@nika-js/onlymap 0.13.3 → 0.13.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 +32 -0
- package/README.md +9 -5
- package/dist/actions.d.ts +12 -6
- package/dist/attribute-resolution.d.ts +32 -4
- package/dist/{basemap-5NHR6Gio.js → basemap-CErNEhX6.js} +3 -7
- package/dist/basemap.d.ts +1 -5
- package/dist/bbox-tokens.d.ts +70 -0
- package/dist/{build-DJjheWZ2.js → build-ByNIb4VX.js} +1 -1
- package/dist/{client-0mQmDog8.js → client-xe2E4jg4.js} +2 -2
- package/dist/clip-box-controller.d.ts +0 -17
- package/dist/ctx.d.ts +17 -0
- package/dist/data-layer.d.ts +15 -8
- package/dist/dom-tile-layer.d.ts +30 -0
- package/dist/draw-controller.d.ts +1 -1
- package/dist/elements/om-map.d.ts +12 -1
- package/dist/feature-service.d.ts +42 -0
- package/dist/geodesy.d.ts +6 -5
- package/dist/{geoparquet-B_nO2OyP.js → geoparquet-DOhMQl-X.js} +1 -1
- package/dist/{globe-view-BFUa9ksE.js → globe-view-84s_uNZX.js} +1 -1
- package/dist/grid-tiles.d.ts +117 -0
- package/dist/{hillshade-B_CxPhtA.js → hillshade-D8h8CRQq.js} +2 -2
- package/dist/{hillshade-shader-r7GxxjXj.js → hillshade-shader-Bm1O0P76.js} +1 -1
- package/dist/{index-YMu_yLXO.js → index-4Y4Q7RP4.js} +3 -3
- package/dist/{index-DWijIMti.js → index-BG_49YHy.js} +33543 -32098
- package/dist/index-BahtHUrg.js +8458 -0
- package/dist/{index-ChmxbIdj.js → index-DTN2CcOQ.js} +43 -43
- package/dist/{index-BvNxS6dM.js → index-DXxQu9Xi.js} +1 -1
- package/dist/{index-A1FYw2dy.js → index-D_EiGesl.js} +1 -1
- package/dist/{index-CObPGkze.js → index-DrSCLk9i.js} +22 -22
- package/dist/{index-CU7RnKnO.js → index-J_Sj6T0S.js} +32 -32
- package/dist/index-bpdGuZR6.js +478 -0
- package/dist/{index-CgIuV5Oh.js → index-phbljJTZ.js} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/ir-snapshot.d.ts +2 -0
- package/dist/ir.d.ts +18 -0
- package/dist/layer-registry.d.ts +1 -0
- package/dist/layers/warped-bitmap-layer.d.ts +14 -1
- package/dist/{lerc-Bl4vym9y.js → lerc-DLWS3sYw.js} +1 -1
- package/dist/onlymap.standalone.js +69300 -58870
- package/dist/onlymapjs.js +25 -25
- package/dist/parse-manifest.d.ts +4 -1
- package/dist/plane-gpu/plane-basemap.d.ts +237 -237
- package/dist/plane-vector/plane-mvt-layer.d.ts +237 -237
- package/dist/plane-warp.d.ts +14 -1
- package/dist/pmtiles.d.ts +76 -0
- package/dist/{post-process-effect-gFGVlC77.js → post-process-effect-CHsD0-oP.js} +1 -1
- package/dist/programmatic.d.ts +21 -1
- package/dist/{raster-1ShXyF12.js → raster-B7ILGg0X.js} +4 -4
- package/dist/{raster-pipeline-BMS54TX2.js → raster-pipeline-avMAbONM.js} +11 -11
- package/dist/react/om-layer.d.ts +4 -0
- package/dist/react.js +67 -65
- package/dist/runtime-core.d.ts +106 -4
- package/dist/serialize/emit.d.ts +2 -0
- package/dist/serialize/index.d.ts +2 -0
- package/dist/{terrain-inspect-Cndlmxig.js → terrain-inspect-FKTVm7nv.js} +1 -1
- package/dist/{text-on-path-QInco4aP.js → text-on-path-CpHM02Fs.js} +19 -18
- package/dist/tile-url.d.ts +84 -16
- package/dist/time-dimension.d.ts +25 -0
- package/dist/vector-style-CPvUSy2F.js +518 -0
- package/dist/vector-style.d.ts +59 -0
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CYD8fyBe.js → zarr-DpbT4eyF.js} +2 -2
- package/dist/zoom-gates.d.ts +60 -0
- package/docs/cartograph.md +2 -2
- package/llms.txt +4 -3
- package/onlymapjs.attributes.json +17 -0
- package/onlymapjs.html-data.json +56 -0
- package/package.json +5 -2
- package/skills/onlymapjs/SKILL.md +10 -3
- package/skills/onlymapjs/references/syntax.md +64 -7
- package/dist/index-DT5d7kFO.js +0 -459
package/dist/programmatic.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Effect } from "@deck.gl/core";
|
|
2
|
-
import { type Camera, type CameraOptions, type MandatedChromeHosts } from "./runtime-core";
|
|
2
|
+
import { type Camera, type CameraOptions, type LayerErrorDetail, type MandatedChromeHosts } from "./runtime-core";
|
|
3
3
|
import type { HoverPickMode } from "./hover-pick";
|
|
4
4
|
import { type LightingIR, type LightingOptions } from "./scene-lighting";
|
|
5
5
|
import type { TerrainIR } from "./terrain";
|
|
@@ -38,6 +38,10 @@ export interface LayerDescriptor {
|
|
|
38
38
|
/** Legend metadata (ctx.layers), same as the label/color attributes. */
|
|
39
39
|
label?: string;
|
|
40
40
|
color?: string;
|
|
41
|
+
/** `false` keeps the layer out of the legend and layer-switcher widgets (it stays in `ctx.layers`) — mirrors `listed="false"`. */
|
|
42
|
+
listed?: boolean;
|
|
43
|
+
/** Per-feature minimum zoom (public issue #25) — mirrors `min-zoom-field`: a row draws only while the camera zoom is ≥ its value in this field; missing/non-numeric values always draw. */
|
|
44
|
+
minZoomField?: string;
|
|
41
45
|
/** GPU filter (spec: "Filtering") — mirrors filter-field/filter-range/… (single dimension). */
|
|
42
46
|
filterField?: string;
|
|
43
47
|
filterRange?: [number, number];
|
|
@@ -63,6 +67,8 @@ export interface LayerDescriptor {
|
|
|
63
67
|
flush?: string;
|
|
64
68
|
/** Polling interval for REST snapshot URLs, e.g. "5s". */
|
|
65
69
|
refresh?: string;
|
|
70
|
+
/** For a `data` URL filled with the view's extent (`{bbox-crs84}`, `{bbox-epsg-XXXX}`): the most features kept per view (default 10000). */
|
|
71
|
+
maxFeatures?: number;
|
|
66
72
|
/**
|
|
67
73
|
* deck.gl updateTriggers, passed through per accessor prop. deck ignores
|
|
68
74
|
* accessor FUNCTION identity by design — supply a value here that changes
|
|
@@ -137,6 +143,8 @@ export interface MapControllerOptions {
|
|
|
137
143
|
onMapPoint?: (coordinate: [number, number] | null, kind: "click" | "hover") => void;
|
|
138
144
|
/** A Tile3DLayer finished loading its root tileset — the `om-tileset-load` DOM event's twin; `tileset` is the live deck `Tileset3D`. */
|
|
139
145
|
onTilesetLoad?: (layerId: string, tileset: unknown) => void;
|
|
146
|
+
/** A layer's tiles failed, once per cause per layer and template — the `om-layer-error` DOM event's twin. The same failure also reaches `onRuntimeError`. */
|
|
147
|
+
onLayerError?: (layerId: string, failure: LayerErrorDetail) => void;
|
|
140
148
|
/** A Route layer finished resolving — the `om-route-resolved` DOM event's twin; `route` carries the normalized geometry/distanceMeters/durationSec/legs/bounds. */
|
|
141
149
|
onRouteResolved?: (layerId: string, route: {
|
|
142
150
|
geometry?: {
|
|
@@ -230,7 +238,13 @@ export declare class MapController {
|
|
|
230
238
|
* `origin`, so it must reset on settle even for store-only consumers.
|
|
231
239
|
*/
|
|
232
240
|
private readonly viewSettle;
|
|
241
|
+
/** Hand the settled view to view-filled feature layers (feature-service.ts). */
|
|
242
|
+
private pushDataView;
|
|
233
243
|
private onViewChange?;
|
|
244
|
+
private onLayerError?;
|
|
245
|
+
private onRuntimeError?;
|
|
246
|
+
/** View-data findings already reported, so each is reported once while it stands (the om-map twin). */
|
|
247
|
+
private viewDataReported;
|
|
234
248
|
/** Per-layer data version counters (`data:<id>` snapshots) — bumped on every data change, monotonic for the controller's lifetime. */
|
|
235
249
|
private readonly dataVersions;
|
|
236
250
|
private readyFired;
|
|
@@ -248,6 +262,12 @@ export declare class MapController {
|
|
|
248
262
|
*/
|
|
249
263
|
clusterLeaves(layerId: string, clusterId: number, limit?: number, offset?: number): unknown[];
|
|
250
264
|
private scheduleCommit;
|
|
265
|
+
/**
|
|
266
|
+
* A view-filled feature layer's failure or cap (feature-service.ts), on
|
|
267
|
+
* the same channels om-map uses — `onLayerError` and `onRuntimeError` —
|
|
268
|
+
* once per finding while it stands.
|
|
269
|
+
*/
|
|
270
|
+
private reportViewData;
|
|
251
271
|
private commit;
|
|
252
272
|
private checkReady;
|
|
253
273
|
/** Readiness as a poll (the promise form is `ready`). */
|
|
@@ -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-avMAbONM.js";
|
|
2
2
|
import { N as Nt, c as zt } from "./hillshade-apron-Bem3DWyJ.js";
|
|
3
|
-
import { r as Bt } from "./hillshade-shader-
|
|
4
|
-
import {
|
|
3
|
+
import { r as Bt } from "./hillshade-shader-Bm1O0P76.js";
|
|
4
|
+
import { c9 as _t, ca as $t } from "./index-BG_49YHy.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-DLWS3sYw.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,6 +1,6 @@
|
|
|
1
1
|
import { w as he } from "./mgrs-BY9bIvp4.js";
|
|
2
|
-
import { am as de,
|
|
3
|
-
import { p as ye, a as Le, h as we } from "./hillshade-shader-
|
|
2
|
+
import { am as de, c1 as fe, c2 as re, c as oe, c3 as me, G as pe, c4 as ge, b7 as Z, c5 as ve, N as be, c6 as xe, c7 as Pe, c8 as Te, ac as ie } from "./index-BG_49YHy.js";
|
|
3
|
+
import { p as ye, a as Le, h as we } from "./hillshade-shader-Bm1O0P76.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 = [
|
|
6
6
|
c,
|
|
@@ -742,7 +742,7 @@ const J = 512, qe = [
|
|
|
742
742
|
// right edge
|
|
743
743
|
[0.5, 1]
|
|
744
744
|
// bottom edge
|
|
745
|
-
]), E = 6378137, S = 2 * Math.PI * E, K = S / 2,
|
|
745
|
+
]), E = 6378137, S = 2 * Math.PI * E, K = S / 2, Q = 85.05112877980659;
|
|
746
746
|
class z {
|
|
747
747
|
/** Index across a row */
|
|
748
748
|
x;
|
|
@@ -906,7 +906,7 @@ function Ge(n, e) {
|
|
|
906
906
|
const [r, o] = n(t, s);
|
|
907
907
|
if (Number.isFinite(r) && Number.isFinite(o))
|
|
908
908
|
return [r, o];
|
|
909
|
-
const [i, a] = e(t, s), u = Math.max(-
|
|
909
|
+
const [i, a] = e(t, s), u = Math.max(-Q, Math.min(Q, a)) * Math.PI / 180, l = i * Math.PI * E / 180, d = Math.log(Math.tan(Math.PI / 4 + u / 2)) * E;
|
|
910
910
|
return [l, d];
|
|
911
911
|
};
|
|
912
912
|
}
|
|
@@ -926,7 +926,7 @@ function Je([n, e]) {
|
|
|
926
926
|
];
|
|
927
927
|
}
|
|
928
928
|
const Ke = 100;
|
|
929
|
-
function
|
|
929
|
+
function Qe(n) {
|
|
930
930
|
const { descriptor: e, viewport: t, datasetWgs84Bounds: s } = n, r = e.levels[0], o = [];
|
|
931
931
|
if (r.matrixWidth * r.matrixHeight <= Ke) {
|
|
932
932
|
for (let m = 0; m < r.matrixHeight; m++)
|
|
@@ -948,7 +948,7 @@ function _e(n) {
|
|
|
948
948
|
o.push(new z(p, m, 0, { descriptor: e }));
|
|
949
949
|
return o;
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function _e(n, e) {
|
|
952
952
|
const { viewport: t, maxZ: s, zRange: r, wgs84Bounds: o, pixelRatio: i = 1 } = e, a = e.boundingVolumeCache ?? new ce();
|
|
953
953
|
a.sweep();
|
|
954
954
|
const c = t instanceof pe && t.resolution ? t.projectPosition : null, u = Object.values(t.getFrustumPlanes()).map(({ normal: O, distance: B }) => new ge(O.clone().negate(), B)), l = new ve(u), d = t.distanceScales.unitsPerMeter[2], f = r && r[0] * d || 0, h = r && r[1] * d || 0, m = 0, [p, g, P, b] = o, x = Z([p, g]), v = Z([P, b]), T = [
|
|
@@ -956,7 +956,7 @@ function Qe(n, e) {
|
|
|
956
956
|
x[1],
|
|
957
957
|
v[0],
|
|
958
958
|
v[1]
|
|
959
|
-
], w =
|
|
959
|
+
], w = Qe({
|
|
960
960
|
descriptor: n,
|
|
961
961
|
viewport: t,
|
|
962
962
|
datasetWgs84Bounds: o
|
|
@@ -1062,7 +1062,7 @@ class ot extends Te {
|
|
|
1062
1062
|
const { viewport: t, minZoom: s } = e;
|
|
1063
1063
|
if (typeof s == "number" && t.zoom < s)
|
|
1064
1064
|
return [];
|
|
1065
|
-
const r = this.descriptor.levels.length - 1, o = typeof e.maxZoom == "number" ? Math.min(e.maxZoom, r) : r, i =
|
|
1065
|
+
const r = this.descriptor.levels.length - 1, o = typeof e.maxZoom == "number" ? Math.min(e.maxZoom, r) : r, i = _e(this.descriptor, {
|
|
1066
1066
|
viewport: t,
|
|
1067
1067
|
maxZ: o,
|
|
1068
1068
|
zRange: e.zRange ?? null,
|
|
@@ -1142,7 +1142,7 @@ class ot extends Te {
|
|
|
1142
1142
|
};
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
|
-
const N = 512, it = 40075016686e-3,
|
|
1145
|
+
const N = 512, it = 40075016686e-3, _ = N / it, at = {
|
|
1146
1146
|
...ie.defaultProps,
|
|
1147
1147
|
maxError: 0.125,
|
|
1148
1148
|
debug: !1,
|
|
@@ -1275,12 +1275,12 @@ class St extends oe {
|
|
|
1275
1275
|
coordinateOrigin: [N / 2, N / 2, 0],
|
|
1276
1276
|
// biome-ignore format: array
|
|
1277
1277
|
modelMatrix: [
|
|
1278
|
-
|
|
1278
|
+
_,
|
|
1279
1279
|
0,
|
|
1280
1280
|
0,
|
|
1281
1281
|
0,
|
|
1282
1282
|
0,
|
|
1283
|
-
|
|
1283
|
+
_,
|
|
1284
1284
|
0,
|
|
1285
1285
|
0,
|
|
1286
1286
|
0,
|
package/dist/react/om-layer.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export interface OmLayerProps {
|
|
|
14
14
|
/** Legend metadata (ctx.layers). */
|
|
15
15
|
label?: string;
|
|
16
16
|
color?: string;
|
|
17
|
+
/** `false` keeps the layer out of the legend and layer-switcher widgets — mirrors `listed="false"`. */
|
|
18
|
+
listed?: boolean;
|
|
19
|
+
/** Per-feature minimum zoom — mirrors `min-zoom-field`: a row draws only while zoom ≥ its value in this field. */
|
|
20
|
+
minZoomField?: string;
|
|
17
21
|
/** GPU filter (DataFilterExtension) — mirrors filter-field/filter-range (single dimension). */
|
|
18
22
|
filterField?: string;
|
|
19
23
|
filterRange?: [number, number];
|
package/dist/react.js
CHANGED
|
@@ -3,10 +3,10 @@ var Ie = (r, e, s) => e in r ? Be(r, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var be = (r, e, s) => Ie(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
4
|
import { jsxs as se, jsx as E } from "react/jsx-runtime";
|
|
5
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
|
|
6
|
+
import { MANAGED_SLOTS as Ve, slotContainerStyle as qe, FOLD_SIDES as N, MapController as Ze, parseWidgetStyle as Ge, foldToggleSlot as Je, foldToggleStyle as Ye, foldPanelStyle as Xe, 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
7
|
import { createPortal as Re } from "react-dom";
|
|
8
8
|
const Ee = Ke(null);
|
|
9
|
-
function
|
|
9
|
+
function X(r) {
|
|
10
10
|
const e = We(Ee);
|
|
11
11
|
if (!e) throw new Error(`[onlymapjs] ${r} must be rendered inside <OmMap>.`);
|
|
12
12
|
return e;
|
|
@@ -17,8 +17,8 @@ function ae(r, e) {
|
|
|
17
17
|
return s.length !== o.length ? !1 : s.every((i) => r[i] === e[i]);
|
|
18
18
|
}
|
|
19
19
|
function ct(r, e) {
|
|
20
|
-
const { props: s, updateTriggers: o, ...i } = r, { props: b, updateTriggers:
|
|
21
|
-
return ae(i, d) && ae(s, b) && ae(o,
|
|
20
|
+
const { props: s, updateTriggers: o, ...i } = r, { props: b, updateTriggers: m, ...d } = e;
|
|
21
|
+
return ae(i, d) && ae(s, b) && ae(o, m);
|
|
22
22
|
}
|
|
23
23
|
class lt {
|
|
24
24
|
constructor(e) {
|
|
@@ -33,19 +33,19 @@ class lt {
|
|
|
33
33
|
this.descriptors.delete(e) && this.controller.setLayers([...this.descriptors.values()]);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const Y = Ve, ut = Object.fromEntries(Y.map((r) => [r, qe(r)])), ve = { display: "flex", pointerEvents: "none", order: 2147483647 }, dt = Object.fromEntries(N.map((r) => [r, null]));
|
|
37
37
|
function ft(r) {
|
|
38
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
41
|
e ? e.focus() : (r.tabIndex = -1, r.focus());
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function mt(r, e) {
|
|
44
44
|
return Object.entries(e).some(([s, o]) => o !== void 0 && r[s] !== o);
|
|
45
45
|
}
|
|
46
46
|
const Rt = He(function(e, s) {
|
|
47
|
-
const { center: o, zoom: i, pitch: b, bearing:
|
|
48
|
-
() => Object.fromEntries(
|
|
47
|
+
const { center: o, zoom: i, pitch: b, bearing: m, basemap: d, projection: f, crs: h, crsDef: p, 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(Y.map((t) => [t, null]))
|
|
49
49
|
), [L, Ce] = x(!1), [V, Fe] = x({ lift: 0, shift: 0 }), [le, xe] = x(dt), [Te, je] = x(
|
|
50
50
|
() => Object.fromEntries(N.map((t) => [t, 0]))
|
|
51
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({
|
|
@@ -55,7 +55,7 @@ const Rt = He(function(e, s) {
|
|
|
55
55
|
K((n) => n === t ? n : t);
|
|
56
56
|
}, []), _e = D(
|
|
57
57
|
() => Object.fromEntries(
|
|
58
|
-
|
|
58
|
+
Y.map((t) => [
|
|
59
59
|
t,
|
|
60
60
|
(n) => {
|
|
61
61
|
ce((a) => a[t] === n ? a : { ...a, [t]: n });
|
|
@@ -73,10 +73,10 @@ const Rt = He(function(e, s) {
|
|
|
73
73
|
])
|
|
74
74
|
),
|
|
75
75
|
[]
|
|
76
|
-
),
|
|
76
|
+
), me = ie((t, n, a) => {
|
|
77
77
|
const u = De.current.get(t), y = u.size;
|
|
78
78
|
a ? u.add(n) : u.delete(n), u.size !== y && je((R) => ({ ...R, [t]: u.size }));
|
|
79
|
-
}, []),
|
|
79
|
+
}, []), pe = ie((t, n, a) => {
|
|
80
80
|
const u = $e.current;
|
|
81
81
|
a ? u.set(n, t) : u.delete(n);
|
|
82
82
|
const y = new Set(u.values());
|
|
@@ -96,26 +96,26 @@ const Rt = He(function(e, s) {
|
|
|
96
96
|
}, [O, fe, de]), w(() => {
|
|
97
97
|
(!L || v) && U(null);
|
|
98
98
|
}, [L, v]);
|
|
99
|
-
const ye = g({ center: o, zoom: i, pitch: b, bearing:
|
|
100
|
-
ye.current = { center: o, zoom: i, pitch: b, bearing:
|
|
101
|
-
const
|
|
102
|
-
|
|
99
|
+
const ye = g({ center: o, zoom: i, pitch: b, bearing: m });
|
|
100
|
+
ye.current = { center: o, zoom: i, pitch: b, bearing: m };
|
|
101
|
+
const Z = g(e.onReady);
|
|
102
|
+
Z.current = e.onReady;
|
|
103
103
|
const _ = g(e.onViewStateChange);
|
|
104
104
|
_.current = e.onViewStateChange;
|
|
105
|
-
const
|
|
106
|
-
|
|
105
|
+
const G = g(e.onRuntimeError);
|
|
106
|
+
G.current = e.onRuntimeError;
|
|
107
107
|
const Q = g(d);
|
|
108
108
|
Q.current = d;
|
|
109
109
|
const ee = g(f);
|
|
110
110
|
ee.current = f;
|
|
111
|
-
const W = g({ crs: h, crsDef:
|
|
112
|
-
W.current = { crs: h, crsDef:
|
|
111
|
+
const W = g({ crs: h, crsDef: p });
|
|
112
|
+
W.current = { crs: h, crsDef: p };
|
|
113
113
|
const te = g(""), re = g(void 0), ne = g(void 0);
|
|
114
114
|
he(() => {
|
|
115
115
|
if (!j.current) return;
|
|
116
116
|
const t = ye.current;
|
|
117
117
|
ne.current = Q.current, re.current = ee.current, te.current = `${W.current.crs ?? ""}|${W.current.crsDef ?? ""}`;
|
|
118
|
-
const n = new
|
|
118
|
+
const n = new Ze(j.current, {
|
|
119
119
|
center: t.center,
|
|
120
120
|
zoom: t.zoom,
|
|
121
121
|
pitch: t.pitch,
|
|
@@ -133,14 +133,14 @@ const Rt = He(function(e, s) {
|
|
|
133
133
|
},
|
|
134
134
|
onRuntimeError: (u) => {
|
|
135
135
|
var y;
|
|
136
|
-
return (y =
|
|
136
|
+
return (y = G.current) == null ? void 0 : y.call(G, u);
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
F(n);
|
|
140
140
|
let a = !0;
|
|
141
141
|
return n.ready.then(() => {
|
|
142
142
|
var u;
|
|
143
|
-
a && ((u =
|
|
143
|
+
a && ((u = Z.current) == null || u.call(Z));
|
|
144
144
|
}), () => {
|
|
145
145
|
a = !1, F(null), n.destroy();
|
|
146
146
|
};
|
|
@@ -149,13 +149,13 @@ const Rt = He(function(e, s) {
|
|
|
149
149
|
}, [l, d]), w(() => {
|
|
150
150
|
!l || re.current === f || (re.current = f, l.setProjection(f ?? null));
|
|
151
151
|
}, [l, f]), w(() => {
|
|
152
|
-
const t = `${h ?? ""}|${
|
|
153
|
-
!l || te.current === t || (te.current = t, l.setCrs(h ?? null,
|
|
154
|
-
}, [l, h,
|
|
152
|
+
const t = `${h ?? ""}|${p ?? ""}`;
|
|
153
|
+
!l || te.current === t || (te.current = t, l.setCrs(h ?? null, p ?? null));
|
|
154
|
+
}, [l, h, p]), Ne(s, () => l, [l]), w(() => {
|
|
155
155
|
if (!l) return;
|
|
156
|
-
const t = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: b, bearing:
|
|
157
|
-
|
|
158
|
-
}, [l, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, b,
|
|
156
|
+
const t = { longitude: o == null ? void 0 : o[0], latitude: o == null ? void 0 : o[1], zoom: i, pitch: b, bearing: m };
|
|
157
|
+
mt(l.getViewState(), t) && l.setView(t);
|
|
158
|
+
}, [l, o == null ? void 0 : o[0], o == null ? void 0 : o[1], i, b, m]), w(() => {
|
|
159
159
|
var t;
|
|
160
160
|
if (l)
|
|
161
161
|
return (t = _.current) == null || t.call(_, l.getViewState()), l.getStore("viewport").subscribe(() => {
|
|
@@ -163,12 +163,12 @@ const Rt = He(function(e, s) {
|
|
|
163
163
|
return (n = _.current) == null ? void 0 : n.call(_, l.getViewState());
|
|
164
164
|
});
|
|
165
165
|
}, [l]);
|
|
166
|
-
const I = B["bottom-start"],
|
|
166
|
+
const I = B["bottom-start"], J = B["bottom-end"];
|
|
167
167
|
w(() => {
|
|
168
168
|
const t = C.current;
|
|
169
|
-
if (!t || !
|
|
169
|
+
if (!t || !J || typeof ResizeObserver > "u") return;
|
|
170
170
|
const n = () => {
|
|
171
|
-
const u = parseFloat(getComputedStyle(t).getPropertyValue("--om-widget-gap-y")) || 8, y =
|
|
171
|
+
const u = parseFloat(getComputedStyle(t).getPropertyValue("--om-widget-gap-y")) || 8, y = J.getBoundingClientRect(), R = nt(
|
|
172
172
|
(I == null ? void 0 : I.getBoundingClientRect()) ?? null,
|
|
173
173
|
y,
|
|
174
174
|
L ? ot : 0,
|
|
@@ -176,8 +176,8 @@ const Rt = He(function(e, s) {
|
|
|
176
176
|
), k = R + Math.ceil(y.height) + u;
|
|
177
177
|
Fe((H) => H.lift === R && H.shift === k ? H : { lift: R, shift: k });
|
|
178
178
|
}, a = new ResizeObserver(n);
|
|
179
|
-
return a.observe(t), a.observe(
|
|
180
|
-
}, [I,
|
|
179
|
+
return a.observe(t), a.observe(J), I && a.observe(I), n(), () => a.disconnect();
|
|
180
|
+
}, [I, J, L]);
|
|
181
181
|
const ze = D(
|
|
182
182
|
() => ({
|
|
183
183
|
position: "absolute",
|
|
@@ -189,12 +189,12 @@ const Rt = He(function(e, s) {
|
|
|
189
189
|
// drawer root reads it through foldDrawerStyle's max() (same wiring
|
|
190
190
|
// as the HTML lane's widget layer).
|
|
191
191
|
"--om-fold-bottom-shift": `${V.shift}px`,
|
|
192
|
-
...S ?
|
|
192
|
+
...S ? Ge(S).properties : void 0
|
|
193
193
|
}),
|
|
194
194
|
[S, V.shift]
|
|
195
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:
|
|
197
|
-
[l, oe, M, B, v, L, le,
|
|
196
|
+
() => l && oe && M ? { controller: l, layers: oe, overlayPane: M, corners: B, widgetsHidden: !!v, widgetsFolded: L, foldPanels: le, registerFoldedWidget: me, registerSlotWidget: pe } : null,
|
|
197
|
+
[l, oe, M, B, v, L, le, me, pe]
|
|
198
198
|
);
|
|
199
199
|
return /* @__PURE__ */ se("div", { ref: C, className: T, style: { position: "relative", overflow: "hidden", ...A }, children: [
|
|
200
200
|
/* @__PURE__ */ E("div", { ref: j, style: { position: "absolute", inset: 0 } }),
|
|
@@ -205,7 +205,7 @@ const Rt = He(function(e, s) {
|
|
|
205
205
|
style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
|
|
206
206
|
}
|
|
207
207
|
),
|
|
208
|
-
/* @__PURE__ */ E("div", { "data-om-widget-layer": "", style: ze, children:
|
|
208
|
+
/* @__PURE__ */ E("div", { "data-om-widget-layer": "", style: ze, children: Y.map((t) => /* @__PURE__ */ se(
|
|
209
209
|
"div",
|
|
210
210
|
{
|
|
211
211
|
"data-om-widget-slot": t,
|
|
@@ -215,7 +215,7 @@ const Rt = He(function(e, s) {
|
|
|
215
215
|
...V.lift > 0 && t === "bottom-end" ? { bottom: `calc(var(--om-widget-inset-y, 12px) + ${V.lift}px)` } : void 0
|
|
216
216
|
},
|
|
217
217
|
children: [
|
|
218
|
-
L && N.filter((n) =>
|
|
218
|
+
L && N.filter((n) => Je(n) === t && Te[n] > 0).map((n) => {
|
|
219
219
|
const a = ke === n;
|
|
220
220
|
return /* @__PURE__ */ se(
|
|
221
221
|
"div",
|
|
@@ -235,7 +235,7 @@ const Rt = He(function(e, s) {
|
|
|
235
235
|
"aria-expanded": a,
|
|
236
236
|
"aria-controls": `${ue}-${n}`,
|
|
237
237
|
"aria-label": `${a ? "Close" : "Open"} ${n} map controls`,
|
|
238
|
-
style:
|
|
238
|
+
style: Ye(),
|
|
239
239
|
onClick: () => {
|
|
240
240
|
U(a ? null : n), a || requestAnimationFrame(() => {
|
|
241
241
|
var y;
|
|
@@ -255,7 +255,7 @@ const Rt = He(function(e, s) {
|
|
|
255
255
|
role: "region",
|
|
256
256
|
"aria-label": `${n} map controls`,
|
|
257
257
|
hidden: !a,
|
|
258
|
-
style: { ...
|
|
258
|
+
style: { ...Xe(n), display: a ? "flex" : "none" }
|
|
259
259
|
}
|
|
260
260
|
)
|
|
261
261
|
]
|
|
@@ -295,6 +295,8 @@ const Rt = He(function(e, s) {
|
|
|
295
295
|
data: "data",
|
|
296
296
|
label: "label",
|
|
297
297
|
color: "color",
|
|
298
|
+
listed: "listed",
|
|
299
|
+
minZoomField: "minZoomField",
|
|
298
300
|
filterField: "filterField",
|
|
299
301
|
filterRange: "filterRange",
|
|
300
302
|
filterSoftRange: "filterSoftRange",
|
|
@@ -317,47 +319,47 @@ const Rt = He(function(e, s) {
|
|
|
317
319
|
crs: "crs",
|
|
318
320
|
crsDef: "crsDef",
|
|
319
321
|
updateTriggers: "updateTriggers"
|
|
320
|
-
},
|
|
322
|
+
}, pt = /* @__PURE__ */ new Set([...Object.keys(Pe), "onClick", "onHover"]);
|
|
321
323
|
function yt(r) {
|
|
322
324
|
const e = {};
|
|
323
325
|
for (const [o, i] of Object.entries(r))
|
|
324
|
-
!
|
|
326
|
+
!pt.has(o) && i !== void 0 && (e[o] = i);
|
|
325
327
|
const s = {};
|
|
326
328
|
for (const [o, i] of Object.entries(Pe))
|
|
327
329
|
s[i] = r[o];
|
|
328
330
|
return Object.keys(e).length > 0 && (s.props = e), s;
|
|
329
331
|
}
|
|
330
332
|
function Et(r) {
|
|
331
|
-
const { controller: e, layers: s } =
|
|
333
|
+
const { controller: e, layers: s } = X("OmLayer"), { id: o } = r, i = yt(r);
|
|
332
334
|
w(() => {
|
|
333
335
|
s.upsert(i);
|
|
334
336
|
}), w(() => () => s.remove(o), [s, o]);
|
|
335
337
|
const b = g(r.onClick);
|
|
336
338
|
b.current = r.onClick;
|
|
337
|
-
const
|
|
338
|
-
return
|
|
339
|
+
const m = g(r.onHover);
|
|
340
|
+
return m.current = r.onHover, w(
|
|
339
341
|
() => e.watchPicks((d) => {
|
|
340
|
-
var f, h,
|
|
342
|
+
var f, h, p;
|
|
341
343
|
if (d === null) {
|
|
342
|
-
(f =
|
|
344
|
+
(f = m.current) == null || f.call(m, null);
|
|
343
345
|
return;
|
|
344
346
|
}
|
|
345
|
-
d.layerId === o && (d.type === "click" ? (h = b.current) == null || h.call(b, d) : (
|
|
347
|
+
d.layerId === o && (d.type === "click" ? (h = b.current) == null || h.call(b, d) : (p = m.current) == null || p.call(m, d));
|
|
346
348
|
}),
|
|
347
349
|
[e, o]
|
|
348
350
|
), null;
|
|
349
351
|
}
|
|
350
352
|
function Pt({ position: r = "top-start", order: e, fold: s, className: o, style: i, children: b }) {
|
|
351
|
-
const { corners:
|
|
353
|
+
const { corners: m, widgetsHidden: d, widgetsFolded: f, foldPanels: h, registerFoldedWidget: p, registerSlotWidget: $ } = X("OmWidget"), P = Oe(), c = st(r) ?? "top-start", S = f && c !== "manual" && s !== "never", v = c === "manual" ? null : it(c);
|
|
352
354
|
if (w(() => {
|
|
353
355
|
if (v)
|
|
354
|
-
return
|
|
355
|
-
}, [v, P, S,
|
|
356
|
+
return p(v, P, S), () => p(v, P, !1);
|
|
357
|
+
}, [v, P, S, p]), w(() => {
|
|
356
358
|
if (c !== "manual")
|
|
357
359
|
return $(c, P, !0), () => $(c, P, !1);
|
|
358
360
|
}, [c, P, $]), c === "manual")
|
|
359
361
|
return /* @__PURE__ */ E("div", { className: o, style: { pointerEvents: "auto", ...i }, children: b });
|
|
360
|
-
const O = S && v ? h[v] :
|
|
362
|
+
const O = S && v ? h[v] : m[c];
|
|
361
363
|
return O ? Re(
|
|
362
364
|
/* @__PURE__ */ E(
|
|
363
365
|
"div",
|
|
@@ -395,9 +397,9 @@ const bt = {
|
|
|
395
397
|
"bottom-right": "translate(-100%, -100%)"
|
|
396
398
|
};
|
|
397
399
|
function Ct(r) {
|
|
398
|
-
const { controller: e, overlayPane: s } =
|
|
400
|
+
const { controller: e, overlayPane: s } = X("OmOverlay"), o = g(null), i = g(void 0), b = g(r);
|
|
399
401
|
b.current = r;
|
|
400
|
-
const
|
|
402
|
+
const m = D(() => {
|
|
401
403
|
const c = e.getStore("selection");
|
|
402
404
|
let S, v, O = null;
|
|
403
405
|
return {
|
|
@@ -408,9 +410,9 @@ function Ct(r) {
|
|
|
408
410
|
}
|
|
409
411
|
};
|
|
410
412
|
}, [e]), d = we(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
413
|
+
m.subscribe,
|
|
414
|
+
m.getSnapshot,
|
|
415
|
+
m.getSnapshot
|
|
414
416
|
);
|
|
415
417
|
w(
|
|
416
418
|
() => e.registerOverlay((c, S, v) => {
|
|
@@ -433,7 +435,7 @@ function Ct(r) {
|
|
|
433
435
|
), w(() => {
|
|
434
436
|
e.refreshOverlays();
|
|
435
437
|
});
|
|
436
|
-
const { children: f, className: h, style:
|
|
438
|
+
const { children: f, className: h, style: p, interactive: $ = !0 } = r, P = typeof f == "function" ? f(d) : f;
|
|
437
439
|
return Re(
|
|
438
440
|
/* @__PURE__ */ E(
|
|
439
441
|
"div",
|
|
@@ -448,7 +450,7 @@ function Ct(r) {
|
|
|
448
450
|
// hidden until the first flush positions it — never flashes at the origin
|
|
449
451
|
willChange: "transform",
|
|
450
452
|
pointerEvents: $ ? "auto" : "none",
|
|
451
|
-
...
|
|
453
|
+
...p
|
|
452
454
|
},
|
|
453
455
|
children: P
|
|
454
456
|
}
|
|
@@ -457,19 +459,19 @@ function Ct(r) {
|
|
|
457
459
|
);
|
|
458
460
|
}
|
|
459
461
|
function Ft(r = []) {
|
|
460
|
-
const { controller: e } =
|
|
461
|
-
const
|
|
462
|
+
const { controller: e } = X("useOmMap"), s = r.join(" "), o = D(() => {
|
|
463
|
+
const m = (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
464
|
let d;
|
|
463
465
|
return {
|
|
464
466
|
subscribe: (f) => {
|
|
465
|
-
const h =
|
|
467
|
+
const h = m.map((p) => p.subscribe(f));
|
|
466
468
|
return () => {
|
|
467
|
-
for (const
|
|
469
|
+
for (const p of h) p();
|
|
468
470
|
};
|
|
469
471
|
},
|
|
470
472
|
getSnapshot: () => {
|
|
471
|
-
const f =
|
|
472
|
-
return (!d || f.some((h,
|
|
473
|
+
const f = m.map((h) => h.getSnapshot());
|
|
474
|
+
return (!d || f.some((h, p) => h !== d[p])) && (d = f), d;
|
|
473
475
|
}
|
|
474
476
|
};
|
|
475
477
|
}, [e, s]), i = we(o.subscribe, o.getSnapshot, o.getSnapshot);
|