@tileflow/svelte 0.1.0-alpha.20 → 0.1.0-alpha.21
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 +8 -5
- package/package.json +3 -3
- package/src/TileflowMap.svelte +7 -34
- package/src/index.d.ts +5 -16
package/README.md
CHANGED
|
@@ -65,8 +65,11 @@ or evaluating MapLibre. All environments follow the same published manifest cont
|
|
|
65
65
|
Hosted maps automatically preflight a short-lived commercial session grant before eligible
|
|
66
66
|
resources. Setting `analytics={{enabled: false}}` disables the optional beacon only; it does not
|
|
67
67
|
remove hosted authorization or override a user `mapOptions.transformRequest` callback.
|
|
68
|
+
Use `analytics={{surfaceId: 'store-locator'}}` when the same Map is embedded in several stable
|
|
69
|
+
product locations. Missing or invalid Surface IDs become `default`; do not use URLs, branches,
|
|
70
|
+
random instance IDs, or user IDs.
|
|
68
71
|
Direct Tileflow World maps keep early `GRACE` silent, show a compact accessible owner-action pill
|
|
69
|
-
when late `GRACE` is activated, and show a stronger banner in `
|
|
72
|
+
when late `GRACE` is activated, and show a stronger banner in `MANAGED_REQUIRED`. Missing tiles and
|
|
70
73
|
MapLibre failures do not remove that recovery path.
|
|
71
74
|
|
|
72
75
|
## Annotations and overlays
|
|
@@ -145,8 +148,8 @@ owned by the shared MapLibre interaction runtime.
|
|
|
145
148
|
/>
|
|
146
149
|
```
|
|
147
150
|
|
|
148
|
-
`annotations`
|
|
149
|
-
`
|
|
151
|
+
`annotations` is the only application-owned marker input. Controlled `interactionState` and
|
|
152
|
+
uncontrolled `defaultInteractionState` are mutually exclusive. `interactions` binds tooltips and
|
|
150
153
|
popups to semantic POIs exposed by the compiled style metadata; applications select the stable
|
|
151
154
|
`poi` domain and optional categories rather than physical style-layer IDs.
|
|
152
155
|
|
|
@@ -161,8 +164,8 @@ with a POI popup (or the reverse) closes the previous owner before opening the n
|
|
|
161
164
|
order remains `popup:close` followed by `popup:open`.
|
|
162
165
|
|
|
163
166
|
Annotations and semantic interactions are interactive-only. The TypeScript API excludes
|
|
164
|
-
annotations,
|
|
165
|
-
|
|
167
|
+
annotations, interactions, interaction state, snippets, and interaction callbacks from the
|
|
168
|
+
`mode="image"` branch. Untyped JavaScript that supplies them still receives an
|
|
166
169
|
`UNSUPPORTED_MODE` diagnostic and capture readiness `error`, rather than pretending the static image
|
|
167
170
|
contains live overlays.
|
|
168
171
|
|
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.21",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Svelte component for rendering Tileflow maps with MapLibre.",
|
|
6
6
|
"type": "module",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@tileflow/core": ">=0.1.0-alpha.
|
|
51
|
-
"@tileflow/interactions": ">=0.1.0-alpha.
|
|
50
|
+
"@tileflow/core": ">=0.1.0-alpha.22 <0.1.0-beta.0",
|
|
51
|
+
"@tileflow/interactions": ">=0.1.0-alpha.1 <0.1.0-beta.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"maplibre-gl": ">=5 <7",
|
package/src/TileflowMap.svelte
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
resolveTileflowRuntimeView,
|
|
25
25
|
resolveTileflowStaticImageUrl,
|
|
26
26
|
shouldLoadTileflowManifest,
|
|
27
|
-
type TileflowMapMarker,
|
|
28
27
|
type TileflowRuntimeManifestMap,
|
|
29
28
|
} from '@tileflow/core/runtime';
|
|
30
29
|
import {
|
|
@@ -36,6 +35,7 @@
|
|
|
36
35
|
getTileflowSystemColorScheme,
|
|
37
36
|
loadTileflowStyleFonts,
|
|
38
37
|
registerTileflowContourProtocol,
|
|
38
|
+
registerTileflowPmtilesProtocol,
|
|
39
39
|
registerTileflowWorldRequestBridge,
|
|
40
40
|
subscribeTileflowSystemColorScheme,
|
|
41
41
|
type TileflowFairUseNoticeController,
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
createTileflowMapLibreDomRuntime,
|
|
62
62
|
createTileflowMapLibreInteractionCoordinator,
|
|
63
63
|
createTileflowMapLibreSemanticDomRuntime,
|
|
64
|
-
normalizeTileflowLegacyMarkers,
|
|
65
64
|
type TileflowMapLibreDomRenderTarget,
|
|
66
65
|
type TileflowMapLibreDomRuntime,
|
|
67
66
|
type TileflowMapLibreInteractionCoordinator,
|
|
@@ -89,7 +88,6 @@
|
|
|
89
88
|
export let interactionState: TileflowMapProps['interactionState'] = undefined;
|
|
90
89
|
export let mapOptions: TileflowMapProps['mapOptions'] = undefined;
|
|
91
90
|
export let marker: TileflowMapProps['marker'] = undefined;
|
|
92
|
-
export let markers: TileflowMapProps['markers'] = undefined;
|
|
93
91
|
export let mode: NonNullable<TileflowMapProps['mode']> = 'interactive';
|
|
94
92
|
export let onInteractionDiagnostic: TileflowMapProps['onInteractionDiagnostic'] = undefined;
|
|
95
93
|
export let onInteractionEvent: TileflowMapProps['onInteractionEvent'] = undefined;
|
|
@@ -137,7 +135,6 @@
|
|
|
137
135
|
let interactionReadinessTargetKeys: readonly string[] = [];
|
|
138
136
|
let hadInteractionErrors = false;
|
|
139
137
|
let interactionRuntimesDisposing = false;
|
|
140
|
-
let legacyTitles: ReadonlyMap<string, string> = new Map();
|
|
141
138
|
let mapResizeObserver: ResizeObserver | null = null;
|
|
142
139
|
let mapWorldRequestBridge: TileflowWorldRequestBridge | null = null;
|
|
143
140
|
let themeController: TileflowThemeController | null = null;
|
|
@@ -248,7 +245,7 @@
|
|
|
248
245
|
? mapCaptureState
|
|
249
246
|
: 'loading';
|
|
250
247
|
$: frameStyle = `height: ${formatHeight(height)}; min-height: 240px; overflow: hidden; position: relative; width: 100%;`;
|
|
251
|
-
$: annotationResolution = resolveAnnotationInput(annotations
|
|
248
|
+
$: annotationResolution = resolveAnnotationInput(annotations);
|
|
252
249
|
$: interactionBindingResolution = resolveInteractionBindingInput(interactions);
|
|
253
250
|
$: interactionStateDiagnostics = validateInteractionStateInput(
|
|
254
251
|
interactionState,
|
|
@@ -256,7 +253,6 @@
|
|
|
256
253
|
);
|
|
257
254
|
$: hasInteractionConfiguration =
|
|
258
255
|
annotations !== undefined ||
|
|
259
|
-
markers !== undefined ||
|
|
260
256
|
interactions !== undefined ||
|
|
261
257
|
interactionState !== undefined ||
|
|
262
258
|
defaultInteractionState !== undefined ||
|
|
@@ -331,7 +327,6 @@
|
|
|
331
327
|
|
|
332
328
|
$: if (mounted) {
|
|
333
329
|
annotations;
|
|
334
|
-
markers;
|
|
335
330
|
syncAnnotations();
|
|
336
331
|
}
|
|
337
332
|
|
|
@@ -577,6 +572,7 @@
|
|
|
577
572
|
});
|
|
578
573
|
mapFairUseNotice = attachTileflowFairUseNotice(targetContainer);
|
|
579
574
|
registerTileflowContourProtocol({addProtocol: maplibregl.addProtocol});
|
|
575
|
+
registerTileflowPmtilesProtocol({addProtocol: maplibregl.addProtocol});
|
|
580
576
|
mapWorldRequestBridge = registerTileflowWorldRequestBridge({
|
|
581
577
|
addProtocol: maplibregl.addProtocol,
|
|
582
578
|
onNotice: mapFairUseNotice.update,
|
|
@@ -630,7 +626,7 @@
|
|
|
630
626
|
TileflowAnnotation
|
|
631
627
|
>({
|
|
632
628
|
createMarker({annotation, element}) {
|
|
633
|
-
element.title =
|
|
629
|
+
element.title = annotation.ariaLabel;
|
|
634
630
|
return new maplibregl.Marker({element});
|
|
635
631
|
},
|
|
636
632
|
createOverlay({container: overlayContainer, kind}) {
|
|
@@ -650,7 +646,7 @@
|
|
|
650
646
|
map: maplibreMap,
|
|
651
647
|
onInteractionStateChange: interactionCoordinator.requestInteractionState,
|
|
652
648
|
updateMarker(_markerInstance, {annotation, element}) {
|
|
653
|
-
element.title =
|
|
649
|
+
element.title = annotation.ariaLabel;
|
|
654
650
|
},
|
|
655
651
|
});
|
|
656
652
|
annotationRuntime = annotationInteractionsForMap;
|
|
@@ -823,7 +819,6 @@
|
|
|
823
819
|
}
|
|
824
820
|
|
|
825
821
|
function syncAnnotations() {
|
|
826
|
-
legacyTitles = annotationResolution.titles;
|
|
827
822
|
if (!annotationRuntime) return;
|
|
828
823
|
|
|
829
824
|
try {
|
|
@@ -942,7 +937,6 @@
|
|
|
942
937
|
annotations: readonly TileflowAnnotation[];
|
|
943
938
|
diagnostics: readonly TileflowInteractionDiagnostic[];
|
|
944
939
|
ok: boolean;
|
|
945
|
-
titles: ReadonlyMap<string, string>;
|
|
946
940
|
}>;
|
|
947
941
|
|
|
948
942
|
type InteractionBindingResolution = Readonly<{
|
|
@@ -953,39 +947,18 @@
|
|
|
953
947
|
|
|
954
948
|
function resolveAnnotationInput(
|
|
955
949
|
nextAnnotations: readonly TileflowAnnotation[] | undefined,
|
|
956
|
-
nextMarkers: readonly TileflowMapMarker[] | undefined,
|
|
957
950
|
): AnnotationResolution {
|
|
958
|
-
|
|
959
|
-
return {
|
|
960
|
-
annotations: [],
|
|
961
|
-
diagnostics: [
|
|
962
|
-
createInteractionDiagnostic(
|
|
963
|
-
'INVALID_DOCUMENT',
|
|
964
|
-
'The annotations and legacy markers props are mutually exclusive.',
|
|
965
|
-
),
|
|
966
|
-
],
|
|
967
|
-
ok: false,
|
|
968
|
-
titles: new Map(),
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
const normalized = normalizeTileflowLegacyMarkers(nextMarkers ?? []);
|
|
973
|
-
const candidates = nextAnnotations ?? normalized.annotations;
|
|
974
|
-
const titles =
|
|
975
|
-
nextAnnotations === undefined
|
|
976
|
-
? normalized.titles
|
|
977
|
-
: new Map(nextAnnotations.map((annotation) => [annotation.id, annotation.ariaLabel]));
|
|
951
|
+
const candidates = nextAnnotations ?? [];
|
|
978
952
|
const validation = validateTileflowAnnotations(candidates);
|
|
979
953
|
if (!validation.ok) {
|
|
980
954
|
return {
|
|
981
955
|
annotations: [],
|
|
982
956
|
diagnostics: validation.diagnostics,
|
|
983
957
|
ok: false,
|
|
984
|
-
titles,
|
|
985
958
|
};
|
|
986
959
|
}
|
|
987
960
|
|
|
988
|
-
return {annotations: candidates, diagnostics: [], ok: true
|
|
961
|
+
return {annotations: candidates, diagnostics: [], ok: true};
|
|
989
962
|
}
|
|
990
963
|
|
|
991
964
|
function resolveInteractionBindingInput(
|
package/src/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type {Snippet, SvelteComponentTyped} from 'svelte';
|
|
|
3
3
|
import type {TileflowThemeTransition} from '@tileflow/core/browser';
|
|
4
4
|
import type {
|
|
5
5
|
TileflowAnalytics,
|
|
6
|
-
TileflowMapMarker,
|
|
7
6
|
TileflowRuntimeSource,
|
|
8
7
|
TileflowThemeSelection,
|
|
9
8
|
} from '@tileflow/core/runtime';
|
|
@@ -21,12 +20,9 @@ export type TileflowMapMode = 'interactive' | 'image';
|
|
|
21
20
|
export type TileflowMapOptions = Omit<MapLibreMapOptions, 'container' | 'style'>;
|
|
22
21
|
export type TileflowMapSource = TileflowRuntimeSource;
|
|
23
22
|
|
|
24
|
-
export type TileflowMapMarkerSnippet<TAnnotation extends TileflowAnnotation = TileflowAnnotation> =
|
|
25
|
-
Snippet<[context: TileflowAnnotationViewContext<TAnnotation>]>;
|
|
26
|
-
|
|
27
23
|
export type TileflowMapAnnotationSnippet<
|
|
28
24
|
TAnnotation extends TileflowAnnotation = TileflowAnnotation,
|
|
29
|
-
> =
|
|
25
|
+
> = Snippet<[context: TileflowAnnotationViewContext<TAnnotation>]>;
|
|
30
26
|
|
|
31
27
|
export type TileflowMapInteractionSnippet<
|
|
32
28
|
TAnnotation extends TileflowAnnotation = TileflowAnnotation,
|
|
@@ -50,15 +46,9 @@ type TileflowMapBaseProps = {
|
|
|
50
46
|
|
|
51
47
|
export type TileflowMapAnnotationProps<
|
|
52
48
|
TAnnotation extends TileflowAnnotation = TileflowAnnotation,
|
|
53
|
-
> =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
markers?: never;
|
|
57
|
-
}
|
|
58
|
-
| {
|
|
59
|
-
annotations?: never;
|
|
60
|
-
markers?: readonly TileflowMapMarker[];
|
|
61
|
-
};
|
|
49
|
+
> = {
|
|
50
|
+
annotations?: readonly TAnnotation[];
|
|
51
|
+
};
|
|
62
52
|
|
|
63
53
|
export type TileflowMapInteractionStateProps =
|
|
64
54
|
| {
|
|
@@ -78,7 +68,7 @@ type TileflowMapInteractiveProps<TAnnotation extends TileflowAnnotation> =
|
|
|
78
68
|
TileflowMapAnnotationProps<TAnnotation> &
|
|
79
69
|
TileflowMapInteractionStateProps & {
|
|
80
70
|
interactions?: readonly TileflowInteractionBinding[];
|
|
81
|
-
marker?:
|
|
71
|
+
marker?: TileflowMapAnnotationSnippet<TAnnotation>;
|
|
82
72
|
mode?: 'interactive';
|
|
83
73
|
onInteractionDiagnostic?: (diagnostic: TileflowInteractionDiagnostic) => void;
|
|
84
74
|
onInteractionEvent?: (event: TileflowInteractionEvent<TAnnotation>) => void;
|
|
@@ -93,7 +83,6 @@ type TileflowMapImageProps = {
|
|
|
93
83
|
interactions?: never;
|
|
94
84
|
interactionState?: never;
|
|
95
85
|
marker?: never;
|
|
96
|
-
markers?: never;
|
|
97
86
|
mode: 'image';
|
|
98
87
|
onInteractionDiagnostic?: never;
|
|
99
88
|
onInteractionEvent?: never;
|