@liveblocks/react-ui 3.6.0 → 3.7.0-preview1
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 +8 -0
- package/dist/_private/index.cjs.map +1 -1
- package/dist/_private/index.d.cts +34 -7
- package/dist/_private/index.d.ts +34 -7
- package/dist/_private/index.js +4 -0
- package/dist/_private/index.js.map +1 -1
- package/dist/components/Comment.cjs +51 -17
- package/dist/components/Comment.cjs.map +1 -1
- package/dist/components/Comment.js +52 -18
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Composer.cjs +77 -31
- package/dist/components/Composer.cjs.map +1 -1
- package/dist/components/Composer.js +79 -34
- package/dist/components/Composer.js.map +1 -1
- package/dist/components/InboxNotification.cjs +11 -12
- package/dist/components/InboxNotification.cjs.map +1 -1
- package/dist/components/InboxNotification.js +13 -14
- package/dist/components/InboxNotification.js.map +1 -1
- package/dist/components/internal/Avatar.cjs +41 -21
- package/dist/components/internal/Avatar.cjs.map +1 -1
- package/dist/components/internal/Avatar.js +40 -20
- package/dist/components/internal/Avatar.js.map +1 -1
- package/dist/components/internal/Group.cjs +23 -0
- package/dist/components/internal/Group.cjs.map +1 -0
- package/dist/components/internal/Group.js +21 -0
- package/dist/components/internal/Group.js.map +1 -0
- package/dist/components/internal/GroupDescription.cjs +23 -0
- package/dist/components/internal/GroupDescription.cjs.map +1 -0
- package/dist/components/internal/GroupDescription.js +21 -0
- package/dist/components/internal/GroupDescription.js.map +1 -0
- package/dist/components/internal/InboxNotificationThread.cjs +19 -8
- package/dist/components/internal/InboxNotificationThread.cjs.map +1 -1
- package/dist/components/internal/InboxNotificationThread.js +20 -9
- package/dist/components/internal/InboxNotificationThread.js.map +1 -1
- package/dist/components/internal/User.cjs +12 -3
- package/dist/components/internal/User.cjs.map +1 -1
- package/dist/components/internal/User.js +13 -4
- package/dist/components/internal/User.js.map +1 -1
- package/dist/constants.cjs +0 -2
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/icon.cjs +4 -0
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.js +2 -0
- package/dist/icon.js.map +1 -1
- package/dist/icons/User.cjs +16 -0
- package/dist/icons/User.cjs.map +1 -0
- package/dist/icons/User.js +14 -0
- package/dist/icons/User.js.map +1 -0
- package/dist/icons/Users.cjs +16 -0
- package/dist/icons/Users.cjs.map +1 -0
- package/dist/icons/Users.js +14 -0
- package/dist/icons/Users.js.map +1 -0
- package/dist/icons/index.cjs +4 -0
- package/dist/icons/index.cjs.map +1 -1
- package/dist/icons/index.js +2 -0
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.cts +12 -8
- package/dist/index.d.ts +12 -8
- package/dist/primitives/Comment/index.cjs +1 -2
- package/dist/primitives/Comment/index.cjs.map +1 -1
- package/dist/primitives/Comment/index.js +1 -2
- package/dist/primitives/Comment/index.js.map +1 -1
- package/dist/primitives/Composer/index.cjs +1 -2
- package/dist/primitives/Composer/index.cjs.map +1 -1
- package/dist/primitives/Composer/index.js +1 -2
- package/dist/primitives/Composer/index.js.map +1 -1
- package/dist/primitives/Composer/slate/plugins/mentions.cjs +5 -5
- package/dist/primitives/Composer/slate/plugins/mentions.cjs.map +1 -1
- package/dist/primitives/Composer/slate/plugins/mentions.js +1 -1
- package/dist/primitives/Composer/slate/plugins/mentions.js.map +1 -1
- package/dist/utils/use-group-mention.cjs +30 -0
- package/dist/utils/use-group-mention.cjs.map +1 -0
- package/dist/utils/use-group-mention.js +28 -0
- package/dist/utils/use-group-mention.js.map +1 -0
- package/dist/utils/use-user-or-group-info.cjs +49 -0
- package/dist/utils/use-user-or-group-info.cjs.map +1 -0
- package/dist/utils/use-user-or-group-info.js +46 -0
- package/dist/utils/use-user-or-group-info.js.map +1 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +4 -4
- package/src/styles/index.css +60 -35
- package/styles.css +1 -1
- package/styles.css.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { getMentionsFromCommentBody } from '@liveblocks/core';
|
|
2
|
+
import { getMentionsFromCommentBody, kInternal } from '@liveblocks/core';
|
|
3
3
|
import { useOverrides } from '../../overrides.js';
|
|
4
4
|
import { Body as CommentBody } from '../../primitives/Comment/index.js';
|
|
5
5
|
import { cn } from '../../utils/cn.js';
|
|
@@ -74,7 +74,7 @@ function InboxNotificationComment({
|
|
|
74
74
|
]
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
function findLastCommentWithMentionedId(comments, mentionedId) {
|
|
77
|
+
function findLastCommentWithMentionedId(client, comments, mentionedId) {
|
|
78
78
|
if (!comments.length) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
@@ -84,12 +84,22 @@ function findLastCommentWithMentionedId(comments, mentionedId) {
|
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
86
86
|
if (comment.body) {
|
|
87
|
-
const mentions = getMentionsFromCommentBody(
|
|
88
|
-
|
|
89
|
-
(mention
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
const mentions = getMentionsFromCommentBody(comment.body);
|
|
88
|
+
for (const mention of mentions) {
|
|
89
|
+
if (mention.kind === "user" && mention.id === mentionedId) {
|
|
90
|
+
return comment;
|
|
91
|
+
}
|
|
92
|
+
if (mention.kind === "group" && mention.userIds?.includes(mentionedId)) {
|
|
93
|
+
return comment;
|
|
94
|
+
}
|
|
95
|
+
if (mention.kind === "group" && mention.userIds === void 0) {
|
|
96
|
+
const group = client[kInternal].httpClient.groupsStore.getData(
|
|
97
|
+
mention.id
|
|
98
|
+
);
|
|
99
|
+
if (group?.members.some((member) => member.id === mentionedId)) {
|
|
100
|
+
return comment;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
}
|
|
@@ -98,7 +108,7 @@ function findLastCommentWithMentionedId(comments, mentionedId) {
|
|
|
98
108
|
function getUserIdsFromComments(comments) {
|
|
99
109
|
return Array.from(new Set(comments.map((comment) => comment.userId)));
|
|
100
110
|
}
|
|
101
|
-
function generateInboxNotificationThreadContents(inboxNotification, thread, userId) {
|
|
111
|
+
function generateInboxNotificationThreadContents(client, inboxNotification, thread, userId) {
|
|
102
112
|
const unreadComments = thread.comments.filter((comment) => {
|
|
103
113
|
if (!comment.body) {
|
|
104
114
|
return false;
|
|
@@ -116,6 +126,7 @@ function generateInboxNotificationThreadContents(inboxNotification, thread, user
|
|
|
116
126
|
};
|
|
117
127
|
}
|
|
118
128
|
const commentWithMention = findLastCommentWithMentionedId(
|
|
129
|
+
client,
|
|
119
130
|
unreadComments,
|
|
120
131
|
userId
|
|
121
132
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InboxNotificationThread.js","sources":["../../../src/components/internal/InboxNotificationThread.tsx"],"sourcesContent":["import type {\n BaseMetadata,\n CommentData,\n InboxNotificationThreadData,\n ThreadData,\n} from \"@liveblocks/core\";\nimport { getMentionsFromCommentBody } from \"@liveblocks/core\";\nimport type { ComponentProps } from \"react\";\n\nimport {\n type CommentOverrides,\n type GlobalOverrides,\n useOverrides,\n} from \"../../overrides\";\nimport * as CommentPrimitive from \"../../primitives/Comment\";\nimport { cn } from \"../../utils/cn\";\nimport {\n CommentMention,\n CommentNonInteractiveFileAttachment,\n CommentNonInteractiveLink,\n CommentNonInteractiveReaction,\n} from \"../Comment\";\nimport { User } from \"./User\";\n\ntype InboxNotificationThreadCommentsContents = {\n type: \"comments\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\ntype InboxNotificationThreadMentionContents = {\n type: \"mention\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\nexport const INBOX_NOTIFICATION_THREAD_MAX_COMMENTS = 3;\n\ntype InboxNotificationThreadContents =\n | InboxNotificationThreadCommentsContents\n | InboxNotificationThreadMentionContents;\n\ninterface InboxNotificationCommentProps extends ComponentProps<\"div\"> {\n comment: CommentData;\n showHeader?: boolean;\n showAttachments?: boolean;\n showReactions?: boolean;\n overrides?: Partial<GlobalOverrides & CommentOverrides>;\n}\n\nexport function InboxNotificationComment({\n comment,\n showHeader = true,\n showAttachments = true,\n showReactions = true,\n overrides,\n className,\n ...props\n}: InboxNotificationCommentProps) {\n const $ = useOverrides(overrides);\n\n return (\n <div\n className={cn(\n \"lb-root lb-inbox-notification-comment lb-comment\",\n className\n )}\n {...props}\n >\n {showHeader && (\n <div className=\"lb-comment-header\">\n <User className=\"lb-comment-author\" userId={comment.userId} />\n </div>\n )}\n <div className=\"lb-comment-content\">\n {comment.body ? (\n <>\n <CommentPrimitive.Body\n className=\"lb-comment-body\"\n body={comment.body}\n components={{\n Mention: CommentMention,\n Link: CommentNonInteractiveLink,\n }}\n />\n {showReactions && comment.reactions.length > 0 && (\n <div className=\"lb-comment-reactions\">\n {comment.reactions.map((reaction) => (\n <CommentNonInteractiveReaction\n key={reaction.emoji}\n reaction={reaction}\n overrides={overrides}\n disabled\n />\n ))}\n </div>\n )}\n {showAttachments && comment.attachments.length > 0 ? (\n <div className=\"lb-comment-attachments\">\n <div className=\"lb-attachments\">\n {comment.attachments.map((attachment) => (\n <CommentNonInteractiveFileAttachment\n key={attachment.id}\n attachment={attachment}\n overrides={overrides}\n roomId={comment.roomId}\n />\n ))}\n </div>\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"lb-comment-body\">\n <p className=\"lb-comment-deleted\">{$.COMMENT_DELETED}</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/**\n * Find the last comment with a mention for the given user ID,\n * unless the comment was created by the user themselves.\n */\nfunction findLastCommentWithMentionedId(\n comments: CommentData[],\n mentionedId: string\n) {\n if (!comments.length) {\n return;\n }\n\n for (let i = comments.length - 1; i >= 0; i--) {\n const comment = comments[i]!;\n\n if (comment.userId === mentionedId) {\n continue;\n }\n\n if (comment.body) {\n const mentions = getMentionsFromCommentBody(\n comment.body,\n (mention) => mention.kind === \"user\" && mention.id === mentionedId\n );\n\n if (mentions.length > 0) {\n return comment;\n }\n }\n }\n\n return;\n}\n\nfunction getUserIdsFromComments(comments: CommentData[]) {\n return Array.from(new Set(comments.map((comment) => comment.userId)));\n}\n\nexport function generateInboxNotificationThreadContents(\n inboxNotification: InboxNotificationThreadData,\n thread: ThreadData<BaseMetadata>,\n userId: string\n): InboxNotificationThreadContents {\n const unreadComments = thread.comments.filter((comment) => {\n if (!comment.body) {\n return false;\n }\n\n return inboxNotification.readAt\n ? comment.createdAt > inboxNotification.readAt &&\n comment.createdAt <= inboxNotification.notifiedAt\n : comment.createdAt <= inboxNotification.notifiedAt;\n });\n\n // If the thread is read, show the last comments.\n if (unreadComments.length === 0) {\n const lastComments = thread.comments\n .filter((comment) => comment.body)\n .slice(-INBOX_NOTIFICATION_THREAD_MAX_COMMENTS);\n\n return {\n type: \"comments\",\n unread: false,\n comments: lastComments,\n userIds: getUserIdsFromComments(lastComments),\n date: inboxNotification.notifiedAt,\n };\n }\n\n const commentWithMention = findLastCommentWithMentionedId(\n unreadComments,\n userId\n );\n\n // If the thread contains one or more mentions for the current user, show the last comment with a mention.\n if (commentWithMention) {\n return {\n type: \"mention\",\n unread: true,\n comments: [commentWithMention],\n userIds: [commentWithMention.userId],\n date: commentWithMention.createdAt,\n };\n }\n\n const lastUnreadComments = unreadComments.slice(\n -INBOX_NOTIFICATION_THREAD_MAX_COMMENTS\n );\n\n // Otherwise, show the last unread comments.\n return {\n type: \"comments\",\n unread: true,\n comments: lastUnreadComments,\n userIds: getUserIdsFromComments(unreadComments),\n date: inboxNotification.notifiedAt,\n };\n}\n"],"names":["CommentPrimitive.Body"],"mappings":";;;;;;;;AAwCO,MAAM,sCAAyC,GAAA,EAAA;AAc/C,SAAS,wBAAyB,CAAA;AAAA,EACvC,OAAA;AAAA,EACA,UAAa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,IAAM,EAAA,UAAA;AAAA,MACN,MAAQ,EAAA,KAAA;AAAA,MACR,QAAU,EAAA,YAAA;AAAA,MACV,OAAA,EAAS,uBAAuB,YAAY,CAAA;AAAA,MAC5C,MAAM,iBAAkB,CAAA,UAAA;AAAA,KAC1B,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,kBAAqB,GAAA,8BAAA;AAAA,IACzB,cAAA;AAAA,IACA,MAAA;AAAA,GACF,CAAA;AAGA,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,SAAA;AAAA,MACN,MAAQ,EAAA,IAAA;AAAA,MACR,QAAA,EAAU,CAAC,kBAAkB,CAAA;AAAA,MAC7B,OAAA,EAAS,CAAC,kBAAA,CAAmB,MAAM,CAAA;AAAA,MACnC,MAAM,kBAAmB,CAAA,SAAA;AAAA,KAC3B,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,qBAAqB,cAAe,CAAA,KAAA;AAAA,IACxC,CAAC,sCAAA;AAAA,GACH,CAAA;AAGA,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,UAAA;AAAA,IACN,MAAQ,EAAA,IAAA;AAAA,IACR,QAAU,EAAA,kBAAA;AAAA,IACV,OAAA,EAAS,uBAAuB,cAAc,CAAA;AAAA,IAC9C,MAAM,iBAAkB,CAAA,UAAA;AAAA,GAC1B,CAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"InboxNotificationThread.js","sources":["../../../src/components/internal/InboxNotificationThread.tsx"],"sourcesContent":["import type {\n BaseMetadata,\n Client,\n CommentData,\n InboxNotificationThreadData,\n ThreadData,\n} from \"@liveblocks/core\";\nimport { getMentionsFromCommentBody, kInternal } from \"@liveblocks/core\";\nimport type { ComponentProps } from \"react\";\n\nimport {\n type CommentOverrides,\n type GlobalOverrides,\n useOverrides,\n} from \"../../overrides\";\nimport * as CommentPrimitive from \"../../primitives/Comment\";\nimport { cn } from \"../../utils/cn\";\nimport {\n CommentMention,\n CommentNonInteractiveFileAttachment,\n CommentNonInteractiveLink,\n CommentNonInteractiveReaction,\n} from \"../Comment\";\nimport { User } from \"./User\";\n\ntype InboxNotificationThreadCommentsContents = {\n type: \"comments\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\ntype InboxNotificationThreadMentionContents = {\n type: \"mention\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\nexport const INBOX_NOTIFICATION_THREAD_MAX_COMMENTS = 3;\n\ntype InboxNotificationThreadContents =\n | InboxNotificationThreadCommentsContents\n | InboxNotificationThreadMentionContents;\n\ninterface InboxNotificationCommentProps extends ComponentProps<\"div\"> {\n comment: CommentData;\n showHeader?: boolean;\n showAttachments?: boolean;\n showReactions?: boolean;\n overrides?: Partial<GlobalOverrides & CommentOverrides>;\n}\n\nexport function InboxNotificationComment({\n comment,\n showHeader = true,\n showAttachments = true,\n showReactions = true,\n overrides,\n className,\n ...props\n}: InboxNotificationCommentProps) {\n const $ = useOverrides(overrides);\n\n return (\n <div\n className={cn(\n \"lb-root lb-inbox-notification-comment lb-comment\",\n className\n )}\n {...props}\n >\n {showHeader && (\n <div className=\"lb-comment-header\">\n <User className=\"lb-comment-author\" userId={comment.userId} />\n </div>\n )}\n <div className=\"lb-comment-content\">\n {comment.body ? (\n <>\n <CommentPrimitive.Body\n className=\"lb-comment-body\"\n body={comment.body}\n components={{\n Mention: CommentMention,\n Link: CommentNonInteractiveLink,\n }}\n />\n {showReactions && comment.reactions.length > 0 && (\n <div className=\"lb-comment-reactions\">\n {comment.reactions.map((reaction) => (\n <CommentNonInteractiveReaction\n key={reaction.emoji}\n reaction={reaction}\n overrides={overrides}\n disabled\n />\n ))}\n </div>\n )}\n {showAttachments && comment.attachments.length > 0 ? (\n <div className=\"lb-comment-attachments\">\n <div className=\"lb-attachments\">\n {comment.attachments.map((attachment) => (\n <CommentNonInteractiveFileAttachment\n key={attachment.id}\n attachment={attachment}\n overrides={overrides}\n roomId={comment.roomId}\n />\n ))}\n </div>\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"lb-comment-body\">\n <p className=\"lb-comment-deleted\">{$.COMMENT_DELETED}</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/**\n * Find the last comment with a mention for the given user ID,\n * unless the comment was created by the user themselves.\n */\nfunction findLastCommentWithMentionedId(\n client: Client,\n comments: CommentData[],\n mentionedId: string\n) {\n if (!comments.length) {\n return;\n }\n\n for (let i = comments.length - 1; i >= 0; i--) {\n const comment = comments[i]!;\n\n if (comment.userId === mentionedId) {\n continue;\n }\n\n if (comment.body) {\n const mentions = getMentionsFromCommentBody(comment.body);\n\n for (const mention of mentions) {\n // 1. The comment contains a user mention for the current user.\n if (mention.kind === \"user\" && mention.id === mentionedId) {\n return comment;\n }\n\n // 2. The comment contains a group mention including the current user in its `userIds` array.\n if (\n mention.kind === \"group\" &&\n mention.userIds?.includes(mentionedId)\n ) {\n return comment;\n }\n\n // 3. The comment contains a group mention including the current user in its managed group members.\n if (mention.kind === \"group\" && mention.userIds === undefined) {\n // Synchronously look up the group data for this group ID.\n const group = client[kInternal].httpClient.groupsStore.getData(\n mention.id\n );\n\n if (group?.members.some((member) => member.id === mentionedId)) {\n return comment;\n }\n }\n }\n }\n }\n\n return;\n}\n\nfunction getUserIdsFromComments(comments: CommentData[]) {\n return Array.from(new Set(comments.map((comment) => comment.userId)));\n}\n\nexport function generateInboxNotificationThreadContents(\n client: Client,\n inboxNotification: InboxNotificationThreadData,\n thread: ThreadData<BaseMetadata>,\n userId: string\n): InboxNotificationThreadContents {\n const unreadComments = thread.comments.filter((comment) => {\n if (!comment.body) {\n return false;\n }\n\n return inboxNotification.readAt\n ? comment.createdAt > inboxNotification.readAt &&\n comment.createdAt <= inboxNotification.notifiedAt\n : comment.createdAt <= inboxNotification.notifiedAt;\n });\n\n // If the thread is read, show the last comments.\n if (unreadComments.length === 0) {\n const lastComments = thread.comments\n .filter((comment) => comment.body)\n .slice(-INBOX_NOTIFICATION_THREAD_MAX_COMMENTS);\n\n return {\n type: \"comments\",\n unread: false,\n comments: lastComments,\n userIds: getUserIdsFromComments(lastComments),\n date: inboxNotification.notifiedAt,\n };\n }\n\n const commentWithMention = findLastCommentWithMentionedId(\n client,\n unreadComments,\n userId\n );\n\n // If the thread contains one or more mentions for the current user, show the last comment with a mention.\n if (commentWithMention) {\n return {\n type: \"mention\",\n unread: true,\n comments: [commentWithMention],\n userIds: [commentWithMention.userId],\n date: commentWithMention.createdAt,\n };\n }\n\n const lastUnreadComments = unreadComments.slice(\n -INBOX_NOTIFICATION_THREAD_MAX_COMMENTS\n );\n\n // Otherwise, show the last unread comments.\n return {\n type: \"comments\",\n unread: true,\n comments: lastUnreadComments,\n userIds: getUserIdsFromComments(unreadComments),\n date: inboxNotification.notifiedAt,\n };\n}\n"],"names":["CommentPrimitive.Body"],"mappings":";;;;;;;;AAyCO,MAAM,sCAAyC,GAAA,EAAA;AAc/C,SAAS,wBAAyB,CAAA;AAAA,EACvC,OAAA;AAAA,EACA,UAAa,GAAA,IAAA;AAAA,EACb,eAAkB,GAAA,IAAA;AAAA,EAClB,aAAgB,GAAA,IAAA;AAAA,EAChB,SAAA;AAAA,EACA,SAAA;AAAA,EACG,GAAA,KAAA;AACL,CAAkC,EAAA;AAChC,EAAM,MAAA,CAAA,GAAI,aAAa,SAAS,CAAA,CAAA;AAEhC,EAAA,uBACG,IAAA,CAAA,KAAA,EAAA;AAAA,IACC,SAAW,EAAA,EAAA;AAAA,MACT,kDAAA;AAAA,MACA,SAAA;AAAA,KACF;AAAA,IACC,GAAG,KAAA;AAAA,IAEH,QAAA,EAAA;AAAA,MAAA,UAAA,oBACE,GAAA,CAAA,KAAA,EAAA;AAAA,QAAI,SAAU,EAAA,mBAAA;AAAA,QACb,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA;AAAA,UAAK,SAAU,EAAA,mBAAA;AAAA,UAAoB,QAAQ,OAAQ,CAAA,MAAA;AAAA,SAAQ,CAAA;AA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AAA;AAAA,MACR,QAAU,EAAA,YAAA;AAAA,MACV,OAAA,EAAS,uBAAuB,YAAY,CAAA;AAAA,MAC5C,MAAM,iBAAkB,CAAA,UAAA;AAAA,KAC1B,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,kBAAqB,GAAA,8BAAA;AAAA,IACzB,MAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,GACF,CAAA;AAGA,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,SAAA;AAAA,MACN,MAAQ,EAAA,IAAA;AAAA,MACR,QAAA,EAAU,CAAC,kBAAkB,CAAA;AAAA,MAC7B,OAAA,EAAS,CAAC,kBAAA,CAAmB,MAAM,CAAA;AAAA,MACnC,MAAM,kBAAmB,CAAA,SAAA;AAAA,KAC3B,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,qBAAqB,cAAe,CAAA,KAAA;AAAA,IACxC,CAAC,sCAAA;AAAA,GACH,CAAA;AAGA,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,UAAA;AAAA,IACN,MAAQ,EAAA,IAAA;AAAA,IACR,QAAU,EAAA,kBAAA;AAAA,IACV,OAAA,EAAS,uBAAuB,cAAc,CAAA;AAAA,IAC9C,MAAM,iBAAkB,CAAA,UAAA;AAAA,GAC1B,CAAA;AACF;;;;"}
|
|
@@ -9,18 +9,27 @@ var shared = require('../../shared.cjs');
|
|
|
9
9
|
var cn = require('../../utils/cn.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
function User({
|
|
12
|
+
function User({
|
|
13
|
+
userId,
|
|
14
|
+
replaceSelf,
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
13
19
|
const currentId = shared.useCurrentUserId();
|
|
14
20
|
const { user, isLoading } = react.useUser(userId);
|
|
15
21
|
const $ = overrides.useOverrides();
|
|
16
22
|
const resolvedUserName = react$1.useMemo(() => {
|
|
17
23
|
return replaceSelf && currentId === userId ? $.USER_SELF : user?.name ?? $.USER_UNKNOWN;
|
|
18
24
|
}, [replaceSelf, currentId, userId, $.USER_SELF, $.USER_UNKNOWN, user?.name]);
|
|
19
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", {
|
|
20
26
|
className: cn.cn("lb-name lb-user", className),
|
|
21
27
|
"data-loading": isLoading ? "" : void 0,
|
|
22
28
|
...props,
|
|
23
|
-
children:
|
|
29
|
+
children: [
|
|
30
|
+
isLoading ? null : resolvedUserName,
|
|
31
|
+
children
|
|
32
|
+
]
|
|
24
33
|
});
|
|
25
34
|
}
|
|
26
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.cjs","sources":["../../../src/components/internal/User.tsx"],"sourcesContent":["\"use client\";\n\nimport { useUser } from \"@liveblocks/react\";\nimport type { ComponentProps } from \"react\";\nimport { useMemo } from \"react\";\n\nimport { useOverrides } from \"../../overrides\";\nimport { useCurrentUserId } from \"../../shared\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface UserProps extends ComponentProps<\"span\"> {\n /**\n * The user ID to display the user name for.\n */\n userId: string;\n\n /**\n * Whether to replace the user name with \"you\" ($.USER_SELF) for the current user.\n */\n replaceSelf?: boolean;\n}\n\nexport function User({
|
|
1
|
+
{"version":3,"file":"User.cjs","sources":["../../../src/components/internal/User.tsx"],"sourcesContent":["\"use client\";\n\nimport { useUser } from \"@liveblocks/react\";\nimport type { ComponentProps } from \"react\";\nimport { useMemo } from \"react\";\n\nimport { useOverrides } from \"../../overrides\";\nimport { useCurrentUserId } from \"../../shared\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface UserProps extends ComponentProps<\"span\"> {\n /**\n * The user ID to display the user name for.\n */\n userId: string;\n\n /**\n * Whether to replace the user name with \"you\" ($.USER_SELF) for the current user.\n */\n replaceSelf?: boolean;\n}\n\nexport function User({\n userId,\n replaceSelf,\n className,\n children,\n ...props\n}: UserProps) {\n const currentId = useCurrentUserId();\n const { user, isLoading } = useUser(userId);\n const $ = useOverrides();\n const resolvedUserName = useMemo(() => {\n return replaceSelf && currentId === userId\n ? $.USER_SELF\n : (user?.name ?? $.USER_UNKNOWN);\n }, [replaceSelf, currentId, userId, $.USER_SELF, $.USER_UNKNOWN, user?.name]);\n\n return (\n <span\n className={cn(\"lb-name lb-user\", className)}\n data-loading={isLoading ? \"\" : undefined}\n {...props}\n >\n {isLoading ? null : resolvedUserName}\n {children}\n </span>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAsBO;AAAc;AACnB;AACA;AACA;AACA;AAEF;AACE;AACA;AACA;AACA;AACE;AAEqB;AAGvB;AACG;AAC2C;AACX;AAC3B;AAEH;AAAmB;AACnB;AAAA;AAGP;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useUser } from '@liveblocks/react';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { useOverrides } from '../../overrides.js';
|
|
@@ -7,18 +7,27 @@ import { useCurrentUserId } from '../../shared.js';
|
|
|
7
7
|
import { cn } from '../../utils/cn.js';
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
function User({
|
|
10
|
+
function User({
|
|
11
|
+
userId,
|
|
12
|
+
replaceSelf,
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
11
17
|
const currentId = useCurrentUserId();
|
|
12
18
|
const { user, isLoading } = useUser(userId);
|
|
13
19
|
const $ = useOverrides();
|
|
14
20
|
const resolvedUserName = useMemo(() => {
|
|
15
21
|
return replaceSelf && currentId === userId ? $.USER_SELF : user?.name ?? $.USER_UNKNOWN;
|
|
16
22
|
}, [replaceSelf, currentId, userId, $.USER_SELF, $.USER_UNKNOWN, user?.name]);
|
|
17
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
18
24
|
className: cn("lb-name lb-user", className),
|
|
19
25
|
"data-loading": isLoading ? "" : void 0,
|
|
20
26
|
...props,
|
|
21
|
-
children:
|
|
27
|
+
children: [
|
|
28
|
+
isLoading ? null : resolvedUserName,
|
|
29
|
+
children
|
|
30
|
+
]
|
|
22
31
|
});
|
|
23
32
|
}
|
|
24
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sources":["../../../src/components/internal/User.tsx"],"sourcesContent":["\"use client\";\n\nimport { useUser } from \"@liveblocks/react\";\nimport type { ComponentProps } from \"react\";\nimport { useMemo } from \"react\";\n\nimport { useOverrides } from \"../../overrides\";\nimport { useCurrentUserId } from \"../../shared\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface UserProps extends ComponentProps<\"span\"> {\n /**\n * The user ID to display the user name for.\n */\n userId: string;\n\n /**\n * Whether to replace the user name with \"you\" ($.USER_SELF) for the current user.\n */\n replaceSelf?: boolean;\n}\n\nexport function User({
|
|
1
|
+
{"version":3,"file":"User.js","sources":["../../../src/components/internal/User.tsx"],"sourcesContent":["\"use client\";\n\nimport { useUser } from \"@liveblocks/react\";\nimport type { ComponentProps } from \"react\";\nimport { useMemo } from \"react\";\n\nimport { useOverrides } from \"../../overrides\";\nimport { useCurrentUserId } from \"../../shared\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface UserProps extends ComponentProps<\"span\"> {\n /**\n * The user ID to display the user name for.\n */\n userId: string;\n\n /**\n * Whether to replace the user name with \"you\" ($.USER_SELF) for the current user.\n */\n replaceSelf?: boolean;\n}\n\nexport function User({\n userId,\n replaceSelf,\n className,\n children,\n ...props\n}: UserProps) {\n const currentId = useCurrentUserId();\n const { user, isLoading } = useUser(userId);\n const $ = useOverrides();\n const resolvedUserName = useMemo(() => {\n return replaceSelf && currentId === userId\n ? $.USER_SELF\n : (user?.name ?? $.USER_UNKNOWN);\n }, [replaceSelf, currentId, userId, $.USER_SELF, $.USER_UNKNOWN, user?.name]);\n\n return (\n <span\n className={cn(\"lb-name lb-user\", className)}\n data-loading={isLoading ? \"\" : undefined}\n {...props}\n >\n {isLoading ? null : resolvedUserName}\n {children}\n </span>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAsBO;AAAc;AACnB;AACA;AACA;AACA;AAEF;AACE;AACA;AACA;AACA;AACE;AAEqB;AAGvB;AACG;AAC2C;AACX;AAC3B;AAEH;AAAmB;AACnB;AAAA;AAGP;;"}
|
package/dist/constants.cjs
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
const FLOATING_ELEMENT_SIDE_OFFSET = 6;
|
|
4
4
|
const FLOATING_ELEMENT_COLLISION_PADDING = 10;
|
|
5
5
|
const EMOJI_FONT_FAMILY = "'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif";
|
|
6
|
-
const MENTION_CHARACTER = "@";
|
|
7
6
|
|
|
8
7
|
exports.EMOJI_FONT_FAMILY = EMOJI_FONT_FAMILY;
|
|
9
8
|
exports.FLOATING_ELEMENT_COLLISION_PADDING = FLOATING_ELEMENT_COLLISION_PADDING;
|
|
10
9
|
exports.FLOATING_ELEMENT_SIDE_OFFSET = FLOATING_ELEMENT_SIDE_OFFSET;
|
|
11
|
-
exports.MENTION_CHARACTER = MENTION_CHARACTER;
|
|
12
10
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../src/constants.ts"],"sourcesContent":["export const FLOATING_ELEMENT_SIDE_OFFSET = 6;\nexport const FLOATING_ELEMENT_COLLISION_PADDING = 10;\n\nexport const EMOJI_FONT_FAMILY =\n \"'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif\";\n
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../src/constants.ts"],"sourcesContent":["export const FLOATING_ELEMENT_SIDE_OFFSET = 6;\nexport const FLOATING_ELEMENT_COLLISION_PADDING = 10;\n\nexport const EMOJI_FONT_FAMILY =\n \"'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif\";\n"],"names":[],"mappings":";;AAAO,MAAM,4BAA+B,GAAA,EAAA;AACrC,MAAM,kCAAqC,GAAA,GAAA;AAE3C,MAAM,iBACX,GAAA;;;;;;"}
|
package/dist/constants.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const FLOATING_ELEMENT_SIDE_OFFSET = 6;
|
|
2
2
|
const FLOATING_ELEMENT_COLLISION_PADDING = 10;
|
|
3
3
|
const EMOJI_FONT_FAMILY = "'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif";
|
|
4
|
-
const MENTION_CHARACTER = "@";
|
|
5
4
|
|
|
6
|
-
export { EMOJI_FONT_FAMILY, FLOATING_ELEMENT_COLLISION_PADDING, FLOATING_ELEMENT_SIDE_OFFSET
|
|
5
|
+
export { EMOJI_FONT_FAMILY, FLOATING_ELEMENT_COLLISION_PADDING, FLOATING_ELEMENT_SIDE_OFFSET };
|
|
7
6
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const FLOATING_ELEMENT_SIDE_OFFSET = 6;\nexport const FLOATING_ELEMENT_COLLISION_PADDING = 10;\n\nexport const EMOJI_FONT_FAMILY =\n \"'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif\";\n
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const FLOATING_ELEMENT_SIDE_OFFSET = 6;\nexport const FLOATING_ELEMENT_COLLISION_PADDING = 10;\n\nexport const EMOJI_FONT_FAMILY =\n \"'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif\";\n"],"names":[],"mappings":"AAAO,MAAM,4BAA+B,GAAA,EAAA;AACrC,MAAM,kCAAqC,GAAA,GAAA;AAE3C,MAAM,iBACX,GAAA;;;;"}
|
package/dist/icon.cjs
CHANGED
|
@@ -45,6 +45,8 @@ var Text = require('./icons/Text.cjs');
|
|
|
45
45
|
var Translate = require('./icons/Translate.cjs');
|
|
46
46
|
var Underline = require('./icons/Underline.cjs');
|
|
47
47
|
var Undo = require('./icons/Undo.cjs');
|
|
48
|
+
var User = require('./icons/User.cjs');
|
|
49
|
+
var Users = require('./icons/Users.cjs');
|
|
48
50
|
var Warning = require('./icons/Warning.cjs');
|
|
49
51
|
|
|
50
52
|
|
|
@@ -93,5 +95,7 @@ exports.Text = Text.TextIcon;
|
|
|
93
95
|
exports.Translate = Translate.TranslateIcon;
|
|
94
96
|
exports.Underline = Underline.UnderlineIcon;
|
|
95
97
|
exports.Undo = Undo.UndoIcon;
|
|
98
|
+
exports.User = User.UserIcon;
|
|
99
|
+
exports.Users = Users.UsersIcon;
|
|
96
100
|
exports.Warning = Warning.WarningIcon;
|
|
97
101
|
//# sourceMappingURL=icon.cjs.map
|
package/dist/icon.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/icon.js
CHANGED
|
@@ -43,5 +43,7 @@ export { TextIcon as Text } from './icons/Text.js';
|
|
|
43
43
|
export { TranslateIcon as Translate } from './icons/Translate.js';
|
|
44
44
|
export { UnderlineIcon as Underline } from './icons/Underline.js';
|
|
45
45
|
export { UndoIcon as Undo } from './icons/Undo.js';
|
|
46
|
+
export { UserIcon as User } from './icons/User.js';
|
|
47
|
+
export { UsersIcon as Users } from './icons/Users.js';
|
|
46
48
|
export { WarningIcon as Warning } from './icons/Warning.js';
|
|
47
49
|
//# sourceMappingURL=icon.js.map
|
package/dist/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Icon = require('../components/internal/Icon.cjs');
|
|
5
|
+
|
|
6
|
+
function UserIcon(props) {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, {
|
|
8
|
+
...props,
|
|
9
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
10
|
+
d: "M10 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0a5.002 5.002 0 0 0-4.901 4.006c-.11.542.349.994.901.994h8c.552 0 1.01-.452.901-.994A5.002 5.002 0 0 0 10 9.75Z"
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.UserIcon = UserIcon;
|
|
16
|
+
//# sourceMappingURL=User.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.cjs","sources":["../../src/icons/User.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function UserIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M10 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0a5.002 5.002 0 0 0-4.901 4.006c-.11.542.349.994.901.994h8c.552 0 1.01-.452.901-.994A5.002 5.002 0 0 0 10 9.75Z\" />\n </Icon>\n );\n}\n"],"names":["jsx","Icon"],"mappings":";;;;;AAIO,SAAS,SAAS,KAA8B,EAAA;AACrD,EAAA,uBACGA,cAAA,CAAAC,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,IACR,QAAC,kBAAAD,cAAA,CAAA,MAAA,EAAA;AAAA,MAAK,CAAE,EAAA,iKAAA;AAAA,KAAkK,CAAA;AAAA,GAC5K,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Icon } from '../components/internal/Icon.js';
|
|
3
|
+
|
|
4
|
+
function UserIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
6
|
+
...props,
|
|
7
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
8
|
+
d: "M10 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0a5.002 5.002 0 0 0-4.901 4.006c-.11.542.349.994.901.994h8c.552 0 1.01-.452.901-.994A5.002 5.002 0 0 0 10 9.75Z"
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { UserIcon };
|
|
14
|
+
//# sourceMappingURL=User.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sources":["../../src/icons/User.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function UserIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M10 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0a5.002 5.002 0 0 0-4.901 4.006c-.11.542.349.994.901.994h8c.552 0 1.01-.452.901-.994A5.002 5.002 0 0 0 10 9.75Z\" />\n </Icon>\n );\n}\n"],"names":[],"mappings":";;;AAIO,SAAS,SAAS,KAA8B,EAAA;AACrD,EAAA,uBACG,GAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,IACR,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,MAAK,CAAE,EAAA,iKAAA;AAAA,KAAkK,CAAA;AAAA,GAC5K,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Icon = require('../components/internal/Icon.cjs');
|
|
5
|
+
|
|
6
|
+
function UsersIcon(props) {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, {
|
|
8
|
+
...props,
|
|
9
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
10
|
+
d: "M8 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0c-2.42 0-4.055 1.72-4.422 4.004-.087.545.37.996.922.996h7c.552 0 1.01-.45.922-.996C12.055 11.47 10.42 9.75 8 9.75ZM15 14.75h.5c.552 0 1.004-.45.912-.995-.317-1.888-1.485-4.114-3.412-4.505.863-.222 1.5-1.068 1.5-2a2 2 0 0 0-2-2"
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.UsersIcon = UsersIcon;
|
|
16
|
+
//# sourceMappingURL=Users.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Users.cjs","sources":["../../src/icons/Users.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function UsersIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M8 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0c-2.42 0-4.055 1.72-4.422 4.004-.087.545.37.996.922.996h7c.552 0 1.01-.45.922-.996C12.055 11.47 10.42 9.75 8 9.75ZM15 14.75h.5c.552 0 1.004-.45.912-.995-.317-1.888-1.485-4.114-3.412-4.505.863-.222 1.5-1.068 1.5-2a2 2 0 0 0-2-2\" />\n </Icon>\n );\n}\n"],"names":["jsx","Icon"],"mappings":";;;;;AAIO,SAAS,UAAU,KAA8B,EAAA;AACtD,EAAA,uBACGA,cAAA,CAAAC,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,IACR,QAAC,kBAAAD,cAAA,CAAA,MAAA,EAAA;AAAA,MAAK,CAAE,EAAA,oRAAA;AAAA,KAAqR,CAAA;AAAA,GAC/R,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Icon } from '../components/internal/Icon.js';
|
|
3
|
+
|
|
4
|
+
function UsersIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
6
|
+
...props,
|
|
7
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
8
|
+
d: "M8 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0c-2.42 0-4.055 1.72-4.422 4.004-.087.545.37.996.922.996h7c.552 0 1.01-.45.922-.996C12.055 11.47 10.42 9.75 8 9.75ZM15 14.75h.5c.552 0 1.004-.45.912-.995-.317-1.888-1.485-4.114-3.412-4.505.863-.222 1.5-1.068 1.5-2a2 2 0 0 0-2-2"
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { UsersIcon };
|
|
14
|
+
//# sourceMappingURL=Users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Users.js","sources":["../../src/icons/Users.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function UsersIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M8 9.75a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm0 0c-2.42 0-4.055 1.72-4.422 4.004-.087.545.37.996.922.996h7c.552 0 1.01-.45.922-.996C12.055 11.47 10.42 9.75 8 9.75ZM15 14.75h.5c.552 0 1.004-.45.912-.995-.317-1.888-1.485-4.114-3.412-4.505.863-.222 1.5-1.068 1.5-2a2 2 0 0 0-2-2\" />\n </Icon>\n );\n}\n"],"names":[],"mappings":";;;AAIO,SAAS,UAAU,KAA8B,EAAA;AACtD,EAAA,uBACG,GAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,IACR,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,MAAK,CAAE,EAAA,oRAAA;AAAA,KAAqR,CAAA;AAAA,GAC/R,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/icons/index.cjs
CHANGED
|
@@ -51,6 +51,8 @@ var Text = require('./Text.cjs');
|
|
|
51
51
|
var Translate = require('./Translate.cjs');
|
|
52
52
|
var Underline = require('./Underline.cjs');
|
|
53
53
|
var Undo = require('./Undo.cjs');
|
|
54
|
+
var User = require('./User.cjs');
|
|
55
|
+
var Users = require('./Users.cjs');
|
|
54
56
|
var Warning = require('./Warning.cjs');
|
|
55
57
|
|
|
56
58
|
|
|
@@ -106,5 +108,7 @@ exports.TextIcon = Text.TextIcon;
|
|
|
106
108
|
exports.TranslateIcon = Translate.TranslateIcon;
|
|
107
109
|
exports.UnderlineIcon = Underline.UnderlineIcon;
|
|
108
110
|
exports.UndoIcon = Undo.UndoIcon;
|
|
111
|
+
exports.UserIcon = User.UserIcon;
|
|
112
|
+
exports.UsersIcon = Users.UsersIcon;
|
|
109
113
|
exports.WarningIcon = Warning.WarningIcon;
|
|
110
114
|
//# sourceMappingURL=index.cjs.map
|
package/dist/icons/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/icons/index.js
CHANGED
|
@@ -49,5 +49,7 @@ export { TextIcon } from './Text.js';
|
|
|
49
49
|
export { TranslateIcon } from './Translate.js';
|
|
50
50
|
export { UnderlineIcon } from './Underline.js';
|
|
51
51
|
export { UndoIcon } from './Undo.js';
|
|
52
|
+
export { UserIcon } from './User.js';
|
|
53
|
+
export { UsersIcon } from './Users.js';
|
|
52
54
|
export { WarningIcon } from './Warning.js';
|
|
53
55
|
//# sourceMappingURL=index.js.map
|
package/dist/icons/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1060,13 +1060,6 @@ type HistoryVersionSummaryListProps = ComponentPropsWithoutRef<"ol">;
|
|
|
1060
1060
|
*/
|
|
1061
1061
|
declare const HistoryVersionSummaryList: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & react.RefAttributes<HTMLOListElement>>;
|
|
1062
1062
|
|
|
1063
|
-
interface AvatarProps extends ComponentProps<"div"> {
|
|
1064
|
-
/**
|
|
1065
|
-
* The user ID to display the avatar for.
|
|
1066
|
-
*/
|
|
1067
|
-
userId: string;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
1063
|
type ComponentTypeWithRef<T extends keyof JSX.IntrinsicElements, P> = ComponentType<P & Pick<ComponentProps<T>, "ref">>;
|
|
1071
1064
|
type InboxNotificationKinds<KS extends KDAD = KDAD> = {
|
|
1072
1065
|
[K in KS]: ComponentTypeWithRef<"a", InboxNotificationCustomKindProps<K>>;
|
|
@@ -1165,7 +1158,12 @@ type InboxNotificationCustomKindProps<K extends KDAD = KDAD> = Omit<InboxNotific
|
|
|
1165
1158
|
inboxNotification: InboxNotificationCustomData<K>;
|
|
1166
1159
|
};
|
|
1167
1160
|
type InboxNotificationIconProps = ComponentProps<"div">;
|
|
1168
|
-
|
|
1161
|
+
interface InboxNotificationAvatarProps extends ComponentProps<"div"> {
|
|
1162
|
+
/**
|
|
1163
|
+
* The user ID to display the avatar for.
|
|
1164
|
+
*/
|
|
1165
|
+
userId: string;
|
|
1166
|
+
}
|
|
1169
1167
|
declare function InboxNotificationIcon({ className, ...props }: InboxNotificationIconProps): react_jsx_runtime.JSX.Element;
|
|
1170
1168
|
declare function InboxNotificationAvatar({ className, ...props }: InboxNotificationAvatarProps): react_jsx_runtime.JSX.Element;
|
|
1171
1169
|
/**
|
|
@@ -1487,6 +1485,10 @@ declare function UnderlineIcon(props: ComponentProps<"svg">): react_jsx_runtime.
|
|
|
1487
1485
|
|
|
1488
1486
|
declare function UndoIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1489
1487
|
|
|
1488
|
+
declare function UserIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1489
|
+
|
|
1490
|
+
declare function UsersIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1491
|
+
|
|
1490
1492
|
declare function WarningIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1491
1493
|
|
|
1492
1494
|
declare namespace icon {
|
|
@@ -1535,6 +1537,8 @@ declare namespace icon {
|
|
|
1535
1537
|
TranslateIcon as Translate,
|
|
1536
1538
|
UnderlineIcon as Underline,
|
|
1537
1539
|
UndoIcon as Undo,
|
|
1540
|
+
UserIcon as User,
|
|
1541
|
+
UsersIcon as Users,
|
|
1538
1542
|
WarningIcon as Warning,
|
|
1539
1543
|
};
|
|
1540
1544
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1060,13 +1060,6 @@ type HistoryVersionSummaryListProps = ComponentPropsWithoutRef<"ol">;
|
|
|
1060
1060
|
*/
|
|
1061
1061
|
declare const HistoryVersionSummaryList: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & react.RefAttributes<HTMLOListElement>>;
|
|
1062
1062
|
|
|
1063
|
-
interface AvatarProps extends ComponentProps<"div"> {
|
|
1064
|
-
/**
|
|
1065
|
-
* The user ID to display the avatar for.
|
|
1066
|
-
*/
|
|
1067
|
-
userId: string;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
1063
|
type ComponentTypeWithRef<T extends keyof JSX.IntrinsicElements, P> = ComponentType<P & Pick<ComponentProps<T>, "ref">>;
|
|
1071
1064
|
type InboxNotificationKinds<KS extends KDAD = KDAD> = {
|
|
1072
1065
|
[K in KS]: ComponentTypeWithRef<"a", InboxNotificationCustomKindProps<K>>;
|
|
@@ -1165,7 +1158,12 @@ type InboxNotificationCustomKindProps<K extends KDAD = KDAD> = Omit<InboxNotific
|
|
|
1165
1158
|
inboxNotification: InboxNotificationCustomData<K>;
|
|
1166
1159
|
};
|
|
1167
1160
|
type InboxNotificationIconProps = ComponentProps<"div">;
|
|
1168
|
-
|
|
1161
|
+
interface InboxNotificationAvatarProps extends ComponentProps<"div"> {
|
|
1162
|
+
/**
|
|
1163
|
+
* The user ID to display the avatar for.
|
|
1164
|
+
*/
|
|
1165
|
+
userId: string;
|
|
1166
|
+
}
|
|
1169
1167
|
declare function InboxNotificationIcon({ className, ...props }: InboxNotificationIconProps): react_jsx_runtime.JSX.Element;
|
|
1170
1168
|
declare function InboxNotificationAvatar({ className, ...props }: InboxNotificationAvatarProps): react_jsx_runtime.JSX.Element;
|
|
1171
1169
|
/**
|
|
@@ -1487,6 +1485,10 @@ declare function UnderlineIcon(props: ComponentProps<"svg">): react_jsx_runtime.
|
|
|
1487
1485
|
|
|
1488
1486
|
declare function UndoIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1489
1487
|
|
|
1488
|
+
declare function UserIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1489
|
+
|
|
1490
|
+
declare function UsersIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1491
|
+
|
|
1490
1492
|
declare function WarningIcon(props: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
1491
1493
|
|
|
1492
1494
|
declare namespace icon {
|
|
@@ -1535,6 +1537,8 @@ declare namespace icon {
|
|
|
1535
1537
|
TranslateIcon as Translate,
|
|
1536
1538
|
UnderlineIcon as Underline,
|
|
1537
1539
|
UndoIcon as Undo,
|
|
1540
|
+
UserIcon as User,
|
|
1541
|
+
UsersIcon as Users,
|
|
1538
1542
|
WarningIcon as Warning,
|
|
1539
1543
|
};
|
|
1540
1544
|
}
|
|
@@ -4,7 +4,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var core = require('@liveblocks/core');
|
|
5
5
|
var reactSlot = require('@radix-ui/react-slot');
|
|
6
6
|
var react = require('react');
|
|
7
|
-
var constants = require('../../constants.cjs');
|
|
8
7
|
|
|
9
8
|
const COMMENT_MENTION_NAME = "CommentMention";
|
|
10
9
|
const COMMENT_BODY_NAME = "CommentBody";
|
|
@@ -35,7 +34,7 @@ const defaultBodyComponents = {
|
|
|
35
34
|
Mention: ({ mention }) => {
|
|
36
35
|
return /* @__PURE__ */ jsxRuntime.jsxs(CommentMention, {
|
|
37
36
|
children: [
|
|
38
|
-
|
|
37
|
+
core.MENTION_CHARACTER,
|
|
39
38
|
mention.id
|
|
40
39
|
]
|
|
41
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/primitives/Comment/index.tsx"],"sourcesContent":["import {\n isCommentBodyLink,\n isCommentBodyMention,\n sanitizeUrl,\n} from \"@liveblocks/core\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef, useMemo } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/primitives/Comment/index.tsx"],"sourcesContent":["import {\n isCommentBodyLink,\n isCommentBodyMention,\n MENTION_CHARACTER,\n sanitizeUrl,\n} from \"@liveblocks/core\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef, useMemo } from \"react\";\n\nimport type {\n CommentBodyComponents,\n CommentBodyProps,\n CommentLinkProps,\n CommentMentionProps,\n} from \"./types\";\n\nconst COMMENT_MENTION_NAME = \"CommentMention\";\nconst COMMENT_BODY_NAME = \"CommentBody\";\nconst COMMENT_LINK_NAME = \"CommentLink\";\n\n/**\n * Displays mentions within `Comment.Body`.\n *\n * @example\n * <Comment.Mention>@{mention.id}</Comment.Mention>\n */\nconst CommentMention = forwardRef<HTMLSpanElement, CommentMentionProps>(\n ({ children, asChild, ...props }, forwardedRef) => {\n const Component = asChild ? Slot : \"span\";\n\n return (\n <Component {...props} ref={forwardedRef}>\n {children}\n </Component>\n );\n }\n);\n\n/**\n * Displays links within `Comment.Body`.\n *\n * @example\n * <Comment.Link href={href}>{children}</Comment.Link>\n */\nconst CommentLink = forwardRef<HTMLAnchorElement, CommentLinkProps>(\n ({ children, asChild, ...props }, forwardedRef) => {\n const Component = asChild ? Slot : \"a\";\n\n return (\n <Component\n target=\"_blank\"\n rel=\"noopener noreferrer nofollow\"\n {...props}\n ref={forwardedRef}\n >\n {children}\n </Component>\n );\n }\n);\n\nconst defaultBodyComponents: CommentBodyComponents = {\n Mention: ({ mention }) => {\n return (\n <CommentMention>\n {MENTION_CHARACTER}\n {mention.id}\n </CommentMention>\n );\n },\n Link: ({ href, children }) => {\n return <CommentLink href={href}>{children}</CommentLink>;\n },\n};\n\n/**\n * Displays a comment body.\n *\n * @example\n * <Comment.Body body={comment.body} />\n */\nconst CommentBody = forwardRef<HTMLDivElement, CommentBodyProps>(\n ({ body, components, style, asChild, ...props }, forwardedRef) => {\n const Component = asChild ? Slot : \"div\";\n const { Mention, Link } = useMemo(\n () => ({ ...defaultBodyComponents, ...components }),\n [components]\n );\n\n if (!body || !body?.content) {\n return null;\n }\n\n return (\n <Component\n {...props}\n style={{ whiteSpace: \"break-spaces\", ...style }}\n ref={forwardedRef}\n >\n {body.content.map((block, index) => {\n switch (block.type) {\n case \"paragraph\":\n return (\n <p key={index} style={{ minHeight: \"1lh\" }}>\n {block.children.map((inline, index) => {\n if (isCommentBodyMention(inline)) {\n const { type: _, ...mention } = inline;\n\n return mention.id ? (\n <Mention mention={mention} key={index} />\n ) : null;\n }\n\n if (isCommentBodyLink(inline)) {\n const href = sanitizeUrl(inline.url);\n\n // If the URL is invalid, its text/URL are used as plain text.\n if (href === null) {\n return (\n <span key={index}>{inline.text ?? inline.url}</span>\n );\n }\n\n return (\n <Link href={href} key={index}>\n {inline.text ?? inline.url}\n </Link>\n );\n }\n\n // <code><s><em><strong>text</strong></s></em></code>\n let children: ReactNode = inline.text;\n\n if (inline.bold) {\n children = <strong key={index}>{children}</strong>;\n }\n\n if (inline.italic) {\n children = <em key={index}>{children}</em>;\n }\n\n if (inline.strikethrough) {\n children = <s key={index}>{children}</s>;\n }\n\n if (inline.code) {\n children = <code key={index}>{children}</code>;\n }\n\n return <span key={index}>{children}</span>;\n })}\n </p>\n );\n default:\n return null;\n }\n })}\n </Component>\n );\n }\n);\n\nif (process.env.NODE_ENV !== \"production\") {\n CommentBody.displayName = COMMENT_BODY_NAME;\n CommentMention.displayName = COMMENT_MENTION_NAME;\n CommentLink.displayName = COMMENT_LINK_NAME;\n}\n\n// NOTE: Every export from this file will be available publicly as Comment.*\nexport { CommentBody as Body, CommentLink as Link, CommentMention as Mention };\n"],"names":["forwardRef","Slot","jsx","jsxs","MENTION_CHARACTER","useMemo","index","isCommentBodyMention","isCommentBodyLink","sanitizeUrl"],"mappings":";;;;;;;AAiBA,MAAM,oBAAuB,GAAA,gBAAA,CAAA;AAC7B,MAAM,iBAAoB,GAAA,aAAA,CAAA;AAC1B,MAAM,iBAAoB,GAAA,aAAA,CAAA;AAQ1B,MAAM,cAAiB,GAAAA,gBAAA;AAAA,EACrB,CAAC,EAAE,QAAA,EAAU,OAAY,EAAA,GAAA,KAAA,IAAS,YAAiB,KAAA;AACjD,IAAM,MAAA,SAAA,GAAY,UAAUC,cAAO,GAAA,MAAA,CAAA;AAEnC,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MAAW,GAAG,KAAA;AAAA,MAAO,GAAK,EAAA,YAAA;AAAA,MACxB,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAQA,MAAM,WAAc,GAAAF,gBAAA;AAAA,EAClB,CAAC,EAAE,QAAA,EAAU,OAAY,EAAA,GAAA,KAAA,IAAS,YAAiB,KAAA;AACjD,IAAM,MAAA,SAAA,GAAY,UAAUC,cAAO,GAAA,GAAA,CAAA;AAEnC,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,GAAI,EAAA,8BAAA;AAAA,MACH,GAAG,KAAA;AAAA,MACJ,GAAK,EAAA,YAAA;AAAA,MAEJ,QAAA;AAAA,KACH,CAAA,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AAA,IAAI,OAAO,MAAQ,EAAA;AACjB,kBAAA,QAAA,mBAAYJ,cAAA,CAAA,IAAA,EAAA;AAAA,oBAAgB,QAAA;AAAA,mBAAA,EAARI,MAAiB,CAAA,CAAA;AAAA,iBACvC;AAEA,gBAAA,IAAI,OAAO,aAAe,EAAA;AACxB,kBAAA,QAAA,mBAAYJ,cAAA,CAAA,GAAA,EAAA;AAAA,oBAAe,QAAA;AAAA,mBAAA,EAARI,MAAiB,CAAA,CAAA;AAAA,iBACtC;AAEA,gBAAA,IAAI,OAAO,IAAM,EAAA;AACf,kBAAA,QAAA,mBAAYJ,cAAA,CAAA,MAAA,EAAA;AAAA,oBAAkB,QAAA;AAAA,mBAAA,EAARI,MAAiB,CAAA,CAAA;AAAA,iBACzC;AAEA,gBAAA,uBAAQJ,cAAA,CAAA,MAAA,EAAA;AAAA,kBAAkB,QAAA;AAAA,iBAAA,EAARI,MAAiB,CAAA,CAAA;AAAA,eACpC,CAAA;AAAA,aAAA,EA/CK,KAgDR,CAAA,CAAA;AAAA,UAEJ;AACE,YAAO,OAAA,IAAA,CAAA;AAAA,SACX;AAAA,OACD,CAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AACzC,EAAA,WAAA,CAAY,WAAc,GAAA,iBAAA,CAAA;AAC1B,EAAA,cAAA,CAAe,WAAc,GAAA,oBAAA,CAAA;AAC7B,EAAA,WAAA,CAAY,WAAc,GAAA,iBAAA,CAAA;AAC5B;;;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { isCommentBodyMention, isCommentBodyLink, sanitizeUrl } from '@liveblocks/core';
|
|
2
|
+
import { MENTION_CHARACTER, isCommentBodyMention, isCommentBodyLink, sanitizeUrl } from '@liveblocks/core';
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { forwardRef, useMemo } from 'react';
|
|
5
|
-
import { MENTION_CHARACTER } from '../../constants.js';
|
|
6
5
|
|
|
7
6
|
const COMMENT_MENTION_NAME = "CommentMention";
|
|
8
7
|
const COMMENT_BODY_NAME = "CommentBody";
|