@pixerate/editor 0.155.0 → 0.157.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/animation-editor/index.cjs +58 -58
- package/dist/animation-editor/index.js +4 -4
- package/dist/{brushstrokeRender-YAZVQUXY.cjs → brushstrokeRender-5WANQIG4.cjs} +10 -10
- package/dist/{brushstrokeRender-EUDQTDYS.js → brushstrokeRender-Q4LI22QV.js} +3 -3
- package/dist/canvas/index.cjs +14 -14
- package/dist/canvas/index.js +3 -3
- package/dist/chart/index.cjs +90 -88
- package/dist/chart/index.js +9 -7
- package/dist/chart/spec.d.cts +2 -1
- package/dist/chart/spec.d.ts +2 -1
- package/dist/chart/types.d.cts +5 -0
- package/dist/chart/types.d.ts +5 -0
- package/dist/{chunk-AGZ47XY2.js → chunk-2N2QPO3H.js} +6 -2
- package/dist/{chunk-NMXPOKF3.js → chunk-45XXVHVG.js} +1 -1
- package/dist/{chunk-2WDZI6QD.cjs → chunk-4T44CJ5K.cjs} +15 -15
- package/dist/{chunk-XTU6QO2W.cjs → chunk-4YWAEV4W.cjs} +36 -27
- package/dist/{chunk-4YQKRHMI.cjs → chunk-57JLBGJ5.cjs} +8 -8
- package/dist/{chunk-SVINJIGK.js → chunk-5QBRAIVK.js} +3 -3
- package/dist/{chunk-R3PECGTQ.cjs → chunk-6LUYFHHN.cjs} +51 -51
- package/dist/{chunk-FLOGD3QB.js → chunk-6UPGM3JB.js} +2 -2
- package/dist/{chunk-6FUAHCVI.cjs → chunk-7NW46N7I.cjs} +16 -16
- package/dist/{chunk-ORDXMBD4.js → chunk-A5UCR2TO.js} +10 -3
- package/dist/{chunk-ML2II3Y3.cjs → chunk-AKDWAWSY.cjs} +58 -46
- package/dist/{chunk-PI45JMP7.cjs → chunk-CD7PLU77.cjs} +81 -81
- package/dist/{chunk-EQ4SF4X4.js → chunk-DBIVICAO.js} +1 -1
- package/dist/{chunk-LRRCMRSL.cjs → chunk-EBDCRTZI.cjs} +20 -16
- package/dist/{chunk-OLCYQLFE.js → chunk-EL5PAHNP.js} +1 -1
- package/dist/{chunk-PUC43JPT.cjs → chunk-EYVVIZJ3.cjs} +1 -1
- package/dist/{chunk-SUVZJ2CP.js → chunk-H5XX4KHB.js} +11 -1
- package/dist/{chunk-BXMIBMVG.cjs → chunk-JGKCC5OF.cjs} +65 -58
- package/dist/{chunk-LIXLD433.cjs → chunk-MHEXLG3M.cjs} +35 -35
- package/dist/{chunk-37RLSNQ3.js → chunk-Q6PA362P.js} +2 -2
- package/dist/{chunk-RHXW4TA5.cjs → chunk-QMI5HZWA.cjs} +7 -7
- package/dist/{chunk-DSZCDNTM.js → chunk-R3QY7PPL.js} +11 -2
- package/dist/{chunk-4RF2H3N3.js → chunk-SSCL7QQ4.js} +15 -3
- package/dist/{chunk-TLMRGLQQ.cjs → chunk-TVO6W2Q6.cjs} +20 -17
- package/dist/{chunk-EIUTJPEL.js → chunk-UM3RPYC5.js} +5 -2
- package/dist/{chunk-UILRJQFD.js → chunk-WNAAWLZ5.js} +1 -1
- package/dist/{chunk-I4AHLP7F.cjs → chunk-WPPJH6X4.cjs} +12 -2
- package/dist/{chunk-RZJCYJWO.cjs → chunk-XNQ5EFB4.cjs} +16 -16
- package/dist/{chunk-R6HNWN7B.js → chunk-YABNLNY7.js} +3 -3
- package/dist/{chunk-Y64YPIFT.js → chunk-ZQWLWDZI.js} +1 -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/image-editor/index.cjs +686 -686
- package/dist/image-editor/index.js +5 -5
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/dist/paint/grain.d.cts +7 -0
- package/dist/paint/grain.d.ts +7 -0
- package/dist/paint/index.cjs +3 -3
- package/dist/paint/index.js +2 -2
- package/dist/paint-editor/controller.d.cts +30 -0
- package/dist/paint-editor/controller.d.ts +30 -0
- package/dist/paint-editor/document.d.cts +8 -0
- package/dist/paint-editor/document.d.ts +8 -0
- package/dist/paint-editor/index.cjs +403 -256
- package/dist/paint-editor/index.js +158 -11
- package/dist/paint-editor/paper.d.cts +8 -0
- package/dist/paint-editor/paper.d.ts +8 -0
- package/dist/paint-editor/stencils.d.cts +2 -0
- package/dist/paint-editor/stencils.d.ts +2 -0
- package/dist/paint-editor/wet.d.cts +1 -0
- package/dist/paint-editor/wet.d.ts +1 -0
- package/dist/vector/index.cjs +950 -950
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-chart/SKILL.md +4 -1
- package/skills/pixerate-paint-editor/SKILL.md +9 -1
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkQMI5HZWAcjs = require('./chunk-QMI5HZWA.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -37,7 +37,7 @@ var lerpP = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
|
37
37
|
var toP = (v) => [v.x, v.y];
|
|
38
38
|
var mapP = (m, p) => [m[0] * p[0] + m[2] * p[1] + m[4], m[1] * p[0] + m[3] * p[1] + m[5]];
|
|
39
39
|
var curvesOf = (c) => Math.max(0, (c.pts.length - 1) / 3) | 0;
|
|
40
|
-
function subpathToMorphContour(sp, m =
|
|
40
|
+
function subpathToMorphContour(sp, m = _chunkQMI5HZWAcjs.IDENTITY_MATRIX) {
|
|
41
41
|
const n = sp.anchors.length;
|
|
42
42
|
if (!n) return null;
|
|
43
43
|
const first = mapP(m, toP(sp.anchors[0]));
|
|
@@ -67,8 +67,8 @@ function isStraight(p0, p1, p2, p3) {
|
|
|
67
67
|
const u2 = along(p2);
|
|
68
68
|
return off(p1) < tol && off(p2) < tol && u1 >= -1e-9 && u1 <= 1 + 1e-9 && u2 >= -1e-9 && u2 <= 1 + 1e-9;
|
|
69
69
|
}
|
|
70
|
-
function morphContourToSubpath(c, m =
|
|
71
|
-
const pts =
|
|
70
|
+
function morphContourToSubpath(c, m = _chunkQMI5HZWAcjs.IDENTITY_MATRIX, closed = c.closed) {
|
|
71
|
+
const pts = _chunkQMI5HZWAcjs.isIdentityMatrix.call(void 0, m) ? c.pts : c.pts.map((p) => mapP(m, p));
|
|
72
72
|
const curves = curvesOf(c);
|
|
73
73
|
const dropLast = closed && c.closed && curves > 0;
|
|
74
74
|
const count = dropLast ? curves : curves + 1;
|
|
@@ -84,7 +84,7 @@ function morphContourToSubpath(c, m = _chunkRHXW4TA5cjs.IDENTITY_MATRIX, closed
|
|
|
84
84
|
anchors[(k + 1) % count].in = { x: p2[0], y: p2[1] };
|
|
85
85
|
}
|
|
86
86
|
for (const a of anchors) {
|
|
87
|
-
const type =
|
|
87
|
+
const type = _chunkQMI5HZWAcjs.inferAnchorType.call(void 0, a);
|
|
88
88
|
if (type !== "corner") a.type = type;
|
|
89
89
|
}
|
|
90
90
|
const isClosed = closed && curves > 0;
|
|
@@ -267,7 +267,7 @@ function bestStart(fixed, free, useShapeContext) {
|
|
|
267
267
|
return best;
|
|
268
268
|
}
|
|
269
269
|
function placeIn(c, from, to) {
|
|
270
|
-
const b =
|
|
270
|
+
const b = _chunkQMI5HZWAcjs.unionBounds.call(void 0, [boundsOfPoints(c.pts)]);
|
|
271
271
|
const p = b ? [b.x + b.width / 2, b.y + b.height / 2] : c.pts[0];
|
|
272
272
|
if (!from || !to) return p;
|
|
273
273
|
const fx = from.width > 0 ? (p[0] - from.x) / from.width : 0.5;
|
|
@@ -456,7 +456,7 @@ function interpolateVectorColor(a, b, t) {
|
|
|
456
456
|
}
|
|
457
457
|
function resampleGradientStops(g, offsets) {
|
|
458
458
|
return offsets.map((offset) => {
|
|
459
|
-
const s =
|
|
459
|
+
const s = _chunkQMI5HZWAcjs.sampleVectorGradient.call(void 0, g, offset);
|
|
460
460
|
return s.opacity < 1 ? { offset, color: s.color, opacity: Math.round(s.opacity * 1e4) / 1e4 } : { offset, color: s.color };
|
|
461
461
|
});
|
|
462
462
|
}
|
|
@@ -467,11 +467,11 @@ function lerpAngle(a, b, t) {
|
|
|
467
467
|
var lerpPoint = (a, b, t) => ({ x: lerpN(a.x, b.x, t), y: lerpN(a.y, b.y, t) });
|
|
468
468
|
var sameColourModel = (a, b) => (_nullishCoalesce(a.interpolation, () => ( "srgb"))) === (_nullishCoalesce(b.interpolation, () => ( "srgb"))) && (_nullishCoalesce(a.smoothness, () => ( 0))) === (_nullishCoalesce(b.smoothness, () => ( 0)));
|
|
469
469
|
function lerpStops(a, b, t) {
|
|
470
|
-
let stopsA =
|
|
471
|
-
let stopsB =
|
|
470
|
+
let stopsA = _chunkQMI5HZWAcjs.sortedVectorGradientStops.call(void 0, a);
|
|
471
|
+
let stopsB = _chunkQMI5HZWAcjs.sortedVectorGradientStops.call(void 0, b);
|
|
472
472
|
const resampled = stopsA.length !== stopsB.length || !sameColourModel(a, b);
|
|
473
473
|
if (resampled) {
|
|
474
|
-
const offs = [...
|
|
474
|
+
const offs = [..._chunkQMI5HZWAcjs.expandVectorGradientStops.call(void 0, a), ..._chunkQMI5HZWAcjs.expandVectorGradientStops.call(void 0, b), ...stopsA, ...stopsB].map((s) => s.offset).filter(Number.isFinite).sort((x, y) => x - y);
|
|
475
475
|
const common = offs.filter((o, i) => i === 0 || o - offs[i - 1] > 1e-4);
|
|
476
476
|
stopsA = resampleGradientStops(a, common);
|
|
477
477
|
stopsB = resampleGradientStops(b, common);
|
|
@@ -498,8 +498,8 @@ function lerpGradient(a, b, t) {
|
|
|
498
498
|
}
|
|
499
499
|
if (near.spread && near.spread !== "pad") out.spread = near.spread;
|
|
500
500
|
if (near.strokeMode && near.strokeMode !== "within") out.strokeMode = near.strokeMode;
|
|
501
|
-
const ea =
|
|
502
|
-
const eb =
|
|
501
|
+
const ea = _chunkQMI5HZWAcjs.hasExplicitGradientGeometry.call(void 0, a);
|
|
502
|
+
const eb = _chunkQMI5HZWAcjs.hasExplicitGradientGeometry.call(void 0, b);
|
|
503
503
|
if (!ea && !eb) {
|
|
504
504
|
if (a.angle !== void 0 || b.angle !== void 0 || a.type === "linear" || a.type === "reflected") {
|
|
505
505
|
const fallback = a.type === "linear" || a.type === "reflected" ? 180 : 90;
|
|
@@ -512,10 +512,10 @@ function lerpGradient(a, b, t) {
|
|
|
512
512
|
}
|
|
513
513
|
return out;
|
|
514
514
|
}
|
|
515
|
-
const pa =
|
|
516
|
-
const pb =
|
|
515
|
+
const pa = _chunkQMI5HZWAcjs.vectorGradientPoints.call(void 0, a);
|
|
516
|
+
const pb = _chunkQMI5HZWAcjs.vectorGradientPoints.call(void 0, b);
|
|
517
517
|
if (pa.units !== pb.units) {
|
|
518
|
-
const src =
|
|
518
|
+
const src = _chunkQMI5HZWAcjs.explicitVectorGradient.call(void 0, near);
|
|
519
519
|
return { ...src, stops: out.stops, ...out.interpolation ? { interpolation: out.interpolation } : {}, ...out.smoothness ? { smoothness: out.smoothness } : {} };
|
|
520
520
|
}
|
|
521
521
|
out.start = lerpPoint(pa.start, pb.start, t);
|
|
@@ -535,14 +535,14 @@ function solidLike(color, like) {
|
|
|
535
535
|
function interpolateVectorPaint(a, b, t) {
|
|
536
536
|
if (t <= 0) return a;
|
|
537
537
|
if (t >= 1) return b;
|
|
538
|
-
const pa =
|
|
539
|
-
const pb =
|
|
538
|
+
const pa = _chunkQMI5HZWAcjs.hasPaint.call(void 0, a);
|
|
539
|
+
const pb = _chunkQMI5HZWAcjs.hasPaint.call(void 0, b);
|
|
540
540
|
if (!pa && !pb) return t < 0.5 ? a : b;
|
|
541
541
|
if (typeof a === "string" && pa && typeof b === "string" && pb) return interpolateVectorColor(a, b, t);
|
|
542
542
|
if (!pa && typeof b === "string") return interpolateVectorColor("transparent", b, t);
|
|
543
543
|
if (!pb && typeof a === "string") return interpolateVectorColor(a, "transparent", t);
|
|
544
|
-
const ga = pa &&
|
|
545
|
-
const gb = pb &&
|
|
544
|
+
const ga = pa && _chunkQMI5HZWAcjs.isVectorGradient.call(void 0, a) ? a : null;
|
|
545
|
+
const gb = pb && _chunkQMI5HZWAcjs.isVectorGradient.call(void 0, b) ? b : null;
|
|
546
546
|
if (ga && gb) return _nullishCoalesce(lerpGradient(ga, gb, t), () => ( (t < 0.5 ? a : b)));
|
|
547
547
|
if (gb) return _nullishCoalesce(lerpGradient(solidLike(pa ? a : null, gb), gb, t), () => ( b));
|
|
548
548
|
if (ga) return _nullishCoalesce(lerpGradient(ga, solidLike(pb ? b : null, ga), t), () => ( a));
|
|
@@ -553,8 +553,8 @@ function interpolateWidthProfiles(a, b, t) {
|
|
|
553
553
|
const at = [..._nullishCoalesce(a, () => ( [])), ..._nullishCoalesce(b, () => ( [])), { t: 0 }, { t: 1 }].map((p) => p.t).sort((x, y) => x - y);
|
|
554
554
|
const ts = at.filter((v, i) => i === 0 || v - at[i - 1] > 1e-6);
|
|
555
555
|
return ts.map((pos) => {
|
|
556
|
-
const x =
|
|
557
|
-
const y =
|
|
556
|
+
const x = _chunkQMI5HZWAcjs.widthProfileAt.call(void 0, a, pos);
|
|
557
|
+
const y = _chunkQMI5HZWAcjs.widthProfileAt.call(void 0, b, pos);
|
|
558
558
|
return { t: pos, left: lerpN(x.left, y.left, t), right: lerpN(x.right, y.right, t) };
|
|
559
559
|
});
|
|
560
560
|
}
|
|
@@ -597,7 +597,7 @@ function reversedStyle(s) {
|
|
|
597
597
|
out.endArrow = s.startArrow;
|
|
598
598
|
out.startArrowScale = s.endArrowScale;
|
|
599
599
|
out.endArrowScale = s.startArrowScale;
|
|
600
|
-
if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile =
|
|
600
|
+
if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile = _chunkQMI5HZWAcjs.reverseWidthProfile.call(void 0, s.strokeWidthProfile);
|
|
601
601
|
for (const k of ["startArrow", "endArrow", "startArrowScale", "endArrowScale"]) if (out[k] === void 0) delete out[k];
|
|
602
602
|
return out;
|
|
603
603
|
}
|
|
@@ -623,19 +623,19 @@ function styleOf(n) {
|
|
|
623
623
|
return out;
|
|
624
624
|
}
|
|
625
625
|
function contoursOf(node, m) {
|
|
626
|
-
return
|
|
626
|
+
return _chunkQMI5HZWAcjs.expandVectorCorners.call(void 0, node.subpaths).map((sp) => subpathToMorphContour(sp, m)).filter((c) => !!c);
|
|
627
627
|
}
|
|
628
|
-
function preparePathMorph(a, b, options, ma =
|
|
628
|
+
function preparePathMorph(a, b, options, ma = _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, a), mb = _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, b)) {
|
|
629
629
|
const corr = correspondMorphContours(contoursOf(a, ma), contoursOf(b, mb), options);
|
|
630
630
|
const sim = procrustes(corr.a, corr.b);
|
|
631
631
|
const styleA = styleOf(a);
|
|
632
632
|
const styleB = corr.reversed ? reversedStyle(styleOf(b)) : styleOf(b);
|
|
633
|
-
const rigid = !
|
|
633
|
+
const rigid = !_chunkQMI5HZWAcjs.isIdentityMatrix.call(void 0, ma) || !_chunkQMI5HZWAcjs.isIdentityMatrix.call(void 0, mb);
|
|
634
634
|
const id = _nullishCoalesce(options.id, () => ( a.id));
|
|
635
635
|
return (t) => {
|
|
636
636
|
const contours = interpolateMorphContours(corr.a, corr.b, t, { linear: options.linear, rigidity: options.rigidity, similarity: sim });
|
|
637
|
-
const m = rigid ? interpolateRigidMatrix(ma, mb, t) :
|
|
638
|
-
const back = rigid ?
|
|
637
|
+
const m = rigid ? interpolateRigidMatrix(ma, mb, t) : _chunkQMI5HZWAcjs.IDENTITY_MATRIX;
|
|
638
|
+
const back = rigid ? _chunkQMI5HZWAcjs.invertMatrix.call(void 0, m) : _chunkQMI5HZWAcjs.IDENTITY_MATRIX;
|
|
639
639
|
const subpaths = contours.map((c, k) => {
|
|
640
640
|
const closed = t <= 0 ? corr.a[k].closed : t >= 1 ? corr.b[k].closed : corr.a[k].closed && corr.b[k].closed;
|
|
641
641
|
return morphContourToSubpath({ closed: corr.a[k].closed && corr.b[k].closed, pts: c.pts }, back, closed);
|
|
@@ -643,14 +643,14 @@ function preparePathMorph(a, b, options, ma = _chunkRHXW4TA5cjs.nodeMatrix.call(
|
|
|
643
643
|
const node = { id, type: "path", subpaths, ...interpolateVectorStyle(styleA, styleB, t) };
|
|
644
644
|
const opacity = lerpN(_nullishCoalesce(a.opacity, () => ( 1)), _nullishCoalesce(b.opacity, () => ( 1)), t);
|
|
645
645
|
if (opacity < 1) node.opacity = opacity;
|
|
646
|
-
if (rigid && !
|
|
646
|
+
if (rigid && !_chunkQMI5HZWAcjs.isIdentityMatrix.call(void 0, m)) node.transform = m;
|
|
647
647
|
return node;
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function flattenPaths(node, parent =
|
|
651
|
-
const m =
|
|
650
|
+
function flattenPaths(node, parent = _chunkQMI5HZWAcjs.IDENTITY_MATRIX) {
|
|
651
|
+
const m = _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, node), parent);
|
|
652
652
|
if (node.type === "path") return [{ path: node, m, opacity: 1 }];
|
|
653
|
-
if (node.type === "text" || node.type === "instance") return flattenPaths(
|
|
653
|
+
if (node.type === "text" || node.type === "instance") return flattenPaths(_chunkQMI5HZWAcjs.expandVectorAppearance.call(void 0, node), parent);
|
|
654
654
|
const o = _nullishCoalesce(node.opacity, () => ( 1));
|
|
655
655
|
return node.children.filter((c) => c.visible !== false).flatMap((c) => flattenPaths(c, m)).map((e) => ({ ...e, opacity: e.opacity * o }));
|
|
656
656
|
}
|
|
@@ -672,8 +672,8 @@ function createVectorMorph(a, b, options = {}) {
|
|
|
672
672
|
}
|
|
673
673
|
const pa = flattenPaths(a);
|
|
674
674
|
const pb = flattenPaths(b);
|
|
675
|
-
const ba =
|
|
676
|
-
const bb =
|
|
675
|
+
const ba = _chunkQMI5HZWAcjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
|
|
676
|
+
const bb = _chunkQMI5HZWAcjs.unionBounds.call(void 0, pb.map((e) => placedBounds(e.path, e.m)));
|
|
677
677
|
const id = _nullishCoalesce(options.id, () => ( a.id));
|
|
678
678
|
const parts = [];
|
|
679
679
|
const opacities = [];
|
|
@@ -685,10 +685,10 @@ function createVectorMorph(a, b, options = {}) {
|
|
|
685
685
|
parts.push(preparePathMorph(x.path, y.path, sub, x.m, y.m));
|
|
686
686
|
opacities.push([x.opacity, y.opacity]);
|
|
687
687
|
} else if (x) {
|
|
688
|
-
parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m,
|
|
688
|
+
parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m, _chunkQMI5HZWAcjs.IDENTITY_MATRIX));
|
|
689
689
|
opacities.push([x.opacity, x.opacity]);
|
|
690
690
|
} else if (y) {
|
|
691
|
-
parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub,
|
|
691
|
+
parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub, _chunkQMI5HZWAcjs.IDENTITY_MATRIX, y.m));
|
|
692
692
|
opacities.push([y.opacity, y.opacity]);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
CHART_OOXML_NS,
|
|
12
12
|
CHART_OOXML_RELATIONSHIP,
|
|
13
13
|
chartToOoxml
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DBIVICAO.js";
|
|
15
15
|
import {
|
|
16
16
|
normalizeChartSpec
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-H5XX4KHB.js";
|
|
18
18
|
|
|
19
19
|
// src/export/images.ts
|
|
20
20
|
var DOCX_IMAGE_TYPES = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJGKCC5OFcjs = require('./chunk-JGKCC5OF.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkCVFAAZXEcjs = require('./chunk-CVFAAZXE.cjs');
|
|
@@ -47,7 +47,7 @@ var _chunkNM3G4VQTcjs = require('./chunk-NM3G4VQT.cjs');
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkEBDCRTZIcjs = require('./chunk-EBDCRTZI.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
@@ -2527,7 +2527,7 @@ function vectorExtrudeFaces(path, params) {
|
|
|
2527
2527
|
// src/vector/brushstroke.ts
|
|
2528
2528
|
var VECTOR_BRUSHSTROKE_SCALE = 2;
|
|
2529
2529
|
function vectorBrushstrokeBrushes() {
|
|
2530
|
-
return
|
|
2530
|
+
return _chunkJGKCC5OFcjs.BUILTIN_BRUSHES.filter((b) => _chunkEBDCRTZIcjs.isBrushstrokeBrush.call(void 0, b));
|
|
2531
2531
|
}
|
|
2532
2532
|
function vectorBrushstrokeBrush(id) {
|
|
2533
2533
|
return _nullishCoalesce(vectorBrushstrokeBrushes().find((b) => b.id === id), () => ( null));
|
|
@@ -2558,7 +2558,7 @@ function sanitizeVectorBrushstrokePaper(value) {
|
|
|
2558
2558
|
if (!value || typeof value !== "object") return null;
|
|
2559
2559
|
const r = value;
|
|
2560
2560
|
const out = {};
|
|
2561
|
-
if (typeof r.pattern === "string" &&
|
|
2561
|
+
if (typeof r.pattern === "string" && _chunkEBDCRTZIcjs.GRAIN_PATTERNS.includes(r.pattern)) out.pattern = r.pattern;
|
|
2562
2562
|
const seed = sanitizeSeed(r.seed);
|
|
2563
2563
|
if (seed !== void 0) out.seed = seed;
|
|
2564
2564
|
if (finite2(r.scale) && r.scale > 0) out.scale = Math.min(8, Math.max(0.25, r.scale));
|
|
@@ -2573,7 +2573,7 @@ function vectorBrushstrokeCharacterError(brush) {
|
|
|
2573
2573
|
const r = paper;
|
|
2574
2574
|
const extra = Object.keys(r).filter((k) => !["pattern", "seed", "scale", "depth"].includes(k));
|
|
2575
2575
|
if (extra.length) return `paper has unknown field ${extra.map((k) => `"${k}"`).join(", ")}: use pattern, seed, scale, depth.`;
|
|
2576
|
-
if (r.pattern !== void 0 && !
|
|
2576
|
+
if (r.pattern !== void 0 && !_chunkEBDCRTZIcjs.GRAIN_PATTERNS.includes(r.pattern)) return `Unknown paper pattern "${String(r.pattern)}": use one of ${_chunkEBDCRTZIcjs.GRAIN_PATTERNS.join(", ")}.`;
|
|
2577
2577
|
if (r.seed !== void 0 && !(Number.isInteger(r.seed) && r.seed >= 0 && r.seed <= VECTOR_BRUSHSTROKE_MAX_SEED)) return `paper.seed must be an integer from 0 to ${VECTOR_BRUSHSTROKE_MAX_SEED}.`;
|
|
2578
2578
|
if (r.scale !== void 0 && !(finite2(r.scale) && r.scale >= 0.25 && r.scale <= 8)) return "paper.scale must be from 0.25 to 8 (1 is the pattern's natural size).";
|
|
2579
2579
|
if (r.depth !== void 0 && !(finite2(r.depth) && r.depth >= 0 && r.depth <= 1)) return "paper.depth must be from 0 to 1.";
|
|
@@ -2589,7 +2589,7 @@ function vectorBrushstrokeReach(layer) {
|
|
|
2589
2589
|
if (!isVectorBrushstrokeLayer(layer)) return 0;
|
|
2590
2590
|
return (_nullishCoalesce(layer.brush.size, () => ( vectorBrushstrokeBrush(layer.brush.brushId).tip.size))) / 2;
|
|
2591
2591
|
}
|
|
2592
|
-
var cache = new (0,
|
|
2592
|
+
var cache = new (0, _chunkEBDCRTZIcjs.BrushstrokeCache)(256);
|
|
2593
2593
|
var urls = /* @__PURE__ */ new WeakMap();
|
|
2594
2594
|
var layerCache = /* @__PURE__ */ new WeakMap();
|
|
2595
2595
|
function vectorBrushstrokeImages(node, layer) {
|
|
@@ -2614,7 +2614,7 @@ function vectorBrushstrokeImages(node, layer) {
|
|
|
2614
2614
|
const stroke = cache.render({ points: ring.map(([x, y]) => ({ x, y })), ...layer.brush.pressure ? { pressure: layer.brush.pressure } : {} }, brush, { scale: VECTOR_BRUSHSTROKE_SCALE, color: color2, maxPixels: 2048 * 2048, ...character });
|
|
2615
2615
|
if (!stroke.bounds) continue;
|
|
2616
2616
|
let href = urls.get(stroke);
|
|
2617
|
-
if (!href) urls.set(stroke, href =
|
|
2617
|
+
if (!href) urls.set(stroke, href = _chunkEBDCRTZIcjs.brushstrokeDataUrl.call(void 0, stroke));
|
|
2618
2618
|
out.push({ href, ...stroke.bounds });
|
|
2619
2619
|
}
|
|
2620
2620
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
chartSeriesColor,
|
|
8
8
|
chartSeriesType,
|
|
9
9
|
chartSliceColor
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-H5XX4KHB.js";
|
|
11
11
|
import {
|
|
12
12
|
NumberFormat
|
|
13
13
|
} from "./chunk-II2WIF5Z.js";
|
|
@@ -1580,7 +1580,12 @@ function layoutRadar(ctx, area, visible) {
|
|
|
1580
1580
|
let hi = -Infinity;
|
|
1581
1581
|
for (const s of visible) for (const v of s.values) if (v !== null && Number.isFinite(v)) lo = Math.min(lo, v), hi = Math.max(hi, v);
|
|
1582
1582
|
if (!Number.isFinite(hi)) hi = 1;
|
|
1583
|
-
|
|
1583
|
+
let scale = axisScale(lo, hi, radius, spec.yAxis, ctx.options.valueDomain);
|
|
1584
|
+
if (spec.radarTicks !== null && spec.yAxis.scale !== "log") {
|
|
1585
|
+
const n2 = spec.radarTicks;
|
|
1586
|
+
const step = (scale.max - scale.min) / n2;
|
|
1587
|
+
scale = { ...scale, step, ticks: Array.from({ length: n2 + 1 }, (_, k) => Number((scale.min + step * k).toPrecision(12))) };
|
|
1588
|
+
}
|
|
1584
1589
|
const rOf = (v) => linearMap(Math.min(scale.max, Math.max(scale.min, v)), [scale.min, scale.max], [0, radius]);
|
|
1585
1590
|
const angle = (i) => i / n * Math.PI * 2;
|
|
1586
1591
|
const at = (i, r) => [cx + r * Math.sin(angle(i)), cy - r * Math.cos(angle(i))];
|
|
@@ -1589,6 +1594,10 @@ function layoutRadar(ctx, area, visible) {
|
|
|
1589
1594
|
scale.ticks.forEach((t, k) => {
|
|
1590
1595
|
const r = rOf(t);
|
|
1591
1596
|
if (r <= 0) return;
|
|
1597
|
+
if (spec.radarGraticule === "circle") {
|
|
1598
|
+
marks.push({ kind: "circle", key: `grid-ring-${k}`, role: "grid", cx, cy, r, fill: "none", stroke: theme.grid, strokeWidth: 1 });
|
|
1599
|
+
return;
|
|
1600
|
+
}
|
|
1592
1601
|
const d = Array.from({ length: n }, (_, i) => at(i, r)).map(([x, y], i) => `${i ? "L" : "M"}${r2(x)},${r2(y)}`).join("") + "Z";
|
|
1593
1602
|
marks.push({ kind: "path", key: `grid-ring-${k}`, role: "grid", d, fill: "none", stroke: theme.grid, strokeWidth: 1 });
|
|
1594
1603
|
});
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
r2,
|
|
8
8
|
sameChartSelection,
|
|
9
9
|
summarizeChartSeries
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-R3QY7PPL.js";
|
|
11
11
|
import {
|
|
12
12
|
CHART_TYPE_LABELS,
|
|
13
13
|
DEFAULT_CHART_PALETTE,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
parseChartValue,
|
|
28
28
|
shadeChartColor,
|
|
29
29
|
uniqueChartSeriesId
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-H5XX4KHB.js";
|
|
31
31
|
import {
|
|
32
32
|
parseCsv,
|
|
33
33
|
parseTsv
|
|
@@ -126,6 +126,8 @@ function chartToMermaid(spec, options = {}) {
|
|
|
126
126
|
}
|
|
127
127
|
if (spec.yAxis.max !== null) lines.push(`${ind}max ${num(spec.yAxis.max)}`);
|
|
128
128
|
if (spec.yAxis.min !== null) lines.push(`${ind}min ${num(spec.yAxis.min)}`);
|
|
129
|
+
if (spec.radarTicks !== null) lines.push(`${ind}ticks ${spec.radarTicks}`);
|
|
130
|
+
if (spec.radarGraticule === "polygon") lines.push(`${ind}graticule polygon`);
|
|
129
131
|
if (!spec.legend.show) lines.push(`${ind}showLegend false`);
|
|
130
132
|
} else {
|
|
131
133
|
lines.push(`xychart-beta${spec.orientation === "horizontal" ? " horizontal" : ""}`);
|
|
@@ -230,6 +232,8 @@ function chartFromMermaid(text, options = {}) {
|
|
|
230
232
|
const radarAxes = [];
|
|
231
233
|
const pieSlices = [];
|
|
232
234
|
let legendShow = true;
|
|
235
|
+
let radarTicks = null;
|
|
236
|
+
let graticule = "circle";
|
|
233
237
|
const counts = { bar: 0, line: 0 };
|
|
234
238
|
const lineIssue = (i, message) => issues.push({ path: `line ${i + 1}`, line: i + 1, message: `Line ${i + 1}: ${message}` });
|
|
235
239
|
for (let i = headerLine + 1; family && i < all.length; i++) {
|
|
@@ -337,6 +341,12 @@ function chartFromMermaid(text, options = {}) {
|
|
|
337
341
|
if (m[1] === "max") yAxis.max = Number(m[2]);
|
|
338
342
|
else if (m[1] === "min") yAxis.min = Number(m[2]);
|
|
339
343
|
else if (m[1] === "showLegend") legendShow = m[2] !== "false";
|
|
344
|
+
else if (m[1] === "ticks") {
|
|
345
|
+
const n = Number(m[2]);
|
|
346
|
+
if (Number.isFinite(n) && n >= 1) radarTicks = Math.min(50, Math.round(n));
|
|
347
|
+
else lineIssue(i, `expected ticks to be a number of rings (1 or more), got "${m[2]}".`);
|
|
348
|
+
} else if (m[2] === "circle" || m[2] === "polygon") graticule = m[2];
|
|
349
|
+
else lineIssue(i, `expected graticule circle or polygon, got "${m[2]}".`);
|
|
340
350
|
continue;
|
|
341
351
|
}
|
|
342
352
|
}
|
|
@@ -352,7 +362,7 @@ function chartFromMermaid(text, options = {}) {
|
|
|
352
362
|
series: [{ id: "series-1", name: title || "Values", values: pieSlices.map((s) => s.value) }]
|
|
353
363
|
};
|
|
354
364
|
} else if (family === "radar") {
|
|
355
|
-
input = { type: "radar", title, categories: radarAxes.map((a) => a.label), series, yAxis, legend: { show: legendShow, position: "bottom" } };
|
|
365
|
+
input = { type: "radar", title, categories: radarAxes.map((a) => a.label), series, yAxis, legend: { show: legendShow, position: "bottom" }, radarTicks, radarGraticule: graticule };
|
|
356
366
|
} else {
|
|
357
367
|
const allBar = series.length > 0 && series.every((s) => s.type === "bar");
|
|
358
368
|
const allLine = series.length > 0 && series.every((s) => s.type === "line");
|
|
@@ -1333,6 +1343,8 @@ function updateLabel(patch) {
|
|
|
1333
1343
|
overlap: "Change bar overlap",
|
|
1334
1344
|
bins: "Change histogram bins",
|
|
1335
1345
|
showTotal: "Toggle waterfall total",
|
|
1346
|
+
radarTicks: "Change radar rings",
|
|
1347
|
+
radarGraticule: "Change radar grid",
|
|
1336
1348
|
legend: "Change legend",
|
|
1337
1349
|
stacking: "Change stacking",
|
|
1338
1350
|
orientation: "Change orientation",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
var _chunkWPPJH6X4cjs = require('./chunk-WPPJH6X4.cjs');
|
|
17
18
|
|
|
18
19
|
// src/chart/schemas.ts
|
|
19
20
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -25,7 +26,7 @@ var FORMAT = {
|
|
|
25
26
|
type: "object",
|
|
26
27
|
description: "How numbers are written on this axis or series.",
|
|
27
28
|
properties: {
|
|
28
|
-
style: { type: "string", enum: [...
|
|
29
|
+
style: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_NUMBER_STYLES], description: "number (default), percent (0.25 \u2192 25%), currency or compact (1.2K)." },
|
|
29
30
|
decimals: { type: "integer", minimum: 0, maximum: 10, description: "Fixed decimals (default: what the ticks need)." },
|
|
30
31
|
currency: { type: "string", description: 'ISO currency code for style "currency", e.g. "EUR" (default USD).' },
|
|
31
32
|
prefix: { type: "string", description: "Text before every number." },
|
|
@@ -45,10 +46,10 @@ var AXIS = (what) => ({
|
|
|
45
46
|
step: { type: ["number", "null"], exclusiveMinimum: 0, description: "Fixed distance between ticks, or null for automatic." },
|
|
46
47
|
gridlines: { type: "boolean", description: "Grid lines at each tick." },
|
|
47
48
|
format: FORMAT,
|
|
48
|
-
kind: { type: ["string", "null"], enum: [...
|
|
49
|
+
kind: { type: ["string", "null"], enum: [..._chunkWPPJH6X4cjs.CHART_AXIS_KINDS, null], description: 'Category axis only: "date" reads categories as dates and labels them by calendar steps.' },
|
|
49
50
|
scale: {
|
|
50
51
|
type: ["string", "null"],
|
|
51
|
-
enum: [...
|
|
52
|
+
enum: [..._chunkWPPJH6X4cjs.CHART_AXIS_SCALES, null],
|
|
52
53
|
description: 'Value axes and the numeric x axis of scatter / bubble charts: "log" spaces ticks by powers of logBase (values of 0 or less are skipped; min and max must be above 0; not with percent stacking). "linear" or null is the default. Ignored on a category axis.'
|
|
53
54
|
},
|
|
54
55
|
logBase: { type: ["number", "null"], minimum: 2, maximum: 1e3, description: "Base of a log axis, 2 to 1000 (default 10; null resets)." },
|
|
@@ -57,7 +58,7 @@ var AXIS = (what) => ({
|
|
|
57
58
|
additionalProperties: false
|
|
58
59
|
});
|
|
59
60
|
var TRENDLINE_PROPS = {
|
|
60
|
-
type: { type: "string", enum: [...
|
|
61
|
+
type: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_TRENDLINE_TYPES], description: "Fit: linear, exponential, logarithmic, power, polynomial or moving-average." },
|
|
61
62
|
order: { type: "integer", minimum: 2, maximum: 6, description: "Polynomial order (default 2)." },
|
|
62
63
|
period: { type: "integer", minimum: 2, description: "Moving-average period in points (default 2)." },
|
|
63
64
|
forward: { type: "number", minimum: 0, description: "Extend the line this many x units past the last point (default 0)." },
|
|
@@ -74,13 +75,13 @@ var ERROR_BARS = (what) => ({
|
|
|
74
75
|
properties: {
|
|
75
76
|
type: {
|
|
76
77
|
type: "string",
|
|
77
|
-
enum: [...
|
|
78
|
+
enum: [..._chunkWPPJH6X4cjs.CHART_ERROR_BAR_TYPES],
|
|
78
79
|
description: "fixed: the same amount at every point; percent: a percentage of each value; stddev: value standard deviations of the series, drawn around the series mean (as Excel does); stderr: the standard error of the series at every point; custom: per-point plus / minus amounts."
|
|
79
80
|
},
|
|
80
81
|
value: { type: "number", minimum: 0, description: "Amount in data units for fixed (default 1), percent of each value for percent (default 5), number of standard deviations for stddev (default 1). Not for stderr or custom." },
|
|
81
82
|
plus: { type: "array", items: VALUE, description: "custom only: amount above each point, one per category, in data units (0 or more; null for none)." },
|
|
82
83
|
minus: { type: "array", items: VALUE, description: "custom only: amount below each point, one per category (default: the plus amounts)." },
|
|
83
|
-
direction: { type: "string", enum: [...
|
|
84
|
+
direction: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_ERROR_BAR_DIRECTIONS], description: "both (default), plus (only above) or minus (only below)." },
|
|
84
85
|
cap: { type: "boolean", description: "Draw end caps (default true)." }
|
|
85
86
|
},
|
|
86
87
|
required: ["type"],
|
|
@@ -90,21 +91,21 @@ var SERIES_PROPS = {
|
|
|
90
91
|
name: { type: "string", description: "Series name (legend and data grid header)." },
|
|
91
92
|
values: { type: "array", items: VALUE, description: "One value per category, in category order (padded with gaps)." },
|
|
92
93
|
color: { type: ["string", "null"], description: "CSS colour, or null for the palette colour." },
|
|
93
|
-
type: { type: ["string", "null"], enum: [...
|
|
94
|
+
type: { type: ["string", "null"], enum: [..._chunkWPPJH6X4cjs.CHART_SERIES_TYPES, null], description: "Draw this series as bar, line, area or scatter (a combo chart); null follows the chart type." },
|
|
94
95
|
hidden: { type: "boolean", description: "Hide the series (its data is kept)." },
|
|
95
96
|
axis: { type: ["string", "null"], enum: ["primary", "secondary", null], description: "Value axis: secondary is drawn on the right with its own scale." },
|
|
96
97
|
x: { type: ["array", "null"], items: VALUE, description: "Numeric x per category, for scatter and bubble charts." },
|
|
97
98
|
sizes: { type: ["array", "null"], items: VALUE, description: "Bubble sizes per category (area is proportional to size)." },
|
|
98
99
|
pointColors: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "Colour per category (null keeps the series colour)." },
|
|
99
|
-
marker: { type: ["string", "null"], enum: [...
|
|
100
|
-
curve: { type: ["string", "null"], enum: [...
|
|
100
|
+
marker: { type: ["string", "null"], enum: [..._chunkWPPJH6X4cjs.CHART_MARKERS, null], description: "Point marker shape for line, area and scatter series." },
|
|
101
|
+
curve: { type: ["string", "null"], enum: [..._chunkWPPJH6X4cjs.CHART_CURVES, null], description: "Line shape for this series: linear, smooth or step." },
|
|
101
102
|
dataLabels: { type: ["boolean", "null"], description: "Value labels for this series (null follows the chart)." },
|
|
102
103
|
format: { ...FORMAT, type: ["object", "null"], description: "How this series' labels are written (null follows the value axis)." },
|
|
103
104
|
errorBars: ERROR_BARS("Error bars along the value axis (bar, line, area and scatter series; on stacked charts they sit on the stack top)."),
|
|
104
105
|
xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
|
|
105
106
|
};
|
|
106
107
|
var CHART_UPDATE_PROPERTIES = {
|
|
107
|
-
type: { type: "string", enum: [...
|
|
108
|
+
type: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_TYPES], description: "Chart type." },
|
|
108
109
|
title: { type: "string", description: 'Title ("" for none).' },
|
|
109
110
|
subtitle: { type: "string", description: 'Subtitle ("" for none).' },
|
|
110
111
|
xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
|
|
@@ -113,21 +114,23 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
113
114
|
legend: {
|
|
114
115
|
type: "object",
|
|
115
116
|
description: "Legend.",
|
|
116
|
-
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [...
|
|
117
|
+
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_LEGEND_POSITIONS], description: "Where the legend goes." } },
|
|
117
118
|
additionalProperties: false
|
|
118
119
|
},
|
|
119
|
-
stacking: { type: "string", enum: [...
|
|
120
|
-
orientation: { type: "string", enum: [...
|
|
121
|
-
curve: { type: "string", enum: [...
|
|
120
|
+
stacking: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_STACKINGS], description: "none, stacked, or percent (each category scaled to 100%)." },
|
|
121
|
+
orientation: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_ORIENTATIONS], description: "horizontal draws bars sideways." },
|
|
122
|
+
curve: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_CURVES], description: "Line shape: linear, smooth or step." },
|
|
122
123
|
points: { type: "boolean", description: "Dots on line and area series." },
|
|
123
124
|
dataLabels: { type: "boolean", description: "Value labels on bars, points and slices." },
|
|
124
|
-
labelPosition: { type: "string", enum: [...
|
|
125
|
+
labelPosition: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_LABEL_POSITIONS], description: "Bar label position; auto drops labels that do not fit." },
|
|
125
126
|
palette: { type: "array", items: { type: "string" }, minItems: 1, description: "Series colours in order (CSS colours)." },
|
|
126
127
|
innerRadius: { type: "number", minimum: 0, maximum: 0.9, description: "Donut hole as a fraction of the radius." },
|
|
127
128
|
gapWidth: { type: "number", minimum: 0, maximum: 0.9, description: "Space between bar groups as a fraction of the category (default 0.28)." },
|
|
128
129
|
overlap: { type: "number", minimum: -1, maximum: 1, description: "Bar overlap within a group as a fraction of a bar (negative: a gap; default -0.12)." },
|
|
129
130
|
bins: { type: ["integer", "null"], minimum: 1, maximum: 500, description: "Histogram bin count, or null for \u221An." },
|
|
130
|
-
showTotal: { type: "boolean", description: "Waterfall: append a total bar." }
|
|
131
|
+
showTotal: { type: "boolean", description: "Waterfall: append a total bar." },
|
|
132
|
+
radarTicks: { type: ["integer", "null"], minimum: 1, maximum: 50, description: "Radar: number of evenly spaced rings from the value axis min to max, or null for round-number rings (default null)." },
|
|
133
|
+
radarGraticule: { type: "string", enum: [..._chunkWPPJH6X4cjs.CHART_RADAR_GRATICULES], description: "Radar: draw rings as polygons through the spokes or as circles (default polygon)." }
|
|
131
134
|
};
|
|
132
135
|
|
|
133
136
|
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
CHART_MARKERS,
|
|
10
10
|
CHART_NUMBER_STYLES,
|
|
11
11
|
CHART_ORIENTATIONS,
|
|
12
|
+
CHART_RADAR_GRATICULES,
|
|
12
13
|
CHART_SERIES_TYPES,
|
|
13
14
|
CHART_STACKINGS,
|
|
14
15
|
CHART_TRENDLINE_TYPES,
|
|
15
16
|
CHART_TYPES
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-H5XX4KHB.js";
|
|
17
18
|
|
|
18
19
|
// src/chart/schemas.ts
|
|
19
20
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -127,7 +128,9 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
127
128
|
gapWidth: { type: "number", minimum: 0, maximum: 0.9, description: "Space between bar groups as a fraction of the category (default 0.28)." },
|
|
128
129
|
overlap: { type: "number", minimum: -1, maximum: 1, description: "Bar overlap within a group as a fraction of a bar (negative: a gap; default -0.12)." },
|
|
129
130
|
bins: { type: ["integer", "null"], minimum: 1, maximum: 500, description: "Histogram bin count, or null for \u221An." },
|
|
130
|
-
showTotal: { type: "boolean", description: "Waterfall: append a total bar." }
|
|
131
|
+
showTotal: { type: "boolean", description: "Waterfall: append a total bar." },
|
|
132
|
+
radarTicks: { type: ["integer", "null"], minimum: 1, maximum: 50, description: "Radar: number of evenly spaced rings from the value axis min to max, or null for round-number rings (default null)." },
|
|
133
|
+
radarGraticule: { type: "string", enum: [...CHART_RADAR_GRATICULES], description: "Radar: draw rings as polygons through the spokes or as circles (default polygon)." }
|
|
131
134
|
};
|
|
132
135
|
|
|
133
136
|
export {
|
|
@@ -231,6 +231,7 @@ var CHART_AXIS_SCALES = ["linear", "log"];
|
|
|
231
231
|
var CHART_SERIES_TYPES = ["bar", "line", "area", "scatter"];
|
|
232
232
|
var CHART_STACKINGS = ["none", "stacked", "percent"];
|
|
233
233
|
var CHART_CURVES = ["linear", "smooth", "step"];
|
|
234
|
+
var CHART_RADAR_GRATICULES = ["polygon", "circle"];
|
|
234
235
|
var CHART_ORIENTATIONS = ["vertical", "horizontal"];
|
|
235
236
|
var CHART_LEGEND_POSITIONS = ["top", "bottom", "left", "right"];
|
|
236
237
|
var CHART_NUMBER_STYLES = ["number", "percent", "currency", "compact"];
|
|
@@ -652,6 +653,12 @@ function normalizeChartSpec(input) {
|
|
|
652
653
|
if (Number.isInteger(b) && b >= 1 && b <= 500) bins = b;
|
|
653
654
|
else issues.push({ path: "bins", message: "bins must be a whole number from 1 to 500, or null for automatic." });
|
|
654
655
|
}
|
|
656
|
+
let radarTicks = null;
|
|
657
|
+
if (value.radarTicks !== void 0 && value.radarTicks !== null) {
|
|
658
|
+
const t = Number(value.radarTicks);
|
|
659
|
+
if (Number.isInteger(t) && t >= 1 && t <= 50) radarTicks = t;
|
|
660
|
+
else issues.push({ path: "radarTicks", message: "radarTicks must be a whole number from 1 to 50, or null for round-number rings." });
|
|
661
|
+
}
|
|
655
662
|
const spec = {
|
|
656
663
|
version: 1,
|
|
657
664
|
type,
|
|
@@ -674,7 +681,9 @@ function normalizeChartSpec(input) {
|
|
|
674
681
|
gapWidth,
|
|
675
682
|
overlap,
|
|
676
683
|
bins,
|
|
677
|
-
showTotal: flag(value.showTotal, true, "showTotal", issues)
|
|
684
|
+
showTotal: flag(value.showTotal, true, "showTotal", issues),
|
|
685
|
+
radarTicks,
|
|
686
|
+
radarGraticule: pick(value.radarGraticule, CHART_RADAR_GRATICULES, "polygon", "radarGraticule", issues)
|
|
678
687
|
};
|
|
679
688
|
if (spec.stacking === "percent")
|
|
680
689
|
for (const name of ["yAxis", "yAxis2"]) {
|
|
@@ -822,4 +831,5 @@ function chartColorInputValue(color) {
|
|
|
822
831
|
|
|
823
832
|
|
|
824
833
|
|
|
825
|
-
|
|
834
|
+
|
|
835
|
+
exports.parseChartColor = parseChartColor; exports.chartRgbToHex = chartRgbToHex; exports.shadeChartColor = shadeChartColor; exports.CHART_PALETTE_SHADES = CHART_PALETTE_SHADES; exports.cyclePaletteColor = cyclePaletteColor; exports.chartLuminance = chartLuminance; exports.chartContrastRatio = chartContrastRatio; exports.chartTextOn = chartTextOn; exports.chartRgbToOklab = chartRgbToOklab; exports.chartColorDistance = chartColorDistance; exports.simulateChartVision = simulateChartVision; exports.checkChartColors = checkChartColors; exports.CHART_ERROR_BAR_TYPES = CHART_ERROR_BAR_TYPES; exports.CHART_ERROR_BAR_DIRECTIONS = CHART_ERROR_BAR_DIRECTIONS; exports.CHART_ERROR_BAR_LABELS = CHART_ERROR_BAR_LABELS; exports.defaultChartErrorBarValue = defaultChartErrorBarValue; exports.chartErrorAmounts = chartErrorAmounts; exports.describeChartErrorBars = describeChartErrorBars; exports.chartErrorBarsOfType = chartErrorBarsOfType; exports.formatChartAmountList = formatChartAmountList; exports.parseChartAmountList = parseChartAmountList; exports.CHART_TYPES = CHART_TYPES; exports.CHART_MARKERS = CHART_MARKERS; exports.CHART_TRENDLINE_TYPES = CHART_TRENDLINE_TYPES; exports.CHART_LABEL_POSITIONS = CHART_LABEL_POSITIONS; exports.CHART_AXIS_KINDS = CHART_AXIS_KINDS; exports.CHART_AXIS_SCALES = CHART_AXIS_SCALES; exports.CHART_SERIES_TYPES = CHART_SERIES_TYPES; exports.CHART_STACKINGS = CHART_STACKINGS; exports.CHART_CURVES = CHART_CURVES; exports.CHART_RADAR_GRATICULES = CHART_RADAR_GRATICULES; exports.CHART_ORIENTATIONS = CHART_ORIENTATIONS; exports.CHART_LEGEND_POSITIONS = CHART_LEGEND_POSITIONS; exports.CHART_NUMBER_STYLES = CHART_NUMBER_STYLES; exports.CHART_TYPE_LABELS = CHART_TYPE_LABELS; exports.DEFAULT_CHART_PALETTE = DEFAULT_CHART_PALETTE; exports.DEFAULT_CHART_THEME = DEFAULT_CHART_THEME; exports.CSS_VARIABLE_CHART_THEME = CSS_VARIABLE_CHART_THEME; exports.isCartesianChart = isCartesianChart; exports.isXyChart = isXyChart; exports.chartFamily = chartFamily; exports.chartColorsByCategory = chartColorsByCategory; exports.defaultChartAxis = defaultChartAxis; exports.createChartSpec = createChartSpec; exports.chartSeriesColor = chartSeriesColor; exports.chartSliceColor = chartSliceColor; exports.chartPointColor = chartPointColor; exports.chartSeriesType = chartSeriesType; exports.uniqueChartSeriesId = uniqueChartSeriesId; exports.parseChartValue = parseChartValue; exports.normalizeChartAxis = normalizeChartAxis; exports.normalizeChartValues = normalizeChartValues; exports.normalizeChartErrorBars = normalizeChartErrorBars; exports.normalizeChartTrendline = normalizeChartTrendline; exports.normalizeChartSpec = normalizeChartSpec; exports.cloneChartSpec = cloneChartSpec; exports.cloneChartSeries = cloneChartSeries; exports.chartDataFromTable = chartDataFromTable; exports.chartDataToTable = chartDataToTable; exports.chartColorInputValue = chartColorInputValue;
|