@tileflow/core 0.1.0-alpha.44 → 0.1.0-alpha.45
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 +103 -61
- package/dist/{3d-CW5Ls0An.d.ts → 3d-EHN80Dhw.d.ts} +16 -1
- package/dist/3d.d.ts +1 -1
- package/dist/3d.js +312 -152
- package/dist/browser.d.ts +180 -9
- package/dist/browser.js +4209 -801
- package/dist/build.d.ts +15 -5
- package/dist/build.js +1161 -167
- package/dist/config-reference.json +93 -44
- package/dist/{icon-composition-Bbw9umUA.d.ts → icon-composition-Dph-24oC.d.ts} +11 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1020 -486
- package/dist/{manifest-types-CwjHd4qc.d.ts → manifest-types-GeYn0SQM.d.ts} +102 -2
- package/dist/manifest.d.ts +2 -2
- package/dist/manifest.js +13 -1
- package/dist/native-profile.d.ts +4 -0
- package/dist/native.d.ts +8 -1
- package/dist/native.js +66 -7
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +3079 -27
- package/dist/worker/camera-tile-worker.global.js +2 -2
- package/package.json +1 -1
|
@@ -645,6 +645,10 @@ type MapLibreStyle = {
|
|
|
645
645
|
version: 8;
|
|
646
646
|
name: string;
|
|
647
647
|
glyphs?: string;
|
|
648
|
+
'font-faces'?: Record<string, string | {
|
|
649
|
+
url: string;
|
|
650
|
+
'unicode-range'?: string[];
|
|
651
|
+
}>;
|
|
648
652
|
light?: TileflowLight;
|
|
649
653
|
projection?: {
|
|
650
654
|
type: TileflowProjection;
|
|
@@ -672,6 +676,96 @@ type TileflowTimeOfDay = (typeof tileflowTimesOfDay)[number];
|
|
|
672
676
|
type TileflowTimeOfDayVariants = Readonly<Record<string, Readonly<Partial<Record<TileflowTimeOfDay, string>>>>>;
|
|
673
677
|
declare function isTileflowTimeOfDay(value: unknown): value is TileflowTimeOfDay;
|
|
674
678
|
|
|
679
|
+
type Json = null | boolean | number | string | Json[] | {
|
|
680
|
+
[key: string]: Json;
|
|
681
|
+
};
|
|
682
|
+
type TileflowFamilyUpdate = readonly [layer: number, property: string];
|
|
683
|
+
/** A shared cartography document. Parameter columns are storage identities, not color tokens. */
|
|
684
|
+
type TileflowStyleFamily = Readonly<{
|
|
685
|
+
kind: 'tileflow-style-family';
|
|
686
|
+
version: 1;
|
|
687
|
+
themes: readonly string[];
|
|
688
|
+
template: Json;
|
|
689
|
+
parameters: readonly (readonly Json[])[];
|
|
690
|
+
/** Literal shared subtrees. Entries are never interpreted as references. */
|
|
691
|
+
constants: readonly Json[];
|
|
692
|
+
updates: Readonly<{
|
|
693
|
+
/** False means that this family contains structural alternatives requiring a style change. */
|
|
694
|
+
appearanceOnly: boolean;
|
|
695
|
+
paint: readonly TileflowFamilyUpdate[];
|
|
696
|
+
roots: readonly ('light' | 'sky')[];
|
|
697
|
+
}>;
|
|
698
|
+
}>;
|
|
699
|
+
declare const tileflowStyleFamilyLimits: Readonly<{
|
|
700
|
+
themes: 64;
|
|
701
|
+
documentBytes: number;
|
|
702
|
+
expandedStyleBytes: number;
|
|
703
|
+
expandedFamilyBytes: number;
|
|
704
|
+
layers: 4096;
|
|
705
|
+
nodes: 500000;
|
|
706
|
+
depth: 96;
|
|
707
|
+
}>;
|
|
708
|
+
/** Factor identical JSON structure and repeated variant columns without guessing token identity. */
|
|
709
|
+
declare function createTileflowStyleFamily(styles: Readonly<Record<string, MapLibreStyle>>): TileflowStyleFamily;
|
|
710
|
+
/** Validate budgets before materializing; malformed or oversized input never reaches a renderer. */
|
|
711
|
+
declare function parseTileflowStyleFamily(input: unknown): TileflowStyleFamily;
|
|
712
|
+
/** Export one conventional MapLibre JSON. The result is detached from the shared document. */
|
|
713
|
+
declare function materializeTileflowStyleFamily(family: TileflowStyleFamily, theme: string): MapLibreStyle;
|
|
714
|
+
/** Expand at a trust boundary when a consumer requires conventional style documents. */
|
|
715
|
+
declare function expandTileflowStyleFamily(input: unknown): Record<string, MapLibreStyle>;
|
|
716
|
+
/** Expand shared literals once when a build/delivery pass needs to inspect the template. */
|
|
717
|
+
declare function expandTileflowFamilyTemplate(family: TileflowStyleFamily): Json;
|
|
718
|
+
/** Repack a resource-rewritten template while retaining and verifying its update contract. */
|
|
719
|
+
declare function withTileflowFamilyTemplate(family: TileflowStyleFamily, template: unknown): TileflowStyleFamily;
|
|
720
|
+
|
|
721
|
+
/** Read a shared family with a strict streaming bound; caller owns cache and request lifetime. */
|
|
722
|
+
declare function loadTileflowStyleFamily(url: string, options?: {
|
|
723
|
+
fetch?: typeof fetch;
|
|
724
|
+
signal?: AbortSignal;
|
|
725
|
+
}): Promise<TileflowStyleFamily>;
|
|
726
|
+
|
|
727
|
+
type TileflowColorOverrides = Readonly<Record<string, string>>;
|
|
728
|
+
/** Reevaluate only explicit colour programs; fixed values and application-owned layers are untouched. */
|
|
729
|
+
declare function applyTileflowColorOverrides(style: MapLibreStyle, overrides: TileflowColorOverrides): MapLibreStyle;
|
|
730
|
+
|
|
731
|
+
/** Prepare feature-dependent paint once, before the first style is installed in the renderer. */
|
|
732
|
+
declare function prepareTileflowStyleFamilyForRendering(family: TileflowStyleFamily): TileflowStyleFamily;
|
|
733
|
+
|
|
734
|
+
/** Resolve document-relative assets without fetching textures, tiles or models ahead of demand. */
|
|
735
|
+
declare function resolveTileflowStyleResourceUrls(style: MapLibreStyle, documentUrl: string): MapLibreStyle;
|
|
736
|
+
declare function resolveTileflowFamilyResourceUrls(family: TileflowStyleFamily, documentUrl: string): TileflowStyleFamily;
|
|
737
|
+
/** Prepare the initial appearance before constructing MapLibre; subsequent changes reuse this family. */
|
|
738
|
+
declare function loadTileflowRuntimeAppearance(style: TileflowRuntimeStyle, options?: {
|
|
739
|
+
fetch?: typeof fetch;
|
|
740
|
+
signal?: AbortSignal;
|
|
741
|
+
}): Promise<TileflowRuntimeStyle>;
|
|
742
|
+
|
|
743
|
+
type TileflowAppearanceSelection = Readonly<{
|
|
744
|
+
palette?: string;
|
|
745
|
+
} & ({
|
|
746
|
+
mode: 'fixed';
|
|
747
|
+
moment?: TileflowTimeOfDay;
|
|
748
|
+
} | {
|
|
749
|
+
mode: 'system';
|
|
750
|
+
light: TileflowTimeOfDay;
|
|
751
|
+
dark: TileflowTimeOfDay;
|
|
752
|
+
} | {
|
|
753
|
+
mode: 'clock';
|
|
754
|
+
schedule: readonly Readonly<{
|
|
755
|
+
hour: number;
|
|
756
|
+
moment: TileflowTimeOfDay;
|
|
757
|
+
}>[];
|
|
758
|
+
blend?: boolean;
|
|
759
|
+
})>;
|
|
760
|
+
/** Resolve artistic time presets. Device dark mode and local clock are independent inputs. */
|
|
761
|
+
declare function resolveTileflowAppearance(map: TileflowRuntimeManifestMap, selection: TileflowAppearanceSelection, context: {
|
|
762
|
+
date: Date;
|
|
763
|
+
colorScheme: 'light' | 'dark';
|
|
764
|
+
}): Readonly<{
|
|
765
|
+
themes: readonly string[];
|
|
766
|
+
position: number;
|
|
767
|
+
}>;
|
|
768
|
+
|
|
675
769
|
declare const defaultTileflowManifestUrl = "/tileflow/manifest.json";
|
|
676
770
|
declare const defaultTileflowRuntimeView: Readonly<{
|
|
677
771
|
bearing: 0;
|
|
@@ -724,6 +818,9 @@ type TileflowResolvedRuntimeTheme = TileflowRuntimeManifestTheme & {
|
|
|
724
818
|
name: string;
|
|
725
819
|
};
|
|
726
820
|
type TileflowRuntimeStyle = {
|
|
821
|
+
/** Shared validated family used for appearance updates without replacing the style. */
|
|
822
|
+
family?: TileflowStyleFamily;
|
|
823
|
+
familyUrl?: string;
|
|
727
824
|
analytics?: TileflowAnalytics;
|
|
728
825
|
colorScheme?: TileflowRuntimeColorScheme;
|
|
729
826
|
/** An explicit empty array means the manifest declares that no web fonts are required. */
|
|
@@ -867,6 +964,7 @@ declare function inferTileflowAnalyticsFromStyleUrl(styleUrl: string): TileflowA
|
|
|
867
964
|
declare const tileflowRuntimeManifestVersion: 1;
|
|
868
965
|
/** V2 adds the optional time-of-day catalog; maps without it still publish V1. */
|
|
869
966
|
declare const tileflowTimeOfDayManifestVersion: 2;
|
|
967
|
+
declare const tileflowFamilyManifestVersion: 3;
|
|
870
968
|
declare const tileflowRuntimeManifestLimits: Readonly<{
|
|
871
969
|
maximumBytes: number;
|
|
872
970
|
}>;
|
|
@@ -886,6 +984,8 @@ type TileflowRuntimeSystemThemes = {
|
|
|
886
984
|
light: string;
|
|
887
985
|
};
|
|
888
986
|
type TileflowRuntimeManifestMapEntry = {
|
|
987
|
+
/** One shared document for every appearance; styleUrl remains the flat export. */
|
|
988
|
+
familyUrl?: string;
|
|
889
989
|
apiUrl?: string;
|
|
890
990
|
defaultTheme: string;
|
|
891
991
|
environment?: string;
|
|
@@ -906,7 +1006,7 @@ type TileflowRuntimeManifestMapEntry = {
|
|
|
906
1006
|
type TileflowRuntimeManifest = {
|
|
907
1007
|
apiUrl?: string;
|
|
908
1008
|
maps: Record<string, TileflowRuntimeManifestMapEntry>;
|
|
909
|
-
version: typeof tileflowRuntimeManifestVersion | typeof tileflowTimeOfDayManifestVersion;
|
|
1009
|
+
version: typeof tileflowRuntimeManifestVersion | typeof tileflowTimeOfDayManifestVersion | typeof tileflowFamilyManifestVersion;
|
|
910
1010
|
};
|
|
911
1011
|
|
|
912
|
-
export { type
|
|
1012
|
+
export { type TileflowImageStyleValue as $, type TileflowLineStyle as A, type TileflowSymbolStyle as B, type TileflowRoadsModuleOptions as C, type TileflowRoadsModuleConfig as D, type TileflowLabelsModuleOptions as E, type TileflowLabelsModuleConfig as F, type TileflowPoiModuleOptions as G, type TileflowPoiModuleConfig as H, type MapLibreSprite as I, type TileflowAerodromeCodeDetail as J, type TileflowAlignment as K, type TileflowAnalytics as L, type MapLibreStyle as M, type TileflowAreaStyle as N, type TileflowBackgroundPaint as O, type TileflowCirclePaint as P, type TileflowColor as Q, type TileflowColorStyleValue as R, type TileflowExtrusionPaint as S, type TileflowRuntimeManifest as T, type TileflowFillPaint as U, type ValidationMessage as V, type TileflowIconAnchor as W, type TileflowIconLayout as X, type TileflowIconPaint as Y, type TileflowIconStyle as Z, type TileflowIconTextFit as _, type TileflowRuntimeColorScheme as a, type TileflowStyleValue as a$, type TileflowLabelDetail as a0, type TileflowLabelLanguage as a1, type TileflowLabelStyles as a2, type TileflowLayerRange as a3, type TileflowLight as a4, type TileflowLineCap as a5, type TileflowLineHatchStyle as a6, type TileflowLineJoin as a7, type TileflowLineLayout as a8, type TileflowLinePaint as a9, type TileflowRoadLayerStyle as aA, type TileflowRoadModifier as aB, type TileflowRoadOutline as aC, type TileflowRoadRestriction as aD, type TileflowRoadRoundaboutStyle as aE, type TileflowRoadServiceType as aF, type TileflowRoadShieldDetail as aG, type TileflowRoadShieldStyles as aH, type TileflowRoadSidewalkStyle as aI, type TileflowRoadStreetLightStyle as aJ, type TileflowRoadStructure as aK, type TileflowRoadTreatmentLayerStyle as aL, type TileflowRoadTreatmentLineStyle as aM, type TileflowRoadTreatmentStyle as aN, type TileflowRoadWeight as aO, type TileflowRuntimeCenterLike as aP, type TileflowRuntimeManifestMap as aQ, type TileflowRuntimeSource as aR, type TileflowRuntimeSourceValidation as aS, type TileflowRuntimeStyle as aT, type TileflowRuntimeStyleOptions as aU, type TileflowRuntimeViewOptions as aV, type TileflowSessionController as aW, type TileflowSessionGrantResponse as aX, type TileflowStringStyleValue as aY, type TileflowStructuralStyleValue as aZ, type TileflowStyleFontFace as a_, type TileflowLineStackStyle as aa, type TileflowManifestFetchOptions as ab, type TileflowManifestLoadOptions as ac, type TileflowMapMode as ad, type TileflowMapModeOptions as ae, type TileflowMarkerSymbolStyle as af, type TileflowMountainBikeScale as ag, type TileflowNumberInsetsStyleValue as ah, type TileflowNumberStyleValue as ai, type TileflowPlaceLabelClass as aj, type TileflowPoiCategory as ak, type TileflowPoiCategoryStyle as al, type TileflowPoiColorMode as am, type TileflowPoiDensity as an, type TileflowPoiPlacementOrder as ao, type TileflowPriorityOrder as ap, type TileflowProjection as aq, type TileflowResolvedRuntimeTheme as ar, type TileflowRoadAreaStyle as as, type TileflowRoadClass as at, type TileflowRoadClassStyle as au, type TileflowRoadCrossingStyle as av, type TileflowRoadDetail as aw, type TileflowRoadExtras as ax, type TileflowRoadHierarchy as ay, type TileflowRoadLabelDetail as az, type TileflowRuntimeManifestMapEntry as b, tileflowStyleFontFaceLimits as b$, type TileflowSymbolOverlap as b0, type TileflowSymbolPlacement as b1, type TileflowSymbolPlacementStyle as b2, type TileflowSymbolZOrder as b3, type TileflowTerrain as b4, type TileflowTerrainConfig as b5, type TileflowTerrainContourLabelStyle as b6, type TileflowTerrainContourLineStyle as b7, type TileflowTerrainContoursConfig as b8, type TileflowTerrainEncoding as b9, color as bA, createTileflowSessionController as bB, createTileflowSessionId as bC, defaultTileflowManifestUrl as bD, defaultTileflowRuntimeView as bE, fixed as bF, getTileflowAnalyticsApiUrl as bG, getTileflowStyleFontFaces as bH, inferTileflowAnalyticsFromStyleUrl as bI, isTileflowTimeOfDay as bJ, loadTileflowManifest as bK, mergeTileflowAnalytics as bL, nearestTileflowBlendTheme as bM, normalizeTileflowRuntimeCenter as bN, normalizeTileflowStaticImageSize as bO, normalizeTileflowUrl as bP, resolveTileflowAnalyticsRequestUrl as bQ, resolveTileflowManifestMap as bR, resolveTileflowMapMode as bS, resolveTileflowRuntimeStyle as bT, resolveTileflowRuntimeTheme as bU, resolveTileflowRuntimeThemeBlend as bV, resolveTileflowRuntimeView as bW, resolveTileflowStaticImageUrl as bX, shouldLoadTileflowManifest as bY, startTileflowSession as bZ, tileflowPoiCategories as b_, type TileflowTerrainHillshadeStyle as ba, type TileflowTerrainLayerRange as bb, type TileflowTerrainMode as bc, type TileflowTextAnchor as bd, type TileflowTextBackground as be, type TileflowTextJustify as bf, type TileflowTextLayout as bg, type TileflowTextPaint as bh, type TileflowTextStyle as bi, type TileflowThemeBlendSelection as bj, type TileflowThemeColorAlpha as bk, type TileflowThemeColorMix as bl, type TileflowThemeColorValue as bm, type TileflowThemeFontValue as bn, type TileflowThemeImageValue as bo, type TileflowThemeNumberValue as bp, type TileflowThemeSelection as bq, type TileflowThemeTokenCategory as br, type TileflowThemeValue as bs, type TileflowViewConfig as bt, type TileflowWaterLabelClass as bu, type TileflowZoomInterpolation as bv, type TileflowZoomValue as bw, type ValidationResult as bx, assertValidTileflowRuntimeSource as by, clearTileflowManifestCache as bz, type TileflowRuntimeManifestTheme as c, tileflowStyleFontFacesMetadataKey as c0, tileflowThemeBlendLimits as c1, tileflowThemeTokenCategories as c2, tileflowTimesOfDay as c3, token as c4, validateTileflowRuntimeSource as c5, validateTileflowThemeBlendSelection as c6, validateTileflowThemeSelection as c7, zoom as c8, type TileflowTypographyStyle as c9, type ResolvedTileflowTypography as ca, type TileflowAppearanceSelection as cb, type TileflowColorOverrides as cc, applyTileflowColorOverrides as cd, loadTileflowRuntimeAppearance as ce, loadTileflowStyleFamily as cf, normalizeTileflowSurfaceId as cg, prepareTileflowStyleFamilyForRendering as ch, resolveTileflowAppearance as ci, resolveTileflowFamilyResourceUrls as cj, resolveTileflowStyleResourceUrls as ck, type TileflowRuntimeSystemThemes as d, type TileflowTimeOfDay as e, type TileflowTimeOfDayVariants as f, tileflowRuntimeManifestLimits as g, tileflowRuntimeManifestVersion as h, tileflowTimeOfDayManifestVersion as i, type TileflowStyleFamily as j, createTileflowStyleFamily as k, expandTileflowFamilyTemplate as l, expandTileflowStyleFamily as m, materializeTileflowStyleFamily as n, tileflowStyleFamilyLimits as o, parseTileflowStyleFamily as p, type TileflowExpression as q, type TileflowFixedValue as r, type TileflowThemeTokenReference as s, tileflowFamilyManifestVersion as t, type TileflowThemeColorOperation as u, type TileflowBackgroundStyle as v, withTileflowFamilyTemplate as w, type TileflowCircleStyle as x, type TileflowExtrusionStyle as y, type TileflowFillStyle as z };
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as TileflowRuntimeManifest } from './manifest-types-CwjHd4qc.js';
|
|
2
|
-
export { a as TileflowRuntimeColorScheme, b as TileflowRuntimeManifestMapEntry, c as TileflowRuntimeManifestTheme, d as TileflowRuntimeSystemThemes, e as TileflowTimeOfDay, f as TileflowTimeOfDayVariants, t as tileflowRuntimeManifestLimits, g as tileflowRuntimeManifestVersion, h as tileflowTimeOfDayManifestVersion } from './manifest-types-CwjHd4qc.js';
|
|
3
1
|
import { z } from 'zod';
|
|
2
|
+
import { T as TileflowRuntimeManifest } from './manifest-types-GeYn0SQM.js';
|
|
3
|
+
export { a as TileflowRuntimeColorScheme, b as TileflowRuntimeManifestMapEntry, c as TileflowRuntimeManifestTheme, d as TileflowRuntimeSystemThemes, e as TileflowTimeOfDay, f as TileflowTimeOfDayVariants, t as tileflowFamilyManifestVersion, g as tileflowRuntimeManifestLimits, h as tileflowRuntimeManifestVersion, i as tileflowTimeOfDayManifestVersion } from './manifest-types-GeYn0SQM.js';
|
|
4
4
|
|
|
5
5
|
declare const tileflowRuntimeManifestSchema: z.ZodType<TileflowRuntimeManifest>;
|
|
6
6
|
declare function parseTileflowRuntimeManifest(input: unknown): TileflowRuntimeManifest;
|
package/dist/manifest.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/manifest-types.ts
|
|
2
2
|
var tileflowRuntimeManifestVersion = 1;
|
|
3
3
|
var tileflowTimeOfDayManifestVersion = 2;
|
|
4
|
+
var tileflowFamilyManifestVersion = 3;
|
|
4
5
|
var tileflowRuntimeManifestLimits = Object.freeze({ maximumBytes: 1024 * 1024 });
|
|
5
6
|
|
|
6
7
|
// src/portable-identity-rules.ts
|
|
@@ -160,6 +161,7 @@ function createTileflowRuntimeManifestSchema(primitives, operations, identities
|
|
|
160
161
|
apiUrl: operations.optional(apiOriginSchema),
|
|
161
162
|
defaultTheme: tileflowThemeNameSchema2,
|
|
162
163
|
environment: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
164
|
+
familyUrl: operations.optional(publicResourceUrlSchema),
|
|
163
165
|
mapId: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
164
166
|
systemThemes: operations.optional(
|
|
165
167
|
operations.object({
|
|
@@ -241,11 +243,20 @@ function createTileflowRuntimeManifestSchema(primitives, operations, identities
|
|
|
241
243
|
maps: operations.record(tileflowPortableIdSchema2, manifestMapSchema),
|
|
242
244
|
version: operations.union(
|
|
243
245
|
operations.literal(tileflowRuntimeManifestVersion),
|
|
244
|
-
operations.literal(2)
|
|
246
|
+
operations.union(operations.literal(2), operations.literal(3))
|
|
245
247
|
)
|
|
246
248
|
}),
|
|
247
249
|
(manifest, context) => {
|
|
248
250
|
const mapCount = Object.keys(manifest.maps).length;
|
|
251
|
+
if (manifest.version !== 3)
|
|
252
|
+
for (const [name, map] of Object.entries(manifest.maps)) {
|
|
253
|
+
if (map.familyUrl !== void 0)
|
|
254
|
+
context.addIssue({
|
|
255
|
+
code: "custom",
|
|
256
|
+
message: "familyUrl requires manifest version 3",
|
|
257
|
+
path: ["maps", name, "familyUrl"]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
249
260
|
if (manifest.version === 1) {
|
|
250
261
|
for (const [name, map] of Object.entries(manifest.maps)) {
|
|
251
262
|
if (map.timeOfDay !== void 0)
|
|
@@ -442,6 +453,7 @@ function safeParseTileflowRuntimeManifest(input) {
|
|
|
442
453
|
export {
|
|
443
454
|
parseTileflowRuntimeManifest,
|
|
444
455
|
safeParseTileflowRuntimeManifest,
|
|
456
|
+
tileflowFamilyManifestVersion,
|
|
445
457
|
tileflowRuntimeManifestLimits,
|
|
446
458
|
tileflowRuntimeManifestSchema,
|
|
447
459
|
tileflowRuntimeManifestVersion,
|
package/dist/native-profile.d.ts
CHANGED
package/dist/native.d.ts
CHANGED
|
@@ -55,6 +55,10 @@ type MapLibreStyle = {
|
|
|
55
55
|
version: 8;
|
|
56
56
|
name: string;
|
|
57
57
|
glyphs?: string;
|
|
58
|
+
'font-faces'?: Record<string, string | {
|
|
59
|
+
url: string;
|
|
60
|
+
'unicode-range'?: string[];
|
|
61
|
+
}>;
|
|
58
62
|
light?: TileflowLight;
|
|
59
63
|
projection?: {
|
|
60
64
|
type: TileflowProjection;
|
|
@@ -103,6 +107,7 @@ declare function nearestTileflowBlendTheme(blend: TileflowThemeBlendSelection):
|
|
|
103
107
|
declare const tileflowRuntimeManifestVersion: 1;
|
|
104
108
|
/** V2 adds the optional time-of-day catalog; maps without it still publish V1. */
|
|
105
109
|
declare const tileflowTimeOfDayManifestVersion: 2;
|
|
110
|
+
declare const tileflowFamilyManifestVersion: 3;
|
|
106
111
|
type TileflowRuntimeColorScheme = 'dark' | 'light';
|
|
107
112
|
type TileflowRuntimeManifestTheme = {
|
|
108
113
|
colorScheme: TileflowRuntimeColorScheme;
|
|
@@ -119,6 +124,8 @@ type TileflowRuntimeSystemThemes = {
|
|
|
119
124
|
light: string;
|
|
120
125
|
};
|
|
121
126
|
type TileflowRuntimeManifestMapEntry = {
|
|
127
|
+
/** One shared document for every appearance; styleUrl remains the flat export. */
|
|
128
|
+
familyUrl?: string;
|
|
122
129
|
apiUrl?: string;
|
|
123
130
|
defaultTheme: string;
|
|
124
131
|
environment?: string;
|
|
@@ -139,7 +146,7 @@ type TileflowRuntimeManifestMapEntry = {
|
|
|
139
146
|
type TileflowRuntimeManifest = {
|
|
140
147
|
apiUrl?: string;
|
|
141
148
|
maps: Record<string, TileflowRuntimeManifestMapEntry>;
|
|
142
|
-
version: typeof tileflowRuntimeManifestVersion | typeof tileflowTimeOfDayManifestVersion;
|
|
149
|
+
version: typeof tileflowRuntimeManifestVersion | typeof tileflowTimeOfDayManifestVersion | typeof tileflowFamilyManifestVersion;
|
|
143
150
|
};
|
|
144
151
|
|
|
145
152
|
/** The adapter must honor the requested read bound, without first buffering an unbounded body. */
|
package/dist/native.js
CHANGED
|
@@ -4086,6 +4086,18 @@ var init_runtime_view_schema = __esm({
|
|
|
4086
4086
|
}
|
|
4087
4087
|
});
|
|
4088
4088
|
|
|
4089
|
+
// src/color-program.ts
|
|
4090
|
+
function isColorProgramMarker(value) {
|
|
4091
|
+
return Array.isArray(value) && value.length === 6 && value[0] === "let" && value[1] === marker && Array.isArray(value[2]) && value[2][0] === "literal";
|
|
4092
|
+
}
|
|
4093
|
+
var marker;
|
|
4094
|
+
var init_color_program = __esm({
|
|
4095
|
+
"src/color-program.ts"() {
|
|
4096
|
+
"use strict";
|
|
4097
|
+
marker = "__tileflow_color_program";
|
|
4098
|
+
}
|
|
4099
|
+
});
|
|
4100
|
+
|
|
4089
4101
|
// src/theme-blend.ts
|
|
4090
4102
|
function planTileflowThemeBlend(styles, options = {}) {
|
|
4091
4103
|
if (styles.length < 2)
|
|
@@ -4248,12 +4260,16 @@ function planTileflowThemeBlend(styles, options = {}) {
|
|
|
4248
4260
|
}
|
|
4249
4261
|
function splitLayer() {
|
|
4250
4262
|
if (isLegacyFilter(layer.filter)) return void 0;
|
|
4263
|
+
const values = driven.map(
|
|
4264
|
+
(property) => [
|
|
4265
|
+
property,
|
|
4266
|
+
variants.map((variant) => inlineBranchBindings(paintOf(variant)[property]))
|
|
4267
|
+
]
|
|
4268
|
+
);
|
|
4269
|
+
if (values.some(([, entries]) => entries.some((entry) => !entry))) return void 0;
|
|
4251
4270
|
const branches = splitBranches(
|
|
4252
4271
|
Object.fromEntries(
|
|
4253
|
-
|
|
4254
|
-
property,
|
|
4255
|
-
variants.map((variant) => paintOf(variant)[property])
|
|
4256
|
-
])
|
|
4272
|
+
values.map(([property, entries]) => [property, entries.map((entry) => entry.value)])
|
|
4257
4273
|
)
|
|
4258
4274
|
);
|
|
4259
4275
|
if (!branches) return void 0;
|
|
@@ -4263,8 +4279,8 @@ function planTileflowThemeBlend(styles, options = {}) {
|
|
|
4263
4279
|
let group = groups.get(key);
|
|
4264
4280
|
if (!group) {
|
|
4265
4281
|
const templates = {};
|
|
4266
|
-
for (const [property,
|
|
4267
|
-
const template = tryMixTemplate(
|
|
4282
|
+
for (const [property, values2] of Object.entries(branch.valuesByProperty)) {
|
|
4283
|
+
const template = tryMixTemplate(values2);
|
|
4268
4284
|
if (template === void 0) return void 0;
|
|
4269
4285
|
templates[property] = template;
|
|
4270
4286
|
}
|
|
@@ -4633,6 +4649,38 @@ function splitBranches(valuesByProperty, conditions = []) {
|
|
|
4633
4649
|
}
|
|
4634
4650
|
return branches;
|
|
4635
4651
|
}
|
|
4652
|
+
function inlineBranchBindings(input) {
|
|
4653
|
+
const limit = 2e4;
|
|
4654
|
+
const visit = (node, scope, depth) => {
|
|
4655
|
+
if (depth > 96) throw new RangeError("Expression nesting limit");
|
|
4656
|
+
if (!Array.isArray(node) || node[0] === "literal" || isColorProgramMarker(node))
|
|
4657
|
+
return { value: node, size: 1 };
|
|
4658
|
+
if (node[0] === "var") {
|
|
4659
|
+
const bound = scope.get(String(node[1]));
|
|
4660
|
+
if (!bound) throw new TypeError("Unbound branch variable");
|
|
4661
|
+
return bound;
|
|
4662
|
+
}
|
|
4663
|
+
if (node[0] === "let") {
|
|
4664
|
+
const inner = new Map(scope);
|
|
4665
|
+
for (let index = 1; index < node.length - 1; index += 2)
|
|
4666
|
+
inner.set(String(node[index]), visit(node[index + 1], scope, depth + 1));
|
|
4667
|
+
return visit(node.at(-1), inner, depth + 1);
|
|
4668
|
+
}
|
|
4669
|
+
let size = 1;
|
|
4670
|
+
const value = node.map((child) => {
|
|
4671
|
+
const result = visit(child, scope, depth + 1);
|
|
4672
|
+
size += result.size;
|
|
4673
|
+
if (size > limit) throw new RangeError("Expanded branch limit");
|
|
4674
|
+
return result.value;
|
|
4675
|
+
});
|
|
4676
|
+
return { value, size };
|
|
4677
|
+
};
|
|
4678
|
+
try {
|
|
4679
|
+
return { value: visit(input, /* @__PURE__ */ new Map(), 0).value };
|
|
4680
|
+
} catch {
|
|
4681
|
+
return void 0;
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4636
4684
|
function scaleByWeight(opacity, weight) {
|
|
4637
4685
|
const input = Array.isArray(opacity) ? opacity[0] === "interpolate" ? opacity[2] : opacity[1] : void 0;
|
|
4638
4686
|
if (Array.isArray(opacity) && (opacity[0] === "interpolate" || opacity[0] === "step") && reads(input, "zoom")) {
|
|
@@ -4726,6 +4774,7 @@ var TileflowThemeBlendError, BlendLeaf, imageProperties, opacityProperties, feat
|
|
|
4726
4774
|
var init_theme_blend = __esm({
|
|
4727
4775
|
"src/theme-blend.ts"() {
|
|
4728
4776
|
"use strict";
|
|
4777
|
+
init_color_program();
|
|
4729
4778
|
TileflowThemeBlendError = class extends Error {
|
|
4730
4779
|
constructor() {
|
|
4731
4780
|
super(...arguments);
|
|
@@ -4909,6 +4958,7 @@ function createTileflowRuntimeManifestSchema(primitives, operations, identities
|
|
|
4909
4958
|
apiUrl: operations.optional(apiOriginSchema),
|
|
4910
4959
|
defaultTheme: tileflowThemeNameSchema,
|
|
4911
4960
|
environment: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
4961
|
+
familyUrl: operations.optional(publicResourceUrlSchema),
|
|
4912
4962
|
mapId: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
4913
4963
|
systemThemes: operations.optional(
|
|
4914
4964
|
operations.object({
|
|
@@ -4990,11 +5040,20 @@ function createTileflowRuntimeManifestSchema(primitives, operations, identities
|
|
|
4990
5040
|
maps: operations.record(tileflowPortableIdSchema, manifestMapSchema),
|
|
4991
5041
|
version: operations.union(
|
|
4992
5042
|
operations.literal(tileflowRuntimeManifestVersion),
|
|
4993
|
-
operations.literal(2)
|
|
5043
|
+
operations.union(operations.literal(2), operations.literal(3))
|
|
4994
5044
|
)
|
|
4995
5045
|
}),
|
|
4996
5046
|
(manifest, context) => {
|
|
4997
5047
|
const mapCount = Object.keys(manifest.maps).length;
|
|
5048
|
+
if (manifest.version !== 3)
|
|
5049
|
+
for (const [name, map2] of Object.entries(manifest.maps)) {
|
|
5050
|
+
if (map2.familyUrl !== void 0)
|
|
5051
|
+
context.addIssue({
|
|
5052
|
+
code: "custom",
|
|
5053
|
+
message: "familyUrl requires manifest version 3",
|
|
5054
|
+
path: ["maps", name, "familyUrl"]
|
|
5055
|
+
});
|
|
5056
|
+
}
|
|
4998
5057
|
if (manifest.version === 1) {
|
|
4999
5058
|
for (const [name, map2] of Object.entries(manifest.maps)) {
|
|
5000
5059
|
if (map2.timeOfDay !== void 0)
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { L as TileflowAnalytics, cb as TileflowAppearanceSelection, cc as TileflowColorOverrides, ab as TileflowManifestFetchOptions, ac as TileflowManifestLoadOptions, ad as TileflowMapMode, ae as TileflowMapModeOptions, ar as TileflowResolvedRuntimeTheme, aP as TileflowRuntimeCenterLike, a as TileflowRuntimeColorScheme, T as TileflowRuntimeManifest, aQ as TileflowRuntimeManifestMap, b as TileflowRuntimeManifestMapEntry, c as TileflowRuntimeManifestTheme, aR as TileflowRuntimeSource, aS as TileflowRuntimeSourceValidation, aT as TileflowRuntimeStyle, aU as TileflowRuntimeStyleOptions, d as TileflowRuntimeSystemThemes, aV as TileflowRuntimeViewOptions, aW as TileflowSessionController, aX as TileflowSessionGrantResponse, j as TileflowStyleFamily, a_ as TileflowStyleFontFace, bj as TileflowThemeBlendSelection, bq as TileflowThemeSelection, e as TileflowTimeOfDay, f as TileflowTimeOfDayVariants, cd as applyTileflowColorOverrides, by as assertValidTileflowRuntimeSource, bz as clearTileflowManifestCache, bB as createTileflowSessionController, bC as createTileflowSessionId, bD as defaultTileflowManifestUrl, bE as defaultTileflowRuntimeView, l as expandTileflowFamilyTemplate, bG as getTileflowAnalyticsApiUrl, bH as getTileflowStyleFontFaces, bI as inferTileflowAnalyticsFromStyleUrl, bJ as isTileflowTimeOfDay, bK as loadTileflowManifest, ce as loadTileflowRuntimeAppearance, cf as loadTileflowStyleFamily, n as materializeTileflowStyleFamily, bL as mergeTileflowAnalytics, bM as nearestTileflowBlendTheme, bN as normalizeTileflowRuntimeCenter, bO as normalizeTileflowStaticImageSize, cg as normalizeTileflowSurfaceId, bP as normalizeTileflowUrl, p as parseTileflowStyleFamily, ch as prepareTileflowStyleFamilyForRendering, bQ as resolveTileflowAnalyticsRequestUrl, ci as resolveTileflowAppearance, cj as resolveTileflowFamilyResourceUrls, bR as resolveTileflowManifestMap, bS as resolveTileflowMapMode, bT as resolveTileflowRuntimeStyle, bU as resolveTileflowRuntimeTheme, bV as resolveTileflowRuntimeThemeBlend, bW as resolveTileflowRuntimeView, bX as resolveTileflowStaticImageUrl, ck as resolveTileflowStyleResourceUrls, bY as shouldLoadTileflowManifest, bZ as startTileflowSession, o as tileflowStyleFamilyLimits, b$ as tileflowStyleFontFaceLimits, c0 as tileflowStyleFontFacesMetadataKey, c1 as tileflowThemeBlendLimits, c3 as tileflowTimesOfDay, c5 as validateTileflowRuntimeSource, c6 as validateTileflowThemeBlendSelection, c7 as validateTileflowThemeSelection, w as withTileflowFamilyTemplate } from './manifest-types-GeYn0SQM.js';
|