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