@nika-js/onlymap 0.13.4 → 0.13.5
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 +12 -0
- package/README.md +2 -2
- package/dist/actions.d.ts +12 -6
- package/dist/attribute-resolution.d.ts +32 -4
- package/dist/{basemap-BiC_RwbV.js → basemap-CErNEhX6.js} +2 -2
- package/dist/{build-DQCmcQE1.js → build-ByNIb4VX.js} +1 -1
- package/dist/{client-C0CgEs_P.js → client-xe2E4jg4.js} +2 -2
- package/dist/ctx.d.ts +2 -0
- package/dist/{geoparquet-DbVJrJYG.js → geoparquet-DOhMQl-X.js} +1 -1
- package/dist/{globe-view-CrGbvqqZ.js → globe-view-84s_uNZX.js} +1 -1
- package/dist/{hillshade-CGY_OBaG.js → hillshade-D8h8CRQq.js} +2 -2
- package/dist/{hillshade-shader-w8tmFgaV.js → hillshade-shader-Bm1O0P76.js} +1 -1
- package/dist/{index-QrGqSW_H.js → index-4Y4Q7RP4.js} +3 -3
- package/dist/{index-DrCMvhhr.js → index-BG_49YHy.js} +19732 -19592
- package/dist/{index-GfvWJDX0.js → index-DTN2CcOQ.js} +11 -11
- package/dist/{index-ChoEWeXU.js → index-DXxQu9Xi.js} +1 -1
- package/dist/{index-Cm2sfhw7.js → index-D_EiGesl.js} +1 -1
- package/dist/{index-Dtsf-TPD.js → index-DrSCLk9i.js} +12 -12
- package/dist/{index-2lD29y87.js → index-J_Sj6T0S.js} +25 -25
- package/dist/index-bpdGuZR6.js +478 -0
- package/dist/{index-xF9sKoMB.js → index-phbljJTZ.js} +3 -3
- package/dist/ir-snapshot.d.ts +2 -0
- package/dist/ir.d.ts +18 -0
- package/dist/{lerc-DxujwTm7.js → lerc-DLWS3sYw.js} +1 -1
- package/dist/onlymap.standalone.js +35477 -35321
- package/dist/onlymapjs.js +13 -13
- package/dist/plane-gpu/plane-basemap.d.ts +79 -79
- package/dist/plane-vector/plane-mvt-layer.d.ts +79 -79
- package/dist/{post-process-effect-BL9rBDEh.js → post-process-effect-CHsD0-oP.js} +1 -1
- package/dist/programmatic.d.ts +4 -0
- package/dist/{raster-Bq768NZr.js → raster-B7ILGg0X.js} +4 -4
- package/dist/{raster-pipeline-C898iYqw.js → raster-pipeline-avMAbONM.js} +2 -2
- package/dist/react/om-layer.d.ts +4 -0
- package/dist/react.js +67 -65
- package/dist/serialize/emit.d.ts +2 -0
- package/dist/serialize/index.d.ts +2 -0
- package/dist/{terrain-inspect-DNZO8z6S.js → terrain-inspect-FKTVm7nv.js} +1 -1
- package/dist/{text-on-path-owfh8Ac6.js → text-on-path-CpHM02Fs.js} +19 -18
- package/dist/{vector-style-BlnKzVND.js → vector-style-CPvUSy2F.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CMWiR63-.js → zarr-DpbT4eyF.js} +2 -2
- package/dist/zoom-gates.d.ts +60 -0
- package/docs/cartograph.md +2 -2
- package/llms.txt +1 -0
- package/onlymapjs.attributes.json +2 -0
- package/onlymapjs.html-data.json +16 -0
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +2 -1
- package/skills/onlymapjs/references/syntax.md +30 -3
- package/dist/index-Bdltig68.js +0 -459
package/dist/react.js
CHANGED
|
@@ -3,10 +3,10 @@ var Ie = (r, e, s) => e in r ? Be(r, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var be = (r, e, s) => Ie(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
4
|
import { jsxs as se, jsx as E } from "react/jsx-runtime";
|
|
5
5
|
import { createContext as Ke, useContext as We, forwardRef as He, useRef as g, useState as x, useId as Oe, useCallback as ie, useMemo as D, useLayoutEffect as he, useEffect as w, useImperativeHandle as Ne, useSyncExternalStore as we } from "react";
|
|
6
|
-
import { MANAGED_SLOTS as Ve, slotContainerStyle as qe, FOLD_SIDES as N, MapController as
|
|
6
|
+
import { MANAGED_SLOTS as Ve, slotContainerStyle as qe, FOLD_SIDES as N, MapController as Ze, parseWidgetStyle as Ge, foldToggleSlot as Je, foldToggleStyle as Ye, foldPanelStyle as Xe, foldDrawerStyle as Ue, resolveFoldBreakpointPx as Qe, shouldFoldAtWidth as et, effectiveFoldBreakpointPx as tt, DEFAULT_FOLD_BREAKPOINT_PX as rt, bottomEndLiftPx as nt, FOLD_BOTTOM_CLEARANCE_PX as ot, resolveSlot as st, foldSideForSlot as it, isStoreToken as at } from "@nika-js/onlymap";
|
|
7
7
|
import { createPortal as Re } from "react-dom";
|
|
8
8
|
const Ee = Ke(null);
|
|
9
|
-
function
|
|
9
|
+
function X(r) {
|
|
10
10
|
const e = We(Ee);
|
|
11
11
|
if (!e) throw new Error(`[onlymapjs] ${r} must be rendered inside <OmMap>.`);
|
|
12
12
|
return e;
|
|
@@ -17,8 +17,8 @@ function ae(r, e) {
|
|
|
17
17
|
return s.length !== o.length ? !1 : s.every((i) => r[i] === e[i]);
|
|
18
18
|
}
|
|
19
19
|
function ct(r, e) {
|
|
20
|
-
const { props: s, updateTriggers: o, ...i } = r, { props: b, updateTriggers:
|
|
21
|
-
return ae(i, d) && ae(s, b) && ae(o,
|
|
20
|
+
const { props: s, updateTriggers: o, ...i } = r, { props: b, updateTriggers: m, ...d } = e;
|
|
21
|
+
return ae(i, d) && ae(s, b) && ae(o, m);
|
|
22
22
|
}
|
|
23
23
|
class lt {
|
|
24
24
|
constructor(e) {
|
|
@@ -33,19 +33,19 @@ class lt {
|
|
|
33
33
|
this.descriptors.delete(e) && this.controller.setLayers([...this.descriptors.values()]);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const Y = Ve, ut = Object.fromEntries(Y.map((r) => [r, qe(r)])), ve = { display: "flex", pointerEvents: "none", order: 2147483647 }, dt = Object.fromEntries(N.map((r) => [r, null]));
|
|
37
37
|
function ft(r) {
|
|
38
38
|
const e = r.querySelector(
|
|
39
39
|
'button:not([disabled]),a[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])'
|
|
40
40
|
);
|
|
41
41
|
e ? e.focus() : (r.tabIndex = -1, r.focus());
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function mt(r, e) {
|
|
44
44
|
return Object.entries(e).some(([s, o]) => o !== void 0 && r[s] !== o);
|
|
45
45
|
}
|
|
46
46
|
const Rt = He(function(e, s) {
|
|
47
|
-
const { center: o, zoom: i, pitch: b, bearing:
|
|
48
|
-
() => Object.fromEntries(
|
|
47
|
+
const { center: o, zoom: i, pitch: b, bearing: m, basemap: d, projection: f, crs: h, crsDef: p, basemapKey: $, attribution: P, headless: c, widgetStyle: S, widgetsHidden: v, widgetsFold: O = !0, className: T, style: A, children: z } = e, C = g(null), j = g(null), [l, F] = x(null), [M, K] = x(null), [B, ce] = x(
|
|
48
|
+
() => Object.fromEntries(Y.map((t) => [t, null]))
|
|
49
49
|
), [L, Ce] = x(!1), [V, Fe] = x({ lift: 0, shift: 0 }), [le, xe] = x(dt), [Te, je] = x(
|
|
50
50
|
() => Object.fromEntries(N.map((t) => [t, 0]))
|
|
51
51
|
), [ke, U] = x(null), ue = `om-react-fold-${Oe().replaceAll(":", "")}`, De = g(new Map(N.map((t) => [t, /* @__PURE__ */ new Set()]))), $e = g(/* @__PURE__ */ new Map()), [de, Me] = x(() => /* @__PURE__ */ new Set()), fe = c ? JSON.stringify(c) : "", q = g({
|
|
@@ -55,7 +55,7 @@ const Rt = He(function(e, s) {
|
|
|
55
55
|
K((n) => n === t ? n : t);
|
|
56
56
|
}, []), _e = D(
|
|
57
57
|
() => Object.fromEntries(
|
|
58
|
-
|
|
58
|
+
Y.map((t) => [
|
|
59
59
|
t,
|
|
60
60
|
(n) => {
|
|
61
61
|
ce((a) => a[t] === n ? a : { ...a, [t]: n });
|
|
@@ -73,10 +73,10 @@ const Rt = He(function(e, s) {
|
|
|
73
73
|
])
|
|
74
74
|
),
|
|
75
75
|
[]
|
|
76
|
-
),
|
|
76
|
+
), me = ie((t, n, a) => {
|
|
77
77
|
const u = De.current.get(t), y = u.size;
|
|
78
78
|
a ? u.add(n) : u.delete(n), u.size !== y && je((R) => ({ ...R, [t]: u.size }));
|
|
79
|
-
}, []),
|
|
79
|
+
}, []), pe = ie((t, n, a) => {
|
|
80
80
|
const u = $e.current;
|
|
81
81
|
a ? u.set(n, t) : u.delete(n);
|
|
82
82
|
const y = new Set(u.values());
|
|
@@ -96,26 +96,26 @@ const Rt = He(function(e, s) {
|
|
|
96
96
|
}, [O, fe, de]), w(() => {
|
|
97
97
|
(!L || v) && U(null);
|
|
98
98
|
}, [L, v]);
|
|
99
|
-
const ye = g({ center: o, zoom: i, pitch: b, bearing:
|
|
100
|
-
ye.current = { center: o, zoom: i, pitch: b, bearing:
|
|
101
|
-
const
|
|
102
|
-
|
|
99
|
+
const ye = g({ center: o, zoom: i, pitch: b, bearing: m });
|
|
100
|
+
ye.current = { center: o, zoom: i, pitch: b, bearing: m };
|
|
101
|
+
const Z = g(e.onReady);
|
|
102
|
+
Z.current = e.onReady;
|
|
103
103
|
const _ = g(e.onViewStateChange);
|
|
104
104
|
_.current = e.onViewStateChange;
|
|
105
|
-
const
|
|
106
|
-
|
|
105
|
+
const G = g(e.onRuntimeError);
|
|
106
|
+
G.current = e.onRuntimeError;
|
|
107
107
|
const Q = g(d);
|
|
108
108
|
Q.current = d;
|
|
109
109
|
const ee = g(f);
|
|
110
110
|
ee.current = f;
|
|
111
|
-
const W = g({ crs: h, crsDef:
|
|
112
|
-
W.current = { crs: h, crsDef:
|
|
111
|
+
const W = g({ crs: h, crsDef: p });
|
|
112
|
+
W.current = { crs: h, crsDef: p };
|
|
113
113
|
const te = g(""), re = g(void 0), ne = g(void 0);
|
|
114
114
|
he(() => {
|
|
115
115
|
if (!j.current) return;
|
|
116
116
|
const t = ye.current;
|
|
117
117
|
ne.current = Q.current, re.current = ee.current, te.current = `${W.current.crs ?? ""}|${W.current.crsDef ?? ""}`;
|
|
118
|
-
const n = new
|
|
118
|
+
const n = new Ze(j.current, {
|
|
119
119
|
center: t.center,
|
|
120
120
|
zoom: t.zoom,
|
|
121
121
|
pitch: t.pitch,
|
|
@@ -133,14 +133,14 @@ const Rt = He(function(e, s) {
|
|
|
133
133
|
},
|
|
134
134
|
onRuntimeError: (u) => {
|
|
135
135
|
var y;
|
|
136
|
-
return (y =
|
|
136
|
+
return (y = G.current) == null ? void 0 : y.call(G, u);
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
F(n);
|
|
140
140
|
let a = !0;
|
|
141
141
|
return n.ready.then(() => {
|
|
142
142
|
var u;
|
|
143
|
-
a && ((u =
|
|
143
|
+
a && ((u = Z.current) == null || u.call(Z));
|
|
144
144
|
}), () => {
|
|
145
145
|
a = !1, F(null), n.destroy();
|
|
146
146
|
};
|
|
@@ -149,13 +149,13 @@ const Rt = He(function(e, s) {
|
|
|
149
149
|
}, [l, d]), w(() => {
|
|
150
150
|
!l || re.current === f || (re.current = f, l.setProjection(f ?? null));
|
|
151
151
|
}, [l, f]), w(() => {
|
|
152
|
-
const t = `${h ?? ""}|${
|
|
153
|
-
!l || te.current === t || (te.current = t, l.setCrs(h ?? null,
|
|
154
|
-
}, [l, h,
|
|
152
|
+
const t = `${h ?? ""}|${p ?? ""}`;
|
|
153
|
+
!l || te.current === t || (te.current = t, l.setCrs(h ?? null, p ?? null));
|
|
154
|
+
}, [l, h, p]), Ne(s, () => l, [l]), w(() => {
|
|
155
155
|
if (!l) return;
|
|
156
|
-
const t = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: b, bearing:
|
|
157
|
-
|
|
158
|
-
}, [l, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, b,
|
|
156
|
+
const t = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: b, bearing: m };
|
|
157
|
+
mt(l.getViewState(), t) && l.setView(t);
|
|
158
|
+
}, [l, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, b, m]), w(() => {
|
|
159
159
|
var t;
|
|
160
160
|
if (l)
|
|
161
161
|
return (t = _.current) == null || t.call(_, l.getViewState()), l.getStore("viewport").subscribe(() => {
|
|
@@ -163,12 +163,12 @@ const Rt = He(function(e, s) {
|
|
|
163
163
|
return (n = _.current) == null ? void 0 : n.call(_, l.getViewState());
|
|
164
164
|
});
|
|
165
165
|
}, [l]);
|
|
166
|
-
const I = B["bottom-start"],
|
|
166
|
+
const I = B["bottom-start"], J = B["bottom-end"];
|
|
167
167
|
w(() => {
|
|
168
168
|
const t = C.current;
|
|
169
|
-
if (!t || !
|
|
169
|
+
if (!t || !J || typeof ResizeObserver > "u") return;
|
|
170
170
|
const n = () => {
|
|
171
|
-
const u = parseFloat(getComputedStyle(t).getPropertyValue("--om-widget-gap-y")) || 8, y =
|
|
171
|
+
const u = parseFloat(getComputedStyle(t).getPropertyValue("--om-widget-gap-y")) || 8, y = J.getBoundingClientRect(), R = nt(
|
|
172
172
|
(I == null ? void 0 : I.getBoundingClientRect()) ?? null,
|
|
173
173
|
y,
|
|
174
174
|
L ? ot : 0,
|
|
@@ -176,8 +176,8 @@ const Rt = He(function(e, s) {
|
|
|
176
176
|
), k = R + Math.ceil(y.height) + u;
|
|
177
177
|
Fe((H) => H.lift === R && H.shift === k ? H : { lift: R, shift: k });
|
|
178
178
|
}, a = new ResizeObserver(n);
|
|
179
|
-
return a.observe(t), a.observe(
|
|
180
|
-
}, [I,
|
|
179
|
+
return a.observe(t), a.observe(J), I && a.observe(I), n(), () => a.disconnect();
|
|
180
|
+
}, [I, J, L]);
|
|
181
181
|
const ze = D(
|
|
182
182
|
() => ({
|
|
183
183
|
position: "absolute",
|
|
@@ -189,12 +189,12 @@ const Rt = He(function(e, s) {
|
|
|
189
189
|
// drawer root reads it through foldDrawerStyle's max() (same wiring
|
|
190
190
|
// as the HTML lane's widget layer).
|
|
191
191
|
"--om-fold-bottom-shift": `${V.shift}px`,
|
|
192
|
-
...S ?
|
|
192
|
+
...S ? Ge(S).properties : void 0
|
|
193
193
|
}),
|
|
194
194
|
[S, V.shift]
|
|
195
195
|
), oe = D(() => l ? new lt(l) : null, [l]), ge = D(
|
|
196
|
-
() => l && oe && M ? { controller: l, layers: oe, overlayPane: M, corners: B, widgetsHidden: !!v, widgetsFolded: L, foldPanels: le, registerFoldedWidget:
|
|
197
|
-
[l, oe, M, B, v, L, le,
|
|
196
|
+
() => l && oe && M ? { controller: l, layers: oe, overlayPane: M, corners: B, widgetsHidden: !!v, widgetsFolded: L, foldPanels: le, registerFoldedWidget: me, registerSlotWidget: pe } : null,
|
|
197
|
+
[l, oe, M, B, v, L, le, me, pe]
|
|
198
198
|
);
|
|
199
199
|
return /* @__PURE__ */ se("div", { ref: C, className: T, style: { position: "relative", overflow: "hidden", ...A }, children: [
|
|
200
200
|
/* @__PURE__ */ E("div", { ref: j, style: { position: "absolute", inset: 0 } }),
|
|
@@ -205,7 +205,7 @@ const Rt = He(function(e, s) {
|
|
|
205
205
|
style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
|
|
206
206
|
}
|
|
207
207
|
),
|
|
208
|
-
/* @__PURE__ */ E("div", { "data-om-widget-layer": "", style: ze, children:
|
|
208
|
+
/* @__PURE__ */ E("div", { "data-om-widget-layer": "", style: ze, children: Y.map((t) => /* @__PURE__ */ se(
|
|
209
209
|
"div",
|
|
210
210
|
{
|
|
211
211
|
"data-om-widget-slot": t,
|
|
@@ -215,7 +215,7 @@ const Rt = He(function(e, s) {
|
|
|
215
215
|
...V.lift > 0 && t === "bottom-end" ? { bottom: `calc(var(--om-widget-inset-y, 12px) + ${V.lift}px)` } : void 0
|
|
216
216
|
},
|
|
217
217
|
children: [
|
|
218
|
-
L && N.filter((n) =>
|
|
218
|
+
L && N.filter((n) => Je(n) === t && Te[n] > 0).map((n) => {
|
|
219
219
|
const a = ke === n;
|
|
220
220
|
return /* @__PURE__ */ se(
|
|
221
221
|
"div",
|
|
@@ -235,7 +235,7 @@ const Rt = He(function(e, s) {
|
|
|
235
235
|
"aria-expanded": a,
|
|
236
236
|
"aria-controls": `${ue}-${n}`,
|
|
237
237
|
"aria-label": `${a ? "Close" : "Open"} ${n} map controls`,
|
|
238
|
-
style:
|
|
238
|
+
style: Ye(),
|
|
239
239
|
onClick: () => {
|
|
240
240
|
U(a ? null : n), a || requestAnimationFrame(() => {
|
|
241
241
|
var y;
|
|
@@ -255,7 +255,7 @@ const Rt = He(function(e, s) {
|
|
|
255
255
|
role: "region",
|
|
256
256
|
"aria-label": `${n} map controls`,
|
|
257
257
|
hidden: !a,
|
|
258
|
-
style: { ...
|
|
258
|
+
style: { ...Xe(n), display: a ? "flex" : "none" }
|
|
259
259
|
}
|
|
260
260
|
)
|
|
261
261
|
]
|
|
@@ -295,6 +295,8 @@ const Rt = He(function(e, s) {
|
|
|
295
295
|
data: "data",
|
|
296
296
|
label: "label",
|
|
297
297
|
color: "color",
|
|
298
|
+
listed: "listed",
|
|
299
|
+
minZoomField: "minZoomField",
|
|
298
300
|
filterField: "filterField",
|
|
299
301
|
filterRange: "filterRange",
|
|
300
302
|
filterSoftRange: "filterSoftRange",
|
|
@@ -317,47 +319,47 @@ const Rt = He(function(e, s) {
|
|
|
317
319
|
crs: "crs",
|
|
318
320
|
crsDef: "crsDef",
|
|
319
321
|
updateTriggers: "updateTriggers"
|
|
320
|
-
},
|
|
322
|
+
}, pt = /* @__PURE__ */ new Set([...Object.keys(Pe), "onClick", "onHover"]);
|
|
321
323
|
function yt(r) {
|
|
322
324
|
const e = {};
|
|
323
325
|
for (const [o, i] of Object.entries(r))
|
|
324
|
-
!
|
|
326
|
+
!pt.has(o) && i !== void 0 && (e[o] = i);
|
|
325
327
|
const s = {};
|
|
326
328
|
for (const [o, i] of Object.entries(Pe))
|
|
327
329
|
s[i] = r[o];
|
|
328
330
|
return Object.keys(e).length > 0 && (s.props = e), s;
|
|
329
331
|
}
|
|
330
332
|
function Et(r) {
|
|
331
|
-
const { controller: e, layers: s } =
|
|
333
|
+
const { controller: e, layers: s } = X("OmLayer"), { id: o } = r, i = yt(r);
|
|
332
334
|
w(() => {
|
|
333
335
|
s.upsert(i);
|
|
334
336
|
}), w(() => () => s.remove(o), [s, o]);
|
|
335
337
|
const b = g(r.onClick);
|
|
336
338
|
b.current = r.onClick;
|
|
337
|
-
const
|
|
338
|
-
return
|
|
339
|
+
const m = g(r.onHover);
|
|
340
|
+
return m.current = r.onHover, w(
|
|
339
341
|
() => e.watchPicks((d) => {
|
|
340
|
-
var f, h,
|
|
342
|
+
var f, h, p;
|
|
341
343
|
if (d === null) {
|
|
342
|
-
(f =
|
|
344
|
+
(f = m.current) == null || f.call(m, null);
|
|
343
345
|
return;
|
|
344
346
|
}
|
|
345
|
-
d.layerId === o && (d.type === "click" ? (h = b.current) == null || h.call(b, d) : (
|
|
347
|
+
d.layerId === o && (d.type === "click" ? (h = b.current) == null || h.call(b, d) : (p = m.current) == null || p.call(m, d));
|
|
346
348
|
}),
|
|
347
349
|
[e, o]
|
|
348
350
|
), null;
|
|
349
351
|
}
|
|
350
352
|
function Pt({ position: r = "top-start", order: e, fold: s, className: o, style: i, children: b }) {
|
|
351
|
-
const { corners:
|
|
353
|
+
const { corners: m, widgetsHidden: d, widgetsFolded: f, foldPanels: h, registerFoldedWidget: p, registerSlotWidget: $ } = X("OmWidget"), P = Oe(), c = st(r) ?? "top-start", S = f && c !== "manual" && s !== "never", v = c === "manual" ? null : it(c);
|
|
352
354
|
if (w(() => {
|
|
353
355
|
if (v)
|
|
354
|
-
return
|
|
355
|
-
}, [v, P, S,
|
|
356
|
+
return p(v, P, S), () => p(v, P, !1);
|
|
357
|
+
}, [v, P, S, p]), w(() => {
|
|
356
358
|
if (c !== "manual")
|
|
357
359
|
return $(c, P, !0), () => $(c, P, !1);
|
|
358
360
|
}, [c, P, $]), c === "manual")
|
|
359
361
|
return /* @__PURE__ */ E("div", { className: o, style: { pointerEvents: "auto", ...i }, children: b });
|
|
360
|
-
const O = S && v ? h[v] :
|
|
362
|
+
const O = S && v ? h[v] : m[c];
|
|
361
363
|
return O ? Re(
|
|
362
364
|
/* @__PURE__ */ E(
|
|
363
365
|
"div",
|
|
@@ -395,9 +397,9 @@ const bt = {
|
|
|
395
397
|
"bottom-right": "translate(-100%, -100%)"
|
|
396
398
|
};
|
|
397
399
|
function Ct(r) {
|
|
398
|
-
const { controller: e, overlayPane: s } =
|
|
400
|
+
const { controller: e, overlayPane: s } = X("OmOverlay"), o = g(null), i = g(void 0), b = g(r);
|
|
399
401
|
b.current = r;
|
|
400
|
-
const
|
|
402
|
+
const m = D(() => {
|
|
401
403
|
const c = e.getStore("selection");
|
|
402
404
|
let S, v, O = null;
|
|
403
405
|
return {
|
|
@@ -408,9 +410,9 @@ function Ct(r) {
|
|
|
408
410
|
}
|
|
409
411
|
};
|
|
410
412
|
}, [e]), d = we(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
413
|
+
m.subscribe,
|
|
414
|
+
m.getSnapshot,
|
|
415
|
+
m.getSnapshot
|
|
414
416
|
);
|
|
415
417
|
w(
|
|
416
418
|
() => e.registerOverlay((c, S, v) => {
|
|
@@ -433,7 +435,7 @@ function Ct(r) {
|
|
|
433
435
|
), w(() => {
|
|
434
436
|
e.refreshOverlays();
|
|
435
437
|
});
|
|
436
|
-
const { children: f, className: h, style:
|
|
438
|
+
const { children: f, className: h, style: p, interactive: $ = !0 } = r, P = typeof f == "function" ? f(d) : f;
|
|
437
439
|
return Re(
|
|
438
440
|
/* @__PURE__ */ E(
|
|
439
441
|
"div",
|
|
@@ -448,7 +450,7 @@ function Ct(r) {
|
|
|
448
450
|
// hidden until the first flush positions it — never flashes at the origin
|
|
449
451
|
willChange: "transform",
|
|
450
452
|
pointerEvents: $ ? "auto" : "none",
|
|
451
|
-
...
|
|
453
|
+
...p
|
|
452
454
|
},
|
|
453
455
|
children: P
|
|
454
456
|
}
|
|
@@ -457,19 +459,19 @@ function Ct(r) {
|
|
|
457
459
|
);
|
|
458
460
|
}
|
|
459
461
|
function Ft(r = []) {
|
|
460
|
-
const { controller: e } =
|
|
461
|
-
const
|
|
462
|
+
const { controller: e } = X("useOmMap"), s = r.join(" "), o = D(() => {
|
|
463
|
+
const m = (s ? s.split(" ") : []).flatMap((f) => at(f) ? [e.getStore(f)] : (console.warn(`[onlymapjs] useOmMap: "${f}" is not a watch token on the React front-end — expected viewport, selection, layers, or data:<layerId>.`), []));
|
|
462
464
|
let d;
|
|
463
465
|
return {
|
|
464
466
|
subscribe: (f) => {
|
|
465
|
-
const h =
|
|
467
|
+
const h = m.map((p) => p.subscribe(f));
|
|
466
468
|
return () => {
|
|
467
|
-
for (const
|
|
469
|
+
for (const p of h) p();
|
|
468
470
|
};
|
|
469
471
|
},
|
|
470
472
|
getSnapshot: () => {
|
|
471
|
-
const f =
|
|
472
|
-
return (!d || f.some((h,
|
|
473
|
+
const f = m.map((h) => h.getSnapshot());
|
|
474
|
+
return (!d || f.some((h, p) => h !== d[p])) && (d = f), d;
|
|
473
475
|
}
|
|
474
476
|
};
|
|
475
477
|
}, [e, s]), i = we(o.subscribe, o.getSnapshot, o.getSnapshot);
|
package/dist/serialize/emit.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface EmitContext {
|
|
|
16
16
|
metresPerPixel: number;
|
|
17
17
|
/** Above this many emitted elements the caller is told to simplify. */
|
|
18
18
|
featureBudget: number;
|
|
19
|
+
/** The capture zoom — rows below their `min-zoom-field` value at it are left out, as on screen. Absent = no gating. */
|
|
20
|
+
zoom?: number;
|
|
19
21
|
}
|
|
20
22
|
export interface EmitResult {
|
|
21
23
|
markup: string;
|
|
@@ -51,6 +51,8 @@ export interface SerializeOptions {
|
|
|
51
51
|
effectDpi?: number;
|
|
52
52
|
featureBudget?: number;
|
|
53
53
|
measureText?: MeasureText;
|
|
54
|
+
/** The capture zoom: layers outside their `visible-zoom-range` and rows below their `min-zoom-field` value are left out, as on screen. Absent = neither gate applies. */
|
|
55
|
+
zoom?: number;
|
|
54
56
|
}
|
|
55
57
|
export interface SerializeResult {
|
|
56
58
|
svg: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a3 as p, a4 as w, a5 as E, a6 as P, a7 as D, a8 as T, a9 as b, aa as k } from "./index-
|
|
1
|
+
import { a3 as p, a4 as w, a5 as E, a6 as P, a7 as D, a8 as T, a9 as b, aa as k } from "./index-BG_49YHy.js";
|
|
2
2
|
const v = [-11e3, 9e3], A = 126, x = 24, R = 32, S = 1;
|
|
3
3
|
async function H(e, i) {
|
|
4
4
|
const a = p(e), o = a.flatMap((t, n) => t.extent ? a.slice(n + 1).map((h) => [t, h]) : []), [r, s] = await Promise.all([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as N, am as E } from "./index-
|
|
2
|
-
const z = Math.PI / 180, O = 45,
|
|
1
|
+
import { c as N, am as E } from "./index-BG_49YHy.js";
|
|
2
|
+
const z = Math.PI / 180, O = 45, j = 24, T = /* @__PURE__ */ new Map();
|
|
3
3
|
let P = null;
|
|
4
|
-
function
|
|
4
|
+
function I(e) {
|
|
5
5
|
if (typeof document > "u") return null;
|
|
6
6
|
if (!P) {
|
|
7
7
|
const o = document.createElement("canvas");
|
|
@@ -9,16 +9,16 @@ function W(e) {
|
|
|
9
9
|
}
|
|
10
10
|
return P && (P.font = e), P;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function W(e, o, t) {
|
|
13
13
|
const n = `${t} 100px ${o}`;
|
|
14
14
|
let r = T.get(n);
|
|
15
15
|
r || (r = /* @__PURE__ */ new Map(), T.set(n, r));
|
|
16
16
|
const f = r.get(e);
|
|
17
17
|
if (f !== void 0) return f;
|
|
18
|
-
const u =
|
|
18
|
+
const u = I(n), a = u ? u.measureText(e).width / 100 : 0.6;
|
|
19
19
|
return r.set(e, a), a;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function _(e) {
|
|
22
22
|
const o = [0];
|
|
23
23
|
let t = 0;
|
|
24
24
|
for (let n = 1; n < e.length; n++)
|
|
@@ -41,7 +41,7 @@ function C(e, o, t) {
|
|
|
41
41
|
const n = (o + 90) * z;
|
|
42
42
|
return [e[0] + Math.cos(n) * t, e[1] - Math.sin(n) * t];
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function k(e) {
|
|
45
45
|
return e === "auto" ? "auto" : e === "start" ? "end" : e === "end" ? "start" : "middle";
|
|
46
46
|
}
|
|
47
47
|
function L(e) {
|
|
@@ -54,7 +54,7 @@ function L(e) {
|
|
|
54
54
|
}
|
|
55
55
|
return o;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function D(e, o, t, n, r, f, u) {
|
|
58
58
|
let a = r;
|
|
59
59
|
const l = [];
|
|
60
60
|
for (let g = 0; g < t.length; g++) {
|
|
@@ -80,16 +80,16 @@ function S(e, o, t, n, r, f, u, a) {
|
|
|
80
80
|
}
|
|
81
81
|
function F(e, o, t) {
|
|
82
82
|
if (e.length < 2 || !o) return [];
|
|
83
|
-
const n =
|
|
83
|
+
const n = _(e);
|
|
84
84
|
if (!(n.total > 0)) return [];
|
|
85
|
-
const r = [...o], f = r.map((i) =>
|
|
85
|
+
const r = [...o], f = r.map((i) => W(i, t.fontFamily, t.fontWeight) * t.sizePx + t.letterSpacing), u = f.reduce((i, h) => i + h, 0) - t.letterSpacing;
|
|
86
86
|
if (u > n.total) return [];
|
|
87
87
|
const a = n.total - u, l = Number.isFinite(t.maxAngle) ? Math.max(0, t.maxAngle) : O, g = t.orientation === "chord" ? "chord" : "curve", c = (i) => i === "start" ? 0 : i === "end" ? a : a / 2, s = c(t.placement === "auto" ? "middle" : t.placement), p = w(e, n, s), x = w(e, n, s + u);
|
|
88
88
|
if (p && x && x.position[0] < p.position[0]) {
|
|
89
89
|
const i = [...e].reverse();
|
|
90
|
-
return F(i, o, { ...t, placement:
|
|
90
|
+
return F(i, o, { ...t, placement: k(t.placement), offsetPx: -t.offsetPx });
|
|
91
91
|
}
|
|
92
|
-
const v = (i) => g === "chord" ? S(e, n, r, f, i, u, t.offsetPx, t.letterSpacing) :
|
|
92
|
+
const v = (i) => g === "chord" ? S(e, n, r, f, i, u, t.offsetPx, t.letterSpacing) : D(e, n, r, f, i, t.offsetPx, t.letterSpacing);
|
|
93
93
|
if (t.placement !== "auto") {
|
|
94
94
|
const i = v(c(t.placement));
|
|
95
95
|
if (g === "curve" && L(i) > l) {
|
|
@@ -99,7 +99,7 @@ function F(e, o, t) {
|
|
|
99
99
|
return i;
|
|
100
100
|
}
|
|
101
101
|
let b = [], m = 1 / 0;
|
|
102
|
-
const d = a > 0 ?
|
|
102
|
+
const d = a > 0 ? j : 1;
|
|
103
103
|
for (let i = 0; i < d; i++) {
|
|
104
104
|
const h = d === 1 ? 0 : a * i / (d - 1), y = v(h);
|
|
105
105
|
if (!y.length) continue;
|
|
@@ -122,7 +122,7 @@ function M(e, o, t, n, r) {
|
|
|
122
122
|
return r;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function G(e) {
|
|
126
126
|
const o = (r) => Array.isArray(r) && Number.isFinite(r[0]) && Number.isFinite(r[1]);
|
|
127
127
|
if (e.every(o)) return e;
|
|
128
128
|
let t = [], n = [];
|
|
@@ -170,7 +170,7 @@ class B extends N {
|
|
|
170
170
|
if (!o || !o.width) return null;
|
|
171
171
|
const t = Array.isArray(this.props.data) ? this.props.data : [], r = ["auto", "start", "middle", "end"].includes(this.props.placement) ? this.props.placement : "auto", f = this.props.orientation === "chord" ? "chord" : "curve", u = Number(this.props.maxAngle), a = this.props.fontFamily ?? "sans-serif", l = this.props.fontWeight ?? "normal", g = this.props.maxLabels ?? 2e3, c = [];
|
|
172
172
|
for (let s = 0; s < t.length && c.length < g; s++) {
|
|
173
|
-
const p = t[s], x = M(this.props.getPath, p, s, t, void 0), v = Array.isArray(x) ?
|
|
173
|
+
const p = t[s], x = M(this.props.getPath, p, s, t, void 0), v = Array.isArray(x) ? G(x) : void 0, b = String(M(this.props.getText, p, s, t, "") ?? "");
|
|
174
174
|
if (!v || v.length < 2 || !b) continue;
|
|
175
175
|
const m = Number(M(this.props.getSize, p, s, t, 14)) || 14, d = M(this.props.getColor, p, s, t, [30, 30, 30, 255]), i = v.map((h) => o.project([h[0], h[1]]).slice(0, 2));
|
|
176
176
|
for (const h of F(i, b, {
|
|
@@ -190,7 +190,8 @@ class B extends N {
|
|
|
190
190
|
angle: h.angle,
|
|
191
191
|
size: m,
|
|
192
192
|
color: Array.isArray(d) ? d : [30, 30, 30, 255],
|
|
193
|
-
row: s
|
|
193
|
+
row: s,
|
|
194
|
+
__source: { parent: this, index: s, object: p }
|
|
194
195
|
}), c.length >= g) break;
|
|
195
196
|
}
|
|
196
197
|
}
|
|
@@ -217,9 +218,9 @@ class B extends N {
|
|
|
217
218
|
}
|
|
218
219
|
export {
|
|
219
220
|
B as OmTextOnPathLayer,
|
|
220
|
-
|
|
221
|
+
W as charAdvance,
|
|
221
222
|
L as maxGlyphTurn,
|
|
222
|
-
|
|
223
|
+
_ as pathMetrics,
|
|
223
224
|
F as placeTextOnPath,
|
|
224
225
|
w as pointAtDistance
|
|
225
226
|
};
|
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-avMAbONM.js";
|
|
2
|
+
import { c as gr } from "./index-BG_49YHy.js";
|
|
3
3
|
import $t from "./index-CW1n5LdO.js";
|
|
4
4
|
var Et;
|
|
5
5
|
function h(e, t, n) {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two zoom gates — the layer-level `visible-zoom-range` test, and the
|
|
3
|
+
* per-feature minimum zoom (`min-zoom-field`, public issue #25). For the
|
|
4
|
+
* latter, the pieces
|
|
5
|
+
* shared by the filter wiring (attribute-resolution), the per-camera-move
|
|
6
|
+
* gate (runtime-core's buildLayers) and the vector serializer. Kept free of
|
|
7
|
+
* deck imports so the serializer stays a pure IR → SVG module.
|
|
8
|
+
*
|
|
9
|
+
* The mechanism: one extra numeric slot of the layer's always-mounted
|
|
10
|
+
* DataFilterExtension holds each row's min zoom; its `filterRange` slot is
|
|
11
|
+
* `[floor, zoom]`, set from the live camera. A plain prop — a uniform in deck,
|
|
12
|
+
* so a zoom step never recomputes an accessor, uploads data, or touches the
|
|
13
|
+
* document.
|
|
14
|
+
*/
|
|
15
|
+
import type { MinZoomGate } from "./ir";
|
|
16
|
+
/** `visible-zoom-range`'s gate — min inclusive, max exclusive (minzoom/maxzoom convention). */
|
|
17
|
+
export declare function zoomInVisibleRange(range: [number, number], zoom: number): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The slot's lower bound, and the value a row with no usable min zoom gets
|
|
20
|
+
* (so it draws at every zoom). Finite, not -Infinity: with an authored
|
|
21
|
+
* `filter-soft-range` deck's shader runs smoothstep over EVERY slot, and an
|
|
22
|
+
* infinite edge there is NaN on real GPUs.
|
|
23
|
+
*/
|
|
24
|
+
export declare const MIN_ZOOM_FLOOR = -1000000;
|
|
25
|
+
/** The slot before the runtime gates it (and in headless / snapshot IR): every row passes. */
|
|
26
|
+
export declare const MIN_ZOOM_OPEN: [number, number];
|
|
27
|
+
/** Its soft-margin twin — edges OUTSIDE the range on both sides, which deck's shader reads as "no soft margin on this slot" (see gateMinZoomProps). */
|
|
28
|
+
export declare const MIN_ZOOM_SOFT_OPEN: [number, number];
|
|
29
|
+
/**
|
|
30
|
+
* A row's min zoom as the GPU sees it: a finite number — numeric strings
|
|
31
|
+
* included, as deck's float attribute would read them — else the floor, so a
|
|
32
|
+
* missing, null or non-numeric value draws at every zoom rather than
|
|
33
|
+
* silently disappearing.
|
|
34
|
+
*/
|
|
35
|
+
export declare function minZoomValue(raw: unknown): number;
|
|
36
|
+
/**
|
|
37
|
+
* Why `min-zoom-field` cannot apply to this layer, or undefined when it can.
|
|
38
|
+
* Clustering is the other case: the cluster index counts every row, so a
|
|
39
|
+
* bubble would count (and expand to) features the gate hides — and
|
|
40
|
+
* clustering is already a zoom-driven declutter of its own.
|
|
41
|
+
*/
|
|
42
|
+
export declare function minZoomFieldUnsupported(type: string, clustered: boolean): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Whether a row with this raw min-zoom value draws at `zoom` — the CPU twin of
|
|
45
|
+
* the shader's test, for the serializer. Both sides go through float32, as
|
|
46
|
+
* they do on the GPU (attribute and uniform), so `minzoom: 12.8` at zoom 12.8
|
|
47
|
+
* is drawn in both places.
|
|
48
|
+
*/
|
|
49
|
+
export declare function drawnAtZoom(raw: unknown, zoom: number): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The per-camera-move half: the `filterRange` (and, when the layer has
|
|
52
|
+
* authored soft margins, `filterSoftRange`) with the min-zoom slot set to
|
|
53
|
+
* `[floor, zoom]`.
|
|
54
|
+
*
|
|
55
|
+
* `props` is the layer's FINAL prop bag (the per-frame channel already
|
|
56
|
+
* merged), so a `populate` sweep's own `filterRange` — sized to the authored
|
|
57
|
+
* dimensions only — is padded out to the full packed shape here, rather than
|
|
58
|
+
* every effect having to know about the slot.
|
|
59
|
+
*/
|
|
60
|
+
export declare function gateMinZoomProps(props: Record<string, unknown>, gate: MinZoomGate, zoom: number): Record<string, unknown>;
|
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.13.
|
|
26
|
-
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.13.
|
|
25
|
+
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.13.5/dist/cartograph.standalone.js"></script>
|
|
26
|
+
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.13.5/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
|
@@ -58,6 +58,7 @@ Programmatic/native bridge rule: `MapController.setLayers()` accepts normal func
|
|
|
58
58
|
- 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.
|
|
59
59
|
- Data in a local grid (eastings/northings: British National Grid, SVY21, State Plane, UTM) is converted to lng/lat at load. A file that names its CRS needs nothing (shapefile `.prj`, FlatGeobuf/GeoParquet header, legacy GeoJSON `crs` member); otherwise declare it on the layer, which also overrides the file: `crs="EPSG:27700"` (or `crs-def="+proj=…"` for a grid with no code). Typical: `<om-layer type="ScatterplotLayer" data="./sites.csv" crs="EPSG:3414" get-position="[$easting, $northing]">`. Never guessed: big coordinates with no CRS → a diagnostic naming the fix; a declared grid on degree data → a warning. UTM zones and common national grids are bundled; any other EPSG code is fetched once from `https://epsg.io/<code>.proj4` by the reader's browser (GeoTIFF/Zarr layers make the same lookup), `OmMap.configureCrs({ online: false })` turns that off. `crs` on a LAYER = what the data is in; `crs` on `<om-map>` = the projection the map is drawn in; they combine.
|
|
60
60
|
- 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.
|
|
61
|
+
- Per-feature min zoom: `min-zoom-field="minzoom"` on ANY layer type — each feature draws only while zoom ≥ its value in that property (inclusive, fractional; missing/null/non-numeric = always drawn). GPU-side against the live camera, so features appear during a zoom; never written to the document. The way to stage labels by zoom — do NOT script `om-view-changed` → `filter-range` rewrites. Not a data filter: ctx filter state and stats ignore it. Uses one of the 4 GPU filter slots (≤ 3 `filter-fields` alongside). Not on tiled/aggregation layers or with `cluster="true"` (ignored with a warning). Descriptor/React: `minZoomField`, `listed: false`. `listed="false"` keeps a helper layer (e.g. hidden-label dots) out of the legend and layer-switcher while it stays in ctx.layers and actions.
|
|
61
62
|
- 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`. Over an image, make the count a badge: `cluster-label-position="top-right"` (or any edge/corner; default `center`) + `cluster-label-background="#111827"` (a pill; absent = a dark halo), with `cluster-label-color`/`cluster-label-size`; `cluster-label="false"` hides it. 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]`).
|
|
62
63
|
- 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.
|
|
63
64
|
- 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.
|