@nika-js/onlymap 0.10.9 → 0.11.0

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 (55) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +15 -3
  3. package/dist/{basemap-B2VvspL4.js → basemap-Bg73oXUb.js} +2 -2
  4. package/dist/cartograph/element-base.d.ts +9 -0
  5. package/dist/cartograph/elements/om-legend.d.ts +4 -0
  6. package/dist/cartograph.js +517 -495
  7. package/dist/cartograph.standalone.js +1307 -1285
  8. package/dist/cluster-index.d.ts +77 -0
  9. package/dist/cluster-options.d.ts +92 -0
  10. package/dist/ctx.d.ts +2 -0
  11. package/dist/elements/om-map.d.ts +6 -0
  12. package/dist/{geoparquet-BJQC6zwS.js → geoparquet-BASBa9tf.js} +1 -1
  13. package/dist/{globe-view-C3Gaf--d.js → globe-view-CTkofOiM.js} +1 -1
  14. package/dist/{hillshade-CNtzlYlz.js → hillshade-DdVEO8lc.js} +1 -1
  15. package/dist/html-data.d.ts +1 -1
  16. package/dist/{index-CQdTYZ08.js → index-BCDmJfeb.js} +3 -3
  17. package/dist/{index-j_Ojvo4x.js → index-BLfj5bIo.js} +1 -1
  18. package/dist/{index-Cp2kquh5.js → index-BOjo5N6i.js} +1 -1
  19. package/dist/{index-DPEWcZeV.js → index-C-YAnesV.js} +17527 -16473
  20. package/dist/{index-CI0vdi2E.js → index-C7CNrOGW.js} +1 -1
  21. package/dist/{index-a-wOE5hE.js → index-CVAyXg52.js} +1 -1
  22. package/dist/{index-D2RzlXff.js → index-DbfTOgYl.js} +1 -1
  23. package/dist/{index-m3UsmxCq.js → index-DsLNa_IB.js} +2 -2
  24. package/dist/{index-C3S0FWlc.js → index-FtNZZGWv.js} +3 -3
  25. package/dist/ir-snapshot.d.ts +10 -0
  26. package/dist/ir.d.ts +9 -0
  27. package/dist/layer-registry.d.ts +8 -0
  28. package/dist/layers/cluster-layer.d.ts +111 -0
  29. package/dist/{lerc-Bv4RLXha.js → lerc-CoNq0xxX.js} +1 -1
  30. package/dist/onlymap.standalone.js +35944 -34890
  31. package/dist/onlymapjs.js +1 -1
  32. package/dist/{post-process-effect-Cpbyy4I3.js → post-process-effect-CrZoIEYa.js} +1 -1
  33. package/dist/programmatic.d.ts +6 -0
  34. package/dist/{raster-D_HU2WuR.js → raster-CZMdghdy.js} +3 -3
  35. package/dist/{raster-pipeline-BmcWLImS.js → raster-pipeline-n2wrLc9r.js} +1 -1
  36. package/dist/runtime-core.d.ts +24 -0
  37. package/dist/{text-on-path-ClLwT2eS.js → text-on-path-CHkHjky-.js} +1 -1
  38. package/dist/version.d.ts +1 -1
  39. package/dist/{zarr-CCCIYwWt.js → zarr-DRBhsEZZ.js} +2 -2
  40. package/docs/cartograph.md +13 -7
  41. package/llms.txt +3 -2
  42. package/onlymapjs.attributes.json +33 -0
  43. package/onlymapjs.html-data.json +113 -1
  44. package/package.json +7 -3
  45. package/skills/onlymapjs/SKILL.md +3 -2
  46. package/skills/onlymapjs/references/react.md +1 -0
  47. package/skills/onlymapjs/references/syntax.md +48 -2
  48. package/docs/design/arrows.md +0 -182
  49. package/docs/design/carto-substrate.md +0 -1067
  50. package/docs/design/cog-v2.md +0 -223
  51. package/docs/design/extensions.md +0 -250
  52. package/docs/design/frame-sources.md +0 -229
  53. package/docs/design/hillshade.md +0 -290
  54. package/docs/design/paced-flyby.md +0 -42
  55. package/docs/design/trace-link-failure.md +0 -20
package/CHANGELOG.md CHANGED
@@ -8,6 +8,24 @@ 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.11.0 — 2026-09-30
12
+
13
+ ### Added
14
+ - **Points that pile up can now be clustered with one attribute.** `cluster="true"` on a `ScatterplotLayer`, a `GeoJsonLayer` of Point features or an `IconLayer` merges the points that would overlap on screen into count bubbles that split apart as the reader zooms in. It is a toggle, not a different layer type: the layer keeps its id, its data, its own colours and sizes for the points that stand alone, its popups and its actions. `cluster-radius`, `cluster-max-zoom` and `cluster-min-points` use the names MapLibre users already know.
15
+ - **Bubbles can say more than a count.** `cluster-properties="sum:capacity_mw,mode:fuel"` carries totals, extremes, means or the commonest category onto each bubble, and `get-cluster-radius`, `get-cluster-fill-color`, `get-cluster-line-color` and `get-cluster-label` style the bubbles with the same expressions the rest of the map uses — a bubble coloured by the fuel most of its plants burn, sized by their combined capacity.
16
+ - **Bubble sizes stay meaningful at every zoom.** Every bubble knows the largest cluster at the current zoom (`$count_max`, and `$sum_x_max` for each aggregate), so the default size keeps the biggest bubble at 36 px whether the reader is looking at a continent or a county, and a custom size or colour ramp can do the same.
17
+ - **A click on a bubble flies to where it splits**, eased, with `cluster-click="none"` to opt out and an `expand-cluster` action to wire it by hand. Hovering or clicking a bubble picks it like any feature — `{{count}}` and the aggregates work in overlays — and `pick="cluster"` / `pick="point"` on `<om-behavior>` gives bubbles and single points their own cards. `map.clusterLeaves(layerId, clusterId)` lists the points inside a bubble. The legend explains the bubbles with a row of its own.
18
+ - **Any layer attribute can be changed at runtime from a widget** with the `set-layer-attribute` action (`{ layer, name, value }`) — the switch behind an on/off button for clustering, or anything else; live, story-capturable and undoable like the other layer actions.
19
+ - **A new example**, *Cluster points*: twenty thousand power plants, a clustering on/off button, bubbles coloured by fuel, a hover summary per bubble, and icons taking over from the circles past z12 with `visible-zoom-range`.
20
+
21
+ ### Changed
22
+ - **The package ships its user guides only.** Working design notes under `docs/design/` were included in earlier tarballs by accident; they are internal planning documents, not documentation, and no longer ship. Nothing that was documented has moved.
23
+
24
+ ## 0.10.10 — 2026-09-29
25
+
26
+ ### Added
27
+ - **A print sheet's colours can now be set attribute by attribute, not only by theme.** The page takes `bg`, `color` and `font`; a legend takes `bg`, `color`, `stroke`, `font-size` and `padding`; the scale bar, north indicator and graticule take `color` — beside the `color`/`bg` text and `fill`/`stroke` shapes always had. Until now a sheet had five themes and a `<style>` block, and an author who wrote `background=` on the page got a warning and no change. Each override is the theme's own property scoped to that element, so the sheet on screen, the printed page and the exported image agree.
28
+
11
29
  ## 0.10.9 — 2026-09-29
12
30
 
13
31
  ### Added
package/README.md CHANGED
@@ -137,9 +137,21 @@ Numeric timestamps are always epoch **milliseconds**, never guessed as seconds.
137
137
 
138
138
  Private endpoints: `OmMap.configureData({ headers, credentials, fetch })` — applied to every fetch including refreshes. Credentials stay out of markup by design. Full guide: [docs/live-data.md](docs/live-data.md).
139
139
 
140
+ ### Clustering
141
+
142
+ Thousands of points that overlap on screen become count bubbles that split apart as the reader zooms in — one attribute on the layer, not a different layer type:
143
+
144
+ ```html
145
+ <om-layer id="plants" type="ScatterplotLayer" data="./plants.csv" get-position="[$lon, $lat]" color="#2563eb"
146
+ cluster="true" cluster-properties="sum:capacity_mw,mode:fuel"
147
+ get-cluster-fill-color="$mode_fuel == 'Hydro' ? '#0ea5e9' : '#64748b'" pickable></om-layer>
148
+ ```
149
+
150
+ `cluster="true"` works on `ScatterplotLayer`, `GeoJsonLayer` (Point features) and `IconLayer`. The layer keeps its id, data, its own `get-*` symbology for the points that stand alone, its picks and its actions. `cluster-radius` (px, 50), `cluster-max-zoom` (16) and `cluster-min-points` (2) follow MapLibre's names. `cluster-properties="sum:f,min:f,max:f,mean:f,mode:f"` carries aggregates onto each bubble as `$sum_f`, `$mode_f`…, beside `$count`; `get-cluster-radius`, `get-cluster-fill-color`, `get-cluster-line-color` and `get-cluster-label` style the bubbles with the same expression language. Every bubble also carries `$count_max` and `$<aggregate>_max` — the largest value at the *current zoom* — so the default radius, `scale($count / $count_max, sqrt, [12, 36], domain=[0, 1])`, keeps the biggest bubble at 36 px whether the reader is looking at a continent or a county. A click on a bubble eases to where it splits (`cluster-click="none"` to opt out, or wire `expand-cluster` yourself); a bubble pick carries `cluster: true`, `count` and the aggregates into overlays and `ctx.selection`, and `pick="point"` / `pick="cluster"` on `<om-behavior>` gives points and bubbles their own cards; `map.clusterLeaves(layerId, clusterId)` returns the rows inside one.
151
+
140
152
  ### Interaction
141
153
 
142
- Built-in actions wire to picks, widget buttons (`data-emit`), or script (`ctx.emit`) with one shared payload contract: `show-overlay`, `hide-overlay`, `show-tooltip`, `hide-tooltip`, `toggle-layer`, `set-pickable` (a runtime popups-on/off switch per layer), `highlight-feature`, `zoom-to-feature`, `filter-layer`, `set-basemap`, `set-effect`, `zoom-in`, `zoom-out`, `undo`, `redo` — plus `OmMap.registerAction` for your own.
154
+ Built-in actions wire to picks, widget buttons (`data-emit`), or script (`ctx.emit`) with one shared payload contract: `show-overlay`, `hide-overlay`, `show-tooltip`, `hide-tooltip`, `toggle-layer`, `set-pickable` (a runtime popups-on/off switch per layer), `set-layer-attribute` (write any layer attribute at runtime — the generic switch behind a widget button), `expand-cluster`, `highlight-feature`, `zoom-to-feature`, `filter-layer`, `set-basemap`, `set-effect`, `zoom-in`, `zoom-out`, `undo`, `redo` — plus `OmMap.registerAction` for your own.
143
155
 
144
156
  Hovering a pickable feature shows a pointer cursor automatically, so recipients can tell a map is interactive without clicking at random (`pick-cursor` on `<om-map>` customizes or disables it). Hover GPU picking is rest-debounced by default — one pick when the pointer stops instead of one per mouse move — which keeps hover popups smooth even on integrated graphics; `hover-pick="continuous|off|<ms>"` tunes it.
145
157
 
@@ -149,7 +161,7 @@ Hovering a pickable feature shows a pointer cursor automatically, so recipients
149
161
 
150
162
  **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
163
 
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).
164
+ **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. Five built-in themes set the look, and any of it is overridable attribute by attribute — the page's ground, ink and font, a legend's panel colours and text size, the colour of a scale bar, north arrow or graticule — with screen, print and export agreeing. 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
165
 
154
166
  **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
167
 
@@ -432,7 +444,7 @@ The library reports one **deployment-scoped** usage snapshot per map per page lo
432
444
 
433
445
  ## Not implemented yet (honestly)
434
446
 
435
- Mapbox GL basemaps, depth-interleaved 3D compositing, globe projection, SSE transport, `dblclick` behaviors, the typed fluent builder, and stories/draw as React components (both work via the HTML manifest). On cartography: relief cannot be masked to land (clipping one layer to another's geometry is layer-extension work), `contour` marches in the DEM's Mercator grid even on a projected sheet (the polylines project exactly; the sampling is what is Mercator), and native-CRS tile pyramids are deferred until asked for. On React Native (`@nika-js/onlymap-native`): stories, draw, widgets, and overlays as native components (build native UI beside the map instead), and bare (non-Expo) React Native until its `0.2.0`. On `pick-features`: instanced (i3dm) tiles keep tile-granularity picking, and `feature-styles`' `opacity` below 1 is still being validated. On BIM: clash detection is bounding-box only (no mesh-level test, and it cannot tell a resolved penetration from a collision), there is no BCF export, no equivalent of Navisworks' Auto Reveal, and prepared tilesets converted before the `bbox*` columns existed cannot take part in a clash pass — `strength` tinting and `opacity: 0` (hide, a shader discard) work. On the measure widget's `volume` mode: the per-cell grid integration measures against the map's active terrain DEM only — measuring against an imported design surface or a previous survey (period-over-period reconciliation) and a cut/fill heat-map overlay are not implemented yet, and a snapped footprint vertex takes the matched feature's horizontal position only — its exact elevation is not threaded through (see **XY snapping** above).
447
+ Mapbox GL basemaps, depth-interleaved 3D compositing, globe projection, SSE transport, `dblclick` behaviors, the typed fluent builder, and stories/draw as React components (both work via the HTML manifest). On clustering: lines and polygons are not clustered by centroid (Point data only), tiled sources (`MVTLayer`/`TileLayer`) do not cluster, and a projected (`crs=`) sheet renders a clustered layer unclustered with a warning. On cartography: relief cannot be masked to land (clipping one layer to another's geometry is layer-extension work), `contour` marches in the DEM's Mercator grid even on a projected sheet (the polylines project exactly; the sampling is what is Mercator), and native-CRS tile pyramids are deferred until asked for. On React Native (`@nika-js/onlymap-native`): stories, draw, widgets, and overlays as native components (build native UI beside the map instead), and bare (non-Expo) React Native until its `0.2.0`. On `pick-features`: instanced (i3dm) tiles keep tile-granularity picking, and `feature-styles`' `opacity` below 1 is still being validated. On BIM: clash detection is bounding-box only (no mesh-level test, and it cannot tell a resolved penetration from a collision), there is no BCF export, no equivalent of Navisworks' Auto Reveal, and prepared tilesets converted before the `bbox*` columns existed cannot take part in a clash pass — `strength` tinting and `opacity: 0` (hide, a shader discard) work. On the measure widget's `volume` mode: the per-cell grid integration measures against the map's active terrain DEM only — measuring against an imported design surface or a previous survey (period-over-period reconciliation) and a cut/fill heat-map overlay are not implemented yet, and a snapped footprint vertex takes the matched feature's horizontal position only — its exact elevation is not threaded through (see **XY snapping** above).
436
448
 
437
449
  ## Going deeper
438
450
 
@@ -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-DPEWcZeV.js";
2
- import { a as ty } from "./globe-view-C3Gaf--d.js";
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-C-YAnesV.js";
2
+ import { a as ty } from "./globe-view-CTkofOiM.js";
3
3
  var Ou = { exports: {} };
4
4
  /**
5
5
  * MapLibre GL JS
@@ -21,6 +21,15 @@ export declare abstract class CartographElementBase extends HTMLElementBase {
21
21
  protected scheduleRender(): void;
22
22
  /** One coalesced render per microtask — subclasses re-read their attributes here. */
23
23
  protected abstract renderNow(): void;
24
+ /**
25
+ * Apply an authored colour or font override to the theme property the
26
+ * element's styling reads. Written as the custom property itself — on this
27
+ * element, so it scopes to it — which is what lets one attribute reach the
28
+ * SVG the element draws, its computed style, and so the canvas exporter,
29
+ * which reads computed colour and keeps no second theme table. `alsoColor`
30
+ * writes the element's own `color` too, for painters that read that.
31
+ */
32
+ protected applyThemeOverride(attr: string, property: string, alsoColor?: boolean): void;
24
33
  /** Write the placed-element inline styles from the mm placement attributes. */
25
34
  protected applyPlacement(): void;
26
35
  }
@@ -6,6 +6,10 @@ export declare class OmLegendElement extends CartographElementBase implements Ca
6
6
  get derived(): boolean;
7
7
  /** The rows this legend currently shows — recomputed on demand, never stored. */
8
8
  get rows(): LegendRow[];
9
+ /** Inner padding in mm — authored, else the 2 mm the theme always used. */
10
+ private get paddingMm();
11
+ /** Row text size in mm — `font-size` is authored in points, like <om-text>. */
12
+ private get fontMm();
9
13
  protected renderNow(): void;
10
14
  private renderRows;
11
15
  private buildRow;