@tileflow/svelte 0.1.0-alpha.30 → 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 +16 -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,12 +31,12 @@
|
|
|
31
31
|
import {
|
|
32
32
|
attachTileflowAtmosphere,
|
|
33
33
|
attachTileflowFairUseNotice,
|
|
34
|
+
attachTileflowMap3D,
|
|
34
35
|
attachTileflowMapLifecycle,
|
|
35
36
|
attachTileflowNotices,
|
|
36
37
|
createTileflowSessionStarter,
|
|
37
38
|
createTileflowThemeController,
|
|
38
|
-
|
|
39
|
-
type TileflowVegetationController,
|
|
39
|
+
type TileflowMap3DAttachment,
|
|
40
40
|
createTileflowTransformRequest,
|
|
41
41
|
getTileflowSystemColorScheme,
|
|
42
42
|
loadTileflowStyleFonts,
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
export let timeOfDay: TileflowMapProps['timeOfDay'] = undefined;
|
|
106
106
|
export let themeBlend: TileflowMapProps['themeBlend'] = undefined;
|
|
107
107
|
export let vegetation: TileflowMapProps['vegetation'] = undefined;
|
|
108
|
-
export let viewMode: NonNullable<TileflowMapProps['viewMode']> = '
|
|
108
|
+
export let viewMode: NonNullable<TileflowMapProps['viewMode']> = '3d';
|
|
109
109
|
export let themeTransition: TileflowMapProps['themeTransition'] = undefined;
|
|
110
110
|
export let tooltip: TileflowMapProps['tooltip'] = undefined;
|
|
111
111
|
export let zoom: TileflowMapProps['zoom'] = undefined;
|
|
@@ -148,9 +148,9 @@
|
|
|
148
148
|
let interactionRuntimesDisposing = false;
|
|
149
149
|
let mapResizeObserver: ResizeObserver | null = null;
|
|
150
150
|
let mapWorldRequestBridge: TileflowWorldRequestBridge | null = null;
|
|
151
|
-
let
|
|
152
|
-
$:
|
|
153
|
-
$:
|
|
151
|
+
let sceneAttachment: TileflowMap3DAttachment | null = null;
|
|
152
|
+
$: sceneAttachment?.setVegetation(vegetation);
|
|
153
|
+
$: sceneAttachment?.setViewMode(viewMode);
|
|
154
154
|
let themeController: TileflowThemeController | null = null;
|
|
155
155
|
let systemColorScheme: 'dark' | 'light' = 'light';
|
|
156
156
|
let unsubscribeSystemColorScheme: (() => void) | null = null;
|
|
@@ -460,8 +460,8 @@
|
|
|
460
460
|
const unsubscribeSemanticTargets = semanticRuntimeTargetsUnsubscribe;
|
|
461
461
|
const currentMap = mapInstance;
|
|
462
462
|
const currentThemeController = themeController;
|
|
463
|
-
const
|
|
464
|
-
|
|
463
|
+
const currentSceneAttachment = sceneAttachment;
|
|
464
|
+
sceneAttachment = null;
|
|
465
465
|
const worldRequestBridge = mapWorldRequestBridge;
|
|
466
466
|
interactionRuntimesDisposing = true;
|
|
467
467
|
mapFairUseNotice = null;
|
|
@@ -504,7 +504,7 @@
|
|
|
504
504
|
() => semanticInteractionsForMap?.dispose(),
|
|
505
505
|
() => annotationInteractionsForMap?.dispose(),
|
|
506
506
|
() => lifecycleAttachment?.dispose(),
|
|
507
|
-
() =>
|
|
507
|
+
() => currentSceneAttachment?.dispose(),
|
|
508
508
|
() => currentThemeController?.dispose(),
|
|
509
509
|
() => worldRequestBridge?.dispose(),
|
|
510
510
|
() => fairUseNotice?.dispose(),
|
|
@@ -587,6 +587,8 @@
|
|
|
587
587
|
const maplibreMap = new maplibregl.Map({
|
|
588
588
|
...mapOptions,
|
|
589
589
|
attributionControl: mapOptions?.attributionControl ?? {compact: true},
|
|
590
|
+
// Tileflow's compiled styles are validated when they are built.
|
|
591
|
+
validateStyle: mapOptions?.validateStyle ?? false,
|
|
590
592
|
bearing: resolvedBearing,
|
|
591
593
|
center: resolvedCenter as LngLatLike,
|
|
592
594
|
container: targetContainer,
|
|
@@ -624,11 +626,14 @@
|
|
|
624
626
|
},
|
|
625
627
|
});
|
|
626
628
|
|
|
627
|
-
|
|
629
|
+
// The map's 3D scene loads only once its style declares one, so 2D maps do not pay for it.
|
|
630
|
+
sceneAttachment = attachTileflowMap3D({
|
|
628
631
|
map: maplibreMap,
|
|
629
632
|
...(themeController ? {controller: themeController} : {}),
|
|
630
|
-
|
|
633
|
+
vegetation,
|
|
631
634
|
viewMode,
|
|
635
|
+
load: () => import('@tileflow/core/3d'),
|
|
636
|
+
onError: (error) => console.error('Failed to load the Tileflow 3D scene', error),
|
|
632
637
|
transformRequest: createTileflowTransformRequest({
|
|
633
638
|
getAnalytics: () => resolvedAnalytics,
|
|
634
639
|
sessionController: session,
|