@nika-js/onlymap 0.6.1 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +106 -1
- package/README.md +28 -15
- package/dist/{LercDecode.es-CJnypw8j.js → LercDecode.es-D5in29tf.js} +1 -1
- package/dist/{basemap-DrQ0-eyR.js → basemap-C0pFT3AO.js} +13 -3
- package/dist/basemap.d.ts +10 -1
- package/dist/clip-box-controller.d.ts +94 -0
- package/dist/clip-box.d.ts +109 -0
- package/dist/data-layer.d.ts +34 -4
- package/dist/draw-controller.d.ts +75 -1
- package/dist/draw.d.ts +22 -4
- package/dist/elements/om-map.d.ts +20 -0
- package/dist/elements/om-overlay.d.ts +12 -0
- package/dist/geodesy.d.ts +32 -3
- package/dist/{geoparquet-Dix4lTNy.js → geoparquet-By98JVB0.js} +1 -1
- package/dist/html-data.d.ts +2 -2
- package/dist/{index-BQMjW5w0.js → index-Bx9GFkrn.js} +1 -1
- package/dist/{index-CXPaeisL.js → index-CqC4sW_k.js} +1 -1
- package/dist/{index-1UgNlfGR.js → index-Cxo9mCw_.js} +30947 -27785
- package/dist/{index-B_1PPJgC.js → index-olfncHIq.js} +1 -1
- package/dist/{index-CAuT5j9Y.js → index-tnlYDALL.js} +2 -2
- package/dist/index.d.ts +8 -3
- package/dist/ir-snapshot.d.ts +3 -1
- package/dist/layers/bim-layer.d.ts +30 -7
- package/dist/layers/feature-mesh-layer.d.ts +1 -1
- package/dist/layers/popup-layer.d.ts +13 -0
- package/dist/legend-spec.d.ts +1 -1
- package/dist/{lerc-CbTjQ7uI.js → lerc-gKDDtc69.js} +2 -2
- package/dist/license.d.ts +25 -4
- package/dist/measure-controller.d.ts +482 -4
- package/dist/onlymap.standalone.js +53976 -50804
- package/dist/onlymapjs.js +42 -40
- package/dist/parse-manifest.d.ts +3 -0
- package/dist/programmatic.d.ts +34 -5
- package/dist/{raster-0b0nSHUh.js → raster-Cl5m3KsC.js} +2 -2
- package/dist/{raster-pipeline-D8siq7-4.js → raster-pipeline-hJGxIwYx.js} +1 -1
- package/dist/react/om-layer.d.ts +6 -1
- package/dist/react.js +167 -160
- package/dist/region-export-controller.d.ts +37 -0
- package/dist/region-export.d.ts +56 -0
- package/dist/runtime-core.d.ts +150 -0
- package/dist/selection.d.ts +11 -1
- package/dist/site-placement.d.ts +22 -0
- package/dist/snapping.d.ts +88 -0
- package/dist/terrain-heightfield.d.ts +53 -0
- package/dist/terrain-sample.d.ts +30 -0
- package/dist/terrain.d.ts +6 -1
- package/dist/units.d.ts +27 -0
- package/dist/version.d.ts +1 -1
- package/dist/volumetrics-run.d.ts +13 -0
- package/dist/volumetrics-worker.d.ts +1 -0
- package/dist/volumetrics.d.ts +201 -0
- package/dist/{zarr-DCYro_Vs.js → zarr-hRDavRGV.js} +2 -2
- package/docs/3d-assets.md +49 -1
- package/docs/live-data.md +26 -1
- package/docs/react.md +9 -1
- package/docs/testing.md +2 -0
- package/llms.txt +10 -5
- package/onlymapjs.html-data.json +161 -2
- package/package.json +4 -2
- package/skills/onlymapjs/SKILL.md +11 -1
- package/skills/onlymapjs/references/react.md +2 -2
- package/skills/onlymapjs/references/syntax.md +20 -8
- package/skills/onlymapjs/references/testing.md +6 -0
package/dist/react.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
3
|
var oe = (e, t, s) => Re(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
-
import { jsxs as X, jsx as
|
|
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
|
|
6
|
-
import { MANAGED_SLOTS as Ce, slotContainerStyle as ke, FOLD_SIDES as A, MapController as
|
|
7
|
-
import { createPortal as
|
|
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
8
|
const fe = xe(null);
|
|
9
9
|
function W(e) {
|
|
10
10
|
const t = Fe(fe);
|
|
@@ -17,8 +17,8 @@ function Q(e, 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:
|
|
21
|
-
return Q(i,
|
|
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) {
|
|
@@ -34,87 +34,87 @@ class qe {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
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
|
|
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
|
|
43
|
+
function Ye(e, t) {
|
|
44
44
|
return Object.entries(t).some(([s, o]) => o !== void 0 && e[s] !== o);
|
|
45
45
|
}
|
|
46
|
-
const
|
|
47
|
-
const { center: o, zoom: i, pitch:
|
|
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
|
-
), [
|
|
49
|
+
), [R, I] = j(!1), [V, me] = j(Be), [ge, ye] = j(
|
|
50
50
|
() => Object.fromEntries(A.map((r) => [r, 0]))
|
|
51
|
-
), [be, B] = j(null), Z = `om-react-fold-${ce().replaceAll(":", "")}`,
|
|
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
|
-
}),
|
|
54
|
+
}), pe = se((r) => {
|
|
55
55
|
q((n) => n === r ? n : r);
|
|
56
|
-
}, []), ve =
|
|
56
|
+
}, []), ve = L(
|
|
57
57
|
() => Object.fromEntries(
|
|
58
58
|
N.map((r) => [
|
|
59
59
|
r,
|
|
60
60
|
(n) => {
|
|
61
|
-
D((
|
|
61
|
+
D((u) => u[r] === n ? u : { ...u, [r]: n });
|
|
62
62
|
}
|
|
63
63
|
])
|
|
64
64
|
),
|
|
65
65
|
[]
|
|
66
|
-
), Se =
|
|
66
|
+
), Se = L(
|
|
67
67
|
() => Object.fromEntries(
|
|
68
68
|
A.map((r) => [
|
|
69
69
|
r,
|
|
70
70
|
(n) => {
|
|
71
|
-
me((
|
|
71
|
+
me((u) => u[r] === n ? u : { ...u, [r]: n });
|
|
72
72
|
}
|
|
73
73
|
])
|
|
74
74
|
),
|
|
75
75
|
[]
|
|
76
|
-
), te = se((r, n,
|
|
77
|
-
const f =
|
|
78
|
-
|
|
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
80
|
ie(() => {
|
|
81
|
-
const r =
|
|
81
|
+
const r = E.current;
|
|
82
82
|
if (!r) return;
|
|
83
|
-
let n,
|
|
83
|
+
let n, u = ze;
|
|
84
84
|
const f = (_) => {
|
|
85
85
|
const U = getComputedStyle(r).getPropertyValue("--om-widget-fold-breakpoint").trim();
|
|
86
|
-
U !== n && (n = U,
|
|
86
|
+
U !== n && (n = U, u = Ae(U, r)), I((we) => b && Ie(_, u, we));
|
|
87
87
|
};
|
|
88
|
-
if (f(r.getBoundingClientRect().width || (
|
|
88
|
+
if (f(r.getBoundingClientRect().width || (d ? d === !0 ? 800 : d.width ?? 800 : 0)), typeof ResizeObserver > "u") return;
|
|
89
89
|
const S = new ResizeObserver(([_]) => f(_.contentRect.width));
|
|
90
90
|
return S.observe(r), () => S.disconnect();
|
|
91
|
-
}, [
|
|
92
|
-
(!
|
|
93
|
-
}, [
|
|
94
|
-
const re = h({ center: o, zoom: i, pitch:
|
|
95
|
-
re.current = { center: o, zoom: i, pitch:
|
|
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
98
|
const $ = h(t.onViewStateChange);
|
|
99
99
|
$.current = t.onViewStateChange;
|
|
100
100
|
const H = h(t.onRuntimeError);
|
|
101
101
|
H.current = t.onRuntimeError;
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
const
|
|
102
|
+
const J = h(l);
|
|
103
|
+
J.current = l;
|
|
104
|
+
const Y = h(void 0);
|
|
105
105
|
ie(() => {
|
|
106
|
-
if (!
|
|
106
|
+
if (!C.current) return;
|
|
107
107
|
const r = re.current;
|
|
108
|
-
|
|
109
|
-
const n = new
|
|
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:
|
|
115
|
-
basemapKey:
|
|
116
|
-
attribution:
|
|
117
|
-
headless:
|
|
114
|
+
basemap: J.current,
|
|
115
|
+
basemapKey: g,
|
|
116
|
+
attribution: p,
|
|
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
|
|
@@ -124,63 +124,63 @@ const rt = Te(function(t, s) {
|
|
|
124
124
|
return (S = H.current) == null ? void 0 : S.call(H, f);
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
|
|
128
|
-
let
|
|
127
|
+
M(n);
|
|
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
|
-
|
|
133
|
+
u = !1, M(null), n.destroy();
|
|
134
134
|
};
|
|
135
|
-
}, [ee]),
|
|
136
|
-
!
|
|
137
|
-
}, [
|
|
138
|
-
if (!
|
|
139
|
-
const r = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch:
|
|
140
|
-
|
|
141
|
-
}, [
|
|
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 (
|
|
144
|
-
return (r = $.current) == null || r.call($,
|
|
143
|
+
if (a)
|
|
144
|
+
return (r = $.current) == null || r.call($, a.getViewState()), a.getStore("viewport").subscribe(() => {
|
|
145
145
|
var n;
|
|
146
|
-
return (n = $.current) == null ? void 0 : n.call($,
|
|
146
|
+
return (n = $.current) == null ? void 0 : n.call($, a.getViewState());
|
|
147
147
|
});
|
|
148
|
-
}, [
|
|
149
|
-
const Oe =
|
|
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
|
-
...
|
|
156
|
+
...F ? Me(F).properties : void 0
|
|
157
157
|
}),
|
|
158
|
-
[
|
|
159
|
-
),
|
|
160
|
-
() =>
|
|
161
|
-
[
|
|
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__ */ X("div", { ref:
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
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:
|
|
168
|
+
ref: pe,
|
|
169
169
|
style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
|
|
170
170
|
}
|
|
171
171
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
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
|
-
...
|
|
179
|
+
...R && r === "bottom-end" ? { bottom: "calc(var(--om-widget-inset-y, 12px) + 28px)" } : void 0
|
|
180
180
|
},
|
|
181
181
|
children: [
|
|
182
|
-
|
|
183
|
-
const
|
|
182
|
+
R && A.filter((n) => $e(n) === r && ge[n] > 0).map((n) => {
|
|
183
|
+
const u = be === n;
|
|
184
184
|
return /* @__PURE__ */ X(
|
|
185
185
|
"div",
|
|
186
186
|
{
|
|
@@ -188,29 +188,29 @@ const rt = Te(function(t, s) {
|
|
|
188
188
|
style: { ..._e(n), display: v ? "none" : "flex" },
|
|
189
189
|
onKeyDown: (f) => {
|
|
190
190
|
var S;
|
|
191
|
-
f.key !== "Escape" || !
|
|
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__ */
|
|
194
|
+
/* @__PURE__ */ O(
|
|
195
195
|
"button",
|
|
196
196
|
{
|
|
197
197
|
type: "button",
|
|
198
198
|
"data-om-fold-toggle": n,
|
|
199
|
-
"aria-expanded":
|
|
199
|
+
"aria-expanded": u,
|
|
200
200
|
"aria-controls": `${Z}-${n}`,
|
|
201
|
-
"aria-label": `${
|
|
201
|
+
"aria-label": `${u ? "Close" : "Open"} ${n} map controls`,
|
|
202
202
|
style: je(),
|
|
203
203
|
onClick: () => {
|
|
204
|
-
B(
|
|
204
|
+
B(u ? null : n), u || requestAnimationFrame(() => {
|
|
205
205
|
var S;
|
|
206
|
-
const f = (S =
|
|
207
|
-
f &&
|
|
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__ */
|
|
213
|
+
/* @__PURE__ */ O(
|
|
214
214
|
"div",
|
|
215
215
|
{
|
|
216
216
|
id: `${Z}-${n}`,
|
|
@@ -218,8 +218,8 @@ const rt = Te(function(t, s) {
|
|
|
218
218
|
"data-om-fold-panel": n,
|
|
219
219
|
role: "region",
|
|
220
220
|
"aria-label": `${n} map controls`,
|
|
221
|
-
hidden: !
|
|
222
|
-
style: { ...De(n), display:
|
|
221
|
+
hidden: !u,
|
|
222
|
+
style: { ...De(n), display: u ? "flex" : "none" }
|
|
223
223
|
}
|
|
224
224
|
)
|
|
225
225
|
]
|
|
@@ -227,7 +227,7 @@ const rt = Te(function(t, s) {
|
|
|
227
227
|
`fold-${n}`
|
|
228
228
|
);
|
|
229
229
|
}),
|
|
230
|
-
r === "bottom-start" && /* @__PURE__ */
|
|
230
|
+
r === "bottom-start" && /* @__PURE__ */ O(
|
|
231
231
|
"div",
|
|
232
232
|
{
|
|
233
233
|
"data-om-mandated-chrome": "badge",
|
|
@@ -237,7 +237,7 @@ const rt = Te(function(t, s) {
|
|
|
237
237
|
style: ae
|
|
238
238
|
}
|
|
239
239
|
),
|
|
240
|
-
r === "bottom-end" && /* @__PURE__ */
|
|
240
|
+
r === "bottom-end" && /* @__PURE__ */ O(
|
|
241
241
|
"div",
|
|
242
242
|
{
|
|
243
243
|
"data-om-mandated-chrome": "attribution",
|
|
@@ -251,9 +251,9 @@ const rt = Te(function(t, s) {
|
|
|
251
251
|
},
|
|
252
252
|
r
|
|
253
253
|
)) }),
|
|
254
|
-
ne && /* @__PURE__ */
|
|
254
|
+
ne && /* @__PURE__ */ O(fe.Provider, { value: ne, children: w })
|
|
255
255
|
] });
|
|
256
|
-
}),
|
|
256
|
+
}), Ge = /* @__PURE__ */ new Set([
|
|
257
257
|
"id",
|
|
258
258
|
"type",
|
|
259
259
|
"data",
|
|
@@ -264,6 +264,8 @@ const rt = Te(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 = Te(function(t, s) {
|
|
|
273
275
|
"onClick",
|
|
274
276
|
"onHover"
|
|
275
277
|
]);
|
|
276
|
-
function
|
|
277
|
-
const
|
|
278
|
-
for (const [
|
|
279
|
-
!
|
|
280
|
-
|
|
281
|
-
id:
|
|
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,54 +290,59 @@ 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:
|
|
301
|
+
...Object.keys(t).length > 0 ? { props: t } : {}
|
|
298
302
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
303
|
+
}
|
|
304
|
+
function ot(e) {
|
|
305
|
+
const { controller: t, layers: s } = W("OmLayer"), { id: o } = e, i = Ue(e);
|
|
306
|
+
x(() => {
|
|
307
|
+
s.upsert(i);
|
|
308
|
+
}), x(() => () => s.remove(o), [s, o]);
|
|
302
309
|
const m = h(e.onClick);
|
|
303
310
|
m.current = e.onClick;
|
|
304
|
-
const
|
|
305
|
-
return
|
|
311
|
+
const c = h(e.onHover);
|
|
312
|
+
return c.current = e.onHover, x(
|
|
306
313
|
() => t.watchPicks((l) => {
|
|
307
|
-
var g,
|
|
314
|
+
var g, p, d;
|
|
308
315
|
if (l === null) {
|
|
309
|
-
(g =
|
|
316
|
+
(g = c.current) == null || g.call(c, null);
|
|
310
317
|
return;
|
|
311
318
|
}
|
|
312
|
-
l.layerId === o && (l.type === "click" ? (
|
|
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
|
|
318
|
-
const { corners:
|
|
319
|
-
if (
|
|
320
|
-
if (
|
|
321
|
-
return
|
|
322
|
-
}, [
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
const T =
|
|
325
|
-
return T ?
|
|
326
|
-
/* @__PURE__ */
|
|
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);
|
|
326
|
+
if (x(() => {
|
|
327
|
+
if (y)
|
|
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":
|
|
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:
|
|
336
|
-
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:
|
|
345
|
+
children: m
|
|
339
346
|
}
|
|
340
347
|
),
|
|
341
348
|
T
|
|
@@ -344,7 +351,7 @@ function ot({ position: e = "top-start", order: t, fold: s, className: o, style:
|
|
|
344
351
|
function le(e, t, s, o) {
|
|
345
352
|
return t && (e == null ? void 0 : e.layerId) !== t ? !1 : !s || (e ? e.type : o) === s;
|
|
346
353
|
}
|
|
347
|
-
const
|
|
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
|
|
359
|
-
const { controller: t, overlayPane: s } = W("OmOverlay"), o = h(null), i = h(void 0),
|
|
360
|
-
|
|
361
|
-
const
|
|
362
|
-
const
|
|
363
|
-
let
|
|
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:
|
|
372
|
+
subscribe: b.subscribe,
|
|
366
373
|
getSnapshot: () => {
|
|
367
|
-
const
|
|
368
|
-
return (
|
|
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]),
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
378
|
+
}, [t]), l = de(
|
|
379
|
+
c.subscribe,
|
|
380
|
+
c.getSnapshot,
|
|
381
|
+
c.getSnapshot
|
|
375
382
|
);
|
|
376
|
-
|
|
377
|
-
() => t.registerOverlay((
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
const { anchor:
|
|
381
|
-
let
|
|
382
|
-
if (
|
|
383
|
-
|
|
383
|
+
x(
|
|
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,
|
|
387
|
-
if (!(D >= 0 && D <=
|
|
388
|
-
|
|
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
|
-
|
|
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:
|
|
398
|
-
return
|
|
399
|
-
/* @__PURE__ */
|
|
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:
|
|
410
|
+
className: p,
|
|
404
411
|
style: {
|
|
405
412
|
position: "absolute",
|
|
406
413
|
top: 0,
|
|
@@ -408,8 +415,8 @@ 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:
|
|
412
|
-
...
|
|
418
|
+
pointerEvents: F ? "auto" : "none",
|
|
419
|
+
...d
|
|
413
420
|
},
|
|
414
421
|
children: v
|
|
415
422
|
}
|
|
@@ -417,29 +424,29 @@ function st(e) {
|
|
|
417
424
|
s
|
|
418
425
|
);
|
|
419
426
|
}
|
|
420
|
-
function
|
|
421
|
-
const { controller: t } = W("useOmMap"), s = e.join(" "), o =
|
|
422
|
-
const
|
|
423
|
-
let
|
|
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: (
|
|
426
|
-
const
|
|
432
|
+
subscribe: (g) => {
|
|
433
|
+
const p = c.map((d) => d.subscribe(g));
|
|
427
434
|
return () => {
|
|
428
|
-
for (const
|
|
435
|
+
for (const d of p) d();
|
|
429
436
|
};
|
|
430
437
|
},
|
|
431
438
|
getSnapshot: () => {
|
|
432
|
-
const
|
|
433
|
-
return (!
|
|
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 =
|
|
437
|
-
return
|
|
443
|
+
}, [t, s]), i = de(o.subscribe, o.getSnapshot, o.getSnapshot);
|
|
444
|
+
return L(() => t.buildCtx(), [t, i]);
|
|
438
445
|
}
|
|
439
446
|
export {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
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 {};
|