@local-logic/maps 0.0.30 → 0.1.1
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-Bn4XgGCE.js → index-BOJCRr60.js} +2 -2
- package/dist/{index-DRdXfLHP.js → index-BUZonjTY.js} +1 -1
- package/dist/index-BabQioiH.js +109 -0
- package/dist/{index-B9irDFVS.js → index-CTWLtI5f.js} +51 -48
- package/dist/{index-BCEeluIN.js → index-CWXZA3V3.js} +2 -2
- package/dist/{index-B1UUkU25.js → index-Ci9PQ3VM.js} +2 -2
- package/dist/{index-D5oT0rvy.js → index-D37STE_k.js} +88 -87
- package/dist/{index-CIE9YlvM.js → index-D8-yY6UK.js} +1 -1
- package/dist/{index-Cnab0xsb.js → index-DHOxmHER.js} +2 -2
- package/dist/{index-GGtrKiJn.js → index-DKy2opdk.js} +1 -1
- package/dist/{index-DImiFUoC.js → index-Dy0j33aN.js} +2 -2
- package/dist/{index-CEDpofgZ.js → index-k9UFzKZZ.js} +8 -7
- package/dist/{index--TOrExMa.js → index-vIYPnHrB.js} +2 -2
- package/dist/{index-7WiriOPf.js → index-xDS1OfMB.js} +48 -45
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +5 -5
- 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/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/types.d.ts +12 -1
- package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/utils.d.ts +3 -4
- package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/index.d.ts +1 -1
- package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/types.d.ts +1 -0
- package/dist/src/components/Map/Root/Markers/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/context.d.ts +0 -1
- package/dist/src/components/Map/Root/context.d.ts.map +1 -1
- package/dist/src/components/Map/Root/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/types.d.ts +1 -0
- package/dist/src/components/Map/Root/types.d.ts.map +1 -1
- package/dist/src/components/Map/storybook-data.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-mseP7Fna.js → styles-B3ZaR0wz.js} +1 -1
- package/dist/utils-IAXGPK5I.js +33 -0
- package/package.json +3 -3
- package/dist/index-5JWsWx8g.js +0 -107
- package/dist/utils-DJ13veBM.js +0 -25
|
@@ -15,7 +15,7 @@ const et = at.createContext({}), R = () => ct(et), C = {
|
|
|
15
15
|
bottom: 10,
|
|
16
16
|
left: 10,
|
|
17
17
|
right: 10
|
|
18
|
-
}, J = 10, pt = 22, Jt = 10, ht = 30, lt = 60, Wt = 15, ft = [-180, -85.0511, 180, 85.0511], dt = "w-full h-full relative overflow-hidden", mt = w(() => import("./index-
|
|
18
|
+
}, J = 10, pt = 22, Jt = 10, ht = 30, lt = 60, Wt = 15, ft = [-180, -85.0511, 180, 85.0511], dt = "w-full h-full relative overflow-hidden", mt = w(() => import("./index-CTWLtI5f.js")), gt = w(() => import("./index-BabQioiH.js")), yt = w(() => import("./index-xDS1OfMB.js")), wt = w(() => import("./index-qqbvBkdn.js")), Mt = ({ children: r }) => {
|
|
19
19
|
const {
|
|
20
20
|
mapProvider: t,
|
|
21
21
|
center: e,
|
|
@@ -24,7 +24,7 @@ const et = at.createContext({}), R = () => ct(et), C = {
|
|
|
24
24
|
bearing: i = C.bearing,
|
|
25
25
|
cooperativeGestures: a = C.cooperativeGestures,
|
|
26
26
|
zoomPosition: c
|
|
27
|
-
} = R(), [s] = L(n),
|
|
27
|
+
} = R(), [s] = L(n), p = S(() => {
|
|
28
28
|
switch (t?.name) {
|
|
29
29
|
case "maptiler":
|
|
30
30
|
return mt;
|
|
@@ -50,7 +50,7 @@ const et = at.createContext({}), R = () => ct(et), C = {
|
|
|
50
50
|
"data-zoom-position": c,
|
|
51
51
|
"data-center-latitude": e.latitude,
|
|
52
52
|
"data-center-longitude": e.longitude,
|
|
53
|
-
children: /* @__PURE__ */ O(
|
|
53
|
+
children: /* @__PURE__ */ O(p, { children: r })
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
56
|
}, _t = w(() => import("./index-C3Tj3r2u.js")), Pt = w(() => import("./index-CUUravWc.js")), At = w(() => import("./index-eWv3le07.js"));
|
|
@@ -106,7 +106,7 @@ const Y = [
|
|
|
106
106
|
Uint32Array,
|
|
107
107
|
Float32Array,
|
|
108
108
|
Float64Array
|
|
109
|
-
],
|
|
109
|
+
], B = 1, T = 8;
|
|
110
110
|
class G {
|
|
111
111
|
/**
|
|
112
112
|
* Creates an index from raw `ArrayBuffer` data.
|
|
@@ -119,8 +119,8 @@ class G {
|
|
|
119
119
|
if (e !== 219)
|
|
120
120
|
throw new Error("Data does not appear to be in a KDBush format.");
|
|
121
121
|
const o = n >> 4;
|
|
122
|
-
if (o !==
|
|
123
|
-
throw new Error(`Got v${o} data when expected v${
|
|
122
|
+
if (o !== B)
|
|
123
|
+
throw new Error(`Got v${o} data when expected v${B}.`);
|
|
124
124
|
const i = Y[n & 15];
|
|
125
125
|
if (!i)
|
|
126
126
|
throw new Error("Unrecognized array type.");
|
|
@@ -140,7 +140,7 @@ class G {
|
|
|
140
140
|
const i = Y.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - c % 8) % 8;
|
|
141
141
|
if (i < 0)
|
|
142
142
|
throw new Error(`Unexpected typed array class: ${n}.`);
|
|
143
|
-
o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data, T, t), this.coords = new this.ArrayType(this.data, T + c + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(T + a + c + s), this.ids = new this.IndexArrayType(this.data, T, t), this.coords = new this.ArrayType(this.data, T + c + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (
|
|
143
|
+
o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data, T, t), this.coords = new this.ArrayType(this.data, T + c + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(T + a + c + s), this.ids = new this.IndexArrayType(this.data, T, t), this.coords = new this.ArrayType(this.data, T + c + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (B << 4) + i]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Add a point to the index.
|
|
@@ -171,20 +171,20 @@ class G {
|
|
|
171
171
|
*/
|
|
172
172
|
range(t, e, n, o) {
|
|
173
173
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
174
|
-
const { ids: i, coords: a, nodeSize: c } = this, s = [0, i.length - 1, 0],
|
|
174
|
+
const { ids: i, coords: a, nodeSize: c } = this, s = [0, i.length - 1, 0], p = [];
|
|
175
175
|
for (; s.length; ) {
|
|
176
176
|
const l = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
|
|
177
177
|
if (u - f <= c) {
|
|
178
|
-
for (let
|
|
179
|
-
const m = a[2 *
|
|
180
|
-
m >= t && m <= n && M >= e && M <= o &&
|
|
178
|
+
for (let h = f; h <= u; h++) {
|
|
179
|
+
const m = a[2 * h], M = a[2 * h + 1];
|
|
180
|
+
m >= t && m <= n && M >= e && M <= o && p.push(i[h]);
|
|
181
181
|
}
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
184
184
|
const d = f + u >> 1, g = a[2 * d], y = a[2 * d + 1];
|
|
185
|
-
g >= t && g <= n && y >= e && y <= o &&
|
|
185
|
+
g >= t && g <= n && y >= e && y <= o && p.push(i[d]), (l === 0 ? t <= g : e <= y) && (s.push(f), s.push(d - 1), s.push(1 - l)), (l === 0 ? n >= g : o >= y) && (s.push(d + 1), s.push(u), s.push(1 - l));
|
|
186
186
|
}
|
|
187
|
-
return
|
|
187
|
+
return p;
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* Search the index for items within a given radius.
|
|
@@ -195,16 +195,16 @@ class G {
|
|
|
195
195
|
*/
|
|
196
196
|
within(t, e, n) {
|
|
197
197
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
198
|
-
const { ids: o, coords: i, nodeSize: a } = this, c = [0, o.length - 1, 0], s = [],
|
|
198
|
+
const { ids: o, coords: i, nodeSize: a } = this, c = [0, o.length - 1, 0], s = [], p = n * n;
|
|
199
199
|
for (; c.length; ) {
|
|
200
200
|
const l = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
|
|
201
201
|
if (u - f <= a) {
|
|
202
|
-
for (let
|
|
203
|
-
K(i[2 *
|
|
202
|
+
for (let h = f; h <= u; h++)
|
|
203
|
+
K(i[2 * h], i[2 * h + 1], t, e) <= p && s.push(o[h]);
|
|
204
204
|
continue;
|
|
205
205
|
}
|
|
206
206
|
const d = f + u >> 1, g = i[2 * d], y = i[2 * d + 1];
|
|
207
|
-
K(g, y, t, e) <=
|
|
207
|
+
K(g, y, t, e) <= p && s.push(o[d]), (l === 0 ? t - n <= g : e - n <= y) && (c.push(f), c.push(d - 1), c.push(1 - l)), (l === 0 ? t + n >= g : e + n >= y) && (c.push(d + 1), c.push(u), c.push(1 - l));
|
|
208
208
|
}
|
|
209
209
|
return s;
|
|
210
210
|
}
|
|
@@ -217,7 +217,7 @@ function j(r, t, e, n, o, i) {
|
|
|
217
217
|
function rt(r, t, e, n, o, i) {
|
|
218
218
|
for (; o > n; ) {
|
|
219
219
|
if (o - n > 600) {
|
|
220
|
-
const
|
|
220
|
+
const p = o - n + 1, l = e - n + 1, u = Math.log(p), f = 0.5 * Math.exp(2 * u / 3), d = 0.5 * Math.sqrt(u * f * (p - f) / p) * (l - p / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - l * f / p + d)), y = Math.min(o, Math.floor(e + (p - l) * f / p + d));
|
|
221
221
|
rt(r, t, e, g, y, i);
|
|
222
222
|
}
|
|
223
223
|
const a = t[2 * e + i];
|
|
@@ -230,9 +230,9 @@ function rt(r, t, e, n, o, i) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
function b(r, t, e, n) {
|
|
233
|
-
|
|
233
|
+
F(r, e, n), F(t, 2 * e, 2 * n), F(t, 2 * e + 1, 2 * n + 1);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function F(r, t, e) {
|
|
236
236
|
const n = r[t];
|
|
237
237
|
r[t] = r[e], r[e] = n;
|
|
238
238
|
}
|
|
@@ -263,7 +263,7 @@ const vt = {
|
|
|
263
263
|
// properties to use for individual points when running the reducer
|
|
264
264
|
map: (r) => r
|
|
265
265
|
// props => ({sum: props.my_value})
|
|
266
|
-
}, q = Math.fround || /* @__PURE__ */ ((r) => (t) => (r[0] = +t, r[0]))(new Float32Array(1)), x = 2, A = 3, N = 4, P = 5, st = 6;
|
|
266
|
+
}, q = Math.fround || /* @__PURE__ */ ((r) => ((t) => (r[0] = +t, r[0])))(new Float32Array(1)), x = 2, A = 3, N = 4, P = 5, st = 6;
|
|
267
267
|
class Ot {
|
|
268
268
|
constructor(t) {
|
|
269
269
|
this.options = Object.assign(Object.create(vt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
|
|
@@ -275,9 +275,9 @@ class Ot {
|
|
|
275
275
|
e && console.time(i), this.points = t;
|
|
276
276
|
const a = [];
|
|
277
277
|
for (let s = 0; s < t.length; s++) {
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
280
|
-
const [l, u] =
|
|
278
|
+
const p = t[s];
|
|
279
|
+
if (!p.geometry) continue;
|
|
280
|
+
const [l, u] = p.geometry.coordinates, f = q(I(l)), d = q(U(u));
|
|
281
281
|
a.push(
|
|
282
282
|
f,
|
|
283
283
|
d,
|
|
@@ -295,8 +295,8 @@ class Ot {
|
|
|
295
295
|
let c = this.trees[o + 1] = this._createTree(a);
|
|
296
296
|
e && console.timeEnd(i);
|
|
297
297
|
for (let s = o; s >= n; s--) {
|
|
298
|
-
const
|
|
299
|
-
c = this.trees[s] = this._createTree(this._cluster(c, s)), e && console.log("z%d: %d clusters in %dms", s, c.numItems, +Date.now() -
|
|
298
|
+
const p = +Date.now();
|
|
299
|
+
c = this.trees[s] = this._createTree(this._cluster(c, s)), e && console.log("z%d: %d clusters in %dms", s, c.numItems, +Date.now() - p);
|
|
300
300
|
}
|
|
301
301
|
return e && console.timeEnd("total time"), this;
|
|
302
302
|
}
|
|
@@ -311,10 +311,10 @@ class Ot {
|
|
|
311
311
|
const u = this.getClusters([n, o, 180, a], e), f = this.getClusters([-180, o, i, a], e);
|
|
312
312
|
return u.concat(f);
|
|
313
313
|
}
|
|
314
|
-
const c = this.trees[this._limitZoom(e)], s = c.range(I(n), U(a), I(i), U(o)),
|
|
314
|
+
const c = this.trees[this._limitZoom(e)], s = c.range(I(n), U(a), I(i), U(o)), p = c.data, l = [];
|
|
315
315
|
for (const u of s) {
|
|
316
316
|
const f = this.stride * u;
|
|
317
|
-
l.push(
|
|
317
|
+
l.push(p[f + P] > 1 ? Q(p, f, this.clusterProps) : this.points[p[f + A]]);
|
|
318
318
|
}
|
|
319
319
|
return l;
|
|
320
320
|
}
|
|
@@ -323,7 +323,7 @@ class Ot {
|
|
|
323
323
|
if (!i) throw new Error(o);
|
|
324
324
|
const a = i.data;
|
|
325
325
|
if (e * this.stride >= a.length) throw new Error(o);
|
|
326
|
-
const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride],
|
|
326
|
+
const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], p = a[e * this.stride + 1], l = i.within(s, p, c), u = [];
|
|
327
327
|
for (const f of l) {
|
|
328
328
|
const d = f * this.stride;
|
|
329
329
|
a[d + N] === t && u.push(a[d + P] > 1 ? Q(a, d, this.clusterProps) : this.points[a[d + A]]);
|
|
@@ -337,25 +337,25 @@ class Ot {
|
|
|
337
337
|
return this._appendLeaves(o, t, e, n, 0), o;
|
|
338
338
|
}
|
|
339
339
|
getTile(t, e, n) {
|
|
340
|
-
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a,
|
|
340
|
+
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a, p = (n - s) / i, l = (n + 1 + s) / i, u = {
|
|
341
341
|
features: []
|
|
342
342
|
};
|
|
343
343
|
return this._addTileFeatures(
|
|
344
|
-
o.range((e - s) / i,
|
|
344
|
+
o.range((e - s) / i, p, (e + 1 + s) / i, l),
|
|
345
345
|
o.data,
|
|
346
346
|
e,
|
|
347
347
|
n,
|
|
348
348
|
i,
|
|
349
349
|
u
|
|
350
350
|
), e === 0 && this._addTileFeatures(
|
|
351
|
-
o.range(1 - s / i,
|
|
351
|
+
o.range(1 - s / i, p, 1, l),
|
|
352
352
|
o.data,
|
|
353
353
|
i,
|
|
354
354
|
n,
|
|
355
355
|
i,
|
|
356
356
|
u
|
|
357
357
|
), e === i - 1 && this._addTileFeatures(
|
|
358
|
-
o.range(0,
|
|
358
|
+
o.range(0, p, s / i, l),
|
|
359
359
|
o.data,
|
|
360
360
|
-1,
|
|
361
361
|
n,
|
|
@@ -387,15 +387,15 @@ class Ot {
|
|
|
387
387
|
}
|
|
388
388
|
_addTileFeatures(t, e, n, o, i, a) {
|
|
389
389
|
for (const c of t) {
|
|
390
|
-
const s = c * this.stride,
|
|
390
|
+
const s = c * this.stride, p = e[s + P] > 1;
|
|
391
391
|
let l, u, f;
|
|
392
|
-
if (
|
|
392
|
+
if (p)
|
|
393
393
|
l = ot(e, s, this.clusterProps), u = e[s], f = e[s + 1];
|
|
394
394
|
else {
|
|
395
395
|
const y = this.points[e[s + A]];
|
|
396
396
|
l = y.properties;
|
|
397
|
-
const [
|
|
398
|
-
u = I(
|
|
397
|
+
const [h, m] = y.geometry.coordinates;
|
|
398
|
+
u = I(h), f = U(m);
|
|
399
399
|
}
|
|
400
400
|
const d = {
|
|
401
401
|
type: 1,
|
|
@@ -406,24 +406,24 @@ class Ot {
|
|
|
406
406
|
tags: l
|
|
407
407
|
};
|
|
408
408
|
let g;
|
|
409
|
-
|
|
409
|
+
p || this.options.generateId ? g = e[s + A] : g = this.points[e[s + A]].id, g !== void 0 && (d.id = g), a.features.push(d);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
_limitZoom(t) {
|
|
413
413
|
return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
|
|
414
414
|
}
|
|
415
415
|
_cluster(t, e) {
|
|
416
|
-
const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, c = n / (o * Math.pow(2, e)), s = t.data,
|
|
416
|
+
const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, c = n / (o * Math.pow(2, e)), s = t.data, p = [], l = this.stride;
|
|
417
417
|
for (let u = 0; u < s.length; u += l) {
|
|
418
418
|
if (s[u + x] <= e) continue;
|
|
419
419
|
s[u + x] = e;
|
|
420
420
|
const f = s[u], d = s[u + 1], g = t.within(s[u], s[u + 1], c), y = s[u + P];
|
|
421
|
-
let
|
|
421
|
+
let h = y;
|
|
422
422
|
for (const m of g) {
|
|
423
423
|
const M = m * l;
|
|
424
|
-
s[M + x] > e && (
|
|
424
|
+
s[M + x] > e && (h += s[M + P]);
|
|
425
425
|
}
|
|
426
|
-
if (
|
|
426
|
+
if (h > y && h >= a) {
|
|
427
427
|
let m = f * y, M = d * y, _, $ = -1;
|
|
428
428
|
const Z = ((u / l | 0) << 5) + (e + 1) + this.points.length;
|
|
429
429
|
for (const it of g) {
|
|
@@ -433,20 +433,20 @@ class Ot {
|
|
|
433
433
|
const k = s[E + P];
|
|
434
434
|
m += s[E] * k, M += s[E + 1] * k, s[E + N] = Z, i && (_ || (_ = this._map(s, u, !0), $ = this.clusterProps.length, this.clusterProps.push(_)), i(_, this._map(s, E)));
|
|
435
435
|
}
|
|
436
|
-
s[u + N] = Z,
|
|
436
|
+
s[u + N] = Z, p.push(m / h, M / h, 1 / 0, Z, -1, h), i && p.push($);
|
|
437
437
|
} else {
|
|
438
|
-
for (let m = 0; m < l; m++)
|
|
439
|
-
if (
|
|
438
|
+
for (let m = 0; m < l; m++) p.push(s[u + m]);
|
|
439
|
+
if (h > 1)
|
|
440
440
|
for (const m of g) {
|
|
441
441
|
const M = m * l;
|
|
442
442
|
if (!(s[M + x] <= e)) {
|
|
443
443
|
s[M + x] = e;
|
|
444
|
-
for (let _ = 0; _ < l; _++)
|
|
444
|
+
for (let _ = 0; _ < l; _++) p.push(s[M + _]);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
return
|
|
449
|
+
return p;
|
|
450
450
|
}
|
|
451
451
|
// get index of the point from which the cluster originated
|
|
452
452
|
_getOriginId(t) {
|
|
@@ -561,7 +561,7 @@ function Ct(r, t) {
|
|
|
561
561
|
return D.useEffect(r, bt(t));
|
|
562
562
|
}
|
|
563
563
|
var Lt = function(t) {
|
|
564
|
-
var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, c = z(), s = z(),
|
|
564
|
+
var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, c = z(), s = z(), p = L([]), l = p[0], u = p[1], f = Math.round(o);
|
|
565
565
|
return Ct(function() {
|
|
566
566
|
a !== !0 && ((!c.current || !v(s.current, e) || !v(c.current.options, i)) && (c.current = new Ot(i), c.current.load(e)), n && u(c.current.getClusters(n, f)), s.current = e);
|
|
567
567
|
}, [e, n, f, i, a]), {
|
|
@@ -569,67 +569,67 @@ var Lt = function(t) {
|
|
|
569
569
|
supercluster: c.current
|
|
570
570
|
};
|
|
571
571
|
};
|
|
572
|
-
const Rt = w(() => import("./index-
|
|
573
|
-
function Dt({
|
|
574
|
-
const { mapProvider:
|
|
572
|
+
const Rt = w(() => import("./index-Dy0j33aN.js")), It = w(() => import("./index-BOJCRr60.js")), Ut = w(() => import("./index-vIYPnHrB.js"));
|
|
573
|
+
function Dt({ isLoading: r, markers: t, onClick: e, ...n }) {
|
|
574
|
+
const { mapProvider: o, activeMarker: i, zoom: a, setMarkerPoints: c, setClusterPoints: s } = R();
|
|
575
575
|
H(() => {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}, [
|
|
581
|
-
const
|
|
576
|
+
if (r)
|
|
577
|
+
return;
|
|
578
|
+
const h = (t || []).map((m) => [m.longitude, m.latitude]);
|
|
579
|
+
c(h);
|
|
580
|
+
}, [t, c]);
|
|
581
|
+
const p = S(
|
|
582
582
|
() => ({
|
|
583
|
-
points:
|
|
583
|
+
points: t.map((h) => xt([h.longitude, h.latitude], h)),
|
|
584
584
|
// Using world bounds to avoid issues with markers near the edges of the map
|
|
585
585
|
bounds: ft,
|
|
586
586
|
zoom: a,
|
|
587
587
|
options: {
|
|
588
|
-
radius:
|
|
588
|
+
radius: o.name === "google" && a > J ? lt : ht,
|
|
589
589
|
minZoom: J,
|
|
590
590
|
maxZoom: pt
|
|
591
591
|
}
|
|
592
592
|
}),
|
|
593
|
-
[
|
|
594
|
-
), { clusters: l, supercluster: u } = Lt(
|
|
593
|
+
[t, o, a]
|
|
594
|
+
), { clusters: l, supercluster: u } = Lt(p), f = z("");
|
|
595
595
|
H(() => {
|
|
596
|
-
const
|
|
596
|
+
const h = JSON.stringify(
|
|
597
597
|
l.map((m) => ({
|
|
598
598
|
coords: m.geometry.coordinates,
|
|
599
599
|
props: m.properties
|
|
600
600
|
}))
|
|
601
601
|
);
|
|
602
|
-
|
|
602
|
+
h !== f.current && (s(l), f.current = h);
|
|
603
603
|
}, [l, s]);
|
|
604
|
-
const d = (
|
|
605
|
-
if (!("properties" in
|
|
604
|
+
const d = (h) => {
|
|
605
|
+
if (!("properties" in h))
|
|
606
606
|
throw new Error("Cluster does not have properties");
|
|
607
|
-
if (
|
|
608
|
-
|
|
609
|
-
id: `${
|
|
610
|
-
latitude:
|
|
611
|
-
longitude:
|
|
612
|
-
markers: u?.getLeaves(
|
|
607
|
+
if (h.properties?.cluster && typeof h.properties?.cluster_id == "number") {
|
|
608
|
+
e?.({
|
|
609
|
+
id: `${h.properties.cluster_id}`,
|
|
610
|
+
latitude: h.geometry.coordinates[1],
|
|
611
|
+
longitude: h.geometry.coordinates[0],
|
|
612
|
+
markers: u?.getLeaves(h.properties.cluster_id)?.map((m) => m.properties) ?? []
|
|
613
613
|
});
|
|
614
614
|
return;
|
|
615
615
|
}
|
|
616
|
-
|
|
617
|
-
id:
|
|
618
|
-
latitude:
|
|
619
|
-
longitude:
|
|
620
|
-
markers: [
|
|
616
|
+
e?.({
|
|
617
|
+
id: h.properties.id,
|
|
618
|
+
latitude: h.properties.latitude,
|
|
619
|
+
longitude: h.properties.longitude,
|
|
620
|
+
markers: [h.properties]
|
|
621
621
|
});
|
|
622
|
-
}, g = (
|
|
623
|
-
if (!u || !
|
|
624
|
-
if (
|
|
622
|
+
}, g = (h) => {
|
|
623
|
+
if (!u || !i) return !1;
|
|
624
|
+
if (i.id === `${h}`)
|
|
625
625
|
return !0;
|
|
626
626
|
try {
|
|
627
|
-
return u.getLeaves(
|
|
627
|
+
return u.getLeaves(h)?.find((m) => m.properties.id === i.id) !== void 0;
|
|
628
628
|
} catch {
|
|
629
629
|
return !1;
|
|
630
630
|
}
|
|
631
631
|
}, y = S(() => {
|
|
632
|
-
switch (
|
|
632
|
+
switch (o?.name) {
|
|
633
633
|
case "maptiler":
|
|
634
634
|
return Rt;
|
|
635
635
|
case "google":
|
|
@@ -639,34 +639,34 @@ function Dt({ markers: r, onClick: t, ...e }) {
|
|
|
639
639
|
default:
|
|
640
640
|
return null;
|
|
641
641
|
}
|
|
642
|
-
}, [
|
|
642
|
+
}, [o]);
|
|
643
643
|
return y ? /* @__PURE__ */ O(
|
|
644
644
|
y,
|
|
645
645
|
{
|
|
646
646
|
clusters: l,
|
|
647
647
|
onClick: d,
|
|
648
648
|
doesSuperclusterContainActiveMarker: g,
|
|
649
|
-
...
|
|
649
|
+
...n
|
|
650
650
|
}
|
|
651
651
|
) : null;
|
|
652
652
|
}
|
|
653
|
-
const Zt = w(() => import("./index-
|
|
653
|
+
const Zt = w(() => import("./index-Ci9PQ3VM.js")), Bt = w(() => import("./index-DHOxmHER.js")), Ft = w(() => import("./index-CWXZA3V3.js"));
|
|
654
654
|
function Nt({ children: r, anchor: t = "bottom", ...e }) {
|
|
655
655
|
const { mapProvider: n } = R(), o = S(() => {
|
|
656
656
|
switch (n?.name) {
|
|
657
657
|
case "maptiler":
|
|
658
658
|
return Zt;
|
|
659
659
|
case "google":
|
|
660
|
-
return Ft;
|
|
661
|
-
case "mapbox":
|
|
662
660
|
return Bt;
|
|
661
|
+
case "mapbox":
|
|
662
|
+
return Ft;
|
|
663
663
|
default:
|
|
664
664
|
return null;
|
|
665
665
|
}
|
|
666
666
|
}, [n]);
|
|
667
667
|
return o ? /* @__PURE__ */ O(o, { ...e, anchor: t, children: r }) : null;
|
|
668
668
|
}
|
|
669
|
-
const zt = w(() => import("./index-
|
|
669
|
+
const zt = w(() => import("./index-DKy2opdk.js")), jt = w(() => import("./index-k9UFzKZZ.js")), Gt = w(() => import("./index-D8-yY6UK.js"));
|
|
670
670
|
function $t(r) {
|
|
671
671
|
const { mapProvider: t } = R(), e = S(() => {
|
|
672
672
|
switch (t?.name) {
|
|
@@ -691,6 +691,7 @@ function kt(r) {
|
|
|
691
691
|
...r,
|
|
692
692
|
locale: r.locale || "en",
|
|
693
693
|
mapPadding: r.mapPadding || ut,
|
|
694
|
+
locationBoundary: r.locationBoundary ? r.locationBoundary : [[r.center.longitude, r.center.latitude]],
|
|
694
695
|
markerPoints: t,
|
|
695
696
|
setMarkerPoints: e,
|
|
696
697
|
clusterPoints: n,
|
|
@@ -2,7 +2,7 @@ import { jsx as c, Fragment as b } from "react/jsx-runtime";
|
|
|
2
2
|
import * as $ from "react";
|
|
3
3
|
import { useContext as S, useRef as k, useState as C, useMemo as g, useEffect as w, cloneElement as j } from "react";
|
|
4
4
|
import { b as x, d as u } from "./scale-control-Dsir9fWY.js";
|
|
5
|
-
import { g as I } from "./utils-
|
|
5
|
+
import { g as I } from "./utils-IAXGPK5I.js";
|
|
6
6
|
function s(t, e) {
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error(e);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
2
|
import { useState as L, useRef as M, useCallback as N, useEffect as f, useMemo as W } from "react";
|
|
3
3
|
import { useMap as _, InfoWindow as x } from "@vis.gl/react-google-maps";
|
|
4
|
-
import { u as z, P as y } from "./index-
|
|
5
|
-
import { c as H, m as j } from "./styles-
|
|
4
|
+
import { u as z, P as y } from "./index-D37STE_k.js";
|
|
5
|
+
import { c as H, m as j } from "./styles-B3ZaR0wz.js";
|
|
6
6
|
function Z({
|
|
7
7
|
latitude: g,
|
|
8
8
|
longitude: m,
|
|
@@ -2,7 +2,7 @@ import { jsx as f, Fragment as x } from "react/jsx-runtime";
|
|
|
2
2
|
import * as $ from "react";
|
|
3
3
|
import { useContext as S, useRef as k, useState as b, useMemo as g, useEffect as w, cloneElement as j } from "react";
|
|
4
4
|
import { b as C, d as u } from "./logo-control-CHapR1Dt.js";
|
|
5
|
-
import { g as I } from "./utils-
|
|
5
|
+
import { g as I } from "./utils-IAXGPK5I.js";
|
|
6
6
|
function s(t, e) {
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error(e);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { a as k } from "./logo-control-CHapR1Dt.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u, M } from "./index-
|
|
5
|
-
import { C as g, c as C, M as v } from "./index-
|
|
4
|
+
import { u, M } from "./index-D37STE_k.js";
|
|
5
|
+
import { C as g, c as C, M as v } from "./index-BUZonjTY.js";
|
|
6
6
|
function x({
|
|
7
7
|
clusters: n,
|
|
8
8
|
colors: o,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as P, Fragment as u } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as s, useContext as M, useEffect as g } from "react";
|
|
3
3
|
import { GoogleMapsContext as L } from "@vis.gl/react-google-maps";
|
|
4
|
-
import { a as
|
|
4
|
+
import { a as k } from "./utils-IAXGPK5I.js";
|
|
5
5
|
function f(o, e, r) {
|
|
6
6
|
switch (o) {
|
|
7
7
|
case "fill":
|
|
@@ -18,8 +18,8 @@ function f(o, e, r) {
|
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const [e, r] =
|
|
21
|
+
function O({ sources: o }) {
|
|
22
|
+
const [e, r] = s(null), [m, c] = s(
|
|
23
23
|
[]
|
|
24
24
|
), i = M(L);
|
|
25
25
|
return g(() => {
|
|
@@ -44,18 +44,19 @@ function E({ sources: o }) {
|
|
|
44
44
|
Object.assign(n, a);
|
|
45
45
|
}
|
|
46
46
|
let l;
|
|
47
|
+
const y = k(t.geometry, n.type);
|
|
47
48
|
return t.type === "LineString" ? l = new google.maps.Polyline({
|
|
48
49
|
// Set default options otherwise the polyline remains visible (even if eg: we only want the outline)
|
|
49
50
|
// We then overrider the default options with the layer options
|
|
50
51
|
strokeWeight: 6,
|
|
51
|
-
path:
|
|
52
|
+
path: y,
|
|
52
53
|
...n
|
|
53
54
|
}) : l = new google.maps.Polygon({
|
|
54
55
|
// Set default options otherwise the polygon remains visible (even if eg: we only want the outline)
|
|
55
56
|
// We then overrider the default options with the layer options
|
|
56
57
|
strokeWeight: 0,
|
|
57
58
|
fillOpacity: 0,
|
|
58
|
-
paths:
|
|
59
|
+
paths: y,
|
|
59
60
|
...n
|
|
60
61
|
}), l.setMap(e), l;
|
|
61
62
|
});
|
|
@@ -69,5 +70,5 @@ function E({ sources: o }) {
|
|
|
69
70
|
}, [e, o]), /* @__PURE__ */ P(u, {});
|
|
70
71
|
}
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
+
O as default
|
|
73
74
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { a as k } from "./scale-control-Dsir9fWY.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u, M } from "./index-
|
|
5
|
-
import { C as g, c as C, M as b } from "./index-
|
|
4
|
+
import { u, M } from "./index-D37STE_k.js";
|
|
5
|
+
import { C as g, c as C, M as b } from "./index-BUZonjTY.js";
|
|
6
6
|
function _({
|
|
7
7
|
clusters: n,
|
|
8
8
|
colors: r,
|