@nika-js/onlymap 0.11.0 → 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 (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/{basemap-Bg73oXUb.js → basemap-CHFwxaRT.js} +2 -2
  4. package/dist/cluster-index.d.ts +1 -1
  5. package/dist/cluster-options.d.ts +4 -1
  6. package/dist/cluster-thumbs.d.ts +68 -0
  7. package/dist/{geoparquet-BASBa9tf.js → geoparquet-DBzSJJz_.js} +1 -1
  8. package/dist/{globe-view-CTkofOiM.js → globe-view-D0eDmIGO.js} +1 -1
  9. package/dist/{hillshade-DdVEO8lc.js → hillshade-DodGS9DL.js} +1 -1
  10. package/dist/{index-BOjo5N6i.js → index-5iFHs_bW.js} +1 -1
  11. package/dist/{index-CVAyXg52.js → index-BGvTOkkE.js} +1 -1
  12. package/dist/{index-C7CNrOGW.js → index-C7Tpf_BA.js} +1 -1
  13. package/dist/{index-BLfj5bIo.js → index-Ca5y3OLs.js} +1 -1
  14. package/dist/{index-DbfTOgYl.js → index-CrnprTab.js} +1 -1
  15. package/dist/{index-C-YAnesV.js → index-D04CeeYu.js} +11359 -11178
  16. package/dist/{index-FtNZZGWv.js → index-DH1_IQmW.js} +3 -3
  17. package/dist/{index-BCDmJfeb.js → index-em-_HmNV.js} +3 -3
  18. package/dist/{index-DsLNa_IB.js → index-wRR0a71N.js} +2 -2
  19. package/dist/layers/cluster-layer.d.ts +25 -0
  20. package/dist/{lerc-CoNq0xxX.js → lerc-KZgSVKKQ.js} +1 -1
  21. package/dist/onlymap.standalone.js +20615 -20434
  22. package/dist/onlymapjs.js +1 -1
  23. package/dist/{post-process-effect-CrZoIEYa.js → post-process-effect-eJXo3MSl.js} +1 -1
  24. package/dist/{raster-CZMdghdy.js → raster-CHuauCiR.js} +3 -3
  25. package/dist/{raster-pipeline-n2wrLc9r.js → raster-pipeline-Coou2lF-.js} +1 -1
  26. package/dist/{text-on-path-CHkHjky-.js → text-on-path-DUfdTGzX.js} +1 -1
  27. package/dist/version.d.ts +1 -1
  28. package/dist/{zarr-DRBhsEZZ.js → zarr-BYLzFMeQ.js} +2 -2
  29. package/docs/cartograph.md +2 -2
  30. package/llms.txt +2 -2
  31. package/onlymapjs.attributes.json +9 -0
  32. package/onlymapjs.html-data.json +12 -0
  33. package/package.json +1 -1
  34. package/skills/onlymapjs/SKILL.md +1 -1
  35. package/skills/onlymapjs/references/syntax.md +6 -3
package/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@ 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
+
11
23
  ## 0.11.0 — 2026-09-30
12
24
 
13
25
  ### Added
package/README.md CHANGED
@@ -147,7 +147,7 @@ Thousands of points that overlap on screen become count bubbles that split apart
147
147
  get-cluster-fill-color="$mode_fuel == 'Hydro' ? '#0ea5e9' : '#64748b'" pickable></om-layer>
148
148
  ```
149
149
 
150
- `cluster="true"` works on `ScatterplotLayer`, `GeoJsonLayer` (Point features) and `IconLayer`. The layer keeps its id, data, its own `get-*` symbology for the points that stand alone, its picks and its actions. `cluster-radius` (px, 50), `cluster-max-zoom` (16) and `cluster-min-points` (2) follow MapLibre's names. `cluster-properties="sum:f,min:f,max:f,mean:f,mode:f"` carries aggregates onto each bubble as `$sum_f`, `$mode_f`…, beside `$count`; `get-cluster-radius`, `get-cluster-fill-color`, `get-cluster-line-color` and `get-cluster-label` style the bubbles with the same expression language. Every bubble also carries `$count_max` and `$<aggregate>_max` — the largest value at the *current zoom* — so the default radius, `scale($count / $count_max, sqrt, [12, 36], domain=[0, 1])`, keeps the biggest bubble at 36 px whether the reader is looking at a continent or a county. A click on a bubble eases to where it splits (`cluster-click="none"` to opt out, or wire `expand-cluster` yourself); a bubble pick carries `cluster: true`, `count` and the aggregates into overlays and `ctx.selection`, and `pick="point"` / `pick="cluster"` on `<om-behavior>` gives points and bubbles their own cards; `map.clusterLeaves(layerId, clusterId)` returns the rows inside one.
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
151
 
152
152
  ### Interaction
153
153
 
@@ -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-C-YAnesV.js";
2
- import { a as ty } from "./globe-view-CTkofOiM.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
@@ -1,6 +1,6 @@
1
1
  import type { LayerData } from "./ir";
2
2
  import type { Shape } from "./expr";
3
- export declare const CLUSTER_AGGREGATE_OPS: readonly ["sum", "min", "max", "mean", "mode"];
3
+ export declare const CLUSTER_AGGREGATE_OPS: readonly ["sum", "min", "max", "mean", "mode", "first"];
4
4
  export type ClusterAggregateOp = (typeof CLUSTER_AGGREGATE_OPS)[number];
5
5
  export interface ClusterAggregate {
6
6
  op: ClusterAggregateOp;
@@ -45,7 +45,7 @@ export declare const DEFAULT_CLUSTER_RADIUS_EXPR = "scale($count / $count_max, s
45
45
  export declare const DEFAULT_CLUSTER_LINE_COLOR_EXPR = "'#ffffff'";
46
46
  export declare const DEFAULT_CLUSTER_LABEL_EXPR = "$count_abbreviated";
47
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"];
48
+ export declare const CLUSTER_ACCESSOR_PROPS: readonly ["getClusterRadius", "getClusterFillColor", "getClusterLineColor", "getClusterLabel", "getClusterIcon"];
49
49
  export type ClusterAccessorProp = (typeof CLUSTER_ACCESSOR_PROPS)[number];
50
50
  /**
51
51
  * Registered onto every CLUSTER_CAPABLE type (layer-registry.ts). `deckProp`
@@ -68,6 +68,9 @@ export interface ClusterOptions {
68
68
  aggregates: ClusterAggregate[];
69
69
  click: ClusterClick;
70
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>;
71
74
  /** Compiled `get-cluster-*` accessors (through the same cache as the host's). */
72
75
  accessors: Partial<Record<ClusterAccessorProp, ClusterAccessor | unknown>>;
73
76
  /** Their update-trigger fingerprints, keyed like `accessors`. */
@@ -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
+ }
@@ -1,4 +1,4 @@
1
- import { a4 as p, a5 as d } from "./index-C-YAnesV.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-C-YAnesV.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-C-YAnesV.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) {
@@ -1,4 +1,4 @@
1
- import { bB as Bt, bM as Xt, bN as Yt, bO as Us } from "./index-C-YAnesV.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-C-YAnesV.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-C-YAnesV.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-C-YAnesV.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-C-YAnesV.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);