@tileflow/react 0.1.0-alpha.20 → 0.1.0-alpha.22
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 +20 -9
- package/dist/index.d.ts +4 -12
- package/dist/index.js +8 -24
- package/dist/static.d.ts +1 -1
- package/dist/static.js +5 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -133,10 +133,9 @@ last valid runtime state active and reports structured diagnostics. `interaction
|
|
|
133
133
|
`defaultInteractionState` are mutually exclusive. Annotation and semantic overlays share one popup
|
|
134
134
|
state, so replacing either target closes the previous popup before opening the next.
|
|
135
135
|
|
|
136
|
-
`MapProps`
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
widened inputs still receive the corresponding runtime diagnostics.
|
|
136
|
+
`MapProps` rejects controlled and default interaction state together. Its `mode="image"` branch
|
|
137
|
+
excludes annotations, semantic bindings, interaction state, renderers, and interaction callbacks.
|
|
138
|
+
JavaScript callers and widened inputs still receive the corresponding runtime diagnostics.
|
|
140
139
|
|
|
141
140
|
`onInteractionDiagnostic` receives each newly reported structured runtime diagnostic. Changing any
|
|
142
141
|
callback identity does not resubscribe the runtime or recreate MapLibre.
|
|
@@ -149,10 +148,10 @@ defaults. A `view` descriptor is a dispatch name for an application renderer; it
|
|
|
149
148
|
serialized component tree. Tooltip content remains non-interactive, while popup content may contain
|
|
150
149
|
normal React controls.
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
`annotations` is the only application-owned marker input. Its singular `coordinate`, required
|
|
152
|
+
`ariaLabel`, and optional `marker` descriptor feed the keyed runtime directly. `mode="image"`
|
|
153
|
+
cannot render interaction configuration and shows an explicit `UNSUPPORTED_MODE` diagnostic
|
|
154
|
+
without loading MapLibre.
|
|
156
155
|
|
|
157
156
|
`mapOptions` accepts native MapLibre options except `container` and `style`, which
|
|
158
157
|
Tileflow resolves from `source`. Direct
|
|
@@ -231,9 +230,13 @@ export function Preview() {
|
|
|
231
230
|
<StaticMap
|
|
232
231
|
map="madrid"
|
|
233
232
|
camera={{type: 'center', center: [-3.7038, 40.4168], zoom: 12}}
|
|
233
|
+
attribution={{mode: 'external'}}
|
|
234
234
|
size={{width: 1200, height: 800}}
|
|
235
235
|
createUrl="/api/static-maps"
|
|
236
236
|
idempotencyKey={idempotencyKey}
|
|
237
|
+
onReady={(result) => {
|
|
238
|
+
if (result.resultVersion === 2) showAttribution(result.attribution.entries);
|
|
239
|
+
}}
|
|
237
240
|
/>
|
|
238
241
|
);
|
|
239
242
|
}
|
|
@@ -244,11 +247,19 @@ reuse it across retries and remounts. Concurrent React consumers share work only
|
|
|
244
247
|
normalized scene, and idempotency key all identify the same operation; unmounting the final
|
|
245
248
|
consumer aborts its in-flight request.
|
|
246
249
|
|
|
250
|
+
`StaticMap` forwards `attribution` as part of the normalized scene and request identity. Omission
|
|
251
|
+
uses embedded automatic placement. With `mode: 'external'`, the component still renders the image,
|
|
252
|
+
but the application must render every structured `onReady` attribution entry beside it. Existing
|
|
253
|
+
`imageUrl` mode has no operation result and cannot infer attribution from an immutable image URL.
|
|
254
|
+
|
|
247
255
|
Hosted interactive maps automatically preflight a short-lived commercial session grant before
|
|
248
256
|
eligible resources. Setting `analytics={{enabled: false}}` disables the optional beacon only; it
|
|
249
257
|
does not remove hosted authorization or override a user `mapOptions.transformRequest` callback.
|
|
258
|
+
Use `analytics={{surfaceId: 'store-locator'}}` when the same Map is embedded in several stable
|
|
259
|
+
product locations. Missing or invalid Surface IDs become `default`; do not use URLs, branches,
|
|
260
|
+
random instance IDs, or user IDs.
|
|
250
261
|
Direct Tileflow World maps keep early `GRACE` silent, show a compact accessible owner-action pill
|
|
251
|
-
when late `GRACE` is activated, and show a stronger banner in `
|
|
262
|
+
when late `GRACE` is activated, and show a stronger banner in `MANAGED_REQUIRED`. Missing tiles and
|
|
252
263
|
MapLibre failures do not remove that recovery path.
|
|
253
264
|
|
|
254
265
|
## Headless capture readiness
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { CSSProperties, ImgHTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
import { MapOptions, Map as Map$1 } from 'maplibre-gl';
|
|
4
4
|
import { TileflowThemeTransition } from '@tileflow/core/browser';
|
|
5
|
-
import { TileflowRuntimeSource, TileflowThemeSelection, TileflowAnalytics
|
|
5
|
+
import { TileflowRuntimeSource, TileflowThemeSelection, TileflowAnalytics } from '@tileflow/core/runtime';
|
|
6
6
|
import { TileflowAnnotation, TileflowInteractionState, TileflowAnnotationViewContext, TileflowInteractionBinding, TileflowInteractionViewContext, TileflowInteractionDiagnostic, TileflowInteractionEvent } from '@tileflow/interactions';
|
|
7
7
|
|
|
8
8
|
type TileflowMapStyleSourceProps = {
|
|
@@ -10,7 +10,6 @@ type TileflowMapStyleSourceProps = {
|
|
|
10
10
|
theme?: TileflowThemeSelection;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
type MapMarker = TileflowMapMarker;
|
|
14
13
|
type TileflowMapSource = TileflowRuntimeSource;
|
|
15
14
|
type TileflowMapOptions = Omit<MapOptions, 'container' | 'style'>;
|
|
16
15
|
type TileflowAnnotationRenderer<TAnnotation extends TileflowAnnotation = TileflowAnnotation> = (context: TileflowAnnotationViewContext<TAnnotation>) => ReactNode;
|
|
@@ -30,13 +29,6 @@ type MapSharedProps = {
|
|
|
30
29
|
onLoad?: (map: Map$1) => void;
|
|
31
30
|
onThemeChange?: (transition: TileflowThemeTransition) => void;
|
|
32
31
|
};
|
|
33
|
-
type TileflowAnnotationInputProps<TAnnotation extends TileflowAnnotation> = Readonly<{
|
|
34
|
-
annotations?: readonly TAnnotation[];
|
|
35
|
-
markers?: never;
|
|
36
|
-
}> | Readonly<{
|
|
37
|
-
annotations?: never;
|
|
38
|
-
markers?: readonly MapMarker[];
|
|
39
|
-
}>;
|
|
40
32
|
type TileflowInteractionStateInputProps = Readonly<{
|
|
41
33
|
defaultInteractionState?: never;
|
|
42
34
|
interactionState?: TileflowInteractionState;
|
|
@@ -53,7 +45,8 @@ type TileflowInteractionRendererProps<TAnnotation extends TileflowAnnotation> =
|
|
|
53
45
|
renderPopup?: TileflowInteractionRenderer<TAnnotation>;
|
|
54
46
|
renderTooltip?: TileflowInteractionRenderer<TAnnotation>;
|
|
55
47
|
}>;
|
|
56
|
-
type MapInteractiveProps<TAnnotation extends TileflowAnnotation> = MapSharedProps &
|
|
48
|
+
type MapInteractiveProps<TAnnotation extends TileflowAnnotation> = MapSharedProps & TileflowInteractionStateInputProps & TileflowInteractionRendererProps<TAnnotation> & {
|
|
49
|
+
annotations?: readonly TAnnotation[];
|
|
57
50
|
mode?: 'interactive';
|
|
58
51
|
onInteractionDiagnostic?: (diagnostic: TileflowInteractionDiagnostic) => void;
|
|
59
52
|
onInteractionEvent?: (event: TileflowInteractionEvent<TAnnotation>) => void;
|
|
@@ -65,7 +58,6 @@ type MapImageProps = MapSharedProps & {
|
|
|
65
58
|
defaultInteractionState?: never;
|
|
66
59
|
interactionState?: never;
|
|
67
60
|
interactions?: never;
|
|
68
|
-
markers?: never;
|
|
69
61
|
mode: 'image';
|
|
70
62
|
onInteractionDiagnostic?: never;
|
|
71
63
|
onInteractionEvent?: never;
|
|
@@ -77,4 +69,4 @@ type MapImageProps = MapSharedProps & {
|
|
|
77
69
|
type MapProps<TAnnotation extends TileflowAnnotation = TileflowAnnotation> = (MapInteractiveProps<TAnnotation> | MapImageProps) & TileflowMapStyleSourceProps;
|
|
78
70
|
declare function Map<TAnnotation extends TileflowAnnotation = TileflowAnnotation>(props: MapProps<TAnnotation>): react.JSX.Element;
|
|
79
71
|
|
|
80
|
-
export { Map, type
|
|
72
|
+
export { Map, type MapProps, type TileflowAnnotationRenderer, type TileflowInteractionRenderer, type TileflowMapOptions, type TileflowMapSource };
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
getTileflowSystemColorScheme,
|
|
20
20
|
loadTileflowStyleFonts,
|
|
21
21
|
registerTileflowContourProtocol,
|
|
22
|
+
registerTileflowPmtilesProtocol,
|
|
22
23
|
registerTileflowWorldRequestBridge,
|
|
23
24
|
subscribeTileflowSystemColorScheme
|
|
24
25
|
} from "@tileflow/core/browser";
|
|
@@ -49,26 +50,9 @@ import {
|
|
|
49
50
|
import {
|
|
50
51
|
validateTileflowAnnotations
|
|
51
52
|
} from "@tileflow/interactions";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
annotations: [],
|
|
57
|
-
diagnostics: [
|
|
58
|
-
{
|
|
59
|
-
code: "INVALID_DOCUMENT",
|
|
60
|
-
level: "error",
|
|
61
|
-
message: "Tileflow Map accepts annotations or legacy markers, not both.",
|
|
62
|
-
path: ""
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
ok: false,
|
|
66
|
-
titles: /* @__PURE__ */ new Map()
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const normalized = normalizeTileflowLegacyMarkers(markers ?? []);
|
|
70
|
-
const candidates = annotations ?? normalized.annotations;
|
|
71
|
-
const titles = annotations === void 0 ? normalized.titles : new Map(annotations.map((annotation) => [annotation.id, annotation.ariaLabel]));
|
|
53
|
+
function prepareTileflowReactAnnotations(annotations) {
|
|
54
|
+
const candidates = annotations ?? [];
|
|
55
|
+
const titles = new Map(candidates.map((annotation) => [annotation.id, annotation.ariaLabel]));
|
|
72
56
|
const validation = validateTileflowAnnotations(candidates);
|
|
73
57
|
if (!validation.ok) {
|
|
74
58
|
return {
|
|
@@ -237,7 +221,6 @@ function Map2(props) {
|
|
|
237
221
|
imageLoading = "eager",
|
|
238
222
|
interactive,
|
|
239
223
|
mapOptions,
|
|
240
|
-
markers,
|
|
241
224
|
analytics,
|
|
242
225
|
theme,
|
|
243
226
|
interactionState,
|
|
@@ -263,8 +246,8 @@ function Map2(props) {
|
|
|
263
246
|
const mapName = runtimeSource.kind === "tileflow" ? runtimeSource.map : void 0;
|
|
264
247
|
const manifestUrl = runtimeSource.kind === "tileflow" ? runtimeSource.manifestUrl ?? defaultTileflowManifestUrl : defaultTileflowManifestUrl;
|
|
265
248
|
const preparedAnnotations = useMemo(
|
|
266
|
-
() => prepareTileflowReactAnnotations(annotations
|
|
267
|
-
[annotations
|
|
249
|
+
() => prepareTileflowReactAnnotations(annotations),
|
|
250
|
+
[annotations]
|
|
268
251
|
);
|
|
269
252
|
const preparedInteractions = useMemo(
|
|
270
253
|
() => prepareTileflowReactInteractionBindings(interactions),
|
|
@@ -377,7 +360,7 @@ function Map2(props) {
|
|
|
377
360
|
const mapNameRef = useRef(mapName);
|
|
378
361
|
const resolvedAnalyticsRef = useRef(void 0);
|
|
379
362
|
const readinessRunRef = useRef(0);
|
|
380
|
-
const hasAdditionalInteractionConfiguration = annotations !== void 0 || defaultInteractionState !== void 0 || interactionState !== void 0 ||
|
|
363
|
+
const hasAdditionalInteractionConfiguration = annotations !== void 0 || defaultInteractionState !== void 0 || interactionState !== void 0 || onInteractionDiagnostic !== void 0 || onInteractionEvent !== void 0 || onInteractionStateChange !== void 0 || renderMarker !== void 0 || renderPopup !== void 0 || renderTooltip !== void 0 || props.interactions !== void 0;
|
|
381
364
|
const modeDiagnostic = useMemo(
|
|
382
365
|
() => isImageMode ? imageModeMapInteractionDiagnostic(
|
|
383
366
|
preparedAnnotations.annotations.length,
|
|
@@ -706,6 +689,7 @@ function Map2(props) {
|
|
|
706
689
|
const fairUseNotice = attachTileflowFairUseNotice(container);
|
|
707
690
|
registerCleanup(() => fairUseNotice.dispose());
|
|
708
691
|
registerTileflowContourProtocol({ addProtocol: maplibregl.addProtocol });
|
|
692
|
+
registerTileflowPmtilesProtocol({ addProtocol: maplibregl.addProtocol });
|
|
709
693
|
const worldRequestBridge = registerTileflowWorldRequestBridge({
|
|
710
694
|
addProtocol: maplibregl.addProtocol,
|
|
711
695
|
onNotice: fairUseNotice.update
|
package/dist/static.d.ts
CHANGED
|
@@ -26,6 +26,6 @@ type StaticMapCreateProps = {
|
|
|
26
26
|
imageUrl?: never;
|
|
27
27
|
};
|
|
28
28
|
type StaticMapProps = StaticMapBaseProps & (StaticMapCreateProps | StaticMapImageProps);
|
|
29
|
-
declare function StaticMap({ alt, camera, className, captureId, createUrl, imageStyle, imageUrl, idempotencyKey, keepPreviousImage, loading, map, onError, onImageLoad, onReady, overlays, size, style, theme, }: StaticMapProps): react.JSX.Element;
|
|
29
|
+
declare function StaticMap({ alt, attribution, camera, className, captureId, createUrl, format, imageStyle, imageUrl, idempotencyKey, keepPreviousImage, loading, map, onError, onImageLoad, onReady, overlays, size, style, theme, }: StaticMapProps): react.JSX.Element;
|
|
30
30
|
|
|
31
31
|
export { StaticMap, type StaticMapProps };
|
package/dist/static.js
CHANGED
|
@@ -107,10 +107,12 @@ function abortReason(signal) {
|
|
|
107
107
|
import { jsx } from "react/jsx-runtime";
|
|
108
108
|
function StaticMap({
|
|
109
109
|
alt = "",
|
|
110
|
+
attribution,
|
|
110
111
|
camera,
|
|
111
112
|
className,
|
|
112
113
|
captureId,
|
|
113
114
|
createUrl,
|
|
115
|
+
format,
|
|
114
116
|
imageStyle,
|
|
115
117
|
imageUrl,
|
|
116
118
|
idempotencyKey,
|
|
@@ -135,10 +137,10 @@ function StaticMap({
|
|
|
135
137
|
const resolvedCaptureId = normalizeTileflowCaptureId(captureId);
|
|
136
138
|
const onErrorRef = useRef(onError);
|
|
137
139
|
const onReadyRef = useRef(onReady);
|
|
138
|
-
const sceneInputKey = stableStringify2({ camera, map, overlays, size, theme });
|
|
140
|
+
const sceneInputKey = stableStringify2({ attribution, camera, format, map, overlays, size, theme });
|
|
139
141
|
const preparedSceneCandidate = useMemo(
|
|
140
|
-
() => prepareSceneRequest({ camera, map, overlays, size, theme }),
|
|
141
|
-
[camera, map, overlays, size, theme]
|
|
142
|
+
() => prepareSceneRequest({ attribution, camera, format, map, overlays, size, theme }),
|
|
143
|
+
[attribution, camera, format, map, overlays, size, theme]
|
|
142
144
|
);
|
|
143
145
|
const preparedScene = useStablePreparedSceneRequest(preparedSceneCandidate);
|
|
144
146
|
const sceneKey = preparedScene.ok ? preparedScene.request.sceneKey : `invalid:${sceneInputKey}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tileflow/react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.22",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "React components for rendering Tileflow maps with MapLibre.",
|
|
6
6
|
"type": "module",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@tileflow/core": ">=0.1.0-alpha.
|
|
50
|
-
"@tileflow/interactions": ">=0.1.0-alpha.
|
|
51
|
-
"@tileflow/static": ">=0.1.0-alpha.
|
|
49
|
+
"@tileflow/core": ">=0.1.0-alpha.23 <0.1.0-beta.0",
|
|
50
|
+
"@tileflow/interactions": ">=0.1.0-alpha.1 <0.1.0-beta.0",
|
|
51
|
+
"@tileflow/static": ">=0.1.0-alpha.22 <0.1.0-beta.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"maplibre-gl": ">=5 <7",
|