@nika-js/onlymap 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +50 -3
  3. package/dist/{LercDecode.es-BMcxSLhD.js → LercDecode.es-IEPCRZOv.js} +1 -1
  4. package/dist/{basemap-m98j2wxG.js → basemap-9lXclX9H.js} +3882 -3980
  5. package/dist/cartograph/elements/om-frame.d.ts +67 -1
  6. package/dist/cartograph/georef.d.ts +18 -4
  7. package/dist/cartograph/schema.d.ts +11 -0
  8. package/dist/cartograph.js +1480 -1311
  9. package/dist/cartograph.standalone.js +1808 -1615
  10. package/dist/{cityjson-D_V5GY8b.js → cityjson-k-z1r6c0.js} +1 -1
  11. package/dist/{crs-DsDQ4Q4i.js → crs-BzE_KP4M.js} +25 -2
  12. package/dist/{crs-Ciu7Xs7a.js → crs-ChglCB3O.js} +39 -16
  13. package/dist/dem-decode.d.ts +58 -0
  14. package/dist/elements/om-map.d.ts +12 -0
  15. package/dist/{geoparquet-XOwOmChh.js → geoparquet-DFDZDBun.js} +10 -10
  16. package/dist/globe-view-D9wjfL0T.js +104 -0
  17. package/dist/hillshade-C2BQr6pd.js +298 -0
  18. package/dist/hillshade-apron-Bem3DWyJ.js +40 -0
  19. package/dist/hillshade-apron.d.ts +54 -0
  20. package/dist/hillshade-shader-DI2uLSNU.js +165 -0
  21. package/dist/hillshade-shader.d.ts +168 -0
  22. package/dist/hillshade.d.ts +163 -0
  23. package/dist/html-data.d.ts +1 -1
  24. package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
  25. package/dist/{index-DzOvV-O7.js → index-4Tvlt0iO.js} +57 -57
  26. package/dist/{index-HZWdgtm4.js → index-Bn66l3KG.js} +1 -1
  27. package/dist/index-BuXrMq5D.js +322 -0
  28. package/dist/index-CNRbZHkK.js +459 -0
  29. package/dist/{index-DDNElBTs.js → index-CkovmN47.js} +1 -1
  30. package/dist/index-CmuOizAF.js +641 -0
  31. package/dist/index-CvT5QHBS.js +65 -0
  32. package/dist/{index-BMbpftvm.js → index-DnVHKI61.js} +1 -1
  33. package/dist/{index-BSAY6CWm.js → index-JjyDEqAS.js} +18911 -17456
  34. package/dist/index.d.ts +4 -0
  35. package/dist/layer-registry.d.ts +27 -0
  36. package/dist/lerc-C1mQ_Kqq.js +22 -0
  37. package/dist/onlymap.standalone.js +49075 -45717
  38. package/dist/onlymapjs.js +73 -70
  39. package/dist/parse-manifest.d.ts +6 -0
  40. package/dist/plane-camera.d.ts +59 -0
  41. package/dist/plane-layers.d.ts +56 -0
  42. package/dist/plane-tiles.d.ts +99 -0
  43. package/dist/plane-tileset.d.ts +31 -0
  44. package/dist/plane-warp.d.ts +91 -0
  45. package/dist/post-process-effect-DfslKPM6.js +197 -0
  46. package/dist/programmatic.d.ts +16 -1
  47. package/dist/projection.d.ts +118 -0
  48. package/dist/{raster-Dg5p_99H.js → raster-D2NzdjZE.js} +609 -499
  49. package/dist/raster-hillshade.d.ts +119 -0
  50. package/dist/{raster-pipeline-DhjkqDYd.js → raster-pipeline-qnD1icOv.js} +511 -484
  51. package/dist/raster-pipeline.d.ts +10 -0
  52. package/dist/raster.d.ts +5 -0
  53. package/dist/runtime-core.d.ts +140 -1
  54. package/dist/serialize/clip.d.ts +50 -0
  55. package/dist/serialize/declutter.d.ts +44 -0
  56. package/dist/serialize/emit.d.ts +60 -0
  57. package/dist/serialize/index.d.ts +64 -0
  58. package/dist/serialize/strategy.d.ts +30 -0
  59. package/dist/serialize/style.d.ts +77 -0
  60. package/dist/snapshot.d.ts +46 -0
  61. package/dist/surface-anchor.d.ts +6 -0
  62. package/dist/terrain-heightfield.d.ts +0 -16
  63. package/dist/terrain-sample.d.ts +0 -13
  64. package/dist/text-on-path-Dm7vtNqt.js +146 -0
  65. package/dist/text-on-path.d.ts +157 -0
  66. package/dist/transform/buffer.d.ts +63 -0
  67. package/dist/transform/contour.d.ts +37 -0
  68. package/dist/transform/dot-density.d.ts +19 -0
  69. package/dist/transform/field.d.ts +80 -0
  70. package/dist/transform/geometry.d.ts +20 -0
  71. package/dist/transform/index.d.ts +29 -0
  72. package/dist/transform/simplify.d.ts +10 -0
  73. package/dist/transform/smooth.d.ts +12 -0
  74. package/dist/transform-stage.d.ts +92 -0
  75. package/dist/version.d.ts +1 -1
  76. package/dist/volumetrics.d.ts +7 -0
  77. package/dist/{zarr-D3CzK1Zm.js → zarr-D5e5agMG.js} +2 -2
  78. package/docs/cartograph.md +12 -4
  79. package/docs/cartography.md +328 -0
  80. package/docs/design/arrows.md +182 -0
  81. package/docs/design/carto-substrate.md +1055 -0
  82. package/docs/design/extensions.md +250 -0
  83. package/docs/design/hillshade.md +290 -0
  84. package/docs/effects.md +11 -0
  85. package/docs/hillshade.md +203 -0
  86. package/llms.txt +4 -2
  87. package/onlymapjs.attributes.json +45 -2
  88. package/onlymapjs.html-data.json +213 -25
  89. package/package.json +13 -9
  90. package/skills/onlymapjs/SKILL.md +7 -2
  91. package/skills/onlymapjs/references/syntax.md +31 -3
  92. package/dist/index-CfPbQUqO.js +0 -511
  93. package/dist/lerc-qK-nhCaB.js +0 -30
@@ -1,17 +1,17 @@
1
- import { y as R, A as S, B as E, F as N, H as h, I as w, J as W, K as O, N as I, Q as x, R as B, S as _, T as P, U as k, X as $, Y as z, Z as C, _ as F, $ as v, a0 as U, a1 as p, a2 as M } from "./index-BSAY6CWm.js";
2
- import { a3 as $e, a4 as ze, a5 as Ce, a6 as ve, a7 as Ue, a8 as Me, a9 as je, aa as De, ab as Je, ac as qe, ad as He, ae as Ve, af as Ge, ag as Ke, ah as Qe, ai as Xe, aj as Ye, ak as Ze, al as et, am as tt, an as nt, ao as rt, ap as at, aq as st, ar as ot } from "./index-BSAY6CWm.js";
1
+ import { aM as R, aN as S, aO as E, aP as N, aQ as h, aR as w, aS as W, aT as O, aU as x, aV as I, aW as B, aX as _, aY as P, aZ as k, a_ as $, a$ as z, b0 as C, b1 as F, b2 as v, b3 as M, b4 as p, b5 as U } from "./index-JjyDEqAS.js";
2
+ import { b6 as $e, b7 as ze, b8 as Ce, b9 as ve, ba as Me, bb as Ue, bc as je, bd as De, be as qe, bf as Je, bg as Ve, bh as Ge, bi as He, bj as Qe, bk as Xe, bl as Ye, bm as Ze, bn as Ke, bo as et, bp as tt, bq as nt, br as rt, bs as at, bt as st, bu as ot } from "./index-JjyDEqAS.js";
3
3
  import { g as j, i as D } from "./table-accessors-CYWTzpQI.js";
4
- async function J(t, e, n = {}, r = {}) {
4
+ async function q(t, e, n = {}, r = {}) {
5
5
  const a = R(t), s = S.getWorkerFarm(n), { source: o } = n, c = { name: a, source: o };
6
6
  o || (c.url = E(t, n));
7
7
  const i = s.getWorkerPool(c), u = n.jobName || t.name, d = await i.startJob(
8
8
  u,
9
9
  // eslint-disable-next-line
10
- q.bind(null, r)
10
+ J.bind(null, r)
11
11
  ), y = N(n);
12
12
  return d.postMessage("process", { input: e, options: y }), (await d.result).result;
13
13
  }
14
- async function q(t, e, n, r) {
14
+ async function J(t, e, n, r) {
15
15
  switch (n) {
16
16
  case "done":
17
17
  e.done(r);
@@ -37,7 +37,7 @@ async function q(t, e, n, r) {
37
37
  console.warn(`process-on-worker: unknown message ${n}`);
38
38
  }
39
39
  }
40
- function H(t, e) {
40
+ function V(t, e) {
41
41
  if (!S.isSupported())
42
42
  return !1;
43
43
  const n = e?._nodeWorkers ?? e?.core?._nodeWorkers, r = e?.worker ?? e?.core?.worker;
@@ -66,30 +66,30 @@ async function* pe(t) {
66
66
  }
67
67
  e.length > 0 && (yield e);
68
68
  }
69
- async function* ge(t) {
69
+ async function* be(t) {
70
70
  let e = 1;
71
71
  for await (const n of t)
72
72
  yield { counter: e, line: n }, e++;
73
73
  }
74
- const V = "4.4.3", Te = {
74
+ const G = "4.4.3", ge = {
75
75
  dataType: null,
76
76
  batchType: null,
77
77
  name: "JSON",
78
78
  id: "json",
79
79
  module: "json",
80
- version: V,
80
+ version: G,
81
81
  extensions: ["json", "geojson"],
82
82
  mimeTypes: ["application/json"],
83
83
  category: "json",
84
84
  text: !0,
85
- parseTextSync: g,
86
- parse: async (t) => g(new TextDecoder().decode(t)),
85
+ parseTextSync: b,
86
+ parse: async (t) => b(new TextDecoder().decode(t)),
87
87
  options: {}
88
88
  };
89
- function g(t) {
89
+ function b(t) {
90
90
  return JSON.parse(t);
91
91
  }
92
- class G {
92
+ class H {
93
93
  handle;
94
94
  size;
95
95
  bigsize;
@@ -111,7 +111,7 @@ class G {
111
111
  }
112
112
  }
113
113
  const f = new Error("Not implemented");
114
- class K {
114
+ class Q {
115
115
  handle;
116
116
  size = 0;
117
117
  bigsize = 0n;
@@ -145,12 +145,12 @@ class K {
145
145
  async close() {
146
146
  }
147
147
  }
148
- async function be(t, e, n) {
148
+ async function Te(t, e, n) {
149
149
  t instanceof Blob || (t = new Blob([t]));
150
150
  const r = t.slice(e, e + n);
151
- return await Q(r);
151
+ return await X(r);
152
152
  }
153
- async function Q(t) {
153
+ async function X(t) {
154
154
  return await new Promise((e, n) => {
155
155
  const r = new FileReader();
156
156
  r.onload = (a) => e(a?.target?.result), r.onerror = (a) => n(a), r.readAsArrayBuffer(t);
@@ -161,31 +161,31 @@ function Se(t, e, n, r) {
161
161
  const s = W(e, r), o = O(t, s, n);
162
162
  if (!o)
163
163
  return null;
164
- const c = I(n, o, s), i = x(t), u = () => {
164
+ const c = x(n, o, s), i = I(t), u = () => {
165
165
  throw new Error("parseSync called parse (which is async");
166
166
  };
167
- return r = B({ url: i, _parseSync: u, _parse: u, loaders: e }, c, r || null), X(o, t, c, r);
167
+ return r = B({ url: i, _parseSync: u, _parse: u, loaders: e }, c, r || null), Y(o, t, c, r);
168
168
  }
169
- function X(t, e, n, r) {
169
+ function Y(t, e, n, r) {
170
170
  if (e = _(e, t), t.parseTextSync && typeof e == "string")
171
171
  return t.parseTextSync(e, n);
172
172
  if (t.parseSync && e instanceof ArrayBuffer)
173
173
  return t.parseSync(e, n, r);
174
174
  throw new Error(`${t.name} loader: 'parseSync' not supported by this loader, use 'parse' instead. ${r.url || ""}`);
175
175
  }
176
- function Y(t) {
176
+ function Z(t) {
177
177
  return { ...t, length: j(t), batchType: "data" };
178
178
  }
179
179
  async function l(t, e, n, r) {
180
180
  const a = Array.isArray(e) ? e : void 0;
181
181
  !Array.isArray(e) && !w(e) && (r = void 0, n = e, e = void 0), t = await t, n = n || {};
182
- const s = x(t), o = await P(t, e, n);
182
+ const s = I(t), o = await P(t, e, n);
183
183
  if (!o)
184
184
  return [];
185
- const c = I(n, o, a, s);
186
- return r = B({ url: s, _parseInBatches: l, _parse: k, loaders: a }, c, r || null), await Z(o, t, c, r);
185
+ const c = x(n, o, a, s);
186
+ return r = B({ url: s, _parseInBatches: l, _parse: k, loaders: a }, c, r || null), await K(o, t, c, r);
187
187
  }
188
- async function Z(t, e, n, r) {
188
+ async function K(t, e, n, r) {
189
189
  const a = await ee(t, e, n, r);
190
190
  if (!n?.core?.metadata)
191
191
  return a;
@@ -220,7 +220,7 @@ async function* te(t, e, n, r) {
220
220
  yield ne(s, e);
221
221
  }
222
222
  function ne(t, e) {
223
- const n = D(t) ? Y(t) : {
223
+ const n = D(t) ? Z(t) : {
224
224
  shape: "unknown",
225
225
  batchType: "data",
226
226
  data: t,
@@ -234,13 +234,13 @@ async function re(t, e = []) {
234
234
  n = r(n);
235
235
  return n;
236
236
  }
237
- function Ie(t, e, n, r) {
237
+ function xe(t, e, n, r) {
238
238
  let a;
239
239
  !Array.isArray(e) && !w(e) ? (n = e, a = void 0) : a = e;
240
240
  const s = C(n || {});
241
- return Array.isArray(t) ? t.map((c) => T(c, a, n || {}, s)) : T(t, a, n || {}, s);
241
+ return Array.isArray(t) ? t.map((c) => g(c, a, n || {}, s)) : g(t, a, n || {}, s);
242
242
  }
243
- async function T(t, e, n, r) {
243
+ async function g(t, e, n, r) {
244
244
  if (typeof t == "string") {
245
245
  const s = await r(t);
246
246
  return Array.isArray(e) ? await l(s, e, n) : await l(s, e, n);
@@ -262,7 +262,7 @@ async function ae(t, e, n) {
262
262
  }
263
263
  throw new Error("Writer could not encode data");
264
264
  }
265
- async function xe(t, e, n) {
265
+ async function Ie(t, e, n) {
266
266
  if (e.text && e.encodeText)
267
267
  return await e.encodeText(t, n);
268
268
  if (e.text) {
@@ -282,8 +282,8 @@ function oe(t) {
282
282
  return [{ ...t, start: 0, end: t.length }];
283
283
  }
284
284
  async function Be(t, e, n) {
285
- const a = { ...U(), ...n };
286
- return e.encodeURLtoURL ? ue(e, t, a) : H(e, a) ? await J(e, t, a) : await e.encode(t, a);
285
+ const a = { ...M(), ...n };
286
+ return e.encodeURLtoURL ? ue(e, t, a) : V(e, a) ? await q(e, t, a) : await e.encode(t, a);
287
287
  }
288
288
  function ce(t, e, n) {
289
289
  if (e.encodeSync)
@@ -327,15 +327,15 @@ async function ie(t, e, n, r) {
327
327
  async function ue(t, e, n) {
328
328
  if (h)
329
329
  throw new Error(`Writer ${t.name} not supported in browser`);
330
- const r = b("input");
331
- await new K(r, "w").write(e);
332
- const s = b("output"), o = await ie(r, s, t, n);
333
- return (await M(o)).arrayBuffer();
330
+ const r = T("input");
331
+ await new Q(r, "w").write(e);
332
+ const s = T("output"), o = await ie(r, s, t, n);
333
+ return (await U(o)).arrayBuffer();
334
334
  }
335
335
  function fe(t) {
336
336
  return [{ ...t, start: 0, end: t.length }];
337
337
  }
338
- function b(t) {
338
+ function T(t) {
339
339
  return `/tmp/${t}`;
340
340
  }
341
341
  function Ae(t, e, n) {
@@ -524,7 +524,7 @@ class Oe {
524
524
  // implements IRandomAccessFileSystem
525
525
  // RANDOM ACCESS
526
526
  async openReadableFile(e, n) {
527
- return new G(this.files[e]);
527
+ return new H(this.files[e]);
528
528
  }
529
529
  // PRIVATE
530
530
  // Supports case independent paths, and file usage tracking
@@ -535,7 +535,7 @@ class Oe {
535
535
  }
536
536
  export {
537
537
  $e as FetchError,
538
- Te as JSONLoader,
538
+ ge as JSONLoader,
539
539
  Ne as NullLoader,
540
540
  Ee as NullWorkerLoader,
541
541
  ze as RequestScheduler,
@@ -545,44 +545,44 @@ export {
545
545
  Ce as _unregisterLoaders,
546
546
  ve as assert,
547
547
  z as concatenateArrayBuffersAsync,
548
- Ue as createDataSource,
549
- Me as document,
548
+ Me as createDataSource,
549
+ Ue as document,
550
550
  Be as encode,
551
551
  Le as encodeInBatches,
552
552
  ce as encodeSync,
553
553
  ae as encodeTable,
554
- xe as encodeTableAsText,
554
+ Ie as encodeTableAsText,
555
555
  se as encodeTableInBatches,
556
556
  ke as encodeText,
557
557
  Fe as encodeTextSync,
558
558
  ie as encodeURLtoURL,
559
- M as fetchFile,
559
+ U as fetchFile,
560
560
  je as forEach,
561
- U as getLoaderOptions,
561
+ M as getLoaderOptions,
562
562
  De as getPathPrefix,
563
- Je as global,
564
- qe as isAsyncIterable,
563
+ qe as global,
564
+ Je as isAsyncIterable,
565
565
  h as isBrowser,
566
- He as isIterable,
567
- Ve as isIterator,
568
- Ge as isPromise,
569
- Ke as isPureObject,
570
- Qe as isReadableStream,
571
- Xe as isResponse,
572
- Ye as isWorker,
573
- Ze as isWritableStream,
566
+ Ve as isIterable,
567
+ Ge as isIterator,
568
+ He as isPromise,
569
+ Qe as isPureObject,
570
+ Xe as isReadableStream,
571
+ Ye as isResponse,
572
+ Ze as isWorker,
573
+ Ke as isWritableStream,
574
574
  et as load,
575
- Ie as loadInBatches,
575
+ xe as loadInBatches,
576
576
  tt as makeIterator,
577
577
  pe as makeLineIterator,
578
- ge as makeNumberedLineIterator,
578
+ be as makeNumberedLineIterator,
579
579
  Re as makeStream,
580
580
  me as makeTextDecoderIterator,
581
581
  we as makeTextEncoderIterator,
582
582
  k as parse,
583
583
  l as parseInBatches,
584
584
  Se as parseSync,
585
- be as readArrayBuffer,
585
+ Te as readArrayBuffer,
586
586
  nt as registerLoaders,
587
587
  p as resolvePath,
588
588
  P as selectLoader,
@@ -1,4 +1,4 @@
1
- import { au as Be, av as le, aw as ce, ax as De, ay as Oe, az as ke } from "./index-BSAY6CWm.js";
1
+ import { bx as Be, by as le, bz as ce, bA as De, bB as Oe, bC as ke } from "./index-JjyDEqAS.js";
2
2
  import { y as ve, a as he, z as G, R as J, A as ue, C as Fe, F as xe, n as je, S as Ie, E as Ne } from "./recordbatch-Bpc0uxFn.js";
3
3
  import { g as V, a as fe, b as Le, c as Ue, d as Me, e as qe, m as Ve } from "./table-accessors-CYWTzpQI.js";
4
4
  import { c as $e } from "./convert-arrow-schema-DrAihRf9.js";
@@ -0,0 +1,322 @@
1
+ import { ac as j, ad as S, ae as A, af as M, ag as L } from "./index-JjyDEqAS.js";
2
+ import { ah as H, ai as V, aj as X, ak as K } from "./index-JjyDEqAS.js";
3
+ import { P as h } from "./post-process-effect-DfslKPM6.js";
4
+ const O = `
5
+ float omfx_lum(vec3 c) { return dot(c, vec3(0.299, 0.587, 0.114)); }
6
+ float omfx_hash(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
7
+ `, w = {
8
+ tint: (o) => `
9
+ {
10
+ float L = omfx_lum(color.rgb);
11
+ float sat = max(max(color.r, color.g), color.b) - min(min(color.r, color.g), color.b);
12
+ vec3 duo = mix(${o("ink")}.rgb, ${o("paper")}.rgb, smoothstep(0.0, 1.0, L));
13
+ float keep = clamp(sat * 2.5, 0.0, 1.0) * ${o("keep-color")};
14
+ color.rgb = mix(color.rgb, mix(duo, color.rgb, keep), ${o("amount")});
15
+ }`,
16
+ levels: (o) => `
17
+ {
18
+ color.rgb = clamp((color.rgb - 0.5) * ${o("contrast")} + 0.5 + ${o("brightness")}, 0.0, 1.0);
19
+ color.rgb = pow(max(color.rgb, vec3(0.0)), vec3(1.0 / max(${o("gamma")}, 0.0001)));
20
+ }`,
21
+ saturation: (o) => `
22
+ {
23
+ color.rgb = mix(vec3(omfx_lum(color.rgb)), color.rgb, ${o("amount")});
24
+ }`,
25
+ posterize: (o) => `
26
+ {
27
+ float n = max(${o("levels")}, 2.0);
28
+ color.rgb = floor(color.rgb * n + 0.5) / n;
29
+ }`,
30
+ vignette: (o) => `
31
+ {
32
+ float r = length(coord - 0.5) * 1.41421356;
33
+ float v = smoothstep(${o("radius")}, ${o("radius")} + max(${o("softness")}, 0.0001), r);
34
+ color.rgb *= 1.0 - ${o("amount")} * v;
35
+ }`,
36
+ grain: (o, e) => `
37
+ {
38
+ float cell = max(${o("size")} * ${e}, 1.0);
39
+ vec2 g = floor(coord * texSize / cell) + ${o("seed")};
40
+ float n = omfx_hash(g) - 0.5;
41
+ vec3 nz = ${o("mono")} > 0.5
42
+ ? vec3(n)
43
+ : vec3(n, omfx_hash(g + 17.0) - 0.5, omfx_hash(g + 41.0) - 0.5);
44
+ color.rgb = clamp(color.rgb + nz * ${o("amount")}, 0.0, 1.0);
45
+ }`,
46
+ edges: (o, e) => `
47
+ {
48
+ vec2 o = max(${o("width")} * ${e}, 1.0) / texSize;
49
+ float tl = omfx_lum(texture(src, coord + o * vec2(-1.0, 1.0)).rgb);
50
+ float t = omfx_lum(texture(src, coord + o * vec2( 0.0, 1.0)).rgb);
51
+ float tr = omfx_lum(texture(src, coord + o * vec2( 1.0, 1.0)).rgb);
52
+ float l = omfx_lum(texture(src, coord + o * vec2(-1.0, 0.0)).rgb);
53
+ float r = omfx_lum(texture(src, coord + o * vec2( 1.0, 0.0)).rgb);
54
+ float bl = omfx_lum(texture(src, coord + o * vec2(-1.0, -1.0)).rgb);
55
+ float b = omfx_lum(texture(src, coord + o * vec2( 0.0, -1.0)).rgb);
56
+ float br = omfx_lum(texture(src, coord + o * vec2( 1.0, -1.0)).rgb);
57
+ float gx = (tr + 2.0 * r + br) - (tl + 2.0 * l + bl);
58
+ float gy = (bl + 2.0 * b + br) - (tl + 2.0 * t + tr);
59
+ float e = clamp(sqrt(gx * gx + gy * gy) * 2.0, 0.0, 1.0);
60
+ color.rgb = mix(color.rgb, ${o("color")}.rgb, e * ${o("amount")});
61
+ }`,
62
+ blur: (o, e) => `
63
+ {
64
+ vec2 o = max(${o("radius")} * ${e}, 0.5) / texSize;
65
+ vec4 sum = vec4(0.0);
66
+ float wsum = 0.0;
67
+ for (int i = -2; i <= 2; i++) {
68
+ for (int j = -2; j <= 2; j++) {
69
+ float w = exp(-float(i * i + j * j) / 4.0);
70
+ sum += texture(src, coord + o * vec2(float(i), float(j))) * w;
71
+ wsum += w;
72
+ }
73
+ }
74
+ color = sum / wsum;
75
+ }`,
76
+ sharpen: (o, e) => `
77
+ {
78
+ vec2 o = max(${o("radius")} * ${e}, 0.5) / texSize;
79
+ vec4 soft = vec4(0.0);
80
+ float wsum = 0.0;
81
+ for (int i = -1; i <= 1; i++) {
82
+ for (int j = -1; j <= 1; j++) {
83
+ float w = (i == 0 && j == 0) ? 4.0 : 1.0;
84
+ soft += texture(src, coord + o * vec2(float(i), float(j))) * w;
85
+ wsum += w;
86
+ }
87
+ }
88
+ soft /= wsum;
89
+ color.rgb = clamp(color.rgb + (color.rgb - soft.rgb) * ${o("amount")}, 0.0, 1.0);
90
+ }`,
91
+ halftone: (o, e) => `
92
+ {
93
+ float cell = max(${o("cell")} * ${e}, 2.0);
94
+ float a = radians(${o("angle")});
95
+ float ca = cos(a);
96
+ float sa = sin(a);
97
+ mat2 rot = mat2(ca, -sa, sa, ca);
98
+ mat2 inv = mat2(ca, sa, -sa, ca);
99
+ vec2 p = coord * texSize;
100
+ vec2 rp = rot * p;
101
+ vec2 centre = inv * ((floor(rp / cell) + 0.5) * cell);
102
+ vec4 c = texture(src, clamp(centre / texSize, vec2(0.0), vec2(1.0)));
103
+ float radius = sqrt(clamp(1.0 - omfx_lum(c.rgb), 0.0, 1.0)) * 0.5;
104
+ float d = length(fract(rp / cell) - 0.5);
105
+ float cov = 1.0 - smoothstep(radius - 0.08, radius + 0.08, d);
106
+ vec3 screened = mix(${o("paper")}.rgb, c.rgb, cov);
107
+ color.rgb = mix(color.rgb, screened, ${o("amount")});
108
+ }`
109
+ };
110
+ function b(o) {
111
+ const e = j(o), t = Object.prototype.hasOwnProperty.call(w, o) ? w[o] : void 0;
112
+ return e && t ? { ...e, glsl: t } : void 0;
113
+ }
114
+ const y = ` float omfxAlpha = inColor.a;
115
+ vec4 color = vec4(omfxAlpha > 0.0 ? inColor.rgb / omfxAlpha : vec3(0.0), omfxAlpha);`, _ = " return vec4(color.rgb * omfxAlpha, omfxAlpha);";
116
+ function z(o) {
117
+ const e = [];
118
+ let t = [];
119
+ const s = () => {
120
+ t.length > 0 && e.push({ kind: "pointwise", ops: t }), t = [];
121
+ };
122
+ return o.forEach((n, l) => {
123
+ if (n.def.kind === "pointwise") {
124
+ t.push(l);
125
+ return;
126
+ }
127
+ s(), e.push({ kind: "neighbourhood", op: l });
128
+ }), s(), e;
129
+ }
130
+ function T(o, e) {
131
+ if (o.length === 0) return null;
132
+ const t = [], s = [], n = /* @__PURE__ */ new Map();
133
+ o.forEach((a, u) => {
134
+ for (const g of a.def.params) {
135
+ const v = a.values[g.name];
136
+ let p;
137
+ g.kind === "color" ? (p = `c${t.length}`, t.push({ key: p, value: Array.isArray(v) ? v : [0, 0, 0, 1] })) : (p = `f${s.length}`, s.push({ key: p, value: typeof v == "number" ? v : 0 })), n.set(`${u}:${g.name}`, `${e}.${p}`);
138
+ }
139
+ });
140
+ const l = {}, c = {}, r = [];
141
+ for (const { key: a, value: u } of t)
142
+ l[a] = u, c[a] = "vec4<f32>", r.push(` vec4 ${a};`);
143
+ for (const { key: a, value: u } of s)
144
+ l[a] = u, c[a] = "f32", r.push(` float ${a};`);
145
+ l.pxPerMm = S, c.pxPerMm = "f32", r.push(" float pxPerMm;");
146
+ const i = `${e}.pxPerMm`, f = (a) => (u) => n.get(`${a}:${u}`) ?? "0.0", m = [], d = [];
147
+ z(o).forEach((a, u) => {
148
+ if (a.kind === "pointwise") {
149
+ const p = `${e}_p${u}`, E = a.ops.map(($) => o[$].def.glsl(f($), i)).join(`
150
+ `);
151
+ m.push(
152
+ `vec4 ${p}(vec4 inColor, vec2 texSize, vec2 coord) {
153
+ ${y}
154
+ ${E}
155
+ ${_}
156
+ }`
157
+ ), d.push({ filter: p });
158
+ return;
159
+ }
160
+ const g = `${e}_n${u}`, v = o[a.op].def.glsl(f(a.op), i);
161
+ m.push(
162
+ `vec4 ${g}(sampler2D src, vec2 texSize, vec2 coord) {
163
+ vec4 inColor = texture(src, coord);
164
+ ${y}
165
+ ${v}
166
+ ${_}
167
+ }`
168
+ ), d.push({ sampler: g });
169
+ });
170
+ const x = [
171
+ `layout(std140) uniform ${e}Uniforms {`,
172
+ ...r,
173
+ `} ${e};`,
174
+ O,
175
+ ...m
176
+ ].join(`
177
+ `);
178
+ return {
179
+ // A multi-pass module names the function each pass runs, which deck's
180
+ // runtime reads (`typeof pass.filter === 'string' ? pass.filter : …`) but
181
+ // its `ShaderSubPass` type declares as a boolean — a deck typing gap, not
182
+ // a runtime one, the same shape as `maxZoom` on the standalone controller.
183
+ module: { name: e, fs: x, uniformTypes: c, passes: d },
184
+ uniforms: l,
185
+ passCount: d.length
186
+ };
187
+ }
188
+ const C = /^\s*(-?[\d.]+)\s*(mm)?\s*$/i, N = /^\s*(-?[\d.]+)\s*(deg)?\s*$/i;
189
+ function k(o, e) {
190
+ if (o.kind === "color") {
191
+ const s = L(e);
192
+ if (!s) return;
193
+ const [n, l, c, r] = s;
194
+ return [n / 255, l / 255, c / 255, r === void 0 ? 1 : r > 1 ? r / 255 : r];
195
+ }
196
+ if (o.kind === "length" || o.kind === "angle") {
197
+ const s = (o.kind === "length" ? C : N).exec(e);
198
+ if (!s) return;
199
+ const n = Number(s[1]);
200
+ return Number.isFinite(n) ? n : void 0;
201
+ }
202
+ const t = Number(e);
203
+ return Number.isFinite(t) ? t : void 0;
204
+ }
205
+ function U(o) {
206
+ return k(o, String(o.default)) ?? 0;
207
+ }
208
+ function P(o, e) {
209
+ const t = b(o);
210
+ if (!t) return null;
211
+ const s = {};
212
+ for (const n of t.params) {
213
+ const l = e(n.name), c = l === null ? void 0 : k(n, l);
214
+ s[n.name] = c ?? U(n);
215
+ }
216
+ return { op: o, values: s };
217
+ }
218
+ function R(o) {
219
+ if (!o || typeof o != "object") return !1;
220
+ const e = o;
221
+ return typeof e.name == "string" && typeof e.fs == "string" && Array.isArray(e.passes) && e.passes.length > 0;
222
+ }
223
+ function J(o) {
224
+ const e = [];
225
+ for (const t of Array.from(o.querySelectorAll(":scope > om-effect"))) {
226
+ const s = t.getAttribute("preset"), n = t.getAttribute("op"), l = t.querySelector(":scope > script[type='application/json']");
227
+ if (s !== null && s !== "") {
228
+ if (!A(s)) {
229
+ console.warn(`[onlymapjs] <om-effect preset="${s}"> is not a known preset — skipped.`, t);
230
+ continue;
231
+ }
232
+ const c = M[s].map(({ op: r, params: i }) => b(r) ? P(r, (m) => {
233
+ const d = t.getAttribute(`${r}-${m}`);
234
+ if (d !== null) return d;
235
+ const x = i[m];
236
+ return x === void 0 ? null : String(x);
237
+ }) : null).filter((r) => r !== null);
238
+ e.push({ ops: c });
239
+ continue;
240
+ }
241
+ if (n !== null && n !== "") {
242
+ const c = P(n, (r) => t.getAttribute(r));
243
+ if (!c) {
244
+ console.warn(`[onlymapjs] <om-effect op="${n}"> is not a known op — skipped.`, t);
245
+ continue;
246
+ }
247
+ e.push({ ops: [c] });
248
+ continue;
249
+ }
250
+ if (l) {
251
+ let c;
252
+ try {
253
+ c = JSON.parse(l.textContent ?? "");
254
+ } catch (f) {
255
+ console.warn(`[onlymapjs] <om-effect>'s inline module is not valid JSON — skipped. ${String(f)}`, t);
256
+ continue;
257
+ }
258
+ if (!R(c)) {
259
+ console.warn(
260
+ "[onlymapjs] <om-effect>'s inline module needs `name`, `fs` and a non-empty `passes` — skipped.",
261
+ t
262
+ );
263
+ continue;
264
+ }
265
+ let r = {};
266
+ const i = t.getAttribute("uniforms");
267
+ if (i)
268
+ try {
269
+ r = JSON.parse(i);
270
+ } catch (f) {
271
+ console.warn(`[onlymapjs] <om-effect uniforms> is not valid JSON — ignored. ${String(f)}`, t);
272
+ }
273
+ e.push({ raw: { module: c, uniforms: r } });
274
+ continue;
275
+ }
276
+ console.warn("[onlymapjs] <om-effect> needs `preset`, `op`, or an inline module — skipped.", t);
277
+ }
278
+ return e;
279
+ }
280
+ let F = 0;
281
+ const q = () => F++;
282
+ function D(o, e = S) {
283
+ const t = [], s = [];
284
+ let n = [];
285
+ const l = q(), c = () => {
286
+ if (n.length === 0) return;
287
+ const r = T(n, `omfx${l}_${t.length}`);
288
+ if (n = [], !r) return;
289
+ const i = { ...r.uniforms, pxPerMm: e }, f = new h(r.module, i);
290
+ s.push({ effect: f, uniforms: r.uniforms }), t.push(f);
291
+ };
292
+ for (const r of o) {
293
+ if (r.ops) {
294
+ for (const { op: i, values: f } of r.ops) {
295
+ const m = b(i);
296
+ m && n.push({ def: m, values: f });
297
+ }
298
+ continue;
299
+ }
300
+ r.raw && (c(), t.push(new h(r.raw.module, r.raw.uniforms)));
301
+ }
302
+ return c(), {
303
+ effects: t,
304
+ setPixelsPerMm(r) {
305
+ for (const { effect: i, uniforms: f } of s) i.setProps({ ...f, pxPerMm: r });
306
+ }
307
+ };
308
+ }
309
+ export {
310
+ S as CSS_PX_PER_MM,
311
+ M as EFFECT_PRESETS,
312
+ H as EFFECT_PRESET_NAMES,
313
+ V as OP_META,
314
+ X as OP_NAMES,
315
+ D as buildPostProcessEffects,
316
+ k as coerceParam,
317
+ K as expandPreset,
318
+ A as isEffectPreset,
319
+ b as opDef,
320
+ j as opMeta,
321
+ J as parseEffectEls
322
+ };