@lexical/react 0.14.2 → 0.14.3

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 (191) hide show
  1. package/{LexicalAutoEmbedPlugin.esm.js → LexicalAutoEmbedPlugin.mjs} +2 -2
  2. package/LexicalAutoEmbedPlugin.node.mjs +11 -0
  3. package/{LexicalHashtagPlugin.esm.js → LexicalAutoFocusPlugin.mjs} +3 -3
  4. package/LexicalAutoFocusPlugin.node.mjs +8 -0
  5. package/{LexicalAutoLinkPlugin.esm.js → LexicalAutoLinkPlugin.mjs} +2 -2
  6. package/LexicalAutoLinkPlugin.node.mjs +9 -0
  7. package/{LexicalBlockWithAlignableContents.esm.js → LexicalBlockWithAlignableContents.mjs} +2 -2
  8. package/LexicalBlockWithAlignableContents.node.mjs +8 -0
  9. package/{LexicalClearEditorPlugin.esm.js → LexicalCharacterLimitPlugin.mjs} +3 -3
  10. package/LexicalCharacterLimitPlugin.node.mjs +8 -0
  11. package/LexicalCheckListPlugin.dev.js +1 -1
  12. package/{LexicalCheckListPlugin.dev.esm.js → LexicalCheckListPlugin.dev.mjs} +2 -2
  13. package/LexicalCheckListPlugin.mjs +10 -0
  14. package/LexicalCheckListPlugin.node.mjs +8 -0
  15. package/LexicalCheckListPlugin.prod.js +1 -1
  16. package/LexicalCheckListPlugin.prod.mjs +7 -0
  17. package/{LexicalCheckListPlugin.esm.js → LexicalClearEditorPlugin.mjs} +3 -3
  18. package/LexicalClearEditorPlugin.node.mjs +8 -0
  19. package/LexicalClickableLinkPlugin.d.ts +2 -1
  20. package/LexicalClickableLinkPlugin.dev.js +8 -3
  21. package/{LexicalClickableLinkPlugin.dev.esm.js → LexicalClickableLinkPlugin.dev.mjs} +8 -3
  22. package/LexicalClickableLinkPlugin.mjs +10 -0
  23. package/LexicalClickableLinkPlugin.node.mjs +8 -0
  24. package/LexicalClickableLinkPlugin.prod.js +4 -3
  25. package/LexicalClickableLinkPlugin.prod.mjs +7 -0
  26. package/{LexicalCollaborationContext.esm.js → LexicalCollaborationContext.mjs} +2 -2
  27. package/LexicalCollaborationContext.node.mjs +9 -0
  28. package/LexicalCollaborationPlugin.mjs +10 -0
  29. package/LexicalCollaborationPlugin.node.mjs +8 -0
  30. package/{LexicalListPlugin.esm.js → LexicalComposer.mjs} +3 -3
  31. package/LexicalComposer.node.mjs +8 -0
  32. package/{LexicalComposerContext.esm.js → LexicalComposerContext.mjs} +2 -2
  33. package/LexicalComposerContext.node.mjs +10 -0
  34. package/LexicalContentEditable.mjs +10 -0
  35. package/LexicalContentEditable.node.mjs +8 -0
  36. package/LexicalContextMenuPlugin.d.ts +2 -1
  37. package/LexicalContextMenuPlugin.dev.js +9 -4
  38. package/{LexicalContextMenuPlugin.dev.esm.js → LexicalContextMenuPlugin.dev.mjs} +9 -4
  39. package/{LexicalContextMenuPlugin.esm.js → LexicalContextMenuPlugin.mjs} +2 -2
  40. package/LexicalContextMenuPlugin.node.mjs +9 -0
  41. package/LexicalContextMenuPlugin.prod.js +16 -16
  42. package/LexicalContextMenuPlugin.prod.mjs +7 -0
  43. package/{LexicalDecoratorBlockNode.esm.js → LexicalDecoratorBlockNode.mjs} +2 -2
  44. package/LexicalDecoratorBlockNode.node.mjs +9 -0
  45. package/LexicalEditorRefPlugin.mjs +10 -0
  46. package/LexicalEditorRefPlugin.node.mjs +8 -0
  47. package/{useLexicalEditable.esm.js → LexicalErrorBoundary.mjs} +2 -2
  48. package/LexicalErrorBoundary.node.mjs +8 -0
  49. package/{LexicalClickableLinkPlugin.esm.js → LexicalHashtagPlugin.mjs} +3 -3
  50. package/LexicalHashtagPlugin.node.mjs +8 -0
  51. package/{LexicalHistoryPlugin.esm.js → LexicalHistoryPlugin.mjs} +2 -2
  52. package/LexicalHistoryPlugin.node.mjs +9 -0
  53. package/{LexicalHorizontalRuleNode.esm.js → LexicalHorizontalRuleNode.mjs} +2 -2
  54. package/LexicalHorizontalRuleNode.node.mjs +11 -0
  55. package/{LexicalCollaborationPlugin.esm.js → LexicalHorizontalRulePlugin.mjs} +3 -3
  56. package/LexicalHorizontalRulePlugin.node.mjs +8 -0
  57. package/{LexicalTableOfContents.esm.js → LexicalLinkPlugin.mjs} +3 -3
  58. package/LexicalLinkPlugin.node.mjs +8 -0
  59. package/LexicalListPlugin.mjs +10 -0
  60. package/LexicalListPlugin.node.mjs +8 -0
  61. package/{LexicalMarkdownShortcutPlugin.esm.js → LexicalMarkdownShortcutPlugin.mjs} +2 -2
  62. package/LexicalMarkdownShortcutPlugin.node.mjs +9 -0
  63. package/LexicalNestedComposer.dev.js +6 -2
  64. package/{LexicalNestedComposer.dev.esm.js → LexicalNestedComposer.dev.mjs} +6 -2
  65. package/LexicalNestedComposer.mjs +10 -0
  66. package/LexicalNestedComposer.node.mjs +8 -0
  67. package/LexicalNestedComposer.prod.js +5 -4
  68. package/LexicalNestedComposer.prod.mjs +7 -0
  69. package/LexicalNodeEventPlugin.mjs +10 -0
  70. package/LexicalNodeEventPlugin.node.mjs +8 -0
  71. package/LexicalNodeMenuPlugin.dev.js +1 -1
  72. package/{LexicalNodeMenuPlugin.dev.esm.js → LexicalNodeMenuPlugin.dev.mjs} +1 -1
  73. package/{LexicalNodeMenuPlugin.esm.js → LexicalNodeMenuPlugin.mjs} +2 -2
  74. package/LexicalNodeMenuPlugin.node.mjs +9 -0
  75. package/LexicalNodeMenuPlugin.prod.js +1 -1
  76. package/{LexicalNodeMenuPlugin.prod.esm.js → LexicalNodeMenuPlugin.prod.mjs} +1 -1
  77. package/{LexicalComposer.esm.js → LexicalOnChangePlugin.mjs} +3 -3
  78. package/LexicalOnChangePlugin.node.mjs +8 -0
  79. package/LexicalPlainTextPlugin.mjs +10 -0
  80. package/LexicalPlainTextPlugin.node.mjs +8 -0
  81. package/{LexicalLinkPlugin.esm.js → LexicalRichTextPlugin.mjs} +3 -3
  82. package/LexicalRichTextPlugin.node.mjs +8 -0
  83. package/{LexicalTabIndentationPlugin.esm.js → LexicalTabIndentationPlugin.mjs} +2 -2
  84. package/LexicalTabIndentationPlugin.node.mjs +9 -0
  85. package/{LexicalErrorBoundary.esm.js → LexicalTableOfContents.mjs} +2 -2
  86. package/LexicalTableOfContents.node.mjs +8 -0
  87. package/LexicalTablePlugin.mjs +10 -0
  88. package/LexicalTablePlugin.node.mjs +8 -0
  89. package/{LexicalTreeView.esm.js → LexicalTreeView.mjs} +2 -2
  90. package/LexicalTreeView.node.mjs +8 -0
  91. package/LexicalTypeaheadMenuPlugin.dev.js +1 -1
  92. package/{LexicalTypeaheadMenuPlugin.dev.esm.js → LexicalTypeaheadMenuPlugin.dev.mjs} +1 -1
  93. package/{LexicalTypeaheadMenuPlugin.esm.js → LexicalTypeaheadMenuPlugin.mjs} +2 -2
  94. package/LexicalTypeaheadMenuPlugin.node.mjs +14 -0
  95. package/LexicalTypeaheadMenuPlugin.prod.js +1 -1
  96. package/{LexicalTypeaheadMenuPlugin.prod.esm.js → LexicalTypeaheadMenuPlugin.prod.mjs} +1 -1
  97. package/package.json +499 -179
  98. package/useLexicalEditable.mjs +10 -0
  99. package/useLexicalEditable.node.mjs +8 -0
  100. package/{useLexicalIsTextContentEmpty.esm.js → useLexicalIsTextContentEmpty.mjs} +2 -2
  101. package/useLexicalIsTextContentEmpty.node.mjs +8 -0
  102. package/{useLexicalNodeSelection.esm.js → useLexicalNodeSelection.mjs} +2 -2
  103. package/useLexicalNodeSelection.node.mjs +8 -0
  104. package/useLexicalSubscription.mjs +10 -0
  105. package/useLexicalSubscription.node.mjs +8 -0
  106. package/{LexicalAutoFocusPlugin.esm.js → useLexicalTextEntity.mjs} +3 -3
  107. package/useLexicalTextEntity.node.mjs +8 -0
  108. package/LexicalCharacterLimitPlugin.esm.js +0 -10
  109. package/LexicalCheckListPlugin.prod.esm.js +0 -7
  110. package/LexicalClickableLinkPlugin.prod.esm.js +0 -7
  111. package/LexicalContentEditable.esm.js +0 -10
  112. package/LexicalContextMenuPlugin.prod.esm.js +0 -7
  113. package/LexicalEditorRefPlugin.esm.js +0 -10
  114. package/LexicalHorizontalRulePlugin.esm.js +0 -10
  115. package/LexicalNestedComposer.esm.js +0 -10
  116. package/LexicalNestedComposer.prod.esm.js +0 -7
  117. package/LexicalNodeEventPlugin.esm.js +0 -10
  118. package/LexicalOnChangePlugin.esm.js +0 -10
  119. package/LexicalPlainTextPlugin.esm.js +0 -10
  120. package/LexicalRichTextPlugin.esm.js +0 -10
  121. package/LexicalTablePlugin.esm.js +0 -10
  122. package/useLexicalSubscription.esm.js +0 -10
  123. package/useLexicalTextEntity.esm.js +0 -10
  124. /package/{LexicalAutoEmbedPlugin.dev.esm.js → LexicalAutoEmbedPlugin.dev.mjs} +0 -0
  125. /package/{LexicalAutoEmbedPlugin.prod.esm.js → LexicalAutoEmbedPlugin.prod.mjs} +0 -0
  126. /package/{LexicalAutoFocusPlugin.dev.esm.js → LexicalAutoFocusPlugin.dev.mjs} +0 -0
  127. /package/{LexicalAutoFocusPlugin.prod.esm.js → LexicalAutoFocusPlugin.prod.mjs} +0 -0
  128. /package/{LexicalAutoLinkPlugin.dev.esm.js → LexicalAutoLinkPlugin.dev.mjs} +0 -0
  129. /package/{LexicalAutoLinkPlugin.prod.esm.js → LexicalAutoLinkPlugin.prod.mjs} +0 -0
  130. /package/{LexicalBlockWithAlignableContents.dev.esm.js → LexicalBlockWithAlignableContents.dev.mjs} +0 -0
  131. /package/{LexicalBlockWithAlignableContents.prod.esm.js → LexicalBlockWithAlignableContents.prod.mjs} +0 -0
  132. /package/{LexicalCharacterLimitPlugin.dev.esm.js → LexicalCharacterLimitPlugin.dev.mjs} +0 -0
  133. /package/{LexicalCharacterLimitPlugin.prod.esm.js → LexicalCharacterLimitPlugin.prod.mjs} +0 -0
  134. /package/{LexicalClearEditorPlugin.dev.esm.js → LexicalClearEditorPlugin.dev.mjs} +0 -0
  135. /package/{LexicalClearEditorPlugin.prod.esm.js → LexicalClearEditorPlugin.prod.mjs} +0 -0
  136. /package/{LexicalCollaborationContext.dev.esm.js → LexicalCollaborationContext.dev.mjs} +0 -0
  137. /package/{LexicalCollaborationContext.prod.esm.js → LexicalCollaborationContext.prod.mjs} +0 -0
  138. /package/{LexicalCollaborationPlugin.dev.esm.js → LexicalCollaborationPlugin.dev.mjs} +0 -0
  139. /package/{LexicalCollaborationPlugin.prod.esm.js → LexicalCollaborationPlugin.prod.mjs} +0 -0
  140. /package/{LexicalComposer.dev.esm.js → LexicalComposer.dev.mjs} +0 -0
  141. /package/{LexicalComposer.prod.esm.js → LexicalComposer.prod.mjs} +0 -0
  142. /package/{LexicalComposerContext.dev.esm.js → LexicalComposerContext.dev.mjs} +0 -0
  143. /package/{LexicalComposerContext.prod.esm.js → LexicalComposerContext.prod.mjs} +0 -0
  144. /package/{LexicalContentEditable.dev.esm.js → LexicalContentEditable.dev.mjs} +0 -0
  145. /package/{LexicalContentEditable.prod.esm.js → LexicalContentEditable.prod.mjs} +0 -0
  146. /package/{LexicalDecoratorBlockNode.dev.esm.js → LexicalDecoratorBlockNode.dev.mjs} +0 -0
  147. /package/{LexicalDecoratorBlockNode.prod.esm.js → LexicalDecoratorBlockNode.prod.mjs} +0 -0
  148. /package/{LexicalEditorRefPlugin.dev.esm.js → LexicalEditorRefPlugin.dev.mjs} +0 -0
  149. /package/{LexicalEditorRefPlugin.prod.esm.js → LexicalEditorRefPlugin.prod.mjs} +0 -0
  150. /package/{LexicalErrorBoundary.dev.esm.js → LexicalErrorBoundary.dev.mjs} +0 -0
  151. /package/{LexicalErrorBoundary.prod.esm.js → LexicalErrorBoundary.prod.mjs} +0 -0
  152. /package/{LexicalHashtagPlugin.dev.esm.js → LexicalHashtagPlugin.dev.mjs} +0 -0
  153. /package/{LexicalHashtagPlugin.prod.esm.js → LexicalHashtagPlugin.prod.mjs} +0 -0
  154. /package/{LexicalHistoryPlugin.dev.esm.js → LexicalHistoryPlugin.dev.mjs} +0 -0
  155. /package/{LexicalHistoryPlugin.prod.esm.js → LexicalHistoryPlugin.prod.mjs} +0 -0
  156. /package/{LexicalHorizontalRuleNode.dev.esm.js → LexicalHorizontalRuleNode.dev.mjs} +0 -0
  157. /package/{LexicalHorizontalRuleNode.prod.esm.js → LexicalHorizontalRuleNode.prod.mjs} +0 -0
  158. /package/{LexicalHorizontalRulePlugin.dev.esm.js → LexicalHorizontalRulePlugin.dev.mjs} +0 -0
  159. /package/{LexicalHorizontalRulePlugin.prod.esm.js → LexicalHorizontalRulePlugin.prod.mjs} +0 -0
  160. /package/{LexicalLinkPlugin.dev.esm.js → LexicalLinkPlugin.dev.mjs} +0 -0
  161. /package/{LexicalLinkPlugin.prod.esm.js → LexicalLinkPlugin.prod.mjs} +0 -0
  162. /package/{LexicalListPlugin.dev.esm.js → LexicalListPlugin.dev.mjs} +0 -0
  163. /package/{LexicalListPlugin.prod.esm.js → LexicalListPlugin.prod.mjs} +0 -0
  164. /package/{LexicalMarkdownShortcutPlugin.dev.esm.js → LexicalMarkdownShortcutPlugin.dev.mjs} +0 -0
  165. /package/{LexicalMarkdownShortcutPlugin.prod.esm.js → LexicalMarkdownShortcutPlugin.prod.mjs} +0 -0
  166. /package/{LexicalNodeEventPlugin.dev.esm.js → LexicalNodeEventPlugin.dev.mjs} +0 -0
  167. /package/{LexicalNodeEventPlugin.prod.esm.js → LexicalNodeEventPlugin.prod.mjs} +0 -0
  168. /package/{LexicalOnChangePlugin.dev.esm.js → LexicalOnChangePlugin.dev.mjs} +0 -0
  169. /package/{LexicalOnChangePlugin.prod.esm.js → LexicalOnChangePlugin.prod.mjs} +0 -0
  170. /package/{LexicalPlainTextPlugin.dev.esm.js → LexicalPlainTextPlugin.dev.mjs} +0 -0
  171. /package/{LexicalPlainTextPlugin.prod.esm.js → LexicalPlainTextPlugin.prod.mjs} +0 -0
  172. /package/{LexicalRichTextPlugin.dev.esm.js → LexicalRichTextPlugin.dev.mjs} +0 -0
  173. /package/{LexicalRichTextPlugin.prod.esm.js → LexicalRichTextPlugin.prod.mjs} +0 -0
  174. /package/{LexicalTabIndentationPlugin.dev.esm.js → LexicalTabIndentationPlugin.dev.mjs} +0 -0
  175. /package/{LexicalTabIndentationPlugin.prod.esm.js → LexicalTabIndentationPlugin.prod.mjs} +0 -0
  176. /package/{LexicalTableOfContents.dev.esm.js → LexicalTableOfContents.dev.mjs} +0 -0
  177. /package/{LexicalTableOfContents.prod.esm.js → LexicalTableOfContents.prod.mjs} +0 -0
  178. /package/{LexicalTablePlugin.dev.esm.js → LexicalTablePlugin.dev.mjs} +0 -0
  179. /package/{LexicalTablePlugin.prod.esm.js → LexicalTablePlugin.prod.mjs} +0 -0
  180. /package/{LexicalTreeView.dev.esm.js → LexicalTreeView.dev.mjs} +0 -0
  181. /package/{LexicalTreeView.prod.esm.js → LexicalTreeView.prod.mjs} +0 -0
  182. /package/{useLexicalEditable.dev.esm.js → useLexicalEditable.dev.mjs} +0 -0
  183. /package/{useLexicalEditable.prod.esm.js → useLexicalEditable.prod.mjs} +0 -0
  184. /package/{useLexicalIsTextContentEmpty.dev.esm.js → useLexicalIsTextContentEmpty.dev.mjs} +0 -0
  185. /package/{useLexicalIsTextContentEmpty.prod.esm.js → useLexicalIsTextContentEmpty.prod.mjs} +0 -0
  186. /package/{useLexicalNodeSelection.dev.esm.js → useLexicalNodeSelection.dev.mjs} +0 -0
  187. /package/{useLexicalNodeSelection.prod.esm.js → useLexicalNodeSelection.prod.mjs} +0 -0
  188. /package/{useLexicalSubscription.dev.esm.js → useLexicalSubscription.dev.mjs} +0 -0
  189. /package/{useLexicalSubscription.prod.esm.js → useLexicalSubscription.prod.mjs} +0 -0
  190. /package/{useLexicalTextEntity.dev.esm.js → useLexicalTextEntity.dev.mjs} +0 -0
  191. /package/{useLexicalTextEntity.prod.esm.js → useLexicalTextEntity.prod.mjs} +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalPlainTextPlugin.dev.mjs') : import('./LexicalPlainTextPlugin.prod.mjs'));
8
+ export const PlainTextPlugin = mod.PlainTextPlugin;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalLinkPlugin.dev.esm.js';
8
- import * as modProd from './LexicalLinkPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalRichTextPlugin.dev.mjs';
8
+ import * as modProd from './LexicalRichTextPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
- export const LinkPlugin = mod.LinkPlugin;
10
+ export const RichTextPlugin = mod.RichTextPlugin;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalRichTextPlugin.dev.mjs') : import('./LexicalRichTextPlugin.prod.mjs'));
8
+ export const RichTextPlugin = mod.RichTextPlugin;
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalTabIndentationPlugin.dev.esm.js';
8
- import * as modProd from './LexicalTabIndentationPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalTabIndentationPlugin.dev.mjs';
8
+ import * as modProd from './LexicalTabIndentationPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const TabIndentationPlugin = mod.TabIndentationPlugin;
11
11
  export const registerTabIndentation = mod.registerTabIndentation;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalTabIndentationPlugin.dev.mjs') : import('./LexicalTabIndentationPlugin.prod.mjs'));
8
+ export const TabIndentationPlugin = mod.TabIndentationPlugin;
9
+ export const registerTabIndentation = mod.registerTabIndentation;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalErrorBoundary.dev.esm.js';
8
- import * as modProd from './LexicalErrorBoundary.prod.esm.js';
7
+ import * as modDev from './LexicalTableOfContents.dev.mjs';
8
+ import * as modProd from './LexicalTableOfContents.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export default mod.default;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalTableOfContents.dev.mjs') : import('./LexicalTableOfContents.prod.mjs'));
8
+ export default mod.default;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import * as modDev from './LexicalTablePlugin.dev.mjs';
8
+ import * as modProd from './LexicalTablePlugin.prod.mjs';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const TablePlugin = mod.TablePlugin;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalTablePlugin.dev.mjs') : import('./LexicalTablePlugin.prod.mjs'));
8
+ export const TablePlugin = mod.TablePlugin;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalTreeView.dev.esm.js';
8
- import * as modProd from './LexicalTreeView.prod.esm.js';
7
+ import * as modDev from './LexicalTreeView.dev.mjs';
8
+ import * as modProd from './LexicalTreeView.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const TreeView = mod.TreeView;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalTreeView.dev.mjs') : import('./LexicalTreeView.prod.mjs'));
8
+ export const TreeView = mod.TreeView;
@@ -323,7 +323,7 @@ function useMenuAnchorRef(resolution, setResolution, className, parent = documen
323
323
  height
324
324
  } = resolution.getRect();
325
325
  const anchorHeight = anchorElementRef.current.offsetHeight; // use to position under anchor
326
- containerDiv.style.top = `${top + window.pageYOffset + anchorHeight + 3}px`;
326
+ containerDiv.style.top = `${top + anchorHeight + 3}px`;
327
327
  containerDiv.style.left = `${left + window.pageXOffset}px`;
328
328
  containerDiv.style.height = `${height}px`;
329
329
  containerDiv.style.width = `${width}px`;
@@ -322,7 +322,7 @@ function useMenuAnchorRef(resolution, setResolution, className, parent = documen
322
322
  height
323
323
  } = resolution.getRect();
324
324
  const anchorHeight = anchorElementRef.current.offsetHeight; // use to position under anchor
325
- containerDiv.style.top = `${top + window.pageYOffset + anchorHeight + 3}px`;
325
+ containerDiv.style.top = `${top + anchorHeight + 3}px`;
326
326
  containerDiv.style.left = `${left + window.pageXOffset}px`;
327
327
  containerDiv.style.height = `${height}px`;
328
328
  containerDiv.style.width = `${width}px`;
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalTypeaheadMenuPlugin.dev.esm.js';
8
- import * as modProd from './LexicalTypeaheadMenuPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalTypeaheadMenuPlugin.dev.mjs';
8
+ import * as modProd from './LexicalTypeaheadMenuPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const LexicalTypeaheadMenuPlugin = mod.LexicalTypeaheadMenuPlugin;
11
11
  export const MenuOption = mod.MenuOption;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalTypeaheadMenuPlugin.dev.mjs') : import('./LexicalTypeaheadMenuPlugin.prod.mjs'));
8
+ export const LexicalTypeaheadMenuPlugin = mod.LexicalTypeaheadMenuPlugin;
9
+ export const MenuOption = mod.MenuOption;
10
+ export const PUNCTUATION = mod.PUNCTUATION;
11
+ export const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND = mod.SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND;
12
+ export const getScrollParent = mod.getScrollParent;
13
+ export const useBasicTypeaheadTriggerMatch = mod.useBasicTypeaheadTriggerMatch;
14
+ export const useDynamicPositioning = mod.useDynamicPositioning;
@@ -14,7 +14,7 @@ function L({close:b,editor:a,anchorElementRef:c,resolution:d,options:f,menuRende
14
14
  "typeahead-item-"+g),h(g))},[a]);y.useEffect(()=>()=>{let g=a.getRootElement();null!==g&&g.removeAttribute("aria-activedescendant")},[a]);B(()=>{null===f?h(null):null===e&&t(0)},[f,e,t]);y.useEffect(()=>A.mergeRegister(a.registerCommand(K,({option:g})=>g.ref&&null!=g.ref.current?(D(g.ref.current),!0):!1,p)),[a,t,p]);y.useEffect(()=>A.mergeRegister(a.registerCommand(q.KEY_ARROW_DOWN_COMMAND,g=>{if(null!==f&&f.length&&null!==e){let m=e!==f.length-1?e+1:0;t(m);let w=f[m];null!=w.ref&&w.ref.current&&
15
15
  a.dispatchCommand(K,{index:m,option:w});g.preventDefault();g.stopImmediatePropagation()}return!0},p),a.registerCommand(q.KEY_ARROW_UP_COMMAND,g=>{if(null!==f&&f.length&&null!==e){var m=0!==e?e-1:f.length-1;t(m);m=f[m];null!=m.ref&&m.ref.current&&D(m.ref.current);g.preventDefault();g.stopImmediatePropagation()}return!0},p),a.registerCommand(q.KEY_ESCAPE_COMMAND,g=>{g.preventDefault();g.stopImmediatePropagation();b();return!0},p),a.registerCommand(q.KEY_TAB_COMMAND,g=>{if(null===f||null===e||null==
16
16
  f[e])return!1;g.preventDefault();g.stopImmediatePropagation();k(f[e]);return!0},p),a.registerCommand(q.KEY_ENTER_COMMAND,g=>{if(null===f||null===e||null==f[e])return!1;null!==g&&(g.preventDefault(),g.stopImmediatePropagation());k(f[e]);return!0},p)),[k,b,a,f,e,t,p]);let u=y.useMemo(()=>({options:f,selectOptionAndCleanUp:k,selectedIndex:e,setHighlightedIndex:h}),[k,e,f]);return n(c,u,d.match?d.match.matchingString:"")}
17
- function M(b,a,c,d=document.body){let [f]=l.useLexicalComposerContext(),n=y.useRef(document.createElement("div")),r=y.useCallback(()=>{n.current.style.top=n.current.style.bottom;const p=f.getRootElement(),e=n.current;var h=e.firstChild;if(null!==p&&null!==b){const {left:t,top:u,width:g,height:m}=b.getRect();e.style.top=`${u+window.pageYOffset+n.current.offsetHeight+3}px`;e.style.left=`${t+window.pageXOffset}px`;e.style.height=`${m}px`;e.style.width=`${g}px`;if(null!==h){h.style.top=`${u}`;var k=h.getBoundingClientRect();
17
+ function M(b,a,c,d=document.body){let [f]=l.useLexicalComposerContext(),n=y.useRef(document.createElement("div")),r=y.useCallback(()=>{n.current.style.top=n.current.style.bottom;const p=f.getRootElement(),e=n.current;var h=e.firstChild;if(null!==p&&null!==b){const {left:t,top:u,width:g,height:m}=b.getRect();e.style.top=`${u+n.current.offsetHeight+3}px`;e.style.left=`${t+window.pageXOffset}px`;e.style.height=`${m}px`;e.style.width=`${g}px`;if(null!==h){h.style.top=`${u}`;var k=h.getBoundingClientRect();
18
18
  h=k.height;k=k.width;const w=p.getBoundingClientRect();t+k>w.right&&(e.style.left=`${w.right-k+window.pageXOffset}px`);(u+h>window.innerHeight||u+h>w.bottom)&&u-w.top>h&&(e.style.top=`${u-h+window.pageYOffset-m}px`)}e.isConnected||(null!=c&&(e.className=c),e.setAttribute("aria-label","Typeahead menu"),e.setAttribute("id","typeahead-menu"),e.setAttribute("role","listbox"),e.style.display="block",e.style.position="absolute",d.append(e));n.current=e;p.setAttribute("aria-controls","typeahead-menu")}},
19
19
  [f,b,c,d]);y.useEffect(()=>{let p=f.getRootElement();if(null!==b)return r(),()=>{null!==p&&p.removeAttribute("aria-controls");let e=n.current;null!==e&&e.isConnected&&e.remove()}},[f,r,b]);let v=y.useCallback(p=>{null!==b&&(p||a(null))},[b,a]);J(b,n.current,r,v);return n}function N(b,a,c){var d=c.getSelection();if(null===d||!d.isCollapsed)return!1;c=d.anchorNode;d=d.anchorOffset;if(null==c||null==d)return!1;try{a.setStart(c,b),a.setEnd(c,d)}catch(f){return!1}return!0}
20
20
  function O(b){let a=null;b.getEditorState().read(()=>{var c=q.$getSelection();if(q.$isRangeSelection(c)){var d=c.anchor;"text"!==d.type?a=null:(c=d.getNode(),c.isSimpleText()?(d=d.offset,a=c.getTextContent().slice(0,d)):a=null)}});return a}function P(b,a){return 0!==a?!1:b.getEditorState().read(()=>{var c=q.$getSelection();return q.$isRangeSelection(c)?(c=c.anchor.getNode().getPreviousSibling(),q.$isTextNode(c)&&c.isTextEntity()):!1})}function Q(b){y.startTransition?y.startTransition(b):b()}
@@ -4,4 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{createCommand as e,KEY_ARROW_DOWN_COMMAND as n,KEY_ARROW_UP_COMMAND as o,KEY_ESCAPE_COMMAND as r,KEY_TAB_COMMAND as l,KEY_ENTER_COMMAND as i,COMMAND_PRIORITY_LOW as s,$getSelection as u,$isRangeSelection as c,$isTextNode as a}from"lexical";import*as d from"react";import{useLayoutEffect as m,useEffect as f,useState as p,useCallback as g,useMemo as h,useRef as w}from"react";import{mergeRegister as y}from"@lexical/utils";var C="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?m:f;class b{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}}const v=t=>{const e=document.getElementById("typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function E(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return n.top>o.top&&n.top<o.bottom}function x(e,n,o,r){const[l]=t();f((()=>{if(null!=n&&null!=e){const t=l.getRootElement(),e=null!=t?function(t,e){let n=getComputedStyle(t);const o="absolute"===n.position,r=e?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===n.position)return document.body;for(let e=t;e=e.parentElement;)if(n=getComputedStyle(e),(!o||"static"!==n.position)&&r.test(n.overflow+n.overflowY+n.overflowX))return e;return document.body}(t,!1):document.body;let i=!1,s=E(n,e);const u=function(){i||(window.requestAnimationFrame((function(){o(),i=!1})),i=!0);const t=E(n,e);t!==s&&(s=t,null!=r&&r(t))},c=new ResizeObserver(o);return window.addEventListener("resize",o),document.addEventListener("scroll",u,{capture:!0,passive:!0}),c.observe(n),()=>{c.unobserve(n),window.removeEventListener("resize",o),document.removeEventListener("scroll",u,!0)}}}),[n,l,r,o,e])}const S=e("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function R({close:t,editor:e,anchorElementRef:a,resolution:d,options:m,menuRenderFn:w,onSelectOption:b,shouldSplitNodeWithQuery:E=!1,commandPriority:x=s}){const[R,O]=p(null),I=d.match&&d.match.matchingString;f((()=>{O(0)}),[I]);const T=g((n=>{e.update((()=>{const e=null!=d.match&&E?function(t){const e=u();if(!c(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const o=n.getNode();if(!o.isSimpleText())return null;const r=n.offset,l=o.getTextContent().slice(0,r),i=t.replaceableString.length,s=r-function(t,e,n){let o=n;for(let n=o;n<=e.length;n++)t.substr(-n)===e.substr(0,n)&&(o=n);return o}(l,t.matchingString,i);if(s<0)return null;let a;return 0===s?[a]=o.splitText(r):[,a]=o.splitText(s,r),a}(d.match):null;b(n,e,t,d.match?d.match.matchingString:"")}))}),[e,E,d.match,b,t]),A=g((t=>{const n=e.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+t),O(t))}),[e]);f((()=>()=>{const t=e.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")}),[e]),C((()=>{null===m?O(null):null===R&&A(0)}),[m,R,A]),f((()=>y(e.registerCommand(S,(({option:t})=>!(!t.ref||null==t.ref.current)&&(v(t.ref.current),!0)),x))),[e,A,x]),f((()=>y(e.registerCommand(n,(t=>{const n=t;if(null!==m&&m.length&&null!==R){const t=R!==m.length-1?R+1:0;A(t);const o=m[t];null!=o.ref&&o.ref.current&&e.dispatchCommand(S,{index:t,option:o}),n.preventDefault(),n.stopImmediatePropagation()}return!0}),x),e.registerCommand(o,(t=>{const e=t;if(null!==m&&m.length&&null!==R){const t=0!==R?R-1:m.length-1;A(t);const n=m[t];null!=n.ref&&n.ref.current&&v(n.ref.current),e.preventDefault(),e.stopImmediatePropagation()}return!0}),x),e.registerCommand(r,(e=>{const n=e;return n.preventDefault(),n.stopImmediatePropagation(),t(),!0}),x),e.registerCommand(l,(t=>{const e=t;return null!==m&&null!==R&&null!=m[R]&&(e.preventDefault(),e.stopImmediatePropagation(),T(m[R]),!0)}),x),e.registerCommand(i,(t=>null!==m&&null!==R&&null!=m[R]&&(null!==t&&(t.preventDefault(),t.stopImmediatePropagation()),T(m[R]),!0)),x))),[T,t,e,m,R,A,x]);return w(a,h((()=>({options:m,selectOptionAndCleanUp:T,selectedIndex:R,setHighlightedIndex:O})),[T,R,m]),d.match?d.match.matchingString:"")}const O="\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;";function I(t,e){let n=getComputedStyle(t);const o="absolute"===n.position,r=e?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===n.position)return document.body;for(let e=t;e=e.parentElement;)if(n=getComputedStyle(e),(!o||"static"!==n.position)&&r.test(n.overflow+n.overflowY+n.overflowX))return e;return document.body}const T=e("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function A(t,{minLength:e=1,maxLength:n=75}){return g((o=>{const r=new RegExp("(^|\\s|\\()(["+t+"]((?:"+("[^"+t+O+"\\s]")+"){0,"+n+"}))$").exec(o);if(null!==r){const t=r[1],n=r[3];if(n.length>=e)return{leadOffset:r.index+t.length,matchingString:n,replaceableString:r[2]}}return null}),[n,e,t])}function N({options:e,onQueryChange:n,onSelectOption:o,onOpen:r,onClose:l,menuRenderFn:i,triggerFn:m,anchorClassName:h,commandPriority:y=s,parent:C}){const[b]=t(),[v,E]=p(null),S=function(e,n,o,r=document.body){const[l]=t(),i=w(document.createElement("div")),s=g((()=>{i.current.style.top=i.current.style.bottom;const t=l.getRootElement(),n=i.current,s=n.firstChild;if(null!==t&&null!==e){const{left:l,top:u,width:c,height:a}=e.getRect(),d=i.current.offsetHeight;if(n.style.top=`${u+window.pageYOffset+d+3}px`,n.style.left=`${l+window.pageXOffset}px`,n.style.height=`${a}px`,n.style.width=`${c}px`,null!==s){s.style.top=`${u}`;const e=s.getBoundingClientRect(),o=e.height,r=e.width,i=t.getBoundingClientRect();l+r>i.right&&(n.style.left=`${i.right-r+window.pageXOffset}px`),(u+o>window.innerHeight||u+o>i.bottom)&&u-i.top>o&&(n.style.top=u-o+window.pageYOffset-a+"px")}n.isConnected||(null!=o&&(n.className=o),n.setAttribute("aria-label","Typeahead menu"),n.setAttribute("id","typeahead-menu"),n.setAttribute("role","listbox"),n.style.display="block",n.style.position="absolute",r.append(n)),i.current=n,t.setAttribute("aria-controls","typeahead-menu")}}),[l,e,o,r]);f((()=>{const t=l.getRootElement();if(null!==e)return s(),()=>{null!==t&&t.removeAttribute("aria-controls");const e=i.current;null!==e&&e.isConnected&&e.remove()}}),[l,s,e]);const u=g((t=>{null!==e&&(t||n(null))}),[e,n]);return x(e,i.current,s,u),i}(v,E,h,C),O=g((()=>{E(null),null!=l&&null!==v&&l()}),[l,v]),I=g((t=>{E(t),null!=r&&null===v&&r(t)}),[r,v]);return f((()=>{const t=b.registerUpdateListener((()=>{b.getEditorState().read((()=>{const t=b._window||window,e=t.document.createRange(),o=u(),r=function(t){let e=null;return t.getEditorState().read((()=>{const t=u();c(t)&&(e=function(t){const e=t.anchor;if("text"!==e.type)return null;const n=e.getNode();if(!n.isSimpleText())return null;const o=e.offset;return n.getTextContent().slice(0,o)}(t))})),e}(b);if(!c(o)||!o.isCollapsed()||null===r||null===e)return void O();const l=m(r,b);if(n(l?l.matchingString:null),null!==l&&!function(t,e){return 0===e&&t.getEditorState().read((()=>{const t=u();if(c(t)){const e=t.anchor.getNode().getPreviousSibling();return a(e)&&e.isTextEntity()}return!1}))}(b,l.leadOffset)){const n=function(t,e,n){const o=n.getSelection();if(null===o||!o.isCollapsed)return!1;const r=o.anchorNode,l=t,i=o.anchorOffset;if(null==r||null==i)return!1;try{e.setStart(r,l),e.setEnd(r,i)}catch(t){return!1}return!0}(l.leadOffset,e,t);if(null!==n)return i=()=>I({getRect:()=>e.getBoundingClientRect(),match:l}),void(d.startTransition?d.startTransition(i):i())}var i;O()}))}));return()=>{t()}}),[b,m,n,v,O,I]),null===v||null===b?null:d.createElement(R,{close:O,resolution:v,editor:b,anchorElementRef:S,options:e,menuRenderFn:i,shouldSplitNodeWithQuery:!0,onSelectOption:o,commandPriority:y})}export{N as LexicalTypeaheadMenuPlugin,b as MenuOption,O as PUNCTUATION,T as SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,I as getScrollParent,A as useBasicTypeaheadTriggerMatch,x as useDynamicPositioning};
7
+ import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{createCommand as e,KEY_ARROW_DOWN_COMMAND as n,KEY_ARROW_UP_COMMAND as o,KEY_ESCAPE_COMMAND as r,KEY_TAB_COMMAND as l,KEY_ENTER_COMMAND as i,COMMAND_PRIORITY_LOW as u,$getSelection as s,$isRangeSelection as c,$isTextNode as a}from"lexical";import*as d from"react";import{useLayoutEffect as m,useEffect as f,useState as p,useCallback as g,useMemo as h,useRef as y}from"react";import{mergeRegister as w}from"@lexical/utils";var C="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?m:f;class b{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}}const v=t=>{const e=document.getElementById("typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function E(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return n.top>o.top&&n.top<o.bottom}function x(e,n,o,r){const[l]=t();f((()=>{if(null!=n&&null!=e){const t=l.getRootElement(),e=null!=t?function(t,e){let n=getComputedStyle(t);const o="absolute"===n.position,r=e?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===n.position)return document.body;for(let e=t;e=e.parentElement;)if(n=getComputedStyle(e),(!o||"static"!==n.position)&&r.test(n.overflow+n.overflowY+n.overflowX))return e;return document.body}(t,!1):document.body;let i=!1,u=E(n,e);const s=function(){i||(window.requestAnimationFrame((function(){o(),i=!1})),i=!0);const t=E(n,e);t!==u&&(u=t,null!=r&&r(t))},c=new ResizeObserver(o);return window.addEventListener("resize",o),document.addEventListener("scroll",s,{capture:!0,passive:!0}),c.observe(n),()=>{c.unobserve(n),window.removeEventListener("resize",o),document.removeEventListener("scroll",s,!0)}}}),[n,l,r,o,e])}const S=e("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function R({close:t,editor:e,anchorElementRef:a,resolution:d,options:m,menuRenderFn:y,onSelectOption:b,shouldSplitNodeWithQuery:E=!1,commandPriority:x=u}){const[R,O]=p(null),I=d.match&&d.match.matchingString;f((()=>{O(0)}),[I]);const T=g((n=>{e.update((()=>{const e=null!=d.match&&E?function(t){const e=s();if(!c(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const o=n.getNode();if(!o.isSimpleText())return null;const r=n.offset,l=o.getTextContent().slice(0,r),i=t.replaceableString.length,u=r-function(t,e,n){let o=n;for(let n=o;n<=e.length;n++)t.substr(-n)===e.substr(0,n)&&(o=n);return o}(l,t.matchingString,i);if(u<0)return null;let a;return 0===u?[a]=o.splitText(r):[,a]=o.splitText(u,r),a}(d.match):null;b(n,e,t,d.match?d.match.matchingString:"")}))}),[e,E,d.match,b,t]),A=g((t=>{const n=e.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+t),O(t))}),[e]);f((()=>()=>{const t=e.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")}),[e]),C((()=>{null===m?O(null):null===R&&A(0)}),[m,R,A]),f((()=>w(e.registerCommand(S,(({option:t})=>!(!t.ref||null==t.ref.current)&&(v(t.ref.current),!0)),x))),[e,A,x]),f((()=>w(e.registerCommand(n,(t=>{const n=t;if(null!==m&&m.length&&null!==R){const t=R!==m.length-1?R+1:0;A(t);const o=m[t];null!=o.ref&&o.ref.current&&e.dispatchCommand(S,{index:t,option:o}),n.preventDefault(),n.stopImmediatePropagation()}return!0}),x),e.registerCommand(o,(t=>{const e=t;if(null!==m&&m.length&&null!==R){const t=0!==R?R-1:m.length-1;A(t);const n=m[t];null!=n.ref&&n.ref.current&&v(n.ref.current),e.preventDefault(),e.stopImmediatePropagation()}return!0}),x),e.registerCommand(r,(e=>{const n=e;return n.preventDefault(),n.stopImmediatePropagation(),t(),!0}),x),e.registerCommand(l,(t=>{const e=t;return null!==m&&null!==R&&null!=m[R]&&(e.preventDefault(),e.stopImmediatePropagation(),T(m[R]),!0)}),x),e.registerCommand(i,(t=>null!==m&&null!==R&&null!=m[R]&&(null!==t&&(t.preventDefault(),t.stopImmediatePropagation()),T(m[R]),!0)),x))),[T,t,e,m,R,A,x]);return y(a,h((()=>({options:m,selectOptionAndCleanUp:T,selectedIndex:R,setHighlightedIndex:O})),[T,R,m]),d.match?d.match.matchingString:"")}const O="\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;";function I(t,e){let n=getComputedStyle(t);const o="absolute"===n.position,r=e?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===n.position)return document.body;for(let e=t;e=e.parentElement;)if(n=getComputedStyle(e),(!o||"static"!==n.position)&&r.test(n.overflow+n.overflowY+n.overflowX))return e;return document.body}const T=e("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function A(t,{minLength:e=1,maxLength:n=75}){return g((o=>{const r=new RegExp("(^|\\s|\\()(["+t+"]((?:"+("[^"+t+O+"\\s]")+"){0,"+n+"}))$").exec(o);if(null!==r){const t=r[1],n=r[3];if(n.length>=e)return{leadOffset:r.index+t.length,matchingString:n,replaceableString:r[2]}}return null}),[n,e,t])}function N({options:e,onQueryChange:n,onSelectOption:o,onOpen:r,onClose:l,menuRenderFn:i,triggerFn:m,anchorClassName:h,commandPriority:w=u,parent:C}){const[b]=t(),[v,E]=p(null),S=function(e,n,o,r=document.body){const[l]=t(),i=y(document.createElement("div")),u=g((()=>{i.current.style.top=i.current.style.bottom;const t=l.getRootElement(),n=i.current,u=n.firstChild;if(null!==t&&null!==e){const{left:l,top:s,width:c,height:a}=e.getRect(),d=i.current.offsetHeight;if(n.style.top=`${s+d+3}px`,n.style.left=`${l+window.pageXOffset}px`,n.style.height=`${a}px`,n.style.width=`${c}px`,null!==u){u.style.top=`${s}`;const e=u.getBoundingClientRect(),o=e.height,r=e.width,i=t.getBoundingClientRect();l+r>i.right&&(n.style.left=`${i.right-r+window.pageXOffset}px`),(s+o>window.innerHeight||s+o>i.bottom)&&s-i.top>o&&(n.style.top=s-o+window.pageYOffset-a+"px")}n.isConnected||(null!=o&&(n.className=o),n.setAttribute("aria-label","Typeahead menu"),n.setAttribute("id","typeahead-menu"),n.setAttribute("role","listbox"),n.style.display="block",n.style.position="absolute",r.append(n)),i.current=n,t.setAttribute("aria-controls","typeahead-menu")}}),[l,e,o,r]);f((()=>{const t=l.getRootElement();if(null!==e)return u(),()=>{null!==t&&t.removeAttribute("aria-controls");const e=i.current;null!==e&&e.isConnected&&e.remove()}}),[l,u,e]);const s=g((t=>{null!==e&&(t||n(null))}),[e,n]);return x(e,i.current,u,s),i}(v,E,h,C),O=g((()=>{E(null),null!=l&&null!==v&&l()}),[l,v]),I=g((t=>{E(t),null!=r&&null===v&&r(t)}),[r,v]);return f((()=>{const t=b.registerUpdateListener((()=>{b.getEditorState().read((()=>{const t=b._window||window,e=t.document.createRange(),o=s(),r=function(t){let e=null;return t.getEditorState().read((()=>{const t=s();c(t)&&(e=function(t){const e=t.anchor;if("text"!==e.type)return null;const n=e.getNode();if(!n.isSimpleText())return null;const o=e.offset;return n.getTextContent().slice(0,o)}(t))})),e}(b);if(!c(o)||!o.isCollapsed()||null===r||null===e)return void O();const l=m(r,b);if(n(l?l.matchingString:null),null!==l&&!function(t,e){return 0===e&&t.getEditorState().read((()=>{const t=s();if(c(t)){const e=t.anchor.getNode().getPreviousSibling();return a(e)&&e.isTextEntity()}return!1}))}(b,l.leadOffset)){const n=function(t,e,n){const o=n.getSelection();if(null===o||!o.isCollapsed)return!1;const r=o.anchorNode,l=t,i=o.anchorOffset;if(null==r||null==i)return!1;try{e.setStart(r,l),e.setEnd(r,i)}catch(t){return!1}return!0}(l.leadOffset,e,t);if(null!==n)return i=()=>I({getRect:()=>e.getBoundingClientRect(),match:l}),void(d.startTransition?d.startTransition(i):i())}var i;O()}))}));return()=>{t()}}),[b,m,n,v,O,I]),null===v||null===b?null:d.createElement(R,{close:O,resolution:v,editor:b,anchorElementRef:S,options:e,menuRenderFn:i,shouldSplitNodeWithQuery:!0,onSelectOption:o,commandPriority:w})}export{N as LexicalTypeaheadMenuPlugin,b as MenuOption,O as PUNCTUATION,T as SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,I as getScrollParent,A as useBasicTypeaheadTriggerMatch,x as useDynamicPositioning};