@tileflow/vue 0.1.0-alpha.27 → 0.1.0-alpha.29
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 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +50 -14
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -88,12 +88,25 @@ Omitting `theme` uses `defaultTheme`. `system` needs the map's explicit light/da
|
|
|
88
88
|
Streets supplies. Switching themes preserves the map, camera, and interactions, with rollback on
|
|
89
89
|
failure. Listen to `themeChange` for transitions.
|
|
90
90
|
|
|
91
|
+
Add `time-of-day="dusk"` beside `theme` to select a map's optional `day`, `dawn`, `dusk`, or
|
|
92
|
+
`night` preset. For Streets, `theme="light"` with this preset selects the existing `dusk` palette.
|
|
93
|
+
Maps without this capability ignore the option; omitting it keeps the selected theme unchanged.
|
|
94
|
+
Changing it uses the existing theme transition. `themeBlend` takes precedence. See the
|
|
95
|
+
[authoring contract](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md#style-with-themes-and-semantic-modules).
|
|
96
|
+
|
|
91
97
|
`:theme-transition="{duration: 450}"` cross-fades theme changes over that many milliseconds.
|
|
92
98
|
`:theme-blend="{themes: ['night', 'dusk', 'day'], position}"` shows a continuous blend of the
|
|
93
99
|
map's themes instead of `theme`: position 0 is the first theme and 1.5 is halfway from the second to
|
|
94
100
|
the third. Moving the position updates the map at once. See
|
|
95
101
|
[theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md).
|
|
96
102
|
|
|
103
|
+
Interactive maps automatically render the map's vegetation. `vegetation` overrides visibility
|
|
104
|
+
(omitting it uses the map default); false hides models and flat artwork alike. `viewMode` is `2d`
|
|
105
|
+
by default and may be `3d`: only maps with `vegetation.mode: 'auto'` switch representation.
|
|
106
|
+
Streets uses model trees in either view. Changing either prop updates the existing map immediately.
|
|
107
|
+
These props do not change camera pitch, buildings or lighting and do not apply in image mode. See
|
|
108
|
+
[vegetation controls](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/trees-3d.md#visibility-and-representation).
|
|
109
|
+
|
|
97
110
|
`mapOptions` accepts native MapLibre options except `container` and `style`. Direct props take
|
|
98
111
|
priority over those options, then the published view, then shared defaults. `TileflowMap` always
|
|
99
112
|
selects a Tileflow map through its manifest; it has no renderer discriminator or direct-style mode.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { MapOptions, Map } from 'maplibre-gl';
|
|
2
2
|
import { DefineComponent, VNodeChild } from 'vue';
|
|
3
|
-
import { TileflowThemeTransitionOptions, TileflowThemeTransition } from '@tileflow/core/browser';
|
|
4
|
-
import { TileflowRuntimeSource, TileflowThemeSelection,
|
|
3
|
+
import { TileflowBrowserThemeBlendSelection, TileflowThemeTransitionOptions, TileflowViewMode, TileflowThemeTransition } from '@tileflow/core/browser';
|
|
4
|
+
import { TileflowRuntimeSource, TileflowThemeSelection, TileflowTimeOfDay, TileflowAnalytics } from '@tileflow/core/runtime';
|
|
5
5
|
import { TileflowAnnotation, TileflowInteractionJsonValue, TileflowInteractionState, TileflowInteractionBinding, TileflowInteractionDiagnostic, TileflowInteractionEvent, TileflowAnnotationViewContext, TileflowInteractionViewContext } from '@tileflow/interactions';
|
|
6
6
|
|
|
7
7
|
type TileflowMapStyleSourceProps = {
|
|
8
8
|
source: TileflowRuntimeSource;
|
|
9
9
|
theme?: TileflowThemeSelection;
|
|
10
|
+
/** Optional artistic preset; ignored by maps without this capability. */
|
|
11
|
+
timeOfDay?: TileflowTimeOfDay;
|
|
10
12
|
/**
|
|
11
13
|
* Shows a continuous blend of the map's themes instead of `theme`. Moving `position` changes the
|
|
12
|
-
* map at once; changing `themes` prepares a new blend.
|
|
14
|
+
* map at once; changing `themes` prepares a new blend. `hold` keeps labels, icons, and mixed
|
|
15
|
+
* artwork back during a camera move; clearing it brings them in at once.
|
|
13
16
|
*/
|
|
14
|
-
themeBlend?:
|
|
17
|
+
themeBlend?: TileflowBrowserThemeBlendSelection;
|
|
15
18
|
/** Cross-fades theme changes, including entering and leaving a blend. */
|
|
16
19
|
themeTransition?: TileflowThemeTransitionOptions;
|
|
17
20
|
};
|
|
@@ -33,6 +36,8 @@ type TileflowMapSlots<TAnnotation extends TileflowAnnotation = TileflowAnnotatio
|
|
|
33
36
|
tooltip?: (context: TileflowMapInteractionSlotContext<TAnnotation>) => VNodeChild;
|
|
34
37
|
};
|
|
35
38
|
type TileflowMapSharedProps = {
|
|
39
|
+
vegetation?: boolean;
|
|
40
|
+
viewMode?: TileflowViewMode;
|
|
36
41
|
alt?: string;
|
|
37
42
|
analytics?: TileflowAnalytics;
|
|
38
43
|
center?: [number, number];
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
attachTileflowMapLifecycle,
|
|
20
20
|
createTileflowSessionStarter,
|
|
21
21
|
createTileflowThemeController,
|
|
22
|
+
createTileflowVegetation,
|
|
22
23
|
createTileflowTransformRequest,
|
|
23
24
|
getTileflowSystemColorScheme,
|
|
24
25
|
loadTileflowStyleFonts,
|
|
@@ -160,8 +161,11 @@ function configureTileflowMapLibreModule(maplibregl) {
|
|
|
160
161
|
|
|
161
162
|
// src/style-source.ts
|
|
162
163
|
import {
|
|
164
|
+
validateTileflowBrowserThemeBlendSelection
|
|
165
|
+
} from "@tileflow/core/browser";
|
|
166
|
+
import {
|
|
167
|
+
isTileflowTimeOfDay,
|
|
163
168
|
validateTileflowRuntimeSource,
|
|
164
|
-
validateTileflowThemeBlendSelection,
|
|
165
169
|
validateTileflowThemeSelection
|
|
166
170
|
} from "@tileflow/core/runtime";
|
|
167
171
|
function validateTileflowMapStyleInputs(input) {
|
|
@@ -170,9 +174,12 @@ function validateTileflowMapStyleInputs(input) {
|
|
|
170
174
|
if (input.theme !== void 0 && !validateTileflowThemeSelection(input.theme)) {
|
|
171
175
|
return { error: 'theme must be a concrete portable theme name or "system"', ok: false };
|
|
172
176
|
}
|
|
173
|
-
if (input.
|
|
177
|
+
if (input.timeOfDay !== void 0 && !isTileflowTimeOfDay(input.timeOfDay)) {
|
|
178
|
+
return { error: "timeOfDay must be day, dawn, dusk, or night", ok: false };
|
|
179
|
+
}
|
|
180
|
+
if (input.themeBlend !== void 0 && !validateTileflowBrowserThemeBlendSelection(input.themeBlend)) {
|
|
174
181
|
return {
|
|
175
|
-
error: "themeBlend must name two to eight concrete themes
|
|
182
|
+
error: "themeBlend must name two to eight concrete themes, a position from 0 to themes.length - 1, and an optional boolean hold",
|
|
176
183
|
ok: false
|
|
177
184
|
};
|
|
178
185
|
}
|
|
@@ -236,7 +243,10 @@ var TileflowMap = defineComponent({
|
|
|
236
243
|
required: true,
|
|
237
244
|
type: Object
|
|
238
245
|
},
|
|
246
|
+
vegetation: { type: Boolean, default: void 0 },
|
|
247
|
+
viewMode: { type: String, default: "2d" },
|
|
239
248
|
theme: String,
|
|
249
|
+
timeOfDay: String,
|
|
240
250
|
themeBlend: Object,
|
|
241
251
|
themeTransition: Object,
|
|
242
252
|
zoom: Number
|
|
@@ -286,6 +296,7 @@ var TileflowMap = defineComponent({
|
|
|
286
296
|
let mapLifecycle = null;
|
|
287
297
|
let mapResizeObserver = null;
|
|
288
298
|
let mapWorldRequestBridge = null;
|
|
299
|
+
let vegetationController = null;
|
|
289
300
|
let themeController = null;
|
|
290
301
|
let unsubscribeSystemColorScheme = null;
|
|
291
302
|
let mapLoadId = 0;
|
|
@@ -375,7 +386,12 @@ var TileflowMap = defineComponent({
|
|
|
375
386
|
}
|
|
376
387
|
return {
|
|
377
388
|
error: false,
|
|
378
|
-
name: resolveTileflowRuntimeTheme(
|
|
389
|
+
name: resolveTileflowRuntimeTheme(
|
|
390
|
+
manifestMap.value,
|
|
391
|
+
selection,
|
|
392
|
+
systemColorScheme.value,
|
|
393
|
+
props.themeBlend ? void 0 : props.timeOfDay
|
|
394
|
+
).name
|
|
379
395
|
};
|
|
380
396
|
} catch {
|
|
381
397
|
return { error: true, name: void 0 };
|
|
@@ -557,6 +573,7 @@ var TileflowMap = defineComponent({
|
|
|
557
573
|
assertTileflowMapStyleInputs({
|
|
558
574
|
source: props.source,
|
|
559
575
|
theme: props.theme,
|
|
576
|
+
timeOfDay: props.timeOfDay,
|
|
560
577
|
themeBlend: props.themeBlend,
|
|
561
578
|
themeTransition: props.themeTransition
|
|
562
579
|
});
|
|
@@ -610,6 +627,13 @@ var TileflowMap = defineComponent({
|
|
|
610
627
|
imageResizeObserver.observe(element);
|
|
611
628
|
updateImageSize();
|
|
612
629
|
};
|
|
630
|
+
watch(
|
|
631
|
+
() => [props.vegetation, props.viewMode],
|
|
632
|
+
([visible, viewMode]) => {
|
|
633
|
+
vegetationController?.setVisible(visible);
|
|
634
|
+
vegetationController?.setViewMode(viewMode ?? "2d");
|
|
635
|
+
}
|
|
636
|
+
);
|
|
613
637
|
const destroyMap = () => {
|
|
614
638
|
mapLoadId += 1;
|
|
615
639
|
readinessRunId += 1;
|
|
@@ -619,6 +643,8 @@ var TileflowMap = defineComponent({
|
|
|
619
643
|
const resizeObserver = mapResizeObserver;
|
|
620
644
|
const map = mapRef.value;
|
|
621
645
|
const controller = themeController;
|
|
646
|
+
const vegetation = vegetationController;
|
|
647
|
+
vegetationController = null;
|
|
622
648
|
const annotationInteractionsForMap = annotationRuntime;
|
|
623
649
|
const semanticInteractionsForMap = semanticRuntime;
|
|
624
650
|
const worldRequestBridge = mapWorldRequestBridge;
|
|
@@ -636,6 +662,7 @@ var TileflowMap = defineComponent({
|
|
|
636
662
|
() => worldRequestBridge?.dispose(),
|
|
637
663
|
() => fairUseNotice?.dispose(),
|
|
638
664
|
() => lifecycle?.dispose(),
|
|
665
|
+
() => vegetation?.dispose(),
|
|
639
666
|
() => controller?.dispose(),
|
|
640
667
|
() => resizeObserver?.disconnect(),
|
|
641
668
|
() => map?.remove()
|
|
@@ -800,6 +827,21 @@ var TileflowMap = defineComponent({
|
|
|
800
827
|
}
|
|
801
828
|
}
|
|
802
829
|
});
|
|
830
|
+
vegetationController = createTileflowVegetation({
|
|
831
|
+
map,
|
|
832
|
+
...themeController ? { controller: themeController } : {},
|
|
833
|
+
visible: props.vegetation,
|
|
834
|
+
viewMode: props.viewMode ?? "2d",
|
|
835
|
+
transformRequest: createTileflowTransformRequest({
|
|
836
|
+
getAnalytics: () => resolvedAnalytics.value,
|
|
837
|
+
sessionController: session,
|
|
838
|
+
sessionId: session.sessionId,
|
|
839
|
+
transformRequest: (url) => props.mapOptions?.transformRequest?.(
|
|
840
|
+
url,
|
|
841
|
+
"Tile"
|
|
842
|
+
)
|
|
843
|
+
})
|
|
844
|
+
});
|
|
803
845
|
try {
|
|
804
846
|
const mapInteractions = createTileflowMapLibreDomRuntime({
|
|
805
847
|
createMarker({ annotation, element }) {
|
|
@@ -936,9 +978,10 @@ var TileflowMap = defineComponent({
|
|
|
936
978
|
const switchBlend = () => {
|
|
937
979
|
const themes = blendStyles.value;
|
|
938
980
|
const position = props.themeBlend?.position;
|
|
981
|
+
const hold = props.themeBlend?.hold === true;
|
|
939
982
|
if (!themeController || !themes || position === void 0) return;
|
|
940
983
|
if (runtimeStyle.value) activeRuntimeResource.value = runtimeStyle.value;
|
|
941
|
-
void themeController.setBlend({ position, themes }, { transition: props.themeTransition }).then((result) => {
|
|
984
|
+
void themeController.setBlend({ hold, position, themes }, { transition: props.themeTransition }).then((result) => {
|
|
942
985
|
if (result.status === "failed") {
|
|
943
986
|
console.error("Failed to blend the Tileflow map themes", result.error);
|
|
944
987
|
}
|
|
@@ -1045,7 +1088,7 @@ var TileflowMap = defineComponent({
|
|
|
1045
1088
|
{ flush: "post" }
|
|
1046
1089
|
);
|
|
1047
1090
|
watch(
|
|
1048
|
-
() => [blendStyles.value, props.themeBlend?.position],
|
|
1091
|
+
() => [blendStyles.value, props.themeBlend?.position, props.themeBlend?.hold === true],
|
|
1049
1092
|
() => switchBlend(),
|
|
1050
1093
|
{ flush: "post" }
|
|
1051
1094
|
);
|
|
@@ -1062,14 +1105,7 @@ var TileflowMap = defineComponent({
|
|
|
1062
1105
|
{ flush: "post" }
|
|
1063
1106
|
);
|
|
1064
1107
|
watch(
|
|
1065
|
-
() => [
|
|
1066
|
-
props.analytics,
|
|
1067
|
-
props.interactive,
|
|
1068
|
-
props.mapOptions,
|
|
1069
|
-
props.mode,
|
|
1070
|
-
props.source,
|
|
1071
|
-
manifestMap.value
|
|
1072
|
-
],
|
|
1108
|
+
() => [props.interactive, props.mapOptions, props.mode, props.source, manifestMap.value],
|
|
1073
1109
|
() => void recreateMap(),
|
|
1074
1110
|
{ flush: "post" }
|
|
1075
1111
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tileflow/vue",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.29",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Vue component for rendering Tileflow maps with MapLibre.",
|
|
6
6
|
"type": "module",
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@tileflow/core": ">=0.1.0-alpha.
|
|
42
|
-
"@tileflow/interactions": ">=0.1.0-alpha.
|
|
41
|
+
"@tileflow/core": ">=0.1.0-alpha.35 <0.1.0-beta.0",
|
|
42
|
+
"@tileflow/interactions": ">=0.1.0-alpha.5 <0.1.0-beta.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"maplibre-gl": ">=6.4.1 <7",
|
|
46
46
|
"vue": ">=3.3 <4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@vue/server-renderer": "3.5.
|
|
50
|
-
"maplibre-gl": "6.
|
|
51
|
-
"tsx": "^4.23.
|
|
52
|
-
"vue": "^3.5.
|
|
49
|
+
"@vue/server-renderer": "3.5.43",
|
|
50
|
+
"maplibre-gl": "6.13.0",
|
|
51
|
+
"tsx": "^4.23.15",
|
|
52
|
+
"vue": "^3.5.43"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsup src/index.ts --format esm --dts --clean --external vue --external maplibre-gl",
|