@pixerate/editor 0.250.0 → 0.252.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 +40 -41
- package/dist/agent/index.js +9 -10
- package/dist/animation/index.cjs +6 -7
- package/dist/animation/index.js +5 -6
- package/dist/animation-editor/index.cjs +70 -70
- package/dist/animation-editor/index.js +12 -12
- package/dist/brushes/index.cjs +2087 -0
- package/dist/brushes/index.d.cts +17 -0
- package/dist/brushes/index.d.ts +17 -0
- package/dist/brushes/index.js +2087 -0
- package/dist/brushes/library.d.cts +104 -0
- package/dist/brushes/library.d.ts +104 -0
- package/dist/brushes/migrate.d.cts +17 -0
- package/dist/brushes/migrate.d.ts +17 -0
- package/dist/brushes/normalize.d.cts +15 -0
- package/dist/brushes/normalize.d.ts +15 -0
- package/dist/brushes/presets.d.cts +12 -0
- package/dist/brushes/presets.d.ts +12 -0
- package/dist/brushes/profiles.d.cts +85 -0
- package/dist/brushes/profiles.d.ts +85 -0
- package/dist/brushes/resolve.d.cts +56 -0
- package/dist/brushes/resolve.d.ts +56 -0
- package/dist/brushes/schema.d.cts +29 -0
- package/dist/brushes/schema.d.ts +29 -0
- package/dist/brushes/tools.d.cts +37 -0
- package/dist/brushes/tools.d.ts +37 -0
- package/dist/brushes/types.d.cts +323 -0
- package/dist/brushes/types.d.ts +323 -0
- package/dist/{brushstrokeRender-2FHFLSEG.js → brushstrokeRender-5PYSKZIJ.js} +8 -8
- package/dist/{brushstrokeRender-QGRXOKDA.cjs → brushstrokeRender-7FLLSQEC.cjs} +14 -14
- package/dist/canvas/index.cjs +57 -58
- package/dist/canvas/index.js +31 -32
- package/dist/chart/index.cjs +159 -160
- package/dist/chart/index.js +9 -10
- package/dist/{chunk-NOHJP5TK.js → chunk-2ZJ4DT3M.js} +1 -1
- package/dist/{chunk-XZNU4DUX.cjs → chunk-3NS5C7FB.cjs} +76 -76
- package/dist/{chunk-UTI5IITZ.cjs → chunk-4ZC5QJE2.cjs} +3 -3
- package/dist/{chunk-SMSGP2HQ.js → chunk-5JNA6LLY.js} +1 -1
- package/dist/{chunk-RD7RX52G.cjs → chunk-5UEFBM2M.cjs} +207 -18
- package/dist/{chunk-WA44NKPF.js → chunk-62Z5WLRA.js} +1 -1
- package/dist/{chunk-BVRRIW7F.js → chunk-6GRUVGKU.js} +3 -3
- package/dist/{chunk-QARCM66V.js → chunk-6ZZKRH7R.js} +3 -3
- package/dist/{chunk-BP6KSGVD.js → chunk-7272D3K2.js} +4 -6
- package/dist/{chunk-NTRAVM2I.js → chunk-7P6VF3FG.js} +2 -2
- package/dist/chunk-APX63ILU.js +173 -0
- package/dist/{chunk-W7L4HUT2.cjs → chunk-CJ6TBL2N.cjs} +16 -16
- package/dist/{chunk-7PT4RJL5.cjs → chunk-EUIDTZNQ.cjs} +111 -113
- package/dist/{chunk-CXXXAZ7H.js → chunk-F6R67I3A.js} +1 -1
- package/dist/{chunk-I7NJPHWV.cjs → chunk-FQPUF2W2.cjs} +35 -606
- package/dist/{chunk-D5KGAO4Z.js → chunk-GCVFEPJG.js} +2 -573
- package/dist/{chunk-LEQKZGQI.js → chunk-GOBOCZZI.js} +1 -1
- package/dist/{chunk-KDLBJ6QR.js → chunk-GYMMNCFT.js} +3 -3
- package/dist/{chunk-NUTMINJZ.cjs → chunk-H7ET2ISK.cjs} +52 -52
- package/dist/chunk-HS6QDWDF.cjs +1029 -0
- package/dist/{chunk-T7KQEMAE.cjs → chunk-HUAISCUX.cjs} +18 -18
- package/dist/{chunk-YGQVCQTG.js → chunk-ILP77UD6.js} +1 -1
- package/dist/{chunk-S6OT6CTS.cjs → chunk-IWEVV63O.cjs} +31 -33
- package/dist/{chunk-M2VKFE5L.cjs → chunk-JFHBXNR2.cjs} +88 -88
- package/dist/{chunk-WPUXGDH4.cjs → chunk-JPEHXIB5.cjs} +10 -10
- package/dist/chunk-JSDND7DF.cjs +173 -0
- package/dist/{chunk-36ZTV7WO.js → chunk-L6Y7TSQ4.js} +1 -1
- package/dist/{chunk-YW43M56C.cjs → chunk-LFMKWGFL.cjs} +1 -1
- package/dist/{chunk-V6DT2CDH.js → chunk-M2TPMYJE.js} +1 -1
- package/dist/{chunk-LJZRHVZV.cjs → chunk-M5GLQQWG.cjs} +2 -2
- package/dist/{chunk-JEGJP4OW.js → chunk-MHLU6GRJ.js} +196 -7
- package/dist/{chunk-KMPM5JM5.js → chunk-MONXNVZK.js} +4 -6
- package/dist/chunk-MTKY6K3Q.js +1029 -0
- package/dist/{chunk-MOW3JMNG.cjs → chunk-N76AMOKE.cjs} +42 -42
- package/dist/{chunk-75K3W4D6.cjs → chunk-NKGB64CW.cjs} +16 -16
- package/dist/{chunk-SGPIVHJB.js → chunk-P3K2JCJA.js} +3 -3
- package/dist/chunk-PXDIAYB6.cjs +594 -0
- package/dist/{chunk-3TWOCSCY.js → chunk-QC3OXRE4.js} +9 -9
- package/dist/{chunk-YM6ZBTXG.cjs → chunk-QLSGTCYT.cjs} +23 -23
- package/dist/{chunk-7YW7T5TJ.js → chunk-RHPSE2YR.js} +2 -2
- package/dist/{chunk-44BMJJVA.cjs → chunk-RUONPPMC.cjs} +8 -8
- package/dist/{chunk-ATK6ABN3.cjs → chunk-SABJMH6M.cjs} +145 -12
- package/dist/{chunk-XWOLPNBW.cjs → chunk-SOSBOS5T.cjs} +22 -22
- package/dist/{chunk-PPFJHTW5.cjs → chunk-TFF2GTGN.cjs} +22 -24
- package/dist/{chunk-X7WRL5ZZ.cjs → chunk-TLOGFIIV.cjs} +37 -37
- package/dist/chunk-TXFWZ5ZJ.js +594 -0
- package/dist/{chunk-GXAK6Q5J.js → chunk-UFEDHACQ.js} +2 -2
- package/dist/{chunk-GA4EU4P3.cjs → chunk-UXETV2NC.cjs} +4 -4
- package/dist/{chunk-N4DFDI73.js → chunk-WKMUBATU.js} +1 -1
- package/dist/{chunk-3R5P3DVY.cjs → chunk-WRZ6C4TU.cjs} +6 -6
- package/dist/{chunk-U4NUOKBT.js → chunk-WZOGDKCQ.js} +134 -1
- package/dist/{chunk-6ADHGQ73.js → chunk-YBAPT7NL.js} +2 -4
- package/dist/color/index.cjs +4 -6
- package/dist/color/index.js +7 -9
- package/dist/export/index.cjs +7 -8
- package/dist/export/index.js +6 -7
- package/dist/extensions/index.cjs +10 -11
- package/dist/extensions/index.js +9 -10
- package/dist/gradient/index.cjs +33 -34
- package/dist/gradient/index.js +4 -5
- package/dist/image-editor/index.cjs +845 -844
- package/dist/image-editor/index.js +39 -38
- package/dist/index.cjs +16 -17
- package/dist/index.js +10 -11
- package/dist/paint/index.cjs +6 -4
- package/dist/paint/index.js +21 -19
- package/dist/paint-editor/brushes.d.cts +1 -2
- package/dist/paint-editor/brushes.d.ts +1 -2
- package/dist/paint-editor/index.cjs +2193 -694
- package/dist/paint-editor/index.js +1575 -76
- package/dist/paint-editor/mark-settings.d.cts +104 -0
- package/dist/paint-editor/mark-settings.d.ts +104 -0
- package/dist/paint-editor/procedural.d.cts +2 -75
- package/dist/paint-editor/procedural.d.ts +2 -75
- package/dist/paint-editor/stickers.d.cts +1 -22
- package/dist/paint-editor/stickers.d.ts +1 -22
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.js +9 -9
- package/dist/stickers/index.cjs +10 -10
- package/dist/stickers/index.js +9 -9
- package/dist/tokens/index.cjs +3 -4
- package/dist/tokens/index.js +2 -3
- package/dist/tools/skill-evals.d.cts +8 -1
- package/dist/tools/skill-evals.d.ts +8 -1
- package/dist/typography/index.cjs +7 -8
- package/dist/typography/index.js +2 -3
- package/dist/vector/index.cjs +974 -974
- package/dist/vector/index.js +12 -12
- package/dist/video-editor/index.cjs +6 -7
- package/dist/video-editor/index.js +5 -6
- package/package.json +11 -1
- package/skills/README.md +2 -0
- package/skills/pixerate-brushes/SKILL.md +104 -0
- package/skills/pixerate-brushes-design/SKILL.md +88 -0
- package/skills/pixerate-brushes-design/evals/canvas-chalk.json +15 -0
- package/skills/pixerate-brushes-design/evals/pink-highlighter.json +15 -0
- package/skills/pixerate-brushes-design/evals/port-to-vector.json +17 -0
- package/dist/chunk-4JNWA3VT.cjs +0 -302
- package/dist/chunk-7AHBW2CQ.cjs +0 -200
- package/dist/chunk-F67XMVDI.js +0 -200
- package/dist/chunk-GT77U7QG.cjs +0 -2637
- package/dist/chunk-OTEPAQJX.js +0 -2637
- package/dist/chunk-WKH5ZAUA.js +0 -302
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkJPEHXIB5cjs = require('./chunk-JPEHXIB5.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
|
|
@@ -1361,12 +1361,12 @@ var unit = (x, y) => {
|
|
|
1361
1361
|
return l > 1e-12 && Number.isFinite(l) ? [x / l, y / l] : null;
|
|
1362
1362
|
};
|
|
1363
1363
|
function cubicOf(sp, i) {
|
|
1364
|
-
const s =
|
|
1364
|
+
const s = _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, i);
|
|
1365
1365
|
if (s.length === 4) return s;
|
|
1366
1366
|
const [a, b] = s;
|
|
1367
1367
|
return [a, [a[0] + (b[0] - a[0]) / 3, a[1] + (b[1] - a[1]) / 3], [a[0] + 2 * (b[0] - a[0]) / 3, a[1] + 2 * (b[1] - a[1]) / 3], b];
|
|
1368
1368
|
}
|
|
1369
|
-
var isLine = (sp, i) =>
|
|
1369
|
+
var isLine = (sp, i) => _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, i).length === 2;
|
|
1370
1370
|
function startTangent(c) {
|
|
1371
1371
|
for (let k = 1; k < 4; k++) {
|
|
1372
1372
|
const u = unit(c[k][0] - c[0][0], c[k][1] - c[0][1]);
|
|
@@ -1386,10 +1386,10 @@ function sample(c, n, out, withStart) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
var onAnchor = (a, h) => !h || Math.abs(h.x - a.x) < EPS && Math.abs(h.y - a.y) < EPS;
|
|
1388
1388
|
function tidy(a, keepType = true) {
|
|
1389
|
-
const next =
|
|
1389
|
+
const next = _chunkJPEHXIB5cjs.cloneAnchor.call(void 0, a);
|
|
1390
1390
|
if (onAnchor(next, next.in)) delete next.in;
|
|
1391
1391
|
if (onAnchor(next, next.out)) delete next.out;
|
|
1392
|
-
const shown =
|
|
1392
|
+
const shown = _chunkJPEHXIB5cjs.inferAnchorType.call(void 0, next);
|
|
1393
1393
|
const type = keepType && a.type ? a.type === "symmetric" && shown !== "symmetric" ? shown === "corner" ? "corner" : "smooth" : a.type === "smooth" && shown === "corner" ? "corner" : a.type : shown;
|
|
1394
1394
|
if (type === "corner") delete next.type;
|
|
1395
1395
|
else next.type = type;
|
|
@@ -1433,7 +1433,7 @@ function fitAcross(pts, N, t0, t1) {
|
|
|
1433
1433
|
return goldenMin(fit, 0, 1);
|
|
1434
1434
|
}
|
|
1435
1435
|
function removeAnchorKeepingShape(sp, index) {
|
|
1436
|
-
const anchors = sp.anchors.map(
|
|
1436
|
+
const anchors = sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor);
|
|
1437
1437
|
const n = anchors.length;
|
|
1438
1438
|
if (index < 0 || index >= n) return { anchors, closed: sp.closed };
|
|
1439
1439
|
if ((sp.closed || index > 0 && index < n - 1) && n >= 3) {
|
|
@@ -1467,12 +1467,12 @@ function removeAnchorKeepingShape(sp, index) {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
function removeAnchorsKeepingShape(sp, indices) {
|
|
1469
1469
|
const order = [...new Set(indices)].filter((i) => i >= 0 && i < sp.anchors.length).sort((a, b) => b - a);
|
|
1470
|
-
return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(
|
|
1470
|
+
return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed });
|
|
1471
1471
|
}
|
|
1472
1472
|
function bendSegment(sp, segment, t, p) {
|
|
1473
|
-
const anchors = sp.anchors.map(
|
|
1473
|
+
const anchors = sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor);
|
|
1474
1474
|
const n = anchors.length;
|
|
1475
|
-
if (segment < 0 || segment >=
|
|
1475
|
+
if (segment < 0 || segment >= _chunkJPEHXIB5cjs.subpathSegmentCount.call(void 0, sp) || !Number.isFinite(t) || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return { anchors, closed: sp.closed };
|
|
1476
1476
|
const tc = Math.min(0.95, Math.max(0.05, t));
|
|
1477
1477
|
const ia = segment;
|
|
1478
1478
|
const ib = (segment + 1) % n;
|
|
@@ -1483,16 +1483,16 @@ function bendSegment(sp, segment, t, p) {
|
|
|
1483
1483
|
const oy = (p.y - (a.y + (b.y - a.y) * tc)) / k;
|
|
1484
1484
|
const c1 = { x: a.x + (b.x - a.x) / 3 + ox, y: a.y + (b.y - a.y) / 3 + oy };
|
|
1485
1485
|
const c2 = { x: b.x + (a.x - b.x) / 3 + ox, y: b.y + (a.y - b.y) / 3 + oy };
|
|
1486
|
-
anchors[ia] =
|
|
1487
|
-
anchors[ib] =
|
|
1486
|
+
anchors[ia] = _chunkJPEHXIB5cjs.moveAnchorHandle.call(void 0, a, "out", c1);
|
|
1487
|
+
anchors[ib] = _chunkJPEHXIB5cjs.moveAnchorHandle.call(void 0, b, "in", c2);
|
|
1488
1488
|
return { anchors, closed: sp.closed };
|
|
1489
1489
|
}
|
|
1490
1490
|
function subpathPointAt(sp, segment, t) {
|
|
1491
|
-
const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0,
|
|
1491
|
+
const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0, _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, segment), t);
|
|
1492
1492
|
return { x, y };
|
|
1493
1493
|
}
|
|
1494
1494
|
function curvatureMoveAnchor(sp, index, q) {
|
|
1495
|
-
const anchors = sp.anchors.map(
|
|
1495
|
+
const anchors = sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor);
|
|
1496
1496
|
const a = sp.anchors[index];
|
|
1497
1497
|
if (!a) return { anchors, closed: sp.closed };
|
|
1498
1498
|
const own = [
|
|
@@ -1538,7 +1538,7 @@ function curvatureMoveAnchor(sp, index, q) {
|
|
|
1538
1538
|
function cutSubpathAt(sp, at) {
|
|
1539
1539
|
const n = sp.anchors.length;
|
|
1540
1540
|
const cuts = [...new Set(at)].filter((i) => Number.isInteger(i) && i >= 0 && i < n && (sp.closed || i > 0 && i < n - 1)).sort((a, b) => a - b);
|
|
1541
|
-
if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(
|
|
1541
|
+
if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed }];
|
|
1542
1542
|
const first = cuts[0];
|
|
1543
1543
|
const run = sp.closed ? Array.from({ length: n + 1 }, (_, i) => sp.anchors[(first + i) % n]) : sp.anchors;
|
|
1544
1544
|
const cutSet = new Set(sp.closed ? [...cuts.map((c) => (c - first + n) % n), n] : cuts);
|
|
@@ -1546,7 +1546,7 @@ function cutSubpathAt(sp, at) {
|
|
|
1546
1546
|
let cur = [];
|
|
1547
1547
|
run.forEach((a, i) => {
|
|
1548
1548
|
if (!cutSet.has(i)) {
|
|
1549
|
-
cur.push(
|
|
1549
|
+
cur.push(_chunkJPEHXIB5cjs.cloneAnchor.call(void 0, a));
|
|
1550
1550
|
return;
|
|
1551
1551
|
}
|
|
1552
1552
|
if (cur.length) {
|
|
@@ -1561,10 +1561,10 @@ function cutSubpathAt(sp, at) {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
function splitSubpathAt(sp, segment, t, endTolerance = 1e-6) {
|
|
1563
1563
|
const n = sp.anchors.length;
|
|
1564
|
-
if (segment < 0 || segment >=
|
|
1564
|
+
if (segment < 0 || segment >= _chunkJPEHXIB5cjs.subpathSegmentCount.call(void 0, sp)) return [{ anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed }];
|
|
1565
1565
|
if (t <= endTolerance) return cutSubpathAt(sp, [segment]);
|
|
1566
1566
|
if (t >= 1 - endTolerance) return cutSubpathAt(sp, [(segment + 1) % n]);
|
|
1567
|
-
const { subpath, index } =
|
|
1567
|
+
const { subpath, index } = _chunkJPEHXIB5cjs.insertAnchor.call(void 0, sp, segment, t);
|
|
1568
1568
|
return cutSubpathAt(subpath, [index]);
|
|
1569
1569
|
}
|
|
1570
1570
|
var endOf = (sp, last) => sp.anchors[last ? sp.anchors.length - 1 : 0];
|
|
@@ -1587,7 +1587,7 @@ function joinSubpaths(subpaths, tolerance) {
|
|
|
1587
1587
|
const closed = [];
|
|
1588
1588
|
let open = [];
|
|
1589
1589
|
for (const sp of subpaths) {
|
|
1590
|
-
const copy = { anchors: sp.anchors.map(
|
|
1590
|
+
const copy = { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed };
|
|
1591
1591
|
if (sp.closed || sp.anchors.length < 2) {
|
|
1592
1592
|
if (sp.anchors.length) closed.push(copy);
|
|
1593
1593
|
} else open.push(copy);
|
|
@@ -1642,7 +1642,7 @@ function smoothSubpath(sp, amount = 1, only) {
|
|
|
1642
1642
|
const t = Math.min(1, Math.max(0, amount));
|
|
1643
1643
|
const orig = sp.anchors;
|
|
1644
1644
|
const n = orig.length;
|
|
1645
|
-
const anchors = orig.map(
|
|
1645
|
+
const anchors = orig.map(_chunkJPEHXIB5cjs.cloneAnchor);
|
|
1646
1646
|
if (n < 3 || t === 0) return { anchors, closed: sp.closed };
|
|
1647
1647
|
for (let i = 0; i < n; i++) {
|
|
1648
1648
|
if (!sp.closed && (i === 0 || i === n - 1)) continue;
|
|
@@ -1671,8 +1671,8 @@ function smoothSubpath(sp, amount = 1, only) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
function segsOf(sp) {
|
|
1673
1673
|
const out = [];
|
|
1674
|
-
for (let i = 0; i <
|
|
1675
|
-
const s =
|
|
1674
|
+
for (let i = 0; i < _chunkJPEHXIB5cjs.subpathSegmentCount.call(void 0, sp); i++) {
|
|
1675
|
+
const s = _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, i);
|
|
1676
1676
|
out.push(s.length === 2 ? { c: s, line: true } : { c: s, line: false });
|
|
1677
1677
|
}
|
|
1678
1678
|
return out;
|
|
@@ -1729,7 +1729,7 @@ function removeRedundantPoints(sp, tolerance) {
|
|
|
1729
1729
|
const tol = Math.max(tolerance, 1e-9);
|
|
1730
1730
|
const types = new Map(sp.anchors.filter((a) => a.type).map((a) => [`${a.x},${a.y}`, a.type]));
|
|
1731
1731
|
const segs = segsOf(sp).filter((s) => !isZeroSeg(s));
|
|
1732
|
-
if (!segs.length) return { anchors: sp.anchors.map(
|
|
1732
|
+
if (!segs.length) return { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed };
|
|
1733
1733
|
const minSegs = sp.closed ? 2 : 1;
|
|
1734
1734
|
let changed = true;
|
|
1735
1735
|
while (changed && segs.length > minSegs) {
|
|
@@ -1747,7 +1747,7 @@ function removeRedundantPoints(sp, tolerance) {
|
|
|
1747
1747
|
break;
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
1750
|
-
return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(
|
|
1750
|
+
return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed }));
|
|
1751
1751
|
}
|
|
1752
1752
|
|
|
1753
1753
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
r2,
|
|
15
15
|
sameChartSelection,
|
|
16
16
|
summarizeChartSeries
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WKMUBATU.js";
|
|
18
18
|
import {
|
|
19
19
|
CHART_TYPE_LABELS,
|
|
20
20
|
DEFAULT_CHART_PALETTE,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
parseChartValue,
|
|
48
48
|
shadeChartColor,
|
|
49
49
|
uniqueChartSeriesId
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-6ZZKRH7R.js";
|
|
51
51
|
import {
|
|
52
52
|
parseCsv,
|
|
53
53
|
parseTsv
|
|
@@ -11,10 +11,10 @@ var _chunkYN6JKAUEcjs = require('./chunk-YN6JKAUE.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkHUAISCUXcjs = require('./chunk-HUAISCUX.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
|
|
18
18
|
|
|
19
19
|
// src/export/images.ts
|
|
20
20
|
var DOCX_IMAGE_TYPES = {
|
|
@@ -1028,12 +1028,12 @@ var DocxBuilder = (_class2 = class {
|
|
|
1028
1028
|
this.drop("node", "chart", "chart has no spec");
|
|
1029
1029
|
return;
|
|
1030
1030
|
}
|
|
1031
|
-
const spec =
|
|
1032
|
-
const written =
|
|
1031
|
+
const spec = _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, raw).spec;
|
|
1032
|
+
const written = _chunkHUAISCUXcjs.chartToOoxml.call(void 0, spec);
|
|
1033
1033
|
for (const issue of written.issues) this.drop("node", "chart", issue);
|
|
1034
1034
|
const name = `chart${this.charts.length + 1}.xml`;
|
|
1035
1035
|
this.charts.push(written.xml);
|
|
1036
|
-
const relId = this.rels.add(
|
|
1036
|
+
const relId = this.rels.add(_chunkHUAISCUXcjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
|
|
1037
1037
|
let width = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.width])), () => ( MAX_IMAGE_WIDTH_PX));
|
|
1038
1038
|
let height = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.height])), () => ( 320));
|
|
1039
1039
|
if (width > MAX_IMAGE_WIDTH_PX) {
|
|
@@ -1050,8 +1050,8 @@ var DocxBuilder = (_class2 = class {
|
|
|
1050
1050
|
drawing.empty("wp:extent", { cx, cy }).empty("wp:effectExtent", { l: 0, t: 0, r: 0, b: 0 });
|
|
1051
1051
|
drawing.empty("wp:docPr", { id, name: `Chart ${id}`, descr: title || void 0, title: title || void 0 });
|
|
1052
1052
|
drawing.empty("wp:cNvGraphicFramePr");
|
|
1053
|
-
drawing.open("a:graphic").open("a:graphicData", { uri:
|
|
1054
|
-
drawing.empty("c:chart", { "xmlns:c":
|
|
1053
|
+
drawing.open("a:graphic").open("a:graphicData", { uri: _chunkHUAISCUXcjs.CHART_OOXML_NS });
|
|
1054
|
+
drawing.empty("c:chart", { "xmlns:c": _chunkHUAISCUXcjs.CHART_OOXML_NS, "r:id": relId });
|
|
1055
1055
|
drawing.close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing").close("w:r");
|
|
1056
1056
|
this.report.written.paragraphs++;
|
|
1057
1057
|
w.open("w:p");
|
|
@@ -1384,7 +1384,7 @@ var DocxBuilder = (_class2 = class {
|
|
|
1384
1384
|
if (people) add("word/people.xml", people, `${CT_WML}people+xml`);
|
|
1385
1385
|
parts.push({ name: "word/_rels/document.xml.rels", data: this.rels.xml() });
|
|
1386
1386
|
for (const file of this.media) parts.push({ name: `word/media/${file.name}`, data: file.bytes });
|
|
1387
|
-
this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml,
|
|
1387
|
+
this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunkHUAISCUXcjs.CHART_OOXML_CONTENT_TYPE));
|
|
1388
1388
|
add("docProps/core.xml", this.coreXml(now), "application/vnd.openxmlformats-package.core-properties+xml");
|
|
1389
1389
|
const app = new XmlWriter();
|
|
1390
1390
|
app.open("Properties", { xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" });
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkJSDND7DFcjs = require('./chunk-JSDND7DF.cjs');
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
var _chunkU67EN7GGcjs = require('./chunk-U67EN7GG.cjs');
|
|
@@ -12,6 +16,129 @@ var _chunkU67EN7GGcjs = require('./chunk-U67EN7GG.cjs');
|
|
|
12
16
|
|
|
13
17
|
var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
14
18
|
|
|
19
|
+
// src/stickers/tools.ts
|
|
20
|
+
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
21
|
+
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
22
|
+
function stickerForAgent(provider, s) {
|
|
23
|
+
const { id, thumbnail: _thumbnail, ...rest } = s;
|
|
24
|
+
return { ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, id), ...rest };
|
|
25
|
+
}
|
|
26
|
+
async function knownRefs(provider, cap = 500) {
|
|
27
|
+
const refs = [];
|
|
28
|
+
let after;
|
|
29
|
+
while (refs.length < cap) {
|
|
30
|
+
const page = await provider.list({ limit: _chunkJSDND7DFcjs.MAX_STICKER_PAGE, ...after ? { after } : {} });
|
|
31
|
+
refs.push(...page.items.map((s) => _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, s.id)));
|
|
32
|
+
if (!page.next || !page.items.length) break;
|
|
33
|
+
after = page.next;
|
|
34
|
+
}
|
|
35
|
+
return refs;
|
|
36
|
+
}
|
|
37
|
+
async function describeStickerRef(provider, ref) {
|
|
38
|
+
_chunkJSDND7DFcjs.parseStickerRef.call(void 0, ref);
|
|
39
|
+
const id = _chunkJSDND7DFcjs.stickerIdFor.call(void 0, provider, ref);
|
|
40
|
+
const found = id === null ? void 0 : await provider.describe(id);
|
|
41
|
+
if (found) return found;
|
|
42
|
+
const near = _chunkJSDND7DFcjs.closestStickerRefs.call(void 0, ref, await knownRefs(provider));
|
|
43
|
+
const owner = _chunkJSDND7DFcjs.parseStickerRef.call(void 0, ref).provider;
|
|
44
|
+
const where = id === null && !provider.namespaced ? ` The sticker library is "${provider.id}", not "${owner}".` : "";
|
|
45
|
+
throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `No sticker "${ref}".${where} Closest: ${near.join(", ") || "none"}; find_stickers lists them.`);
|
|
46
|
+
}
|
|
47
|
+
function createStickerTools(options) {
|
|
48
|
+
const find = {
|
|
49
|
+
name: "find_stickers",
|
|
50
|
+
title: "Find stickers",
|
|
51
|
+
description: "Searches the sticker library (the editor's own stamps unless the host plugged in its own): words in the name, tags, category or description, filtered by category, tags and commercial licence, a small page at a time. Returns each sticker's ref (provider:id, for the tools that spray or place stickers), name, category, tags, natural width and height, formats, whether it is tintable (recoloured to the paint colour) and its licence, plus total and next (pass as after for the next page) and the categories. Changes nothing.",
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: {
|
|
55
|
+
query: { type: "string", maxLength: 200, description: "Words to match (default: list everything)." },
|
|
56
|
+
category: { type: "string", description: "Only this category (the result lists them)." },
|
|
57
|
+
tags: { type: "array", maxItems: 10, items: { type: "string", description: "A tag." }, description: "Only stickers with every one of these tags." },
|
|
58
|
+
commercial: { type: "boolean", description: "true: only stickers whose licence allows commercial use." },
|
|
59
|
+
limit: { type: "integer", minimum: 1, maximum: _chunkJSDND7DFcjs.MAX_STICKER_PAGE, description: "Page size (default 24)." },
|
|
60
|
+
after: { type: "string", description: "next from the previous page." }
|
|
61
|
+
},
|
|
62
|
+
additionalProperties: false
|
|
63
|
+
},
|
|
64
|
+
annotations: { title: "Find stickers", ...READ },
|
|
65
|
+
handler: async ({ query, category, tags, commercial, limit, after }) => {
|
|
66
|
+
const p = options.provider();
|
|
67
|
+
const categories = await _asyncNullishCoalesce(await _optionalChain([p, 'access', _2 => _2.categories, 'optionalCall', _3 => _3()]), async () => ( null));
|
|
68
|
+
if (category !== void 0 && categories && !categories.some((c) => c.id === category)) {
|
|
69
|
+
throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `No category "${category}" in "${p.name}"; categories: ${categories.map((c) => c.id).join(", ")}.`);
|
|
70
|
+
}
|
|
71
|
+
const o = { ...category !== void 0 ? { category } : {}, ...tags ? { tags } : {}, ...commercial ? { licence: { commercial: true } } : {}, ...limit !== void 0 ? { limit } : {}, ...after !== void 0 ? { after } : {} };
|
|
72
|
+
const q = typeof query === "string" ? query.trim() : "";
|
|
73
|
+
if (q && !p.capabilities.supportsSearch) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `"${p.name}" can't search; leave query out and filter by category instead.`);
|
|
74
|
+
const page = q ? await p.search(q, o) : await p.list(o);
|
|
75
|
+
return { provider: p.id, items: page.items.map((s) => stickerForAgent(p, s)), total: page.total, ...page.next ? { next: page.next } : {}, ...categories ? { categories } : {} };
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const describe = {
|
|
79
|
+
name: "describe_sticker",
|
|
80
|
+
title: "Describe a sticker",
|
|
81
|
+
description: "Everything about one sticker by ref (from find_stickers): name, category, tags, natural size, formats, tintable, licence (with any attribution it asks for), dominant colours, variants and its outline as SVG path data (silhouette). An unknown ref is refused with the closest refs. Changes nothing.",
|
|
82
|
+
inputSchema: { type: "object", properties: { ref: { type: "string", description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." } }, required: ["ref"], additionalProperties: false },
|
|
83
|
+
annotations: { title: "Describe a sticker", ...READ },
|
|
84
|
+
handler: async ({ ref }) => {
|
|
85
|
+
const p = options.provider();
|
|
86
|
+
const d = await describeStickerRef(p, ref);
|
|
87
|
+
const { thumbnail: _thumbnail, id, ...rest } = d;
|
|
88
|
+
return { ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, p, id), ...rest };
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return options.insert ? [find, describe, createInsertStickerTool(options.provider, options.insert)] : [find, describe];
|
|
92
|
+
}
|
|
93
|
+
async function loadForHost(provider, ref, d, host, colour, size) {
|
|
94
|
+
const id = _chunkJSDND7DFcjs.stickerIdFor.call(void 0, provider, ref);
|
|
95
|
+
const format = d.formats.includes(host.format) ? host.format : _nullishCoalesce(d.formats[0], () => ( host.format));
|
|
96
|
+
return provider.load(id, { format, ...format === "png" ? { size: Math.max(8, Math.min(_nullishCoalesce(provider.capabilities.maxSize, () => ( 1024)), Math.round(size))) } : {}, ...colour && d.tintable ? { colour } : {} });
|
|
97
|
+
}
|
|
98
|
+
async function insertSticker(provider, host, options) {
|
|
99
|
+
const d = await describeStickerRef(provider, options.ref);
|
|
100
|
+
if (options.color !== void 0 && !d.tintable) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `"${options.ref}" is not tintable (its art has its own colours); leave color out, or pick a tintable sticker (find_stickers lists tintable).`);
|
|
101
|
+
if (options.width !== void 0 && !(options.width > 0)) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `width must be a positive size, got ${options.width}.`);
|
|
102
|
+
const w = _nullishCoalesce(options.width, () => ( d.width));
|
|
103
|
+
const h = w * d.height / d.width;
|
|
104
|
+
const centre = host.defaultCentre();
|
|
105
|
+
const asset = await loadForHost(provider, options.ref, d, host, options.color, Math.max(w, h));
|
|
106
|
+
const ref = _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, d.id);
|
|
107
|
+
const made = await host.insert({ ref, description: d, asset, x: _nullishCoalesce(options.x, () => ( centre.x)), y: _nullishCoalesce(options.y, () => ( centre.y)), width: w, height: h, ...options.color ? { colour: options.color.toLowerCase() } : {} });
|
|
108
|
+
return { ...made, ref, width: w, height: h, licence: d.licence };
|
|
109
|
+
}
|
|
110
|
+
function createInsertStickerTool(provider, host) {
|
|
111
|
+
return {
|
|
112
|
+
name: "insert_sticker",
|
|
113
|
+
title: "Insert a sticker",
|
|
114
|
+
description: `Puts one sticker from the sticker library (ref from find_stickers) into the document as a new ${host.noun}, centred at x, y and width wide (its natural aspect kept; default its natural size), tinted to color when the sticker is tintable. Its art is loaded first; an unknown ref is refused with the closest ones. One undo step. Returns the new ${host.noun}'s id (for the editor's own tools, such as effects on it), the ref and its licence (credit any attribution it asks for).`,
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: "object",
|
|
117
|
+
properties: {
|
|
118
|
+
ref: { type: "string", minLength: 1, description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." },
|
|
119
|
+
x: { type: "number", description: "Centre x in document units (default the middle of the view or document)." },
|
|
120
|
+
y: { type: "number", description: "Centre y in document units (default the middle of the view or document)." },
|
|
121
|
+
width: { type: "number", exclusiveMinimum: 0, maximum: 1e4, description: "Width in document units (default the natural width); the height follows the aspect." },
|
|
122
|
+
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "Tint #rrggbb for tintable stickers (default the sticker's own colour); refused for stickers that are not tintable." }
|
|
123
|
+
},
|
|
124
|
+
required: ["ref"],
|
|
125
|
+
additionalProperties: false
|
|
126
|
+
},
|
|
127
|
+
annotations: { title: "Insert a sticker", ...WRITE },
|
|
128
|
+
handler: ({ ref, x, y, width, color }) => insertSticker(provider(), host, { ref, x, y, width, color })
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function createStickerToolProvider(options) {
|
|
132
|
+
return {
|
|
133
|
+
id: _nullishCoalesce(options.id, () => ( "stickers")),
|
|
134
|
+
namespace: options.namespace,
|
|
135
|
+
title: "Stickers",
|
|
136
|
+
description: "Find and describe stickers from the sticker library, by ref (provider:id), for the editors that spray or place them.",
|
|
137
|
+
skill: "pixerate-stickers",
|
|
138
|
+
tools: createStickerTools(options)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
15
142
|
// src/stickers/editor.ts
|
|
16
143
|
var BOX = 100;
|
|
17
144
|
var GRID = 128;
|
|
@@ -32,7 +159,7 @@ var HEX = /^#[0-9a-fA-F]{6}$/;
|
|
|
32
159
|
function stampOutline(kind) {
|
|
33
160
|
const n = GRID;
|
|
34
161
|
const f = new Float32Array((n + 1) * (n + 1));
|
|
35
|
-
for (let j = 0; j <= n; j++) for (let i = 0; i <= n; i++) f[j * (n + 1) + i] =
|
|
162
|
+
for (let j = 0; j <= n; j++) for (let i = 0; i <= n; i++) f[j * (n + 1) + i] = _chunkJSDND7DFcjs.stampCoverage.call(void 0, kind, i / n * 2 - 1, j / n * 2 - 1, SHAPE_SEED) - 0.5;
|
|
36
163
|
const at = (i, j) => f[j * (n + 1) + i];
|
|
37
164
|
const points = /* @__PURE__ */ new Map();
|
|
38
165
|
const point = (key, i0, j0, i1, j1) => {
|
|
@@ -169,7 +296,7 @@ function stampPixels(kind, size, colour) {
|
|
|
169
296
|
for (let y = 0; y < size; y++) {
|
|
170
297
|
for (let x = 0; x < size; x++) {
|
|
171
298
|
let c = 0;
|
|
172
|
-
for (let sy = 0; sy < ss; sy++) for (let sx = 0; sx < ss; sx++) c +=
|
|
299
|
+
for (let sy = 0; sy < ss; sy++) for (let sx = 0; sx < ss; sx++) c += _chunkJSDND7DFcjs.stampCoverage.call(void 0, kind, (x + (sx + 0.5) / ss) / size * 2 - 1, (y + (sy + 0.5) / ss) / size * 2 - 1, SHAPE_SEED);
|
|
173
300
|
const a = Math.round(c / (ss * ss) * 255);
|
|
174
301
|
if (!a) continue;
|
|
175
302
|
const i = (y * size + x) * 4;
|
|
@@ -191,22 +318,22 @@ function editorStickers() {
|
|
|
191
318
|
return { id: k, name: m.name, category: m.category, tags: m.tags, description: m.description, width: BOX, height: BOX, thumbnail: thumbs.get(k), formats: ["svg", "png"], licence: { ...LICENCE }, tintable: true };
|
|
192
319
|
};
|
|
193
320
|
const kind = (id) => {
|
|
194
|
-
if (!
|
|
321
|
+
if (!_chunkJSDND7DFcjs.STAMP_KINDS.includes(id)) throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `The editor has no sticker "${id}"; its stickers are ${_chunkJSDND7DFcjs.STAMP_KINDS.join(", ")}.`);
|
|
195
322
|
return id;
|
|
196
323
|
};
|
|
197
324
|
return {
|
|
198
|
-
id:
|
|
325
|
+
id: _chunkJSDND7DFcjs.EDITOR_STICKERS_ID,
|
|
199
326
|
name: "Editor stickers",
|
|
200
327
|
version: "1",
|
|
201
328
|
capabilities: { supportsSearch: true, supportsSvg: true, supportsRaster: true, maxSize: 1024 },
|
|
202
|
-
list: (options) =>
|
|
203
|
-
search: (query, options) =>
|
|
329
|
+
list: (options) => _chunkJSDND7DFcjs.stickerPage.call(void 0, _chunkJSDND7DFcjs.STAMP_KINDS.map(summary), options),
|
|
330
|
+
search: (query, options) => _chunkJSDND7DFcjs.stickerPage.call(void 0, _chunkJSDND7DFcjs.STAMP_KINDS.map(summary), options, query),
|
|
204
331
|
describe(id) {
|
|
205
|
-
if (!
|
|
332
|
+
if (!_chunkJSDND7DFcjs.STAMP_KINDS.includes(id)) return void 0;
|
|
206
333
|
const k = id;
|
|
207
334
|
return { ...summary(k), silhouette: outline(k), colours: [META[k].colour] };
|
|
208
335
|
},
|
|
209
|
-
categories: () => [...new Set(
|
|
336
|
+
categories: () => [...new Set(_chunkJSDND7DFcjs.STAMP_KINDS.map((k) => META[k].category))].map((c) => ({ id: c, name: c[0].toUpperCase() + c.slice(1), count: _chunkJSDND7DFcjs.STAMP_KINDS.filter((k) => META[k].category === c).length })),
|
|
210
337
|
load(id, options = {}) {
|
|
211
338
|
const k = kind(id);
|
|
212
339
|
const colour = _nullishCoalesce(options.colour, () => ( META[k].colour));
|
|
@@ -255,7 +382,7 @@ var StickerBrowser = (_class = class {
|
|
|
255
382
|
this.next = void 0;
|
|
256
383
|
this.set({ loading: true, error: null, items: [], total: 0, hasMore: false, provider: p.name });
|
|
257
384
|
try {
|
|
258
|
-
const categories = await _asyncNullishCoalesce(await _optionalChain([p, 'access',
|
|
385
|
+
const categories = await _asyncNullishCoalesce(await _optionalChain([p, 'access', _4 => _4.categories, 'optionalCall', _5 => _5()]), async () => ( []));
|
|
259
386
|
if (run !== this.run) return;
|
|
260
387
|
this.set({ categories });
|
|
261
388
|
await this.page(run, p, true);
|
|
@@ -290,7 +417,7 @@ var StickerBrowser = (_class = class {
|
|
|
290
417
|
const res = q && p.capabilities.supportsSearch ? await p.search(q, options) : await p.list(options);
|
|
291
418
|
if (run !== this.run) return;
|
|
292
419
|
this.next = res.next;
|
|
293
|
-
const items = res.items.map((s) => ({ ...s, ref:
|
|
420
|
+
const items = res.items.map((s) => ({ ...s, ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, p, s.id) }));
|
|
294
421
|
this.set({ items: first ? items : [...this.s.items, ...items], total: res.total, hasMore: Boolean(res.next), loading: false });
|
|
295
422
|
}
|
|
296
423
|
}, _class);
|
|
@@ -300,4 +427,10 @@ var StickerBrowser = (_class = class {
|
|
|
300
427
|
|
|
301
428
|
|
|
302
429
|
|
|
303
|
-
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
exports.stickerForAgent = stickerForAgent; exports.describeStickerRef = describeStickerRef; exports.createStickerTools = createStickerTools; exports.insertSticker = insertSticker; exports.createInsertStickerTool = createInsertStickerTool; exports.createStickerToolProvider = createStickerToolProvider; exports.stampOutline = stampOutline; exports.stampPixels = stampPixels; exports.editorStickers = editorStickers; exports.StickerBrowser = StickerBrowser;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
|
|
22
22
|
|
|
23
23
|
// src/chart/schemas.ts
|
|
24
24
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -30,7 +30,7 @@ var FORMAT = {
|
|
|
30
30
|
type: "object",
|
|
31
31
|
description: "How numbers are written on this axis or series.",
|
|
32
32
|
properties: {
|
|
33
|
-
style: { type: "string", enum: [...
|
|
33
|
+
style: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_NUMBER_STYLES], description: "number (default), percent (0.25 \u2192 25%), currency or compact (1.2K)." },
|
|
34
34
|
decimals: { type: "integer", minimum: 0, maximum: 10, description: "Fixed decimals (default: what the ticks need)." },
|
|
35
35
|
currency: { type: "string", description: 'ISO currency code for style "currency", e.g. "EUR" (default USD).' },
|
|
36
36
|
prefix: { type: "string", description: "Text before every number." },
|
|
@@ -50,10 +50,10 @@ var AXIS = (what) => ({
|
|
|
50
50
|
step: { type: ["number", "null"], exclusiveMinimum: 0, description: "Fixed distance between ticks, or null for automatic." },
|
|
51
51
|
gridlines: { type: "boolean", description: "Grid lines at each tick." },
|
|
52
52
|
format: FORMAT,
|
|
53
|
-
kind: { type: ["string", "null"], enum: [...
|
|
53
|
+
kind: { type: ["string", "null"], enum: [..._chunkWRZ6C4TUcjs.CHART_AXIS_KINDS, null], description: 'Category axis only: "date" reads categories as dates and labels them by calendar steps.' },
|
|
54
54
|
scale: {
|
|
55
55
|
type: ["string", "null"],
|
|
56
|
-
enum: [...
|
|
56
|
+
enum: [..._chunkWRZ6C4TUcjs.CHART_AXIS_SCALES, null],
|
|
57
57
|
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.'
|
|
58
58
|
},
|
|
59
59
|
logBase: { type: ["number", "null"], minimum: 2, maximum: 1e3, description: "Base of a log axis, 2 to 1000 (default 10; null resets)." },
|
|
@@ -62,7 +62,7 @@ var AXIS = (what) => ({
|
|
|
62
62
|
additionalProperties: false
|
|
63
63
|
});
|
|
64
64
|
var TRENDLINE_PROPS = {
|
|
65
|
-
type: { type: "string", enum: [...
|
|
65
|
+
type: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_TRENDLINE_TYPES], description: "Fit: linear, exponential, logarithmic, power, polynomial or moving-average." },
|
|
66
66
|
order: { type: "integer", minimum: 2, maximum: 6, description: "Polynomial order (default 2)." },
|
|
67
67
|
period: { type: "integer", minimum: 2, description: "Moving-average period in points (default 2)." },
|
|
68
68
|
forward: { type: "number", minimum: 0, description: "Extend the line this many x units past the last point (default 0)." },
|
|
@@ -77,7 +77,7 @@ var REFERENCE_COMMON = {
|
|
|
77
77
|
label: { type: "string", description: 'Text written on it, e.g. "Target" (default none).' },
|
|
78
78
|
axis: {
|
|
79
79
|
type: "string",
|
|
80
|
-
enum: [...
|
|
80
|
+
enum: [..._chunkWRZ6C4TUcjs.CHART_REFERENCE_AXES],
|
|
81
81
|
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."
|
|
82
82
|
},
|
|
83
83
|
color: { type: "string", description: "CSS colour (default: the text colour)." }
|
|
@@ -93,7 +93,7 @@ var REFERENCE_BAND_PROPS = {
|
|
|
93
93
|
};
|
|
94
94
|
var REFERENCE_COMMON_PATCH = {
|
|
95
95
|
label: { type: ["string", "null"], description: "Text written on it; null removes it." },
|
|
96
|
-
axis: { type: ["string", "null"], enum: [...
|
|
96
|
+
axis: { type: ["string", "null"], enum: [..._chunkWRZ6C4TUcjs.CHART_REFERENCE_AXES, null], description: "Axis it is measured on (y, y2 or x); null goes back to y." },
|
|
97
97
|
color: { type: ["string", "null"], description: "CSS colour; null goes back to the text colour." }
|
|
98
98
|
};
|
|
99
99
|
var REFERENCE_LINE_PATCH = { value: REFERENCE_LINE_PROPS.value, ...REFERENCE_COMMON_PATCH };
|
|
@@ -127,13 +127,13 @@ var ERROR_BARS = (what) => ({
|
|
|
127
127
|
properties: {
|
|
128
128
|
type: {
|
|
129
129
|
type: "string",
|
|
130
|
-
enum: [...
|
|
130
|
+
enum: [..._chunkWRZ6C4TUcjs.CHART_ERROR_BAR_TYPES],
|
|
131
131
|
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."
|
|
132
132
|
},
|
|
133
133
|
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." },
|
|
134
134
|
plus: { type: "array", items: VALUE, description: "custom only: amount above each point, one per category, in data units (0 or more; null for none)." },
|
|
135
135
|
minus: { type: "array", items: VALUE, description: "custom only: amount below each point, one per category (default: the plus amounts)." },
|
|
136
|
-
direction: { type: "string", enum: [...
|
|
136
|
+
direction: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_ERROR_BAR_DIRECTIONS], description: "both (default), plus (only above) or minus (only below)." },
|
|
137
137
|
cap: { type: "boolean", description: "Draw end caps (default true)." }
|
|
138
138
|
},
|
|
139
139
|
required: ["type"],
|
|
@@ -143,22 +143,22 @@ var SERIES_PROPS = {
|
|
|
143
143
|
name: { type: "string", description: "Series name (legend and data grid header)." },
|
|
144
144
|
values: { type: "array", items: VALUE, description: "One value per category, in category order (padded with gaps)." },
|
|
145
145
|
color: { type: ["string", "null"], description: "CSS colour, or null for the palette colour." },
|
|
146
|
-
type: { type: ["string", "null"], enum: [...
|
|
146
|
+
type: { type: ["string", "null"], enum: [..._chunkWRZ6C4TUcjs.CHART_SERIES_TYPES, null], description: "Draw this series as bar, line, area or scatter (a combo chart); null follows the chart type." },
|
|
147
147
|
hidden: { type: "boolean", description: "Hide the series (its data is kept)." },
|
|
148
148
|
axis: { type: ["string", "null"], enum: ["primary", "secondary", null], description: "Value axis: secondary is drawn on the right with its own scale." },
|
|
149
149
|
x: { type: ["array", "null"], items: VALUE, description: "Numeric x per category, for scatter and bubble charts." },
|
|
150
150
|
sizes: { type: ["array", "null"], items: VALUE, description: "Bubble sizes per category (area is proportional to size)." },
|
|
151
151
|
pointColors: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "Colour per category (null keeps the series colour)." },
|
|
152
152
|
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." },
|
|
153
|
-
marker: { type: ["string", "null"], enum: [...
|
|
154
|
-
curve: { type: ["string", "null"], enum: [...
|
|
153
|
+
marker: { type: ["string", "null"], enum: [..._chunkWRZ6C4TUcjs.CHART_MARKERS, null], description: "Point marker shape for line, area and scatter series." },
|
|
154
|
+
curve: { type: ["string", "null"], enum: [..._chunkWRZ6C4TUcjs.CHART_CURVES, null], description: "Line shape for this series: linear, smooth or step." },
|
|
155
155
|
dataLabels: { type: ["boolean", "null"], description: "Value labels for this series (null follows the chart)." },
|
|
156
156
|
format: { ...FORMAT, type: ["object", "null"], description: "How this series' labels are written (null follows the value axis)." },
|
|
157
157
|
errorBars: ERROR_BARS("Error bars along the value axis (bar, line, area and scatter series; on stacked charts they sit on the stack top)."),
|
|
158
158
|
xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
|
|
159
159
|
};
|
|
160
160
|
var CHART_UPDATE_PROPERTIES = {
|
|
161
|
-
type: { type: "string", enum: [...
|
|
161
|
+
type: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_TYPES], description: "Chart type. streamgraph stacks areas symmetrically around a center baseline; 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; sankey draws the flows (set_chart_links); barrace reads categories as time points and series as names, and animates their ranking; choropleth shades the regions of a map, each category naming a region by code (FRA) or name (France)." },
|
|
162
162
|
title: { type: "string", description: 'Title ("" for none).' },
|
|
163
163
|
subtitle: { type: "string", description: 'Subtitle ("" for none).' },
|
|
164
164
|
xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
|
|
@@ -167,15 +167,15 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
167
167
|
legend: {
|
|
168
168
|
type: "object",
|
|
169
169
|
description: "Legend.",
|
|
170
|
-
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [...
|
|
170
|
+
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_LEGEND_POSITIONS], description: "Where the legend goes." } },
|
|
171
171
|
additionalProperties: false
|
|
172
172
|
},
|
|
173
|
-
stacking: { type: "string", enum: [...
|
|
174
|
-
orientation: { type: "string", enum: [...
|
|
175
|
-
curve: { type: "string", enum: [...
|
|
173
|
+
stacking: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_STACKINGS], description: "none, stacked, or percent (each category scaled to 100%)." },
|
|
174
|
+
orientation: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_ORIENTATIONS], description: "horizontal draws bars sideways." },
|
|
175
|
+
curve: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_CURVES], description: "Line shape: linear, smooth or step." },
|
|
176
176
|
points: { type: "boolean", description: "Dots on line and area series." },
|
|
177
177
|
dataLabels: { type: "boolean", description: "Value labels on bars, points and slices." },
|
|
178
|
-
labelPosition: { type: "string", enum: [...
|
|
178
|
+
labelPosition: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_LABEL_POSITIONS], description: "Bar label position; auto drops labels that do not fit." },
|
|
179
179
|
palette: { type: "array", items: { type: "string" }, minItems: 1, description: "Series colours in order (CSS colours)." },
|
|
180
180
|
innerRadius: { type: "number", minimum: 0, maximum: 0.9, description: "Donut hole as a fraction of the radius." },
|
|
181
181
|
gapWidth: { type: "number", minimum: 0, maximum: 0.9, description: "Space between bar groups as a fraction of the category (default 0.28)." },
|
|
@@ -183,19 +183,19 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
183
183
|
bins: { type: ["integer", "null"], minimum: 1, maximum: 500, description: "Histogram bin count, or null for \u221An." },
|
|
184
184
|
showTotal: { type: "boolean", description: "Waterfall: append a total bar." },
|
|
185
185
|
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)." },
|
|
186
|
-
radarGraticule: { type: "string", enum: [...
|
|
186
|
+
radarGraticule: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_RADAR_GRATICULES], description: "Radar: draw rings as polygons through the spokes or as circles (default polygon)." },
|
|
187
187
|
note: { type: "string", description: 'A source or footnote written under the chart ("" for none).' },
|
|
188
188
|
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." },
|
|
189
189
|
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." },
|
|
190
190
|
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." },
|
|
191
191
|
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)." },
|
|
192
|
-
likertNeutral: { type: "string", enum: [...
|
|
193
|
-
likertSort: { type: "string", enum: [...
|
|
192
|
+
likertNeutral: { type: "string", enum: [..._chunkWRZ6C4TUcjs.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." },
|
|
193
|
+
likertSort: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_LIKERT_SORTS], description: "Likert: order the questions by agreement (positive), by disagreement (negative) or as given (none, default)." },
|
|
194
194
|
parliamentArc: { type: "number", minimum: 90, maximum: 360, description: "Parliament: sweep of the hemicycle in degrees (default 180)." },
|
|
195
195
|
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)." },
|
|
196
196
|
parliamentLabel: { type: "string", description: 'Parliament: caption under the seat total ("" writes "seats").' },
|
|
197
197
|
sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' },
|
|
198
|
-
sankeyLinkColor: { type: "string", enum: [...
|
|
198
|
+
sankeyLinkColor: { type: "string", enum: [..._chunkWRZ6C4TUcjs.CHART_SANKEY_LINK_COLORS], description: "Sankey: colour each flow by its source node (default), its target node, or grey." },
|
|
199
199
|
map: { type: "string", description: 'Choropleth: the registered map to draw (list_chart_map_regions lists them; "europe" by default).' },
|
|
200
200
|
mapSteps: { type: "integer", minimum: 2, maximum: 9, description: "Choropleth: number of equal colour classes between the smallest and largest value (default 5)." },
|
|
201
201
|
mapThresholds: { type: "array", items: { type: "number" }, maxItems: 8, description: "Choropleth: class breaks in ascending order, e.g. [100, 250, 500], used instead of mapSteps; [] goes back to equal classes." },
|