@pixerate/editor 0.52.0 → 0.53.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 +23 -23
- package/dist/agent/index.js +4 -4
- package/dist/chart/index.cjs +174 -131
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +68 -21
- package/dist/chart/index.d.ts +68 -21
- package/dist/chart/index.js +64 -21
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-UAW5FEMD.js → chunk-3S72F46R.js} +66 -8
- package/dist/chunk-3S72F46R.js.map +1 -0
- package/dist/{chunk-5TWIN7ZJ.js → chunk-47WWV3LI.js} +34 -4
- package/dist/chunk-47WWV3LI.js.map +1 -0
- package/dist/{chunk-OV7UAKIY.js → chunk-633QC34G.js} +172 -1
- package/dist/chunk-633QC34G.js.map +1 -0
- package/dist/{chunk-5N6AQCVB.js → chunk-BQQZ6MOI.js} +3 -3
- package/dist/{chunk-M5Z77GFH.cjs → chunk-C3JHII3M.cjs} +53 -53
- package/dist/{chunk-M5Z77GFH.cjs.map → chunk-C3JHII3M.cjs.map} +1 -1
- package/dist/{chunk-JOX6MJW4.cjs → chunk-CKRNELPO.cjs} +176 -5
- package/dist/chunk-CKRNELPO.cjs.map +1 -0
- package/dist/{chunk-TGBCBQFV.cjs → chunk-DK6QBGCS.cjs} +45 -15
- package/dist/chunk-DK6QBGCS.cjs.map +1 -0
- package/dist/{chunk-GTZXF4BI.cjs → chunk-NK3WL5TJ.cjs} +298 -133
- package/dist/chunk-NK3WL5TJ.cjs.map +1 -0
- package/dist/{chunk-3ZBAXET6.cjs → chunk-NN3JGUSX.cjs} +80 -22
- package/dist/chunk-NN3JGUSX.cjs.map +1 -0
- package/dist/{chunk-YMKPMXZ4.js → chunk-OIKYP7XC.js} +4 -4
- package/dist/{chunk-FEMIVHN3.cjs → chunk-P43HUQRX.cjs} +16 -16
- package/dist/{chunk-FEMIVHN3.cjs.map → chunk-P43HUQRX.cjs.map} +1 -1
- package/dist/{chunk-QFTVLEVN.js → chunk-RIXTW3C4.js} +3 -3
- package/dist/{chunk-WBOAXDKD.js → chunk-VODBAO32.js} +222 -57
- package/dist/chunk-VODBAO32.js.map +1 -0
- package/dist/{chunk-2DEBI6KU.cjs → chunk-YZZMX6V7.cjs} +10 -10
- package/dist/{chunk-2DEBI6KU.cjs.map → chunk-YZZMX6V7.cjs.map} +1 -1
- package/dist/{controller-DS3drIvy.d.cts → controller-CX0QfSv0.d.cts} +53 -2
- package/dist/{controller-BdKzaxs2.d.ts → controller-DscWQbjO.d.ts} +53 -2
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +6 -6
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/extensions/index.js +5 -5
- package/dist/{index-Dt9lzydb.d.ts → index-CALDD35B.d.ts} +1 -1
- package/dist/{index-DOy9HzfC.d.cts → index-DIWB6xMf.d.cts} +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-3ZBAXET6.cjs.map +0 -1
- package/dist/chunk-5TWIN7ZJ.js.map +0 -1
- package/dist/chunk-GTZXF4BI.cjs.map +0 -1
- package/dist/chunk-JOX6MJW4.cjs.map +0 -1
- package/dist/chunk-OV7UAKIY.js.map +0 -1
- package/dist/chunk-TGBCBQFV.cjs.map +0 -1
- package/dist/chunk-UAW5FEMD.js.map +0 -1
- package/dist/chunk-WBOAXDKD.js.map +0 -1
- /package/dist/{chunk-5N6AQCVB.js.map → chunk-BQQZ6MOI.js.map} +0 -0
- /package/dist/{chunk-YMKPMXZ4.js.map → chunk-OIKYP7XC.js.map} +0 -0
- /package/dist/{chunk-QFTVLEVN.js.map → chunk-RIXTW3C4.js.map} +0 -0
package/dist/chart/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkDK6QBGCScjs = require('../chunk-DK6QBGCS.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ var _chunkTGBCBQFVcjs = require('../chunk-TGBCBQFV.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkNN3JGUSXcjs = require('../chunk-NN3JGUSX.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -72,10 +72,10 @@ var _chunk3ZBAXET6cjs = require('../chunk-3ZBAXET6.cjs');
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
var _chunkGTZXF4BIcjs = require('../chunk-GTZXF4BI.cjs');
|
|
76
75
|
|
|
77
76
|
|
|
78
77
|
|
|
78
|
+
var _chunkNK3WL5TJcjs = require('../chunk-NK3WL5TJ.cjs');
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
@@ -122,7 +122,21 @@ var _chunkGTZXF4BIcjs = require('../chunk-GTZXF4BI.cjs');
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
var _chunkCKRNELPOcjs = require('../chunk-CKRNELPO.cjs');
|
|
126
140
|
require('../chunk-XP5IUZUO.cjs');
|
|
127
141
|
|
|
128
142
|
|
|
@@ -237,7 +251,7 @@ function chartFileName(spec, extension) {
|
|
|
237
251
|
}
|
|
238
252
|
async function downloadChartPng(spec, options = {}) {
|
|
239
253
|
const { width = 800, height = 450, filename = chartFileName(spec, "png"), theme, ...raster } = options;
|
|
240
|
-
const svg =
|
|
254
|
+
const svg = _chunkNK3WL5TJcjs.chartToSvg.call(void 0, spec, { width, height, theme });
|
|
241
255
|
const { url, width: w, height: h } = await svgToPngDataUrl(svg, { ...raster, width, height });
|
|
242
256
|
const doc = _nullishCoalesce(raster.document, () => ( globalThis.document));
|
|
243
257
|
const link = doc.createElement("a");
|
|
@@ -252,7 +266,7 @@ async function downloadChartPng(spec, options = {}) {
|
|
|
252
266
|
|
|
253
267
|
// src/chart/recommend.ts
|
|
254
268
|
var blank = (c) => c === null || c === void 0 || String(c).trim() === "";
|
|
255
|
-
var isText = (c) => blank(c) ||
|
|
269
|
+
var isText = (c) => blank(c) || _chunkCKRNELPOcjs.parseChartValue.call(void 0, c) === void 0;
|
|
256
270
|
function analyzeChartTable(rows) {
|
|
257
271
|
const grid = rows.filter((r) => r.some((c) => !blank(c)));
|
|
258
272
|
const height = grid.length;
|
|
@@ -270,7 +284,7 @@ function analyzeChartTable(rows) {
|
|
|
270
284
|
let anyPositive = false;
|
|
271
285
|
for (let r = headerRow ? 1 : 0; r < height; r++)
|
|
272
286
|
for (let c = labelColumn ? 1 : 0; c < width; c++) {
|
|
273
|
-
const v =
|
|
287
|
+
const v = _chunkCKRNELPOcjs.parseChartValue.call(void 0, cell(r, c));
|
|
274
288
|
if (typeof v !== "number") continue;
|
|
275
289
|
anyNumber = true;
|
|
276
290
|
if (v < 0) {
|
|
@@ -279,7 +293,7 @@ function analyzeChartTable(rows) {
|
|
|
279
293
|
} else if (v > 0) anyPositive = true;
|
|
280
294
|
}
|
|
281
295
|
const labels = byRows ? _nullishCoalesce(_optionalChain([grid, 'access', _20 => _20[0], 'optionalAccess', _21 => _21.slice, 'call', _22 => _22(labelColumn ? 1 : 0)]), () => ( [])) : grid.slice(headerRow ? 1 : 0).map((r) => r[0]);
|
|
282
|
-
const dates = (byRows ? headerRow : labelColumn) && labels.length > 1 && labels.filter((l) => !blank(l) &&
|
|
296
|
+
const dates = (byRows ? headerRow : labelColumn) && labels.length > 1 && labels.filter((l) => !blank(l) && _chunkNK3WL5TJcjs.parseChartDate.call(void 0, String(l)) !== null).length >= labels.length * 0.8;
|
|
283
297
|
return {
|
|
284
298
|
headerRow,
|
|
285
299
|
labelColumn,
|
|
@@ -366,7 +380,7 @@ function chartFromTable(rows, options = {}) {
|
|
|
366
380
|
if (xFromFirst) {
|
|
367
381
|
table = table.map((r) => [r[1], ...r.slice(2)]);
|
|
368
382
|
}
|
|
369
|
-
const data =
|
|
383
|
+
const data = _chunkCKRNELPOcjs.chartDataFromTable.call(void 0, table, { seriesIn: shape.byRows ? "rows" : "columns", header: true, xFromFirstColumn: xFromFirst });
|
|
370
384
|
return { type, stacking, categories: data.categories, series: data.series, issues: data.issues, shape };
|
|
371
385
|
}
|
|
372
386
|
|
|
@@ -402,10 +416,10 @@ function createChartCommands(controller, options = {}) {
|
|
|
402
416
|
readOnly: true,
|
|
403
417
|
keywords: ["chart", "data", "spec", "get", "summary"],
|
|
404
418
|
description: "Returns the chart spec, its data as a table (series names in the header row) and a summary: per-series min / max / mean / trend, axes as drawn, layout warnings and a colour check.",
|
|
405
|
-
params: object({ width:
|
|
419
|
+
params: object({ width: _chunkDK6QBGCScjs.WIDTH, height: _chunkDK6QBGCScjs.HEIGHT }),
|
|
406
420
|
run: (_ctx, params = {}) => {
|
|
407
421
|
const spec = controller.getSpec();
|
|
408
|
-
return { spec: controller.toJSON(), table:
|
|
422
|
+
return { spec: controller.toJSON(), table: _chunkCKRNELPOcjs.chartDataToTable.call(void 0, spec), summary: _chunkNK3WL5TJcjs.summarizeChart.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _25 => _25.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _26 => _26.height]), () => ( 400)) }), issues: controller.getState().issues };
|
|
409
423
|
}
|
|
410
424
|
},
|
|
411
425
|
{
|
|
@@ -413,8 +427,8 @@ function createChartCommands(controller, options = {}) {
|
|
|
413
427
|
id: `${prefix}update`,
|
|
414
428
|
label: "Change Chart\u2026",
|
|
415
429
|
keywords: ["chart", "title", "axis", "legend", "stack", "style", "format", "type"],
|
|
416
|
-
description:
|
|
417
|
-
params: object(
|
|
430
|
+
description: 'Changes chart presentation as one undo step: type, titles, axes (xAxis = categories, yAxis = values, yAxis2 = secondary values; reverse, and scale "log" on value axes), legend, stacking, orientation, curve, points, data labels, palette, donut hole, bar spacing, histogram bins or waterfall total. Invalid values change nothing and return why.',
|
|
431
|
+
params: object(_chunkDK6QBGCScjs.CHART_UPDATE_PROPERTIES),
|
|
418
432
|
run: (_ctx, params) => {
|
|
419
433
|
check(controller.update(params));
|
|
420
434
|
return { spec: controller.toJSON() };
|
|
@@ -428,11 +442,11 @@ function createChartCommands(controller, options = {}) {
|
|
|
428
442
|
description: "Replaces the categories and series as one undo step. Each series has one value per category (padded with gaps).",
|
|
429
443
|
params: object({
|
|
430
444
|
categories: { type: "array", items: { type: "string" }, description: "Category labels in order." },
|
|
431
|
-
series: { type: "array", description: "The new series.", items: object({ id: { type: "string", description: "Stable id (optional)." }, ...
|
|
445
|
+
series: { type: "array", description: "The new series.", items: object({ id: { type: "string", description: "Stable id (optional)." }, ..._chunkDK6QBGCScjs.SERIES_PROPS }, ["name", "values"]) }
|
|
432
446
|
}),
|
|
433
447
|
run: (_ctx, params) => {
|
|
434
448
|
check(controller.setData(params));
|
|
435
|
-
return { table:
|
|
449
|
+
return { table: _chunkCKRNELPOcjs.chartDataToTable.call(void 0, controller.getSpec()) };
|
|
436
450
|
}
|
|
437
451
|
},
|
|
438
452
|
{
|
|
@@ -441,10 +455,10 @@ function createChartCommands(controller, options = {}) {
|
|
|
441
455
|
label: "Set Chart Values\u2026",
|
|
442
456
|
keywords: ["chart", "value", "cell", "edit"],
|
|
443
457
|
description: "Sets individual values as one undo step. Series by id or name; category by index or label.",
|
|
444
|
-
params: object({ cells: { type: "array", minItems: 1, description: "Values to set.", items: object({ series:
|
|
458
|
+
params: object({ cells: { type: "array", minItems: 1, description: "Values to set.", items: object({ series: _chunkDK6QBGCScjs.SERIES_REF, category: _chunkDK6QBGCScjs.CATEGORY_REF, value: _chunkDK6QBGCScjs.VALUE }, ["series", "category", "value"]) } }, ["cells"]),
|
|
445
459
|
run: (_ctx, params) => {
|
|
446
460
|
check(controller.setValues(params.cells.map((c) => ({ seriesId: resolveSeries(c.series).id, index: resolveCategory(c.category), value: c.value }))));
|
|
447
|
-
return { table:
|
|
461
|
+
return { table: _chunkCKRNELPOcjs.chartDataToTable.call(void 0, controller.getSpec()) };
|
|
448
462
|
}
|
|
449
463
|
},
|
|
450
464
|
{
|
|
@@ -453,7 +467,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
453
467
|
label: "Add Series",
|
|
454
468
|
keywords: ["chart", "series", "new"],
|
|
455
469
|
description: "Adds a series (default: an empty one at the end). Returns its id.",
|
|
456
|
-
params: object({ ...
|
|
470
|
+
params: object({ ..._chunkDK6QBGCScjs.SERIES_PROPS, id: { type: "string", description: "Id to use (default series-N)." }, at: { type: "integer", minimum: 0, description: "Position (default: last)." } }),
|
|
457
471
|
run: (_ctx, params = {}) => {
|
|
458
472
|
const { at, ...input } = _nullishCoalesce(params, () => ( {}));
|
|
459
473
|
const clean = Object.fromEntries(Object.entries(input).filter(([, v]) => v !== null));
|
|
@@ -467,8 +481,8 @@ function createChartCommands(controller, options = {}) {
|
|
|
467
481
|
id: `${prefix}updateSeries`,
|
|
468
482
|
label: "Change Series\u2026",
|
|
469
483
|
keywords: ["chart", "series", "rename", "colour", "color", "hide", "axis", "marker"],
|
|
470
|
-
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (null resets a field).",
|
|
471
|
-
params: object({ series:
|
|
484
|
+
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn, including error bars (null resets a field).",
|
|
485
|
+
params: object({ series: _chunkDK6QBGCScjs.SERIES_REF, ...Object.fromEntries(Object.entries(_chunkDK6QBGCScjs.SERIES_PROPS).filter(([k]) => k !== "values")) }, ["series"]),
|
|
472
486
|
run: (_ctx, params) => {
|
|
473
487
|
const { series, ...patch } = params;
|
|
474
488
|
const id = resolveSeries(series).id;
|
|
@@ -482,7 +496,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
482
496
|
label: "Delete Series",
|
|
483
497
|
keywords: ["chart", "series", "remove"],
|
|
484
498
|
description: "Deletes a series by id or name.",
|
|
485
|
-
params: object({ series:
|
|
499
|
+
params: object({ series: _chunkDK6QBGCScjs.SERIES_REF }, ["series"]),
|
|
486
500
|
run: (_ctx, params) => {
|
|
487
501
|
check(controller.removeSeries(resolveSeries(params.series).id));
|
|
488
502
|
return { series: seriesIds() };
|
|
@@ -503,7 +517,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
503
517
|
label: "Delete Category",
|
|
504
518
|
keywords: ["chart", "category", "row", "remove"],
|
|
505
519
|
description: "Deletes a category (and its values) by index or label.",
|
|
506
|
-
params: object({ category:
|
|
520
|
+
params: object({ category: _chunkDK6QBGCScjs.CATEGORY_REF }, ["category"]),
|
|
507
521
|
run: (_ctx, params) => {
|
|
508
522
|
check(controller.removeCategory(resolveCategory(params.category)));
|
|
509
523
|
return { categories: controller.getSpec().categories };
|
|
@@ -515,7 +529,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
515
529
|
label: "Add Trendline\u2026",
|
|
516
530
|
keywords: ["chart", "trend", "regression", "fit", "forecast", "moving average"],
|
|
517
531
|
description: "Fits a trendline to a series (linear, exponential, logarithmic, power, polynomial or moving average). Returns its index and the fit.",
|
|
518
|
-
params: object({ series:
|
|
532
|
+
params: object({ series: _chunkDK6QBGCScjs.SERIES_REF, ..._chunkDK6QBGCScjs.TRENDLINE_PROPS }, ["series", "type"]),
|
|
519
533
|
run: (_ctx, params) => {
|
|
520
534
|
const { series, ...line } = params;
|
|
521
535
|
const result = controller.addTrendline(resolveSeries(series).id, line);
|
|
@@ -530,7 +544,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
530
544
|
label: "Delete Trendline",
|
|
531
545
|
keywords: ["chart", "trend", "remove"],
|
|
532
546
|
description: "Deletes a trendline from a series.",
|
|
533
|
-
params: object({ series:
|
|
547
|
+
params: object({ series: _chunkDK6QBGCScjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index (0 = first)." } }, ["series", "index"]),
|
|
534
548
|
run: (_ctx, params) => {
|
|
535
549
|
check(controller.removeTrendline(resolveSeries(params.series).id, params.index));
|
|
536
550
|
return { trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _29 => _29.getSeries, 'call', _30 => _30(resolveSeries(params.series).id), 'optionalAccess', _31 => _31.trendlines]), () => ( [])) };
|
|
@@ -543,8 +557,8 @@ function createChartCommands(controller, options = {}) {
|
|
|
543
557
|
keywords: ["chart", "quick layout", "style", "colours", "colors", "monochrome", "theme"],
|
|
544
558
|
description: "Applies a quick layout and / or colour scheme as one undo step.",
|
|
545
559
|
params: object({
|
|
546
|
-
layout: { type: "string", enum:
|
|
547
|
-
colors: { type: "string", enum:
|
|
560
|
+
layout: { type: "string", enum: _chunkNK3WL5TJcjs.CHART_LAYOUT_PRESETS.map((p) => p.id), description: "Quick layout id." },
|
|
561
|
+
colors: { type: "string", enum: _chunkNK3WL5TJcjs.CHART_COLOR_SCHEMES.map((p) => p.id), description: "Colour scheme id." }
|
|
548
562
|
}),
|
|
549
563
|
run: (_ctx, params = {}) => {
|
|
550
564
|
check(controller.applyPreset(_nullishCoalesce(params, () => ( {}))));
|
|
@@ -559,7 +573,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
559
573
|
description: "Swaps series and categories as one undo step.",
|
|
560
574
|
run: () => {
|
|
561
575
|
check(controller.transpose());
|
|
562
|
-
return { table:
|
|
576
|
+
return { table: _chunkCKRNELPOcjs.chartDataToTable.call(void 0, controller.getSpec()) };
|
|
563
577
|
}
|
|
564
578
|
},
|
|
565
579
|
{
|
|
@@ -579,7 +593,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
579
593
|
run: (_ctx, params) => {
|
|
580
594
|
const result = controller.importCsv(params.csv, { seriesIn: params.seriesIn, header: params.header });
|
|
581
595
|
check(result);
|
|
582
|
-
return { table:
|
|
596
|
+
return { table: _chunkCKRNELPOcjs.chartDataToTable.call(void 0, controller.getSpec()), issues: _nullishCoalesce(result.issues, () => ( [])) };
|
|
583
597
|
}
|
|
584
598
|
},
|
|
585
599
|
{
|
|
@@ -590,7 +604,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
590
604
|
description: "Replaces the chart with Mermaid xychart-beta, pie or radar-beta text (one undo step). Unreadable lines are listed with line numbers.",
|
|
591
605
|
params: object({ mermaid: { type: "string", description: "Mermaid text." } }, ["mermaid"]),
|
|
592
606
|
run: (_ctx, params) => {
|
|
593
|
-
const read =
|
|
607
|
+
const read = _chunkNK3WL5TJcjs.chartFromMermaid.call(void 0, params.mermaid);
|
|
594
608
|
if (!read.family) fail(read.issues.map((i) => i.message).join(" ") || "Expected Mermaid starting with xychart-beta, pie or radar-beta.");
|
|
595
609
|
check(controller.update({ ...read.spec }, { label: "Import Mermaid chart" }));
|
|
596
610
|
return { spec: controller.toJSON(), issues: read.issues };
|
|
@@ -604,7 +618,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
604
618
|
keywords: ["chart", "mermaid", "markdown", "export"],
|
|
605
619
|
description: "Returns the chart as Mermaid text (with a round-trip comment unless meta is false).",
|
|
606
620
|
params: object({ meta: { type: "boolean", description: "Include the %% @pixerate round-trip comment (default true)." } }),
|
|
607
|
-
run: (_ctx, params = {}) => ({ mermaid:
|
|
621
|
+
run: (_ctx, params = {}) => ({ mermaid: _chunkNK3WL5TJcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta: _optionalChain([params, 'optionalAccess', _32 => _32.meta]) }) })
|
|
608
622
|
},
|
|
609
623
|
{
|
|
610
624
|
...base,
|
|
@@ -613,7 +627,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
613
627
|
readOnly: true,
|
|
614
628
|
keywords: ["chart", "office", "word", "powerpoint", "docx", "pptx", "xml", "export"],
|
|
615
629
|
description: "Returns the chart as a DrawingML chart part (c:chartSpace) and what could not be written.",
|
|
616
|
-
run: () =>
|
|
630
|
+
run: () => _chunkNN3JGUSXcjs.chartToOoxml.call(void 0, controller.toJSON())
|
|
617
631
|
},
|
|
618
632
|
{
|
|
619
633
|
...base,
|
|
@@ -622,9 +636,9 @@ function createChartCommands(controller, options = {}) {
|
|
|
622
636
|
readOnly: true,
|
|
623
637
|
keywords: ["chart", "svg", "export", "image"],
|
|
624
638
|
description: "Returns the chart drawn as a standalone, accessible SVG string (with <title> and <desc>).",
|
|
625
|
-
params: object({ width:
|
|
639
|
+
params: object({ width: _chunkDK6QBGCScjs.WIDTH, height: _chunkDK6QBGCScjs.HEIGHT }),
|
|
626
640
|
run: (_ctx, params = {}) => ({
|
|
627
|
-
svg:
|
|
641
|
+
svg: _chunkNK3WL5TJcjs.chartToSvg.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _33 => _33.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _34 => _34.height]), () => ( 400)) })
|
|
628
642
|
})
|
|
629
643
|
},
|
|
630
644
|
{
|
|
@@ -636,7 +650,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
636
650
|
description: "Suggests chart types for the current data (or CSV), best first, each with a reason.",
|
|
637
651
|
params: object({ csv: { type: "string", description: "CSV text to analyse instead of the current data." } }),
|
|
638
652
|
run: (_ctx, params = {}) => ({
|
|
639
|
-
recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess', _35 => _35.csv]) !== void 0 ? _chunkTNNJXF46cjs.parseCsv.call(void 0, params.csv) :
|
|
653
|
+
recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess', _35 => _35.csv]) !== void 0 ? _chunkTNNJXF46cjs.parseCsv.call(void 0, params.csv) : _chunkCKRNELPOcjs.chartDataToTable.call(void 0, controller.getSpec()))
|
|
640
654
|
})
|
|
641
655
|
},
|
|
642
656
|
{
|
|
@@ -649,8 +663,8 @@ function createChartCommands(controller, options = {}) {
|
|
|
649
663
|
run: () => {
|
|
650
664
|
const s = controller.getSpec();
|
|
651
665
|
const visible = s.series.filter((x) => !x.hidden);
|
|
652
|
-
const colors =
|
|
653
|
-
return { colors, ...
|
|
666
|
+
const colors = _chunkCKRNELPOcjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _36 => _36[0], 'optionalAccess', _37 => _37.pointColors, 'optionalAccess', _38 => _38[i]]) || _chunkCKRNELPOcjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
|
|
667
|
+
return { colors, ..._chunkCKRNELPOcjs.checkChartColors.call(void 0, colors) };
|
|
654
668
|
}
|
|
655
669
|
},
|
|
656
670
|
{
|
|
@@ -681,7 +695,7 @@ function chartClientToScene(scene, box, clientX, clientY) {
|
|
|
681
695
|
function canDragChartPoint(controller, scene, target) {
|
|
682
696
|
if (_optionalChain([target, 'optionalAccess', _39 => _39.kind]) !== "point" || !scene.valueScale || scene.percent) return false;
|
|
683
697
|
const spec = controller.getSpec();
|
|
684
|
-
const family =
|
|
698
|
+
const family = _chunkCKRNELPOcjs.chartFamily.call(void 0, spec);
|
|
685
699
|
if (family !== "cartesian" && family !== "xy" && family !== "waterfall") return false;
|
|
686
700
|
const series = controller.getSeries(target.seriesId);
|
|
687
701
|
return !!series && !series.hidden && series.values[target.index] !== null;
|
|
@@ -690,13 +704,14 @@ function snapChartDragValue(scene, value, options = {}) {
|
|
|
690
704
|
const scale = _nullishCoalesce(options.scale, () => ( scene.valueScale));
|
|
691
705
|
const tolerance = _nullishCoalesce(options.tolerancePx, () => ( 6));
|
|
692
706
|
if (scale) {
|
|
693
|
-
const px = (v) =>
|
|
707
|
+
const px = (v) => _chunkNK3WL5TJcjs.chartScaleToPixel.call(void 0, v, scale);
|
|
694
708
|
const at = px(value);
|
|
695
709
|
let best = null;
|
|
696
710
|
let bestDist = tolerance;
|
|
697
711
|
for (const c of [..._nullishCoalesce(options.candidates, () => ( [])), ...scale.ticks]) {
|
|
698
712
|
if (!Number.isFinite(c)) continue;
|
|
699
713
|
const d = Math.abs(px(c) - at);
|
|
714
|
+
if (!Number.isFinite(d)) continue;
|
|
700
715
|
if (d <= bestDist) {
|
|
701
716
|
best = c;
|
|
702
717
|
bestDist = d;
|
|
@@ -704,7 +719,7 @@ function snapChartDragValue(scene, value, options = {}) {
|
|
|
704
719
|
}
|
|
705
720
|
if (best !== null) return best;
|
|
706
721
|
}
|
|
707
|
-
return
|
|
722
|
+
return _chunkNK3WL5TJcjs.snapChartValue.call(void 0, scene, value, options.step, _optionalChain([scale, 'optionalAccess', _40 => _40.ticks]), _optionalChain([scale, 'optionalAccess', _41 => _41.logBase]));
|
|
708
723
|
}
|
|
709
724
|
function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
710
725
|
if (!canDragChartPoint(controller, scene, target)) return null;
|
|
@@ -713,11 +728,11 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
713
728
|
const series = controller.getSeries(seriesId);
|
|
714
729
|
const secondary = series.axis === "secondary" && !!scene.valueScale2;
|
|
715
730
|
const scale = secondary ? scene.valueScale2 : scene.valueScale;
|
|
716
|
-
const xy =
|
|
731
|
+
const xy = _chunkCKRNELPOcjs.chartFamily.call(void 0, spec) === "xy" && !!scene.xScale;
|
|
717
732
|
const startValue = _nullishCoalesce(series.values[index], () => ( 0));
|
|
718
|
-
const startX = _nullishCoalesce(_optionalChain([series, 'access',
|
|
719
|
-
const startAt =
|
|
720
|
-
const startAtX = xy ?
|
|
733
|
+
const startX = _nullishCoalesce(_optionalChain([series, 'access', _42 => _42.x, 'optionalAccess', _43 => _43[index]]), () => ( null));
|
|
734
|
+
const startAt = _chunkNK3WL5TJcjs.chartValueAtPoint.call(void 0, scene, start, secondary);
|
|
735
|
+
const startAtX = xy ? _chunkNK3WL5TJcjs.chartXAtPoint.call(void 0, scene, start) : void 0;
|
|
721
736
|
if (startAt === void 0) return null;
|
|
722
737
|
const candidates = [0, startValue];
|
|
723
738
|
if (!xy) {
|
|
@@ -735,34 +750,38 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
735
750
|
target: { seriesId, index },
|
|
736
751
|
move(point, moveOptions = {}) {
|
|
737
752
|
if (ended) return;
|
|
738
|
-
const at =
|
|
753
|
+
const at = _chunkNK3WL5TJcjs.chartValueAtPoint.call(void 0, scene, point, secondary);
|
|
739
754
|
if (at === void 0) return;
|
|
740
755
|
const factor = moveOptions.fine ? 0.1 : 1;
|
|
741
|
-
|
|
742
|
-
let
|
|
756
|
+
const moved = (from, to, s, value) => s.logBase && value > 0 && from > 0 && to > 0 ? value * Math.pow(to / from, factor) : value + (to - from) * factor;
|
|
757
|
+
let moveY = true;
|
|
758
|
+
let moveX = false;
|
|
759
|
+
let atX;
|
|
743
760
|
if (xy && startX !== null && startAtX !== void 0) {
|
|
744
|
-
|
|
745
|
-
|
|
761
|
+
atX = _chunkNK3WL5TJcjs.chartXAtPoint.call(void 0, scene, point);
|
|
762
|
+
moveX = atX !== void 0;
|
|
746
763
|
if (moveOptions.lockAxis) {
|
|
747
|
-
if (Math.abs(point.x - start.x) >= Math.abs(point.y - start.y))
|
|
748
|
-
else
|
|
764
|
+
if (Math.abs(point.x - start.x) >= Math.abs(point.y - start.y)) moveY = false;
|
|
765
|
+
else moveX = false;
|
|
749
766
|
}
|
|
750
767
|
}
|
|
751
768
|
const snap = (v, s, c) => {
|
|
752
769
|
if (moveOptions.noSnap) return Number(v.toPrecision(12));
|
|
753
770
|
if (moveOptions.fine) {
|
|
771
|
+
if (s.logBase && !options.step) return v > 0 ? Number(v.toPrecision(3)) : v;
|
|
754
772
|
const unit = options.step ? options.step / 10 : s.ticks.length > 1 ? (s.ticks[1] - s.ticks[0]) / 100 : void 0;
|
|
755
|
-
return
|
|
773
|
+
return _chunkNK3WL5TJcjs.snapChartValue.call(void 0, scene, v, unit, s.ticks);
|
|
756
774
|
}
|
|
757
775
|
return snapChartDragValue(scene, v, { candidates: c, tolerancePx: options.tolerancePx, step: options.step, scale: s });
|
|
758
776
|
};
|
|
759
|
-
const y = snap(
|
|
777
|
+
const y = moveY ? snap(moved(startAt, at, scale, startValue), scale, candidates) : startValue;
|
|
760
778
|
if (xy && startX !== null) {
|
|
761
|
-
const
|
|
779
|
+
const nextX = moveX ? moved(startAtX, atX, scene.xScale, startX) : startX;
|
|
780
|
+
const x = nextX !== startX ? snap(nextX, scene.xScale, [0, startX]) : startX;
|
|
762
781
|
const xs = [..._nullishCoalesce(series.x, () => ( []))];
|
|
763
782
|
xs[index] = x;
|
|
764
783
|
controller.setValue(seriesId, index, y, { label });
|
|
765
|
-
if (x !== _optionalChain([controller, 'access',
|
|
784
|
+
if (x !== _optionalChain([controller, 'access', _44 => _44.getSeries, 'call', _45 => _45(seriesId), 'optionalAccess', _46 => _46.x, 'optionalAccess', _47 => _47[index]])) controller.updateSeries(seriesId, { x: xs });
|
|
766
785
|
} else controller.setValue(seriesId, index, y, { label });
|
|
767
786
|
},
|
|
768
787
|
end() {
|
|
@@ -796,7 +815,7 @@ function handleChartKey(controller, scene, event) {
|
|
|
796
815
|
return true;
|
|
797
816
|
case "ArrowLeft":
|
|
798
817
|
case "ArrowRight": {
|
|
799
|
-
if (event.altKey || _optionalChain([selection, 'optionalAccess',
|
|
818
|
+
if (event.altKey || _optionalChain([selection, 'optionalAccess', _48 => _48.kind]) !== "point" && _optionalChain([selection, 'optionalAccess', _49 => _49.kind]) !== "category") return false;
|
|
800
819
|
const n = spec.categories.length;
|
|
801
820
|
const index = Math.max(0, Math.min(n - 1, selection.index + (event.key === "ArrowRight" ? 1 : -1)));
|
|
802
821
|
controller.select({ ...selection, index });
|
|
@@ -804,12 +823,22 @@ function handleChartKey(controller, scene, event) {
|
|
|
804
823
|
}
|
|
805
824
|
case "ArrowUp":
|
|
806
825
|
case "ArrowDown": {
|
|
807
|
-
if (_optionalChain([selection, 'optionalAccess',
|
|
808
|
-
const
|
|
809
|
-
const
|
|
826
|
+
if (_optionalChain([selection, 'optionalAccess', _50 => _50.kind]) !== "point" || _optionalChain([scene, 'optionalAccess', _51 => _51.percent])) return false;
|
|
827
|
+
const series = controller.getSeries(selection.seriesId);
|
|
828
|
+
const secondary = _optionalChain([series, 'optionalAccess', _52 => _52.axis]) === "secondary";
|
|
829
|
+
const scale = _nullishCoalesce((secondary ? _optionalChain([scene, 'optionalAccess', _53 => _53.valueScale2]) : null), () => ( _optionalChain([scene, 'optionalAccess', _54 => _54.valueScale])));
|
|
830
|
+
const ticks = _nullishCoalesce(_optionalChain([scale, 'optionalAccess', _55 => _55.ticks]), () => ( []));
|
|
831
|
+
const up = event.key === "ArrowUp";
|
|
832
|
+
const current = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _56 => _56.values, 'access', _57 => _57[selection.index]]), () => ( null));
|
|
833
|
+
if (_optionalChain([scale, 'optionalAccess', _58 => _58.logBase]) && current !== null && current > 0) {
|
|
834
|
+
const power = event.shiftKey ? 1 : event.altKey ? 0.01 : 0.1;
|
|
835
|
+
const next = Number((current * Math.pow(scale.logBase, up ? power : -power)).toPrecision(event.altKey ? 4 : 3));
|
|
836
|
+
controller.nudgeValue(selection.seriesId, selection.index, next - current);
|
|
837
|
+
return true;
|
|
838
|
+
}
|
|
810
839
|
const step = ticks.length > 1 ? ticks[1] - ticks[0] : 1;
|
|
811
840
|
const amount = event.shiftKey ? step : event.altKey ? step / 100 : step / 10;
|
|
812
|
-
controller.nudgeValue(selection.seriesId, selection.index, amount * (
|
|
841
|
+
controller.nudgeValue(selection.seriesId, selection.index, amount * (up ? 1 : -1));
|
|
813
842
|
return true;
|
|
814
843
|
}
|
|
815
844
|
default:
|
|
@@ -829,22 +858,22 @@ function describeChartSelection(controller, selection = controller.getState().se
|
|
|
829
858
|
case "legend":
|
|
830
859
|
return "Legend";
|
|
831
860
|
case "axis":
|
|
832
|
-
return selection.axis === "x" ?
|
|
861
|
+
return selection.axis === "x" ? _chunkCKRNELPOcjs.chartFamily.call(void 0, spec) === "xy" ? "X axis" : "Category axis" : selection.axis === "y" ? "Value axis" : "Secondary value axis";
|
|
833
862
|
case "series":
|
|
834
|
-
return `Series "${_nullishCoalesce(_optionalChain([controller, 'access',
|
|
863
|
+
return `Series "${_nullishCoalesce(_optionalChain([controller, 'access', _59 => _59.getSeries, 'call', _60 => _60(selection.seriesId), 'optionalAccess', _61 => _61.name]), () => ( selection.seriesId))}"`;
|
|
835
864
|
case "category":
|
|
836
865
|
return `Category "${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}"`;
|
|
837
866
|
case "trendline": {
|
|
838
867
|
const series = controller.getSeries(selection.seriesId);
|
|
839
|
-
const line = _optionalChain([series, 'optionalAccess',
|
|
840
|
-
return `${line ? line.type.replace("-", " ") : "Trendline"} trendline on "${_nullishCoalesce(_optionalChain([series, 'optionalAccess',
|
|
868
|
+
const line = _optionalChain([series, 'optionalAccess', _62 => _62.trendlines, 'optionalAccess', _63 => _63[selection.index]]);
|
|
869
|
+
return `${line ? line.type.replace("-", " ") : "Trendline"} trendline on "${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _64 => _64.name]), () => ( selection.seriesId))}"`;
|
|
841
870
|
}
|
|
842
871
|
case "point": {
|
|
843
872
|
const series = controller.getSeries(selection.seriesId);
|
|
844
|
-
const value = _optionalChain([series, 'optionalAccess',
|
|
845
|
-
const x = _optionalChain([series, 'optionalAccess',
|
|
846
|
-
if (x !== void 0 && x !== null &&
|
|
847
|
-
return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess',
|
|
873
|
+
const value = _optionalChain([series, 'optionalAccess', _65 => _65.values, 'access', _66 => _66[selection.index]]);
|
|
874
|
+
const x = _optionalChain([series, 'optionalAccess', _67 => _67.x, 'optionalAccess', _68 => _68[selection.index]]);
|
|
875
|
+
if (x !== void 0 && x !== null && _chunkCKRNELPOcjs.chartFamily.call(void 0, spec) === "xy") return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _69 => _69.name]), () => ( selection.seriesId))}: (${x}, ${_nullishCoalesce(value, () => ( "blank"))})`;
|
|
876
|
+
return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _70 => _70.name]), () => ( selection.seriesId))} \xB7 ${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}: ${_nullishCoalesce(value, () => ( "blank"))}`;
|
|
848
877
|
}
|
|
849
878
|
}
|
|
850
879
|
}
|
|
@@ -917,13 +946,13 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
917
946
|
fail2(`There is no category ${JSON.stringify(ref)}; expected an index from 0 to ${categories.length - 1} or one of ${categories.slice(0, 20).map((c) => JSON.stringify(c)).join(", ")}.`);
|
|
918
947
|
return index;
|
|
919
948
|
};
|
|
920
|
-
const table = () =>
|
|
949
|
+
const table = () => _chunkCKRNELPOcjs.chartDataToTable.call(void 0, spec());
|
|
921
950
|
const Parser = () => _nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser));
|
|
922
951
|
const getChart = {
|
|
923
952
|
name: "get_chart",
|
|
924
953
|
title: "Read the chart",
|
|
925
954
|
description: "Returns the chart spec (type, titles, axes, legend, series with ids and settings), its data as a table (header row of series names, then one row per category), the current selection, and a summary at the given size: per-series min / max / mean / trend, the axes as drawn, layout warnings (hidden labels, thinned lines), a colour check and a plain-language description. Use the series ids and category indexes it returns with the write tools.",
|
|
926
|
-
inputSchema: { type: "object", properties: { width:
|
|
955
|
+
inputSchema: { type: "object", properties: { width: _chunkDK6QBGCScjs.WIDTH, height: _chunkDK6QBGCScjs.HEIGHT }, additionalProperties: false },
|
|
927
956
|
annotations: { title: "Read the chart", ...READ },
|
|
928
957
|
handler: ({ width = size.width, height = size.height }) => {
|
|
929
958
|
const reason = readOnlyReason();
|
|
@@ -931,7 +960,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
931
960
|
spec: controller.toJSON(),
|
|
932
961
|
table: table(),
|
|
933
962
|
selection: controller.getState().selection,
|
|
934
|
-
summary:
|
|
963
|
+
summary: _chunkNK3WL5TJcjs.summarizeChart.call(void 0, controller.toJSON(), { width, height }),
|
|
935
964
|
issues: controller.getState().issues,
|
|
936
965
|
...reason ? { readOnly: reason } : {}
|
|
937
966
|
};
|
|
@@ -944,8 +973,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
944
973
|
inputSchema: {
|
|
945
974
|
type: "object",
|
|
946
975
|
properties: {
|
|
947
|
-
width:
|
|
948
|
-
height:
|
|
976
|
+
width: _chunkDK6QBGCScjs.WIDTH,
|
|
977
|
+
height: _chunkDK6QBGCScjs.HEIGHT,
|
|
949
978
|
format: { type: "string", enum: ["svg", "png"], description: "svg (default): the SVG document as text. png: an image to look at (only when the host can rasterize; costs image tokens)." }
|
|
950
979
|
},
|
|
951
980
|
additionalProperties: false
|
|
@@ -953,8 +982,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
953
982
|
annotations: { title: "Render the chart", ...READ },
|
|
954
983
|
handler: async ({ width = size.width, height = size.height, format = "svg" }) => {
|
|
955
984
|
const json = controller.toJSON();
|
|
956
|
-
const scene =
|
|
957
|
-
const svg =
|
|
985
|
+
const scene = _chunkNK3WL5TJcjs.layoutChart.call(void 0, json, { width, height, selection: null });
|
|
986
|
+
const svg = _chunkNK3WL5TJcjs.chartSceneToSvg.call(void 0, scene, { ariaLabel: json.title || void 0, description: _chunkNK3WL5TJcjs.describeChart.call(void 0, json) });
|
|
958
987
|
const warnings = scene.warnings;
|
|
959
988
|
if (format === "png") {
|
|
960
989
|
if (!options.rasterize) fail2('This host cannot rasterize charts; call render_chart with format "svg", or get_chart for the layout warnings.');
|
|
@@ -988,8 +1017,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
988
1017
|
handler: ({ colors, surface }) => {
|
|
989
1018
|
const s = spec();
|
|
990
1019
|
const visible = s.series.filter((x) => !x.hidden);
|
|
991
|
-
const own =
|
|
992
|
-
return { colors: _nullishCoalesce(colors, () => ( own)), ...
|
|
1020
|
+
const own = _chunkCKRNELPOcjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _71 => _71[0], 'optionalAccess', _72 => _72.pointColors, 'optionalAccess', _73 => _73[i]]) || _chunkCKRNELPOcjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
|
|
1021
|
+
return { colors: _nullishCoalesce(colors, () => ( own)), ..._chunkCKRNELPOcjs.checkChartColors.call(void 0, _nullishCoalesce(colors, () => ( own)), { surface }) };
|
|
993
1022
|
}
|
|
994
1023
|
};
|
|
995
1024
|
const recommend = {
|
|
@@ -1011,15 +1040,15 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1011
1040
|
description: "Returns a trendline's fitted coefficients (in x for category charts, x = 1, 2, 3, \u2026), R\xB2, equation and the number of points, or the moving-average points.",
|
|
1012
1041
|
inputSchema: {
|
|
1013
1042
|
type: "object",
|
|
1014
|
-
properties: { series:
|
|
1043
|
+
properties: { series: _chunkDK6QBGCScjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index on the series (0 = first)." } },
|
|
1015
1044
|
required: ["series", "index"],
|
|
1016
1045
|
additionalProperties: false
|
|
1017
1046
|
},
|
|
1018
1047
|
annotations: { title: "Read a trendline fit", ...READ },
|
|
1019
1048
|
handler: ({ series, index }) => {
|
|
1020
1049
|
const s = seriesById(series);
|
|
1021
|
-
const line = _optionalChain([s, 'access',
|
|
1022
|
-
if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access',
|
|
1050
|
+
const line = _optionalChain([s, 'access', _74 => _74.trendlines, 'optionalAccess', _75 => _75[index]]);
|
|
1051
|
+
if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access', _76 => _76.trendlines, 'optionalAccess', _77 => _77.length]), () => ( 0))}.`);
|
|
1023
1052
|
if (line.type === "moving-average") return { trendline: line, points: controller.trendlineMovingAverage(s.id, index) };
|
|
1024
1053
|
const fit = controller.trendlineFit(s.id, index);
|
|
1025
1054
|
if (!fit) fail2(`The ${line.type} trendline on "${s.name}" cannot be fitted: it needs more points (and positive values for log, exponential and power fits).`);
|
|
@@ -1033,8 +1062,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1033
1062
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
1034
1063
|
annotations: { title: "List chart presets", ...READ },
|
|
1035
1064
|
handler: () => ({
|
|
1036
|
-
layouts:
|
|
1037
|
-
colorSchemes:
|
|
1065
|
+
layouts: _chunkNK3WL5TJcjs.CHART_LAYOUT_PRESETS.map(({ id, label, description }) => ({ id, label, description })),
|
|
1066
|
+
colorSchemes: _chunkNK3WL5TJcjs.CHART_COLOR_SCHEMES.map(({ id, label, description, palette }) => ({ id, label, description, palette }))
|
|
1038
1067
|
})
|
|
1039
1068
|
};
|
|
1040
1069
|
const exportMermaid = {
|
|
@@ -1043,7 +1072,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1043
1072
|
description: 'Returns the chart as Mermaid text (xychart-beta, pie or radar-beta) for Markdown or chat. With meta (default true) one "%% @pixerate {\u2026}" comment keeps what Mermaid cannot express, so import_chart_mermaid gets the chart back exactly.',
|
|
1044
1073
|
inputSchema: { type: "object", properties: { meta: { type: "boolean", description: "Include the round-trip comment (default true)." } }, additionalProperties: false },
|
|
1045
1074
|
annotations: { title: "Export chart as Mermaid", ...READ },
|
|
1046
|
-
handler: ({ meta = true }) => ({ mermaid:
|
|
1075
|
+
handler: ({ meta = true }) => ({ mermaid: _chunkNK3WL5TJcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta }) })
|
|
1047
1076
|
};
|
|
1048
1077
|
const exportOoxml = {
|
|
1049
1078
|
name: "export_chart_ooxml",
|
|
@@ -1051,15 +1080,15 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1051
1080
|
description: "Returns the chart as a DrawingML chart part (c:chartSpace) for Word or PowerPoint files, with what could not be written as sentences.",
|
|
1052
1081
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
1053
1082
|
annotations: { title: "Export chart as Office XML", ...READ },
|
|
1054
|
-
handler: () =>
|
|
1083
|
+
handler: () => _chunkNN3JGUSXcjs.chartToOoxml.call(void 0, controller.toJSON())
|
|
1055
1084
|
};
|
|
1056
1085
|
const updateChart = {
|
|
1057
1086
|
name: "update_chart",
|
|
1058
1087
|
title: "Change chart presentation",
|
|
1059
|
-
description:
|
|
1088
|
+
description: 'Changes how the chart looks, as one undo step: type, titles, axes (xAxis = categories or numeric x, yAxis = values, yAxis2 = secondary values; each can be reversed, and value axes can be logarithmic with scale "log"), legend, stacking, orientation, curve, points, data labels and their position, palette, donut hole, bar spacing, histogram bins, waterfall total. All-or-nothing: invalid values change nothing and come back as sentences. Returns the new spec.',
|
|
1060
1089
|
inputSchema: {
|
|
1061
1090
|
type: "object",
|
|
1062
|
-
properties:
|
|
1091
|
+
properties: _chunkDK6QBGCScjs.CHART_UPDATE_PROPERTIES,
|
|
1063
1092
|
additionalProperties: false
|
|
1064
1093
|
},
|
|
1065
1094
|
annotations: { title: "Change chart presentation", ...WRITE_IDEMPOTENT },
|
|
@@ -1080,7 +1109,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1080
1109
|
series: {
|
|
1081
1110
|
type: "array",
|
|
1082
1111
|
description: "The new series (replaces all).",
|
|
1083
|
-
items: { type: "object", properties: { id: { type: "string", description: "Stable id (optional)." }, ...
|
|
1112
|
+
items: { type: "object", properties: { id: { type: "string", description: "Stable id (optional)." }, ..._chunkDK6QBGCScjs.SERIES_PROPS }, required: ["name", "values"], additionalProperties: false }
|
|
1084
1113
|
}
|
|
1085
1114
|
},
|
|
1086
1115
|
additionalProperties: false
|
|
@@ -1103,7 +1132,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1103
1132
|
type: "array",
|
|
1104
1133
|
minItems: 1,
|
|
1105
1134
|
description: "Values to set.",
|
|
1106
|
-
items: { type: "object", properties: { series:
|
|
1135
|
+
items: { type: "object", properties: { series: _chunkDK6QBGCScjs.SERIES_REF, category: _chunkDK6QBGCScjs.CATEGORY_REF, value: _chunkDK6QBGCScjs.VALUE }, required: ["series", "category", "value"], additionalProperties: false }
|
|
1107
1136
|
}
|
|
1108
1137
|
},
|
|
1109
1138
|
required: ["cells"],
|
|
@@ -1112,7 +1141,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1112
1141
|
annotations: { title: "Set chart values", ...WRITE_IDEMPOTENT },
|
|
1113
1142
|
handler: async ({ cells }) => {
|
|
1114
1143
|
const resolved = cells.map((c) => ({ seriesId: seriesById(c.series).id, index: categoryIndex(c.category), value: c.value }));
|
|
1115
|
-
const parsed = resolved.map((c) =>
|
|
1144
|
+
const parsed = resolved.map((c) => _chunkCKRNELPOcjs.parseChartValue.call(void 0, c.value));
|
|
1116
1145
|
const bad = resolved.find((_, i) => parsed[i] === void 0);
|
|
1117
1146
|
if (bad) fail2(`"${String(bad.value)}" is not a number; pass a number, numeric text or null for a gap. Nothing was changed.`);
|
|
1118
1147
|
if (options.director && parsed.every((v) => typeof v === "number")) {
|
|
@@ -1129,7 +1158,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1129
1158
|
description: "Adds a series (values padded to the categories) and selects it. Returns its id and stored values.",
|
|
1130
1159
|
inputSchema: {
|
|
1131
1160
|
type: "object",
|
|
1132
|
-
properties: { ...
|
|
1161
|
+
properties: { ..._chunkDK6QBGCScjs.SERIES_PROPS, id: { type: "string", description: "Id to use (default: series-N)." }, at: { type: "integer", minimum: 0, description: "Position (default: last)." } },
|
|
1133
1162
|
required: ["name"],
|
|
1134
1163
|
additionalProperties: false
|
|
1135
1164
|
},
|
|
@@ -1144,10 +1173,10 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1144
1173
|
const updateSeries = {
|
|
1145
1174
|
name: "update_chart_series",
|
|
1146
1175
|
title: "Change a series",
|
|
1147
|
-
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (marker, curve, labels, format, x values, bubble sizes, point colours). null resets a field. Values change with set_chart_values. Returns the series.",
|
|
1176
|
+
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (marker, curve, labels, format, x values, bubble sizes, point colours, error bars). null resets a field. Values change with set_chart_values. Returns the series.",
|
|
1148
1177
|
inputSchema: {
|
|
1149
1178
|
type: "object",
|
|
1150
|
-
properties: { series:
|
|
1179
|
+
properties: { series: _chunkDK6QBGCScjs.SERIES_REF, ...Object.fromEntries(Object.entries(_chunkDK6QBGCScjs.SERIES_PROPS).filter(([k]) => k !== "values")) },
|
|
1151
1180
|
required: ["series"],
|
|
1152
1181
|
additionalProperties: false
|
|
1153
1182
|
},
|
|
@@ -1163,7 +1192,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1163
1192
|
name: "remove_chart_series",
|
|
1164
1193
|
title: "Delete a series",
|
|
1165
1194
|
description: "Deletes a series and its values. Returns the remaining series ids.",
|
|
1166
|
-
inputSchema: { type: "object", properties: { series:
|
|
1195
|
+
inputSchema: { type: "object", properties: { series: _chunkDK6QBGCScjs.SERIES_REF }, required: ["series"], additionalProperties: false },
|
|
1167
1196
|
annotations: { title: "Delete a series", ...DESTRUCTIVE },
|
|
1168
1197
|
handler: ({ series }) => {
|
|
1169
1198
|
resolve(controller.removeSeries(seriesById(series).id));
|
|
@@ -1189,7 +1218,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1189
1218
|
name: "remove_chart_category",
|
|
1190
1219
|
title: "Delete a category",
|
|
1191
1220
|
description: "Deletes a category and its value in every series. Returns the remaining categories.",
|
|
1192
|
-
inputSchema: { type: "object", properties: { category:
|
|
1221
|
+
inputSchema: { type: "object", properties: { category: _chunkDK6QBGCScjs.CATEGORY_REF }, required: ["category"], additionalProperties: false },
|
|
1193
1222
|
annotations: { title: "Delete a category", ...DESTRUCTIVE },
|
|
1194
1223
|
handler: ({ category }) => {
|
|
1195
1224
|
resolve(controller.removeCategory(categoryIndex(category)));
|
|
@@ -1232,7 +1261,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1232
1261
|
annotations: { title: "Import a Mermaid chart", ...DESTRUCTIVE },
|
|
1233
1262
|
handler: ({ mermaid }) => {
|
|
1234
1263
|
const fenced = /```(?:mermaid)?\s*\n([\s\S]*?)```/.exec(mermaid);
|
|
1235
|
-
const read =
|
|
1264
|
+
const read = _chunkNK3WL5TJcjs.chartFromMermaid.call(void 0, fenced ? fenced[1] : mermaid);
|
|
1236
1265
|
if (!read.family) fail2(read.issues.map((i) => i.message).join(" ") || "Expected Mermaid starting with xychart-beta, pie or radar-beta.");
|
|
1237
1266
|
resolve(controller.update({ ...read.spec }, { label: "Import Mermaid chart" }));
|
|
1238
1267
|
return { spec: controller.toJSON(), issues: read.issues };
|
|
@@ -1245,7 +1274,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1245
1274
|
inputSchema: { type: "object", properties: { xml: { type: "string", description: "The chart part XML, e.g. word/charts/chart1.xml." } }, required: ["xml"], additionalProperties: false },
|
|
1246
1275
|
annotations: { title: "Import an Office chart", ...DESTRUCTIVE },
|
|
1247
1276
|
handler: ({ xml }) => {
|
|
1248
|
-
const read =
|
|
1277
|
+
const read = _chunkNN3JGUSXcjs.chartFromOoxml.call(void 0, xml, { DOMParser: Parser() });
|
|
1249
1278
|
if (read.issues.some((i) => i.path === "" || i.path === "plotArea")) fail2(read.issues.map((i) => i.message).join(" "));
|
|
1250
1279
|
resolve(controller.update({ ...read.spec }, { label: "Import Office chart" }));
|
|
1251
1280
|
return { spec: controller.toJSON(), issues: read.issues.map((i) => i.message), unsupported: read.unsupported, lossless: read.lossless };
|
|
@@ -1255,7 +1284,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1255
1284
|
name: "add_chart_trendline",
|
|
1256
1285
|
title: "Add a trendline",
|
|
1257
1286
|
description: "Fits a trendline to a series and draws it (unstacked bar, line, area, scatter and bubble charts). Returns its index and the fit: coefficients, R\xB2 and equation.",
|
|
1258
|
-
inputSchema: { type: "object", properties: { series:
|
|
1287
|
+
inputSchema: { type: "object", properties: { series: _chunkDK6QBGCScjs.SERIES_REF, ..._chunkDK6QBGCScjs.TRENDLINE_PROPS }, required: ["series", "type"], additionalProperties: false },
|
|
1259
1288
|
annotations: { title: "Add a trendline", ...WRITE },
|
|
1260
1289
|
handler: ({ series, ...line }) => {
|
|
1261
1290
|
const s = seriesById(series);
|
|
@@ -1269,7 +1298,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1269
1298
|
description: "Deletes a trendline from a series. Returns the series' remaining trendlines.",
|
|
1270
1299
|
inputSchema: {
|
|
1271
1300
|
type: "object",
|
|
1272
|
-
properties: { series:
|
|
1301
|
+
properties: { series: _chunkDK6QBGCScjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index on the series (0 = first)." } },
|
|
1273
1302
|
required: ["series", "index"],
|
|
1274
1303
|
additionalProperties: false
|
|
1275
1304
|
},
|
|
@@ -1277,7 +1306,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1277
1306
|
handler: ({ series, index }) => {
|
|
1278
1307
|
const s = seriesById(series);
|
|
1279
1308
|
resolve(controller.removeTrendline(s.id, index));
|
|
1280
|
-
return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
1309
|
+
return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _78 => _78.getSeries, 'call', _79 => _79(s.id), 'optionalAccess', _80 => _80.trendlines]), () => ( [])) };
|
|
1281
1310
|
}
|
|
1282
1311
|
};
|
|
1283
1312
|
const applyPreset = {
|
|
@@ -1287,8 +1316,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1287
1316
|
inputSchema: {
|
|
1288
1317
|
type: "object",
|
|
1289
1318
|
properties: {
|
|
1290
|
-
layout: { type: "string", enum:
|
|
1291
|
-
colors: { type: "string", enum:
|
|
1319
|
+
layout: { type: "string", enum: _chunkNK3WL5TJcjs.CHART_LAYOUT_PRESETS.map((p) => p.id), description: "Quick layout id." },
|
|
1320
|
+
colors: { type: "string", enum: _chunkNK3WL5TJcjs.CHART_COLOR_SCHEMES.map((p) => p.id), description: "Colour scheme id." }
|
|
1292
1321
|
},
|
|
1293
1322
|
additionalProperties: false
|
|
1294
1323
|
},
|
|
@@ -1317,8 +1346,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1317
1346
|
type: "object",
|
|
1318
1347
|
properties: {
|
|
1319
1348
|
kind: { type: "string", enum: ["none", "chart", "title", "subtitle", "legend", "axis", "series", "point", "category", "trendline"], description: "What to select." },
|
|
1320
|
-
series: { ...
|
|
1321
|
-
category: { ...
|
|
1349
|
+
series: { ..._chunkDK6QBGCScjs.SERIES_REF, description: "Series id or name (series, point, trendline)." },
|
|
1350
|
+
category: { ..._chunkDK6QBGCScjs.CATEGORY_REF, description: "Category index or label (point, category)." },
|
|
1322
1351
|
axis: { type: "string", enum: ["x", "y", "y2"], description: "Axis (axis)." },
|
|
1323
1352
|
index: { type: "integer", minimum: 0, description: "Trendline index (trendline)." }
|
|
1324
1353
|
},
|
|
@@ -1376,20 +1405,20 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1376
1405
|
to: { type: "object", description: "End, as fractions of the chart.", properties: { x: { type: "number", minimum: 0, maximum: 1, description: "Fraction of the width." }, y: { type: "number", minimum: 0, maximum: 1, description: "Fraction of the height." } }, required: ["x", "y"], additionalProperties: false },
|
|
1377
1406
|
fine: { type: "boolean", description: "Move a tenth as far (Alt)." },
|
|
1378
1407
|
lockAxis: { type: "boolean", description: "Scatter charts: change only the axis moved along most (Shift)." },
|
|
1379
|
-
width:
|
|
1380
|
-
height:
|
|
1408
|
+
width: _chunkDK6QBGCScjs.WIDTH,
|
|
1409
|
+
height: _chunkDK6QBGCScjs.HEIGHT
|
|
1381
1410
|
},
|
|
1382
1411
|
required: ["from", "to"],
|
|
1383
1412
|
additionalProperties: false
|
|
1384
1413
|
},
|
|
1385
1414
|
annotations: { title: "Drag a chart point", ...WRITE },
|
|
1386
1415
|
handler: ({ from, to, fine, lockAxis, width = size.width, height = size.height }) => {
|
|
1387
|
-
const scene =
|
|
1416
|
+
const scene = _chunkNK3WL5TJcjs.layoutChart.call(void 0, controller.toJSON(), { width, height });
|
|
1388
1417
|
const start = { x: from.x * width, y: from.y * height };
|
|
1389
1418
|
const target = chartHitTest(scene, start);
|
|
1390
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
1419
|
+
if (_optionalChain([target, 'optionalAccess', _81 => _81.kind]) !== "point") fail2(`There is no bar or point at (${from.x}, ${from.y}); ${target ? `that is the ${target.kind}` : "that is outside the chart"}. Use render_chart to find marks.`);
|
|
1391
1420
|
const t = target;
|
|
1392
|
-
const before = _nullishCoalesce(_optionalChain([controller, 'access',
|
|
1421
|
+
const before = _nullishCoalesce(_optionalChain([controller, 'access', _82 => _82.getSeries, 'call', _83 => _83(t.seriesId), 'optionalAccess', _84 => _84.values, 'access', _85 => _85[t.index]]), () => ( null));
|
|
1393
1422
|
const session = startChartPointDrag(controller, scene, t, start);
|
|
1394
1423
|
if (!session) fail2("That point cannot be dragged here (percent-stacked charts, pies and gaps cannot be dragged).");
|
|
1395
1424
|
session.move({ x: to.x * width, y: to.y * height }, { fine, lockAxis });
|
|
@@ -1414,10 +1443,10 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1414
1443
|
},
|
|
1415
1444
|
annotations: { title: "Press a key on the chart", ...DESTRUCTIVE },
|
|
1416
1445
|
handler: ({ key: k, shift, alt }) => {
|
|
1417
|
-
const scene =
|
|
1446
|
+
const scene = _chunkNK3WL5TJcjs.layoutChart.call(void 0, controller.toJSON(), size);
|
|
1418
1447
|
const used = handleChartKey(controller, scene, { key: k, shiftKey: shift, altKey: alt });
|
|
1419
1448
|
const sel = controller.getState().selection;
|
|
1420
|
-
const value = _optionalChain([sel, 'optionalAccess',
|
|
1449
|
+
const value = _optionalChain([sel, 'optionalAccess', _86 => _86.kind]) === "point" ? _nullishCoalesce(_optionalChain([controller, 'access', _87 => _87.getSeries, 'call', _88 => _88(sel.seriesId), 'optionalAccess', _89 => _89.values, 'access', _90 => _90[sel.index]]), () => ( null)) : void 0;
|
|
1421
1450
|
return { used, selection: sel, ...value !== void 0 ? { value } : {} };
|
|
1422
1451
|
}
|
|
1423
1452
|
};
|
|
@@ -1522,12 +1551,12 @@ var ChartStream = (_class = class {
|
|
|
1522
1551
|
if (format === "json") {
|
|
1523
1552
|
const value = complete ? safeParse(text) : parsePartialChartJson(text);
|
|
1524
1553
|
if (value !== void 0) {
|
|
1525
|
-
const read =
|
|
1554
|
+
const read = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, value);
|
|
1526
1555
|
spec = read.spec;
|
|
1527
1556
|
issues = complete ? read.issues : [];
|
|
1528
1557
|
}
|
|
1529
1558
|
} else {
|
|
1530
|
-
const read =
|
|
1559
|
+
const read = _chunkNK3WL5TJcjs.chartFromMermaid.call(void 0, text, { partial: !complete });
|
|
1531
1560
|
if (read.family) {
|
|
1532
1561
|
spec = read.spec;
|
|
1533
1562
|
issues = complete ? read.issues : [];
|
|
@@ -1639,7 +1668,7 @@ function createInstantChartClock(start = 0) {
|
|
|
1639
1668
|
};
|
|
1640
1669
|
}
|
|
1641
1670
|
function chartPointAnchor(scene, seriesId, index) {
|
|
1642
|
-
const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access',
|
|
1671
|
+
const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access', _91 => _91.target, 'optionalAccess', _92 => _92.kind]) === "point" && m.target.seriesId === seriesId && m.target.index === index);
|
|
1643
1672
|
if (!mark) return null;
|
|
1644
1673
|
if (mark.kind === "rect") return { x: mark.x + mark.width / 2, y: mark.y };
|
|
1645
1674
|
if (mark.kind === "circle") return { x: mark.cx, y: mark.cy };
|
|
@@ -1665,10 +1694,10 @@ function planChartCommand(spec, scene, command, speed = 1) {
|
|
|
1665
1694
|
case "setValue": {
|
|
1666
1695
|
const at = chartPointAnchor(scene, command.seriesId, command.index);
|
|
1667
1696
|
const series = spec.series.find((s) => s.id === command.seriesId);
|
|
1668
|
-
const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess',
|
|
1669
|
-
const scale = _optionalChain([series, 'optionalAccess',
|
|
1697
|
+
const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _93 => _93.values, 'access', _94 => _94[command.index]]), () => ( 0));
|
|
1698
|
+
const scale = _optionalChain([series, 'optionalAccess', _95 => _95.axis]) === "secondary" ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
|
|
1670
1699
|
if (at && scale) {
|
|
1671
|
-
const px =
|
|
1700
|
+
const px = _chunkNK3WL5TJcjs.linearMap.call(void 0, command.value, scale.domain, scale.range);
|
|
1672
1701
|
const to = scale.axis === "y" ? { x: at.x, y: px } : { x: px, y: at.y };
|
|
1673
1702
|
steps.push({ type: "move", to: at, ms: ms(380) }, { type: "press" }, { type: "drag", to, ms: ms(520), from, value: command.value }, { type: "release" });
|
|
1674
1703
|
} else steps.push({ type: "drag", to: { x: scene.plot.x + scene.plot.width / 2, y: scene.plot.y + scene.plot.height / 2 }, ms: ms(200), from, value: command.value });
|
|
@@ -1678,12 +1707,12 @@ function planChartCommand(spec, scene, command, speed = 1) {
|
|
|
1678
1707
|
case "select": {
|
|
1679
1708
|
const sel = command.selection;
|
|
1680
1709
|
let to = null;
|
|
1681
|
-
if (_optionalChain([sel, 'optionalAccess',
|
|
1710
|
+
if (_optionalChain([sel, 'optionalAccess', _96 => _96.kind]) === "point") to = chartPointAnchor(scene, sel.seriesId, sel.index);
|
|
1682
1711
|
else if (sel) {
|
|
1683
1712
|
const m = scene.marks.find((x) => x.target && JSON.stringify(x.target) === JSON.stringify(sel));
|
|
1684
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
1685
|
-
else if (_optionalChain([m, 'optionalAccess',
|
|
1686
|
-
else if (_optionalChain([m, 'optionalAccess',
|
|
1713
|
+
if (_optionalChain([m, 'optionalAccess', _97 => _97.kind]) === "text") to = { x: m.x, y: m.y };
|
|
1714
|
+
else if (_optionalChain([m, 'optionalAccess', _98 => _98.kind]) === "rect") to = { x: m.x + m.width / 2, y: m.y + m.height / 2 };
|
|
1715
|
+
else if (_optionalChain([m, 'optionalAccess', _99 => _99.kind]) === "circle") to = { x: m.cx, y: m.cy };
|
|
1687
1716
|
}
|
|
1688
1717
|
if (to) steps.push({ type: "move", to, ms: ms(380) }, { type: "press" }, { type: "release" });
|
|
1689
1718
|
steps.push({ type: "commit" });
|
|
@@ -1750,7 +1779,7 @@ var ChartDirector = (_class3 = class {
|
|
|
1750
1779
|
const t = f / frames;
|
|
1751
1780
|
const e = 1 - Math.pow(1 - t, 3);
|
|
1752
1781
|
this.presence.set({ id, x: from.x + (to.x - from.x) * e, y: from.y + (to.y - from.y) * e });
|
|
1753
|
-
_optionalChain([each, 'optionalCall',
|
|
1782
|
+
_optionalChain([each, 'optionalCall', _100 => _100(e)]);
|
|
1754
1783
|
await this.clock.wait(ms / frames);
|
|
1755
1784
|
}
|
|
1756
1785
|
}
|
|
@@ -1782,7 +1811,7 @@ var ChartDirector = (_class3 = class {
|
|
|
1782
1811
|
if (command.kind !== "setValue") break;
|
|
1783
1812
|
const stale2 = this.stale(command);
|
|
1784
1813
|
if (stale2) return { ok: false, command, message: stale2 };
|
|
1785
|
-
const label = `${_nullishCoalesce(_optionalChain([this, 'access',
|
|
1814
|
+
const label = `${_nullishCoalesce(_optionalChain([this, 'access', _101 => _101.presence, 'access', _102 => _102.getState, 'call', _103 => _103(), 'access', _104 => _104.actors, 'access', _105 => _105.find, 'call', _106 => _106((a) => a.id === id), 'optionalAccess', _107 => _107.name]), () => ( "Agent"))}: edit value`;
|
|
1786
1815
|
await this.move(id, where(), step.to, step.ms, (e) => {
|
|
1787
1816
|
const v = step.from + (step.value - step.from) * e;
|
|
1788
1817
|
this.controller.setValue(command.seriesId, command.index, Number(v.toPrecision(12)), { label });
|
|
@@ -1830,7 +1859,7 @@ function elements(root, localName) {
|
|
|
1830
1859
|
}
|
|
1831
1860
|
function relId(el, localName = "id") {
|
|
1832
1861
|
for (const a of Array.from(el.attributes)) {
|
|
1833
|
-
if (a.localName === localName && (_optionalChain([a, 'access',
|
|
1862
|
+
if (a.localName === localName && (_optionalChain([a, 'access', _108 => _108.namespaceURI, 'optionalAccess', _109 => _109.includes, 'call', _110 => _110("relationships")]) || a.prefix === "r")) return a.value;
|
|
1834
1863
|
}
|
|
1835
1864
|
return void 0;
|
|
1836
1865
|
}
|
|
@@ -1849,17 +1878,17 @@ async function readRels(r, partPath) {
|
|
|
1849
1878
|
const id = rel.getAttribute("Id");
|
|
1850
1879
|
if (!id) continue;
|
|
1851
1880
|
const target = _nullishCoalesce(rel.getAttribute("Target"), () => ( ""));
|
|
1852
|
-
const external = _optionalChain([rel, 'access',
|
|
1881
|
+
const external = _optionalChain([rel, 'access', _111 => _111.getAttribute, 'call', _112 => _112("TargetMode"), 'optionalAccess', _113 => _113.toLowerCase, 'call', _114 => _114()]) === "external";
|
|
1853
1882
|
rels.set(id, { type: _nullishCoalesce(rel.getAttribute("Type"), () => ( "")), target: external ? target : resolvePartPath(dirname(partPath), target), external });
|
|
1854
1883
|
}
|
|
1855
1884
|
return rels;
|
|
1856
1885
|
}
|
|
1857
|
-
var isChartRef = (el) => el.localName === "chart" && (el.namespaceURI ===
|
|
1886
|
+
var isChartRef = (el) => el.localName === "chart" && (el.namespaceURI === _chunkNN3JGUSXcjs.CHART_OOXML_NS || el.namespaceURI === STRICT_CHART_NS || el.namespaceURI === CHARTEX_NS);
|
|
1858
1887
|
function frameName(ref) {
|
|
1859
1888
|
for (let el = ref.parentElement; el; el = el.parentElement) {
|
|
1860
1889
|
if (el.localName === "graphicFrame") {
|
|
1861
1890
|
const nv = elements(el, "cNvPr")[0];
|
|
1862
|
-
return _optionalChain([nv, 'optionalAccess',
|
|
1891
|
+
return _optionalChain([nv, 'optionalAccess', _115 => _115.getAttribute, 'call', _116 => _116("name")]) || void 0;
|
|
1863
1892
|
}
|
|
1864
1893
|
}
|
|
1865
1894
|
return void 0;
|
|
@@ -1873,7 +1902,7 @@ async function chartsInPart(r, root, rels, place) {
|
|
|
1873
1902
|
const entry = r.zip.get(rel.target);
|
|
1874
1903
|
if (!entry) continue;
|
|
1875
1904
|
r.seen.add(rel.target);
|
|
1876
|
-
const read =
|
|
1905
|
+
const read = _chunkNN3JGUSXcjs.chartFromOoxml.call(void 0, await r.zip.readText(entry), { DOMParser: r.Parser });
|
|
1877
1906
|
const name = frameName(ref);
|
|
1878
1907
|
r.charts.push({
|
|
1879
1908
|
id: `chart-${r.charts.length + 1}`,
|
|
@@ -1895,8 +1924,8 @@ function columnName(index) {
|
|
|
1895
1924
|
return name;
|
|
1896
1925
|
}
|
|
1897
1926
|
function anchorCell(marker) {
|
|
1898
|
-
const col = Number(_optionalChain([firstChild, 'call',
|
|
1899
|
-
const row = Number(_optionalChain([firstChild, 'call',
|
|
1927
|
+
const col = Number(_optionalChain([firstChild, 'call', _117 => _117(marker, "col"), 'optionalAccess', _118 => _118.textContent]));
|
|
1928
|
+
const row = Number(_optionalChain([firstChild, 'call', _119 => _119(marker, "row"), 'optionalAccess', _120 => _120.textContent]));
|
|
1900
1929
|
return Number.isInteger(col) && Number.isInteger(row) && col >= 0 && row >= 0 ? `${columnName(col)}${row + 1}` : void 0;
|
|
1901
1930
|
}
|
|
1902
1931
|
function drawingPlace(ref) {
|
|
@@ -1955,7 +1984,7 @@ async function open(bytes, options) {
|
|
|
1955
1984
|
if (!Parser) throw new OfficeChartsError("Reading Office files needs a DOMParser. In Node, pass one (e.g. from jsdom or @xmldom/xmldom) as { DOMParser }.");
|
|
1956
1985
|
let zip;
|
|
1957
1986
|
try {
|
|
1958
|
-
zip = await
|
|
1987
|
+
zip = await _chunkNN3JGUSXcjs.readZip.call(void 0, bytes, options);
|
|
1959
1988
|
} catch (error) {
|
|
1960
1989
|
throw new OfficeChartsError(`This is not an Office file: ${error.message}`, { cause: error });
|
|
1961
1990
|
}
|
|
@@ -2059,7 +2088,7 @@ function createOfficeChartToolProvider(options = {}) {
|
|
|
2059
2088
|
description: "Lists the Office files the user opened that charts can be read from. Returns their names and sizes in bytes.",
|
|
2060
2089
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
2061
2090
|
annotations: { title: "List open files", ...READ2 },
|
|
2062
|
-
handler: () => ({ files: (_nullishCoalesce(_optionalChain([options, 'access',
|
|
2091
|
+
handler: () => ({ files: (_nullishCoalesce(_optionalChain([options, 'access', _121 => _121.files, 'optionalCall', _122 => _122()]), () => ( []))).map((f) => ({ name: f.name, bytes: f.data.byteLength })) })
|
|
2063
2092
|
};
|
|
2064
2093
|
const listCharts = {
|
|
2065
2094
|
name: "list_file_charts",
|
|
@@ -2252,5 +2281,19 @@ function createOfficeChartToolProvider(options = {}) {
|
|
|
2252
2281
|
|
|
2253
2282
|
|
|
2254
2283
|
|
|
2255
|
-
|
|
2284
|
+
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
|
|
2289
|
+
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
|
|
2293
|
+
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
|
|
2297
|
+
|
|
2298
|
+
exports.CHART_AXIS_KINDS = _chunkCKRNELPOcjs.CHART_AXIS_KINDS; exports.CHART_AXIS_SCALES = _chunkCKRNELPOcjs.CHART_AXIS_SCALES; exports.CHART_COLOR_SCHEMES = _chunkNK3WL5TJcjs.CHART_COLOR_SCHEMES; exports.CHART_CURVES = _chunkCKRNELPOcjs.CHART_CURVES; exports.CHART_DATE_STEPS = _chunkNK3WL5TJcjs.CHART_DATE_STEPS; exports.CHART_ERROR_BAR_DIRECTIONS = _chunkCKRNELPOcjs.CHART_ERROR_BAR_DIRECTIONS; exports.CHART_ERROR_BAR_LABELS = _chunkCKRNELPOcjs.CHART_ERROR_BAR_LABELS; exports.CHART_ERROR_BAR_TYPES = _chunkCKRNELPOcjs.CHART_ERROR_BAR_TYPES; exports.CHART_LABEL_POSITIONS = _chunkCKRNELPOcjs.CHART_LABEL_POSITIONS; exports.CHART_LAYOUT_PRESETS = _chunkNK3WL5TJcjs.CHART_LAYOUT_PRESETS; exports.CHART_LEGEND_POSITIONS = _chunkCKRNELPOcjs.CHART_LEGEND_POSITIONS; exports.CHART_MARKERS = _chunkCKRNELPOcjs.CHART_MARKERS; exports.CHART_MERMAID_META_PREFIX = _chunkNK3WL5TJcjs.CHART_MERMAID_META_PREFIX; exports.CHART_NUMBER_STYLES = _chunkCKRNELPOcjs.CHART_NUMBER_STYLES; exports.CHART_OOXML_CONTENT_TYPE = _chunkNN3JGUSXcjs.CHART_OOXML_CONTENT_TYPE; exports.CHART_OOXML_NS = _chunkNN3JGUSXcjs.CHART_OOXML_NS; exports.CHART_OOXML_RELATIONSHIP = _chunkNN3JGUSXcjs.CHART_OOXML_RELATIONSHIP; exports.CHART_ORIENTATIONS = _chunkCKRNELPOcjs.CHART_ORIENTATIONS; exports.CHART_PALETTE_SHADES = _chunkCKRNELPOcjs.CHART_PALETTE_SHADES; exports.CHART_PRESENCE_COLORS = CHART_PRESENCE_COLORS; exports.CHART_RASTER_MAX_SIZE = CHART_RASTER_MAX_SIZE; exports.CHART_SERIES_TYPES = _chunkCKRNELPOcjs.CHART_SERIES_TYPES; exports.CHART_STACKINGS = _chunkCKRNELPOcjs.CHART_STACKINGS; exports.CHART_TRENDLINE_TYPES = _chunkCKRNELPOcjs.CHART_TRENDLINE_TYPES; exports.CHART_TYPES = _chunkCKRNELPOcjs.CHART_TYPES; exports.CHART_TYPE_LABELS = _chunkCKRNELPOcjs.CHART_TYPE_LABELS; exports.CSS_VARIABLE_CHART_THEME = _chunkCKRNELPOcjs.CSS_VARIABLE_CHART_THEME; exports.ChartController = _chunkNK3WL5TJcjs.ChartController; exports.ChartDirector = ChartDirector; exports.ChartPresence = ChartPresence; exports.ChartStream = ChartStream; exports.DEFAULT_CHART_PALETTE = _chunkCKRNELPOcjs.DEFAULT_CHART_PALETTE; exports.DEFAULT_CHART_THEME = _chunkCKRNELPOcjs.DEFAULT_CHART_THEME; exports.MAX_CHART_DATA_LABELS = _chunkNK3WL5TJcjs.MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = _chunkNK3WL5TJcjs.MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = _chunkNK3WL5TJcjs.MAX_CHART_MARKERS; exports.OfficeChartsError = OfficeChartsError; exports.RENDER_CHART_INSTRUCTIONS = RENDER_CHART_INSTRUCTIONS; exports.analyzeChartTable = analyzeChartTable; exports.blendChartScenes = blendChartScenes; exports.canDragChartPoint = canDragChartPoint; exports.chartBoxStats = _chunkNK3WL5TJcjs.chartBoxStats; exports.chartClientToScene = chartClientToScene; exports.chartColorDistance = _chunkCKRNELPOcjs.chartColorDistance; exports.chartColorInputValue = _chunkCKRNELPOcjs.chartColorInputValue; exports.chartColorsByCategory = _chunkCKRNELPOcjs.chartColorsByCategory; exports.chartContrastRatio = _chunkCKRNELPOcjs.chartContrastRatio; exports.chartDataFromTable = _chunkCKRNELPOcjs.chartDataFromTable; exports.chartDataToTable = _chunkCKRNELPOcjs.chartDataToTable; exports.chartDateLabels = _chunkNK3WL5TJcjs.chartDateLabels; exports.chartDateToSerial = _chunkNK3WL5TJcjs.chartDateToSerial; exports.chartErrorAmounts = _chunkCKRNELPOcjs.chartErrorAmounts; exports.chartErrorBarsOfType = _chunkCKRNELPOcjs.chartErrorBarsOfType; exports.chartFamily = _chunkCKRNELPOcjs.chartFamily; exports.chartFileName = chartFileName; exports.chartFormatToCode = _chunkNN3JGUSXcjs.chartFormatToCode; exports.chartFromMermaid = _chunkNK3WL5TJcjs.chartFromMermaid; exports.chartFromOoxml = _chunkNN3JGUSXcjs.chartFromOoxml; exports.chartFromTable = chartFromTable; exports.chartHistogram = _chunkNK3WL5TJcjs.chartHistogram; exports.chartHitTest = chartHitTest; exports.chartLuminance = _chunkCKRNELPOcjs.chartLuminance; exports.chartMermaidFamily = _chunkNK3WL5TJcjs.chartMermaidFamily; exports.chartMovingAverage = _chunkNK3WL5TJcjs.chartMovingAverage; exports.chartPointAnchor = chartPointAnchor; exports.chartPointColor = _chunkCKRNELPOcjs.chartPointColor; exports.chartPresetPatch = _chunkNK3WL5TJcjs.chartPresetPatch; exports.chartQuantile = _chunkNK3WL5TJcjs.chartQuantile; exports.chartRasterSize = chartRasterSize; exports.chartRgbToHex = _chunkCKRNELPOcjs.chartRgbToHex; exports.chartRgbToOklab = _chunkCKRNELPOcjs.chartRgbToOklab; exports.chartScaleFromPixel = _chunkNK3WL5TJcjs.chartScaleFromPixel; exports.chartScaleToPixel = _chunkNK3WL5TJcjs.chartScaleToPixel; exports.chartSceneToDomSpec = _chunkNK3WL5TJcjs.chartSceneToDomSpec; exports.chartSceneToSvg = _chunkNK3WL5TJcjs.chartSceneToSvg; exports.chartSerialToDate = _chunkNK3WL5TJcjs.chartSerialToDate; exports.chartSeriesColor = _chunkCKRNELPOcjs.chartSeriesColor; exports.chartSeriesType = _chunkCKRNELPOcjs.chartSeriesType; exports.chartSliceColor = _chunkCKRNELPOcjs.chartSliceColor; exports.chartSquarify = _chunkNK3WL5TJcjs.chartSquarify; exports.chartSupportsTrendlines = _chunkNK3WL5TJcjs.chartSupportsTrendlines; exports.chartTextBaseline = _chunkNK3WL5TJcjs.chartTextBaseline; exports.chartTextOn = _chunkCKRNELPOcjs.chartTextOn; exports.chartTextTransform = _chunkNK3WL5TJcjs.chartTextTransform; exports.chartToMermaid = _chunkNK3WL5TJcjs.chartToMermaid; exports.chartToOoxml = _chunkNN3JGUSXcjs.chartToOoxml; exports.chartToSvg = _chunkNK3WL5TJcjs.chartToSvg; exports.chartTrendlineName = _chunkNK3WL5TJcjs.chartTrendlineName; exports.chartValueAtPoint = _chunkNK3WL5TJcjs.chartValueAtPoint; exports.chartXAtPoint = _chunkNK3WL5TJcjs.chartXAtPoint; exports.checkChartColors = _chunkCKRNELPOcjs.checkChartColors; exports.cloneChartSeries = _chunkCKRNELPOcjs.cloneChartSeries; exports.cloneChartSpec = _chunkCKRNELPOcjs.cloneChartSpec; exports.compileChartFormatCode = _chunkNK3WL5TJcjs.compileChartFormatCode; exports.contrastingTextColor = _chunkNK3WL5TJcjs.contrastingTextColor; exports.createChartCommands = createChartCommands; exports.createChartController = _chunkNK3WL5TJcjs.createChartController; exports.createChartRasterizer = createChartRasterizer; exports.createChartSpec = _chunkCKRNELPOcjs.createChartSpec; exports.createChartToolProvider = createChartToolProvider; exports.createInstantChartClock = createInstantChartClock; exports.createOfficeChartToolProvider = createOfficeChartToolProvider; exports.cyclePaletteColor = _chunkCKRNELPOcjs.cyclePaletteColor; exports.decimateChartPoints = _chunkNK3WL5TJcjs.decimateChartPoints; exports.defaultChartAxis = _chunkCKRNELPOcjs.defaultChartAxis; exports.defaultChartErrorBarValue = _chunkCKRNELPOcjs.defaultChartErrorBarValue; exports.describeChart = _chunkNK3WL5TJcjs.describeChart; exports.describeChartErrorBars = _chunkCKRNELPOcjs.describeChartErrorBars; exports.describeChartSelection = describeChartSelection; exports.describeOfficeChartPlace = describeOfficeChartPlace; exports.downloadChartPng = downloadChartPng; exports.easeChartTween = easeChartTween; exports.estimateChartTextWidth = _chunkNK3WL5TJcjs.estimateChartTextWidth; exports.extractDocxCharts = extractDocxCharts; exports.extractOfficeCharts = extractOfficeCharts; exports.extractPptxCharts = extractPptxCharts; exports.extractXlsxCharts = extractXlsxCharts; exports.findMermaidCharts = _chunkNK3WL5TJcjs.findMermaidCharts; exports.fitChartTrendline = _chunkNK3WL5TJcjs.fitChartTrendline; exports.formatChartAmountList = _chunkCKRNELPOcjs.formatChartAmountList; exports.formatChartDate = _chunkNK3WL5TJcjs.formatChartDate; exports.formatChartNumber = _chunkNK3WL5TJcjs.formatChartNumber; exports.formatChartValueWithCode = _chunkNK3WL5TJcjs.formatChartValueWithCode; exports.handleChartKey = handleChartKey; exports.isCartesianChart = _chunkCKRNELPOcjs.isCartesianChart; exports.isXyChart = _chunkCKRNELPOcjs.isXyChart; exports.layoutChart = _chunkNK3WL5TJcjs.layoutChart; exports.layoutSparkline = _chunkNK3WL5TJcjs.layoutSparkline; exports.linearMap = _chunkNK3WL5TJcjs.linearMap; exports.monochromeChartPalette = _chunkNK3WL5TJcjs.monochromeChartPalette; exports.niceLogScale = _chunkNK3WL5TJcjs.niceLogScale; exports.niceScale = _chunkNK3WL5TJcjs.niceScale; exports.niceStep = _chunkNK3WL5TJcjs.niceStep; exports.normalizeChartAxis = _chunkCKRNELPOcjs.normalizeChartAxis; exports.normalizeChartErrorBars = _chunkCKRNELPOcjs.normalizeChartErrorBars; exports.normalizeChartSpec = _chunkCKRNELPOcjs.normalizeChartSpec; exports.normalizeChartTrendline = _chunkCKRNELPOcjs.normalizeChartTrendline; exports.normalizeChartValues = _chunkCKRNELPOcjs.normalizeChartValues; exports.parseChartAmountList = _chunkCKRNELPOcjs.parseChartAmountList; exports.parseChartColor = _chunkCKRNELPOcjs.parseChartColor; exports.parseChartDate = _chunkNK3WL5TJcjs.parseChartDate; exports.parseChartValue = _chunkCKRNELPOcjs.parseChartValue; exports.parsePartialChartJson = parsePartialChartJson; exports.planChartCommand = planChartCommand; exports.rasterizeChartSvg = rasterizeChartSvg; exports.realChartClock = realChartClock; exports.recommendChartTypes = recommendChartTypes; exports.recommendForShape = recommendForShape; exports.resolveChartSvgPaints = resolveChartSvgPaints; exports.sameChartSelection = _chunkNK3WL5TJcjs.sameChartSelection; exports.shadeChartColor = _chunkCKRNELPOcjs.shadeChartColor; exports.simulateChartVision = _chunkCKRNELPOcjs.simulateChartVision; exports.snapChartDragValue = snapChartDragValue; exports.snapChartValue = _chunkNK3WL5TJcjs.snapChartValue; exports.sparklineToSvg = _chunkNK3WL5TJcjs.sparklineToSvg; exports.startChartPointDrag = startChartPointDrag; exports.stepDecimals = _chunkNK3WL5TJcjs.stepDecimals; exports.summarizeChart = _chunkNK3WL5TJcjs.summarizeChart; exports.summarizeChartSeries = _chunkNK3WL5TJcjs.summarizeChartSeries; exports.trendNumberText = _chunkNK3WL5TJcjs.trendNumberText; exports.uniqueChartSeriesId = _chunkCKRNELPOcjs.uniqueChartSeriesId;
|
|
2256
2299
|
//# sourceMappingURL=index.cjs.map
|