@tileflow/dev 0.1.0-alpha.2 → 0.1.0-alpha.20

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 CHANGED
@@ -2,12 +2,552 @@
2
2
 
3
3
  Node utilities used by the Tileflow CLI and build integrations.
4
4
 
5
+ Most apps should use `tileflow`, `@tileflow/vite`, or `@tileflow/next` directly. Use this
6
+ package when you are building a custom dev server, bundler plugin, or deployment adapter that needs
7
+ to load and compile the single map exported by `tileflow.config.ts`.
8
+
5
9
  ```ts
6
- import { createTileflowBuildArtifacts } from "@tileflow/dev";
10
+ import {createTileflowBuildArtifacts} from '@tileflow/dev/artifacts';
7
11
 
8
12
  const artifacts = await createTileflowBuildArtifacts({
9
- config: "tileflow.config.ts",
13
+ config: 'tileflow.config.ts',
14
+ });
15
+
16
+ try {
17
+ // Serve, capture, or write this exact generation.
18
+ } finally {
19
+ await artifacts.dispose?.();
20
+ }
21
+ ```
22
+
23
+ The integration surfaces are deliberately split: use `@tileflow/dev/artifacts` for source
24
+ preparation and production outputs, `@tileflow/dev/server` for HTTP development handling,
25
+ `@tileflow/dev/icons` for icon compilation, `@tileflow/dev/inspect` for safe resolved-config and
26
+ bounded feature inspection, `@tileflow/dev/validation` for structured diagnostics, and
27
+ `@tileflow/dev/preview` only for the local preview contract. The root entry keeps compatibility
28
+ re-exports.
29
+
30
+ Artifact construction is an explicit `source map → resolved map → prepared map → ArtifactPlan`
31
+ pipeline. Map inheritance resolves before its ordered local/package icon and font directories are
32
+ prepared, and before the result reaches the core style compiler. The Node layer may normalize
33
+ the map into an internal build catalog, but that catalog is orchestration state rather than another
34
+ public authoring model. The plan exposes its complete files and observed input graph, so build
35
+ adapters emit and watch the same generation instead of reconstructing either list themselves. Production manifests
36
+ point to content-addressed `generations/<sha256>/...` theme styles and sprites; those immutable files are
37
+ installed before the manifest pointer changes. Stable style paths are
38
+ `styles/<map>/<theme>.json`; every manifest lookup resolves a concrete theme. The disk writer also stages the complete plan,
39
+ records a managed-file inventory, rolls back caught filesystem failures, and removes only stale
40
+ files named by its previous valid inventory. Stable `styles/` and `icons/` paths remain available,
41
+ but generation-consistent consumers resolve maps through `manifest.json`.
42
+
43
+ A local `hostedTileset()` path remains user-owned input. Dev performs bounded header, root-directory,
44
+ and metadata checks, then creates an opaque immutable snapshot under
45
+ `.tileflow/cache/pmtiles-snapshots/v1/`, using copy-on-write cloning when available and a safe copy
46
+ otherwise. It does not hash the complete archive or traverse every leaf directory. Dev and Capture
47
+ read only that snapshot. The current generation and already-started operations retain references;
48
+ a replaced generation accepts no new acquisitions and is collected after its last operation.
49
+ The Style-facing path remains `tilesets/<logical-id>.pmtiles` across generations; physical snapshot
50
+ identity stays out of Style JSON. Generation ETags make cached PMTiles reads restart instead of
51
+ mixing ranges when current changes. Invalid edits keep the prior valid generation. Production
52
+ writers reject unresolved local PMTiles instead of copying, content-addressing, deduplicating, or
53
+ retaining them. Explicit `tileset publish` owns managed publication and exhaustive validation.
54
+ Startup removes snapshot generations owned by dead processes, and symlinked snapshot-store
55
+ boundaries are rejected.
56
+
57
+ Every plan also emits canonical `build-manifest.json` (schema version 1). For each map it records
58
+ the leaf `mapVersion`, resolved lineage, effective icon/font source identities, semantic compiler ABI, and
59
+ one entry per concrete theme with `colorScheme`, identity, inferred legacy `dataRequirements`,
60
+ multi-source `sourceRequirements`, and `styleSha256`. The multi-source contract records each
61
+ referenced vector source independently and records raster DEM source ID, encoding, and tile size;
62
+ it therefore distinguishes Bathymetry vector bands from optional relief without inventing vector
63
+ fields. `mapRevisionSha256` identifies the effective cartographic definition after `extends`;
64
+ `assetSetSha256` for that map's generated runtime resources. Data requirements are derived from the
65
+ final Style layers and fields rather than copied from a manually maintained allowlist, so disabled
66
+ or overridden modules do not claim data they no longer use. Maps use the single implicit semantic
67
+ compiler; its ABI remains a separate `semanticCompiler: {name, version}` build-manifest axis.
68
+
69
+ The map revision is versioned and domain-separated. It contains the resolved cartographic design,
70
+ semantic language version, effective public module/render-stack design, and effective icon/font
71
+ identities. Map `id`, `name`, editorial `mapVersion`, default `view`, capture `scenes`, package
72
+ SemVer, compiler ABI, local paths, timestamps, generated sprite/font output, and a
73
+ concrete resolution of a floating World selector are deliberately outside it. Changing a shadowed
74
+ ancestor does not change the revision; changing an effective cartographic override or source asset
75
+ does. Lineage and the leaf `mapVersion` remain beside the hash for traceability, and Style JSON owns
76
+ its compiled-output identity. Hosted browser policy is managed outside repository artifacts. The
77
+ top-level `provenance` block records the exact participating Tileflow package versions and the
78
+ nearest package-manager lockfile's format and content hash, without embedding its local path;
79
+ provenance remains outside every map revision. The same portable block is available to Hosted
80
+ adapters through
81
+ `createTileflowBuildProvenance(cwd)`. The dev server exposes the complete document at
82
+ `/build-manifest.json`.
83
+
84
+ `createTileflowStyle`, `createTileflowStyles`, and artifact construction all enforce the same
85
+ recursive JSON-value invariant and MapLibre style-spec semantics without fetching remote resources.
86
+ The family API returns `styles[map][theme]`; it never flattens a default theme into a map alias.
87
+ Invalid output throws `TileflowStyleValidationError` with at most 32 deterministic
88
+ `map`/`path`/`message` issues; layer indexes are projected to stable layer IDs.
89
+
90
+ For a watched, last-known-good integration, use one artifact session rather than recompiling each
91
+ request independently:
92
+
93
+ ```ts
94
+ import {createTileflowArtifactSession} from '@tileflow/dev/artifacts';
95
+
96
+ const session = await createTileflowArtifactSession({
97
+ config: 'tileflow.config.ts',
98
+ watch: true,
99
+ });
100
+
101
+ const unsubscribe = session.subscribe((state) => {
102
+ // building -> ready, or invalid while getLastGoodArtifacts() remains available
103
+ console.log(state.status, state.generation);
104
+ });
105
+
106
+ unsubscribe();
107
+ await session.close();
108
+ ```
109
+
110
+ `getState()` and `getLastGoodArtifacts()` are borrowed synchronous views. Before starting async
111
+ work, call `session.acquireArtifacts(generation?)` and release the returned acquisition in `finally`.
112
+ A replacement stops new acquisitions of the old generation and deletes its snapshot after the last
113
+ release. `close()` waits for outstanding acquisitions.
114
+
115
+ The bounded watcher follows the config, transitive local TypeScript/JavaScript/JSON imports, and
116
+ effective local icon/font directory inputs. Generations are monotonic, overlapping refreshes are latest-wins, invalid
117
+ edits retain the last good snapshot, and caller-supplied output directories can be ignored to avoid
118
+ feedback loops. `tileflow preview` (`tileflow dev` compatibility alias), `capture --watch`, and
119
+ framework adapters use this shared status
120
+ vocabulary. The built-in preview reloads after its live event stream reconnects following a server
121
+ restart, even when the replacement process begins again at generation 1.
122
+
123
+ Custom preview servers use the exported map or one of its standalone scenes:
124
+
125
+ ```ts
126
+ import {createTileflowDevRequestHandler} from '@tileflow/dev/server';
127
+
128
+ const fetch = createTileflowDevRequestHandler({
129
+ session,
130
+ scene: 'madrid-mobile',
131
+ });
132
+
133
+ // On server shutdown:
134
+ await Promise.all([fetch.close(), session.close()]);
135
+ ```
136
+
137
+ The handler does not close a caller-owned session.
138
+
139
+ Map preview uses the exported map's `view` and accepts one concrete `theme`; scene preview uses its
140
+ committed concrete theme, camera, and CSS viewport metadata from that same map. A scene does not
141
+ repeat the map ID because its owner is implicit.
142
+ `resolveTileflowPreview()` exposes the validated selection for custom integrations.
143
+ Application-target scenes remain the responsibility of the application's development server. The
144
+ built-in preview records longitude, latitude, zoom, bearing, and pitch in the current URL, so browser
145
+ refreshes and config-triggered reloads return to the same view. Removing those query parameters
146
+ restores the configured camera.
147
+
148
+ ## Local comparison workbench and compiler inspection
149
+
150
+ The CLI exposes the complete authoring surface through `tileflow preview --against-map ...` or
151
+ `--against-config ...`. Custom local servers can compose the same shell around two existing dev
152
+ handlers:
153
+
154
+ ```ts
155
+ import {createTileflowComparisonRequestHandler} from '@tileflow/dev/server';
156
+
157
+ const fetch = createTileflowComparisonRequestHandler({
158
+ left: {
159
+ basePath: '/left',
160
+ handler: leftHandler,
161
+ label: 'candidate / light',
162
+ previewUrl: '/left/',
163
+ sidecarUrl: '/left/__inspection/candidate/light.json',
164
+ },
165
+ right: {
166
+ basePath: '/right',
167
+ handler: rightHandler,
168
+ label: 'reference / light',
169
+ previewUrl: '/right/',
170
+ sidecarUrl: '/right/__inspection/reference/light.json',
171
+ },
172
+ });
173
+ ```
174
+
175
+ Each side handler retains ownership of its styles, fonts, sprites, events, diagnostics, and
176
+ last-known-good artifact generation. The comparison router only owns the root HTML and strict
177
+ dispatch to two disjoint same-origin route prefixes. Its synchronized camera, URL state,
178
+ side-by-side/split/overlay/blink modes, rendered-feature inspector, zoom-curve sampling, sprite
179
+ atlas, and scene/capture-command copying require no hosted service.
180
+
181
+ Set `inspection: true` on `createTileflowBuildArtifacts` or
182
+ `createTileflowArtifactSession` to compute `artifacts.styleInspections[map][theme]`. A dev handler
183
+ serves an available sidecar at `/__inspection/<map>/<theme>.json`; otherwise that route is 404. The
184
+ option is deliberately off by default. Sidecars remain in memory, do not alter Style bytes or
185
+ manifest hashes, and are excluded from `getTileflowArtifactFiles()` and every stable build output.
186
+
187
+ When a resolved map declares `fonts`, preparation reads its ordered directories and uses OpenType
188
+ full names as the canonical IDs referenced by `text-font`. TTF, OTF, and WOFF2 inputs are supported;
189
+ every contributing directory must contain `LICENSE.txt`. Later directories replace earlier faces
190
+ with the same exact ID, case-only collisions fail, and every primary font in the final style must be
191
+ present. `font` is an exact face ID; local `fallbacks` entries are exact face names or explicit CSS
192
+ generic families such as `sans-serif`. Preparation never synthesizes a face name from a family and
193
+ weight. Only selected primary faces and licenses are emitted as
194
+ content-addressed managed artifacts.
195
+
196
+ `fonts` and `glyphs` are mutually exclusive map fields. Omission inherits the parent's current text
197
+ provider; declaring either one replaces an inherited provider of either kind atomically. The font
198
+ pipeline is driven only by directory metadata and final style usage—there are no hard-coded map or
199
+ family names, and a URL provider comes only from the resolved map instead of being invented by the
200
+ pipeline. After inheritance resolves, a map with any text layer must have exactly one provider. A
201
+ `glyphs: {kind: 'url', ...}` provider enumerates the exact comma-joined MapLibre request keys
202
+ produced by the style's `text-font` arrays.
203
+
204
+ The resulting style records strict `tileflow:fontFaces` metadata. Preview, capture, and browser
205
+ framework adapters load those definitions before constructing MapLibre. Hosted deploy rejects a
206
+ prepared local-font bundle before authentication until managed font storage is available. A derived
207
+ map that declares `glyphs` replaces the inherited local provider atomically; the URL-backed map is
208
+ complete as declared and independent of its World selection.
209
+
210
+ For Streets styles whose vegetation layer declares `tileflow:vegetation-mode = 3d`, the built-in
211
+ preview uses the same portable circle fallback as capture and the published framework adapters by
212
+ default. This makes an ordinary `tileflow preview` session WYSIWYG with production and visual
213
+ baselines. Append `?treeRenderer=simple` or `?treeRenderer=complex` to opt into the experimental,
214
+ preview-only instanced renderer described below; that explicit mode is not capture evidence.
215
+
216
+ The experimental renderer uses source height and crown diameter when present, distinguishes palms,
217
+ columnar cypresses, conifers, and three broadleaf silhouettes from the bound botanical fields, and
218
+ falls back to deterministic broadleaf variety and dimensions when tags are missing. Bark color,
219
+ crown palettes, height scale, and crown scale come from `vegetation.threeDimensional`; the preview
220
+ does not maintain a second hard-coded appearance contract. During camera
221
+ gestures the existing 3D batch remains visible while native circles cover newly arriving tiles; the
222
+ batch refreshes when movement ends without waiting for the whole map to become idle. Source-tile
223
+ events are rate-limited and unchanged instance selections do not upload new GPU buffers. The
224
+ preview caps one view at 3,000 trees and uses zoom-dependent density. Both detailed modes use thin,
225
+ tapered trunks, branches that enter the crown, softly shaded overlapping ellipsoids, and stable
226
+ per-tree scale and rotation. `simple` reduces lobe and segment counts; `complex` keeps the complete
227
+ round, open, avenue, pine, cypress, and palm silhouettes. Each archetype remains fused into one
228
+ reusable geometry and every complete tree remains
229
+ one GPU instance, so the additional detail introduces no extra draw calls. The experimental
230
+ renderer defaults to its WebGL2 backend, which
231
+ draws those instances directly without a Three.js scene traversal; append `&treeBackend=three` for
232
+ the compatibility backend. Use `?treeRenderer=circle`, `?treeRenderer=simple`, or
233
+ `?treeRenderer=complex&treeBenchmark=1` to compare identical scenes; the benchmark reports frame
234
+ p95, query, selection, build and render time, draw calls, and triangle count in the tree status badge.
235
+ Visible candidates come from MapLibre's worker-built tile index instead of a second copy of the
236
+ vector source. Terrain height is sampled on a fixed 5-by-5 viewport grid and interpolated per tree,
237
+ avoiding hundreds of synchronous terrain queries when a new batch first appears.
238
+ The separate `TREES ON/OFF` control sits below the building `3D ON/OFF` control and pauses tree
239
+ refresh work while disabled. Both choices survive reloads and shared links through the
240
+ `buildings3d=on|off` and `trees3d=on|off` URL parameters.
241
+
242
+ Detailed trees retain the compiler's scene order: they render above road and pedestrian surfaces,
243
+ ordinary building geometry, and detailed landmark models. Map labels and other annotations remain
244
+ above the physical scene, while road names and route references stay attached to the carriageway
245
+ below buildings and trees.
246
+
247
+ The same control toggles any compiled layer whose metadata contains
248
+ `tileflow:3d-toggle = building`. It switches the building volumes independently from the camera,
249
+ so enabling 3D never changes the pitch and users remain free to tilt the map with pointer controls.
250
+
251
+ ### Detailed landmark models
252
+
253
+ A hidden style layer can opt the Streets preview into detailed GLB landmarks by setting
254
+ `tileflow:landmark-manifest-url` in its metadata. The bounded version-2 manifest indexes GLB entries
255
+ inside one or more PMTiles archives and is fetched only when the 3D building control is enabled near
256
+ the landmark runtime zoom. Archive URLs may be absolute or relative to the manifest URL.
257
+
258
+ ```json
259
+ {
260
+ "schemaVersion": 2,
261
+ "id": "madrid-landmarks-2026-08-19",
262
+ "minzoom": 16,
263
+ "maximumVisibleModels": 8,
264
+ "maximumCachedModels": 16,
265
+ "archives": [
266
+ {
267
+ "id": "madrid-v1",
268
+ "url": "./madrid-landmarks-v1.pmtiles",
269
+ "bytes": 14832912,
270
+ "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
271
+ }
272
+ ],
273
+ "landmarks": [
274
+ {
275
+ "id": "palacio-cibeles",
276
+ "center": [-3.6921, 40.4193],
277
+ "bounds": [-3.693, 40.4186, -3.6912, 40.42],
278
+ "priority": 100,
279
+ "models": [
280
+ {
281
+ "minzoom": 16,
282
+ "archiveId": "madrid-v1",
283
+ "z": 0,
284
+ "x": 0,
285
+ "y": 0,
286
+ "bytes": 481024,
287
+ "sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
288
+ "axisConvention": "EUN_Y_UP"
289
+ },
290
+ {
291
+ "minzoom": 18,
292
+ "archiveId": "madrid-v1",
293
+ "z": 1,
294
+ "x": 0,
295
+ "y": 0,
296
+ "bytes": 1276416,
297
+ "sha256": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
298
+ "axisConvention": "EUN_Y_UP"
299
+ }
300
+ ]
301
+ }
302
+ ]
303
+ }
304
+ ```
305
+
306
+ `maximumVisibleModels` is bounded to 1–64. `maximumCachedModels` defaults to twice that value,
307
+ must be at least the visible limit, and is bounded to 128. Higher `priority` values win when more
308
+ landmarks intersect the viewport than can be shown. `models[0]` is the base LOD and must start at the
309
+ manifest `minzoom`; later entries replace it at their distinct `minzoom`. The parser bounds manifest,
310
+ archive, landmark, model and GLB-entry sizes, rejects credential-bearing or non-HTTP archive URLs,
311
+ and verifies each extracted entry's declared byte length and SHA-256 before parsing it.
312
+
313
+ The preview starts the Three.js runtime and manifest request together one zoom before the landmark
314
+ layer becomes visible. A landmark entering directly at a close zoom always displays its base LOD
315
+ first and upgrades in place. Nearby base LODs are warmed in the parsed-model cache. Style layers
316
+ marked with `tileflow:landmark-fallback = true` remain visible until the corresponding active GLB is
317
+ ready, so a cold request never leaves an empty building volume.
318
+
319
+ Embedded Streets previews also accept a same-origin parent command without reloading the document:
320
+
321
+ ```js
322
+ iframe.contentWindow.postMessage(
323
+ {
324
+ type: 'tileflow:set-map-state',
325
+ schemaVersion: 1,
326
+ state: {
327
+ center: [-3.688344, 40.453053],
328
+ zoom: 17.75,
329
+ bearing: -24,
330
+ pitch: 58,
331
+ buildings3d: true,
332
+ trees3d: false,
333
+ visibleLayerGroups: ['labels', 'roads', 'buildings', 'landuse', 'water'],
334
+ },
335
+ },
336
+ location.origin,
337
+ );
338
+ ```
339
+
340
+ The command is applied atomically only for the embedding parent, with exact same-origin and numeric
341
+ range checks. `visibleLayerGroups` is optional and accepts only `labels`, `pois`, `roads`, `transit`,
342
+ `buildings`, `landuse`, and `water`; omitted groups are hidden while base background and attribution
343
+ remain. Camera and toggle state continue to be written to the preview URL after application.
344
+
345
+ GLB base colors, textures, emissive values, metalness, and roughness are authoritative and are not
346
+ rewritten by the preview. Models outside the active selection remain hidden in a least-recently-used
347
+ cache; leaving the cache disposes their geometry, materials, and textures.
348
+
349
+ The vector building represented by a detailed model must carry `hide_3d = true`. The ordinary
350
+ building extrusion and both screen-space shadow passes filter on that field, preventing the coarse
351
+ volume from intersecting the GLB while retaining the flat footprint below it. This flag belongs in
352
+ the vector-tile dataset; the landmark endpoint cannot substitute for it. Version model and GLB URLs
353
+ so they can be served with immutable caching. Cross-origin endpoints must allow credentialed GETs
354
+ because the development renderer requests the manifest and models with credentials.
355
+
356
+ If a map uses `icons: ['./icons/brand']`, build artifacts include the generated MapLibre
357
+ `sprite.json`, `sprite.png`, `sprite@2x.json`, and `sprite@2x.png` beside its style. Ordinary sources
358
+ are normalized into 24 px icon cells. A source named `<id>.pattern.svg` (or another supported raster
359
+ format with the same marker) instead keeps its intrinsic dimensions and is published as `<id>`.
360
+ This provides calibrated, non-square textures for line and fill patterns while the runtime still
361
+ consumes only the generated PNG sprite. Pattern widths must be a power of two from 2 through 512
362
+ pixels, matching MapLibre's seamless line-pattern contract.
363
+
364
+ `icons` is one ordered array. Omitting it inherits the parent's exact array, declaring it replaces
365
+ the array atomically, and `[]` means no icons. Use a spread to preserve imported directories while
366
+ adding or replacing files:
367
+
368
+ ```ts
369
+ import {defineMap} from '@tileflow/core';
370
+ import {streets} from '@tileflow/maps';
371
+
372
+ export default defineMap({
373
+ id: 'brand-map',
374
+ version: 1,
375
+ extends: streets,
376
+ icons: [...streets.icons, './icons/brand'],
10
377
  });
11
378
  ```
12
379
 
380
+ Directories apply left to right. `<id>.<ext>` publishes an icon as `<id>`;
381
+ `<id>.pattern.<ext>` publishes the intrinsic-size pattern as `<id>`. The published ID must already
382
+ be canonical lower-kebab-case. A later file replaces an earlier file only for the same exact ID;
383
+ case-only collisions fail. Package maps export `streetsIcons`, `baedekerIcons`, `ferrarisIcons`,
384
+ `haradIcons`, `siegfriedIcons`, `soundingsIcons`, `cyberpunkIcons`, `matrixIcons`, and
385
+ `verdantIcons`, and `sanFrancistoIcons` directory descriptors from `@tileflow/maps`. Cyberpunk,
386
+ Matrix, Baedeker, and Siegfried also export `cyberpunkFonts`, `matrixFonts`, `baedekerFonts`, and
387
+ `siegfriedFonts`. Preparation
388
+ resolves package descriptors inside their owning package, checks real-path containment, and
389
+ compiles them through the same pipeline as a config-relative directory. There are no
390
+ built-in/source/sprite selectors, mappings, icon-specific inheritance, or compatibility aliases.
391
+
392
+ Local directories resolve from the directory containing the selected `tileflow.config.ts`, while
393
+ the workspace `cwd` remains their containment boundary. Canonical local syntax starts with `./` or
394
+ one or more leading `../` segments and then uses only non-empty segments other than `.` or `..`;
395
+ trailing or repeated slashes, backslashes, controls, and paths longer than 512 characters fail.
396
+
397
+ ## Structured config inspection and diagnostics
398
+
399
+ Custom Node tooling can use the same deterministic documents as `tileflow validate --json` and
400
+ `tileflow inspect --json`:
401
+
402
+ ```ts
403
+ import {inspectTileflowConfig} from '@tileflow/dev/inspect';
404
+ import {
405
+ createTileflowCommandFailureDocument,
406
+ serializeTileflowCommandDocument,
407
+ } from '@tileflow/dev/validation';
408
+
409
+ try {
410
+ const inspection = await inspectTileflowConfig({config: 'tileflow.config.ts'});
411
+ process.stdout.write(serializeTileflowCommandDocument(inspection));
412
+ } catch (error) {
413
+ const failure = createTileflowCommandFailureDocument('inspect', error, process.cwd(), {
414
+ code: 'INSPECTION_FAILED',
415
+ phase: 'config-inspection',
416
+ });
417
+ process.stderr.write(serializeTileflowCommandDocument(failure));
418
+ }
419
+ ```
420
+
421
+ The inspection resolves one config load into sorted maps, root-to-leaf lineage, declared paths, and
422
+ leaf-level merge provenance. Its `themeContract` exposes the default/system mapping, shared token
423
+ schema, concrete resolved token values, typography and lighting, differences from the default, and
424
+ stable `THEME_IMPLICIT_FIXED` diagnostics across modules, render stacks, and terrain. Each
425
+ diagnostic carries a semantic scope and, for module values, its owner, plus machine-readable
426
+ severity and remediation. Colors, fonts, and images are followed through
427
+ expression outputs; numeric diagnostics intentionally cover only direct visual scalars, excluding
428
+ expression operands, zoom stops, tuples, placement, priority, and other structural numbers.
429
+ Agents can therefore edit semantic roles without
430
+ reverse-engineering compiler layers or parsing prose. It never returns `inputFiles`, absolute filesystem paths, credentials,
431
+ URL queries, data URLs, or recognized secret formats. Structured summaries and diagnostics use the
432
+ same required schema-version-1 fields and bounded safe suggestions so consumers do not need to
433
+ parse human prose.
434
+
435
+ ## Bounded PMTiles resource inspection
436
+
437
+ Node tooling can inspect one local PMTiles archive without reading it completely:
438
+
439
+ ```ts
440
+ import {inspectTileflowPmtiles} from '@tileflow/dev/tilesets';
441
+
442
+ const inspection = await inspectTileflowPmtiles('./data/stores.pmtiles', {
443
+ includeValues: ['category', 'status'],
444
+ });
445
+ ```
446
+
447
+ Inspection schema 1 separates the authoritative PMTiles header and TileJSON `vector_layers` metadata
448
+ from deterministic bounded MVT observations. Each sampled field reports present/missing feature
449
+ counts, observed primitive types, capped distinct-value cardinality, numeric min/max, and explicit
450
+ truncation. Values are returned only for requested portable field names, with at most 32 requested
451
+ fields, 16 values per field, and 256 characters per string. Sampling reads at most eight tiles,
452
+ 20,000 features, or 24 MB of tile data; `sample: false` returns only authoritative metadata and does
453
+ not accept `includeValues`.
454
+
455
+ ## Bounded vector-feature inspection
456
+
457
+ Custom Node tooling can inspect only the features visible near a configured camera without opening
458
+ a browser:
459
+
460
+ ```ts
461
+ import {inspectTileflowFeatures} from '@tileflow/dev/inspect';
462
+
463
+ const internalCatalog = artifacts.project;
464
+ const inspection = await inspectTileflowFeatures(internalCatalog, 'madrid', {
465
+ center: [-3.6927512, 40.4086555],
466
+ zoom: 16,
467
+ sourceLayers: ['poi'],
468
+ properties: ['name', 'category', 'type', 'icon', 'filter_rank', 'size_rank'],
469
+ width: 512,
470
+ height: 512,
471
+ limit: 100,
472
+ });
473
+ ```
474
+
475
+ The inspector supports ordinary HTTP(S) vector sources and TileJSON. It bounds viewport, tile
476
+ count, individual/total bytes, scanned and returned features, property count/string lengths, and
477
+ request time; results are deduplicated and sorted deterministically. Output contains projected
478
+ properties, geometry summaries, safe origin/path metadata, and the configured source revision or
479
+ `null`. It never emits URL queries, credentials, hidden properties, response bodies, or absolute
480
+ paths. PMTiles and authenticated provider adapters are not currently supported by this primitive.
481
+
482
+ Deployment adapters can compile the same sources without writing them to disk:
483
+
484
+ ```ts
485
+ import {compileTileflowIconPackages} from '@tileflow/dev/icons';
486
+
487
+ const internalCatalog = artifacts.project;
488
+ const result = await compileTileflowIconPackages(internalCatalog, {
489
+ cwd: process.cwd(),
490
+ target: 'hosted',
491
+ });
492
+ ```
493
+
494
+ Streets declares `[streetsIcons]` and keeps light/dark image-token targets in that one closure;
495
+ Cyberpunk and Matrix independently declare `[cyberpunkIcons]` and `[matrixIcons]`. Baedeker,
496
+ Ferraris, Härad, Siegfried, Soundings, Verdant, and San Francisto declare only `[baedekerIcons]`,
497
+ `[ferrarisIcons]`, `[haradIcons]`, `[siegfriedIcons]`, `[soundingsIcons]`, `[verdantIcons]`, and
498
+ `[sanFrancistoIcons]`, respectively. No official root composes another map's assets even though all
499
+ use the semantic compiler ABI. Baedeker's directory contains eight original travel-atlas patterns;
500
+ its browser-derived Mapterhorn contours use runtime terrain tiles and are not part of the icon
501
+ package. Härad's directory contains nine original Tileflow patterns inspired by Lantmäteriet's CC0
502
+ Häradsekonomiska kartan series from 1859–1934. Soundings owns ten original nautical symbols and
503
+ patterns. San Francisto owns four technical blueprint patterns and one schematic POI node; its
504
+ unbundled Mapterhorn contours remain runtime terrain, and its text uses the canonical Noto Sans
505
+ glyph provider. An application map may inherit a root's exact array, replace it, clear it with `[]`,
506
+ or compose it explicitly with a spread.
507
+ `modules.poi.icons: false` or a disabled POI module suppresses POI icon layers without moving asset
508
+ ownership into dev. POI density is the numeric producer threshold 1–5; it is not an asset-provider
509
+ preset.
510
+
511
+ The hosted target enforces repository containment, portable icon IDs, safe SVG
512
+ references, deterministic ordering, and the public package limits. Package-owned directories are
513
+ trusted only inside their declared owning package and are exempt from config working-tree
514
+ containment. It returns deduplicated generated files plus a canonical manifest/content hash. Upload
515
+ only those generated files: source icons and absolute paths remain local.
516
+
517
+ The version-1 manifest includes `renderedIcons` in the exact sorted `iconNames` order. Each entry
518
+ contains SHA-256 digests for the normalized 1x and 2x RGBA cell. The digest framing includes its
519
+ density and dimensions, zeroes RGB only where alpha is zero, and excludes filenames/source bytes.
520
+ The package content hash still covers the complete canonical manifest, including all four encoded
521
+ file hashes. Consumers can therefore distinguish a visible per-icon change from an atlas-layout or
522
+ encoding-only package change without receiving the original SVG/raster file.
523
+
524
+ `compileTileflowIconPackages` retains the exact RGBA cells used to assemble each atlas, so its
525
+ pixel digests describe delivered pixels rather than a second render. Hosted upload services must
526
+ decode the submitted PNGs and reconstruct those digests independently; client-authored manifest
527
+ analysis is not authoritative.
528
+
529
+ Custom Node tooling can inspect the same local pipeline without walking or decoding source files a
530
+ second time:
531
+
532
+ ```ts
533
+ import {inspectTileflowIconCatalogs} from '@tileflow/dev/icons';
534
+
535
+ const internalCatalog = artifacts.project;
536
+ const inspection = await inspectTileflowIconCatalogs(internalCatalog, {
537
+ cwd: process.cwd(),
538
+ mapNames: ['madrid'],
539
+ });
540
+ ```
541
+
542
+ The result keeps one catalog per distinct ordered directory composition, the exact winning source
543
+ for every final ID, explicit same-ID replacements, config-relative source metadata, exact atlas rectangles,
544
+ both manifest pixel digests, and the shared compiled package. `icons: []` is represented as an
545
+ absent catalog. This is a local-authoring integration surface: use the hosted compilation target
546
+ separately for deployment compatibility, and project only the metadata needed by an external
547
+ protocol rather than serializing generated byte arrays accidentally.
548
+
549
+ This package is public, but it is an integration layer. Styling primitives live in
550
+ `@tileflow/core`, official maps and their source assets live in `@tileflow/maps`, and React
551
+ rendering lives in `@tileflow/react`.
552
+
13
553
  Docs: https://tileflow.dev/docs
@@ -0,0 +1,69 @@
1
+ # Third-party notices
2
+
3
+ This file records third-party components used by Node preparation and preview. Official map artwork
4
+ and fonts are owned and published by `@tileflow/maps`; `@tileflow/dev` does not carry an `assets/`
5
+ directory. Runtime dependencies are installed as separate npm packages, and their code and native
6
+ binaries are not copied into the dev package.
7
+
8
+ ## Package-owned map fonts
9
+
10
+ The generic font preparation pipeline reads map-owned TTF, OTF, and WOFF2 directories; it does not
11
+ embed fonts in `@tileflow/dev`. Each source directory must carry its own `LICENSE.txt`, which is
12
+ copied into the deterministic build artifacts whenever that directory contributes a selected face.
13
+
14
+ The Cyberpunk map in `@tileflow/maps` currently owns unmodified Oxanium Medium and SemiBold TTFs.
15
+ Oxanium is copyright 2019 The Oxanium Project Authors and is distributed under the SIL Open Font
16
+ License 1.1. The source and binaries are pinned to upstream commit
17
+ `a8f39e0c71186190027a093e9001459410192d1e`; the complete license accompanies the files at
18
+ `@tileflow/maps/assets/cyberpunk/fonts/LICENSE.txt`.
19
+
20
+ - Source: <https://github.com/sevmeyer/oxanium/tree/a8f39e0c71186190027a093e9001459410192d1e>
21
+ - Google Fonts specimen: <https://fonts.google.com/specimen/Oxanium>
22
+ - License: <https://github.com/sevmeyer/oxanium/blob/a8f39e0c71186190027a093e9001459410192d1e/OFL.txt>
23
+
24
+ ## fontkit 2.0.4
25
+
26
+ Font metadata for TTF, OTF, and WOFF2 inputs is read with the separately installed `fontkit`
27
+ package. fontkit is copyright Devon Govett and contributors and is distributed under the MIT
28
+ License.
29
+
30
+ - Source: <https://github.com/foliojs/fontkit/tree/v2.0.4>
31
+ - License: <https://github.com/foliojs/fontkit/blob/v2.0.4/LICENSE>
32
+
33
+ ## PMTiles JavaScript 4.5.0
34
+
35
+ The local Streets preview loads the separately installed `pmtiles` browser decoder to retrieve
36
+ individual landmark GLB entries with HTTP byte ranges. PMTiles is copyright Protomaps and
37
+ contributors and is distributed under the BSD 3-Clause License. Its `fflate` dependency is
38
+ copyright 2020 Arjun Barrett and is distributed under the MIT License.
39
+
40
+ - PMTiles source and license: <https://github.com/protomaps/PMTiles/tree/v4.5.0/js>
41
+ - fflate source and license: <https://github.com/101arrowz/fflate/tree/v0.8.2>
42
+
43
+ ## sharp 0.35.3
44
+
45
+ `@tileflow/dev` declares `sharp` as an optional dependency and loads it dynamically only when local
46
+ SVG or raster icon sources must be inspected and packed. The Tileflow build externalizes `sharp`
47
+ rather than bundling it. `sharp` is copyright Lovell Fuller and contributors and is distributed under
48
+ the Apache License 2.0.
49
+
50
+ - Source: <https://github.com/lovell/sharp/tree/v0.35.3>
51
+ - License: <https://github.com/lovell/sharp/blob/v0.35.3/LICENSE>
52
+
53
+ ## sharp libvips distributions 1.3.2
54
+
55
+ `sharp` selects a separate optional `@img/sharp-libvips-*` package for the current platform. The
56
+ installed platform-package manifest declares `LGPL-3.0-or-later`; the packaging scripts themselves
57
+ are distributed under Apache-2.0. The packages contain prebuilt libvips and separately licensed
58
+ runtime dependencies. For `sharp` 0.35.3 the selected libvips ABI is 8.18.3.
59
+
60
+ - Packaging source: <https://github.com/lovell/sharp-libvips/tree/v1.3.2>
61
+ - Packaging-script license: <https://github.com/lovell/sharp-libvips/blob/v1.3.2/LICENSE>
62
+ - libvips 8.18.3 source: <https://github.com/libvips/libvips/tree/v8.18.3>
63
+ - libvips 8.18.3 license (LGPL-2.1-or-later):
64
+ <https://github.com/libvips/libvips/blob/v8.18.3/LICENSE>
65
+
66
+ Because `sharp` remains a separately installed optional package, users can install, update, remove,
67
+ or replace it independently of `@tileflow/dev`. Tileflow does not modify libvips and does not place a
68
+ libvips shared library or a `sharp` native addon inside any Tileflow package tarball. Release smoke
69
+ tests enforce that package boundary.
package/TRADEMARKS.md ADDED
@@ -0,0 +1,10 @@
1
+ # Tileflow trademarks
2
+
3
+ The Apache License, Version 2.0, and the Tileflow generated-output grant do not grant permission to
4
+ use the Tileflow name, `tileflow.dev`, logos, service marks, product names, or other Tileflow brand
5
+ features except for reasonable and customary use that truthfully describes the origin of the SDK or
6
+ compatibility with Tileflow, and for reproducing required notices.
7
+
8
+ You may not use Tileflow brand features in a way that suggests sponsorship, endorsement, or an
9
+ official Tileflow product when none exists. Third-party names and marks remain the property of their
10
+ respective owners.