@liveblocks/react-ui 2.0.0-alpha1 → 2.0.0-alpha3

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
@@ -1,4 +1,4 @@
1
- import { CommentData, CommentBody, BaseMetadata, InboxNotificationData, InboxNotificationThreadData, InboxNotificationCustomData, ThreadData } from '@liveblocks/core';
1
+ import { CommentData, CommentBody, BaseMetadata, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, DAD, ThreadData } from '@liveblocks/core';
2
2
  import React, { ReactNode, ComponentPropsWithoutRef, MouseEvent, ComponentType, FormEvent, RefAttributes, ComponentProps, PropsWithChildren } from 'react';
3
3
 
4
4
  declare type Direction = "ltr" | "rtl";
@@ -53,13 +53,18 @@ interface ThreadOverrides {
53
53
  THREAD_COMPOSER_PLACEHOLDER: string;
54
54
  THREAD_COMPOSER_SEND: string;
55
55
  }
56
+ interface ThreadPanelOverrides {
57
+ THREAD_PANEL_EMPTY: string;
58
+ }
56
59
  interface InboxNotificationOverrides {
57
60
  INBOX_NOTIFICATION_MORE: string;
58
61
  INBOX_NOTIFICATION_MARK_AS_READ: string;
59
62
  INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (list: ReactNode, room: ReactNode | undefined, count: number) => ReactNode;
60
63
  INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode | undefined) => ReactNode;
64
+ INBOX_NOTIFICATION_TEXT_MENTION: (user: ReactNode, room: ReactNode | undefined) => ReactNode;
61
65
  }
62
- declare type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides;
66
+ declare type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & ThreadPanelOverrides & InboxNotificationOverrides;
67
+ declare function useOverrides(overrides?: Partial<Overrides>): Overrides;
63
68
 
64
69
  interface CommentProps extends ComponentPropsWithoutRef<"div"> {
65
70
  /**
@@ -278,8 +283,11 @@ interface AvatarProps extends ComponentProps<"div"> {
278
283
  }
279
284
 
280
285
  declare type ComponentTypeWithRef<T extends keyof JSX.IntrinsicElements, P> = ComponentType<P & Pick<ComponentProps<T>, "ref">>;
281
- declare type InboxNotificationKinds = Record<`$${string}`, ComponentTypeWithRef<"a", InboxNotificationCustomKindProps>> & {
286
+ declare type InboxNotificationKinds = {
287
+ [K in keyof DAD]: ComponentTypeWithRef<"a", InboxNotificationCustomKindProps<K>>;
288
+ } & {
282
289
  thread: ComponentTypeWithRef<"a", InboxNotificationThreadKindProps>;
290
+ textMention: ComponentTypeWithRef<"a", InboxNotificationTextMentionProps>;
283
291
  };
284
292
  interface InboxNotificationSharedProps {
285
293
  /**
@@ -315,6 +323,16 @@ interface InboxNotificationThreadProps extends Omit<InboxNotificationProps, "kin
315
323
  */
316
324
  showRoomName?: boolean;
317
325
  }
326
+ interface InboxNotificationTextMentionProps extends Omit<InboxNotificationProps, "kinds">, InboxNotificationSharedProps {
327
+ /**
328
+ * The inbox notification to display.
329
+ */
330
+ inboxNotification: InboxNotificationTextMentionData;
331
+ /**
332
+ * Whether to show the room name in the title.
333
+ */
334
+ showRoomName?: boolean;
335
+ }
318
336
  interface InboxNotificationCustomProps extends Omit<InboxNotificationProps, "kinds">, InboxNotificationSharedProps, SlotProp {
319
337
  /**
320
338
  * The inbox notification to display.
@@ -341,8 +359,11 @@ interface InboxNotificationCustomProps extends Omit<InboxNotificationProps, "kin
341
359
  declare type InboxNotificationThreadKindProps = Omit<InboxNotificationProps, "kinds"> & {
342
360
  inboxNotification: InboxNotificationThreadData;
343
361
  };
344
- declare type InboxNotificationCustomKindProps = Omit<InboxNotificationProps, "kinds"> & {
345
- inboxNotification: InboxNotificationCustomData;
362
+ declare type InboxNotificationTextMentionKindProps = Omit<InboxNotificationProps, "kinds"> & {
363
+ inboxNotification: InboxNotificationTextMentionData;
364
+ };
365
+ declare type InboxNotificationCustomKindProps<K extends `$${string}` = `$${string}`> = Omit<InboxNotificationProps, "kinds"> & {
366
+ inboxNotification: InboxNotificationCustomData<K>;
346
367
  };
347
368
  declare type InboxNotificationIconProps = ComponentProps<"div">;
348
369
  declare type InboxNotificationAvatarProps = AvatarProps;
@@ -366,6 +387,7 @@ declare function InboxNotificationAvatar({ className, ...props }: InboxNotificat
366
387
  */
367
388
  declare const InboxNotification: React.ForwardRefExoticComponent<InboxNotificationProps & React.RefAttributes<HTMLAnchorElement>> & {
368
389
  Thread: React.ForwardRefExoticComponent<InboxNotificationThreadProps & React.RefAttributes<HTMLAnchorElement>>;
390
+ TextMention: React.ForwardRefExoticComponent<InboxNotificationTextMentionProps & React.RefAttributes<HTMLAnchorElement>>;
369
391
  Custom: React.ForwardRefExoticComponent<InboxNotificationCustomProps & React.RefAttributes<HTMLAnchorElement>>;
370
392
  Icon: typeof InboxNotificationIcon;
371
393
  Avatar: typeof InboxNotificationAvatar;
@@ -490,4 +512,4 @@ declare function LiveblocksUIConfig({ overrides, components, portalContainer, ch
490
512
  */
491
513
  declare function useMentionSuggestions(search?: string): string[] | undefined;
492
514
 
493
- export { Comment, CommentProps, Composer, ComposerProps, ComposerSubmitComment, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, Thread, ThreadProps, useMentionSuggestions };
515
+ export { Comment, CommentOverrides, CommentProps, Composer, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadPanelOverrides, ThreadProps, useMentionSuggestions, useOverrides };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommentData, CommentBody, BaseMetadata, InboxNotificationData, InboxNotificationThreadData, InboxNotificationCustomData, ThreadData } from '@liveblocks/core';
1
+ import { CommentData, CommentBody, BaseMetadata, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, DAD, ThreadData } from '@liveblocks/core';
2
2
  import React, { ReactNode, ComponentPropsWithoutRef, MouseEvent, ComponentType, FormEvent, RefAttributes, ComponentProps, PropsWithChildren } from 'react';
3
3
 
4
4
  declare type Direction = "ltr" | "rtl";
@@ -53,13 +53,18 @@ interface ThreadOverrides {
53
53
  THREAD_COMPOSER_PLACEHOLDER: string;
54
54
  THREAD_COMPOSER_SEND: string;
55
55
  }
56
+ interface ThreadPanelOverrides {
57
+ THREAD_PANEL_EMPTY: string;
58
+ }
56
59
  interface InboxNotificationOverrides {
57
60
  INBOX_NOTIFICATION_MORE: string;
58
61
  INBOX_NOTIFICATION_MARK_AS_READ: string;
59
62
  INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (list: ReactNode, room: ReactNode | undefined, count: number) => ReactNode;
60
63
  INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode | undefined) => ReactNode;
64
+ INBOX_NOTIFICATION_TEXT_MENTION: (user: ReactNode, room: ReactNode | undefined) => ReactNode;
61
65
  }
62
- declare type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides;
66
+ declare type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & ThreadPanelOverrides & InboxNotificationOverrides;
67
+ declare function useOverrides(overrides?: Partial<Overrides>): Overrides;
63
68
 
64
69
  interface CommentProps extends ComponentPropsWithoutRef<"div"> {
65
70
  /**
@@ -278,8 +283,11 @@ interface AvatarProps extends ComponentProps<"div"> {
278
283
  }
279
284
 
280
285
  declare type ComponentTypeWithRef<T extends keyof JSX.IntrinsicElements, P> = ComponentType<P & Pick<ComponentProps<T>, "ref">>;
281
- declare type InboxNotificationKinds = Record<`$${string}`, ComponentTypeWithRef<"a", InboxNotificationCustomKindProps>> & {
286
+ declare type InboxNotificationKinds = {
287
+ [K in keyof DAD]: ComponentTypeWithRef<"a", InboxNotificationCustomKindProps<K>>;
288
+ } & {
282
289
  thread: ComponentTypeWithRef<"a", InboxNotificationThreadKindProps>;
290
+ textMention: ComponentTypeWithRef<"a", InboxNotificationTextMentionProps>;
283
291
  };
284
292
  interface InboxNotificationSharedProps {
285
293
  /**
@@ -315,6 +323,16 @@ interface InboxNotificationThreadProps extends Omit<InboxNotificationProps, "kin
315
323
  */
316
324
  showRoomName?: boolean;
317
325
  }
326
+ interface InboxNotificationTextMentionProps extends Omit<InboxNotificationProps, "kinds">, InboxNotificationSharedProps {
327
+ /**
328
+ * The inbox notification to display.
329
+ */
330
+ inboxNotification: InboxNotificationTextMentionData;
331
+ /**
332
+ * Whether to show the room name in the title.
333
+ */
334
+ showRoomName?: boolean;
335
+ }
318
336
  interface InboxNotificationCustomProps extends Omit<InboxNotificationProps, "kinds">, InboxNotificationSharedProps, SlotProp {
319
337
  /**
320
338
  * The inbox notification to display.
@@ -341,8 +359,11 @@ interface InboxNotificationCustomProps extends Omit<InboxNotificationProps, "kin
341
359
  declare type InboxNotificationThreadKindProps = Omit<InboxNotificationProps, "kinds"> & {
342
360
  inboxNotification: InboxNotificationThreadData;
343
361
  };
344
- declare type InboxNotificationCustomKindProps = Omit<InboxNotificationProps, "kinds"> & {
345
- inboxNotification: InboxNotificationCustomData;
362
+ declare type InboxNotificationTextMentionKindProps = Omit<InboxNotificationProps, "kinds"> & {
363
+ inboxNotification: InboxNotificationTextMentionData;
364
+ };
365
+ declare type InboxNotificationCustomKindProps<K extends `$${string}` = `$${string}`> = Omit<InboxNotificationProps, "kinds"> & {
366
+ inboxNotification: InboxNotificationCustomData<K>;
346
367
  };
347
368
  declare type InboxNotificationIconProps = ComponentProps<"div">;
348
369
  declare type InboxNotificationAvatarProps = AvatarProps;
@@ -366,6 +387,7 @@ declare function InboxNotificationAvatar({ className, ...props }: InboxNotificat
366
387
  */
367
388
  declare const InboxNotification: React.ForwardRefExoticComponent<InboxNotificationProps & React.RefAttributes<HTMLAnchorElement>> & {
368
389
  Thread: React.ForwardRefExoticComponent<InboxNotificationThreadProps & React.RefAttributes<HTMLAnchorElement>>;
390
+ TextMention: React.ForwardRefExoticComponent<InboxNotificationTextMentionProps & React.RefAttributes<HTMLAnchorElement>>;
369
391
  Custom: React.ForwardRefExoticComponent<InboxNotificationCustomProps & React.RefAttributes<HTMLAnchorElement>>;
370
392
  Icon: typeof InboxNotificationIcon;
371
393
  Avatar: typeof InboxNotificationAvatar;
@@ -490,4 +512,4 @@ declare function LiveblocksUIConfig({ overrides, components, portalContainer, ch
490
512
  */
491
513
  declare function useMentionSuggestions(search?: string): string[] | undefined;
492
514
 
493
- export { Comment, CommentProps, Composer, ComposerProps, ComposerSubmitComment, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, Thread, ThreadProps, useMentionSuggestions };
515
+ export { Comment, CommentOverrides, CommentProps, Composer, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadPanelOverrides, ThreadProps, useMentionSuggestions, useOverrides };
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ var InboxNotification = require('./components/InboxNotification.js');
8
8
  var InboxNotificationList = require('./components/InboxNotificationList.js');
9
9
  var Thread = require('./components/Thread.js');
10
10
  var config = require('./config.js');
11
+ var overrides = require('./overrides.js');
11
12
  var shared = require('./shared.js');
12
13
 
13
14
  core.detectDupes(version.PKG_NAME, version.PKG_VERSION, version.PKG_FORMAT);
@@ -18,5 +19,6 @@ exports.InboxNotification = InboxNotification.InboxNotification;
18
19
  exports.InboxNotificationList = InboxNotificationList.InboxNotificationList;
19
20
  exports.Thread = Thread.Thread;
20
21
  exports.LiveblocksUIConfig = config.LiveblocksUIConfig;
22
+ exports.useOverrides = overrides.useOverrides;
21
23
  exports.useMentionSuggestions = shared.useMentionSuggestions;
22
24
  //# sourceMappingURL=index.js.map
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 { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\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 { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n ThreadPanelOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;"}
package/dist/index.mjs CHANGED
@@ -6,6 +6,7 @@ export { InboxNotification } from './components/InboxNotification.mjs';
6
6
  export { InboxNotificationList } from './components/InboxNotificationList.mjs';
7
7
  export { Thread } from './components/Thread.mjs';
8
8
  export { LiveblocksUIConfig } from './config.mjs';
9
+ export { useOverrides } from './overrides.mjs';
9
10
  export { useMentionSuggestions } from './shared.mjs';
10
11
 
11
12
  detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
@@ -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 { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\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 { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n ThreadPanelOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\n"],"names":[],"mappings":";;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
package/dist/overrides.js CHANGED
@@ -58,10 +58,12 @@ const defaultOverrides = {
58
58
  THREAD_NEW_INDICATOR_DESCRIPTION: "New comments",
59
59
  THREAD_COMPOSER_PLACEHOLDER: "Reply to thread\u2026",
60
60
  THREAD_COMPOSER_SEND: "Reply",
61
+ THREAD_PANEL_EMPTY: "No threads yet.",
61
62
  INBOX_NOTIFICATION_MORE: "More",
62
63
  INBOX_NOTIFICATION_MARK_AS_READ: "Mark as read",
63
64
  INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (list, room) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, list, " commented", room ? /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " in ", room) : /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " in a thread")),
64
- INBOX_NOTIFICATION_THREAD_MENTION: (user, room) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, user, " mentioned you", room ? /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " in ", room) : null)
65
+ INBOX_NOTIFICATION_THREAD_MENTION: (user, room) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, user, " mentioned you", room ? /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " in ", room) : null),
66
+ INBOX_NOTIFICATION_TEXT_MENTION: (user, room) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, user, " mentioned you", room ? /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " in ", room) : null)
65
67
  };
66
68
  const OverridesContext = React.createContext(void 0);
67
69
  function useOverrides(overrides) {
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.js","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport * as React from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { Direction } from \"./types\";\nimport { pluralize } from \"./utils/pluralize\";\n\nexport interface LocalizationOverrides {\n locale: string;\n dir: Direction;\n}\n\nexport interface GlobalOverrides {\n USER_SELF: string;\n USER_UNKNOWN: string;\n LIST_REMAINING: (count: number) => string;\n LIST_REMAINING_USERS: (count: number) => string;\n LIST_REMAINING_COMMENTS: (count: number) => string;\n EMOJI_PICKER_SEARCH_PLACEHOLDER: string;\n EMOJI_PICKER_EMPTY: ReactNode;\n EMOJI_PICKER_ERROR: (error: Error) => ReactNode;\n}\n\nexport interface CommentOverrides {\n COMMENT_EDITED: ReactNode;\n COMMENT_DELETED: ReactNode;\n COMMENT_MORE: string;\n COMMENT_EDIT: string;\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: string;\n COMMENT_EDIT_COMPOSER_CANCEL: string;\n COMMENT_EDIT_COMPOSER_SAVE: string;\n COMMENT_DELETE: string;\n COMMENT_ADD_REACTION: string;\n COMMENT_REACTION_LIST: (\n list: ReactNode,\n emoji: string,\n count: number\n ) => ReactNode;\n COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;\n}\n\nexport interface ComposerOverrides {\n COMPOSER_INSERT_MENTION: string;\n COMPOSER_INSERT_EMOJI: string;\n COMPOSER_PLACEHOLDER: string;\n COMPOSER_SEND: string;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_COMPOSER_PLACEHOLDER: string;\n THREAD_COMPOSER_SEND: string;\n}\n\nexport interface InboxNotificationOverrides {\n INBOX_NOTIFICATION_MORE: string;\n INBOX_NOTIFICATION_MARK_AS_READ: string;\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode | undefined,\n count: number\n ) => ReactNode;\n INBOX_NOTIFICATION_THREAD_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n InboxNotificationOverrides;\n\ntype OverridesProviderProps = PropsWithChildren<{\n overrides?: Partial<Overrides>;\n}>;\n\nexport const defaultOverrides: Overrides = {\n locale: \"en\",\n dir: \"ltr\",\n USER_SELF: \"you\",\n USER_UNKNOWN: \"Anonymous\",\n LIST_REMAINING: (count) => `${count} more`,\n LIST_REMAINING_USERS: (count) => `${count} ${pluralize(count, \"other\")}`,\n LIST_REMAINING_COMMENTS: (count) =>\n `${count} more ${pluralize(count, \"comment\")}`,\n EMOJI_PICKER_SEARCH_PLACEHOLDER: \"Search…\",\n EMOJI_PICKER_EMPTY: \"No emoji found.\",\n EMOJI_PICKER_ERROR: () =>\n \"There was an error while getting the list of emoji.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_PLACEHOLDER: \"Write a comment…\",\n COMPOSER_SEND: \"Send\",\n COMMENT_EDITED: \"(edited)\",\n COMMENT_DELETED: \"This comment has been deleted.\",\n COMMENT_MORE: \"More\",\n COMMENT_EDIT: \"Edit comment\",\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: \"Edit comment…\",\n COMMENT_EDIT_COMPOSER_CANCEL: \"Cancel\",\n COMMENT_EDIT_COMPOSER_SAVE: \"Save\",\n COMMENT_DELETE: \"Delete comment\",\n COMMENT_ADD_REACTION: \"Add reaction\",\n COMMENT_REACTION_LIST: (list, emoji) => (\n <>\n {list} reacted with <Emoji emoji={emoji} />\n </>\n ),\n COMMENT_REACTION_DESCRIPTION: (emoji, count) =>\n `${count} ${pluralize(count, \"reaction\")}, react with ${emoji}`,\n THREAD_RESOLVE: \"Resolve thread\",\n THREAD_UNRESOLVE: \"Re-open thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_COMPOSER_PLACEHOLDER: \"Reply to thread…\",\n THREAD_COMPOSER_SEND: \"Reply\",\n INBOX_NOTIFICATION_MORE: \"More\",\n INBOX_NOTIFICATION_MARK_AS_READ: \"Mark as read\",\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode\n ) => (\n <>\n {list} commented\n {room ? <> in {room}</> : <> in a thread</>}\n </>\n ),\n INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n};\n\nexport const OverridesContext = createContext<Overrides | undefined>(undefined);\n\nexport function useOverrides(overrides?: Partial<Overrides>): Overrides {\n const contextOverrides = useContext(OverridesContext);\n\n return useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...overrides,\n }),\n [contextOverrides, overrides]\n );\n}\n\nexport function OverridesProvider({\n children,\n overrides: providerOverrides,\n}: OverridesProviderProps) {\n const contextOverrides = useContext(OverridesContext);\n const overrides = useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...providerOverrides,\n }),\n [contextOverrides, providerOverrides]\n );\n\n return (\n <OverridesContext.Provider value={overrides}>\n {children}\n </OverridesContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqFO;AAAoC;AACjC;AACH;AACM;AACG;AACgB;AACuC;AAExB;AACZ;AACb;AAElB;AACuB;AACF;AACD;AACP;AACC;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACM;AAGG;AAAM;AAC7B;AAGwD;AAC1C;AACE;AACI;AACY;AACL;AACP;AACG;AACQ;AAQ/B;AAOJ;AAEa;AAEN;AACL;AAEA;AAAO;AACE;AACF;AACA;AACA;AACL;AAC4B;AAEhC;AAEO;AAA2B;AAChC;AAEF;AACE;AACA;AAAkB;AACT;AACF;AACA;AACA;AACL;AACoC;AAGtC;AACG;AAAiC;AAItC;;;;;"}
1
+ {"version":3,"file":"overrides.js","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport * as React from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { Direction } from \"./types\";\nimport { pluralize } from \"./utils/pluralize\";\n\nexport interface LocalizationOverrides {\n locale: string;\n dir: Direction;\n}\n\nexport interface GlobalOverrides {\n USER_SELF: string;\n USER_UNKNOWN: string;\n LIST_REMAINING: (count: number) => string;\n LIST_REMAINING_USERS: (count: number) => string;\n LIST_REMAINING_COMMENTS: (count: number) => string;\n EMOJI_PICKER_SEARCH_PLACEHOLDER: string;\n EMOJI_PICKER_EMPTY: ReactNode;\n EMOJI_PICKER_ERROR: (error: Error) => ReactNode;\n}\n\nexport interface CommentOverrides {\n COMMENT_EDITED: ReactNode;\n COMMENT_DELETED: ReactNode;\n COMMENT_MORE: string;\n COMMENT_EDIT: string;\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: string;\n COMMENT_EDIT_COMPOSER_CANCEL: string;\n COMMENT_EDIT_COMPOSER_SAVE: string;\n COMMENT_DELETE: string;\n COMMENT_ADD_REACTION: string;\n COMMENT_REACTION_LIST: (\n list: ReactNode,\n emoji: string,\n count: number\n ) => ReactNode;\n COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;\n}\n\nexport interface ComposerOverrides {\n COMPOSER_INSERT_MENTION: string;\n COMPOSER_INSERT_EMOJI: string;\n COMPOSER_PLACEHOLDER: string;\n COMPOSER_SEND: string;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_COMPOSER_PLACEHOLDER: string;\n THREAD_COMPOSER_SEND: string;\n}\n\nexport interface ThreadPanelOverrides {\n THREAD_PANEL_EMPTY: string;\n}\n\nexport interface InboxNotificationOverrides {\n INBOX_NOTIFICATION_MORE: string;\n INBOX_NOTIFICATION_MARK_AS_READ: string;\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode | undefined,\n count: number\n ) => ReactNode;\n INBOX_NOTIFICATION_THREAD_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n INBOX_NOTIFICATION_TEXT_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n ThreadPanelOverrides &\n InboxNotificationOverrides;\n\ntype OverridesProviderProps = PropsWithChildren<{\n overrides?: Partial<Overrides>;\n}>;\n\nexport const defaultOverrides: Overrides = {\n locale: \"en\",\n dir: \"ltr\",\n USER_SELF: \"you\",\n USER_UNKNOWN: \"Anonymous\",\n LIST_REMAINING: (count) => `${count} more`,\n LIST_REMAINING_USERS: (count) => `${count} ${pluralize(count, \"other\")}`,\n LIST_REMAINING_COMMENTS: (count) =>\n `${count} more ${pluralize(count, \"comment\")}`,\n EMOJI_PICKER_SEARCH_PLACEHOLDER: \"Search…\",\n EMOJI_PICKER_EMPTY: \"No emoji found.\",\n EMOJI_PICKER_ERROR: () =>\n \"There was an error while getting the list of emoji.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_PLACEHOLDER: \"Write a comment…\",\n COMPOSER_SEND: \"Send\",\n COMMENT_EDITED: \"(edited)\",\n COMMENT_DELETED: \"This comment has been deleted.\",\n COMMENT_MORE: \"More\",\n COMMENT_EDIT: \"Edit comment\",\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: \"Edit comment…\",\n COMMENT_EDIT_COMPOSER_CANCEL: \"Cancel\",\n COMMENT_EDIT_COMPOSER_SAVE: \"Save\",\n COMMENT_DELETE: \"Delete comment\",\n COMMENT_ADD_REACTION: \"Add reaction\",\n COMMENT_REACTION_LIST: (list, emoji) => (\n <>\n {list} reacted with <Emoji emoji={emoji} />\n </>\n ),\n COMMENT_REACTION_DESCRIPTION: (emoji, count) =>\n `${count} ${pluralize(count, \"reaction\")}, react with ${emoji}`,\n THREAD_RESOLVE: \"Resolve thread\",\n THREAD_UNRESOLVE: \"Re-open thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_COMPOSER_PLACEHOLDER: \"Reply to thread…\",\n THREAD_COMPOSER_SEND: \"Reply\",\n THREAD_PANEL_EMPTY: \"No threads yet.\",\n INBOX_NOTIFICATION_MORE: \"More\",\n INBOX_NOTIFICATION_MARK_AS_READ: \"Mark as read\",\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode\n ) => (\n <>\n {list} commented\n {room ? <> in {room}</> : <> in a thread</>}\n </>\n ),\n INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n INBOX_NOTIFICATION_TEXT_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n};\n\nexport const OverridesContext = createContext<Overrides | undefined>(undefined);\n\nexport function useOverrides(overrides?: Partial<Overrides>): Overrides {\n const contextOverrides = useContext(OverridesContext);\n\n return useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...overrides,\n }),\n [contextOverrides, overrides]\n );\n}\n\nexport function OverridesProvider({\n children,\n overrides: providerOverrides,\n}: OverridesProviderProps) {\n const contextOverrides = useContext(OverridesContext);\n const overrides = useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...providerOverrides,\n }),\n [contextOverrides, providerOverrides]\n );\n\n return (\n <OverridesContext.Provider value={overrides}>\n {children}\n </OverridesContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8FO;AAAoC;AACjC;AACH;AACM;AACG;AACgB;AACuC;AAExB;AACZ;AACb;AAElB;AACuB;AACF;AACD;AACP;AACC;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACM;AAGG;AAAM;AAC7B;AAGwD;AAC1C;AACE;AACI;AACY;AACL;AACP;AACF;AACK;AACQ;AAQ/B;AAKA;AAOJ;AAEa;AAEN;AACL;AAEA;AAAO;AACE;AACF;AACA;AACA;AACL;AAC4B;AAEhC;AAEO;AAA2B;AAChC;AAEF;AACE;AACA;AAAkB;AACT;AACF;AACA;AACA;AACL;AACoC;AAGtC;AACG;AAAiC;AAItC;;;;;"}
@@ -38,10 +38,12 @@ const defaultOverrides = {
38
38
  THREAD_NEW_INDICATOR_DESCRIPTION: "New comments",
39
39
  THREAD_COMPOSER_PLACEHOLDER: "Reply to thread\u2026",
40
40
  THREAD_COMPOSER_SEND: "Reply",
41
+ THREAD_PANEL_EMPTY: "No threads yet.",
41
42
  INBOX_NOTIFICATION_MORE: "More",
42
43
  INBOX_NOTIFICATION_MARK_AS_READ: "Mark as read",
43
44
  INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (list, room) => /* @__PURE__ */ React.createElement(React.Fragment, null, list, " commented", room ? /* @__PURE__ */ React.createElement(React.Fragment, null, " in ", room) : /* @__PURE__ */ React.createElement(React.Fragment, null, " in a thread")),
44
- INBOX_NOTIFICATION_THREAD_MENTION: (user, room) => /* @__PURE__ */ React.createElement(React.Fragment, null, user, " mentioned you", room ? /* @__PURE__ */ React.createElement(React.Fragment, null, " in ", room) : null)
45
+ INBOX_NOTIFICATION_THREAD_MENTION: (user, room) => /* @__PURE__ */ React.createElement(React.Fragment, null, user, " mentioned you", room ? /* @__PURE__ */ React.createElement(React.Fragment, null, " in ", room) : null),
46
+ INBOX_NOTIFICATION_TEXT_MENTION: (user, room) => /* @__PURE__ */ React.createElement(React.Fragment, null, user, " mentioned you", room ? /* @__PURE__ */ React.createElement(React.Fragment, null, " in ", room) : null)
45
47
  };
46
48
  const OverridesContext = createContext(void 0);
47
49
  function useOverrides(overrides) {
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.mjs","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport * as React from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { Direction } from \"./types\";\nimport { pluralize } from \"./utils/pluralize\";\n\nexport interface LocalizationOverrides {\n locale: string;\n dir: Direction;\n}\n\nexport interface GlobalOverrides {\n USER_SELF: string;\n USER_UNKNOWN: string;\n LIST_REMAINING: (count: number) => string;\n LIST_REMAINING_USERS: (count: number) => string;\n LIST_REMAINING_COMMENTS: (count: number) => string;\n EMOJI_PICKER_SEARCH_PLACEHOLDER: string;\n EMOJI_PICKER_EMPTY: ReactNode;\n EMOJI_PICKER_ERROR: (error: Error) => ReactNode;\n}\n\nexport interface CommentOverrides {\n COMMENT_EDITED: ReactNode;\n COMMENT_DELETED: ReactNode;\n COMMENT_MORE: string;\n COMMENT_EDIT: string;\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: string;\n COMMENT_EDIT_COMPOSER_CANCEL: string;\n COMMENT_EDIT_COMPOSER_SAVE: string;\n COMMENT_DELETE: string;\n COMMENT_ADD_REACTION: string;\n COMMENT_REACTION_LIST: (\n list: ReactNode,\n emoji: string,\n count: number\n ) => ReactNode;\n COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;\n}\n\nexport interface ComposerOverrides {\n COMPOSER_INSERT_MENTION: string;\n COMPOSER_INSERT_EMOJI: string;\n COMPOSER_PLACEHOLDER: string;\n COMPOSER_SEND: string;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_COMPOSER_PLACEHOLDER: string;\n THREAD_COMPOSER_SEND: string;\n}\n\nexport interface InboxNotificationOverrides {\n INBOX_NOTIFICATION_MORE: string;\n INBOX_NOTIFICATION_MARK_AS_READ: string;\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode | undefined,\n count: number\n ) => ReactNode;\n INBOX_NOTIFICATION_THREAD_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n InboxNotificationOverrides;\n\ntype OverridesProviderProps = PropsWithChildren<{\n overrides?: Partial<Overrides>;\n}>;\n\nexport const defaultOverrides: Overrides = {\n locale: \"en\",\n dir: \"ltr\",\n USER_SELF: \"you\",\n USER_UNKNOWN: \"Anonymous\",\n LIST_REMAINING: (count) => `${count} more`,\n LIST_REMAINING_USERS: (count) => `${count} ${pluralize(count, \"other\")}`,\n LIST_REMAINING_COMMENTS: (count) =>\n `${count} more ${pluralize(count, \"comment\")}`,\n EMOJI_PICKER_SEARCH_PLACEHOLDER: \"Search…\",\n EMOJI_PICKER_EMPTY: \"No emoji found.\",\n EMOJI_PICKER_ERROR: () =>\n \"There was an error while getting the list of emoji.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_PLACEHOLDER: \"Write a comment…\",\n COMPOSER_SEND: \"Send\",\n COMMENT_EDITED: \"(edited)\",\n COMMENT_DELETED: \"This comment has been deleted.\",\n COMMENT_MORE: \"More\",\n COMMENT_EDIT: \"Edit comment\",\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: \"Edit comment…\",\n COMMENT_EDIT_COMPOSER_CANCEL: \"Cancel\",\n COMMENT_EDIT_COMPOSER_SAVE: \"Save\",\n COMMENT_DELETE: \"Delete comment\",\n COMMENT_ADD_REACTION: \"Add reaction\",\n COMMENT_REACTION_LIST: (list, emoji) => (\n <>\n {list} reacted with <Emoji emoji={emoji} />\n </>\n ),\n COMMENT_REACTION_DESCRIPTION: (emoji, count) =>\n `${count} ${pluralize(count, \"reaction\")}, react with ${emoji}`,\n THREAD_RESOLVE: \"Resolve thread\",\n THREAD_UNRESOLVE: \"Re-open thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_COMPOSER_PLACEHOLDER: \"Reply to thread…\",\n THREAD_COMPOSER_SEND: \"Reply\",\n INBOX_NOTIFICATION_MORE: \"More\",\n INBOX_NOTIFICATION_MARK_AS_READ: \"Mark as read\",\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode\n ) => (\n <>\n {list} commented\n {room ? <> in {room}</> : <> in a thread</>}\n </>\n ),\n INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n};\n\nexport const OverridesContext = createContext<Overrides | undefined>(undefined);\n\nexport function useOverrides(overrides?: Partial<Overrides>): Overrides {\n const contextOverrides = useContext(OverridesContext);\n\n return useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...overrides,\n }),\n [contextOverrides, overrides]\n );\n}\n\nexport function OverridesProvider({\n children,\n overrides: providerOverrides,\n}: OverridesProviderProps) {\n const contextOverrides = useContext(OverridesContext);\n const overrides = useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...providerOverrides,\n }),\n [contextOverrides, providerOverrides]\n );\n\n return (\n <OverridesContext.Provider value={overrides}>\n {children}\n </OverridesContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;AAqFO;AAAoC;AACjC;AACH;AACM;AACG;AACgB;AACuC;AAExB;AACZ;AACb;AAElB;AACuB;AACF;AACD;AACP;AACC;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACM;AAGG;AAAM;AAC7B;AAGwD;AAC1C;AACE;AACI;AACY;AACL;AACP;AACG;AACQ;AAQ/B;AAOJ;AAEa;AAEN;AACL;AAEA;AAAO;AACE;AACF;AACA;AACA;AACL;AAC4B;AAEhC;AAEO;AAA2B;AAChC;AAEF;AACE;AACA;AAAkB;AACT;AACF;AACA;AACA;AACL;AACoC;AAGtC;AACG;AAAiC;AAItC;;"}
1
+ {"version":3,"file":"overrides.mjs","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport * as React from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { Direction } from \"./types\";\nimport { pluralize } from \"./utils/pluralize\";\n\nexport interface LocalizationOverrides {\n locale: string;\n dir: Direction;\n}\n\nexport interface GlobalOverrides {\n USER_SELF: string;\n USER_UNKNOWN: string;\n LIST_REMAINING: (count: number) => string;\n LIST_REMAINING_USERS: (count: number) => string;\n LIST_REMAINING_COMMENTS: (count: number) => string;\n EMOJI_PICKER_SEARCH_PLACEHOLDER: string;\n EMOJI_PICKER_EMPTY: ReactNode;\n EMOJI_PICKER_ERROR: (error: Error) => ReactNode;\n}\n\nexport interface CommentOverrides {\n COMMENT_EDITED: ReactNode;\n COMMENT_DELETED: ReactNode;\n COMMENT_MORE: string;\n COMMENT_EDIT: string;\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: string;\n COMMENT_EDIT_COMPOSER_CANCEL: string;\n COMMENT_EDIT_COMPOSER_SAVE: string;\n COMMENT_DELETE: string;\n COMMENT_ADD_REACTION: string;\n COMMENT_REACTION_LIST: (\n list: ReactNode,\n emoji: string,\n count: number\n ) => ReactNode;\n COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;\n}\n\nexport interface ComposerOverrides {\n COMPOSER_INSERT_MENTION: string;\n COMPOSER_INSERT_EMOJI: string;\n COMPOSER_PLACEHOLDER: string;\n COMPOSER_SEND: string;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_COMPOSER_PLACEHOLDER: string;\n THREAD_COMPOSER_SEND: string;\n}\n\nexport interface ThreadPanelOverrides {\n THREAD_PANEL_EMPTY: string;\n}\n\nexport interface InboxNotificationOverrides {\n INBOX_NOTIFICATION_MORE: string;\n INBOX_NOTIFICATION_MARK_AS_READ: string;\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode | undefined,\n count: number\n ) => ReactNode;\n INBOX_NOTIFICATION_THREAD_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n INBOX_NOTIFICATION_TEXT_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n ThreadPanelOverrides &\n InboxNotificationOverrides;\n\ntype OverridesProviderProps = PropsWithChildren<{\n overrides?: Partial<Overrides>;\n}>;\n\nexport const defaultOverrides: Overrides = {\n locale: \"en\",\n dir: \"ltr\",\n USER_SELF: \"you\",\n USER_UNKNOWN: \"Anonymous\",\n LIST_REMAINING: (count) => `${count} more`,\n LIST_REMAINING_USERS: (count) => `${count} ${pluralize(count, \"other\")}`,\n LIST_REMAINING_COMMENTS: (count) =>\n `${count} more ${pluralize(count, \"comment\")}`,\n EMOJI_PICKER_SEARCH_PLACEHOLDER: \"Search…\",\n EMOJI_PICKER_EMPTY: \"No emoji found.\",\n EMOJI_PICKER_ERROR: () =>\n \"There was an error while getting the list of emoji.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_PLACEHOLDER: \"Write a comment…\",\n COMPOSER_SEND: \"Send\",\n COMMENT_EDITED: \"(edited)\",\n COMMENT_DELETED: \"This comment has been deleted.\",\n COMMENT_MORE: \"More\",\n COMMENT_EDIT: \"Edit comment\",\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: \"Edit comment…\",\n COMMENT_EDIT_COMPOSER_CANCEL: \"Cancel\",\n COMMENT_EDIT_COMPOSER_SAVE: \"Save\",\n COMMENT_DELETE: \"Delete comment\",\n COMMENT_ADD_REACTION: \"Add reaction\",\n COMMENT_REACTION_LIST: (list, emoji) => (\n <>\n {list} reacted with <Emoji emoji={emoji} />\n </>\n ),\n COMMENT_REACTION_DESCRIPTION: (emoji, count) =>\n `${count} ${pluralize(count, \"reaction\")}, react with ${emoji}`,\n THREAD_RESOLVE: \"Resolve thread\",\n THREAD_UNRESOLVE: \"Re-open thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_COMPOSER_PLACEHOLDER: \"Reply to thread…\",\n THREAD_COMPOSER_SEND: \"Reply\",\n THREAD_PANEL_EMPTY: \"No threads yet.\",\n INBOX_NOTIFICATION_MORE: \"More\",\n INBOX_NOTIFICATION_MARK_AS_READ: \"Mark as read\",\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode\n ) => (\n <>\n {list} commented\n {room ? <> in {room}</> : <> in a thread</>}\n </>\n ),\n INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n INBOX_NOTIFICATION_TEXT_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n};\n\nexport const OverridesContext = createContext<Overrides | undefined>(undefined);\n\nexport function useOverrides(overrides?: Partial<Overrides>): Overrides {\n const contextOverrides = useContext(OverridesContext);\n\n return useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...overrides,\n }),\n [contextOverrides, overrides]\n );\n}\n\nexport function OverridesProvider({\n children,\n overrides: providerOverrides,\n}: OverridesProviderProps) {\n const contextOverrides = useContext(OverridesContext);\n const overrides = useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...providerOverrides,\n }),\n [contextOverrides, providerOverrides]\n );\n\n return (\n <OverridesContext.Provider value={overrides}>\n {children}\n </OverridesContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;AA8FO;AAAoC;AACjC;AACH;AACM;AACG;AACgB;AACuC;AAExB;AACZ;AACb;AAElB;AACuB;AACF;AACD;AACP;AACC;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACM;AAGG;AAAM;AAC7B;AAGwD;AAC1C;AACE;AACI;AACY;AACL;AACP;AACF;AACK;AACQ;AAQ/B;AAKA;AAOJ;AAEa;AAEN;AACL;AAEA;AAAO;AACE;AACF;AACA;AACA;AACL;AAC4B;AAEhC;AAEO;AAA2B;AAChC;AAEF;AACE;AACA;AAAkB;AACT;AACF;AACA;AACA;AACL;AACoC;AAGtC;AACG;AAAiC;AAItC;;"}
package/dist/shared.js CHANGED
@@ -16,7 +16,6 @@ function getMentionSuggestionsCacheForClient(client) {
16
16
  }
17
17
  function useMentionSuggestions(search) {
18
18
  const client = react.useClient();
19
- const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);
20
19
  const room = react.useRoom();
21
20
  const [mentionSuggestions, setMentionSuggestions] = React.useState();
22
21
  const lastInvokedAt = React.useRef();
@@ -29,6 +28,7 @@ function useMentionSuggestions(search) {
29
28
  const mentionSuggestionsCacheKey = core.stringify(resolveMentionSuggestionsArgs);
30
29
  let debounceTimeout;
31
30
  let isCanceled = false;
31
+ const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);
32
32
  const getMentionSuggestions = async () => {
33
33
  try {
34
34
  lastInvokedAt.current = performance.now();
@@ -61,7 +61,7 @@ function useMentionSuggestions(search) {
61
61
  isCanceled = true;
62
62
  window.clearTimeout(debounceTimeout);
63
63
  };
64
- }, [room.id, search]);
64
+ }, [client, room.id, search]);
65
65
  return mentionSuggestions;
66
66
  }
67
67
  function useCurrentUserIdFromRoom() {
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sources":["../src/shared.ts"],"sourcesContent":["import type { OpaqueClient } from \"@liveblocks/core\";\nimport { kInternal, raise, stringify } from \"@liveblocks/core\";\nimport {\n ClientContext,\n RoomContext,\n useClient,\n useRoom,\n useSelf,\n} from \"@liveblocks/react\";\nimport React, { useContext, useSyncExternalStore } from \"react\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\nconst _cachesByClient = new WeakMap<OpaqueClient, Map<string, string[]>>();\n\nfunction getMentionSuggestionsCacheForClient(client: OpaqueClient) {\n let cache = _cachesByClient.get(client);\n if (!cache) {\n cache = new Map();\n _cachesByClient.set(client, cache);\n }\n return cache;\n}\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(search?: string) {\n const client = useClient();\n const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);\n\n const room = useRoom();\n const [mentionSuggestions, setMentionSuggestions] =\n React.useState<string[]>();\n const lastInvokedAt = React.useRef<number>();\n\n React.useEffect(() => {\n const resolveMentionSuggestions =\n client[kInternal].resolveMentionSuggestions;\n\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId: room.id };\n const mentionSuggestionsCacheKey = stringify(resolveMentionSuggestionsArgs);\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [room.id, search]);\n\n return mentionSuggestions;\n}\n\nfunction useCurrentUserIdFromRoom() {\n return useSelf((user) => (typeof user.id === \"string\" ? user.id : null));\n}\n\nfunction useCurrentUserIdFromClient_withClient(client: OpaqueClient) {\n const currentUserIdStore = client[kInternal].currentUserIdStore;\n return useSyncExternalStore(\n currentUserIdStore.subscribe,\n currentUserIdStore.get,\n currentUserIdStore.get\n );\n}\n\nexport function useCurrentUserId(): string | null {\n const client = useContext(ClientContext);\n const room = useContext(RoomContext);\n if (room !== null) {\n return useCurrentUserIdFromRoom();\n } else if (client !== null) {\n return useCurrentUserIdFromClient_withClient(client);\n } else {\n raise(\n \"LiveblocksProvider or RoomProvider are missing from the React tree.\"\n );\n }\n}\n"],"names":["useClient","useRoom","kInternal","stringify","mentionSuggestions","useSelf","useSyncExternalStore","useContext","ClientContext","RoomContext","raise"],"mappings":";;;;;;AAWA,MAAM,4BAA+B,GAAA,GAAA,CAAA;AAErC,MAAM,eAAA,uBAAsB,OAA6C,EAAA,CAAA;AAEzE,SAAS,oCAAoC,MAAsB,EAAA;AACjE,EAAI,IAAA,KAAA,GAAQ,eAAgB,CAAA,GAAA,CAAI,MAAM,CAAA,CAAA;AACtC,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAA,KAAA,uBAAY,GAAI,EAAA,CAAA;AAChB,IAAgB,eAAA,CAAA,GAAA,CAAI,QAAQ,KAAK,CAAA,CAAA;AAAA,GACnC;AACA,EAAO,OAAA,KAAA,CAAA;AACT,CAAA;AAQO,SAAS,sBAAsB,MAAiB,EAAA;AACrD,EAAA,MAAM,SAASA,eAAU,EAAA,CAAA;AACzB,EAAM,MAAA,uBAAA,GAA0B,oCAAoC,MAAM,CAAA,CAAA;AAE1E,EAAA,MAAM,OAAOC,aAAQ,EAAA,CAAA;AACrB,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,CAAA,GAC9C,MAAM,QAAmB,EAAA,CAAA;AAC3B,EAAM,MAAA,aAAA,GAAgB,MAAM,MAAe,EAAA,CAAA;AAE3C,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAM,MAAA,yBAAA,GACJ,OAAOC,cAAW,CAAA,CAAA,yBAAA,CAAA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AAK,qBAAsB,EAAA,CAAA;AAAA,SAC1B,4BAA4B,CAAA,CAAA;AAAA,KACjC;AAEA,IAAA,OAAO,MAAM;AACX,MAAa,UAAA,GAAA,IAAA,CAAA;AACb,MAAA,MAAA,CAAO,aAAa,eAAe,CAAA,CAAA;AAAA,KACrC,CAAA;AAAA,GACC,EAAA,CAAC,IAAK,CAAA,EAAA,EAAI,MAAM,CAAC,CAAA,CAAA;AAEpB,EAAO,OAAA,kBAAA,CAAA;AACT,CAAA;AAEA,SAAS,wBAA2B,GAAA;AAClC,EAAO,OAAAC,aAAA,CAAQ,CAAC,IAAU,KAAA,OAAO,KAAK,EAAO,KAAA,QAAA,GAAW,IAAK,CAAA,EAAA,GAAK,IAAK,CAAA,CAAA;AACzE,CAAA;AAEA,SAAS,sCAAsC,MAAsB,EAAA;AACnE,EAAM,MAAA,kBAAA,GAAqB,OAAOH,cAAW,CAAA,CAAA,kBAAA,CAAA;AAC7C,EAAO,OAAAI,0BAAA;AAAA,IACL,kBAAmB,CAAA,SAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,GACrB,CAAA;AACF,CAAA;AAEO,SAAS,gBAAkC,GAAA;AAChD,EAAM,MAAA,MAAA,GAASC,iBAAWC,mBAAa,CAAA,CAAA;AACvC,EAAM,MAAA,IAAA,GAAOD,iBAAWE,iBAAW,CAAA,CAAA;AACnC,EAAA,IAAI,SAAS,IAAM,EAAA;AACjB,IAAA,OAAO,wBAAyB,EAAA,CAAA;AAAA,GAClC,MAAA,IAAW,WAAW,IAAM,EAAA;AAC1B,IAAA,OAAO,sCAAsC,MAAM,CAAA,CAAA;AAAA,GAC9C,MAAA;AACL,IAAAC,UAAA;AAAA,MACE,qEAAA;AAAA,KACF,CAAA;AAAA,GACF;AACF;;;;;"}
1
+ {"version":3,"file":"shared.js","sources":["../src/shared.ts"],"sourcesContent":["import type { OpaqueClient } from \"@liveblocks/core\";\nimport { kInternal, raise, stringify } from \"@liveblocks/core\";\nimport {\n ClientContext,\n RoomContext,\n useClient,\n useRoom,\n useSelf,\n} from \"@liveblocks/react\";\nimport React, { useContext, useSyncExternalStore } from \"react\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\nconst _cachesByClient = new WeakMap<OpaqueClient, Map<string, string[]>>();\n\nfunction getMentionSuggestionsCacheForClient(client: OpaqueClient) {\n let cache = _cachesByClient.get(client);\n if (!cache) {\n cache = new Map();\n _cachesByClient.set(client, cache);\n }\n return cache;\n}\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(search?: string) {\n const client = useClient();\n\n const room = useRoom();\n const [mentionSuggestions, setMentionSuggestions] =\n React.useState<string[]>();\n const lastInvokedAt = React.useRef<number>();\n\n React.useEffect(() => {\n const resolveMentionSuggestions =\n client[kInternal].resolveMentionSuggestions;\n\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId: room.id };\n const mentionSuggestionsCacheKey = stringify(resolveMentionSuggestionsArgs);\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [client, room.id, search]);\n\n return mentionSuggestions;\n}\n\nfunction useCurrentUserIdFromRoom() {\n return useSelf((user) => (typeof user.id === \"string\" ? user.id : null));\n}\n\nfunction useCurrentUserIdFromClient_withClient(client: OpaqueClient) {\n const currentUserIdStore = client[kInternal].currentUserIdStore;\n return useSyncExternalStore(\n currentUserIdStore.subscribe,\n currentUserIdStore.get,\n currentUserIdStore.get\n );\n}\n\nexport function useCurrentUserId(): string | null {\n const client = useContext(ClientContext);\n const room = useContext(RoomContext);\n\n // NOTE: These hooks are called conditionally, but in a way that will not\n // take different code paths between re-renders, so we can ignore the\n // rules-of-hooks lint warning here.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (room !== null) {\n return useCurrentUserIdFromRoom();\n } else if (client !== null) {\n return useCurrentUserIdFromClient_withClient(client);\n } else {\n raise(\n \"LiveblocksProvider or RoomProvider are missing from the React tree.\"\n );\n }\n /* eslint-enable react-hooks/rules-of-hooks */\n}\n"],"names":["useClient","useRoom","kInternal","stringify","mentionSuggestions","useSelf","useSyncExternalStore","useContext","ClientContext","RoomContext","raise"],"mappings":";;;;;;AAWA,MAAM,4BAA+B,GAAA,GAAA,CAAA;AAErC,MAAM,eAAA,uBAAsB,OAA6C,EAAA,CAAA;AAEzE,SAAS,oCAAoC,MAAsB,EAAA;AACjE,EAAI,IAAA,KAAA,GAAQ,eAAgB,CAAA,GAAA,CAAI,MAAM,CAAA,CAAA;AACtC,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAA,KAAA,uBAAY,GAAI,EAAA,CAAA;AAChB,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AAmB,CAAA,GAAA;AAAA,GACrB,CAAA;AACF,CAAA;AAEO,SAAS,gBAAkC,GAAA;AAChD,EAAM,MAAA,MAAA,GAASC,iBAAWC,mBAAa,CAAA,CAAA;AACvC,EAAM,MAAA,IAAA,GAAOD,iBAAWE,iBAAW,CAAA,CAAA;AAMnC,EAAA,IAAI,SAAS,IAAM,EAAA;AACjB,IAAA,OAAO,wBAAyB,EAAA,CAAA;AAAA,GAClC,MAAA,IAAW,WAAW,IAAM,EAAA;AAC1B,IAAA,OAAO,sCAAsC,MAAM,CAAA,CAAA;AAAA,GAC9C,MAAA;AACL,IAAAC,UAAA;AAAA,MACE,qEAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEF;;;;;"}
package/dist/shared.mjs CHANGED
@@ -14,7 +14,6 @@ function getMentionSuggestionsCacheForClient(client) {
14
14
  }
15
15
  function useMentionSuggestions(search) {
16
16
  const client = useClient();
17
- const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);
18
17
  const room = useRoom();
19
18
  const [mentionSuggestions, setMentionSuggestions] = React__default.useState();
20
19
  const lastInvokedAt = React__default.useRef();
@@ -27,6 +26,7 @@ function useMentionSuggestions(search) {
27
26
  const mentionSuggestionsCacheKey = stringify(resolveMentionSuggestionsArgs);
28
27
  let debounceTimeout;
29
28
  let isCanceled = false;
29
+ const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);
30
30
  const getMentionSuggestions = async () => {
31
31
  try {
32
32
  lastInvokedAt.current = performance.now();
@@ -59,7 +59,7 @@ function useMentionSuggestions(search) {
59
59
  isCanceled = true;
60
60
  window.clearTimeout(debounceTimeout);
61
61
  };
62
- }, [room.id, search]);
62
+ }, [client, room.id, search]);
63
63
  return mentionSuggestions;
64
64
  }
65
65
  function useCurrentUserIdFromRoom() {
@@ -1 +1 @@
1
- {"version":3,"file":"shared.mjs","sources":["../src/shared.ts"],"sourcesContent":["import type { OpaqueClient } from \"@liveblocks/core\";\nimport { kInternal, raise, stringify } from \"@liveblocks/core\";\nimport {\n ClientContext,\n RoomContext,\n useClient,\n useRoom,\n useSelf,\n} from \"@liveblocks/react\";\nimport React, { useContext, useSyncExternalStore } from \"react\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\nconst _cachesByClient = new WeakMap<OpaqueClient, Map<string, string[]>>();\n\nfunction getMentionSuggestionsCacheForClient(client: OpaqueClient) {\n let cache = _cachesByClient.get(client);\n if (!cache) {\n cache = new Map();\n _cachesByClient.set(client, cache);\n }\n return cache;\n}\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(search?: string) {\n const client = useClient();\n const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);\n\n const room = useRoom();\n const [mentionSuggestions, setMentionSuggestions] =\n React.useState<string[]>();\n const lastInvokedAt = React.useRef<number>();\n\n React.useEffect(() => {\n const resolveMentionSuggestions =\n client[kInternal].resolveMentionSuggestions;\n\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId: room.id };\n const mentionSuggestionsCacheKey = stringify(resolveMentionSuggestionsArgs);\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [room.id, search]);\n\n return mentionSuggestions;\n}\n\nfunction useCurrentUserIdFromRoom() {\n return useSelf((user) => (typeof user.id === \"string\" ? user.id : null));\n}\n\nfunction useCurrentUserIdFromClient_withClient(client: OpaqueClient) {\n const currentUserIdStore = client[kInternal].currentUserIdStore;\n return useSyncExternalStore(\n currentUserIdStore.subscribe,\n currentUserIdStore.get,\n currentUserIdStore.get\n );\n}\n\nexport function useCurrentUserId(): string | null {\n const client = useContext(ClientContext);\n const room = useContext(RoomContext);\n if (room !== null) {\n return useCurrentUserIdFromRoom();\n } else if (client !== null) {\n return useCurrentUserIdFromClient_withClient(client);\n } else {\n raise(\n \"LiveblocksProvider or RoomProvider are missing from the React tree.\"\n );\n }\n}\n"],"names":["React","mentionSuggestions"],"mappings":";;;;AAWA,MAAM,4BAA+B,GAAA,GAAA,CAAA;AAErC,MAAM,eAAA,uBAAsB,OAA6C,EAAA,CAAA;AAEzE,SAAS,oCAAoC,MAAsB,EAAA;AACjE,EAAI,IAAA,KAAA,GAAQ,eAAgB,CAAA,GAAA,CAAI,MAAM,CAAA,CAAA;AACtC,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAA,KAAA,uBAAY,GAAI,EAAA,CAAA;AAChB,IAAgB,eAAA,CAAA,GAAA,CAAI,QAAQ,KAAK,CAAA,CAAA;AAAA,GACnC;AACA,EAAO,OAAA,KAAA,CAAA;AACT,CAAA;AAQO,SAAS,sBAAsB,MAAiB,EAAA;AACrD,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,uBAAA,GAA0B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A,OAAO,wBAAyB,EAAA,CAAA;AAAA,GAClC,MAAA,IAAW,WAAW,IAAM,EAAA;AAC1B,IAAA,OAAO,sCAAsC,MAAM,CAAA,CAAA;AAAA,GAC9C,MAAA;AACL,IAAA,KAAA;AAAA,MACE,qEAAA;AAAA,KACF,CAAA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"shared.mjs","sources":["../src/shared.ts"],"sourcesContent":["import type { OpaqueClient } from \"@liveblocks/core\";\nimport { kInternal, raise, stringify } from \"@liveblocks/core\";\nimport {\n ClientContext,\n RoomContext,\n useClient,\n useRoom,\n useSelf,\n} from \"@liveblocks/react\";\nimport React, { useContext, useSyncExternalStore } from \"react\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\nconst _cachesByClient = new WeakMap<OpaqueClient, Map<string, string[]>>();\n\nfunction getMentionSuggestionsCacheForClient(client: OpaqueClient) {\n let cache = _cachesByClient.get(client);\n if (!cache) {\n cache = new Map();\n _cachesByClient.set(client, cache);\n }\n return cache;\n}\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(search?: string) {\n const client = useClient();\n\n const room = useRoom();\n const [mentionSuggestions, setMentionSuggestions] =\n React.useState<string[]>();\n const lastInvokedAt = React.useRef<number>();\n\n React.useEffect(() => {\n const resolveMentionSuggestions =\n client[kInternal].resolveMentionSuggestions;\n\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId: room.id };\n const mentionSuggestionsCacheKey = stringify(resolveMentionSuggestionsArgs);\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const mentionSuggestionsCache = getMentionSuggestionsCacheForClient(client);\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [client, room.id, search]);\n\n return mentionSuggestions;\n}\n\nfunction useCurrentUserIdFromRoom() {\n return useSelf((user) => (typeof user.id === \"string\" ? user.id : null));\n}\n\nfunction useCurrentUserIdFromClient_withClient(client: OpaqueClient) {\n const currentUserIdStore = client[kInternal].currentUserIdStore;\n return useSyncExternalStore(\n currentUserIdStore.subscribe,\n currentUserIdStore.get,\n currentUserIdStore.get\n );\n}\n\nexport function useCurrentUserId(): string | null {\n const client = useContext(ClientContext);\n const room = useContext(RoomContext);\n\n // NOTE: These hooks are called conditionally, but in a way that will not\n // take different code paths between re-renders, so we can ignore the\n // rules-of-hooks lint warning here.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (room !== null) {\n return useCurrentUserIdFromRoom();\n } else if (client !== null) {\n return useCurrentUserIdFromClient_withClient(client);\n } else {\n raise(\n \"LiveblocksProvider or RoomProvider are missing from the React tree.\"\n );\n }\n /* eslint-enable react-hooks/rules-of-hooks */\n}\n"],"names":["React","mentionSuggestions"],"mappings":";;;;AAWA,MAAM,4BAA+B,GAAA,GAAA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AAK,IAAK,CAAA,CAAA;AACzE,CAAA;AAEA,SAAS,sCAAsC,MAAsB,EAAA;AACnE,EAAM,MAAA,kBAAA,GAAqB,OAAO,SAAW,CAAA,CAAA,kBAAA,CAAA;AAC7C,EAAO,OAAA,oBAAA;AAAA,IACL,kBAAmB,CAAA,SAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,GACrB,CAAA;AACF,CAAA;AAEO,SAAS,gBAAkC,GAAA;AAChD,EAAM,MAAA,MAAA,GAAS,WAAW,aAAa,CAAA,CAAA;AACvC,EAAM,MAAA,IAAA,GAAO,WAAW,WAAW,CAAA,CAAA;AAMnC,EAAA,IAAI,SAAS,IAAM,EAAA;AACjB,IAAA,OAAO,wBAAyB,EAAA,CAAA;AAAA,GAClC,MAAA,IAAW,WAAW,IAAM,EAAA;AAC1B,IAAA,OAAO,sCAAsC,MAAM,CAAA,CAAA;AAAA,GAC9C,MAAA;AACL,IAAA,KAAA;AAAA,MACE,qEAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEF;;;;"}
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const PKG_NAME = "@liveblocks/react-ui";
4
- const PKG_VERSION = "2.0.0-alpha1";
4
+ const PKG_VERSION = "2.0.0-alpha3";
5
5
  const PKG_FORMAT = "cjs";
6
6
 
7
7
  exports.PKG_FORMAT = PKG_FORMAT;
package/dist/version.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const PKG_NAME = "@liveblocks/react-ui";
2
- const PKG_VERSION = "2.0.0-alpha1";
2
+ const PKG_VERSION = "2.0.0-alpha3";
3
3
  const PKG_FORMAT = "esm";
4
4
 
5
5
  export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/react-ui",
3
- "version": "2.0.0-alpha1",
3
+ "version": "2.0.0-alpha3",
4
4
  "description": "A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",
@@ -58,13 +58,14 @@
58
58
  "lint": "eslint src/; stylelint src/styles/",
59
59
  "lint:package": "publint --strict && attw --pack",
60
60
  "test": "jest --silent --verbose --color=always",
61
+ "test:types": "ls test-d/* | xargs -n1 tsd --files",
61
62
  "test:watch": "jest --silent --verbose --color=always --watch"
62
63
  },
63
64
  "dependencies": {
64
65
  "@floating-ui/react-dom": "^2.0.8",
65
- "@liveblocks/client": "2.0.0-alpha1",
66
- "@liveblocks/core": "2.0.0-alpha1",
67
- "@liveblocks/react": "2.0.0-alpha1",
66
+ "@liveblocks/client": "2.0.0-alpha3",
67
+ "@liveblocks/core": "2.0.0-alpha3",
68
+ "@liveblocks/react": "2.0.0-alpha3",
68
69
  "@radix-ui/react-dropdown-menu": "^2.0.6",
69
70
  "@radix-ui/react-popover": "^1.0.7",
70
71
  "@radix-ui/react-slot": "^1.0.2",
@@ -74,7 +75,7 @@
74
75
  "slate": "^0.102.0",
75
76
  "slate-history": "^0.100.0",
76
77
  "slate-react": "^0.102.0",
77
- "use-sync-external-store": "^1.2.0"
78
+ "use-sync-external-store": "^1.2.2"
78
79
  },
79
80
  "peerDependencies": {
80
81
  "react": "^16.14.0 || ^17 || ^18"
@@ -86,7 +87,7 @@
86
87
  "@rollup/plugin-typescript": "^11.1.2",
87
88
  "@testing-library/jest-dom": "^5.16.5",
88
89
  "@testing-library/react": "^13.1.1",
89
- "@types/use-sync-external-store": "^0.0.3",
90
+ "@types/use-sync-external-store": "^0.0.6",
90
91
  "emojibase": "^15.3.0",
91
92
  "eslint-plugin-react": "^7.33.2",
92
93
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -98,6 +98,7 @@
98
98
  var(--lb-foreground-contrast),
99
99
  800
100
100
  );
101
+ --lb-selection: color-mix(in srgb, var(--lb-accent) 40%, transparent);
101
102
 
102
103
  overflow-wrap: break-word;
103
104
  accent-color: var(--lb-accent);