react-leaflet-d3 2.0.0 → 3.0.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/.github/workflows/pr-tests.yml +66 -0
- package/.github/workflows/release.yml +63 -0
- package/CHANGELOG.md +20 -10
- package/LICENSE +19 -19
- package/README.md +107 -184
- package/dist/react-leaflet-d3.min.js +2 -3
- package/dist/react-leaflet-d3.min.js.LICENSE.txt +9 -0
- package/docs/App.jsx +184 -0
- package/docs/data.js +1 -0
- package/docs/index.html +175 -0
- package/package.json +92 -66
- package/playwright.config.js +17 -0
- package/tests/e2e/fixture.css +11 -0
- package/tests/e2e/fixture.jsx +102 -0
- package/tests/e2e/index.html +12 -0
- package/tests/e2e/layers.spec.js +53 -0
- package/tests/e2e/server.js +45 -0
- package/webpack.e2e.config.js +27 -0
- package/lib/HexbinLayer.js +0 -27
- package/lib/PingLayer.js +0 -18
- package/lib/index.js +0 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: PR Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [master]
|
|
6
|
+
types: [opened, synchronize, reopened]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test-unit:
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
include:
|
|
17
|
+
- name: React Leaflet 4
|
|
18
|
+
react: "18.3.1"
|
|
19
|
+
react_dom: "18.3.1"
|
|
20
|
+
react_leaflet: "4.2.1"
|
|
21
|
+
react_leaflet_core: "2.1.0"
|
|
22
|
+
- name: React Leaflet 5
|
|
23
|
+
react: "19.2.3"
|
|
24
|
+
react_dom: "19.2.3"
|
|
25
|
+
react_leaflet: "5.0.0"
|
|
26
|
+
react_leaflet_core: "3.0.0"
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- name: Check out repository
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
|
|
32
|
+
- name: Set up Node.js
|
|
33
|
+
uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: 22
|
|
36
|
+
cache: npm
|
|
37
|
+
|
|
38
|
+
- name: Install dependencies
|
|
39
|
+
run: npm ci
|
|
40
|
+
|
|
41
|
+
- name: Install ${{ matrix.name }} compatibility versions
|
|
42
|
+
run: npm install --no-save --package-lock=false --legacy-peer-deps react@${{ matrix.react }} react-dom@${{ matrix.react_dom }} react-leaflet@${{ matrix.react_leaflet }} @react-leaflet/core@${{ matrix.react_leaflet_core }}
|
|
43
|
+
|
|
44
|
+
- name: Run unit tests
|
|
45
|
+
run: npm run test:unit
|
|
46
|
+
|
|
47
|
+
test-e2e:
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- name: Check out repository
|
|
51
|
+
uses: actions/checkout@v4
|
|
52
|
+
|
|
53
|
+
- name: Set up Node.js
|
|
54
|
+
uses: actions/setup-node@v4
|
|
55
|
+
with:
|
|
56
|
+
node-version: 22
|
|
57
|
+
cache: npm
|
|
58
|
+
|
|
59
|
+
- name: Install dependencies
|
|
60
|
+
run: npm ci
|
|
61
|
+
|
|
62
|
+
- name: Install Playwright Chromium
|
|
63
|
+
run: npx playwright install --with-deps chromium
|
|
64
|
+
|
|
65
|
+
- name: Run Playwright tests
|
|
66
|
+
run: npm run test:e2e
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Check out pushed commit
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
persist-credentials: false
|
|
20
|
+
|
|
21
|
+
- name: Set up Node.js
|
|
22
|
+
uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: 22
|
|
25
|
+
|
|
26
|
+
- name: Set up npm trusted publishing
|
|
27
|
+
run: npm install --global npm@11.15.0
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: npm ci
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: npm test
|
|
34
|
+
|
|
35
|
+
- name: Build package
|
|
36
|
+
run: npm run build
|
|
37
|
+
|
|
38
|
+
- name: Read version and check release tag
|
|
39
|
+
id: release
|
|
40
|
+
shell: bash
|
|
41
|
+
run: |
|
|
42
|
+
VERSION="$(node -p "require('./package.json').version")"
|
|
43
|
+
TAG="v${VERSION}"
|
|
44
|
+
|
|
45
|
+
if [ -z "$VERSION" ]; then
|
|
46
|
+
echo "::error::package.json does not specify a version."
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
if git rev-parse --quiet --verify "refs/tags/${TAG}" >/dev/null; then
|
|
51
|
+
echo "::error::Release tag ${TAG} already exists. Bump package.json before merging another release PR."
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
|
56
|
+
|
|
57
|
+
- name: Stage package on npm
|
|
58
|
+
run: npm stage publish --ignore-scripts
|
|
59
|
+
|
|
60
|
+
- name: Create GitHub Release
|
|
61
|
+
run: gh release create "${{ steps.release.outputs.tag }}" --target "$(git rev-parse HEAD)" --title "${{ steps.release.outputs.tag }}" --generate-notes
|
|
62
|
+
env:
|
|
63
|
+
GH_TOKEN: ${{ github.token }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
react-leaflet-d3 Changelog
|
|
2
|
-
=========================
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
1
|
+
react-leaflet-d3 Changelog
|
|
2
|
+
=========================
|
|
3
|
+
|
|
4
|
+
## 3.0.0
|
|
5
|
+
|
|
6
|
+
* Replace deprecated `@asymmetrik/leaflet-d3` with `@bluehalo/leaflet-d3` 6.x; D3 v7 is required and D3 v5 is no longer supported
|
|
7
|
+
* Migrate PingLayer and HexbinLayer to the React Leaflet v4/v5 hook API
|
|
8
|
+
* Fix layer mounting, LayersControl toggling, and unmount cleanup
|
|
9
|
+
* Fix HexbinLayer data updates and safely handle empty or invalid GeoJSON data
|
|
10
|
+
* Support React 18/19 and Leaflet 1.9+
|
|
11
|
+
* Remove support for React Leaflet 1.x and 2.x
|
|
12
|
+
* Modernize build and test dependencies
|
|
13
|
+
* Remove unused dependencies and address dependency audit findings
|
|
14
|
+
|
|
15
|
+
## 2.0.0 (2019-01-12)
|
|
16
|
+
|
|
17
|
+
* Make compatible with `react-leaflet@2.x`
|
|
18
|
+
* Update dependencies
|
|
19
|
+
* Update README
|
|
20
|
+
* Add example
|
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,184 +1,107 @@
|
|
|
1
|
-
# react-leaflet-d3
|
|
2
|
-
|
|
3
|
-
[![
|
|
4
|
-
[![
|
|
5
|
-
[![
|
|
6
|
-
[![
|
|
7
|
-
[![
|
|
8
|
-
|
|
9
|
-
[
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
`radiusRange` | `array` | `[ 4, 12 ]` | Sets the range of the radius scale used to size the hexbins on the layer.
|
|
109
|
-
`pointerEvents` | `string` | `all` | This value is passed directly to an element-level css style for `pointer-events`. You should only modify this config option if you want to change the mouse event behavior on hexbins. This will modify when the events are propagated based on the visibility state and/or part of the hexbin being hovered.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### PingLayer (with react-leaflet v1)
|
|
113
|
-
|
|
114
|
-
```javascript
|
|
115
|
-
import { Map, TileLayer } from 'react-leaflet';
|
|
116
|
-
import { PingLayer } from 'react-leaflet-d3';
|
|
117
|
-
|
|
118
|
-
ping() {
|
|
119
|
-
this.pingLayer.ping([101.448205, 2.935403], 'myCustomCssClass');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
<Map center={[2.935403, 101.448205]} zoom={10}>
|
|
123
|
-
<TileLayer
|
|
124
|
-
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
125
|
-
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
|
126
|
-
/>
|
|
127
|
-
|
|
128
|
-
<PingLayer ref={(ref) => { this.pingLayer = ref; }} radiusRange={[3, 50]} />
|
|
129
|
-
</Map>
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### PingLayer (with react-leaflet v2)
|
|
134
|
-
|
|
135
|
-
```javascript
|
|
136
|
-
import { Map, TileLayer, withLeaflet } from 'react-leaflet';
|
|
137
|
-
import { PingLayer } from 'react-leaflet-d3';
|
|
138
|
-
const WrappedPingLayer = withLeaflet(PingLayer);
|
|
139
|
-
|
|
140
|
-
ping() {
|
|
141
|
-
this.pingLayer.ping([101.448205, 2.935403], 'myCustomCssClass');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
<Map center={[2.935403, 101.448205]} zoom={10}>
|
|
145
|
-
<TileLayer
|
|
146
|
-
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
147
|
-
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
|
148
|
-
/>
|
|
149
|
-
|
|
150
|
-
{/* Use <WrappedPingLayer> where you would have used <PingLayer>. */}
|
|
151
|
-
<WrappedPingLayer ref={(ref) => { this.pingLayer = ref; }} radiusRange={[3, 50]} />
|
|
152
|
-
</Map>
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
#### Options [Ping options](https://github.com/Asymmetrik/leaflet-d3#options-1)
|
|
156
|
-
|
|
157
|
-
Option | Type | Default | Description
|
|
158
|
-
--------------- | --------- | ------- | -------------
|
|
159
|
-
`duration` | `int` | `800 ` | Sets the transition duration for the ping layer.
|
|
160
|
-
`fps` | `int` | `32` | Sets the target framerate for the ping animation.
|
|
161
|
-
`opacityRange` | `array` | `[ 1, 0 ]` | Sets the range of the opacity scale used to fade out the pings as they age.
|
|
162
|
-
`radiusRange` | `array` | `[ 3, 15 ]` | Sets the range of the radius scale used to size the pings as they age.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
#### API
|
|
166
|
-
|
|
167
|
-
[Ping API](https://github.com/Asymmetrik/leaflet-d3#lpinglayer)
|
|
168
|
-
|
|
169
|
-
##### pingLayer.ping(coordinates, cssClassName) - [doc](https://github.com/Asymmetrik/leaflet-d3#pinglayerpingvalue-)
|
|
170
|
-
|
|
171
|
-
Submit a ping to the layer. The default data schema for the ping layer is:
|
|
172
|
-
|
|
173
|
-
`[ [ lng1, lat1 ], [ lng2, lat2 ], [ lng3, lat3 ]... [ lngN, latN ] ]`
|
|
174
|
-
|
|
175
|
-
Where the ping radius scale factor is fixed at 1.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
# Credits
|
|
180
|
-
Credits goes to all the [contributors](https://github.com/Asymmetrik/leaflet-d3/graphs/contributors) for the original work.
|
|
181
|
-
|
|
182
|
-
# License
|
|
183
|
-
|
|
184
|
-
MIT License
|
|
1
|
+
# react-leaflet-d3
|
|
2
|
+
|
|
3
|
+
[](http://npm.im/react-leaflet-d3)
|
|
4
|
+
[](https://github.com/mhasbie/react-leaflet-d3)
|
|
5
|
+
[](https://github.com/mhasbie/react-leaflet-d3/issues)
|
|
6
|
+
[](http://npm-stat.com/charts.html?package=react-leaflet-d3&from=2018-01-01)
|
|
7
|
+
[](http://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
React wrappers for [@bluehalo/leaflet-d3](https://github.com/bluehalo/leaflet-d3), a collection of D3.js visualizations for Leaflet. This release requires D3 v7.
|
|
10
|
+
|
|
11
|
+
Try the [live demo](https://mhasbie.github.io/react-leaflet-d3/).
|
|
12
|
+
|
|
13
|
+
CodePen demos:
|
|
14
|
+
|
|
15
|
+
- [Hexbin](https://codepen.io/m_hasbie/pen/ramoZmo)
|
|
16
|
+
- [Ping](https://codepen.io/m_hasbie/pen/pvPqOPK)
|
|
17
|
+
|
|
18
|
+
Compatible with React 18 or 19 and React Leaflet 4 or 5.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install react-leaflet-d3 react react-dom react-leaflet leaflet d3 d3-hexbin
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Customize the visualization styles using the [Leaflet D3 CSS guidance](https://github.com/bluehalo/leaflet-d3#styling).
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import { useRef } from 'react';
|
|
32
|
+
import { MapContainer, TileLayer } from 'react-leaflet';
|
|
33
|
+
import { HexbinLayer, PingLayer } from 'react-leaflet-d3';
|
|
34
|
+
|
|
35
|
+
function Example({ geoJsonData }) {
|
|
36
|
+
const pingRef = useRef(null);
|
|
37
|
+
|
|
38
|
+
function addPing() {
|
|
39
|
+
pingRef.current.ping([101.448205, 2.935403], 'myCustomCssClass');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<button onClick={addPing}>Ping</button>
|
|
45
|
+
<MapContainer
|
|
46
|
+
center={[2.935403, 101.448205]}
|
|
47
|
+
zoom={10}
|
|
48
|
+
style={{ height: '400px' }}
|
|
49
|
+
>
|
|
50
|
+
<TileLayer
|
|
51
|
+
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
52
|
+
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
53
|
+
/>
|
|
54
|
+
<HexbinLayer
|
|
55
|
+
data={geoJsonData}
|
|
56
|
+
colorRange={['#f7fbff', '#ff0000']}
|
|
57
|
+
radiusRange={[5, 12]}
|
|
58
|
+
/>
|
|
59
|
+
<PingLayer ref={pingRef} radiusRange={[3, 50]} />
|
|
60
|
+
</MapContainer>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`geoJsonData` must be a GeoJSON FeatureCollection. HexbinLayer currently uses Point features only.
|
|
67
|
+
|
|
68
|
+
## HexbinLayer options
|
|
69
|
+
|
|
70
|
+
See the [Leaflet D3 hexbin API](https://github.com/bluehalo/leaflet-d3/blob/master/docs/API.md#hexbins-api).
|
|
71
|
+
|
|
72
|
+
| Option | Type | Default | Description |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| `data` | `object` | `{}` | Required GeoJSON FeatureCollection; Point features are used. |
|
|
75
|
+
| `radius` | `int` | `12` | Hexbin radius. |
|
|
76
|
+
| `opacity` | `float` | `0.6` | Layer opacity. |
|
|
77
|
+
| `duration` | `int` | `200` | Transition duration. |
|
|
78
|
+
| `colorScaleExtent` | `array` | `[1, undefined]` | Color scale extent. |
|
|
79
|
+
| `radiusScaleExtent` | `array` | `[1, undefined]` | Radius scale extent. |
|
|
80
|
+
| `colorRange` | `array` | `['#f7fbff', '#08306b']` | Hexbin fill color range. |
|
|
81
|
+
| `radiusRange` | `array` | `[4, 12]` | Hexbin size range. |
|
|
82
|
+
| `pointerEvents` | `string` | `all` | CSS `pointer-events` value for hexbins. |
|
|
83
|
+
|
|
84
|
+
## PingLayer options and API
|
|
85
|
+
|
|
86
|
+
See the [Leaflet D3 ping API](https://github.com/bluehalo/leaflet-d3/blob/master/docs/API.md#pings-api).
|
|
87
|
+
|
|
88
|
+
| Option | Type | Default | Description |
|
|
89
|
+
| --- | --- | --- | --- |
|
|
90
|
+
| `duration` | `int` | `800` | Ping animation duration. |
|
|
91
|
+
| `fps` | `int` | `32` | Target animation frame rate. |
|
|
92
|
+
| `opacityRange` | `array` | `[1, 0]` | Opacity range as pings age. |
|
|
93
|
+
| `radiusRange` | `array` | `[3, 15]` | Radius range as pings age. |
|
|
94
|
+
|
|
95
|
+
Call `pingRef.current.ping(coordinates, cssClassName)` to add pings. Coordinates use `[longitude, latitude]` pairs.
|
|
96
|
+
|
|
97
|
+
## Tests
|
|
98
|
+
|
|
99
|
+
Run the unit tests with `npm run test:unit` and the browser tests with `npm run test:e2e`. The Playwright tests require Chromium; install it with `npx playwright install chromium`. Run both suites with `npm run test:all`.
|
|
100
|
+
|
|
101
|
+
## Releases
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
|
|
105
|
+
## Credits and license
|
|
106
|
+
|
|
107
|
+
Credit goes to the [Leaflet D3 contributors](https://github.com/bluehalo/leaflet-d3/graphs/contributors). This package is MIT licensed.
|