@nika-js/onlymap 0.10.5 → 0.10.6
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/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/dist/{basemap-Q-Hd5jE-.js → basemap-Do1r50ff.js} +2 -2
- package/dist/cartograph/elements/om-frame.d.ts +55 -2
- package/dist/cartograph/elements/om-source.d.ts +23 -0
- package/dist/cartograph/frame-sources.d.ts +64 -0
- package/dist/cartograph/live-frame.d.ts +8 -2
- package/dist/cartograph.js +1324 -1126
- package/dist/cartograph.standalone.js +1804 -1606
- package/dist/elements/om-map.d.ts +11 -0
- package/dist/{geoparquet-mtTpzfNU.js → geoparquet-CfnIgWoq.js} +1 -1
- package/dist/{globe-view-D6a6_ADT.js → globe-view-CKrjE2_P.js} +1 -1
- package/dist/{hillshade-CY4PNGum.js → hillshade-DYX4HiM6.js} +1 -1
- package/dist/{index-DwIUeLzW.js → index-CLwi0tl1.js} +1 -1
- package/dist/{index-yJEyQjKn.js → index-Cr2lpzhG.js} +54 -18
- package/dist/{index-DUJtvAv2.js → index-D7pGwN4r.js} +2 -2
- package/dist/{index-V-VuBp7C.js → index-DfH_mTX9.js} +1 -1
- package/dist/{index-BwOC7qcd.js → index-DwX39Hco.js} +1 -1
- package/dist/{index-4z9qUdmz.js → index-jOAZ7MGr.js} +1 -1
- package/dist/{index--Zswyzcw.js → index-pNSDUva1.js} +1 -1
- package/dist/{index-BhH8ySRp.js → index-q_KoQjsU.js} +3 -3
- package/dist/{index-D6jtcTK4.js → index-xTIB8sjz.js} +3 -3
- package/dist/{lerc-BdO3Bk6b.js → lerc-DIXeSlBh.js} +1 -1
- package/dist/onlymap.standalone.js +37 -1
- package/dist/onlymapjs.js +1 -1
- package/dist/{post-process-effect-DqteD0Gr.js → post-process-effect-BSBhBXeu.js} +1 -1
- package/dist/{raster-3YBp5u4H.js → raster-mlOu3P2H.js} +3 -3
- package/dist/{raster-pipeline-P1v9_jgU.js → raster-pipeline-ByRr7hBG.js} +1 -1
- package/dist/runtime-core.d.ts +19 -0
- package/dist/{text-on-path-DMUvpyS-.js → text-on-path-Q0dF8039.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CldzO0mP.js → zarr-D6-cCHW4.js} +2 -2
- package/docs/cartograph.md +49 -3
- package/docs/design/carto-substrate.md +12 -0
- package/docs/design/frame-sources.md +229 -0
- package/llms.txt +1 -1
- package/onlymapjs.html-data.json +28 -0
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +3 -2
- package/skills/onlymapjs/references/syntax.md +13 -2
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Frame sources — what a cartograph frame shows, and where
|
|
2
|
+
|
|
3
|
+
Design for `<om-frame>`'s source resolution: **one ordered mechanism** in place of a
|
|
4
|
+
live `src` with a bolted-on rescue, so a sheet renders correctly in the editor that
|
|
5
|
+
wrote it, in a browser that has never heard of the host app, and in an export.
|
|
6
|
+
|
|
7
|
+
**Versions are assigned at release, not here.** This first read as a minor — a new public
|
|
8
|
+
element plus a changed definition of frame readiness. It shipped as a PATCH (0.10.6),
|
|
9
|
+
because the readiness change turned out to affect no existing document: a frame with one
|
|
10
|
+
source has nothing to fall through to, so it behaves exactly as before, and there is a test
|
|
11
|
+
asserting it. What remains is purely additive. The rule this repo actually gates a minor on
|
|
12
|
+
— the bundled deck.gl/luma.gl pin moving — is untouched, and precedent agrees: 0.10.5
|
|
13
|
+
shipped two new attributes AND a changed default that altered how existing manifests
|
|
14
|
+
render, as a patch.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 1. The observation this rests on
|
|
19
|
+
|
|
20
|
+
A generated A3 plate — Albers CONUS, relief, coastal vignette, curved river labels —
|
|
21
|
+
validated clean and rendered correctly in the host app's editor. Opened as a file it
|
|
22
|
+
showed a blank frame surrounded by correct furniture.
|
|
23
|
+
|
|
24
|
+
Tracing it gave a result that invalidates the obvious fix:
|
|
25
|
+
|
|
26
|
+
| step | outcome |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `src="../maps/map-bd54….html"` from the cartograph's own directory | **resolves** — it is a real relative path |
|
|
29
|
+
| the map document loads | **succeeds** |
|
|
30
|
+
| its layers, on `nika-file://localhost/…` | fail — a host-registered protocol that exists only inside the app |
|
|
31
|
+
| its `basemap="none"` | nothing to fall back on |
|
|
32
|
+
| the frame | mounts a map with zero drawable layers and reports success |
|
|
33
|
+
|
|
34
|
+
### It fails two different ways, and only one of them is loud
|
|
35
|
+
|
|
36
|
+
The trace above is the file:// case. The host app's own PREVIEW fails differently, and
|
|
37
|
+
finding that out changed what the readiness test has to cover.
|
|
38
|
+
|
|
39
|
+
| context | `src` resolves? | outcome |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| opened from the cartograph's own directory | yes — a real relative path | map loads, layers fail on the host protocol → **silent blank frame** |
|
|
42
|
+
| the app's HTML preview, before it was fixed | on disk yes, in the URL no — the preview served the sheet through a scheme that percent-encoded its whole path into ONE URL segment, so `../maps/…` resolved to the scheme root | → **loud 404** |
|
|
43
|
+
|
|
44
|
+
Two symptoms that need different detection, and — as it turned out — two different root
|
|
45
|
+
causes. The loud one was never the sheet's fault: the host served it from a URL whose
|
|
46
|
+
whole filesystem path was one percent-encoded segment, so `../maps/…` resolved to the
|
|
47
|
+
scheme root and no relative reference of any kind could work. That is fixed in the host,
|
|
48
|
+
where it belongs (§10), and it is why the flat preview cache this section first blamed was
|
|
49
|
+
a red herring — the preview serves the ORIGINAL file, in its own directory.
|
|
50
|
+
|
|
51
|
+
The silent one is the real subject of this design, and the reason readiness cannot be
|
|
52
|
+
defined on loading.
|
|
53
|
+
|
|
54
|
+
A design that only handled the loud case would look correct in the preview, where it is
|
|
55
|
+
most often seen, and do nothing in the file the user actually sends to someone.
|
|
56
|
+
|
|
57
|
+
**The silent failure.** `showPlaceholder("load-failed")` never runs, because nothing
|
|
58
|
+
failed in the sense the frame checks for. A raster fallback hung off the error path —
|
|
59
|
+
the design this document replaced — would have sat unused while the sheet showed a blank
|
|
60
|
+
box. It would have been a mechanism that does not fire in the only case it exists for.
|
|
61
|
+
|
|
62
|
+
The generalisation matters more than the instance. Outside the host app the live path
|
|
63
|
+
does not *sometimes* fail; it fails essentially always, because both halves of it are
|
|
64
|
+
app-local: a relative path into the host's storage, and a custom protocol for the data.
|
|
65
|
+
So "fallback" misnames it. Outside the app a capture is not the rescue, it is the only
|
|
66
|
+
thing that can render, and a design that treats it as exceptional has the priority
|
|
67
|
+
backwards.
|
|
68
|
+
|
|
69
|
+
## 2. What is wrong with the current model
|
|
70
|
+
|
|
71
|
+
`src` names **one** source and assumes it works. Three contexts need three answers, and
|
|
72
|
+
today two of them are served by machinery outside the element:
|
|
73
|
+
|
|
74
|
+
- the editor, which has the app protocol and the sibling map — the live path;
|
|
75
|
+
- a stored file opened anywhere else — nothing;
|
|
76
|
+
- an export, where the host inlines the map, embeds its layer data, and deletes `src`.
|
|
77
|
+
|
|
78
|
+
The export path proves the point: it exists precisely because `src` cannot survive
|
|
79
|
+
leaving the app. It is a second resolution strategy implemented in the host rather than
|
|
80
|
+
in the element, which is why the element cannot degrade on its own.
|
|
81
|
+
|
|
82
|
+
## 3. The model: ordered sources
|
|
83
|
+
|
|
84
|
+
A frame declares its sources in priority order and takes the first that **renders**.
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<om-frame id="main" center="[-96, 38]" zoom="3.25">
|
|
88
|
+
<om-source src="../maps/map-bd54….html"></om-source>
|
|
89
|
+
<om-source src="captures/main@2x.png" corners="[[…],[…],[…],[…]]" crs="EPSG:5070"></om-source>
|
|
90
|
+
</om-frame>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- `src=` on the frame stays as shorthand for a single `<om-source src=…>`, so every
|
|
94
|
+
existing document keeps working and the common case stays one line.
|
|
95
|
+
- **One attribute for both kinds: `src`.** A map document and a raster are both "where
|
|
96
|
+
this frame's picture comes from", and two attribute names would make the author state
|
|
97
|
+
a thing the file extension already says. The kind is read from the extension — `.html`
|
|
98
|
+
is a map document, an image extension is a raster — and an unrecognised one is a
|
|
99
|
+
validation error naming both, rather than a silent guess. `corners`/`crs` appearing on
|
|
100
|
+
a source is what makes it georeferenced, which is orthogonal to its kind.
|
|
101
|
+
- **The frame states which source it settled on**, as an attribute reflecting the
|
|
102
|
+
resolved index and a `om-frame-source` event. A capture shown silently is its own
|
|
103
|
+
trap: an editor should be able to say "showing a capture from 12 March", and F6's
|
|
104
|
+
concern about masking a broken map depends on the choice being visible.
|
|
105
|
+
- Order is document order. No scoring, no heuristics about the environment: a source
|
|
106
|
+
either rendered or it did not, and the frame moves on.
|
|
107
|
+
- A raster source carries the georef that was true **when it was captured** — the same
|
|
108
|
+
thing `freeze()` already stamps onto a frame — so furniture is correct even when the
|
|
109
|
+
live map never loaded and its CRS is therefore unknowable. Deriving corners from the
|
|
110
|
+
authored camera via `cornersFromCamera` was considered and is Mercator-only, so it is
|
|
111
|
+
wrong for exactly the projected sheets this feature is for.
|
|
112
|
+
|
|
113
|
+
Each context then gets the right answer with no special case:
|
|
114
|
+
|
|
115
|
+
| context | resolves to |
|
|
116
|
+
|---|---|
|
|
117
|
+
| the editor | the live map |
|
|
118
|
+
| a stored file, opened anywhere | the capture — a correct picture, not a blank box |
|
|
119
|
+
| an export | the map inlined; no `src` to resolve |
|
|
120
|
+
|
|
121
|
+
## 4. The hard part: what "rendered" means
|
|
122
|
+
|
|
123
|
+
This is the whole design. "Loaded" is not enough — the failure above loaded fine.
|
|
124
|
+
|
|
125
|
+
A source has rendered when the frame can show something a reader would recognise as the
|
|
126
|
+
map. The proposed test, in order of preference:
|
|
127
|
+
|
|
128
|
+
1. **At least one drawable layer after settle.** The frame already awaits
|
|
129
|
+
`mapEl.whenSettled?.({ timeout: 20_000 })`; the map already tracks layer readiness.
|
|
130
|
+
Zero drawable layers after settle is observable, needs no cooperation from the map,
|
|
131
|
+
and covers the `nika-file://` case exactly — every layer's fetch failed, so none is
|
|
132
|
+
drawable.
|
|
133
|
+
2. A basemap counts as drawable. A map that is deliberately only a basemap is a
|
|
134
|
+
legitimate frame, and `basemap="none"` is what made the instance above empty.
|
|
135
|
+
3. **Not** "every layer loaded". A sheet whose fifth layer 404s is degraded, not failed,
|
|
136
|
+
and silently swapping it for a stale capture would be worse than showing it.
|
|
137
|
+
|
|
138
|
+
The bar is deliberately low — *something* drew — because the alternative is the frame
|
|
139
|
+
adjudicating cartographic quality, which it cannot do and should not try.
|
|
140
|
+
|
|
141
|
+
### The timing cost
|
|
142
|
+
|
|
143
|
+
A source that fails by rendering nothing costs a full settle before the next is tried,
|
|
144
|
+
up to the existing 20 s timeout. That is acceptable for the stored-file case, which is
|
|
145
|
+
one-shot, and invisible in the editor, where source 1 succeeds. It is not acceptable to
|
|
146
|
+
pay it on every frame of a paced flyby — but a flyby drives a live map, not a cartograph
|
|
147
|
+
frame, so the path is not shared.
|
|
148
|
+
|
|
149
|
+
## 5. Caveat register
|
|
150
|
+
|
|
151
|
+
| # | Caveat | Resolution |
|
|
152
|
+
|---|---|---|
|
|
153
|
+
| F1 | The failure has TWO shapes: silent from file:// (map loads, draws nothing) and, formerly, a loud 404 in the app preview, whose URL shape broke the relative `src`. A design fitted to the loud one looks right where it is most often seen and does nothing in the file that gets sent to someone | readiness is defined on drawable layers, not on load, so both shapes resolve to the next source. The loud shape was a HOST bug and is fixed there (§10) — which leaves the silent one as the case this design must carry, exactly as argued |
|
|
154
|
+
| F2 | A raster's georef cannot be derived when the live map never loaded, because its CRS comes from that map | the capture carries `corners` + `crs`, as `freeze()` already writes them |
|
|
155
|
+
| F3 | `cornersFromCamera` needs only the core module and the authored camera — tempting as a no-new-attributes answer | it builds a `WebMercatorViewport`, so it is wrong for any projected sheet, which is the case this serves |
|
|
156
|
+
| F4 | Validation forbids `corners`/`crs` on a LIVE frame, for good reason — a live frame derives them | the attributes move to `<om-source>`, where they describe that source rather than the frame |
|
|
157
|
+
| F5 | A failed source costs a full settle before the next is tried | one-shot contexts only; no cartograph frame is on a per-frame animation path |
|
|
158
|
+
| F6 | Ordered sources could mask a genuinely broken map in the editor, where the author wants the error | the editor is source 1 and reports its own failure; a later source is reached only after source 1 has demonstrably drawn nothing, and the frame should say which source it settled on |
|
|
159
|
+
| F7 | Captures go stale against the map they came from | out of scope here; a host that stores captures already versions them, and that is where staleness belongs |
|
|
160
|
+
|
|
161
|
+
## 6. Alternatives considered
|
|
162
|
+
|
|
163
|
+
**A raster hung off the error path.** The original proposal, and wrong: the failure it
|
|
164
|
+
exists for is silent, so it would never fire. Recorded because the reasoning is not
|
|
165
|
+
obvious until the resolution is actually traced.
|
|
166
|
+
|
|
167
|
+
**Always inline the map on write.** What export does, and it genuinely works — but it
|
|
168
|
+
duplicates the map into every sheet on every autosave, and gives snapshot semantics
|
|
169
|
+
where `src` deliberately gives live ones. Edits to the map would stop reaching the
|
|
170
|
+
sheet, which is the reason `src` exists.
|
|
171
|
+
|
|
172
|
+
**Detect the environment.** "Am I in the host app?" is not knowable from the element, and
|
|
173
|
+
a document that behaves differently depending on where it is opened is worse than one
|
|
174
|
+
that tries sources in a stated order.
|
|
175
|
+
|
|
176
|
+
## 7. Non-goals
|
|
177
|
+
|
|
178
|
+
- Deciding whether a capture is out of date. F7.
|
|
179
|
+
- Making `nika-file://` resolve outside its host. That is the host's protocol and its
|
|
180
|
+
business; this design is about surviving its absence.
|
|
181
|
+
- Choosing a source by quality, resolution or size. Order is the author's statement of
|
|
182
|
+
preference, and adding scoring would make the result depend on the environment again.
|
|
183
|
+
|
|
184
|
+
## 8. Acceptance
|
|
185
|
+
|
|
186
|
+
- A sheet whose live source draws nothing renders its capture, not a blank box — tested
|
|
187
|
+
against the real failure: a map on a host-local protocol, loaded successfully, with
|
|
188
|
+
zero drawable layers.
|
|
189
|
+
- A sheet whose live source works is unchanged, and pays nothing for the mechanism.
|
|
190
|
+
- Furniture is correct on whichever source won, which means `om-frame-view` fires on a
|
|
191
|
+
source switch (see §9, `arrows.md`).
|
|
192
|
+
- An existing `src=` document renders identically, with no edit.
|
|
193
|
+
- The frame states which source it settled on, so a capture is never shown silently.
|
|
194
|
+
|
|
195
|
+
## 9. Decisions
|
|
196
|
+
|
|
197
|
+
1. **The frame reports which source it settled on.** An attribute plus an
|
|
198
|
+
`om-frame-source` event. Silence would make a capture indistinguishable from a live
|
|
199
|
+
map, and F6 depends on the choice being visible.
|
|
200
|
+
2. **One attribute, `src`, for both kinds**, with the kind read from the extension. Two
|
|
201
|
+
names would restate what the filename already says, and a `type` buys extensibility
|
|
202
|
+
that no third kind is asking for yet.
|
|
203
|
+
3. **Captures are relative paths in the stored document, embedded at export.** Keeps the
|
|
204
|
+
stored file readable and diffable, and export already embeds rasters, so the split follows machinery that exists.
|
|
205
|
+
|
|
206
|
+
The consequence must be stated rather than discovered: a stored cartograph is then
|
|
207
|
+
**renderable in place, not portable**. Moving the file alone breaks its captures, the
|
|
208
|
+
same way it breaks its `src` today. Export is what produces a file that survives
|
|
209
|
+
being sent to someone. This belongs in the cartograph skill — the word "standalone"
|
|
210
|
+
has already misled once, when it described a document whose head had no runtime.
|
|
211
|
+
|
|
212
|
+
## 10. Adjacent designs, deconflicted
|
|
213
|
+
|
|
214
|
+
- **`carto-substrate.md` §7 (freeze to vector)** — `freeze()` converts a live frame to a
|
|
215
|
+
static one, writing `corners` + `crs`. This design reuses that georef contract for a
|
|
216
|
+
raster source rather than inventing a second one; freeze remains the way a frame stops
|
|
217
|
+
being live at all.
|
|
218
|
+
- **`arrows.md`** — NOT untouched, as a first pass assumed. It depends on furniture
|
|
219
|
+
re-rendering when `om-frame-view` fires (`om-cartograph.ts:81`) and on the frame
|
|
220
|
+
footprint `overview-of` computes (`om-frame.ts:452`). Settling on a different source
|
|
221
|
+
changes the frame's georef, so **a source switch must fire `om-frame-view`** — an arrow
|
|
222
|
+
or a graticule left on the previous source's georef is the same class of silent wrong
|
|
223
|
+
output this design exists to remove. Added to the acceptance bar below.
|
|
224
|
+
- **`extensions.md`** — no interaction found; it names no frame and no source.
|
|
225
|
+
- **The host's preview URL** — a previewed page
|
|
226
|
+
is now served with its path separators intact, so a relative `src` resolves against the
|
|
227
|
+
sheet's own folder, and each document a frame names is approved on open. That removes
|
|
228
|
+
the loud shape in F1 and is a prerequisite for `src` being meaningful in the app at all.
|
|
229
|
+
It does nothing for a sheet opened outside the app, which is what §3 is for.
|
package/llms.txt
CHANGED
|
@@ -45,7 +45,7 @@ Programmatic/native bridge rule: `MapController.setLayers()` accepts normal func
|
|
|
45
45
|
- `<om-behavior on="click|hover|drag|load|data-loaded" layer="..." action="...">` — declarative interaction. Built-in actions: `show-overlay`, `hide-overlay`, `show-tooltip`, `hide-tooltip`, `toggle-layer`, `set-pickable` (`{layer, pickable: true|false|"3d"}` — runtime picking/popup toggle, story-capturable; the per-layer popup on/off switch a viewer-facing export needs), `filter-layer`, `highlight-feature`, `zoom-to-feature`, `set-basemap`, `undo`, `redo`; scene/tool actions `set-lighting`, `set-effect` (`{preset}` — swap a post-process finish; see the effects bullet), `set-terrain`, `set-clip-box` (`{min,max,invert?,highlight?}` / `{clear:true}`), `clip-box-edit` (`{editing}`), `export-region-3d` (`{target?, format?:"glb"|"b3dm"}` — what the draw widget's `export-3d` button emits), the draw actions `draw-mode` (`{target?:"sketch", mode:"point"|"line"|"polygon"|null}` — null exits drawing), `draw-commit`, `draw-cancel`, `draw-delete` (removes the last shape), `draw-clear`, `draw-config` (`{target?, autosave?, fillColor?, lineColor?}`) and `draw-save` (`{target?, format?:"download"|"file-system"|"both"}`) — every one of these drives the same store a `data="draw:<target>"` layer reads, so a custom toolbar can replace `<om-widget type="draw">` entirely; and the measure actions `measure-mode` (`{mode:"distance"|"area"|"volume"|null}`), `measure-units`, `measure-clear`, `measure-config` (`{profile?, baseSurface?, density?, swell?, shrink?, deadband?}`), `measure-flat-target-plane` (`{flat}`). One payload contract everywhere: `{ layer, target, feature, featureId, coordinate }`. A `show-tooltip` popup DISMISSES ITSELF when the selection clears — the pointer leaving the feature for a hover, or a click on empty map for a click — so you never wire `hide-tooltip` by hand for that. A tooltip whose template contains an interactive `[data-emit]` element takes pointer events and so does NOT close when clicked, which is what lets it carry its own close button.
|
|
46
46
|
- Undo/redo is built in: user-facing manifest changes (layer toggles, filter changes, basemap switches, element add/remove, drawn sketches) are recorded automatically — the manifest is the state. `<om-widget type="undo-redo">` renders the buttons; Cmd/Ctrl-Z, Shift-Cmd/Ctrl-Z, and Ctrl-Y work on any map (text inputs keep their native undo). Camera moves, hover effects, and story playback are deliberately NOT undo steps. Widget scripts: `ctx.history.canUndo/canRedo` with watch token `history`; `ctx.emit("undo")`/`ctx.emit("redo")`.
|
|
47
47
|
- `<om-fallback>` — static no-JS fallback, direct child of `<om-map>` (one per map, no attributes, plain HTML content — links allowed). Shown ONLY where scripts never run (chat-app/email file previews — iOS QuickLook renders HTML attachments with JS off — file managers, sandboxed webviews); hidden automatically once the map boots. GOOD PRACTICE: include one on every complete page, especially pages that may be shared as a file. To PRODUCE a shareable single file, `npx @nika-js/onlymap export map.html` embeds every relative data/src/scenegraph URL as a data: URL (format detection preserved — the original extension rides a #name.ext fragment), pins relative library refs to the CDN, adds a generic om-fallback when missing, and warns when embedded data is heavy (>1 MB per file / >5 MB total) or when a source cannot be embedded (shapefile sidecars, COG Range streams, Zarr directories, {z}/{x}/{y} templates — those need hosting) ("This interactive map requires JavaScript — open this file in a web browser", plus a hosted-version link when one exists). Without one, the stylesheet shows a generic text-only banner. The gate is pure CSS (`om-map:not(:defined)` in onlymapjs.css) refined by the `scripting` media feature on 2023+ engines: with scripting DISABLED the fallback shows instantly; with scripting ENABLED it never flashes during a slow load and only surfaces after a ~4s grace with load-failure wording (blocked/unreachable bundle). The CSS must load without JS — a real `<link rel="stylesheet">` or inlined `<style>` on no-build pages; a bundler-emitted stylesheet is fine in npm projects.
|
|
48
|
-
- PRINT LAYOUTS (`@nika-js/onlymap/cartograph`, separate lazy entry — the core bundle does not grow): `<om-cartograph size="A3" orientation="landscape">` is a standalone page measured in MILLIMETRES carrying `<om-frame>`s (live `<om-map>` with the frame's own camera, or `mode="static"` georeferenced rasters placed by `crs`+`corners`) plus cartographic furniture: `<om-legend for="...">` (rows DERIVED from the live map's own symbology incl. classified breaks; author literal `<om-legend-row>`s with `derived="false"`), `<om-scalebar>` (metric|imperial|nautical), `<om-north>`, `<om-graticule>` (4326/3857/UTM), `<om-shape>`, `<om-image>`, `<om-text>` with `{{title}}`/`{{date}}`/`{{frame.<id>.scale}}`/`{{atlas.<field>}}` tokens. `overview-of="<frame-id>"` draws a locator inset's footprint. A live frame georeferences whatever its map shows: zoomed out past the whole world, the map wraps inside the frame like any web map (the graticule labels each copy, the scale bar measures its own row) — the frame never limits or changes the camera, and once the map inside it settles after a pan/rotate/tilt the frame's georeference follows the map's own view, so north arrow, scale bar, graticule, locator and `{{frame.<id>.scale}}` describe what is on screen (and a freeze captures that view). `max-pitch` and `min-zoom` on `<om-map>` exist as author-set controls for kiosk-style maps and are never applied automatically. `<om-atlas for="<frame-id>" layer="<layer-id>">` renders one page per feature (sequentially through ONE live map — WebGL context limits make cloned pages fail at scale) and exports a ZIP. Print via `page.print()` or `?print=1` (true page size via @page; live frames swap to print-DPI captures first), PNG via `renderCartograph(page, {dpi})` or `?export=png&dpi=300`. `bleed`/`crop-marks`/`safe-zone` (screen-only guide)/`flatten` are press-shop attributes; `cvd="deuteranopia|protanopia|tritanopia|achromatopsia"` simulates colour-vision deficiencies page-wide and `lintLegendColours()` flags collapsing palettes. Free plan: a small foot credit is injected — suppressed by any authored `om-text` crediting OnlyMap, or by a paid key on a live frame's map. Deep reference: docs/cartograph.md.
|
|
48
|
+
- PRINT LAYOUTS (`@nika-js/onlymap/cartograph`, separate lazy entry — the core bundle does not grow): `<om-cartograph size="A3" orientation="landscape">` is a standalone page measured in MILLIMETRES carrying `<om-frame>`s (live `<om-map>` with the frame's own camera, or `mode="static"` georeferenced rasters placed by `crs`+`corners`). A frame may declare SEVERAL sources and show the first that renders: `src=` is shorthand for the first `<om-source src=>`, then each `<om-source>` child in document order, and an inline `<om-map>` outranks both. The kind comes from the extension (`.html` = map document, an image extension = capture); a capture MUST carry its own `corners` (+`crs`), because when it is what gets shown the live map did not load and its projection is unknowable. "Rendered" means one drawable thing after settle — a basemap, or rows on any layer — NOT every layer loaded; this exists because a sheet opened outside its host mounts a map whose every layer failed and still reports success, showing a blank box inside correct furniture. The frame reports its choice as `data-om-carto-source="<index>"` and an `om-frame-source` event, and fires `om-frame-view` on a switch so furniture re-places. A stored sheet is renderable IN PLACE, not portable — capture paths are relative; export inlines the map and embeds the rasters plus cartographic furniture: `<om-legend for="...">` (rows DERIVED from the live map's own symbology incl. classified breaks; author literal `<om-legend-row>`s with `derived="false"`), `<om-scalebar>` (metric|imperial|nautical), `<om-north>`, `<om-graticule>` (4326/3857/UTM), `<om-shape>`, `<om-image>`, `<om-text>` with `{{title}}`/`{{date}}`/`{{frame.<id>.scale}}`/`{{atlas.<field>}}` tokens. `overview-of="<frame-id>"` draws a locator inset's footprint. A live frame georeferences whatever its map shows: zoomed out past the whole world, the map wraps inside the frame like any web map (the graticule labels each copy, the scale bar measures its own row) — the frame never limits or changes the camera, and once the map inside it settles after a pan/rotate/tilt the frame's georeference follows the map's own view, so north arrow, scale bar, graticule, locator and `{{frame.<id>.scale}}` describe what is on screen (and a freeze captures that view). `max-pitch` and `min-zoom` on `<om-map>` exist as author-set controls for kiosk-style maps and are never applied automatically. `<om-atlas for="<frame-id>" layer="<layer-id>">` renders one page per feature (sequentially through ONE live map — WebGL context limits make cloned pages fail at scale) and exports a ZIP. Print via `page.print()` or `?print=1` (true page size via @page; live frames swap to print-DPI captures first), PNG via `renderCartograph(page, {dpi})` or `?export=png&dpi=300`. `bleed`/`crop-marks`/`safe-zone` (screen-only guide)/`flatten` are press-shop attributes; `cvd="deuteranopia|protanopia|tritanopia|achromatopsia"` simulates colour-vision deficiencies page-wide and `lintLegendColours()` flags collapsing palettes. Free plan: a small foot credit is injected — suppressed by any authored `om-text` crediting OnlyMap, or by a paid key on a live frame's map. Deep reference: docs/cartograph.md.
|
|
49
49
|
- POST-PROCESS EFFECTS: `<om-effect>` children of `<om-map>` ARE deck's `effects` array — document order is pipeline order. Three lanes, exactly one per element: `preset="vintage|engraved|night|blueprint|riso|newsprint|muted"` (a named finish; override one knob with `<op>-<param>`, e.g. `grain-amount="0.02"`, or get the preset as markup from `OmMap.expandPreset(name)`); `op="tint|levels|saturation|posterize|vignette|grain|edges|blur|sharpen|halftone"` with that op's knobs as attributes; or an inline `<script type="application/json">` luma ShaderModule passed to deck untouched (raw GLSL, multi-pass). Spatial knobs are MILLIMETRES (`size="0.12mm"`) and resolve against the live pixel density, so a look keeps its physical size at print DPI — a pixel value is a validation error. Consecutive pointwise ops compile into ONE pass; only neighbourhood ops (edges/blur/sharpen/halftone) cost a pass each. A preset is literally a saved op list. `set-effect {preset}` swaps it live by writing the document, and `<om-widget type="effects">` renders that as preset radios plus Off, mirroring the document rather than holding state (undoable; NOT story-rewindable yet — a step can apply it, but `seek()` back will not remove it, because rewind restores `<om-map>` attributes and this adds a child element). Programmatic twin: `MapController.setEffects(effects | null)` hands deck `Effect` instances directly and outranks the document's chain while set. Deep reference: docs/effects.md. CAVEAT: a pass runs over deck's framebuffer, so with a MapLibre basemap the basemap underneath is untouched — the validator warns and suggests `basemap="none"` with the base drawn as layers.
|
|
50
50
|
- Animation: `transition="get-fill-color 800ms, get-radius 400ms"` on a layer GPU-animates prop changes (also smooths streaming updates via `get-position`). Camera: the `fly-to` action takes `center`/`zoom`/`pitch`/`bearing`/`duration` (e.g. `duration="2s"`) — use it in behaviors or `data-emit` buttons; `zoom-to-feature` also accepts `duration`.
|
|
51
51
|
- Pull-model frame rendering (external video frameworks such as Remotion): mark the map `data-om-recording` (the determinism switch — instant camera, no transitions/gesture interrupts, byte-stable `snapshot()`), then per frame `story.seek(t, {interpolateCamera: true})` + `await mapEl.whenSettled()` + capture; the same frame is byte-identical across processes and orderings. Story effect verbs (fade/pulse/trace/populate) evaluate as pure functions of story time under the switch — a seek landing mid-trace renders the half-drawn outline; only effects dispatched OUTSIDE a story (behaviors, ctx.emit) snap to their end state. `onlymapjs record` remains the built-in push-model path; `@nika-js/onlymap-remotion` packages the pull-model path for Remotion.
|
package/onlymapjs.html-data.json
CHANGED
|
@@ -3993,6 +3993,34 @@
|
|
|
3993
3993
|
}
|
|
3994
3994
|
]
|
|
3995
3995
|
},
|
|
3996
|
+
{
|
|
3997
|
+
"name": "om-source",
|
|
3998
|
+
"description": "One place a frame's picture may come from. A frame tries its sources in order and takes the first that renders — so a sheet can name its live map AND a capture of it, and still show a map when the live one cannot load (opened outside the app that wrote it, for instance). The kind is read from the extension: .html is a map document, an image extension is a capture.",
|
|
3999
|
+
"attributes": [
|
|
4000
|
+
{
|
|
4001
|
+
"name": "src",
|
|
4002
|
+
"description": "Map document (.html) or capture image (.png/.jpg/.webp/.avif/.gif/.svg). Relative paths resolve against the sheet's own folder."
|
|
4003
|
+
},
|
|
4004
|
+
{
|
|
4005
|
+
"name": "corners",
|
|
4006
|
+
"description": "A capture's four corner coordinates as lon/lat pairs, order tl/tr/br/bl — the georeference that was true when it was taken, so furniture is right even if the live map never loaded."
|
|
4007
|
+
},
|
|
4008
|
+
{
|
|
4009
|
+
"name": "crs",
|
|
4010
|
+
"description": "A capture's CRS (e.g. EPSG:5070). Defaults to EPSG:3857."
|
|
4011
|
+
},
|
|
4012
|
+
{
|
|
4013
|
+
"name": "crs-def",
|
|
4014
|
+
"description": "Proj string (\"+proj=…\") for a CRS the library doesn't bundle."
|
|
4015
|
+
}
|
|
4016
|
+
],
|
|
4017
|
+
"references": [
|
|
4018
|
+
{
|
|
4019
|
+
"name": "Cartograph reference",
|
|
4020
|
+
"url": "https://github.com/NikaGeospatial/onlymapjs/blob/main/docs/cartograph.md"
|
|
4021
|
+
}
|
|
4022
|
+
]
|
|
4023
|
+
},
|
|
3996
4024
|
{
|
|
3997
4025
|
"name": "om-atlas",
|
|
3998
4026
|
"description": "Page-series generator: iterates the features of a layer in a frame — one page per feature, per-page camera refit (om-frame atlas-fit), {{atlas.<field>}} tokens, N-page print and N-file export.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nika-js/onlymap",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"description": "Declarative deck.gl maps for HTML and React — interactive WebGL mapping with GeoJSON/CSV/Arrow data, MapLibre basemaps, widgets, popups, and live streams from a custom-element manifest or typed React components. TypeScript, no build step.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"publishConfig": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: onlymapjs
|
|
3
|
-
description: Build, edit, debug, or review OnlyMapJS declarative HTML maps and dashboards, or React maps via the @nika-js/onlymap/react adapter. Use when a user asks for an interactive map, deck.gl-style visualization, geospatial dashboard, live fleet/telemetry map, choropleth, popup/tooltip map, map story/tour, manual drawing/sketch map, 3D map assets, a React map component, a map page shared as a single HTML file (incl. no-JS fallbacks for chat/email previews), a print-ready map sheet / PDF map / atlas (the cartograph entry: mm-based pages, frames, derived legends, scale bars, graticules), a styled/post-processed map look (film grain, halftone, duotone, vintage or printed finish, bloom-style passes — the <om-effect> pipeline), shaded relief / hillshade / terrain shading on a flat cartographic map (the HillshadeLayer), a map in a REAL PROJECTION (Albers, state plane, British National Grid, UTM, Lambert — the crs attribute), a label that FOLLOWS A LINE / curved text / text along a path (a river's name down the river — the TextOnPathLayer), generalizing or ornamenting geometry (simplify, smooth, dot density, a coastal vignette/buffer band, contour lines from a DEM — the <om-transform> pipeline), or EXPORTING A MAP AS SVG / editable vector for Illustrator or a print shop (incl. freezing a cartograph frame to inline vector), a responsive/mobile map whose controls auto-fold on narrow screens, auditing a map's widget layout with the check-layout tool, syncing OnlyMapJS map/camera state into an app state store (Redux, MobX, Zustand, Jotai — the getStore contract), BIM/IFC models (loading .ifc files in the browser, 3D Tiles per-element picking, isolate/hide/ghost, clash detection, model federation), routes and directions (a styled A-to-B route line, OSRM or another routing engine, click-to-route), live vehicle/rider/delivery tracking (a moving marker gliding between GPS fixes with a follow camera), a Remotion map video or programmatic map flyover with overlays (route to the separate @nika-js/onlymap-remotion package), a React Native or Expo mobile map (route to the separate @nika-js/onlymap-native package), or help with OnlyMapJS syntax, validation, widgets, data formats, testing, or publishing examples.
|
|
3
|
+
description: Build, edit, debug, or review OnlyMapJS declarative HTML maps and dashboards, or React maps via the @nika-js/onlymap/react adapter. Use when a user asks for an interactive map, deck.gl-style visualization, geospatial dashboard, live fleet/telemetry map, choropleth, popup/tooltip map, map story/tour, manual drawing/sketch map, 3D map assets, a React map component, a map page shared as a single HTML file (incl. no-JS fallbacks for chat/email previews), a print-ready map sheet / PDF map / atlas (the cartograph entry: mm-based pages, frames, derived legends, scale bars, graticules), a cartograph sheet whose map frame renders BLANK or empty outside the app that made it (frame fallback sources), a styled/post-processed map look (film grain, halftone, duotone, vintage or printed finish, bloom-style passes — the <om-effect> pipeline), shaded relief / hillshade / terrain shading on a flat cartographic map (the HillshadeLayer), a map in a REAL PROJECTION (Albers, state plane, British National Grid, UTM, Lambert — the crs attribute), a label that FOLLOWS A LINE / curved text / text along a path (a river's name down the river — the TextOnPathLayer), generalizing or ornamenting geometry (simplify, smooth, dot density, a coastal vignette/buffer band, contour lines from a DEM — the <om-transform> pipeline), or EXPORTING A MAP AS SVG / editable vector for Illustrator or a print shop (incl. freezing a cartograph frame to inline vector), a responsive/mobile map whose controls auto-fold on narrow screens, auditing a map's widget layout with the check-layout tool, syncing OnlyMapJS map/camera state into an app state store (Redux, MobX, Zustand, Jotai — the getStore contract), BIM/IFC models (loading .ifc files in the browser, 3D Tiles per-element picking, isolate/hide/ghost, clash detection, model federation), routes and directions (a styled A-to-B route line, OSRM or another routing engine, click-to-route), live vehicle/rider/delivery tracking (a moving marker gliding between GPS fixes with a follow camera), a Remotion map video or programmatic map flyover with overlays (route to the separate @nika-js/onlymap-remotion package), a React Native or Expo mobile map (route to the separate @nika-js/onlymap-native package), or help with OnlyMapJS syntax, validation, widgets, data formats, testing, or publishing examples.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OnlyMapJS
|
|
@@ -23,7 +23,7 @@ Use OnlyMapJS as a declarative HTML map library. Write custom elements such as `
|
|
|
23
23
|
</script>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
For no-build CDN pages, use the single-file standalone bundle from a raw-file CDN — `https://unpkg.com/@nika-js/onlymap@0.10.
|
|
26
|
+
For no-build CDN pages, use the single-file standalone bundle from a raw-file CDN — `https://unpkg.com/@nika-js/onlymap@0.10.6` (the bare package URL serves `dist/onlymap.standalone.js`) — plus `<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.10.6/dist/onlymapjs.css">`. Never a rebundling CDN (esm.sh, skypack): re-bundling duplicates the deck.gl/luma.gl runtime and every layer fails shader compilation.
|
|
27
27
|
|
|
28
28
|
## React Projects
|
|
29
29
|
|
|
@@ -83,6 +83,7 @@ Load the smallest reference needed for the task:
|
|
|
83
83
|
- Generalizing or ornamenting geometry (smooth a jagged coastline, thin a dense one, scatter dots for population, an engraved coastal vignette, contour lines) -> `<om-transform type="simplify|smooth|dot-density|buffer|contour">` as a CHILD of the `<om-layer>`. Spatial knobs are millimetres on paper and need `reference-scale` on `<om-map>`; ground units (`tolerance="50m"`) need none. `buffer` is a cartographic ORNAMENT with a measured half-cell bound — for a setback somebody will act on, say so and point at PostGIS/turf. See docs/cartography.md.
|
|
84
84
|
- A label that FOLLOWS a line (curved text, text on a path, "the river's name should run along the river") -> `<om-layer type="TextOnPathLayer" get-path="$path" get-text="$name">`. deck has no such layer; this is a composite emitting one text instance per glyph. `letter-spacing` tracks names out (the convention for oceans and ranges), `offset` moves it off the line, `placement="start|middle|end"` picks where. It reads left-to-right whichever way the line was digitised, and a name that does not fit is DROPPED rather than squeezed. Exports as one `<textPath>`. See docs/cartography.md.
|
|
85
85
|
- Exporting a map as EDITABLE VECTOR (SVG for Illustrator, a print shop, "not a screenshot") -> `await map.snapshot({ format: "svg" })`, which returns SVG text. Labels come out as real `<text>`; rasters and 3D come out as placed `<image>` bands. A `<om-effect>` print finish forces the whole frame to one raster band — say that BEFORE the user builds a sheet around both. `frame.freeze({format: "svg"})` does the same inside a cartograph frame. See docs/cartography.md.
|
|
86
|
+
- A cartograph sheet whose FRAME IS BLANK when opened as a file (or sent to someone), while its legend, scale bar and titles are all correct -> the frame's `src=` map loaded and drew NOTHING: its layers point at paths or a protocol that only exist inside the app that wrote the sheet. Nothing errored, so no placeholder fires. Give the frame a second source: `<om-source src="captures/<frame>@2x.png" corners="[[…]×4]" crs="…">` after the map, and it shows a correct picture instead of a blank box. `src=` on the frame is shorthand for the first `<om-source>`; the frame takes the first source that RENDERS (one drawable thing after settle) and reports its pick as `data-om-carto-source` + an `om-frame-source` event. A capture MUST carry its own `corners` — when it is what gets shown, the live map did not load, so its CRS is unknowable. A stored sheet is renderable IN PLACE, not portable: capture paths are relative, and export is what inlines the map and embeds the rasters. See references/syntax.md and docs/cartograph.md.
|
|
86
87
|
- GeoTIFF/COG raster (DEM, satellite imagery, NDVI) -> `<om-layer type="COGLayer" src="…tif">` with `min`/`max`/`colormap` for single-band data (see syntax.md — `src`, not `data`).
|
|
87
88
|
- Zarr / GeoZarr raster (chunked N-D arrays — climate/weather grids, datacubes) -> `<om-layer type="ZarrLayer" src="….zarr" variable="…" select="time=0">` with `min`/`max`/`colormap` (same raster styling as COGLayer). Pick the `variable` and pin every non-spatial dim in `select`. A GeoZarr store georeferences itself; a plain Zarr needs manual `bounds` + `crs` + `spatial-dims`. `src`, not `data` — and it can be any absolute URL to a remote store, which needs no server setup but must be CORS-enabled (fetched in the browser) and public (authenticated stores are a follow-up). See syntax.md.
|
|
88
89
|
- BIM model / .ifc file / 3D Tiles with per-element picking -> `<om-layer type="BIMLayer" src="….ifc" pickable>` (parses the IFC in-browser; web-ifc WASM is CDN-fetched on first use) or `type="Tile3DLayer" tileset="…" pick-features` for a pre-built tileset. Author `terrain` explicitly (`terrain="mapterhorn"`, or `terrain="off"` for flat ground) — a model that resolves real elevation (IfcMapConversion + OrthogonalHeight) on a terrain-less map raises an error through the validation channel at load time, and the library never writes attributes for you. Style by property with `feature-color-by`/`feature-color-scale` (+ `feature-palette`); isolate/hide/ghost elements declaratively with `feature-filter-field` + `isolate-features`/`hide-features`/`ghost-features` (undoable, story-steppable). See syntax.md.
|
|
@@ -16,8 +16,8 @@ Vite/npm project:
|
|
|
16
16
|
Static CDN page (raw-file CDNs only — unpkg/jsDelivr; never esm.sh or another rebundling CDN, which duplicates the WebGL runtime and breaks layer shaders):
|
|
17
17
|
|
|
18
18
|
```html
|
|
19
|
-
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.10.
|
|
20
|
-
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.10.
|
|
19
|
+
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.10.6/dist/onlymapjs.css">
|
|
20
|
+
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.10.6"></script>
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Always include `onlymapjs.css` — it carries the MapLibre basemap styles and the no-JS fallback rules (`<om-fallback>` / default banner). For the fallback to work in script-disabled previews it must load without JavaScript: a real `<link rel="stylesheet">` or inlined `<style>` on no-build pages (a bundler-emitted stylesheet is fine in npm projects).
|
|
@@ -677,6 +677,17 @@ A separate lazy entry (`import "@nika-js/onlymap/cartograph"`; CDN: `https://unp
|
|
|
677
677
|
```
|
|
678
678
|
|
|
679
679
|
- Frames: live (`<om-map>` child, the FRAME's camera attributes win) or `mode="static"` with `crs` + `corners` for a georeferenced raster. `overview-of="<frame-id>"` draws a locator footprint.
|
|
680
|
+
- ORDERED SOURCES. A frame may name several places its picture can come from and shows the first that RENDERS; `src=` is shorthand for the first, then each `<om-source>` child in document order, and an inline `<om-map>` outranks both.
|
|
681
|
+
|
|
682
|
+
```html
|
|
683
|
+
<om-frame id="main" x="15" y="41" w="255" h="155" center="[-96, 38]" zoom="3.25">
|
|
684
|
+
<om-source src="../maps/map-abc.html"></om-source>
|
|
685
|
+
<om-source src="captures/main@2x.png"
|
|
686
|
+
corners="[[-126,50],[-66,50],[-66,23],[-126,23]]" crs="EPSG:5070"></om-source>
|
|
687
|
+
</om-frame>
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
The kind is read from the EXTENSION (`.html` = map document; `.png`/`.jpg`/`.jpeg`/`.webp`/`.avif`/`.gif`/`.svg` = capture) — an unrecognised one is a validation error naming both, not a guess. A capture MUST carry its own `corners` (and `crs` if not 3857): when the capture is what gets shown, the live map did not load, so its projection is unknowable, and deriving corners from the frame's camera would be Mercator-only — wrong for exactly the projected sheets this serves. "Rendered" is ONE drawable thing after settle (a basemap, or rows on any layer), deliberately not "every layer loaded": a sheet whose fifth layer 404s is degraded, not failed. Why it exists: a sheet opened outside the app that wrote it mounts a map whose every layer failed to fetch and still reports success — a blank box inside correct furniture. The frame reports its choice via `data-om-carto-source="<index>"` and an `om-frame-source` event (`{id, index, kind, src}`), and fires `om-frame-view` on a switch so furniture re-places. A stored sheet is renderable IN PLACE, not portable — capture paths are relative; export inlines the map and embeds the rasters.
|
|
680
691
|
|
|
681
692
|
- A live frame georeferences whatever its map shows. Zoomed out past the whole world, the map wraps inside the frame like any web map — the graticule labels each copy by where it is on the globe, and the scale bar measures its own row — and the frame never limits or rewrites the camera. Once the map inside a frame settles after a pan, rotate or tilt, the frame's georeference follows the map's own view: north arrow, scale bar, graticule, locator inset and `{{frame.<id>.scale}}` describe what is on screen, and freezing captures that view. `max-pitch` and `min-zoom` on `<om-map>` are author-set controls (a kiosk map that should stay upright or within an area); nothing sets them for you.
|
|
682
693
|
- `<om-legend for>` derives rows from the live map's own symbology (classified breaks included); literal rows via `derived="false"` + `<om-legend-row>` children.
|