@nika-js/onlymap 0.9.1 → 0.10.0

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 (79) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +26 -2
  3. package/dist/{basemap-DL0mk9Bf.js → basemap-9lXclX9H.js} +3882 -3980
  4. package/dist/cartograph/elements/om-frame.d.ts +67 -1
  5. package/dist/cartograph/georef.d.ts +18 -4
  6. package/dist/cartograph/schema.d.ts +11 -0
  7. package/dist/cartograph.js +1480 -1311
  8. package/dist/cartograph.standalone.js +1808 -1615
  9. package/dist/{cityjson-D_V5GY8b.js → cityjson-k-z1r6c0.js} +1 -1
  10. package/dist/{crs-DsDQ4Q4i.js → crs-BzE_KP4M.js} +25 -2
  11. package/dist/{crs-Ciu7Xs7a.js → crs-ChglCB3O.js} +39 -16
  12. package/dist/elements/om-map.d.ts +10 -0
  13. package/dist/{geoparquet-DJxZA0if.js → geoparquet-DFDZDBun.js} +10 -10
  14. package/dist/globe-view-D9wjfL0T.js +104 -0
  15. package/dist/hillshade-C2BQr6pd.js +298 -0
  16. package/dist/{hillshade-shader-n_zManfZ.js → hillshade-shader-DI2uLSNU.js} +15 -10
  17. package/dist/hillshade-shader.d.ts +18 -2
  18. package/dist/hillshade.d.ts +30 -0
  19. package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
  20. package/dist/{index-CvuDsvnk.js → index-4Tvlt0iO.js} +47 -47
  21. package/dist/{index-BjcPjICh.js → index-Bn66l3KG.js} +59 -59
  22. package/dist/index-BuXrMq5D.js +322 -0
  23. package/dist/index-CNRbZHkK.js +459 -0
  24. package/dist/{index-DdTZSuAb.js → index-CkovmN47.js} +106 -106
  25. package/dist/index-CmuOizAF.js +641 -0
  26. package/dist/index-CvT5QHBS.js +65 -0
  27. package/dist/{index-vLXZuog4.js → index-DnVHKI61.js} +1 -1
  28. package/dist/{index-oY3XHIux.js → index-JjyDEqAS.js} +18178 -16943
  29. package/dist/index.d.ts +4 -0
  30. package/dist/layer-registry.d.ts +27 -0
  31. package/dist/{lerc-Bph62dCb.js → lerc-C1mQ_Kqq.js} +1 -1
  32. package/dist/onlymap.standalone.js +48211 -45574
  33. package/dist/onlymapjs.js +77 -74
  34. package/dist/parse-manifest.d.ts +6 -0
  35. package/dist/plane-camera.d.ts +59 -0
  36. package/dist/plane-layers.d.ts +56 -0
  37. package/dist/plane-tiles.d.ts +99 -0
  38. package/dist/plane-tileset.d.ts +31 -0
  39. package/dist/plane-warp.d.ts +91 -0
  40. package/dist/post-process-effect-DfslKPM6.js +197 -0
  41. package/dist/programmatic.d.ts +16 -1
  42. package/dist/projection.d.ts +118 -0
  43. package/dist/{raster-D-eTzCE3.js → raster-D2NzdjZE.js} +4 -4
  44. package/dist/{raster-pipeline-BlOnMPJe.js → raster-pipeline-qnD1icOv.js} +4 -3
  45. package/dist/runtime-core.d.ts +140 -1
  46. package/dist/serialize/clip.d.ts +50 -0
  47. package/dist/serialize/declutter.d.ts +44 -0
  48. package/dist/serialize/emit.d.ts +60 -0
  49. package/dist/serialize/index.d.ts +64 -0
  50. package/dist/serialize/strategy.d.ts +30 -0
  51. package/dist/serialize/style.d.ts +77 -0
  52. package/dist/snapshot.d.ts +46 -0
  53. package/dist/surface-anchor.d.ts +6 -0
  54. package/dist/text-on-path-Dm7vtNqt.js +146 -0
  55. package/dist/text-on-path.d.ts +157 -0
  56. package/dist/transform/buffer.d.ts +63 -0
  57. package/dist/transform/contour.d.ts +37 -0
  58. package/dist/transform/dot-density.d.ts +19 -0
  59. package/dist/transform/field.d.ts +80 -0
  60. package/dist/transform/geometry.d.ts +20 -0
  61. package/dist/transform/index.d.ts +29 -0
  62. package/dist/transform/simplify.d.ts +10 -0
  63. package/dist/transform/smooth.d.ts +12 -0
  64. package/dist/transform-stage.d.ts +92 -0
  65. package/dist/version.d.ts +1 -1
  66. package/dist/{zarr-BGDoEtFb.js → zarr-D5e5agMG.js} +2 -2
  67. package/docs/cartograph.md +12 -4
  68. package/docs/cartography.md +328 -0
  69. package/docs/design/arrows.md +182 -0
  70. package/docs/design/carto-substrate.md +1055 -0
  71. package/docs/design/extensions.md +250 -0
  72. package/llms.txt +2 -1
  73. package/onlymapjs.attributes.json +18 -0
  74. package/onlymapjs.html-data.json +169 -19
  75. package/package.json +1 -1
  76. package/skills/onlymapjs/SKILL.md +6 -2
  77. package/skills/onlymapjs/references/syntax.md +22 -2
  78. package/dist/hillshade-DR3TxO1a.js +0 -186
  79. package/dist/index-DO_w0tqR.js +0 -514
@@ -0,0 +1,197 @@
1
+ import { av as m, aw as h, ax as P, ay as S, az as C } from "./index-JjyDEqAS.js";
2
+ const x = (
3
+ /* wgsl */
4
+ `struct VertexInputs {
5
+ @location(0) clipSpacePositions: vec2<f32>,
6
+ @location(1) texCoords: vec2<f32>,
7
+ @location(2) coordinates: vec2<f32>
8
+ }
9
+
10
+ struct FragmentInputs {
11
+ @builtin(position) Position : vec4<f32>,
12
+ @location(0) position : vec2<f32>,
13
+ @location(1) coordinate : vec2<f32>,
14
+ @location(2) uv : vec2<f32>
15
+ };
16
+
17
+ @vertex
18
+ fn vertexMain(inputs: VertexInputs) -> FragmentInputs {
19
+ var outputs: FragmentInputs;
20
+ outputs.Position = vec4(inputs.clipSpacePositions, 0., 1.);
21
+ outputs.position = inputs.clipSpacePositions;
22
+ outputs.coordinate = inputs.coordinates;
23
+ outputs.uv = inputs.texCoords;
24
+ return outputs;
25
+ }
26
+ `
27
+ ), g = (
28
+ /* glsl */
29
+ `#version 300 es
30
+ in vec2 clipSpacePositions;
31
+ in vec2 texCoords;
32
+ in vec2 coordinates;
33
+
34
+ out vec2 position;
35
+ out vec2 coordinate;
36
+ out vec2 uv;
37
+
38
+ void main(void) {
39
+ gl_Position = vec4(clipSpacePositions, 0., 1.);
40
+ position = clipSpacePositions;
41
+ coordinate = coordinates;
42
+ uv = texCoords;
43
+ }
44
+ `
45
+ ), u = [-1, -1, 1, -1, -1, 1, 1, 1];
46
+ class E extends m {
47
+ constructor(e, t) {
48
+ const r = u.map((s) => s === -1 ? 0 : s);
49
+ t.source && (t = { ...t, source: `${x}
50
+ ${t.source}` }), super(e, {
51
+ id: t.id || P("clip-space"),
52
+ ...t,
53
+ vs: g,
54
+ vertexCount: 4,
55
+ geometry: new h({
56
+ topology: "triangle-strip",
57
+ vertexCount: 4,
58
+ attributes: {
59
+ clipSpacePositions: { size: 2, value: new Float32Array(u) },
60
+ texCoords: { size: 2, value: new Float32Array(r) },
61
+ coordinates: { size: 2, value: new Float32Array(r) }
62
+ }
63
+ })
64
+ });
65
+ }
66
+ }
67
+ const _ = `layout(std140) uniform screenUniforms {
68
+ vec2 texSize;
69
+ } screen;
70
+ `, F = {
71
+ name: "screen",
72
+ fs: _,
73
+ uniformTypes: {
74
+ texSize: "vec2<f32>"
75
+ }
76
+ };
77
+ class A extends S {
78
+ constructor(e, t) {
79
+ super(e, t);
80
+ const { module: r, fs: s, id: i } = t, o = {
81
+ depthWriteEnabled: !1,
82
+ depthCompare: "always",
83
+ depthBias: 0,
84
+ blend: !0,
85
+ blendColorSrcFactor: "one",
86
+ blendColorDstFactor: "one-minus-src-alpha",
87
+ blendAlphaSrcFactor: "one",
88
+ blendAlphaDstFactor: "one-minus-src-alpha",
89
+ blendColorOperation: "add",
90
+ blendAlphaOperation: "add"
91
+ };
92
+ this.model = new E(e, { id: i, fs: s, modules: [r, F], parameters: o });
93
+ }
94
+ render(e) {
95
+ this._renderPass(this.device, e);
96
+ }
97
+ delete() {
98
+ this.model.destroy(), this.model = null;
99
+ }
100
+ // Private methods
101
+ /**
102
+ * Renders the pass.
103
+ * This is an abstract method that should be overridden.
104
+ * @param inputBuffer - Frame buffer that contains the result of the previous pass
105
+ * @param outputBuffer - Frame buffer that serves as the output render target
106
+ */
107
+ _renderPass(e, t) {
108
+ const { clearCanvas: r, inputBuffer: s, outputBuffer: i } = t, o = [s.width, s.height], c = {
109
+ texSrc: s.colorAttachments[0],
110
+ texSize: o
111
+ };
112
+ this.model.shaderInputs.setProps({
113
+ screen: c,
114
+ ...t.moduleProps
115
+ });
116
+ const a = this.device.beginRenderPass({
117
+ framebuffer: i,
118
+ parameters: { viewport: [0, 0, ...o] },
119
+ clearColor: r ? [0, 0, 0, 0] : !1,
120
+ clearDepth: 1,
121
+ clearStencil: !1
122
+ });
123
+ this.model.draw(a), a.end();
124
+ }
125
+ }
126
+ class R {
127
+ constructor(e, t) {
128
+ this.id = `${e.name}-pass`, this.props = t, C(e), this.module = e;
129
+ }
130
+ setup({ device: e }) {
131
+ this.passes = T(e, this.module, this.id);
132
+ }
133
+ setProps(e) {
134
+ this.props = e;
135
+ }
136
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
137
+ preRender() {
138
+ }
139
+ postRender(e) {
140
+ const t = this.passes, { target: r } = e;
141
+ let s = e.inputBuffer, i = e.swapBuffer;
142
+ for (let o = 0; o < t.length; o++) {
143
+ const c = o === t.length - 1, a = r !== void 0 && c;
144
+ a && (i = r);
145
+ const p = !a || !!e.clearCanvas, l = {}, f = this.module.passes[o].uniforms;
146
+ l[this.module.name] = { ...this.props, ...f }, t[o].render({ clearCanvas: p, inputBuffer: s, outputBuffer: i, moduleProps: l });
147
+ const v = i;
148
+ i = s, s = v;
149
+ }
150
+ return s;
151
+ }
152
+ cleanup() {
153
+ if (this.passes) {
154
+ for (const e of this.passes)
155
+ e.delete();
156
+ this.passes = void 0;
157
+ }
158
+ }
159
+ }
160
+ function T(n, e, t) {
161
+ return e.passes.map((r, s) => {
162
+ const i = b(e, r), o = `${t}-${s}`;
163
+ return new A(n, { id: o, module: e, fs: i });
164
+ });
165
+ }
166
+ const d = `#version 300 es
167
+ uniform sampler2D texSrc;
168
+
169
+ in vec2 position;
170
+ in vec2 coordinate;
171
+ in vec2 uv;
172
+
173
+ out vec4 fragColor;
174
+ `, w = (n) => `${d}
175
+ void main() {
176
+ fragColor = texture(texSrc, coordinate);
177
+ fragColor = ${n}(fragColor, screen.texSize, coordinate);
178
+ }
179
+ `, y = (n) => `${d}
180
+ void main() {
181
+ fragColor = ${n}(texSrc, screen.texSize, coordinate);
182
+ }
183
+ `;
184
+ function b(n, e) {
185
+ if (e.filter) {
186
+ const t = typeof e.filter == "string" ? e.filter : `${n.name}_filterColor_ext`;
187
+ return w(t);
188
+ }
189
+ if (e.sampler) {
190
+ const t = typeof e.sampler == "string" ? e.sampler : `${n.name}_sampleColor`;
191
+ return y(t);
192
+ }
193
+ return "";
194
+ }
195
+ export {
196
+ R as P
197
+ };
@@ -14,6 +14,7 @@ import type { 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";
17
+ import { type TransformSpec } from "./transform-stage";
17
18
  /**
18
19
  * A layer, declared as a typed value — the programmatic mirror of one
19
20
  * <om-layer> element. First-party callers normally use plain JS accessor
@@ -74,6 +75,12 @@ export interface LayerDescriptor {
74
75
  terrain?: "drape" | "offset" | "off";
75
76
  /** Per-layer zoom visibility (public issue #38) — the `visible-zoom-range` attribute's twin: hidden outside min ≤ zoom < max (minzoom/maxzoom convention). Composes with `visible`. */
76
77
  visibleZoomRange?: [number, number];
78
+ /**
79
+ * Geometry transforms (spec: cartographic substrate, Part B) — the
80
+ * `<om-transform>` children's twin, in order. Millimetre-authored knobs
81
+ * resolve against `MapControllerOptions.referenceScale`.
82
+ */
83
+ transforms?: readonly TransformSpec[];
77
84
  }
78
85
  /** Camera state, both an input (options/setView) and an output (getViewState). */
79
86
  export interface CameraState {
@@ -138,6 +145,12 @@ export interface MapControllerOptions {
138
145
  hasFullMapConversion: boolean;
139
146
  approximatePlacement: boolean;
140
147
  }) => void;
148
+ /**
149
+ * The scale millimetre-authored geometry transforms resolve against — the
150
+ * `reference-scale` attribute's twin. Either spelling: `"1:50000"`, or the
151
+ * ground metres one millimetre of paper stands for (`50`).
152
+ */
153
+ referenceScale?: string | number;
141
154
  /** @internal Stable React-owned hosts that place required chrome in managed slots. */
142
155
  chromeHosts?: MandatedChromeHosts;
143
156
  }
@@ -152,7 +165,7 @@ export interface MapControllerOptions {
152
165
  * still notifies, but it holds no reference count, so a real owner's release
153
166
  * can stop it. `MapController` owns its own transports and does not need this.
154
167
  */
155
- export declare function descriptorToIR(desc: LayerDescriptor, onDataLoaded: () => void, owner?: DataTransportOwner): LayerIR | null;
168
+ export declare function descriptorToIR(desc: LayerDescriptor, onDataLoaded: () => void, owner?: DataTransportOwner, metresPerMm?: number | null): LayerIR | null;
156
169
  /**
157
170
  * Resolve JSON-safe/programmatic descriptors to deterministic snapshots.
158
171
  * URL data is represented as an empty pending layer and is never fetched.
@@ -191,6 +204,8 @@ export declare class MapController {
191
204
  private destroyed;
192
205
  private suspended;
193
206
  private readonly dataOwner;
207
+ /** Ground metres per millimetre of paper — what a millimetre-authored transform resolves against. Null when the caller declared none. */
208
+ private metresPerMm;
194
209
  private firstCommitDone;
195
210
  private readonly stores;
196
211
  /** Origin of the most recent viewport change FRAME — latched through the settle tracker for snapshot reads. */
@@ -0,0 +1,118 @@
1
+ /**
2
+ * One projection function outside the GPU — the shared piece the plane view and
3
+ * the vector serializer both need (docs/design/carto-substrate.md §3).
4
+ *
5
+ * Before this module the capability existed twice, half each:
6
+ * `cartograph/georef.ts` had a `CrsForward` pair with closed-form Mercator and
7
+ * a lazy proj4 fallback but no batch and no origin; `crs.ts` had the bundled
8
+ * EPSG table and an INVERSE-only path built for placing BIM models. Neither
9
+ * could serve a whole layer of coordinates, and neither knew what a plane
10
+ * unit was worth in metres. This is both of them, plus the two things a plane
11
+ * view cannot do without.
12
+ *
13
+ * THE LOCAL ORIGIN IS NOT OPTIONAL. Eastings near 500 000 and northings near
14
+ * 6 000 000 carry ~24 bits of integer part, so an fp32 attribute buffer has
15
+ * roughly decimetre resolution left at those magnitudes — and the GPU sees
16
+ * fp32 whatever the CPU computed. Geometry jitters visibly at high zoom. The
17
+ * plane therefore holds `(x − x₀, y − y₀)`, with the origin fixed for the
18
+ * map's life and recorded so nothing downstream has to rediscover it.
19
+ *
20
+ * THE INTERFACE IS THE CONTRACT, NOT THE LIBRARY. proj4 covers the conic,
21
+ * cylindrical and azimuthal families most sheets need. Anything it does not —
22
+ * an interrupted or artistic projection — registers as a `Projection` from
23
+ * elsewhere without changing a caller, which is how the cartograph's graticule
24
+ * already works.
25
+ *
26
+ * DIRECTION NAMING IS CROSSED AGAINST proj4, DELIBERATELY. Here `forward`
27
+ * means INTO the plane, because that is the direction every caller thinks in.
28
+ * proj4's `converter.forward` goes from its first argument to its second, so
29
+ * the two get swapped at the boundary below. Getting this backwards produces
30
+ * coordinates that look plausible and are wrong, which is why it is stated
31
+ * here as well as at the call site.
32
+ */
33
+ /** A planar coordinate: metres for a projected CRS, degrees for a geographic one. */
34
+ export type PlaneXY = [number, number];
35
+ /** `[lng, lat]`, always in that order. */
36
+ export type LngLatPair = [number, number];
37
+ /**
38
+ * Whether a plane's units are angular or linear — the only distinction ground
39
+ * scale actually turns on. A linear CRS converts with one scalar; a geographic
40
+ * one is ANISOTROPIC, because a degree of longitude shrinks with cos φ while a
41
+ * degree of latitude does not, so its two axes need different treatment.
42
+ */
43
+ export type PlaneUnits = "degree" | "linear";
44
+ export interface Projection {
45
+ /** Normalized code, e.g. `EPSG:5070`. */
46
+ code: string;
47
+ units: PlaneUnits;
48
+ /**
49
+ * Metres per plane unit. For a linear CRS this is exact (1 for metres,
50
+ * 0.3048 for feet). For `"degree"` it is the EQUATORIAL degree — correct for
51
+ * latitude, and correct for longitude only after multiplying by cos φ.
52
+ */
53
+ metresPerUnit: number;
54
+ /** lng/lat → plane. */
55
+ forward(lngLat: LngLatPair): PlaneXY;
56
+ /** plane → lng/lat. */
57
+ inverse(xy: PlaneXY): LngLatPair;
58
+ }
59
+ /** 2πa/360 — one degree of longitude at the equator. */
60
+ export declare const METRES_PER_EQUATORIAL_DEGREE: number;
61
+ export declare function mercatorForward([lng, lat]: LngLatPair): PlaneXY;
62
+ export declare function mercatorInverse([x, y]: PlaneXY): LngLatPair;
63
+ /** Normalize `3857` / `epsg:3857` / `EPSG::3857` to `EPSG:3857`; null when unparseable. */
64
+ export declare function normalizeCrs(raw: string | null | undefined): string | null;
65
+ /** The CRSs served with no proj4 load at all. */
66
+ export declare function builtinProjection(crs: string | null | undefined): Projection | null;
67
+ /**
68
+ * Teach the library a CRS: either a proj4 definition string, or a complete
69
+ * `Projection` for something proj4 cannot express.
70
+ *
71
+ * The second form is the escape hatch that keeps this module's promise — an
72
+ * interrupted or artistic projection is a function, and a caller that can
73
+ * supply one should not need this file changed.
74
+ */
75
+ export declare function registerCrs(code: string, def: string | Projection): void;
76
+ /** Registered codes, for diagnostics and validation messages. */
77
+ export declare function registeredCrsCodes(): string[];
78
+ /** Formulaic UTM — the zones no table can enumerate. */
79
+ export declare function utmDef(zone: number, hemisphere: "N" | "S"): string | null;
80
+ /**
81
+ * Resolve any CRS to a projection, loading proj4 only for codes without a
82
+ * closed form. `def` is an authored `+proj=…` string for a CRS the library
83
+ * neither bundles nor has registered.
84
+ *
85
+ * Returns null rather than guessing: a wrong projection places data somewhere
86
+ * plausible and wrong, which is indistinguishable from correct until someone
87
+ * measures it.
88
+ */
89
+ export declare function resolveProjection(crs: string | null | undefined, def?: string | null): Promise<Projection | null>;
90
+ /**
91
+ * A projection plus the local origin everything downstream works relative to.
92
+ *
93
+ * Kept separate from `Projection` on purpose: the projection is a fact about a
94
+ * CRS and is shareable, while the origin is a fact about one map and must not
95
+ * leak between them.
96
+ */
97
+ export interface PlaneFrame {
98
+ projection: Projection;
99
+ /** The origin in ABSOLUTE plane coordinates — what a consumer adds back to get real eastings. */
100
+ origin: PlaneXY;
101
+ originLngLat: LngLatPair;
102
+ /** lng/lat → plane, relative to the origin. */
103
+ toPlane(lngLat: LngLatPair): PlaneXY;
104
+ /** Origin-relative plane → lng/lat. */
105
+ fromPlane(xy: PlaneXY): LngLatPair;
106
+ /**
107
+ * Batch forward over interleaved coordinates, in place by default.
108
+ *
109
+ * `stride` lets a caller pass `[lng, lat, z]` triples (or wider rows) and
110
+ * have only the first two components transformed — elevation is not a plane
111
+ * coordinate and must survive untouched.
112
+ */
113
+ forwardCoords(coords: Float64Array, opts?: {
114
+ out?: Float64Array;
115
+ stride?: number;
116
+ }): Float64Array;
117
+ }
118
+ export declare function planeFrame(projection: Projection, originLngLat: LngLatPair): PlaneFrame;
@@ -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-BlOnMPJe.js";
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-qnD1icOv.js";
2
2
  import { N as Nt, c as zt } from "./hillshade-apron-Bem3DWyJ.js";
3
- import { r as Bt } from "./hillshade-shader-n_zManfZ.js";
4
- import { aQ as _t, aR as $t } from "./index-oY3XHIux.js";
3
+ import { r as Bt } from "./hillshade-shader-DI2uLSNU.js";
4
+ import { bK as _t, bL as $t } from "./index-JjyDEqAS.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-Bph62dCb.js").then((e) => e.decode));
1075
+ j.set(f.Lerc, () => import("./lerc-C1mQ_Kqq.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 { aH as de, aI as fe, aJ as re, C as oe, aK as me, t as pe, aL as ge, A as Z, aM as ve, w as be, aN as xe, aO as Pe, aP as Te, T as ie } from "./index-oY3XHIux.js";
3
- import { p as ye, a as Le, h as we } from "./hillshade-shader-n_zManfZ.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-JjyDEqAS.js";
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 = [
6
6
  c,
@@ -1789,7 +1789,8 @@ function Wt(n, e) {
1789
1789
  // With a colormap the relief modulates the tint; without one the
1790
1790
  // chain below is a grey ramp of the same heights, and multiplying
1791
1791
  // relief into it only muddies it — so relief replaces it outright.
1792
- composite: !!e.colormap
1792
+ // The raster path samples a real picture, so relief belongs INSIDE it.
1793
+ composite: e.colormap ? "colour" : !1
1793
1794
  }),
1794
1795
  hillshadeHeights: n.shading.texture
1795
1796
  }
@@ -268,6 +268,7 @@ export interface BasemapRuntimeOptions {
268
268
  attribution?: boolean;
269
269
  }
270
270
  export declare class RuntimeCore {
271
+ /** MapView on a Mercator map, OrthographicView over a projected plane — see createStandaloneDeck. */
271
272
  private deck?;
272
273
  private basemap?;
273
274
  /**
@@ -318,6 +319,19 @@ export declare class RuntimeCore {
318
319
  private firstSettleDrawDone;
319
320
  private destroyed;
320
321
  private viewState;
322
+ /** `<om-map crs>` — set only for a projected map; fixed for the map's life. */
323
+ private crs?;
324
+ private crsDef?;
325
+ /**
326
+ * The projected plane, once its projection has resolved. Null on a Mercator
327
+ * map, and null on a projected one until proj4 lands — which is why the Deck
328
+ * waits for it.
329
+ */
330
+ private plane;
331
+ /** A `crs` that could not be resolved. Readiness settles so the page's own await returns; nothing is drawn. */
332
+ private projectionFailed;
333
+ /** While set, only these layer ids draw — the serializer's band isolation. */
334
+ private bandIsolation;
321
335
  private callbacks;
322
336
  private parent;
323
337
  /** The live `basemap` attribute value — re-read by the lazy adapter chunk so a switch during its load lands the LATEST style. */
@@ -432,7 +446,10 @@ export declare class RuntimeCore {
432
446
  private quotaNotice?;
433
447
  private unsubscribeLicense?;
434
448
  private readonly chromeHosts;
435
- constructor(parent: HTMLElement, initialView: InitialView, callbacks?: RuntimeCoreCallbacks, basemapAttr?: string, headless?: HeadlessOptions, basemapOptions?: BasemapRuntimeOptions, chromeHosts?: MandatedChromeHosts);
449
+ constructor(parent: HTMLElement, initialView: InitialView, callbacks?: RuntimeCoreCallbacks, basemapAttr?: string, headless?: HeadlessOptions, basemapOptions?: BasemapRuntimeOptions, chromeHosts?: MandatedChromeHosts, projected?: {
450
+ crs?: string | null;
451
+ crsDef?: string | null;
452
+ });
436
453
  /** Zoom ±1 about the cursor (shift inverts), animated, tagged "user" — a real gesture, so one burst latch before the transition's programmatic frames. */
437
454
  private readonly standaloneDblclick;
438
455
  /** `basemap` attribute → concrete style, logging resolution problems (unknown preset / missing key) — the demo-style fallback still renders. */
@@ -443,6 +460,54 @@ export declare class RuntimeCore {
443
460
  * (none ↔ maplibre). Reads/seeds the camera from `this.viewState`.
444
461
  */
445
462
  private initRenderer;
463
+ /**
464
+ * `this.viewState` is ALWAYS geographic, on a projected map as much as a
465
+ * Mercator one — stories, seek(), the scale bar, the Remotion frame driver
466
+ * and every camera API read it, and a second camera model would fork all of
467
+ * them. These two functions are the only places the plane exists, and they
468
+ * are deliberately the only places.
469
+ */
470
+ /**
471
+ * The standalone overrides that still mean something without a third
472
+ * dimension. `dragRotate`/pitch caps are dropped rather than passed through,
473
+ * because an orthographic controller would either ignore them or assert.
474
+ */
475
+ /**
476
+ * `STANDALONE_MAX_ZOOM` in PLANE zoom, which is a different scale entirely.
477
+ *
478
+ * Plane zoom and geographic zoom differ by roughly sixteen levels (a plane
479
+ * unit is a metre; a Mercator world unit at mid-latitude is tens of
480
+ * kilometres), so handing the geographic constant straight to an
481
+ * `OrthographicController` set a cap so far out of range that it never
482
+ * engaged — a gesture could zoom well past where `zoomBy()` and `setView()`
483
+ * clamp, and the two disagreed about the same map's limits.
484
+ *
485
+ * Converted at the plane's ORIGIN latitude, which is fixed for the map's
486
+ * life for the same reason the origin itself is.
487
+ */
488
+ private planeMaxZoom;
489
+ private planeControllerOverrides;
490
+ /**
491
+ * The controller this map should be running, whichever mode it is in.
492
+ *
493
+ * ONE definition, because there are five places that set it: Deck creation
494
+ * and four later `setProps` calls (draw capture, drag-pan suspend, the tilt
495
+ * ceiling, the zoom floor). Those four each built a `MapController`
496
+ * unconditionally, so on a PROJECTED map the first draw-tool activation
497
+ * swapped a Mercator controller onto an orthographic viewState — and
498
+ * `MapState`'s constructor asserts on a viewState with no longitude or
499
+ * latitude, which is exactly what a plane view has. C20 recorded that
500
+ * failure for Deck creation; it came back through the four setters.
501
+ */
502
+ private currentController;
503
+ private toDeckViewState;
504
+ private fromDeckViewState;
505
+ /**
506
+ * The standalone Deck — Mercator by default, orthographic over a projected
507
+ * plane when `this.plane` is set. Split out of `initRenderer` because a
508
+ * projected map has to await its projection first.
509
+ */
510
+ private createStandaloneDeck;
446
511
  /**
447
512
  * The five pick/drag deck callbacks, shared verbatim by the lazy MapLibre
448
513
  * adapter's deckProps and the standalone `new Deck` — one place to edit the
@@ -579,7 +644,19 @@ export declare class RuntimeCore {
579
644
  * mode only, terrain's own required mode) rather than a general-purpose
580
645
  * picking API this codebase otherwise avoids.
581
646
  */
647
+ /**
648
+ * deck reports `info.coordinate` in the viewport's own world space, which on
649
+ * a plane view is METRES, not lng/lat. Everything downstream — draw, measure,
650
+ * `om-map-point`, behaviors, coordinate-anchored overlays — expects lng/lat,
651
+ * so the whole resolution runs in the plane (where the layer geometry and
652
+ * the viewport already agree) and converts once, here, on the way out.
653
+ *
654
+ * Measuring is the reason this matters rather than merely being tidy: the
655
+ * measure tool feeds these points to `geodesy.ts`, and a projected metre fed
656
+ * to a geodesic formula returns a confident, wrong distance.
657
+ */
582
658
  private resolveMapPoint;
659
+ private resolveMapPointInViewSpace;
583
660
  /**
584
661
  * See `resolveMapPoint`'s own doc comment for why this re-picks rather than
585
662
  * reusing deck's own top-level `info`. `radius` mirrors the configured
@@ -663,6 +740,30 @@ export declare class RuntimeCore {
663
740
  withCapturePixelRatio<T>(scale: number, body: () => Promise<T>, opts?: {
664
741
  timeout?: number;
665
742
  }): Promise<T>;
743
+ /**
744
+ * Capture a raster band containing only `layerIds` (or every layer when
745
+ * null), as a PNG data URI at `dpi` — the one thing the vector serializer
746
+ * needs a renderer for (§6).
747
+ *
748
+ * Isolation is a COMPOSED gate, not an edit: the IRs are the document, and
749
+ * a capture must not change it. The restore runs in a `finally` because a
750
+ * failed export that left half the sheet hidden would be a far worse bug
751
+ * than the export failing.
752
+ */
753
+ captureBand(layerIds: readonly string[] | null, dpi: number): Promise<string>;
754
+ /**
755
+ * Whether the RESOLVED effect chain carries a real post-process pass.
756
+ *
757
+ * `instanceof PostProcessEffect` against what deck is actually running —
758
+ * not "is there an `<om-effect>` element", which misses `setEffects()`, and
759
+ * not "does deck have any effects", which catches the collision effect a
760
+ * decluttering layer installs by itself (§13.1). Both are wrong, in opposite
761
+ * directions, and each would make one document export two different ways.
762
+ */
763
+ resolvedPostProcessPass(): Promise<{
764
+ present: boolean;
765
+ label?: string;
766
+ }>;
666
767
  snapshot(): Promise<HTMLCanvasElement>;
667
768
  /**
668
769
  * Live basemap change (spec: "Basemap presets & switching"), both paths:
@@ -721,7 +822,45 @@ export declare class RuntimeCore {
721
822
  * resolves) and the first frame. With a basemap: the MapLibre-backed
722
823
  * adapter, once the basemap's style has loaded.
723
824
  */
825
+ /**
826
+ * The four ground corners a `widthPx × heightPx` box of THIS map would see,
827
+ * in tl, tr, br, bl order — or null when the map is not projected, which
828
+ * leaves the caller's own Web Mercator reconstruction untouched.
829
+ *
830
+ * Only the map can answer this for a projected view: the camera is
831
+ * geographic, so a caller reconstructing a `WebMercatorViewport` from it
832
+ * gets a plausible box for a map that is not drawn that way. A cartograph
833
+ * frame renders at its own print-resolution pixel size rather than the
834
+ * map's CSS size, so the viewport is rebuilt here at the size asked for.
835
+ *
836
+ * The payoff downstream is exactness: an orthographic frame's corners are an
837
+ * AFFINE map of the plane, so the georeference fitted from them has no
838
+ * projective residue at all — no pitch cap, no wrap, world-file-able.
839
+ */
840
+ groundCorners(widthPx: number, heightPx: number): [number, number][] | null;
841
+ /** The CRS this map is projected into, or null for a Web Mercator map. */
842
+ projectedCrs(): string | null;
724
843
  getViewport(): MapViewport | undefined;
844
+ /**
845
+ * The vector serializer's whole runtime dependency, in one method
846
+ * (§6, Part C).
847
+ *
848
+ * Everything the serializer needs that only a live map knows: the IRs in
849
+ * document order, how to project lng/lat to frame pixels, the ground scale
850
+ * for metre-valued widths, whether a real post-process pass is running, and
851
+ * a way to capture a band. The serializer itself is pure and headless.
852
+ */
853
+ serializeSvg(opts?: {
854
+ effectDpi?: number;
855
+ featureBudget?: number;
856
+ }): Promise<{
857
+ svg: string;
858
+ notices: {
859
+ code: string;
860
+ message: string;
861
+ fix: string;
862
+ }[];
863
+ }>;
725
864
  /** Renderer init state — feeds the `om-map-ready` signal. Headless has nothing async to wait for. */
726
865
  isReady(): boolean;
727
866
  /**
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Clipping geometry to the frame, in screen pixels
3
+ * (docs/design/carto-substrate.md §6, "Feature-count guard").
4
+ *
5
+ * Two jobs in one pass. A print sheet is thousands of features and an SVG with
6
+ * half a million paths is unusable, so anything outside the frame is dropped
7
+ * before it is ever written. And a feature that merely CROSSES the frame is
8
+ * trimmed rather than emitted whole — otherwise a coastline spanning a
9
+ * continent arrives as a single path with a hundred thousand vertices, 99% of
10
+ * them off the page, which is the "giant path" that makes editors crawl.
11
+ *
12
+ * Clipping happens in SCREEN space, after projection, on purpose: the frame is
13
+ * a rectangle there and an arbitrary quadrilateral in any projected plane, and
14
+ * a rectangle is the only shape Sutherland-Hodgman is simple against.
15
+ */
16
+ export type Point = [number, number];
17
+ export interface Rect {
18
+ left: number;
19
+ top: number;
20
+ right: number;
21
+ bottom: number;
22
+ }
23
+ export declare function containsPoint(rect: Rect, p: Point): boolean;
24
+ /** Whether a polyline's or ring's bounding box misses the rect entirely — the cheap reject. */
25
+ export declare function boundsMiss(points: readonly Point[], rect: Rect): boolean;
26
+ /**
27
+ * Clip one segment to the rect. Returns null when it misses entirely.
28
+ *
29
+ * Liang-Barsky rather than Cohen-Sutherland: it computes the surviving
30
+ * parameter interval directly instead of iterating, which matters when the
31
+ * input is a densely-digitized coastline and most segments are decided by
32
+ * arithmetic alone.
33
+ */
34
+ export declare function clipSegment(a: Point, b: Point, rect: Rect): [Point, Point] | null;
35
+ /**
36
+ * Clip a polyline, returning the surviving RUNS. A line that leaves the frame
37
+ * and comes back is two runs, not one — joining them would draw a chord
38
+ * straight across the page.
39
+ */
40
+ export declare function clipPolyline(points: readonly Point[], rect: Rect): Point[][];
41
+ /**
42
+ * Clip a polygon RING to the rect. Returns an empty array when nothing
43
+ * survives.
44
+ *
45
+ * Sutherland-Hodgman produces degenerate zero-width connections when a concave
46
+ * ring leaves and re-enters — a known artefact, and harmless here: they are
47
+ * invisible under a fill and this output is artwork, not an analytic product.
48
+ * The same line §5 draws around `buffer`.
49
+ */
50
+ export declare function clipRing(ring: readonly Point[], rect: Rect): Point[];