@tileflow/core 0.1.0-alpha.34 → 0.1.0-alpha.35

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.
@@ -1,3 +1,10 @@
1
+ /** Artistic presets; selecting one never starts a clock or moves the real sun. */
2
+ declare const tileflowTimesOfDay: readonly ["day", "dawn", "dusk", "night"];
3
+ type TileflowTimeOfDay = (typeof tileflowTimesOfDay)[number];
4
+ /** A named theme family points to complete, already compiled themes. */
5
+ type TileflowTimeOfDayVariants = Readonly<Record<string, Readonly<Partial<Record<TileflowTimeOfDay, string>>>>>;
6
+ declare function isTileflowTimeOfDay(value: unknown): value is TileflowTimeOfDay;
7
+
1
8
  declare const expressionBrand: unique symbol;
2
9
  declare const themeValueBrand: unique symbol;
3
10
  declare const zoomBrand: unique symbol;
@@ -535,21 +542,50 @@ declare const tileflowPoiCategories: readonly ["arts-entertainment", "education"
535
542
  type TileflowPoiCategory = (typeof tileflowPoiCategories)[number];
536
543
  type TileflowPoiDensity = 1 | 2 | 3 | 4 | 5;
537
544
  type TileflowPoiColorMode = 'uniform' | 'category';
538
- type TileflowPoiCategoryStyle = Omit<TileflowMarkerSymbolStyle, 'priority'> & {
539
- /** Optional category-local cap within the module's canonical density tiers. */
540
- density?: TileflowPoiDensity;
541
- };
545
+ /**
546
+ * How POI categories are placed against each other. `importance` places every category in one
547
+ * order, by World's ranks. `categories` gives each category its own layer and places the
548
+ * categories in the order they are listed, the first on top; ranks order each category only.
549
+ */
550
+ type TileflowPoiPlacementOrder = 'categories' | 'importance';
551
+ /**
552
+ * The appearance of one POI category. With the default `importance` order every category shares
553
+ * one placement layer, so categories may differ only in properties MapLibre evaluates per feature
554
+ * (image, size, colors, font, offsets); layer-wide properties such as zoom ranges, padding,
555
+ * overlap or `optional` must match, or the module uses `placement.order: 'categories'`.
556
+ */
557
+ type TileflowPoiCategoryStyle = Omit<TileflowMarkerSymbolStyle, 'priority'>;
542
558
  type TileflowPoiModuleConfig = {
543
559
  type: 'poi';
544
560
  categories?: readonly TileflowPoiCategory[];
545
561
  color?: TileflowPoiColorMode;
562
+ /** One density for the whole module: World's ranks decide what each category shows. */
546
563
  density?: TileflowPoiDensity;
547
564
  icons?: boolean;
548
565
  labels?: boolean;
549
566
  minZoom?: number;
550
567
  placement?: {
568
+ /**
569
+ * Places each pictogram with its name as one unit that needs room for both. Defaults to
570
+ * `false`.
571
+ */
551
572
  coupleIconAndLabel?: boolean;
552
573
  iconPadding?: number;
574
+ /**
575
+ * World POI `type` values whose pictogram explains them. When pictograms and names are both
576
+ * drawn, every other POI needs a name, and these types are drawn as a pictogram alone.
577
+ * Defaults to parking and public toilets.
578
+ */
579
+ iconOnlyTypes?: readonly string[];
580
+ /** Defaults to `importance`. */
581
+ order?: TileflowPoiPlacementOrder;
582
+ /**
583
+ * With the `importance` order, POIs whose World `filter_rank` is at most this value are placed
584
+ * before the map's road and place labels, and the others after them. A map that gives street
585
+ * names priority over POIs (labels `collisionPriority: 'navigation'`) keeps its landmarks this
586
+ * way. Unset, every POI is placed at the module's own position.
587
+ */
588
+ prominentRank?: 0 | 1 | 2 | 3 | 4 | 5;
553
589
  textPadding?: number;
554
590
  };
555
591
  styles?: Partial<Record<TileflowPoiCategory, TileflowPoiCategoryStyle>>;
@@ -668,6 +704,7 @@ type TileflowRuntimeSource = {
668
704
  map: string;
669
705
  };
670
706
  type TileflowRuntimeStyleOptions = {
707
+ timeOfDay?: TileflowTimeOfDay;
671
708
  colorScheme?: TileflowRuntimeColorScheme;
672
709
  manifestMap?: TileflowRuntimeManifestMap | null;
673
710
  source: TileflowRuntimeSource;
@@ -733,7 +770,7 @@ declare function resolveTileflowRuntimeThemeBlend(options: {
733
770
  declare function assertValidTileflowRuntimeSource(source: unknown): asserts source is TileflowRuntimeSource;
734
771
  declare function resolveTileflowRuntimeStyle(options: TileflowRuntimeStyleOptions): TileflowRuntimeStyle | null;
735
772
  /** Resolve one concrete published theme without consulting ambient browser state. */
736
- declare function resolveTileflowRuntimeTheme(map: TileflowRuntimeManifestMap, selection: TileflowThemeSelection | undefined, colorScheme?: TileflowRuntimeColorScheme): TileflowResolvedRuntimeTheme;
773
+ declare function resolveTileflowRuntimeTheme(map: TileflowRuntimeManifestMap, selection: TileflowThemeSelection | undefined, colorScheme?: TileflowRuntimeColorScheme, timeOfDay?: TileflowTimeOfDay): TileflowResolvedRuntimeTheme;
737
774
  /** Strictly reads Tileflow-owned web-font metadata from a compiled MapLibre style. */
738
775
  declare function getTileflowStyleFontFaces(style: Pick<MapLibreStyle, 'metadata'>): TileflowStyleFontFace[];
739
776
  declare function normalizeTileflowUrl(value: string): string;
@@ -769,6 +806,7 @@ declare function resolveTileflowStaticImageUrl(input: {
769
806
  } | null;
770
807
  manifestMap: TileflowRuntimeManifestMap | null;
771
808
  theme?: TileflowThemeSelection;
809
+ timeOfDay?: TileflowTimeOfDay;
772
810
  zoom: number;
773
811
  }): string | undefined;
774
812
  declare function normalizeTileflowStaticImageSize(input: {
@@ -780,8 +818,10 @@ declare function normalizeTileflowStaticImageSize(input: {
780
818
  };
781
819
  declare function inferTileflowAnalyticsFromStyleUrl(styleUrl: string): TileflowAnalytics | undefined;
782
820
 
783
- /** The first and only public multi-theme runtime manifest contract. */
821
+ /** The original public multi-theme runtime manifest contract. */
784
822
  declare const tileflowRuntimeManifestVersion: 1;
823
+ /** V2 adds the optional time-of-day catalog; maps without it still publish V1. */
824
+ declare const tileflowTimeOfDayManifestVersion: 2;
785
825
  declare const tileflowRuntimeManifestLimits: Readonly<{
786
826
  maximumBytes: number;
787
827
  }>;
@@ -807,6 +847,7 @@ type TileflowRuntimeManifestMapEntry = {
807
847
  mapId?: string;
808
848
  systemThemes?: TileflowRuntimeSystemThemes;
809
849
  themes: Record<string, TileflowRuntimeManifestTheme>;
850
+ timeOfDay?: TileflowTimeOfDayVariants;
810
851
  usageMode?: 'session';
811
852
  view?: TileflowViewConfig;
812
853
  worldGeneration?: 'v1';
@@ -820,7 +861,7 @@ type TileflowRuntimeManifestMapEntry = {
820
861
  type TileflowRuntimeManifest = {
821
862
  apiUrl?: string;
822
863
  maps: Record<string, TileflowRuntimeManifestMapEntry>;
823
- version: typeof tileflowRuntimeManifestVersion;
864
+ version: typeof tileflowRuntimeManifestVersion | typeof tileflowTimeOfDayManifestVersion;
824
865
  };
825
866
 
826
- export { type TileflowManifestFetchOptions as $, type TileflowAreaStyle as A, type TileflowBackgroundPaint as B, type TileflowCirclePaint as C, type TileflowColor as D, type TileflowColorStyleValue as E, type TileflowExtrusionPaint as F, type TileflowFillPaint as G, type TileflowIconAnchor as H, type TileflowIconLayout as I, type TileflowIconPaint as J, type TileflowIconStyle as K, type TileflowIconTextFit as L, type MapLibreStyle as M, type TileflowImageStyleValue as N, type TileflowLabelDetail as O, type TileflowLabelLanguage as P, type TileflowLabelStyles as Q, type TileflowLayerRange as R, type TileflowLight as S, type TileflowRuntimeManifest as T, type TileflowLineCap as U, type ValidationMessage as V, type TileflowLineHatchStyle as W, type TileflowLineJoin as X, type TileflowLineLayout as Y, type TileflowLinePaint as Z, type TileflowLineStackStyle as _, type TileflowRuntimeColorScheme as a, type TileflowTerrainMode as a$, type TileflowManifestLoadOptions as a0, type TileflowMapMode as a1, type TileflowMapModeOptions as a2, type TileflowMarkerSymbolStyle as a3, type TileflowMountainBikeScale as a4, type TileflowNumberInsetsStyleValue as a5, type TileflowNumberStyleValue as a6, type TileflowPlaceLabelClass as a7, type TileflowPoiCategory as a8, type TileflowPoiCategoryStyle as a9, type TileflowRoadTreatmentStyle as aA, type TileflowRoadWeight as aB, type TileflowRuntimeCenterLike as aC, type TileflowRuntimeManifestMap as aD, type TileflowRuntimeSource as aE, type TileflowRuntimeSourceValidation as aF, type TileflowRuntimeStyle as aG, type TileflowRuntimeStyleOptions as aH, type TileflowRuntimeViewOptions as aI, type TileflowSessionController as aJ, type TileflowSessionGrantResponse as aK, type TileflowStringStyleValue as aL, type TileflowStructuralStyleValue as aM, type TileflowStyleFontFace as aN, type TileflowStyleValue as aO, type TileflowSymbolOverlap as aP, type TileflowSymbolPlacement as aQ, type TileflowSymbolPlacementStyle as aR, type TileflowSymbolZOrder as aS, type TileflowTerrain as aT, type TileflowTerrainConfig as aU, type TileflowTerrainContourLabelStyle as aV, type TileflowTerrainContourLineStyle as aW, type TileflowTerrainContoursConfig as aX, type TileflowTerrainEncoding as aY, type TileflowTerrainHillshadeStyle as aZ, type TileflowTerrainLayerRange as a_, type TileflowPoiColorMode as aa, type TileflowPoiDensity as ab, type TileflowPriorityOrder as ac, type TileflowProjection as ad, type TileflowResolvedRuntimeTheme as ae, type TileflowRoadAreaStyle as af, type TileflowRoadClass as ag, type TileflowRoadClassStyle as ah, type TileflowRoadCrossingStyle as ai, type TileflowRoadDetail as aj, type TileflowRoadExtras as ak, type TileflowRoadHierarchy as al, type TileflowRoadLabelDetail as am, type TileflowRoadLayerStyle as an, type TileflowRoadModifier as ao, type TileflowRoadOutline as ap, type TileflowRoadRestriction as aq, type TileflowRoadRoundaboutStyle as ar, type TileflowRoadServiceType as as, type TileflowRoadShieldDetail as at, type TileflowRoadShieldStyles as au, type TileflowRoadSidewalkStyle as av, type TileflowRoadStreetLightStyle as aw, type TileflowRoadStructure as ax, type TileflowRoadTreatmentLayerStyle as ay, type TileflowRoadTreatmentLineStyle as az, type TileflowRuntimeManifestMapEntry as b, type TileflowTextAnchor as b0, type TileflowTextBackground as b1, type TileflowTextJustify as b2, type TileflowTextLayout as b3, type TileflowTextPaint as b4, type TileflowTextStyle as b5, type TileflowThemeBlendSelection as b6, type TileflowThemeColorAlpha as b7, type TileflowThemeColorMix as b8, type TileflowThemeColorValue as b9, normalizeTileflowStaticImageSize as bA, normalizeTileflowUrl as bB, resolveTileflowAnalyticsRequestUrl as bC, resolveTileflowManifestMap as bD, resolveTileflowMapMode as bE, resolveTileflowRuntimeStyle as bF, resolveTileflowRuntimeTheme as bG, resolveTileflowRuntimeThemeBlend as bH, resolveTileflowRuntimeView as bI, resolveTileflowStaticImageUrl as bJ, shouldLoadTileflowManifest as bK, startTileflowSession as bL, tileflowPoiCategories as bM, tileflowStyleFontFaceLimits as bN, tileflowStyleFontFacesMetadataKey as bO, tileflowThemeBlendLimits as bP, tileflowThemeTokenCategories as bQ, token as bR, validateTileflowRuntimeSource as bS, validateTileflowThemeBlendSelection as bT, validateTileflowThemeSelection as bU, zoom as bV, type TileflowTypographyStyle as bW, type ResolvedTileflowTypography as bX, normalizeTileflowSurfaceId as bY, type TileflowThemeFontValue as ba, type TileflowThemeImageValue as bb, type TileflowThemeNumberValue as bc, type TileflowThemeSelection as bd, type TileflowThemeTokenCategory as be, type TileflowThemeValue as bf, type TileflowViewConfig as bg, type TileflowWaterLabelClass as bh, type TileflowZoomInterpolation as bi, type TileflowZoomValue as bj, type ValidationResult as bk, assertValidTileflowRuntimeSource as bl, clearTileflowManifestCache as bm, color as bn, createTileflowSessionController as bo, createTileflowSessionId as bp, defaultTileflowManifestUrl as bq, defaultTileflowRuntimeView as br, fixed as bs, getTileflowAnalyticsApiUrl as bt, getTileflowStyleFontFaces as bu, inferTileflowAnalyticsFromStyleUrl as bv, loadTileflowManifest as bw, mergeTileflowAnalytics as bx, nearestTileflowBlendTheme as by, normalizeTileflowRuntimeCenter as bz, type TileflowRuntimeManifestTheme as c, type TileflowRuntimeSystemThemes as d, tileflowRuntimeManifestVersion as e, type TileflowExpression as f, type TileflowFixedValue as g, type TileflowThemeTokenReference as h, type TileflowThemeColorOperation as i, type TileflowBackgroundStyle as j, type TileflowCircleStyle as k, type TileflowExtrusionStyle as l, type TileflowFillStyle as m, type TileflowLineStyle as n, type TileflowSymbolStyle as o, type TileflowRoadsModuleOptions as p, type TileflowRoadsModuleConfig as q, type TileflowLabelsModuleOptions as r, type TileflowLabelsModuleConfig as s, tileflowRuntimeManifestLimits as t, type TileflowPoiModuleOptions as u, type TileflowPoiModuleConfig as v, type MapLibreSprite as w, type TileflowAerodromeCodeDetail as x, type TileflowAlignment as y, type TileflowAnalytics as z };
867
+ export { type TileflowLineLayout as $, type TileflowAerodromeCodeDetail as A, type TileflowAlignment as B, type TileflowAnalytics as C, type TileflowAreaStyle as D, type TileflowBackgroundPaint as E, type TileflowCirclePaint as F, type TileflowColor as G, type TileflowColorStyleValue as H, type TileflowExtrusionPaint as I, type TileflowFillPaint as J, type TileflowIconAnchor as K, type TileflowIconLayout as L, type MapLibreStyle as M, type TileflowIconPaint as N, type TileflowIconStyle as O, type TileflowIconTextFit as P, type TileflowImageStyleValue as Q, type TileflowLabelDetail as R, type TileflowLabelLanguage as S, type TileflowRuntimeManifest as T, type TileflowLabelStyles as U, type ValidationMessage as V, type TileflowLayerRange as W, type TileflowLight as X, type TileflowLineCap as Y, type TileflowLineHatchStyle as Z, type TileflowLineJoin as _, type TileflowRuntimeColorScheme as a, type TileflowTerrainContoursConfig as a$, type TileflowLinePaint as a0, type TileflowLineStackStyle as a1, type TileflowManifestFetchOptions as a2, type TileflowManifestLoadOptions as a3, type TileflowMapMode as a4, type TileflowMapModeOptions as a5, type TileflowMarkerSymbolStyle as a6, type TileflowMountainBikeScale as a7, type TileflowNumberInsetsStyleValue as a8, type TileflowNumberStyleValue as a9, type TileflowRoadStreetLightStyle as aA, type TileflowRoadStructure as aB, type TileflowRoadTreatmentLayerStyle as aC, type TileflowRoadTreatmentLineStyle as aD, type TileflowRoadTreatmentStyle as aE, type TileflowRoadWeight as aF, type TileflowRuntimeCenterLike as aG, type TileflowRuntimeManifestMap as aH, type TileflowRuntimeSource as aI, type TileflowRuntimeSourceValidation as aJ, type TileflowRuntimeStyle as aK, type TileflowRuntimeStyleOptions as aL, type TileflowRuntimeViewOptions as aM, type TileflowSessionController as aN, type TileflowSessionGrantResponse as aO, type TileflowStringStyleValue as aP, type TileflowStructuralStyleValue as aQ, type TileflowStyleFontFace as aR, type TileflowStyleValue as aS, type TileflowSymbolOverlap as aT, type TileflowSymbolPlacement as aU, type TileflowSymbolPlacementStyle as aV, type TileflowSymbolZOrder as aW, type TileflowTerrain as aX, type TileflowTerrainConfig as aY, type TileflowTerrainContourLabelStyle as aZ, type TileflowTerrainContourLineStyle as a_, type TileflowPlaceLabelClass as aa, type TileflowPoiCategory as ab, type TileflowPoiCategoryStyle as ac, type TileflowPoiColorMode as ad, type TileflowPoiDensity as ae, type TileflowPoiPlacementOrder as af, type TileflowPriorityOrder as ag, type TileflowProjection as ah, type TileflowResolvedRuntimeTheme as ai, type TileflowRoadAreaStyle as aj, type TileflowRoadClass as ak, type TileflowRoadClassStyle as al, type TileflowRoadCrossingStyle as am, type TileflowRoadDetail as an, type TileflowRoadExtras as ao, type TileflowRoadHierarchy as ap, type TileflowRoadLabelDetail as aq, type TileflowRoadLayerStyle as ar, type TileflowRoadModifier as as, type TileflowRoadOutline as at, type TileflowRoadRestriction as au, type TileflowRoadRoundaboutStyle as av, type TileflowRoadServiceType as aw, type TileflowRoadShieldDetail as ax, type TileflowRoadShieldStyles as ay, type TileflowRoadSidewalkStyle as az, type TileflowRuntimeManifestMapEntry as b, zoom as b$, type TileflowTerrainEncoding as b0, type TileflowTerrainHillshadeStyle as b1, type TileflowTerrainLayerRange as b2, type TileflowTerrainMode as b3, type TileflowTextAnchor as b4, type TileflowTextBackground as b5, type TileflowTextJustify as b6, type TileflowTextLayout as b7, type TileflowTextPaint as b8, type TileflowTextStyle as b9, isTileflowTimeOfDay as bA, loadTileflowManifest as bB, mergeTileflowAnalytics as bC, nearestTileflowBlendTheme as bD, normalizeTileflowRuntimeCenter as bE, normalizeTileflowStaticImageSize as bF, normalizeTileflowUrl as bG, resolveTileflowAnalyticsRequestUrl as bH, resolveTileflowManifestMap as bI, resolveTileflowMapMode as bJ, resolveTileflowRuntimeStyle as bK, resolveTileflowRuntimeTheme as bL, resolveTileflowRuntimeThemeBlend as bM, resolveTileflowRuntimeView as bN, resolveTileflowStaticImageUrl as bO, shouldLoadTileflowManifest as bP, startTileflowSession as bQ, tileflowPoiCategories as bR, tileflowStyleFontFaceLimits as bS, tileflowStyleFontFacesMetadataKey as bT, tileflowThemeBlendLimits as bU, tileflowThemeTokenCategories as bV, tileflowTimesOfDay as bW, token as bX, validateTileflowRuntimeSource as bY, validateTileflowThemeBlendSelection as bZ, validateTileflowThemeSelection as b_, type TileflowThemeBlendSelection as ba, type TileflowThemeColorAlpha as bb, type TileflowThemeColorMix as bc, type TileflowThemeColorValue as bd, type TileflowThemeFontValue as be, type TileflowThemeImageValue as bf, type TileflowThemeNumberValue as bg, type TileflowThemeSelection as bh, type TileflowThemeTokenCategory as bi, type TileflowThemeValue as bj, type TileflowViewConfig as bk, type TileflowWaterLabelClass as bl, type TileflowZoomInterpolation as bm, type TileflowZoomValue as bn, type ValidationResult as bo, assertValidTileflowRuntimeSource as bp, clearTileflowManifestCache as bq, color as br, createTileflowSessionController as bs, createTileflowSessionId as bt, defaultTileflowManifestUrl as bu, defaultTileflowRuntimeView as bv, fixed as bw, getTileflowAnalyticsApiUrl as bx, getTileflowStyleFontFaces as by, inferTileflowAnalyticsFromStyleUrl as bz, type TileflowRuntimeManifestTheme as c, type TileflowTypographyStyle as c0, type ResolvedTileflowTypography as c1, normalizeTileflowSurfaceId as c2, type TileflowRuntimeSystemThemes as d, type TileflowTimeOfDay as e, type TileflowTimeOfDayVariants as f, tileflowRuntimeManifestVersion as g, tileflowTimeOfDayManifestVersion as h, type TileflowExpression as i, type TileflowFixedValue as j, type TileflowThemeTokenReference as k, type TileflowThemeColorOperation as l, type TileflowBackgroundStyle as m, type TileflowCircleStyle as n, type TileflowExtrusionStyle as o, type TileflowFillStyle as p, type TileflowLineStyle as q, type TileflowSymbolStyle as r, type TileflowRoadsModuleOptions as s, tileflowRuntimeManifestLimits as t, type TileflowRoadsModuleConfig as u, type TileflowLabelsModuleOptions as v, type TileflowLabelsModuleConfig as w, type TileflowPoiModuleOptions as x, type TileflowPoiModuleConfig as y, type MapLibreSprite as z };
@@ -1,6 +1,6 @@
1
+ import { T as TileflowRuntimeManifest } from './manifest-types-Bzxon3dx.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-Bzxon3dx.js';
1
3
  import { z } from 'zod';
2
- import { T as TileflowRuntimeManifest } from './manifest-types-hmzy2bBX.js';
3
- export { a as TileflowRuntimeColorScheme, b as TileflowRuntimeManifestMapEntry, c as TileflowRuntimeManifestTheme, d as TileflowRuntimeSystemThemes, t as tileflowRuntimeManifestLimits, e as tileflowRuntimeManifestVersion } from './manifest-types-hmzy2bBX.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,5 +1,6 @@
1
1
  // src/manifest-types.ts
2
2
  var tileflowRuntimeManifestVersion = 1;
3
+ var tileflowTimeOfDayManifestVersion = 2;
3
4
  var tileflowRuntimeManifestLimits = Object.freeze({ maximumBytes: 1024 * 1024 });
4
5
 
5
6
  // src/portable-identity-rules.ts
@@ -48,6 +49,43 @@ function createTileflowRuntimeViewSchema(operations) {
48
49
  });
49
50
  }
50
51
 
52
+ // src/time-of-day.ts
53
+ var tileflowTimesOfDay = ["day", "dawn", "dusk", "night"];
54
+ function isTileflowTimeOfDay(value) {
55
+ return typeof value === "string" && tileflowTimesOfDay.includes(value);
56
+ }
57
+ function validateTileflowTimeOfDayVariants(variants, themes) {
58
+ const issues = [];
59
+ const owners = /* @__PURE__ */ new Map();
60
+ const families = Object.entries(variants);
61
+ for (const [family, moments] of families) {
62
+ if (!isTileflowThemeName(family) || !Object.hasOwn(themes, family)) {
63
+ issues.push({ path: [family], message: "Time-of-day family must name an existing theme" });
64
+ }
65
+ if (!Object.values(moments).includes(family)) {
66
+ issues.push({ path: [family], message: "A family must include its own theme in its presets" });
67
+ }
68
+ for (const [moment, name] of Object.entries(moments)) {
69
+ if (name === void 0) continue;
70
+ if (!isTileflowTimeOfDay(moment) || !isTileflowThemeName(name) || !Object.hasOwn(themes, name)) {
71
+ issues.push({
72
+ path: [family, moment],
73
+ message: "Expected a supported moment and an existing theme"
74
+ });
75
+ }
76
+ const owner = owners.get(name);
77
+ if (owner !== void 0 && owner !== family) {
78
+ issues.push({
79
+ path: [family, moment],
80
+ message: `Theme "${name}" already belongs to family "${owner}"`
81
+ });
82
+ }
83
+ owners.set(name, family);
84
+ }
85
+ }
86
+ return issues;
87
+ }
88
+
51
89
  // src/themes/model.ts
52
90
  var tileflowThemeLimits = Object.freeze({ maxThemes: 64 });
53
91
  var themeTypographyStyleKeys = ["fallbacks", "font", "letterSpacing", "transform"];
@@ -59,6 +97,19 @@ var themeTypographyKeys = [
59
97
  "water"
60
98
  ];
61
99
 
100
+ // src/time-of-day-schema.ts
101
+ function createTileflowTimeOfDaySchema(operations, themeName) {
102
+ return operations.record(
103
+ themeName,
104
+ operations.object({
105
+ day: operations.optional(themeName),
106
+ dawn: operations.optional(themeName),
107
+ dusk: operations.optional(themeName),
108
+ night: operations.optional(themeName)
109
+ })
110
+ );
111
+ }
112
+
62
113
  // src/manifest-schema.ts
63
114
  function createTileflowRuntimeManifestSchema(primitives, operations, identities = createPortableIdentitySchemas(operations)) {
64
115
  const { tileflowPortableIdSchema: tileflowPortableIdSchema2, tileflowThemeNameSchema: tileflowThemeNameSchema2 } = identities;
@@ -114,12 +165,24 @@ function createTileflowRuntimeManifestSchema(primitives, operations, identities
114
165
  })
115
166
  ),
116
167
  themes: operations.record(tileflowThemeNameSchema2, manifestThemeSchema),
168
+ timeOfDay: operations.optional(
169
+ createTileflowTimeOfDaySchema(operations, tileflowThemeNameSchema2)
170
+ ),
117
171
  usageMode: operations.optional(operations.literal("session")),
118
172
  view: operations.optional(viewSchema),
119
173
  worldGeneration: operations.optional(operations.literal("v1"))
120
174
  }),
121
175
  (entry, context) => {
122
176
  const names = Object.keys(entry.themes);
177
+ if (entry.timeOfDay) {
178
+ for (const issue of validateTileflowTimeOfDayVariants(entry.timeOfDay, entry.themes)) {
179
+ context.addIssue({
180
+ code: "custom",
181
+ message: issue.message,
182
+ path: ["timeOfDay", ...issue.path]
183
+ });
184
+ }
185
+ }
123
186
  if (names.length === 0) {
124
187
  context.addIssue({
125
188
  code: "custom",
@@ -173,10 +236,23 @@ function createTileflowRuntimeManifestSchema(primitives, operations, identities
173
236
  operations.object({
174
237
  apiUrl: operations.optional(apiOriginSchema),
175
238
  maps: operations.record(tileflowPortableIdSchema2, manifestMapSchema),
176
- version: operations.literal(tileflowRuntimeManifestVersion)
239
+ version: operations.union(
240
+ operations.literal(tileflowRuntimeManifestVersion),
241
+ operations.literal(2)
242
+ )
177
243
  }),
178
244
  (manifest, context) => {
179
245
  const mapCount = Object.keys(manifest.maps).length;
246
+ if (manifest.version === 1) {
247
+ for (const [name, map] of Object.entries(manifest.maps)) {
248
+ if (map.timeOfDay !== void 0)
249
+ context.addIssue({
250
+ code: "custom",
251
+ message: "timeOfDay requires manifest version 2",
252
+ path: ["maps", name, "timeOfDay"]
253
+ });
254
+ }
255
+ }
180
256
  if (mapCount === 0) {
181
257
  context.addIssue({ code: "custom", message: "Expected at least one map", path: ["maps"] });
182
258
  }
@@ -326,6 +402,7 @@ var classicManifestSchemaOperations = {
326
402
  return z2.enum(values);
327
403
  },
328
404
  literal: (value) => z2.literal(value),
405
+ union: (left, right) => z2.union([classic(left), classic(right)]),
329
406
  tuplePair(left, right) {
330
407
  return z2.tuple([classic(left), classic(right)]);
331
408
  },
@@ -364,5 +441,6 @@ export {
364
441
  safeParseTileflowRuntimeManifest,
365
442
  tileflowRuntimeManifestLimits,
366
443
  tileflowRuntimeManifestSchema,
367
- tileflowRuntimeManifestVersion
444
+ tileflowRuntimeManifestVersion,
445
+ tileflowTimeOfDayManifestVersion
368
446
  };
@@ -8744,6 +8744,7 @@ var classicManifestSchemaOperations = {
8744
8744
  return z3.enum(values);
8745
8745
  },
8746
8746
  literal: (value) => z3.literal(value),
8747
+ union: (left, right) => z3.union([classic(left), classic(right)]),
8747
8748
  tuplePair(left, right) {
8748
8749
  return z3.tuple([classic(left), classic(right)]);
8749
8750
  },
package/dist/native.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /** Artistic presets; selecting one never starts a clock or moves the real sun. */
2
+ declare const tileflowTimesOfDay: readonly ["day", "dawn", "dusk", "night"];
3
+ type TileflowTimeOfDay = (typeof tileflowTimesOfDay)[number];
4
+ /** A named theme family points to complete, already compiled themes. */
5
+ type TileflowTimeOfDayVariants = Readonly<Record<string, Readonly<Partial<Record<TileflowTimeOfDay, string>>>>>;
6
+
1
7
  /** URL resolution for native clients, without a renderer or an ambient application origin. */
2
8
  declare const tileflowNativeUrlLimits: Readonly<{
3
9
  maximumLength: 2048;
@@ -93,8 +99,10 @@ declare function validateTileflowThemeBlendSelection(value: unknown): value is T
93
99
  /** The theme nearest to a blend position, which a blend shows when it cannot blend. */
94
100
  declare function nearestTileflowBlendTheme(blend: TileflowThemeBlendSelection): string;
95
101
 
96
- /** The first and only public multi-theme runtime manifest contract. */
102
+ /** The original public multi-theme runtime manifest contract. */
97
103
  declare const tileflowRuntimeManifestVersion: 1;
104
+ /** V2 adds the optional time-of-day catalog; maps without it still publish V1. */
105
+ declare const tileflowTimeOfDayManifestVersion: 2;
98
106
  type TileflowRuntimeColorScheme = 'dark' | 'light';
99
107
  type TileflowRuntimeManifestTheme = {
100
108
  colorScheme: TileflowRuntimeColorScheme;
@@ -117,6 +125,7 @@ type TileflowRuntimeManifestMapEntry = {
117
125
  mapId?: string;
118
126
  systemThemes?: TileflowRuntimeSystemThemes;
119
127
  themes: Record<string, TileflowRuntimeManifestTheme>;
128
+ timeOfDay?: TileflowTimeOfDayVariants;
120
129
  usageMode?: 'session';
121
130
  view?: TileflowViewConfig;
122
131
  worldGeneration?: 'v1';
@@ -130,7 +139,7 @@ type TileflowRuntimeManifestMapEntry = {
130
139
  type TileflowRuntimeManifest = {
131
140
  apiUrl?: string;
132
141
  maps: Record<string, TileflowRuntimeManifestMapEntry>;
133
- version: typeof tileflowRuntimeManifestVersion;
142
+ version: typeof tileflowRuntimeManifestVersion | typeof tileflowTimeOfDayManifestVersion;
134
143
  };
135
144
 
136
145
  /** The adapter must honor the requested read bound, without first buffering an unbounded body. */
@@ -179,6 +188,7 @@ type TileflowNativeSource = {
179
188
  };
180
189
  type TileflowNativeSourceOptions = {
181
190
  theme?: string;
191
+ timeOfDay?: TileflowTimeOfDay;
182
192
  /** Required only for theme="system"; no ambient appearance access. */
183
193
  colorScheme?: TileflowRuntimeColorScheme;
184
194
  signal?: TileflowNativeAbortSignal;
@@ -352,4 +362,4 @@ declare function planTileflowThemeBlend(styles: readonly MapLibreStyle[], option
352
362
  /** Fills one blend template for a position. Plain values pass through unchanged. */
353
363
  declare function fillTileflowThemeBlendTemplate(template: unknown, position: number): unknown;
354
364
 
355
- export { type TileflowNativeAbortSignal, type TileflowNativeInitialView, type TileflowNativeInitialViewOptions, type TileflowNativeManifestAcquire, type TileflowNativeManifestLoadOptions, type TileflowNativeManifestOperation, type TileflowNativeManifestReader, type TileflowNativeManifestResponse, type TileflowNativeManifestResult, type TileflowNativeNetworkOptions, type TileflowNativeResourceUrlOptions, type TileflowNativeSource, type TileflowNativeSourceController, TileflowNativeSourceError, type TileflowNativeSourceErrorCode, type TileflowNativeSourceErrorField, type TileflowNativeSourceOptions, type TileflowNativeSourceState, TileflowNativeUrlError, type TileflowNativeUrlErrorCode, type TileflowNativeUrlField, type TileflowThemeBlendClock, TileflowThemeBlendError, type TileflowThemeBlendImage, type TileflowThemeBlendOptions, type TileflowThemeBlendPaint, type TileflowThemeBlendPlan, type TileflowThemeBlendSelection, type TileflowThemeBlendSwitch, createTileflowNativeSourceController, fillTileflowThemeBlendTemplate, loadTileflowNativeManifest, nearestTileflowBlendTheme, planTileflowThemeBlend, resolveTileflowNativeInitialView, resolveTileflowNativeManifestUrl, resolveTileflowNativeResourceUrl, tileflowNativeManifestLimits, tileflowNativeUrlLimits, tileflowThemeBlendLimits, validateTileflowThemeBlendSelection };
365
+ export { type TileflowNativeAbortSignal, type TileflowNativeInitialView, type TileflowNativeInitialViewOptions, type TileflowNativeManifestAcquire, type TileflowNativeManifestLoadOptions, type TileflowNativeManifestOperation, type TileflowNativeManifestReader, type TileflowNativeManifestResponse, type TileflowNativeManifestResult, type TileflowNativeNetworkOptions, type TileflowNativeResourceUrlOptions, type TileflowNativeSource, type TileflowNativeSourceController, TileflowNativeSourceError, type TileflowNativeSourceErrorCode, type TileflowNativeSourceErrorField, type TileflowNativeSourceOptions, type TileflowNativeSourceState, TileflowNativeUrlError, type TileflowNativeUrlErrorCode, type TileflowNativeUrlField, type TileflowThemeBlendClock, TileflowThemeBlendError, type TileflowThemeBlendImage, type TileflowThemeBlendOptions, type TileflowThemeBlendPaint, type TileflowThemeBlendPlan, type TileflowThemeBlendSelection, type TileflowThemeBlendSwitch, type TileflowTimeOfDay, type TileflowTimeOfDayVariants, createTileflowNativeSourceController, fillTileflowThemeBlendTemplate, loadTileflowNativeManifest, nearestTileflowBlendTheme, planTileflowThemeBlend, resolveTileflowNativeInitialView, resolveTileflowNativeManifestUrl, resolveTileflowNativeResourceUrl, tileflowNativeManifestLimits, tileflowNativeUrlLimits, tileflowThemeBlendLimits, validateTileflowThemeBlendSelection };