@lexical/react 0.49.1-nightly.20260901.0 → 0.50.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 (65) hide show
  1. package/dist/LexicalAutoEmbedPlugin.d.ts +4 -47
  2. package/dist/LexicalAutoEmbedPlugin.dev.js +5 -31
  3. package/dist/LexicalAutoEmbedPlugin.dev.mjs +5 -30
  4. package/dist/LexicalAutoEmbedPlugin.prod.js +1 -1
  5. package/dist/LexicalAutoEmbedPlugin.prod.mjs +1 -1
  6. package/dist/LexicalAutoEmbedPluginUtils.d.ts +53 -0
  7. package/dist/LexicalAutoEmbedPluginUtils.dev.js +66 -0
  8. package/dist/LexicalAutoEmbedPluginUtils.dev.mjs +62 -0
  9. package/dist/LexicalAutoEmbedPluginUtils.js +11 -0
  10. package/dist/LexicalAutoEmbedPluginUtils.js.flow +40 -0
  11. package/dist/LexicalAutoEmbedPluginUtils.mjs +14 -0
  12. package/dist/LexicalAutoEmbedPluginUtils.node.mjs +12 -0
  13. package/dist/LexicalAutoEmbedPluginUtils.prod.js +9 -0
  14. package/dist/LexicalAutoEmbedPluginUtils.prod.mjs +9 -0
  15. package/dist/LexicalCollaborationContext.d.ts +1 -26
  16. package/dist/LexicalCollaborationContext.dev.js +5 -55
  17. package/dist/LexicalCollaborationContext.dev.mjs +4 -53
  18. package/dist/LexicalCollaborationContext.prod.js +2 -2
  19. package/dist/LexicalCollaborationContext.prod.mjs +2 -2
  20. package/dist/LexicalCollaborationContextUtils.d.ts +35 -0
  21. package/dist/LexicalCollaborationContextUtils.dev.js +83 -0
  22. package/dist/LexicalCollaborationContextUtils.dev.mjs +79 -0
  23. package/dist/LexicalCollaborationContextUtils.js +11 -0
  24. package/dist/LexicalCollaborationContextUtils.js.flow +25 -0
  25. package/dist/LexicalCollaborationContextUtils.mjs +14 -0
  26. package/dist/LexicalCollaborationContextUtils.node.mjs +12 -0
  27. package/dist/LexicalCollaborationContextUtils.prod.js +9 -0
  28. package/dist/LexicalCollaborationContextUtils.prod.mjs +9 -0
  29. package/dist/LexicalMenuOption.d.ts +29 -0
  30. package/dist/LexicalMenuOption.dev.js +51 -0
  31. package/dist/LexicalMenuOption.dev.mjs +49 -0
  32. package/dist/LexicalMenuOption.js +11 -0
  33. package/dist/LexicalMenuOption.js.flow +20 -0
  34. package/dist/LexicalMenuOption.mjs +12 -0
  35. package/dist/LexicalMenuOption.node.mjs +10 -0
  36. package/dist/LexicalMenuOption.prod.js +9 -0
  37. package/dist/LexicalMenuOption.prod.mjs +9 -0
  38. package/dist/LexicalNodeMenuPlugin.dev.js +5 -28
  39. package/dist/LexicalNodeMenuPlugin.dev.mjs +4 -27
  40. package/dist/LexicalNodeMenuPlugin.prod.js +1 -1
  41. package/dist/LexicalNodeMenuPlugin.prod.mjs +1 -1
  42. package/dist/LexicalTypeaheadMenuPlugin.d.ts +2 -34
  43. package/dist/LexicalTypeaheadMenuPlugin.dev.js +10 -78
  44. package/dist/LexicalTypeaheadMenuPlugin.dev.mjs +9 -76
  45. package/dist/LexicalTypeaheadMenuPlugin.prod.js +1 -1
  46. package/dist/LexicalTypeaheadMenuPlugin.prod.mjs +1 -1
  47. package/dist/LexicalTypeaheadMenuPluginUtils.d.ts +44 -0
  48. package/dist/LexicalTypeaheadMenuPluginUtils.dev.js +81 -0
  49. package/dist/LexicalTypeaheadMenuPluginUtils.dev.mjs +76 -0
  50. package/dist/LexicalTypeaheadMenuPluginUtils.js +11 -0
  51. package/dist/LexicalTypeaheadMenuPluginUtils.js.flow +34 -0
  52. package/dist/LexicalTypeaheadMenuPluginUtils.mjs +15 -0
  53. package/dist/LexicalTypeaheadMenuPluginUtils.node.mjs +13 -0
  54. package/dist/LexicalTypeaheadMenuPluginUtils.prod.js +9 -0
  55. package/dist/LexicalTypeaheadMenuPluginUtils.prod.mjs +9 -0
  56. package/dist/shared/LexicalMenu.d.ts +5 -19
  57. package/package.json +164 -20
  58. package/src/LexicalAutoEmbedPlugin.tsx +12 -70
  59. package/src/LexicalAutoEmbedPluginUtils.ts +80 -0
  60. package/src/LexicalCollaborationContext.tsx +11 -90
  61. package/src/LexicalCollaborationContextUtils.ts +99 -0
  62. package/src/LexicalMenuOption.ts +39 -0
  63. package/src/LexicalTypeaheadMenuPlugin.tsx +6 -80
  64. package/src/LexicalTypeaheadMenuPluginUtils.ts +93 -0
  65. package/src/shared/LexicalMenu.tsx +12 -28
@@ -7,6 +7,8 @@
7
7
  */
8
8
 
9
9
  import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
10
+ import {MenuOption} from '@lexical/react/LexicalMenuOption';
11
+ import {SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND} from '@lexical/react/LexicalTypeaheadMenuPluginUtils';
10
12
  import {getScrollParent} from '@lexical/utils';
11
13
  import {
12
14
  $getSelection,
@@ -14,7 +16,6 @@ import {
14
16
  CAN_USE_DOM,
15
17
  COMMAND_PRIORITY_LOW,
16
18
  type CommandListenerPriority,
17
- createCommand,
18
19
  getDOMShadowRoots,
19
20
  getParentElement,
20
21
  getRootOwnerDocument,
@@ -25,7 +26,6 @@ import {
25
26
  KEY_ENTER_COMMAND,
26
27
  KEY_ESCAPE_COMMAND,
27
28
  KEY_TAB_COMMAND,
28
- type LexicalCommand,
29
29
  type LexicalEditor,
30
30
  mergeRegister,
31
31
  registerEventListener,
@@ -67,28 +67,10 @@ export type MenuResolution = {
67
67
  getRect: () => DOMRect;
68
68
  };
69
69
 
70
- /**
71
- * The base class for an item shown in a {@link LexicalTypeaheadMenuPlugin} or
72
- * {@link LexicalNodeMenuPlugin} menu. Each option has a unique `key` and a `ref`
73
- * to its rendered element (used for scrolling and keyboard navigation).
74
- * Subclass it to attach your own data such as a label or callback.
75
- */
76
- export class MenuOption {
77
- key: string;
78
- ref?: RefObject<HTMLElement | null>;
79
- icon?: JSX.Element;
80
- title?: JSX.Element | string;
81
-
82
- constructor(key: string) {
83
- this.key = key;
84
- this.ref = {current: null};
85
- this.setRefElement = this.setRefElement.bind(this);
86
- }
87
-
88
- setRefElement(element: HTMLElement | null) {
89
- this.ref = {current: element};
90
- }
91
- }
70
+ // Defined in its own entry point rather than here, for the same reason as the
71
+ // command above: this module is inlined into every entry that reaches it, so a
72
+ // class defined here would be a different class in each of them.
73
+ export {MenuOption};
92
74
 
93
75
  /**
94
76
  * A render function for a menu's contents. It receives the anchor element ref,
@@ -283,10 +265,12 @@ export function useDynamicPositioning(
283
265
  }, [targetElement, editor, onVisibilityChange, onReposition, resolution]);
284
266
  }
285
267
 
286
- export const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{
287
- index: number;
288
- option: MenuOption;
289
- }> = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND');
268
+ // Imported through the package path rather than defined here: this module is
269
+ // not an entry point, so it is inlined into every entry that reaches it, and a
270
+ // command created here would be a different object in each of them — including
271
+ // a different one from the command this package exports, which is the one a
272
+ // consumer dispatches. Re-exported for anything that imports it from here.
273
+ export {SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND};
290
274
 
291
275
  function MenuItem({
292
276
  index,