@dxos/react-ui-thread 0.8.4-main.c1de068 → 0.8.4-main.e098934
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 +3 -3
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/Message/Message.d.ts.map +1 -1
- package/dist/types/src/Message/Message.stories.d.ts +6 -4
- package/dist/types/src/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Comments.stories.d.ts +7 -23
- package/dist/types/src/Thread/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.stories.d.ts +28 -4
- package/dist/types/src/Thread/Thread.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -15
- package/src/Message/Message.stories.tsx +12 -6
- package/src/Message/Message.tsx +3 -2
- package/src/Thread/Comments.stories.tsx +13 -7
- package/src/Thread/Thread.stories.tsx +10 -6
- package/src/Thread/Thread.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-thread",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.e098934",
|
|
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",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
16
|
}
|
|
@@ -26,30 +27,30 @@
|
|
|
26
27
|
"@preact-signals/safe-react": "^0.9.0",
|
|
27
28
|
"@radix-ui/react-primitive": "2.0.2",
|
|
28
29
|
"date-fns": "^3.3.1",
|
|
29
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
30
|
-
"@dxos/util": "0.8.4-main.
|
|
30
|
+
"@dxos/react-ui-editor": "0.8.4-main.e098934",
|
|
31
|
+
"@dxos/util": "0.8.4-main.e098934"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/react": "~18.2.0",
|
|
34
35
|
"@types/react-dom": "~18.2.0",
|
|
35
36
|
"react": "~18.2.0",
|
|
36
37
|
"react-dom": "~18.2.0",
|
|
37
|
-
"vite": "
|
|
38
|
-
"@dxos/echo-
|
|
39
|
-
"@dxos/echo-
|
|
40
|
-
"@dxos/keys": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/random": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
45
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
46
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
38
|
+
"vite": "7.1.1",
|
|
39
|
+
"@dxos/echo-db": "0.8.4-main.e098934",
|
|
40
|
+
"@dxos/echo-schema": "0.8.4-main.e098934",
|
|
41
|
+
"@dxos/keys": "0.8.4-main.e098934",
|
|
42
|
+
"@dxos/log": "0.8.4-main.e098934",
|
|
43
|
+
"@dxos/random": "0.8.4-main.e098934",
|
|
44
|
+
"@dxos/live-object": "0.8.4-main.e098934",
|
|
45
|
+
"@dxos/react-ui": "0.8.4-main.e098934",
|
|
46
|
+
"@dxos/react-ui-theme": "0.8.4-main.e098934",
|
|
47
|
+
"@dxos/storybook-utils": "0.8.4-main.e098934"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"react": "~18.2.0",
|
|
50
51
|
"react-dom": "~18.2.0",
|
|
51
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
52
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
52
|
+
"@dxos/react-ui": "0.8.4-main.e098934",
|
|
53
|
+
"@dxos/react-ui-theme": "0.8.4-main.e098934"
|
|
53
54
|
},
|
|
54
55
|
"publishConfig": {
|
|
55
56
|
"access": "public"
|
|
@@ -4,17 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React, { useState } from 'react';
|
|
8
9
|
|
|
9
10
|
import { PublicKey } from '@dxos/keys';
|
|
10
11
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
11
12
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
14
15
|
import { Thread } from '../Thread';
|
|
15
|
-
import { MessageStoryText, type MessageEntity } from '../testing';
|
|
16
16
|
import { translations } from '../translations';
|
|
17
17
|
|
|
18
|
+
import { MessageRoot } from './Message';
|
|
19
|
+
|
|
18
20
|
const DefaultStory = () => {
|
|
19
21
|
const [identityKey] = useState(PublicKey.random());
|
|
20
22
|
const [message] = useState<MessageEntity>({
|
|
@@ -35,12 +37,16 @@ const DefaultStory = () => {
|
|
|
35
37
|
);
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
const meta = {
|
|
39
41
|
title: 'ui/react-ui-thread/Message',
|
|
40
|
-
component: MessageRoot,
|
|
42
|
+
component: MessageRoot as any,
|
|
41
43
|
render: DefaultStory,
|
|
42
44
|
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
43
45
|
parameters: { translations },
|
|
44
|
-
}
|
|
46
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
47
|
+
|
|
48
|
+
export default meta;
|
|
49
|
+
|
|
50
|
+
type Story = StoryObj<typeof meta>;
|
|
45
51
|
|
|
46
|
-
export const Default = {};
|
|
52
|
+
export const Default: Story = {};
|
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,
|
|
6
|
+
import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';
|
|
7
7
|
|
|
8
8
|
// TODO(burdon): Remove dep.
|
|
9
9
|
import { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
@@ -20,6 +20,7 @@ export type MessageRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> &
|
|
|
20
20
|
MessageMetadata &
|
|
21
21
|
Partial<{ continues: boolean }>;
|
|
22
22
|
|
|
23
|
+
// TODO(burdon): Show authorName on tooltip.
|
|
23
24
|
export const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(
|
|
24
25
|
(
|
|
25
26
|
{ authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps },
|
|
@@ -35,7 +36,7 @@ export const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(
|
|
|
35
36
|
className={mx('grid grid-cols-subgrid col-span-2', classNames)}
|
|
36
37
|
ref={forwardedRef}
|
|
37
38
|
>
|
|
38
|
-
<div role='none' className='flex flex-col items-center gap-2 pbs-
|
|
39
|
+
<div role='none' className='flex flex-col items-center gap-2 pbs-1'>
|
|
39
40
|
<Avatar.Content
|
|
40
41
|
size={avatarSize}
|
|
41
42
|
hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
9
|
|
|
9
10
|
import { createDocAccessor, createObject } from '@dxos/echo-db';
|
|
@@ -29,11 +30,12 @@ import {
|
|
|
29
30
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
30
31
|
import { withTheme } from '@dxos/storybook-utils';
|
|
31
32
|
|
|
32
|
-
import { Thread } from './Thread';
|
|
33
33
|
import { MessageBody, MessageHeading, MessageRoot, MessageTextbox } from '../Message';
|
|
34
34
|
import { type MessageEntity } from '../testing';
|
|
35
35
|
import { translations } from '../translations';
|
|
36
36
|
|
|
37
|
+
import { Thread } from './Thread';
|
|
38
|
+
|
|
37
39
|
faker.seed(101);
|
|
38
40
|
|
|
39
41
|
const authorId = PublicKey.random().toHex();
|
|
@@ -231,7 +233,7 @@ type StoryProps = {
|
|
|
231
233
|
autoCreate?: boolean;
|
|
232
234
|
};
|
|
233
235
|
|
|
234
|
-
const
|
|
236
|
+
const DefaultStory = ({ text, autoCreate }: StoryProps) => {
|
|
235
237
|
const [item] = useState(createObject(live(Expando, { content: text ?? '' })));
|
|
236
238
|
const [threads, setThreads] = useState<StoryCommentThread[]>([]);
|
|
237
239
|
const [selected, setSelected] = useState<string>();
|
|
@@ -348,17 +350,21 @@ const Story = ({ text, autoCreate }: StoryProps) => {
|
|
|
348
350
|
);
|
|
349
351
|
};
|
|
350
352
|
|
|
351
|
-
|
|
353
|
+
const meta = {
|
|
352
354
|
title: 'ui/react-ui-thread/Comments',
|
|
353
|
-
component: StoryThread,
|
|
355
|
+
component: StoryThread as any,
|
|
356
|
+
render: DefaultStory,
|
|
354
357
|
decorators: [withTheme],
|
|
355
|
-
render: (args: StoryProps) => <Story {...args} />,
|
|
356
358
|
parameters: { translations, layout: 'fullscreen' },
|
|
357
|
-
}
|
|
359
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
360
|
+
|
|
361
|
+
export default meta;
|
|
362
|
+
|
|
363
|
+
type Story = StoryObj<typeof meta>;
|
|
358
364
|
|
|
359
365
|
const str = (...lines: string[]) => lines.join('\n');
|
|
360
366
|
|
|
361
|
-
export const Default = {
|
|
367
|
+
export const Default: Story = {
|
|
362
368
|
args: {
|
|
363
369
|
text: str(
|
|
364
370
|
'# Comments',
|
|
@@ -4,19 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React, { useMemo, useRef, useState } from 'react';
|
|
8
9
|
|
|
9
10
|
import { PublicKey } from '@dxos/keys';
|
|
10
11
|
import { faker } from '@dxos/random';
|
|
11
12
|
import { createBasicExtensions, createThemeExtensions } from '@dxos/react-ui-editor';
|
|
12
13
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
13
|
-
import {
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
15
|
|
|
15
|
-
import { Thread } from './Thread';
|
|
16
16
|
import { MessageRoot, MessageTextbox } from '../Message';
|
|
17
|
-
import {
|
|
17
|
+
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
18
18
|
import { translations } from '../translations';
|
|
19
19
|
|
|
20
|
+
import { Thread } from './Thread';
|
|
21
|
+
|
|
20
22
|
faker.seed(1);
|
|
21
23
|
|
|
22
24
|
const DefaultStory = () => {
|
|
@@ -81,14 +83,16 @@ const DefaultStory = () => {
|
|
|
81
83
|
);
|
|
82
84
|
};
|
|
83
85
|
|
|
84
|
-
const meta
|
|
86
|
+
const meta = {
|
|
85
87
|
title: 'ui/react-ui-thread/Thread',
|
|
86
88
|
component: Thread.Root,
|
|
87
89
|
render: DefaultStory,
|
|
88
90
|
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
89
91
|
parameters: { translations },
|
|
90
|
-
}
|
|
92
|
+
} satisfies Meta<typeof Thread.Root>;
|
|
91
93
|
|
|
92
94
|
export default meta;
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
type Story = StoryObj<typeof meta>;
|
|
97
|
+
|
|
98
|
+
export const Default: Story = {};
|
package/src/Thread/Thread.tsx
CHANGED
|
@@ -95,8 +95,8 @@ const ThreadStatus = forwardRef<HTMLDivElement, ThreadStatusProps>(
|
|
|
95
95
|
>
|
|
96
96
|
<Icon
|
|
97
97
|
icon='ph--spinner--bold'
|
|
98
|
-
data-visible={activity ? 'show' : 'hide'}
|
|
99
98
|
classNames='is-6 bs-4 invisible data-[visible=show]:visible animate-spin-slow'
|
|
99
|
+
data-visible={activity ? 'show' : 'hide'}
|
|
100
100
|
/>
|
|
101
101
|
<span className='truncate min-is-0' aria-live='polite'>
|
|
102
102
|
{activity ? children : null}
|