@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/agent/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkTGBCBQFVcjs = require('../chunk-TGBCBQFV.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -52,12 +52,14 @@ var _chunkRIWPYSKUcjs = require('../chunk-RIWPYSKU.cjs');
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var _chunkFEMIVHN3cjs = require('../chunk-FEMIVHN3.cjs');
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
var _chunkGTZXF4BIcjs = require('../chunk-GTZXF4BI.cjs');
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
|
|
62
|
+
var _chunkJOX6MJW4cjs = require('../chunk-JOX6MJW4.cjs');
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
|
|
@@ -418,14 +420,14 @@ var SIZE_WIDTH = {
|
|
|
418
420
|
};
|
|
419
421
|
var SIZE_HEIGHT = { type: "number", minimum: 50, maximum: 4096, description: "Height in pixels (default 320)." };
|
|
420
422
|
var SPEC_PROPERTIES = {
|
|
421
|
-
...
|
|
423
|
+
..._chunkTGBCBQFVcjs.CHART_UPDATE_PROPERTIES,
|
|
422
424
|
categories: { type: "array", items: { type: "string" }, description: "Category labels in order (x axis labels, or pie slices)." },
|
|
423
425
|
series: {
|
|
424
426
|
type: "array",
|
|
425
427
|
description: "The series, each with one value per category (padded with gaps).",
|
|
426
428
|
items: {
|
|
427
429
|
type: "object",
|
|
428
|
-
properties: { id: { type: "string", description: "Stable id (default: from the name)." }, ...
|
|
430
|
+
properties: { id: { type: "string", description: "Stable id (default: from the name)." }, ..._chunkTGBCBQFVcjs.SERIES_PROPS },
|
|
429
431
|
required: ["name", "values"],
|
|
430
432
|
additionalProperties: false
|
|
431
433
|
}
|
|
@@ -436,7 +438,7 @@ function cleanSeries(series) {
|
|
|
436
438
|
return series.map((s) => s && typeof s === "object" ? Object.fromEntries(Object.entries(s).filter(([, v]) => v !== null)) : s);
|
|
437
439
|
}
|
|
438
440
|
function checkedSpec(input) {
|
|
439
|
-
const { spec, issues } =
|
|
441
|
+
const { spec, issues } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, { ...input, ...input.series !== void 0 ? { series: cleanSeries(input.series) } : {} });
|
|
440
442
|
if (issues.length) throw new Error(`The chart was not changed: ${issues.map((i) => i.message).join(" ")}`);
|
|
441
443
|
return spec;
|
|
442
444
|
}
|
|
@@ -451,14 +453,14 @@ function describe(chart, includeSpec) {
|
|
|
451
453
|
series: spec.series.map((s) => ({ id: s.id, name: s.name })),
|
|
452
454
|
width: _nullishCoalesce(node.attrs.width, () => ( null)),
|
|
453
455
|
height: node.attrs.height,
|
|
454
|
-
description:
|
|
456
|
+
description: _chunkGTZXF4BIcjs.describeChart.call(void 0, spec),
|
|
455
457
|
...includeSpec ? { spec } : {}
|
|
456
458
|
};
|
|
457
459
|
}
|
|
458
460
|
function sparklines(doc) {
|
|
459
461
|
const found = [];
|
|
460
462
|
doc.descendants((node, pos) => {
|
|
461
|
-
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: _chunkFEMIVHN3cjs.sparklineLabel.call(void 0, node) });
|
|
462
464
|
});
|
|
463
465
|
return found;
|
|
464
466
|
}
|
|
@@ -469,7 +471,7 @@ function checkPosition(editor, at) {
|
|
|
469
471
|
function createDocumentChartTools(editor) {
|
|
470
472
|
const chartType = () => editor().schema.nodes.chart;
|
|
471
473
|
const findChart = (args) => {
|
|
472
|
-
const charts =
|
|
474
|
+
const charts = _chunkFEMIVHN3cjs.getDocumentCharts.call(void 0, editor().state.doc);
|
|
473
475
|
const list = charts.map((c) => `"${c.id}" at ${c.pos}`).join(", ") || "none; add one with insert_chart";
|
|
474
476
|
if (args.chartId !== void 0) {
|
|
475
477
|
const chart = charts.find((c) => c.id === args.chartId);
|
|
@@ -496,7 +498,7 @@ function createDocumentChartTools(editor) {
|
|
|
496
498
|
annotations: { title: "List charts in the document", ...READ },
|
|
497
499
|
handler: ({ includeSpec = false }) => {
|
|
498
500
|
const doc = editor().state.doc;
|
|
499
|
-
return { charts:
|
|
501
|
+
return { charts: _chunkFEMIVHN3cjs.getDocumentCharts.call(void 0, doc).map((c) => describe(c, includeSpec)), sparklines: editor().schema.nodes.sparkline ? sparklines(doc) : [] };
|
|
500
502
|
}
|
|
501
503
|
};
|
|
502
504
|
const insertChart = {
|
|
@@ -523,7 +525,7 @@ function createDocumentChartTools(editor) {
|
|
|
523
525
|
const node = { type: "chart", attrs: { id, spec, width, ...height !== void 0 ? { height } : {} } };
|
|
524
526
|
const chain = ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true));
|
|
525
527
|
const ok = (at !== void 0 ? chain.insertContentAt(at, node) : chain.insertContent(node)).run();
|
|
526
|
-
const chart =
|
|
528
|
+
const chart = _chunkFEMIVHN3cjs.getDocumentCharts.call(void 0, ed.state.doc).find((c) => c.id === id);
|
|
527
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.`);
|
|
528
530
|
return { id: chart.id, pos: chart.pos, spec: chart.spec, width: chart.node.attrs.width, height: chart.node.attrs.height };
|
|
529
531
|
}
|
|
@@ -570,8 +572,8 @@ function createDocumentChartTools(editor) {
|
|
|
570
572
|
inputSchema: {
|
|
571
573
|
type: "object",
|
|
572
574
|
properties: {
|
|
573
|
-
values: { type: "array", items:
|
|
574
|
-
kind: { type: "string", enum: [...
|
|
575
|
+
values: { type: "array", items: _chunkTGBCBQFVcjs.VALUE, minItems: 1, maxItems: _chunkFEMIVHN3cjs.MAX_SPARKLINE_VALUES, description: "Values in order (null for a gap)." },
|
|
576
|
+
kind: { type: "string", enum: [..._chunkFEMIVHN3cjs.SPARKLINE_KINDS], description: "line (default), column, or win-loss (sign only)." },
|
|
575
577
|
at: { type: "integer", minimum: 0, description: "Document position inside a paragraph (default: the selection)." },
|
|
576
578
|
width: { type: "number", minimum: 4, maximum: 1e3, description: "Width in pixels (default 80)." },
|
|
577
579
|
height: { type: "number", minimum: 4, maximum: 200, description: "Height in pixels (default 18)." },
|
|
@@ -585,12 +587,12 @@ function createDocumentChartTools(editor) {
|
|
|
585
587
|
handler: ({ values, kind = "line", at, width = 80, height = 18, color = null, label = null }) => {
|
|
586
588
|
const ed = editor();
|
|
587
589
|
checkPosition(ed, at);
|
|
588
|
-
const parsed = values.map((v) =>
|
|
590
|
+
const parsed = values.map((v) => _chunkJOX6MJW4cjs.parseChartValue.call(void 0, v));
|
|
589
591
|
const bad = parsed.findIndex((v) => v === void 0);
|
|
590
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.`);
|
|
591
593
|
const pos = _nullishCoalesce(at, () => ( ed.state.selection.from));
|
|
592
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}).`);
|
|
593
|
-
const stored =
|
|
595
|
+
const stored = _chunkFEMIVHN3cjs.normalizeSparklineValues.call(void 0, parsed);
|
|
594
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();
|
|
595
597
|
return { pos, kind, values: stored };
|
|
596
598
|
}
|
|
@@ -641,7 +643,7 @@ function findMatches(editor, query, args, replacement) {
|
|
|
641
643
|
wholeWord: !!args.wholeWord,
|
|
642
644
|
...args.regex ? { regex: true } : { literal: true }
|
|
643
645
|
};
|
|
644
|
-
const result =
|
|
646
|
+
const result = _chunkFEMIVHN3cjs.searchDocument.call(void 0, editor.state.doc, query, options, replacement !== void 0 ? { replacement } : {});
|
|
645
647
|
if (result.error) throw new Error(`Invalid search pattern: ${result.error.message}`);
|
|
646
648
|
return { matches: result.matches, truncated: result.truncated };
|
|
647
649
|
}
|
|
@@ -793,7 +795,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
793
795
|
replacement: String(replace).replace(/\r\n?|\n/g, "\r")
|
|
794
796
|
}));
|
|
795
797
|
const tr = ed.state.tr;
|
|
796
|
-
const ends =
|
|
798
|
+
const ends = _chunkFEMIVHN3cjs.applyReplacements.call(void 0, tr, chosen);
|
|
797
799
|
ed.view.dispatch(tr.scrollIntoView());
|
|
798
800
|
return {
|
|
799
801
|
replaced: chosen.length,
|
|
@@ -890,7 +892,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
890
892
|
inputSchema: {
|
|
891
893
|
type: "object",
|
|
892
894
|
properties: {
|
|
893
|
-
operation: { type: "string", enum:
|
|
895
|
+
operation: { type: "string", enum: _chunkFEMIVHN3cjs.TABLE_ACTIONS.map((a) => a.action), description: "Table operation." },
|
|
894
896
|
at: { type: "integer", minimum: 0, description: "Document position to place the cursor first (e.g. inside a cell)." },
|
|
895
897
|
rows: { type: "integer", minimum: 1, maximum: 100, description: "insertTable: rows (default 3)." },
|
|
896
898
|
cols: { type: "integer", minimum: 1, maximum: 50, description: "insertTable: columns (default 3)." },
|
|
@@ -920,10 +922,10 @@ function createRichTextToolProvider(target, options) {
|
|
|
920
922
|
ed.view.dispatch(ed.state.tr.setSelection(_state.TextSelection.near(ed.state.doc.resolve(at))));
|
|
921
923
|
}
|
|
922
924
|
const action = operation;
|
|
923
|
-
const state =
|
|
925
|
+
const state = _chunkFEMIVHN3cjs.getTableActionState.call(void 0, ed, action, params);
|
|
924
926
|
if (state !== true) throw new Error(state);
|
|
925
|
-
|
|
926
|
-
const table =
|
|
927
|
+
_chunkFEMIVHN3cjs.runTableAction.call(void 0, ed, action, params);
|
|
928
|
+
const table = _chunkFEMIVHN3cjs.getTableState.call(void 0, ed);
|
|
927
929
|
return {
|
|
928
930
|
operation,
|
|
929
931
|
table: table.inTable ? { rows: table.rows, columns: table.columns, row: table.row, column: table.column } : null,
|
|
@@ -939,7 +941,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
939
941
|
if (!ed || ed.isDestroyed) return [];
|
|
940
942
|
if (!ed.isEditable) return [getText, findText, ...charts.read()];
|
|
941
943
|
const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection];
|
|
942
|
-
return [...tools, ...
|
|
944
|
+
return [...tools, ..._chunkFEMIVHN3cjs.isTableEnabled.call(void 0, ed) ? [editTable] : [], ...charts.read(), ...charts.write()];
|
|
943
945
|
},
|
|
944
946
|
subscribe: (notify) => {
|
|
945
947
|
const ed = editor();
|