@dxos/plugin-thread 0.8.2-main.f081794 → 0.8.2-main.fbd8ed0
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/{ChatContainer-WC6KQDDU.mjs → ChatContainer-H4XTHM3A.mjs} +5 -5
- package/dist/lib/browser/ChatContainer-H4XTHM3A.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-6W4UKJDI.mjs → app-graph-builder-V7UUHGUI.mjs} +10 -7
- package/dist/lib/browser/app-graph-builder-V7UUHGUI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AYNXYEKP.mjs → chunk-32EIWOAL.mjs} +1 -1
- package/dist/lib/browser/{chunk-AYNXYEKP.mjs.map → chunk-32EIWOAL.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-FY5OCUP6.mjs → chunk-I3JK6CBS.mjs} +9 -7
- package/dist/lib/browser/chunk-I3JK6CBS.mjs.map +7 -0
- package/dist/lib/browser/chunk-OO7PQPV5.mjs +93 -0
- package/dist/lib/browser/chunk-OO7PQPV5.mjs.map +7 -0
- package/dist/lib/browser/chunk-YRGWE35W.mjs +17 -0
- package/dist/lib/browser/index.mjs +10 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-3UW6ROYT.mjs → intent-resolver-PDOLX5B7.mjs} +14 -19
- package/dist/lib/browser/intent-resolver-PDOLX5B7.mjs.map +7 -0
- package/dist/lib/browser/{markdown-7KXBXCUS.mjs → markdown-XJJVUBDO.mjs} +4 -4
- package/dist/lib/browser/markdown-XJJVUBDO.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-KAPIXG2M.mjs → react-surface-7DJZKIOK.mjs} +21 -22
- package/dist/lib/browser/react-surface-7DJZKIOK.mjs.map +7 -0
- package/dist/lib/browser/{settings-2VZ7S4SK.mjs → settings-K56QXNJ4.mjs} +2 -2
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{ChatContainer-LVYQ67PJ.cjs → ChatContainer-TUISUIY7.cjs} +11 -11
- package/dist/lib/node/ChatContainer-TUISUIY7.cjs.map +7 -0
- package/dist/lib/node/{app-graph-builder-HZNWT4QU.cjs → app-graph-builder-MMM26FEH.cjs} +13 -10
- package/dist/lib/node/app-graph-builder-MMM26FEH.cjs.map +7 -0
- package/dist/lib/node/{chunk-BASYS5Q5.cjs → chunk-AZ275P4V.cjs} +9 -9
- package/dist/lib/node/{chunk-RIYLEDQ7.cjs → chunk-ETDNE4Z6.cjs} +13 -11
- package/dist/lib/node/chunk-ETDNE4Z6.cjs.map +7 -0
- package/dist/lib/node/{chunk-46BSFPBV.cjs → chunk-GRMB5VRN.cjs} +49 -49
- package/dist/lib/node/chunk-GRMB5VRN.cjs.map +7 -0
- package/dist/lib/node/{chunk-W25MBII2.cjs → chunk-NO6WQR36.cjs} +4 -4
- package/dist/lib/node/{chunk-W25MBII2.cjs.map → chunk-NO6WQR36.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +17 -17
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-DC6HDNTX.cjs → intent-resolver-MNTL32W2.cjs} +24 -29
- package/dist/lib/node/intent-resolver-MNTL32W2.cjs.map +7 -0
- package/dist/lib/node/{markdown-L2WMCQKM.cjs → markdown-25NI6Q4Y.cjs} +9 -9
- package/dist/lib/node/markdown-25NI6Q4Y.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-5USFRCS3.cjs → react-surface-KGUZJVRL.cjs} +31 -32
- package/dist/lib/node/react-surface-KGUZJVRL.cjs.map +7 -0
- package/dist/lib/node/{settings-7MGTJ46L.cjs → settings-4WLSO726.cjs} +6 -6
- package/dist/lib/node/types.cjs +3 -3
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{ChatContainer-WMOPMK5H.mjs → ChatContainer-G7VTTRDN.mjs} +5 -5
- package/dist/lib/node-esm/ChatContainer-G7VTTRDN.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-M3KK5QJH.mjs → app-graph-builder-QEFJ2KA4.mjs} +10 -7
- package/dist/lib/node-esm/app-graph-builder-QEFJ2KA4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5XUQJWUG.mjs +19 -0
- package/dist/lib/node-esm/chunk-A7RLBTTZ.mjs +94 -0
- package/dist/lib/node-esm/chunk-A7RLBTTZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-T6E5EY7Z.mjs → chunk-IZWN4KAY.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-T6E5EY7Z.mjs.map → chunk-IZWN4KAY.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-7DOPZH6Y.mjs → chunk-V7HLWNAO.mjs} +9 -7
- package/dist/lib/node-esm/chunk-V7HLWNAO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +10 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-OAMDKGAA.mjs → intent-resolver-X2FNKFSK.mjs} +14 -19
- package/dist/lib/node-esm/intent-resolver-X2FNKFSK.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-ZKU23UVD.mjs → markdown-2ERASVEO.mjs} +4 -4
- package/dist/lib/node-esm/markdown-2ERASVEO.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-VNZ2SN6W.mjs → react-surface-DLD2UJRM.mjs} +21 -22
- package/dist/lib/node-esm/react-surface-DLD2UJRM.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-AJAZ3O47.mjs → settings-5UA6FBMW.mjs} +2 -2
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -179
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +2 -2
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
- package/dist/types/src/components/Comments.stories.d.ts +1 -1
- package/dist/types/src/components/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts +5 -4
- package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
- package/dist/types/src/components/ThreadSettings.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +96 -49
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +2 -2
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/extensions/threads.d.ts.map +1 -1
- package/dist/types/src/hooks/analytics.d.ts +2 -2
- package/dist/types/src/hooks/analytics.d.ts.map +1 -1
- package/dist/types/src/hooks/useStatus.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -56
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +212 -61
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -33
- package/src/ThreadPlugin.tsx +7 -7
- package/src/capabilities/app-graph-builder.ts +31 -21
- package/src/capabilities/intent-resolver.ts +10 -11
- package/src/capabilities/markdown.ts +4 -4
- package/src/components/Chat.stories.tsx +5 -6
- package/src/components/ChatContainer.tsx +3 -3
- package/src/components/CommentContainer.tsx +25 -49
- package/src/components/Comments.stories.tsx +9 -7
- package/src/components/CommentsContainer.tsx +2 -8
- package/src/components/MessageContainer.tsx +31 -50
- package/src/components/testing.ts +2 -2
- package/src/components/types.ts +2 -2
- package/src/hooks/analytics.ts +6 -2
- package/src/translations.ts +2 -2
- package/src/types.ts +40 -40
- package/dist/lib/browser/ChatContainer-WC6KQDDU.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-6W4UKJDI.mjs.map +0 -7
- package/dist/lib/browser/chunk-2S7HPWRY.mjs +0 -17
- package/dist/lib/browser/chunk-FY5OCUP6.mjs.map +0 -7
- package/dist/lib/browser/chunk-WOG72DWE.mjs +0 -93
- package/dist/lib/browser/chunk-WOG72DWE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3UW6ROYT.mjs.map +0 -7
- package/dist/lib/browser/markdown-7KXBXCUS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KAPIXG2M.mjs.map +0 -7
- package/dist/lib/node/ChatContainer-LVYQ67PJ.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-HZNWT4QU.cjs.map +0 -7
- package/dist/lib/node/chunk-46BSFPBV.cjs.map +0 -7
- package/dist/lib/node/chunk-RIYLEDQ7.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-DC6HDNTX.cjs.map +0 -7
- package/dist/lib/node/markdown-L2WMCQKM.cjs.map +0 -7
- package/dist/lib/node/react-surface-5USFRCS3.cjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-WMOPMK5H.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-M3KK5QJH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7DOPZH6Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E446MGLP.mjs +0 -94
- package/dist/lib/node-esm/chunk-E446MGLP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HZGOTRPK.mjs +0 -19
- package/dist/lib/node-esm/intent-resolver-OAMDKGAA.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-ZKU23UVD.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-VNZ2SN6W.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-2S7HPWRY.mjs.map → chunk-YRGWE35W.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-2VZ7S4SK.mjs.map → settings-K56QXNJ4.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-BASYS5Q5.cjs.map → chunk-AZ275P4V.cjs.map} +0 -0
- /package/dist/lib/node/{settings-7MGTJ46L.cjs.map → settings-4WLSO726.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-HZGOTRPK.mjs.map → chunk-5XUQJWUG.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-AJAZ3O47.mjs.map → settings-5UA6FBMW.mjs.map} +0 -0
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities, contributes, createIntent, createResolver, type
|
|
6
|
-
import {
|
|
5
|
+
import { Capabilities, contributes, createIntent, createResolver, type PluginContext } from '@dxos/app-framework';
|
|
6
|
+
import { createQueueDxn, Ref } from '@dxos/echo-schema';
|
|
7
7
|
import { invariant } from '@dxos/invariant';
|
|
8
|
-
import { DXN, QueueSubspaceTags } from '@dxos/keys';
|
|
9
8
|
import { refFromDXN } from '@dxos/live-object';
|
|
10
9
|
import { log } from '@dxos/log';
|
|
11
10
|
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
|
|
12
11
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
13
12
|
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
14
13
|
import { live, fullyQualifiedId, getSpace, makeRef } from '@dxos/react-client/echo';
|
|
15
|
-
import {
|
|
14
|
+
import { DataType } from '@dxos/schema';
|
|
16
15
|
|
|
17
16
|
import { ThreadCapabilities } from './capabilities';
|
|
18
17
|
import { THREAD_PLUGIN } from '../meta';
|
|
19
18
|
import { ThreadAction } from '../types';
|
|
20
19
|
|
|
21
|
-
export default (context:
|
|
20
|
+
export default (context: PluginContext) =>
|
|
22
21
|
contributes(Capabilities.IntentResolver, [
|
|
23
22
|
createResolver({
|
|
24
23
|
intent: ThreadAction.CreateChannel,
|
|
@@ -26,7 +25,7 @@ export default (context: PluginsContext) =>
|
|
|
26
25
|
data: {
|
|
27
26
|
object: live(ChannelType, {
|
|
28
27
|
name,
|
|
29
|
-
queue: refFromDXN(
|
|
28
|
+
queue: refFromDXN(createQueueDxn(spaceId)),
|
|
30
29
|
}),
|
|
31
30
|
},
|
|
32
31
|
}),
|
|
@@ -45,7 +44,7 @@ export default (context: PluginsContext) =>
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
const { state } = context.
|
|
47
|
+
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
49
48
|
const subjectId = fullyQualifiedId(subject);
|
|
50
49
|
const thread = live(ThreadType, { name, anchor: cursor, messages: [], status: 'staged' });
|
|
51
50
|
const draft = state.drafts[subjectId];
|
|
@@ -70,7 +69,7 @@ export default (context: PluginsContext) =>
|
|
|
70
69
|
createResolver({
|
|
71
70
|
intent: ThreadAction.Select,
|
|
72
71
|
resolve: ({ current }) => {
|
|
73
|
-
const { state } = context.
|
|
72
|
+
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
74
73
|
state.current = current;
|
|
75
74
|
},
|
|
76
75
|
}),
|
|
@@ -103,7 +102,7 @@ export default (context: PluginsContext) =>
|
|
|
103
102
|
createResolver({
|
|
104
103
|
intent: ThreadAction.Delete,
|
|
105
104
|
resolve: ({ subject, thread }, undo) => {
|
|
106
|
-
const { state } = context.
|
|
105
|
+
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
107
106
|
const subjectId = fullyQualifiedId(subject);
|
|
108
107
|
const draft = state.drafts[subjectId];
|
|
109
108
|
if (draft) {
|
|
@@ -166,13 +165,13 @@ export default (context: PluginsContext) =>
|
|
|
166
165
|
createResolver({
|
|
167
166
|
intent: ThreadAction.AddMessage,
|
|
168
167
|
resolve: ({ thread, subject, sender, text }) => {
|
|
169
|
-
const { state } = context.
|
|
168
|
+
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
170
169
|
const subjectId = fullyQualifiedId(subject);
|
|
171
170
|
const space = getSpace(subject);
|
|
172
171
|
invariant(space, 'Space not found');
|
|
173
172
|
const intents = [];
|
|
174
173
|
|
|
175
|
-
const message = live(
|
|
174
|
+
const message = live(DataType.Message, {
|
|
176
175
|
sender,
|
|
177
176
|
created: new Date().toISOString(),
|
|
178
177
|
blocks: [{ type: 'text', text }],
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities, contributes, type
|
|
5
|
+
import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
|
|
6
6
|
import { MarkdownCapabilities } from '@dxos/plugin-markdown';
|
|
7
7
|
|
|
8
8
|
import { ThreadCapabilities } from './capabilities';
|
|
9
9
|
import { threads } from '../extensions';
|
|
10
10
|
|
|
11
|
-
export default (context:
|
|
11
|
+
export default (context: PluginContext) =>
|
|
12
12
|
contributes(MarkdownCapabilities.Extensions, [
|
|
13
13
|
({ document: doc }) => {
|
|
14
|
-
const { dispatchPromise: dispatch } = context.
|
|
15
|
-
const { state } = context.
|
|
14
|
+
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
15
|
+
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
16
16
|
return threads(state, doc, dispatch);
|
|
17
17
|
},
|
|
18
18
|
]);
|
|
@@ -9,8 +9,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
9
9
|
|
|
10
10
|
import { Capabilities, contributes, createSurface, IntentPlugin } from '@dxos/app-framework';
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import {
|
|
13
|
-
import { DXN, QueueSubspaceTags } from '@dxos/keys';
|
|
12
|
+
import { createQueueDxn } from '@dxos/echo-schema';
|
|
14
13
|
import { refFromDXN } from '@dxos/live-object';
|
|
15
14
|
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
16
15
|
import { faker } from '@dxos/random';
|
|
@@ -19,7 +18,7 @@ import { live, type Space } from '@dxos/react-client/echo';
|
|
|
19
18
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
20
19
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
21
20
|
import { Thread } from '@dxos/react-ui-thread';
|
|
22
|
-
import {
|
|
21
|
+
import { DataType } from '@dxos/schema';
|
|
23
22
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
24
23
|
|
|
25
24
|
import { ChatContainer } from './ChatContainer';
|
|
@@ -39,7 +38,7 @@ const Story = () => {
|
|
|
39
38
|
const space = await client.spaces.create();
|
|
40
39
|
const channel = space.db.add(
|
|
41
40
|
live(ChannelType, {
|
|
42
|
-
queue: refFromDXN(
|
|
41
|
+
queue: refFromDXN(createQueueDxn(space.id)),
|
|
43
42
|
}),
|
|
44
43
|
);
|
|
45
44
|
setSpace(space);
|
|
@@ -80,8 +79,8 @@ const meta: Meta = {
|
|
|
80
79
|
],
|
|
81
80
|
}),
|
|
82
81
|
withTheme,
|
|
83
|
-
withLayout({ fullscreen: true
|
|
84
|
-
withClientProvider({ createSpace: true, types: [ThreadType,
|
|
82
|
+
withLayout({ fullscreen: true }),
|
|
83
|
+
withClientProvider({ createSpace: true, types: [ThreadType, DataType.Message] }),
|
|
85
84
|
],
|
|
86
85
|
parameters: { translations },
|
|
87
86
|
};
|
|
@@ -14,7 +14,7 @@ import { createBasicExtensions, createThemeExtensions, listener } from '@dxos/re
|
|
|
14
14
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
15
15
|
import { mx } from '@dxos/react-ui-theme';
|
|
16
16
|
import { MessageTextbox, type MessageTextboxProps, Thread, ThreadFooter, threadLayout } from '@dxos/react-ui-thread';
|
|
17
|
-
import {
|
|
17
|
+
import { DataType } from '@dxos/schema';
|
|
18
18
|
|
|
19
19
|
import { MessageContainer } from './MessageContainer';
|
|
20
20
|
import { command } from './command-extension';
|
|
@@ -44,7 +44,7 @@ export const ChatContainer = ({ space, dxn, context, current, autoFocusTextbox }
|
|
|
44
44
|
const id = dxn.toString();
|
|
45
45
|
const identity = useIdentity()!;
|
|
46
46
|
const members = useMembers(space?.key);
|
|
47
|
-
const queue = useQueue<
|
|
47
|
+
const queue = useQueue<DataType.Message>(dxn, { pollInterval: 1_000 });
|
|
48
48
|
const activity = useStatus(space, id);
|
|
49
49
|
const { t } = useTranslation(THREAD_PLUGIN);
|
|
50
50
|
// TODO(wittjosiah): This is a hack to reset the editor after a message is sent.
|
|
@@ -84,7 +84,7 @@ export const ChatContainer = ({ space, dxn, context, current, autoFocusTextbox }
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
queue.append([
|
|
87
|
-
create(
|
|
87
|
+
create(DataType.Message, {
|
|
88
88
|
sender: { identityDid: identity.did },
|
|
89
89
|
created: new Date().toISOString(),
|
|
90
90
|
blocks: [{ type: 'text', text: messageRef.current }],
|
|
@@ -42,25 +42,17 @@ const ToggleResolvedButton = ({
|
|
|
42
42
|
const { t } = useTranslation(THREAD_PLUGIN);
|
|
43
43
|
const label = t(isResolved ? 'mark as unresolved label' : 'mark as resolved label');
|
|
44
44
|
return (
|
|
45
|
-
<Tooltip.
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</Tooltip.Trigger>
|
|
57
|
-
<Tooltip.Portal>
|
|
58
|
-
<Tooltip.Content>
|
|
59
|
-
{label}
|
|
60
|
-
<Tooltip.Arrow />
|
|
61
|
-
</Tooltip.Content>
|
|
62
|
-
</Tooltip.Portal>
|
|
63
|
-
</Tooltip.Root>
|
|
45
|
+
<Tooltip.Trigger asChild content={label}>
|
|
46
|
+
<Button
|
|
47
|
+
variant='ghost'
|
|
48
|
+
data-testid='thread.toggle-resolved'
|
|
49
|
+
onClick={onResolve}
|
|
50
|
+
classNames={[commentControlClassNames, !isResolved && hoverableControlItem]}
|
|
51
|
+
>
|
|
52
|
+
<span className='sr-only'>{label}</span>
|
|
53
|
+
{isResolved ? <CheckCircle className={sizeClass} weight='fill' /> : <CheckCircle className={sizeClass} />}
|
|
54
|
+
</Button>
|
|
55
|
+
</Tooltip.Trigger>
|
|
64
56
|
);
|
|
65
57
|
};
|
|
66
58
|
|
|
@@ -68,25 +60,17 @@ const DeleteThreadButton = ({ onDelete }: { onDelete: () => void }) => {
|
|
|
68
60
|
const { t } = useTranslation(THREAD_PLUGIN);
|
|
69
61
|
const label = t('delete thread label');
|
|
70
62
|
return (
|
|
71
|
-
<Tooltip.
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</Tooltip.Trigger>
|
|
83
|
-
<Tooltip.Portal>
|
|
84
|
-
<Tooltip.Content classNames='z-30'>
|
|
85
|
-
{label}
|
|
86
|
-
<Tooltip.Arrow />
|
|
87
|
-
</Tooltip.Content>
|
|
88
|
-
</Tooltip.Portal>
|
|
89
|
-
</Tooltip.Root>
|
|
63
|
+
<Tooltip.Trigger asChild content={label}>
|
|
64
|
+
<Button
|
|
65
|
+
variant='ghost'
|
|
66
|
+
data-testid='thread.delete'
|
|
67
|
+
onClick={onDelete}
|
|
68
|
+
classNames={[commentControlClassNames, hoverableControlItem]}
|
|
69
|
+
>
|
|
70
|
+
<span className='sr-only'>{label}</span>
|
|
71
|
+
<X className={sizeClass} />
|
|
72
|
+
</Button>
|
|
73
|
+
</Tooltip.Trigger>
|
|
90
74
|
);
|
|
91
75
|
};
|
|
92
76
|
|
|
@@ -156,17 +140,9 @@ export const CommentContainer = ({
|
|
|
156
140
|
)}
|
|
157
141
|
>
|
|
158
142
|
{detached ? (
|
|
159
|
-
<Tooltip.
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
</Tooltip.Trigger>
|
|
163
|
-
<Tooltip.Portal>
|
|
164
|
-
<Tooltip.Content classNames='z-30' side='top'>
|
|
165
|
-
{t('detached thread label')}
|
|
166
|
-
<Tooltip.Arrow />
|
|
167
|
-
</Tooltip.Content>
|
|
168
|
-
</Tooltip.Portal>
|
|
169
|
-
</Tooltip.Root>
|
|
143
|
+
<Tooltip.Trigger asChild content={t('detached thread label')} side='top'>
|
|
144
|
+
<ThreadHeading detached>{thread.name}</ThreadHeading>
|
|
145
|
+
</Tooltip.Trigger>
|
|
170
146
|
) : (
|
|
171
147
|
<ThreadHeading>{thread.name}</ThreadHeading>
|
|
172
148
|
)}
|
|
@@ -14,7 +14,7 @@ import { faker } from '@dxos/random';
|
|
|
14
14
|
import { Filter, fullyQualifiedId, useQuery, useSpace } from '@dxos/react-client/echo';
|
|
15
15
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
16
16
|
import { type ClientRepeatedComponentProps, ClientRepeater } from '@dxos/react-client/testing';
|
|
17
|
-
import {
|
|
17
|
+
import { DataType } from '@dxos/schema';
|
|
18
18
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
19
19
|
|
|
20
20
|
import { CommentsContainer } from './CommentsContainer';
|
|
@@ -26,7 +26,7 @@ faker.seed(1);
|
|
|
26
26
|
const Story = ({ spaceKey }: ClientRepeatedComponentProps) => {
|
|
27
27
|
const identity = useIdentity();
|
|
28
28
|
const space = useSpace(spaceKey);
|
|
29
|
-
const threads = useQuery(space, Filter.
|
|
29
|
+
const threads = useQuery(space, Filter.type(ThreadType));
|
|
30
30
|
const [detached, setDetached] = useState<string[]>([]);
|
|
31
31
|
|
|
32
32
|
useEffect(() => {
|
|
@@ -54,18 +54,20 @@ const Story = ({ spaceKey }: ClientRepeatedComponentProps) => {
|
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
export const Default = {};
|
|
58
|
-
|
|
59
57
|
const meta: Meta = {
|
|
60
58
|
title: 'plugins/plugin-thread/Comments',
|
|
61
59
|
// TODO(wittjosiah): Use decorator.
|
|
62
|
-
render: () => <ClientRepeater component={Story} createIdentity createSpace types={[ThreadType,
|
|
60
|
+
render: () => <ClientRepeater component={Story} createIdentity createSpace types={[ThreadType, DataType.Message]} />,
|
|
63
61
|
decorators: [
|
|
64
62
|
withTheme,
|
|
65
|
-
withLayout({ fullscreen: true
|
|
66
|
-
withPluginManager({
|
|
63
|
+
withLayout({ fullscreen: true }),
|
|
64
|
+
withPluginManager({
|
|
65
|
+
plugins: [IntentPlugin()],
|
|
66
|
+
}),
|
|
67
67
|
],
|
|
68
68
|
parameters: { translations },
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export default meta;
|
|
72
|
+
|
|
73
|
+
export const Default = {};
|
|
@@ -8,7 +8,7 @@ import React, { useEffect } from 'react';
|
|
|
8
8
|
import { type ThreadType } from '@dxos/plugin-space/types';
|
|
9
9
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
10
10
|
import { useTranslation, Trans } from '@dxos/react-ui';
|
|
11
|
-
import {
|
|
11
|
+
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
12
12
|
|
|
13
13
|
import { CommentContainer } from './CommentContainer';
|
|
14
14
|
import { type ThreadContainerProps } from './types';
|
|
@@ -59,13 +59,7 @@ export const CommentsContainer = ({
|
|
|
59
59
|
);
|
|
60
60
|
})
|
|
61
61
|
) : (
|
|
62
|
-
<div
|
|
63
|
-
role='alert'
|
|
64
|
-
className={mx(
|
|
65
|
-
descriptionText,
|
|
66
|
-
'place-self-center border border-dashed border-unAccent rounded-lg text-center p-4 m-4',
|
|
67
|
-
)}
|
|
68
|
-
>
|
|
62
|
+
<div role='alert' className={mx(descriptionMessage, 'place-self-center rounded-lg text-center m-4')}>
|
|
69
63
|
<h2 className='mbe-2 font-medium text-baseText'>{t('no comments title')}</h2>
|
|
70
64
|
<p>
|
|
71
65
|
<Trans
|
|
@@ -9,7 +9,7 @@ import React, { forwardRef, useCallback, useEffect, useRef, useState } from 'rea
|
|
|
9
9
|
import { Surface } from '@dxos/app-framework';
|
|
10
10
|
import { RefArray } from '@dxos/live-object';
|
|
11
11
|
import { PublicKey } from '@dxos/react-client';
|
|
12
|
-
import { type
|
|
12
|
+
import { type AnyLiveObject, type Expando, type SpaceMember } from '@dxos/react-client/echo';
|
|
13
13
|
import { useIdentity, type Identity } from '@dxos/react-client/halo';
|
|
14
14
|
import { Button, ButtonGroup, Tooltip, useOnTransition, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
15
15
|
import { createBasicExtensions, createThemeExtensions, useTextEditor } from '@dxos/react-ui-editor';
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
mx,
|
|
22
22
|
} from '@dxos/react-ui-theme';
|
|
23
23
|
import { MessageHeading, MessageRoot } from '@dxos/react-ui-thread';
|
|
24
|
-
import { type
|
|
24
|
+
import { type DataType } from '@dxos/schema';
|
|
25
25
|
|
|
26
26
|
import { command } from './command-extension';
|
|
27
27
|
import { useOnEditAnalytics } from '../hooks';
|
|
@@ -31,17 +31,14 @@ import { getMessageMetadata } from '../util';
|
|
|
31
31
|
// TODO(thure): #8149
|
|
32
32
|
const messageControlClassNames = ['!p-1 !min-bs-0 transition-opacity', hoverableControlItem];
|
|
33
33
|
|
|
34
|
-
export
|
|
35
|
-
message
|
|
36
|
-
members,
|
|
37
|
-
editable = false,
|
|
38
|
-
onDelete,
|
|
39
|
-
}: {
|
|
40
|
-
message: MessageType;
|
|
34
|
+
export type MessageContainerProps = {
|
|
35
|
+
message: DataType.Message;
|
|
41
36
|
members: SpaceMember[];
|
|
42
37
|
editable?: boolean;
|
|
43
38
|
onDelete?: (id: string) => void;
|
|
44
|
-
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const MessageContainer = ({ message, members, editable = false, onDelete }: MessageContainerProps) => {
|
|
45
42
|
const senderIdentity = members.find(
|
|
46
43
|
(member) =>
|
|
47
44
|
(message.sender.identityDid && member.identity.did === message.sender.identityDid) ||
|
|
@@ -64,46 +61,30 @@ export const MessageContainer = ({
|
|
|
64
61
|
<MessageHeading authorName={messageMetadata.authorName} timestamp={messageMetadata.timestamp}>
|
|
65
62
|
<ButtonGroup classNames='mie-1'>
|
|
66
63
|
{userIsAuthor && editable && (
|
|
67
|
-
<Tooltip.
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</Tooltip.Trigger>
|
|
79
|
-
<Tooltip.Portal>
|
|
80
|
-
<Tooltip.Content>
|
|
81
|
-
{editLabel}
|
|
82
|
-
<Tooltip.Arrow />
|
|
83
|
-
</Tooltip.Content>
|
|
84
|
-
</Tooltip.Portal>
|
|
85
|
-
</Tooltip.Root>
|
|
64
|
+
<Tooltip.Trigger asChild content={editLabel}>
|
|
65
|
+
<Button
|
|
66
|
+
variant='ghost'
|
|
67
|
+
data-testid={editing ? 'thread.message.save' : 'thread.message.edit'}
|
|
68
|
+
classNames={messageControlClassNames}
|
|
69
|
+
onClick={() => setEditing((editing) => !editing)}
|
|
70
|
+
>
|
|
71
|
+
<span className='sr-only'>{editLabel}</span>
|
|
72
|
+
{editing ? <Check className={getSize(4)} /> : <PencilSimple className={getSize(4)} />}
|
|
73
|
+
</Button>
|
|
74
|
+
</Tooltip.Trigger>
|
|
86
75
|
)}
|
|
87
76
|
{onDelete && (
|
|
88
|
-
<Tooltip.
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</Tooltip.Trigger>
|
|
100
|
-
<Tooltip.Portal>
|
|
101
|
-
<Tooltip.Content>
|
|
102
|
-
{deleteLabel}
|
|
103
|
-
<Tooltip.Arrow />
|
|
104
|
-
</Tooltip.Content>
|
|
105
|
-
</Tooltip.Portal>
|
|
106
|
-
</Tooltip.Root>
|
|
77
|
+
<Tooltip.Trigger asChild content={deleteLabel}>
|
|
78
|
+
<Button
|
|
79
|
+
variant='ghost'
|
|
80
|
+
data-testid='thread.message.delete'
|
|
81
|
+
classNames={messageControlClassNames}
|
|
82
|
+
onClick={() => handleDelete()}
|
|
83
|
+
>
|
|
84
|
+
<span className='sr-only'>{deleteLabel}</span>
|
|
85
|
+
<X className={getSize(4)} />
|
|
86
|
+
</Button>
|
|
87
|
+
</Tooltip.Trigger>
|
|
107
88
|
)}
|
|
108
89
|
</ButtonGroup>
|
|
109
90
|
</MessageHeading>
|
|
@@ -124,7 +105,7 @@ const TextboxBlock = ({
|
|
|
124
105
|
isAuthor,
|
|
125
106
|
editing,
|
|
126
107
|
}: {
|
|
127
|
-
block:
|
|
108
|
+
block: DataType.MessageBlock.Text;
|
|
128
109
|
editing?: boolean;
|
|
129
110
|
isAuthor?: boolean;
|
|
130
111
|
identity?: Identity;
|
|
@@ -166,7 +147,7 @@ const TextboxBlock = ({
|
|
|
166
147
|
return <div role='none' ref={parentRef} className='mie-4' {...focusAttributes} />;
|
|
167
148
|
};
|
|
168
149
|
|
|
169
|
-
const MessageBlockObjectTile = forwardRef<HTMLDivElement, { subject:
|
|
150
|
+
const MessageBlockObjectTile = forwardRef<HTMLDivElement, { subject: AnyLiveObject<any> }>(
|
|
170
151
|
({ subject }, forwardedRef) => {
|
|
171
152
|
let title = subject.name ?? subject.title ?? subject.type ?? 'Object';
|
|
172
153
|
if (typeof title !== 'string') {
|
|
@@ -7,14 +7,14 @@ import { live, makeRef } from '@dxos/live-object';
|
|
|
7
7
|
import { ThreadType } from '@dxos/plugin-space/types';
|
|
8
8
|
import { faker } from '@dxos/random';
|
|
9
9
|
import { type Identity } from '@dxos/react-client/halo';
|
|
10
|
-
import {
|
|
10
|
+
import { DataType } from '@dxos/schema';
|
|
11
11
|
|
|
12
12
|
export const createCommentThread = (identity: Identity) => {
|
|
13
13
|
return live(ThreadType, {
|
|
14
14
|
messages: faker.helpers.multiple(
|
|
15
15
|
() =>
|
|
16
16
|
makeRef(
|
|
17
|
-
live(
|
|
17
|
+
live(DataType.Message, {
|
|
18
18
|
sender: {
|
|
19
19
|
identityDid: faker.datatype.boolean() ? identity.did : IdentityDid.random(),
|
|
20
20
|
},
|
package/src/components/types.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type AnyLiveObject } from '@dxos/client/echo';
|
|
6
6
|
import { type ThreadType } from '@dxos/plugin-space/types';
|
|
7
7
|
import { type ThreadProps } from '@dxos/react-ui-thread';
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ import { type ThreadProps } from '@dxos/react-ui-thread';
|
|
|
20
20
|
*/
|
|
21
21
|
export type ThreadContainerProps = {
|
|
22
22
|
thread: ThreadType;
|
|
23
|
-
context?:
|
|
23
|
+
context?: AnyLiveObject<any>;
|
|
24
24
|
autoFocusTextbox?: boolean;
|
|
25
25
|
onTextboxFocus?: () => void;
|
|
26
26
|
detached?: boolean;
|
package/src/hooks/analytics.ts
CHANGED
|
@@ -9,9 +9,13 @@ import { type Live } from '@dxos/live-object';
|
|
|
9
9
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
10
10
|
import { getSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { useOnTransition } from '@dxos/react-ui';
|
|
12
|
-
import { type
|
|
12
|
+
import { type DataType } from '@dxos/schema';
|
|
13
13
|
|
|
14
|
-
export const useOnEditAnalytics = (
|
|
14
|
+
export const useOnEditAnalytics = (
|
|
15
|
+
message: Live<any>,
|
|
16
|
+
textBlock: DataType.MessageBlock.Text | undefined,
|
|
17
|
+
editing: boolean,
|
|
18
|
+
) => {
|
|
15
19
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
16
20
|
|
|
17
21
|
const onEdit = useCallback(() => {
|
package/src/translations.ts
CHANGED
|
@@ -27,9 +27,9 @@ export default [
|
|
|
27
27
|
'comments heading': 'Comments',
|
|
28
28
|
'chat heading': 'Chat',
|
|
29
29
|
'draft button': 'DRAFT',
|
|
30
|
-
'no comments title': '
|
|
30
|
+
'no comments title': 'Comments',
|
|
31
31
|
'no comments message':
|
|
32
|
-
'
|
|
32
|
+
'Click on the <commentIcon></commentIcon> button in the document toolbar to create a comment thread on the selected text.',
|
|
33
33
|
'toggle show resolved': 'Show resolved',
|
|
34
34
|
'unnamed object threads label': 'Threads',
|
|
35
35
|
'mark as resolved label': 'Mark as resolved',
|
package/src/types.ts
CHANGED
|
@@ -2,86 +2,86 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { Type } from '@dxos/echo';
|
|
6
8
|
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
7
9
|
import { EchoObjectSchema } from '@dxos/react-client/echo';
|
|
8
|
-
import {
|
|
10
|
+
import { DataType } from '@dxos/schema';
|
|
9
11
|
|
|
10
12
|
import { THREAD_PLUGIN } from './meta';
|
|
11
13
|
|
|
12
14
|
export namespace ThreadAction {
|
|
13
15
|
const THREAD_ACTION = `${THREAD_PLUGIN}/action`;
|
|
14
16
|
|
|
15
|
-
export class CreateChannel extends
|
|
16
|
-
input:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name: S.optional(S.String),
|
|
17
|
+
export class CreateChannel extends Schema.TaggedClass<CreateChannel>()(`${THREAD_ACTION}/create-channel`, {
|
|
18
|
+
input: Schema.Struct({
|
|
19
|
+
spaceId: Type.SpaceId,
|
|
20
|
+
name: Schema.optional(Schema.String),
|
|
20
21
|
}),
|
|
21
|
-
output:
|
|
22
|
+
output: Schema.Struct({
|
|
22
23
|
object: ChannelType,
|
|
23
24
|
}),
|
|
24
25
|
}) {}
|
|
25
26
|
|
|
26
|
-
export class Create extends
|
|
27
|
-
input:
|
|
28
|
-
name:
|
|
29
|
-
cursor:
|
|
27
|
+
export class Create extends Schema.TaggedClass<Create>()(`${THREAD_ACTION}/create`, {
|
|
28
|
+
input: Schema.Struct({
|
|
29
|
+
name: Schema.optional(Schema.String),
|
|
30
|
+
cursor: Schema.String,
|
|
30
31
|
subject: EchoObjectSchema,
|
|
31
32
|
}),
|
|
32
|
-
output:
|
|
33
|
+
output: Schema.Struct({
|
|
33
34
|
object: ThreadType,
|
|
34
35
|
}),
|
|
35
36
|
}) {}
|
|
36
37
|
|
|
37
|
-
export class
|
|
38
|
-
input:
|
|
39
|
-
|
|
38
|
+
export class Delete extends Schema.TaggedClass<Delete>()(`${THREAD_ACTION}/delete`, {
|
|
39
|
+
input: Schema.Struct({
|
|
40
|
+
thread: ThreadType,
|
|
41
|
+
subject: EchoObjectSchema,
|
|
42
|
+
cursor: Schema.optional(Schema.String),
|
|
40
43
|
}),
|
|
41
|
-
output:
|
|
44
|
+
output: Schema.Void,
|
|
42
45
|
}) {}
|
|
43
46
|
|
|
44
|
-
export class
|
|
45
|
-
input:
|
|
46
|
-
|
|
47
|
+
export class Select extends Schema.TaggedClass<Select>()(`${THREAD_ACTION}/select`, {
|
|
48
|
+
input: Schema.Struct({
|
|
49
|
+
current: Schema.String,
|
|
47
50
|
}),
|
|
48
|
-
output:
|
|
51
|
+
output: Schema.Void,
|
|
49
52
|
}) {}
|
|
50
53
|
|
|
51
|
-
export class
|
|
52
|
-
input:
|
|
54
|
+
export class ToggleResolved extends Schema.TaggedClass<ToggleResolved>()(`${THREAD_ACTION}/toggle-resolved`, {
|
|
55
|
+
input: Schema.Struct({
|
|
53
56
|
thread: ThreadType,
|
|
54
|
-
subject: EchoObjectSchema,
|
|
55
|
-
cursor: S.optional(S.String),
|
|
56
57
|
}),
|
|
57
|
-
output:
|
|
58
|
+
output: Schema.Void,
|
|
58
59
|
}) {}
|
|
59
60
|
|
|
60
|
-
export class AddMessage extends
|
|
61
|
-
input:
|
|
61
|
+
export class AddMessage extends Schema.TaggedClass<AddMessage>()(`${THREAD_ACTION}/add-message`, {
|
|
62
|
+
input: Schema.Struct({
|
|
62
63
|
subject: EchoObjectSchema,
|
|
63
64
|
thread: ThreadType,
|
|
64
|
-
sender:
|
|
65
|
-
text:
|
|
65
|
+
sender: DataType.Actor,
|
|
66
|
+
text: Schema.String,
|
|
66
67
|
}),
|
|
67
|
-
output:
|
|
68
|
+
output: Schema.Void,
|
|
68
69
|
}) {}
|
|
69
70
|
|
|
70
|
-
export class DeleteMessage extends
|
|
71
|
-
input:
|
|
71
|
+
export class DeleteMessage extends Schema.TaggedClass<DeleteMessage>()(`${THREAD_ACTION}/delete-message`, {
|
|
72
|
+
input: Schema.Struct({
|
|
72
73
|
thread: ThreadType,
|
|
73
74
|
subject: EchoObjectSchema,
|
|
74
|
-
messageId:
|
|
75
|
-
message:
|
|
76
|
-
messageIndex:
|
|
75
|
+
messageId: Schema.String,
|
|
76
|
+
message: Schema.optional(DataType.Message),
|
|
77
|
+
messageIndex: Schema.optional(Schema.Number),
|
|
77
78
|
}),
|
|
78
|
-
output:
|
|
79
|
+
output: Schema.Void,
|
|
79
80
|
}) {}
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
export const ThreadSettingsSchema =
|
|
83
|
-
|
|
84
|
-
export type ThreadSettingsProps = S.Schema.Type<typeof ThreadSettingsSchema>;
|
|
83
|
+
export const ThreadSettingsSchema = Schema.mutable(Schema.Struct({}));
|
|
84
|
+
export type ThreadSettingsProps = Schema.Schema.Type<typeof ThreadSettingsSchema>;
|
|
85
85
|
|
|
86
86
|
export interface ThreadModel {
|
|
87
87
|
root: ThreadType;
|