@tileflow/dev 0.1.0-alpha.32 → 0.1.0-alpha.33

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/dist/fonts.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TileflowFontBundleManifest, MapLibreStyle } from '@tileflow/core';
2
2
  import { TileflowEffectiveFontSourceIdentity, TileflowBuildStyles, TileflowBuildCatalog } from '@tileflow/core/build';
3
- import { T as TileflowBuildAsset } from './icons-B84H8Ymu.js';
3
+ import { T as TileflowBuildAsset } from './icons-BdOehQmB.js';
4
4
 
5
5
  type TileflowFontCompilationTarget = 'hosted' | 'local';
6
6
  type TileflowFontCompilationIssue = {
@@ -1,4 +1,4 @@
1
- import { TileflowIconAppearance, TileflowIconLayoutMetadata, TileflowIconSetPin, TileflowLandmarkRegion, TileflowModelDirectory, TileflowTreeModel, TileflowIconSpriteIndex, TileflowIconSource, TileflowIconsLockfileV1, TileflowIconCompositionV1, TileflowIconPackageFileName, TileflowIconPackageManifest, TileflowIconDirectory } from '@tileflow/core';
1
+ import { TileflowIconAppearance, TileflowIconLayoutMetadata, TileflowIconSetPin, TileflowLandmarkRegion, TileflowModelBundleManifest, TileflowModelDirectory, TileflowTreeModel, TileflowIconSpriteIndex, TileflowIconSource, TileflowIconsLockfileV1, TileflowIconCompositionV1, TileflowIconPackageFileName, TileflowIconPackageManifest, TileflowIconDirectory } from '@tileflow/core';
2
2
  import { TileflowEffectiveModelSourceIdentity, TileflowEffectiveIconSourceIdentity, TileflowBuildCatalog, TileflowPreparedMapAssets } from '@tileflow/core/build';
3
3
 
4
4
  type TileflowRenderedIconCell = {
@@ -43,6 +43,7 @@ type PreparedTileflowBuildingModel = {
43
43
  /** Its file name, content-addressed: `<id>-<first 16 hex of its SHA-256>.glb`. */
44
44
  fileName: string;
45
45
  bytes: Uint8Array;
46
+ sha256: string;
46
47
  };
47
48
  /** A building model's glTF binaries, nearest level first. */
48
49
  type TileflowBuildingModelLevels = Readonly<{
@@ -88,6 +89,23 @@ declare function encodeTileflowLandmarkRegion(region: TileflowLandmarkRegion): {
88
89
  bytes: Uint8Array;
89
90
  sha256: string;
90
91
  };
92
+ /** A map's building models as the model bundle a hosted deploy uploads before its styles. */
93
+ type TileflowModelBundle = {
94
+ /** The SHA-256 of the manifest's canonical JSON. */
95
+ contentHash: string;
96
+ manifest: TileflowModelBundleManifest;
97
+ /** Each model's prepared file, named as the manifest names it. */
98
+ files: {
99
+ contentType: string;
100
+ fileName: string;
101
+ source: Uint8Array;
102
+ }[];
103
+ };
104
+ /**
105
+ * Bundles a map's prepared building models, or returns undefined when it has none. Throws a
106
+ * `RangeError` an author can act on when the models together are too large to host.
107
+ */
108
+ declare function createTileflowModelBundle(buildings: Readonly<Record<string, PreparedTileflowBuildingModel>>): Promise<TileflowModelBundle | undefined>;
91
109
  type PreparedTileflowTreeModels = {
92
110
  /** The prepared tree models by id. */
93
111
  models: Record<string, TileflowTreeModel>;
@@ -403,4 +421,4 @@ declare function readTileflowIconDirectory(source: TileflowIconDirectory, option
403
421
  target: TileflowIconCompilationTarget;
404
422
  }): Promise<ReadTileflowIconDirectoryResult>;
405
423
 
406
- export { renderTileflowIconAtlasPreview as $, type TileflowIconCompilationIssue as A, type TileflowIconCompilationTarget as B, type CompileTileflowIconPackagesOptions as C, type TileflowIconDirectoryEntry as D, type TileflowIconDirectorySourceFile as E, type TileflowIconReplacement as F, type TileflowMapIconPackageBinding as G, type TileflowRenderedIcon as H, type InspectTileflowIconCatalogsOptions as I, type TileflowRenderedIconCell as J, compileTileflowIconPackages as K, composeTileflowIconSources as L, getTileflowIconCacheDirectory as M, getTileflowIconWatchPaths as N, iconFileExtensions as O, type PreparedTileflowBuildCatalog as P, inspectTileflowIconCatalogs as Q, type ReadTileflowIconDirectoryResult as R, loadTileflowIconSetArtifact as S, type TileflowBuildAsset as T, packTileflowRenderedIcons as U, type VerifiedTileflowIconArtifact as V, prepareTileflowCatalogIcons as W, prepareTileflowMapTreeModels as X, readTileflowIconDirectory as Y, readTileflowIconsLockfile as Z, readTileflowIconsLockfileText as _, type TileflowIconResolutionOptions as a, storeTileflowIconSetArtifact as a0, verifyTileflowIconArtifact as a1, writeTileflowIconsLockfile as a2, type TileflowSourceCatalog as b, type PreparedTileflowCatalog as c, type TileflowBuildingModelLevels as d, type TileflowLandmarkSource as e, encodeTileflowLandmarkRegion as f, prepareTileflowBuildingModel as g, type CompileTileflowIconPackagesResult as h, type CompiledTileflowIconPackage as i, type CompiledTileflowIconPackageFile as j, type ComposeTileflowIconSourcesOptions as k, type TileflowComposedIconContributor as l, type TileflowComposedIconSources as m, type TileflowComposedIconWinner as n, type TileflowIconCacheOptions as o, packageTileflowLandmarkTile as p, type TileflowIconCatalog as q, type TileflowIconCatalogAtlasRectangle as r, type TileflowIconCatalogContributor as s, type TileflowIconCatalogIcon as t, type TileflowIconCatalogIconSource as u, type TileflowIconCatalogInspection as v, type TileflowIconCatalogMap as w, type TileflowIconCatalogRenderedDensity as x, type TileflowIconCatalogSourceFormat as y, TileflowIconCompilationError as z };
424
+ export { readTileflowIconDirectory as $, TileflowIconCompilationError as A, type TileflowIconCompilationIssue as B, type CompileTileflowIconPackagesOptions as C, type TileflowIconCompilationTarget as D, type TileflowIconDirectoryEntry as E, type TileflowIconDirectorySourceFile as F, type TileflowIconReplacement as G, type TileflowMapIconPackageBinding as H, type InspectTileflowIconCatalogsOptions as I, type TileflowModelBundle as J, type TileflowRenderedIcon as K, type TileflowRenderedIconCell as L, compileTileflowIconPackages as M, composeTileflowIconSources as N, createTileflowModelBundle as O, type PreparedTileflowBuildCatalog as P, getTileflowIconCacheDirectory as Q, type ReadTileflowIconDirectoryResult as R, getTileflowIconWatchPaths as S, type TileflowBuildAsset as T, iconFileExtensions as U, type VerifiedTileflowIconArtifact as V, inspectTileflowIconCatalogs as W, loadTileflowIconSetArtifact as X, packTileflowRenderedIcons as Y, prepareTileflowCatalogIcons as Z, prepareTileflowMapTreeModels as _, type TileflowIconResolutionOptions as a, readTileflowIconsLockfile as a0, readTileflowIconsLockfileText as a1, renderTileflowIconAtlasPreview as a2, storeTileflowIconSetArtifact as a3, verifyTileflowIconArtifact as a4, writeTileflowIconsLockfile as a5, type TileflowSourceCatalog as b, type PreparedTileflowCatalog as c, type TileflowBuildingModelLevels as d, type TileflowLandmarkSource as e, encodeTileflowLandmarkRegion as f, prepareTileflowBuildingModel as g, type CompileTileflowIconPackagesResult as h, type CompiledTileflowIconPackage as i, type CompiledTileflowIconPackageFile as j, type ComposeTileflowIconSourcesOptions as k, type PreparedTileflowBuildingModel as l, type TileflowComposedIconContributor as m, type TileflowComposedIconSources as n, type TileflowComposedIconWinner as o, packageTileflowLandmarkTile as p, type TileflowIconCacheOptions as q, type TileflowIconCatalog as r, type TileflowIconCatalogAtlasRectangle as s, type TileflowIconCatalogContributor as t, type TileflowIconCatalogIcon as u, type TileflowIconCatalogIconSource as v, type TileflowIconCatalogInspection as w, type TileflowIconCatalogMap as x, type TileflowIconCatalogRenderedDensity as y, type TileflowIconCatalogSourceFormat as z };
package/dist/icons.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import '@tileflow/core';
2
2
  import '@tileflow/core/build';
3
- export { C as CompileTileflowIconPackagesOptions, h as CompileTileflowIconPackagesResult, i as CompiledTileflowIconPackage, j as CompiledTileflowIconPackageFile, k as ComposeTileflowIconSourcesOptions, I as InspectTileflowIconCatalogsOptions, P as PreparedTileflowBuildCatalog, c as PreparedTileflowCatalog, R as ReadTileflowIconDirectoryResult, T as TileflowBuildAsset, l as TileflowComposedIconContributor, m as TileflowComposedIconSources, n as TileflowComposedIconWinner, o as TileflowIconCacheOptions, q as TileflowIconCatalog, r as TileflowIconCatalogAtlasRectangle, s as TileflowIconCatalogContributor, t as TileflowIconCatalogIcon, u as TileflowIconCatalogIconSource, v as TileflowIconCatalogInspection, w as TileflowIconCatalogMap, x as TileflowIconCatalogRenderedDensity, y as TileflowIconCatalogSourceFormat, z as TileflowIconCompilationError, A as TileflowIconCompilationIssue, B as TileflowIconCompilationTarget, D as TileflowIconDirectoryEntry, E as TileflowIconDirectorySourceFile, F as TileflowIconReplacement, a as TileflowIconResolutionOptions, G as TileflowMapIconPackageBinding, H as TileflowRenderedIcon, J as TileflowRenderedIconCell, b as TileflowSourceCatalog, V as VerifiedTileflowIconArtifact, K as compileTileflowIconPackages, L as composeTileflowIconSources, M as getTileflowIconCacheDirectory, N as getTileflowIconWatchPaths, O as iconFileExtensions, Q as inspectTileflowIconCatalogs, S as loadTileflowIconSetArtifact, U as packTileflowRenderedIcons, W as prepareTileflowCatalogIcons, X as prepareTileflowMapTreeModels, Y as readTileflowIconDirectory, Z as readTileflowIconsLockfile, _ as readTileflowIconsLockfileText, $ as renderTileflowIconAtlasPreview, a0 as storeTileflowIconSetArtifact, a1 as verifyTileflowIconArtifact, a2 as writeTileflowIconsLockfile } from './icons-B84H8Ymu.js';
3
+ export { C as CompileTileflowIconPackagesOptions, h as CompileTileflowIconPackagesResult, i as CompiledTileflowIconPackage, j as CompiledTileflowIconPackageFile, k as ComposeTileflowIconSourcesOptions, I as InspectTileflowIconCatalogsOptions, P as PreparedTileflowBuildCatalog, l as PreparedTileflowBuildingModel, c as PreparedTileflowCatalog, R as ReadTileflowIconDirectoryResult, T as TileflowBuildAsset, m as TileflowComposedIconContributor, n as TileflowComposedIconSources, o as TileflowComposedIconWinner, q as TileflowIconCacheOptions, r as TileflowIconCatalog, s as TileflowIconCatalogAtlasRectangle, t as TileflowIconCatalogContributor, u as TileflowIconCatalogIcon, v as TileflowIconCatalogIconSource, w as TileflowIconCatalogInspection, x as TileflowIconCatalogMap, y as TileflowIconCatalogRenderedDensity, z as TileflowIconCatalogSourceFormat, A as TileflowIconCompilationError, B as TileflowIconCompilationIssue, D as TileflowIconCompilationTarget, E as TileflowIconDirectoryEntry, F as TileflowIconDirectorySourceFile, G as TileflowIconReplacement, a as TileflowIconResolutionOptions, H as TileflowMapIconPackageBinding, J as TileflowModelBundle, K as TileflowRenderedIcon, L as TileflowRenderedIconCell, b as TileflowSourceCatalog, V as VerifiedTileflowIconArtifact, M as compileTileflowIconPackages, N as composeTileflowIconSources, O as createTileflowModelBundle, Q as getTileflowIconCacheDirectory, S as getTileflowIconWatchPaths, U as iconFileExtensions, W as inspectTileflowIconCatalogs, X as loadTileflowIconSetArtifact, Y as packTileflowRenderedIcons, Z as prepareTileflowCatalogIcons, _ as prepareTileflowMapTreeModels, $ as readTileflowIconDirectory, a0 as readTileflowIconsLockfile, a1 as readTileflowIconsLockfileText, a2 as renderTileflowIconAtlasPreview, a3 as storeTileflowIconSetArtifact, a4 as verifyTileflowIconArtifact, a5 as writeTileflowIconsLockfile } from './icons-BdOehQmB.js';
package/dist/icons.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  TileflowIconCompilationError,
3
3
  compileTileflowIconPackages,
4
4
  composeTileflowIconSources,
5
+ createTileflowModelBundle,
5
6
  getTileflowIconCacheDirectory,
6
7
  getTileflowIconWatchPaths,
7
8
  iconFileExtensions,
@@ -17,12 +18,13 @@ import {
17
18
  storeTileflowIconSetArtifact,
18
19
  verifyTileflowIconArtifact,
19
20
  writeTileflowIconsLockfile
20
- } from "./chunk-F4PLTZS4.js";
21
+ } from "./chunk-QYU4OW5A.js";
21
22
  import "./chunk-7C4F6GAX.js";
22
23
  export {
23
24
  TileflowIconCompilationError,
24
25
  compileTileflowIconPackages,
25
26
  composeTileflowIconSources,
27
+ createTileflowModelBundle,
26
28
  getTileflowIconCacheDirectory,
27
29
  getTileflowIconWatchPaths,
28
30
  iconFileExtensions,
package/dist/preview.js CHANGED
@@ -196,6 +196,40 @@ var previewSceneClient = String.raw`
196
196
  };
197
197
  `;
198
198
 
199
+ // src/preview-scene-themes.ts
200
+ function createPreviewSceneThemes(map, readSun) {
201
+ const cache = {
202
+ value: void 0,
203
+ snapshot() {
204
+ if (!cache.value) {
205
+ const metadata = map.getStyle()?.metadata;
206
+ cache.value = { metadata, sun: readSun(metadata) };
207
+ }
208
+ return cache.value;
209
+ },
210
+ invalidate() {
211
+ cache.value = void 0;
212
+ },
213
+ release() {
214
+ map.off("styledata", cache.invalidate);
215
+ map.off("style.load", cache.invalidate);
216
+ map.off("remove", cache.release);
217
+ cache.invalidate();
218
+ }
219
+ };
220
+ map.on("styledata", cache.invalidate);
221
+ map.on("style.load", cache.invalidate);
222
+ map.on("remove", cache.release);
223
+ return {
224
+ getSun() {
225
+ return cache.snapshot().sun;
226
+ },
227
+ getThemeMetadata(key) {
228
+ return { values: [cache.snapshot().metadata?.[key]], position: 0 };
229
+ }
230
+ };
231
+ }
232
+
199
233
  // src/preview-html.ts
200
234
  function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticPreview, fontFaces = [], fitViewport = false, controls) {
201
235
  const styleUrl = preview ? `${basePath}/styles/${preview.mapName}/${preview.themeName}.json${controls ? `?${new URLSearchParams({ controls })}` : ""}` : void 0;
@@ -372,7 +406,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
372
406
  if (values[0] === "off") return false;
373
407
  return fallback;
374
408
  }
375
- let threeDimensionalEnabled = readToggleFromUrl("buildings3d", false);
409
+ let threeDimensionalEnabled = readToggleFromUrl("buildings3d", true);
376
410
  let treesEnabled = readToggleFromUrl("trees3d", true);
377
411
  const landmarkState = {
378
412
  active: [],
@@ -1985,7 +2019,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
1985
2019
  // buildings, trees and street lights look, and the controls only show and hide them. The
1986
2020
  // vegetation control hides all trees when off. The preview shows one theme at a
1987
2021
  // time, so the style on screen holds the sun and the design.
1988
- const coreScene = {buildings: undefined, trees: undefined, lights: undefined, buildingsShown: false, animation: "0"};
2022
+ const coreScene = {buildings: undefined, trees: undefined, lights: undefined, buildingsShown: undefined, animation: "0"};
1989
2023
  const runtimeLayerVisibility = {};
1990
2024
  globalThis.__tileflowPreviewScene = coreScene;
1991
2025
  globalThis.__tileflowRuntimeVisibility = (id, visible) => {
@@ -2001,16 +2035,16 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
2001
2035
  ...(coreScene.trees ? {"tileflow-trees-3d": {controller:"Vegetation", state:{visible:runtimeLayerVisibility["tileflow-trees-3d"] !== false, representation:coreScene.trees.representation}, stats:coreScene.trees.stats}} : {}),
2002
2036
  ...(coreScene.lights ? {"tileflow-street-lights": {controller:"Street lights", state:{visible:runtimeLayerVisibility["tileflow-street-lights"] !== false, mounted:true}, stats:coreScene.lights.stats}} : {})
2003
2037
  });
2038
+ const createPreviewSceneThemes = ${createPreviewSceneThemes.toString()};
2039
+ const coreSceneThemeControllers = new WeakMap();
2004
2040
  function coreSceneThemes(map) {
2005
- return {
2006
- getSun() {
2007
- const preset = readTileflowSunPreset(map.getStyle()?.metadata);
2008
- return resolveTileflowSun(preset ?? tileflowDefaultSunPreset);
2009
- },
2010
- getThemeMetadata(key) {
2011
- return {values: [map.getStyle()?.metadata?.[key]], position: 0};
2012
- }
2013
- };
2041
+ let controller = coreSceneThemeControllers.get(map);
2042
+ if (!controller) {
2043
+ controller = createPreviewSceneThemes(map, metadata =>
2044
+ resolveTileflowSun(readTileflowSunPreset(metadata) ?? tileflowDefaultSunPreset));
2045
+ coreSceneThemeControllers.set(map, controller);
2046
+ }
2047
+ return controller;
2014
2048
  }
2015
2049
  let mountingCoreScene = false;
2016
2050
  function mountCoreScene(map) {
@@ -2031,10 +2065,10 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
2031
2065
  }
2032
2066
  coreScene.trees.setVisible(treesEnabled && runtimeLayerVisibility["tileflow-trees-3d"] !== false);
2033
2067
  coreScene.trees.setViewMode(threeDimensionalEnabled ? "3d" : "2d");
2034
- // Street lights have no capture fallback, so they shine only with the 3D control on.
2068
+ // Street lights require an explicit map opt-in and the 3D control; defaults stay off.
2035
2069
  if (!coreScene.lights && threeDimensionalEnabled && metadata["tileflow:street-lights"]) {
2036
2070
  coreScene.lights = createTileflowStreetLights({map, controller});
2037
- } else if (coreScene.lights && !threeDimensionalEnabled) {
2071
+ } else if (coreScene.lights && (!threeDimensionalEnabled || !metadata["tileflow:street-lights"])) {
2038
2072
  coreScene.lights.dispose();
2039
2073
  coreScene.lights = undefined;
2040
2074
  }
package/dist/server.d.ts CHANGED
@@ -5,7 +5,7 @@ import '@tileflow/core';
5
5
  import '@tileflow/core/build';
6
6
  import '@tileflow/core/manifest';
7
7
  import '@tileflow/core/native-profile';
8
- import './icons-B84H8Ymu.js';
8
+ import './icons-BdOehQmB.js';
9
9
  import './config.js';
10
10
 
11
11
  declare const tileflowComparisonSchemaVersion: 1;