@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,6 +1,6 @@
1
- import { $ as $isElementNode, $n as TabNode, $t as ElementNode, Ar as removeClassNamesFromElement, B as $getNodeFromDOMNode, Bn as OUTDENT_CONTENT_COMMAND, Bt as COMMAND_PRIORITY_LOW, D as $getCaretRangeInDirection, E as $getCaretRange, Et as $setState, F as $getEditor, Fr as shallowMergeConfig, G as $getState, Gn as RootNode, H as $getRoot, In as KEY_TAB_COMMAND, Ir as stopLexicalPropagation, It as COMMAND_PRIORITY_BEFORE_CRITICAL, Kn as SELECTION_CHANGE_COMMAND, Ln as LineBreakNode, Lr as toggleTextFormatType, Lt as COMMAND_PRIORITY_CRITICAL, Nt as CLEAR_EDITOR_COMMAND, Or as mergeRegister, Pt as CLICK_COMMAND, Q as $isEditorState, Qn as TEXT_TYPE_TO_FORMAT, Qt as DecoratorNode, R as $getNodeByKey, Rt as COMMAND_PRIORITY_EDITOR, Tt as $setSelectionFromCaretRange, U as $getSelection, Un as ParagraphNode, V as $getPreviousSelection, W as $getSiblingCaret, X as $isChildCaret, Xn as SKIP_SCROLL_INTO_VIEW_TAG, Y as $isBlockElementNode, Z as $isDecoratorNode, Zn as SKIP_SELECTION_FOCUS_TAG, ar as createEditor, at as $isNodeSelection, cr as defineExtension, d as $createNodeSelection, er as TextNode, f as $createParagraphNode, fr as getStaticNodeConfig, gt as $normalizeSelection__EXPERIMENTAL, ht as $normalizeCaret, i as $caretRangeFromSelection, in as HISTORY_MERGE_TAG, ir as createCommand, it as $isLineBreakNode, jr as safeCast, k as $getChildCaret, kt as $updateDOMSelection, l as $create, ln as INSERT_TAB_COMMAND, lr as getDOMSelection, m as $createRangeSelection, nn as FORMAT_TEXT_COMMAND, on as INDENT_CONTENT_COMMAND, or as createState, pt as $isTextPointCaret, rr as configExtension, sr as declarePeerDependency, st as $isRangeSelection, tr as addClassNamesToElement, ut as $isSiblingCaret, vr as isDOMNode, wt as $setSelection, yt as $rewindSiblingCaret } from "./Lexical.node-fXM8Jp7p.mjs";
2
- import { c as $insertNodeToNearestRoot, i as $getNearestBlockElementAncestorOrThrow, o as $handleIndentAndOutdent, v as selectionAlwaysOnDisplay } from "./LexicalUtils.node-j3Llm7Y3.mjs";
3
- //#region ../../node_modules/.pnpm/@lexical+extension@0.45.0/node_modules/@lexical/extension/dist/LexicalExtension.dev.mjs
1
+ import { A as $getChildCaret, Ct as $normalizeCaret, D as $getCaretRange, Dt as $rewindSiblingCaret, Fr as getStaticNodeConfig, G as $getSiblingCaret, Gr as isExactShortcutMatch, Gt as COMMAND_PRIORITY_BEFORE_EDITOR, H as $getPreviousSelection, Ht as CLICK_COMMAND, I as $getEditor, J as $getSlotHost, Jn as KEY_TAB_COMMAND, Kt as COMMAND_PRIORITY_CRITICAL, Lt as $updateDOMSelection, Mt as $setSelection, Nr as getRegisteredSubtypeMap, Nt as $setSelectionFromCaretRange, O as $getCaretRangeInDirection, Ot as $selectAll, Pt as $setState, Qn as OUTDENT_CONTENT_COMMAND, Qt as COMPOSITION_START_TAG, Sr as getActiveElement, Tr as getDOMSelection, U as $getRoot, V as $getNodeFromDOMNode, Vr as isDOMNode, Vt as CLEAR_EDITOR_COMMAND, W as $getSelection, Wt as COMMAND_PRIORITY_BEFORE_CRITICAL, X as $getState, Yn as LineBreakNode, Yt as COMMAND_PRIORITY_LOW, Zt as COMPOSITION_START_COMMAND, _r as createEditor, _t as $isSiblingCaret, a as $caretRangeFromSelection, ai as safeCast, at as $isElementNode, br as defineExtension, bt as $isTextNode, cr as SKIP_SCROLL_INTO_VIEW_TAG, di as toggleTextFormatType, dn as ElementNode, dr as TabNode, dt as $isNodeSelection, f as $createNodeSelection, fr as TextNode, gn as HISTORY_MERGE_TAG, gr as createCommand, h as $createRangeSelection, hr as configExtension, ii as removeClassNamesFromElement, ir as SELECTION_CHANGE_COMMAND, it as $isEditorState, li as shallowMergeConfig, lr as SKIP_SELECTION_FOCUS_TAG, mn as FORMAT_TEXT_COMMAND, mt as $isRootNode, ni as mergeRegister, nt as $isChildCaret, or as SELECT_ALL_COMMAND, p as $createParagraphNode, pr as addClassNamesToElement, pt as $isRangeSelection, q as $getSlotFrame, qr as isHTMLElement, qt as COMMAND_PRIORITY_EDITOR, rr as RootNode, rt as $isDecoratorNode, tr as ParagraphNode, tt as $isBlockElementNode, u as $create, ui as stopLexicalPropagation, un as DecoratorNode, ur as TEXT_TYPE_TO_FORMAT, ut as $isLineBreakNode, vn as INDENT_CONTENT_COMMAND, vr as createState, wt as $normalizeSelection__EXPERIMENTAL, xn as INSERT_TAB_COMMAND, xt as $isTextPointCaret, yr as declarePeerDependency, z as $getNodeByKey } from "./Lexical.node-DnR_u_Ke.mjs";
2
+ import { a as $handleIndentAndOutdent, c as $isBlockFullySelected, f as IS_APPLE, g as selectionAlwaysOnDisplay, r as $getNearestBlockElementAncestorOrThrow, s as $insertNodeToNearestRoot } from "./LexicalUtils.node-Ck74ludK.mjs";
3
+ //#region ../../node_modules/.pnpm/@lexical+extension@0.46.0_typescript@6.0.3/node_modules/@lexical/extension/dist/LexicalExtension.dev.mjs
4
4
  /**
5
5
  * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
@@ -446,11 +446,11 @@ function namedSignals(defaults, opts = {}) {
446
446
  * An Extension to focus the LexicalEditor when the root element is set
447
447
  * (typically only when the editor is first created).
448
448
  */
449
- const AutoFocusExtension = defineExtension({
449
+ const AutoFocusExtension = /* @__PURE__ */ defineExtension({
450
450
  build: (editor, config, state) => {
451
451
  return namedSignals(config);
452
452
  },
453
- config: safeCast({
453
+ config: /* @__PURE__ */ safeCast({
454
454
  defaultSelection: "rootEnd",
455
455
  disabled: false
456
456
  }),
@@ -459,7 +459,7 @@ const AutoFocusExtension = defineExtension({
459
459
  const stores = state.getOutput();
460
460
  return j(() => stores.disabled.value ? void 0 : editor.registerRootListener((rootElement) => {
461
461
  editor.focus(() => {
462
- const activeElement = document.activeElement;
462
+ const activeElement = rootElement !== null ? getActiveElement(rootElement) : null;
463
463
  if (rootElement !== null && (activeElement === null || !rootElement.contains(activeElement))) rootElement.focus({ preventScroll: true });
464
464
  }, { defaultSelection: stores.defaultSelection.peek() });
465
465
  }));
@@ -490,11 +490,11 @@ function registerClearEditor(editor, $onClear = $defaultOnClear) {
490
490
  /**
491
491
  * An extension to provide an implementation of {@link CLEAR_EDITOR_COMMAND}
492
492
  */
493
- const ClearEditorExtension = defineExtension({
493
+ const ClearEditorExtension = /* @__PURE__ */ defineExtension({
494
494
  build(editor, config, state) {
495
495
  return namedSignals(config);
496
496
  },
497
- config: safeCast({ $onClear: $defaultOnClear }),
497
+ config: /* @__PURE__ */ safeCast({ $onClear: $defaultOnClear }),
498
498
  name: "@lexical/extension/ClearEditor",
499
499
  register(editor, config, state) {
500
500
  const { $onClear } = state.getOutput();
@@ -543,14 +543,14 @@ function $defaultShouldInsertAfter(node) {
543
543
  function shouldClaimClick(editor, rootElement, event, $shouldInsertAfter) {
544
544
  if (!editor.isEditable()) return false;
545
545
  if (event.target !== rootElement) return false;
546
- return editor.getEditorState().read(() => {
546
+ return editor.read("latest", () => {
547
547
  const lastChild = $getRoot().getLastChild();
548
548
  if (lastChild === null) return false;
549
549
  const lastChildDOM = editor.getElementByKey(lastChild.getKey());
550
550
  if (lastChildDOM === null) return false;
551
551
  if (event.clientY <= lastChildDOM.getBoundingClientRect().bottom) return false;
552
552
  return $shouldInsertAfter(lastChild);
553
- }, { editor });
553
+ });
554
554
  }
555
555
  /**
556
556
  * Click handling for the empty area below the last block of the document.
@@ -568,9 +568,9 @@ function shouldClaimClick(editor, rootElement, event, $shouldInsertAfter) {
568
568
  *
569
569
  * Closes #8544.
570
570
  */
571
- const ClickAfterLastBlockExtension = defineExtension({
571
+ const ClickAfterLastBlockExtension = /* @__PURE__ */ defineExtension({
572
572
  build: (_editor, config) => namedSignals(config),
573
- config: safeCast({
573
+ config: /* @__PURE__ */ safeCast({
574
574
  $shouldInsertAfter: $defaultShouldInsertAfter,
575
575
  disabled: false
576
576
  }),
@@ -644,7 +644,7 @@ function getNodeConfig(config) {
644
644
  * LICENSE file in the root directory of this source tree.
645
645
  *
646
646
  */
647
- const formatState = createState("format", { parse: (value) => typeof value === "number" ? value : 0 });
647
+ const formatState = /* @__PURE__ */ createState("format", { parse: (value) => typeof value === "number" ? value : 0 });
648
648
  var DecoratorTextNode = class extends DecoratorNode {
649
649
  $config() {
650
650
  return this.config("decorator-text", {
@@ -746,7 +746,7 @@ const DEFAULT_TAG_NAME_TO_FORMAT = {
746
746
  * An extension for DecoratorTextNode that sets the format for the node and CSS classes for the DOM container.
747
747
  * The base class is always set, and the focus class is set when the node is selected.
748
748
  */
749
- const DecoratorTextExtension = defineExtension({
749
+ const DecoratorTextExtension = /* @__PURE__ */ defineExtension({
750
750
  name: "@lexical/extension/DecoratorText",
751
751
  nodes: () => [DecoratorTextNode],
752
752
  register(editor, config, state) {
@@ -799,7 +799,7 @@ function watchedSignal(getSnapshot, register) {
799
799
  /**
800
800
  * An extension to provide the current EditorState as a signal
801
801
  */
802
- const EditorStateExtension = defineExtension({
802
+ const EditorStateExtension = /* @__PURE__ */ defineExtension({
803
803
  build(editor) {
804
804
  return watchedSignal(() => editor.getEditorState(), (editorStateSignal) => editor.registerUpdateListener((payload) => {
805
805
  editorStateSignal.value = payload.editorState;
@@ -826,9 +826,9 @@ function formatDevErrorMessage(message) {
826
826
  */
827
827
  let envLexicalVersion;
828
828
  try {
829
- envLexicalVersion = "0.45.0+dev.esm";
829
+ envLexicalVersion = "0.46.0+dev.esm";
830
830
  } catch (_unused) {}
831
- const LEXICAL_VERSION = envLexicalVersion ?? "0.45.0+source";
831
+ const LEXICAL_VERSION = envLexicalVersion ?? "\"<unknown>+source\"";
832
832
  /**
833
833
  * Copyright (c) Meta Platforms, Inc. and affiliates.
834
834
  *
@@ -852,11 +852,19 @@ const LEXICAL_VERSION = envLexicalVersion ?? "0.45.0+source";
852
852
  * expect(a).toEqual({ a: "a", b: "b", nested: { a: 1, b: 2 } });
853
853
  * ```
854
854
  */
855
+ const UNSAFE_KEYS = new Set([
856
+ "__proto__",
857
+ "constructor",
858
+ "prototype"
859
+ ]);
855
860
  function deepThemeMergeInPlace(a, b) {
856
861
  if (a && b && !Array.isArray(b) && typeof a === "object" && typeof b === "object") {
857
862
  const aObj = a;
858
863
  const bObj = b;
859
- for (const k in bObj) aObj[k] = deepThemeMergeInPlace(aObj[k], bObj[k]);
864
+ for (const k in bObj) {
865
+ if (UNSAFE_KEYS.has(k) || !Object.prototype.hasOwnProperty.call(bObj, k)) continue;
866
+ aObj[k] = deepThemeMergeInPlace(aObj[k], bObj[k]);
867
+ }
860
868
  return a;
861
869
  }
862
870
  return b;
@@ -1091,8 +1099,8 @@ function $defaultInitializer() {
1091
1099
  * but you should not call `editor.setRootElement` earlier than
1092
1100
  * this phase to avoid rendering an empty editor first.
1093
1101
  */
1094
- const InitialStateExtension = defineExtension({
1095
- config: safeCast({
1102
+ const InitialStateExtension = /* @__PURE__ */ defineExtension({
1103
+ config: /* @__PURE__ */ safeCast({
1096
1104
  setOptions: HISTORY_MERGE_OPTIONS,
1097
1105
  updateOptions: HISTORY_MERGE_OPTIONS
1098
1106
  }),
@@ -1220,11 +1228,14 @@ var LexicalBuilder = class LexicalBuilder {
1220
1228
  return builder;
1221
1229
  }
1222
1230
  constructEditor() {
1223
- const { $initialEditorState: _$initialEditorState, onError, ...editorConfig } = this.buildCreateEditorArgs();
1231
+ const { $initialEditorState: _$initialEditorState, onError, onWarn, ...editorConfig } = this.buildCreateEditorArgs();
1224
1232
  const editor = Object.assign(createEditor({
1225
1233
  ...editorConfig,
1226
1234
  ...onError ? { onError: (err) => {
1227
1235
  onError(err, editor);
1236
+ } } : {},
1237
+ ...onWarn ? { onWarn: (err) => {
1238
+ onWarn(err, editor);
1228
1239
  } } : {}
1229
1240
  }), { [builderSymbol]: this });
1230
1241
  for (const extensionRep of this.sortedExtensionReps()) extensionRep.build(editor);
@@ -1345,6 +1356,7 @@ var LexicalBuilder = class LexicalBuilder {
1345
1356
  for (const extensionRep of extensionReps) {
1346
1357
  const { extension } = extensionRep;
1347
1358
  if (extension.onError !== void 0) config.onError = extension.onError;
1359
+ if (extension.onWarn !== void 0) config.onWarn = extension.onWarn;
1348
1360
  if (extension.disableEvents !== void 0) config.disableEvents = extension.disableEvents;
1349
1361
  if (extension.parentEditor !== void 0) config.parentEditor = extension.parentEditor;
1350
1362
  if (extension.editable !== void 0) config.editable = extension.editable;
@@ -1580,7 +1592,7 @@ const EMPTY_SET = /* @__PURE__ */ new Set();
1580
1592
  * currently selected or not. A framework independent
1581
1593
  * alternative to {@link useLexicalNodeSelection}.
1582
1594
  */
1583
- const NodeSelectionExtension = defineExtension({
1595
+ const NodeSelectionExtension = /* @__PURE__ */ defineExtension({
1584
1596
  build(editor, config, state) {
1585
1597
  const editorStateStore = state.getDependency(EditorStateExtension).output;
1586
1598
  const watchedNodeStore = a({ watchedNodeKeys: /* @__PURE__ */ new Map() });
@@ -1631,7 +1643,16 @@ const NodeSelectionExtension = defineExtension({
1631
1643
  * LICENSE file in the root directory of this source tree.
1632
1644
  *
1633
1645
  */
1634
- const INSERT_HORIZONTAL_RULE_COMMAND = createCommand("INSERT_HORIZONTAL_RULE_COMMAND");
1646
+ /**
1647
+ * The serialized form of a {@link HorizontalRuleNode}. It has no extra fields
1648
+ * beyond the base serialized node.
1649
+ */
1650
+ /**
1651
+ * Command that inserts a {@link HorizontalRuleNode} at the current selection.
1652
+ * Dispatch it with
1653
+ * `editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined)`.
1654
+ */
1655
+ const INSERT_HORIZONTAL_RULE_COMMAND = /* @__PURE__ */ createCommand("INSERT_HORIZONTAL_RULE_COMMAND");
1635
1656
  var HorizontalRuleNode = class HorizontalRuleNode extends DecoratorNode {
1636
1657
  static getType() {
1637
1658
  return "horizontalrule";
@@ -1672,6 +1693,9 @@ function $convertHorizontalRuleElement() {
1672
1693
  function $createHorizontalRuleNode() {
1673
1694
  return $create(HorizontalRuleNode);
1674
1695
  }
1696
+ /**
1697
+ * @returns `true` if `node` is a {@link HorizontalRuleNode}, narrowing its type.
1698
+ */
1675
1699
  function $isHorizontalRuleNode(node) {
1676
1700
  return node instanceof HorizontalRuleNode;
1677
1701
  }
@@ -1692,7 +1716,7 @@ function $toggleNodeSelection(node, shiftKey = false) {
1692
1716
  * An extension for HorizontalRuleNode that provides an implementation that
1693
1717
  * works without any React dependency.
1694
1718
  */
1695
- const HorizontalRuleExtension = defineExtension({
1719
+ const HorizontalRuleExtension = /* @__PURE__ */ defineExtension({
1696
1720
  dependencies: [EditorStateExtension, NodeSelectionExtension],
1697
1721
  name: "@lexical/extension/HorizontalRule",
1698
1722
  nodes: () => [HorizontalRuleNode],
@@ -1753,14 +1777,93 @@ const HorizontalRuleExtension = defineExtension({
1753
1777
  * LICENSE file in the root directory of this source tree.
1754
1778
  *
1755
1779
  */
1780
+ /**
1781
+ * Centralizes IME composition state so extensions that react to
1782
+ * composition lifecycle don't each re-implement the
1783
+ * COMPOSITION_START_COMMAND + compositionend listener dance.
1784
+ *
1785
+ * Exposes two signals (both always-active for the editor's lifetime —
1786
+ * listeners are wired up by `register`, not lazily on subscription, so
1787
+ * consumers can read `.value` from anywhere without holding a
1788
+ * subscription themselves):
1789
+ *
1790
+ * - `compositionKey` is the raw mirror — the value Lexical's own
1791
+ * `$handleCompositionStart` writes to its internal `_compositionKey`,
1792
+ * i.e. the `selection.anchor.key` at the moment composition starts.
1793
+ * This can be a non-TextNode key when composition begins on an
1794
+ * element-anchor selection (e.g. empty paragraph). Cleared on
1795
+ * `compositionend`.
1796
+ *
1797
+ * - `composingTextNode` is the resolved view — the actual TextNode
1798
+ * being composed on, or `null` while there is no TextNode-level
1799
+ * composition. For an element-anchor start it stays `null` until
1800
+ * the `COMPOSITION_START_TAG`-tagged update fires with the
1801
+ * post-ZWSP-heuristic selection, at which point it updates to the
1802
+ * new TextNode.
1803
+ *
1804
+ */
1805
+ const IMEExtension = /* @__PURE__ */ defineExtension({
1806
+ build(_editor) {
1807
+ return {
1808
+ composingTextNode: a(null),
1809
+ compositionKey: a(null)
1810
+ };
1811
+ },
1812
+ name: "@lexical/extension/IME",
1813
+ register(editor, _config, state) {
1814
+ const { compositionKey, composingTextNode } = state.getOutput();
1815
+ return mergeRegister(editor.registerCommand(COMPOSITION_START_COMMAND, () => {
1816
+ const selection = $getSelection();
1817
+ if ($isRangeSelection(selection)) compositionKey.value = selection.anchor.key;
1818
+ return false;
1819
+ }, COMMAND_PRIORITY_BEFORE_EDITOR), j(() => {
1820
+ const key = compositionKey.value;
1821
+ if (key === null) {
1822
+ composingTextNode.value = null;
1823
+ return;
1824
+ }
1825
+ composingTextNode.value = editor.read("latest", () => {
1826
+ const node = $getNodeByKey(key);
1827
+ return $isTextNode(node) ? node : null;
1828
+ });
1829
+ }), editor.registerUpdateListener(({ tags, editorState }) => {
1830
+ if (!tags.has(COMPOSITION_START_TAG)) return;
1831
+ editorState.read(() => {
1832
+ const selection = $getSelection();
1833
+ if (!$isRangeSelection(selection)) return;
1834
+ const node = selection.anchor.getNode();
1835
+ if ($isTextNode(node)) composingTextNode.value = node;
1836
+ });
1837
+ }), editor.registerRootListener((rootElem) => {
1838
+ if (rootElem === null) {
1839
+ compositionKey.value = null;
1840
+ return;
1841
+ }
1842
+ const onCompositionEnd = () => {
1843
+ compositionKey.value = null;
1844
+ };
1845
+ rootElem.addEventListener("compositionend", onCompositionEnd);
1846
+ return () => {
1847
+ rootElem.removeEventListener("compositionend", onCompositionEnd);
1848
+ };
1849
+ }));
1850
+ }
1851
+ });
1852
+ /**
1853
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1854
+ *
1855
+ * This source code is licensed under the MIT license found in the
1856
+ * LICENSE file in the root directory of this source tree.
1857
+ *
1858
+ */
1756
1859
  function $defaultGetParentEditor() {
1757
1860
  const editor = $getEditor();
1758
1861
  LexicalBuilder.fromEditor(editor);
1759
1862
  return editor;
1760
1863
  }
1761
- const NestedEditorExtension = defineExtension({
1864
+ const NestedEditorExtension = /* @__PURE__ */ defineExtension({
1762
1865
  build: (editor, config) => namedSignals({ inheritEditableFromParent: config.inheritEditableFromParent }),
1763
- config: safeCast({
1866
+ config: /* @__PURE__ */ safeCast({
1764
1867
  $getParentEditor: $defaultGetParentEditor,
1765
1868
  inheritEditableFromParent: false
1766
1869
  }),
@@ -1781,6 +1884,77 @@ const NestedEditorExtension = defineExtension({
1781
1884
  })
1782
1885
  });
1783
1886
  /**
1887
+ * @experimental
1888
+ *
1889
+ * Mirrors {@link NodeSelection} membership onto the host DOM as an attribute
1890
+ * so CSS can render a selection outline for `ElementNode` hosts, which have
1891
+ * no `decorate()` render path of their own. Configure it per node type:
1892
+ *
1893
+ * ```ts
1894
+ * configExtension(NodeSelectionDataSelectedExtension, {nodes: [CardNode]})
1895
+ * ```
1896
+ *
1897
+ * The matched host needs a corresponding CSS rule, e.g.
1898
+ * `.lexical-card-node[data-selected='true'] { outline: ... }`.
1899
+ */
1900
+ const NodeSelectionDataSelectedExtension = /* @__PURE__ */ defineExtension({
1901
+ config: /* @__PURE__ */ safeCast({
1902
+ attribute: "data-selected",
1903
+ nodes: []
1904
+ }),
1905
+ init(editorConfig, config) {
1906
+ const matchTypes = /* @__PURE__ */ new Set();
1907
+ const subtypeMap = getRegisteredSubtypeMap(getKnownTypesAndNodes(editorConfig).nodes);
1908
+ for (const klass of config.nodes) {
1909
+ const type = klass.getType();
1910
+ const subtypes = subtypeMap.get(type);
1911
+ if (!(subtypes !== void 0)) formatDevErrorMessage(`Node class ${klass.name} with type ${type} not registered in editor`);
1912
+ matchTypes.add(type);
1913
+ for (const subtype of subtypes) matchTypes.add(subtype);
1914
+ }
1915
+ return { matchTypes };
1916
+ },
1917
+ mergeConfig(config, partial) {
1918
+ return shallowMergeConfig(config, {
1919
+ ...partial,
1920
+ ...partial.nodes && { nodes: [...config.nodes, ...partial.nodes] }
1921
+ });
1922
+ },
1923
+ name: "@lexical/extension/NodeSelectionDataSelected",
1924
+ register(editor, config, state) {
1925
+ const { attribute } = config;
1926
+ const { matchTypes } = state.getInitResult();
1927
+ const marked = /* @__PURE__ */ new Map();
1928
+ const syncFromEditorState = (editorState) => {
1929
+ const nextKeys = /* @__PURE__ */ new Set();
1930
+ editorState.read(() => {
1931
+ const selection = $getSelection();
1932
+ if ($isNodeSelection(selection)) {
1933
+ for (const node of selection.getNodes()) if (matchTypes.has(node.getType())) nextKeys.add(node.getKey());
1934
+ }
1935
+ });
1936
+ for (const [key, dom] of marked) if (!nextKeys.has(key)) {
1937
+ dom.removeAttribute(attribute);
1938
+ marked.delete(key);
1939
+ }
1940
+ for (const key of nextKeys) {
1941
+ const dom = editor.getElementByKey(key);
1942
+ if (dom !== null) {
1943
+ dom.setAttribute(attribute, "true");
1944
+ marked.set(key, dom);
1945
+ }
1946
+ }
1947
+ };
1948
+ syncFromEditorState(editor.getEditorState());
1949
+ const removeUpdateListener = editor.registerUpdateListener(({ editorState }) => syncFromEditorState(editorState));
1950
+ return () => {
1951
+ removeUpdateListener();
1952
+ for (const dom of marked.values()) dom.removeAttribute(attribute);
1953
+ marked.clear();
1954
+ };
1955
+ }
1956
+ });
1957
+ /**
1784
1958
  * Copyright (c) Meta Platforms, Inc. and affiliates.
1785
1959
  *
1786
1960
  * This source code is licensed under the MIT license found in the
@@ -1799,9 +1973,9 @@ function deleteEmptyInline(node) {
1799
1973
  * the plugin API with the option to disable it, but it may be removed
1800
1974
  * in the future and integrated into the core
1801
1975
  */
1802
- const NormalizeInlineElementsExtension = defineExtension({
1976
+ const NormalizeInlineElementsExtension = /* @__PURE__ */ defineExtension({
1803
1977
  build: (editor, config, state) => namedSignals(config),
1804
- config: safeCast({ disabled: false }),
1978
+ config: /* @__PURE__ */ safeCast({ disabled: false }),
1805
1979
  name: "@lexical/NormalizeInlineElements",
1806
1980
  register: (editor, config, state) => {
1807
1981
  const stores = state.getOutput();
@@ -1860,9 +2034,9 @@ function $fixFocusOverselection() {
1860
2034
  * be called from other places and it can be replaced or wrapped with
1861
2035
  * different functionality.
1862
2036
  */
1863
- const NormalizeTripleClickSelectionExtension = defineExtension({
2037
+ const NormalizeTripleClickSelectionExtension = /* @__PURE__ */ defineExtension({
1864
2038
  build: (editor, config, state) => namedSignals(config),
1865
- config: safeCast({
2039
+ config: /* @__PURE__ */ safeCast({
1866
2040
  $fixFocusOverselection,
1867
2041
  dateNow: Date.now,
1868
2042
  disabled: false,
@@ -1903,13 +2077,123 @@ const NormalizeTripleClickSelectionExtension = defineExtension({
1903
2077
  * LICENSE file in the root directory of this source tree.
1904
2078
  *
1905
2079
  */
2080
+ function captureKeydown(e) {
2081
+ const target = e.target;
2082
+ if (isExactShortcutMatch(e, "a", {
2083
+ ctrlKey: !IS_APPLE,
2084
+ metaKey: IS_APPLE
2085
+ }) && isHTMLElement(target) && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) target.addEventListener("keydown", stopLexicalPropagation, { once: true });
2086
+ }
2087
+ /**
2088
+ * By default, lexical intercepts most events and dispatches the appropriate commands.
2089
+ * This extension prevents the keydown event propagating from input/textarea elements,
2090
+ * which are typically part of a decorator node, in order to stop dispatching the SELECT_ALL_COMMAND.
2091
+ *
2092
+ * When used as a dependency of SelectBlockExtension, its disabled state is
2093
+ * kept in sync with that extension.
2094
+ */
2095
+ const PreventSelectAllExtension = /* @__PURE__ */ defineExtension({
2096
+ build: (editor, config, state) => namedSignals(config),
2097
+ config: /* @__PURE__ */ safeCast({ disabled: false }),
2098
+ name: "@lexical/extension/PreventSelectAll",
2099
+ register: (editor, config, state) => {
2100
+ const stores = state.getOutput();
2101
+ return j(() => {
2102
+ if (!stores.disabled.value) return editor.registerRootListener((rootElement) => {
2103
+ if (rootElement) {
2104
+ rootElement.addEventListener("keydown", captureKeydown, true);
2105
+ return () => rootElement.removeEventListener("keydown", captureKeydown, true);
2106
+ }
2107
+ });
2108
+ });
2109
+ }
2110
+ });
2111
+ /**
2112
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2113
+ *
2114
+ * This source code is licensed under the MIT license found in the
2115
+ * LICENSE file in the root directory of this source tree.
2116
+ *
2117
+ */
2118
+ function $hasCommonTopParent(nodes, commonTopParent) {
2119
+ return nodes.every((node) => commonTopParent.is(node.getTopLevelElement()));
2120
+ }
2121
+ /**
2122
+ * This extension includes block selection.
2123
+ * If you press Ctrl + A, the nearest block element, for example paragraph, is selected first.
2124
+ * Pressing Ctrl + A again selects all content in the document. A selection
2125
+ * that already spans multiple blocks expands directly to the whole document.
2126
+ */
2127
+ const SelectBlockExtension = /* @__PURE__ */ defineExtension({
2128
+ build: (editor, config, state) => namedSignals(config),
2129
+ config: /* @__PURE__ */ safeCast({
2130
+ cascadeSelection: false,
2131
+ disabled: false
2132
+ }),
2133
+ dependencies: [PreventSelectAllExtension],
2134
+ name: "@lexical/extension/SelectBlock",
2135
+ register: (editor, config, state) => {
2136
+ const stores = state.getOutput();
2137
+ const preventSelectAllStores = state.getDependency(PreventSelectAllExtension).output;
2138
+ return mergeRegister(j(() => {
2139
+ preventSelectAllStores.disabled.value = stores.disabled.value;
2140
+ }), j(() => {
2141
+ if (!stores.disabled.value) return editor.registerCommand(SELECT_ALL_COMMAND, (event, triggerEditor) => {
2142
+ if (triggerEditor !== editor) {
2143
+ if (!stores.cascadeSelection.peek()) return false;
2144
+ if (!triggerEditor.read("pending", () => {
2145
+ const nestedSelection = $getSelection();
2146
+ return $isRangeSelection(nestedSelection) && $isBlockFullySelected($getRoot(), nestedSelection);
2147
+ })) return false;
2148
+ $selectAll();
2149
+ return true;
2150
+ }
2151
+ const selection = $getSelection();
2152
+ if ($isNodeSelection(selection)) {
2153
+ const selectedNodes = selection.getNodes();
2154
+ const firstNode = selectedNodes[0];
2155
+ if (!firstNode) return false;
2156
+ const topParent = firstNode.getTopLevelElement();
2157
+ if (!topParent || $isRootNode(topParent) || topParent.is(firstNode) || selectedNodes.length > 1 && !$hasCommonTopParent(selectedNodes, topParent)) $selectAll();
2158
+ else if ($isElementNode(topParent)) topParent.select(0, topParent.getChildrenSize());
2159
+ return true;
2160
+ }
2161
+ if (!$isRangeSelection(selection)) return false;
2162
+ const anchorNode = selection.anchor.getNode();
2163
+ const blockNode = anchorNode.getTopLevelElement();
2164
+ if (blockNode && blockNode.is(selection.focus.getNode().getTopLevelElement()) && !$isBlockFullySelected(blockNode, selection)) {
2165
+ blockNode.select(0, blockNode.getChildrenSize());
2166
+ return true;
2167
+ }
2168
+ let frame = $getSlotFrame(anchorNode);
2169
+ while (frame !== null) {
2170
+ if ($isElementNode(frame) && !$isBlockFullySelected(frame, selection)) {
2171
+ frame.select(0, frame.getChildrenSize());
2172
+ return true;
2173
+ }
2174
+ const host = $getSlotHost(frame);
2175
+ frame = host === null ? null : $getSlotFrame(host);
2176
+ }
2177
+ if (!$isBlockFullySelected($getRoot(), selection)) $selectAll();
2178
+ return true;
2179
+ }, COMMAND_PRIORITY_LOW);
2180
+ }));
2181
+ }
2182
+ });
2183
+ /**
2184
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2185
+ *
2186
+ * This source code is licensed under the MIT license found in the
2187
+ * LICENSE file in the root directory of this source tree.
2188
+ *
2189
+ */
1906
2190
  /**
1907
2191
  * An extension that highlights selected content in the Lexical editor
1908
2192
  * even when the editor is not currently focused.
1909
2193
  */
1910
- const SelectionAlwaysOnDisplayExtension = defineExtension({
2194
+ const SelectionAlwaysOnDisplayExtension = /* @__PURE__ */ defineExtension({
1911
2195
  build: (editor, config, state) => namedSignals(config),
1912
- config: safeCast({
2196
+ config: /* @__PURE__ */ safeCast({
1913
2197
  disabled: false,
1914
2198
  onReposition: void 0
1915
2199
  }),
@@ -1947,6 +2231,13 @@ function $indentOverTab(selection) {
1947
2231
  function $defaultCanIndent(node) {
1948
2232
  return node.canIndent();
1949
2233
  }
2234
+ /**
2235
+ * Registers a `KEY_TAB_COMMAND` handler that makes Tab and Shift+Tab indent and
2236
+ * outdent block elements (and otherwise insert a tab). Pass `maxIndent` to cap
2237
+ * the indent depth and `$canIndent` to control which elements may be indented.
2238
+ *
2239
+ * @returns A cleanup function that unregisters the handler.
2240
+ */
1950
2241
  function registerTabIndentation(editor, maxIndent, $canIndent = $defaultCanIndent) {
1951
2242
  return mergeRegister(editor.registerCommand(KEY_TAB_COMMAND, (event) => {
1952
2243
  const selection = $getSelection();
@@ -1971,11 +2262,11 @@ function registerTabIndentation(editor, maxIndent, $canIndent = $defaultCanInden
1971
2262
  * recommend using this plugin as it could negatively affect accessibility for keyboard
1972
2263
  * users, causing focus to become trapped within the editor.
1973
2264
  */
1974
- const TabIndentationExtension = defineExtension({
2265
+ const TabIndentationExtension = /* @__PURE__ */ defineExtension({
1975
2266
  build(editor, config, state) {
1976
2267
  return namedSignals(config);
1977
2268
  },
1978
- config: safeCast({
2269
+ config: /* @__PURE__ */ safeCast({
1979
2270
  $canIndent: $defaultCanIndent,
1980
2271
  disabled: false,
1981
2272
  maxIndent: null
@@ -1988,5 +2279,28 @@ const TabIndentationExtension = defineExtension({
1988
2279
  });
1989
2280
  }
1990
2281
  });
2282
+ /**
2283
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2284
+ *
2285
+ * This source code is licensed under the MIT license found in the
2286
+ * LICENSE file in the root directory of this source tree.
2287
+ *
2288
+ */
2289
+ /**
2290
+ * Exposes the editor's editable state as a reactive `Signal<boolean>` that
2291
+ * mirrors `editor.isEditable()` via an editable listener.
2292
+ *
2293
+ * Depend on this extension and read its output `Signal` from a signals
2294
+ * `effect`/`computed` to react to editability changes without subscribing
2295
+ * through React (or any other framework).
2296
+ */
2297
+ const WatchEditableExtension = /* @__PURE__ */ defineExtension({
2298
+ build(editor) {
2299
+ return watchedSignal(() => editor.isEditable(), (signal) => editor.registerEditableListener((editable) => {
2300
+ signal.value = editable;
2301
+ }));
2302
+ },
2303
+ name: "@lexical/extension/WatchEditable"
2304
+ });
1991
2305
  //#endregion
1992
- export { $createHorizontalRuleNode, $defaultShouldInsertAfter, $getExtensionDependency, $getExtensionOutput, $getPeerDependency, $isDecoratorTextNode, $isHorizontalRuleNode, AutoFocusExtension, ClearEditorExtension, ClickAfterLastBlockExtension, DecoratorTextExtension, DecoratorTextNode, EditorStateExtension, HorizontalRuleExtension, HorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND, InitialStateExtension, LexicalBuilder, NestedEditorExtension, NodeSelectionExtension, NormalizeInlineElementsExtension, NormalizeTripleClickSelectionExtension, SelectionAlwaysOnDisplayExtension, TabIndentationExtension, applyFormatFromStyle, applyFormatToDom, n as batch, buildEditorFromExtensions, g as computed, configExtension, declarePeerDependency, defineExtension, j as effect, getExtensionDependencyFromEditor, getKnownTypesAndNodes, getPeerDependencyFromEditor, getPeerDependencyFromEditorOrThrow, namedSignals, registerClearEditor, registerTabIndentation, safeCast, shallowMergeConfig, a as signal, h as untracked, watchedSignal };
2306
+ export { $createHorizontalRuleNode, $defaultShouldInsertAfter, $getExtensionDependency, $getExtensionOutput, $getPeerDependency, $isDecoratorTextNode, $isHorizontalRuleNode, AutoFocusExtension, ClearEditorExtension, ClickAfterLastBlockExtension, DecoratorTextExtension, DecoratorTextNode, EditorStateExtension, HorizontalRuleExtension, HorizontalRuleNode, IMEExtension, INSERT_HORIZONTAL_RULE_COMMAND, InitialStateExtension, LexicalBuilder, NestedEditorExtension, NodeSelectionDataSelectedExtension, NodeSelectionExtension, NormalizeInlineElementsExtension, NormalizeTripleClickSelectionExtension, PreventSelectAllExtension, SelectBlockExtension, SelectionAlwaysOnDisplayExtension, TabIndentationExtension, WatchEditableExtension, applyFormatFromStyle, applyFormatToDom, n as batch, buildEditorFromExtensions, g as computed, configExtension, declarePeerDependency, defineExtension, j as effect, getExtensionDependencyFromEditor, getKnownTypesAndNodes, getPeerDependencyFromEditor, getPeerDependencyFromEditorOrThrow, namedSignals, registerClearEditor, registerTabIndentation, safeCast, shallowMergeConfig, a as signal, h as untracked, watchedSignal };
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@lexical+extension@0.45.0/node_modules/@lexical/extension/dist/LexicalExtension.node.mjs
1
+ //#region ../../node_modules/.pnpm/@lexical+extension@0.46.0_typescript@6.0.3/node_modules/@lexical/extension/dist/LexicalExtension.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 = await (process.env.NODE_ENV !== "production" ? import("./LexicalExtension.dev-BPNyvGqe.mjs") : import("./LexicalExtension.prod-DFKbiNt-.mjs"));
9
+ const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalExtension.dev-CXtOJb83.mjs") : import("./LexicalExtension.prod-BCLGhzcg.mjs"));
10
10
  const $createHorizontalRuleNode = mod.$createHorizontalRuleNode;
11
11
  mod.$defaultShouldInsertAfter;
12
12
  mod.$getExtensionDependency;
@@ -22,15 +22,20 @@ mod.DecoratorTextNode;
22
22
  mod.EditorStateExtension;
23
23
  const HorizontalRuleExtension = mod.HorizontalRuleExtension;
24
24
  const HorizontalRuleNode = mod.HorizontalRuleNode;
25
+ mod.IMEExtension;
25
26
  mod.INSERT_HORIZONTAL_RULE_COMMAND;
26
27
  mod.InitialStateExtension;
27
28
  mod.LexicalBuilder;
28
29
  mod.NestedEditorExtension;
30
+ mod.NodeSelectionDataSelectedExtension;
29
31
  mod.NodeSelectionExtension;
30
32
  const NormalizeInlineElementsExtension = mod.NormalizeInlineElementsExtension;
31
33
  const NormalizeTripleClickSelectionExtension = mod.NormalizeTripleClickSelectionExtension;
34
+ mod.PreventSelectAllExtension;
35
+ mod.SelectBlockExtension;
32
36
  mod.SelectionAlwaysOnDisplayExtension;
33
37
  mod.TabIndentationExtension;
38
+ mod.WatchEditableExtension;
34
39
  mod.applyFormatFromStyle;
35
40
  mod.applyFormatToDom;
36
41
  mod.batch;
@@ -51,6 +56,6 @@ mod.safeCast;
51
56
  mod.shallowMergeConfig;
52
57
  const signal = mod.signal;
53
58
  mod.untracked;
54
- mod.watchedSignal;
59
+ const watchedSignal = mod.watchedSignal;
55
60
  //#endregion
56
- export { HorizontalRuleNode as a, configExtension as c, getPeerDependencyFromEditor as d, namedSignals as f, HorizontalRuleExtension as i, effect as l, $getExtensionOutput as n, NormalizeInlineElementsExtension as o, signal as p, $getPeerDependency as r, NormalizeTripleClickSelectionExtension as s, $createHorizontalRuleNode as t, getKnownTypesAndNodes as u };
61
+ export { HorizontalRuleNode as a, configExtension as c, getPeerDependencyFromEditor as d, namedSignals as f, HorizontalRuleExtension as i, effect as l, watchedSignal as m, $getExtensionOutput as n, NormalizeInlineElementsExtension as o, signal as p, $getPeerDependency as r, NormalizeTripleClickSelectionExtension as s, $createHorizontalRuleNode as t, getKnownTypesAndNodes as u };