@dxos/react-ui-thread 0.6.7 → 0.6.8-main.046e6cf
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/lib/browser/index.mjs +8 -13
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/Message/Message.d.ts +6 -6
- package/dist/types/src/Message/Message.d.ts.map +1 -1
- package/dist/types/src/Message/Message.stories.d.ts +2 -2
- package/dist/types/src/Thread/Comments.stories.d.ts +1 -1
- package/dist/types/src/Thread/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.d.ts +3 -3
- package/dist/types/src/Thread/Thread.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.stories.d.ts +2 -2
- package/dist/types/src/testing.d.ts +4 -4
- package/dist/types/src/testing.d.ts.map +1 -1
- package/package.json +14 -15
- package/src/Message/Message.tsx +23 -21
- package/src/Thread/Comments.stories.tsx +5 -6
- package/src/Thread/Thread.tsx +1 -1
|
@@ -33,7 +33,7 @@ var Thread = /* @__PURE__ */ forwardRef(({ current, children, classNames, ...pro
|
|
|
33
33
|
"aria-current": typeof current === "string" ? current : "location"
|
|
34
34
|
},
|
|
35
35
|
...props,
|
|
36
|
-
className: mx(threadLayout, hoverableFocusedWithinControls, "plb-1.5 bg-[var(--surface-bg)] border-[color:var(--surface-separator)] border-bs border-be", "attention attention-within attention-current [--controls-opacity:0]", classNames),
|
|
36
|
+
className: mx(threadLayout, hoverableFocusedWithinControls, "plb-1.5 bg-[var(--surface-bg)] border-[color:var(--surface-separator)] border-bs first:border-bs-0 border-be", "attention attention-within attention-current [--controls-opacity:0]", classNames),
|
|
37
37
|
ref: forwardedRef
|
|
38
38
|
}, children);
|
|
39
39
|
});
|
|
@@ -72,7 +72,7 @@ var ThreadFooter = /* @__PURE__ */ forwardRef(({ activity, classNames, children,
|
|
|
72
72
|
|
|
73
73
|
// packages/ui/react-ui-thread/src/Message/Message.tsx
|
|
74
74
|
import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
|
|
75
|
-
import React2, { forwardRef as forwardRef2
|
|
75
|
+
import React2, { forwardRef as forwardRef2 } from "react";
|
|
76
76
|
import { Avatar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
77
77
|
import { keymap, listener, useTextEditor } from "@dxos/react-ui-editor";
|
|
78
78
|
import { focusRing, mx as mx2 } from "@dxos/react-ui-theme";
|
|
@@ -164,9 +164,10 @@ var keyBindings = ({ onSend, onClear }) => [
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
];
|
|
167
|
-
var MessageTextbox = ({ id,
|
|
168
|
-
const
|
|
169
|
-
|
|
167
|
+
var MessageTextbox = ({ id, authorId, authorName, authorImgSrc, authorAvatarProps, disabled, extensions, onSend, onClear, onEditorFocus, ...editorProps }) => {
|
|
168
|
+
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
169
|
+
id,
|
|
170
|
+
extensions: [
|
|
170
171
|
keymap.of(keyBindings({
|
|
171
172
|
onSend,
|
|
172
173
|
onClear
|
|
@@ -178,14 +179,8 @@ var MessageTextbox = ({ id, onSend, onClear, onEditorFocus, authorId, authorName
|
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
}),
|
|
181
|
-
|
|
182
|
-
].filter(isNotFalsy)
|
|
183
|
-
}, [
|
|
184
|
-
_extensions
|
|
185
|
-
]);
|
|
186
|
-
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
187
|
-
id,
|
|
188
|
-
extensions,
|
|
182
|
+
extensions
|
|
183
|
+
].filter(isNotFalsy),
|
|
189
184
|
...editorProps
|
|
190
185
|
}), [
|
|
191
186
|
id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/translations.ts", "../../../src/Thread/Thread.tsx", "../../../src/Message/Message.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'thread';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {\n 'plugin name': 'Threads',\n 'thread title placeholder': 'New thread',\n 'thread title label': 'Title',\n 'delete thread label': 'Delete',\n 'create thread label': 'Create thread',\n 'message placeholder': 'Enter message...',\n 'comment placeholder': 'Enter comment...',\n 'settings standalone label': 'Enable standalone thread creation',\n 'anonymous label': 'Anonymous',\n 'enter to send message': 'Enter to add ⏎',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CaretDoubleRight, Spinner } from '@phosphor-icons/react';\nimport React, { type ComponentProps, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/react-ui-theme';\n\nimport { translationKey } from '../translations';\nimport type { ThreadEntity } from '../types';\n\nexport type ThreadProps = ThemedClassName<ComponentPropsWithRef<'div'>> &\n ThreadEntity & { current?: boolean | ComponentProps<'div'>['aria-current'] };\n\nexport const threadLayout = 'is-full place-self-start grid grid-cols-[var(--rail-size)_1fr]';\n\nexport const Thread = forwardRef<HTMLDivElement, ThreadProps>(\n ({ current, children, classNames, ...props }, forwardedRef) => {\n return (\n <div\n role='group'\n data-testid='thread'\n {...(current && { 'aria-current': typeof current === 'string' ? current : 'location' })}\n {...props}\n className={mx(\n threadLayout,\n hoverableFocusedWithinControls,\n 'plb-1.5 bg-[var(--surface-bg)] border-[color:var(--surface-separator)] border-bs border-be',\n 'attention attention-within attention-current [--controls-opacity:0]',\n classNames,\n )}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\nexport type ThreadHeadingProps = ThemedClassName<ComponentPropsWithRef<'div'>> & { detached?: boolean };\n\nexport const ThreadHeading = forwardRef<HTMLParagraphElement, ThreadHeadingProps>(\n ({ classNames, children, detached, ...props }, forwardedRef) => {\n return (\n <>\n <div role='none' className='flex items-center justify-center fg-description'>\n <CaretDoubleRight />\n </div>\n <div role='none' className='flex items-center overflow-hidden'>\n <p\n role='heading'\n data-testid='thread.heading'\n {...props}\n className={mx('mie-2 fg-description font-medium truncate italic', detached && 'line-through decoration-1')}\n ref={forwardedRef}\n >\n {children}\n </p>\n </div>\n </>\n );\n },\n);\n\nexport type ThreadFooterProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {\n activity?: boolean;\n};\n\nexport const ThreadFooter = forwardRef<HTMLDivElement, ThreadFooterProps>(\n ({ activity, classNames, children, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n return (\n <div\n {...props}\n className={mx(\n 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pie-2 text-xs fg-description',\n classNames,\n )}\n ref={forwardedRef}\n >\n <Spinner\n weight='bold'\n data-visible={activity ? 'show' : 'hide'}\n className='is-6 bs-4 invisible data-[visible=show]:visible animate-spin-slow'\n />\n <span className='truncate min-is-0' aria-live='polite'>\n {activity ? children : null}\n </span>\n <span className={mx('text-end', hoverableControlItem)}>{t('enter to send message')}</span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\nimport React, { type ComponentPropsWithRef, forwardRef,
|
|
5
|
-
"mappings": ";AAIO,IAAMA,iBAAiB;AAE9B,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACA,cAAAA,GAAiB;QAChB,eAAe;QACf,4BAA4B;QAC5B,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,6BAA6B;QAC7B,mBAAmB;QACnB,yBAAyB;MAC3B;IACF;EACF;;;;AClBF,SAASC,kBAAkBC,eAAe;AAC1C,OAAOC,SAA0DC,kBAAkB;AAEnF,SAA+BC,sBAAsB;AACrD,SAASC,sBAAsBC,gCAAgCC,UAAU;AAQlE,IAAMC,eAAe;AAErB,IAAMC,SAASC,2BACpB,CAAC,EAAEC,SAASC,UAAUC,YAAY,GAAGC,MAAAA,GAASC,iBAAAA;AAC5C,SACE,sBAAA,cAACC,OAAAA;IACCC,MAAK;IACLC,eAAY;IACX,GAAIP,WAAW;MAAE,gBAAgB,OAAOA,YAAY,WAAWA,UAAU;IAAW;IACpF,GAAGG;IACJK,WAAWC,GACTZ,cACAa,gCACA,
|
|
6
|
-
"names": ["translationKey", "CaretDoubleRight", "Spinner", "React", "forwardRef", "useTranslation", "hoverableControlItem", "hoverableFocusedWithinControls", "mx", "threadLayout", "Thread", "forwardRef", "current", "children", "classNames", "props", "forwardedRef", "div", "role", "data-testid", "className", "mx", "hoverableFocusedWithinControls", "ref", "ThreadHeading", "detached", "CaretDoubleRight", "p", "ThreadFooter", "activity", "t", "useTranslation", "translationKey", "Spinner", "weight", "data-visible", "span", "aria-live", "hoverableControlItem", "formatDistanceToNow", "React", "forwardRef", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'thread';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {\n 'plugin name': 'Threads',\n 'thread title placeholder': 'New thread',\n 'thread title label': 'Title',\n 'delete thread label': 'Delete',\n 'create thread label': 'Create thread',\n 'message placeholder': 'Enter message...',\n 'comment placeholder': 'Enter comment...',\n 'settings standalone label': 'Enable standalone thread creation',\n 'anonymous label': 'Anonymous',\n 'enter to send message': 'Enter to add ⏎',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CaretDoubleRight, Spinner } from '@phosphor-icons/react';\nimport React, { type ComponentProps, type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/react-ui-theme';\n\nimport { translationKey } from '../translations';\nimport type { ThreadEntity } from '../types';\n\nexport type ThreadProps = ThemedClassName<ComponentPropsWithRef<'div'>> &\n ThreadEntity & { current?: boolean | ComponentProps<'div'>['aria-current'] };\n\nexport const threadLayout = 'is-full place-self-start grid grid-cols-[var(--rail-size)_1fr]';\n\nexport const Thread = forwardRef<HTMLDivElement, ThreadProps>(\n ({ current, children, classNames, ...props }, forwardedRef) => {\n return (\n <div\n role='group'\n data-testid='thread'\n {...(current && { 'aria-current': typeof current === 'string' ? current : 'location' })}\n {...props}\n className={mx(\n threadLayout,\n hoverableFocusedWithinControls,\n 'plb-1.5 bg-[var(--surface-bg)] border-[color:var(--surface-separator)] border-bs first:border-bs-0 border-be',\n 'attention attention-within attention-current [--controls-opacity:0]',\n classNames,\n )}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\nexport type ThreadHeadingProps = ThemedClassName<ComponentPropsWithRef<'div'>> & { detached?: boolean };\n\nexport const ThreadHeading = forwardRef<HTMLParagraphElement, ThreadHeadingProps>(\n ({ classNames, children, detached, ...props }, forwardedRef) => {\n return (\n <>\n <div role='none' className='flex items-center justify-center fg-description'>\n <CaretDoubleRight />\n </div>\n <div role='none' className='flex items-center overflow-hidden'>\n <p\n role='heading'\n data-testid='thread.heading'\n {...props}\n className={mx('mie-2 fg-description font-medium truncate italic', detached && 'line-through decoration-1')}\n ref={forwardedRef}\n >\n {children}\n </p>\n </div>\n </>\n );\n },\n);\n\nexport type ThreadFooterProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {\n activity?: boolean;\n};\n\nexport const ThreadFooter = forwardRef<HTMLDivElement, ThreadFooterProps>(\n ({ activity, classNames, children, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n return (\n <div\n {...props}\n className={mx(\n 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pie-2 text-xs fg-description',\n classNames,\n )}\n ref={forwardedRef}\n >\n <Spinner\n weight='bold'\n data-visible={activity ? 'show' : 'hide'}\n className='is-6 bs-4 invisible data-[visible=show]:visible animate-spin-slow'\n />\n <span className='truncate min-is-0' aria-live='polite'>\n {activity ? children : null}\n </span>\n <span className={mx('text-end', hoverableControlItem)}>{t('enter to send message')}</span>\n </div>\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\nimport React, { type ComponentPropsWithRef, forwardRef, type ComponentPropsWithoutRef } from 'react';\n\n// TODO(burdon): Remove dep.\nimport { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { type UseTextEditorProps, keymap, listener, useTextEditor } from '@dxos/react-ui-editor';\nimport { focusRing, mx } from '@dxos/react-ui-theme';\nimport { hexToEmoji, hexToHue, isNotFalsy } from '@dxos/util';\n\nimport { translationKey } from '../translations';\nimport { type MessageMetadata } from '../types';\n\nconst avatarSize = 7;\n\nexport type MessageRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> &\n MessageMetadata &\n Partial<{ continues: boolean }>;\n\nexport const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(\n (\n { authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps },\n forwardedRef,\n ) => {\n return (\n // Must wrap the message since Avatar.Label may be used in the content.\n <Avatar.Root size={avatarSize} hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}>\n <div\n role='none'\n data-testid='thread.message'\n {...rootProps}\n className={mx('grid grid-cols-subgrid col-span-2', classNames)}\n ref={forwardedRef}\n >\n <div role='none' className='flex flex-col items-center gap-2 pbs-2'>\n <Avatar.Frame>\n <Avatar.Fallback text={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')} />\n {authorImgSrc && <Avatar.Image href={authorImgSrc} />}\n </Avatar.Frame>\n {continues && <div role='none' className='is-px grow surface-separator' />}\n </div>\n <div role='none' className='plb-1 min-is-0'>\n {children}\n </div>\n </div>\n </Avatar.Root>\n );\n },\n);\n\nexport type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> &\n Pick<MessageMetadata, 'authorName' | 'timestamp'>;\n\nexport const MessageHeading = ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => {\n return (\n <div role='none' {...props} className={mx('flex gap-2 items-start', classNames)}>\n <p className='grow'>\n <MessageAuthorName authorName={authorName} />\n {timestamp && <MessageTime timestamp={timestamp} />}\n </p>\n {children}\n </div>\n );\n};\n\nexport type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;\n\nexport const MessageAuthorName = ({ authorName }: MessageAuthorNameProps) => {\n const { t } = useTranslation(translationKey);\n return (\n <Avatar.Label classNames='block truncate text-sm fg-subdued'>{authorName ?? t('anonymous label')}</Avatar.Label>\n );\n};\n\nexport type MessageTimeProps = Pick<MessageMetadata, 'timestamp'>;\n\nexport const MessageTime = ({ timestamp }: MessageTimeProps) => {\n const { dtLocale } = useTranslation(translationKey);\n const dt = timestamp ? new Date(timestamp) : undefined;\n return (\n <time className='block fg-subdued text-xs pbe-0.5' dateTime={dt?.toISOString()}>\n {dt ? formatDistanceToNow(dt, { locale: dtLocale, addSuffix: true }) : ''}\n </time>\n );\n};\n\nexport type MessageBodyProps = ComponentPropsWithoutRef<'p'>;\n\nexport const MessageBody = ({ children, ...props }: MessageBodyProps) => {\n return <p {...props}>{children}</p>;\n};\n\nexport type MessageTextboxProps = {\n disabled?: boolean;\n onSend?: () => void;\n onClear?: () => void;\n onEditorFocus?: () => void;\n} & MessageMetadata &\n UseTextEditorProps;\n\nconst keyBindings = ({ onSend, onClear }: Pick<MessageTextboxProps, 'onSend' | 'onClear'>) => [\n {\n key: 'Enter',\n run: () => {\n if (onSend) {\n onSend();\n return true;\n } else {\n return false;\n }\n },\n },\n {\n // TODO(burdon): Other key bindings.\n key: 'Meta+Backspace',\n run: () => {\n if (onClear) {\n onClear();\n return true;\n } else {\n return false;\n }\n },\n },\n];\n\nexport const MessageTextbox = ({\n id,\n authorId,\n authorName,\n authorImgSrc,\n authorAvatarProps,\n disabled,\n extensions,\n onSend,\n onClear,\n onEditorFocus,\n ...editorProps\n}: MessageTextboxProps) => {\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n extensions: [\n keymap.of(keyBindings({ onSend, onClear })),\n listener({\n onFocus: (focusing) => {\n if (focusing) {\n onEditorFocus?.();\n }\n },\n }),\n extensions,\n ].filter(isNotFalsy),\n ...editorProps,\n }),\n [id, extensions],\n );\n\n return (\n <MessageRoot {...{ id, authorId, authorName, authorImgSrc, authorAvatarProps }} continues={false}>\n <div\n role='none'\n ref={parentRef}\n className={mx('plb-0.5 mie-1 rounded-sm', focusRing, disabled && 'opacity-50')}\n {...focusAttributes}\n />\n </MessageRoot>\n );\n};\n"],
|
|
5
|
+
"mappings": ";AAIO,IAAMA,iBAAiB;AAE9B,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACA,cAAAA,GAAiB;QAChB,eAAe;QACf,4BAA4B;QAC5B,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,6BAA6B;QAC7B,mBAAmB;QACnB,yBAAyB;MAC3B;IACF;EACF;;;;AClBF,SAASC,kBAAkBC,eAAe;AAC1C,OAAOC,SAA0DC,kBAAkB;AAEnF,SAA+BC,sBAAsB;AACrD,SAASC,sBAAsBC,gCAAgCC,UAAU;AAQlE,IAAMC,eAAe;AAErB,IAAMC,SAASC,2BACpB,CAAC,EAAEC,SAASC,UAAUC,YAAY,GAAGC,MAAAA,GAASC,iBAAAA;AAC5C,SACE,sBAAA,cAACC,OAAAA;IACCC,MAAK;IACLC,eAAY;IACX,GAAIP,WAAW;MAAE,gBAAgB,OAAOA,YAAY,WAAWA,UAAU;IAAW;IACpF,GAAGG;IACJK,WAAWC,GACTZ,cACAa,gCACA,gHACA,uEACAR,UAAAA;IAEFS,KAAKP;KAEJH,QAAAA;AAGP,CAAA;AAKK,IAAMW,gBAAgBb,2BAC3B,CAAC,EAAEG,YAAYD,UAAUY,UAAU,GAAGV,MAAAA,GAASC,iBAAAA;AAC7C,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOE,WAA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4BAA4BmD,WAAWd,YAAY,YAAA;IAChE,GAAGK;;AAIZ;",
|
|
6
|
+
"names": ["translationKey", "CaretDoubleRight", "Spinner", "React", "forwardRef", "useTranslation", "hoverableControlItem", "hoverableFocusedWithinControls", "mx", "threadLayout", "Thread", "forwardRef", "current", "children", "classNames", "props", "forwardedRef", "div", "role", "data-testid", "className", "mx", "hoverableFocusedWithinControls", "ref", "ThreadHeading", "detached", "CaretDoubleRight", "p", "ThreadFooter", "activity", "t", "useTranslation", "translationKey", "Spinner", "weight", "data-visible", "span", "aria-live", "hoverableControlItem", "formatDistanceToNow", "React", "forwardRef", "Avatar", "useTranslation", "keymap", "listener", "useTextEditor", "focusRing", "mx", "hexToEmoji", "hexToHue", "isNotFalsy", "avatarSize", "MessageRoot", "forwardRef", "authorImgSrc", "authorId", "authorName", "authorAvatarProps", "continues", "children", "classNames", "rootProps", "forwardedRef", "React", "Avatar", "Root", "size", "hue", "hexToHue", "div", "role", "data-testid", "className", "mx", "ref", "Frame", "Fallback", "text", "emoji", "hexToEmoji", "Image", "href", "MessageHeading", "timestamp", "props", "p", "MessageAuthorName", "MessageTime", "t", "useTranslation", "translationKey", "Label", "dtLocale", "dt", "Date", "undefined", "time", "dateTime", "toISOString", "formatDistanceToNow", "locale", "addSuffix", "MessageBody", "keyBindings", "onSend", "onClear", "key", "run", "MessageTextbox", "id", "disabled", "extensions", "onEditorFocus", "editorProps", "parentRef", "focusAttributes", "useTextEditor", "keymap", "of", "listener", "onFocus", "focusing", "filter", "isNotFalsy", "focusRing"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-thread/src/translations.ts":{"bytes":2337,"imports":[],"format":"esm"},"packages/ui/react-ui-thread/src/Thread/Thread.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-thread/src/translations.ts":{"bytes":2337,"imports":[],"format":"esm"},"packages/ui/react-ui-thread/src/Thread/Thread.tsx":{"bytes":9732,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-thread/src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"packages/ui/react-ui-thread/src/Thread/index.ts":{"bytes":500,"imports":[{"path":"packages/ui/react-ui-thread/src/Thread/Thread.tsx","kind":"import-statement","original":"./Thread"}],"format":"esm"},"packages/ui/react-ui-thread/src/Message/Message.tsx":{"bytes":16942,"imports":[{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-thread/src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"packages/ui/react-ui-thread/src/Message/index.ts":{"bytes":506,"imports":[{"path":"packages/ui/react-ui-thread/src/Message/Message.tsx","kind":"import-statement","original":"./Message"}],"format":"esm"},"packages/ui/react-ui-thread/src/types.ts":{"bytes":863,"imports":[],"format":"esm"},"packages/ui/react-ui-thread/src/index.ts":{"bytes":913,"imports":[{"path":"packages/ui/react-ui-thread/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/ui/react-ui-thread/src/Thread/index.ts","kind":"import-statement","original":"./Thread"},{"path":"packages/ui/react-ui-thread/src/Message/index.ts","kind":"import-statement","original":"./Message"},{"path":"packages/ui/react-ui-thread/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-thread/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15052},"packages/ui/react-ui-thread/dist/lib/browser/index.mjs":{"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["MessageAuthorName","MessageBody","MessageHeading","MessageRoot","MessageTextbox","MessageTime","Thread","ThreadFooter","ThreadHeading","threadLayout","translations"],"entryPoint":"packages/ui/react-ui-thread/src/index.ts","inputs":{"packages/ui/react-ui-thread/src/translations.ts":{"bytesInOutput":609},"packages/ui/react-ui-thread/src/Thread/Thread.tsx":{"bytesInOutput":2592},"packages/ui/react-ui-thread/src/Thread/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-thread/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-thread/src/Message/Message.tsx":{"bytesInOutput":4327},"packages/ui/react-ui-thread/src/Message/index.ts":{"bytesInOutput":0}},"bytes":7936}}}
|
|
@@ -5,20 +5,20 @@ import { type MessageMetadata } from '../types';
|
|
|
5
5
|
export type MessageRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & MessageMetadata & Partial<{
|
|
6
6
|
continues: boolean;
|
|
7
7
|
}>;
|
|
8
|
-
export declare const MessageRoot: React.ForwardRefExoticComponent<
|
|
8
|
+
export declare const MessageRoot: React.ForwardRefExoticComponent<Omit<MessageRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
export type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & Pick<MessageMetadata, 'authorName' | 'timestamp'>;
|
|
10
|
-
export declare const MessageHeading: ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => JSX.Element;
|
|
10
|
+
export declare const MessageHeading: ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => React.JSX.Element;
|
|
11
11
|
export type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;
|
|
12
|
-
export declare const MessageAuthorName: ({ authorName }: MessageAuthorNameProps) => JSX.Element;
|
|
12
|
+
export declare const MessageAuthorName: ({ authorName }: MessageAuthorNameProps) => React.JSX.Element;
|
|
13
13
|
export type MessageTimeProps = Pick<MessageMetadata, 'timestamp'>;
|
|
14
|
-
export declare const MessageTime: ({ timestamp }: MessageTimeProps) => JSX.Element;
|
|
14
|
+
export declare const MessageTime: ({ timestamp }: MessageTimeProps) => React.JSX.Element;
|
|
15
15
|
export type MessageBodyProps = ComponentPropsWithoutRef<'p'>;
|
|
16
|
-
export declare const MessageBody: ({ children, ...props }: MessageBodyProps) => JSX.Element;
|
|
16
|
+
export declare const MessageBody: ({ children, ...props }: MessageBodyProps) => React.JSX.Element;
|
|
17
17
|
export type MessageTextboxProps = {
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
onSend?: () => void;
|
|
20
20
|
onClear?: () => void;
|
|
21
21
|
onEditorFocus?: () => void;
|
|
22
22
|
} & MessageMetadata & UseTextEditorProps;
|
|
23
|
-
export declare const MessageTextbox: ({ id,
|
|
23
|
+
export declare const MessageTextbox: ({ id, authorId, authorName, authorImgSrc, authorAvatarProps, disabled, extensions, onSend, onClear, onEditorFocus, ...editorProps }: MessageTextboxProps) => React.JSX.Element;
|
|
24
24
|
//# sourceMappingURL=Message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,qBAAqB,EAAc,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAG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BrB,CAAC"}
|
|
@@ -2,8 +2,8 @@ import '@dxosTheme';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: React.ForwardRefExoticComponent<
|
|
6
|
-
render: () => JSX.Element;
|
|
5
|
+
component: React.ForwardRefExoticComponent<Omit<import("./Message").MessageRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
render: () => React.JSX.Element;
|
|
7
7
|
decorators: import("@storybook/react/*").Decorator[];
|
|
8
8
|
parameters: {
|
|
9
9
|
translations: {
|
|
@@ -22,7 +22,7 @@ declare const _default: {
|
|
|
22
22
|
onResolve: () => void;
|
|
23
23
|
}>;
|
|
24
24
|
decorators: import("@storybook/react/*").Decorator[];
|
|
25
|
-
render: (args: StoryProps) => JSX.Element;
|
|
25
|
+
render: (args: StoryProps) => React.JSX.Element;
|
|
26
26
|
parameters: {
|
|
27
27
|
translations: {
|
|
28
28
|
'en-US': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Comments.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Comments.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAGpB,OAAO,KAAwD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Comments.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Comments.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAGpB,OAAO,KAAwD,MAAM,OAAO,CAAC;AAQ7E,OAAO,EAML,KAAK,KAAK,EAMX,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAqEhD,KAAK,kBAAkB,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,CAAC;AAwHF,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;;;;gBAxHQ,kBAAkB;kBAChB,OAAO;kBACP,MAAM,IAAI;mBACT,MAAM,IAAI;;;mBAgPN,UAAU;;;;;;;;;;;;;;;;;;;;;AAJ3B,wBAME;AAWF,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
|
|
@@ -5,13 +5,13 @@ export type ThreadProps = ThemedClassName<ComponentPropsWithRef<'div'>> & Thread
|
|
|
5
5
|
current?: boolean | ComponentProps<'div'>['aria-current'];
|
|
6
6
|
};
|
|
7
7
|
export declare const threadLayout = "is-full place-self-start grid grid-cols-[var(--rail-size)_1fr]";
|
|
8
|
-
export declare const Thread: React.ForwardRefExoticComponent<
|
|
8
|
+
export declare const Thread: React.ForwardRefExoticComponent<Omit<ThreadProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
export type ThreadHeadingProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
|
|
10
10
|
detached?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const ThreadHeading: React.ForwardRefExoticComponent<
|
|
12
|
+
export declare const ThreadHeading: React.ForwardRefExoticComponent<Omit<ThreadHeadingProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
13
13
|
export type ThreadFooterProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
|
|
14
14
|
activity?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export declare const ThreadFooter: React.ForwardRefExoticComponent<
|
|
16
|
+
export declare const ThreadFooter: React.ForwardRefExoticComponent<Omit<ThreadFooterProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
17
|
//# sourceMappingURL=Thread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thread.d.ts","sourceRoot":"","sources":["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,MAAM,iBAAiB,GAAG,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,YAAY,uGAwBxB,CAAC"}
|
|
@@ -2,8 +2,8 @@ import '@dxosTheme';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: React.ForwardRefExoticComponent<
|
|
6
|
-
render: () => JSX.Element;
|
|
5
|
+
component: React.ForwardRefExoticComponent<Omit<import("./Thread").ThreadProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
render: () => React.JSX.Element;
|
|
7
7
|
decorators: import("@storybook/react/*").Decorator[];
|
|
8
8
|
parameters: {
|
|
9
9
|
translations: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PropsWithChildren } from 'react';
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
2
|
import { type MessageMetadata } from './types';
|
|
3
3
|
export type MessageEntity<PartValue = any> = MessageMetadata & {
|
|
4
4
|
text: string;
|
|
@@ -8,10 +8,10 @@ export type MessageTextProps = MessageMetadata & {
|
|
|
8
8
|
text: string;
|
|
9
9
|
onDelete?: () => void;
|
|
10
10
|
};
|
|
11
|
-
export declare const MessageStoryText: ({ text, onDelete, authorName, timestamp }: MessageTextProps) => JSX.Element;
|
|
11
|
+
export declare const MessageStoryText: ({ text, onDelete, authorName, timestamp }: MessageTextProps) => React.JSX.Element;
|
|
12
12
|
export type MessagePartProps<PartValue> = {
|
|
13
13
|
part: PartValue;
|
|
14
14
|
};
|
|
15
|
-
export declare const MessageStoryBlock: <PartValue>({ part }: MessagePartProps<PartValue>) => JSX.Element;
|
|
16
|
-
export declare const ThreadStoryContainer: ({ children }: PropsWithChildren) => JSX.Element;
|
|
15
|
+
export declare const MessageStoryBlock: <PartValue>({ part }: MessagePartProps<PartValue>) => React.JSX.Element;
|
|
16
|
+
export declare const ThreadStoryContainer: ({ children }: PropsWithChildren) => React.JSX.Element;
|
|
17
17
|
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.tsx"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAMtD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,aAAa,CAAC,SAAS,GAAG,GAAG,IAAI,eAAe,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,8CAA+C,gBAAgB,sBAiB3F,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,SAAS,IAAI;IACxC,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,YAAa,gBAAgB,CAAC,SAAS,CAAC,sBAWlF,CAAC;AAEF,eAAO,MAAM,oBAAoB,iBAAkB,iBAAiB,sBAEnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-thread",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8-main.046e6cf",
|
|
4
4
|
"description": "A set of components to use with threads, including comments and messages.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,26 +23,25 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@radix-ui/react-primitive": "^1.0.2",
|
|
25
25
|
"date-fns": "^3.3.1",
|
|
26
|
-
"@dxos/react-ui": "0.6.
|
|
27
|
-
"@dxos/react-ui-
|
|
28
|
-
"@dxos/react-ui-editor": "0.6.
|
|
29
|
-
"@dxos/react-ui-
|
|
30
|
-
"@dxos/util": "0.6.
|
|
26
|
+
"@dxos/react-ui": "0.6.8-main.046e6cf",
|
|
27
|
+
"@dxos/react-ui-theme": "0.6.8-main.046e6cf",
|
|
28
|
+
"@dxos/react-ui-editor": "0.6.8-main.046e6cf",
|
|
29
|
+
"@dxos/react-ui-mosaic": "0.6.8-main.046e6cf",
|
|
30
|
+
"@dxos/util": "0.6.8-main.046e6cf"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@phosphor-icons/react": "^2.1.5",
|
|
34
|
-
"@types/react": "
|
|
35
|
-
"@types/react-dom": "
|
|
34
|
+
"@types/react": "~18.2.0",
|
|
35
|
+
"@types/react-dom": "~18.2.0",
|
|
36
36
|
"react": "~18.2.0",
|
|
37
37
|
"react-dom": "~18.2.0",
|
|
38
38
|
"vite": "^5.3.4",
|
|
39
|
-
"@dxos/echo-
|
|
40
|
-
"@
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/storybook-utils": "0.6.7"
|
|
39
|
+
"@dxos/echo-db": "0.6.8-main.046e6cf",
|
|
40
|
+
"@dxos/echo-schema": "0.6.8-main.046e6cf",
|
|
41
|
+
"@dxos/keys": "0.6.8-main.046e6cf",
|
|
42
|
+
"@dxos/log": "0.6.8-main.046e6cf",
|
|
43
|
+
"@dxos/storybook-utils": "0.6.8-main.046e6cf",
|
|
44
|
+
"@dxos/random": "0.6.8-main.046e6cf"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
47
|
"@phosphor-icons/react": "^2.1.5",
|
package/src/Message/Message.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';
|
|
6
|
-
import React, { type ComponentPropsWithRef, forwardRef,
|
|
6
|
+
import React, { type ComponentPropsWithRef, forwardRef, type ComponentPropsWithoutRef } from 'react';
|
|
7
7
|
|
|
8
8
|
// TODO(burdon): Remove dep.
|
|
9
9
|
import { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
@@ -129,33 +129,35 @@ const keyBindings = ({ onSend, onClear }: Pick<MessageTextboxProps, 'onSend' | '
|
|
|
129
129
|
|
|
130
130
|
export const MessageTextbox = ({
|
|
131
131
|
id,
|
|
132
|
-
onSend,
|
|
133
|
-
onClear,
|
|
134
|
-
onEditorFocus,
|
|
135
132
|
authorId,
|
|
136
133
|
authorName,
|
|
137
134
|
authorImgSrc,
|
|
138
135
|
authorAvatarProps,
|
|
139
136
|
disabled,
|
|
140
|
-
extensions
|
|
137
|
+
extensions,
|
|
138
|
+
onSend,
|
|
139
|
+
onClear,
|
|
140
|
+
onEditorFocus,
|
|
141
141
|
...editorProps
|
|
142
142
|
}: MessageTextboxProps) => {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
143
|
+
const { parentRef, focusAttributes } = useTextEditor(
|
|
144
|
+
() => ({
|
|
145
|
+
id,
|
|
146
|
+
extensions: [
|
|
147
|
+
keymap.of(keyBindings({ onSend, onClear })),
|
|
148
|
+
listener({
|
|
149
|
+
onFocus: (focusing) => {
|
|
150
|
+
if (focusing) {
|
|
151
|
+
onEditorFocus?.();
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
}),
|
|
155
|
+
extensions,
|
|
156
|
+
].filter(isNotFalsy),
|
|
157
|
+
...editorProps,
|
|
158
|
+
}),
|
|
159
|
+
[id, extensions],
|
|
160
|
+
);
|
|
159
161
|
|
|
160
162
|
return (
|
|
161
163
|
<MessageRoot {...{ id, authorId, authorName, authorImgSrc, authorAvatarProps }} continues={false}>
|
|
@@ -7,9 +7,8 @@ import '@dxosTheme';
|
|
|
7
7
|
import { Check, Trash } from '@phosphor-icons/react';
|
|
8
8
|
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { MessageType, TextType } from '@braneframe/types';
|
|
11
10
|
import { createDocAccessor, createEchoObject } from '@dxos/echo-db';
|
|
12
|
-
import { create } from '@dxos/echo-schema';
|
|
11
|
+
import { create, Expando } from '@dxos/echo-schema';
|
|
13
12
|
import { PublicKey } from '@dxos/keys';
|
|
14
13
|
import { log } from '@dxos/log';
|
|
15
14
|
import { faker } from '@dxos/random';
|
|
@@ -45,7 +44,7 @@ const authorId = PublicKey.random().toHex();
|
|
|
45
44
|
|
|
46
45
|
const Editor: FC<{
|
|
47
46
|
id?: string;
|
|
48
|
-
item:
|
|
47
|
+
item: Expando;
|
|
49
48
|
comments: Comment[];
|
|
50
49
|
selected?: string;
|
|
51
50
|
onCreateComment: CommentsOptions['onCreate'];
|
|
@@ -143,12 +142,12 @@ const StoryThread: FC<{
|
|
|
143
142
|
|
|
144
143
|
const handleCreateMessage = () => {
|
|
145
144
|
if (messageRef.current?.length) {
|
|
146
|
-
const message = create(
|
|
145
|
+
const message = create(Expando, {
|
|
147
146
|
timestamp: new Date().toISOString(),
|
|
148
147
|
sender: { identityKey: authorId },
|
|
149
148
|
text: messageRef.current,
|
|
150
149
|
});
|
|
151
|
-
thread.messages.push(message);
|
|
150
|
+
thread.messages.push(message as any);
|
|
152
151
|
|
|
153
152
|
messageRef.current = '';
|
|
154
153
|
setAutoFocus(true);
|
|
@@ -233,7 +232,7 @@ type StoryProps = {
|
|
|
233
232
|
};
|
|
234
233
|
|
|
235
234
|
const Story = ({ text, autoCreate }: StoryProps) => {
|
|
236
|
-
const [item] = useState(createEchoObject(create(
|
|
235
|
+
const [item] = useState(createEchoObject(create(Expando, { content: text ?? '' })));
|
|
237
236
|
const [threads, setThreads] = useState<StoryCommentThread[]>([]);
|
|
238
237
|
const [selected, setSelected] = useState<string>();
|
|
239
238
|
|
package/src/Thread/Thread.tsx
CHANGED
|
@@ -27,7 +27,7 @@ export const Thread = forwardRef<HTMLDivElement, ThreadProps>(
|
|
|
27
27
|
className={mx(
|
|
28
28
|
threadLayout,
|
|
29
29
|
hoverableFocusedWithinControls,
|
|
30
|
-
'plb-1.5 bg-[var(--surface-bg)] border-[color:var(--surface-separator)] border-bs border-be',
|
|
30
|
+
'plb-1.5 bg-[var(--surface-bg)] border-[color:var(--surface-separator)] border-bs first:border-bs-0 border-be',
|
|
31
31
|
'attention attention-within attention-current [--controls-opacity:0]',
|
|
32
32
|
classNames,
|
|
33
33
|
)}
|