@nika-js/onlymap 0.13.0 → 0.13.2

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +2 -2
  3. package/bin/dem-tiles.mjs +270 -0
  4. package/bin/onlymapjs.mjs +138 -34
  5. package/dist/{basemap-BxqFTBzX.js → basemap-CdSCIWCl.js} +473 -443
  6. package/dist/basemap.d.ts +16 -3
  7. package/dist/{build-D4iI8O9b.js → build-CUx4yR_O.js} +10 -10
  8. package/dist/camera-altitude.d.ts +29 -0
  9. package/dist/{client-BYFePLZV.js → client-DVkMuuPp.js} +2 -2
  10. package/dist/color.d.ts +15 -0
  11. package/dist/credit-chrome.d.ts +11 -0
  12. package/dist/elements/om-map.d.ts +41 -1
  13. package/dist/geodesy.d.ts +2 -0
  14. package/dist/{geoparquet-BV32P0nI.js → geoparquet-DuCEsCOu.js} +3 -3
  15. package/dist/{globe-view-B_X6obse.js → globe-view-BWNfn-Sx.js} +1 -1
  16. package/dist/ground-controller.d.ts +39 -0
  17. package/dist/{hillshade-9VS_t-Ks.js → hillshade-DyfYxqNm.js} +61 -64
  18. package/dist/{hillshade-shader-DI2uLSNU.js → hillshade-shader-BWA0USDQ.js} +12 -11
  19. package/dist/hillshade-shader.d.ts +2 -2
  20. package/dist/hillshade.d.ts +0 -29
  21. package/dist/{index-IDWDfgTC.js → index-BfHaNHyY.js} +20687 -19351
  22. package/dist/{index-JewSBOjJ.js → index-CCj9Z5yt.js} +38 -38
  23. package/dist/{index-D40H3fpl.js → index-Cc3huYsW.js} +62 -62
  24. package/dist/{index-Bct9VWxi.js → index-DRGcZmBm.js} +1 -1
  25. package/dist/{index-eSuCj2Bn.js → index-DYrgHprN.js} +61 -61
  26. package/dist/{index-D3P6Cfbr.js → index-DabUE8w3.js} +38 -38
  27. package/dist/{index-CbFw6P0B.js → index-DfzI_j0D.js} +1 -1
  28. package/dist/{index-Di1LK4JT.js → index-DiDoH_BG.js} +3 -3
  29. package/dist/{index-BR_5FIN1.js → index-dUoVyYIW.js} +18 -18
  30. package/dist/index.d.ts +1 -1
  31. package/dist/{lerc-C42a0ISa.js → lerc-CUV0h9Ci.js} +1 -1
  32. package/dist/onlymap.standalone.js +37891 -36442
  33. package/dist/onlymapjs.js +49 -49
  34. package/dist/plane-gpu/plane-basemap.d.ts +0 -14
  35. package/dist/{post-process-effect-ktcgAjmv.js → post-process-effect-DPrpqybM.js} +1 -1
  36. package/dist/programmatic.d.ts +3 -1
  37. package/dist/{raster-CIxg_M_1.js → raster-CrRQNJE7.js} +4 -4
  38. package/dist/{raster-pipeline-BODPC9vJ.js → raster-pipeline-D9g8RAo4.js} +11 -11
  39. package/dist/runtime-core.d.ts +132 -0
  40. package/dist/sea-surface.d.ts +18 -0
  41. package/dist/terrain-derive.d.ts +39 -0
  42. package/dist/terrain-ground.d.ts +31 -0
  43. package/dist/terrain-heightfield.d.ts +17 -9
  44. package/dist/terrain-inspect-GowNVtMZ.js +96 -0
  45. package/dist/terrain-inspect.d.ts +34 -0
  46. package/dist/terrain-nodata.d.ts +50 -0
  47. package/dist/terrain-priority.d.ts +92 -0
  48. package/dist/terrain-sample.d.ts +6 -0
  49. package/dist/terrain-skirt.d.ts +6140 -0
  50. package/dist/terrain-texture-mask.d.ts +40 -0
  51. package/dist/terrain-tint.d.ts +61 -0
  52. package/dist/terrain.d.ts +132 -8
  53. package/dist/{text-on-path-LZL6NfwZ.js → text-on-path-BoFbm-tl.js} +1 -1
  54. package/dist/version.d.ts +1 -1
  55. package/dist/viewport-filter.d.ts +9 -0
  56. package/dist/volumetrics.d.ts +11 -0
  57. package/dist/{zarr-D19fNIZt.js → zarr-C8CU8LXU.js} +2 -2
  58. package/docs/cartograph.md +2 -2
  59. package/llms.txt +1 -1
  60. package/onlymapjs.html-data.json +162 -2
  61. package/package.json +2 -1
  62. package/skills/onlymapjs/SKILL.md +5 -2
  63. package/skills/onlymapjs/references/syntax.md +3 -3
package/dist/basemap.d.ts CHANGED
@@ -156,15 +156,28 @@ export declare class MapLibreBasemapAdapter {
156
156
  */
157
157
  setStyle(resolved: ResolvedBasemap): void;
158
158
  /**
159
- * This basemap's attribution as plain text: every source's declared
160
- * attribution plus the preset's own line, de-duplicated.
159
+ * This basemap's attribution as plain text: every source's attribution plus
160
+ * the preset's own line, de-duplicated.
161
161
  *
162
162
  * Every source the style DECLARES, not only the ones currently drawn — the
163
163
  * superset MapLibre's control narrows to. On a printed sheet an extra credit
164
164
  * costs nothing; a missing one is a licence breach.
165
+ *
166
+ * A source's credit is read from the LOADED source first. The keyless
167
+ * presets — CARTO's dark-matter, positron and voyager, OpenFreeMap's liberty
168
+ * and bright — declare each vector source as `{ type, url }`, and the credit
169
+ * lives in the TileJSON behind that url, which `getStyle()` never reports
170
+ * (MapLibre serialises the declared options). Reading the style alone
171
+ * returned nothing for every one of them, and a sheet printed no credit.
165
172
  */
166
173
  attributions(): string[];
167
- /** Called whenever a (new) style has loaded — the moment its sources' attributions are known. */
174
+ /**
175
+ * Called when a (new) style has loaded, and again whenever a source's
176
+ * metadata arrives with a credit the list did not have — the TileJSON of a
177
+ * `{ type, url }` source loads AFTER `style.load`, which is the only event
178
+ * MapLibre's own control does not wait on either (it re-reads on
179
+ * `sourcedata` metadata).
180
+ */
168
181
  onAttributionsChange(callback: () => void): void;
169
182
  /**
170
183
  * (Re)mounts the compact attribution control. Source-declared attributions
@@ -1,4 +1,4 @@
1
- import { ah as j, ai as T, aj as B, ak as E, al as q } from "./index-IDWDfgTC.js";
1
+ import { aq as q, ar as T, as as B, at as E, au as j } from "./index-BfHaNHyY.js";
2
2
  const N = (l) => Number.isFinite(l[0]) && Number.isFinite(l[1]);
3
3
  function O(l, t, s) {
4
4
  const o = T(s.x, s.y, s.z), i = 8, n = [];
@@ -23,7 +23,7 @@ function O(l, t, s) {
23
23
  }
24
24
  function U(l, t, s, o) {
25
25
  try {
26
- return q(l, t, o(s[0], s[1]));
26
+ return j(l, t, o(s[0], s[1]));
27
27
  } catch {
28
28
  return !1;
29
29
  }
@@ -40,21 +40,21 @@ function V(l, t, s, o, i) {
40
40
  return !1;
41
41
  }
42
42
  function H(l, t, s, o, i) {
43
- const { project: n, tears: p } = O(o, i, t), u = j.parseSync(l, {
43
+ const { project: n, tears: p } = O(o, i, t), u = q.parseSync(l, {
44
44
  // Called directly, the parser does not merge the loader's defaults: name
45
45
  // the layer property, which a basemap selects and styles by.
46
46
  mvt: { shape: "geojson", coordinates: "wgs84", tileIndex: t, layerProperty: "layerName", ...s.layers ? { layers: s.layers } : null }
47
- }) ?? [], a = T(t.x, t.y, t.z), g = B(a, n), d = s.cut !== !1, c = s.classify, e = new Y(), r = new Y(), F = new Y(), I = new Y(), M = [], S = [], k = [];
47
+ }) ?? [], a = T(t.x, t.y, t.z), g = B(a, n), d = s.cut !== !1, c = s.classify, e = new Y(), r = new Y(), F = new Y(), I = new Y(), M = [], S = [], C = [];
48
48
  u.forEach((f, h) => {
49
49
  const w = f.properties ?? {};
50
50
  M[h] = w;
51
51
  const y = f.geometry?.type;
52
52
  if (y === "Polygon" || y === "MultiPolygon") {
53
53
  const m = c ? c.fillRank[String(w.layerName)] : 0;
54
- if (m !== void 0 && S.push({ id: h, f, rank: m, casing: !1 }), s.outlines && !c) for (const v of R(f)) for (const P of v) C(F, h, w, P);
54
+ if (m !== void 0 && S.push({ id: h, f, rank: m, casing: !1 }), s.outlines && !c) for (const v of R(f)) for (const P of v) k(F, h, w, P);
55
55
  } else if (y === "LineString" || y === "MultiLineString") {
56
56
  const m = c ? _(c.lineRules, w) : void 0;
57
- (!c || m) && k.push({ id: h, f, rank: m?.rank ?? 0, casing: !!m?.casing });
57
+ (!c || m) && C.push({ id: h, f, rank: m?.rank ?? 0, casing: !!m?.casing });
58
58
  } else if ((y === "Point" || y === "MultiPoint") && !c) {
59
59
  const m = y === "Point" ? [f.geometry.coordinates] : f.geometry.coordinates;
60
60
  for (const v of m) {
@@ -65,19 +65,19 @@ function H(l, t, s, o, i) {
65
65
  }
66
66
  });
67
67
  const L = (f, h) => f.rank - h.rank;
68
- c && (S.sort(L), k.sort(L));
68
+ c && (S.sort(L), C.sort(L));
69
69
  for (const { id: f, f: h } of S)
70
70
  for (const w of R(h)) {
71
71
  const y = d ? g.polygon(w) : w;
72
72
  y && D(e, f, h.properties ?? {}, y, n, p);
73
73
  }
74
- for (const { id: f, f: h, casing: w } of k) {
74
+ for (const { id: f, f: h, casing: w } of C) {
75
75
  const y = h.geometry.type === "LineString" ? [h.geometry.coordinates] : h.geometry.coordinates;
76
76
  for (const m of y)
77
- C(r, f, h.properties ?? {}, m), w && C(I, f, h.properties ?? {}, m);
77
+ k(r, f, h.properties ?? {}, m), w && k(I, f, h.properties ?? {}, m);
78
78
  }
79
79
  return { fills: e.finish(), lines: r.finish(), outlines: F.finish(), casings: I.finish(), properties: M };
80
- function C(f, h, w, y) {
80
+ function k(f, h, w, y) {
81
81
  const m = d ? g.line(y) : [{ points: y, startCut: !1, endCut: !1 }];
82
82
  for (const v of m) {
83
83
  let P = [], z = v.startCut;
@@ -0,0 +1,29 @@
1
+ /** A geographic camera, plus the frame lift deck's view state may carry. */
2
+ export interface EyeView {
3
+ longitude: number;
4
+ latitude: number;
5
+ zoom: number;
6
+ pitch: number;
7
+ bearing: number;
8
+ position?: readonly number[];
9
+ }
10
+ /** The eye as `[lng, lat, scene metres]`, or null for a viewport with no size yet. */
11
+ export declare function eyeOf(view: EyeView, width: number, height: number): [number, number, number] | null;
12
+ /** A scene height in true metres (`exaggeration` is always positive — the terrain parse guarantees it). */
13
+ export declare function trueMetres(scene: number, exaggeration: number): number;
14
+ /** `camera-clearance`: true metres, or null for no floor (absent, empty, or not a non-negative number — validation reports the last). One parse for the element and the validator. */
15
+ export declare function parseCameraClearance(raw: string | null): number | null;
16
+ /**
17
+ * The highest zoom at which the eye stays `clearance` true metres above the
18
+ * ground beneath it, or null when there is nothing to hold it to (no size,
19
+ * no ground tile yet, or a floor the eye can never reach down to).
20
+ *
21
+ * The eye's height above the frame lift scales as 2^−zoom (deck keeps it 1.5
22
+ * viewport heights from the target, in pixels), so the bound is closed-form.
23
+ * Zooming also moves the eye toward the target, over different ground; the
24
+ * bound is re-taken on every frame (and every gesture state), so it settles.
25
+ */
26
+ export declare function maxZoomForClearance(view: EyeView & {
27
+ width: number;
28
+ height: number;
29
+ }, groundAt: (lngLat: [number, number]) => number | null, exaggeration: number, clearance: number): number | null;
@@ -1,4 +1,4 @@
1
- import { as as _ } from "./index-IDWDfgTC.js";
1
+ import { aB as _ } from "./index-BfHaNHyY.js";
2
2
  const c = `function Ie(t) {
3
3
  t("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"), t("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"), t("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
4
4
  for (var i = 1; i <= 60; ++i)
@@ -6869,7 +6869,7 @@ async function E(e, t, n, i) {
6869
6869
  });
6870
6870
  }
6871
6871
  async function f(e, t, n, i) {
6872
- const { buildPlaneTile: s } = await import("./build-D4iI8O9b.js");
6872
+ const { buildPlaneTile: s } = await import("./build-CUx4yR_O.js");
6873
6873
  return s(e, t, n, (a, r) => i.toPlane([a, r]), (a, r) => i.fromPlane([a, r]));
6874
6874
  }
6875
6875
  export {
package/dist/color.d.ts CHANGED
@@ -7,3 +7,18 @@
7
7
  */
8
8
  export declare function hexToRgb(raw: string): number[] | undefined;
9
9
  export declare function cssColorToRgb(raw: string): number[] | undefined;
10
+ /**
11
+ * Is `raw` a CSS colour? `undefined` when it cannot tell — a named or
12
+ * functional colour outside a browser (the validate CLI runs in Node), where
13
+ * a false "not a colour" would be worse than silence. A `#` value is always
14
+ * decidable.
15
+ */
16
+ export declare function isCssColor(raw: string): boolean | undefined;
17
+ /** 0–255 RGB → "#rrggbb". */
18
+ export declare function rgbToHex(c: readonly number[]): string;
19
+ /**
20
+ * A 0–255 RGB(A) array as a 0–1 RGBA vec4 (alpha 1 when absent), converted
21
+ * once per array — shader extensions read their colours on every draw, per
22
+ * tile, per pass.
23
+ */
24
+ export declare function unitRgba(c: readonly number[]): number[];
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A credit line in the map's attribution slot, as a MapLibre basemap's
3
+ * control would show it: linked text, one entry per provider. The plane
4
+ * basemap and the terrain presets both credit the data they pick
5
+ * (docs/design/underwater-terrain.md, Phase A).
6
+ */
7
+ export interface CreditEntry {
8
+ text: string;
9
+ href: string;
10
+ }
11
+ export declare function creditElement(entries: readonly CreditEntry[]): HTMLElement;
@@ -1,5 +1,5 @@
1
1
  import { HTMLElementBase } from "../env";
2
- import { RuntimeCore } from "../runtime-core";
2
+ import { RuntimeCore, type Camera } from "../runtime-core";
3
3
  import { type RuntimeContext } from "../ctx";
4
4
  import { type LightingIR } from "../scene-lighting";
5
5
  import { type ClipBoxIR } from "../clip-box";
@@ -37,6 +37,8 @@ export declare class OmMapElement extends HTMLElementBase {
37
37
  private contextmenuHandler?;
38
38
  private mount;
39
39
  private reconcilePending;
40
+ /** The `<om-terrain>` markup the terrain was last resolved from (reconcileTerrainSources). */
41
+ private terrainSourceSignature;
40
42
  /** Last seen `<om-effect>` markup, so the `effects` watch token fires on real changes only. */
41
43
  private effectSignature;
42
44
  private readonly dataOwner;
@@ -232,6 +234,24 @@ export declare class OmMapElement extends HTMLElementBase {
232
234
  duration?: number;
233
235
  curve?: boolean;
234
236
  }): void;
237
+ /**
238
+ * The camera now, with where its eye is: `altitude` (the eye against sea
239
+ * level), `targetElevation` (the ground under the view centre) and
240
+ * `clearance` (the eye above the ground beneath it), in true metres —
241
+ * cheap enough to read every animation frame for a depth gauge.
242
+ * `undefined` before the map has mounted.
243
+ */
244
+ getCamera(): Camera | undefined;
245
+ /**
246
+ * Read the terrain's own tiles for what markup cannot tell
247
+ * (docs/design/underwater-terrain.md, Phase I): a step where two
248
+ * `<om-terrain>` sources meet (a consistent one gets a `vertical-offset`
249
+ * to set) and heights no real ground has, repeated (a `nodata` to set).
250
+ * Fetches tiles, so it is opt-in; returns warnings, never errors — the map
251
+ * draws either way. `onlymapjs inspect-terrain <page.html>` runs it
252
+ * headless.
253
+ */
254
+ inspectTerrain(): Promise<ValidationEntry[]>;
235
255
  setLayerVisible(id: string, visible: boolean): void;
236
256
  /** A snapshot of the current layer IRs — the same shape `ctx.layers` is built from. */
237
257
  getLayers(): readonly LayerIR[];
@@ -359,6 +379,12 @@ export declare class OmMapElement extends HTMLElementBase {
359
379
  /** Current camera state (story initial-state capture) — internal-suffix API. */
360
380
  /** Push `max-pitch` to the runtime; absent or unparseable restores the default. */
361
381
  private applyMaxPitch;
382
+ /** Push `camera-target` to the runtime; absent or unknown is "sea-level" (validation reports the unknown). */
383
+ private applyCameraTarget;
384
+ /** Push `camera-clearance` (true metres) to the runtime; absent, empty or not a non-negative number is no floor (validation reports the last). */
385
+ private applyCameraClearance;
386
+ /** Push `sea-surface` (a CSS colour) to the runtime; absent or not a colour is no surface (validation reports the latter). */
387
+ private applySeaSurface;
362
388
  /** Push `min-zoom` to the runtime; absent or unparseable restores the default. */
363
389
  private applyMinZoom;
364
390
  getViewStateInternal(): {
@@ -499,6 +525,14 @@ export declare class OmMapElement extends HTMLElementBase {
499
525
  * changed.
500
526
  */
501
527
  private reconcileEffects;
528
+ /**
529
+ * `<om-terrain>` children are terrain sources (terrain="a, b"): an edit to
530
+ * one — or one added or removed — re-resolves the map's terrain. Compared
531
+ * by markup, so a reconcile for anything else costs a string join.
532
+ */
533
+ private reconcileTerrainSources;
534
+ /** The markup of this map's direct `<tag>` children — a change signature: equal strings, nothing to re-resolve. */
535
+ private childMarkup;
502
536
  private reconcile;
503
537
  /**
504
538
  * Re-runs on every reconcile when the `validate` attribute is present —
@@ -548,6 +582,12 @@ declare global {
548
582
  zoom: number;
549
583
  pitch: number;
550
584
  bearing: number;
585
+ /** The eye against sea level, true metres (null on a projected map) — see getCamera(). */
586
+ altitude: number | null;
587
+ /** The ground under the view centre, true metres — null without terrain, or until that DEM tile is held (a settle reads held tiles only). */
588
+ targetElevation: number | null;
589
+ /** The eye above the ground beneath it, true metres — null as targetElevation. */
590
+ clearance: number | null;
551
591
  /** "user" if any change in the settled burst came from a canvas gesture; "programmatic" for pure API/action/story moves. */
552
592
  origin: "user" | "programmatic";
553
593
  }>;
package/dist/geodesy.d.ts CHANGED
@@ -14,6 +14,8 @@
14
14
  */
15
15
  /** WGS84 mean radius (2a + b)/3, with a = 6378137 m, 1/f = 298.257223563. */
16
16
  export declare const WGS84_MEAN_RADIUS_M = 6371008.7714;
17
+ /** Equatorial circumference (m) — the Web Mercator scale numerator. Here, not in hillshade-shader.ts, so eager code (terrain-skirt.ts) can use it without pulling the lazy hillshade chunk into every map. */
18
+ export declare const EARTH_CIRCUMFERENCE = 40075016.686;
17
19
  /** The sphere radius (m) current measurements resolve against. */
18
20
  export declare function getMeasureRadiusMeters(): number;
19
21
  /** Override the measure radius (e.g. a non-Earth body). Non-positive values reset to WGS84. */
@@ -1,4 +1,4 @@
1
- import { ae as i, af as m, ag as p } from "./index-IDWDfgTC.js";
1
+ import { an as i, ao as m, ap as p } from "./index-BfHaNHyY.js";
2
2
  function y(e) {
3
3
  if (e == null) return !0;
4
4
  const t = e, o = t.id?.code;
@@ -8,10 +8,10 @@ function g(e, t, o) {
8
8
  const r = t.primary_column;
9
9
  if (!r)
10
10
  throw new Error(`data="${o}": GeoParquet "geo" metadata names no primary_column — can't tell which column is geometry.`);
11
- const a = t.columns?.[r]?.crs, n = f(e, r, o);
11
+ const a = t.columns?.[r]?.crs, n = d(e, r, o);
12
12
  return y(a) || i(n, a), n;
13
13
  }
14
- function f(e, t, o) {
14
+ function d(e, t, o) {
15
15
  if (e.length === 0)
16
16
  return console.warn(`[onlymapjs] data="${o}": GeoParquet has no rows — empty layer.`), [];
17
17
  const r = e.map((n) => n[t]);
@@ -1,4 +1,4 @@
1
- import { d as L, j as x, am as A, an as E, ao as d, ap as h, aq as u, ar as z, p as V, W as Z, G as D } from "./index-IDWDfgTC.js";
1
+ import { d as L, j as x, av as A, aw as E, ax as d, ay as h, az as u, aA as z, p as V, W as Z, G as D } from "./index-BfHaNHyY.js";
2
2
  const c = Math.PI / 180, G = 180 / Math.PI;
3
3
  function w(l, t = 0) {
4
4
  const a = Math.min(180, l) * c;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * deck's MapController, for a camera over a terrain
3
+ * (docs/design/underwater-terrain.md, Phase C).
4
+ *
5
+ * 1. Gestures grab the GROUND PLANE. deck's MapState unprojects the pointer
6
+ * onto z = 0 and pans in that plane. With the frame lifted to the ground
7
+ * (`camera-target="terrain"`) the eye can sit below z = 0 — over a
8
+ * seabed — where the pointer's ray meets that plane behind the camera: a
9
+ * drag moved the map hundreds of metres the wrong way. Here pan and wheel
10
+ * zoom unproject onto the lift's own height and move with deck's
11
+ * `panByPosition3D`, as its TerrainController does for rotation.
12
+ * 2. A floor for the eye (`camera-clearance`): `applyConstraints` — which
13
+ * deck runs on every gesture state and every transition frame — caps the
14
+ * zoom at the eye's clearance above the ground beneath it.
15
+ *
16
+ * deck does not export MapState; MapController installs it as
17
+ * `ControllerState`, so this wraps whatever class that is.
18
+ *
19
+ * Every standalone Web Mercator map uses this controller, whatever its
20
+ * attributes: deck re-creates a view's controller when its TYPE changes and
21
+ * never finalizes the old one (view-manager.js `_updateController`), so a
22
+ * live switch MapController ↔ GroundController left the old one handling
23
+ * every gesture too. With no lift and no clearance it is deck's MapState.
24
+ */
25
+ import { MapController } from "@deck.gl/core";
26
+ /** What the controller reads from the runtime, live (one object per runtime, read through getters). */
27
+ export interface GroundFollow {
28
+ /** The ground under a point, true metres, or null until its tile has loaded. */
29
+ groundAt(lngLat: [number, number]): number | null;
30
+ exaggeration: number;
31
+ /** The eye's floor above the ground under it, true metres; null for none. */
32
+ clearance: number | null;
33
+ }
34
+ export declare class GroundController extends MapController {
35
+ constructor(...args: ConstructorParameters<typeof MapController>);
36
+ setProps(props: Parameters<MapController["setProps"]>[0] & {
37
+ groundFollow?: GroundFollow;
38
+ }): void;
39
+ }
@@ -1,50 +1,47 @@
1
- import { c as w, a3 as F, a4 as M, a5 as B, a6 as H, a7 as $, a8 as x, a9 as E, aa as _, ab as D, ac as O } from "./index-IDWDfgTC.js";
1
+ import { c as w, ab as F, ac as M, ad as B, ae as H, af as $, ag as b, ah as E, ai as _, aj as S, ak as D, aa as O } from "./index-BfHaNHyY.js";
2
2
  import { N as P, c as C } from "./hillshade-apron-Bem3DWyJ.js";
3
- import { p as N, h as R, m as Z, a as U } from "./hillshade-shader-DI2uLSNU.js";
4
- const A = 64, g = /* @__PURE__ */ new Map();
5
- function S(t) {
6
- const e = g.get(t);
3
+ import { p as N, h as R, m as Z, a as U } from "./hillshade-shader-BWA0USDQ.js";
4
+ const A = 64, f = /* @__PURE__ */ new Map();
5
+ function L(t) {
6
+ const e = f.get(t);
7
7
  if (e) return e;
8
8
  const a = D(t);
9
- if (g.set(t, a), g.size > A) {
10
- const r = g.keys().next().value;
11
- r !== void 0 && g.delete(r);
9
+ if (f.set(t, a), f.size > A) {
10
+ const r = f.keys().next().value;
11
+ r !== void 0 && f.delete(r);
12
12
  }
13
13
  return a;
14
14
  }
15
- function z(t, e, a, r) {
16
- return t.replace("{z}", String(r)).replace("{x}", String(e)).replace("{y}", String(a));
17
- }
18
- async function I(t, e, a) {
19
- const r = await S(z(t, a.x, a.y, a.z));
15
+ async function j(t, e, a) {
16
+ const r = await L(S(t, a.x, a.y, a.z));
20
17
  if (!r) return null;
21
- const c = (i) => ({
22
- width: i.width,
23
- height: i.height,
24
- at: (u, s) => {
25
- const h = (s * i.width + u) * 4;
26
- return O(e, i.data[h], i.data[h + 1], i.data[h + 2]);
18
+ const u = (n) => ({
19
+ width: n.width,
20
+ height: n.height,
21
+ at: (d, s) => {
22
+ const h = (s * n.width + d) * 4;
23
+ return O(e, n.data[h], n.data[h + 1], n.data[h + 2]);
27
24
  }
28
- }), d = 2 ** a.z, p = /* @__PURE__ */ new Map();
25
+ }), c = 2 ** a.z, p = /* @__PURE__ */ new Map();
29
26
  return await Promise.all(
30
- P.map(async ({ dx: i, dy: u }) => {
31
- const s = a.y + u;
32
- if (s < 0 || s >= d) return;
33
- const h = ((a.x + i) % d + d) % d;
34
- p.set(`${i},${u}`, await S(z(t, h, s, a.z)));
27
+ P.map(async ({ dx: n, dy: d }) => {
28
+ const s = a.y + d;
29
+ if (s < 0 || s >= c) return;
30
+ const h = ((a.x + n) % c + c) % c;
31
+ p.set(`${n},${d}`, await L(S(t, h, s, a.z)));
35
32
  })
36
- ), C(c(r), (i, u) => {
37
- const s = p.get(`${i},${u}`);
38
- return s ? c(s) : null;
33
+ ), C(u(r), (n, d) => {
34
+ const s = p.get(`${n},${d}`);
35
+ return s ? u(s) : null;
39
36
  });
40
37
  }
41
- const j = {
38
+ const I = {
42
39
  blendColorSrcFactor: "dst",
43
40
  blendColorDstFactor: "zero",
44
41
  blendAlphaSrcFactor: "zero",
45
42
  blendAlphaDstFactor: "one"
46
43
  };
47
- class L extends _ {
44
+ class z extends _ {
48
45
  static layerName = "HillshadeBitmapLayer";
49
46
  getShaders() {
50
47
  const e = super.getShaders();
@@ -52,21 +49,21 @@ class L extends _ {
52
49
  }
53
50
  draw(e) {
54
51
  const a = this.props, r = { ...a.hillshadeUniforms, hillshadeHeights: a.image };
55
- for (const c of this.getModels()) c.shaderInputs.setProps({ hillshade: r });
52
+ for (const u of this.getModels()) u.shaderInputs.setProps({ hillshade: r });
56
53
  super.draw(e);
57
54
  }
58
55
  }
59
- class W extends L {
56
+ class k extends z {
60
57
  static layerName = "WarpedHillshadeBitmapLayer";
61
58
  _createMesh() {
62
59
  const e = this.props, a = e._planeFrame, r = e._planeBounds;
63
60
  return !a || !r ? super._createMesh() : E(r, a, e._subdivision ?? 1);
64
61
  }
65
62
  }
66
- function k(t, e) {
63
+ function W(t, e) {
67
64
  if (!t) return e;
68
65
  if (typeof t != "string") return t;
69
- if (t in x) return x[t];
66
+ if (t in b) return b[t];
70
67
  try {
71
68
  const a = JSON.parse(t);
72
69
  if ([a?.rScaler, a?.gScaler, a?.bScaler, a?.offset].every((r) => typeof r == "number" && Number.isFinite(r))) return a;
@@ -78,9 +75,9 @@ function J(t) {
78
75
  const e = $(t.src);
79
76
  return e ? e.requiresKey ? (console.warn(`[onlymapjs] HillshadeLayer: src="${t.src}" needs a ${e.requiresKey} key, which this layer does not plumb — use a keyless source such as "terrarium".`), null) : {
80
77
  template: e.elevationData,
81
- decoder: typeof e.decoder == "string" ? x[e.decoder] : e.decoder,
78
+ decoder: typeof e.decoder == "string" ? b[e.decoder] : e.decoder,
82
79
  maxZoom: t.maxZoom ?? e.maxZoom
83
- } : !t.src || !t.src.includes("{z}") ? (console.warn(`[onlymapjs] HillshadeLayer: src="${t.src}" is neither a registered terrain preset nor a {z}/{x}/{y} DEM URL template.`), null) : { template: t.src, decoder: k(t.decoder, x.terrarium), maxZoom: t.maxZoom ?? 14 };
80
+ } : !t.src || !t.src.includes("{z}") ? (console.warn(`[onlymapjs] HillshadeLayer: src="${t.src}" is neither a registered terrain preset nor a {z}/{x}/{y} DEM URL template.`), null) : { template: t.src, decoder: W(t.decoder, b.terrarium), maxZoom: t.maxZoom ?? 14 };
84
81
  }
85
82
  function q(t, e) {
86
83
  return !Number.isFinite(t) || !Number.isFinite(e) || e <= 0 ? 0 : Math.max(0, Math.round(Math.log2(Math.max(1, t / e))));
@@ -113,7 +110,7 @@ class Y extends w {
113
110
  renderLayers() {
114
111
  const e = J(this.props);
115
112
  if (!e) return null;
116
- const { azimuths: a, weights: r } = N(this.props.sunAzimuth, this.props.sunWeight), c = this.props.blend === "multiply", d = this.context.device, p = d?.canvasContext?.cssToDeviceRatio?.() ?? 1, i = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, u = this.state.textures, s = this.props._planeFrame ?? null, h = Math.max(1, p / i), v = this.props.sunDatum === "geographic";
113
+ const { azimuths: a, weights: r } = N(this.props.sunAzimuth, this.props.sunWeight), u = this.props.blend === "multiply", c = this.context.device, p = c?.canvasContext?.cssToDeviceRatio?.() ?? 1, n = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, d = this.state.textures, s = this.props._planeFrame ?? null, h = Math.max(1, p / n), v = this.props.sunDatum === "geographic";
117
114
  return new M(
118
115
  this.getSubLayerProps({ id: "tiles" }),
119
116
  {
@@ -129,7 +126,7 @@ class Y extends w {
129
126
  // PYRAMID's zoom range is a different number entirely, and the plane
130
127
  // tileset applies it to the geographic zoom it derives.
131
128
  ...s ? { TilesetClass: this.planeTileset(s), minZoom: -1 / 0 } : {},
132
- zoomOffset: (this.props.zoomOffset ?? 0) + q(p, i),
129
+ zoomOffset: (this.props.zoomOffset ?? 0) + q(p, n),
133
130
  // deck compares FUNCTION props by their update triggers, never by
134
131
  // identity — inline closures would otherwise invalidate everything on
135
132
  // every render. So anything a closure captures is invisible to deck
@@ -145,52 +142,52 @@ class Y extends w {
145
142
  getTileData: [e.template, JSON.stringify(e.decoder)],
146
143
  // The plane itself, not its code: every tile's mesh is warped for
147
144
  // one plane, and a live switch must rebuild them (plane-tileset.ts).
148
- renderSubLayers: [a.join(","), r.join(","), this.props.sunElevation, this.props.zFactor, c, v, s]
145
+ renderSubLayers: [a.join(","), r.join(","), this.props.sunElevation, this.props.zFactor, u, v, s]
149
146
  },
150
147
  getTileData: async (o) => {
151
- const n = await I(e.template, e.decoder, o.index);
152
- if (!n || !d) return null;
148
+ const i = await j(e.template, e.decoder, o.index);
149
+ if (!i || !c) return null;
153
150
  const l = `${o.index.z}/${o.index.x}/${o.index.y}`;
154
- u.get(l)?.destroy();
155
- const m = d.createTexture({
156
- data: n.data,
151
+ d.get(l)?.destroy();
152
+ const m = c.createTexture({
153
+ data: i.data,
157
154
  format: "r32float",
158
- width: n.width + 2,
159
- height: n.height + 2,
155
+ width: i.width + 2,
156
+ height: i.height + 2,
160
157
  // NEAREST, because linear filtering of a float texture needs
161
158
  // OES_texture_float_linear, which is not universal (the same
162
159
  // constraint raster-pipeline.ts documents).
163
160
  sampler: { minFilter: "nearest", magFilter: "nearest", addressModeU: "clamp-to-edge", addressModeV: "clamp-to-edge" }
164
161
  });
165
- return u.set(l, m), { texture: m, width: n.width, height: n.height, key: l };
162
+ return d.set(l, m), { texture: m, width: i.width, height: i.height, key: l };
166
163
  },
167
164
  onTileUnload: (o) => {
168
- const n = `${o.index.z}/${o.index.x}/${o.index.y}`;
169
- u.get(n)?.destroy(), u.delete(n);
165
+ const i = `${o.index.z}/${o.index.x}/${o.index.y}`;
166
+ d.get(i)?.destroy(), d.delete(i);
170
167
  },
171
168
  renderSubLayers: (o) => {
172
- const n = o.data;
173
- if (!n) return null;
174
- const l = o.tile, [[m, f], [b, y]] = s && l.lngLatBbox ? [[l.lngLatBbox.west, l.lngLatBbox.south], [l.lngLatBbox.east, l.lngLatBbox.north]] : l.boundingBox, T = s ? W : L;
169
+ const i = o.data;
170
+ if (!i) return null;
171
+ const l = o.tile, [[m, g], [x, y]] = s && l.lngLatBbox ? [[l.lngLatBbox.west, l.lngLatBbox.south], [l.lngLatBbox.east, l.lngLatBbox.north]] : l.boundingBox, T = s ? k : z;
175
172
  return new T(o, {
176
173
  id: `${o.id}-bitmap`,
177
174
  data: void 0,
178
- image: n.texture,
179
- bounds: [m, f, b, y],
175
+ image: i.texture,
176
+ bounds: [m, g, x, y],
180
177
  _planeFrame: s,
181
- _planeBounds: s ? { west: m, south: f, east: b, north: y } : void 0,
178
+ _planeBounds: s ? { west: m, south: g, east: x, north: y } : void 0,
182
179
  _subdivision: s ? H(l.index.z, h) : 1,
183
- multiply: c,
184
- parameters: c ? j : {},
180
+ multiply: u,
181
+ parameters: u ? I : {},
185
182
  hillshadeUniforms: R({
186
- width: n.width,
187
- height: n.height,
188
- azimuthOffset: s && !v ? B(s, [(m + b) / 2, (y + f) / 2]) : 0,
183
+ width: i.width,
184
+ height: i.height,
185
+ azimuthOffset: s && !v ? B(s, [(m + x) / 2, (y + g) / 2]) : 0,
189
186
  // Web Mercator: one scale for both axes, stated at the equator
190
187
  // and given its cos-phi falloff per fragment by the shader.
191
- ...Z(l.index.z, n.width, n.height),
188
+ ...Z(l.index.z, i.width, i.height),
192
189
  north: y,
193
- south: f,
190
+ south: g,
194
191
  azimuths: a,
195
192
  weights: r,
196
193
  sunElevation: this.props.sunElevation ?? 45,
@@ -198,7 +195,7 @@ class Y extends w {
198
195
  // This layer's texture IS the heightfield, so there is no
199
196
  // sampled colour to multiply into — a multiply-blended tile emits
200
197
  // the shade and lets the GL blend put it in the framebuffer.
201
- composite: c ? "framebuffer" : !1
198
+ composite: u ? "framebuffer" : !1
202
199
  })
203
200
  });
204
201
  }
@@ -215,7 +212,7 @@ class Y extends w {
215
212
  }
216
213
  export {
217
214
  Y as OmHillshadeLayer,
218
- I as buildPaddedHeights,
215
+ j as buildPaddedHeights,
219
216
  q as captureZoomOffset,
220
217
  J as resolveHillshadeSource
221
218
  };
@@ -1,5 +1,6 @@
1
- const d = 40075016686e-3, u = 110574, m = 111320, o = Math.PI / 180, f = { none: 0, mercator: 1, geographic: 2 };
2
- function p(e, a, s = "HillshadeLayer") {
1
+ import { al as d } from "./index-BfHaNHyY.js";
2
+ const u = 110574, m = 111320, o = Math.PI / 180, f = { none: 0, mercator: 1, geographic: 2 };
3
+ function E(e, a, s = "HillshadeLayer") {
3
4
  const h = (l) => l == null || l === "" ? [] : typeof l == "number" ? Number.isFinite(l) ? [l] : [] : String(l).split(/[\s,]+/).filter(Boolean).map(Number).filter((r) => Number.isFinite(r));
4
5
  let t = h(e);
5
6
  t.length === 0 && (t = [315]), t.length > 4 && (console.warn(`[onlymapjs] ${s}: sun-azimuth takes at most 4 azimuths — using the first 4 of ${t.length}.`), t = t.slice(0, 4));
@@ -90,7 +91,7 @@ float hillshade_light(vec3 normal, float azimuth, float elevation) {
90
91
  color = vec4(vec3(shade) * layer.opacity, layer.opacity);
91
92
  }
92
93
  `
93
- ), E = {
94
+ ), y = {
94
95
  name: "hillshade",
95
96
  fs: g,
96
97
  inject: {
@@ -120,11 +121,11 @@ function c(e, a) {
120
121
  function x(e) {
121
122
  return Math.log(Math.tan(Math.PI / 4 + Math.max(-85.0511, Math.min(85.0511, e)) * o / 2));
122
123
  }
123
- function y(e, a, s) {
124
+ function T(e, a, s) {
124
125
  const h = d / 2 ** e;
125
126
  return { metresPerTexel: [h / a, h / s], latMode: "mercator" };
126
127
  }
127
- function T(e) {
128
+ function w(e) {
128
129
  const { unitsPerPixelX: a, unitsPerPixelY: s, crsUnits: h } = e;
129
130
  if (h === "degree")
130
131
  return {
@@ -134,7 +135,7 @@ function T(e) {
134
135
  const t = h === "foot" ? 0.3048 : 1;
135
136
  return { metresPerTexel: [a * t, s * t], latMode: "none" };
136
137
  }
137
- function w(e) {
138
+ function M(e) {
138
139
  const a = e.width + 2, s = e.height + 2, h = (t) => e.latMode === "mercator" ? x(t) : t * o;
139
140
  return {
140
141
  azimuths: c(
@@ -157,9 +158,9 @@ function w(e) {
157
158
  };
158
159
  }
159
160
  export {
160
- E as a,
161
- w as h,
162
- y as m,
163
- p,
164
- T as r
161
+ y as a,
162
+ M as h,
163
+ T as m,
164
+ E as p,
165
+ w as r
165
166
  };
@@ -22,8 +22,8 @@
22
22
  * layer's own source, so reaching for BitmapLayer's `bitmapTexture` there
23
23
  * gives "undeclared identifier" on every tap.
24
24
  */
25
- /** Equatorial circumference (m) — the Web Mercator scale numerator. */
26
- export declare const EARTH_CIRCUMFERENCE = 40075016.686;
25
+ import { EARTH_CIRCUMFERENCE } from "./geodesy";
26
+ export { EARTH_CIRCUMFERENCE };
27
27
  /** Metres per degree of latitude (mean). Latitude degrees barely vary; longitude degrees do, which is the whole point of `latMode`. */
28
28
  export declare const METRES_PER_DEGREE_LAT = 110574;
29
29
  /** Metres per degree of longitude AT THE EQUATOR — scaled by cos(latitude) per fragment. */