@tileflow/dev 0.1.0-alpha.3 → 0.1.0-alpha.31

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.
Files changed (41) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +201 -5
  3. package/THIRD_PARTY_NOTICES.md +87 -0
  4. package/dist/artifacts.d.ts +265 -0
  5. package/dist/artifacts.js +81 -0
  6. package/dist/chunk-2QXKVQ6O.js +3062 -0
  7. package/dist/chunk-7C4F6GAX.js +170 -0
  8. package/dist/chunk-AQUGMUZW.js +324 -0
  9. package/dist/chunk-D4OE4ITL.js +13 -0
  10. package/dist/chunk-IR22ZTQW.js +2392 -0
  11. package/dist/chunk-KDFTE4Q5.js +156 -0
  12. package/dist/chunk-ONYQNLNA.js +1108 -0
  13. package/dist/chunk-UTRO4IBQ.js +671 -0
  14. package/dist/chunk-XHJBCVBB.js +241 -0
  15. package/dist/config.d.ts +33 -0
  16. package/dist/config.js +27 -0
  17. package/dist/fonts.d.ts +47 -0
  18. package/dist/fonts.js +16 -0
  19. package/dist/icons.d.ts +339 -0
  20. package/dist/icons.js +39 -0
  21. package/dist/inspect.d.ts +149 -0
  22. package/dist/inspect.js +805 -0
  23. package/dist/preview-assets-MVUJJ5XR.js +148 -0
  24. package/dist/preview.d.ts +71 -0
  25. package/dist/preview.js +2574 -0
  26. package/dist/server.d.ts +82 -0
  27. package/dist/server.js +2094 -0
  28. package/dist/tilesets.d.ts +89 -0
  29. package/dist/tilesets.js +6 -0
  30. package/dist/validation.d.ts +65 -0
  31. package/dist/validation.js +24 -0
  32. package/docs/artifact-lifecycle.md +152 -0
  33. package/docs/bounded-pmtiles-resource-inspection.md +21 -0
  34. package/docs/bounded-vector-feature-inspection.md +100 -0
  35. package/docs/local-comparison-workbench-and-compiler-inspection.md +227 -0
  36. package/docs/native-artifacts.md +285 -0
  37. package/docs/native-icons.md +129 -0
  38. package/docs/structured-config-inspection-and-diagnostics.md +39 -0
  39. package/package.json +77 -13
  40. package/dist/index.d.ts +0 -54
  41. package/dist/index.js +0 -314
@@ -0,0 +1,148 @@
1
+ import {
2
+ isPathWithin
3
+ } from "./chunk-D4OE4ITL.js";
4
+
5
+ // src/preview-assets.ts
6
+ import { readFileSync } from "fs";
7
+ import { createRequire } from "module";
8
+ import { dirname, join } from "path";
9
+ var localRequire = createRequire(import.meta.url);
10
+ var localMapLibreAssets = /* @__PURE__ */ new Map();
11
+ var localTileflowBrowserJavaScript;
12
+ var localThreeCoreJavaScript;
13
+ var localThreeModuleJavaScript;
14
+ var localPmtilesJavaScript;
15
+ var localFflateJavaScript;
16
+ function getTileflowPreviewRuntimeResponse(path) {
17
+ if (path === "/__runtime/maplibre-gl.mjs") {
18
+ return textAssetResponse(
19
+ getLocalMapLibreAsset("maplibre-gl.mjs"),
20
+ "text/javascript; charset=utf-8"
21
+ );
22
+ }
23
+ if (path === "/__runtime/maplibre-gl-worker.mjs") {
24
+ return textAssetResponse(
25
+ getLocalMapLibreAsset("maplibre-gl-worker.mjs"),
26
+ "text/javascript; charset=utf-8"
27
+ );
28
+ }
29
+ if (path === "/__runtime/maplibre-gl.css") {
30
+ return textAssetResponse(getLocalMapLibreAsset("maplibre-gl.css"), "text/css; charset=utf-8");
31
+ }
32
+ if (path === "/__runtime/tileflow-browser.js") {
33
+ return textAssetResponse(getLocalTileflowBrowserAsset(), "text/javascript; charset=utf-8");
34
+ }
35
+ if (path === "/__runtime/three.module.js") {
36
+ return textAssetResponse(getLocalThreeAsset("module"), "text/javascript; charset=utf-8");
37
+ }
38
+ if (path === "/__runtime/three.core.min.js") {
39
+ return textAssetResponse(getLocalThreeAsset("core"), "text/javascript; charset=utf-8");
40
+ }
41
+ if (path === "/__runtime/pmtiles.js") {
42
+ return textAssetResponse(getLocalPmtilesAsset(), "text/javascript; charset=utf-8");
43
+ }
44
+ if (path === "/__runtime/fflate.js") {
45
+ return textAssetResponse(getLocalFflateAsset(), "text/javascript; charset=utf-8");
46
+ }
47
+ if (path === "/__runtime/three-addons/libs/draco/gltf/draco_decoder.wasm") {
48
+ return binaryAssetResponse(
49
+ getLocalThreeAddonBinaryAsset("libs/draco/gltf/draco_decoder.wasm"),
50
+ "application/wasm"
51
+ );
52
+ }
53
+ if (path.startsWith("/__runtime/three-addons/")) {
54
+ return textAssetResponse(
55
+ getLocalThreeAddonAsset(path.slice("/__runtime/three-addons/".length)),
56
+ "text/javascript; charset=utf-8"
57
+ );
58
+ }
59
+ return void 0;
60
+ }
61
+ function getLocalMapLibreAsset(fileName) {
62
+ const cached = localMapLibreAssets.get(fileName);
63
+ if (cached !== void 0) return cached;
64
+ const source = readFileSync(localRequire.resolve(`maplibre-gl/dist/${fileName}`), "utf8");
65
+ localMapLibreAssets.set(fileName, source);
66
+ return source;
67
+ }
68
+ function getLocalTileflowBrowserAsset() {
69
+ if (localTileflowBrowserJavaScript !== void 0) return localTileflowBrowserJavaScript;
70
+ const packagePath = localRequire.resolve("@tileflow/core/package.json");
71
+ localTileflowBrowserJavaScript = readFileSync(
72
+ join(dirname(packagePath), "dist", "browser.js"),
73
+ "utf8"
74
+ );
75
+ return localTileflowBrowserJavaScript;
76
+ }
77
+ function getLocalThreeAsset(kind) {
78
+ if (kind === "core" && localThreeCoreJavaScript !== void 0) return localThreeCoreJavaScript;
79
+ if (kind === "module" && localThreeModuleJavaScript !== void 0)
80
+ return localThreeModuleJavaScript;
81
+ const commonJsPath = localRequire.resolve("three");
82
+ const source = readFileSync(
83
+ join(dirname(commonJsPath), kind === "core" ? "three.core.min.js" : "three.module.min.js"),
84
+ "utf8"
85
+ );
86
+ if (kind === "core") localThreeCoreJavaScript = source;
87
+ else localThreeModuleJavaScript = source;
88
+ return source;
89
+ }
90
+ function getLocalThreeAddonAsset(relativePath) {
91
+ if (!/^[A-Za-z0-9_./-]+\.js$/.test(relativePath) || relativePath.includes("..")) {
92
+ throw new Error("Invalid Three.js addon path.");
93
+ }
94
+ const commonJsPath = localRequire.resolve("three");
95
+ const addonRoot = join(dirname(dirname(commonJsPath)), "examples", "jsm");
96
+ const assetPath = join(addonRoot, relativePath);
97
+ if (!isPathWithin(addonRoot, assetPath)) throw new Error("Invalid Three.js addon path.");
98
+ return readFileSync(assetPath, "utf8");
99
+ }
100
+ function getLocalThreeAddonBinaryAsset(relativePath) {
101
+ if (!/^[A-Za-z0-9_./-]+\.wasm$/.test(relativePath) || relativePath.includes("..")) {
102
+ throw new Error("Invalid Three.js binary addon path.");
103
+ }
104
+ const commonJsPath = localRequire.resolve("three");
105
+ const addonRoot = join(dirname(dirname(commonJsPath)), "examples", "jsm");
106
+ const assetPath = join(addonRoot, relativePath);
107
+ if (!isPathWithin(addonRoot, assetPath)) throw new Error("Invalid Three.js binary addon path.");
108
+ return readFileSync(assetPath);
109
+ }
110
+ function getLocalPmtilesAsset() {
111
+ if (localPmtilesJavaScript !== void 0) return localPmtilesJavaScript;
112
+ const packagePath = localRequire.resolve("pmtiles/package.json");
113
+ localPmtilesJavaScript = readFileSync(
114
+ join(dirname(packagePath), "dist", "esm", "index.js"),
115
+ "utf8"
116
+ );
117
+ return localPmtilesJavaScript;
118
+ }
119
+ function getLocalFflateAsset() {
120
+ if (localFflateJavaScript !== void 0) return localFflateJavaScript;
121
+ const commonJsPath = localRequire.resolve("fflate");
122
+ localFflateJavaScript = readFileSync(
123
+ join(dirname(dirname(commonJsPath)), "esm", "browser.js"),
124
+ "utf8"
125
+ );
126
+ return localFflateJavaScript;
127
+ }
128
+ function textAssetResponse(body, contentType) {
129
+ return new Response(body, {
130
+ headers: {
131
+ "Access-Control-Allow-Origin": "*",
132
+ "Cache-Control": "no-store",
133
+ "Content-Type": contentType
134
+ }
135
+ });
136
+ }
137
+ function binaryAssetResponse(body, contentType) {
138
+ return new Response(new Uint8Array(body), {
139
+ headers: {
140
+ "Access-Control-Allow-Origin": "*",
141
+ "Cache-Control": "no-store",
142
+ "Content-Type": contentType
143
+ }
144
+ });
145
+ }
146
+ export {
147
+ getTileflowPreviewRuntimeResponse
148
+ };
@@ -0,0 +1,71 @@
1
+ import { TileflowStyleFontFace, NormalizedTileflowCaptureScene } from '@tileflow/core';
2
+ import { TileflowBuildCatalog } from '@tileflow/core/build';
3
+
4
+ declare function renderTileflowPreviewHtml(preview: ResolvedTileflowPreview | undefined, basePath: string, initialStatus: unknown, isSemanticPreview: boolean, fontFaces?: readonly TileflowStyleFontFace[]): string;
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
+ /** Reads a response without ever buffering more than the declared bound. */
42
+ declare function readBoundedTileflowResponse(response: Response, maximumBytes: number): Promise<Uint8Array>;
43
+ /** Reads and strictly decodes a bounded UTF-8 JSON response. */
44
+ 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
+
51
+ type TileflowPreviewSelection = {
52
+ map?: string;
53
+ scene?: string;
54
+ theme?: string;
55
+ };
56
+ type ResolvedTileflowPreview = {
57
+ camera: NormalizedTileflowCaptureScene['camera'];
58
+ label: string;
59
+ mapName: string;
60
+ themeName: string;
61
+ /** Every theme of a map preview, in declaration order. A scene owns its theme and omits this. */
62
+ themeNames?: readonly string[];
63
+ viewport?: NormalizedTileflowCaptureScene['viewport'];
64
+ };
65
+ declare class TileflowPreviewSelectionError extends Error {
66
+ readonly code: "PREVIEW_SELECTION_INVALID";
67
+ constructor(message: string);
68
+ }
69
+ declare function resolveTileflowPreview(project: TileflowBuildCatalog, selection?: TileflowPreviewSelection): ResolvedTileflowPreview;
70
+
71
+ export { type ResolvedTileflowPreview, type TileflowLandmark, type TileflowLandmarkArchive, type TileflowLandmarkAxisConvention, type TileflowLandmarkManifestV2, type TileflowLandmarkModel, type TileflowPreviewSelection, TileflowPreviewSelectionError, normalizeTileflowLandmarkManifest, readBoundedTileflowJsonResponse, readBoundedTileflowResponse, renderTileflowPreviewHtml, resolveTileflowPreview };