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