@mx-space/cli 0.13.1 → 0.13.2

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.
Files changed (58) hide show
  1. package/README.md +59 -0
  2. package/ROADMAP.md +10 -7
  3. package/dist/{Lexical.dev-By5dOKBN.mjs → Lexical.dev-BsbWMhb3.mjs} +2265 -429
  4. package/dist/{Lexical.node-fXM8Jp7p.mjs → Lexical.node-DnR_u_Ke.mjs} +47 -10
  5. package/dist/Lexical.prod-B7L8eVsO.mjs +6816 -0
  6. package/dist/{LexicalClipboard.dev--HxGoSkO.mjs → LexicalClipboard.dev-BGSFbuTA.mjs} +131 -39
  7. package/dist/{LexicalClipboard.node-C3mRbrmW.mjs → LexicalClipboard.node-CUD_tpWb.mjs} +2 -2
  8. package/dist/LexicalClipboard.prod-DQXfRt3h.mjs +429 -0
  9. package/dist/{LexicalCodeCore.dev-DjSrd4A4.mjs → LexicalCodeCore.dev-B9lK_GSN.mjs} +81 -67
  10. package/dist/LexicalCodeCore.prod-CNWMPXhg.mjs +651 -0
  11. package/dist/LexicalDragon.dev-DRm2bGZ1.mjs +186 -0
  12. package/dist/{LexicalDragon.node-BVhw4C7s.mjs → LexicalDragon.node-d8gPruly.mjs} +3 -2
  13. package/dist/LexicalDragon.prod-ey3uKDJF.mjs +121 -0
  14. package/dist/{LexicalExtension.dev-BPNyvGqe.mjs → LexicalExtension.dev-CXtOJb83.mjs} +349 -35
  15. package/dist/{LexicalExtension.node-BVlcrgOx.mjs → LexicalExtension.node-CMsupJZs.mjs} +9 -4
  16. package/dist/{LexicalExtension.prod-DFKbiNt-.mjs → LexicalExtension.prod-BCLGhzcg.mjs} +477 -328
  17. package/dist/{LexicalHeadless.dev-B-cj7Pr5.mjs → LexicalHeadless.dev-yVDOBd64.mjs} +2 -2
  18. package/dist/{LexicalHeadless.prod-Byp1vNzT.mjs → LexicalHeadless.prod-B8qauuEA.mjs} +2 -2
  19. package/dist/{LexicalHtml.dev-prBAwszN.mjs → LexicalHtml.dev-3rdckXIU.mjs} +323 -265
  20. package/dist/{LexicalHtml.node-BvNF96jZ.mjs → LexicalHtml.node-DagZUjQ_.mjs} +6 -4
  21. package/dist/{LexicalHtml.prod-Sz3CW1ht.mjs → LexicalHtml.prod-B5AQaJDb.mjs} +354 -352
  22. package/dist/{LexicalLink.dev-NySTYhVR.mjs → LexicalLink.dev-CspSwLNB.mjs} +69 -58
  23. package/dist/{LexicalLink.prod-BuCM8gts.mjs → LexicalLink.prod-Da-ZW6H5.mjs} +210 -211
  24. package/dist/{LexicalList.dev-DIMOvSFD.mjs → LexicalList.dev-CNXmV6v8.mjs} +246 -198
  25. package/dist/LexicalList.prod-DgQzj4v9.mjs +944 -0
  26. package/dist/{LexicalMarkdown.dev-C7aylvCG.mjs → LexicalMarkdown.dev-0XURdo96.mjs} +129 -37
  27. package/dist/LexicalMarkdown.prod-qUsIQfJx.mjs +932 -0
  28. package/dist/{LexicalRichText.dev-DfICq6lU.mjs → LexicalRichText.dev-BqsEA7I9.mjs} +151 -122
  29. package/dist/{LexicalRichText.node-Bg9jND3Q.mjs → LexicalRichText.node-D73RR0Ck.mjs} +8 -11
  30. package/dist/LexicalRichText.prod-4Atyd7OR.mjs +538 -0
  31. package/dist/{LexicalSelection.dev-DGjj12wW.mjs → LexicalSelection.dev-DK5xfxKP.mjs} +10 -9
  32. package/dist/{LexicalSelection.node-BU5L4193.mjs → LexicalSelection.node-pyZyrANz.mjs} +4 -4
  33. package/dist/{LexicalSelection.prod-D-PwRbyK.mjs → LexicalSelection.prod-C5GrCbDC.mjs} +144 -146
  34. package/dist/{LexicalTable.dev-ChP7cugd.mjs → LexicalTable.dev-DiR_4rdI.mjs} +184 -119
  35. package/dist/LexicalTable.prod-Cbc5EasT.mjs +2336 -0
  36. package/dist/{LexicalUtils.dev-BiFU3789.mjs → LexicalUtils.dev-jhPjn1vQ.mjs} +375 -35
  37. package/dist/{LexicalUtils.node-j3Llm7Y3.mjs → LexicalUtils.node-Ck74ludK.mjs} +24 -12
  38. package/dist/LexicalUtils.prod-nuTBxnk_.mjs +504 -0
  39. package/dist/bin/mxs.mjs +1 -1
  40. package/dist/esm-BumPuCXw.mjs +2 -0
  41. package/dist/{esm-DFrz5rIo.mjs → esm-DupC6TTP.mjs} +214 -179
  42. package/dist/index.d.mts +46 -17
  43. package/dist/index.mjs +1 -1
  44. package/dist/{mxs-DXpzbUf4.mjs → mxs-BgAyMQdq.mjs} +8384 -6209
  45. package/package.json +17 -17
  46. package/skills/commands-ai.md +115 -0
  47. package/skills/overview.md +1 -0
  48. package/dist/Lexical.prod-BlCvXPGa.mjs +0 -6088
  49. package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +0 -371
  50. package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +0 -642
  51. package/dist/LexicalDragon.dev-DwprRH0z.mjs +0 -88
  52. package/dist/LexicalDragon.prod-nh4J-8vn.mjs +0 -59
  53. package/dist/LexicalList.prod-MVqfA6Vo.mjs +0 -925
  54. package/dist/LexicalMarkdown.prod-CfQSM406.mjs +0 -868
  55. package/dist/LexicalRichText.prod-GsFzCK-o.mjs +0 -550
  56. package/dist/LexicalTable.prod-Bpr9YRXp.mjs +0 -2311
  57. package/dist/LexicalUtils.prod-DCvrA78p.mjs +0 -373
  58. package/dist/esm-DXO9Afik.mjs +0 -2
@@ -1,642 +0,0 @@
1
- import { d as getPeerDependencyFromEditor, f as namedSignals, l as effect } from "./LexicalExtension.node-BVlcrgOx.mjs";
2
- import { $ as $isElementNode, $t as ElementNode, An as KEY_ARROW_UP_COMMAND, Ar as removeClassNamesFromElement, Bn as OUTDENT_CONTENT_COMMAND, Bt as COMMAND_PRIORITY_LOW, D as $getCaretRangeInDirection, Dn as KEY_ARROW_DOWN_COMMAND, E as $getCaretRange, F as $getEditor, In as KEY_TAB_COMMAND, J as $insertNodes, K as $getTextPointCaret, Mr as setDOMStyleFromCSS, Nn as KEY_ENTER_COMMAND, Or as mergeRegister, Rn as MOVE_TO_END, Sr as isHTMLElement, Tt as $setSelectionFromCaretRange, U as $getSelection, W as $getSiblingCaret, _r as isDOMDocumentNode, cr as defineExtension, dt as $isTabNode, er as TextNode, f as $createParagraphNode, ft as $isTextNode, g as $createTabNode, ht as $normalizeCaret, it as $isLineBreakNode, jr as safeCast, l as $create, ln as INSERT_TAB_COMMAND, mr as getTextDirection, n as $applyNodeReplacement, on as INDENT_CONTENT_COMMAND, p as $createPoint, rr as configExtension, st as $isRangeSelection, tr as addClassNamesToElement, u as $createLineBreakNode, x as $generateNodesFromRawText, yr as isDOMTextNode, zn as MOVE_TO_START } from "./Lexical.node-fXM8Jp7p.mjs";
3
- import { a as CoreImportExtension, g as sel, m as defineOverlayRules, o as DOMImportExtension, p as defineImportRule, s as ImportOverlays } from "./LexicalHtml.node-BvNF96jZ.mjs";
4
- //#region ../../node_modules/.pnpm/@lexical+code-core@0.45.0/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.mjs
5
- /**
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- *
11
- */
12
- function Z(t, ...e) {
13
- const n = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams();
14
- r.append("code", t);
15
- for (const t of e) r.append("v", t);
16
- throw n.search = r.toString(), Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
17
- }
18
- function tt(t, e) {
19
- let r = t;
20
- for (let i = $getSiblingCaret(t, e); i && (Pt(i.origin) || $isTabNode(i.origin)); i = i.getAdjacentCaret()) r = i.origin;
21
- return r;
22
- }
23
- function et(t) {
24
- return tt(t, "previous");
25
- }
26
- function nt(t) {
27
- return tt(t, "next");
28
- }
29
- function rt(n) {
30
- const r = et(n), i = nt(n);
31
- let o = r;
32
- for (; null !== o;) {
33
- if (Pt(o)) {
34
- const e = getTextDirection(o.getTextContent());
35
- if (null !== e) return e;
36
- }
37
- if (o === i) break;
38
- o = o.getNextSibling();
39
- }
40
- const s = r.getParent();
41
- if ($isElementNode(s)) {
42
- const t = s.getDirection();
43
- if ("ltr" === t || "rtl" === t) return t;
44
- }
45
- return null;
46
- }
47
- function it(t, e) {
48
- let i = null, o = null, s = t, l = e, u = t.getTextContent();
49
- for (;;) {
50
- if (0 === l) {
51
- if (s = s.getPreviousSibling(), null === s) break;
52
- if (Pt(s) || $isTabNode(s) || $isLineBreakNode(s) || Z(167), $isLineBreakNode(s)) {
53
- i = {
54
- node: s,
55
- offset: 1
56
- };
57
- break;
58
- }
59
- l = Math.max(0, s.getTextContentSize() - 1), u = s.getTextContent();
60
- } else l--;
61
- const t = u[l];
62
- Pt(s) && " " !== t && (o = {
63
- node: s,
64
- offset: l
65
- });
66
- }
67
- if (null !== o) return o;
68
- let c = null;
69
- if (e < t.getTextContentSize()) Pt(t) && (c = t.getTextContent()[e]);
70
- else {
71
- const e = t.getNextSibling();
72
- Pt(e) && (c = e.getTextContent()[0]);
73
- }
74
- if (null !== c && " " !== c) return i;
75
- {
76
- const n = function(t, e) {
77
- let n = t, i = e, o = t.getTextContent(), s = t.getTextContentSize();
78
- for (;;) {
79
- if (!Pt(n) || i === s) {
80
- if (n = n.getNextSibling(), null === n || $isLineBreakNode(n)) return null;
81
- Pt(n) && (i = 0, o = n.getTextContent(), s = n.getTextContentSize());
82
- }
83
- if (Pt(n)) {
84
- if (" " !== o[i]) return {
85
- node: n,
86
- offset: i
87
- };
88
- i++;
89
- }
90
- }
91
- }(t, e);
92
- return null !== n ? n : i;
93
- }
94
- }
95
- function ot(t) {
96
- const e = nt(t);
97
- return $isLineBreakNode(e) && Z(168), e;
98
- }
99
- function st(t) {
100
- const e = [];
101
- return t.split("\n").forEach((t, n) => {
102
- n > 0 && e.push($createLineBreakNode());
103
- t.split(" ").forEach((t, n) => {
104
- n > 0 && e.push($createTabNode()), t.length > 0 && e.push(Ot(t));
105
- });
106
- }), e;
107
- }
108
- function lt(t, e, n) {
109
- if (!Number.isInteger(e) || e <= 0) return !1;
110
- const r = t.getTextContent(), i = /^ +/.exec(r);
111
- if (!i) return !1;
112
- const o = Math.min(e, i[0].length), s = t.getKey(), l = n.anchor.key === s && "text" === n.anchor.type ? n.anchor.offset : null, u = n.focus.key === s && "text" === n.focus.type ? n.focus.offset : null;
113
- return t.spliceText(0, o, ""), null !== l && n.anchor.set(s, Math.max(0, l - o), "text"), null !== u && n.focus.set(s, Math.max(0, u - o), "text"), !0;
114
- }
115
- const ut = "javascript", ct = () => ut;
116
- function at(t, e) {
117
- for (const n of t.childNodes) {
118
- if (isHTMLElement(n) && n.tagName === e) return !0;
119
- if (at(n, e)) return !0;
120
- }
121
- return !1;
122
- }
123
- const gt = "data-language", ht = "data-highlight-language", ft = "data-theme";
124
- var dt = class dt extends ElementNode {
125
- __language;
126
- __theme;
127
- __isSyntaxHighlightSupported;
128
- static getType() {
129
- return "code";
130
- }
131
- static clone(t) {
132
- return new dt(t.__language, t.__key);
133
- }
134
- constructor(t, e) {
135
- super(e), this.__language = t || void 0, this.__isSyntaxHighlightSupported = !1, this.__theme = void 0;
136
- }
137
- afterCloneFrom(t) {
138
- super.afterCloneFrom(t), this.__language = t.__language, this.__theme = t.__theme, this.__isSyntaxHighlightSupported = t.__isSyntaxHighlightSupported;
139
- }
140
- createDOM(t) {
141
- const e = document.createElement("code");
142
- addClassNamesToElement(e, t.theme.code), e.setAttribute("spellcheck", "false");
143
- const n = this.getLanguage();
144
- n && (e.setAttribute(gt, n), this.getIsSyntaxHighlightSupported() && e.setAttribute(ht, n));
145
- const r = this.getTheme();
146
- r && e.setAttribute(ft, r);
147
- const i = this.getStyle();
148
- return i && setDOMStyleFromCSS(e.style, i), e;
149
- }
150
- updateDOM(t, e, n) {
151
- const r = this.__language, i = t.__language;
152
- r ? r !== i && e.setAttribute(gt, r) : i && e.removeAttribute(gt);
153
- const o = this.__isSyntaxHighlightSupported;
154
- t.__isSyntaxHighlightSupported && i ? o && r ? r !== i && e.setAttribute(ht, r) : e.removeAttribute(ht) : o && r && e.setAttribute(ht, r);
155
- const s = this.__theme, l = t.__theme;
156
- s ? s !== l && e.setAttribute(ft, s) : l && e.removeAttribute(ft);
157
- const u = this.__style, c = t.__style;
158
- return u !== c && setDOMStyleFromCSS(e.style, u, c), !1;
159
- }
160
- exportDOM(t) {
161
- const e = document.createElement("pre");
162
- addClassNamesToElement(e, t._config.theme.code), e.setAttribute("spellcheck", "false");
163
- const n = this.getLanguage();
164
- n && (e.setAttribute(gt, n), this.getIsSyntaxHighlightSupported() && e.setAttribute(ht, n));
165
- const r = this.getTheme();
166
- r && e.setAttribute(ft, r);
167
- const i = this.getStyle();
168
- return i && setDOMStyleFromCSS(e.style, i), { element: e };
169
- }
170
- static importDOM() {
171
- return {
172
- code: (t) => null != t.textContent && (/\r?\n/.test(t.textContent) || at(t, "BR")) ? {
173
- conversion: _t,
174
- priority: 1
175
- } : null,
176
- div: () => ({
177
- conversion: St,
178
- priority: 1
179
- }),
180
- pre: () => ({
181
- conversion: _t,
182
- priority: 0
183
- }),
184
- table: (t) => Ct(t) ? {
185
- conversion: yt,
186
- priority: 3
187
- } : null,
188
- td: (t) => {
189
- const e = t, n = e.closest("table");
190
- return e.classList.contains("js-file-line") || n && Ct(n) ? {
191
- conversion: bt,
192
- priority: 3
193
- } : null;
194
- },
195
- tr: (t) => {
196
- const e = t.closest("table");
197
- return e && Ct(e) ? {
198
- conversion: bt,
199
- priority: 3
200
- } : null;
201
- }
202
- };
203
- }
204
- static importJSON(t) {
205
- return mt().updateFromJSON(t);
206
- }
207
- updateFromJSON(t) {
208
- return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme);
209
- }
210
- exportJSON() {
211
- return {
212
- ...super.exportJSON(),
213
- language: this.getLanguage(),
214
- theme: this.getTheme()
215
- };
216
- }
217
- insertNewAfter(t, e = !0) {
218
- if (!getPeerDependencyFromEditor($getEditor(), "@lexical/code")) {
219
- const e = Tt(t);
220
- if (e) return e;
221
- }
222
- const { anchor: r, focus: s } = t, l = (r.isBefore(s) ? r : s).getNode();
223
- if ($isTextNode(l)) {
224
- let t = et(l);
225
- const e = [];
226
- for (;;) if ($isTabNode(t)) e.push($createTabNode()), t = t.getNextSibling();
227
- else {
228
- if (!Pt(t)) break;
229
- {
230
- let n = 0;
231
- const r = t.getTextContent(), i = t.getTextContentSize();
232
- for (; n < i && " " === r[n];) n++;
233
- if (0 !== n && e.push(Ot(" ".repeat(n))), n !== i) break;
234
- t = t.getNextSibling();
235
- }
236
- }
237
- const s = l.splitText(r.offset)[0], u = 0 === r.offset ? 0 : 1, c = s.getIndexWithinParent() + u, a = l.getParentOrThrow(), g = [$createLineBreakNode(), ...e];
238
- a.splice(c, 0, g);
239
- const h = e[e.length - 1];
240
- h ? h.select() : 0 === r.offset ? s.selectPrevious() : s.getNextSibling().selectNext(0, 0);
241
- }
242
- if (xt(l)) {
243
- const { offset: e } = t.anchor;
244
- l.splice(e, 0, [$createLineBreakNode()]), l.select(e + 1, e + 1);
245
- }
246
- return null;
247
- }
248
- canIndent() {
249
- return !1;
250
- }
251
- collapseAtStart() {
252
- const t = $createParagraphNode();
253
- return this.getChildren().forEach((e) => t.append(e)), this.replace(t), !0;
254
- }
255
- setLanguage(t) {
256
- const e = this.getWritable();
257
- return e.__language = t || void 0, e;
258
- }
259
- getLanguage() {
260
- return this.getLatest().__language;
261
- }
262
- setIsSyntaxHighlightSupported(t) {
263
- const e = this.getWritable();
264
- return e.__isSyntaxHighlightSupported = t, e;
265
- }
266
- getIsSyntaxHighlightSupported() {
267
- return this.getLatest().__isSyntaxHighlightSupported;
268
- }
269
- setTheme(t) {
270
- const e = this.getWritable();
271
- return e.__theme = t || void 0, e;
272
- }
273
- getTheme() {
274
- return this.getLatest().__theme;
275
- }
276
- };
277
- function mt(t, e) {
278
- return $create(dt).setLanguage(t).setTheme(e);
279
- }
280
- function xt(t) {
281
- return t instanceof dt;
282
- }
283
- function _t(t) {
284
- return { node: mt(t.getAttribute(gt)) };
285
- }
286
- function St(t) {
287
- const e = t, n = vt(e);
288
- return n || function(t) {
289
- let e = t.parentElement;
290
- for (; null !== e;) {
291
- if (vt(e)) return !0;
292
- e = e.parentElement;
293
- }
294
- return !1;
295
- }(e) ? { node: n ? mt() : null } : { node: null };
296
- }
297
- function yt() {
298
- return { node: mt() };
299
- }
300
- function bt() {
301
- return { node: null };
302
- }
303
- function vt(t) {
304
- return null !== t.style.fontFamily.match("monospace");
305
- }
306
- function Ct(t) {
307
- return t.classList.contains("js-file-line-container");
308
- }
309
- function Tt(t) {
310
- const { anchor: e } = t;
311
- if (t.isCollapsed() && "element" === e.type) {
312
- const t = e.getNode();
313
- if (xt(t)) {
314
- const n = t.getChildrenSize();
315
- if (n >= 2 && e.offset === n) {
316
- const e = t.getLastChild();
317
- if ($isLineBreakNode(e) && $isLineBreakNode(e.getPreviousSibling())) {
318
- const e = $createParagraphNode();
319
- return t.splice(n - 2, 2, []).insertAfter(e, !1), e.select(), e;
320
- }
321
- }
322
- }
323
- }
324
- return null;
325
- }
326
- var Nt = class Nt extends TextNode {
327
- __highlightType;
328
- constructor(t = "", e, n) {
329
- super(t, n), this.__highlightType = e;
330
- }
331
- static getType() {
332
- return "code-highlight";
333
- }
334
- static clone(t) {
335
- return new Nt(t.__text, t.__highlightType || void 0, t.__key);
336
- }
337
- afterCloneFrom(t) {
338
- super.afterCloneFrom(t), this.__highlightType = t.__highlightType;
339
- }
340
- getHighlightType() {
341
- return this.getLatest().__highlightType;
342
- }
343
- setHighlightType(t) {
344
- const e = this.getWritable();
345
- return e.__highlightType = t || void 0, e;
346
- }
347
- canHaveFormat() {
348
- return !1;
349
- }
350
- createDOM(t) {
351
- const e = super.createDOM(t);
352
- return addClassNamesToElement(e, At(t.theme, this.__highlightType)), e;
353
- }
354
- updateDOM(t, e, n) {
355
- const r = super.updateDOM(t, e, n), i = At(n.theme, t.__highlightType), o = At(n.theme, this.__highlightType);
356
- return i !== o && (i && removeClassNamesFromElement(e, i), o && addClassNamesToElement(e, o)), r;
357
- }
358
- static importJSON(t) {
359
- return Ot().updateFromJSON(t);
360
- }
361
- updateFromJSON(t) {
362
- return super.updateFromJSON(t).setHighlightType(t.highlightType);
363
- }
364
- exportJSON() {
365
- return {
366
- ...super.exportJSON(),
367
- highlightType: this.getHighlightType()
368
- };
369
- }
370
- setFormat(t) {
371
- return this;
372
- }
373
- isParentRequired() {
374
- return !0;
375
- }
376
- createParentElementNode() {
377
- return mt();
378
- }
379
- };
380
- function At(t, e) {
381
- return e && t && t.codeHighlight && t.codeHighlight[e];
382
- }
383
- function Ot(t = "", e) {
384
- return $applyNodeReplacement(new Nt(t, e));
385
- }
386
- function Pt(t) {
387
- return t instanceof Nt;
388
- }
389
- const wt = defineExtension({
390
- name: "@lexical/code",
391
- nodes: () => [dt, Nt],
392
- register: (t) => t.registerCommand(KEY_ENTER_COMMAND, (t) => {
393
- const e = $getSelection();
394
- return !(!$isRangeSelection(e) || !Tt(e)) && (t.preventDefault(), !0);
395
- }, COMMAND_PRIORITY_LOW)
396
- }), Ht = "data-language";
397
- function Dt(t) {
398
- return null !== t.style.fontFamily.match("monospace");
399
- }
400
- function Bt(t) {
401
- let e = t.parentElement;
402
- for (; null !== e;) {
403
- if (Dt(e)) return !0;
404
- e = e.parentElement;
405
- }
406
- return !1;
407
- }
408
- const Et = defineOverlayRules([defineImportRule({
409
- $import: (t, e) => t.$importChildren(e),
410
- match: sel.tag("tr", "td"),
411
- name: "@lexical/code/github-code-table/unwrap"
412
- })]), Lt = defineImportRule({
413
- $import: (t, e) => [mt(e.getAttribute(Ht)).splice(0, 0, t.$importChildren(e))],
414
- match: sel.tag("pre"),
415
- name: "@lexical/code/pre"
416
- }), $t = defineImportRule({
417
- $import: (t, e, n) => {
418
- const r = e.textContent || "";
419
- return /\r?\n/.test(r) || null !== e.querySelector("br") ? [mt(e.getAttribute(Ht)).splice(0, 0, t.$importChildren(e))] : n();
420
- },
421
- match: sel.tag("code"),
422
- name: "@lexical/code/code-multiline"
423
- });
424
- function kt(t) {
425
- if (!isHTMLElement(t)) return !1;
426
- const e = t.style.fontFamily, n = t.style.whiteSpace;
427
- return "string" == typeof e && /monospace/i.test(e) && "string" == typeof n && n.startsWith("pre");
428
- }
429
- function Ft(t) {
430
- let e = !1;
431
- const n = [];
432
- let r = "", i = !1;
433
- const o = () => {
434
- i && (n.push(r), r = "", i = !1);
435
- };
436
- for (const s of Array.from(t.childNodes)) if (isHTMLElement(s)) "DIV" === s.tagName ? (o(), n.push(s.textContent || ""), e = !0) : "BR" === s.tagName ? (o(), n.push(""), e = !0) : (r += s.textContent || "", i = !0);
437
- else if (isDOMTextNode(s)) {
438
- const t = s.textContent || "";
439
- t.length > 0 && (r += t, i = !0);
440
- }
441
- return o(), e ? n : null;
442
- }
443
- function Mt(t) {
444
- for (const e of Array.from(t.children)) {
445
- if (isHTMLElement(e) && kt(e)) {
446
- if (null !== Ft(e)) return !0;
447
- const t = e.nextElementSibling;
448
- if (t && kt(t)) return !0;
449
- continue;
450
- }
451
- if (Mt(e)) return !0;
452
- }
453
- return !1;
454
- }
455
- const Jt = defineOverlayRules([defineImportRule({
456
- $import: (t, e, n) => {
457
- if (!kt(e) || Bt(e)) return n();
458
- const r = Ft(e);
459
- return null === r || 0 === r.length ? n() : [mt().splice(0, 0, $generateNodesFromRawText(r.join("\n")))];
460
- },
461
- match: sel.tag("div"),
462
- name: "@lexical/code/vscode-wrapper"
463
- }), defineImportRule({
464
- $import: (t, e, n) => {
465
- if (!kt(e) || Bt(e)) return n();
466
- const r = e.previousElementSibling;
467
- if (r && kt(r)) return [];
468
- const i = [];
469
- let o = e;
470
- for (; o && kt(o);) i.push("BR" === o.tagName ? "" : o.textContent || ""), o = o.nextElementSibling;
471
- return i.length < 2 ? n() : [mt().splice(0, 0, $generateNodesFromRawText(i.join("\n")))];
472
- },
473
- match: sel.tag("div", "br"),
474
- name: "@lexical/code/vscode-line-run"
475
- })]), zt = defineImportRule({
476
- $import: (t, e, n) => Dt(e) ? [mt().splice(0, 0, t.$importChildren(e))] : Bt(e) ? t.$importChildren(e) : n(),
477
- match: sel.tag("div"),
478
- name: "@lexical/code/div"
479
- }), It = [
480
- defineImportRule({
481
- $import: (t, e) => [mt().splice(0, 0, t.$importChildren(e, { rules: Et }))],
482
- match: sel.tag("table").classAll("js-file-line-container"),
483
- name: "@lexical/code/github-code-table"
484
- }),
485
- defineImportRule({
486
- $import: (t, e) => t.$importChildren(e),
487
- match: sel.tag("td").classAll("js-file-line"),
488
- name: "@lexical/code/github-code-cell-by-class"
489
- }),
490
- $t,
491
- Lt,
492
- zt
493
- ], Kt = defineExtension({
494
- dependencies: [
495
- CoreImportExtension,
496
- wt,
497
- configExtension(DOMImportExtension, {
498
- preprocess: [(t, e, n) => {
499
- Mt(isDOMDocumentNode(t) ? t.body : t) && e.session.update(ImportOverlays, (t) => [...t, Jt]), n();
500
- }],
501
- rules: It
502
- })
503
- ],
504
- name: "@lexical/code/Import"
505
- });
506
- function jt(t) {
507
- if (!$isRangeSelection(t)) return !1;
508
- const e = t.anchor.getNode(), n = xt(e) ? e : e.getParent(), r = t.focus.getNode(), i = xt(r) ? r : r.getParent();
509
- return xt(n) && n.is(i);
510
- }
511
- function Rt(t) {
512
- const e = t.getNodes(), i = [];
513
- if (1 === e.length && xt(e[0])) return i;
514
- let o = [];
515
- for (let t = 0; t < e.length; t++) {
516
- const s = e[t];
517
- Pt(s) || $isTabNode(s) || $isLineBreakNode(s) || Z(169), $isLineBreakNode(s) ? o.length > 0 && (i.push(o), o = []) : o.push(s);
518
- }
519
- if (o.length > 0) {
520
- const e = t.isBackward() ? t.anchor : t.focus, n = $createPoint(o[0].getKey(), 0, "text");
521
- e.is(n) || i.push(o);
522
- }
523
- return i;
524
- }
525
- function Wt(t, e) {
526
- const r = $getSelection();
527
- if (!$isRangeSelection(r) || !jt(r)) return !1;
528
- const l = Rt(r), u = l.length;
529
- if (0 === u && r.isCollapsed()) return t === INDENT_CONTENT_COMMAND && r.insertNodes([$createTabNode()]), !0;
530
- if (0 === u && t === INDENT_CONTENT_COMMAND && "\n" === r.getTextContent()) {
531
- const t = $createTabNode(), e = $createLineBreakNode(), n = r.isBackward() ? "previous" : "next";
532
- return r.insertNodes([t, e]), $setSelectionFromCaretRange($getCaretRangeInDirection($getCaretRange($getTextPointCaret(t, "next", 0), $normalizeCaret($getSiblingCaret(e, "next"))), n)), !0;
533
- }
534
- for (let i = 0; i < u; i++) {
535
- const s = l[i];
536
- if (s.length > 0) {
537
- let l = s[0];
538
- if (0 === i && (l = et(l)), t === INDENT_CONTENT_COMMAND) {
539
- const t = $createTabNode();
540
- if (l.insertBefore(t), 0 === i) {
541
- const e = r.isBackward() ? "focus" : "anchor", n = $createPoint(l.getKey(), 0, "text");
542
- r[e].is(n) && r[e].set(t.getKey(), 0, "text");
543
- }
544
- } else $isTabNode(l) ? l.remove() : void 0 !== e && Pt(l) && lt(l, e, r);
545
- }
546
- }
547
- return !0;
548
- }
549
- function qt(t, e) {
550
- const i = $getSelection();
551
- if (!$isRangeSelection(i)) return !1;
552
- const { anchor: o, focus: s } = i, l = o.offset, u = s.offset, c = o.getNode(), a = s.getNode(), g = t === KEY_ARROW_UP_COMMAND;
553
- if (!jt(i) || !Pt(c) && !$isTabNode(c) || !Pt(a) && !$isTabNode(a)) return !1;
554
- if (!e.altKey) {
555
- if (i.isCollapsed()) {
556
- const t = c.getParentOrThrow();
557
- if (g && 0 === l && null === c.getPreviousSibling()) {
558
- if (null === t.getPreviousSibling()) return t.selectPrevious(), e.preventDefault(), !0;
559
- } else if (!g && l === c.getTextContentSize() && null === c.getNextSibling()) {
560
- if (null === t.getNextSibling()) return t.selectNext(), e.preventDefault(), !0;
561
- }
562
- }
563
- return !1;
564
- }
565
- let h, f;
566
- if (c.isBefore(a) ? (h = et(c), f = nt(a)) : (h = et(a), f = nt(c)), null == h || null == f) return !1;
567
- const p = h.getNodesBetween(f);
568
- for (let t = 0; t < p.length; t++) {
569
- const e = p[t];
570
- if (!Pt(e) && !$isTabNode(e) && !$isLineBreakNode(e)) return !1;
571
- }
572
- e.preventDefault(), e.stopPropagation();
573
- const d = g ? h.getPreviousSibling() : f.getNextSibling();
574
- if (!$isLineBreakNode(d)) return !0;
575
- const m = g ? d.getPreviousSibling() : d.getNextSibling();
576
- if (null == m) return !0;
577
- const x = Pt(m) || $isTabNode(m) || $isLineBreakNode(m) ? g ? et(m) : nt(m) : null;
578
- let _ = null != x ? x : m;
579
- return d.remove(), p.forEach((t) => t.remove()), t === KEY_ARROW_UP_COMMAND ? (p.forEach((t) => _.insertBefore(t)), _.insertBefore(d)) : (_.insertAfter(d), _ = d, p.forEach((t) => {
580
- _.insertAfter(t), _ = t;
581
- })), i.setTextNodeRange(c, l, a, u), !0;
582
- }
583
- function Ut(t, e) {
584
- const i = $getSelection();
585
- if (!$isRangeSelection(i)) return !1;
586
- const { anchor: o, focus: s } = i, l = o.getNode(), u = s.getNode(), c = t === MOVE_TO_START;
587
- if (!jt(i) || !Pt(l) && !$isTabNode(l) || !Pt(u) && !$isTabNode(u)) return !1;
588
- const a = u, g = "rtl" === rt(a) ? !c : c, h = o.key, f = o.offset, p = o.type;
589
- if (g) {
590
- const t = it(a, s.offset);
591
- if (null !== t) {
592
- const { node: e, offset: n } = t;
593
- $isLineBreakNode(e) ? e.selectNext(0, 0) : i.setTextNodeRange(e, n, e, n);
594
- } else a.getParentOrThrow().selectStart();
595
- } else ot(a).select();
596
- return e.shiftKey && i.anchor.set(h, f, p), e.preventDefault(), e.stopPropagation(), !0;
597
- }
598
- function Vt(t, e) {
599
- return mergeRegister(t.registerCommand(KEY_TAB_COMMAND, (e) => {
600
- const n = function(t) {
601
- const e = $getSelection();
602
- if (!$isRangeSelection(e) || !jt(e)) return null;
603
- const n = t ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND, r = t ? OUTDENT_CONTENT_COMMAND : INSERT_TAB_COMMAND, i = e.anchor, o = e.focus;
604
- if (i.is(o)) return r;
605
- const s = Rt(e);
606
- if (1 !== s.length) return n;
607
- const l = s[0];
608
- let u, c;
609
- 0 === l.length && Z(285), e.isBackward() ? (u = o, c = i) : (u = i, c = o);
610
- const a = et(l[0]), g = nt(l[0]), h = $createPoint(a.getKey(), 0, "text"), f = $createPoint(g.getKey(), g.getTextContentSize(), "text");
611
- return u.isBefore(h) || f.isBefore(c) ? n : h.isBefore(u) || c.isBefore(f) ? r : n;
612
- }(e.shiftKey);
613
- return null !== n && (e.preventDefault(), t.dispatchCommand(n, void 0), !0);
614
- }, COMMAND_PRIORITY_LOW), t.registerCommand(INSERT_TAB_COMMAND, () => !!jt($getSelection()) && ($insertNodes([$createTabNode()]), !0), COMMAND_PRIORITY_LOW), t.registerCommand(INDENT_CONTENT_COMMAND, () => Wt(INDENT_CONTENT_COMMAND), COMMAND_PRIORITY_LOW), t.registerCommand(OUTDENT_CONTENT_COMMAND, () => Wt(OUTDENT_CONTENT_COMMAND, e), COMMAND_PRIORITY_LOW), t.registerCommand(KEY_ARROW_UP_COMMAND, (t) => {
615
- const e = $getSelection();
616
- if (!$isRangeSelection(e)) return !1;
617
- const { anchor: n } = e, r = n.getNode();
618
- return !!jt(e) && (e.isCollapsed() && 0 === n.offset && null === r.getPreviousSibling() && xt(r.getParentOrThrow()) ? (t.preventDefault(), !0) : qt(KEY_ARROW_UP_COMMAND, t));
619
- }, COMMAND_PRIORITY_LOW), t.registerCommand(KEY_ARROW_DOWN_COMMAND, (t) => {
620
- const e = $getSelection();
621
- if (!$isRangeSelection(e)) return !1;
622
- const { anchor: n } = e, r = n.getNode();
623
- return !!jt(e) && (e.isCollapsed() && n.offset === r.getTextContentSize() && null === r.getNextSibling() && xt(r.getParentOrThrow()) ? (t.preventDefault(), !0) : qt(KEY_ARROW_DOWN_COMMAND, t));
624
- }, COMMAND_PRIORITY_LOW), t.registerCommand(MOVE_TO_START, (t) => Ut(MOVE_TO_START, t), COMMAND_PRIORITY_LOW), t.registerCommand(MOVE_TO_END, (t) => Ut(MOVE_TO_END, t), COMMAND_PRIORITY_LOW));
625
- }
626
- const Gt = defineExtension({
627
- build: (t, e) => namedSignals(e),
628
- config: safeCast({
629
- disabled: !1,
630
- tabSize: void 0
631
- }),
632
- dependencies: [wt],
633
- name: "@lexical/code-indent",
634
- register: (t, e, n) => {
635
- const r = n.getOutput();
636
- return effect(() => {
637
- if (!r.disabled.value) return Vt(t, r.tabSize.value);
638
- });
639
- }
640
- });
641
- //#endregion
642
- export { Ot as $createCodeHighlightNode, mt as $createCodeNode, rt as $getCodeLineDirection, ot as $getEndOfCodeInLine, et as $getFirstCodeNodeOfLine, nt as $getLastCodeNodeOfLine, it as $getStartOfCodeInLine, Pt as $isCodeHighlightNode, xt as $isCodeNode, lt as $outdentLeadingSpaces, st as $plainifyCodeContent, wt as CodeExtension, Nt as CodeHighlightNode, Kt as CodeImportExtension, It as CodeImportRules, Gt as CodeIndentExtension, dt as CodeNode, ut as DEFAULT_CODE_LANGUAGE, ct as getDefaultCodeLanguage, Vt as registerCodeIndentation };