@pixerate/editor 0.162.0 → 0.163.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/index.cjs +34 -34
- package/dist/agent/index.js +5 -5
- package/dist/animation-editor/index.cjs +57 -57
- package/dist/animation-editor/index.js +3 -3
- package/dist/{brushstrokeRender-Q4LI22QV.js → brushstrokeRender-7LXCU7PD.js} +2 -2
- package/dist/{brushstrokeRender-5WANQIG4.cjs → brushstrokeRender-VO4ZTWVA.cjs} +5 -5
- package/dist/canvas/index.cjs +14 -14
- package/dist/canvas/index.js +3 -3
- package/dist/chart/commands.d.cts +2 -1
- package/dist/chart/commands.d.ts +2 -1
- package/dist/chart/controller.d.cts +109 -1
- package/dist/chart/controller.d.ts +109 -1
- package/dist/chart/index.cjs +605 -130
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +490 -15
- package/dist/chart/layout-annotations.d.cts +29 -0
- package/dist/chart/layout-annotations.d.ts +29 -0
- package/dist/chart/layout-families.d.cts +23 -0
- package/dist/chart/layout-families.d.ts +23 -0
- package/dist/chart/mermaid.d.cts +2 -1
- package/dist/chart/mermaid.d.ts +2 -1
- package/dist/chart/schemas.d.cts +13 -0
- package/dist/chart/schemas.d.ts +13 -0
- package/dist/chart/spec.d.cts +30 -5
- package/dist/chart/spec.d.ts +30 -5
- package/dist/chart/stats.d.cts +9 -1
- package/dist/chart/stats.d.ts +9 -1
- package/dist/chart/tools.d.cts +1 -1
- package/dist/chart/tools.d.ts +1 -1
- package/dist/chart/tree.d.cts +62 -0
- package/dist/chart/tree.d.ts +62 -0
- package/dist/chart/types.d.cts +77 -3
- package/dist/chart/types.d.ts +77 -3
- package/dist/{chunk-7YBDRJXT.cjs → chunk-22KLZZGH.cjs} +8 -8
- package/dist/{chunk-LQLZHP6F.js → chunk-36OKQDCF.js} +7 -4
- package/dist/{chunk-HLOKB7WW.js → chunk-3NEZJCBY.js} +366 -6
- package/dist/{chunk-GWV4T5NZ.js → chunk-3VLOOO3G.js} +1 -1
- package/dist/{chunk-3GJH2MGH.cjs → chunk-5AARIS3R.cjs} +35 -35
- package/dist/{chunk-EVPZ5IKN.js → chunk-5FNGLV2D.js} +65 -3
- package/dist/{chunk-EQ46F75O.cjs → chunk-D54JHQK2.cjs} +51 -51
- package/dist/{chunk-NO5QQDHZ.js → chunk-DAPQGA55.js} +2 -2
- package/dist/{chunk-3IHNXRUV.cjs → chunk-GKNEJ6EN.cjs} +399 -67
- package/dist/{chunk-236TKNUR.cjs → chunk-JCXMJUQO.cjs} +2 -2
- package/dist/{chunk-4NGVHHJB.cjs → chunk-NZD2MZJC.cjs} +80 -18
- package/dist/{chunk-CX6JLDFC.js → chunk-OXERWBKE.js} +3 -3
- package/dist/{chunk-32MMQYCQ.cjs → chunk-PA3IMPPS.cjs} +81 -81
- package/dist/{chunk-7CKPUUN4.js → chunk-POR54B55.js} +61 -10
- package/dist/{chunk-KGTF55R3.js → chunk-QY4KUDMY.js} +1 -1
- package/dist/{chunk-LL3H5XUH.cjs → chunk-R3P2M7HU.cjs} +367 -7
- package/dist/{chunk-HDGBM7EA.cjs → chunk-SBQVEBSU.cjs} +580 -53
- package/dist/{chunk-2TKHLX6H.js → chunk-SET6KJOP.js} +1 -1
- package/dist/{chunk-XDCFJEU7.js → chunk-SZA42R4N.js} +346 -14
- package/dist/{chunk-GLMP22FT.js → chunk-TALQONZ5.js} +3 -3
- package/dist/{chunk-GNK7SESQ.cjs → chunk-V7GWZIZK.cjs} +7 -4
- package/dist/{chunk-EYVVIZJ3.cjs → chunk-WTW7QRTS.cjs} +1 -1
- package/dist/{chunk-NA4UVVJ4.cjs → chunk-YGG7WDWT.cjs} +76 -25
- package/dist/{chunk-JGKCC5OF.cjs → chunk-YQ5C5BVK.cjs} +10 -9
- package/dist/{chunk-EY22AY6R.cjs → chunk-YSAGBIRW.cjs} +16 -16
- package/dist/{chunk-A5UCR2TO.js → chunk-YXKLVD56.js} +10 -9
- package/dist/{chunk-DTSTNRPH.js → chunk-Z4P2RBMJ.js} +536 -9
- package/dist/{chunk-45XXVHVG.js → chunk-ZZGPYNS2.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 +638 -638
- package/dist/image-editor/index.js +4 -4
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/dist/paint/index.cjs +2 -2
- package/dist/paint/index.js +1 -1
- package/dist/paint-editor/index.cjs +129 -149
- package/dist/paint-editor/index.js +5 -25
- package/dist/vector/index.cjs +948 -948
- package/dist/vector/index.js +3 -3
- package/package.json +3 -3
- package/skills/pixerate-canvas/SKILL.md +16 -0
- package/skills/pixerate-chart/SKILL.md +92 -9
- package/skills/pixerate-paint-editor/SKILL.md +0 -2
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkJCXMJUQOcjs = require('./chunk-JCXMJUQO.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 = _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.IDENTITY_MATRIX, closed = c.closed) {
|
|
71
|
+
const pts = _chunkJCXMJUQOcjs.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 = _chunk236TKNURcjs.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 = _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.sortedVectorGradientStops.call(void 0, a);
|
|
471
|
+
let stopsB = _chunkJCXMJUQOcjs.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 = [..._chunkJCXMJUQOcjs.expandVectorGradientStops.call(void 0, a), ..._chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.hasExplicitGradientGeometry.call(void 0, a);
|
|
502
|
+
const eb = _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.vectorGradientPoints.call(void 0, a);
|
|
516
|
+
const pb = _chunkJCXMJUQOcjs.vectorGradientPoints.call(void 0, b);
|
|
517
517
|
if (pa.units !== pb.units) {
|
|
518
|
-
const src =
|
|
518
|
+
const src = _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.hasPaint.call(void 0, a);
|
|
539
|
+
const pb = _chunkJCXMJUQOcjs.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 && _chunkJCXMJUQOcjs.isVectorGradient.call(void 0, a) ? a : null;
|
|
545
|
+
const gb = pb && _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.widthProfileAt.call(void 0, a, pos);
|
|
557
|
+
const y = _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.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 _chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.nodeMatrix.call(void 0, a), mb = _chunkJCXMJUQOcjs.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 = !_chunkJCXMJUQOcjs.isIdentityMatrix.call(void 0, ma) || !_chunkJCXMJUQOcjs.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) : _chunkJCXMJUQOcjs.IDENTITY_MATRIX;
|
|
638
|
+
const back = rigid ? _chunkJCXMJUQOcjs.invertMatrix.call(void 0, m) : _chunkJCXMJUQOcjs.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 = _chunk236TKNURcjs.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 && !_chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.IDENTITY_MATRIX) {
|
|
651
|
+
const m = _chunkJCXMJUQOcjs.multiplyMatrices.call(void 0, _chunkJCXMJUQOcjs.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(_chunkJCXMJUQOcjs.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 = _chunkJCXMJUQOcjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
|
|
676
|
+
const bb = _chunkJCXMJUQOcjs.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, _chunkJCXMJUQOcjs.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, _chunkJCXMJUQOcjs.IDENTITY_MATRIX, y.m));
|
|
692
692
|
opacities.push([y.opacity, y.opacity]);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
@@ -6,15 +6,18 @@ import {
|
|
|
6
6
|
CHART_ERROR_BAR_TYPES,
|
|
7
7
|
CHART_LABEL_POSITIONS,
|
|
8
8
|
CHART_LEGEND_POSITIONS,
|
|
9
|
+
CHART_LIKERT_NEUTRALS,
|
|
10
|
+
CHART_LIKERT_SORTS,
|
|
9
11
|
CHART_MARKERS,
|
|
10
12
|
CHART_NUMBER_STYLES,
|
|
11
13
|
CHART_ORIENTATIONS,
|
|
12
14
|
CHART_RADAR_GRATICULES,
|
|
15
|
+
CHART_REFERENCE_AXES,
|
|
13
16
|
CHART_SERIES_TYPES,
|
|
14
17
|
CHART_STACKINGS,
|
|
15
18
|
CHART_TRENDLINE_TYPES,
|
|
16
19
|
CHART_TYPES
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3NEZJCBY.js";
|
|
18
21
|
|
|
19
22
|
// src/chart/schemas.ts
|
|
20
23
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -69,6 +72,46 @@ var TRENDLINE_PROPS = {
|
|
|
69
72
|
name: { type: "string", description: 'Legend name (default e.g. "Linear (Sales)").' },
|
|
70
73
|
color: { type: "string", description: "CSS colour (default: the series colour)." }
|
|
71
74
|
};
|
|
75
|
+
var REFERENCE_COMMON = {
|
|
76
|
+
label: { type: "string", description: 'Text written on it, e.g. "Target" (default none).' },
|
|
77
|
+
axis: {
|
|
78
|
+
type: "string",
|
|
79
|
+
enum: [...CHART_REFERENCE_AXES],
|
|
80
|
+
description: "Axis it is measured on: y (default) is the value axis, y2 the secondary value axis (needs a series there), x the numeric x axis of a scatter or bubble chart."
|
|
81
|
+
},
|
|
82
|
+
color: { type: "string", description: "CSS colour (default: the text colour)." }
|
|
83
|
+
};
|
|
84
|
+
var REFERENCE_LINE_PROPS = {
|
|
85
|
+
value: { type: "number", description: "Where the line crosses its axis, in data units." },
|
|
86
|
+
...REFERENCE_COMMON
|
|
87
|
+
};
|
|
88
|
+
var REFERENCE_BAND_PROPS = {
|
|
89
|
+
from: { type: "number", description: "One end of the band on its axis, in data units." },
|
|
90
|
+
to: { type: "number", description: "The other end of the band, in data units (ends may come in either order)." },
|
|
91
|
+
...REFERENCE_COMMON
|
|
92
|
+
};
|
|
93
|
+
var REFERENCE_COMMON_PATCH = {
|
|
94
|
+
label: { type: ["string", "null"], description: "Text written on it; null removes it." },
|
|
95
|
+
axis: { type: ["string", "null"], enum: [...CHART_REFERENCE_AXES, null], description: "Axis it is measured on (y, y2 or x); null goes back to y." },
|
|
96
|
+
color: { type: ["string", "null"], description: "CSS colour; null goes back to the text colour." }
|
|
97
|
+
};
|
|
98
|
+
var REFERENCE_LINE_PATCH = { value: REFERENCE_LINE_PROPS.value, ...REFERENCE_COMMON_PATCH };
|
|
99
|
+
var REFERENCE_BAND_PATCH = { from: REFERENCE_BAND_PROPS.from, to: REFERENCE_BAND_PROPS.to, ...REFERENCE_COMMON_PATCH };
|
|
100
|
+
var REFERENCE_INDEX = (what) => ({ type: "integer", minimum: 0, description: `${what} index (0 = first), as get_chart lists them in spec.${what === "Reference line" ? "referenceLines" : "referenceBands"}.` });
|
|
101
|
+
var TREE_NODE = {
|
|
102
|
+
type: "object",
|
|
103
|
+
description: 'An item ({"name", "value"}) or a group ({"name", "children": [nodes]}, whose value is the sum of its items).',
|
|
104
|
+
properties: {
|
|
105
|
+
name: { type: "string", description: "Label; unique among its siblings." },
|
|
106
|
+
value: { type: "number", minimum: 0, description: "Items only: the amount, 0 or more." },
|
|
107
|
+
children: { type: "array", items: { $ref: "#/$defs/chartTreeNode" }, description: "Groups only: the nodes inside it (up to 6 levels in all)." },
|
|
108
|
+
color: { type: "string", description: "CSS colour (default: the palette colour of its top-level group, lighter further in)." }
|
|
109
|
+
},
|
|
110
|
+
required: ["name"],
|
|
111
|
+
additionalProperties: false
|
|
112
|
+
};
|
|
113
|
+
var TREE_DEFS = { chartTreeNode: TREE_NODE };
|
|
114
|
+
var TREE_PATH = { type: "array", items: { type: "string" }, minItems: 1, description: 'Names from the top level down to the node, e.g. ["Europe", "France"] (from get_chart treeTable or spec.tree).' };
|
|
72
115
|
var ERROR_BARS = (what) => ({
|
|
73
116
|
type: ["object", "null"],
|
|
74
117
|
description: `${what} null removes them.`,
|
|
@@ -97,6 +140,7 @@ var SERIES_PROPS = {
|
|
|
97
140
|
x: { type: ["array", "null"], items: VALUE, description: "Numeric x per category, for scatter and bubble charts." },
|
|
98
141
|
sizes: { type: ["array", "null"], items: VALUE, description: "Bubble sizes per category (area is proportional to size)." },
|
|
99
142
|
pointColors: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "Colour per category (null keeps the series colour)." },
|
|
143
|
+
callouts: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "A label pinned to each point that matters, one per category (null: none); null removes them all. Bar, line, area and scatter charts. set_chart_callout sets one." },
|
|
100
144
|
marker: { type: ["string", "null"], enum: [...CHART_MARKERS, null], description: "Point marker shape for line, area and scatter series." },
|
|
101
145
|
curve: { type: ["string", "null"], enum: [...CHART_CURVES, null], description: "Line shape for this series: linear, smooth or step." },
|
|
102
146
|
dataLabels: { type: ["boolean", "null"], description: "Value labels for this series (null follows the chart)." },
|
|
@@ -105,7 +149,7 @@ var SERIES_PROPS = {
|
|
|
105
149
|
xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
|
|
106
150
|
};
|
|
107
151
|
var CHART_UPDATE_PROPERTIES = {
|
|
108
|
-
type: { type: "string", enum: [...CHART_TYPES], description: "Chart type." },
|
|
152
|
+
type: { type: "string", enum: [...CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups." },
|
|
109
153
|
title: { type: "string", description: 'Title ("" for none).' },
|
|
110
154
|
subtitle: { type: "string", description: 'Subtitle ("" for none).' },
|
|
111
155
|
xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
|
|
@@ -130,7 +174,18 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
130
174
|
bins: { type: ["integer", "null"], minimum: 1, maximum: 500, description: "Histogram bin count, or null for \u221An." },
|
|
131
175
|
showTotal: { type: "boolean", description: "Waterfall: append a total bar." },
|
|
132
176
|
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)." }
|
|
177
|
+
radarGraticule: { type: "string", enum: [...CHART_RADAR_GRATICULES], description: "Radar: draw rings as polygons through the spokes or as circles (default polygon)." },
|
|
178
|
+
note: { type: "string", description: 'A source or footnote written under the chart ("" for none).' },
|
|
179
|
+
highlight: { type: "array", items: { type: "string" }, description: "Category labels and series names (or ids) to draw normally while the rest are muted; [] shows everything. highlight_chart checks the names." },
|
|
180
|
+
referenceLines: { type: "array", items: { type: "object", properties: REFERENCE_LINE_PROPS, required: ["value"], additionalProperties: false }, description: "Replaces every reference line (targets, floors, averages across the plot). add_chart_reference_line adds one." },
|
|
181
|
+
referenceBands: { type: "array", items: { type: "object", properties: REFERENCE_BAND_PROPS, required: ["from", "to"], additionalProperties: false }, description: "Replaces every reference band (target ranges across the plot). add_chart_reference_band adds one." },
|
|
182
|
+
varyColors: { type: "boolean", description: "A one-series bar, line, area or scatter chart colours each category from the palette, and its legend lists the categories (default false)." },
|
|
183
|
+
likertNeutral: { type: "string", enum: [...CHART_LIKERT_NEUTRALS], description: "Likert with an odd number of answers: split (default) puts the middle answer across the centre line; separate draws it in its own column on the right." },
|
|
184
|
+
likertSort: { type: "string", enum: [...CHART_LIKERT_SORTS], description: "Likert: order the questions by agreement (positive), by disagreement (negative) or as given (none, default)." },
|
|
185
|
+
parliamentArc: { type: "number", minimum: 90, maximum: 360, description: "Parliament: sweep of the hemicycle in degrees (default 180)." },
|
|
186
|
+
parliamentMajority: { type: ["integer", "null"], minimum: 1, description: "Parliament: seats needed for a majority, drawn as a dashed line (null: half of the seats plus one)." },
|
|
187
|
+
parliamentLabel: { type: "string", description: 'Parliament: caption under the seat total ("" writes "seats").' },
|
|
188
|
+
sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' }
|
|
134
189
|
};
|
|
135
190
|
|
|
136
191
|
export {
|
|
@@ -140,6 +195,13 @@ export {
|
|
|
140
195
|
WIDTH,
|
|
141
196
|
HEIGHT,
|
|
142
197
|
TRENDLINE_PROPS,
|
|
198
|
+
REFERENCE_LINE_PROPS,
|
|
199
|
+
REFERENCE_BAND_PROPS,
|
|
200
|
+
REFERENCE_LINE_PATCH,
|
|
201
|
+
REFERENCE_BAND_PATCH,
|
|
202
|
+
REFERENCE_INDEX,
|
|
203
|
+
TREE_DEFS,
|
|
204
|
+
TREE_PATH,
|
|
143
205
|
SERIES_PROPS,
|
|
144
206
|
CHART_UPDATE_PROPERTIES
|
|
145
207
|
};
|