@nika-js/onlymap 0.10.10 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +14 -2
  3. package/dist/{basemap-BH76eQA0.js → basemap-CHFwxaRT.js} +2 -2
  4. package/dist/cluster-index.d.ts +77 -0
  5. package/dist/cluster-options.d.ts +95 -0
  6. package/dist/cluster-thumbs.d.ts +68 -0
  7. package/dist/ctx.d.ts +2 -0
  8. package/dist/elements/om-map.d.ts +6 -0
  9. package/dist/{geoparquet-DzKLe-0r.js → geoparquet-DBzSJJz_.js} +1 -1
  10. package/dist/{globe-view-B-prUQFh.js → globe-view-D0eDmIGO.js} +1 -1
  11. package/dist/{hillshade-CDng2Jsi.js → hillshade-DodGS9DL.js} +1 -1
  12. package/dist/html-data.d.ts +1 -1
  13. package/dist/{index-D86S8KJ1.js → index-5iFHs_bW.js} +1 -1
  14. package/dist/{index-Rvd-zFrS.js → index-BGvTOkkE.js} +1 -1
  15. package/dist/{index-CpLydTmE.js → index-C7Tpf_BA.js} +1 -1
  16. package/dist/{index-DOfIeNux.js → index-Ca5y3OLs.js} +1 -1
  17. package/dist/{index-cwieLGSg.js → index-CrnprTab.js} +1 -1
  18. package/dist/{index-DvEcTZ4i.js → index-D04CeeYu.js} +17702 -16467
  19. package/dist/{index-CIo8LgRZ.js → index-DH1_IQmW.js} +3 -3
  20. package/dist/{index-laD2SEAB.js → index-em-_HmNV.js} +3 -3
  21. package/dist/{index-8Fj-yh7f.js → index-wRR0a71N.js} +2 -2
  22. package/dist/ir-snapshot.d.ts +10 -0
  23. package/dist/ir.d.ts +9 -0
  24. package/dist/layer-registry.d.ts +8 -0
  25. package/dist/layers/cluster-layer.d.ts +136 -0
  26. package/dist/{lerc-BJB4-X6n.js → lerc-KZgSVKKQ.js} +1 -1
  27. package/dist/onlymap.standalone.js +36288 -35053
  28. package/dist/onlymapjs.js +1 -1
  29. package/dist/{post-process-effect-Bd5plkno.js → post-process-effect-eJXo3MSl.js} +1 -1
  30. package/dist/programmatic.d.ts +6 -0
  31. package/dist/{raster-DJ6vvro6.js → raster-CHuauCiR.js} +3 -3
  32. package/dist/{raster-pipeline-BQhNhrPq.js → raster-pipeline-Coou2lF-.js} +1 -1
  33. package/dist/runtime-core.d.ts +24 -0
  34. package/dist/{text-on-path-CrqchF3O.js → text-on-path-DUfdTGzX.js} +1 -1
  35. package/dist/version.d.ts +1 -1
  36. package/dist/{zarr-oAkG7ZLM.js → zarr-BYLzFMeQ.js} +2 -2
  37. package/docs/cartograph.md +2 -2
  38. package/llms.txt +3 -2
  39. package/onlymapjs.attributes.json +42 -0
  40. package/onlymapjs.html-data.json +80 -0
  41. package/package.json +7 -3
  42. package/skills/onlymapjs/SKILL.md +3 -2
  43. package/skills/onlymapjs/references/react.md +1 -0
  44. package/skills/onlymapjs/references/syntax.md +50 -2
  45. package/docs/design/arrows.md +0 -182
  46. package/docs/design/carto-substrate.md +0 -1067
  47. package/docs/design/cog-v2.md +0 -223
  48. package/docs/design/extensions.md +0 -250
  49. package/docs/design/frame-sources.md +0 -229
  50. package/docs/design/hillshade.md +0 -290
  51. package/docs/design/paced-flyby.md +0 -42
  52. package/docs/design/trace-link-failure.md +0 -20
package/CHANGELOG.md CHANGED
@@ -8,6 +8,31 @@ 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.1 — 2026-09-30
12
+
13
+ ### Added
14
+ - **A cluster bubble can carry an image.** `get-cluster-icon="$first_photo"` draws the image as a circular thumbnail, cropped to the bubble and ringed in the bubble's colour — the photo of the first place in the cluster, say. A name instead of a URL draws a glyph from `cluster-icon-atlas` / `cluster-icon-mapping` (or the layer's own icon atlas). Images must be same-origin or served with CORS headers, as any image a map draws must; a bubble whose image is still loading, or could not load, stays a plain circle.
15
+ - **`first:` joins the aggregates.** `cluster-properties="first:photo"` puts the earliest member's value (in data order, any type — a URL, a name) on every bubble as `$first_photo`, beside `sum`, `min`, `max`, `mean` and `mode`.
16
+
17
+ ### Changed
18
+ - Cluster count labels now have a thin dark halo, so they read over a light bubble or a photo.
19
+
20
+ ### Fixed
21
+ - **An `<img src="{{photo}}">` in a popup no longer requests the literal `{{photo}}`.** Overlay and tooltip templates are blanked until a pick fills them instead of being written raw, so the bogus request (a 404 in the console on every card) and the momentary flash of `{{token}}` text are gone. For an overlay authored as light-DOM children the browser had already parsed the image before any script ran — wrap such content in a `<template>` child, which is now the recommended form for any card carrying an image or link.
22
+
23
+ ## 0.11.0 — 2026-09-30
24
+
25
+ ### Added
26
+ - **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.
27
+ - **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.
28
+ - **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.
29
+ - **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.
30
+ - **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.
31
+ - **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`.
32
+
33
+ ### Changed
34
+ - **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.
35
+
11
36
  ## 0.10.10 — 2026-09-29
12
37
 
13
38
  ### 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,first:f"` carries aggregates onto each bubble as `$sum_f`, `$mode_f`, `$first_f`…, beside `$count`; `get-cluster-icon="$first_photo"` puts an image on the bubble — a URL becomes a circular thumbnail ringed in the bubble's fill (images need CORS), a name a glyph from `cluster-icon-atlas`; `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
 
@@ -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-DvEcTZ4i.js";
2
- import { a as ty } from "./globe-view-B-prUQFh.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-D04CeeYu.js";
2
+ import { a as ty } from "./globe-view-D0eDmIGO.js";
3
3
  var Ou = { exports: {} };
4
4
  /**
5
5
  * MapLibre GL JS
@@ -0,0 +1,77 @@
1
+ import type { LayerData } from "./ir";
2
+ import type { Shape } from "./expr";
3
+ export declare const CLUSTER_AGGREGATE_OPS: readonly ["sum", "min", "max", "mean", "mode", "first"];
4
+ export type ClusterAggregateOp = (typeof CLUSTER_AGGREGATE_OPS)[number];
5
+ export interface ClusterAggregate {
6
+ op: ClusterAggregateOp;
7
+ field: string;
8
+ /** `${op}_${field}` — the name the cluster row carries. */
9
+ name: string;
10
+ }
11
+ /**
12
+ * `"sum:mag, max:mag"` → aggregates. Malformed entries are reported through
13
+ * `warn` and skipped, never thrown: a bad aggregate must not take the map
14
+ * down with it (the validator repeats the same diagnosis structurally).
15
+ */
16
+ export declare function parseClusterProperties(raw: string | undefined | null, warn?: (message: string) => void): ClusterAggregate[];
17
+ export interface ClusterIndexOptions {
18
+ /** Cluster radius in screen pixels (MapLibre's `clusterRadius`; default 50). */
19
+ radius: number;
20
+ /** Highest zoom at which clusters still form (default 16). */
21
+ maxZoom: number;
22
+ /** Fewest points that make a cluster (default 2). */
23
+ minPoints: number;
24
+ aggregates: readonly ClusterAggregate[];
25
+ shape: Shape;
26
+ }
27
+ /** One cluster as a flat row — the layer re-shapes it to the host's data shape. */
28
+ export interface ClusterRow {
29
+ cluster: true;
30
+ cluster_id: number;
31
+ count: number;
32
+ /** `12`, `1.2k` — always a string, because a TextLayer drops numbers. */
33
+ count_abbreviated: string;
34
+ count_total: number;
35
+ count_max: number;
36
+ zoom: number;
37
+ position: [number, number];
38
+ /** `${op}_${field}` values plus `${op}_${field}_max` / `_min` at this zoom. */
39
+ [aggregate: string]: unknown;
40
+ }
41
+ export interface ClusterQuery {
42
+ clusters: ClusterRow[];
43
+ /** Original row indices of the points that stand alone at this zoom. */
44
+ leaves: number[];
45
+ }
46
+ /** Dataset-wide extremes at one zoom: `count_max` plus `<agg>_max`/`<agg>_min`. */
47
+ export type ClusterMaxima = Record<string, number>;
48
+ export declare class ClusterIndex {
49
+ private readonly data;
50
+ private readonly options;
51
+ private readonly index;
52
+ private readonly maximaByZoom;
53
+ /** Rows the position lookup could not place (non-finite or missing) — surfaced, never thrown. */
54
+ readonly skipped: number;
55
+ /** Points actually indexed. */
56
+ readonly total: number;
57
+ constructor(data: LayerData, positionOf: (index: number) => readonly number[] | undefined, options: ClusterIndexOptions);
58
+ /** The accumulator a single point contributes. */
59
+ private seed;
60
+ /** Fold `props` into `acc` (supercluster mutates the accumulator in place). */
61
+ private merge;
62
+ /** Aggregates in their final form: means divided, modes resolved to the winning value. */
63
+ private finalize;
64
+ private clampZoom;
65
+ /**
66
+ * Dataset-wide extremes at `zoom`, cached: `count_max` (1 when nothing
67
+ * clusters at this zoom, so a division by it is always defined) and, per
68
+ * aggregate, `<name>_max`/`<name>_min` over the clusters that exist.
69
+ */
70
+ maxima(zoom: number): ClusterMaxima;
71
+ /** Clusters and standalone points inside `bbox` ([west, south, east, north]) at `zoom`. */
72
+ query(bbox: readonly [number, number, number, number], zoom: number): ClusterQuery;
73
+ /** Original row indices inside a cluster (paged like supercluster's own `getLeaves`). */
74
+ leaves(clusterId: number, limit?: number, offset?: number): number[];
75
+ /** The zoom at which this cluster splits — what click-to-expand flies to. */
76
+ expansionZoom(clusterId: number): number;
77
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The `cluster` toggle's authoring surface (docs/design/clustering.md).
3
+ *
4
+ * Clustering is a toggle on the three point-capable layer types, not a layer
5
+ * type of its own: `cluster="true"` on a ScatterplotLayer keeps the layer's
6
+ * id, data, symbology, picking and actions, and only changes which symbols
7
+ * exist per zoom. The attributes below are therefore REGISTERED on those
8
+ * schemas (so attribute resolution, validation, IntelliSense and the
9
+ * programmatic lane all see them through the ordinary PropDescriptor path)
10
+ * and then ROUTED OUT of the deck prop bag into `LayerIR.cluster` by
11
+ * `extractClusterOptions`, so the host class never receives them. The
12
+ * reconciler swaps in `ClusterLayer` (src/layers/cluster-layer.ts) when the
13
+ * IR carries them.
14
+ *
15
+ * Names follow MapLibre's GeoJSON-source options (`cluster`, `clusterRadius`,
16
+ * `clusterMaxZoom`, `clusterMinPoints`, `clusterProperties`) — the names a
17
+ * translated manifest already carries.
18
+ */
19
+ import type { PropDescriptor } from "./layer-registry";
20
+ import type { Shape } from "./expr";
21
+ import type { LayerData } from "./ir";
22
+ import { type ClusterAggregate } from "./cluster-index";
23
+ /** Layer types the toggle is registered on. Point-only by construction (D7). */
24
+ export declare const CLUSTER_CAPABLE_TYPES: readonly string[];
25
+ export declare const CLUSTER_ATTR = "cluster";
26
+ export declare const CLUSTER_CLICK_VALUES: readonly ["expand", "none"];
27
+ export type ClusterClick = (typeof CLUSTER_CLICK_VALUES)[number];
28
+ export declare const CLUSTER_DEFAULTS: {
29
+ radius: number;
30
+ maxZoom: number;
31
+ minPoints: number;
32
+ click: ClusterClick;
33
+ label: boolean;
34
+ };
35
+ /** The eased duration of click-to-expand and of `expand-cluster` when no `duration` is authored. */
36
+ export declare const CLUSTER_EXPAND_MS = 600;
37
+ /**
38
+ * The default bubble size — self-normalising per zoom: the largest cluster at
39
+ * any zoom is 36 px and the rest scale by the square root of their share
40
+ * (area ∝ count). `count_max` is the dataset-wide maximum at the cluster's own
41
+ * zoom (cluster-index.ts), so this never collapses to the minimum as the
42
+ * reader zooms in the way a literal count domain would.
43
+ */
44
+ export declare const DEFAULT_CLUSTER_RADIUS_EXPR = "scale($count / $count_max, sqrt, [12, 36], domain=[0, 1])";
45
+ export declare const DEFAULT_CLUSTER_LINE_COLOR_EXPR = "'#ffffff'";
46
+ export declare const DEFAULT_CLUSTER_LABEL_EXPR = "$count_abbreviated";
47
+ /** The accessor props a cluster row is styled through — `getCluster*`, never the host's own. */
48
+ export declare const CLUSTER_ACCESSOR_PROPS: readonly ["getClusterRadius", "getClusterFillColor", "getClusterLineColor", "getClusterLabel", "getClusterIcon"];
49
+ export type ClusterAccessorProp = (typeof CLUSTER_ACCESSOR_PROPS)[number];
50
+ /**
51
+ * Registered onto every CLUSTER_CAPABLE type (layer-registry.ts). `deckProp`
52
+ * is the prop-bag key extraction looks for; none of these ever reaches deck.
53
+ */
54
+ export declare const CLUSTER_PROP_DESCRIPTORS: readonly PropDescriptor[];
55
+ /** Every prop-bag key the toggle owns — what extraction removes from the host's props. */
56
+ export declare const CLUSTER_PROP_KEYS: readonly string[];
57
+ export type ClusterAccessor = (row: unknown, info: {
58
+ index: number;
59
+ data: unknown;
60
+ }) => unknown;
61
+ /** What `LayerIR.cluster` carries — everything ClusterLayer needs beyond the host's own props. */
62
+ export interface ClusterOptions {
63
+ radius: number;
64
+ maxZoom: number;
65
+ minPoints: number;
66
+ /** The authored `cluster-properties` text, kept for snapshots and diagnostics. */
67
+ properties?: string;
68
+ aggregates: ClusterAggregate[];
69
+ click: ClusterClick;
70
+ label: boolean;
71
+ /** `cluster-icon-atlas` / `cluster-icon-mapping` — the glyph sheet a NAME from `get-cluster-icon` resolves in. */
72
+ iconAtlas?: string;
73
+ iconMapping?: Record<string, unknown>;
74
+ /** Compiled `get-cluster-*` accessors (through the same cache as the host's). */
75
+ accessors: Partial<Record<ClusterAccessorProp, ClusterAccessor | unknown>>;
76
+ /** Their update-trigger fingerprints, keyed like `accessors`. */
77
+ updateTriggers: Partial<Record<ClusterAccessorProp, string>>;
78
+ }
79
+ /**
80
+ * Pulls the toggle's props OUT of a resolved prop bag (and their triggers out
81
+ * of `updateTriggers`) — always, so a host layer never sees `clusterRadius`
82
+ * as a deck prop — and returns the options when `cluster` is on.
83
+ *
84
+ * Shared by both front-ends (parse-manifest and the descriptor lane), which is
85
+ * what keeps `<om-layer cluster>` and `<OmLayer cluster>` identical.
86
+ */
87
+ export declare function extractClusterOptions(props: Record<string, unknown>, updateTriggers: Record<string, string>, warn: (message: string) => void): ClusterOptions | undefined;
88
+ /**
89
+ * Point-only enforcement (D7): a GeoJSON layer whose rows carry any geometry
90
+ * other than Point is refused, with the fix. Returns null when clustering
91
+ * can proceed. Flat and columnar rows position through an accessor and are
92
+ * always fine here; a row with no geometry at all is left to the index's
93
+ * own skip count.
94
+ */
95
+ export declare function clusterGeometryProblem(data: LayerData, shape: Shape): string | null;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Circular thumbnails for cluster bubbles (docs/design/clustering.md, "an
3
+ * image on the bubble"). deck's IconLayer draws rectangles and cannot clip,
4
+ * so when `get-cluster-icon` yields an image URL the image is drawn once,
5
+ * cover-fit, into an offscreen canvas with a circular clip and a ring in the
6
+ * bubble's fill colour, and THAT is handed to deck as an auto-packed icon.
7
+ *
8
+ * One render per distinct (url, ring colour): the cache key. A bubble whose
9
+ * thumbnail is still loading draws as a plain circle and switches when the
10
+ * load lands (`onReady`); a URL that fails — a 404, or a cross-origin image
11
+ * without CORS headers, which a canvas cannot read — is remembered as failed
12
+ * so the bubble stays a circle instead of retrying every frame.
13
+ *
14
+ * The loader and the canvas are injectable, so the cache logic is tested
15
+ * without a DOM; the defaults are the browser's `Image` and `<canvas>`.
16
+ */
17
+ export interface ThumbIcon {
18
+ /** A data: URL of the rendered thumbnail — what deck's IconLayer fetches. */
19
+ url: string;
20
+ width: number;
21
+ height: number;
22
+ /** deck's auto-packing keys icons by id; the cache key doubles as one. */
23
+ id: string;
24
+ /** Not a mask: the image's own colours draw. */
25
+ mask: false;
26
+ }
27
+ export interface ThumbSource {
28
+ width: number;
29
+ height: number;
30
+ }
31
+ /** Fetches an image ready to draw. The default is a CORS-anonymous `Image` that has decoded. */
32
+ export type ThumbLoader = (url: string) => Promise<ThumbSource>;
33
+ /** Draws `image` cover-fit inside a circle of `size` px with a `ring` stroke, and returns the data URL. */
34
+ export type ThumbRenderer = (image: ThumbSource, size: number, ring: {
35
+ color: string;
36
+ width: number;
37
+ }) => string;
38
+ export interface ThumbnailCacheOptions {
39
+ /** Rendered thumbnail size in device pixels (deck scales it to the bubble). */
40
+ size?: number;
41
+ ringWidth?: number;
42
+ load?: ThumbLoader;
43
+ render?: ThumbRenderer;
44
+ /** Called once per thumbnail that finishes loading — the layer asks deck to re-render. */
45
+ onReady?: () => void;
46
+ }
47
+ /** `[r, g, b(, a)]` → the CSS colour the ring is stroked in. */
48
+ export declare function ringColorCss(color: readonly number[] | undefined): string;
49
+ /** A string `get-cluster-icon` yields is a URL (drawn as a thumbnail) when it looks like one; otherwise it names an atlas glyph. */
50
+ export declare function looksLikeImageUrl(value: string): boolean;
51
+ export declare class ThumbnailCache {
52
+ private readonly entries;
53
+ private readonly size;
54
+ private readonly ringWidth;
55
+ private readonly load;
56
+ private readonly render;
57
+ private readonly onReady?;
58
+ constructor(options?: ThumbnailCacheOptions);
59
+ /**
60
+ * The thumbnail for `url` ringed in `ringColor`, if it is ready. Otherwise
61
+ * undefined — and, the first time, the load starts. A failed URL stays
62
+ * undefined without another attempt.
63
+ */
64
+ get(url: string, ringColor: readonly number[] | undefined): ThumbIcon | undefined;
65
+ /** How many thumbnails are ready — a test hook and a dev-panel number. */
66
+ get readyCount(): number;
67
+ get failedCount(): number;
68
+ }
package/dist/ctx.d.ts CHANGED
@@ -23,6 +23,8 @@ export interface LayerMetaSnapshot {
23
23
  filter?: LayerFilter;
24
24
  /** The layer's active categorical filter, if any — independent of `filter`, read by the built-in `filter` widget's categorical mode. */
25
25
  categoryFilter?: LayerCategoryFilter;
26
+ /** `cluster="true"` is on (docs/design/clustering.md) — the legend adds a bubble row so the count circles are explained. */
27
+ cluster?: boolean;
26
28
  }
27
29
  export interface DataOpts {
28
30
  /** Set `false` to bypass the layer's active declarative filter (spec: "Filter-aware stats & data (the coherence rule)"). Default `true`. */
@@ -214,6 +214,12 @@ export declare class OmMapElement extends HTMLElementBase {
214
214
  setLayerVisible(id: string, visible: boolean): void;
215
215
  /** A snapshot of the current layer IRs — the same shape `ctx.layers` is built from. */
216
216
  getLayers(): readonly LayerIR[];
217
+ /**
218
+ * The rows inside a cluster bubble on a `cluster` layer (docs/design/clustering.md),
219
+ * flattened like `ctx.selection.object`. `clusterId` is the `cluster_id` a bubble
220
+ * pick carries. Empty when the layer is not clustered right now.
221
+ */
222
+ clusterLeaves(layerId: string, clusterId: number, limit?: number, offset?: number): unknown[];
217
223
  private notifyWidgets;
218
224
  private buildCurrentCtx;
219
225
  /** Picked object, normalized to flat — GeoJSON properties lifted; columnar rows materialized from columns at the pick index. */
@@ -1,4 +1,4 @@
1
- import { a4 as p, a5 as d } from "./index-DvEcTZ4i.js";
1
+ import { a4 as p, a5 as d } from "./index-D04CeeYu.js";
2
2
  function g(t) {
3
3
  if (t == null) return !0;
4
4
  const e = t, n = e.id?.code;
@@ -1,4 +1,4 @@
1
- import { d as L, j as x, a6 as A, a7 as E, a8 as d, a9 as h, aa as u, ab as z, p as V, W as Z, G as D } from "./index-DvEcTZ4i.js";
1
+ import { d as L, j as x, a6 as A, a7 as E, a8 as d, a9 as h, aa as u, ab as z, p as V, W as Z, G as D } from "./index-D04CeeYu.js";
2
2
  const c = Math.PI / 180, G = 180 / Math.PI;
3
3
  function w(l, t = 0) {
4
4
  const a = Math.min(180, l) * c;
@@ -1,4 +1,4 @@
1
- import { al as P, am as T, an as N, ao as Z, c as B, ap as E, aq as C, ar as b, as as D, at as I, au as O } from "./index-DvEcTZ4i.js";
1
+ import { al as P, am as T, an as N, ao as Z, c as B, ap as E, aq as C, ar as b, as as D, at as I, au as O } from "./index-D04CeeYu.js";
2
2
  import { N as _, c as H } from "./hillshade-apron-Bem3DWyJ.js";
3
3
  import { p as $, h as j, m as A, a as U } from "./hillshade-shader-DI2uLSNU.js";
4
4
  function R(t, e, o) {
@@ -15,7 +15,7 @@ interface TagData {
15
15
  }[];
16
16
  }
17
17
  /** Hand-authored action list — validated against hasAction() in html-data.test.ts. */
18
- export declare const BUILTIN_ACTIONS: readonly ["toggle-layer", "set-pickable", "zoom-in", "zoom-out", "filter-layer", "highlight-feature", "fade", "pulse", "populate", "trace", "story-play", "story-pause", "story-seek", "fly-to", "zoom-to-feature", "show-overlay", "hide-overlay", "show-tooltip", "hide-tooltip", "draw-mode", "draw-commit", "draw-cancel", "draw-delete", "draw-clear", "draw-config", "draw-save", "export-region-3d", "measure-mode", "measure-clear", "measure-units", "set-basemap", "set-effect", "set-lighting", "set-terrain", "set-clip-box", "clip-box-edit", "set-widgets-visible", "undo", "redo", "warm-tiles"];
18
+ export declare const BUILTIN_ACTIONS: readonly ["toggle-layer", "set-pickable", "set-layer-attribute", "expand-cluster", "zoom-in", "zoom-out", "filter-layer", "highlight-feature", "fade", "pulse", "populate", "trace", "story-play", "story-pause", "story-seek", "fly-to", "zoom-to-feature", "show-overlay", "hide-overlay", "show-tooltip", "hide-tooltip", "draw-mode", "draw-commit", "draw-cancel", "draw-delete", "draw-clear", "draw-config", "draw-save", "export-region-3d", "measure-mode", "measure-clear", "measure-units", "set-basemap", "set-effect", "set-lighting", "set-terrain", "set-clip-box", "clip-box-edit", "set-widgets-visible", "undo", "redo", "warm-tiles"];
19
19
  /** Hand-authored widget types — validated against the widget registry in html-data.test.ts.
20
20
  * Declared in `widget-types.ts` so the runtime validator can use it without
21
21
  * pulling this 42 KB table into the bundle. */
@@ -1,4 +1,4 @@
1
- import { bB as Bt, bM as Xt, bN as Yt, bO as Us } from "./index-DvEcTZ4i.js";
1
+ import { bB as Bt, bM as Xt, bN as Yt, bO as Us } from "./index-D04CeeYu.js";
2
2
  import { w as gs, t as Hs, f as Ws, m as Qs } from "./mgrs-BY9bIvp4.js";
3
3
  import { c as Xs } from "./convert-arrow-schema-DrAihRf9.js";
4
4
  import { y as Ys, A as bt, a as Ks, z as Vs, R as Zs } from "./recordbatch-Bpc0uxFn.js";
@@ -1,4 +1,4 @@
1
- import { aA as B } from "./index-DvEcTZ4i.js";
1
+ import { aA as B } from "./index-D04CeeYu.js";
2
2
  const V = /* @__PURE__ */ new Set([
3
3
  "GeoJsonLayer",
4
4
  "PolygonLayer",
@@ -1,4 +1,4 @@
1
- import { bx as Be, by as le, bz as ce, bA as De, bB as Oe, bC as ke } from "./index-DvEcTZ4i.js";
1
+ import { bx as Be, by as le, bz as ce, bA as De, bB as Oe, bC as ke } from "./index-D04CeeYu.js";
2
2
  import { y as ve, a as he, z as G, R as J, A as ue, C as Fe, F as xe, n as je, S as Ie, E as Ne } from "./recordbatch-Bpc0uxFn.js";
3
3
  import { g as V, a as fe, b as Le, c as Ue, d as Me, e as qe, m as Ve } from "./table-accessors-CYWTzpQI.js";
4
4
  import { c as $e } from "./convert-arrow-schema-DrAihRf9.js";
@@ -1,4 +1,4 @@
1
- import { aB as tt, aC as et, aD as j, at as nt, au as ot, aE as B, aF as rt, aG as U, aq as st, ar as _, aH as C, aI as it } from "./index-DvEcTZ4i.js";
1
+ import { aB as tt, aC as et, aD as j, at as nt, au as ot, aE as B, aF as rt, aG as U, aq as st, ar as _, aH as C, aI as it } from "./index-D04CeeYu.js";
2
2
  const J = Math.PI / 180, T = tt * J;
3
3
  function Q(t, r) {
4
4
  const n = Math.max(Math.cos(r * J), 1e-6);
@@ -1,4 +1,4 @@
1
- import { bv as _t, bw as Ct } from "./index-DvEcTZ4i.js";
1
+ import { bv as _t, bw as Ct } from "./index-D04CeeYu.js";
2
2
  function Yt(e, r, t = 2, i, o = "xy") {
3
3
  const s = r && r.length, l = s ? r[0] * t : e.length;
4
4
  let c = Ut(e, 0, l, t, !0, i && i[0], o);