@tileflow/dev 0.1.0-alpha.4 → 0.1.0-alpha.41

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 (45) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +264 -5
  3. package/THIRD_PARTY_NOTICES.md +309 -0
  4. package/dist/artifacts.d.ts +269 -0
  5. package/dist/artifacts.js +98 -0
  6. package/dist/chunk-AQUGMUZW.js +324 -0
  7. package/dist/chunk-C4VPHZ3F.js +4062 -0
  8. package/dist/chunk-D4OE4ITL.js +13 -0
  9. package/dist/chunk-FOMTSCOP.js +671 -0
  10. package/dist/chunk-GXLY73PD.js +3199 -0
  11. package/dist/chunk-KDFTE4Q5.js +156 -0
  12. package/dist/chunk-ONYQNLNA.js +1108 -0
  13. package/dist/chunk-RTU7TD4M.js +172 -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-BIHpw5Zy.d.ts +417 -0
  20. package/dist/icons.d.ts +3 -0
  21. package/dist/icons.js +41 -0
  22. package/dist/inspect.d.ts +149 -0
  23. package/dist/inspect.js +805 -0
  24. package/dist/inspector-browser.js +16955 -0
  25. package/dist/inspector-observer.js +95 -0
  26. package/dist/preview-assets-ATLLYY72.js +103 -0
  27. package/dist/preview.d.ts +31 -0
  28. package/dist/preview.js +1974 -0
  29. package/dist/server.d.ts +89 -0
  30. package/dist/server.js +3662 -0
  31. package/dist/tilesets.d.ts +89 -0
  32. package/dist/tilesets.js +6 -0
  33. package/dist/validation.d.ts +65 -0
  34. package/dist/validation.js +24 -0
  35. package/package.json +77 -13
  36. package/ui-fonts/hubot-sans-OFL.txt +93 -0
  37. package/ui-fonts/hubot-sans.woff2 +0 -0
  38. package/ui-fonts/inter-OFL.txt +92 -0
  39. package/ui-fonts/inter.woff2 +0 -0
  40. package/ui-fonts/jetbrains-mono-OFL.txt +93 -0
  41. package/ui-fonts/jetbrains-mono.woff2 +0 -0
  42. package/ui-fonts/mona-sans-OFL.txt +93 -0
  43. package/ui-fonts/mona-sans.woff2 +0 -0
  44. package/dist/index.d.ts +0 -54
  45. package/dist/index.js +0 -314
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,13 +1,272 @@
1
1
  # @tileflow/dev
2
2
 
3
- Node utilities used by the Tileflow CLI and build integrations.
3
+ Node.js utilities for custom Tileflow build tools and development servers. Load a trusted
4
+ `tileflow.config.ts`, prepare its assets, and produce a validated artifact generation.
5
+
6
+ Most applications should use the [CLI](https://github.com/tileflow/tileflow-sdk/blob/main/packages/cli/README.md)
7
+ or the [Vite](https://github.com/tileflow/tileflow-sdk/blob/main/packages/vite/README.md),
8
+ [Next.js](https://github.com/tileflow/tileflow-sdk/blob/main/packages/next/README.md), or
9
+ [Webpack](https://github.com/tileflow/tileflow-sdk/blob/main/packages/webpack/README.md) integration.
10
+ This package is for implementing an integration, not for browser rendering.
11
+
12
+ > Related packages and guides: [documentation index](https://raw.githubusercontent.com/tileflow/tileflow-sdk/main/llms.txt).
13
+
14
+ ## Install
15
+
16
+ Use Node.js 22 or newer:
17
+
18
+ ```sh
19
+ npm install --save-dev @tileflow/dev@alpha @tileflow/core@alpha @tileflow/maps@alpha
20
+ ```
21
+
22
+ Create a trusted `tileflow.config.ts` in the working directory:
23
+
24
+ <!-- docs:check -->
4
25
 
5
26
  ```ts
6
- import { createTileflowBuildArtifacts } from "@tileflow/dev";
27
+ import {defineMap} from '@tileflow/core';
28
+ import {streets} from '@tileflow/maps';
7
29
 
8
- const artifacts = await createTileflowBuildArtifacts({
9
- config: "tileflow.config.ts",
30
+ export default defineMap({id: 'madrid', version: 1, extends: streets});
31
+ ```
32
+
33
+ Loading the config executes its imports. It is not a sandbox for untrusted code. Local preparation
34
+ needs no API key, but serving a map can still cause requests to its remote data or font providers.
35
+
36
+ The CLI's local Inspector provides a dockable layer inspector, loaded tiles, assets, scene
37
+ controls and frame timing. Its element picker selects a layer and evaluates its rules using the
38
+ feature clicked on the map.
39
+ Debug's Overdraw overlay uses a heatmap with a visible pass-count legend and explanation.
40
+
41
+ ## Prepare a generation
42
+
43
+ <!-- docs:check -->
44
+
45
+ ```ts
46
+ import {createTileflowBuildArtifacts} from '@tileflow/dev/artifacts';
47
+
48
+ const artifacts = await createTileflowBuildArtifacts({config: 'tileflow.config.ts'});
49
+
50
+ try {
51
+ console.log(artifacts.manifest);
52
+ console.log(Object.keys(artifacts.styles.madrid));
53
+ } finally {
54
+ await artifacts.dispose?.();
55
+ }
56
+ ```
57
+
58
+ The artifact plan exposes files and observed inputs from the same generation. Styles are keyed as
59
+ `styles[map][theme]`, never as an implicit default-theme alias. Keep that generation alive for the
60
+ whole operation, then release it. Do not reconstruct its asset list from directory guesses.
61
+
62
+ Generated style files use compact JSON in both stable and immutable generation paths. Their
63
+ parsed contents are unchanged; format the JSON in your editor when inspecting a generated file.
64
+
65
+ Map-owned tree models are prepared alongside icons and embedded in the styles. Custom tools that
66
+ compile icons separately can use `prepareTileflowMapTreeModels` from `@tileflow/dev/icons` with
67
+ the map's model directories, base directory, working directory, target and diagnostic path. Pass
68
+ its `models` result as `preparedAssets.models` when compiling the style; retain its source
69
+ identities and watch paths when managing revisions. The artifact pipeline does this automatically.
70
+ A GLB whose materials name only `bark`, `leaves`, `fronds` or `stem` is a tree model; any other
71
+ is a building model, whose materials name its parts.
72
+
73
+ To write production output rather than manage it in memory:
74
+
75
+ <!-- docs:check -->
76
+
77
+ ```ts
78
+ import {writeTileflowBuildArtifacts} from '@tileflow/dev/artifacts';
79
+
80
+ await writeTileflowBuildArtifacts({
81
+ config: 'tileflow.config.ts',
82
+ outDir: 'public/tileflow',
10
83
  });
11
84
  ```
12
85
 
13
- Docs: https://tileflow.dev/docs
86
+ Serve the complete output. The writer installs immutable generation assets before changing the
87
+ manifest pointer, tracks its own files, and refuses to replace a hosted manifest by default.
88
+ Web output includes `families/<map>.json` and its immutable generation copy. The version-3
89
+ manifest selects that shared document; conventional theme JSON remains available for exports.
90
+ Web artifacts include semantic runtime colour programs. Native artifacts keep concrete styles.
91
+ Changing SDK/map package versions requires rebuilding and publishing the new artifacts.
92
+ Native builds retain embedded PNG image sources as hashed files beside the styles, so their
93
+ resource URLs remain portable without permitting data URLs in the native profile.
94
+ `overwriteHostedManifest: true` is an explicit migration option, not a normal build setting.
95
+ Production rejects unresolved local PMTiles; publish data explicitly or provide an application-owned
96
+ production source. Local development snapshots do not publish or redistribute the original dataset.
97
+
98
+ Maps whose labels use a line-fitted `text.background` draw text with derived glyph stacks. Local
99
+ previews and captures route such a map's glyph URL through `__glyphs/<map>/…`. Ordinary stacks pass
100
+ through from the declared provider; derived ranges are computed from their source ranges, which are
101
+ cached under `.tileflow/cache/glyphs/v1`. Production output keeps the declared provider, which must
102
+ serve derived stacks.
103
+
104
+ ## Keep a watched request handler
105
+
106
+ Use one session for repeated work and close it when the owning server stops:
107
+
108
+ <!-- docs:check -->
109
+
110
+ ```ts
111
+ import {createTileflowArtifactSession} from '@tileflow/dev/artifacts';
112
+ import {createTileflowDevRequestHandler} from '@tileflow/dev/server';
113
+
114
+ export async function createMapHandler() {
115
+ const session = await createTileflowArtifactSession({
116
+ config: 'tileflow.config.ts',
117
+ watch: true,
118
+ });
119
+ const handler = createTileflowDevRequestHandler({session});
120
+
121
+ return {
122
+ fetch: handler,
123
+ async close() {
124
+ await handler.close();
125
+ await session.close();
126
+ },
127
+ };
128
+ }
129
+ ```
130
+
131
+ The caller mounts `fetch` in its server and calls `close()` on shutdown. This factory does not open
132
+ a listener. Sessions follow config imports and local asset inputs, retain the last good generation
133
+ after invalid edits, and publish structured state changes through `subscribe()`.
134
+ Session creation waits for the first valid generation or a settled invalid result, including
135
+ when a watched edit replaces the initial build before it finishes.
136
+ Watching follows aliased working directories, including newly created or removed icon metadata.
137
+ Package assets resolve from the config directory. Linked package assets inside the selected working
138
+ tree are watched too; installed assets in `node_modules` remain immutable.
139
+
140
+ A single startup consistency check complements ordinary watcher notifications; no recurring scan
141
+ is added.
142
+
143
+ `getState()` and `getLastGoodArtifacts()` return borrowed synchronous views. Before asynchronous
144
+ work, call `acquireArtifacts(generation?)` and release the acquisition in `finally`. A replaced
145
+ generation accepts no new acquisitions; closing a session waits for existing acquisitions.
146
+
147
+ ## Choose an entry point
148
+
149
+ Use `/artifacts` for preparation and output, `/server` for HTTP handling, `/config` for trusted config
150
+ loading, `/icons` and `/fonts` for asset preparation, `/inspect` for bounded inspection, `/tilesets`
151
+ for local PMTiles inspection, and `/validation` for diagnostics. `/preview` is the local preview
152
+ contract, including experimental preview-only rendering; it does not promise hosted support.
153
+ The package has no root entry point. `/server` also exposes the reusable Inspector shell. The CLI
154
+ connects appearance controls and shared browser context through its optional local
155
+ workflow adapter.
156
+ The navigation contains **Map**, **Layers**, **Tiles**, **Assets**, **Debug** and **Diagnostics**.
157
+ Zoom, Pitch and Bearing appear as **Z**, **P** and **B** directly below it, with live Zoom and Pitch
158
+ sliders and **Copy for AI**. Pitch and Bearing each have an inline reset to 0° within the map's
159
+ camera limits. Camera resets preserve the current zoom and map position.
160
+ The active tab and selected layer remain in the URL across reloads. The menu provides left,
161
+ right and bottom docking, System/Light/Dark appearance, and **Reset all changes**.
162
+ Side docking has a minimum width of 640 CSS pixels, including restored layouts.
163
+
164
+ **Map** exposes time-of-day segments, theme cards with actual style swatches, 3D view,
165
+ Off/Grow/Fade building animation, and the map's module settings. The command selects the map.
166
+ Streets shows **Default**, **Faded** and **Monochrome**; Default keeps the compatible `light`
167
+ theme ID in configs, URLs and capture commands. Time of day is selected independently.
168
+ 3D view defaults to on for every map. Buildings fade in between zoom 15 and 15.25.
169
+ Toggling 3D view preserves the camera, including pitch; an explicit off setting stays off.
170
+ Changes update the existing map after a 300 ms pause while the form remains editable. Superseded
171
+ compilations are discarded. Runtime controls do not recompile the style. Scene and layer edits
172
+ share the header Undo/Redo controls; source files stay unchanged.
173
+
174
+ **Layers** groups physical and runtime layers by module or draw order. Hover highlights geometry;
175
+ selection keeps it highlighted independently of the element picker. The picker opens the clicked
176
+ feature's layer in **Rules**. Rules expose live colors, numeric sliders, enums, expression curves,
177
+ defaults, and checkboxes for temporarily disabling paint, layout and filters. Diagnosis, Data and
178
+ Origin explain renderer state, sample features and available compiler provenance. **Visible**
179
+ filters to the current viewport. Context can be reviewed as Markdown or JSON before copying.
180
+
181
+ **Tiles** shows resident map tiles as a coordinate grid and source-grouped list. Source layers,
182
+ Features and Info expose raw payload sizes, consumer layers, paginated features, GeoJSON and bounds.
183
+ Inspection reads resident data without issuing tile requests. MLT and inaccessible renderer data
184
+ have explicit unavailable states.
185
+
186
+ **Assets** separates Icons, 3D models and Fonts. Icons lists real registered images and loads actual
187
+ sprite variants for the map's themes and times of day. Models previews bounded samples of loaded
188
+ controller meshes, with available counts, bytes and LODs. Fonts renders editable samples from actual
189
+ font files or glyphs and links back to consuming layers.
190
+
191
+ **Debug** contains overdraw, collision and tile-boundary overlays, explanations, and controls for
192
+ the map's actual pixel ratio. **Diagnostics** lists actionable findings under Readability, Style,
193
+ Assets and Performance. Problems identify confirmed failures; Review findings describe situations
194
+ that can be intentional. There are no quality scores or automatic camera tours. Style checks refresh
195
+ when the map changes; **Check view** collects bounded current-view evidence and briefly samples
196
+ drawing work. Findings open the affected layer and rule, show available evidence, and copy context
197
+ for an agent. Unavailable observations and stale results remain explicit. **Diagnosis** in
198
+ Layers describes the selected layer's zoom, visibility and feature-rule context without turning
199
+ empty viewport queries into errors. Legacy `tab=beacon` links open Diagnostics.
200
+
201
+ The preview's globe rim follows the rendered canvas silhouette, including camera and viewport
202
+ changes, and fades between zooms 3 and 6. Its colors follow the map's atmosphere when declared.
203
+
204
+ Invalid compiled styles throw `TileflowStyleValidationError` with bounded issues. Keep diagnostics
205
+ structured; do not return executable config, local paths, credentials, or complete generated byte
206
+ arrays from a public endpoint.
207
+
208
+ ## Locked Icon Set composition
209
+
210
+ `composeTileflowIconSources(sources, {cwd, lock, cacheRoot, offline: true})` combines local/package
211
+ directories and `iconSet('@team/set')` contributors into one effective sprite. Without an explicit
212
+ lock object, it reads `tileflow.icons.lock.json` beside `baseDirectory` (default: `cwd`). It never
213
+ resolves latest or writes the lock. The result contains the generated `package`, ordered
214
+ `composition` receipt, effective `sourceIdentities`, declared `contributors`, effective `winners`,
215
+ replacement ordinals, local `watchPaths`, and the exact `watchFiles` that select the composition.
216
+ Pass both the source identities and receipt to Core map-revision hashing.
217
+
218
+ This is the one normal icon-preparation path. `compileTileflowIconPackages`,
219
+ `prepareTileflowCatalogIcons`, `inspectTileflowIconCatalogs` and `getTileflowIconWatchPaths` all use
220
+ it, so `createTileflowBuildArtifacts`, `createTileflowArtifactSession`, and every adapter that
221
+ enters them accept the same explicit `icons` resolution options: `cacheRoot`, `offline`,
222
+ `deliveryOrigins`, `fetch` and `signal`. An explicit `cacheRoot` takes precedence over
223
+ `TILEFLOW_ICON_CACHE_DIR`, then the OS cache default. Origins and transport use their documented
224
+ defaults unless supplied explicitly; no build or watch polls a catalog head. `prepareTileflowCatalogIcons`
225
+ returns `mapIconCompositions` alongside `mapIconSources`, and build-manifest entries carry the
226
+ receipt as `sourceAssets.iconComposition` with `mapRevisionSchemaVersion: 2`.
227
+
228
+ A map whose contributors are all local or package directories keeps its existing generated bytes,
229
+ manifest and content hash, and its build-manifest entry stays on the legacy v1 contract.
230
+
231
+ The reader verifies each file length/checksum, PNG/index geometry, names, density pairing, and both
232
+ per-icon pixel hashes. It copies decoded 1x and 2x cells independently, without resampling either.
233
+ The existing directory compiler and this port share the same sprite packer. A sole shared set reuses
234
+ its exact artifact; mixed inputs are packed deterministically. Later contributors win and all
235
+ dependencies remain in the receipt, even when entirely shadowed. Shared inputs never pretend to
236
+ contain original SVG/source identities. Existing local-only compilation remains unchanged.
237
+
238
+ `storeTileflowIconSetArtifact` seeds an exact verified cache entry. `loadTileflowIconSetArtifact`
239
+ uses the cache or hydrates only the selected artifact's four public files. Hydration defaults to the
240
+ trusted `https://api.tileflow.dev` origin, sends no credentials, and follows no redirects.
241
+ Applications may explicitly configure trusted `deliveryOrigins`; locks cannot add them. `offline`
242
+ forbids all fetches and fails on missing or corrupt entries. Complete-map offline rendering still
243
+ depends on unrelated tiles, glyphs, and other external resources.
244
+
245
+ The cache lives under the OS user cache with `tileflow/icons/v1/<contentHash>`. `cacheRoot`, then
246
+ `TILEFLOW_ICON_CACHE_DIR`, overrides its parent. Atomic directory installation and exact-entry
247
+ retirement support concurrent writers and corruption repair. Symlink entries are rejected. This is
248
+ a disposable cache, not a security sandbox against another process controlling the same user
249
+ account. Incomplete temporary entries are never accepted as published cache entries.
250
+
251
+ `readTileflowIconsLockfileText(directory)` returns the exact current lock bytes, or `null` when no
252
+ lock exists; those bytes are the only valid `expectedContents` for the next write.
253
+ `writeTileflowIconsLockfile(directory, lock, expectedContents)` uses a whole-file compare-and-swap
254
+ and atomic rename. A conflicting writer fails without overwriting pins. An interrupted writer leaves
255
+ the previous complete lock intact; remove a stale `.writing` guard only after confirming that its
256
+ writer has exited. Ordinary reads and Core validation never acquire write guards.
257
+
258
+ A package supports up to 1,000 effective icons, subject to a 2,048-pixel atlas dimension,
259
+ 4 MiB per generated file, and 8 MiB per package. Paired densities share a logical layout capped
260
+ at 1,024 pixels per dimension at 1× and 2,048 at 2×. Mixed-size artwork retains matching placements
261
+ without resampling either density. Larger artwork can hit those limits before
262
+ 1,000 icons. Several individually valid sets can exceed the effective map limit; composition
263
+ fails explicitly instead of clipping. Cache and composition do not create Team resources or
264
+ publish anything. Every normal entry point composes declared shared descriptors through this path;
265
+ catalog publication and lock maintenance stay in the `tileflow` CLI, which is the only writer of
266
+ `tileflow.icons.lock.json` and the only caller that resolves `latest`.
267
+
268
+ ## Recolorable icons
269
+
270
+ Declare SDF defaults and optional stretch/content layout in `tileflow.icons.json` beside ordinary artwork. Preparation
271
+ verifies both densities and rejects mixed representations within one symbol layer, including
272
+ fallbacks and local overrides.