@pixerate/editor 0.162.1 → 0.164.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/canvas/displacement.d.cts +34 -2
- package/dist/canvas/displacement.d.ts +34 -2
- package/dist/canvas/explosion-tools.d.cts +43 -0
- package/dist/canvas/explosion-tools.d.ts +43 -0
- package/dist/canvas/explosionLayout.d.cts +50 -0
- package/dist/canvas/explosionLayout.d.ts +50 -0
- package/dist/canvas/explosionState.d.cts +52 -0
- package/dist/canvas/explosionState.d.ts +52 -0
- package/dist/canvas/index.cjs +430 -88
- package/dist/canvas/index.d.cts +3 -0
- package/dist/canvas/index.d.ts +3 -0
- package/dist/canvas/index.js +425 -83
- package/dist/canvas/types.d.cts +27 -2
- package/dist/canvas/types.d.ts +27 -2
- 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-HLOKB7WW.js → chunk-3NEZJCBY.js} +366 -6
- 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-4NGVHHJB.cjs → chunk-NZD2MZJC.cjs} +80 -18
- package/dist/{chunk-CX6JLDFC.js → chunk-OXERWBKE.js} +3 -3
- package/dist/{chunk-7CKPUUN4.js → chunk-POR54B55.js} +61 -10
- package/dist/{chunk-LL3H5XUH.cjs → chunk-R3P2M7HU.cjs} +367 -7
- package/dist/{chunk-HDGBM7EA.cjs → chunk-SBQVEBSU.cjs} +580 -53
- package/dist/{chunk-XDCFJEU7.js → chunk-SZA42R4N.js} +346 -14
- package/dist/{chunk-GLMP22FT.js → chunk-TALQONZ5.js} +3 -3
- package/dist/{chunk-NA4UVVJ4.cjs → chunk-YGG7WDWT.cjs} +76 -25
- package/dist/{chunk-EY22AY6R.cjs → chunk-YSAGBIRW.cjs} +16 -16
- package/dist/{chunk-DTSTNRPH.js → chunk-Z4P2RBMJ.js} +536 -9
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.js +6 -6
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/dist/paint-editor/index.cjs +0 -20
- package/dist/paint-editor/index.js +0 -20
- package/package.json +1 -1
- package/skills/README.md +12 -0
- package/skills/pixerate-agent-tools/SKILL.md +34 -1
- package/skills/pixerate-canvas/SKILL.md +16 -0
- package/skills/pixerate-chart/SKILL.md +41 -9
- package/skills/pixerate-image-editor/SKILL.md +2 -0
- package/skills/pixerate-paint-editor/SKILL.md +2 -0
- package/skills/pixerate-tokens/SKILL.md +5 -0
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkR3P2M7HUcjs = require('./chunk-R3P2M7HU.cjs');
|
|
10
12
|
|
|
11
13
|
// src/chart/ooxml.ts
|
|
12
14
|
var CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
@@ -109,11 +111,11 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
109
111
|
try {
|
|
110
112
|
doc = new (parser(options))().parseFromString(xml, "application/xml");
|
|
111
113
|
} catch (error) {
|
|
112
|
-
return { spec:
|
|
114
|
+
return { spec: _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: `The chart XML could not be read: ${error.message}` }], unsupported, lossless: false };
|
|
113
115
|
}
|
|
114
116
|
const root = doc.documentElement;
|
|
115
117
|
if (!root || root.localName !== "chartSpace" || doc.getElementsByTagName("parsererror").length) {
|
|
116
|
-
return { spec:
|
|
118
|
+
return { spec: _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: "This is not a chart part: expected a c:chartSpace (or cx:chartSpace) root element." }], unsupported, lossless: false };
|
|
117
119
|
}
|
|
118
120
|
if (_optionalChain([root, 'access', _14 => _14.namespaceURI, 'optionalAccess', _15 => _15.includes, 'call', _16 => _16("chartex")]) || kid(root, "chartData")) return readChartex(root, issues, unsupported);
|
|
119
121
|
const chart = kid(root, "chart");
|
|
@@ -278,7 +280,7 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
278
280
|
}
|
|
279
281
|
if (!types.length) {
|
|
280
282
|
issues.push({ path: "plotArea", message: unsupported.length ? `The chart type is not supported: ${unsupported.join(", ")}.` : "The chart has no plot groups." });
|
|
281
|
-
return { spec:
|
|
283
|
+
return { spec: _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, input).spec, issues, unsupported, lossless: false };
|
|
282
284
|
}
|
|
283
285
|
const first = types[0];
|
|
284
286
|
const combo = types.some((t) => t !== first);
|
|
@@ -288,14 +290,14 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
288
290
|
if (!combo) {
|
|
289
291
|
for (const s of series) if (s.axis) issues.push({ path: "series", message: `"${s.name}" is on a second value axis.` });
|
|
290
292
|
}
|
|
291
|
-
if (types.some((t) => !
|
|
293
|
+
if (types.some((t) => !_chunkR3P2M7HUcjs.isCartesianChart.call(void 0, t)) && combo) unsupported.push("a pie or radar mixed with other chart types");
|
|
292
294
|
input.series = series;
|
|
293
295
|
input.categories = categories.length ? categories : Array.from({ length: Math.max(0, ...series.map((s) => s.values.length)) }, (_, i) => `${i + 1}`);
|
|
294
296
|
input.stacking = stacking;
|
|
295
297
|
input.orientation = orientation;
|
|
296
298
|
input.dataLabels = dataLabels;
|
|
297
299
|
input.points = points || first !== "line";
|
|
298
|
-
if (bool(val(groups[0], "varyColors")) &&
|
|
300
|
+
if (bool(val(groups[0], "varyColors")) && !combo && _chunkR3P2M7HUcjs.isCartesianChart.call(void 0, first) && series.length === 1) input.varyColors = true;
|
|
299
301
|
const readAxis = (a, fallback) => {
|
|
300
302
|
const axis = { ...fallback, format: {} };
|
|
301
303
|
if (!a) return axis;
|
|
@@ -322,12 +324,12 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
322
324
|
};
|
|
323
325
|
const xy = first === "scatter" || first === "bubble";
|
|
324
326
|
const catAxis = _nullishCoalesce(_nullishCoalesce(kid(plot, "catAx"), () => ( kid(plot, "dateAx"))), () => ( (xy ? valAxes.find((a) => !vertical(a)) : void 0)));
|
|
325
|
-
input.xAxis = readAxis(catAxis,
|
|
327
|
+
input.xAxis = readAxis(catAxis, _chunkR3P2M7HUcjs.defaultChartAxis.call(void 0, false));
|
|
326
328
|
if (kid(plot, "dateAx")) input.xAxis.kind = "date";
|
|
327
|
-
input.yAxis = readAxis(_nullishCoalesce(_nullishCoalesce(primaryAxis, () => ( valAxes.find(vertical))), () => ( valAxes[0])),
|
|
329
|
+
input.yAxis = readAxis(_nullishCoalesce(_nullishCoalesce(primaryAxis, () => ( valAxes.find(vertical))), () => ( valAxes[0])), _chunkR3P2M7HUcjs.defaultChartAxis.call(void 0, true));
|
|
328
330
|
const secondaryAxis = valAxes.find((a) => a !== primaryAxis && (xy ? vertical(a) && a !== primaryAxis : true) && a !== catAxis);
|
|
329
|
-
if (series.some((s) => s.axis === "secondary") && secondaryAxis) input.yAxis2 = readAxis(secondaryAxis,
|
|
330
|
-
const { spec, issues: specIssues } =
|
|
331
|
+
if (series.some((s) => s.axis === "secondary") && secondaryAxis) input.yAxis2 = readAxis(secondaryAxis, _chunkR3P2M7HUcjs.defaultChartAxis.call(void 0, false));
|
|
332
|
+
const { spec, issues: specIssues } = _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, input);
|
|
331
333
|
issues.push(...specIssues);
|
|
332
334
|
const uniq = [...new Set(unsupported)];
|
|
333
335
|
return { spec, issues, unsupported: uniq, lossless: uniq.length === 0 && specIssues.length === 0 };
|
|
@@ -340,6 +342,29 @@ function readChartex(root, issues, unsupported) {
|
|
|
340
342
|
const numDim = kids(d, "numDim")[0];
|
|
341
343
|
const lvl = (dim) => kids(dim, "lvl")[0];
|
|
342
344
|
const cats = kids(lvl(strDim), "pt").map((p) => _nullishCoalesce(p.textContent, () => ( "")));
|
|
345
|
+
const levels = kids(strDim, "lvl").map((l) => {
|
|
346
|
+
const out = [];
|
|
347
|
+
for (const p of kids(l, "pt")) out[Number(_nullishCoalesce(p.getAttribute("idx"), () => ( out.length)))] = (_nullishCoalesce(p.textContent, () => ( ""))).trim();
|
|
348
|
+
return out;
|
|
349
|
+
});
|
|
350
|
+
let paths;
|
|
351
|
+
if (levels.length > 1) {
|
|
352
|
+
const carried = [];
|
|
353
|
+
paths = levels[0].map((_, i) => {
|
|
354
|
+
const path2 = [];
|
|
355
|
+
for (let k = levels.length - 1; k >= 1; k--) {
|
|
356
|
+
const name = levels[k][i];
|
|
357
|
+
if (name) {
|
|
358
|
+
carried[k] = name;
|
|
359
|
+
carried.length = Math.max(carried.length, k + 1);
|
|
360
|
+
for (let j = 1; j < k; j++) carried[j] = "";
|
|
361
|
+
}
|
|
362
|
+
if (carried[k]) path2.push(carried[k]);
|
|
363
|
+
}
|
|
364
|
+
if (levels[0][i]) path2.push(levels[0][i]);
|
|
365
|
+
return path2;
|
|
366
|
+
});
|
|
367
|
+
}
|
|
343
368
|
const values = [];
|
|
344
369
|
const nl = lvl(numDim);
|
|
345
370
|
for (const p of kids(nl, "pt")) {
|
|
@@ -347,19 +372,18 @@ function readChartex(root, issues, unsupported) {
|
|
|
347
372
|
while (values.length < i) values.push(null);
|
|
348
373
|
values[i] = numberOf((_nullishCoalesce(p.textContent, () => ( ""))).trim());
|
|
349
374
|
}
|
|
350
|
-
data.set(id, { categories: cats, values, code: _nullishCoalesce(_optionalChain([nl, 'optionalAccess', _27 => _27.getAttribute, 'call', _28 => _28("formatCode")]), () => ( void 0)) });
|
|
375
|
+
data.set(id, { categories: cats, values, code: _nullishCoalesce(_optionalChain([nl, 'optionalAccess', _27 => _27.getAttribute, 'call', _28 => _28("formatCode")]), () => ( void 0)), paths });
|
|
351
376
|
}
|
|
352
377
|
const chart = kid(root, "chart");
|
|
353
378
|
const region = path(chart, "plotArea", "plotAreaRegion");
|
|
354
379
|
const seriesEls = kids(region, "series");
|
|
355
|
-
const layouts = { waterfall: "waterfall", funnel: "funnel", treemap: "treemap", sunburst: "
|
|
380
|
+
const layouts = { waterfall: "waterfall", funnel: "funnel", treemap: "treemap", sunburst: "sunburst", boxWhisker: "box", clusteredColumn: "histogram", paretoLine: "histogram" };
|
|
356
381
|
const layout = _nullishCoalesce(_optionalChain([seriesEls, 'access', _29 => _29[0], 'optionalAccess', _30 => _30.getAttribute, 'call', _31 => _31("layoutId")]), () => ( ""));
|
|
357
382
|
const type = layouts[layout];
|
|
358
383
|
if (!type) {
|
|
359
384
|
issues.push({ path: "plotArea", message: `The chart layout "${layout || "unknown"}" is not supported.` });
|
|
360
|
-
return { spec:
|
|
385
|
+
return { spec: _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, {}).spec, issues, unsupported: [layout || "unknown chartex layout"], lossless: false };
|
|
361
386
|
}
|
|
362
|
-
if (layout === "sunburst") unsupported.push("sunburst (drawn as a treemap of the innermost level)");
|
|
363
387
|
if (layout === "paretoLine") unsupported.push("pareto line");
|
|
364
388
|
const series = [];
|
|
365
389
|
let categories = [];
|
|
@@ -382,15 +406,21 @@ function readChartex(root, issues, unsupported) {
|
|
|
382
406
|
categories: categories.length >= longest ? categories : Array.from({ length: longest }, (_, i) => _nullishCoalesce(categories[i], () => ( `${i + 1}`)))
|
|
383
407
|
};
|
|
384
408
|
if (type === "waterfall") input.showTotal = false;
|
|
385
|
-
const
|
|
409
|
+
const first = data.get(_nullishCoalesce(_optionalChain([kid, 'call', _35 => _35(seriesEls[0], "dataId"), 'optionalAccess', _36 => _36.getAttribute, 'call', _37 => _37("val")]), () => ( "0")));
|
|
410
|
+
if ((type === "treemap" || type === "sunburst") && _optionalChain([first, 'optionalAccess', _38 => _38.paths])) {
|
|
411
|
+
const treeIssues = [];
|
|
412
|
+
input.tree = _chunkR3P2M7HUcjs.chartTreeFromRows.call(void 0, first.paths.map((path2, i) => ({ path: path2, value: _nullishCoalesce(first.values[i], () => ( 0)) })), treeIssues);
|
|
413
|
+
for (const t of treeIssues) issues.push({ path: "chartData", message: t.message });
|
|
414
|
+
}
|
|
415
|
+
const { spec, issues: specIssues } = _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, input);
|
|
386
416
|
issues.push(...specIssues);
|
|
387
417
|
return { spec, issues, unsupported, lossless: unsupported.length === 0 && specIssues.length === 0 };
|
|
388
418
|
}
|
|
389
419
|
var esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
390
420
|
var hex = (color) => {
|
|
391
421
|
if (!color) return null;
|
|
392
|
-
const rgb =
|
|
393
|
-
return rgb ?
|
|
422
|
+
const rgb = _chunkR3P2M7HUcjs.parseChartColor.call(void 0, color);
|
|
423
|
+
return rgb ? _chunkR3P2M7HUcjs.chartRgbToHex.call(void 0, rgb).slice(1).toUpperCase() : null;
|
|
394
424
|
};
|
|
395
425
|
var fillXml = (color, line = false) => {
|
|
396
426
|
const h = hex(color);
|
|
@@ -434,22 +464,42 @@ function errBarsXml(bars, dir) {
|
|
|
434
464
|
var MARKER_OUT = { circle: "circle", square: "square", diamond: "diamond", triangle: "triangle", cross: "x", none: "none" };
|
|
435
465
|
function chartToOoxml(spec) {
|
|
436
466
|
const issues = [];
|
|
437
|
-
const family =
|
|
467
|
+
const family = _chunkR3P2M7HUcjs.chartFamily.call(void 0, spec);
|
|
438
468
|
let type = spec.type;
|
|
439
469
|
if (family === "waterfall" || family === "histogram" || family === "box" || family === "funnel") {
|
|
440
470
|
issues.push(`${spec.type} charts are written as bar charts: DrawingML has no ${spec.type} type (Office 2016 stores it as chartex).`);
|
|
441
471
|
type = "bar";
|
|
442
472
|
} else if (family === "treemap") {
|
|
443
|
-
issues.push(
|
|
473
|
+
issues.push(`Treemaps are written as pie charts${spec.tree.length ? " of the top-level group totals" : ""}: DrawingML has no treemap type.`);
|
|
444
474
|
type = "pie";
|
|
475
|
+
} else if (family === "sunburst") {
|
|
476
|
+
issues.push(`Sunburst charts are written as doughnut charts of the ${spec.tree.length ? "top-level group totals" : "values"}: DrawingML has no sunburst type (Office 2016 stores it as chartex).`);
|
|
477
|
+
type = "donut";
|
|
478
|
+
} else if (family === "parliament") {
|
|
479
|
+
issues.push("Parliament charts are written as doughnut charts of the seats: DrawingML has no parliament type.");
|
|
480
|
+
type = "donut";
|
|
481
|
+
} else if (family === "slope") {
|
|
482
|
+
issues.push("Slope charts are written as line charts with the two series as lines over the categories: DrawingML has no slope type.");
|
|
483
|
+
type = "line";
|
|
484
|
+
} else if (family === "likert") {
|
|
485
|
+
issues.push("Likert charts are written as 100% stacked horizontal bars: DrawingML has no diverging bar.");
|
|
486
|
+
spec = { ...spec, type: "bar", stacking: "percent", orientation: "horizontal" };
|
|
487
|
+
type = "bar";
|
|
445
488
|
}
|
|
446
489
|
const visible = spec.series.filter((s) => !s.hidden);
|
|
490
|
+
const annotations = [
|
|
491
|
+
spec.referenceLines.length || spec.referenceBands.length ? "reference lines and bands" : "",
|
|
492
|
+
spec.series.some((s) => s.callouts) ? "callouts" : "",
|
|
493
|
+
spec.highlight.length ? "the highlight" : "",
|
|
494
|
+
spec.note ? "the note" : ""
|
|
495
|
+
].filter(Boolean);
|
|
496
|
+
if (annotations.length) issues.push(`${annotations.join(", ").replace(/^./, (c) => c.toUpperCase())} ${annotations.length === 1 && !annotations[0].endsWith("s") ? "is" : "are"} not written: DrawingML has no equivalent.`);
|
|
447
497
|
if (visible.length < spec.series.length) issues.push(`${spec.series.length - visible.length} hidden series ${spec.series.length - visible.length === 1 ? "is" : "are"} left out.`);
|
|
448
498
|
const grouping = spec.stacking === "stacked" ? "stacked" : spec.stacking === "percent" ? "percentStacked" : "standard";
|
|
449
499
|
const ids = { cat: 500000001, val: 500000002, cat2: 500000003, val2: 500000004 };
|
|
450
500
|
const xy = family === "xy" || type === "scatter" || type === "bubble";
|
|
451
501
|
const pieLike = type === "pie" || type === "donut";
|
|
452
|
-
const typed = (s) => pieLike || type === "radar" ? type : type === "bubble" ? "bubble" : xy ? "scatter" :
|
|
502
|
+
const typed = (s) => pieLike || type === "radar" ? type : type === "bubble" ? "bubble" : xy ? "scatter" : _chunkR3P2M7HUcjs.chartSeriesType.call(void 0, { type }, s);
|
|
453
503
|
const groups = [];
|
|
454
504
|
visible.forEach((s) => {
|
|
455
505
|
const kind = typed(s);
|
|
@@ -512,6 +562,7 @@ function chartToOoxml(spec) {
|
|
|
512
562
|
return `<c:ser>${parts.join("")}</c:ser>`;
|
|
513
563
|
};
|
|
514
564
|
const dLbls = `<c:dLbls><c:showLegendKey val="0"/><c:showVal val="${spec.dataLabels ? 1 : 0}"/><c:showCatName val="0"/><c:showSerName val="0"/><c:showPercent val="0"/><c:showBubbleSize val="0"/></c:dLbls>`;
|
|
565
|
+
const vary = _chunkR3P2M7HUcjs.chartVariesColors.call(void 0, spec) ? 1 : 0;
|
|
515
566
|
const groupXml = groups.map((g) => {
|
|
516
567
|
const axes2 = g.secondary ? `<c:axId val="${ids.cat2}"/><c:axId val="${ids.val2}"/>` : `<c:axId val="${ids.cat}"/><c:axId val="${ids.val}"/>`;
|
|
517
568
|
const sers = g.series.map(({ s, index }) => serXml(g.kind, s, index)).join("");
|
|
@@ -521,14 +572,14 @@ function chartToOoxml(spec) {
|
|
|
521
572
|
const barsWidth = spec.stacking === "none" ? n - (n - 1) * spec.overlap : 1;
|
|
522
573
|
const gapPct = Math.round(Math.min(500, spec.gapWidth / Math.max(0.01, 1 - spec.gapWidth) * barsWidth * 100));
|
|
523
574
|
const overlapPct = spec.stacking === "none" ? Math.round(spec.overlap * 100) : 100;
|
|
524
|
-
return `<c:barChart><c:barDir val="${spec.orientation === "horizontal" ? "bar" : "col"}"/><c:grouping val="${spec.stacking === "none" ? "clustered" : grouping}"/><c:varyColors val="
|
|
575
|
+
return `<c:barChart><c:barDir val="${spec.orientation === "horizontal" ? "bar" : "col"}"/><c:grouping val="${spec.stacking === "none" ? "clustered" : grouping}"/><c:varyColors val="${vary}"/>${sers}${dLbls}<c:gapWidth val="${gapPct}"/><c:overlap val="${overlapPct}"/>${axes2}</c:barChart>`;
|
|
525
576
|
}
|
|
526
577
|
case "line":
|
|
527
|
-
return `<c:lineChart><c:grouping val="${spec.stacking === "none" ? "standard" : "standard"}"/><c:varyColors val="
|
|
578
|
+
return `<c:lineChart><c:grouping val="${spec.stacking === "none" ? "standard" : "standard"}"/><c:varyColors val="${vary}"/>${sers}${dLbls}<c:marker val="1"/>${axes2}</c:lineChart>`;
|
|
528
579
|
case "area":
|
|
529
|
-
return `<c:areaChart><c:grouping val="${grouping}"/><c:varyColors val="
|
|
580
|
+
return `<c:areaChart><c:grouping val="${grouping}"/><c:varyColors val="${vary}"/>${sers}${dLbls}${axes2}</c:areaChart>`;
|
|
530
581
|
case "scatter":
|
|
531
|
-
return `<c:scatterChart><c:scatterStyle val="lineMarker"/><c:varyColors val="
|
|
582
|
+
return `<c:scatterChart><c:scatterStyle val="lineMarker"/><c:varyColors val="${vary}"/>${sers}${dLbls}${axes2}</c:scatterChart>`;
|
|
532
583
|
case "bubble":
|
|
533
584
|
return `<c:bubbleChart><c:varyColors val="0"/>${sers}${dLbls}<c:bubbleScale val="100"/>${axes2}</c:bubbleChart>`;
|
|
534
585
|
case "radar":
|
|
@@ -563,7 +614,7 @@ function chartToOoxml(spec) {
|
|
|
563
614
|
const legend = spec.legend.show ? `<c:legend><c:legendPos val="${legendPos}"/><c:overlay val="0"/></c:legend>` : "";
|
|
564
615
|
const titleXml = spec.title ? `<c:title>${rich(spec.title)}</c:title><c:autoTitleDeleted val="0"/>` : '<c:autoTitleDeleted val="1"/>';
|
|
565
616
|
if (spec.subtitle) issues.push("The subtitle is left out: DrawingML charts have one title.");
|
|
566
|
-
if (family === "radar" && spec.series.some((s) => _optionalChain([s, 'access',
|
|
617
|
+
if (family === "radar" && spec.series.some((s) => _optionalChain([s, 'access', _39 => _39.trendlines, 'optionalAccess', _40 => _40.length]))) issues.push("Trendlines on a radar chart are left out.");
|
|
567
618
|
const xml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><c:chartSpace xmlns:c="${CHART_OOXML_NS}" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><c:roundedCorners val="0"/><c:chart>${titleXml}<c:plotArea><c:layout/>${groupXml.join("")}${axes}</c:plotArea>${legend}<c:plotVisOnly val="1"/><c:dispBlanksAs val="gap"/></c:chart><c:txPr><a:bodyPr/><a:lstStyle/><a:p><a:pPr><a:defRPr sz="${Math.round(10 * 100)}"/></a:pPr><a:endParaRPr lang="en-US"/></a:p></c:txPr></c:chartSpace>`;
|
|
568
619
|
return { xml, issues: [...new Set(issues)] };
|
|
569
620
|
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkGKNEJ6ENcjs = require('./chunk-GKNEJ6EN.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkSBQVEBSUcjs = require('./chunk-SBQVEBSU.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkR3P2M7HUcjs = require('./chunk-R3P2M7HU.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
@@ -1211,7 +1211,7 @@ var ChartNodeView = (_class = class {
|
|
|
1211
1211
|
this.dom.contentEditable = "false";
|
|
1212
1212
|
this.syncAttributes();
|
|
1213
1213
|
this.key = specKey(this.node.attrs.spec);
|
|
1214
|
-
this.controller = new (0,
|
|
1214
|
+
this.controller = new (0, _chunkGKNEJ6ENcjs.ChartController)({ spec: this.node.attrs.spec });
|
|
1215
1215
|
this.unsubscribe = this.controller.subscribe((state) => {
|
|
1216
1216
|
if (!state.gesture) this.writeBack();
|
|
1217
1217
|
});
|
|
@@ -1444,7 +1444,7 @@ function readSpec(value) {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
1447
|
-
return
|
|
1447
|
+
return _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, input).spec;
|
|
1448
1448
|
}
|
|
1449
1449
|
var readSize = (value) => {
|
|
1450
1450
|
const n = value === null ? NaN : Number(value);
|
|
@@ -1470,10 +1470,10 @@ function staticChartSvg(node, options) {
|
|
|
1470
1470
|
const spec = node.attrs.spec;
|
|
1471
1471
|
const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
|
|
1472
1472
|
const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
|
|
1473
|
-
const scene =
|
|
1474
|
-
return
|
|
1473
|
+
const scene = _chunkSBQVEBSUcjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
|
|
1474
|
+
return _chunkGKNEJ6ENcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1475
1475
|
ariaLabel: spec.title || "Chart",
|
|
1476
|
-
description:
|
|
1476
|
+
description: _chunkGKNEJ6ENcjs.describeChart.call(void 0, spec),
|
|
1477
1477
|
attrs: { style: "max-width: 100%; height: auto; display: block" }
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
@@ -1489,7 +1489,7 @@ var Chart = _core.Node.create({
|
|
|
1489
1489
|
return {
|
|
1490
1490
|
HTMLAttributes: {},
|
|
1491
1491
|
nodeView: null,
|
|
1492
|
-
theme:
|
|
1492
|
+
theme: _chunkR3P2M7HUcjs.DEFAULT_CHART_THEME,
|
|
1493
1493
|
defaultWidth: 640,
|
|
1494
1494
|
defaultHeight: 320,
|
|
1495
1495
|
generateId: () => generateStructureId("chart")
|
|
@@ -1503,7 +1503,7 @@ var Chart = _core.Node.create({
|
|
|
1503
1503
|
renderHTML: (attributes) => attributes.id ? { "data-chart-id": attributes.id } : {}
|
|
1504
1504
|
},
|
|
1505
1505
|
spec: {
|
|
1506
|
-
default:
|
|
1506
|
+
default: _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, {}).spec,
|
|
1507
1507
|
// null (no `data-chart`) keeps what the parse rule found, e.g. a mermaid block's spec.
|
|
1508
1508
|
parseHTML: (element) => readSpec(element.getAttribute("data-chart")),
|
|
1509
1509
|
renderHTML: (attributes) => ({
|
|
@@ -1541,7 +1541,7 @@ var Chart = _core.Node.create({
|
|
|
1541
1541
|
const code = element.querySelector("code");
|
|
1542
1542
|
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _34 => _34.getAttribute, 'call', _35 => _35("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1543
1543
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1544
|
-
const result =
|
|
1544
|
+
const result = _chunkGKNEJ6ENcjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1545
1545
|
return result.family ? { spec: result.spec } : false;
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
@@ -1565,7 +1565,7 @@ var Chart = _core.Node.create({
|
|
|
1565
1565
|
return {
|
|
1566
1566
|
markdown: {
|
|
1567
1567
|
serialize(state, node) {
|
|
1568
|
-
const text =
|
|
1568
|
+
const text = _chunkGKNEJ6ENcjs.chartToMermaid.call(void 0, node.attrs.spec);
|
|
1569
1569
|
const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
|
|
1570
1570
|
state.write(`${fence}mermaid
|
|
1571
1571
|
`);
|
|
@@ -1587,7 +1587,7 @@ var Chart = _core.Node.create({
|
|
|
1587
1587
|
type: this.name,
|
|
1588
1588
|
attrs: {
|
|
1589
1589
|
id: _nullishCoalesce(options.id, () => ( this.options.generateId())),
|
|
1590
|
-
spec:
|
|
1590
|
+
spec: _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {}))).spec,
|
|
1591
1591
|
width: _nullishCoalesce(options.width, () => ( null)),
|
|
1592
1592
|
height: _nullishCoalesce(options.height, () => ( this.options.defaultHeight))
|
|
1593
1593
|
}
|
|
@@ -1598,7 +1598,7 @@ var Chart = _core.Node.create({
|
|
|
1598
1598
|
if (dispatch) {
|
|
1599
1599
|
tr.setNodeMarkup(chart.pos, void 0, {
|
|
1600
1600
|
...chart.node.attrs,
|
|
1601
|
-
...changes.spec !== void 0 ? { spec:
|
|
1601
|
+
...changes.spec !== void 0 ? { spec: _chunkR3P2M7HUcjs.normalizeChartSpec.call(void 0, changes.spec).spec } : {},
|
|
1602
1602
|
...changes.width !== void 0 ? { width: changes.width } : {},
|
|
1603
1603
|
...changes.height !== void 0 ? { height: changes.height } : {}
|
|
1604
1604
|
});
|
|
@@ -1705,14 +1705,14 @@ var Sparkline = _core.Node.create({
|
|
|
1705
1705
|
return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
|
|
1706
1706
|
},
|
|
1707
1707
|
renderHTML({ node, HTMLAttributes }) {
|
|
1708
|
-
const scene =
|
|
1708
|
+
const scene = _chunkGKNEJ6ENcjs.layoutSparkline.call(void 0, node.attrs.values, {
|
|
1709
1709
|
kind: node.attrs.kind,
|
|
1710
1710
|
width: node.attrs.width,
|
|
1711
1711
|
height: node.attrs.height,
|
|
1712
1712
|
color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
|
|
1713
1713
|
negativeColor: this.options.negativeColor
|
|
1714
1714
|
});
|
|
1715
|
-
const svg =
|
|
1715
|
+
const svg = _chunkGKNEJ6ENcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1716
1716
|
ariaLabel: sparklineLabel(node),
|
|
1717
1717
|
attrs: { style: "display: inline-block; vertical-align: middle" }
|
|
1718
1718
|
});
|