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