@liveblocks/react-ui 3.2.1 → 3.3.1
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/_private/index.cjs +4 -2
- package/dist/_private/index.cjs.map +1 -1
- package/dist/_private/index.d.cts +100 -33
- package/dist/_private/index.d.ts +100 -33
- package/dist/_private/index.js +3 -2
- package/dist/_private/index.js.map +1 -1
- package/dist/components/AiChat.cjs +11 -9
- package/dist/components/AiChat.cjs.map +1 -1
- package/dist/components/AiChat.js +12 -10
- package/dist/components/AiChat.js.map +1 -1
- package/dist/components/Composer.cjs +1 -1
- package/dist/components/Composer.cjs.map +1 -1
- package/dist/components/Composer.js +1 -1
- package/dist/components/Composer.js.map +1 -1
- package/dist/components/Thread.cjs +58 -0
- package/dist/components/Thread.cjs.map +1 -1
- package/dist/components/Thread.js +59 -1
- package/dist/components/Thread.js.map +1 -1
- package/dist/components/internal/AiComposer.cjs +132 -0
- package/dist/components/internal/AiComposer.cjs.map +1 -0
- package/dist/components/internal/AiComposer.js +130 -0
- package/dist/components/internal/AiComposer.js.map +1 -0
- package/dist/components/internal/Button.cjs.map +1 -1
- package/dist/components/internal/Button.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -11
- package/dist/index.d.ts +113 -11
- package/dist/index.js.map +1 -1
- package/dist/overrides.cjs +4 -3
- package/dist/overrides.cjs.map +1 -1
- package/dist/overrides.js +4 -3
- package/dist/overrides.js.map +1 -1
- package/dist/primitives/AiComposer/contexts.cjs +24 -0
- package/dist/primitives/AiComposer/contexts.cjs.map +1 -0
- package/dist/primitives/AiComposer/contexts.js +19 -0
- package/dist/primitives/AiComposer/contexts.js.map +1 -0
- package/dist/primitives/AiComposer/index.cjs +348 -0
- package/dist/primitives/AiComposer/index.cjs.map +1 -0
- package/dist/primitives/AiComposer/index.js +340 -0
- package/dist/primitives/AiComposer/index.js.map +1 -0
- package/dist/primitives/index.d.cts +8 -1
- package/dist/primitives/index.d.ts +8 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/src/styles/index.css +36 -10
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/components/internal/AiChatComposer.cjs +0 -161
- package/dist/components/internal/AiChatComposer.cjs.map +0 -1
- package/dist/components/internal/AiChatComposer.js +0 -159
- package/dist/components/internal/AiChatComposer.js.map +0 -1
- package/dist/primitives/AiChatComposer/index.cjs +0 -202
- package/dist/primitives/AiChatComposer/index.cjs.map +0 -1
- package/dist/primitives/AiChatComposer/index.js +0 -195
- package/dist/primitives/AiChatComposer/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ComponentType, ComponentPropsWithoutRef, ElementType, ReactNode,
|
|
3
|
-
import { CommentAttachment, Relax, AiKnowledgeSource, AiOpaqueToolDefinition, AiToolTypePack, JsonObject, AiToolExecuteCallback, NoInfr, CommentBody, MentionData, BaseMetadata, DM, CommentData, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
2
|
+
import { ComponentType, ComponentPropsWithoutRef, ElementType, ReactNode, FormEvent, ComponentProps, RefAttributes, MouseEvent, PropsWithChildren } from 'react';
|
|
3
|
+
import { CommentAttachment, Relax, CopilotId, AiKnowledgeSource, AiOpaqueToolDefinition, AiToolTypePack, JsonObject, AiToolExecuteCallback, NoInfr, CommentBody, MentionData, BaseMetadata, DM, CommentData, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
interface GlobalComponents {
|
|
@@ -83,10 +83,10 @@ interface AiToolConfirmationOverrides {
|
|
|
83
83
|
AI_TOOL_CONFIRMATION_CONFIRM: string;
|
|
84
84
|
AI_TOOL_CONFIRMATION_CANCEL: string;
|
|
85
85
|
}
|
|
86
|
-
interface
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
interface AiComposerOverrides {
|
|
87
|
+
AI_COMPOSER_PLACEHOLDER: string;
|
|
88
|
+
AI_COMPOSER_SEND: string;
|
|
89
|
+
AI_COMPOSER_ABORT: string;
|
|
90
90
|
}
|
|
91
91
|
interface AiChatMessageOverrides {
|
|
92
92
|
AI_CHAT_MESSAGE_DELETED: string;
|
|
@@ -103,6 +103,7 @@ interface ThreadOverrides {
|
|
|
103
103
|
THREAD_UNSUBSCRIBE: string;
|
|
104
104
|
THREAD_NEW_INDICATOR: string;
|
|
105
105
|
THREAD_NEW_INDICATOR_DESCRIPTION: string;
|
|
106
|
+
THREAD_SHOW_MORE_COMMENTS: (count: number) => string;
|
|
106
107
|
THREAD_COMPOSER_PLACEHOLDER: string;
|
|
107
108
|
THREAD_COMPOSER_SEND: string;
|
|
108
109
|
}
|
|
@@ -120,7 +121,7 @@ interface HistoryVersionPreviewOverrides {
|
|
|
120
121
|
HISTORY_VERSION_PREVIEW_EMPTY: ReactNode;
|
|
121
122
|
HISTORY_VERSION_PREVIEW_ERROR: (error: Error) => ReactNode;
|
|
122
123
|
}
|
|
123
|
-
type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides & HistoryVersionPreviewOverrides &
|
|
124
|
+
type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides & HistoryVersionPreviewOverrides & AiComposerOverrides & AiChatMessageOverrides & AiChatOverrides & AiToolConfirmationOverrides;
|
|
124
125
|
declare function useOverrides(overrides?: Partial<Overrides>): Overrides;
|
|
125
126
|
|
|
126
127
|
type MarkdownComponents = {
|
|
@@ -386,6 +387,80 @@ interface MarkdownComponentsCodeBlockProps {
|
|
|
386
387
|
language?: string;
|
|
387
388
|
}
|
|
388
389
|
|
|
390
|
+
interface AiComposerSubmitMessage {
|
|
391
|
+
/**
|
|
392
|
+
* The submitted message text.
|
|
393
|
+
*/
|
|
394
|
+
text: string;
|
|
395
|
+
}
|
|
396
|
+
interface AiComposerFormProps extends ComponentPropsWithSlot<"form"> {
|
|
397
|
+
/**
|
|
398
|
+
* The ID of the chat the composer belongs to.
|
|
399
|
+
*/
|
|
400
|
+
chatId?: string;
|
|
401
|
+
/**
|
|
402
|
+
* The event handler called when the composer is submitted.
|
|
403
|
+
*/
|
|
404
|
+
onComposerSubmit?: (message: AiComposerSubmitMessage, event: FormEvent<HTMLFormElement>) => Promise<void> | void;
|
|
405
|
+
/**
|
|
406
|
+
* Whether the composer is disabled.
|
|
407
|
+
*/
|
|
408
|
+
disabled?: boolean;
|
|
409
|
+
}
|
|
410
|
+
interface AiComposerEditorProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue" | "children"> {
|
|
411
|
+
/**
|
|
412
|
+
* The reading direction of the editor and related elements.
|
|
413
|
+
*/
|
|
414
|
+
dir?: Direction;
|
|
415
|
+
/**
|
|
416
|
+
* The editor's initial value.
|
|
417
|
+
*/
|
|
418
|
+
defaultValue?: string;
|
|
419
|
+
/**
|
|
420
|
+
* The text to display when the editor is empty.
|
|
421
|
+
*/
|
|
422
|
+
placeholder?: string;
|
|
423
|
+
/**
|
|
424
|
+
* Whether the editor is disabled.
|
|
425
|
+
*/
|
|
426
|
+
disabled?: boolean;
|
|
427
|
+
/**
|
|
428
|
+
* Whether to focus the editor on mount.
|
|
429
|
+
*/
|
|
430
|
+
autoFocus?: boolean;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
interface AiComposerProps extends Omit<ComponentProps<"form">, "defaultValue"> {
|
|
434
|
+
/**
|
|
435
|
+
* The composer's initial value.
|
|
436
|
+
*/
|
|
437
|
+
defaultValue?: string;
|
|
438
|
+
/**
|
|
439
|
+
* The event handler called when the composer is submitted.
|
|
440
|
+
*/
|
|
441
|
+
onComposerSubmit?: (message: AiComposerSubmitMessage, event: FormEvent<HTMLFormElement>) => void;
|
|
442
|
+
/**
|
|
443
|
+
* Whether the composer is disabled.
|
|
444
|
+
*/
|
|
445
|
+
disabled?: AiComposerFormProps["disabled"];
|
|
446
|
+
/**
|
|
447
|
+
* Whether to focus the composer on mount.
|
|
448
|
+
*/
|
|
449
|
+
autoFocus?: AiComposerEditorProps["autoFocus"];
|
|
450
|
+
/**
|
|
451
|
+
* Override the component's strings.
|
|
452
|
+
*/
|
|
453
|
+
overrides?: Partial<GlobalOverrides & AiComposerOverrides>;
|
|
454
|
+
/**
|
|
455
|
+
* The ID of the chat the composer belongs to.
|
|
456
|
+
*/
|
|
457
|
+
chatId: string;
|
|
458
|
+
/**
|
|
459
|
+
* The ID of the copilot to use to send the message.
|
|
460
|
+
*/
|
|
461
|
+
copilotId?: CopilotId;
|
|
462
|
+
}
|
|
463
|
+
|
|
389
464
|
type AiChatComponentsEmptyProps = {
|
|
390
465
|
/**
|
|
391
466
|
* The chat ID provided to the `AiChat` component.
|
|
@@ -425,14 +500,20 @@ interface AiChatProps extends ComponentProps<"div"> {
|
|
|
425
500
|
*/
|
|
426
501
|
copilotId?: string;
|
|
427
502
|
/**
|
|
428
|
-
* The contextual knowledge to include in the chat. May be used by the
|
|
429
|
-
*
|
|
503
|
+
* The contextual knowledge to include in the chat. May be used by the
|
|
504
|
+
* assistant when generating responses. In addition to the knowledge passed
|
|
505
|
+
* in via this prop, the AiChat instance will also have access to any
|
|
506
|
+
* globally registered knowledge via <RegisterAiKnowledge />.
|
|
430
507
|
*/
|
|
431
508
|
knowledge?: AiKnowledgeSource[];
|
|
432
509
|
/**
|
|
433
510
|
* Tool definitions to make available within this chat. May be used by the assistant when generating responses.
|
|
434
511
|
*/
|
|
435
512
|
tools?: Record<string, AiOpaqueToolDefinition>;
|
|
513
|
+
/**
|
|
514
|
+
* The event handler called when the composer is submitted.
|
|
515
|
+
*/
|
|
516
|
+
onComposerSubmit?: AiComposerProps["onComposerSubmit"];
|
|
436
517
|
/**
|
|
437
518
|
* The layout of the chat and its composer.
|
|
438
519
|
*/
|
|
@@ -440,7 +521,7 @@ interface AiChatProps extends ComponentProps<"div"> {
|
|
|
440
521
|
/**
|
|
441
522
|
* Override the component's strings.
|
|
442
523
|
*/
|
|
443
|
-
overrides?: Partial<GlobalOverrides &
|
|
524
|
+
overrides?: Partial<GlobalOverrides & AiComposerOverrides & AiChatMessageOverrides & AiChatOverrides>;
|
|
444
525
|
/**
|
|
445
526
|
* Override the component's components.
|
|
446
527
|
*/
|
|
@@ -1174,6 +1255,27 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
|
|
|
1174
1255
|
* Whether to show the composer's formatting controls.
|
|
1175
1256
|
*/
|
|
1176
1257
|
showComposerFormattingControls?: ComposerProps["showFormattingControls"];
|
|
1258
|
+
/**
|
|
1259
|
+
* The maximum number of comments to show.
|
|
1260
|
+
*
|
|
1261
|
+
* The first and last comments are always shown and by default if some comments
|
|
1262
|
+
* are hidden, only the first comment will be shown before the "show more" button
|
|
1263
|
+
* and after it will be shown all the newest comments to fit the limit set.
|
|
1264
|
+
*
|
|
1265
|
+
* It's possible to customize this by setting `maxVisibleComments` to an object:
|
|
1266
|
+
*
|
|
1267
|
+
* @example
|
|
1268
|
+
* // Only show the last comment, and all the older ones to fit the limit.
|
|
1269
|
+
* <Thread maxVisibleComments={{ max: 5, show: "oldest" }} />
|
|
1270
|
+
*
|
|
1271
|
+
* @example
|
|
1272
|
+
* // Show as many old comments as new ones to fit the limit.
|
|
1273
|
+
* <Thread maxVisibleComments={{ max: 5, show: "both" }} />
|
|
1274
|
+
*/
|
|
1275
|
+
maxVisibleComments?: number | {
|
|
1276
|
+
max: number;
|
|
1277
|
+
show: "oldest" | "both" | "newest";
|
|
1278
|
+
};
|
|
1177
1279
|
/**
|
|
1178
1280
|
* Whether to blur the composer editor when the composer is submitted.
|
|
1179
1281
|
*/
|
|
@@ -1435,4 +1537,4 @@ declare namespace icon {
|
|
|
1435
1537
|
};
|
|
1436
1538
|
}
|
|
1437
1539
|
|
|
1438
|
-
export { AiChat, AiChatComponents, AiChatComponentsEmptyProps, AiChatComponentsLoadingProps, AiChatProps, AiTool, AiToolIconProps, AiToolProps, Comment, CommentAttachmentArgs, CommentOverrides, CommentProps, Composer, ComposerBodyMark, ComposerBodyMarks, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, HistoryVersionSummary, HistoryVersionSummaryList, HistoryVersionSummaryListProps, HistoryVersionSummaryProps, icon as Icon, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationInspectorProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUiConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useOverrides };
|
|
1540
|
+
export { AiChat, AiChatComponents, AiChatComponentsEmptyProps, AiChatComponentsLoadingProps, AiChatProps, AiComposerSubmitMessage, AiTool, AiToolIconProps, AiToolProps, Comment, CommentAttachmentArgs, CommentOverrides, CommentProps, Composer, ComposerBodyMark, ComposerBodyMarks, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, HistoryVersionSummary, HistoryVersionSummaryList, HistoryVersionSummaryListProps, HistoryVersionSummaryProps, icon as Icon, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationInspectorProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUiConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useOverrides };
|
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 {\n AiChatComponents,\n AiChatComponentsEmptyProps,\n AiChatComponentsLoadingProps,\n AiChatProps,\n} from \"./components/AiChat\";\nexport { AiChat } from \"./components/AiChat\";\nexport type { AiToolIconProps, AiToolProps } from \"./components/AiTool\";\nexport { AiTool } from \"./components/AiTool\";\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 InboxNotificationInspectorProps,\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 * as Icon from \"./icon\";\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 {
|
|
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 {\n AiChatComponents,\n AiChatComponentsEmptyProps,\n AiChatComponentsLoadingProps,\n AiChatProps,\n} from \"./components/AiChat\";\nexport { AiChat } from \"./components/AiChat\";\nexport type { AiToolIconProps, AiToolProps } from \"./components/AiTool\";\nexport { AiTool } from \"./components/AiTool\";\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 InboxNotificationInspectorProps,\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 * as Icon from \"./icon\";\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 {\n AiComposerSubmitMessage,\n ComposerSubmitComment,\n} from \"./primitives\";\nexport type {\n CommentAttachmentArgs,\n ComposerBodyMark,\n ComposerBodyMarks,\n} from \"./types\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
|
package/dist/overrides.cjs
CHANGED
|
@@ -69,6 +69,7 @@ const defaultOverrides = {
|
|
|
69
69
|
THREAD_UNSUBSCRIBE: "Unsubscribe from thread",
|
|
70
70
|
THREAD_NEW_INDICATOR: "New",
|
|
71
71
|
THREAD_NEW_INDICATOR_DESCRIPTION: "New comments",
|
|
72
|
+
THREAD_SHOW_MORE_COMMENTS: (count) => `Show ${count} more ${pluralize.pluralize(count, "reply", "replies")}`,
|
|
72
73
|
THREAD_COMPOSER_PLACEHOLDER: "Reply to thread\u2026",
|
|
73
74
|
THREAD_COMPOSER_SEND: "Reply",
|
|
74
75
|
INBOX_NOTIFICATION_MORE: "More",
|
|
@@ -121,9 +122,9 @@ const defaultOverrides = {
|
|
|
121
122
|
HISTORY_VERSION_PREVIEW_RESTORE: "Restore",
|
|
122
123
|
HISTORY_VERSION_PREVIEW_EMPTY: "No content.",
|
|
123
124
|
HISTORY_VERSION_PREVIEW_ERROR: () => "There was an error while getting this version.",
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
AI_COMPOSER_PLACEHOLDER: "Ask anything\u2026",
|
|
126
|
+
AI_COMPOSER_SEND: "Send",
|
|
127
|
+
AI_COMPOSER_ABORT: "Abort response",
|
|
127
128
|
AI_CHAT_MESSAGE_DELETED: "This message has been deleted.",
|
|
128
129
|
AI_CHAT_MESSAGE_THINKING: "Thinking\u2026",
|
|
129
130
|
AI_CHAT_MESSAGE_REASONING: (isStreaming) => isStreaming ? "Reasoning\u2026" : "Reasoning",
|
package/dist/overrides.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.cjs","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport { assertNever } from \"@liveblocks/core\";\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { ComposerBodyMark, 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 EMOJI_PICKER_CHANGE_SKIN_TONE: string;\n ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;\n ATTACHMENT_ERROR: (error: Error) => string;\n COPY_TO_CLIPBOARD: 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 COMPOSER_TOGGLE_MARK: (mark: ComposerBodyMark) => string;\n}\n\nexport interface AiToolConfirmationOverrides {\n AI_TOOL_CONFIRMATION_CONFIRM: string;\n AI_TOOL_CONFIRMATION_CANCEL: string;\n}\n\nexport interface
|
|
1
|
+
{"version":3,"file":"overrides.cjs","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport { assertNever } from \"@liveblocks/core\";\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { ComposerBodyMark, 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 EMOJI_PICKER_CHANGE_SKIN_TONE: string;\n ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;\n ATTACHMENT_ERROR: (error: Error) => string;\n COPY_TO_CLIPBOARD: 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 COMPOSER_TOGGLE_MARK: (mark: ComposerBodyMark) => string;\n}\n\nexport interface AiToolConfirmationOverrides {\n AI_TOOL_CONFIRMATION_CONFIRM: string;\n AI_TOOL_CONFIRMATION_CANCEL: string;\n}\n\nexport interface AiComposerOverrides {\n AI_COMPOSER_PLACEHOLDER: string;\n AI_COMPOSER_SEND: string;\n AI_COMPOSER_ABORT: string;\n}\n\nexport interface AiChatMessageOverrides {\n AI_CHAT_MESSAGE_DELETED: string;\n AI_CHAT_MESSAGE_THINKING: string;\n AI_CHAT_MESSAGE_REASONING: (isStreaming: boolean) => string;\n}\n\nexport interface AiChatOverrides {\n AI_CHAT_MESSAGES_ERROR: (error: Error) => ReactNode;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_SUBSCRIBE: string;\n THREAD_UNSUBSCRIBE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_SHOW_MORE_COMMENTS: (count: number) => 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 AiComposerOverrides &\n AiChatMessageOverrides &\n AiChatOverrides &\n AiToolConfirmationOverrides;\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 COPY_TO_CLIPBOARD: \"Copy\",\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 EMOJI_PICKER_CHANGE_SKIN_TONE: \"Change skin tone\",\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 COMPOSER_TOGGLE_MARK: (format) => {\n switch (format) {\n case \"bold\":\n return \"Bold\";\n case \"italic\":\n return \"Italic\";\n case \"strikethrough\":\n return \"Strikethrough\";\n case \"code\":\n return \"Inline code\";\n default:\n return assertNever(format, \"Unexpected mark\");\n }\n },\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_SUBSCRIBE: \"Subscribe to thread\",\n THREAD_UNSUBSCRIBE: \"Unsubscribe from thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_SHOW_MORE_COMMENTS: (count) =>\n `Show ${count} more ${pluralize(count, \"reply\", \"replies\")}`,\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 AI_COMPOSER_PLACEHOLDER: \"Ask anything…\",\n AI_COMPOSER_SEND: \"Send\",\n AI_COMPOSER_ABORT: \"Abort response\",\n AI_CHAT_MESSAGE_DELETED: \"This message has been deleted.\",\n AI_CHAT_MESSAGE_THINKING: \"Thinking…\",\n AI_CHAT_MESSAGE_REASONING: (isStreaming) =>\n isStreaming ? \"Reasoning…\" : \"Reasoning\",\n AI_CHAT_MESSAGES_ERROR: () =>\n \"There was an error while getting the messages.\",\n AI_TOOL_CONFIRMATION_CONFIRM: \"Confirm\",\n AI_TOOL_CONFIRMATION_CANCEL: \"Cancel\",\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":";;;;;;;;;;AAsIO;AAAoC;AACjC;AACH;AACM;AACG;AACK;AACW;AACuC;AAExB;AACZ;AACb;AAElB;AAC6B;AAEoB;AAC3B;AACC;AACF;AACA;AACK;AACN;AACP;AAEb;AAAgB;AAEZ;AAAO;AAEP;AAAO;AAEP;AAAO;AAEP;AAAO;AAEP;AAA4C;AAChD;AACF;AACgB;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACW;AACL;AAEpB;AACG;AAAA;AAAK;AAAe;AAAM;AAAc;AAAA;AAC3C;AAGwD;AAC1C;AACE;AACA;AACE;AACE;AACY;AAEyB;AAC9B;AACP;AACG;AACQ;AACN;AAKzB;AACG;AAAA;AAAK;AACE;AAAE;AAAA;AAAK;AAAA;AAAW;AAAE;AAAY;AAAA;AAC1C;AAGA;AACG;AAAA;AAAK;AAAsB;AAAE;AAAA;AAAK;AAAA;AAAW;AAAA;AAChD;AAGA;AACG;AAAA;AAAK;AAAsB;AAAE;AAAA;AAAK;AAAA;AAAW;AAAA;AAChD;AAGA;AAAE;AAAA;AAAY;AAAA;AAAK;AAEY;AACF;AAE7B;AACuB;AACP;AACC;AACM;AACC;AAEK;AAE7B;AAC4B;AAEhC;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;AAC/B;AAGP;;;;;"}
|
package/dist/overrides.js
CHANGED
|
@@ -67,6 +67,7 @@ const defaultOverrides = {
|
|
|
67
67
|
THREAD_UNSUBSCRIBE: "Unsubscribe from thread",
|
|
68
68
|
THREAD_NEW_INDICATOR: "New",
|
|
69
69
|
THREAD_NEW_INDICATOR_DESCRIPTION: "New comments",
|
|
70
|
+
THREAD_SHOW_MORE_COMMENTS: (count) => `Show ${count} more ${pluralize(count, "reply", "replies")}`,
|
|
70
71
|
THREAD_COMPOSER_PLACEHOLDER: "Reply to thread\u2026",
|
|
71
72
|
THREAD_COMPOSER_SEND: "Reply",
|
|
72
73
|
INBOX_NOTIFICATION_MORE: "More",
|
|
@@ -119,9 +120,9 @@ const defaultOverrides = {
|
|
|
119
120
|
HISTORY_VERSION_PREVIEW_RESTORE: "Restore",
|
|
120
121
|
HISTORY_VERSION_PREVIEW_EMPTY: "No content.",
|
|
121
122
|
HISTORY_VERSION_PREVIEW_ERROR: () => "There was an error while getting this version.",
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
AI_COMPOSER_PLACEHOLDER: "Ask anything\u2026",
|
|
124
|
+
AI_COMPOSER_SEND: "Send",
|
|
125
|
+
AI_COMPOSER_ABORT: "Abort response",
|
|
125
126
|
AI_CHAT_MESSAGE_DELETED: "This message has been deleted.",
|
|
126
127
|
AI_CHAT_MESSAGE_THINKING: "Thinking\u2026",
|
|
127
128
|
AI_CHAT_MESSAGE_REASONING: (isStreaming) => isStreaming ? "Reasoning\u2026" : "Reasoning",
|
package/dist/overrides.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport { assertNever } from \"@liveblocks/core\";\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { ComposerBodyMark, 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 EMOJI_PICKER_CHANGE_SKIN_TONE: string;\n ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;\n ATTACHMENT_ERROR: (error: Error) => string;\n COPY_TO_CLIPBOARD: 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 COMPOSER_TOGGLE_MARK: (mark: ComposerBodyMark) => string;\n}\n\nexport interface AiToolConfirmationOverrides {\n AI_TOOL_CONFIRMATION_CONFIRM: string;\n AI_TOOL_CONFIRMATION_CANCEL: string;\n}\n\nexport interface
|
|
1
|
+
{"version":3,"file":"overrides.js","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport { assertNever } from \"@liveblocks/core\";\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { ComposerBodyMark, 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 EMOJI_PICKER_CHANGE_SKIN_TONE: string;\n ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;\n ATTACHMENT_ERROR: (error: Error) => string;\n COPY_TO_CLIPBOARD: 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 COMPOSER_TOGGLE_MARK: (mark: ComposerBodyMark) => string;\n}\n\nexport interface AiToolConfirmationOverrides {\n AI_TOOL_CONFIRMATION_CONFIRM: string;\n AI_TOOL_CONFIRMATION_CANCEL: string;\n}\n\nexport interface AiComposerOverrides {\n AI_COMPOSER_PLACEHOLDER: string;\n AI_COMPOSER_SEND: string;\n AI_COMPOSER_ABORT: string;\n}\n\nexport interface AiChatMessageOverrides {\n AI_CHAT_MESSAGE_DELETED: string;\n AI_CHAT_MESSAGE_THINKING: string;\n AI_CHAT_MESSAGE_REASONING: (isStreaming: boolean) => string;\n}\n\nexport interface AiChatOverrides {\n AI_CHAT_MESSAGES_ERROR: (error: Error) => ReactNode;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_SUBSCRIBE: string;\n THREAD_UNSUBSCRIBE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_SHOW_MORE_COMMENTS: (count: number) => 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 AiComposerOverrides &\n AiChatMessageOverrides &\n AiChatOverrides &\n AiToolConfirmationOverrides;\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 COPY_TO_CLIPBOARD: \"Copy\",\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 EMOJI_PICKER_CHANGE_SKIN_TONE: \"Change skin tone\",\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 COMPOSER_TOGGLE_MARK: (format) => {\n switch (format) {\n case \"bold\":\n return \"Bold\";\n case \"italic\":\n return \"Italic\";\n case \"strikethrough\":\n return \"Strikethrough\";\n case \"code\":\n return \"Inline code\";\n default:\n return assertNever(format, \"Unexpected mark\");\n }\n },\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_SUBSCRIBE: \"Subscribe to thread\",\n THREAD_UNSUBSCRIBE: \"Unsubscribe from thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_SHOW_MORE_COMMENTS: (count) =>\n `Show ${count} more ${pluralize(count, \"reply\", \"replies\")}`,\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 AI_COMPOSER_PLACEHOLDER: \"Ask anything…\",\n AI_COMPOSER_SEND: \"Send\",\n AI_COMPOSER_ABORT: \"Abort response\",\n AI_CHAT_MESSAGE_DELETED: \"This message has been deleted.\",\n AI_CHAT_MESSAGE_THINKING: \"Thinking…\",\n AI_CHAT_MESSAGE_REASONING: (isStreaming) =>\n isStreaming ? \"Reasoning…\" : \"Reasoning\",\n AI_CHAT_MESSAGES_ERROR: () =>\n \"There was an error while getting the messages.\",\n AI_TOOL_CONFIRMATION_CONFIRM: \"Confirm\",\n AI_TOOL_CONFIRMATION_CANCEL: \"Cancel\",\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":";;;;;;;;AAsIO;AAAoC;AACjC;AACH;AACM;AACG;AACK;AACW;AACuC;AAExB;AACZ;AACb;AAElB;AAC6B;AAEoB;AAC3B;AACC;AACF;AACA;AACK;AACN;AACP;AAEb;AAAgB;AAEZ;AAAO;AAEP;AAAO;AAEP;AAAO;AAEP;AAAO;AAEP;AAA4C;AAChD;AACF;AACgB;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACW;AACL;AAEpB;AACG;AAAA;AAAK;AAAe;AAAM;AAAc;AAAA;AAC3C;AAGwD;AAC1C;AACE;AACA;AACE;AACE;AACY;AAEyB;AAC9B;AACP;AACG;AACQ;AACN;AAKzB;AACG;AAAA;AAAK;AACE;AAAE;AAAA;AAAK;AAAA;AAAW;AAAE;AAAY;AAAA;AAC1C;AAGA;AACG;AAAA;AAAK;AAAsB;AAAE;AAAA;AAAK;AAAA;AAAW;AAAA;AAChD;AAGA;AACG;AAAA;AAAK;AAAsB;AAAE;AAAA;AAAK;AAAA;AAAW;AAAA;AAChD;AAGA;AAAE;AAAA;AAAY;AAAA;AAAK;AAEY;AACF;AAE7B;AACuB;AACP;AACC;AACM;AACC;AAEK;AAE7B;AAC4B;AAEhC;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;AAC/B;AAGP;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@liveblocks/core');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const AiComposerContext = react.createContext(null);
|
|
7
|
+
const AiComposerEditorContext = react.createContext(null);
|
|
8
|
+
function useAiComposerEditorContext() {
|
|
9
|
+
const composerEditorContext = react.useContext(AiComposerEditorContext);
|
|
10
|
+
return core.nn(
|
|
11
|
+
composerEditorContext,
|
|
12
|
+
"AiComposer.Form is missing from the React tree."
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
function useAiComposer() {
|
|
16
|
+
const composerContext = react.useContext(AiComposerContext);
|
|
17
|
+
return core.nn(composerContext, "AiComposer.Form is missing from the React tree.");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.AiComposerContext = AiComposerContext;
|
|
21
|
+
exports.AiComposerEditorContext = AiComposerEditorContext;
|
|
22
|
+
exports.useAiComposer = useAiComposer;
|
|
23
|
+
exports.useAiComposerEditorContext = useAiComposerEditorContext;
|
|
24
|
+
//# sourceMappingURL=contexts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.cjs","sources":["../../../src/primitives/AiComposer/contexts.ts"],"sourcesContent":["import { type MessageId, nn } from \"@liveblocks/core\";\nimport {\n createContext,\n type Dispatch,\n type SetStateAction,\n useContext,\n} from \"react\";\nimport type {\n Descendant as SlateDescendant,\n Editor as SlateEditor,\n} from \"slate\";\n\nexport type AiComposerContext = {\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 composer can currently abort a response in its related chat.\n */\n canAbort: 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 * Abort the composer's related response programmatically.\n */\n abort: () => 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\nexport type AiComposerEditorContext = {\n onEditorValueChange: (value: SlateDescendant[]) => void;\n editor: SlateEditor;\n abortableMessageId: MessageId | undefined;\n setFocused: Dispatch<SetStateAction<boolean>>;\n};\n\nexport const AiComposerContext = createContext<AiComposerContext | null>(null);\nexport const AiComposerEditorContext =\n createContext<AiComposerEditorContext | null>(null);\n\nexport function useAiComposerEditorContext() {\n const composerEditorContext = useContext(AiComposerEditorContext);\n\n return nn(\n composerEditorContext,\n \"AiComposer.Form is missing from the React tree.\"\n );\n}\n\nexport function useAiComposer(): AiComposerContext {\n const composerContext = useContext(AiComposerContext);\n\n return nn(composerContext, \"AiComposer.Form is missing from the React tree.\");\n}\n"],"names":["createContext","useContext","nn"],"mappings":";;;;;AA4Ea,MAAA,iBAAA,GAAoBA,oBAAwC,IAAI,EAAA;AAChE,MAAA,uBAAA,GACXA,oBAA8C,IAAI,EAAA;AAE7C,SAAS,0BAA6B,GAAA;AAC3C,EAAM,MAAA,qBAAA,GAAwBC,iBAAW,uBAAuB,CAAA,CAAA;AAEhE,EAAO,OAAAC,OAAA;AAAA,IACL,qBAAA;AAAA,IACA,iDAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEO,SAAS,aAAmC,GAAA;AACjD,EAAM,MAAA,eAAA,GAAkBD,iBAAW,iBAAiB,CAAA,CAAA;AAEpD,EAAO,OAAAC,OAAA,CAAG,iBAAiB,iDAAiD,CAAA,CAAA;AAC9E;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { nn } from '@liveblocks/core';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const AiComposerContext = createContext(null);
|
|
5
|
+
const AiComposerEditorContext = createContext(null);
|
|
6
|
+
function useAiComposerEditorContext() {
|
|
7
|
+
const composerEditorContext = useContext(AiComposerEditorContext);
|
|
8
|
+
return nn(
|
|
9
|
+
composerEditorContext,
|
|
10
|
+
"AiComposer.Form is missing from the React tree."
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
function useAiComposer() {
|
|
14
|
+
const composerContext = useContext(AiComposerContext);
|
|
15
|
+
return nn(composerContext, "AiComposer.Form is missing from the React tree.");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { AiComposerContext, AiComposerEditorContext, useAiComposer, useAiComposerEditorContext };
|
|
19
|
+
//# sourceMappingURL=contexts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.js","sources":["../../../src/primitives/AiComposer/contexts.ts"],"sourcesContent":["import { type MessageId, nn } from \"@liveblocks/core\";\nimport {\n createContext,\n type Dispatch,\n type SetStateAction,\n useContext,\n} from \"react\";\nimport type {\n Descendant as SlateDescendant,\n Editor as SlateEditor,\n} from \"slate\";\n\nexport type AiComposerContext = {\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 composer can currently abort a response in its related chat.\n */\n canAbort: 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 * Abort the composer's related response programmatically.\n */\n abort: () => 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\nexport type AiComposerEditorContext = {\n onEditorValueChange: (value: SlateDescendant[]) => void;\n editor: SlateEditor;\n abortableMessageId: MessageId | undefined;\n setFocused: Dispatch<SetStateAction<boolean>>;\n};\n\nexport const AiComposerContext = createContext<AiComposerContext | null>(null);\nexport const AiComposerEditorContext =\n createContext<AiComposerEditorContext | null>(null);\n\nexport function useAiComposerEditorContext() {\n const composerEditorContext = useContext(AiComposerEditorContext);\n\n return nn(\n composerEditorContext,\n \"AiComposer.Form is missing from the React tree.\"\n );\n}\n\nexport function useAiComposer(): AiComposerContext {\n const composerContext = useContext(AiComposerContext);\n\n return nn(composerContext, \"AiComposer.Form is missing from the React tree.\");\n}\n"],"names":[],"mappings":";;;AA4Ea,MAAA,iBAAA,GAAoB,cAAwC,IAAI,EAAA;AAChE,MAAA,uBAAA,GACX,cAA8C,IAAI,EAAA;AAE7C,SAAS,0BAA6B,GAAA;AAC3C,EAAM,MAAA,qBAAA,GAAwB,WAAW,uBAAuB,CAAA,CAAA;AAEhE,EAAO,OAAA,EAAA;AAAA,IACL,qBAAA;AAAA,IACA,iDAAA;AAAA,GACF,CAAA;AACF,CAAA;AAEO,SAAS,aAAmC,GAAA;AACjD,EAAM,MAAA,eAAA,GAAkB,WAAW,iBAAiB,CAAA,CAAA;AAEpD,EAAO,OAAA,EAAA,CAAG,iBAAiB,iDAAiD,CAAA,CAAA;AAC9E;;;;"}
|