@genome-spy/app 0.83.1 → 0.85.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.
- package/dist/{agentApi-AxdD95yY.js → agentApi-Cz0hCnVp.js} +6576 -7722
- package/dist/agentApi.es.js +3747 -3317
- package/dist/agentShared.es.js +18 -18
- package/dist/arrayUtils-LJpQOu-U.js +2175 -0
- package/dist/bmFontMetrics-CuNB-kNN.js +31 -0
- package/dist/canvas2d-DoAXEiF9.js +309 -0
- package/dist/canvas2d-f5jl4A5D.js +310 -0
- package/dist/canvasSizeHelper-7h_8rOcx.js +56 -0
- package/dist/clipOptions-gqdb3fvW.js +43 -0
- package/dist/color-W5zffv-z.js +335 -0
- package/dist/{componentStyles-BzJWWojD.js → componentStyles-FsNmIb22.js} +5 -1
- package/dist/{debug-CI7POTMx.js → debug-BvCZWumf.js} +10 -10
- package/dist/{debug-DJKug_38.js → debug-CgDtmspT.js} +7 -5
- package/dist/dialog.es.js +1 -1
- package/dist/{esm-CGLz7idZ.js → esm-BA6yMcc-.js} +438 -434
- package/dist/{esm-D8vvQAP3.js → esm-CcDLRSvC.js} +33 -33
- package/dist/{esm-BeV56E_5.js → esm-CfYZhLHN.js} +33 -33
- package/dist/{esm-DQ3lJSQN.js → esm-JAiZmFIS.js} +1 -1
- package/dist/framebufferReadback-CCLOjStu.js +148 -0
- package/dist/framebufferReadback-THWwFqs8.js +1994 -0
- package/dist/index.es.js +3735 -3369
- package/dist/index.js +743 -616
- package/dist/metadataChannels-DV62inJh.js +19 -0
- package/dist/nativeText-DMO8gLt7.js +806 -0
- package/dist/nativeText-m5AUINMq.js +806 -0
- package/dist/paramUtils-BYI4rwyL.js +2195 -0
- package/dist/schema.json +2253 -4201
- package/dist/style.css +1 -1
- package/dist/svg-CCu8kYy2.js +1158 -0
- package/dist/svg-yFj875aX.js +1158 -0
- package/dist/svgNumber-DNxESJQB.js +11 -0
- package/dist/twgl-full.module-DB2UdP1k.js +1849 -0
- package/dist/viewIdentityRegistry-BUdkK9zT.js +92 -0
- package/dist/{viewIdentityRegistry-CcQdL0Z8.js → viewIdentityRegistry-D3oPbN4O.js} +1 -1
- package/dist/viewRenderingContext-HtpqwS_x.js +120 -0
- package/dist/viewSelectors-DGCspRN3.js +4198 -0
- package/dist/viewSelectors-U5oLCLHV.js +4195 -0
- package/dist/{viewUtils-Cybv1tu-.js → viewUtils-Dg4RA40Q.js} +2405 -3983
- package/dist/warning-CpIIpk8e.js +7 -0
- package/dist/warning-DRGdb6BF.js +59 -0
- package/dist/webgl-Ci6ZhCCf.js +54 -0
- package/dist/webgl-Dpz8a3TI.js +53 -0
- package/package.json +5 -5
- package/dist/metadataChannels-fGQOmJj0.js +0 -6732
- package/dist/viewIdentityRegistry-EH5-Noyz.js +0 -6827
|
@@ -0,0 +1,1158 @@
|
|
|
1
|
+
import { B as e, H as t, ft as n, r } from "./arrayUtils-LJpQOu-U.js";
|
|
2
|
+
import { b as i, q as a } from "./viewSelectors-U5oLCLHV.js";
|
|
3
|
+
import { a as o, o as s } from "./clipOptions-gqdb3fvW.js";
|
|
4
|
+
import { n as c, t as l } from "./viewRenderingContext-HtpqwS_x.js";
|
|
5
|
+
import { C as u, E as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as y, g as b, h as x, i as S, l as C, m as w, n as T, o as E, p as D, r as ee, s as te, t as ne, u as re, v as ie, w as O, x as k, y as ae } from "./nativeText-m5AUINMq.js";
|
|
6
|
+
import { n as A, t as j } from "./svgNumber-DNxESJQB.js";
|
|
7
|
+
//#region ../core/src/rendering/svg/svgElement.js
|
|
8
|
+
var M = "http://www.w3.org/2000/svg";
|
|
9
|
+
function N(e, t) {
|
|
10
|
+
let n = document.createElementNS(M, e);
|
|
11
|
+
if (t) for (let [e, r] of Object.entries(t)) n.setAttribute(e, "" + r);
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ../core/src/rendering/svg/svgAttributes.js
|
|
16
|
+
function P(e, t) {
|
|
17
|
+
let n = Object.entries(t).filter(([t, n]) => n.encoder.constant ? (e.setAttribute(t, "" + F(n, {})), !1) : !0);
|
|
18
|
+
return (e) => Object.fromEntries(n.map(([t, n]) => [t, F(n, e)]));
|
|
19
|
+
}
|
|
20
|
+
function F(e, t) {
|
|
21
|
+
let n = e.encoder(t);
|
|
22
|
+
return e.transform ? e.transform(n) : "" + n;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../core/src/rendering/svg/renderers/arrow.js
|
|
26
|
+
function oe(e, t) {
|
|
27
|
+
let n = e, { coords: r, data: i, group: a, viewOpacity: o, visibleBounds: s } = t, c = n.encoders, l = P(a, {
|
|
28
|
+
fill: {
|
|
29
|
+
encoder: c.fill,
|
|
30
|
+
transform: k
|
|
31
|
+
},
|
|
32
|
+
"fill-opacity": {
|
|
33
|
+
encoder: c.fillOpacity,
|
|
34
|
+
transform: (e) => +e * o
|
|
35
|
+
},
|
|
36
|
+
stroke: {
|
|
37
|
+
encoder: c.stroke,
|
|
38
|
+
transform: k
|
|
39
|
+
},
|
|
40
|
+
"stroke-opacity": {
|
|
41
|
+
encoder: c.strokeOpacity,
|
|
42
|
+
transform: (e) => +e * o
|
|
43
|
+
},
|
|
44
|
+
"stroke-width": {
|
|
45
|
+
encoder: c.strokeWidth,
|
|
46
|
+
transform: (e) => j(+e)
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
a.setAttribute("stroke-linejoin", "miter");
|
|
50
|
+
let u = x(n);
|
|
51
|
+
return b(n, u, {
|
|
52
|
+
coords: r,
|
|
53
|
+
data: i,
|
|
54
|
+
visibleBounds: s,
|
|
55
|
+
viewOpacity: o,
|
|
56
|
+
countOnly: t.countOnly
|
|
57
|
+
}, (e) => {
|
|
58
|
+
t.countOnly || (e.headShapeFallback && t.warn(`SVG export rendered unsupported arrow headShape "${u.headShape}" as a triangle.`), a.appendChild(N("path", {
|
|
59
|
+
d: e.boundaryLoops.map(se).join(" "),
|
|
60
|
+
...l(e.datum)
|
|
61
|
+
})));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function se(e) {
|
|
65
|
+
return `M ${e.map(ce).join(" L ")} Z`;
|
|
66
|
+
}
|
|
67
|
+
function ce(e) {
|
|
68
|
+
return `${j(e.x)} ${j(e.y)}`;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region ../core/src/rendering/svg/renderers/link.js
|
|
72
|
+
function le(e, t) {
|
|
73
|
+
let n = e, r = n.properties, i = g(n, r.arcFadingDistance), a = D(n), { coords: o, data: s, group: c, viewOpacity: l, visibleBounds: u } = t, d = n.encoders, f = g(n, r.noFadingOnPointSelection) ? ue(n, d) : [], p = P(c, {
|
|
74
|
+
stroke: {
|
|
75
|
+
encoder: d.color,
|
|
76
|
+
transform: k
|
|
77
|
+
},
|
|
78
|
+
"stroke-opacity": {
|
|
79
|
+
encoder: d.opacity,
|
|
80
|
+
transform: (e) => +e * l
|
|
81
|
+
},
|
|
82
|
+
"stroke-width": {
|
|
83
|
+
encoder: d.size,
|
|
84
|
+
transform: (e) => j(+e)
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return c.setAttribute("fill", "none"), c.setAttribute("stroke-linecap", "butt"), w(n, a, {
|
|
88
|
+
coords: o,
|
|
89
|
+
data: s,
|
|
90
|
+
visibleBounds: u
|
|
91
|
+
}, ({ datum: e, points: n }) => {
|
|
92
|
+
let [r, o, s, l] = n;
|
|
93
|
+
if (t.countOnly) return;
|
|
94
|
+
let u = p(e);
|
|
95
|
+
if (a.shape == "arc" && i !== !1 && i[0] > 0 && i[1] > 0 && !de(e, f)) {
|
|
96
|
+
let e = t.getLinkArcFadeMaskUrl({
|
|
97
|
+
p1: r,
|
|
98
|
+
p4: l,
|
|
99
|
+
distances: i
|
|
100
|
+
});
|
|
101
|
+
e && (u.mask = e);
|
|
102
|
+
}
|
|
103
|
+
c.appendChild(N("path", {
|
|
104
|
+
d: `M ${I(r)} C ${I(o)} ${I(s)} ${I(l)}`,
|
|
105
|
+
...u
|
|
106
|
+
}));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ue(n, r) {
|
|
110
|
+
let i = new Set(Object.values(r).flatMap((e) => e.branches).map((e) => e.predicate?.param).filter((e) => e));
|
|
111
|
+
return Array.from(i).map((e) => n.unitView.paramRuntime.findValue(e)).filter((n) => n && (t(n) || e(n)));
|
|
112
|
+
}
|
|
113
|
+
function de(e, r) {
|
|
114
|
+
let i = e[n];
|
|
115
|
+
return r.some((e) => t(e) ? e.uniqueId != null && e.uniqueId == i : e.data.has(i));
|
|
116
|
+
}
|
|
117
|
+
function I(e) {
|
|
118
|
+
return e.map(j).join(" ");
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region ../core/src/rendering/svg/renderers/point.js
|
|
122
|
+
function L(e, t) {
|
|
123
|
+
let n = e;
|
|
124
|
+
g(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.");
|
|
125
|
+
let r = v(n), { inwardStroke: i } = r, { group: a, viewOpacity: o } = t, s = n.encoders, c = P(a, {
|
|
126
|
+
fill: {
|
|
127
|
+
encoder: s.fill,
|
|
128
|
+
transform: k
|
|
129
|
+
},
|
|
130
|
+
"fill-opacity": {
|
|
131
|
+
encoder: s.fillOpacity,
|
|
132
|
+
transform: (e) => +e * o
|
|
133
|
+
},
|
|
134
|
+
stroke: {
|
|
135
|
+
encoder: s.stroke,
|
|
136
|
+
transform: k
|
|
137
|
+
},
|
|
138
|
+
"stroke-opacity": {
|
|
139
|
+
encoder: s.strokeOpacity,
|
|
140
|
+
transform: (e) => +e * o
|
|
141
|
+
},
|
|
142
|
+
"stroke-width": {
|
|
143
|
+
encoder: s.strokeWidth,
|
|
144
|
+
transform: (e) => j(+e)
|
|
145
|
+
}
|
|
146
|
+
}), l = z();
|
|
147
|
+
return y(n, r, t, (e) => {
|
|
148
|
+
if (t.countOnly) return;
|
|
149
|
+
let { datum: n, shape: r, x: u, y: d, geometryRadius: f, angle: p, strokeWidth: m, lineShape: h } = e, g = {
|
|
150
|
+
...c(n),
|
|
151
|
+
...i && !h ? { "stroke-width": j(m) } : {},
|
|
152
|
+
...h ? B(s, n, o) : {}
|
|
153
|
+
}, _ = R(r, u, d, f, g, l);
|
|
154
|
+
_ ? (p && _.setAttribute("transform", `rotate(${j(p)} ${j(u)} ${j(d)})`), a.appendChild(_)) : (t.warn(`SVG export rendered unsupported point shape "${r}" as a circle.`), a.appendChild(N("circle", {
|
|
155
|
+
cx: j(u),
|
|
156
|
+
cy: j(d),
|
|
157
|
+
r: j(f),
|
|
158
|
+
...g
|
|
159
|
+
})));
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function R(e, t, n, r, i, a) {
|
|
163
|
+
let o = j(t), s = j(n), c = j(r);
|
|
164
|
+
if (e == "circle") return N("circle", {
|
|
165
|
+
cx: o,
|
|
166
|
+
cy: s,
|
|
167
|
+
r: c,
|
|
168
|
+
...i
|
|
169
|
+
});
|
|
170
|
+
if (e == "square") return N("rect", {
|
|
171
|
+
x: j(t - r),
|
|
172
|
+
y: j(n - r),
|
|
173
|
+
width: j(r * 2),
|
|
174
|
+
height: j(r * 2),
|
|
175
|
+
...i
|
|
176
|
+
});
|
|
177
|
+
let l = a.build(e, t, n, r);
|
|
178
|
+
return l ? N("path", {
|
|
179
|
+
d: l,
|
|
180
|
+
...i
|
|
181
|
+
}) : void 0;
|
|
182
|
+
}
|
|
183
|
+
function z() {
|
|
184
|
+
let e = "", t = (e, t) => `${j(e)} ${j(t)}`, n = {
|
|
185
|
+
moveTo(n, r) {
|
|
186
|
+
e += `${e ? " M" : "M"} ${t(n, r)}`;
|
|
187
|
+
},
|
|
188
|
+
lineTo(n, r) {
|
|
189
|
+
e += ` L ${t(n, r)}`;
|
|
190
|
+
},
|
|
191
|
+
closePath() {
|
|
192
|
+
e += " Z";
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
return { build(t, r, i, a) {
|
|
196
|
+
return e = "", re(t, r, i, a, n) ? e : void 0;
|
|
197
|
+
} };
|
|
198
|
+
}
|
|
199
|
+
function B(e, t, n) {
|
|
200
|
+
let r = e.stroke(t), i = m(e.strokeOpacity, t), a = r == null || i <= 0;
|
|
201
|
+
return {
|
|
202
|
+
fill: "none",
|
|
203
|
+
stroke: k(a ? e.fill(t) : r),
|
|
204
|
+
"stroke-opacity": (a ? m(e.fillOpacity, t) : i) * n,
|
|
205
|
+
"stroke-width": j(m(e.strokeWidth, t)),
|
|
206
|
+
"stroke-linecap": "butt"
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region ../core/src/rendering/svg/renderers/rect.js
|
|
211
|
+
function V(e, t) {
|
|
212
|
+
let n = e, r = _(n), { shadow: i, hatch: a } = r, { group: o, viewOpacity: s } = t, c = n.encoders, l = P(o, {
|
|
213
|
+
fill: {
|
|
214
|
+
encoder: c.fill,
|
|
215
|
+
transform: k
|
|
216
|
+
},
|
|
217
|
+
"fill-opacity": {
|
|
218
|
+
encoder: c.fillOpacity,
|
|
219
|
+
transform: (e) => +e * s
|
|
220
|
+
},
|
|
221
|
+
stroke: {
|
|
222
|
+
encoder: c.stroke,
|
|
223
|
+
transform: k
|
|
224
|
+
},
|
|
225
|
+
"stroke-opacity": {
|
|
226
|
+
encoder: c.strokeOpacity,
|
|
227
|
+
transform: (e) => +e * s
|
|
228
|
+
},
|
|
229
|
+
"stroke-width": {
|
|
230
|
+
encoder: c.strokeWidth,
|
|
231
|
+
transform: (e) => j(+e)
|
|
232
|
+
}
|
|
233
|
+
}), u = i.opacity > 0 ? {
|
|
234
|
+
fill: i.color,
|
|
235
|
+
"fill-opacity": 1,
|
|
236
|
+
stroke: i.color,
|
|
237
|
+
"stroke-opacity": 1,
|
|
238
|
+
opacity: A(i.opacity * s),
|
|
239
|
+
filter: t.getShadowFilterUrl(i)
|
|
240
|
+
} : null;
|
|
241
|
+
return C(n, r, t, (e) => {
|
|
242
|
+
if (t.countOnly) return;
|
|
243
|
+
let { datum: n, x: r, y: i, width: d, height: f, radii: p, opacityFactor: h, strokeWidth: g, fill: _, fillOpacity: v } = e, y = {
|
|
244
|
+
...l(n),
|
|
245
|
+
...h == 1 ? {} : { opacity: A(h) }
|
|
246
|
+
};
|
|
247
|
+
if (a != "none" && g > 0 && (y.fill = t.getRectHatchPatternUrl({
|
|
248
|
+
type: a,
|
|
249
|
+
fill: k(c.fill(n)),
|
|
250
|
+
fillOpacity: m(c.fillOpacity, n) * s,
|
|
251
|
+
stroke: k(c.stroke(n)),
|
|
252
|
+
strokeOpacity: m(c.strokeOpacity, n) * s,
|
|
253
|
+
strokeWidth: g
|
|
254
|
+
}), y["fill-opacity"] = 1), u) {
|
|
255
|
+
let e = H(r, i, d, f, p, {
|
|
256
|
+
...u,
|
|
257
|
+
"stroke-width": j(g)
|
|
258
|
+
});
|
|
259
|
+
if (a == "none" && _ != "none" && v == 1 && h == 1) o.appendChild(e);
|
|
260
|
+
else {
|
|
261
|
+
let n = g / 2, a = Object.fromEntries(Object.entries(p).map(([e, t]) => [e, t + n])), s = U(r - n, i - n, d + n * 2, f + n * 2, a), c = N("g", { "clip-path": t.getShadowClipPathUrl(s) });
|
|
262
|
+
c.appendChild(e), o.appendChild(c);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
o.appendChild(H(r, i, d, f, p, y));
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function H(e, t, n, r, i, a) {
|
|
269
|
+
if (fe(i)) {
|
|
270
|
+
let o = i.topLeft, s = j(e), c = j(t), l = j(e + n), u = j(t + r);
|
|
271
|
+
return N("rect", {
|
|
272
|
+
x: s,
|
|
273
|
+
y: c,
|
|
274
|
+
width: j(l - s),
|
|
275
|
+
height: j(u - c),
|
|
276
|
+
...o ? {
|
|
277
|
+
rx: j(o),
|
|
278
|
+
ry: j(o)
|
|
279
|
+
} : {},
|
|
280
|
+
...a
|
|
281
|
+
});
|
|
282
|
+
} else return N("path", {
|
|
283
|
+
d: U(e, t, n, r, i),
|
|
284
|
+
...a
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function fe(e) {
|
|
288
|
+
return Object.values(e).every((t) => t == e.topLeft);
|
|
289
|
+
}
|
|
290
|
+
function U(e, t, n, r, i) {
|
|
291
|
+
let a = e + n, o = t + r, { topLeft: s, topRight: c, bottomRight: l, bottomLeft: u } = i;
|
|
292
|
+
return [
|
|
293
|
+
`M ${G(e + s, t)}`,
|
|
294
|
+
`H ${j(a - c)}`,
|
|
295
|
+
W(c, a, t + c, a, t),
|
|
296
|
+
`V ${j(o - l)}`,
|
|
297
|
+
W(l, a - l, o, a, o),
|
|
298
|
+
`H ${j(e + u)}`,
|
|
299
|
+
W(u, e, o - u, e, o),
|
|
300
|
+
`V ${j(t + s)}`,
|
|
301
|
+
W(s, e + s, t, e, t),
|
|
302
|
+
"Z"
|
|
303
|
+
].join(" ");
|
|
304
|
+
}
|
|
305
|
+
function W(e, t, n, r, i) {
|
|
306
|
+
return e ? `A ${j(e)} ${j(e)} 0 0 1 ${G(t, n)}` : `L ${G(r, i)}`;
|
|
307
|
+
}
|
|
308
|
+
function G(e, t) {
|
|
309
|
+
return `${j(e)} ${j(t)}`;
|
|
310
|
+
}
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region ../core/src/rendering/svg/renderers/rule.js
|
|
313
|
+
function K(e, t) {
|
|
314
|
+
let n = e, r = E(n), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, l = n.encoders, u = n.properties.strokeDash, d = P(o, {
|
|
315
|
+
stroke: {
|
|
316
|
+
encoder: l.color,
|
|
317
|
+
transform: k
|
|
318
|
+
},
|
|
319
|
+
"stroke-opacity": {
|
|
320
|
+
encoder: l.opacity,
|
|
321
|
+
transform: (e) => +e * s
|
|
322
|
+
},
|
|
323
|
+
"stroke-width": {
|
|
324
|
+
encoder: l.size,
|
|
325
|
+
transform: (e) => j(+e)
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
return o.setAttribute("stroke-linecap", "" + n.properties.strokeCap), u && (o.setAttribute("stroke-dasharray", u.map(j).join(" ")), o.setAttribute("stroke-dashoffset", "" + j(n.properties.strokeDashOffset))), te(n, r, {
|
|
329
|
+
coords: i,
|
|
330
|
+
data: a,
|
|
331
|
+
visibleBounds: c
|
|
332
|
+
}, (e) => {
|
|
333
|
+
t.countOnly || o.appendChild(N("line", {
|
|
334
|
+
x1: j(e.x1),
|
|
335
|
+
y1: j(e.y1),
|
|
336
|
+
x2: j(e.x2),
|
|
337
|
+
y2: j(e.y2),
|
|
338
|
+
...d(e.datum)
|
|
339
|
+
}));
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region ../core/src/rendering/svg/renderers/text.js
|
|
344
|
+
function pe(e, t) {
|
|
345
|
+
let n = e, r = n.properties, i = S(n), { coords: a, data: o, group: s, viewOpacity: c, visibleBounds: l, anchorCullBounds: u } = t, d = n.encoders, f = P(s, {
|
|
346
|
+
fill: {
|
|
347
|
+
encoder: d.color,
|
|
348
|
+
transform: k
|
|
349
|
+
},
|
|
350
|
+
"fill-opacity": {
|
|
351
|
+
encoder: d.opacity,
|
|
352
|
+
transform: (e) => +e * c
|
|
353
|
+
},
|
|
354
|
+
"font-size": {
|
|
355
|
+
encoder: d.size,
|
|
356
|
+
transform: (e) => j(+e)
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
s.setAttribute("font-family", ne(r.font)), s.setAttribute("font-style", r.fontStyle ?? "normal"), s.setAttribute("font-weight", "" + ee(r.fontWeight ?? "normal")), s.setAttribute("text-anchor", me[i.align]);
|
|
360
|
+
let p = {
|
|
361
|
+
top: {
|
|
362
|
+
width: g(n, r.viewportEdgeFadeWidthTop),
|
|
363
|
+
distance: g(n, r.viewportEdgeFadeDistanceTop)
|
|
364
|
+
},
|
|
365
|
+
right: {
|
|
366
|
+
width: g(n, r.viewportEdgeFadeWidthRight),
|
|
367
|
+
distance: g(n, r.viewportEdgeFadeDistanceRight)
|
|
368
|
+
},
|
|
369
|
+
bottom: {
|
|
370
|
+
width: g(n, r.viewportEdgeFadeWidthBottom),
|
|
371
|
+
distance: g(n, r.viewportEdgeFadeDistanceBottom)
|
|
372
|
+
},
|
|
373
|
+
left: {
|
|
374
|
+
width: g(n, r.viewportEdgeFadeWidthLeft),
|
|
375
|
+
distance: g(n, r.viewportEdgeFadeDistanceLeft)
|
|
376
|
+
}
|
|
377
|
+
}, m = h(n, i, {
|
|
378
|
+
coords: a,
|
|
379
|
+
data: o,
|
|
380
|
+
visibleBounds: l,
|
|
381
|
+
anchorCullBounds: u
|
|
382
|
+
}, (e) => {
|
|
383
|
+
if (t.countOnly) return;
|
|
384
|
+
if (e.logoScale) {
|
|
385
|
+
e.multiCharacterLogo && t.warn("SVG export stretches multi-character logo text as a single glyph cell.");
|
|
386
|
+
let n = [`translate(${j(e.x)} ${j(e.y)})`];
|
|
387
|
+
e.angle && n.push(`rotate(${j(e.angle)})`), (e.dx || e.dy) && n.push(`translate(${j(e.dx)} ${j(e.dy)})`), n.push(`scale(${j(e.logoScale.width)} ${j(e.logoScale.heightScale)})`);
|
|
388
|
+
let r = N("text", {
|
|
389
|
+
x: 0,
|
|
390
|
+
y: 0,
|
|
391
|
+
dy: T("middle", 1),
|
|
392
|
+
"text-anchor": "middle",
|
|
393
|
+
lengthAdjust: "spacingAndGlyphs",
|
|
394
|
+
textLength: 1,
|
|
395
|
+
transform: n.join(" "),
|
|
396
|
+
...f(e.datum),
|
|
397
|
+
"font-size": 1
|
|
398
|
+
});
|
|
399
|
+
r.textContent = e.text, s.appendChild(r);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
let n = j(e.x), r = j(e.y), a = N("text", {
|
|
403
|
+
x: n,
|
|
404
|
+
y: r,
|
|
405
|
+
dx: j(e.dx),
|
|
406
|
+
dy: j(e.dy + T(i.baseline, e.size)),
|
|
407
|
+
lengthAdjust: "spacingAndGlyphs",
|
|
408
|
+
textLength: j(e.width),
|
|
409
|
+
...f(e.datum),
|
|
410
|
+
...e.scale == 1 ? {} : { "font-size": j(e.size) },
|
|
411
|
+
...e.fadeOpacity == 1 ? {} : { opacity: A(e.fadeOpacity) }
|
|
412
|
+
});
|
|
413
|
+
a.textContent = e.text, e.angle && a.setAttribute("transform", `rotate(${j(e.angle)} ${n} ${r})`), s.appendChild(a);
|
|
414
|
+
});
|
|
415
|
+
if (!t.countOnly && s.childElementCount > 0) {
|
|
416
|
+
let e = t.getViewportEdgeFadeMaskUrl(p);
|
|
417
|
+
e && s.setAttribute("mask", e);
|
|
418
|
+
}
|
|
419
|
+
return m;
|
|
420
|
+
}
|
|
421
|
+
var me = {
|
|
422
|
+
left: "start",
|
|
423
|
+
center: "middle",
|
|
424
|
+
right: "end"
|
|
425
|
+
}, q = 64;
|
|
426
|
+
function he(e, t) {
|
|
427
|
+
let n = _e(e.unitView);
|
|
428
|
+
if (!n) return;
|
|
429
|
+
let r = e.unitView.getScaleResolution(n.channel)?.getScale();
|
|
430
|
+
if (!r || !a(r.type)) return;
|
|
431
|
+
let { coords: i, data: o, group: s, viewOpacity: c, visibleBounds: l } = t;
|
|
432
|
+
if (!o.length) return 0;
|
|
433
|
+
let u = e.encoders, d = n.channel == "stroke" ? u.stroke : u.fill, f = ve(e.unitView.spec.encoding.x), m = Infinity, h = Infinity, g = -Infinity, _ = -Infinity, v = o.map((e) => {
|
|
434
|
+
let [t, n] = ie(i, u, e), [r, a] = ae(i, u, e);
|
|
435
|
+
return m = Math.min(m, t, n), h = Math.min(h, r, a), g = Math.max(g, t, n), _ = Math.max(_, r, a), {
|
|
436
|
+
offset: Number(e.position),
|
|
437
|
+
color: k(d(e))
|
|
438
|
+
};
|
|
439
|
+
}).sort((e, t) => e.offset - t.offset);
|
|
440
|
+
if (!p(l, m, h, g, _)) return 0;
|
|
441
|
+
if (t.countOnly) return o.length;
|
|
442
|
+
let y = ge(v), b = [
|
|
443
|
+
{
|
|
444
|
+
offset: 0,
|
|
445
|
+
color: y[0].color
|
|
446
|
+
},
|
|
447
|
+
...y,
|
|
448
|
+
{
|
|
449
|
+
offset: 1,
|
|
450
|
+
color: y.at(-1).color
|
|
451
|
+
}
|
|
452
|
+
], x = t.getLegendGradientUrl({
|
|
453
|
+
x1: m,
|
|
454
|
+
y1: f ? h : _,
|
|
455
|
+
x2: f ? g : m,
|
|
456
|
+
y2: h,
|
|
457
|
+
stops: b
|
|
458
|
+
}), S = j(m), C = j(h), w = j(g), T = j(_), E = Number(u.fillOpacity(o[0])) * c;
|
|
459
|
+
return s.appendChild(N("rect", {
|
|
460
|
+
x: S,
|
|
461
|
+
y: C,
|
|
462
|
+
width: j(w - S),
|
|
463
|
+
height: j(T - C),
|
|
464
|
+
fill: x,
|
|
465
|
+
"fill-opacity": A(E),
|
|
466
|
+
stroke: "none"
|
|
467
|
+
})), o.length;
|
|
468
|
+
}
|
|
469
|
+
function ge(e) {
|
|
470
|
+
return e.length <= q ? e : Array.from({ length: q }, (t, n) => e[Math.round(n * (e.length - 1) / (q - 1))]);
|
|
471
|
+
}
|
|
472
|
+
function _e(e) {
|
|
473
|
+
let t = e;
|
|
474
|
+
for (; t;) {
|
|
475
|
+
let e = t.spec.data;
|
|
476
|
+
if (e) return "lazy" in e && e.lazy.type == "legendGradient" ? e.lazy : void 0;
|
|
477
|
+
t = t.dataParent;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
function ve(e) {
|
|
481
|
+
return e != null && "field" in e && (e.field == "position0" || e.field == "position1");
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region ../core/src/rendering/svg/renderers/index.js
|
|
485
|
+
var ye = /* @__PURE__ */ new Map([
|
|
486
|
+
["arrow", oe],
|
|
487
|
+
["link", le],
|
|
488
|
+
["point", L],
|
|
489
|
+
["rect", V],
|
|
490
|
+
["rule", K],
|
|
491
|
+
["text", pe],
|
|
492
|
+
["tick", K]
|
|
493
|
+
]);
|
|
494
|
+
function be(e, t) {
|
|
495
|
+
if (e.getType() == "rect") {
|
|
496
|
+
let n = he(e, t);
|
|
497
|
+
if (n !== void 0) return n;
|
|
498
|
+
}
|
|
499
|
+
let n = ye.get(e.getType());
|
|
500
|
+
if (!n) throw Error(`SVG rendering is not implemented for mark type "${e.getType()}". View: ${e.unitView.getPathString()}`);
|
|
501
|
+
return n(e, t);
|
|
502
|
+
}
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region ../core/src/rendering/svg/rectHatchPattern.js
|
|
505
|
+
function xe(e, t) {
|
|
506
|
+
let n = t.strokeWidth, r = [
|
|
507
|
+
"dots",
|
|
508
|
+
"rings",
|
|
509
|
+
"ringsLarge"
|
|
510
|
+
].includes(t.type), i = [
|
|
511
|
+
"diagonal",
|
|
512
|
+
"antiDiagonal",
|
|
513
|
+
"cross"
|
|
514
|
+
].includes(t.type), a = [
|
|
515
|
+
"vertical",
|
|
516
|
+
"horizontal",
|
|
517
|
+
"grid"
|
|
518
|
+
].includes(t.type), o = r ? n * 7 : n * (i ? 6 : 4), s = a ? n * 2 : n, c = o, l = r ? o * 2 : o, u = N("pattern", {
|
|
519
|
+
id: e,
|
|
520
|
+
x: 0,
|
|
521
|
+
y: 0,
|
|
522
|
+
width: j(c),
|
|
523
|
+
height: j(l),
|
|
524
|
+
patternUnits: "userSpaceOnUse"
|
|
525
|
+
});
|
|
526
|
+
u.appendChild(N("rect", {
|
|
527
|
+
width: j(c),
|
|
528
|
+
height: j(l),
|
|
529
|
+
fill: t.fill,
|
|
530
|
+
"fill-opacity": A(t.fillOpacity)
|
|
531
|
+
}));
|
|
532
|
+
let d = N("g", {
|
|
533
|
+
fill: "none",
|
|
534
|
+
stroke: t.stroke,
|
|
535
|
+
"stroke-opacity": A(t.strokeOpacity),
|
|
536
|
+
"stroke-width": j(s),
|
|
537
|
+
"stroke-linecap": "square"
|
|
538
|
+
});
|
|
539
|
+
return Se(d, t.type, o, s), u.appendChild(d), u;
|
|
540
|
+
}
|
|
541
|
+
function Se(e, t, n, r) {
|
|
542
|
+
let i = (t) => e.appendChild(N("path", { d: t })), a = (e) => j(e), o = (e) => {
|
|
543
|
+
for (let t of [
|
|
544
|
+
-n,
|
|
545
|
+
0,
|
|
546
|
+
n
|
|
547
|
+
]) i(`M ${a(t - r)} ${a(e ? -r : n + r)} L ${a(t + n + r)} ${a(e ? n + r : -r)}`);
|
|
548
|
+
};
|
|
549
|
+
switch (t) {
|
|
550
|
+
case "diagonal":
|
|
551
|
+
o(!0);
|
|
552
|
+
break;
|
|
553
|
+
case "antiDiagonal":
|
|
554
|
+
o(!1);
|
|
555
|
+
break;
|
|
556
|
+
case "cross":
|
|
557
|
+
o(!0), o(!1);
|
|
558
|
+
break;
|
|
559
|
+
case "vertical":
|
|
560
|
+
i(`M 0 ${a(-r)} V ${a(n + r)}`);
|
|
561
|
+
break;
|
|
562
|
+
case "horizontal":
|
|
563
|
+
i(`M ${a(-r)} 0 H ${a(n + r)}`);
|
|
564
|
+
break;
|
|
565
|
+
case "grid":
|
|
566
|
+
i(`M 0 ${a(-r)} V ${a(n + r)} M ${a(-r)} 0 H ${a(n + r)}`);
|
|
567
|
+
break;
|
|
568
|
+
case "dots":
|
|
569
|
+
case "rings":
|
|
570
|
+
case "ringsLarge": {
|
|
571
|
+
let r = n * (t == "dots" ? .07 : t == "rings" ? .2 : .35), i = (t, n) => e.appendChild(N("circle", {
|
|
572
|
+
cx: j(t),
|
|
573
|
+
cy: j(n),
|
|
574
|
+
r: j(r)
|
|
575
|
+
}));
|
|
576
|
+
i(n / 2, 0), i(n / 2, n * 2), i(0, n), i(n, n);
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
default: throw Error(`Unknown rectangle hatch pattern: ${t}`);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region ../core/src/rendering/svg/linkArcFadeMask.js
|
|
584
|
+
var J = 4;
|
|
585
|
+
function Ce(e, t, n) {
|
|
586
|
+
let r = t[0] - e[0], i = t[1] - e[1], a = Math.hypot(r, i);
|
|
587
|
+
if (a == 0) return;
|
|
588
|
+
let o = -i / a, s = r / a;
|
|
589
|
+
(o < 0 || o == 0 && s < 0) && (o = -o, s = -s);
|
|
590
|
+
let c = o * e[0] + s * e[1], [l, u] = n, d = JSON.stringify([
|
|
591
|
+
Y(o, 6),
|
|
592
|
+
Y(s, 6),
|
|
593
|
+
Y(c, 1),
|
|
594
|
+
Y(l, 1),
|
|
595
|
+
Y(u, 1)
|
|
596
|
+
]);
|
|
597
|
+
return {
|
|
598
|
+
normalX: o,
|
|
599
|
+
normalY: s,
|
|
600
|
+
offset: c,
|
|
601
|
+
start: l,
|
|
602
|
+
end: u,
|
|
603
|
+
key: d
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function we(e, t, n, r) {
|
|
607
|
+
let { normalX: i, normalY: a, offset: o, start: s, end: c } = r, l = i * o, u = a * o, d = e + "-gradient", f = N("linearGradient", {
|
|
608
|
+
id: d,
|
|
609
|
+
gradientUnits: "userSpaceOnUse",
|
|
610
|
+
x1: j(l - i * c),
|
|
611
|
+
y1: j(u - a * c),
|
|
612
|
+
x2: j(l + i * c),
|
|
613
|
+
y2: j(u + a * c),
|
|
614
|
+
spreadMethod: "pad"
|
|
615
|
+
});
|
|
616
|
+
for (let { offset: e, opacity: t } of Te(s, c)) f.appendChild(N("stop", {
|
|
617
|
+
offset: Y(e, 3),
|
|
618
|
+
"stop-color": "white",
|
|
619
|
+
"stop-opacity": Y(t, 3)
|
|
620
|
+
}));
|
|
621
|
+
let p = N("mask", {
|
|
622
|
+
id: e,
|
|
623
|
+
x: 0,
|
|
624
|
+
y: 0,
|
|
625
|
+
width: j(t),
|
|
626
|
+
height: j(n),
|
|
627
|
+
maskUnits: "userSpaceOnUse",
|
|
628
|
+
maskContentUnits: "userSpaceOnUse",
|
|
629
|
+
"mask-type": "luminance"
|
|
630
|
+
});
|
|
631
|
+
return p.appendChild(N("rect", {
|
|
632
|
+
width: j(t),
|
|
633
|
+
height: j(n),
|
|
634
|
+
fill: `url(#${d})`
|
|
635
|
+
})), {
|
|
636
|
+
gradient: f,
|
|
637
|
+
mask: p
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function Te(e, t) {
|
|
641
|
+
let n = [], r = (r) => {
|
|
642
|
+
for (let i = 0; i <= J; i++) {
|
|
643
|
+
let a = i / J, o = r ? t + (e - t) * a : e + (t - e) * a, s = r ? (t - o) / (2 * t) : (t + o) / (2 * t), c = (o - e) / (t - e);
|
|
644
|
+
n.push({
|
|
645
|
+
offset: s,
|
|
646
|
+
opacity: 1 - Ee(c)
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
return r(!0), r(!1), n;
|
|
651
|
+
}
|
|
652
|
+
function Ee(e) {
|
|
653
|
+
let t = Math.max(0, Math.min(1, e));
|
|
654
|
+
return t * t * (3 - 2 * t);
|
|
655
|
+
}
|
|
656
|
+
function Y(e, t) {
|
|
657
|
+
let n = 10 ** t;
|
|
658
|
+
return Math.round(e * n) / n;
|
|
659
|
+
}
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region ../core/src/rendering/svg/svgViewRenderingContext.js
|
|
662
|
+
var X = class extends l {
|
|
663
|
+
#e;
|
|
664
|
+
#t;
|
|
665
|
+
#n = [];
|
|
666
|
+
#r = /* @__PURE__ */ new Map();
|
|
667
|
+
#i = /* @__PURE__ */ new WeakMap();
|
|
668
|
+
#a = /* @__PURE__ */ new Map();
|
|
669
|
+
#o = /* @__PURE__ */ new Map();
|
|
670
|
+
#s = /* @__PURE__ */ new Map();
|
|
671
|
+
#c = /* @__PURE__ */ new Map();
|
|
672
|
+
#l = /* @__PURE__ */ new Set();
|
|
673
|
+
#u = !1;
|
|
674
|
+
#d = /* @__PURE__ */ new Map();
|
|
675
|
+
#f = N("g");
|
|
676
|
+
#p;
|
|
677
|
+
#m;
|
|
678
|
+
#h = [];
|
|
679
|
+
#g;
|
|
680
|
+
#_ = 0;
|
|
681
|
+
#v = 0;
|
|
682
|
+
#y = 0;
|
|
683
|
+
#b = 0;
|
|
684
|
+
#x = 0;
|
|
685
|
+
#S = 0;
|
|
686
|
+
#C = 0;
|
|
687
|
+
constructor(e, t) {
|
|
688
|
+
super(e), this.width = t.width, this.height = t.height, this.#m = t.maxVectorInstances;
|
|
689
|
+
let n = j(t.width), r = j(t.height);
|
|
690
|
+
this.#e = N("svg", {
|
|
691
|
+
xmlns: M,
|
|
692
|
+
width: n,
|
|
693
|
+
height: r,
|
|
694
|
+
viewBox: `0 0 ${n} ${r}`
|
|
695
|
+
}), this.#t = N("defs"), this.#e.appendChild(this.#t), t.background != null && this.#e.appendChild(N("rect", {
|
|
696
|
+
width: n,
|
|
697
|
+
height: r,
|
|
698
|
+
fill: t.background,
|
|
699
|
+
"data-export-background": ""
|
|
700
|
+
}));
|
|
701
|
+
}
|
|
702
|
+
beginInstanceCounting() {
|
|
703
|
+
if (this.#n.length || this.#u) throw Error("Cannot start SVG instance counting during traversal.");
|
|
704
|
+
this.#d = /* @__PURE__ */ new Map(), this.#u = !0;
|
|
705
|
+
}
|
|
706
|
+
endInstanceCounting() {
|
|
707
|
+
if (this.#n.length || !this.#u) throw Error("SVG instance counting is not active or traversal is incomplete.");
|
|
708
|
+
this.#u = !1;
|
|
709
|
+
}
|
|
710
|
+
getVisibleInstanceCount(e) {
|
|
711
|
+
return this.#d.get(e) ?? 0;
|
|
712
|
+
}
|
|
713
|
+
getVisibleInstanceCounts() {
|
|
714
|
+
return new Map(this.#d);
|
|
715
|
+
}
|
|
716
|
+
getRasterRuns() {
|
|
717
|
+
this.#T();
|
|
718
|
+
for (let e of this.#h) e.image || this.#E(e);
|
|
719
|
+
return this.#h;
|
|
720
|
+
}
|
|
721
|
+
beginSampleFacetBatch() {
|
|
722
|
+
if (this.#p) throw Error("Nested sample facet batches are not supported.");
|
|
723
|
+
this.#p = {
|
|
724
|
+
viewGroups: /* @__PURE__ */ new WeakMap(),
|
|
725
|
+
markGroups: /* @__PURE__ */ new WeakMap(),
|
|
726
|
+
markGroupElements: /* @__PURE__ */ new Set(),
|
|
727
|
+
rasterRuns: /* @__PURE__ */ new WeakMap()
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
endSampleFacetBatch() {
|
|
731
|
+
let e = this.#p;
|
|
732
|
+
if (!e) throw Error("No sample facet batch is active.");
|
|
733
|
+
for (let t of e.markGroupElements) t.childElementCount || t.remove();
|
|
734
|
+
this.#p = void 0;
|
|
735
|
+
}
|
|
736
|
+
pushView(e, t) {
|
|
737
|
+
let n = e.getPathString();
|
|
738
|
+
if (r(this.#n)?.exportExcluded || i(e) && e.name.startsWith("scrollbar-")) {
|
|
739
|
+
this.#n.push({
|
|
740
|
+
view: e,
|
|
741
|
+
node: this.currentNode,
|
|
742
|
+
coords: t,
|
|
743
|
+
exportExcluded: !0
|
|
744
|
+
});
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
if (this.#u) {
|
|
748
|
+
this.#n.push({
|
|
749
|
+
view: e,
|
|
750
|
+
node: this.currentNode,
|
|
751
|
+
coords: t,
|
|
752
|
+
exportExcluded: !1
|
|
753
|
+
});
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
let a = this.#p, o = a?.viewGroups.get(e);
|
|
757
|
+
if (o) {
|
|
758
|
+
if (o.parentNode !== this.currentNode) throw Error(`Sample-faceted view was rendered under multiple parents: ${n}`);
|
|
759
|
+
} else {
|
|
760
|
+
o = N("g", {
|
|
761
|
+
id: De(e.name, this.#_++),
|
|
762
|
+
"data-name": e.name,
|
|
763
|
+
"data-view-path": n
|
|
764
|
+
});
|
|
765
|
+
let t = N("title");
|
|
766
|
+
t.textContent = n, o.appendChild(t), this.currentNode.appendChild(o), a?.viewGroups.set(e, o);
|
|
767
|
+
}
|
|
768
|
+
this.#n.push({
|
|
769
|
+
view: e,
|
|
770
|
+
node: o,
|
|
771
|
+
coords: t,
|
|
772
|
+
exportExcluded: !1
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
popView(e) {
|
|
776
|
+
if (this.#n.pop()?.view !== e) throw Error("Unbalanced SVG view rendering context stack.");
|
|
777
|
+
}
|
|
778
|
+
renderMark(e, t) {
|
|
779
|
+
if (r(this.#n)?.exportExcluded || e.unitView.getEffectiveOpacity() <= 0) return;
|
|
780
|
+
let n = o(t), i = s(n, e.properties.clip, this.currentCoords), a = u(this.width, this.height, i);
|
|
781
|
+
if (!O(a)) return;
|
|
782
|
+
let c = this.getVisibleInstanceCount(e);
|
|
783
|
+
if (!this.#u && this.#m != null && c == 0) return;
|
|
784
|
+
if (!this.#u && this.#m != null && c > this.#m) {
|
|
785
|
+
this.#w(e, a);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
let l = !this.#u && this.#p != null, p = l ? this.getClipPathUrl(i) : void 0, m = l ? this.#p.markGroups.get(e)?.get(p ?? "") : void 0;
|
|
789
|
+
!this.#u && !m && this.#T();
|
|
790
|
+
let h = this.#u ? this.#f : this.#D(e, p), g = f(this.currentCoords, n, e.properties.cullByVisibleRange);
|
|
791
|
+
if (d(e, t, this.currentCoords, (t, n) => {
|
|
792
|
+
let r = be(e, {
|
|
793
|
+
coords: t,
|
|
794
|
+
data: n,
|
|
795
|
+
group: h,
|
|
796
|
+
visibleBounds: a,
|
|
797
|
+
anchorCullBounds: g,
|
|
798
|
+
viewOpacity: e.unitView.getEffectiveOpacity(),
|
|
799
|
+
countOnly: this.#u,
|
|
800
|
+
getViewportEdgeFadeMaskUrl: (e) => this.#u ? void 0 : this.getViewportEdgeFadeMaskUrl(e),
|
|
801
|
+
getShadowFilterUrl: (e) => this.#u ? "" : this.getShadowFilterUrl(e),
|
|
802
|
+
getShadowClipPathUrl: (e) => this.#u ? "" : this.getShadowClipPathUrl(e),
|
|
803
|
+
getRectHatchPatternUrl: (e) => this.#u ? "" : this.getRectHatchPatternUrl(e),
|
|
804
|
+
getLinkArcFadeMaskUrl: (e) => this.#u ? void 0 : this.getLinkArcFadeMaskUrl(e),
|
|
805
|
+
getLegendGradientUrl: (e) => this.#u ? "" : this.getLegendGradientUrl(e),
|
|
806
|
+
warn: (t) => {
|
|
807
|
+
this.#u || this.#l.add(`${t} View: ${e.unitView.getPathString()}`);
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
this.#u && this.#d.set(e, this.getVisibleInstanceCount(e) + r);
|
|
811
|
+
}, (t) => this.#l.add(`SVG export could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`)), !this.#u && !l && h.childElementCount > 0) {
|
|
812
|
+
let e = this.getClipPathUrl(i);
|
|
813
|
+
e && h.setAttribute("clip-path", e), this.currentNode.appendChild(h);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
#w(e, t) {
|
|
817
|
+
let n = this.#p?.rasterRuns.get(e);
|
|
818
|
+
if (n) {
|
|
819
|
+
Z(n.bounds, t), n.viewNodes.add(this.currentNode);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
let r = this.#g;
|
|
823
|
+
if (r) Z(r.bounds, t);
|
|
824
|
+
else {
|
|
825
|
+
let e = document.createComment("raster-run");
|
|
826
|
+
this.currentNode.appendChild(e), r = {
|
|
827
|
+
marks: /* @__PURE__ */ new Set(),
|
|
828
|
+
targets: [],
|
|
829
|
+
viewNodes: /* @__PURE__ */ new Set(),
|
|
830
|
+
anchor: e,
|
|
831
|
+
bounds: { ...t },
|
|
832
|
+
image: void 0
|
|
833
|
+
}, this.#g = r;
|
|
834
|
+
}
|
|
835
|
+
r.marks.add(e), r.targets.push({
|
|
836
|
+
mark: e,
|
|
837
|
+
instanceCount: this.getVisibleInstanceCount(e)
|
|
838
|
+
}), r.viewNodes.add(this.currentNode), this.#p?.rasterRuns.set(e, r);
|
|
839
|
+
}
|
|
840
|
+
#T() {
|
|
841
|
+
let e = this.#g;
|
|
842
|
+
e && (this.#h.push(e), this.#g = void 0);
|
|
843
|
+
}
|
|
844
|
+
#E(e) {
|
|
845
|
+
let t = Oe(e.viewNodes), n = e.targets.map((e) => e.mark.getType()), r = N("g", {
|
|
846
|
+
id: `rasterized-${n.join("-")}-${this.#C++}`,
|
|
847
|
+
"data-name": `Rasterized ${n.join(", ")}`,
|
|
848
|
+
"data-rasterized": ""
|
|
849
|
+
}), i = N("image", { preserveAspectRatio: "none" });
|
|
850
|
+
r.appendChild(i);
|
|
851
|
+
let a = e.anchor.parentNode;
|
|
852
|
+
t == a ? t.insertBefore(r, e.anchor) : t.insertBefore(r, ke(a, t)), e.anchor.remove();
|
|
853
|
+
for (let n of e.viewNodes) Ae(n, t);
|
|
854
|
+
e.image = i;
|
|
855
|
+
}
|
|
856
|
+
#D(e, t) {
|
|
857
|
+
let n = this.#p;
|
|
858
|
+
if (!n) return N("g", { "data-mark-type": e.getType() });
|
|
859
|
+
let r = n.markGroups.get(e);
|
|
860
|
+
r || (r = /* @__PURE__ */ new Map(), n.markGroups.set(e, r));
|
|
861
|
+
let i = t ?? "", a = r.get(i);
|
|
862
|
+
if (a) {
|
|
863
|
+
if (a.parentNode !== this.currentNode) throw Error(`Sample-faceted mark was rendered under multiple parents: ${e.unitView.getPathString()}`);
|
|
864
|
+
} else a = N("g", { "data-mark-type": e.getType() }), t && a.setAttribute("clip-path", t), this.currentNode.appendChild(a), r.set(i, a), n.markGroupElements.add(a);
|
|
865
|
+
return a;
|
|
866
|
+
}
|
|
867
|
+
getClipPathUrl(e) {
|
|
868
|
+
if (!e) return;
|
|
869
|
+
let t = e.rect.flatten(), n = [
|
|
870
|
+
e.clipX ? t.x : 0,
|
|
871
|
+
e.clipY ? t.y : 0,
|
|
872
|
+
e.clipX ? t.width : this.width,
|
|
873
|
+
e.clipY ? t.height : this.height
|
|
874
|
+
].map(j), r = n.join(","), i = this.#r.get(r);
|
|
875
|
+
if (!i) {
|
|
876
|
+
i = "clip-" + this.#v++;
|
|
877
|
+
let e = N("clipPath", {
|
|
878
|
+
id: i,
|
|
879
|
+
clipPathUnits: "userSpaceOnUse"
|
|
880
|
+
});
|
|
881
|
+
e.appendChild(N("rect", {
|
|
882
|
+
x: n[0],
|
|
883
|
+
y: n[1],
|
|
884
|
+
width: n[2],
|
|
885
|
+
height: n[3]
|
|
886
|
+
})), this.#t.appendChild(e), this.#r.set(r, i);
|
|
887
|
+
}
|
|
888
|
+
return `url(#${i})`;
|
|
889
|
+
}
|
|
890
|
+
getShadowFilterUrl(e) {
|
|
891
|
+
let t = j(Math.max(e.blur / 2.5, .25)), n = j(e.offsetX), r = j(e.offsetY), i = [
|
|
892
|
+
t,
|
|
893
|
+
n,
|
|
894
|
+
r
|
|
895
|
+
].join(","), a = this.#a.get(i);
|
|
896
|
+
if (!a) {
|
|
897
|
+
a = "shadow-" + this.#b++;
|
|
898
|
+
let e = N("filter", {
|
|
899
|
+
id: a,
|
|
900
|
+
x: 0,
|
|
901
|
+
y: 0,
|
|
902
|
+
width: j(this.width),
|
|
903
|
+
height: j(this.height),
|
|
904
|
+
filterUnits: "userSpaceOnUse",
|
|
905
|
+
primitiveUnits: "userSpaceOnUse",
|
|
906
|
+
"color-interpolation-filters": "sRGB"
|
|
907
|
+
});
|
|
908
|
+
e.appendChild(N("feGaussianBlur", {
|
|
909
|
+
in: "SourceGraphic",
|
|
910
|
+
stdDeviation: t,
|
|
911
|
+
result: "blur"
|
|
912
|
+
})), e.appendChild(N("feOffset", {
|
|
913
|
+
in: "blur",
|
|
914
|
+
dx: n,
|
|
915
|
+
dy: r,
|
|
916
|
+
result: "offsetBlur"
|
|
917
|
+
})), this.#t.appendChild(e), this.#a.set(i, a);
|
|
918
|
+
}
|
|
919
|
+
return `url(#${a})`;
|
|
920
|
+
}
|
|
921
|
+
getShadowClipPathUrl(e) {
|
|
922
|
+
let t = this.#o.get(e);
|
|
923
|
+
if (!t) {
|
|
924
|
+
t = "shadow-clip-" + this.#v++;
|
|
925
|
+
let n = N("clipPath", {
|
|
926
|
+
id: t,
|
|
927
|
+
clipPathUnits: "userSpaceOnUse"
|
|
928
|
+
});
|
|
929
|
+
n.appendChild(N("path", {
|
|
930
|
+
d: `M 0 0 V ${j(this.height)} H ${j(this.width)} V 0 Z ${e}`,
|
|
931
|
+
"clip-rule": "evenodd",
|
|
932
|
+
"fill-rule": "evenodd"
|
|
933
|
+
})), this.#t.appendChild(n), this.#o.set(e, t);
|
|
934
|
+
}
|
|
935
|
+
return `url(#${t})`;
|
|
936
|
+
}
|
|
937
|
+
getRectHatchPatternUrl(e) {
|
|
938
|
+
let t = JSON.stringify([
|
|
939
|
+
e.type,
|
|
940
|
+
e.fill,
|
|
941
|
+
A(e.fillOpacity),
|
|
942
|
+
e.stroke,
|
|
943
|
+
A(e.strokeOpacity),
|
|
944
|
+
A(e.strokeWidth)
|
|
945
|
+
]), n = this.#s.get(t);
|
|
946
|
+
return n || (n = "rect-hatch-" + this.#x++, this.#t.appendChild(xe(n, e)), this.#s.set(t, n)), `url(#${n})`;
|
|
947
|
+
}
|
|
948
|
+
getLegendGradientUrl(e) {
|
|
949
|
+
let t = "legend-gradient-" + this.#S++, n = N("linearGradient", {
|
|
950
|
+
id: t,
|
|
951
|
+
gradientUnits: "userSpaceOnUse",
|
|
952
|
+
x1: j(e.x1),
|
|
953
|
+
y1: j(e.y1),
|
|
954
|
+
x2: j(e.x2),
|
|
955
|
+
y2: j(e.y2)
|
|
956
|
+
});
|
|
957
|
+
for (let t of e.stops) n.appendChild(N("stop", {
|
|
958
|
+
offset: A(t.offset),
|
|
959
|
+
"stop-color": t.color
|
|
960
|
+
}));
|
|
961
|
+
return this.#t.appendChild(n), `url(#${t})`;
|
|
962
|
+
}
|
|
963
|
+
getLinkArcFadeMaskUrl(e) {
|
|
964
|
+
let t = Ce(e.p1, e.p4, e.distances);
|
|
965
|
+
if (!t) return;
|
|
966
|
+
let n = this.#c.get(t.key);
|
|
967
|
+
if (!n) {
|
|
968
|
+
n = "link-arc-fade-" + this.#y++;
|
|
969
|
+
let { gradient: e, mask: r } = we(n, this.width, this.height, t);
|
|
970
|
+
this.#t.appendChild(e), this.#t.appendChild(r), this.#c.set(t.key, n);
|
|
971
|
+
}
|
|
972
|
+
return `url(#${n})`;
|
|
973
|
+
}
|
|
974
|
+
getViewportEdgeFadeMaskUrl(e) {
|
|
975
|
+
let t = Object.entries(e).filter(([, e]) => e.width > 0 && Number.isFinite(e.distance));
|
|
976
|
+
if (!t.length) return;
|
|
977
|
+
let n = r(this.#n);
|
|
978
|
+
if (!n) throw Error("No current view in SVG rendering context.");
|
|
979
|
+
let i = this.#i.get(n.view);
|
|
980
|
+
if (!i) {
|
|
981
|
+
i = "edge-fade-" + this.#y++;
|
|
982
|
+
let e = j(this.width), r = j(this.height), a = N("mask", {
|
|
983
|
+
id: i,
|
|
984
|
+
x: 0,
|
|
985
|
+
y: 0,
|
|
986
|
+
width: e,
|
|
987
|
+
height: r,
|
|
988
|
+
maskUnits: "userSpaceOnUse",
|
|
989
|
+
maskContentUnits: "userSpaceOnUse",
|
|
990
|
+
"mask-type": "luminance"
|
|
991
|
+
});
|
|
992
|
+
a.appendChild(N("rect", {
|
|
993
|
+
width: e,
|
|
994
|
+
height: r,
|
|
995
|
+
fill: "white"
|
|
996
|
+
}));
|
|
997
|
+
for (let [o, s] of t) {
|
|
998
|
+
let t = i + "-" + o, c = je(t, o, s, n.coords);
|
|
999
|
+
this.#t.appendChild(c), a.appendChild(N("rect", {
|
|
1000
|
+
width: e,
|
|
1001
|
+
height: r,
|
|
1002
|
+
fill: `url(#${t})`
|
|
1003
|
+
}));
|
|
1004
|
+
}
|
|
1005
|
+
this.#t.appendChild(a), this.#i.set(n.view, i);
|
|
1006
|
+
}
|
|
1007
|
+
return `url(#${i})`;
|
|
1008
|
+
}
|
|
1009
|
+
getSvg() {
|
|
1010
|
+
return this.#e;
|
|
1011
|
+
}
|
|
1012
|
+
getWarnings() {
|
|
1013
|
+
return Array.from(this.#l);
|
|
1014
|
+
}
|
|
1015
|
+
get currentNode() {
|
|
1016
|
+
return r(this.#n)?.node ?? this.#e;
|
|
1017
|
+
}
|
|
1018
|
+
get currentCoords() {
|
|
1019
|
+
let e = r(this.#n);
|
|
1020
|
+
if (!e) throw Error("No current view in SVG rendering context.");
|
|
1021
|
+
return e.coords;
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
function De(e, t) {
|
|
1025
|
+
let n = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1026
|
+
return `${/^[A-Za-z_]/.test(n) ? n : n ? "view-" + n : "view"}-${t}`;
|
|
1027
|
+
}
|
|
1028
|
+
function Z(e, t) {
|
|
1029
|
+
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);
|
|
1030
|
+
}
|
|
1031
|
+
function Oe(e) {
|
|
1032
|
+
let [t, ...n] = Array.from(e), r = t;
|
|
1033
|
+
for (; n.some((e) => !r.contains(e));) r = r.parentNode;
|
|
1034
|
+
return r;
|
|
1035
|
+
}
|
|
1036
|
+
function ke(e, t) {
|
|
1037
|
+
let n = e;
|
|
1038
|
+
for (; n.parentNode != t;) n = n.parentNode;
|
|
1039
|
+
return n;
|
|
1040
|
+
}
|
|
1041
|
+
function Ae(e, t) {
|
|
1042
|
+
let n = e;
|
|
1043
|
+
for (; n != t && n.matches("g[data-view-path]") && Array.from(n.children).every((e) => e.tagName == "title");) {
|
|
1044
|
+
let e = n.parentNode;
|
|
1045
|
+
n.remove(), n = e;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
function je(e, t, n, r) {
|
|
1049
|
+
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 = N("linearGradient", {
|
|
1050
|
+
id: e,
|
|
1051
|
+
gradientUnits: "userSpaceOnUse",
|
|
1052
|
+
x1: j(a ? i : 0),
|
|
1053
|
+
y1: j(a ? 0 : i),
|
|
1054
|
+
x2: j(a ? o : 0),
|
|
1055
|
+
y2: j(a ? 0 : o)
|
|
1056
|
+
});
|
|
1057
|
+
return s.appendChild(N("stop", {
|
|
1058
|
+
offset: 0,
|
|
1059
|
+
"stop-color": "black",
|
|
1060
|
+
"stop-opacity": 1
|
|
1061
|
+
})), s.appendChild(N("stop", {
|
|
1062
|
+
offset: 1,
|
|
1063
|
+
"stop-color": "black",
|
|
1064
|
+
"stop-opacity": 0
|
|
1065
|
+
})), s;
|
|
1066
|
+
}
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region ../core/src/rendering/svg/index.js
|
|
1069
|
+
function Q({ viewRoot: e, logicalWidth: t, logicalHeight: n, background: r = "white" }) {
|
|
1070
|
+
let i = new X({ picking: !1 }, {
|
|
1071
|
+
width: t,
|
|
1072
|
+
height: n,
|
|
1073
|
+
background: r
|
|
1074
|
+
});
|
|
1075
|
+
return e.render(i, c.create(0, 0, t, n), { firstFacet: !0 }), {
|
|
1076
|
+
svg: i.getSvg(),
|
|
1077
|
+
warnings: i.getWarnings()
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
function Me({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
|
|
1081
|
+
let r = new X({ picking: !1 }, {
|
|
1082
|
+
width: t,
|
|
1083
|
+
height: n,
|
|
1084
|
+
background: null
|
|
1085
|
+
});
|
|
1086
|
+
return r.beginInstanceCounting(), e.render(r, c.create(0, 0, t, n), { firstFacet: !0 }), r.endInstanceCounting(), { layers: Array.from(r.getVisibleInstanceCounts(), ([e, t]) => ({
|
|
1087
|
+
viewName: e.unitView.name,
|
|
1088
|
+
viewTitle: e.unitView.getTitleText(),
|
|
1089
|
+
viewPath: e.unitView.getPathString(),
|
|
1090
|
+
markType: e.getType(),
|
|
1091
|
+
instanceCount: t
|
|
1092
|
+
})).filter((e) => e.instanceCount > 0) };
|
|
1093
|
+
}
|
|
1094
|
+
async function Ne(e) {
|
|
1095
|
+
let t = e.rasterization;
|
|
1096
|
+
if (!t) return {
|
|
1097
|
+
...Q(e),
|
|
1098
|
+
rasterized: []
|
|
1099
|
+
};
|
|
1100
|
+
if ($(t), !e.webGLHelper) {
|
|
1101
|
+
let t = Q(e);
|
|
1102
|
+
return {
|
|
1103
|
+
...t,
|
|
1104
|
+
warnings: [...t.warnings, "SVG rasterization was requested but no WebGL context is available; exported all marks as vectors."],
|
|
1105
|
+
rasterized: []
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
return Pe({
|
|
1109
|
+
...e,
|
|
1110
|
+
webGLHelper: e.webGLHelper,
|
|
1111
|
+
maxVectorInstances: t.maxVectorInstances,
|
|
1112
|
+
pixelRatio: t.pixelRatio
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
async function Pe({ viewRoot: e, webGLHelper: t, logicalWidth: n, logicalHeight: r, background: i = "white", maxVectorInstances: a, pixelRatio: o = 2 }) {
|
|
1116
|
+
$({
|
|
1117
|
+
maxVectorInstances: a,
|
|
1118
|
+
pixelRatio: o
|
|
1119
|
+
});
|
|
1120
|
+
let s = new X({ picking: !1 }, {
|
|
1121
|
+
width: n,
|
|
1122
|
+
height: r,
|
|
1123
|
+
background: i,
|
|
1124
|
+
maxVectorInstances: a
|
|
1125
|
+
}), l = c.create(0, 0, n, r);
|
|
1126
|
+
s.beginInstanceCounting(), e.render(s, l, { firstFacet: !0 }), s.endInstanceCounting(), e.render(s, l, { firstFacet: !0 });
|
|
1127
|
+
let u = s.getRasterRuns();
|
|
1128
|
+
if (u.length) {
|
|
1129
|
+
let { rasterizeSvgRuns: i } = await import("./webgl-Ci6ZhCCf.js");
|
|
1130
|
+
i({
|
|
1131
|
+
runs: u,
|
|
1132
|
+
viewRoot: e,
|
|
1133
|
+
webGLHelper: t,
|
|
1134
|
+
logicalWidth: n,
|
|
1135
|
+
logicalHeight: r,
|
|
1136
|
+
pixelRatio: o
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
return {
|
|
1140
|
+
svg: s.getSvg(),
|
|
1141
|
+
warnings: s.getWarnings(),
|
|
1142
|
+
rasterized: u.map((e) => ({
|
|
1143
|
+
targets: e.targets.map((e) => ({
|
|
1144
|
+
markType: e.mark.getType(),
|
|
1145
|
+
instanceCount: e.instanceCount
|
|
1146
|
+
})),
|
|
1147
|
+
reason: "instance-threshold",
|
|
1148
|
+
maxVectorInstances: a,
|
|
1149
|
+
pixelRatio: o
|
|
1150
|
+
}))
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
function $(e) {
|
|
1154
|
+
if (!Number.isInteger(e.maxVectorInstances) || e.maxVectorInstances < 0) throw RangeError("maxVectorInstances must be a non-negative integer.");
|
|
1155
|
+
if (e.pixelRatio != null && (!Number.isFinite(e.pixelRatio) || e.pixelRatio <= 0)) throw RangeError("SVG raster pixelRatio must be positive.");
|
|
1156
|
+
}
|
|
1157
|
+
//#endregion
|
|
1158
|
+
export { Me as analyzeSvgExport, Ne as createSvgExport };
|