@tileflow/core 0.1.0-alpha.31 → 0.1.0-alpha.32

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 CHANGED
@@ -144,6 +144,12 @@ show a continuous blend of them on the same MapLibre instance, with no extra req
144
144
  [theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md).
145
145
  The same controller can make chosen modules recede and the map's labels fade so an application's
146
146
  own content reads first; see [map emphasis](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/map-emphasis.md).
147
+ It also sets the style-wide states that themes read with `expr.globalState`, easing numbers so the
148
+ values a theme interpolates on them move smoothly; see
149
+ [style states](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/style-states.md).
150
+ For application-drawn RGBA symbols, it also manages fixed-size
151
+ [dynamic style images](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/dynamic-style-images.md),
152
+ including state refresh, theme changes and restoration without changing layer placement.
147
153
 
148
154
  The semantic domains are `land`, `water`, `nautical`, `roads`, `buildings`, `boundaries`, `labels`,
149
155
  `poi`, `aeroways`, `transit`, `vegetation`, `addresses`, and `landforms`. Style stable geographic
@@ -239,7 +245,7 @@ standalone capture apply the browser effect automatically. Direct MapLibre integ
239
245
 
240
246
  A map with text must declare exactly one text provider. Streets, Ferraris, Härad, Soundings,
241
247
  and Blueprint use URL glyph providers. Baedeker and Siegfried use packaged Cormorant
242
- fonts; Cyberpunk and Matrix use packaged Oxanium fonts. Hosted deployment currently rejects
248
+ fonts, and Cívica uses its packaged lettering. Hosted deployment currently rejects
243
249
  package/local font bundles; use self-hosted output or explicitly replace the provider with compatible
244
250
  public glyphs. Tile URLs and font providers do not establish redistribution rights.
245
251
 
@@ -265,6 +271,7 @@ revision; prefer the installed copy when working with an older release.
265
271
  - [Themes and module styles](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/themes-and-module-styles.md)
266
272
  - [Theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md)
267
273
  - [Map emphasis](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/map-emphasis.md)
274
+ - [Style states](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/style-states.md)
268
275
  - [Data is separate from design](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/data-is-separate-from-design.md)
269
276
  - [Capture scenes](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/capture-scenes.md)
270
277
  - [Public API and browser subpath](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/public-api-and-browser-subpath.md)
package/dist/browser.d.ts CHANGED
@@ -1,3 +1,46 @@
1
+ /** Inputs to one fixed-size, application-owned RGBA image. */
2
+ type TileflowDynamicImageContext = Readonly<{
3
+ theme: string;
4
+ blend?: Readonly<{
5
+ position: number;
6
+ themes: readonly string[];
7
+ }>;
8
+ states: Readonly<Record<string, boolean | number | string | null | undefined>>;
9
+ /** Physical pixel dimensions, fixed for this registration. */
10
+ width: number;
11
+ height: number;
12
+ pixelRatio: number;
13
+ }>;
14
+ type TileflowDynamicImage = Readonly<{
15
+ /** Physical pixel dimensions, each from 1 through 2048. */
16
+ width: number;
17
+ height: number;
18
+ /** Physical pixels per logical pixel. Defaults to 1; fixed until disposal. */
19
+ pixelRatio?: number;
20
+ /** Controller states that invalidate this image, including interpolated values. */
21
+ states?: readonly string[];
22
+ /** Synchronous RGBA pixels; undefined keeps the previous pixels (initially transparent). */
23
+ render(context: TileflowDynamicImageContext): Uint8Array | Uint8ClampedArray | undefined;
24
+ /** Later render/restore failures retain good pixels. Defaults to console.error. */
25
+ onError?(error: Error): void;
26
+ }>;
27
+ type TileflowDynamicImageHandle = {
28
+ /** Refresh external inputs at the next frame. Repeated requests coalesce. */
29
+ refresh(): void;
30
+ /** Cancel queued work, release the name and remove only this resource's image. */
31
+ dispose(): void;
32
+ };
33
+ type TileflowDynamicImageMap = {
34
+ addImage?: unknown;
35
+ getCanvas?: unknown;
36
+ getImage?: unknown;
37
+ getStyle?: unknown;
38
+ removeImage?: unknown;
39
+ updateImage?: unknown;
40
+ on(event: string, listener: () => void): unknown;
41
+ off(event: string, listener: () => void): unknown;
42
+ };
43
+
1
44
  type TileflowFairUseNoticeState = 'GRACE' | 'MANAGED_REQUIRED';
2
45
  type TileflowFairUseNotice = Readonly<{
3
46
  action: string;
@@ -135,6 +178,11 @@ type TileflowTextJustify = 'auto' | 'center' | 'left' | 'right';
135
178
  type TileflowIconAnchor = TileflowTextAnchor;
136
179
  type TileflowAlignment = 'auto' | 'map' | 'viewport';
137
180
  type TileflowIconTextFit = 'both' | 'height' | 'none' | 'width';
181
+ /**
182
+ * How a symbol part treats collisions with symbols placed before it. `never` hides it, `always`
183
+ * shows it, and `cooperative` shows it unless the earlier symbol was placed with `never`.
184
+ */
185
+ type TileflowSymbolOverlap = 'always' | 'cooperative' | 'never';
138
186
  /** Visibility and zoom bounds shared by every visual primitive. */
139
187
  type TileflowLayerRange = {
140
188
  maxZoom?: number;
@@ -231,6 +279,12 @@ type TileflowTextLayout = {
231
279
  maxWidth?: TileflowNumberStyleValue;
232
280
  offset?: TileflowNumberOffsetStyleValue;
233
281
  optional?: boolean;
282
+ /**
283
+ * Overlap mode. Takes precedence over `allowOverlap`, so the compiled layer carries only the mode.
284
+ * Native artifacts, whose renderer has no overlap modes, use `allowOverlap: false` for `never`
285
+ * and `true` otherwise.
286
+ */
287
+ overlap?: TileflowSymbolOverlap;
234
288
  padding?: TileflowNumberStyleValue;
235
289
  pitchAlignment?: TileflowAlignment;
236
290
  radialOffset?: TileflowNumberStyleValue;
@@ -256,6 +310,12 @@ type TileflowIconLayout = {
256
310
  keepUpright?: boolean;
257
311
  offset?: TileflowNumberOffsetStyleValue;
258
312
  optional?: boolean;
313
+ /**
314
+ * Overlap mode. Takes precedence over `allowOverlap`, so the compiled layer carries only the mode.
315
+ * Native artifacts, whose renderer has no overlap modes, use `allowOverlap: false` for `never`
316
+ * and `true` otherwise.
317
+ */
318
+ overlap?: TileflowSymbolOverlap;
259
319
  padding?: TileflowNumberStyleValue;
260
320
  pitchAlignment?: TileflowAlignment;
261
321
  rotate?: TileflowNumberStyleValue;
@@ -509,6 +569,17 @@ type TileflowStyleFontFace = {
509
569
  style?: 'italic' | 'normal' | 'oblique';
510
570
  weight?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
511
571
  };
572
+ /**
573
+ * A continuous blend of named themes of one Tileflow map. `position` places the map between
574
+ * neighbouring themes: 0 is the first, 1 the second, and 1.25 a quarter of the way from the second
575
+ * to the third.
576
+ */
577
+ type TileflowThemeBlendSelection = Readonly<{
578
+ /** From 0 to `themes.length - 1`. */
579
+ position: number;
580
+ /** Two to eight concrete theme names of the map, in blend order. */
581
+ themes: readonly string[];
582
+ }>;
512
583
 
513
584
  type TileflowAddressesModuleOptions = {
514
585
  /** Styling for OpenMapTiles point house-number labels. */
@@ -624,7 +695,6 @@ type TileflowVegetationThreeDimensionalStyle = {
624
695
  };
625
696
  type TileflowVegetationModuleOptions = {
626
697
  flat?: TileflowCircleStyle;
627
- minZoom?: number;
628
698
  mode?: TileflowVegetationMode;
629
699
  threeDimensional?: TileflowVegetationThreeDimensionalStyle;
630
700
  };
@@ -785,7 +855,7 @@ type TileflowPmtilesProtocolHandler = (request: Readonly<{
785
855
  url: string;
786
856
  }>, abortController: AbortController) => Promise<Readonly<{
787
857
  cacheControl?: string;
788
- data: unknown;
858
+ data: object | string;
789
859
  expires?: string;
790
860
  }>>;
791
861
  type TileflowPmtilesProtocolRegistry = Readonly<{
@@ -840,24 +910,56 @@ type TileflowThemeBlendRequest = Readonly<{
840
910
  position: number;
841
911
  /** Two to eight concrete themes of one map, in blend order. */
842
912
  themes: readonly TileflowRuntimeStyle[];
913
+ /**
914
+ * Holds back what would make MapLibre lay tiles out again: the change of nearest theme, with
915
+ * the labels, icons, and values it switches, and mixed pattern artwork. Colours, numbers, the
916
+ * sky, and light keep following the position, so a camera move or a recording never waits on
917
+ * the blend. The next request without `hold` brings what was held back in at once.
918
+ */
919
+ hold?: boolean;
843
920
  }>;
921
+ /**
922
+ * A blend of named themes as the React, Vue, and Svelte maps take it: `hold` holds back what
923
+ * would make MapLibre lay tiles out again, as `TileflowThemeBlendRequest.hold` does, and the next
924
+ * selection without it brings what waited in at once.
925
+ */
926
+ type TileflowBrowserThemeBlendSelection = TileflowThemeBlendSelection & Readonly<{
927
+ hold?: boolean;
928
+ }>;
929
+ declare function validateTileflowBrowserThemeBlendSelection(value: unknown): value is TileflowBrowserThemeBlendSelection;
844
930
  type TileflowThemeBlendState = Readonly<{
931
+ /** Whether changes held back by `hold` are waiting for a request without it. */
932
+ held: boolean;
845
933
  position: number;
934
+ /**
935
+ * Positions where the nearest theme changes over values that make MapLibre lay tiles out
936
+ * again, such as icon names, layout values, and values that read feature data or state. Plan
937
+ * a camera move or a recording around them, or pass `hold` across them.
938
+ */
939
+ relayoutAt: readonly number[];
846
940
  themes: readonly string[];
847
941
  }>;
848
- type TileflowStyleSwitchMap = TileflowThemeMotionMap & {
942
+ type TileflowStyleSwitchMap = TileflowThemeMotionMap & TileflowDynamicImageMap & {
943
+ getGlobalState?: unknown;
849
944
  off(event: string, listener: (event?: unknown) => void): unknown;
850
945
  on(event: string, listener: (event?: unknown) => void): unknown;
946
+ setGlobalStateProperty?: unknown;
851
947
  setStyle: unknown;
852
948
  };
949
+ /** A value an application sets for the whole style, which themes read with `expr.globalState`. */
950
+ type TileflowStyleStateValue = boolean | number | string | null;
853
951
  type TileflowThemeController = {
854
952
  dispose(): void;
953
+ /** Own a fixed-size RGBA image with a stable name across themes, restored after style reloads. */
954
+ registerImage(name: string, image: TileflowDynamicImage): TileflowDynamicImageHandle;
855
955
  /** The active blend, or undefined when the map shows one theme. */
856
956
  getBlend(): TileflowThemeBlendState | undefined;
857
957
  /** The theme the map shows; during a blend, the nearest theme. */
858
958
  getCurrent(): TileflowRuntimeStyle;
859
959
  /** The emphasis requested last, or undefined when the map is shown as designed. */
860
960
  getEmphasis(): TileflowEmphasis | undefined;
961
+ /** The value a style state was set to last, or undefined when it has not been set. */
962
+ getState(name: string): TileflowStyleStateValue | undefined;
861
963
  /**
862
964
  * Shows a blend of themes. The first request for a set of themes loads their styles and
863
965
  * prepares one style that holds all of them; later requests for the same themes only move the
@@ -871,6 +973,15 @@ type TileflowThemeController = {
871
973
  * that MapLibre evaluates per feature change at once, under a cross-fade.
872
974
  */
873
975
  setEmphasis(emphasis: TileflowEmphasis | undefined, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
976
+ /**
977
+ * Sets a style-wide state that the map's themes read with `expr.globalState(name)`. A number
978
+ * eases from the value it shows to the new one over the transition, so a colour or size that a
979
+ * theme interpolates on it moves smoothly; other values, and a number set for the first time,
980
+ * change at once. A value that also reads feature data or feature state is laid out again by
981
+ * MapLibre at each change, so it follows late and costs more. States stay through theme changes
982
+ * and blends. Needs a MapLibre map with global state (GL JS 5.6 or later).
983
+ */
984
+ setState(name: string, value: TileflowStyleStateValue, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
874
985
  setTheme(style: TileflowRuntimeStyle, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
875
986
  };
876
987
  /**
@@ -921,7 +1032,6 @@ type TileflowTransformRequestParameters = {
921
1032
  type TileflowComposedRequest<TRequest extends TileflowTransformRequestParameters> = Pick<TRequest, 'url'> & Partial<Omit<TRequest, 'url'>>;
922
1033
  type TileflowTransformRequest<TRequest extends TileflowTransformRequestParameters, TResourceType> = (url: string, resourceType?: TResourceType) => Promise<TileflowComposedRequest<TRequest>> | TileflowComposedRequest<TRequest> | undefined;
923
1034
  type TileflowUserTransformRequest<TRequest extends TileflowTransformRequestParameters, TResourceType> = (url: string, resourceType?: TResourceType) => Promise<TRequest> | TRequest | undefined;
924
- type TileflowAsyncAnalyticsTiming = 'request' | 'resolution';
925
1035
  declare function createTileflowSessionStarter(options: {
926
1036
  getSessionId?: () => string;
927
1037
  sessionId: string;
@@ -940,23 +1050,17 @@ declare function attachTileflowMapLifecycle<TMap, TFrame>(options: {
940
1050
  setState: (state: TileflowMapReadinessState) => void;
941
1051
  subscribe: TileflowMapLifecycleSubscriber<TMap>;
942
1052
  }): TileflowMapLifecycleAttachment;
1053
+ /**
1054
+ * Compose the caller's request transform with Tileflow analytics, the Hosted session, and the
1055
+ * World bridge. Analytics are read when each request starts, so an asynchronous user transform
1056
+ * never attaches analytics that changed while it was pending.
1057
+ */
943
1058
  declare function createTileflowTransformRequest<TRequest extends TileflowTransformRequestParameters = TileflowTransformRequestParameters, TResourceType = unknown>(options: {
944
- always: true;
945
- asyncAnalyticsTiming?: TileflowAsyncAnalyticsTiming;
946
1059
  getAnalytics: () => TileflowAnalytics | undefined;
947
1060
  sessionController?: TileflowSessionController;
948
1061
  sessionId: string;
949
1062
  transformRequest?: TileflowUserTransformRequest<TRequest, TResourceType>;
950
1063
  worldRequestBridge?: TileflowWorldRequestBridge;
951
1064
  }): TileflowTransformRequest<TRequest, TResourceType>;
952
- declare function createTileflowTransformRequest<TRequest extends TileflowTransformRequestParameters = TileflowTransformRequestParameters, TResourceType = unknown>(options: {
953
- always?: boolean;
954
- asyncAnalyticsTiming?: TileflowAsyncAnalyticsTiming;
955
- getAnalytics: () => TileflowAnalytics | undefined;
956
- sessionController?: TileflowSessionController;
957
- sessionId: string;
958
- transformRequest?: TileflowUserTransformRequest<TRequest, TResourceType>;
959
- worldRequestBridge?: TileflowWorldRequestBridge;
960
- }): TileflowTransformRequest<TRequest, TResourceType> | undefined;
961
1065
 
962
- export { type TileflowAsyncAnalyticsTiming, type TileflowAtmosphereMap, type TileflowComposedRequest, type TileflowContourProtocolHandler, type TileflowContourProtocolRegistrationOptions, type TileflowContourProtocolRegistry, type TileflowContourProtocolRequest, type TileflowContourProtocolResponse, type TileflowEmphasis, type TileflowEmphasisArea, type TileflowEmphasisModule, type TileflowFairUseNotice, type TileflowFairUseNoticeController, type TileflowFairUseNoticeState, type TileflowFrameScheduler, type TileflowMapLifecycleAttachment, type TileflowMapLifecycleEvent, type TileflowMapLifecycleSubscriber, type TileflowMapReadinessState, type TileflowPmtilesProtocolHandler, type TileflowPmtilesProtocolRegistrationOptions, type TileflowPmtilesProtocolRegistry, type TileflowSessionSender, type TileflowSessionStarter, type TileflowStyleFontLoadOptions, type TileflowStyleSwitchMap, type TileflowThemeBlendRequest, type TileflowThemeBlendState, type TileflowThemeChangeOptions, type TileflowThemeController, type TileflowThemeTransition, type TileflowThemeTransitionOptions, type TileflowThemeTransitionPhase, type TileflowThemeTransitionResult, type TileflowTransformRequest, type TileflowTransformRequestParameters, type TileflowUserTransformRequest, type TileflowWorldProtocolHandler, type TileflowWorldProtocolRequest, type TileflowWorldProtocolResponse, type TileflowWorldRequestBridge, attachTileflowAtmosphere, attachTileflowFairUseNotice, attachTileflowMapLifecycle, createTileflowSessionStarter, createTileflowThemeController, createTileflowTransformRequest, getTileflowSystemColorScheme, loadTileflowStyleFonts, registerTileflowContourProtocol, registerTileflowPmtilesProtocol, registerTileflowWorldRequestBridge, subscribeTileflowSystemColorScheme, tileflowFairUseNoticeMessage, tileflowLayerDomainMetadataKey, tileflowMaplibreContourVersion, tileflowPmtilesMaximumDirectoryDepth, tileflowPmtilesProtocol, validateTileflowEmphasis };
1066
+ export { type TileflowAtmosphereMap, type TileflowBrowserThemeBlendSelection, type TileflowComposedRequest, type TileflowContourProtocolHandler, type TileflowContourProtocolRegistrationOptions, type TileflowContourProtocolRegistry, type TileflowContourProtocolRequest, type TileflowContourProtocolResponse, type TileflowDynamicImage, type TileflowDynamicImageContext, type TileflowDynamicImageHandle, type TileflowEmphasis, type TileflowEmphasisArea, type TileflowEmphasisModule, type TileflowFairUseNotice, type TileflowFairUseNoticeController, type TileflowFairUseNoticeState, type TileflowFrameScheduler, type TileflowMapLifecycleAttachment, type TileflowMapLifecycleEvent, type TileflowMapLifecycleSubscriber, type TileflowMapReadinessState, type TileflowPmtilesProtocolHandler, type TileflowPmtilesProtocolRegistrationOptions, type TileflowPmtilesProtocolRegistry, type TileflowSessionSender, type TileflowSessionStarter, type TileflowStyleFontLoadOptions, type TileflowStyleStateValue, type TileflowStyleSwitchMap, type TileflowThemeBlendRequest, type TileflowThemeBlendState, type TileflowThemeChangeOptions, type TileflowThemeController, type TileflowThemeTransition, type TileflowThemeTransitionOptions, type TileflowThemeTransitionPhase, type TileflowThemeTransitionResult, type TileflowTransformRequest, type TileflowTransformRequestParameters, type TileflowUserTransformRequest, type TileflowWorldProtocolHandler, type TileflowWorldProtocolRequest, type TileflowWorldProtocolResponse, type TileflowWorldRequestBridge, attachTileflowAtmosphere, attachTileflowFairUseNotice, attachTileflowMapLifecycle, createTileflowSessionStarter, createTileflowThemeController, createTileflowTransformRequest, getTileflowSystemColorScheme, loadTileflowStyleFonts, registerTileflowContourProtocol, registerTileflowPmtilesProtocol, registerTileflowWorldRequestBridge, subscribeTileflowSystemColorScheme, tileflowFairUseNoticeMessage, tileflowLayerDomainMetadataKey, tileflowMaplibreContourVersion, tileflowPmtilesMaximumDirectoryDepth, tileflowPmtilesProtocol, validateTileflowBrowserThemeBlendSelection, validateTileflowEmphasis };