@dxos/react-ui-thread 0.8.2-staging.7ac8446 → 0.8.3-main.672df60
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 +168 -121
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/Message/Message.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -14
- package/src/Thread/Comments.stories.tsx +3 -3
- package/src/types.ts +1 -1
|
@@ -20,57 +20,74 @@ var translations_default = [
|
|
|
20
20
|
];
|
|
21
21
|
|
|
22
22
|
// packages/ui/react-ui-thread/src/Thread/Thread.tsx
|
|
23
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
23
24
|
import { CaretDoubleRight, Spinner } from "@phosphor-icons/react";
|
|
24
25
|
import React, { forwardRef } from "react";
|
|
25
26
|
import { useTranslation } from "@dxos/react-ui";
|
|
26
27
|
import { hoverableControlItem, hoverableFocusedWithinControls, mx } from "@dxos/react-ui-theme";
|
|
27
28
|
var threadLayout = "is-full place-self-start grid grid-cols-[var(--rail-size)_1fr]";
|
|
28
29
|
var Thread = /* @__PURE__ */ forwardRef(({ current, children, classNames, ...props }, forwardedRef) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
var _effect = _useSignals();
|
|
31
|
+
try {
|
|
32
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
33
|
+
role: "group",
|
|
34
|
+
"data-testid": "thread",
|
|
35
|
+
...current && {
|
|
36
|
+
"aria-current": typeof current === "string" ? current : "location"
|
|
37
|
+
},
|
|
38
|
+
...props,
|
|
39
|
+
className: mx(threadLayout, hoverableFocusedWithinControls, "pbs-2 pbe-4 bg-[var(--surface-bg)] border-separator first:border-bs-0 border-be", "current-related attention-surface [--controls-opacity:0]", classNames),
|
|
40
|
+
ref: forwardedRef
|
|
41
|
+
}, children);
|
|
42
|
+
} finally {
|
|
43
|
+
_effect.f();
|
|
44
|
+
}
|
|
39
45
|
});
|
|
40
46
|
var ThreadHeading = /* @__PURE__ */ forwardRef(({ classNames, children, detached, ...props }, forwardedRef) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
var _effect = _useSignals();
|
|
48
|
+
try {
|
|
49
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
50
|
+
role: "none",
|
|
51
|
+
className: "flex items-center justify-center text-description"
|
|
52
|
+
}, /* @__PURE__ */ React.createElement(CaretDoubleRight, null)), /* @__PURE__ */ React.createElement("div", {
|
|
53
|
+
role: "none",
|
|
54
|
+
className: "flex items-center overflow-hidden"
|
|
55
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
56
|
+
role: "heading",
|
|
57
|
+
"data-testid": "thread.heading",
|
|
58
|
+
...props,
|
|
59
|
+
className: mx("mie-2 text-description font-medium truncate italic", detached && "line-through decoration-1"),
|
|
60
|
+
ref: forwardedRef
|
|
61
|
+
}, children)));
|
|
62
|
+
} finally {
|
|
63
|
+
_effect.f();
|
|
64
|
+
}
|
|
54
65
|
});
|
|
55
66
|
var ThreadFooter = /* @__PURE__ */ forwardRef(({ activity, classNames, children, ...props }, forwardedRef) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
var _effect = _useSignals();
|
|
68
|
+
try {
|
|
69
|
+
const { t } = useTranslation(translationKey);
|
|
70
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
71
|
+
...props,
|
|
72
|
+
className: mx("col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pie-2 text-xs text-description", classNames),
|
|
73
|
+
ref: forwardedRef
|
|
74
|
+
}, /* @__PURE__ */ React.createElement(Spinner, {
|
|
75
|
+
weight: "bold",
|
|
76
|
+
"data-visible": activity ? "show" : "hide",
|
|
77
|
+
className: "is-6 bs-4 invisible data-[visible=show]:visible animate-spin-slow"
|
|
78
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
79
|
+
className: "truncate min-is-0",
|
|
80
|
+
"aria-live": "polite"
|
|
81
|
+
}, activity ? children : null), /* @__PURE__ */ React.createElement("span", {
|
|
82
|
+
className: mx("text-end", hoverableControlItem)
|
|
83
|
+
}, t("enter to send message")));
|
|
84
|
+
} finally {
|
|
85
|
+
_effect.f();
|
|
86
|
+
}
|
|
71
87
|
});
|
|
72
88
|
|
|
73
89
|
// packages/ui/react-ui-thread/src/Message/Message.tsx
|
|
90
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
74
91
|
import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
|
|
75
92
|
import React2, { forwardRef as forwardRef2 } from "react";
|
|
76
93
|
import { Avatar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
@@ -79,65 +96,90 @@ import { focusRing, mx as mx2 } from "@dxos/react-ui-theme";
|
|
|
79
96
|
import { hexToEmoji, hexToHue, isNotFalsy } from "@dxos/util";
|
|
80
97
|
var avatarSize = 7;
|
|
81
98
|
var MessageRoot = /* @__PURE__ */ forwardRef2(({ authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps }, forwardedRef) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
var _effect = _useSignals2();
|
|
100
|
+
try {
|
|
101
|
+
return (
|
|
102
|
+
// Must wrap the message since Avatar.Label may be used in the content.
|
|
103
|
+
/* @__PURE__ */ React2.createElement(Avatar.Root, null, /* @__PURE__ */ React2.createElement("div", {
|
|
104
|
+
role: "none",
|
|
105
|
+
"data-testid": "thread.message",
|
|
106
|
+
...rootProps,
|
|
107
|
+
className: mx2("grid grid-cols-subgrid col-span-2", classNames),
|
|
108
|
+
ref: forwardedRef
|
|
109
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
110
|
+
role: "none",
|
|
111
|
+
className: "flex flex-col items-center gap-2 pbs-2"
|
|
112
|
+
}, /* @__PURE__ */ React2.createElement(Avatar.Content, {
|
|
113
|
+
size: avatarSize,
|
|
114
|
+
hue: authorAvatarProps?.hue || hexToHue(authorId ?? "0"),
|
|
115
|
+
fallback: authorAvatarProps?.emoji || hexToEmoji(authorId ?? "0"),
|
|
116
|
+
...authorImgSrc && {
|
|
117
|
+
imgSrc: authorImgSrc
|
|
118
|
+
}
|
|
119
|
+
}), continues && /* @__PURE__ */ React2.createElement("div", {
|
|
120
|
+
role: "none",
|
|
121
|
+
className: "is-px grow bg-separator"
|
|
122
|
+
})), /* @__PURE__ */ React2.createElement("div", {
|
|
123
|
+
role: "none",
|
|
124
|
+
className: "plb-1 min-is-0"
|
|
125
|
+
}, children)))
|
|
126
|
+
);
|
|
127
|
+
} finally {
|
|
128
|
+
_effect.f();
|
|
129
|
+
}
|
|
108
130
|
});
|
|
109
131
|
var MessageHeading = ({ children, classNames, timestamp, authorName, ...props }) => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
132
|
+
var _effect = _useSignals2();
|
|
133
|
+
try {
|
|
134
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
135
|
+
role: "none",
|
|
136
|
+
...props,
|
|
137
|
+
className: mx2("flex gap-2 items-start", classNames)
|
|
138
|
+
}, /* @__PURE__ */ React2.createElement("p", {
|
|
139
|
+
className: "grow"
|
|
140
|
+
}, /* @__PURE__ */ React2.createElement(MessageAuthorName, {
|
|
141
|
+
authorName
|
|
142
|
+
}), timestamp && /* @__PURE__ */ React2.createElement(MessageTime, {
|
|
143
|
+
timestamp
|
|
144
|
+
})), children);
|
|
145
|
+
} finally {
|
|
146
|
+
_effect.f();
|
|
147
|
+
}
|
|
121
148
|
};
|
|
122
149
|
var MessageAuthorName = ({ authorName }) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
150
|
+
var _effect = _useSignals2();
|
|
151
|
+
try {
|
|
152
|
+
const { t } = useTranslation2(translationKey);
|
|
153
|
+
return /* @__PURE__ */ React2.createElement(Avatar.Label, {
|
|
154
|
+
classNames: "block truncate text-sm text-subdued"
|
|
155
|
+
}, authorName ?? t("anonymous label"));
|
|
156
|
+
} finally {
|
|
157
|
+
_effect.f();
|
|
158
|
+
}
|
|
127
159
|
};
|
|
128
160
|
var MessageTime = ({ timestamp }) => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
161
|
+
var _effect = _useSignals2();
|
|
162
|
+
try {
|
|
163
|
+
const { dtLocale } = useTranslation2(translationKey);
|
|
164
|
+
const dt = timestamp ? new Date(timestamp) : void 0;
|
|
165
|
+
return /* @__PURE__ */ React2.createElement("time", {
|
|
166
|
+
className: "block text-subdued text-xs pbe-0.5",
|
|
167
|
+
dateTime: dt?.toISOString()
|
|
168
|
+
}, dt ? formatDistanceToNow(dt, {
|
|
169
|
+
locale: dtLocale,
|
|
170
|
+
addSuffix: true
|
|
171
|
+
}) : "");
|
|
172
|
+
} finally {
|
|
173
|
+
_effect.f();
|
|
174
|
+
}
|
|
138
175
|
};
|
|
139
176
|
var MessageBody = ({ children, ...props }) => {
|
|
140
|
-
|
|
177
|
+
var _effect = _useSignals2();
|
|
178
|
+
try {
|
|
179
|
+
return /* @__PURE__ */ React2.createElement("p", props, children);
|
|
180
|
+
} finally {
|
|
181
|
+
_effect.f();
|
|
182
|
+
}
|
|
141
183
|
};
|
|
142
184
|
var keyBindings = ({ onSend, onClear }) => [
|
|
143
185
|
{
|
|
@@ -165,40 +207,45 @@ var keyBindings = ({ onSend, onClear }) => [
|
|
|
165
207
|
}
|
|
166
208
|
];
|
|
167
209
|
var MessageTextbox = ({ id, authorId, authorName, authorImgSrc, authorAvatarProps, disabled, extensions, onSend, onClear, onEditorFocus, ...editorProps }) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
210
|
+
var _effect = _useSignals2();
|
|
211
|
+
try {
|
|
212
|
+
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
213
|
+
id,
|
|
214
|
+
extensions: [
|
|
215
|
+
keymap.of(keyBindings({
|
|
216
|
+
onSend,
|
|
217
|
+
onClear
|
|
218
|
+
})),
|
|
219
|
+
listener({
|
|
220
|
+
onFocus: (focusing) => {
|
|
221
|
+
if (focusing) {
|
|
222
|
+
onEditorFocus?.();
|
|
223
|
+
}
|
|
179
224
|
}
|
|
180
|
-
}
|
|
181
|
-
|
|
225
|
+
}),
|
|
226
|
+
extensions
|
|
227
|
+
].filter(isNotFalsy),
|
|
228
|
+
...editorProps
|
|
229
|
+
}), [
|
|
230
|
+
id,
|
|
182
231
|
extensions
|
|
183
|
-
]
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
...focusAttributes
|
|
201
|
-
}));
|
|
232
|
+
]);
|
|
233
|
+
return /* @__PURE__ */ React2.createElement(MessageRoot, {
|
|
234
|
+
id,
|
|
235
|
+
authorId,
|
|
236
|
+
authorName,
|
|
237
|
+
authorImgSrc,
|
|
238
|
+
authorAvatarProps,
|
|
239
|
+
continues: false
|
|
240
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
241
|
+
role: "none",
|
|
242
|
+
ref: parentRef,
|
|
243
|
+
className: mx2("plb-0.5 mie-1 rounded-sm", focusRing, disabled && "opacity-50"),
|
|
244
|
+
...focusAttributes
|
|
245
|
+
}));
|
|
246
|
+
} finally {
|
|
247
|
+
_effect.f();
|
|
248
|
+
}
|
|
202
249
|
};
|
|
203
250
|
export {
|
|
204
251
|
MessageAuthorName,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/translations.ts", "../../../src/Thread/Thread.tsx", "../../../src/Message/Message.tsx"],
|
|
4
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 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'>> & ThreadEntity & { current?: boolean };\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 'pbs-2 pbe-4 bg-[var(--surface-bg)] border-separator first:border-bs-0 border-be',\n 'current-related attention-surface [--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 text-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(\n 'mie-2 text-description font-medium truncate italic',\n detached && 'line-through decoration-1',\n )}\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 text-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>\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.Content\n size={avatarSize}\n hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}\n fallback={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')}\n {...(authorImgSrc && { imgSrc: authorImgSrc })}\n />\n {continues && <div role='none' className='is-px grow bg-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 text-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 text-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
|
|
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,SAAqCC,kBAAkB;AAE9D,SAA+BC,sBAAsB;AACr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ACAC,YACAF,cACAG,mBACAmD,UACAC,YACAP,QACAC,SACAO,eACA,GAAGC,YAAAA,MACiB;;;AACpB,UAAM,EAAEC,WAAWC,gBAAe,IAAKC,cACrC,OAAO;MACLP;MACAE,YAAY;QACVM,OAAOC,GAAGf,YAAY;UAAEC;UAAQC;QAAQ,CAAA,CAAA;QACxCc,SAAS;UACPC,SAAS,CAACC,aAAAA;AACR,gBAAIA,UAAU;AACZT,8BAAAA;YACF;UACF;QACF,CAAA;QACAD;QACAW,OAAOC,UAAAA;MACT,GAAGV;IACL,IACA;MAACJ;MAAIE;KAAW;AAGlB,WACE,gBAAA9C,OAAA,cAACX,aAAAA;MAAkBuD;MAAIpD;MAAUC;MAAYF;MAAcG;MAAqBC,WAAW;OACzF,gBAAAK,OAAA,cAACG,OAAAA;MACCC,MAAK;MACLI,KAAKyC;MACL3C,WAAWC,IAAG,4BAA4BoD,WAAWd,YAAY,YAAA;MAChE,GAAGK;;;;;AAIZ;",
|
|
6
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", "div", "role", "data-testid", "className", "mx", "ref", "Content", "size", "hue", "hexToHue", "fallback", "emoji", "hexToEmoji", "imgSrc", "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":
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-thread/src/translations.ts":{"bytes":2281,"imports":[],"format":"esm"},"packages/ui/react-ui-thread/src/Thread/Thread.tsx":{"bytes":10042,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"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":472,"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":17570,"imports":[{"path":"@preact-signals/safe-react/tracking","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},{"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":474,"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":911,"imports":[],"format":"esm"},"packages/ui/react-ui-thread/src/index.ts":{"bytes":877,"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":14979},"packages/ui/react-ui-thread/dist/lib/browser/index.mjs":{"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"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":"@preact-signals/safe-react/tracking","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":2937},"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":4934},"packages/ui/react-ui-thread/src/Message/index.ts":{"bytesInOutput":0}},"bytes":8888}}}
|
|
@@ -1 +1 @@
|
|
|
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;AAGrG,OAAO,EAAU,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,KAAK,kBAAkB,EAAmC,MAAM,uBAAuB,CAAC;AAKjG,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,GAC1E,eAAe,GACf,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAElC,eAAO,MAAM,WAAW,sGA+BvB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAChF,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,WAAW,CAAC,CAAC;AAEpD,eAAO,MAAM,cAAc,
|
|
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;AAGrG,OAAO,EAAU,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,KAAK,kBAAkB,EAAmC,MAAM,uBAAuB,CAAC;AAKjG,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,MAAM,MAAM,gBAAgB,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-thread",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3-main.672df60",
|
|
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,10 +23,11 @@
|
|
|
23
23
|
"src"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@preact-signals/safe-react": "^0.9.0",
|
|
26
27
|
"@radix-ui/react-primitive": "2.0.2",
|
|
27
28
|
"date-fns": "^3.3.1",
|
|
28
|
-
"@dxos/react-ui-editor": "0.8.
|
|
29
|
-
"@dxos/util": "0.8.
|
|
29
|
+
"@dxos/react-ui-editor": "0.8.3-main.672df60",
|
|
30
|
+
"@dxos/util": "0.8.3-main.672df60"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -35,22 +36,22 @@
|
|
|
35
36
|
"react": "~18.2.0",
|
|
36
37
|
"react-dom": "~18.2.0",
|
|
37
38
|
"vite": "5.4.7",
|
|
38
|
-
"@dxos/echo-
|
|
39
|
-
"@dxos/keys": "0.8.
|
|
40
|
-
"@dxos/live-object": "0.8.
|
|
41
|
-
"@dxos/echo-
|
|
42
|
-
"@dxos/log": "0.8.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
39
|
+
"@dxos/echo-db": "0.8.3-main.672df60",
|
|
40
|
+
"@dxos/keys": "0.8.3-main.672df60",
|
|
41
|
+
"@dxos/live-object": "0.8.3-main.672df60",
|
|
42
|
+
"@dxos/echo-schema": "0.8.3-main.672df60",
|
|
43
|
+
"@dxos/log": "0.8.3-main.672df60",
|
|
44
|
+
"@dxos/random": "0.8.3-main.672df60",
|
|
45
|
+
"@dxos/react-ui": "0.8.3-main.672df60",
|
|
46
|
+
"@dxos/storybook-utils": "0.8.3-main.672df60",
|
|
47
|
+
"@dxos/react-ui-theme": "0.8.3-main.672df60"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"@phosphor-icons/react": "^2.1.5",
|
|
50
51
|
"react": "~18.2.0",
|
|
51
52
|
"react-dom": "~18.2.0",
|
|
52
|
-
"@dxos/react-ui": "0.8.
|
|
53
|
-
"@dxos/react-ui
|
|
53
|
+
"@dxos/react-ui-theme": "0.8.3-main.672df60",
|
|
54
|
+
"@dxos/react-ui": "0.8.3-main.672df60"
|
|
54
55
|
},
|
|
55
56
|
"publishConfig": {
|
|
56
57
|
"access": "public"
|
|
@@ -10,7 +10,7 @@ import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
10
10
|
import { createDocAccessor, createObject } from '@dxos/echo-db';
|
|
11
11
|
import { Expando } from '@dxos/echo-schema';
|
|
12
12
|
import { PublicKey } from '@dxos/keys';
|
|
13
|
-
import {
|
|
13
|
+
import { live } from '@dxos/live-object';
|
|
14
14
|
import { log } from '@dxos/log';
|
|
15
15
|
import { faker } from '@dxos/random';
|
|
16
16
|
import { Button, useThemeContext } from '@dxos/react-ui';
|
|
@@ -143,7 +143,7 @@ const StoryThread: FC<{
|
|
|
143
143
|
|
|
144
144
|
const handleCreateMessage = () => {
|
|
145
145
|
if (messageRef.current?.length) {
|
|
146
|
-
const message =
|
|
146
|
+
const message = live(Expando, {
|
|
147
147
|
timestamp: new Date().toISOString(),
|
|
148
148
|
sender: { identityKey: authorId },
|
|
149
149
|
text: messageRef.current,
|
|
@@ -233,7 +233,7 @@ type StoryProps = {
|
|
|
233
233
|
};
|
|
234
234
|
|
|
235
235
|
const Story = ({ text, autoCreate }: StoryProps) => {
|
|
236
|
-
const [item] = useState(createObject(
|
|
236
|
+
const [item] = useState(createObject(live(Expando, { content: text ?? '' })));
|
|
237
237
|
const [threads, setThreads] = useState<StoryCommentThread[]>([]);
|
|
238
238
|
const [selected, setSelected] = useState<string>();
|
|
239
239
|
|