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