@liveblocks/react-ui 2.7.0-beta1 → 2.7.0-versions

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 (142) hide show
  1. package/_private/README.md +5 -0
  2. package/_private/package.json +4 -0
  3. package/dist/_private/index.d.mts +72 -0
  4. package/dist/_private/index.d.ts +72 -0
  5. package/dist/_private/index.js +46 -0
  6. package/dist/_private/index.js.map +1 -0
  7. package/dist/_private/index.mjs +21 -0
  8. package/dist/_private/index.mjs.map +1 -0
  9. package/dist/components/Comment.js +7 -65
  10. package/dist/components/Comment.js.map +1 -1
  11. package/dist/components/Comment.mjs +9 -66
  12. package/dist/components/Comment.mjs.map +1 -1
  13. package/dist/components/Composer.js +101 -217
  14. package/dist/components/Composer.js.map +1 -1
  15. package/dist/components/Composer.mjs +104 -220
  16. package/dist/components/Composer.mjs.map +1 -1
  17. package/dist/components/HistoryVersionSummary.js +42 -0
  18. package/dist/components/HistoryVersionSummary.js.map +1 -0
  19. package/dist/components/HistoryVersionSummary.mjs +40 -0
  20. package/dist/components/HistoryVersionSummary.mjs.map +1 -0
  21. package/dist/components/HistoryVersionSummaryList.js +22 -0
  22. package/dist/components/HistoryVersionSummaryList.js.map +1 -0
  23. package/dist/components/HistoryVersionSummaryList.mjs +20 -0
  24. package/dist/components/HistoryVersionSummaryList.mjs.map +1 -0
  25. package/dist/components/InboxNotification.js +10 -25
  26. package/dist/components/InboxNotification.js.map +1 -1
  27. package/dist/components/InboxNotification.mjs +10 -25
  28. package/dist/components/InboxNotification.mjs.map +1 -1
  29. package/dist/components/Thread.js +0 -2
  30. package/dist/components/Thread.js.map +1 -1
  31. package/dist/components/Thread.mjs +0 -2
  32. package/dist/components/Thread.mjs.map +1 -1
  33. package/dist/components/internal/Button.js +8 -1
  34. package/dist/components/internal/Button.js.map +1 -1
  35. package/dist/components/internal/Button.mjs +8 -1
  36. package/dist/components/internal/Button.mjs.map +1 -1
  37. package/dist/components/internal/EmojiPicker.js +3 -3
  38. package/dist/components/internal/EmojiPicker.js.map +1 -1
  39. package/dist/components/internal/EmojiPicker.mjs +3 -3
  40. package/dist/components/internal/EmojiPicker.mjs.map +1 -1
  41. package/dist/components/internal/InboxNotificationThread.js +2 -10
  42. package/dist/components/internal/InboxNotificationThread.js.map +1 -1
  43. package/dist/components/internal/InboxNotificationThread.mjs +3 -11
  44. package/dist/components/internal/InboxNotificationThread.mjs.map +1 -1
  45. package/dist/components/internal/User.js +3 -19
  46. package/dist/components/internal/User.js.map +1 -1
  47. package/dist/components/internal/User.mjs +3 -19
  48. package/dist/components/internal/User.mjs.map +1 -1
  49. package/dist/icons/ArrowUp.js +15 -0
  50. package/dist/icons/ArrowUp.js.map +1 -0
  51. package/dist/icons/ArrowUp.mjs +13 -0
  52. package/dist/icons/ArrowUp.mjs.map +1 -0
  53. package/dist/icons/{Warning.js → Missing.js} +3 -3
  54. package/dist/icons/{Warning.js.map → Missing.js.map} +1 -1
  55. package/dist/icons/{Warning.mjs → Missing.mjs} +3 -3
  56. package/dist/icons/{Warning.mjs.map → Missing.mjs.map} +1 -1
  57. package/dist/icons/Restore.js +17 -0
  58. package/dist/icons/Restore.js.map +1 -0
  59. package/dist/icons/Restore.mjs +15 -0
  60. package/dist/icons/Restore.mjs.map +1 -0
  61. package/dist/icons/Spinner.js +9 -3
  62. package/dist/icons/Spinner.js.map +1 -1
  63. package/dist/icons/Spinner.mjs +10 -4
  64. package/dist/icons/Spinner.mjs.map +1 -1
  65. package/dist/index.d.mts +74 -70
  66. package/dist/index.d.ts +74 -70
  67. package/dist/index.js +6 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/index.mjs +3 -0
  70. package/dist/index.mjs.map +1 -1
  71. package/dist/overrides.js +5 -6
  72. package/dist/overrides.js.map +1 -1
  73. package/dist/overrides.mjs +5 -6
  74. package/dist/overrides.mjs.map +1 -1
  75. package/dist/primitives/Composer/contexts.js +3 -17
  76. package/dist/primitives/Composer/contexts.js.map +1 -1
  77. package/dist/primitives/Composer/contexts.mjs +4 -15
  78. package/dist/primitives/Composer/contexts.mjs.map +1 -1
  79. package/dist/primitives/Composer/index.js +26 -185
  80. package/dist/primitives/Composer/index.js.map +1 -1
  81. package/dist/primitives/Composer/index.mjs +31 -188
  82. package/dist/primitives/Composer/index.mjs.map +1 -1
  83. package/dist/primitives/Composer/utils.js +0 -224
  84. package/dist/primitives/Composer/utils.js.map +1 -1
  85. package/dist/primitives/Composer/utils.mjs +1 -222
  86. package/dist/primitives/Composer/utils.mjs.map +1 -1
  87. package/dist/primitives/EmojiPicker/utils.js +2 -2
  88. package/dist/primitives/EmojiPicker/utils.js.map +1 -1
  89. package/dist/primitives/EmojiPicker/utils.mjs +1 -1
  90. package/dist/primitives/EmojiPicker/utils.mjs.map +1 -1
  91. package/dist/primitives/index.d.mts +3 -83
  92. package/dist/primitives/index.d.ts +3 -83
  93. package/dist/primitives/index.js +0 -4
  94. package/dist/primitives/index.js.map +1 -1
  95. package/dist/primitives/index.mjs +0 -2
  96. package/dist/primitives/index.mjs.map +1 -1
  97. package/dist/utils/chunk.js +12 -0
  98. package/dist/utils/chunk.js.map +1 -0
  99. package/dist/utils/chunk.mjs +10 -0
  100. package/dist/utils/chunk.mjs.map +1 -0
  101. package/dist/utils/intl.js +0 -6
  102. package/dist/utils/intl.js.map +1 -1
  103. package/dist/utils/intl.mjs +1 -6
  104. package/dist/utils/intl.mjs.map +1 -1
  105. package/dist/utils/use-initial.js +1 -2
  106. package/dist/utils/use-initial.js.map +1 -1
  107. package/dist/utils/use-initial.mjs +2 -3
  108. package/dist/utils/use-initial.mjs.map +1 -1
  109. package/dist/version.js +1 -1
  110. package/dist/version.js.map +1 -1
  111. package/dist/version.mjs +1 -1
  112. package/dist/version.mjs.map +1 -1
  113. package/package.json +16 -4
  114. package/src/styles/dark/index.css +0 -1
  115. package/src/styles/index.css +219 -325
  116. package/src/styles/utils.css +6 -44
  117. package/styles/dark/attributes.css +1 -1
  118. package/styles/dark/attributes.css.map +1 -1
  119. package/styles/dark/media-query.css +1 -1
  120. package/styles/dark/media-query.css.map +1 -1
  121. package/styles.css +1 -1
  122. package/styles.css.map +1 -1
  123. package/dist/components/internal/Attachment.js +0 -226
  124. package/dist/components/internal/Attachment.js.map +0 -1
  125. package/dist/components/internal/Attachment.mjs +0 -224
  126. package/dist/components/internal/Attachment.mjs.map +0 -1
  127. package/dist/icons/Attachment.js +0 -15
  128. package/dist/icons/Attachment.js.map +0 -1
  129. package/dist/icons/Attachment.mjs +0 -13
  130. package/dist/icons/Attachment.mjs.map +0 -1
  131. package/dist/primitives/FileSize.js +0 -33
  132. package/dist/primitives/FileSize.js.map +0 -1
  133. package/dist/primitives/FileSize.mjs +0 -31
  134. package/dist/primitives/FileSize.mjs.map +0 -1
  135. package/dist/utils/download.js +0 -14
  136. package/dist/utils/download.js.map +0 -1
  137. package/dist/utils/download.mjs +0 -12
  138. package/dist/utils/download.mjs.map +0 -1
  139. package/dist/utils/format-file-size.js +0 -45
  140. package/dist/utils/format-file-size.js.map +0 -1
  141. package/dist/utils/format-file-size.mjs +0 -43
  142. package/dist/utils/format-file-size.mjs.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { CommentAttachment, CommentData, CommentBody, BaseMetadata, DM, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
2
- import React, { ElementType, ComponentPropsWithoutRef, ReactNode, MouseEvent, FormEvent, ComponentType, RefAttributes, ComponentProps, PropsWithChildren } from 'react';
1
+ import { CommentData, CommentBody, BaseMetadata, DM, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
2
+ import React, { ElementType, ComponentPropsWithoutRef, ReactNode, MouseEvent, ComponentType, FormEvent, RefAttributes, ComponentProps, PropsWithChildren } from 'react';
3
3
 
4
4
  declare type Direction = "ltr" | "rtl";
5
5
  declare type SlotProp = {
@@ -9,16 +9,6 @@ declare type SlotProp = {
9
9
  asChild?: boolean;
10
10
  };
11
11
  declare type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
12
- interface CommentAttachmentArgs {
13
- /**
14
- * The attachment.
15
- */
16
- attachment: CommentAttachment;
17
- /**
18
- * A presigned URL for the attachment.
19
- */
20
- url: string;
21
- }
22
12
 
23
13
  interface LocalizationOverrides {
24
14
  locale: string;
@@ -33,8 +23,6 @@ interface GlobalOverrides {
33
23
  EMOJI_PICKER_SEARCH_PLACEHOLDER: string;
34
24
  EMOJI_PICKER_EMPTY: ReactNode;
35
25
  EMOJI_PICKER_ERROR: (error: Error) => ReactNode;
36
- ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;
37
- ATTACHMENT_ERROR: (error: Error) => string;
38
26
  }
39
27
  interface CommentOverrides {
40
28
  COMMENT_EDITED: ReactNode;
@@ -45,7 +33,6 @@ interface CommentOverrides {
45
33
  COMMENT_EDIT_COMPOSER_CANCEL: string;
46
34
  COMMENT_EDIT_COMPOSER_SAVE: string;
47
35
  COMMENT_DELETE: string;
48
- COMMENT_DELETE_ATTACHMENT: string;
49
36
  COMMENT_ADD_REACTION: string;
50
37
  COMMENT_REACTION_LIST: (list: ReactNode, emoji: string, count: number) => ReactNode;
51
38
  COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;
@@ -53,8 +40,6 @@ interface CommentOverrides {
53
40
  interface ComposerOverrides {
54
41
  COMPOSER_INSERT_MENTION: string;
55
42
  COMPOSER_INSERT_EMOJI: string;
56
- COMPOSER_ATTACH_FILES: string;
57
- COMPOSER_REMOVE_ATTACHMENT: string;
58
43
  COMPOSER_PLACEHOLDER: string;
59
44
  COMPOSER_SEND: string;
60
45
  }
@@ -74,7 +59,13 @@ interface InboxNotificationOverrides {
74
59
  INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode | undefined) => ReactNode;
75
60
  INBOX_NOTIFICATION_TEXT_MENTION: (user: ReactNode, room: ReactNode | undefined) => ReactNode;
76
61
  }
77
- declare type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides;
62
+ interface HistoryVersionPreviewOverrides {
63
+ HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list: ReactNode) => ReactNode;
64
+ HISTORY_VERSION_PREVIEW_RESTORE: string;
65
+ HISTORY_VERSION_PREVIEW_EMPTY: ReactNode;
66
+ HISTORY_VERSION_PREVIEW_ERROR: (error: Error) => ReactNode;
67
+ }
68
+ declare type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides & HistoryVersionPreviewOverrides;
78
69
  declare function useOverrides(overrides?: Partial<Overrides>): Overrides;
79
70
 
80
71
  interface CommentProps extends ComponentPropsWithoutRef<"div"> {
@@ -94,10 +85,6 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
94
85
  * Whether to show reactions.
95
86
  */
96
87
  showReactions?: boolean;
97
- /**
98
- * Whether to show attachments.
99
- */
100
- showAttachments?: boolean;
101
88
  /**
102
89
  * Whether to indent the comment's content.
103
90
  */
@@ -118,10 +105,6 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
118
105
  * The event handler called when clicking on a mention.
119
106
  */
120
107
  onMentionClick?: (userId: string, event: MouseEvent<HTMLElement>) => void;
121
- /**
122
- * The event handler called when clicking on a comment's attachment.
123
- */
124
- onAttachmentClick?: (args: CommentAttachmentArgs, event: MouseEvent<HTMLElement>) => void;
125
108
  /**
126
109
  * Override the component's strings.
127
110
  */
@@ -213,29 +196,11 @@ interface ComposerEditorProps extends Omit<ComponentPropsWithoutRef<"div">, "def
213
196
  */
214
197
  components?: Partial<ComposerEditorComponents>;
215
198
  }
216
- interface ComposerFormProps extends ComponentPropsWithSlot<"form"> {
217
- /**
218
- * The event handler called when the form is submitted.
219
- */
220
- onComposerSubmit?: (comment: ComposerSubmitComment, event: FormEvent<HTMLFormElement>) => Promise<void> | void;
221
- /**
222
- * Whether the composer is disabled.
223
- */
224
- disabled?: boolean;
225
- /**
226
- * The composer's initial attachments.
227
- */
228
- defaultAttachments?: CommentAttachment[];
229
- }
230
199
  interface ComposerSubmitComment {
231
200
  /**
232
201
  * The submitted comment's body.
233
202
  */
234
203
  body: CommentBody;
235
- /**
236
- * The submitted comment's uploaded attachments.
237
- */
238
- attachments: CommentAttachment[];
239
204
  }
240
205
 
241
206
  declare type ComposerCreateThreadProps<M extends BaseMetadata> = {
@@ -274,10 +239,6 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
274
239
  * The composer's initial value.
275
240
  */
276
241
  defaultValue?: ComposerEditorProps["defaultValue"];
277
- /**
278
- * The composer's initial attachments.
279
- */
280
- defaultAttachments?: CommentAttachment[];
281
242
  /**
282
243
  * Whether the composer is collapsed. Setting a value will make the composer controlled.
283
244
  */
@@ -290,14 +251,10 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
290
251
  * Whether the composer is initially collapsed. Setting a value will make the composer uncontrolled.
291
252
  */
292
253
  defaultCollapsed?: boolean;
293
- /**
294
- * Whether to show and allow adding attachments.
295
- */
296
- showAttachments?: boolean;
297
254
  /**
298
255
  * Whether the composer is disabled.
299
256
  */
300
- disabled?: ComposerFormProps["disabled"];
257
+ disabled?: ComposerEditorProps["disabled"];
301
258
  /**
302
259
  * Whether to focus the composer on mount.
303
260
  */
@@ -315,6 +272,31 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
315
272
  */
316
273
  declare const Composer: <M extends BaseMetadata = BaseMetadata>(props: ComposerProps<M> & RefAttributes<HTMLFormElement>) => JSX.Element;
317
274
 
275
+ interface HistoryVersionSummaryProps extends ComponentPropsWithoutRef<"button"> {
276
+ version: HistoryVersion;
277
+ selected?: boolean;
278
+ }
279
+ /**
280
+ * Displays some information about a version.
281
+ *
282
+ * @example
283
+ * <HistoryVersionSummary version={version} />
284
+ */
285
+ declare const HistoryVersionSummary: React.ForwardRefExoticComponent<HistoryVersionSummaryProps & React.RefAttributes<HTMLButtonElement>>;
286
+
287
+ declare type HistoryVersionSummaryListProps = ComponentPropsWithoutRef<"ol">;
288
+ /**
289
+ * Displays versions summaries as a list.
290
+ *
291
+ * @example
292
+ * <HistoryVersionSummaryList>
293
+ * {versions.map((version) => (
294
+ * <HistoryVersionSummary key={version.id} version={version} />
295
+ * ))}
296
+ * </HistoryVersionSummaryList>
297
+ */
298
+ declare const HistoryVersionSummaryList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
299
+
318
300
  interface GlobalComponents {
319
301
  Anchor: ComponentType<ComponentPropsWithoutRef<"a">> | "a";
320
302
  }
@@ -367,14 +349,6 @@ interface InboxNotificationThreadProps extends Omit<InboxNotificationProps, "kin
367
349
  * Whether to show the room name in the title.
368
350
  */
369
351
  showRoomName?: boolean;
370
- /**
371
- * Whether to show reactions.
372
- */
373
- showReactions?: boolean;
374
- /**
375
- * Whether to show attachments.
376
- */
377
- showAttachments?: boolean;
378
352
  }
379
353
  interface InboxNotificationTextMentionProps extends Omit<InboxNotificationProps, "kinds">, InboxNotificationSharedProps {
380
354
  /**
@@ -486,10 +460,6 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
486
460
  * Whether to show deleted comments.
487
461
  */
488
462
  showDeletedComments?: CommentProps["showDeleted"];
489
- /**
490
- * Whether to show attachments.
491
- */
492
- showAttachments?: boolean;
493
463
  /**
494
464
  * The event handler called when changing the resolved status.
495
465
  */
@@ -515,10 +485,6 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
515
485
  * The event handler called when clicking on a mention.
516
486
  */
517
487
  onMentionClick?: CommentProps["onMentionClick"];
518
- /**
519
- * The event handler called when clicking on a comment's attachment.
520
- */
521
- onAttachmentClick?: CommentProps["onAttachmentClick"];
522
488
  /**
523
489
  * Override the component's strings.
524
490
  */
@@ -561,6 +527,44 @@ declare type LiveblocksUIConfigProps = PropsWithChildren<{
561
527
  */
562
528
  declare function LiveblocksUIConfig({ overrides, components, portalContainer, children, }: LiveblocksUIConfigProps): React.JSX.Element;
563
529
 
530
+ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children" | "title"> {
531
+ /**
532
+ * The date to display.
533
+ */
534
+ date: Date | string | number;
535
+ /**
536
+ * A function to format the displayed date.
537
+ */
538
+ children?: (date: Date, locale?: string) => ReactNode;
539
+ /**
540
+ * The `title` attribute's value or a function to format it.
541
+ */
542
+ title?: string | ((date: Date, locale?: string) => string);
543
+ /**
544
+ * The interval in milliseconds at which the component will re-render.
545
+ * Can be set to `false` to disable re-rendering.
546
+ */
547
+ interval?: number | false;
548
+ /**
549
+ * The locale used when formatting the date.
550
+ */
551
+ locale?: string;
552
+ }
553
+ /**
554
+ * Displays a formatted date, and automatically re-renders to support relative
555
+ * formatting. Defaults to relative formatting for recent dates and a short
556
+ * absolute formatting for older ones.
557
+ *
558
+ * @example
559
+ * <Timestamp date={new Date()} />
560
+ *
561
+ * @example
562
+ * <Timestamp date={new Date()} title={(date) => date.toISOString()} interval={false}>
563
+ * {(date) => date.toLocaleDateString()}
564
+ * </Timestamp>
565
+ */
566
+ declare const Timestamp: React.ForwardRefExoticComponent<TimestampProps & React.RefAttributes<HTMLTimeElement>>;
567
+
564
568
  /**
565
569
  * @private For internal use only. Do not rely on this hook.
566
570
  *
@@ -569,4 +573,4 @@ declare function LiveblocksUIConfig({ overrides, components, portalContainer, ch
569
573
  */
570
574
  declare function useMentionSuggestions(search?: string): string[] | undefined;
571
575
 
572
- export { Comment, CommentAttachmentArgs, 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, ThreadProps, useMentionSuggestions, useOverrides };
576
+ export { Comment, CommentOverrides, CommentProps, Composer, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, HistoryVersionSummary, HistoryVersionSummaryList, HistoryVersionSummaryListProps, HistoryVersionSummaryProps, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, Timestamp, useMentionSuggestions, useOverrides };
package/dist/index.js CHANGED
@@ -4,21 +4,27 @@ var core = require('@liveblocks/core');
4
4
  var version = require('./version.js');
5
5
  var Comment = require('./components/Comment.js');
6
6
  var Composer = require('./components/Composer.js');
7
+ var HistoryVersionSummary = require('./components/HistoryVersionSummary.js');
8
+ var HistoryVersionSummaryList = require('./components/HistoryVersionSummaryList.js');
7
9
  var InboxNotification = require('./components/InboxNotification.js');
8
10
  var InboxNotificationList = require('./components/InboxNotificationList.js');
9
11
  var Thread = require('./components/Thread.js');
10
12
  var config = require('./config.js');
11
13
  var overrides = require('./overrides.js');
14
+ var Timestamp = require('./primitives/Timestamp.js');
12
15
  var shared = require('./shared.js');
13
16
 
14
17
  core.detectDupes(version.PKG_NAME, version.PKG_VERSION, version.PKG_FORMAT);
15
18
 
16
19
  exports.Comment = Comment.Comment;
17
20
  exports.Composer = Composer.Composer;
21
+ exports.HistoryVersionSummary = HistoryVersionSummary.HistoryVersionSummary;
22
+ exports.HistoryVersionSummaryList = HistoryVersionSummaryList.HistoryVersionSummaryList;
18
23
  exports.InboxNotification = InboxNotification.InboxNotification;
19
24
  exports.InboxNotificationList = InboxNotificationList.InboxNotificationList;
20
25
  exports.Thread = Thread.Thread;
21
26
  exports.LiveblocksUIConfig = config.LiveblocksUIConfig;
22
27
  exports.useOverrides = overrides.useOverrides;
28
+ exports.Timestamp = Timestamp.Timestamp;
23
29
  exports.useMentionSuggestions = shared.useMentionSuggestions;
24
30
  //# 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 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} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\nexport type { CommentAttachmentArgs } from \"./types\";\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 { HistoryVersionSummaryProps } from \"./components/HistoryVersionSummary\";\nexport { HistoryVersionSummary } from \"./components/HistoryVersionSummary\";\nexport type { HistoryVersionSummaryListProps } from \"./components/HistoryVersionSummaryList\";\nexport { HistoryVersionSummaryList } from \"./components/HistoryVersionSummaryList\";\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} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { Timestamp } from \"./primitives/Timestamp\";\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
@@ -2,11 +2,14 @@ import { detectDupes } from '@liveblocks/core';
2
2
  import { PKG_NAME, PKG_VERSION, PKG_FORMAT } from './version.mjs';
3
3
  export { Comment } from './components/Comment.mjs';
4
4
  export { Composer } from './components/Composer.mjs';
5
+ export { HistoryVersionSummary } from './components/HistoryVersionSummary.mjs';
6
+ export { HistoryVersionSummaryList } from './components/HistoryVersionSummaryList.mjs';
5
7
  export { InboxNotification } from './components/InboxNotification.mjs';
6
8
  export { InboxNotificationList } from './components/InboxNotificationList.mjs';
7
9
  export { Thread } from './components/Thread.mjs';
8
10
  export { LiveblocksUIConfig } from './config.mjs';
9
11
  export { useOverrides } from './overrides.mjs';
12
+ export { Timestamp } from './primitives/Timestamp.mjs';
10
13
  export { useMentionSuggestions } from './shared.mjs';
11
14
 
12
15
  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 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} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\nexport type { CommentAttachmentArgs } from \"./types\";\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 { HistoryVersionSummaryProps } from \"./components/HistoryVersionSummary\";\nexport { HistoryVersionSummary } from \"./components/HistoryVersionSummary\";\nexport type { HistoryVersionSummaryListProps } from \"./components/HistoryVersionSummaryList\";\nexport { HistoryVersionSummaryList } from \"./components/HistoryVersionSummaryList\";\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} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { Timestamp } from \"./primitives/Timestamp\";\nexport { useMentionSuggestions } from \"./shared\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
package/dist/overrides.js CHANGED
@@ -35,12 +35,8 @@ const defaultOverrides = {
35
35
  EMOJI_PICKER_SEARCH_PLACEHOLDER: "Search\u2026",
36
36
  EMOJI_PICKER_EMPTY: "No emoji found.",
37
37
  EMOJI_PICKER_ERROR: () => "There was an error while getting the list of emoji.",
38
- ATTACHMENT_TOO_LARGE: (maxSize) => maxSize ? `The file is larger than ${maxSize}` : "The file is too large",
39
- ATTACHMENT_ERROR: () => "The file couldn\u2019t be uploaded.",
40
38
  COMPOSER_INSERT_MENTION: "Mention someone",
41
39
  COMPOSER_INSERT_EMOJI: "Add emoji",
42
- COMPOSER_ATTACH_FILES: "Attach files",
43
- COMPOSER_REMOVE_ATTACHMENT: "Remove attachment",
44
40
  COMPOSER_PLACEHOLDER: "Write a comment\u2026",
45
41
  COMPOSER_SEND: "Send",
46
42
  COMMENT_EDITED: "(edited)",
@@ -51,7 +47,6 @@ const defaultOverrides = {
51
47
  COMMENT_EDIT_COMPOSER_CANCEL: "Cancel",
52
48
  COMMENT_EDIT_COMPOSER_SAVE: "Save",
53
49
  COMMENT_DELETE: "Delete comment",
54
- COMMENT_DELETE_ATTACHMENT: "Delete attachment",
55
50
  COMMENT_ADD_REACTION: "Add reaction",
56
51
  COMMENT_REACTION_LIST: (list, emoji) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, list, " reacted with ", /* @__PURE__ */ React__namespace.createElement(Emoji.Emoji, {
57
52
  emoji
@@ -68,7 +63,11 @@ const defaultOverrides = {
68
63
  INBOX_NOTIFICATION_DELETE: "Delete notification",
69
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")),
70
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),
71
- 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)
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),
67
+ HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, "Edits from ", list),
68
+ HISTORY_VERSION_PREVIEW_RESTORE: "Restore",
69
+ HISTORY_VERSION_PREVIEW_EMPTY: "No content.",
70
+ HISTORY_VERSION_PREVIEW_ERROR: () => "There was an error while getting this version."
72
71
  };
73
72
  const OverridesContext = React.createContext(void 0);
74
73
  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 ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;\n ATTACHMENT_ERROR: (error: Error) => string;\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_DELETE_ATTACHMENT: 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_ATTACH_FILES: string;\n COMPOSER_REMOVE_ATTACHMENT: 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_DELETE: 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 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 ATTACHMENT_TOO_LARGE: (maxSize) =>\n maxSize ? `The file is larger than ${maxSize}` : \"The file is too large\",\n ATTACHMENT_ERROR: () => \"The file couldn’t be uploaded.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_ATTACH_FILES: \"Attach files\",\n COMPOSER_REMOVE_ATTACHMENT: \"Remove attachment\",\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_DELETE_ATTACHMENT: \"Delete attachment\",\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_DELETE: \"Delete notification\",\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+FO;AAAoC;AACjC;AACH;AACM;AACG;AACgB;AACuC;AAExB;AACZ;AACb;AAElB;AAEiD;AAC3B;AACC;AACF;AACA;AACK;AACN;AACP;AACC;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACW;AACL;AAGG;AAAM;AAC7B;AAGwD;AAC1C;AACE;AACI;AACY;AACL;AACP;AACG;AACQ;AACN;AAQzB;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;;;;;"}
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_DELETE: 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 interface HistoryVersionPreviewOverrides {\n HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list: ReactNode) => ReactNode;\n HISTORY_VERSION_PREVIEW_RESTORE: string;\n HISTORY_VERSION_PREVIEW_EMPTY: ReactNode;\n HISTORY_VERSION_PREVIEW_ERROR: (error: Error) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n InboxNotificationOverrides &\n HistoryVersionPreviewOverrides;\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_DELETE: \"Delete notification\",\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 HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list: ReactNode) => (\n <>Edits from {list}</>\n ),\n HISTORY_VERSION_PREVIEW_RESTORE: \"Restore\",\n HISTORY_VERSION_PREVIEW_EMPTY: \"No content.\",\n HISTORY_VERSION_PREVIEW_ERROR: () =>\n \"There was an error while getting this version.\",\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkGO;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;AACN;AAQzB;AAKA;AAKA;AAGmB;AAEY;AACF;AAGjC;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;;;;;"}
@@ -15,12 +15,8 @@ const defaultOverrides = {
15
15
  EMOJI_PICKER_SEARCH_PLACEHOLDER: "Search\u2026",
16
16
  EMOJI_PICKER_EMPTY: "No emoji found.",
17
17
  EMOJI_PICKER_ERROR: () => "There was an error while getting the list of emoji.",
18
- ATTACHMENT_TOO_LARGE: (maxSize) => maxSize ? `The file is larger than ${maxSize}` : "The file is too large",
19
- ATTACHMENT_ERROR: () => "The file couldn\u2019t be uploaded.",
20
18
  COMPOSER_INSERT_MENTION: "Mention someone",
21
19
  COMPOSER_INSERT_EMOJI: "Add emoji",
22
- COMPOSER_ATTACH_FILES: "Attach files",
23
- COMPOSER_REMOVE_ATTACHMENT: "Remove attachment",
24
20
  COMPOSER_PLACEHOLDER: "Write a comment\u2026",
25
21
  COMPOSER_SEND: "Send",
26
22
  COMMENT_EDITED: "(edited)",
@@ -31,7 +27,6 @@ const defaultOverrides = {
31
27
  COMMENT_EDIT_COMPOSER_CANCEL: "Cancel",
32
28
  COMMENT_EDIT_COMPOSER_SAVE: "Save",
33
29
  COMMENT_DELETE: "Delete comment",
34
- COMMENT_DELETE_ATTACHMENT: "Delete attachment",
35
30
  COMMENT_ADD_REACTION: "Add reaction",
36
31
  COMMENT_REACTION_LIST: (list, emoji) => /* @__PURE__ */ React.createElement(React.Fragment, null, list, " reacted with ", /* @__PURE__ */ React.createElement(Emoji, {
37
32
  emoji
@@ -48,7 +43,11 @@ const defaultOverrides = {
48
43
  INBOX_NOTIFICATION_DELETE: "Delete notification",
49
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")),
50
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),
51
- 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)
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),
47
+ HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list) => /* @__PURE__ */ React.createElement(React.Fragment, null, "Edits from ", list),
48
+ HISTORY_VERSION_PREVIEW_RESTORE: "Restore",
49
+ HISTORY_VERSION_PREVIEW_EMPTY: "No content.",
50
+ HISTORY_VERSION_PREVIEW_ERROR: () => "There was an error while getting this version."
52
51
  };
53
52
  const OverridesContext = createContext(void 0);
54
53
  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 ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;\n ATTACHMENT_ERROR: (error: Error) => string;\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_DELETE_ATTACHMENT: 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_ATTACH_FILES: string;\n COMPOSER_REMOVE_ATTACHMENT: 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_DELETE: 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 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 ATTACHMENT_TOO_LARGE: (maxSize) =>\n maxSize ? `The file is larger than ${maxSize}` : \"The file is too large\",\n ATTACHMENT_ERROR: () => \"The file couldn’t be uploaded.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_ATTACH_FILES: \"Attach files\",\n COMPOSER_REMOVE_ATTACHMENT: \"Remove attachment\",\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_DELETE_ATTACHMENT: \"Delete attachment\",\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_DELETE: \"Delete notification\",\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":";;;;;;AA+FO;AAAoC;AACjC;AACH;AACM;AACG;AACgB;AACuC;AAExB;AACZ;AACb;AAElB;AAEiD;AAC3B;AACC;AACF;AACA;AACK;AACN;AACP;AACC;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACW;AACL;AAGG;AAAM;AAC7B;AAGwD;AAC1C;AACE;AACI;AACY;AACL;AACP;AACG;AACQ;AACN;AAQzB;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;;"}
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_DELETE: 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 interface HistoryVersionPreviewOverrides {\n HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list: ReactNode) => ReactNode;\n HISTORY_VERSION_PREVIEW_RESTORE: string;\n HISTORY_VERSION_PREVIEW_EMPTY: ReactNode;\n HISTORY_VERSION_PREVIEW_ERROR: (error: Error) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n InboxNotificationOverrides &\n HistoryVersionPreviewOverrides;\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_DELETE: \"Delete notification\",\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 HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list: ReactNode) => (\n <>Edits from {list}</>\n ),\n HISTORY_VERSION_PREVIEW_RESTORE: \"Restore\",\n HISTORY_VERSION_PREVIEW_EMPTY: \"No content.\",\n HISTORY_VERSION_PREVIEW_ERROR: () =>\n \"There was an error while getting this version.\",\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":";;;;;;AAkGO;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;AACN;AAQzB;AAKA;AAKA;AAGmB;AAEY;AACF;AAGjC;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;;"}
@@ -5,7 +5,6 @@ var React = require('react');
5
5
 
6
6
  const ComposerContext = React.createContext(null);
7
7
  const ComposerEditorContext = React.createContext(null);
8
- const ComposerAttachmentsContext = React.createContext(null);
9
8
  const ComposerSuggestionsContext = React.createContext(null);
10
9
  function useComposerEditorContext() {
11
10
  const composerEditorContext = React.useContext(ComposerEditorContext);
@@ -14,15 +13,9 @@ function useComposerEditorContext() {
14
13
  "Composer.Form is missing from the React tree."
15
14
  );
16
15
  }
17
- function useComposerAttachmentsContextOrNull() {
18
- return React.useContext(ComposerAttachmentsContext);
19
- }
20
- function useComposerAttachmentsContext() {
21
- const composerAttachmentsContext = useComposerAttachmentsContextOrNull();
22
- return core.nn(
23
- composerAttachmentsContext,
24
- "Composer.Form is missing from the React tree."
25
- );
16
+ function useComposer() {
17
+ const composerContext = React.useContext(ComposerContext);
18
+ return core.nn(composerContext, "Composer.Form is missing from the React tree.");
26
19
  }
27
20
  function useComposerSuggestionsContext(source = "useComposerSuggestionsContext") {
28
21
  const composerSuggestionsContext = React.useContext(ComposerSuggestionsContext);
@@ -31,18 +24,11 @@ function useComposerSuggestionsContext(source = "useComposerSuggestionsContext")
31
24
  `${source} can\u2019t be used outside of Composer.Editor.`
32
25
  );
33
26
  }
34
- function useComposer() {
35
- const composerContext = React.useContext(ComposerContext);
36
- return core.nn(composerContext, "Composer.Form is missing from the React tree.");
37
- }
38
27
 
39
- exports.ComposerAttachmentsContext = ComposerAttachmentsContext;
40
28
  exports.ComposerContext = ComposerContext;
41
29
  exports.ComposerEditorContext = ComposerEditorContext;
42
30
  exports.ComposerSuggestionsContext = ComposerSuggestionsContext;
43
31
  exports.useComposer = useComposer;
44
- exports.useComposerAttachmentsContext = useComposerAttachmentsContext;
45
- exports.useComposerAttachmentsContextOrNull = useComposerAttachmentsContextOrNull;
46
32
  exports.useComposerEditorContext = useComposerEditorContext;
47
33
  exports.useComposerSuggestionsContext = useComposerSuggestionsContext;
48
34
  //# sourceMappingURL=contexts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contexts.js","sources":["../../../src/primitives/Composer/contexts.ts"],"sourcesContent":["import type { Placement } from \"@floating-ui/react-dom\";\nimport type { CommentMixedAttachment } from \"@liveblocks/core\";\nimport { nn } from \"@liveblocks/core\";\nimport type { Direction } from \"@radix-ui/react-dropdown-menu\";\nimport type { Dispatch, Ref, SetStateAction } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { Editor as SlateEditor, Element as SlateElement } from \"slate\";\n\nexport type ComposerContext = {\n /**\n * Whether the composer is currently disabled.\n */\n isDisabled: boolean;\n\n /**\n * Whether the composer can currently be submitted.\n */\n canSubmit: boolean;\n\n /**\n * Whether the editor is currently focused.\n */\n isFocused: boolean;\n\n /**\n * Whether the editor is currently empty.\n */\n isEmpty: boolean;\n\n /**\n * Submit the composer programmatically.\n */\n submit: () => void;\n\n /**\n * Clear the composer programmatically.\n */\n clear: () => void;\n\n /**\n * Select the editor programmatically.\n */\n select: () => void;\n\n /**\n * Focus the editor programmatically.\n */\n focus: () => void;\n\n /**\n * Blur the editor programmatically.\n */\n blur: () => void;\n\n /**\n * Start creating a mention at the current selection.\n */\n createMention: () => void;\n\n /**\n * Insert text at the current selection.\n */\n insertText: (text: string) => void;\n\n /**\n * Open a file picker programmatically to create attachments.\n */\n attachFiles: () => void;\n\n /**\n * The composer's current attachments.\n */\n attachments: CommentMixedAttachment[];\n\n /**\n * Remove an attachment by its ID.\n */\n removeAttachment: (attachmentId: string) => void;\n};\n\nexport type ComposerEditorContext = {\n validate: (value: SlateElement[]) => void;\n editor: SlateEditor;\n setFocused: Dispatch<SetStateAction<boolean>>;\n};\n\nexport type ComposerAttachmentsContext = {\n canAddAttachments: boolean;\n createAttachments: (files: File[]) => void;\n isUploadingAttachments: boolean;\n maxAttachments: number;\n maxAttachmentSize: number;\n};\n\nexport type ComposerSuggestionsContext = {\n dir?: Direction;\n id: string;\n itemId: (value?: string) => string | undefined;\n placement: Placement;\n selectedValue?: string;\n setSelectedValue: (value: string) => void;\n onItemSelect: (value: string) => void;\n ref: Ref<HTMLDivElement>;\n};\n\nexport const ComposerContext = createContext<ComposerContext | null>(null);\nexport const ComposerEditorContext =\n createContext<ComposerEditorContext | null>(null);\nexport const ComposerAttachmentsContext =\n createContext<ComposerAttachmentsContext | null>(null);\nexport const ComposerSuggestionsContext =\n createContext<ComposerSuggestionsContext | null>(null);\n\nexport function useComposerEditorContext() {\n const composerEditorContext = useContext(ComposerEditorContext);\n\n return nn(\n composerEditorContext,\n \"Composer.Form is missing from the React tree.\"\n );\n}\n\nexport function useComposerAttachmentsContextOrNull() {\n return useContext(ComposerAttachmentsContext);\n}\n\nexport function useComposerAttachmentsContext() {\n const composerAttachmentsContext = useComposerAttachmentsContextOrNull();\n\n return nn(\n composerAttachmentsContext,\n \"Composer.Form is missing from the React tree.\"\n );\n}\n\nexport function useComposerSuggestionsContext(\n source = \"useComposerSuggestionsContext\"\n) {\n const composerSuggestionsContext = useContext(ComposerSuggestionsContext);\n\n return nn(\n composerSuggestionsContext,\n `${source} can’t be used outside of Composer.Editor.`\n );\n}\n\nexport function useComposer(): ComposerContext {\n const composerContext = useContext(ComposerContext);\n\n return nn(composerContext, \"Composer.Form is missing from the React tree.\");\n}\n"],"names":["createContext","useContext","nn"],"mappings":";;;;;AAyGa,MAAA,eAAA,GAAkBA,oBAAsC,IAAI,EAAA;AAC5D,MAAA,qBAAA,GACXA,oBAA4C,IAAI,EAAA;AACrC,MAAA,0BAAA,GACXA,oBAAiD,IAAI,EAAA;AAC1C,MAAA,0BAAA,GACXA,oBAAiD,IAAI,EAAA;AAEhD,SAAS,wBAA2B,GAAA;AACzC,EAAM,MAAA,qBAAA,GAAwBC,iBAAW,qBAAqB,CAAA,CAAA;AAE9D,EAAO,OAAAC,OAAA;AAAA,IACL,qBAAA;AAAA,IACA,+CAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEO,SAAS,mCAAsC,GAAA;AACpD,EAAA,OAAOD,iBAAW,0BAA0B,CAAA,CAAA;AAC9C,CAAA;AAEO,SAAS,6BAAgC,GAAA;AAC9C,EAAA,MAAM,6BAA6B,mCAAoC,EAAA,CAAA;AAEvE,EAAO,OAAAC,OAAA;AAAA,IACL,0BAAA;AAAA,IACA,+CAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEgB,SAAA,6BAAA,CACd,SAAS,+BACT,EAAA;AACA,EAAM,MAAA,0BAAA,GAA6BD,iBAAW,0BAA0B,CAAA,CAAA;AAExE,EAAO,OAAAC,OAAA;AAAA,IACL,0BAAA;AAAA,IACA,CAAG,EAAA,MAAA,CAAA,+CAAA,CAAA;AAAA,GACL,CAAA;AACF,CAAA;AAEO,SAAS,WAA+B,GAAA;AAC7C,EAAM,MAAA,eAAA,GAAkBD,iBAAW,eAAe,CAAA,CAAA;AAElD,EAAO,OAAAC,OAAA,CAAG,iBAAiB,+CAA+C,CAAA,CAAA;AAC5E;;;;;;;;;;;;"}
1
+ {"version":3,"file":"contexts.js","sources":["../../../src/primitives/Composer/contexts.ts"],"sourcesContent":["import type { Placement } from \"@floating-ui/react-dom\";\nimport { nn } from \"@liveblocks/core\";\nimport type { Direction } from \"@radix-ui/react-dropdown-menu\";\nimport type { Dispatch, Ref, SetStateAction } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { Editor as SlateEditor, Element as SlateElement } from \"slate\";\n\nexport type ComposerContext = {\n /**\n * Whether the editor is currently focused.\n */\n isFocused: boolean;\n\n /**\n * Whether the editor is currently empty.\n */\n isEmpty: boolean;\n\n /**\n * Submit the composer programmatically.\n */\n submit: () => void;\n\n /**\n * Clear the editor programmatically.\n */\n clear: () => void;\n\n /**\n * Select the editor programmatically.\n */\n select: () => void;\n\n /**\n * Focus the editor programmatically.\n */\n focus: () => void;\n\n /**\n * Blur the editor programmatically.\n */\n blur: () => void;\n\n /**\n * Start creating a mention at the current selection.\n */\n createMention: () => void;\n\n /**\n * Insert text at the current selection.\n */\n insertText: (text: string) => void;\n};\n\nexport type ComposerEditorContext = {\n validate: (value: SlateElement[]) => void;\n editor: SlateEditor;\n setFocused: Dispatch<SetStateAction<boolean>>;\n};\n\nexport type ComposerSuggestionsContext = {\n dir?: Direction;\n id: string;\n itemId: (value?: string) => string | undefined;\n placement: Placement;\n selectedValue?: string;\n setSelectedValue: (value: string) => void;\n onItemSelect: (value: string) => void;\n ref: Ref<HTMLDivElement>;\n};\n\nexport const ComposerContext = createContext<ComposerContext | null>(null);\nexport const ComposerEditorContext =\n createContext<ComposerEditorContext | null>(null);\nexport const ComposerSuggestionsContext =\n createContext<ComposerSuggestionsContext | null>(null);\n\nexport function useComposerEditorContext() {\n const composerEditorContext = useContext(ComposerEditorContext);\n\n return nn(\n composerEditorContext,\n \"Composer.Form is missing from the React tree.\"\n );\n}\n\nexport function useComposer(): ComposerContext {\n const composerContext = useContext(ComposerContext);\n\n return nn(composerContext, \"Composer.Form is missing from the React tree.\");\n}\n\nexport function useComposerSuggestionsContext(\n source = \"useComposerSuggestionsContext\"\n) {\n const composerSuggestionsContext = useContext(ComposerSuggestionsContext);\n\n return nn(\n composerSuggestionsContext,\n `${source} can’t be used outside of Composer.Editor.`\n );\n}\n"],"names":["createContext","useContext","nn"],"mappings":";;;;;AAuEa,MAAA,eAAA,GAAkBA,oBAAsC,IAAI,EAAA;AAC5D,MAAA,qBAAA,GACXA,oBAA4C,IAAI,EAAA;AACrC,MAAA,0BAAA,GACXA,oBAAiD,IAAI,EAAA;AAEhD,SAAS,wBAA2B,GAAA;AACzC,EAAM,MAAA,qBAAA,GAAwBC,iBAAW,qBAAqB,CAAA,CAAA;AAE9D,EAAO,OAAAC,OAAA;AAAA,IACL,qBAAA;AAAA,IACA,+CAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEO,SAAS,WAA+B,GAAA;AAC7C,EAAM,MAAA,eAAA,GAAkBD,iBAAW,eAAe,CAAA,CAAA;AAElD,EAAO,OAAAC,OAAA,CAAG,iBAAiB,+CAA+C,CAAA,CAAA;AAC5E,CAAA;AAEgB,SAAA,6BAAA,CACd,SAAS,+BACT,EAAA;AACA,EAAM,MAAA,0BAAA,GAA6BD,iBAAW,0BAA0B,CAAA,CAAA;AAExE,EAAO,OAAAC,OAAA;AAAA,IACL,0BAAA;AAAA,IACA,CAAG,EAAA,MAAA,CAAA,+CAAA,CAAA;AAAA,GACL,CAAA;AACF;;;;;;;;;"}
@@ -3,7 +3,6 @@ import { createContext, useContext } from 'react';
3
3
 
4
4
  const ComposerContext = createContext(null);
5
5
  const ComposerEditorContext = createContext(null);
6
- const ComposerAttachmentsContext = createContext(null);
7
6
  const ComposerSuggestionsContext = createContext(null);
8
7
  function useComposerEditorContext() {
9
8
  const composerEditorContext = useContext(ComposerEditorContext);
@@ -12,15 +11,9 @@ function useComposerEditorContext() {
12
11
  "Composer.Form is missing from the React tree."
13
12
  );
14
13
  }
15
- function useComposerAttachmentsContextOrNull() {
16
- return useContext(ComposerAttachmentsContext);
17
- }
18
- function useComposerAttachmentsContext() {
19
- const composerAttachmentsContext = useComposerAttachmentsContextOrNull();
20
- return nn(
21
- composerAttachmentsContext,
22
- "Composer.Form is missing from the React tree."
23
- );
14
+ function useComposer() {
15
+ const composerContext = useContext(ComposerContext);
16
+ return nn(composerContext, "Composer.Form is missing from the React tree.");
24
17
  }
25
18
  function useComposerSuggestionsContext(source = "useComposerSuggestionsContext") {
26
19
  const composerSuggestionsContext = useContext(ComposerSuggestionsContext);
@@ -29,10 +22,6 @@ function useComposerSuggestionsContext(source = "useComposerSuggestionsContext")
29
22
  `${source} can\u2019t be used outside of Composer.Editor.`
30
23
  );
31
24
  }
32
- function useComposer() {
33
- const composerContext = useContext(ComposerContext);
34
- return nn(composerContext, "Composer.Form is missing from the React tree.");
35
- }
36
25
 
37
- export { ComposerAttachmentsContext, ComposerContext, ComposerEditorContext, ComposerSuggestionsContext, useComposer, useComposerAttachmentsContext, useComposerAttachmentsContextOrNull, useComposerEditorContext, useComposerSuggestionsContext };
26
+ export { ComposerContext, ComposerEditorContext, ComposerSuggestionsContext, useComposer, useComposerEditorContext, useComposerSuggestionsContext };
38
27
  //# sourceMappingURL=contexts.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contexts.mjs","sources":["../../../src/primitives/Composer/contexts.ts"],"sourcesContent":["import type { Placement } from \"@floating-ui/react-dom\";\nimport type { CommentMixedAttachment } from \"@liveblocks/core\";\nimport { nn } from \"@liveblocks/core\";\nimport type { Direction } from \"@radix-ui/react-dropdown-menu\";\nimport type { Dispatch, Ref, SetStateAction } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { Editor as SlateEditor, Element as SlateElement } from \"slate\";\n\nexport type ComposerContext = {\n /**\n * Whether the composer is currently disabled.\n */\n isDisabled: boolean;\n\n /**\n * Whether the composer can currently be submitted.\n */\n canSubmit: boolean;\n\n /**\n * Whether the editor is currently focused.\n */\n isFocused: boolean;\n\n /**\n * Whether the editor is currently empty.\n */\n isEmpty: boolean;\n\n /**\n * Submit the composer programmatically.\n */\n submit: () => void;\n\n /**\n * Clear the composer programmatically.\n */\n clear: () => void;\n\n /**\n * Select the editor programmatically.\n */\n select: () => void;\n\n /**\n * Focus the editor programmatically.\n */\n focus: () => void;\n\n /**\n * Blur the editor programmatically.\n */\n blur: () => void;\n\n /**\n * Start creating a mention at the current selection.\n */\n createMention: () => void;\n\n /**\n * Insert text at the current selection.\n */\n insertText: (text: string) => void;\n\n /**\n * Open a file picker programmatically to create attachments.\n */\n attachFiles: () => void;\n\n /**\n * The composer's current attachments.\n */\n attachments: CommentMixedAttachment[];\n\n /**\n * Remove an attachment by its ID.\n */\n removeAttachment: (attachmentId: string) => void;\n};\n\nexport type ComposerEditorContext = {\n validate: (value: SlateElement[]) => void;\n editor: SlateEditor;\n setFocused: Dispatch<SetStateAction<boolean>>;\n};\n\nexport type ComposerAttachmentsContext = {\n canAddAttachments: boolean;\n createAttachments: (files: File[]) => void;\n isUploadingAttachments: boolean;\n maxAttachments: number;\n maxAttachmentSize: number;\n};\n\nexport type ComposerSuggestionsContext = {\n dir?: Direction;\n id: string;\n itemId: (value?: string) => string | undefined;\n placement: Placement;\n selectedValue?: string;\n setSelectedValue: (value: string) => void;\n onItemSelect: (value: string) => void;\n ref: Ref<HTMLDivElement>;\n};\n\nexport const ComposerContext = createContext<ComposerContext | null>(null);\nexport const ComposerEditorContext =\n createContext<ComposerEditorContext | null>(null);\nexport const ComposerAttachmentsContext =\n createContext<ComposerAttachmentsContext | null>(null);\nexport const ComposerSuggestionsContext =\n createContext<ComposerSuggestionsContext | null>(null);\n\nexport function useComposerEditorContext() {\n const composerEditorContext = useContext(ComposerEditorContext);\n\n return nn(\n composerEditorContext,\n \"Composer.Form is missing from the React tree.\"\n );\n}\n\nexport function useComposerAttachmentsContextOrNull() {\n return useContext(ComposerAttachmentsContext);\n}\n\nexport function useComposerAttachmentsContext() {\n const composerAttachmentsContext = useComposerAttachmentsContextOrNull();\n\n return nn(\n composerAttachmentsContext,\n \"Composer.Form is missing from the React tree.\"\n );\n}\n\nexport function useComposerSuggestionsContext(\n source = \"useComposerSuggestionsContext\"\n) {\n const composerSuggestionsContext = useContext(ComposerSuggestionsContext);\n\n return nn(\n composerSuggestionsContext,\n `${source} can’t be used outside of Composer.Editor.`\n );\n}\n\nexport function useComposer(): ComposerContext {\n const composerContext = useContext(ComposerContext);\n\n return nn(composerContext, \"Composer.Form is missing from the React tree.\");\n}\n"],"names":[],"mappings":";;;AAyGa,MAAA,eAAA,GAAkB,cAAsC,IAAI,EAAA;AAC5D,MAAA,qBAAA,GACX,cAA4C,IAAI,EAAA;AACrC,MAAA,0BAAA,GACX,cAAiD,IAAI,EAAA;AAC1C,MAAA,0BAAA,GACX,cAAiD,IAAI,EAAA;AAEhD,SAAS,wBAA2B,GAAA;AACzC,EAAM,MAAA,qBAAA,GAAwB,WAAW,qBAAqB,CAAA,CAAA;AAE9D,EAAO,OAAA,EAAA;AAAA,IACL,qBAAA;AAAA,IACA,+CAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEO,SAAS,mCAAsC,GAAA;AACpD,EAAA,OAAO,WAAW,0BAA0B,CAAA,CAAA;AAC9C,CAAA;AAEO,SAAS,6BAAgC,GAAA;AAC9C,EAAA,MAAM,6BAA6B,mCAAoC,EAAA,CAAA;AAEvE,EAAO,OAAA,EAAA;AAAA,IACL,0BAAA;AAAA,IACA,+CAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEgB,SAAA,6BAAA,CACd,SAAS,+BACT,EAAA;AACA,EAAM,MAAA,0BAAA,GAA6B,WAAW,0BAA0B,CAAA,CAAA;AAExE,EAAO,OAAA,EAAA;AAAA,IACL,0BAAA;AAAA,IACA,CAAG,EAAA,MAAA,CAAA,+CAAA,CAAA;AAAA,GACL,CAAA;AACF,CAAA;AAEO,SAAS,WAA+B,GAAA;AAC7C,EAAM,MAAA,eAAA,GAAkB,WAAW,eAAe,CAAA,CAAA;AAElD,EAAO,OAAA,EAAA,CAAG,iBAAiB,+CAA+C,CAAA,CAAA;AAC5E;;;;"}
1
+ {"version":3,"file":"contexts.mjs","sources":["../../../src/primitives/Composer/contexts.ts"],"sourcesContent":["import type { Placement } from \"@floating-ui/react-dom\";\nimport { nn } from \"@liveblocks/core\";\nimport type { Direction } from \"@radix-ui/react-dropdown-menu\";\nimport type { Dispatch, Ref, SetStateAction } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { Editor as SlateEditor, Element as SlateElement } from \"slate\";\n\nexport type ComposerContext = {\n /**\n * Whether the editor is currently focused.\n */\n isFocused: boolean;\n\n /**\n * Whether the editor is currently empty.\n */\n isEmpty: boolean;\n\n /**\n * Submit the composer programmatically.\n */\n submit: () => void;\n\n /**\n * Clear the editor programmatically.\n */\n clear: () => void;\n\n /**\n * Select the editor programmatically.\n */\n select: () => void;\n\n /**\n * Focus the editor programmatically.\n */\n focus: () => void;\n\n /**\n * Blur the editor programmatically.\n */\n blur: () => void;\n\n /**\n * Start creating a mention at the current selection.\n */\n createMention: () => void;\n\n /**\n * Insert text at the current selection.\n */\n insertText: (text: string) => void;\n};\n\nexport type ComposerEditorContext = {\n validate: (value: SlateElement[]) => void;\n editor: SlateEditor;\n setFocused: Dispatch<SetStateAction<boolean>>;\n};\n\nexport type ComposerSuggestionsContext = {\n dir?: Direction;\n id: string;\n itemId: (value?: string) => string | undefined;\n placement: Placement;\n selectedValue?: string;\n setSelectedValue: (value: string) => void;\n onItemSelect: (value: string) => void;\n ref: Ref<HTMLDivElement>;\n};\n\nexport const ComposerContext = createContext<ComposerContext | null>(null);\nexport const ComposerEditorContext =\n createContext<ComposerEditorContext | null>(null);\nexport const ComposerSuggestionsContext =\n createContext<ComposerSuggestionsContext | null>(null);\n\nexport function useComposerEditorContext() {\n const composerEditorContext = useContext(ComposerEditorContext);\n\n return nn(\n composerEditorContext,\n \"Composer.Form is missing from the React tree.\"\n );\n}\n\nexport function useComposer(): ComposerContext {\n const composerContext = useContext(ComposerContext);\n\n return nn(composerContext, \"Composer.Form is missing from the React tree.\");\n}\n\nexport function useComposerSuggestionsContext(\n source = \"useComposerSuggestionsContext\"\n) {\n const composerSuggestionsContext = useContext(ComposerSuggestionsContext);\n\n return nn(\n composerSuggestionsContext,\n `${source} can’t be used outside of Composer.Editor.`\n );\n}\n"],"names":[],"mappings":";;;AAuEa,MAAA,eAAA,GAAkB,cAAsC,IAAI,EAAA;AAC5D,MAAA,qBAAA,GACX,cAA4C,IAAI,EAAA;AACrC,MAAA,0BAAA,GACX,cAAiD,IAAI,EAAA;AAEhD,SAAS,wBAA2B,GAAA;AACzC,EAAM,MAAA,qBAAA,GAAwB,WAAW,qBAAqB,CAAA,CAAA;AAE9D,EAAO,OAAA,EAAA;AAAA,IACL,qBAAA;AAAA,IACA,+CAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEO,SAAS,WAA+B,GAAA;AAC7C,EAAM,MAAA,eAAA,GAAkB,WAAW,eAAe,CAAA,CAAA;AAElD,EAAO,OAAA,EAAA,CAAG,iBAAiB,+CAA+C,CAAA,CAAA;AAC5E,CAAA;AAEgB,SAAA,6BAAA,CACd,SAAS,+BACT,EAAA;AACA,EAAM,MAAA,0BAAA,GAA6B,WAAW,0BAA0B,CAAA,CAAA;AAExE,EAAO,OAAA,EAAA;AAAA,IACL,0BAAA;AAAA,IACA,CAAG,EAAA,MAAA,CAAA,+CAAA,CAAA;AAAA,GACL,CAAA;AACF;;;;"}