@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
@@ -6,7 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { createContext, useMemo, useContext } from 'react';
9
+ import { newContext, CollaborationContext } from '@lexical/react/LexicalCollaborationContextUtils';
10
+ export { CollaborationContext, useCollaborationContext } from '@lexical/react/LexicalCollaborationContextUtils';
11
+ import { useMemo } from 'react';
10
12
  import { jsx } from 'react/jsx-runtime';
11
13
 
12
14
  /**
@@ -17,33 +19,6 @@ import { jsx } from 'react/jsx-runtime';
17
19
  *
18
20
  */
19
21
 
20
- // Do not require this module directly! Use normal `invariant` calls.
21
-
22
- function formatDevErrorMessage(message) {
23
- throw new Error(message);
24
- }
25
-
26
- const entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];
27
- const randomEntry = entries[Math.floor(Math.random() * entries.length)];
28
-
29
- /**
30
- * The React context that holds the shared {@link CollaborationContextType} for
31
- * collaborative editors. Provide it with {@link LexicalCollaboration} and read
32
- * it with {@link useCollaborationContext}.
33
- */
34
- const CollaborationContext = /*#__PURE__*/createContext(null);
35
- function newContext() {
36
- return {
37
- color: randomEntry[1],
38
- isCollabActive: false,
39
- name: randomEntry[0],
40
- yjsDocMap: new Map()
41
- };
42
- }
43
-
44
- // This is here to help the transition post-#7818, however should be removed in a future release as
45
- // a shared context across editors is likely to lead to bugs.
46
- const UNSAFE_GLOBAL_CONTEXT = newContext();
47
22
 
48
23
  /**
49
24
  * A provider component that creates a fresh {@link CollaborationContextType}
@@ -63,28 +38,4 @@ function LexicalCollaboration({
63
38
  });
64
39
  }
65
40
 
66
- /**
67
- * Reads the current {@link CollaborationContextType} from the nearest
68
- * {@link LexicalCollaboration} provider. Optionally pass `username` and `color`
69
- * to set the local user's display name and cursor color.
70
- *
71
- * @returns The active collaboration context.
72
- */
73
- function useCollaborationContext(username, color) {
74
- let collabContext = useContext(CollaborationContext);
75
- if (!(collabContext != null)) {
76
- formatDevErrorMessage(`useCollaborationContext: no context provider found`);
77
- }
78
- collabContext = collabContext ?? UNSAFE_GLOBAL_CONTEXT;
79
- if (username != null) {
80
- // eslint-disable-next-line react-hooks/immutability
81
- collabContext.name = username;
82
- }
83
- if (color != null) {
84
- // eslint-disable-next-line react-hooks/immutability
85
- collabContext.color = color;
86
- }
87
- return collabContext;
88
- }
89
-
90
- export { CollaborationContext, LexicalCollaboration, useCollaborationContext };
41
+ export { LexicalCollaboration };
@@ -6,5 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var r=require("react"),e=require("react/jsx-runtime");const o=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],n=o[Math.floor(Math.random()*o.length)],t=/*#__PURE__*/r.createContext(null);function l(){return{color:n[1],isCollabActive:!1,name:n[0],yjsDocMap:new Map}}const a=l();exports.CollaborationContext=t,exports.LexicalCollaboration=function({children:o}){const n=r.useMemo(()=>l(),[]);
10
- return e.jsx(t.Provider,{value:n,children:o})},exports.useCollaborationContext=function(e,o){let n=r.useContext(t);return null==n&&function(r,...e){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",r);for(const r of e)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),n=n??a,null!=e&&(n.name=e),null!=o&&(n.color=o),n};
9
+ "use strict";var o=require("@lexical/react/LexicalCollaborationContextUtils"),e=require("react"),t=require("react/jsx-runtime");exports.CollaborationContext=o.CollaborationContext,exports.useCollaborationContext=o.useCollaborationContext,exports.LexicalCollaboration=function({children:r}){const a=e.useMemo(()=>o.newContext(),[]);
10
+ return t.jsx(o.CollaborationContext.Provider,{value:a,children:r})};
@@ -6,5 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{createContext as r,useMemo as n,useContext as e}from"react";import{jsx as o}from"react/jsx-runtime";const t=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],i=t[Math.floor(Math.random()*t.length)],l=/*#__PURE__*/r(null);function a(){return{color:i[1],isCollabActive:!1,name:i[0],yjsDocMap:new Map}}const g=a();function c({children:r}){const e=n(()=>a(),[]);
10
- return o(l.Provider,{value:e,children:r})}function b(r,n){let o=e(l);return null==o&&function(r,...n){const e=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of n)o.append("v",r);e.search=o.toString(),console.warn(`Minified Lexical warning #${r}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),o=o??g,null!=r&&(o.name=r),null!=n&&(o.color=n),o}export{l as CollaborationContext,c as LexicalCollaboration,b as useCollaborationContext};
9
+ import{newContext as o,CollaborationContext as t}from"@lexical/react/LexicalCollaborationContextUtils";export{CollaborationContext,useCollaborationContext}from"@lexical/react/LexicalCollaborationContextUtils";import{useMemo as r}from"react";import{jsx as e}from"react/jsx-runtime";function l({children:l}){const i=r(()=>o(),[]);
10
+ return e(t.Provider,{value:i,children:l})}export{l as LexicalCollaboration};
@@ -0,0 +1,35 @@
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
+ */
8
+ import type { Doc } from 'yjs';
9
+ /**
10
+ * The value stored in the {@link CollaborationContext}: the local user's
11
+ * display `name` and cursor `color`, whether collaboration is currently active,
12
+ * and the map of Yjs documents shared by the editors under this provider.
13
+ */
14
+ export type CollaborationContextType = {
15
+ color: string;
16
+ isCollabActive: boolean;
17
+ name: string;
18
+ yjsDocMap: Map<string, Doc>;
19
+ };
20
+ /**
21
+ * The React context that holds the shared {@link CollaborationContextType} for
22
+ * collaborative editors. Provide it with {@link LexicalCollaboration} and read
23
+ * it with {@link useCollaborationContext}.
24
+ */
25
+ export declare const CollaborationContext: import("react").Context<CollaborationContextType | null>;
26
+ /** @internal */
27
+ export declare function newContext(): CollaborationContextType;
28
+ /**
29
+ * Reads the current {@link CollaborationContextType} from the nearest
30
+ * {@link LexicalCollaboration} provider. Optionally pass `username` and `color`
31
+ * to set the local user's display name and cursor color.
32
+ *
33
+ * @returns The active collaboration context.
34
+ */
35
+ export declare function useCollaborationContext(username?: string, color?: string): CollaborationContextType;
@@ -0,0 +1,83 @@
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
+ */
8
+
9
+ 'use strict';
10
+
11
+ var react = require('react');
12
+
13
+ /**
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ *
19
+ */
20
+
21
+ // Do not require this module directly! Use normal `invariant` calls.
22
+
23
+ function formatDevErrorMessage(message) {
24
+ throw new Error(message);
25
+ }
26
+
27
+ /**
28
+ * The value stored in the {@link CollaborationContext}: the local user's
29
+ * display `name` and cursor `color`, whether collaboration is currently active,
30
+ * and the map of Yjs documents shared by the editors under this provider.
31
+ */
32
+
33
+ const entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];
34
+ const randomEntry = entries[Math.floor(Math.random() * entries.length)];
35
+
36
+ /**
37
+ * The React context that holds the shared {@link CollaborationContextType} for
38
+ * collaborative editors. Provide it with {@link LexicalCollaboration} and read
39
+ * it with {@link useCollaborationContext}.
40
+ */
41
+ const CollaborationContext = react.createContext(null);
42
+
43
+ /** @internal */
44
+ function newContext() {
45
+ return {
46
+ color: randomEntry[1],
47
+ isCollabActive: false,
48
+ name: randomEntry[0],
49
+ yjsDocMap: new Map()
50
+ };
51
+ }
52
+
53
+ // This is here to help the transition post-#7818, however should be removed in a future release as
54
+ // a shared context across editors is likely to lead to bugs.
55
+ const UNSAFE_GLOBAL_CONTEXT = newContext();
56
+
57
+ /**
58
+ * Reads the current {@link CollaborationContextType} from the nearest
59
+ * {@link LexicalCollaboration} provider. Optionally pass `username` and `color`
60
+ * to set the local user's display name and cursor color.
61
+ *
62
+ * @returns The active collaboration context.
63
+ */
64
+ function useCollaborationContext(username, color) {
65
+ let collabContext = react.useContext(CollaborationContext);
66
+ if (!(collabContext != null)) {
67
+ formatDevErrorMessage(`useCollaborationContext: no context provider found`);
68
+ }
69
+ collabContext = collabContext ?? UNSAFE_GLOBAL_CONTEXT;
70
+ if (username != null) {
71
+ // eslint-disable-next-line react-hooks/immutability
72
+ collabContext.name = username;
73
+ }
74
+ if (color != null) {
75
+ // eslint-disable-next-line react-hooks/immutability
76
+ collabContext.color = color;
77
+ }
78
+ return collabContext;
79
+ }
80
+
81
+ exports.CollaborationContext = CollaborationContext;
82
+ exports.newContext = newContext;
83
+ exports.useCollaborationContext = useCollaborationContext;
@@ -0,0 +1,79 @@
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
+ */
8
+
9
+ import { createContext, useContext } from 'react';
10
+
11
+ /**
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ *
17
+ */
18
+
19
+ // Do not require this module directly! Use normal `invariant` calls.
20
+
21
+ function formatDevErrorMessage(message) {
22
+ throw new Error(message);
23
+ }
24
+
25
+ /**
26
+ * The value stored in the {@link CollaborationContext}: the local user's
27
+ * display `name` and cursor `color`, whether collaboration is currently active,
28
+ * and the map of Yjs documents shared by the editors under this provider.
29
+ */
30
+
31
+ const entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];
32
+ const randomEntry = entries[Math.floor(Math.random() * entries.length)];
33
+
34
+ /**
35
+ * The React context that holds the shared {@link CollaborationContextType} for
36
+ * collaborative editors. Provide it with {@link LexicalCollaboration} and read
37
+ * it with {@link useCollaborationContext}.
38
+ */
39
+ const CollaborationContext = createContext(null);
40
+
41
+ /** @internal */
42
+ function newContext() {
43
+ return {
44
+ color: randomEntry[1],
45
+ isCollabActive: false,
46
+ name: randomEntry[0],
47
+ yjsDocMap: new Map()
48
+ };
49
+ }
50
+
51
+ // This is here to help the transition post-#7818, however should be removed in a future release as
52
+ // a shared context across editors is likely to lead to bugs.
53
+ const UNSAFE_GLOBAL_CONTEXT = newContext();
54
+
55
+ /**
56
+ * Reads the current {@link CollaborationContextType} from the nearest
57
+ * {@link LexicalCollaboration} provider. Optionally pass `username` and `color`
58
+ * to set the local user's display name and cursor color.
59
+ *
60
+ * @returns The active collaboration context.
61
+ */
62
+ function useCollaborationContext(username, color) {
63
+ let collabContext = useContext(CollaborationContext);
64
+ if (!(collabContext != null)) {
65
+ formatDevErrorMessage(`useCollaborationContext: no context provider found`);
66
+ }
67
+ collabContext = collabContext ?? UNSAFE_GLOBAL_CONTEXT;
68
+ if (username != null) {
69
+ // eslint-disable-next-line react-hooks/immutability
70
+ collabContext.name = username;
71
+ }
72
+ if (color != null) {
73
+ // eslint-disable-next-line react-hooks/immutability
74
+ collabContext.color = color;
75
+ }
76
+ return collabContext;
77
+ }
78
+
79
+ export { CollaborationContext, newContext, useCollaborationContext };
@@ -0,0 +1,11 @@
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
+ */
8
+
9
+ 'use strict'
10
+ const LexicalCollaborationContextUtils = process.env.NODE_ENV !== 'production' ? require('./LexicalCollaborationContextUtils.dev.js') : require('./LexicalCollaborationContextUtils.prod.js');
11
+ module.exports = LexicalCollaborationContextUtils;
@@ -0,0 +1,25 @@
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
+ * @flow strict
8
+ */
9
+
10
+ import type {Doc} from 'yjs';
11
+ import type {Context} from 'react';
12
+
13
+ export type CollaborationContextType = {
14
+ color: string,
15
+ isCollabActive: boolean,
16
+ name: string,
17
+ yjsDocMap: Map<string, Doc>,
18
+ };
19
+
20
+ declare export var CollaborationContext: Context<CollaborationContextType | null>;
21
+ declare export function newContext(): CollaborationContextType;
22
+ declare export hook useCollaborationContext(
23
+ username?: string,
24
+ color?: string,
25
+ ): CollaborationContextType;
@@ -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
+ */
8
+
9
+ import * as modDev from './LexicalCollaborationContextUtils.dev.mjs';
10
+ import * as modProd from './LexicalCollaborationContextUtils.prod.mjs';
11
+ const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
12
+ export const CollaborationContext = mod.CollaborationContext;
13
+ export const newContext = mod.newContext;
14
+ export const useCollaborationContext = mod.useCollaborationContext;
@@ -0,0 +1,12 @@
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
+ */
8
+
9
+ const mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalCollaborationContextUtils.dev.mjs') : import('./LexicalCollaborationContextUtils.prod.mjs'));
10
+ export const CollaborationContext = mod.CollaborationContext;
11
+ export const newContext = mod.newContext;
12
+ export const useCollaborationContext = mod.useCollaborationContext;
@@ -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
+ */
8
+
9
+ "use strict";var r=require("react");const e=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],o=e[Math.floor(Math.random()*e.length)],n=r.createContext(null);function t(){return{color:o[1],isCollabActive:!1,name:o[0],yjsDocMap:new Map}}const a=t();exports.CollaborationContext=n,exports.newContext=t,exports.useCollaborationContext=function(e,o){let t=r.useContext(n);return null==t&&function(r,...e){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",r);for(const r of e)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),t=t??a,null!=e&&(t.name=e),null!=o&&(t.color=o),t};
@@ -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
+ */
8
+
9
+ import{createContext as r,useContext as n}from"react";const e=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],o=e[Math.floor(Math.random()*e.length)],l=r(null);function t(){return{color:o[1],isCollabActive:!1,name:o[0],yjsDocMap:new Map}}const a=t();function g(r,e){let o=n(l);return null==o&&function(r,...n){const e=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of n)o.append("v",r);e.search=o.toString(),console.warn(`Minified Lexical warning #${r}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),o=o??a,null!=r&&(o.name=r),null!=e&&(o.color=e),o}export{l as CollaborationContext,t as newContext,g as useCollaborationContext};
@@ -0,0 +1,29 @@
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
+ */
8
+ import type { JSX, RefObject } from 'react';
9
+ /**
10
+ * The base class for an item shown in a {@link LexicalTypeaheadMenuPlugin} or
11
+ * {@link LexicalNodeMenuPlugin} menu. Each option has a unique `key` and a `ref`
12
+ * to its rendered element (used for scrolling and keyboard navigation).
13
+ * Subclass it to attach your own data such as a label or callback.
14
+ *
15
+ * Its own module, and not `shared/LexicalMenu`, because that module is not an
16
+ * entry point: it is inlined into every entry that reaches it, which would give
17
+ * each of them a different `MenuOption` class. Its own module rather than one
18
+ * of the plugin entry points, because those export React components — anything
19
+ * importing this from one of them sits behind that component's Fast Refresh
20
+ * boundary and is invalidated whenever the component changes.
21
+ */
22
+ export declare class MenuOption {
23
+ key: string;
24
+ ref?: RefObject<HTMLElement | null>;
25
+ icon?: JSX.Element;
26
+ title?: JSX.Element | string;
27
+ constructor(key: string);
28
+ setRefElement(element: HTMLElement | null): void;
29
+ }
@@ -0,0 +1,51 @@
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
+ */
8
+
9
+ 'use strict';
10
+
11
+ /**
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ *
17
+ */
18
+
19
+ /**
20
+ * The base class for an item shown in a {@link LexicalTypeaheadMenuPlugin} or
21
+ * {@link LexicalNodeMenuPlugin} menu. Each option has a unique `key` and a `ref`
22
+ * to its rendered element (used for scrolling and keyboard navigation).
23
+ * Subclass it to attach your own data such as a label or callback.
24
+ *
25
+ * Its own module, and not `shared/LexicalMenu`, because that module is not an
26
+ * entry point: it is inlined into every entry that reaches it, which would give
27
+ * each of them a different `MenuOption` class. Its own module rather than one
28
+ * of the plugin entry points, because those export React components — anything
29
+ * importing this from one of them sits behind that component's Fast Refresh
30
+ * boundary and is invalidated whenever the component changes.
31
+ */
32
+ class MenuOption {
33
+ key;
34
+ ref;
35
+ icon;
36
+ title;
37
+ constructor(key) {
38
+ this.key = key;
39
+ this.ref = {
40
+ current: null
41
+ };
42
+ this.setRefElement = this.setRefElement.bind(this);
43
+ }
44
+ setRefElement(element) {
45
+ this.ref = {
46
+ current: element
47
+ };
48
+ }
49
+ }
50
+
51
+ exports.MenuOption = MenuOption;
@@ -0,0 +1,49 @@
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
+ */
8
+
9
+ /**
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *
15
+ */
16
+
17
+ /**
18
+ * The base class for an item shown in a {@link LexicalTypeaheadMenuPlugin} or
19
+ * {@link LexicalNodeMenuPlugin} menu. Each option has a unique `key` and a `ref`
20
+ * to its rendered element (used for scrolling and keyboard navigation).
21
+ * Subclass it to attach your own data such as a label or callback.
22
+ *
23
+ * Its own module, and not `shared/LexicalMenu`, because that module is not an
24
+ * entry point: it is inlined into every entry that reaches it, which would give
25
+ * each of them a different `MenuOption` class. Its own module rather than one
26
+ * of the plugin entry points, because those export React components — anything
27
+ * importing this from one of them sits behind that component's Fast Refresh
28
+ * boundary and is invalidated whenever the component changes.
29
+ */
30
+ class MenuOption {
31
+ key;
32
+ ref;
33
+ icon;
34
+ title;
35
+ constructor(key) {
36
+ this.key = key;
37
+ this.ref = {
38
+ current: null
39
+ };
40
+ this.setRefElement = this.setRefElement.bind(this);
41
+ }
42
+ setRefElement(element) {
43
+ this.ref = {
44
+ current: element
45
+ };
46
+ }
47
+ }
48
+
49
+ export { MenuOption };
@@ -0,0 +1,11 @@
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
+ */
8
+
9
+ 'use strict'
10
+ const LexicalMenuOption = process.env.NODE_ENV !== 'production' ? require('./LexicalMenuOption.dev.js') : require('./LexicalMenuOption.prod.js');
11
+ module.exports = LexicalMenuOption;
@@ -0,0 +1,20 @@
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
+ * @flow strict
8
+ */
9
+
10
+ import type {RefObject} from 'react';
11
+ import * as React from 'react';
12
+
13
+ declare export class MenuOption {
14
+ key: string;
15
+ ref?: RefObject<HTMLElement | null>;
16
+ icon?: React.MixedElement;
17
+ title?: React.MixedElement | string;
18
+ constructor(key: string): void;
19
+ setRefElement(element: HTMLElement | null): void;
20
+ }
@@ -0,0 +1,12 @@
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
+ */
8
+
9
+ import * as modDev from './LexicalMenuOption.dev.mjs';
10
+ import * as modProd from './LexicalMenuOption.prod.mjs';
11
+ const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
12
+ export const MenuOption = mod.MenuOption;
@@ -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
+ */
8
+
9
+ const mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalMenuOption.dev.mjs') : import('./LexicalMenuOption.prod.mjs'));
10
+ export const MenuOption = mod.MenuOption;
@@ -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
+ */
8
+
9
+ "use strict";exports.MenuOption=class{key;ref;icon;title;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}};
@@ -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
+ */
8
+
9
+ class e{key;ref;icon;title;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}}export{e as MenuOption};