@nika-js/onlymap 0.6.0 → 0.6.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 (54) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/README.md +18 -6
  3. package/THIRD-PARTY-LICENSES.md +27 -0
  4. package/dist/{LercDecode.es-fbo6h5rt.js → LercDecode.es-CJnypw8j.js} +1 -1
  5. package/dist/{basemap-CprSan9q.js → basemap-DrQ0-eyR.js} +1 -1
  6. package/dist/cityjson-D_V5GY8b.js +332 -0
  7. package/dist/crs-Ciu7Xs7a.js +108 -0
  8. package/dist/crs.d.ts +50 -0
  9. package/dist/ctx.d.ts +8 -1
  10. package/dist/elements/om-map.d.ts +26 -2
  11. package/dist/elements/om-overlay.d.ts +1 -1
  12. package/dist/elements/om-widget.d.ts +4 -0
  13. package/dist/feature-colors.d.ts +41 -0
  14. package/dist/{geoparquet-Bm8pfxyo.js → geoparquet-Dix4lTNy.js} +1 -1
  15. package/dist/html-data.d.ts +1 -1
  16. package/dist/ifc-Dc-TdSJr.js +877 -0
  17. package/dist/ifc.d.ts +406 -0
  18. package/dist/{index-Bz-rbmhj.js → index-1UgNlfGR.js} +20892 -18886
  19. package/dist/{index-GOwMjqm6.js → index-BQMjW5w0.js} +1 -1
  20. package/dist/{index-DSRIZR81.js → index-B_1PPJgC.js} +1 -1
  21. package/dist/{index-CCQttJzO.js → index-CAuT5j9Y.js} +2 -2
  22. package/dist/{index-UzmNhuS0.js → index-CXPaeisL.js} +1 -1
  23. package/dist/index.d.ts +8 -0
  24. package/dist/layer-registry.d.ts +14 -0
  25. package/dist/layers/bim-layer.d.ts +104 -0
  26. package/dist/layers/feature-mesh-layer.d.ts +288 -0
  27. package/dist/layers/gltf-scene-walk.d.ts +55 -0
  28. package/dist/{lerc-CuifOkoA.js → lerc-CbTjQ7uI.js} +2 -2
  29. package/dist/meshopt_simplifier-Co6uRDDA.js +370 -0
  30. package/dist/onlymap.standalone.js +57996 -54706
  31. package/dist/onlymapjs.js +69 -67
  32. package/dist/programmatic.d.ts +22 -2
  33. package/dist/{raster-dysYIQ_k.js → raster-0b0nSHUh.js} +2 -2
  34. package/dist/{raster-pipeline-ZdCOGfqV.js → raster-pipeline-D8siq7-4.js} +1 -1
  35. package/dist/react/om-overlay.d.ts +9 -0
  36. package/dist/react.js +144 -144
  37. package/dist/runtime-core.d.ts +110 -3
  38. package/dist/selection.d.ts +33 -0
  39. package/dist/site-placement.d.ts +85 -0
  40. package/dist/testing.d.ts +6 -2
  41. package/dist/tile3d-metadata.d.ts +185 -0
  42. package/dist/version.d.ts +1 -1
  43. package/dist/widget-registry.d.ts +11 -0
  44. package/dist/widgets/ifc-clash.d.ts +18 -0
  45. package/dist/widgets/ifc.d.ts +41 -0
  46. package/dist/{zarr-OewK7k2K.js → zarr-DCYro_Vs.js} +79 -66
  47. package/docs/testing.md +2 -2
  48. package/llms.txt +3 -3
  49. package/onlymapjs.html-data.json +152 -0
  50. package/package.json +3 -1
  51. package/skills/onlymapjs/SKILL.md +4 -2
  52. package/skills/onlymapjs/references/react.md +1 -1
  53. package/skills/onlymapjs/references/syntax.md +298 -11
  54. package/dist/cityjson-urQeujQv.js +0 -407
package/dist/react.js CHANGED
@@ -1,28 +1,28 @@
1
1
  var Ee = Object.defineProperty;
2
2
  var Re = (e, t, s) => t in e ? Ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var ne = (e, t, s) => Re(e, typeof t != "symbol" ? t + "" : t, s);
4
- import { jsxs as J, jsx as E } from "react/jsx-runtime";
5
- import { createContext as xe, useContext as Fe, forwardRef as Ce, useRef as h, useState as L, useId as le, useCallback as oe, useMemo as P, useLayoutEffect as se, useEffect as x, useImperativeHandle as Pe, useSyncExternalStore as ce } from "react";
6
- import { MANAGED_SLOTS as Te, slotContainerStyle as ke, FOLD_SIDES as A, MapController as Me, parseWidgetStyle as Le, foldToggleSlot as $e, foldToggleStyle as je, foldPanelStyle as De, foldDrawerStyle as _e, resolveFoldBreakpointPx as Ae, shouldFoldAtWidth as Ie, DEFAULT_FOLD_BREAKPOINT_PX as ze, resolveSlot as Ke, foldSideForSlot as He, isStoreToken as Ne } from "@nika-js/onlymap";
3
+ var oe = (e, t, s) => Re(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { jsxs as X, jsx as w } from "react/jsx-runtime";
5
+ import { createContext as xe, useContext as Fe, forwardRef as Te, useRef as h, useState as j, useId as ce, useCallback as se, useMemo as M, useLayoutEffect as ie, useEffect as F, useImperativeHandle as Pe, useSyncExternalStore as ue } from "react";
6
+ import { MANAGED_SLOTS as Ce, slotContainerStyle as ke, FOLD_SIDES as A, MapController as Me, parseWidgetStyle as Le, foldToggleSlot as $e, foldToggleStyle as je, foldPanelStyle as De, foldDrawerStyle as _e, resolveFoldBreakpointPx as Ae, shouldFoldAtWidth as Ie, DEFAULT_FOLD_BREAKPOINT_PX as ze, resolveSlot as Ke, foldSideForSlot as He, isStoreToken as Ne } from "@nika-js/onlymap";
7
7
  import { createPortal as de } from "react-dom";
8
- const ue = xe(null);
8
+ const fe = xe(null);
9
9
  function W(e) {
10
- const t = Fe(ue);
10
+ const t = Fe(fe);
11
11
  if (!t) throw new Error(`[onlymapjs] ${e} must be rendered inside <OmMap>.`);
12
12
  return t;
13
13
  }
14
- function U(e, t) {
14
+ function Q(e, t) {
15
15
  if (e === t) return !0;
16
16
  const s = Object.keys(e ?? {}), o = Object.keys(t ?? {});
17
17
  return s.length !== o.length ? !1 : s.every((i) => e[i] === t[i]);
18
18
  }
19
19
  function We(e, t) {
20
- const { props: s, updateTriggers: o, ...i } = e, { props: b, updateTriggers: m, ...a } = t;
21
- return U(i, a) && U(s, b) && U(o, m);
20
+ const { props: s, updateTriggers: o, ...i } = e, { props: y, updateTriggers: m, ...a } = t;
21
+ return Q(i, a) && Q(s, y) && Q(o, m);
22
22
  }
23
23
  class qe {
24
24
  constructor(t) {
25
- ne(this, "descriptors", /* @__PURE__ */ new Map());
25
+ oe(this, "descriptors", /* @__PURE__ */ new Map());
26
26
  this.controller = t;
27
27
  }
28
28
  upsert(t) {
@@ -33,7 +33,7 @@ class qe {
33
33
  this.descriptors.delete(t) && this.controller.setLayers([...this.descriptors.values()]);
34
34
  }
35
35
  }
36
- const N = Te, Ve = Object.fromEntries(N.map((e) => [e, ke(e)])), ie = { display: "flex", pointerEvents: "none", order: 2147483647 }, Be = Object.fromEntries(A.map((e) => [e, null]));
36
+ const N = Ce, Ve = Object.fromEntries(N.map((e) => [e, ke(e)])), ae = { display: "flex", pointerEvents: "none", order: 2147483647 }, Be = Object.fromEntries(A.map((e) => [e, null]));
37
37
  function Ye(e) {
38
38
  const t = e.querySelector(
39
39
  'button:not([disabled]),a[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])'
@@ -43,183 +43,183 @@ function Ye(e) {
43
43
  function Ge(e, t) {
44
44
  return Object.entries(t).some(([s, o]) => o !== void 0 && e[s] !== o);
45
45
  }
46
- const rt = Ce(function(t, s) {
47
- const { center: o, zoom: i, pitch: b, bearing: m, basemap: a, basemapKey: l, attribution: g, headless: d, widgetStyle: w, widgetsHidden: v, widgetsFold: p = !0, className: y, style: S, children: $ } = t, R = h(null), C = h(null), [c, T] = L(null), [F, D] = L(null), [j, I] = L(
46
+ const rt = Te(function(t, s) {
47
+ const { center: o, zoom: i, pitch: y, bearing: m, basemap: a, basemapKey: l, attribution: g, headless: u, widgetStyle: O, widgetsHidden: v, widgetsFold: p = !0, className: b, style: T, children: E } = t, R = h(null), P = h(null), [c, L] = j(null), [C, q] = j(null), [k, D] = j(
48
48
  () => Object.fromEntries(N.map((r) => [r, null]))
49
- ), [k, fe] = L(!1), [X, me] = L(Be), [ge, be] = L(
49
+ ), [x, I] = j(!1), [V, me] = j(Be), [ge, ye] = j(
50
50
  () => Object.fromEntries(A.map((r) => [r, 0]))
51
- ), [ye, q] = L(null), Q = `om-react-fold-${le().replaceAll(":", "")}`, pe = h(new Map(A.map((r) => [r, /* @__PURE__ */ new Set()]))), Z = d ? JSON.stringify(d) : "", z = h({
51
+ ), [be, B] = j(null), Z = `om-react-fold-${ce().replaceAll(":", "")}`, pe = h(new Map(A.map((r) => [r, /* @__PURE__ */ new Set()]))), ee = u ? JSON.stringify(u) : "", z = h({
52
52
  badge: null,
53
53
  attribution: null
54
- }), he = oe((r) => {
55
- D((n) => n === r ? n : r);
56
- }, []), ve = P(
54
+ }), he = se((r) => {
55
+ q((n) => n === r ? n : r);
56
+ }, []), ve = M(
57
57
  () => Object.fromEntries(
58
58
  N.map((r) => [
59
59
  r,
60
60
  (n) => {
61
- I((u) => u[r] === n ? u : { ...u, [r]: n });
61
+ D((d) => d[r] === n ? d : { ...d, [r]: n });
62
62
  }
63
63
  ])
64
64
  ),
65
65
  []
66
- ), Se = P(
66
+ ), Se = M(
67
67
  () => Object.fromEntries(
68
68
  A.map((r) => [
69
69
  r,
70
70
  (n) => {
71
- me((u) => u[r] === n ? u : { ...u, [r]: n });
71
+ me((d) => d[r] === n ? d : { ...d, [r]: n });
72
72
  }
73
73
  ])
74
74
  ),
75
75
  []
76
- ), ee = oe((r, n, u) => {
77
- const f = pe.current.get(r), O = f.size;
78
- u ? f.add(n) : f.delete(n), f.size !== O && be((_) => ({ ..._, [r]: f.size }));
76
+ ), te = se((r, n, d) => {
77
+ const f = pe.current.get(r), S = f.size;
78
+ d ? f.add(n) : f.delete(n), f.size !== S && ye((_) => ({ ..._, [r]: f.size }));
79
79
  }, []);
80
- se(() => {
80
+ ie(() => {
81
81
  const r = R.current;
82
82
  if (!r) return;
83
- let n, u = ze;
83
+ let n, d = ze;
84
84
  const f = (_) => {
85
- const G = getComputedStyle(r).getPropertyValue("--om-widget-fold-breakpoint").trim();
86
- G !== n && (n = G, u = Ae(G, r)), fe((we) => p && Ie(_, u, we));
85
+ const U = getComputedStyle(r).getPropertyValue("--om-widget-fold-breakpoint").trim();
86
+ U !== n && (n = U, d = Ae(U, r)), I((we) => p && Ie(_, d, we));
87
87
  };
88
- if (f(r.getBoundingClientRect().width || (d ? d === !0 ? 800 : d.width ?? 800 : 0)), typeof ResizeObserver > "u") return;
89
- const O = new ResizeObserver(([_]) => f(_.contentRect.width));
90
- return O.observe(r), () => O.disconnect();
91
- }, [p, Z]), x(() => {
92
- (!k || v) && q(null);
93
- }, [k, v]);
94
- const te = h({ center: o, zoom: i, pitch: b, bearing: m });
95
- te.current = { center: o, zoom: i, pitch: b, bearing: m };
88
+ if (f(r.getBoundingClientRect().width || (u ? u === !0 ? 800 : u.width ?? 800 : 0)), typeof ResizeObserver > "u") return;
89
+ const S = new ResizeObserver(([_]) => f(_.contentRect.width));
90
+ return S.observe(r), () => S.disconnect();
91
+ }, [p, ee]), F(() => {
92
+ (!x || v) && B(null);
93
+ }, [x, v]);
94
+ const re = h({ center: o, zoom: i, pitch: y, bearing: m });
95
+ re.current = { center: o, zoom: i, pitch: y, bearing: m };
96
96
  const K = h(t.onReady);
97
97
  K.current = t.onReady;
98
- const M = h(t.onViewStateChange);
99
- M.current = t.onViewStateChange;
98
+ const $ = h(t.onViewStateChange);
99
+ $.current = t.onViewStateChange;
100
100
  const H = h(t.onRuntimeError);
101
101
  H.current = t.onRuntimeError;
102
- const V = h(a);
103
- V.current = a;
104
- const B = h(void 0);
105
- se(() => {
106
- if (!C.current) return;
107
- const r = te.current;
108
- B.current = V.current;
109
- const n = new Me(C.current, {
102
+ const Y = h(a);
103
+ Y.current = a;
104
+ const G = h(void 0);
105
+ ie(() => {
106
+ if (!P.current) return;
107
+ const r = re.current;
108
+ G.current = Y.current;
109
+ const n = new Me(P.current, {
110
110
  center: r.center,
111
111
  zoom: r.zoom,
112
112
  pitch: r.pitch,
113
113
  bearing: r.bearing,
114
- basemap: V.current,
114
+ basemap: Y.current,
115
115
  basemapKey: l,
116
116
  attribution: g,
117
- headless: d ? d === !0 ? {} : d : void 0,
117
+ headless: u ? u === !0 ? {} : u : void 0,
118
118
  chromeHosts: {
119
119
  badge: z.current.badge ?? void 0,
120
120
  attribution: z.current.attribution ?? void 0
121
121
  },
122
122
  onRuntimeError: (f) => {
123
- var O;
124
- return (O = H.current) == null ? void 0 : O.call(H, f);
123
+ var S;
124
+ return (S = H.current) == null ? void 0 : S.call(H, f);
125
125
  }
126
126
  });
127
- T(n);
128
- let u = !0;
127
+ L(n);
128
+ let d = !0;
129
129
  return n.ready.then(() => {
130
130
  var f;
131
- u && ((f = K.current) == null || f.call(K));
131
+ d && ((f = K.current) == null || f.call(K));
132
132
  }), () => {
133
- u = !1, T(null), n.destroy();
133
+ d = !1, L(null), n.destroy();
134
134
  };
135
- }, [Z]), x(() => {
136
- !c || B.current === a || (B.current = a, c.setBasemap(a ?? null));
137
- }, [c, a]), Pe(s, () => c, [c]), x(() => {
135
+ }, [ee]), F(() => {
136
+ !c || G.current === a || (G.current = a, c.setBasemap(a ?? null));
137
+ }, [c, a]), Pe(s, () => c, [c]), F(() => {
138
138
  if (!c) return;
139
- const r = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: b, bearing: m };
139
+ const r = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: y, bearing: m };
140
140
  Ge(c.getViewState(), r) && c.setView(r);
141
- }, [c, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, b, m]), x(() => {
141
+ }, [c, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, y, m]), F(() => {
142
142
  var r;
143
143
  if (c)
144
- return (r = M.current) == null || r.call(M, c.getViewState()), c.getStore("viewport").subscribe(() => {
144
+ return (r = $.current) == null || r.call($, c.getViewState()), c.getStore("viewport").subscribe(() => {
145
145
  var n;
146
- return (n = M.current) == null ? void 0 : n.call(M, c.getViewState());
146
+ return (n = $.current) == null ? void 0 : n.call($, c.getViewState());
147
147
  });
148
148
  }, [c]);
149
- const Oe = P(
149
+ const Oe = M(
150
150
  () => ({
151
151
  position: "absolute",
152
152
  inset: 0,
153
153
  zIndex: 20,
154
154
  pointerEvents: "none",
155
155
  opacity: "var(--om-widget-opacity, 1)",
156
- ...w ? Le(w).properties : void 0
156
+ ...O ? Le(O).properties : void 0
157
157
  }),
158
- [w]
159
- ), Y = P(() => c ? new qe(c) : null, [c]), re = P(
160
- () => c && Y && F ? { controller: c, layers: Y, overlayPane: F, corners: j, widgetsHidden: !!v, widgetsFolded: k, foldPanels: X, registerFoldedWidget: ee } : null,
161
- [c, Y, F, j, v, k, X, ee]
158
+ [O]
159
+ ), J = M(() => c ? new qe(c) : null, [c]), ne = M(
160
+ () => c && J && C ? { controller: c, layers: J, overlayPane: C, corners: k, widgetsHidden: !!v, widgetsFolded: x, foldPanels: V, registerFoldedWidget: te } : null,
161
+ [c, J, C, k, v, x, V, te]
162
162
  );
163
- return /* @__PURE__ */ J("div", { ref: R, className: y, style: { position: "relative", overflow: "hidden", ...S }, children: [
164
- /* @__PURE__ */ E("div", { ref: C, style: { position: "absolute", inset: 0 } }),
165
- /* @__PURE__ */ E(
163
+ return /* @__PURE__ */ X("div", { ref: R, className: b, style: { position: "relative", overflow: "hidden", ...T }, children: [
164
+ /* @__PURE__ */ w("div", { ref: P, style: { position: "absolute", inset: 0 } }),
165
+ /* @__PURE__ */ w(
166
166
  "div",
167
167
  {
168
168
  ref: he,
169
169
  style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
170
170
  }
171
171
  ),
172
- /* @__PURE__ */ E("div", { "data-om-widget-layer": "", style: Oe, children: N.map((r) => /* @__PURE__ */ J(
172
+ /* @__PURE__ */ w("div", { "data-om-widget-layer": "", style: Oe, children: N.map((r) => /* @__PURE__ */ X(
173
173
  "div",
174
174
  {
175
175
  "data-om-widget-slot": r,
176
176
  ref: ve[r],
177
177
  style: {
178
178
  ...Ve[r],
179
- ...k && r === "bottom-end" ? { bottom: "calc(var(--om-widget-inset-y, 12px) + 28px)" } : void 0
179
+ ...x && r === "bottom-end" ? { bottom: "calc(var(--om-widget-inset-y, 12px) + 28px)" } : void 0
180
180
  },
181
181
  children: [
182
- k && A.filter((n) => $e(n) === r && ge[n] > 0).map((n) => {
183
- const u = ye === n;
184
- return /* @__PURE__ */ J(
182
+ x && A.filter((n) => $e(n) === r && ge[n] > 0).map((n) => {
183
+ const d = be === n;
184
+ return /* @__PURE__ */ X(
185
185
  "div",
186
186
  {
187
187
  "data-om-fold-drawer": n,
188
188
  style: { ..._e(n), display: v ? "none" : "flex" },
189
189
  onKeyDown: (f) => {
190
- var O;
191
- f.key !== "Escape" || !u || (q(null), (O = f.currentTarget.querySelector("[data-om-fold-toggle]")) == null || O.focus(), f.preventDefault(), f.stopPropagation());
190
+ var S;
191
+ f.key !== "Escape" || !d || (B(null), (S = f.currentTarget.querySelector("[data-om-fold-toggle]")) == null || S.focus(), f.preventDefault(), f.stopPropagation());
192
192
  },
193
193
  children: [
194
- /* @__PURE__ */ E(
194
+ /* @__PURE__ */ w(
195
195
  "button",
196
196
  {
197
197
  type: "button",
198
198
  "data-om-fold-toggle": n,
199
- "aria-expanded": u,
200
- "aria-controls": `${Q}-${n}`,
201
- "aria-label": `${u ? "Close" : "Open"} ${n} map controls`,
199
+ "aria-expanded": d,
200
+ "aria-controls": `${Z}-${n}`,
201
+ "aria-label": `${d ? "Close" : "Open"} ${n} map controls`,
202
202
  style: je(),
203
203
  onClick: () => {
204
- q(u ? null : n), u || requestAnimationFrame(() => {
205
- var O;
206
- const f = (O = R.current) == null ? void 0 : O.querySelector(`[data-om-fold-panel="${n}"]`);
204
+ B(d ? null : n), d || requestAnimationFrame(() => {
205
+ var S;
206
+ const f = (S = R.current) == null ? void 0 : S.querySelector(`[data-om-fold-panel="${n}"]`);
207
207
  f && Ye(f);
208
208
  });
209
209
  },
210
210
  children: "⋯"
211
211
  }
212
212
  ),
213
- /* @__PURE__ */ E(
213
+ /* @__PURE__ */ w(
214
214
  "div",
215
215
  {
216
- id: `${Q}-${n}`,
216
+ id: `${Z}-${n}`,
217
217
  ref: Se[n],
218
218
  "data-om-fold-panel": n,
219
219
  role: "region",
220
220
  "aria-label": `${n} map controls`,
221
- hidden: !u,
222
- style: { ...De(n), display: u ? "flex" : "none" }
221
+ hidden: !d,
222
+ style: { ...De(n), display: d ? "flex" : "none" }
223
223
  }
224
224
  )
225
225
  ]
@@ -227,31 +227,31 @@ const rt = Ce(function(t, s) {
227
227
  `fold-${n}`
228
228
  );
229
229
  }),
230
- r === "bottom-start" && /* @__PURE__ */ E(
230
+ r === "bottom-start" && /* @__PURE__ */ w(
231
231
  "div",
232
232
  {
233
233
  "data-om-mandated-chrome": "badge",
234
234
  ref: (n) => {
235
235
  z.current.badge = n;
236
236
  },
237
- style: ie
237
+ style: ae
238
238
  }
239
239
  ),
240
- r === "bottom-end" && /* @__PURE__ */ E(
240
+ r === "bottom-end" && /* @__PURE__ */ w(
241
241
  "div",
242
242
  {
243
243
  "data-om-mandated-chrome": "attribution",
244
244
  ref: (n) => {
245
245
  z.current.attribution = n;
246
246
  },
247
- style: ie
247
+ style: ae
248
248
  }
249
249
  )
250
250
  ]
251
251
  },
252
252
  r
253
253
  )) }),
254
- re && /* @__PURE__ */ E(ue.Provider, { value: re, children: $ })
254
+ ne && /* @__PURE__ */ w(fe.Provider, { value: ne, children: E })
255
255
  ] });
256
256
  }), Je = /* @__PURE__ */ new Set([
257
257
  "id",
@@ -277,7 +277,7 @@ function nt(e) {
277
277
  const { controller: t, layers: s } = W("OmLayer"), { id: o } = e, i = {};
278
278
  for (const [l, g] of Object.entries(e))
279
279
  !Je.has(l) && g !== void 0 && (i[l] = g);
280
- const b = {
280
+ const y = {
281
281
  id: o,
282
282
  type: e.type,
283
283
  data: e.data,
@@ -296,34 +296,34 @@ function nt(e) {
296
296
  updateTriggers: e.updateTriggers,
297
297
  props: i
298
298
  };
299
- x(() => {
300
- s.upsert(b);
301
- }), x(() => () => s.remove(o), [s, o]);
299
+ F(() => {
300
+ s.upsert(y);
301
+ }), F(() => () => s.remove(o), [s, o]);
302
302
  const m = h(e.onClick);
303
303
  m.current = e.onClick;
304
304
  const a = h(e.onHover);
305
- return a.current = e.onHover, x(
305
+ return a.current = e.onHover, F(
306
306
  () => t.watchPicks((l) => {
307
- var g, d, w;
307
+ var g, u, O;
308
308
  if (l === null) {
309
309
  (g = a.current) == null || g.call(a, null);
310
310
  return;
311
311
  }
312
- l.layerId === o && (l.type === "click" ? (d = m.current) == null || d.call(m, l) : (w = a.current) == null || w.call(a, l));
312
+ l.layerId === o && (l.type === "click" ? (u = m.current) == null || u.call(m, l) : (O = a.current) == null || O.call(a, l));
313
313
  }),
314
314
  [t, o]
315
315
  ), null;
316
316
  }
317
- function ot({ position: e = "top-start", order: t, fold: s, className: o, style: i, children: b }) {
318
- const { corners: m, widgetsHidden: a, widgetsFolded: l, foldPanels: g, registerFoldedWidget: d } = W("OmWidget"), w = le(), v = Ke(e) ?? "top-start", p = l && v !== "manual" && s !== "never", y = v === "manual" ? null : He(v);
319
- if (x(() => {
320
- if (y)
321
- return d(y, w, p), () => d(y, w, !1);
322
- }, [y, w, p, d]), v === "manual")
323
- return /* @__PURE__ */ E("div", { className: o, style: { pointerEvents: "auto", ...i }, children: b });
324
- const S = p && y ? g[y] : m[v];
325
- return S ? de(
326
- /* @__PURE__ */ E(
317
+ function ot({ position: e = "top-start", order: t, fold: s, className: o, style: i, children: y }) {
318
+ const { corners: m, widgetsHidden: a, widgetsFolded: l, foldPanels: g, registerFoldedWidget: u } = W("OmWidget"), O = ce(), v = Ke(e) ?? "top-start", p = l && v !== "manual" && s !== "never", b = v === "manual" ? null : He(v);
319
+ if (F(() => {
320
+ if (b)
321
+ return u(b, O, p), () => u(b, O, !1);
322
+ }, [b, O, p, u]), v === "manual")
323
+ return /* @__PURE__ */ w("div", { className: o, style: { pointerEvents: "auto", ...i }, children: y });
324
+ const T = p && b ? g[b] : m[v];
325
+ return T ? de(
326
+ /* @__PURE__ */ w(
327
327
  "div",
328
328
  {
329
329
  "data-om-react-widget": "",
@@ -335,14 +335,14 @@ function ot({ position: e = "top-start", order: t, fold: s, className: o, style:
335
335
  pointerEvents: a ? "none" : (i == null ? void 0 : i.pointerEvents) ?? "auto",
336
336
  visibility: a ? "hidden" : i == null ? void 0 : i.visibility
337
337
  },
338
- children: b
338
+ children: y
339
339
  }
340
340
  ),
341
- S
341
+ T
342
342
  ) : null;
343
343
  }
344
- function ae(e, t) {
345
- return !t || (e == null ? void 0 : e.layerId) === t;
344
+ function le(e, t, s, o) {
345
+ return t && (e == null ? void 0 : e.layerId) !== t ? !1 : !s || (e ? e.type : o) === s;
346
346
  }
347
347
  const Ue = {
348
348
  "top-left": "translate(0, 0)",
@@ -356,47 +356,47 @@ const Ue = {
356
356
  "bottom-right": "translate(-100%, -100%)"
357
357
  };
358
358
  function st(e) {
359
- const { controller: t, overlayPane: s } = W("OmOverlay"), o = h(null), i = h(void 0), b = h(e);
360
- b.current = e;
361
- const m = P(() => {
359
+ const { controller: t, overlayPane: s } = W("OmOverlay"), o = h(null), i = h(void 0), y = h(e);
360
+ y.current = e;
361
+ const m = M(() => {
362
362
  const p = t.getStore("selection");
363
- let y, S, $ = null;
363
+ let b, T, E = null;
364
364
  return {
365
365
  subscribe: p.subscribe,
366
366
  getSnapshot: () => {
367
- const R = p.getSnapshot(), { anchorFrom: C, layer: c } = b.current, T = `${C ?? ""}|${c ?? ""}`;
368
- return (R !== y || T !== S) && (y = R, S = T, C === "selection" && ae(R, c) && ($ = R)), $;
367
+ const R = p.getSnapshot(), { anchorFrom: P, layer: c, selectionType: L } = y.current, C = `${P ?? ""}|${c ?? ""}|${L ?? ""}`;
368
+ return (R !== b || C !== T) && (b = R, T = C, P === "selection" && le(R, c, L, t.getLastPickType()) && (E = R)), E;
369
369
  }
370
370
  };
371
- }, [t]), a = ce(
371
+ }, [t]), a = ue(
372
372
  m.subscribe,
373
373
  m.getSnapshot,
374
374
  m.getSnapshot
375
375
  );
376
- x(
377
- () => t.registerOverlay((p, y) => {
378
- const S = o.current;
379
- if (!S) return;
380
- const { anchor: $, anchorFrom: R, layer: C, visible: c = !0, anchorOffset: T } = b.current;
381
- let F;
382
- if (R === "selection" ? (ae(y, C) && (i.current = (y == null ? void 0 : y.coordinate) ?? void 0), F = i.current) : F = $, !c || !F || !p) {
383
- S.style.visibility = "hidden";
376
+ F(
377
+ () => t.registerOverlay((p, b, T) => {
378
+ const E = o.current;
379
+ if (!E) return;
380
+ const { anchor: R, anchorFrom: P, layer: c, selectionType: L, visible: C = !0, anchorOffset: q } = y.current;
381
+ let k;
382
+ if (P === "selection" ? (le(b, c, L, T) && (i.current = (b == null ? void 0 : b.coordinate) ?? void 0), k = i.current) : k = R, !C || !k || !p) {
383
+ E.style.visibility = "hidden";
384
384
  return;
385
385
  }
386
- const [D, j, I] = p.project([F[0], F[1], 0]);
387
- if (!(D >= 0 && D <= p.width && j >= 0 && j <= p.height) || I !== void 0 && I < 0) {
388
- S.style.visibility = "hidden";
386
+ const [D, x, I] = p.project([k[0], k[1], 0]);
387
+ if (!(D >= 0 && D <= p.width && x >= 0 && x <= p.height) || I !== void 0 && I < 0) {
388
+ E.style.visibility = "hidden";
389
389
  return;
390
390
  }
391
- S.style.visibility = "visible", S.style.transform = `translate(${D}px, ${j}px) ${Ue[T ?? "bottom-center"]}`;
391
+ E.style.visibility = "visible", E.style.transform = `translate(${D}px, ${x}px) ${Ue[q ?? "bottom-center"]}`;
392
392
  }),
393
393
  [t]
394
- ), x(() => {
394
+ ), F(() => {
395
395
  t.refreshOverlays();
396
396
  });
397
- const { children: l, className: g, style: d, interactive: w = !0 } = e, v = typeof l == "function" ? l(a) : l;
397
+ const { children: l, className: g, style: u, interactive: O = !0 } = e, v = typeof l == "function" ? l(a) : l;
398
398
  return de(
399
- /* @__PURE__ */ E(
399
+ /* @__PURE__ */ w(
400
400
  "div",
401
401
  {
402
402
  ref: o,
@@ -408,8 +408,8 @@ function st(e) {
408
408
  visibility: "hidden",
409
409
  // hidden until the first flush positions it — never flashes at the origin
410
410
  willChange: "transform",
411
- pointerEvents: w ? "auto" : "none",
412
- ...d
411
+ pointerEvents: O ? "auto" : "none",
412
+ ...u
413
413
  },
414
414
  children: v
415
415
  }
@@ -418,23 +418,23 @@ function st(e) {
418
418
  );
419
419
  }
420
420
  function it(e = []) {
421
- const { controller: t } = W("useOmMap"), s = e.join(" "), o = P(() => {
421
+ const { controller: t } = W("useOmMap"), s = e.join(" "), o = M(() => {
422
422
  const m = (s ? s.split(" ") : []).flatMap((l) => Ne(l) ? [t.getStore(l)] : (console.warn(`[onlymapjs] useOmMap: "${l}" is not a watch token on the React front-end — expected viewport, selection, layers, or data:<layerId>.`), []));
423
423
  let a;
424
424
  return {
425
425
  subscribe: (l) => {
426
- const g = m.map((d) => d.subscribe(l));
426
+ const g = m.map((u) => u.subscribe(l));
427
427
  return () => {
428
- for (const d of g) d();
428
+ for (const u of g) u();
429
429
  };
430
430
  },
431
431
  getSnapshot: () => {
432
432
  const l = m.map((g) => g.getSnapshot());
433
- return (!a || l.some((g, d) => g !== a[d])) && (a = l), a;
433
+ return (!a || l.some((g, u) => g !== a[u])) && (a = l), a;
434
434
  }
435
435
  };
436
- }, [t, s]), i = ce(o.subscribe, o.getSnapshot, o.getSnapshot);
437
- return P(() => t.buildCtx(), [t, i]);
436
+ }, [t, s]), i = ue(o.subscribe, o.getSnapshot, o.getSnapshot);
437
+ return M(() => t.buildCtx(), [t, i]);
438
438
  }
439
439
  export {
440
440
  nt as OmLayer,