@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.
- package/CHANGELOG.md +63 -1
- package/README.md +39 -14
- package/THIRD-PARTY-LICENSES.md +27 -0
- package/dist/{LercDecode.es-fbo6h5rt.js → LercDecode.es-BOJJr6Gx.js} +1 -1
- package/dist/{basemap-CprSan9q.js → basemap-BofXgXxy.js} +13 -3
- package/dist/basemap.d.ts +10 -1
- package/dist/cityjson-D_V5GY8b.js +332 -0
- package/dist/clip-box-controller.d.ts +94 -0
- package/dist/clip-box.d.ts +109 -0
- package/dist/crs-Ciu7Xs7a.js +108 -0
- package/dist/crs.d.ts +50 -0
- package/dist/ctx.d.ts +8 -1
- package/dist/data-layer.d.ts +11 -3
- package/dist/draw-controller.d.ts +75 -1
- package/dist/draw.d.ts +22 -4
- package/dist/elements/om-map.d.ts +45 -2
- package/dist/elements/om-overlay.d.ts +13 -1
- package/dist/elements/om-widget.d.ts +4 -0
- package/dist/feature-colors.d.ts +41 -0
- package/dist/geodesy.d.ts +29 -3
- package/dist/{geoparquet-Bm8pfxyo.js → geoparquet-DapHATA0.js} +1 -1
- package/dist/html-data.d.ts +2 -2
- package/dist/ifc-Dc-TdSJr.js +877 -0
- package/dist/ifc.d.ts +406 -0
- package/dist/{index-Bz-rbmhj.js → index-7B-6Cbzu.js} +31619 -26565
- package/dist/{index-DSRIZR81.js → index-BF9iO8Tq.js} +1 -1
- package/dist/{index-GOwMjqm6.js → index-BmX6IId3.js} +1 -1
- package/dist/{index-UzmNhuS0.js → index-SPJVn_n_.js} +1 -1
- package/dist/{index-CCQttJzO.js → index-xmJjZxQJ.js} +2 -2
- package/dist/index.d.ts +13 -2
- package/dist/ir-snapshot.d.ts +3 -1
- package/dist/layer-registry.d.ts +14 -0
- package/dist/layers/bim-layer.d.ts +127 -0
- package/dist/layers/feature-mesh-layer.d.ts +288 -0
- package/dist/layers/gltf-scene-walk.d.ts +55 -0
- package/dist/layers/popup-layer.d.ts +13 -0
- package/dist/legend-spec.d.ts +1 -1
- package/dist/{lerc-CuifOkoA.js → lerc-C6k7EzSN.js} +2 -2
- package/dist/license.d.ts +12 -5
- package/dist/measure-controller.d.ts +458 -4
- package/dist/meshopt_simplifier-Co6uRDDA.js +370 -0
- package/dist/onlymap.standalone.js +57077 -50729
- package/dist/onlymapjs.js +72 -69
- package/dist/parse-manifest.d.ts +3 -0
- package/dist/programmatic.d.ts +39 -5
- package/dist/{raster-dysYIQ_k.js → raster-Cuzhibe2.js} +2 -2
- package/dist/{raster-pipeline-ZdCOGfqV.js → raster-pipeline-DLrnJK8y.js} +1 -1
- package/dist/react/om-layer.d.ts +6 -1
- package/dist/react/om-overlay.d.ts +9 -0
- package/dist/react.js +176 -169
- package/dist/region-export-controller.d.ts +37 -0
- package/dist/region-export.d.ts +56 -0
- package/dist/runtime-core.d.ts +260 -3
- package/dist/selection.d.ts +44 -1
- package/dist/site-placement.d.ts +107 -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/testing.d.ts +6 -2
- package/dist/tile3d-metadata.d.ts +185 -0
- 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/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-OewK7k2K.js → zarr-CUzEX8fB.js} +79 -66
- package/docs/3d-assets.md +48 -0
- package/docs/live-data.md +9 -1
- package/docs/testing.md +4 -2
- package/llms.txt +10 -5
- package/onlymapjs.html-data.json +313 -2
- package/package.json +6 -2
- package/skills/onlymapjs/SKILL.md +14 -2
- package/skills/onlymapjs/references/react.md +2 -2
- package/skills/onlymapjs/references/syntax.md +314 -15
- 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
|
|
7
|
-
import { createPortal as
|
|
8
|
-
const
|
|
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(
|
|
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: 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
|
-
|
|
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 =
|
|
37
|
-
function
|
|
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
|
|
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
|
-
), [
|
|
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
|
-
}),
|
|
55
|
-
|
|
56
|
-
}, []), ve =
|
|
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
|
-
|
|
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,
|
|
@@ -73,147 +73,147 @@ const rt = Ce(function(t, s) {
|
|
|
73
73
|
])
|
|
74
74
|
),
|
|
75
75
|
[]
|
|
76
|
-
),
|
|
77
|
-
const f =
|
|
78
|
-
u ? f.add(n) : f.delete(n), 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
|
-
|
|
81
|
-
const r =
|
|
80
|
+
ie(() => {
|
|
81
|
+
const r = E.current;
|
|
82
82
|
if (!r) return;
|
|
83
83
|
let n, u = ze;
|
|
84
84
|
const f = (_) => {
|
|
85
|
-
const
|
|
86
|
-
|
|
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
|
|
90
|
-
return
|
|
91
|
-
}, [
|
|
92
|
-
(!
|
|
93
|
-
}, [
|
|
94
|
-
const
|
|
95
|
-
|
|
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
|
|
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
|
-
|
|
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 =
|
|
108
|
-
|
|
109
|
-
const n = new
|
|
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:
|
|
115
|
-
basemapKey:
|
|
116
|
-
attribution:
|
|
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
|
|
124
|
-
return (
|
|
123
|
+
var S;
|
|
124
|
+
return (S = H.current) == null ? void 0 : S.call(H, f);
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
|
|
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,
|
|
133
|
+
u = !1, M(null), n.destroy();
|
|
134
134
|
};
|
|
135
|
-
}, [
|
|
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 =
|
|
143
|
+
if (a)
|
|
144
|
+
return (r = $.current) == null || r.call($, a.getViewState()), a.getStore("viewport").subscribe(() => {
|
|
145
145
|
var n;
|
|
146
|
-
return (n =
|
|
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__ */
|
|
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 u =
|
|
184
|
-
return /* @__PURE__ */
|
|
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
|
|
191
|
-
f.key !== "Escape" || !u || (
|
|
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__ */
|
|
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": `${
|
|
200
|
+
"aria-controls": `${Z}-${n}`,
|
|
201
201
|
"aria-label": `${u ? "Close" : "Open"} ${n} map controls`,
|
|
202
202
|
style: je(),
|
|
203
203
|
onClick: () => {
|
|
204
|
-
|
|
205
|
-
var
|
|
206
|
-
const f = (
|
|
207
|
-
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__ */
|
|
213
|
+
/* @__PURE__ */ O(
|
|
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",
|
|
@@ -227,33 +227,33 @@ const rt = Ce(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",
|
|
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__ */ 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:
|
|
247
|
+
style: ae
|
|
248
248
|
}
|
|
249
249
|
)
|
|
250
250
|
]
|
|
251
251
|
},
|
|
252
252
|
r
|
|
253
253
|
)) }),
|
|
254
|
-
|
|
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 = 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
|
|
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,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:
|
|
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(
|
|
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
|
|
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:
|
|
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,
|
|
322
|
-
}, [y,
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
const
|
|
325
|
-
return
|
|
326
|
-
/* @__PURE__ */
|
|
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
|
|
342
349
|
) : null;
|
|
343
350
|
}
|
|
344
|
-
function
|
|
345
|
-
return
|
|
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
|
|
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 y,
|
|
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
383
|
x(
|
|
377
|
-
() => t.registerOverlay((
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
const { anchor:
|
|
381
|
-
let
|
|
382
|
-
if (
|
|
383
|
-
|
|
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,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:
|
|
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
|
|
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 d of
|
|
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 {};
|