@nika-js/onlymap 0.11.11 → 0.12.1
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 +20 -0
- package/README.md +9 -3
- package/dist/attribute-resolution.d.ts +2 -0
- package/dist/{basemap-QT4ua-dL.js → basemap-BK25o5OE.js} +1514 -1462
- package/dist/basemap.d.ts +41 -1
- package/dist/cartograph.js +362 -321
- package/dist/cartograph.standalone.js +1995 -1914
- package/dist/{cityjson-k-z1r6c0.js → cityjson-DMc_dwu1.js} +1 -1
- package/dist/{crs-BzE_KP4M.js → crs-D5FyQfEu.js} +74 -7
- package/dist/{crs-ChglCB3O.js → crs-ZdDBJ2EY.js} +39 -36
- package/dist/data-layer.d.ts +36 -3
- package/dist/elements/om-map.d.ts +2 -1
- package/dist/geoparquet-CLydPm2f.js +30 -0
- package/dist/geoparquet.d.ts +6 -7
- package/dist/{globe-view-BSGTUqWc.js → globe-view-ChuX60M5.js} +11 -11
- package/dist/hillshade-DD8WFrvf.js +209 -0
- package/dist/html-data.d.ts +1 -1
- package/dist/{ifc-DXwePQRv.js → ifc-sisRo7I7.js} +1 -1
- package/dist/{index-DudIuhJa.js → index-BHRpKnGi.js} +1 -1
- package/dist/{index-CevWTqBO.js → index-Bs69fn8a.js} +14362 -13782
- package/dist/{index-DBt_2x-w.js → index-C2CKUsom.js} +106 -106
- package/dist/{index-DjYxw-8H.js → index-CMKrghNb.js} +18 -18
- package/dist/{index-Dwc4s3mc.js → index-CdAf0bLj.js} +20 -20
- package/dist/{index-BO7MtTkn.js → index-CgVFHEdM.js} +3 -3
- package/dist/{index-Bxue4Psc.js → index-CvrH6mbS.js} +9 -9
- package/dist/{index-Bzypgr1v.js → index-DIzzRLKr.js} +1 -1
- package/dist/{index-D1ZjhP2H.js → index-Dvwr1Y3o.js} +11 -11
- package/dist/index.d.ts +3 -2
- package/dist/ir.d.ts +6 -0
- package/dist/layer-registry.d.ts +21 -0
- package/dist/layers/warped-bitmap-layer.d.ts +27 -0
- package/dist/{lerc-DQuf93SN.js → lerc-mAijS40k.js} +1 -1
- package/dist/onlymap.standalone.js +53019 -52455
- package/dist/onlymapjs.js +86 -84
- package/dist/parse-manifest.d.ts +12 -9
- package/dist/{post-process-effect-B3j_nBzy.js → post-process-effect-rwFDi8di.js} +5 -5
- package/dist/programmatic.d.ts +12 -0
- package/dist/projection.d.ts +44 -1
- package/dist/{raster-CvAJ-h_g.js → raster-CXIqf83L.js} +3 -3
- package/dist/{raster-pipeline-CusoihQ3.js → raster-pipeline-CfSg2Re7.js} +1 -1
- package/dist/react/om-layer.d.ts +4 -0
- package/dist/react/om-map.d.ts +2 -0
- package/dist/react.js +225 -218
- package/dist/runtime-core.d.ts +24 -0
- package/dist/source-crs.d.ts +99 -0
- package/dist/{text-on-path-D9u5SYCo.js → text-on-path-B08PekFz.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-DWb_nikR.js → zarr-CUn2udOc.js} +2 -2
- package/docs/cartograph.md +2 -2
- package/docs/cartography.md +106 -1
- package/llms.txt +2 -1
- package/onlymapjs.attributes.json +2 -0
- package/onlymapjs.html-data.json +26 -4
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +5 -3
- package/skills/onlymapjs/references/syntax.md +18 -3
- package/dist/geoparquet-hOsdfZJa.js +0 -35
- package/dist/hillshade-D2Ps3Nim.js +0 -298
package/dist/cartograph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let Pt = null,
|
|
1
|
+
let Pt = null, J = null;
|
|
2
2
|
function Ie(r) {
|
|
3
3
|
Pt = r;
|
|
4
4
|
}
|
|
@@ -6,13 +6,13 @@ function yr() {
|
|
|
6
6
|
return V !== null;
|
|
7
7
|
}
|
|
8
8
|
let V = null;
|
|
9
|
-
function
|
|
9
|
+
function Z() {
|
|
10
10
|
return V;
|
|
11
11
|
}
|
|
12
12
|
function Fe() {
|
|
13
|
-
return V ? Promise.resolve(V) :
|
|
14
|
-
throw
|
|
15
|
-
}),
|
|
13
|
+
return V ? Promise.resolve(V) : J || (Pt ? (J = Promise.resolve(Pt()).then((r) => (V = r, V)).catch((r) => {
|
|
14
|
+
throw J = null, r;
|
|
15
|
+
}), J) : Promise.reject(
|
|
16
16
|
new Error(
|
|
17
17
|
'[onlymapjs/cartograph] No map runtime loader is configured. Import the cartograph entry ("@nika-js/onlymap/cartograph" or its standalone build) rather than a submodule — the entry installs it.'
|
|
18
18
|
)
|
|
@@ -22,10 +22,10 @@ const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
22
22
|
__proto__: null,
|
|
23
23
|
isCoreLoaded: yr,
|
|
24
24
|
loadCore: Fe,
|
|
25
|
-
peekCore:
|
|
25
|
+
peekCore: Z,
|
|
26
26
|
setCoreLoader: Ie
|
|
27
27
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
28
|
-
function
|
|
28
|
+
function Yt(r) {
|
|
29
29
|
return { scale: r / 96, pxPerMm: r / 25.4 };
|
|
30
30
|
}
|
|
31
31
|
function gt(r) {
|
|
@@ -57,7 +57,7 @@ function I(r) {
|
|
|
57
57
|
const t = r.trim().toLowerCase();
|
|
58
58
|
return t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "none" ? null : r;
|
|
59
59
|
}
|
|
60
|
-
const D = 96 / 25.4,
|
|
60
|
+
const D = 96 / 25.4, Xt = {
|
|
61
61
|
A0: { widthMm: 841, heightMm: 1189 },
|
|
62
62
|
A1: { widthMm: 594, heightMm: 841 },
|
|
63
63
|
A2: { widthMm: 420, heightMm: 594 },
|
|
@@ -70,7 +70,7 @@ const D = 96 / 25.4, Jt = {
|
|
|
70
70
|
function dt(r, t, e, n) {
|
|
71
71
|
const i = t != null ? Number(t) : NaN, s = e != null ? Number(e) : NaN;
|
|
72
72
|
if (Number.isFinite(i) && i > 0 && Number.isFinite(s) && s > 0) return { widthMm: i, heightMm: s };
|
|
73
|
-
const o =
|
|
73
|
+
const o = Xt[r ?? Zt] ?? Xt[Zt];
|
|
74
74
|
return n === "landscape" ? { widthMm: o.heightMm, heightMm: o.widthMm } : { ...o };
|
|
75
75
|
}
|
|
76
76
|
let rt = null;
|
|
@@ -115,11 +115,11 @@ const ft = ["protanopia", "deuteranopia", "tritanopia", "achromatopsia"], Oe = {
|
|
|
115
115
|
tritan: "tritanopia",
|
|
116
116
|
achroma: "achromatopsia"
|
|
117
117
|
};
|
|
118
|
-
function
|
|
118
|
+
function Gt(r) {
|
|
119
119
|
const t = r?.trim().toLowerCase();
|
|
120
120
|
return !t || t === "none" ? null : ft.includes(t) ? t : Oe[t] ?? null;
|
|
121
121
|
}
|
|
122
|
-
const Sr = ["none", ...ft, ...Object.keys(Oe)],
|
|
122
|
+
const Sr = ["none", ...ft, ...Object.keys(Oe)], qt = {
|
|
123
123
|
protanopia: [0.11238, 0.88762, 0, 0.11238, 0.88762, 0, 401e-5, -401e-5, 1],
|
|
124
124
|
deuteranopia: [0.29275, 0.70725, 0, 0.29275, 0.70725, 0, -0.02234, 0.02234, 1],
|
|
125
125
|
tritanopia: [1, 0.14461, -0.14461, 0, 0.85659, 0.14341, 0, 0.85659, 0.14341],
|
|
@@ -140,20 +140,20 @@ function Cr(r) {
|
|
|
140
140
|
const n = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/.exec(t);
|
|
141
141
|
return n ? { r: Number(n[1]), g: Number(n[2]), b: Number(n[3]) } : null;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
const e =
|
|
143
|
+
function Jt(r, t) {
|
|
144
|
+
const e = qt[t], [n, i, s] = [q(r.r), q(r.g), q(r.b)];
|
|
145
145
|
return {
|
|
146
146
|
r: ht(e[0] * n + e[1] * i + e[2] * s),
|
|
147
147
|
g: ht(e[3] * n + e[4] * i + e[5] * s),
|
|
148
148
|
b: ht(e[6] * n + e[7] * i + e[8] * s)
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Qt({ r, g: t, b: e }) {
|
|
152
152
|
const [n, i, s] = [q(r), q(t), q(e)], o = (n * 0.4124564 + i * 0.3575761 + s * 0.1804375) / 0.95047, a = n * 0.2126729 + i * 0.7151522 + s * 0.072175, l = (n * 0.0193339 + i * 0.119192 + s * 0.9503041) / 1.08883, c = (m) => m > 216 / 24389 ? Math.cbrt(m) : 841 / 108 * m + 4 / 29, [u, h, d] = [c(o), c(a), c(l)];
|
|
153
153
|
return [116 * h - 16, 500 * (u - h), 200 * (h - d)];
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
const [e, n, i] =
|
|
155
|
+
function te(r, t) {
|
|
156
|
+
const [e, n, i] = Qt(r), [s, o, a] = Qt(t), l = Math.PI / 180, c = 180 / Math.PI, u = (Math.hypot(n, i) + Math.hypot(o, a)) / 2, h = 0.5 * (1 - Math.sqrt(u ** 7 / (u ** 7 + 25 ** 7))), [d, m] = [n * (1 + h), o * (1 + h)], [f, g] = [Math.hypot(d, i), Math.hypot(m, a)], p = (L, R) => {
|
|
157
157
|
if (L === 0 && R === 0) return 0;
|
|
158
158
|
const B = Math.atan2(R, L) * c;
|
|
159
159
|
return B >= 0 ? B : B + 360;
|
|
@@ -180,8 +180,8 @@ function kr(r, t = xr) {
|
|
|
180
180
|
for (const l of e.values())
|
|
181
181
|
for (let c = 0; c < l.length; c++)
|
|
182
182
|
for (let u = c + 1; u < l.length; u++) {
|
|
183
|
-
if (
|
|
184
|
-
const d =
|
|
183
|
+
if (te(l[c].rgb, l[u].rgb) < t) continue;
|
|
184
|
+
const d = te(Jt(l[c].rgb, a), Jt(l[u].rgb, a));
|
|
185
185
|
d < t && (n.push({ type: a, a: l[c].entry, b: l[u].entry, distance: d }), i.set(a, (i.get(a) ?? 0) + 1));
|
|
186
186
|
}
|
|
187
187
|
let s = null, o = 0;
|
|
@@ -204,7 +204,7 @@ function $r(r, t, e, n) {
|
|
|
204
204
|
const l = (h) => {
|
|
205
205
|
const d = Math.min(1, Math.max(0, h)) * o, m = Math.floor(d);
|
|
206
206
|
return m >= o ? a[o] : a[m] + (a[m + 1] - a[m]) * (d - m);
|
|
207
|
-
}, c =
|
|
207
|
+
}, c = qt[n], u = i.data;
|
|
208
208
|
for (let h = 0; h < u.length; h += 4) {
|
|
209
209
|
const d = s[u[h]], m = s[u[h + 1]], f = s[u[h + 2]];
|
|
210
210
|
u[h] = l(c[0] * d + c[1] * m + c[2] * f), u[h + 1] = l(c[3] * d + c[4] * m + c[5] * f), u[h + 2] = l(c[6] * d + c[7] * m + c[8] * f);
|
|
@@ -221,7 +221,7 @@ function Er(r) {
|
|
|
221
221
|
n.id = _e(e), n.setAttribute("color-interpolation-filters", "linearRGB");
|
|
222
222
|
const i = r.createElementNS("http://www.w3.org/2000/svg", "feColorMatrix");
|
|
223
223
|
i.setAttribute("type", "matrix");
|
|
224
|
-
const s =
|
|
224
|
+
const s = qt[e];
|
|
225
225
|
i.setAttribute("values", [s[0], s[1], s[2], 0, 0, s[3], s[4], s[5], 0, 0, s[6], s[7], s[8], 0, 0, 0, 0, 0, 1, 0].join(" ")), n.appendChild(i), t.appendChild(n);
|
|
226
226
|
}
|
|
227
227
|
r.body.appendChild(t);
|
|
@@ -240,13 +240,13 @@ async function Nr(r) {
|
|
|
240
240
|
})
|
|
241
241
|
), t;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function je(r) {
|
|
244
244
|
return !r.hasAttribute("hidden") && !r.hasAttribute("data-om-carto-screen-only") && !r.hasAttribute("data-om-carto-marks") && !r.hasAttribute("data-om-carto-flattened") && r.tagName.toLowerCase() !== "style" && r.tagName.toLowerCase() !== "script";
|
|
245
245
|
}
|
|
246
246
|
function Pr(r) {
|
|
247
|
-
return [...r.children].filter(
|
|
247
|
+
return [...r.children].filter(je).map((t, e) => ({ el: t, index: e, z: S(t).z ?? 0 })).sort((t, e) => t.z - e.z || t.index - e.index).map((t) => t.el);
|
|
248
248
|
}
|
|
249
|
-
async function
|
|
249
|
+
async function Wt(r, t = {}) {
|
|
250
250
|
const e = r ?? document.querySelector("om-cartograph");
|
|
251
251
|
if (!e) throw new Error("[onlymapjs/cartograph] renderCartograph: no <om-cartograph> to render.");
|
|
252
252
|
const n = [], i = t.dpi ?? (Number(e.getAttribute("dpi")) || 300);
|
|
@@ -260,11 +260,11 @@ async function Bt(r, t = {}) {
|
|
|
260
260
|
let d = i;
|
|
261
261
|
const m = Math.min(u / (l / 25.4), u / (c / 25.4)), f = Math.sqrt(h / (l / 25.4 * (c / 25.4))), g = Math.min(m, f);
|
|
262
262
|
d > g && (d = Math.floor(g), n.push(`Requested ${i} dpi exceeds this browser's canvas budget for a ${l.toFixed(0)}×${c.toFixed(0)}mm page; rendered at ${d} dpi instead.`)), n.push(...await Nr(e)), typeof document < "u" && document.fonts?.ready && await document.fonts.ready;
|
|
263
|
-
const p =
|
|
263
|
+
const p = Yt(d), b = Math.max(1, Math.round(l * p.pxPerMm)), w = Math.max(1, Math.round(c * p.pxPerMm)), y = Pr(e);
|
|
264
264
|
for (const M of y)
|
|
265
265
|
if (!(!gt(M) || !M.prepareCartograph))
|
|
266
266
|
try {
|
|
267
|
-
await M.prepareCartograph(
|
|
267
|
+
await M.prepareCartograph(Yt(d));
|
|
268
268
|
} catch (C) {
|
|
269
269
|
M.discardCartograph?.(), n.push(`${M.tagName.toLowerCase()}${M.id ? `#${M.id}` : ""} could not be captured: ${C.message}`);
|
|
270
270
|
}
|
|
@@ -293,7 +293,7 @@ async function Bt(r, t = {}) {
|
|
|
293
293
|
const C = Number(M.getAttribute("x1")), P = Number(M.getAttribute("y1")), k = Number(M.getAttribute("x2")), L = Number(M.getAttribute("y2"));
|
|
294
294
|
[C, P, k, L].every(Number.isFinite) && (v.save(), v.strokeStyle = M.getAttribute("stroke") || "#000000", v.lineWidth = (Number(M.getAttribute("stroke-width")) || 0.2) * p.pxPerMm, v.beginPath(), v.moveTo((C + a) * p.pxPerMm, (P + a) * p.pxPerMm), v.lineTo((k + a) * p.pxPerMm, (L + a) * p.pxPerMm), v.stroke(), v.restore());
|
|
295
295
|
}
|
|
296
|
-
const _ =
|
|
296
|
+
const _ = Gt(t.cvd === "page" ? e.getAttribute("cvd") : t.cvd);
|
|
297
297
|
_ && !$r(v, b, w, _) && n.push("Colour-vision simulation was skipped: a cross-origin image on the page makes the export canvas unreadable.");
|
|
298
298
|
for (const M of y) gt(M) && M.discardCartograph?.();
|
|
299
299
|
const E = t.format === "jpeg" ? "image/jpeg" : "image/png";
|
|
@@ -302,7 +302,7 @@ async function Bt(r, t = {}) {
|
|
|
302
302
|
if (!N) throw new Error("[onlymapjs/cartograph] renderCartograph: the canvas produced no image (it may have exceeded a browser limit).");
|
|
303
303
|
return { blob: N, widthPx: b, heightPx: w, dpi: d, warnings: n };
|
|
304
304
|
}
|
|
305
|
-
async function
|
|
305
|
+
async function ze(r, t = {}) {
|
|
306
306
|
const e = r ?? document.querySelector("om-cartograph");
|
|
307
307
|
if (!e) throw new Error("[onlymapjs/cartograph] renderCartographAtlas: no <om-cartograph> to render.");
|
|
308
308
|
const n = e.querySelector("om-atlas") ?? null;
|
|
@@ -318,14 +318,14 @@ async function je(r, t = {}) {
|
|
|
318
318
|
if (!Number.isInteger(h) || h < 0 || h >= i)
|
|
319
319
|
throw new Error(`[onlymapjs/cartograph] renderCartographAtlas: page ${t.page} is out of range (this atlas has ${i}).`);
|
|
320
320
|
n.seek(h);
|
|
321
|
-
const d = await
|
|
321
|
+
const d = await ee(e, t, a);
|
|
322
322
|
return { blob: d.blob, filenames: [o[h]], pages: 1, dpi: d.dpi, warnings: a };
|
|
323
323
|
}
|
|
324
324
|
const c = [];
|
|
325
325
|
let u = t.dpi ?? 300;
|
|
326
326
|
for (let h = 0; h < i; h++) {
|
|
327
327
|
n.seek(h);
|
|
328
|
-
const d = await
|
|
328
|
+
const d = await ee(e, t, a);
|
|
329
329
|
u = d.dpi, c.push({ name: o[h], data: d.blob }), t.onPage?.(h + 1, i);
|
|
330
330
|
}
|
|
331
331
|
return { blob: await Mr(c), filenames: o, pages: i, dpi: u, warnings: a };
|
|
@@ -333,28 +333,28 @@ async function je(r, t = {}) {
|
|
|
333
333
|
n.seek(l);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
async function
|
|
336
|
+
async function ee(r, t, e) {
|
|
337
337
|
for (const i of r.querySelectorAll("om-frame"))
|
|
338
338
|
await i.mapElement?.whenSettled?.({ timeout: 2e4 });
|
|
339
|
-
const n = await
|
|
339
|
+
const n = await Wt(r, t);
|
|
340
340
|
return e.push(...n.warnings), n;
|
|
341
341
|
}
|
|
342
342
|
const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
343
343
|
__proto__: null,
|
|
344
344
|
MAX_CANVAS_AREA: De,
|
|
345
345
|
MAX_CANVAS_DIMENSION: Ue,
|
|
346
|
-
paintsInExport:
|
|
347
|
-
renderCartograph:
|
|
348
|
-
renderCartographAtlas:
|
|
346
|
+
paintsInExport: je,
|
|
347
|
+
renderCartograph: Wt,
|
|
348
|
+
renderCartographAtlas: ze
|
|
349
349
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
350
|
-
function
|
|
350
|
+
function re(r, t, e = {}) {
|
|
351
351
|
const n = URL.createObjectURL(r), i = document.createElement("a");
|
|
352
352
|
i.href = n, i.download = t, document.body.appendChild(i), i.click(), i.remove();
|
|
353
353
|
const s = e.revokeAfterMs ?? 0;
|
|
354
354
|
s > 0 ? setTimeout(() => URL.revokeObjectURL(n), s) : URL.revokeObjectURL(n);
|
|
355
355
|
}
|
|
356
356
|
const Lr = 3e4;
|
|
357
|
-
async function
|
|
357
|
+
async function ne(r, t = Lr) {
|
|
358
358
|
let e = !1;
|
|
359
359
|
const n = new Promise(
|
|
360
360
|
(s) => setTimeout(() => {
|
|
@@ -382,7 +382,7 @@ async function Rr(r, t = {}) {
|
|
|
382
382
|
i && r.setAttribute("cvd", i);
|
|
383
383
|
const s = n.get("export");
|
|
384
384
|
if (s) {
|
|
385
|
-
await
|
|
385
|
+
await ne(r, t.timeoutMs);
|
|
386
386
|
const o = s === "jpeg" ? "jpeg" : "png", a = Number(n.get("dpi")) || void 0, l = r.getAttribute("cartograph-id") || "cartograph", c = n.get("page");
|
|
387
387
|
if (c != null) {
|
|
388
388
|
const h = r.querySelector("om-atlas");
|
|
@@ -390,15 +390,15 @@ async function Rr(r, t = {}) {
|
|
|
390
390
|
const d = Number(c);
|
|
391
391
|
if (!Number.isInteger(d) || d < 1) throw new Error(`?page=${c} is not a page number (they start at 1).`);
|
|
392
392
|
h.refresh?.();
|
|
393
|
-
const m = await
|
|
393
|
+
const m = await ze(r, { dpi: a, format: o, page: d - 1 });
|
|
394
394
|
for (const f of m.warnings) console.warn(`[onlymapjs/cartograph] ${f}`);
|
|
395
|
-
return
|
|
395
|
+
return re(m.blob, m.filenames[0] ?? `${l}.${o === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
|
|
396
396
|
}
|
|
397
|
-
const u = await
|
|
397
|
+
const u = await Wt(r, { dpi: a, format: o });
|
|
398
398
|
for (const h of u.warnings) console.warn(`[onlymapjs/cartograph] ${h}`);
|
|
399
|
-
return
|
|
399
|
+
return re(u.blob, `${l}.${o === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
|
|
400
400
|
}
|
|
401
|
-
return n.get("print") === "1" ? (await
|
|
401
|
+
return n.get("print") === "1" ? (await ne(r, t.timeoutMs), typeof r.print == "function" ? await r.print({ dpi: Number(n.get("dpi")) || void 0 }) : typeof window < "u" && window.print(), "print") : i ? "cvd" : null;
|
|
402
402
|
}
|
|
403
403
|
function Ir() {
|
|
404
404
|
if (typeof document > "u") return;
|
|
@@ -420,7 +420,7 @@ function Fr(r) {
|
|
|
420
420
|
);
|
|
421
421
|
return new DOMParser().parseFromString(r, "text/html");
|
|
422
422
|
}
|
|
423
|
-
const
|
|
423
|
+
const Bt = " · ", Or = {
|
|
424
424
|
copy: "©",
|
|
425
425
|
reg: "®",
|
|
426
426
|
amp: "&",
|
|
@@ -445,8 +445,8 @@ function We(r) {
|
|
|
445
445
|
);
|
|
446
446
|
return t.filter((e) => !t.some((n) => n !== e && n.includes(e)));
|
|
447
447
|
}
|
|
448
|
-
function
|
|
449
|
-
return We((r ?? "").split(
|
|
448
|
+
function ie(r) {
|
|
449
|
+
return We((r ?? "").split(Bt.trim()));
|
|
450
450
|
}
|
|
451
451
|
class O extends qe {
|
|
452
452
|
renderQueued = !1;
|
|
@@ -492,23 +492,23 @@ class O extends qe {
|
|
|
492
492
|
a != null && Number.isInteger(a) ? this.style.zIndex = String(a) : this.style.removeProperty("z-index");
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
const bt = "cartograph/2",
|
|
495
|
+
const bt = "cartograph/2", Ii = ["default", "dark", "sepia", "blueprint", "minimal"], se = ["A0", "A1", "A2", "A3", "A4", "A5", "Letter", "Legal"], Ur = /* @__PURE__ */ new Map([
|
|
496
496
|
["projection", "live frames render Web Mercator (EPSG:3857) only — Globe support is design-only; use a static frame for other projections"]
|
|
497
|
-
]),
|
|
497
|
+
]), j = ["id", "x", "y", "w", "h", "rotation", "z", "locked", "hidden"], T = {
|
|
498
498
|
"om-cartograph": ["cartograph-id", "format", "size", "width", "height", "orientation", "theme", "bg", "color", "font", "title", "attribution", "notes", "cvd", "bleed", "crop-marks", "safe-zone", "dpi", "flatten", "color-profile", "allow-url-actions", "keep-badge"],
|
|
499
|
-
"om-frame": [...
|
|
500
|
-
"om-legend": [...
|
|
499
|
+
"om-frame": [...j, "src", "mode", "center", "zoom", "bearing", "pitch", "dpi", "crs", "corners", "crs-def", "overview-of", "overview-stroke", "atlas-fit", "atlas-margin", "frame-stroke", "frame-bg", "attribution"],
|
|
500
|
+
"om-legend": [...j, "for", "title", "columns", "derived", "bg", "color", "stroke", "font-size", "padding"],
|
|
501
501
|
"om-legend-row": ["layer", "match", "label", "hide", "order", "color", "shape"],
|
|
502
502
|
// NOTE: the discriminator on furniture is `kind`, never `style` — `style` is
|
|
503
503
|
// the global HTML attribute the runtime itself writes for mm placement, so
|
|
504
504
|
// `style="double"` would be erased on the first render. `kind` also matches
|
|
505
505
|
// om-text/om-shape, so the whole vocabulary has ONE discriminator word.
|
|
506
|
-
"om-scalebar": [...
|
|
507
|
-
"om-north": [...
|
|
508
|
-
"om-graticule": [...
|
|
509
|
-
"om-text": [...
|
|
510
|
-
"om-shape": [...
|
|
511
|
-
"om-image": [...
|
|
506
|
+
"om-scalebar": [...j, "for", "units", "segments", "segment-length", "kind", "color"],
|
|
507
|
+
"om-north": [...j, "for", "kind", "color"],
|
|
508
|
+
"om-graticule": [...j, "for", "crs", "crs-def", "interval", "interval-x", "interval-y", "kind", "labels", "format", "color"],
|
|
509
|
+
"om-text": [...j, "kind", "font-size", "weight", "align", "font", "color", "bg"],
|
|
510
|
+
"om-shape": [...j, "kind", "fill", "fill-opacity", "stroke", "stroke-width", "radius"],
|
|
511
|
+
"om-image": [...j, "src", "fit"],
|
|
512
512
|
// NOT placed: a source is a child of <om-frame> that says where the frame's
|
|
513
513
|
// picture may come from. Its corners/crs describe THAT source — a capture
|
|
514
514
|
// carries the georeference that was true when it was taken, which is the
|
|
@@ -516,7 +516,7 @@ const bt = "cartograph/2", Ei = ["default", "dark", "sepia", "blueprint", "minim
|
|
|
516
516
|
// CRS is therefore unknowable.
|
|
517
517
|
"om-source": ["src", "corners", "crs", "crs-def", "attribution"],
|
|
518
518
|
"om-atlas": ["id", "for", "layer", "filter", "sort", "filename", "page-name", "pager"]
|
|
519
|
-
}, yt = Object.keys(T), Lt = "data-om-carto-vector", Dr = ["metric", "imperial", "nautical"],
|
|
519
|
+
}, yt = Object.keys(T), Lt = "data-om-carto-vector", Dr = ["metric", "imperial", "nautical"], jr = 0.3048, zr = 1609.344, Gr = 1852;
|
|
520
520
|
function qr(r) {
|
|
521
521
|
return r != null && Dr.includes(r) ? r : null;
|
|
522
522
|
}
|
|
@@ -525,26 +525,26 @@ function Be(r) {
|
|
|
525
525
|
const t = Math.pow(10, Math.floor(Math.log10(r))), e = r / t;
|
|
526
526
|
return (e >= 5 ? 5 : e >= 2 ? 2 : 1) * t;
|
|
527
527
|
}
|
|
528
|
-
const
|
|
528
|
+
const oe = {
|
|
529
529
|
// Finest first; the largest tier whose snapped length is ≥ 1 unit wins.
|
|
530
530
|
metric: [
|
|
531
531
|
{ metersPerUnit: 1, label: "m" },
|
|
532
532
|
{ metersPerUnit: 1e3, label: "km" }
|
|
533
533
|
],
|
|
534
534
|
imperial: [
|
|
535
|
-
{ metersPerUnit:
|
|
536
|
-
{ metersPerUnit:
|
|
535
|
+
{ metersPerUnit: jr, label: "ft" },
|
|
536
|
+
{ metersPerUnit: zr, label: "mi" }
|
|
537
537
|
],
|
|
538
538
|
nautical: [{ metersPerUnit: Gr, label: "nmi" }]
|
|
539
539
|
};
|
|
540
540
|
function Ke({ groundMetersPerMm: r, maxWidthMm: t, segments: e = 4, units: n = "metric", segmentLengthMeters: i }) {
|
|
541
541
|
if (!Number.isFinite(r) || r <= 0 || !Number.isFinite(t) || t <= 0) return null;
|
|
542
|
-
const s = Number.isInteger(e) && e > 0 ? e : 4, o =
|
|
542
|
+
const s = Number.isInteger(e) && e > 0 ? e : 4, o = oe[n] ?? oe.metric, a = t / s * r;
|
|
543
543
|
let l, c;
|
|
544
544
|
if (i != null && Number.isFinite(i) && i > 0)
|
|
545
|
-
l = i, c =
|
|
545
|
+
l = i, c = ae(o, l);
|
|
546
546
|
else {
|
|
547
|
-
c =
|
|
547
|
+
c = ae(o, a);
|
|
548
548
|
const f = Be(a / c.metersPerUnit);
|
|
549
549
|
if (f <= 0) return null;
|
|
550
550
|
l = f * c.metersPerUnit;
|
|
@@ -606,7 +606,7 @@ function Wr(r, t, e) {
|
|
|
606
606
|
}
|
|
607
607
|
return { bars: c, strokes: u, labels: f, fontMm: n, strokeMm: i, segmentMeters: r.segmentMeters, unitLabel: r.unitLabel, scaleDenominator: r.scaleDenominator };
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function ae(r, t) {
|
|
610
610
|
let e = r[0];
|
|
611
611
|
for (const n of r)
|
|
612
612
|
t / n.metersPerUnit >= 1 && (e = n);
|
|
@@ -639,7 +639,7 @@ function He(r, t) {
|
|
|
639
639
|
function Hr(r) {
|
|
640
640
|
return [...r.matchAll(Ve)].map((t) => t[1]);
|
|
641
641
|
}
|
|
642
|
-
const
|
|
642
|
+
const le = /* @__PURE__ */ new WeakMap();
|
|
643
643
|
function Yr(r, t) {
|
|
644
644
|
const e = [], n = r.ownerDocument ?? (typeof document < "u" ? document : null);
|
|
645
645
|
if (!n) return e;
|
|
@@ -650,10 +650,10 @@ function Yr(r, t) {
|
|
|
650
650
|
), s = [];
|
|
651
651
|
for (let o = i.nextNode(); o; o = i.nextNode()) s.push(o);
|
|
652
652
|
for (const o of s) {
|
|
653
|
-
let a =
|
|
653
|
+
let a = le.get(o);
|
|
654
654
|
if (a === void 0) {
|
|
655
655
|
if (a = o.data, !a.includes("{{")) continue;
|
|
656
|
-
|
|
656
|
+
le.set(o, a);
|
|
657
657
|
}
|
|
658
658
|
const l = He(a, t);
|
|
659
659
|
o.data !== l.text && (o.data = l.text), e.push(...l.unresolved);
|
|
@@ -674,18 +674,18 @@ function Xe(r, t) {
|
|
|
674
674
|
if (n.id === t) return n;
|
|
675
675
|
return null;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function Ze(r) {
|
|
678
678
|
return [...r.querySelectorAll("om-frame")];
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Zr(r) {
|
|
681
681
|
const t = Ye(r);
|
|
682
682
|
if (!t) return null;
|
|
683
|
-
const e =
|
|
683
|
+
const e = Ze(t);
|
|
684
684
|
return e.length === 1 ? e[0] : null;
|
|
685
685
|
}
|
|
686
686
|
function U(r) {
|
|
687
687
|
const t = r.getAttribute("for");
|
|
688
|
-
return t ? Xe(r, t) :
|
|
688
|
+
return t ? Xe(r, t) : Zr(r);
|
|
689
689
|
}
|
|
690
690
|
function W(r, t) {
|
|
691
691
|
let e = r.querySelector(`:scope > [${Rt}]`);
|
|
@@ -696,11 +696,11 @@ function W(r, t) {
|
|
|
696
696
|
}
|
|
697
697
|
e.textContent !== t && (e.textContent = t);
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function Jr(r) {
|
|
700
700
|
r.querySelector(`:scope > [${Rt}]`)?.remove();
|
|
701
701
|
}
|
|
702
|
-
const
|
|
703
|
-
function
|
|
702
|
+
const ce = "data-om-carto-page", ue = "data-om-carto-marks", wt = "data-om-carto-credit", he = "data-om-carto-attribution", Je = "Built with OnlyMap by NIKA", Qr = `${Je} · free for non-commercial use`, nt = 2, vt = 1.2, it = 2.4, At = 1.5, st = 1.2, Mt = 0.3, St = 0.8, Ct = "http://www.w3.org/2000/svg", tn = 6e4;
|
|
703
|
+
function me(r) {
|
|
704
704
|
return r.replace(/©|\(c\)/gi, " ").replace(/\s+/g, " ").trim().toLowerCase();
|
|
705
705
|
}
|
|
706
706
|
class Qe extends O {
|
|
@@ -742,14 +742,14 @@ class Qe extends O {
|
|
|
742
742
|
* runtime's job (issue #41 §9: the om-map carries the key).
|
|
743
743
|
*/
|
|
744
744
|
renderCredit() {
|
|
745
|
-
const t =
|
|
745
|
+
const t = Z();
|
|
746
746
|
t && !this.unsubscribeLicense && typeof t.subscribeLicense == "function" && (this.unsubscribeLicense = t.subscribeLicense(() => this.renderCredit()));
|
|
747
747
|
const e = this.creditMode(t, this.hasAttribute("keep-badge")), n = [...this.querySelectorAll("om-text")].some((a) => /onlymap/i.test(a.textContent ?? "")), i = this.querySelector(`:scope > [${wt}]`);
|
|
748
748
|
if (e === "hidden" || n) {
|
|
749
749
|
i?.remove();
|
|
750
750
|
return;
|
|
751
751
|
}
|
|
752
|
-
const s = e === "voluntary" ?
|
|
752
|
+
const s = e === "voluntary" ? Je : Qr;
|
|
753
753
|
if (i) {
|
|
754
754
|
i.textContent !== s && (i.textContent = s), this.armCreditPainter(i);
|
|
755
755
|
return;
|
|
@@ -772,19 +772,19 @@ class Qe extends O {
|
|
|
772
772
|
* runtime still credits the tiles in its pictures.
|
|
773
773
|
*/
|
|
774
774
|
renderAttribution() {
|
|
775
|
-
const t = [...this.querySelectorAll("om-frame")], e = We(t.flatMap((l) => l.attributions?.() ?? [])), n = [...this.querySelectorAll("om-text")].map((l) =>
|
|
776
|
-
`), i = e.filter((l) => !n.includes(
|
|
775
|
+
const t = [...this.querySelectorAll("om-frame")], e = We(t.flatMap((l) => l.attributions?.() ?? [])), n = [...this.querySelectorAll("om-text")].map((l) => me(l.textContent ?? "")).join(`
|
|
776
|
+
`), i = e.filter((l) => !n.includes(me(l))), s = this.querySelector(`:scope > [${he}]`);
|
|
777
777
|
if (i.length === 0) {
|
|
778
778
|
s?.remove();
|
|
779
779
|
return;
|
|
780
780
|
}
|
|
781
|
-
const o = i.join(
|
|
781
|
+
const o = i.join(Bt);
|
|
782
782
|
if (s) {
|
|
783
783
|
s.textContent !== o && (s.textContent = o);
|
|
784
784
|
return;
|
|
785
785
|
}
|
|
786
786
|
const a = this.ownerDocument.createElement("div");
|
|
787
|
-
a.setAttribute(
|
|
787
|
+
a.setAttribute(he, ""), a.setAttribute("z", "2147483644"), a.textContent = o, a.style.cssText = `position:absolute;right:${nt}mm;bottom:${vt}mm;z-index:2147483644;max-width:60%;text-align:right;font:${it}mm/${At} system-ui,sans-serif;color:#374151;background:rgba(255,255,255,.72);padding:${Mt}mm ${st}mm;border-radius:${St}mm;pointer-events:none;`, this.armFootPainter(a, "right"), this.appendChild(a);
|
|
788
788
|
}
|
|
789
789
|
/**
|
|
790
790
|
* Which credit this sheet carries, from the core's own predicate so the
|
|
@@ -868,7 +868,7 @@ class Qe extends O {
|
|
|
868
868
|
}
|
|
869
869
|
/** Values every `{{token}}` on this page resolves against. */
|
|
870
870
|
tokenContext() {
|
|
871
|
-
const t = /* @__PURE__ */ new Map(), e =
|
|
871
|
+
const t = /* @__PURE__ */ new Map(), e = Ze(this);
|
|
872
872
|
for (const s of e) {
|
|
873
873
|
const o = s.georef, a = o?.groundMetersPerMm() ?? 0;
|
|
874
874
|
t.set(s.id, {
|
|
@@ -899,8 +899,8 @@ class Qe extends O {
|
|
|
899
899
|
renderNow() {
|
|
900
900
|
const { widthMm: t, heightMm: e } = this.pageSize, n = this.bleedMm;
|
|
901
901
|
this.style.display = "block", this.style.position = "relative", this.style.width = `${t}mm`, this.style.height = `${e}mm`, this.style.margin = n > 0 ? `${n}mm` : "", this.style.overflow = n > 0 ? "visible" : "hidden", this.applyThemeOverride("bg", "--om-carto-bg"), this.applyThemeOverride("color", "--om-carto-ink"), this.applyThemeOverride("font", "--om-carto-font");
|
|
902
|
-
let i = this.querySelector(`style[${
|
|
903
|
-
i || (i = document.createElement("style"), i.setAttribute(
|
|
902
|
+
let i = this.querySelector(`style[${ce}]`);
|
|
903
|
+
i || (i = document.createElement("style"), i.setAttribute(ce, ""), this.prepend(i));
|
|
904
904
|
const s = t + n * 2, o = e + n * 2;
|
|
905
905
|
i.textContent = `@page { size: ${s}mm ${o}mm; margin: 0; }
|
|
906
906
|
@media print { html, body { margin: 0; padding: 0; } om-cartograph { break-after: page; } }`, this.renderPrintMarks(t, e, n), this.applyCvd(), this.refreshTokens(), this.renderCredit(), this.renderAttribution();
|
|
@@ -915,13 +915,13 @@ class Qe extends O {
|
|
|
915
915
|
* worse than no guide.
|
|
916
916
|
*/
|
|
917
917
|
renderPrintMarks(t, e, n) {
|
|
918
|
-
const i = this.hasAttribute("crop-marks") && n > 0, s = Number(this.getAttribute("safe-zone")), o = Number.isFinite(s) && s > 0, a = this.querySelector(`:scope > [${
|
|
918
|
+
const i = this.hasAttribute("crop-marks") && n > 0, s = Number(this.getAttribute("safe-zone")), o = Number.isFinite(s) && s > 0, a = this.querySelector(`:scope > [${ue}]`);
|
|
919
919
|
if (!i && !o) {
|
|
920
920
|
a?.remove();
|
|
921
921
|
return;
|
|
922
922
|
}
|
|
923
923
|
const l = this.ownerDocument, c = a ?? l.createElementNS(Ct, "svg");
|
|
924
|
-
if (c.setAttribute(
|
|
924
|
+
if (c.setAttribute(ue, ""), c.setAttribute("viewBox", `${-n} ${-n} ${t + n * 2} ${e + n * 2}`), c.setAttribute("width", `${t + n * 2}mm`), c.setAttribute("height", `${e + n * 2}mm`), c.style.cssText = `position:absolute;left:${-n}mm;top:${-n}mm;pointer-events:none;z-index:2147483646;`, c.replaceChildren(), i) {
|
|
925
925
|
const u = Math.min(n, 4), h = Math.min(n * 0.35, 1.5), d = [];
|
|
926
926
|
for (const m of [0, t])
|
|
927
927
|
for (const f of [0, e]) {
|
|
@@ -948,7 +948,7 @@ class Qe extends O {
|
|
|
948
948
|
* injected only when a page actually asks for one.
|
|
949
949
|
*/
|
|
950
950
|
applyCvd() {
|
|
951
|
-
const t =
|
|
951
|
+
const t = Gt(this.getAttribute("cvd"));
|
|
952
952
|
if (!t) {
|
|
953
953
|
this.style.removeProperty("filter");
|
|
954
954
|
return;
|
|
@@ -987,7 +987,7 @@ function en({ text: r, maxWidth: t, fontSizePx: e, lineHeightPx: n, measure: i }
|
|
|
987
987
|
c.baselineY = a + u * s, c.width > l && (l = c.width);
|
|
988
988
|
}), { lines: o, lineHeight: s, maxWidth: l };
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function Fi(r) {
|
|
991
991
|
if (typeof document > "u") return null;
|
|
992
992
|
const e = document.createElement("canvas").getContext("2d");
|
|
993
993
|
return e ? (e.font = r, (n) => e.measureText(n).width) : null;
|
|
@@ -1048,19 +1048,19 @@ function on(r, t, e = sn) {
|
|
|
1048
1048
|
const n = (t[1] - r[1]) * ot, i = (t[0] - r[0]) * ot, s = r[1] * ot, o = t[1] * ot, a = Math.sin(n / 2) ** 2 + Math.cos(s) * Math.cos(o) * Math.sin(i / 2) ** 2;
|
|
1049
1049
|
return 2 * e * Math.asin(Math.min(1, Math.sqrt(a)));
|
|
1050
1050
|
}
|
|
1051
|
-
const et = 6378137,
|
|
1052
|
-
function
|
|
1053
|
-
const e = Math.max(-
|
|
1054
|
-
return [et * r *
|
|
1051
|
+
const et = 6378137, de = Math.PI / 180, fe = 180 / Math.PI, pe = 85.0511287798066, It = 2 * Math.PI * et / 360;
|
|
1052
|
+
function Kt([r, t]) {
|
|
1053
|
+
const e = Math.max(-pe, Math.min(pe, t));
|
|
1054
|
+
return [et * r * de, et * Math.log(Math.tan(Math.PI / 4 + e * de / 2))];
|
|
1055
1055
|
}
|
|
1056
1056
|
function pt([r, t]) {
|
|
1057
|
-
return [r / et *
|
|
1057
|
+
return [r / et * fe, (2 * Math.atan(Math.exp(t / et)) - Math.PI / 2) * fe];
|
|
1058
1058
|
}
|
|
1059
1059
|
const an = {
|
|
1060
1060
|
code: "EPSG:3857",
|
|
1061
1061
|
units: "linear",
|
|
1062
1062
|
metresPerUnit: 1,
|
|
1063
|
-
forward:
|
|
1063
|
+
forward: Kt,
|
|
1064
1064
|
inverse: pt
|
|
1065
1065
|
}, ln = {
|
|
1066
1066
|
code: "EPSG:4326",
|
|
@@ -1069,69 +1069,110 @@ const an = {
|
|
|
1069
1069
|
forward: ([r, t]) => [r, t],
|
|
1070
1070
|
inverse: ([r, t]) => [r, t]
|
|
1071
1071
|
};
|
|
1072
|
-
function
|
|
1072
|
+
function Vt(r) {
|
|
1073
1073
|
if (r == null) return null;
|
|
1074
1074
|
const t = r.trim();
|
|
1075
1075
|
if (t === "") return null;
|
|
1076
|
-
|
|
1077
|
-
|
|
1076
|
+
if (/^(?:urn:ogc:def:crs:)?OGC:(?:1\.3:)?CRS84$/i.test(t) || /^CRS:?84$/i.test(t)) return "EPSG:4326";
|
|
1077
|
+
const e = /^urn:ogc:def:crs:EPSG:[\d.]*:(\d{4,6})$/i.exec(t);
|
|
1078
|
+
if (e) return `EPSG:${e[1]}`;
|
|
1079
|
+
const n = /^(?:epsg:{1,2})?(\d{4,6})$/i.exec(t);
|
|
1080
|
+
return n ? `EPSG:${n[1]}` : t.toUpperCase();
|
|
1078
1081
|
}
|
|
1079
1082
|
function er(r) {
|
|
1080
|
-
const t =
|
|
1083
|
+
const t = Vt(r) ?? "EPSG:3857";
|
|
1081
1084
|
return t === "EPSG:3857" || t === "EPSG:900913" ? an : t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84" ? ln : null;
|
|
1082
1085
|
}
|
|
1083
1086
|
const rr = /* @__PURE__ */ new Map();
|
|
1084
|
-
function
|
|
1087
|
+
function cn(r, t) {
|
|
1085
1088
|
return !Number.isInteger(r) || r < 1 || r > 60 ? null : `+proj=utm +zone=${r}${t === "S" ? " +south" : ""} +datum=WGS84 +units=m +no_defs`;
|
|
1086
1089
|
}
|
|
1087
|
-
|
|
1090
|
+
const un = [
|
|
1091
|
+
{ from: 32601, to: 32660, firstZone: 1, south: !1, datum: "+datum=WGS84" },
|
|
1092
|
+
// WGS 84 / UTM N
|
|
1093
|
+
{ from: 32701, to: 32760, firstZone: 1, south: !0, datum: "+datum=WGS84" },
|
|
1094
|
+
// WGS 84 / UTM S
|
|
1095
|
+
{ from: 25828, to: 25838, firstZone: 28, south: !1, datum: "+ellps=GRS80 +towgs84=0,0,0,0,0,0,0" },
|
|
1096
|
+
// ETRS89 / UTM 28N–38N
|
|
1097
|
+
{ from: 26901, to: 26923, firstZone: 1, south: !1, datum: "+datum=NAD83" },
|
|
1098
|
+
// NAD83 / UTM 1N–23N
|
|
1099
|
+
{ from: 28348, to: 28358, firstZone: 48, south: !0, datum: "+ellps=GRS80 +towgs84=0,0,0,0,0,0,0" },
|
|
1100
|
+
// GDA94 / MGA 48–58
|
|
1101
|
+
{ from: 7846, to: 7859, firstZone: 46, south: !0, datum: "+ellps=GRS80 +towgs84=0,0,0,0,0,0,0" }
|
|
1102
|
+
// GDA2020 / MGA 46–59
|
|
1103
|
+
];
|
|
1104
|
+
function hn(r) {
|
|
1105
|
+
for (const t of un)
|
|
1106
|
+
if (!(r < t.from || r > t.to))
|
|
1107
|
+
return `+proj=utm +zone=${t.firstZone + (r - t.from)}${t.south ? " +south" : ""} ${t.datum} +units=m +no_defs`;
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1110
|
+
const mn = {}, ge = /* @__PURE__ */ new Map();
|
|
1111
|
+
function dn(r) {
|
|
1112
|
+
let t = ge.get(r);
|
|
1113
|
+
return t || (t = (mn.fetch ?? ((n) => fetch(n)))(`https://epsg.io/${r}.proj4`).then(async (n) => {
|
|
1114
|
+
if (!n.ok) return null;
|
|
1115
|
+
const i = (await n.text()).trim();
|
|
1116
|
+
return i.startsWith("+proj=") ? i : null;
|
|
1117
|
+
}).catch(() => null), ge.set(r, t)), t;
|
|
1118
|
+
}
|
|
1119
|
+
async function fn(r) {
|
|
1088
1120
|
const t = rr.get(r);
|
|
1089
1121
|
if (typeof t == "string") return t;
|
|
1090
1122
|
const e = Number(/^EPSG:(\d+)$/.exec(r)?.[1]);
|
|
1091
1123
|
if (!Number.isFinite(e)) return null;
|
|
1092
|
-
|
|
1093
|
-
if (
|
|
1094
|
-
const
|
|
1095
|
-
return
|
|
1124
|
+
const { CRS_DEFS: n, COMPOUND_TO_HORIZONTAL: i } = await import("./crs-ZdDBJ2EY.js"), s = i[e] ?? e, o = hn(s);
|
|
1125
|
+
if (o) return o;
|
|
1126
|
+
const a = n[s]?.def;
|
|
1127
|
+
return a || dn(s);
|
|
1096
1128
|
}
|
|
1097
|
-
function
|
|
1129
|
+
function pn(r) {
|
|
1098
1130
|
if (r.projName === "longlat") return { units: "degree", metresPerUnit: It };
|
|
1099
1131
|
if (typeof r.to_meter == "number" && r.to_meter > 0) return { units: "linear", metresPerUnit: r.to_meter };
|
|
1100
1132
|
const t = (r.units ?? "m").toLowerCase();
|
|
1101
1133
|
return t.startsWith("deg") ? { units: "degree", metresPerUnit: It } : t.includes("ft") || t.includes("foot") ? { units: "linear", metresPerUnit: 0.3048 } : { units: "linear", metresPerUnit: 1 };
|
|
1102
1134
|
}
|
|
1103
|
-
async function
|
|
1104
|
-
const e =
|
|
1135
|
+
async function gn(r, t) {
|
|
1136
|
+
const e = Vt(r) ?? "EPSG:3857", n = rr.get(e);
|
|
1105
1137
|
if (n && typeof n != "string") return n;
|
|
1106
1138
|
if (!t) {
|
|
1107
|
-
const
|
|
1108
|
-
if (
|
|
1139
|
+
const s = er(e);
|
|
1140
|
+
if (s) return s;
|
|
1109
1141
|
}
|
|
1110
|
-
const i = t?.trim() || await
|
|
1111
|
-
|
|
1112
|
-
|
|
1142
|
+
const i = t?.trim() || await fn(e);
|
|
1143
|
+
return i ? bn(e, i) : null;
|
|
1144
|
+
}
|
|
1145
|
+
async function bn(r, t) {
|
|
1146
|
+
const e = (await import("./index-CcLC9jE5.js")).default, n = "+proj=longlat +datum=WGS84 +no_defs";
|
|
1147
|
+
let i, s;
|
|
1148
|
+
try {
|
|
1149
|
+
i = e(t, n), s = new e.Proj(t);
|
|
1150
|
+
} catch {
|
|
1151
|
+
return null;
|
|
1152
|
+
}
|
|
1153
|
+
const { units: o, metresPerUnit: a } = pn(s);
|
|
1113
1154
|
return {
|
|
1114
|
-
code:
|
|
1115
|
-
units:
|
|
1116
|
-
metresPerUnit:
|
|
1117
|
-
forward: (
|
|
1118
|
-
inverse: (
|
|
1155
|
+
code: r,
|
|
1156
|
+
units: o,
|
|
1157
|
+
metresPerUnit: a,
|
|
1158
|
+
forward: (l) => i.inverse(l),
|
|
1159
|
+
inverse: (l) => i.forward(l)
|
|
1119
1160
|
};
|
|
1120
1161
|
}
|
|
1121
|
-
const be = Math.PI / 180,
|
|
1122
|
-
function
|
|
1162
|
+
const be = Math.PI / 180, yn = 180 / Math.PI, wn = { code: "EPSG:3857", forward: Kt, inverse: pt }, Oi = Kt, _i = pt, ye = 6378137, we = 89.9;
|
|
1163
|
+
function vn([r, t]) {
|
|
1123
1164
|
const e = Math.max(-we, Math.min(we, t));
|
|
1124
1165
|
return [ye * r * be, ye * Math.log(Math.tan(Math.PI / 4 + e * be / 2))];
|
|
1125
1166
|
}
|
|
1126
|
-
const
|
|
1167
|
+
const An = { code: "EPSG:3857", forward: vn, inverse: pt }, Ft = Vt;
|
|
1127
1168
|
function Y(r) {
|
|
1128
1169
|
return er(r);
|
|
1129
1170
|
}
|
|
1130
|
-
async function
|
|
1131
|
-
return
|
|
1171
|
+
async function Ot(r, t) {
|
|
1172
|
+
return gn(r, t);
|
|
1132
1173
|
}
|
|
1133
|
-
const
|
|
1134
|
-
function
|
|
1174
|
+
const Ui = cn;
|
|
1175
|
+
function Mn(r, t) {
|
|
1135
1176
|
const e = t.length, n = r.map((i, s) => [...i, t[s]]);
|
|
1136
1177
|
for (let i = 0; i < e; i++) {
|
|
1137
1178
|
let s = i;
|
|
@@ -1147,14 +1188,14 @@ function gn(r, t) {
|
|
|
1147
1188
|
}
|
|
1148
1189
|
return n.map((i, s) => i[e] / i[s]);
|
|
1149
1190
|
}
|
|
1150
|
-
function
|
|
1191
|
+
function Sn(r, t) {
|
|
1151
1192
|
if (r.length !== 4 || t.length !== 4) return null;
|
|
1152
1193
|
const e = r.reduce((h, d) => h + d[0], 0) / 4, n = r.reduce((h, d) => h + d[1], 0) / 4, i = r.reduce((h, d) => h + Math.hypot(d[0] - e, d[1] - n), 0) / 4, s = i > 1e-12 ? Math.SQRT2 / i : 1, o = (h) => [(h[0] - e) * s, (h[1] - n) * s], a = [], l = [];
|
|
1153
1194
|
for (let h = 0; h < 4; h++) {
|
|
1154
1195
|
const [d, m] = o(r[h]), [f, g] = t[h];
|
|
1155
1196
|
a.push([d, m, 1, 0, 0, 0, -d * f, -m * f]), l.push(f), a.push([0, 0, 0, d, m, 1, -d * g, -m * g]), l.push(g);
|
|
1156
1197
|
}
|
|
1157
|
-
const c =
|
|
1198
|
+
const c = Mn(a, l);
|
|
1158
1199
|
if (!c || c.some((h) => !Number.isFinite(h))) return null;
|
|
1159
1200
|
const u = (h) => [h[0] / s + e, h[1] / s + n];
|
|
1160
1201
|
return { matrix: [c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], 1], normalize: o, denormalize: u };
|
|
@@ -1163,7 +1204,7 @@ function ve(r, [t, e]) {
|
|
|
1163
1204
|
const n = r[6] * t + r[7] * e + r[8];
|
|
1164
1205
|
return Math.abs(n) < 1e-12 ? null : [(r[0] * t + r[1] * e + r[2]) / n, (r[3] * t + r[4] * e + r[5]) / n];
|
|
1165
1206
|
}
|
|
1166
|
-
function
|
|
1207
|
+
function Cn(r) {
|
|
1167
1208
|
const [t, e, n, i, s, o, a, l, c] = r, u = t * (s * c - o * l) - e * (i * c - o * a) + n * (i * l - s * a);
|
|
1168
1209
|
return !Number.isFinite(u) || Math.abs(u) < 1e-15 ? null : [
|
|
1169
1210
|
(s * c - o * l) / u,
|
|
@@ -1177,7 +1218,7 @@ function yn(r) {
|
|
|
1177
1218
|
(t * s - e * i) / u
|
|
1178
1219
|
];
|
|
1179
1220
|
}
|
|
1180
|
-
function
|
|
1221
|
+
function xn(r, t) {
|
|
1181
1222
|
let e = r;
|
|
1182
1223
|
for (; e - t > 180; ) e -= 360;
|
|
1183
1224
|
for (; t - e > 180; ) e += 360;
|
|
@@ -1188,12 +1229,12 @@ const nr = (r) => {
|
|
|
1188
1229
|
return t === -180 && (t = 180), t;
|
|
1189
1230
|
};
|
|
1190
1231
|
function tt({ corners: r, widthMm: t, heightMm: e, crsForward: n, continuous: i = !1 }) {
|
|
1191
|
-
const s = n ?? (i ?
|
|
1232
|
+
const s = n ?? (i ? An : wn), o = r[0][0], a = (b) => i ? b : xn(b, o), l = (b) => i ? b : nr(b), c = r.map(([b, w]) => [a(b), w]), u = c.map((b) => s.forward(b)), h = [
|
|
1192
1233
|
[0, 0],
|
|
1193
1234
|
[t, 0],
|
|
1194
1235
|
[t, e],
|
|
1195
1236
|
[0, e]
|
|
1196
|
-
], d = t > 0 && e > 0 ?
|
|
1237
|
+
], d = t > 0 && e > 0 ? Sn(u, h) : null, m = d ? Cn(d.matrix) : null, f = !d || !m, g = (b, w = i ? 16 : 1) => {
|
|
1197
1238
|
let y = 0, A = p.unproject(0, b);
|
|
1198
1239
|
if (!A) return null;
|
|
1199
1240
|
for (let v = 1; v <= w; v++) {
|
|
@@ -1265,16 +1306,16 @@ function X(r) {
|
|
|
1265
1306
|
}
|
|
1266
1307
|
return e;
|
|
1267
1308
|
}
|
|
1268
|
-
function
|
|
1309
|
+
function kn(r) {
|
|
1269
1310
|
if (r.degenerate) return null;
|
|
1270
1311
|
const t = r.unproject(r.widthMm / 2, r.heightMm / 2);
|
|
1271
1312
|
if (!t) return null;
|
|
1272
1313
|
const n = [t[0], Math.min(89.9, Math.max(-89.9, t[1] + 0.01))], i = r.project(t), s = r.project(n);
|
|
1273
1314
|
if (!i || !s) return null;
|
|
1274
1315
|
const o = s.xMm - i.xMm, a = s.yMm - i.yMm;
|
|
1275
|
-
return Math.abs(o) < 1e-12 && Math.abs(a) < 1e-12 ? null : (Math.atan2(o, -a) *
|
|
1316
|
+
return Math.abs(o) < 1e-12 && Math.abs(a) < 1e-12 ? null : (Math.atan2(o, -a) * yn % 360 + 360) % 360;
|
|
1276
1317
|
}
|
|
1277
|
-
function
|
|
1318
|
+
function $n(r) {
|
|
1278
1319
|
if (r.degenerate) return null;
|
|
1279
1320
|
const { widthMm: t, heightMm: e } = r, n = [];
|
|
1280
1321
|
for (const o of [0.02, 0.5, 0.98]) {
|
|
@@ -1285,7 +1326,7 @@ function An(r) {
|
|
|
1285
1326
|
const i = Math.min(...n), s = Math.max(...n);
|
|
1286
1327
|
return i > 0 ? (s - i) / i : null;
|
|
1287
1328
|
}
|
|
1288
|
-
function
|
|
1329
|
+
function Di(r, t, e, n) {
|
|
1289
1330
|
return [
|
|
1290
1331
|
[r, n],
|
|
1291
1332
|
[e, n],
|
|
@@ -1293,8 +1334,8 @@ function Ri(r, t, e, n) {
|
|
|
1293
1334
|
[r, t]
|
|
1294
1335
|
];
|
|
1295
1336
|
}
|
|
1296
|
-
const
|
|
1297
|
-
function
|
|
1337
|
+
const En = (r) => r.toLowerCase().startsWith("on");
|
|
1338
|
+
function Nn(r, t) {
|
|
1298
1339
|
const e = (n) => {
|
|
1299
1340
|
const i = n.tagName.toLowerCase();
|
|
1300
1341
|
if (i === "script") {
|
|
@@ -1305,7 +1346,7 @@ function Sn(r, t) {
|
|
|
1305
1346
|
if (i === "style" || i === "link" || i === "iframe" || i === "object" || i === "embed") return null;
|
|
1306
1347
|
const s = t.createElement(i);
|
|
1307
1348
|
for (const o of n.attributes)
|
|
1308
|
-
|
|
1349
|
+
En(o.name) || /^\s*javascript:/i.test(o.value) || s.setAttribute(o.name, o.value);
|
|
1309
1350
|
for (const o of n.childNodes)
|
|
1310
1351
|
if (o.nodeType === 3) s.appendChild(t.createTextNode(o.textContent ?? ""));
|
|
1311
1352
|
else if (o.nodeType === 1) {
|
|
@@ -1316,12 +1357,12 @@ function Sn(r, t) {
|
|
|
1316
1357
|
};
|
|
1317
1358
|
return e(r);
|
|
1318
1359
|
}
|
|
1319
|
-
async function
|
|
1360
|
+
async function Pn(r, t = document) {
|
|
1320
1361
|
const e = await fetch(r, { credentials: "same-origin", cache: "no-store" });
|
|
1321
1362
|
if (!e.ok) throw new Error(`fetching ${r} failed with HTTP ${e.status}`);
|
|
1322
1363
|
const n = await e.text(), s = new DOMParser().parseFromString(n, "text/html").querySelector("om-map");
|
|
1323
1364
|
if (!s) throw new Error(`${r} contains no <om-map>`);
|
|
1324
|
-
const o =
|
|
1365
|
+
const o = Nn(s, t);
|
|
1325
1366
|
if (!o) throw new Error(`${r} could not be adopted`);
|
|
1326
1367
|
return o;
|
|
1327
1368
|
}
|
|
@@ -1346,8 +1387,8 @@ function mt(r) {
|
|
|
1346
1387
|
pitch: Number(r.getAttribute("pitch")) || 0
|
|
1347
1388
|
};
|
|
1348
1389
|
}
|
|
1349
|
-
function
|
|
1350
|
-
const s = (l) =>
|
|
1390
|
+
function ji(r, t, e, n, i = 60) {
|
|
1391
|
+
const s = (l) => _t(r, { ...t, pitch: l }, e, n) !== null;
|
|
1351
1392
|
if (s(i)) return i;
|
|
1352
1393
|
if (!s(0)) return 0;
|
|
1353
1394
|
let o = 0, a = i;
|
|
@@ -1357,7 +1398,7 @@ function Ii(r, t, e, n, i = 60) {
|
|
|
1357
1398
|
}
|
|
1358
1399
|
return o;
|
|
1359
1400
|
}
|
|
1360
|
-
function
|
|
1401
|
+
function _t(r, t, e, n) {
|
|
1361
1402
|
if (!(e > 0) || !(n > 0)) return null;
|
|
1362
1403
|
const i = new r.WebMercatorViewport({
|
|
1363
1404
|
width: e,
|
|
@@ -1380,44 +1421,44 @@ function Ut(r, t, e, n) {
|
|
|
1380
1421
|
}
|
|
1381
1422
|
return o;
|
|
1382
1423
|
}
|
|
1383
|
-
async function
|
|
1424
|
+
async function Tn(r, t) {
|
|
1384
1425
|
const e = await Fe();
|
|
1385
1426
|
if (t && typeof t != "string") return { core: e, map: t };
|
|
1386
1427
|
if (!t) throw new Error("a live frame needs src= or an inline <om-map> child");
|
|
1387
|
-
const n = await
|
|
1428
|
+
const n = await Pn(t, r.ownerDocument);
|
|
1388
1429
|
return { core: e, map: n };
|
|
1389
1430
|
}
|
|
1390
1431
|
function xt(r, t) {
|
|
1391
|
-
r.setAttribute("center", JSON.stringify(t.center)), r.setAttribute("zoom", String(t.zoom)), r.setAttribute("bearing", String(t.bearing)), r.setAttribute("pitch", String(t.pitch)),
|
|
1432
|
+
r.setAttribute("center", JSON.stringify(t.center)), r.setAttribute("zoom", String(t.zoom)), r.setAttribute("bearing", String(t.bearing)), r.setAttribute("pitch", String(t.pitch)), Ln(r, t);
|
|
1392
1433
|
}
|
|
1393
|
-
function
|
|
1434
|
+
function Ln(r, t) {
|
|
1394
1435
|
const e = r;
|
|
1395
1436
|
typeof e.setViewInternal == "function" ? e.setViewInternal({ longitude: t.center[0], latitude: t.center[1], zoom: t.zoom, pitch: t.pitch, bearing: t.bearing }) : typeof e.flyTo == "function" && e.flyTo(t.center, t.zoom, { duration: 0 });
|
|
1396
1437
|
}
|
|
1397
|
-
const
|
|
1398
|
-
function
|
|
1438
|
+
const Rn = [".png", ".jpg", ".jpeg", ".webp", ".avif", ".gif", ".svg"], In = [".html", ".htm"];
|
|
1439
|
+
function Ut(r) {
|
|
1399
1440
|
const t = r.trim().split(/[?#]/, 1)[0]?.toLowerCase() ?? "";
|
|
1400
|
-
return
|
|
1441
|
+
return In.some((e) => t.endsWith(e)) ? "map" : Rn.some((e) => t.endsWith(e)) ? "raster" : null;
|
|
1401
1442
|
}
|
|
1402
|
-
function
|
|
1443
|
+
function Fn(r, t) {
|
|
1403
1444
|
const e = [], n = [...r.children].find(
|
|
1404
1445
|
(o) => o.tagName.toLowerCase() === "om-map" && o !== t
|
|
1405
1446
|
);
|
|
1406
1447
|
n && e.push({ kind: "inline", key: "inline", el: r, map: n });
|
|
1407
1448
|
const i = r.getAttribute("src")?.trim();
|
|
1408
|
-
i && e.push({ kind:
|
|
1449
|
+
i && e.push({ kind: Ut(i) ?? "map", key: `src:${i}`, el: r, src: i });
|
|
1409
1450
|
let s = 0;
|
|
1410
1451
|
for (const o of r.children) {
|
|
1411
1452
|
if (o.tagName.toLowerCase() !== "om-source") continue;
|
|
1412
1453
|
const a = o.getAttribute("src")?.trim();
|
|
1413
|
-
a && e.push({ kind:
|
|
1454
|
+
a && e.push({ kind: Ut(a) ?? "map", key: `source:${s++}:${a}`, el: o, src: a });
|
|
1414
1455
|
}
|
|
1415
1456
|
return e;
|
|
1416
1457
|
}
|
|
1417
|
-
function
|
|
1458
|
+
function On(r) {
|
|
1418
1459
|
return r.map((t) => t.key).join("|");
|
|
1419
1460
|
}
|
|
1420
|
-
async function
|
|
1461
|
+
async function _n(r, t, e) {
|
|
1421
1462
|
const n = Math.max(1, Math.round(t.w * e)), i = Math.max(1, Math.round(t.h * e)), s = r.cloneNode(!0);
|
|
1422
1463
|
s.removeAttribute("style"), s.setAttribute("width", String(n)), s.setAttribute("height", String(i)), s.setAttribute("preserveAspectRatio", "none");
|
|
1423
1464
|
const o = new XMLSerializer().serializeToString(s), a = new Image();
|
|
@@ -1520,7 +1561,7 @@ class ir extends O {
|
|
|
1520
1561
|
}
|
|
1521
1562
|
const n = this.georefHost, i = X(n.getAttribute("corners"));
|
|
1522
1563
|
if (!i) return null;
|
|
1523
|
-
const s =
|
|
1564
|
+
const s = Ft(n.getAttribute("crs")) ?? "EPSG:3857", o = n.getAttribute("crs-def");
|
|
1524
1565
|
let a = o ? null : Y(s);
|
|
1525
1566
|
return !a && this.resolvedForwardKey === `${s}|${o ?? ""}` && (a = this.resolvedForward), a ? tt({ corners: i, widthMm: t, heightMm: e, crsForward: a }) : null;
|
|
1526
1567
|
}
|
|
@@ -1535,7 +1576,7 @@ class ir extends O {
|
|
|
1535
1576
|
if (this.resolvedForwardKey === e || this.pendingLiveCrs === e) return;
|
|
1536
1577
|
this.pendingLiveCrs = e;
|
|
1537
1578
|
const n = ++this.resolveToken;
|
|
1538
|
-
|
|
1579
|
+
Ot(t, null).then((i) => {
|
|
1539
1580
|
if (n === this.resolveToken) {
|
|
1540
1581
|
if (this.pendingLiveCrs = null, !i) {
|
|
1541
1582
|
this.showPlaceholder("unknown-crs", `The map in this frame is projected to "${t}", which could not be resolved.`);
|
|
@@ -1597,10 +1638,10 @@ class ir extends O {
|
|
|
1597
1638
|
}
|
|
1598
1639
|
const e = t.style;
|
|
1599
1640
|
e.position = "absolute", e.inset = "0", e.width = "100%", e.height = "100%", e.display = "block", t instanceof SVGSVGElement ? t.setAttribute("preserveAspectRatio", "none") : e.objectFit = "fill";
|
|
1600
|
-
const n =
|
|
1641
|
+
const n = Ft(this.getAttribute("crs")) ?? "EPSG:3857", i = this.getAttribute("crs-def"), s = `${n}|${i ?? ""}`;
|
|
1601
1642
|
if ((i != null || Y(n) == null) && this.resolvedForwardKey !== s) {
|
|
1602
1643
|
const a = ++this.resolveToken;
|
|
1603
|
-
this.resolvedForward = null, this.resolvedForwardKey = null,
|
|
1644
|
+
this.resolvedForward = null, this.resolvedForwardKey = null, Ot(n, i).then((l) => {
|
|
1604
1645
|
if (a === this.resolveToken) {
|
|
1605
1646
|
if (!l) {
|
|
1606
1647
|
this.showPlaceholder("unknown-crs", `Unknown CRS "${n}" — supply crs-def="+proj=…".`);
|
|
@@ -1639,7 +1680,7 @@ class ir extends O {
|
|
|
1639
1680
|
this.showPlaceholder("no-source", "Live frame needs src=, an <om-source> child, or an inline <om-map>.");
|
|
1640
1681
|
return;
|
|
1641
1682
|
}
|
|
1642
|
-
const o =
|
|
1683
|
+
const o = On(s);
|
|
1643
1684
|
o !== this.knownSourceList && (this.knownSourceList = o, this.sourceCursor = 0, this.settledSource = null, this.removeAttribute(Ae));
|
|
1644
1685
|
const a = Math.min(this.sourceCursor, s.length - 1), l = s[a];
|
|
1645
1686
|
if (l.kind === "raster") {
|
|
@@ -1689,7 +1730,7 @@ class ir extends O {
|
|
|
1689
1730
|
* inline source on the next render.
|
|
1690
1731
|
*/
|
|
1691
1732
|
sources() {
|
|
1692
|
-
return
|
|
1733
|
+
return Fn(this, this.liveMapOwned ? this.liveMap : null);
|
|
1693
1734
|
}
|
|
1694
1735
|
/**
|
|
1695
1736
|
* Move to the next source, or report that there is none.
|
|
@@ -1758,9 +1799,9 @@ class ir extends O {
|
|
|
1758
1799
|
}
|
|
1759
1800
|
updateLiveCorners(t = mt(this)) {
|
|
1760
1801
|
if (!t) return;
|
|
1761
|
-
const e =
|
|
1802
|
+
const e = Z();
|
|
1762
1803
|
if (!e) return;
|
|
1763
|
-
const { w: n, h: i } = S(this), o = this.liveMap?.groundCorners?.(n * D, i * D) ??
|
|
1804
|
+
const { w: n, h: i } = S(this), o = this.liveMap?.groundCorners?.(n * D, i * D) ?? _t(e, t, n * D, i * D), a = JSON.stringify(o) !== JSON.stringify(this.liveCorners);
|
|
1764
1805
|
this.liveCorners = o, a && this.liveMap && this.dispatchEvent(new CustomEvent("om-frame-view", { bubbles: !0, detail: { id: this.id } })), this.applyReferenceScale(), o ? this.lastError === "degenerate-view" && this.clearPlaceholder() : this.showPlaceholder("degenerate-view", "This frame's box cannot be georeferenced — give it a positive width and height.");
|
|
1765
1806
|
}
|
|
1766
1807
|
async mountLive(t, e, n) {
|
|
@@ -1768,7 +1809,7 @@ class ir extends O {
|
|
|
1768
1809
|
this.mounting = !0, this.mountingSource = t.key;
|
|
1769
1810
|
let s = !1;
|
|
1770
1811
|
try {
|
|
1771
|
-
const { core: o, map: a } = await
|
|
1812
|
+
const { core: o, map: a } = await Tn(this, t.map ?? t.src);
|
|
1772
1813
|
if (i !== this.mountToken || !this.isConnected || this.mode !== "live") return;
|
|
1773
1814
|
const l = mt(this);
|
|
1774
1815
|
if (!l) return;
|
|
@@ -1776,7 +1817,7 @@ class ir extends O {
|
|
|
1776
1817
|
const c = a;
|
|
1777
1818
|
c.style.position = "absolute", c.style.inset = "0", c.style.display = "block", a.setAttribute("data-om-carto-frame", ""), this.liveMapOwned = a.parentElement !== this, this.liveMapOwned && this.appendChild(a), this.liveMap = c, c.addEventListener("om-view-changed", this.onLiveViewSettled), this.mountedSource = t.key, this.sizeLiveMap(), this.clearPlaceholder();
|
|
1778
1819
|
const { w: u, h } = S(this);
|
|
1779
|
-
if (this.liveCorners =
|
|
1820
|
+
if (this.liveCorners = _t(o, l, u * D, h * D), this.applyReferenceScale(), await c.ready, i !== this.mountToken || (xt(a, l), await c.whenSettled?.({ timeout: 2e4 }), i !== this.mountToken)) return;
|
|
1780
1821
|
if (c.hasDrawableContent?.() === !1) {
|
|
1781
1822
|
if (this.advanceSource(n)) return;
|
|
1782
1823
|
console.warn(
|
|
@@ -1928,7 +1969,7 @@ class ir extends O {
|
|
|
1928
1969
|
}
|
|
1929
1970
|
this.setAttribute("corners", JSON.stringify(n.map(([a, l]) => [Number(a.toFixed(8)), Number(l.toFixed(8))]))), s && s !== "EPSG:3857" ? this.setAttribute("crs", s) : this.removeAttribute("crs");
|
|
1930
1971
|
const o = this.liveMap?.attributions?.() ?? [];
|
|
1931
|
-
return o.length > 0 ? this.setAttribute("attribution", o.join(
|
|
1972
|
+
return o.length > 0 ? this.setAttribute("attribution", o.join(Bt)) : this.removeAttribute("attribution"), this.setAttribute("mode", "static"), this.scheduleRender(), this.dispatchEvent(new CustomEvent("om-attributions-changed", { bubbles: !0 })), !0;
|
|
1932
1973
|
}
|
|
1933
1974
|
/**
|
|
1934
1975
|
* The basemap attribution this frame owes the sheet, as text.
|
|
@@ -1938,9 +1979,9 @@ class ir extends O {
|
|
|
1938
1979
|
* the only source a page without the runtime has.
|
|
1939
1980
|
*/
|
|
1940
1981
|
attributions() {
|
|
1941
|
-
if (this.mode !== "live") return
|
|
1982
|
+
if (this.mode !== "live") return ie(this.getAttribute("attribution"));
|
|
1942
1983
|
const t = this.settledSource;
|
|
1943
|
-
return t?.kind === "raster" ?
|
|
1984
|
+
return t?.kind === "raster" ? ie(t.el.getAttribute("attribution")) : this.liveMap?.attributions?.() ?? [];
|
|
1944
1985
|
}
|
|
1945
1986
|
/**
|
|
1946
1987
|
* Point this frame's camera at a lon/lat box — the atlas's per-page refit.
|
|
@@ -1952,7 +1993,7 @@ class ir extends O {
|
|
|
1952
1993
|
fitBounds(t) {
|
|
1953
1994
|
const [e, n, i, s] = t, { w: o, h: a } = S(this);
|
|
1954
1995
|
if (o <= 0 || a <= 0) return;
|
|
1955
|
-
const l =
|
|
1996
|
+
const l = Z();
|
|
1956
1997
|
if (!l) return;
|
|
1957
1998
|
const c = new l.WebMercatorViewport({ width: o * D, height: a * D, longitude: 0, latitude: 0, zoom: 0 }).fitBounds([
|
|
1958
1999
|
[e, n],
|
|
@@ -1977,7 +2018,7 @@ class ir extends O {
|
|
|
1977
2018
|
return;
|
|
1978
2019
|
}
|
|
1979
2020
|
const e = this.vector;
|
|
1980
|
-
e && (this.captureImage = await
|
|
2021
|
+
e && (this.captureImage = await _n(e, S(this), t.pxPerMm));
|
|
1981
2022
|
}
|
|
1982
2023
|
/** Export hook: forget the capture, so a failed pre-pass never reuses it. */
|
|
1983
2024
|
discardCartograph() {
|
|
@@ -2016,7 +2057,7 @@ class ir extends O {
|
|
|
2016
2057
|
}
|
|
2017
2058
|
}
|
|
2018
2059
|
x("om-frame", ir);
|
|
2019
|
-
const at = "http://www.w3.org/2000/svg",
|
|
2060
|
+
const at = "http://www.w3.org/2000/svg", Un = ["single", "double", "line", "ticks"];
|
|
2020
2061
|
class sr extends O {
|
|
2021
2062
|
static observedAttributes = [...T["om-scalebar"]];
|
|
2022
2063
|
/** The geometry currently drawn — reused by the canvas exporter. */
|
|
@@ -2034,7 +2075,7 @@ class sr extends O {
|
|
|
2034
2075
|
}
|
|
2035
2076
|
get barStyle() {
|
|
2036
2077
|
const t = this.getAttribute("kind");
|
|
2037
|
-
return
|
|
2078
|
+
return Un.includes(t) ? t : "single";
|
|
2038
2079
|
}
|
|
2039
2080
|
get unitSystem() {
|
|
2040
2081
|
return qr(this.getAttribute("units")) ?? "metric";
|
|
@@ -2094,7 +2135,7 @@ class or extends O {
|
|
|
2094
2135
|
/** Degrees clockwise from the page's "up", or null when unknowable. */
|
|
2095
2136
|
get bearing() {
|
|
2096
2137
|
const t = U(this)?.georef;
|
|
2097
|
-
return t ?
|
|
2138
|
+
return t ? kn(t) : null;
|
|
2098
2139
|
}
|
|
2099
2140
|
get indicatorKind() {
|
|
2100
2141
|
return this.getAttribute("kind") === "rose" ? "rose" : "arrow";
|
|
@@ -2136,12 +2177,12 @@ class or extends O {
|
|
|
2136
2177
|
}
|
|
2137
2178
|
}
|
|
2138
2179
|
x("om-north", or);
|
|
2139
|
-
const lt = "http://www.w3.org/2000/svg",
|
|
2180
|
+
const lt = "http://www.w3.org/2000/svg", Dn = ["rect", "ellipse", "line", "arrow"];
|
|
2140
2181
|
class ar extends O {
|
|
2141
2182
|
static observedAttributes = [...T["om-shape"]];
|
|
2142
2183
|
get kind() {
|
|
2143
2184
|
const t = this.getAttribute("kind");
|
|
2144
|
-
return
|
|
2185
|
+
return Dn.includes(t) ? t : "rect";
|
|
2145
2186
|
}
|
|
2146
2187
|
get fill() {
|
|
2147
2188
|
return this.getAttribute("fill") || "var(--om-carto-shape-fill)";
|
|
@@ -2199,12 +2240,12 @@ class ar extends O {
|
|
|
2199
2240
|
}
|
|
2200
2241
|
}
|
|
2201
2242
|
x("om-shape", ar);
|
|
2202
|
-
const xe = "data-om-carto-owned",
|
|
2243
|
+
const xe = "data-om-carto-owned", jn = ["contain", "cover", "fill"];
|
|
2203
2244
|
class lr extends O {
|
|
2204
2245
|
static observedAttributes = [...T["om-image"]];
|
|
2205
2246
|
get fit() {
|
|
2206
2247
|
const t = this.getAttribute("fit");
|
|
2207
|
-
return
|
|
2248
|
+
return jn.includes(t ?? "") ? t : "contain";
|
|
2208
2249
|
}
|
|
2209
2250
|
get image() {
|
|
2210
2251
|
return this.querySelector(":scope > img");
|
|
@@ -2230,12 +2271,12 @@ class lr extends O {
|
|
|
2230
2271
|
}
|
|
2231
2272
|
}
|
|
2232
2273
|
x("om-image", lr);
|
|
2233
|
-
const
|
|
2234
|
-
function
|
|
2274
|
+
const zn = /* @__PURE__ */ new Set(["PathLayer", "LineLayer", "ArcLayer", "TripsLayer", "GreatCircleLayer", "PathStyleLayer"]), Gn = /* @__PURE__ */ new Set(["ScatterplotLayer", "IconLayer", "TextLayer", "PointCloudLayer", "HeatmapLayer", "ScreenGridLayer"]), qn = /* @__PURE__ */ new Set(["COGLayer", "ZarrLayer", "BitmapLayer", "TerrainLayer", "ImageOverlay"]);
|
|
2275
|
+
function Wn(r) {
|
|
2235
2276
|
const t = r.type ?? "";
|
|
2236
|
-
if (
|
|
2237
|
-
if (
|
|
2238
|
-
if (
|
|
2277
|
+
if (qn.has(t)) return "ramp";
|
|
2278
|
+
if (zn.has(t)) return "line";
|
|
2279
|
+
if (Gn.has(t)) return "point";
|
|
2239
2280
|
if (t === "GeoJsonLayer") {
|
|
2240
2281
|
const e = r.props ?? {}, n = e.getFillColor !== void 0, i = e.getLineColor !== void 0;
|
|
2241
2282
|
if (n && !i) return "polygon";
|
|
@@ -2243,24 +2284,24 @@ function Un(r) {
|
|
|
2243
2284
|
}
|
|
2244
2285
|
return "polygon";
|
|
2245
2286
|
}
|
|
2246
|
-
function
|
|
2287
|
+
function Bn(r) {
|
|
2247
2288
|
const t = r.meta?.legend;
|
|
2248
2289
|
return r.meta?.color ?? (t?.kind === "ramp" ? t.colors[0] : t?.entries[0]?.color) ?? "#999";
|
|
2249
2290
|
}
|
|
2250
2291
|
const Nt = 12;
|
|
2251
|
-
function
|
|
2292
|
+
function Kn(r, t = []) {
|
|
2252
2293
|
const e = [];
|
|
2253
2294
|
for (const n of r) {
|
|
2254
2295
|
if (n.props?.visible === !1) continue;
|
|
2255
2296
|
const i = t.filter((a) => a.layer === n.id), s = i.find((a) => a.match == null);
|
|
2256
2297
|
if (s?.hide) continue;
|
|
2257
|
-
const o =
|
|
2298
|
+
const o = Vn(n.meta?.legend);
|
|
2258
2299
|
e.push({
|
|
2259
2300
|
layerId: n.id,
|
|
2260
2301
|
label: s?.label ?? n.meta?.label ?? n.id,
|
|
2261
|
-
color: s?.color ??
|
|
2262
|
-
shape: s?.shape ??
|
|
2263
|
-
legend:
|
|
2302
|
+
color: s?.color ?? Bn(n),
|
|
2303
|
+
shape: s?.shape ?? Wn(n),
|
|
2304
|
+
legend: Hn(o, i),
|
|
2264
2305
|
order: s?.order
|
|
2265
2306
|
});
|
|
2266
2307
|
}
|
|
@@ -2269,7 +2310,7 @@ function zn(r, t = []) {
|
|
|
2269
2310
|
return s - o || n.index - i.index;
|
|
2270
2311
|
}).map((n) => n.row);
|
|
2271
2312
|
}
|
|
2272
|
-
function
|
|
2313
|
+
function Vn(r) {
|
|
2273
2314
|
if (!r || r.kind !== "categories" || r.entries.length <= Nt) return r;
|
|
2274
2315
|
const t = r.entries.slice(0, Nt), e = r.entries.length - Nt;
|
|
2275
2316
|
return {
|
|
@@ -2277,7 +2318,7 @@ function jn(r) {
|
|
|
2277
2318
|
entries: [...t, { color: r.defaultColor ?? "#999", label: `+${e} more` }]
|
|
2278
2319
|
};
|
|
2279
2320
|
}
|
|
2280
|
-
function
|
|
2321
|
+
function Hn(r, t) {
|
|
2281
2322
|
const e = t.filter((i) => i.match != null);
|
|
2282
2323
|
if (!r || r.kind === "ramp" || e.length === 0) return r;
|
|
2283
2324
|
const n = [];
|
|
@@ -2287,7 +2328,7 @@ function Gn(r, t) {
|
|
|
2287
2328
|
}
|
|
2288
2329
|
return { ...r, entries: n };
|
|
2289
2330
|
}
|
|
2290
|
-
function
|
|
2331
|
+
function Yn(r) {
|
|
2291
2332
|
const t = [];
|
|
2292
2333
|
for (const e of r.querySelectorAll(":scope > om-legend-row")) {
|
|
2293
2334
|
const n = e.getAttribute("layer");
|
|
@@ -2330,7 +2371,7 @@ class ur extends O {
|
|
|
2330
2371
|
get rows() {
|
|
2331
2372
|
if (!this.derived) return cr(this);
|
|
2332
2373
|
const n = U(this)?.mapElement?.getLayers?.();
|
|
2333
|
-
return n ?
|
|
2374
|
+
return n ? Kn(n, Yn(this)) : [];
|
|
2334
2375
|
}
|
|
2335
2376
|
/** Inner padding in mm — authored, else the 2 mm the theme always used. */
|
|
2336
2377
|
get paddingMm() {
|
|
@@ -2357,7 +2398,7 @@ class ur extends O {
|
|
|
2357
2398
|
}
|
|
2358
2399
|
renderRows(t) {
|
|
2359
2400
|
const e = this.ownerDocument;
|
|
2360
|
-
this.querySelector(`:scope > [${ke}]`)?.remove(),
|
|
2401
|
+
this.querySelector(`:scope > [${ke}]`)?.remove(), Jr(this);
|
|
2361
2402
|
const n = e.createElement("div");
|
|
2362
2403
|
n.setAttribute(ke, ""), n.style.cssText = `padding:${this.paddingMm}mm;font-size:${this.fontMm}mm;line-height:1.35;`;
|
|
2363
2404
|
const i = this.getAttribute("title");
|
|
@@ -2443,25 +2484,25 @@ const ct = (r, t) => {
|
|
|
2443
2484
|
return e.textContent = t, e;
|
|
2444
2485
|
};
|
|
2445
2486
|
x("om-legend", ur);
|
|
2446
|
-
const $e = 48,
|
|
2487
|
+
const $e = 48, Dt = {
|
|
2447
2488
|
toLngLat: (r, t) => [r, t],
|
|
2448
2489
|
fromLngLat: (r) => [r[0], r[1]]
|
|
2449
2490
|
};
|
|
2450
2491
|
function Ee(r, t = 5) {
|
|
2451
2492
|
return !Number.isFinite(r) || r <= 0 ? 0 : Be(r / Math.max(1, t));
|
|
2452
2493
|
}
|
|
2453
|
-
function
|
|
2494
|
+
function Xn({ georef: r, plane: t = Dt, interval: e, intervalX: n, intervalY: i, labels: s = "outside", format: o }) {
|
|
2454
2495
|
if (r.degenerate) return null;
|
|
2455
2496
|
const a = r.corners.map((y) => t.fromLngLat(y)), l = a.map((y) => y[0]), c = a.map((y) => y[1]);
|
|
2456
2497
|
if (l.some((y) => !Number.isFinite(y)) || c.some((y) => !Number.isFinite(y))) return null;
|
|
2457
2498
|
const u = Math.min(...l), h = Math.max(...l), d = Math.min(...c), m = Math.max(...c), f = Ne(n ?? e, Ee(h - u)), g = Ne(i ?? e, Ee(m - d));
|
|
2458
2499
|
if (f <= 0 || g <= 0 || (h - u) / f > 500 || (m - d) / g > 500) return null;
|
|
2459
|
-
const p = [], b = [], w = o ??
|
|
2500
|
+
const p = [], b = [], w = o ?? Jn;
|
|
2460
2501
|
for (let y = Math.ceil(u / f) * f; y <= h + 1e-9; y += f) {
|
|
2461
2502
|
const A = Pe(r, t, y, d, m, "x");
|
|
2462
2503
|
if (A) {
|
|
2463
2504
|
p.push(A);
|
|
2464
|
-
const v = t ===
|
|
2505
|
+
const v = t === Dt ? nr(y) : y;
|
|
2465
2506
|
s !== "none" && Le(b, A, r, w(v, "x"), "x", s);
|
|
2466
2507
|
}
|
|
2467
2508
|
}
|
|
@@ -2480,10 +2521,10 @@ function Pe(r, t, e, n, i, s) {
|
|
|
2480
2521
|
const h = r.project(u);
|
|
2481
2522
|
h && o.push(h);
|
|
2482
2523
|
}
|
|
2483
|
-
const a =
|
|
2524
|
+
const a = Zn(o, r.widthMm, r.heightMm);
|
|
2484
2525
|
return a.length >= 2 ? { points: a, value: e, axis: s } : null;
|
|
2485
2526
|
}
|
|
2486
|
-
function
|
|
2527
|
+
function Zn(r, t, e) {
|
|
2487
2528
|
const n = (a) => a.xMm >= -0.01 && a.xMm <= t + 0.01 && a.yMm >= -0.01 && a.yMm <= e + 0.01, i = r.findIndex(n);
|
|
2488
2529
|
if (i === -1) return [];
|
|
2489
2530
|
let s = r.length - 1;
|
|
@@ -2502,16 +2543,16 @@ function Le(r, t, e, n, i, s) {
|
|
|
2502
2543
|
r.push({ text: n, xMm: s === "outside" ? -1.2 : 1.2, yMm: o.yMm, edge: "left", axis: i });
|
|
2503
2544
|
}
|
|
2504
2545
|
}
|
|
2505
|
-
function
|
|
2546
|
+
function Jn(r, t) {
|
|
2506
2547
|
if (Math.abs(r) >= 1e3) return Math.round(r).toLocaleString("en-US");
|
|
2507
2548
|
const e = Math.abs(r) < 1 ? 3 : Math.abs(r) < 10 ? 2 : 1;
|
|
2508
2549
|
return `${Number(r.toFixed(e))}°`;
|
|
2509
2550
|
}
|
|
2510
|
-
function
|
|
2551
|
+
function Qn(r, t) {
|
|
2511
2552
|
const e = t === "x" ? r < 0 ? "W" : "E" : r < 0 ? "S" : "N", n = Math.abs(r), i = Math.floor(n), s = (n - i) * 60, o = Math.floor(s), a = Math.round((s - o) * 60), l = a === 60 ? o + 1 : o, c = l === 60 ? i + 1 : i, u = l === 60 ? 0 : l, h = a === 60 ? 0 : a;
|
|
2512
2553
|
return `${c}°${String(u).padStart(2, "0")}′${String(h).padStart(2, "0")}″${e}`;
|
|
2513
2554
|
}
|
|
2514
|
-
const ut = "http://www.w3.org/2000/svg",
|
|
2555
|
+
const ut = "http://www.w3.org/2000/svg", ti = ["solid", "cross", "markers"], z = 1.4;
|
|
2515
2556
|
class hr extends O {
|
|
2516
2557
|
static observedAttributes = [...T["om-graticule"]];
|
|
2517
2558
|
resolvedPlane = null;
|
|
@@ -2519,7 +2560,7 @@ class hr extends O {
|
|
|
2519
2560
|
resolveToken = 0;
|
|
2520
2561
|
get kind() {
|
|
2521
2562
|
const t = this.getAttribute("kind");
|
|
2522
|
-
return
|
|
2563
|
+
return ti.includes(t) ? t : "solid";
|
|
2523
2564
|
}
|
|
2524
2565
|
get labelPlacement() {
|
|
2525
2566
|
const t = this.getAttribute("labels");
|
|
@@ -2535,14 +2576,14 @@ class hr extends O {
|
|
|
2535
2576
|
const s = Number(this.getAttribute(i));
|
|
2536
2577
|
return Number.isFinite(s) && s > 0 ? s : null;
|
|
2537
2578
|
};
|
|
2538
|
-
return
|
|
2579
|
+
return Xn({
|
|
2539
2580
|
georef: t,
|
|
2540
2581
|
plane: e,
|
|
2541
2582
|
interval: n("interval"),
|
|
2542
2583
|
intervalX: n("interval-x"),
|
|
2543
2584
|
intervalY: n("interval-y"),
|
|
2544
2585
|
labels: this.labelPlacement,
|
|
2545
|
-
format: this.getAttribute("format") === "dms" ?
|
|
2586
|
+
format: this.getAttribute("format") === "dms" ? Qn : void 0
|
|
2546
2587
|
});
|
|
2547
2588
|
}
|
|
2548
2589
|
/**
|
|
@@ -2551,8 +2592,8 @@ class hr extends O {
|
|
|
2551
2592
|
* a re-render when it lands.
|
|
2552
2593
|
*/
|
|
2553
2594
|
gridPlane() {
|
|
2554
|
-
const t =
|
|
2555
|
-
if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return
|
|
2595
|
+
const t = Ft(this.getAttribute("crs"));
|
|
2596
|
+
if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return Dt;
|
|
2556
2597
|
const e = `${t}|${this.getAttribute("crs-def") ?? ""}`;
|
|
2557
2598
|
if (this.resolvedPlaneKey === e) return this.resolvedPlane;
|
|
2558
2599
|
const n = Y(t);
|
|
@@ -2561,7 +2602,7 @@ class hr extends O {
|
|
|
2561
2602
|
return this.resolvedPlane = s, this.resolvedPlaneKey = e, s;
|
|
2562
2603
|
}
|
|
2563
2604
|
const i = ++this.resolveToken;
|
|
2564
|
-
return
|
|
2605
|
+
return Ot(t, this.getAttribute("crs-def")).then((s) => {
|
|
2565
2606
|
i !== this.resolveToken || !s || (this.resolvedPlane = { toLngLat: (o, a) => s.inverse([o, a]), fromLngLat: (o) => s.forward(o) }, this.resolvedPlaneKey = e, this.scheduleRender());
|
|
2566
2607
|
}).catch(() => {
|
|
2567
2608
|
}), null;
|
|
@@ -2590,7 +2631,7 @@ class hr extends O {
|
|
|
2590
2631
|
} else
|
|
2591
2632
|
for (const c of this.tickPoints(l, a, t)) {
|
|
2592
2633
|
const u = i.createElementNS(ut, "path");
|
|
2593
|
-
u.setAttribute("d", `M ${c.xMm -
|
|
2634
|
+
u.setAttribute("d", `M ${c.xMm - z} ${c.yMm} H ${c.xMm + z} M ${c.xMm} ${c.yMm - z} V ${c.yMm + z}`), u.setAttribute("stroke", o), u.setAttribute("stroke-width", "0.15"), s.appendChild(u);
|
|
2594
2635
|
}
|
|
2595
2636
|
for (const l of t.labels) {
|
|
2596
2637
|
const c = i.createElementNS(ut, "text");
|
|
@@ -2603,7 +2644,7 @@ class hr extends O {
|
|
|
2603
2644
|
if (e === "markers") return [t.points[0], t.points[t.points.length - 1]];
|
|
2604
2645
|
const i = n.lines.filter((o) => o.axis !== t.axis), s = [];
|
|
2605
2646
|
for (const o of i) {
|
|
2606
|
-
const a =
|
|
2647
|
+
const a = ei(t.points, o.points);
|
|
2607
2648
|
a && s.push(a);
|
|
2608
2649
|
}
|
|
2609
2650
|
return s;
|
|
@@ -2618,14 +2659,14 @@ class hr extends O {
|
|
|
2618
2659
|
t.beginPath(), l.points.forEach((c, u) => u === 0 ? t.moveTo(o(c.xMm), o(c.yMm)) : t.lineTo(o(c.xMm), o(c.yMm))), t.stroke();
|
|
2619
2660
|
else
|
|
2620
2661
|
for (const c of this.tickPoints(l, a, n))
|
|
2621
|
-
t.beginPath(), t.moveTo(o(c.xMm -
|
|
2662
|
+
t.beginPath(), t.moveTo(o(c.xMm - z), o(c.yMm)), t.lineTo(o(c.xMm + z), o(c.yMm)), t.moveTo(o(c.xMm), o(c.yMm - z)), t.lineTo(o(c.xMm), o(c.yMm + z)), t.stroke();
|
|
2622
2663
|
t.font = `${o(2.2)}px ${i?.fontFamily || "system-ui, sans-serif"}`, t.textBaseline = "alphabetic";
|
|
2623
2664
|
for (const l of n.labels)
|
|
2624
2665
|
t.textAlign = l.edge === "left" ? "right" : "center", t.fillText(l.text, o(l.xMm), o(l.yMm));
|
|
2625
2666
|
t.restore();
|
|
2626
2667
|
}
|
|
2627
2668
|
}
|
|
2628
|
-
function
|
|
2669
|
+
function ei(r, t) {
|
|
2629
2670
|
let e = null, n = Number.POSITIVE_INFINITY;
|
|
2630
2671
|
for (const i of r)
|
|
2631
2672
|
for (const s of t) {
|
|
@@ -2635,7 +2676,7 @@ function Yn(r, t) {
|
|
|
2635
2676
|
return n <= 1 ? e : null;
|
|
2636
2677
|
}
|
|
2637
2678
|
x("om-graticule", hr);
|
|
2638
|
-
function
|
|
2679
|
+
function ri(r, t) {
|
|
2639
2680
|
if (r == null || typeof r != "object") return;
|
|
2640
2681
|
const e = r.properties;
|
|
2641
2682
|
return e && t in e ? e[t] : r[t];
|
|
@@ -2649,13 +2690,13 @@ function jt(r, t) {
|
|
|
2649
2690
|
for (const e of r) jt(e, t);
|
|
2650
2691
|
}
|
|
2651
2692
|
}
|
|
2652
|
-
function
|
|
2693
|
+
function ni(r) {
|
|
2653
2694
|
return r ? r.tileData != null ? "tiled" : r.asset != null ? "asset" : null : "empty";
|
|
2654
2695
|
}
|
|
2655
2696
|
function F(r, t) {
|
|
2656
|
-
return
|
|
2697
|
+
return ri(r, t);
|
|
2657
2698
|
}
|
|
2658
|
-
function
|
|
2699
|
+
function zt(r) {
|
|
2659
2700
|
const t = {}, e = (i) => {
|
|
2660
2701
|
for (const [s, o] of Object.entries(i))
|
|
2661
2702
|
o == null || typeof o == "object" || (t[s] = String(o));
|
|
@@ -2664,7 +2705,7 @@ function Gt(r) {
|
|
|
2664
2705
|
const n = r.properties;
|
|
2665
2706
|
return n && typeof n == "object" && e(n), t;
|
|
2666
2707
|
}
|
|
2667
|
-
function
|
|
2708
|
+
function ii(r) {
|
|
2668
2709
|
let t = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
|
|
2669
2710
|
const s = [], o = r.geometry;
|
|
2670
2711
|
if (o?.coordinates != null) jt(o.coordinates, s);
|
|
@@ -2677,51 +2718,51 @@ function Zn(r) {
|
|
|
2677
2718
|
!Number.isFinite(a) || !Number.isFinite(l) || (t = Math.min(t, a), n = Math.max(n, a), e = Math.min(e, l), i = Math.max(i, l));
|
|
2678
2719
|
return !Number.isFinite(t) || !Number.isFinite(e) ? null : [t, e, n, i];
|
|
2679
2720
|
}
|
|
2680
|
-
function
|
|
2721
|
+
function si(r, t) {
|
|
2681
2722
|
const [e, n, i, s] = r, o = Math.max(i - e, 1e-4), a = Math.max(s - n, 1e-4), l = o * t, c = a * t;
|
|
2682
2723
|
return [e - l, n - c, i + l, s + c];
|
|
2683
2724
|
}
|
|
2684
|
-
const
|
|
2685
|
-
function
|
|
2686
|
-
let n = t ? r.filter((s) =>
|
|
2687
|
-
const i =
|
|
2725
|
+
const zi = ([r, t, e, n]) => Math.max(0, e - r) * Math.max(0, n - t);
|
|
2726
|
+
function oi({ features: r, filter: t, sort: e }) {
|
|
2727
|
+
let n = t ? r.filter((s) => ai(t, s)) : [...r];
|
|
2728
|
+
const i = li(e);
|
|
2688
2729
|
return i.length > 0 && (n = [...n].sort((s, o) => {
|
|
2689
2730
|
for (const { field: a, descending: l } of i) {
|
|
2690
2731
|
const c = F(s, a), u = F(o, a);
|
|
2691
2732
|
if (c == null && u == null) continue;
|
|
2692
2733
|
if (c == null) return 1;
|
|
2693
2734
|
if (u == null) return -1;
|
|
2694
|
-
const h =
|
|
2735
|
+
const h = ci(c, u);
|
|
2695
2736
|
if (h !== 0) return l ? -h : h;
|
|
2696
2737
|
}
|
|
2697
2738
|
return 0;
|
|
2698
2739
|
})), n;
|
|
2699
2740
|
}
|
|
2700
|
-
function
|
|
2741
|
+
function ai(r, t) {
|
|
2701
2742
|
try {
|
|
2702
2743
|
return !!r(t);
|
|
2703
2744
|
} catch {
|
|
2704
2745
|
return !1;
|
|
2705
2746
|
}
|
|
2706
2747
|
}
|
|
2707
|
-
function
|
|
2748
|
+
function li(r) {
|
|
2708
2749
|
return r ? r.split(",").map((t) => t.trim()).filter(Boolean).map((t) => t.startsWith("-") ? { field: t.slice(1), descending: !0 } : { field: t, descending: !1 }) : [];
|
|
2709
2750
|
}
|
|
2710
|
-
function
|
|
2751
|
+
function ci(r, t) {
|
|
2711
2752
|
return typeof r == "number" && typeof t == "number" ? r - t : String(r).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" });
|
|
2712
2753
|
}
|
|
2713
|
-
function
|
|
2754
|
+
function ui(r) {
|
|
2714
2755
|
const t = r.replace(/[\x00-\x1f<>:"/\\|?*]+/g, "-").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 100);
|
|
2715
2756
|
return t === "" ? "page" : t;
|
|
2716
2757
|
}
|
|
2717
|
-
function
|
|
2758
|
+
function hi(r, t, e) {
|
|
2718
2759
|
const n = /* @__PURE__ */ new Map();
|
|
2719
2760
|
return t.map((i, s) => {
|
|
2720
|
-
const o =
|
|
2761
|
+
const o = zt(i), a = (r ?? "page-{{atlas.index}}").replace(/\{\{\s*atlas\.([\w]+)\s*\}\}/g, (u, h) => h === "index" ? String(s + 1) : h === "count" ? String(t.length) : o[h] ?? u), l = ui(a), c = n.get(l) ?? 0;
|
|
2721
2762
|
return n.set(l, c + 1), `${c === 0 ? l : `${l}-${c + 1}`}.${e}`;
|
|
2722
2763
|
});
|
|
2723
2764
|
}
|
|
2724
|
-
const Re = "data-om-carto-pager",
|
|
2765
|
+
const Re = "data-om-carto-pager", mi = "data-om-carto-screen-only", di = "onlymap-cartograph", fi = "onlymap-cartograph-host";
|
|
2725
2766
|
class mr extends O {
|
|
2726
2767
|
static observedAttributes = [...T["om-atlas"]];
|
|
2727
2768
|
/**
|
|
@@ -2772,7 +2813,7 @@ class mr extends O {
|
|
|
2772
2813
|
*/
|
|
2773
2814
|
onHostMessage = (t) => {
|
|
2774
2815
|
const e = t.data;
|
|
2775
|
-
!e || e.source !==
|
|
2816
|
+
!e || e.source !== fi || e.type !== "atlas-seek" || typeof e.index == "number" && Number.isInteger(e.index) && this.seek(e.index);
|
|
2776
2817
|
};
|
|
2777
2818
|
/** The frame whose layer drives the iteration — the same `for=` rule every furniture element follows. */
|
|
2778
2819
|
get frame() {
|
|
@@ -2793,13 +2834,13 @@ class mr extends O {
|
|
|
2793
2834
|
}
|
|
2794
2835
|
/** Export filenames, one per page, already de-duplicated. */
|
|
2795
2836
|
filenames(t = "png") {
|
|
2796
|
-
return
|
|
2837
|
+
return hi(this.getAttribute("filename"), this.ensurePages(), t);
|
|
2797
2838
|
}
|
|
2798
2839
|
/** Human page labels, for an editor's stepper and PDF bookmarks. */
|
|
2799
2840
|
pageName(t) {
|
|
2800
2841
|
const e = this.ensurePages()[t];
|
|
2801
2842
|
if (!e) return `Page ${t + 1}`;
|
|
2802
|
-
const n =
|
|
2843
|
+
const n = zt(e), i = this.getAttribute("page-name");
|
|
2803
2844
|
return i ? i.replace(
|
|
2804
2845
|
/\{\{\s*atlas\.([\w]+)\s*\}\}/g,
|
|
2805
2846
|
(s, o) => o === "index" ? String(t + 1) : o === "count" ? String(this.count) : n[o] ?? s
|
|
@@ -2817,11 +2858,11 @@ class mr extends O {
|
|
|
2817
2858
|
}
|
|
2818
2859
|
ensurePages() {
|
|
2819
2860
|
if (this.pages) return this.pages;
|
|
2820
|
-
const e = this.frame?.mapElement?.getLayers?.(), n = this.getAttribute("layer"), i = e?.find((a) => a.id === n), s = e ?
|
|
2861
|
+
const e = this.frame?.mapElement?.getLayers?.(), n = this.getAttribute("layer"), i = e?.find((a) => a.id === n), s = e ? ni(i) : null;
|
|
2821
2862
|
if (!e || s)
|
|
2822
2863
|
return this.rejection = e ? s : null, this.pages = [];
|
|
2823
2864
|
const o = this.materialize(i);
|
|
2824
|
-
return this.pages =
|
|
2865
|
+
return this.pages = oi({ features: o, filter: this.compileFilter(), sort: this.getAttribute("sort") }), this.currentIndex = Math.min(this.currentIndex, Math.max(0, this.pages.length - 1)), this.pages;
|
|
2825
2866
|
}
|
|
2826
2867
|
/**
|
|
2827
2868
|
* Rows from the layer, with the layer's OWN declarative filters applied —
|
|
@@ -2829,7 +2870,7 @@ class mr extends O {
|
|
|
2829
2870
|
* sheets for features the map itself is hiding.
|
|
2830
2871
|
*/
|
|
2831
2872
|
materialize(t) {
|
|
2832
|
-
const e =
|
|
2873
|
+
const e = Z(), n = t.data;
|
|
2833
2874
|
if (!n) return [];
|
|
2834
2875
|
const i = e?.asRows ? e.asRows(n) : Array.isArray(n) ? n : [], s = [t.filter, t.categoryFilter].filter(Boolean);
|
|
2835
2876
|
return s.length === 0 ? i : i.filter(
|
|
@@ -2848,7 +2889,7 @@ class mr extends O {
|
|
|
2848
2889
|
compileFilter() {
|
|
2849
2890
|
const t = this.getAttribute("filter");
|
|
2850
2891
|
if (!t) return;
|
|
2851
|
-
const e =
|
|
2892
|
+
const e = Z();
|
|
2852
2893
|
if (e?.compileExpression)
|
|
2853
2894
|
try {
|
|
2854
2895
|
const n = e.compileExpression(t, { shape: "geojson", paramName: "d" });
|
|
@@ -2872,12 +2913,12 @@ class mr extends O {
|
|
|
2872
2913
|
const e = this.closest("om-cartograph");
|
|
2873
2914
|
for (const s of e?.querySelectorAll("om-frame") ?? []) {
|
|
2874
2915
|
if (s.getAttribute("atlas-fit") !== "feature") continue;
|
|
2875
|
-
const o =
|
|
2916
|
+
const o = ii(t);
|
|
2876
2917
|
if (!o) continue;
|
|
2877
|
-
const a = Number(s.getAttribute("atlas-margin")), l =
|
|
2918
|
+
const a = Number(s.getAttribute("atlas-margin")), l = si(o, Number.isFinite(a) && a > 0 ? a : 0.15);
|
|
2878
2919
|
s.fitBounds?.(l);
|
|
2879
2920
|
}
|
|
2880
|
-
e?.setAtlasFields({ ...
|
|
2921
|
+
e?.setAtlasFields({ ...zt(t), index: String(this.currentIndex + 1), count: String(this.count) }), e?.refreshFurniture();
|
|
2881
2922
|
const n = this.pageName(this.currentIndex);
|
|
2882
2923
|
this.dispatchEvent(
|
|
2883
2924
|
new CustomEvent("om-atlas-page", {
|
|
@@ -2886,7 +2927,7 @@ class mr extends O {
|
|
|
2886
2927
|
})
|
|
2887
2928
|
), this.renderPager();
|
|
2888
2929
|
const i = typeof window < "u" ? window.parent : null;
|
|
2889
|
-
i && i !== window && i.postMessage({ source:
|
|
2930
|
+
i && i !== window && i.postMessage({ source: di, type: "atlas-page", index: this.currentIndex, count: this.count, name: n }, "*");
|
|
2890
2931
|
}
|
|
2891
2932
|
/**
|
|
2892
2933
|
* Draw (or update) the reader's page control on the owning sheet:
|
|
@@ -2904,7 +2945,7 @@ class mr extends O {
|
|
|
2904
2945
|
}
|
|
2905
2946
|
const i = this.ownerDocument, s = e ?? i.createElement("div");
|
|
2906
2947
|
if (!e) {
|
|
2907
|
-
s.setAttribute(Re, ""), s.setAttribute(
|
|
2948
|
+
s.setAttribute(Re, ""), s.setAttribute(mi, ""), s.setAttribute("role", "navigation"), s.setAttribute("aria-label", "Atlas pages"), s.style.cssText = "position:absolute;left:50%;bottom:4mm;transform:translateX(-50%);z-index:2147483000;display:flex;align-items:center;gap:8px;padding:4px 10px;border-radius:999px;background:rgba(20,20,24,.82);color:#fff;font:12px/1.2 system-ui,sans-serif;box-shadow:0 2px 10px rgba(0,0,0,.35);user-select:none;pointer-events:auto;";
|
|
2908
2949
|
for (const [u, h, d] of [
|
|
2909
2950
|
[-1, "‹", "Previous page"],
|
|
2910
2951
|
[1, "›", "Next page"]
|
|
@@ -2937,7 +2978,7 @@ class mr extends O {
|
|
|
2937
2978
|
}
|
|
2938
2979
|
}
|
|
2939
2980
|
x("om-atlas", mr);
|
|
2940
|
-
class
|
|
2981
|
+
class pi extends qe {
|
|
2941
2982
|
static observedAttributes = [...T["om-source"]];
|
|
2942
2983
|
connectedCallback() {
|
|
2943
2984
|
this.style.display = "none";
|
|
@@ -2951,7 +2992,7 @@ class ci extends qe {
|
|
|
2951
2992
|
this.closest("om-frame")?.scheduleRender?.();
|
|
2952
2993
|
}
|
|
2953
2994
|
}
|
|
2954
|
-
const
|
|
2995
|
+
const gi = /* @__PURE__ */ new Set(["class", "style", "id", "hidden", "title", "lang", "dir", "slot", "part", "role", "tabindex"]), bi = /* @__PURE__ */ new Set(["style", "script", "img", "template", "om-map"]), yi = ["data-om-carto-credit", "data-om-carto-marks", "data-om-carto-flattened"], wi = /* @__PURE__ */ new Set(["om-text", "om-legend", "om-scalebar", "om-north", "om-shape", "om-image"]), vi = /* @__PURE__ */ new Set(["om-frame", "om-legend", "om-scalebar", "om-north", "om-graticule", "om-text", "om-shape", "om-image"]), Ai = 0.02, Mi = (r) => Math.max(0, Number(r.getAttribute("bleed")) || 0);
|
|
2955
2996
|
function dr(r) {
|
|
2956
2997
|
const t = r.tagName.toLowerCase();
|
|
2957
2998
|
return r.id ? `${t}#${r.id}` : t;
|
|
@@ -2962,10 +3003,10 @@ function H(r, t) {
|
|
|
2962
3003
|
const n = Number(e);
|
|
2963
3004
|
return Number.isFinite(n) ? n : null;
|
|
2964
3005
|
}
|
|
2965
|
-
function
|
|
3006
|
+
function Si(r, t) {
|
|
2966
3007
|
return r.x < t.x + t.w && t.x < r.x + r.w && r.y < t.y + t.h && t.y < r.y + r.h;
|
|
2967
3008
|
}
|
|
2968
|
-
function
|
|
3009
|
+
function Ci(r, t) {
|
|
2969
3010
|
const e = r.getAttribute("style");
|
|
2970
3011
|
if (!e) return null;
|
|
2971
3012
|
const n = new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*(-?[\\d.]+)mm`, "i").exec(e);
|
|
@@ -2977,21 +3018,21 @@ function fr(r) {
|
|
|
2977
3018
|
}, n = [...r.querySelectorAll("om-cartograph")];
|
|
2978
3019
|
if (n.length === 0 && r.tagName?.toLowerCase() === "om-cartograph" && n.push(r), n.length === 0)
|
|
2979
3020
|
return { valid: !0, errors: [], warnings: [] };
|
|
2980
|
-
for (const o of n)
|
|
3021
|
+
for (const o of n) xi(o, e);
|
|
2981
3022
|
const i = t.filter((o) => o.severity === "error"), s = t.filter((o) => o.severity === "warning");
|
|
2982
3023
|
return { valid: i.length === 0, errors: i, warnings: s };
|
|
2983
3024
|
}
|
|
2984
|
-
function
|
|
3025
|
+
function xi(r, t) {
|
|
2985
3026
|
const e = r.getAttribute("size"), n = H(r, "width") != null && H(r, "height") != null;
|
|
2986
|
-
e && !
|
|
3027
|
+
e && !se.includes(e) && !n && t(
|
|
2987
3028
|
"error",
|
|
2988
3029
|
r,
|
|
2989
3030
|
`Unknown page size "${e}" and no width/height to fall back on.`,
|
|
2990
|
-
`Use one of ${
|
|
3031
|
+
`Use one of ${se.join(", ")}, or give width= and height= in millimetres.`,
|
|
2991
3032
|
"size"
|
|
2992
3033
|
);
|
|
2993
3034
|
const i = r.getAttribute("cvd");
|
|
2994
|
-
i && i.trim().toLowerCase() !== "none" && !
|
|
3035
|
+
i && i.trim().toLowerCase() !== "none" && !Gt(i) && t("warning", r, `Unknown cvd="${i}" — no simulation applied.`, `Use one of ${Sr.join(", ")}.`, "cvd"), r.hasAttribute("crop-marks") && Mi(r) <= 0 && t("warning", r, "crop-marks needs bleed to draw into — trim marks sit outside the page box.", 'Add bleed="3" (mm), or drop crop-marks.', "crop-marks");
|
|
2995
3036
|
const s = H(r, "safe-zone");
|
|
2996
3037
|
if (s != null && s > 0) {
|
|
2997
3038
|
const m = dt(r.getAttribute("size"), r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation"));
|
|
@@ -3003,19 +3044,19 @@ function wi(r, t) {
|
|
|
3003
3044
|
for (const m of h)
|
|
3004
3045
|
m.id ? u.add(m.id) : t("error", m, "Frame has no id.", "Give every frame an id so furniture can reference it with for=.", "id");
|
|
3005
3046
|
for (const m of r.children) {
|
|
3006
|
-
if (
|
|
3047
|
+
if (yi.some((g) => m.hasAttribute(g))) continue;
|
|
3007
3048
|
const f = m.tagName.toLowerCase();
|
|
3008
|
-
!yt.includes(f) && !
|
|
3049
|
+
!yt.includes(f) && !bi.has(f) && t("error", m, `<${f}> is not a cartograph element.`, `Use one of ${yt.join(", ")}, or move this content inside an <om-text>.`);
|
|
3009
3050
|
}
|
|
3010
3051
|
const d = [];
|
|
3011
3052
|
for (const m of [r, ...r.querySelectorAll("*")]) {
|
|
3012
3053
|
const f = m.tagName.toLowerCase();
|
|
3013
3054
|
if (yt.includes(f) && !m.closest("om-map")) {
|
|
3014
|
-
if (
|
|
3055
|
+
if (ki(m, f, t), vi.has(f)) {
|
|
3015
3056
|
const g = S(m);
|
|
3016
|
-
|
|
3057
|
+
$i(m, g, a, l, c, t), wi.has(f) && !m.hasAttribute("hidden") && d.push({ el: m, box: g });
|
|
3017
3058
|
}
|
|
3018
|
-
f === "om-frame" &&
|
|
3059
|
+
f === "om-frame" && Ei(m, t), f === "om-source" && Ni(m, t), f === "om-legend" && Pi(m, h, t), f === "om-atlas" && Ti(m, h, t), f === "om-scalebar" && Li(m, h, t), f === "om-text" && Ri(m, h, t);
|
|
3019
3060
|
for (const g of ["for", "overview-of"]) {
|
|
3020
3061
|
const p = m.getAttribute(g);
|
|
3021
3062
|
p && !u.has(p) && t("error", m, `${g}="${p}" references no frame on this page.`, `Point it at one of: ${[...u].join(", ") || "(no frames)"}.`, g);
|
|
@@ -3025,7 +3066,7 @@ function wi(r, t) {
|
|
|
3025
3066
|
for (let m = 0; m < d.length; m++)
|
|
3026
3067
|
for (let f = m + 1; f < d.length; f++) {
|
|
3027
3068
|
const g = d[m], p = d[f];
|
|
3028
|
-
g.box.w <= 0 || g.box.h <= 0 || p.box.w <= 0 || p.box.h <= 0 ||
|
|
3069
|
+
g.box.w <= 0 || g.box.h <= 0 || p.box.w <= 0 || p.box.h <= 0 || Si(g.box, p.box) && t(
|
|
3029
3070
|
"warning",
|
|
3030
3071
|
g.el,
|
|
3031
3072
|
`Overlaps ${dr(p.el)} on the page.`,
|
|
@@ -3033,11 +3074,11 @@ function wi(r, t) {
|
|
|
3033
3074
|
);
|
|
3034
3075
|
}
|
|
3035
3076
|
}
|
|
3036
|
-
function
|
|
3077
|
+
function ki(r, t, e) {
|
|
3037
3078
|
const n = new Set(T[t] ?? []);
|
|
3038
3079
|
for (const i of r.attributes) {
|
|
3039
3080
|
const s = i.name.toLowerCase();
|
|
3040
|
-
if (n.has(s) ||
|
|
3081
|
+
if (n.has(s) || gi.has(s) || s.startsWith("data-") || s.startsWith("aria-")) continue;
|
|
3041
3082
|
const o = Ur.get(s);
|
|
3042
3083
|
if (o) {
|
|
3043
3084
|
e("warning", r, `Attribute "${s}" has no effect: ${o}`, "Remove it, or use the documented alternative.", s);
|
|
@@ -3046,7 +3087,7 @@ function vi(r, t, e) {
|
|
|
3046
3087
|
e("warning", r, `Unknown attribute "${s}" on <${t}> — likely a typo.`, `Valid attributes: ${[...n].join(", ")}.`, s);
|
|
3047
3088
|
}
|
|
3048
3089
|
}
|
|
3049
|
-
function
|
|
3090
|
+
function $i(r, t, e, n, i, s) {
|
|
3050
3091
|
if (t.w <= 0 || t.h <= 0) {
|
|
3051
3092
|
s("error", r, `Element has no size (w=${t.w}, h=${t.h}).`, "Give w= and h= in millimetres — both greater than zero.", t.w <= 0 ? "w" : "h");
|
|
3052
3093
|
return;
|
|
@@ -3065,7 +3106,7 @@ function Ai(r, t, e, n, i, s) {
|
|
|
3065
3106
|
["height", t.h]
|
|
3066
3107
|
];
|
|
3067
3108
|
for (const [u, h] of c) {
|
|
3068
|
-
const d =
|
|
3109
|
+
const d = Ci(r, u);
|
|
3069
3110
|
d != null && Math.abs(d - h) > 0.01 && s(
|
|
3070
3111
|
"error",
|
|
3071
3112
|
r,
|
|
@@ -3075,7 +3116,7 @@ function Ai(r, t, e, n, i, s) {
|
|
|
3075
3116
|
);
|
|
3076
3117
|
}
|
|
3077
3118
|
}
|
|
3078
|
-
function
|
|
3119
|
+
function Ei(r, t) {
|
|
3079
3120
|
if ((r.getAttribute("mode") === "static" ? "static" : "live") === "static") {
|
|
3080
3121
|
const n = r.getAttribute("corners"), i = X(n);
|
|
3081
3122
|
i || t(
|
|
@@ -3096,8 +3137,8 @@ function Mi(r, t) {
|
|
|
3096
3137
|
if (a.degenerate)
|
|
3097
3138
|
t("error", r, "Frame corners are degenerate (collinear or coincident) — nothing can be placed on this frame.", "Check the corner order: tl, tr, br, bl.", "corners");
|
|
3098
3139
|
else {
|
|
3099
|
-
const l =
|
|
3100
|
-
l != null && l >
|
|
3140
|
+
const l = $n(a);
|
|
3141
|
+
l != null && l > Ai && t(
|
|
3101
3142
|
"warning",
|
|
3102
3143
|
r,
|
|
3103
3144
|
`Ground scale varies ${(l * 100).toFixed(1)}% across this frame, so a single scale bar is only true near its anchor.`,
|
|
@@ -3152,7 +3193,7 @@ function Mi(r, t) {
|
|
|
3152
3193
|
);
|
|
3153
3194
|
}
|
|
3154
3195
|
}
|
|
3155
|
-
function
|
|
3196
|
+
function Ni(r, t) {
|
|
3156
3197
|
const e = r.parentElement;
|
|
3157
3198
|
if (e?.tagName.toLowerCase() !== "om-frame") {
|
|
3158
3199
|
t(
|
|
@@ -3168,7 +3209,7 @@ function Si(r, t) {
|
|
|
3168
3209
|
t("error", r, "<om-source> has no src=.", "Give it a map document (.html) or a capture image.", "src");
|
|
3169
3210
|
return;
|
|
3170
3211
|
}
|
|
3171
|
-
const i =
|
|
3212
|
+
const i = Ut(n);
|
|
3172
3213
|
if (!i) {
|
|
3173
3214
|
t(
|
|
3174
3215
|
"error",
|
|
@@ -3204,12 +3245,12 @@ function Si(r, t) {
|
|
|
3204
3245
|
'Remove mode="static" to let the frame resolve its sources, or drop the <om-source>.'
|
|
3205
3246
|
);
|
|
3206
3247
|
}
|
|
3207
|
-
function
|
|
3248
|
+
function Ht(r, t) {
|
|
3208
3249
|
const e = r.getAttribute("for");
|
|
3209
3250
|
return e ? t.find((n) => n.id === e) : t.length === 1 ? t[0] : void 0;
|
|
3210
3251
|
}
|
|
3211
|
-
function
|
|
3212
|
-
const n = r.getAttribute("derived") !== "false", i =
|
|
3252
|
+
function Pi(r, t, e) {
|
|
3253
|
+
const n = r.getAttribute("derived") !== "false", i = Ht(r, t);
|
|
3213
3254
|
n && i?.getAttribute("mode") === "static" && e(
|
|
3214
3255
|
"warning",
|
|
3215
3256
|
r,
|
|
@@ -3230,12 +3271,12 @@ function Ci(r, t, e) {
|
|
|
3230
3271
|
);
|
|
3231
3272
|
}
|
|
3232
3273
|
}
|
|
3233
|
-
function
|
|
3274
|
+
function Ti(r, t, e) {
|
|
3234
3275
|
const n = r.getAttribute("pager");
|
|
3235
3276
|
n != null && n !== "auto" && n !== "none" && e("warning", r, `pager="${n}" is not a value; the control is drawn as if "auto".`, 'Use pager="none" to remove the on-screen page control, or omit the attribute.', "pager");
|
|
3236
3277
|
const i = r.getAttribute("layer");
|
|
3237
3278
|
i || e("error", r, "Atlas has no layer= to iterate.", 'Name a layer inside the frame, e.g. layer="parcels".', "layer");
|
|
3238
|
-
const s = r.getAttribute("for"), o =
|
|
3279
|
+
const s = r.getAttribute("for"), o = Ht(r, t);
|
|
3239
3280
|
if (!o) {
|
|
3240
3281
|
!s && t.length !== 1 && e("error", r, `Atlas does not say which frame drives it, and the page has ${t.length} frames.`, 'Add for="<frame id>".', "for");
|
|
3241
3282
|
return;
|
|
@@ -3267,10 +3308,10 @@ function xi(r, t, e) {
|
|
|
3267
3308
|
);
|
|
3268
3309
|
}
|
|
3269
3310
|
}
|
|
3270
|
-
function
|
|
3311
|
+
function Li(r, t, e) {
|
|
3271
3312
|
const n = H(r, "segment-length");
|
|
3272
3313
|
if (n == null) return;
|
|
3273
|
-
const i =
|
|
3314
|
+
const i = Ht(r, t);
|
|
3274
3315
|
if (!i) return;
|
|
3275
3316
|
const s = X(i.getAttribute("corners")), o = Y(i.getAttribute("crs")), a = S(i);
|
|
3276
3317
|
if (!s || !o || a.w <= 0 || a.h <= 0) return;
|
|
@@ -3288,7 +3329,7 @@ function ki(r, t, e) {
|
|
|
3288
3329
|
"segment-length"
|
|
3289
3330
|
);
|
|
3290
3331
|
}
|
|
3291
|
-
function
|
|
3332
|
+
function Ri(r, t, e) {
|
|
3292
3333
|
const n = r.textContent ?? "", i = /* @__PURE__ */ new Set(["title", "attribution", "date", "notes", "scale", "crs"]), s = new Set(t.map((o) => o.id).filter(Boolean));
|
|
3293
3334
|
for (const o of Hr(n))
|
|
3294
3335
|
if (!o.startsWith("atlas.")) {
|
|
@@ -3309,10 +3350,10 @@ function $i(r, t, e) {
|
|
|
3309
3350
|
i.has(o) || e("warning", r, `Unknown token {{${o}}} — it will render literally.`, `Known tokens: ${[...i].join(", ")}, frame.<id>.scale, frame.<id>.crs, atlas.<field>.`);
|
|
3310
3351
|
}
|
|
3311
3352
|
}
|
|
3312
|
-
function
|
|
3353
|
+
function Gi(r) {
|
|
3313
3354
|
return fr(Fr(r));
|
|
3314
3355
|
}
|
|
3315
|
-
async function
|
|
3356
|
+
async function qi(r) {
|
|
3316
3357
|
const t = fr(r), e = [...r.querySelectorAll("om-frame")].filter((a) => a.querySelector(":scope > om-map"));
|
|
3317
3358
|
if (e.length === 0) return t;
|
|
3318
3359
|
const { loadCore: n } = await Promise.resolve().then(() => wr), i = await n(), s = [...t.errors], o = [...t.warnings];
|
|
@@ -3323,8 +3364,8 @@ async function _i(r) {
|
|
|
3323
3364
|
}
|
|
3324
3365
|
return { valid: s.length === 0, errors: s, warnings: o };
|
|
3325
3366
|
}
|
|
3326
|
-
function
|
|
3327
|
-
x("om-cartograph", Qe), x("om-text", tr), x("om-frame", ir), x("om-scalebar", sr), x("om-north", or), x("om-shape", ar), x("om-image", lr), x("om-legend", ur), x("om-graticule", hr), x("om-atlas", mr), x("om-source",
|
|
3367
|
+
function Wi() {
|
|
3368
|
+
x("om-cartograph", Qe), x("om-text", tr), x("om-frame", ir), x("om-scalebar", sr), x("om-north", or), x("om-shape", ar), x("om-image", lr), x("om-legend", ur), x("om-graticule", hr), x("om-atlas", mr), x("om-source", pi);
|
|
3328
3369
|
}
|
|
3329
3370
|
Ie(() => import("@nika-js/onlymap"));
|
|
3330
3371
|
Ir();
|
|
@@ -3332,12 +3373,12 @@ export {
|
|
|
3332
3373
|
T as CARTOGRAPH_ELEMENT_ATTRS,
|
|
3333
3374
|
bt as CARTOGRAPH_FORMAT,
|
|
3334
3375
|
yt as CARTOGRAPH_TAG_NAMES,
|
|
3335
|
-
|
|
3376
|
+
Ii as CARTOGRAPH_THEMES,
|
|
3336
3377
|
xr as COLLAPSE_THRESHOLD,
|
|
3337
|
-
|
|
3378
|
+
qt as CVD_MATRICES,
|
|
3338
3379
|
ft as CVD_TYPES,
|
|
3339
3380
|
Sr as CVD_VALUES,
|
|
3340
|
-
|
|
3381
|
+
Dt as GEOGRAPHIC_PLANE,
|
|
3341
3382
|
Ur as INERT_RESERVED_CARTOGRAPH_ATTRS,
|
|
3342
3383
|
De as MAX_CANVAS_AREA,
|
|
3343
3384
|
Ue as MAX_CANVAS_DIMENSION,
|
|
@@ -3352,39 +3393,39 @@ export {
|
|
|
3352
3393
|
sr as OmScalebarElement,
|
|
3353
3394
|
ar as OmShapeElement,
|
|
3354
3395
|
tr as OmTextElement,
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3396
|
+
Xt as PAGE_PRESETS,
|
|
3397
|
+
se as PAGE_SIZE_NAMES,
|
|
3398
|
+
j as PLACED_ATTR_NAMES,
|
|
3358
3399
|
D as PX_PER_MM,
|
|
3359
3400
|
Br as SCALE_GROUP_SEPARATOR,
|
|
3360
3401
|
Lr as URL_ACTION_TIMEOUT_MS,
|
|
3361
3402
|
rn as alignOffset,
|
|
3362
|
-
|
|
3403
|
+
Ze as allFrames,
|
|
3363
3404
|
$r as applyCvdToCanvas,
|
|
3364
3405
|
Yr as applyTokens,
|
|
3365
3406
|
Rr as applyUrlActions,
|
|
3366
|
-
|
|
3367
|
-
|
|
3407
|
+
zt as atlasFields,
|
|
3408
|
+
zi as boundsArea,
|
|
3368
3409
|
S as boxMm,
|
|
3369
|
-
|
|
3370
|
-
|
|
3410
|
+
Xn as buildGraticule,
|
|
3411
|
+
oi as buildPages,
|
|
3371
3412
|
Ke as buildScalebar,
|
|
3372
3413
|
Wr as buildScalebarDrawing,
|
|
3373
3414
|
Y as builtinCrsForward,
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3415
|
+
Fi as canvasMeasurer,
|
|
3416
|
+
Jr as clearUnlinked,
|
|
3417
|
+
Di as cornersFromBounds,
|
|
3418
|
+
_t as cornersFromCamera,
|
|
3378
3419
|
tt as createFrameGeoref,
|
|
3379
3420
|
Mr as createZip,
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3421
|
+
Wi as defineCartographElements,
|
|
3422
|
+
te as deltaE00,
|
|
3423
|
+
Kn as deriveLegendRows,
|
|
3383
3424
|
Er as ensureCvdFilters,
|
|
3384
|
-
|
|
3425
|
+
ii as featureBounds,
|
|
3385
3426
|
F as fieldOf,
|
|
3386
3427
|
Xe as findFrame,
|
|
3387
|
-
|
|
3428
|
+
Qn as formatDms,
|
|
3388
3429
|
Kr as formatScaleDenominator,
|
|
3389
3430
|
Ir as installUrlActions,
|
|
3390
3431
|
yr as isCoreLoaded,
|
|
@@ -3392,44 +3433,44 @@ export {
|
|
|
3392
3433
|
en as layoutText,
|
|
3393
3434
|
kr as lintLegendColours,
|
|
3394
3435
|
Fe as loadCore,
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3436
|
+
ji as maxGeoreferenceablePitch,
|
|
3437
|
+
Oi as mercatorForward,
|
|
3438
|
+
_i as mercatorInverse,
|
|
3398
3439
|
Ee as niceInterval,
|
|
3399
3440
|
Be as niceNumberBelow,
|
|
3400
|
-
|
|
3401
|
-
|
|
3441
|
+
Ft as normalizeCrs,
|
|
3442
|
+
kn as northBearingDegrees,
|
|
3402
3443
|
Ye as ownerCartograph,
|
|
3403
|
-
|
|
3404
|
-
|
|
3444
|
+
si as padBounds,
|
|
3445
|
+
Yt as paintEnvForDpi,
|
|
3405
3446
|
Cr as parseColor,
|
|
3406
3447
|
X as parseCorners,
|
|
3407
|
-
|
|
3408
|
-
|
|
3448
|
+
li as parseSort,
|
|
3449
|
+
Z as peekCore,
|
|
3409
3450
|
mt as readCamera,
|
|
3410
3451
|
cr as readLiteralRows,
|
|
3411
|
-
|
|
3452
|
+
Yn as readOverrides,
|
|
3412
3453
|
U as referencedFrame,
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3454
|
+
ni as rejectionFor,
|
|
3455
|
+
Wt as renderCartograph,
|
|
3456
|
+
ze as renderCartographAtlas,
|
|
3457
|
+
Ot as resolveCrsForward,
|
|
3458
|
+
Gt as resolveCvdType,
|
|
3459
|
+
hi as resolveFilenames,
|
|
3419
3460
|
dt as resolvePageSize,
|
|
3420
3461
|
Vr as resolveToken,
|
|
3421
3462
|
He as resolveTokens,
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3463
|
+
Bn as rowColorFor,
|
|
3464
|
+
Nn as sanitizeAdoptedMap,
|
|
3465
|
+
ui as sanitizeFilename,
|
|
3466
|
+
$n as scaleVariation,
|
|
3426
3467
|
Ie as setCoreLoader,
|
|
3427
|
-
|
|
3428
|
-
|
|
3468
|
+
Jt as simulate,
|
|
3469
|
+
Wn as swatchShapeFor,
|
|
3429
3470
|
Hr as tokensIn,
|
|
3430
|
-
|
|
3471
|
+
Ui as utmDef,
|
|
3431
3472
|
fr as validateCartograph,
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3473
|
+
qi as validateCartographDeep,
|
|
3474
|
+
Gi as validateCartographString,
|
|
3475
|
+
ne as whenPageReady
|
|
3435
3476
|
};
|