@dxos/react-ui-thread 0.8.4-main.74a063c4e0 → 0.8.4-main.765dc60934
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +24 -55
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +25 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/Message/Message.d.ts.map +1 -1
- package/dist/types/src/Message/Message.stories.d.ts +10 -10
- package/dist/types/src/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Comments.stories.d.ts +10 -10
- package/dist/types/src/Thread/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.d.ts +1 -1
- package/dist/types/src/Thread/Thread.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.stories.d.ts +10 -10
- package/dist/types/src/Thread/Thread.stories.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -19
- package/src/Message/Message.stories.tsx +2 -1
- package/src/Message/Message.tsx +7 -10
- package/src/Thread/Comments.stories.tsx +5 -5
- package/src/Thread/Thread.stories.tsx +2 -1
- package/src/Thread/Thread.tsx +4 -3
- package/src/index.ts +0 -3
- package/src/testing.tsx +1 -4
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.765dc60934",
|
|
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",
|
|
@@ -8,21 +8,27 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#translations": "./src/translations.ts"
|
|
17
|
+
},
|
|
15
18
|
"exports": {
|
|
16
19
|
".": {
|
|
17
20
|
"source": "./src/index.ts",
|
|
18
21
|
"types": "./dist/types/src/index.d.ts",
|
|
19
22
|
"browser": "./dist/lib/browser/index.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./translations": {
|
|
25
|
+
"source": "./src/translations.ts",
|
|
26
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
27
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
28
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
20
29
|
}
|
|
21
30
|
},
|
|
22
31
|
"types": "dist/types/src/index.d.ts",
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"*": {}
|
|
25
|
-
},
|
|
26
32
|
"files": [
|
|
27
33
|
"dist",
|
|
28
34
|
"src"
|
|
@@ -30,30 +36,30 @@
|
|
|
30
36
|
"dependencies": {
|
|
31
37
|
"@radix-ui/react-primitive": "2.0.2",
|
|
32
38
|
"date-fns": "^3.6.0",
|
|
33
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
34
|
-
"@dxos/ui-editor": "0.8.4-main.
|
|
35
|
-
"@dxos/util": "0.8.4-main.
|
|
39
|
+
"@dxos/react-ui-editor": "0.8.4-main.765dc60934",
|
|
40
|
+
"@dxos/ui-editor": "0.8.4-main.765dc60934",
|
|
41
|
+
"@dxos/util": "0.8.4-main.765dc60934"
|
|
36
42
|
},
|
|
37
43
|
"devDependencies": {
|
|
38
44
|
"@types/react": "~19.2.7",
|
|
39
45
|
"@types/react-dom": "~19.2.3",
|
|
40
46
|
"react": "~19.2.3",
|
|
41
47
|
"react-dom": "~19.2.3",
|
|
42
|
-
"vite": "^
|
|
43
|
-
"@dxos/echo": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/random": "0.8.4-main.
|
|
48
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
48
|
+
"vite": "^8.0.13",
|
|
49
|
+
"@dxos/echo-db": "0.8.4-main.765dc60934",
|
|
50
|
+
"@dxos/echo": "0.8.4-main.765dc60934",
|
|
51
|
+
"@dxos/keys": "0.8.4-main.765dc60934",
|
|
52
|
+
"@dxos/log": "0.8.4-main.765dc60934",
|
|
53
|
+
"@dxos/random": "0.8.4-main.765dc60934",
|
|
54
|
+
"@dxos/react-ui": "0.8.4-main.765dc60934",
|
|
55
|
+
"@dxos/ui-theme": "0.8.4-main.765dc60934",
|
|
56
|
+
"@dxos/storybook-utils": "0.8.4-main.765dc60934"
|
|
51
57
|
},
|
|
52
58
|
"peerDependencies": {
|
|
53
59
|
"react": "~19.2.3",
|
|
54
60
|
"react-dom": "~19.2.3",
|
|
55
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
56
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
61
|
+
"@dxos/react-ui": "0.8.4-main.765dc60934",
|
|
62
|
+
"@dxos/ui-theme": "0.8.4-main.765dc60934"
|
|
57
63
|
},
|
|
58
64
|
"publishConfig": {
|
|
59
65
|
"access": "public"
|
|
@@ -9,9 +9,10 @@ import { PublicKey } from '@dxos/keys';
|
|
|
9
9
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
10
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
|
+
import { translations } from '#translations';
|
|
13
|
+
|
|
12
14
|
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
13
15
|
import { Thread } from '../Thread';
|
|
14
|
-
import { translations } from '../translations';
|
|
15
16
|
import { MessageRoot } from './Message';
|
|
16
17
|
|
|
17
18
|
const DefaultStory = () => {
|
package/src/Message/Message.tsx
CHANGED
|
@@ -11,7 +11,8 @@ import { keymap, listener } from '@dxos/ui-editor';
|
|
|
11
11
|
import { mx } from '@dxos/ui-theme';
|
|
12
12
|
import { hexToEmoji, hexToHue, isTruthy } from '@dxos/util';
|
|
13
13
|
|
|
14
|
-
import { translationKey } from '
|
|
14
|
+
import { translationKey } from '#translations';
|
|
15
|
+
|
|
15
16
|
import { type MessageMetadata } from '../types';
|
|
16
17
|
|
|
17
18
|
const avatarSize = 7;
|
|
@@ -26,28 +27,25 @@ export const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(
|
|
|
26
27
|
{ authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps },
|
|
27
28
|
forwardedRef,
|
|
28
29
|
) => {
|
|
30
|
+
// Must wrap the message since Avatar.Label may be used in the content.
|
|
29
31
|
return (
|
|
30
|
-
// Must wrap the message since Avatar.Label may be used in the content.
|
|
31
32
|
<Avatar.Root>
|
|
32
33
|
<div
|
|
33
|
-
role='none'
|
|
34
34
|
data-testid='thread.message'
|
|
35
35
|
{...rootProps}
|
|
36
36
|
className={mx('grid grid-cols-subgrid col-span-2', classNames)}
|
|
37
37
|
ref={forwardedRef}
|
|
38
38
|
>
|
|
39
|
-
<div
|
|
39
|
+
<div 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
|
|
47
|
-
</div>
|
|
48
|
-
<div role='none' className='py-1 min-w-0'>
|
|
49
|
-
{children}
|
|
46
|
+
{continues && <div className='w-px grow bg-separator' />}
|
|
50
47
|
</div>
|
|
48
|
+
<div className='py-1 min-w-0'>{children}</div>
|
|
51
49
|
</div>
|
|
52
50
|
</Avatar.Root>
|
|
53
51
|
);
|
|
@@ -59,7 +57,7 @@ export type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'
|
|
|
59
57
|
|
|
60
58
|
export const MessageHeading = ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => {
|
|
61
59
|
return (
|
|
62
|
-
<div
|
|
60
|
+
<div {...props} className={mx('flex gap-2 items-start', classNames)}>
|
|
63
61
|
<p className='grow'>
|
|
64
62
|
<MessageAuthorName authorName={authorName} />
|
|
65
63
|
{timestamp && <MessageTime timestamp={timestamp} />}
|
|
@@ -165,7 +163,6 @@ export const MessageTextbox = ({
|
|
|
165
163
|
return (
|
|
166
164
|
<MessageRoot {...{ id, authorId, authorName, authorImgSrc, authorAvatarProps }} continues={false}>
|
|
167
165
|
<div
|
|
168
|
-
role='none'
|
|
169
166
|
ref={parentRef}
|
|
170
167
|
className={mx('py-0.5 me-1 rounded-xs dx-focus-ring', disabled && 'opacity-50')}
|
|
171
168
|
{...focusAttributes}
|
|
@@ -14,10 +14,8 @@ import { Icon, IconButton, useThemeContext } from '@dxos/react-ui';
|
|
|
14
14
|
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
15
15
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
16
|
import {
|
|
17
|
-
type Comment,
|
|
18
17
|
type CommentsOptions,
|
|
19
18
|
type EditorView,
|
|
20
|
-
type Range,
|
|
21
19
|
comments,
|
|
22
20
|
createBasicExtensions,
|
|
23
21
|
createThemeExtensions,
|
|
@@ -26,11 +24,13 @@ import {
|
|
|
26
24
|
scrollThreadIntoView,
|
|
27
25
|
setComments,
|
|
28
26
|
} from '@dxos/ui-editor';
|
|
27
|
+
import { type Comment, type Range } from '@dxos/ui-editor/types';
|
|
29
28
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
|
|
30
29
|
|
|
30
|
+
import { translations } from '#translations';
|
|
31
|
+
|
|
31
32
|
import { MessageBody, MessageHeading, MessageRoot, MessageTextbox } from '../Message';
|
|
32
33
|
import { type MessageEntity } from '../testing';
|
|
33
|
-
import { translations } from '../translations';
|
|
34
34
|
import { Thread } from './Thread';
|
|
35
35
|
|
|
36
36
|
random.seed(101);
|
|
@@ -349,7 +349,7 @@ const DefaultStory = ({ text, autoCreate }: DefaultStoryProps) => {
|
|
|
349
349
|
|
|
350
350
|
return (
|
|
351
351
|
<main className='fixed inset-0 grid grid-cols-[1fr_24rem]'>
|
|
352
|
-
<div
|
|
352
|
+
<div className='max-h-full overflow-y-auto p-4'>
|
|
353
353
|
<Editor
|
|
354
354
|
initialValue={item.content}
|
|
355
355
|
selected={selected}
|
|
@@ -361,7 +361,7 @@ const DefaultStory = ({ text, autoCreate }: DefaultStoryProps) => {
|
|
|
361
361
|
/>
|
|
362
362
|
</div>
|
|
363
363
|
|
|
364
|
-
<div
|
|
364
|
+
<div className='max-h-full overflow-y-auto p-4'>
|
|
365
365
|
<Sidebar
|
|
366
366
|
threads={visibleThreads}
|
|
367
367
|
selected={selected}
|
|
@@ -11,9 +11,10 @@ import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
|
11
11
|
import { createBasicExtensions, createThemeExtensions } from '@dxos/ui-editor';
|
|
12
12
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
|
+
import { translations } from '#translations';
|
|
15
|
+
|
|
14
16
|
import { MessageRoot, MessageTextbox } from '../Message';
|
|
15
17
|
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
16
|
-
import { translations } from '../translations';
|
|
17
18
|
import { Thread } from './Thread';
|
|
18
19
|
|
|
19
20
|
random.seed(1);
|
package/src/Thread/Thread.tsx
CHANGED
|
@@ -7,7 +7,8 @@ import React, { ComponentPropsWithRef, forwardRef, PropsWithChildren } from 'rea
|
|
|
7
7
|
import { Icon, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
8
|
import { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
|
-
import { translationKey } from '
|
|
10
|
+
import { translationKey } from '#translations';
|
|
11
|
+
|
|
11
12
|
import type { ThreadEntity } from '../types';
|
|
12
13
|
|
|
13
14
|
// TODO(burdon): Avoid exporting fragments.
|
|
@@ -55,10 +56,10 @@ const ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(
|
|
|
55
56
|
({ children, detached, ...props }, forwardedRef) => {
|
|
56
57
|
return (
|
|
57
58
|
<>
|
|
58
|
-
<div
|
|
59
|
+
<div className='flex items-center justify-center text-description'>
|
|
59
60
|
<Icon icon='ph--caret-double-right--regular' />
|
|
60
61
|
</div>
|
|
61
|
-
<div
|
|
62
|
+
<div className='flex items-center overflow-hidden'>
|
|
62
63
|
<p
|
|
63
64
|
role='heading'
|
|
64
65
|
data-testid='thread.heading'
|
package/src/index.ts
CHANGED
package/src/testing.tsx
CHANGED
|
@@ -46,10 +46,7 @@ export type MessagePartProps<PartValue> = {
|
|
|
46
46
|
|
|
47
47
|
export const MessageStoryBlock = <PartValue,>({ part }: MessagePartProps<PartValue>) => {
|
|
48
48
|
return (
|
|
49
|
-
<div
|
|
50
|
-
role='none'
|
|
51
|
-
className={mx('grid grid-cols-subgrid col-span-3', hoverableControls, hoverableFocusedWithinControls)}
|
|
52
|
-
>
|
|
49
|
+
<div className={mx('grid grid-cols-subgrid col-span-3', hoverableControls, hoverableFocusedWithinControls)}>
|
|
53
50
|
<pre className='font-mono max-w-full overflow-x-auto col-span-3'>
|
|
54
51
|
<code>{JSON.stringify(part, undefined, 2)}</code>
|
|
55
52
|
</pre>
|