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