@blueprint-chart/lib 2.17.0 → 2.17.1
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/embed.js +1 -1
- package/dist/index.js +229 -229
- package/dist/lib/lib.iife.js +29 -29
- package/dist/{render-bpc-CPj5h-p4.js → render-bpc-DZF2uugG.js} +3002 -3903
- package/dist/runtime-xftta_35.js +1034 -0
- package/dist/runtime.js +2 -2
- package/package.json +1 -1
- package/dist/runtime-CT02Shsd.js +0 -118
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as ee, I as te, It as _, J as v, Jt as ne, K as re, Kt as ie, L as
|
|
2
|
-
import { c as
|
|
3
|
-
import
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as ee, I as te, It as _, J as v, Jt as ne, K as re, Kt as ie, L as y, Lt as ae, M as b, Mt as oe, N as se, Nt as ce, O as le, Ot as ue, P as de, Pt as x, Q as fe, Qt as pe, R as S, Rt as me, S as he, St as ge, T as _e, Tt as ve, U as ye, Ut as be, V as C, Vt as xe, W as Se, Wt as Ce, X as we, Xt as Te, Y as Ee, Yt as De, Z as Oe, Zt as ke, _ as Ae, _t as je, a as Me, an as Ne, at as Pe, b as Fe, bt as Ie, c as Le, cn as Re, ct as ze, d as Be, dt as Ve, en as He, et as Ue, f as We, ft as Ge, g as Ke, gt as qe, h as Je, ht as Ye, i as w, in as Xe, it as Ze, j as Qe, jt as $e, k as T, kt as E, l as et, lt as tt, m as nt, mt as rt, n as it, nn as at, nt as ot, o as st, on as ct, ot as lt, p as ut, pt as dt, q as ft, qt as pt, r as mt, rn as ht, rt as gt, s as _t, sn as vt, st as yt, t as bt, tn as xt, tt as St, u as Ct, ut as wt, v as Tt, vt as Et, w as Dt, wt as Ot, x as kt, xt as At, y as jt, yt as Mt, z as Nt, zt as Pt } from "./render-bpc-DZF2uugG.js";
|
|
2
|
+
import { c as Ft, i as It, l as Lt, s as Rt, t as zt } from "./runtime-xftta_35.js";
|
|
3
|
+
import D from "chroma-js";
|
|
4
4
|
//#region src/recommendations/intent.ts
|
|
5
|
-
var
|
|
5
|
+
var Bt = [
|
|
6
6
|
{
|
|
7
7
|
intent: "range",
|
|
8
8
|
pattern: /\b(range|high and low|high\/low|margin of error|confidence interval|confidence|interval|plus or minus|spread between)\b/i
|
|
@@ -32,97 +32,97 @@ var Vt = [
|
|
|
32
32
|
pattern: /\b(compares?|compared|comparison|versus|vs\.?|more than|difference between|across|than)\b/i
|
|
33
33
|
}
|
|
34
34
|
];
|
|
35
|
-
function
|
|
35
|
+
function Vt(e) {
|
|
36
36
|
if (e === void 0 || e.trim() === "") return "none";
|
|
37
|
-
for (let t of
|
|
37
|
+
for (let t of Bt) if (t.pattern.test(e)) return t.intent;
|
|
38
38
|
return "none";
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/recommendations/decisionTable.ts
|
|
42
|
-
var
|
|
42
|
+
var O = (e, t, n) => ({
|
|
43
43
|
type: e,
|
|
44
44
|
fitness: t,
|
|
45
45
|
reason: n
|
|
46
|
-
}),
|
|
46
|
+
}), k = {
|
|
47
47
|
"1cat+1num": {
|
|
48
48
|
none: (e) => {
|
|
49
|
-
let t = [
|
|
50
|
-
return e <= 8 && (t.push(
|
|
49
|
+
let t = [O("bar-vertical", "best", "1 categorical + 1 numeric — classic bar chart"), O("bar-horizontal", "good", "Horizontal bars work well for long labels")];
|
|
50
|
+
return e <= 8 && (t.push(O("donut", "good", `${e} items — suitable for part-of-whole`)), t.push(O("pie", "alternative", "Pie chart for part-of-whole"))), t;
|
|
51
51
|
},
|
|
52
|
-
comparison: (e) =>
|
|
53
|
-
ranking: () => [
|
|
52
|
+
comparison: (e) => k["1cat+1num"].none(e),
|
|
53
|
+
ranking: () => [O("bar-horizontal", "best", "Ranked categories read best as horizontal bars"), O("bar-vertical", "good", "Vertical bars also work for ranking")],
|
|
54
54
|
"part-to-whole": (e) => e <= 5 ? [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
O("pie", "best", `${e} slices — pie reads cleanly for very small N`),
|
|
56
|
+
O("donut", "good", "Donut for part-of-whole with a center label"),
|
|
57
|
+
O("bar-vertical", "alternative", "Bars if precise comparison matters")
|
|
58
58
|
] : e <= 8 ? [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
] : [
|
|
63
|
-
range: () => [
|
|
59
|
+
O("donut", "best", `${e} slices — donut for part-of-whole`),
|
|
60
|
+
O("pie", "good", "Pie for part-of-whole"),
|
|
61
|
+
O("bar-vertical", "alternative", "Bars if precise comparison matters")
|
|
62
|
+
] : [O("bar-vertical", "best", `${e} categories — too many for a readable pie`), O("bar-horizontal", "good", "Horizontal bars for long labels")],
|
|
63
|
+
range: () => [O("bar-vertical", "best", "A single numeric column carries no range — plain bars read the value directly"), O("bar-horizontal", "good", "Horizontal bars work well for long labels")]
|
|
64
64
|
},
|
|
65
65
|
"1cat+Nnum": {
|
|
66
|
-
none: () => [
|
|
67
|
-
comparison: (e) =>
|
|
68
|
-
ranking: (e) =>
|
|
69
|
-
trend: () => [
|
|
66
|
+
none: () => [O("bar-multi", "best", "1 categorical + multiple numeric columns — compare groups"), O("line-multi", "good", "Can also show as a multi-line chart")],
|
|
67
|
+
comparison: (e) => k["1cat+Nnum"].none(e),
|
|
68
|
+
ranking: (e) => k["1cat+Nnum"].none(e),
|
|
69
|
+
trend: () => [O("line-multi", "best", "A trend or crossover story reads best as lines, even over categorical periods"), O("bar-multi", "alternative", "Grouped bars if per-period comparison matters more than the trend")],
|
|
70
70
|
"part-to-whole": () => [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
O("bar-stacked", "best", "Stacked bars show composition within each category"),
|
|
72
|
+
O("column-stacked", "good", "Stacked columns for the same composition"),
|
|
73
|
+
O("bar-multi", "alternative", "Grouped bars if comparison beats composition")
|
|
74
74
|
],
|
|
75
75
|
"composition-over-time": () => [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
O("column-stacked", "best", "Stacked columns show composition across discrete periods"),
|
|
77
|
+
O("bar-stacked", "good", "Stacked bars for the same composition"),
|
|
78
|
+
O("area-stacked", "alternative", "Stacked area if the periods are continuous time")
|
|
79
79
|
],
|
|
80
|
-
relationship: () => [
|
|
81
|
-
range: () => [
|
|
80
|
+
relationship: () => [O("scatter", "best", "Two numeric columns per item — a scatter plot shows how they move together"), O("line-multi", "alternative", "Lines if the categories have a natural order")],
|
|
81
|
+
range: () => [O("dot-plot", "best", "A dot with a bar from low to high shows each value with its margin. Set dotStyle = \"range\" and pick the low and high columns"), O("bar-split", "alternative", "Split bars if each bound should read as its own panel")]
|
|
82
82
|
},
|
|
83
83
|
"1cat+text+Nnum": {
|
|
84
|
-
none: () => [
|
|
85
|
-
relationship: (e) =>
|
|
84
|
+
none: () => [O("scatter", "best", "A label, a text column and several numbers — plot one number against another"), O("bar-multi", "alternative", "Grouped bars if comparing values per row matters more")],
|
|
85
|
+
relationship: (e) => k["1cat+text+Nnum"].none(e)
|
|
86
86
|
},
|
|
87
87
|
"1date+1num": {
|
|
88
|
-
none: () => [
|
|
88
|
+
none: () => [O("line", "best", "1 date + 1 numeric column — ideal for trend"), O("bar-vertical", "alternative", "Can also show as bars")],
|
|
89
89
|
trend: () => [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
O("line", "best", "1 date + 1 numeric column — ideal for trend"),
|
|
91
|
+
O("area", "good", "Filled area emphasizes magnitude over time"),
|
|
92
|
+
O("bar-vertical", "alternative", "Can also show as bars")
|
|
93
93
|
],
|
|
94
|
-
comparison: () => [
|
|
95
|
-
ranking: () => [
|
|
96
|
-
"part-to-whole": () => [
|
|
97
|
-
"composition-over-time": () => [
|
|
94
|
+
comparison: () => [O("bar-vertical", "best", "Bars for comparing discrete time points"), O("line", "good", "Line if the trend matters more than the comparison")],
|
|
95
|
+
ranking: () => [O("bar-vertical", "best", "Bars for ranking discrete time points"), O("line", "good", "Line for the underlying trend")],
|
|
96
|
+
"part-to-whole": () => [O("area", "best", "Filled area reads as magnitude/share over time"), O("line", "good", "Line for the underlying trend")],
|
|
97
|
+
"composition-over-time": () => [O("area", "best", "Filled area shows magnitude over time"), O("line", "good", "Line for the underlying trend")]
|
|
98
98
|
},
|
|
99
99
|
"1date+Nnum": {
|
|
100
|
-
none: () => [
|
|
101
|
-
trend: (e) =>
|
|
102
|
-
comparison: (e) =>
|
|
103
|
-
ranking: (e) =>
|
|
100
|
+
none: () => [O("line-multi", "best", "1 date + multiple numeric columns — compare trends"), O("bar-multi", "alternative", "Can also show as grouped bars")],
|
|
101
|
+
trend: (e) => k["1date+Nnum"].none(e),
|
|
102
|
+
comparison: (e) => k["1date+Nnum"].none(e),
|
|
103
|
+
ranking: (e) => k["1date+Nnum"].none(e),
|
|
104
104
|
"composition-over-time": () => [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
O("area-stacked", "best", "Stacked area shows composition over continuous time"),
|
|
106
|
+
O("column-stacked", "good", "Stacked columns for the same composition"),
|
|
107
|
+
O("line-multi", "alternative", "Multi-line if composition is not the point")
|
|
108
108
|
],
|
|
109
|
-
"part-to-whole": () => [
|
|
109
|
+
"part-to-whole": () => [O("area-stacked", "best", "Stacked area shows share over time"), O("line-multi", "good", "Multi-line if absolute trends matter more")]
|
|
110
110
|
},
|
|
111
|
-
other: { none: () => [
|
|
111
|
+
other: { none: () => [O("bar-vertical", "good", "Default bar chart recommendation")] }
|
|
112
112
|
};
|
|
113
|
-
function
|
|
114
|
-
let r =
|
|
115
|
-
return i ? i(n) : [
|
|
113
|
+
function Ht(e, t, n) {
|
|
114
|
+
let r = k[e], i = r[t] ?? r.none;
|
|
115
|
+
return i ? i(n) : [O("bar-vertical", "good", "Default bar chart recommendation")];
|
|
116
116
|
}
|
|
117
117
|
//#endregion
|
|
118
118
|
//#region src/recommendations/shape.ts
|
|
119
|
-
function
|
|
119
|
+
function Ut(e, t) {
|
|
120
120
|
let n = e[0] === "date", r = e.filter((e) => e === "string").length, i = n ? e.filter((e) => e === "date").length : 0, a = e.filter((e) => e === "number" || e === "date" && !n).length;
|
|
121
121
|
return i === 1 && r === 0 && a >= 1 ? a === 1 ? "1date+1num" : "1date+Nnum" : r === 1 && i === 0 && a >= 1 ? a === 1 ? "1cat+1num" : "1cat+Nnum" : e[0] === "string" && i === 0 && r >= 2 && a >= 2 ? "1cat+text+Nnum" : "other";
|
|
122
122
|
}
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/recommendations/types.ts
|
|
125
|
-
var
|
|
125
|
+
var Wt = {
|
|
126
126
|
"bar-vertical": "Vertical Bar Chart",
|
|
127
127
|
"bar-horizontal": "Horizontal Bar Chart",
|
|
128
128
|
"bar-multi": "Grouped Bar Chart",
|
|
@@ -141,21 +141,21 @@ var Gt = {
|
|
|
141
141
|
};
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region src/recommendations/recommend.ts
|
|
144
|
-
function
|
|
145
|
-
return e.length === 0 ? [] : Ut(
|
|
144
|
+
function Gt(e, t, n) {
|
|
145
|
+
return e.length === 0 ? [] : Ht(Ut(e, t), Vt(n), t).map((e) => ({
|
|
146
146
|
chartType: e.type,
|
|
147
|
-
label:
|
|
147
|
+
label: Wt[e.type] ?? e.type,
|
|
148
148
|
fitness: e.fitness,
|
|
149
149
|
reason: e.reason
|
|
150
150
|
}));
|
|
151
151
|
}
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/charts/colorblind.ts
|
|
154
|
-
var
|
|
154
|
+
var Kt = {
|
|
155
155
|
protanopia: "Protanopia (no red)",
|
|
156
156
|
deuteranopia: "Deuteranopia (no green)",
|
|
157
157
|
tritanopia: "Tritanopia (no blue)"
|
|
158
|
-
},
|
|
158
|
+
}, qt = {
|
|
159
159
|
protanopia: [
|
|
160
160
|
.152286,
|
|
161
161
|
1.052583,
|
|
@@ -223,27 +223,27 @@ var qt = {
|
|
|
223
223
|
0
|
|
224
224
|
]
|
|
225
225
|
};
|
|
226
|
-
function
|
|
226
|
+
function Jt(e) {
|
|
227
227
|
return `bc-cvd-${e}`;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function Yt(e) {
|
|
230
230
|
let t = "http://www.w3.org/2000/svg", n = document.createElementNS(t, "filter");
|
|
231
|
-
n.setAttribute("id",
|
|
231
|
+
n.setAttribute("id", Jt(e)), n.setAttribute("color-interpolation-filters", "linearRGB");
|
|
232
232
|
let r = document.createElementNS(t, "feColorMatrix");
|
|
233
|
-
return r.setAttribute("type", "matrix"), r.setAttribute("values",
|
|
233
|
+
return r.setAttribute("type", "matrix"), r.setAttribute("values", qt[e].join(" ")), n.appendChild(r), n;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Xt(e) {
|
|
236
236
|
return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function A(e) {
|
|
239
239
|
return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
240
240
|
}
|
|
241
|
-
function
|
|
242
|
-
let [n, r, i] = (
|
|
243
|
-
return
|
|
241
|
+
function Zt(e, t) {
|
|
242
|
+
let [n, r, i] = (D.valid(e) ? D(e) : D("#000")).rgb().map((e) => Xt(e / 255)), a = qt[t], o = A(a[0] * n + a[1] * r + a[2] * i), s = A(a[5] * n + a[6] * r + a[7] * i), c = A(a[10] * n + a[11] * r + a[12] * i), l = (e) => Math.min(255, Math.max(0, Math.round(e * 255)));
|
|
243
|
+
return D(l(o), l(s), l(c)).hex();
|
|
244
244
|
}
|
|
245
|
-
var
|
|
246
|
-
function
|
|
245
|
+
var Qt = 10;
|
|
246
|
+
function $t(e) {
|
|
247
247
|
if (e.length < 2) return [];
|
|
248
248
|
let t = [
|
|
249
249
|
"protanopia",
|
|
@@ -251,10 +251,10 @@ function en(e) {
|
|
|
251
251
|
"tritanopia"
|
|
252
252
|
], n = [];
|
|
253
253
|
for (let r of t) {
|
|
254
|
-
let t = e.map((e) =>
|
|
254
|
+
let t = e.map((e) => Zt(e, r)), i = [];
|
|
255
255
|
for (let n = 0; n < t.length; n++) for (let r = n + 1; r < t.length; r++) {
|
|
256
|
-
let a =
|
|
257
|
-
a <
|
|
256
|
+
let a = D.deltaE(t[n], t[r]);
|
|
257
|
+
a < Qt && i.push({
|
|
258
258
|
a: e[n],
|
|
259
259
|
b: e[r],
|
|
260
260
|
deltaE: a
|
|
@@ -262,7 +262,7 @@ function en(e) {
|
|
|
262
262
|
}
|
|
263
263
|
i.length > 0 && n.push({
|
|
264
264
|
type: r,
|
|
265
|
-
label:
|
|
265
|
+
label: Kt[r],
|
|
266
266
|
pairs: i
|
|
267
267
|
});
|
|
268
268
|
}
|
|
@@ -270,158 +270,158 @@ function en(e) {
|
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/dsl/serializer.ts
|
|
273
|
-
function
|
|
273
|
+
function j(e, t) {
|
|
274
274
|
return (e ?? []).flatMap((e) => e.split("\n").map((e) => `${t}// ${e.trim()}`));
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function M(e, t) {
|
|
277
277
|
return t == null ? e : t.includes("\n") ? `${e} /* ${t} */` : `${e} // ${t}`;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
return [...
|
|
279
|
+
function N(e, t) {
|
|
280
|
+
return [...j(e.trailingComments, `${t} `), M(`${t}}`, e.trailingComment)];
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return typeof e.value == "number" ? e.isPercentage ? `${e.value}%` : `${e.value}` : typeof e.value == "string" && e.value.startsWith("#") ?
|
|
282
|
+
function P(e) {
|
|
283
|
+
return typeof e.value == "number" ? e.isPercentage ? `${e.value}%` : `${e.value}` : typeof e.value == "string" && e.value.startsWith("#") ? S(e.value) : typeof e.value == "string" && /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.value) ? e.value : S(String(e.value));
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
return /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e) ? e :
|
|
285
|
+
function en(e) {
|
|
286
|
+
return /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e) ? e : S(e);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
let n =
|
|
290
|
-
return [...
|
|
288
|
+
function F(e, t) {
|
|
289
|
+
let n = M(`${t}${en(e.key)} = ${P(e)}`, e.trailingComment);
|
|
290
|
+
return [...j(e.leadingComments, t), n].join("\n");
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function tn(e, t) {
|
|
293
293
|
let n;
|
|
294
|
-
return n = e.key === "series" && e.quotedKey && !(e.values && e.values.length > 1) ? `${t}"series" = ${
|
|
295
|
-
}
|
|
296
|
-
function F(e, t) {
|
|
297
|
-
let n = [...A(e.leadingComments, t), `${t}data {`];
|
|
298
|
-
for (let r of e.entries) n.push(nn(r, `${t} `));
|
|
299
|
-
return n.push(...M(e, t)), n.join("\n");
|
|
294
|
+
return n = e.key === "series" && e.quotedKey && !(e.values && e.values.length > 1) ? `${t}"series" = ${P(e)}` : e.values && e.values.length > 1 ? `${t}${e.key === "series" && !e.quotedKey ? e.key : S(e.key)} = ${e.values.map((e) => typeof e == "number" ? `${e}` : S(String(e))).join(",")}` : `${t}${en(e.key)} = ${P(e)}`, [...j(e.leadingComments, t), M(n, e.trailingComment)].join("\n");
|
|
300
295
|
}
|
|
301
296
|
function I(e, t) {
|
|
302
|
-
let n =
|
|
303
|
-
for (let
|
|
304
|
-
return
|
|
297
|
+
let n = [...j(e.leadingComments, t), `${t}data {`];
|
|
298
|
+
for (let r of e.entries) n.push(tn(r, `${t} `));
|
|
299
|
+
return n.push(...N(e, t)), n.join("\n");
|
|
305
300
|
}
|
|
306
301
|
function L(e, t) {
|
|
307
|
-
|
|
302
|
+
let n = e.fromHighlight ? "highlight" : "colorize", r = [...j(e.leadingComments, t), `${t}${n} ${S(e.target)} {`];
|
|
303
|
+
for (let n of e.properties) r.push(F(n, `${t} `));
|
|
304
|
+
return r.push(...N(e, t)), r.join("\n");
|
|
308
305
|
}
|
|
309
306
|
function R(e, t) {
|
|
310
|
-
|
|
311
|
-
for (let r of e.properties) n.push(P(r, `${t} `));
|
|
312
|
-
return n.push(...M(e, t)), n.join("\n");
|
|
307
|
+
return [...j(e.leadingComments, t), M(`${t}highlight ${S(e.target)}`, e.trailingComment)].join("\n");
|
|
313
308
|
}
|
|
314
309
|
function z(e, t) {
|
|
315
|
-
let n = e.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
310
|
+
let n = [...j(e.leadingComments, t), `${t}area-fill ${S(e.from)} ${S(e.to)} {`];
|
|
311
|
+
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
312
|
+
return n.push(...N(e, t)), n.join("\n");
|
|
313
|
+
}
|
|
314
|
+
function B(e, t) {
|
|
315
|
+
let n = e.kind ?? E.Point;
|
|
316
|
+
if (n === E.Range) {
|
|
317
|
+
let n = [...j(e.leadingComments, t), `${t}range {`];
|
|
318
|
+
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
319
|
+
return n.push(...N(e, t)), n.join("\n");
|
|
320
320
|
}
|
|
321
|
-
if (n ===
|
|
322
|
-
let n = [...
|
|
323
|
-
for (let r of e.properties) n.push(
|
|
324
|
-
return n.push(...
|
|
321
|
+
if (n === E.Free) {
|
|
322
|
+
let n = [...j(e.leadingComments, t), `${t}note {`];
|
|
323
|
+
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
324
|
+
return n.push(...N(e, t)), n.join("\n");
|
|
325
325
|
}
|
|
326
|
-
let
|
|
327
|
-
for (let n of e.properties)
|
|
328
|
-
return
|
|
326
|
+
let r = "target" in e ? e.target : "", i = [...j(e.leadingComments, t), `${t}annotation ${S(r)} {`];
|
|
327
|
+
for (let n of e.properties) i.push(F(n, `${t} `));
|
|
328
|
+
return i.push(...N(e, t)), i.join("\n");
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
let n = [...
|
|
332
|
-
for (let r of e.properties) n.push(
|
|
333
|
-
return n.push(...
|
|
330
|
+
function nn(e, t) {
|
|
331
|
+
let n = [...j(e.leadingComments, t), `${t}series ${S(e.name)} {`];
|
|
332
|
+
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
333
|
+
return n.push(...N(e, t)), n.join("\n");
|
|
334
334
|
}
|
|
335
335
|
function rn(e, t) {
|
|
336
|
-
let n = e.name == null ? `${t}scene {` : `${t}scene ${
|
|
337
|
-
for (let n of e.properties) r.push(
|
|
338
|
-
e.data && r.push(
|
|
339
|
-
for (let n of e.colorizes) r.push(
|
|
340
|
-
for (let n of e.highlights) r.push(
|
|
341
|
-
for (let n of e.areaFills) r.push(
|
|
342
|
-
for (let n of e.annotations) r.push(
|
|
343
|
-
for (let n of e.series) r.push(
|
|
336
|
+
let n = e.name == null ? `${t}scene {` : `${t}scene ${S(e.name)} {`, r = [...j(e.leadingComments, t), n];
|
|
337
|
+
for (let n of e.properties) r.push(F(n, `${t} `));
|
|
338
|
+
e.data && r.push(I(e.data, `${t} `));
|
|
339
|
+
for (let n of e.colorizes) r.push(L(n, `${t} `));
|
|
340
|
+
for (let n of e.highlights) r.push(R(n, `${t} `));
|
|
341
|
+
for (let n of e.areaFills) r.push(z(n, `${t} `));
|
|
342
|
+
for (let n of e.annotations) r.push(B(n, `${t} `));
|
|
343
|
+
for (let n of e.series) r.push(nn(n, `${t} `));
|
|
344
344
|
for (let n of e.transforms) r.push(V(n, `${t} `));
|
|
345
|
-
return r.push(...
|
|
345
|
+
return r.push(...N(e, t)), r.join("\n");
|
|
346
346
|
}
|
|
347
347
|
function V(e, t) {
|
|
348
|
-
let n = [...
|
|
349
|
-
for (let r of e.properties) n.push(
|
|
350
|
-
return n.push(...
|
|
348
|
+
let n = [...j(e.leadingComments, t), `${t}transform ${e.transformType} {`];
|
|
349
|
+
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
350
|
+
return n.push(...N(e, t)), n.join("\n");
|
|
351
351
|
}
|
|
352
352
|
function an(e, t, n) {
|
|
353
|
-
let r =
|
|
353
|
+
let r = C(n).find((t) => t.key === e);
|
|
354
354
|
return !r || r.default === void 0 ? !1 : String(r.default) === String(t);
|
|
355
355
|
}
|
|
356
356
|
function on(e) {
|
|
357
357
|
let t = [`chart ${e.chartType} {`];
|
|
358
|
-
for (let n of e.properties) t.push(
|
|
359
|
-
e.data && t.push(
|
|
360
|
-
for (let n of e.colorizes) t.push(
|
|
361
|
-
for (let n of e.highlights) t.push(
|
|
362
|
-
for (let n of e.areaFills) t.push(
|
|
363
|
-
for (let n of e.annotations) t.push(
|
|
364
|
-
for (let n of e.series) t.push(
|
|
358
|
+
for (let n of e.properties) t.push(F(n, " "));
|
|
359
|
+
e.data && t.push(I(e.data, " "));
|
|
360
|
+
for (let n of e.colorizes) t.push(L(n, " "));
|
|
361
|
+
for (let n of e.highlights) t.push(R(n, " "));
|
|
362
|
+
for (let n of e.areaFills) t.push(z(n, " "));
|
|
363
|
+
for (let n of e.annotations) t.push(B(n, " "));
|
|
364
|
+
for (let n of e.series) t.push(nn(n, " "));
|
|
365
365
|
for (let n of e.scenes) t.push(rn(n, " "));
|
|
366
366
|
for (let n of e.transforms) t.push(V(n, " "));
|
|
367
|
-
return t.push(...
|
|
367
|
+
return t.push(...j(e.trailingComments, " "), "}"), t.join("\n");
|
|
368
368
|
}
|
|
369
369
|
function sn(e) {
|
|
370
370
|
return new Map(e.map((e) => [e.key, e.value]));
|
|
371
371
|
}
|
|
372
372
|
function H(e, t, n, r) {
|
|
373
|
-
let i =
|
|
373
|
+
let i = C(n).find((t) => t.key === e);
|
|
374
374
|
return i ? r.has(e) ? String(r.get(e)) === String(t) : i.default !== void 0 && String(i.default) === String(t) : !1;
|
|
375
375
|
}
|
|
376
376
|
function cn(e, t, n, r) {
|
|
377
|
-
let i = [...
|
|
378
|
-
for (let a of e.properties) (a.isPercentage || !H(a.key, a.value, n, r)) && i.push(
|
|
379
|
-
return i.push(...
|
|
377
|
+
let i = [...j(e.leadingComments, t), `${t}series ${S(e.name)} {`];
|
|
378
|
+
for (let a of e.properties) (a.isPercentage || !H(a.key, a.value, n, r)) && i.push(F(a, `${t} `));
|
|
379
|
+
return i.push(...N(e, t)), i.join("\n");
|
|
380
380
|
}
|
|
381
381
|
function ln(e, t, n, r) {
|
|
382
|
-
let i = e.properties.find((e) => e.key === "type"), a = i ? String(i.value) : n, o = e.name == null ? `${t}scene {` : `${t}scene ${
|
|
382
|
+
let i = e.properties.find((e) => e.key === "type"), a = i ? String(i.value) : n, o = e.name == null ? `${t}scene {` : `${t}scene ${S(e.name)} {`, s = [...j(e.leadingComments, t), o], c = new Map(r);
|
|
383
383
|
for (let n of e.properties) {
|
|
384
384
|
if (n.key === "type") {
|
|
385
|
-
s.push(
|
|
385
|
+
s.push(F(n, `${t} `));
|
|
386
386
|
continue;
|
|
387
387
|
}
|
|
388
|
-
c.set(n.key, n.value), (n.isPercentage || !H(n.key, n.value, a, r)) && s.push(
|
|
388
|
+
c.set(n.key, n.value), (n.isPercentage || !H(n.key, n.value, a, r)) && s.push(F(n, `${t} `));
|
|
389
389
|
}
|
|
390
|
-
e.data && s.push(
|
|
391
|
-
for (let n of e.colorizes) s.push(
|
|
392
|
-
for (let n of e.highlights) s.push(
|
|
393
|
-
for (let n of e.areaFills) s.push(
|
|
394
|
-
for (let n of e.annotations) s.push(
|
|
390
|
+
e.data && s.push(I(e.data, `${t} `));
|
|
391
|
+
for (let n of e.colorizes) s.push(L(n, `${t} `));
|
|
392
|
+
for (let n of e.highlights) s.push(R(n, `${t} `));
|
|
393
|
+
for (let n of e.areaFills) s.push(z(n, `${t} `));
|
|
394
|
+
for (let n of e.annotations) s.push(B(n, `${t} `));
|
|
395
395
|
for (let n of e.series) s.push(cn(n, `${t} `, a, c));
|
|
396
396
|
for (let n of e.transforms) s.push(V(n, `${t} `));
|
|
397
|
-
return s.push(...
|
|
397
|
+
return s.push(...N(e, t)), s.join("\n");
|
|
398
398
|
}
|
|
399
399
|
function un(e) {
|
|
400
400
|
let t = [`chart ${e.chartType} {`], n = /* @__PURE__ */ new Map();
|
|
401
|
-
for (let r of e.properties) (r.isPercentage || !H(r.key, r.value, e.chartType, n)) && t.push(
|
|
402
|
-
e.data && t.push(
|
|
403
|
-
for (let n of e.colorizes) t.push(
|
|
404
|
-
for (let n of e.highlights) t.push(
|
|
405
|
-
for (let n of e.areaFills) t.push(
|
|
406
|
-
for (let n of e.annotations) t.push(
|
|
401
|
+
for (let r of e.properties) (r.isPercentage || !H(r.key, r.value, e.chartType, n)) && t.push(F(r, " "));
|
|
402
|
+
e.data && t.push(I(e.data, " "));
|
|
403
|
+
for (let n of e.colorizes) t.push(L(n, " "));
|
|
404
|
+
for (let n of e.highlights) t.push(R(n, " "));
|
|
405
|
+
for (let n of e.areaFills) t.push(z(n, " "));
|
|
406
|
+
for (let n of e.annotations) t.push(B(n, " "));
|
|
407
407
|
let r = sn(e.properties);
|
|
408
408
|
for (let n of e.series) t.push(cn(n, " ", e.chartType, r));
|
|
409
409
|
for (let n of e.scenes) t.push(ln(n, " ", e.chartType, r));
|
|
410
410
|
for (let n of e.transforms) t.push(V(n, " "));
|
|
411
|
-
return t.push(...
|
|
411
|
+
return t.push(...j(e.trailingComments, " "), "}"), t.join("\n");
|
|
412
412
|
}
|
|
413
413
|
function dn(e) {
|
|
414
414
|
let t = [`chart ${e.chartType} {`];
|
|
415
|
-
for (let n of e.properties) an(n.key, n.value, e.chartType) || t.push(
|
|
416
|
-
e.data && t.push(
|
|
417
|
-
for (let n of e.colorizes) t.push(
|
|
418
|
-
for (let n of e.highlights) t.push(
|
|
419
|
-
for (let n of e.areaFills) t.push(
|
|
420
|
-
for (let n of e.annotations) t.push(
|
|
421
|
-
for (let n of e.series) t.push(
|
|
415
|
+
for (let n of e.properties) an(n.key, n.value, e.chartType) || t.push(F(n, " "));
|
|
416
|
+
e.data && t.push(I(e.data, " "));
|
|
417
|
+
for (let n of e.colorizes) t.push(L(n, " "));
|
|
418
|
+
for (let n of e.highlights) t.push(R(n, " "));
|
|
419
|
+
for (let n of e.areaFills) t.push(z(n, " "));
|
|
420
|
+
for (let n of e.annotations) t.push(B(n, " "));
|
|
421
|
+
for (let n of e.series) t.push(nn(n, " "));
|
|
422
422
|
for (let n of e.scenes) t.push(rn(n, " "));
|
|
423
423
|
for (let n of e.transforms) t.push(V(n, " "));
|
|
424
|
-
return t.push(...
|
|
424
|
+
return t.push(...j(e.trailingComments, " "), "}"), t.join("\n");
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/dsl/suggest.ts
|
|
@@ -464,7 +464,7 @@ var pn = [
|
|
|
464
464
|
y: "vertical"
|
|
465
465
|
};
|
|
466
466
|
function gn(e) {
|
|
467
|
-
return [...
|
|
467
|
+
return [...Oe(e), ...(e.textColumns ?? []).map((e) => e.name)];
|
|
468
468
|
}
|
|
469
469
|
function _n(e, t, n, r) {
|
|
470
470
|
let i = gn(e);
|
|
@@ -495,31 +495,31 @@ function yn(e) {
|
|
|
495
495
|
message: `Trend line skipped${e === "overall" ? "" : ` for ${e}`}: needs at least 3 points.`
|
|
496
496
|
}));
|
|
497
497
|
}
|
|
498
|
-
function bn(e,
|
|
499
|
-
return ["x", "y"].flatMap((
|
|
500
|
-
let
|
|
501
|
-
return e[
|
|
498
|
+
function bn(e, t) {
|
|
499
|
+
return ["x", "y"].flatMap((n) => ["min", "max"].flatMap((r) => {
|
|
500
|
+
let i = t[n]?.[r];
|
|
501
|
+
return e[n] !== pe.Log || i === void 0 || String(i).trim() === "" || !(Number(i) <= 0) ? [] : [{
|
|
502
502
|
code: "log-range-ignored",
|
|
503
503
|
severity: "warning",
|
|
504
|
-
message: `${`${hn[
|
|
504
|
+
message: `${`${hn[n]}Range${r === "min" ? "Min" : "Max"}`} must be above 0 on a log axis; it is ignored.`
|
|
505
505
|
}];
|
|
506
506
|
}));
|
|
507
507
|
}
|
|
508
|
-
function xn(t, n, r, i
|
|
509
|
-
let
|
|
510
|
-
if (!
|
|
508
|
+
function xn(e, t, n, r, i) {
|
|
509
|
+
let a = _n(e, t, pn, "error"), o = fe(e, t);
|
|
510
|
+
if (!o.y) return [...a, {
|
|
511
511
|
code: "scatter-missing-y",
|
|
512
512
|
severity: "error",
|
|
513
513
|
key: "y",
|
|
514
514
|
message: "Scatter needs at least two numeric columns."
|
|
515
515
|
}];
|
|
516
|
-
let
|
|
517
|
-
if (
|
|
518
|
-
let { points:
|
|
516
|
+
let s = bn(n, r);
|
|
517
|
+
if (a.length) return [...a, ...s];
|
|
518
|
+
let { points: c, dropped: l } = Ee(e, o, n), u = ft(i) ? v(c, i, n).skipped : [];
|
|
519
519
|
return [
|
|
520
|
-
...vn(
|
|
521
|
-
...yn(
|
|
522
|
-
...
|
|
520
|
+
...vn(l, mn),
|
|
521
|
+
...yn(u),
|
|
522
|
+
...s
|
|
523
523
|
];
|
|
524
524
|
}
|
|
525
525
|
//#endregion
|
|
@@ -547,14 +547,14 @@ function Tn(e, t) {
|
|
|
547
547
|
}] : [];
|
|
548
548
|
}
|
|
549
549
|
function En(e, t) {
|
|
550
|
-
return e.dotStyle !==
|
|
550
|
+
return e.dotStyle !== Pt.Range || t === "range" ? [] : [{
|
|
551
551
|
code: "missing-range-columns",
|
|
552
552
|
severity: "warning",
|
|
553
553
|
message: "Range style needs a low and a high column. Pick them in low and high."
|
|
554
554
|
}];
|
|
555
555
|
}
|
|
556
556
|
function Dn(e, t, n) {
|
|
557
|
-
let r =
|
|
557
|
+
let r = re(e, t), { rows: i, dropped: a } = Se(e, r, n);
|
|
558
558
|
return [
|
|
559
559
|
..._n(e, t, Sn, "warning"),
|
|
560
560
|
...En(t, r.mode),
|
|
@@ -608,7 +608,7 @@ var On = /* @__PURE__ */ new Set([
|
|
|
608
608
|
"fixedHeight",
|
|
609
609
|
"fixedWidth",
|
|
610
610
|
"maxWidth"
|
|
611
|
-
]), G =
|
|
611
|
+
]), G = st, jn = /* @__PURE__ */ new Set([
|
|
612
612
|
"text",
|
|
613
613
|
"repeat",
|
|
614
614
|
"textColor",
|
|
@@ -689,7 +689,7 @@ function Ln(e, t, n) {
|
|
|
689
689
|
}
|
|
690
690
|
function Rn(e, t, n, r) {
|
|
691
691
|
let i = t.value, a = String(i).toLowerCase();
|
|
692
|
-
if (e.type ===
|
|
692
|
+
if (e.type === ce.Boolean) {
|
|
693
693
|
if (e.key === "valueLabels" && a === "percent" || i === !0 || i === !1 || a === "true" || a === "false") return;
|
|
694
694
|
r.push({
|
|
695
695
|
code: "invalid-boolean",
|
|
@@ -706,7 +706,7 @@ function Rn(e, t, n, r) {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
function zn(e, t, n, r) {
|
|
709
|
-
let i =
|
|
709
|
+
let i = C(e), a = /* @__PURE__ */ new Set([...i.map((e) => e.key), ...On]);
|
|
710
710
|
for (let o of t) {
|
|
711
711
|
let t = `${n}.${o.key}`;
|
|
712
712
|
Ln(o, t, r);
|
|
@@ -726,36 +726,36 @@ function zn(e, t, n, r) {
|
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
728
|
function Bn(e) {
|
|
729
|
-
return e ===
|
|
729
|
+
return e === E.Range ? Pn : e === E.Free ? Fn : jn;
|
|
730
730
|
}
|
|
731
731
|
function Vn(e) {
|
|
732
|
-
return
|
|
732
|
+
return l[e];
|
|
733
733
|
}
|
|
734
734
|
function Hn(e, t, n) {
|
|
735
|
-
e.forEach((e,
|
|
736
|
-
let
|
|
737
|
-
for (let
|
|
738
|
-
let e = `${t}.${
|
|
739
|
-
Ln(
|
|
735
|
+
e.forEach((e, r) => {
|
|
736
|
+
let i = e.kind ?? E.Point, a = Bn(i), o = Vn(i);
|
|
737
|
+
for (let i of e.properties) {
|
|
738
|
+
let e = `${t}.${o}[${r}].${i.key}`;
|
|
739
|
+
Ln(i, e, n), !a.has(i.key) && n.push({
|
|
740
740
|
code: "unknown-annotation-property",
|
|
741
741
|
path: e,
|
|
742
|
-
message: `Unknown ${
|
|
743
|
-
suggestion: U(
|
|
742
|
+
message: `Unknown ${o} property "${i.key}"; it will be silently ignored.`,
|
|
743
|
+
suggestion: U(i.key, a)
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
|
-
let
|
|
747
|
-
if (
|
|
748
|
-
let e = String(
|
|
749
|
-
e === "true" || e === "false" || typeof
|
|
746
|
+
let s = b(e.properties).get("repeat");
|
|
747
|
+
if (s !== void 0) {
|
|
748
|
+
let e = String(s).toLowerCase();
|
|
749
|
+
e === "true" || e === "false" || typeof s == "number" && Number.isInteger(s) && s >= 1 || n.push({
|
|
750
750
|
code: "invalid-annotation-repeat",
|
|
751
|
-
message: `repeat must be false, true, or a positive integer (got ${String(
|
|
752
|
-
path: `${t}.${
|
|
751
|
+
message: `repeat must be false, true, or a positive integer (got ${String(s)})`,
|
|
752
|
+
path: `${t}.${o}[${r}].repeat`
|
|
753
753
|
});
|
|
754
754
|
}
|
|
755
755
|
});
|
|
756
756
|
}
|
|
757
757
|
function Un(e, t, n, r) {
|
|
758
|
-
let i =
|
|
758
|
+
let i = C(e);
|
|
759
759
|
t.forEach((e, t) => {
|
|
760
760
|
for (let a of e.properties) {
|
|
761
761
|
let e = `${n}.series[${t}].${a.key}`;
|
|
@@ -829,7 +829,7 @@ function Kn(e, t) {
|
|
|
829
829
|
});
|
|
830
830
|
}
|
|
831
831
|
function qn(e) {
|
|
832
|
-
let t = [], n = [], r =
|
|
832
|
+
let t = [], n = [], r = g(), i = r.includes(e.chartType);
|
|
833
833
|
i || t.push({
|
|
834
834
|
code: "unknown-chart-type",
|
|
835
835
|
path: "chartType",
|
|
@@ -841,10 +841,10 @@ function qn(e) {
|
|
|
841
841
|
code: "missing-data",
|
|
842
842
|
path: "data",
|
|
843
843
|
message: e.data && e.data.entries.length === 0 ? "Data block is empty." : "Chart has no data."
|
|
844
|
-
}), e.data && Jn(e.data.entries, n), e.data && Yn(e.data.entries, n), Kn(e, n), e.chartType ===
|
|
844
|
+
}), e.data && Jn(e.data.entries, n), e.data && Yn(e.data.entries, n), Kn(e, n), e.chartType === x.Scatter && Zn(e.data, e.properties, "chart", "data", t, n), e.chartType === x.DotPlot && Qn(e.data, e.properties, "chart", "data", n), e.scenes.forEach((r, i) => {
|
|
845
845
|
Xn(r, e.chartType, i, t);
|
|
846
846
|
let a = r.properties.find((e) => e.key === "type")?.value ?? e.chartType;
|
|
847
|
-
a ===
|
|
847
|
+
a === x.Scatter && Zn(r.data, [...e.properties, ...r.properties], `scene[${i}]`, `scene[${i}].data`, t, n), a === x.DotPlot && Qn(r.data, [...e.properties, ...r.properties], `scene[${i}]`, `scene[${i}].data`, n);
|
|
848
848
|
}), {
|
|
849
849
|
valid: t.length === 0,
|
|
850
850
|
errors: t,
|
|
@@ -879,16 +879,16 @@ function Yn(e, t) {
|
|
|
879
879
|
}
|
|
880
880
|
function Xn(e, t, n, r) {
|
|
881
881
|
let i = `scene[${n}]`, a = e.properties.find((e) => e.key === "type")?.value, o = a == null ? t : String(a);
|
|
882
|
-
a != null && !
|
|
882
|
+
a != null && !g().includes(o) ? r.push({
|
|
883
883
|
code: "unknown-chart-type",
|
|
884
884
|
path: `${i}.type`,
|
|
885
885
|
message: `Unknown chart type "${o}".`,
|
|
886
|
-
suggestion: U(o,
|
|
886
|
+
suggestion: U(o, g())
|
|
887
887
|
}) : (zn(o, e.properties, i, r), Un(o, e.series, i, r)), Wn(e.transforms, i, r), Hn(e.annotations, i, r);
|
|
888
888
|
}
|
|
889
889
|
function Zn(e, t, n, r, i, a) {
|
|
890
890
|
if (!e || e.entries.length === 0) return;
|
|
891
|
-
let o =
|
|
891
|
+
let o = b(t), s = (e) => o.has(e) ? String(o.get(e)) : void 0, c = (e) => s(e), l = (e) => ({
|
|
892
892
|
min: s(`${e}RangeMin`),
|
|
893
893
|
max: s(`${e}RangeMax`)
|
|
894
894
|
}), u = {
|
|
@@ -903,16 +903,16 @@ function Zn(e, t, n, r, i, a) {
|
|
|
903
903
|
x: l("horizontal"),
|
|
904
904
|
y: l("vertical")
|
|
905
905
|
};
|
|
906
|
-
for (let t of xn(
|
|
906
|
+
for (let t of xn(y(T(e)), u, d, f, s("trend"))) (t.severity === "error" ? i : a).push($n(t, t.key ? `${n}.${t.key}` : r));
|
|
907
907
|
}
|
|
908
908
|
function Qn(e, t, n, r, i) {
|
|
909
909
|
if (!e || e.entries.length === 0) return;
|
|
910
|
-
let a =
|
|
910
|
+
let a = b(t), o = (e) => a.has(e) ? String(a.get(e)) : void 0, s = {
|
|
911
911
|
dotStyle: o("dotStyle"),
|
|
912
912
|
low: o("low"),
|
|
913
913
|
high: o("high")
|
|
914
914
|
};
|
|
915
|
-
for (let t of Dn(
|
|
915
|
+
for (let t of Dn(y(T(e)), s, o("horizontalScaleType"))) i.push($n(t, t.key ? `${n}.${t.key}` : r));
|
|
916
916
|
}
|
|
917
917
|
function $n({ code: e, message: t, suggestion: n }, r) {
|
|
918
918
|
return {
|
|
@@ -945,7 +945,7 @@ function Cr(e) {
|
|
|
945
945
|
return n ? [`series = "${String(n.value)}"`, ...t.filter((e) => !(e.key === "series" && !e.quotedKey)).map((e) => `"${e.key}" = "${String(e.value)}"`)].join("\n") : t.map((e) => `"${e.key}" = ${String(e.value)}`).join("\n");
|
|
946
946
|
}
|
|
947
947
|
function q(e, t) {
|
|
948
|
-
let n =
|
|
948
|
+
let n = Rt(t);
|
|
949
949
|
return {
|
|
950
950
|
id: e,
|
|
951
951
|
title: xr(n, "title"),
|
|
@@ -1004,7 +1004,7 @@ function Or() {
|
|
|
1004
1004
|
};
|
|
1005
1005
|
},
|
|
1006
1006
|
renderToContainer(e, t, n) {
|
|
1007
|
-
|
|
1007
|
+
it(e, t, {
|
|
1008
1008
|
sceneIndex: n.sceneIndex,
|
|
1009
1009
|
thumbnail: n.thumbnail ?? !1,
|
|
1010
1010
|
transition: !1,
|
|
@@ -1087,32 +1087,32 @@ function Kr(e) {
|
|
|
1087
1087
|
return /r?em$/.test(e) ? t * 16 : t;
|
|
1088
1088
|
}
|
|
1089
1089
|
function qr(e) {
|
|
1090
|
-
let t = e.frame ?? {}, n = Ur(e.theme), [r, i, a, o] =
|
|
1091
|
-
t.title && (
|
|
1090
|
+
let t = e.frame ?? {}, n = Ur(e.theme), [r, i, a, o] = d(t.padding ?? Rr).map(Kr), s = Math.max(e.width - o - i, 1), c = Gr(), l = [], u = r;
|
|
1091
|
+
t.title && (u = Z(l, X(t.title, s, Mr, !0, c), {
|
|
1092
1092
|
x: o,
|
|
1093
|
-
top:
|
|
1093
|
+
top: u,
|
|
1094
1094
|
fontSize: Mr,
|
|
1095
1095
|
fontWeight: "bold",
|
|
1096
1096
|
fill: n.color
|
|
1097
|
-
})), t.description && (
|
|
1097
|
+
})), t.description && (u = Z(l, X(t.description, s, Nr, !1, c), {
|
|
1098
1098
|
x: o,
|
|
1099
|
-
top: t.title ?
|
|
1099
|
+
top: t.title ? u + Pr : u,
|
|
1100
1100
|
fontSize: Nr,
|
|
1101
1101
|
fill: n.color
|
|
1102
1102
|
}));
|
|
1103
|
-
let f =
|
|
1104
|
-
return v = Z(
|
|
1103
|
+
let f = u, p = t.note ? X(t.note, s, J, !1, c) : [], m = c(zr, J, !1), h = [t.byline, t.source ? Br + t.source : ""].filter(Boolean).join(Vr), g = h ? X(h, Math.max(s - m - Ir, 1), J, !1, c) : [], ee = Math.max(g.length, 1), te = p.length * J * Y + Fr + ee * J * Y + a, _ = Math.max(e.height - f - te, Lr), v = f + _;
|
|
1104
|
+
return v = Z(l, p, {
|
|
1105
1105
|
x: o,
|
|
1106
1106
|
top: v,
|
|
1107
1107
|
fontSize: J,
|
|
1108
1108
|
fontStyle: "italic",
|
|
1109
1109
|
fill: n.color
|
|
1110
|
-
}) + Fr, Z(
|
|
1110
|
+
}) + Fr, Z(l, g, {
|
|
1111
1111
|
x: o,
|
|
1112
1112
|
top: v,
|
|
1113
1113
|
fontSize: J,
|
|
1114
1114
|
fill: n.color
|
|
1115
|
-
}), Z(
|
|
1115
|
+
}), Z(l, [zr], {
|
|
1116
1116
|
x: e.width - i,
|
|
1117
1117
|
top: v,
|
|
1118
1118
|
fontSize: J,
|
|
@@ -1128,7 +1128,7 @@ function qr(e) {
|
|
|
1128
1128
|
width: s,
|
|
1129
1129
|
height: _
|
|
1130
1130
|
},
|
|
1131
|
-
blocks:
|
|
1131
|
+
blocks: l,
|
|
1132
1132
|
background: t.transparentBackground ? null : n.background,
|
|
1133
1133
|
color: n.color,
|
|
1134
1134
|
fontFamily: jr
|
|
@@ -1177,7 +1177,7 @@ async function $r() {
|
|
|
1177
1177
|
async function ei(e, t = {}) {
|
|
1178
1178
|
let n;
|
|
1179
1179
|
try {
|
|
1180
|
-
n =
|
|
1180
|
+
n = Me(Rt(e));
|
|
1181
1181
|
} catch (e) {
|
|
1182
1182
|
throw new Tr(e instanceof Error ? e.message : String(e), { cause: e });
|
|
1183
1183
|
}
|
|
@@ -1190,7 +1190,7 @@ async function ei(e, t = {}) {
|
|
|
1190
1190
|
let { background: n, color: r } = Ur(t);
|
|
1191
1191
|
e.style.backgroundColor = n, e.style.setProperty("--bc-text-color", r);
|
|
1192
1192
|
}
|
|
1193
|
-
let s = t.theme === "auto" ? void 0 : t.theme, c = s ? null :
|
|
1193
|
+
let s = t.theme === "auto" ? void 0 : t.theme, c = s ? null : Ft();
|
|
1194
1194
|
function l(e) {
|
|
1195
1195
|
return s ?? e ?? (c?.matches ? "dark" : void 0);
|
|
1196
1196
|
}
|
|
@@ -1198,7 +1198,7 @@ async function ei(e, t = {}) {
|
|
|
1198
1198
|
r.renderToContainer(e, n, {
|
|
1199
1199
|
sceneIndex: i,
|
|
1200
1200
|
thumbnail: t,
|
|
1201
|
-
theme: l(
|
|
1201
|
+
theme: l(w(n, i).theme)
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
1204
|
let d = /* @__PURE__ */ new Map();
|
|
@@ -1208,7 +1208,7 @@ async function ei(e, t = {}) {
|
|
|
1208
1208
|
}), d.size || c?.removeEventListener("change", f);
|
|
1209
1209
|
}
|
|
1210
1210
|
function p(e) {
|
|
1211
|
-
let t = e.width ?? a.width, s = e.height ?? a.height, c =
|
|
1211
|
+
let t = e.width ?? a.width, s = e.height ?? a.height, c = w(n, a.sceneIndex), d = l(c.theme);
|
|
1212
1212
|
if (!i) {
|
|
1213
1213
|
let { container: e, cleanup: n } = r.createContainer(t, s);
|
|
1214
1214
|
try {
|
|
@@ -1225,7 +1225,7 @@ async function ei(e, t = {}) {
|
|
|
1225
1225
|
}), { container: p, cleanup: m } = r.createContainer(f.plot.width, f.plot.height);
|
|
1226
1226
|
try {
|
|
1227
1227
|
o(p, d), u(p, !0, a.sceneIndex);
|
|
1228
|
-
let e =
|
|
1228
|
+
let e = mt(c.chartType, c.frame, c.data);
|
|
1229
1229
|
return Yr(f, r.serializeSvg(p), e);
|
|
1230
1230
|
} finally {
|
|
1231
1231
|
m();
|
|
@@ -1263,4 +1263,4 @@ async function ei(e, t = {}) {
|
|
|
1263
1263
|
return m;
|
|
1264
1264
|
}
|
|
1265
1265
|
//#endregion
|
|
1266
|
-
export {
|
|
1266
|
+
export { l as ANNOTATION_KIND_KEYWORD, ue as Anchor, E as AnnotationKind, r as AnnotationLineStyle, $e as ArrowDirection, oe as AxisDirection, yt as BC_TRANSITION_NAME, ce as ChartOptionType, Tr as ChartParseError, x as ChartType, p as CompassDirection, _ as CrosshairDirection, ae as CrosshairStyle, s as DEFAULT_BAR_GAP, tt as DEFAULT_COLORS, me as DirectLabelMode, Pt as DotStyle, a as DslNodeType, xe as FilterCondition, ee as FrameSizing, be as GridStyle, Ce as Interpolation, h as LabelPosition, ie as LabelRotation, pt as LegendPosition, ne as LineStyle, we as MAPPING_NONE, Dr as MissingNodeRenderDepsError, Tt as NULL_VALUE, De as Orientation, Te as ParseOperationCategory, Er as PngBrowserUnsupportedError, It as RESIZE_MESSAGE, ke as RangeAnchor, pe as ScaleType, Ze as SceneTransition, t as SortDirection, He as SortMode, xt as StackMode, at as StrokeStyle, ht as SymbolShape, Xe as SymbolShowOn, Ne as SymbolStyle, st as TRANSFORM_TYPES, ct as TickPosition, vt as TransformType, Re as ValueLabelPosition, Mt as adjustColorsForBackground, _t as applyTransformNodes, Le as applyTransformNodesToChartData, et as applyTransformSteps, Me as astToDefinition, te as buildChartOptions, Yr as buildFrameSvg, zt as buildSrcdoc, Be as chartDataToTable, $t as checkCvdColors, Vt as classifyIntent, We as cleanNumericValue, rt as commitFadeOut, dn as compactSerialize, un as compactSerializeDeep, Dt as convertAnnotations, _e as convertAreaFills, u as convertColorizes, c as convertHighlights, le as convertSeriesOverrides, Et as createCanvas, Yt as createCvdSvgFilter, ve as createFrame, T as dataEntriesToString, ut as detectColumnTypes, m as detectRangeColumn, n as extractChartTypeOptions, Qe as extractSceneOverrides, Ye as fadeIn, ot as featureJoin, lt as getCachedChart, i as getChart, C as getChartOptions, de as getChartTypeDefaults, Jt as getCvdFilterId, Fe as getOutputType, Pe as getSceneTransition, qe as getTransitionDuration, nt as isDateValue, Je as isNumberValue, e as isSeriesHidden, kt as isTypeCompatible, g as listCharts, wt as listPalettes, Lt as listThemes, Oe as numericColumns, Rt as parse, Ke as parseBpcData, y as parseData, he as parseOperationMap, o as parseOperations, b as propertyMap, S as quoteDslString, Gt as recommendCharts, ye as registerChart, ei as render, bt as renderBpc, it as renderChart, Ge as renderHorizontalAxis, ze as renderLegend, dt as renderVerticalAxis, Ie as resolveBackgroundColor, Ot as resolveBarGapPadding, f as resolveChartTypeOptions, re as resolveDotPlotMapping, Ve as resolvePalette, fe as resolveScatterMapping, w as resolveScene, Ue as resolveSeriesColor, St as resolveSeriesInterpolation, wr as samples, on as serialize, Ae as serializeTableData, Ut as shapeOf, Zt as simulateCvdColor, je as snapshotForFadeOut, gt as snapshotLiveAttrs, Nt as stripDigitGroupSpaces, se as toBool, Ct as transformNodesToSteps, jt as transformValue, qn as validateChart, At as wcagContrastRatio, ge as wcagLevel };
|