@genome-spy/app 0.88.1 → 0.90.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 (65) hide show
  1. package/dist/{agentApi-BIpg3JKh.js → agentApi-Z65dw-sD.js} +5976 -6711
  2. package/dist/agentApi.es.js +3580 -4470
  3. package/dist/agentShared.es.js +742 -683
  4. package/dist/{canvas2d-BVQ7-2eJ.js → canvas2d-DiPQvNtZ.js} +122 -109
  5. package/dist/{canvas2d-D7SZK3xv.js → canvas2d-t_N10CeW.js} +114 -101
  6. package/dist/{canvasSizeHelper-7h_8rOcx.js → canvasSizeHelper-foL2YvGL.js} +15 -8
  7. package/dist/{clipOptions-DTMcB_9z.js → clipOptions-B5PibDq3.js} +1610 -1342
  8. package/dist/{clipOptions-BWHr3aTa.js → clipOptions-Cba4I0AO.js} +1872 -1644
  9. package/dist/{componentStyles-FsNmIb22.js → componentStyles-DGtQXvwc.js} +17 -15
  10. package/dist/{debug-CVpoEOWx.js → debug-CVAlrcZt.js} +2 -2
  11. package/dist/{debug-DYAMZZKl.js → debug-DP4WzTNo.js} +2 -2
  12. package/dist/dialog.es.js +4 -3
  13. package/dist/esm-BiqrFjMh.js +443 -0
  14. package/dist/{esm-lwYrRdbg.js → esm-Bv7Frz7C.js} +142 -79
  15. package/dist/{esm-VvpZ9hsq.js → esm-C3A-AuRi.js} +1 -1
  16. package/dist/esm-CvpR1OcU.js +322 -0
  17. package/dist/esm-DFHFX1sH.js +1526 -0
  18. package/dist/esm-Dndm-NaA.js +1193 -0
  19. package/dist/{esm-CcDLRSvC.js → esm-DtNElqRr.js} +64 -63
  20. package/dist/esm-L53qjcYH.js +1155 -0
  21. package/dist/esm-VFJeyk9i.js +249 -0
  22. package/dist/{esm-BdLYkz-m.js → esm-_xCtpDwm.js} +1 -1
  23. package/dist/index.es.js +4203 -3910
  24. package/dist/index.js +971 -482
  25. package/dist/{indexer-CXjZDo2Q.js → indexer-DbFTKGlm.js} +1 -1
  26. package/dist/{indexer-DAH_ruVn.js → indexer-En7gpvLN.js} +1 -1
  27. package/dist/{lit-ByuJ0FJ4.js → lit-CoXp9NFX.js} +12 -10
  28. package/dist/order-BkYCnwD7.js +1062 -0
  29. package/dist/order-R043xTpC.js +1062 -0
  30. package/dist/{parquetRead-Cs2xRrvz.js → parquetRead-0hFIa3Cc.js} +532 -350
  31. package/dist/rasterExport-C_FcNBkC.js +52 -0
  32. package/dist/rasterExport-Z7gs5346.js +52 -0
  33. package/dist/rasterization-_-9JmSas.js +63 -0
  34. package/dist/rectangle-DE98gIxF.js +108 -0
  35. package/dist/{renderCanvas2D-DxturTEW.js → renderCanvas2D-DK1c9TFK.js} +68 -67
  36. package/dist/{renderCanvas2D-DtcJjqpB.js → renderCanvas2D-IM-A9DYG.js} +57 -56
  37. package/dist/schema.json +599 -116
  38. package/dist/{src-DjOlFqSn.js → src-DJtvThVC.js} +3 -5
  39. package/dist/style.css +1 -1
  40. package/dist/{svg-SDJMzL--.js → svg-DW3tfUmm.js} +339 -326
  41. package/dist/{svg-CyrLfa9e.js → svg-PabUdcDi.js} +365 -352
  42. package/dist/{svgRasterizer-f7DJ3UO0.js → svgRasterizer-B6YtWLJs.js} +6 -5
  43. package/dist/{svgRasterizer-mWK7HTkx.js → svgRasterizer-BEVDyyS3.js} +6 -5
  44. package/dist/{vega-scale-DLKCwWRs.js → vega-scale-Byaw1K8O.js} +823 -780
  45. package/dist/{vega-scale-CypF85iS.js → vega-scale-Ctz_wa3z.js} +963 -923
  46. package/dist/{viewIdentityRegistry-Dl-vMN9I.js → viewIdentityRegistry-BW415b3o.js} +1 -1
  47. package/dist/{viewIdentityRegistry-DIDo44XQ.js → viewIdentityRegistry-_F0E7nkA.js} +1 -1
  48. package/dist/{viewSelectors-CymbZyE6.js → viewSelectors-DYz-PhTO.js} +407 -340
  49. package/dist/{viewSelectors-DNiDip5e.js → viewSelectors-KtD-QSN0.js} +349 -282
  50. package/dist/{viewUtils-BrJLIj2o.js → viewUtils-BZGPseMx.js} +2052 -1871
  51. package/dist/{webgl-tZfZ8y3q.js → webgl-BKSGqHaz.js} +2144 -784
  52. package/dist/{webgl-CTJt7jQd.js → webgl-tdKf9SlZ.js} +2386 -1026
  53. package/package.json +5 -5
  54. package/dist/esm-80V4xF_D.js +0 -1098
  55. package/dist/esm-BA6yMcc-.js +0 -1222
  56. package/dist/esm-BdT7qUL-.js +0 -157
  57. package/dist/esm-CfYZhLHN.js +0 -1367
  58. package/dist/esm-D-iG_TIX.js +0 -441
  59. package/dist/esm-JAiZmFIS.js +0 -128
  60. package/dist/order-C5CzA37O.js +0 -918
  61. package/dist/order-DvY7KNcu.js +0 -918
  62. package/dist/rasterExport-BgZ98e6U.js +0 -44
  63. package/dist/rasterExport-DEr8fOLm.js +0 -44
  64. package/dist/rasterization-CFogVB3B.js +0 -50
  65. package/dist/rectangle-DKnrAmKs.js +0 -142
@@ -1,35 +1,35 @@
1
- import { o as e, s as t, un as n } from "./clipOptions-BWHr3aTa.js";
2
- import { v as r } from "./vega-scale-CypF85iS.js";
3
- import { x as i } from "./viewSelectors-DNiDip5e.js";
4
- import { t as a } from "./rasterization-CFogVB3B.js";
5
- import { t as o } from "./rectangle-DKnrAmKs.js";
1
+ import { Kt as e, o as t, s as n } from "./clipOptions-B5PibDq3.js";
2
+ import { v as r } from "./vega-scale-Ctz_wa3z.js";
3
+ import { x as i } from "./viewSelectors-KtD-QSN0.js";
4
+ import { t as a } from "./rasterization-_-9JmSas.js";
5
+ import { t as o } from "./rectangle-DE98gIxF.js";
6
6
  import { n as s, t as c } from "./layoutResult-D50MSHXR.js";
7
- import { A as l, C as u, D as d, E as f, M as p, N as m, O as h, T as g, _, a as v, c as y, d as b, f as x, g as S, h as C, i as w, j as ee, k as T, l as E, m as D, n as te, o as ne, p as re, r as O, s as ie, t as ae, u as oe, v as se, w as ce, x as le, y as ue } from "./order-C5CzA37O.js";
8
- import { n as k, t as A } from "./svgNumber-DNxESJQB.js";
7
+ import { A as l, D as u, E as d, F as f, I as p, M as m, N as h, O as g, P as _, S as v, _ as y, a as b, b as x, c as S, d as C, f as w, g as T, h as E, i as D, j as O, k, l as A, m as ee, n as te, o as ne, p as j, r as re, s as ie, t as ae, u as oe, v as se, w as ce, x as le, y as ue } from "./order-BkYCnwD7.js";
8
+ import { n as M, t as N } from "./svgNumber-DNxESJQB.js";
9
9
  //#region ../core/src/rendering/svg/svgElement.js
10
- var j = "http://www.w3.org/2000/svg";
11
- function M(e, t) {
12
- let n = document.createElementNS(j, e);
10
+ var P = "http://www.w3.org/2000/svg";
11
+ function F(e, t) {
12
+ let n = document.createElementNS(P, e);
13
13
  if (t) for (let [e, r] of Object.entries(t)) n.setAttribute(e, "" + r);
14
14
  return n;
15
15
  }
16
16
  //#endregion
17
17
  //#region ../core/src/rendering/svg/svgAttributes.js
18
- function N(e, t) {
19
- let n = Object.entries(t).filter(([t, n]) => n.encoder.constant ? (e.setAttribute(t, "" + P(n, {})), !1) : !0);
20
- return (e) => Object.fromEntries(n.map(([t, n]) => [t, P(n, e)]));
18
+ function I(e, t) {
19
+ let n = Object.entries(t).filter(([t, n]) => !n.encoder.constant || (e.setAttribute(t, "" + L(n, {})), !1));
20
+ return (e) => Object.fromEntries(n.map(([t, n]) => [t, L(n, e)]));
21
21
  }
22
- function P(e, t) {
22
+ function L(e, t) {
23
23
  let n = e.encoder(t);
24
24
  return e.transform ? e.transform(n) : "" + n;
25
25
  }
26
26
  //#endregion
27
27
  //#region ../core/src/rendering/svg/renderers/arrow.js
28
28
  function de(e, t) {
29
- let n = e, { coords: r, data: i, group: a, viewOpacity: o, visibleBounds: s } = t, c = n.encoders, l = N(a, {
29
+ let n = e, { coords: r, data: i, group: a, viewOpacity: o, visibleBounds: s } = t, c = n.encoders, u = I(a, {
30
30
  fill: {
31
31
  encoder: c.fill,
32
- transform: d
32
+ transform: l
33
33
  },
34
34
  "fill-opacity": {
35
35
  encoder: c.fillOpacity,
@@ -37,7 +37,7 @@ function de(e, t) {
37
37
  },
38
38
  stroke: {
39
39
  encoder: c.stroke,
40
- transform: d
40
+ transform: l
41
41
  },
42
42
  "stroke-opacity": {
43
43
  encoder: c.strokeOpacity,
@@ -45,21 +45,21 @@ function de(e, t) {
45
45
  },
46
46
  "stroke-width": {
47
47
  encoder: c.strokeWidth,
48
- transform: (e) => A(+e)
48
+ transform: (e) => N(+e)
49
49
  }
50
50
  });
51
51
  a.setAttribute("stroke-linejoin", "miter");
52
- let u = ue(n);
53
- return le(n, u, {
52
+ let d = v(n);
53
+ return ce(n, d, {
54
54
  coords: r,
55
55
  data: i,
56
56
  visibleBounds: s,
57
57
  viewOpacity: o,
58
58
  countOnly: t.countOnly
59
59
  }, (e) => {
60
- t.countOnly || (e.headShapeFallback && t.warn(`SVG export rendered unsupported arrow headShape "${u.headShape}" as a triangle.`), a.appendChild(M("path", {
60
+ t.countOnly || (e.headShapeFallback && t.warn(`SVG export rendered unsupported arrow headShape "${d.headShape}" as a triangle.`), a.appendChild(F("path", {
61
61
  d: e.boundaryLoops.map(fe).join(" "),
62
- ...l(e.datum)
62
+ ...u(e.datum)
63
63
  })));
64
64
  });
65
65
  }
@@ -67,57 +67,57 @@ function fe(e) {
67
67
  return `M ${e.map(pe).join(" L ")} Z`;
68
68
  }
69
69
  function pe(e) {
70
- return `${A(e.x)} ${A(e.y)}`;
70
+ return `${N(e.x)} ${N(e.y)}`;
71
71
  }
72
72
  //#endregion
73
73
  //#region ../core/src/rendering/svg/renderers/link.js
74
74
  function me(e, t) {
75
- let n = e, r = D(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, l = n.encoders, u = se(n, r.shape, t.secondOrderPass), f = N(o, {
75
+ let n = e, r = y(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, u = n.encoders, d = le(n, r.shape, t.secondOrderPass), f = I(o, {
76
76
  stroke: {
77
- encoder: l.color,
78
- transform: d
77
+ encoder: u.color,
78
+ transform: l
79
79
  },
80
80
  "stroke-opacity": {
81
- encoder: l.opacity,
81
+ encoder: u.opacity,
82
82
  transform: (e) => +e * s
83
83
  },
84
84
  "stroke-width": {
85
- encoder: l.size,
86
- transform: (e) => A(+e)
85
+ encoder: u.size,
86
+ transform: (e) => N(+e)
87
87
  }
88
88
  });
89
89
  o.setAttribute("fill", "none"), o.setAttribute("stroke-linecap", "butt");
90
90
  let p = o, m;
91
- return C(n, r, {
91
+ return se(n, r, {
92
92
  coords: i,
93
93
  data: a,
94
94
  visibleBounds: c
95
95
  }, ({ datum: e, points: n }) => {
96
96
  let [r, i, a, s] = n;
97
97
  if (t.countOnly) return;
98
- let c = f(e), l = u ? t.getLinkArcFadeMaskUrl({
98
+ let c = f(e), l = d ? t.getLinkArcFadeMaskUrl({
99
99
  p1: r,
100
100
  p4: s,
101
- distances: u
101
+ distances: d
102
102
  }) : void 0;
103
- l !== m && (m = l, p = l ? M("g", { mask: l }) : o, l && o.appendChild(p)), p.appendChild(M("path", {
104
- d: `M ${F(r)} C ${F(i)} ${F(a)} ${F(s)}`,
103
+ l !== m && (m = l, p = l ? F("g", { mask: l }) : o, l && o.appendChild(p)), p.appendChild(F("path", {
104
+ d: `M ${R(r)} C ${R(i)} ${R(a)} ${R(s)}`,
105
105
  ...c
106
106
  }));
107
107
  });
108
108
  }
109
- function F(e) {
110
- return e.map(A).join(" ");
109
+ function R(e) {
110
+ return e.map(N).join(" ");
111
111
  }
112
112
  //#endregion
113
113
  //#region ../core/src/rendering/svg/renderers/point.js
114
- function I(e, t) {
114
+ function z(e, t) {
115
115
  let n = e;
116
- f(n, n.properties.fillGradientStrength) && t.warn("SVG export ignored unsupported point property fillGradientStrength."), n.properties.geometricZoomBound && t.warn("SVG export ignored unsupported point property geometricZoomBound.");
117
- let r = x(n), { inwardStroke: i } = r, { group: a, viewOpacity: o } = t, s = n.encoders, c = N(a, {
116
+ k(n, n.properties.fillGradientStrength) && t.warn("SVG export ignored unsupported point property fillGradientStrength."), n.properties.geometricZoomBound && t.warn("SVG export ignored unsupported point property geometricZoomBound.");
117
+ let r = E(n), { inwardStroke: i } = r, { group: a, viewOpacity: o } = t, s = n.encoders, c = I(a, {
118
118
  fill: {
119
119
  encoder: s.fill,
120
- transform: d
120
+ transform: l
121
121
  },
122
122
  "fill-opacity": {
123
123
  encoder: s.fillOpacity,
@@ -125,7 +125,7 @@ function I(e, t) {
125
125
  },
126
126
  stroke: {
127
127
  encoder: s.stroke,
128
- transform: d
128
+ transform: l
129
129
  },
130
130
  "stroke-opacity": {
131
131
  encoder: s.strokeOpacity,
@@ -133,47 +133,47 @@ function I(e, t) {
133
133
  },
134
134
  "stroke-width": {
135
135
  encoder: s.strokeWidth,
136
- transform: (e) => A(+e)
136
+ transform: (e) => N(+e)
137
137
  }
138
- }), l = R();
139
- return re(n, r, t, (e) => {
138
+ }), u = ge();
139
+ return T(n, r, t, (e) => {
140
140
  if (t.countOnly) return;
141
- let { datum: n, shape: r, x: u, y: d, geometryRadius: f, angle: p, strokeWidth: m, lineShape: h } = e, g = {
141
+ let { datum: n, shape: r, x: l, y: d, geometryRadius: f, angle: p, strokeWidth: m, lineShape: h } = e, g = {
142
142
  ...c(n),
143
- ...i && !h ? { "stroke-width": A(m) } : {},
144
- ...h ? z(s, n, o) : {}
145
- }, _ = L(r, u, d, f, g, l);
146
- _ ? (p && _.setAttribute("transform", `rotate(${A(p)} ${A(u)} ${A(d)})`), a.appendChild(_)) : (t.warn(`SVG export rendered unsupported point shape "${r}" as a circle.`), a.appendChild(M("circle", {
147
- cx: A(u),
148
- cy: A(d),
149
- r: A(f),
143
+ ...i && !h ? { "stroke-width": N(m) } : {},
144
+ ...h ? _e(s, n, o) : {}
145
+ }, _ = he(r, l, d, f, g, u);
146
+ _ ? (p && _.setAttribute("transform", `rotate(${N(p)} ${N(l)} ${N(d)})`), a.appendChild(_)) : (t.warn(`SVG export rendered unsupported point shape "${r}" as a circle.`), a.appendChild(F("circle", {
147
+ cx: N(l),
148
+ cy: N(d),
149
+ r: N(f),
150
150
  ...g
151
151
  })));
152
152
  });
153
153
  }
154
- function L(e, t, n, r, i, a) {
155
- let o = A(t), s = A(n), c = A(r);
156
- if (e == "circle") return M("circle", {
154
+ function he(e, t, n, r, i, a) {
155
+ let o = N(t), s = N(n), c = N(r);
156
+ if (e == "circle") return F("circle", {
157
157
  cx: o,
158
158
  cy: s,
159
159
  r: c,
160
160
  ...i
161
161
  });
162
- if (e == "square") return M("rect", {
163
- x: A(t - r),
164
- y: A(n - r),
165
- width: A(r * 2),
166
- height: A(r * 2),
162
+ if (e == "square") return F("rect", {
163
+ x: N(t - r),
164
+ y: N(n - r),
165
+ width: N(r * 2),
166
+ height: N(r * 2),
167
167
  ...i
168
168
  });
169
169
  let l = a.build(e, t, n, r);
170
- return l ? M("path", {
170
+ return l ? F("path", {
171
171
  d: l,
172
172
  ...i
173
173
  }) : void 0;
174
174
  }
175
- function R() {
176
- let e = "", t = (e, t) => `${A(e)} ${A(t)}`, n = {
175
+ function ge() {
176
+ let e = "", t = (e, t) => `${N(e)} ${N(t)}`, n = {
177
177
  moveTo(n, r) {
178
178
  e += `${e ? " M" : "M"} ${t(n, r)}`;
179
179
  },
@@ -185,26 +185,26 @@ function R() {
185
185
  }
186
186
  };
187
187
  return { build(t, r, i, a) {
188
- return e = "", b(t, r, i, a, n) ? e : void 0;
188
+ return e = "", ee(t, r, i, a, n) ? e : void 0;
189
189
  } };
190
190
  }
191
- function z(e, t, n) {
192
- let r = e.stroke(t), i = u(e.strokeOpacity, t), a = r == null || i <= 0;
191
+ function _e(e, t, n) {
192
+ let r = e.stroke(t), i = d(e.strokeOpacity, t), a = r == null || i <= 0;
193
193
  return {
194
194
  fill: "none",
195
- stroke: d(a ? e.fill(t) : r),
196
- "stroke-opacity": (a ? u(e.fillOpacity, t) : i) * n,
197
- "stroke-width": A(u(e.strokeWidth, t)),
195
+ stroke: l(a ? e.fill(t) : r),
196
+ "stroke-opacity": (a ? d(e.fillOpacity, t) : i) * n,
197
+ "stroke-width": N(d(e.strokeWidth, t)),
198
198
  "stroke-linecap": "butt"
199
199
  };
200
200
  }
201
201
  //#endregion
202
202
  //#region ../core/src/rendering/svg/renderers/rect.js
203
- function he(e, t) {
204
- let n = e, r = E(n), { shadow: i, hatch: a } = r, { group: o, viewOpacity: s } = t, c = n.encoders, l = N(o, {
203
+ function ve(e, t) {
204
+ let n = e, r = w(n), { shadow: i, hatch: a } = r, { group: o, viewOpacity: s } = t, c = n.encoders, u = I(o, {
205
205
  fill: {
206
206
  encoder: c.fill,
207
- transform: d
207
+ transform: l
208
208
  },
209
209
  "fill-opacity": {
210
210
  encoder: c.fillOpacity,
@@ -212,7 +212,7 @@ function he(e, t) {
212
212
  },
213
213
  stroke: {
214
214
  encoder: c.stroke,
215
- transform: d
215
+ transform: l
216
216
  },
217
217
  "stroke-opacity": {
218
218
  encoder: c.strokeOpacity,
@@ -220,37 +220,37 @@ function he(e, t) {
220
220
  },
221
221
  "stroke-width": {
222
222
  encoder: c.strokeWidth,
223
- transform: (e) => A(+e)
223
+ transform: (e) => N(+e)
224
224
  }
225
225
  }), f = i.opacity > 0 ? {
226
226
  fill: i.color,
227
227
  "fill-opacity": 1,
228
228
  stroke: i.color,
229
229
  "stroke-opacity": 1,
230
- opacity: k(i.opacity * s),
230
+ opacity: M(i.opacity * s),
231
231
  filter: t.getShadowFilterUrl(i)
232
232
  } : null;
233
- return oe(n, r, t, (e) => {
233
+ return j(n, r, t, (e) => {
234
234
  if (t.countOnly) return;
235
235
  let { datum: n, x: r, y: i, width: p, height: m, radii: h, opacityFactor: g, strokeWidth: _, fill: v, fillOpacity: y } = e, b = {
236
- ...l(n),
237
- ...g == 1 ? {} : { opacity: k(g) }
236
+ ...u(n),
237
+ ...g == 1 ? {} : { opacity: M(g) }
238
238
  };
239
239
  if (a != "none" && _ > 0 && (b.fill = t.getRectHatchPatternUrl({
240
240
  type: a,
241
- fill: d(c.fill(n)),
242
- fillOpacity: u(c.fillOpacity, n) * s,
243
- stroke: d(c.stroke(n)),
244
- strokeOpacity: u(c.strokeOpacity, n) * s,
241
+ fill: l(c.fill(n)),
242
+ fillOpacity: d(c.fillOpacity, n) * s,
243
+ stroke: l(c.stroke(n)),
244
+ strokeOpacity: d(c.strokeOpacity, n) * s,
245
245
  strokeWidth: _
246
246
  }), b["fill-opacity"] = 1), f) {
247
247
  let e = B(r, i, p, m, h, {
248
248
  ...f,
249
- "stroke-width": A(_)
249
+ "stroke-width": N(_)
250
250
  });
251
251
  if (a == "none" && v != "none" && y == 1 && g == 1) o.appendChild(e);
252
252
  else {
253
- let n = _ / 2, a = Object.fromEntries(Object.entries(h).map(([e, t]) => [e, t + n])), s = V(r - n, i - n, p + n * 2, m + n * 2, a), c = M("g", { "clip-path": t.getShadowClipPathUrl(s) });
253
+ let n = _ / 2, a = Object.fromEntries(Object.entries(h).map(([e, t]) => [e, t + n])), s = V(r - n, i - n, p + n * 2, m + n * 2, a), c = F("g", { "clip-path": t.getShadowClipPathUrl(s) });
254
254
  c.appendChild(e), o.appendChild(c);
255
255
  }
256
256
  }
@@ -258,210 +258,209 @@ function he(e, t) {
258
258
  });
259
259
  }
260
260
  function B(e, t, n, r, i, a) {
261
- if (ge(i)) {
262
- let o = i.topLeft, s = A(e), c = A(t), l = A(e + n), u = A(t + r);
263
- return M("rect", {
261
+ if (ye(i)) {
262
+ let o = i.topLeft, s = N(e), c = N(t), l = N(e + n), u = N(t + r);
263
+ return F("rect", {
264
264
  x: s,
265
265
  y: c,
266
- width: A(l - s),
267
- height: A(u - c),
266
+ width: N(l - s),
267
+ height: N(u - c),
268
268
  ...o ? {
269
- rx: A(o),
270
- ry: A(o)
269
+ rx: N(o),
270
+ ry: N(o)
271
271
  } : {},
272
272
  ...a
273
273
  });
274
- } else return M("path", {
274
+ }
275
+ return F("path", {
275
276
  d: V(e, t, n, r, i),
276
277
  ...a
277
278
  });
278
279
  }
279
- function ge(e) {
280
+ function ye(e) {
280
281
  return Object.values(e).every((t) => t == e.topLeft);
281
282
  }
282
283
  function V(e, t, n, r, i) {
283
284
  let a = e + n, o = t + r, { topLeft: s, topRight: c, bottomRight: l, bottomLeft: u } = i;
284
285
  return [
285
286
  `M ${U(e + s, t)}`,
286
- `H ${A(a - c)}`,
287
+ `H ${N(a - c)}`,
287
288
  H(c, a, t + c, a, t),
288
- `V ${A(o - l)}`,
289
+ `V ${N(o - l)}`,
289
290
  H(l, a - l, o, a, o),
290
- `H ${A(e + u)}`,
291
+ `H ${N(e + u)}`,
291
292
  H(u, e, o - u, e, o),
292
- `V ${A(t + s)}`,
293
+ `V ${N(t + s)}`,
293
294
  H(s, e + s, t, e, t),
294
295
  "Z"
295
296
  ].join(" ");
296
297
  }
297
298
  function H(e, t, n, r, i) {
298
- return e ? `A ${A(e)} ${A(e)} 0 0 1 ${U(t, n)}` : `L ${U(r, i)}`;
299
+ return e ? `A ${N(e)} ${N(e)} 0 0 1 ${U(t, n)}` : `L ${U(r, i)}`;
299
300
  }
300
301
  function U(e, t) {
301
- return `${A(e)} ${A(t)}`;
302
+ return `${N(e)} ${N(t)}`;
302
303
  }
303
304
  //#endregion
304
305
  //#region ../core/src/rendering/svg/renderers/rule.js
305
306
  function W(e, t) {
306
- let n = e, r = ie(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, l = n.encoders, u = n.properties.strokeDash, f = N(o, {
307
+ let n = e, r = oe(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, u = n.encoders, d = n.properties.strokeDash, f = I(o, {
307
308
  stroke: {
308
- encoder: l.color,
309
- transform: d
309
+ encoder: u.color,
310
+ transform: l
310
311
  },
311
312
  "stroke-opacity": {
312
- encoder: l.opacity,
313
+ encoder: u.opacity,
313
314
  transform: (e) => +e * s
314
315
  },
315
316
  "stroke-width": {
316
- encoder: l.size,
317
- transform: (e) => A(+e)
317
+ encoder: u.size,
318
+ transform: (e) => N(+e)
318
319
  }
319
320
  });
320
- return o.setAttribute("stroke-linecap", "" + n.properties.strokeCap), u && (o.setAttribute("stroke-dasharray", u.map(A).join(" ")), o.setAttribute("stroke-dashoffset", "" + A(n.properties.strokeDashOffset))), y(n, r, {
321
+ return o.setAttribute("stroke-linecap", "" + n.properties.strokeCap), d && (o.setAttribute("stroke-dasharray", d.map(N).join(" ")), o.setAttribute("stroke-dashoffset", "" + N(n.properties.strokeDashOffset))), C(n, r, {
321
322
  coords: i,
322
323
  data: a,
323
324
  visibleBounds: c
324
325
  }, (e) => {
325
- t.countOnly || o.appendChild(M("line", {
326
- x1: A(e.x1),
327
- y1: A(e.y1),
328
- x2: A(e.x2),
329
- y2: A(e.y2),
326
+ t.countOnly || o.appendChild(F("line", {
327
+ x1: N(e.x1),
328
+ y1: N(e.y1),
329
+ x2: N(e.x2),
330
+ y2: N(e.y2),
330
331
  ...f(e.datum)
331
332
  }));
332
333
  });
333
334
  }
334
335
  //#endregion
335
336
  //#region ../core/src/rendering/svg/renderers/text.js
336
- function _e(e, t) {
337
- let n = e, r = n.properties, i = v(n), { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: l, anchorCullBounds: u } = t, p = n.encoders, m = N(s, {
337
+ function be(e, t) {
338
+ let n = e, r = n.properties, i = t.textMetrics ?? n.unitView.context.textMetrics, a = i.requestFont(r), o = D(i, r), s = S(n), { coords: c, data: u, group: d, viewOpacity: f, visibleBounds: p, anchorCullBounds: m } = t, h = n.encoders, g = I(d, {
338
339
  fill: {
339
- encoder: p.color,
340
- transform: d
340
+ encoder: h.color,
341
+ transform: l
341
342
  },
342
343
  "fill-opacity": {
343
- encoder: p.opacity,
344
- transform: (e) => +e * c
344
+ encoder: h.opacity,
345
+ transform: (e) => +e * f
345
346
  },
346
347
  "font-size": {
347
- encoder: p.size,
348
- transform: (e) => A(+e)
348
+ encoder: h.size,
349
+ transform: (e) => N(+e)
349
350
  }
350
351
  });
351
- s.setAttribute("font-family", te(r.font)), s.setAttribute("font-style", r.fontStyle ?? "normal"), s.setAttribute("font-weight", "" + w(r.fontWeight ?? "normal")), s.setAttribute("text-anchor", ve[i.align]);
352
- let h = {
352
+ d.setAttribute("font-family", b(r.font)), d.setAttribute("font-style", r.fontStyle ?? "normal"), d.setAttribute("font-weight", "" + ie(r.fontWeight ?? "normal")), d.setAttribute("text-anchor", xe[s.align]);
353
+ let _ = {
353
354
  top: {
354
- width: f(n, r.viewportEdgeFadeWidthTop),
355
- distance: f(n, r.viewportEdgeFadeDistanceTop)
355
+ width: k(n, r.viewportEdgeFadeWidthTop),
356
+ distance: k(n, r.viewportEdgeFadeDistanceTop)
356
357
  },
357
358
  right: {
358
- width: f(n, r.viewportEdgeFadeWidthRight),
359
- distance: f(n, r.viewportEdgeFadeDistanceRight)
359
+ width: k(n, r.viewportEdgeFadeWidthRight),
360
+ distance: k(n, r.viewportEdgeFadeDistanceRight)
360
361
  },
361
362
  bottom: {
362
- width: f(n, r.viewportEdgeFadeWidthBottom),
363
- distance: f(n, r.viewportEdgeFadeDistanceBottom)
363
+ width: k(n, r.viewportEdgeFadeWidthBottom),
364
+ distance: k(n, r.viewportEdgeFadeDistanceBottom)
364
365
  },
365
366
  left: {
366
- width: f(n, r.viewportEdgeFadeWidthLeft),
367
- distance: f(n, r.viewportEdgeFadeDistanceLeft)
367
+ width: k(n, r.viewportEdgeFadeWidthLeft),
368
+ distance: k(n, r.viewportEdgeFadeDistanceLeft)
368
369
  }
369
- }, g = ne(n, i, {
370
- coords: a,
371
- data: o,
372
- visibleBounds: l,
373
- anchorCullBounds: u
370
+ }, v = A(n, s, {
371
+ coords: c,
372
+ data: u,
373
+ visibleBounds: p,
374
+ anchorCullBounds: m,
375
+ fontMeasurement: a,
376
+ measureLogoInkBounds: o
374
377
  }, (e) => {
375
378
  if (t.countOnly) return;
376
- if (e.logoScale) {
379
+ if (e.logoTransform) {
377
380
  e.multiCharacterLogo && t.warn("SVG export stretches multi-character logo text as a single glyph cell.");
378
- let n = [`translate(${A(e.x)} ${A(e.y)})`];
379
- e.angle && n.push(`rotate(${A(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${A(e.dx)} ${A(e.dy)})`), n.push(`scale(${A(e.logoScale.width)} ${A(e.logoScale.heightScale)})`);
380
- let r = M("text", {
381
+ let n = [`translate(${N(e.x)} ${N(e.y)})`];
382
+ e.angle && n.push(`rotate(${N(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${N(e.dx)} ${N(e.dy)})`), n.push(`scale(${N(e.logoTransform.scaleX)} ${N(e.logoTransform.scaleY)})`), n.push(`translate(${N(-e.logoTransform.originX)} ${N(-e.logoTransform.originY)})`);
383
+ let r = F("text", {
381
384
  x: 0,
382
385
  y: 0,
383
- dy: O("middle", 1),
384
- "text-anchor": "middle",
385
- lengthAdjust: "spacingAndGlyphs",
386
- textLength: 1,
386
+ "text-anchor": "start",
387
387
  transform: n.join(" "),
388
- ...m(e.datum),
389
- "font-size": 1
388
+ ...g(e.datum),
389
+ "font-size": e.size
390
390
  });
391
- r.textContent = e.text, s.appendChild(r);
391
+ r.textContent = e.text, d.appendChild(r);
392
392
  return;
393
393
  }
394
- let n = A(e.x), r = A(e.y), a = M("text", {
395
- x: n,
396
- y: r,
397
- dx: A(e.dx),
398
- dy: A(e.dy + O(i.baseline, e.size)),
399
- lengthAdjust: "spacingAndGlyphs",
400
- textLength: A(e.width),
401
- ...m(e.datum),
402
- ...e.scale == 1 ? {} : { "font-size": A(e.size) },
403
- ...e.fadeOpacity == 1 ? {} : { opacity: k(e.fadeOpacity) }
394
+ let n = [`translate(${N(e.x)} ${N(e.y)})`];
395
+ e.angle && n.push(`rotate(${N(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${N(e.dx)} ${N(e.dy)})`), e.scale != 1 && n.push(`scale(${N(e.scale)})`);
396
+ let r = F("text", {
397
+ x: 0,
398
+ y: 0,
399
+ dy: N(ne(s.baseline, e.size)),
400
+ ...g(e.datum),
401
+ ...e.fadeOpacity == 1 ? {} : { opacity: M(e.fadeOpacity) },
402
+ transform: n.join(" ")
404
403
  });
405
- a.textContent = e.text, e.angle && a.setAttribute("transform", `rotate(${A(e.angle)} ${n} ${r})`), s.appendChild(a);
404
+ r.textContent = e.text, d.appendChild(r);
406
405
  });
407
- if (!t.countOnly && s.childElementCount > 0) {
408
- let e = t.getViewportEdgeFadeMaskUrl(h);
409
- e && s.setAttribute("mask", e);
406
+ if (!t.countOnly && d.childElementCount > 0) {
407
+ let e = t.getViewportEdgeFadeMaskUrl(_);
408
+ e && d.setAttribute("mask", e);
410
409
  }
411
- return g;
410
+ return v;
412
411
  }
413
- var ve = {
412
+ var xe = {
414
413
  left: "start",
415
414
  center: "middle",
416
415
  right: "end"
417
416
  }, G = 64;
418
- function ye(e, t) {
419
- let n = xe(e.unitView);
417
+ function Se(e, t) {
418
+ let n = we(e.unitView);
420
419
  if (!n) return;
421
420
  let i = e.unitView.getScaleResolution(n.channel)?.getScale();
422
421
  if (!i || !r(i.type)) return;
423
- let { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: l } = t;
422
+ let { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: d } = t;
424
423
  if (!o.length) return 0;
425
- let u = e.encoders, f = n.channel == "stroke" ? u.stroke : u.fill, p = Se(e.unitView.spec.encoding.x), m = Infinity, h = Infinity, _ = -Infinity, v = -Infinity, y = o.map((e) => {
426
- let [t, n] = ce(a, u, e), [r, i] = g(a, u, e);
427
- return m = Math.min(m, t, n), h = Math.min(h, r, i), _ = Math.max(_, t, n), v = Math.max(v, r, i), {
424
+ let f = e.encoders, p = n.channel == "stroke" ? f.stroke : f.fill, m = Te(e.unitView.spec.encoding.x), h = Infinity, v = Infinity, y = -Infinity, b = -Infinity, x = o.map((e) => {
425
+ let [t, n] = u(a, f, e), [r, i] = g(a, f, e);
426
+ return h = Math.min(h, t, n), v = Math.min(v, r, i), y = Math.max(y, t, n), b = Math.max(b, r, i), {
428
427
  offset: Number(e.position),
429
- color: d(f(e))
428
+ color: l(p(e))
430
429
  };
431
430
  }).sort((e, t) => e.offset - t.offset);
432
- if (!ee(l, m, h, _, v)) return 0;
431
+ if (!_(d, h, v, y, b)) return 0;
433
432
  if (t.countOnly) return o.length;
434
- let b = be(y), x = [
433
+ let S = Ce(x), C = [
435
434
  {
436
435
  offset: 0,
437
- color: b[0].color
436
+ color: S[0].color
438
437
  },
439
- ...b,
438
+ ...S,
440
439
  {
441
440
  offset: 1,
442
- color: b.at(-1).color
441
+ color: S.at(-1).color
443
442
  }
444
- ], S = t.getLegendGradientUrl({
445
- x1: m,
446
- y1: p ? h : v,
447
- x2: p ? _ : m,
448
- y2: h,
449
- stops: x
450
- }), C = A(m), w = A(h), T = A(_), E = A(v), D = Number(u.fillOpacity(o[0])) * c;
451
- return s.appendChild(M("rect", {
452
- x: C,
453
- y: w,
454
- width: A(T - C),
455
- height: A(E - w),
456
- fill: S,
457
- "fill-opacity": k(D),
443
+ ], w = t.getLegendGradientUrl({
444
+ x1: h,
445
+ y1: m ? v : b,
446
+ x2: m ? y : h,
447
+ y2: v,
448
+ stops: C
449
+ }), T = N(h), E = N(v), D = N(y), O = N(b), k = Number(f.fillOpacity(o[0])) * c;
450
+ return s.appendChild(F("rect", {
451
+ x: T,
452
+ y: E,
453
+ width: N(D - T),
454
+ height: N(O - E),
455
+ fill: w,
456
+ "fill-opacity": M(k),
458
457
  stroke: "none"
459
458
  })), o.length;
460
459
  }
461
- function be(e) {
462
- return e.length <= G ? e : Array.from({ length: G }, (t, n) => e[Math.round(n * (e.length - 1) / (G - 1))]);
460
+ function Ce(e) {
461
+ return e.length <= G ? e : Array.from({ length: G }, (t, n) => e[Math.round(n * (e.length - 1) / 63)]);
463
462
  }
464
- function xe(e) {
463
+ function we(e) {
465
464
  let t = e;
466
465
  for (; t;) {
467
466
  let e = t.spec.data;
@@ -469,32 +468,32 @@ function xe(e) {
469
468
  t = t.dataParent;
470
469
  }
471
470
  }
472
- function Se(e) {
471
+ function Te(e) {
473
472
  return e != null && "field" in e && (e.field == "position0" || e.field == "position1");
474
473
  }
475
474
  //#endregion
476
475
  //#region ../core/src/rendering/svg/renderers/index.js
477
- var Ce = /* @__PURE__ */ new Map([
476
+ var Ee = /* @__PURE__ */ new Map([
478
477
  ["arrow", de],
479
478
  ["link", me],
480
- ["point", I],
481
- ["rect", he],
479
+ ["point", z],
480
+ ["rect", ve],
482
481
  ["rule", W],
483
- ["text", _e],
482
+ ["text", be],
484
483
  ["tick", W]
485
484
  ]);
486
- function we(e, t) {
485
+ function De(e, t) {
487
486
  if (e.getType() == "rect") {
488
- let n = ye(e, t);
487
+ let n = Se(e, t);
489
488
  if (n !== void 0) return n;
490
489
  }
491
- let n = Ce.get(e.getType());
490
+ let n = Ee.get(e.getType());
492
491
  if (!n) throw Error(`SVG rendering is not implemented for mark type "${e.getType()}". View: ${e.unitView.getPathString()}`);
493
492
  return n(e, t);
494
493
  }
495
494
  //#endregion
496
495
  //#region ../core/src/rendering/svg/rectHatchPattern.js
497
- function Te(e, t) {
496
+ function Oe(e, t) {
498
497
  let n = t.strokeWidth, r = [
499
498
  "dots",
500
499
  "rings",
@@ -507,31 +506,31 @@ function Te(e, t) {
507
506
  "vertical",
508
507
  "horizontal",
509
508
  "grid"
510
- ].includes(t.type), o = r ? n * 7 : n * (i ? 6 : 4), s = a ? n * 2 : n, c = o, l = r ? o * 2 : o, u = M("pattern", {
509
+ ].includes(t.type), o = r ? n * 7 : n * (i ? 6 : 4), s = a ? n * 2 : n, c = o, l = r ? o * 2 : o, u = F("pattern", {
511
510
  id: e,
512
511
  x: 0,
513
512
  y: 0,
514
- width: A(c),
515
- height: A(l),
513
+ width: N(c),
514
+ height: N(l),
516
515
  patternUnits: "userSpaceOnUse"
517
516
  });
518
- u.appendChild(M("rect", {
519
- width: A(c),
520
- height: A(l),
517
+ u.appendChild(F("rect", {
518
+ width: N(c),
519
+ height: N(l),
521
520
  fill: t.fill,
522
- "fill-opacity": k(t.fillOpacity)
521
+ "fill-opacity": M(t.fillOpacity)
523
522
  }));
524
- let d = M("g", {
523
+ let d = F("g", {
525
524
  fill: "none",
526
525
  stroke: t.stroke,
527
- "stroke-opacity": k(t.strokeOpacity),
528
- "stroke-width": A(s),
526
+ "stroke-opacity": M(t.strokeOpacity),
527
+ "stroke-width": N(s),
529
528
  "stroke-linecap": "square"
530
529
  });
531
- return Ee(d, t.type, o, s), u.appendChild(d), u;
530
+ return ke(d, t.type, o, s), u.appendChild(d), u;
532
531
  }
533
- function Ee(e, t, n, r) {
534
- let i = (t) => e.appendChild(M("path", { d: t })), a = (e) => A(e), o = (e) => {
532
+ function ke(e, t, n, r) {
533
+ let i = (t) => e.appendChild(F("path", { d: t })), a = (e) => N(e), o = (e) => {
535
534
  for (let t of [
536
535
  -n,
537
536
  0,
@@ -560,10 +559,10 @@ function Ee(e, t, n, r) {
560
559
  case "dots":
561
560
  case "rings":
562
561
  case "ringsLarge": {
563
- let r = n * (t == "dots" ? .07 : t == "rings" ? .2 : .35), i = (t, n) => e.appendChild(M("circle", {
564
- cx: A(t),
565
- cy: A(n),
566
- r: A(r)
562
+ let r = n * (t == "dots" ? .07 : t == "rings" ? .2 : .35), i = (t, n) => e.appendChild(F("circle", {
563
+ cx: N(t),
564
+ cy: N(n),
565
+ r: N(r)
567
566
  }));
568
567
  i(n / 2, 0), i(n / 2, n * 2), i(0, n), i(n, n);
569
568
  break;
@@ -573,34 +572,34 @@ function Ee(e, t, n, r) {
573
572
  }
574
573
  //#endregion
575
574
  //#region ../core/src/rendering/svg/linkArcFadeMask.js
576
- function De(e, t, n, r) {
577
- let { normalX: i, normalY: a, offset: o, start: s, end: c } = r, l = i * o, u = a * o, d = e + "-gradient", f = M("linearGradient", {
575
+ function Ae(e, t, n, r) {
576
+ let { normalX: i, normalY: a, offset: o, start: s, end: c } = r, l = i * o, u = a * o, d = e + "-gradient", f = F("linearGradient", {
578
577
  id: d,
579
578
  gradientUnits: "userSpaceOnUse",
580
- x1: A(l - i * c),
581
- y1: A(u - a * c),
582
- x2: A(l + i * c),
583
- y2: A(u + a * c),
579
+ x1: N(l - i * c),
580
+ y1: N(u - a * c),
581
+ x2: N(l + i * c),
582
+ y2: N(u + a * c),
584
583
  spreadMethod: "pad"
585
584
  });
586
- for (let { offset: e, opacity: t } of S(s, c)) f.appendChild(M("stop", {
585
+ for (let { offset: e, opacity: t } of ue(s, c)) f.appendChild(F("stop", {
587
586
  offset: K(e, 3),
588
587
  "stop-color": "white",
589
588
  "stop-opacity": K(t, 3)
590
589
  }));
591
- let p = M("mask", {
590
+ let p = F("mask", {
592
591
  id: e,
593
592
  x: 0,
594
593
  y: 0,
595
- width: A(t),
596
- height: A(n),
594
+ width: N(t),
595
+ height: N(n),
597
596
  maskUnits: "userSpaceOnUse",
598
597
  maskContentUnits: "userSpaceOnUse",
599
598
  "mask-type": "luminance"
600
599
  });
601
- return p.appendChild(M("rect", {
602
- width: A(t),
603
- height: A(n),
600
+ return p.appendChild(F("rect", {
601
+ width: N(t),
602
+ height: N(n),
604
603
  fill: `url(#${d})`
605
604
  })), {
606
605
  gradient: f,
@@ -626,8 +625,8 @@ var q = class extends s {
626
625
  #l = /* @__PURE__ */ new Set();
627
626
  #u = !1;
628
627
  #d = /* @__PURE__ */ new Map();
629
- #f = new p();
630
- #p = M("g");
628
+ #f = new f();
629
+ #p = F("g");
631
630
  #m;
632
631
  #h;
633
632
  #g = [];
@@ -640,14 +639,14 @@ var q = class extends s {
640
639
  #C = 0;
641
640
  #w = 0;
642
641
  constructor(e, t) {
643
- super(e), this.width = t.width, this.height = t.height, this.#h = t.maxVectorInstances;
644
- let n = A(t.width), r = A(t.height);
645
- this.#e = M("svg", {
646
- xmlns: j,
642
+ super(e), this.width = t.width, this.height = t.height, this.textMetrics = t.textMetrics, this.#h = t.maxVectorInstances;
643
+ let n = N(t.width), r = N(t.height);
644
+ this.#e = F("svg", {
645
+ xmlns: P,
647
646
  width: n,
648
647
  height: r,
649
648
  viewBox: `0 0 ${n} ${r}`
650
- }), this.#t = M("defs"), this.#e.appendChild(this.#t), t.background != null && this.#e.appendChild(M("rect", {
649
+ }), this.#t = F("defs"), this.#e.appendChild(this.#t), t.background != null && this.#e.appendChild(F("rect", {
651
650
  width: n,
652
651
  height: r,
653
652
  fill: t.background,
@@ -688,42 +687,42 @@ var q = class extends s {
688
687
  for (let t of e.markGroupElements) t.childElementCount || t.remove();
689
688
  this.#m = void 0;
690
689
  }
691
- pushView(e, t) {
692
- let r = e.getPathString();
693
- if (n(this.#n)?.exportExcluded || i(e) && e.name.startsWith("scrollbar-")) {
690
+ pushView(t, n) {
691
+ let r = t.getPathString();
692
+ if (e(this.#n)?.exportExcluded || i(t) && t.name.startsWith("scrollbar-")) {
694
693
  this.#n.push({
695
- view: e,
694
+ view: t,
696
695
  node: this.currentNode,
697
- coords: t,
696
+ coords: n,
698
697
  exportExcluded: !0
699
698
  });
700
699
  return;
701
700
  }
702
701
  if (this.#u) {
703
702
  this.#n.push({
704
- view: e,
703
+ view: t,
705
704
  node: this.currentNode,
706
- coords: t,
705
+ coords: n,
707
706
  exportExcluded: !1
708
707
  });
709
708
  return;
710
709
  }
711
- let a = this.#m, o = a?.viewGroups.get(e);
710
+ let a = this.#m, o = a?.viewGroups.get(t);
712
711
  if (o) {
713
712
  if (o.parentNode !== this.currentNode) throw Error(`Sample-faceted view was rendered under multiple parents: ${r}`);
714
713
  } else {
715
- o = M("g", {
716
- id: Oe(e.name, this.#v++),
717
- "data-name": e.name,
714
+ o = F("g", {
715
+ id: je(t.name, this.#v++),
716
+ "data-name": t.name,
718
717
  "data-view-path": r
719
718
  });
720
- let t = M("title");
721
- t.textContent = r, o.appendChild(t), this.currentNode.appendChild(o), a?.viewGroups.set(e, o);
719
+ let e = F("title");
720
+ e.textContent = r, o.appendChild(e), this.currentNode.appendChild(o), a?.viewGroups.set(t, o);
722
721
  }
723
722
  this.#n.push({
724
- view: e,
723
+ view: t,
725
724
  node: o,
726
- coords: t,
725
+ coords: n,
727
726
  exportExcluded: !1
728
727
  });
729
728
  }
@@ -731,27 +730,28 @@ var q = class extends s {
731
730
  if (this.#n.pop()?.view !== e) throw Error("Unbalanced SVG view rendering context stack.");
732
731
  }
733
732
  renderMark(r, i) {
734
- if (n(this.#n)?.exportExcluded || r.unitView.getEffectiveOpacity() <= 0) return;
735
- let a = e(i), o = t(a, r.properties.clip, this.currentCoords), s = T(this.width, this.height, o);
736
- if (!l(s)) return;
733
+ if (e(this.#n)?.exportExcluded || r.unitView.getEffectiveOpacity() <= 0) return;
734
+ let a = t(i), o = n(a, r.properties.clip, this.currentCoords), s = m(this.width, this.height, o);
735
+ if (!h(s)) return;
737
736
  let c = this.getVisibleInstanceCount(r);
738
737
  if (!this.#u && this.#h != null && c == 0) return;
739
738
  if (!this.#u && this.#h != null && c > this.#h) {
740
739
  this.#T(r, s);
741
740
  return;
742
741
  }
743
- let u = !this.#u && this.#m != null, d = u ? this.getClipPathUrl(o) : void 0, f = u ? this.#m.markGroups.get(r)?.get(d ?? "") : void 0;
744
- !this.#u && !f && this.#E();
745
- let p = this.#u ? this.#p : this.#O(r, d), g = h(this.currentCoords, a, r.properties.cullByVisibleRange), _ = r.getOrder?.(), v = !this.#u && _ && _.isActive();
746
- if (m(r, i, this.currentCoords, this.#f, (e, t) => {
742
+ let l = !this.#u && this.#m != null, u = l ? this.getClipPathUrl(o) : void 0, d = l ? this.#m.markGroups.get(r)?.get(u ?? "") : void 0;
743
+ !this.#u && !d && this.#E();
744
+ let f = this.#u ? this.#p : this.#O(r, u), g = O(this.currentCoords, a, r.properties.cullByVisibleRange), _ = r.getOrder?.(), v = !this.#u && _ && _.isActive();
745
+ if (p(r, i, this.currentCoords, this.#f, (e, t) => {
747
746
  let n = (t, n = !1) => {
748
- let i = we(r, {
747
+ let i = De(r, {
749
748
  coords: e,
750
749
  data: t,
751
- group: p,
750
+ group: f,
752
751
  visibleBounds: s,
753
752
  anchorCullBounds: g,
754
753
  viewOpacity: r.unitView.getEffectiveOpacity(),
754
+ textMetrics: this.textMetrics,
755
755
  secondOrderPass: n,
756
756
  countOnly: this.#u,
757
757
  getViewportEdgeFadeMaskUrl: (e) => this.#u ? void 0 : this.getViewportEdgeFadeMaskUrl(e),
@@ -772,9 +772,9 @@ var q = class extends s {
772
772
  }
773
773
  let i = ae(t, 0, t.length, _.predicate, _.passes);
774
774
  for (let [e, t] of i.entries()) t.length !== 0 && n(t, e === 1);
775
- }, (e) => this.#l.add(`SVG export could not resolve sample facet index ${e}. View: ${r.unitView.getPathString()}`)), !this.#u && !u && p.childElementCount > 0) {
775
+ }, (e) => this.#l.add(`SVG export could not resolve sample facet index ${e}. View: ${r.unitView.getPathString()}`)), !this.#u && !l && f.childElementCount > 0) {
776
776
  let e = this.getClipPathUrl(o);
777
- e && p.setAttribute("clip-path", e), this.currentNode.appendChild(p);
777
+ e && f.setAttribute("clip-path", e), this.currentNode.appendChild(f);
778
778
  }
779
779
  }
780
780
  #T(e, t) {
@@ -806,26 +806,26 @@ var q = class extends s {
806
806
  e && (this.#g.push(e), this.#_ = void 0);
807
807
  }
808
808
  #D(e) {
809
- let t = ke(e.viewNodes), n = e.targets.map((e) => e.mark.getType()), r = M("g", {
809
+ let t = Me(e.viewNodes), n = e.targets.map((e) => e.mark.getType()), r = F("g", {
810
810
  id: `rasterized-${n.join("-")}-${this.#w++}`,
811
811
  "data-name": `Rasterized ${n.join(", ")}`,
812
812
  "data-rasterized": ""
813
- }), i = M("image", { preserveAspectRatio: "none" });
813
+ }), i = F("image", { preserveAspectRatio: "none" });
814
814
  r.appendChild(i);
815
815
  let a = e.anchor.parentNode;
816
- t == a ? t.insertBefore(r, e.anchor) : t.insertBefore(r, Ae(a, t)), e.anchor.remove();
817
- for (let n of e.viewNodes) je(n, t);
816
+ t == a ? t.insertBefore(r, e.anchor) : t.insertBefore(r, Ne(a, t)), e.anchor.remove();
817
+ for (let n of e.viewNodes) Pe(n, t);
818
818
  e.image = i;
819
819
  }
820
820
  #O(e, t) {
821
821
  let n = this.#m;
822
- if (!n) return M("g", { "data-mark-type": e.getType() });
822
+ if (!n) return F("g", { "data-mark-type": e.getType() });
823
823
  let r = n.markGroups.get(e);
824
824
  r || (r = /* @__PURE__ */ new Map(), n.markGroups.set(e, r));
825
825
  let i = t ?? "", a = r.get(i);
826
826
  if (a) {
827
827
  if (a.parentNode !== this.currentNode) throw Error(`Sample-faceted mark was rendered under multiple parents: ${e.unitView.getPathString()}`);
828
- } else a = M("g", { "data-mark-type": e.getType() }), t && a.setAttribute("clip-path", t), this.currentNode.appendChild(a), r.set(i, a), n.markGroupElements.add(a);
828
+ } else a = F("g", { "data-mark-type": e.getType() }), t && a.setAttribute("clip-path", t), this.currentNode.appendChild(a), r.set(i, a), n.markGroupElements.add(a);
829
829
  return a;
830
830
  }
831
831
  getClipPathUrl(e) {
@@ -835,14 +835,14 @@ var q = class extends s {
835
835
  e.clipY ? t.y : 0,
836
836
  e.clipX ? t.width : this.width,
837
837
  e.clipY ? t.height : this.height
838
- ].map(A), r = n.join(","), i = this.#r.get(r);
838
+ ].map(N), r = n.join(","), i = this.#r.get(r);
839
839
  if (!i) {
840
840
  i = "clip-" + this.#y++;
841
- let e = M("clipPath", {
841
+ let e = F("clipPath", {
842
842
  id: i,
843
843
  clipPathUnits: "userSpaceOnUse"
844
844
  });
845
- e.appendChild(M("rect", {
845
+ e.appendChild(F("rect", {
846
846
  x: n[0],
847
847
  y: n[1],
848
848
  width: n[2],
@@ -852,28 +852,28 @@ var q = class extends s {
852
852
  return `url(#${i})`;
853
853
  }
854
854
  getShadowFilterUrl(e) {
855
- let t = A(Math.max(e.blur / 2.5, .25)), n = A(e.offsetX), r = A(e.offsetY), i = [
855
+ let t = N(Math.max(e.blur / 2.5, .25)), n = N(e.offsetX), r = N(e.offsetY), i = [
856
856
  t,
857
857
  n,
858
858
  r
859
859
  ].join(","), a = this.#a.get(i);
860
860
  if (!a) {
861
861
  a = "shadow-" + this.#x++;
862
- let e = M("filter", {
862
+ let e = F("filter", {
863
863
  id: a,
864
864
  x: 0,
865
865
  y: 0,
866
- width: A(this.width),
867
- height: A(this.height),
866
+ width: N(this.width),
867
+ height: N(this.height),
868
868
  filterUnits: "userSpaceOnUse",
869
869
  primitiveUnits: "userSpaceOnUse",
870
870
  "color-interpolation-filters": "sRGB"
871
871
  });
872
- e.appendChild(M("feGaussianBlur", {
872
+ e.appendChild(F("feGaussianBlur", {
873
873
  in: "SourceGraphic",
874
874
  stdDeviation: t,
875
875
  result: "blur"
876
- })), e.appendChild(M("feOffset", {
876
+ })), e.appendChild(F("feOffset", {
877
877
  in: "blur",
878
878
  dx: n,
879
879
  dy: r,
@@ -886,12 +886,12 @@ var q = class extends s {
886
886
  let t = this.#o.get(e);
887
887
  if (!t) {
888
888
  t = "shadow-clip-" + this.#y++;
889
- let n = M("clipPath", {
889
+ let n = F("clipPath", {
890
890
  id: t,
891
891
  clipPathUnits: "userSpaceOnUse"
892
892
  });
893
- n.appendChild(M("path", {
894
- d: `M 0 0 V ${A(this.height)} H ${A(this.width)} V 0 Z ${e}`,
893
+ n.appendChild(F("path", {
894
+ d: `M 0 0 V ${N(this.height)} H ${N(this.width)} V 0 Z ${e}`,
895
895
  "clip-rule": "evenodd",
896
896
  "fill-rule": "evenodd"
897
897
  })), this.#t.appendChild(n), this.#o.set(e, t);
@@ -902,68 +902,68 @@ var q = class extends s {
902
902
  let t = JSON.stringify([
903
903
  e.type,
904
904
  e.fill,
905
- k(e.fillOpacity),
905
+ M(e.fillOpacity),
906
906
  e.stroke,
907
- k(e.strokeOpacity),
908
- k(e.strokeWidth)
907
+ M(e.strokeOpacity),
908
+ M(e.strokeWidth)
909
909
  ]), n = this.#s.get(t);
910
- return n || (n = "rect-hatch-" + this.#S++, this.#t.appendChild(Te(n, e)), this.#s.set(t, n)), `url(#${n})`;
910
+ return n || (n = "rect-hatch-" + this.#S++, this.#t.appendChild(Oe(n, e)), this.#s.set(t, n)), `url(#${n})`;
911
911
  }
912
912
  getLegendGradientUrl(e) {
913
- let t = "legend-gradient-" + this.#C++, n = M("linearGradient", {
913
+ let t = "legend-gradient-" + this.#C++, n = F("linearGradient", {
914
914
  id: t,
915
915
  gradientUnits: "userSpaceOnUse",
916
- x1: A(e.x1),
917
- y1: A(e.y1),
918
- x2: A(e.x2),
919
- y2: A(e.y2)
916
+ x1: N(e.x1),
917
+ y1: N(e.y1),
918
+ x2: N(e.x2),
919
+ y2: N(e.y2)
920
920
  });
921
- for (let t of e.stops) n.appendChild(M("stop", {
922
- offset: k(t.offset),
921
+ for (let t of e.stops) n.appendChild(F("stop", {
922
+ offset: M(t.offset),
923
923
  "stop-color": t.color
924
924
  }));
925
925
  return this.#t.appendChild(n), `url(#${t})`;
926
926
  }
927
927
  getLinkArcFadeMaskUrl(e) {
928
- let t = _(e.p1, e.p4, e.distances);
928
+ let t = x(e.p1, e.p4, e.distances);
929
929
  if (!t) return;
930
930
  let n = this.#c.get(t.key);
931
931
  if (!n) {
932
932
  n = "link-arc-fade-" + this.#b++;
933
- let { gradient: e, mask: r } = De(n, this.width, this.height, t);
933
+ let { gradient: e, mask: r } = Ae(n, this.width, this.height, t);
934
934
  this.#t.appendChild(e), this.#t.appendChild(r), this.#c.set(t.key, n);
935
935
  }
936
936
  return `url(#${n})`;
937
937
  }
938
- getViewportEdgeFadeMaskUrl(e) {
939
- let t = Object.entries(e).filter(([, e]) => e.width > 0 && Number.isFinite(e.distance));
940
- if (!t.length) return;
941
- let r = n(this.#n);
938
+ getViewportEdgeFadeMaskUrl(t) {
939
+ let n = Object.entries(t).filter(([, e]) => e.width > 0 && Number.isFinite(e.distance));
940
+ if (!n.length) return;
941
+ let r = e(this.#n);
942
942
  if (!r) throw Error("No current view in SVG rendering context.");
943
943
  let i = this.#i.get(r.view);
944
944
  if (!i) {
945
945
  i = "edge-fade-" + this.#b++;
946
- let e = A(this.width), n = A(this.height), a = M("mask", {
946
+ let e = N(this.width), t = N(this.height), a = F("mask", {
947
947
  id: i,
948
948
  x: 0,
949
949
  y: 0,
950
950
  width: e,
951
- height: n,
951
+ height: t,
952
952
  maskUnits: "userSpaceOnUse",
953
953
  maskContentUnits: "userSpaceOnUse",
954
954
  "mask-type": "luminance"
955
955
  });
956
- a.appendChild(M("rect", {
956
+ a.appendChild(F("rect", {
957
957
  width: e,
958
- height: n,
958
+ height: t,
959
959
  fill: "white"
960
960
  }));
961
- for (let [o, s] of t) {
962
- let t = i + "-" + o, c = Me(t, o, s, r.coords);
963
- this.#t.appendChild(c), a.appendChild(M("rect", {
961
+ for (let [o, s] of n) {
962
+ let n = i + "-" + o, c = Fe(n, o, s, r.coords);
963
+ this.#t.appendChild(c), a.appendChild(F("rect", {
964
964
  width: e,
965
- height: n,
966
- fill: `url(#${t})`
965
+ height: t,
966
+ fill: `url(#${n})`
967
967
  }));
968
968
  }
969
969
  this.#t.appendChild(a), this.#i.set(r.view, i);
@@ -977,52 +977,52 @@ var q = class extends s {
977
977
  return Array.from(this.#l);
978
978
  }
979
979
  get currentNode() {
980
- return n(this.#n)?.node ?? this.#e;
980
+ return e(this.#n)?.node ?? this.#e;
981
981
  }
982
982
  get currentCoords() {
983
- let e = n(this.#n);
984
- if (!e) throw Error("No current view in SVG rendering context.");
985
- return e.coords;
983
+ let t = e(this.#n);
984
+ if (!t) throw Error("No current view in SVG rendering context.");
985
+ return t.coords;
986
986
  }
987
987
  };
988
- function Oe(e, t) {
988
+ function je(e, t) {
989
989
  let n = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
990
990
  return `${/^[A-Za-z_]/.test(n) ? n : n ? "view-" + n : "view"}-${t}`;
991
991
  }
992
992
  function J(e, t) {
993
993
  e.x1 = Math.min(e.x1, t.x1), e.y1 = Math.min(e.y1, t.y1), e.x2 = Math.max(e.x2, t.x2), e.y2 = Math.max(e.y2, t.y2);
994
994
  }
995
- function ke(e) {
995
+ function Me(e) {
996
996
  let [t, ...n] = Array.from(e), r = t;
997
997
  for (; n.some((e) => !r.contains(e));) r = r.parentNode;
998
998
  return r;
999
999
  }
1000
- function Ae(e, t) {
1000
+ function Ne(e, t) {
1001
1001
  let n = e;
1002
1002
  for (; n.parentNode != t;) n = n.parentNode;
1003
1003
  return n;
1004
1004
  }
1005
- function je(e, t) {
1005
+ function Pe(e, t) {
1006
1006
  let n = e;
1007
1007
  for (; n != t && n.matches("g[data-view-path]") && Array.from(n.children).every((e) => e.tagName == "title");) {
1008
1008
  let e = n.parentNode;
1009
1009
  n.remove(), n = e;
1010
1010
  }
1011
1011
  }
1012
- function Me(e, t, n, r) {
1013
- let i = t == "top" ? r.y + n.distance : t == "right" ? r.x2 - n.distance : t == "bottom" ? r.y2 - n.distance : r.x + n.distance, a = t == "left" || t == "right", o = i + (t == "top" || t == "left" ? 1 : -1) * n.width, s = M("linearGradient", {
1012
+ function Fe(e, t, n, r) {
1013
+ let i = t == "top" ? r.y + n.distance : t == "right" ? r.x2 - n.distance : t == "bottom" ? r.y2 - n.distance : r.x + n.distance, a = t == "left" || t == "right", o = i + (t == "top" || t == "left" ? 1 : -1) * n.width, s = F("linearGradient", {
1014
1014
  id: e,
1015
1015
  gradientUnits: "userSpaceOnUse",
1016
- x1: A(a ? i : 0),
1017
- y1: A(a ? 0 : i),
1018
- x2: A(a ? o : 0),
1019
- y2: A(a ? 0 : o)
1016
+ x1: N(a ? i : 0),
1017
+ y1: N(a ? 0 : i),
1018
+ x2: N(a ? o : 0),
1019
+ y2: N(a ? 0 : o)
1020
1020
  });
1021
- return s.appendChild(M("stop", {
1021
+ return s.appendChild(F("stop", {
1022
1022
  offset: 0,
1023
1023
  "stop-color": "black",
1024
1024
  "stop-opacity": 1
1025
- })), s.appendChild(M("stop", {
1025
+ })), s.appendChild(F("stop", {
1026
1026
  offset: 1,
1027
1027
  "stop-color": "black",
1028
1028
  "stop-opacity": 0
@@ -1030,22 +1030,24 @@ function Me(e, t, n, r) {
1030
1030
  }
1031
1031
  //#endregion
1032
1032
  //#region ../core/src/rendering/svg/index.js
1033
- function Y({ viewRoot: e, logicalWidth: t, logicalHeight: n, background: r = "white" }) {
1034
- let i = new q({ picking: !1 }, {
1033
+ function Y({ viewRoot: e, logicalWidth: t, logicalHeight: n, background: r = "white", textMetrics: i = e.context.textMetrics }) {
1034
+ let a = new q({ picking: !1 }, {
1035
1035
  width: t,
1036
1036
  height: n,
1037
- background: r
1037
+ background: r,
1038
+ textMetrics: i
1038
1039
  });
1039
- return c(e, o.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(i), {
1040
- svg: i.getSvg(),
1041
- warnings: i.getWarnings()
1040
+ return c(e, o.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(a), {
1041
+ svg: a.getSvg(),
1042
+ warnings: a.getWarnings()
1042
1043
  };
1043
1044
  }
1044
- function Ne({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
1045
+ async function Ie({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
1045
1046
  let r = new q({ picking: !1 }, {
1046
1047
  width: t,
1047
1048
  height: n,
1048
- background: null
1049
+ background: null,
1050
+ textMetrics: await Z(e)
1049
1051
  });
1050
1052
  return r.beginInstanceCounting(), c(e, o.create(0, 0, t, n), { renderingOptions: { firstFacet: !0 } }).collectRenderCommands(r), r.endInstanceCounting(), { layers: Array.from(r.getVisibleInstanceCounts(), ([e, t]) => ({
1051
1053
  viewName: e.unitView.name,
@@ -1055,36 +1057,41 @@ function Ne({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
1055
1057
  instanceCount: t
1056
1058
  })).filter((e) => e.instanceCount > 0) };
1057
1059
  }
1058
- async function X(e) {
1059
- let t = e.rasterization;
1060
- return t ? ($(t), e.rasterizeSvgRuns ? Z({
1060
+ async function Le(e) {
1061
+ let t = await Z(e.viewRoot), n = {
1061
1062
  ...e,
1063
+ textMetrics: t
1064
+ }, r = e.rasterization;
1065
+ return r ? ($(r), e.rasterizeSvgRuns ? X({
1066
+ ...n,
1062
1067
  rasterizeSvgRuns: e.rasterizeSvgRuns,
1063
- maxVectorInstances: t.maxVectorInstances,
1064
- pixelRatio: t.pixelRatio
1065
- }) : Q(e)) : {
1066
- ...Y(e),
1068
+ maxVectorInstances: r.maxVectorInstances,
1069
+ pixelRatio: r.pixelRatio
1070
+ }) : Q(n)) : {
1071
+ ...Y(n),
1067
1072
  rasterized: []
1068
1073
  };
1069
1074
  }
1070
- async function Z({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHeight: r, background: i = "white", maxVectorInstances: s, pixelRatio: l = 2 }) {
1071
- $({
1075
+ async function X({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHeight: r, background: i = "white", maxVectorInstances: s, pixelRatio: l = 2, textMetrics: u }) {
1076
+ u ??= await Z(e), $({
1072
1077
  maxVectorInstances: s,
1073
1078
  pixelRatio: l
1074
1079
  });
1075
- let u = new q({ picking: !1 }, {
1080
+ let d = new q({ picking: !1 }, {
1076
1081
  width: n,
1077
1082
  height: r,
1078
1083
  background: i,
1079
- maxVectorInstances: s
1080
- }), d = c(e, o.create(0, 0, n, r), { renderingOptions: { firstFacet: !0 } });
1081
- u.beginInstanceCounting(), d.collectRenderCommands(u), u.endInstanceCounting(), d.collectRenderCommands(u);
1082
- let f = u.getRasterRuns();
1083
- if (f.length) try {
1084
+ maxVectorInstances: s,
1085
+ textMetrics: u
1086
+ }), f = o.create(0, 0, n, r), p = c(e, f, { renderingOptions: { firstFacet: !0 } });
1087
+ d.beginInstanceCounting(), p.collectRenderCommands(d), d.endInstanceCounting(), p.collectRenderCommands(d);
1088
+ let m = d.getRasterRuns();
1089
+ if (m.length) try {
1084
1090
  await t({
1085
- runs: f,
1091
+ runs: m,
1086
1092
  viewRoot: e,
1087
- layoutResult: d,
1093
+ layoutResult: p,
1094
+ textMetrics: u,
1088
1095
  logicalWidth: n,
1089
1096
  logicalHeight: r,
1090
1097
  pixelRatio: l
@@ -1094,14 +1101,15 @@ async function Z({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHei
1094
1101
  viewRoot: e,
1095
1102
  logicalWidth: n,
1096
1103
  logicalHeight: r,
1097
- background: i
1104
+ background: i,
1105
+ textMetrics: u
1098
1106
  });
1099
1107
  throw t;
1100
1108
  }
1101
1109
  return {
1102
- svg: u.getSvg(),
1103
- warnings: u.getWarnings(),
1104
- rasterized: f.map((e) => ({
1110
+ svg: d.getSvg(),
1111
+ warnings: d.getWarnings(),
1112
+ rasterized: m.map((e) => ({
1105
1113
  targets: e.targets.map((e) => ({
1106
1114
  markType: e.mark.getType(),
1107
1115
  instanceCount: e.instanceCount
@@ -1112,6 +1120,11 @@ async function Z({ viewRoot: e, rasterizeSvgRuns: t, logicalWidth: n, logicalHei
1112
1120
  }))
1113
1121
  };
1114
1122
  }
1123
+ async function Z(e) {
1124
+ if (!document.fonts) return e.context.textMetrics;
1125
+ let t = te(document);
1126
+ return await re(t, e), t;
1127
+ }
1115
1128
  function Q(e) {
1116
1129
  let t = Y(e);
1117
1130
  return {
@@ -1125,4 +1138,4 @@ function $(e) {
1125
1138
  if (e.pixelRatio != null && (!Number.isFinite(e.pixelRatio) || e.pixelRatio <= 0)) throw RangeError("SVG raster pixelRatio must be positive.");
1126
1139
  }
1127
1140
  //#endregion
1128
- export { Ne as analyzeSvgExport, Z as createRasterizedSvg, Y as createSvg, X as createSvgExport };
1141
+ export { Ie as analyzeSvgExport, X as createRasterizedSvg, Y as createSvg, Le as createSvgExport };