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

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-BIHpw5Zy.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, TileflowLandmarkFootprint, 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,13 @@ 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;
47
+ /** The glTF binaries it was prepared from, nearest level first. */
48
+ sources: readonly Readonly<{
49
+ level: 'near' | 'mid' | 'far';
50
+ sha256: string;
51
+ byteLength: number;
52
+ }>[];
46
53
  };
47
54
  /** A building model's glTF binaries, nearest level first. */
48
55
  type TileflowBuildingModelLevels = Readonly<{
@@ -72,17 +79,21 @@ type TileflowLandmarkSource = Readonly<{
72
79
  /**
73
80
  * Packages the landmarks standing in one tile of a landmarks tileset into that tile's prepared
74
81
  * model file, the landmarks in the order of their ids. Every landmark's origin must fall in the
75
- * same zoom-14 tile. The result depends only on its input.
82
+ * same zoom-14 tile. It also returns each landmark's place and footprint, as the region's index
83
+ * names them. The result depends only on its input.
76
84
  */
77
85
  declare function packageTileflowLandmarkTile(landmarks: readonly TileflowLandmarkSource[]): Promise<{
78
86
  x: number;
79
87
  y: number;
80
88
  bytes: Uint8Array;
81
89
  sha256: string;
90
+ landmarks: readonly TileflowLandmarkFootprint[];
82
91
  }>;
83
92
  /**
84
- * Writes the index of one region of a landmarks tileset, `{region: [x, y], tiles: [[x, y,
85
- * sha256], ...]}`, as the bytes the tileset serves, with their SHA-256.
93
+ * Writes the index of one region of a landmarks tileset, `{region: [x, y], tiles: [[x, y, sha256,
94
+ * landmarks], ...]}`, as the bytes the tileset serves, with their SHA-256. A tile's `landmarks` are
95
+ * the ones `packageTileflowLandmarkTile` returned for it, or `readTileflowLandmarkTileFootprints`
96
+ * reads back from its bytes.
86
97
  */
87
98
  declare function encodeTileflowLandmarkRegion(region: TileflowLandmarkRegion): {
88
99
  bytes: Uint8Array;
@@ -403,4 +414,4 @@ declare function readTileflowIconDirectory(source: TileflowIconDirectory, option
403
414
  target: TileflowIconCompilationTarget;
404
415
  }): Promise<ReadTileflowIconDirectoryResult>;
405
416
 
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 };
417
+ export { readTileflowIconsLockfileText 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 TileflowRenderedIcon as J, type TileflowRenderedIconCell as K, compileTileflowIconPackages as L, composeTileflowIconSources as M, getTileflowIconCacheDirectory as N, getTileflowIconWatchPaths as O, type PreparedTileflowBuildCatalog as P, iconFileExtensions as Q, type ReadTileflowIconDirectoryResult as R, inspectTileflowIconCatalogs as S, type TileflowBuildAsset as T, loadTileflowIconSetArtifact as U, type VerifiedTileflowIconArtifact as V, packTileflowRenderedIcons as W, prepareTileflowCatalogIcons as X, prepareTileflowMapTreeModels as Y, readTileflowIconDirectory as Z, readTileflowIconsLockfile as _, type TileflowIconResolutionOptions as a, renderTileflowIconAtlasPreview as a0, storeTileflowIconSetArtifact as a1, verifyTileflowIconArtifact as a2, writeTileflowIconsLockfile as a3, 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 TileflowRenderedIcon, K as TileflowRenderedIconCell, b as TileflowSourceCatalog, V as VerifiedTileflowIconArtifact, L as compileTileflowIconPackages, M as composeTileflowIconSources, N as getTileflowIconCacheDirectory, O as getTileflowIconWatchPaths, Q as iconFileExtensions, S as inspectTileflowIconCatalogs, U as loadTileflowIconSetArtifact, W as packTileflowRenderedIcons, X as prepareTileflowCatalogIcons, Y as prepareTileflowMapTreeModels, Z as readTileflowIconDirectory, _ as readTileflowIconsLockfile, $ as readTileflowIconsLockfileText, a0 as renderTileflowIconAtlasPreview, a1 as storeTileflowIconSetArtifact, a2 as verifyTileflowIconArtifact, a3 as writeTileflowIconsLockfile } from './icons-BIHpw5Zy.js';
package/dist/icons.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  storeTileflowIconSetArtifact,
18
18
  verifyTileflowIconArtifact,
19
19
  writeTileflowIconsLockfile
20
- } from "./chunk-F4PLTZS4.js";
20
+ } from "./chunk-5RT4CHSK.js";
21
21
  import "./chunk-7C4F6GAX.js";
22
22
  export {
23
23
  TileflowIconCompilationError,
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;
@@ -314,6 +348,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
314
348
  import {loadTileflowStyleFonts} from "${basePath}/__runtime/tileflow-browser.js";
315
349
  import {registerTileflowContourProtocol} from "${basePath}/__runtime/tileflow-browser.js";
316
350
  import {registerTileflowPmtilesProtocol} from "${basePath}/__runtime/tileflow-browser.js";
351
+ import {attachTileflowNotices} from "${basePath}/__runtime/tileflow-browser.js";
317
352
  import {createTileflowBuildings3D, createTileflowStreetLights, createTileflowVegetation} from "${basePath}/__runtime/tileflow-browser.js";
318
353
  import {readTileflowSunPreset, resolveTileflowSun, tileflowDefaultSunPreset} from "${basePath}/__runtime/tileflow-browser.js";
319
354
 
@@ -372,7 +407,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
372
407
  if (values[0] === "off") return false;
373
408
  return fallback;
374
409
  }
375
- let threeDimensionalEnabled = readToggleFromUrl("buildings3d", false);
410
+ let threeDimensionalEnabled = readToggleFromUrl("buildings3d", true);
376
411
  let treesEnabled = readToggleFromUrl("trees3d", true);
377
412
  const landmarkState = {
378
413
  active: [],
@@ -1985,7 +2020,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
1985
2020
  // buildings, trees and street lights look, and the controls only show and hide them. The
1986
2021
  // vegetation control hides all trees when off. The preview shows one theme at a
1987
2022
  // 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"};
2023
+ const coreScene = {buildings: undefined, trees: undefined, lights: undefined, buildingsShown: undefined, animation: "0"};
1989
2024
  const runtimeLayerVisibility = {};
1990
2025
  globalThis.__tileflowPreviewScene = coreScene;
1991
2026
  globalThis.__tileflowRuntimeVisibility = (id, visible) => {
@@ -2001,16 +2036,16 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
2001
2036
  ...(coreScene.trees ? {"tileflow-trees-3d": {controller:"Vegetation", state:{visible:runtimeLayerVisibility["tileflow-trees-3d"] !== false, representation:coreScene.trees.representation}, stats:coreScene.trees.stats}} : {}),
2002
2037
  ...(coreScene.lights ? {"tileflow-street-lights": {controller:"Street lights", state:{visible:runtimeLayerVisibility["tileflow-street-lights"] !== false, mounted:true}, stats:coreScene.lights.stats}} : {})
2003
2038
  });
2039
+ const createPreviewSceneThemes = ${createPreviewSceneThemes.toString()};
2040
+ const coreSceneThemeControllers = new WeakMap();
2004
2041
  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
- };
2042
+ let controller = coreSceneThemeControllers.get(map);
2043
+ if (!controller) {
2044
+ controller = createPreviewSceneThemes(map, metadata =>
2045
+ resolveTileflowSun(readTileflowSunPreset(metadata) ?? tileflowDefaultSunPreset));
2046
+ coreSceneThemeControllers.set(map, controller);
2047
+ }
2048
+ return controller;
2014
2049
  }
2015
2050
  let mountingCoreScene = false;
2016
2051
  function mountCoreScene(map) {
@@ -2031,10 +2066,10 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
2031
2066
  }
2032
2067
  coreScene.trees.setVisible(treesEnabled && runtimeLayerVisibility["tileflow-trees-3d"] !== false);
2033
2068
  coreScene.trees.setViewMode(threeDimensionalEnabled ? "3d" : "2d");
2034
- // Street lights have no capture fallback, so they shine only with the 3D control on.
2069
+ // Street lights require an explicit map opt-in and the 3D control; defaults stay off.
2035
2070
  if (!coreScene.lights && threeDimensionalEnabled && metadata["tileflow:street-lights"]) {
2036
2071
  coreScene.lights = createTileflowStreetLights({map, controller});
2037
- } else if (coreScene.lights && !threeDimensionalEnabled) {
2072
+ } else if (coreScene.lights && (!threeDimensionalEnabled || !metadata["tileflow:street-lights"])) {
2038
2073
  coreScene.lights.dispose();
2039
2074
  coreScene.lights = undefined;
2040
2075
  }
@@ -2349,6 +2384,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticP
2349
2384
  ...resolveInitialMapOptions(previewMapOptions)
2350
2385
  });
2351
2386
  globalThis.__tileflowPreviewMap = map;
2387
+ attachTileflowNotices(map);
2352
2388
  devtoolsObserver?.attach(map);
2353
2389
  installMapBenchmark(map);
2354
2390
  if (window.parent === window) map.addControl(new maplibregl.NavigationControl(), "top-right");
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-BIHpw5Zy.js';
9
9
  import './config.js';
10
10
 
11
11
  declare const tileflowComparisonSchemaVersion: 1;