@pixerate/editor 0.75.0 → 0.77.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 +28 -28
- package/dist/agent/index.js +3 -3
- package/dist/animation-editor/index.cjs +148 -218
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.js +8 -78
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/{chunk-OK7T2LHK.js → chunk-GNO5PEMH.js} +2 -2
- package/dist/{chunk-EIXXBKUB.js → chunk-IMSX4IVG.js} +7 -7
- package/dist/chunk-INZJALPY.js +87 -0
- package/dist/chunk-INZJALPY.js.map +1 -0
- package/dist/{chunk-PL3MPFPA.cjs → chunk-MXF4DP2C.cjs} +77 -77
- package/dist/{chunk-PL3MPFPA.cjs.map → chunk-MXF4DP2C.cjs.map} +1 -1
- package/dist/{chunk-T4XWVPJK.cjs → chunk-RKJDBXTY.cjs} +3 -3
- package/dist/{chunk-T4XWVPJK.cjs.map → chunk-RKJDBXTY.cjs.map} +1 -1
- package/dist/{chunk-HNDSPZ5T.cjs → chunk-ROXFP2LQ.cjs} +4 -4
- package/dist/{chunk-HNDSPZ5T.cjs.map → chunk-ROXFP2LQ.cjs.map} +1 -1
- package/dist/{chunk-WON34HKM.js → chunk-SVW2UNUC.js} +2 -2
- package/dist/{chunk-66IMF6OD.cjs → chunk-TYOAJDFD.cjs} +3 -3
- package/dist/{chunk-66IMF6OD.cjs.map → chunk-TYOAJDFD.cjs.map} +1 -1
- package/dist/chunk-WAJQKWQU.cjs +87 -0
- package/dist/chunk-WAJQKWQU.cjs.map +1 -0
- package/dist/{chunk-UKI64KUD.js → chunk-ZQNDSUZO.js} +6 -6
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +6 -6
- package/dist/index.cjs +35 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -17
- package/dist/serializers/index.cjs +4 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.js +3 -3
- package/dist/video-editor/index.cjs +2234 -0
- package/dist/video-editor/index.cjs.map +1 -0
- package/dist/video-editor/index.d.cts +1003 -0
- package/dist/video-editor/index.d.ts +1003 -0
- package/dist/video-editor/index.js +2234 -0
- package/dist/video-editor/index.js.map +1 -0
- package/package.json +6 -1
- /package/dist/{chunk-OK7T2LHK.js.map → chunk-GNO5PEMH.js.map} +0 -0
- /package/dist/{chunk-EIXXBKUB.js.map → chunk-IMSX4IVG.js.map} +0 -0
- /package/dist/{chunk-WON34HKM.js.map → chunk-SVW2UNUC.js.map} +0 -0
- /package/dist/{chunk-UKI64KUD.js.map → chunk-ZQNDSUZO.js.map} +0 -0
package/dist/agent/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ var _chunkRIWPYSKUcjs = require('../chunk-RIWPYSKU.cjs');
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
var
|
|
73
|
+
var _chunkRKJDBXTYcjs = require('../chunk-RKJDBXTY.cjs');
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
var _chunkTKPPIVW7cjs = require('../chunk-TKPPIVW7.cjs');
|
|
@@ -82,9 +82,9 @@ var _chunkCKRNELPOcjs = require('../chunk-CKRNELPO.cjs');
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
var
|
|
86
|
-
require('../chunk-BVP3TSLH.cjs');
|
|
85
|
+
var _chunkTYOAJDFDcjs = require('../chunk-TYOAJDFD.cjs');
|
|
87
86
|
require('../chunk-IFHKKVXH.cjs');
|
|
87
|
+
require('../chunk-BVP3TSLH.cjs');
|
|
88
88
|
require('../chunk-UN33YOXW.cjs');
|
|
89
89
|
|
|
90
90
|
|
|
@@ -472,7 +472,7 @@ function describe(chart, includeSpec) {
|
|
|
472
472
|
function sparklines(doc) {
|
|
473
473
|
const found = [];
|
|
474
474
|
doc.descendants((node, pos) => {
|
|
475
|
-
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label:
|
|
475
|
+
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label: _chunkRKJDBXTYcjs.sparklineLabel.call(void 0, node) });
|
|
476
476
|
});
|
|
477
477
|
return found;
|
|
478
478
|
}
|
|
@@ -483,7 +483,7 @@ function checkPosition(editor, at) {
|
|
|
483
483
|
function createDocumentChartTools(editor) {
|
|
484
484
|
const chartType = () => editor().schema.nodes.chart;
|
|
485
485
|
const findChart = (args) => {
|
|
486
|
-
const charts =
|
|
486
|
+
const charts = _chunkRKJDBXTYcjs.getDocumentCharts.call(void 0, editor().state.doc);
|
|
487
487
|
const list = charts.map((c) => `"${c.id}" at ${c.pos}`).join(", ") || "none; add one with insert_chart";
|
|
488
488
|
if (args.chartId !== void 0) {
|
|
489
489
|
const chart = charts.find((c) => c.id === args.chartId);
|
|
@@ -510,7 +510,7 @@ function createDocumentChartTools(editor) {
|
|
|
510
510
|
annotations: { title: "List charts in the document", ...READ },
|
|
511
511
|
handler: ({ includeSpec = false }) => {
|
|
512
512
|
const doc = editor().state.doc;
|
|
513
|
-
return { charts:
|
|
513
|
+
return { charts: _chunkRKJDBXTYcjs.getDocumentCharts.call(void 0, doc).map((c) => describe(c, includeSpec)), sparklines: editor().schema.nodes.sparkline ? sparklines(doc) : [] };
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
516
|
const insertChart = {
|
|
@@ -537,7 +537,7 @@ function createDocumentChartTools(editor) {
|
|
|
537
537
|
const node = { type: "chart", attrs: { id, spec, width, ...height !== void 0 ? { height } : {} } };
|
|
538
538
|
const chain = ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true));
|
|
539
539
|
const ok = (at !== void 0 ? chain.insertContentAt(at, node) : chain.insertContent(node)).run();
|
|
540
|
-
const chart =
|
|
540
|
+
const chart = _chunkRKJDBXTYcjs.getDocumentCharts.call(void 0, ed.state.doc).find((c) => c.id === id);
|
|
541
541
|
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.`);
|
|
542
542
|
return { id: chart.id, pos: chart.pos, spec: chart.spec, width: chart.node.attrs.width, height: chart.node.attrs.height };
|
|
543
543
|
}
|
|
@@ -584,8 +584,8 @@ function createDocumentChartTools(editor) {
|
|
|
584
584
|
inputSchema: {
|
|
585
585
|
type: "object",
|
|
586
586
|
properties: {
|
|
587
|
-
values: { type: "array", items: _chunkDK6QBGCScjs.VALUE, minItems: 1, maxItems:
|
|
588
|
-
kind: { type: "string", enum: [...
|
|
587
|
+
values: { type: "array", items: _chunkDK6QBGCScjs.VALUE, minItems: 1, maxItems: _chunkRKJDBXTYcjs.MAX_SPARKLINE_VALUES, description: "Values in order (null for a gap)." },
|
|
588
|
+
kind: { type: "string", enum: [..._chunkRKJDBXTYcjs.SPARKLINE_KINDS], description: "line (default), column, or win-loss (sign only)." },
|
|
589
589
|
at: { type: "integer", minimum: 0, description: "Document position inside a paragraph (default: the selection)." },
|
|
590
590
|
width: { type: "number", minimum: 4, maximum: 1e3, description: "Width in pixels (default 80)." },
|
|
591
591
|
height: { type: "number", minimum: 4, maximum: 200, description: "Height in pixels (default 18)." },
|
|
@@ -604,7 +604,7 @@ function createDocumentChartTools(editor) {
|
|
|
604
604
|
if (bad >= 0) throw new Error(`values[${bad}] ("${String(values[bad])}") is not a number; pass numbers, numeric text or null. Nothing was inserted.`);
|
|
605
605
|
const pos = _nullishCoalesce(at, () => ( ed.state.selection.from));
|
|
606
606
|
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}).`);
|
|
607
|
-
const stored =
|
|
607
|
+
const stored = _chunkRKJDBXTYcjs.normalizeSparklineValues.call(void 0, parsed);
|
|
608
608
|
ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true)).insertContentAt(pos, { type: "sparkline", attrs: { values: stored, kind, width, height, color, label } }).run();
|
|
609
609
|
return { pos, kind, values: stored };
|
|
610
610
|
}
|
|
@@ -639,8 +639,8 @@ function createTextPresence(editor, providerId, option) {
|
|
|
639
639
|
const config = option === false ? null : option === true || option === void 0 ? {} : option;
|
|
640
640
|
const caret = {
|
|
641
641
|
id: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _23 => _23.id]), () => ( providerId)),
|
|
642
|
-
name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _24 => _24.name]), () => (
|
|
643
|
-
color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _25 => _25.color]), () => (
|
|
642
|
+
name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _24 => _24.name]), () => ( _chunkRKJDBXTYcjs.DEFAULT_AGENT_CARET_NAME)),
|
|
643
|
+
color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _25 => _25.color]), () => ( _chunkRKJDBXTYcjs.DEFAULT_AGENT_CARET_COLOR))
|
|
644
644
|
};
|
|
645
645
|
const typing = !_optionalChain([config, 'optionalAccess', _26 => _26.typing]) ? null : config.typing === true ? {} : config.typing;
|
|
646
646
|
const idleMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _27 => _27.idleMs]), () => ( 12e3));
|
|
@@ -653,19 +653,19 @@ function createTextPresence(editor, providerId, option) {
|
|
|
653
653
|
};
|
|
654
654
|
const touch = () => {
|
|
655
655
|
clearTimeout(idleTimer);
|
|
656
|
-
if (idleMs > 0) idleTimer = setTimeout(() => live() &&
|
|
656
|
+
if (idleMs > 0) idleTimer = setTimeout(() => live() && _chunkRKJDBXTYcjs.clearAgentCaret.call(void 0, live(), caret.id), idleMs);
|
|
657
657
|
};
|
|
658
658
|
const tint = (ed, ranges) => {
|
|
659
659
|
clearTimeout(tintTimer);
|
|
660
|
-
|
|
661
|
-
if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() &&
|
|
660
|
+
_chunkRKJDBXTYcjs.markAgentChanges.call(void 0, ed, caret.id, ranges);
|
|
661
|
+
if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() && _chunkRKJDBXTYcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
|
|
662
662
|
};
|
|
663
663
|
return {
|
|
664
664
|
/** Puts the caret at `head`, selecting from `anchor`. */
|
|
665
665
|
show(anchor, head = anchor) {
|
|
666
666
|
const ed = live();
|
|
667
667
|
if (!ed) return;
|
|
668
|
-
|
|
668
|
+
_chunkRKJDBXTYcjs.setAgentCaret.call(void 0, ed, { ...caret, from: anchor, to: head });
|
|
669
669
|
touch();
|
|
670
670
|
},
|
|
671
671
|
/** Shows the caret after ranges just changed by a tool, tinting them. */
|
|
@@ -673,7 +673,7 @@ function createTextPresence(editor, providerId, option) {
|
|
|
673
673
|
const ed = live();
|
|
674
674
|
if (!ed || !ranges.length) return;
|
|
675
675
|
const last = ranges[ranges.length - 1];
|
|
676
|
-
|
|
676
|
+
_chunkRKJDBXTYcjs.setAgentCaret.call(void 0, ed, { ...caret, from: last.to });
|
|
677
677
|
tint(ed, ranges);
|
|
678
678
|
touch();
|
|
679
679
|
},
|
|
@@ -681,12 +681,12 @@ function createTextPresence(editor, providerId, option) {
|
|
|
681
681
|
async write(ed, from, to, text, signal) {
|
|
682
682
|
if (live() && typing) {
|
|
683
683
|
clearTimeout(tintTimer);
|
|
684
|
-
const range2 = await
|
|
685
|
-
if (changedMs > 0) tintTimer = setTimeout(() => live() &&
|
|
684
|
+
const range2 = await _chunkRKJDBXTYcjs.typeAgentText.call(void 0, ed, { ...typing, from, to, text, caret, signal });
|
|
685
|
+
if (changedMs > 0) tintTimer = setTimeout(() => live() && _chunkRKJDBXTYcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
|
|
686
686
|
touch();
|
|
687
687
|
return range2;
|
|
688
688
|
}
|
|
689
|
-
const tr =
|
|
689
|
+
const tr = _chunkRKJDBXTYcjs.replaceWithTextTransaction.call(void 0, ed.state, from, to, text);
|
|
690
690
|
const end = tr.mapping.map(to, 1);
|
|
691
691
|
const range = { from: Math.min(tr.mapping.map(from, -1), end), to: end };
|
|
692
692
|
ed.view.dispatch(tr.scrollIntoView());
|
|
@@ -715,7 +715,7 @@ function findMatches(editor, query, args, replacement) {
|
|
|
715
715
|
wholeWord: !!args.wholeWord,
|
|
716
716
|
...args.regex ? { regex: true } : { literal: true }
|
|
717
717
|
};
|
|
718
|
-
const result =
|
|
718
|
+
const result = _chunkRKJDBXTYcjs.searchDocument.call(void 0, editor.state.doc, query, options, replacement !== void 0 ? { replacement } : {});
|
|
719
719
|
if (result.error) throw new Error(`Invalid search pattern: ${result.error.message}`);
|
|
720
720
|
return { matches: result.matches, truncated: result.truncated };
|
|
721
721
|
}
|
|
@@ -751,7 +751,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
751
751
|
},
|
|
752
752
|
handler: ({ format = "text", blocks = false }) => {
|
|
753
753
|
const ed = editor();
|
|
754
|
-
const content = format === "html" ? ed.getHTML() : format === "markdown" ?
|
|
754
|
+
const content = format === "html" ? ed.getHTML() : format === "markdown" ? _chunkTYOAJDFDcjs.getEditorMarkdown.call(void 0, ed) : _chunkTYOAJDFDcjs.getEditorText.call(void 0, ed);
|
|
755
755
|
return {
|
|
756
756
|
format,
|
|
757
757
|
content,
|
|
@@ -869,7 +869,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
869
869
|
replacement: String(replace).replace(/\r\n?|\n/g, "\r")
|
|
870
870
|
}));
|
|
871
871
|
const tr = ed.state.tr;
|
|
872
|
-
const ends =
|
|
872
|
+
const ends = _chunkRKJDBXTYcjs.applyReplacements.call(void 0, tr, chosen);
|
|
873
873
|
ed.view.dispatch(tr.scrollIntoView());
|
|
874
874
|
const ranges = chosen.map((m, i) => ({ from: tr.mapping.map(m.from, -1), to: ends[i] }));
|
|
875
875
|
presence.changed(ranges.filter((r) => r.from < r.to));
|
|
@@ -970,7 +970,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
970
970
|
inputSchema: {
|
|
971
971
|
type: "object",
|
|
972
972
|
properties: {
|
|
973
|
-
operation: { type: "string", enum:
|
|
973
|
+
operation: { type: "string", enum: _chunkRKJDBXTYcjs.TABLE_ACTIONS.map((a) => a.action), description: "Table operation." },
|
|
974
974
|
at: { type: "integer", minimum: 0, description: "Document position to place the cursor first (e.g. inside a cell)." },
|
|
975
975
|
rows: { type: "integer", minimum: 1, maximum: 100, description: "insertTable: rows (default 3)." },
|
|
976
976
|
cols: { type: "integer", minimum: 1, maximum: 50, description: "insertTable: columns (default 3)." },
|
|
@@ -1000,10 +1000,10 @@ function createRichTextToolProvider(target, options) {
|
|
|
1000
1000
|
ed.view.dispatch(ed.state.tr.setSelection(_state.TextSelection.near(ed.state.doc.resolve(at))));
|
|
1001
1001
|
}
|
|
1002
1002
|
const action = operation;
|
|
1003
|
-
const state =
|
|
1003
|
+
const state = _chunkRKJDBXTYcjs.getTableActionState.call(void 0, ed, action, params);
|
|
1004
1004
|
if (state !== true) throw new Error(state);
|
|
1005
|
-
|
|
1006
|
-
const table =
|
|
1005
|
+
_chunkRKJDBXTYcjs.runTableAction.call(void 0, ed, action, params);
|
|
1006
|
+
const table = _chunkRKJDBXTYcjs.getTableState.call(void 0, ed);
|
|
1007
1007
|
return {
|
|
1008
1008
|
operation,
|
|
1009
1009
|
table: table.inTable ? { rows: table.rows, columns: table.columns, row: table.row, column: table.column } : null,
|
|
@@ -1019,7 +1019,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
1019
1019
|
if (!ed || ed.isDestroyed) return [];
|
|
1020
1020
|
if (!ed.isEditable) return [getText, findText, ...charts.read()];
|
|
1021
1021
|
const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection];
|
|
1022
|
-
return [...tools, ...
|
|
1022
|
+
return [...tools, ..._chunkRKJDBXTYcjs.isTableEnabled.call(void 0, ed) ? [editTable] : [], ...charts.read(), ...charts.write()];
|
|
1023
1023
|
},
|
|
1024
1024
|
subscribe: (notify) => {
|
|
1025
1025
|
const ed = editor();
|
package/dist/agent/index.js
CHANGED
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
setAgentCaret,
|
|
71
71
|
sparklineLabel,
|
|
72
72
|
typeAgentText
|
|
73
|
-
} from "../chunk-
|
|
73
|
+
} from "../chunk-GNO5PEMH.js";
|
|
74
74
|
import {
|
|
75
75
|
describeChart
|
|
76
76
|
} from "../chunk-ZOH6X3VR.js";
|
|
@@ -82,9 +82,9 @@ import {
|
|
|
82
82
|
import {
|
|
83
83
|
getEditorMarkdown,
|
|
84
84
|
getEditorText
|
|
85
|
-
} from "../chunk-
|
|
86
|
-
import "../chunk-O5RYH2PG.js";
|
|
85
|
+
} from "../chunk-ZQNDSUZO.js";
|
|
87
86
|
import "../chunk-SWE3NPOU.js";
|
|
87
|
+
import "../chunk-O5RYH2PG.js";
|
|
88
88
|
import "../chunk-JQ3BB3E6.js";
|
|
89
89
|
import {
|
|
90
90
|
colNameToIndex,
|