@tileflow/dev 0.1.0-alpha.31 → 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/README.md +67 -2
- package/THIRD_PARTY_NOTICES.md +225 -3
- package/dist/artifacts.d.ts +6 -2
- package/dist/artifacts.js +17 -2
- package/dist/{chunk-IR22ZTQW.js → chunk-QYU4OW5A.js} +481 -27
- package/dist/{chunk-2QXKVQ6O.js → chunk-WJOF6USY.js} +47 -6
- package/dist/devtools-browser.js +16914 -0
- package/dist/devtools-observer.js +95 -0
- package/dist/fonts.d.ts +1 -1
- package/dist/icons-BdOehQmB.d.ts +424 -0
- package/dist/icons.d.ts +3 -339
- package/dist/icons.js +5 -1
- package/dist/{preview-assets-MVUJJ5XR.js → preview-assets-KGUICQHG.js} +6 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +250 -108
- package/dist/server.d.ts +11 -4
- package/dist/server.js +1843 -280
- package/docs/beacon-map-audits.md +145 -0
- package/docs/bounded-vector-feature-inspection.md +3 -4
- package/docs/layers-inspection.md +92 -0
- package/docs/local-comparison-workbench-and-compiler-inspection.md +74 -171
- package/docs/map-design-diagnostics.md +76 -0
- package/docs/native-artifacts.md +3 -3
- package/package.json +7 -5
- package/ui-fonts/hubot-sans-OFL.txt +93 -0
- package/ui-fonts/hubot-sans.woff2 +0 -0
- package/ui-fonts/inter-OFL.txt +92 -0
- package/ui-fonts/inter.woff2 +0 -0
- package/ui-fonts/jetbrains-mono-OFL.txt +93 -0
- package/ui-fonts/jetbrains-mono.woff2 +0 -0
- package/ui-fonts/mona-sans-OFL.txt +93 -0
- package/ui-fonts/mona-sans.woff2 +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// src/devtools/observer.ts
|
|
2
|
+
function resourceAddress(input, base = "http://localhost") {
|
|
3
|
+
try {
|
|
4
|
+
const url = new URL(input.replace(/^(?:tileflow-pmtiles|pmtiles):\/\//u, ""), base);
|
|
5
|
+
if (!["http:", "https:"].includes(url.protocol)) return url.protocol;
|
|
6
|
+
return `${url.origin}${url.pathname}`.slice(0, 2048);
|
|
7
|
+
} catch {
|
|
8
|
+
return "(unavailable URL)";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function resourceKind(url, initiator = "") {
|
|
12
|
+
if (/\.(?:pbf|mvt|mlt)(?:$|\?)/iu.test(url)) return /glyph|font/iu.test(url) ? "Font" : "Tile";
|
|
13
|
+
if (/\.pmtiles(?:$|\?)/iu.test(url)) return "Archive";
|
|
14
|
+
if (/\/(?:\d+)\/(?:\d+)\/(?:\d+)(?:\.[a-z]+)?(?:$|\?)/iu.test(url)) return "Tile";
|
|
15
|
+
if (/sprite/iu.test(url)) return "Sprite";
|
|
16
|
+
if (/\.(?:woff2?|ttf|otf)(?:$|\?)/iu.test(url)) return "Font";
|
|
17
|
+
if (/\.(?:glb|gltf)(?:$|\?)/iu.test(url)) return "Model";
|
|
18
|
+
if (/\.json(?:$|\?)/iu.test(url)) return "JSON";
|
|
19
|
+
return initiator === "script" || /\.m?js(?:$|\?)/iu.test(url) ? "Script" : "Other";
|
|
20
|
+
}
|
|
21
|
+
function createPreviewObserver() {
|
|
22
|
+
let nextId = 0;
|
|
23
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24
|
+
const limit = 2e3;
|
|
25
|
+
let map;
|
|
26
|
+
const observer = {
|
|
27
|
+
records: [],
|
|
28
|
+
revision: 0,
|
|
29
|
+
dropped: 0,
|
|
30
|
+
recording: true,
|
|
31
|
+
attach(value) {
|
|
32
|
+
map = value;
|
|
33
|
+
map.on("data", onData);
|
|
34
|
+
if (!map.loaded()) map.once("load", onLoad);
|
|
35
|
+
},
|
|
36
|
+
clear() {
|
|
37
|
+
observer.records.length = 0;
|
|
38
|
+
observer.dropped = 0;
|
|
39
|
+
observer.revision++;
|
|
40
|
+
},
|
|
41
|
+
dispose() {
|
|
42
|
+
performanceObserver?.disconnect();
|
|
43
|
+
map?.off("data", onData);
|
|
44
|
+
map?.off("load", onLoad);
|
|
45
|
+
seen.clear();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
function onLoad() {
|
|
49
|
+
observer.mapReadyMs = performance.now();
|
|
50
|
+
}
|
|
51
|
+
function record(entry) {
|
|
52
|
+
if (!observer.recording) return;
|
|
53
|
+
const key = `${entry.name}|${entry.startTime}|${entry.duration}`;
|
|
54
|
+
if (seen.has(key)) return;
|
|
55
|
+
seen.add(key);
|
|
56
|
+
if (seen.size > limit * 2) seen.delete(seen.values().next().value);
|
|
57
|
+
const url = resourceAddress(entry.name, location.href);
|
|
58
|
+
if (/\/__(?:status|events|workbench|inspection)/u.test(url)) return;
|
|
59
|
+
const sizesAvailable = entry.decodedBodySize > 0 || entry.encodedBodySize > 0;
|
|
60
|
+
const status = entry.responseStatus;
|
|
61
|
+
const item = {
|
|
62
|
+
id: ++nextId,
|
|
63
|
+
url,
|
|
64
|
+
name: /\/\d+\/\d+\/\d+(?:\.[a-z]+)?$/iu.exec(url)?.[0].slice(1) || url.split("/").pop() || url,
|
|
65
|
+
kind: resourceKind(url, entry.initiatorType),
|
|
66
|
+
transport: "resource",
|
|
67
|
+
start: Number.isFinite(entry.startTime) ? Math.max(0, entry.startTime) : 0,
|
|
68
|
+
duration: Number.isFinite(entry.duration) && entry.duration >= 0 ? entry.duration : void 0,
|
|
69
|
+
status: status ? String(status) : "\u2014",
|
|
70
|
+
...sizesAvailable ? { bytes: entry.encodedBodySize, transferred: entry.transferSize } : {}
|
|
71
|
+
};
|
|
72
|
+
if (entry.transferSize === 0 && sizesAvailable) item.status = "Cached";
|
|
73
|
+
observer.records.push(item);
|
|
74
|
+
if (observer.records.length > limit) {
|
|
75
|
+
observer.records.shift();
|
|
76
|
+
observer.dropped++;
|
|
77
|
+
}
|
|
78
|
+
observer.revision++;
|
|
79
|
+
}
|
|
80
|
+
function onData(event) {
|
|
81
|
+
const timings = event.resourceTiming;
|
|
82
|
+
for (const timing of timings || []) record(timing);
|
|
83
|
+
}
|
|
84
|
+
const performanceObserver = typeof PerformanceObserver === "undefined" ? void 0 : new PerformanceObserver((list) => {
|
|
85
|
+
for (const entry of list.getEntries()) record(entry);
|
|
86
|
+
});
|
|
87
|
+
performanceObserver?.observe({ type: "resource", buffered: true });
|
|
88
|
+
addEventListener("pagehide", observer.dispose, { once: true });
|
|
89
|
+
return observer;
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
createPreviewObserver,
|
|
93
|
+
resourceAddress,
|
|
94
|
+
resourceKind
|
|
95
|
+
};
|
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 { TileflowBuildAsset } from './icons.js';
|
|
3
|
+
import { T as TileflowBuildAsset } from './icons-BdOehQmB.js';
|
|
4
4
|
|
|
5
5
|
type TileflowFontCompilationTarget = 'hosted' | 'local';
|
|
6
6
|
type TileflowFontCompilationIssue = {
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { TileflowIconAppearance, TileflowIconLayoutMetadata, TileflowIconSetPin, TileflowLandmarkRegion, TileflowModelBundleManifest, TileflowModelDirectory, TileflowTreeModel, TileflowIconSpriteIndex, TileflowIconSource, TileflowIconsLockfileV1, TileflowIconCompositionV1, TileflowIconPackageFileName, TileflowIconPackageManifest, TileflowIconDirectory } from '@tileflow/core';
|
|
2
|
+
import { TileflowEffectiveModelSourceIdentity, TileflowEffectiveIconSourceIdentity, TileflowBuildCatalog, TileflowPreparedMapAssets } from '@tileflow/core/build';
|
|
3
|
+
|
|
4
|
+
type TileflowRenderedIconCell = {
|
|
5
|
+
height: number;
|
|
6
|
+
width: number;
|
|
7
|
+
rgba: Uint8Array;
|
|
8
|
+
};
|
|
9
|
+
type TileflowRenderedIcon = {
|
|
10
|
+
id: string;
|
|
11
|
+
appearance?: TileflowIconAppearance;
|
|
12
|
+
layout?: TileflowIconLayoutMetadata;
|
|
13
|
+
oneX: TileflowRenderedIconCell;
|
|
14
|
+
twoX: TileflowRenderedIconCell;
|
|
15
|
+
};
|
|
16
|
+
/** Pack independently rendered densities without scaling or re-rasterizing either input. */
|
|
17
|
+
declare function packTileflowRenderedIcons(input: readonly TileflowRenderedIcon[]): Promise<CompiledTileflowIconPackage>;
|
|
18
|
+
|
|
19
|
+
type VerifiedTileflowIconArtifact = {
|
|
20
|
+
package: CompiledTileflowIconPackage;
|
|
21
|
+
icons: TileflowRenderedIcon[];
|
|
22
|
+
};
|
|
23
|
+
/** Verify exact compressed bytes and independently decode/hash every cell at both densities. */
|
|
24
|
+
declare function verifyTileflowIconArtifact(input: CompiledTileflowIconPackage): Promise<VerifiedTileflowIconArtifact>;
|
|
25
|
+
|
|
26
|
+
type TileflowIconCacheOptions = {
|
|
27
|
+
/** Parent of the versioned tileflow/icons/v1 cache, not a serialized lock setting. */
|
|
28
|
+
cacheRoot?: string;
|
|
29
|
+
offline?: boolean;
|
|
30
|
+
/** Trusted application configuration. A lock cannot extend this allowlist. */
|
|
31
|
+
deliveryOrigins?: readonly string[];
|
|
32
|
+
fetch?: typeof globalThis.fetch;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
};
|
|
35
|
+
declare function getTileflowIconCacheDirectory(options?: Pick<TileflowIconCacheOptions, 'cacheRoot'>): string;
|
|
36
|
+
/** Read and verify an exact pin; a cache miss never resolves a newer version. */
|
|
37
|
+
declare function loadTileflowIconSetArtifact(input: TileflowIconSetPin, options?: TileflowIconCacheOptions): Promise<VerifiedTileflowIconArtifact>;
|
|
38
|
+
/** Seed or repair a disposable cache using verified generated bytes, never original artwork. */
|
|
39
|
+
declare function storeTileflowIconSetArtifact(input: TileflowIconSetPin, artifact: CompiledTileflowIconPackage, options?: Pick<TileflowIconCacheOptions, 'cacheRoot'>): Promise<VerifiedTileflowIconArtifact>;
|
|
40
|
+
|
|
41
|
+
/** A building model file, prepared for the build to write beside the style. */
|
|
42
|
+
type PreparedTileflowBuildingModel = {
|
|
43
|
+
/** Its file name, content-addressed: `<id>-<first 16 hex of its SHA-256>.glb`. */
|
|
44
|
+
fileName: string;
|
|
45
|
+
bytes: Uint8Array;
|
|
46
|
+
sha256: string;
|
|
47
|
+
};
|
|
48
|
+
/** A building model's glTF binaries, nearest level first. */
|
|
49
|
+
type TileflowBuildingModelLevels = Readonly<{
|
|
50
|
+
near: Uint8Array;
|
|
51
|
+
mid?: Uint8Array;
|
|
52
|
+
far?: Uint8Array;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Prepares one building model from its glTF binaries into the file a build writes beside the
|
|
56
|
+
* style: a glTF binary compressed with meshoptimizer. Its footprint is the near level's `footprint`
|
|
57
|
+
* mesh, or else its outline on the ground. Throws `TileflowGltfError` or `RangeError` with words an
|
|
58
|
+
* author can act on.
|
|
59
|
+
*/
|
|
60
|
+
declare function prepareTileflowBuildingModel(id: string, levels: TileflowBuildingModelLevels): Promise<{
|
|
61
|
+
bytes: Uint8Array;
|
|
62
|
+
sha256: string;
|
|
63
|
+
}>;
|
|
64
|
+
/** A landmark to package: a building model and where it stands. */
|
|
65
|
+
type TileflowLandmarkSource = Readonly<{
|
|
66
|
+
id: string;
|
|
67
|
+
/** Longitude and latitude of its origin. */
|
|
68
|
+
at: readonly [number, number];
|
|
69
|
+
/** Degrees clockwise from north its own north is turned to, from 0 to 360. */
|
|
70
|
+
heading: number;
|
|
71
|
+
levels: TileflowBuildingModelLevels;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Packages the landmarks standing in one tile of a landmarks tileset into that tile's prepared
|
|
75
|
+
* 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.
|
|
77
|
+
*/
|
|
78
|
+
declare function packageTileflowLandmarkTile(landmarks: readonly TileflowLandmarkSource[]): Promise<{
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
bytes: Uint8Array;
|
|
82
|
+
sha256: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
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.
|
|
87
|
+
*/
|
|
88
|
+
declare function encodeTileflowLandmarkRegion(region: TileflowLandmarkRegion): {
|
|
89
|
+
bytes: Uint8Array;
|
|
90
|
+
sha256: string;
|
|
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>;
|
|
109
|
+
type PreparedTileflowTreeModels = {
|
|
110
|
+
/** The prepared tree models by id. */
|
|
111
|
+
models: Record<string, TileflowTreeModel>;
|
|
112
|
+
/** The prepared building models by id. */
|
|
113
|
+
buildings: Record<string, PreparedTileflowBuildingModel>;
|
|
114
|
+
identities: TileflowEffectiveModelSourceIdentity[];
|
|
115
|
+
/** Directories to watch for changes. */
|
|
116
|
+
watchPaths: string[];
|
|
117
|
+
};
|
|
118
|
+
/** Reads, checks and prepares one map's model directories. */
|
|
119
|
+
declare function prepareTileflowMapTreeModels(directories: readonly TileflowModelDirectory[], options: {
|
|
120
|
+
baseDirectory: string;
|
|
121
|
+
configPath: string;
|
|
122
|
+
cwd: string;
|
|
123
|
+
target: 'hosted' | 'local';
|
|
124
|
+
}): Promise<PreparedTileflowTreeModels>;
|
|
125
|
+
|
|
126
|
+
/** Render a report image without changing the immutable generated sprite. */
|
|
127
|
+
declare function renderTileflowIconAtlasPreview(source: Uint8Array, index: TileflowIconSpriteIndex): Promise<Uint8Array>;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Read the exact current lock bytes for a compare-and-swap update.
|
|
131
|
+
*
|
|
132
|
+
* `null` means no lock exists yet. The returned text is the only valid `expectedContents` for a
|
|
133
|
+
* later `writeTileflowIconsLockfile` call, so a concurrent writer can never be silently lost.
|
|
134
|
+
*/
|
|
135
|
+
declare function readTileflowIconsLockfileText(baseDirectory: string): Promise<string | null>;
|
|
136
|
+
declare function readTileflowIconsLockfile(baseDirectory: string, sources?: readonly TileflowIconSource[]): Promise<TileflowIconsLockfileV1>;
|
|
137
|
+
/** Compare-and-swap the whole lock. Never rewrite executable config or lose another writer's pin. */
|
|
138
|
+
declare function writeTileflowIconsLockfile(baseDirectory: string, input: TileflowIconsLockfileV1, expectedContents: string | null): Promise<void>;
|
|
139
|
+
|
|
140
|
+
type ComposeTileflowIconSourcesOptions = TileflowIconCacheOptions & {
|
|
141
|
+
cwd: string;
|
|
142
|
+
baseDirectory?: string;
|
|
143
|
+
/** Trusted caller-owned diagnostic prefix, such as `maps.main.icons`. */
|
|
144
|
+
configPath?: string;
|
|
145
|
+
lock?: unknown;
|
|
146
|
+
target?: TileflowIconCompilationTarget;
|
|
147
|
+
};
|
|
148
|
+
/** One declared contributor, retained even when later contributors shadow all of its exports. */
|
|
149
|
+
type TileflowComposedIconContributor = {
|
|
150
|
+
/** Ordered declared entries, before later contributors replace any of them. */
|
|
151
|
+
entries: readonly TileflowIconDirectoryEntry[];
|
|
152
|
+
iconIds: readonly string[];
|
|
153
|
+
insideWorkingTree: boolean;
|
|
154
|
+
kind: 'local' | 'package';
|
|
155
|
+
label: string;
|
|
156
|
+
} | {
|
|
157
|
+
iconIds: readonly string[];
|
|
158
|
+
kind: 'icon-set';
|
|
159
|
+
/** Canonical `@team/set` reference; the exact revision lives in the receipt. */
|
|
160
|
+
label: string;
|
|
161
|
+
packageId: string;
|
|
162
|
+
reference: string;
|
|
163
|
+
setId: string;
|
|
164
|
+
version: number;
|
|
165
|
+
versionId: string;
|
|
166
|
+
};
|
|
167
|
+
/** One effective icon after ordered last-wins replacement has completed. */
|
|
168
|
+
type TileflowComposedIconWinner = {
|
|
169
|
+
contributor: number;
|
|
170
|
+
id: string;
|
|
171
|
+
identity: TileflowEffectiveIconSourceIdentity;
|
|
172
|
+
/** Present only for filesystem-backed winners; verified shared cells expose no original. */
|
|
173
|
+
source: TileflowIconDirectorySourceFile | null;
|
|
174
|
+
};
|
|
175
|
+
type TileflowComposedIconSources = {
|
|
176
|
+
package: CompiledTileflowIconPackage | null;
|
|
177
|
+
composition: TileflowIconCompositionV1 | null;
|
|
178
|
+
contributors: TileflowComposedIconContributor[];
|
|
179
|
+
sourceIdentities: TileflowEffectiveIconSourceIdentity[];
|
|
180
|
+
replacements: Array<{
|
|
181
|
+
id: string;
|
|
182
|
+
replaced: number;
|
|
183
|
+
winner: number;
|
|
184
|
+
}>;
|
|
185
|
+
/** Exact files whose contents select this composition, such as the icon lock. */
|
|
186
|
+
watchFiles: string[];
|
|
187
|
+
/** Local directories whose children can change the composition without a config edit. */
|
|
188
|
+
watchPaths: string[];
|
|
189
|
+
winners: TileflowComposedIconWinner[];
|
|
190
|
+
};
|
|
191
|
+
/** The single normal icon-preparation path for declared local, package and shared contributors. */
|
|
192
|
+
declare function composeTileflowIconSources(input: readonly TileflowIconSource[], options: ComposeTileflowIconSourcesOptions): Promise<TileflowComposedIconSources>;
|
|
193
|
+
|
|
194
|
+
type TileflowBuildAsset = {
|
|
195
|
+
contentType: string;
|
|
196
|
+
fileName: string;
|
|
197
|
+
source: string | Uint8Array;
|
|
198
|
+
};
|
|
199
|
+
/** Executable authoring input before local sources have been resolved into runtime URLs. */
|
|
200
|
+
type TileflowSourceCatalog = TileflowBuildCatalog;
|
|
201
|
+
declare const preparedTileflowBuildCatalog: unique symbol;
|
|
202
|
+
/** A validated catalog paired with build-owned portable assets. */
|
|
203
|
+
type PreparedTileflowBuildCatalog = TileflowBuildCatalog & {
|
|
204
|
+
readonly [preparedTileflowBuildCatalog]: true;
|
|
205
|
+
};
|
|
206
|
+
type PreparedTileflowCatalog = {
|
|
207
|
+
assets: TileflowBuildAsset[];
|
|
208
|
+
baseDirectory: string;
|
|
209
|
+
cwd: string;
|
|
210
|
+
mapAssets: Record<string, TileflowPreparedMapAssets>;
|
|
211
|
+
/** Ordered shared dependency receipts, present only for maps that declare an Icon Set. */
|
|
212
|
+
mapIconCompositions: Record<string, TileflowIconCompositionV1>;
|
|
213
|
+
mapIconSources: Record<string, readonly TileflowEffectiveIconSourceIdentity[]>;
|
|
214
|
+
/** The files of each map's own 3D models, for its revision. */
|
|
215
|
+
mapModelSources?: Record<string, readonly TileflowEffectiveModelSourceIdentity[]>;
|
|
216
|
+
project: PreparedTileflowBuildCatalog;
|
|
217
|
+
sourceProject: TileflowSourceCatalog;
|
|
218
|
+
/** Exact files whose contents select the composition, such as the icon lock. */
|
|
219
|
+
watchFiles: string[];
|
|
220
|
+
watchPaths: string[];
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Explicit, trusted resolution settings for declared shared Icon Sets.
|
|
224
|
+
*
|
|
225
|
+
* These are supplied by the calling command or adapter. A lock file can never widen them, and no
|
|
226
|
+
* ambient process state selects a cache, an origin, or a transport.
|
|
227
|
+
*/
|
|
228
|
+
type TileflowIconResolutionOptions = TileflowIconCacheOptions;
|
|
229
|
+
type TileflowIconCompilationTarget = 'hosted' | 'local';
|
|
230
|
+
type TileflowIconCompilationIssue = {
|
|
231
|
+
message: string;
|
|
232
|
+
path: string;
|
|
233
|
+
};
|
|
234
|
+
type CompiledTileflowIconPackageFile = {
|
|
235
|
+
contentType: 'application/json' | 'image/png';
|
|
236
|
+
fileName: TileflowIconPackageFileName;
|
|
237
|
+
source: Uint8Array;
|
|
238
|
+
};
|
|
239
|
+
type CompiledTileflowIconPackage = {
|
|
240
|
+
contentHash: string;
|
|
241
|
+
files: CompiledTileflowIconPackageFile[];
|
|
242
|
+
manifest: TileflowIconPackageManifest;
|
|
243
|
+
};
|
|
244
|
+
type TileflowMapIconPackageBinding = {
|
|
245
|
+
appearances?: Record<string, TileflowIconAppearance>;
|
|
246
|
+
iconIds: readonly string[];
|
|
247
|
+
label: string;
|
|
248
|
+
mapName: string;
|
|
249
|
+
packageHash: string;
|
|
250
|
+
};
|
|
251
|
+
type CompileTileflowIconPackagesOptions = {
|
|
252
|
+
baseDirectory?: string;
|
|
253
|
+
cwd: string;
|
|
254
|
+
/** Trusted shared-set resolution settings; omitted means the default verified cache. */
|
|
255
|
+
icons?: TileflowIconResolutionOptions;
|
|
256
|
+
target: TileflowIconCompilationTarget;
|
|
257
|
+
};
|
|
258
|
+
type CompileTileflowIconPackagesResult = {
|
|
259
|
+
bindings: TileflowMapIconPackageBinding[];
|
|
260
|
+
/** Exact ordered dependency receipts, keyed by map, for maps that declare an Icon Set. */
|
|
261
|
+
compositions: Record<string, TileflowIconCompositionV1>;
|
|
262
|
+
packages: CompiledTileflowIconPackage[];
|
|
263
|
+
sourceIdentities: Record<string, readonly TileflowEffectiveIconSourceIdentity[]>;
|
|
264
|
+
/** Exact files whose contents select the composition, such as the icon lock. */
|
|
265
|
+
watchFiles: string[];
|
|
266
|
+
watchPaths: string[];
|
|
267
|
+
};
|
|
268
|
+
type InspectTileflowIconCatalogsOptions = {
|
|
269
|
+
baseDirectory?: string;
|
|
270
|
+
cwd: string;
|
|
271
|
+
icons?: TileflowIconResolutionOptions;
|
|
272
|
+
mapNames?: readonly string[];
|
|
273
|
+
};
|
|
274
|
+
type TileflowIconCatalogSourceFormat = 'jpeg' | 'png' | 'svg' | 'webp';
|
|
275
|
+
type TileflowIconCatalogAtlasRectangle = {
|
|
276
|
+
height: number;
|
|
277
|
+
width: number;
|
|
278
|
+
x: number;
|
|
279
|
+
y: number;
|
|
280
|
+
};
|
|
281
|
+
type TileflowIconCatalogRenderedDensity = {
|
|
282
|
+
atlas: TileflowIconCatalogAtlasRectangle;
|
|
283
|
+
height: number;
|
|
284
|
+
pixelRatio: 1 | 2;
|
|
285
|
+
pixelSha256: string;
|
|
286
|
+
width: number;
|
|
287
|
+
};
|
|
288
|
+
/** One winning icon's origin: a repository/package original, or an exact shared revision cell. */
|
|
289
|
+
type TileflowIconCatalogIconSource = {
|
|
290
|
+
byteLength: number;
|
|
291
|
+
contributor: number;
|
|
292
|
+
dimensions: {
|
|
293
|
+
height: number;
|
|
294
|
+
width: number;
|
|
295
|
+
} | null;
|
|
296
|
+
format: TileflowIconCatalogSourceFormat;
|
|
297
|
+
kind: 'file';
|
|
298
|
+
path: string;
|
|
299
|
+
} | {
|
|
300
|
+
contributor: number;
|
|
301
|
+
kind: 'icon-set';
|
|
302
|
+
reference: string;
|
|
303
|
+
version: number;
|
|
304
|
+
};
|
|
305
|
+
type TileflowIconCatalogIcon = {
|
|
306
|
+
appearance?: TileflowIconAppearance;
|
|
307
|
+
layout?: TileflowIconLayoutMetadata;
|
|
308
|
+
id: string;
|
|
309
|
+
rendered: {
|
|
310
|
+
oneX: TileflowIconCatalogRenderedDensity;
|
|
311
|
+
twoX: TileflowIconCatalogRenderedDensity;
|
|
312
|
+
};
|
|
313
|
+
source: TileflowIconCatalogIconSource;
|
|
314
|
+
};
|
|
315
|
+
/** One declared contributor in authoring order, retained even when fully shadowed. */
|
|
316
|
+
type TileflowIconCatalogContributor = {
|
|
317
|
+
iconIds: string[];
|
|
318
|
+
insideWorkingTree: boolean;
|
|
319
|
+
kind: 'local' | 'package';
|
|
320
|
+
label: string;
|
|
321
|
+
} | {
|
|
322
|
+
iconIds: string[];
|
|
323
|
+
kind: 'icon-set';
|
|
324
|
+
label: string;
|
|
325
|
+
reference: string;
|
|
326
|
+
version: number;
|
|
327
|
+
};
|
|
328
|
+
type TileflowIconCatalog = {
|
|
329
|
+
compiledPackage: CompiledTileflowIconPackage;
|
|
330
|
+
composition: TileflowIconCompositionV1 | null;
|
|
331
|
+
contributors: TileflowIconCatalogContributor[];
|
|
332
|
+
icons: TileflowIconCatalogIcon[];
|
|
333
|
+
insideWorkingTree: boolean;
|
|
334
|
+
replacements: TileflowIconReplacement[];
|
|
335
|
+
};
|
|
336
|
+
type TileflowIconReplacement = {
|
|
337
|
+
id: string;
|
|
338
|
+
replaced: string;
|
|
339
|
+
winner: string;
|
|
340
|
+
};
|
|
341
|
+
type TileflowIconCatalogMap = {
|
|
342
|
+
name: string;
|
|
343
|
+
icons: {
|
|
344
|
+
composition: TileflowIconCompositionV1 | null;
|
|
345
|
+
contributors: TileflowIconCatalogContributor[];
|
|
346
|
+
iconIds: string[];
|
|
347
|
+
kind: 'sources';
|
|
348
|
+
label: string;
|
|
349
|
+
packageHash: string;
|
|
350
|
+
} | {
|
|
351
|
+
kind: 'none';
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
type TileflowIconCatalogInspection = {
|
|
355
|
+
catalogs: TileflowIconCatalog[];
|
|
356
|
+
maps: TileflowIconCatalogMap[];
|
|
357
|
+
};
|
|
358
|
+
declare class TileflowIconCompilationError extends Error {
|
|
359
|
+
readonly code: "ICON_INVALID";
|
|
360
|
+
readonly issues: TileflowIconCompilationIssue[];
|
|
361
|
+
readonly phase: "icon-compilation";
|
|
362
|
+
constructor(issues: TileflowIconCompilationIssue[]);
|
|
363
|
+
}
|
|
364
|
+
type DecodedIconDimensions = {
|
|
365
|
+
height: number;
|
|
366
|
+
width: number;
|
|
367
|
+
};
|
|
368
|
+
declare const iconFileExtensions: Set<string>;
|
|
369
|
+
declare function compileTileflowIconPackages(project: TileflowBuildCatalog, options: CompileTileflowIconPackagesOptions): Promise<CompileTileflowIconPackagesResult>;
|
|
370
|
+
declare function inspectTileflowIconCatalogs(project: TileflowBuildCatalog, options: InspectTileflowIconCatalogsOptions): Promise<TileflowIconCatalogInspection>;
|
|
371
|
+
declare function prepareTileflowCatalogIcons(project: TileflowBuildCatalog, options: {
|
|
372
|
+
assetBaseUrl: string;
|
|
373
|
+
baseDirectory?: string;
|
|
374
|
+
cwd: string;
|
|
375
|
+
icons?: TileflowIconResolutionOptions;
|
|
376
|
+
}): Promise<PreparedTileflowCatalog>;
|
|
377
|
+
/**
|
|
378
|
+
* Report the exact filesystem inputs that can change the composed sprite.
|
|
379
|
+
*
|
|
380
|
+
* The lock beside the selected config is one of them; a lock edit rebuilds from its new exact
|
|
381
|
+
* pins. Catalog heads are never polled, so a newly published revision changes nothing here.
|
|
382
|
+
*/
|
|
383
|
+
declare function getTileflowIconWatchPaths(project: TileflowBuildCatalog, cwd: string, baseDirectory?: string): Promise<string[]>;
|
|
384
|
+
|
|
385
|
+
/** One declared icon file, including entries a later contributor eventually replaces. */
|
|
386
|
+
type TileflowIconDirectoryEntry = {
|
|
387
|
+
byteLength: number;
|
|
388
|
+
format: TileflowIconCatalogSourceFormat;
|
|
389
|
+
id: string;
|
|
390
|
+
kind: 'icon' | 'pattern';
|
|
391
|
+
/** Authoring-relative display path. Absolute filesystem paths never leave this module. */
|
|
392
|
+
path: string;
|
|
393
|
+
};
|
|
394
|
+
/** The decoded original behind one effective local winner. */
|
|
395
|
+
type TileflowIconDirectorySourceFile = TileflowIconDirectoryEntry & {
|
|
396
|
+
dimensions: DecodedIconDimensions;
|
|
397
|
+
};
|
|
398
|
+
type ReadTileflowIconDirectoryResult = {
|
|
399
|
+
containmentRoot: string;
|
|
400
|
+
entries: TileflowIconDirectoryEntry[];
|
|
401
|
+
iconIds: string[];
|
|
402
|
+
/** Authoring label: a config-relative directory or a safe `npm:<package>/<path>` descriptor. */
|
|
403
|
+
label: string;
|
|
404
|
+
realPath: string;
|
|
405
|
+
render: (ids: readonly string[]) => Promise<Array<{
|
|
406
|
+
icon: TileflowRenderedIcon;
|
|
407
|
+
identity: TileflowEffectiveIconSourceIdentity;
|
|
408
|
+
source: TileflowIconDirectorySourceFile;
|
|
409
|
+
sourceBytes: number;
|
|
410
|
+
}>>;
|
|
411
|
+
watchPath?: string;
|
|
412
|
+
};
|
|
413
|
+
/** A bounded local source snapshot used by the explicit shared-composition build port. */
|
|
414
|
+
declare function readTileflowIconDirectory(source: TileflowIconDirectory, options: {
|
|
415
|
+
baseDirectory: string;
|
|
416
|
+
/** Trusted caller-owned diagnostic prefix, such as `maps.main.icons`. */
|
|
417
|
+
configPath?: string;
|
|
418
|
+
cwd: string;
|
|
419
|
+
/** Ordinal of this directory inside the declared contributor sequence. */
|
|
420
|
+
ordinal?: number;
|
|
421
|
+
target: TileflowIconCompilationTarget;
|
|
422
|
+
}): Promise<ReadTileflowIconDirectoryResult>;
|
|
423
|
+
|
|
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 };
|