@nika-js/onlymap 0.12.1 → 0.13.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 (61) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +1 -1
  3. package/dist/{basemap-BK25o5OE.js → basemap-zG1-omic.js} +473 -443
  4. package/dist/basemap.d.ts +16 -3
  5. package/dist/build-Bbi4SleC.js +208 -0
  6. package/dist/cartograph.js +43 -41
  7. package/dist/cartograph.standalone.js +3 -1
  8. package/dist/client-CIH6ToMI.js +6878 -0
  9. package/dist/{geoparquet-CLydPm2f.js → geoparquet-CyWsYt9S.js} +1 -1
  10. package/dist/{globe-view-ChuX60M5.js → globe-view-Xelgj_KW.js} +6 -6
  11. package/dist/{hillshade-DD8WFrvf.js → hillshade-Zbg50lm6.js} +79 -67
  12. package/dist/hillshade.d.ts +7 -0
  13. package/dist/html-data.d.ts +1 -1
  14. package/dist/{index-CgVFHEdM.js → index-6eeSlSqN.js} +3 -3
  15. package/dist/{index-CMKrghNb.js → index-BL_YCKiW.js} +54 -54
  16. package/dist/{index-C2CKUsom.js → index-BbVnkgld.js} +38 -38
  17. package/dist/{index-CvrH6mbS.js → index-BtRsa5oc.js} +3 -3
  18. package/dist/{index-DIzzRLKr.js → index-BwtXeP_F.js} +1 -1
  19. package/dist/{index-Dvwr1Y3o.js → index-ClAPAqcm.js} +49 -49
  20. package/dist/{index-Bs69fn8a.js → index-CpFNIkOO.js} +33429 -30673
  21. package/dist/{index-CdAf0bLj.js → index-DnCmvLuC.js} +42 -42
  22. package/dist/index-JFuN4DCn.js +4449 -0
  23. package/dist/layer-registry.d.ts +1 -0
  24. package/dist/{lerc-mAijS40k.js → lerc-C3SKC6CU.js} +1 -1
  25. package/dist/onlymap.standalone.js +60762 -51701
  26. package/dist/onlymapjs.js +47 -47
  27. package/dist/plane-gpu/gpu-layer-types.d.ts +35 -0
  28. package/dist/plane-gpu/plane-basemap.d.ts +10461 -0
  29. package/dist/plane-gpu/plane-gpu-view.d.ts +90 -0
  30. package/dist/plane-gpu/projection-params.d.ts +47 -0
  31. package/dist/plane-layers.d.ts +2 -0
  32. package/dist/plane-seam.d.ts +48 -0
  33. package/dist/plane-tileset.d.ts +23 -2
  34. package/dist/plane-vector/build.d.ts +107 -0
  35. package/dist/plane-vector/client.d.ts +18 -0
  36. package/dist/plane-vector/cut-ends-extension.d.ts +30 -0
  37. package/dist/plane-vector/plane-mvt-layer.d.ts +10412 -0
  38. package/dist/plane-vector/tile-cut.d.ts +45 -0
  39. package/dist/plane-vector/worker.d.ts +15 -0
  40. package/dist/plane-warp.d.ts +12 -1
  41. package/dist/{post-process-effect-rwFDi8di.js → post-process-effect-C3P9VwC9.js} +11 -11
  42. package/dist/programmatic.d.ts +6 -0
  43. package/dist/projection.d.ts +51 -0
  44. package/dist/{raster-CXIqf83L.js → raster-BgCnz9-Z.js} +3 -3
  45. package/dist/{raster-pipeline-CfSg2Re7.js → raster-pipeline-CKdpKgFo.js} +1 -1
  46. package/dist/react/om-map.d.ts +4 -0
  47. package/dist/react.js +259 -252
  48. package/dist/runtime-core.d.ts +84 -2
  49. package/dist/{text-on-path-B08PekFz.js → text-on-path-BpVLX8Yt.js} +74 -66
  50. package/dist/version.d.ts +1 -1
  51. package/dist/{zarr-CUn2udOc.js → zarr-Cur_pzNa.js} +2 -2
  52. package/docs/cartograph.md +2 -2
  53. package/docs/cartography.md +59 -3
  54. package/docs/testing.md +2 -1
  55. package/llms.txt +2 -2
  56. package/onlymapjs.attributes.json +1 -0
  57. package/onlymapjs.html-data.json +15 -1
  58. package/package.json +3 -2
  59. package/skills/onlymapjs/SKILL.md +2 -2
  60. package/skills/onlymapjs/references/syntax.md +7 -6
  61. package/dist/index-BHRpKnGi.js +0 -4883
package/dist/react.js CHANGED
@@ -1,177 +1,184 @@
1
- var _e = Object.defineProperty;
2
- var $e = (t, e, s) => e in t ? _e(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var me = (t, e, s) => $e(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { jsxs as re, jsx as C } from "react/jsx-runtime";
5
- import { createContext as Ae, useContext as ze, forwardRef as Be, useRef as y, useState as T, useId as he, useCallback as ne, useMemo as _, useLayoutEffect as ge, useEffect as E, useImperativeHandle as Ie, useSyncExternalStore as ve } from "react";
6
- import { MANAGED_SLOTS as Ke, slotContainerStyle as We, FOLD_SIDES as W, MapController as He, parseWidgetStyle as Ne, foldToggleSlot as Ve, foldToggleStyle as qe, foldPanelStyle as Ge, foldDrawerStyle as Je, resolveFoldBreakpointPx as Ye, shouldFoldAtWidth as Xe, effectiveFoldBreakpointPx as Ze, DEFAULT_FOLD_BREAKPOINT_PX as Ue, bottomEndLiftPx as Qe, FOLD_BOTTOM_CLEARANCE_PX as et, resolveSlot as tt, foldSideForSlot as rt, isStoreToken as nt } from "@nika-js/onlymap";
7
- import { createPortal as Se } from "react-dom";
8
- const Oe = Ae(null);
9
- function Y(t) {
10
- const e = ze(Oe);
11
- if (!e) throw new Error(`[onlymapjs] ${t} must be rendered inside <OmMap>.`);
1
+ var Be = Object.defineProperty;
2
+ var Ie = (r, e, s) => e in r ? Be(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var be = (r, e, s) => Ie(r, typeof e != "symbol" ? e + "" : e, s);
4
+ import { jsxs as se, jsx as E } from "react/jsx-runtime";
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 Ge, parseWidgetStyle as Je, foldToggleSlot as Ye, foldToggleStyle as Xe, foldPanelStyle as Ze, 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
+ import { createPortal as Re } from "react-dom";
8
+ const Ee = Ke(null);
9
+ function Z(r) {
10
+ const e = We(Ee);
11
+ if (!e) throw new Error(`[onlymapjs] ${r} must be rendered inside <OmMap>.`);
12
12
  return e;
13
13
  }
14
- function oe(t, e) {
15
- if (t === e) return !0;
16
- const s = Object.keys(t ?? {}), o = Object.keys(e ?? {});
17
- return s.length !== o.length ? !1 : s.every((i) => t[i] === e[i]);
14
+ function ae(r, e) {
15
+ if (r === e) return !0;
16
+ const s = Object.keys(r ?? {}), o = Object.keys(e ?? {});
17
+ return s.length !== o.length ? !1 : s.every((i) => r[i] === e[i]);
18
18
  }
19
- function ot(t, e) {
20
- const { props: s, updateTriggers: o, ...i } = t, { props: g, updateTriggers: p, ...u } = e;
21
- return oe(i, u) && oe(s, g) && oe(o, p);
19
+ function ct(r, e) {
20
+ const { props: s, updateTriggers: o, ...i } = r, { props: b, updateTriggers: p, ...d } = e;
21
+ return ae(i, d) && ae(s, b) && ae(o, p);
22
22
  }
23
- class st {
23
+ class lt {
24
24
  constructor(e) {
25
- me(this, "descriptors", /* @__PURE__ */ new Map());
25
+ be(this, "descriptors", /* @__PURE__ */ new Map());
26
26
  this.controller = e;
27
27
  }
28
28
  upsert(e) {
29
29
  const s = this.descriptors.get(e.id);
30
- s && ot(s, e) || (this.descriptors.set(e.id, e), this.controller.setLayers([...this.descriptors.values()]));
30
+ s && ct(s, e) || (this.descriptors.set(e.id, e), this.controller.setLayers([...this.descriptors.values()]));
31
31
  }
32
32
  remove(e) {
33
33
  this.descriptors.delete(e) && this.controller.setLayers([...this.descriptors.values()]);
34
34
  }
35
35
  }
36
- const J = Ke, it = Object.fromEntries(J.map((t) => [t, We(t)])), ye = { display: "flex", pointerEvents: "none", order: 2147483647 }, at = Object.fromEntries(W.map((t) => [t, null]));
37
- function lt(t) {
38
- const e = t.querySelector(
36
+ const X = Ve, ut = Object.fromEntries(X.map((r) => [r, qe(r)])), ve = { display: "flex", pointerEvents: "none", order: 2147483647 }, dt = Object.fromEntries(N.map((r) => [r, null]));
37
+ function ft(r) {
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
- e ? e.focus() : (t.tabIndex = -1, t.focus());
41
+ e ? e.focus() : (r.tabIndex = -1, r.focus());
42
42
  }
43
- function ct(t, e) {
44
- return Object.entries(e).some(([s, o]) => o !== void 0 && t[s] !== o);
43
+ function pt(r, e) {
44
+ return Object.entries(e).some(([s, o]) => o !== void 0 && r[s] !== o);
45
45
  }
46
- const vt = Be(function(e, s) {
47
- const { center: o, zoom: i, pitch: g, bearing: p, basemap: u, projection: f, basemapKey: v, attribution: b, headless: S, widgetStyle: P, widgetsHidden: d, widgetsFold: h = !0, className: O, style: w, children: j } = e, F = y(null), k = y(null), [l, $] = T(null), [B, M] = T(null), [L, I] = T(
48
- () => Object.fromEntries(J.map((r) => [r, null]))
49
- ), [x, se] = T(!1), [H, Re] = T({ lift: 0, shift: 0 }), [ie, Ee] = T(at), [Pe, Ce] = T(
50
- () => Object.fromEntries(W.map((r) => [r, 0]))
51
- ), [Fe, X] = T(null), ae = `om-react-fold-${he().replaceAll(":", "")}`, xe = y(new Map(W.map((r) => [r, /* @__PURE__ */ new Set()]))), Te = y(/* @__PURE__ */ new Map()), [le, je] = T(() => /* @__PURE__ */ new Set()), ce = S ? JSON.stringify(S) : "", N = y({
46
+ const Rt = He(function(e, s) {
47
+ const { center: o, zoom: i, pitch: b, bearing: p, basemap: d, projection: f, crs: h, crsDef: m, 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(X.map((t) => [t, null]))
49
+ ), [L, Ce] = x(!1), [V, Fe] = x({ lift: 0, shift: 0 }), [le, xe] = x(dt), [Te, je] = x(
50
+ () => Object.fromEntries(N.map((t) => [t, 0]))
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({
52
52
  badge: null,
53
53
  attribution: null
54
- }), ke = ne((r) => {
55
- M((n) => n === r ? n : r);
56
- }, []), Me = _(
54
+ }), Le = ie((t) => {
55
+ K((n) => n === t ? n : t);
56
+ }, []), _e = D(
57
57
  () => Object.fromEntries(
58
- J.map((r) => [
59
- r,
58
+ X.map((t) => [
59
+ t,
60
60
  (n) => {
61
- I((a) => a[r] === n ? a : { ...a, [r]: n });
61
+ ce((a) => a[t] === n ? a : { ...a, [t]: n });
62
62
  }
63
63
  ])
64
64
  ),
65
65
  []
66
- ), Le = _(
66
+ ), Ae = D(
67
67
  () => Object.fromEntries(
68
- W.map((r) => [
69
- r,
68
+ N.map((t) => [
69
+ t,
70
70
  (n) => {
71
- Ee((a) => a[r] === n ? a : { ...a, [r]: n });
71
+ xe((a) => a[t] === n ? a : { ...a, [t]: n });
72
72
  }
73
73
  ])
74
74
  ),
75
75
  []
76
- ), de = ne((r, n, a) => {
77
- const c = xe.current.get(r), m = c.size;
78
- a ? c.add(n) : c.delete(n), c.size !== m && Ce((R) => ({ ...R, [r]: c.size }));
79
- }, []), ue = ne((r, n, a) => {
80
- const c = Te.current;
81
- a ? c.set(n, r) : c.delete(n);
82
- const m = new Set(c.values());
83
- je((R) => R.size === m.size && [...m].every((D) => R.has(D)) ? R : m);
76
+ ), pe = ie((t, n, a) => {
77
+ const u = De.current.get(t), y = u.size;
78
+ a ? u.add(n) : u.delete(n), u.size !== y && je((R) => ({ ...R, [t]: u.size }));
79
+ }, []), me = ie((t, n, a) => {
80
+ const u = $e.current;
81
+ a ? u.set(n, t) : u.delete(n);
82
+ const y = new Set(u.values());
83
+ Me((R) => R.size === y.size && [...y].every((k) => R.has(k)) ? R : y);
84
84
  }, []);
85
- ge(() => {
86
- const r = F.current;
87
- if (!r) return;
88
- let n, a = Ue;
89
- const c = (R) => {
90
- const D = getComputedStyle(r).getPropertyValue("--om-widget-fold-breakpoint").trim();
91
- D !== n && (n = D, a = Ye(D, r)), se((K) => h && Xe(R, Ze(a, le), K));
85
+ he(() => {
86
+ const t = C.current;
87
+ if (!t) return;
88
+ let n, a = rt;
89
+ const u = (R) => {
90
+ const k = getComputedStyle(t).getPropertyValue("--om-widget-fold-breakpoint").trim();
91
+ k !== n && (n = k, a = Qe(k, t)), Ce((H) => O && et(R, tt(a, de), H));
92
92
  };
93
- if (c(r.getBoundingClientRect().width || (S ? S === !0 ? 800 : S.width ?? 800 : 0)), typeof ResizeObserver > "u") return;
94
- const m = new ResizeObserver(([R]) => c(R.contentRect.width));
95
- return m.observe(r), () => m.disconnect();
96
- }, [h, ce, le]), E(() => {
97
- (!x || d) && X(null);
98
- }, [x, d]);
99
- const fe = y({ center: o, zoom: i, pitch: g, bearing: p });
100
- fe.current = { center: o, zoom: i, pitch: g, bearing: p };
101
- const V = y(e.onReady);
102
- V.current = e.onReady;
103
- const A = y(e.onViewStateChange);
104
- A.current = e.onViewStateChange;
105
- const q = y(e.onRuntimeError);
106
- q.current = e.onRuntimeError;
107
- const Z = y(u);
108
- Z.current = u;
109
- const U = y(f);
110
- U.current = f;
111
- const Q = y(void 0), ee = y(void 0);
112
- ge(() => {
113
- if (!k.current) return;
114
- const r = fe.current;
115
- ee.current = Z.current, Q.current = U.current;
116
- const n = new He(k.current, {
117
- center: r.center,
118
- zoom: r.zoom,
119
- pitch: r.pitch,
120
- bearing: r.bearing,
121
- basemap: Z.current,
122
- projection: U.current,
123
- basemapKey: v,
124
- attribution: b,
125
- headless: S ? S === !0 ? {} : S : void 0,
93
+ if (u(t.getBoundingClientRect().width || (c ? c === !0 ? 800 : c.width ?? 800 : 0)), typeof ResizeObserver > "u") return;
94
+ const y = new ResizeObserver(([R]) => u(R.contentRect.width));
95
+ return y.observe(t), () => y.disconnect();
96
+ }, [O, fe, de]), w(() => {
97
+ (!L || v) && U(null);
98
+ }, [L, v]);
99
+ const ye = g({ center: o, zoom: i, pitch: b, bearing: p });
100
+ ye.current = { center: o, zoom: i, pitch: b, bearing: p };
101
+ const G = g(e.onReady);
102
+ G.current = e.onReady;
103
+ const _ = g(e.onViewStateChange);
104
+ _.current = e.onViewStateChange;
105
+ const J = g(e.onRuntimeError);
106
+ J.current = e.onRuntimeError;
107
+ const Q = g(d);
108
+ Q.current = d;
109
+ const ee = g(f);
110
+ ee.current = f;
111
+ const W = g({ crs: h, crsDef: m });
112
+ W.current = { crs: h, crsDef: m };
113
+ const te = g(""), re = g(void 0), ne = g(void 0);
114
+ he(() => {
115
+ if (!j.current) return;
116
+ const t = ye.current;
117
+ ne.current = Q.current, re.current = ee.current, te.current = `${W.current.crs ?? ""}|${W.current.crsDef ?? ""}`;
118
+ const n = new Ge(j.current, {
119
+ center: t.center,
120
+ zoom: t.zoom,
121
+ pitch: t.pitch,
122
+ bearing: t.bearing,
123
+ basemap: Q.current,
124
+ projection: ee.current,
125
+ crs: W.current.crs,
126
+ crsDef: W.current.crsDef,
127
+ basemapKey: $,
128
+ attribution: P,
129
+ headless: c ? c === !0 ? {} : c : void 0,
126
130
  chromeHosts: {
127
- badge: N.current.badge ?? void 0,
128
- attribution: N.current.attribution ?? void 0
131
+ badge: q.current.badge ?? void 0,
132
+ attribution: q.current.attribution ?? void 0
129
133
  },
130
- onRuntimeError: (c) => {
131
- var m;
132
- return (m = q.current) == null ? void 0 : m.call(q, c);
134
+ onRuntimeError: (u) => {
135
+ var y;
136
+ return (y = J.current) == null ? void 0 : y.call(J, u);
133
137
  }
134
138
  });
135
- $(n);
139
+ F(n);
136
140
  let a = !0;
137
141
  return n.ready.then(() => {
138
- var c;
139
- a && ((c = V.current) == null || c.call(V));
142
+ var u;
143
+ a && ((u = G.current) == null || u.call(G));
140
144
  }), () => {
141
- a = !1, $(null), n.destroy();
145
+ a = !1, F(null), n.destroy();
142
146
  };
143
- }, [ce]), E(() => {
144
- !l || ee.current === u || (ee.current = u, l.setBasemap(u ?? null));
145
- }, [l, u]), E(() => {
146
- !l || Q.current === f || (Q.current = f, l.setProjection(f ?? null));
147
- }, [l, f]), Ie(s, () => l, [l]), E(() => {
147
+ }, [fe]), w(() => {
148
+ !l || ne.current === d || (ne.current = d, l.setBasemap(d ?? null));
149
+ }, [l, d]), w(() => {
150
+ !l || re.current === f || (re.current = f, l.setProjection(f ?? null));
151
+ }, [l, f]), w(() => {
152
+ const t = `${h ?? ""}|${m ?? ""}`;
153
+ !l || te.current === t || (te.current = t, l.setCrs(h ?? null, m ?? null));
154
+ }, [l, h, m]), Ne(s, () => l, [l]), w(() => {
148
155
  if (!l) return;
149
- const r = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: g, bearing: p };
150
- ct(l.getViewState(), r) && l.setView(r);
151
- }, [l, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, g, p]), E(() => {
152
- var r;
156
+ const t = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: b, bearing: p };
157
+ pt(l.getViewState(), t) && l.setView(t);
158
+ }, [l, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, b, p]), w(() => {
159
+ var t;
153
160
  if (l)
154
- return (r = A.current) == null || r.call(A, l.getViewState()), l.getStore("viewport").subscribe(() => {
161
+ return (t = _.current) == null || t.call(_, l.getViewState()), l.getStore("viewport").subscribe(() => {
155
162
  var n;
156
- return (n = A.current) == null ? void 0 : n.call(A, l.getViewState());
163
+ return (n = _.current) == null ? void 0 : n.call(_, l.getViewState());
157
164
  });
158
165
  }, [l]);
159
- const z = L["bottom-start"], G = L["bottom-end"];
160
- E(() => {
161
- const r = F.current;
162
- if (!r || !G || typeof ResizeObserver > "u") return;
166
+ const I = B["bottom-start"], Y = B["bottom-end"];
167
+ w(() => {
168
+ const t = C.current;
169
+ if (!t || !Y || typeof ResizeObserver > "u") return;
163
170
  const n = () => {
164
- const c = parseFloat(getComputedStyle(r).getPropertyValue("--om-widget-gap-y")) || 8, m = G.getBoundingClientRect(), R = Qe(
165
- (z == null ? void 0 : z.getBoundingClientRect()) ?? null,
166
- m,
167
- x ? et : 0,
168
- c
169
- ), D = R + Math.ceil(m.height) + c;
170
- Re((K) => K.lift === R && K.shift === D ? K : { lift: R, shift: D });
171
+ const u = parseFloat(getComputedStyle(t).getPropertyValue("--om-widget-gap-y")) || 8, y = Y.getBoundingClientRect(), R = nt(
172
+ (I == null ? void 0 : I.getBoundingClientRect()) ?? null,
173
+ y,
174
+ L ? ot : 0,
175
+ u
176
+ ), k = R + Math.ceil(y.height) + u;
177
+ Fe((H) => H.lift === R && H.shift === k ? H : { lift: R, shift: k });
171
178
  }, a = new ResizeObserver(n);
172
- return a.observe(r), a.observe(G), z && a.observe(z), n(), () => a.disconnect();
173
- }, [z, G, x]);
174
- const De = _(
179
+ return a.observe(t), a.observe(Y), I && a.observe(I), n(), () => a.disconnect();
180
+ }, [I, Y, L]);
181
+ const ze = D(
175
182
  () => ({
176
183
  position: "absolute",
177
184
  inset: 0,
@@ -181,74 +188,74 @@ const vt = Be(function(e, s) {
181
188
  // Measured clearance for the floating bottom drawer toggle — the
182
189
  // drawer root reads it through foldDrawerStyle's max() (same wiring
183
190
  // as the HTML lane's widget layer).
184
- "--om-fold-bottom-shift": `${H.shift}px`,
185
- ...P ? Ne(P).properties : void 0
191
+ "--om-fold-bottom-shift": `${V.shift}px`,
192
+ ...S ? Je(S).properties : void 0
186
193
  }),
187
- [P, H.shift]
188
- ), te = _(() => l ? new st(l) : null, [l]), pe = _(
189
- () => l && te && B ? { controller: l, layers: te, overlayPane: B, corners: L, widgetsHidden: !!d, widgetsFolded: x, foldPanels: ie, registerFoldedWidget: de, registerSlotWidget: ue } : null,
190
- [l, te, B, L, d, x, ie, de, ue]
194
+ [S, V.shift]
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: pe, registerSlotWidget: me } : null,
197
+ [l, oe, M, B, v, L, le, pe, me]
191
198
  );
192
- return /* @__PURE__ */ re("div", { ref: F, className: O, style: { position: "relative", overflow: "hidden", ...w }, children: [
193
- /* @__PURE__ */ C("div", { ref: k, style: { position: "absolute", inset: 0 } }),
194
- /* @__PURE__ */ C(
199
+ return /* @__PURE__ */ se("div", { ref: C, className: T, style: { position: "relative", overflow: "hidden", ...A }, children: [
200
+ /* @__PURE__ */ E("div", { ref: j, style: { position: "absolute", inset: 0 } }),
201
+ /* @__PURE__ */ E(
195
202
  "div",
196
203
  {
197
- ref: ke,
204
+ ref: Le,
198
205
  style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
199
206
  }
200
207
  ),
201
- /* @__PURE__ */ C("div", { "data-om-widget-layer": "", style: De, children: J.map((r) => /* @__PURE__ */ re(
208
+ /* @__PURE__ */ E("div", { "data-om-widget-layer": "", style: ze, children: X.map((t) => /* @__PURE__ */ se(
202
209
  "div",
203
210
  {
204
- "data-om-widget-slot": r,
205
- ref: Me[r],
211
+ "data-om-widget-slot": t,
212
+ ref: _e[t],
206
213
  style: {
207
- ...it[r],
208
- ...H.lift > 0 && r === "bottom-end" ? { bottom: `calc(var(--om-widget-inset-y, 12px) + ${H.lift}px)` } : void 0
214
+ ...ut[t],
215
+ ...V.lift > 0 && t === "bottom-end" ? { bottom: `calc(var(--om-widget-inset-y, 12px) + ${V.lift}px)` } : void 0
209
216
  },
210
217
  children: [
211
- x && W.filter((n) => Ve(n) === r && Pe[n] > 0).map((n) => {
212
- const a = Fe === n;
213
- return /* @__PURE__ */ re(
218
+ L && N.filter((n) => Ye(n) === t && Te[n] > 0).map((n) => {
219
+ const a = ke === n;
220
+ return /* @__PURE__ */ se(
214
221
  "div",
215
222
  {
216
223
  "data-om-fold-drawer": n,
217
- style: { ...Je(n), display: d ? "none" : "flex" },
218
- onKeyDown: (c) => {
219
- var m;
220
- c.key !== "Escape" || !a || (X(null), (m = c.currentTarget.querySelector("[data-om-fold-toggle]")) == null || m.focus(), c.preventDefault(), c.stopPropagation());
224
+ style: { ...Ue(n), display: v ? "none" : "flex" },
225
+ onKeyDown: (u) => {
226
+ var y;
227
+ u.key !== "Escape" || !a || (U(null), (y = u.currentTarget.querySelector("[data-om-fold-toggle]")) == null || y.focus(), u.preventDefault(), u.stopPropagation());
221
228
  },
222
229
  children: [
223
- /* @__PURE__ */ C(
230
+ /* @__PURE__ */ E(
224
231
  "button",
225
232
  {
226
233
  type: "button",
227
234
  "data-om-fold-toggle": n,
228
235
  "aria-expanded": a,
229
- "aria-controls": `${ae}-${n}`,
236
+ "aria-controls": `${ue}-${n}`,
230
237
  "aria-label": `${a ? "Close" : "Open"} ${n} map controls`,
231
- style: qe(),
238
+ style: Xe(),
232
239
  onClick: () => {
233
- X(a ? null : n), a || requestAnimationFrame(() => {
234
- var m;
235
- const c = (m = F.current) == null ? void 0 : m.querySelector(`[data-om-fold-panel="${n}"]`);
236
- c && lt(c);
240
+ U(a ? null : n), a || requestAnimationFrame(() => {
241
+ var y;
242
+ const u = (y = C.current) == null ? void 0 : y.querySelector(`[data-om-fold-panel="${n}"]`);
243
+ u && ft(u);
237
244
  });
238
245
  },
239
246
  children: "⋯"
240
247
  }
241
248
  ),
242
- /* @__PURE__ */ C(
249
+ /* @__PURE__ */ E(
243
250
  "div",
244
251
  {
245
- id: `${ae}-${n}`,
246
- ref: Le[n],
252
+ id: `${ue}-${n}`,
253
+ ref: Ae[n],
247
254
  "data-om-fold-panel": n,
248
255
  role: "region",
249
256
  "aria-label": `${n} map controls`,
250
257
  hidden: !a,
251
- style: { ...Ge(n), display: a ? "flex" : "none" }
258
+ style: { ...Ze(n), display: a ? "flex" : "none" }
252
259
  }
253
260
  )
254
261
  ]
@@ -256,33 +263,33 @@ const vt = Be(function(e, s) {
256
263
  `fold-${n}`
257
264
  );
258
265
  }),
259
- r === "bottom-start" && /* @__PURE__ */ C(
266
+ t === "bottom-start" && /* @__PURE__ */ E(
260
267
  "div",
261
268
  {
262
269
  "data-om-mandated-chrome": "badge",
263
270
  ref: (n) => {
264
- N.current.badge = n;
271
+ q.current.badge = n;
265
272
  },
266
- style: ye
273
+ style: ve
267
274
  }
268
275
  ),
269
- r === "bottom-end" && /* @__PURE__ */ C(
276
+ t === "bottom-end" && /* @__PURE__ */ E(
270
277
  "div",
271
278
  {
272
279
  "data-om-mandated-chrome": "attribution",
273
280
  ref: (n) => {
274
- N.current.attribution = n;
281
+ q.current.attribution = n;
275
282
  },
276
- style: ye
283
+ style: ve
277
284
  }
278
285
  )
279
286
  ]
280
287
  },
281
- r
288
+ t
282
289
  )) }),
283
- pe && /* @__PURE__ */ C(Oe.Provider, { value: pe, children: j })
290
+ ge && /* @__PURE__ */ E(Ee.Provider, { value: ge, children: z })
284
291
  ] });
285
- }), we = {
292
+ }), Pe = {
286
293
  id: "id",
287
294
  type: "type",
288
295
  data: "data",
@@ -310,73 +317,73 @@ const vt = Be(function(e, s) {
310
317
  crs: "crs",
311
318
  crsDef: "crsDef",
312
319
  updateTriggers: "updateTriggers"
313
- }, dt = /* @__PURE__ */ new Set([...Object.keys(we), "onClick", "onHover"]);
314
- function ut(t) {
320
+ }, mt = /* @__PURE__ */ new Set([...Object.keys(Pe), "onClick", "onHover"]);
321
+ function yt(r) {
315
322
  const e = {};
316
- for (const [o, i] of Object.entries(t))
317
- !dt.has(o) && i !== void 0 && (e[o] = i);
323
+ for (const [o, i] of Object.entries(r))
324
+ !mt.has(o) && i !== void 0 && (e[o] = i);
318
325
  const s = {};
319
- for (const [o, i] of Object.entries(we))
320
- s[i] = t[o];
326
+ for (const [o, i] of Object.entries(Pe))
327
+ s[i] = r[o];
321
328
  return Object.keys(e).length > 0 && (s.props = e), s;
322
329
  }
323
- function St(t) {
324
- const { controller: e, layers: s } = Y("OmLayer"), { id: o } = t, i = ut(t);
325
- E(() => {
330
+ function Et(r) {
331
+ const { controller: e, layers: s } = Z("OmLayer"), { id: o } = r, i = yt(r);
332
+ w(() => {
326
333
  s.upsert(i);
327
- }), E(() => () => s.remove(o), [s, o]);
328
- const g = y(t.onClick);
329
- g.current = t.onClick;
330
- const p = y(t.onHover);
331
- return p.current = t.onHover, E(
332
- () => e.watchPicks((u) => {
333
- var f, v, b;
334
- if (u === null) {
334
+ }), w(() => () => s.remove(o), [s, o]);
335
+ const b = g(r.onClick);
336
+ b.current = r.onClick;
337
+ const p = g(r.onHover);
338
+ return p.current = r.onHover, w(
339
+ () => e.watchPicks((d) => {
340
+ var f, h, m;
341
+ if (d === null) {
335
342
  (f = p.current) == null || f.call(p, null);
336
343
  return;
337
344
  }
338
- u.layerId === o && (u.type === "click" ? (v = g.current) == null || v.call(g, u) : (b = p.current) == null || b.call(p, u));
345
+ d.layerId === o && (d.type === "click" ? (h = b.current) == null || h.call(b, d) : (m = p.current) == null || m.call(p, d));
339
346
  }),
340
347
  [e, o]
341
348
  ), null;
342
349
  }
343
- function Ot({ position: t = "top-start", order: e, fold: s, className: o, style: i, children: g }) {
344
- const { corners: p, widgetsHidden: u, widgetsFolded: f, foldPanels: v, registerFoldedWidget: b, registerSlotWidget: S } = Y("OmWidget"), P = he(), d = tt(t) ?? "top-start", h = f && d !== "manual" && s !== "never", O = d === "manual" ? null : rt(d);
345
- if (E(() => {
346
- if (O)
347
- return b(O, P, h), () => b(O, P, !1);
348
- }, [O, P, h, b]), E(() => {
349
- if (d !== "manual")
350
- return S(d, P, !0), () => S(d, P, !1);
351
- }, [d, P, S]), d === "manual")
352
- return /* @__PURE__ */ C("div", { className: o, style: { pointerEvents: "auto", ...i }, children: g });
353
- const w = h && O ? v[O] : p[d];
354
- return w ? Se(
355
- /* @__PURE__ */ C(
350
+ function Pt({ position: r = "top-start", order: e, fold: s, className: o, style: i, children: b }) {
351
+ const { corners: p, widgetsHidden: d, widgetsFolded: f, foldPanels: h, registerFoldedWidget: m, registerSlotWidget: $ } = Z("OmWidget"), P = Oe(), c = st(r) ?? "top-start", S = f && c !== "manual" && s !== "never", v = c === "manual" ? null : it(c);
352
+ if (w(() => {
353
+ if (v)
354
+ return m(v, P, S), () => m(v, P, !1);
355
+ }, [v, P, S, m]), w(() => {
356
+ if (c !== "manual")
357
+ return $(c, P, !0), () => $(c, P, !1);
358
+ }, [c, P, $]), c === "manual")
359
+ return /* @__PURE__ */ E("div", { className: o, style: { pointerEvents: "auto", ...i }, children: b });
360
+ const O = S && v ? h[v] : p[c];
361
+ return O ? Re(
362
+ /* @__PURE__ */ E(
356
363
  "div",
357
364
  {
358
365
  "data-om-react-widget": "",
359
- "data-om-fold-origin-slot": h ? d : void 0,
366
+ "data-om-fold-origin-slot": S ? c : void 0,
360
367
  className: o,
361
368
  style: {
362
369
  ...e !== void 0 ? { order: e } : void 0,
363
370
  ...i,
364
- pointerEvents: u ? "none" : (i == null ? void 0 : i.pointerEvents) ?? "auto",
365
- visibility: u ? "hidden" : i == null ? void 0 : i.visibility
371
+ pointerEvents: d ? "none" : (i == null ? void 0 : i.pointerEvents) ?? "auto",
372
+ visibility: d ? "hidden" : i == null ? void 0 : i.visibility
366
373
  },
367
- children: g
374
+ children: b
368
375
  }
369
376
  ),
370
- w
377
+ O
371
378
  ) : null;
372
379
  }
373
- function ft(t, e) {
374
- return e !== void 0 && e < 0 && t.isGeospatial !== !1;
380
+ function gt(r, e) {
381
+ return e !== void 0 && e < 0 && r.isGeospatial !== !1;
375
382
  }
376
- function be(t, e, s, o) {
377
- return e && (t == null ? void 0 : t.layerId) !== e ? !1 : !s || (t ? t.type : o) === s;
383
+ function Se(r, e, s, o) {
384
+ return e && (r == null ? void 0 : r.layerId) !== e ? !1 : !s || (r ? r.type : o) === s;
378
385
  }
379
- const pt = {
386
+ const bt = {
380
387
  "top-left": "translate(0, 0)",
381
388
  "top-center": "translate(-50%, 0)",
382
389
  "top-right": "translate(-100%, 0)",
@@ -387,52 +394,52 @@ const pt = {
387
394
  "bottom-center": "translate(-50%, -100%)",
388
395
  "bottom-right": "translate(-100%, -100%)"
389
396
  };
390
- function wt(t) {
391
- const { controller: e, overlayPane: s } = Y("OmOverlay"), o = y(null), i = y(void 0), g = y(t);
392
- g.current = t;
393
- const p = _(() => {
394
- const d = e.getStore("selection");
395
- let h, O, w = null;
397
+ function Ct(r) {
398
+ const { controller: e, overlayPane: s } = Z("OmOverlay"), o = g(null), i = g(void 0), b = g(r);
399
+ b.current = r;
400
+ const p = D(() => {
401
+ const c = e.getStore("selection");
402
+ let S, v, O = null;
396
403
  return {
397
- subscribe: d.subscribe,
404
+ subscribe: c.subscribe,
398
405
  getSnapshot: () => {
399
- const j = d.getSnapshot(), { anchorFrom: F, layer: k, selectionType: l } = g.current, $ = `${F ?? ""}|${k ?? ""}|${l ?? ""}`;
400
- return (j !== h || $ !== O) && (h = j, O = $, F === "selection" && be(j, k, l, e.getLastPickType()) && (w = j)), w;
406
+ const T = c.getSnapshot(), { anchorFrom: A, layer: z, selectionType: C } = b.current, j = `${A ?? ""}|${z ?? ""}|${C ?? ""}`;
407
+ return (T !== S || j !== v) && (S = T, v = j, A === "selection" && Se(T, z, C, e.getLastPickType()) && (O = T)), O;
401
408
  }
402
409
  };
403
- }, [e]), u = ve(
410
+ }, [e]), d = we(
404
411
  p.subscribe,
405
412
  p.getSnapshot,
406
413
  p.getSnapshot
407
414
  );
408
- E(
409
- () => e.registerOverlay((d, h, O) => {
410
- const w = o.current;
411
- if (!w) return;
412
- const { anchor: j, anchorFrom: F, layer: k, selectionType: l, visible: $ = !0, anchorOffset: B } = g.current;
413
- let M;
414
- if (F === "selection" ? (be(h, k, l, O) && (i.current = (h == null ? void 0 : h.coordinate) ?? void 0), M = i.current) : M = j, !$ || !M || !d) {
415
- w.style.visibility = "hidden";
415
+ w(
416
+ () => e.registerOverlay((c, S, v) => {
417
+ const O = o.current;
418
+ if (!O) return;
419
+ const { anchor: T, anchorFrom: A, layer: z, selectionType: C, visible: j = !0, anchorOffset: l } = b.current;
420
+ let F;
421
+ if (A === "selection" ? (Se(S, z, C, v) && (i.current = (S == null ? void 0 : S.coordinate) ?? void 0), F = i.current) : F = T, !j || !F || !c) {
422
+ O.style.visibility = "hidden";
416
423
  return;
417
424
  }
418
- const [L, I, x] = d.project([M[0], M[1], M[2] ?? 0]);
419
- if (!(L >= 0 && L <= d.width && I >= 0 && I <= d.height) || ft(d, x)) {
420
- w.style.visibility = "hidden";
425
+ const [M, K, B] = c.project([F[0], F[1], F[2] ?? 0]);
426
+ if (!(M >= 0 && M <= c.width && K >= 0 && K <= c.height) || gt(c, B)) {
427
+ O.style.visibility = "hidden";
421
428
  return;
422
429
  }
423
- w.style.visibility = "visible", w.style.transform = `translate(${L}px, ${I}px) ${pt[B ?? "bottom-center"]}`;
430
+ O.style.visibility = "visible", O.style.transform = `translate(${M}px, ${K}px) ${bt[l ?? "bottom-center"]}`;
424
431
  }),
425
432
  [e]
426
- ), E(() => {
433
+ ), w(() => {
427
434
  e.refreshOverlays();
428
435
  });
429
- const { children: f, className: v, style: b, interactive: S = !0 } = t, P = typeof f == "function" ? f(u) : f;
430
- return Se(
431
- /* @__PURE__ */ C(
436
+ const { children: f, className: h, style: m, interactive: $ = !0 } = r, P = typeof f == "function" ? f(d) : f;
437
+ return Re(
438
+ /* @__PURE__ */ E(
432
439
  "div",
433
440
  {
434
441
  ref: o,
435
- className: v,
442
+ className: h,
436
443
  style: {
437
444
  position: "absolute",
438
445
  top: 0,
@@ -440,8 +447,8 @@ function wt(t) {
440
447
  visibility: "hidden",
441
448
  // hidden until the first flush positions it — never flashes at the origin
442
449
  willChange: "transform",
443
- pointerEvents: S ? "auto" : "none",
444
- ...b
450
+ pointerEvents: $ ? "auto" : "none",
451
+ ...m
445
452
  },
446
453
  children: P
447
454
  }
@@ -449,29 +456,29 @@ function wt(t) {
449
456
  s
450
457
  );
451
458
  }
452
- function Rt(t = []) {
453
- const { controller: e } = Y("useOmMap"), s = t.join(" "), o = _(() => {
454
- const p = (s ? s.split(" ") : []).flatMap((f) => nt(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>.`), []));
455
- let u;
459
+ function Ft(r = []) {
460
+ const { controller: e } = Z("useOmMap"), s = r.join(" "), o = D(() => {
461
+ const p = (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
+ let d;
456
463
  return {
457
464
  subscribe: (f) => {
458
- const v = p.map((b) => b.subscribe(f));
465
+ const h = p.map((m) => m.subscribe(f));
459
466
  return () => {
460
- for (const b of v) b();
467
+ for (const m of h) m();
461
468
  };
462
469
  },
463
470
  getSnapshot: () => {
464
- const f = p.map((v) => v.getSnapshot());
465
- return (!u || f.some((v, b) => v !== u[b])) && (u = f), u;
471
+ const f = p.map((h) => h.getSnapshot());
472
+ return (!d || f.some((h, m) => h !== d[m])) && (d = f), d;
466
473
  }
467
474
  };
468
- }, [e, s]), i = ve(o.subscribe, o.getSnapshot, o.getSnapshot);
469
- return _(() => e.buildCtx(), [e, i]);
475
+ }, [e, s]), i = we(o.subscribe, o.getSnapshot, o.getSnapshot);
476
+ return D(() => e.buildCtx(), [e, i]);
470
477
  }
471
478
  export {
472
- St as OmLayer,
473
- vt as OmMap,
474
- wt as OmOverlay,
475
- Ot as OmWidget,
476
- Rt as useOmMap
479
+ Et as OmLayer,
480
+ Rt as OmMap,
481
+ Ct as OmOverlay,
482
+ Pt as OmWidget,
483
+ Ft as useOmMap
477
484
  };