@dxos/plugin-thread 0.6.11-staging.e6894a4 → 0.6.11
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 +2 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1 -4
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/components/Chat.stories.d.ts +0 -1
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/Comments.stories.d.ts.map +1 -1
- package/package.json +28 -28
- package/src/ThreadPlugin.tsx +5 -14
- package/src/components/Chat.stories.tsx +3 -3
- package/src/components/Comments.stories.tsx +8 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA8B,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"Chat.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DnD,wBAOE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Comments.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Comments.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Comments.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Comments.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CnD,wBAME;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-thread",
|
|
3
|
-
"version": "0.6.11
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"description": "DXOS Threads Surface plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -51,28 +51,28 @@
|
|
|
51
51
|
"@preact/signals-core": "^1.6.0",
|
|
52
52
|
"date-fns": "^3.3.1",
|
|
53
53
|
"lodash.get": "^4.4.2",
|
|
54
|
-
"@dxos/async": "0.6.11
|
|
55
|
-
"@dxos/display-name": "0.6.11
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/plugin-
|
|
62
|
-
"@dxos/plugin-
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/plugin-
|
|
65
|
-
"@dxos/plugin-observability": "0.6.11
|
|
66
|
-
"@dxos/plugin-settings": "0.6.11
|
|
67
|
-
"@dxos/plugin-space": "0.6.11
|
|
68
|
-
"@dxos/react-client": "0.6.11
|
|
69
|
-
"@dxos/react-ui-
|
|
70
|
-
"@dxos/react-ui-
|
|
71
|
-
"@dxos/react-ui-editor": "0.6.11
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-
|
|
74
|
-
"@dxos/react-ui-thread": "0.6.11
|
|
75
|
-
"@dxos/util": "0.6.11
|
|
54
|
+
"@dxos/async": "0.6.11",
|
|
55
|
+
"@dxos/display-name": "0.6.11",
|
|
56
|
+
"@dxos/app-framework": "0.6.11",
|
|
57
|
+
"@dxos/echo-schema": "0.6.11",
|
|
58
|
+
"@dxos/invariant": "0.6.11",
|
|
59
|
+
"@dxos/local-storage": "0.6.11",
|
|
60
|
+
"@dxos/log": "0.6.11",
|
|
61
|
+
"@dxos/plugin-graph": "0.6.11",
|
|
62
|
+
"@dxos/plugin-markdown": "0.6.11",
|
|
63
|
+
"@dxos/plugin-attention": "0.6.11",
|
|
64
|
+
"@dxos/plugin-client": "0.6.11",
|
|
65
|
+
"@dxos/plugin-observability": "0.6.11",
|
|
66
|
+
"@dxos/plugin-settings": "0.6.11",
|
|
67
|
+
"@dxos/plugin-space": "0.6.11",
|
|
68
|
+
"@dxos/react-client": "0.6.11",
|
|
69
|
+
"@dxos/react-ui-deck": "0.6.11",
|
|
70
|
+
"@dxos/react-ui-attention": "0.6.11",
|
|
71
|
+
"@dxos/react-ui-editor": "0.6.11",
|
|
72
|
+
"@dxos/react-ui-mosaic": "0.6.11",
|
|
73
|
+
"@dxos/react-ui-theme": "0.6.11",
|
|
74
|
+
"@dxos/react-ui-thread": "0.6.11",
|
|
75
|
+
"@dxos/util": "0.6.11"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -82,16 +82,16 @@
|
|
|
82
82
|
"react": "~18.2.0",
|
|
83
83
|
"react-dom": "~18.2.0",
|
|
84
84
|
"vite": "^5.3.4",
|
|
85
|
-
"@dxos/
|
|
86
|
-
"@dxos/
|
|
87
|
-
"@dxos/storybook-utils": "0.6.11
|
|
85
|
+
"@dxos/random": "0.6.11",
|
|
86
|
+
"@dxos/react-ui": "0.6.11",
|
|
87
|
+
"@dxos/storybook-utils": "0.6.11"
|
|
88
88
|
},
|
|
89
89
|
"optionalDependencies": {
|
|
90
90
|
"@phosphor-icons/react": "^2.1.5",
|
|
91
91
|
"react": "^18.0.0",
|
|
92
92
|
"react-dom": "^18.0.0",
|
|
93
|
-
"@dxos/react-ui": "0.6.11
|
|
94
|
-
"@dxos/react-ui
|
|
93
|
+
"@dxos/react-ui-theme": "0.6.11",
|
|
94
|
+
"@dxos/react-ui": "0.6.11"
|
|
95
95
|
},
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
package/src/ThreadPlugin.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Chat, type IconProps } from '@phosphor-icons/react';
|
|
6
6
|
import { computed, effect } from '@preact/signals-core';
|
|
7
|
-
import React
|
|
7
|
+
import React from 'react';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
type IntentPluginProvides,
|
|
@@ -73,6 +73,10 @@ type SubjectId = string;
|
|
|
73
73
|
const initialViewState = { showResolvedThreads: false };
|
|
74
74
|
type ViewStore = Record<SubjectId, typeof initialViewState>;
|
|
75
75
|
|
|
76
|
+
// TODO(Zan): More robust runtime check.
|
|
77
|
+
const providesThreadsConfig = (plugin: any): Plugin<ThreadProvides<any>> | undefined =>
|
|
78
|
+
'thread' in plugin.provides ? (plugin as Plugin<ThreadProvides<any>>) : undefined;
|
|
79
|
+
|
|
76
80
|
// TODO(Zan): Every instance of `cursor` should be replaced with `anchor`.
|
|
77
81
|
export const ThreadPlugin = (): PluginDefinition<ThreadPluginProvides> => {
|
|
78
82
|
const settings = new LocalStorageStore<ThreadSettingsProps>(THREAD_PLUGIN);
|
|
@@ -199,7 +203,6 @@ export const ThreadPlugin = (): PluginDefinition<ThreadPluginProvides> => {
|
|
|
199
203
|
const [spaceId, objectId] = docId?.split(':') ?? [];
|
|
200
204
|
const space = client.spaces.get().find((space) => space.id === spaceId);
|
|
201
205
|
const doc = space?.db.getObjectById(objectId);
|
|
202
|
-
|
|
203
206
|
if (!doc || !docId) {
|
|
204
207
|
return;
|
|
205
208
|
}
|
|
@@ -225,7 +228,6 @@ export const ThreadPlugin = (): PluginDefinition<ThreadPluginProvides> => {
|
|
|
225
228
|
},
|
|
226
229
|
actions: ({ node }) => {
|
|
227
230
|
const dataId = node.id.split('~').at(0);
|
|
228
|
-
|
|
229
231
|
if (!node.id.endsWith('~comments') || !dataId) {
|
|
230
232
|
return;
|
|
231
233
|
}
|
|
@@ -312,14 +314,6 @@ export const ThreadPlugin = (): PluginDefinition<ThreadPluginProvides> => {
|
|
|
312
314
|
case 'article':
|
|
313
315
|
case 'complementary': {
|
|
314
316
|
const location = navigationPlugin?.provides.location;
|
|
315
|
-
|
|
316
|
-
const providesThreadsConfig = useCallback(
|
|
317
|
-
(plugin: any): Plugin<ThreadProvides<any>> | undefined =>
|
|
318
|
-
// TODO(Zan): More robust runtime check.
|
|
319
|
-
'thread' in plugin.provides ? (plugin as Plugin<ThreadProvides<any>>) : undefined,
|
|
320
|
-
[],
|
|
321
|
-
);
|
|
322
|
-
|
|
323
317
|
const threadsIntegrators = useResolvePlugins(providesThreadsConfig);
|
|
324
318
|
const threadProvides = threadsIntegrators.map((p) => p.provides.thread);
|
|
325
319
|
|
|
@@ -328,9 +322,7 @@ export const ThreadPlugin = (): PluginDefinition<ThreadPluginProvides> => {
|
|
|
328
322
|
// TODO(zan): Maybe we should have utility for positional main object ids.
|
|
329
323
|
if (isLayoutParts(location?.active) && location.active.main) {
|
|
330
324
|
const layoutEntries = location.active.main;
|
|
331
|
-
|
|
332
325
|
const currentPosition = layoutEntries.findIndex((entry) => channel.id === entry.id);
|
|
333
|
-
|
|
334
326
|
if (currentPosition > 0) {
|
|
335
327
|
const objectToTheLeft = layoutEntries[currentPosition - 1];
|
|
336
328
|
const context = getSpace(data.object)?.db.getObjectById(objectToTheLeft.id);
|
|
@@ -452,7 +444,6 @@ export const ThreadPlugin = (): PluginDefinition<ThreadPluginProvides> => {
|
|
|
452
444
|
|
|
453
445
|
const subjectId = fullyQualifiedId(subject);
|
|
454
446
|
const thread = create(ThreadType, { name, anchor: cursor, messages: [], status: 'staged' });
|
|
455
|
-
|
|
456
447
|
const stagingArea = state.staging[subjectId];
|
|
457
448
|
if (stagingArea) {
|
|
458
449
|
stagingArea.push(thread);
|
|
@@ -15,7 +15,7 @@ import { useIdentity } from '@dxos/react-client/halo';
|
|
|
15
15
|
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
16
16
|
import { Mosaic } from '@dxos/react-ui-mosaic';
|
|
17
17
|
import { Thread } from '@dxos/react-ui-thread';
|
|
18
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
18
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
19
19
|
|
|
20
20
|
import { ChatContainer } from './ChatContainer';
|
|
21
21
|
import { createChatThread } from './testing';
|
|
@@ -69,8 +69,8 @@ export default {
|
|
|
69
69
|
component: Thread,
|
|
70
70
|
// TODO(wittjosiah): Register schemas.
|
|
71
71
|
render: () => <ClientRepeater component={Story} createIdentity createSpace types={[ThreadType]} />,
|
|
72
|
-
decorators: [withTheme],
|
|
73
|
-
parameters: { translations
|
|
72
|
+
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
73
|
+
parameters: { translations },
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
export const Default = {};
|
|
@@ -8,12 +8,10 @@ import React, { useEffect, useState } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { MessageType, ThreadType } from '@dxos/plugin-space/types';
|
|
10
10
|
import { faker } from '@dxos/random';
|
|
11
|
-
import { type PublicKey } from '@dxos/react-client';
|
|
12
11
|
import { Filter, useQuery, useSpace } from '@dxos/react-client/echo';
|
|
13
12
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
14
|
-
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
15
|
-
import {
|
|
16
|
-
import { withFullscreen, withTheme } from '@dxos/storybook-utils';
|
|
13
|
+
import { type ClientRepeatedComponentProps, ClientRepeater } from '@dxos/react-client/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
17
15
|
|
|
18
16
|
import { CommentsContainer } from './CommentsContainer';
|
|
19
17
|
import { createCommentThread } from './testing';
|
|
@@ -21,7 +19,7 @@ import translations from '../translations';
|
|
|
21
19
|
|
|
22
20
|
faker.seed(1);
|
|
23
21
|
|
|
24
|
-
const Story = ({ spaceKey }:
|
|
22
|
+
const Story = ({ spaceKey }: ClientRepeatedComponentProps) => {
|
|
25
23
|
const identity = useIdentity();
|
|
26
24
|
const space = useSpace(spaceKey);
|
|
27
25
|
const threads = useQuery(space, Filter.schema(ThreadType));
|
|
@@ -43,15 +41,12 @@ const Story = ({ spaceKey }: { spaceKey: PublicKey }) => {
|
|
|
43
41
|
return null;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
// TODO(wittjosiah): Include Tooltip.Provider in `withTheme` decorator?
|
|
47
44
|
return (
|
|
48
|
-
<
|
|
49
|
-
<div className='flex
|
|
50
|
-
<
|
|
51
|
-
<CommentsContainer threads={threads} detached={detached} onThreadDelete={console.log} />
|
|
52
|
-
</div>
|
|
45
|
+
<div className='flex justify-center overflow-y-auto bg-white dark:bg-black'>
|
|
46
|
+
<div className='flex flex-col w-[400px]'>
|
|
47
|
+
<CommentsContainer threads={threads} detached={detached} onThreadDelete={console.log} />
|
|
53
48
|
</div>
|
|
54
|
-
</
|
|
49
|
+
</div>
|
|
55
50
|
);
|
|
56
51
|
};
|
|
57
52
|
|
|
@@ -59,7 +54,7 @@ export default {
|
|
|
59
54
|
title: 'plugin-thread/Comments',
|
|
60
55
|
// TODO(wittjosiah): Register schemas.
|
|
61
56
|
render: () => <ClientRepeater component={Story} createIdentity createSpace types={[ThreadType, MessageType]} />,
|
|
62
|
-
decorators: [withTheme,
|
|
57
|
+
decorators: [withTheme, withLayout({ fullscreen: true, tooltips: true })],
|
|
63
58
|
parameters: { translations },
|
|
64
59
|
};
|
|
65
60
|
|