@dxos/react-ui-thread 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0

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/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-thread",
3
- "version": "0.8.4-main.72ec0f3",
3
+ "version": "0.8.4-main.74a063c4e0",
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",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
- "sideEffects": true,
13
+ "sideEffects": false,
10
14
  "type": "module",
11
15
  "exports": {
12
16
  ".": {
@@ -24,33 +28,32 @@
24
28
  "src"
25
29
  ],
26
30
  "dependencies": {
27
- "@preact-signals/safe-react": "^0.9.0",
28
31
  "@radix-ui/react-primitive": "2.0.2",
29
- "date-fns": "^3.3.1",
30
- "@dxos/react-ui-editor": "0.8.4-main.72ec0f3",
31
- "@dxos/util": "0.8.4-main.72ec0f3"
32
+ "date-fns": "^3.6.0",
33
+ "@dxos/react-ui-editor": "0.8.4-main.74a063c4e0",
34
+ "@dxos/ui-editor": "0.8.4-main.74a063c4e0",
35
+ "@dxos/util": "0.8.4-main.74a063c4e0"
32
36
  },
33
37
  "devDependencies": {
34
- "@types/react": "~19.2.2",
35
- "@types/react-dom": "~19.2.2",
36
- "react": "~19.2.0",
37
- "react-dom": "~19.2.0",
38
- "vite": "7.1.9",
39
- "@dxos/echo": "0.8.4-main.72ec0f3",
40
- "@dxos/live-object": "0.8.4-main.72ec0f3",
41
- "@dxos/keys": "0.8.4-main.72ec0f3",
42
- "@dxos/log": "0.8.4-main.72ec0f3",
43
- "@dxos/random": "0.8.4-main.72ec0f3",
44
- "@dxos/react-ui": "0.8.4-main.72ec0f3",
45
- "@dxos/react-ui-theme": "0.8.4-main.72ec0f3",
46
- "@dxos/echo-db": "0.8.4-main.72ec0f3",
47
- "@dxos/storybook-utils": "0.8.4-main.72ec0f3"
38
+ "@types/react": "~19.2.7",
39
+ "@types/react-dom": "~19.2.3",
40
+ "react": "~19.2.3",
41
+ "react-dom": "~19.2.3",
42
+ "vite": "^7.1.11",
43
+ "@dxos/echo": "0.8.4-main.74a063c4e0",
44
+ "@dxos/keys": "0.8.4-main.74a063c4e0",
45
+ "@dxos/log": "0.8.4-main.74a063c4e0",
46
+ "@dxos/echo-db": "0.8.4-main.74a063c4e0",
47
+ "@dxos/random": "0.8.4-main.74a063c4e0",
48
+ "@dxos/react-ui": "0.8.4-main.74a063c4e0",
49
+ "@dxos/storybook-utils": "0.8.4-main.74a063c4e0",
50
+ "@dxos/ui-theme": "0.8.4-main.74a063c4e0"
48
51
  },
49
52
  "peerDependencies": {
50
- "react": "^19.0.0",
51
- "react-dom": "^19.0.0",
52
- "@dxos/react-ui": "0.8.4-main.72ec0f3",
53
- "@dxos/react-ui-theme": "0.8.4-main.72ec0f3"
53
+ "react": "~19.2.3",
54
+ "react-dom": "~19.2.3",
55
+ "@dxos/react-ui": "0.8.4-main.74a063c4e0",
56
+ "@dxos/ui-theme": "0.8.4-main.74a063c4e0"
54
57
  },
55
58
  "publishConfig": {
56
59
  "access": "public"
@@ -6,13 +6,12 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useState } from 'react';
7
7
 
8
8
  import { PublicKey } from '@dxos/keys';
9
- import { withTheme } from '@dxos/react-ui/testing';
10
- import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
9
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
+ import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
11
11
 
12
12
  import { type MessageEntity, MessageStoryText } from '../testing';
13
13
  import { Thread } from '../Thread';
14
14
  import { translations } from '../translations';
15
-
16
15
  import { MessageRoot } from './Message';
17
16
 
18
17
  const DefaultStory = () => {
@@ -25,7 +24,7 @@ const DefaultStory = () => {
25
24
  });
26
25
 
27
26
  return (
28
- <div className='mli-auto is-96 overflow-y-auto'>
27
+ <div className='mx-auto w-96 overflow-y-auto'>
29
28
  <Thread.Root id='t1'>
30
29
  <MessageRoot {...message} classNames={[hoverableControls, hoverableFocusedWithinControls]}>
31
30
  <MessageStoryText {...message} onDelete={() => console.log('delete')} />
@@ -39,7 +38,7 @@ const meta = {
39
38
  title: 'ui/react-ui-thread/Message',
40
39
  component: MessageRoot as any,
41
40
  render: DefaultStory,
42
- decorators: [withTheme],
41
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
43
42
  parameters: {
44
43
  layout: 'fullscreen',
45
44
  translations,
@@ -5,10 +5,10 @@
5
5
  import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';
6
6
  import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';
7
7
 
8
- // TODO(burdon): Remove dep.
9
8
  import { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';
10
- import { type UseTextEditorProps, keymap, listener, useTextEditor } from '@dxos/react-ui-editor';
11
- import { focusRing, mx } from '@dxos/react-ui-theme';
9
+ import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
10
+ import { keymap, listener } from '@dxos/ui-editor';
11
+ import { mx } from '@dxos/ui-theme';
12
12
  import { hexToEmoji, hexToHue, isTruthy } from '@dxos/util';
13
13
 
14
14
  import { translationKey } from '../translations';
@@ -16,9 +16,9 @@ import { type MessageMetadata } from '../types';
16
16
 
17
17
  const avatarSize = 7;
18
18
 
19
- export type MessageRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> &
20
- MessageMetadata &
21
- Partial<{ continues: boolean }>;
19
+ export type MessageRootProps = ThemedClassName<
20
+ ComponentPropsWithRef<'div'> & MessageMetadata & Partial<{ continues: boolean }>
21
+ >;
22
22
 
23
23
  // TODO(burdon): Show authorName on tooltip.
24
24
  export const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(
@@ -36,16 +36,16 @@ export const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(
36
36
  className={mx('grid grid-cols-subgrid col-span-2', classNames)}
37
37
  ref={forwardedRef}
38
38
  >
39
- <div role='none' className='flex flex-col items-center gap-2 pbs-1'>
39
+ <div role='none' className='flex flex-col items-center gap-2 pt-1'>
40
40
  <Avatar.Content
41
41
  size={avatarSize}
42
42
  hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}
43
43
  fallback={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')}
44
44
  {...(authorImgSrc && { imgSrc: authorImgSrc })}
45
45
  />
46
- {continues && <div role='none' className='is-px grow bg-separator' />}
46
+ {continues && <div role='none' className='w-px grow bg-separator' />}
47
47
  </div>
48
- <div role='none' className='plb-1 min-is-0'>
48
+ <div role='none' className='py-1 min-w-0'>
49
49
  {children}
50
50
  </div>
51
51
  </div>
@@ -74,7 +74,7 @@ export type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;
74
74
  export const MessageAuthorName = ({ authorName }: MessageAuthorNameProps) => {
75
75
  const { t } = useTranslation(translationKey);
76
76
  return (
77
- <Avatar.Label classNames='block truncate text-sm text-subdued'>{authorName ?? t('anonymous label')}</Avatar.Label>
77
+ <Avatar.Label classNames='block truncate text-sm text-subdued'>{authorName ?? t('anonymous.label')}</Avatar.Label>
78
78
  );
79
79
  };
80
80
 
@@ -84,7 +84,7 @@ export const MessageTime = ({ timestamp }: MessageTimeProps) => {
84
84
  const { dtLocale } = useTranslation(translationKey);
85
85
  const dt = timestamp ? new Date(timestamp) : undefined;
86
86
  return (
87
- <time className='block text-subdued text-xs pbe-0.5' dateTime={dt?.toISOString()}>
87
+ <time className='block text-subdued text-xs pb-0.5' dateTime={dt?.toISOString()}>
88
88
  {dt ? formatDistanceToNow(dt, { locale: dtLocale, addSuffix: true }) : ''}
89
89
  </time>
90
90
  );
@@ -167,7 +167,7 @@ export const MessageTextbox = ({
167
167
  <div
168
168
  role='none'
169
169
  ref={parentRef}
170
- className={mx('plb-0.5 mie-1 rounded-sm', focusRing, disabled && 'opacity-50')}
170
+ className={mx('py-0.5 me-1 rounded-xs dx-focus-ring', disabled && 'opacity-50')}
171
171
  {...focusAttributes}
172
172
  />
173
173
  </MessageRoot>
@@ -5,46 +5,63 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
7
7
 
8
- import { Expando } from '@dxos/echo/internal';
9
- import { live } from '@dxos/echo/internal';
10
- import { createDocAccessor, createObject } from '@dxos/echo-db';
8
+ import { Obj } from '@dxos/echo';
9
+ import { TestSchema } from '@dxos/echo/testing';
11
10
  import { PublicKey } from '@dxos/keys';
12
11
  import { log } from '@dxos/log';
13
- import { faker } from '@dxos/random';
12
+ import { random } from '@dxos/random';
14
13
  import { Icon, IconButton, useThemeContext } from '@dxos/react-ui';
15
- import { withTheme } from '@dxos/react-ui/testing';
14
+ import { useTextEditor } from '@dxos/react-ui-editor';
15
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
16
16
  import {
17
17
  type Comment,
18
18
  type CommentsOptions,
19
+ type EditorView,
19
20
  type Range,
20
- automerge,
21
21
  comments,
22
22
  createBasicExtensions,
23
23
  createThemeExtensions,
24
+ documentId,
24
25
  listener,
25
26
  scrollThreadIntoView,
26
- useComments,
27
- useTextEditor,
28
- } from '@dxos/react-ui-editor';
29
- import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
27
+ setComments,
28
+ } from '@dxos/ui-editor';
29
+ import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
30
30
 
31
31
  import { MessageBody, MessageHeading, MessageRoot, MessageTextbox } from '../Message';
32
32
  import { type MessageEntity } from '../testing';
33
33
  import { translations } from '../translations';
34
-
35
34
  import { Thread } from './Thread';
36
35
 
37
- faker.seed(101);
36
+ random.seed(101);
38
37
 
39
38
  const authorId = PublicKey.random().toHex();
40
39
 
40
+ /**
41
+ * @deprecated This hook will be removed in future versions. Use the new comment sync extension instead.
42
+ * Update comments state field.
43
+ */
44
+ const useComments = (view: EditorView | null | undefined, id: string, comments?: Comment[]) => {
45
+ useEffect(() => {
46
+ if (view) {
47
+ // Check same document.
48
+ // NOTE: Hook might be called before editor state is updated.
49
+ if (id === view.state.facet(documentId)) {
50
+ view.dispatch({
51
+ effects: setComments.of({ id, comments: comments ?? [] }),
52
+ });
53
+ }
54
+ }
55
+ });
56
+ };
57
+
41
58
  //
42
59
  // Editor
43
60
  //
44
61
 
45
62
  const Editor: FC<{
46
63
  id?: string;
47
- item: Expando;
64
+ initialValue: string;
48
65
  comments: Comment[];
49
66
  selected?: string;
50
67
  onCreateComment: CommentsOptions['onCreate'];
@@ -53,7 +70,7 @@ const Editor: FC<{
53
70
  onSelectComment: CommentsOptions['onSelect'];
54
71
  }> = ({
55
72
  id = 'test',
56
- item,
73
+ initialValue,
57
74
  selected: selectedValue,
58
75
  comments: commentRanges,
59
76
  onCreateComment,
@@ -67,11 +84,10 @@ const Editor: FC<{
67
84
  const { parentRef, view } = useTextEditor(
68
85
  () => ({
69
86
  id,
70
- initialValue: item.content,
87
+ initialValue: initialValue,
71
88
  extensions: [
72
89
  createBasicExtensions(),
73
90
  createThemeExtensions({ themeMode }),
74
- automerge(createDocAccessor(item, ['content'])),
75
91
  comments({
76
92
  id,
77
93
  onCreate: onCreateComment,
@@ -81,7 +97,7 @@ const Editor: FC<{
81
97
  }),
82
98
  ],
83
99
  }),
84
- [id, item, themeMode],
100
+ [id, initialValue, themeMode],
85
101
  );
86
102
  useComments(view, id, commentRanges);
87
103
  useEffect(() => {
@@ -144,7 +160,7 @@ const StoryThread: FC<{
144
160
 
145
161
  const handleCreateMessage = () => {
146
162
  if (messageRef.current?.length) {
147
- const message = live(Expando, {
163
+ const message = Obj.make(TestSchema.Expando, {
148
164
  timestamp: new Date().toISOString(),
149
165
  sender: { identityKey: authorId },
150
166
  text: messageRef.current,
@@ -191,7 +207,7 @@ const StoryThread: FC<{
191
207
  variant='ghost'
192
208
  icon='ph--check--regular'
193
209
  iconOnly
194
- classNames='pli-1'
210
+ classNames='px-1'
195
211
  label='Resolve'
196
212
  onClick={onResolve}
197
213
  />
@@ -200,12 +216,14 @@ const StoryThread: FC<{
200
216
  );
201
217
  };
202
218
 
203
- const Sidebar: FC<{
219
+ type SidebarProps = {
204
220
  threads: StoryCommentThread[];
205
221
  selected?: string;
206
222
  onSelect: (thread: string) => void;
207
223
  onResolve: (thread: string) => void;
208
- }> = ({ threads, selected, onSelect, onResolve }) => {
224
+ };
225
+
226
+ const Sidebar = ({ threads, selected, onSelect, onResolve }: SidebarProps) => {
209
227
  // Sort by y-position.
210
228
  const sortedThreads = useMemo(() => {
211
229
  const sorted = [...threads];
@@ -233,13 +251,13 @@ const Sidebar: FC<{
233
251
  // Story container.
234
252
  //
235
253
 
236
- type StoryProps = {
254
+ type DefaultStoryProps = {
237
255
  text?: string;
238
256
  autoCreate?: boolean;
239
257
  };
240
258
 
241
- const DefaultStory = ({ text, autoCreate }: StoryProps) => {
242
- const [item] = useState(createObject(live(Expando, { content: text ?? '' })));
259
+ const DefaultStory = ({ text, autoCreate }: DefaultStoryProps) => {
260
+ const [item] = useState(() => Obj.make(TestSchema.Expando, { content: text ?? '' }));
243
261
  const [threads, setThreads] = useState<StoryCommentThread[]>([]);
244
262
  const [selected, setSelected] = useState<string>();
245
263
 
@@ -258,12 +276,12 @@ const DefaultStory = ({ text, autoCreate }: StoryProps) => {
258
276
  cursor,
259
277
  yPos: location ? Math.floor(location.top) : undefined,
260
278
  messages: autoCreate
261
- ? faker.helpers.multiple(
279
+ ? random.helpers.multiple(
262
280
  () => ({
263
281
  id: PublicKey.random().toHex(),
264
282
  timestamp: new Date().toISOString(),
265
283
  authorId: PublicKey.random().toHex(),
266
- text: faker.lorem.sentence(),
284
+ text: random.lorem.sentence(),
267
285
  }),
268
286
  { count: { min: 1, max: 3 } },
269
287
  )
@@ -331,9 +349,9 @@ const DefaultStory = ({ text, autoCreate }: StoryProps) => {
331
349
 
332
350
  return (
333
351
  <main className='fixed inset-0 grid grid-cols-[1fr_24rem]'>
334
- <div role='none' className='max-bs-full overflow-y-auto p-4'>
352
+ <div role='none' className='max-h-full overflow-y-auto p-4'>
335
353
  <Editor
336
- item={item}
354
+ initialValue={item.content}
337
355
  selected={selected}
338
356
  comments={comments}
339
357
  onCreateComment={handleCreateComment}
@@ -343,7 +361,7 @@ const DefaultStory = ({ text, autoCreate }: StoryProps) => {
343
361
  />
344
362
  </div>
345
363
 
346
- <div role='none' className='max-bs-full overflow-y-auto p-4'>
364
+ <div role='none' className='max-h-full overflow-y-auto p-4'>
347
365
  <Sidebar
348
366
  threads={visibleThreads}
349
367
  selected={selected}
@@ -359,7 +377,7 @@ const meta = {
359
377
  title: 'ui/react-ui-thread/Comments',
360
378
  component: StoryThread as any,
361
379
  render: DefaultStory,
362
- decorators: [withTheme],
380
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
363
381
  parameters: {
364
382
  translations,
365
383
  layout: 'fullscreen',
@@ -377,7 +395,7 @@ export const Default: Story = {
377
395
  text: str(
378
396
  '# Comments',
379
397
  '',
380
- str(...faker.helpers.multiple(() => [faker.lorem.paragraph({ min: 5, max: 10 }), ''], { count: 20 }).flat()),
398
+ str(...random.helpers.multiple(() => [random.lorem.paragraph({ min: 5, max: 10 }), ''], { count: 20 }).flat()),
381
399
  '',
382
400
  ),
383
401
  },
@@ -6,18 +6,17 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useMemo, useRef, useState } from 'react';
7
7
 
8
8
  import { PublicKey } from '@dxos/keys';
9
- import { faker } from '@dxos/random';
10
- import { withTheme } from '@dxos/react-ui/testing';
11
- import { createBasicExtensions, createThemeExtensions } from '@dxos/react-ui-editor';
12
- import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
9
+ import { random } from '@dxos/random';
10
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
11
+ import { createBasicExtensions, createThemeExtensions } from '@dxos/ui-editor';
12
+ import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
13
13
 
14
14
  import { MessageRoot, MessageTextbox } from '../Message';
15
15
  import { type MessageEntity, MessageStoryText } from '../testing';
16
16
  import { translations } from '../translations';
17
-
18
17
  import { Thread } from './Thread';
19
18
 
20
- faker.seed(1);
19
+ random.seed(1);
21
20
 
22
21
  const DefaultStory = () => {
23
22
  const [pending, setPending] = useState(false);
@@ -28,7 +27,7 @@ const DefaultStory = () => {
28
27
  id: `m${i + 1}`,
29
28
  timestamp: new Date().toISOString(),
30
29
  authorId: [identityKey1.toHex(), identityKey2.toHex()][i % 2],
31
- text: faker.lorem.paragraph(),
30
+ text: random.lorem.paragraph(),
32
31
  })),
33
32
  );
34
33
 
@@ -59,7 +58,7 @@ const DefaultStory = () => {
59
58
  };
60
59
 
61
60
  return (
62
- <div className='mli-auto is-96 overflow-y-auto'>
61
+ <div className='mx-auto w-96 overflow-y-auto'>
63
62
  <Thread.Root id='t1'>
64
63
  {messages.map((message) => (
65
64
  <MessageRoot key={message.id} classNames={[hoverableControls, hoverableFocusedWithinControls]} {...message}>
@@ -85,7 +84,7 @@ const meta = {
85
84
  title: 'ui/react-ui-thread/Thread',
86
85
  component: Thread.Root,
87
86
  render: DefaultStory,
88
- decorators: [withTheme],
87
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
89
88
  parameters: {
90
89
  layout: 'fullscreen',
91
90
  translations,
@@ -2,22 +2,26 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { type ComponentPropsWithRef, forwardRef } from 'react';
5
+ import React, { ComponentPropsWithRef, forwardRef, PropsWithChildren } from 'react';
6
6
 
7
7
  import { Icon, type ThemedClassName, useTranslation } from '@dxos/react-ui';
8
- import { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/react-ui-theme';
8
+ import { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';
9
9
 
10
10
  import { translationKey } from '../translations';
11
11
  import type { ThreadEntity } from '../types';
12
12
 
13
- // TODO(burdon): Why is this exported?
14
- export const threadLayout = 'is-full place-self-start grid grid-cols-[var(--rail-size)_1fr]';
13
+ // TODO(burdon): Avoid exporting fragments.
14
+ export const threadLayout = 'w-full place-self-start grid grid-cols-[var(--dx-rail-size)_1fr]';
15
15
 
16
16
  //
17
17
  // Root
18
18
  //
19
19
 
20
- type ThreadRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & ThreadEntity & { current?: boolean };
20
+ type ThreadRootProps = ThemedClassName<
21
+ PropsWithChildren<
22
+ ThreadEntity & { current?: boolean } & Pick<ComponentPropsWithRef<'div'>, 'onClickCapture' | 'onFocusCapture'>
23
+ >
24
+ >;
21
25
 
22
26
  const ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(
23
27
  ({ current, children, classNames, ...props }, forwardedRef) => {
@@ -30,7 +34,7 @@ const ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(
30
34
  className={mx(
31
35
  threadLayout,
32
36
  hoverableFocusedWithinControls,
33
- 'bg-[var(--surface-bg)] current-related attention-surface [--controls-opacity:0]',
37
+ 'bg-[var(--surface-bg)] current-related dx-attention-surface [--controls-opacity:0]',
34
38
  classNames,
35
39
  )}
36
40
  ref={forwardedRef}
@@ -45,7 +49,7 @@ const ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(
45
49
  // Heading
46
50
  //
47
51
 
48
- type ThreadHeaderProps = ComponentPropsWithRef<'div'> & { detached?: boolean };
52
+ type ThreadHeaderProps = PropsWithChildren<{ detached?: boolean }>;
49
53
 
50
54
  const ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(
51
55
  ({ children, detached, ...props }, forwardedRef) => {
@@ -59,10 +63,7 @@ const ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(
59
63
  role='heading'
60
64
  data-testid='thread.heading'
61
65
  {...props}
62
- className={mx(
63
- 'mie-2 text-description font-medium truncate italic',
64
- detached && 'line-through decoration-1',
65
- )}
66
+ className={mx('me-2 text-description font-medium truncate italic', detached && 'line-through decoration-1')}
66
67
  ref={forwardedRef}
67
68
  >
68
69
  {children}
@@ -77,7 +78,7 @@ const ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(
77
78
  // Status
78
79
  //
79
80
 
80
- type ThreadStatusProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
81
+ type ThreadStatusProps = ThemedClassName<PropsWithChildren> & {
81
82
  activity?: boolean;
82
83
  };
83
84
 
@@ -88,20 +89,20 @@ const ThreadStatus = forwardRef<HTMLDivElement, ThreadStatusProps>(
88
89
  <div
89
90
  {...props}
90
91
  className={mx(
91
- 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pie-2 text-xs text-description',
92
+ 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pe-2 text-xs text-description',
92
93
  classNames,
93
94
  )}
94
95
  ref={forwardedRef}
95
96
  >
96
97
  <Icon
97
98
  icon='ph--spinner--bold'
98
- classNames='is-6 bs-4 invisible data-[visible=show]:visible animate-spin-slow'
99
+ classNames='w-6 h-4 invisible data-[visible=show]:visible animate-spin-slow'
99
100
  data-visible={activity ? 'show' : 'hide'}
100
101
  />
101
- <span className='truncate min-is-0' aria-live='polite'>
102
+ <span className='truncate min-w-0' aria-live='polite'>
102
103
  {activity ? children : null}
103
104
  </span>
104
- <span className={mx('text-end', hoverableControlItem)}>{t('enter to send message')}</span>
105
+ <span className={mx('text-end', hoverableControlItem)}>{t('enter-to-send.message')}</span>
105
106
  </div>
106
107
  );
107
108
  },
@@ -113,4 +114,4 @@ export const Thread = {
113
114
  Status: ThreadStatus,
114
115
  };
115
116
 
116
- export type { ThreadRootProps, ThreadHeaderProps as ThreadHeadingProps, ThreadStatusProps };
117
+ export type { ThreadRootProps, ThreadHeaderProps, ThreadStatusProps };
package/src/testing.tsx CHANGED
@@ -5,7 +5,7 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { IconButton } from '@dxos/react-ui';
8
- import { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/react-ui-theme';
8
+ import { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';
9
9
 
10
10
  import { MessageBody, MessageHeading } from './Message';
11
11
  import { type MessageMetadata } from './types';
@@ -30,7 +30,7 @@ export const MessageStoryText = ({ text, onDelete, authorName, timestamp }: Mess
30
30
  iconOnly
31
31
  label='Delete'
32
32
  variant='ghost'
33
- classNames={['p-1.5 min-bs-0 mie-1 items-start transition-opacity', hoverableControlItem]}
33
+ classNames={['p-1.5 min-h-0 me-1 items-start transition-opacity', hoverableControlItem]}
34
34
  onClick={() => onDelete()}
35
35
  />
36
36
  )}
@@ -50,7 +50,7 @@ export const MessageStoryBlock = <PartValue,>({ part }: MessagePartProps<PartVal
50
50
  role='none'
51
51
  className={mx('grid grid-cols-subgrid col-span-3', hoverableControls, hoverableFocusedWithinControls)}
52
52
  >
53
- <pre className='font-mono max-is-full overflow-x-auto col-span-3'>
53
+ <pre className='font-mono max-w-full overflow-x-auto col-span-3'>
54
54
  <code>{JSON.stringify(part, undefined, 2)}</code>
55
55
  </pre>
56
56
  </div>
@@ -4,22 +4,22 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- export const translationKey = 'react-ui-thread';
7
+ export const translationKey = '@dxos/react-ui-thread';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [translationKey]: {
13
- 'plugin name': 'Threads',
14
- 'thread title placeholder': 'New thread',
15
- 'thread title label': 'Title',
16
- 'delete thread label': 'Delete',
17
- 'create thread label': 'Create thread',
18
- 'message placeholder': 'Enter message...',
19
- 'comment placeholder': 'Enter comment...',
20
- 'settings standalone label': 'Enable standalone thread creation',
21
- 'anonymous label': 'Anonymous',
22
- 'enter to send message': 'Enter to add ⏎',
13
+ 'plugin.name': 'Threads',
14
+ 'thread-title.placeholder': 'New thread',
15
+ 'thread-title.label': 'Title',
16
+ 'delete-thread.label': 'Delete',
17
+ 'create-thread.label': 'Create thread',
18
+ 'message.placeholder': 'Enter message...',
19
+ 'comment.placeholder': 'Enter comment...',
20
+ 'settings-standalone.label': 'Enable standalone thread creation',
21
+ 'anonymous.label': 'Anonymous',
22
+ 'enter-to-send.message': 'Enter to add ⏎',
23
23
  },
24
24
  },
25
25
  },
package/src/types.ts CHANGED
@@ -16,6 +16,7 @@ export type MessageMetadata = {
16
16
  };
17
17
 
18
18
  export type ThreadEntity = {
19
+ id?: string;
19
20
  topicId?: string;
20
21
  topicTitle?: string;
21
22
  };