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