@nika-js/onlymap 0.11.4 → 0.11.5
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 +11 -0
- package/README.md +2 -2
- package/dist/{basemap-UE11uf6w.js → basemap-CnjAGLZo.js} +14 -2
- package/dist/basemap.d.ts +9 -0
- package/dist/elements/om-map.d.ts +31 -1
- package/dist/elements/om-overlay.d.ts +0 -14
- package/dist/{geoparquet-D7ZKVPDh.js → geoparquet-CHtunmD2.js} +1 -1
- package/dist/{globe-view-B7Yn2BbK.js → globe-view-CgQa-07O.js} +1 -1
- package/dist/{hillshade-tQaqlPhn.js → hillshade-BgXgVdjg.js} +1 -1
- package/dist/{index-DzxpYTfi.js → index-BTTCf4nb.js} +5488 -5305
- package/dist/{index-DIoKYXlh.js → index-BTsRqhXB.js} +1 -1
- package/dist/{index-DPV7mwIc.js → index-ClLMdW3k.js} +2 -2
- package/dist/{index-C09RUa1s.js → index-D4x57ql0.js} +1 -1
- package/dist/{index-N5acD4ii.js → index-DjtM8ecq.js} +1 -1
- package/dist/{index-CWtaL88w.js → index-DoNtp5Nh.js} +3 -3
- package/dist/{index-CFWt9qS0.js → index-NCXX8bDe.js} +1 -1
- package/dist/{index-B_L_7lV0.js → index-aOe9cOFs.js} +1 -1
- package/dist/{index-C8a3EKM8.js → index-k7l7kqTk.js} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/{lerc-BDcZeX07.js → lerc-BtdiMDO7.js} +1 -1
- package/dist/onlymap.standalone.js +13650 -13455
- package/dist/onlymapjs.js +1 -1
- package/dist/{post-process-effect-C1iDE90L.js → post-process-effect-BWrq5IR8.js} +1 -1
- package/dist/programmatic.d.ts +10 -1
- package/dist/{raster-D4nwLneR.js → raster-iGwPuAgo.js} +3 -3
- package/dist/{raster-pipeline-DX-rZjRG.js → raster-pipeline-Dxs9TpD6.js} +1 -1
- package/dist/react.js +128 -125
- package/dist/runtime-core.d.ts +50 -1
- package/dist/selection.d.ts +31 -0
- package/dist/{text-on-path-onhHN4AZ.js → text-on-path-C8h_3Snf.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/viewport-cull.d.ts +15 -0
- package/dist/{zarr-CBGaInwF.js → zarr-C1zXD9VD.js} +2 -2
- package/docs/cartograph.md +2 -2
- package/llms.txt +2 -1
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +3 -2
- package/skills/onlymapjs/references/syntax.md +4 -2
package/dist/onlymapjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bP as e, bQ as r, bR as t, as as c, C as o, bS as i, c as n, bT as d, bU as l, bV as S, bW as E, ah as g, bX as L, bY as T, bZ as _, b_ as A, b$ as p, c0 as m, c1 as I, c2 as D, L as M, g as u, c3 as b, c4 as y, c5 as f, c6 as O, c7 as P, bE as R, c8 as C, ap as N, c9 as F, aB as h, ca as B, W as v, cb as x, aA as G, cc as U, cd as W, ce as w, cf as Y, cg as k, ch as X, ci as H, cj as K, ck as V, cl as j, cm as z, cn as J, co as q, cp as Q, cq as Z, cr as $, ak as aa, cs as sa, ct as ea, cu as ra, cv as ta, cw as ca, cx as oa, cy as ia, cz as na, cA as da, cB as la, cC as Sa, cD as Ea, aq as ga, cE as La, cF as Ta, ae as _a, cG as Aa, cH as pa, cI as ma, cJ as Ia, cK as Da, cL as Ma, cM as ua, cN as ba, cO as ya, cP as fa, cQ as Oa, cR as Pa, cS as Ra, cT as Ca, cU as Na, cV as Fa, cW as ha, cX as Ba, cY as va, cZ as xa, c_ as Ga, c$ as Ua, d0 as Wa, d1 as wa, d2 as Ya, d3 as ka, d4 as Xa, d5 as Ha, d6 as Ka, aC as Va, d7 as ja, d8 as za, d9 as Ja, da as qa, db as Qa, dc as Za, dd as $a, de as as, df as ss, dg as es, dh as rs, di as ts, dj as cs, dk as os, dl as is, dm as ns, dn as ds } from "./index-
|
|
1
|
+
import { bP as e, bQ as r, bR as t, as as c, C as o, bS as i, c as n, bT as d, bU as l, bV as S, bW as E, ah as g, bX as L, bY as T, bZ as _, b_ as A, b$ as p, c0 as m, c1 as I, c2 as D, L as M, g as u, c3 as b, c4 as y, c5 as f, c6 as O, c7 as P, bE as R, c8 as C, ap as N, c9 as F, aB as h, ca as B, W as v, cb as x, aA as G, cc as U, cd as W, ce as w, cf as Y, cg as k, ch as X, ci as H, cj as K, ck as V, cl as j, cm as z, cn as J, co as q, cp as Q, cq as Z, cr as $, ak as aa, cs as sa, ct as ea, cu as ra, cv as ta, cw as ca, cx as oa, cy as ia, cz as na, cA as da, cB as la, cC as Sa, cD as Ea, aq as ga, cE as La, cF as Ta, ae as _a, cG as Aa, cH as pa, cI as ma, cJ as Ia, cK as Da, cL as Ma, cM as ua, cN as ba, cO as ya, cP as fa, cQ as Oa, cR as Pa, cS as Ra, cT as Ca, cU as Na, cV as Fa, cW as ha, cX as Ba, cY as va, cZ as xa, c_ as Ga, c$ as Ua, d0 as Wa, d1 as wa, d2 as Ya, d3 as ka, d4 as Xa, d5 as Ha, d6 as Ka, aC as Va, d7 as ja, d8 as za, d9 as Ja, da as qa, db as Qa, dc as Za, dd as $a, de as as, df as ss, dg as es, dh as rs, di as ts, dj as cs, dk as os, dl as is, dm as ns, dn as ds } from "./index-BTTCf4nb.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ALL_POSITION_VALUES,
|
|
4
4
|
r as AUDIT_EXEMPTIONS,
|
package/dist/programmatic.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type RuntimeContext } from "./ctx";
|
|
|
10
10
|
import type { LayerMetaSnapshot } from "./ctx";
|
|
11
11
|
import { type LayerFilterFieldSpec, type LayerCategoryFilterFieldSpec } from "./attribute-resolution";
|
|
12
12
|
import { type DataTransportOwner } from "./data-layer";
|
|
13
|
-
import type { Selection } from "./selection";
|
|
13
|
+
import type { PickAtOptions, PickMode, PickRect, PickRectOptions, Selection } from "./selection";
|
|
14
14
|
import type { ValidationEntry } from "./validation";
|
|
15
15
|
import type { MapViewport } from "./basemap";
|
|
16
16
|
import { type LayerIRSnapshot } from "./ir-snapshot";
|
|
@@ -282,6 +282,15 @@ export declare class MapController {
|
|
|
282
282
|
*/
|
|
283
283
|
getLastPickType(): "hover" | "click" | undefined;
|
|
284
284
|
getSelection(): Selection | null;
|
|
285
|
+
/** See `<om-map>`'s `pickMode` (docs/design/pick-api.md): `"all"` makes every layer pickable while set; never part of the descriptors. */
|
|
286
|
+
get pickMode(): PickMode;
|
|
287
|
+
set pickMode(mode: PickMode);
|
|
288
|
+
/** The object under a screen pixel, or null — a query that leaves the selection, behaviors and pick listeners alone. See `<om-map>.pickAt`. */
|
|
289
|
+
pickAt(pixel: [number, number], options?: PickAtOptions): Selection | null;
|
|
290
|
+
/** Every object inside a screen rectangle, front to back — a query. See `<om-map>.pickRect`. */
|
|
291
|
+
pickRect(rect: PickRect, options?: PickRectOptions): Selection[];
|
|
292
|
+
/** Screen pixel → `[lng, lat]` on the ground plane, or null before the viewport resolves. */
|
|
293
|
+
unproject(pixel: [number, number]): [number, number] | null;
|
|
285
294
|
/** Every hover/click pick (null = hover left) — the stream framework adapters route to per-layer onClick/onHover handlers. */
|
|
286
295
|
watchPicks(listener: PickListener): () => void;
|
|
287
296
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as se, t as $e, i as Ct, a as ke, s as Lt, C as It, b as Gt, F as vt, A as Et, d as Ft, R as ye, e as At, p as jt, m as Rt, f as Mt, g as We, h as Ut, r as le, j as Ot, k as xt, l as Kt, n as Dt } from "./raster-pipeline-
|
|
1
|
+
import { c as se, t as $e, i as Ct, a as ke, s as Lt, C as It, b as Gt, F as vt, A as Et, d as Ft, R as ye, e as At, p as jt, m as Rt, f as Mt, g as We, h as Ut, r as le, j as Ot, k as xt, l as Kt, n as Dt } from "./raster-pipeline-Dxs9TpD6.js";
|
|
2
2
|
import { N as Nt, c as zt } from "./hillshade-apron-Bem3DWyJ.js";
|
|
3
3
|
import { r as Bt } from "./hillshade-shader-DI2uLSNU.js";
|
|
4
|
-
import { bK as _t, bL as $t } from "./index-
|
|
4
|
+
import { bK as _t, bL as $t } from "./index-BTTCf4nb.js";
|
|
5
5
|
import we from "./index-CW1n5LdO.js";
|
|
6
6
|
function kt(e, t) {
|
|
7
7
|
const n = e.length / 3, r = new Uint8ClampedArray(n * 4), o = 0, i = n, a = n * 2;
|
|
@@ -1072,7 +1072,7 @@ j.set(f.Zstd, () => import("./zstd-jXobGRcq.js").then((e) => e.decode));
|
|
|
1072
1072
|
j.set(f.Jpeg, () => Promise.resolve(ce));
|
|
1073
1073
|
j.set(f.Jpeg6, () => Promise.resolve(ce));
|
|
1074
1074
|
j.set(f.Webp, () => Promise.resolve(ce));
|
|
1075
|
-
j.set(f.Lerc, () => import("./lerc-
|
|
1075
|
+
j.set(f.Lerc, () => import("./lerc-BtdiMDO7.js").then((e) => e.decode));
|
|
1076
1076
|
async function ue(e, t, n) {
|
|
1077
1077
|
const r = j.get(t);
|
|
1078
1078
|
if (!r)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { w as he } from "./mgrs-BY9bIvp4.js";
|
|
2
|
-
import { a3 as de, bD as fe, bE as re, c as oe, bF as me, G as pe, bG as ge, aK as Z, bH as ve, N as be, bI as xe, bJ as Pe, al as Te, ap as ie } from "./index-
|
|
2
|
+
import { a3 as de, bD as fe, bE as re, c as oe, bF as me, G as pe, bG as ge, aK as Z, bH as ve, N as be, bI as xe, bJ as Pe, al as Te, ap as ie } from "./index-BTTCf4nb.js";
|
|
3
3
|
import { p as ye, a as Le, h as we } from "./hillshade-shader-DI2uLSNU.js";
|
|
4
4
|
function Oe(n, e, t) {
|
|
5
5
|
const { projectedCorners: s } = e, { topLeft: r, topRight: o, bottomRight: i, bottomLeft: a } = s, c = t(r[0], r[1]), u = t(o[0], o[1]), l = t(i[0], i[1]), d = t(a[0], a[1]), f = [
|
package/dist/react.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var Le = Object.defineProperty;
|
|
2
|
-
var _e = (
|
|
3
|
-
var ue = (
|
|
4
|
-
import { jsxs as ee, jsx as
|
|
2
|
+
var _e = (t, e, s) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var ue = (t, e, s) => _e(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { jsxs as ee, jsx as x } from "react/jsx-runtime";
|
|
5
5
|
import { createContext as $e, useContext as je, forwardRef as De, useRef as b, useState as k, useId as ge, useCallback as te, useMemo as $, useLayoutEffect as fe, useEffect as E, useImperativeHandle as Ae, useSyncExternalStore as ye } from "react";
|
|
6
|
-
import { MANAGED_SLOTS as ze, slotContainerStyle as Be, FOLD_SIDES as K, MapController as Ie, parseWidgetStyle as Ke, foldToggleSlot as We, foldToggleStyle as He, foldPanelStyle as Ne, foldDrawerStyle as Ve, resolveFoldBreakpointPx as qe, shouldFoldAtWidth as
|
|
6
|
+
import { MANAGED_SLOTS as ze, slotContainerStyle as Be, FOLD_SIDES as K, MapController as Ie, parseWidgetStyle as Ke, foldToggleSlot as We, foldToggleStyle as He, foldPanelStyle as Ne, foldDrawerStyle as Ve, resolveFoldBreakpointPx as qe, shouldFoldAtWidth as Ge, effectiveFoldBreakpointPx as Je, DEFAULT_FOLD_BREAKPOINT_PX as Ye, bottomEndLiftPx as Xe, FOLD_BOTTOM_CLEARANCE_PX as Ze, resolveSlot as Ue, foldSideForSlot as Qe, isStoreToken as et } from "@nika-js/onlymap";
|
|
7
7
|
import { createPortal as be } from "react-dom";
|
|
8
8
|
const he = $e(null);
|
|
9
|
-
function
|
|
9
|
+
function G(t) {
|
|
10
10
|
const e = je(he);
|
|
11
|
-
if (!e) throw new Error(`[onlymapjs] ${
|
|
11
|
+
if (!e) throw new Error(`[onlymapjs] ${t} must be rendered inside <OmMap>.`);
|
|
12
12
|
return e;
|
|
13
13
|
}
|
|
14
|
-
function re(
|
|
15
|
-
if (
|
|
16
|
-
const s = Object.keys(
|
|
17
|
-
return s.length !== o.length ? !1 : s.every((i) =>
|
|
14
|
+
function re(t, e) {
|
|
15
|
+
if (t === e) return !0;
|
|
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 tt(
|
|
20
|
-
const { props: s, updateTriggers: o, ...i } =
|
|
19
|
+
function tt(t, e) {
|
|
20
|
+
const { props: s, updateTriggers: o, ...i } = t, { props: g, updateTriggers: u, ...d } = e;
|
|
21
21
|
return re(i, d) && re(s, g) && re(o, u);
|
|
22
22
|
}
|
|
23
23
|
class rt {
|
|
@@ -33,107 +33,107 @@ class rt {
|
|
|
33
33
|
this.descriptors.delete(e) && this.controller.setLayers([...this.descriptors.values()]);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
function st(
|
|
38
|
-
const e =
|
|
36
|
+
const q = ze, nt = Object.fromEntries(q.map((t) => [t, Be(t)])), me = { display: "flex", pointerEvents: "none", order: 2147483647 }, ot = Object.fromEntries(K.map((t) => [t, null]));
|
|
37
|
+
function st(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
|
-
e ? e.focus() : (
|
|
41
|
+
e ? e.focus() : (t.tabIndex = -1, t.focus());
|
|
42
42
|
}
|
|
43
|
-
function it(
|
|
44
|
-
return Object.entries(e).some(([s, o]) => o !== void 0 &&
|
|
43
|
+
function it(t, e) {
|
|
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: u, basemap: d, basemapKey: y, attribution: h, headless: f, widgetStyle: T, widgetsHidden: v, widgetsFold: m = !0, className: S, style: O, children: w } = e, P = b(null), M = b(null), [c, j] = k(null), [L,
|
|
48
|
-
() => Object.fromEntries(
|
|
49
|
-
), [
|
|
50
|
-
() => Object.fromEntries(K.map((
|
|
51
|
-
), [Ee, X] = k(null), oe = `om-react-fold-${ge().replaceAll(":", "")}`, Pe = b(new Map(K.map((
|
|
46
|
+
const yt = De(function(e, s) {
|
|
47
|
+
const { center: o, zoom: i, pitch: g, bearing: u, basemap: d, basemapKey: y, attribution: h, headless: f, widgetStyle: T, widgetsHidden: v, widgetsFold: m = !0, className: S, style: O, children: w } = e, P = b(null), M = b(null), [c, j] = k(null), [L, J] = k(null), [C, z] = k(
|
|
48
|
+
() => Object.fromEntries(q.map((r) => [r, null]))
|
|
49
|
+
), [F, Y] = k(!1), [B, Se] = k({ lift: 0, shift: 0 }), [ne, Oe] = k(ot), [we, Re] = k(
|
|
50
|
+
() => Object.fromEntries(K.map((r) => [r, 0]))
|
|
51
|
+
), [Ee, X] = k(null), oe = `om-react-fold-${ge().replaceAll(":", "")}`, Pe = b(new Map(K.map((r) => [r, /* @__PURE__ */ new Set()]))), Ce = b(/* @__PURE__ */ new Map()), [se, Fe] = k(() => /* @__PURE__ */ new Set()), ie = f ? JSON.stringify(f) : "", W = b({
|
|
52
52
|
badge: null,
|
|
53
53
|
attribution: null
|
|
54
|
-
}),
|
|
55
|
-
|
|
54
|
+
}), xe = te((r) => {
|
|
55
|
+
J((n) => n === r ? n : r);
|
|
56
56
|
}, []), Te = $(
|
|
57
57
|
() => Object.fromEntries(
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
q.map((r) => [
|
|
59
|
+
r,
|
|
60
60
|
(n) => {
|
|
61
|
-
z((a) => a[
|
|
61
|
+
z((a) => a[r] === n ? a : { ...a, [r]: n });
|
|
62
62
|
}
|
|
63
63
|
])
|
|
64
64
|
),
|
|
65
65
|
[]
|
|
66
66
|
), ke = $(
|
|
67
67
|
() => Object.fromEntries(
|
|
68
|
-
K.map((
|
|
69
|
-
|
|
68
|
+
K.map((r) => [
|
|
69
|
+
r,
|
|
70
70
|
(n) => {
|
|
71
|
-
Oe((a) => a[
|
|
71
|
+
Oe((a) => a[r] === n ? a : { ...a, [r]: n });
|
|
72
72
|
}
|
|
73
73
|
])
|
|
74
74
|
),
|
|
75
75
|
[]
|
|
76
|
-
), ae = te((
|
|
77
|
-
const l = Pe.current.get(
|
|
78
|
-
a ? l.add(n) : l.delete(n), l.size !== p && Re((R) => ({ ...R, [
|
|
79
|
-
}, []), le = te((
|
|
80
|
-
const l =
|
|
81
|
-
a ? l.set(n,
|
|
76
|
+
), ae = te((r, n, a) => {
|
|
77
|
+
const l = Pe.current.get(r), p = l.size;
|
|
78
|
+
a ? l.add(n) : l.delete(n), l.size !== p && Re((R) => ({ ...R, [r]: l.size }));
|
|
79
|
+
}, []), le = te((r, n, a) => {
|
|
80
|
+
const l = Ce.current;
|
|
81
|
+
a ? l.set(n, r) : l.delete(n);
|
|
82
82
|
const p = new Set(l.values());
|
|
83
|
-
|
|
83
|
+
Fe((R) => R.size === p.size && [...p].every((_) => R.has(_)) ? R : p);
|
|
84
84
|
}, []);
|
|
85
85
|
fe(() => {
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
88
|
-
let n, a =
|
|
86
|
+
const r = P.current;
|
|
87
|
+
if (!r) return;
|
|
88
|
+
let n, a = Ye;
|
|
89
89
|
const l = (R) => {
|
|
90
|
-
const _ = getComputedStyle(
|
|
91
|
-
_ !== n && (n = _, a = qe(_,
|
|
90
|
+
const _ = getComputedStyle(r).getPropertyValue("--om-widget-fold-breakpoint").trim();
|
|
91
|
+
_ !== n && (n = _, a = qe(_, r)), Y((I) => m && Ge(R, Je(a, se), I));
|
|
92
92
|
};
|
|
93
|
-
if (l(
|
|
93
|
+
if (l(r.getBoundingClientRect().width || (f ? f === !0 ? 800 : f.width ?? 800 : 0)), typeof ResizeObserver > "u") return;
|
|
94
94
|
const p = new ResizeObserver(([R]) => l(R.contentRect.width));
|
|
95
|
-
return p.observe(
|
|
95
|
+
return p.observe(r), () => p.disconnect();
|
|
96
96
|
}, [m, ie, se]), E(() => {
|
|
97
|
-
(!
|
|
98
|
-
}, [
|
|
97
|
+
(!F || v) && X(null);
|
|
98
|
+
}, [F, v]);
|
|
99
99
|
const ce = b({ center: o, zoom: i, pitch: g, bearing: u });
|
|
100
100
|
ce.current = { center: o, zoom: i, pitch: g, bearing: u };
|
|
101
|
-
const
|
|
102
|
-
|
|
101
|
+
const H = b(e.onReady);
|
|
102
|
+
H.current = e.onReady;
|
|
103
103
|
const D = b(e.onViewStateChange);
|
|
104
104
|
D.current = e.onViewStateChange;
|
|
105
|
-
const
|
|
106
|
-
|
|
105
|
+
const N = b(e.onRuntimeError);
|
|
106
|
+
N.current = e.onRuntimeError;
|
|
107
107
|
const Z = b(d);
|
|
108
108
|
Z.current = d;
|
|
109
109
|
const U = b(void 0);
|
|
110
110
|
fe(() => {
|
|
111
111
|
if (!M.current) return;
|
|
112
|
-
const
|
|
112
|
+
const r = ce.current;
|
|
113
113
|
U.current = Z.current;
|
|
114
114
|
const n = new Ie(M.current, {
|
|
115
|
-
center:
|
|
116
|
-
zoom:
|
|
117
|
-
pitch:
|
|
118
|
-
bearing:
|
|
115
|
+
center: r.center,
|
|
116
|
+
zoom: r.zoom,
|
|
117
|
+
pitch: r.pitch,
|
|
118
|
+
bearing: r.bearing,
|
|
119
119
|
basemap: Z.current,
|
|
120
120
|
basemapKey: y,
|
|
121
121
|
attribution: h,
|
|
122
122
|
headless: f ? f === !0 ? {} : f : void 0,
|
|
123
123
|
chromeHosts: {
|
|
124
|
-
badge:
|
|
125
|
-
attribution:
|
|
124
|
+
badge: W.current.badge ?? void 0,
|
|
125
|
+
attribution: W.current.attribution ?? void 0
|
|
126
126
|
},
|
|
127
127
|
onRuntimeError: (l) => {
|
|
128
128
|
var p;
|
|
129
|
-
return (p =
|
|
129
|
+
return (p = N.current) == null ? void 0 : p.call(N, l);
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
j(n);
|
|
133
133
|
let a = !0;
|
|
134
134
|
return n.ready.then(() => {
|
|
135
135
|
var l;
|
|
136
|
-
a && ((l =
|
|
136
|
+
a && ((l = H.current) == null || l.call(H));
|
|
137
137
|
}), () => {
|
|
138
138
|
a = !1, j(null), n.destroy();
|
|
139
139
|
};
|
|
@@ -141,31 +141,31 @@ const gt = De(function(e, s) {
|
|
|
141
141
|
!c || U.current === d || (U.current = d, c.setBasemap(d ?? null));
|
|
142
142
|
}, [c, d]), Ae(s, () => c, [c]), E(() => {
|
|
143
143
|
if (!c) return;
|
|
144
|
-
const
|
|
145
|
-
it(c.getViewState(),
|
|
144
|
+
const r = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: g, bearing: u };
|
|
145
|
+
it(c.getViewState(), r) && c.setView(r);
|
|
146
146
|
}, [c, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, g, u]), E(() => {
|
|
147
|
-
var
|
|
147
|
+
var r;
|
|
148
148
|
if (c)
|
|
149
|
-
return (
|
|
149
|
+
return (r = D.current) == null || r.call(D, c.getViewState()), c.getStore("viewport").subscribe(() => {
|
|
150
150
|
var n;
|
|
151
151
|
return (n = D.current) == null ? void 0 : n.call(D, c.getViewState());
|
|
152
152
|
});
|
|
153
153
|
}, [c]);
|
|
154
|
-
const A =
|
|
154
|
+
const A = C["bottom-start"], V = C["bottom-end"];
|
|
155
155
|
E(() => {
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
156
|
+
const r = P.current;
|
|
157
|
+
if (!r || !V || typeof ResizeObserver > "u") return;
|
|
158
158
|
const n = () => {
|
|
159
|
-
const l = parseFloat(getComputedStyle(
|
|
159
|
+
const l = parseFloat(getComputedStyle(r).getPropertyValue("--om-widget-gap-y")) || 8, p = V.getBoundingClientRect(), R = Xe(
|
|
160
160
|
(A == null ? void 0 : A.getBoundingClientRect()) ?? null,
|
|
161
161
|
p,
|
|
162
|
-
|
|
162
|
+
F ? Ze : 0,
|
|
163
163
|
l
|
|
164
164
|
), _ = R + Math.ceil(p.height) + l;
|
|
165
165
|
Se((I) => I.lift === R && I.shift === _ ? I : { lift: R, shift: _ });
|
|
166
166
|
}, a = new ResizeObserver(n);
|
|
167
|
-
return a.observe(
|
|
168
|
-
}, [A,
|
|
167
|
+
return a.observe(r), a.observe(V), A && a.observe(A), n(), () => a.disconnect();
|
|
168
|
+
}, [A, V, F]);
|
|
169
169
|
const Me = $(
|
|
170
170
|
() => ({
|
|
171
171
|
position: "absolute",
|
|
@@ -181,29 +181,29 @@ const gt = De(function(e, s) {
|
|
|
181
181
|
}),
|
|
182
182
|
[T, B.shift]
|
|
183
183
|
), Q = $(() => c ? new rt(c) : null, [c]), de = $(
|
|
184
|
-
() => c && Q && L ? { controller: c, layers: Q, overlayPane: L, corners:
|
|
185
|
-
[c, Q, L,
|
|
184
|
+
() => c && Q && L ? { controller: c, layers: Q, overlayPane: L, corners: C, widgetsHidden: !!v, widgetsFolded: F, foldPanels: ne, registerFoldedWidget: ae, registerSlotWidget: le } : null,
|
|
185
|
+
[c, Q, L, C, v, F, ne, ae, le]
|
|
186
186
|
);
|
|
187
187
|
return /* @__PURE__ */ ee("div", { ref: P, className: S, style: { position: "relative", overflow: "hidden", ...O }, children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ x("div", { ref: M, style: { position: "absolute", inset: 0 } }),
|
|
189
|
+
/* @__PURE__ */ x(
|
|
190
190
|
"div",
|
|
191
191
|
{
|
|
192
|
-
ref:
|
|
192
|
+
ref: xe,
|
|
193
193
|
style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
|
|
194
194
|
}
|
|
195
195
|
),
|
|
196
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ x("div", { "data-om-widget-layer": "", style: Me, children: q.map((r) => /* @__PURE__ */ ee(
|
|
197
197
|
"div",
|
|
198
198
|
{
|
|
199
|
-
"data-om-widget-slot":
|
|
200
|
-
ref: Te[
|
|
199
|
+
"data-om-widget-slot": r,
|
|
200
|
+
ref: Te[r],
|
|
201
201
|
style: {
|
|
202
|
-
...nt[
|
|
203
|
-
...B.lift > 0 &&
|
|
202
|
+
...nt[r],
|
|
203
|
+
...B.lift > 0 && r === "bottom-end" ? { bottom: `calc(var(--om-widget-inset-y, 12px) + ${B.lift}px)` } : void 0
|
|
204
204
|
},
|
|
205
205
|
children: [
|
|
206
|
-
|
|
206
|
+
F && K.filter((n) => We(n) === r && we[n] > 0).map((n) => {
|
|
207
207
|
const a = Ee === n;
|
|
208
208
|
return /* @__PURE__ */ ee(
|
|
209
209
|
"div",
|
|
@@ -215,7 +215,7 @@ const gt = De(function(e, s) {
|
|
|
215
215
|
l.key !== "Escape" || !a || (X(null), (p = l.currentTarget.querySelector("[data-om-fold-toggle]")) == null || p.focus(), l.preventDefault(), l.stopPropagation());
|
|
216
216
|
},
|
|
217
217
|
children: [
|
|
218
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ x(
|
|
219
219
|
"button",
|
|
220
220
|
{
|
|
221
221
|
type: "button",
|
|
@@ -234,7 +234,7 @@ const gt = De(function(e, s) {
|
|
|
234
234
|
children: "⋯"
|
|
235
235
|
}
|
|
236
236
|
),
|
|
237
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ x(
|
|
238
238
|
"div",
|
|
239
239
|
{
|
|
240
240
|
id: `${oe}-${n}`,
|
|
@@ -251,31 +251,31 @@ const gt = De(function(e, s) {
|
|
|
251
251
|
`fold-${n}`
|
|
252
252
|
);
|
|
253
253
|
}),
|
|
254
|
-
|
|
254
|
+
r === "bottom-start" && /* @__PURE__ */ x(
|
|
255
255
|
"div",
|
|
256
256
|
{
|
|
257
257
|
"data-om-mandated-chrome": "badge",
|
|
258
258
|
ref: (n) => {
|
|
259
|
-
|
|
259
|
+
W.current.badge = n;
|
|
260
260
|
},
|
|
261
261
|
style: me
|
|
262
262
|
}
|
|
263
263
|
),
|
|
264
|
-
|
|
264
|
+
r === "bottom-end" && /* @__PURE__ */ x(
|
|
265
265
|
"div",
|
|
266
266
|
{
|
|
267
267
|
"data-om-mandated-chrome": "attribution",
|
|
268
268
|
ref: (n) => {
|
|
269
|
-
|
|
269
|
+
W.current.attribution = n;
|
|
270
270
|
},
|
|
271
271
|
style: me
|
|
272
272
|
}
|
|
273
273
|
)
|
|
274
274
|
]
|
|
275
275
|
},
|
|
276
|
-
|
|
276
|
+
r
|
|
277
277
|
)) }),
|
|
278
|
-
de && /* @__PURE__ */
|
|
278
|
+
de && /* @__PURE__ */ x(he.Provider, { value: de, children: w })
|
|
279
279
|
] });
|
|
280
280
|
}), ve = {
|
|
281
281
|
id: "id",
|
|
@@ -304,24 +304,24 @@ const gt = De(function(e, s) {
|
|
|
304
304
|
visibleZoomRange: "visibleZoomRange",
|
|
305
305
|
updateTriggers: "updateTriggers"
|
|
306
306
|
}, at = /* @__PURE__ */ new Set([...Object.keys(ve), "onClick", "onHover"]);
|
|
307
|
-
function lt(
|
|
307
|
+
function lt(t) {
|
|
308
308
|
const e = {};
|
|
309
|
-
for (const [o, i] of Object.entries(
|
|
309
|
+
for (const [o, i] of Object.entries(t))
|
|
310
310
|
!at.has(o) && i !== void 0 && (e[o] = i);
|
|
311
311
|
const s = {};
|
|
312
312
|
for (const [o, i] of Object.entries(ve))
|
|
313
|
-
s[i] =
|
|
313
|
+
s[i] = t[o];
|
|
314
314
|
return Object.keys(e).length > 0 && (s.props = e), s;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
const { controller: e, layers: s } =
|
|
316
|
+
function bt(t) {
|
|
317
|
+
const { controller: e, layers: s } = G("OmLayer"), { id: o } = t, i = lt(t);
|
|
318
318
|
E(() => {
|
|
319
319
|
s.upsert(i);
|
|
320
320
|
}), E(() => () => s.remove(o), [s, o]);
|
|
321
|
-
const g = b(
|
|
322
|
-
g.current =
|
|
323
|
-
const u = b(
|
|
324
|
-
return u.current =
|
|
321
|
+
const g = b(t.onClick);
|
|
322
|
+
g.current = t.onClick;
|
|
323
|
+
const u = b(t.onHover);
|
|
324
|
+
return u.current = t.onHover, E(
|
|
325
325
|
() => e.watchPicks((d) => {
|
|
326
326
|
var y, h, f;
|
|
327
327
|
if (d === null) {
|
|
@@ -333,8 +333,8 @@ function yt(r) {
|
|
|
333
333
|
[e, o]
|
|
334
334
|
), null;
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
const { corners: u, widgetsHidden: d, widgetsFolded: y, foldPanels: h, registerFoldedWidget: f, registerSlotWidget: T } =
|
|
336
|
+
function ht({ position: t = "top-start", order: e, fold: s, className: o, style: i, children: g }) {
|
|
337
|
+
const { corners: u, widgetsHidden: d, widgetsFolded: y, foldPanels: h, registerFoldedWidget: f, registerSlotWidget: T } = G("OmWidget"), v = ge(), m = Ue(t) ?? "top-start", S = y && m !== "manual" && s !== "never", O = m === "manual" ? null : Qe(m);
|
|
338
338
|
if (E(() => {
|
|
339
339
|
if (O)
|
|
340
340
|
return f(O, v, S), () => f(O, v, !1);
|
|
@@ -342,10 +342,10 @@ function bt({ position: r = "top-start", order: e, fold: s, className: o, style:
|
|
|
342
342
|
if (m !== "manual")
|
|
343
343
|
return T(m, v, !0), () => T(m, v, !1);
|
|
344
344
|
}, [m, v, T]), m === "manual")
|
|
345
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ x("div", { className: o, style: { pointerEvents: "auto", ...i }, children: g });
|
|
346
346
|
const w = S && O ? h[O] : u[m];
|
|
347
347
|
return w ? be(
|
|
348
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ x(
|
|
349
349
|
"div",
|
|
350
350
|
{
|
|
351
351
|
"data-om-react-widget": "",
|
|
@@ -363,10 +363,13 @@ function bt({ position: r = "top-start", order: e, fold: s, className: o, style:
|
|
|
363
363
|
w
|
|
364
364
|
) : null;
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
return e
|
|
366
|
+
function ct(t, e) {
|
|
367
|
+
return e !== void 0 && e < 0 && t.isGeospatial !== !1;
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
function pe(t, e, s, o) {
|
|
370
|
+
return e && (t == null ? void 0 : t.layerId) !== e ? !1 : !s || (t ? t.type : o) === s;
|
|
371
|
+
}
|
|
372
|
+
const dt = {
|
|
370
373
|
"top-left": "translate(0, 0)",
|
|
371
374
|
"top-center": "translate(-50%, 0)",
|
|
372
375
|
"top-right": "translate(-100%, 0)",
|
|
@@ -377,9 +380,9 @@ const ct = {
|
|
|
377
380
|
"bottom-center": "translate(-50%, -100%)",
|
|
378
381
|
"bottom-right": "translate(-100%, -100%)"
|
|
379
382
|
};
|
|
380
|
-
function
|
|
381
|
-
const { controller: e, overlayPane: s } =
|
|
382
|
-
g.current =
|
|
383
|
+
function vt(t) {
|
|
384
|
+
const { controller: e, overlayPane: s } = G("OmOverlay"), o = b(null), i = b(void 0), g = b(t);
|
|
385
|
+
g.current = t;
|
|
383
386
|
const u = $(() => {
|
|
384
387
|
const m = e.getStore("selection");
|
|
385
388
|
let S, O, w = null;
|
|
@@ -399,26 +402,26 @@ function ht(r) {
|
|
|
399
402
|
() => e.registerOverlay((m, S, O) => {
|
|
400
403
|
const w = o.current;
|
|
401
404
|
if (!w) return;
|
|
402
|
-
const { anchor: P, anchorFrom: M, layer: c, selectionType: j, visible: L = !0, anchorOffset:
|
|
403
|
-
let
|
|
404
|
-
if (M === "selection" ? (pe(S, c, j, O) && (i.current = (S == null ? void 0 : S.coordinate) ?? void 0),
|
|
405
|
+
const { anchor: P, anchorFrom: M, layer: c, selectionType: j, visible: L = !0, anchorOffset: J } = g.current;
|
|
406
|
+
let C;
|
|
407
|
+
if (M === "selection" ? (pe(S, c, j, O) && (i.current = (S == null ? void 0 : S.coordinate) ?? void 0), C = i.current) : C = P, !L || !C || !m) {
|
|
405
408
|
w.style.visibility = "hidden";
|
|
406
409
|
return;
|
|
407
410
|
}
|
|
408
|
-
const [z,
|
|
409
|
-
if (!(z >= 0 && z <= m.width &&
|
|
411
|
+
const [z, F, Y] = m.project([C[0], C[1], C[2] ?? 0]);
|
|
412
|
+
if (!(z >= 0 && z <= m.width && F >= 0 && F <= m.height) || ct(m, Y)) {
|
|
410
413
|
w.style.visibility = "hidden";
|
|
411
414
|
return;
|
|
412
415
|
}
|
|
413
|
-
w.style.visibility = "visible", w.style.transform = `translate(${z}px, ${
|
|
416
|
+
w.style.visibility = "visible", w.style.transform = `translate(${z}px, ${F}px) ${dt[J ?? "bottom-center"]}`;
|
|
414
417
|
}),
|
|
415
418
|
[e]
|
|
416
419
|
), E(() => {
|
|
417
420
|
e.refreshOverlays();
|
|
418
421
|
});
|
|
419
|
-
const { children: y, className: h, style: f, interactive: T = !0 } =
|
|
422
|
+
const { children: y, className: h, style: f, interactive: T = !0 } = t, v = typeof y == "function" ? y(d) : y;
|
|
420
423
|
return be(
|
|
421
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ x(
|
|
422
425
|
"div",
|
|
423
426
|
{
|
|
424
427
|
ref: o,
|
|
@@ -439,8 +442,8 @@ function ht(r) {
|
|
|
439
442
|
s
|
|
440
443
|
);
|
|
441
444
|
}
|
|
442
|
-
function
|
|
443
|
-
const { controller: e } =
|
|
445
|
+
function St(t = []) {
|
|
446
|
+
const { controller: e } = G("useOmMap"), s = t.join(" "), o = $(() => {
|
|
444
447
|
const u = (s ? s.split(" ") : []).flatMap((y) => et(y) ? [e.getStore(y)] : (console.warn(`[onlymapjs] useOmMap: "${y}" is not a watch token on the React front-end — expected viewport, selection, layers, or data:<layerId>.`), []));
|
|
445
448
|
let d;
|
|
446
449
|
return {
|
|
@@ -459,9 +462,9 @@ function vt(r = []) {
|
|
|
459
462
|
return $(() => e.buildCtx(), [e, i]);
|
|
460
463
|
}
|
|
461
464
|
export {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
bt as OmLayer,
|
|
466
|
+
yt as OmMap,
|
|
467
|
+
vt as OmOverlay,
|
|
468
|
+
ht as OmWidget,
|
|
469
|
+
St as useOmMap
|
|
467
470
|
};
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { type ClipBoxIR } from "./clip-box";
|
|
|
7
7
|
import { type SnapAgent, type SnapConfig } from "./snapping";
|
|
8
8
|
import type { ViewOrigin } from "./external-store";
|
|
9
9
|
import type { LayerIR } from "./ir";
|
|
10
|
-
import { type Selection } from "./selection";
|
|
10
|
+
import { type PickAtOptions, type PickMode, type PickRect, type PickRectOptions, type Selection } from "./selection";
|
|
11
11
|
import type { ValidationEntry } from "./validation";
|
|
12
12
|
import type { MapViewport } from "./basemap";
|
|
13
13
|
/**
|
|
@@ -389,6 +389,8 @@ export declare class RuntimeCore {
|
|
|
389
389
|
private bimGeoreference;
|
|
390
390
|
/** Rendered deck layer id → authored manifest/controller id (terrain uses fresh renderer ids). */
|
|
391
391
|
private renderedLayerIds;
|
|
392
|
+
/** docs/design/pick-api.md — `"all"` forces every built layer pickable; see `PickMode`. */
|
|
393
|
+
private pickMode;
|
|
392
394
|
/** Zoom-visibility gate fingerprint (see computeZoomGateKey) — camera moves rebuild layers only when this changes. */
|
|
393
395
|
private zoomGateKey;
|
|
394
396
|
/** Hover-pick cadence (issue #31) — a GETTER so an attribute edit applies to the very next pointer move. Default: rest-debounced. */
|
|
@@ -547,6 +549,16 @@ export declare class RuntimeCore {
|
|
|
547
549
|
* layer wins; identify itself is a CPU sample of the retained decode.
|
|
548
550
|
*/
|
|
549
551
|
private rasterSelectionAt;
|
|
552
|
+
/**
|
|
553
|
+
* A deck pick → the selection every consumer reads, `coordinate` in lng/lat.
|
|
554
|
+
* deck reports `info.coordinate` in its own view space, which on a projected
|
|
555
|
+
* map is plane METRES; passed through raw, a click popup anchored to the
|
|
556
|
+
* selection never appeared and `zoom-to-feature` set the camera to a
|
|
557
|
+
* longitude of -594331 (reproduced on an EPSG:5070 cartograph frame,
|
|
558
|
+
* e2e/plane-pick.spec.ts). `om-map-point` was always converted; this is the
|
|
559
|
+
* same conversion for picks.
|
|
560
|
+
*/
|
|
561
|
+
private selectionFor;
|
|
550
562
|
private pickCallbacks;
|
|
551
563
|
/** The current lighting as a deck `effects` array — [] restores deck's default lights. */
|
|
552
564
|
private buildEffects;
|
|
@@ -678,6 +690,43 @@ export declare class RuntimeCore {
|
|
|
678
690
|
* this just stops adding avoidable per-move allocation on top of it.)
|
|
679
691
|
*/
|
|
680
692
|
private pickForSnap;
|
|
693
|
+
setPickMode(mode: PickMode): void;
|
|
694
|
+
getPickMode(): PickMode;
|
|
695
|
+
/** The object or feature under a screen pixel, or null. Same `Selection` a click produces (`type: "click"`), with `coordinate` always lng/lat. */
|
|
696
|
+
pickAt(pixel: [number, number], opts?: PickAtOptions): Selection | null;
|
|
697
|
+
/**
|
|
698
|
+
* Every object inside a screen rectangle, front to back, up to `maxObjects`.
|
|
699
|
+
* deck reports no per-object position for a rectangle pick, so each
|
|
700
|
+
* selection's `coordinate` is null and `pixel` is the rectangle's origin.
|
|
701
|
+
* Raster layers are not sampled: a box of pixel values is not a list of
|
|
702
|
+
* features.
|
|
703
|
+
*/
|
|
704
|
+
pickRect(rect: PickRect, opts?: PickRectOptions): Selection[];
|
|
705
|
+
/** Screen pixel → `[lng, lat]` on the ground plane, or null before the viewport exists. On every mode, a projected sheet included: `getViewport()` already speaks lng/lat. */
|
|
706
|
+
unproject(pixel: [number, number]): [number, number] | null;
|
|
707
|
+
/** deck's own rule (`Deck._shouldUnproject3D`): depth-pick when any live layer, sublayers included, is `pickable: "3d"`. */
|
|
708
|
+
private depthPickWanted;
|
|
709
|
+
/** Whichever object owns deck's pick methods in this mode — the standalone Deck, or the basemap overlay — or undefined while there is none to ask. */
|
|
710
|
+
private picker;
|
|
711
|
+
/**
|
|
712
|
+
* The rendered deck ids to search, and the authored ids a result may come
|
|
713
|
+
* from. Runtime plumbing (`__onlymapjs-*`: trace outlines, the terrain
|
|
714
|
+
* surface's own renderer id is never in `renderedLayerIds` at all) is never
|
|
715
|
+
* a pick target — it is not something an author or a user put there.
|
|
716
|
+
*/
|
|
717
|
+
private pickTargets;
|
|
718
|
+
/**
|
|
719
|
+
* One deck pick → a query result, or null when it is not one of the layers
|
|
720
|
+
* asked for. The layer id resolves the way the snapping re-pick does: a
|
|
721
|
+
* composite's SUB-layer (`${parentId}-${subId}`, deck's own convention) is
|
|
722
|
+
* reported as the authored parent, because that is the id a caller can do
|
|
723
|
+
* something with.
|
|
724
|
+
*/
|
|
725
|
+
private querySelection;
|
|
726
|
+
/** On a projected sheet deck picks in plane metres; a selection's coordinate is lng/lat on every map. */
|
|
727
|
+
private toLngLatSelection;
|
|
728
|
+
/** The point under a pixel in the space deck's own `info.coordinate` uses — what `rasterSelectionAt` expects, as on the click path. */
|
|
729
|
+
private viewSpaceAt;
|
|
681
730
|
private drainSnapshotCaptures;
|
|
682
731
|
/** Settle queued snapshot promises when the renderer they were waiting on goes away (mode flip / destroy) — never leave a caller hanging. */
|
|
683
732
|
private cancelSnapshotCaptures;
|