@mapvx/web-js 3.5.0-dev.2 → 3.5.0-dev.4

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 (43) hide show
  1. package/dist/cjs/controllers/routeController.js +396 -106
  2. package/dist/cjs/controllers/routeController.js.map +1 -1
  3. package/dist/cjs/domain/models/routeInstance.js +1 -0
  4. package/dist/cjs/domain/models/routeInstance.js.map +1 -1
  5. package/dist/cjs/logger/sentry.js +1 -1
  6. package/dist/cjs/map/map.js +250 -24
  7. package/dist/cjs/map/map.js.map +1 -1
  8. package/dist/cjs/map/mapInteractionOptions.js +18 -0
  9. package/dist/cjs/map/mapInteractionOptions.js.map +1 -1
  10. package/dist/cjs/utils/loadGlb.js +55 -20
  11. package/dist/cjs/utils/loadGlb.js.map +1 -1
  12. package/dist/cjs/utils/three.js +70 -34
  13. package/dist/cjs/utils/three.js.map +1 -1
  14. package/dist/es/controllers/routeController.d.ts +91 -13
  15. package/dist/es/controllers/routeController.d.ts.map +1 -1
  16. package/dist/es/controllers/routeController.js +396 -106
  17. package/dist/es/controllers/routeController.js.map +1 -1
  18. package/dist/es/domain/models/mapConfig.d.ts +76 -0
  19. package/dist/es/domain/models/mapConfig.d.ts.map +1 -1
  20. package/dist/es/domain/models/routeInstance.d.ts +70 -1
  21. package/dist/es/domain/models/routeInstance.d.ts.map +1 -1
  22. package/dist/es/domain/models/routeInstance.js +1 -0
  23. package/dist/es/domain/models/routeInstance.js.map +1 -1
  24. package/dist/es/logger/sentry.js +1 -1
  25. package/dist/es/map/map.d.ts +76 -0
  26. package/dist/es/map/map.d.ts.map +1 -1
  27. package/dist/es/map/map.js +250 -24
  28. package/dist/es/map/map.js.map +1 -1
  29. package/dist/es/map/mapInteractionOptions.d.ts +5 -1
  30. package/dist/es/map/mapInteractionOptions.d.ts.map +1 -1
  31. package/dist/es/map/mapInteractionOptions.js +18 -0
  32. package/dist/es/map/mapInteractionOptions.js.map +1 -1
  33. package/dist/es/utils/loadGlb.d.ts +41 -0
  34. package/dist/es/utils/loadGlb.d.ts.map +1 -1
  35. package/dist/es/utils/loadGlb.js +55 -21
  36. package/dist/es/utils/loadGlb.js.map +1 -1
  37. package/dist/es/utils/three.d.ts +37 -8
  38. package/dist/es/utils/three.d.ts.map +1 -1
  39. package/dist/es/utils/three.js +68 -32
  40. package/dist/es/utils/three.js.map +1 -1
  41. package/dist/umd/index.js +1012 -257
  42. package/dist/umd/index.js.map +1 -1
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"loadGlb.js","sourceRoot":"","sources":["../../../src/utils/loadGlb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC;;;;;GAKG;AACH,IAAI,iBAES,CAAA;AAEb,SAAS,aAAa;IACpB,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,IAAjB,iBAAiB,GAAK,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QAC7C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,CAAA;QACzC,WAAW,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAA;QAEtD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,CAAA;QACvC,UAAU,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;QAEtC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,CAAA;QACvC,UAAU,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAA;QAC1D,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;QACpC,UAAU,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAE1E,0FAA0F;QAC1F,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QACtD,KAAK,GAAG,UAAU,CAChB,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,SAAS,OAAO,GAAG,EAAE,CAAC,CAAC,EAC7E,SAAS,CACV,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IAC5C,CAAC;YAAS,CAAC;QACT,OAAO,GAAG,IAAI,CAAA;QACd,YAAY,CAAC,KAAK,CAAC,CAAA;QACnB,4FAA4F;QAC5F,6FAA6F;QAC7F,4FAA4F;QAC5F,4EAA4E;QAC5E,UAAU,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;AACH,CAAC"}
@@ -31,12 +31,6 @@ export interface ThreeModule {
31
31
  GLTFLoader: typeof GLTFLoader;
32
32
  DRACOLoader: typeof DRACOLoader;
33
33
  KTX2Loader: typeof KTX2Loader;
34
- /**
35
- * The singleton meshopt decoder. Wired into the GLB loader so assets compressed with
36
- * `EXT_meshopt_compression` (a much stronger geometry/vertex compressor than Draco for many
37
- * meshes) decode instead of failing. See {@link getGltfLoader} in `loadGlb.ts`.
38
- */
39
- MeshoptDecoder: typeof MeshoptDecoder;
40
34
  }
41
35
  /** Runtime handle to the deck.gl classes used by the 3D scene. */
42
36
  export interface DeckModule {
@@ -46,13 +40,48 @@ export interface DeckModule {
46
40
  PathLayer: typeof import("@deck.gl/layers").PathLayer;
47
41
  TextLayer: typeof import("@deck.gl/layers").TextLayer;
48
42
  }
43
+ /**
44
+ * Memoizes a dynamic-import chain, caching only a FULFILLED result.
45
+ *
46
+ * A plain `cached ??= import(...)` also memoizes a *rejection*, so one transient chunk-fetch
47
+ * failure (a dropped connection, a cache-busted deploy mid-session) permanently disables the
48
+ * feature for the rest of the page's life: every retry receives the same rejected promise and
49
+ * fails identically. The 3D scene retries on its own — `reloadScene3DModelsForLod` reloads GLB
50
+ * templates on every zoom-in past the LOD threshold — so a sticky rejection turns a blip into
51
+ * models that never come back until the user reloads.
52
+ *
53
+ * Concurrent callers still share one in-flight import (that is the point of the cache); only the
54
+ * rejected promise is evicted, and the error is re-thrown so every current caller still sees it.
55
+ *
56
+ * Exported only so the eviction behaviour can be tested directly — the loaders below wrap real
57
+ * dynamic `import()` calls, which a unit test cannot fail on demand.
58
+ *
59
+ * @param load Builds the import promise. Called again on the first retry after a failure.
60
+ * @returns An accessor that imports at most once per successful load.
61
+ * @internal
62
+ */
63
+ export declare function memoizeImport<T>(load: () => Promise<T>): () => Promise<T>;
49
64
  /**
50
65
  * Dynamically imports Three.js and the GLTF/DRACO/KTX2 loaders once and caches the result.
51
66
  * Subsequent calls return the same promise, so a single Three.js instance is shared.
67
+ * A failed import is not cached — see {@link memoizeImport}.
68
+ */
69
+ export declare const loadThree: () => Promise<ThreeModule>;
70
+ /**
71
+ * Dynamically imports the singleton meshopt decoder once and caches the result.
72
+ *
73
+ * Deliberately NOT part of {@link loadThree}'s import chain: only GLBs compressed with
74
+ * `EXT_meshopt_compression` need it, so keeping it out of the eager `Promise.all` keeps the
75
+ * decoder module (and its WASM instantiation) off the critical path of the first 3D frame.
76
+ * It is fetched on the first meshopt buffer decode instead — see the lazy wrapper in
77
+ * `loadGlb.ts`. That moves the fetch inside `parse()`, competing with hundreds of MB of GLB
78
+ * downloads, so not caching a failed import (see {@link memoizeImport}) matters more here than
79
+ * for the eager loaders.
52
80
  */
53
- export declare function loadThree(): Promise<ThreeModule>;
81
+ export declare const loadMeshoptDecoder: () => Promise<typeof MeshoptDecoder>;
54
82
  /**
55
83
  * Dynamically imports the deck.gl overlay and layer classes once and caches the result.
84
+ * A failed import is not cached — see {@link memoizeImport}.
56
85
  */
57
- export declare function loadDeck(): Promise<DeckModule>;
86
+ export declare const loadDeck: () => Promise<DeckModule>;
58
87
  //# sourceMappingURL=three.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"three.d.ts","sourceRoot":"","sources":["../../../src/ut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,EAAE,MAAM,oCAAoC,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAEjF,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,cAAc,OAAO,CAAC,CAAA;IAC7B,UAAU,EAAE,OAAO,UAAU,CAAA;IAC7B,WAAW,EAAE,OAAO,WAAW,CAAA;IAC/B,UAAU,EAAE,OAAO,UAAU,CAAA;CAC9B;AAED,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,cAAc,iBAAiB,EAAE,aAAa,CAAA;IAC7D,QAAQ,EAAE,cAAc,qBAAqB,EAAE,QAAQ,CAAA;IACvD,SAAS,EAAE,cAAc,iBAAiB,EAAE,SAAS,CAAA;IACrD,SAAS,EAAE,cAAc,iBAAiB,EAAE,SAAS,CAAA;IACrD,SAAS,EAAE,cAAc,iBAAiB,EAAE,SAAS,CAAA;CACtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,CAAC,CAWzE;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,OAAO,CAAC,WAAW,CAYhD,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,OAAO,CAAC,OAAO,cAAc,CAEnE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,OAAO,CAAC,UAAU,CAY9C,CAAA"}
@@ -1,40 +1,76 @@
1
- let threePromise;
2
- let deckPromise;
1
+ /**
2
+ * Memoizes a dynamic-import chain, caching only a FULFILLED result.
3
+ *
4
+ * A plain `cached ??= import(...)` also memoizes a *rejection*, so one transient chunk-fetch
5
+ * failure (a dropped connection, a cache-busted deploy mid-session) permanently disables the
6
+ * feature for the rest of the page's life: every retry receives the same rejected promise and
7
+ * fails identically. The 3D scene retries on its own — `reloadScene3DModelsForLod` reloads GLB
8
+ * templates on every zoom-in past the LOD threshold — so a sticky rejection turns a blip into
9
+ * models that never come back until the user reloads.
10
+ *
11
+ * Concurrent callers still share one in-flight import (that is the point of the cache); only the
12
+ * rejected promise is evicted, and the error is re-thrown so every current caller still sees it.
13
+ *
14
+ * Exported only so the eviction behaviour can be tested directly — the loaders below wrap real
15
+ * dynamic `import()` calls, which a unit test cannot fail on demand.
16
+ *
17
+ * @param load Builds the import promise. Called again on the first retry after a failure.
18
+ * @returns An accessor that imports at most once per successful load.
19
+ * @internal
20
+ */
21
+ export function memoizeImport(load) {
22
+ let cached;
23
+ return () => {
24
+ cached !== null && cached !== void 0 ? cached : (cached = load().catch((error) => {
25
+ // Evict BEFORE re-throwing so the next call starts a fresh import. Safe to assign here:
26
+ // a promise never settles synchronously, so `cached` is already assigned by now.
27
+ cached = undefined;
28
+ throw error;
29
+ }));
30
+ return cached;
31
+ };
32
+ }
3
33
  /**
4
34
  * Dynamically imports Three.js and the GLTF/DRACO/KTX2 loaders once and caches the result.
5
35
  * Subsequent calls return the same promise, so a single Three.js instance is shared.
36
+ * A failed import is not cached — see {@link memoizeImport}.
6
37
  */
7
- export function loadThree() {
8
- threePromise !== null && threePromise !== void 0 ? threePromise : (threePromise = Promise.all([
9
- import("three"),
10
- import("three/addons/loaders/GLTFLoader.js"),
11
- import("three/addons/loaders/DRACOLoader.js"),
12
- import("three/addons/loaders/KTX2Loader.js"),
13
- import("three/addons/libs/meshopt_decoder.module.js"),
14
- ]).then(([three, gltf, draco, ktx2, meshopt]) => ({
15
- THREE: three,
16
- GLTFLoader: gltf.GLTFLoader,
17
- DRACOLoader: draco.DRACOLoader,
18
- KTX2Loader: ktx2.KTX2Loader,
19
- MeshoptDecoder: meshopt.MeshoptDecoder,
20
- })));
21
- return threePromise;
22
- }
38
+ export const loadThree = memoizeImport(() => Promise.all([
39
+ import("three"),
40
+ import("three/addons/loaders/GLTFLoader.js"),
41
+ import("three/addons/loaders/DRACOLoader.js"),
42
+ import("three/addons/loaders/KTX2Loader.js"),
43
+ ]).then(([three, gltf, draco, ktx2]) => ({
44
+ THREE: three,
45
+ GLTFLoader: gltf.GLTFLoader,
46
+ DRACOLoader: draco.DRACOLoader,
47
+ KTX2Loader: ktx2.KTX2Loader,
48
+ })));
49
+ /**
50
+ * Dynamically imports the singleton meshopt decoder once and caches the result.
51
+ *
52
+ * Deliberately NOT part of {@link loadThree}'s import chain: only GLBs compressed with
53
+ * `EXT_meshopt_compression` need it, so keeping it out of the eager `Promise.all` keeps the
54
+ * decoder module (and its WASM instantiation) off the critical path of the first 3D frame.
55
+ * It is fetched on the first meshopt buffer decode instead — see the lazy wrapper in
56
+ * `loadGlb.ts`. That moves the fetch inside `parse()`, competing with hundreds of MB of GLB
57
+ * downloads, so not caching a failed import (see {@link memoizeImport}) matters more here than
58
+ * for the eager loaders.
59
+ */
60
+ export const loadMeshoptDecoder = memoizeImport(() => import("three/addons/libs/meshopt_decoder.module.js").then((meshopt) => meshopt.MeshoptDecoder));
23
61
  /**
24
62
  * Dynamically imports the deck.gl overlay and layer classes once and caches the result.
63
+ * A failed import is not cached — see {@link memoizeImport}.
25
64
  */
26
- export function loadDeck() {
27
- deckPromise !== null && deckPromise !== void 0 ? deckPromise : (deckPromise = Promise.all([
28
- import("@deck.gl/mapbox"),
29
- import("@deck.gl/geo-layers"),
30
- import("@deck.gl/layers"),
31
- ]).then(([mapbox, geoLayers, layers]) => ({
32
- MapboxOverlay: mapbox.MapboxOverlay,
33
- MVTLayer: geoLayers.MVTLayer,
34
- IconLayer: layers.IconLayer,
35
- PathLayer: layers.PathLayer,
36
- TextLayer: layers.TextLayer,
37
- })));
38
- return deckPromise;
39
- }
65
+ export const loadDeck = memoizeImport(() => Promise.all([
66
+ import("@deck.gl/mapbox"),
67
+ import("@deck.gl/geo-layers"),
68
+ import("@deck.gl/layers"),
69
+ ]).then(([mapbox, geoLayers, layers]) => ({
70
+ MapboxOverlay: mapbox.MapboxOverlay,
71
+ MVTLayer: geoLayers.MVTLayer,
72
+ IconLayer: layers.IconLayer,
73
+ PathLayer: layers.PathLayer,
74
+ TextLayer: layers.TextLayer,
75
+ })));
40
76
  //# sourceMappingURL=three.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"three.js","sourceRoot":"","sources":["../../../src/utils/three.ts"],"names":[],"mappings":"AAmDA,IAAI,YAA8C,CAAA;AAClD,IAAI,WAA4C,CAAA;AAEhD;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,YAAY,aAAZ,YAAY,cAAZ,YAAY,IAAZ,YAAY,GAAK,OAAO,CAAC,GAAG,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC;QACf,MAAM,CAAC,oCAAoC,CAAC;QAC5C,MAAM,CAAC,qCAAqC,CAAC;QAC7C,MAAM,CAAC,oCAAoC,CAAC;QAC5C,MAAM,CAAC,6CAA6C,CAAC;KACtD,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QAChD,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC,CAAC,EAAA;IACH,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ;IACtB,WAAW,aAAX,WAAW,cAAX,WAAW,IAAX,WAAW,GAAK,OAAO,CAAC,GAAG,CAAC;QAC1B,MAAM,CAAC,iBAAiB,CAAC;QACzB,MAAM,CAAC,qBAAqB,CAAC;QAC7B,MAAM,CAAC,iBAAiB,CAAC;KAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAA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