@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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as h, ref as w, toRefs as u, shallowRef as f, provide as m, h as L, inject as v, onMounted as M, onUnmounted as k, watch as g, nextTick as G, computed as S } from "vue";
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, g(e, () => {
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, g(e, (t, s) => {
31
- const r = [...s || []], o = [...t || []], i = o.map((n) => n.id), c = r.map((n) => n.id), p = o.filter((n) => !c.includes(n.id)), y = r.filter((n) => !i.includes(n.id));
32
- for (const n of y)
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(n.id);
34
+ this.map.removeSource(i.id);
35
35
  });
36
- for (const n of p) {
37
- const d = { ...n };
38
- delete d.id, this.map.addSource(n.id, d);
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, g(e, (t, s) => {
50
- const r = [...s || []], o = [...t || []], i = o.map((n) => n.id), c = r.map((n) => n.id), p = o.filter((n) => !c.includes(n.id)), y = r.filter((n) => !i.includes(n.id));
51
- for (const n of y)
52
- this.map.removeLayer(n.id);
53
- for (const n of p)
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(n);
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 h(
73
+ return u(
74
74
  (e, { emit: a, slots: t }) => {
75
- const s = w(null), { options: r, layers: o, sources: i } = u(e), c = f(null);
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(i, r.value.watchSourcesOptions || { immediate: !0 }), p.watchLayers(o, r.value.watchLayersOptions || { immediate: !0 }), a("loaded", p);
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 h(
99
+ return u(
100
100
  (e, { emit: a, slots: t }) => {
101
- const { options: s, layers: r } = u(e), o = v("mapboxMap");
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((i) => {
105
- i.watchLayers(r, s.value.watchLayersOptions || { immediate: !0 }), a("loaded", i);
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("./mapbox-sdk/datasets.js").then((e) => e.datasets),
130
- directions: () => import("./mapbox-sdk/directions.js").then((e) => e.directions),
131
- geocoding: () => import("./mapbox-sdk/geocoding.js").then((e) => e.geocoding),
132
- geocodingV6: () => import("./mapbox-sdk/geocoding-v6.js").then((e) => e.geocodingV6),
133
- mapMatching: () => import("./mapbox-sdk/map-matching.js").then((e) => e.mapMatching),
134
- matrix: () => import("./mapbox-sdk/matrix.js").then((e) => e.matrix),
135
- optimization: () => import("./mapbox-sdk/optimization.js").then((e) => e.optimization),
136
- static: () => import("./mapbox-sdk/static.js").then((e) => e._static),
137
- styles: () => import("./mapbox-sdk/styles.js").then((e) => e.styles),
138
- tilequery: () => import("./mapbox-sdk/tilequery.js").then((e) => e.tilequery),
139
- tilesets: () => import("./mapbox-sdk/tilesets.js").then((e) => e.tilesets),
140
- tokens: () => import("./mapbox-sdk/tokens.js").then((e) => e.tokens),
141
- uploads: () => import("./mapbox-sdk/uploads.js").then((e) => e.uploads),
142
- isochrone: () => import("./mapbox-sdk/isochrone.js").then((e) => e.isochrone)
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("./mapbox-sdk.js").then((s) => s.index)).default({ accessToken: this.apiKey }), t = await Promise.all(this.services.map((s) => this.servicesLoader[s]().then((r) => r.default(a))));
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, g(e, () => {
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 h(
210
+ return u(
211
211
  (e, { emit: a, slots: t }) => {
212
- const s = w(null), { options: r } = u(e), o = f(null);
213
- return m("googleMapsMap", o), this.createMap(s, r.value).then((i) => {
214
- o.value = i, a("loaded", i);
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 h(
228
+ return u(
229
229
  (e, { emit: a, slots: t }) => {
230
- const { options: s, layers: r } = u(e), o = v("googleMapsMap");
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((i) => {
234
- i.watchLayers(r, s.value.watchLayersOptions || { immediate: !0 }), a("loaded", i);
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 h(
253
+ return u(
254
254
  (e, { emit: a, slots: t }) => {
255
- const { options: s } = u(e), r = v("deckGLPrependLayers");
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 i = v("deckGLAppendVNodeFn");
266
- if (!i)
265
+ const n = g("deckGLAppendVNodeFn");
266
+ if (!n)
267
267
  throw new Error("deckGLAppendVNodeFn should exist");
268
- return t.appendMap && i.value.push(() => t.appendMap({ credits: o.value })), () => {
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: i } = o.content.gltf.asset;
333
- i.split(";").forEach(r.add, r), e.value = [...r].join("; ");
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, g(e, () => {
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 h(
363
+ return u(
364
364
  (e, { emit: a, attrs: t, slots: s }) => {
365
- const r = w(null), { options: o, layers: i } = u(e), c = f(null);
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
- ...i.value
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 n = w([]);
377
- return m("deckGLAppendVNodeFn", n), () => [L("div", { ...t, ref: r }, c.value ? s : []), n.value.map((d) => d())];
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 i = E(t, o);
428
- r.push(i.geometry.coordinates);
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.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.15"
44
+ "vue": "^3.4.18"
47
45
  }
48
46
  }
@@ -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
- };