@yappkit/front-module-map 0.1.1 → 0.1.3
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/lib/mapbox-gl.js +1030 -1027
- package/lib/providers/mapbox.js +57 -57
- package/lib/providers/maplibre.js +59 -59
- package/lib/yappkit-map.js +61 -61
- package/package.json +3 -5
- package/lib/_commonjsHelpers.js +0 -8
- package/lib/mapbox-sdk/browser-client.js +0 -500
- package/lib/mapbox-sdk/create-service-factory.js +0 -237
- package/lib/mapbox-sdk/datasets.js +0 -123
- package/lib/mapbox-sdk/directions.js +0 -155
- package/lib/mapbox-sdk/geocoding-v6.js +0 -129
- package/lib/mapbox-sdk/geocoding.js +0 -113
- package/lib/mapbox-sdk/isochrone.js +0 -82
- package/lib/mapbox-sdk/map-matching.js +0 -110
- package/lib/mapbox-sdk/matrix.js +0 -72
- package/lib/mapbox-sdk/object-clean.js +0 -11
- package/lib/mapbox-sdk/optimization.js +0 -106
- package/lib/mapbox-sdk/static.js +0 -197
- package/lib/mapbox-sdk/stringify-booleans.js +0 -15
- package/lib/mapbox-sdk/styles.js +0 -181
- package/lib/mapbox-sdk/tilequery.js +0 -46
- package/lib/mapbox-sdk/tilesets.js +0 -214
- package/lib/mapbox-sdk/tokens.js +0 -111
- package/lib/mapbox-sdk/uploads.js +0 -77
- package/lib/mapbox-sdk.js +0 -29
package/lib/yappkit-map.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as u, ref as w, toRefs as h, shallowRef as f, provide as m, h as L, inject as g, onMounted as M, onUnmounted as k, watch as v, nextTick as G, computed as S } from "vue";
|
|
2
2
|
import { lineString as K, length as P, along as E, point as D } from "@turf/turf";
|
|
3
3
|
class j {
|
|
4
4
|
constructor() {
|
|
@@ -11,7 +11,7 @@ class j {
|
|
|
11
11
|
console.warn("No need to call MapboxDeckGLOverlay.watchLayers(). layers are already being watched");
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
this.watching.layers = !0,
|
|
14
|
+
this.watching.layers = !0, v(e, () => {
|
|
15
15
|
this.overlay.setProps({ layers: e.value });
|
|
16
16
|
}, a);
|
|
17
17
|
}
|
|
@@ -27,15 +27,15 @@ class T {
|
|
|
27
27
|
console.warn("No need to call MapboxMap.watchSources(). sources are already being watched");
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
this.watching.sources = !0,
|
|
31
|
-
const r = [...s || []], o = [...t || []],
|
|
32
|
-
for (const
|
|
30
|
+
this.watching.sources = !0, v(e, (t, s) => {
|
|
31
|
+
const r = [...s || []], o = [...t || []], n = o.map((i) => i.id), c = r.map((i) => i.id), p = o.filter((i) => !c.includes(i.id)), y = r.filter((i) => !n.includes(i.id));
|
|
32
|
+
for (const i of y)
|
|
33
33
|
G(() => {
|
|
34
|
-
this.map.removeSource(
|
|
34
|
+
this.map.removeSource(i.id);
|
|
35
35
|
});
|
|
36
|
-
for (const
|
|
37
|
-
const d = { ...
|
|
38
|
-
delete d.id, this.map.addSource(
|
|
36
|
+
for (const i of p) {
|
|
37
|
+
const d = { ...i };
|
|
38
|
+
delete d.id, this.map.addSource(i.id, d);
|
|
39
39
|
}
|
|
40
40
|
}, a);
|
|
41
41
|
}
|
|
@@ -46,13 +46,13 @@ class T {
|
|
|
46
46
|
console.warn("No need to call MapboxMap.watchLayers(). layers are already being watched");
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
this.watching.layers = !0,
|
|
50
|
-
const r = [...s || []], o = [...t || []],
|
|
51
|
-
for (const
|
|
52
|
-
this.map.removeLayer(
|
|
53
|
-
for (const
|
|
49
|
+
this.watching.layers = !0, v(e, (t, s) => {
|
|
50
|
+
const r = [...s || []], o = [...t || []], n = o.map((i) => i.id), c = r.map((i) => i.id), p = o.filter((i) => !c.includes(i.id)), y = r.filter((i) => !n.includes(i.id));
|
|
51
|
+
for (const i of y)
|
|
52
|
+
this.map.removeLayer(i.id);
|
|
53
|
+
for (const i of p)
|
|
54
54
|
G(() => {
|
|
55
|
-
this.map.addLayer(
|
|
55
|
+
this.map.addLayer(i);
|
|
56
56
|
});
|
|
57
57
|
}, a);
|
|
58
58
|
}
|
|
@@ -70,11 +70,11 @@ class A {
|
|
|
70
70
|
this.services = e.services || [], this.sdk = {}, this.mapboxgl = null, this.services.length && this.loadMapboxSDK();
|
|
71
71
|
}
|
|
72
72
|
get Map() {
|
|
73
|
-
return
|
|
73
|
+
return u(
|
|
74
74
|
(e, { emit: a, slots: t }) => {
|
|
75
|
-
const s = w(null), { options: r, layers: o, sources:
|
|
75
|
+
const s = w(null), { options: r, layers: o, sources: n } = h(e), c = f(null);
|
|
76
76
|
return m("mapboxMap", c), this.createMap(s, r.value).then((p) => {
|
|
77
|
-
c.value = p, p.watchSources(
|
|
77
|
+
c.value = p, p.watchSources(n, r.value.watchSourcesOptions || { immediate: !0 }), p.watchLayers(o, r.value.watchLayersOptions || { immediate: !0 }), a("loaded", p);
|
|
78
78
|
}), () => L("div", { ref: s }, c.value ? t : []);
|
|
79
79
|
},
|
|
80
80
|
{
|
|
@@ -96,13 +96,13 @@ class A {
|
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
get DeckGLOverlay() {
|
|
99
|
-
return
|
|
99
|
+
return u(
|
|
100
100
|
(e, { emit: a, slots: t }) => {
|
|
101
|
-
const { options: s, layers: r } =
|
|
101
|
+
const { options: s, layers: r } = h(e), o = g("mapboxMap");
|
|
102
102
|
if (!o || !o.value)
|
|
103
103
|
throw new Error("map should exist");
|
|
104
|
-
return o.value.setDeckGLOverlay(s.value).then((
|
|
105
|
-
|
|
104
|
+
return o.value.setDeckGLOverlay(s.value).then((n) => {
|
|
105
|
+
n.watchLayers(r, s.value.watchLayersOptions || { immediate: !0 }), a("loaded", n);
|
|
106
106
|
}), () => {
|
|
107
107
|
};
|
|
108
108
|
},
|
|
@@ -126,24 +126,24 @@ class A {
|
|
|
126
126
|
}
|
|
127
127
|
get servicesLoader() {
|
|
128
128
|
return {
|
|
129
|
-
datasets: () => import("
|
|
130
|
-
directions: () => import("
|
|
131
|
-
geocoding: () => import("
|
|
132
|
-
geocodingV6: () => import("
|
|
133
|
-
mapMatching: () => import("
|
|
134
|
-
matrix: () => import("
|
|
135
|
-
optimization: () => import("
|
|
136
|
-
static: () => import("
|
|
137
|
-
styles: () => import("
|
|
138
|
-
tilequery: () => import("
|
|
139
|
-
tilesets: () => import("
|
|
140
|
-
tokens: () => import("
|
|
141
|
-
uploads: () => import("
|
|
142
|
-
isochrone: () => import("
|
|
129
|
+
datasets: () => import("@mapbox/mapbox-sdk/services/datasets.js"),
|
|
130
|
+
directions: () => import("@mapbox/mapbox-sdk/services/directions.js"),
|
|
131
|
+
geocoding: () => import("@mapbox/mapbox-sdk/services/geocoding.js"),
|
|
132
|
+
geocodingV6: () => import("@mapbox/mapbox-sdk/services/geocoding-v6.js"),
|
|
133
|
+
mapMatching: () => import("@mapbox/mapbox-sdk/services/map-matching.js"),
|
|
134
|
+
matrix: () => import("@mapbox/mapbox-sdk/services/matrix.js"),
|
|
135
|
+
optimization: () => import("@mapbox/mapbox-sdk/services/optimization.js"),
|
|
136
|
+
static: () => import("@mapbox/mapbox-sdk/services/static.js"),
|
|
137
|
+
styles: () => import("@mapbox/mapbox-sdk/services/styles.js"),
|
|
138
|
+
tilequery: () => import("@mapbox/mapbox-sdk/services/tilequery.js"),
|
|
139
|
+
tilesets: () => import("@mapbox/mapbox-sdk/services/tilesets.js"),
|
|
140
|
+
tokens: () => import("@mapbox/mapbox-sdk/services/tokens.js"),
|
|
141
|
+
uploads: () => import("@mapbox/mapbox-sdk/services/uploads.js"),
|
|
142
|
+
isochrone: () => import("@mapbox/mapbox-sdk/services/isochrone.js")
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
async loadMapboxSDK() {
|
|
146
|
-
const a = (await import("
|
|
146
|
+
const a = (await import("@mapbox/mapbox-sdk")).default({ accessToken: this.apiKey }), t = await Promise.all(this.services.map((s) => this.servicesLoader[s]().then((r) => r.default(a))));
|
|
147
147
|
for (const [s, r] of this.services.entries())
|
|
148
148
|
this.sdk[r] = t[s];
|
|
149
149
|
}
|
|
@@ -184,7 +184,7 @@ class N {
|
|
|
184
184
|
console.warn("No need to call GoogleMapsDeckGLOverlay.watchLayers(). layers are already being watched");
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
this.watching.layers = !0,
|
|
187
|
+
this.watching.layers = !0, v(e, () => {
|
|
188
188
|
this.overlay.setProps({ layers: e.value });
|
|
189
189
|
}, a);
|
|
190
190
|
}
|
|
@@ -207,11 +207,11 @@ class x {
|
|
|
207
207
|
this.libraries = e.libraries || ["maps"], this.version = e.version || "weekly", this.loader = null, this.sdk = {}, this.deckgl = null;
|
|
208
208
|
}
|
|
209
209
|
get Map() {
|
|
210
|
-
return
|
|
210
|
+
return u(
|
|
211
211
|
(e, { emit: a, slots: t }) => {
|
|
212
|
-
const s = w(null), { options: r } =
|
|
213
|
-
return m("googleMapsMap", o), this.createMap(s, r.value).then((
|
|
214
|
-
o.value =
|
|
212
|
+
const s = w(null), { options: r } = h(e), o = f(null);
|
|
213
|
+
return m("googleMapsMap", o), this.createMap(s, r.value).then((n) => {
|
|
214
|
+
o.value = n, a("loaded", n);
|
|
215
215
|
}), () => L("div", { ref: s }, o.value ? t : []);
|
|
216
216
|
},
|
|
217
217
|
{
|
|
@@ -225,13 +225,13 @@ class x {
|
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
get DeckGLOverlay() {
|
|
228
|
-
return
|
|
228
|
+
return u(
|
|
229
229
|
(e, { emit: a, slots: t }) => {
|
|
230
|
-
const { options: s, layers: r } =
|
|
230
|
+
const { options: s, layers: r } = h(e), o = g("googleMapsMap");
|
|
231
231
|
if (!o || !o.value)
|
|
232
232
|
throw new Error("map should exist");
|
|
233
|
-
return o.value.setDeckGLOverlay(s.value).then((
|
|
234
|
-
|
|
233
|
+
return o.value.setDeckGLOverlay(s.value).then((n) => {
|
|
234
|
+
n.watchLayers(r, s.value.watchLayersOptions || { immediate: !0 }), a("loaded", n);
|
|
235
235
|
}), () => {
|
|
236
236
|
};
|
|
237
237
|
},
|
|
@@ -250,9 +250,9 @@ class x {
|
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
252
|
get DeckGL3DTileLayer() {
|
|
253
|
-
return
|
|
253
|
+
return u(
|
|
254
254
|
(e, { emit: a, slots: t }) => {
|
|
255
|
-
const { options: s } =
|
|
255
|
+
const { options: s } = h(e), r = g("deckGLPrependLayers");
|
|
256
256
|
if (!r || !r.value)
|
|
257
257
|
throw new Error("deckGLPrependLayers should exist");
|
|
258
258
|
const o = w("");
|
|
@@ -262,10 +262,10 @@ class x {
|
|
|
262
262
|
c
|
|
263
263
|
];
|
|
264
264
|
});
|
|
265
|
-
const
|
|
266
|
-
if (!
|
|
265
|
+
const n = g("deckGLAppendVNodeFn");
|
|
266
|
+
if (!n)
|
|
267
267
|
throw new Error("deckGLAppendVNodeFn should exist");
|
|
268
|
-
return t.appendMap &&
|
|
268
|
+
return t.appendMap && n.value.push(() => t.appendMap({ credits: o.value })), () => {
|
|
269
269
|
};
|
|
270
270
|
},
|
|
271
271
|
{
|
|
@@ -329,8 +329,8 @@ class x {
|
|
|
329
329
|
e && (t.options.onTraversalComplete = (s) => {
|
|
330
330
|
const r = /* @__PURE__ */ new Set();
|
|
331
331
|
return s.forEach((o) => {
|
|
332
|
-
const { copyright:
|
|
333
|
-
|
|
332
|
+
const { copyright: n } = o.content.gltf.asset;
|
|
333
|
+
n.split(";").forEach(r.add, r), e.value = [...r].join("; ");
|
|
334
334
|
}), s;
|
|
335
335
|
});
|
|
336
336
|
},
|
|
@@ -350,7 +350,7 @@ class V {
|
|
|
350
350
|
console.warn("No need to call DeckGLMap.watchLayers(). layers are already being watched");
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
this.watching.layers = !0,
|
|
353
|
+
this.watching.layers = !0, v(e, () => {
|
|
354
354
|
this.map.setProps({ layers: e.value });
|
|
355
355
|
}, a);
|
|
356
356
|
}
|
|
@@ -360,21 +360,21 @@ class O {
|
|
|
360
360
|
this.deckgl = null;
|
|
361
361
|
}
|
|
362
362
|
get Map() {
|
|
363
|
-
return
|
|
363
|
+
return u(
|
|
364
364
|
(e, { emit: a, attrs: t, slots: s }) => {
|
|
365
|
-
const r = w(null), { options: o, layers:
|
|
365
|
+
const r = w(null), { options: o, layers: n } = h(e), c = f(null);
|
|
366
366
|
m("deckGLMap", c);
|
|
367
367
|
const p = f([]);
|
|
368
368
|
m("deckGLPrependLayers", p);
|
|
369
369
|
const y = S(() => [
|
|
370
370
|
...p.value,
|
|
371
|
-
...
|
|
371
|
+
...n.value
|
|
372
372
|
]);
|
|
373
373
|
this.createMap(r, o.value).then((d) => {
|
|
374
374
|
c.value = d, d.watchLayers(y, o.value.watchLayersOptions || { immediate: !0 }), a("loaded", d);
|
|
375
375
|
});
|
|
376
|
-
const
|
|
377
|
-
return m("deckGLAppendVNodeFn",
|
|
376
|
+
const i = w([]);
|
|
377
|
+
return m("deckGLAppendVNodeFn", i), () => [L("div", { ...t, ref: r }, c.value ? s : []), i.value.map((d) => d())];
|
|
378
378
|
},
|
|
379
379
|
{
|
|
380
380
|
props: {
|
|
@@ -424,8 +424,8 @@ function b(l) {
|
|
|
424
424
|
function F({ origin: l, destination: e, step: a = 100 }) {
|
|
425
425
|
const t = K([l, e]), s = P(t), r = [];
|
|
426
426
|
for (let o = 0; o < s; o += s / a) {
|
|
427
|
-
const
|
|
428
|
-
r.push(
|
|
427
|
+
const n = E(t, o);
|
|
428
|
+
r.push(n.geometry.coordinates);
|
|
429
429
|
}
|
|
430
430
|
return r.push(e), t.geometry.coordinates = b(r), t;
|
|
431
431
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yappkit/front-module-map",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "@yappkit/front module for map",
|
|
5
5
|
"module": "./lib/yappkit-map.js",
|
|
6
6
|
"main": "./lib/yappkit-map.js",
|
|
@@ -15,9 +15,6 @@
|
|
|
15
15
|
"./mapboxgl.css": {
|
|
16
16
|
"import": "./lib/mapbox-gl.css"
|
|
17
17
|
},
|
|
18
|
-
"./mapboxsdk": {
|
|
19
|
-
"import": "./lib/mapbox-sdk.js"
|
|
20
|
-
},
|
|
21
18
|
"./searoute": {
|
|
22
19
|
"import": "./lib/searoute.js"
|
|
23
20
|
},
|
|
@@ -39,10 +36,11 @@
|
|
|
39
36
|
"@deck.gl/google-maps": "^8.9.34",
|
|
40
37
|
"@deck.gl/mapbox": "^8.9.34",
|
|
41
38
|
"@googlemaps/js-api-loader": "^1.16.2",
|
|
39
|
+
"@mapbox/mapbox-sdk": "^0.15.3",
|
|
42
40
|
"@turf/turf": "^6.5.0",
|
|
43
41
|
"deck.gl": "^8.9.34",
|
|
44
42
|
"geojson-path-finder": "2.0.2",
|
|
45
43
|
"maplibre-gl": "^4.0.0",
|
|
46
|
-
"vue": "^3.4.
|
|
44
|
+
"vue": "^3.4.18"
|
|
47
45
|
}
|
|
48
46
|
}
|
package/lib/_commonjsHelpers.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
-
function l(e) {
|
|
3
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
o as commonjsGlobal,
|
|
7
|
-
l as getDefaultExportFromCjs
|
|
8
|
-
};
|