@nika-js/onlymap 0.10.5 → 0.10.7
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 +27 -0
- package/README.md +1 -1
- package/dist/{basemap-Q-Hd5jE-.js → basemap-BLkOm29L.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 +23 -3
- package/dist/cartograph.js +1324 -1126
- package/dist/cartograph.standalone.js +1805 -1607
- package/dist/elements/om-map.d.ts +11 -0
- package/dist/{geoparquet-mtTpzfNU.js → geoparquet-DbbUXVXd.js} +1 -1
- package/dist/{globe-view-D6a6_ADT.js → globe-view-n8TPYgZe.js} +1 -1
- package/dist/{hillshade-CY4PNGum.js → hillshade-B6l8L37H.js} +1 -1
- package/dist/{index-BwOC7qcd.js → index-B0tkvD0x.js} +1 -1
- package/dist/{index--Zswyzcw.js → index-BLAVlsST.js} +1 -1
- package/dist/{index-DUJtvAv2.js → index-Bl4588NA.js} +2 -2
- package/dist/{index-D6jtcTK4.js → index-CbOQw_BV.js} +3 -3
- package/dist/{index-V-VuBp7C.js → index-Dhx6gjQz.js} +1 -1
- package/dist/{index-BhH8ySRp.js → index-NAbQYGbu.js} +3 -3
- package/dist/{index-yJEyQjKn.js → index-WHzuElLB.js} +54 -18
- package/dist/{index-DwIUeLzW.js → index-mjadez7s.js} +1 -1
- package/dist/{index-4z9qUdmz.js → index-sBhuo23e.js} +1 -1
- package/dist/{lerc-BdO3Bk6b.js → lerc-C5Oz68We.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-D_esTgsv.js} +1 -1
- package/dist/{raster-3YBp5u4H.js → raster-9bYuOeFR.js} +3 -3
- package/dist/{raster-pipeline-P1v9_jgU.js → raster-pipeline-DxRvTCIO.js} +1 -1
- package/dist/runtime-core.d.ts +19 -0
- package/dist/{text-on-path-DMUvpyS-.js → text-on-path-BGsF6paj.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CldzO0mP.js → zarr-aO_vxY6e.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
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,33 @@ Note: npm collapsed a few closely-spaced releases — the GPX/FlatGeobuf (0.5.4)
|
|
|
8
8
|
and GeoParquet (0.5.5) work shipped to npm together as **0.5.6**, so npm's
|
|
9
9
|
version list jumps 0.5.3 → 0.5.6. Each logical version is listed here regardless.
|
|
10
10
|
|
|
11
|
+
## 0.10.7 — 2026-09-28
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- **A print sheet now shows the current version of the map it points at.** Restyle the map, reopen the sheet, and the frame could still draw the old one — the sheet was serving the copy it had fetched the first time. It looked exactly like the restyle not having worked. Sheets that seemed to render correctly only after you opened the map first were this: opening a map saves its camera, which rewrote the file and cleared the stale copy by accident.
|
|
15
|
+
|
|
16
|
+
## 0.10.6 — 2026-09-28
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- **A print sheet's map frame can now name more than one place to get its picture from, and shows the first that actually works.** Send someone a sheet you made in an app, and the frame could come out blank — a white box ringed by a perfectly correct legend, scale bar and title — because the map it points at only resolves inside that app. Nothing errored, so nothing told you. Give the frame a second source and it falls through to a georeferenced picture instead:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<om-frame id="main" x="15" y="41" w="255" h="155" center="[-96, 38]" zoom="3.25">
|
|
23
|
+
<om-source src="../maps/map-abc.html"></om-source>
|
|
24
|
+
<om-source src="captures/main@2x.png"
|
|
25
|
+
corners="[[-126,50],[-66,50],[-66,23],[-126,23]]" crs="EPSG:5070"></om-source>
|
|
26
|
+
</om-frame>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Sources are tried in the order you write them. `src=` on the frame still works exactly as before and counts as the first one, so no existing sheet needs editing. Whether a source counts as working is deliberately generous: if anything drew — a basemap, or any layer with data in it — the frame keeps it. A sheet whose fifth layer is missing is a sheet with a missing layer, not a reason to show an old picture instead.
|
|
30
|
+
- **The frame tells you which source it settled on**, so an editor can say "showing a capture" rather than leaving you to guess: a `data-om-carto-source` attribute and an `om-frame-source` event. The scale bar, north arrow and graticule re-place themselves against whichever source won.
|
|
31
|
+
- **`hasDrawableContent()` on `<om-map>`** — did this map draw anything at all? Useful anywhere you need to tell "finished loading" from "finished loading and there is nothing there", which a map cannot otherwise report.
|
|
32
|
+
|
|
33
|
+
### Notes
|
|
34
|
+
- A picture source carries its own `corners` (and `crs`), because if it is what you are seeing then the live map never loaded and there is nothing else to take the coordinates from. Validation asks for them.
|
|
35
|
+
- A source's kind comes from its file extension — `.html` is a map, an image extension is a picture. Anything else is a validation error that names both, rather than a guess.
|
|
36
|
+
- A saved sheet renders where it sits; it is not portable. Picture paths are relative, so moving the file alone breaks them, the same way it already breaks a relative `src=`. Exporting is what produces a file you can send anywhere.
|
|
37
|
+
|
|
11
38
|
## 0.10.5 — 2026-09-25
|
|
12
39
|
|
|
13
40
|
### Changed
|
package/README.md
CHANGED
|
@@ -149,7 +149,7 @@ Hovering a pickable feature shows a pointer cursor automatically, so recipients
|
|
|
149
149
|
|
|
150
150
|
**Animation:** camera moves accept a duration — `map.flyTo(coords, zoom, { duration: 1200, curve: true })`, or the `fly-to` action (`center`/`zoom`/`pitch`/`bearing`/`duration`) from any behavior or button; `prefers-reduced-motion` is honored (moves become instant, final state identical). Per-prop GPU transitions via the `transition` attribute: `transition="get-fill-color 800ms"` fades color changes; on a streaming layer, `transition="get-position 300ms"` makes entities glide between updates.
|
|
151
151
|
|
|
152
|
-
**Print layouts (cartographs):** the `@nika-js/onlymap/cartograph` entry renders standalone pages measured in millimetres — `<om-cartograph>` holds live or static-georeferenced `<om-frame>`s plus derived legends, graticules, scale bars, north roses, shapes, images and token-driven text; `<om-atlas>` renders one page per feature and exports a ZIP. Sheets print at true page size (`@page` + print-DPI frame captures) or export as 300 dpi PNG, with bleed/crop-marks/safe-zone press attributes and page-wide colour-vision simulation. It is a separate lazy build entry: the core bundle does not grow, and a static-only sheet never loads the map runtime. Guide: [docs/cartograph.md](docs/cartograph.md).
|
|
152
|
+
**Print layouts (cartographs):** the `@nika-js/onlymap/cartograph` entry renders standalone pages measured in millimetres — `<om-cartograph>` holds live or static-georeferenced `<om-frame>`s plus derived legends, graticules, scale bars, north roses, shapes, images and token-driven text; `<om-atlas>` renders one page per feature and exports a ZIP. A frame can name SEVERAL sources (`<om-source>`) and shows the first that actually renders, so a sheet whose live map cannot load where it is opened falls through to a georeferenced capture instead of a blank box, and says which one it chose. Sheets print at true page size (`@page` + print-DPI frame captures) or export as 300 dpi PNG, with bleed/crop-marks/safe-zone press attributes and page-wide colour-vision simulation. It is a separate lazy build entry: the core bundle does not grow, and a static-only sheet never loads the map runtime. Guide: [docs/cartograph.md](docs/cartograph.md).
|
|
153
153
|
|
|
154
154
|
**Map stories:** a guided tour as markup — `<om-story>` holds `<om-step>` children that fire the same actions behaviors use, on a timeline (`duration`, `delay`, `parallel`); the built-in `type="player"` widget gives play/pause/scrub, seeking restores the scene's captured initial state, one story is active per map, and grabbing the map pauses playback. Effect verbs — `fade`, `pulse`, `trace` (progressive TripsLayer draw-on; with `feature-id`, a single polygon draws itself on inside its own layer), and `populate` (rows drop in one by one via a GPU filter sweep) — work as step shorthands or plain actions. The story is a sibling that references layers by id — delete it and the map is unchanged. For flybys over 3D tilesets, `warm-tiles` pre-loads the route's tiles in the background before playback, and `paced` goes further: the story steps its own clock and never advances a frame while a tileset is still refining, so no frame ever shows unrefined tiles — wall-clock stretches instead (built for recorded takes; emits `om-paced-tick {t, waitedMs}` per frame, and the two compose — warm first, wait less). `npx @nika-js/onlymap record map.html --out flyby.mp4` turns that guarantee into an actual video: one screenshot per paced frame in headless Chromium (widgets and attribution included), assembled with ffmpeg — and effect verbs animate on the story clock, so recorded traces draw on frame by frame exactly as authored. Guide: [docs/stories.md](docs/stories.md).
|
|
155
155
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aJ as Y_, N as Bu, H as Pd, k as K_, aK as J_, aL as Q_, D as Xf, Z as ey } from "./index-
|
|
2
|
-
import { a as ty } from "./globe-view-
|
|
1
|
+
import { aJ as Y_, N as Bu, H as Pd, k as K_, aK as J_, aL as Q_, D as Xf, Z as ey } from "./index-WHzuElLB.js";
|
|
2
|
+
import { a as ty } from "./globe-view-n8TPYgZe.js";
|
|
3
3
|
var Ou = { exports: {} };
|
|
4
4
|
/**
|
|
5
5
|
* MapLibre GL JS
|
|
@@ -35,12 +35,30 @@ export declare class OmFrameElement extends CartographElementBase implements Car
|
|
|
35
35
|
private liveMapOwned;
|
|
36
36
|
/** A capture standing in for the live map during export/print. */
|
|
37
37
|
private captureImage;
|
|
38
|
+
/** Ordered-source state (docs/design/frame-sources.md). */
|
|
39
|
+
private sourceCursor;
|
|
40
|
+
/** The list this cursor indexes — an edit to it restarts from the top. */
|
|
41
|
+
private knownSourceList;
|
|
42
|
+
/** The source the frame is currently SHOWING, once one has rendered. */
|
|
43
|
+
private settledSource;
|
|
38
44
|
/** The authored camera last driven into the map, so a re-render can tell an edit from a repaint. */
|
|
39
45
|
private appliedCameraKey;
|
|
40
46
|
private printing;
|
|
41
47
|
get mode(): FrameMode;
|
|
42
48
|
/** The mounted `<om-map>`, once a live frame has one. */
|
|
43
49
|
get mapElement(): HTMLElement | null;
|
|
50
|
+
/**
|
|
51
|
+
* Where `corners`/`crs` are read from.
|
|
52
|
+
*
|
|
53
|
+
* A georeference describes a SOURCE, not a frame: a capture carries the one
|
|
54
|
+
* that was true when it was taken, which is the only georeference available
|
|
55
|
+
* when the live map never loaded and its CRS is therefore unknowable. For
|
|
56
|
+
* `mode="static"` and the `src=` shorthand that element is the frame, so
|
|
57
|
+
* every existing document reads exactly as before.
|
|
58
|
+
*/
|
|
59
|
+
private get georefHost();
|
|
60
|
+
/** Is the frame currently showing a capture rather than a live map? */
|
|
61
|
+
private get showingRaster();
|
|
44
62
|
/**
|
|
45
63
|
* The frame's georeference, or null when it has none yet (malformed corners,
|
|
46
64
|
* a CRS still resolving, a live map not yet mounted, a view too pitched to
|
|
@@ -80,8 +98,43 @@ export declare class OmFrameElement extends CartographElementBase implements Car
|
|
|
80
98
|
protected renderNow(): void;
|
|
81
99
|
private renderStatic;
|
|
82
100
|
private renderLive;
|
|
83
|
-
/**
|
|
84
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Draw a CAPTURE source — a georeferenced picture, placed exactly like a
|
|
103
|
+
* static frame's raster because it is the same thing arrived at a different
|
|
104
|
+
* way. The <img> is created here and reused, so falling through to a capture
|
|
105
|
+
* needs nothing in the document that the author did not write.
|
|
106
|
+
*/
|
|
107
|
+
private renderCaptureSource;
|
|
108
|
+
/** `georefHost` for a source not yet settled — the settle happens after the check. */
|
|
109
|
+
private georefHostFor;
|
|
110
|
+
/** A capture left over from an earlier source must not sit under a live map. */
|
|
111
|
+
private hideCaptureImage;
|
|
112
|
+
/**
|
|
113
|
+
* This frame's sources, in the order they are tried. The map the frame
|
|
114
|
+
* FETCHED is excluded: it is a child by then, and would otherwise read as an
|
|
115
|
+
* inline source on the next render.
|
|
116
|
+
*/
|
|
117
|
+
private sources;
|
|
118
|
+
/**
|
|
119
|
+
* Move to the next source, or report that there is none.
|
|
120
|
+
*
|
|
121
|
+
* Called when a source has demonstrably failed — it threw, or it settled
|
|
122
|
+
* having drawn nothing. The map that drew nothing is released first: leaving
|
|
123
|
+
* it mounted under a capture would keep a blank canvas over the picture.
|
|
124
|
+
*/
|
|
125
|
+
private advanceSource;
|
|
126
|
+
/**
|
|
127
|
+
* Record which source the frame settled on, and say so.
|
|
128
|
+
*
|
|
129
|
+
* A capture shown silently is its own trap: an editor should be able to
|
|
130
|
+
* report "showing a capture", and the argument for trying sources in order
|
|
131
|
+
* at all depends on the choice being visible rather than guessed at.
|
|
132
|
+
*
|
|
133
|
+
* `om-frame-view` fires too, because settling on a different source changes
|
|
134
|
+
* the frame's georeference — furniture left on the previous source's georef
|
|
135
|
+
* is the same silently-wrong output ordered sources exist to remove.
|
|
136
|
+
*/
|
|
137
|
+
private settleSource;
|
|
85
138
|
/** Leave live mode without deleting an authored inline map. */
|
|
86
139
|
private suspendLiveMode;
|
|
87
140
|
private releaseLiveMap;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <om-source> — one place a frame's picture may come from.
|
|
3
|
+
*
|
|
4
|
+
* Pure declaration: it draws nothing itself and has no placement. The frame
|
|
5
|
+
* reads its `src` and, for a capture, the `corners`/`crs` that were true when
|
|
6
|
+
* that capture was taken. See docs/design/frame-sources.md.
|
|
7
|
+
*
|
|
8
|
+
* It hides itself rather than relying on the stylesheet, because a frozen
|
|
9
|
+
* sheet is meant to open with no runtime and no network — and an element the
|
|
10
|
+
* browser does not know is `display: inline`, which would put a stray text box
|
|
11
|
+
* inside the frame.
|
|
12
|
+
*/
|
|
13
|
+
import { HTMLElementBase } from "../../env";
|
|
14
|
+
export declare class OmSourceElement extends HTMLElementBase {
|
|
15
|
+
static readonly observedAttributes: string[];
|
|
16
|
+
connectedCallback(): void;
|
|
17
|
+
/**
|
|
18
|
+
* An edit re-resolves the OWNING frame: which source wins is a property of
|
|
19
|
+
* the list, so the decision cannot be made here. `om-frame` observes its
|
|
20
|
+
* own subtree for this.
|
|
21
|
+
*/
|
|
22
|
+
attributeChangedCallback(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a frame's picture can come from, in the order it is tried.
|
|
3
|
+
*
|
|
4
|
+
* A frame declares its sources and takes the first that RENDERS. This module
|
|
5
|
+
* is the pure half — reading the ordered list out of the markup and deciding
|
|
6
|
+
* what kind each source is — so `om-frame.ts` stays about mounting and
|
|
7
|
+
* placement. See docs/design/frame-sources.md.
|
|
8
|
+
*
|
|
9
|
+
* The reason the list exists: `src=` names one source and assumes it works,
|
|
10
|
+
* which is true only inside the app that wrote the sheet. Opened anywhere
|
|
11
|
+
* else, a relative path into a host's storage and a host-local protocol for
|
|
12
|
+
* the data both fail, and the frame that "loaded" draws nothing. Outside its
|
|
13
|
+
* host, a capture is not a rescue — it is the only thing that can render.
|
|
14
|
+
*/
|
|
15
|
+
export type FrameSourceKind = "inline" | "map" | "raster";
|
|
16
|
+
export interface FrameSource {
|
|
17
|
+
kind: FrameSourceKind;
|
|
18
|
+
/**
|
|
19
|
+
* Mount identity. Compared to decide whether a re-render can keep the
|
|
20
|
+
* mounted map or must replace it, so it distinguishes a source from its
|
|
21
|
+
* siblings — not merely its URL, which two sources may share.
|
|
22
|
+
*/
|
|
23
|
+
key: string;
|
|
24
|
+
/**
|
|
25
|
+
* Where this source's `corners`/`crs` are read from: the `<om-source>` that
|
|
26
|
+
* declared it, or the frame itself for the `src=` shorthand. A georeference
|
|
27
|
+
* describes the SOURCE, which is why it cannot live only on the frame.
|
|
28
|
+
*/
|
|
29
|
+
el: Element;
|
|
30
|
+
/** Absent only for an inline `<om-map>` child. */
|
|
31
|
+
src?: string;
|
|
32
|
+
/** The authored map, for `kind: "inline"`. */
|
|
33
|
+
map?: Element;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A source's kind, from its extension — null when the extension is not one
|
|
37
|
+
* this understands.
|
|
38
|
+
*
|
|
39
|
+
* Read from the filename rather than an authored `type=`, because the name
|
|
40
|
+
* already says it and two ways to state one fact is one way to state it
|
|
41
|
+
* wrongly. Null is a VALIDATION error naming both kinds, never a silent
|
|
42
|
+
* guess: guessing wrong shows a picture of the wrong thing, or nothing.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sourceKindFromSrc(src: string): "map" | "raster" | null;
|
|
45
|
+
/**
|
|
46
|
+
* The frame's sources, in the order they are tried.
|
|
47
|
+
*
|
|
48
|
+
* Order is document order, with two positions fixed by what they mean:
|
|
49
|
+
* 1. an inline `<om-map>` child — the author put the map IN the frame, so
|
|
50
|
+
* nothing can outrank it;
|
|
51
|
+
* 2. the frame's own `src=`, which is shorthand for the first
|
|
52
|
+
* `<om-source src=>` and keeps the common case one line;
|
|
53
|
+
* 3. each `<om-source>`, in document order.
|
|
54
|
+
*
|
|
55
|
+
* So a fallback is added by appending a child, without restructuring the
|
|
56
|
+
* frame that already works.
|
|
57
|
+
*
|
|
58
|
+
* `adopted` is the map this frame FETCHED and appended; it is a child by then
|
|
59
|
+
* and would otherwise read as an inline source on the next render, pinning
|
|
60
|
+
* the frame to a copy of its own result.
|
|
61
|
+
*/
|
|
62
|
+
export declare function frameSources(frame: Element, adopted?: Element | null): FrameSource[];
|
|
63
|
+
/** Identity of the LIST itself — a change means restarting from the top. */
|
|
64
|
+
export declare function sourceListKey(sources: readonly FrameSource[]): string;
|
|
@@ -25,7 +25,21 @@ export type Corners = [LngLat, LngLat, LngLat, LngLat];
|
|
|
25
25
|
* Returns null if the source has nothing to adopt.
|
|
26
26
|
*/
|
|
27
27
|
export declare function sanitizeAdoptedMap(source: Element, doc: Document): Element | null;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Fetch a map document and return its `<om-map>`, sanitized and ready to mount.
|
|
30
|
+
*
|
|
31
|
+
* `no-store`, because the map a frame points at is a LIVE document that its
|
|
32
|
+
* author is editing in another window. Served from the HTTP cache, the frame
|
|
33
|
+
* shows the map as it was the first time this page asked for it: restyle the
|
|
34
|
+
* map, reopen the sheet, and the frame still draws the old one — indis-
|
|
35
|
+
* tinguishable from the restyle not having worked. It was found that way,
|
|
36
|
+
* masked further by the editing host's camera autosave, which rewrites the map
|
|
37
|
+
* file on open and so invalidated the entry by accident; the sheet therefore
|
|
38
|
+
* "worked" if you opened the map first and not otherwise.
|
|
39
|
+
*
|
|
40
|
+
* The cost is one conditional request per mount of a small HTML document,
|
|
41
|
+
* against a mount that already loads the runtime and every layer's data.
|
|
42
|
+
*/
|
|
29
43
|
export declare function fetchMapElement(src: string, doc?: Document): Promise<Element>;
|
|
30
44
|
export interface FrameCamera {
|
|
31
45
|
center: LngLat;
|
|
@@ -59,8 +73,14 @@ export declare function maxGeoreferenceablePitch(core: CoreModule, camera: Frame
|
|
|
59
73
|
* view, no camera produces; it guards a degenerate box, not a steep one.
|
|
60
74
|
*/
|
|
61
75
|
export declare function cornersFromCamera(core: CoreModule, camera: FrameCamera, widthPx: number, heightPx: number): Corners | null;
|
|
62
|
-
/**
|
|
63
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Load the core and build an `<om-map>` for a frame from ONE chosen source.
|
|
78
|
+
*
|
|
79
|
+
* The caller resolves WHICH source — a frame may declare several and take the
|
|
80
|
+
* first that renders (see frame-sources.ts) — so this no longer re-reads the
|
|
81
|
+
* frame and cannot disagree with the decision already made.
|
|
82
|
+
*/
|
|
83
|
+
export declare function buildLiveMap(frame: Element, source: Element | string | undefined): Promise<{
|
|
64
84
|
core: CoreModule;
|
|
65
85
|
map: Element;
|
|
66
86
|
}>;
|