@nika-js/onlymap 0.10.10 → 0.11.1

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 (52) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +14 -2
  3. package/dist/{basemap-BH76eQA0.js → basemap-CHFwxaRT.js} +2 -2
  4. package/dist/cluster-index.d.ts +77 -0
  5. package/dist/cluster-options.d.ts +95 -0
  6. package/dist/cluster-thumbs.d.ts +68 -0
  7. package/dist/ctx.d.ts +2 -0
  8. package/dist/elements/om-map.d.ts +6 -0
  9. package/dist/{geoparquet-DzKLe-0r.js → geoparquet-DBzSJJz_.js} +1 -1
  10. package/dist/{globe-view-B-prUQFh.js → globe-view-D0eDmIGO.js} +1 -1
  11. package/dist/{hillshade-CDng2Jsi.js → hillshade-DodGS9DL.js} +1 -1
  12. package/dist/html-data.d.ts +1 -1
  13. package/dist/{index-D86S8KJ1.js → index-5iFHs_bW.js} +1 -1
  14. package/dist/{index-Rvd-zFrS.js → index-BGvTOkkE.js} +1 -1
  15. package/dist/{index-CpLydTmE.js → index-C7Tpf_BA.js} +1 -1
  16. package/dist/{index-DOfIeNux.js → index-Ca5y3OLs.js} +1 -1
  17. package/dist/{index-cwieLGSg.js → index-CrnprTab.js} +1 -1
  18. package/dist/{index-DvEcTZ4i.js → index-D04CeeYu.js} +17702 -16467
  19. package/dist/{index-CIo8LgRZ.js → index-DH1_IQmW.js} +3 -3
  20. package/dist/{index-laD2SEAB.js → index-em-_HmNV.js} +3 -3
  21. package/dist/{index-8Fj-yh7f.js → index-wRR0a71N.js} +2 -2
  22. package/dist/ir-snapshot.d.ts +10 -0
  23. package/dist/ir.d.ts +9 -0
  24. package/dist/layer-registry.d.ts +8 -0
  25. package/dist/layers/cluster-layer.d.ts +136 -0
  26. package/dist/{lerc-BJB4-X6n.js → lerc-KZgSVKKQ.js} +1 -1
  27. package/dist/onlymap.standalone.js +36288 -35053
  28. package/dist/onlymapjs.js +1 -1
  29. package/dist/{post-process-effect-Bd5plkno.js → post-process-effect-eJXo3MSl.js} +1 -1
  30. package/dist/programmatic.d.ts +6 -0
  31. package/dist/{raster-DJ6vvro6.js → raster-CHuauCiR.js} +3 -3
  32. package/dist/{raster-pipeline-BQhNhrPq.js → raster-pipeline-Coou2lF-.js} +1 -1
  33. package/dist/runtime-core.d.ts +24 -0
  34. package/dist/{text-on-path-CrqchF3O.js → text-on-path-DUfdTGzX.js} +1 -1
  35. package/dist/version.d.ts +1 -1
  36. package/dist/{zarr-oAkG7ZLM.js → zarr-BYLzFMeQ.js} +2 -2
  37. package/docs/cartograph.md +2 -2
  38. package/llms.txt +3 -2
  39. package/onlymapjs.attributes.json +42 -0
  40. package/onlymapjs.html-data.json +80 -0
  41. package/package.json +7 -3
  42. package/skills/onlymapjs/SKILL.md +3 -2
  43. package/skills/onlymapjs/references/react.md +1 -0
  44. package/skills/onlymapjs/references/syntax.md +50 -2
  45. package/docs/design/arrows.md +0 -182
  46. package/docs/design/carto-substrate.md +0 -1067
  47. package/docs/design/cog-v2.md +0 -223
  48. package/docs/design/extensions.md +0 -250
  49. package/docs/design/frame-sources.md +0 -229
  50. package/docs/design/hillshade.md +0 -290
  51. package/docs/design/paced-flyby.md +0 -42
  52. package/docs/design/trace-link-failure.md +0 -20
@@ -1,223 +0,0 @@
1
- # COGLayer v2 — design (issue #13, targeting 0.7.0)
2
-
3
- _Status: IMPLEMENTED (2026-09-02, ships in 0.7.0) — all six phases landed as
4
- designed; the one deviation is recorded inline (the auto-window overview
5
- fallback samples the COARSEST overview, `overviews[overviews.length - 1]`,
6
- because upstream's list is finest-first). Grounded against the 0.6.26 tree and
7
- the actually-bundled
8
- dep versions (`@developmentseed/deck.gl-geotiff` 0.7.0, `deck.gl-raster`
9
- 0.7.0, `@developmentseed/geotiff`), not the ticket's 0.3.x-era assumptions.
10
- Written 2026-09-02._
11
-
12
- ## What the deep-read changed about the ticket
13
-
14
- The ticket's implementation plan predates three upstream facts that make the
15
- work smaller and the design better:
16
-
17
- 1. **`fetchTile` already decodes EVERY band.** `RasterArray` carries all
18
- samples (band-separate or interleaved); today we throw away everything but
19
- band 0 / the first three. Band selection is therefore a re-slice of data
20
- we already hold — not a refetch.
21
- 2. **`CompositeBands` exists upstream** (deck.gl-raster 0.7.0): a GPU module
22
- with four texture slots and an `ivec4 channelMap` uniform, plus
23
- `buildCompositeBandsProps`. Band → channel routing is a *uniform*.
24
- 3. **Paletted rasters already render** in the unstyled path:
25
- `inferRenderPipeline` reads `colorMap`/`photometric` from `cachedTags` and
26
- routes through `photometricInterpretationToRGB` (`parseColormap` in
27
- `@developmentseed/geotiff`). Item 5 shrinks to "don't break it + legend".
28
-
29
- Also confirmed: `geotiff.gdalMetadata` is parsed per band at open
30
- (`STATISTICS_MINIMUM/MAXIMUM/MEAN/STDDEV/VALID_PERCENT` — gdal-metadata.js),
31
- and `cachedTags` exposes `bitsPerSample`/`sampleFormat`/`samplesPerPixel` —
32
- so `rescale="auto"` and the bit-depth auto-route are header reads, no pixel
33
- pass. No stretch/gamma module exists upstream; we write one (the module
34
- contract is ~40 lines — `LinearRescale` is the template: `fs` uniform block,
35
- `inject fs:DECKGL_FILTER_COLOR`, `uniformTypes`, `getUniforms`).
36
-
37
- ## The load-bearing design decision: retained decode + lazy band textures
38
-
39
- One decision serves three ticket items at once (bands, identify, auto-route):
40
- **`OmTileData` retains the decoded `RasterArray` CPU-side for the tile's
41
- cache lifetime**, and band textures are created LAZILY from it.
42
-
43
- ```
44
- getTileData (module-level, stable identity — NEVER changes per ticket item 1)
45
- └─ fetchTile → RasterArray (all bands, already decoded)
46
- OmTileData {
47
- array: RasterArray ← retained (identify + band switches)
48
- bandTextures: Map<int, Texture> ← lazy, per selected band
49
- width/height/byteLength/nodata/colormapTexture
50
- }
51
-
52
- renderTile(data, props) ← re-runs on every new layer instance (restretch,
53
- └─ ensureBandTextures(data, bands) band switch, stretch/gamma edit)
54
- └─ pipeline: CompositeBands(channelMap ← bands)
55
- → FilterNoDataVal (raw values, unchanged ordering)
56
- → LinearRescale
57
- → StretchGamma (NEW module; identity when linear/γ=1)
58
- → Colormap | (reversed) — single-band only
59
- ```
60
-
61
- Consequences, in order of importance:
62
-
63
- - **A `bands` change never refetches or re-decodes.** The ticket's central
64
- constraint ("bands must mint a distinct getTileData identity, deliberately
65
- invalidating the tile cache") is dissolved, not implemented: the new
66
- instance's `renderTile` uploads any missing band texture from the retained
67
- array and updates `channelMap`. The tile cache, the HTTP cache, and the
68
- decode work all survive. Acceptance criterion 1 gets *stronger*: nothing
69
- short of a `src` change refetches.
70
- - **Identify is a free rider.** The pick samples the retained array —
71
- no second fetch, no GPU readback (open Q1 resolved below).
72
- - **VRAM discipline:** textures for bands no longer referenced by the current
73
- `bands` are destroyed at `ensureBandTextures` time (keep = selected set
74
- only); `onTileUnload` destroys every entry plus drops the array reference.
75
- Worst-case steady-state VRAM equals today's (≤4 r32float textures ≈ one
76
- rgba32float); the new CPU cost is the retained arrays, bounded by deck's
77
- existing tile cache and released on eviction exactly like textures today.
78
-
79
- `extractSingleBand`/`packFirstThreeAsRgba` are subsumed by
80
- `extractBand(arr, i)` (both layouts, Float32 widening preserved). The
81
- single-band path uploads one `r32float` and routes `channelMap = [0,0,0,-1]`
82
- (gray replicate) into Colormap — the current visual result, one pipeline
83
- instead of two texture formats.
84
-
85
- ## Attribute grammar (per the ticket, with resolved semantics)
86
-
87
- | Attribute | Values | Semantics |
88
- |---|---|---|
89
- | `bands` | `"4"` or `"[4,3,2]"` | 1-based (GDAL convention). Single = colormap-eligible; triple = RGB composite. Absent = today's defaults (band 1 / first three). |
90
- | `rescale` | `"auto"` | Window(s) from per-band GDAL stats tags — a composite gets TRUE per-band windows (decision above). Tags absent → sample the coarsest overview (one small read), dev-notice that the window is data-derived. Explicit `min`/`max` always win. |
91
- | `min` / `max` | number or triple | A number broadcasts to every selected band; a triple (`min="[0,0,0]"`) gives per-band windows, positionally matching the `bands` triple. Validation: triple lengths must match a `bands` triple. |
92
- | `stretch` | `linear` (default) \| `log` \| `sqrt` | StretchGamma module, applied to the rescaled [0,1] value. `log` uses `log(1+9x)/log(10)` (bounded, monotone, no −∞ at 0). |
93
- | `gamma` | number > 0 | `pow(x, 1/gamma)` in the same module. Validation error at ≤ 0. |
94
- | `reverse` | bare | Colormap uv-flip prop (the sprite has no reversed rows — flip `u` in the Colormap lookup; small fork of the module if upstream's lacks the prop). |
95
- | `identify` | `"off"` | Opt out of CPU array retention (memory-tight embeds). Default on. |
96
-
97
- Bit-depth auto-route (the "my COG is blank" fix): at class init read
98
- `bitsPerSample`/`sampleFormat`; if not uint8 and NO styling attrs are
99
- authored, enter the styled pipeline anyway with `rescale="auto"` semantics
100
- and emit the dev-panel notice verbatim from the ticket. uint8 keeps the
101
- untouched unstyled fast path — including paletted sources
102
- (`colorMap` present → never auto-route; upstream renders the palette).
103
-
104
- ## Identify (ticket item 4)
105
-
106
- `OmCOGLayer.identify(lngLat)` walks the currently-cached tiles for the
107
- best-zoom tile containing the coordinate (tile bounds are known to the
108
- TileLayer), converts to fractional uv, samples ALL bands from the retained
109
- array, and returns `{ values: number[], bands: number[], nodata: boolean }`.
110
- Runtime wiring follows the established schema-flag pattern
111
- (`carriesTileset` precedent): a `carriesRasterIdentify` flag makes
112
- runtime-core enrich the pick path — when a click/hover resolves over a
113
- COG/Zarr layer with no vector object, `selection.raster` carries the
114
- identify result and `{{raster.value}}` / `{{raster.values}}` interpolate in
115
- overlays/tooltips. Float64 sources: values surface as the Float32 the
116
- pipeline holds; the readout notes original dtype (ticket's documented cost).
117
-
118
- ## Structured errors (ticket item 6)
119
-
120
- The #39 work built the exact channel this needs: parse-time entries via
121
- `ParseManifestOptions.report` → `reportRuntimeErrorInternal` →
122
- `om-validation-error`/validate panel. Raster failures are RUNTIME (fetch/
123
- header time, inside the lazy chunk), so raster.ts gets an error classifier
124
- around GeoTIFF open + tile fetch, reported through a runtime-core-injected
125
- callback (the `onTilesetLoad` compose-not-clobber pattern):
126
-
127
- - CORS: `TypeError` from fetch with zero response → the ticket's CORS
128
- message verbatim (fix string included).
129
- - Non-COG: header lacks tile structure/overviews → warning + `rio cogeo`
130
- fix string. Layer keeps rendering (slow full reads) — warning, not error.
131
- - Band out of range: `bands` vs `samplesPerPixel` at init → error naming the
132
- source's band count; layer falls back to defaults rather than blanking.
133
-
134
- Static validation (validation.ts): `bands` shape, `colormap`+triple warning,
135
- `min ≥ max`, `gamma ≤ 0` — messages verbatim from the ticket.
136
-
137
- ## Decisions (maintainer-settled 2026-09-02)
138
-
139
- - **Auto-route: APPROVED.** Behavior change accepted — confined to unstyled
140
- non-8-bit sources that render broken today. Known trade acknowledged: the
141
- stale-stats-tags case moves from obviously-broken to subtly-wrong-with-a-
142
- notice; the dev-panel notice names the derived window so it stays
143
- inspectable, and authored `min`/`max` is the standing remedy.
144
- - **Entitlements: EXEMPT.** COG Range traffic joins every other tile stream
145
- outside `maxFetchBytes`; the gate's rule ("row-data loads, not tile
146
- streams") gets written into the architecture doc's license section.
147
- - **Identify: retain by default, `identify="off"` opt-out — SAME DEFAULT ON
148
- MOBILE.** No native-side default flip (web/native parity is the product
149
- stance); instead the onlymap-native docs/llms guidance RECOMMENDS
150
- `identify="off"` on raster layers for memory-tight WebViews.
151
- - **`reverse`: fork the Colormap module** (tiny, pinned dep, no upstream
152
- contact) rather than the sprite-doubling alternative.
153
- - **deck/luma pin: DOES NOT MOVE in 0.7.0.** Decided consciously at the one
154
- version boundary where it could.
155
- - **Pipeline: UNIFY.** Single-band sources route through CompositeBands too
156
- (slot-0 gray replicate) — one pipeline, every feature written once. The
157
- parachute is pre-authorized: phase 1 acceptance pixel-compares the
158
- existing single-band fixtures against 0.6.26 on Metal-ANGLE, and a
159
- failure there retreats to the dedicated single-band path without redesign.
160
- - **Per-band rescale windows: PINNED, BUT SHIP IN 0.7.0.** Not a follow-up
161
- ticket — the same release. `min`/`max` accept a number (broadcast to all
162
- bands) OR a triple (`min="[0,0,0]" max="[3000,8000,3000]"`, positionally
163
- matching a `bands` triple); `rescale="auto"` on a composite resolves TRUE
164
- per-band windows from per-band stats (the min-of-mins merge hack is
165
- DELETED from the design, not deferred). Mechanism: a PerBandRescale
166
- module variant (vec4 min/max uniforms) replacing LinearRescale when bands
167
- is a triple — scalar sources keep the upstream module.
168
-
169
- ## Open questions — recommendations
170
-
171
- 1. **Identify cost:** retain by default. The array is already allocated by
172
- decode; retention converts a GC into a cache-lifetime hold, bounded by the
173
- existing tile cache and freed on the existing eviction hook. Re-fetch-per-
174
- pick buys idle memory back at the cost of latency + a second Range-request
175
- path to maintain. `identify="off"` is the escape hatch (one boolean, drops
176
- the reference after texture upload).
177
- 2. **Entitlements:** exempt, explicitly. Tile streams are self-limiting and
178
- already exempt for TileLayer/MVTLayer/Tile3DLayer — the fetch gate's rule
179
- becomes "row-data loads, not tile streams", stated in the license section
180
- of the architecture doc. Counting COG bytes would gate panning, which no
181
- tier intends. (Telemetry MAY count bytes later for observability; not
182
- entitlements.)
183
- 3. **Index mode:** out of scope, as the ticket leans — but note the retained-
184
- decode design lands ALL its plumbing (multi-band textures + CompositeBands
185
- are exactly what `index="ndvi"` needs; the follow-up becomes one shader
186
- module + a preset table).
187
-
188
- ## Phases (each independently green; ~1–1.5 weeks total)
189
-
190
- 1. **Retained decode + lazy band textures + `bands`.** Rework OmTileData,
191
- `extractBand`, CompositeBands pipeline, VRAM lifecycle; schema row;
192
- ir-diff needs NO band special-case (props flow through updateTriggers as
193
- uniforms). Unit: extraction across both layouts + dtype matrix
194
- (uint8/uint16/int16/float32 fixtures); harness: snapshotIR mapping.
195
- 2. **StretchGamma + PerBandRescale modules + `reverse` + validation
196
- rules.** Two small forked/authored GPU modules; min/max triple grammar;
197
- pipeline ordering tests (nodata → per-band rescale → stretch → colormap).
198
- 3. **`rescale="auto"` + bit-depth auto-route + dev notice.** Header reads,
199
- legend feed (`deriveRasterLegendSpec` gets the resolved window),
200
- coarsest-overview fallback sampler.
201
- 4. **Identify + pick wiring.** Layer method, `carriesRasterIdentify`
202
- enrichment, `selection.raster`, tooltip interpolation, `identify="off"`.
203
- 5. **Palette legend + guard.** Paletted sources never auto-route; legend
204
- class rows when used-entry count ≤ 12 (matches classify legend cap), else
205
- single swatch.
206
- 6. **Errors + doc-sync + e2e.** Classifier + report channel; README, skill
207
- syntax.md, llms.txt, html-data + attributes.json regen, arch doc,
208
- `dev/examples` raster page extension + build-public allowlist,
209
- CHANGELOG at the 0.7.0 bump. e2e: band composite non-blank & differs
210
- from default; CORS URL → structured error with live canvas; identify
211
- click returns a plausible DEM value.
212
-
213
- Zarr note: phases 1–3 land in `raster-pipeline.ts`/shared shapes where
214
- possible; ZarrLayer inherits stretch/gamma/reverse for free (same
215
- RasterStyle), while `bands`/identify stay COG-only in v2 (Zarr's variable
216
- model differs — its `select` already plays the role).
217
-
218
- ## Non-goals (unchanged from the ticket)
219
-
220
- Server-side tiling, band math/spectral indices (follow-up), NetCDF/HDF5,
221
- raster analysis. No deck.gl/luma bump — 0.7.0 is the version where the pin
222
- COULD move per the deps contract, but nothing here needs it; don't spend the
223
- coordination budget.
@@ -1,250 +0,0 @@
1
- # Layer extensions — design
2
-
3
- Mounting deck's unused extensions behind curated attributes: **label decluttering**,
4
- **pattern fills**, **geofence masking**, **parallel offset lines**.
5
-
6
- **Versions are assigned at release, not here.** An earlier draft of this line pinned
7
- 0.11.0 and went stale before anything was built; the phases below are independently
8
- shippable and each lands as a minor while pre-1.0.
9
-
10
- **Deconflicted with the cartographic substrate** (`carto-substrate.md` §13), which
11
- touches this design in four places: the rasterise trigger is decided by effect *type*
12
- rather than by who installed the effect, so `CollisionFilterExtension`'s self-installed
13
- effect must not force a map frame to rasterise on export (§13.1); the CPU declutter
14
- pass in the vector serializer and this design's GPU decluttering are two algorithms for
15
- one job, and the GPU one is authoritative wherever it runs (§13.2); S3's pattern-scale
16
- question is the same millimetres-on-paper question the substrate asks of geometry, and
17
- both read one declared reference scale (§13.3); and a mask layer serializes to a
18
- `<clipPath>`, not to artwork (§13.4). Label candidate positions and leader lines are a
19
- non-goal here and belong to the placement pass, which owns them for both designs
20
- (§13.6).
21
-
22
- Everything below was verified against the pinned deck (**9.3.5**) in `node_modules`,
23
- not from memory. Sources are cited so the next reader can re-check rather than
24
- re-litigate.
25
-
26
- ---
27
-
28
- ## Verified: what already works in our favour
29
-
30
- 1. **Every extension carries a static `defaultProps`** in exactly the shape
31
- `deriveSchemaFromDeckClass` (`src/layer-registry.ts`) already walks —
32
- `CollisionFilterExtension` declares `getCollisionPriority, collisionEnabled,
33
- collisionGroup, collisionTestProps`; `FillStyleExtension` seven; `MaskExtension`
34
- three. Attribute derivation, validation and IntelliSense come along for free.
35
- 2. **Extension props reach sublayers automatically.** `LayerExtension.getSubLayerProps`
36
- (deck `lib/layer-extension.js`) forwards every key in the extension's `defaultProps`
37
- to sublayers, wrapping `type: 'accessor'` props in `getSubLayerAccessor` and
38
- carrying their update triggers. `getCollisionPriority` therefore reaches
39
- `TextLayer`'s character sublayers with no plumbing from us.
40
- 3. **Composite layers propagate `extensions`** (deck `lib/composite-layer.js:126`), and
41
- `FillStyleExtension.isEnabled` excludes path-tesselator layers — so a
42
- `GeoJsonLayer`'s polygon sublayer patterns while its line sublayers correctly skip it.
43
- 4. **Fresh instances every reconcile are free.** `diffExtensions` (deck
44
- `lifecycle/props.js:201`) compares with `.equals()` — constructor identity plus a
45
- shallow `opts` compare — so no shader churn. This is already the pattern at
46
- `src/attribute-resolution.ts:278`, which pushes `new PathStyleExtension({dash:true})`.
47
- 5. **The aliasing trap is already guarded.** `cloneDefault` exists precisely because
48
- deck's `extensions: []` default was being shared by reference across every layer of
49
- a type (see its comment in `src/attribute-resolution.ts`).
50
- 6. **`operation` is already authorable.** It sits on `Layer.defaultProps` as `'draw'`,
51
- so the derive walk exposes it — `MaskExtension`'s prerequisite needs no new surface.
52
-
53
- ## Verified: the surprises
54
-
55
- These are the reasons this document exists. Each changes the design or the plan.
56
-
57
- ### S1 — collision installs a map-level Effect by itself
58
-
59
- `CollisionFilterExtension.initializeState` calls
60
- `this.context.deck?._addDefaultEffect(new CollisionFilterEffect())`. Deck keeps
61
- `_defaultEffects` **separate** from `props.effects` and resolves
62
- `userEffects.concat(defaultEffects)` (`lib/effect-manager.js`), deduping by
63
- `effect.id` (`'collision-filter-effect'`).
64
-
65
- Consequences:
66
- - **No conflict** with `buildEffects()` / `setEffects()` — our array is untouched, and
67
- repeated layer initialisation cannot accumulate duplicates.
68
- - **But `setEffects([])` no longer means "no effects".** `docs/effects.md` currently
69
- says `[]` "renders no effects at all"; with a decluttering layer present a
70
- collision effect still runs. The sentence needs qualifying, and a test should pin it.
71
- - The collision effect declares `useInPicking: true`, and the extension's
72
- `getNeedsPickingBuffer()` returns true whenever collision is on — so label layers
73
- allocate picking buffers whether or not they are `pickable`.
74
-
75
- ### S2 — decluttering is resolution-dependent, and capture changes the resolution
76
-
77
- `collision-filter-effect.js` sizes its framebuffer from
78
- `device.canvasContext.getPixelSize()` divided by a hardcoded `DOWNSCALE = 2`. Our
79
- capture path sets `useDevicePixels: ratio` (`src/runtime-core.ts:1394`), which is
80
- exactly what `getPixelSize()` reports.
81
-
82
- So a label of *w* CSS pixels occupies `w·r/2` collision-map pixels: **half a pixel per
83
- CSS pixel at r=1, two at r=4**. The rasterised footprints that decide overlap are
84
- four times finer on a 300 dpi plate than on screen, so **the print can keep labels the
85
- preview dropped**. Same family as the pixel-keyed grain bug `<om-effect>` fixed with
86
- millimetres, and it must be measured before the API is designed around it — see
87
- Phase 0. `DOWNSCALE` is not configurable from outside deck.
88
-
89
- ### S3 — fill patterns are glued to the ground, not to the paper
90
-
91
- The pattern shader sets `fill_uv = geometry.position.xy` in **common space**, and
92
- deck documents `getFillPatternScale`: *"If the pattern is 24 x 24 pixels, scale 1
93
- roughly yields 24 **meters**."* Patterns are anchored in world coordinates and grow
94
- on the screen as you zoom in.
95
-
96
- That is the opposite of the contract `<om-effect>` established, where every spatial
97
- knob is millimetres on paper and survives a change of resolution. A paper-constant
98
- hachure therefore needs `getFillPatternScale` **derived from the current zoom and the
99
- sheet scale**, not authored as a constant. This is a design decision, not a defect —
100
- but authoring raw metres would produce a pattern that silently changes size between
101
- the screen and the sheet.
102
-
103
- ### S4 — only one of the three takes constructor options
104
-
105
- `new FillStyleExtension({pattern: true})` — and `pattern` defaults to **false**, so an
106
- extension mounted without opts silently does nothing. `CollisionFilterExtension` and
107
- `MaskExtension` take no options at all (verified: constructor arity 0, `opts`
108
- undefined).
109
-
110
- Constructor options are **not** in `defaultProps`, so they are invisible to the derive
111
- walk. This is the concrete gap that a generic `<om-extension>` passthrough would have
112
- to solve, and the reason the curated route goes first.
113
-
114
- ### S5 — two object-typed props derive as strings
115
-
116
- The derive walk maps a spec with no `type` key, or `type: 'object'`, to
117
- `coerceType = "string"`. That mis-types exactly two props we need:
118
- `collisionTestProps` (`{}`, no `type`) and `fillPatternMapping` (`{type: 'object'}`).
119
-
120
- Fix with **curated overrides**, not by widening the walk: making plain-object defaults
121
- derive as `json` would silently reclassify props across every bundled layer type.
122
-
123
- ### S6 — a mask layer is invisible but not `visible: false`
124
-
125
- Masks cap at four (`mask-effect.js`: *"Too many mask layers. The max supported is 4"*).
126
- More importantly, a mask layer carries `operation: "mask"` and draws nothing, yet its
127
- `visible` stays `true` — and `src/cartograph/legend.ts:106` skips entries only on
128
- `visible === false`. **A mask would appear in the printed legend and in the layers
129
- widget as a togglable entry.** Both need an `operation` check.
130
-
131
- ### S7 — collision and mask are coupled inside deck
132
-
133
- `collision-filter-effect.js` reads `preRenderStats['mask-effect']?.didRender` to decide
134
- whether to re-run, beside deck's own comment: *"TODO: better dependency system for
135
- Effects"*. Shipping both lands on that seam, so they should not ship in the same phase.
136
-
137
- ### S8 — the pattern atlas is an async fetch
138
-
139
- `fillPatternAtlas` is an async image prop and `fillPatternMapping` an async object.
140
- A standalone cartograph is one file that opens by double-click with no server, so a
141
- shipped atlas must inline as a `data:` URI or patterns vanish offline.
142
-
143
- ---
144
-
145
- ## Decisions these facts settle
146
-
147
- - **Curated attributes, not a generic passthrough** — unchanged, and S4 is the
148
- concrete reason. Implement each by merging the extension's *derived* schema rather
149
- than hand-listing props (fact 1), so the machinery a future `<om-extension>` needs
150
- gets built as a side effect and the passthrough stays a separate, later decision.
151
- - **Collision and mask ship in different phases** (S7).
152
- - **Patterns are authored in millimetres on paper**, with the world-space scale derived
153
- (S3) — consistent with `<om-effect>`.
154
- - **Phase 0 exists** because S2 could change the API: if decluttering diverges between
155
- preview and plate, that is a contract problem, not a polish item.
156
-
157
- ## Phases
158
-
159
- ### Phase 0 — measure, before any API (half a day)
160
-
161
- Answer three questions with a real GPU, not reasoning:
162
-
163
- 1. **Capture divergence (S2).** Render a dense label set, count survivors at
164
- `useDevicePixels` 1, 2 and 4. If the set differs, decide the mitigation *now*:
165
- document it, or render the preview at the capture ratio, or expose the ratio a
166
- sheet was designed at.
167
- 2. **World copies.** The effect tests `viewports[0]` only; check labels in repeated
168
- world copies (`repeat: true`) near the antimeridian — the seam that bit us before.
169
- 3. **Cost.** Picking-buffer allocation (S1) on a large label layer, measured.
170
-
171
- Deliverable: numbers in this document, and a go/no-go on the collision API shape.
172
-
173
- ### Phase 1 — the extension seam + decluttering
174
-
175
- The seam: declare an extension on a layer, merge its derived schema into that layer's
176
- prop surface, mount the instance through the `cloneDefault`-guarded `extensions` array.
177
- Curated overrides for `collisionTestProps` (S5).
178
-
179
- Authoring: a `declutter` attribute plus `get-label-priority`. `collisionTestProps`
180
- should default to the documented sizing bump rather than being left to the author —
181
- the prop exists so a label reserves more room than it draws, and getting it wrong
182
- looks like "decluttering doesn't work" rather than an error.
183
-
184
- Validation: `get-label-priority` without `declutter` is silently inert — an error with
185
- a fix string, in the `<om-effect>` validator's idiom.
186
-
187
- Docs: qualify the `setEffects([])` sentence in `docs/effects.md` (S1).
188
-
189
- ### Phase 2 — masking
190
-
191
- `mask="<layer-id>"` plus `mask-inverted`. Requires the `operation` fix in
192
- `src/cartograph/legend.ts` and the layers widget (S6), and a structured error when
193
- `maskId` names a layer that is missing or not `operation="mask"` — deck silently
194
- disables masking in both cases. Validate the four-mask cap with a real message.
195
-
196
- Visual targets: relief clipped to land at the coastline; a study area at full
197
- saturation with everything outside knocked back.
198
-
199
- ### Phase 3 — pattern fills
200
-
201
- `new FillStyleExtension({pattern: true})` (S4), a shipped monochrome atlas —
202
- hachures, dot screens, cross-hatch, stipple — inlined as a `data:` URI (S8), with
203
- `fillPatternMask` left at its default so each feature's own fill colour tints the
204
- texture. `fill-pattern="hachure-45"` names an entry; `fill-pattern-size="1.5mm"`
205
- resolves to `getFillPatternScale` against the current zoom (S3).
206
-
207
- This phase has a design cost the others don't: someone has to draw the atlas, and it
208
- is the thing that most changes how a sheet looks.
209
-
210
- Pairs with the cartograph's colour-vision lint, which can currently only report that
211
- two categories are indistinguishable — patterns are the fix it has no way to suggest.
212
-
213
- ### Phase 4 — offset lines
214
-
215
- `get-offset` on the already-mounted `PathStyleExtension` (only `dash` and
216
- `dash-justified` are exposed today, `src/attribute-resolution.ts:117`). Road casings,
217
- divided carriageways, boundaries drawn inside the line. Cheapest phase by a wide margin.
218
-
219
- ### Phase 5 — surfaces and release
220
-
221
- Example pages, `docs/`, README, skill + `llms.txt`, `html-data.ts` regeneration,
222
- `dev/build-public.ts` + `npm run test:public`, architecture traceability, CHANGELOG,
223
- downstream pins.
224
-
225
- ## Acceptance criteria
226
-
227
- - [ ] Dense labels declutter by authored priority, and the survivor set at capture
228
- resolution is either identical to the preview or the difference is documented
229
- with a stated mitigation (Phase 0).
230
- - [ ] A layer masked to another's geometry clips at the boundary; the mask layer
231
- appears in neither the derived legend nor the layers widget.
232
- - [ ] A pattern fill holds the same **paper** size across a zoom change and a
233
- 300 dpi capture.
234
- - [ ] Patterns survive in a standalone cartograph opened offline.
235
- - [ ] Extension props are authored through derived schemas, not hand-listed — adding a
236
- future extension is a registration, not a port.
237
- - [ ] Every silently-inert combination reports a validator error with a fix.
238
- - [ ] Bundle: eager growth measured and stated (`@deck.gl/extensions` is already in the
239
- eager graph via `attribute-resolution.ts`, so this is tree-shake delta, not a new
240
- dependency).
241
-
242
- ## Non-goals
243
-
244
- - **A generic `<om-extension>` passthrough** — a separate decision, deliberately left
245
- open; S4 is the work it would have to do first.
246
- - **Label candidate positions and leader lines** — real cartographic wins, but placement
247
- logic, not extension work. Follow-up.
248
- - **Text on a curve** — a composite layer placing per-glyph `TextLayer` entries along a
249
- path. Feasible in deck; unrelated to this ticket.
250
- - **`BrushingExtension`** — an interaction effect with no print equivalent.