diff --git a/.babelrc.js b/.babelrc.js deleted file mode 100644 index 2bf3daf9..00000000 --- a/.babelrc.js +++ /dev/null @@ -1,54 +0,0 @@ -const targets = { - node: 'current', - browsers: [ - 'last 2 Chrome versions', - 'last 2 Edge versions', - 'last 2 Firefox versions', - 'last 2 iOS versions', - 'last 2 Opera versions', - 'last 2 Safari versions', - 'last 2 Samsung versions', - ], -} - -module.exports = { - presets: ['@babel/preset-react', '@babel/preset-typescript'], - env: { - development: { - presets: [ - [ - '@babel/preset-env', - { - loose: true, - modules: 'commonjs', - targets, - }, - ], - ], - }, - rollup: { - presets: [ - [ - '@babel/preset-env', - { - loose: true, - modules: false, - targets, - }, - ], - ], - }, - esm: { - presets: [ - [ - '@babel/preset-env', - { - loose: true, - modules: false, - targets, - }, - ], - ], - }, - }, -} diff --git a/.eslintrc.json b/.eslintrc.json index 70ac14ea..938f0fbd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,7 +36,7 @@ }, "settings": { "react": { - "version": "17.0" + "version": "18.0" } } } diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 35ac135f..fa0b94a6 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,9 +1,9 @@ --- -name: Bug report -about: Report a bug +name: Bug report in v4 +about: Report a bug in v4 --- -## Bug report +## Bug report in v4 **Before** opening an issue, make sure to read the [contributing guide](https://github.com/PaulLeCam/react-leaflet/blob/master/CONTRIBUTING.md) and understand this is a bug tracker, not a support platform. @@ -11,11 +11,11 @@ Please make sure to check the following boxes before submitting an issue.\ **Issues opened without using this template will be closed unless they have a good reason not to follow this template.** - [ ] All peer dependencies are installed: React, ReactDOM and Leaflet. -- [ ] Using a supported version of React and ReactDOM (v17.0.0 minimum). -- [ ] Using the supported version of Leaflet (v1.7.1 minimum) and its corresponding CSS file is loaded. -- [ ] Using the [latest v3 version of React-Leaflet](https://github.com/PaulLeCam/react-leaflet/releases). +- [ ] Using the latest version of React and ReactDOM v18. +- [ ] Using the supported version of Leaflet (v1.8.0 minimum) and its corresponding CSS file is loaded. +- [ ] Using the [latest v4 version of React-Leaflet](https://github.com/PaulLeCam/react-leaflet/releases). - [ ] The issue has not already been reported. -- [ ] Make sure you have followed the [quick start guide](http://leafletjs.com/examples/quick-start.html) for Leaflet. +- [ ] Make sure you have followed the [quick start guide](https://leafletjs.com/examples/quick-start.html) for Leaflet. - [ ] Make sure you have fully read the [documentation](https://react-leaflet.js.org/docs/start-introduction) and that you understand the [limitations](https://react-leaflet.js.org/docs/start-introduction#limitations). ### Expected behavior @@ -28,4 +28,4 @@ Please describe. ### Steps to reproduce -Please provide the simplest example possible to reproduce the issue, based on [this CodePen](https://codepen.io/PaulLeCam/pen/xxOgovP). +Please provide the simplest example possible to reproduce the issue, based on [this CodePen](https://codepen.io/PaulLeCam/pen/OJxEbBW). diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb5b58ec..656b261e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node: ['14.x', '16.x'] + node: ['16.x'] os: [ubuntu-latest, macOS-latest] steps: @@ -25,8 +25,8 @@ jobs: - name: Lint run: yarn run lint - - name: Test and build core - run: yarn run start:core + - name: Build + run: yarn run build - - name: Test and build lib - run: yarn run start:react-leaflet + - name: Test + run: yarn run test --ci diff --git a/.gitignore b/.gitignore index ac00ef44..0eed9183 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules +.turbo .vercel \ No newline at end of file diff --git a/.swcrc b/.swcrc new file mode 100644 index 00000000..c6f1fc62 --- /dev/null +++ b/.swcrc @@ -0,0 +1,9 @@ +{ + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": true + }, + "target": "es2020" + } +} diff --git a/CHANGELOG-v0.x.md b/CHANGELOG-v0.x.md deleted file mode 100644 index e35d5d12..00000000 --- a/CHANGELOG-v0.x.md +++ /dev/null @@ -1,164 +0,0 @@ -## v0.12.3 (2016-09-21) - -Fixed events bindind in UMD build. - -## v0.12.2 (2016-09-09) - -- Updated propTypes to allow polygons with holes in `MultiPolygon` ([PR #218](https://github.com/PaulLeCam/react-leaflet/pull/218) by _ernoaapa_). -- Fixed badly named `ScaleControl` class. - -## v0.12.1 (2016-07-08) - -- Fixed unmounting `LayersControl` when the `Map` is unmounting as well. -- Added a [plugins](docs/Plugins.md) section to the [documentation](docs). - -## v0.12.0 (2016-06-25) - -- [BREAKING] Moved Leaflet instances injection from props to [context](https://facebook.github.io/react/docs/context.html). All components provided by this lib should continue to work as expected, but custom components need to be updated. Read the [UPGRADING](UPGRADING.md) file for more information. -- Deprecated `getLeafletElement()` method, simply use the `leafletElement` property instead. -- Documentation moved to the [docs](docs) folder and has been split into different files for better readability. - -## v0.11.7 (2016-06-14) - -Fixed removing layers from `LayersControl`. - -## v0.11.6 (2016-06-09) - -- Fixed allowing to set and update the `style` prop as a function in `GeoJson`. -- [internal] Added [lodash-webpack-plugin](https://github.com/lodash/lodash-webpack-plugin) to reduce the size of the UMD build. - -## v0.11.5 (2016-05-14) - -- Fixed updating `boundsOptions` in the `Map` without updating `bounds`. -- Fixed setting `opacity` and `zIndex` properties to `0` in tile layers. - -## v0.11.4 (2016-05-05) - -Fixed `TileLayer` properties update. - -## v0.11.3 (2016-04-28) - -Made the `draggable` property in `Marker` dynamic ([PR #148](https://github.com/PaulLeCam/react-leaflet/pull/148) by _riolowry_). - -## v0.11.2 (2016-04-25) - -Fixed layer removal in `LayersControl`. - -## v0.11.1 (2016-04-17) - -Fixed `map` property injection in `LayersControl` ([PR #142](https://github.com/PaulLeCam/react-leaflet/pull/142) by _Dahlgren_). - -## v0.11.0 (2016-04-09) - -- [BREAKING] Added `layerContainer` property as a consistent replacement for `map` or `layerGroup` ([PR #132](https://github.com/PaulLeCam/react-leaflet/pull/132) by _boromisp_). This is only breaking if you are creating custom components, as you will need to make sure to also inject the `layerContainer` property to children layers as you need to do with `map`. -- Changed `LayersControl` to be based on components: - - Added `LayersControl.BaseLayer` container component to add a base layer to a `LayersControl`. - - Added `LayersControl.Overlay` container component to add an overlay to a `LayersControl`. - - `baseLayers` and `overlays` properties for `LayersControl` are still supported but deprecated. Using either of them will make the `LayersControl` behave the same way it does in versions < 0.11. -- Deprecated `onLeaflet...` properties for events, simply use `on...`, ex `onClick` instead of `onLeafletClick`. -- Added warnings for deprecated features, the same way React does. Make sure to address these warnings to ease the transition to future releases. -- Added React v15.0.0 support as peer dependency. -- [internal] Fixed `no-unused-vars` linting ([PR #131](https://github.com/PaulLeCam/react-leaflet/pull/131) by _boromisp_). - -## v0.10.2 (2016-03-12) - -- Added `animate` optional property to `Map` ([PR #126](https://github.com/PaulLeCam/react-leaflet/pull/126) by _mariusandra_). -- Added React v15.0.0-rc.1 support as peer dependency. - -## v0.10.1 (2016-02-22) - -- Added the popup container as source layer to `Popup` creation, fixes [#113](https://github.com/PaulLeCam/react-leaflet/issues/113) ([PR #112](https://github.com/PaulLeCam/react-leaflet/pull/112) by _amarant_). -- [internal] Updated Lodash to v4. - -## v0.10.0 (2015-12-22) - -- Added `AttributionControl`, `LayersControl` and `ScaleControl` ([PR #100](https://github.com/PaulLeCam/react-leaflet/pull/100) by _jonboiser_). -- Added example to render a list of custom Markers ([PR #104](https://github.com/PaulLeCam/react-leaflet/pull/104) by _varya_). -- [internal] Updated Babel to v6. - -## v0.9.0 (2015-11-12) - -- Removed `PopupContainer` component, extended internally by other components. -- `FeatureGroup` now expects its layers to be passed as children, like `LayerGroup`. -- Added `renderChildrenWithProps()` to `MapLayer`, used internally by the library. -- Added `MapControl` as base component for controls. -- Added `ZoomControl`. - -## v0.8.1 (2015-10-21) - -Fix `PropTypes` export. - -## v0.8.0 (2015-10-07) - -Changes from v0.7.0: - -- Updated React to v0.14.0. -- Added ReactDOM v0.14.0 to peer dependencies. -- `Popup` now renders its contents using `ReactDOM.render()` and therefore supports dynamic children. -- `Map` now supports dynamic `bounds` and `maxBounds` properties ([#72](https://github.com/PaulLeCam/react-leaflet/pull/72)). -- Added `LayerGroup` component ([#58](https://github.com/PaulLeCam/react-leaflet/pull/58)). - -## v0.8.0-rc.3 (2015-09-29) - -- Added `LayerGroup` component ([#58](https://github.com/PaulLeCam/react-leaflet/pull/58)). -- `Map` now supports dynamic `bounds` and `maxBounds` properties ([#72](https://github.com/PaulLeCam/react-leaflet/pull/72)). - -## v0.8.0-rc.2 (2015-09-22) - -Check if `Popup` content node exists before trying to unmount. - -## v0.8.0-rc.1 (2015-09-16) - -- Updated React to v0.14.0-rc1. -- Added ReactDOM v0.14.0-rc1 to peer dependencies. -- `Popup` now renders its contents using `ReactDOM.render()` and therefore supports dynamic children. - -## v0.7.0 (2015-09-08) - -- Updated Leaflet to v0.7.5. -- Added `Path` base component for vector layers, handling dynamic [Path options](http://leafletjs.com/reference.html#path-options) properties. -- Added support for holes in `Polygon`. -- [internal] Updated Jest to v0.5. -- [internal] Updated Gulpfile to use Babel. -- [internal] Added ESLint validation. - -## v0.6.2 (2015-06-14) - -Fix ignored events in `MapComponent` -([#41](https://github.com/PaulLeCam/react-leaflet/pull/41)). - -## v0.6.1 (2015-05-22) - -Fix `PopupContainer` export. - -## v0.6.0 (2015-05-18) - -- Added `style` property on the `Map` component. -- Replaced the `