@nika-js/onlymap 0.6.0 → 0.6.2

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 (80) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/README.md +39 -14
  3. package/THIRD-PARTY-LICENSES.md +27 -0
  4. package/dist/{LercDecode.es-fbo6h5rt.js → LercDecode.es-BOJJr6Gx.js} +1 -1
  5. package/dist/{basemap-CprSan9q.js → basemap-BofXgXxy.js} +13 -3
  6. package/dist/basemap.d.ts +10 -1
  7. package/dist/cityjson-D_V5GY8b.js +332 -0
  8. package/dist/clip-box-controller.d.ts +94 -0
  9. package/dist/clip-box.d.ts +109 -0
  10. package/dist/crs-Ciu7Xs7a.js +108 -0
  11. package/dist/crs.d.ts +50 -0
  12. package/dist/ctx.d.ts +8 -1
  13. package/dist/data-layer.d.ts +11 -3
  14. package/dist/draw-controller.d.ts +75 -1
  15. package/dist/draw.d.ts +22 -4
  16. package/dist/elements/om-map.d.ts +45 -2
  17. package/dist/elements/om-overlay.d.ts +13 -1
  18. package/dist/elements/om-widget.d.ts +4 -0
  19. package/dist/feature-colors.d.ts +41 -0
  20. package/dist/geodesy.d.ts +29 -3
  21. package/dist/{geoparquet-Bm8pfxyo.js → geoparquet-DapHATA0.js} +1 -1
  22. package/dist/html-data.d.ts +2 -2
  23. package/dist/ifc-Dc-TdSJr.js +877 -0
  24. package/dist/ifc.d.ts +406 -0
  25. package/dist/{index-Bz-rbmhj.js → index-7B-6Cbzu.js} +31619 -26565
  26. package/dist/{index-DSRIZR81.js → index-BF9iO8Tq.js} +1 -1
  27. package/dist/{index-GOwMjqm6.js → index-BmX6IId3.js} +1 -1
  28. package/dist/{index-UzmNhuS0.js → index-SPJVn_n_.js} +1 -1
  29. package/dist/{index-CCQttJzO.js → index-xmJjZxQJ.js} +2 -2
  30. package/dist/index.d.ts +13 -2
  31. package/dist/ir-snapshot.d.ts +3 -1
  32. package/dist/layer-registry.d.ts +14 -0
  33. package/dist/layers/bim-layer.d.ts +127 -0
  34. package/dist/layers/feature-mesh-layer.d.ts +288 -0
  35. package/dist/layers/gltf-scene-walk.d.ts +55 -0
  36. package/dist/layers/popup-layer.d.ts +13 -0
  37. package/dist/legend-spec.d.ts +1 -1
  38. package/dist/{lerc-CuifOkoA.js → lerc-C6k7EzSN.js} +2 -2
  39. package/dist/license.d.ts +12 -5
  40. package/dist/measure-controller.d.ts +458 -4
  41. package/dist/meshopt_simplifier-Co6uRDDA.js +370 -0
  42. package/dist/onlymap.standalone.js +57077 -50729
  43. package/dist/onlymapjs.js +72 -69
  44. package/dist/parse-manifest.d.ts +3 -0
  45. package/dist/programmatic.d.ts +39 -5
  46. package/dist/{raster-dysYIQ_k.js → raster-Cuzhibe2.js} +2 -2
  47. package/dist/{raster-pipeline-ZdCOGfqV.js → raster-pipeline-DLrnJK8y.js} +1 -1
  48. package/dist/react/om-layer.d.ts +6 -1
  49. package/dist/react/om-overlay.d.ts +9 -0
  50. package/dist/react.js +176 -169
  51. package/dist/region-export-controller.d.ts +37 -0
  52. package/dist/region-export.d.ts +56 -0
  53. package/dist/runtime-core.d.ts +260 -3
  54. package/dist/selection.d.ts +44 -1
  55. package/dist/site-placement.d.ts +107 -0
  56. package/dist/snapping.d.ts +88 -0
  57. package/dist/terrain-heightfield.d.ts +53 -0
  58. package/dist/terrain-sample.d.ts +30 -0
  59. package/dist/terrain.d.ts +6 -1
  60. package/dist/testing.d.ts +6 -2
  61. package/dist/tile3d-metadata.d.ts +185 -0
  62. package/dist/units.d.ts +27 -0
  63. package/dist/version.d.ts +1 -1
  64. package/dist/volumetrics-run.d.ts +13 -0
  65. package/dist/volumetrics-worker.d.ts +1 -0
  66. package/dist/volumetrics.d.ts +201 -0
  67. package/dist/widget-registry.d.ts +11 -0
  68. package/dist/widgets/ifc-clash.d.ts +18 -0
  69. package/dist/widgets/ifc.d.ts +41 -0
  70. package/dist/{zarr-OewK7k2K.js → zarr-CUzEX8fB.js} +79 -66
  71. package/docs/3d-assets.md +48 -0
  72. package/docs/live-data.md +9 -1
  73. package/docs/testing.md +4 -2
  74. package/llms.txt +10 -5
  75. package/onlymapjs.html-data.json +313 -2
  76. package/package.json +6 -2
  77. package/skills/onlymapjs/SKILL.md +14 -2
  78. package/skills/onlymapjs/references/react.md +2 -2
  79. package/skills/onlymapjs/references/syntax.md +314 -15
  80. 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";
7
- import { createPortal as de } from "react-dom";
8
- const ue = xe(null);
3
+ var oe = (e, t, s) => Re(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { jsxs as X, jsx as O } 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 L, useLayoutEffect as ie, useEffect as x, useImperativeHandle as Pe, useSyncExternalStore as de } from "react";
6
+ import { MANAGED_SLOTS as Ce, slotContainerStyle as ke, FOLD_SIDES as A, MapController as Le, parseWidgetStyle as Me, 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
+ import { createPortal as ue } from "react-dom";
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: m, updateTriggers: c, ...l } = t;
21
+ return Q(i, l) && Q(s, m) && Q(o, c);
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,37 +33,37 @@ 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]));
37
- function Ye(e) {
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
+ function Je(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"])'
40
40
  );
41
41
  t ? t.focus() : (e.tabIndex = -1, e.focus());
42
42
  }
43
- function Ge(e, t) {
43
+ function Ye(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 nt = Te(function(t, s) {
47
+ const { center: o, zoom: i, pitch: m, bearing: c, basemap: l, basemapKey: g, attribution: p, headless: d, widgetStyle: F, widgetsHidden: v, widgetsFold: b = !0, className: y, style: T, children: w } = t, E = h(null), C = h(null), [a, M] = j(null), [k, q] = j(null), [P, D] = j(
48
48
  () => Object.fromEntries(N.map((r) => [r, null]))
49
- ), [k, fe] = L(!1), [X, me] = L(Be), [ge, be] = L(
49
+ ), [R, 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(":", "")}`, he = h(new Map(A.map((r) => [r, /* @__PURE__ */ new Set()]))), ee = d ? JSON.stringify(d) : "", 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
+ }), pe = se((r) => {
55
+ q((n) => n === r ? n : r);
56
+ }, []), ve = L(
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((u) => u[r] === n ? u : { ...u, [r]: n });
62
62
  }
63
63
  ])
64
64
  ),
65
65
  []
66
- ), Se = P(
66
+ ), Se = L(
67
67
  () => Object.fromEntries(
68
68
  A.map((r) => [
69
69
  r,
@@ -73,147 +73,147 @@ const rt = Ce(function(t, s) {
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, u) => {
77
+ const f = he.current.get(r), S = f.size;
78
+ u ? f.add(n) : f.delete(n), f.size !== S && ye((_) => ({ ..._, [r]: f.size }));
79
79
  }, []);
80
- se(() => {
81
- const r = R.current;
80
+ ie(() => {
81
+ const r = E.current;
82
82
  if (!r) return;
83
83
  let n, u = 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, u = Ae(U, r)), I((we) => b && Ie(_, u, we));
87
87
  };
88
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 };
89
+ const S = new ResizeObserver(([_]) => f(_.contentRect.width));
90
+ return S.observe(r), () => S.disconnect();
91
+ }, [b, ee]), x(() => {
92
+ (!R || v) && B(null);
93
+ }, [R, v]);
94
+ const re = h({ center: o, zoom: i, pitch: m, bearing: c });
95
+ re.current = { center: o, zoom: i, pitch: m, bearing: c };
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(() => {
102
+ const J = h(l);
103
+ J.current = l;
104
+ const Y = h(void 0);
105
+ ie(() => {
106
106
  if (!C.current) return;
107
- const r = te.current;
108
- B.current = V.current;
109
- const n = new Me(C.current, {
107
+ const r = re.current;
108
+ Y.current = J.current;
109
+ const n = new Le(C.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,
115
- basemapKey: l,
116
- attribution: g,
114
+ basemap: J.current,
115
+ basemapKey: g,
116
+ attribution: p,
117
117
  headless: d ? d === !0 ? {} : d : 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);
127
+ M(n);
128
128
  let u = !0;
129
129
  return n.ready.then(() => {
130
130
  var f;
131
131
  u && ((f = K.current) == null || f.call(K));
132
132
  }), () => {
133
- u = !1, T(null), n.destroy();
133
+ u = !1, M(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(() => {
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 };
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(() => {
135
+ }, [ee]), x(() => {
136
+ !a || Y.current === l || (Y.current = l, a.setBasemap(l ?? null));
137
+ }, [a, l]), Pe(s, () => a, [a]), x(() => {
138
+ if (!a) return;
139
+ const r = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: m, bearing: c };
140
+ Ye(a.getViewState(), r) && a.setView(r);
141
+ }, [a, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, m, c]), x(() => {
142
142
  var r;
143
- if (c)
144
- return (r = M.current) == null || r.call(M, c.getViewState()), c.getStore("viewport").subscribe(() => {
143
+ if (a)
144
+ return (r = $.current) == null || r.call($, a.getViewState()), a.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($, a.getViewState());
147
147
  });
148
- }, [c]);
149
- const Oe = P(
148
+ }, [a]);
149
+ const Oe = L(
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
+ ...F ? Me(F).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
+ [F]
159
+ ), G = L(() => a ? new qe(a) : null, [a]), ne = L(
160
+ () => a && G && k ? { controller: a, layers: G, overlayPane: k, corners: P, widgetsHidden: !!v, widgetsFolded: R, foldPanels: V, registerFoldedWidget: te } : null,
161
+ [a, G, k, P, v, R, 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: E, className: y, style: { position: "relative", overflow: "hidden", ...T }, children: [
164
+ /* @__PURE__ */ O("div", { ref: C, style: { position: "absolute", inset: 0 } }),
165
+ /* @__PURE__ */ O(
166
166
  "div",
167
167
  {
168
- ref: he,
168
+ ref: pe,
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__ */ O("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
+ ...R && 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
+ R && A.filter((n) => $e(n) === r && ge[n] > 0).map((n) => {
183
+ const u = 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" || !u || (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__ */ O(
195
195
  "button",
196
196
  {
197
197
  type: "button",
198
198
  "data-om-fold-toggle": n,
199
199
  "aria-expanded": u,
200
- "aria-controls": `${Q}-${n}`,
200
+ "aria-controls": `${Z}-${n}`,
201
201
  "aria-label": `${u ? "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}"]`);
207
- f && Ye(f);
204
+ B(u ? null : n), u || requestAnimationFrame(() => {
205
+ var S;
206
+ const f = (S = E.current) == null ? void 0 : S.querySelector(`[data-om-fold-panel="${n}"]`);
207
+ f && Je(f);
208
208
  });
209
209
  },
210
210
  children: "⋯"
211
211
  }
212
212
  ),
213
- /* @__PURE__ */ E(
213
+ /* @__PURE__ */ O(
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",
@@ -227,33 +227,33 @@ 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__ */ O(
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__ */ O(
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__ */ O(fe.Provider, { value: ne, children: w })
255
255
  ] });
256
- }), Je = /* @__PURE__ */ new Set([
256
+ }), Ge = /* @__PURE__ */ new Set([
257
257
  "id",
258
258
  "type",
259
259
  "data",
@@ -264,6 +264,8 @@ const rt = Ce(function(t, s) {
264
264
  "filterSoftRange",
265
265
  "filterCategoryField",
266
266
  "filterCategories",
267
+ "dash",
268
+ "dashJustified",
267
269
  "source",
268
270
  "streamKey",
269
271
  "flush",
@@ -273,12 +275,12 @@ const rt = Ce(function(t, s) {
273
275
  "onClick",
274
276
  "onHover"
275
277
  ]);
276
- function nt(e) {
277
- const { controller: t, layers: s } = W("OmLayer"), { id: o } = e, i = {};
278
- for (const [l, g] of Object.entries(e))
279
- !Je.has(l) && g !== void 0 && (i[l] = g);
280
- const b = {
281
- id: o,
278
+ function Ue(e) {
279
+ const t = {};
280
+ for (const [s, o] of Object.entries(e))
281
+ !Ge.has(s) && o !== void 0 && (t[s] = o);
282
+ return {
283
+ id: e.id,
282
284
  type: e.type,
283
285
  data: e.data,
284
286
  label: e.label,
@@ -288,63 +290,68 @@ function nt(e) {
288
290
  filterSoftRange: e.filterSoftRange,
289
291
  filterCategoryField: e.filterCategoryField,
290
292
  filterCategories: e.filterCategories,
293
+ dash: e.dash,
294
+ dashJustified: e.dashJustified,
291
295
  source: e.source,
292
296
  key: e.streamKey,
293
297
  flush: e.flush,
294
298
  refresh: e.refresh,
295
299
  terrain: e.terrain,
296
300
  updateTriggers: e.updateTriggers,
297
- props: i
301
+ ...Object.keys(t).length > 0 ? { props: t } : {}
298
302
  };
303
+ }
304
+ function ot(e) {
305
+ const { controller: t, layers: s } = W("OmLayer"), { id: o } = e, i = Ue(e);
299
306
  x(() => {
300
- s.upsert(b);
307
+ s.upsert(i);
301
308
  }), x(() => () => s.remove(o), [s, o]);
302
309
  const m = h(e.onClick);
303
310
  m.current = e.onClick;
304
- const a = h(e.onHover);
305
- return a.current = e.onHover, x(
311
+ const c = h(e.onHover);
312
+ return c.current = e.onHover, x(
306
313
  () => t.watchPicks((l) => {
307
- var g, d, w;
314
+ var g, p, d;
308
315
  if (l === null) {
309
- (g = a.current) == null || g.call(a, null);
316
+ (g = c.current) == null || g.call(c, null);
310
317
  return;
311
318
  }
312
- l.layerId === o && (l.type === "click" ? (d = m.current) == null || d.call(m, l) : (w = a.current) == null || w.call(a, l));
319
+ l.layerId === o && (l.type === "click" ? (p = m.current) == null || p.call(m, l) : (d = c.current) == null || d.call(c, l));
313
320
  }),
314
321
  [t, o]
315
322
  ), null;
316
323
  }
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);
324
+ function st({ position: e = "top-start", order: t, fold: s, className: o, style: i, children: m }) {
325
+ const { corners: c, widgetsHidden: l, widgetsFolded: g, foldPanels: p, registerFoldedWidget: d } = W("OmWidget"), F = ce(), v = Ke(e) ?? "top-start", b = g && v !== "manual" && s !== "never", y = v === "manual" ? null : He(v);
319
326
  if (x(() => {
320
327
  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(
328
+ return d(y, F, b), () => d(y, F, !1);
329
+ }, [y, F, b, d]), v === "manual")
330
+ return /* @__PURE__ */ O("div", { className: o, style: { pointerEvents: "auto", ...i }, children: m });
331
+ const T = b && y ? p[y] : c[v];
332
+ return T ? ue(
333
+ /* @__PURE__ */ O(
327
334
  "div",
328
335
  {
329
336
  "data-om-react-widget": "",
330
- "data-om-fold-origin-slot": p ? v : void 0,
337
+ "data-om-fold-origin-slot": b ? v : void 0,
331
338
  className: o,
332
339
  style: {
333
340
  ...t !== void 0 ? { order: t } : void 0,
334
341
  ...i,
335
- pointerEvents: a ? "none" : (i == null ? void 0 : i.pointerEvents) ?? "auto",
336
- visibility: a ? "hidden" : i == null ? void 0 : i.visibility
342
+ pointerEvents: l ? "none" : (i == null ? void 0 : i.pointerEvents) ?? "auto",
343
+ visibility: l ? "hidden" : i == null ? void 0 : i.visibility
337
344
  },
338
- children: b
345
+ children: m
339
346
  }
340
347
  ),
341
- S
348
+ T
342
349
  ) : null;
343
350
  }
344
- function ae(e, t) {
345
- return !t || (e == null ? void 0 : e.layerId) === t;
351
+ function le(e, t, s, o) {
352
+ return t && (e == null ? void 0 : e.layerId) !== t ? !1 : !s || (e ? e.type : o) === s;
346
353
  }
347
- const Ue = {
354
+ const Xe = {
348
355
  "top-left": "translate(0, 0)",
349
356
  "top-center": "translate(-50%, 0)",
350
357
  "top-right": "translate(-100%, 0)",
@@ -355,52 +362,52 @@ const Ue = {
355
362
  "bottom-center": "translate(-50%, -100%)",
356
363
  "bottom-right": "translate(-100%, -100%)"
357
364
  };
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(() => {
362
- const p = t.getStore("selection");
363
- let y, S, $ = null;
365
+ function it(e) {
366
+ const { controller: t, overlayPane: s } = W("OmOverlay"), o = h(null), i = h(void 0), m = h(e);
367
+ m.current = e;
368
+ const c = L(() => {
369
+ const b = t.getStore("selection");
370
+ let y, T, w = null;
364
371
  return {
365
- subscribe: p.subscribe,
372
+ subscribe: b.subscribe,
366
373
  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)), $;
374
+ const E = b.getSnapshot(), { anchorFrom: C, layer: a, selectionType: M } = m.current, k = `${C ?? ""}|${a ?? ""}|${M ?? ""}`;
375
+ return (E !== y || k !== T) && (y = E, T = k, C === "selection" && le(E, a, M, t.getLastPickType()) && (w = E)), w;
369
376
  }
370
377
  };
371
- }, [t]), a = ce(
372
- m.subscribe,
373
- m.getSnapshot,
374
- m.getSnapshot
378
+ }, [t]), l = de(
379
+ c.subscribe,
380
+ c.getSnapshot,
381
+ c.getSnapshot
375
382
  );
376
383
  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";
384
+ () => t.registerOverlay((b, y, T) => {
385
+ const w = o.current;
386
+ if (!w) return;
387
+ const { anchor: E, anchorFrom: C, layer: a, selectionType: M, visible: k = !0, anchorOffset: q } = m.current;
388
+ let P;
389
+ if (C === "selection" ? (le(y, a, M, T) && (i.current = (y == null ? void 0 : y.coordinate) ?? void 0), P = i.current) : P = E, !k || !P || !b) {
390
+ w.style.visibility = "hidden";
384
391
  return;
385
392
  }
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";
393
+ const [D, R, I] = b.project([P[0], P[1], P[2] ?? 0]);
394
+ if (!(D >= 0 && D <= b.width && R >= 0 && R <= b.height) || I !== void 0 && I < 0) {
395
+ w.style.visibility = "hidden";
389
396
  return;
390
397
  }
391
- S.style.visibility = "visible", S.style.transform = `translate(${D}px, ${j}px) ${Ue[T ?? "bottom-center"]}`;
398
+ w.style.visibility = "visible", w.style.transform = `translate(${D}px, ${R}px) ${Xe[q ?? "bottom-center"]}`;
392
399
  }),
393
400
  [t]
394
401
  ), x(() => {
395
402
  t.refreshOverlays();
396
403
  });
397
- const { children: l, className: g, style: d, interactive: w = !0 } = e, v = typeof l == "function" ? l(a) : l;
398
- return de(
399
- /* @__PURE__ */ E(
404
+ const { children: g, className: p, style: d, interactive: F = !0 } = e, v = typeof g == "function" ? g(l) : g;
405
+ return ue(
406
+ /* @__PURE__ */ O(
400
407
  "div",
401
408
  {
402
409
  ref: o,
403
- className: g,
410
+ className: p,
404
411
  style: {
405
412
  position: "absolute",
406
413
  top: 0,
@@ -408,7 +415,7 @@ function st(e) {
408
415
  visibility: "hidden",
409
416
  // hidden until the first flush positions it — never flashes at the origin
410
417
  willChange: "transform",
411
- pointerEvents: w ? "auto" : "none",
418
+ pointerEvents: F ? "auto" : "none",
412
419
  ...d
413
420
  },
414
421
  children: v
@@ -417,29 +424,29 @@ function st(e) {
417
424
  s
418
425
  );
419
426
  }
420
- function it(e = []) {
421
- const { controller: t } = W("useOmMap"), s = e.join(" "), o = P(() => {
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
- let a;
427
+ function at(e = []) {
428
+ const { controller: t } = W("useOmMap"), s = e.join(" "), o = L(() => {
429
+ const c = (s ? s.split(" ") : []).flatMap((g) => Ne(g) ? [t.getStore(g)] : (console.warn(`[onlymapjs] useOmMap: "${g}" is not a watch token on the React front-end — expected viewport, selection, layers, or data:<layerId>.`), []));
430
+ let l;
424
431
  return {
425
- subscribe: (l) => {
426
- const g = m.map((d) => d.subscribe(l));
432
+ subscribe: (g) => {
433
+ const p = c.map((d) => d.subscribe(g));
427
434
  return () => {
428
- for (const d of g) d();
435
+ for (const d of p) d();
429
436
  };
430
437
  },
431
438
  getSnapshot: () => {
432
- const l = m.map((g) => g.getSnapshot());
433
- return (!a || l.some((g, d) => g !== a[d])) && (a = l), a;
439
+ const g = c.map((p) => p.getSnapshot());
440
+ return (!l || g.some((p, d) => p !== l[d])) && (l = g), l;
434
441
  }
435
442
  };
436
- }, [t, s]), i = ce(o.subscribe, o.getSnapshot, o.getSnapshot);
437
- return P(() => t.buildCtx(), [t, i]);
443
+ }, [t, s]), i = de(o.subscribe, o.getSnapshot, o.getSnapshot);
444
+ return L(() => t.buildCtx(), [t, i]);
438
445
  }
439
446
  export {
440
- nt as OmLayer,
441
- rt as OmMap,
442
- st as OmOverlay,
443
- ot as OmWidget,
444
- it as useOmMap
447
+ ot as OmLayer,
448
+ nt as OmMap,
449
+ it as OmOverlay,
450
+ st as OmWidget,
451
+ at as useOmMap
445
452
  };
@@ -0,0 +1,37 @@
1
+ declare class RegionExportController {
2
+ private readonly mapEl;
3
+ /** `hadElement` records whether an authored `<om-layer>` existed WHEN THE TILESET LOADED — see `visibleTilesets` for why "no element now" alone can't mean "removed". */
4
+ private tilesets;
5
+ constructor(mapEl: Element);
6
+ /** The last committed ring on `target` — a draw widget's own polygon, same coords `snapshotIR`/measure read. `null` when nothing's been drawn yet (or the last shape isn't a polygon). */
7
+ private lastRing;
8
+ /**
9
+ * Registered tilesets whose OWN `<om-layer>` is currently visible (spec:
10
+ * issue #34 tier 1 — "measure/export only what's visible"). `visible`
11
+ * reads directly off the DOM attribute — `!== "false"`, the exact check
12
+ * `toggle-layer` itself uses (actions.ts) — not a reactive-props lookup,
13
+ * so this stays consistent with a plain `visible="false"` author edit AND
14
+ * with a live `toggle-layer` click, without needing this controller to
15
+ * carry `layerIRs` around just for one boolean. A layer hidden AFTER it
16
+ * loaded (the common case — someone toggles it off before exporting) is
17
+ * excluded; one never registered at all (never fired `om-tileset-load`)
18
+ * was already excluded by construction.
19
+ *
20
+ * A layer whose `<om-layer>` has since been REMOVED from the DOM (a
21
+ * manifest edit, a story step, a framework re-render) is excluded too, and
22
+ * its registry entry dropped on the way past — `this.tilesets` is only ever
23
+ * appended to, so otherwise a deleted layer's geometry kept exporting
24
+ * indefinitely.
25
+ *
26
+ * That's gated on `hadElement`, captured when the load event fired, rather
27
+ * than on "no element right now": a programmatically-built layer legitimately
28
+ * has no `<om-layer>` at all, and treating a missing element as removal
29
+ * would exclude every such layer from export permanently. Seen-then-gone is
30
+ * removal; never-seen is a DOM-less layer, which stays exportable.
31
+ */
32
+ private visibleTilesets;
33
+ exportRegion(target: string, format: "glb" | "b3dm"): Promise<void>;
34
+ }
35
+ /** Exported so the `draw` widget can call this EAGERLY at render time (when `export-3d` is configured), before the user has drawn anything — see the constructor's own doc comment for why lazy binding on first export doesn't work. */
36
+ export declare function getRegionExportController(mapEl: Element): RegionExportController;
37
+ export {};