@tileflow/svelte 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.
package/README.md CHANGED
@@ -16,6 +16,12 @@ npm install @tileflow/svelte@alpha @tileflow/core@alpha @tileflow/maps@alpha "ma
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:
@@ -101,7 +107,7 @@ Theme and `timeOfDay` changes cross-fade over 450 ms by default, respecting redu
101
107
  `themeBlend={{themes: ['night', 'dusk', 'day'], position}}` shows a continuous blend of the map's
102
108
  themes instead of `theme`: position 0 is the first theme and 1.5 is halfway from the second to the
103
109
  third. Moving the position updates the map at once. See
104
- [theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md).
110
+ [theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md).
105
111
 
106
112
  Interactive maps show the 3D scene their style declares by default: buildings with Tileflow
107
113
  landmarks and the map's Team building models, 3D trees, and street lights where the map enables
@@ -111,8 +117,8 @@ draws vegetation as the map's policy sets for the 2D view (Streets keeps its mod
111
117
  view). `vegetation` overrides vegetation visibility (omitting it uses the map default); `vegetation={false}`
112
118
  hides models and flat artwork alike. Changing either prop updates the existing map immediately.
113
119
  They do not change camera pitch and do not apply in image mode. See
114
- [the map's 3D scene](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/buildings-3d.md#the-maps-3d-scene)
115
- and [vegetation controls](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/trees-3d.md#visibility-and-representation).
120
+ [the map's 3D scene](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md)
121
+ and [vegetation controls](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md).
116
122
 
117
123
  `mapOptions` accepts native MapLibre options except `container` and `style`. Direct props win over
118
124
  those options, then the manifest view, then shared defaults. `TileflowMap` always selects a Tileflow
@@ -224,5 +230,5 @@ managed delivery is required. Imports and the image path remain SSR-safe; intera
224
230
  requires a browser with WebGL.
225
231
 
226
232
  See the [interaction guide](https://github.com/tileflow/tileflow-sdk/blob/main/packages/interactions/README.md)
227
- and [browser runtime contract](https://github.com/tileflow/tileflow-sdk/blob/main/docs/contracts/framework-browser-runtime.md).
233
+ and [browser runtime contract](https://github.com/tileflow/tileflow-sdk/blob/main/README.md).
228
234
  Use the installed declarations and README for release-specific behavior; `main` may be newer than npm.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/svelte",
3
- "version": "0.1.0-alpha.33",
3
+ "version": "0.1.0-alpha.35",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Svelte component for rendering Tileflow maps with MapLibre.",
6
6
  "type": "module",
@@ -44,15 +44,15 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@tileflow/core": ">=0.1.0-alpha.40 <0.1.0-beta.0",
48
- "@tileflow/interactions": ">=0.1.0-alpha.6 <0.1.0-beta.0"
47
+ "@tileflow/core": ">=0.1.0-alpha.45 <0.1.0-beta.0",
48
+ "@tileflow/interactions": ">=0.1.0-alpha.7 <0.1.0-beta.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "maplibre-gl": ">=6.4.1 <7",
52
52
  "svelte": ">=5 <6"
53
53
  },
54
54
  "devDependencies": {
55
- "maplibre-gl": "6.13.0",
55
+ "maplibre-gl": "6.16.0",
56
56
  "svelte": "^5.57.2",
57
57
  "svelte-check": "^4.7.7"
58
58
  },
@@ -31,6 +31,7 @@
31
31
  import {
32
32
  attachTileflowAtmosphere,
33
33
  attachTileflowLabelPlacement,
34
+ attachTileflowHorizonQueries,
34
35
  attachTileflowFairUseNotice,
35
36
  attachTileflowMap3D,
36
37
  attachTileflowMapLifecycle,
@@ -41,8 +42,10 @@
41
42
  type TileflowMap3DAttachment,
42
43
  createTileflowTransformRequest,
43
44
  getTileflowSystemColorScheme,
45
+ loadTileflowRuntimeStyle,
44
46
  loadTileflowStyleFonts,
45
47
  registerTileflowContourProtocol,
48
+ registerTileflowPathGroundProtocol,
46
49
  registerTileflowPmtilesProtocol,
47
50
  registerTileflowWorldRequestBridge,
48
51
  subscribeTileflowSystemColorScheme,
@@ -164,6 +167,7 @@
164
167
  let manifestResolutionKey = '';
165
168
  let manifestResolutionState: 'error' | 'loading' | 'ready' = 'loading';
166
169
  let mapLoadId = 0;
170
+ let resourceLifetime: AbortController | undefined;
167
171
  let mounted = false;
168
172
  let refreshRunId = 0;
169
173
  let readinessRunId = 0;
@@ -449,6 +453,8 @@
449
453
 
450
454
  function destroyMap() {
451
455
  mapLoadId += 1;
456
+ resourceLifetime?.abort();
457
+ resourceLifetime = undefined;
452
458
  readinessRunId += 1;
453
459
  const lifecycleAttachment = mapLifecycleAttachment;
454
460
  const fairUseNotice = mapFairUseNotice;
@@ -550,15 +556,36 @@
550
556
  const loadId = mapLoadId;
551
557
  const targetContainer = container;
552
558
  const runtime = runtimeStyle;
559
+ const session = createTileflowSessionController({source: 'svelte'});
560
+ const lifetime = new AbortController();
561
+ resourceLifetime = lifetime;
562
+ const resourceTransform = createTileflowTransformRequest({
563
+ getAnalytics: () => resolvedAnalytics,
564
+ sessionController: session,
565
+ sessionId: session.sessionId,
566
+ transformRequest: mapOptions?.transformRequest ?? undefined,
567
+ });
568
+ const styleLoadOptions = {
569
+ signal: lifetime.signal,
570
+ transformRequest: (url: string, type: 'Style' | 'Source') =>
571
+ resourceTransform(
572
+ url,
573
+ type as Parameters<NonNullable<TileflowMapOptions['transformRequest']>>[1],
574
+ ),
575
+ };
553
576
  let maplibregl: Awaited<ReturnType<typeof loadTileflowMapLibre>>;
554
-
577
+ let prepared: Awaited<ReturnType<typeof loadTileflowRuntimeStyle>>;
555
578
  try {
556
- [maplibregl] = await Promise.all([
579
+ [maplibregl, prepared] = await Promise.all([
557
580
  loadTileflowMapLibre(),
558
- loadTileflowStyleFonts(runtime.style, {fontFaces: runtime.fontFaces}),
581
+ loadTileflowRuntimeStyle(runtime, styleLoadOptions).then(async (loaded) => {
582
+ await loadTileflowStyleFonts(loaded.style, {fontFaces: loaded.fontFaces});
583
+ return loaded;
584
+ }),
559
585
  ]);
560
586
  } catch (error) {
561
587
  if (mounted && runId === refreshRunId && loadId === mapLoadId) {
588
+ lifetime.abort();
562
589
  console.error('Failed to load the Tileflow map runtime', error);
563
590
  mapCaptureState = 'error';
564
591
  }
@@ -575,7 +602,6 @@
575
602
  return;
576
603
  }
577
604
 
578
- const session = createTileflowSessionController({source: 'svelte'});
579
605
  const sessionStarter = createTileflowSessionStarter({
580
606
  getSessionId: () => session.sessionId,
581
607
  sessionId: session.sessionId,
@@ -583,6 +609,7 @@
583
609
  });
584
610
  mapFairUseNotice = attachTileflowFairUseNotice(targetContainer);
585
611
  registerTileflowContourProtocol({addProtocol: maplibregl.addProtocol});
612
+ registerTileflowPathGroundProtocol({addProtocol: maplibregl.addProtocol});
586
613
  registerTileflowPmtilesProtocol({addProtocol: maplibregl.addProtocol});
587
614
  mapWorldRequestBridge = registerTileflowWorldRequestBridge({
588
615
  addProtocol: maplibregl.addProtocol,
@@ -600,7 +627,7 @@
600
627
  container: targetContainer,
601
628
  interactive: resolvedInteractive,
602
629
  pitch: resolvedPitch,
603
- style: runtime.style as StyleSpecification | string,
630
+ style: prepared.style as StyleSpecification,
604
631
  transformRequest: createTileflowTransformRequest({
605
632
  getAnalytics: () => resolvedAnalytics,
606
633
  sessionController: session,
@@ -616,11 +643,15 @@
616
643
  attachTileflowNotices(maplibreMap);
617
644
  attachTileflowNauticalLights(maplibreMap);
618
645
  attachTileflowLabelPlacement(maplibreMap);
646
+ // Feature queries and taps keep working once a steep pitch shows the horizon.
647
+ attachTileflowHorizonQueries(maplibreMap);
619
648
  themeController =
620
649
  runtime.theme === undefined
621
650
  ? null
622
651
  : createTileflowThemeController({
623
- initial: runtime,
652
+ initial: prepared.family ? prepared : runtime,
653
+ initialStyle: prepared.style,
654
+ styleLoadOptions,
624
655
  map: maplibreMap,
625
656
  onTransition(transition) {
626
657
  onThemeChange?.(transition);