@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,511 +0,0 @@
1
- import { M as A, G as k, u as T, P as M, i as j, o as F, C as w, a as z, E as O, c as L } from "./index-BSAY6CWm.js";
2
- import { b as io, O as lo, d as ao, e as fo } from "./index-BSAY6CWm.js";
3
- const R = (
4
- /* wgsl */
5
- `struct VertexInputs {
6
- @location(0) clipSpacePositions: vec2<f32>,
7
- @location(1) texCoords: vec2<f32>,
8
- @location(2) coordinates: vec2<f32>
9
- }
10
-
11
- struct FragmentInputs {
12
- @builtin(position) Position : vec4<f32>,
13
- @location(0) position : vec2<f32>,
14
- @location(1) coordinate : vec2<f32>,
15
- @location(2) uv : vec2<f32>
16
- };
17
-
18
- @vertex
19
- fn vertexMain(inputs: VertexInputs) -> FragmentInputs {
20
- var outputs: FragmentInputs;
21
- outputs.Position = vec4(inputs.clipSpacePositions, 0., 1.);
22
- outputs.position = inputs.clipSpacePositions;
23
- outputs.coordinate = inputs.coordinates;
24
- outputs.uv = inputs.texCoords;
25
- return outputs;
26
- }
27
- `
28
- ), I = (
29
- /* glsl */
30
- `#version 300 es
31
- in vec2 clipSpacePositions;
32
- in vec2 texCoords;
33
- in vec2 coordinates;
34
-
35
- out vec2 position;
36
- out vec2 coordinate;
37
- out vec2 uv;
38
-
39
- void main(void) {
40
- gl_Position = vec4(clipSpacePositions, 0., 1.);
41
- position = clipSpacePositions;
42
- coordinate = coordinates;
43
- uv = texCoords;
44
- }
45
- `
46
- ), $ = [-1, -1, 1, -1, -1, 1, 1, 1];
47
- class B extends A {
48
- constructor(e, t) {
49
- const n = $.map((r) => r === -1 ? 0 : r);
50
- t.source && (t = { ...t, source: `${R}
51
- ${t.source}` }), super(e, {
52
- id: t.id || T("clip-space"),
53
- ...t,
54
- vs: I,
55
- vertexCount: 4,
56
- geometry: new k({
57
- topology: "triangle-strip",
58
- vertexCount: 4,
59
- attributes: {
60
- clipSpacePositions: { size: 2, value: new Float32Array($) },
61
- texCoords: { size: 2, value: new Float32Array(n) },
62
- coordinates: { size: 2, value: new Float32Array(n) }
63
- }
64
- })
65
- });
66
- }
67
- }
68
- const D = `layout(std140) uniform screenUniforms {
69
- vec2 texSize;
70
- } screen;
71
- `, N = {
72
- name: "screen",
73
- fs: D,
74
- uniformTypes: {
75
- texSize: "vec2<f32>"
76
- }
77
- };
78
- class U extends M {
79
- constructor(e, t) {
80
- super(e, t);
81
- const { module: n, fs: r, id: i } = t, c = {
82
- depthWriteEnabled: !1,
83
- depthCompare: "always",
84
- depthBias: 0,
85
- blend: !0,
86
- blendColorSrcFactor: "one",
87
- blendColorDstFactor: "one-minus-src-alpha",
88
- blendAlphaSrcFactor: "one",
89
- blendAlphaDstFactor: "one-minus-src-alpha",
90
- blendColorOperation: "add",
91
- blendAlphaOperation: "add"
92
- };
93
- this.model = new B(e, { id: i, fs: r, modules: [n, N], parameters: c });
94
- }
95
- render(e) {
96
- this._renderPass(this.device, e);
97
- }
98
- delete() {
99
- this.model.destroy(), this.model = null;
100
- }
101
- // Private methods
102
- /**
103
- * Renders the pass.
104
- * This is an abstract method that should be overridden.
105
- * @param inputBuffer - Frame buffer that contains the result of the previous pass
106
- * @param outputBuffer - Frame buffer that serves as the output render target
107
- */
108
- _renderPass(e, t) {
109
- const { clearCanvas: n, inputBuffer: r, outputBuffer: i } = t, c = [r.width, r.height], s = {
110
- texSrc: r.colorAttachments[0],
111
- texSize: c
112
- };
113
- this.model.shaderInputs.setProps({
114
- screen: s,
115
- ...t.moduleProps
116
- });
117
- const l = this.device.beginRenderPass({
118
- framebuffer: i,
119
- parameters: { viewport: [0, 0, ...c] },
120
- clearColor: n ? [0, 0, 0, 0] : !1,
121
- clearDepth: 1,
122
- clearStencil: !1
123
- });
124
- this.model.draw(l), l.end();
125
- }
126
- }
127
- class S {
128
- constructor(e, t) {
129
- this.id = `${e.name}-pass`, this.props = t, j(e), this.module = e;
130
- }
131
- setup({ device: e }) {
132
- this.passes = G(e, this.module, this.id);
133
- }
134
- setProps(e) {
135
- this.props = e;
136
- }
137
- // eslint-disable-next-line @typescript-eslint/no-empty-function
138
- preRender() {
139
- }
140
- postRender(e) {
141
- const t = this.passes, { target: n } = e;
142
- let r = e.inputBuffer, i = e.swapBuffer;
143
- for (let c = 0; c < t.length; c++) {
144
- const s = c === t.length - 1, l = n !== void 0 && s;
145
- l && (i = n);
146
- const f = !l || !!e.clearCanvas, u = {}, d = this.module.passes[c].uniforms;
147
- u[this.module.name] = { ...this.props, ...d }, t[c].render({ clearCanvas: f, inputBuffer: r, outputBuffer: i, moduleProps: u });
148
- const v = i;
149
- i = r, r = v;
150
- }
151
- return r;
152
- }
153
- cleanup() {
154
- if (this.passes) {
155
- for (const e of this.passes)
156
- e.delete();
157
- this.passes = void 0;
158
- }
159
- }
160
- }
161
- function G(o, e, t) {
162
- return e.passes.map((n, r) => {
163
- const i = J(e, n), c = `${t}-${r}`;
164
- return new U(o, { id: c, module: e, fs: i });
165
- });
166
- }
167
- const y = `#version 300 es
168
- uniform sampler2D texSrc;
169
-
170
- in vec2 position;
171
- in vec2 coordinate;
172
- in vec2 uv;
173
-
174
- out vec4 fragColor;
175
- `, V = (o) => `${y}
176
- void main() {
177
- fragColor = texture(texSrc, coordinate);
178
- fragColor = ${o}(fragColor, screen.texSize, coordinate);
179
- }
180
- `, q = (o) => `${y}
181
- void main() {
182
- fragColor = ${o}(texSrc, screen.texSize, coordinate);
183
- }
184
- `;
185
- function J(o, e) {
186
- if (e.filter) {
187
- const t = typeof e.filter == "string" ? e.filter : `${o.name}_filterColor_ext`;
188
- return V(t);
189
- }
190
- if (e.sampler) {
191
- const t = typeof e.sampler == "string" ? e.sampler : `${o.name}_sampleColor`;
192
- return q(t);
193
- }
194
- return "";
195
- }
196
- const X = `
197
- float omfx_lum(vec3 c) { return dot(c, vec3(0.299, 0.587, 0.114)); }
198
- float omfx_hash(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
199
- `, P = {
200
- tint: (o) => `
201
- {
202
- float L = omfx_lum(color.rgb);
203
- float sat = max(max(color.r, color.g), color.b) - min(min(color.r, color.g), color.b);
204
- vec3 duo = mix(${o("ink")}.rgb, ${o("paper")}.rgb, smoothstep(0.0, 1.0, L));
205
- float keep = clamp(sat * 2.5, 0.0, 1.0) * ${o("keep-color")};
206
- color.rgb = mix(color.rgb, mix(duo, color.rgb, keep), ${o("amount")});
207
- }`,
208
- levels: (o) => `
209
- {
210
- color.rgb = clamp((color.rgb - 0.5) * ${o("contrast")} + 0.5 + ${o("brightness")}, 0.0, 1.0);
211
- color.rgb = pow(max(color.rgb, vec3(0.0)), vec3(1.0 / max(${o("gamma")}, 0.0001)));
212
- }`,
213
- saturation: (o) => `
214
- {
215
- color.rgb = mix(vec3(omfx_lum(color.rgb)), color.rgb, ${o("amount")});
216
- }`,
217
- posterize: (o) => `
218
- {
219
- float n = max(${o("levels")}, 2.0);
220
- color.rgb = floor(color.rgb * n + 0.5) / n;
221
- }`,
222
- vignette: (o) => `
223
- {
224
- float r = length(coord - 0.5) * 1.41421356;
225
- float v = smoothstep(${o("radius")}, ${o("radius")} + max(${o("softness")}, 0.0001), r);
226
- color.rgb *= 1.0 - ${o("amount")} * v;
227
- }`,
228
- grain: (o, e) => `
229
- {
230
- float cell = max(${o("size")} * ${e}, 1.0);
231
- vec2 g = floor(coord * texSize / cell) + ${o("seed")};
232
- float n = omfx_hash(g) - 0.5;
233
- vec3 nz = ${o("mono")} > 0.5
234
- ? vec3(n)
235
- : vec3(n, omfx_hash(g + 17.0) - 0.5, omfx_hash(g + 41.0) - 0.5);
236
- color.rgb = clamp(color.rgb + nz * ${o("amount")}, 0.0, 1.0);
237
- }`,
238
- edges: (o, e) => `
239
- {
240
- vec2 o = max(${o("width")} * ${e}, 1.0) / texSize;
241
- float tl = omfx_lum(texture(src, coord + o * vec2(-1.0, 1.0)).rgb);
242
- float t = omfx_lum(texture(src, coord + o * vec2( 0.0, 1.0)).rgb);
243
- float tr = omfx_lum(texture(src, coord + o * vec2( 1.0, 1.0)).rgb);
244
- float l = omfx_lum(texture(src, coord + o * vec2(-1.0, 0.0)).rgb);
245
- float r = omfx_lum(texture(src, coord + o * vec2( 1.0, 0.0)).rgb);
246
- float bl = omfx_lum(texture(src, coord + o * vec2(-1.0, -1.0)).rgb);
247
- float b = omfx_lum(texture(src, coord + o * vec2( 0.0, -1.0)).rgb);
248
- float br = omfx_lum(texture(src, coord + o * vec2( 1.0, -1.0)).rgb);
249
- float gx = (tr + 2.0 * r + br) - (tl + 2.0 * l + bl);
250
- float gy = (bl + 2.0 * b + br) - (tl + 2.0 * t + tr);
251
- float e = clamp(sqrt(gx * gx + gy * gy) * 2.0, 0.0, 1.0);
252
- color.rgb = mix(color.rgb, ${o("color")}.rgb, e * ${o("amount")});
253
- }`,
254
- blur: (o, e) => `
255
- {
256
- vec2 o = max(${o("radius")} * ${e}, 0.5) / texSize;
257
- vec4 sum = vec4(0.0);
258
- float wsum = 0.0;
259
- for (int i = -2; i <= 2; i++) {
260
- for (int j = -2; j <= 2; j++) {
261
- float w = exp(-float(i * i + j * j) / 4.0);
262
- sum += texture(src, coord + o * vec2(float(i), float(j))) * w;
263
- wsum += w;
264
- }
265
- }
266
- color = sum / wsum;
267
- }`,
268
- sharpen: (o, e) => `
269
- {
270
- vec2 o = max(${o("radius")} * ${e}, 0.5) / texSize;
271
- vec4 soft = vec4(0.0);
272
- float wsum = 0.0;
273
- for (int i = -1; i <= 1; i++) {
274
- for (int j = -1; j <= 1; j++) {
275
- float w = (i == 0 && j == 0) ? 4.0 : 1.0;
276
- soft += texture(src, coord + o * vec2(float(i), float(j))) * w;
277
- wsum += w;
278
- }
279
- }
280
- soft /= wsum;
281
- color.rgb = clamp(color.rgb + (color.rgb - soft.rgb) * ${o("amount")}, 0.0, 1.0);
282
- }`,
283
- halftone: (o, e) => `
284
- {
285
- float cell = max(${o("cell")} * ${e}, 2.0);
286
- float a = radians(${o("angle")});
287
- float ca = cos(a);
288
- float sa = sin(a);
289
- mat2 rot = mat2(ca, -sa, sa, ca);
290
- mat2 inv = mat2(ca, sa, -sa, ca);
291
- vec2 p = coord * texSize;
292
- vec2 rp = rot * p;
293
- vec2 centre = inv * ((floor(rp / cell) + 0.5) * cell);
294
- vec4 c = texture(src, clamp(centre / texSize, vec2(0.0), vec2(1.0)));
295
- float radius = sqrt(clamp(1.0 - omfx_lum(c.rgb), 0.0, 1.0)) * 0.5;
296
- float d = length(fract(rp / cell) - 0.5);
297
- float cov = 1.0 - smoothstep(radius - 0.08, radius + 0.08, d);
298
- vec3 screened = mix(${o("paper")}.rgb, c.rgb, cov);
299
- color.rgb = mix(color.rgb, screened, ${o("amount")});
300
- }`
301
- };
302
- function x(o) {
303
- const e = F(o), t = Object.prototype.hasOwnProperty.call(P, o) ? P[o] : void 0;
304
- return e && t ? { ...e, glsl: t } : void 0;
305
- }
306
- function H(o) {
307
- const e = [];
308
- let t = [];
309
- const n = () => {
310
- t.length > 0 && e.push({ kind: "pointwise", ops: t }), t = [];
311
- };
312
- return o.forEach((r, i) => {
313
- if (r.def.kind === "pointwise") {
314
- t.push(i);
315
- return;
316
- }
317
- n(), e.push({ kind: "neighbourhood", op: i });
318
- }), n(), e;
319
- }
320
- function W(o, e) {
321
- if (o.length === 0) return null;
322
- const t = [], n = [], r = /* @__PURE__ */ new Map();
323
- o.forEach((a, p) => {
324
- for (const g of a.def.params) {
325
- const h = a.values[g.name];
326
- let m;
327
- g.kind === "color" ? (m = `c${t.length}`, t.push({ key: m, value: Array.isArray(h) ? h : [0, 0, 0, 1] })) : (m = `f${n.length}`, n.push({ key: m, value: typeof h == "number" ? h : 0 })), r.set(`${p}:${g.name}`, `${e}.${m}`);
328
- }
329
- });
330
- const i = {}, c = {}, s = [];
331
- for (const { key: a, value: p } of t)
332
- i[a] = p, c[a] = "vec4<f32>", s.push(` vec4 ${a};`);
333
- for (const { key: a, value: p } of n)
334
- i[a] = p, c[a] = "f32", s.push(` float ${a};`);
335
- i.pxPerMm = w, c.pxPerMm = "f32", s.push(" float pxPerMm;");
336
- const l = `${e}.pxPerMm`, f = (a) => (p) => r.get(`${a}:${p}`) ?? "0.0", u = [], d = [];
337
- H(o).forEach((a, p) => {
338
- if (a.kind === "pointwise") {
339
- const m = `${e}_p${p}`, C = a.ops.map((b) => o[b].def.glsl(f(b), l)).join(`
340
- `);
341
- u.push(
342
- `vec4 ${m}(vec4 inColor, vec2 texSize, vec2 coord) {
343
- vec4 color = inColor;
344
- ${C}
345
- return color;
346
- }`
347
- ), d.push({ filter: m });
348
- return;
349
- }
350
- const g = `${e}_n${p}`, h = o[a.op].def.glsl(f(a.op), l);
351
- u.push(
352
- `vec4 ${g}(sampler2D src, vec2 texSize, vec2 coord) {
353
- vec4 color = texture(src, coord);
354
- ${h}
355
- return color;
356
- }`
357
- ), d.push({ sampler: g });
358
- });
359
- const v = [
360
- `layout(std140) uniform ${e}Uniforms {`,
361
- ...s,
362
- `} ${e};`,
363
- X,
364
- ...u
365
- ].join(`
366
- `);
367
- return {
368
- // A multi-pass module names the function each pass runs, which deck's
369
- // runtime reads (`typeof pass.filter === 'string' ? pass.filter : …`) but
370
- // its `ShaderSubPass` type declares as a boolean — a deck typing gap, not
371
- // a runtime one, the same shape as `maxZoom` on the standalone controller.
372
- module: { name: e, fs: v, uniformTypes: c, passes: d },
373
- uniforms: i,
374
- passCount: d.length
375
- };
376
- }
377
- const K = /^\s*(-?[\d.]+)\s*(mm)?\s*$/i, Q = /^\s*(-?[\d.]+)\s*(deg)?\s*$/i;
378
- function E(o, e) {
379
- if (o.kind === "color") {
380
- const n = L(e);
381
- if (!n) return;
382
- const [r, i, c, s] = n;
383
- return [r / 255, i / 255, c / 255, s === void 0 ? 1 : s > 1 ? s / 255 : s];
384
- }
385
- if (o.kind === "length" || o.kind === "angle") {
386
- const n = (o.kind === "length" ? K : Q).exec(e);
387
- if (!n) return;
388
- const r = Number(n[1]);
389
- return Number.isFinite(r) ? r : void 0;
390
- }
391
- const t = Number(e);
392
- return Number.isFinite(t) ? t : void 0;
393
- }
394
- function Y(o) {
395
- return E(o, String(o.default)) ?? 0;
396
- }
397
- function _(o, e) {
398
- const t = x(o);
399
- if (!t) return null;
400
- const n = {};
401
- for (const r of t.params) {
402
- const i = e(r.name), c = i === null ? void 0 : E(r, i);
403
- n[r.name] = c ?? Y(r);
404
- }
405
- return { op: o, values: n };
406
- }
407
- function Z(o) {
408
- if (!o || typeof o != "object") return !1;
409
- const e = o;
410
- return typeof e.name == "string" && typeof e.fs == "string" && Array.isArray(e.passes) && e.passes.length > 0;
411
- }
412
- function ro(o) {
413
- const e = [];
414
- for (const t of Array.from(o.querySelectorAll(":scope > om-effect"))) {
415
- const n = t.getAttribute("preset"), r = t.getAttribute("op"), i = t.querySelector(":scope > script[type='application/json']");
416
- if (n !== null && n !== "") {
417
- if (!z(n)) {
418
- console.warn(`[onlymapjs] <om-effect preset="${n}"> is not a known preset — skipped.`, t);
419
- continue;
420
- }
421
- const c = O[n].map(({ op: s, params: l }) => x(s) ? _(s, (u) => {
422
- const d = t.getAttribute(`${s}-${u}`);
423
- if (d !== null) return d;
424
- const v = l[u];
425
- return v === void 0 ? null : String(v);
426
- }) : null).filter((s) => s !== null);
427
- e.push({ ops: c });
428
- continue;
429
- }
430
- if (r !== null && r !== "") {
431
- const c = _(r, (s) => t.getAttribute(s));
432
- if (!c) {
433
- console.warn(`[onlymapjs] <om-effect op="${r}"> is not a known op — skipped.`, t);
434
- continue;
435
- }
436
- e.push({ ops: [c] });
437
- continue;
438
- }
439
- if (i) {
440
- let c;
441
- try {
442
- c = JSON.parse(i.textContent ?? "");
443
- } catch (f) {
444
- console.warn(`[onlymapjs] <om-effect>'s inline module is not valid JSON — skipped. ${String(f)}`, t);
445
- continue;
446
- }
447
- if (!Z(c)) {
448
- console.warn(
449
- "[onlymapjs] <om-effect>'s inline module needs `name`, `fs` and a non-empty `passes` — skipped.",
450
- t
451
- );
452
- continue;
453
- }
454
- let s = {};
455
- const l = t.getAttribute("uniforms");
456
- if (l)
457
- try {
458
- s = JSON.parse(l);
459
- } catch (f) {
460
- console.warn(`[onlymapjs] <om-effect uniforms> is not valid JSON — ignored. ${String(f)}`, t);
461
- }
462
- e.push({ raw: { module: c, uniforms: s } });
463
- continue;
464
- }
465
- console.warn("[onlymapjs] <om-effect> needs `preset`, `op`, or an inline module — skipped.", t);
466
- }
467
- return e;
468
- }
469
- let oo = 0;
470
- const eo = () => oo++;
471
- function so(o, e = w) {
472
- const t = [], n = [];
473
- let r = [];
474
- const i = eo(), c = () => {
475
- if (r.length === 0) return;
476
- const s = W(r, `omfx${i}_${t.length}`);
477
- if (r = [], !s) return;
478
- const l = { ...s.uniforms, pxPerMm: e }, f = new S(s.module, l);
479
- n.push({ effect: f, uniforms: s.uniforms }), t.push(f);
480
- };
481
- for (const s of o) {
482
- if (s.ops) {
483
- for (const { op: l, values: f } of s.ops) {
484
- const u = x(l);
485
- u && r.push({ def: u, values: f });
486
- }
487
- continue;
488
- }
489
- s.raw && (c(), t.push(new S(s.raw.module, s.raw.uniforms)));
490
- }
491
- return c(), {
492
- effects: t,
493
- setPixelsPerMm(s) {
494
- for (const { effect: l, uniforms: f } of n) l.setProps({ ...f, pxPerMm: s });
495
- }
496
- };
497
- }
498
- export {
499
- w as CSS_PX_PER_MM,
500
- O as EFFECT_PRESETS,
501
- io as EFFECT_PRESET_NAMES,
502
- lo as OP_META,
503
- ao as OP_NAMES,
504
- so as buildPostProcessEffects,
505
- E as coerceParam,
506
- fo as expandPreset,
507
- z as isEffectPreset,
508
- x as opDef,
509
- F as opMeta,
510
- ro as parseEffectEls
511
- };
@@ -1,30 +0,0 @@
1
- import { C as a, D as s } from "./raster-Dg5p_99H.js";
2
- const D = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3
- __proto__: null
4
- }, Symbol.toStringTag, { value: "Module" }));
5
- var t;
6
- (function(e) {
7
- e[e.None = 0] = "None", e[e.Deflate = 1] = "Deflate", e[e.Zstd = 2] = "Zstd";
8
- })(t || (t = {}));
9
- let l = !1;
10
- async function d() {
11
- const e = await import("./LercDecode.es-BMcxSLhD.js");
12
- return l || (await e.load(), l = !0), e;
13
- }
14
- async function i(e, r) {
15
- const o = r.lercParameters?.[1] ?? t.None;
16
- let n = e;
17
- if (o === t.Deflate || o === t.Zstd) {
18
- const c = o === t.Deflate ? a.Deflate : a.Zstd;
19
- n = await (await s.get(c)())(e, r);
20
- }
21
- return { layout: "band-separate", bands: (await d()).decode(n).pixels };
22
- }
23
- const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24
- __proto__: null,
25
- decode: i
26
- }, Symbol.toStringTag, { value: "Module" }));
27
- export {
28
- D as _,
29
- b as l
30
- };