@tileflow/dev 0.1.0-alpha.33 → 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.
@@ -8976,7 +8976,7 @@ function readUtf8(buf, pos, end) {
8976
8976
  return str;
8977
8977
  }
8978
8978
 
8979
- // src/landmarks.ts
8979
+ // src/bounded-response.ts
8980
8980
  async function readBoundedTileflowResponse(response, maximumBytes) {
8981
8981
  if (!Number.isSafeInteger(maximumBytes) || maximumBytes < 1) {
8982
8982
  throw new Error("invalid response byte limit");
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-BdOehQmB.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, TileflowModelBundleManifest, 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 = {
@@ -44,6 +44,12 @@ type PreparedTileflowBuildingModel = {
44
44
  fileName: string;
45
45
  bytes: Uint8Array;
46
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
+ }>[];
47
53
  };
48
54
  /** A building model's glTF binaries, nearest level first. */
49
55
  type TileflowBuildingModelLevels = Readonly<{
@@ -73,39 +79,26 @@ type TileflowLandmarkSource = Readonly<{
73
79
  /**
74
80
  * Packages the landmarks standing in one tile of a landmarks tileset into that tile's prepared
75
81
  * model file, the landmarks in the order of their ids. Every landmark's origin must fall in the
76
- * 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.
77
84
  */
78
85
  declare function packageTileflowLandmarkTile(landmarks: readonly TileflowLandmarkSource[]): Promise<{
79
86
  x: number;
80
87
  y: number;
81
88
  bytes: Uint8Array;
82
89
  sha256: string;
90
+ landmarks: readonly TileflowLandmarkFootprint[];
83
91
  }>;
84
92
  /**
85
- * Writes the index of one region of a landmarks tileset, `{region: [x, y], tiles: [[x, y,
86
- * 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.
87
97
  */
88
98
  declare function encodeTileflowLandmarkRegion(region: TileflowLandmarkRegion): {
89
99
  bytes: Uint8Array;
90
100
  sha256: string;
91
101
  };
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>;
109
102
  type PreparedTileflowTreeModels = {
110
103
  /** The prepared tree models by id. */
111
104
  models: Record<string, TileflowTreeModel>;
@@ -421,4 +414,4 @@ declare function readTileflowIconDirectory(source: TileflowIconDirectory, option
421
414
  target: TileflowIconCompilationTarget;
422
415
  }): Promise<ReadTileflowIconDirectoryResult>;
423
416
 
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 };
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, 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';
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
@@ -2,7 +2,6 @@ import {
2
2
  TileflowIconCompilationError,
3
3
  compileTileflowIconPackages,
4
4
  composeTileflowIconSources,
5
- createTileflowModelBundle,
6
5
  getTileflowIconCacheDirectory,
7
6
  getTileflowIconWatchPaths,
8
7
  iconFileExtensions,
@@ -18,13 +17,12 @@ import {
18
17
  storeTileflowIconSetArtifact,
19
18
  verifyTileflowIconArtifact,
20
19
  writeTileflowIconsLockfile
21
- } from "./chunk-QYU4OW5A.js";
20
+ } from "./chunk-5RT4CHSK.js";
22
21
  import "./chunk-7C4F6GAX.js";
23
22
  export {
24
23
  TileflowIconCompilationError,
25
24
  compileTileflowIconPackages,
26
25
  composeTileflowIconSources,
27
- createTileflowModelBundle,
28
26
  getTileflowIconCacheDirectory,
29
27
  getTileflowIconWatchPaths,
30
28
  iconFileExtensions,
@@ -11,8 +11,6 @@ var localMapLibreAssets = /* @__PURE__ */ new Map();
11
11
  var localTileflowBrowserJavaScript;
12
12
  var localThreeCoreJavaScript;
13
13
  var localThreeModuleJavaScript;
14
- var localPmtilesJavaScript;
15
- var localFflateJavaScript;
16
14
  function getTileflowPreviewRuntimeResponse(path) {
17
15
  if (path === "/__runtime/devtools-observer.js") {
18
16
  return textAssetResponse(
@@ -44,18 +42,6 @@ function getTileflowPreviewRuntimeResponse(path) {
44
42
  if (path === "/__runtime/three.core.min.js") {
45
43
  return textAssetResponse(getLocalThreeAsset("core"), "text/javascript; charset=utf-8");
46
44
  }
47
- if (path === "/__runtime/pmtiles.js") {
48
- return textAssetResponse(getLocalPmtilesAsset(), "text/javascript; charset=utf-8");
49
- }
50
- if (path === "/__runtime/fflate.js") {
51
- return textAssetResponse(getLocalFflateAsset(), "text/javascript; charset=utf-8");
52
- }
53
- if (path === "/__runtime/three-addons/libs/draco/gltf/draco_decoder.wasm") {
54
- return binaryAssetResponse(
55
- getLocalThreeAddonBinaryAsset("libs/draco/gltf/draco_decoder.wasm"),
56
- "application/wasm"
57
- );
58
- }
59
45
  if (path.startsWith("/__runtime/three-addons/")) {
60
46
  return textAssetResponse(
61
47
  getLocalThreeAddonAsset(path.slice("/__runtime/three-addons/".length)),
@@ -103,34 +89,6 @@ function getLocalThreeAddonAsset(relativePath) {
103
89
  if (!isPathWithin(addonRoot, assetPath)) throw new Error("Invalid Three.js addon path.");
104
90
  return readFileSync(assetPath, "utf8");
105
91
  }
106
- function getLocalThreeAddonBinaryAsset(relativePath) {
107
- if (!/^[A-Za-z0-9_./-]+\.wasm$/.test(relativePath) || relativePath.includes("..")) {
108
- throw new Error("Invalid Three.js binary addon path.");
109
- }
110
- const commonJsPath = localRequire.resolve("three");
111
- const addonRoot = join(dirname(dirname(commonJsPath)), "examples", "jsm");
112
- const assetPath = join(addonRoot, relativePath);
113
- if (!isPathWithin(addonRoot, assetPath)) throw new Error("Invalid Three.js binary addon path.");
114
- return readFileSync(assetPath);
115
- }
116
- function getLocalPmtilesAsset() {
117
- if (localPmtilesJavaScript !== void 0) return localPmtilesJavaScript;
118
- const packagePath = localRequire.resolve("pmtiles/package.json");
119
- localPmtilesJavaScript = readFileSync(
120
- join(dirname(packagePath), "dist", "esm", "index.js"),
121
- "utf8"
122
- );
123
- return localPmtilesJavaScript;
124
- }
125
- function getLocalFflateAsset() {
126
- if (localFflateJavaScript !== void 0) return localFflateJavaScript;
127
- const commonJsPath = localRequire.resolve("fflate");
128
- localFflateJavaScript = readFileSync(
129
- join(dirname(dirname(commonJsPath)), "esm", "browser.js"),
130
- "utf8"
131
- );
132
- return localFflateJavaScript;
133
- }
134
92
  function textAssetResponse(body, contentType) {
135
93
  return new Response(body, {
136
94
  headers: {
@@ -140,15 +98,6 @@ function textAssetResponse(body, contentType) {
140
98
  }
141
99
  });
142
100
  }
143
- function binaryAssetResponse(body, contentType) {
144
- return new Response(new Uint8Array(body), {
145
- headers: {
146
- "Access-Control-Allow-Origin": "*",
147
- "Cache-Control": "no-store",
148
- "Content-Type": contentType
149
- }
150
- });
151
- }
152
101
  export {
153
102
  getTileflowPreviewRuntimeResponse
154
103
  };
package/dist/preview.d.ts CHANGED
@@ -3,50 +3,10 @@ import { TileflowBuildCatalog } from '@tileflow/core/build';
3
3
 
4
4
  declare function renderTileflowPreviewHtml(preview: ResolvedTileflowPreview | undefined, basePath: string, initialStatus: unknown, isSemanticPreview: boolean, fontFaces?: readonly TileflowStyleFontFace[], fitViewport?: boolean, controls?: string): string;
5
5
 
6
- type TileflowLandmarkAxisConvention = 'ENU_Z_UP' | 'EUN_Y_UP' | 'EUS_Y_UP';
7
- type TileflowLandmarkArchive = {
8
- bytes: number;
9
- id: string;
10
- sha256: string;
11
- url: string;
12
- };
13
- type TileflowLandmarkModel = {
14
- archive: TileflowLandmarkArchive;
15
- archiveId: string;
16
- axisConvention: TileflowLandmarkAxisConvention;
17
- bytes: number;
18
- key: string;
19
- minzoom: number;
20
- sha256: string;
21
- x: number;
22
- y: number;
23
- z: number;
24
- };
25
- type TileflowLandmark = {
26
- bounds: [number, number, number, number];
27
- center: [number, number];
28
- id: string;
29
- models: TileflowLandmarkModel[];
30
- priority: number;
31
- };
32
- type TileflowLandmarkManifestV2 = {
33
- archives: TileflowLandmarkArchive[];
34
- id: string;
35
- landmarks: TileflowLandmark[];
36
- maximumCachedModels: number;
37
- maximumVisibleModels: number;
38
- minzoom: number;
39
- schemaVersion: 2;
40
- };
41
6
  /** Reads a response without ever buffering more than the declared bound. */
42
7
  declare function readBoundedTileflowResponse(response: Response, maximumBytes: number): Promise<Uint8Array>;
43
8
  /** Reads and strictly decodes a bounded UTF-8 JSON response. */
44
9
  declare function readBoundedTileflowJsonResponse(response: Response, maximumBytes: number): Promise<unknown>;
45
- /**
46
- * Validates the browser preview's bounded v2 PMTiles landmark contract. Keep this function
47
- * self-contained: the preview serializes it into its isolated browser document.
48
- */
49
- declare function normalizeTileflowLandmarkManifest(candidate: unknown, manifestUrl: string): TileflowLandmarkManifestV2;
50
10
 
51
11
  type TileflowPreviewSelection = {
52
12
  map?: string;
@@ -68,4 +28,4 @@ declare class TileflowPreviewSelectionError extends Error {
68
28
  }
69
29
  declare function resolveTileflowPreview(project: TileflowBuildCatalog, selection?: TileflowPreviewSelection): ResolvedTileflowPreview;
70
30
 
71
- export { type ResolvedTileflowPreview, type TileflowLandmark, type TileflowLandmarkArchive, type TileflowLandmarkAxisConvention, type TileflowLandmarkManifestV2, type TileflowLandmarkModel, type TileflowPreviewSelection, TileflowPreviewSelectionError, normalizeTileflowLandmarkManifest, readBoundedTileflowJsonResponse, readBoundedTileflowResponse, renderTileflowPreviewHtml, resolveTileflowPreview };
31
+ export { type ResolvedTileflowPreview, type TileflowPreviewSelection, TileflowPreviewSelectionError, readBoundedTileflowJsonResponse, readBoundedTileflowResponse, renderTileflowPreviewHtml, resolveTileflowPreview };