@dxos/react-ui-thread 0.4.10-main.eedd150 → 0.4.10-main.f635fb0
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.
|
@@ -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;AAE7E,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAM5D,OAAO,EAML,KAAK,KAAK,EAMX,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,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;AAE7E,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAM5D,OAAO,EAML,KAAK,KAAK,EAMX,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAoE9C,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,CAAC;QAAE,OAAO,CAAC,EAAE,UAAU,CAAA;KAAE,CAAC,EAAE,CAAC;CACrD,CAAC;AA6IF,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;;;;;;;;;;mBA+He,UAAU;;;;;;;;;;;;;;;;;;;;;AAJ3B,wBAME;AAWF,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-thread",
|
|
3
|
-
"version": "0.4.10-main.
|
|
3
|
+
"version": "0.4.10-main.f635fb0",
|
|
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",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@radix-ui/react-primitive": "^1.0.2",
|
|
20
20
|
"date-fns": "^3.3.1",
|
|
21
|
-
"@dxos/react-ui": "0.4.10-main.
|
|
22
|
-
"@dxos/react-ui-
|
|
23
|
-
"@dxos/react-ui-mosaic": "0.4.10-main.
|
|
24
|
-
"@dxos/react-ui-
|
|
25
|
-
"@dxos/util": "0.4.10-main.
|
|
21
|
+
"@dxos/react-ui": "0.4.10-main.f635fb0",
|
|
22
|
+
"@dxos/react-ui-theme": "0.4.10-main.f635fb0",
|
|
23
|
+
"@dxos/react-ui-mosaic": "0.4.10-main.f635fb0",
|
|
24
|
+
"@dxos/react-ui-editor": "0.4.10-main.f635fb0",
|
|
25
|
+
"@dxos/util": "0.4.10-main.f635fb0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"@types/react-dom": "^18.0.6",
|
|
31
31
|
"react": "^18.2.0",
|
|
32
32
|
"react-dom": "^18.2.0",
|
|
33
|
-
"vite": "^5.
|
|
33
|
+
"vite": "^5.2.9",
|
|
34
34
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
35
|
-
"@braneframe/types": "0.4.10-main.
|
|
36
|
-
"@dxos/echo-schema": "0.4.10-main.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
35
|
+
"@braneframe/types": "0.4.10-main.f635fb0",
|
|
36
|
+
"@dxos/echo-schema": "0.4.10-main.f635fb0",
|
|
37
|
+
"@dxos/log": "0.4.10-main.f635fb0",
|
|
38
|
+
"@dxos/random": "0.4.10-main.f635fb0",
|
|
39
|
+
"@dxos/storybook-utils": "0.4.10-main.f635fb0",
|
|
40
|
+
"@dxos/keys": "0.4.10-main.f635fb0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -8,7 +8,7 @@ import { Check, Trash } from '@phosphor-icons/react';
|
|
|
8
8
|
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { MessageType, TextV0Type } from '@braneframe/types';
|
|
11
|
-
import
|
|
11
|
+
import { createDocAccessor, create, createEchoObject } from '@dxos/echo-schema';
|
|
12
12
|
import { PublicKey } from '@dxos/keys';
|
|
13
13
|
import { log } from '@dxos/log';
|
|
14
14
|
import { faker } from '@dxos/random';
|
|
@@ -63,17 +63,16 @@ const Editor: FC<{
|
|
|
63
63
|
const [selected, setSelected] = useState<string>();
|
|
64
64
|
|
|
65
65
|
const { themeMode } = useThemeContext();
|
|
66
|
-
const doc = item.content;
|
|
67
|
-
const accessor = E.getRawDoc(item, ['content']);
|
|
68
66
|
const { parentRef, view } = useTextEditor(
|
|
69
67
|
() => ({
|
|
70
68
|
id,
|
|
71
|
-
doc,
|
|
69
|
+
doc: item.content,
|
|
72
70
|
extensions: [
|
|
73
71
|
createBasicExtensions(),
|
|
74
72
|
createThemeExtensions({ themeMode }),
|
|
75
|
-
automerge(
|
|
73
|
+
automerge(createDocAccessor(item, ['content'])),
|
|
76
74
|
comments({
|
|
75
|
+
id,
|
|
77
76
|
onCreate: onCreateComment,
|
|
78
77
|
onDelete: onDeleteComment,
|
|
79
78
|
onUpdate: onUpdateComment,
|
|
@@ -81,7 +80,7 @@ const Editor: FC<{
|
|
|
81
80
|
}),
|
|
82
81
|
],
|
|
83
82
|
}),
|
|
84
|
-
[
|
|
83
|
+
[id, item, themeMode],
|
|
85
84
|
);
|
|
86
85
|
useComments(view, id, commentRanges);
|
|
87
86
|
useEffect(() => {
|
|
@@ -111,7 +110,7 @@ type StoryCommentThread = {
|
|
|
111
110
|
const StoryMessageBlock = (props: MessageBlockProps<{ content?: TextV0Type }>) => {
|
|
112
111
|
const { themeMode } = useThemeContext();
|
|
113
112
|
const doc = props.block.content?.content;
|
|
114
|
-
const accessor =
|
|
113
|
+
const accessor = createDocAccessor(props.block.content!, ['content']);
|
|
115
114
|
const { parentRef } = useTextEditor(
|
|
116
115
|
() => ({
|
|
117
116
|
doc,
|
|
@@ -162,12 +161,12 @@ const StoryThread: FC<{
|
|
|
162
161
|
|
|
163
162
|
const handleCreateMessage = () => {
|
|
164
163
|
if (messageRef.current?.length) {
|
|
165
|
-
const message =
|
|
164
|
+
const message = create(MessageType, {
|
|
166
165
|
from: { identityKey: authorId },
|
|
167
166
|
blocks: [
|
|
168
167
|
{
|
|
169
168
|
timestamp: new Date().toISOString(),
|
|
170
|
-
content:
|
|
169
|
+
content: create(TextV0Type, { content: messageRef.current }),
|
|
171
170
|
},
|
|
172
171
|
],
|
|
173
172
|
});
|
|
@@ -253,7 +252,7 @@ type StoryProps = {
|
|
|
253
252
|
};
|
|
254
253
|
|
|
255
254
|
const Story = ({ text, autoCreate }: StoryProps) => {
|
|
256
|
-
const [item] = useState(
|
|
255
|
+
const [item] = useState(createEchoObject(create(TextV0Type, { content: text ?? '' })));
|
|
257
256
|
const [threads, setThreads] = useState<StoryCommentThread[]>([]);
|
|
258
257
|
const [selected, setSelected] = useState<string>();
|
|
259
258
|
|
|
@@ -279,7 +278,7 @@ const Story = ({ text, autoCreate }: StoryProps) => {
|
|
|
279
278
|
blocks: [
|
|
280
279
|
{
|
|
281
280
|
timestamp: new Date().toISOString(),
|
|
282
|
-
content:
|
|
281
|
+
content: create(TextV0Type, { content: faker.lorem.sentence() }),
|
|
283
282
|
},
|
|
284
283
|
],
|
|
285
284
|
}),
|