@local-logic/maps 0.0.16 → 0.0.18
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-NEUlLLtm.js → index-Be6RGKzc.js} +3 -3
- package/dist/{index-BvnFFiii.js → index-C0nB-ZYI.js} +2 -2
- package/dist/{index-CnuTCmRK.js → index-C1QREXT1.js} +2 -2
- package/dist/index-C7cTTXxY.js +24 -0
- package/dist/{index-DJ1PVoCd.js → index-C9z8YU4t.js} +3 -3
- package/dist/{index-Cg3HD19r.js → index-CBfuS_n2.js} +2 -2
- package/dist/{index-BUkdAOYF.js → index-C_RtwL3E.js} +5 -5
- package/dist/{index-Brp2pz_Z.js → index-DMwjyhBt.js} +3 -3
- package/dist/{index-Dzgb7feN.js → index-DUdSU2pv.js} +2 -2
- package/dist/{index-_YvDHCeI.js → index-DjQpPQGI.js} +1 -1
- package/dist/{index-CTU66ogZ.js → index-DnE7POcz.js} +1 -1
- package/dist/{index-3kRdcdZh.js → index-Dvg9jDs5.js} +1 -1
- package/dist/{index-x3wrHsPD.js → index-Dz1XJJEv.js} +1 -1
- package/dist/{index-DyGtnON3.js → index-gTk5Txmy.js} +2 -2
- package/dist/{index-CV_IAyz3.js → index-pztBT1mz.js} +2 -2
- package/dist/{index-Yh7bUURu.js → index-r9nwo0R7.js} +1 -1
- package/dist/index-t8m-nFSa.js +23 -0
- package/dist/index.es.js +1 -1
- package/dist/{index.modern-CLRs8JwI.js → index.modern-fpUBOYPT.js} +288 -282
- package/dist/index.umd.js +624 -251
- package/dist/{logo-control-NE-LlsRy.js → logo-control-BALqfBGo.js} +212 -202
- package/dist/mapbox-gl-Coz2msiN.js +34257 -0
- package/dist/maplibre-gl-CAHhS7Ky.js +21377 -0
- package/dist/{scale-control-CyJd4u6j.js → scale-control-BOI2g14-.js} +183 -173
- package/dist/src/components/Map/Root/CenterPin/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/CenterPin/Mapbox/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +30 -30
- package/dist/index-BFK3wMTT.js +0 -24
- package/dist/index-BQRXN0e-.js +0 -23
- package/dist/mapbox-gl-D58OubwB.js +0 -32266
- package/dist/maplibre-gl-CfOZKUDd.js +0 -20722
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as M from "react";
|
|
2
|
-
import { useContext as w, useMemo as x, useLayoutEffect as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
const t = (
|
|
2
|
+
import { useContext as w, useMemo as x, useLayoutEffect as $, useEffect as d, useState as J, useRef as b, useImperativeHandle as k, memo as _, forwardRef as z } from "react";
|
|
3
|
+
import { createPortal as H } from "react-dom";
|
|
4
|
+
const V = M.createContext(null);
|
|
5
|
+
function pt() {
|
|
6
|
+
var i;
|
|
7
|
+
const t = (i = w(V)) == null ? void 0 : i.maps, n = w(R);
|
|
8
8
|
return x(() => ({ ...t, current: n == null ? void 0 : n.map }), [t, n]);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const e = Array.isArray(t) ? t[0] : t ? t.x : 0,
|
|
12
|
-
return e ===
|
|
10
|
+
function K(t, n) {
|
|
11
|
+
const e = Array.isArray(t) ? t[0] : t ? t.x : 0, i = Array.isArray(t) ? t[1] : t ? t.y : 0, r = Array.isArray(n) ? n[0] : n ? n.x : 0, o = Array.isArray(n) ? n[1] : n ? n.y : 0;
|
|
12
|
+
return e === r && i === o;
|
|
13
13
|
}
|
|
14
14
|
function y(t, n) {
|
|
15
15
|
if (t === n)
|
|
@@ -26,17 +26,17 @@ function y(t, n) {
|
|
|
26
26
|
} else if (Array.isArray(n))
|
|
27
27
|
return !1;
|
|
28
28
|
if (typeof t == "object" && typeof n == "object") {
|
|
29
|
-
const e = Object.keys(t),
|
|
30
|
-
if (e.length !==
|
|
29
|
+
const e = Object.keys(t), i = Object.keys(n);
|
|
30
|
+
if (e.length !== i.length)
|
|
31
31
|
return !1;
|
|
32
|
-
for (const
|
|
33
|
-
if (!n.hasOwnProperty(
|
|
32
|
+
for (const r of e)
|
|
33
|
+
if (!n.hasOwnProperty(r) || !y(t[r], n[r]))
|
|
34
34
|
return !1;
|
|
35
35
|
return !0;
|
|
36
36
|
}
|
|
37
37
|
return !1;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function A(t) {
|
|
40
40
|
return {
|
|
41
41
|
longitude: t.center.lng,
|
|
42
42
|
latitude: t.center.lat,
|
|
@@ -46,37 +46,37 @@ function O(t) {
|
|
|
46
46
|
padding: t.padding
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const e = n.viewState || n,
|
|
49
|
+
function U(t, n) {
|
|
50
|
+
const e = n.viewState || n, i = {};
|
|
51
51
|
if ("longitude" in e && "latitude" in e && (e.longitude !== t.center.lng || e.latitude !== t.center.lat)) {
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const r = t.center.constructor;
|
|
53
|
+
i.center = new r(e.longitude, e.latitude);
|
|
54
54
|
}
|
|
55
|
-
return "zoom" in e && e.zoom !== t.zoom && (
|
|
55
|
+
return "zoom" in e && e.zoom !== t.zoom && (i.zoom = e.zoom), "bearing" in e && e.bearing !== t.bearing && (i.bearing = e.bearing), "pitch" in e && e.pitch !== t.pitch && (i.pitch = e.pitch), e.padding && t.padding && !y(e.padding, t.padding) && (i.padding = e.padding), i;
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
function
|
|
57
|
+
const Y = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
|
|
58
|
+
function I(t) {
|
|
59
59
|
if (!t)
|
|
60
60
|
return null;
|
|
61
61
|
if (typeof t == "string" || ("toJS" in t && (t = t.toJS()), !t.layers))
|
|
62
62
|
return t;
|
|
63
63
|
const n = {};
|
|
64
|
-
for (const
|
|
65
|
-
n[
|
|
66
|
-
const e = t.layers.map((
|
|
67
|
-
let
|
|
68
|
-
"interactive" in
|
|
69
|
-
const o = n[
|
|
64
|
+
for (const i of t.layers)
|
|
65
|
+
n[i.id] = i;
|
|
66
|
+
const e = t.layers.map((i) => {
|
|
67
|
+
let r = null;
|
|
68
|
+
"interactive" in i && (r = Object.assign({}, i), delete r.interactive);
|
|
69
|
+
const o = n[i.ref];
|
|
70
70
|
if (o) {
|
|
71
|
-
|
|
72
|
-
for (const s of
|
|
73
|
-
s in o && (
|
|
71
|
+
r = r || Object.assign({}, i), delete r.ref;
|
|
72
|
+
for (const s of Y)
|
|
73
|
+
s in o && (r[s] = o[s]);
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return r || i;
|
|
76
76
|
});
|
|
77
77
|
return { ...t, layers: e };
|
|
78
78
|
}
|
|
79
|
-
const
|
|
79
|
+
const F = { version: 8, sources: {}, layers: [] }, D = {
|
|
80
80
|
mousedown: "onMouseDown",
|
|
81
81
|
mouseup: "onMouseUp",
|
|
82
82
|
mouseover: "onMouseOver",
|
|
@@ -91,7 +91,7 @@ const I = { version: 8, sources: {}, layers: [] }, F = {
|
|
|
91
91
|
touchend: "onTouchEnd",
|
|
92
92
|
touchmove: "onTouchMove",
|
|
93
93
|
touchcancel: "onTouchCancel"
|
|
94
|
-
},
|
|
94
|
+
}, W = {
|
|
95
95
|
movestart: "onMoveStart",
|
|
96
96
|
move: "onMove",
|
|
97
97
|
moveend: "onMoveEnd",
|
|
@@ -107,7 +107,7 @@ const I = { version: 8, sources: {}, layers: [] }, F = {
|
|
|
107
107
|
pitchstart: "onPitchStart",
|
|
108
108
|
pitch: "onPitch",
|
|
109
109
|
pitchend: "onPitchEnd"
|
|
110
|
-
},
|
|
110
|
+
}, Z = {
|
|
111
111
|
wheel: "onWheel",
|
|
112
112
|
boxzoomstart: "onBoxZoomStart",
|
|
113
113
|
boxzoomend: "onBoxZoomEnd",
|
|
@@ -121,7 +121,7 @@ const I = { version: 8, sources: {}, layers: [] }, F = {
|
|
|
121
121
|
styledata: "onStyleData",
|
|
122
122
|
sourcedata: "onSourceData",
|
|
123
123
|
error: "onError"
|
|
124
|
-
},
|
|
124
|
+
}, Q = [
|
|
125
125
|
"minZoom",
|
|
126
126
|
"maxZoom",
|
|
127
127
|
"minPitch",
|
|
@@ -129,7 +129,7 @@ const I = { version: 8, sources: {}, layers: [] }, F = {
|
|
|
129
129
|
"maxBounds",
|
|
130
130
|
"projection",
|
|
131
131
|
"renderWorldCopies"
|
|
132
|
-
],
|
|
132
|
+
], X = [
|
|
133
133
|
"scrollZoom",
|
|
134
134
|
"boxZoom",
|
|
135
135
|
"dragRotate",
|
|
@@ -140,21 +140,21 @@ const I = { version: 8, sources: {}, layers: [] }, F = {
|
|
|
140
140
|
"touchPitch"
|
|
141
141
|
];
|
|
142
142
|
class P {
|
|
143
|
-
constructor(n, e,
|
|
144
|
-
this._map = null, this._internalUpdate = !1, this._hoveredFeatures = null, this._propsedCameraUpdate = null, this._styleComponents = {}, this._onEvent = (
|
|
145
|
-
const o = this.props[
|
|
146
|
-
o ? o(
|
|
147
|
-
}, this._onCameraEvent = (
|
|
143
|
+
constructor(n, e, i) {
|
|
144
|
+
this._map = null, this._internalUpdate = !1, this._hoveredFeatures = null, this._propsedCameraUpdate = null, this._styleComponents = {}, this._onEvent = (r) => {
|
|
145
|
+
const o = this.props[Z[r.type]];
|
|
146
|
+
o ? o(r) : r.type === "error" && console.error(r.error);
|
|
147
|
+
}, this._onCameraEvent = (r) => {
|
|
148
148
|
if (this._internalUpdate)
|
|
149
149
|
return;
|
|
150
|
-
|
|
151
|
-
const o = this.props[
|
|
152
|
-
o && o(
|
|
153
|
-
}, this._onCameraUpdate = (
|
|
154
|
-
(
|
|
155
|
-
const o = this.props[
|
|
156
|
-
o && (this.props.interactiveLayerIds &&
|
|
157
|
-
}, this._MapClass = n, this.props = e, this._initialize(
|
|
150
|
+
r.viewState = this._propsedCameraUpdate || A(this._map.transform);
|
|
151
|
+
const o = this.props[W[r.type]];
|
|
152
|
+
o && o(r);
|
|
153
|
+
}, this._onCameraUpdate = (r) => this._internalUpdate ? r : (this._propsedCameraUpdate = A(r), U(r, this.props)), this._onPointerEvent = (r) => {
|
|
154
|
+
(r.type === "mousemove" || r.type === "mouseout") && this._updateHover(r);
|
|
155
|
+
const o = this.props[D[r.type]];
|
|
156
|
+
o && (this.props.interactiveLayerIds && r.type !== "mouseover" && r.type !== "mouseout" && (r.features = this._hoveredFeatures || this._queryRenderedFeatures(r.point)), o(r), delete r.features);
|
|
157
|
+
}, this._MapClass = n, this.props = e, this._initialize(i);
|
|
158
158
|
}
|
|
159
159
|
get map() {
|
|
160
160
|
return this._map;
|
|
@@ -162,31 +162,31 @@ class P {
|
|
|
162
162
|
setProps(n) {
|
|
163
163
|
const e = this.props;
|
|
164
164
|
this.props = n;
|
|
165
|
-
const
|
|
166
|
-
this._updateStyle(n, e), this._updateStyleComponents(n), this._updateHandlers(n, e), (
|
|
165
|
+
const i = this._updateSettings(n, e), r = this._updateSize(n), o = this._updateViewState(n);
|
|
166
|
+
this._updateStyle(n, e), this._updateStyleComponents(n), this._updateHandlers(n, e), (i || r || o && !this._map.isMoving()) && this.redraw();
|
|
167
167
|
}
|
|
168
168
|
static reuse(n, e) {
|
|
169
|
-
const
|
|
170
|
-
if (!
|
|
169
|
+
const i = P.savedMaps.pop();
|
|
170
|
+
if (!i)
|
|
171
171
|
return null;
|
|
172
|
-
const
|
|
172
|
+
const r = i.map, o = r.getContainer();
|
|
173
173
|
for (e.className = o.className; o.childNodes.length > 0; )
|
|
174
174
|
e.appendChild(o.childNodes[0]);
|
|
175
|
-
|
|
176
|
-
const s =
|
|
177
|
-
s && (s.disconnect(), s.observe(e)),
|
|
175
|
+
r._container = e;
|
|
176
|
+
const s = r._resizeObserver;
|
|
177
|
+
s && (s.disconnect(), s.observe(e)), i.setProps({ ...n, styleDiffing: !1 }), r.resize();
|
|
178
178
|
const { initialViewState: a } = n;
|
|
179
|
-
return a && (a.bounds ?
|
|
179
|
+
return a && (a.bounds ? r.fitBounds(a.bounds, { ...a.fitBoundsOptions, duration: 0 }) : i._updateViewState(a)), r.isStyleLoaded() ? r.fire("load") : r.once("style.load", () => r.fire("load")), r._update(), i;
|
|
180
180
|
}
|
|
181
181
|
/* eslint-disable complexity,max-statements */
|
|
182
182
|
_initialize(n) {
|
|
183
|
-
const { props: e } = this, { mapStyle:
|
|
183
|
+
const { props: e } = this, { mapStyle: i = F } = e, r = {
|
|
184
184
|
...e,
|
|
185
185
|
...e.initialViewState,
|
|
186
186
|
container: n,
|
|
187
|
-
style:
|
|
188
|
-
}, o =
|
|
189
|
-
if (Object.assign(
|
|
187
|
+
style: I(i)
|
|
188
|
+
}, o = r.initialViewState || r.viewState || r;
|
|
189
|
+
if (Object.assign(r, {
|
|
190
190
|
center: [o.longitude || 0, o.latitude || 0],
|
|
191
191
|
zoom: o.zoom || 0,
|
|
192
192
|
pitch: o.pitch || 0,
|
|
@@ -195,7 +195,7 @@ class P {
|
|
|
195
195
|
const a = HTMLCanvasElement.prototype.getContext;
|
|
196
196
|
HTMLCanvasElement.prototype.getContext = () => (HTMLCanvasElement.prototype.getContext = a, e.gl);
|
|
197
197
|
}
|
|
198
|
-
const s = new this._MapClass(
|
|
198
|
+
const s = new this._MapClass(r);
|
|
199
199
|
o.padding && s.setPadding(o.padding), e.cursor && (s.getCanvas().style.cursor = e.cursor), s.transformCameraUpdate = this._onCameraUpdate, s.on("style.load", () => {
|
|
200
200
|
var a;
|
|
201
201
|
this._styleComponents = {
|
|
@@ -208,11 +208,11 @@ class P {
|
|
|
208
208
|
}), s.on("sourcedata", () => {
|
|
209
209
|
this._updateStyleComponents(this.props);
|
|
210
210
|
});
|
|
211
|
-
for (const a in F)
|
|
212
|
-
s.on(a, this._onPointerEvent);
|
|
213
211
|
for (const a in D)
|
|
214
|
-
s.on(a, this.
|
|
212
|
+
s.on(a, this._onPointerEvent);
|
|
215
213
|
for (const a in W)
|
|
214
|
+
s.on(a, this._onCameraEvent);
|
|
215
|
+
for (const a in Z)
|
|
216
216
|
s.on(a, this._onEvent);
|
|
217
217
|
this._map = s;
|
|
218
218
|
}
|
|
@@ -238,9 +238,9 @@ class P {
|
|
|
238
238
|
_updateSize(n) {
|
|
239
239
|
const { viewState: e } = n;
|
|
240
240
|
if (e) {
|
|
241
|
-
const
|
|
242
|
-
if (e.width !==
|
|
243
|
-
return
|
|
241
|
+
const i = this._map;
|
|
242
|
+
if (e.width !== i.transform.width || e.height !== i.transform.height)
|
|
243
|
+
return i.resize(), !0;
|
|
244
244
|
}
|
|
245
245
|
return !1;
|
|
246
246
|
}
|
|
@@ -251,9 +251,9 @@ class P {
|
|
|
251
251
|
@returns {bool} true if anything is changed
|
|
252
252
|
*/
|
|
253
253
|
_updateViewState(n) {
|
|
254
|
-
const e = this._map,
|
|
254
|
+
const e = this._map, i = e.transform;
|
|
255
255
|
if (!e.isMoving()) {
|
|
256
|
-
const o =
|
|
256
|
+
const o = U(i, n);
|
|
257
257
|
if (Object.keys(o).length > 0)
|
|
258
258
|
return this._internalUpdate = !0, e.jumpTo(o), this._internalUpdate = !1, !0;
|
|
259
259
|
}
|
|
@@ -265,23 +265,23 @@ class P {
|
|
|
265
265
|
@returns {bool} true if anything is changed
|
|
266
266
|
*/
|
|
267
267
|
_updateSettings(n, e) {
|
|
268
|
-
const
|
|
269
|
-
let
|
|
270
|
-
for (const o of
|
|
268
|
+
const i = this._map;
|
|
269
|
+
let r = !1;
|
|
270
|
+
for (const o of Q)
|
|
271
271
|
if (o in n && !y(n[o], e[o])) {
|
|
272
|
-
|
|
273
|
-
const s =
|
|
274
|
-
s == null || s.call(
|
|
272
|
+
r = !0;
|
|
273
|
+
const s = i[`set${o[0].toUpperCase()}${o.slice(1)}`];
|
|
274
|
+
s == null || s.call(i, n[o]);
|
|
275
275
|
}
|
|
276
|
-
return
|
|
276
|
+
return r;
|
|
277
277
|
}
|
|
278
278
|
/* Update map style to match props */
|
|
279
279
|
_updateStyle(n, e) {
|
|
280
280
|
if (n.cursor !== e.cursor && (this._map.getCanvas().style.cursor = n.cursor || ""), n.mapStyle !== e.mapStyle) {
|
|
281
|
-
const { mapStyle:
|
|
282
|
-
diff:
|
|
281
|
+
const { mapStyle: i = F, styleDiffing: r = !0 } = n, o = {
|
|
282
|
+
diff: r
|
|
283
283
|
};
|
|
284
|
-
"localIdeographFontFamily" in n && (o.localIdeographFontFamily = n.localIdeographFontFamily), this._map.setStyle(
|
|
284
|
+
"localIdeographFontFamily" in n && (o.localIdeographFontFamily = n.localIdeographFontFamily), this._map.setStyle(I(i), o);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
/* Update fog, light, projection and terrain to match props
|
|
@@ -289,41 +289,41 @@ class P {
|
|
|
289
289
|
* 1. They can not be applied right away. Certain conditions (style loaded, source loaded, etc.) must be met
|
|
290
290
|
* 2. They can be overwritten by mapStyle
|
|
291
291
|
*/
|
|
292
|
-
_updateStyleComponents({ light: n, projection: e, sky:
|
|
292
|
+
_updateStyleComponents({ light: n, projection: e, sky: i, terrain: r }) {
|
|
293
293
|
var a, c;
|
|
294
294
|
const o = this._map, s = this._styleComponents;
|
|
295
|
-
o.style._loaded && (n && !y(n, s.light) && (s.light = n, o.setLight(n)), e && !y(e, s.projection) && e !== ((a = s.projection) == null ? void 0 : a.type) && (s.projection = typeof e == "string" ? { type: e } : e, (c = o.setProjection) == null || c.call(o, s.projection)),
|
|
295
|
+
o.style._loaded && (n && !y(n, s.light) && (s.light = n, o.setLight(n)), e && !y(e, s.projection) && e !== ((a = s.projection) == null ? void 0 : a.type) && (s.projection = typeof e == "string" ? { type: e } : e, (c = o.setProjection) == null || c.call(o, s.projection)), i && !y(i, s.sky) && (s.sky = i, o.setSky(i)), r !== void 0 && !y(r, s.terrain) && (!r || o.getSource(r.source)) && (s.terrain = r, o.setTerrain(r)));
|
|
296
296
|
}
|
|
297
297
|
/* Update interaction handlers to match props */
|
|
298
298
|
_updateHandlers(n, e) {
|
|
299
|
-
const
|
|
300
|
-
for (const
|
|
301
|
-
const o = n[
|
|
302
|
-
y(o, s) || (o ? r
|
|
299
|
+
const i = this._map;
|
|
300
|
+
for (const r of X) {
|
|
301
|
+
const o = n[r] ?? !0, s = e[r] ?? !0;
|
|
302
|
+
y(o, s) || (o ? i[r].enable(o) : i[r].disable());
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
_queryRenderedFeatures(n) {
|
|
306
|
-
const e = this._map, { interactiveLayerIds:
|
|
306
|
+
const e = this._map, { interactiveLayerIds: i = [] } = this.props;
|
|
307
307
|
try {
|
|
308
308
|
return e.queryRenderedFeatures(n, {
|
|
309
|
-
layers:
|
|
309
|
+
layers: i.filter(e.getLayer.bind(e))
|
|
310
310
|
});
|
|
311
311
|
} catch {
|
|
312
312
|
return [];
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
_updateHover(n) {
|
|
316
|
-
var
|
|
316
|
+
var r;
|
|
317
317
|
const { props: e } = this;
|
|
318
318
|
if (e.interactiveLayerIds && (e.onMouseMove || e.onMouseEnter || e.onMouseLeave)) {
|
|
319
|
-
const o = n.type, s = ((
|
|
319
|
+
const o = n.type, s = ((r = this._hoveredFeatures) == null ? void 0 : r.length) > 0, a = this._queryRenderedFeatures(n.point), c = a.length > 0;
|
|
320
320
|
!c && s && (n.type = "mouseleave", this._onPointerEvent(n)), this._hoveredFeatures = a, c && !s && (n.type = "mouseenter", this._onPointerEvent(n)), n.type = o;
|
|
321
321
|
} else
|
|
322
322
|
this._hoveredFeatures = null;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
P.savedMaps = [];
|
|
326
|
-
const
|
|
326
|
+
const tt = [
|
|
327
327
|
"setMaxBounds",
|
|
328
328
|
"setMinZoom",
|
|
329
329
|
"setMaxZoom",
|
|
@@ -345,69 +345,66 @@ const Y = [
|
|
|
345
345
|
"setFog",
|
|
346
346
|
"remove"
|
|
347
347
|
];
|
|
348
|
-
function
|
|
348
|
+
function et(t) {
|
|
349
349
|
if (!t)
|
|
350
350
|
return null;
|
|
351
351
|
const n = t.map, e = {
|
|
352
352
|
getMap: () => n
|
|
353
353
|
};
|
|
354
|
-
for (const
|
|
355
|
-
!(
|
|
354
|
+
for (const i of nt(n))
|
|
355
|
+
!(i in e) && !tt.includes(i) && (e[i] = n[i].bind(n));
|
|
356
356
|
return e;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function nt(t) {
|
|
359
359
|
const n = /* @__PURE__ */ new Set();
|
|
360
360
|
let e = t;
|
|
361
361
|
for (; e; ) {
|
|
362
|
-
for (const
|
|
363
|
-
|
|
362
|
+
for (const i of Object.getOwnPropertyNames(e))
|
|
363
|
+
i[0] !== "_" && typeof t[i] == "function" && i !== "fire" && i !== "setEventedParent" && n.add(i);
|
|
364
364
|
e = Object.getPrototypeOf(e);
|
|
365
365
|
}
|
|
366
366
|
return Array.from(n);
|
|
367
367
|
}
|
|
368
|
-
const
|
|
369
|
-
function
|
|
370
|
-
const { RTLTextPlugin: e, maxParallelImageRequests:
|
|
368
|
+
const ot = typeof document < "u" ? $ : d;
|
|
369
|
+
function rt(t, n) {
|
|
370
|
+
const { RTLTextPlugin: e, maxParallelImageRequests: i, workerCount: r, workerUrl: o } = n;
|
|
371
371
|
if (e && t.getRTLTextPluginStatus && t.getRTLTextPluginStatus() === "unavailable") {
|
|
372
372
|
const { pluginUrl: s, lazy: a = !0 } = typeof e == "string" ? { pluginUrl: e } : e;
|
|
373
373
|
t.setRTLTextPlugin(s, (c) => {
|
|
374
374
|
c && console.error(c);
|
|
375
375
|
}, a);
|
|
376
376
|
}
|
|
377
|
-
|
|
377
|
+
i !== void 0 && t.setMaxParallelImageRequests(i), r !== void 0 && t.setWorkerCount(r), o !== void 0 && t.setWorkerUrl(o);
|
|
378
378
|
}
|
|
379
379
|
const R = M.createContext(null);
|
|
380
|
-
function
|
|
381
|
-
const e = w(
|
|
380
|
+
function it(t, n) {
|
|
381
|
+
const e = w(V), [i, r] = J(null), o = b(), { current: s } = b({ mapLib: null, map: null });
|
|
382
382
|
d(() => {
|
|
383
383
|
const l = t.mapLib;
|
|
384
|
-
let
|
|
385
|
-
return Promise.resolve(l || import("./maplibre-gl-
|
|
386
|
-
if (!
|
|
384
|
+
let m = !0, u;
|
|
385
|
+
return Promise.resolve(l || import("./maplibre-gl-CAHhS7Ky.js").then((f) => f.m)).then((f) => {
|
|
386
|
+
if (!m)
|
|
387
387
|
return;
|
|
388
388
|
if (!f)
|
|
389
389
|
throw new Error("Invalid mapLib");
|
|
390
|
-
const
|
|
391
|
-
if (!
|
|
390
|
+
const p = "Map" in f ? f : f.default;
|
|
391
|
+
if (!p.Map)
|
|
392
392
|
throw new Error("Invalid mapLib");
|
|
393
|
-
|
|
394
|
-
t.reuseMaps && (u = P.reuse(t, o.current)), u || (u = new P(m.Map, t, o.current)), s.map = Q(u), s.mapLib = m, i(u), e == null || e.onMapMount(s.map, t.id);
|
|
395
|
-
else
|
|
396
|
-
throw new Error("Map is not supported by this browser");
|
|
393
|
+
rt(p, t), t.reuseMaps && (u = P.reuse(t, o.current)), u || (u = new P(p.Map, t, o.current)), s.map = et(u), s.mapLib = p, r(u), e == null || e.onMapMount(s.map, t.id);
|
|
397
394
|
}).catch((f) => {
|
|
398
|
-
const { onError:
|
|
399
|
-
|
|
395
|
+
const { onError: p } = t;
|
|
396
|
+
p ? p({
|
|
400
397
|
type: "error",
|
|
401
398
|
target: null,
|
|
402
399
|
originalEvent: null,
|
|
403
400
|
error: f
|
|
404
401
|
}) : console.error(f);
|
|
405
402
|
}), () => {
|
|
406
|
-
|
|
403
|
+
m = !1, u && (e == null || e.onMapUnmount(t.id), t.reuseMaps ? u.recycle() : u.destroy());
|
|
407
404
|
};
|
|
408
|
-
}, []),
|
|
409
|
-
|
|
410
|
-
}),
|
|
405
|
+
}, []), ot(() => {
|
|
406
|
+
i && i.setProps(t);
|
|
407
|
+
}), k(n, () => s.map, [i]);
|
|
411
408
|
const a = x(() => ({
|
|
412
409
|
position: "relative",
|
|
413
410
|
width: "100%",
|
|
@@ -416,106 +413,119 @@ function nt(t, n) {
|
|
|
416
413
|
}), [t.style]), c = {
|
|
417
414
|
height: "100%"
|
|
418
415
|
};
|
|
419
|
-
return M.createElement("div", { id: t.id, ref: o, style: a },
|
|
416
|
+
return M.createElement("div", { id: t.id, ref: o, style: a }, i && M.createElement(
|
|
420
417
|
R.Provider,
|
|
421
418
|
{ value: s },
|
|
422
419
|
M.createElement("div", { "mapboxgl-children": "", style: c }, t.children)
|
|
423
420
|
));
|
|
424
421
|
}
|
|
425
|
-
const
|
|
422
|
+
const yt = M.forwardRef(it), st = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
|
|
426
423
|
function C(t, n) {
|
|
427
424
|
if (!t || !n)
|
|
428
425
|
return;
|
|
429
426
|
const e = t.style;
|
|
430
|
-
for (const
|
|
431
|
-
const
|
|
432
|
-
Number.isFinite(
|
|
427
|
+
for (const i in n) {
|
|
428
|
+
const r = n[i];
|
|
429
|
+
Number.isFinite(r) && !st.test(i) ? e[i] = `${r}px` : e[i] = r;
|
|
433
430
|
}
|
|
434
431
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
|
|
432
|
+
function q(t, n) {
|
|
433
|
+
if (t === n)
|
|
434
|
+
return null;
|
|
435
|
+
const e = j(t), i = j(n), r = [];
|
|
436
|
+
for (const o of i)
|
|
437
|
+
e.has(o) || r.push(o);
|
|
438
|
+
for (const o of e)
|
|
439
|
+
i.has(o) || r.push(o);
|
|
440
|
+
return r.length === 0 ? null : r;
|
|
441
|
+
}
|
|
442
|
+
function j(t) {
|
|
443
|
+
return new Set(t ? t.trim().split(/\s+/) : []);
|
|
444
|
+
}
|
|
445
|
+
const vt = _(z((t, n) => {
|
|
446
|
+
const { map: e, mapLib: i } = w(R), r = b({ props: t }), o = x(() => {
|
|
447
|
+
let T = !1;
|
|
440
448
|
M.Children.forEach(t.children, (v) => {
|
|
441
|
-
v && (
|
|
449
|
+
v && (T = !0);
|
|
442
450
|
});
|
|
443
|
-
const
|
|
451
|
+
const G = {
|
|
444
452
|
...t,
|
|
445
|
-
element:
|
|
446
|
-
}, S = new
|
|
453
|
+
element: T ? document.createElement("div") : void 0
|
|
454
|
+
}, S = new i.Marker(G);
|
|
447
455
|
return S.setLngLat([t.longitude, t.latitude]), S.getElement().addEventListener("click", (v) => {
|
|
448
|
-
var
|
|
449
|
-
(
|
|
456
|
+
var h, g;
|
|
457
|
+
(g = (h = r.current.props).onClick) == null || g.call(h, {
|
|
450
458
|
type: "click",
|
|
451
459
|
target: S,
|
|
452
460
|
originalEvent: v
|
|
453
461
|
});
|
|
454
462
|
}), S.on("dragstart", (v) => {
|
|
455
|
-
var
|
|
456
|
-
const
|
|
457
|
-
|
|
463
|
+
var g, L;
|
|
464
|
+
const h = v;
|
|
465
|
+
h.lngLat = o.getLngLat(), (L = (g = r.current.props).onDragStart) == null || L.call(g, h);
|
|
458
466
|
}), S.on("drag", (v) => {
|
|
459
|
-
var
|
|
460
|
-
const
|
|
461
|
-
|
|
467
|
+
var g, L;
|
|
468
|
+
const h = v;
|
|
469
|
+
h.lngLat = o.getLngLat(), (L = (g = r.current.props).onDrag) == null || L.call(g, h);
|
|
462
470
|
}), S.on("dragend", (v) => {
|
|
463
|
-
var
|
|
464
|
-
const
|
|
465
|
-
|
|
471
|
+
var g, L;
|
|
472
|
+
const h = v;
|
|
473
|
+
h.lngLat = o.getLngLat(), (L = (g = r.current.props).onDragEnd) == null || L.call(g, h);
|
|
466
474
|
}), S;
|
|
467
475
|
}, []);
|
|
468
476
|
d(() => (o.addTo(e.getMap()), () => {
|
|
469
477
|
o.remove();
|
|
470
478
|
}), []);
|
|
471
|
-
const { longitude: s, latitude: a, offset: c, style: l, draggable:
|
|
472
|
-
|
|
479
|
+
const { longitude: s, latitude: a, offset: c, style: l, draggable: m = !1, popup: u = null, rotation: f = 0, rotationAlignment: p = "auto", pitchAlignment: N = "auto" } = t;
|
|
480
|
+
d(() => {
|
|
473
481
|
C(o.getElement(), l);
|
|
474
|
-
}, [l]),
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
}, [l]), k(n, () => o, []);
|
|
483
|
+
const B = r.current.props;
|
|
484
|
+
(o.getLngLat().lng !== s || o.getLngLat().lat !== a) && o.setLngLat([s, a]), c && !K(o.getOffset(), c) && o.setOffset(c), o.isDraggable() !== m && o.setDraggable(m), o.getRotation() !== f && o.setRotation(f), o.getRotationAlignment() !== p && o.setRotationAlignment(p), o.getPitchAlignment() !== N && o.setPitchAlignment(N), o.getPopup() !== u && o.setPopup(u);
|
|
485
|
+
const O = q(B.className, t.className);
|
|
486
|
+
if (O)
|
|
487
|
+
for (const T of O)
|
|
488
|
+
o.toggleClassName(T);
|
|
489
|
+
return r.current.props = t, H(t.children, o.getElement());
|
|
490
|
+
})), _t = _(z((t, n) => {
|
|
491
|
+
const { map: e, mapLib: i } = w(R), r = x(() => document.createElement("div"), []), o = b({ props: t }), s = x(() => {
|
|
492
|
+
const a = { ...t }, c = new i.Popup(a);
|
|
484
493
|
return c.setLngLat([t.longitude, t.latitude]), c.once("open", (l) => {
|
|
485
|
-
var
|
|
486
|
-
(u = (
|
|
494
|
+
var m, u;
|
|
495
|
+
(u = (m = o.current.props).onOpen) == null || u.call(m, l);
|
|
487
496
|
}), c;
|
|
488
497
|
}, []);
|
|
489
498
|
if (d(() => {
|
|
490
499
|
const a = (c) => {
|
|
491
|
-
var l,
|
|
492
|
-
(
|
|
500
|
+
var l, m;
|
|
501
|
+
(m = (l = o.current.props).onClose) == null || m.call(l, c);
|
|
493
502
|
};
|
|
494
|
-
return s.on("close", a), s.setDOMContent(
|
|
503
|
+
return s.on("close", a), s.setDOMContent(r).addTo(e.getMap()), () => {
|
|
495
504
|
s.off("close", a), s.isOpen() && s.remove();
|
|
496
505
|
};
|
|
497
506
|
}, []), d(() => {
|
|
498
507
|
C(s.getElement(), t.style);
|
|
499
|
-
}, [t.style]),
|
|
500
|
-
const a =
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
508
|
+
}, [t.style]), k(n, () => s, []), s.isOpen()) {
|
|
509
|
+
const a = o.current.props;
|
|
510
|
+
(s.getLngLat().lng !== t.longitude || s.getLngLat().lat !== t.latitude) && s.setLngLat([t.longitude, t.latitude]), t.offset && !y(a.offset, t.offset) && s.setOffset(t.offset), (a.anchor !== t.anchor || a.maxWidth !== t.maxWidth) && (s.options.anchor = t.anchor, s.setMaxWidth(t.maxWidth));
|
|
511
|
+
const c = q(a.className, t.className);
|
|
512
|
+
if (c)
|
|
513
|
+
for (const l of c)
|
|
514
|
+
s.toggleClassName(l);
|
|
515
|
+
o.current.props = t;
|
|
506
516
|
}
|
|
507
|
-
return
|
|
517
|
+
return H(t.children, r);
|
|
508
518
|
}));
|
|
509
|
-
function E(t, n, e,
|
|
510
|
-
const
|
|
519
|
+
function E(t, n, e, i) {
|
|
520
|
+
const r = w(R), o = x(() => t(r), []);
|
|
511
521
|
return d(() => {
|
|
512
|
-
const s = n, a = null, c = typeof n == "function" ? n : null, { map: l } =
|
|
513
|
-
return l.hasControl(o) || (l.addControl(o, s == null ? void 0 : s.position), a && a(
|
|
514
|
-
c && c(
|
|
522
|
+
const s = n, a = null, c = typeof n == "function" ? n : null, { map: l } = r;
|
|
523
|
+
return l.hasControl(o) || (l.addControl(o, s == null ? void 0 : s.position), a && a(r)), () => {
|
|
524
|
+
c && c(r), l.hasControl(o) && l.removeControl(o);
|
|
515
525
|
};
|
|
516
526
|
}, []), o;
|
|
517
527
|
}
|
|
518
|
-
function
|
|
528
|
+
function at(t) {
|
|
519
529
|
const n = E(({ mapLib: e }) => new e.AttributionControl(t), {
|
|
520
530
|
position: t.position
|
|
521
531
|
});
|
|
@@ -523,8 +533,8 @@ function it(t) {
|
|
|
523
533
|
C(n._container, t.style);
|
|
524
534
|
}, [t.style]), null;
|
|
525
535
|
}
|
|
526
|
-
_(
|
|
527
|
-
function
|
|
536
|
+
_(at);
|
|
537
|
+
function ct(t) {
|
|
528
538
|
const n = E(({ mapLib: e }) => new e.FullscreenControl({
|
|
529
539
|
container: t.containerId && document.getElementById(t.containerId)
|
|
530
540
|
}), { position: t.position });
|
|
@@ -532,10 +542,10 @@ function rt(t) {
|
|
|
532
542
|
C(n._controlContainer, t.style);
|
|
533
543
|
}, [t.style]), null;
|
|
534
544
|
}
|
|
535
|
-
_(
|
|
536
|
-
function
|
|
537
|
-
const e = b({ props: t }),
|
|
538
|
-
const o = new
|
|
545
|
+
_(ct);
|
|
546
|
+
function lt(t, n) {
|
|
547
|
+
const e = b({ props: t }), i = E(({ mapLib: r }) => {
|
|
548
|
+
const o = new r.GeolocateControl(t), s = o._setupUI;
|
|
539
549
|
return o._setupUI = () => {
|
|
540
550
|
o._container.hasChildNodes() || s();
|
|
541
551
|
}, o.on("geolocate", (a) => {
|
|
@@ -555,12 +565,12 @@ function st(t, n) {
|
|
|
555
565
|
(l = (c = e.current.props).onTrackUserLocationEnd) == null || l.call(c, a);
|
|
556
566
|
}), o;
|
|
557
567
|
}, { position: t.position });
|
|
558
|
-
return e.current.props = t,
|
|
559
|
-
C(
|
|
568
|
+
return e.current.props = t, k(n, () => i, []), d(() => {
|
|
569
|
+
C(i._container, t.style);
|
|
560
570
|
}, [t.style]), null;
|
|
561
571
|
}
|
|
562
|
-
_(
|
|
563
|
-
function
|
|
572
|
+
_(z(lt));
|
|
573
|
+
function ut(t) {
|
|
564
574
|
const n = E(({ mapLib: e }) => new e.NavigationControl(t), {
|
|
565
575
|
position: t.position
|
|
566
576
|
});
|
|
@@ -568,19 +578,19 @@ function at(t) {
|
|
|
568
578
|
C(n._container, t.style);
|
|
569
579
|
}, [t.style]), null;
|
|
570
580
|
}
|
|
571
|
-
const
|
|
572
|
-
function
|
|
581
|
+
const Ct = _(ut);
|
|
582
|
+
function dt(t) {
|
|
573
583
|
const n = E(({ mapLib: o }) => new o.ScaleControl(t), {
|
|
574
584
|
position: t.position
|
|
575
|
-
}), e = b(t),
|
|
585
|
+
}), e = b(t), i = e.current;
|
|
576
586
|
e.current = t;
|
|
577
|
-
const { style:
|
|
578
|
-
return t.maxWidth !== void 0 && t.maxWidth !==
|
|
579
|
-
C(n._container,
|
|
580
|
-
}, [
|
|
587
|
+
const { style: r } = t;
|
|
588
|
+
return t.maxWidth !== void 0 && t.maxWidth !== i.maxWidth && (n.options.maxWidth = t.maxWidth), t.unit !== void 0 && t.unit !== i.unit && n.setUnit(t.unit), d(() => {
|
|
589
|
+
C(n._container, r);
|
|
590
|
+
}, [r]), null;
|
|
581
591
|
}
|
|
582
|
-
_(
|
|
583
|
-
function
|
|
592
|
+
_(dt);
|
|
593
|
+
function ft(t) {
|
|
584
594
|
const n = E(({ mapLib: e }) => new e.TerrainControl(t), {
|
|
585
595
|
position: t.position
|
|
586
596
|
});
|
|
@@ -588,20 +598,20 @@ function lt(t) {
|
|
|
588
598
|
C(n._container, t.style);
|
|
589
599
|
}, [t.style]), null;
|
|
590
600
|
}
|
|
591
|
-
_(
|
|
592
|
-
function
|
|
601
|
+
_(ft);
|
|
602
|
+
function mt(t) {
|
|
593
603
|
const n = E(({ mapLib: e }) => new e.LogoControl(t), { position: t.position });
|
|
594
604
|
return d(() => {
|
|
595
605
|
C(n._container, t.style);
|
|
596
606
|
}, [t.style]), null;
|
|
597
607
|
}
|
|
598
|
-
_(
|
|
608
|
+
_(mt);
|
|
599
609
|
export {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
610
|
+
yt as M,
|
|
611
|
+
Ct as N,
|
|
612
|
+
_t as P,
|
|
613
|
+
vt as a,
|
|
604
614
|
R as b,
|
|
605
615
|
y as d,
|
|
606
|
-
|
|
616
|
+
pt as u
|
|
607
617
|
};
|