@tileflow/svelte 0.1.0-alpha.29 → 0.1.0-alpha.31
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 +13 -7
- package/package.json +3 -3
- package/src/TileflowMap.svelte +18 -11
package/README.md
CHANGED
|
@@ -102,16 +102,22 @@ themes instead of `theme`: position 0 is the first theme and 1.5 is halfway from
|
|
|
102
102
|
third. Moving the position updates the map at once. See
|
|
103
103
|
[theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md).
|
|
104
104
|
|
|
105
|
-
Interactive maps
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
Interactive maps show the 3D scene their style declares by default: buildings with Tileflow
|
|
106
|
+
landmarks and the map's Team building models, 3D trees, and street lights where the map enables
|
|
107
|
+
them. The 3D renderers load only when the style declares a scene, so 2D maps do not download them.
|
|
108
|
+
`viewMode` is `3d` by default; `viewMode="2d"` opts out, mounting no 3D buildings or street lights, and
|
|
109
|
+
draws vegetation as the map's policy sets for the 2D view (Streets keeps its model trees in either
|
|
110
|
+
view). `vegetation` overrides vegetation visibility (omitting it uses the map default); `vegetation={false}`
|
|
111
|
+
hides models and flat artwork alike. Changing either prop updates the existing map immediately.
|
|
112
|
+
They do not change camera pitch and do not apply in image mode. See
|
|
113
|
+
[the map's 3D scene](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/buildings-3d.md#the-maps-3d-scene)
|
|
114
|
+
and [vegetation controls](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/trees-3d.md#visibility-and-representation).
|
|
111
115
|
|
|
112
116
|
`mapOptions` accepts native MapLibre options except `container` and `style`. Direct props win over
|
|
113
117
|
those options, then the manifest view, then shared defaults. `TileflowMap` always selects a Tileflow
|
|
114
|
-
map through its manifest; it has no renderer discriminator or direct-style mode.
|
|
118
|
+
map through its manifest; it has no renderer discriminator or direct-style mode. Tileflow's styles
|
|
119
|
+
are validated when they are compiled, so `validateStyle` defaults to `false`; pass `true` to
|
|
120
|
+
validate them again in the browser. The obsolete
|
|
115
121
|
source fields `kind` and `style` are rejected. For a completely unmanaged map, use `maplibre-gl`
|
|
116
122
|
directly rather than a Tileflow component.
|
|
117
123
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tileflow/svelte",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.31",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Svelte component for rendering Tileflow maps with MapLibre.",
|
|
6
6
|
"type": "module",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@tileflow/core": ">=0.1.0-alpha.
|
|
48
|
-
"@tileflow/interactions": ">=0.1.0-alpha.
|
|
47
|
+
"@tileflow/core": ">=0.1.0-alpha.38 <0.1.0-beta.0",
|
|
48
|
+
"@tileflow/interactions": ">=0.1.0-alpha.6 <0.1.0-beta.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"maplibre-gl": ">=6.4.1 <7",
|
package/src/TileflowMap.svelte
CHANGED
|
@@ -31,11 +31,12 @@
|
|
|
31
31
|
import {
|
|
32
32
|
attachTileflowAtmosphere,
|
|
33
33
|
attachTileflowFairUseNotice,
|
|
34
|
+
attachTileflowMap3D,
|
|
34
35
|
attachTileflowMapLifecycle,
|
|
36
|
+
attachTileflowNotices,
|
|
35
37
|
createTileflowSessionStarter,
|
|
36
38
|
createTileflowThemeController,
|
|
37
|
-
|
|
38
|
-
type TileflowVegetationController,
|
|
39
|
+
type TileflowMap3DAttachment,
|
|
39
40
|
createTileflowTransformRequest,
|
|
40
41
|
getTileflowSystemColorScheme,
|
|
41
42
|
loadTileflowStyleFonts,
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
export let timeOfDay: TileflowMapProps['timeOfDay'] = undefined;
|
|
105
106
|
export let themeBlend: TileflowMapProps['themeBlend'] = undefined;
|
|
106
107
|
export let vegetation: TileflowMapProps['vegetation'] = undefined;
|
|
107
|
-
export let viewMode: NonNullable<TileflowMapProps['viewMode']> = '
|
|
108
|
+
export let viewMode: NonNullable<TileflowMapProps['viewMode']> = '3d';
|
|
108
109
|
export let themeTransition: TileflowMapProps['themeTransition'] = undefined;
|
|
109
110
|
export let tooltip: TileflowMapProps['tooltip'] = undefined;
|
|
110
111
|
export let zoom: TileflowMapProps['zoom'] = undefined;
|
|
@@ -147,9 +148,9 @@
|
|
|
147
148
|
let interactionRuntimesDisposing = false;
|
|
148
149
|
let mapResizeObserver: ResizeObserver | null = null;
|
|
149
150
|
let mapWorldRequestBridge: TileflowWorldRequestBridge | null = null;
|
|
150
|
-
let
|
|
151
|
-
$:
|
|
152
|
-
$:
|
|
151
|
+
let sceneAttachment: TileflowMap3DAttachment | null = null;
|
|
152
|
+
$: sceneAttachment?.setVegetation(vegetation);
|
|
153
|
+
$: sceneAttachment?.setViewMode(viewMode);
|
|
153
154
|
let themeController: TileflowThemeController | null = null;
|
|
154
155
|
let systemColorScheme: 'dark' | 'light' = 'light';
|
|
155
156
|
let unsubscribeSystemColorScheme: (() => void) | null = null;
|
|
@@ -459,8 +460,8 @@
|
|
|
459
460
|
const unsubscribeSemanticTargets = semanticRuntimeTargetsUnsubscribe;
|
|
460
461
|
const currentMap = mapInstance;
|
|
461
462
|
const currentThemeController = themeController;
|
|
462
|
-
const
|
|
463
|
-
|
|
463
|
+
const currentSceneAttachment = sceneAttachment;
|
|
464
|
+
sceneAttachment = null;
|
|
464
465
|
const worldRequestBridge = mapWorldRequestBridge;
|
|
465
466
|
interactionRuntimesDisposing = true;
|
|
466
467
|
mapFairUseNotice = null;
|
|
@@ -503,7 +504,7 @@
|
|
|
503
504
|
() => semanticInteractionsForMap?.dispose(),
|
|
504
505
|
() => annotationInteractionsForMap?.dispose(),
|
|
505
506
|
() => lifecycleAttachment?.dispose(),
|
|
506
|
-
() =>
|
|
507
|
+
() => currentSceneAttachment?.dispose(),
|
|
507
508
|
() => currentThemeController?.dispose(),
|
|
508
509
|
() => worldRequestBridge?.dispose(),
|
|
509
510
|
() => fairUseNotice?.dispose(),
|
|
@@ -586,6 +587,8 @@
|
|
|
586
587
|
const maplibreMap = new maplibregl.Map({
|
|
587
588
|
...mapOptions,
|
|
588
589
|
attributionControl: mapOptions?.attributionControl ?? {compact: true},
|
|
590
|
+
// Tileflow's compiled styles are validated when they are built.
|
|
591
|
+
validateStyle: mapOptions?.validateStyle ?? false,
|
|
589
592
|
bearing: resolvedBearing,
|
|
590
593
|
center: resolvedCenter as LngLatLike,
|
|
591
594
|
container: targetContainer,
|
|
@@ -604,6 +607,7 @@
|
|
|
604
607
|
|
|
605
608
|
mapInstance = maplibreMap;
|
|
606
609
|
attachTileflowAtmosphere(maplibreMap);
|
|
610
|
+
attachTileflowNotices(maplibreMap);
|
|
607
611
|
themeController =
|
|
608
612
|
runtime.theme === undefined
|
|
609
613
|
? null
|
|
@@ -622,11 +626,14 @@
|
|
|
622
626
|
},
|
|
623
627
|
});
|
|
624
628
|
|
|
625
|
-
|
|
629
|
+
// The map's 3D scene loads only once its style declares one, so 2D maps do not pay for it.
|
|
630
|
+
sceneAttachment = attachTileflowMap3D({
|
|
626
631
|
map: maplibreMap,
|
|
627
632
|
...(themeController ? {controller: themeController} : {}),
|
|
628
|
-
|
|
633
|
+
vegetation,
|
|
629
634
|
viewMode,
|
|
635
|
+
load: () => import('@tileflow/core/3d'),
|
|
636
|
+
onError: (error) => console.error('Failed to load the Tileflow 3D scene', error),
|
|
630
637
|
transformRequest: createTileflowTransformRequest({
|
|
631
638
|
getAnalytics: () => resolvedAnalytics,
|
|
632
639
|
sessionController: session,
|