@nika-js/onlymap 0.11.11 → 0.12.0
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/README.md +9 -3
- package/dist/attribute-resolution.d.ts +2 -0
- package/dist/{basemap-QT4ua-dL.js → basemap-CtDse0mW.js} +1514 -1462
- package/dist/basemap.d.ts +41 -1
- package/dist/cartograph.js +362 -321
- package/dist/cartograph.standalone.js +1995 -1914
- package/dist/{cityjson-k-z1r6c0.js → cityjson-DMc_dwu1.js} +1 -1
- package/dist/{crs-BzE_KP4M.js → crs-D5FyQfEu.js} +74 -7
- package/dist/{crs-ChglCB3O.js → crs-ZdDBJ2EY.js} +39 -36
- package/dist/data-layer.d.ts +36 -3
- package/dist/elements/om-map.d.ts +2 -1
- package/dist/geoparquet-BTHYX1ET.js +30 -0
- package/dist/geoparquet.d.ts +6 -7
- package/dist/{globe-view-BSGTUqWc.js → globe-view-KrKNOmVs.js} +11 -11
- package/dist/hillshade-CijRdYyU.js +209 -0
- package/dist/html-data.d.ts +1 -1
- package/dist/{ifc-DXwePQRv.js → ifc-sisRo7I7.js} +1 -1
- package/dist/{index-Bxue4Psc.js → index-21KGElDr.js} +9 -9
- package/dist/{index-DjYxw-8H.js → index-A45DtXly.js} +18 -18
- package/dist/{index-Dwc4s3mc.js → index-BPa2CC8T.js} +20 -20
- package/dist/{index-DudIuhJa.js → index-B_Vhebf7.js} +1 -1
- package/dist/{index-DBt_2x-w.js → index-Bfocr1_A.js} +106 -106
- package/dist/{index-CevWTqBO.js → index-DMc81n9B.js} +14362 -13782
- package/dist/{index-D1ZjhP2H.js → index-DS6VUGi6.js} +11 -11
- package/dist/{index-BO7MtTkn.js → index-DoGY-Vgi.js} +3 -3
- package/dist/{index-Bzypgr1v.js → index-eHYe06mM.js} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/ir.d.ts +6 -0
- package/dist/layer-registry.d.ts +21 -0
- package/dist/layers/warped-bitmap-layer.d.ts +27 -0
- package/dist/{lerc-DQuf93SN.js → lerc-DjrPALEj.js} +1 -1
- package/dist/onlymap.standalone.js +53019 -52455
- package/dist/onlymapjs.js +86 -84
- package/dist/parse-manifest.d.ts +12 -9
- package/dist/{post-process-effect-B3j_nBzy.js → post-process-effect-Be1qa2DD.js} +5 -5
- package/dist/programmatic.d.ts +12 -0
- package/dist/projection.d.ts +44 -1
- package/dist/{raster-pipeline-CusoihQ3.js → raster-pipeline-DspBYxwc.js} +1 -1
- package/dist/{raster-CvAJ-h_g.js → raster-zC3qXBrs.js} +3 -3
- package/dist/react/om-layer.d.ts +4 -0
- package/dist/react/om-map.d.ts +2 -0
- package/dist/react.js +225 -218
- package/dist/runtime-core.d.ts +24 -0
- package/dist/source-crs.d.ts +99 -0
- package/dist/{text-on-path-D9u5SYCo.js → text-on-path-D0_URrD2.js} +1 -1
- package/dist/{zarr-DWb_nikR.js → zarr-DopOhzfY.js} +2 -2
- package/docs/cartography.md +106 -1
- package/llms.txt +2 -1
- package/onlymapjs.attributes.json +2 -0
- package/onlymapjs.html-data.json +26 -4
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +4 -2
- package/skills/onlymapjs/references/syntax.md +16 -1
- package/dist/geoparquet-hOsdfZJa.js +0 -35
- package/dist/hillshade-D2Ps3Nim.js +0 -298
package/dist/react.js
CHANGED
|
@@ -1,172 +1,177 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { MANAGED_SLOTS as
|
|
7
|
-
import { createPortal as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const e =
|
|
1
|
+
var _e = Object.defineProperty;
|
|
2
|
+
var $e = (t, e, s) => e in t ? _e(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var me = (t, e, s) => $e(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { jsxs as re, jsx as C } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as Ae, useContext as ze, forwardRef as Be, useRef as y, useState as T, useId as he, useCallback as ne, useMemo as _, useLayoutEffect as ge, useEffect as E, useImperativeHandle as Ie, useSyncExternalStore as ve } from "react";
|
|
6
|
+
import { MANAGED_SLOTS as Ke, slotContainerStyle as We, FOLD_SIDES as W, MapController as He, parseWidgetStyle as Ne, foldToggleSlot as Ve, foldToggleStyle as qe, foldPanelStyle as Ge, foldDrawerStyle as Je, resolveFoldBreakpointPx as Ye, shouldFoldAtWidth as Xe, effectiveFoldBreakpointPx as Ze, DEFAULT_FOLD_BREAKPOINT_PX as Ue, bottomEndLiftPx as Qe, FOLD_BOTTOM_CLEARANCE_PX as et, resolveSlot as tt, foldSideForSlot as rt, isStoreToken as nt } from "@nika-js/onlymap";
|
|
7
|
+
import { createPortal as Se } from "react-dom";
|
|
8
|
+
const Oe = Ae(null);
|
|
9
|
+
function Y(t) {
|
|
10
|
+
const e = ze(Oe);
|
|
11
11
|
if (!e) throw new Error(`[onlymapjs] ${t} must be rendered inside <OmMap>.`);
|
|
12
12
|
return e;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function oe(t, e) {
|
|
15
15
|
if (t === e) return !0;
|
|
16
16
|
const s = Object.keys(t ?? {}), o = Object.keys(e ?? {});
|
|
17
17
|
return s.length !== o.length ? !1 : s.every((i) => t[i] === e[i]);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const { props: s, updateTriggers: o, ...i } = t, { props: g, updateTriggers:
|
|
21
|
-
return
|
|
19
|
+
function ot(t, e) {
|
|
20
|
+
const { props: s, updateTriggers: o, ...i } = t, { props: g, updateTriggers: p, ...u } = e;
|
|
21
|
+
return oe(i, u) && oe(s, g) && oe(o, p);
|
|
22
22
|
}
|
|
23
|
-
class
|
|
23
|
+
class st {
|
|
24
24
|
constructor(e) {
|
|
25
|
-
|
|
25
|
+
me(this, "descriptors", /* @__PURE__ */ new Map());
|
|
26
26
|
this.controller = e;
|
|
27
27
|
}
|
|
28
28
|
upsert(e) {
|
|
29
29
|
const s = this.descriptors.get(e.id);
|
|
30
|
-
s &&
|
|
30
|
+
s && ot(s, e) || (this.descriptors.set(e.id, e), this.controller.setLayers([...this.descriptors.values()]));
|
|
31
31
|
}
|
|
32
32
|
remove(e) {
|
|
33
33
|
this.descriptors.delete(e) && this.controller.setLayers([...this.descriptors.values()]);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
36
|
+
const J = Ke, it = Object.fromEntries(J.map((t) => [t, We(t)])), ye = { display: "flex", pointerEvents: "none", order: 2147483647 }, at = Object.fromEntries(W.map((t) => [t, null]));
|
|
37
|
+
function lt(t) {
|
|
38
38
|
const e = t.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
|
e ? e.focus() : (t.tabIndex = -1, t.focus());
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function ct(t, e) {
|
|
44
44
|
return Object.entries(e).some(([s, o]) => o !== void 0 && t[s] !== o);
|
|
45
45
|
}
|
|
46
|
-
const
|
|
47
|
-
const { center: o, zoom: i, pitch: g, bearing:
|
|
48
|
-
() => Object.fromEntries(
|
|
49
|
-
), [
|
|
50
|
-
() => Object.fromEntries(
|
|
51
|
-
), [
|
|
46
|
+
const vt = Be(function(e, s) {
|
|
47
|
+
const { center: o, zoom: i, pitch: g, bearing: p, basemap: u, projection: f, basemapKey: v, attribution: b, headless: S, widgetStyle: P, widgetsHidden: d, widgetsFold: h = !0, className: O, style: w, children: j } = e, F = y(null), k = y(null), [l, $] = T(null), [B, M] = T(null), [L, I] = T(
|
|
48
|
+
() => Object.fromEntries(J.map((r) => [r, null]))
|
|
49
|
+
), [x, se] = T(!1), [H, Re] = T({ lift: 0, shift: 0 }), [ie, Ee] = T(at), [Pe, Ce] = T(
|
|
50
|
+
() => Object.fromEntries(W.map((r) => [r, 0]))
|
|
51
|
+
), [Fe, X] = T(null), ae = `om-react-fold-${he().replaceAll(":", "")}`, xe = y(new Map(W.map((r) => [r, /* @__PURE__ */ new Set()]))), Te = y(/* @__PURE__ */ new Map()), [le, je] = T(() => /* @__PURE__ */ new Set()), ce = S ? JSON.stringify(S) : "", N = y({
|
|
52
52
|
badge: null,
|
|
53
53
|
attribution: null
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
}, []),
|
|
54
|
+
}), ke = ne((r) => {
|
|
55
|
+
M((n) => n === r ? n : r);
|
|
56
|
+
}, []), Me = _(
|
|
57
57
|
() => Object.fromEntries(
|
|
58
|
-
|
|
58
|
+
J.map((r) => [
|
|
59
59
|
r,
|
|
60
60
|
(n) => {
|
|
61
|
-
|
|
61
|
+
I((a) => a[r] === n ? a : { ...a, [r]: n });
|
|
62
62
|
}
|
|
63
63
|
])
|
|
64
64
|
),
|
|
65
65
|
[]
|
|
66
|
-
),
|
|
66
|
+
), Le = _(
|
|
67
67
|
() => Object.fromEntries(
|
|
68
|
-
|
|
68
|
+
W.map((r) => [
|
|
69
69
|
r,
|
|
70
70
|
(n) => {
|
|
71
|
-
|
|
71
|
+
Ee((a) => a[r] === n ? a : { ...a, [r]: n });
|
|
72
72
|
}
|
|
73
73
|
])
|
|
74
74
|
),
|
|
75
75
|
[]
|
|
76
|
-
),
|
|
77
|
-
const
|
|
78
|
-
a ?
|
|
79
|
-
}, []),
|
|
80
|
-
const
|
|
81
|
-
a ?
|
|
82
|
-
const
|
|
83
|
-
|
|
76
|
+
), de = ne((r, n, a) => {
|
|
77
|
+
const c = xe.current.get(r), m = c.size;
|
|
78
|
+
a ? c.add(n) : c.delete(n), c.size !== m && Ce((R) => ({ ...R, [r]: c.size }));
|
|
79
|
+
}, []), ue = ne((r, n, a) => {
|
|
80
|
+
const c = Te.current;
|
|
81
|
+
a ? c.set(n, r) : c.delete(n);
|
|
82
|
+
const m = new Set(c.values());
|
|
83
|
+
je((R) => R.size === m.size && [...m].every((D) => R.has(D)) ? R : m);
|
|
84
84
|
}, []);
|
|
85
|
-
|
|
86
|
-
const r =
|
|
85
|
+
ge(() => {
|
|
86
|
+
const r = F.current;
|
|
87
87
|
if (!r) return;
|
|
88
|
-
let n, a =
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
88
|
+
let n, a = Ue;
|
|
89
|
+
const c = (R) => {
|
|
90
|
+
const D = getComputedStyle(r).getPropertyValue("--om-widget-fold-breakpoint").trim();
|
|
91
|
+
D !== n && (n = D, a = Ye(D, r)), se((K) => h && Xe(R, Ze(a, le), K));
|
|
92
92
|
};
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
}, [
|
|
97
|
-
(!
|
|
98
|
-
}, [
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const Z =
|
|
108
|
-
Z.current =
|
|
109
|
-
const U =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
93
|
+
if (c(r.getBoundingClientRect().width || (S ? S === !0 ? 800 : S.width ?? 800 : 0)), typeof ResizeObserver > "u") return;
|
|
94
|
+
const m = new ResizeObserver(([R]) => c(R.contentRect.width));
|
|
95
|
+
return m.observe(r), () => m.disconnect();
|
|
96
|
+
}, [h, ce, le]), E(() => {
|
|
97
|
+
(!x || d) && X(null);
|
|
98
|
+
}, [x, d]);
|
|
99
|
+
const fe = y({ center: o, zoom: i, pitch: g, bearing: p });
|
|
100
|
+
fe.current = { center: o, zoom: i, pitch: g, bearing: p };
|
|
101
|
+
const V = y(e.onReady);
|
|
102
|
+
V.current = e.onReady;
|
|
103
|
+
const A = y(e.onViewStateChange);
|
|
104
|
+
A.current = e.onViewStateChange;
|
|
105
|
+
const q = y(e.onRuntimeError);
|
|
106
|
+
q.current = e.onRuntimeError;
|
|
107
|
+
const Z = y(u);
|
|
108
|
+
Z.current = u;
|
|
109
|
+
const U = y(f);
|
|
110
|
+
U.current = f;
|
|
111
|
+
const Q = y(void 0), ee = y(void 0);
|
|
112
|
+
ge(() => {
|
|
113
|
+
if (!k.current) return;
|
|
114
|
+
const r = fe.current;
|
|
115
|
+
ee.current = Z.current, Q.current = U.current;
|
|
116
|
+
const n = new He(k.current, {
|
|
115
117
|
center: r.center,
|
|
116
118
|
zoom: r.zoom,
|
|
117
119
|
pitch: r.pitch,
|
|
118
120
|
bearing: r.bearing,
|
|
119
121
|
basemap: Z.current,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
projection: U.current,
|
|
123
|
+
basemapKey: v,
|
|
124
|
+
attribution: b,
|
|
125
|
+
headless: S ? S === !0 ? {} : S : void 0,
|
|
123
126
|
chromeHosts: {
|
|
124
|
-
badge:
|
|
125
|
-
attribution:
|
|
127
|
+
badge: N.current.badge ?? void 0,
|
|
128
|
+
attribution: N.current.attribution ?? void 0
|
|
126
129
|
},
|
|
127
|
-
onRuntimeError: (
|
|
128
|
-
var
|
|
129
|
-
return (
|
|
130
|
+
onRuntimeError: (c) => {
|
|
131
|
+
var m;
|
|
132
|
+
return (m = q.current) == null ? void 0 : m.call(q, c);
|
|
130
133
|
}
|
|
131
134
|
});
|
|
132
|
-
|
|
135
|
+
$(n);
|
|
133
136
|
let a = !0;
|
|
134
137
|
return n.ready.then(() => {
|
|
135
|
-
var
|
|
136
|
-
a && ((
|
|
138
|
+
var c;
|
|
139
|
+
a && ((c = V.current) == null || c.call(V));
|
|
137
140
|
}), () => {
|
|
138
|
-
a = !1,
|
|
141
|
+
a = !1, $(null), n.destroy();
|
|
139
142
|
};
|
|
140
|
-
}, [
|
|
141
|
-
!
|
|
142
|
-
}, [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
}, [ce]), E(() => {
|
|
144
|
+
!l || ee.current === u || (ee.current = u, l.setBasemap(u ?? null));
|
|
145
|
+
}, [l, u]), E(() => {
|
|
146
|
+
!l || Q.current === f || (Q.current = f, l.setProjection(f ?? null));
|
|
147
|
+
}, [l, f]), Ie(s, () => l, [l]), E(() => {
|
|
148
|
+
if (!l) return;
|
|
149
|
+
const r = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: g, bearing: p };
|
|
150
|
+
ct(l.getViewState(), r) && l.setView(r);
|
|
151
|
+
}, [l, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, g, p]), E(() => {
|
|
147
152
|
var r;
|
|
148
|
-
if (
|
|
149
|
-
return (r =
|
|
153
|
+
if (l)
|
|
154
|
+
return (r = A.current) == null || r.call(A, l.getViewState()), l.getStore("viewport").subscribe(() => {
|
|
150
155
|
var n;
|
|
151
|
-
return (n =
|
|
156
|
+
return (n = A.current) == null ? void 0 : n.call(A, l.getViewState());
|
|
152
157
|
});
|
|
153
|
-
}, [
|
|
154
|
-
const
|
|
158
|
+
}, [l]);
|
|
159
|
+
const z = L["bottom-start"], G = L["bottom-end"];
|
|
155
160
|
E(() => {
|
|
156
|
-
const r =
|
|
157
|
-
if (!r || !
|
|
161
|
+
const r = F.current;
|
|
162
|
+
if (!r || !G || typeof ResizeObserver > "u") return;
|
|
158
163
|
const n = () => {
|
|
159
|
-
const
|
|
160
|
-
(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
),
|
|
165
|
-
|
|
164
|
+
const c = parseFloat(getComputedStyle(r).getPropertyValue("--om-widget-gap-y")) || 8, m = G.getBoundingClientRect(), R = Qe(
|
|
165
|
+
(z == null ? void 0 : z.getBoundingClientRect()) ?? null,
|
|
166
|
+
m,
|
|
167
|
+
x ? et : 0,
|
|
168
|
+
c
|
|
169
|
+
), D = R + Math.ceil(m.height) + c;
|
|
170
|
+
Re((K) => K.lift === R && K.shift === D ? K : { lift: R, shift: D });
|
|
166
171
|
}, a = new ResizeObserver(n);
|
|
167
|
-
return a.observe(r), a.observe(
|
|
168
|
-
}, [
|
|
169
|
-
const
|
|
172
|
+
return a.observe(r), a.observe(G), z && a.observe(z), n(), () => a.disconnect();
|
|
173
|
+
}, [z, G, x]);
|
|
174
|
+
const De = _(
|
|
170
175
|
() => ({
|
|
171
176
|
position: "absolute",
|
|
172
177
|
inset: 0,
|
|
@@ -176,74 +181,74 @@ const yt = De(function(e, s) {
|
|
|
176
181
|
// Measured clearance for the floating bottom drawer toggle — the
|
|
177
182
|
// drawer root reads it through foldDrawerStyle's max() (same wiring
|
|
178
183
|
// as the HTML lane's widget layer).
|
|
179
|
-
"--om-fold-bottom-shift": `${
|
|
180
|
-
...
|
|
184
|
+
"--om-fold-bottom-shift": `${H.shift}px`,
|
|
185
|
+
...P ? Ne(P).properties : void 0
|
|
181
186
|
}),
|
|
182
|
-
[
|
|
183
|
-
),
|
|
184
|
-
() =>
|
|
185
|
-
[
|
|
187
|
+
[P, H.shift]
|
|
188
|
+
), te = _(() => l ? new st(l) : null, [l]), pe = _(
|
|
189
|
+
() => l && te && B ? { controller: l, layers: te, overlayPane: B, corners: L, widgetsHidden: !!d, widgetsFolded: x, foldPanels: ie, registerFoldedWidget: de, registerSlotWidget: ue } : null,
|
|
190
|
+
[l, te, B, L, d, x, ie, de, ue]
|
|
186
191
|
);
|
|
187
|
-
return /* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
192
|
+
return /* @__PURE__ */ re("div", { ref: F, className: O, style: { position: "relative", overflow: "hidden", ...w }, children: [
|
|
193
|
+
/* @__PURE__ */ C("div", { ref: k, style: { position: "absolute", inset: 0 } }),
|
|
194
|
+
/* @__PURE__ */ C(
|
|
190
195
|
"div",
|
|
191
196
|
{
|
|
192
|
-
ref:
|
|
197
|
+
ref: ke,
|
|
193
198
|
style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
|
|
194
199
|
}
|
|
195
200
|
),
|
|
196
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ C("div", { "data-om-widget-layer": "", style: De, children: J.map((r) => /* @__PURE__ */ re(
|
|
197
202
|
"div",
|
|
198
203
|
{
|
|
199
204
|
"data-om-widget-slot": r,
|
|
200
|
-
ref:
|
|
205
|
+
ref: Me[r],
|
|
201
206
|
style: {
|
|
202
|
-
...
|
|
203
|
-
...
|
|
207
|
+
...it[r],
|
|
208
|
+
...H.lift > 0 && r === "bottom-end" ? { bottom: `calc(var(--om-widget-inset-y, 12px) + ${H.lift}px)` } : void 0
|
|
204
209
|
},
|
|
205
210
|
children: [
|
|
206
|
-
|
|
207
|
-
const a =
|
|
208
|
-
return /* @__PURE__ */
|
|
211
|
+
x && W.filter((n) => Ve(n) === r && Pe[n] > 0).map((n) => {
|
|
212
|
+
const a = Fe === n;
|
|
213
|
+
return /* @__PURE__ */ re(
|
|
209
214
|
"div",
|
|
210
215
|
{
|
|
211
216
|
"data-om-fold-drawer": n,
|
|
212
|
-
style: { ...
|
|
213
|
-
onKeyDown: (
|
|
214
|
-
var
|
|
215
|
-
|
|
217
|
+
style: { ...Je(n), display: d ? "none" : "flex" },
|
|
218
|
+
onKeyDown: (c) => {
|
|
219
|
+
var m;
|
|
220
|
+
c.key !== "Escape" || !a || (X(null), (m = c.currentTarget.querySelector("[data-om-fold-toggle]")) == null || m.focus(), c.preventDefault(), c.stopPropagation());
|
|
216
221
|
},
|
|
217
222
|
children: [
|
|
218
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ C(
|
|
219
224
|
"button",
|
|
220
225
|
{
|
|
221
226
|
type: "button",
|
|
222
227
|
"data-om-fold-toggle": n,
|
|
223
228
|
"aria-expanded": a,
|
|
224
|
-
"aria-controls": `${
|
|
229
|
+
"aria-controls": `${ae}-${n}`,
|
|
225
230
|
"aria-label": `${a ? "Close" : "Open"} ${n} map controls`,
|
|
226
|
-
style:
|
|
231
|
+
style: qe(),
|
|
227
232
|
onClick: () => {
|
|
228
233
|
X(a ? null : n), a || requestAnimationFrame(() => {
|
|
229
|
-
var
|
|
230
|
-
const
|
|
231
|
-
|
|
234
|
+
var m;
|
|
235
|
+
const c = (m = F.current) == null ? void 0 : m.querySelector(`[data-om-fold-panel="${n}"]`);
|
|
236
|
+
c && lt(c);
|
|
232
237
|
});
|
|
233
238
|
},
|
|
234
239
|
children: "⋯"
|
|
235
240
|
}
|
|
236
241
|
),
|
|
237
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ C(
|
|
238
243
|
"div",
|
|
239
244
|
{
|
|
240
|
-
id: `${
|
|
241
|
-
ref:
|
|
245
|
+
id: `${ae}-${n}`,
|
|
246
|
+
ref: Le[n],
|
|
242
247
|
"data-om-fold-panel": n,
|
|
243
248
|
role: "region",
|
|
244
249
|
"aria-label": `${n} map controls`,
|
|
245
250
|
hidden: !a,
|
|
246
|
-
style: { ...
|
|
251
|
+
style: { ...Ge(n), display: a ? "flex" : "none" }
|
|
247
252
|
}
|
|
248
253
|
)
|
|
249
254
|
]
|
|
@@ -251,33 +256,33 @@ const yt = De(function(e, s) {
|
|
|
251
256
|
`fold-${n}`
|
|
252
257
|
);
|
|
253
258
|
}),
|
|
254
|
-
r === "bottom-start" && /* @__PURE__ */
|
|
259
|
+
r === "bottom-start" && /* @__PURE__ */ C(
|
|
255
260
|
"div",
|
|
256
261
|
{
|
|
257
262
|
"data-om-mandated-chrome": "badge",
|
|
258
263
|
ref: (n) => {
|
|
259
|
-
|
|
264
|
+
N.current.badge = n;
|
|
260
265
|
},
|
|
261
|
-
style:
|
|
266
|
+
style: ye
|
|
262
267
|
}
|
|
263
268
|
),
|
|
264
|
-
r === "bottom-end" && /* @__PURE__ */
|
|
269
|
+
r === "bottom-end" && /* @__PURE__ */ C(
|
|
265
270
|
"div",
|
|
266
271
|
{
|
|
267
272
|
"data-om-mandated-chrome": "attribution",
|
|
268
273
|
ref: (n) => {
|
|
269
|
-
|
|
274
|
+
N.current.attribution = n;
|
|
270
275
|
},
|
|
271
|
-
style:
|
|
276
|
+
style: ye
|
|
272
277
|
}
|
|
273
278
|
)
|
|
274
279
|
]
|
|
275
280
|
},
|
|
276
281
|
r
|
|
277
282
|
)) }),
|
|
278
|
-
|
|
283
|
+
pe && /* @__PURE__ */ C(Oe.Provider, { value: pe, children: j })
|
|
279
284
|
] });
|
|
280
|
-
}),
|
|
285
|
+
}), we = {
|
|
281
286
|
id: "id",
|
|
282
287
|
type: "type",
|
|
283
288
|
data: "data",
|
|
@@ -302,60 +307,62 @@ const yt = De(function(e, s) {
|
|
|
302
307
|
refresh: "refresh",
|
|
303
308
|
terrain: "terrain",
|
|
304
309
|
visibleZoomRange: "visibleZoomRange",
|
|
310
|
+
crs: "crs",
|
|
311
|
+
crsDef: "crsDef",
|
|
305
312
|
updateTriggers: "updateTriggers"
|
|
306
|
-
},
|
|
307
|
-
function
|
|
313
|
+
}, dt = /* @__PURE__ */ new Set([...Object.keys(we), "onClick", "onHover"]);
|
|
314
|
+
function ut(t) {
|
|
308
315
|
const e = {};
|
|
309
316
|
for (const [o, i] of Object.entries(t))
|
|
310
|
-
!
|
|
317
|
+
!dt.has(o) && i !== void 0 && (e[o] = i);
|
|
311
318
|
const s = {};
|
|
312
|
-
for (const [o, i] of Object.entries(
|
|
319
|
+
for (const [o, i] of Object.entries(we))
|
|
313
320
|
s[i] = t[o];
|
|
314
321
|
return Object.keys(e).length > 0 && (s.props = e), s;
|
|
315
322
|
}
|
|
316
|
-
function
|
|
317
|
-
const { controller: e, layers: s } =
|
|
323
|
+
function St(t) {
|
|
324
|
+
const { controller: e, layers: s } = Y("OmLayer"), { id: o } = t, i = ut(t);
|
|
318
325
|
E(() => {
|
|
319
326
|
s.upsert(i);
|
|
320
327
|
}), E(() => () => s.remove(o), [s, o]);
|
|
321
|
-
const g =
|
|
328
|
+
const g = y(t.onClick);
|
|
322
329
|
g.current = t.onClick;
|
|
323
|
-
const
|
|
324
|
-
return
|
|
325
|
-
() => e.watchPicks((
|
|
326
|
-
var
|
|
327
|
-
if (
|
|
328
|
-
(
|
|
330
|
+
const p = y(t.onHover);
|
|
331
|
+
return p.current = t.onHover, E(
|
|
332
|
+
() => e.watchPicks((u) => {
|
|
333
|
+
var f, v, b;
|
|
334
|
+
if (u === null) {
|
|
335
|
+
(f = p.current) == null || f.call(p, null);
|
|
329
336
|
return;
|
|
330
337
|
}
|
|
331
|
-
|
|
338
|
+
u.layerId === o && (u.type === "click" ? (v = g.current) == null || v.call(g, u) : (b = p.current) == null || b.call(p, u));
|
|
332
339
|
}),
|
|
333
340
|
[e, o]
|
|
334
341
|
), null;
|
|
335
342
|
}
|
|
336
|
-
function
|
|
337
|
-
const { corners:
|
|
343
|
+
function Ot({ position: t = "top-start", order: e, fold: s, className: o, style: i, children: g }) {
|
|
344
|
+
const { corners: p, widgetsHidden: u, widgetsFolded: f, foldPanels: v, registerFoldedWidget: b, registerSlotWidget: S } = Y("OmWidget"), P = he(), d = tt(t) ?? "top-start", h = f && d !== "manual" && s !== "never", O = d === "manual" ? null : rt(d);
|
|
338
345
|
if (E(() => {
|
|
339
346
|
if (O)
|
|
340
|
-
return
|
|
341
|
-
}, [O,
|
|
342
|
-
if (
|
|
343
|
-
return
|
|
344
|
-
}, [
|
|
345
|
-
return /* @__PURE__ */
|
|
346
|
-
const w =
|
|
347
|
-
return w ?
|
|
348
|
-
/* @__PURE__ */
|
|
347
|
+
return b(O, P, h), () => b(O, P, !1);
|
|
348
|
+
}, [O, P, h, b]), E(() => {
|
|
349
|
+
if (d !== "manual")
|
|
350
|
+
return S(d, P, !0), () => S(d, P, !1);
|
|
351
|
+
}, [d, P, S]), d === "manual")
|
|
352
|
+
return /* @__PURE__ */ C("div", { className: o, style: { pointerEvents: "auto", ...i }, children: g });
|
|
353
|
+
const w = h && O ? v[O] : p[d];
|
|
354
|
+
return w ? Se(
|
|
355
|
+
/* @__PURE__ */ C(
|
|
349
356
|
"div",
|
|
350
357
|
{
|
|
351
358
|
"data-om-react-widget": "",
|
|
352
|
-
"data-om-fold-origin-slot":
|
|
359
|
+
"data-om-fold-origin-slot": h ? d : void 0,
|
|
353
360
|
className: o,
|
|
354
361
|
style: {
|
|
355
362
|
...e !== void 0 ? { order: e } : void 0,
|
|
356
363
|
...i,
|
|
357
|
-
pointerEvents:
|
|
358
|
-
visibility:
|
|
364
|
+
pointerEvents: u ? "none" : (i == null ? void 0 : i.pointerEvents) ?? "auto",
|
|
365
|
+
visibility: u ? "hidden" : i == null ? void 0 : i.visibility
|
|
359
366
|
},
|
|
360
367
|
children: g
|
|
361
368
|
}
|
|
@@ -363,13 +370,13 @@ function ht({ position: t = "top-start", order: e, fold: s, className: o, style:
|
|
|
363
370
|
w
|
|
364
371
|
) : null;
|
|
365
372
|
}
|
|
366
|
-
function
|
|
373
|
+
function ft(t, e) {
|
|
367
374
|
return e !== void 0 && e < 0 && t.isGeospatial !== !1;
|
|
368
375
|
}
|
|
369
|
-
function
|
|
376
|
+
function be(t, e, s, o) {
|
|
370
377
|
return e && (t == null ? void 0 : t.layerId) !== e ? !1 : !s || (t ? t.type : o) === s;
|
|
371
378
|
}
|
|
372
|
-
const
|
|
379
|
+
const pt = {
|
|
373
380
|
"top-left": "translate(0, 0)",
|
|
374
381
|
"top-center": "translate(-50%, 0)",
|
|
375
382
|
"top-right": "translate(-100%, 0)",
|
|
@@ -380,52 +387,52 @@ const dt = {
|
|
|
380
387
|
"bottom-center": "translate(-50%, -100%)",
|
|
381
388
|
"bottom-right": "translate(-100%, -100%)"
|
|
382
389
|
};
|
|
383
|
-
function
|
|
384
|
-
const { controller: e, overlayPane: s } =
|
|
390
|
+
function wt(t) {
|
|
391
|
+
const { controller: e, overlayPane: s } = Y("OmOverlay"), o = y(null), i = y(void 0), g = y(t);
|
|
385
392
|
g.current = t;
|
|
386
|
-
const
|
|
387
|
-
const
|
|
388
|
-
let
|
|
393
|
+
const p = _(() => {
|
|
394
|
+
const d = e.getStore("selection");
|
|
395
|
+
let h, O, w = null;
|
|
389
396
|
return {
|
|
390
|
-
subscribe:
|
|
397
|
+
subscribe: d.subscribe,
|
|
391
398
|
getSnapshot: () => {
|
|
392
|
-
const
|
|
393
|
-
return (
|
|
399
|
+
const j = d.getSnapshot(), { anchorFrom: F, layer: k, selectionType: l } = g.current, $ = `${F ?? ""}|${k ?? ""}|${l ?? ""}`;
|
|
400
|
+
return (j !== h || $ !== O) && (h = j, O = $, F === "selection" && be(j, k, l, e.getLastPickType()) && (w = j)), w;
|
|
394
401
|
}
|
|
395
402
|
};
|
|
396
|
-
}, [e]),
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
403
|
+
}, [e]), u = ve(
|
|
404
|
+
p.subscribe,
|
|
405
|
+
p.getSnapshot,
|
|
406
|
+
p.getSnapshot
|
|
400
407
|
);
|
|
401
408
|
E(
|
|
402
|
-
() => e.registerOverlay((
|
|
409
|
+
() => e.registerOverlay((d, h, O) => {
|
|
403
410
|
const w = o.current;
|
|
404
411
|
if (!w) return;
|
|
405
|
-
const { anchor:
|
|
406
|
-
let
|
|
407
|
-
if (
|
|
412
|
+
const { anchor: j, anchorFrom: F, layer: k, selectionType: l, visible: $ = !0, anchorOffset: B } = g.current;
|
|
413
|
+
let M;
|
|
414
|
+
if (F === "selection" ? (be(h, k, l, O) && (i.current = (h == null ? void 0 : h.coordinate) ?? void 0), M = i.current) : M = j, !$ || !M || !d) {
|
|
408
415
|
w.style.visibility = "hidden";
|
|
409
416
|
return;
|
|
410
417
|
}
|
|
411
|
-
const [
|
|
412
|
-
if (!(
|
|
418
|
+
const [L, I, x] = d.project([M[0], M[1], M[2] ?? 0]);
|
|
419
|
+
if (!(L >= 0 && L <= d.width && I >= 0 && I <= d.height) || ft(d, x)) {
|
|
413
420
|
w.style.visibility = "hidden";
|
|
414
421
|
return;
|
|
415
422
|
}
|
|
416
|
-
w.style.visibility = "visible", w.style.transform = `translate(${
|
|
423
|
+
w.style.visibility = "visible", w.style.transform = `translate(${L}px, ${I}px) ${pt[B ?? "bottom-center"]}`;
|
|
417
424
|
}),
|
|
418
425
|
[e]
|
|
419
426
|
), E(() => {
|
|
420
427
|
e.refreshOverlays();
|
|
421
428
|
});
|
|
422
|
-
const { children:
|
|
423
|
-
return
|
|
424
|
-
/* @__PURE__ */
|
|
429
|
+
const { children: f, className: v, style: b, interactive: S = !0 } = t, P = typeof f == "function" ? f(u) : f;
|
|
430
|
+
return Se(
|
|
431
|
+
/* @__PURE__ */ C(
|
|
425
432
|
"div",
|
|
426
433
|
{
|
|
427
434
|
ref: o,
|
|
428
|
-
className:
|
|
435
|
+
className: v,
|
|
429
436
|
style: {
|
|
430
437
|
position: "absolute",
|
|
431
438
|
top: 0,
|
|
@@ -433,38 +440,38 @@ function vt(t) {
|
|
|
433
440
|
visibility: "hidden",
|
|
434
441
|
// hidden until the first flush positions it — never flashes at the origin
|
|
435
442
|
willChange: "transform",
|
|
436
|
-
pointerEvents:
|
|
437
|
-
...
|
|
443
|
+
pointerEvents: S ? "auto" : "none",
|
|
444
|
+
...b
|
|
438
445
|
},
|
|
439
|
-
children:
|
|
446
|
+
children: P
|
|
440
447
|
}
|
|
441
448
|
),
|
|
442
449
|
s
|
|
443
450
|
);
|
|
444
451
|
}
|
|
445
|
-
function
|
|
446
|
-
const { controller: e } =
|
|
447
|
-
const
|
|
448
|
-
let
|
|
452
|
+
function Rt(t = []) {
|
|
453
|
+
const { controller: e } = Y("useOmMap"), s = t.join(" "), o = _(() => {
|
|
454
|
+
const p = (s ? s.split(" ") : []).flatMap((f) => nt(f) ? [e.getStore(f)] : (console.warn(`[onlymapjs] useOmMap: "${f}" is not a watch token on the React front-end — expected viewport, selection, layers, or data:<layerId>.`), []));
|
|
455
|
+
let u;
|
|
449
456
|
return {
|
|
450
|
-
subscribe: (
|
|
451
|
-
const
|
|
457
|
+
subscribe: (f) => {
|
|
458
|
+
const v = p.map((b) => b.subscribe(f));
|
|
452
459
|
return () => {
|
|
453
|
-
for (const
|
|
460
|
+
for (const b of v) b();
|
|
454
461
|
};
|
|
455
462
|
},
|
|
456
463
|
getSnapshot: () => {
|
|
457
|
-
const
|
|
458
|
-
return (!
|
|
464
|
+
const f = p.map((v) => v.getSnapshot());
|
|
465
|
+
return (!u || f.some((v, b) => v !== u[b])) && (u = f), u;
|
|
459
466
|
}
|
|
460
467
|
};
|
|
461
|
-
}, [e, s]), i =
|
|
462
|
-
return
|
|
468
|
+
}, [e, s]), i = ve(o.subscribe, o.getSnapshot, o.getSnapshot);
|
|
469
|
+
return _(() => e.buildCtx(), [e, i]);
|
|
463
470
|
}
|
|
464
471
|
export {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
472
|
+
St as OmLayer,
|
|
473
|
+
vt as OmMap,
|
|
474
|
+
wt as OmOverlay,
|
|
475
|
+
Ot as OmWidget,
|
|
476
|
+
Rt as useOmMap
|
|
470
477
|
};
|