@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.
- package/CHANGELOG.md +25 -0
- package/README.md +14 -2
- package/dist/{basemap-BH76eQA0.js → basemap-CHFwxaRT.js} +2 -2
- package/dist/cluster-index.d.ts +77 -0
- package/dist/cluster-options.d.ts +95 -0
- package/dist/cluster-thumbs.d.ts +68 -0
- package/dist/ctx.d.ts +2 -0
- package/dist/elements/om-map.d.ts +6 -0
- package/dist/{geoparquet-DzKLe-0r.js → geoparquet-DBzSJJz_.js} +1 -1
- package/dist/{globe-view-B-prUQFh.js → globe-view-D0eDmIGO.js} +1 -1
- package/dist/{hillshade-CDng2Jsi.js → hillshade-DodGS9DL.js} +1 -1
- package/dist/html-data.d.ts +1 -1
- package/dist/{index-D86S8KJ1.js → index-5iFHs_bW.js} +1 -1
- package/dist/{index-Rvd-zFrS.js → index-BGvTOkkE.js} +1 -1
- package/dist/{index-CpLydTmE.js → index-C7Tpf_BA.js} +1 -1
- package/dist/{index-DOfIeNux.js → index-Ca5y3OLs.js} +1 -1
- package/dist/{index-cwieLGSg.js → index-CrnprTab.js} +1 -1
- package/dist/{index-DvEcTZ4i.js → index-D04CeeYu.js} +17702 -16467
- package/dist/{index-CIo8LgRZ.js → index-DH1_IQmW.js} +3 -3
- package/dist/{index-laD2SEAB.js → index-em-_HmNV.js} +3 -3
- package/dist/{index-8Fj-yh7f.js → index-wRR0a71N.js} +2 -2
- package/dist/ir-snapshot.d.ts +10 -0
- package/dist/ir.d.ts +9 -0
- package/dist/layer-registry.d.ts +8 -0
- package/dist/layers/cluster-layer.d.ts +136 -0
- package/dist/{lerc-BJB4-X6n.js → lerc-KZgSVKKQ.js} +1 -1
- package/dist/onlymap.standalone.js +36288 -35053
- package/dist/onlymapjs.js +1 -1
- package/dist/{post-process-effect-Bd5plkno.js → post-process-effect-eJXo3MSl.js} +1 -1
- package/dist/programmatic.d.ts +6 -0
- package/dist/{raster-DJ6vvro6.js → raster-CHuauCiR.js} +3 -3
- package/dist/{raster-pipeline-BQhNhrPq.js → raster-pipeline-Coou2lF-.js} +1 -1
- package/dist/runtime-core.d.ts +24 -0
- package/dist/{text-on-path-CrqchF3O.js → text-on-path-DUfdTGzX.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-oAkG7ZLM.js → zarr-BYLzFMeQ.js} +2 -2
- package/docs/cartograph.md +2 -2
- package/llms.txt +3 -2
- package/onlymapjs.attributes.json +42 -0
- package/onlymapjs.html-data.json +80 -0
- package/package.json +7 -3
- package/skills/onlymapjs/SKILL.md +3 -2
- package/skills/onlymapjs/references/react.md +1 -0
- package/skills/onlymapjs/references/syntax.md +50 -2
- package/docs/design/arrows.md +0 -182
- package/docs/design/carto-substrate.md +0 -1067
- package/docs/design/cog-v2.md +0 -223
- package/docs/design/extensions.md +0 -250
- package/docs/design/frame-sources.md +0 -229
- package/docs/design/hillshade.md +0 -290
- package/docs/design/paced-flyby.md +0 -42
- package/docs/design/trace-link-failure.md +0 -20
package/dist/onlymapjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bP as e, bQ as r, bR as t, as as c, C as o, bS as i, c as n, bT as d, bU as l, bV as S, bW as E, ah as g, bX as L, bY as T, bZ as _, b_ as A, b$ as p, c0 as m, c1 as I, c2 as D, L as M, g as u, c3 as b, c4 as y, c5 as f, c6 as O, c7 as P, bE as R, c8 as C, ap as N, c9 as F, aB as h, ca as B, W as v, cb as x, aA as G, cc as U, cd as W, ce as w, cf as Y, cg as k, ch as X, ci as H, cj as K, ck as V, cl as j, cm as z, cn as J, co as q, cp as Q, cq as Z, cr as $, ak as aa, cs as sa, ct as ea, cu as ra, cv as ta, cw as ca, cx as oa, cy as ia, cz as na, cA as da, cB as la, cC as Sa, cD as Ea, aq as ga, cE as La, cF as Ta, ae as _a, cG as Aa, cH as pa, cI as ma, cJ as Ia, cK as Da, cL as Ma, cM as ua, cN as ba, cO as ya, cP as fa, cQ as Oa, cR as Pa, cS as Ra, cT as Ca, cU as Na, cV as Fa, cW as ha, cX as Ba, cY as va, cZ as xa, c_ as Ga, c$ as Ua, d0 as Wa, d1 as wa, d2 as Ya, d3 as ka, d4 as Xa, d5 as Ha, d6 as Ka, aC as Va, d7 as ja, d8 as za, d9 as Ja, da as qa, db as Qa, dc as Za, dd as $a, de as as, df as ss, dg as es, dh as rs, di as ts, dj as cs, dk as os, dl as is, dm as ns, dn as ds } from "./index-
|
|
1
|
+
import { bP as e, bQ as r, bR as t, as as c, C as o, bS as i, c as n, bT as d, bU as l, bV as S, bW as E, ah as g, bX as L, bY as T, bZ as _, b_ as A, b$ as p, c0 as m, c1 as I, c2 as D, L as M, g as u, c3 as b, c4 as y, c5 as f, c6 as O, c7 as P, bE as R, c8 as C, ap as N, c9 as F, aB as h, ca as B, W as v, cb as x, aA as G, cc as U, cd as W, ce as w, cf as Y, cg as k, ch as X, ci as H, cj as K, ck as V, cl as j, cm as z, cn as J, co as q, cp as Q, cq as Z, cr as $, ak as aa, cs as sa, ct as ea, cu as ra, cv as ta, cw as ca, cx as oa, cy as ia, cz as na, cA as da, cB as la, cC as Sa, cD as Ea, aq as ga, cE as La, cF as Ta, ae as _a, cG as Aa, cH as pa, cI as ma, cJ as Ia, cK as Da, cL as Ma, cM as ua, cN as ba, cO as ya, cP as fa, cQ as Oa, cR as Pa, cS as Ra, cT as Ca, cU as Na, cV as Fa, cW as ha, cX as Ba, cY as va, cZ as xa, c_ as Ga, c$ as Ua, d0 as Wa, d1 as wa, d2 as Ya, d3 as ka, d4 as Xa, d5 as Ha, d6 as Ka, aC as Va, d7 as ja, d8 as za, d9 as Ja, da as qa, db as Qa, dc as Za, dd as $a, de as as, df as ss, dg as es, dh as rs, di as ts, dj as cs, dk as os, dl as is, dm as ns, dn as ds } from "./index-D04CeeYu.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ALL_POSITION_VALUES,
|
|
4
4
|
r as AUDIT_EXEMPTIONS,
|
package/dist/programmatic.d.ts
CHANGED
|
@@ -227,6 +227,12 @@ export declare class MapController {
|
|
|
227
227
|
setLayers(descriptors: readonly LayerDescriptor[]): void;
|
|
228
228
|
/** A snapshot of the current layer IRs — the same shape ctx.layers is built from. */
|
|
229
229
|
getLayers(): readonly LayerIR[];
|
|
230
|
+
/**
|
|
231
|
+
* The rows inside a cluster bubble on a `cluster` layer (docs/design/clustering.md),
|
|
232
|
+
* flattened like a pick's object. `clusterId` is the `cluster_id` a bubble pick
|
|
233
|
+
* carries. Empty when the layer is not clustered right now.
|
|
234
|
+
*/
|
|
235
|
+
clusterLeaves(layerId: string, clusterId: number, limit?: number, offset?: number): unknown[];
|
|
230
236
|
private scheduleCommit;
|
|
231
237
|
private commit;
|
|
232
238
|
private checkReady;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as se, t as $e, i as Ct, a as ke, s as Lt, C as It, b as Gt, F as vt, A as Et, d as Ft, R as ye, e as At, p as jt, m as Rt, f as Mt, g as We, h as Ut, r as le, j as Ot, k as xt, l as Kt, n as Dt } from "./raster-pipeline-
|
|
1
|
+
import { c as se, t as $e, i as Ct, a as ke, s as Lt, C as It, b as Gt, F as vt, A as Et, d as Ft, R as ye, e as At, p as jt, m as Rt, f as Mt, g as We, h as Ut, r as le, j as Ot, k as xt, l as Kt, n as Dt } from "./raster-pipeline-Coou2lF-.js";
|
|
2
2
|
import { N as Nt, c as zt } from "./hillshade-apron-Bem3DWyJ.js";
|
|
3
3
|
import { r as Bt } from "./hillshade-shader-DI2uLSNU.js";
|
|
4
|
-
import { bK as _t, bL as $t } from "./index-
|
|
4
|
+
import { bK as _t, bL as $t } from "./index-D04CeeYu.js";
|
|
5
5
|
import we from "./index-CW1n5LdO.js";
|
|
6
6
|
function kt(e, t) {
|
|
7
7
|
const n = e.length / 3, r = new Uint8ClampedArray(n * 4), o = 0, i = n, a = n * 2;
|
|
@@ -1072,7 +1072,7 @@ j.set(f.Zstd, () => import("./zstd-jXobGRcq.js").then((e) => e.decode));
|
|
|
1072
1072
|
j.set(f.Jpeg, () => Promise.resolve(ce));
|
|
1073
1073
|
j.set(f.Jpeg6, () => Promise.resolve(ce));
|
|
1074
1074
|
j.set(f.Webp, () => Promise.resolve(ce));
|
|
1075
|
-
j.set(f.Lerc, () => import("./lerc-
|
|
1075
|
+
j.set(f.Lerc, () => import("./lerc-KZgSVKKQ.js").then((e) => e.decode));
|
|
1076
1076
|
async function ue(e, t, n) {
|
|
1077
1077
|
const r = j.get(t);
|
|
1078
1078
|
if (!r)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { w as he } from "./mgrs-BY9bIvp4.js";
|
|
2
|
-
import { a3 as de, bD as fe, bE as re, c as oe, bF as me, G as pe, bG as ge, aK as Z, bH as ve, N as be, bI as xe, bJ as Pe, al as Te, ap as ie } from "./index-
|
|
2
|
+
import { a3 as de, bD as fe, bE as re, c as oe, bF as me, G as pe, bG as ge, aK as Z, bH as ve, N as be, bI as xe, bJ as Pe, al as Te, ap as ie } from "./index-D04CeeYu.js";
|
|
3
3
|
import { p as ye, a as Le, h as we } from "./hillshade-shader-DI2uLSNU.js";
|
|
4
4
|
function Oe(n, e, t) {
|
|
5
5
|
const { projectedCorners: s } = e, { topLeft: r, topRight: o, bottomRight: i, bottomLeft: a } = s, c = t(r[0], r[1]), u = t(o[0], o[1]), l = t(i[0], i[1]), d = t(a[0], a[1]), f = [
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -807,6 +807,30 @@ export declare class RuntimeCore {
|
|
|
807
807
|
* own) or on every pass.
|
|
808
808
|
*/
|
|
809
809
|
reconcile(irs: LayerIR[]): void;
|
|
810
|
+
/** Layer ids already told that clustering does not run on a plane — one warning each, not one per rebuild. */
|
|
811
|
+
private readonly clusterPlaneWarned;
|
|
812
|
+
/** How long click-to-expand eases (the `flyTo` default is 0 — an instant cut, which reads as a glitch on a bubble the reader just clicked). Reduced-motion users still get the instant move. */
|
|
813
|
+
static readonly CLUSTER_EXPAND_MS = 600;
|
|
814
|
+
/**
|
|
815
|
+
* The live ClusterLayer instance rendering an authored layer id, in either
|
|
816
|
+
* renderer mode. Deck re-instantiates layers per reconcile but carries the
|
|
817
|
+
* STATE (the index) across instances of one id, so the current instance is
|
|
818
|
+
* the one to ask. Undefined when the layer is not clustered right now.
|
|
819
|
+
*/
|
|
820
|
+
private liveClusterLayer;
|
|
821
|
+
/** The zoom at which a cluster splits — what click-to-expand and `expand-cluster` fly to. */
|
|
822
|
+
clusterExpansion(layerId: string, clusterId: number): number | undefined;
|
|
823
|
+
/** The rows inside a cluster, flattened the way a pick's object is (GeoJSON properties lifted, columnar rows materialised). */
|
|
824
|
+
clusterLeaves(layerId: string, clusterId: number, limit?: number, offset?: number): unknown[];
|
|
825
|
+
/** D5: a click selection that landed on a bubble flies to the cluster's expansion zoom, unless `cluster-click="none"`. */
|
|
826
|
+
private expandClusterOnClick;
|
|
827
|
+
/**
|
|
828
|
+
* Wrap a fully built prop bag in a ClusterLayer: the host class draws the
|
|
829
|
+
* leaves from those props verbatim, the cluster options ride beside them.
|
|
830
|
+
* `id`/`data`/`updateTriggers` stay the composite's own so picking resolves
|
|
831
|
+
* to the authored layer id and deck's data diffing sees the real rows.
|
|
832
|
+
*/
|
|
833
|
+
private buildClusterLayer;
|
|
810
834
|
private buildLayers;
|
|
811
835
|
/** Fingerprint of every zoom-gated layer's in/out state at the current zoom — "" when no layer authors a range (the overwhelmingly common case, so refreshZoomGates is two property reads per camera move). */
|
|
812
836
|
private computeZoomGateKey;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ur, d as lr, R as zt, e as fr, m as dr, p as St, f as hr, k as pr, l as mr } from "./raster-pipeline-
|
|
2
|
-
import { c as gr } from "./index-
|
|
1
|
+
import { A as ur, d as lr, R as zt, e as fr, m as dr, p as St, f as hr, k as pr, l as mr } from "./raster-pipeline-Coou2lF-.js";
|
|
2
|
+
import { c as gr } from "./index-D04CeeYu.js";
|
|
3
3
|
import $t from "./index-CW1n5LdO.js";
|
|
4
4
|
var Et;
|
|
5
5
|
function h(e, t, n) {
|
package/docs/cartograph.md
CHANGED
|
@@ -22,8 +22,8 @@ to PDF at true page size via CSS `@page` and exports PNG/JPEG at print DPI throu
|
|
|
22
22
|
<html>
|
|
23
23
|
<head>
|
|
24
24
|
<meta charset="utf-8">
|
|
25
|
-
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.
|
|
26
|
-
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.
|
|
25
|
+
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.11.1/dist/cartograph.standalone.js"></script>
|
|
26
|
+
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.11.1/dist/cartograph.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<om-cartograph cartograph-id="cg-lot-12" format="cartograph/2" size="A4" theme="minimal"
|
package/llms.txt
CHANGED
|
@@ -41,8 +41,8 @@ Programmatic/native bridge rule: `MapController.setLayers()` accepts normal func
|
|
|
41
41
|
- Chunked N-dimensional Zarr / GeoZarr rasters (climate/weather grids, datacubes) are the library-owned `ZarrLayer` type (built on `@developmentseed/deck.gl-zarr` + zarrita, a lazy chunk): `<om-layer type="ZarrLayer" src="./x.zarr" variable="temp" select="time=0" colormap="viridis" min="…" max="…">`. `src` not `data` (chunks stream through the layer's reader, never parsed rows). Pick the `variable` and pin EVERY non-spatial dimension in `select` ("init_time=0, lead_time=0, ensemble_member=0"); the two spatial dims are handled for you (a 2-D array needs no select). A GeoZarr-compliant store georeferences itself; a plain Zarr needs manual `bounds="[w,s,e,n]"` + `crs="EPSG:4326"` + `spatial-dims="<yName> <xName>"` (bounds without crs+spatial-dims is a validation error). `min`/`max`/`colormap`/`nodata` and the auto legend reuse the exact COGLayer raster pipeline. Beware store chunking: a dataset chunked coarsely over non-spatial dims (e.g. all forecast steps in one chunk) decodes far more than the pinned frame needs. `src` may be any absolute URL (`https://…/store.zarr`) — an external/remote store works with no server setup (a static host serves Zarr's extensionless chunk keys natively), but zarrita fetches it directly from the browser so the store MUST send CORS headers (`Access-Control-Allow-Origin`), and it must be PUBLIC — authenticated stores are not yet supported (ZarrLayer uses zarrita's own fetch, not `OmMap.configureData`).
|
|
42
42
|
- `<om-widget type="legend|layer-switcher|basemap-switcher|lighting|clip-box|zoom-controls|undo-redo|scale-bar|attribution|filter|vega-lite|dynamic-chart|measure" position="bottom-end">` — static UI panels. `position` takes one of 8 managed slots (logical, RTL-aware: `top-start|top-center|top-end|center-start|center-end|bottom-start|bottom-center|bottom-end`; legacy corners `top-left` etc. alias) — same-slot widgets stack with flush edges and a shared gap (never overlap); provider attribution joins `bottom-end` and the license badge joins `bottom-start` as in-flow members, so required chrome never covers a widget; `order="1"` orders within a slot; adjacent compact button widgets (zoom-controls, undo-redo, widgets-toggle) auto-merge into ONE control group with dividers (`cluster="false"` opts a widget out); `position="manual"` renders a plain block you place with your own CSS (even outside the map). At narrow map widths managed widgets auto-fold into one accessible drawer per map side — at ≤640px when some row (top/center/bottom) has widgets on more than one of its slots, and only at ≤416px when every occupied row is one-sided (a lone legend at center-start keeps the row to itself and survives narrower maps); `fold="never"` exempts an essential widget, `widgets-fold="off"` opts the map out, `--om-widget-fold-breakpoint` changes the threshold. Layout tokens on `<om-map>`: `widget-style="gap:10 opacity:0.9 inset:16"` (keys inset/gap/inset-x/-y/gap-x/-y/opacity/radius/size, px except opacity) or the `--om-widget-inset-x/-y/-gap-x/-gap-y/-opacity/-radius/-fold-breakpoint` custom properties. Built-ins are themeable from page CSS via custom properties (they inherit through the shadow root): `om-map { --om-widget-bg: #111827; --om-widget-fg: #f9fafb; }` — full set: `--om-widget-bg/-fg/-muted/-border/-hover-bg/-accent`; scope to a single widget with an `om-widget[type=legend]` selector instead. `measure` is a geodesic ruler: `modes="distance area volume"` (default `distance area`), `units="metric|imperial|nautical"` — click the map to place points, live per-segment + total labels render on the map, and it dispatches an `om-measure` event; it reuses the draw capture stack (measure/draw mutually exclusive) and its geometry is ephemeral (never saved, not an undo step) — see the dedicated `measure`/`volume` bullet above for the full event shape and the `profile`/`density`/`swell`/`shrink`/`deadband` volume-mode attributes. `scale-bar` now takes the same `units`. `dynamic-chart` is the same Vega-Lite rendering as `vega-lite` but fed by a live DOM event instead of a layer: `on="<event-name>"` (required) + `series-field="<name>"` (default `series`) reads `event.detail[seriesField]` as `data.values` and re-embeds on every event where it's a present array, at a fixed `width`; omitting the field on a later event freezes the chart with no separate pause API — built for a feature (a drawn line's elevation profile) that computes its own series live and has no layer to bind to. No `type` + HTML + `<script type="om/widget">` = custom widget with `ctx` (`ctx.layers`, `ctx.data(id)`, `ctx.dataInViewport(id)`, `ctx.stats(id, field)`, `ctx.viewport`, `ctx.selection`, `ctx.emit(action, payload)`), `this.watch = ['data:<layerId>', 'viewport', 'selection', 'layers', 'history', 'basemap']` (`layers` also fires on visibility/filter changes; `basemap` on basemap switches; `history` on undo/redo availability), `this.$(sel)`, `vegaEmbed`/`d3` as globals.
|
|
43
43
|
- Custom-widget event emission (the #1 custom-widget bug — a widget that renders but does nothing): a widget DRIVES the map ONLY by EMITTING a registered action; it never mutates the map or dispatches its own `CustomEvent`. Two ways: (1) declarative `data-emit="<action>"` + `data-*` payload keys on an element (fires on click, or change for form controls whose `.value` is auto-added; `data-*` values are STRINGS — use `ctx.emit` for numeric/array payloads like a slider's range); (2) `ctx.emit(action, payload)` for typed payloads, wired INSIDE `render` (so `ctx` is in scope) by assigning `.oninput`/`.onclick` — e.g. a day slider: `this.render = (ctx) => { this.$("#day").oninput = e => ctx.emit("filter-layer", { layer: "quakes", field: "day", range: [+e.target.value, +e.target.value] }); }`. Actions + payloads: `filter-layer {layer, field?, range:[min,max]}`, `toggle-layer {layer, visible?}`, `fly-to {center:[lng,lat], zoom?, duration?}`, `zoom-to-feature {layer, featureId}`, `set-basemap {basemap}`, `highlight-feature {layer, featureId}`, `show-overlay`/`hide-overlay {target}`, `story-play`/`story-pause`/`story-seek {story, t?}`, `undo`/`redo`, `zoom-in`/`zoom-out`, `set-widgets-visible {visible}`; register more with `OmMap.registerAction(name, handler)`. NEVER inline `onclick=`/`oninput=` — `ctx` isn't a global and CSP blocks them, so it silently fires nothing (validation errors on it). For a plain value/time slider prefer the built-in `<om-widget type="filter" layer=… field=…>` — it wires `filter-layer` for you; hand-author only for bespoke UI.
|
|
44
|
-
- `<om-overlay id="..." anchor-from="selection">` — rich geo-anchored HTML (≤ ~20 per map). Anchors: `anchor="[lng, lat]"` (static), `anchor-from="selection"` (follows picks), or `anchor-layer="regions" anchor-feature-id="mission"` (anchored to a feature's own geometry — bbox center — no coordinates in markup; `{{field}}` interpolates that feature's attributes). Selection-anchored overlays scope with `layer="…"` (one layer's picks only) and `selection-type="click"|"hover"` (one pick type only) — a click-opened popup should ALWAYS set `selection-type="click"`, else merely hovering any pickable feature drags it there and re-templates it against the hovered object; with it, hover is inert and a click on empty space still dismisses. `{{field}}` interpolates the picked feature HTML-escaped; `{{{field}}}` is raw (avoid); `{{z}}` is the pick's ELEVATION in meters, present only when a `pickable="3d"` layer ran deck's depth pass for that pick (absent — not `0` — otherwise, so "no elevation" is distinguishable from sea level). `clip-to-map` (opt-in) hides the overlay when its own BOX would spill past the map viewport rather than only when its anchor leaves — for small transient tips that track the cursor; an overhanging absolutely-positioned box inflates the page's scrollable overflow and the scrollbar -> map resize -> reprojection loop shows as view jitter. For labels on many features use `PopupLayer`, not overlays. STYLING: overlay content renders inside a shadow root (style isolation, like widgets) — page stylesheets/classes do NOT reach it; use inline `style="…"` on the content or a `<style>` element INSIDE the overlay (children move into the shadow root wholesale, so it applies there); inheritable props + CSS custom properties pierce.
|
|
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.
|
|
44
|
+
- `<om-overlay id="..." anchor-from="selection">` — rich geo-anchored HTML (≤ ~20 per map). Anchors: `anchor="[lng, lat]"` (static), `anchor-from="selection"` (follows picks), or `anchor-layer="regions" anchor-feature-id="mission"` (anchored to a feature's own geometry — bbox center — no coordinates in markup; `{{field}}` interpolates that feature's attributes). Selection-anchored overlays scope with `layer="…"` (one layer's picks only) and `selection-type="click"|"hover"` (one pick type only) — a click-opened popup should ALWAYS set `selection-type="click"`, else merely hovering any pickable feature drags it there and re-templates it against the hovered object; with it, hover is inert and a click on empty space still dismisses. `{{field}}` interpolates the picked feature HTML-escaped; `{{{field}}}` is raw (avoid); `{{z}}` is the pick's ELEVATION in meters, present only when a `pickable="3d"` layer ran deck's depth pass for that pick (absent — not `0` — otherwise, so "no elevation" is distinguishable from sea level). `clip-to-map` (opt-in) hides the overlay when its own BOX would spill past the map viewport rather than only when its anchor leaves — for small transient tips that track the cursor; an overhanging absolutely-positioned box inflates the page's scrollable overflow and the scrollbar -> map resize -> reprojection loop shows as view jitter. For labels on many features use `PopupLayer`, not overlays. STYLING: overlay content renders inside a shadow root (style isolation, like widgets) — page stylesheets/classes do NOT reach it; use inline `style="…"` on the content or a `<style>` element INSIDE the overlay (children move into the shadow root wholesale, so it applies there); inheritable props + CSS custom properties pierce. A card with an image or link (`<img src="{{photo}}">`) goes inside a `<template>` child (`<om-overlay …><template>…</template></om-overlay>`, 0.11.1): inert at parse, so the literal `{{photo}}` is never requested; tokens stay blank until a pick fills them.
|
|
45
|
+
- `<om-behavior on="click|hover|drag|load|data-loaded" layer="..." action="...">` — declarative interaction (`pick="point"|"cluster"` narrows it to standalone points or count bubbles on a `cluster="true"` layer). Built-in actions: `show-overlay`, `hide-overlay`, `show-tooltip`, `hide-tooltip`, `toggle-layer`, `set-layer-attribute` (`{layer, name, value}` — write ANY layer attribute at runtime by its kebab-case name, `value: null` removes; the generic on/off switch for a widget button, e.g. `name: "cluster"`), `expand-cluster` (`{feature, layer}` or `{layer, clusterId}` — fly to where a bubble splits), `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
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. Look: `theme=` (default|dark|sepia|blueprint|minimal) on the page, overridden per attribute — the page's `bg`/`color`/`font`, a legend's `bg`/`color`/`stroke`/`font-size`(pt)/`padding`(mm), `color` on scale bar, north and graticule, `color`/`bg` on text, `fill`/`stroke` on shapes; there is no `background=`/`border=`/`padding=` elsewhere. `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; frames follow with `atlas-fit="feature"`, and `atlas-margin` is a FRACTION of the feature's extent (default 0.15, useful range 0.1–0.3) — the one spatial number here that is NOT millimetres; `atlas-margin="10"` pads each side by ten feature-widths and shows every page as a speck. A reader pages an atlas with the arrow keys / PageUp / PageDown / Home / End, or the on-sheet pager (`‹ 3 / 49 · name ›`, screen-only — never printed or exported; `pager="none"` on `<om-atlas>` removes it); a host embedding the sheet cross-origin gets `{source:"onlymap-cartograph", type:"atlas-page", index, count, name}` posted to its window and can post `{source:"onlymap-cartograph-host", type:"atlas-seek", index}` back. 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 ON THE SHEET — suppressed by any authored `om-text` crediting OnlyMap, or by a paid key on a live frame's map. A map inside a frame carries NO badge of its own (the sheet credits the page once), so a sheet with several live frames still shows one credit. Deep reference: docs/cartograph.md.
|
|
@@ -55,6 +55,7 @@ Programmatic/native bridge rule: `MapController.setLayers()` accepts normal func
|
|
|
55
55
|
- `<om-story id="tour" autoplay loop interrupt="pause|ignore">` — a storyboard of `<om-step>` children. Each step: `action="..."` + payload attributes (same kebab-case rule as behaviors) + `duration`/`delay`/`parallel` timing. Steps REFERENCE layers/overlays by id (`layer=`/`target=`) — a step must NEVER contain elements (validation error). Control: `<om-widget type="player" story="tour">`, the story-play/story-pause/story-seek actions, or `storyEl.play()/pause()/seek(ms)`. Seeking restores initial state then applies steps before T; use declarative payloads (e.g. `action="toggle-layer" visible="true"`, not bare toggles) so scrubbing is deterministic. Scene actions are story-steppable AND scrub-capturable: `set-basemap`, `set-lighting` (a sunset story: steps walking sun-elevation down; a bare preset step is a clean reset), and `set-terrain` all rewind on seek — the story captures the map's scene attributes before first play. Effect verbs as bare step attributes: `<om-step fade layer="regions" duration="1s">` (opacity reveal — start the layer at `opacity="0"`), `pulse` (attention flash), `trace` (progressive draw — whole-layer needs a TripsLayer; add `feature-id="..."` to make ONE polygon/line draw itself on inside any layer, or use it from a click behavior for click-to-trace), `populate` (rows drop in one by one — ordered by the authored filter-field, a payload `field`, or data order).
|
|
56
56
|
- Hover picking & the pointer cursor: hovering a pickable feature shows `cursor: pointer` automatically (the is-this-interactive affordance; `pick-cursor` on `<om-map>` overrides the cursor value, `pick-cursor="none"` disables). Hover GPU picks are REST-DEBOUNCED by default — one pick when the pointer stops moving, none while it sweeps — which eliminates the per-mousemove GPU ReadPixels stall that made hover popups freeze integrated-graphics machines (measured ~1.1s of main-thread stall per move on real layers). `hover-pick` on `<om-map>` tunes it: `"rest"` (default), `"continuous"` (deck-native per-frame — for hover-follow UIs on capable hardware), `"off"` (click picking only), or a throttle interval in ms (leading + trailing). Click picking is never gated.
|
|
57
57
|
- Zoom visibility: `visible-zoom-range="[8, 14]"` on ANY layer type — scale-dependent visibility (hidden outside min ≤ zoom < max, the minzoom/maxzoom convention; the tile-only visible-min-zoom/visible-max-zoom deck props remain tile-layer-specific). Composes with `visible`; a zoom-hidden layer stays in the legend/switcher/ctx. For CI that emits om-layer markup, validate attributes per layer type against the shipped `onlymapjs.attributes.json` (generated from the same registry the runtime checks — `universal` + `layers[<type>]`), not the flat per-tag union in the IntelliSense html-data file. Also: a layer whose REQUIRED position accessor resolves undefined for every row (e.g. a TextLayer fed GeoJSON with no get-position) now warns at runtime with the exact fix (`get-position="$geometry.coordinates"`) instead of silently drawing nothing.
|
|
58
|
+
- Clustering: `cluster="true"` on a `ScatterplotLayer`, `GeoJsonLayer` (Point features) or `IconLayer` merges points that would overlap into count bubbles that split as the reader zooms in — a toggle, NOT a separate layer type; the layer keeps its id, data, its own `get-*` symbology for standalone points, picks and actions. Options use MapLibre's names: `cluster-radius` (px, 50), `cluster-max-zoom` (16), `cluster-min-points` (2). `cluster-properties="sum:f,max:f,mean:f,mode:f,first:f"` puts `$sum_f`/`$mode_f`/`$first_f`… on every bubble beside `$count` (`first` = the earliest member's value in data order, any type); style bubbles with `get-cluster-radius` / `get-cluster-fill-color` / `get-cluster-line-color` / `get-cluster-label`, and put an IMAGE on a bubble with `get-cluster-icon="$first_photo"` — a URL draws as a circular thumbnail ringed in the bubble's fill (needs CORS; a loading or failed image leaves the circle), a name draws a glyph from `cluster-icon-atlas`/`cluster-icon-mapping`. Every bubble also carries `$count_max` and `$<agg>_max` (the largest at the CURRENT zoom) — divide by them so a ramp stays meaningful at every zoom; the default radius is `scale($count / $count_max, sqrt, [12, 36], domain=[0, 1])`. A click on a bubble flies (eased) to where it splits (`cluster-click="none"` opts out; action `expand-cluster`); bubble picks carry `cluster: true`, `count`, `cluster_id` and the aggregates into overlays — give bubbles and points separate behaviors with `pick="cluster"` / `pick="point"` (a template cannot branch, so one shared card would open half-empty for bubbles); `map.clusterLeaves(layerId, clusterId)` lists the rows inside; `ctx.layers[i].cluster` says whether the toggle is on, and `set-layer-attribute {layer, name: "cluster", value}` flips it from a widget. Point data only (lines/polygons refuse with a structured error); not on projected (`crs=`) sheets. Bubbles far out and icons close in = two layers over the same file with complementary `visible-zoom-range`s (`[0, 12]` clustered with `cluster-max-zoom="11"`, an `IconLayer` on `[12, 24]`).
|
|
58
59
|
- Filtering: `filter-field="magnitude" filter-range="[4, 10]"` on a layer (GPU-side, live-updatable via the `filter-layer` action); pair with `<om-widget type="filter" layer="..." field="...">`. For an epoch-millisecond field, make the slider labels readable with `<om-widget type="filter" layer="quakes" field="time" format="date" date-style="datetime" time-zone="UTC"></om-widget>`. Up to 4 numeric dimensions at once via `filter-fields='[{"field":"magnitude","range":[4,10]},{"field":"time","range":[…]}]'` (JSON array, additive to filter-field/filter-range — wins if both are authored) — one `<om-widget type="filter">` per field, each moves its own dimension independently (filter-layer merges the range onto the matching field rather than replacing the whole filter); a row must pass every active dimension (AND). A dimension can't be added live — the full set is declared up front in filter-fields. Categorical filtering is a SEPARATE mechanism (deck.gl's own discrete keep-list test, not a range) with its own attributes: `filter-category="fuel" filter-categories='["Coal","Gas"]'` (single) or `filter-category-fields='[{"field":"fuel","categories":[...]},...]'` (up to 4); the SAME `<om-widget type="filter">` auto-renders checkboxes instead of a slider when its `field` is declared categorically (mode is inferred from the layer's own filter, never a separate widget attribute) — one checkbox per distinct value present in the data, with its row count. A category dimension with no keep-list is dropped from the active filter (there is no "matches everything" category the way a numeric range has [-Infinity, Infinity]). Numeric and categorical filters on the same layer combine — a row must pass both. `ctx.stats`/`ctx.dataInViewport` respect whichever kind(s) are active by default (`{filtered:false}` opts out). CLASSIFIED SYMBOLOGY: `classify-by="<numeric field>"` (+ `classify-scale="quantile|equal-interval|jenks"`, `classify-classes="2-12"` default 5, `classify-ramp="viridis|plasma|inferno|magma|cividis|turbo|blues|greens|oranges|purples|reds|ylorrd|rdbu|spectral"`) computes class breaks FROM THE DATA at reconcile time, installs the fill-color accessor and the auto classes legend — use it when the user asks for graduated/choropleth styling WITHOUT hand-authoring domains; an authored get-fill-color/color always wins (validation warns on the conflict); URL-backed layers classify when their data arrives. TEMPORAL PLAYBACK: `<om-widget type="time-slider" layer="…" field="<numeric/epoch-ms field>" duration="20s" window="<span in field units>" loop format="date" date-style time-zone>` — play/pause/scrub emitting the ordinary filter-layer action (cumulative from the domain start, or a sliding window with `window`); manifest stays the source of truth so undo/story/external filter edits re-sync the thumb — prefer it over hand-rolling a playback loop.
|
|
59
60
|
- Routing & tracking are two library-owned layer types (not `PathLayer`/`IconLayer` hand-wired) that expand into ordinary `PathLayer`/`IconLayer` instances internally, same pattern as `BIMLayer`→`Tile3DLayer`. `<om-layer type="Route" geometry='{"type":"LineString","coordinates":[[lng,lat],...]}'>` draws a styled route (casing + line + origin/destination pins) from geometry you already have — resolves SYNCHRONOUSLY, no network. `<om-layer type="Route" origin="[lng,lat]" destination="[lng,lat]" provider="nika" profile="driving">` (+ optional `waypoints`) resolves one ASYNCHRONOUSLY via a `RoutingProvider` named by `provider` — `"nika"` is registered by default but its endpoint is an UNVERIFIED PLACEHOLDER until NIKA's real routing service ships (register a working one with `OmMap.registerRoutingProvider(name, provider)` — a ~15-line adapter over OSRM's keyless public demo server (`router.project-osrm.org/route/v1/{profile}/{lng},{lat};{lng},{lat}?geometries=geojson&overview=full`, map `distance`/`duration`/`legs` onto `distanceMeters`/`durationSec`/`legs[]`) is the verified keyless real-data recipe; the skill's syntax.md carries it in full). `geometry` wins outright if both are authored (validation warns). `color`/`casing-color` style the line; `follow="fit-route"` auto-fits the camera once resolved. `<om-layer type="Tracking" get-position="[$lng,$lat]">` renders ONE moving entity (v1 — a fleet is one `Tracking` layer per vehicle) with bearing-derived icon rotation; position data arrives through the ORDINARY `data`/`source` mechanism, no separate tracking-subscription API. `bearing-field` (default `"bearing"`) names the plain field to rotate by (checks `properties.<field>` on GeoJSON rows, `<field>` directly on flat rows); `interpolate-ms` (default `1000`) glides the marker between two fixes via the per-frame channel instead of jumping; `follow="follow"` eases the camera along with it, same timing. `color`/`size` style the marker; `icon="arrow|car|motorcycle"` picks the shape (default arrow — all nose-up, baked in `color`, unknown names fall back with a validation warning). Tail modes: on the ROUTE layer, `progress-from="<tracking-layer-id>"` + `tail="none"` (client view — only current position → destination renders, origin pin dropped) or `tail="dim"` (operator view — traveled portion darkened; `tail-color` overrides) split the route at the marker's interpolated position per frame; default full ignores the split; validation warns on partial wiring.
|
|
60
61
|
|
|
@@ -320,6 +320,15 @@
|
|
|
320
320
|
"GeoJsonLayer": [
|
|
321
321
|
"auto-highlight",
|
|
322
322
|
"clip",
|
|
323
|
+
"cluster",
|
|
324
|
+
"cluster-click",
|
|
325
|
+
"cluster-icon-atlas",
|
|
326
|
+
"cluster-icon-mapping",
|
|
327
|
+
"cluster-label",
|
|
328
|
+
"cluster-max-zoom",
|
|
329
|
+
"cluster-min-points",
|
|
330
|
+
"cluster-properties",
|
|
331
|
+
"cluster-radius",
|
|
323
332
|
"color",
|
|
324
333
|
"color-format",
|
|
325
334
|
"coordinate-origin",
|
|
@@ -328,6 +337,11 @@
|
|
|
328
337
|
"extensions",
|
|
329
338
|
"extruded",
|
|
330
339
|
"filled",
|
|
340
|
+
"get-cluster-fill-color",
|
|
341
|
+
"get-cluster-icon",
|
|
342
|
+
"get-cluster-label",
|
|
343
|
+
"get-cluster-line-color",
|
|
344
|
+
"get-cluster-radius",
|
|
331
345
|
"get-elevation",
|
|
332
346
|
"get-fill-color",
|
|
333
347
|
"get-icon",
|
|
@@ -716,11 +730,25 @@
|
|
|
716
730
|
"auto-highlight",
|
|
717
731
|
"billboard",
|
|
718
732
|
"clip",
|
|
733
|
+
"cluster",
|
|
734
|
+
"cluster-click",
|
|
735
|
+
"cluster-icon-atlas",
|
|
736
|
+
"cluster-icon-mapping",
|
|
737
|
+
"cluster-label",
|
|
738
|
+
"cluster-max-zoom",
|
|
739
|
+
"cluster-min-points",
|
|
740
|
+
"cluster-properties",
|
|
741
|
+
"cluster-radius",
|
|
719
742
|
"color-format",
|
|
720
743
|
"coordinate-origin",
|
|
721
744
|
"coordinate-system",
|
|
722
745
|
"extensions",
|
|
723
746
|
"get-angle",
|
|
747
|
+
"get-cluster-fill-color",
|
|
748
|
+
"get-cluster-icon",
|
|
749
|
+
"get-cluster-label",
|
|
750
|
+
"get-cluster-line-color",
|
|
751
|
+
"get-cluster-radius",
|
|
724
752
|
"get-color",
|
|
725
753
|
"get-icon",
|
|
726
754
|
"get-pixel-offset",
|
|
@@ -1177,12 +1205,26 @@
|
|
|
1177
1205
|
"auto-highlight",
|
|
1178
1206
|
"billboard",
|
|
1179
1207
|
"clip",
|
|
1208
|
+
"cluster",
|
|
1209
|
+
"cluster-click",
|
|
1210
|
+
"cluster-icon-atlas",
|
|
1211
|
+
"cluster-icon-mapping",
|
|
1212
|
+
"cluster-label",
|
|
1213
|
+
"cluster-max-zoom",
|
|
1214
|
+
"cluster-min-points",
|
|
1215
|
+
"cluster-properties",
|
|
1216
|
+
"cluster-radius",
|
|
1180
1217
|
"color",
|
|
1181
1218
|
"color-format",
|
|
1182
1219
|
"coordinate-origin",
|
|
1183
1220
|
"coordinate-system",
|
|
1184
1221
|
"extensions",
|
|
1185
1222
|
"filled",
|
|
1223
|
+
"get-cluster-fill-color",
|
|
1224
|
+
"get-cluster-icon",
|
|
1225
|
+
"get-cluster-label",
|
|
1226
|
+
"get-cluster-line-color",
|
|
1227
|
+
"get-cluster-radius",
|
|
1186
1228
|
"get-fill-color",
|
|
1187
1229
|
"get-line-color",
|
|
1188
1230
|
"get-line-width",
|
package/onlymapjs.html-data.json
CHANGED
|
@@ -905,6 +905,62 @@
|
|
|
905
905
|
"name": "get-pixel-offset",
|
|
906
906
|
"description": "Accessor for deck.gl getPixelOffset — expression language: $field, scale(), formatDate(), arithmetic. Valid on: IconLayer, ScatterplotLayer, TextLayer."
|
|
907
907
|
},
|
|
908
|
+
{
|
|
909
|
+
"name": "cluster",
|
|
910
|
+
"description": "Set \"true\" to merge points that would overlap on screen into count bubbles that split apart as the reader zooms in. The layer keeps its data, symbology, picking and actions; a click on a bubble zooms to where it splits (cluster-click). Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
"name": "cluster-radius",
|
|
914
|
+
"description": "Cluster radius in screen pixels — points closer than this merge (default 50, MapLibre's). Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
"name": "cluster-max-zoom",
|
|
918
|
+
"description": "The last zoom at which clusters still form (default 16); past it every point stands alone. Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
"name": "cluster-min-points",
|
|
922
|
+
"description": "Fewest points that make a cluster (default 2). Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"name": "cluster-properties",
|
|
926
|
+
"description": "Aggregates carried onto each cluster: \"sum:mag,max:mag,mean:depth,mode:type\" → $sum_mag, $max_mag, $mean_depth, $mode_type in get-cluster-* expressions, beside $count. Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
"name": "cluster-click",
|
|
930
|
+
"description": "What a click on a bubble does: \"expand\" (default — fly to the zoom where it splits) or \"none\". Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"name": "cluster-label",
|
|
934
|
+
"description": "Set \"false\" to drop the count text on bubbles. Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
"name": "get-cluster-radius",
|
|
938
|
+
"description": "Bubble radius in pixels — an expression over $count, $count_max (the largest cluster at this zoom), $count_total, $zoom and the cluster-properties aggregates. Default: scale($count / $count_max, sqrt, [12, 36], domain=[0, 1]). Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
"name": "get-cluster-fill-color",
|
|
942
|
+
"description": "Bubble fill — an expression over the same cluster fields (e.g. scale($mean_depth, sequential, ['#fc0', '#60a'], domain=[0, 300])). Default: the layer's own color, else blue. Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
"name": "get-cluster-line-color",
|
|
946
|
+
"description": "Bubble outline colour (default white). Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
"name": "get-cluster-label",
|
|
950
|
+
"description": "The bubble's text (default $count_abbreviated, e.g. 1.2k). Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
"name": "get-cluster-icon",
|
|
954
|
+
"description": "An image on the bubble: an expression yielding a URL (drawn as a circular thumbnail ringed in the bubble's fill — e.g. $first_photo with cluster-properties=\"first:photo\") or a glyph name from cluster-icon-atlas. Images need CORS. Absent = a plain circle. Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
"name": "cluster-icon-atlas",
|
|
958
|
+
"description": "Sprite sheet URL for glyph NAMES returned by get-cluster-icon (an IconLayer host's own icon-atlas is used when this is absent). Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
"name": "cluster-icon-mapping",
|
|
962
|
+
"description": "JSON mapping of glyph names to atlas rectangles, as icon-mapping on IconLayer. Valid on: GeoJsonLayer, IconLayer, ScatterplotLayer."
|
|
963
|
+
},
|
|
908
964
|
{
|
|
909
965
|
"name": "get-point-radius",
|
|
910
966
|
"description": "Accessor for deck.gl getPointRadius — expression language: $field, scale(), formatDate(), arithmetic. Valid on: GeoJsonLayer, MVTLayer."
|
|
@@ -2228,6 +2284,18 @@
|
|
|
2228
2284
|
"name": "layer",
|
|
2229
2285
|
"description": "Only picks on this layer trigger the behavior."
|
|
2230
2286
|
},
|
|
2287
|
+
{
|
|
2288
|
+
"name": "pick",
|
|
2289
|
+
"description": "On a clustered layer (cluster=\"true\"): \"point\" fires only for standalone points, \"cluster\" only for count bubbles. Absent = both.",
|
|
2290
|
+
"values": [
|
|
2291
|
+
{
|
|
2292
|
+
"name": "point"
|
|
2293
|
+
},
|
|
2294
|
+
{
|
|
2295
|
+
"name": "cluster"
|
|
2296
|
+
}
|
|
2297
|
+
]
|
|
2298
|
+
},
|
|
2231
2299
|
{
|
|
2232
2300
|
"name": "action",
|
|
2233
2301
|
"description": "Action to dispatch.",
|
|
@@ -2238,6 +2306,12 @@
|
|
|
2238
2306
|
{
|
|
2239
2307
|
"name": "set-pickable"
|
|
2240
2308
|
},
|
|
2309
|
+
{
|
|
2310
|
+
"name": "set-layer-attribute"
|
|
2311
|
+
},
|
|
2312
|
+
{
|
|
2313
|
+
"name": "expand-cluster"
|
|
2314
|
+
},
|
|
2241
2315
|
{
|
|
2242
2316
|
"name": "zoom-in"
|
|
2243
2317
|
},
|
|
@@ -2849,6 +2923,12 @@
|
|
|
2849
2923
|
{
|
|
2850
2924
|
"name": "set-pickable"
|
|
2851
2925
|
},
|
|
2926
|
+
{
|
|
2927
|
+
"name": "set-layer-attribute"
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
"name": "expand-cluster"
|
|
2931
|
+
},
|
|
2852
2932
|
{
|
|
2853
2933
|
"name": "zoom-in"
|
|
2854
2934
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nika-js/onlymap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
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": {
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"CHANGELOG.md",
|
|
112
112
|
"LICENSE.md",
|
|
113
113
|
"THIRD-PARTY-LICENSES.md",
|
|
114
|
-
"docs",
|
|
114
|
+
"docs/*.md",
|
|
115
115
|
"llms.txt",
|
|
116
116
|
"onlymapjs.html-data.json",
|
|
117
117
|
"onlymapjs.attributes.json",
|
|
@@ -170,6 +170,7 @@
|
|
|
170
170
|
"@types/estree": "^1.0.9",
|
|
171
171
|
"@types/react": "^19.2.17",
|
|
172
172
|
"@types/react-dom": "^19.2.3",
|
|
173
|
+
"@types/supercluster": "^7.1.3",
|
|
173
174
|
"@types/ws": "^8.18.1",
|
|
174
175
|
"acorn": "^8.17.0",
|
|
175
176
|
"apache-arrow": "^21.1.0",
|
|
@@ -199,5 +200,8 @@
|
|
|
199
200
|
"ws": "^8.21.0",
|
|
200
201
|
"zustand": "^5.0.14"
|
|
201
202
|
},
|
|
202
|
-
"comment:deck-pin": "deck.gl/luma.gl devDeps are EXACT pins: they get BUNDLED into dist, and both libraries hard-throw on duplicate-version detection — consumers that also ship their own deck.gl (nika-agent) must match these versions exactly. CONTRACT: the bundled deck.gl/luma.gl version is part of the release surface and only changes at the SemVer boundary a caret does NOT cross — a MAJOR onlymap release (a 0.x MINOR while pre-1.0). Anything a caret floats (minor+patch once >=1.0; patch while 0.x) must NEVER move deck.gl, so a consumer can caret onlymap safely. Bumping deck is a breaking-coordination event, never a side effect of a minor/patch release or a reinstall."
|
|
203
|
+
"comment:deck-pin": "deck.gl/luma.gl devDeps are EXACT pins: they get BUNDLED into dist, and both libraries hard-throw on duplicate-version detection — consumers that also ship their own deck.gl (nika-agent) must match these versions exactly. CONTRACT: the bundled deck.gl/luma.gl version is part of the release surface and only changes at the SemVer boundary a caret does NOT cross — a MAJOR onlymap release (a 0.x MINOR while pre-1.0). Anything a caret floats (minor+patch once >=1.0; patch while 0.x) must NEVER move deck.gl, so a consumer can caret onlymap safely. Bumping deck is a breaking-coordination event, never a side effect of a minor/patch release or a reinstall.",
|
|
204
|
+
"dependencies": {
|
|
205
|
+
"supercluster": "^8.0.1"
|
|
206
|
+
}
|
|
203
207
|
}
|
|
@@ -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 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.
|
|
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, marker clustering / clustered points (count bubbles that split on zoom — the `cluster` toggle), 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.
|
|
26
|
+
For no-build CDN pages, use the single-file standalone bundle from a raw-file CDN — `https://unpkg.com/@nika-js/onlymap@0.11.1` (the bare package URL serves `dist/onlymap.standalone.js`) — plus `<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.11.1/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
|
|
|
@@ -71,6 +71,7 @@ Load the smallest reference needed for the task:
|
|
|
71
71
|
- UI panel, control, chart, legend, stats, filter, or draw toolbar -> `<om-widget>`.
|
|
72
72
|
- Sparse rich HTML at one geographic location -> `<om-overlay>`.
|
|
73
73
|
- Many labels/badges -> `<om-layer type="PopupLayer">`.
|
|
74
|
+
- Many overlapping POINTS ("marker clusters", "group the pins", "thousands of points that pile up when zoomed out") -> `cluster="true"` on the existing `ScatterplotLayer`/`GeoJsonLayer`/`IconLayer` — a toggle, never a new layer type or a `HexagonLayer`. Add `cluster-properties="sum:field,mode:field"` when a bubble should say more than a count, and style bubbles with `get-cluster-radius`/`get-cluster-fill-color` over `$count`, `$count_max` and the aggregates (syntax.md "Clustering"). Do NOT confuse with `cluster="false"` on `<om-widget>`, which is button grouping.
|
|
74
75
|
- A styled look for the whole map (vintage / printed / risograph / newsprint / night plate, film grain, halftone, duotone) -> `<om-effect>` children of `<om-map>`: `preset="vintage|engraved|night|blueprint|riso|newsprint|muted"`, or `op=` with knobs, in document order. Spatial knobs are MILLIMETRES, never px. See references/syntax.md.
|
|
75
76
|
- Guided tour or narrative sequence -> `<om-story>` with `<om-step>` siblings that reference existing layers/overlays by id.
|
|
76
77
|
- Basemap choice or user-switchable basemaps -> `basemap` presets (`positron`, `liberty`, `dark-matter`, `osm`, ...) + `<om-widget type="basemap-switcher">`; MapTiler custom styles via a style URL or `basemap-key`.
|
|
@@ -50,6 +50,7 @@ function StatsPanel({ onToggle }) {
|
|
|
50
50
|
|
|
51
51
|
- **`<OmMap>`** — `center`/`zoom`/`pitch`/`bearing` (initial; later changes move the camera, unchanged props never fight user panning), `basemap`, `headless`, `widgetStyle` (layout-token sugar, the `widget-style` attribute's twin: `"gap:10 opacity:0.9"` → `--om-widget-*` custom properties), `widgetsHidden` (hide-all: hides authored managed widget wrappers without removal, so widget state survives; provider attribution and the license badge stay visible in their slots), `widgetsFold` (default true; map-width responsive side drawers, set false to opt out), `onReady`, `onViewStateChange`, `onRuntimeError`. Give it a size via `style`/`className`. `ref` exposes the imperative `MapController` handle: `flyTo`, `setView`, `emit`, `getLayers`, `getSelection`, `injectPick`, `ready` (promise), `project`, `suspend`/`resume` (release live fetch/poll/socket handles on app background, reacquire on foreground — native/WebView hosts; the layer repaints its last rows on resume while the first response is in flight).
|
|
52
52
|
- **`<OmLayer>`** — `id` + `type` (any registered deck.gl layer type) + deck props. `data`: stable inline reference or URL string (full Data Layer: CSV/Arrow/Shapefile/KML formats, `ws(s)://` streams via `source`/`streamKey`/`flush`, `refresh` polling). `dash`/`dashJustified` mirror the HTML path-style attributes. `label`/`color` feed `ctx.layers`; `filterField`/`filterRange` = GPU filter; `onClick`/`onHover` receive the flattened picked object (`onHover(null)` = pointer left). Conditional unmount/removal releases that layer's live-transport ownership; the final owner closes it.
|
|
53
|
+
- **Clustering on `<OmLayer>`** — `cluster` + `clusterRadius`/`clusterMaxZoom`/`clusterMinPoints`/`clusterProperties`/`clusterClick`/`clusterLabel` and the `getClusterRadius`/`getClusterFillColor`/`getClusterLineColor`/`getClusterLabel` expression props (camelCase twins of the HTML `cluster-*` attributes; `ScatterplotLayer`, `GeoJsonLayer` with Point features, `IconLayer`). Bubble picks reach `onClick` with `cluster: true`, `count` and the aggregates; `controller.clusterLeaves(layerId, clusterId)` returns the rows inside one. Clicking a bubble zooms to where it splits unless `clusterClick="none"`.
|
|
53
54
|
- **`<OmWidget>`** — positioning shell: `position` takes one of 8 managed slots (logical, RTL-aware: `top-start|top-center|top-end|center-start|center-end|bottom-start|bottom-center|bottom-end`; legacy corners `top-left` etc. alias) + arbitrary JSX. Same-slot widgets stack with flush edges and a shared gap; at map widths ≤640px they auto-fold into per-side drawers (`fold="never"` exempts an essential control); provider attribution joins `bottom-end` and the license badge joins `bottom-start` as in-flow members; `order={1}` sets deterministic in-slot ordering. `position="manual"` renders a plain block at the JSX site — note it sits inside OmMap's overflow-hidden box, so for UI OUTSIDE the map render your own element next to `<OmMap>` and drive the map via `useOmMap()`/the ref instead. (Automatic button-clustering of adjacent compact widgets, and collision-dim of slots under an open overlay, are HTML-lane only — in React, compose your own control group in JSX and dim via your own state.)
|
|
54
55
|
- **`<OmOverlay>`** — geo-anchored HTML with managed projection/tracking/culling. `anchor={[lng, lat]}` or `anchorFrom="selection"` (+ `layer` to scope which picks move it, + `selectionType="click"|"hover"` to scope which pick TYPE — a click-opened popup wants `selectionType="click"`, else hovering any pickable feature drags and re-renders it; a click on empty space still dismisses); children may be `(selection) => JSX`; `anchorOffset` (default `bottom-center`); `interactive={false}` for hover-following tooltips.
|
|
55
56
|
- **`useOmMap(watch?)`** — the same `ctx` contract HTML widget scripts get, typed: `layers`, `viewport`, `selection`, `emit`, `data()`, `dataInViewport()`, `stats()`. Watch tokens: `"viewport"`, `"selection"`, `"layers"`, `"data:<layerId>"`. Rides `useSyncExternalStore` (tearing-safe; `ctx` identity stable until a watched token fires).
|
|
@@ -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.
|
|
20
|
-
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.
|
|
19
|
+
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.11.1/dist/onlymapjs.css">
|
|
20
|
+
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.11.1"></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).
|
|
@@ -168,6 +168,44 @@ One `<om-widget type="filter">` per dimension — each moves its own field's ran
|
|
|
168
168
|
|
|
169
169
|
`visible-zoom-range="[8, 14]"` — scale-dependent visibility, the QGIS/ArcGIS/Mapbox everyday pattern: the layer renders only at min ≤ zoom < max (min inclusive, max exclusive — the minzoom/maxzoom convention). Universal: valid on every layer type, unlike the tile-only `visible-min-zoom`/`visible-max-zoom` deck props. Composes with `visible` (both must allow); a zoom-hidden layer stays a full scene member — legend, layer-switcher, and `ctx` still list it. Malformed values are ignored with a warning (`validate` reports them structurally).
|
|
170
170
|
|
|
171
|
+
## Clustering (`ScatterplotLayer`, `GeoJsonLayer` with Point features, `IconLayer`)
|
|
172
|
+
|
|
173
|
+
`cluster="true"` merges points that would overlap on screen into count bubbles that split apart as the reader zooms in. A TOGGLE on the point layer, never a separate layer type: the layer keeps its id, data, its own `get-*` symbology for the points that stand alone at the current zoom, its picks, behaviors and actions.
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<om-layer id="plants" type="ScatterplotLayer" data="./plants.csv"
|
|
177
|
+
get-position="[$lon, $lat]" color="#2563eb" radius="4" radius-units="pixels"
|
|
178
|
+
cluster="true"
|
|
179
|
+
cluster-radius="50" cluster-max-zoom="16" cluster-min-points="2" <!-- the defaults, MapLibre's names -->
|
|
180
|
+
cluster-properties="sum:capacity_mw,mode:fuel"
|
|
181
|
+
get-cluster-radius="scale($count / $count_max, sqrt, [12, 36], domain=[0, 1])" <!-- the default -->
|
|
182
|
+
get-cluster-fill-color="$mode_fuel == 'Hydro' ? '#0ea5e9' : '#64748b'"
|
|
183
|
+
pickable></om-layer>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
| Attribute | Meaning |
|
|
187
|
+
|---|---|
|
|
188
|
+
| `cluster` | `"true"` turns clustering on. |
|
|
189
|
+
| `cluster-radius` | Cluster radius in screen pixels (default 50). |
|
|
190
|
+
| `cluster-max-zoom` | The last zoom at which clusters still form (default 16); past it every point stands alone. |
|
|
191
|
+
| `cluster-min-points` | Fewest points that make a cluster (default 2). |
|
|
192
|
+
| `cluster-properties` | `"op:field,…"` with op `sum` `min` `max` `mean` `mode` `first` → `$op_field` on every bubble (`$sum_capacity_mw`, `$mode_fuel`, `$first_photo`), beside `$count`. `mode` is the commonest value — the way to colour a bubble by category; `first` (0.11.1) is the earliest member's value in data order, any type — the way to pick a representative photo or name. |
|
|
193
|
+
| `cluster-click` | `expand` (default: a click flies to the zoom where the bubble splits) or `none`. |
|
|
194
|
+
| `cluster-label` | `"false"` drops the count text. |
|
|
195
|
+
| `get-cluster-radius` | Bubble radius in px — an expression over the cluster fields. |
|
|
196
|
+
| `get-cluster-fill-color` / `get-cluster-line-color` | Bubble fill/outline. Default fill: the layer's own `color`, else blue; outline white. |
|
|
197
|
+
| `get-cluster-label` | Bubble text (default `$count_abbreviated`, e.g. `1.2k`). |
|
|
198
|
+
| `get-cluster-icon` | An IMAGE on the bubble (0.11.1). A URL (`$first_photo`) draws as a circular thumbnail, cover-fit, ringed in the bubble's fill; a name draws a glyph from `cluster-icon-atlas` (or an `IconLayer` host's own atlas). Images need CORS (same-origin, or `Access-Control-Allow-Origin`); a bubble whose image is loading or failed stays a circle. |
|
|
199
|
+
| `cluster-icon-atlas` / `cluster-icon-mapping` | The glyph sheet for names from `get-cluster-icon`, as `icon-atlas`/`icon-mapping` on IconLayer. |
|
|
200
|
+
|
|
201
|
+
Cluster fields available to `get-cluster-*`: `$count`, `$count_abbreviated`, `$count_total` (all points), `$zoom`, the aggregates, and — for scaling — `$count_max` and `$<aggregate>_max` / `_min`: the largest/smallest value among ALL clusters at the bubble's own zoom. Divide by them, as the default radius does, and a size or colour ramp stays meaningful at every zoom (a literal `domain=[2, 1000]` is right at z3 and collapses every bubble at z11). `scale()` domains must be literals, so this normalisation is the way to get a zoom-adaptive ramp.
|
|
202
|
+
|
|
203
|
+
Picks: a bubble pick's object carries `cluster: true`, `cluster_id`, `count`, `position` and the aggregates — `<om-overlay>` templates read `{{count}}` / `{{sum_capacity_mw}}`; a standalone point picks as itself. Give each kind its own behavior with `pick="point"` / `pick="cluster"` on `<om-behavior>` (a point's click card, a bubble's hover tooltip) — without it one card would open, half-empty, for both. `map.clusterLeaves(layerId, clusterId, limit?)` returns the rows inside a bubble. Action `expand-cluster` (payload: a pick, or `{layer, clusterId}`) flies to the split zoom, eased over 600 ms — the default click already does this. A runtime on/off switch is `set-layer-attribute` `{ layer, name: "cluster", value: "true"|"false" }` from a widget button; `ctx.layers[i].cluster` reports the current state.
|
|
204
|
+
|
|
205
|
+
Zoom bands ("bubbles far out, icons close in"): two layers over the same file, each with its own `visible-zoom-range` — the clustered `ScatterplotLayer` on `[0, 12]` with `cluster-max-zoom="11"` (so nothing is still bubbled at the hand-over) and an `IconLayer` on `[12, 24]`. The URL is fetched once; each layer needs its own id, `label`, and behaviors. Hard cut at the boundary, not a cross-fade.
|
|
206
|
+
|
|
207
|
+
Rules: Point data only — a `GeoJsonLayer` with any line or polygon feature refuses to cluster (structured error; give those features their own layer). `cluster-*` on any other layer type is a validation error. Not applied on a projected (`crs=`) sheet (renders unclustered, warns once). Row caps count the raw rows, not the bubbles.
|
|
208
|
+
|
|
171
209
|
Attribute-contract tooling: the package also ships `onlymapjs.attributes.json` — a machine-readable per-layer-type attribute list generated from the same registry the runtime validates against. CI checks that emit `<om-layer>` markup should validate attributes per `type=` against it, NOT against the editor IntelliSense file (`onlymapjs.html-data.json`), which is a flat per-tag union and cannot express "valid on TileLayer, not GeoJsonLayer". An attribute is accepted on a type iff it appears in the contract's `universal` list or `layers[<type>]`.
|
|
172
210
|
|
|
173
211
|
Categorical filtering is a SEPARATE mechanism from numeric (deck.gl's own `categorySize`, a discrete keep-list test, not a range) — same shape, own attributes, and combines with an active numeric filter (a row must pass both):
|
|
@@ -647,6 +685,7 @@ Templates:
|
|
|
647
685
|
- `{{field}}` HTML-escaped interpolation.
|
|
648
686
|
- `{{{field}}}` raw HTML; avoid unless trusted.
|
|
649
687
|
- `{{z}}` — the pick's elevation in meters, present only when a `pickable="3d"` layer ran the depth pass for it (see `<om-layer>`'s `pickable` above). Absent, not `0`, otherwise.
|
|
688
|
+
- **Image or link tokens → wrap the content in a `<template>` child** (0.11.1): `<om-overlay …><template><img src="{{photo}}"></template></om-overlay>`. A `<template>` is inert, so the browser never requests the literal `{{photo}}` at page load the way it does for live light-DOM children. Tokens are blanked until the first pick fills them (an empty `src` is not fetched), and the tooltip path does the same.
|
|
650
689
|
|
|
651
690
|
Example:
|
|
652
691
|
|
|
@@ -727,6 +766,13 @@ Declarative event to action binding.
|
|
|
727
766
|
|
|
728
767
|
Events: `click`, `hover`, `drag`, `load`, `data-loaded`.
|
|
729
768
|
|
|
769
|
+
`pick="point"` / `pick="cluster"` — on a `cluster="true"` layer, fire only for standalone points or only for count bubbles (absent = both). A template cannot branch, so this is how a point gets its card and a bubble its own tooltip:
|
|
770
|
+
|
|
771
|
+
```html
|
|
772
|
+
<om-behavior on="click" layer="plants" pick="point" action="show-overlay" target="detail"></om-behavior>
|
|
773
|
+
<om-behavior on="hover" layer="plants" pick="cluster" action="show-tooltip" template="#bubble-tip"></om-behavior>
|
|
774
|
+
```
|
|
775
|
+
|
|
730
776
|
Common built-in actions:
|
|
731
777
|
|
|
732
778
|
- `show-overlay`, `hide-overlay`
|
|
@@ -734,6 +780,8 @@ Common built-in actions:
|
|
|
734
780
|
- `toggle-layer`
|
|
735
781
|
- `set-effect` — payload `{ preset }` (a preset name, or `"none"` to remove it); optional `<op>-<param>` knob overrides, e.g. `{ preset: "vintage", "grain-amount": 0.02 }`. Writes one `<om-effect preset>` child, so it is undoable; NOT story-rewindable yet (rewind restores `<om-map>` attributes, this adds an element). A hand-composed op chain is left alone.
|
|
736
782
|
- `set-pickable` — payload `{ layer, pickable: true|false|"3d" }`; writes/removes the layer's `pickable` attribute at runtime (turns popups/tooltips/hover behaviors on or off per layer — the viewer-facing popup toggle), story-capturable and undoable
|
|
783
|
+
- `set-layer-attribute` — payload `{ layer, name, value }`; writes ANY `<om-layer>` attribute at runtime by its kebab-case name (`{ layer: "plants", name: "cluster", value: "true" }`, `{ name: "radius", value: 8 }`); `value: null` (or `remove: true`) removes it. The generic twin of a React prop change — live, story-capturable and undoable like `toggle-layer`. The one refusal is `name: "id"`.
|
|
784
|
+
- `expand-cluster` — payload: a cluster pick (`{ feature, layer }`) or `{ layer, clusterId }`, optional `duration`; flies to the zoom where the bubble splits (eased 600 ms by default). The default click on a bubble already does this (`cluster-click="expand"`); the action is for `cluster-click="none"` layers and hosts.
|
|
737
785
|
- `highlight-feature` — sets the layer's `highlighted-id`; style the selection with `highlight-color="[220, 38, 38, 255]"` (or hex) on the `<om-layer>` — a constant color, not a `get-*` accessor
|
|
738
786
|
- `zoom-to-feature`
|
|
739
787
|
- `filter-layer`
|