@nika-js/onlymap 0.13.3 → 0.13.4

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 (61) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +8 -4
  3. package/dist/{basemap-5NHR6Gio.js → basemap-BiC_RwbV.js} +3 -7
  4. package/dist/basemap.d.ts +1 -5
  5. package/dist/bbox-tokens.d.ts +70 -0
  6. package/dist/{build-DJjheWZ2.js → build-DQCmcQE1.js} +1 -1
  7. package/dist/{client-0mQmDog8.js → client-C0CgEs_P.js} +2 -2
  8. package/dist/clip-box-controller.d.ts +0 -17
  9. package/dist/ctx.d.ts +15 -0
  10. package/dist/data-layer.d.ts +15 -8
  11. package/dist/dom-tile-layer.d.ts +30 -0
  12. package/dist/draw-controller.d.ts +1 -1
  13. package/dist/elements/om-map.d.ts +12 -1
  14. package/dist/feature-service.d.ts +42 -0
  15. package/dist/geodesy.d.ts +6 -5
  16. package/dist/{geoparquet-B_nO2OyP.js → geoparquet-DbVJrJYG.js} +1 -1
  17. package/dist/{globe-view-BFUa9ksE.js → globe-view-CrGbvqqZ.js} +1 -1
  18. package/dist/grid-tiles.d.ts +117 -0
  19. package/dist/{hillshade-B_CxPhtA.js → hillshade-CGY_OBaG.js} +2 -2
  20. package/dist/{hillshade-shader-r7GxxjXj.js → hillshade-shader-w8tmFgaV.js} +1 -1
  21. package/dist/{index-CU7RnKnO.js → index-2lD29y87.js} +25 -25
  22. package/dist/index-BahtHUrg.js +8458 -0
  23. package/dist/{index-DT5d7kFO.js → index-Bdltig68.js} +1 -1
  24. package/dist/{index-BvNxS6dM.js → index-ChoEWeXU.js} +1 -1
  25. package/dist/{index-A1FYw2dy.js → index-Cm2sfhw7.js} +1 -1
  26. package/dist/{index-DWijIMti.js → index-DrCMvhhr.js} +32340 -31035
  27. package/dist/{index-CObPGkze.js → index-Dtsf-TPD.js} +22 -22
  28. package/dist/{index-ChmxbIdj.js → index-GfvWJDX0.js} +36 -36
  29. package/dist/{index-YMu_yLXO.js → index-QrGqSW_H.js} +3 -3
  30. package/dist/{index-CgIuV5Oh.js → index-xF9sKoMB.js} +3 -3
  31. package/dist/index.d.ts +1 -1
  32. package/dist/layer-registry.d.ts +1 -0
  33. package/dist/layers/warped-bitmap-layer.d.ts +14 -1
  34. package/dist/{lerc-Bl4vym9y.js → lerc-DxujwTm7.js} +1 -1
  35. package/dist/onlymap.standalone.js +68435 -58161
  36. package/dist/onlymapjs.js +21 -21
  37. package/dist/parse-manifest.d.ts +4 -1
  38. package/dist/plane-gpu/plane-basemap.d.ts +158 -158
  39. package/dist/plane-vector/plane-mvt-layer.d.ts +158 -158
  40. package/dist/plane-warp.d.ts +14 -1
  41. package/dist/pmtiles.d.ts +76 -0
  42. package/dist/{post-process-effect-gFGVlC77.js → post-process-effect-BL9rBDEh.js} +1 -1
  43. package/dist/programmatic.d.ts +17 -1
  44. package/dist/{raster-1ShXyF12.js → raster-Bq768NZr.js} +4 -4
  45. package/dist/{raster-pipeline-BMS54TX2.js → raster-pipeline-C898iYqw.js} +11 -11
  46. package/dist/runtime-core.d.ts +106 -4
  47. package/dist/{terrain-inspect-Cndlmxig.js → terrain-inspect-DNZO8z6S.js} +1 -1
  48. package/dist/{text-on-path-QInco4aP.js → text-on-path-owfh8Ac6.js} +1 -1
  49. package/dist/tile-url.d.ts +84 -16
  50. package/dist/time-dimension.d.ts +25 -0
  51. package/dist/vector-style-BlnKzVND.js +518 -0
  52. package/dist/vector-style.d.ts +59 -0
  53. package/dist/version.d.ts +1 -1
  54. package/dist/{zarr-CYD8fyBe.js → zarr-CMWiR63-.js} +2 -2
  55. package/docs/cartograph.md +2 -2
  56. package/llms.txt +3 -3
  57. package/onlymapjs.attributes.json +15 -0
  58. package/onlymapjs.html-data.json +40 -0
  59. package/package.json +5 -2
  60. package/skills/onlymapjs/SKILL.md +9 -3
  61. package/skills/onlymapjs/references/syntax.md +36 -6
@@ -0,0 +1,518 @@
1
+ import { a0 as U, v as W, B as D, aQ as V, g as I, aR as S, aS as q, aT as J, am as Y } from "./index-DrCMvhhr.js";
2
+ const H = (
3
+ /* glsl */
4
+ `
5
+ in float collisionPriorities;
6
+
7
+ uniform sampler2D collision_texture;
8
+
9
+ layout(std140) uniform collisionUniforms {
10
+ bool sort;
11
+ bool enabled;
12
+ } collision;
13
+
14
+ vec2 collision_getCoords(vec4 position) {
15
+ vec4 collision_clipspace = project_common_position_to_clipspace(position);
16
+ return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
17
+ }
18
+
19
+ float collision_match(vec2 tex, vec3 pickingColor) {
20
+ vec4 collision_pickingColor = texture(collision_texture, tex);
21
+ float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
22
+ float e = 0.001;
23
+ return step(delta, e);
24
+ }
25
+
26
+ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
27
+ if (!collision.enabled) {
28
+ return 1.0;
29
+ }
30
+
31
+ // Visibility test, sample area of 5x5 pixels in order to fade in/out.
32
+ // Due to the locality, the lookups will be cached
33
+ // This reduces the flicker present when objects are shown/hidden
34
+ const int N = 2;
35
+ float accumulator = 0.0;
36
+ vec2 step = vec2(1.0 / project.viewportSize);
37
+
38
+ const float floatN = float(N);
39
+ vec2 delta = -floatN * step;
40
+ for(int i = -N; i <= N; i++) {
41
+ delta.x = -step.x * floatN;
42
+ for(int j = -N; j <= N; j++) {
43
+ accumulator += collision_match(texCoords + delta, pickingColor);
44
+ delta.x += step.x;
45
+ }
46
+ delta.y += step.y;
47
+ }
48
+
49
+ float W = 2.0 * floatN + 1.0;
50
+ return pow(accumulator / (W * W), 2.2);
51
+ }
52
+ `
53
+ ), K = {
54
+ "vs:#decl": (
55
+ /* glsl */
56
+ `
57
+ float collision_fade = 1.0;
58
+ `
59
+ ),
60
+ "vs:DECKGL_FILTER_GL_POSITION": (
61
+ /* glsl */
62
+ `
63
+ if (collision.sort) {
64
+ float collisionPriority = collisionPriorities;
65
+ position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000
66
+ }
67
+
68
+ if (collision.enabled) {
69
+ vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
70
+ vec2 collision_texCoords = collision_getCoords(collision_common_position);
71
+ collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
72
+ if (collision_fade < 0.0001) {
73
+ // Position outside clip space bounds to discard
74
+ position = vec4(0.0, 0.0, 2.0, 1.0);
75
+ }
76
+ }
77
+ `
78
+ ),
79
+ "vs:DECKGL_FILTER_COLOR": (
80
+ /* glsl */
81
+ `
82
+ color.a *= collision_fade;
83
+ `
84
+ )
85
+ }, Q = (n) => {
86
+ if (!n || !("dummyCollisionMap" in n))
87
+ return {};
88
+ const { enabled: t, collisionFBO: e, drawToCollisionMap: i, dummyCollisionMap: s } = n;
89
+ return {
90
+ enabled: t && !i,
91
+ sort: !!i,
92
+ collision_texture: !i && e ? e.colorAttachments[0] : s
93
+ };
94
+ }, X = {
95
+ name: "collision",
96
+ dependencies: [U],
97
+ vs: H,
98
+ inject: K,
99
+ getUniforms: Q,
100
+ uniformTypes: {
101
+ sort: "i32",
102
+ enabled: "i32"
103
+ }
104
+ };
105
+ class Z extends W {
106
+ renderCollisionMap(t, e) {
107
+ const s = [0, 0, 0, 0], l = [1, 1, t.width - 2, t.height - 2];
108
+ this.render({ ...e, clearColor: s, scissorRect: l, target: t, pass: "collision" });
109
+ }
110
+ getLayerParameters(t, e, i) {
111
+ return {
112
+ ...t.props.parameters,
113
+ blend: !1,
114
+ depthWriteEnabled: !0,
115
+ depthCompare: "less-equal"
116
+ };
117
+ }
118
+ getShaderModuleProps() {
119
+ return {
120
+ collision: {
121
+ drawToCollisionMap: !0
122
+ },
123
+ picking: {
124
+ isActive: 1,
125
+ isAttribute: !1
126
+ },
127
+ lighting: { enabled: !1 }
128
+ };
129
+ }
130
+ }
131
+ const N = 2;
132
+ class z {
133
+ constructor() {
134
+ this.id = "collision-filter-effect", this.props = null, this.useInPicking = !0, this.order = 1, this.channels = {}, this.collisionFBOs = {};
135
+ }
136
+ setup(t) {
137
+ this.context = t;
138
+ const { device: e } = t;
139
+ this.dummyCollisionMap = e.createTexture({ width: 1, height: 1 }), this.collisionFilterPass = new Z(e, { id: "default-collision-filter" });
140
+ }
141
+ preRender({ effects: t, layers: e, layerFilter: i, viewports: s, onViewportActive: l, views: r, isPicking: o, preRenderStats: f = {} }) {
142
+ const { device: d } = this.context;
143
+ if (o)
144
+ return;
145
+ const u = e.filter(
146
+ // @ts-ignore
147
+ ({ props: { visible: h, collisionEnabled: x } }) => h && x
148
+ );
149
+ if (u.length === 0) {
150
+ this.channels = {};
151
+ return;
152
+ }
153
+ const p = t?.filter((h) => h.useInPicking && f[h.id]), C = f["mask-effect"]?.didRender, c = this._groupByCollisionGroup(d, u), a = s[0], g = !this.lastViewport || !this.lastViewport.equals(a) || C;
154
+ for (const h in c) {
155
+ const x = this.collisionFBOs[h], y = c[h], [b, _] = d.canvasContext.getPixelSize();
156
+ x.resize({
157
+ width: b / N,
158
+ height: _ / N
159
+ }), this._render(y, {
160
+ effects: p,
161
+ layerFilter: i,
162
+ onViewportActive: l,
163
+ views: r,
164
+ viewport: a,
165
+ viewportChanged: g
166
+ });
167
+ }
168
+ }
169
+ _render(t, { effects: e, layerFilter: i, onViewportActive: s, views: l, viewport: r, viewportChanged: o }) {
170
+ const { collisionGroup: f } = t, d = this.channels[f];
171
+ if (!d)
172
+ return;
173
+ const u = o || // If render info is new
174
+ t === d || // If sublayers have changed
175
+ !D(d.layers, t.layers, 1) || // If a sublayer's bounds have been updated
176
+ t.layerBounds.some((p, C) => !V(p, d.layerBounds[C])) || // If a sublayer's isLoaded state has been updated
177
+ t.allLayersLoaded !== d.allLayersLoaded || // Some prop is in transition
178
+ t.layers.some((p) => p.props.transitions);
179
+ if (this.channels[f] = t, u) {
180
+ this.lastViewport = r;
181
+ const p = this.collisionFBOs[f];
182
+ this.collisionFilterPass.renderCollisionMap(p, {
183
+ pass: "collision-filter",
184
+ isPicking: !0,
185
+ layers: t.layers,
186
+ effects: e,
187
+ layerFilter: i,
188
+ viewports: r ? [r] : [],
189
+ onViewportActive: s,
190
+ views: l,
191
+ shaderModuleProps: {
192
+ collision: {
193
+ enabled: !0,
194
+ // To avoid feedback loop forming between Framebuffer and active Texture.
195
+ dummyCollisionMap: this.dummyCollisionMap
196
+ },
197
+ project: {
198
+ // @ts-expect-error TODO - assuming WebGL context
199
+ devicePixelRatio: p.device.canvasContext.getDevicePixelRatio() / N
200
+ }
201
+ }
202
+ });
203
+ }
204
+ }
205
+ /**
206
+ * Group layers by collisionGroup
207
+ * Returns a map from collisionGroup to render info
208
+ */
209
+ _groupByCollisionGroup(t, e) {
210
+ const i = {};
211
+ for (const s of e) {
212
+ const l = s.props.collisionGroup;
213
+ let r = i[l];
214
+ r || (r = { collisionGroup: l, layers: [], layerBounds: [], allLayersLoaded: !0 }, i[l] = r), r.layers.push(s), r.layerBounds.push(s.getBounds()), s.isLoaded || (r.allLayersLoaded = !1);
215
+ }
216
+ for (const s of Object.keys(i))
217
+ this.collisionFBOs[s] || this.createFBO(t, s), this.channels[s] || (this.channels[s] = i[s]);
218
+ for (const s of Object.keys(this.collisionFBOs))
219
+ i[s] || this.destroyFBO(s);
220
+ return i;
221
+ }
222
+ getShaderModuleProps(t) {
223
+ const { collisionGroup: e, collisionEnabled: i } = t.props, { collisionFBOs: s, dummyCollisionMap: l } = this, r = s[e];
224
+ return {
225
+ collision: {
226
+ enabled: i && !!r,
227
+ collisionFBO: r,
228
+ dummyCollisionMap: l
229
+ }
230
+ };
231
+ }
232
+ cleanup() {
233
+ this.dummyCollisionMap && (this.dummyCollisionMap.delete(), this.dummyCollisionMap = void 0), this.channels = {};
234
+ for (const t of Object.keys(this.collisionFBOs))
235
+ this.destroyFBO(t);
236
+ this.collisionFBOs = {}, this.lastViewport = void 0;
237
+ }
238
+ createFBO(t, e) {
239
+ const { width: i, height: s } = t.getDefaultCanvasContext().canvas, l = t.createTexture({
240
+ format: "rgba8unorm",
241
+ width: i,
242
+ height: s,
243
+ sampler: {
244
+ minFilter: "nearest",
245
+ magFilter: "nearest",
246
+ addressModeU: "clamp-to-edge",
247
+ addressModeV: "clamp-to-edge"
248
+ }
249
+ }), r = t.createTexture({
250
+ format: "depth16unorm",
251
+ width: i,
252
+ height: s
253
+ });
254
+ this.collisionFBOs[e] = t.createFramebuffer({
255
+ id: `collision-${e}`,
256
+ width: i,
257
+ height: s,
258
+ colorAttachments: [l],
259
+ depthStencilAttachment: r
260
+ });
261
+ }
262
+ destroyFBO(t) {
263
+ const e = this.collisionFBOs[t];
264
+ e.colorAttachments[0]?.destroy(), e.depthStencilAttachment?.destroy(), e.destroy(), delete this.collisionFBOs[t];
265
+ }
266
+ }
267
+ const ee = {
268
+ getCollisionPriority: { type: "accessor", value: 0 },
269
+ collisionEnabled: !0,
270
+ collisionGroup: { type: "string", value: "default" },
271
+ collisionTestProps: {}
272
+ };
273
+ class E extends I {
274
+ getShaders() {
275
+ return { modules: [X] };
276
+ }
277
+ /* eslint-disable camelcase */
278
+ draw({ shaderModuleProps: t }) {
279
+ t.collision?.drawToCollisionMap && (this.props = this.clone(this.props.collisionTestProps).props);
280
+ }
281
+ initializeState(t, e) {
282
+ if (this.getAttributeManager() === null)
283
+ return;
284
+ this.context.deck?._addDefaultEffect(new z()), this.getAttributeManager().add({
285
+ collisionPriorities: {
286
+ size: 1,
287
+ stepMode: "dynamic",
288
+ accessor: "getCollisionPriority"
289
+ }
290
+ });
291
+ }
292
+ getNeedsPickingBuffer() {
293
+ return this.props.collisionEnabled;
294
+ }
295
+ }
296
+ E.defaultProps = ee;
297
+ E.extensionName = "CollisionFilterExtension";
298
+ const te = /* @__PURE__ */ new Set(["fill", "line", "circle", "fill-extrusion", "symbol"]), j = { Point: 1, MultiPoint: 1, LineString: 2, MultiLineString: 2, Polygon: 3, MultiPolygon: 3 };
299
+ function A(n) {
300
+ const t = n;
301
+ if (!t || typeof t.r != "number") return [0, 0, 0, 0];
302
+ const e = t.a;
303
+ return e > 0 ? [Math.round(t.r / e * 255), Math.round(t.g / e * 255), Math.round(t.b / e * 255), Math.round(e * 255)] : [0, 0, 0, 0];
304
+ }
305
+ function B(n, t) {
306
+ try {
307
+ return new URL(n, t).href;
308
+ } catch {
309
+ return n;
310
+ }
311
+ }
312
+ async function re(n, t = {}) {
313
+ const e = await fetch(n, t.init);
314
+ if (!e.ok) throw Object.assign(new Error(`HTTP ${e.status} loading the style ${n}`), { response: e, url: n });
315
+ const i = await e.json(), s = Object.entries(i.sources ?? {}).filter(([, c]) => c?.type === "vector").map(([c]) => c), l = t.source ?? s[0];
316
+ if (!l) throw new Error(`the style ${n} has no vector source`);
317
+ if (t.source && !s.includes(t.source)) throw new Error(`the style has no vector source "${t.source}" (it has ${s.join(", ") || "none"})`);
318
+ const r = await import("./index-BahtHUrg.js"), o = [], f = {};
319
+ for (const c of i.layers ?? []) {
320
+ const a = String(c.type);
321
+ if (c.source !== l || !te.has(a)) {
322
+ f[a] = (f[a] ?? 0) + 1;
323
+ continue;
324
+ }
325
+ const g = c.layout ?? {};
326
+ if (g.visibility === "none") continue;
327
+ const h = c.paint ?? {}, x = c.filter;
328
+ let y = () => !0;
329
+ if (x !== void 0) {
330
+ const m = r.featureFilter(x);
331
+ y = (M, P) => m.filter({ zoom: M }, { type: j[P.geometry.type] ?? 1, properties: P.properties, id: P.id });
332
+ }
333
+ const b = r.latest, _ = /* @__PURE__ */ new Map(), $ = (m) => {
334
+ if (_.has(m)) return _.get(m);
335
+ const M = m in h ? "paint" : "layout", P = M === "paint" ? h[m] : g[m], L = b[`${M}_${a}`]?.[m] ?? b[`paint_${a}`]?.[m] ?? b[`layout_${a}`]?.[m];
336
+ let F;
337
+ if (L)
338
+ try {
339
+ const T = r.normalizePropertyExpression(P ?? L.default, L);
340
+ (P !== void 0 || L.default !== void 0) && (F = {
341
+ constant: T.kind === "constant",
342
+ evaluate: (G, O) => T.evaluate({ zoom: G }, O ? { type: j[O.geometry.type] ?? 1, properties: O.properties, id: O.id } : void 0)
343
+ });
344
+ } catch {
345
+ F = void 0;
346
+ }
347
+ return _.set(m, F), F;
348
+ };
349
+ o.push({
350
+ id: String(c.id),
351
+ type: a,
352
+ sourceLayer: String(c["source-layer"] ?? ""),
353
+ minzoom: typeof c.minzoom == "number" ? c.minzoom : 0,
354
+ maxzoom: typeof c.maxzoom == "number" ? c.maxzoom : 24,
355
+ filter: y,
356
+ get: $
357
+ });
358
+ }
359
+ let d;
360
+ const u = typeof i.sprite == "string" ? i.sprite : Array.isArray(i.sprite) ? i.sprite[0]?.url : void 0;
361
+ if (u && o.some((c) => c.type === "symbol" && c.get("icon-image"))) {
362
+ const c = B(u, n), a = typeof devicePixelRatio == "number" && devicePixelRatio > 1 ? "@2x" : "";
363
+ try {
364
+ const g = await (await fetch(`${c}${a}.json`, t.init)).json();
365
+ d = { atlas: `${c}${a}.png`, mapping: g };
366
+ } catch {
367
+ d = void 0;
368
+ }
369
+ }
370
+ let p = i.sources?.[l] ?? {};
371
+ if (!p.tiles?.length && p.url)
372
+ try {
373
+ const c = B(p.url, n), a = await (await fetch(c, t.init)).json();
374
+ p = { ...a, tiles: a.tiles?.map((g) => B(g, c)) };
375
+ } catch {
376
+ p = {};
377
+ }
378
+ const C = p.tiles?.length ? p.tiles.map((c) => B(c, n)).map((c) => c.replace(/%7B/g, "{").replace(/%7D/g, "}")) : void 0;
379
+ return { url: n, source: l, layers: o, skipped: f, sprite: d, tiles: C, minzoom: p.minzoom, maxzoom: p.maxzoom };
380
+ }
381
+ function v(n, t, e, i, s) {
382
+ const l = n.get(t);
383
+ return l ? l.evaluate(e, l.constant ? void 0 : i) ?? s : s;
384
+ }
385
+ function k(n, t, e, i, s = (l) => l) {
386
+ const l = n.get(t);
387
+ return l ? l.constant ? s(l.evaluate(e) ?? i) : (r) => s(l.evaluate(e, r) ?? i, r) : i;
388
+ }
389
+ function w(n, t, e, i, s) {
390
+ const l = n.get(t), r = n.get(e), o = (f) => {
391
+ const d = l ? A(l.evaluate(i, f)) : s, u = r ? Number(r.evaluate(i, f) ?? 1) : 1;
392
+ return [d[0], d[1], d[2], Math.round(d[3] * u)];
393
+ };
394
+ return (l?.constant ?? !0) && (r?.constant ?? !0) ? o() : (f) => o(f);
395
+ }
396
+ function ie(n, t, e) {
397
+ let i = n && typeof n == "object" && "sections" in n ? n.sections.map((s) => s.text).join("") : n == null ? "" : String(n);
398
+ return i = i.replace(/\{([^}]+)\}/g, (s, l) => String(t.properties[l] ?? "")), e === "uppercase" ? i.toUpperCase() : e === "lowercase" ? i.toLowerCase() : i;
399
+ }
400
+ function oe(n) {
401
+ const t = n.geometry, e = t.coordinates;
402
+ if (t.type === "Point") return e;
403
+ if (t.type === "MultiPoint") return e[0] ?? null;
404
+ const i = t.type === "LineString" ? e : t.type === "MultiLineString" ? e[0] : null;
405
+ if (i?.length) return i[Math.floor(i.length / 2)];
406
+ const s = t.type === "Polygon" ? e[0] : t.type === "MultiPolygon" ? e[0]?.[0] : null;
407
+ if (!s?.length) return null;
408
+ let l = 0, r = 0;
409
+ for (const o of s)
410
+ l += o[0], r += o[1];
411
+ return [l / s.length, r / s.length];
412
+ }
413
+ function se(n) {
414
+ return typeof n == "function" ? (t) => n(t.f) : n;
415
+ }
416
+ const ne = new q({ dash: !0 }), R = new E();
417
+ function ce(n, t, e, i) {
418
+ const s = /* @__PURE__ */ new Map();
419
+ for (const r of t) {
420
+ const o = String(r.properties.layerName ?? "");
421
+ let f = s.get(o);
422
+ f || s.set(o, f = []), f.push(r);
423
+ }
424
+ const l = [];
425
+ for (const [r, o] of n.layers.entries()) {
426
+ if (e < o.minzoom || e >= o.maxzoom) continue;
427
+ const f = (s.get(o.sourceLayer) ?? []).filter((u) => o.filter(e, u));
428
+ if (!f.length) continue;
429
+ const d = { ...i, id: `${i.id}-${o.id}`, data: f, pickable: i.pickable, updateTriggers: { all: e } };
430
+ if (o.type === "fill") {
431
+ const u = o.get("fill-outline-color");
432
+ l.push(new S({ ...d, filled: !0, stroked: !!u, getFillColor: w(o, "fill-color", "fill-opacity", e, [0, 0, 0, 255]), getLineColor: u ? w(o, "fill-outline-color", "fill-opacity", e, [0, 0, 0, 255]) : [0, 0, 0, 0], lineWidthUnits: "pixels", getLineWidth: 1 }));
433
+ } else if (o.type === "line") {
434
+ const u = v(o, "line-dasharray", e, void 0, null);
435
+ l.push(new S({
436
+ ...d,
437
+ filled: !1,
438
+ stroked: !0,
439
+ getLineColor: w(o, "line-color", "line-opacity", e, [0, 0, 0, 255]),
440
+ getLineWidth: k(o, "line-width", e, 1, (p) => Number(p)),
441
+ lineWidthUnits: "pixels",
442
+ lineCapRounded: v(o, "line-cap", e, void 0, "butt") === "round",
443
+ lineJointRounded: v(o, "line-join", e, void 0, "miter") === "round",
444
+ ...Array.isArray(u) && u.length >= 2 ? { extensions: [ne], getDashArray: [Number(u[0]), Number(u[1])], dashJustified: !0 } : null
445
+ }));
446
+ } else if (o.type === "circle")
447
+ l.push(new S({
448
+ ...d,
449
+ pointType: "circle",
450
+ filled: !0,
451
+ stroked: !!o.get("circle-stroke-width"),
452
+ getFillColor: w(o, "circle-color", "circle-opacity", e, [0, 0, 0, 255]),
453
+ getLineColor: w(o, "circle-stroke-color", "circle-stroke-opacity", e, [0, 0, 0, 255]),
454
+ getPointRadius: k(o, "circle-radius", e, 5, (u) => Number(u)),
455
+ pointRadiusUnits: "pixels",
456
+ getLineWidth: k(o, "circle-stroke-width", e, 0, (u) => Number(u)),
457
+ lineWidthUnits: "pixels"
458
+ }));
459
+ else if (o.type === "fill-extrusion")
460
+ l.push(new S({
461
+ ...d,
462
+ extruded: !0,
463
+ filled: !0,
464
+ stroked: !1,
465
+ getFillColor: w(o, "fill-extrusion-color", "fill-extrusion-opacity", e, [0, 0, 0, 255]),
466
+ getElevation: k(o, "fill-extrusion-height", e, 0, (u) => Number(u))
467
+ }));
468
+ else if (o.type === "symbol") {
469
+ const u = o.get("text-field"), p = o.get("icon-image"), C = f.map((a) => ({ f: a, at: oe(a) })).filter((a) => !!a.at), c = (a) => -Number(v(o, "symbol-sort-key", e, a.f, 0)) - r * 1e-3;
470
+ if (p && n.sprite && l.push(new J({
471
+ ...d,
472
+ id: `${d.id}-icons`,
473
+ data: C.filter((a) => n.sprite.mapping[String(p.evaluate(e, a.f) ?? "")]),
474
+ iconAtlas: n.sprite.atlas,
475
+ iconMapping: n.sprite.mapping,
476
+ getIcon: (a) => String(p.evaluate(e, a.f)),
477
+ getPosition: (a) => a.at,
478
+ getSize: (a) => {
479
+ const g = n.sprite.mapping[String(p.evaluate(e, a.f))];
480
+ return (g ? g.height / (g.pixelRatio ?? 1) : 16) * Number(v(o, "icon-size", e, a.f, 1));
481
+ },
482
+ sizeUnits: "pixels",
483
+ extensions: [R],
484
+ collisionGroup: "om-style-labels",
485
+ getCollisionPriority: c
486
+ })), u) {
487
+ const a = v(o, "text-transform", e, void 0, "none"), g = C.map((h) => ({ ...h, text: ie(u.evaluate(e, h.f), h.f, a) })).filter((h) => h.text.trim());
488
+ if (g.length) {
489
+ const h = (y) => Number(v(o, "text-size", e, y.f, 16)), x = o.get("text-halo-width");
490
+ l.push(new Y({
491
+ ...d,
492
+ id: `${d.id}-text`,
493
+ data: g,
494
+ getText: (y) => y.text,
495
+ getPosition: (y) => y.at,
496
+ getSize: h,
497
+ getColor: se(w(o, "text-color", "text-opacity", e, [0, 0, 0, 255])),
498
+ getPixelOffset: (y) => {
499
+ const b = v(o, "text-offset", e, y.f, null);
500
+ return Array.isArray(b) ? [Number(b[0]) * h(y), Number(b[1]) * h(y)] : [0, 0];
501
+ },
502
+ characterSet: "auto",
503
+ fontFamily: "system-ui, sans-serif",
504
+ ...x ? { fontSettings: { sdf: !0 }, outlineWidth: Math.min(4, Number(x.evaluate(e) ?? 0)), outlineColor: A(v(o, "text-halo-color", e, void 0, null)) } : null,
505
+ extensions: [R],
506
+ collisionGroup: "om-style-labels",
507
+ getCollisionPriority: c
508
+ }));
509
+ }
510
+ }
511
+ }
512
+ }
513
+ return l;
514
+ }
515
+ export {
516
+ re as loadVectorStyle,
517
+ ce as styledTileLayers
518
+ };
@@ -0,0 +1,59 @@
1
+ import type { Layer } from "@deck.gl/core";
2
+ type Feature = {
3
+ type?: string;
4
+ id?: unknown;
5
+ geometry: {
6
+ type: string;
7
+ coordinates: unknown;
8
+ };
9
+ properties: Record<string, unknown>;
10
+ };
11
+ interface Evaluator {
12
+ /** Constant over zoom and features: evaluated once. */
13
+ constant: boolean;
14
+ evaluate(zoom: number, feature?: Feature): unknown;
15
+ }
16
+ export interface CompiledStyleLayer {
17
+ id: string;
18
+ type: "fill" | "line" | "circle" | "fill-extrusion" | "symbol";
19
+ sourceLayer: string;
20
+ minzoom: number;
21
+ maxzoom: number;
22
+ filter: (zoom: number, feature: Feature) => boolean;
23
+ get(property: string): Evaluator | undefined;
24
+ }
25
+ export interface VectorStyle {
26
+ url: string;
27
+ source: string;
28
+ /** The source's own tile templates and zoom range — the layer's tiles when it names no `data` (TileJSON `url` sources are read). */
29
+ tiles?: string[];
30
+ minzoom?: number;
31
+ maxzoom?: number;
32
+ layers: CompiledStyleLayer[];
33
+ /** Style layers left out, by type, for the one-line report. */
34
+ skipped: Record<string, number>;
35
+ sprite?: {
36
+ atlas: string;
37
+ mapping: Record<string, {
38
+ x: number;
39
+ y: number;
40
+ width: number;
41
+ height: number;
42
+ pixelRatio?: number;
43
+ }>;
44
+ };
45
+ }
46
+ /** Load a style and compile its layers for one vector source (the named one, or the style's first vector source). */
47
+ export declare function loadVectorStyle(url: string, opts?: {
48
+ source?: string;
49
+ init?: RequestInit;
50
+ }): Promise<VectorStyle>;
51
+ /**
52
+ * One tile's deck sublayers for a style, in style order. `features` is the
53
+ * tile's GeoJSON (MVTLayer with `binary: false`, each feature carrying its
54
+ * `layerName`); `zoom` is the map's, which the style's functions read.
55
+ */
56
+ export declare function styledTileLayers(style: VectorStyle, features: Feature[], zoom: number, base: {
57
+ id: string;
58
+ } & Record<string, unknown>): Layer[];
59
+ export {};
package/dist/version.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * the build rootDir, and a `define` would need repeating across vite/vitest/
6
6
  * vite-node configs.
7
7
  */
8
- export declare const LIBRARY_VERSION = "0.13.3";
8
+ export declare const LIBRARY_VERSION = "0.13.4";
@@ -1,5 +1,5 @@
1
- import { A as ur, d as lr, R as zt, e as fr, m as dr, p as St, f as hr, k as pr, l as mr } from "./raster-pipeline-BMS54TX2.js";
2
- import { c as gr } from "./index-DWijIMti.js";
1
+ import { A as ur, d as lr, R as zt, e as fr, m as dr, p as St, f as hr, k as pr, l as mr } from "./raster-pipeline-C898iYqw.js";
2
+ import { c as gr } from "./index-DrCMvhhr.js";
3
3
  import $t from "./index-CW1n5LdO.js";
4
4
  var Et;
5
5
  function h(e, t, n) {
@@ -22,8 +22,8 @@ to PDF at true page size via CSS `@page` and exports PNG/JPEG at print DPI throu
22
22
  <html>
23
23
  <head>
24
24
  <meta charset="utf-8">
25
- <script type="module" src="https://unpkg.com/@nika-js/onlymap@0.13.3/dist/cartograph.standalone.js"></script>
26
- <link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.13.3/dist/cartograph.css">
25
+ <script type="module" src="https://unpkg.com/@nika-js/onlymap@0.13.4/dist/cartograph.standalone.js"></script>
26
+ <link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.13.4/dist/cartograph.css">
27
27
  </head>
28
28
  <body>
29
29
  <om-cartograph cartograph-id="cg-lot-12" format="cartograph/2" size="A4" theme="minimal"