react-leaflet-deflate 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -35
- package/LICENSE +19 -19
- package/README.md +116 -89
- package/dist/react-leaflet-deflate.js +70 -85
- package/dist/react-leaflet-deflate.min.js +1 -1
- package/dist/react-leaflet-deflate.min.js.LICENSE.txt +9 -9
- package/docs/App.jsx +299 -299
- package/docs/css/business-frontpage.css +8 -8
- package/docs/geojsonSamples.js +149 -149
- package/docs/index.html +132 -132
- package/docs/vendor/bootstrap/css/bootstrap.css +9886 -9886
- package/docs/vendor/bootstrap/css/bootstrap.min.css +6 -6
- package/docs/vendor/bootstrap/js/bootstrap.bundle.js +6818 -6818
- package/docs/vendor/bootstrap/js/bootstrap.bundle.min.js +6 -6
- package/docs/vendor/bootstrap/js/bootstrap.js +4249 -4249
- package/docs/vendor/bootstrap/js/bootstrap.min.js +6 -6
- package/docs/vendor/jquery/jquery.js +10364 -10364
- package/docs/vendor/jquery/jquery.min.js +2 -2
- package/docs/vendor/jquery/jquery.slim.js +8269 -8269
- package/docs/vendor/jquery/jquery.slim.min.js +2 -2
- package/lib/Deflate.js +7 -7
- package/package.json +86 -87
- package/playwright.config.js +17 -0
- package/tests/e2e/deflate.spec.js +48 -0
- package/tests/e2e/empty-module.js +1 -0
- package/tests/e2e/fixture.jsx +120 -0
- package/tests/e2e/index.html +20 -0
- package/tests/e2e/server.js +42 -0
- package/webpack.e2e.config.js +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,35 +1,44 @@
|
|
|
1
|
-
react-leaflet-deflate Changelog
|
|
2
|
-
=========================
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## 3.
|
|
12
|
-
|
|
13
|
-
* NPM Audit Fix
|
|
14
|
-
|
|
15
|
-
## 3.
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
* Update
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
1
|
+
react-leaflet-deflate Changelog
|
|
2
|
+
=========================
|
|
3
|
+
|
|
4
|
+
## 3.1.3 (2026-11-14)
|
|
5
|
+
|
|
6
|
+
* Fix UMD build runtime error when `markerCluster` is enabled: use Leaflet's `DomUtil.addClass` instead of the mis-externalized `@react-leaflet/core` helper.
|
|
7
|
+
* Remove unused dependencies.
|
|
8
|
+
* Add `react` to `peerDependencies`.
|
|
9
|
+
* Align `jest-environment-jsdom` with Jest 29.
|
|
10
|
+
|
|
11
|
+
## 3.1.2 (2026-01-11)
|
|
12
|
+
|
|
13
|
+
* NPM Audit Fix
|
|
14
|
+
|
|
15
|
+
## 3.1.0 (2025-12-05)
|
|
16
|
+
|
|
17
|
+
* Add gh-pages docs
|
|
18
|
+
* Update dependencies
|
|
19
|
+
|
|
20
|
+
## 3.0.1 (2025-11-28)
|
|
21
|
+
|
|
22
|
+
* NPM Audit Fix
|
|
23
|
+
|
|
24
|
+
## 3.0.0 (2025-11-07)
|
|
25
|
+
|
|
26
|
+
* Update Leaflet.Deflate dependency to 2.1.0.
|
|
27
|
+
* Update Leaflet dependency to 1.9.4
|
|
28
|
+
* Update react-leaflet dependency to 5.0.0
|
|
29
|
+
* Update react dependency to 19.2.0
|
|
30
|
+
|
|
31
|
+
## 2.2.1 (2019-02-11)
|
|
32
|
+
|
|
33
|
+
* Update Leaflet.Deflate dependency to 1.1.0 ([PR #5](https://github.com/mhasbie/react-leaflet-deflate/pull/5) by _oliverroick_).
|
|
34
|
+
* Remove unused dependencies
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## 2.2.0 (2019-01-20)
|
|
38
|
+
|
|
39
|
+
* Make compatible with `react-leaflet@2.x`
|
|
40
|
+
* Update dependencies
|
|
41
|
+
* Update README
|
|
42
|
+
* Add example
|
|
43
|
+
* Add unit test
|
|
44
|
+
* Bugs fixes
|
package/LICENSE
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,89 +1,116 @@
|
|
|
1
|
-
# react-leaflet-deflate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[](http://npm.im/react-leaflet-deflate)
|
|
5
|
-
[](https://github.com/mhasbie/react-leaflet-deflate)
|
|
6
|
-
[](https://github.com/mhasbie/react-leaflet-deflate/issues)
|
|
7
|
-
[](http://npm-stat.com/charts.html?package=react-leaflet-deflate&from=2018-01-01)
|
|
8
|
-
[](http://opensource.org/licenses/MIT)
|
|
9
|
-
|
|
10
|
-
React wrapper of [Leaflet.Deflate](
|
|
11
|
-
https://github.com/oliverroick/Leaflet.Deflate)
|
|
12
|
-
for [react-leaflet](https://github.com/PaulLeCam/react-leaflet).
|
|
13
|
-
|
|
14
|
-
Substitutes polygons and lines with markers when their screen size falls below a defined threshold.
|
|
15
|
-
|
|
16
|
-
*Tested with React 19.2.0, Leaflet 1.9.4, React-Leaflet 5.0.0, React-Leaflet 4.0.0, Leaflet.Deflate 2.1.0*
|
|
17
|
-
|
|
18
|
-

|
|
19
|
-
|
|
20
|
-
## Demos
|
|
21
|
-
|
|
22
|
-
| Version | Demo |
|
|
23
|
-
| --- | --- |
|
|
24
|
-
| `react-leaflet@1.9.1` | [`CodePen`](https://codepen.io/m_hasbie/full/jvgeVR/) |
|
|
25
|
-
| `react-leaflet@2.x` | [`CodePen`](https://codepen.io/m_hasbie/full/MqNPRy/) |
|
|
26
|
-
| `react-leaflet@5.x` | [`CodePen`](https://codepen.io/m_hasbie/full/wBGampr) |
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
### Install via NPM
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm install --save react-leaflet-deflate
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`react-leaflet-deflate` requires `leaflet.markercluster` as [`peerDependency`](https://docs.npmjs.com/files/package.json#peerdependencies)
|
|
38
|
-
|
|
39
|
-
(React, Leaflet, react-leaflet also should be installed)
|
|
40
|
-
```bash
|
|
41
|
-
npm install --save leaflet.markercluster
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
##
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
`
|
|
77
|
-
`
|
|
78
|
-
`
|
|
79
|
-
`
|
|
80
|
-
`
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
# react-leaflet-deflate
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
[](http://npm.im/react-leaflet-deflate)
|
|
5
|
+
[](https://github.com/mhasbie/react-leaflet-deflate)
|
|
6
|
+
[](https://github.com/mhasbie/react-leaflet-deflate/issues)
|
|
7
|
+
[](http://npm-stat.com/charts.html?package=react-leaflet-deflate&from=2018-01-01)
|
|
8
|
+
[](http://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
React wrapper of [Leaflet.Deflate](
|
|
11
|
+
https://github.com/oliverroick/Leaflet.Deflate)
|
|
12
|
+
for [react-leaflet](https://github.com/PaulLeCam/react-leaflet).
|
|
13
|
+
|
|
14
|
+
Substitutes polygons and lines with markers when their screen size falls below a defined threshold.
|
|
15
|
+
|
|
16
|
+
*Tested with React 19.2.0, Leaflet 1.9.4, React-Leaflet 5.0.0, React-Leaflet 4.0.0, Leaflet.Deflate 2.1.0*
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
## Demos
|
|
21
|
+
|
|
22
|
+
| Version | Demo |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `react-leaflet@1.9.1` | [`CodePen`](https://codepen.io/m_hasbie/full/jvgeVR/) |
|
|
25
|
+
| `react-leaflet@2.x` | [`CodePen`](https://codepen.io/m_hasbie/full/MqNPRy/) |
|
|
26
|
+
| `react-leaflet@5.x` | [`CodePen`](https://codepen.io/m_hasbie/full/wBGampr) |
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
### Install via NPM
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install --save react-leaflet-deflate
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`react-leaflet-deflate` requires `leaflet.markercluster` as [`peerDependency`](https://docs.npmjs.com/files/package.json#peerdependencies)
|
|
38
|
+
|
|
39
|
+
(React, Leaflet, react-leaflet also should be installed)
|
|
40
|
+
```bash
|
|
41
|
+
npm install --save leaflet.markercluster
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Releases
|
|
45
|
+
|
|
46
|
+
Merging a pull request into `master` runs the release workflow. Before merging a release PR, update the version in both `package.json` and `package-lock.json`. The workflow uses that version to stage the package on npm and create the GitHub Release tag (`v<version>`), and stops if the tag already exists. The GitHub Release is created when staging succeeds; the npm version is not publicly available until it is approved.
|
|
47
|
+
|
|
48
|
+
## Usage example
|
|
49
|
+
|
|
50
|
+
### react-leaflet v5
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
import { MapContainer, TileLayer } from 'react-leaflet';
|
|
54
|
+
import Deflate from 'react-leaflet-deflate';
|
|
55
|
+
|
|
56
|
+
const geojson = {...};
|
|
57
|
+
|
|
58
|
+
<MapContainer center={[2.935403, 101.448205]} zoom={10}>
|
|
59
|
+
<TileLayer
|
|
60
|
+
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
61
|
+
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<Deflate
|
|
65
|
+
data={geojson}
|
|
66
|
+
minSize={10}
|
|
67
|
+
markerCluster={true}
|
|
68
|
+
/>
|
|
69
|
+
</MapContainer>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Options
|
|
73
|
+
|
|
74
|
+
Option | Type | Default | Description
|
|
75
|
+
--------------- | --------- | ------- | -------------
|
|
76
|
+
`data` | `object` | `{}` | Required. A valid [GeoJSON object](http://geojson.org/geojson-spec.html).
|
|
77
|
+
`minSize` | `int` | `20` | Defines the minimum width and height in pixels for a path to be displayed in its actual shape.
|
|
78
|
+
`markerOptions` | `object` or `function` | `{}` | Optional. Customize the markers of deflated features using [Leaflet marker options](http://leafletjs.com/reference-1.3.0.html#marker).
|
|
79
|
+
`markerCluster` | `boolean` | `false` | Indicates whether markers should be clustered. Requires `Leaflet.markercluster`.
|
|
80
|
+
`markerClusterOptions` | `object` | `{}` | Optional. Customize the appearance and behaviour of clustered markers using [`Leaflet.markercluster` options](https://github.com/Leaflet/Leaflet.markercluster#options).
|
|
81
|
+
`pointToLayer` | `function` | `{}` | [Leaflet geojson pointToLayer options](http://leafletjs.com/reference-1.3.0.html#geojson-pointtolayer).
|
|
82
|
+
`style` | `function` | `{}` | Style to apply to polygons or lines. [Leaflet geojson style options](https://leafletjs.com/reference.html#geojson-style).
|
|
83
|
+
`onEachFeature` | `function` | `{}` | Function to execute on each geojson feature. [Leaflet geojson onEachFeature options](https://leafletjs.com/reference.html#geojson-oneachfeature).
|
|
84
|
+
`filter` | `function` | `{}` | Filter function to apply to geojson features. [Leaflet geojson filter options](https://leafletjs.com/reference.html#geojson-filter).
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# Credits
|
|
88
|
+
- [oliverroick](https://github.com/oliverroick) and the other [contributors](https://github.com/oliverroick/Leaflet.Deflate/graphs/contributors) to for the original work on `Leaflet.Deflate`.
|
|
89
|
+
- [clintharris](https://github.com/clintharris) for updating `react-leaflet-deflate` to reference `Leaflet.Deflate` as an external dependency, support property changes, and work with `react-leaflet` v2.
|
|
90
|
+
|
|
91
|
+
# Tests
|
|
92
|
+
|
|
93
|
+
For instructions on the browser debug example, see [example/README.md](example/README.md).
|
|
94
|
+
|
|
95
|
+
Run the Jest/React Testing Library unit suite with:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm test
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The Playwright tests run a local Leaflet fixture without external tiles or CDN dependencies. Install the Chromium browser once, then run:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx playwright install chromium
|
|
105
|
+
npm run test:e2e
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
To run both suites:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm run test:all
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
# License
|
|
115
|
+
|
|
116
|
+
MIT License
|