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

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.
@@ -58,8 +58,8 @@ License.
58
58
 
59
59
  ## PMTiles JavaScript 4.5.0
60
60
 
61
- The local Streets preview loads the separately installed `pmtiles` browser decoder to retrieve
62
- individual landmark GLB entries with HTTP byte ranges. PMTiles is copyright Protomaps and
61
+ Local tileset inspection uses the separately installed `pmtiles` package to read vector and raster
62
+ tiles from local PMTiles archives. PMTiles is copyright Protomaps and
63
63
  contributors and is distributed under the BSD 3-Clause License. Its `fflate` dependency is
64
64
  copyright 2020 Arjun Barrett and is distributed under the MIT License.
65
65
 
package/dist/artifacts.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  usesTileflowLineBackgroundGlyphs,
33
33
  writeTileflowArtifactPlan,
34
34
  writeTileflowBuildArtifacts
35
- } from "./chunk-2F7LOYQI.js";
35
+ } from "./chunk-UKWAQKLH.js";
36
36
  import {
37
37
  getTileflowAssetBasePath,
38
38
  getTileflowAssetFileName,
@@ -575,6 +575,7 @@ import {
575
575
  import {
576
576
  getTileflowStyleFontFaces,
577
577
  serializeCanonicalJson,
578
+ steadyTileflowNauticalLights,
578
579
  tileflowStyleFontFacesMetadataKey,
579
580
  tileflowIconIdPattern,
580
581
  tileflowIconPackageLimits
@@ -1227,12 +1228,16 @@ function lowerNativeStyleRepresentation(input, normalizeFilter = (filter) => fil
1227
1228
  properties: lowered.properties
1228
1229
  });
1229
1230
  }
1230
- const changed = projection !== "none" || transformations.length > 0 || symbolOverlap.length > 0;
1231
+ if (input.sky !== void 0 && !object2(input.sky)) fail("/sky");
1232
+ const sky = input.sky !== void 0;
1233
+ const changed = projection !== "none" || sky || transformations.length > 0 || symbolOverlap.length > 0;
1231
1234
  const output = changed ? { ...input, layers } : input;
1232
1235
  if (changed && projection !== "none") delete output.projection;
1236
+ if (sky) delete output.sky;
1233
1237
  return {
1234
1238
  style: output,
1235
1239
  projection,
1240
+ ...sky ? { sky: "removed" } : {},
1236
1241
  layers: transformations,
1237
1242
  symbolOverlap,
1238
1243
  inputLayers: originalLayers.length,
@@ -1260,12 +1265,13 @@ function lowerTileflowNativeCompiledStyles(input, policy = {}) {
1260
1265
  for (const map of Object.keys(input).sort()) {
1261
1266
  styles[map] = {};
1262
1267
  for (const theme of Object.keys(input[map]).sort()) {
1263
- const original = input[map][theme];
1268
+ const web = input[map][theme];
1269
+ const original = steadyTileflowNauticalLights(web);
1264
1270
  try {
1265
1271
  const options = { ...urlOptions(map, theme, policy), deferFontClosure: true };
1266
1272
  const pending = validateTileflowNativeStyle(original, options);
1267
1273
  const blockers = pending.filter(
1268
- (issue) => issue.code !== "NATIVE_UNSUPPORTED_STYLE" || !(issue.path === "/projection" || /^\/layers\/\d+\/(?:layout\/line-cap|paint\/line-dasharray)(?:\/|$)/u.test(
1274
+ (issue) => issue.code !== "NATIVE_UNSUPPORTED_STYLE" || !(issue.path === "/projection" || issue.path === "/sky" || /^\/layers\/\d+\/(?:layout\/line-cap|paint\/line-dasharray)(?:\/|$)/u.test(
1269
1275
  issue.path
1270
1276
  ) || /^\/layers\/\d+\/layout\/(?:icon|text)-overlap$/u.test(issue.path))
1271
1277
  );
@@ -1318,11 +1324,12 @@ function lowerTileflowNativeCompiledStyles(input, policy = {}) {
1318
1324
  transformations.push({
1319
1325
  map,
1320
1326
  theme,
1321
- inputStyleSha256: createHash2("sha256").update(serializeCanonicalJson(original)).digest("hex"),
1327
+ inputStyleSha256: createHash2("sha256").update(serializeCanonicalJson(web)).digest("hex"),
1322
1328
  loweredStyleSha256: createHash2("sha256").update(serializeCanonicalJson(style)).digest("hex"),
1323
1329
  inputLayers: lowered.inputLayers,
1324
1330
  outputLayers: lowered.outputLayers,
1325
1331
  projection: lowered.projection,
1332
+ ...lowered.sky ? { sky: lowered.sky } : {},
1326
1333
  layers: lowered.layers,
1327
1334
  symbolOverlap: lowered.symbolOverlap
1328
1335
  });
@@ -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");
@@ -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 };