@local-logic/maps 0.0.6 → 0.0.7
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/dist/{index-BHjgd5HB.js → index-7D9tjwUD.js} +1 -1
- package/dist/{index-BbrOUWDy.js → index-C7t1isWh.js} +1 -1
- package/dist/{index-Bd-X-1Gd.js → index-CIUYCbof.js} +13 -13
- package/dist/index-CSXMNubL.js +47 -0
- package/dist/{index-CXLLvdx4.js → index-CwZ22Kq_.js} +122 -116
- package/dist/index-D0VvNlqV.js +29 -0
- package/dist/{index-BAAE2pMq.js → index-FSH3b4mt.js} +21 -21
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/Google/index.d.ts +2 -2
- package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/Mapbox/index.d.ts +2 -2
- package/dist/src/components/Map/Root/Layers/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts +2 -2
- package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/index.d.ts +2 -2
- package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/types.d.ts +1 -1
- package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/constants.d.ts +5 -0
- package/dist/src/components/Map/Root/constants.d.ts.map +1 -1
- package/dist/src/components/Map/Root/index.d.ts +0 -3
- package/dist/src/components/Map/Root/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/types.d.ts +1 -1
- package/dist/src/components/Map/Root/types.d.ts.map +1 -1
- package/dist/src/components/Map/index.d.ts +3 -0
- package/dist/src/components/Map/index.d.ts.map +1 -1
- package/dist/src/components/Map/index.stories.d.ts +1 -1
- package/dist/src/components/Map/index.stories.d.ts.map +1 -1
- package/dist/src/components/Map/storybook-data.d.ts +1 -15
- package/dist/src/components/Map/storybook-data.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/index-B_LO5X9C.js +0 -46
- package/dist/index-DHw9gU4K.js +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as s, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { C as c, M as l } from "./index-CXjxZmYt.js";
|
|
3
3
|
import { a as f } from "./index.modern-EsUgbhzI.js";
|
|
4
|
-
import { c as g, i as h,
|
|
4
|
+
import { c as g, i as h, b as t } from "./index-CwZ22Kq_.js";
|
|
5
5
|
function j({ clusters: e, onClick: o, children: m }) {
|
|
6
6
|
return e == null ? void 0 : e.map((a, p) => {
|
|
7
7
|
const i = a.geometry.coordinates[0], n = a.geometry.coordinates[1];
|
|
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as d, Fragment as c } from "react/jsx-runtime";
|
|
|
2
2
|
import { C as h, M as f } from "./index-CXjxZmYt.js";
|
|
3
3
|
import { a as g } from "./scale-control-CyJd4u6j.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { c as l, i as x,
|
|
5
|
+
import { c as l, i as x, b as t } from "./index-CwZ22Kq_.js";
|
|
6
6
|
function k({ clusters: o, onClick: e, children: p }) {
|
|
7
7
|
return o == null ? void 0 : o.map((a, m) => {
|
|
8
8
|
const i = a.geometry.coordinates[0], n = a.geometry.coordinates[1];
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { jsxs as l, jsx as
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect as c } from "react";
|
|
3
3
|
import { M as f, N as d, u as M } from "./logo-control-NE-LlsRy.js";
|
|
4
|
-
import { u as
|
|
5
|
-
const
|
|
6
|
-
const { current: t } = M(), { setBounds: e } =
|
|
4
|
+
import { u as s, d as o, a as h } from "./index-CwZ22Kq_.js";
|
|
5
|
+
const y = () => {
|
|
6
|
+
const { current: t } = M(), { setBounds: e } = s();
|
|
7
7
|
return c(() => {
|
|
8
8
|
t && e(t.getBounds().toArray().flat());
|
|
9
9
|
}, [t]), null;
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function z({ children: t }) {
|
|
12
12
|
const {
|
|
13
13
|
mapProvider: e,
|
|
14
|
-
center:
|
|
14
|
+
center: i,
|
|
15
15
|
zoom: n = o.zoom,
|
|
16
16
|
pitch: p = o.pitch,
|
|
17
17
|
bearing: m = o.bearing,
|
|
18
18
|
cooperativeGestures: u = o.cooperativeGestures,
|
|
19
|
-
zoomPosition:
|
|
20
|
-
} =
|
|
19
|
+
zoomPosition: a
|
|
20
|
+
} = s();
|
|
21
21
|
return e.name !== "maptiler" ? null : /* @__PURE__ */ l(
|
|
22
22
|
f,
|
|
23
23
|
{
|
|
24
24
|
initialViewState: {
|
|
25
|
-
...
|
|
25
|
+
...i,
|
|
26
26
|
zoom: n,
|
|
27
27
|
pitch: p,
|
|
28
28
|
bearing: m
|
|
29
29
|
},
|
|
30
30
|
cooperativeGestures: u,
|
|
31
|
-
mapStyle: `https://api.maptiler.com/maps/${e.
|
|
31
|
+
mapStyle: `https://api.maptiler.com/maps/${e.theme || h.maptiler}/style.json?key=${e.apiKey}`,
|
|
32
32
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
33
|
+
/* @__PURE__ */ r(y, {}),
|
|
34
|
+
a && /* @__PURE__ */ r(d, { position: a }),
|
|
35
35
|
t
|
|
36
36
|
]
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
z as default
|
|
42
42
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs as l, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as c } from "react";
|
|
3
|
+
import { M as f, N as d, u as b } from "./scale-control-CyJd4u6j.js";
|
|
4
|
+
import { u as n, d as a, a as x } from "./index-CwZ22Kq_.js";
|
|
5
|
+
const M = () => {
|
|
6
|
+
const { current: e } = b(), { setBounds: o } = n();
|
|
7
|
+
return c(() => {
|
|
8
|
+
if (!e)
|
|
9
|
+
return;
|
|
10
|
+
const t = e.getBounds();
|
|
11
|
+
t && o(t.toArray().flat());
|
|
12
|
+
}, [e]), null;
|
|
13
|
+
};
|
|
14
|
+
function w({ children: e }) {
|
|
15
|
+
const {
|
|
16
|
+
mapProvider: o,
|
|
17
|
+
center: t,
|
|
18
|
+
zoom: i = a.zoom,
|
|
19
|
+
pitch: p = a.pitch,
|
|
20
|
+
bearing: u = a.bearing,
|
|
21
|
+
cooperativeGestures: m = a.cooperativeGestures,
|
|
22
|
+
zoomPosition: r
|
|
23
|
+
} = n();
|
|
24
|
+
return o.name !== "mapbox" ? null : /* @__PURE__ */ l(
|
|
25
|
+
f,
|
|
26
|
+
{
|
|
27
|
+
mapboxAccessToken: o.apiKey,
|
|
28
|
+
initialViewState: {
|
|
29
|
+
...t,
|
|
30
|
+
zoom: i,
|
|
31
|
+
pitch: p,
|
|
32
|
+
bearing: u
|
|
33
|
+
},
|
|
34
|
+
cooperativeGestures: m,
|
|
35
|
+
mapStyle: `mapbox://styles/${o.theme || x.mapbox}`,
|
|
36
|
+
interactiveLayerIds: ["road-label", "waterway-label"],
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ s(M, {}),
|
|
39
|
+
r && /* @__PURE__ */ s(d, { position: r }),
|
|
40
|
+
e
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
w as default
|
|
47
|
+
};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { jsx as x, Fragment as nt } from "react/jsx-runtime";
|
|
2
2
|
import * as F from "react";
|
|
3
|
-
import st, { useContext as
|
|
4
|
-
const
|
|
3
|
+
import st, { useContext as ot, lazy as w, useMemo as L, useRef as G, useState as q } from "react";
|
|
4
|
+
const Q = st.createContext(
|
|
5
5
|
{}
|
|
6
|
-
), R = () =>
|
|
6
|
+
), R = () => ot(Q), S = {
|
|
7
7
|
zoom: 16,
|
|
8
8
|
pitch: 0,
|
|
9
9
|
bearing: 0,
|
|
10
10
|
cooperativeGestures: !1
|
|
11
|
-
},
|
|
11
|
+
}, Ut = {
|
|
12
|
+
maptiler: "600d69cb-288d-445e-9839-3dfe4d76b31a",
|
|
13
|
+
mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
|
|
14
|
+
google: "a7ff20eb973126bb"
|
|
15
|
+
}, it = "w-full h-full relative overflow-hidden", at = w(() => import("./index-CIUYCbof.js")), ct = w(() => import("./index-FSH3b4mt.js")), ut = w(() => import("./index-CSXMNubL.js")), ht = w(() => import("./index-qqbvBkdn.js")), pt = ({ children: n }) => {
|
|
12
16
|
const {
|
|
13
17
|
mapProvider: t,
|
|
14
18
|
center: e,
|
|
15
19
|
zoom: r = S.zoom,
|
|
16
|
-
pitch:
|
|
17
|
-
bearing:
|
|
20
|
+
pitch: o = S.pitch,
|
|
21
|
+
bearing: i = S.bearing,
|
|
18
22
|
cooperativeGestures: a = S.cooperativeGestures,
|
|
19
23
|
zoomPosition: u
|
|
20
24
|
} = R(), s = L(() => {
|
|
@@ -32,12 +36,13 @@ const q = st.createContext(
|
|
|
32
36
|
return /* @__PURE__ */ x(
|
|
33
37
|
"div",
|
|
34
38
|
{
|
|
35
|
-
className:
|
|
39
|
+
className: it,
|
|
36
40
|
"data-testid": "base-map",
|
|
37
|
-
"data-map-provider": t == null ? void 0 : t.name,
|
|
41
|
+
"data-map-provider-name": t == null ? void 0 : t.name,
|
|
42
|
+
"data-map-provider-theme": t == null ? void 0 : t.theme,
|
|
38
43
|
"data-zoom": r,
|
|
39
|
-
"data-pitch":
|
|
40
|
-
"data-bearing":
|
|
44
|
+
"data-pitch": o,
|
|
45
|
+
"data-bearing": i,
|
|
41
46
|
"data-cooperative-gestures": a,
|
|
42
47
|
"data-zoom-position": u,
|
|
43
48
|
"data-center-latitude": e.latitude,
|
|
@@ -67,7 +72,7 @@ function ft(n, t, e = {}) {
|
|
|
67
72
|
function V(n) {
|
|
68
73
|
return !isNaN(n) && n !== null && !Array.isArray(n);
|
|
69
74
|
}
|
|
70
|
-
const
|
|
75
|
+
const k = [
|
|
71
76
|
Int8Array,
|
|
72
77
|
Uint8Array,
|
|
73
78
|
Uint8ClampedArray,
|
|
@@ -77,7 +82,7 @@ const H = [
|
|
|
77
82
|
Uint32Array,
|
|
78
83
|
Float32Array,
|
|
79
84
|
Float64Array
|
|
80
|
-
], C = 1,
|
|
85
|
+
], C = 1, O = 8;
|
|
81
86
|
class D {
|
|
82
87
|
/**
|
|
83
88
|
* Creates an index from raw `ArrayBuffer` data.
|
|
@@ -89,14 +94,14 @@ class D {
|
|
|
89
94
|
const [e, r] = new Uint8Array(t, 0, 2);
|
|
90
95
|
if (e !== 219)
|
|
91
96
|
throw new Error("Data does not appear to be in a KDBush format.");
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
throw new Error(`Got v${
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
97
|
+
const o = r >> 4;
|
|
98
|
+
if (o !== C)
|
|
99
|
+
throw new Error(`Got v${o} data when expected v${C}.`);
|
|
100
|
+
const i = k[r & 15];
|
|
101
|
+
if (!i)
|
|
97
102
|
throw new Error("Unrecognized array type.");
|
|
98
103
|
const [a] = new Uint16Array(t, 2, 1), [u] = new Uint32Array(t, 4, 1);
|
|
99
|
-
return new D(u, a,
|
|
104
|
+
return new D(u, a, i, t);
|
|
100
105
|
}
|
|
101
106
|
/**
|
|
102
107
|
* Creates an index that will hold a given number of items.
|
|
@@ -105,13 +110,13 @@ class D {
|
|
|
105
110
|
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
106
111
|
* @param {ArrayBuffer} [data] (For internal use only)
|
|
107
112
|
*/
|
|
108
|
-
constructor(t, e = 64, r = Float64Array,
|
|
113
|
+
constructor(t, e = 64, r = Float64Array, o) {
|
|
109
114
|
if (isNaN(t) || t < 0) throw new Error(`Unpexpected numItems value: ${t}.`);
|
|
110
115
|
this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = r, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array;
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
116
|
+
const i = k.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, u = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - u % 8) % 8;
|
|
117
|
+
if (i < 0)
|
|
113
118
|
throw new Error(`Unexpected typed array class: ${r}.`);
|
|
114
|
-
|
|
119
|
+
o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + u + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(O + a + u + s), this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + u + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (C << 4) + i]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
|
|
115
120
|
}
|
|
116
121
|
/**
|
|
117
122
|
* Add a point to the index.
|
|
@@ -140,20 +145,20 @@ class D {
|
|
|
140
145
|
* @param {number} maxY
|
|
141
146
|
* @returns {number[]} An array of indices correponding to the found items.
|
|
142
147
|
*/
|
|
143
|
-
range(t, e, r,
|
|
148
|
+
range(t, e, r, o) {
|
|
144
149
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
145
|
-
const { ids:
|
|
150
|
+
const { ids: i, coords: a, nodeSize: u } = this, s = [0, i.length - 1, 0], c = [];
|
|
146
151
|
for (; s.length; ) {
|
|
147
152
|
const p = s.pop() || 0, h = s.pop() || 0, l = s.pop() || 0;
|
|
148
153
|
if (h - l <= u) {
|
|
149
154
|
for (let d = l; d <= h; d++) {
|
|
150
155
|
const y = a[2 * d], M = a[2 * d + 1];
|
|
151
|
-
y >= t && y <= r && M >= e && M <=
|
|
156
|
+
y >= t && y <= r && M >= e && M <= o && c.push(i[d]);
|
|
152
157
|
}
|
|
153
158
|
continue;
|
|
154
159
|
}
|
|
155
160
|
const f = l + h >> 1, g = a[2 * f], m = a[2 * f + 1];
|
|
156
|
-
g >= t && g <= r && m >= e && m <=
|
|
161
|
+
g >= t && g <= r && m >= e && m <= o && c.push(i[f]), (p === 0 ? t <= g : e <= m) && (s.push(l), s.push(f - 1), s.push(1 - p)), (p === 0 ? r >= g : o >= m) && (s.push(f + 1), s.push(h), s.push(1 - p));
|
|
157
162
|
}
|
|
158
163
|
return c;
|
|
159
164
|
}
|
|
@@ -166,50 +171,50 @@ class D {
|
|
|
166
171
|
*/
|
|
167
172
|
within(t, e, r) {
|
|
168
173
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
169
|
-
const { ids:
|
|
174
|
+
const { ids: o, coords: i, nodeSize: a } = this, u = [0, o.length - 1, 0], s = [], c = r * r;
|
|
170
175
|
for (; u.length; ) {
|
|
171
176
|
const p = u.pop() || 0, h = u.pop() || 0, l = u.pop() || 0;
|
|
172
177
|
if (h - l <= a) {
|
|
173
178
|
for (let d = l; d <= h; d++)
|
|
174
|
-
|
|
179
|
+
H(i[2 * d], i[2 * d + 1], t, e) <= c && s.push(o[d]);
|
|
175
180
|
continue;
|
|
176
181
|
}
|
|
177
|
-
const f = l + h >> 1, g =
|
|
178
|
-
|
|
182
|
+
const f = l + h >> 1, g = i[2 * f], m = i[2 * f + 1];
|
|
183
|
+
H(g, m, t, e) <= c && s.push(o[f]), (p === 0 ? t - r <= g : e - r <= m) && (u.push(l), u.push(f - 1), u.push(1 - p)), (p === 0 ? t + r >= g : e + r >= m) && (u.push(f + 1), u.push(h), u.push(1 - p));
|
|
179
184
|
}
|
|
180
185
|
return s;
|
|
181
186
|
}
|
|
182
187
|
}
|
|
183
|
-
function j(n, t, e, r,
|
|
184
|
-
if (
|
|
185
|
-
const a = r +
|
|
186
|
-
X(n, t, a, r,
|
|
188
|
+
function j(n, t, e, r, o, i) {
|
|
189
|
+
if (o - r <= e) return;
|
|
190
|
+
const a = r + o >> 1;
|
|
191
|
+
X(n, t, a, r, o, i), j(n, t, e, r, a - 1, 1 - i), j(n, t, e, a + 1, o, 1 - i);
|
|
187
192
|
}
|
|
188
|
-
function X(n, t, e, r,
|
|
189
|
-
for (;
|
|
190
|
-
if (
|
|
191
|
-
const c =
|
|
192
|
-
X(n, t, e, g, m,
|
|
193
|
+
function X(n, t, e, r, o, i) {
|
|
194
|
+
for (; o > r; ) {
|
|
195
|
+
if (o - r > 600) {
|
|
196
|
+
const c = o - r + 1, p = e - r + 1, h = Math.log(c), l = 0.5 * Math.exp(2 * h / 3), f = 0.5 * Math.sqrt(h * l * (c - l) / c) * (p - c / 2 < 0 ? -1 : 1), g = Math.max(r, Math.floor(e - p * l / c + f)), m = Math.min(o, Math.floor(e + (c - p) * l / c + f));
|
|
197
|
+
X(n, t, e, g, m, i);
|
|
193
198
|
}
|
|
194
|
-
const a = t[2 * e +
|
|
195
|
-
let u = r, s =
|
|
196
|
-
for (
|
|
197
|
-
for (
|
|
198
|
-
for (; t[2 * s +
|
|
199
|
+
const a = t[2 * e + i];
|
|
200
|
+
let u = r, s = o;
|
|
201
|
+
for (P(n, t, r, e), t[2 * o + i] > a && P(n, t, r, o); u < s; ) {
|
|
202
|
+
for (P(n, t, u, s), u++, s--; t[2 * u + i] < a; ) u++;
|
|
203
|
+
for (; t[2 * s + i] > a; ) s--;
|
|
199
204
|
}
|
|
200
|
-
t[2 * r +
|
|
205
|
+
t[2 * r + i] === a ? P(n, t, r, s) : (s++, P(n, t, s, o)), s <= e && (r = s + 1), e <= s && (o = s - 1);
|
|
201
206
|
}
|
|
202
207
|
}
|
|
203
|
-
function
|
|
208
|
+
function P(n, t, e, r) {
|
|
204
209
|
U(n, e, r), U(t, 2 * e, 2 * r), U(t, 2 * e + 1, 2 * r + 1);
|
|
205
210
|
}
|
|
206
211
|
function U(n, t, e) {
|
|
207
212
|
const r = n[t];
|
|
208
213
|
n[t] = n[e], n[e] = r;
|
|
209
214
|
}
|
|
210
|
-
function
|
|
211
|
-
const
|
|
212
|
-
return
|
|
215
|
+
function H(n, t, e, r) {
|
|
216
|
+
const o = n - e, i = t - r;
|
|
217
|
+
return o * o + i * i;
|
|
213
218
|
}
|
|
214
219
|
const dt = {
|
|
215
220
|
minZoom: 0,
|
|
@@ -240,10 +245,10 @@ class gt {
|
|
|
240
245
|
this.options = Object.assign(Object.create(dt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
|
|
241
246
|
}
|
|
242
247
|
load(t) {
|
|
243
|
-
const { log: e, minZoom: r, maxZoom:
|
|
248
|
+
const { log: e, minZoom: r, maxZoom: o } = this.options;
|
|
244
249
|
e && console.time("total time");
|
|
245
|
-
const
|
|
246
|
-
e && console.time(
|
|
250
|
+
const i = `prepare ${t.length} points`;
|
|
251
|
+
e && console.time(i), this.points = t;
|
|
247
252
|
const a = [];
|
|
248
253
|
for (let s = 0; s < t.length; s++) {
|
|
249
254
|
const c = t[s];
|
|
@@ -263,9 +268,9 @@ class gt {
|
|
|
263
268
|
// number of points in a cluster
|
|
264
269
|
), this.options.reduce && a.push(0);
|
|
265
270
|
}
|
|
266
|
-
let u = this.trees[
|
|
267
|
-
e && console.timeEnd(
|
|
268
|
-
for (let s =
|
|
271
|
+
let u = this.trees[o + 1] = this._createTree(a);
|
|
272
|
+
e && console.timeEnd(i);
|
|
273
|
+
for (let s = o; s >= r; s--) {
|
|
269
274
|
const c = +Date.now();
|
|
270
275
|
u = this.trees[s] = this._createTree(this._cluster(u, s)), e && console.log("z%d: %d clusters in %dms", s, u.numItems, +Date.now() - c);
|
|
271
276
|
}
|
|
@@ -273,16 +278,16 @@ class gt {
|
|
|
273
278
|
}
|
|
274
279
|
getClusters(t, e) {
|
|
275
280
|
let r = ((t[0] + 180) % 360 + 360) % 360 - 180;
|
|
276
|
-
const
|
|
277
|
-
let
|
|
281
|
+
const o = Math.max(-90, Math.min(90, t[1]));
|
|
282
|
+
let i = t[2] === 180 ? 180 : ((t[2] + 180) % 360 + 360) % 360 - 180;
|
|
278
283
|
const a = Math.max(-90, Math.min(90, t[3]));
|
|
279
284
|
if (t[2] - t[0] >= 360)
|
|
280
|
-
r = -180,
|
|
281
|
-
else if (r >
|
|
282
|
-
const h = this.getClusters([r,
|
|
285
|
+
r = -180, i = 180;
|
|
286
|
+
else if (r > i) {
|
|
287
|
+
const h = this.getClusters([r, o, 180, a], e), l = this.getClusters([-180, o, i, a], e);
|
|
283
288
|
return h.concat(l);
|
|
284
289
|
}
|
|
285
|
-
const u = this.trees[this._limitZoom(e)], s = u.range(I(r), B(a), I(
|
|
290
|
+
const u = this.trees[this._limitZoom(e)], s = u.range(I(r), B(a), I(i), B(o)), c = u.data, p = [];
|
|
286
291
|
for (const h of s) {
|
|
287
292
|
const l = this.stride * h;
|
|
288
293
|
p.push(c[l + A] > 1 ? K(c, l, this.clusterProps) : this.points[c[l + E]]);
|
|
@@ -290,47 +295,47 @@ class gt {
|
|
|
290
295
|
return p;
|
|
291
296
|
}
|
|
292
297
|
getChildren(t) {
|
|
293
|
-
const e = this._getOriginId(t), r = this._getOriginZoom(t),
|
|
294
|
-
if (!
|
|
295
|
-
const a =
|
|
296
|
-
if (e * this.stride >= a.length) throw new Error(
|
|
297
|
-
const u = this.options.radius / (this.options.extent * Math.pow(2, r - 1)), s = a[e * this.stride], c = a[e * this.stride + 1], p =
|
|
298
|
+
const e = this._getOriginId(t), r = this._getOriginZoom(t), o = "No cluster with the specified id.", i = this.trees[r];
|
|
299
|
+
if (!i) throw new Error(o);
|
|
300
|
+
const a = i.data;
|
|
301
|
+
if (e * this.stride >= a.length) throw new Error(o);
|
|
302
|
+
const u = this.options.radius / (this.options.extent * Math.pow(2, r - 1)), s = a[e * this.stride], c = a[e * this.stride + 1], p = i.within(s, c, u), h = [];
|
|
298
303
|
for (const l of p) {
|
|
299
304
|
const f = l * this.stride;
|
|
300
305
|
a[f + z] === t && h.push(a[f + A] > 1 ? K(a, f, this.clusterProps) : this.points[a[f + E]]);
|
|
301
306
|
}
|
|
302
|
-
if (h.length === 0) throw new Error(
|
|
307
|
+
if (h.length === 0) throw new Error(o);
|
|
303
308
|
return h;
|
|
304
309
|
}
|
|
305
310
|
getLeaves(t, e, r) {
|
|
306
311
|
e = e || 10, r = r || 0;
|
|
307
|
-
const
|
|
308
|
-
return this._appendLeaves(
|
|
312
|
+
const o = [];
|
|
313
|
+
return this._appendLeaves(o, t, e, r, 0), o;
|
|
309
314
|
}
|
|
310
315
|
getTile(t, e, r) {
|
|
311
|
-
const
|
|
316
|
+
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: u } = this.options, s = u / a, c = (r - s) / i, p = (r + 1 + s) / i, h = {
|
|
312
317
|
features: []
|
|
313
318
|
};
|
|
314
319
|
return this._addTileFeatures(
|
|
315
|
-
|
|
316
|
-
|
|
320
|
+
o.range((e - s) / i, c, (e + 1 + s) / i, p),
|
|
321
|
+
o.data,
|
|
317
322
|
e,
|
|
318
323
|
r,
|
|
319
|
-
|
|
324
|
+
i,
|
|
320
325
|
h
|
|
321
326
|
), e === 0 && this._addTileFeatures(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
327
|
+
o.range(1 - s / i, c, 1, p),
|
|
328
|
+
o.data,
|
|
329
|
+
i,
|
|
325
330
|
r,
|
|
326
|
-
|
|
331
|
+
i,
|
|
327
332
|
h
|
|
328
|
-
), e ===
|
|
329
|
-
|
|
330
|
-
|
|
333
|
+
), e === i - 1 && this._addTileFeatures(
|
|
334
|
+
o.range(0, c, s / i, p),
|
|
335
|
+
o.data,
|
|
331
336
|
-1,
|
|
332
337
|
r,
|
|
333
|
-
|
|
338
|
+
i,
|
|
334
339
|
h
|
|
335
340
|
), h.features.length ? h : null;
|
|
336
341
|
}
|
|
@@ -343,20 +348,20 @@ class gt {
|
|
|
343
348
|
}
|
|
344
349
|
return e;
|
|
345
350
|
}
|
|
346
|
-
_appendLeaves(t, e, r,
|
|
351
|
+
_appendLeaves(t, e, r, o, i) {
|
|
347
352
|
const a = this.getChildren(e);
|
|
348
353
|
for (const u of a) {
|
|
349
354
|
const s = u.properties;
|
|
350
|
-
if (s && s.cluster ?
|
|
355
|
+
if (s && s.cluster ? i + s.point_count <= o ? i += s.point_count : i = this._appendLeaves(t, s.cluster_id, r, o, i) : i < o ? i++ : t.push(u), t.length === r) break;
|
|
351
356
|
}
|
|
352
|
-
return
|
|
357
|
+
return i;
|
|
353
358
|
}
|
|
354
359
|
_createTree(t) {
|
|
355
360
|
const e = new D(t.length / this.stride | 0, this.options.nodeSize, Float32Array);
|
|
356
361
|
for (let r = 0; r < t.length; r += this.stride) e.add(t[r], t[r + 1]);
|
|
357
362
|
return e.finish(), e.data = t, e;
|
|
358
363
|
}
|
|
359
|
-
_addTileFeatures(t, e, r,
|
|
364
|
+
_addTileFeatures(t, e, r, o, i, a) {
|
|
360
365
|
for (const u of t) {
|
|
361
366
|
const s = u * this.stride, c = e[s + A] > 1;
|
|
362
367
|
let p, h, l;
|
|
@@ -371,8 +376,8 @@ class gt {
|
|
|
371
376
|
const f = {
|
|
372
377
|
type: 1,
|
|
373
378
|
geometry: [[
|
|
374
|
-
Math.round(this.options.extent * (h *
|
|
375
|
-
Math.round(this.options.extent * (l *
|
|
379
|
+
Math.round(this.options.extent * (h * i - r)),
|
|
380
|
+
Math.round(this.options.extent * (l * i - o))
|
|
376
381
|
]],
|
|
377
382
|
tags: p
|
|
378
383
|
};
|
|
@@ -384,7 +389,7 @@ class gt {
|
|
|
384
389
|
return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
|
|
385
390
|
}
|
|
386
391
|
_cluster(t, e) {
|
|
387
|
-
const { radius: r, extent:
|
|
392
|
+
const { radius: r, extent: o, reduce: i, minPoints: a } = this.options, u = r / (o * Math.pow(2, e)), s = t.data, c = [], p = this.stride;
|
|
388
393
|
for (let h = 0; h < s.length; h += p) {
|
|
389
394
|
if (s[h + v] <= e) continue;
|
|
390
395
|
s[h + v] = e;
|
|
@@ -402,9 +407,9 @@ class gt {
|
|
|
402
407
|
if (s[b + v] <= e) continue;
|
|
403
408
|
s[b + v] = e;
|
|
404
409
|
const $ = s[b + A];
|
|
405
|
-
y += s[b] * $, M += s[b + 1] * $, s[b + z] = Z,
|
|
410
|
+
y += s[b] * $, M += s[b + 1] * $, s[b + z] = Z, i && (_ || (_ = this._map(s, h, !0), N = this.clusterProps.length, this.clusterProps.push(_)), i(_, this._map(s, b)));
|
|
406
411
|
}
|
|
407
|
-
s[h + z] = Z, c.push(y / d, M / d, 1 / 0, Z, -1, d),
|
|
412
|
+
s[h + z] = Z, c.push(y / d, M / d, 1 / 0, Z, -1, d), i && c.push(N);
|
|
408
413
|
} else {
|
|
409
414
|
for (let y = 0; y < p; y++) c.push(s[h + y]);
|
|
410
415
|
if (d > 1)
|
|
@@ -432,8 +437,8 @@ class gt {
|
|
|
432
437
|
const a = this.clusterProps[t[e + tt]];
|
|
433
438
|
return r ? Object.assign({}, a) : a;
|
|
434
439
|
}
|
|
435
|
-
const
|
|
436
|
-
return r &&
|
|
440
|
+
const o = this.points[t[e + E]].properties, i = this.options.map(o);
|
|
441
|
+
return r && i === o ? Object.assign({}, i) : i;
|
|
437
442
|
}
|
|
438
443
|
}
|
|
439
444
|
function K(n, t, e) {
|
|
@@ -448,12 +453,12 @@ function K(n, t, e) {
|
|
|
448
453
|
};
|
|
449
454
|
}
|
|
450
455
|
function et(n, t, e) {
|
|
451
|
-
const r = n[t + A],
|
|
456
|
+
const r = n[t + A], o = r >= 1e4 ? `${Math.round(r / 1e3)}k` : r >= 1e3 ? `${Math.round(r / 100) / 10}k` : r, i = n[t + tt], a = i === -1 ? {} : Object.assign({}, e[i]);
|
|
452
457
|
return Object.assign(a, {
|
|
453
458
|
cluster: !0,
|
|
454
459
|
cluster_id: n[t + E],
|
|
455
460
|
point_count: r,
|
|
456
|
-
point_count_abbreviated:
|
|
461
|
+
point_count_abbreviated: o
|
|
457
462
|
});
|
|
458
463
|
}
|
|
459
464
|
function I(n) {
|
|
@@ -476,7 +481,7 @@ function Y(n, t, e) {
|
|
|
476
481
|
if (T(e, t)) return e;
|
|
477
482
|
}
|
|
478
483
|
function T(n, t) {
|
|
479
|
-
var e, r,
|
|
484
|
+
var e, r, o;
|
|
480
485
|
if (n === t) return !0;
|
|
481
486
|
if (n && t && (e = n.constructor) === t.constructor) {
|
|
482
487
|
if (e === Date) return n.getTime() === t.getTime();
|
|
@@ -490,14 +495,14 @@ function T(n, t) {
|
|
|
490
495
|
if (n.size !== t.size)
|
|
491
496
|
return !1;
|
|
492
497
|
for (r of n)
|
|
493
|
-
if (
|
|
498
|
+
if (o = r, o && typeof o == "object" && (o = Y(t, o), !o) || !t.has(o)) return !1;
|
|
494
499
|
return !0;
|
|
495
500
|
}
|
|
496
501
|
if (e === Map) {
|
|
497
502
|
if (n.size !== t.size)
|
|
498
503
|
return !1;
|
|
499
504
|
for (r of n)
|
|
500
|
-
if (
|
|
505
|
+
if (o = r[0], o && typeof o == "object" && (o = Y(t, o), !o) || !T(r[1], t.get(o)))
|
|
501
506
|
return !1;
|
|
502
507
|
return !0;
|
|
503
508
|
}
|
|
@@ -532,15 +537,15 @@ function Mt(n, t) {
|
|
|
532
537
|
return F.useEffect(n, wt(t));
|
|
533
538
|
}
|
|
534
539
|
var xt = function(t) {
|
|
535
|
-
var e = t.points, r = t.bounds,
|
|
540
|
+
var e = t.points, r = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, u = G(), s = G(), c = q([]), p = c[0], h = c[1], l = Math.round(o);
|
|
536
541
|
return Mt(function() {
|
|
537
|
-
a !== !0 && ((!u.current || !T(s.current, e) || !T(u.current.options,
|
|
538
|
-
}, [e, r, l,
|
|
542
|
+
a !== !0 && ((!u.current || !T(s.current, e) || !T(u.current.options, i)) && (u.current = new gt(i), u.current.load(e)), r && h(u.current.getClusters(r, l)), s.current = e);
|
|
543
|
+
}, [e, r, l, i, a]), {
|
|
539
544
|
clusters: p,
|
|
540
545
|
supercluster: u.current
|
|
541
546
|
};
|
|
542
547
|
};
|
|
543
|
-
const
|
|
548
|
+
const zt = `
|
|
544
549
|
cursor-pointer
|
|
545
550
|
relative
|
|
546
551
|
h-7
|
|
@@ -559,23 +564,23 @@ const Ut = `
|
|
|
559
564
|
transition-transform
|
|
560
565
|
group-hover:stroke-base-white
|
|
561
566
|
group-focus:stroke-base-white
|
|
562
|
-
`,
|
|
567
|
+
`, jt = `
|
|
563
568
|
absolute top-1 left-1/2 transform -translate-x-1/2
|
|
564
569
|
flex justify-center items-center rounded-full overflow-hidden
|
|
565
570
|
transition-all w-3.5 h-3.5
|
|
566
571
|
|
|
567
572
|
group-hover:bg-base-white
|
|
568
|
-
`,
|
|
573
|
+
`, Dt = `
|
|
569
574
|
m-auto transition-all w-full h-full
|
|
570
575
|
max-w-3.5 max-h-3.5
|
|
571
576
|
|
|
572
577
|
group-hover:text-primary-100
|
|
573
578
|
group-hover:max-w-2.5
|
|
574
579
|
group-hover:max-h-2.5
|
|
575
|
-
`, At = w(() => import("./index-
|
|
576
|
-
const { mapProvider: r, bounds:
|
|
580
|
+
`, At = w(() => import("./index-D0VvNlqV.js")), Et = w(() => import("./index-7D9tjwUD.js")), bt = w(() => import("./index-C7t1isWh.js")), vt = ({ markers: n, onClick: t, ...e }) => {
|
|
581
|
+
const { mapProvider: r, bounds: o } = R(), { clusters: i, supercluster: a } = xt({
|
|
577
582
|
points: n.map((c) => ft([c.longitude, c.latitude], c)),
|
|
578
|
-
bounds:
|
|
583
|
+
bounds: o,
|
|
579
584
|
zoom: 16,
|
|
580
585
|
options: { radius: 50, maxZoom: 30 }
|
|
581
586
|
}), u = (c) => {
|
|
@@ -609,23 +614,23 @@ const Ut = `
|
|
|
609
614
|
return null;
|
|
610
615
|
}
|
|
611
616
|
}, [r]);
|
|
612
|
-
return s ? /* @__PURE__ */ x(nt, { children: /* @__PURE__ */ x(s, { clusters:
|
|
617
|
+
return s ? /* @__PURE__ */ x(nt, { children: /* @__PURE__ */ x(s, { clusters: i, onClick: u, ...e, children: /* @__PURE__ */ x("svg", { viewBox: "0 0 20 28", fill: "none", className: _t, children: /* @__PURE__ */ x(
|
|
613
618
|
"path",
|
|
614
619
|
{
|
|
615
620
|
d: "M20 10C20 15.5228 12 27.5 10 27.5C8 27.5 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10Z",
|
|
616
621
|
fill: "inherit"
|
|
617
622
|
}
|
|
618
623
|
) }) }) }) : null;
|
|
619
|
-
}, Tt = w(() => import("./index-J1MKzGEM.js")),
|
|
624
|
+
}, Tt = w(() => import("./index-J1MKzGEM.js")), Ot = w(() => import("./index-BZ2605rA.js")), Pt = w(() => import("./index-B43MtiHH.js"));
|
|
620
625
|
function St({ children: n, ...t }) {
|
|
621
626
|
const { mapProvider: e } = R(), r = L(() => {
|
|
622
627
|
switch (e == null ? void 0 : e.name) {
|
|
623
628
|
case "maptiler":
|
|
624
629
|
return Tt;
|
|
625
630
|
case "google":
|
|
626
|
-
return Pt;
|
|
627
|
-
case "mapbox":
|
|
628
631
|
return Ot;
|
|
632
|
+
case "mapbox":
|
|
633
|
+
return Pt;
|
|
629
634
|
default:
|
|
630
635
|
return null;
|
|
631
636
|
}
|
|
@@ -649,10 +654,10 @@ function Lt(n) {
|
|
|
649
654
|
return e ? /* @__PURE__ */ x(e, { ...n }) : null;
|
|
650
655
|
}
|
|
651
656
|
function Rt(n) {
|
|
652
|
-
const [t, e] =
|
|
653
|
-
return /* @__PURE__ */ x(
|
|
657
|
+
const [t, e] = q();
|
|
658
|
+
return /* @__PURE__ */ x(Q.Provider, { value: { ...n, bounds: t, setBounds: e }, children: n.children });
|
|
654
659
|
}
|
|
655
|
-
const
|
|
660
|
+
const Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
656
661
|
__proto__: null,
|
|
657
662
|
BaseMap: pt,
|
|
658
663
|
Layers: Lt,
|
|
@@ -661,10 +666,11 @@ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
661
666
|
Root: Rt
|
|
662
667
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
663
668
|
export {
|
|
664
|
-
|
|
669
|
+
Ut as a,
|
|
665
670
|
Dt as b,
|
|
666
|
-
|
|
671
|
+
zt as c,
|
|
667
672
|
S as d,
|
|
668
|
-
|
|
673
|
+
Nt as e,
|
|
674
|
+
jt as i,
|
|
669
675
|
R as u
|
|
670
676
|
};
|