@pixerate/editor 0.51.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 +475 -124
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +174 -25
- package/dist/chart/index.d.ts +174 -25
- package/dist/chart/index.js +375 -24
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-GJBIVWB2.js → chunk-3S72F46R.js} +387 -9
- 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-MR2764X2.js → chunk-AGGUNWT6.js} +2 -322
- package/dist/chunk-AGGUNWT6.js.map +1 -0
- package/dist/{chunk-T6XU4B54.js → chunk-BQQZ6MOI.js} +7 -7
- package/dist/{chunk-LNKZPIQD.cjs → chunk-C3JHII3M.cjs} +67 -67
- package/dist/{chunk-LNKZPIQD.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-3JNRQVTS.cjs → chunk-NN3JGUSX.cjs} +402 -24
- package/dist/chunk-NN3JGUSX.cjs.map +1 -0
- package/dist/{chunk-3CC7OPUQ.cjs → chunk-O6FO6VI3.cjs} +3 -323
- package/dist/chunk-O6FO6VI3.cjs.map +1 -0
- package/dist/{chunk-DQPBQXKG.js → chunk-OIKYP7XC.js} +8 -8
- 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-2Q46FKZK.cjs → chunk-YZZMX6V7.cjs} +25 -25
- package/dist/{chunk-2Q46FKZK.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 +5 -5
- package/dist/export/index.js +4 -4
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/extensions/index.js +6 -6
- 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 +15 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -113
- package/dist/index.d.ts +6 -113
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/zip-4nG0YAH7.d.cts +110 -0
- package/dist/zip-4nG0YAH7.d.ts +110 -0
- package/package.json +1 -1
- package/dist/chunk-3CC7OPUQ.cjs.map +0 -1
- package/dist/chunk-3JNRQVTS.cjs.map +0 -1
- package/dist/chunk-5TWIN7ZJ.js.map +0 -1
- package/dist/chunk-GJBIVWB2.js.map +0 -1
- package/dist/chunk-GTZXF4BI.cjs.map +0 -1
- package/dist/chunk-JOX6MJW4.cjs.map +0 -1
- package/dist/chunk-MR2764X2.js.map +0 -1
- package/dist/chunk-OV7UAKIY.js.map +0 -1
- package/dist/chunk-TGBCBQFV.cjs.map +0 -1
- package/dist/chunk-WBOAXDKD.js.map +0 -1
- /package/dist/{chunk-T6XU4B54.js.map → chunk-BQQZ6MOI.js.map} +0 -0
- /package/dist/{chunk-DQPBQXKG.js.map → chunk-OIKYP7XC.js.map} +0 -0
- /package/dist/{chunk-QFTVLEVN.js.map → chunk-RIXTW3C4.js.map} +0 -0
package/dist/agent/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkDK6QBGCScjs = require('../chunk-DK6QBGCS.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -52,14 +52,14 @@ var _chunkRIWPYSKUcjs = require('../chunk-RIWPYSKU.cjs');
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var _chunkP43HUQRXcjs = require('../chunk-P43HUQRX.cjs');
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
var
|
|
58
|
+
var _chunkNK3WL5TJcjs = require('../chunk-NK3WL5TJ.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
var
|
|
62
|
+
var _chunkCKRNELPOcjs = require('../chunk-CKRNELPO.cjs');
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
@@ -420,14 +420,14 @@ var SIZE_WIDTH = {
|
|
|
420
420
|
};
|
|
421
421
|
var SIZE_HEIGHT = { type: "number", minimum: 50, maximum: 4096, description: "Height in pixels (default 320)." };
|
|
422
422
|
var SPEC_PROPERTIES = {
|
|
423
|
-
...
|
|
423
|
+
..._chunkDK6QBGCScjs.CHART_UPDATE_PROPERTIES,
|
|
424
424
|
categories: { type: "array", items: { type: "string" }, description: "Category labels in order (x axis labels, or pie slices)." },
|
|
425
425
|
series: {
|
|
426
426
|
type: "array",
|
|
427
427
|
description: "The series, each with one value per category (padded with gaps).",
|
|
428
428
|
items: {
|
|
429
429
|
type: "object",
|
|
430
|
-
properties: { id: { type: "string", description: "Stable id (default: from the name)." }, ...
|
|
430
|
+
properties: { id: { type: "string", description: "Stable id (default: from the name)." }, ..._chunkDK6QBGCScjs.SERIES_PROPS },
|
|
431
431
|
required: ["name", "values"],
|
|
432
432
|
additionalProperties: false
|
|
433
433
|
}
|
|
@@ -438,7 +438,7 @@ function cleanSeries(series) {
|
|
|
438
438
|
return series.map((s) => s && typeof s === "object" ? Object.fromEntries(Object.entries(s).filter(([, v]) => v !== null)) : s);
|
|
439
439
|
}
|
|
440
440
|
function checkedSpec(input) {
|
|
441
|
-
const { spec, issues } =
|
|
441
|
+
const { spec, issues } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, { ...input, ...input.series !== void 0 ? { series: cleanSeries(input.series) } : {} });
|
|
442
442
|
if (issues.length) throw new Error(`The chart was not changed: ${issues.map((i) => i.message).join(" ")}`);
|
|
443
443
|
return spec;
|
|
444
444
|
}
|
|
@@ -453,14 +453,14 @@ function describe(chart, includeSpec) {
|
|
|
453
453
|
series: spec.series.map((s) => ({ id: s.id, name: s.name })),
|
|
454
454
|
width: _nullishCoalesce(node.attrs.width, () => ( null)),
|
|
455
455
|
height: node.attrs.height,
|
|
456
|
-
description:
|
|
456
|
+
description: _chunkNK3WL5TJcjs.describeChart.call(void 0, spec),
|
|
457
457
|
...includeSpec ? { spec } : {}
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
460
|
function sparklines(doc) {
|
|
461
461
|
const found = [];
|
|
462
462
|
doc.descendants((node, pos) => {
|
|
463
|
-
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label:
|
|
463
|
+
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label: _chunkP43HUQRXcjs.sparklineLabel.call(void 0, node) });
|
|
464
464
|
});
|
|
465
465
|
return found;
|
|
466
466
|
}
|
|
@@ -471,7 +471,7 @@ function checkPosition(editor, at) {
|
|
|
471
471
|
function createDocumentChartTools(editor) {
|
|
472
472
|
const chartType = () => editor().schema.nodes.chart;
|
|
473
473
|
const findChart = (args) => {
|
|
474
|
-
const charts =
|
|
474
|
+
const charts = _chunkP43HUQRXcjs.getDocumentCharts.call(void 0, editor().state.doc);
|
|
475
475
|
const list = charts.map((c) => `"${c.id}" at ${c.pos}`).join(", ") || "none; add one with insert_chart";
|
|
476
476
|
if (args.chartId !== void 0) {
|
|
477
477
|
const chart = charts.find((c) => c.id === args.chartId);
|
|
@@ -498,7 +498,7 @@ function createDocumentChartTools(editor) {
|
|
|
498
498
|
annotations: { title: "List charts in the document", ...READ },
|
|
499
499
|
handler: ({ includeSpec = false }) => {
|
|
500
500
|
const doc = editor().state.doc;
|
|
501
|
-
return { charts:
|
|
501
|
+
return { charts: _chunkP43HUQRXcjs.getDocumentCharts.call(void 0, doc).map((c) => describe(c, includeSpec)), sparklines: editor().schema.nodes.sparkline ? sparklines(doc) : [] };
|
|
502
502
|
}
|
|
503
503
|
};
|
|
504
504
|
const insertChart = {
|
|
@@ -525,7 +525,7 @@ function createDocumentChartTools(editor) {
|
|
|
525
525
|
const node = { type: "chart", attrs: { id, spec, width, ...height !== void 0 ? { height } : {} } };
|
|
526
526
|
const chain = ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true));
|
|
527
527
|
const ok = (at !== void 0 ? chain.insertContentAt(at, node) : chain.insertContent(node)).run();
|
|
528
|
-
const chart =
|
|
528
|
+
const chart = _chunkP43HUQRXcjs.getDocumentCharts.call(void 0, ed.state.doc).find((c) => c.id === id);
|
|
529
529
|
if (!ok || !chart) throw new Error(`A chart cannot go at ${_nullishCoalesce(at, () => ( ed.state.selection.from))}; pass a position between blocks or inside a paragraph.`);
|
|
530
530
|
return { id: chart.id, pos: chart.pos, spec: chart.spec, width: chart.node.attrs.width, height: chart.node.attrs.height };
|
|
531
531
|
}
|
|
@@ -572,8 +572,8 @@ function createDocumentChartTools(editor) {
|
|
|
572
572
|
inputSchema: {
|
|
573
573
|
type: "object",
|
|
574
574
|
properties: {
|
|
575
|
-
values: { type: "array", items:
|
|
576
|
-
kind: { type: "string", enum: [...
|
|
575
|
+
values: { type: "array", items: _chunkDK6QBGCScjs.VALUE, minItems: 1, maxItems: _chunkP43HUQRXcjs.MAX_SPARKLINE_VALUES, description: "Values in order (null for a gap)." },
|
|
576
|
+
kind: { type: "string", enum: [..._chunkP43HUQRXcjs.SPARKLINE_KINDS], description: "line (default), column, or win-loss (sign only)." },
|
|
577
577
|
at: { type: "integer", minimum: 0, description: "Document position inside a paragraph (default: the selection)." },
|
|
578
578
|
width: { type: "number", minimum: 4, maximum: 1e3, description: "Width in pixels (default 80)." },
|
|
579
579
|
height: { type: "number", minimum: 4, maximum: 200, description: "Height in pixels (default 18)." },
|
|
@@ -587,12 +587,12 @@ function createDocumentChartTools(editor) {
|
|
|
587
587
|
handler: ({ values, kind = "line", at, width = 80, height = 18, color = null, label = null }) => {
|
|
588
588
|
const ed = editor();
|
|
589
589
|
checkPosition(ed, at);
|
|
590
|
-
const parsed = values.map((v) =>
|
|
590
|
+
const parsed = values.map((v) => _chunkCKRNELPOcjs.parseChartValue.call(void 0, v));
|
|
591
591
|
const bad = parsed.findIndex((v) => v === void 0);
|
|
592
592
|
if (bad >= 0) throw new Error(`values[${bad}] ("${String(values[bad])}") is not a number; pass numbers, numeric text or null. Nothing was inserted.`);
|
|
593
593
|
const pos = _nullishCoalesce(at, () => ( ed.state.selection.from));
|
|
594
594
|
if (!ed.state.doc.resolve(pos).parent.inlineContent) throw new Error(`Position ${pos} is between blocks; a sparkline goes inside a paragraph (use a position from get_text {blocks: true}).`);
|
|
595
|
-
const stored =
|
|
595
|
+
const stored = _chunkP43HUQRXcjs.normalizeSparklineValues.call(void 0, parsed);
|
|
596
596
|
ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true)).insertContentAt(pos, { type: "sparkline", attrs: { values: stored, kind, width, height, color, label } }).run();
|
|
597
597
|
return { pos, kind, values: stored };
|
|
598
598
|
}
|
|
@@ -643,7 +643,7 @@ function findMatches(editor, query, args, replacement) {
|
|
|
643
643
|
wholeWord: !!args.wholeWord,
|
|
644
644
|
...args.regex ? { regex: true } : { literal: true }
|
|
645
645
|
};
|
|
646
|
-
const result =
|
|
646
|
+
const result = _chunkP43HUQRXcjs.searchDocument.call(void 0, editor.state.doc, query, options, replacement !== void 0 ? { replacement } : {});
|
|
647
647
|
if (result.error) throw new Error(`Invalid search pattern: ${result.error.message}`);
|
|
648
648
|
return { matches: result.matches, truncated: result.truncated };
|
|
649
649
|
}
|
|
@@ -795,7 +795,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
795
795
|
replacement: String(replace).replace(/\r\n?|\n/g, "\r")
|
|
796
796
|
}));
|
|
797
797
|
const tr = ed.state.tr;
|
|
798
|
-
const ends =
|
|
798
|
+
const ends = _chunkP43HUQRXcjs.applyReplacements.call(void 0, tr, chosen);
|
|
799
799
|
ed.view.dispatch(tr.scrollIntoView());
|
|
800
800
|
return {
|
|
801
801
|
replaced: chosen.length,
|
|
@@ -892,7 +892,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
892
892
|
inputSchema: {
|
|
893
893
|
type: "object",
|
|
894
894
|
properties: {
|
|
895
|
-
operation: { type: "string", enum:
|
|
895
|
+
operation: { type: "string", enum: _chunkP43HUQRXcjs.TABLE_ACTIONS.map((a) => a.action), description: "Table operation." },
|
|
896
896
|
at: { type: "integer", minimum: 0, description: "Document position to place the cursor first (e.g. inside a cell)." },
|
|
897
897
|
rows: { type: "integer", minimum: 1, maximum: 100, description: "insertTable: rows (default 3)." },
|
|
898
898
|
cols: { type: "integer", minimum: 1, maximum: 50, description: "insertTable: columns (default 3)." },
|
|
@@ -922,10 +922,10 @@ function createRichTextToolProvider(target, options) {
|
|
|
922
922
|
ed.view.dispatch(ed.state.tr.setSelection(_state.TextSelection.near(ed.state.doc.resolve(at))));
|
|
923
923
|
}
|
|
924
924
|
const action = operation;
|
|
925
|
-
const state =
|
|
925
|
+
const state = _chunkP43HUQRXcjs.getTableActionState.call(void 0, ed, action, params);
|
|
926
926
|
if (state !== true) throw new Error(state);
|
|
927
|
-
|
|
928
|
-
const table =
|
|
927
|
+
_chunkP43HUQRXcjs.runTableAction.call(void 0, ed, action, params);
|
|
928
|
+
const table = _chunkP43HUQRXcjs.getTableState.call(void 0, ed);
|
|
929
929
|
return {
|
|
930
930
|
operation,
|
|
931
931
|
table: table.inTable ? { rows: table.rows, columns: table.columns, row: table.row, column: table.column } : null,
|
|
@@ -941,7 +941,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
941
941
|
if (!ed || ed.isDestroyed) return [];
|
|
942
942
|
if (!ed.isEditable) return [getText, findText, ...charts.read()];
|
|
943
943
|
const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection];
|
|
944
|
-
return [...tools, ...
|
|
944
|
+
return [...tools, ..._chunkP43HUQRXcjs.isTableEnabled.call(void 0, ed) ? [editTable] : [], ...charts.read(), ...charts.write()];
|
|
945
945
|
},
|
|
946
946
|
subscribe: (notify) => {
|
|
947
947
|
const ed = editor();
|
package/dist/agent/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CHART_UPDATE_PROPERTIES,
|
|
3
3
|
SERIES_PROPS,
|
|
4
4
|
VALUE
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-47WWV3LI.js";
|
|
6
6
|
import {
|
|
7
7
|
EDITOR_CANVAS_TOOLS,
|
|
8
8
|
EDITOR_MCP_TOOLS,
|
|
@@ -52,14 +52,14 @@ import {
|
|
|
52
52
|
runTableAction,
|
|
53
53
|
searchDocument,
|
|
54
54
|
sparklineLabel
|
|
55
|
-
} from "../chunk-
|
|
55
|
+
} from "../chunk-RIXTW3C4.js";
|
|
56
56
|
import {
|
|
57
57
|
describeChart
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-VODBAO32.js";
|
|
59
59
|
import {
|
|
60
60
|
normalizeChartSpec,
|
|
61
61
|
parseChartValue
|
|
62
|
-
} from "../chunk-
|
|
62
|
+
} from "../chunk-633QC34G.js";
|
|
63
63
|
import {
|
|
64
64
|
getEditorMarkdown,
|
|
65
65
|
getEditorText,
|