@nika-js/onlymap 0.5.12 → 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.
- package/CHANGELOG.md +19 -0
- package/LICENSE.md +2 -0
- package/README.md +19 -7
- package/THIRD-PARTY-LICENSES.md +27 -0
- package/dist/{LercDecode.es-C97NsRLr.js → LercDecode.es-CJnypw8j.js} +1 -1
- package/dist/{basemap-kc0aQNqr.js → basemap-DrQ0-eyR.js} +1 -1
- package/dist/cityjson-D_V5GY8b.js +332 -0
- package/dist/crs-Ciu7Xs7a.js +108 -0
- package/dist/crs.d.ts +50 -0
- package/dist/ctx.d.ts +8 -1
- package/dist/elements/om-map.d.ts +26 -2
- package/dist/elements/om-overlay.d.ts +1 -1
- package/dist/elements/om-widget.d.ts +4 -0
- package/dist/feature-colors.d.ts +41 -0
- package/dist/{geoparquet-Dn1BypCS.js → geoparquet-Dix4lTNy.js} +1 -1
- package/dist/html-data.d.ts +1 -1
- package/dist/ifc-Dc-TdSJr.js +877 -0
- package/dist/ifc.d.ts +406 -0
- package/dist/{index-aBiHCzy-.js → index-1UgNlfGR.js} +20944 -18922
- package/dist/{index-BoUIm-jd.js → index-BQMjW5w0.js} +1 -1
- package/dist/{index-BcG3m2rF.js → index-B_1PPJgC.js} +1 -1
- package/dist/{index-DA_aop8u.js → index-CAuT5j9Y.js} +2 -2
- package/dist/{index-Dc-ZLLo8.js → index-CXPaeisL.js} +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/layer-registry.d.ts +14 -0
- package/dist/layers/bim-layer.d.ts +104 -0
- package/dist/layers/feature-mesh-layer.d.ts +288 -0
- package/dist/layers/gltf-scene-walk.d.ts +55 -0
- package/dist/{lerc-74-SNPeU.js → lerc-CbTjQ7uI.js} +2 -2
- package/dist/license.d.ts +29 -5
- package/dist/meshopt_simplifier-Co6uRDDA.js +370 -0
- package/dist/onlymap.standalone.js +58057 -54751
- package/dist/onlymapjs.js +69 -67
- package/dist/programmatic.d.ts +22 -2
- package/dist/{raster-VyHCbPXy.js → raster-0b0nSHUh.js} +2 -2
- package/dist/{raster-pipeline-CGQTOUjw.js → raster-pipeline-D8siq7-4.js} +1 -1
- package/dist/react/om-overlay.d.ts +9 -0
- package/dist/react.js +144 -144
- package/dist/runtime-core.d.ts +110 -3
- package/dist/selection.d.ts +33 -0
- package/dist/site-placement.d.ts +85 -0
- package/dist/testing.d.ts +6 -2
- package/dist/tile3d-metadata.d.ts +185 -0
- package/dist/version.d.ts +1 -1
- package/dist/widget-registry.d.ts +11 -0
- package/dist/widgets/ifc-clash.d.ts +18 -0
- package/dist/widgets/ifc.d.ts +41 -0
- package/dist/{zarr-DddHNVim.js → zarr-DCYro_Vs.js} +79 -66
- package/docs/3d-assets.md +3 -3
- package/docs/live-data.md +2 -2
- package/docs/stories.md +1 -1
- package/docs/testing.md +2 -2
- package/llms.txt +3 -3
- package/onlymapjs.html-data.json +152 -0
- package/package.json +7 -2
- package/skills/onlymapjs/SKILL.md +4 -2
- package/skills/onlymapjs/references/react.md +1 -1
- package/skills/onlymapjs/references/syntax.md +299 -12
- 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
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { createContext as xe, useContext as Fe, forwardRef as
|
|
6
|
-
import { MANAGED_SLOTS as
|
|
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
|
|
8
|
+
const fe = xe(null);
|
|
9
9
|
function W(e) {
|
|
10
|
-
const t = Fe(
|
|
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
|
|
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:
|
|
21
|
-
return
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
47
|
-
const { center: o, zoom: i, pitch:
|
|
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
|
-
), [
|
|
49
|
+
), [x, I] = j(!1), [V, me] = j(Be), [ge, ye] = j(
|
|
50
50
|
() => Object.fromEntries(A.map((r) => [r, 0]))
|
|
51
|
-
), [
|
|
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 =
|
|
55
|
-
|
|
56
|
-
}, []), ve =
|
|
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
|
-
|
|
61
|
+
D((d) => d[r] === n ? d : { ...d, [r]: n });
|
|
62
62
|
}
|
|
63
63
|
])
|
|
64
64
|
),
|
|
65
65
|
[]
|
|
66
|
-
), Se =
|
|
66
|
+
), Se = M(
|
|
67
67
|
() => Object.fromEntries(
|
|
68
68
|
A.map((r) => [
|
|
69
69
|
r,
|
|
70
70
|
(n) => {
|
|
71
|
-
me((
|
|
71
|
+
me((d) => d[r] === n ? d : { ...d, [r]: n });
|
|
72
72
|
}
|
|
73
73
|
])
|
|
74
74
|
),
|
|
75
75
|
[]
|
|
76
|
-
),
|
|
77
|
-
const f = pe.current.get(r),
|
|
78
|
-
|
|
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
|
-
|
|
80
|
+
ie(() => {
|
|
81
81
|
const r = R.current;
|
|
82
82
|
if (!r) return;
|
|
83
|
-
let n,
|
|
83
|
+
let n, d = ze;
|
|
84
84
|
const f = (_) => {
|
|
85
|
-
const
|
|
86
|
-
|
|
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 || (
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
}, [p,
|
|
92
|
-
(!
|
|
93
|
-
}, [
|
|
94
|
-
const
|
|
95
|
-
|
|
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
|
|
99
|
-
|
|
98
|
+
const $ = h(t.onViewStateChange);
|
|
99
|
+
$.current = t.onViewStateChange;
|
|
100
100
|
const H = h(t.onRuntimeError);
|
|
101
101
|
H.current = t.onRuntimeError;
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
if (!
|
|
107
|
-
const r =
|
|
108
|
-
|
|
109
|
-
const n = new Me(
|
|
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:
|
|
114
|
+
basemap: Y.current,
|
|
115
115
|
basemapKey: l,
|
|
116
116
|
attribution: g,
|
|
117
|
-
headless:
|
|
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
|
|
124
|
-
return (
|
|
123
|
+
var S;
|
|
124
|
+
return (S = H.current) == null ? void 0 : S.call(H, f);
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
|
|
128
|
-
let
|
|
127
|
+
L(n);
|
|
128
|
+
let d = !0;
|
|
129
129
|
return n.ready.then(() => {
|
|
130
130
|
var f;
|
|
131
|
-
|
|
131
|
+
d && ((f = K.current) == null || f.call(K));
|
|
132
132
|
}), () => {
|
|
133
|
-
|
|
133
|
+
d = !1, L(null), n.destroy();
|
|
134
134
|
};
|
|
135
|
-
}, [
|
|
136
|
-
!c ||
|
|
137
|
-
}, [c, a]), Pe(s, () => c, [c]),
|
|
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:
|
|
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,
|
|
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 =
|
|
144
|
+
return (r = $.current) == null || r.call($, c.getViewState()), c.getStore("viewport").subscribe(() => {
|
|
145
145
|
var n;
|
|
146
|
-
return (n =
|
|
146
|
+
return (n = $.current) == null ? void 0 : n.call($, c.getViewState());
|
|
147
147
|
});
|
|
148
148
|
}, [c]);
|
|
149
|
-
const Oe =
|
|
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
|
-
...
|
|
156
|
+
...O ? Le(O).properties : void 0
|
|
157
157
|
}),
|
|
158
|
-
[
|
|
159
|
-
),
|
|
160
|
-
() => c &&
|
|
161
|
-
[c,
|
|
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__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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
|
-
...
|
|
179
|
+
...x && r === "bottom-end" ? { bottom: "calc(var(--om-widget-inset-y, 12px) + 28px)" } : void 0
|
|
180
180
|
},
|
|
181
181
|
children: [
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
return /* @__PURE__ */
|
|
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
|
|
191
|
-
f.key !== "Escape" || !
|
|
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__ */
|
|
194
|
+
/* @__PURE__ */ w(
|
|
195
195
|
"button",
|
|
196
196
|
{
|
|
197
197
|
type: "button",
|
|
198
198
|
"data-om-fold-toggle": n,
|
|
199
|
-
"aria-expanded":
|
|
200
|
-
"aria-controls": `${
|
|
201
|
-
"aria-label": `${
|
|
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
|
-
|
|
205
|
-
var
|
|
206
|
-
const f = (
|
|
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__ */
|
|
213
|
+
/* @__PURE__ */ w(
|
|
214
214
|
"div",
|
|
215
215
|
{
|
|
216
|
-
id: `${
|
|
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: !
|
|
222
|
-
style: { ...De(n), display:
|
|
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__ */
|
|
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:
|
|
237
|
+
style: ae
|
|
238
238
|
}
|
|
239
239
|
),
|
|
240
|
-
r === "bottom-end" && /* @__PURE__ */
|
|
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:
|
|
247
|
+
style: ae
|
|
248
248
|
}
|
|
249
249
|
)
|
|
250
250
|
]
|
|
251
251
|
},
|
|
252
252
|
r
|
|
253
253
|
)) }),
|
|
254
|
-
|
|
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
|
|
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
|
-
|
|
300
|
-
s.upsert(
|
|
301
|
-
}),
|
|
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,
|
|
305
|
+
return a.current = e.onHover, F(
|
|
306
306
|
() => t.watchPicks((l) => {
|
|
307
|
-
var g,
|
|
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" ? (
|
|
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:
|
|
318
|
-
const { corners: m, widgetsHidden: a, widgetsFolded: l, foldPanels: g, registerFoldedWidget:
|
|
319
|
-
if (
|
|
320
|
-
if (
|
|
321
|
-
return
|
|
322
|
-
}, [
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
const
|
|
325
|
-
return
|
|
326
|
-
/* @__PURE__ */
|
|
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:
|
|
338
|
+
children: y
|
|
339
339
|
}
|
|
340
340
|
),
|
|
341
|
-
|
|
341
|
+
T
|
|
342
342
|
) : null;
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
return
|
|
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),
|
|
360
|
-
|
|
361
|
-
const m =
|
|
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
|
|
363
|
+
let b, T, E = null;
|
|
364
364
|
return {
|
|
365
365
|
subscribe: p.subscribe,
|
|
366
366
|
getSnapshot: () => {
|
|
367
|
-
const R = p.getSnapshot(), { anchorFrom:
|
|
368
|
-
return (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 =
|
|
371
|
+
}, [t]), a = ue(
|
|
372
372
|
m.subscribe,
|
|
373
373
|
m.getSnapshot,
|
|
374
374
|
m.getSnapshot
|
|
375
375
|
);
|
|
376
|
-
|
|
377
|
-
() => t.registerOverlay((p,
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
const { anchor:
|
|
381
|
-
let
|
|
382
|
-
if (
|
|
383
|
-
|
|
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,
|
|
387
|
-
if (!(D >= 0 && D <= p.width &&
|
|
388
|
-
|
|
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
|
-
|
|
391
|
+
E.style.visibility = "visible", E.style.transform = `translate(${D}px, ${x}px) ${Ue[q ?? "bottom-center"]}`;
|
|
392
392
|
}),
|
|
393
393
|
[t]
|
|
394
|
-
),
|
|
394
|
+
), F(() => {
|
|
395
395
|
t.refreshOverlays();
|
|
396
396
|
});
|
|
397
|
-
const { children: l, className: g, style:
|
|
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__ */
|
|
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:
|
|
412
|
-
...
|
|
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 =
|
|
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((
|
|
426
|
+
const g = m.map((u) => u.subscribe(l));
|
|
427
427
|
return () => {
|
|
428
|
-
for (const
|
|
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,
|
|
433
|
+
return (!a || l.some((g, u) => g !== a[u])) && (a = l), a;
|
|
434
434
|
}
|
|
435
435
|
};
|
|
436
|
-
}, [t, s]), i =
|
|
437
|
-
return
|
|
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,
|