@pixerate/editor 0.234.0 → 0.236.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 +286 -27
- package/dist/agent/index.d.cts +1 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +261 -2
- package/dist/agent/reviewTools.d.cts +16 -0
- package/dist/agent/reviewTools.d.ts +16 -0
- package/dist/animation-editor/controller.d.cts +25 -0
- package/dist/animation-editor/controller.d.ts +25 -0
- package/dist/animation-editor/index.cjs +159 -50
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +115 -6
- package/dist/animation-editor/layers.d.cts +2 -0
- package/dist/animation-editor/layers.d.ts +2 -0
- package/dist/animation-editor/sequence.d.cts +33 -0
- package/dist/animation-editor/sequence.d.ts +33 -0
- package/dist/{chunk-PI2UYMZY.js → chunk-FSLKBQU7.js} +269 -15
- package/dist/{chunk-I277KJLQ.js → chunk-G3RUKJ5C.js} +105 -1
- package/dist/{chunk-6RZVFYGJ.cjs → chunk-JWCKJNDR.cjs} +105 -1
- package/dist/{chunk-3MO3ZS7E.js → chunk-PHYOZK3B.js} +59 -311
- package/dist/{chunk-CZBRY4SW.cjs → chunk-WPWHT4Z6.cjs} +122 -374
- package/dist/{chunk-O7QXVGMP.cjs → chunk-WV5WTOC6.cjs} +295 -41
- package/dist/effects/index.cjs +19 -11
- package/dist/effects/index.d.cts +1 -0
- package/dist/effects/index.d.ts +1 -0
- package/dist/effects/index.js +9 -1
- package/dist/effects/template-tools.d.cts +25 -0
- package/dist/effects/template-tools.d.ts +25 -0
- package/dist/effects/templates.d.cts +30 -1
- package/dist/effects/templates.d.ts +30 -1
- package/dist/extensions/index.cjs +6 -6
- package/dist/extensions/index.js +10 -10
- package/dist/index.cjs +11 -11
- package/dist/index.js +10 -10
- package/dist/video-editor/controller.d.cts +26 -0
- package/dist/video-editor/controller.d.ts +26 -0
- package/dist/video-editor/index.cjs +187 -42
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +145 -0
- package/dist/video-editor/sequence.d.cts +38 -0
- package/dist/video-editor/sequence.d.ts +38 -0
- package/package.json +1 -1
- package/skills/pixerate-rich-text/SKILL.md +28 -1
- package/skills/pixerate-rich-text-revise/SKILL.md +8 -1
|
@@ -20,11 +20,257 @@ var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
|
|
24
|
+
|
|
23
25
|
var _chunk34RQAGWIcjs = require('./chunk-34RQAGWI.cjs');
|
|
24
26
|
|
|
27
|
+
// src/extensions/comments.ts
|
|
28
|
+
var _core = require('@tiptap/core');
|
|
29
|
+
var _state = require('@tiptap/pm/state');
|
|
30
|
+
var _view = require('@tiptap/pm/view');
|
|
31
|
+
var commentsPluginKey = new (0, _state.PluginKey)("comments");
|
|
32
|
+
var COMMENT_MARK_NAME = "comment";
|
|
33
|
+
function findCommentRanges(doc) {
|
|
34
|
+
const result = /* @__PURE__ */ new Map();
|
|
35
|
+
doc.descendants((node, pos) => {
|
|
36
|
+
if (!node.isInline) return;
|
|
37
|
+
node.marks.forEach((mark) => {
|
|
38
|
+
if (mark.type.name !== COMMENT_MARK_NAME) return;
|
|
39
|
+
const id = mark.attrs.commentId;
|
|
40
|
+
if (!id) return;
|
|
41
|
+
const ranges = _nullishCoalesce(result.get(id), () => ( []));
|
|
42
|
+
const last = ranges[ranges.length - 1];
|
|
43
|
+
const end = pos + node.nodeSize;
|
|
44
|
+
if (last && last.to === pos) {
|
|
45
|
+
last.to = end;
|
|
46
|
+
} else {
|
|
47
|
+
ranges.push({ from: pos, to: end });
|
|
48
|
+
}
|
|
49
|
+
result.set(id, ranges);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function getCommentAnchors(doc) {
|
|
55
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
56
|
+
findCommentRanges(doc).forEach((ranges, id) => {
|
|
57
|
+
const from = ranges[0].from;
|
|
58
|
+
const to = ranges[ranges.length - 1].to;
|
|
59
|
+
anchors.set(id, {
|
|
60
|
+
from,
|
|
61
|
+
to,
|
|
62
|
+
quote: ranges.map((r) => doc.textBetween(r.from, r.to, " ", " ")).join(" ")
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
return anchors;
|
|
66
|
+
}
|
|
67
|
+
function getCommentIdsAt(state, pos = state.selection.from) {
|
|
68
|
+
const $pos = state.doc.resolve(pos);
|
|
69
|
+
const marks = [
|
|
70
|
+
..._nullishCoalesce(_optionalChain([$pos, 'access', _2 => _2.nodeAfter, 'optionalAccess', _3 => _3.marks]), () => ( [])),
|
|
71
|
+
..._nullishCoalesce(_optionalChain([$pos, 'access', _4 => _4.nodeBefore, 'optionalAccess', _5 => _5.marks]), () => ( []))
|
|
72
|
+
];
|
|
73
|
+
const ids = [];
|
|
74
|
+
marks.forEach((m) => {
|
|
75
|
+
if (m.type.name === COMMENT_MARK_NAME && m.attrs.commentId && !ids.includes(m.attrs.commentId)) {
|
|
76
|
+
ids.push(m.attrs.commentId);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return ids;
|
|
80
|
+
}
|
|
81
|
+
function getCommentStore(editor) {
|
|
82
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _6 => _6.storage, 'optionalAccess', _7 => _7[COMMENT_MARK_NAME], 'optionalAccess', _8 => _8.store]), () => ( null));
|
|
83
|
+
}
|
|
84
|
+
function resolveAuthor(author) {
|
|
85
|
+
return typeof author === "function" ? author() : author;
|
|
86
|
+
}
|
|
87
|
+
var Comments = _core.Mark.create({
|
|
88
|
+
name: COMMENT_MARK_NAME,
|
|
89
|
+
// Typing at the edge of a comment does not extend it.
|
|
90
|
+
inclusive: false,
|
|
91
|
+
// Allow several comment marks (different threads) on the same text.
|
|
92
|
+
excludes: "",
|
|
93
|
+
addOptions() {
|
|
94
|
+
return {
|
|
95
|
+
store: null,
|
|
96
|
+
author: { id: "anonymous", name: "Anonymous" },
|
|
97
|
+
HTMLAttributes: {},
|
|
98
|
+
commentClass: "pixerate-comment bg-amber-100 border-b-2 border-amber-400 dark:bg-amber-500/20 cursor-pointer",
|
|
99
|
+
activeClass: "pixerate-comment-active bg-amber-200 dark:bg-amber-500/40",
|
|
100
|
+
resolvedClass: "",
|
|
101
|
+
activateOnSelection: true
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
addStorage() {
|
|
105
|
+
return {
|
|
106
|
+
store: _nullishCoalesce(this.options.store, () => ( new (0, _chunk34RQAGWIcjs.CommentStore)())),
|
|
107
|
+
// tiptap-markdown: comments are not part of the exported markdown.
|
|
108
|
+
markdown: { serialize: { open: "", close: "" }, parse: {} }
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
addAttributes() {
|
|
112
|
+
return {
|
|
113
|
+
commentId: {
|
|
114
|
+
default: null,
|
|
115
|
+
parseHTML: (el) => el.getAttribute("data-comment-id"),
|
|
116
|
+
renderHTML: (attrs) => attrs.commentId ? { "data-comment-id": attrs.commentId } : {}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
parseHTML() {
|
|
121
|
+
return [{ tag: "span[data-comment-id]" }];
|
|
122
|
+
},
|
|
123
|
+
renderHTML({ HTMLAttributes }) {
|
|
124
|
+
return ["span", _chunk34RQAGWIcjs.safeMergeAttributes.call(void 0, this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
125
|
+
},
|
|
126
|
+
addCommands() {
|
|
127
|
+
const store = () => this.storage.store;
|
|
128
|
+
return {
|
|
129
|
+
addComment: (options = {}) => ({ state, tr, dispatch }) => {
|
|
130
|
+
const { from, to, empty } = state.selection;
|
|
131
|
+
if (empty) return false;
|
|
132
|
+
if (dispatch) {
|
|
133
|
+
const id = _nullishCoalesce(options.id, () => ( _chunk34RQAGWIcjs.createReviewId.call(void 0, "comment")));
|
|
134
|
+
tr.addMark(from, to, this.type.create({ commentId: id }));
|
|
135
|
+
tr.setMeta(commentsPluginKey, "refresh");
|
|
136
|
+
store().createThread({
|
|
137
|
+
id,
|
|
138
|
+
body: _nullishCoalesce(options.body, () => ( "")),
|
|
139
|
+
author: _nullishCoalesce(options.author, () => ( resolveAuthor(this.options.author))),
|
|
140
|
+
anchor: { from, to, quote: state.doc.textBetween(from, to, " ", " ") }
|
|
141
|
+
});
|
|
142
|
+
store().setActiveThread(id);
|
|
143
|
+
}
|
|
144
|
+
return true;
|
|
145
|
+
},
|
|
146
|
+
resolveComment: (id, resolved = true) => ({ tr, dispatch }) => {
|
|
147
|
+
if (!store().getThread(id)) return false;
|
|
148
|
+
if (dispatch) {
|
|
149
|
+
store().resolveThread(id, resolved, resolveAuthor(this.options.author));
|
|
150
|
+
tr.setMeta(commentsPluginKey, "refresh");
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
},
|
|
154
|
+
deleteComment: (id) => ({ state, tr, dispatch }) => {
|
|
155
|
+
const ranges = _nullishCoalesce(findCommentRanges(state.doc).get(id), () => ( []));
|
|
156
|
+
if (ranges.length === 0 && !store().getThread(id)) return false;
|
|
157
|
+
if (dispatch) {
|
|
158
|
+
ranges.forEach(({ from, to }) => {
|
|
159
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
160
|
+
const mark = node.marks.find(
|
|
161
|
+
(m) => m.type === this.type && m.attrs.commentId === id
|
|
162
|
+
);
|
|
163
|
+
if (mark) {
|
|
164
|
+
tr.removeMark(Math.max(pos, from), Math.min(pos + node.nodeSize, to), mark);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
tr.setMeta(commentsPluginKey, "refresh");
|
|
169
|
+
store().deleteThread(id);
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
},
|
|
173
|
+
setActiveComment: (id) => ({ tr, dispatch }) => {
|
|
174
|
+
if (id !== null && !store().getThread(id)) return false;
|
|
175
|
+
if (dispatch) {
|
|
176
|
+
store().setActiveThread(id);
|
|
177
|
+
tr.setMeta(commentsPluginKey, "refresh");
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
},
|
|
181
|
+
focusComment: (id) => ({ state, tr, dispatch }) => {
|
|
182
|
+
const ranges = findCommentRanges(state.doc).get(id);
|
|
183
|
+
if (!ranges || ranges.length === 0) return false;
|
|
184
|
+
if (dispatch) {
|
|
185
|
+
const from = ranges[0].from;
|
|
186
|
+
const to = ranges[ranges.length - 1].to;
|
|
187
|
+
tr.setSelection(_state.TextSelection.create(tr.doc, from, to)).scrollIntoView();
|
|
188
|
+
store().setActiveThread(id);
|
|
189
|
+
tr.setMeta(commentsPluginKey, "refresh");
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
addProseMirrorPlugins() {
|
|
196
|
+
const store = this.storage.store;
|
|
197
|
+
const options = this.options;
|
|
198
|
+
let cache = null;
|
|
199
|
+
const buildDecorations2 = (doc) => {
|
|
200
|
+
const snapshot = store.getSnapshot();
|
|
201
|
+
if (cache && cache.doc === doc && cache.snapshot === snapshot) return cache.set;
|
|
202
|
+
const decorations = [];
|
|
203
|
+
findCommentRanges(doc).forEach((ranges, id) => {
|
|
204
|
+
const thread = store.getThread(id);
|
|
205
|
+
const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _9 => _9.resolved]), () => ( false));
|
|
206
|
+
const active = snapshot.activeThreadId === id;
|
|
207
|
+
const cls = [
|
|
208
|
+
resolved ? options.resolvedClass : options.commentClass,
|
|
209
|
+
active ? options.activeClass : ""
|
|
210
|
+
].filter(Boolean).join(" ");
|
|
211
|
+
if (!cls) return;
|
|
212
|
+
ranges.forEach(({ from, to }) => {
|
|
213
|
+
decorations.push(_view.Decoration.inline(from, to, { class: cls }));
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
const set = _view.DecorationSet.create(doc, decorations);
|
|
217
|
+
cache = { doc, snapshot, set };
|
|
218
|
+
return set;
|
|
219
|
+
};
|
|
220
|
+
return [
|
|
221
|
+
new (0, _state.Plugin)({
|
|
222
|
+
key: commentsPluginKey,
|
|
223
|
+
props: {
|
|
224
|
+
decorations: (state) => buildDecorations2(state.doc)
|
|
225
|
+
},
|
|
226
|
+
view: (view) => {
|
|
227
|
+
let destroyed = false;
|
|
228
|
+
let scheduled = false;
|
|
229
|
+
const sync = () => store.syncAnchors(getCommentAnchors(view.state.doc));
|
|
230
|
+
sync();
|
|
231
|
+
const unsubscribe = store.subscribe(() => {
|
|
232
|
+
if (scheduled) return;
|
|
233
|
+
scheduled = true;
|
|
234
|
+
queueMicrotask(() => {
|
|
235
|
+
scheduled = false;
|
|
236
|
+
if (destroyed) return;
|
|
237
|
+
sync();
|
|
238
|
+
if (_optionalChain([cache, 'optionalAccess', _10 => _10.snapshot]) !== store.getSnapshot()) {
|
|
239
|
+
view.dispatch(
|
|
240
|
+
view.state.tr.setMeta(commentsPluginKey, "refresh").setMeta("addToHistory", false)
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
return {
|
|
246
|
+
update(view2, prevState) {
|
|
247
|
+
if (!prevState.doc.eq(view2.state.doc)) sync();
|
|
248
|
+
if (options.activateOnSelection && !prevState.selection.eq(view2.state.selection)) {
|
|
249
|
+
const ids = getCommentIdsAt(view2.state);
|
|
250
|
+
const active = store.getSnapshot().activeThreadId;
|
|
251
|
+
if (!active || !ids.includes(active)) {
|
|
252
|
+
store.setActiveThread(_nullishCoalesce(ids[0], () => ( null)));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
destroy() {
|
|
257
|
+
destroyed = true;
|
|
258
|
+
unsubscribe();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
];
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
function getCommentAuthor(editor) {
|
|
267
|
+
const ext = _optionalChain([editor, 'optionalAccess', _11 => _11.extensionManager, 'optionalAccess', _12 => _12.extensions, 'access', _13 => _13.find, 'call', _14 => _14((e) => e.name === COMMENT_MARK_NAME)]);
|
|
268
|
+
return ext ? resolveAuthor(ext.options.author) : null;
|
|
269
|
+
}
|
|
270
|
+
|
|
25
271
|
// src/extensions/table/nesting.ts
|
|
26
272
|
var _model = require('@tiptap/pm/model');
|
|
27
|
-
|
|
273
|
+
|
|
28
274
|
|
|
29
275
|
|
|
30
276
|
|
|
@@ -145,7 +391,7 @@ function unnestTables(tr, ranges) {
|
|
|
145
391
|
const node = nodes[i];
|
|
146
392
|
const $pos = tr.doc.resolve(pos);
|
|
147
393
|
const parent = $pos.parent;
|
|
148
|
-
const filler = parent.childCount === 1 ? _optionalChain([parent, 'access',
|
|
394
|
+
const filler = parent.childCount === 1 ? _optionalChain([parent, 'access', _15 => _15.type, 'access', _16 => _16.contentMatch, 'access', _17 => _17.defaultType, 'optionalAccess', _18 => _18.createAndFill, 'call', _19 => _19()]) : null;
|
|
149
395
|
if (filler) tr.replaceWith(pos, pos + node.nodeSize, filler);
|
|
150
396
|
else tr.delete(pos, pos + node.nodeSize);
|
|
151
397
|
}
|
|
@@ -1057,13 +1303,13 @@ function applyReplacements(tr, matches) {
|
|
|
1057
1303
|
}
|
|
1058
1304
|
|
|
1059
1305
|
// src/extensions/table/extension.ts
|
|
1060
|
-
|
|
1306
|
+
|
|
1061
1307
|
|
|
1062
1308
|
var _extensiontable = require('@tiptap/extension-table'); var _Table = _interopRequireWildcard(_extensiontable);
|
|
1063
1309
|
var _extensiontablerow = require('@tiptap/extension-table-row'); var _TableRow = _interopRequireWildcard(_extensiontablerow);
|
|
1064
1310
|
var _extensiontableheader = require('@tiptap/extension-table-header'); var _TableHeader = _interopRequireWildcard(_extensiontableheader);
|
|
1065
1311
|
var _extensiontablecell = require('@tiptap/extension-table-cell'); var _TableCell = _interopRequireWildcard(_extensiontablecell);
|
|
1066
|
-
var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
1312
|
+
var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess', _20 => _20[name]]) || _optionalChain([mod, 'optionalAccess', _21 => _21.default, 'optionalAccess', _22 => _22[name]]) || _optionalChain([mod, 'optionalAccess', _23 => _23.default, 'optionalAccess', _24 => _24.default]) || _optionalChain([mod, 'optionalAccess', _25 => _25.default]) || mod;
|
|
1067
1313
|
var BaseTable = resolveExt(_Table, "Table");
|
|
1068
1314
|
var BaseTableRow = resolveExt(_TableRow, "TableRow");
|
|
1069
1315
|
var BaseTableHeader = resolveExt(_TableHeader, "TableHeader");
|
|
@@ -1083,7 +1329,7 @@ function normalizeTableCellColor(value) {
|
|
|
1083
1329
|
var cellAttributes = () => ({
|
|
1084
1330
|
align: {
|
|
1085
1331
|
default: null,
|
|
1086
|
-
parseHTML: (element) => normalizeTableCellAlignment(_optionalChain([element, 'access',
|
|
1332
|
+
parseHTML: (element) => normalizeTableCellAlignment(_optionalChain([element, 'access', _26 => _26.style, 'optionalAccess', _27 => _27.textAlign]) || element.getAttribute("align")),
|
|
1087
1333
|
renderHTML: (attrs) => {
|
|
1088
1334
|
const align = normalizeTableCellAlignment(attrs.align);
|
|
1089
1335
|
return align ? { style: `text-align: ${align}` } : {};
|
|
@@ -1092,7 +1338,7 @@ var cellAttributes = () => ({
|
|
|
1092
1338
|
backgroundColor: {
|
|
1093
1339
|
default: null,
|
|
1094
1340
|
parseHTML: (element) => normalizeTableCellColor(
|
|
1095
|
-
element.getAttribute("data-background-color") || _optionalChain([element, 'access',
|
|
1341
|
+
element.getAttribute("data-background-color") || _optionalChain([element, 'access', _28 => _28.style, 'optionalAccess', _29 => _29.backgroundColor]) || element.getAttribute("bgcolor")
|
|
1096
1342
|
),
|
|
1097
1343
|
renderHTML: (attrs) => {
|
|
1098
1344
|
const color = normalizeTableCellColor(attrs.backgroundColor);
|
|
@@ -1163,18 +1409,18 @@ var Table = BaseTable.extend({
|
|
|
1163
1409
|
return { markdown: { serialize: serializeTableMarkdown } };
|
|
1164
1410
|
},
|
|
1165
1411
|
addProseMirrorPlugins() {
|
|
1166
|
-
return [..._nullishCoalesce(_optionalChain([this, 'access',
|
|
1412
|
+
return [..._nullishCoalesce(_optionalChain([this, 'access', _30 => _30.parent, 'optionalCall', _31 => _31()]), () => ( [])), createTableNestingPlugin()];
|
|
1167
1413
|
}
|
|
1168
1414
|
});
|
|
1169
1415
|
var TableRow = BaseTableRow;
|
|
1170
1416
|
var TableCell = BaseTableCell.extend({
|
|
1171
1417
|
addAttributes() {
|
|
1172
|
-
return { ..._optionalChain([this, 'access',
|
|
1418
|
+
return { ..._optionalChain([this, 'access', _32 => _32.parent, 'optionalCall', _33 => _33()]), ...cellAttributes() };
|
|
1173
1419
|
}
|
|
1174
1420
|
});
|
|
1175
1421
|
var TableHeader = BaseTableHeader.extend({
|
|
1176
1422
|
addAttributes() {
|
|
1177
|
-
return { ..._optionalChain([this, 'access',
|
|
1423
|
+
return { ..._optionalChain([this, 'access', _34 => _34.parent, 'optionalCall', _35 => _35()]), ...cellAttributes() };
|
|
1178
1424
|
}
|
|
1179
1425
|
});
|
|
1180
1426
|
function createTableExtensions(options = {}) {
|
|
@@ -1324,7 +1570,7 @@ var ChartNodeView = (_class = class {
|
|
|
1324
1570
|
destroy() {
|
|
1325
1571
|
this.editor.off("update", this.onEditorUpdate);
|
|
1326
1572
|
this.unsubscribe();
|
|
1327
|
-
_optionalChain([this, 'access',
|
|
1573
|
+
_optionalChain([this, 'access', _36 => _36.renderer, 'optionalAccess', _37 => _37.destroy, 'call', _38 => _38()]);
|
|
1328
1574
|
this.controller.destroy();
|
|
1329
1575
|
}
|
|
1330
1576
|
}, _class);
|
|
@@ -1397,11 +1643,11 @@ function arraysEqual(a, b, eq) {
|
|
|
1397
1643
|
}
|
|
1398
1644
|
function scrollDomAtPos(view, pos, behavior = "smooth") {
|
|
1399
1645
|
try {
|
|
1400
|
-
const dom = _optionalChain([view, 'optionalAccess',
|
|
1646
|
+
const dom = _optionalChain([view, 'optionalAccess', _39 => _39.nodeDOM, 'optionalCall', _40 => _40(pos)]);
|
|
1401
1647
|
if (dom && typeof dom.scrollIntoView === "function") {
|
|
1402
1648
|
dom.scrollIntoView({ block: "start", behavior });
|
|
1403
1649
|
}
|
|
1404
|
-
} catch (
|
|
1650
|
+
} catch (e2) {
|
|
1405
1651
|
}
|
|
1406
1652
|
}
|
|
1407
1653
|
function syncInitialContent(editor, sync) {
|
|
@@ -1412,8 +1658,8 @@ function syncInitialContent(editor, sync) {
|
|
|
1412
1658
|
errorOnInvalidContent: false
|
|
1413
1659
|
});
|
|
1414
1660
|
const tr = sync(_state.EditorState.create({ doc }));
|
|
1415
|
-
if (_optionalChain([tr, 'optionalAccess',
|
|
1416
|
-
} catch (
|
|
1661
|
+
if (_optionalChain([tr, 'optionalAccess', _41 => _41.docChanged])) editor.options.content = tr.doc;
|
|
1662
|
+
} catch (e3) {
|
|
1417
1663
|
}
|
|
1418
1664
|
}
|
|
1419
1665
|
var STRUCTURE_PRIORITY = 45;
|
|
@@ -1432,14 +1678,14 @@ function getDocumentCharts(doc, typeName = "chart") {
|
|
|
1432
1678
|
return charts;
|
|
1433
1679
|
}
|
|
1434
1680
|
function isChartEnabled(editor) {
|
|
1435
|
-
return !!_optionalChain([editor, 'optionalAccess',
|
|
1681
|
+
return !!_optionalChain([editor, 'optionalAccess', _42 => _42.schema, 'optionalAccess', _43 => _43.nodes, 'optionalAccess', _44 => _44.chart]);
|
|
1436
1682
|
}
|
|
1437
1683
|
function readSpec(value) {
|
|
1438
1684
|
let input = value;
|
|
1439
1685
|
if (typeof value === "string") {
|
|
1440
1686
|
try {
|
|
1441
1687
|
input = JSON.parse(value);
|
|
1442
|
-
} catch (
|
|
1688
|
+
} catch (e4) {
|
|
1443
1689
|
return null;
|
|
1444
1690
|
}
|
|
1445
1691
|
}
|
|
@@ -1464,7 +1710,7 @@ function syncChartIds(state, typeName, generateId) {
|
|
|
1464
1710
|
tr = _nullishCoalesce(tr, () => ( state.tr));
|
|
1465
1711
|
tr.setNodeMarkup(chart.pos, void 0, { ...chart.node.attrs, id });
|
|
1466
1712
|
}
|
|
1467
|
-
return _nullishCoalesce(_optionalChain([tr, 'optionalAccess',
|
|
1713
|
+
return _nullishCoalesce(_optionalChain([tr, 'optionalAccess', _45 => _45.setMeta, 'call', _46 => _46("addToHistory", false)]), () => ( null));
|
|
1468
1714
|
}
|
|
1469
1715
|
function staticChartSvg(node, options) {
|
|
1470
1716
|
const spec = node.attrs.spec;
|
|
@@ -1539,7 +1785,7 @@ var Chart = _core.Node.create({
|
|
|
1539
1785
|
priority: 60,
|
|
1540
1786
|
getAttrs: (element) => {
|
|
1541
1787
|
const code = element.querySelector("code");
|
|
1542
|
-
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess',
|
|
1788
|
+
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _47 => _47.getAttribute, 'call', _48 => _48("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1543
1789
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1544
1790
|
const result = _chunk5DQPDXOMcjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1545
1791
|
return result.family ? { spec: result.spec } : false;
|
|
@@ -1559,7 +1805,7 @@ var Chart = _core.Node.create({
|
|
|
1559
1805
|
];
|
|
1560
1806
|
},
|
|
1561
1807
|
renderText({ node }) {
|
|
1562
|
-
return `[Chart: ${_optionalChain([node, 'access',
|
|
1808
|
+
return `[Chart: ${_optionalChain([node, 'access', _49 => _49.attrs, 'access', _50 => _50.spec, 'optionalAccess', _51 => _51.title]) || "untitled"}]`;
|
|
1563
1809
|
},
|
|
1564
1810
|
addStorage() {
|
|
1565
1811
|
return {
|
|
@@ -1642,7 +1888,7 @@ function readValues(text) {
|
|
|
1642
1888
|
if (!text) return [];
|
|
1643
1889
|
try {
|
|
1644
1890
|
return normalizeSparklineValues(JSON.parse(text));
|
|
1645
|
-
} catch (
|
|
1891
|
+
} catch (e5) {
|
|
1646
1892
|
return normalizeSparklineValues(text.split(/[\s,]+/).filter(Boolean).map(Number));
|
|
1647
1893
|
}
|
|
1648
1894
|
}
|
|
@@ -1813,7 +2059,7 @@ var isInt = (value, min, max) => typeof value === "number" && Number.isInteger(v
|
|
|
1813
2059
|
var can = (editor, run) => {
|
|
1814
2060
|
try {
|
|
1815
2061
|
return !!run(editor.can().chain()).run();
|
|
1816
|
-
} catch (
|
|
2062
|
+
} catch (e6) {
|
|
1817
2063
|
return false;
|
|
1818
2064
|
}
|
|
1819
2065
|
};
|
|
@@ -1861,13 +2107,13 @@ function getTableActionState(editor, action, params = {}) {
|
|
|
1861
2107
|
if (params.align !== void 0 && params.align !== null && !normalizeTableCellAlignment(params.align)) {
|
|
1862
2108
|
return 'Alignment must be "left", "center", "right", "justify" or null.';
|
|
1863
2109
|
}
|
|
1864
|
-
if (!_optionalChain([editor, 'access',
|
|
2110
|
+
if (!_optionalChain([editor, 'access', _52 => _52.schema, 'access', _53 => _53.nodes, 'access', _54 => _54.tableCell, 'optionalAccess', _55 => _55.spec, 'access', _56 => _56.attrs, 'optionalAccess', _57 => _57.align])) return "Cell alignment is not supported by this schema.";
|
|
1865
2111
|
return true;
|
|
1866
2112
|
case "setCellBackground":
|
|
1867
2113
|
if (params.color !== void 0 && params.color !== null && !normalizeTableCellColor(params.color)) {
|
|
1868
2114
|
return "Color must be a CSS color such as #fde68a, rgb(\u2026) or a color name, or null.";
|
|
1869
2115
|
}
|
|
1870
|
-
if (!_optionalChain([editor, 'access',
|
|
2116
|
+
if (!_optionalChain([editor, 'access', _58 => _58.schema, 'access', _59 => _59.nodes, 'access', _60 => _60.tableCell, 'optionalAccess', _61 => _61.spec, 'access', _62 => _62.attrs, 'optionalAccess', _63 => _63.backgroundColor])) return "Cell backgrounds are not supported by this schema.";
|
|
1871
2117
|
return true;
|
|
1872
2118
|
default:
|
|
1873
2119
|
return can(editor, (c) => c[action]()) ? true : "This table action is not available here.";
|
|
@@ -1930,7 +2176,7 @@ function getTableState(editor) {
|
|
|
1930
2176
|
const rect = _tables.selectedRect.call(void 0, state);
|
|
1931
2177
|
const { map, table } = rect;
|
|
1932
2178
|
const cellAt = (row, col) => table.nodeAt(map.map[row * map.width + col]);
|
|
1933
|
-
const allHeaders = (positions) => positions.length > 0 && positions.every((pos) => _optionalChain([table, 'access',
|
|
2179
|
+
const allHeaders = (positions) => positions.length > 0 && positions.every((pos) => _optionalChain([table, 'access', _64 => _64.nodeAt, 'call', _65 => _65(pos), 'optionalAccess', _66 => _66.type, 'access', _67 => _67.name]) === "tableHeader");
|
|
1934
2180
|
const firstRow = map.cellsInRect({ left: 0, right: map.width, top: 0, bottom: 1 });
|
|
1935
2181
|
const firstColumn = map.cellsInRect({ left: 0, right: 1, top: 0, bottom: map.height });
|
|
1936
2182
|
const cell = cellAt(rect.top, rect.left);
|
|
@@ -1944,11 +2190,11 @@ function getTableState(editor) {
|
|
|
1944
2190
|
column: rect.left,
|
|
1945
2191
|
headerRow: allHeaders(firstRow),
|
|
1946
2192
|
headerColumn: allHeaders(firstColumn),
|
|
1947
|
-
headerCell: _optionalChain([cell, 'optionalAccess',
|
|
1948
|
-
cellAlignment: normalizeTableCellAlignment(_optionalChain([cell, 'optionalAccess',
|
|
1949
|
-
cellBackground: normalizeTableCellColor(_optionalChain([cell, 'optionalAccess',
|
|
2193
|
+
headerCell: _optionalChain([cell, 'optionalAccess', _68 => _68.type, 'access', _69 => _69.name]) === "tableHeader",
|
|
2194
|
+
cellAlignment: normalizeTableCellAlignment(_optionalChain([cell, 'optionalAccess', _70 => _70.attrs, 'access', _71 => _71.align])),
|
|
2195
|
+
cellBackground: normalizeTableCellColor(_optionalChain([cell, 'optionalAccess', _72 => _72.attrs, 'access', _73 => _73.backgroundColor]))
|
|
1950
2196
|
};
|
|
1951
|
-
} catch (
|
|
2197
|
+
} catch (e7) {
|
|
1952
2198
|
return { ...base, inTable: true };
|
|
1953
2199
|
}
|
|
1954
2200
|
}
|
|
@@ -1966,10 +2212,10 @@ function createTableStore(editor) {
|
|
|
1966
2212
|
listeners.forEach((listener) => listener());
|
|
1967
2213
|
};
|
|
1968
2214
|
const detach = () => {
|
|
1969
|
-
_optionalChain([editor, 'optionalAccess',
|
|
1970
|
-
_optionalChain([editor, 'optionalAccess',
|
|
1971
|
-
_optionalChain([editor, 'optionalAccess',
|
|
1972
|
-
_optionalChain([editor, 'optionalAccess',
|
|
2215
|
+
_optionalChain([editor, 'optionalAccess', _74 => _74.off, 'call', _75 => _75("transaction", update)]);
|
|
2216
|
+
_optionalChain([editor, 'optionalAccess', _76 => _76.off, 'call', _77 => _77("update", update)]);
|
|
2217
|
+
_optionalChain([editor, 'optionalAccess', _78 => _78.off, 'call', _79 => _79("focus", update)]);
|
|
2218
|
+
_optionalChain([editor, 'optionalAccess', _80 => _80.off, 'call', _81 => _81("destroy", update)]);
|
|
1973
2219
|
};
|
|
1974
2220
|
return {
|
|
1975
2221
|
getSnapshot: () => {
|
|
@@ -2008,7 +2254,7 @@ function createTableStore(editor) {
|
|
|
2008
2254
|
|
|
2009
2255
|
var _history = require('@tiptap/pm/history');
|
|
2010
2256
|
|
|
2011
|
-
|
|
2257
|
+
|
|
2012
2258
|
var DEFAULT_AGENT_CARET_COLOR = "#8b5cf6";
|
|
2013
2259
|
var DEFAULT_AGENT_CARET_NAME = "Agent";
|
|
2014
2260
|
var agentCaretPluginKey = new (0, _state.PluginKey)("agentCaret");
|
|
@@ -2097,11 +2343,11 @@ function createAgentCaretPlugin() {
|
|
|
2097
2343
|
const anchor = clamp(input.from, size);
|
|
2098
2344
|
const caret = {
|
|
2099
2345
|
id: input.id,
|
|
2100
|
-
name: _nullishCoalesce(_nullishCoalesce(input.name, () => ( _optionalChain([prev, 'optionalAccess',
|
|
2101
|
-
color: _nullishCoalesce(_nullishCoalesce(input.color, () => ( _optionalChain([prev, 'optionalAccess',
|
|
2346
|
+
name: _nullishCoalesce(_nullishCoalesce(input.name, () => ( _optionalChain([prev, 'optionalAccess', _82 => _82.name]))), () => ( DEFAULT_AGENT_CARET_NAME)),
|
|
2347
|
+
color: _nullishCoalesce(_nullishCoalesce(input.color, () => ( _optionalChain([prev, 'optionalAccess', _83 => _83.color]))), () => ( DEFAULT_AGENT_CARET_COLOR)),
|
|
2102
2348
|
anchor,
|
|
2103
2349
|
head: input.to === void 0 ? anchor : clamp(input.to, size),
|
|
2104
|
-
changed: _nullishCoalesce(_optionalChain([prev, 'optionalAccess',
|
|
2350
|
+
changed: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _84 => _84.changed]), () => ( []))
|
|
2105
2351
|
};
|
|
2106
2352
|
carets = prev ? carets.map((c) => c.id === input.id ? caret : c) : [...carets, caret];
|
|
2107
2353
|
} else if (meta && "clear" in meta) {
|
|
@@ -2115,13 +2361,13 @@ function createAgentCaretPlugin() {
|
|
|
2115
2361
|
const span = meta.span;
|
|
2116
2362
|
spans = { ...spans };
|
|
2117
2363
|
if ("end" in span) delete spans[span.id];
|
|
2118
|
-
else spans[span.id] = { from: span.from, to: span.to, foreign: _nullishCoalesce(_optionalChain([spans, 'access',
|
|
2364
|
+
else spans[span.id] = { from: span.from, to: span.to, foreign: _nullishCoalesce(_optionalChain([spans, 'access', _85 => _85[span.id], 'optionalAccess', _86 => _86.foreign]), () => ( false)) };
|
|
2119
2365
|
}
|
|
2120
2366
|
return { carets, spans, decorations: buildDecorations(state, carets) };
|
|
2121
2367
|
}
|
|
2122
2368
|
},
|
|
2123
2369
|
props: {
|
|
2124
|
-
decorations: (state) => _optionalChain([agentCaretPluginKey, 'access',
|
|
2370
|
+
decorations: (state) => _optionalChain([agentCaretPluginKey, 'access', _87 => _87.getState, 'call', _88 => _88(state), 'optionalAccess', _89 => _89.decorations])
|
|
2125
2371
|
}
|
|
2126
2372
|
});
|
|
2127
2373
|
}
|
|
@@ -2152,7 +2398,7 @@ function markAgentChanges(editor, id, ranges) {
|
|
|
2152
2398
|
dispatchMeta(editor, { changed: { id, ranges } });
|
|
2153
2399
|
}
|
|
2154
2400
|
function getAgentCarets(state) {
|
|
2155
|
-
return _nullishCoalesce(_optionalChain([agentCaretPluginKey, 'access',
|
|
2401
|
+
return _nullishCoalesce(_optionalChain([agentCaretPluginKey, 'access', _90 => _90.getState, 'call', _91 => _91(state), 'optionalAccess', _92 => _92.carets]), () => ( []));
|
|
2156
2402
|
}
|
|
2157
2403
|
function replaceWithTextTransaction(state, from, to, text) {
|
|
2158
2404
|
return /[\r\n]/.test(text) ? state.tr.replace(from, to, _chunkG43MNQ4Ccjs.plainTextToSlice.call(void 0, text, state.schema)) : text ? state.tr.insertText(text, from, to) : state.tr.delete(from, to);
|
|
@@ -2196,7 +2442,7 @@ async function typeAgentText(editor, options) {
|
|
|
2196
2442
|
try {
|
|
2197
2443
|
if (from < to) await wait(_nullishCoalesce(options.selectMs, () => ( 250)));
|
|
2198
2444
|
for (let i = 1; i <= frames; i++) {
|
|
2199
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
2445
|
+
if (_optionalChain([signal, 'optionalAccess', _93 => _93.aborted])) throw new Error("Typing was cancelled; the document is unchanged.");
|
|
2200
2446
|
if (editor.isDestroyed) throw new Error("The editor was closed while the agent was typing.");
|
|
2201
2447
|
const s = span();
|
|
2202
2448
|
const prefix = chars.slice(0, Math.round(chars.length * i / frames)).join("");
|
|
@@ -2287,4 +2533,12 @@ async function typeAgentText(editor, options) {
|
|
|
2287
2533
|
|
|
2288
2534
|
|
|
2289
2535
|
|
|
2290
|
-
|
|
2536
|
+
|
|
2537
|
+
|
|
2538
|
+
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
|
|
2544
|
+
exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.ALLOW_NESTED_TABLES_META = ALLOW_NESTED_TABLES_META; exports.tableNestingPluginKey = tableNestingPluginKey; exports.outermostTableDepth = outermostTableDepth; exports.isInTableCell = isInTableCell; exports.sliceContainsTable = sliceContainsTable; exports.insertSliceAfterTable = insertSliceAfterTable; exports.handleTablePasteWithoutNesting = handleTablePasteWithoutNesting; exports.unnestTables = unnestTables; exports.createTableNestingPlugin = createTableNestingPlugin; exports.generateStructureId = generateStructureId; exports.presenceStateSpec = presenceStateSpec; exports.arraysEqual = arraysEqual; exports.scrollDomAtPos = scrollDomAtPos; exports.syncInitialContent = syncInitialContent; exports.STRUCTURE_PRIORITY = STRUCTURE_PRIORITY; exports.FIND_PARAGRAPH_MARK = FIND_PARAGRAPH_MARK; exports.MAX_FIND_PATTERN_LENGTH = MAX_FIND_PATTERN_LENGTH; exports.createSearchBudget = createSearchBudget; exports.foldCodePoint = foldCodePoint; exports.compileFindPattern = compileFindPattern; exports.findAllMatches = findAllMatches; exports.parseReplacement = parseReplacement; exports.expandReplacement = expandReplacement; exports.searchDocument = searchDocument; exports.applyReplacements = applyReplacements; exports.normalizeTableCellAlignment = normalizeTableCellAlignment; exports.normalizeTableCellColor = normalizeTableCellColor; exports.isGfmTable = isGfmTable; exports.DEFAULT_TABLE_OPTIONS = DEFAULT_TABLE_OPTIONS; exports.Table = Table; exports.TableRow = TableRow; exports.TableCell = TableCell; exports.TableHeader = TableHeader; exports.createTableExtensions = createTableExtensions; exports.ChartNodeView = ChartNodeView; exports.createChartNodeView = createChartNodeView; exports.chartPluginKey = chartPluginKey; exports.getDocumentCharts = getDocumentCharts; exports.isChartEnabled = isChartEnabled; exports.staticChartSvg = staticChartSvg; exports.Chart = Chart; exports.SPARKLINE_KINDS = SPARKLINE_KINDS; exports.MAX_SPARKLINE_VALUES = MAX_SPARKLINE_VALUES; exports.normalizeSparklineValues = normalizeSparklineValues; exports.sparklineLabel = sparklineLabel; exports.Sparkline = Sparkline; exports.TABLE_ACTIONS = TABLE_ACTIONS; exports.DEFAULT_TABLE_TOOLBAR = DEFAULT_TABLE_TOOLBAR; exports.MAX_TABLE_ROWS = MAX_TABLE_ROWS; exports.MAX_TABLE_COLUMNS = MAX_TABLE_COLUMNS; exports.isTableEnabled = isTableEnabled; exports.isSelectionInTable = isSelectionInTable; exports.shouldShowTableBubbleMenu = shouldShowTableBubbleMenu; exports.getTableActionState = getTableActionState; exports.runTableAction = runTableAction; exports.EMPTY_TABLE_STATE = EMPTY_TABLE_STATE; exports.getTableState = getTableState; exports.createTableStore = createTableStore; exports.DEFAULT_AGENT_CARET_COLOR = DEFAULT_AGENT_CARET_COLOR; exports.DEFAULT_AGENT_CARET_NAME = DEFAULT_AGENT_CARET_NAME; exports.agentCaretPluginKey = agentCaretPluginKey; exports.createAgentCaretPlugin = createAgentCaretPlugin; exports.AgentCaret = AgentCaret; exports.ensureAgentCaret = ensureAgentCaret; exports.setAgentCaret = setAgentCaret; exports.clearAgentCaret = clearAgentCaret; exports.markAgentChanges = markAgentChanges; exports.getAgentCarets = getAgentCarets; exports.replaceWithTextTransaction = replaceWithTextTransaction; exports.typeAgentText = typeAgentText;
|