@tileflow/vue 0.1.0-alpha.28 → 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 +6 -2
- package/dist/index.js +41 -1
- package/package.json +4 -4
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,12 +1,14 @@
|
|
|
1
1
|
import { MapOptions, Map } from 'maplibre-gl';
|
|
2
2
|
import { DefineComponent, VNodeChild } from 'vue';
|
|
3
|
-
import { TileflowBrowserThemeBlendSelection, TileflowThemeTransitionOptions, TileflowThemeTransition } from '@tileflow/core/browser';
|
|
4
|
-
import { TileflowRuntimeSource, TileflowThemeSelection, TileflowAnalytics } from '@tileflow/core/runtime';
|
|
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
14
|
* map at once; changing `themes` prepares a new blend. `hold` keeps labels, icons, and mixed
|
|
@@ -34,6 +36,8 @@ type TileflowMapSlots<TAnnotation extends TileflowAnnotation = TileflowAnnotatio
|
|
|
34
36
|
tooltip?: (context: TileflowMapInteractionSlotContext<TAnnotation>) => VNodeChild;
|
|
35
37
|
};
|
|
36
38
|
type TileflowMapSharedProps = {
|
|
39
|
+
vegetation?: boolean;
|
|
40
|
+
viewMode?: TileflowViewMode;
|
|
37
41
|
alt?: string;
|
|
38
42
|
analytics?: TileflowAnalytics;
|
|
39
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,
|
|
@@ -163,6 +164,7 @@ import {
|
|
|
163
164
|
validateTileflowBrowserThemeBlendSelection
|
|
164
165
|
} from "@tileflow/core/browser";
|
|
165
166
|
import {
|
|
167
|
+
isTileflowTimeOfDay,
|
|
166
168
|
validateTileflowRuntimeSource,
|
|
167
169
|
validateTileflowThemeSelection
|
|
168
170
|
} from "@tileflow/core/runtime";
|
|
@@ -172,6 +174,9 @@ function validateTileflowMapStyleInputs(input) {
|
|
|
172
174
|
if (input.theme !== void 0 && !validateTileflowThemeSelection(input.theme)) {
|
|
173
175
|
return { error: 'theme must be a concrete portable theme name or "system"', ok: false };
|
|
174
176
|
}
|
|
177
|
+
if (input.timeOfDay !== void 0 && !isTileflowTimeOfDay(input.timeOfDay)) {
|
|
178
|
+
return { error: "timeOfDay must be day, dawn, dusk, or night", ok: false };
|
|
179
|
+
}
|
|
175
180
|
if (input.themeBlend !== void 0 && !validateTileflowBrowserThemeBlendSelection(input.themeBlend)) {
|
|
176
181
|
return {
|
|
177
182
|
error: "themeBlend must name two to eight concrete themes, a position from 0 to themes.length - 1, and an optional boolean hold",
|
|
@@ -238,7 +243,10 @@ var TileflowMap = defineComponent({
|
|
|
238
243
|
required: true,
|
|
239
244
|
type: Object
|
|
240
245
|
},
|
|
246
|
+
vegetation: { type: Boolean, default: void 0 },
|
|
247
|
+
viewMode: { type: String, default: "2d" },
|
|
241
248
|
theme: String,
|
|
249
|
+
timeOfDay: String,
|
|
242
250
|
themeBlend: Object,
|
|
243
251
|
themeTransition: Object,
|
|
244
252
|
zoom: Number
|
|
@@ -288,6 +296,7 @@ var TileflowMap = defineComponent({
|
|
|
288
296
|
let mapLifecycle = null;
|
|
289
297
|
let mapResizeObserver = null;
|
|
290
298
|
let mapWorldRequestBridge = null;
|
|
299
|
+
let vegetationController = null;
|
|
291
300
|
let themeController = null;
|
|
292
301
|
let unsubscribeSystemColorScheme = null;
|
|
293
302
|
let mapLoadId = 0;
|
|
@@ -377,7 +386,12 @@ var TileflowMap = defineComponent({
|
|
|
377
386
|
}
|
|
378
387
|
return {
|
|
379
388
|
error: false,
|
|
380
|
-
name: resolveTileflowRuntimeTheme(
|
|
389
|
+
name: resolveTileflowRuntimeTheme(
|
|
390
|
+
manifestMap.value,
|
|
391
|
+
selection,
|
|
392
|
+
systemColorScheme.value,
|
|
393
|
+
props.themeBlend ? void 0 : props.timeOfDay
|
|
394
|
+
).name
|
|
381
395
|
};
|
|
382
396
|
} catch {
|
|
383
397
|
return { error: true, name: void 0 };
|
|
@@ -559,6 +573,7 @@ var TileflowMap = defineComponent({
|
|
|
559
573
|
assertTileflowMapStyleInputs({
|
|
560
574
|
source: props.source,
|
|
561
575
|
theme: props.theme,
|
|
576
|
+
timeOfDay: props.timeOfDay,
|
|
562
577
|
themeBlend: props.themeBlend,
|
|
563
578
|
themeTransition: props.themeTransition
|
|
564
579
|
});
|
|
@@ -612,6 +627,13 @@ var TileflowMap = defineComponent({
|
|
|
612
627
|
imageResizeObserver.observe(element);
|
|
613
628
|
updateImageSize();
|
|
614
629
|
};
|
|
630
|
+
watch(
|
|
631
|
+
() => [props.vegetation, props.viewMode],
|
|
632
|
+
([visible, viewMode]) => {
|
|
633
|
+
vegetationController?.setVisible(visible);
|
|
634
|
+
vegetationController?.setViewMode(viewMode ?? "2d");
|
|
635
|
+
}
|
|
636
|
+
);
|
|
615
637
|
const destroyMap = () => {
|
|
616
638
|
mapLoadId += 1;
|
|
617
639
|
readinessRunId += 1;
|
|
@@ -621,6 +643,8 @@ var TileflowMap = defineComponent({
|
|
|
621
643
|
const resizeObserver = mapResizeObserver;
|
|
622
644
|
const map = mapRef.value;
|
|
623
645
|
const controller = themeController;
|
|
646
|
+
const vegetation = vegetationController;
|
|
647
|
+
vegetationController = null;
|
|
624
648
|
const annotationInteractionsForMap = annotationRuntime;
|
|
625
649
|
const semanticInteractionsForMap = semanticRuntime;
|
|
626
650
|
const worldRequestBridge = mapWorldRequestBridge;
|
|
@@ -638,6 +662,7 @@ var TileflowMap = defineComponent({
|
|
|
638
662
|
() => worldRequestBridge?.dispose(),
|
|
639
663
|
() => fairUseNotice?.dispose(),
|
|
640
664
|
() => lifecycle?.dispose(),
|
|
665
|
+
() => vegetation?.dispose(),
|
|
641
666
|
() => controller?.dispose(),
|
|
642
667
|
() => resizeObserver?.disconnect(),
|
|
643
668
|
() => map?.remove()
|
|
@@ -802,6 +827,21 @@ var TileflowMap = defineComponent({
|
|
|
802
827
|
}
|
|
803
828
|
}
|
|
804
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
|
+
});
|
|
805
845
|
try {
|
|
806
846
|
const mapInteractions = createTileflowMapLibreDomRuntime({
|
|
807
847
|
createMarker({ annotation, element }) {
|
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,8 +38,8 @@
|
|
|
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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@vue/server-renderer": "3.5.43",
|
|
50
50
|
"maplibre-gl": "6.13.0",
|
|
51
|
-
"tsx": "^4.23.
|
|
51
|
+
"tsx": "^4.23.15",
|
|
52
52
|
"vue": "^3.5.43"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|