@pixerate/editor 0.48.0 → 0.50.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 +24 -22
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.js +6 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +151 -25
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +109 -3
- package/dist/canvas/index.d.ts +109 -3
- package/dist/canvas/index.js +127 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chart/index.cjs +81 -79
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.js +52 -50
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-TXXNBDQX.cjs → chunk-2Q46FKZK.cjs} +113 -34
- package/dist/chunk-2Q46FKZK.cjs.map +1 -0
- package/dist/{chunk-PIMCHMZE.cjs → chunk-3JNRQVTS.cjs} +16 -16
- package/dist/{chunk-PIMCHMZE.cjs.map → chunk-3JNRQVTS.cjs.map} +1 -1
- package/dist/{chunk-HXUL3LS7.js → chunk-5TWIN7ZJ.js} +2 -2
- package/dist/{chunk-VKPEPWKZ.js → chunk-DQPBQXKG.js} +4 -4
- package/dist/{chunk-MUCYWI6W.cjs → chunk-FEMIVHN3.cjs} +17 -15
- package/dist/chunk-FEMIVHN3.cjs.map +1 -0
- package/dist/{chunk-XUUD43OV.js → chunk-GJBIVWB2.js} +2 -2
- package/dist/{chunk-PRSJJZBS.cjs → chunk-GTZXF4BI.cjs} +191 -841
- package/dist/chunk-GTZXF4BI.cjs.map +1 -0
- package/dist/chunk-JOX6MJW4.cjs +674 -0
- package/dist/chunk-JOX6MJW4.cjs.map +1 -0
- package/dist/{chunk-WXEHCVJQ.cjs → chunk-LNKZPIQD.cjs} +52 -52
- package/dist/{chunk-WXEHCVJQ.cjs.map → chunk-LNKZPIQD.cjs.map} +1 -1
- package/dist/chunk-OV7UAKIY.js +674 -0
- package/dist/chunk-OV7UAKIY.js.map +1 -0
- package/dist/{chunk-PKBWLEL7.js → chunk-QFTVLEVN.js} +6 -4
- package/dist/{chunk-PKBWLEL7.js.map → chunk-QFTVLEVN.js.map} +1 -1
- package/dist/{chunk-KRGXUQ2Y.js → chunk-T6XU4B54.js} +82 -3
- package/dist/chunk-T6XU4B54.js.map +1 -0
- package/dist/{chunk-U6IZKC7B.cjs → chunk-TGBCBQFV.cjs} +14 -14
- package/dist/{chunk-U6IZKC7B.cjs.map → chunk-TGBCBQFV.cjs.map} +1 -1
- package/dist/{chunk-3LHWTGHW.js → chunk-TO22LX34.js} +11 -1
- package/dist/chunk-TO22LX34.js.map +1 -0
- package/dist/{chunk-LTUM52X6.js → chunk-WBOAXDKD.js} +109 -759
- package/dist/chunk-WBOAXDKD.js.map +1 -0
- package/dist/{chunk-VNYRI265.cjs → chunk-YNSK4MGT.cjs} +12 -2
- package/dist/chunk-YNSK4MGT.cjs.map +1 -0
- package/dist/export/index.cjs +4 -2
- package/dist/export/index.cjs.map +1 -1
- package/dist/export/index.d.cts +5 -1
- package/dist/export/index.d.ts +5 -1
- package/dist/export/index.js +3 -1
- package/dist/extensions/index.cjs +6 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +5 -4
- package/dist/image-editor/index.cjs +141 -1
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +42 -1
- package/dist/image-editor/index.d.ts +42 -1
- package/dist/image-editor/index.js +140 -0
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/{pathfinder-D98S2lV5.d.ts → pathfinder-B9xh_pCZ.d.ts} +2 -1
- package/dist/{pathfinder-DKRcXiLS.d.cts → pathfinder-QdG70sr9.d.cts} +2 -1
- package/dist/vector/index.cjs +153 -153
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3LHWTGHW.js.map +0 -1
- package/dist/chunk-KRGXUQ2Y.js.map +0 -1
- package/dist/chunk-LTUM52X6.js.map +0 -1
- package/dist/chunk-MUCYWI6W.cjs.map +0 -1
- package/dist/chunk-PRSJJZBS.cjs.map +0 -1
- package/dist/chunk-TXXNBDQX.cjs.map +0 -1
- package/dist/chunk-VNYRI265.cjs.map +0 -1
- /package/dist/{chunk-HXUL3LS7.js.map → chunk-5TWIN7ZJ.js.map} +0 -0
- /package/dist/{chunk-VKPEPWKZ.js.map → chunk-DQPBQXKG.js.map} +0 -0
- /package/dist/{chunk-XUUD43OV.js.map → chunk-GJBIVWB2.js.map} +0 -0
package/dist/chart/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTGBCBQFVcjs = require('../chunk-TGBCBQFV.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ var _chunkU6IZKC7Bcjs = require('../chunk-U6IZKC7B.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk3JNRQVTScjs = require('../chunk-3JNRQVTS.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
@@ -71,6 +71,7 @@ var _chunkPIMCHMZEcjs = require('../chunk-PIMCHMZE.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
var _chunkGTZXF4BIcjs = require('../chunk-GTZXF4BI.cjs');
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
|
|
@@ -119,7 +120,8 @@ var _chunkPIMCHMZEcjs = require('../chunk-PIMCHMZE.cjs');
|
|
|
119
120
|
|
|
120
121
|
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
|
|
124
|
+
var _chunkJOX6MJW4cjs = require('../chunk-JOX6MJW4.cjs');
|
|
123
125
|
require('../chunk-XP5IUZUO.cjs');
|
|
124
126
|
|
|
125
127
|
|
|
@@ -128,7 +130,7 @@ require('../chunk-QKLRAA4T.cjs');
|
|
|
128
130
|
|
|
129
131
|
// src/chart/recommend.ts
|
|
130
132
|
var blank = (c) => c === null || c === void 0 || String(c).trim() === "";
|
|
131
|
-
var isText = (c) => blank(c) ||
|
|
133
|
+
var isText = (c) => blank(c) || _chunkJOX6MJW4cjs.parseChartValue.call(void 0, c) === void 0;
|
|
132
134
|
function analyzeChartTable(rows) {
|
|
133
135
|
const grid = rows.filter((r) => r.some((c) => !blank(c)));
|
|
134
136
|
const height = grid.length;
|
|
@@ -146,7 +148,7 @@ function analyzeChartTable(rows) {
|
|
|
146
148
|
let anyPositive = false;
|
|
147
149
|
for (let r = headerRow ? 1 : 0; r < height; r++)
|
|
148
150
|
for (let c = labelColumn ? 1 : 0; c < width; c++) {
|
|
149
|
-
const v =
|
|
151
|
+
const v = _chunkJOX6MJW4cjs.parseChartValue.call(void 0, cell(r, c));
|
|
150
152
|
if (typeof v !== "number") continue;
|
|
151
153
|
anyNumber = true;
|
|
152
154
|
if (v < 0) {
|
|
@@ -155,7 +157,7 @@ function analyzeChartTable(rows) {
|
|
|
155
157
|
} else if (v > 0) anyPositive = true;
|
|
156
158
|
}
|
|
157
159
|
const labels = byRows ? _nullishCoalesce(_optionalChain([grid, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.slice, 'call', _6 => _6(labelColumn ? 1 : 0)]), () => ( [])) : grid.slice(headerRow ? 1 : 0).map((r) => r[0]);
|
|
158
|
-
const dates = (byRows ? headerRow : labelColumn) && labels.length > 1 && labels.filter((l) => !blank(l) &&
|
|
160
|
+
const dates = (byRows ? headerRow : labelColumn) && labels.length > 1 && labels.filter((l) => !blank(l) && _chunkGTZXF4BIcjs.parseChartDate.call(void 0, String(l)) !== null).length >= labels.length * 0.8;
|
|
159
161
|
return {
|
|
160
162
|
headerRow,
|
|
161
163
|
labelColumn,
|
|
@@ -242,7 +244,7 @@ function chartFromTable(rows, options = {}) {
|
|
|
242
244
|
if (xFromFirst) {
|
|
243
245
|
table = table.map((r) => [r[1], ...r.slice(2)]);
|
|
244
246
|
}
|
|
245
|
-
const data =
|
|
247
|
+
const data = _chunkJOX6MJW4cjs.chartDataFromTable.call(void 0, table, { seriesIn: shape.byRows ? "rows" : "columns", header: true, xFromFirstColumn: xFromFirst });
|
|
246
248
|
return { type, stacking, categories: data.categories, series: data.series, issues: data.issues, shape };
|
|
247
249
|
}
|
|
248
250
|
|
|
@@ -278,10 +280,10 @@ function createChartCommands(controller, options = {}) {
|
|
|
278
280
|
readOnly: true,
|
|
279
281
|
keywords: ["chart", "data", "spec", "get", "summary"],
|
|
280
282
|
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.",
|
|
281
|
-
params: object({ width:
|
|
283
|
+
params: object({ width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT }),
|
|
282
284
|
run: (_ctx, params = {}) => {
|
|
283
285
|
const spec = controller.getSpec();
|
|
284
|
-
return { spec: controller.toJSON(), table:
|
|
286
|
+
return { spec: controller.toJSON(), table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, spec), summary: _chunkGTZXF4BIcjs.summarizeChart.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _9 => _9.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _10 => _10.height]), () => ( 400)) }), issues: controller.getState().issues };
|
|
285
287
|
}
|
|
286
288
|
},
|
|
287
289
|
{
|
|
@@ -290,7 +292,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
290
292
|
label: "Change Chart\u2026",
|
|
291
293
|
keywords: ["chart", "title", "axis", "legend", "stack", "style", "format", "type"],
|
|
292
294
|
description: "Changes chart presentation as one undo step: type, titles, axes (xAxis = categories, yAxis = values, yAxis2 = secondary values), legend, stacking, orientation, curve, points, data labels, palette, donut hole, bar spacing, histogram bins or waterfall total. Invalid values change nothing and return why.",
|
|
293
|
-
params: object(
|
|
295
|
+
params: object(_chunkTGBCBQFVcjs.CHART_UPDATE_PROPERTIES),
|
|
294
296
|
run: (_ctx, params) => {
|
|
295
297
|
check(controller.update(params));
|
|
296
298
|
return { spec: controller.toJSON() };
|
|
@@ -304,11 +306,11 @@ function createChartCommands(controller, options = {}) {
|
|
|
304
306
|
description: "Replaces the categories and series as one undo step. Each series has one value per category (padded with gaps).",
|
|
305
307
|
params: object({
|
|
306
308
|
categories: { type: "array", items: { type: "string" }, description: "Category labels in order." },
|
|
307
|
-
series: { type: "array", description: "The new series.", items: object({ id: { type: "string", description: "Stable id (optional)." }, ...
|
|
309
|
+
series: { type: "array", description: "The new series.", items: object({ id: { type: "string", description: "Stable id (optional)." }, ..._chunkTGBCBQFVcjs.SERIES_PROPS }, ["name", "values"]) }
|
|
308
310
|
}),
|
|
309
311
|
run: (_ctx, params) => {
|
|
310
312
|
check(controller.setData(params));
|
|
311
|
-
return { table:
|
|
313
|
+
return { table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()) };
|
|
312
314
|
}
|
|
313
315
|
},
|
|
314
316
|
{
|
|
@@ -317,10 +319,10 @@ function createChartCommands(controller, options = {}) {
|
|
|
317
319
|
label: "Set Chart Values\u2026",
|
|
318
320
|
keywords: ["chart", "value", "cell", "edit"],
|
|
319
321
|
description: "Sets individual values as one undo step. Series by id or name; category by index or label.",
|
|
320
|
-
params: object({ cells: { type: "array", minItems: 1, description: "Values to set.", items: object({ series:
|
|
322
|
+
params: object({ cells: { type: "array", minItems: 1, description: "Values to set.", items: object({ series: _chunkTGBCBQFVcjs.SERIES_REF, category: _chunkTGBCBQFVcjs.CATEGORY_REF, value: _chunkTGBCBQFVcjs.VALUE }, ["series", "category", "value"]) } }, ["cells"]),
|
|
321
323
|
run: (_ctx, params) => {
|
|
322
324
|
check(controller.setValues(params.cells.map((c) => ({ seriesId: resolveSeries(c.series).id, index: resolveCategory(c.category), value: c.value }))));
|
|
323
|
-
return { table:
|
|
325
|
+
return { table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()) };
|
|
324
326
|
}
|
|
325
327
|
},
|
|
326
328
|
{
|
|
@@ -329,7 +331,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
329
331
|
label: "Add Series",
|
|
330
332
|
keywords: ["chart", "series", "new"],
|
|
331
333
|
description: "Adds a series (default: an empty one at the end). Returns its id.",
|
|
332
|
-
params: object({ ...
|
|
334
|
+
params: object({ ..._chunkTGBCBQFVcjs.SERIES_PROPS, id: { type: "string", description: "Id to use (default series-N)." }, at: { type: "integer", minimum: 0, description: "Position (default: last)." } }),
|
|
333
335
|
run: (_ctx, params = {}) => {
|
|
334
336
|
const { at, ...input } = _nullishCoalesce(params, () => ( {}));
|
|
335
337
|
const clean = Object.fromEntries(Object.entries(input).filter(([, v]) => v !== null));
|
|
@@ -344,7 +346,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
344
346
|
label: "Change Series\u2026",
|
|
345
347
|
keywords: ["chart", "series", "rename", "colour", "color", "hide", "axis", "marker"],
|
|
346
348
|
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (null resets a field).",
|
|
347
|
-
params: object({ series:
|
|
349
|
+
params: object({ series: _chunkTGBCBQFVcjs.SERIES_REF, ...Object.fromEntries(Object.entries(_chunkTGBCBQFVcjs.SERIES_PROPS).filter(([k]) => k !== "values")) }, ["series"]),
|
|
348
350
|
run: (_ctx, params) => {
|
|
349
351
|
const { series, ...patch } = params;
|
|
350
352
|
const id = resolveSeries(series).id;
|
|
@@ -358,7 +360,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
358
360
|
label: "Delete Series",
|
|
359
361
|
keywords: ["chart", "series", "remove"],
|
|
360
362
|
description: "Deletes a series by id or name.",
|
|
361
|
-
params: object({ series:
|
|
363
|
+
params: object({ series: _chunkTGBCBQFVcjs.SERIES_REF }, ["series"]),
|
|
362
364
|
run: (_ctx, params) => {
|
|
363
365
|
check(controller.removeSeries(resolveSeries(params.series).id));
|
|
364
366
|
return { series: seriesIds() };
|
|
@@ -379,7 +381,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
379
381
|
label: "Delete Category",
|
|
380
382
|
keywords: ["chart", "category", "row", "remove"],
|
|
381
383
|
description: "Deletes a category (and its values) by index or label.",
|
|
382
|
-
params: object({ category:
|
|
384
|
+
params: object({ category: _chunkTGBCBQFVcjs.CATEGORY_REF }, ["category"]),
|
|
383
385
|
run: (_ctx, params) => {
|
|
384
386
|
check(controller.removeCategory(resolveCategory(params.category)));
|
|
385
387
|
return { categories: controller.getSpec().categories };
|
|
@@ -391,7 +393,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
391
393
|
label: "Add Trendline\u2026",
|
|
392
394
|
keywords: ["chart", "trend", "regression", "fit", "forecast", "moving average"],
|
|
393
395
|
description: "Fits a trendline to a series (linear, exponential, logarithmic, power, polynomial or moving average). Returns its index and the fit.",
|
|
394
|
-
params: object({ series:
|
|
396
|
+
params: object({ series: _chunkTGBCBQFVcjs.SERIES_REF, ..._chunkTGBCBQFVcjs.TRENDLINE_PROPS }, ["series", "type"]),
|
|
395
397
|
run: (_ctx, params) => {
|
|
396
398
|
const { series, ...line } = params;
|
|
397
399
|
const result = controller.addTrendline(resolveSeries(series).id, line);
|
|
@@ -406,7 +408,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
406
408
|
label: "Delete Trendline",
|
|
407
409
|
keywords: ["chart", "trend", "remove"],
|
|
408
410
|
description: "Deletes a trendline from a series.",
|
|
409
|
-
params: object({ series:
|
|
411
|
+
params: object({ series: _chunkTGBCBQFVcjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index (0 = first)." } }, ["series", "index"]),
|
|
410
412
|
run: (_ctx, params) => {
|
|
411
413
|
check(controller.removeTrendline(resolveSeries(params.series).id, params.index));
|
|
412
414
|
return { trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _13 => _13.getSeries, 'call', _14 => _14(resolveSeries(params.series).id), 'optionalAccess', _15 => _15.trendlines]), () => ( [])) };
|
|
@@ -419,8 +421,8 @@ function createChartCommands(controller, options = {}) {
|
|
|
419
421
|
keywords: ["chart", "quick layout", "style", "colours", "colors", "monochrome", "theme"],
|
|
420
422
|
description: "Applies a quick layout and / or colour scheme as one undo step.",
|
|
421
423
|
params: object({
|
|
422
|
-
layout: { type: "string", enum:
|
|
423
|
-
colors: { type: "string", enum:
|
|
424
|
+
layout: { type: "string", enum: _chunkGTZXF4BIcjs.CHART_LAYOUT_PRESETS.map((p) => p.id), description: "Quick layout id." },
|
|
425
|
+
colors: { type: "string", enum: _chunkGTZXF4BIcjs.CHART_COLOR_SCHEMES.map((p) => p.id), description: "Colour scheme id." }
|
|
424
426
|
}),
|
|
425
427
|
run: (_ctx, params = {}) => {
|
|
426
428
|
check(controller.applyPreset(_nullishCoalesce(params, () => ( {}))));
|
|
@@ -435,7 +437,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
435
437
|
description: "Swaps series and categories as one undo step.",
|
|
436
438
|
run: () => {
|
|
437
439
|
check(controller.transpose());
|
|
438
|
-
return { table:
|
|
440
|
+
return { table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()) };
|
|
439
441
|
}
|
|
440
442
|
},
|
|
441
443
|
{
|
|
@@ -455,7 +457,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
455
457
|
run: (_ctx, params) => {
|
|
456
458
|
const result = controller.importCsv(params.csv, { seriesIn: params.seriesIn, header: params.header });
|
|
457
459
|
check(result);
|
|
458
|
-
return { table:
|
|
460
|
+
return { table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()), issues: _nullishCoalesce(result.issues, () => ( [])) };
|
|
459
461
|
}
|
|
460
462
|
},
|
|
461
463
|
{
|
|
@@ -466,7 +468,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
466
468
|
description: "Replaces the chart with Mermaid xychart-beta, pie or radar-beta text (one undo step). Unreadable lines are listed with line numbers.",
|
|
467
469
|
params: object({ mermaid: { type: "string", description: "Mermaid text." } }, ["mermaid"]),
|
|
468
470
|
run: (_ctx, params) => {
|
|
469
|
-
const read =
|
|
471
|
+
const read = _chunkGTZXF4BIcjs.chartFromMermaid.call(void 0, params.mermaid);
|
|
470
472
|
if (!read.family) fail(read.issues.map((i) => i.message).join(" ") || "Expected Mermaid starting with xychart-beta, pie or radar-beta.");
|
|
471
473
|
check(controller.update({ ...read.spec }, { label: "Import Mermaid chart" }));
|
|
472
474
|
return { spec: controller.toJSON(), issues: read.issues };
|
|
@@ -480,7 +482,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
480
482
|
keywords: ["chart", "mermaid", "markdown", "export"],
|
|
481
483
|
description: "Returns the chart as Mermaid text (with a round-trip comment unless meta is false).",
|
|
482
484
|
params: object({ meta: { type: "boolean", description: "Include the %% @pixerate round-trip comment (default true)." } }),
|
|
483
|
-
run: (_ctx, params = {}) => ({ mermaid:
|
|
485
|
+
run: (_ctx, params = {}) => ({ mermaid: _chunkGTZXF4BIcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta: _optionalChain([params, 'optionalAccess', _16 => _16.meta]) }) })
|
|
484
486
|
},
|
|
485
487
|
{
|
|
486
488
|
...base,
|
|
@@ -489,7 +491,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
489
491
|
readOnly: true,
|
|
490
492
|
keywords: ["chart", "office", "word", "powerpoint", "docx", "pptx", "xml", "export"],
|
|
491
493
|
description: "Returns the chart as a DrawingML chart part (c:chartSpace) and what could not be written.",
|
|
492
|
-
run: () =>
|
|
494
|
+
run: () => _chunk3JNRQVTScjs.chartToOoxml.call(void 0, controller.toJSON())
|
|
493
495
|
},
|
|
494
496
|
{
|
|
495
497
|
...base,
|
|
@@ -498,9 +500,9 @@ function createChartCommands(controller, options = {}) {
|
|
|
498
500
|
readOnly: true,
|
|
499
501
|
keywords: ["chart", "svg", "export", "image"],
|
|
500
502
|
description: "Returns the chart drawn as a standalone, accessible SVG string (with <title> and <desc>).",
|
|
501
|
-
params: object({ width:
|
|
503
|
+
params: object({ width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT }),
|
|
502
504
|
run: (_ctx, params = {}) => ({
|
|
503
|
-
svg:
|
|
505
|
+
svg: _chunkGTZXF4BIcjs.chartToSvg.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _17 => _17.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _18 => _18.height]), () => ( 400)) })
|
|
504
506
|
})
|
|
505
507
|
},
|
|
506
508
|
{
|
|
@@ -512,7 +514,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
512
514
|
description: "Suggests chart types for the current data (or CSV), best first, each with a reason.",
|
|
513
515
|
params: object({ csv: { type: "string", description: "CSV text to analyse instead of the current data." } }),
|
|
514
516
|
run: (_ctx, params = {}) => ({
|
|
515
|
-
recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess', _19 => _19.csv]) !== void 0 ? _chunkTNNJXF46cjs.parseCsv.call(void 0, params.csv) :
|
|
517
|
+
recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess', _19 => _19.csv]) !== void 0 ? _chunkTNNJXF46cjs.parseCsv.call(void 0, params.csv) : _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()))
|
|
516
518
|
})
|
|
517
519
|
},
|
|
518
520
|
{
|
|
@@ -525,8 +527,8 @@ function createChartCommands(controller, options = {}) {
|
|
|
525
527
|
run: () => {
|
|
526
528
|
const s = controller.getSpec();
|
|
527
529
|
const visible = s.series.filter((x) => !x.hidden);
|
|
528
|
-
const colors =
|
|
529
|
-
return { colors, ...
|
|
530
|
+
const colors = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _20 => _20[0], 'optionalAccess', _21 => _21.pointColors, 'optionalAccess', _22 => _22[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
|
|
531
|
+
return { colors, ..._chunkJOX6MJW4cjs.checkChartColors.call(void 0, colors) };
|
|
530
532
|
}
|
|
531
533
|
},
|
|
532
534
|
{
|
|
@@ -557,7 +559,7 @@ function chartClientToScene(scene, box, clientX, clientY) {
|
|
|
557
559
|
function canDragChartPoint(controller, scene, target) {
|
|
558
560
|
if (_optionalChain([target, 'optionalAccess', _23 => _23.kind]) !== "point" || !scene.valueScale || scene.percent) return false;
|
|
559
561
|
const spec = controller.getSpec();
|
|
560
|
-
const family =
|
|
562
|
+
const family = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec);
|
|
561
563
|
if (family !== "cartesian" && family !== "xy" && family !== "waterfall") return false;
|
|
562
564
|
const series = controller.getSeries(target.seriesId);
|
|
563
565
|
return !!series && !series.hidden && series.values[target.index] !== null;
|
|
@@ -566,7 +568,7 @@ function snapChartDragValue(scene, value, options = {}) {
|
|
|
566
568
|
const scale = _nullishCoalesce(options.scale, () => ( scene.valueScale));
|
|
567
569
|
const tolerance = _nullishCoalesce(options.tolerancePx, () => ( 6));
|
|
568
570
|
if (scale) {
|
|
569
|
-
const px = (v) =>
|
|
571
|
+
const px = (v) => _chunkGTZXF4BIcjs.linearMap.call(void 0, v, scale.domain, scale.range);
|
|
570
572
|
const at = px(value);
|
|
571
573
|
let best = null;
|
|
572
574
|
let bestDist = tolerance;
|
|
@@ -580,7 +582,7 @@ function snapChartDragValue(scene, value, options = {}) {
|
|
|
580
582
|
}
|
|
581
583
|
if (best !== null) return best;
|
|
582
584
|
}
|
|
583
|
-
return
|
|
585
|
+
return _chunkGTZXF4BIcjs.snapChartValue.call(void 0, scene, value, options.step, _optionalChain([scale, 'optionalAccess', _24 => _24.ticks]));
|
|
584
586
|
}
|
|
585
587
|
function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
586
588
|
if (!canDragChartPoint(controller, scene, target)) return null;
|
|
@@ -589,11 +591,11 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
589
591
|
const series = controller.getSeries(seriesId);
|
|
590
592
|
const secondary = series.axis === "secondary" && !!scene.valueScale2;
|
|
591
593
|
const scale = secondary ? scene.valueScale2 : scene.valueScale;
|
|
592
|
-
const xy =
|
|
594
|
+
const xy = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy" && !!scene.xScale;
|
|
593
595
|
const startValue = _nullishCoalesce(series.values[index], () => ( 0));
|
|
594
596
|
const startX = _nullishCoalesce(_optionalChain([series, 'access', _25 => _25.x, 'optionalAccess', _26 => _26[index]]), () => ( null));
|
|
595
|
-
const startAt =
|
|
596
|
-
const startAtX = xy ?
|
|
597
|
+
const startAt = _chunkGTZXF4BIcjs.chartValueAtPoint.call(void 0, scene, start, secondary);
|
|
598
|
+
const startAtX = xy ? _chunkGTZXF4BIcjs.chartXAtPoint.call(void 0, scene, start) : void 0;
|
|
597
599
|
if (startAt === void 0) return null;
|
|
598
600
|
const candidates = [0, startValue];
|
|
599
601
|
if (!xy) {
|
|
@@ -611,13 +613,13 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
611
613
|
target: { seriesId, index },
|
|
612
614
|
move(point, moveOptions = {}) {
|
|
613
615
|
if (ended) return;
|
|
614
|
-
const at =
|
|
616
|
+
const at = _chunkGTZXF4BIcjs.chartValueAtPoint.call(void 0, scene, point, secondary);
|
|
615
617
|
if (at === void 0) return;
|
|
616
618
|
const factor = moveOptions.fine ? 0.1 : 1;
|
|
617
619
|
let dy = (at - startAt) * factor;
|
|
618
620
|
let dx = 0;
|
|
619
621
|
if (xy && startX !== null && startAtX !== void 0) {
|
|
620
|
-
const atX =
|
|
622
|
+
const atX = _chunkGTZXF4BIcjs.chartXAtPoint.call(void 0, scene, point);
|
|
621
623
|
if (atX !== void 0) dx = (atX - startAtX) * factor;
|
|
622
624
|
if (moveOptions.lockAxis) {
|
|
623
625
|
if (Math.abs(point.x - start.x) >= Math.abs(point.y - start.y)) dy = 0;
|
|
@@ -628,7 +630,7 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
628
630
|
if (moveOptions.noSnap) return Number(v.toPrecision(12));
|
|
629
631
|
if (moveOptions.fine) {
|
|
630
632
|
const unit = options.step ? options.step / 10 : s.ticks.length > 1 ? (s.ticks[1] - s.ticks[0]) / 100 : void 0;
|
|
631
|
-
return
|
|
633
|
+
return _chunkGTZXF4BIcjs.snapChartValue.call(void 0, scene, v, unit, s.ticks);
|
|
632
634
|
}
|
|
633
635
|
return snapChartDragValue(scene, v, { candidates: c, tolerancePx: options.tolerancePx, step: options.step, scale: s });
|
|
634
636
|
};
|
|
@@ -705,7 +707,7 @@ function describeChartSelection(controller, selection = controller.getState().se
|
|
|
705
707
|
case "legend":
|
|
706
708
|
return "Legend";
|
|
707
709
|
case "axis":
|
|
708
|
-
return selection.axis === "x" ?
|
|
710
|
+
return selection.axis === "x" ? _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy" ? "X axis" : "Category axis" : selection.axis === "y" ? "Value axis" : "Secondary value axis";
|
|
709
711
|
case "series":
|
|
710
712
|
return `Series "${_nullishCoalesce(_optionalChain([controller, 'access', _42 => _42.getSeries, 'call', _43 => _43(selection.seriesId), 'optionalAccess', _44 => _44.name]), () => ( selection.seriesId))}"`;
|
|
711
713
|
case "category":
|
|
@@ -719,7 +721,7 @@ function describeChartSelection(controller, selection = controller.getState().se
|
|
|
719
721
|
const series = controller.getSeries(selection.seriesId);
|
|
720
722
|
const value = _optionalChain([series, 'optionalAccess', _48 => _48.values, 'access', _49 => _49[selection.index]]);
|
|
721
723
|
const x = _optionalChain([series, 'optionalAccess', _50 => _50.x, 'optionalAccess', _51 => _51[selection.index]]);
|
|
722
|
-
if (x !== void 0 && x !== null &&
|
|
724
|
+
if (x !== void 0 && x !== null && _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy") return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _52 => _52.name]), () => ( selection.seriesId))}: (${x}, ${_nullishCoalesce(value, () => ( "blank"))})`;
|
|
723
725
|
return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _53 => _53.name]), () => ( selection.seriesId))} \xB7 ${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}: ${_nullishCoalesce(value, () => ( "blank"))}`;
|
|
724
726
|
}
|
|
725
727
|
}
|
|
@@ -792,13 +794,13 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
792
794
|
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(", ")}.`);
|
|
793
795
|
return index;
|
|
794
796
|
};
|
|
795
|
-
const table = () =>
|
|
797
|
+
const table = () => _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, spec());
|
|
796
798
|
const Parser = () => _nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser));
|
|
797
799
|
const getChart = {
|
|
798
800
|
name: "get_chart",
|
|
799
801
|
title: "Read the chart",
|
|
800
802
|
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.",
|
|
801
|
-
inputSchema: { type: "object", properties: { width:
|
|
803
|
+
inputSchema: { type: "object", properties: { width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT }, additionalProperties: false },
|
|
802
804
|
annotations: { title: "Read the chart", ...READ },
|
|
803
805
|
handler: ({ width = size.width, height = size.height }) => {
|
|
804
806
|
const reason = readOnlyReason();
|
|
@@ -806,7 +808,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
806
808
|
spec: controller.toJSON(),
|
|
807
809
|
table: table(),
|
|
808
810
|
selection: controller.getState().selection,
|
|
809
|
-
summary:
|
|
811
|
+
summary: _chunkGTZXF4BIcjs.summarizeChart.call(void 0, controller.toJSON(), { width, height }),
|
|
810
812
|
issues: controller.getState().issues,
|
|
811
813
|
...reason ? { readOnly: reason } : {}
|
|
812
814
|
};
|
|
@@ -818,12 +820,12 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
818
820
|
description: 'Draws the chart without changing it, to check it visually: SVG text by default, or a PNG image (format "png") when the host can rasterize. Look for overlapping or hidden labels; get_chart lists layout warnings without a render.',
|
|
819
821
|
inputSchema: {
|
|
820
822
|
type: "object",
|
|
821
|
-
properties: { width:
|
|
823
|
+
properties: { width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT, format: { type: "string", enum: ["svg", "png"], description: "svg (default) or png (only when the host supports it)." } },
|
|
822
824
|
additionalProperties: false
|
|
823
825
|
},
|
|
824
826
|
annotations: { title: "Render the chart", ...READ },
|
|
825
827
|
handler: async ({ width = size.width, height = size.height, format = "svg" }) => {
|
|
826
|
-
const svg =
|
|
828
|
+
const svg = _chunkGTZXF4BIcjs.chartToSvg.call(void 0, controller.toJSON(), { width, height });
|
|
827
829
|
if (format === "png") {
|
|
828
830
|
if (!options.rasterize) fail2('This host cannot rasterize charts; call render_chart with format "svg".');
|
|
829
831
|
const image = await options.rasterize(svg, { width, height });
|
|
@@ -848,8 +850,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
848
850
|
handler: ({ colors, surface }) => {
|
|
849
851
|
const s = spec();
|
|
850
852
|
const visible = s.series.filter((x) => !x.hidden);
|
|
851
|
-
const own =
|
|
852
|
-
return { colors: _nullishCoalesce(colors, () => ( own)), ...
|
|
853
|
+
const own = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _54 => _54[0], 'optionalAccess', _55 => _55.pointColors, 'optionalAccess', _56 => _56[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
|
|
854
|
+
return { colors: _nullishCoalesce(colors, () => ( own)), ..._chunkJOX6MJW4cjs.checkChartColors.call(void 0, _nullishCoalesce(colors, () => ( own)), { surface }) };
|
|
853
855
|
}
|
|
854
856
|
};
|
|
855
857
|
const recommend = {
|
|
@@ -871,7 +873,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
871
873
|
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.",
|
|
872
874
|
inputSchema: {
|
|
873
875
|
type: "object",
|
|
874
|
-
properties: { series:
|
|
876
|
+
properties: { series: _chunkTGBCBQFVcjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index on the series (0 = first)." } },
|
|
875
877
|
required: ["series", "index"],
|
|
876
878
|
additionalProperties: false
|
|
877
879
|
},
|
|
@@ -893,8 +895,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
893
895
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
894
896
|
annotations: { title: "List chart presets", ...READ },
|
|
895
897
|
handler: () => ({
|
|
896
|
-
layouts:
|
|
897
|
-
colorSchemes:
|
|
898
|
+
layouts: _chunkGTZXF4BIcjs.CHART_LAYOUT_PRESETS.map(({ id, label, description }) => ({ id, label, description })),
|
|
899
|
+
colorSchemes: _chunkGTZXF4BIcjs.CHART_COLOR_SCHEMES.map(({ id, label, description, palette }) => ({ id, label, description, palette }))
|
|
898
900
|
})
|
|
899
901
|
};
|
|
900
902
|
const exportMermaid = {
|
|
@@ -903,7 +905,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
903
905
|
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.',
|
|
904
906
|
inputSchema: { type: "object", properties: { meta: { type: "boolean", description: "Include the round-trip comment (default true)." } }, additionalProperties: false },
|
|
905
907
|
annotations: { title: "Export chart as Mermaid", ...READ },
|
|
906
|
-
handler: ({ meta = true }) => ({ mermaid:
|
|
908
|
+
handler: ({ meta = true }) => ({ mermaid: _chunkGTZXF4BIcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta }) })
|
|
907
909
|
};
|
|
908
910
|
const exportOoxml = {
|
|
909
911
|
name: "export_chart_ooxml",
|
|
@@ -911,7 +913,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
911
913
|
description: "Returns the chart as a DrawingML chart part (c:chartSpace) for Word or PowerPoint files, with what could not be written as sentences.",
|
|
912
914
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
913
915
|
annotations: { title: "Export chart as Office XML", ...READ },
|
|
914
|
-
handler: () =>
|
|
916
|
+
handler: () => _chunk3JNRQVTScjs.chartToOoxml.call(void 0, controller.toJSON())
|
|
915
917
|
};
|
|
916
918
|
const updateChart = {
|
|
917
919
|
name: "update_chart",
|
|
@@ -919,7 +921,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
919
921
|
description: "Changes how the chart looks, as one undo step: type, titles, axes (xAxis = categories or numeric x, yAxis = values, yAxis2 = secondary values), 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.",
|
|
920
922
|
inputSchema: {
|
|
921
923
|
type: "object",
|
|
922
|
-
properties:
|
|
924
|
+
properties: _chunkTGBCBQFVcjs.CHART_UPDATE_PROPERTIES,
|
|
923
925
|
additionalProperties: false
|
|
924
926
|
},
|
|
925
927
|
annotations: { title: "Change chart presentation", ...WRITE_IDEMPOTENT },
|
|
@@ -940,7 +942,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
940
942
|
series: {
|
|
941
943
|
type: "array",
|
|
942
944
|
description: "The new series (replaces all).",
|
|
943
|
-
items: { type: "object", properties: { id: { type: "string", description: "Stable id (optional)." }, ...
|
|
945
|
+
items: { type: "object", properties: { id: { type: "string", description: "Stable id (optional)." }, ..._chunkTGBCBQFVcjs.SERIES_PROPS }, required: ["name", "values"], additionalProperties: false }
|
|
944
946
|
}
|
|
945
947
|
},
|
|
946
948
|
additionalProperties: false
|
|
@@ -963,7 +965,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
963
965
|
type: "array",
|
|
964
966
|
minItems: 1,
|
|
965
967
|
description: "Values to set.",
|
|
966
|
-
items: { type: "object", properties: { series:
|
|
968
|
+
items: { type: "object", properties: { series: _chunkTGBCBQFVcjs.SERIES_REF, category: _chunkTGBCBQFVcjs.CATEGORY_REF, value: _chunkTGBCBQFVcjs.VALUE }, required: ["series", "category", "value"], additionalProperties: false }
|
|
967
969
|
}
|
|
968
970
|
},
|
|
969
971
|
required: ["cells"],
|
|
@@ -972,7 +974,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
972
974
|
annotations: { title: "Set chart values", ...WRITE_IDEMPOTENT },
|
|
973
975
|
handler: async ({ cells }) => {
|
|
974
976
|
const resolved = cells.map((c) => ({ seriesId: seriesById(c.series).id, index: categoryIndex(c.category), value: c.value }));
|
|
975
|
-
const parsed = resolved.map((c) =>
|
|
977
|
+
const parsed = resolved.map((c) => _chunkJOX6MJW4cjs.parseChartValue.call(void 0, c.value));
|
|
976
978
|
const bad = resolved.find((_, i) => parsed[i] === void 0);
|
|
977
979
|
if (bad) fail2(`"${String(bad.value)}" is not a number; pass a number, numeric text or null for a gap. Nothing was changed.`);
|
|
978
980
|
if (options.director && parsed.every((v) => typeof v === "number")) {
|
|
@@ -989,7 +991,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
989
991
|
description: "Adds a series (values padded to the categories) and selects it. Returns its id and stored values.",
|
|
990
992
|
inputSchema: {
|
|
991
993
|
type: "object",
|
|
992
|
-
properties: { ...
|
|
994
|
+
properties: { ..._chunkTGBCBQFVcjs.SERIES_PROPS, id: { type: "string", description: "Id to use (default: series-N)." }, at: { type: "integer", minimum: 0, description: "Position (default: last)." } },
|
|
993
995
|
required: ["name"],
|
|
994
996
|
additionalProperties: false
|
|
995
997
|
},
|
|
@@ -1007,7 +1009,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1007
1009
|
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.",
|
|
1008
1010
|
inputSchema: {
|
|
1009
1011
|
type: "object",
|
|
1010
|
-
properties: { series:
|
|
1012
|
+
properties: { series: _chunkTGBCBQFVcjs.SERIES_REF, ...Object.fromEntries(Object.entries(_chunkTGBCBQFVcjs.SERIES_PROPS).filter(([k]) => k !== "values")) },
|
|
1011
1013
|
required: ["series"],
|
|
1012
1014
|
additionalProperties: false
|
|
1013
1015
|
},
|
|
@@ -1023,7 +1025,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1023
1025
|
name: "remove_chart_series",
|
|
1024
1026
|
title: "Delete a series",
|
|
1025
1027
|
description: "Deletes a series and its values. Returns the remaining series ids.",
|
|
1026
|
-
inputSchema: { type: "object", properties: { series:
|
|
1028
|
+
inputSchema: { type: "object", properties: { series: _chunkTGBCBQFVcjs.SERIES_REF }, required: ["series"], additionalProperties: false },
|
|
1027
1029
|
annotations: { title: "Delete a series", ...DESTRUCTIVE },
|
|
1028
1030
|
handler: ({ series }) => {
|
|
1029
1031
|
resolve(controller.removeSeries(seriesById(series).id));
|
|
@@ -1049,7 +1051,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1049
1051
|
name: "remove_chart_category",
|
|
1050
1052
|
title: "Delete a category",
|
|
1051
1053
|
description: "Deletes a category and its value in every series. Returns the remaining categories.",
|
|
1052
|
-
inputSchema: { type: "object", properties: { category:
|
|
1054
|
+
inputSchema: { type: "object", properties: { category: _chunkTGBCBQFVcjs.CATEGORY_REF }, required: ["category"], additionalProperties: false },
|
|
1053
1055
|
annotations: { title: "Delete a category", ...DESTRUCTIVE },
|
|
1054
1056
|
handler: ({ category }) => {
|
|
1055
1057
|
resolve(controller.removeCategory(categoryIndex(category)));
|
|
@@ -1092,7 +1094,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1092
1094
|
annotations: { title: "Import a Mermaid chart", ...DESTRUCTIVE },
|
|
1093
1095
|
handler: ({ mermaid }) => {
|
|
1094
1096
|
const fenced = /```(?:mermaid)?\s*\n([\s\S]*?)```/.exec(mermaid);
|
|
1095
|
-
const read =
|
|
1097
|
+
const read = _chunkGTZXF4BIcjs.chartFromMermaid.call(void 0, fenced ? fenced[1] : mermaid);
|
|
1096
1098
|
if (!read.family) fail2(read.issues.map((i) => i.message).join(" ") || "Expected Mermaid starting with xychart-beta, pie or radar-beta.");
|
|
1097
1099
|
resolve(controller.update({ ...read.spec }, { label: "Import Mermaid chart" }));
|
|
1098
1100
|
return { spec: controller.toJSON(), issues: read.issues };
|
|
@@ -1105,7 +1107,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1105
1107
|
inputSchema: { type: "object", properties: { xml: { type: "string", description: "The chart part XML, e.g. word/charts/chart1.xml." } }, required: ["xml"], additionalProperties: false },
|
|
1106
1108
|
annotations: { title: "Import an Office chart", ...DESTRUCTIVE },
|
|
1107
1109
|
handler: ({ xml }) => {
|
|
1108
|
-
const read =
|
|
1110
|
+
const read = _chunk3JNRQVTScjs.chartFromOoxml.call(void 0, xml, { DOMParser: Parser() });
|
|
1109
1111
|
if (read.issues.some((i) => i.path === "" || i.path === "plotArea")) fail2(read.issues.map((i) => i.message).join(" "));
|
|
1110
1112
|
resolve(controller.update({ ...read.spec }, { label: "Import Office chart" }));
|
|
1111
1113
|
return { spec: controller.toJSON(), issues: read.issues.map((i) => i.message), unsupported: read.unsupported, lossless: read.lossless };
|
|
@@ -1115,7 +1117,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1115
1117
|
name: "add_chart_trendline",
|
|
1116
1118
|
title: "Add a trendline",
|
|
1117
1119
|
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.",
|
|
1118
|
-
inputSchema: { type: "object", properties: { series:
|
|
1120
|
+
inputSchema: { type: "object", properties: { series: _chunkTGBCBQFVcjs.SERIES_REF, ..._chunkTGBCBQFVcjs.TRENDLINE_PROPS }, required: ["series", "type"], additionalProperties: false },
|
|
1119
1121
|
annotations: { title: "Add a trendline", ...WRITE },
|
|
1120
1122
|
handler: ({ series, ...line }) => {
|
|
1121
1123
|
const s = seriesById(series);
|
|
@@ -1129,7 +1131,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1129
1131
|
description: "Deletes a trendline from a series. Returns the series' remaining trendlines.",
|
|
1130
1132
|
inputSchema: {
|
|
1131
1133
|
type: "object",
|
|
1132
|
-
properties: { series:
|
|
1134
|
+
properties: { series: _chunkTGBCBQFVcjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index on the series (0 = first)." } },
|
|
1133
1135
|
required: ["series", "index"],
|
|
1134
1136
|
additionalProperties: false
|
|
1135
1137
|
},
|
|
@@ -1147,8 +1149,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1147
1149
|
inputSchema: {
|
|
1148
1150
|
type: "object",
|
|
1149
1151
|
properties: {
|
|
1150
|
-
layout: { type: "string", enum:
|
|
1151
|
-
colors: { type: "string", enum:
|
|
1152
|
+
layout: { type: "string", enum: _chunkGTZXF4BIcjs.CHART_LAYOUT_PRESETS.map((p) => p.id), description: "Quick layout id." },
|
|
1153
|
+
colors: { type: "string", enum: _chunkGTZXF4BIcjs.CHART_COLOR_SCHEMES.map((p) => p.id), description: "Colour scheme id." }
|
|
1152
1154
|
},
|
|
1153
1155
|
additionalProperties: false
|
|
1154
1156
|
},
|
|
@@ -1177,8 +1179,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1177
1179
|
type: "object",
|
|
1178
1180
|
properties: {
|
|
1179
1181
|
kind: { type: "string", enum: ["none", "chart", "title", "subtitle", "legend", "axis", "series", "point", "category", "trendline"], description: "What to select." },
|
|
1180
|
-
series: { ...
|
|
1181
|
-
category: { ...
|
|
1182
|
+
series: { ..._chunkTGBCBQFVcjs.SERIES_REF, description: "Series id or name (series, point, trendline)." },
|
|
1183
|
+
category: { ..._chunkTGBCBQFVcjs.CATEGORY_REF, description: "Category index or label (point, category)." },
|
|
1182
1184
|
axis: { type: "string", enum: ["x", "y", "y2"], description: "Axis (axis)." },
|
|
1183
1185
|
index: { type: "integer", minimum: 0, description: "Trendline index (trendline)." }
|
|
1184
1186
|
},
|
|
@@ -1236,15 +1238,15 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1236
1238
|
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 },
|
|
1237
1239
|
fine: { type: "boolean", description: "Move a tenth as far (Alt)." },
|
|
1238
1240
|
lockAxis: { type: "boolean", description: "Scatter charts: change only the axis moved along most (Shift)." },
|
|
1239
|
-
width:
|
|
1240
|
-
height:
|
|
1241
|
+
width: _chunkTGBCBQFVcjs.WIDTH,
|
|
1242
|
+
height: _chunkTGBCBQFVcjs.HEIGHT
|
|
1241
1243
|
},
|
|
1242
1244
|
required: ["from", "to"],
|
|
1243
1245
|
additionalProperties: false
|
|
1244
1246
|
},
|
|
1245
1247
|
annotations: { title: "Drag a chart point", ...WRITE },
|
|
1246
1248
|
handler: ({ from, to, fine, lockAxis, width = size.width, height = size.height }) => {
|
|
1247
|
-
const scene =
|
|
1249
|
+
const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, controller.toJSON(), { width, height });
|
|
1248
1250
|
const start = { x: from.x * width, y: from.y * height };
|
|
1249
1251
|
const target = chartHitTest(scene, start);
|
|
1250
1252
|
if (_optionalChain([target, 'optionalAccess', _64 => _64.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.`);
|
|
@@ -1274,7 +1276,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1274
1276
|
},
|
|
1275
1277
|
annotations: { title: "Press a key on the chart", ...DESTRUCTIVE },
|
|
1276
1278
|
handler: ({ key: k, shift, alt }) => {
|
|
1277
|
-
const scene =
|
|
1279
|
+
const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, controller.toJSON(), size);
|
|
1278
1280
|
const used = handleChartKey(controller, scene, { key: k, shiftKey: shift, altKey: alt });
|
|
1279
1281
|
const sel = controller.getState().selection;
|
|
1280
1282
|
const value = _optionalChain([sel, 'optionalAccess', _69 => _69.kind]) === "point" ? _nullishCoalesce(_optionalChain([controller, 'access', _70 => _70.getSeries, 'call', _71 => _71(sel.seriesId), 'optionalAccess', _72 => _72.values, 'access', _73 => _73[sel.index]]), () => ( null)) : void 0;
|
|
@@ -1382,12 +1384,12 @@ var ChartStream = (_class = class {
|
|
|
1382
1384
|
if (format === "json") {
|
|
1383
1385
|
const value = complete ? safeParse(text) : parsePartialChartJson(text);
|
|
1384
1386
|
if (value !== void 0) {
|
|
1385
|
-
const read =
|
|
1387
|
+
const read = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, value);
|
|
1386
1388
|
spec = read.spec;
|
|
1387
1389
|
issues = complete ? read.issues : [];
|
|
1388
1390
|
}
|
|
1389
1391
|
} else {
|
|
1390
|
-
const read =
|
|
1392
|
+
const read = _chunkGTZXF4BIcjs.chartFromMermaid.call(void 0, text, { partial: !complete });
|
|
1391
1393
|
if (read.family) {
|
|
1392
1394
|
spec = read.spec;
|
|
1393
1395
|
issues = complete ? read.issues : [];
|
|
@@ -1528,7 +1530,7 @@ function planChartCommand(spec, scene, command, speed = 1) {
|
|
|
1528
1530
|
const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _76 => _76.values, 'access', _77 => _77[command.index]]), () => ( 0));
|
|
1529
1531
|
const scale = _optionalChain([series, 'optionalAccess', _78 => _78.axis]) === "secondary" ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
|
|
1530
1532
|
if (at && scale) {
|
|
1531
|
-
const px =
|
|
1533
|
+
const px = _chunkGTZXF4BIcjs.linearMap.call(void 0, command.value, scale.domain, scale.range);
|
|
1532
1534
|
const to = scale.axis === "y" ? { x: at.x, y: px } : { x: px, y: at.y };
|
|
1533
1535
|
steps.push({ type: "move", to: at, ms: ms(380) }, { type: "press" }, { type: "drag", to, ms: ms(520), from, value: command.value }, { type: "release" });
|
|
1534
1536
|
} 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 });
|
|
@@ -1797,5 +1799,5 @@ var ChartDirector = (_class3 = class {
|
|
|
1797
1799
|
|
|
1798
1800
|
|
|
1799
1801
|
|
|
1800
|
-
exports.CHART_AXIS_KINDS =
|
|
1802
|
+
exports.CHART_AXIS_KINDS = _chunkJOX6MJW4cjs.CHART_AXIS_KINDS; exports.CHART_COLOR_SCHEMES = _chunkGTZXF4BIcjs.CHART_COLOR_SCHEMES; exports.CHART_CURVES = _chunkJOX6MJW4cjs.CHART_CURVES; exports.CHART_DATE_STEPS = _chunkGTZXF4BIcjs.CHART_DATE_STEPS; exports.CHART_LABEL_POSITIONS = _chunkJOX6MJW4cjs.CHART_LABEL_POSITIONS; exports.CHART_LAYOUT_PRESETS = _chunkGTZXF4BIcjs.CHART_LAYOUT_PRESETS; exports.CHART_LEGEND_POSITIONS = _chunkJOX6MJW4cjs.CHART_LEGEND_POSITIONS; exports.CHART_MARKERS = _chunkJOX6MJW4cjs.CHART_MARKERS; exports.CHART_MERMAID_META_PREFIX = _chunkGTZXF4BIcjs.CHART_MERMAID_META_PREFIX; exports.CHART_NUMBER_STYLES = _chunkJOX6MJW4cjs.CHART_NUMBER_STYLES; exports.CHART_OOXML_CONTENT_TYPE = _chunk3JNRQVTScjs.CHART_OOXML_CONTENT_TYPE; exports.CHART_OOXML_NS = _chunk3JNRQVTScjs.CHART_OOXML_NS; exports.CHART_OOXML_RELATIONSHIP = _chunk3JNRQVTScjs.CHART_OOXML_RELATIONSHIP; exports.CHART_ORIENTATIONS = _chunkJOX6MJW4cjs.CHART_ORIENTATIONS; exports.CHART_PALETTE_SHADES = _chunkJOX6MJW4cjs.CHART_PALETTE_SHADES; exports.CHART_PRESENCE_COLORS = CHART_PRESENCE_COLORS; exports.CHART_SERIES_TYPES = _chunkJOX6MJW4cjs.CHART_SERIES_TYPES; exports.CHART_STACKINGS = _chunkJOX6MJW4cjs.CHART_STACKINGS; exports.CHART_TRENDLINE_TYPES = _chunkJOX6MJW4cjs.CHART_TRENDLINE_TYPES; exports.CHART_TYPES = _chunkJOX6MJW4cjs.CHART_TYPES; exports.CHART_TYPE_LABELS = _chunkJOX6MJW4cjs.CHART_TYPE_LABELS; exports.CSS_VARIABLE_CHART_THEME = _chunkJOX6MJW4cjs.CSS_VARIABLE_CHART_THEME; exports.ChartController = _chunkGTZXF4BIcjs.ChartController; exports.ChartDirector = ChartDirector; exports.ChartPresence = ChartPresence; exports.ChartStream = ChartStream; exports.DEFAULT_CHART_PALETTE = _chunkJOX6MJW4cjs.DEFAULT_CHART_PALETTE; exports.DEFAULT_CHART_THEME = _chunkJOX6MJW4cjs.DEFAULT_CHART_THEME; exports.MAX_CHART_DATA_LABELS = _chunkGTZXF4BIcjs.MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = _chunkGTZXF4BIcjs.MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = _chunkGTZXF4BIcjs.MAX_CHART_MARKERS; exports.analyzeChartTable = analyzeChartTable; exports.blendChartScenes = blendChartScenes; exports.canDragChartPoint = canDragChartPoint; exports.chartBoxStats = _chunkGTZXF4BIcjs.chartBoxStats; exports.chartClientToScene = chartClientToScene; exports.chartColorDistance = _chunkJOX6MJW4cjs.chartColorDistance; exports.chartColorInputValue = _chunkJOX6MJW4cjs.chartColorInputValue; exports.chartColorsByCategory = _chunkJOX6MJW4cjs.chartColorsByCategory; exports.chartContrastRatio = _chunkJOX6MJW4cjs.chartContrastRatio; exports.chartDataFromTable = _chunkJOX6MJW4cjs.chartDataFromTable; exports.chartDataToTable = _chunkJOX6MJW4cjs.chartDataToTable; exports.chartDateLabels = _chunkGTZXF4BIcjs.chartDateLabels; exports.chartDateToSerial = _chunkGTZXF4BIcjs.chartDateToSerial; exports.chartFamily = _chunkJOX6MJW4cjs.chartFamily; exports.chartFormatToCode = _chunk3JNRQVTScjs.chartFormatToCode; exports.chartFromMermaid = _chunkGTZXF4BIcjs.chartFromMermaid; exports.chartFromOoxml = _chunk3JNRQVTScjs.chartFromOoxml; exports.chartFromTable = chartFromTable; exports.chartHistogram = _chunkGTZXF4BIcjs.chartHistogram; exports.chartHitTest = chartHitTest; exports.chartLuminance = _chunkJOX6MJW4cjs.chartLuminance; exports.chartMermaidFamily = _chunkGTZXF4BIcjs.chartMermaidFamily; exports.chartMovingAverage = _chunkGTZXF4BIcjs.chartMovingAverage; exports.chartPointAnchor = chartPointAnchor; exports.chartPointColor = _chunkJOX6MJW4cjs.chartPointColor; exports.chartPresetPatch = _chunkGTZXF4BIcjs.chartPresetPatch; exports.chartQuantile = _chunkGTZXF4BIcjs.chartQuantile; exports.chartRgbToHex = _chunkJOX6MJW4cjs.chartRgbToHex; exports.chartRgbToOklab = _chunkJOX6MJW4cjs.chartRgbToOklab; exports.chartSceneToDomSpec = _chunkGTZXF4BIcjs.chartSceneToDomSpec; exports.chartSceneToSvg = _chunkGTZXF4BIcjs.chartSceneToSvg; exports.chartSerialToDate = _chunkGTZXF4BIcjs.chartSerialToDate; exports.chartSeriesColor = _chunkJOX6MJW4cjs.chartSeriesColor; exports.chartSeriesType = _chunkJOX6MJW4cjs.chartSeriesType; exports.chartSliceColor = _chunkJOX6MJW4cjs.chartSliceColor; exports.chartSquarify = _chunkGTZXF4BIcjs.chartSquarify; exports.chartSupportsTrendlines = _chunkGTZXF4BIcjs.chartSupportsTrendlines; exports.chartTextBaseline = _chunkGTZXF4BIcjs.chartTextBaseline; exports.chartTextOn = _chunkJOX6MJW4cjs.chartTextOn; exports.chartTextTransform = _chunkGTZXF4BIcjs.chartTextTransform; exports.chartToMermaid = _chunkGTZXF4BIcjs.chartToMermaid; exports.chartToOoxml = _chunk3JNRQVTScjs.chartToOoxml; exports.chartToSvg = _chunkGTZXF4BIcjs.chartToSvg; exports.chartTrendlineName = _chunkGTZXF4BIcjs.chartTrendlineName; exports.chartValueAtPoint = _chunkGTZXF4BIcjs.chartValueAtPoint; exports.chartXAtPoint = _chunkGTZXF4BIcjs.chartXAtPoint; exports.checkChartColors = _chunkJOX6MJW4cjs.checkChartColors; exports.cloneChartSeries = _chunkJOX6MJW4cjs.cloneChartSeries; exports.cloneChartSpec = _chunkJOX6MJW4cjs.cloneChartSpec; exports.compileChartFormatCode = _chunkGTZXF4BIcjs.compileChartFormatCode; exports.contrastingTextColor = _chunkGTZXF4BIcjs.contrastingTextColor; exports.createChartCommands = createChartCommands; exports.createChartController = _chunkGTZXF4BIcjs.createChartController; exports.createChartSpec = _chunkJOX6MJW4cjs.createChartSpec; exports.createChartToolProvider = createChartToolProvider; exports.createInstantChartClock = createInstantChartClock; exports.cyclePaletteColor = _chunkJOX6MJW4cjs.cyclePaletteColor; exports.decimateChartPoints = _chunkGTZXF4BIcjs.decimateChartPoints; exports.defaultChartAxis = _chunkJOX6MJW4cjs.defaultChartAxis; exports.describeChart = _chunkGTZXF4BIcjs.describeChart; exports.describeChartSelection = describeChartSelection; exports.easeChartTween = easeChartTween; exports.estimateChartTextWidth = _chunkGTZXF4BIcjs.estimateChartTextWidth; exports.findMermaidCharts = _chunkGTZXF4BIcjs.findMermaidCharts; exports.fitChartTrendline = _chunkGTZXF4BIcjs.fitChartTrendline; exports.formatChartDate = _chunkGTZXF4BIcjs.formatChartDate; exports.formatChartNumber = _chunkGTZXF4BIcjs.formatChartNumber; exports.formatChartValueWithCode = _chunkGTZXF4BIcjs.formatChartValueWithCode; exports.handleChartKey = handleChartKey; exports.isCartesianChart = _chunkJOX6MJW4cjs.isCartesianChart; exports.isXyChart = _chunkJOX6MJW4cjs.isXyChart; exports.layoutChart = _chunkGTZXF4BIcjs.layoutChart; exports.layoutSparkline = _chunkGTZXF4BIcjs.layoutSparkline; exports.linearMap = _chunkGTZXF4BIcjs.linearMap; exports.monochromeChartPalette = _chunkGTZXF4BIcjs.monochromeChartPalette; exports.niceScale = _chunkGTZXF4BIcjs.niceScale; exports.niceStep = _chunkGTZXF4BIcjs.niceStep; exports.normalizeChartAxis = _chunkJOX6MJW4cjs.normalizeChartAxis; exports.normalizeChartSpec = _chunkJOX6MJW4cjs.normalizeChartSpec; exports.normalizeChartTrendline = _chunkJOX6MJW4cjs.normalizeChartTrendline; exports.normalizeChartValues = _chunkJOX6MJW4cjs.normalizeChartValues; exports.parseChartColor = _chunkJOX6MJW4cjs.parseChartColor; exports.parseChartDate = _chunkGTZXF4BIcjs.parseChartDate; exports.parseChartValue = _chunkJOX6MJW4cjs.parseChartValue; exports.parsePartialChartJson = parsePartialChartJson; exports.planChartCommand = planChartCommand; exports.realChartClock = realChartClock; exports.recommendChartTypes = recommendChartTypes; exports.recommendForShape = recommendForShape; exports.sameChartSelection = _chunkGTZXF4BIcjs.sameChartSelection; exports.shadeChartColor = _chunkJOX6MJW4cjs.shadeChartColor; exports.simulateChartVision = _chunkJOX6MJW4cjs.simulateChartVision; exports.snapChartDragValue = snapChartDragValue; exports.snapChartValue = _chunkGTZXF4BIcjs.snapChartValue; exports.sparklineToSvg = _chunkGTZXF4BIcjs.sparklineToSvg; exports.startChartPointDrag = startChartPointDrag; exports.stepDecimals = _chunkGTZXF4BIcjs.stepDecimals; exports.summarizeChart = _chunkGTZXF4BIcjs.summarizeChart; exports.summarizeChartSeries = _chunkGTZXF4BIcjs.summarizeChartSeries; exports.trendNumberText = _chunkGTZXF4BIcjs.trendNumberText; exports.uniqueChartSeriesId = _chunkJOX6MJW4cjs.uniqueChartSeriesId;
|
|
1801
1803
|
//# sourceMappingURL=index.cjs.map
|