@mx-space/cli 0.7.8 → 0.9.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.
Files changed (68) hide show
  1. package/README.md +30 -0
  2. package/ROADMAP.md +1 -0
  3. package/dist/{Lexical.dev-rcxzwpir.mjs → Lexical.dev-By5dOKBN.mjs} +1486 -356
  4. package/dist/{Lexical.node-BUsI9gWr.mjs → Lexical.node-fXM8Jp7p.mjs} +39 -17
  5. package/dist/{Lexical.prod-C8HtkSD6.mjs → Lexical.prod-BlCvXPGa.mjs} +2279 -1768
  6. package/dist/LexicalClipboard.dev--HxGoSkO.mjs +915 -0
  7. package/dist/{LexicalClipboard.node-CO-MCKx5.mjs → LexicalClipboard.node-C3mRbrmW.mjs} +10 -3
  8. package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +371 -0
  9. package/dist/LexicalCodeCore.dev-DjSrd4A4.mjs +1109 -0
  10. package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +642 -0
  11. package/dist/{LexicalDragon.dev-gBP8WSRS.mjs → LexicalDragon.dev-DwprRH0z.mjs} +3 -3
  12. package/dist/{LexicalDragon.node-OG6G55nl.mjs → LexicalDragon.node-BVhw4C7s.mjs} +2 -2
  13. package/dist/{LexicalDragon.prod-DP-_Q8cv.mjs → LexicalDragon.prod-nh4J-8vn.mjs} +3 -3
  14. package/dist/{LexicalExtension.dev-DVbjljrm.mjs → LexicalExtension.dev-BPNyvGqe.mjs} +335 -6
  15. package/dist/{LexicalExtension.node-CF3EAPN7.mjs → LexicalExtension.node-BVlcrgOx.mjs} +15 -8
  16. package/dist/{LexicalExtension.prod-DklHHErZ.mjs → LexicalExtension.prod-DFKbiNt-.mjs} +375 -265
  17. package/dist/{LexicalHeadless.dev-DdWLM7Nl.mjs → LexicalHeadless.dev-B-cj7Pr5.mjs} +2 -2
  18. package/dist/{LexicalHeadless.prod-CoiiTDzR.mjs → LexicalHeadless.prod-Byp1vNzT.mjs} +2 -2
  19. package/dist/LexicalHtml.dev-prBAwszN.mjs +2424 -0
  20. package/dist/LexicalHtml.node-BvNF96jZ.mjs +56 -0
  21. package/dist/LexicalHtml.prod-Sz3CW1ht.mjs +1207 -0
  22. package/dist/{LexicalLink.dev-BS1Bf-yD.mjs → LexicalLink.dev-NySTYhVR.mjs} +42 -8
  23. package/dist/{LexicalLink.prod-B_crkoHP.mjs → LexicalLink.prod-BuCM8gts.mjs} +209 -191
  24. package/dist/{LexicalList.dev-OMqmcnQ-.mjs → LexicalList.dev-DIMOvSFD.mjs} +252 -80
  25. package/dist/{LexicalList.prod-CpL1s8vS.mjs → LexicalList.prod-MVqfA6Vo.mjs} +364 -278
  26. package/dist/{LexicalMarkdown.dev-BHSdx_Gr.mjs → LexicalMarkdown.dev-C7aylvCG.mjs} +729 -552
  27. package/dist/LexicalMarkdown.prod-CfQSM406.mjs +868 -0
  28. package/dist/{LexicalRichText.dev-Bz9A_WbM.mjs → LexicalRichText.dev-DfICq6lU.mjs} +272 -77
  29. package/dist/{LexicalRichText.node-DDpwfE-P.mjs → LexicalRichText.node-Bg9jND3Q.mjs} +21 -8
  30. package/dist/LexicalRichText.prod-GsFzCK-o.mjs +550 -0
  31. package/dist/{LexicalSelection.dev-CQ380fnD.mjs → LexicalSelection.dev-DGjj12wW.mjs} +50 -38
  32. package/dist/{LexicalSelection.node-DesBMjIE.mjs → LexicalSelection.node-BU5L4193.mjs} +4 -4
  33. package/dist/{LexicalSelection.prod-D2jivCDB.mjs → LexicalSelection.prod-D-PwRbyK.mjs} +158 -140
  34. package/dist/{LexicalTable.dev-Ca7mQ7Jk.mjs → LexicalTable.dev-ChP7cugd.mjs} +215 -53
  35. package/dist/{LexicalTable.prod-DyPAcC7y.mjs → LexicalTable.prod-Bpr9YRXp.mjs} +668 -573
  36. package/dist/{LexicalUtils.dev-HxM8F0g6.mjs → LexicalUtils.dev-BiFU3789.mjs} +10 -47
  37. package/dist/{LexicalUtils.node-lCWjRjoG.mjs → LexicalUtils.node-j3Llm7Y3.mjs} +2 -2
  38. package/dist/{LexicalUtils.prod-Bti5w4ki.mjs → LexicalUtils.prod-DCvrA78p.mjs} +103 -105
  39. package/dist/bin/mxs.d.mts +1 -1
  40. package/dist/bin/mxs.mjs +1 -1
  41. package/dist/esm-By7trG9K.mjs +2 -0
  42. package/dist/{esm-CK9m5JKX.mjs → esm-Dg-WhPCe.mjs} +989 -989
  43. package/dist/index.d.mts +11 -2
  44. package/dist/index.mjs +1 -1
  45. package/dist/{mxs-BZt1cLW9.mjs → mxs-BR5Y5ash.mjs} +25141 -24672
  46. package/package.json +15 -14
  47. package/skills/commands-auth.md +1 -1
  48. package/skills/commands-category.md +1 -1
  49. package/skills/commands-comment.md +1 -1
  50. package/skills/commands-config.md +1 -1
  51. package/skills/commands-preview.md +1 -1
  52. package/skills/commands-profile.md +1 -1
  53. package/skills/commands-project.md +57 -0
  54. package/skills/commands-topic.md +1 -1
  55. package/skills/output-modes.md +1 -1
  56. package/skills/overview.md +2 -1
  57. package/skills/safety.md +10 -0
  58. package/dist/LexicalClipboard.dev-BpqRwTLP.mjs +0 -494
  59. package/dist/LexicalClipboard.prod-B_xdeiAC.mjs +0 -291
  60. package/dist/LexicalCodeCore.dev-7_cexm39.mjs +0 -537
  61. package/dist/LexicalCodeCore.prod-Bd6WFHcO.mjs +0 -381
  62. package/dist/LexicalHtml.dev-C3ZSWBFZ.mjs +0 -684
  63. package/dist/LexicalHtml.node-D0TD152E.mjs +0 -24
  64. package/dist/LexicalHtml.prod-CX47X0zl.mjs +0 -430
  65. package/dist/LexicalMarkdown.prod-C-S7Ii6-.mjs +0 -754
  66. package/dist/LexicalRichText.prod-C8qXACDL.mjs +0 -427
  67. package/dist/esm-DRbkkY3r.mjs +0 -2
  68. /package/dist/{mxs-CM8-6uAr.d.mts → mxs-iqJBopvE.d.mts} +0 -0
@@ -1,9 +1,11 @@
1
- import { Bt as DROP_COMMAND, Ft as DELETE_CHARACTER_COMMAND, Gt as FORMAT_TEXT_COMMAND, Hn as isDOMNode, Ht as ElementNode, It as DELETE_LINE_COMMAND, Lt as DELETE_WORD_COMMAND, Mn as defineExtension, Mt as COPY_COMMAND, N as $getNearestNodeFromDOMNode, Nt as CUT_COMMAND, On as createCommand, Ot as COMMAND_PRIORITY_EDITOR, Qt as INSERT_TAB_COMMAND, R as $getRoot, Rt as DRAGOVER_COMMAND, Tt as CLICK_COMMAND, W as $insertNodes, Wt as FORMAT_ELEMENT_COMMAND, Xt as INSERT_LINE_BREAK_COMMAND, Y as $isElementNode, Yt as INDENT_CONTENT_COMMAND, Zt as INSERT_PARAGRAPH_COMMAND, an as KEY_DELETE_COMMAND, cn as KEY_SPACE_COMMAND, ct as $isTextNode, dn as OUTDENT_CONTENT_COMMAND, en as KEY_ARROW_DOWN_COMMAND, f as $createParagraphNode, fn as PASTE_COMMAND, ft as $normalizeSelection__EXPERIMENTAL, g as $createTabNode, gt as $selectAll, hn as REMOVE_TEXT_COMMAND, in as KEY_BACKSPACE_COMMAND, it as $isRootNode, jt as CONTROLLED_TEXT_INSERTION_COMMAND, ln as KEY_TAB_COMMAND, m as $createRangeSelection, n as $applyNodeReplacement, nn as KEY_ARROW_RIGHT_COMMAND, nr as setNodeIndentFromDOM, on as KEY_ENTER_COMMAND, pn as PASTE_TAG, q as $isDecoratorNode, qn as isSelectionCapturedInDecoratorInput, rn as KEY_ARROW_UP_COMMAND, rt as $isRangeSelection, sn as KEY_ESCAPE_COMMAND, tn as KEY_ARROW_LEFT_COMMAND, tt as $isNodeSelection, vt as $setSelection, x as $getAdjacentNode, yn as SELECT_ALL_COMMAND, z as $getSelection, zt as DRAGSTART_COMMAND } from "./Lexical.node-BUsI9gWr.mjs";
2
- import { i as $shouldOverrideDefaultCharacterSelection, n as $isParentRTL, r as $moveCharacter } from "./LexicalSelection.node-DesBMjIE.mjs";
3
- import { d as addClassNamesToElement, g as objectKlassEquals, h as mergeRegister, i as $getNearestBlockElementAncestorOrThrow, m as isHTMLElement, o as $handleIndentAndOutdent, r as $findMatchingParent } from "./LexicalUtils.node-lCWjRjoG.mjs";
4
- import { a as copyToClipboard, i as $writeDragSourceToDataTransfer, n as $handleRichTextDrop, o as setLexicalClipboardDataTransfer, r as $insertDataTransferForRichText, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-CO-MCKx5.mjs";
5
- import { t as DragonExtension } from "./LexicalDragon.node-OG6G55nl.mjs";
6
- //#region ../../node_modules/.pnpm/@lexical+rich-text@0.44.0/node_modules/@lexical/rich-text/LexicalRichText.dev.mjs
1
+ import { f as namedSignals, l as effect, o as NormalizeInlineElementsExtension, p as signal, s as NormalizeTripleClickSelectionExtension } from "./LexicalExtension.node-BVlcrgOx.mjs";
2
+ import { $ as $isElementNode, $t as ElementNode, An as KEY_ARROW_UP_COMMAND, Bn as OUTDENT_CONTENT_COMMAND, C as $getAdjacentNode, Dn as KEY_ARROW_DOWN_COMMAND, Fn as KEY_SPACE_COMMAND, Fr as shallowMergeConfig, H as $getRoot, Hn as PASTE_TAG, Ht as CONTROLLED_TEXT_INSERTION_COMMAND, In as KEY_TAB_COMMAND, J as $insertNodes, Jn as SELECT_ALL_COMMAND, Jt as DELETE_WORD_COMMAND, Kt as DELETE_CHARACTER_COMMAND, L as $getNearestNodeFromDOMNode, Mn as KEY_DELETE_COMMAND, Nn as KEY_ENTER_COMMAND, On as KEY_ARROW_LEFT_COMMAND, Pn as KEY_ESCAPE_COMMAND, Pr as setNodeIndentFromDOM, Pt as CLICK_COMMAND, Rn as MOVE_TO_END, Rt as COMMAND_PRIORITY_EDITOR, Sn as IS_SAFARI, Sr as isHTMLElement, St as $setFormatFromDOM, Tr as isSelectionCapturedInDecoratorInput, U as $getSelection, Ut as COPY_COMMAND, Vn as PASTE_COMMAND, Wn as REMOVE_TEXT_COMMAND, Wt as CUT_COMMAND, Xt as DRAGSTART_COMMAND, Yt as DRAGOVER_COMMAND, Z as $isDecoratorNode, Zt as DROP_COMMAND, at as $isNodeSelection, bn as IS_IOS, bt as $selectAll, cn as INSERT_PARAGRAPH_COMMAND, cr as defineExtension, ct as $isRootNode, f as $createParagraphNode, ft as $isTextNode, g as $createTabNode, gt as $normalizeSelection__EXPERIMENTAL, ir as createCommand, jn as KEY_BACKSPACE_COMMAND, jr as safeCast, jt as CAN_USE_BEFORE_INPUT, kn as KEY_ARROW_RIGHT_COMMAND, ln as INSERT_TAB_COMMAND, m as $createRangeSelection, mn as IS_APPLE_WEBKIT, n as $applyNodeReplacement, nn as FORMAT_TEXT_COMMAND, on as INDENT_CONTENT_COMMAND, qt as DELETE_LINE_COMMAND, rr as configExtension, sn as INSERT_LINE_BREAK_COMMAND, st as $isRangeSelection, tn as FORMAT_ELEMENT_COMMAND, vr as isDOMNode, wt as $setSelection, xt as $setDirectionFromDOM, zn as MOVE_TO_START } from "./Lexical.node-fXM8Jp7p.mjs";
3
+ import { a as CoreImportExtension, g as sel, o as DOMImportExtension, p as defineImportRule } from "./LexicalHtml.node-BvNF96jZ.mjs";
4
+ import { n as $moveCharacter, r as $shouldOverrideDefaultCharacterSelection, t as $isParentRTL } from "./LexicalSelection.node-BU5L4193.mjs";
5
+ import { d as addClassNamesToElement, g as objectKlassEquals, h as mergeRegister, i as $getNearestBlockElementAncestorOrThrow, m as isHTMLElement$1, o as $handleIndentAndOutdent, r as $findMatchingParent } from "./LexicalUtils.node-j3Llm7Y3.mjs";
6
+ import { a as caretFromPoint, i as $writeDragSourceToDataTransfer, n as $handleRichTextDrop, o as copyToClipboard, r as $insertDataTransferForRichText, s as setLexicalClipboardDataTransfer, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-C3mRbrmW.mjs";
7
+ import { t as DragonExtension } from "./LexicalDragon.node-BVhw4C7s.mjs";
8
+ //#region ../../node_modules/.pnpm/@lexical+rich-text@0.45.0/node_modules/@lexical/rich-text/dist/LexicalRichText.dev.mjs
7
9
  /**
8
10
  * Copyright (c) Meta Platforms, Inc. and affiliates.
9
11
  *
@@ -18,23 +20,76 @@ import { t as DragonExtension } from "./LexicalDragon.node-OG6G55nl.mjs";
18
20
  * LICENSE file in the root directory of this source tree.
19
21
  *
20
22
  */
21
- function caretFromPoint(x, y) {
22
- if (typeof document.caretRangeFromPoint !== "undefined") {
23
- const range = document.caretRangeFromPoint(x, y);
24
- if (range === null) return null;
25
- return {
26
- node: range.startContainer,
27
- offset: range.startOffset
28
- };
29
- } else if (document.caretPositionFromPoint !== "undefined") {
30
- const range = document.caretPositionFromPoint(x, y);
31
- if (range === null) return null;
32
- return {
33
- node: range.offsetNode,
34
- offset: range.offset
35
- };
36
- } else return null;
23
+ /**
24
+ * Configuration for {@link RichTextExtension}.
25
+ *
26
+ * @property escapeFormatTriggers - Per-format trigger configuration that
27
+ * controls which text formats are automatically cleared from the selection
28
+ * on specific user interactions.
29
+ *
30
+ * Defaults to:
31
+ * ```ts
32
+ * {
33
+ * capitalize: {enter: true, space: true, tab: true},
34
+ * lowercase: {enter: true, space: true, tab: true},
35
+ * uppercase: {enter: true, space: true, tab: true},
36
+ * }
37
+ * ```
38
+ *
39
+ * To opt in to escaping `code` formatting at text node boundaries:
40
+ * ```ts
41
+ * configExtension(RichTextExtension, {
42
+ * escapeFormatTriggers: {
43
+ * code: {onlyAtBoundary: true, enter: true, click: true, arrow: true},
44
+ * },
45
+ * })
46
+ * ```
47
+ */
48
+ const DEFAULT_RICH_TEXT_CONFIG = { escapeFormatTriggers: {
49
+ capitalize: {
50
+ enter: true,
51
+ space: true,
52
+ tab: true
53
+ },
54
+ lowercase: {
55
+ enter: true,
56
+ space: true,
57
+ tab: true
58
+ },
59
+ uppercase: {
60
+ enter: true,
61
+ space: true,
62
+ tab: true
63
+ }
64
+ } };
65
+ function mergeTriggerConfig(config, override) {
66
+ if (!config || override === null) return override;
67
+ return shallowMergeConfig(config, override);
68
+ }
69
+ function mergeEscapeFormatTriggers(config, overrides) {
70
+ const merged = shallowMergeConfig(config, overrides);
71
+ for (const k of Object.keys(overrides)) merged[k] = mergeTriggerConfig(config[k], overrides[k]);
72
+ return merged;
73
+ }
74
+ function mergeRichTextConfig(config, overrides) {
75
+ const merged = shallowMergeConfig(config, overrides);
76
+ if (overrides.escapeFormatTriggers) merged.escapeFormatTriggers = mergeEscapeFormatTriggers(config.escapeFormatTriggers, overrides.escapeFormatTriggers);
77
+ return merged;
37
78
  }
79
+ const RichTextExtension = defineExtension({
80
+ build: (_editor, config) => namedSignals(config),
81
+ config: safeCast(DEFAULT_RICH_TEXT_CONFIG),
82
+ conflictsWith: ["@lexical/plain-text"],
83
+ dependencies: [
84
+ DragonExtension,
85
+ NormalizeInlineElementsExtension,
86
+ NormalizeTripleClickSelectionExtension
87
+ ],
88
+ mergeConfig: mergeRichTextConfig,
89
+ name: "@lexical/rich-text",
90
+ nodes: () => [HeadingNode, QuoteNode],
91
+ register: (editor, _config, state) => effect(() => registerRichText(editor, state.getOutput().escapeFormatTriggers))
92
+ });
38
93
  /**
39
94
  * Copyright (c) Meta Platforms, Inc. and affiliates.
40
95
  *
@@ -42,22 +97,78 @@ function caretFromPoint(x, y) {
42
97
  * LICENSE file in the root directory of this source tree.
43
98
  *
44
99
  */
45
- const CAN_USE_DOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
46
100
  /**
47
- * Copyright (c) Meta Platforms, Inc. and affiliates.
101
+ * Heuristic copied (in spirit) from the legacy `isGoogleDocsTitle`:
102
+ * Google Docs serializes the document title as a `<span style="font-size:
103
+ * 26pt">` (sometimes wrapped in a `<p>`). The presence of a 26pt span at
104
+ * the start of a `<p>` is treated as a heading-1 marker.
105
+ */
106
+ function isGoogleDocsTitleSpan(node) {
107
+ return isHTMLElement(node) && node.nodeName === "SPAN" && node.style.fontSize === "26pt";
108
+ }
109
+ /**
110
+ * Import rules for {@link HeadingNode} and {@link QuoteNode}, including
111
+ * the Google Docs title heuristic that the legacy `HeadingNode.importDOM`
112
+ * declared. The Google-Docs rules are registered last (highest priority)
113
+ * so they precede the generic `<p>` and `<span>` rules from
114
+ * {@link CoreImportRules}.
48
115
  *
49
- * This source code is licensed under the MIT license found in the
50
- * LICENSE file in the root directory of this source tree.
116
+ * @experimental
117
+ */
118
+ const RichTextImportRules = [
119
+ defineImportRule({
120
+ $import: (ctx, el) => {
121
+ const node = $createHeadingNode(el.nodeName.toLowerCase());
122
+ setNodeIndentFromDOM(el, node);
123
+ $setFormatFromDOM(node, el);
124
+ $setDirectionFromDOM(node, el);
125
+ return [node.splice(0, 0, ctx.$importChildren(el))];
126
+ },
127
+ match: sel.tag("h1", "h2", "h3", "h4", "h5", "h6"),
128
+ name: "@lexical/rich-text/heading"
129
+ }),
130
+ defineImportRule({
131
+ $import: (ctx, el) => {
132
+ const node = $createQuoteNode();
133
+ $setFormatFromDOM(node, el);
134
+ setNodeIndentFromDOM(el, node);
135
+ $setDirectionFromDOM(node, el);
136
+ return [node.splice(0, 0, ctx.$importChildren(el))];
137
+ },
138
+ match: sel.tag("blockquote"),
139
+ name: "@lexical/rich-text/blockquote"
140
+ }),
141
+ defineImportRule({
142
+ $import: (ctx, el, $next) => {
143
+ const first = el.firstChild;
144
+ if (first && isGoogleDocsTitleSpan(first)) return ctx.$importChildren(el);
145
+ return $next();
146
+ },
147
+ match: sel.tag("p"),
148
+ name: "@lexical/rich-text/google-docs-title-p"
149
+ }),
150
+ defineImportRule({
151
+ $import: (ctx, el, $next) => el.style.fontSize !== "26pt" ? $next() : [$createHeadingNode("h1").splice(0, 0, ctx.$importChildren(el))],
152
+ match: sel.tag("span"),
153
+ name: "@lexical/rich-text/google-docs-title-span"
154
+ })
155
+ ];
156
+ /**
157
+ * Bundles {@link RichTextImportRules} (plus {@link CoreImportExtension})
158
+ * into a single dependency. Use this in editors that want the legacy
159
+ * `@lexical/rich-text` DOM import behavior under the new
160
+ * {@link DOMImportExtension} pipeline.
51
161
  *
162
+ * @experimental
52
163
  */
53
- const documentMode = CAN_USE_DOM && "documentMode" in document ? document.documentMode : null;
54
- const IS_APPLE = CAN_USE_DOM && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
55
- const CAN_USE_BEFORE_INPUT = CAN_USE_DOM && "InputEvent" in window && !documentMode ? "getTargetRanges" in new window.InputEvent("input") : false;
56
- const IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
57
- const IS_ANDROID = CAN_USE_DOM && /Android/.test(navigator.userAgent);
58
- const IS_SAFARI = CAN_USE_DOM && /Version\/[\d.]+.*Safari/.test(navigator.userAgent) && !IS_ANDROID;
59
- const IS_CHROME = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent);
60
- const IS_APPLE_WEBKIT = CAN_USE_DOM && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && IS_APPLE && !IS_CHROME;
164
+ const RichTextImportExtension = defineExtension({
165
+ dependencies: [
166
+ CoreImportExtension,
167
+ RichTextExtension,
168
+ configExtension(DOMImportExtension, { rules: RichTextImportRules })
169
+ ],
170
+ name: "@lexical/rich-text/Import"
171
+ });
61
172
  /**
62
173
  * Copyright (c) Meta Platforms, Inc. and affiliates.
63
174
  *
@@ -90,7 +201,7 @@ var QuoteNode = class QuoteNode extends ElementNode {
90
201
  }
91
202
  exportDOM(editor) {
92
203
  const { element } = super.exportDOM(editor);
93
- if (isHTMLElement(element)) {
204
+ if (isHTMLElement$1(element)) {
94
205
  if (this.isEmpty()) element.append(document.createElement("br"));
95
206
  const formatType = this.getFormatType();
96
207
  if (formatType) element.style.textAlign = formatType;
@@ -211,7 +322,7 @@ var HeadingNode = class HeadingNode extends ElementNode {
211
322
  }
212
323
  exportDOM(editor) {
213
324
  const { element } = super.exportDOM(editor);
214
- if (isHTMLElement(element)) {
325
+ if (isHTMLElement$1(element)) {
215
326
  if (this.isEmpty()) element.append(document.createElement("br"));
216
327
  const formatType = this.getFormatType();
217
328
  if (formatType) element.style.textAlign = formatType;
@@ -247,9 +358,11 @@ var HeadingNode = class HeadingNode extends ElementNode {
247
358
  return newElement;
248
359
  }
249
360
  collapseAtStart() {
250
- const newElement = !this.isEmpty() ? $createHeadingNode(this.getTag()) : $createParagraphNode();
251
- this.getChildren().forEach((child) => newElement.append(child));
252
- this.replace(newElement);
361
+ if (this.isEmpty()) {
362
+ const paragraph = $createParagraphNode();
363
+ this.getChildren().forEach((child) => paragraph.append(child));
364
+ this.replace(paragraph);
365
+ }
253
366
  return true;
254
367
  }
255
368
  extractWithChild() {
@@ -265,19 +378,17 @@ function $convertHeadingElement(element) {
265
378
  let node = null;
266
379
  if (nodeName === "h1" || nodeName === "h2" || nodeName === "h3" || nodeName === "h4" || nodeName === "h5" || nodeName === "h6") {
267
380
  node = $createHeadingNode(nodeName);
268
- if (element.style !== null) {
269
- setNodeIndentFromDOM(element, node);
270
- node.setFormat(element.style.textAlign);
271
- }
381
+ setNodeIndentFromDOM(element, node);
382
+ $setFormatFromDOM(node, element);
383
+ $setDirectionFromDOM(node, element);
272
384
  }
273
385
  return { node };
274
386
  }
275
387
  function $convertBlockquoteElement(element) {
276
388
  const node = $createQuoteNode();
277
- if (element.style !== null) {
278
- node.setFormat(element.style.textAlign);
279
- setNodeIndentFromDOM(element, node);
280
- }
389
+ $setFormatFromDOM(node, element);
390
+ setNodeIndentFromDOM(element, node);
391
+ $setDirectionFromDOM(node, element);
281
392
  return { node };
282
393
  }
283
394
  function $createHeadingNode(headingTag = "h1") {
@@ -337,24 +448,78 @@ function $isSelectionCollapsedAtFrontOfIndentedBlock(selection) {
337
448
  return element.getIndent() > 0 && (element.is(anchorNode) || anchorNode.is(element.getFirstDescendant()));
338
449
  }
339
450
  /**
340
- * Resets the capitalization of the selection to default.
341
- * Called when the user presses space, tab, or enter key.
342
- * @param selection The selection to reset the capitalization of.
451
+ * Trigger types that cause format escape at text node boundaries.
452
+ * - `enter`: Escape on Enter key press
453
+ * - `click`: Escape on mouse click
454
+ * - `arrow`: Escape on arrow key navigation (left/right)
455
+ * - `space`: Escape on Space key press
456
+ * - `tab`: Escape on Tab key press
343
457
  */
344
- function $resetCapitalization(selection) {
345
- for (const format of [
346
- "lowercase",
347
- "uppercase",
348
- "capitalize"
349
- ]) if (selection.hasFormat(format)) selection.toggleFormat(format);
458
+ /**
459
+ * Trigger flags for a single format type. Set a trigger key to `true` to
460
+ * escape that format when the corresponding user interaction occurs.
461
+ *
462
+ * When `onlyAtBoundary` is `true`, the format is only escaped when the cursor
463
+ * is at the start or end of a formatted text node with no adjacent sibling in
464
+ * that direction. When `onlyAtBoundary` is `false` or omitted the format is
465
+ * always escaped regardless of cursor position (matching the legacy
466
+ * `$resetCapitalization` behavior).
467
+ */
468
+ /**
469
+ * Per-format trigger configuration. Each {@link TextFormatType} maps to its
470
+ * own set of triggers, or `null` to explicitly disable escape for that format
471
+ * (useful when overriding defaults via `configExtension`).
472
+ */
473
+ function $escapeFormatsForTrigger(selection, trigger, direction, config) {
474
+ let isBoundary = false;
475
+ let anchorNode = null;
476
+ if (selection.isCollapsed() && selection.anchor.type === "text") {
477
+ const node = selection.anchor.getNode();
478
+ if ($isTextNode(node)) {
479
+ anchorNode = node;
480
+ const offset = selection.anchor.offset;
481
+ const atEnd = offset === node.getTextContentSize() && node.getNextSibling() === null;
482
+ const atStart = offset === 0 && node.getPreviousSibling() === null;
483
+ isBoundary = direction === "end" && atEnd || direction === "start" && atStart || direction === "both" && (atEnd || atStart);
484
+ }
485
+ }
486
+ let didEscapeBoundary = false;
487
+ for (const [formatKey, triggers] of Object.entries(config)) {
488
+ if (triggers == null || !triggers[trigger]) continue;
489
+ const format = formatKey;
490
+ if (triggers.onlyAtBoundary) {
491
+ if (!isBoundary || !anchorNode || !$isTextNode(anchorNode) || !anchorNode.hasFormat(format)) continue;
492
+ didEscapeBoundary = true;
493
+ }
494
+ if (selection.hasFormat(format)) selection.toggleFormat(format);
495
+ }
496
+ if (didEscapeBoundary) selection.setStyle("");
350
497
  }
351
- function registerRichText(editor) {
352
- return mergeRegister(editor.registerCommand(CLICK_COMMAND, (payload) => {
498
+ const DEFAULT_ESCAPE_FORMAT_TRIGGERS = {
499
+ capitalize: {
500
+ enter: true,
501
+ space: true,
502
+ tab: true
503
+ },
504
+ lowercase: {
505
+ enter: true,
506
+ space: true,
507
+ tab: true
508
+ },
509
+ uppercase: {
510
+ enter: true,
511
+ space: true,
512
+ tab: true
513
+ }
514
+ };
515
+ function registerRichText(editor, escapeFormatTriggers = signal(DEFAULT_ESCAPE_FORMAT_TRIGGERS)) {
516
+ return mergeRegister(editor.registerCommand(CLICK_COMMAND, () => {
353
517
  const selection = $getSelection();
354
518
  if ($isNodeSelection(selection)) {
355
519
  selection.clear();
356
520
  return true;
357
521
  }
522
+ if ($isRangeSelection(selection)) $escapeFormatsForTrigger(selection, "click", "both", escapeFormatTriggers.peek());
358
523
  return false;
359
524
  }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(DELETE_CHARACTER_COMMAND, (isBackward) => {
360
525
  const selection = $getSelection();
@@ -491,6 +656,7 @@ function registerRichText(editor) {
491
656
  }
492
657
  }
493
658
  if (!$isRangeSelection(selection)) return false;
659
+ if (!event.shiftKey) $escapeFormatsForTrigger(selection, "arrow", "start", escapeFormatTriggers.peek());
494
660
  if ($shouldOverrideDefaultCharacterSelection(selection, true)) {
495
661
  const isHoldingShift = event.shiftKey;
496
662
  event.preventDefault();
@@ -510,8 +676,9 @@ function registerRichText(editor) {
510
676
  }
511
677
  }
512
678
  if (!$isRangeSelection(selection)) return false;
513
- const isHoldingShift = event.shiftKey;
679
+ if (!event.shiftKey) $escapeFormatsForTrigger(selection, "arrow", "end", escapeFormatTriggers.peek());
514
680
  if ($shouldOverrideDefaultCharacterSelection(selection, false)) {
681
+ const isHoldingShift = event.shiftKey;
515
682
  event.preventDefault();
516
683
  $moveCharacter(selection, isHoldingShift, false);
517
684
  return true;
@@ -536,9 +703,13 @@ function registerRichText(editor) {
536
703
  event.preventDefault();
537
704
  return editor.dispatchCommand(DELETE_CHARACTER_COMMAND, false);
538
705
  }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_ENTER_COMMAND, (event) => {
539
- const selection = $getSelection();
706
+ let selection = $getSelection();
707
+ if ($isNodeSelection(selection)) {
708
+ const nodes = selection.getNodes();
709
+ if (nodes.length === 1 && $isDecoratorNode(nodes[0]) && !nodes[0].isInline()) selection = nodes[0].selectNext();
710
+ }
540
711
  if (!$isRangeSelection(selection)) return false;
541
- $resetCapitalization(selection);
712
+ $escapeFormatsForTrigger(selection, "enter", "both", escapeFormatTriggers.peek());
542
713
  if (event !== null) {
543
714
  if ((IS_IOS || IS_SAFARI || IS_APPLE_WEBKIT) && CAN_USE_BEFORE_INPUT) return false;
544
715
  event.preventDefault();
@@ -618,26 +789,50 @@ function registerRichText(editor) {
618
789
  return true;
619
790
  }
620
791
  return false;
621
- }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_SPACE_COMMAND, (_) => {
792
+ }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_SPACE_COMMAND, () => {
622
793
  const selection = $getSelection();
623
- if ($isRangeSelection(selection)) $resetCapitalization(selection);
794
+ if ($isRangeSelection(selection)) $escapeFormatsForTrigger(selection, "space", "both", escapeFormatTriggers.peek());
624
795
  return false;
625
- }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_TAB_COMMAND, (_) => {
796
+ }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_TAB_COMMAND, () => {
626
797
  const selection = $getSelection();
627
- if ($isRangeSelection(selection)) $resetCapitalization(selection);
798
+ if ($isRangeSelection(selection)) $escapeFormatsForTrigger(selection, "tab", "both", escapeFormatTriggers.peek());
628
799
  return false;
800
+ }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(MOVE_TO_END, (event) => {
801
+ const selection = $getSelection();
802
+ if (!$isRangeSelection(selection)) return false;
803
+ const { anchor } = selection;
804
+ if (anchor.type !== "element" || anchor.offset !== 0) return false;
805
+ const element = anchor.getNode();
806
+ if (!$isElementNode(element)) return false;
807
+ const firstChild = element.getFirstChild();
808
+ if (!$isDecoratorNode(firstChild) || !firstChild.isInline()) return false;
809
+ const lastDescendant = element.getLastDescendant();
810
+ if (lastDescendant == null || $isDecoratorNode(lastDescendant)) return false;
811
+ const elementKey = element.getKey();
812
+ const ending = element.selectEnd();
813
+ if (event.shiftKey) ending.anchor.set(elementKey, 0, "element");
814
+ event.preventDefault();
815
+ event.stopPropagation();
816
+ return true;
817
+ }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(MOVE_TO_START, (event) => {
818
+ const selection = $getSelection();
819
+ if (!$isRangeSelection(selection)) return false;
820
+ const { anchor, focus } = selection;
821
+ const focusBlock = $findMatchingParent(focus.getNode(), (node) => $isElementNode(node) && !node.isInline());
822
+ if (focusBlock === null) return false;
823
+ const firstChild = focusBlock.getFirstChild();
824
+ if (!$isDecoratorNode(firstChild) || !firstChild.isInline()) return false;
825
+ const lastDescendant = focusBlock.getLastDescendant();
826
+ if (lastDescendant == null || $isDecoratorNode(lastDescendant)) return false;
827
+ if ($findMatchingParent(anchor.getNode(), (node) => $isElementNode(node) && !node.isInline()) !== focusBlock) return false;
828
+ const blockKey = focusBlock.getKey();
829
+ if (focus.type === "element" && focus.key === blockKey && focus.offset === 0) return false;
830
+ selection.focus.set(blockKey, 0, "element");
831
+ if (!event.shiftKey) selection.anchor.set(blockKey, 0, "element");
832
+ event.preventDefault();
833
+ event.stopPropagation();
834
+ return true;
629
835
  }, COMMAND_PRIORITY_EDITOR));
630
836
  }
631
- /**
632
- * An extension to register \@lexical/rich-text behavior and nodes
633
- * ({@link HeadingNode}, {@link QuoteNode})
634
- */
635
- const RichTextExtension = defineExtension({
636
- conflictsWith: ["@lexical/plain-text"],
637
- dependencies: [DragonExtension],
638
- name: "@lexical/rich-text",
639
- nodes: () => [HeadingNode, QuoteNode],
640
- register: registerRichText
641
- });
642
837
  //#endregion
643
- export { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, DRAG_DROP_PASTE, HeadingNode, QuoteNode, RichTextExtension, eventFiles, registerRichText };
838
+ export { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, DRAG_DROP_PASTE, HeadingNode, QuoteNode, RichTextExtension, RichTextImportExtension, RichTextImportRules, eventFiles, registerRichText };
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@lexical+code-core@0.44.0/node_modules/@lexical/code-core/LexicalCodeCore.node.mjs
1
+ //#region ../../node_modules/.pnpm/@lexical+code-core@0.45.0/node_modules/@lexical/code-core/dist/LexicalCodeCore.node.mjs
2
2
  /**
3
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  */
9
- const mod$3 = await (process.env.NODE_ENV !== "production" ? import("./LexicalCodeCore.dev-7_cexm39.mjs") : import("./LexicalCodeCore.prod-Bd6WFHcO.mjs"));
9
+ const mod$3 = await (process.env.NODE_ENV !== "production" ? import("./LexicalCodeCore.dev-DjSrd4A4.mjs") : import("./LexicalCodeCore.prod-DTDShkR3.mjs"));
10
10
  mod$3.$createCodeHighlightNode;
11
11
  const $createCodeNode = mod$3.$createCodeNode;
12
12
  mod$3.$getCodeLineDirection;
@@ -16,13 +16,19 @@ mod$3.$getLastCodeNodeOfLine;
16
16
  mod$3.$getStartOfCodeInLine;
17
17
  mod$3.$isCodeHighlightNode;
18
18
  const $isCodeNode = mod$3.$isCodeNode;
19
+ mod$3.$outdentLeadingSpaces;
20
+ mod$3.$plainifyCodeContent;
19
21
  mod$3.CodeExtension;
20
22
  const CodeHighlightNode = mod$3.CodeHighlightNode;
23
+ mod$3.CodeImportExtension;
24
+ mod$3.CodeImportRules;
25
+ mod$3.CodeIndentExtension;
21
26
  const CodeNode = mod$3.CodeNode;
22
27
  mod$3.DEFAULT_CODE_LANGUAGE;
23
28
  mod$3.getDefaultCodeLanguage;
29
+ mod$3.registerCodeIndentation;
24
30
  //#endregion
25
- //#region ../../node_modules/.pnpm/@lexical+link@0.44.0/node_modules/@lexical/link/LexicalLink.node.mjs
31
+ //#region ../../node_modules/.pnpm/@lexical+link@0.45.0/node_modules/@lexical/link/dist/LexicalLink.node.mjs
26
32
  /**
27
33
  * Copyright (c) Meta Platforms, Inc. and affiliates.
28
34
  *
@@ -30,7 +36,7 @@ mod$3.getDefaultCodeLanguage;
30
36
  * LICENSE file in the root directory of this source tree.
31
37
  *
32
38
  */
33
- const mod$2 = await (process.env.NODE_ENV !== "production" ? import("./LexicalLink.dev-BS1Bf-yD.mjs") : import("./LexicalLink.prod-B_crkoHP.mjs"));
39
+ const mod$2 = await (process.env.NODE_ENV !== "production" ? import("./LexicalLink.dev-NySTYhVR.mjs") : import("./LexicalLink.prod-BuCM8gts.mjs"));
34
40
  mod$2.$createAutoLinkNode;
35
41
  const $createLinkNode = mod$2.$createLinkNode;
36
42
  const $isAutoLinkNode = mod$2.$isAutoLinkNode;
@@ -40,6 +46,8 @@ mod$2.AutoLinkExtension;
40
46
  const AutoLinkNode = mod$2.AutoLinkNode;
41
47
  mod$2.ClickableLinkExtension;
42
48
  mod$2.LinkExtension;
49
+ mod$2.LinkImportExtension;
50
+ mod$2.LinkImportRules;
43
51
  const LinkNode = mod$2.LinkNode;
44
52
  mod$2.TOGGLE_LINK_COMMAND;
45
53
  mod$2.createLinkMatcherWithRegExp;
@@ -49,7 +57,7 @@ mod$2.registerClickableLink;
49
57
  mod$2.registerLink;
50
58
  mod$2.toggleLink;
51
59
  //#endregion
52
- //#region ../../node_modules/.pnpm/@lexical+list@0.44.0/node_modules/@lexical/list/LexicalList.node.mjs
60
+ //#region ../../node_modules/.pnpm/@lexical+list@0.45.0/node_modules/@lexical/list/dist/LexicalList.node.mjs
53
61
  /**
54
62
  * Copyright (c) Meta Platforms, Inc. and affiliates.
55
63
  *
@@ -57,7 +65,7 @@ mod$2.toggleLink;
57
65
  * LICENSE file in the root directory of this source tree.
58
66
  *
59
67
  */
60
- const mod$1 = await (process.env.NODE_ENV !== "production" ? import("./LexicalList.dev-OMqmcnQ-.mjs") : import("./LexicalList.prod-CpL1s8vS.mjs"));
68
+ const mod$1 = await (process.env.NODE_ENV !== "production" ? import("./LexicalList.dev-DIMOvSFD.mjs") : import("./LexicalList.prod-MVqfA6Vo.mjs"));
61
69
  const $createListItemNode = mod$1.$createListItemNode;
62
70
  const $createListNode = mod$1.$createListNode;
63
71
  mod$1.$getListDepth;
@@ -71,8 +79,11 @@ mod$1.INSERT_CHECK_LIST_COMMAND;
71
79
  mod$1.INSERT_ORDERED_LIST_COMMAND;
72
80
  mod$1.INSERT_UNORDERED_LIST_COMMAND;
73
81
  mod$1.ListExtension;
82
+ mod$1.ListImportExtension;
83
+ mod$1.ListImportRules;
74
84
  const ListItemNode = mod$1.ListItemNode;
75
85
  const ListNode = mod$1.ListNode;
86
+ mod$1.ListSchema;
76
87
  mod$1.REMOVE_LIST_COMMAND;
77
88
  mod$1.UPDATE_LIST_START_COMMAND;
78
89
  mod$1.insertList;
@@ -81,7 +92,7 @@ mod$1.registerList;
81
92
  mod$1.registerListStrictIndentTransform;
82
93
  mod$1.removeList;
83
94
  //#endregion
84
- //#region ../../node_modules/.pnpm/@lexical+rich-text@0.44.0/node_modules/@lexical/rich-text/LexicalRichText.node.mjs
95
+ //#region ../../node_modules/.pnpm/@lexical+rich-text@0.45.0/node_modules/@lexical/rich-text/dist/LexicalRichText.node.mjs
85
96
  /**
86
97
  * Copyright (c) Meta Platforms, Inc. and affiliates.
87
98
  *
@@ -89,7 +100,7 @@ mod$1.removeList;
89
100
  * LICENSE file in the root directory of this source tree.
90
101
  *
91
102
  */
92
- const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalRichText.dev-Bz9A_WbM.mjs") : import("./LexicalRichText.prod-C8qXACDL.mjs"));
103
+ const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalRichText.dev-DfICq6lU.mjs") : import("./LexicalRichText.prod-GsFzCK-o.mjs"));
93
104
  const $createHeadingNode = mod.$createHeadingNode;
94
105
  const $createQuoteNode = mod.$createQuoteNode;
95
106
  const $isHeadingNode = mod.$isHeadingNode;
@@ -98,6 +109,8 @@ mod.DRAG_DROP_PASTE;
98
109
  const HeadingNode = mod.HeadingNode;
99
110
  const QuoteNode = mod.QuoteNode;
100
111
  mod.RichTextExtension;
112
+ mod.RichTextImportExtension;
113
+ mod.RichTextImportRules;
101
114
  mod.eventFiles;
102
115
  mod.registerRichText;
103
116
  //#endregion