@pixerate/editor 0.180.0 → 0.181.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/agent/index.cjs +34 -34
- package/dist/agent/index.js +5 -5
- package/dist/canvas/index.cjs +6 -6
- package/dist/canvas/index.js +2 -2
- package/dist/chart/index.cjs +162 -157
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +12 -7
- package/dist/chart/layout-streamgraph.d.cts +15 -0
- package/dist/chart/layout-streamgraph.d.ts +15 -0
- package/dist/chart/spec.d.cts +1 -1
- package/dist/chart/spec.d.ts +1 -1
- package/dist/chart/types.d.cts +2 -1
- package/dist/chart/types.d.ts +2 -1
- package/dist/{chunk-KPWG3PSW.js → chunk-23E5GI2U.js} +8 -2
- package/dist/{chunk-IMHRN4ZZ.js → chunk-3MO3ZS7E.js} +3 -3
- package/dist/{chunk-GXEC4FS6.cjs → chunk-5DQPDXOM.cjs} +82 -76
- package/dist/{chunk-ORZF4JOO.js → chunk-6ZZKRH7R.js} +3 -1
- package/dist/{chunk-FHNGNL3V.cjs → chunk-CZBRY4SW.cjs} +51 -51
- package/dist/{chunk-34UCPHYO.js → chunk-GOBOCZZI.js} +2 -2
- package/dist/{chunk-VKHJJUBK.cjs → chunk-HUAISCUX.cjs} +22 -18
- package/dist/{chunk-OLCHKGGO.js → chunk-L6Y7TSQ4.js} +5 -1
- package/dist/{chunk-TUXKLM5W.cjs → chunk-N76AMOKE.cjs} +224 -42
- package/dist/{chunk-RLOIEDA3.cjs → chunk-O7QXVGMP.cjs} +16 -16
- package/dist/{chunk-R2VHVQVY.js → chunk-PI2UYMZY.js} +3 -3
- package/dist/{chunk-E45AIIWY.cjs → chunk-RUONPPMC.cjs} +8 -8
- package/dist/{chunk-GTF4RYXJ.cjs → chunk-SOSBOS5T.cjs} +22 -22
- package/dist/{chunk-FKYGM35R.js → chunk-UFEDHACQ.js} +2 -2
- package/dist/{chunk-OJQVKJYD.js → chunk-WKMUBATU.js} +183 -1
- package/dist/{chunk-OUO3DSRT.cjs → chunk-WRZ6C4TU.cjs} +3 -1
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.js +6 -6
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunk55AKPTLMcjs = require('./chunk-55AKPTLM.cjs');
|
|
@@ -1239,7 +1239,7 @@ function layoutCartesian(ctx, area, visible) {
|
|
|
1239
1239
|
const { spec, theme, marks, measure, fs } = ctx;
|
|
1240
1240
|
const horizontal = spec.orientation === "horizontal";
|
|
1241
1241
|
const n = spec.categories.length;
|
|
1242
|
-
const types = new Map(visible.map((s) => [s.id,
|
|
1242
|
+
const types = new Map(visible.map((s) => [s.id, _chunkWRZ6C4TUcjs.chartSeriesType.call(void 0, spec, s)]));
|
|
1243
1243
|
const stacked = spec.stacking !== "none";
|
|
1244
1244
|
const percent = spec.stacking === "percent";
|
|
1245
1245
|
const onSecondary = (s) => s.axis === "secondary";
|
|
@@ -1276,7 +1276,7 @@ function layoutCartesian(ctx, area, visible) {
|
|
|
1276
1276
|
const stack = stacks.get(s.id);
|
|
1277
1277
|
errors.set(
|
|
1278
1278
|
s.id,
|
|
1279
|
-
|
|
1279
|
+
_chunkWRZ6C4TUcjs.chartErrorAmounts.call(void 0, s.errorBars, s.values).map((e, i) => {
|
|
1280
1280
|
const raw = s.values[i];
|
|
1281
1281
|
const seg = _optionalChain([stack, 'optionalAccess', _11 => _11.segments, 'access', _12 => _12[i]]);
|
|
1282
1282
|
if (!e || raw === null || stack && !seg) return null;
|
|
@@ -1346,7 +1346,7 @@ function layoutCartesian(ctx, area, visible) {
|
|
|
1346
1346
|
const drawOrder = [...visible].sort((a, b) => order(types.get(a.id)) - order(types.get(b.id)));
|
|
1347
1347
|
for (const s of drawOrder) {
|
|
1348
1348
|
const si = spec.series.indexOf(s);
|
|
1349
|
-
const color =
|
|
1349
|
+
const color = _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, si);
|
|
1350
1350
|
const type = types.get(s.id);
|
|
1351
1351
|
const stack = stacks.get(s.id);
|
|
1352
1352
|
const selSeries = ctx.seriesSelected(s.id);
|
|
@@ -1372,7 +1372,7 @@ function layoutCartesian(ctx, area, visible) {
|
|
|
1372
1372
|
const selected = ctx.isSelected(target);
|
|
1373
1373
|
const [x, y] = map({ c: c0, v: Math.min(a, b) });
|
|
1374
1374
|
const rect = horizontal ? { x: Math.min(a, b), y: c0, width: Math.abs(b - a), height: cw } : { x, y, width: cw, height: Math.abs(b - a) };
|
|
1375
|
-
const fill =
|
|
1375
|
+
const fill = _chunkWRZ6C4TUcjs.chartPointColor.call(void 0, spec, si, i);
|
|
1376
1376
|
marks.push({
|
|
1377
1377
|
kind: "rect",
|
|
1378
1378
|
key: `bar-${s.id}-${i}`,
|
|
@@ -1451,7 +1451,7 @@ function layoutCartesian(ctx, area, visible) {
|
|
|
1451
1451
|
const target = { kind: "point", seriesId: s.id, index: i };
|
|
1452
1452
|
const selected = ctx.isSelected(target);
|
|
1453
1453
|
const r = type === "scatter" ? 4.5 : 3.5;
|
|
1454
|
-
const pointColor =
|
|
1454
|
+
const pointColor = _chunkWRZ6C4TUcjs.chartPointColor.call(void 0, spec, si, i);
|
|
1455
1455
|
const fill = showDots ? type === "scatter" ? pointColor : theme.surface : "transparent";
|
|
1456
1456
|
marks.push(
|
|
1457
1457
|
pointMark({ key: `point-${s.id}-${i}`, target, selected: selected || selSeries, opacity: type === "scatter" ? 0.85 : void 0 }, showDots ? marker : "hit", cx, cy, showDots ? r : 6, fill, showDots ? pointColor : void 0, 2)
|
|
@@ -1525,8 +1525,8 @@ function layoutXy(ctx, area, visible) {
|
|
|
1525
1525
|
const yErrors = /* @__PURE__ */ new Map();
|
|
1526
1526
|
const xErrors = /* @__PURE__ */ new Map();
|
|
1527
1527
|
for (const { s } of all) {
|
|
1528
|
-
if (s.errorBars) yErrors.set(s.id,
|
|
1529
|
-
if (s.xErrorBars) xErrors.set(s.id,
|
|
1528
|
+
if (s.errorBars) yErrors.set(s.id, _chunkWRZ6C4TUcjs.chartErrorAmounts.call(void 0, s.errorBars, s.values));
|
|
1529
|
+
if (s.xErrorBars) xErrors.set(s.id, _chunkWRZ6C4TUcjs.chartErrorAmounts.call(void 0, s.xErrorBars, s.values.map((_, i) => _nullishCoalesce(_optionalChain([s, 'access', _29 => _29.x, 'optionalAccess', _30 => _30[i]]), () => ( (bubble || !s.x ? i + 1 : null))))));
|
|
1530
1530
|
}
|
|
1531
1531
|
let xlo = Infinity;
|
|
1532
1532
|
let xhi = -Infinity;
|
|
@@ -1609,8 +1609,8 @@ function layoutXy(ctx, area, visible) {
|
|
|
1609
1609
|
const trendLabels = [];
|
|
1610
1610
|
for (const { s, pts } of all) {
|
|
1611
1611
|
const si = spec.series.indexOf(s);
|
|
1612
|
-
const color =
|
|
1613
|
-
const type =
|
|
1612
|
+
const color = _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, si);
|
|
1613
|
+
const type = _chunkWRZ6C4TUcjs.chartSeriesType.call(void 0, spec, s);
|
|
1614
1614
|
const selSeries = ctx.seriesSelected(s.id);
|
|
1615
1615
|
const seriesTarget = { kind: "series", seriesId: s.id };
|
|
1616
1616
|
if (type === "line" || type === "area") {
|
|
@@ -1635,7 +1635,7 @@ function layoutXy(ctx, area, visible) {
|
|
|
1635
1635
|
}
|
|
1636
1636
|
const target = { kind: "point", seriesId: s.id, index: p.i };
|
|
1637
1637
|
const selected = ctx.isSelected(target);
|
|
1638
|
-
const pointColor =
|
|
1638
|
+
const pointColor = _chunkWRZ6C4TUcjs.chartPointColor.call(void 0, spec, si, p.i);
|
|
1639
1639
|
const r = bubble ? maxSize > 0 && p.size !== null && p.size > 0 ? Math.max(2, Math.sqrt(p.size / maxSize) * maxR) : 2 : 4.5;
|
|
1640
1640
|
if (bubble) marks.push({ kind: "circle", key: `point-${s.id}-${p.i}`, role: "point", cx, cy, r, fill: pointColor, stroke: pointColor, strokeWidth: 1, opacity: 0.6, target, selected: selected || selSeries });
|
|
1641
1641
|
else marks.push(pointMark({ key: `point-${s.id}-${p.i}`, target, selected: selected || selSeries, opacity: 0.85 }, marker === "none" ? "hit" : marker, cx, cy, marker === "none" ? 6 : r, marker === "none" ? "transparent" : pointColor, marker === "none" ? void 0 : pointColor, 2));
|
|
@@ -1678,6 +1678,185 @@ function trendlineLegendItems(spec, color) {
|
|
|
1678
1678
|
);
|
|
1679
1679
|
}
|
|
1680
1680
|
|
|
1681
|
+
// src/chart/layout-streamgraph.ts
|
|
1682
|
+
function layoutStreamgraph(ctx, area, visible) {
|
|
1683
|
+
const { spec, theme, marks, selection } = ctx;
|
|
1684
|
+
const n = spec.categories.length;
|
|
1685
|
+
if (!visible.length || n === 0) {
|
|
1686
|
+
const plot2 = { x: area.x + 8, y: area.y + 8, width: Math.max(1, area.width - 16), height: Math.max(1, area.height - 16) };
|
|
1687
|
+
marks.push({
|
|
1688
|
+
kind: "text",
|
|
1689
|
+
key: "empty",
|
|
1690
|
+
role: "empty",
|
|
1691
|
+
x: plot2.x + plot2.width / 2,
|
|
1692
|
+
y: plot2.y + plot2.height / 2,
|
|
1693
|
+
text: _nullishCoalesce(ctx.options.emptyMessage, () => ( "No data")),
|
|
1694
|
+
anchor: "middle",
|
|
1695
|
+
baseline: "middle",
|
|
1696
|
+
size: ctx.fs + 1,
|
|
1697
|
+
fill: theme.mutedText
|
|
1698
|
+
});
|
|
1699
|
+
return { plot: plot2 };
|
|
1700
|
+
}
|
|
1701
|
+
const totals = new Array(n).fill(0);
|
|
1702
|
+
for (let i = 0; i < n; i++) {
|
|
1703
|
+
let colSum = 0;
|
|
1704
|
+
for (const s of visible) {
|
|
1705
|
+
const v = s.values[i];
|
|
1706
|
+
if (v !== null && Number.isFinite(v) && v > 0) {
|
|
1707
|
+
colSum += v;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
totals[i] = colSum;
|
|
1711
|
+
}
|
|
1712
|
+
const maxTotal = Math.max(0, ...totals);
|
|
1713
|
+
const halfTotal = maxTotal > 0 ? maxTotal / 2 : 1;
|
|
1714
|
+
const headroom = spec.yAxis.max === null;
|
|
1715
|
+
const maxHalf = headroom ? halfTotal * 1.15 : halfTotal;
|
|
1716
|
+
const lo = -maxHalf;
|
|
1717
|
+
const hi = maxHalf;
|
|
1718
|
+
const frame = categoryFrame(ctx, area, {
|
|
1719
|
+
labels: spec.categories,
|
|
1720
|
+
horizontal: spec.orientation === "horizontal",
|
|
1721
|
+
primary: {
|
|
1722
|
+
lo,
|
|
1723
|
+
hi,
|
|
1724
|
+
axis: spec.yAxis,
|
|
1725
|
+
format: spec.yAxis.format,
|
|
1726
|
+
frozen: ctx.options.valueDomain,
|
|
1727
|
+
key: "y"
|
|
1728
|
+
}
|
|
1729
|
+
});
|
|
1730
|
+
const { plot, catCenter, map, value } = frame;
|
|
1731
|
+
const curve = spec.curve === "step" ? "linear" : spec.curve;
|
|
1732
|
+
const baselines = totals.map((t) => -0.5 * t);
|
|
1733
|
+
const currentOffsets = [...baselines];
|
|
1734
|
+
const zeroPx = value.px(0);
|
|
1735
|
+
const [zx1, zy1] = map({ c: frame.catStart, v: zeroPx });
|
|
1736
|
+
const [zx2, zy2] = map({ c: frame.catStart + frame.catLen, v: zeroPx });
|
|
1737
|
+
marks.push({
|
|
1738
|
+
kind: "line",
|
|
1739
|
+
key: "rule-zero",
|
|
1740
|
+
role: "grid",
|
|
1741
|
+
x1: zx1,
|
|
1742
|
+
y1: zy1,
|
|
1743
|
+
x2: zx2,
|
|
1744
|
+
y2: zy2,
|
|
1745
|
+
stroke: theme.axis,
|
|
1746
|
+
strokeWidth: 1,
|
|
1747
|
+
dash: "3,3"
|
|
1748
|
+
});
|
|
1749
|
+
const layers = [];
|
|
1750
|
+
for (let sIdx = 0; sIdx < visible.length; sIdx++) {
|
|
1751
|
+
const s = visible[sIdx];
|
|
1752
|
+
const color = _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
|
|
1753
|
+
const selSeries = ctx.seriesSelected(s.id);
|
|
1754
|
+
const bottomPts = [];
|
|
1755
|
+
const topPts = [];
|
|
1756
|
+
for (let i = 0; i < n; i++) {
|
|
1757
|
+
const c = catCenter(i);
|
|
1758
|
+
const rawVal = s.values[i];
|
|
1759
|
+
const val = rawVal !== null && Number.isFinite(rawVal) && rawVal > 0 ? rawVal : 0;
|
|
1760
|
+
const bVal = currentOffsets[i];
|
|
1761
|
+
const tVal = bVal + val;
|
|
1762
|
+
currentOffsets[i] = tVal;
|
|
1763
|
+
bottomPts.push({ c, v: value.px(bVal), i });
|
|
1764
|
+
topPts.push({ c, v: value.px(tVal), i });
|
|
1765
|
+
}
|
|
1766
|
+
layers.push({ series: s, color, selSeries, bottomPts, topPts });
|
|
1767
|
+
}
|
|
1768
|
+
for (const layer of layers) {
|
|
1769
|
+
const { series: s, color, selSeries, bottomPts, topPts } = layer;
|
|
1770
|
+
const seriesTarget = { kind: "series", seriesId: s.id };
|
|
1771
|
+
const revBottom = [...bottomPts].reverse();
|
|
1772
|
+
const d = `${curvePath(topPts, curve, map)}${curvePath(revBottom, curve, map, false)}Z`;
|
|
1773
|
+
marks.push({
|
|
1774
|
+
kind: "path",
|
|
1775
|
+
key: `area-${s.id}`,
|
|
1776
|
+
role: "area",
|
|
1777
|
+
d,
|
|
1778
|
+
fill: color,
|
|
1779
|
+
opacity: selSeries ? 0.85 : 0.65,
|
|
1780
|
+
target: seriesTarget,
|
|
1781
|
+
selected: selSeries
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
if (layers.length > 0) {
|
|
1785
|
+
const bottomBase = layers[0].bottomPts;
|
|
1786
|
+
marks.push({
|
|
1787
|
+
kind: "path",
|
|
1788
|
+
key: `boundary-bottom`,
|
|
1789
|
+
role: "line",
|
|
1790
|
+
d: curvePath(bottomBase, curve, map),
|
|
1791
|
+
fill: "none",
|
|
1792
|
+
stroke: theme.axis,
|
|
1793
|
+
strokeWidth: 1.5,
|
|
1794
|
+
opacity: 0.7
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
for (const layer of layers) {
|
|
1798
|
+
const { series: s, color, selSeries, topPts } = layer;
|
|
1799
|
+
const seriesTarget = { kind: "series", seriesId: s.id };
|
|
1800
|
+
marks.push({
|
|
1801
|
+
kind: "path",
|
|
1802
|
+
key: `line-${s.id}`,
|
|
1803
|
+
role: "line",
|
|
1804
|
+
d: curvePath(topPts, curve, map),
|
|
1805
|
+
fill: "none",
|
|
1806
|
+
stroke: color,
|
|
1807
|
+
strokeWidth: selSeries ? 3 : 1.75,
|
|
1808
|
+
target: seriesTarget,
|
|
1809
|
+
selected: selSeries
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
const showDots = spec.points;
|
|
1813
|
+
for (const layer of layers) {
|
|
1814
|
+
const { series: s, color } = layer;
|
|
1815
|
+
for (let i = 0; i < n; i++) {
|
|
1816
|
+
const rawVal = s.values[i];
|
|
1817
|
+
if (rawVal === null || !Number.isFinite(rawVal)) continue;
|
|
1818
|
+
const bPt = layer.bottomPts[i];
|
|
1819
|
+
const tPt = layer.topPts[i];
|
|
1820
|
+
const midV = (bPt.v + tPt.v) / 2;
|
|
1821
|
+
const [cx, cy] = map({ c: bPt.c, v: midV });
|
|
1822
|
+
const target = { kind: "point", seriesId: s.id, index: i };
|
|
1823
|
+
const selected = ctx.isSelected(target);
|
|
1824
|
+
if (showDots || selected) {
|
|
1825
|
+
marks.push({
|
|
1826
|
+
kind: "circle",
|
|
1827
|
+
key: `pt-${s.id}-${i}`,
|
|
1828
|
+
role: "point",
|
|
1829
|
+
cx: r2(cx),
|
|
1830
|
+
cy: r2(cy),
|
|
1831
|
+
r: selected ? 5 : 3.5,
|
|
1832
|
+
fill: selected ? theme.selection : color,
|
|
1833
|
+
stroke: theme.surface,
|
|
1834
|
+
strokeWidth: 1.5,
|
|
1835
|
+
target,
|
|
1836
|
+
selected
|
|
1837
|
+
});
|
|
1838
|
+
} else {
|
|
1839
|
+
marks.push({
|
|
1840
|
+
kind: "circle",
|
|
1841
|
+
key: `hit-${s.id}-${i}`,
|
|
1842
|
+
role: "point",
|
|
1843
|
+
cx: r2(cx),
|
|
1844
|
+
cy: r2(cy),
|
|
1845
|
+
r: 6,
|
|
1846
|
+
fill: "transparent",
|
|
1847
|
+
stroke: "none",
|
|
1848
|
+
target
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
return {
|
|
1854
|
+
plot,
|
|
1855
|
+
valueScale: toValueScale(value, frame.horizontal ? "x" : "y"),
|
|
1856
|
+
categoryScale: { axis: frame.horizontal ? "y" : "x", start: frame.catStart, length: frame.catLen, count: frame.n, reverse: !!spec.xAxis.reverse }
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1681
1860
|
// src/chart/maps.ts
|
|
1682
1861
|
var maps = /* @__PURE__ */ new Map();
|
|
1683
1862
|
function registerChartMap(map) {
|
|
@@ -1720,7 +1899,7 @@ function chartMapBreaks(values, steps, thresholds) {
|
|
|
1720
1899
|
var chartMapClass = (value, breaks) => breaks.filter((b) => value >= b).length;
|
|
1721
1900
|
function chartMapRamp(base, count) {
|
|
1722
1901
|
if (count <= 1) return [base];
|
|
1723
|
-
return Array.from({ length: count }, (_, k) =>
|
|
1902
|
+
return Array.from({ length: count }, (_, k) => _chunkWRZ6C4TUcjs.shadeChartColor.call(void 0, base, 0.82 - 1.17 * k / (count - 1)));
|
|
1724
1903
|
}
|
|
1725
1904
|
|
|
1726
1905
|
// src/chart/race.ts
|
|
@@ -1756,7 +1935,7 @@ function chartRaceRanking(spec, frame) {
|
|
|
1756
1935
|
}
|
|
1757
1936
|
|
|
1758
1937
|
// src/chart/layout-families.ts
|
|
1759
|
-
var sliceColor = (ctx, series, i) => _optionalChain([series, 'access', _45 => _45.pointColors, 'optionalAccess', _46 => _46[i]]) ||
|
|
1938
|
+
var sliceColor = (ctx, series, i) => _optionalChain([series, 'access', _45 => _45.pointColors, 'optionalAccess', _46 => _46[i]]) || _chunkWRZ6C4TUcjs.chartSliceColor.call(void 0, ctx.spec, i);
|
|
1760
1939
|
function layoutPie(ctx, area, series) {
|
|
1761
1940
|
const { spec, theme, marks, fs, selection } = ctx;
|
|
1762
1941
|
const values = spec.categories.map((_, i) => {
|
|
@@ -1872,7 +2051,7 @@ function layoutRadar(ctx, area, visible) {
|
|
|
1872
2051
|
});
|
|
1873
2052
|
for (const s of visible) {
|
|
1874
2053
|
const si = spec.series.indexOf(s);
|
|
1875
|
-
const color =
|
|
2054
|
+
const color = _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, si);
|
|
1876
2055
|
const selSeries = ctx.seriesSelected(s.id);
|
|
1877
2056
|
const pts = s.values.map((v, i) => v !== null && Number.isFinite(v) ? at(i, rOf(v)) : null);
|
|
1878
2057
|
const present = pts.filter((p) => p !== null);
|
|
@@ -1922,7 +2101,7 @@ function layoutWaterfall(ctx, area, series) {
|
|
|
1922
2101
|
});
|
|
1923
2102
|
const { band, catCenter, map, value } = frame;
|
|
1924
2103
|
const w = band * (1 - spec.gapWidth);
|
|
1925
|
-
const color =
|
|
2104
|
+
const color = _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(series));
|
|
1926
2105
|
const format = _nullishCoalesce(series.format, () => ( spec.yAxis.format));
|
|
1927
2106
|
const labelsOn = _nullishCoalesce(series.dataLabels, () => ( spec.dataLabels));
|
|
1928
2107
|
let prevEnd = null;
|
|
@@ -1981,7 +2160,7 @@ function layoutHistogram(ctx, area, visible) {
|
|
|
1981
2160
|
const gap = k > 1 ? band * spec.gapWidth * 0.5 : 0;
|
|
1982
2161
|
const w = (band - gap) / k;
|
|
1983
2162
|
visible.forEach((s, si) => {
|
|
1984
|
-
const color =
|
|
2163
|
+
const color = _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
|
|
1985
2164
|
const target = { kind: "series", seriesId: s.id };
|
|
1986
2165
|
const selected = ctx.seriesSelected(s.id);
|
|
1987
2166
|
counts[si].forEach((c, b) => {
|
|
@@ -2012,7 +2191,7 @@ function layoutBox(ctx, area, visible) {
|
|
|
2012
2191
|
visible.forEach((s, i) => {
|
|
2013
2192
|
const st = stats[i];
|
|
2014
2193
|
if (!st) return;
|
|
2015
|
-
const color =
|
|
2194
|
+
const color = _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
|
|
2016
2195
|
const target = { kind: "series", seriesId: s.id };
|
|
2017
2196
|
const selected = ctx.seriesSelected(s.id);
|
|
2018
2197
|
const c = catCenter(i);
|
|
@@ -2231,7 +2410,7 @@ function layoutLikert(ctx, area, visible) {
|
|
|
2231
2410
|
if (x1 - x0 <= 0) return;
|
|
2232
2411
|
const target = { kind: "point", seriesId: s.id, index: i };
|
|
2233
2412
|
const selected = ctx.isSelected(target);
|
|
2234
|
-
const fill = _optionalChain([s, 'access', _48 => _48.pointColors, 'optionalAccess', _49 => _49[i]]) ||
|
|
2413
|
+
const fill = _optionalChain([s, 'access', _48 => _48.pointColors, 'optionalAccess', _49 => _49[i]]) || _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
|
|
2235
2414
|
const rect = { x: x0, y, width: x1 - x0, height: barH };
|
|
2236
2415
|
marks.push({ kind: "rect", key, role: "bar", ...rect, fill, target, selected: selected || ctx.seriesSelected(s.id) || catSelected });
|
|
2237
2416
|
if (selected) ctx.outline(`${key}-selection`, { x: rect.x - 2, y: rect.y - 2, width: rect.width + 4, height: rect.height + 4 });
|
|
@@ -2330,8 +2509,8 @@ function layoutParliament(ctx, area, series) {
|
|
|
2330
2509
|
}
|
|
2331
2510
|
function treeColor(ctx, series, node, group, base, shade) {
|
|
2332
2511
|
if (node.color) return node.color;
|
|
2333
|
-
if (base === null) return _optionalChain([series, 'optionalAccess', _50 => _50.pointColors, 'optionalAccess', _51 => _51[group]]) ||
|
|
2334
|
-
return
|
|
2512
|
+
if (base === null) return _optionalChain([series, 'optionalAccess', _50 => _50.pointColors, 'optionalAccess', _51 => _51[group]]) || _chunkWRZ6C4TUcjs.chartSliceColor.call(void 0, ctx.spec, group);
|
|
2513
|
+
return _chunkWRZ6C4TUcjs.shadeChartColor.call(void 0, base, shade);
|
|
2335
2514
|
}
|
|
2336
2515
|
function layoutTreemapTree(ctx, area, series) {
|
|
2337
2516
|
const { spec, marks, theme, fs, measure } = ctx;
|
|
@@ -2339,7 +2518,7 @@ function layoutTreemapTree(ctx, area, series) {
|
|
|
2339
2518
|
const labelsOn = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _53 => _53.dataLabels]), () => ( true));
|
|
2340
2519
|
let unlabelled = 0;
|
|
2341
2520
|
const draw = (nodes, rect, key, group, base) => {
|
|
2342
|
-
const rects = chartSquarify(nodes.map(
|
|
2521
|
+
const rects = chartSquarify(nodes.map(_chunkWRZ6C4TUcjs.chartTreeTotal), rect);
|
|
2343
2522
|
nodes.forEach((node, k) => {
|
|
2344
2523
|
const r = rects[k];
|
|
2345
2524
|
if (r.width <= 0.5 || r.height <= 0.5) return;
|
|
@@ -2374,10 +2553,10 @@ function layoutTreemapTree(ctx, area, series) {
|
|
|
2374
2553
|
}
|
|
2375
2554
|
function layoutSunburst(ctx, area, series) {
|
|
2376
2555
|
const { spec, marks, theme, fs, measure } = ctx;
|
|
2377
|
-
const tree = spec.tree.length ? spec.tree :
|
|
2556
|
+
const tree = spec.tree.length ? spec.tree : _chunkWRZ6C4TUcjs.chartTreeFromSeries.call(void 0, spec.categories, _nullishCoalesce(_optionalChain([series, 'optionalAccess', _55 => _55.values]), () => ( [])));
|
|
2378
2557
|
const indexOf = new Map(spec.categories.map((c, i) => [c.trim() || `${i + 1}`, i]));
|
|
2379
|
-
const depth =
|
|
2380
|
-
const total = tree.reduce((t, n) => t +
|
|
2558
|
+
const depth = _chunkWRZ6C4TUcjs.chartTreeDepth.call(void 0, tree);
|
|
2559
|
+
const total = tree.reduce((t, n) => t + _chunkWRZ6C4TUcjs.chartTreeTotal.call(void 0, n), 0);
|
|
2381
2560
|
const cx = area.x + area.width / 2;
|
|
2382
2561
|
const cy = area.y + area.height / 2;
|
|
2383
2562
|
const outer = Math.max(8, Math.min(area.width, area.height) / 2 - 4);
|
|
@@ -2391,10 +2570,10 @@ function layoutSunburst(ctx, area, series) {
|
|
|
2391
2570
|
const format = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _56 => _56.format]), () => ( spec.yAxis.format));
|
|
2392
2571
|
let unlabelled = 0;
|
|
2393
2572
|
const walk = (nodes, start, sweep, level, key, group, base) => {
|
|
2394
|
-
const sum = nodes.reduce((t, n) => t +
|
|
2573
|
+
const sum = nodes.reduce((t, n) => t + _chunkWRZ6C4TUcjs.chartTreeTotal.call(void 0, n), 0);
|
|
2395
2574
|
let at = start;
|
|
2396
2575
|
nodes.forEach((node, k) => {
|
|
2397
|
-
const value =
|
|
2576
|
+
const value = _chunkWRZ6C4TUcjs.chartTreeTotal.call(void 0, node);
|
|
2398
2577
|
if (!(value > 0) || !sum) return;
|
|
2399
2578
|
const a0 = at;
|
|
2400
2579
|
const a1 = at + sweep * value / sum;
|
|
@@ -2466,7 +2645,7 @@ function layoutSankey(ctx, area, series) {
|
|
|
2466
2645
|
y += value[i] * ky + pad;
|
|
2467
2646
|
}
|
|
2468
2647
|
}
|
|
2469
|
-
const color = (i) => _optionalChain([series, 'optionalAccess', _61 => _61.pointColors, 'optionalAccess', _62 => _62[i]]) ||
|
|
2648
|
+
const color = (i) => _optionalChain([series, 'optionalAccess', _61 => _61.pointColors, 'optionalAccess', _62 => _62[i]]) || _chunkWRZ6C4TUcjs.chartSliceColor.call(void 0, spec, i);
|
|
2470
2649
|
const named = new Set(spec.highlight);
|
|
2471
2650
|
const lit = nodes.map((n) => named.has(n));
|
|
2472
2651
|
const dimLinks = lit.some(Boolean);
|
|
@@ -2551,7 +2730,7 @@ function layoutBarRace(ctx, area, frame) {
|
|
|
2551
2730
|
const target = { kind: "point", seriesId: e.seriesId, index };
|
|
2552
2731
|
const selected = ctx.isSelected(target) || ctx.seriesSelected(e.seriesId);
|
|
2553
2732
|
const width = Math.max(0, xOf(e.value) - plot.x);
|
|
2554
|
-
marks.push({ kind: "rect", key: `bar-${e.seriesId}`, role: "bar", x: plot.x, y, width, height: barH, fill:
|
|
2733
|
+
marks.push({ kind: "rect", key: `bar-${e.seriesId}`, role: "bar", x: plot.x, y, width, height: barH, fill: _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, si), radius: Math.min(3, barH / 4), target, selected, ...selected ? { stroke: theme.selection, strokeWidth: 1.5 } : {} });
|
|
2555
2734
|
marks.push({ kind: "text", key: `label-name-${e.seriesId}`, role: "tick-label", x: plot.x - 6, y: y + barH / 2, text: truncate(e.name, labelW - 8, fs, measure), anchor: "end", baseline: "middle", size: fs, fill: selected ? theme.selection : theme.text, target: { kind: "series", seriesId: e.seriesId } });
|
|
2556
2735
|
if (_nullishCoalesce(s.dataLabels, () => ( true))) marks.push({ kind: "text", key: `label-${e.seriesId}`, role: "data-label", x: plot.x + width + 5, y: y + barH / 2, text: formatChartNumber(e.value, _nullishCoalesce(s.format, () => ( format)), _nullishCoalesce((_nullishCoalesce(s.format, () => ( format))).decimals, () => ( (Math.abs(e.value) >= 100 ? 0 : void 0)))), anchor: "start", baseline: "middle", size: fs - 1, fill: theme.text, target });
|
|
2557
2736
|
}
|
|
@@ -2576,7 +2755,7 @@ function layoutChoropleth(ctx, area, series) {
|
|
|
2576
2755
|
};
|
|
2577
2756
|
const present = [...indexOf.values()].map(valueAt).filter((v) => v !== null);
|
|
2578
2757
|
const breaks = chartMapBreaks(present, spec.mapSteps, spec.mapThresholds);
|
|
2579
|
-
const ramp = chartMapRamp(_nullishCoalesce(series.color, () => (
|
|
2758
|
+
const ramp = chartMapRamp(_nullishCoalesce(series.color, () => ( _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(series)))), breaks.length + 1);
|
|
2580
2759
|
const format = _nullishCoalesce(series.format, () => ( spec.yAxis.format));
|
|
2581
2760
|
const legendH = fs * 2.2;
|
|
2582
2761
|
const s = Math.max(1e-6, Math.min(area.width / map.width, (area.height - legendH) / map.height));
|
|
@@ -2621,14 +2800,14 @@ function layoutChoropleth(ctx, area, series) {
|
|
|
2621
2800
|
|
|
2622
2801
|
// src/chart/layout.ts
|
|
2623
2802
|
function legendItems(spec, ctx) {
|
|
2624
|
-
const family =
|
|
2803
|
+
const family = _chunkWRZ6C4TUcjs.chartFamily.call(void 0, spec);
|
|
2625
2804
|
if (spec.type === "funnel" || spec.type === "slope" || spec.type === "sankey" || spec.type === "barrace" || spec.type === "choropleth") return [];
|
|
2626
|
-
if (
|
|
2805
|
+
if (_chunkWRZ6C4TUcjs.chartSpecColorsByCategory.call(void 0, spec)) {
|
|
2627
2806
|
const first = spec.series.find((s) => !s.hidden);
|
|
2628
2807
|
const seats = (i) => Math.max(0, Math.round(_nullishCoalesce(_optionalChain([first, 'optionalAccess', _68 => _68.values, 'access', _69 => _69[i]]), () => ( 0))));
|
|
2629
2808
|
return spec.categories.map((c, i) => ({
|
|
2630
2809
|
label: spec.type === "parliament" ? `${c} ${seats(i)}` : c,
|
|
2631
|
-
color: _optionalChain([first, 'optionalAccess', _70 => _70.pointColors, 'optionalAccess', _71 => _71[i]]) ||
|
|
2810
|
+
color: _optionalChain([first, 'optionalAccess', _70 => _70.pointColors, 'optionalAccess', _71 => _71[i]]) || _chunkWRZ6C4TUcjs.chartSliceColor.call(void 0, spec, i),
|
|
2632
2811
|
target: { kind: "category", index: i },
|
|
2633
2812
|
faded: false,
|
|
2634
2813
|
selected: ctx.isSelected({ kind: "category", index: i }),
|
|
@@ -2642,17 +2821,17 @@ function legendItems(spec, ctx) {
|
|
|
2642
2821
|
return [
|
|
2643
2822
|
{ label: "Increase", color: ctx.theme.positive, target, faded: false, selected: false, shape: "square" },
|
|
2644
2823
|
{ label: "Decrease", color: ctx.theme.negative, target, faded: false, selected: false, shape: "square" },
|
|
2645
|
-
{ label: "Total", color:
|
|
2824
|
+
{ label: "Total", color: _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(first)), target, faded: false, selected: false, shape: "square" }
|
|
2646
2825
|
];
|
|
2647
2826
|
}
|
|
2648
2827
|
if (family === "box") return [];
|
|
2649
|
-
const trends = trendlineLegendItems(spec, (i) =>
|
|
2828
|
+
const trends = trendlineLegendItems(spec, (i) => _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, i));
|
|
2650
2829
|
const items = [];
|
|
2651
2830
|
spec.series.forEach((s, i) => {
|
|
2652
|
-
const type =
|
|
2831
|
+
const type = _chunkWRZ6C4TUcjs.chartSeriesType.call(void 0, spec, s);
|
|
2653
2832
|
items.push({
|
|
2654
2833
|
label: s.name,
|
|
2655
|
-
color:
|
|
2834
|
+
color: _chunkWRZ6C4TUcjs.chartSeriesColor.call(void 0, spec, i),
|
|
2656
2835
|
target: { kind: "series", seriesId: s.id },
|
|
2657
2836
|
faded: !!s.hidden,
|
|
2658
2837
|
selected: ctx.seriesSelected(s.id),
|
|
@@ -2665,7 +2844,7 @@ function legendItems(spec, ctx) {
|
|
|
2665
2844
|
function layoutChart(spec, options) {
|
|
2666
2845
|
const width = Math.max(1, Number.isFinite(options.width) ? options.width : 1);
|
|
2667
2846
|
const height = Math.max(1, Number.isFinite(options.height) ? options.height : 1);
|
|
2668
|
-
const theme = { ...
|
|
2847
|
+
const theme = { ..._chunkWRZ6C4TUcjs.DEFAULT_CHART_THEME, ...options.theme };
|
|
2669
2848
|
const selection = _nullishCoalesce(options.selection, () => ( null));
|
|
2670
2849
|
const marks = [];
|
|
2671
2850
|
const warnings = [];
|
|
@@ -2704,17 +2883,17 @@ function layoutChart(spec, options) {
|
|
|
2704
2883
|
if (spec.title) titleMark("title", spec.title, theme.titleSize, 600, theme.text);
|
|
2705
2884
|
if (spec.subtitle) titleMark("subtitle", spec.subtitle, fs + 1, 400, theme.mutedText);
|
|
2706
2885
|
if (spec.title || spec.subtitle) top += 6;
|
|
2707
|
-
const family =
|
|
2886
|
+
const family = _chunkWRZ6C4TUcjs.chartFamily.call(void 0, spec);
|
|
2708
2887
|
const visible = spec.series.filter((s) => !s.hidden);
|
|
2709
2888
|
const items = legendItems(spec, ctx);
|
|
2710
2889
|
let area = { x: pad, y: top, width: width - pad * 2, height: height - top - pad - noteHeight(spec, fs) };
|
|
2711
2890
|
const seriesLegend = family === "cartesian" || family === "xy" || family === "radar" || family === "histogram";
|
|
2712
2891
|
const hasTrend = items.some((i) => i.shape === "dash");
|
|
2713
|
-
const showLegend = spec.legend.show && items.length > 0 && (!seriesLegend ||
|
|
2892
|
+
const showLegend = spec.legend.show && items.length > 0 && (!seriesLegend || _chunkWRZ6C4TUcjs.chartVariesColors.call(void 0, spec) || spec.series.length > 1 || spec.series.some((s) => s.hidden) || hasTrend);
|
|
2714
2893
|
if (showLegend) area = layoutLegend(items, spec.legend.position, area, ctx, ctx.isSelected({ kind: "legend" }));
|
|
2715
2894
|
const finish = (result) => {
|
|
2716
2895
|
if (result.plot.width > 0) {
|
|
2717
|
-
if (chartAnnotationFamily(
|
|
2896
|
+
if (chartAnnotationFamily(_chunkWRZ6C4TUcjs.chartFamily.call(void 0, spec))) drawCallouts(ctx, result.plot);
|
|
2718
2897
|
else if (spec.referenceLines.length || spec.referenceBands.length || spec.series.some((s) => s.callouts))
|
|
2719
2898
|
ctx.warn("annotations-skipped", `Reference lines, bands and callouts are drawn on bar, line, area, scatter and bubble charts; this ${spec.type} chart leaves them out.`);
|
|
2720
2899
|
}
|
|
@@ -2777,6 +2956,8 @@ function layoutChart(spec, options) {
|
|
|
2777
2956
|
}
|
|
2778
2957
|
case "barrace":
|
|
2779
2958
|
return finish(layoutBarRace(ctx, area, options.raceFrame));
|
|
2959
|
+
case "streamgraph":
|
|
2960
|
+
return finish(layoutStreamgraph(ctx, area, visible));
|
|
2780
2961
|
case "sankey":
|
|
2781
2962
|
if (!spec.links.length) {
|
|
2782
2963
|
ctx.warn("type-fallback", "A Sankey diagram needs flows (set_chart_links); it is drawn as a bar chart until then.");
|
|
@@ -2893,7 +3074,7 @@ function addReadout(ctx, readout, plot) {
|
|
|
2893
3074
|
} else return;
|
|
2894
3075
|
const axis = series.axis === "secondary" ? spec.yAxis2 : spec.yAxis;
|
|
2895
3076
|
const x = _optionalChain([series, 'access', _77 => _77.x, 'optionalAccess', _78 => _78[readout.index]]);
|
|
2896
|
-
const text = x !== null && x !== void 0 &&
|
|
3077
|
+
const text = x !== null && x !== void 0 && _chunkWRZ6C4TUcjs.chartFamily.call(void 0, spec) === "xy" ? `${formatChartNumber(x, spec.xAxis.format)}, ${formatChartNumber(value, axis.format)}` : `${_nullishCoalesce(spec.categories[readout.index], () => ( ""))}: ${formatChartNumber(value, _nullishCoalesce(series.format, () => ( axis.format)))}`;
|
|
2897
3078
|
const w = measure(text, fs, 600) + 10;
|
|
2898
3079
|
const h = fs + 8;
|
|
2899
3080
|
const bx = Math.max(plot.x, Math.min(plot.x + plot.width - w, ax - w / 2));
|
|
@@ -3009,4 +3190,5 @@ function snapChartValue(scene, value, step, ticks = _nullishCoalesce(_optionalCh
|
|
|
3009
3190
|
|
|
3010
3191
|
|
|
3011
3192
|
|
|
3012
|
-
|
|
3193
|
+
|
|
3194
|
+
exports.parseChartDate = parseChartDate; exports.CHART_DATE_STEPS = CHART_DATE_STEPS; exports.formatChartDate = formatChartDate; exports.chartDateLabels = chartDateLabels; exports.compileChartFormatCode = compileChartFormatCode; exports.formatChartValueWithCode = formatChartValueWithCode; exports.chartSerialToDate = chartSerialToDate; exports.chartDateToSerial = chartDateToSerial; exports.niceStep = niceStep; exports.niceScale = niceScale; exports.stepDecimals = stepDecimals; exports.formatChartNumber = formatChartNumber; exports.linearMap = linearMap; exports.niceLogScale = niceLogScale; exports.chartScaleToPixel = chartScaleToPixel; exports.chartScaleFromPixel = chartScaleFromPixel; exports.estimateChartTextWidth = estimateChartTextWidth; exports.sameChartSelection = sameChartSelection; exports.contrastingTextColor = contrastingTextColor; exports.r2 = r2; exports.chartHistogram = chartHistogram; exports.chartQuantile = chartQuantile; exports.suggestChartReferences = suggestChartReferences; exports.chartBoxStats = chartBoxStats; exports.chartSquarify = chartSquarify; exports.decimateChartPoints = decimateChartPoints; exports.summarizeChartSeries = summarizeChartSeries; exports.fitChartTrendline = fitChartTrendline; exports.trendNumberText = trendNumberText; exports.chartMovingAverage = chartMovingAverage; exports.chartTrendlineName = chartTrendlineName; exports.chartSupportsTrendlines = chartSupportsTrendlines; exports.MAX_CHART_DATA_LABELS = MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = MAX_CHART_MARKERS; exports.layoutStreamgraph = layoutStreamgraph; exports.registerChartMap = registerChartMap; exports.getChartMap = getChartMap; exports.listChartMaps = listChartMaps; exports.matchChartMapRegions = matchChartMapRegions; exports.chartMapBreaks = chartMapBreaks; exports.chartMapClass = chartMapClass; exports.chartMapRamp = chartMapRamp; exports.chartRaceValueAt = chartRaceValueAt; exports.chartRaceMoment = chartRaceMoment; exports.chartRaceRanking = chartRaceRanking; exports.layoutChart = layoutChart; exports.chartValueAtPoint = chartValueAtPoint; exports.chartCategoryAtPoint = chartCategoryAtPoint; exports.chartXAtPoint = chartXAtPoint; exports.snapChartValue = snapChartValue;
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk5DQPDXOMcjs = require('./chunk-5DQPDXOM.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkN76AMOKEcjs = require('./chunk-N76AMOKE.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
@@ -1211,7 +1211,7 @@ var ChartNodeView = (_class = class {
|
|
|
1211
1211
|
this.dom.contentEditable = "false";
|
|
1212
1212
|
this.syncAttributes();
|
|
1213
1213
|
this.key = specKey(this.node.attrs.spec);
|
|
1214
|
-
this.controller = new (0,
|
|
1214
|
+
this.controller = new (0, _chunk5DQPDXOMcjs.ChartController)({ spec: this.node.attrs.spec });
|
|
1215
1215
|
this.unsubscribe = this.controller.subscribe((state) => {
|
|
1216
1216
|
if (!state.gesture) this.writeBack();
|
|
1217
1217
|
});
|
|
@@ -1444,7 +1444,7 @@ function readSpec(value) {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
1447
|
-
return
|
|
1447
|
+
return _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, input).spec;
|
|
1448
1448
|
}
|
|
1449
1449
|
var readSize = (value) => {
|
|
1450
1450
|
const n = value === null ? NaN : Number(value);
|
|
@@ -1470,10 +1470,10 @@ function staticChartSvg(node, options) {
|
|
|
1470
1470
|
const spec = node.attrs.spec;
|
|
1471
1471
|
const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
|
|
1472
1472
|
const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
|
|
1473
|
-
const scene =
|
|
1474
|
-
return
|
|
1473
|
+
const scene = _chunkN76AMOKEcjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
|
|
1474
|
+
return _chunk5DQPDXOMcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1475
1475
|
ariaLabel: spec.title || "Chart",
|
|
1476
|
-
description:
|
|
1476
|
+
description: _chunk5DQPDXOMcjs.describeChart.call(void 0, spec),
|
|
1477
1477
|
attrs: { style: "max-width: 100%; height: auto; display: block" }
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
@@ -1489,7 +1489,7 @@ var Chart = _core.Node.create({
|
|
|
1489
1489
|
return {
|
|
1490
1490
|
HTMLAttributes: {},
|
|
1491
1491
|
nodeView: null,
|
|
1492
|
-
theme:
|
|
1492
|
+
theme: _chunkWRZ6C4TUcjs.DEFAULT_CHART_THEME,
|
|
1493
1493
|
defaultWidth: 640,
|
|
1494
1494
|
defaultHeight: 320,
|
|
1495
1495
|
generateId: () => generateStructureId("chart")
|
|
@@ -1503,7 +1503,7 @@ var Chart = _core.Node.create({
|
|
|
1503
1503
|
renderHTML: (attributes) => attributes.id ? { "data-chart-id": attributes.id } : {}
|
|
1504
1504
|
},
|
|
1505
1505
|
spec: {
|
|
1506
|
-
default:
|
|
1506
|
+
default: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, {}).spec,
|
|
1507
1507
|
// null (no `data-chart`) keeps what the parse rule found, e.g. a mermaid block's spec.
|
|
1508
1508
|
parseHTML: (element) => readSpec(element.getAttribute("data-chart")),
|
|
1509
1509
|
renderHTML: (attributes) => ({
|
|
@@ -1541,7 +1541,7 @@ var Chart = _core.Node.create({
|
|
|
1541
1541
|
const code = element.querySelector("code");
|
|
1542
1542
|
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _34 => _34.getAttribute, 'call', _35 => _35("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1543
1543
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1544
|
-
const result =
|
|
1544
|
+
const result = _chunk5DQPDXOMcjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1545
1545
|
return result.family ? { spec: result.spec } : false;
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
@@ -1565,7 +1565,7 @@ var Chart = _core.Node.create({
|
|
|
1565
1565
|
return {
|
|
1566
1566
|
markdown: {
|
|
1567
1567
|
serialize(state, node) {
|
|
1568
|
-
const text =
|
|
1568
|
+
const text = _chunk5DQPDXOMcjs.chartToMermaid.call(void 0, node.attrs.spec);
|
|
1569
1569
|
const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
|
|
1570
1570
|
state.write(`${fence}mermaid
|
|
1571
1571
|
`);
|
|
@@ -1587,7 +1587,7 @@ var Chart = _core.Node.create({
|
|
|
1587
1587
|
type: this.name,
|
|
1588
1588
|
attrs: {
|
|
1589
1589
|
id: _nullishCoalesce(options.id, () => ( this.options.generateId())),
|
|
1590
|
-
spec:
|
|
1590
|
+
spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {}))).spec,
|
|
1591
1591
|
width: _nullishCoalesce(options.width, () => ( null)),
|
|
1592
1592
|
height: _nullishCoalesce(options.height, () => ( this.options.defaultHeight))
|
|
1593
1593
|
}
|
|
@@ -1598,7 +1598,7 @@ var Chart = _core.Node.create({
|
|
|
1598
1598
|
if (dispatch) {
|
|
1599
1599
|
tr.setNodeMarkup(chart.pos, void 0, {
|
|
1600
1600
|
...chart.node.attrs,
|
|
1601
|
-
...changes.spec !== void 0 ? { spec:
|
|
1601
|
+
...changes.spec !== void 0 ? { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, changes.spec).spec } : {},
|
|
1602
1602
|
...changes.width !== void 0 ? { width: changes.width } : {},
|
|
1603
1603
|
...changes.height !== void 0 ? { height: changes.height } : {}
|
|
1604
1604
|
});
|
|
@@ -1705,14 +1705,14 @@ var Sparkline = _core.Node.create({
|
|
|
1705
1705
|
return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
|
|
1706
1706
|
},
|
|
1707
1707
|
renderHTML({ node, HTMLAttributes }) {
|
|
1708
|
-
const scene =
|
|
1708
|
+
const scene = _chunk5DQPDXOMcjs.layoutSparkline.call(void 0, node.attrs.values, {
|
|
1709
1709
|
kind: node.attrs.kind,
|
|
1710
1710
|
width: node.attrs.width,
|
|
1711
1711
|
height: node.attrs.height,
|
|
1712
1712
|
color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
|
|
1713
1713
|
negativeColor: this.options.negativeColor
|
|
1714
1714
|
});
|
|
1715
|
-
const svg =
|
|
1715
|
+
const svg = _chunk5DQPDXOMcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1716
1716
|
ariaLabel: sparklineLabel(node),
|
|
1717
1717
|
attrs: { style: "display: inline-block; vertical-align: middle" }
|
|
1718
1718
|
});
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
chartToMermaid,
|
|
6
6
|
describeChart,
|
|
7
7
|
layoutSparkline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-23E5GI2U.js";
|
|
9
9
|
import {
|
|
10
10
|
layoutChart
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WKMUBATU.js";
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_CHART_THEME,
|
|
14
14
|
normalizeChartSpec
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6ZZKRH7R.js";
|
|
16
16
|
import {
|
|
17
17
|
plainTextToSlice
|
|
18
18
|
} from "./chunk-2INPJDNY.js";
|