@genome-spy/app 0.84.0 → 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-DHXYZVvQ.js → agentApi-Cz0hCnVp.js} +5790 -5190
- package/dist/agentApi.es.js +3117 -2793
- package/dist/agentShared.es.js +8 -8
- package/dist/arrayUtils-LJpQOu-U.js +2175 -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/{clipOptions-Dqco1p8b.js → color-W5zffv-z.js} +1 -43
- package/dist/{debug-aHQsa6hU.js → debug-BvCZWumf.js} +2 -2
- package/dist/{debug-D6FqxKEj.js → debug-CgDtmspT.js} +2 -2
- 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-CC0D6Haw.js → framebufferReadback-CCLOjStu.js} +26 -25
- package/dist/{framebufferReadback-Bje9lHb7.js → framebufferReadback-THWwFqs8.js} +14 -13
- package/dist/index.es.js +541 -538
- package/dist/index.js +560 -554
- 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 +1488 -88
- package/dist/style.css +1 -1
- package/dist/svg-CCu8kYy2.js +1158 -0
- package/dist/svg-yFj875aX.js +1158 -0
- package/dist/{svgNumber-C6aRPc8Z.js → svgNumber-DNxESJQB.js} +1 -1
- package/dist/{twgl-full.module-BNEMlXRV.js → twgl-full.module-DB2UdP1k.js} +1 -1
- package/dist/{viewIdentityRegistry-AEQpJTDm.js → viewIdentityRegistry-BUdkK9zT.js} +1 -1
- package/dist/{viewIdentityRegistry-Dl7rR4Ay.js → viewIdentityRegistry-D3oPbN4O.js} +1 -1
- package/dist/viewSelectors-DGCspRN3.js +4198 -0
- package/dist/viewSelectors-U5oLCLHV.js +4195 -0
- package/dist/{viewUtils-DMNiWslc.js → viewUtils-Dg4RA40Q.js} +2384 -2109
- package/dist/warning-CpIIpk8e.js +7 -0
- package/dist/warning-DRGdb6BF.js +59 -0
- package/dist/{raster-BofBWXbe.js → webgl-Ci6ZhCCf.js} +4 -4
- package/dist/{raster-9uKYMjHZ.js → webgl-Dpz8a3TI.js} +3 -3
- package/package.json +5 -5
- package/dist/svg-CvsT1Y2V.js +0 -1793
- package/dist/svg-DRgWfcsL.js +0 -1793
- package/dist/viewSelectors-BhW4mTR1.js +0 -6386
- package/dist/viewSelectors-Bwzj10Qz.js +0 -6363
package/dist/svg-CvsT1Y2V.js
DELETED
|
@@ -1,1793 +0,0 @@
|
|
|
1
|
-
import { Gn as e, M as t, Nr as n, Sn as r, Tn as i, Z as a, b as o, en as s, nn as c } from "./viewSelectors-Bwzj10Qz.js";
|
|
2
|
-
import { a as l, o as u } from "./clipOptions-Dqco1p8b.js";
|
|
3
|
-
import { n as d, t as f } from "./viewRenderingContext-HtpqwS_x.js";
|
|
4
|
-
import { n as p, t as m } from "./svgNumber-C6aRPc8Z.js";
|
|
5
|
-
//#region ../core/src/svg/svgBounds.js
|
|
6
|
-
function h(e, t, n) {
|
|
7
|
-
return {
|
|
8
|
-
x1: n?.clipX ? Math.max(0, n.rect.x) : 0,
|
|
9
|
-
y1: n?.clipY ? Math.max(0, n.rect.y) : 0,
|
|
10
|
-
x2: n?.clipX ? Math.min(e, n.rect.x2) : e,
|
|
11
|
-
y2: n?.clipY ? Math.min(t, n.rect.y2) : t
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function g(e, t, n) {
|
|
15
|
-
let r = n === !0 || n === "x", i = n === !0 || n === "y";
|
|
16
|
-
return {
|
|
17
|
-
x1: r ? t?.clipX ? t.rect.x : e.x : -Infinity,
|
|
18
|
-
y1: i ? t?.clipY ? t.rect.y : e.y : -Infinity,
|
|
19
|
-
x2: r ? t?.clipX ? t.rect.x2 : e.x2 : Infinity,
|
|
20
|
-
y2: i ? t?.clipY ? t.rect.y2 : e.y2 : Infinity
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function _(e) {
|
|
24
|
-
return e.x1 <= e.x2 && e.y1 <= e.y2;
|
|
25
|
-
}
|
|
26
|
-
function v(e, t, n) {
|
|
27
|
-
return t < e.x1 || t > e.x2 || n < e.y1 || n > e.y2;
|
|
28
|
-
}
|
|
29
|
-
function y(e, t, n, r, i, a = 0) {
|
|
30
|
-
return !(Math.max(t, r) + a < e.x1 || Math.min(t, r) - a > e.x2 || Math.max(n, i) + a < e.y1 || Math.min(n, i) - a > e.y2);
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region ../core/src/svg/markData.js
|
|
34
|
-
var b = [];
|
|
35
|
-
function x(e, t) {
|
|
36
|
-
let n = e.unitView.getCollector();
|
|
37
|
-
if (!n) throw Error(`Cannot export an uninitialized mark as SVG. View: ${e.unitView.getPathString()}`);
|
|
38
|
-
let r = n.facetBatches.get(void 0);
|
|
39
|
-
return r?.length ? r : n.facetBatches.get(t.facetId) ?? b;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region ../core/src/svg/svgElement.js
|
|
43
|
-
var S = "http://www.w3.org/2000/svg";
|
|
44
|
-
function C(e, t) {
|
|
45
|
-
let n = document.createElementNS(S, e);
|
|
46
|
-
if (t) for (let [e, r] of Object.entries(t)) n.setAttribute(e, "" + r);
|
|
47
|
-
return n;
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region ../core/src/svg/polygonUnion.js
|
|
51
|
-
var w = 1e-8;
|
|
52
|
-
function T(e) {
|
|
53
|
-
let t = e.flatMap((e, t) => e.map((n, r) => ({
|
|
54
|
-
a: n,
|
|
55
|
-
b: e[(r + 1) % e.length],
|
|
56
|
-
polygonIndex: t
|
|
57
|
-
}))), n = [];
|
|
58
|
-
for (let r of t) {
|
|
59
|
-
let i = [0, 1];
|
|
60
|
-
for (let e of t) r.polygonIndex != e.polygonIndex && E(r, e, i);
|
|
61
|
-
i.sort((e, t) => e - t);
|
|
62
|
-
for (let t = 0; t < i.length - 1; t++) {
|
|
63
|
-
let a = i[t], o = i[t + 1];
|
|
64
|
-
if (o - a <= w) continue;
|
|
65
|
-
let s = M(r.a, r.b, a), c = M(r.a, r.b, o), l = M(s, c, .5);
|
|
66
|
-
e.some((e, t) => t != r.polygonIndex && A(l, e)) || n.push({
|
|
67
|
-
a: s,
|
|
68
|
-
b: c,
|
|
69
|
-
polygonIndex: r.polygonIndex
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return k(O(n));
|
|
74
|
-
}
|
|
75
|
-
function E(e, t, n) {
|
|
76
|
-
let r = P(e.b, e.a), i = P(t.b, t.a), a = P(t.a, e.a), o = I(r, i);
|
|
77
|
-
if (Math.abs(o) > w) {
|
|
78
|
-
let e = I(a, i) / o, t = I(a, r) / o;
|
|
79
|
-
e > w && e < 1 - w && t >= -1e-8 && t <= 1.00000001 && n.push(e);
|
|
80
|
-
} else Math.abs(I(a, r)) <= w && (D(e, t.a, n), D(e, t.b, n));
|
|
81
|
-
}
|
|
82
|
-
function D(e, t, n) {
|
|
83
|
-
let r = P(e.b, e.a), i = F(r, r), a = F(P(t, e.a), r) / i;
|
|
84
|
-
a > w && a < 1 - w && n.push(a);
|
|
85
|
-
}
|
|
86
|
-
function O(e) {
|
|
87
|
-
let t = /* @__PURE__ */ new Map();
|
|
88
|
-
for (let n of e) {
|
|
89
|
-
let e = N(n.a) + ":" + N(n.b), r = N(n.b) + ":" + N(n.a);
|
|
90
|
-
t.has(r) ? t.delete(r) : t.has(e) || t.set(e, n);
|
|
91
|
-
}
|
|
92
|
-
return Array.from(t.values());
|
|
93
|
-
}
|
|
94
|
-
function k(e) {
|
|
95
|
-
let t = /* @__PURE__ */ new Map();
|
|
96
|
-
for (let n of e) {
|
|
97
|
-
let e = N(n.a), r = t.get(e) ?? [];
|
|
98
|
-
r.push(n), t.set(e, r);
|
|
99
|
-
}
|
|
100
|
-
let n = new Set(e), r = [];
|
|
101
|
-
for (; n.size;) {
|
|
102
|
-
let e = n.values().next().value, i = [e.a], a = e;
|
|
103
|
-
for (;;) {
|
|
104
|
-
if (n.delete(a), i.push(a.b), N(a.b) == N(i[0])) {
|
|
105
|
-
i.pop();
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
let e = (t.get(N(a.b)) ?? []).find((e) => n.has(e));
|
|
109
|
-
if (!e) throw Error("Cannot chain SVG polygon union boundary.");
|
|
110
|
-
a = e;
|
|
111
|
-
}
|
|
112
|
-
r.push(i);
|
|
113
|
-
}
|
|
114
|
-
return r;
|
|
115
|
-
}
|
|
116
|
-
function A(e, t) {
|
|
117
|
-
let n = !1;
|
|
118
|
-
for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
|
|
119
|
-
let a = t[i], o = t[r];
|
|
120
|
-
if (j(e, a, o)) return !1;
|
|
121
|
-
a.y > e.y != o.y > e.y && e.x < (o.x - a.x) * (e.y - a.y) / (o.y - a.y) + a.x && (n = !n);
|
|
122
|
-
}
|
|
123
|
-
return n;
|
|
124
|
-
}
|
|
125
|
-
function j(e, t, n) {
|
|
126
|
-
return Math.abs(I(P(e, t), P(n, t))) <= w && F(P(e, t), P(e, n)) <= w;
|
|
127
|
-
}
|
|
128
|
-
function M(e, t, n) {
|
|
129
|
-
return {
|
|
130
|
-
x: e.x + (t.x - e.x) * n,
|
|
131
|
-
y: e.y + (t.y - e.y) * n
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function N(e) {
|
|
135
|
-
return `${Math.round(e.x / w)},${Math.round(e.y / w)}`;
|
|
136
|
-
}
|
|
137
|
-
function P(e, t) {
|
|
138
|
-
return {
|
|
139
|
-
x: e.x - t.x,
|
|
140
|
-
y: e.y - t.y
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function F(e, t) {
|
|
144
|
-
return e.x * t.x + e.y * t.y;
|
|
145
|
-
}
|
|
146
|
-
function I(e, t) {
|
|
147
|
-
return e.x * t.y - e.y * t.x;
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region ../core/src/svg/svgMarkUtils.js
|
|
151
|
-
function L(e, t, n) {
|
|
152
|
-
return e.x + t * e.width + n;
|
|
153
|
-
}
|
|
154
|
-
function R(e, t, n) {
|
|
155
|
-
return e.y + (1 - t) * e.height + n;
|
|
156
|
-
}
|
|
157
|
-
function z(e, t, n) {
|
|
158
|
-
return B(e, t.x, t.x2, t.xOffset, t.x2Offset, n, L);
|
|
159
|
-
}
|
|
160
|
-
function ee(e, t, n) {
|
|
161
|
-
return B(e, t.y, t.y2, t.yOffset, t.y2Offset, n, R);
|
|
162
|
-
}
|
|
163
|
-
function B(e, t, n, r, i, a, o) {
|
|
164
|
-
let s = V(r, a), c = o(e, H(t, a), s);
|
|
165
|
-
return [c, n ? o(e, H(n, a), i ? V(i, a) : s) : c];
|
|
166
|
-
}
|
|
167
|
-
function V(e, t) {
|
|
168
|
-
return e(t);
|
|
169
|
-
}
|
|
170
|
-
function H(e, t) {
|
|
171
|
-
let n = V(e, t), r = e.scale;
|
|
172
|
-
if (!r) return n;
|
|
173
|
-
let i = e.channelDef, a = i && "band" in i ? i.band ?? .5 : .5;
|
|
174
|
-
if (r.type == "band" || r.type == "point") return n + r.bandwidth() * a;
|
|
175
|
-
if (r.type == "index" || r.type == "locus") {
|
|
176
|
-
let e = r;
|
|
177
|
-
return n + Math.sign(e.step()) * e.bandwidth() * (a - e.align());
|
|
178
|
-
} else return n;
|
|
179
|
-
}
|
|
180
|
-
function te(e, t) {
|
|
181
|
-
return W(e(t));
|
|
182
|
-
}
|
|
183
|
-
function U(e, t) {
|
|
184
|
-
return i(t) ? e.unitView.paramRuntime.evaluateAndGet(t.expr) : t;
|
|
185
|
-
}
|
|
186
|
-
function W(e) {
|
|
187
|
-
return e == null ? "none" : "" + e;
|
|
188
|
-
}
|
|
189
|
-
function G(e, t) {
|
|
190
|
-
let n = Object.entries(t).filter(([t, n]) => n.encoder.constant ? (e.setAttribute(t, "" + K(n, {})), !1) : !0);
|
|
191
|
-
return (e) => Object.fromEntries(n.map(([t, n]) => [t, K(n, e)]));
|
|
192
|
-
}
|
|
193
|
-
function K(e, t) {
|
|
194
|
-
let n = e.encoder(t);
|
|
195
|
-
return e.transform ? e.transform(n) : "" + n;
|
|
196
|
-
}
|
|
197
|
-
//#endregion
|
|
198
|
-
//#region ../core/src/svg/renderers/arrow.js
|
|
199
|
-
function ne(e, t) {
|
|
200
|
-
let n = e, r = n.properties, i = le(U(n, r.headAngle)), a = le(U(n, r.headNotchAngle)), o = U(n, r.headShape), s = U(n, r.headWidth), c = U(n, r.minSize), l = U(n, r.stem), u = U(n, r.startNotch), d = U(n, r.minStemLength), f = U(n, r.headSpacing), p = f != null && f >= 0, h = U(n, r.headPlacement), { coords: g, data: _, group: v, viewOpacity: b, visibleBounds: x } = t, S = n.encoders, w = G(v, {
|
|
201
|
-
fill: {
|
|
202
|
-
encoder: S.fill,
|
|
203
|
-
transform: W
|
|
204
|
-
},
|
|
205
|
-
"fill-opacity": {
|
|
206
|
-
encoder: S.fillOpacity,
|
|
207
|
-
transform: (e) => +e * b
|
|
208
|
-
},
|
|
209
|
-
stroke: {
|
|
210
|
-
encoder: S.stroke,
|
|
211
|
-
transform: W
|
|
212
|
-
},
|
|
213
|
-
"stroke-opacity": {
|
|
214
|
-
encoder: S.strokeOpacity,
|
|
215
|
-
transform: (e) => +e * b
|
|
216
|
-
},
|
|
217
|
-
"stroke-width": {
|
|
218
|
-
encoder: S.strokeWidth,
|
|
219
|
-
transform: (e) => m(+e)
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
v.setAttribute("stroke-linejoin", "miter");
|
|
223
|
-
let E = 0;
|
|
224
|
-
for (let e of _) {
|
|
225
|
-
let [n, r] = z(g, S, e), [m, _] = ee(g, S, e), D = {
|
|
226
|
-
x: n,
|
|
227
|
-
y: m
|
|
228
|
-
}, O = {
|
|
229
|
-
x: r,
|
|
230
|
-
y: _
|
|
231
|
-
}, k = te(S.direction, e), A = k == "reverse" ? O : D, j = k == "reverse" ? D : O, M = fe(j, A), N = Math.hypot(M.x, M.y);
|
|
232
|
-
if (N == 0) continue;
|
|
233
|
-
let P = J(M, 1 / N), F = {
|
|
234
|
-
x: -P.y,
|
|
235
|
-
y: P.x
|
|
236
|
-
}, I = Math.max(V(S.size, e), c), L = I / 2, R = Math.max(s * I, 0) / 2, B = oe({
|
|
237
|
-
segmentLength: N,
|
|
238
|
-
headHalfWidth: R,
|
|
239
|
-
stemHalfWidth: l ? L : -L,
|
|
240
|
-
configuredRHeadSlope: i,
|
|
241
|
-
configuredRHeadNotchSlope: a,
|
|
242
|
-
headRepeat: p,
|
|
243
|
-
headPlacement: h,
|
|
244
|
-
startNotch: u,
|
|
245
|
-
minStemLength: d,
|
|
246
|
-
headShape: o
|
|
247
|
-
}), H = o == "open" ? B : Math.min(a, B), U = o == "open" ? I : 0, G = h == "outside" ? ce(R, B, H, U) : 0, K = h == "outside" ? q(j, J(P, G)) : j, ne = R * B, se = Math.hypot(R, ne), le = o == "open" && se > 0 ? I * R / se : 0, de = q(K, J(P, -ne - le)), Y = V(S.strokeWidth, e), pe = Math.max(l ? L : 0, R) + Y * 2;
|
|
248
|
-
if (!y(x, Math.min(A.x, K.x, de.x), Math.min(A.y, K.y, de.y), Math.max(A.x, K.x, de.x), Math.max(A.y, K.y, de.y), pe) || (E++, t.countOnly)) continue;
|
|
249
|
-
let me = o == "triangle" || o == "open" ? o : "triangle";
|
|
250
|
-
me != o && t.warn(`SVG export rendered unsupported arrow headShape "${o}" as a triangle.`);
|
|
251
|
-
let he = l ? ie(A, K, P, F, L, B, u) : null, X = he ? [he] : [], ge = he && me == "triangle" && !p && R <= L, _e = ne + U / Math.hypot(B, 1) + Y, ve = p ? Math.max((f ?? 0) * I, _e) : Infinity, ye = Math.hypot(K.x - A.x, K.y - A.y);
|
|
252
|
-
for (let e = 0; !ge && !(e > 0 && e + _e - Y / 2 > ye); e += ve) {
|
|
253
|
-
let t = q(K, J(P, -e));
|
|
254
|
-
if (X.push(me == "open" ? ae(t, P, F, R, B, H, I) : re(t, P, F, R, B, H)), !p || ve <= 0) break;
|
|
255
|
-
}
|
|
256
|
-
let Z = W(S.stroke(e)) != "none" && V(S.strokeOpacity, e) * b > 0 && Y > 0, be = C("path", {
|
|
257
|
-
d: (X.length == 1 || !Z ? X : T(X)).map(ue).join(" "),
|
|
258
|
-
...w(e)
|
|
259
|
-
});
|
|
260
|
-
v.appendChild(be);
|
|
261
|
-
}
|
|
262
|
-
return E;
|
|
263
|
-
}
|
|
264
|
-
function re(e, t, n, r, i, a) {
|
|
265
|
-
let o = r * i, s = o - r * a, c = q(q(e, J(t, -o)), J(n, r)), l = q(q(e, J(t, -o)), J(n, -r));
|
|
266
|
-
return [
|
|
267
|
-
e,
|
|
268
|
-
c,
|
|
269
|
-
q(e, J(t, -s)),
|
|
270
|
-
l
|
|
271
|
-
];
|
|
272
|
-
}
|
|
273
|
-
function ie(e, t, n, r, i, a, o) {
|
|
274
|
-
let s = i * a, c = q(q(t, J(n, -s)), J(r, i)), l = q(q(t, J(n, -s)), J(r, -i)), u = q(e, J(r, i)), d = q(e, J(r, -i));
|
|
275
|
-
return [
|
|
276
|
-
t,
|
|
277
|
-
c,
|
|
278
|
-
u,
|
|
279
|
-
...o ? [q(e, J(n, i * a))] : [],
|
|
280
|
-
d,
|
|
281
|
-
l
|
|
282
|
-
];
|
|
283
|
-
}
|
|
284
|
-
function ae(e, t, n, r, i, a, o) {
|
|
285
|
-
let s = r * i, c = q(q(e, J(t, -s)), J(n, r)), l = q(q(e, J(t, -s)), J(n, -r)), u = Math.hypot(r, s), d = o * r / u, f = o * s / u, p = q(q(c, J(t, -d)), J(n, -f)), m = q(q(l, J(t, -d)), J(n, f));
|
|
286
|
-
return [
|
|
287
|
-
e,
|
|
288
|
-
c,
|
|
289
|
-
p,
|
|
290
|
-
q(e, J(t, -(s + d - (r - f) * a))),
|
|
291
|
-
m,
|
|
292
|
-
l
|
|
293
|
-
];
|
|
294
|
-
}
|
|
295
|
-
function oe({ segmentLength: e, headHalfWidth: t, stemHalfWidth: n, configuredRHeadSlope: r, configuredRHeadNotchSlope: i, headRepeat: a, headPlacement: o, startNotch: s, minStemLength: c, headShape: l }) {
|
|
296
|
-
if (a || n < 0) return r;
|
|
297
|
-
if (o == "outside") {
|
|
298
|
-
if (!s || n <= 0) return r;
|
|
299
|
-
let t = Math.max(e - c, 0);
|
|
300
|
-
return Math.min(r, t / n);
|
|
301
|
-
} else if (l != "triangle") return r;
|
|
302
|
-
let u = Math.max(e - c, 0);
|
|
303
|
-
return se(n, t, r, i) <= u ? r : u < n * i ? n > 0 ? Y(u / n, 0, r) : 0 : Y((u + (t - n) * i) / t, 0, r);
|
|
304
|
-
}
|
|
305
|
-
function se(e, t, n, r) {
|
|
306
|
-
let i = Math.min(r, n);
|
|
307
|
-
return t * n - (t - e) * i;
|
|
308
|
-
}
|
|
309
|
-
function ce(e, t, n, r) {
|
|
310
|
-
if (e <= 0) return 0;
|
|
311
|
-
let i = e * t, a = Math.hypot(e, i);
|
|
312
|
-
return i + r * e / a - (e - r * i / a) * n;
|
|
313
|
-
}
|
|
314
|
-
function le(e) {
|
|
315
|
-
let t = Y(e, 1, 90) * Math.PI / 180;
|
|
316
|
-
return 1 / Math.max(Math.tan(t), 1e-6);
|
|
317
|
-
}
|
|
318
|
-
function ue(e) {
|
|
319
|
-
return `M ${e.map(de).join(" L ")} Z`;
|
|
320
|
-
}
|
|
321
|
-
function de(e) {
|
|
322
|
-
return `${m(e.x)} ${m(e.y)}`;
|
|
323
|
-
}
|
|
324
|
-
function q(e, t) {
|
|
325
|
-
return {
|
|
326
|
-
x: e.x + t.x,
|
|
327
|
-
y: e.y + t.y
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
function fe(e, t) {
|
|
331
|
-
return {
|
|
332
|
-
x: e.x - t.x,
|
|
333
|
-
y: e.y - t.y
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function J(e, t) {
|
|
337
|
-
return {
|
|
338
|
-
x: e.x * t,
|
|
339
|
-
y: e.y * t
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
function Y(e, t, n) {
|
|
343
|
-
return Math.min(Math.max(e, t), n);
|
|
344
|
-
}
|
|
345
|
-
//#endregion
|
|
346
|
-
//#region ../core/src/svg/renderers/link.js
|
|
347
|
-
function pe(e, t) {
|
|
348
|
-
let n = e, r = n.properties, i = U(n, r.arcFadingDistance), a = U(n, r.linkShape), o = {
|
|
349
|
-
shape: a,
|
|
350
|
-
orient: U(n, r.orient),
|
|
351
|
-
arcHeightFactor: U(n, r.arcHeightFactor),
|
|
352
|
-
minArcHeight: U(n, r.minArcHeight),
|
|
353
|
-
maxChordLength: U(n, r.maxChordLength),
|
|
354
|
-
clampApex: U(n, r.clampApex)
|
|
355
|
-
}, { coords: s, data: c, group: l, viewOpacity: u, visibleBounds: d } = t, f = n.encoders, p = U(n, r.noFadingOnPointSelection) ? me(n, f) : [], h = G(l, {
|
|
356
|
-
stroke: {
|
|
357
|
-
encoder: f.color,
|
|
358
|
-
transform: W
|
|
359
|
-
},
|
|
360
|
-
"stroke-opacity": {
|
|
361
|
-
encoder: f.opacity,
|
|
362
|
-
transform: (e) => +e * u
|
|
363
|
-
},
|
|
364
|
-
"stroke-width": {
|
|
365
|
-
encoder: f.size,
|
|
366
|
-
transform: (e) => m(+e)
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
l.setAttribute("fill", "none"), l.setAttribute("stroke-linecap", "butt");
|
|
370
|
-
let g = 0;
|
|
371
|
-
for (let e of c) {
|
|
372
|
-
let [n, r] = z(s, f, e), [c, u] = ee(s, f, e), [m, _, v, b] = ge([n - s.x, s.y2 - c], [r - s.x, s.y2 - u], {
|
|
373
|
-
width: s.width,
|
|
374
|
-
height: s.height
|
|
375
|
-
}, o).map(([e, t]) => [s.x + e, s.y + s.height - t]), x = V(f.size, e) / 2;
|
|
376
|
-
if (!y(d, Math.min(m[0], _[0], v[0], b[0]), Math.min(m[1], _[1], v[1], b[1]), Math.max(m[0], _[0], v[0], b[0]), Math.max(m[1], _[1], v[1], b[1]), x) || (g++, t.countOnly)) continue;
|
|
377
|
-
let S = h(e);
|
|
378
|
-
if (a == "arc" && i !== !1 && i[0] > 0 && i[1] > 0 && !he(e, p)) {
|
|
379
|
-
let e = t.getLinkArcFadeMaskUrl({
|
|
380
|
-
p1: m,
|
|
381
|
-
p4: b,
|
|
382
|
-
distances: i
|
|
383
|
-
});
|
|
384
|
-
e && (S.mask = e);
|
|
385
|
-
}
|
|
386
|
-
l.appendChild(C("path", {
|
|
387
|
-
d: `M ${X(m)} C ${X(_)} ${X(v)} ${X(b)}`,
|
|
388
|
-
...S
|
|
389
|
-
}));
|
|
390
|
-
}
|
|
391
|
-
return g;
|
|
392
|
-
}
|
|
393
|
-
function me(e, t) {
|
|
394
|
-
let n = new Set(Object.values(t).flatMap((e) => e.branches).map((e) => e.predicate?.param).filter((e) => e));
|
|
395
|
-
return Array.from(n).map((t) => e.unitView.paramRuntime.findValue(t)).filter((e) => e && (c(e) || s(e)));
|
|
396
|
-
}
|
|
397
|
-
function he(e, t) {
|
|
398
|
-
let n = e[r];
|
|
399
|
-
return t.some((e) => c(e) ? e.uniqueId != null && e.uniqueId == n : e.data.has(n));
|
|
400
|
-
}
|
|
401
|
-
function X(e) {
|
|
402
|
-
return e.map(m).join(" ");
|
|
403
|
-
}
|
|
404
|
-
function ge(e, t, n, r) {
|
|
405
|
-
if (r.shape == "arc") {
|
|
406
|
-
let i = [...e], a = [...t], o = be(a, i), s = xe(o);
|
|
407
|
-
if (s == 0) return [
|
|
408
|
-
i,
|
|
409
|
-
i,
|
|
410
|
-
a,
|
|
411
|
-
a
|
|
412
|
-
];
|
|
413
|
-
let c = Q(o, 1 / s), l = [-c[1], c[0]];
|
|
414
|
-
s = _e(i, a, s, r.maxChordLength, n);
|
|
415
|
-
let u = Q(l, Math.max(s / 2 * r.arcHeightFactor, r.minArcHeight) / .75);
|
|
416
|
-
return [
|
|
417
|
-
i,
|
|
418
|
-
Z(i, u),
|
|
419
|
-
Z(a, u),
|
|
420
|
-
a
|
|
421
|
-
];
|
|
422
|
-
} else if (r.shape == "dome") {
|
|
423
|
-
let i, a, o;
|
|
424
|
-
r.orient == "vertical" ? (i = [Math.min(e[0], t[0]), t[1]], a = [Math.max(e[0], t[0]), t[1]], o = [0, e[1] - t[1]]) : (i = [t[0], Math.min(e[1], t[1])], a = [t[0], Math.max(e[1], t[1])], o = [e[0] - t[0], 0]);
|
|
425
|
-
let s = xe(be(a, i));
|
|
426
|
-
_e(i, a, s, r.maxChordLength, n), r.clampApex && ve(i, a, r.orient, n);
|
|
427
|
-
let c = Q(o, 1 / .75);
|
|
428
|
-
return [
|
|
429
|
-
i,
|
|
430
|
-
Z(i, c),
|
|
431
|
-
Z(a, c),
|
|
432
|
-
a
|
|
433
|
-
];
|
|
434
|
-
} else if (r.shape == "diagonal") if (r.orient == "vertical") {
|
|
435
|
-
let n = (e[1] + t[1]) / 2;
|
|
436
|
-
return [
|
|
437
|
-
e,
|
|
438
|
-
[e[0], n],
|
|
439
|
-
[t[0], n],
|
|
440
|
-
t
|
|
441
|
-
];
|
|
442
|
-
} else {
|
|
443
|
-
let n = (e[0] + t[0]) / 2;
|
|
444
|
-
return [
|
|
445
|
-
e,
|
|
446
|
-
[n, e[1]],
|
|
447
|
-
[n, t[1]],
|
|
448
|
-
t
|
|
449
|
-
];
|
|
450
|
-
}
|
|
451
|
-
else if (r.shape == "line") {
|
|
452
|
-
let n = Q(Z(e, t), .5);
|
|
453
|
-
return [
|
|
454
|
-
e,
|
|
455
|
-
n,
|
|
456
|
-
n,
|
|
457
|
-
t
|
|
458
|
-
];
|
|
459
|
-
} else throw Error(`Unsupported link shape: ${r.shape}`);
|
|
460
|
-
}
|
|
461
|
-
function _e(e, t, n, r, i) {
|
|
462
|
-
if (n <= r) return n;
|
|
463
|
-
let a = Q(be(t, e), 1 / n);
|
|
464
|
-
return ye(e, i, 2) ? (Se(t, Z(e, Q(a, r))), r) : ye(t, i, 2) ? (Se(e, be(t, Q(a, r))), r) : n;
|
|
465
|
-
}
|
|
466
|
-
function ve(e, t, n, r) {
|
|
467
|
-
n == "vertical" ? (t[0] > 0 && (e[0] = Math.max(e[0], -t[0])), e[0] < r.width && (t[0] = Math.min(t[0], 2 * r.width - e[0]))) : (t[1] > 0 && (e[1] = Math.max(e[1], -t[1])), e[1] < r.height && (t[1] = Math.min(t[1], 2 * r.height - e[1])));
|
|
468
|
-
}
|
|
469
|
-
function ye(e, t, n) {
|
|
470
|
-
return e[0] >= -t.width * n && e[0] <= t.width * (1 + n) && e[1] >= -t.height * n && e[1] <= t.height * (1 + n);
|
|
471
|
-
}
|
|
472
|
-
function Z(e, t) {
|
|
473
|
-
return [e[0] + t[0], e[1] + t[1]];
|
|
474
|
-
}
|
|
475
|
-
function be(e, t) {
|
|
476
|
-
return [e[0] - t[0], e[1] - t[1]];
|
|
477
|
-
}
|
|
478
|
-
function Q(e, t) {
|
|
479
|
-
return [e[0] * t, e[1] * t];
|
|
480
|
-
}
|
|
481
|
-
function xe(e) {
|
|
482
|
-
return Math.hypot(e[0], e[1]);
|
|
483
|
-
}
|
|
484
|
-
function Se(e, t) {
|
|
485
|
-
e[0] = t[0], e[1] = t[1];
|
|
486
|
-
}
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region ../core/src/svg/renderers/point.js
|
|
489
|
-
function Ce(e, t) {
|
|
490
|
-
let n = e;
|
|
491
|
-
U(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.");
|
|
492
|
-
let r = U(n, n.properties.inwardStroke), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c, anchorCullBounds: l } = t, u = n.encoders, d = n.getSemanticThreshold(), f = G(o, {
|
|
493
|
-
fill: {
|
|
494
|
-
encoder: u.fill,
|
|
495
|
-
transform: W
|
|
496
|
-
},
|
|
497
|
-
"fill-opacity": {
|
|
498
|
-
encoder: u.fillOpacity,
|
|
499
|
-
transform: (e) => +e * s
|
|
500
|
-
},
|
|
501
|
-
stroke: {
|
|
502
|
-
encoder: u.stroke,
|
|
503
|
-
transform: W
|
|
504
|
-
},
|
|
505
|
-
"stroke-opacity": {
|
|
506
|
-
encoder: u.strokeOpacity,
|
|
507
|
-
transform: (e) => +e * s
|
|
508
|
-
},
|
|
509
|
-
"stroke-width": {
|
|
510
|
-
encoder: u.strokeWidth,
|
|
511
|
-
transform: (e) => m(+e)
|
|
512
|
-
}
|
|
513
|
-
}), p = 0;
|
|
514
|
-
for (let e of a) {
|
|
515
|
-
let n = te(u.shape, e);
|
|
516
|
-
if (V(u.semanticScore, e) < d) continue;
|
|
517
|
-
let a = L(i, H(u.x, e), V(u.xOffset, e) + V(u.dx, e)), h = R(i, H(u.y, e), V(u.yOffset, e) - V(u.dy, e));
|
|
518
|
-
if (v(l, a, h)) continue;
|
|
519
|
-
let g = Math.sqrt(V(u.size, e)) / 2;
|
|
520
|
-
if (r && g <= 0) continue;
|
|
521
|
-
let _ = V(u.angle, e), b = V(u.strokeWidth, e), x = n == "x" || n == "+", S = r && !x ? Math.min(b, g) : b, w = r && !x ? g - S / 2 : g, T = r ? 0 : b / 2, E = g * Math.SQRT2 + T;
|
|
522
|
-
if (!y(c, a - E, h - E, a + E, h + E) || (p++, t.countOnly)) continue;
|
|
523
|
-
let D = {
|
|
524
|
-
...f(e),
|
|
525
|
-
...r && !x ? { "stroke-width": m(S) } : {},
|
|
526
|
-
...x ? Ee(u, e, s) : {}
|
|
527
|
-
}, O = we(n, a, h, w, D);
|
|
528
|
-
O ? (_ && O.setAttribute("transform", `rotate(${m(_)} ${m(a)} ${m(h)})`), o.appendChild(O)) : (t.warn(`SVG export rendered unsupported point shape "${n}" as a circle.`), o.appendChild(C("circle", {
|
|
529
|
-
cx: m(a),
|
|
530
|
-
cy: m(h),
|
|
531
|
-
r: m(w),
|
|
532
|
-
...D
|
|
533
|
-
})));
|
|
534
|
-
}
|
|
535
|
-
return p;
|
|
536
|
-
}
|
|
537
|
-
function we(e, t, n, r, i) {
|
|
538
|
-
let a = m(t), o = m(n), s = m(r);
|
|
539
|
-
if (e == "circle") return C("circle", {
|
|
540
|
-
cx: a,
|
|
541
|
-
cy: o,
|
|
542
|
-
r: s,
|
|
543
|
-
...i
|
|
544
|
-
});
|
|
545
|
-
if (e == "square") return C("rect", {
|
|
546
|
-
x: m(t - r),
|
|
547
|
-
y: m(n - r),
|
|
548
|
-
width: m(r * 2),
|
|
549
|
-
height: m(r * 2),
|
|
550
|
-
...i
|
|
551
|
-
});
|
|
552
|
-
let c = Te(e, t, n, r);
|
|
553
|
-
return c ? C("path", {
|
|
554
|
-
d: c,
|
|
555
|
-
...i
|
|
556
|
-
}) : void 0;
|
|
557
|
-
}
|
|
558
|
-
function Te(e, t, n, r) {
|
|
559
|
-
let i = (e) => e.map(m).join(" "), a = (e) => `M ${e.map(i).join(" L ")} Z`, o = r * .4, s = r * .15, c = Math.sqrt(3) * r / 2;
|
|
560
|
-
if (e == "diamond") return a([
|
|
561
|
-
[t, n - r],
|
|
562
|
-
[t + r, n],
|
|
563
|
-
[t, n + r],
|
|
564
|
-
[t - r, n]
|
|
565
|
-
]);
|
|
566
|
-
if (e == "cross") return a([
|
|
567
|
-
[t - o, n - r],
|
|
568
|
-
[t + o, n - r],
|
|
569
|
-
[t + o, n - o],
|
|
570
|
-
[t + r, n - o],
|
|
571
|
-
[t + r, n + o],
|
|
572
|
-
[t + o, n + o],
|
|
573
|
-
[t + o, n + r],
|
|
574
|
-
[t - o, n + r],
|
|
575
|
-
[t - o, n + o],
|
|
576
|
-
[t - r, n + o],
|
|
577
|
-
[t - r, n - o],
|
|
578
|
-
[t - o, n - o]
|
|
579
|
-
]);
|
|
580
|
-
if (e.startsWith("triangle-")) {
|
|
581
|
-
let i = {
|
|
582
|
-
"triangle-up": [
|
|
583
|
-
[t, n - c],
|
|
584
|
-
[t + r, n + c],
|
|
585
|
-
[t - r, n + c]
|
|
586
|
-
],
|
|
587
|
-
"triangle-right": [
|
|
588
|
-
[t + c, n],
|
|
589
|
-
[t - c, n + r],
|
|
590
|
-
[t - c, n - r]
|
|
591
|
-
],
|
|
592
|
-
"triangle-down": [
|
|
593
|
-
[t, n + c],
|
|
594
|
-
[t - r, n - c],
|
|
595
|
-
[t + r, n - c]
|
|
596
|
-
],
|
|
597
|
-
"triangle-left": [
|
|
598
|
-
[t - c, n],
|
|
599
|
-
[t + c, n - r],
|
|
600
|
-
[t + c, n + r]
|
|
601
|
-
]
|
|
602
|
-
}[e];
|
|
603
|
-
return i ? a(i) : void 0;
|
|
604
|
-
} else if (e.startsWith("tick-")) {
|
|
605
|
-
let i = {
|
|
606
|
-
"tick-up": [
|
|
607
|
-
-s,
|
|
608
|
-
-r,
|
|
609
|
-
s,
|
|
610
|
-
0
|
|
611
|
-
],
|
|
612
|
-
"tick-right": [
|
|
613
|
-
0,
|
|
614
|
-
-s,
|
|
615
|
-
r,
|
|
616
|
-
s
|
|
617
|
-
],
|
|
618
|
-
"tick-down": [
|
|
619
|
-
-s,
|
|
620
|
-
0,
|
|
621
|
-
s,
|
|
622
|
-
r
|
|
623
|
-
],
|
|
624
|
-
"tick-left": [
|
|
625
|
-
-r,
|
|
626
|
-
-s,
|
|
627
|
-
0,
|
|
628
|
-
s
|
|
629
|
-
]
|
|
630
|
-
}[e];
|
|
631
|
-
if (i) {
|
|
632
|
-
let [e, r, o, s] = i;
|
|
633
|
-
return a([
|
|
634
|
-
[t + e, n + r],
|
|
635
|
-
[t + o, n + r],
|
|
636
|
-
[t + o, n + s],
|
|
637
|
-
[t + e, n + s]
|
|
638
|
-
]);
|
|
639
|
-
}
|
|
640
|
-
} else if (e == "+") return `M ${i([t - r, n])} L ${i([t + r, n])} M ${i([t, n - r])} L ${i([t, n + r])}`;
|
|
641
|
-
else if (e == "x") return `M ${i([t - r, n - r])} L ${i([t + r, n + r])} M ${i([t + r, n - r])} L ${i([t - r, n + r])}`;
|
|
642
|
-
}
|
|
643
|
-
function Ee(e, t, n) {
|
|
644
|
-
let r = e.stroke(t), i = V(e.strokeOpacity, t), a = r == null || i <= 0;
|
|
645
|
-
return {
|
|
646
|
-
fill: "none",
|
|
647
|
-
stroke: W(a ? e.fill(t) : r),
|
|
648
|
-
"stroke-opacity": (a ? V(e.fillOpacity, t) : i) * n,
|
|
649
|
-
"stroke-width": m(V(e.strokeWidth, t)),
|
|
650
|
-
"stroke-linecap": "butt"
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
//#endregion
|
|
654
|
-
//#region ../core/src/svg/renderers/rect.js
|
|
655
|
-
var De = .1;
|
|
656
|
-
function Oe(e, t) {
|
|
657
|
-
let n = e, r = n.properties, i = U(n, r.cornerRadius), a = {
|
|
658
|
-
topLeft: U(n, r.cornerRadiusTopLeft ?? i),
|
|
659
|
-
topRight: U(n, r.cornerRadiusTopRight ?? i),
|
|
660
|
-
bottomRight: U(n, r.cornerRadiusBottomRight ?? i),
|
|
661
|
-
bottomLeft: U(n, r.cornerRadiusBottomLeft ?? i)
|
|
662
|
-
}, o = U(n, r.minWidth), s = U(n, r.minHeight), c = U(n, r.minOpacity), l = {
|
|
663
|
-
blur: U(n, r.shadowBlur ?? 0),
|
|
664
|
-
color: U(n, r.shadowColor ?? "black"),
|
|
665
|
-
offsetX: U(n, r.shadowOffsetX ?? 0),
|
|
666
|
-
offsetY: U(n, r.shadowOffsetY ?? 0),
|
|
667
|
-
opacity: U(n, r.shadowOpacity ?? 0)
|
|
668
|
-
}, u = U(n, r.hatch ?? "none"), d = u == "none" && l.opacity == 0 && Ne(a), { coords: f, data: h, group: g, viewOpacity: _, visibleBounds: v } = t, b = n.encoders, x = G(g, {
|
|
669
|
-
fill: {
|
|
670
|
-
encoder: b.fill,
|
|
671
|
-
transform: W
|
|
672
|
-
},
|
|
673
|
-
"fill-opacity": {
|
|
674
|
-
encoder: b.fillOpacity,
|
|
675
|
-
transform: (e) => +e * _
|
|
676
|
-
},
|
|
677
|
-
stroke: {
|
|
678
|
-
encoder: b.stroke,
|
|
679
|
-
transform: W
|
|
680
|
-
},
|
|
681
|
-
"stroke-opacity": {
|
|
682
|
-
encoder: b.strokeOpacity,
|
|
683
|
-
transform: (e) => +e * _
|
|
684
|
-
},
|
|
685
|
-
"stroke-width": {
|
|
686
|
-
encoder: b.strokeWidth,
|
|
687
|
-
transform: (e) => m(+e)
|
|
688
|
-
}
|
|
689
|
-
}), S = l.opacity > 0 ? {
|
|
690
|
-
fill: l.color,
|
|
691
|
-
"fill-opacity": 1,
|
|
692
|
-
stroke: l.color,
|
|
693
|
-
"stroke-opacity": 1,
|
|
694
|
-
opacity: p(l.opacity * _),
|
|
695
|
-
filter: t.getShadowFilterUrl(l)
|
|
696
|
-
} : null, w = 0;
|
|
697
|
-
for (let e of h) {
|
|
698
|
-
let [n, r] = z(f, b, e), [i, h] = ee(f, b, e), T = Math.min(n, r), E = Math.min(i, h), D = Math.abs(r - n), O = Math.abs(h - i), k = Ae(D, o), A = Ae(O, s), j = Math.max(c, k * A);
|
|
699
|
-
D < o && (T -= (o - D) / 2, D = o), O < s && (E -= (s - O) / 2, O = s);
|
|
700
|
-
let M = V(b.strokeWidth, e), N = W(b.fill(e)), P = V(b.fillOpacity, e) * _, F = M == 0 && P == 1 && j == 1 && d && N != "none" ? De : 0;
|
|
701
|
-
F && (T -= F, E -= F, D += F * 2, O += F * 2);
|
|
702
|
-
let I = M / 2, L = l.opacity > 0 ? l.blur + Math.max(Math.abs(l.offsetX), Math.abs(l.offsetY)) : 0;
|
|
703
|
-
if (!y(v, T, E, T + D, E + O, I + L) || (w++, t.countOnly)) continue;
|
|
704
|
-
let R = je(a, D, O), B = {
|
|
705
|
-
...x(e),
|
|
706
|
-
...j == 1 ? {} : { opacity: p(j) }
|
|
707
|
-
};
|
|
708
|
-
if (u != "none" && M > 0 && (B.fill = t.getRectHatchPatternUrl({
|
|
709
|
-
type: u,
|
|
710
|
-
fill: W(b.fill(e)),
|
|
711
|
-
fillOpacity: V(b.fillOpacity, e) * _,
|
|
712
|
-
stroke: W(b.stroke(e)),
|
|
713
|
-
strokeOpacity: V(b.strokeOpacity, e) * _,
|
|
714
|
-
strokeWidth: M
|
|
715
|
-
}), B["fill-opacity"] = 1), S) {
|
|
716
|
-
let e = ke(T, E, D, O, R, {
|
|
717
|
-
...S,
|
|
718
|
-
"stroke-width": m(M)
|
|
719
|
-
});
|
|
720
|
-
if (u == "none" && N != "none" && P == 1 && j == 1) g.appendChild(e);
|
|
721
|
-
else {
|
|
722
|
-
let n = M / 2, r = Object.fromEntries(Object.entries(R).map(([e, t]) => [e, t + n])), i = Pe(T - n, E - n, D + n * 2, O + n * 2, r), a = C("g", { "clip-path": t.getShadowClipPathUrl(i) });
|
|
723
|
-
a.appendChild(e), g.appendChild(a);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
g.appendChild(ke(T, E, D, O, R, B));
|
|
727
|
-
}
|
|
728
|
-
return w;
|
|
729
|
-
}
|
|
730
|
-
function ke(e, t, n, r, i, a) {
|
|
731
|
-
if (Me(i)) {
|
|
732
|
-
let o = i.topLeft, s = m(e), c = m(t), l = m(e + n), u = m(t + r);
|
|
733
|
-
return C("rect", {
|
|
734
|
-
x: s,
|
|
735
|
-
y: c,
|
|
736
|
-
width: m(l - s),
|
|
737
|
-
height: m(u - c),
|
|
738
|
-
...o ? {
|
|
739
|
-
rx: m(o),
|
|
740
|
-
ry: m(o)
|
|
741
|
-
} : {},
|
|
742
|
-
...a
|
|
743
|
-
});
|
|
744
|
-
} else return C("path", {
|
|
745
|
-
d: Pe(e, t, n, r, i),
|
|
746
|
-
...a
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
function Ae(e, t) {
|
|
750
|
-
return t > 0 && e < t ? e / t : 1;
|
|
751
|
-
}
|
|
752
|
-
function je(e, t, n) {
|
|
753
|
-
let r = Math.min(t, n) / 2;
|
|
754
|
-
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Math.min(t, r)]));
|
|
755
|
-
}
|
|
756
|
-
function Me(e) {
|
|
757
|
-
return Object.values(e).every((t) => t == e.topLeft);
|
|
758
|
-
}
|
|
759
|
-
function Ne(e) {
|
|
760
|
-
return Object.values(e).every((e) => e == 0);
|
|
761
|
-
}
|
|
762
|
-
function Pe(e, t, n, r, i) {
|
|
763
|
-
let a = e + n, o = t + r, { topLeft: s, topRight: c, bottomRight: l, bottomLeft: u } = i;
|
|
764
|
-
return [
|
|
765
|
-
`M ${Ie(e + s, t)}`,
|
|
766
|
-
`H ${m(a - c)}`,
|
|
767
|
-
Fe(c, a, t + c, a, t),
|
|
768
|
-
`V ${m(o - l)}`,
|
|
769
|
-
Fe(l, a - l, o, a, o),
|
|
770
|
-
`H ${m(e + u)}`,
|
|
771
|
-
Fe(u, e, o - u, e, o),
|
|
772
|
-
`V ${m(t + s)}`,
|
|
773
|
-
Fe(s, e + s, t, e, t),
|
|
774
|
-
"Z"
|
|
775
|
-
].join(" ");
|
|
776
|
-
}
|
|
777
|
-
function Fe(e, t, n, r, i) {
|
|
778
|
-
return e ? `A ${m(e)} ${m(e)} 0 0 1 ${Ie(t, n)}` : `L ${Ie(r, i)}`;
|
|
779
|
-
}
|
|
780
|
-
function Ie(e, t) {
|
|
781
|
-
return `${m(e)} ${m(t)}`;
|
|
782
|
-
}
|
|
783
|
-
//#endregion
|
|
784
|
-
//#region ../core/src/svg/renderers/rule.js
|
|
785
|
-
function Le(e, t) {
|
|
786
|
-
let n = e, r = U(n, n.properties.minLength), { coords: i, data: a, group: o, viewOpacity: s, visibleBounds: c } = t, l = n.encoders, u = n.properties.strokeDash, d = G(o, {
|
|
787
|
-
stroke: {
|
|
788
|
-
encoder: l.color,
|
|
789
|
-
transform: W
|
|
790
|
-
},
|
|
791
|
-
"stroke-opacity": {
|
|
792
|
-
encoder: l.opacity,
|
|
793
|
-
transform: (e) => +e * s
|
|
794
|
-
},
|
|
795
|
-
"stroke-width": {
|
|
796
|
-
encoder: l.size,
|
|
797
|
-
transform: (e) => m(+e)
|
|
798
|
-
}
|
|
799
|
-
});
|
|
800
|
-
o.setAttribute("stroke-linecap", "" + n.properties.strokeCap), u && (o.setAttribute("stroke-dasharray", u.map(m).join(" ")), o.setAttribute("stroke-dashoffset", "" + m(n.properties.strokeDashOffset)));
|
|
801
|
-
let f = 0;
|
|
802
|
-
for (let e of a) {
|
|
803
|
-
let [n, a] = z(i, l, e), [s, u] = ee(i, l, e), p = a - n, h = u - s, g = Math.hypot(p, h);
|
|
804
|
-
if (g > 0 && g < r) {
|
|
805
|
-
let e = (r - g) / 2, t = p / g, i = h / g;
|
|
806
|
-
n -= t * e, s -= i * e, a += t * e, u += i * e;
|
|
807
|
-
}
|
|
808
|
-
let _ = V(l.size, e) / 2;
|
|
809
|
-
y(c, n, s, a, u, _) && (f++, !t.countOnly && o.appendChild(C("line", {
|
|
810
|
-
x1: m(n),
|
|
811
|
-
y1: m(s),
|
|
812
|
-
x2: m(a),
|
|
813
|
-
y2: m(u),
|
|
814
|
-
...d(e)
|
|
815
|
-
})));
|
|
816
|
-
}
|
|
817
|
-
return f;
|
|
818
|
-
}
|
|
819
|
-
//#endregion
|
|
820
|
-
//#region ../core/src/svg/renderers/text.js
|
|
821
|
-
var Re = [
|
|
822
|
-
"Lato",
|
|
823
|
-
"Avenir Next",
|
|
824
|
-
"Avenir",
|
|
825
|
-
"Segoe UI",
|
|
826
|
-
"Ubuntu",
|
|
827
|
-
"Noto Sans",
|
|
828
|
-
"Helvetica Neue",
|
|
829
|
-
"Helvetica",
|
|
830
|
-
"Arial",
|
|
831
|
-
"sans-serif"
|
|
832
|
-
];
|
|
833
|
-
function ze(t, r) {
|
|
834
|
-
let i = t, a = i.properties, o = U(i, a.logoLetters), s = U(i, a.paddingX), c = U(i, a.paddingY), l = U(i, a.flushX), u = U(i, a.flushY), d = U(i, a.squeeze), f = U(i, a.dx), h = U(i, a.dy), { coords: g, data: _, group: y, viewOpacity: b, visibleBounds: x, anchorCullBounds: S } = r, w = i.encoders, T = i.encoding.text, E = "format" in T ? e(T.format) : (e) => e, D = G(y, {
|
|
835
|
-
fill: {
|
|
836
|
-
encoder: w.color,
|
|
837
|
-
transform: W
|
|
838
|
-
},
|
|
839
|
-
"fill-opacity": {
|
|
840
|
-
encoder: w.opacity,
|
|
841
|
-
transform: (e) => +e * b
|
|
842
|
-
},
|
|
843
|
-
"font-size": {
|
|
844
|
-
encoder: w.size,
|
|
845
|
-
transform: (e) => m(+e)
|
|
846
|
-
}
|
|
847
|
-
});
|
|
848
|
-
y.setAttribute("font-family", Be(a.font)), y.setAttribute("font-style", a.fontStyle ?? "normal"), y.setAttribute("font-weight", "" + Qe(a.fontWeight ?? "normal")), y.setAttribute("text-anchor", Ye[a.align]);
|
|
849
|
-
let O = {
|
|
850
|
-
top: {
|
|
851
|
-
width: U(i, a.viewportEdgeFadeWidthTop),
|
|
852
|
-
distance: U(i, a.viewportEdgeFadeDistanceTop)
|
|
853
|
-
},
|
|
854
|
-
right: {
|
|
855
|
-
width: U(i, a.viewportEdgeFadeWidthRight),
|
|
856
|
-
distance: U(i, a.viewportEdgeFadeDistanceRight)
|
|
857
|
-
},
|
|
858
|
-
bottom: {
|
|
859
|
-
width: U(i, a.viewportEdgeFadeWidthBottom),
|
|
860
|
-
distance: U(i, a.viewportEdgeFadeDistanceBottom)
|
|
861
|
-
},
|
|
862
|
-
left: {
|
|
863
|
-
width: U(i, a.viewportEdgeFadeWidthLeft),
|
|
864
|
-
distance: U(i, a.viewportEdgeFadeDistanceLeft)
|
|
865
|
-
}
|
|
866
|
-
}, k = 0;
|
|
867
|
-
for (let e of _) {
|
|
868
|
-
let t = E(w.text(e)), _ = n(t) ? t : t === null ? "" : "" + t;
|
|
869
|
-
if (!_) continue;
|
|
870
|
-
let [b, T] = z(g, w, e), [O, A] = ee(g, w, e), j = V(w.size, e), M = V(w.angle, e), N = !!w.x2, P = !!w.y2;
|
|
871
|
-
if (o) {
|
|
872
|
-
_.length > 1 && r.warn("SVG export stretches multi-character logo text as a single glyph cell.");
|
|
873
|
-
let t = j, n = j;
|
|
874
|
-
N && (t = T - b, b = (b + T) / 2), P && (n = O - A, O = (O + A) / 2);
|
|
875
|
-
let a = i.font.metrics.getChar(_[0]), o = n * i.font.metrics.common.base * (a.height + 10) / (a.height * a.height);
|
|
876
|
-
if (!t || !n || v(S, b, O) || !He(x, b, O, Math.abs(t), Math.abs(n), "center", "middle", M, f, h) || (k++, r.countOnly)) continue;
|
|
877
|
-
let s = [`translate(${m(b)} ${m(O)})`];
|
|
878
|
-
M && s.push(`rotate(${m(M)})`), (f || h) && s.push(`translate(${m(f)} ${m(h)})`), s.push(`scale(${m(t)} ${m(o)})`);
|
|
879
|
-
let c = C("text", {
|
|
880
|
-
x: 0,
|
|
881
|
-
y: 0,
|
|
882
|
-
dy: Xe("middle", 1),
|
|
883
|
-
"text-anchor": "middle",
|
|
884
|
-
lengthAdjust: "spacingAndGlyphs",
|
|
885
|
-
textLength: 1,
|
|
886
|
-
transform: s.join(" "),
|
|
887
|
-
...D(e),
|
|
888
|
-
"font-size": 1
|
|
889
|
-
});
|
|
890
|
-
c.textContent = _, y.appendChild(c);
|
|
891
|
-
continue;
|
|
892
|
-
}
|
|
893
|
-
let F = i.font.metrics.measureWidth(_, j), I = Ue(F, j, M), L = N || P ? Ge(a.align, a.baseline, M) : {
|
|
894
|
-
x: qe[a.align],
|
|
895
|
-
y: Je[a.baseline]
|
|
896
|
-
}, R = 1;
|
|
897
|
-
if (N) {
|
|
898
|
-
let e = We(Math.min(b, T), Math.max(b, T), I.width, s, L.x, l, g.x, g.x2);
|
|
899
|
-
b = e.position, R *= e.scale;
|
|
900
|
-
}
|
|
901
|
-
if (P) {
|
|
902
|
-
let e = We(Math.min(O, A), Math.max(O, A), I.height * R, c, L.y, u, g.y, g.y2);
|
|
903
|
-
O = e.position, R *= e.scale;
|
|
904
|
-
}
|
|
905
|
-
if (v(S, b, O)) continue;
|
|
906
|
-
let B = 1;
|
|
907
|
-
if (R < 1) {
|
|
908
|
-
if (!d || R < 3 / j) continue;
|
|
909
|
-
B = Ke(3 / j, 6 / j, R);
|
|
910
|
-
}
|
|
911
|
-
let H = j * R, te = F * R;
|
|
912
|
-
if (!He(x, b, O, te, H, a.align, a.baseline, M, f, h) || (k++, r.countOnly)) continue;
|
|
913
|
-
let U = m(b), W = m(O), G = C("text", {
|
|
914
|
-
x: U,
|
|
915
|
-
y: W,
|
|
916
|
-
dx: m(f),
|
|
917
|
-
dy: m(h + Xe(a.baseline, H)),
|
|
918
|
-
lengthAdjust: "spacingAndGlyphs",
|
|
919
|
-
textLength: m(te),
|
|
920
|
-
...D(e),
|
|
921
|
-
...R == 1 ? {} : { "font-size": m(H) },
|
|
922
|
-
...B == 1 ? {} : { opacity: p(B) }
|
|
923
|
-
});
|
|
924
|
-
G.textContent = _, M && G.setAttribute("transform", `rotate(${m(M)} ${U} ${W})`), y.appendChild(G);
|
|
925
|
-
}
|
|
926
|
-
if (!r.countOnly && y.childElementCount > 0) {
|
|
927
|
-
let e = r.getViewportEdgeFadeMaskUrl(O);
|
|
928
|
-
e && y.setAttribute("mask", e);
|
|
929
|
-
}
|
|
930
|
-
return k;
|
|
931
|
-
}
|
|
932
|
-
function Be(e) {
|
|
933
|
-
let t = e ?? "Lato";
|
|
934
|
-
return [t, ...Re.filter((e) => e.toLowerCase() != t.toLowerCase())].map(Ve).join(", ");
|
|
935
|
-
}
|
|
936
|
-
function Ve(e) {
|
|
937
|
-
return e == "sans-serif" ? e : `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
938
|
-
}
|
|
939
|
-
function He(e, t, n, r, i, a, o, s, c, l) {
|
|
940
|
-
let u = t + c - (qe[a] + 1) / 2 * r, d = n + l - (Je[o] + 1) / 2 * i, f = u + r, p = d + i;
|
|
941
|
-
if (!s) return y(e, u, d, f, p, 1);
|
|
942
|
-
let m = s * Math.PI / 180, h = Math.sin(m), g = Math.cos(m), _ = t + (u - t) * g - (d - n) * h, v = n + (u - t) * h + (d - n) * g, b = t + (f - t) * g - (d - n) * h, x = n + (f - t) * h + (d - n) * g, S = t + (f - t) * g - (p - n) * h, C = n + (f - t) * h + (p - n) * g, w = t + (u - t) * g - (p - n) * h, T = n + (u - t) * h + (p - n) * g;
|
|
943
|
-
return y(e, Math.min(_, b, S, w), Math.min(v, x, C, T), Math.max(_, b, S, w), Math.max(v, x, C, T), 1);
|
|
944
|
-
}
|
|
945
|
-
function Ue(e, t, n) {
|
|
946
|
-
let r = n * Math.PI / 180, i = Math.abs(Math.sin(r)), a = Math.abs(Math.cos(r));
|
|
947
|
-
return {
|
|
948
|
-
width: e * a + t * i,
|
|
949
|
-
height: e * i + t * a
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
function We(e, t, n, r, i, a, o, s) {
|
|
953
|
-
let c = t - e, l = n + 2 * r;
|
|
954
|
-
if (e > s || t < o) return {
|
|
955
|
-
position: 0,
|
|
956
|
-
scale: 0
|
|
957
|
-
};
|
|
958
|
-
let u = Math.max(0, c - l), d;
|
|
959
|
-
if (i == 0) {
|
|
960
|
-
let n = e + t;
|
|
961
|
-
if (a) {
|
|
962
|
-
let e = Math.max(0, 2 * o + l - n);
|
|
963
|
-
n += Math.min(e, u);
|
|
964
|
-
let t = Math.max(0, l + n - 2 * s);
|
|
965
|
-
n -= Math.min(t, u);
|
|
966
|
-
}
|
|
967
|
-
d = n / 2;
|
|
968
|
-
} else if (i < 0) {
|
|
969
|
-
let t = e;
|
|
970
|
-
a && (t += Math.min(Math.max(0, o - t), u)), d = t + r;
|
|
971
|
-
} else {
|
|
972
|
-
let e = t;
|
|
973
|
-
a && (e -= Math.min(Math.max(0, e - s), u)), d = e - r;
|
|
974
|
-
}
|
|
975
|
-
return {
|
|
976
|
-
position: d,
|
|
977
|
-
scale: Math.max(0, Math.min(1, (c - r) / l))
|
|
978
|
-
};
|
|
979
|
-
}
|
|
980
|
-
function Ge(e, t, n) {
|
|
981
|
-
let r = qe[e], i = -Je[t], a = ((n + 45) % 360 + 360) % 360, o, s;
|
|
982
|
-
return a < 90 ? (o = r, s = i) : a < 180 ? (o = i, s = -r) : a < 270 ? (o = -r, s = i) : (o = -i, s = r), {
|
|
983
|
-
x: o,
|
|
984
|
-
y: -s
|
|
985
|
-
};
|
|
986
|
-
}
|
|
987
|
-
function Ke(e, t, n) {
|
|
988
|
-
return Math.max(0, Math.min(1, (n - e) / (t - e)));
|
|
989
|
-
}
|
|
990
|
-
var qe = {
|
|
991
|
-
left: -1,
|
|
992
|
-
center: 0,
|
|
993
|
-
right: 1
|
|
994
|
-
}, Je = {
|
|
995
|
-
top: -1,
|
|
996
|
-
middle: 0,
|
|
997
|
-
bottom: 1,
|
|
998
|
-
alphabetic: 1,
|
|
999
|
-
baseline: 1
|
|
1000
|
-
}, Ye = {
|
|
1001
|
-
left: "start",
|
|
1002
|
-
center: "middle",
|
|
1003
|
-
right: "end"
|
|
1004
|
-
};
|
|
1005
|
-
function Xe(e, t) {
|
|
1006
|
-
switch (e) {
|
|
1007
|
-
case "top": return .79 * t;
|
|
1008
|
-
case "middle": return .35 * t;
|
|
1009
|
-
case "bottom": return -.21 * t;
|
|
1010
|
-
case "alphabetic":
|
|
1011
|
-
case "baseline": return 0;
|
|
1012
|
-
default: throw Error(`Unknown text baseline: ${e}`);
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
var Ze = {
|
|
1016
|
-
thin: 100,
|
|
1017
|
-
light: 300,
|
|
1018
|
-
regular: 400,
|
|
1019
|
-
normal: 400,
|
|
1020
|
-
medium: 500,
|
|
1021
|
-
bold: 700,
|
|
1022
|
-
black: 900
|
|
1023
|
-
};
|
|
1024
|
-
function Qe(e) {
|
|
1025
|
-
return typeof e == "number" ? e : Ze[e];
|
|
1026
|
-
}
|
|
1027
|
-
//#endregion
|
|
1028
|
-
//#region ../core/src/svg/legendGradient.js
|
|
1029
|
-
var $e = 64;
|
|
1030
|
-
function et(e, t) {
|
|
1031
|
-
let n = nt(e.unitView);
|
|
1032
|
-
if (!n) return;
|
|
1033
|
-
let r = e.unitView.getScaleResolution(n.channel)?.getScale();
|
|
1034
|
-
if (!r || !a(r.type)) return;
|
|
1035
|
-
let { coords: i, data: o, group: s, viewOpacity: c, visibleBounds: l } = t;
|
|
1036
|
-
if (!o.length) return 0;
|
|
1037
|
-
let u = e.encoders, d = n.channel == "stroke" ? u.stroke : u.fill, f = rt(e.unitView.spec.encoding.x), h = Infinity, g = Infinity, _ = -Infinity, v = -Infinity, b = o.map((e) => {
|
|
1038
|
-
let [t, n] = z(i, u, e), [r, a] = ee(i, u, e);
|
|
1039
|
-
return h = Math.min(h, t, n), g = Math.min(g, r, a), _ = Math.max(_, t, n), v = Math.max(v, r, a), {
|
|
1040
|
-
offset: Number(e.position),
|
|
1041
|
-
color: W(d(e))
|
|
1042
|
-
};
|
|
1043
|
-
}).sort((e, t) => e.offset - t.offset);
|
|
1044
|
-
if (!y(l, h, g, _, v)) return 0;
|
|
1045
|
-
if (t.countOnly) return o.length;
|
|
1046
|
-
let x = tt(b), S = [
|
|
1047
|
-
{
|
|
1048
|
-
offset: 0,
|
|
1049
|
-
color: x[0].color
|
|
1050
|
-
},
|
|
1051
|
-
...x,
|
|
1052
|
-
{
|
|
1053
|
-
offset: 1,
|
|
1054
|
-
color: x.at(-1).color
|
|
1055
|
-
}
|
|
1056
|
-
], w = t.getLegendGradientUrl({
|
|
1057
|
-
x1: h,
|
|
1058
|
-
y1: f ? g : v,
|
|
1059
|
-
x2: f ? _ : h,
|
|
1060
|
-
y2: g,
|
|
1061
|
-
stops: S
|
|
1062
|
-
}), T = m(h), E = m(g), D = m(_), O = m(v), k = Number(u.fillOpacity(o[0])) * c;
|
|
1063
|
-
return s.appendChild(C("rect", {
|
|
1064
|
-
x: T,
|
|
1065
|
-
y: E,
|
|
1066
|
-
width: m(D - T),
|
|
1067
|
-
height: m(O - E),
|
|
1068
|
-
fill: w,
|
|
1069
|
-
"fill-opacity": p(k),
|
|
1070
|
-
stroke: "none"
|
|
1071
|
-
})), o.length;
|
|
1072
|
-
}
|
|
1073
|
-
function tt(e) {
|
|
1074
|
-
return e.length <= $e ? e : Array.from({ length: $e }, (t, n) => e[Math.round(n * (e.length - 1) / ($e - 1))]);
|
|
1075
|
-
}
|
|
1076
|
-
function nt(e) {
|
|
1077
|
-
let t = e;
|
|
1078
|
-
for (; t;) {
|
|
1079
|
-
let e = t.spec.data;
|
|
1080
|
-
if (e) return "lazy" in e && e.lazy.type == "legendGradient" ? e.lazy : void 0;
|
|
1081
|
-
t = t.dataParent;
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
function rt(e) {
|
|
1085
|
-
return e != null && "field" in e && (e.field == "position0" || e.field == "position1");
|
|
1086
|
-
}
|
|
1087
|
-
//#endregion
|
|
1088
|
-
//#region ../core/src/svg/renderers/index.js
|
|
1089
|
-
var it = /* @__PURE__ */ new Map([
|
|
1090
|
-
["arrow", ne],
|
|
1091
|
-
["link", pe],
|
|
1092
|
-
["point", Ce],
|
|
1093
|
-
["rect", Oe],
|
|
1094
|
-
["rule", Le],
|
|
1095
|
-
["text", ze],
|
|
1096
|
-
["tick", Le]
|
|
1097
|
-
]);
|
|
1098
|
-
function at(e, t) {
|
|
1099
|
-
if (e.getType() == "rect") {
|
|
1100
|
-
let n = et(e, t);
|
|
1101
|
-
if (n !== void 0) return n;
|
|
1102
|
-
}
|
|
1103
|
-
let n = it.get(e.getType());
|
|
1104
|
-
if (!n) throw Error(`SVG rendering is not implemented for mark type "${e.getType()}". View: ${e.unitView.getPathString()}`);
|
|
1105
|
-
return n(e, t);
|
|
1106
|
-
}
|
|
1107
|
-
//#endregion
|
|
1108
|
-
//#region ../core/src/svg/rectHatchPattern.js
|
|
1109
|
-
function ot(e, t) {
|
|
1110
|
-
let n = t.strokeWidth, r = [
|
|
1111
|
-
"dots",
|
|
1112
|
-
"rings",
|
|
1113
|
-
"ringsLarge"
|
|
1114
|
-
].includes(t.type), i = [
|
|
1115
|
-
"diagonal",
|
|
1116
|
-
"antiDiagonal",
|
|
1117
|
-
"cross"
|
|
1118
|
-
].includes(t.type), a = [
|
|
1119
|
-
"vertical",
|
|
1120
|
-
"horizontal",
|
|
1121
|
-
"grid"
|
|
1122
|
-
].includes(t.type), o = r ? n * 7 : n * (i ? 6 : 4), s = a ? n * 2 : n, c = o, l = r ? o * 2 : o, u = C("pattern", {
|
|
1123
|
-
id: e,
|
|
1124
|
-
x: 0,
|
|
1125
|
-
y: 0,
|
|
1126
|
-
width: m(c),
|
|
1127
|
-
height: m(l),
|
|
1128
|
-
patternUnits: "userSpaceOnUse"
|
|
1129
|
-
});
|
|
1130
|
-
u.appendChild(C("rect", {
|
|
1131
|
-
width: m(c),
|
|
1132
|
-
height: m(l),
|
|
1133
|
-
fill: t.fill,
|
|
1134
|
-
"fill-opacity": p(t.fillOpacity)
|
|
1135
|
-
}));
|
|
1136
|
-
let d = C("g", {
|
|
1137
|
-
fill: "none",
|
|
1138
|
-
stroke: t.stroke,
|
|
1139
|
-
"stroke-opacity": p(t.strokeOpacity),
|
|
1140
|
-
"stroke-width": m(s),
|
|
1141
|
-
"stroke-linecap": "square"
|
|
1142
|
-
});
|
|
1143
|
-
return st(d, t.type, o, s), u.appendChild(d), u;
|
|
1144
|
-
}
|
|
1145
|
-
function st(e, t, n, r) {
|
|
1146
|
-
let i = (t) => e.appendChild(C("path", { d: t })), a = (e) => m(e), o = (e) => {
|
|
1147
|
-
for (let t of [
|
|
1148
|
-
-n,
|
|
1149
|
-
0,
|
|
1150
|
-
n
|
|
1151
|
-
]) i(`M ${a(t - r)} ${a(e ? -r : n + r)} L ${a(t + n + r)} ${a(e ? n + r : -r)}`);
|
|
1152
|
-
};
|
|
1153
|
-
switch (t) {
|
|
1154
|
-
case "diagonal":
|
|
1155
|
-
o(!0);
|
|
1156
|
-
break;
|
|
1157
|
-
case "antiDiagonal":
|
|
1158
|
-
o(!1);
|
|
1159
|
-
break;
|
|
1160
|
-
case "cross":
|
|
1161
|
-
o(!0), o(!1);
|
|
1162
|
-
break;
|
|
1163
|
-
case "vertical":
|
|
1164
|
-
i(`M 0 ${a(-r)} V ${a(n + r)}`);
|
|
1165
|
-
break;
|
|
1166
|
-
case "horizontal":
|
|
1167
|
-
i(`M ${a(-r)} 0 H ${a(n + r)}`);
|
|
1168
|
-
break;
|
|
1169
|
-
case "grid":
|
|
1170
|
-
i(`M 0 ${a(-r)} V ${a(n + r)} M ${a(-r)} 0 H ${a(n + r)}`);
|
|
1171
|
-
break;
|
|
1172
|
-
case "dots":
|
|
1173
|
-
case "rings":
|
|
1174
|
-
case "ringsLarge": {
|
|
1175
|
-
let r = n * (t == "dots" ? .07 : t == "rings" ? .2 : .35), i = (t, n) => e.appendChild(C("circle", {
|
|
1176
|
-
cx: m(t),
|
|
1177
|
-
cy: m(n),
|
|
1178
|
-
r: m(r)
|
|
1179
|
-
}));
|
|
1180
|
-
i(n / 2, 0), i(n / 2, n * 2), i(0, n), i(n, n);
|
|
1181
|
-
break;
|
|
1182
|
-
}
|
|
1183
|
-
default: throw Error(`Unknown rectangle hatch pattern: ${t}`);
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
//#endregion
|
|
1187
|
-
//#region ../core/src/svg/linkArcFadeMask.js
|
|
1188
|
-
var ct = 4;
|
|
1189
|
-
function lt(e, t, n) {
|
|
1190
|
-
let r = t[0] - e[0], i = t[1] - e[1], a = Math.hypot(r, i);
|
|
1191
|
-
if (a == 0) return;
|
|
1192
|
-
let o = -i / a, s = r / a;
|
|
1193
|
-
(o < 0 || o == 0 && s < 0) && (o = -o, s = -s);
|
|
1194
|
-
let c = o * e[0] + s * e[1], [l, u] = n, d = JSON.stringify([
|
|
1195
|
-
$(o, 6),
|
|
1196
|
-
$(s, 6),
|
|
1197
|
-
$(c, 1),
|
|
1198
|
-
$(l, 1),
|
|
1199
|
-
$(u, 1)
|
|
1200
|
-
]);
|
|
1201
|
-
return {
|
|
1202
|
-
normalX: o,
|
|
1203
|
-
normalY: s,
|
|
1204
|
-
offset: c,
|
|
1205
|
-
start: l,
|
|
1206
|
-
end: u,
|
|
1207
|
-
key: d
|
|
1208
|
-
};
|
|
1209
|
-
}
|
|
1210
|
-
function ut(e, t, n, r) {
|
|
1211
|
-
let { normalX: i, normalY: a, offset: o, start: s, end: c } = r, l = i * o, u = a * o, d = e + "-gradient", f = C("linearGradient", {
|
|
1212
|
-
id: d,
|
|
1213
|
-
gradientUnits: "userSpaceOnUse",
|
|
1214
|
-
x1: m(l - i * c),
|
|
1215
|
-
y1: m(u - a * c),
|
|
1216
|
-
x2: m(l + i * c),
|
|
1217
|
-
y2: m(u + a * c),
|
|
1218
|
-
spreadMethod: "pad"
|
|
1219
|
-
});
|
|
1220
|
-
for (let { offset: e, opacity: t } of dt(s, c)) f.appendChild(C("stop", {
|
|
1221
|
-
offset: $(e, 3),
|
|
1222
|
-
"stop-color": "white",
|
|
1223
|
-
"stop-opacity": $(t, 3)
|
|
1224
|
-
}));
|
|
1225
|
-
let p = C("mask", {
|
|
1226
|
-
id: e,
|
|
1227
|
-
x: 0,
|
|
1228
|
-
y: 0,
|
|
1229
|
-
width: m(t),
|
|
1230
|
-
height: m(n),
|
|
1231
|
-
maskUnits: "userSpaceOnUse",
|
|
1232
|
-
maskContentUnits: "userSpaceOnUse",
|
|
1233
|
-
"mask-type": "luminance"
|
|
1234
|
-
});
|
|
1235
|
-
return p.appendChild(C("rect", {
|
|
1236
|
-
width: m(t),
|
|
1237
|
-
height: m(n),
|
|
1238
|
-
fill: `url(#${d})`
|
|
1239
|
-
})), {
|
|
1240
|
-
gradient: f,
|
|
1241
|
-
mask: p
|
|
1242
|
-
};
|
|
1243
|
-
}
|
|
1244
|
-
function dt(e, t) {
|
|
1245
|
-
let n = [], r = (r) => {
|
|
1246
|
-
for (let i = 0; i <= ct; i++) {
|
|
1247
|
-
let a = i / ct, 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);
|
|
1248
|
-
n.push({
|
|
1249
|
-
offset: s,
|
|
1250
|
-
opacity: 1 - ft(c)
|
|
1251
|
-
});
|
|
1252
|
-
}
|
|
1253
|
-
};
|
|
1254
|
-
return r(!0), r(!1), n;
|
|
1255
|
-
}
|
|
1256
|
-
function ft(e) {
|
|
1257
|
-
let t = Math.max(0, Math.min(1, e));
|
|
1258
|
-
return t * t * (3 - 2 * t);
|
|
1259
|
-
}
|
|
1260
|
-
function $(e, t) {
|
|
1261
|
-
let n = 10 ** t;
|
|
1262
|
-
return Math.round(e * n) / n;
|
|
1263
|
-
}
|
|
1264
|
-
//#endregion
|
|
1265
|
-
//#region ../core/src/svg/svgViewRenderingContext.js
|
|
1266
|
-
var pt = class extends f {
|
|
1267
|
-
#e;
|
|
1268
|
-
#t;
|
|
1269
|
-
#n = [];
|
|
1270
|
-
#r = /* @__PURE__ */ new Map();
|
|
1271
|
-
#i = /* @__PURE__ */ new WeakMap();
|
|
1272
|
-
#a = /* @__PURE__ */ new Map();
|
|
1273
|
-
#o = /* @__PURE__ */ new Map();
|
|
1274
|
-
#s = /* @__PURE__ */ new Map();
|
|
1275
|
-
#c = /* @__PURE__ */ new Map();
|
|
1276
|
-
#l = /* @__PURE__ */ new Set();
|
|
1277
|
-
#u = !1;
|
|
1278
|
-
#d = /* @__PURE__ */ new Map();
|
|
1279
|
-
#f = C("g");
|
|
1280
|
-
#p;
|
|
1281
|
-
#m;
|
|
1282
|
-
#h = [];
|
|
1283
|
-
#g;
|
|
1284
|
-
#_ = 0;
|
|
1285
|
-
#v = 0;
|
|
1286
|
-
#y = 0;
|
|
1287
|
-
#b = 0;
|
|
1288
|
-
#x = 0;
|
|
1289
|
-
#S = 0;
|
|
1290
|
-
#C = 0;
|
|
1291
|
-
constructor(e, t) {
|
|
1292
|
-
super(e), this.width = t.width, this.height = t.height, this.#m = t.maxVectorInstances;
|
|
1293
|
-
let n = m(t.width), r = m(t.height);
|
|
1294
|
-
this.#e = C("svg", {
|
|
1295
|
-
xmlns: S,
|
|
1296
|
-
width: n,
|
|
1297
|
-
height: r,
|
|
1298
|
-
viewBox: `0 0 ${n} ${r}`
|
|
1299
|
-
}), this.#t = C("defs"), this.#e.appendChild(this.#t), t.background != null && this.#e.appendChild(C("rect", {
|
|
1300
|
-
width: n,
|
|
1301
|
-
height: r,
|
|
1302
|
-
fill: t.background,
|
|
1303
|
-
"data-export-background": ""
|
|
1304
|
-
}));
|
|
1305
|
-
}
|
|
1306
|
-
beginInstanceCounting() {
|
|
1307
|
-
if (this.#n.length || this.#u) throw Error("Cannot start SVG instance counting during traversal.");
|
|
1308
|
-
this.#d = /* @__PURE__ */ new Map(), this.#u = !0;
|
|
1309
|
-
}
|
|
1310
|
-
endInstanceCounting() {
|
|
1311
|
-
if (this.#n.length || !this.#u) throw Error("SVG instance counting is not active or traversal is incomplete.");
|
|
1312
|
-
this.#u = !1;
|
|
1313
|
-
}
|
|
1314
|
-
getVisibleInstanceCount(e) {
|
|
1315
|
-
return this.#d.get(e) ?? 0;
|
|
1316
|
-
}
|
|
1317
|
-
getVisibleInstanceCounts() {
|
|
1318
|
-
return new Map(this.#d);
|
|
1319
|
-
}
|
|
1320
|
-
getRasterRuns() {
|
|
1321
|
-
this.#T();
|
|
1322
|
-
for (let e of this.#h) e.image || this.#E(e);
|
|
1323
|
-
return this.#h;
|
|
1324
|
-
}
|
|
1325
|
-
beginSampleFacetBatch() {
|
|
1326
|
-
if (this.#p) throw Error("Nested sample facet batches are not supported.");
|
|
1327
|
-
this.#p = {
|
|
1328
|
-
viewGroups: /* @__PURE__ */ new WeakMap(),
|
|
1329
|
-
markGroups: /* @__PURE__ */ new WeakMap(),
|
|
1330
|
-
markGroupElements: /* @__PURE__ */ new Set(),
|
|
1331
|
-
rasterRuns: /* @__PURE__ */ new WeakMap()
|
|
1332
|
-
};
|
|
1333
|
-
}
|
|
1334
|
-
endSampleFacetBatch() {
|
|
1335
|
-
let e = this.#p;
|
|
1336
|
-
if (!e) throw Error("No sample facet batch is active.");
|
|
1337
|
-
for (let t of e.markGroupElements) t.childElementCount || t.remove();
|
|
1338
|
-
this.#p = void 0;
|
|
1339
|
-
}
|
|
1340
|
-
pushView(e, n) {
|
|
1341
|
-
let r = e.getPathString();
|
|
1342
|
-
if (t(this.#n)?.exportExcluded || o(e) && e.name.startsWith("scrollbar-")) {
|
|
1343
|
-
this.#n.push({
|
|
1344
|
-
view: e,
|
|
1345
|
-
node: this.currentNode,
|
|
1346
|
-
coords: n,
|
|
1347
|
-
exportExcluded: !0
|
|
1348
|
-
});
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
if (this.#u) {
|
|
1352
|
-
this.#n.push({
|
|
1353
|
-
view: e,
|
|
1354
|
-
node: this.currentNode,
|
|
1355
|
-
coords: n,
|
|
1356
|
-
exportExcluded: !1
|
|
1357
|
-
});
|
|
1358
|
-
return;
|
|
1359
|
-
}
|
|
1360
|
-
let i = this.#p, a = i?.viewGroups.get(e);
|
|
1361
|
-
if (a) {
|
|
1362
|
-
if (a.parentNode !== this.currentNode) throw Error(`Sample-faceted view was rendered under multiple parents: ${r}`);
|
|
1363
|
-
} else {
|
|
1364
|
-
a = C("g", {
|
|
1365
|
-
id: mt(e.name, this.#_++),
|
|
1366
|
-
"data-name": e.name,
|
|
1367
|
-
"data-view-path": r
|
|
1368
|
-
});
|
|
1369
|
-
let t = C("title");
|
|
1370
|
-
t.textContent = r, a.appendChild(t), this.currentNode.appendChild(a), i?.viewGroups.set(e, a);
|
|
1371
|
-
}
|
|
1372
|
-
this.#n.push({
|
|
1373
|
-
view: e,
|
|
1374
|
-
node: a,
|
|
1375
|
-
coords: n,
|
|
1376
|
-
exportExcluded: !1
|
|
1377
|
-
});
|
|
1378
|
-
}
|
|
1379
|
-
popView(e) {
|
|
1380
|
-
if (this.#n.pop()?.view !== e) throw Error("Unbalanced SVG view rendering context stack.");
|
|
1381
|
-
}
|
|
1382
|
-
renderMark(e, n) {
|
|
1383
|
-
if (t(this.#n)?.exportExcluded || e.unitView.getEffectiveOpacity() <= 0) return;
|
|
1384
|
-
let r = l(n), i = u(r, e.properties.clip, this.currentCoords), a = h(this.width, this.height, i);
|
|
1385
|
-
if (!_(a)) return;
|
|
1386
|
-
let o = this.getVisibleInstanceCount(e);
|
|
1387
|
-
if (!this.#u && this.#m != null && o == 0) return;
|
|
1388
|
-
if (!this.#u && this.#m != null && o > this.#m) {
|
|
1389
|
-
this.#w(e, a);
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
let s = !this.#u && this.#p != null, c = s ? this.getClipPathUrl(i) : void 0, d = s ? this.#p.markGroups.get(e)?.get(c ?? "") : void 0;
|
|
1393
|
-
!this.#u && !d && this.#T();
|
|
1394
|
-
let f = this.#u ? this.#f : this.#D(e, c), p = g(this.currentCoords, r, e.properties.cullByVisibleRange), m = x(e, n), v = (t, n) => {
|
|
1395
|
-
let r = at(e, {
|
|
1396
|
-
coords: t,
|
|
1397
|
-
data: n,
|
|
1398
|
-
group: f,
|
|
1399
|
-
visibleBounds: a,
|
|
1400
|
-
anchorCullBounds: p,
|
|
1401
|
-
viewOpacity: e.unitView.getEffectiveOpacity(),
|
|
1402
|
-
countOnly: this.#u,
|
|
1403
|
-
getViewportEdgeFadeMaskUrl: (e) => this.#u ? void 0 : this.getViewportEdgeFadeMaskUrl(e),
|
|
1404
|
-
getShadowFilterUrl: (e) => this.#u ? "" : this.getShadowFilterUrl(e),
|
|
1405
|
-
getShadowClipPathUrl: (e) => this.#u ? "" : this.getShadowClipPathUrl(e),
|
|
1406
|
-
getRectHatchPatternUrl: (e) => this.#u ? "" : this.getRectHatchPatternUrl(e),
|
|
1407
|
-
getLinkArcFadeMaskUrl: (e) => this.#u ? void 0 : this.getLinkArcFadeMaskUrl(e),
|
|
1408
|
-
getLegendGradientUrl: (e) => this.#u ? "" : this.getLegendGradientUrl(e),
|
|
1409
|
-
warn: (t) => {
|
|
1410
|
-
this.#u || this.#l.add(`${t} View: ${e.unitView.getPathString()}`);
|
|
1411
|
-
}
|
|
1412
|
-
});
|
|
1413
|
-
this.#u && this.#d.set(e, this.getVisibleInstanceCount(e) + r);
|
|
1414
|
-
};
|
|
1415
|
-
if (n.sampleFacetRenderingOptions) v(ht(this.currentCoords, n.sampleFacetRenderingOptions), m);
|
|
1416
|
-
else if (e.encoders.facetIndex) for (let [t, n] of gt(e.encoders.facetIndex, m)) {
|
|
1417
|
-
let r = this.#O(e, t);
|
|
1418
|
-
r ? v(ht(this.currentCoords, {
|
|
1419
|
-
locSize: r,
|
|
1420
|
-
pixelToUnit: 1
|
|
1421
|
-
}), n) : this.#l.add(`SVG export could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`);
|
|
1422
|
-
}
|
|
1423
|
-
else v(this.currentCoords, m);
|
|
1424
|
-
if (!this.#u && !s && f.childElementCount > 0) {
|
|
1425
|
-
let e = this.getClipPathUrl(i);
|
|
1426
|
-
e && f.setAttribute("clip-path", e), this.currentNode.appendChild(f);
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
#w(e, t) {
|
|
1430
|
-
let n = this.#p?.rasterRuns.get(e);
|
|
1431
|
-
if (n) {
|
|
1432
|
-
_t(n.bounds, t), n.viewNodes.add(this.currentNode);
|
|
1433
|
-
return;
|
|
1434
|
-
}
|
|
1435
|
-
let r = this.#g;
|
|
1436
|
-
if (r) _t(r.bounds, t);
|
|
1437
|
-
else {
|
|
1438
|
-
let e = document.createComment("raster-run");
|
|
1439
|
-
this.currentNode.appendChild(e), r = {
|
|
1440
|
-
marks: /* @__PURE__ */ new Set(),
|
|
1441
|
-
targets: [],
|
|
1442
|
-
viewNodes: /* @__PURE__ */ new Set(),
|
|
1443
|
-
anchor: e,
|
|
1444
|
-
bounds: { ...t },
|
|
1445
|
-
image: void 0
|
|
1446
|
-
}, this.#g = r;
|
|
1447
|
-
}
|
|
1448
|
-
r.marks.add(e), r.targets.push({
|
|
1449
|
-
mark: e,
|
|
1450
|
-
instanceCount: this.getVisibleInstanceCount(e)
|
|
1451
|
-
}), r.viewNodes.add(this.currentNode), this.#p?.rasterRuns.set(e, r);
|
|
1452
|
-
}
|
|
1453
|
-
#T() {
|
|
1454
|
-
let e = this.#g;
|
|
1455
|
-
e && (this.#h.push(e), this.#g = void 0);
|
|
1456
|
-
}
|
|
1457
|
-
#E(e) {
|
|
1458
|
-
let t = vt(e.viewNodes), n = e.targets.map((e) => e.mark.getType()), r = C("g", {
|
|
1459
|
-
id: `rasterized-${n.join("-")}-${this.#C++}`,
|
|
1460
|
-
"data-name": `Rasterized ${n.join(", ")}`,
|
|
1461
|
-
"data-rasterized": ""
|
|
1462
|
-
}), i = C("image", { preserveAspectRatio: "none" });
|
|
1463
|
-
r.appendChild(i);
|
|
1464
|
-
let a = e.anchor.parentNode;
|
|
1465
|
-
t == a ? t.insertBefore(r, e.anchor) : t.insertBefore(r, yt(a, t)), e.anchor.remove();
|
|
1466
|
-
for (let n of e.viewNodes) bt(n, t);
|
|
1467
|
-
e.image = i;
|
|
1468
|
-
}
|
|
1469
|
-
#D(e, t) {
|
|
1470
|
-
let n = this.#p;
|
|
1471
|
-
if (!n) return C("g", { "data-mark-type": e.getType() });
|
|
1472
|
-
let r = n.markGroups.get(e);
|
|
1473
|
-
r || (r = /* @__PURE__ */ new Map(), n.markGroups.set(e, r));
|
|
1474
|
-
let i = t ?? "", a = r.get(i);
|
|
1475
|
-
if (a) {
|
|
1476
|
-
if (a.parentNode !== this.currentNode) throw Error(`Sample-faceted mark was rendered under multiple parents: ${e.unitView.getPathString()}`);
|
|
1477
|
-
} else a = C("g", { "data-mark-type": e.getType() }), t && a.setAttribute("clip-path", t), this.currentNode.appendChild(a), r.set(i, a), n.markGroupElements.add(a);
|
|
1478
|
-
return a;
|
|
1479
|
-
}
|
|
1480
|
-
getClipPathUrl(e) {
|
|
1481
|
-
if (!e) return;
|
|
1482
|
-
let t = e.rect.flatten(), n = [
|
|
1483
|
-
e.clipX ? t.x : 0,
|
|
1484
|
-
e.clipY ? t.y : 0,
|
|
1485
|
-
e.clipX ? t.width : this.width,
|
|
1486
|
-
e.clipY ? t.height : this.height
|
|
1487
|
-
].map(m), r = n.join(","), i = this.#r.get(r);
|
|
1488
|
-
if (!i) {
|
|
1489
|
-
i = "clip-" + this.#v++;
|
|
1490
|
-
let e = C("clipPath", {
|
|
1491
|
-
id: i,
|
|
1492
|
-
clipPathUnits: "userSpaceOnUse"
|
|
1493
|
-
});
|
|
1494
|
-
e.appendChild(C("rect", {
|
|
1495
|
-
x: n[0],
|
|
1496
|
-
y: n[1],
|
|
1497
|
-
width: n[2],
|
|
1498
|
-
height: n[3]
|
|
1499
|
-
})), this.#t.appendChild(e), this.#r.set(r, i);
|
|
1500
|
-
}
|
|
1501
|
-
return `url(#${i})`;
|
|
1502
|
-
}
|
|
1503
|
-
#O(e, t) {
|
|
1504
|
-
for (let n of e.unitView.getLayoutAncestors()) {
|
|
1505
|
-
let e = n.getSampleFacetPosition(t);
|
|
1506
|
-
if (e) return e;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
getShadowFilterUrl(e) {
|
|
1510
|
-
let t = m(Math.max(e.blur / 2.5, .25)), n = m(e.offsetX), r = m(e.offsetY), i = [
|
|
1511
|
-
t,
|
|
1512
|
-
n,
|
|
1513
|
-
r
|
|
1514
|
-
].join(","), a = this.#a.get(i);
|
|
1515
|
-
if (!a) {
|
|
1516
|
-
a = "shadow-" + this.#b++;
|
|
1517
|
-
let e = C("filter", {
|
|
1518
|
-
id: a,
|
|
1519
|
-
x: 0,
|
|
1520
|
-
y: 0,
|
|
1521
|
-
width: m(this.width),
|
|
1522
|
-
height: m(this.height),
|
|
1523
|
-
filterUnits: "userSpaceOnUse",
|
|
1524
|
-
primitiveUnits: "userSpaceOnUse",
|
|
1525
|
-
"color-interpolation-filters": "sRGB"
|
|
1526
|
-
});
|
|
1527
|
-
e.appendChild(C("feGaussianBlur", {
|
|
1528
|
-
in: "SourceGraphic",
|
|
1529
|
-
stdDeviation: t,
|
|
1530
|
-
result: "blur"
|
|
1531
|
-
})), e.appendChild(C("feOffset", {
|
|
1532
|
-
in: "blur",
|
|
1533
|
-
dx: n,
|
|
1534
|
-
dy: r,
|
|
1535
|
-
result: "offsetBlur"
|
|
1536
|
-
})), this.#t.appendChild(e), this.#a.set(i, a);
|
|
1537
|
-
}
|
|
1538
|
-
return `url(#${a})`;
|
|
1539
|
-
}
|
|
1540
|
-
getShadowClipPathUrl(e) {
|
|
1541
|
-
let t = this.#o.get(e);
|
|
1542
|
-
if (!t) {
|
|
1543
|
-
t = "shadow-clip-" + this.#v++;
|
|
1544
|
-
let n = C("clipPath", {
|
|
1545
|
-
id: t,
|
|
1546
|
-
clipPathUnits: "userSpaceOnUse"
|
|
1547
|
-
});
|
|
1548
|
-
n.appendChild(C("path", {
|
|
1549
|
-
d: `M 0 0 V ${m(this.height)} H ${m(this.width)} V 0 Z ${e}`,
|
|
1550
|
-
"clip-rule": "evenodd",
|
|
1551
|
-
"fill-rule": "evenodd"
|
|
1552
|
-
})), this.#t.appendChild(n), this.#o.set(e, t);
|
|
1553
|
-
}
|
|
1554
|
-
return `url(#${t})`;
|
|
1555
|
-
}
|
|
1556
|
-
getRectHatchPatternUrl(e) {
|
|
1557
|
-
let t = JSON.stringify([
|
|
1558
|
-
e.type,
|
|
1559
|
-
e.fill,
|
|
1560
|
-
p(e.fillOpacity),
|
|
1561
|
-
e.stroke,
|
|
1562
|
-
p(e.strokeOpacity),
|
|
1563
|
-
p(e.strokeWidth)
|
|
1564
|
-
]), n = this.#s.get(t);
|
|
1565
|
-
return n || (n = "rect-hatch-" + this.#x++, this.#t.appendChild(ot(n, e)), this.#s.set(t, n)), `url(#${n})`;
|
|
1566
|
-
}
|
|
1567
|
-
getLegendGradientUrl(e) {
|
|
1568
|
-
let t = "legend-gradient-" + this.#S++, n = C("linearGradient", {
|
|
1569
|
-
id: t,
|
|
1570
|
-
gradientUnits: "userSpaceOnUse",
|
|
1571
|
-
x1: m(e.x1),
|
|
1572
|
-
y1: m(e.y1),
|
|
1573
|
-
x2: m(e.x2),
|
|
1574
|
-
y2: m(e.y2)
|
|
1575
|
-
});
|
|
1576
|
-
for (let t of e.stops) n.appendChild(C("stop", {
|
|
1577
|
-
offset: p(t.offset),
|
|
1578
|
-
"stop-color": t.color
|
|
1579
|
-
}));
|
|
1580
|
-
return this.#t.appendChild(n), `url(#${t})`;
|
|
1581
|
-
}
|
|
1582
|
-
getLinkArcFadeMaskUrl(e) {
|
|
1583
|
-
let t = lt(e.p1, e.p4, e.distances);
|
|
1584
|
-
if (!t) return;
|
|
1585
|
-
let n = this.#c.get(t.key);
|
|
1586
|
-
if (!n) {
|
|
1587
|
-
n = "link-arc-fade-" + this.#y++;
|
|
1588
|
-
let { gradient: e, mask: r } = ut(n, this.width, this.height, t);
|
|
1589
|
-
this.#t.appendChild(e), this.#t.appendChild(r), this.#c.set(t.key, n);
|
|
1590
|
-
}
|
|
1591
|
-
return `url(#${n})`;
|
|
1592
|
-
}
|
|
1593
|
-
getViewportEdgeFadeMaskUrl(e) {
|
|
1594
|
-
let n = Object.entries(e).filter(([, e]) => e.width > 0 && Number.isFinite(e.distance));
|
|
1595
|
-
if (!n.length) return;
|
|
1596
|
-
let r = t(this.#n);
|
|
1597
|
-
if (!r) throw Error("No current view in SVG rendering context.");
|
|
1598
|
-
let i = this.#i.get(r.view);
|
|
1599
|
-
if (!i) {
|
|
1600
|
-
i = "edge-fade-" + this.#y++;
|
|
1601
|
-
let e = m(this.width), t = m(this.height), a = C("mask", {
|
|
1602
|
-
id: i,
|
|
1603
|
-
x: 0,
|
|
1604
|
-
y: 0,
|
|
1605
|
-
width: e,
|
|
1606
|
-
height: t,
|
|
1607
|
-
maskUnits: "userSpaceOnUse",
|
|
1608
|
-
maskContentUnits: "userSpaceOnUse",
|
|
1609
|
-
"mask-type": "luminance"
|
|
1610
|
-
});
|
|
1611
|
-
a.appendChild(C("rect", {
|
|
1612
|
-
width: e,
|
|
1613
|
-
height: t,
|
|
1614
|
-
fill: "white"
|
|
1615
|
-
}));
|
|
1616
|
-
for (let [o, s] of n) {
|
|
1617
|
-
let n = i + "-" + o, c = xt(n, o, s, r.coords);
|
|
1618
|
-
this.#t.appendChild(c), a.appendChild(C("rect", {
|
|
1619
|
-
width: e,
|
|
1620
|
-
height: t,
|
|
1621
|
-
fill: `url(#${n})`
|
|
1622
|
-
}));
|
|
1623
|
-
}
|
|
1624
|
-
this.#t.appendChild(a), this.#i.set(r.view, i);
|
|
1625
|
-
}
|
|
1626
|
-
return `url(#${i})`;
|
|
1627
|
-
}
|
|
1628
|
-
getSvg() {
|
|
1629
|
-
return this.#e;
|
|
1630
|
-
}
|
|
1631
|
-
getWarnings() {
|
|
1632
|
-
return Array.from(this.#l);
|
|
1633
|
-
}
|
|
1634
|
-
get currentNode() {
|
|
1635
|
-
return t(this.#n)?.node ?? this.#e;
|
|
1636
|
-
}
|
|
1637
|
-
get currentCoords() {
|
|
1638
|
-
let e = t(this.#n);
|
|
1639
|
-
if (!e) throw Error("No current view in SVG rendering context.");
|
|
1640
|
-
return e.coords;
|
|
1641
|
-
}
|
|
1642
|
-
};
|
|
1643
|
-
function mt(e, t) {
|
|
1644
|
-
let n = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1645
|
-
return `${/^[A-Za-z_]/.test(n) ? n : n ? "view-" + n : "view"}-${t}`;
|
|
1646
|
-
}
|
|
1647
|
-
function ht(e, t) {
|
|
1648
|
-
if (!t) return e;
|
|
1649
|
-
let n = t.locSize.location * t.pixelToUnit, r = t.locSize.size * t.pixelToUnit;
|
|
1650
|
-
return e.modify({
|
|
1651
|
-
y: () => e.y + n * e.height,
|
|
1652
|
-
height: () => r * e.height
|
|
1653
|
-
});
|
|
1654
|
-
}
|
|
1655
|
-
function gt(e, t) {
|
|
1656
|
-
let n = /* @__PURE__ */ new Map();
|
|
1657
|
-
for (let r of t) {
|
|
1658
|
-
let t = +e(r), i = n.get(t);
|
|
1659
|
-
i || (i = [], n.set(t, i)), i.push(r);
|
|
1660
|
-
}
|
|
1661
|
-
return n;
|
|
1662
|
-
}
|
|
1663
|
-
function _t(e, t) {
|
|
1664
|
-
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);
|
|
1665
|
-
}
|
|
1666
|
-
function vt(e) {
|
|
1667
|
-
let [t, ...n] = Array.from(e), r = t;
|
|
1668
|
-
for (; n.some((e) => !r.contains(e));) r = r.parentNode;
|
|
1669
|
-
return r;
|
|
1670
|
-
}
|
|
1671
|
-
function yt(e, t) {
|
|
1672
|
-
let n = e;
|
|
1673
|
-
for (; n.parentNode != t;) n = n.parentNode;
|
|
1674
|
-
return n;
|
|
1675
|
-
}
|
|
1676
|
-
function bt(e, t) {
|
|
1677
|
-
let n = e;
|
|
1678
|
-
for (; n != t && n.matches("g[data-view-path]") && Array.from(n.children).every((e) => e.tagName == "title");) {
|
|
1679
|
-
let e = n.parentNode;
|
|
1680
|
-
n.remove(), n = e;
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
function xt(e, t, n, r) {
|
|
1684
|
-
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 = C("linearGradient", {
|
|
1685
|
-
id: e,
|
|
1686
|
-
gradientUnits: "userSpaceOnUse",
|
|
1687
|
-
x1: m(a ? i : 0),
|
|
1688
|
-
y1: m(a ? 0 : i),
|
|
1689
|
-
x2: m(a ? o : 0),
|
|
1690
|
-
y2: m(a ? 0 : o)
|
|
1691
|
-
});
|
|
1692
|
-
return s.appendChild(C("stop", {
|
|
1693
|
-
offset: 0,
|
|
1694
|
-
"stop-color": "black",
|
|
1695
|
-
"stop-opacity": 1
|
|
1696
|
-
})), s.appendChild(C("stop", {
|
|
1697
|
-
offset: 1,
|
|
1698
|
-
"stop-color": "black",
|
|
1699
|
-
"stop-opacity": 0
|
|
1700
|
-
})), s;
|
|
1701
|
-
}
|
|
1702
|
-
//#endregion
|
|
1703
|
-
//#region ../core/src/svg/index.js
|
|
1704
|
-
function St({ viewRoot: e, logicalWidth: t, logicalHeight: n, background: r = "white" }) {
|
|
1705
|
-
let i = new pt({ picking: !1 }, {
|
|
1706
|
-
width: t,
|
|
1707
|
-
height: n,
|
|
1708
|
-
background: r
|
|
1709
|
-
});
|
|
1710
|
-
return e.render(i, d.create(0, 0, t, n), { firstFacet: !0 }), {
|
|
1711
|
-
svg: i.getSvg(),
|
|
1712
|
-
warnings: i.getWarnings()
|
|
1713
|
-
};
|
|
1714
|
-
}
|
|
1715
|
-
function Ct({ viewRoot: e, logicalWidth: t, logicalHeight: n }) {
|
|
1716
|
-
let r = new pt({ picking: !1 }, {
|
|
1717
|
-
width: t,
|
|
1718
|
-
height: n,
|
|
1719
|
-
background: null
|
|
1720
|
-
});
|
|
1721
|
-
return r.beginInstanceCounting(), e.render(r, d.create(0, 0, t, n), { firstFacet: !0 }), r.endInstanceCounting(), { layers: Array.from(r.getVisibleInstanceCounts(), ([e, t]) => ({
|
|
1722
|
-
viewName: e.unitView.name,
|
|
1723
|
-
viewTitle: e.unitView.getTitleText(),
|
|
1724
|
-
viewPath: e.unitView.getPathString(),
|
|
1725
|
-
markType: e.getType(),
|
|
1726
|
-
instanceCount: t
|
|
1727
|
-
})).filter((e) => e.instanceCount > 0) };
|
|
1728
|
-
}
|
|
1729
|
-
async function wt(e) {
|
|
1730
|
-
let t = e.rasterization;
|
|
1731
|
-
if (!t) return {
|
|
1732
|
-
...St(e),
|
|
1733
|
-
rasterized: []
|
|
1734
|
-
};
|
|
1735
|
-
if (Et(t), !e.webGLHelper) {
|
|
1736
|
-
let t = St(e);
|
|
1737
|
-
return {
|
|
1738
|
-
...t,
|
|
1739
|
-
warnings: [...t.warnings, "SVG rasterization was requested but no WebGL context is available; exported all marks as vectors."],
|
|
1740
|
-
rasterized: []
|
|
1741
|
-
};
|
|
1742
|
-
}
|
|
1743
|
-
return Tt({
|
|
1744
|
-
...e,
|
|
1745
|
-
webGLHelper: e.webGLHelper,
|
|
1746
|
-
maxVectorInstances: t.maxVectorInstances,
|
|
1747
|
-
pixelRatio: t.pixelRatio
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
async function Tt({ viewRoot: e, webGLHelper: t, logicalWidth: n, logicalHeight: r, background: i = "white", maxVectorInstances: a, pixelRatio: o = 2 }) {
|
|
1751
|
-
Et({
|
|
1752
|
-
maxVectorInstances: a,
|
|
1753
|
-
pixelRatio: o
|
|
1754
|
-
});
|
|
1755
|
-
let s = new pt({ picking: !1 }, {
|
|
1756
|
-
width: n,
|
|
1757
|
-
height: r,
|
|
1758
|
-
background: i,
|
|
1759
|
-
maxVectorInstances: a
|
|
1760
|
-
}), c = d.create(0, 0, n, r);
|
|
1761
|
-
s.beginInstanceCounting(), e.render(s, c, { firstFacet: !0 }), s.endInstanceCounting(), e.render(s, c, { firstFacet: !0 });
|
|
1762
|
-
let l = s.getRasterRuns();
|
|
1763
|
-
if (l.length) {
|
|
1764
|
-
let { rasterizeSvgRuns: i } = await import("./raster-BofBWXbe.js");
|
|
1765
|
-
i({
|
|
1766
|
-
runs: l,
|
|
1767
|
-
viewRoot: e,
|
|
1768
|
-
webGLHelper: t,
|
|
1769
|
-
logicalWidth: n,
|
|
1770
|
-
logicalHeight: r,
|
|
1771
|
-
pixelRatio: o
|
|
1772
|
-
});
|
|
1773
|
-
}
|
|
1774
|
-
return {
|
|
1775
|
-
svg: s.getSvg(),
|
|
1776
|
-
warnings: s.getWarnings(),
|
|
1777
|
-
rasterized: l.map((e) => ({
|
|
1778
|
-
targets: e.targets.map((e) => ({
|
|
1779
|
-
markType: e.mark.getType(),
|
|
1780
|
-
instanceCount: e.instanceCount
|
|
1781
|
-
})),
|
|
1782
|
-
reason: "instance-threshold",
|
|
1783
|
-
maxVectorInstances: a,
|
|
1784
|
-
pixelRatio: o
|
|
1785
|
-
}))
|
|
1786
|
-
};
|
|
1787
|
-
}
|
|
1788
|
-
function Et(e) {
|
|
1789
|
-
if (!Number.isInteger(e.maxVectorInstances) || e.maxVectorInstances < 0) throw RangeError("maxVectorInstances must be a non-negative integer.");
|
|
1790
|
-
if (e.pixelRatio != null && (!Number.isFinite(e.pixelRatio) || e.pixelRatio <= 0)) throw RangeError("SVG raster pixelRatio must be positive.");
|
|
1791
|
-
}
|
|
1792
|
-
//#endregion
|
|
1793
|
-
export { Ct as analyzeSvgExport, wt as createSvgExport };
|