@liveblocks/react-lexical 2.16.0-toolbars1 → 2.16.0-toolbars3

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.
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ import { ThreadProps, ComposerProps } from '@liveblocks/react-ui';
4
4
  import * as react from 'react';
5
5
  import { ComponentPropsWithoutRef, ComponentType, HTMLAttributes, ReactNode, ComponentProps } from 'react';
6
6
  import * as lexical from 'lexical';
7
- import { LexicalCommand, LexicalEditor, LexicalNode } from 'lexical';
7
+ import { LexicalCommand, LexicalEditor, LexicalNode, TextFormatType } from 'lexical';
8
8
  import { InitialConfigType } from '@lexical/react/LexicalComposer';
9
9
 
10
10
  type AnchoredThreadsComponents = {
@@ -77,6 +77,10 @@ interface FloatingThreadsProps<M extends BaseMetadata = DM> extends Omit<HTMLAtt
77
77
  }
78
78
  declare function FloatingThreads({ threads, components, ...props }: FloatingThreadsProps): react_jsx_runtime.JSX.Element | null;
79
79
 
80
+ declare function getSelectedBlockElement(editor: LexicalEditor): LexicalNode | null;
81
+
82
+ declare function isTextFormatActive(editor: LexicalEditor, format: TextFormatType): boolean;
83
+
80
84
  /**
81
85
  * Function that takes a Lexical editor config and modifies it to add the necessary
82
86
  * `nodes` and `theme` to make `LiveblocksPlugin` works correctly.
@@ -200,11 +204,12 @@ interface ToolbarToggleProps extends ToolbarButtonProps {
200
204
  }
201
205
  interface ToolbarBlockSelectorItem {
202
206
  name: string;
203
- isActive: (selectedBlockElement: LexicalNode | null, editor: LexicalEditor) => boolean;
207
+ icon?: ReactNode;
208
+ isActive: ((element: LexicalNode | null, editor: LexicalEditor) => boolean) | "default";
204
209
  setActive: (editor: LexicalEditor) => void;
205
210
  }
206
211
  interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
207
- items?: ToolbarBlockSelectorItem[];
212
+ items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
208
213
  }
209
214
  declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
210
215
  declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element | null;
@@ -226,7 +231,9 @@ interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
226
231
  before?: ToolbarSlot;
227
232
  after?: ToolbarSlot;
228
233
  }
229
- declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
234
+ declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
235
+ External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
236
+ };
230
237
 
231
238
  interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
232
239
  version: HistoryVersion;
@@ -240,4 +247,4 @@ interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
240
247
  */
241
248
  declare const HistoryVersionPreview: react.ForwardRefExoticComponent<HistoryVersionPreviewProps & react.RefAttributes<HTMLDivElement>>;
242
249
 
243
- export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, FloatingToolbar, FloatingToolbarProps, HistoryVersionPreview, HistoryVersionPreviewProps, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, Toolbar, ToolbarProps, liveblocksConfig, useEditorStatus, useIsEditorReady, useIsThreadActive };
250
+ export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, FloatingToolbar, FloatingToolbarProps, HistoryVersionPreview, HistoryVersionPreviewProps, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, Toolbar, ToolbarProps, getSelectedBlockElement, isTextFormatActive, liveblocksConfig, useEditorStatus, useIsEditorReady, useIsThreadActive };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { ThreadProps, ComposerProps } from '@liveblocks/react-ui';
4
4
  import * as react from 'react';
5
5
  import { ComponentPropsWithoutRef, ComponentType, HTMLAttributes, ReactNode, ComponentProps } from 'react';
6
6
  import * as lexical from 'lexical';
7
- import { LexicalCommand, LexicalEditor, LexicalNode } from 'lexical';
7
+ import { LexicalCommand, LexicalEditor, LexicalNode, TextFormatType } from 'lexical';
8
8
  import { InitialConfigType } from '@lexical/react/LexicalComposer';
9
9
 
10
10
  type AnchoredThreadsComponents = {
@@ -77,6 +77,10 @@ interface FloatingThreadsProps<M extends BaseMetadata = DM> extends Omit<HTMLAtt
77
77
  }
78
78
  declare function FloatingThreads({ threads, components, ...props }: FloatingThreadsProps): react_jsx_runtime.JSX.Element | null;
79
79
 
80
+ declare function getSelectedBlockElement(editor: LexicalEditor): LexicalNode | null;
81
+
82
+ declare function isTextFormatActive(editor: LexicalEditor, format: TextFormatType): boolean;
83
+
80
84
  /**
81
85
  * Function that takes a Lexical editor config and modifies it to add the necessary
82
86
  * `nodes` and `theme` to make `LiveblocksPlugin` works correctly.
@@ -200,11 +204,12 @@ interface ToolbarToggleProps extends ToolbarButtonProps {
200
204
  }
201
205
  interface ToolbarBlockSelectorItem {
202
206
  name: string;
203
- isActive: (selectedBlockElement: LexicalNode | null, editor: LexicalEditor) => boolean;
207
+ icon?: ReactNode;
208
+ isActive: ((element: LexicalNode | null, editor: LexicalEditor) => boolean) | "default";
204
209
  setActive: (editor: LexicalEditor) => void;
205
210
  }
206
211
  interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
207
- items?: ToolbarBlockSelectorItem[];
212
+ items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
208
213
  }
209
214
  declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
210
215
  declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element | null;
@@ -226,7 +231,9 @@ interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
226
231
  before?: ToolbarSlot;
227
232
  after?: ToolbarSlot;
228
233
  }
229
- declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
234
+ declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
235
+ External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
236
+ };
230
237
 
231
238
  interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
232
239
  version: HistoryVersion;
@@ -240,4 +247,4 @@ interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
240
247
  */
241
248
  declare const HistoryVersionPreview: react.ForwardRefExoticComponent<HistoryVersionPreviewProps & react.RefAttributes<HTMLDivElement>>;
242
249
 
243
- export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, FloatingToolbar, FloatingToolbarProps, HistoryVersionPreview, HistoryVersionPreviewProps, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, Toolbar, ToolbarProps, liveblocksConfig, useEditorStatus, useIsEditorReady, useIsThreadActive };
250
+ export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, FloatingToolbar, FloatingToolbarProps, HistoryVersionPreview, HistoryVersionPreviewProps, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, Toolbar, ToolbarProps, getSelectedBlockElement, isTextFormatActive, liveblocksConfig, useEditorStatus, useIsEditorReady, useIsThreadActive };
package/dist/index.js CHANGED
@@ -6,6 +6,8 @@ var anchoredThreads = require('./comments/anchored-threads.js');
6
6
  var commentPluginProvider = require('./comments/comment-plugin-provider.js');
7
7
  var floatingComposer = require('./comments/floating-composer.js');
8
8
  var floatingThreads = require('./comments/floating-threads.js');
9
+ var getSelectedBlockElement = require('./get-selected-block-element.js');
10
+ var isTextFormatActive = require('./is-text-format-active.js');
9
11
  var liveblocksConfig = require('./liveblocks-config.js');
10
12
  var liveblocksPluginProvider = require('./liveblocks-plugin-provider.js');
11
13
  var floatingToolbar = require('./toolbar/floating-toolbar.js');
@@ -19,6 +21,8 @@ exports.useIsThreadActive = commentPluginProvider.useIsThreadActive;
19
21
  exports.FloatingComposer = floatingComposer.FloatingComposer;
20
22
  exports.OPEN_FLOATING_COMPOSER_COMMAND = floatingComposer.OPEN_FLOATING_COMPOSER_COMMAND;
21
23
  exports.FloatingThreads = floatingThreads.FloatingThreads;
24
+ exports.getSelectedBlockElement = getSelectedBlockElement.getSelectedBlockElement;
25
+ exports.isTextFormatActive = isTextFormatActive.isTextFormatActive;
22
26
  exports.liveblocksConfig = liveblocksConfig.liveblocksConfig;
23
27
  exports.LiveblocksPlugin = liveblocksPluginProvider.LiveblocksPlugin;
24
28
  exports.useEditorStatus = liveblocksPluginProvider.useEditorStatus;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n useIsEditorReady,\n} from \"./liveblocks-plugin-provider\";\nexport type { FloatingToolbarProps } from \"./toolbar/floating-toolbar\";\nexport { FloatingToolbar } from \"./toolbar/floating-toolbar\";\nexport type { ToolbarProps } from \"./toolbar/toolbar\";\nexport { Toolbar } from \"./toolbar/toolbar\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/history-version-preview\";\nexport { HistoryVersionPreview } from \"./version-history/history-version-preview\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\nexport { getSelectedBlockElement } from \"./get-selected-block-element\";\nexport { isTextFormatActive } from \"./is-text-format-active\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n useIsEditorReady,\n} from \"./liveblocks-plugin-provider\";\nexport type { FloatingToolbarProps } from \"./toolbar/floating-toolbar\";\nexport { FloatingToolbar } from \"./toolbar/floating-toolbar\";\nexport type { ToolbarProps } from \"./toolbar/toolbar\";\nexport { Toolbar } from \"./toolbar/toolbar\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/history-version-preview\";\nexport { HistoryVersionPreview } from \"./version-history/history-version-preview\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs CHANGED
@@ -4,6 +4,8 @@ export { AnchoredThreads } from './comments/anchored-threads.mjs';
4
4
  export { useIsThreadActive } from './comments/comment-plugin-provider.mjs';
5
5
  export { FloatingComposer, OPEN_FLOATING_COMPOSER_COMMAND } from './comments/floating-composer.mjs';
6
6
  export { FloatingThreads } from './comments/floating-threads.mjs';
7
+ export { getSelectedBlockElement } from './get-selected-block-element.mjs';
8
+ export { isTextFormatActive } from './is-text-format-active.mjs';
7
9
  export { liveblocksConfig } from './liveblocks-config.mjs';
8
10
  export { LiveblocksPlugin, useEditorStatus, useIsEditorReady } from './liveblocks-plugin-provider.mjs';
9
11
  export { FloatingToolbar } from './toolbar/floating-toolbar.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n useIsEditorReady,\n} from \"./liveblocks-plugin-provider\";\nexport type { FloatingToolbarProps } from \"./toolbar/floating-toolbar\";\nexport { FloatingToolbar } from \"./toolbar/floating-toolbar\";\nexport type { ToolbarProps } from \"./toolbar/toolbar\";\nexport { Toolbar } from \"./toolbar/toolbar\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/history-version-preview\";\nexport { HistoryVersionPreview } from \"./version-history/history-version-preview\";\n"],"names":[],"mappings":";;;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\nexport { getSelectedBlockElement } from \"./get-selected-block-element\";\nexport { isTextFormatActive } from \"./is-text-format-active\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n useIsEditorReady,\n} from \"./liveblocks-plugin-provider\";\nexport type { FloatingToolbarProps } from \"./toolbar/floating-toolbar\";\nexport { FloatingToolbar } from \"./toolbar/floating-toolbar\";\nexport type { ToolbarProps } from \"./toolbar/toolbar\";\nexport { Toolbar } from \"./toolbar/toolbar\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/history-version-preview\";\nexport { HistoryVersionPreview } from \"./version-history/history-version-preview\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}