@tileflow/vue 0.1.0-alpha.33 → 0.1.0-alpha.35

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 (3) hide show
  1. package/README.md +10 -4
  2. package/dist/index.js +34 -6
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -16,6 +16,12 @@ npm install @tileflow/vue@alpha @tileflow/core@alpha @tileflow/maps@alpha "mapli
16
16
  npm install --save-dev --save-exact tileflow@alpha
17
17
  ```
18
18
 
19
+ Prepared styles may retain relative asset URLs. The component loads them through Core's shared
20
+ resource loader before creating the map and before changing or blending themes. Sprites, fonts,
21
+ data and model resources resolve against their declaring documents. Pending document loads are
22
+ cancelled when the map is replaced or unmounted; `mapOptions.transformRequest` also applies to
23
+ style and HTTP TileJSON requests.
24
+
19
25
  ## Prepare a map
20
26
 
21
27
  Create `tileflow.config.ts` at the application root:
@@ -99,7 +105,7 @@ Theme and `time-of-day` changes cross-fade over 450 ms by default, respecting re
99
105
  `:theme-blend="{themes: ['night', 'dusk', 'day'], position}"` shows a continuous blend of the
100
106
  map's themes instead of `theme`: position 0 is the first theme and 1.5 is halfway from the second to
101
107
  the third. Moving the position updates the map at once. See
102
- [theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md).
108
+ [theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md).
103
109
 
104
110
  Interactive maps show the 3D scene their style declares by default: buildings with Tileflow
105
111
  landmarks and the map's Team building models, 3D trees, and street lights where the map enables
@@ -109,8 +115,8 @@ draws vegetation as the map's policy sets for the 2D view (Streets keeps its mod
109
115
  view). `vegetation` overrides vegetation visibility (omitting it uses the map default); `:vegetation="false"`
110
116
  hides models and flat artwork alike. Changing either prop updates the existing map immediately.
111
117
  They do not change camera pitch and do not apply in image mode. See
112
- [the map's 3D scene](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/buildings-3d.md#the-maps-3d-scene)
113
- and [vegetation controls](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/trees-3d.md#visibility-and-representation).
118
+ [the map's 3D scene](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md)
119
+ and [vegetation controls](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md).
114
120
 
115
121
  `mapOptions` accepts native MapLibre options except `container` and `style`. Direct props take
116
122
  priority over those options, then the published view, then shared defaults. `TileflowMap` always
@@ -216,5 +222,5 @@ Direct World maps can show owner-action notices when managed delivery is require
216
222
  image path remain SSR-safe; interactive rendering needs a browser with WebGL.
217
223
 
218
224
  See the [interaction guide](https://github.com/tileflow/tileflow-sdk/blob/main/packages/interactions/README.md)
219
- and [browser runtime contract](https://github.com/tileflow/tileflow-sdk/blob/main/docs/contracts/framework-browser-runtime.md).
225
+ and [browser runtime contract](https://github.com/tileflow/tileflow-sdk/blob/main/README.md).
220
226
  Use the installed package's declarations and README for a release; `main` can include newer changes.
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  import {
17
17
  attachTileflowAtmosphere,
18
18
  attachTileflowFairUseNotice,
19
+ attachTileflowHorizonQueries,
19
20
  attachTileflowLabelPlacement,
20
21
  attachTileflowMap3D,
21
22
  attachTileflowMapLifecycle,
@@ -25,8 +26,10 @@ import {
25
26
  createTileflowThemeController,
26
27
  createTileflowTransformRequest,
27
28
  getTileflowSystemColorScheme,
29
+ loadTileflowRuntimeStyle,
28
30
  loadTileflowStyleFonts,
29
31
  registerTileflowContourProtocol,
32
+ registerTileflowPathGroundProtocol,
30
33
  registerTileflowPmtilesProtocol,
31
34
  registerTileflowWorldRequestBridge,
32
35
  subscribeTileflowSystemColorScheme,
@@ -305,6 +308,7 @@ var TileflowMap = defineComponent({
305
308
  let themeController = null;
306
309
  let unsubscribeSystemColorScheme = null;
307
310
  let mapLoadId = 0;
311
+ let resourceLifetime;
308
312
  let manifestLoadId = 0;
309
313
  let readinessRunId = 0;
310
314
  let interactionReadinessRunId = 0;
@@ -641,6 +645,8 @@ var TileflowMap = defineComponent({
641
645
  );
642
646
  const destroyMap = () => {
643
647
  mapLoadId += 1;
648
+ resourceLifetime?.abort();
649
+ resourceLifetime = void 0;
644
650
  readinessRunId += 1;
645
651
  invalidateInteractionReadiness();
646
652
  const lifecycle = mapLifecycle;
@@ -765,16 +771,35 @@ var TileflowMap = defineComponent({
765
771
  const loadId = mapLoadId;
766
772
  const container = containerRef.value;
767
773
  const runtime = runtimeStyle.value;
774
+ const session = createTileflowSessionController({ source: "vue" });
775
+ const lifetime = new AbortController();
776
+ resourceLifetime = lifetime;
777
+ const resourceTransform = createTileflowTransformRequest({
778
+ getAnalytics: () => resolvedAnalytics.value,
779
+ sessionController: session,
780
+ sessionId: session.sessionId,
781
+ transformRequest: props.mapOptions?.transformRequest ?? void 0
782
+ });
783
+ const styleLoadOptions = {
784
+ signal: lifetime.signal,
785
+ transformRequest: (url, type) => resourceTransform(
786
+ url,
787
+ type
788
+ )
789
+ };
768
790
  let maplibregl;
791
+ let prepared;
769
792
  try {
770
- [maplibregl] = await Promise.all([
793
+ [maplibregl, prepared] = await Promise.all([
771
794
  loadTileflowMapLibre(),
772
- loadTileflowStyleFonts(runtime.style, {
773
- fontFaces: runtime.fontFaces
795
+ loadTileflowRuntimeStyle(runtime, styleLoadOptions).then(async (loaded) => {
796
+ await loadTileflowStyleFonts(loaded.style, { fontFaces: loaded.fontFaces });
797
+ return loaded;
774
798
  })
775
799
  ]);
776
800
  } catch (error) {
777
801
  if (loadId === mapLoadId) {
802
+ lifetime.abort();
778
803
  console.error("Failed to load the Tileflow map runtime", error);
779
804
  mapCaptureState.value = "error";
780
805
  }
@@ -783,7 +808,6 @@ var TileflowMap = defineComponent({
783
808
  if (loadId !== mapLoadId || containerRef.value !== container || isImageMode.value) {
784
809
  return;
785
810
  }
786
- const session = createTileflowSessionController({ source: "vue" });
787
811
  const sessionStarter = createTileflowSessionStarter({
788
812
  getSessionId: () => session.sessionId,
789
813
  sessionId: session.sessionId,
@@ -791,6 +815,7 @@ var TileflowMap = defineComponent({
791
815
  });
792
816
  mapFairUseNotice = attachTileflowFairUseNotice(container);
793
817
  registerTileflowContourProtocol({ addProtocol: maplibregl.addProtocol });
818
+ registerTileflowPathGroundProtocol({ addProtocol: maplibregl.addProtocol });
794
819
  registerTileflowPmtilesProtocol({ addProtocol: maplibregl.addProtocol });
795
820
  mapWorldRequestBridge = registerTileflowWorldRequestBridge({
796
821
  addProtocol: maplibregl.addProtocol,
@@ -812,7 +837,7 @@ var TileflowMap = defineComponent({
812
837
  container,
813
838
  interactive: resolvedInteractive.value,
814
839
  pitch: resolvedPitch.value,
815
- style: runtime.style,
840
+ style: prepared.style,
816
841
  transformRequest: createTileflowTransformRequest({
817
842
  getAnalytics: () => resolvedAnalytics.value,
818
843
  sessionController: session,
@@ -827,8 +852,11 @@ var TileflowMap = defineComponent({
827
852
  attachTileflowNotices(map);
828
853
  attachTileflowNauticalLights(map);
829
854
  attachTileflowLabelPlacement(map);
855
+ attachTileflowHorizonQueries(map);
830
856
  themeController = runtime.theme === void 0 ? null : createTileflowThemeController({
831
- initial: runtime,
857
+ initial: prepared.family ? prepared : runtime,
858
+ initialStyle: prepared.style,
859
+ styleLoadOptions,
832
860
  map,
833
861
  onTransition(transition) {
834
862
  emit("themeChange", transition);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/vue",
3
- "version": "0.1.0-alpha.33",
3
+ "version": "0.1.0-alpha.35",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Vue component for rendering Tileflow maps with MapLibre.",
6
6
  "type": "module",
@@ -38,8 +38,8 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@tileflow/core": ">=0.1.0-alpha.40 <0.1.0-beta.0",
42
- "@tileflow/interactions": ">=0.1.0-alpha.6 <0.1.0-beta.0"
41
+ "@tileflow/core": ">=0.1.0-alpha.45 <0.1.0-beta.0",
42
+ "@tileflow/interactions": ">=0.1.0-alpha.7 <0.1.0-beta.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "maplibre-gl": ">=6.4.1 <7",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@vue/server-renderer": "3.5.43",
50
- "maplibre-gl": "6.13.0",
50
+ "maplibre-gl": "6.16.0",
51
51
  "tsx": "^4.23.15",
52
52
  "vue": "^3.5.43"
53
53
  },