@liveblocks/react-ui 2.12.2 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_private/index.d.mts +1 -1
- package/dist/_private/index.d.ts +1 -1
- package/dist/components/Comment.js +2 -0
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Comment.mjs +2 -0
- package/dist/components/Comment.mjs.map +1 -1
- package/dist/components/Composer.js +74 -6
- package/dist/components/Composer.js.map +1 -1
- package/dist/components/Composer.mjs +77 -9
- package/dist/components/Composer.mjs.map +1 -1
- package/dist/components/HistoryVersionSummary.js +1 -0
- package/dist/components/HistoryVersionSummary.js.map +1 -1
- package/dist/components/HistoryVersionSummary.mjs +1 -0
- package/dist/components/HistoryVersionSummary.mjs.map +1 -1
- package/dist/components/Thread.js +3 -0
- package/dist/components/Thread.js.map +1 -1
- package/dist/components/Thread.mjs +3 -0
- package/dist/components/Thread.mjs.map +1 -1
- package/dist/components/internal/Button.js.map +1 -1
- package/dist/components/internal/Button.mjs.map +1 -1
- package/dist/icons/Bold.js +15 -0
- package/dist/icons/Bold.js.map +1 -0
- package/dist/icons/Bold.mjs +13 -0
- package/dist/icons/Bold.mjs.map +1 -0
- package/dist/icons/Code.js +15 -0
- package/dist/icons/Code.js.map +1 -0
- package/dist/icons/Code.mjs +13 -0
- package/dist/icons/Code.mjs.map +1 -0
- package/dist/icons/Italic.js +15 -0
- package/dist/icons/Italic.js.map +1 -0
- package/dist/icons/Italic.mjs +13 -0
- package/dist/icons/Italic.mjs.map +1 -0
- package/dist/icons/Strikethrough.js +15 -0
- package/dist/icons/Strikethrough.js.map +1 -0
- package/dist/icons/Strikethrough.mjs +13 -0
- package/dist/icons/Strikethrough.mjs.map +1 -0
- package/dist/index.d.mts +94 -103
- package/dist/index.d.ts +94 -103
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/overrides.js +15 -0
- package/dist/overrides.js.map +1 -1
- package/dist/overrides.mjs +15 -0
- package/dist/overrides.mjs.map +1 -1
- package/dist/primitives/Composer/contexts.js +12 -0
- package/dist/primitives/Composer/contexts.js.map +1 -1
- package/dist/primitives/Composer/contexts.mjs +11 -1
- package/dist/primitives/Composer/contexts.mjs.map +1 -1
- package/dist/primitives/Composer/index.js +251 -76
- package/dist/primitives/Composer/index.js.map +1 -1
- package/dist/primitives/Composer/index.mjs +239 -85
- package/dist/primitives/Composer/index.mjs.map +1 -1
- package/dist/primitives/Composer/utils.js +94 -21
- package/dist/primitives/Composer/utils.js.map +1 -1
- package/dist/primitives/Composer/utils.mjs +91 -20
- package/dist/primitives/Composer/utils.mjs.map +1 -1
- package/dist/primitives/index.d.mts +57 -1
- package/dist/primitives/index.d.ts +57 -1
- package/dist/slate/plugins/auto-formatting.js +1 -2
- package/dist/slate/plugins/auto-formatting.js.map +1 -1
- package/dist/slate/plugins/auto-formatting.mjs +1 -2
- package/dist/slate/plugins/auto-formatting.mjs.map +1 -1
- package/dist/slate/plugins/auto-links.js +3 -2
- package/dist/slate/plugins/auto-links.js.map +1 -1
- package/dist/slate/plugins/auto-links.mjs +2 -1
- package/dist/slate/plugins/auto-links.mjs.map +1 -1
- package/dist/slate/plugins/custom-links.js +3 -2
- package/dist/slate/plugins/custom-links.js.map +1 -1
- package/dist/slate/plugins/custom-links.mjs +2 -1
- package/dist/slate/plugins/custom-links.mjs.map +1 -1
- package/dist/slate/plugins/mentions.js +3 -4
- package/dist/slate/plugins/mentions.js.map +1 -1
- package/dist/slate/plugins/mentions.mjs +4 -5
- package/dist/slate/plugins/mentions.mjs.map +1 -1
- package/dist/slate/utils/marks.js +27 -8
- package/dist/slate/utils/marks.js.map +1 -1
- package/dist/slate/utils/marks.mjs +27 -10
- package/dist/slate/utils/marks.mjs.map +1 -1
- package/dist/utils/use-observable.js +15 -0
- package/dist/utils/use-observable.js.map +1 -0
- package/dist/utils/use-observable.mjs +13 -0
- package/dist/utils/use-observable.mjs.map +1 -0
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +4 -4
- package/src/styles/constants.css +1 -1
- package/src/styles/index.css +70 -9
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/slate/utils/is-selection-collapsed.js +0 -10
- package/dist/slate/utils/is-selection-collapsed.js.map +0 -1
- package/dist/slate/utils/is-selection-collapsed.mjs +0 -8
- package/dist/slate/utils/is-selection-collapsed.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thread.mjs","sources":["../../src/components/Thread.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n BaseMetadata,\n CommentData,\n DM,\n ThreadData,\n} from \"@liveblocks/core\";\nimport { useThreadSubscription } from \"@liveblocks/react\";\nimport {\n useMarkRoomThreadAsResolved,\n useMarkRoomThreadAsUnresolved,\n} from \"@liveblocks/react/_private\";\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport type {\n ComponentPropsWithoutRef,\n ForwardedRef,\n RefAttributes,\n SyntheticEvent,\n} from \"react\";\nimport React, {\n forwardRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nimport { ArrowDownIcon } from \"../icons/ArrowDown\";\nimport { ResolveIcon } from \"../icons/Resolve\";\nimport { ResolvedIcon } from \"../icons/Resolved\";\nimport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n ThreadOverrides,\n} from \"../overrides\";\nimport { useOverrides } from \"../overrides\";\nimport { classNames } from \"../utils/class-names\";\nimport { findLastIndex } from \"../utils/find-last-index\";\nimport type { CommentProps } from \"./Comment\";\nimport { Comment } from \"./Comment\";\nimport type { ComposerProps } from \"./Composer\";\nimport { Composer } from \"./Composer\";\nimport { Button } from \"./internal/Button\";\nimport { Tooltip, TooltipProvider } from \"./internal/Tooltip\";\n\nexport interface ThreadProps<M extends BaseMetadata = DM>\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The thread to display.\n */\n thread: ThreadData<M>;\n\n /**\n * How to show or hide the composer to reply to the thread.\n */\n showComposer?: boolean | \"collapsed\";\n\n /**\n * Whether to show the action to resolve the thread.\n */\n showResolveAction?: boolean;\n\n /**\n * How to show or hide the actions.\n */\n showActions?: CommentProps[\"showActions\"];\n\n /**\n * Whether to show reactions.\n */\n showReactions?: CommentProps[\"showReactions\"];\n\n /**\n * Whether to indent the comments' content.\n */\n indentCommentContent?: CommentProps[\"indentContent\"];\n\n /**\n * Whether to show deleted comments.\n */\n showDeletedComments?: CommentProps[\"showDeleted\"];\n\n /**\n * Whether to show attachments.\n */\n showAttachments?: boolean;\n\n /**\n * The event handler called when changing the resolved status.\n */\n onResolvedChange?: (resolved: boolean) => void;\n\n /**\n * The event handler called when a comment is edited.\n */\n onCommentEdit?: CommentProps[\"onCommentEdit\"];\n\n /**\n * The event handler called when a comment is deleted.\n */\n onCommentDelete?: CommentProps[\"onCommentDelete\"];\n\n /**\n * The event handler called when the thread is deleted.\n * A thread is deleted when all its comments are deleted.\n */\n onThreadDelete?: (thread: ThreadData<M>) => void;\n\n /**\n * The event handler called when clicking on a comment's author.\n */\n onAuthorClick?: CommentProps[\"onAuthorClick\"];\n\n /**\n * The event handler called when clicking on a mention.\n */\n onMentionClick?: CommentProps[\"onMentionClick\"];\n\n /**\n * The event handler called when clicking on a comment's attachment.\n */\n onAttachmentClick?: CommentProps[\"onAttachmentClick\"];\n\n /**\n * The event handler called when the composer is submitted.\n */\n onComposerSubmit?: ComposerProps[\"onComposerSubmit\"];\n\n /**\n * Override the component's strings.\n */\n overrides?: Partial<\n GlobalOverrides & ThreadOverrides & CommentOverrides & ComposerOverrides\n >;\n}\n\n/**\n * Displays a thread of comments, with a composer to reply\n * to it.\n *\n * @example\n * <>\n * {threads.map((thread) => (\n * <Thread key={thread.id} thread={thread} />\n * ))}\n * </>\n */\nexport const Thread = forwardRef(\n <M extends BaseMetadata = DM>(\n {\n thread,\n indentCommentContent = true,\n showActions = \"hover\",\n showDeletedComments,\n showResolveAction = true,\n showReactions = true,\n showComposer = \"collapsed\",\n showAttachments = true,\n onResolvedChange,\n onCommentEdit,\n onCommentDelete,\n onThreadDelete,\n onAuthorClick,\n onMentionClick,\n onAttachmentClick,\n onComposerSubmit,\n overrides,\n className,\n ...props\n }: ThreadProps<M>,\n forwardedRef: ForwardedRef<HTMLDivElement>\n ) => {\n const markThreadAsResolved = useMarkRoomThreadAsResolved(thread.roomId);\n const markThreadAsUnresolved = useMarkRoomThreadAsUnresolved(thread.roomId);\n const $ = useOverrides(overrides);\n const firstCommentIndex = useMemo(() => {\n return showDeletedComments\n ? 0\n : thread.comments.findIndex((comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const lastCommentIndex = useMemo(() => {\n return showDeletedComments\n ? thread.comments.length - 1\n : findLastIndex(thread.comments, (comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const { status: subscriptionStatus, unreadSince } = useThreadSubscription(\n thread.id\n );\n const unreadIndex = useMemo(() => {\n // The user is not subscribed to this thread.\n if (subscriptionStatus !== \"subscribed\") {\n return;\n }\n\n // The user hasn't read the thread yet, so all comments are unread.\n if (unreadSince === null) {\n return firstCommentIndex;\n }\n\n // The user has read the thread, so we find the first unread comment.\n const unreadIndex = thread.comments.findIndex(\n (comment) =>\n (showDeletedComments ? true : comment.body) &&\n comment.createdAt > unreadSince\n );\n\n return unreadIndex >= 0 && unreadIndex < thread.comments.length\n ? unreadIndex\n : undefined;\n }, [\n firstCommentIndex,\n showDeletedComments,\n subscriptionStatus,\n thread.comments,\n unreadSince,\n ]);\n const [newIndex, setNewIndex] = useState<number>();\n const newIndicatorIndex = newIndex === undefined ? unreadIndex : newIndex;\n\n useEffect(() => {\n if (unreadIndex) {\n // Keep the \"new\" indicator at the lowest unread index.\n setNewIndex((persistedUnreadIndex) =>\n Math.min(persistedUnreadIndex ?? Infinity, unreadIndex)\n );\n }\n }, [unreadIndex]);\n\n const stopPropagation = useCallback((event: SyntheticEvent) => {\n event.stopPropagation();\n }, []);\n\n const handleResolvedChange = useCallback(\n (resolved: boolean) => {\n onResolvedChange?.(resolved);\n\n if (resolved) {\n markThreadAsResolved(thread.id);\n } else {\n markThreadAsUnresolved(thread.id);\n }\n },\n [\n markThreadAsResolved,\n markThreadAsUnresolved,\n onResolvedChange,\n thread.id,\n ]\n );\n\n const handleCommentDelete = useCallback(\n (comment: CommentData) => {\n onCommentDelete?.(comment);\n\n const filteredComments = thread.comments.filter(\n (comment) => comment.body\n );\n\n if (filteredComments.length <= 1) {\n onThreadDelete?.(thread);\n }\n },\n [onCommentDelete, onThreadDelete, thread]\n );\n\n return (\n <TooltipProvider>\n <div\n className={classNames(\n \"lb-root lb-thread\",\n showActions === \"hover\" && \"lb-thread:show-actions-hover\",\n className\n )}\n data-resolved={thread.resolved ? \"\" : undefined}\n data-unread={unreadIndex !== undefined ? \"\" : undefined}\n dir={$.dir}\n {...props}\n ref={forwardedRef}\n >\n <div className=\"lb-thread-comments\">\n {thread.comments.map((comment, index) => {\n const isFirstComment = index === firstCommentIndex;\n const isUnread =\n unreadIndex !== undefined && index >= unreadIndex;\n\n const children = (\n <Comment\n key={comment.id}\n className=\"lb-thread-comment\"\n data-unread={isUnread ? \"\" : undefined}\n comment={comment}\n indentContent={indentCommentContent}\n showDeleted={showDeletedComments}\n showActions={showActions}\n showReactions={showReactions}\n showAttachments={showAttachments}\n onCommentEdit={onCommentEdit}\n onCommentDelete={handleCommentDelete}\n onAuthorClick={onAuthorClick}\n onMentionClick={onMentionClick}\n onAttachmentClick={onAttachmentClick}\n autoMarkReadThreadId={\n index === lastCommentIndex && isUnread\n ? thread.id\n : undefined\n }\n additionalActionsClassName={\n isFirstComment ? \"lb-thread-actions\" : undefined\n }\n additionalActions={\n isFirstComment && showResolveAction ? (\n <Tooltip\n content={\n thread.resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n <TogglePrimitive.Root\n pressed={thread.resolved}\n onPressedChange={handleResolvedChange}\n asChild\n >\n <Button\n className=\"lb-comment-action\"\n onClick={stopPropagation}\n aria-label={\n thread.resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n {thread.resolved ? (\n <ResolvedIcon className=\"lb-button-icon\" />\n ) : (\n <ResolveIcon className=\"lb-button-icon\" />\n )}\n </Button>\n </TogglePrimitive.Root>\n </Tooltip>\n ) : null\n }\n />\n );\n\n return index === newIndicatorIndex &&\n newIndicatorIndex !== firstCommentIndex &&\n newIndicatorIndex <= lastCommentIndex ? (\n <Fragment key={comment.id}>\n <div\n className=\"lb-thread-new-indicator\"\n aria-label={$.THREAD_NEW_INDICATOR_DESCRIPTION}\n >\n <span className=\"lb-thread-new-indicator-label\">\n <ArrowDownIcon className=\"lb-thread-new-indicator-label-icon\" />\n {$.THREAD_NEW_INDICATOR}\n </span>\n </div>\n {children}\n </Fragment>\n ) : (\n children\n );\n })}\n </div>\n {showComposer && (\n <Composer\n className=\"lb-thread-composer\"\n threadId={thread.id}\n defaultCollapsed={showComposer === \"collapsed\" ? true : undefined}\n showAttachments={showAttachments}\n onComposerSubmit={onComposerSubmit}\n overrides={{\n COMPOSER_PLACEHOLDER: $.THREAD_COMPOSER_PLACEHOLDER,\n COMPOSER_SEND: $.THREAD_COMPOSER_SEND,\n }}\n roomId={thread.roomId}\n />\n )}\n </div>\n </TooltipProvider>\n );\n }\n) as <M extends BaseMetadata = DM>(\n props: ThreadProps<M> & RefAttributes<HTMLDivElement>\n) => JSX.Element;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAsJO;AAAe;AAElB;AACE;AACuB;AACT;AACd;AACoB;AACJ;AACD;AACG;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACG;AAIL;AACA;AACA;AACA;AACE;AAEuD;AAEzD;AACE;AAE4D;AAE9D;AAAoD;AAC3C;AAET;AAEE;AACE;AAAA;AAIF;AACE;AAAO;AAIT;AAAoC;AAGZ;AAGxB;AAEI;AACH;AACD;AACA;AACA;AACO;AACP;AAEF;AACA;AAEA;AACE;AAEE;AAAA;AACwD;AACxD;AACF;AAGF;AACE;AAAsB;AAGxB;AAA6B;AAEzB;AAEA;AACE;AAA8B;AAE9B;AAAgC;AAClC;AACF;AACA;AACE;AACA;AACA;AACO;AACT;AAGF;AAA4B;AAExB;AAEA;AAAyC;AAClB;AAGvB;AACE;AAAuB;AACzB;AACF;AACwC;AAG1C;AAEK;AACY;AACT;AAC2B;AAC3B;AACF;AACsC;AACQ;AACvC;AACH;AACC;AAEJ;AAAc;AAEX;AACA;AAGA;AACG;AACc;AACH;AACmB;AAC7B;AACe;AACF;AACb;AACA;AACA;AACA;AACiB;AACjB;AACA;AACA;AAIM;AAGmC;AAIpC;AAIS;AAGP;AACiB;AACC;AACV;AAEN;AACW;AACD;AAID;AAIL;AAAuB;AAEvB;AAAsB;AAK7B;AAKV;AAGG;AAAsB;AACpB;AACW;AACI;AAEb;AAAe;AACb;AAAwB;AAO/B;AAKH;AACW;AACO;AACuC;AACxD;AACA;AACW;AACe;AACP;AACnB;AACe;AAIvB;AAGN;;"}
|
|
1
|
+
{"version":3,"file":"Thread.mjs","sources":["../../src/components/Thread.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n BaseMetadata,\n CommentData,\n DM,\n ThreadData,\n} from \"@liveblocks/core\";\nimport { useThreadSubscription } from \"@liveblocks/react\";\nimport {\n useMarkRoomThreadAsResolved,\n useMarkRoomThreadAsUnresolved,\n} from \"@liveblocks/react/_private\";\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport type {\n ComponentPropsWithoutRef,\n ForwardedRef,\n RefAttributes,\n SyntheticEvent,\n} from \"react\";\nimport React, {\n forwardRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nimport { ArrowDownIcon } from \"../icons/ArrowDown\";\nimport { ResolveIcon } from \"../icons/Resolve\";\nimport { ResolvedIcon } from \"../icons/Resolved\";\nimport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n ThreadOverrides,\n} from \"../overrides\";\nimport { useOverrides } from \"../overrides\";\nimport { classNames } from \"../utils/class-names\";\nimport { findLastIndex } from \"../utils/find-last-index\";\nimport type { CommentProps } from \"./Comment\";\nimport { Comment } from \"./Comment\";\nimport type { ComposerProps } from \"./Composer\";\nimport { Composer } from \"./Composer\";\nimport { Button } from \"./internal/Button\";\nimport { Tooltip, TooltipProvider } from \"./internal/Tooltip\";\n\nexport interface ThreadProps<M extends BaseMetadata = DM>\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The thread to display.\n */\n thread: ThreadData<M>;\n\n /**\n * How to show or hide the composer to reply to the thread.\n */\n showComposer?: boolean | \"collapsed\";\n\n /**\n * Whether to show the action to resolve the thread.\n */\n showResolveAction?: boolean;\n\n /**\n * How to show or hide the actions.\n */\n showActions?: CommentProps[\"showActions\"];\n\n /**\n * Whether to show reactions.\n */\n showReactions?: CommentProps[\"showReactions\"];\n\n /**\n * Whether to show the composer's formatting controls.\n */\n showComposerFormattingControls?: ComposerProps[\"showFormattingControls\"];\n\n /**\n * Whether to indent the comments' content.\n */\n indentCommentContent?: CommentProps[\"indentContent\"];\n\n /**\n * Whether to show deleted comments.\n */\n showDeletedComments?: CommentProps[\"showDeleted\"];\n\n /**\n * Whether to show attachments.\n */\n showAttachments?: boolean;\n\n /**\n * The event handler called when changing the resolved status.\n */\n onResolvedChange?: (resolved: boolean) => void;\n\n /**\n * The event handler called when a comment is edited.\n */\n onCommentEdit?: CommentProps[\"onCommentEdit\"];\n\n /**\n * The event handler called when a comment is deleted.\n */\n onCommentDelete?: CommentProps[\"onCommentDelete\"];\n\n /**\n * The event handler called when the thread is deleted.\n * A thread is deleted when all its comments are deleted.\n */\n onThreadDelete?: (thread: ThreadData<M>) => void;\n\n /**\n * The event handler called when clicking on a comment's author.\n */\n onAuthorClick?: CommentProps[\"onAuthorClick\"];\n\n /**\n * The event handler called when clicking on a mention.\n */\n onMentionClick?: CommentProps[\"onMentionClick\"];\n\n /**\n * The event handler called when clicking on a comment's attachment.\n */\n onAttachmentClick?: CommentProps[\"onAttachmentClick\"];\n\n /**\n * The event handler called when the composer is submitted.\n */\n onComposerSubmit?: ComposerProps[\"onComposerSubmit\"];\n\n /**\n * Override the component's strings.\n */\n overrides?: Partial<\n GlobalOverrides & ThreadOverrides & CommentOverrides & ComposerOverrides\n >;\n}\n\n/**\n * Displays a thread of comments, with a composer to reply\n * to it.\n *\n * @example\n * <>\n * {threads.map((thread) => (\n * <Thread key={thread.id} thread={thread} />\n * ))}\n * </>\n */\nexport const Thread = forwardRef(\n <M extends BaseMetadata = DM>(\n {\n thread,\n indentCommentContent = true,\n showActions = \"hover\",\n showDeletedComments,\n showResolveAction = true,\n showReactions = true,\n showComposer = \"collapsed\",\n showAttachments = true,\n showComposerFormattingControls = true,\n onResolvedChange,\n onCommentEdit,\n onCommentDelete,\n onThreadDelete,\n onAuthorClick,\n onMentionClick,\n onAttachmentClick,\n onComposerSubmit,\n overrides,\n className,\n ...props\n }: ThreadProps<M>,\n forwardedRef: ForwardedRef<HTMLDivElement>\n ) => {\n const markThreadAsResolved = useMarkRoomThreadAsResolved(thread.roomId);\n const markThreadAsUnresolved = useMarkRoomThreadAsUnresolved(thread.roomId);\n const $ = useOverrides(overrides);\n const firstCommentIndex = useMemo(() => {\n return showDeletedComments\n ? 0\n : thread.comments.findIndex((comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const lastCommentIndex = useMemo(() => {\n return showDeletedComments\n ? thread.comments.length - 1\n : findLastIndex(thread.comments, (comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const { status: subscriptionStatus, unreadSince } = useThreadSubscription(\n thread.id\n );\n const unreadIndex = useMemo(() => {\n // The user is not subscribed to this thread.\n if (subscriptionStatus !== \"subscribed\") {\n return;\n }\n\n // The user hasn't read the thread yet, so all comments are unread.\n if (unreadSince === null) {\n return firstCommentIndex;\n }\n\n // The user has read the thread, so we find the first unread comment.\n const unreadIndex = thread.comments.findIndex(\n (comment) =>\n (showDeletedComments ? true : comment.body) &&\n comment.createdAt > unreadSince\n );\n\n return unreadIndex >= 0 && unreadIndex < thread.comments.length\n ? unreadIndex\n : undefined;\n }, [\n firstCommentIndex,\n showDeletedComments,\n subscriptionStatus,\n thread.comments,\n unreadSince,\n ]);\n const [newIndex, setNewIndex] = useState<number>();\n const newIndicatorIndex = newIndex === undefined ? unreadIndex : newIndex;\n\n useEffect(() => {\n if (unreadIndex) {\n // Keep the \"new\" indicator at the lowest unread index.\n setNewIndex((persistedUnreadIndex) =>\n Math.min(persistedUnreadIndex ?? Infinity, unreadIndex)\n );\n }\n }, [unreadIndex]);\n\n const stopPropagation = useCallback((event: SyntheticEvent) => {\n event.stopPropagation();\n }, []);\n\n const handleResolvedChange = useCallback(\n (resolved: boolean) => {\n onResolvedChange?.(resolved);\n\n if (resolved) {\n markThreadAsResolved(thread.id);\n } else {\n markThreadAsUnresolved(thread.id);\n }\n },\n [\n markThreadAsResolved,\n markThreadAsUnresolved,\n onResolvedChange,\n thread.id,\n ]\n );\n\n const handleCommentDelete = useCallback(\n (comment: CommentData) => {\n onCommentDelete?.(comment);\n\n const filteredComments = thread.comments.filter(\n (comment) => comment.body\n );\n\n if (filteredComments.length <= 1) {\n onThreadDelete?.(thread);\n }\n },\n [onCommentDelete, onThreadDelete, thread]\n );\n\n return (\n <TooltipProvider>\n <div\n className={classNames(\n \"lb-root lb-thread\",\n showActions === \"hover\" && \"lb-thread:show-actions-hover\",\n className\n )}\n data-resolved={thread.resolved ? \"\" : undefined}\n data-unread={unreadIndex !== undefined ? \"\" : undefined}\n dir={$.dir}\n {...props}\n ref={forwardedRef}\n >\n <div className=\"lb-thread-comments\">\n {thread.comments.map((comment, index) => {\n const isFirstComment = index === firstCommentIndex;\n const isUnread =\n unreadIndex !== undefined && index >= unreadIndex;\n\n const children = (\n <Comment\n key={comment.id}\n className=\"lb-thread-comment\"\n data-unread={isUnread ? \"\" : undefined}\n comment={comment}\n indentContent={indentCommentContent}\n showDeleted={showDeletedComments}\n showActions={showActions}\n showReactions={showReactions}\n showAttachments={showAttachments}\n showComposerFormattingControls={\n showComposerFormattingControls\n }\n onCommentEdit={onCommentEdit}\n onCommentDelete={handleCommentDelete}\n onAuthorClick={onAuthorClick}\n onMentionClick={onMentionClick}\n onAttachmentClick={onAttachmentClick}\n autoMarkReadThreadId={\n index === lastCommentIndex && isUnread\n ? thread.id\n : undefined\n }\n additionalActionsClassName={\n isFirstComment ? \"lb-thread-actions\" : undefined\n }\n additionalActions={\n isFirstComment && showResolveAction ? (\n <Tooltip\n content={\n thread.resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n <TogglePrimitive.Root\n pressed={thread.resolved}\n onPressedChange={handleResolvedChange}\n asChild\n >\n <Button\n className=\"lb-comment-action\"\n onClick={stopPropagation}\n aria-label={\n thread.resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n {thread.resolved ? (\n <ResolvedIcon className=\"lb-button-icon\" />\n ) : (\n <ResolveIcon className=\"lb-button-icon\" />\n )}\n </Button>\n </TogglePrimitive.Root>\n </Tooltip>\n ) : null\n }\n />\n );\n\n return index === newIndicatorIndex &&\n newIndicatorIndex !== firstCommentIndex &&\n newIndicatorIndex <= lastCommentIndex ? (\n <Fragment key={comment.id}>\n <div\n className=\"lb-thread-new-indicator\"\n aria-label={$.THREAD_NEW_INDICATOR_DESCRIPTION}\n >\n <span className=\"lb-thread-new-indicator-label\">\n <ArrowDownIcon className=\"lb-thread-new-indicator-label-icon\" />\n {$.THREAD_NEW_INDICATOR}\n </span>\n </div>\n {children}\n </Fragment>\n ) : (\n children\n );\n })}\n </div>\n {showComposer && (\n <Composer\n className=\"lb-thread-composer\"\n threadId={thread.id}\n defaultCollapsed={showComposer === \"collapsed\" ? true : undefined}\n showAttachments={showAttachments}\n showFormattingControls={showComposerFormattingControls}\n onComposerSubmit={onComposerSubmit}\n overrides={{\n COMPOSER_PLACEHOLDER: $.THREAD_COMPOSER_PLACEHOLDER,\n COMPOSER_SEND: $.THREAD_COMPOSER_SEND,\n }}\n roomId={thread.roomId}\n />\n )}\n </div>\n </TooltipProvider>\n );\n }\n) as <M extends BaseMetadata = DM>(\n props: ThreadProps<M> & RefAttributes<HTMLDivElement>\n) => JSX.Element;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA2JO;AAAe;AAElB;AACE;AACuB;AACT;AACd;AACoB;AACJ;AACD;AACG;AACe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACG;AAIL;AACA;AACA;AACA;AACE;AAEuD;AAEzD;AACE;AAE4D;AAE9D;AAAoD;AAC3C;AAET;AAEE;AACE;AAAA;AAIF;AACE;AAAO;AAIT;AAAoC;AAGZ;AAGxB;AAEI;AACH;AACD;AACA;AACA;AACO;AACP;AAEF;AACA;AAEA;AACE;AAEE;AAAA;AACwD;AACxD;AACF;AAGF;AACE;AAAsB;AAGxB;AAA6B;AAEzB;AAEA;AACE;AAA8B;AAE9B;AAAgC;AAClC;AACF;AACA;AACE;AACA;AACA;AACO;AACT;AAGF;AAA4B;AAExB;AAEA;AAAyC;AAClB;AAGvB;AACE;AAAuB;AACzB;AACF;AACwC;AAG1C;AAEK;AACY;AACT;AAC2B;AAC3B;AACF;AACsC;AACQ;AACvC;AACH;AACC;AAEJ;AAAc;AAEX;AACA;AAGA;AACG;AACc;AACH;AACmB;AAC7B;AACe;AACF;AACb;AACA;AACA;AACA;AAGA;AACiB;AACjB;AACA;AACA;AAIM;AAGmC;AAIpC;AAIS;AAGP;AACiB;AACC;AACV;AAEN;AACW;AACD;AAID;AAIL;AAAuB;AAEvB;AAAsB;AAK7B;AAKV;AAGG;AAAsB;AACpB;AACW;AACI;AAEb;AAAe;AACb;AAAwB;AAO/B;AAKH;AACW;AACO;AACuC;AACxD;AACwB;AACxB;AACW;AACe;AACP;AACnB;AACe;AAIvB;AAGN;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?: \"default\" | \"outline\" | \"primary\";\n size?: \"default\" | \"large\";\n disableable?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = \"default\",\n size = \"default\",\n disableable = true,\n className,\n ...props\n },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n data-size={size}\n {...props}\n ref={forwardedRef}\n />\n );\n }\n);\n"],"names":[],"mappings":";;;;;;AAaO;AAAe;AAElB;AACY;AACH;AACO;AACd;AACG;AAIL;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACH;AACP;AACC;AACP;AAGN;;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?: \"default\" | \"outline\" | \"toggle\" | \"primary\";\n size?: \"default\" | \"large\";\n disableable?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = \"default\",\n size = \"default\",\n disableable = true,\n className,\n ...props\n },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n data-size={size}\n {...props}\n ref={forwardedRef}\n />\n );\n }\n);\n"],"names":[],"mappings":";;;;;;AAaO;AAAe;AAElB;AACY;AACH;AACO;AACd;AACG;AAIL;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACH;AACP;AACC;AACP;AAGN;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?: \"default\" | \"outline\" | \"primary\";\n size?: \"default\" | \"large\";\n disableable?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = \"default\",\n size = \"default\",\n disableable = true,\n className,\n ...props\n },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n data-size={size}\n {...props}\n ref={forwardedRef}\n />\n );\n }\n);\n"],"names":[],"mappings":";;;;AAaO;AAAe;AAElB;AACY;AACH;AACO;AACd;AACG;AAIL;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACH;AACP;AACC;AACP;AAGN;;"}
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?: \"default\" | \"outline\" | \"toggle\" | \"primary\";\n size?: \"default\" | \"large\";\n disableable?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = \"default\",\n size = \"default\",\n disableable = true,\n className,\n ...props\n },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n data-size={size}\n {...props}\n ref={forwardedRef}\n />\n );\n }\n);\n"],"names":[],"mappings":";;;;AAaO;AAAe;AAElB;AACY;AACH;AACO;AACd;AACG;AAIL;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACH;AACP;AACC;AACP;AAGN;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Icon = require('../components/internal/Icon.js');
|
|
5
|
+
|
|
6
|
+
function BoldIcon(props) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Icon.Icon, {
|
|
8
|
+
...props
|
|
9
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
10
|
+
d: "M5.5 10h6.63m0 5.75H5.5V4.25h5.63M11.125 10a2.875 2.875 0 0 0 0-5.75m1 11.5a2.875 2.875 0 0 0 0-5.75"
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.BoldIcon = BoldIcon;
|
|
15
|
+
//# sourceMappingURL=Bold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bold.js","sources":["../../src/icons/Bold.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function BoldIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M5.5 10h6.63m0 5.75H5.5V4.25h5.63M11.125 10a2.875 2.875 0 0 0 0-5.75m1 11.5a2.875 2.875 0 0 0 0-5.75\" />\n </Icon>\n );\n}\n"],"names":["Icon"],"mappings":";;;;;AAKO,SAAS,SAAS,KAA8B,EAAA;AACrD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAAA,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACP,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,sGAAA;AAAA,GAAuG,CACjH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Icon } from '../components/internal/Icon.mjs';
|
|
3
|
+
|
|
4
|
+
function BoldIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(Icon, {
|
|
6
|
+
...props
|
|
7
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
8
|
+
d: "M5.5 10h6.63m0 5.75H5.5V4.25h5.63M11.125 10a2.875 2.875 0 0 0 0-5.75m1 11.5a2.875 2.875 0 0 0 0-5.75"
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { BoldIcon };
|
|
13
|
+
//# sourceMappingURL=Bold.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bold.mjs","sources":["../../src/icons/Bold.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function BoldIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M5.5 10h6.63m0 5.75H5.5V4.25h5.63M11.125 10a2.875 2.875 0 0 0 0-5.75m1 11.5a2.875 2.875 0 0 0 0-5.75\" />\n </Icon>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,SAAS,KAA8B,EAAA;AACrD,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,sGAAA;AAAA,GAAuG,CACjH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Icon = require('../components/internal/Icon.js');
|
|
5
|
+
|
|
6
|
+
function CodeIcon(props) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Icon.Icon, {
|
|
8
|
+
...props
|
|
9
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
10
|
+
d: "m7.5 6-4 4 4 4m5-8 4 4-4 4"
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.CodeIcon = CodeIcon;
|
|
15
|
+
//# sourceMappingURL=Code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.js","sources":["../../src/icons/Code.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function CodeIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"m7.5 6-4 4 4 4m5-8 4 4-4 4\" />\n </Icon>\n );\n}\n"],"names":["Icon"],"mappings":";;;;;AAKO,SAAS,SAAS,KAA8B,EAAA;AACrD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAAA,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACP,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,4BAAA;AAAA,GAA6B,CACvC,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Icon } from '../components/internal/Icon.mjs';
|
|
3
|
+
|
|
4
|
+
function CodeIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(Icon, {
|
|
6
|
+
...props
|
|
7
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
8
|
+
d: "m7.5 6-4 4 4 4m5-8 4 4-4 4"
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { CodeIcon };
|
|
13
|
+
//# sourceMappingURL=Code.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.mjs","sources":["../../src/icons/Code.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function CodeIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"m7.5 6-4 4 4 4m5-8 4 4-4 4\" />\n </Icon>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,SAAS,KAA8B,EAAA;AACrD,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,4BAAA;AAAA,GAA6B,CACvC,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Icon = require('../components/internal/Icon.js');
|
|
5
|
+
|
|
6
|
+
function ItalicIcon(props) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Icon.Icon, {
|
|
8
|
+
...props
|
|
9
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
10
|
+
d: "M15 4.25H8m4 11.5H5m6.75-11.5-3.5 11.5"
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.ItalicIcon = ItalicIcon;
|
|
15
|
+
//# sourceMappingURL=Italic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Italic.js","sources":["../../src/icons/Italic.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function ItalicIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M15 4.25H8m4 11.5H5m6.75-11.5-3.5 11.5\" />\n </Icon>\n );\n}\n"],"names":["Icon"],"mappings":";;;;;AAKO,SAAS,WAAW,KAA8B,EAAA;AACvD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAAA,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACP,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,wCAAA;AAAA,GAAyC,CACnD,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Icon } from '../components/internal/Icon.mjs';
|
|
3
|
+
|
|
4
|
+
function ItalicIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(Icon, {
|
|
6
|
+
...props
|
|
7
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
8
|
+
d: "M15 4.25H8m4 11.5H5m6.75-11.5-3.5 11.5"
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { ItalicIcon };
|
|
13
|
+
//# sourceMappingURL=Italic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Italic.mjs","sources":["../../src/icons/Italic.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function ItalicIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M15 4.25H8m4 11.5H5m6.75-11.5-3.5 11.5\" />\n </Icon>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,WAAW,KAA8B,EAAA;AACvD,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,wCAAA;AAAA,GAAyC,CACnD,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Icon = require('../components/internal/Icon.js');
|
|
5
|
+
|
|
6
|
+
function StrikethroughIcon(props) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Icon.Icon, {
|
|
8
|
+
...props
|
|
9
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
10
|
+
d: "M15.5 10h-11m4.669 0C7.599 9.44 6.5 8.484 6.5 7.125 6.5 5.537 7.79 4.25 10 4.25c1.654 0 2.793.721 3.261 1.75M6.74 14c.468 1.029 1.607 1.75 3.261 1.75 2 0 3.5-1 3.5-2.5 0-.085-.004-.169-.013-.25"
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.StrikethroughIcon = StrikethroughIcon;
|
|
15
|
+
//# sourceMappingURL=Strikethrough.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Strikethrough.js","sources":["../../src/icons/Strikethrough.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function StrikethroughIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M15.5 10h-11m4.669 0C7.599 9.44 6.5 8.484 6.5 7.125 6.5 5.537 7.79 4.25 10 4.25c1.654 0 2.793.721 3.261 1.75M6.74 14c.468 1.029 1.607 1.75 3.261 1.75 2 0 3.5-1 3.5-2.5 0-.085-.004-.169-.013-.25\" />\n </Icon>\n );\n}\n"],"names":["Icon"],"mappings":";;;;;AAKO,SAAS,kBAAkB,KAA8B,EAAA;AAC9D,EAAA,uBACG,KAAA,CAAA,aAAA,CAAAA,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACP,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,mMAAA;AAAA,GAAoM,CAC9M,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Icon } from '../components/internal/Icon.mjs';
|
|
3
|
+
|
|
4
|
+
function StrikethroughIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(Icon, {
|
|
6
|
+
...props
|
|
7
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
8
|
+
d: "M15.5 10h-11m4.669 0C7.599 9.44 6.5 8.484 6.5 7.125 6.5 5.537 7.79 4.25 10 4.25c1.654 0 2.793.721 3.261 1.75M6.74 14c.468 1.029 1.607 1.75 3.261 1.75 2 0 3.5-1 3.5-2.5 0-.085-.004-.169-.013-.25"
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { StrikethroughIcon };
|
|
13
|
+
//# sourceMappingURL=Strikethrough.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Strikethrough.mjs","sources":["../../src/icons/Strikethrough.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function StrikethroughIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M15.5 10h-11m4.669 0C7.599 9.44 6.5 8.484 6.5 7.125 6.5 5.537 7.79 4.25 10 4.25c1.654 0 2.793.721 3.261 1.75M6.74 14c.468 1.029 1.607 1.75 3.261 1.75 2 0 3.5-1 3.5-2.5 0-.085-.004-.169-.013-.25\" />\n </Icon>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,kBAAkB,KAA8B,EAAA;AAC9D,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,mMAAA;AAAA,GAAoM,CAC9M,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommentAttachment,
|
|
2
|
-
import React, { ElementType, ComponentPropsWithoutRef, ReactNode,
|
|
1
|
+
import { CommentAttachment, CommentBody, BaseMetadata, DM, CommentData, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
2
|
+
import React, { ElementType, ComponentPropsWithoutRef, ReactNode, FormEvent, ComponentType, RefAttributes, MouseEvent, ComponentProps, PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
declare type Direction = "ltr" | "rtl";
|
|
5
5
|
declare type SlotProp = {
|
|
@@ -9,6 +9,17 @@ declare type SlotProp = {
|
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
};
|
|
11
11
|
declare type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
|
|
12
|
+
declare type ComposerBodyText = {
|
|
13
|
+
bold?: boolean;
|
|
14
|
+
italic?: boolean;
|
|
15
|
+
strikethrough?: boolean;
|
|
16
|
+
code?: boolean;
|
|
17
|
+
text: string;
|
|
18
|
+
};
|
|
19
|
+
declare type ComposerBodyMark = keyof Omit<ComposerBodyText, "text">;
|
|
20
|
+
declare type ComposerBodyMarks = {
|
|
21
|
+
[K in ComposerBodyMark]: boolean;
|
|
22
|
+
};
|
|
12
23
|
interface CommentAttachmentArgs {
|
|
13
24
|
/**
|
|
14
25
|
* The attachment.
|
|
@@ -57,6 +68,7 @@ interface ComposerOverrides {
|
|
|
57
68
|
COMPOSER_REMOVE_ATTACHMENT: string;
|
|
58
69
|
COMPOSER_PLACEHOLDER: string;
|
|
59
70
|
COMPOSER_SEND: string;
|
|
71
|
+
COMPOSER_TOGGLE_MARK: (mark: ComposerBodyMark) => string;
|
|
60
72
|
}
|
|
61
73
|
interface ThreadOverrides {
|
|
62
74
|
THREAD_RESOLVE: string;
|
|
@@ -83,68 +95,6 @@ interface HistoryVersionPreviewOverrides {
|
|
|
83
95
|
declare type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides & HistoryVersionPreviewOverrides;
|
|
84
96
|
declare function useOverrides(overrides?: Partial<Overrides>): Overrides;
|
|
85
97
|
|
|
86
|
-
interface CommentProps extends ComponentPropsWithoutRef<"div"> {
|
|
87
|
-
/**
|
|
88
|
-
* The comment to display.
|
|
89
|
-
*/
|
|
90
|
-
comment: CommentData;
|
|
91
|
-
/**
|
|
92
|
-
* How to show or hide the actions.
|
|
93
|
-
*/
|
|
94
|
-
showActions?: boolean | "hover";
|
|
95
|
-
/**
|
|
96
|
-
* Whether to show the comment if it was deleted. If set to `false`, it will render deleted comments as `null`.
|
|
97
|
-
*/
|
|
98
|
-
showDeleted?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Whether to show reactions.
|
|
101
|
-
*/
|
|
102
|
-
showReactions?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Whether to show attachments.
|
|
105
|
-
*/
|
|
106
|
-
showAttachments?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Whether to indent the comment's content.
|
|
109
|
-
*/
|
|
110
|
-
indentContent?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* The event handler called when the comment is edited.
|
|
113
|
-
*/
|
|
114
|
-
onCommentEdit?: (comment: CommentData) => void;
|
|
115
|
-
/**
|
|
116
|
-
* The event handler called when the comment is deleted.
|
|
117
|
-
*/
|
|
118
|
-
onCommentDelete?: (comment: CommentData) => void;
|
|
119
|
-
/**
|
|
120
|
-
* The event handler called when clicking on the author.
|
|
121
|
-
*/
|
|
122
|
-
onAuthorClick?: (userId: string, event: MouseEvent<HTMLElement>) => void;
|
|
123
|
-
/**
|
|
124
|
-
* The event handler called when clicking on a mention.
|
|
125
|
-
*/
|
|
126
|
-
onMentionClick?: (userId: string, event: MouseEvent<HTMLElement>) => void;
|
|
127
|
-
/**
|
|
128
|
-
* The event handler called when clicking on a comment's attachment.
|
|
129
|
-
*/
|
|
130
|
-
onAttachmentClick?: (args: CommentAttachmentArgs, event: MouseEvent<HTMLElement>) => void;
|
|
131
|
-
/**
|
|
132
|
-
* Override the component's strings.
|
|
133
|
-
*/
|
|
134
|
-
overrides?: Partial<GlobalOverrides & CommentOverrides & ComposerOverrides>;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Displays a single comment.
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* <>
|
|
141
|
-
* {thread.comments.map((comment) => (
|
|
142
|
-
* <Comment key={comment.id} comment={comment} />
|
|
143
|
-
* ))}
|
|
144
|
-
* </>
|
|
145
|
-
*/
|
|
146
|
-
declare const Comment: React.ForwardRefExoticComponent<CommentProps & React.RefAttributes<HTMLDivElement>>;
|
|
147
|
-
|
|
148
98
|
interface ComposerEditorMentionProps {
|
|
149
99
|
/**
|
|
150
100
|
* Whether the mention is selected.
|
|
@@ -179,6 +129,7 @@ declare type ComposerEditorMentionSuggestionsProps = {
|
|
|
179
129
|
*/
|
|
180
130
|
selectedUserId?: string;
|
|
181
131
|
};
|
|
132
|
+
declare type ComposerEditorFloatingToolbarProps = Record<string, never>;
|
|
182
133
|
interface ComposerEditorComponents {
|
|
183
134
|
/**
|
|
184
135
|
* The component used to display mentions.
|
|
@@ -192,6 +143,10 @@ interface ComposerEditorComponents {
|
|
|
192
143
|
* The component used to display links.
|
|
193
144
|
*/
|
|
194
145
|
Link: ComponentType<ComposerEditorLinkProps>;
|
|
146
|
+
/**
|
|
147
|
+
* The component used to display a floating toolbar attached to the selection.
|
|
148
|
+
*/
|
|
149
|
+
FloatingToolbar?: ComponentType<ComposerEditorFloatingToolbarProps>;
|
|
195
150
|
}
|
|
196
151
|
interface ComposerEditorProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue"> {
|
|
197
152
|
/**
|
|
@@ -317,6 +272,10 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
|
|
|
317
272
|
* Whether to show and allow adding attachments.
|
|
318
273
|
*/
|
|
319
274
|
showAttachments?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Whether to show formatting controls (e.g. a floating toolbar with formatting toggles when selecting text)
|
|
277
|
+
*/
|
|
278
|
+
showFormattingControls?: boolean;
|
|
320
279
|
/**
|
|
321
280
|
* Whether the composer is disabled.
|
|
322
281
|
*/
|
|
@@ -338,6 +297,72 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
|
|
|
338
297
|
*/
|
|
339
298
|
declare const Composer: <M extends BaseMetadata = BaseMetadata>(props: ComposerProps<M> & RefAttributes<HTMLFormElement>) => JSX.Element;
|
|
340
299
|
|
|
300
|
+
interface CommentProps extends ComponentPropsWithoutRef<"div"> {
|
|
301
|
+
/**
|
|
302
|
+
* The comment to display.
|
|
303
|
+
*/
|
|
304
|
+
comment: CommentData;
|
|
305
|
+
/**
|
|
306
|
+
* How to show or hide the actions.
|
|
307
|
+
*/
|
|
308
|
+
showActions?: boolean | "hover";
|
|
309
|
+
/**
|
|
310
|
+
* Whether to show the comment if it was deleted. If set to `false`, it will render deleted comments as `null`.
|
|
311
|
+
*/
|
|
312
|
+
showDeleted?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Whether to show reactions.
|
|
315
|
+
*/
|
|
316
|
+
showReactions?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Whether to show attachments.
|
|
319
|
+
*/
|
|
320
|
+
showAttachments?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Whether to show the composer's formatting controls when editing the comment.
|
|
323
|
+
*/
|
|
324
|
+
showComposerFormattingControls?: ComposerProps["showFormattingControls"];
|
|
325
|
+
/**
|
|
326
|
+
* Whether to indent the comment's content.
|
|
327
|
+
*/
|
|
328
|
+
indentContent?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* The event handler called when the comment is edited.
|
|
331
|
+
*/
|
|
332
|
+
onCommentEdit?: (comment: CommentData) => void;
|
|
333
|
+
/**
|
|
334
|
+
* The event handler called when the comment is deleted.
|
|
335
|
+
*/
|
|
336
|
+
onCommentDelete?: (comment: CommentData) => void;
|
|
337
|
+
/**
|
|
338
|
+
* The event handler called when clicking on the author.
|
|
339
|
+
*/
|
|
340
|
+
onAuthorClick?: (userId: string, event: MouseEvent<HTMLElement>) => void;
|
|
341
|
+
/**
|
|
342
|
+
* The event handler called when clicking on a mention.
|
|
343
|
+
*/
|
|
344
|
+
onMentionClick?: (userId: string, event: MouseEvent<HTMLElement>) => void;
|
|
345
|
+
/**
|
|
346
|
+
* The event handler called when clicking on a comment's attachment.
|
|
347
|
+
*/
|
|
348
|
+
onAttachmentClick?: (args: CommentAttachmentArgs, event: MouseEvent<HTMLElement>) => void;
|
|
349
|
+
/**
|
|
350
|
+
* Override the component's strings.
|
|
351
|
+
*/
|
|
352
|
+
overrides?: Partial<GlobalOverrides & CommentOverrides & ComposerOverrides>;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Displays a single comment.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* <>
|
|
359
|
+
* {thread.comments.map((comment) => (
|
|
360
|
+
* <Comment key={comment.id} comment={comment} />
|
|
361
|
+
* ))}
|
|
362
|
+
* </>
|
|
363
|
+
*/
|
|
364
|
+
declare const Comment: React.ForwardRefExoticComponent<CommentProps & React.RefAttributes<HTMLDivElement>>;
|
|
365
|
+
|
|
341
366
|
interface HistoryVersionSummaryProps extends ComponentPropsWithoutRef<"button"> {
|
|
342
367
|
version: HistoryVersion;
|
|
343
368
|
selected?: boolean;
|
|
@@ -534,6 +559,10 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
|
|
|
534
559
|
* Whether to show reactions.
|
|
535
560
|
*/
|
|
536
561
|
showReactions?: CommentProps["showReactions"];
|
|
562
|
+
/**
|
|
563
|
+
* Whether to show the composer's formatting controls.
|
|
564
|
+
*/
|
|
565
|
+
showComposerFormattingControls?: ComposerProps["showFormattingControls"];
|
|
537
566
|
/**
|
|
538
567
|
* Whether to indent the comments' content.
|
|
539
568
|
*/
|
|
@@ -633,42 +662,4 @@ declare type LiveblocksUIConfigProps = PropsWithChildren<{
|
|
|
633
662
|
*/
|
|
634
663
|
declare function LiveblocksUIConfig({ overrides, components, portalContainer, preventUnsavedComposerChanges, children, }: LiveblocksUIConfigProps): React.JSX.Element;
|
|
635
664
|
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* The date to display.
|
|
639
|
-
*/
|
|
640
|
-
date: Date | string | number;
|
|
641
|
-
/**
|
|
642
|
-
* A function to format the displayed date.
|
|
643
|
-
*/
|
|
644
|
-
children?: (date: Date, locale?: string) => ReactNode;
|
|
645
|
-
/**
|
|
646
|
-
* The `title` attribute's value or a function to format it.
|
|
647
|
-
*/
|
|
648
|
-
title?: string | ((date: Date, locale?: string) => string);
|
|
649
|
-
/**
|
|
650
|
-
* The interval in milliseconds at which the component will re-render.
|
|
651
|
-
* Can be set to `false` to disable re-rendering.
|
|
652
|
-
*/
|
|
653
|
-
interval?: number | false;
|
|
654
|
-
/**
|
|
655
|
-
* The locale used when formatting the date.
|
|
656
|
-
*/
|
|
657
|
-
locale?: string;
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Displays a formatted date, and automatically re-renders to support relative
|
|
661
|
-
* formatting. Defaults to relative formatting for recent dates and a short
|
|
662
|
-
* absolute formatting for older ones.
|
|
663
|
-
*
|
|
664
|
-
* @example
|
|
665
|
-
* <Timestamp date={new Date()} />
|
|
666
|
-
*
|
|
667
|
-
* @example
|
|
668
|
-
* <Timestamp date={new Date()} title={(date) => date.toISOString()} interval={false}>
|
|
669
|
-
* {(date) => date.toLocaleDateString()}
|
|
670
|
-
* </Timestamp>
|
|
671
|
-
*/
|
|
672
|
-
declare const Timestamp: React.ForwardRefExoticComponent<TimestampProps & React.RefAttributes<HTMLTimeElement>>;
|
|
673
|
-
|
|
674
|
-
export { Comment, CommentAttachmentArgs, 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, useOverrides };
|
|
665
|
+
export { Comment, CommentAttachmentArgs, CommentOverrides, CommentProps, Composer, ComposerBodyMark, ComposerBodyMarks, 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, useOverrides };
|