Skip to content

Commit

Permalink
v3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulLeCam committed Aug 1, 2021
1 parent 40a46c1 commit 7c63621
Show file tree
Hide file tree
Showing 13 changed files with 3,043 additions and 3,113 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['14.x']
node: ['14.x', '16.x']
os: [ubuntu-latest, macOS-latest]

steps:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v3.2.1 (2021-08-01)

- Fix `Popup` unmounting logic to unbind from container.
- Fix links to point to Leaflet 1.7.1 docs ([PR #889](https://github.com/PaulLeCam/react-leaflet/pull/889) by [zerekw](https://github.com/zerekw)).

## v3.2.0 (2021-05-15)

- Change unmounting logic for some layers, which should fix issues related to removing or updating elements.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# React Leaflet [![npm version](https://img.shields.io/npm/v/react-leaflet.svg)](https://www.npmjs.com/package/react-leaflet) [![CDNJS version](https://img.shields.io/cdnjs/v/react-leaflet.svg)](https://cdnjs.com/libraries/react-leaflet)
# React Leaflet [![npm version](https://img.shields.io/npm/v/react-leaflet.svg)](https://www.npmjs.com/package/react-leaflet)

React components for Leaflet maps.

Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,43 @@
"start": "yarn run lint && yarn run start:core && yarn run start:react-leaflet"
},
"devDependencies": {
"@babel/cli": "^7.13.10",
"@babel/core": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-export-default-from": "^7.12.13",
"@babel/plugin-transform-proto-to-assign": "^7.12.13",
"@babel/plugin-transform-strict-mode": "^7.12.13",
"@babel/preset-env": "^7.13.10",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.13.0",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^5.1.0",
"@types/jest": "^26.0.21",
"@types/leaflet": "^1.7.0",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.5",
"@babel/cli": "^7.14.8",
"@babel/core": "^7.14.8",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-export-default-from": "^7.14.5",
"@babel/plugin-transform-proto-to-assign": "^7.14.5",
"@babel/plugin-transform-strict-mode": "^7.14.5",
"@babel/preset-env": "^7.14.9",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.14.5",
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^7.0.1",
"@types/jest": "^26.0.24",
"@types/leaflet": "^1.7.4",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.9",
"@types/warning": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
"babel-eslint": "^10.0.3",
"babel-jest": "^26.6.1",
"babel-jest": "^27.0.6",
"cross-env": "^7.0.3",
"del-cli": "^3.0.1",
"eslint": "^7.22.0",
"del-cli": "^4.0.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.23.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.1",
"jest": "^27.0.6",
"leaflet": "^1.7.1",
"prettier": "^2.2.1",
"prettier-eslint": "^12.0.0",
"prettier": "^2.3.2",
"prettier-eslint": "^13.0.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-test-renderer": "^17.0.1",
"typescript": "^4.2.3"
"typescript": "^4.3.5"
}
}
3 changes: 3 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@
"leaflet": "^1.7.1",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"jest": {
"testEnvironment": "jsdom"
}
}
5 changes: 3 additions & 2 deletions packages/core/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export interface LeafletContextInterface {
pane?: string
}

export const LeafletContext =
createContext<LeafletContextInterface | null>(null)
export const LeafletContext = createContext<LeafletContextInterface | null>(
null,
)

export const LeafletProvider = LeafletContext.Provider

Expand Down
13 changes: 8 additions & 5 deletions packages/react-leaflet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-leaflet",
"version": "3.2.0",
"version": "3.2.1",
"description": "React components for Leaflet maps",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down Expand Up @@ -52,10 +52,13 @@
},
"devDependencies": {
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-replace": "^2.3.4",
"rollup": "^2.48.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-replace": "^3.0.0",
"rollup": "^2.55.1",
"rollup-plugin-terser": "^7.0.0"
},
"jest": {
"testEnvironment": "jsdom"
}
}
1 change: 1 addition & 0 deletions packages/react-leaflet/src/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const Popup = createOverlayComponent<LeafletPopup, PopupProps>(
popupopen: onPopupOpen,
popupclose: onPopupClose,
})
context.overlayContainer?.unbindPopup()
context.map.removeLayer(instance)
}
},
Expand Down
1 change: 1 addition & 0 deletions packages/website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
tagline: 'React components for Leaflet maps',
url: 'https://react-leaflet.js.org',
baseUrl: '/',
trailingSlash: true,
favicon: 'img/logo.svg',
organizationName: 'PaulLeCam',
projectName: 'react-leaflet',
Expand Down
8 changes: 4 additions & 4 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
"deploy": "docusaurus deploy"
},
"dependencies": {
"@docusaurus/core": "^2.0.0-beta.0",
"@docusaurus/preset-classic": "2.0.0-beta.0",
"@docusaurus/theme-live-codeblock": "2.0.0-beta.0",
"@docusaurus/core": "^2.0.0-beta.4",
"@docusaurus/preset-classic": "2.0.0-beta.4",
"@docusaurus/theme-live-codeblock": "2.0.0-beta.4",
"@react-leaflet/docusaurus-plugin": "^1.0.1",
"classnames": "^2.2.6",
"leaflet": "^1.7.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-leaflet": "^3.2.0",
"typescript": "^4.2.3"
"typescript": "^4.3.5"
},
"browserslist": {
"production": [
Expand Down
131 changes: 131 additions & 0 deletions packages/website/src/theme/DocItem/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import clsx from 'clsx';
import {useActivePlugin, useVersions} from '@theme/hooks/useDocs';
import useWindowSize from '@theme/hooks/useWindowSize';
import DocPaginator from '@theme/DocPaginator';
import DocVersionBanner from '@theme/DocVersionBanner';
import Seo from '@theme/Seo';
import LastUpdated from '@theme/LastUpdated';
import TOC from '@theme/TOC';
import TOCCollapsible from '@theme/TOCCollapsible';
import EditThisPage from '@theme/EditThisPage';
import {MainHeading} from '@theme/Heading';
import styles from './styles.module.css';

function DocItem(props) {
const {content: DocContent, versionMetadata} = props;
const {metadata, frontMatter} = DocContent;
const {
image,
keywords,
hide_title: hideTitle,
hide_table_of_contents: hideTableOfContents,
} = frontMatter;
const {
description,
title,
editUrl,
lastUpdatedAt,
formattedLastUpdatedAt,
lastUpdatedBy,
} = metadata;
const {pluginId} = useActivePlugin({
failfast: true,
});
const versions = useVersions(pluginId); // If site is not versioned or only one version is included
// we don't show the version badge
// See https://github.com/facebook/docusaurus/issues/3362

const showVersionBadge = versions.length > 1; // We only add a title if:
// - user asks to hide it with frontmatter
// - the markdown content does not already contain a top-level h1 heading

const shouldAddTitle =
!hideTitle && typeof DocContent.contentTitle === 'undefined';
const windowSize = useWindowSize();
const canRenderTOC =
!hideTableOfContents && DocContent.toc && DocContent.toc.length > 0;
const renderTocDesktop =
canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
return (
<>
<Seo
{...{
title,
description,
keywords,
image,
}}
/>

<div className="row">
<div
className={clsx('col', {
[styles.docItemCol]: !hideTableOfContents,
})}>
<DocVersionBanner versionMetadata={versionMetadata} />
<div className={styles.docItemContainer}>
<article>
{showVersionBadge && (
<span className="badge badge--secondary">
Version: {versionMetadata.label}
</span>
)}

{canRenderTOC && (
<TOCCollapsible
toc={DocContent.toc}
className={styles.tocMobile}
/>
)}

<div className="markdown">
{/*
Title can be declared inside md content or declared through frontmatter and added manually
To make both cases consistent, the added title is added under the same div.markdown block
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
*/}
{shouldAddTitle && <MainHeading>{title}</MainHeading>}

<DocContent />
</div>

{(editUrl || lastUpdatedAt || lastUpdatedBy) && (
<footer className="row docusaurus-mt-lg">
<div className="col">
{editUrl && <EditThisPage editUrl={editUrl} />}
</div>

<div className={clsx('col', styles.lastUpdated)}>
{(lastUpdatedAt || lastUpdatedBy) && (
<LastUpdated
lastUpdatedAt={lastUpdatedAt}
formattedLastUpdatedAt={formattedLastUpdatedAt}
lastUpdatedBy={lastUpdatedBy}
/>
)}
</div>
</footer>
)}
</article>

<DocPaginator metadata={metadata} />
</div>
</div>
{renderTocDesktop && (
<div className="col col--3">
<TOC toc={DocContent.toc} />
</div>
)}
</div>
</>
);
}

export default DocItem;
32 changes: 32 additions & 0 deletions packages/website/src/theme/DocItem/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

.docItemContainer article > *:first-child,
.docItemContainer header + * {
margin-top: 0;
}

.lastUpdated {
margin-top: 0.2rem;
font-style: italic;
font-size: smaller;
}

@media only screen and (min-width: 997px) {
.docItemCol {
max-width: 75% !important;
}

.lastUpdated {
text-align: right;
}

/* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
.tocMobile {
display: none;
}
}
Loading

0 comments on commit 7c63621

Please sign in to comment.