@geoql/v-maplibre 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +100 -120
  2. package/dist/constants/events/index.d.ts +4 -0
  3. package/dist/constants/events/layer.d.ts +2 -0
  4. package/dist/constants/events/map.d.ts +2 -0
  5. package/dist/constants/events/marker.d.ts +2 -0
  6. package/dist/constants/events/popup.d.ts +1 -0
  7. package/dist/controls/attribution/VControlAttribution.vue.d.ts +21 -0
  8. package/dist/controls/attribution/index.d.ts +1 -0
  9. package/dist/controls/attribution/types.d.ts +1 -0
  10. package/dist/controls/fullscreen/VControlFullscreen.vue.d.ts +11 -0
  11. package/dist/controls/fullscreen/index.d.ts +1 -0
  12. package/dist/controls/fullscreen/types.d.ts +1 -0
  13. package/dist/controls/geolocate/VControlGeolocate.vue.d.ts +11 -0
  14. package/dist/controls/geolocate/events.d.ts +1 -0
  15. package/dist/controls/geolocate/index.d.ts +1 -0
  16. package/dist/controls/geolocate/types.d.ts +1 -0
  17. package/dist/controls/index.d.ts +5 -0
  18. package/dist/controls/navigation/VControlNavigation.vue.d.ts +11 -0
  19. package/dist/controls/navigation/index.d.ts +1 -0
  20. package/dist/controls/navigation/types.d.ts +6 -0
  21. package/dist/controls/scale/VControlScale.vue.d.ts +21 -0
  22. package/dist/controls/scale/index.d.ts +1 -0
  23. package/dist/controls/scale/types.d.ts +1 -0
  24. package/dist/index-BdU-GZRP.js +56221 -0
  25. package/dist/index-BdU-GZRP.js.map +1 -0
  26. package/dist/index-_bcbVwuT.js +5106 -0
  27. package/dist/index-_bcbVwuT.js.map +1 -0
  28. package/dist/index.d.ts +8 -0
  29. package/dist/index.js +55 -1454
  30. package/dist/index.js.map +1 -1
  31. package/dist/layers/deckgl/_shared/index.d.ts +2 -0
  32. package/dist/layers/deckgl/_shared/types.d.ts +29 -0
  33. package/dist/layers/deckgl/_shared/useDeckOverlay.d.ts +30 -0
  34. package/dist/layers/deckgl/arc/VLayerDeckglArc.vue.d.ts +112 -0
  35. package/dist/layers/deckgl/arc/index.d.ts +1 -0
  36. package/dist/layers/deckgl/bitmap/VLayerDeckglBitmap.vue.d.ts +98 -0
  37. package/dist/layers/deckgl/bitmap/index.d.ts +1 -0
  38. package/dist/layers/deckgl/column/VLayerDeckglColumn.vue.d.ts +130 -0
  39. package/dist/layers/deckgl/column/index.d.ts +1 -0
  40. package/dist/layers/deckgl/contour/VLayerDeckglContour.vue.d.ts +110 -0
  41. package/dist/layers/deckgl/contour/index.d.ts +1 -0
  42. package/dist/layers/deckgl/generic/VLayerDeckgl.vue.d.ts +78 -0
  43. package/dist/layers/deckgl/generic/index.d.ts +1 -0
  44. package/dist/layers/deckgl/geohash/VLayerDeckglGeohash.vue.d.ts +116 -0
  45. package/dist/layers/deckgl/geohash/index.d.ts +1 -0
  46. package/dist/layers/deckgl/geojson/VLayerDeckglGeojson.vue.d.ts +134 -0
  47. package/dist/layers/deckgl/geojson/index.d.ts +1 -0
  48. package/dist/layers/deckgl/great-circle/VLayerDeckglGreatCircle.vue.d.ts +110 -0
  49. package/dist/layers/deckgl/great-circle/index.d.ts +1 -0
  50. package/dist/layers/deckgl/grid/VLayerDeckglGrid.vue.d.ts +124 -0
  51. package/dist/layers/deckgl/grid/index.d.ts +1 -0
  52. package/dist/layers/deckgl/grid-cell/VLayerDeckglGridCell.vue.d.ts +105 -0
  53. package/dist/layers/deckgl/grid-cell/index.d.ts +1 -0
  54. package/dist/layers/deckgl/h3-cluster/VLayerDeckglH3Cluster.vue.d.ts +116 -0
  55. package/dist/layers/deckgl/h3-cluster/index.d.ts +1 -0
  56. package/dist/layers/deckgl/h3-hexagon/VLayerDeckglH3Hexagon.vue.d.ts +120 -0
  57. package/dist/layers/deckgl/h3-hexagon/index.d.ts +1 -0
  58. package/dist/layers/deckgl/heatmap/VLayerDeckglHeatmap.vue.d.ts +107 -0
  59. package/dist/layers/deckgl/heatmap/index.d.ts +1 -0
  60. package/dist/layers/deckgl/hexagon/VLayerDeckglHexagon.vue.d.ts +123 -0
  61. package/dist/layers/deckgl/hexagon/index.d.ts +1 -0
  62. package/dist/layers/deckgl/icon/VLayerDeckglIcon.vue.d.ts +124 -0
  63. package/dist/layers/deckgl/icon/index.d.ts +1 -0
  64. package/dist/layers/deckgl/index.d.ts +35 -0
  65. package/dist/layers/deckgl/line/VLayerDeckglLine.vue.d.ts +106 -0
  66. package/dist/layers/deckgl/line/index.d.ts +1 -0
  67. package/dist/layers/deckgl/mvt/VLayerDeckglMVT.vue.d.ts +138 -0
  68. package/dist/layers/deckgl/mvt/index.d.ts +1 -0
  69. package/dist/layers/deckgl/path/VLayerDeckglPath.vue.d.ts +113 -0
  70. package/dist/layers/deckgl/path/index.d.ts +1 -0
  71. package/dist/layers/deckgl/point-cloud/VLayerDeckglPointCloud.vue.d.ts +101 -0
  72. package/dist/layers/deckgl/point-cloud/index.d.ts +1 -0
  73. package/dist/layers/deckgl/polygon/VLayerDeckglPolygon.vue.d.ts +122 -0
  74. package/dist/layers/deckgl/polygon/index.d.ts +1 -0
  75. package/dist/layers/deckgl/quadkey/VLayerDeckglQuadkey.vue.d.ts +116 -0
  76. package/dist/layers/deckgl/quadkey/index.d.ts +1 -0
  77. package/dist/layers/deckgl/s2/VLayerDeckglS2.vue.d.ts +116 -0
  78. package/dist/layers/deckgl/s2/index.d.ts +1 -0
  79. package/dist/layers/deckgl/scatterplot/VLayerDeckglScatterplot.vue.d.ts +122 -0
  80. package/dist/layers/deckgl/scatterplot/index.d.ts +1 -0
  81. package/dist/layers/deckgl/scenegraph/VLayerDeckglScenegraph.vue.d.ts +109 -0
  82. package/dist/layers/deckgl/scenegraph/index.d.ts +1 -0
  83. package/dist/layers/deckgl/screen-grid/VLayerDeckglScreenGrid.vue.d.ts +105 -0
  84. package/dist/layers/deckgl/screen-grid/index.d.ts +1 -0
  85. package/dist/layers/deckgl/simple-mesh/VLayerDeckglSimpleMesh.vue.d.ts +108 -0
  86. package/dist/layers/deckgl/simple-mesh/index.d.ts +1 -0
  87. package/dist/layers/deckgl/solid-polygon/VLayerDeckglSolidPolygon.vue.d.ts +106 -0
  88. package/dist/layers/deckgl/solid-polygon/index.d.ts +1 -0
  89. package/dist/layers/deckgl/terrain/VLayerDeckglTerrain.vue.d.ts +115 -0
  90. package/dist/layers/deckgl/terrain/index.d.ts +1 -0
  91. package/dist/layers/deckgl/text/VLayerDeckglText.vue.d.ts +132 -0
  92. package/dist/layers/deckgl/text/index.d.ts +1 -0
  93. package/dist/layers/deckgl/tile/VLayerDeckglTile.vue.d.ts +130 -0
  94. package/dist/layers/deckgl/tile/index.d.ts +1 -0
  95. package/dist/layers/deckgl/tile-3d/VLayerDeckglTile3D.vue.d.ts +103 -0
  96. package/dist/layers/deckgl/tile-3d/index.d.ts +1 -0
  97. package/dist/layers/deckgl/trips/VLayerDeckglTrips.vue.d.ts +118 -0
  98. package/dist/layers/deckgl/trips/index.d.ts +1 -0
  99. package/dist/layers/deckgl/wms/VLayerDeckglWMS.vue.d.ts +96 -0
  100. package/dist/layers/deckgl/wms/index.d.ts +1 -0
  101. package/dist/layers/index.d.ts +9 -0
  102. package/dist/layers/maplibre/canvas/VLayerMaplibreCanvas.vue.d.ts +25 -0
  103. package/dist/layers/maplibre/canvas/index.d.ts +1 -0
  104. package/dist/layers/maplibre/cluster/VLayerMaplibreCluster.vue.d.ts +63 -0
  105. package/dist/layers/maplibre/cluster/index.d.ts +1 -0
  106. package/dist/layers/maplibre/geojson/VLayerMaplibreGeojson.vue.d.ts +36 -0
  107. package/dist/layers/maplibre/geojson/index.d.ts +2 -0
  108. package/dist/layers/maplibre/geojson/types.d.ts +8 -0
  109. package/dist/layers/maplibre/image/VLayerMaplibreImage.vue.d.ts +70 -0
  110. package/dist/layers/maplibre/image/index.d.ts +1 -0
  111. package/dist/layers/maplibre/pmtile/VLayerMaplibrePmtile.vue.d.ts +60 -0
  112. package/dist/layers/maplibre/pmtile/index.d.ts +1 -0
  113. package/dist/layers/maplibre/raster/VLayerMaplibreRaster.vue.d.ts +21 -0
  114. package/dist/layers/maplibre/raster/index.d.ts +1 -0
  115. package/dist/layers/maplibre/vector/VLayerMaplibreVector.vue.d.ts +49 -0
  116. package/dist/layers/maplibre/vector/index.d.ts +1 -0
  117. package/dist/layers/maplibre/video/VLayerMaplibreVideo.vue.d.ts +70 -0
  118. package/dist/layers/maplibre/video/index.d.ts +1 -0
  119. package/dist/map/VMap.vue.d.ts +131 -0
  120. package/dist/markers/VMarker.vue.d.ts +29 -0
  121. package/dist/popups/VPopup.vue.d.ts +38 -0
  122. package/dist/utils/index.d.ts +2 -0
  123. package/dist/utils/injects.d.ts +8 -0
  124. package/dist/utils/symbols.d.ts +7 -0
  125. package/package.json +73 -39
package/dist/index.js CHANGED
@@ -1,1457 +1,58 @@
1
- import { inject as O, defineComponent as h, useSlots as R, onMounted as S, renderSlot as _, ref as b, watch as v, onBeforeUnmount as C, createBlock as J, openBlock as M, computed as V, provide as T, shallowRef as B, createElementBlock as j, createCommentVNode as D, withCtx as F } from "vue";
2
- import U, { AttributionControl as Z, FullscreenControl as K, GeolocateControl as W, NavigationControl as H, ScaleControl as Q, Map as X, Popup as Y, Marker as ee } from "maplibre-gl";
3
- import { PMTiles as re, Protocol as te } from "pmtiles";
4
- function P(p, t) {
5
- const e = O(p, t);
6
- if (!e)
7
- throw new Error(`Could not resolve ${p.description}`);
8
- return e;
9
- }
10
- const E = Symbol("Map"), G = Symbol("Protocol"), pe = /* @__PURE__ */ h({
11
- __name: "VControlAttribution",
12
- props: {
13
- options: { default: void 0 },
14
- position: { default: "bottom-right" }
15
- },
16
- setup(p) {
17
- const t = {
18
- compact: !1,
19
- customAttribution: void 0
20
- }, e = p, y = R(), i = P(E);
21
- S(() => {
22
- u();
23
- });
24
- const u = () => {
25
- let d = t;
26
- e.options && (d = {
27
- ...e.options
28
- }), y && y.default?.() && (d.customAttribution = y.default()[0].children);
29
- const m = new Z(d);
30
- i.value.addControl(m, e.position);
31
- };
32
- return (d, m) => _(d.$slots, "default");
33
- }
34
- }), fe = /* @__PURE__ */ h({
35
- __name: "VControlFullscreen",
36
- props: {
37
- options: { default: void 0 },
38
- position: { default: "top-left" }
39
- },
40
- setup(p) {
41
- const t = {
42
- container: void 0
43
- }, e = p, y = P(E);
44
- S(() => {
45
- i();
46
- });
47
- const i = () => {
48
- const u = new K(e.options || t);
49
- y.value.addControl(u, e.position);
50
- };
51
- return () => {
52
- };
53
- }
54
- }), x = [
55
- "geolocate",
56
- "error",
57
- "outofmaxbounds",
58
- "trackuserlocationstart",
59
- "trackuserlocationend"
60
- ], me = /* @__PURE__ */ h({
61
- __name: "VControlGeolocate",
62
- props: {
63
- options: { default: void 0 },
64
- position: { default: "top-left" }
65
- },
66
- emits: x,
67
- setup(p, { emit: t }) {
68
- const e = {
69
- fitBoundsOptions: {
70
- linear: !1,
71
- offset: [0, 0],
72
- maxZoom: 22
73
- },
74
- positionOptions: {
75
- enableHighAccuracy: !0,
76
- maximumAge: 0,
77
- timeout: 6e3
78
- },
79
- trackUserLocation: !0,
80
- showAccuracyCircle: !0,
81
- showUserLocation: !0
82
- }, y = p, i = t, u = P(E);
83
- S(() => {
84
- d();
85
- });
86
- const d = () => {
87
- const m = new W(y.options || e);
88
- u.value.addControl(m, y.position), x.forEach((g) => {
89
- m.on(g, () => {
90
- i(g);
91
- });
92
- });
93
- };
94
- return () => {
95
- };
96
- }
97
- }), ge = /* @__PURE__ */ h({
98
- __name: "VControlNavigation",
99
- props: {
100
- options: { default: void 0 },
101
- position: { default: "top-left" }
102
- },
103
- setup(p) {
104
- const t = {
105
- showCompass: !0,
106
- showZoom: !0,
107
- visualizePitch: !0
108
- }, e = p, y = O(E);
109
- S(() => {
110
- i();
111
- });
112
- const i = () => {
113
- const u = new H(e.options || t);
114
- y.value.addControl(u, e.position);
115
- };
116
- return () => {
117
- };
118
- }
119
- }), ve = /* @__PURE__ */ h({
120
- __name: "VControlScale",
121
- props: {
122
- options: { default: void 0 },
123
- position: { default: "bottom-left" }
124
- },
125
- setup(p) {
126
- const t = {
127
- maxWidth: 100,
128
- unit: "metric"
129
- }, e = p, y = O(E);
130
- S(() => {
131
- i();
132
- });
133
- const i = () => {
134
- const u = new Q(e.options || t);
135
- y?.value.addControl(u, e.position);
136
- };
137
- return (u, d) => _(u.$slots, "default");
138
- }
139
- }), Ie = /* @__PURE__ */ h({
140
- __name: "VLayerMaplibreCanvas",
141
- props: {
142
- source: {},
143
- layer: {},
144
- sourceId: { default: "maplibre.gl-canvas-source" },
145
- layerId: { default: "maplibre.gl-canvas-layer" },
146
- before: { default: "" }
147
- },
148
- setup(p) {
149
- const t = p, e = P(E), y = b(!1), i = () => e.value || null, u = (r) => {
150
- r && r.on("style.load", () => {
151
- const a = () => {
152
- r.isStyleLoaded() ? y.value = !0 : (y.value = !1, setTimeout(a, 200));
153
- };
154
- a();
155
- });
156
- }, d = () => {
157
- const r = i();
158
- if (r)
159
- try {
160
- if (r.getSource(t.sourceId) || r.addSource(t.sourceId, t.source), !r.getLayer(t.layerId)) {
161
- const a = {
162
- ...t.layer,
163
- id: t.layerId,
164
- source: t.sourceId
165
- };
166
- r.addLayer(a, t.before);
167
- }
168
- } catch (a) {
169
- console.error("Error adding Canvas layer:", a);
170
- }
171
- }, m = () => {
172
- const r = i();
173
- if (r)
174
- try {
175
- r.getLayer(t.layerId) && r.removeLayer(t.layerId), r.getSource(t.sourceId) && r.removeSource(t.sourceId), r.addSource(t.sourceId, t.source);
176
- const a = {
177
- ...t.layer,
178
- id: t.layerId,
179
- source: t.sourceId
180
- };
181
- r.addLayer(a, t.before);
182
- } catch (a) {
183
- console.error("Error updating Canvas source:", a);
184
- }
185
- }, g = () => {
186
- const r = i();
187
- if (r)
188
- try {
189
- r.getLayer(t.layerId) && (Object.entries(t.layer.paint || {}).forEach(([a, f]) => {
190
- r.setPaintProperty(t.layerId, a, f);
191
- }), Object.entries(t.layer.layout || {}).forEach(([a, f]) => {
192
- r.setLayoutProperty(t.layerId, a, f);
193
- }));
194
- } catch (a) {
195
- console.error("Error updating Canvas layer:", a);
196
- }
197
- };
198
- return v(() => t.source, m, { deep: !0 }), v(() => t.layer, g, { deep: !0 }), v(
199
- e,
200
- (r) => {
201
- r && u(r);
202
- },
203
- { immediate: !0 }
204
- ), v(y, (r) => {
205
- r && d();
206
- }), S(() => {
207
- i()?.isStyleLoaded() && d();
208
- }), C(() => {
209
- const r = i();
210
- if (r)
211
- try {
212
- r.getLayer(t.layerId) && r.removeLayer(t.layerId), r.getSource(t.sourceId) && r.removeSource(t.sourceId);
213
- } catch (a) {
214
- console.error("Error cleaning up Canvas layer:", a);
215
- }
216
- }), (r, a) => _(r.$slots, "default");
217
- }
218
- }), Le = /* @__PURE__ */ h({
219
- __name: "VLayerMaplibreGeojson",
220
- props: {
221
- sourceId: { default: "maplibre-gl-geojson-source" },
222
- layerId: { default: "maplibre-gl-geojson-layer" },
223
- source: {},
224
- layer: {},
225
- before: { default: "" }
226
- },
227
- emits: ["on-click"],
228
- setup(p, { emit: t }) {
229
- const e = p, y = t, i = P(E), u = b(!1), d = (o) => !o || typeof o == "string" ? !1 : o && typeof o == "object" && "type" in o ? o.type === "FeatureCollection" && "features" in o ? o.features.length > 0 : o.type === "Feature" || o.type === "Point" || o.type === "LineString" || o.type === "Polygon" || o.type === "MultiPoint" || o.type === "MultiLineString" || o.type === "MultiPolygon" : !1, m = () => i.value || null, g = (o) => {
230
- o && o.on("style.load", () => {
231
- const l = () => {
232
- o.isStyleLoaded() ? u.value = !0 : (u.value = !1, setTimeout(l, 200));
233
- };
234
- l();
235
- });
236
- }, r = () => {
237
- const o = m();
238
- if (!(!o || !o.isStyleLoaded())) {
239
- if (!d(e.source.data)) {
240
- console.log(
241
- `[${e.layerId}] Waiting for valid data before adding layer`
242
- );
243
- return;
244
- }
245
- try {
246
- if (o.getSource(e.sourceId) || o.addSource(e.sourceId, e.source), !o.getLayer(e.layerId)) {
247
- const l = {
248
- ...e.layer,
249
- id: e.layerId,
250
- source: e.sourceId
251
- };
252
- o.addLayer(l, e.before);
253
- }
254
- } catch (l) {
255
- console.error("Error adding GeoJSON layer:", l);
256
- }
257
- }
258
- }, a = () => {
259
- const o = m();
260
- if (o)
261
- try {
262
- const l = o.getSource(e.sourceId);
263
- if (l && "setData" in l) {
264
- const I = o.getStyle().layers.filter(
265
- (s) => s.type !== "background" && "source" in s && s.source === e.sourceId
266
- );
267
- (I.length === 0 || I[0]?.id === e.layerId) && l.setData(e.source.data);
268
- } else l || r();
269
- } catch (l) {
270
- console.error("Error updating GeoJSON source:", l);
271
- }
272
- }, f = () => {
273
- const o = m();
274
- if (o)
275
- try {
276
- o.getLayer(e.layerId) ? (Object.entries(e.layer.paint || {}).forEach(([l, I]) => {
277
- o.setPaintProperty(e.layerId, l, I);
278
- }), Object.entries(e.layer.layout || {}).forEach(([l, I]) => {
279
- o.setLayoutProperty(e.layerId, l, I);
280
- })) : r();
281
- } catch (l) {
282
- console.error("Error updating GeoJSON layer:", l);
283
- }
284
- }, n = (o) => {
285
- if (o)
286
- try {
287
- o.on("click", e.layerId, (l) => {
288
- l.features && l.features.length > 0 && y("on-click", {
289
- features: l.features,
290
- coordinates: l.lngLat
291
- });
292
- }), o.on("mouseenter", e.layerId, () => {
293
- o.getCanvas().style.cursor = "pointer";
294
- }), o.on("mouseleave", e.layerId, () => {
295
- o.getCanvas().style.cursor = "";
296
- });
297
- } catch (l) {
298
- console.error("Error in setupLayerEvents:", l);
299
- }
300
- };
301
- return v(
302
- () => e.source,
303
- (o, l) => {
304
- if (d(o?.data) && JSON.stringify(o.data) !== JSON.stringify(l?.data)) {
305
- const I = m();
306
- I?.isStyleLoaded() && (I.getSource(e.sourceId) ? a() : r());
307
- }
308
- },
309
- { deep: !0 }
310
- ), v(() => e.layer, f, { deep: !0 }), v(
311
- i,
312
- (o) => {
313
- o && (g(o), o.isStyleLoaded() && (u.value = !0));
314
- },
315
- { immediate: !0 }
316
- ), v(u, (o) => {
317
- if (o && d(e.source.data)) {
318
- const l = m();
319
- l && (r(), n(l));
320
- }
321
- }), v(
322
- () => e.layer.layout?.visibility,
323
- (o) => {
324
- const l = m();
325
- if (!l || !l.isStyleLoaded()) return;
326
- const I = l.getLayer(e.layerId);
327
- if (!I && o === "visible")
328
- d(e.source.data) && r();
329
- else if (I)
330
- try {
331
- l.setLayoutProperty(
332
- e.layerId,
333
- "visibility",
334
- o
335
- );
336
- } catch (s) {
337
- console.error(
338
- `Error updating visibility for ${e.layerId}:`,
339
- s
340
- );
341
- }
342
- },
343
- { immediate: !0 }
344
- ), S(() => {
345
- try {
346
- m()?.isStyleLoaded() && d(e.source.data) && r();
347
- } catch (o) {
348
- console.error("Error adding layer:", o);
349
- }
350
- }), C(() => {
351
- const o = m();
352
- if (o)
353
- try {
354
- o.getLayer(e.layerId) && o.removeLayer(e.layerId), o.getStyle().layers.filter(
355
- (I) => I.type !== "background" && "source" in I && I.source === e.sourceId
356
- ).length === 0 && o.getSource(e.sourceId) && o.removeSource(e.sourceId);
357
- } catch (l) {
358
- console.error("Error cleaning up GeoJSON layer:", l);
359
- }
360
- }), (o, l) => _(o.$slots, "default");
361
- }
362
- }), be = /* @__PURE__ */ h({
363
- __name: "VLayerMaplibreImage",
364
- props: {
365
- sourceId: {
366
- type: String,
367
- default: "maplibre.gl-image-source",
368
- required: !0
369
- },
370
- layerId: {
371
- type: String,
372
- default: "maplibre.gl-image-layer",
373
- required: !0
374
- },
375
- source: {
376
- type: Object,
377
- required: !0
378
- },
379
- layer: {
380
- type: Object,
381
- default: () => ({}),
382
- required: !0
383
- },
384
- before: {
385
- type: String,
386
- default: "",
387
- required: !1
388
- }
389
- },
390
- setup(p) {
391
- const t = p, e = P(E), y = b(!1), i = () => e.value || null, u = (r) => {
392
- r && r.on("style.load", () => {
393
- const a = () => {
394
- r.isStyleLoaded() ? y.value = !0 : (y.value = !1, setTimeout(a, 200));
395
- };
396
- a();
397
- });
398
- }, d = () => {
399
- const r = i();
400
- if (r)
401
- try {
402
- if (r.getSource(t.sourceId) || r.addSource(t.sourceId, t.source), !r.getLayer(t.layerId)) {
403
- const a = {
404
- ...t.layer,
405
- id: t.layerId,
406
- source: t.sourceId
407
- };
408
- r.addLayer(a, t.before);
409
- }
410
- } catch (a) {
411
- console.error("Error adding Image layer:", a);
412
- }
413
- }, m = () => {
414
- const r = i();
415
- if (r)
416
- try {
417
- const a = r.getSource(t.sourceId);
418
- if (a)
419
- if (a.updateImage)
420
- a.updateImage({
421
- url: t.source.url,
422
- coordinates: t.source.coordinates
423
- });
424
- else {
425
- r.getLayer(t.layerId) && r.removeLayer(t.layerId), r.getSource(t.sourceId) && r.removeSource(t.sourceId), r.addSource(t.sourceId, t.source);
426
- const f = {
427
- ...t.layer,
428
- id: t.layerId,
429
- source: t.sourceId
430
- };
431
- r.addLayer(f, t.before);
432
- }
433
- } catch (a) {
434
- console.error("Error updating Image source:", a);
435
- }
436
- }, g = () => {
437
- const r = i();
438
- if (r)
439
- try {
440
- r.getLayer(t.layerId) && (Object.entries(t.layer.paint || {}).forEach(([a, f]) => {
441
- r.setPaintProperty(t.layerId, a, f);
442
- }), Object.entries(t.layer.layout || {}).forEach(([a, f]) => {
443
- r.setLayoutProperty(t.layerId, a, f);
444
- }));
445
- } catch (a) {
446
- console.error("Error updating Image layer:", a);
447
- }
448
- };
449
- return v(() => t.source, m, { deep: !0 }), v(() => t.layer, g, { deep: !0 }), v(
450
- e,
451
- (r) => {
452
- r && u(r);
453
- },
454
- { immediate: !0 }
455
- ), v(y, (r) => {
456
- r && d();
457
- }), S(() => {
458
- i()?.isStyleLoaded() && d();
459
- }), C(() => {
460
- const r = i();
461
- if (r)
462
- try {
463
- r.getLayer(t.layerId) && r.removeLayer(t.layerId), r.getSource(t.sourceId) && r.removeSource(t.sourceId);
464
- } catch (a) {
465
- console.error("Error cleaning up Image layer:", a);
466
- }
467
- }), (r, a) => _(r.$slots, "default");
468
- }
469
- }), oe = /* @__PURE__ */ h({
470
- __name: "VLayerMaplibreRaster",
471
- props: {
472
- sourceId: {},
473
- source: {},
474
- layerId: {},
475
- layer: {},
476
- before: {}
477
- },
478
- setup(p) {
479
- const t = p, e = P(E), y = b(!1), i = () => e.value || null, u = (r) => {
480
- r && r.on("style.load", () => {
481
- const a = () => {
482
- r.isStyleLoaded() ? y.value = !0 : (y.value = !1, setTimeout(a, 200));
483
- };
484
- a();
485
- });
486
- }, d = () => {
487
- const r = i();
488
- if (r)
489
- try {
490
- r.getSource(t.sourceId) || r.addSource(t.sourceId, t.source), r.getLayer(t.layerId) || (r.addLayer(t.layer, t.before), t.layer.layout?.visibility && r.setLayoutProperty(
491
- t.layerId,
492
- "visibility",
493
- t.layer.layout.visibility
494
- ));
495
- } catch (a) {
496
- console.error(`[${t.layerId}] Error setting up layer:`, a);
497
- }
498
- }, m = () => {
499
- const r = i();
500
- if (r)
501
- try {
502
- const a = t.before;
503
- r.getLayer(t.layerId) && r.removeLayer(t.layerId), r.removeSource(t.sourceId), r.addSource(t.sourceId, t.source);
504
- const f = {
505
- ...t.layer,
506
- id: t.layerId,
507
- type: "raster",
508
- source: t.sourceId
509
- };
510
- a && r.getLayer(a) ? r.addLayer(f, a) : r.addLayer(f);
511
- } catch (a) {
512
- console.error("Error updating Raster source:", a);
513
- }
514
- }, g = () => {
515
- const r = i();
516
- if (r)
517
- try {
518
- if (r.getLayer(t.layerId)) {
519
- const a = t.layer.paint || {};
520
- Object.entries(a).forEach(([n, o]) => {
521
- r.setPaintProperty(t.layerId, n, o);
522
- });
523
- const f = t.layer.layout || {};
524
- Object.entries(f).forEach(([n, o]) => {
525
- r.setLayoutProperty(t.layerId, n, o);
526
- });
527
- }
528
- } catch (a) {
529
- console.error("Error updating Raster layer:", a);
530
- }
531
- };
532
- return v(
533
- () => t.source.tiles?.[0],
534
- // Usually raster sources have a single tile URL
535
- (r, a) => {
536
- r !== a && m();
537
- }
538
- ), v(() => t.layer, g, { deep: !0 }), v(
539
- e,
540
- (r) => {
541
- r && u(r);
542
- },
543
- { immediate: !0 }
544
- ), v(y, (r) => {
545
- r && d();
546
- }), v(
547
- () => t.layer.layout?.visibility,
548
- (r) => {
549
- const a = i();
550
- if (!a) return;
551
- if (a.getLayer(t.layerId))
552
- try {
553
- a.setLayoutProperty(
554
- t.layerId,
555
- "visibility",
556
- r
557
- ), r === "visible" && t.before && a.moveLayer(t.layerId, t.before);
558
- } catch (n) {
559
- console.error(`[${t.layerId}] Error updating visibility:`, n);
560
- }
561
- else
562
- try {
563
- a.addLayer(t.layer, t.before);
564
- } catch (n) {
565
- console.error(`[${t.layerId}] Error adding layer:`, n);
566
- }
567
- },
568
- { immediate: !0 }
569
- ), v(
570
- () => t.before,
571
- (r) => {
572
- const a = i();
573
- if (!(!a || !a.getLayer(t.layerId)) && t.layer.layout?.visibility === "visible")
574
- try {
575
- console.log(`[${t.layerId}] Moving layer before:`, r), a.moveLayer(t.layerId, r);
576
- } catch (f) {
577
- console.error(`[${t.layerId}] Error moving layer:`, f);
578
- }
579
- }
580
- ), S(() => {
581
- if (i())
582
- try {
583
- d();
584
- } catch (a) {
585
- console.error(`[${t.layerId}] Error setting up layer:`, a);
586
- }
587
- }), (r, a) => _(r.$slots, "default");
588
- }
589
- }), A = [
590
- "click",
591
- "dblclick",
592
- "mousedown",
593
- "mouseup",
594
- "mousemove",
595
- "mouseenter",
596
- "mouseleave",
597
- "mouseover",
598
- "mouseout",
599
- "contextmenu",
600
- "touchstart",
601
- "touchend",
602
- "touchcancel"
603
- ], N = [
604
- "error",
605
- "load",
606
- "idle",
607
- "remove",
608
- "render",
609
- "resize",
610
- "webglcontextlost",
611
- "webglcontextrestored",
612
- "dataloading",
613
- "data",
614
- "tiledataloading",
615
- "sourcedataloading",
616
- "styledataloading",
617
- "sourcedata",
618
- "styledata",
619
- "boxzoomcancel",
620
- "boxzoomstart",
621
- "boxzoomend",
622
- "touchcancel",
623
- "touchmove",
624
- "touchend",
625
- "touchstart",
626
- "click",
627
- "contextmenu",
628
- "dblclick",
629
- "mousemove",
630
- "mouseup",
631
- "mousedown",
632
- "mouseout",
633
- "mouseover",
634
- "movestart",
635
- "move",
636
- "moveend",
637
- "zoomstart",
638
- "zoom",
639
- "zoomend",
640
- "rotatestart",
641
- "rotate",
642
- "rotateend",
643
- "dragstart",
644
- "drag",
645
- "dragend",
646
- "pitchstart",
647
- "pitch",
648
- "pitchend",
649
- "wheel"
650
- ], w = ["dragstart", "drag", "dragend"], q = ["click", "mouseenter", "mouseleave"], z = ["open", "close"], he = /* @__PURE__ */ h({
651
- __name: "VLayerMaplibreVector",
652
- props: {
653
- sourceId: {},
654
- source: {},
655
- layerId: {},
656
- layer: {},
657
- before: {}
658
- },
659
- emits: [...A],
660
- setup(p, { emit: t }) {
661
- const e = p, y = t, i = P(E), u = b(!1), d = () => i.value || null, m = (n) => {
662
- n && n.on("style.load", () => {
663
- const o = () => {
664
- n.isStyleLoaded() ? u.value = !0 : (u.value = !1, setTimeout(o, 200));
665
- };
666
- o();
667
- });
668
- }, g = () => {
669
- const n = d();
670
- if (n)
671
- try {
672
- n.getSource(e.sourceId) || n.addSource(e.sourceId, e.source), n.getLayer(e.layerId) || (e.layer.layout?.visibility === "visible" ? n.addLayer(e.layer, e.before) : n.addLayer(e.layer));
673
- } catch (o) {
674
- console.error(`[${e.layerId}] Error setting up layer:`, o);
675
- }
676
- }, r = () => {
677
- const n = d();
678
- if (n)
679
- try {
680
- const o = n.getSource(e.sourceId);
681
- if (o && JSON.stringify(o.serialize()) !== JSON.stringify(e.source)) {
682
- n.getLayer(e.layerId) && n.removeLayer(e.layerId), n.removeSource(e.sourceId), n.addSource(e.sourceId, e.source);
683
- const l = {
684
- ...e.layer,
685
- id: e.layerId,
686
- source: e.sourceId
687
- };
688
- n.addLayer(l, e.before);
689
- }
690
- } catch (o) {
691
- console.error("Error updating vector source:", o);
692
- }
693
- }, a = () => {
694
- const n = d();
695
- if (n)
696
- try {
697
- if (n.getLayer(e.layerId)) {
698
- const o = n.getLayer(e.layerId), l = o?.paint || {}, I = o?.layout || {};
699
- Object.entries(e.layer.paint || {}).forEach(([s, c]) => {
700
- JSON.stringify(l[s]) !== JSON.stringify(c) && n.setPaintProperty(e.layerId, s, c);
701
- }), Object.entries(e.layer.layout || {}).forEach(([s, c]) => {
702
- JSON.stringify(I[s]) !== JSON.stringify(c) && n.setLayoutProperty(e.layerId, s, c);
703
- });
704
- }
705
- } catch (o) {
706
- console.error("Error updating vector layer:", o);
707
- }
708
- }, f = (n) => {
709
- if (n)
710
- try {
711
- A.forEach((o) => {
712
- n.on(o, e.layerId, (l) => {
713
- o === "mousemove" && (n.getCanvas().style.cursor = "pointer"), o === "mouseleave" && (n.getCanvas().style.cursor = ""), y(o, l);
714
- });
715
- });
716
- } catch (o) {
717
- console.error("Error setting up layer events:", o);
718
- }
719
- };
720
- return v(
721
- i,
722
- (n, o) => {
723
- n && n !== o && m(n);
724
- },
725
- { immediate: !0 }
726
- ), v(u, (n) => {
727
- if (n) {
728
- const o = d();
729
- if (!o) return;
730
- g(), f(o);
731
- }
732
- }), v(
733
- () => JSON.stringify(e.source.tiles),
734
- (n, o) => {
735
- n !== o && r();
736
- }
737
- ), v(
738
- () => ({
739
- paint: e.layer.paint,
740
- // Watch layout changes but exclude visibility since it's handled separately
741
- layout: e.layer.layout ? { ...e.layer.layout, visibility: void 0 } : void 0
742
- }),
743
- (n, o) => {
744
- JSON.stringify(n) !== JSON.stringify(o) && a();
745
- },
746
- { deep: !0 }
747
- ), v(
748
- () => e.layer.layout?.visibility,
749
- (n) => {
750
- const o = d();
751
- if (!o) return;
752
- if (o.getLayer(e.layerId))
753
- try {
754
- o.setLayoutProperty(
755
- e.layerId,
756
- "visibility",
757
- n
758
- ), n === "visible" && e.before && setTimeout(() => {
759
- o.moveLayer(e.layerId, e.before);
760
- }, 0);
761
- } catch (I) {
762
- console.error(`[${e.layerId}] Error updating visibility:`, I);
763
- }
764
- else
765
- try {
766
- o.getSource(e.sourceId) || o.addSource(e.sourceId, e.source), o.addLayer(e.layer, e.before);
767
- } catch (I) {
768
- console.error(`[${e.layerId}] Error adding layer:`, I);
769
- }
770
- },
771
- { immediate: !0 }
772
- ), v(
773
- () => e.before,
774
- (n) => {
775
- const o = d();
776
- if (!(!o || !o.getLayer(e.layerId)) && e.layer.layout?.visibility === "visible")
777
- try {
778
- o.moveLayer(e.layerId, n);
779
- } catch (l) {
780
- console.error(
781
- `Error reordering vector layer ${e.layerId}:`,
782
- l
783
- );
784
- }
785
- }
786
- ), v(
787
- () => e.layer.layout?.visibility,
788
- (n) => {
789
- const o = d();
790
- if (!o) return;
791
- if (o.getLayer(e.layerId))
792
- try {
793
- o.setLayoutProperty(
794
- e.layerId,
795
- "visibility",
796
- n
797
- );
798
- } catch (I) {
799
- console.error(`[${e.layerId}] Error updating visibility:`, I);
800
- }
801
- else
802
- try {
803
- o.getSource(e.sourceId) || o.addSource(e.sourceId, e.source), o.addLayer(e.layer, e.before);
804
- } catch (I) {
805
- console.error(`[${e.layerId}] Error adding layer:`, I);
806
- }
807
- },
808
- { immediate: !0 }
809
- ), S(() => {
810
- if (d())
811
- try {
812
- g();
813
- } catch (o) {
814
- console.error(`[${e.layerId}] Error setting up layer:`, o);
815
- }
816
- }), (n, o) => _(n.$slots, "default");
817
- }
818
- }), Se = /* @__PURE__ */ h({
819
- __name: "VLayerMaplibreVideo",
820
- props: {
821
- sourceId: {
822
- type: String,
823
- default: "maplibre.gl-video-source",
824
- required: !0
825
- },
826
- layerId: {
827
- type: String,
828
- default: "maplibre.gl-video-layer",
829
- required: !0
830
- },
831
- source: {
832
- type: Object,
833
- required: !0
834
- },
835
- layer: {
836
- type: Object,
837
- default: () => ({}),
838
- required: !0
839
- },
840
- before: {
841
- type: String,
842
- default: "",
843
- required: !1
844
- }
845
- },
846
- setup(p) {
847
- const t = p, e = P(E), y = b(!1), i = () => e.value || null, u = (r) => {
848
- r && r.on("style.load", () => {
849
- const a = () => {
850
- r.isStyleLoaded() ? y.value = !0 : (y.value = !1, setTimeout(a, 200));
851
- };
852
- a();
853
- });
854
- }, d = () => {
855
- const r = i();
856
- if (r)
857
- try {
858
- if (r.getSource(t.sourceId) || r.addSource(t.sourceId, t.source), !r.getLayer(t.layerId)) {
859
- const a = {
860
- ...t.layer,
861
- id: t.layerId,
862
- source: t.sourceId
863
- };
864
- r.addLayer(a, t.before);
865
- }
866
- } catch (a) {
867
- console.error("Error adding Video layer:", a);
868
- }
869
- }, m = () => {
870
- const r = i();
871
- if (r)
872
- try {
873
- const a = r.getSource(t.sourceId);
874
- if (a) {
875
- r.getLayer(t.layerId) && r.removeLayer(t.layerId), r.getSource(t.sourceId) && r.removeSource(t.sourceId), r.addSource(t.sourceId, t.source);
876
- const f = {
877
- ...t.layer,
878
- id: t.layerId,
879
- source: t.sourceId
880
- };
881
- if (r.addLayer(f, t.before), a.getVideo) {
882
- const n = a.getVideo();
883
- n && n.play().catch((o) => {
884
- console.error("Error playing video:", o);
885
- });
886
- }
887
- }
888
- } catch (a) {
889
- console.error("Error updating Video source:", a);
890
- }
891
- }, g = () => {
892
- const r = i();
893
- if (r)
894
- try {
895
- r.getLayer(t.layerId) && (Object.entries(t.layer.paint || {}).forEach(([a, f]) => {
896
- r.setPaintProperty(t.layerId, a, f);
897
- }), Object.entries(t.layer.layout || {}).forEach(([a, f]) => {
898
- r.setLayoutProperty(t.layerId, a, f);
899
- }));
900
- } catch (a) {
901
- console.error("Error updating Video layer:", a);
902
- }
903
- };
904
- return v(() => t.source, m, { deep: !0 }), v(() => t.layer, g, { deep: !0 }), v(
905
- e,
906
- (r) => {
907
- r && u(r);
908
- },
909
- { immediate: !0 }
910
- ), v(y, (r) => {
911
- r && d();
912
- }), S(() => {
913
- i()?.isStyleLoaded() && d();
914
- }), C(() => {
915
- const r = i();
916
- if (r)
917
- try {
918
- const a = r.getSource(t.sourceId);
919
- if (a?.getVideo) {
920
- const f = a.getVideo();
921
- f && (f.pause(), f.remove());
922
- }
923
- r.getLayer(t.layerId) && r.removeLayer(t.layerId), r.getSource(t.sourceId) && r.removeSource(t.sourceId);
924
- } catch (a) {
925
- console.error("Error cleaning up Video layer:", a);
926
- }
927
- }), (r, a) => _(r.$slots, "default");
928
- }
929
- }), Ee = /* @__PURE__ */ h({
930
- __name: "VLayerMaplibrePmtile",
931
- props: {
932
- sourceId: {
933
- type: String,
934
- default: "maplibre.gl-pmtile-source",
935
- required: !0
936
- },
937
- layerId: {
938
- type: String,
939
- default: "maplibre.gl-pmtile-layer",
940
- required: !0
941
- },
942
- url: {
943
- type: String,
944
- required: !0
945
- },
946
- layer: {
947
- type: Object,
948
- default: () => ({}),
949
- required: !0
950
- },
951
- before: {
952
- type: String,
953
- default: "",
954
- required: !1
955
- }
956
- },
957
- setup(p) {
958
- const t = p, e = O(G);
959
- if (!e)
960
- throw new Error("Protocol not provided");
961
- const y = b({
962
- type: "raster",
963
- url: `pmtiles://${t.url}`,
964
- tileSize: 512,
965
- volatile: !0
966
- });
967
- return S(async () => {
968
- const i = new re(t.url);
969
- e.add(i);
970
- }), (i, u) => (M(), J(oe, {
971
- "source-id": p.sourceId,
972
- "layer-id": p.layerId,
973
- source: y.value,
974
- layer: {
975
- ...p.layer,
976
- type: "raster"
977
- },
978
- before: p.before
979
- }, null, 8, ["source-id", "layer-id", "source", "layer", "before"]));
980
- }
981
- }), _e = /* @__PURE__ */ h({
982
- __name: "VLayerMaplibreCluster",
983
- props: {
984
- sourceId: { default: "cluster-source" },
985
- baseLayerId: { default: "cluster" },
986
- source: {},
987
- visibility: { type: Boolean, default: !0 },
988
- clusterPaint: { default: () => ({
989
- colors: ["#51bbd6", "#f1f075", "#f28cb1"],
990
- radii: [20, 30, 40]
991
- }) },
992
- unclusteredPaint: { default: () => ({
993
- color: "#51bbd6",
994
- radius: 6
995
- }) },
996
- textPaint: { default: () => ({
997
- color: "#ffffff",
998
- font: ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
999
- size: 12
1000
- }) }
1001
- },
1002
- emits: ["cluster-click", "point-click"],
1003
- setup(p, { emit: t }) {
1004
- const e = p, y = t, i = P(E), u = b(!1), d = V(() => `${e.baseLayerId}-clusters`), m = V(
1005
- () => `${e.baseLayerId}-cluster-count`
1006
- ), g = V(
1007
- () => `${e.baseLayerId}-unclustered-point`
1008
- ), r = () => i.value || null, a = (s) => typeof s == "string" ? !1 : s && typeof s == "object" && "type" in s && s.type === "FeatureCollection" && "features" in s ? s.features.length > 0 : !1, f = () => {
1009
- const s = r();
1010
- if (!(!s || !s.isStyleLoaded()))
1011
- try {
1012
- if (!s.getSource(e.sourceId))
1013
- console.log(`Adding clustered source: ${e.sourceId}`), s.addSource(e.sourceId, {
1014
- ...e.source,
1015
- cluster: !0,
1016
- clusterMaxZoom: 14,
1017
- clusterRadius: 50
1018
- });
1019
- else {
1020
- const c = s.getSource(e.sourceId);
1021
- c && "setData" in c && c.setData(e.source.data);
1022
- }
1023
- s.getLayer(d.value) || (console.log(`Adding clusters layer: ${d.value}`), s.addLayer({
1024
- id: d.value,
1025
- type: "circle",
1026
- source: e.sourceId,
1027
- filter: ["has", "point_count"],
1028
- paint: {
1029
- "circle-color": [
1030
- "step",
1031
- ["get", "point_count"],
1032
- e.clusterPaint.colors[0],
1033
- 100,
1034
- e.clusterPaint.colors[1],
1035
- 750,
1036
- e.clusterPaint.colors[2]
1037
- ],
1038
- "circle-radius": [
1039
- "step",
1040
- ["get", "point_count"],
1041
- e.clusterPaint.radii[0],
1042
- 100,
1043
- e.clusterPaint.radii[1],
1044
- 750,
1045
- e.clusterPaint.radii[2]
1046
- ],
1047
- "circle-stroke-width": 2,
1048
- "circle-stroke-color": "#ffffff",
1049
- "circle-opacity": 0.9
1050
- },
1051
- layout: {
1052
- visibility: e.visibility ? "visible" : "none"
1053
- }
1054
- })), s.getLayer(m.value) || (console.log(`Adding cluster count layer: ${m.value}`), s.addLayer({
1055
- id: m.value,
1056
- type: "symbol",
1057
- source: e.sourceId,
1058
- filter: ["has", "point_count"],
1059
- layout: {
1060
- "text-field": "{point_count_abbreviated}",
1061
- "text-font": e.textPaint.font,
1062
- "text-size": e.textPaint.size,
1063
- visibility: e.visibility ? "visible" : "none"
1064
- },
1065
- paint: {
1066
- "text-color": e.textPaint.color
1067
- }
1068
- })), s.getLayer(g.value) || (console.log(
1069
- `Adding unclustered points layer: ${g.value}`
1070
- ), s.addLayer({
1071
- id: g.value,
1072
- type: "circle",
1073
- source: e.sourceId,
1074
- filter: ["!", ["has", "point_count"]],
1075
- paint: {
1076
- "circle-color": e.unclusteredPaint.color,
1077
- "circle-radius": e.unclusteredPaint.radius,
1078
- "circle-stroke-width": 2,
1079
- "circle-stroke-color": "#ffffff",
1080
- "circle-opacity": 0.95
1081
- },
1082
- layout: {
1083
- visibility: e.visibility ? "visible" : "none"
1084
- }
1085
- })), console.log(`All cluster layers added for ${e.baseLayerId}`), l(s);
1086
- } catch (c) {
1087
- console.error("Error adding cluster layers:", c);
1088
- }
1089
- }, n = () => {
1090
- const s = r();
1091
- if (s)
1092
- try {
1093
- const c = s.getSource(e.sourceId);
1094
- c && "setData" in c ? (console.log(`Updating source ${e.sourceId} with data`), c.setData(e.source.data), setTimeout(() => {
1095
- f();
1096
- }, 100)) : c || f();
1097
- } catch (c) {
1098
- console.error("Error updating source:", c);
1099
- }
1100
- }, o = (s) => {
1101
- const c = r();
1102
- if (!c) return;
1103
- const L = s ? "visible" : "none";
1104
- [
1105
- d.value,
1106
- m.value,
1107
- g.value
1108
- ].forEach(($) => {
1109
- c.getLayer($) && c.setLayoutProperty($, "visibility", L);
1110
- });
1111
- }, l = (s) => {
1112
- if (s)
1113
- try {
1114
- s.on(
1115
- "click",
1116
- d.value,
1117
- (c) => {
1118
- c.features && c.features.length > 0 && y("cluster-click", {
1119
- features: c.features,
1120
- coordinates: c.lngLat
1121
- });
1122
- }
1123
- ), s.on(
1124
- "click",
1125
- g.value,
1126
- (c) => {
1127
- c.features && c.features.length > 0 && y("point-click", {
1128
- features: c.features,
1129
- coordinates: c.lngLat
1130
- });
1131
- }
1132
- ), [d.value, g.value].forEach((c) => {
1133
- s.on("mouseenter", c, () => {
1134
- s.getCanvas().style.cursor = "pointer";
1135
- }), s.on("mouseleave", c, () => {
1136
- s.getCanvas().style.cursor = "";
1137
- });
1138
- });
1139
- } catch (c) {
1140
- console.error("Error setting up layer events:", c);
1141
- }
1142
- }, I = (s) => {
1143
- s && (s.on("style.load", () => {
1144
- const c = () => {
1145
- s.isStyleLoaded() ? (u.value = !0, a(e.source.data) && f()) : (u.value = !1, setTimeout(c, 200));
1146
- };
1147
- c();
1148
- }), s.isStyleLoaded() && (u.value = !0, a(e.source.data) && f()));
1149
- };
1150
- return v(
1151
- () => e.source.data,
1152
- (s) => {
1153
- if (a(s)) {
1154
- const c = r();
1155
- c?.isStyleLoaded() && (c.getSource(e.sourceId) ? n() : f());
1156
- }
1157
- },
1158
- { deep: !0, immediate: !0 }
1159
- ), v(() => e.visibility, o), v(
1160
- i,
1161
- (s) => {
1162
- s && I(s);
1163
- },
1164
- { immediate: !0 }
1165
- ), S(() => {
1166
- r()?.isStyleLoaded() && a(e.source.data) && f();
1167
- }), C(() => {
1168
- const s = r();
1169
- if (s)
1170
- try {
1171
- [d.value, g.value].forEach((c) => {
1172
- s.off("click", c, () => {
1173
- }), s.off("mouseenter", c, () => {
1174
- }), s.off("mouseleave", c, () => {
1175
- });
1176
- }), [
1177
- d.value,
1178
- m.value,
1179
- g.value
1180
- ].forEach((c) => {
1181
- s.getLayer(c) && s.removeLayer(c);
1182
- }), s.getSource(e.sourceId) && s.removeSource(e.sourceId);
1183
- } catch (c) {
1184
- console.error("Error cleaning up cluster layers:", c);
1185
- }
1186
- }), (s, c) => _(s.$slots, "default");
1187
- }
1188
- }), ae = ["id"], se = /* @__PURE__ */ h({
1189
- __name: "VMap",
1190
- props: {
1191
- options: { default: () => ({ container: "map" }) },
1192
- supportPmtiles: { type: Boolean, default: !1 }
1193
- },
1194
- emits: ["loaded", ...N],
1195
- setup(p, { emit: t }) {
1196
- const e = p, y = t;
1197
- if (e.supportPmtiles) {
1198
- const g = new te({ metadata: !0 });
1199
- U.addProtocol("pmtiles", g.tile), T(G, g);
1200
- }
1201
- const i = B(null), u = b(!1), d = b(N);
1202
- T(E, i), S(() => {
1203
- i.value = new X(e.options), u.value = !0, m();
1204
- });
1205
- const m = () => {
1206
- i.value && d.value.forEach((g) => {
1207
- i.value?.on(g, (r) => {
1208
- switch (g) {
1209
- case "load":
1210
- y("loaded", i.value);
1211
- break;
1212
- default:
1213
- y(g, r);
1214
- break;
1215
- }
1216
- });
1217
- });
1218
- };
1219
- return (g, r) => (M(), j("div", {
1220
- id: `${p.options?.container}`,
1221
- class: "v-map-container"
1222
- }, [
1223
- u.value ? _(g.$slots, "default", { key: 0 }, () => [
1224
- _(g.$slots, "default", {}, void 0, !0)
1225
- ], !0) : D("", !0)
1226
- ], 8, ae));
1227
- }
1228
- }), ce = (p, t) => {
1229
- const e = p.__vccOpts || p;
1230
- for (const [y, i] of t)
1231
- e[y] = i;
1232
- return e;
1233
- }, Pe = /* @__PURE__ */ ce(se, [["__scopeId", "data-v-e49c0b85"]]), ne = ["id"], ie = /* @__PURE__ */ h({
1234
- __name: "VPopup",
1235
- props: {
1236
- options: { default: () => ({}) },
1237
- coordinates: { default: () => ({}) },
1238
- marker: { default: () => ({}) }
1239
- },
1240
- emits: ["added", "removed", "open", "close"],
1241
- setup(p, { emit: t }) {
1242
- const e = p, y = t, i = P(E), u = new Y(e.options), d = b(!0), m = b(null), g = () => i.value || null, r = (s) => {
1243
- s && s.on("style.load", () => {
1244
- const c = () => {
1245
- s.isStyleLoaded() ? d.value = !0 : (d.value = !1, setTimeout(c, 200));
1246
- };
1247
- c();
1248
- });
1249
- }, a = () => {
1250
- try {
1251
- m.value && u.setDOMContent(m.value);
1252
- } catch (s) {
1253
- console.error("Error setting popup content:", s);
1254
- }
1255
- }, f = () => {
1256
- try {
1257
- u.setLngLat(e.coordinates);
1258
- } catch (s) {
1259
- console.error("Error setting popup coordinates:", s);
1260
- }
1261
- }, n = () => {
1262
- const s = g();
1263
- if (s)
1264
- try {
1265
- "setPopup" in e.marker ? e.marker.setPopup(u) : u.addTo(s), y("added", { popup: u });
1266
- } catch (c) {
1267
- console.error("Error adding popup to marker:", c);
1268
- }
1269
- }, o = () => {
1270
- try {
1271
- u.remove(), y("removed");
1272
- } catch (s) {
1273
- console.error("Error removing popup:", s);
1274
- }
1275
- }, l = () => {
1276
- try {
1277
- z.forEach((s) => {
1278
- u.on(s, () => {
1279
- y(s);
1280
- });
1281
- });
1282
- } catch (s) {
1283
- console.error("Error setting up popup events:", s);
1284
- }
1285
- }, I = () => {
1286
- try {
1287
- z.forEach((s) => {
1288
- u.off(s, () => {
1289
- y(s);
1290
- });
1291
- });
1292
- } catch (s) {
1293
- console.error("Error removing popup events:", s);
1294
- }
1295
- };
1296
- return v(
1297
- i,
1298
- (s) => {
1299
- s && r(s);
1300
- },
1301
- { immediate: !0 }
1302
- ), v(
1303
- () => e.coordinates,
1304
- () => {
1305
- f();
1306
- },
1307
- { deep: !0 }
1308
- ), S(() => {
1309
- if (d.value)
1310
- try {
1311
- a(), f(), n(), l();
1312
- } catch (s) {
1313
- console.error("Error initializing popup:", s);
1314
- }
1315
- else
1316
- o(), I();
1317
- }), C(() => {
1318
- o(), I();
1319
- }), (s, c) => (M(), j("section", {
1320
- id: `popup-${Date.now()}`,
1321
- ref_key: "content",
1322
- ref: m
1323
- }, [
1324
- _(s.$slots, "default")
1325
- ], 8, ne));
1326
- }
1327
- }), le = ["id"], $e = /* @__PURE__ */ h({
1328
- __name: "VMarker",
1329
- props: {
1330
- coordinates: { default: null },
1331
- options: { default: () => ({}) },
1332
- popupOptions: { default: () => ({}) },
1333
- cursor: { default: "pointer" }
1334
- },
1335
- emits: [
1336
- "added",
1337
- "update:coordinates",
1338
- "removed",
1339
- ...w,
1340
- ...q
1341
- ],
1342
- setup(p, { emit: t }) {
1343
- const e = p, y = t, i = P(E), u = b(null), d = b(!0), m = b(!1), g = b(null), r = () => i.value || null, a = (c) => {
1344
- c && c.on("style.load", () => {
1345
- const L = () => {
1346
- c.isStyleLoaded() ? d.value = !0 : (d.value = !1, setTimeout(L, 200));
1347
- };
1348
- L();
1349
- });
1350
- }, f = (c) => {
1351
- g.value = c;
1352
- }, n = (c) => {
1353
- if (e.coordinates !== null)
1354
- try {
1355
- c.setLngLat(e.coordinates);
1356
- } catch (L) {
1357
- console.error("Error setting marker coordinates:", L);
1358
- }
1359
- }, o = (c) => {
1360
- try {
1361
- c.getElement().style.cursor = e.cursor || "default";
1362
- } catch (L) {
1363
- console.error("Error setting cursor:", L);
1364
- }
1365
- }, l = (c) => {
1366
- const L = r();
1367
- if (L)
1368
- try {
1369
- c.addTo(L), y("added", { marker: c });
1370
- } catch ($) {
1371
- console.error("Error adding marker to map:", $);
1372
- }
1373
- }, I = (c) => {
1374
- try {
1375
- c.remove(), y("removed");
1376
- } catch (L) {
1377
- console.error("Error removing marker from map:", L);
1378
- }
1379
- }, s = (c) => {
1380
- try {
1381
- let L;
1382
- w.forEach(($) => {
1383
- c.on($, (k) => {
1384
- $ === "dragend" && (Array.isArray(e.coordinates) ? L = [
1385
- k.target.getLngLat().lng,
1386
- k.target.getLngLat().lat
1387
- ] : L = k.target.getLngLat(), y("update:coordinates", L)), y($, k);
1388
- });
1389
- }), q.forEach(($) => {
1390
- c.getElement().addEventListener($, (k) => {
1391
- y($, k);
1392
- });
1393
- });
1394
- } catch (L) {
1395
- console.error("Error setting up marker events:", L);
1396
- }
1397
- };
1398
- return v(u, (c) => {
1399
- m.value = c !== null && "_map" in c;
1400
- }), v(
1401
- i,
1402
- (c) => {
1403
- c && a(c);
1404
- },
1405
- { immediate: !0 }
1406
- ), S(() => {
1407
- if (d.value)
1408
- try {
1409
- const c = {
1410
- ...e.options,
1411
- element: g.value || void 0
1412
- };
1413
- u.value = new ee(c), n(u.value), l(u.value), o(u.value), s(u.value);
1414
- } catch (c) {
1415
- console.error("Error initializing marker:", c);
1416
- }
1417
- }), C(() => {
1418
- u.value && I(u.value);
1419
- }), (c, L) => (M(), j("section", {
1420
- id: `marker-${Date.now()}`,
1421
- class: "absolute"
1422
- }, [
1423
- _(c.$slots, "markers", { setRef: f }),
1424
- m.value ? (M(), J(ie, {
1425
- key: 0,
1426
- marker: u.value,
1427
- options: p.popupOptions,
1428
- coordinates: p.coordinates
1429
- }, {
1430
- default: F(() => [
1431
- _(c.$slots, "default")
1432
- ]),
1433
- _: 3
1434
- }, 8, ["marker", "options", "coordinates"])) : D("", !0)
1435
- ], 8, le));
1436
- }
1437
- });
1
+ import { aR as r, aQ as l, ac as s, ad as V, ae as y, af as c, ag as L, aN as g, ai as k, ar as o, aq as D, ax as i, aI as t, aj as n, aG as p, aw as C, as as M, aB as u, aA as b, au as d, av as G, ao as m, al as S, aC as P, ak as h, at as H, am as T, aJ as v, aH as x, ah as f, aM as j, ay as A, aL as I, an as K, aF as O, ap as B, aD as F, aE as N, az as Q, aK as R, a4 as q, a6 as w, a5 as z, a7 as E, ab as J, a8 as W, a9 as U, aa as X, a1 as Y, a2 as Z, a3 as _, a1 as $, aP as aa, aO as ea } from "./index-BdU-GZRP.js";
1438
2
  export {
1439
- pe as VControlAttribution,
1440
- fe as VControlFullscreen,
1441
- me as VControlGeolocate,
1442
- ge as VControlNavigation,
1443
- ve as VControlScale,
1444
- Ie as VLayerMaplibreCanvas,
1445
- _e as VLayerMaplibreCluster,
1446
- Le as VLayerMaplibreGeojson,
1447
- be as VLayerMaplibreImage,
1448
- Ee as VLayerMaplibrePmtile,
1449
- oe as VLayerMaplibreRaster,
1450
- he as VLayerMaplibreVector,
1451
- Se as VLayerMaplibreVideo,
1452
- Pe as VMap,
1453
- $e as VMarker,
1454
- ie as VPopup,
1455
- Pe as default
3
+ r as DeckLayersKey,
4
+ l as DeckOverlayKey,
5
+ s as VControlAttribution,
6
+ V as VControlFullscreen,
7
+ y as VControlGeolocate,
8
+ c as VControlNavigation,
9
+ L as VControlScale,
10
+ g as VLayerDeckgl,
11
+ k as VLayerDeckglArc,
12
+ o as VLayerDeckglBitmap,
13
+ D as VLayerDeckglColumn,
14
+ i as VLayerDeckglContour,
15
+ t as VLayerDeckglGeohash,
16
+ n as VLayerDeckglGeojson,
17
+ p as VLayerDeckglGreatCircle,
18
+ C as VLayerDeckglGrid,
19
+ M as VLayerDeckglGridCell,
20
+ u as VLayerDeckglH3Cluster,
21
+ b as VLayerDeckglH3Hexagon,
22
+ d as VLayerDeckglHeatmap,
23
+ G as VLayerDeckglHexagon,
24
+ m as VLayerDeckglIcon,
25
+ S as VLayerDeckglLine,
26
+ P as VLayerDeckglMVT,
27
+ h as VLayerDeckglPath,
28
+ H as VLayerDeckglPointCloud,
29
+ T as VLayerDeckglPolygon,
30
+ v as VLayerDeckglQuadkey,
31
+ x as VLayerDeckglS2,
32
+ f as VLayerDeckglScatterplot,
33
+ j as VLayerDeckglScenegraph,
34
+ A as VLayerDeckglScreenGrid,
35
+ I as VLayerDeckglSimpleMesh,
36
+ K as VLayerDeckglSolidPolygon,
37
+ O as VLayerDeckglTerrain,
38
+ B as VLayerDeckglText,
39
+ F as VLayerDeckglTile,
40
+ N as VLayerDeckglTile3D,
41
+ Q as VLayerDeckglTrips,
42
+ R as VLayerDeckglWMS,
43
+ q as VLayerMaplibreCanvas,
44
+ w as VLayerMaplibreCluster,
45
+ z as VLayerMaplibreGeojson,
46
+ E as VLayerMaplibreImage,
47
+ J as VLayerMaplibrePmtile,
48
+ W as VLayerMaplibreRaster,
49
+ U as VLayerMaplibreVector,
50
+ X as VLayerMaplibreVideo,
51
+ Y as VMap,
52
+ Z as VMarker,
53
+ _ as VPopup,
54
+ $ as default,
55
+ aa as useDeckLayers,
56
+ ea as useDeckOverlay
1456
57
  };
1457
58
  //# sourceMappingURL=index.js.map