@dxos/plugin-thread 0.8.1-main.ae460ac → 0.8.1-staging.31c3ee1
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-IOOAQW6S.mjs +138 -0
- package/dist/lib/browser/ChatContainer-IOOAQW6S.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-6W4UKJDI.mjs +41 -0
- package/dist/lib/browser/app-graph-builder-6W4UKJDI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NAO3LZMZ.mjs → chunk-EP6MRLY7.mjs} +2 -2
- package/dist/lib/browser/{chunk-BNEWNQBO.mjs → chunk-QDJ3Y6WF.mjs} +14 -19
- package/dist/lib/browser/{chunk-BNEWNQBO.mjs.map → chunk-QDJ3Y6WF.mjs.map} +3 -3
- package/dist/lib/browser/chunk-S5ZR4FYW.mjs +17 -0
- package/dist/lib/browser/chunk-S5ZR4FYW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UPKU23DA.mjs → chunk-TFVPUPOO.mjs} +35 -140
- package/dist/lib/browser/chunk-TFVPUPOO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-636QDHE3.mjs → chunk-WBJLUUOK.mjs} +1 -1
- package/dist/lib/browser/{chunk-636QDHE3.mjs.map → chunk-WBJLUUOK.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-YK3ICB7G.mjs → chunk-WOG72DWE.mjs} +25 -11
- package/dist/lib/browser/chunk-WOG72DWE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +47 -49
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-FAFQ54NP.mjs → intent-resolver-QAY4FLLM.mjs} +134 -94
- package/dist/lib/browser/intent-resolver-QAY4FLLM.mjs.map +7 -0
- package/dist/lib/browser/{markdown-RPYOUBVR.mjs → markdown-7KXBXCUS.mjs} +9 -10
- package/dist/lib/browser/markdown-7KXBXCUS.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-Y4MUSICN.mjs → react-surface-MT3OWULR.mjs} +55 -51
- package/dist/lib/browser/react-surface-MT3OWULR.mjs.map +7 -0
- package/dist/lib/browser/{settings-WQTE5AEZ.mjs → settings-4FEC7EAX.mjs} +3 -3
- package/dist/lib/browser/{state-GNFUURIC.mjs → state-PNMSLKAH.mjs} +4 -3
- package/dist/lib/browser/state-PNMSLKAH.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/ChatContainer-4FNDRF3G.cjs +163 -0
- package/dist/lib/node/ChatContainer-4FNDRF3G.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-HZNWT4QU.cjs +57 -0
- package/dist/lib/node/app-graph-builder-HZNWT4QU.cjs.map +7 -0
- package/dist/lib/node/{chunk-CMEMMYDL.cjs → chunk-46BSFPBV.cjs} +29 -15
- package/dist/lib/node/chunk-46BSFPBV.cjs.map +7 -0
- package/dist/lib/node/{chunk-AWSTZ2KN.cjs → chunk-AKINTFBH.cjs} +17 -23
- package/dist/lib/node/chunk-AKINTFBH.cjs.map +7 -0
- package/dist/lib/node/chunk-E7Z3BKRQ.cjs +232 -0
- package/dist/lib/node/chunk-E7Z3BKRQ.cjs.map +7 -0
- package/dist/lib/node/{chunk-FPWNZ6TB.cjs → chunk-NQ5DTPOY.cjs} +7 -7
- package/dist/lib/node/{chunk-F735VMTN.cjs → chunk-ONLWOUYZ.cjs} +4 -4
- package/dist/lib/node/{chunk-F735VMTN.cjs.map → chunk-ONLWOUYZ.cjs.map} +2 -2
- package/dist/lib/node/{chunk-BHFHFTHO.cjs → chunk-S2A6BXEA.cjs} +12 -9
- package/dist/lib/node/chunk-S2A6BXEA.cjs.map +7 -0
- package/dist/lib/node/index.cjs +78 -83
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{intent-resolver-DVBEXJ33.cjs → intent-resolver-S6FE5OR7.cjs} +153 -113
- package/dist/lib/node/intent-resolver-S6FE5OR7.cjs.map +7 -0
- package/dist/lib/node/{markdown-ELRGISXE.cjs → markdown-L2WMCQKM.cjs} +13 -14
- package/dist/lib/node/markdown-L2WMCQKM.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-7HLTN5XS.cjs → react-surface-Z45BYECE.cjs} +68 -64
- package/dist/lib/node/react-surface-Z45BYECE.cjs.map +7 -0
- package/dist/lib/node/{settings-7VQYARM5.cjs → settings-IXCPE55J.cjs} +8 -8
- package/dist/lib/node/{state-TQWEZ6B3.cjs → state-AT73KPGZ.cjs} +8 -7
- package/dist/lib/node/state-AT73KPGZ.cjs.map +7 -0
- package/dist/lib/node/types.cjs +4 -4
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/ChatContainer-NYLCL6QA.mjs +139 -0
- package/dist/lib/node-esm/ChatContainer-NYLCL6QA.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-M3KK5QJH.mjs +42 -0
- package/dist/lib/node-esm/app-graph-builder-M3KK5QJH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FXUATCLW.mjs → chunk-42F2DTMM.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-FXUATCLW.mjs.map → chunk-42F2DTMM.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-CISLDOH7.mjs → chunk-ADTVMESP.mjs} +35 -140
- package/dist/lib/node-esm/chunk-ADTVMESP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-33NDMQQQ.mjs → chunk-E446MGLP.mjs} +25 -11
- package/dist/lib/node-esm/chunk-E446MGLP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HLWJTUWZ.mjs → chunk-J56FORYF.mjs} +14 -19
- package/dist/lib/node-esm/{chunk-HLWJTUWZ.mjs.map → chunk-J56FORYF.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-ZJITX3TO.mjs → chunk-WLY2HMDB.mjs} +2 -2
- package/dist/lib/node-esm/chunk-WSE23GSG.mjs +19 -0
- package/dist/lib/node-esm/chunk-WSE23GSG.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +47 -49
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-DHVLBNCC.mjs → intent-resolver-OURFRSSF.mjs} +134 -94
- package/dist/lib/node-esm/intent-resolver-OURFRSSF.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-23OB7EZG.mjs → markdown-ZKU23UVD.mjs} +9 -10
- package/dist/lib/node-esm/markdown-ZKU23UVD.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-AZHTTR6J.mjs → react-surface-KIJ767JK.mjs} +55 -51
- package/dist/lib/node-esm/react-surface-KIJ767JK.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-SGMM7UDT.mjs → settings-ZUJQ4LWI.mjs} +3 -3
- package/dist/lib/node-esm/{state-7MLR27YG.mjs → state-SSDX5O67.mjs} +4 -3
- package/dist/lib/node-esm/state-SSDX5O67.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +2 -2
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +177 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.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 +10 -2
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentContainer.d.ts +2 -1
- package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
- package/dist/types/src/components/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts +2 -1
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts +5 -3
- package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts +2 -1
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
- package/dist/types/src/components/ThreadSettings.d.ts +2 -1
- package/dist/types/src/components/ThreadSettings.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +45 -40
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +4 -0
- package/dist/types/src/events.d.ts.map +1 -0
- 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/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -7
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +40 -9
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +33 -30
- package/src/ThreadPlugin.tsx +17 -28
- package/src/capabilities/app-graph-builder.ts +34 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +97 -61
- package/src/capabilities/react-surface.tsx +29 -27
- package/src/capabilities/state.ts +1 -1
- package/src/components/Chat.stories.tsx +19 -9
- package/src/components/ChatContainer.tsx +29 -29
- package/src/components/CommentContainer.tsx +8 -2
- package/src/components/Comments.stories.tsx +2 -1
- package/src/components/MessageContainer.tsx +23 -17
- package/src/components/ThreadComplementary.tsx +26 -32
- package/src/components/index.ts +1 -2
- package/src/components/testing.ts +6 -29
- package/src/events.ts +11 -0
- package/src/extensions/threads.ts +3 -3
- package/src/hooks/analytics.ts +23 -18
- package/src/index.ts +2 -0
- package/src/meta.ts +2 -2
- package/src/translations.ts +2 -4
- package/src/types.ts +22 -8
- package/src/util.ts +1 -1
- package/dist/lib/browser/ThreadContainer-6OP5AG2W.mjs +0 -19
- package/dist/lib/browser/ThreadContainer-6OP5AG2W.mjs.map +0 -7
- package/dist/lib/browser/chunk-UPKU23DA.mjs.map +0 -7
- package/dist/lib/browser/chunk-VOMIDDNO.mjs +0 -15
- package/dist/lib/browser/chunk-VOMIDDNO.mjs.map +0 -7
- package/dist/lib/browser/chunk-YK3ICB7G.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-FAFQ54NP.mjs.map +0 -7
- package/dist/lib/browser/markdown-RPYOUBVR.mjs.map +0 -7
- package/dist/lib/browser/react-surface-Y4MUSICN.mjs.map +0 -7
- package/dist/lib/browser/state-GNFUURIC.mjs.map +0 -7
- package/dist/lib/node/ThreadContainer-LTKKLPXX.cjs +0 -45
- package/dist/lib/node/ThreadContainer-LTKKLPXX.cjs.map +0 -7
- package/dist/lib/node/chunk-AWSTZ2KN.cjs.map +0 -7
- package/dist/lib/node/chunk-BHFHFTHO.cjs.map +0 -7
- package/dist/lib/node/chunk-CMEMMYDL.cjs.map +0 -7
- package/dist/lib/node/chunk-RQR5Z23G.cjs +0 -331
- package/dist/lib/node/chunk-RQR5Z23G.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-DVBEXJ33.cjs.map +0 -7
- package/dist/lib/node/markdown-ELRGISXE.cjs.map +0 -7
- package/dist/lib/node/react-surface-7HLTN5XS.cjs.map +0 -7
- package/dist/lib/node/state-TQWEZ6B3.cjs.map +0 -7
- package/dist/lib/node-esm/ThreadContainer-SV74JFRH.mjs +0 -20
- package/dist/lib/node-esm/ThreadContainer-SV74JFRH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-33NDMQQQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CISLDOH7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PJPVEO7E.mjs +0 -17
- package/dist/lib/node-esm/chunk-PJPVEO7E.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DHVLBNCC.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-23OB7EZG.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-AZHTTR6J.mjs.map +0 -7
- package/dist/lib/node-esm/state-7MLR27YG.mjs.map +0 -7
- package/dist/types/src/components/ThreadContainer.d.ts +0 -7
- package/dist/types/src/components/ThreadContainer.d.ts.map +0 -1
- package/src/components/ThreadContainer.tsx +0 -22
- /package/dist/lib/browser/{chunk-NAO3LZMZ.mjs.map → chunk-EP6MRLY7.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-WQTE5AEZ.mjs.map → settings-4FEC7EAX.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-FPWNZ6TB.cjs.map → chunk-NQ5DTPOY.cjs.map} +0 -0
- /package/dist/lib/node/{settings-7VQYARM5.cjs.map → settings-IXCPE55J.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-ZJITX3TO.mjs.map → chunk-WLY2HMDB.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-SGMM7UDT.mjs.map → settings-ZUJQ4LWI.mjs.map} +0 -0
|
@@ -8,7 +8,6 @@ import React, { forwardRef, useCallback, useEffect, useRef, useState } from 'rea
|
|
|
8
8
|
|
|
9
9
|
import { Surface } from '@dxos/app-framework';
|
|
10
10
|
import { RefArray } from '@dxos/live-object';
|
|
11
|
-
import { type MessageType } from '@dxos/plugin-space/types';
|
|
12
11
|
import { PublicKey } from '@dxos/react-client';
|
|
13
12
|
import { type ReactiveEchoObject, type Expando, type SpaceMember } from '@dxos/react-client/echo';
|
|
14
13
|
import { useIdentity, type Identity } from '@dxos/react-client/halo';
|
|
@@ -22,6 +21,7 @@ import {
|
|
|
22
21
|
mx,
|
|
23
22
|
} from '@dxos/react-ui-theme';
|
|
24
23
|
import { MessageHeading, MessageRoot } from '@dxos/react-ui-thread';
|
|
24
|
+
import { type TextContentBlock, type MessageType } from '@dxos/schema';
|
|
25
25
|
|
|
26
26
|
import { command } from './command-extension';
|
|
27
27
|
import { useOnEditAnalytics } from '../hooks';
|
|
@@ -34,28 +34,36 @@ const messageControlClassNames = ['!p-1 !min-bs-0 transition-opacity', hoverable
|
|
|
34
34
|
export const MessageContainer = ({
|
|
35
35
|
message,
|
|
36
36
|
members,
|
|
37
|
+
editable = false,
|
|
37
38
|
onDelete,
|
|
38
39
|
}: {
|
|
39
40
|
message: MessageType;
|
|
40
41
|
members: SpaceMember[];
|
|
42
|
+
editable?: boolean;
|
|
41
43
|
onDelete?: (id: string) => void;
|
|
42
44
|
}) => {
|
|
43
45
|
const senderIdentity = members.find(
|
|
44
|
-
(member) =>
|
|
46
|
+
(member) =>
|
|
47
|
+
(message.sender.identityDid && member.identity.did === message.sender.identityDid) ||
|
|
48
|
+
(message.sender.identityKey && PublicKey.equals(member.identity.identityKey, message.sender.identityKey)),
|
|
45
49
|
)?.identity;
|
|
46
50
|
const messageMetadata = getMessageMetadata(message.id, senderIdentity);
|
|
47
|
-
const userIsAuthor = useIdentity()?.
|
|
51
|
+
const userIsAuthor = useIdentity()?.did === messageMetadata.authorId;
|
|
48
52
|
const [editing, setEditing] = useState(false);
|
|
49
53
|
const handleDelete = useCallback(() => onDelete?.(message.id), [message, onDelete]);
|
|
50
54
|
const { t } = useTranslation(THREAD_PLUGIN);
|
|
51
55
|
const editLabel = t(editing ? 'save message label' : 'edit message label');
|
|
52
56
|
const deleteLabel = t('delete message label');
|
|
57
|
+
const textBlock = message.blocks.find((block) => block.type === 'text');
|
|
58
|
+
const references = message.blocks.filter((block) => block.type === 'reference').map((block) => block.reference);
|
|
59
|
+
|
|
60
|
+
useOnEditAnalytics(message, textBlock, !!editing);
|
|
53
61
|
|
|
54
62
|
return (
|
|
55
63
|
<MessageRoot {...messageMetadata} classNames={[hoverableControls, hoverableFocusedWithinControls]}>
|
|
56
64
|
<MessageHeading authorName={messageMetadata.authorName} timestamp={messageMetadata.timestamp}>
|
|
57
65
|
<ButtonGroup classNames='mie-1'>
|
|
58
|
-
{userIsAuthor && (
|
|
66
|
+
{userIsAuthor && editable && (
|
|
59
67
|
<Tooltip.Root>
|
|
60
68
|
<Tooltip.Trigger asChild>
|
|
61
69
|
<Button
|
|
@@ -99,9 +107,9 @@ export const MessageContainer = ({
|
|
|
99
107
|
)}
|
|
100
108
|
</ButtonGroup>
|
|
101
109
|
</MessageHeading>
|
|
102
|
-
<TextboxBlock
|
|
103
|
-
{RefArray.
|
|
104
|
-
<MessagePart key={index} part={
|
|
110
|
+
{textBlock && <TextboxBlock block={textBlock} isAuthor={userIsAuthor} editing={editing} />}
|
|
111
|
+
{RefArray.targets(references).map((reference, index) => (
|
|
112
|
+
<MessagePart key={index} part={reference} />
|
|
105
113
|
))}
|
|
106
114
|
</MessageRoot>
|
|
107
115
|
);
|
|
@@ -112,33 +120,33 @@ const MessagePart = ({ part }: { part: Expando }) => {
|
|
|
112
120
|
};
|
|
113
121
|
|
|
114
122
|
const TextboxBlock = ({
|
|
115
|
-
|
|
123
|
+
block,
|
|
116
124
|
isAuthor,
|
|
117
125
|
editing,
|
|
118
126
|
}: {
|
|
119
|
-
|
|
127
|
+
block: TextContentBlock;
|
|
120
128
|
editing?: boolean;
|
|
121
129
|
isAuthor?: boolean;
|
|
122
130
|
identity?: Identity;
|
|
123
131
|
}) => {
|
|
124
132
|
const { themeMode } = useThemeContext();
|
|
125
|
-
const inMemoryContentRef = useRef(
|
|
133
|
+
const inMemoryContentRef = useRef(block.text);
|
|
126
134
|
|
|
127
135
|
const handleDocumentChange = useCallback((newState: string) => {
|
|
128
136
|
inMemoryContentRef.current = newState;
|
|
129
137
|
}, []);
|
|
130
138
|
|
|
131
139
|
const saveDocumentChange = useCallback(() => {
|
|
132
|
-
|
|
133
|
-
}, [
|
|
140
|
+
block.text = inMemoryContentRef.current;
|
|
141
|
+
}, [block]);
|
|
134
142
|
|
|
135
143
|
useOnTransition(editing, true, false, saveDocumentChange);
|
|
136
144
|
|
|
137
145
|
const { parentRef, focusAttributes, view } = useTextEditor(
|
|
138
146
|
() => ({
|
|
139
|
-
initialValue:
|
|
147
|
+
initialValue: block.text,
|
|
140
148
|
extensions: [
|
|
141
|
-
createBasicExtensions({
|
|
149
|
+
createBasicExtensions({ readOnly: !isAuthor || !editing }),
|
|
142
150
|
createThemeExtensions({ themeMode }),
|
|
143
151
|
command,
|
|
144
152
|
EditorView.updateListener.of((update) => {
|
|
@@ -148,15 +156,13 @@ const TextboxBlock = ({
|
|
|
148
156
|
}),
|
|
149
157
|
],
|
|
150
158
|
}),
|
|
151
|
-
[
|
|
159
|
+
[block.text, editing, isAuthor, themeMode, handleDocumentChange],
|
|
152
160
|
);
|
|
153
161
|
|
|
154
162
|
useEffect(() => {
|
|
155
163
|
editing && view?.focus();
|
|
156
164
|
}, [editing, view]);
|
|
157
165
|
|
|
158
|
-
useOnEditAnalytics(message, !!editing);
|
|
159
|
-
|
|
160
166
|
return <div role='none' ref={parentRef} className='mie-4' {...focusAttributes} />;
|
|
161
167
|
};
|
|
162
168
|
|
|
@@ -6,11 +6,12 @@ import React, { useCallback, useEffect, useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { createIntent, LayoutAction, useCapability, useCapabilities, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { ThreadCapabilities } from '@dxos/plugin-space';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { type ThreadType } from '@dxos/plugin-space/types';
|
|
10
|
+
import { fullyQualifiedId, RefArray } from '@dxos/react-client/echo';
|
|
11
11
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
12
12
|
import { useTranslation } from '@dxos/react-ui';
|
|
13
13
|
import { useAttended } from '@dxos/react-ui-attention';
|
|
14
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
14
15
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
15
16
|
import { isNonNullable } from '@dxos/util';
|
|
16
17
|
|
|
@@ -42,7 +43,7 @@ export const ThreadComplementary = ({ subject }: { subject: any }) => {
|
|
|
42
43
|
);
|
|
43
44
|
const sort = useMemo(() => createSort?.(subject), [createSort, subject]);
|
|
44
45
|
|
|
45
|
-
const threadObjects = RefArray.
|
|
46
|
+
const threadObjects = RefArray.targets(subject.threads ?? []);
|
|
46
47
|
|
|
47
48
|
const threads = useMemo(() => {
|
|
48
49
|
return threadObjects.concat(drafts ?? []).filter(isNonNullable) as ThreadType[];
|
|
@@ -87,21 +88,11 @@ export const ThreadComplementary = ({ subject }: { subject: any }) => {
|
|
|
87
88
|
);
|
|
88
89
|
|
|
89
90
|
const handleComment = useCallback(
|
|
90
|
-
async (thread: ThreadType,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
create(MessageType, {
|
|
94
|
-
sender: { identityKey: identity?.identityKey.toHex() },
|
|
95
|
-
timestamp: new Date().toISOString(),
|
|
96
|
-
text: message,
|
|
97
|
-
// TODO(wittjosiah): Context based on attention.
|
|
98
|
-
// context: context ? makeRef(context) : undefined,
|
|
99
|
-
}),
|
|
100
|
-
),
|
|
91
|
+
async (thread: ThreadType, text: string) => {
|
|
92
|
+
await dispatch(
|
|
93
|
+
createIntent(ThreadAction.AddMessage, { thread, subject, sender: { identityDid: identity?.did }, text }),
|
|
101
94
|
);
|
|
102
95
|
|
|
103
|
-
await dispatch(createIntent(ThreadAction.OnMessageAdd, { thread, subject }));
|
|
104
|
-
|
|
105
96
|
state.current = fullyQualifiedId(thread);
|
|
106
97
|
},
|
|
107
98
|
[dispatch, identity, subject],
|
|
@@ -138,21 +129,24 @@ export const ThreadComplementary = ({ subject }: { subject: any }) => {
|
|
|
138
129
|
);
|
|
139
130
|
|
|
140
131
|
return (
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
132
|
+
<StackItem.Content toolbar>
|
|
133
|
+
<Tabs.Root
|
|
134
|
+
value={showResolvedThreads ? 'all' : 'unresolved'}
|
|
135
|
+
onValueChange={onChangeViewState}
|
|
136
|
+
orientation='horizontal'
|
|
137
|
+
classNames='contents [&_[role="tabpanel"]]:min-bs-0 [&_[role="tabpanel"]]:overflow-y-auto [&_[role="tabpanel"]]:scrollbar-thin'
|
|
138
|
+
>
|
|
139
|
+
<Tabs.Tablist classNames='p-1 gap-1 bs-[--rail-action] border-be border-separator'>
|
|
140
|
+
<Tabs.Tab value='unresolved' classNames='text-sm'>
|
|
141
|
+
{t('show unresolved label')}
|
|
142
|
+
</Tabs.Tab>
|
|
143
|
+
<Tabs.Tab value='all' classNames='text-sm'>
|
|
144
|
+
{t('show all label')}
|
|
145
|
+
</Tabs.Tab>
|
|
146
|
+
</Tabs.Tablist>
|
|
147
|
+
<Tabs.Tabpanel value='all'>{showResolvedThreads && comments}</Tabs.Tabpanel>
|
|
148
|
+
<Tabs.Tabpanel value='unresolved'>{!showResolvedThreads && comments}</Tabs.Tabpanel>
|
|
149
|
+
</Tabs.Root>
|
|
150
|
+
</StackItem.Content>
|
|
157
151
|
);
|
|
158
152
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
8
8
|
|
|
9
9
|
// TODO(wittjosiah): Suspense boundary for sidebar?
|
|
10
10
|
export * from './CommentContainer';
|
|
11
11
|
export * from './CommentsContainer';
|
|
12
|
-
export * from './ChatContainer';
|
|
13
12
|
export * from './MessageContainer';
|
|
14
13
|
export * from './ThreadComplementary';
|
|
15
14
|
export * from './ThreadSettings';
|
|
@@ -2,35 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { PublicKey } from '@dxos/keys';
|
|
5
|
+
import { IdentityDid } from '@dxos/keys';
|
|
7
6
|
import { create, makeRef } from '@dxos/live-object';
|
|
8
|
-
import {
|
|
7
|
+
import { ThreadType } from '@dxos/plugin-space/types';
|
|
9
8
|
import { faker } from '@dxos/random';
|
|
10
9
|
import { type Identity } from '@dxos/react-client/halo';
|
|
11
|
-
|
|
12
|
-
export const createChatThread = (identity: Identity) => {
|
|
13
|
-
return create(ThreadType, {
|
|
14
|
-
messages: Array.from({ length: 8 }).map(() =>
|
|
15
|
-
makeRef(
|
|
16
|
-
create(MessageType, {
|
|
17
|
-
sender: {
|
|
18
|
-
identityKey: faker.datatype.boolean() ? identity.identityKey.toHex() : PublicKey.random().toHex(),
|
|
19
|
-
},
|
|
20
|
-
timestamp: faker.date.recent().toISOString(),
|
|
21
|
-
text: faker.lorem.sentences(3),
|
|
22
|
-
parts: faker.helpers.multiple(
|
|
23
|
-
() =>
|
|
24
|
-
faker.datatype.boolean({ probability: 0.8 })
|
|
25
|
-
? undefined
|
|
26
|
-
: (makeRef(create(Expando, { name: faker.lorem.sentence() })) as any), // TODO(dmaretskyi): Fix types in schema.
|
|
27
|
-
{ count: { min: 1, max: 3 } },
|
|
28
|
-
),
|
|
29
|
-
}),
|
|
30
|
-
),
|
|
31
|
-
),
|
|
32
|
-
});
|
|
33
|
-
};
|
|
10
|
+
import { MessageType } from '@dxos/schema';
|
|
34
11
|
|
|
35
12
|
export const createCommentThread = (identity: Identity) => {
|
|
36
13
|
return create(ThreadType, {
|
|
@@ -39,10 +16,10 @@ export const createCommentThread = (identity: Identity) => {
|
|
|
39
16
|
makeRef(
|
|
40
17
|
create(MessageType, {
|
|
41
18
|
sender: {
|
|
42
|
-
|
|
19
|
+
identityDid: faker.datatype.boolean() ? identity.did : IdentityDid.random(),
|
|
43
20
|
},
|
|
44
|
-
|
|
45
|
-
text: faker.lorem.sentences(3),
|
|
21
|
+
created: new Date().toISOString(),
|
|
22
|
+
blocks: [{ type: 'text', text: faker.lorem.sentences(3) }],
|
|
46
23
|
}),
|
|
47
24
|
),
|
|
48
25
|
{ count: { min: 2, max: 3 } },
|
package/src/events.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Events } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { THREAD_PLUGIN } from './meta';
|
|
8
|
+
|
|
9
|
+
export namespace ThreadEvents {
|
|
10
|
+
export const SetupActivity = Events.createStateEvent(`${THREAD_PLUGIN}/setup-activity`);
|
|
11
|
+
}
|
|
@@ -37,7 +37,7 @@ export const threads = (state: ThreadState, doc?: DocumentType, dispatch?: Promi
|
|
|
37
37
|
|
|
38
38
|
// TODO(Zan): When we have the deepsignal specific equivalent of this we should use that instead.
|
|
39
39
|
const threads = computed(() =>
|
|
40
|
-
[...RefArray.
|
|
40
|
+
[...RefArray.targets(doc.threads), ...(state.drafts[fullyQualifiedId(doc)] ?? [])].filter(
|
|
41
41
|
(thread) => !(thread?.status === 'resolved'),
|
|
42
42
|
),
|
|
43
43
|
);
|
|
@@ -45,7 +45,7 @@ export const threads = (state: ThreadState, doc?: DocumentType, dispatch?: Promi
|
|
|
45
45
|
return [
|
|
46
46
|
EditorView.updateListener.of((update) => {
|
|
47
47
|
if (update.docChanged) {
|
|
48
|
-
RefArray.
|
|
48
|
+
RefArray.targets(doc.threads).forEach((thread) => {
|
|
49
49
|
if (thread.anchor) {
|
|
50
50
|
// Only update if the name has changed, otherwise this will cause an infinite loop.
|
|
51
51
|
// Skip if the name is empty; this means comment text was deleted, but thread name should remain.
|
|
@@ -100,7 +100,7 @@ export const threads = (state: ThreadState, doc?: DocumentType, dispatch?: Promi
|
|
|
100
100
|
onSelect: ({ selection }) => {
|
|
101
101
|
const current = selection.current ?? selection.closest;
|
|
102
102
|
if (current) {
|
|
103
|
-
void dispatch(createIntent(ThreadAction.Select, { current
|
|
103
|
+
void dispatch(createIntent(ThreadAction.Select, { current }));
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
}),
|
package/src/hooks/analytics.ts
CHANGED
|
@@ -9,27 +9,32 @@ import { type ReactiveObject } 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 TextContentBlock } from '@dxos/schema';
|
|
12
13
|
|
|
13
|
-
export const
|
|
14
|
+
export const useOnEditAnalytics = (
|
|
15
|
+
message: ReactiveObject<any>,
|
|
16
|
+
textBlock: TextContentBlock | undefined,
|
|
17
|
+
editing: boolean,
|
|
18
|
+
) => {
|
|
14
19
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
[dispatch, name, meta, spaceId],
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const useOnEditAnalytics = (message: ReactiveObject<any>, editing: boolean) => {
|
|
27
|
-
const space = getSpace(message);
|
|
21
|
+
const onEdit = useCallback(() => {
|
|
22
|
+
const space = getSpace(message);
|
|
23
|
+
if (!space || !textBlock) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
void dispatch(
|
|
28
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
29
|
+
name: 'threads.message.update',
|
|
30
|
+
properties: {
|
|
31
|
+
spaceId: space.id,
|
|
32
|
+
messageId: message.id,
|
|
33
|
+
messageLength: textBlock?.text.length,
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
}, [dispatch, message, textBlock]);
|
|
33
38
|
|
|
34
|
-
useOnTransition(editing, true, false,
|
|
39
|
+
useOnTransition(editing, true, false, onEdit);
|
|
35
40
|
};
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { type PluginMeta } from '@dxos/app-framework';
|
|
|
7
7
|
export const THREAD_PLUGIN = 'dxos.org/plugin/thread';
|
|
8
8
|
export const THREAD_ITEM = `${THREAD_PLUGIN}/item`;
|
|
9
9
|
|
|
10
|
-
export const meta = {
|
|
10
|
+
export const meta: PluginMeta = {
|
|
11
11
|
id: THREAD_PLUGIN,
|
|
12
12
|
name: 'Threads',
|
|
13
13
|
description: 'Add comment threads to objects.',
|
|
14
14
|
icon: 'ph--chat--regular',
|
|
15
15
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-thread',
|
|
16
|
-
}
|
|
16
|
+
};
|
package/src/translations.ts
CHANGED
|
@@ -11,13 +11,11 @@ export default [
|
|
|
11
11
|
'en-US': {
|
|
12
12
|
[ChannelType.typename]: {
|
|
13
13
|
'typename label': 'Channel',
|
|
14
|
+
'object name placeholder': 'New channel',
|
|
14
15
|
},
|
|
15
16
|
[THREAD_PLUGIN]: {
|
|
16
17
|
'plugin name': 'Threads',
|
|
17
|
-
'channel name placeholder': 'New channel',
|
|
18
18
|
'channel title label': 'Title',
|
|
19
|
-
'delete channel label': 'Delete channel',
|
|
20
|
-
'create channel label': 'Create channel',
|
|
21
19
|
'message placeholder': 'Reply…',
|
|
22
20
|
'activity message': 'Processing…',
|
|
23
21
|
'anonymous label': 'Anonymous',
|
|
@@ -40,7 +38,7 @@ export default [
|
|
|
40
38
|
'edit message label': 'Edit',
|
|
41
39
|
'delete message label': 'Delete message',
|
|
42
40
|
'open comments panel label': 'Show Comments',
|
|
43
|
-
'comments
|
|
41
|
+
'comments label': 'Comments',
|
|
44
42
|
'show all label': 'All comments',
|
|
45
43
|
'show unresolved label': 'Unresolved only',
|
|
46
44
|
},
|
package/src/types.ts
CHANGED
|
@@ -3,29 +3,40 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { S } from '@dxos/echo-schema';
|
|
6
|
-
import { ChannelType,
|
|
6
|
+
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
7
7
|
import { EchoObjectSchema } from '@dxos/react-client/echo';
|
|
8
|
+
import { ActorSchema, MessageType } from '@dxos/schema';
|
|
8
9
|
|
|
9
10
|
import { THREAD_PLUGIN } from './meta';
|
|
10
11
|
|
|
11
12
|
export namespace ThreadAction {
|
|
12
13
|
const THREAD_ACTION = `${THREAD_PLUGIN}/action`;
|
|
13
14
|
|
|
15
|
+
export class CreateChannel extends S.TaggedClass<CreateChannel>()(`${THREAD_ACTION}/create-channel`, {
|
|
16
|
+
input: S.Struct({
|
|
17
|
+
// TODO(wittjosiah): Should be SpaceId.
|
|
18
|
+
spaceId: S.String,
|
|
19
|
+
name: S.optional(S.String),
|
|
20
|
+
}),
|
|
21
|
+
output: S.Struct({
|
|
22
|
+
object: ChannelType,
|
|
23
|
+
}),
|
|
24
|
+
}) {}
|
|
25
|
+
|
|
14
26
|
export class Create extends S.TaggedClass<Create>()(`${THREAD_ACTION}/create`, {
|
|
15
27
|
input: S.Struct({
|
|
16
28
|
name: S.optional(S.String),
|
|
17
|
-
cursor: S.
|
|
18
|
-
subject:
|
|
29
|
+
cursor: S.String,
|
|
30
|
+
subject: EchoObjectSchema,
|
|
19
31
|
}),
|
|
20
32
|
output: S.Struct({
|
|
21
|
-
object:
|
|
33
|
+
object: ThreadType,
|
|
22
34
|
}),
|
|
23
35
|
}) {}
|
|
24
36
|
|
|
25
37
|
export class Select extends S.TaggedClass<Select>()(`${THREAD_ACTION}/select`, {
|
|
26
38
|
input: S.Struct({
|
|
27
39
|
current: S.String,
|
|
28
|
-
skipOpen: S.optional(S.Boolean),
|
|
29
40
|
}),
|
|
30
41
|
output: S.Void,
|
|
31
42
|
}) {}
|
|
@@ -46,11 +57,12 @@ export namespace ThreadAction {
|
|
|
46
57
|
output: S.Void,
|
|
47
58
|
}) {}
|
|
48
59
|
|
|
49
|
-
|
|
50
|
-
export class OnMessageAdd extends S.TaggedClass<OnMessageAdd>()(`${THREAD_ACTION}/on-message-add`, {
|
|
60
|
+
export class AddMessage extends S.TaggedClass<AddMessage>()(`${THREAD_ACTION}/add-message`, {
|
|
51
61
|
input: S.Struct({
|
|
52
|
-
thread: ThreadType,
|
|
53
62
|
subject: EchoObjectSchema,
|
|
63
|
+
thread: ThreadType,
|
|
64
|
+
sender: ActorSchema,
|
|
65
|
+
text: S.String,
|
|
54
66
|
}),
|
|
55
67
|
output: S.Void,
|
|
56
68
|
}) {}
|
|
@@ -80,6 +92,8 @@ export type ViewState = { showResolvedThreads: boolean };
|
|
|
80
92
|
export type ViewStore = Record<SubjectId, ViewState>;
|
|
81
93
|
|
|
82
94
|
export type ThreadState = {
|
|
95
|
+
/** Current channel activity. */
|
|
96
|
+
activities: Record<string, string | undefined>;
|
|
83
97
|
/** In-memory draft threads. */
|
|
84
98
|
drafts: Record<string, ThreadType[]>;
|
|
85
99
|
current?: string | undefined;
|
package/src/util.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const getMessageMetadata = (id: string, identity?: Identity): MessageMeta
|
|
|
14
14
|
const fallback = hexToFallback(identity?.identityKey.toHex() ?? '0');
|
|
15
15
|
return {
|
|
16
16
|
id,
|
|
17
|
-
authorId: identity?.
|
|
17
|
+
authorId: identity?.did,
|
|
18
18
|
authorName:
|
|
19
19
|
identity?.profile?.displayName ??
|
|
20
20
|
(identity?.identityKey ? generateName(identity.identityKey.toHex()) : undefined),
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChatContainer
|
|
3
|
-
} from "./chunk-UPKU23DA.mjs";
|
|
4
|
-
import "./chunk-BNEWNQBO.mjs";
|
|
5
|
-
import "./chunk-636QDHE3.mjs";
|
|
6
|
-
|
|
7
|
-
// packages/plugins/plugin-thread/src/components/ThreadContainer.tsx
|
|
8
|
-
import React from "react";
|
|
9
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
10
|
-
var ThreadContainer = ({ role, ...props }) => {
|
|
11
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
12
|
-
toolbar: false
|
|
13
|
-
}, /* @__PURE__ */ React.createElement(ChatContainer, props));
|
|
14
|
-
};
|
|
15
|
-
var ThreadContainer_default = ThreadContainer;
|
|
16
|
-
export {
|
|
17
|
-
ThreadContainer_default as default
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=ThreadContainer-6OP5AG2W.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/ThreadContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ComponentProps } from 'react';\n\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { ChatContainer } from './ChatContainer';\n\nconst ThreadContainer = ({\n role,\n ...props\n}: Pick<ComponentProps<typeof ChatContainer>, 'thread' | 'context'> & { role: string }) => {\n return (\n <StackItem.Content toolbar={false}>\n <ChatContainer {...props} />\n </StackItem.Content>\n );\n};\n\nexport default ThreadContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAIA,OAAOA,WAAoC;AAE3C,SAASC,iBAAiB;AAI1B,IAAMC,kBAAkB,CAAC,EACvBC,MACA,GAAGC,MAAAA,MACiF;AACpF,SACE,sBAAA,cAACC,UAAUC,SAAO;IAACC,SAAS;KAC1B,sBAAA,cAACC,eAAkBJ,KAAAA,CAAAA;AAGzB;AAEA,IAAA,0BAAeF;",
|
|
6
|
-
"names": ["React", "StackItem", "ThreadContainer", "role", "props", "StackItem", "Content", "toolbar", "ChatContainer"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/ChatContainer.tsx", "../../../src/components/MessageContainer.tsx", "../../../src/components/command-extension.ts", "../../../src/util.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport { Ref } from '@dxos/echo-schema';\nimport { create, makeRef, RefArray } from '@dxos/live-object';\nimport { MessageType } from '@dxos/plugin-space/types';\nimport { fullyQualifiedId, getSpace, useMembers } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { Icon, ScrollArea, useThemeContext, useTranslation } from '@dxos/react-ui';\nimport { createBasicExtensions, createThemeExtensions, listener } from '@dxos/react-ui-editor';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { mx } from '@dxos/react-ui-theme';\nimport { MessageTextbox, type MessageTextboxProps, Thread, ThreadFooter, threadLayout } from '@dxos/react-ui-thread';\n\nimport { MessageContainer } from './MessageContainer';\nimport { command } from './command-extension';\nimport { type ThreadContainerProps } from './types';\nimport { useStatus } from '../hooks';\nimport { THREAD_PLUGIN } from '../meta';\nimport { getMessageMetadata } from '../util';\n\nexport const ChatHeading = ({ attendableId }: { attendableId?: string }) => {\n const { t } = useTranslation(THREAD_PLUGIN);\n return (\n <div role='none' className='flex items-center'>\n <StackItem.SigilButton attendableId={attendableId}>\n <Icon icon='ph--chat--regular' size={5} />\n </StackItem.SigilButton>\n <StackItem.HeadingLabel attendableId={attendableId}>{t('chat heading')}</StackItem.HeadingLabel>\n </div>\n );\n};\n\nexport const ChatContainer = ({ thread, context, current, autoFocusTextbox }: ThreadContainerProps) => {\n const identity = useIdentity()!;\n const space = getSpace(thread);\n const members = useMembers(space?.key);\n const activity = useStatus(space, fullyQualifiedId(thread));\n const { t } = useTranslation(THREAD_PLUGIN);\n // TODO(wittjosiah): This is a hack to reset the editor after a message is sent.\n const [_count, _setCount] = useState(0);\n const rerenderEditor = () => _setCount((count) => count + 1);\n const [autoFocus, setAutoFocus] = useState(autoFocusTextbox);\n const threadScrollRef = useRef<HTMLDivElement | null>(null);\n const { themeMode } = useThemeContext();\n\n const textboxMetadata = getMessageMetadata(fullyQualifiedId(thread), identity);\n const messageRef = useRef('');\n const extensions = useMemo(\n () => [\n createBasicExtensions({ placeholder: t('message placeholder') }),\n createThemeExtensions({ themeMode }),\n listener({ onChange: (text) => (messageRef.current = text) }),\n command,\n ],\n [themeMode, _count],\n );\n\n // TODO(thure): Factor out.\n // TODO(thure): `flex-col-reverse` does not work to start the container scrolled to the end while also using\n // `ScrollArea`. This is the least-bad way I found to scroll to the end on mount. Note that 0ms was insufficient\n // for the desired effect; this is likely hardware-dependent and should be reevaluated.\n const scrollToEnd = (behavior: ScrollBehavior) =>\n setTimeout(() => threadScrollRef.current?.scrollIntoView({ behavior, block: 'end' }), 10);\n\n useLayoutEffect(() => {\n scrollToEnd('instant');\n }, []);\n\n // TODO(burdon): Change to model.\n const handleCreate: MessageTextboxProps['onSend'] = () => {\n if (!messageRef.current?.length) {\n return false;\n }\n\n thread.messages.push(\n makeRef(\n create(MessageType, {\n sender: { identityKey: identity.identityKey.toHex() },\n timestamp: new Date().toISOString(),\n text: messageRef.current,\n context: context ? makeRef(context) : undefined,\n }),\n ),\n );\n\n messageRef.current = '';\n setAutoFocus(true);\n scrollToEnd('smooth');\n rerenderEditor();\n return true;\n };\n\n const handleDelete = (id: string) => {\n const messageIndex = thread.messages.findIndex(Ref.hasObjectId(id));\n if (messageIndex !== -1) {\n thread.messages.splice(messageIndex, 1);\n }\n };\n\n return (\n <Thread\n current={current}\n id={fullyQualifiedId(thread)}\n classNames='bs-full grid-rows-[1fr_min-content_min-content] overflow-hidden transition-[padding-block-end] [[data-sidebar-inline-start-state=open]_&]:lg:pbe-0'\n >\n <ScrollArea.Root classNames='col-span-2'>\n <ScrollArea.Viewport classNames='overflow-anchored after:overflow-anchor after:block after:bs-px after:-mbs-px [&>div]:min-bs-full [&>div]:!grid [&>div]:grid-rows-[1fr_0]'>\n <div role='none' className={mx(threadLayout, 'place-self-end')}>\n {RefArray.allResolvedTargets(thread.messages ?? []).map((message) => (\n <MessageContainer key={message.id} message={message} members={members} onDelete={handleDelete} />\n ))}\n </div>\n {/* NOTE(thure): This can’t also be the `overflow-anchor` because `ScrollArea` injects an interceding node that contains this necessary ref’d element. */}\n <div role='none' className='bs-px -mbs-px' ref={threadScrollRef} />\n <ScrollArea.Scrollbar>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n <MessageTextbox extensions={extensions} autoFocus={autoFocus} onSend={handleCreate} {...textboxMetadata} />\n <ThreadFooter activity={activity}>{t('activity message')}</ThreadFooter>\n </Thread>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { EditorView } from '@codemirror/view';\nimport { Check, PencilSimple, X } from '@phosphor-icons/react';\nimport React, { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { RefArray } from '@dxos/live-object';\nimport { type MessageType } from '@dxos/plugin-space/types';\nimport { PublicKey } from '@dxos/react-client';\nimport { type ReactiveEchoObject, type Expando, type SpaceMember } from '@dxos/react-client/echo';\nimport { useIdentity, type Identity } from '@dxos/react-client/halo';\nimport { Button, ButtonGroup, Tooltip, useOnTransition, useThemeContext, useTranslation } from '@dxos/react-ui';\nimport { createBasicExtensions, createThemeExtensions, useTextEditor } from '@dxos/react-ui-editor';\nimport {\n getSize,\n hoverableControlItem,\n hoverableControls,\n hoverableFocusedWithinControls,\n mx,\n} from '@dxos/react-ui-theme';\nimport { MessageHeading, MessageRoot } from '@dxos/react-ui-thread';\n\nimport { command } from './command-extension';\nimport { useOnEditAnalytics } from '../hooks';\nimport { THREAD_PLUGIN } from '../meta';\nimport { getMessageMetadata } from '../util';\n\n// TODO(thure): #8149\nconst messageControlClassNames = ['!p-1 !min-bs-0 transition-opacity', hoverableControlItem];\n\nexport const MessageContainer = ({\n message,\n members,\n onDelete,\n}: {\n message: MessageType;\n members: SpaceMember[];\n onDelete?: (id: string) => void;\n}) => {\n const senderIdentity = members.find(\n (member) => message.sender.identityKey && PublicKey.equals(member.identity.identityKey, message.sender.identityKey),\n )?.identity;\n const messageMetadata = getMessageMetadata(message.id, senderIdentity);\n const userIsAuthor = useIdentity()?.identityKey.toHex() === messageMetadata.authorId;\n const [editing, setEditing] = useState(false);\n const handleDelete = useCallback(() => onDelete?.(message.id), [message, onDelete]);\n const { t } = useTranslation(THREAD_PLUGIN);\n const editLabel = t(editing ? 'save message label' : 'edit message label');\n const deleteLabel = t('delete message label');\n\n return (\n <MessageRoot {...messageMetadata} classNames={[hoverableControls, hoverableFocusedWithinControls]}>\n <MessageHeading authorName={messageMetadata.authorName} timestamp={messageMetadata.timestamp}>\n <ButtonGroup classNames='mie-1'>\n {userIsAuthor && (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Button\n variant='ghost'\n data-testid={editing ? 'thread.message.save' : 'thread.message.edit'}\n classNames={messageControlClassNames}\n onClick={() => setEditing((editing) => !editing)}\n >\n <span className='sr-only'>{editLabel}</span>\n {editing ? <Check className={getSize(4)} /> : <PencilSimple className={getSize(4)} />}\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n {editLabel}\n <Tooltip.Arrow />\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n )}\n {onDelete && (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Button\n variant='ghost'\n data-testid='thread.message.delete'\n classNames={messageControlClassNames}\n onClick={() => handleDelete()}\n >\n <span className='sr-only'>{deleteLabel}</span>\n <X className={getSize(4)} />\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n {deleteLabel}\n <Tooltip.Arrow />\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n )}\n </ButtonGroup>\n </MessageHeading>\n <TextboxBlock message={message} isAuthor={userIsAuthor} editing={editing} />\n {RefArray.allResolvedTargets(message.parts ?? []).map((part, index) => (\n <MessagePart key={index} part={part} />\n ))}\n </MessageRoot>\n );\n};\n\nconst MessagePart = ({ part }: { part: Expando }) => {\n return <MessageBlockObjectTile subject={part} />;\n};\n\nconst TextboxBlock = ({\n message,\n isAuthor,\n editing,\n}: {\n message: MessageType;\n editing?: boolean;\n isAuthor?: boolean;\n identity?: Identity;\n}) => {\n const { themeMode } = useThemeContext();\n const inMemoryContentRef = useRef(message.text);\n\n const handleDocumentChange = useCallback((newState: string) => {\n inMemoryContentRef.current = newState;\n }, []);\n\n const saveDocumentChange = useCallback(() => {\n message.text = inMemoryContentRef.current;\n }, [message]);\n\n useOnTransition(editing, true, false, saveDocumentChange);\n\n const { parentRef, focusAttributes, view } = useTextEditor(\n () => ({\n initialValue: message.text,\n extensions: [\n createBasicExtensions({ readonly: !isAuthor || !editing }),\n createThemeExtensions({ themeMode }),\n command,\n EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n handleDocumentChange(update.state.doc.toString());\n }\n }),\n ],\n }),\n [message.text, editing, isAuthor, themeMode, handleDocumentChange],\n );\n\n useEffect(() => {\n editing && view?.focus();\n }, [editing, view]);\n\n useOnEditAnalytics(message, !!editing);\n\n return <div role='none' ref={parentRef} className='mie-4' {...focusAttributes} />;\n};\n\nconst MessageBlockObjectTile = forwardRef<HTMLDivElement, { subject: ReactiveEchoObject<any> }>(\n ({ subject }, forwardedRef) => {\n let title = subject.name ?? subject.title ?? subject.type ?? 'Object';\n if (typeof title !== 'string') {\n title = title?.content ?? '';\n }\n\n return (\n <div\n role='group'\n className={mx('grid col-span-3 py-1 pr-4', hoverableControls, hoverableFocusedWithinControls)}\n ref={forwardedRef}\n >\n <Surface role='card' limit={1} data={{ subject }} fallback={title} />\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { StreamLanguage, HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { type Extension } from '@codemirror/state';\n\nimport { tags } from '@dxos/react-ui-editor';\nimport { mx } from '@dxos/react-ui-theme';\n\n/**\n * https://github.com/codemirror/stream-parser/blob/main/test/test-stream-parser.ts\n */\nconst parser = StreamLanguage.define<{ count: number }>({\n startState: () => ({ count: 0 }),\n token: (stream, state) => {\n state.count++;\n if (stream.eatSpace()) {\n return null;\n }\n if (state.count === 1 && stream.match(/^(\\/\\w+)/)) {\n return 'tagName';\n }\n stream.next();\n return null;\n },\n});\n\nconst styles = HighlightStyle.define([\n { tag: tags.tagName, class: mx('dx-tag dx-tag--indigo text-baseText font-medium') },\n]);\n\nexport const command: Extension = [parser, syntaxHighlighting(styles)];\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { generateName } from '@dxos/display-name';\nimport { type PublicKey } from '@dxos/react-client';\nimport { type Identity } from '@dxos/react-client/halo';\nimport { type MessageMetadata } from '@dxos/react-ui-thread';\nimport { hexToFallback } from '@dxos/util';\n\nexport type MessagePropertiesProvider = (identityKey: PublicKey | undefined) => MessageMetadata;\n\nexport const getMessageMetadata = (id: string, identity?: Identity): MessageMetadata => {\n const fallback = hexToFallback(identity?.identityKey.toHex() ?? '0');\n return {\n id,\n authorId: identity?.identityKey.toHex(),\n authorName:\n identity?.profile?.displayName ??\n (identity?.identityKey ? generateName(identity.identityKey.toHex()) : undefined),\n authorAvatarProps: {\n hue: identity?.profile?.data?.hue ?? fallback.hue,\n emoji: identity?.profile?.data?.emoji ?? fallback.emoji,\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,UAASC,iBAAiBC,SAASC,UAAAA,SAAQC,YAAAA,iBAAgB;AAElE,SAASC,WAAW;AACpB,SAASC,QAAQC,SAASC,YAAAA,iBAAgB;AAC1C,SAASC,mBAAmB;AAC5B,SAASC,kBAAkBC,UAAUC,kBAAkB;AACvD,SAASC,eAAAA,oBAAmB;AAC5B,SAASC,MAAMC,YAAYC,mBAAAA,kBAAiBC,kBAAAA,uBAAsB;AAClE,SAASC,yBAAAA,wBAAuBC,yBAAAA,wBAAuBC,gBAAgB;AACvE,SAASC,iBAAiB;AAC1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kBAAA,CAAA,CAAA;AAG3C;",
|
|
6
|
-
"names": ["React", "useLayoutEffect", "useMemo", "useRef", "useState", "Ref", "create", "makeRef", "RefArray", "MessageType", "fullyQualifiedId", "getSpace", "useMembers", "useIdentity", "Icon", "ScrollArea", "useThemeContext", "useTranslation", "createBasicExtensions", "createThemeExtensions", "listener", "StackItem", "mx", "MessageTextbox", "Thread", "ThreadFooter", "threadLayout", "EditorView", "Check", "PencilSimple", "X", "React", "forwardRef", "useCallback", "useEffect", "useRef", "useState", "Surface", "RefArray", "PublicKey", "useIdentity", "Button", "ButtonGroup", "Tooltip", "useOnTransition", "useThemeContext", "useTranslation", "createBasicExtensions", "createThemeExtensions", "useTextEditor", "getSize", "hoverableControlItem", "hoverableControls", "hoverableFocusedWithinControls", "mx", "MessageHeading", "MessageRoot", "StreamLanguage", "HighlightStyle", "syntaxHighlighting", "tags", "mx", "parser", "StreamLanguage", "define", "startState", "count", "token", "stream", "state", "eatSpace", "match", "next", "styles", "HighlightStyle", "tag", "tags", "tagName", "class", "mx", "command", "syntaxHighlighting", "generateName", "hexToFallback", "getMessageMetadata", "id", "identity", "fallback", "hexToFallback", "identityKey", "toHex", "authorId", "authorName", "profile", "displayName", "generateName", "undefined", "authorAvatarProps", "hue", "data", "emoji", "messageControlClassNames", "hoverableControlItem", "MessageContainer", "message", "members", "onDelete", "senderIdentity", "find", "member", "sender", "identityKey", "PublicKey", "equals", "identity", "messageMetadata", "getMessageMetadata", "id", "userIsAuthor", "useIdentity", "toHex", "authorId", "editing", "setEditing", "useState", "handleDelete", "useCallback", "t", "useTranslation", "THREAD_PLUGIN", "editLabel", "deleteLabel", "MessageRoot", "classNames", "hoverableControls", "hoverableFocusedWithinControls", "MessageHeading", "authorName", "timestamp", "ButtonGroup", "Tooltip", "Root", "Trigger", "asChild", "Button", "variant", "data-testid", "onClick", "span", "className", "Check", "getSize", "PencilSimple", "Portal", "Content", "Arrow", "X", "TextboxBlock", "isAuthor", "RefArray", "allResolvedTargets", "parts", "map", "part", "index", "MessagePart", "key", "MessageBlockObjectTile", "subject", "themeMode", "useThemeContext", "inMemoryContentRef", "useRef", "text", "handleDocumentChange", "newState", "current", "saveDocumentChange", "useOnTransition", "parentRef", "focusAttributes", "view", "useTextEditor", "initialValue", "extensions", "createBasicExtensions", "readonly", "createThemeExtensions", "command", "EditorView", "updateListener", "of", "update", "docChanged", "state", "doc", "toString", "useEffect", "focus", "useOnEditAnalytics", "div", "role", "ref", "forwardRef", "forwardedRef", "title", "name", "type", "content", "mx", "Surface", "limit", "data", "fallback", "ChatContainer", "thread", "context", "current", "autoFocusTextbox", "identity", "useIdentity", "space", "getSpace", "members", "useMembers", "key", "activity", "useStatus", "fullyQualifiedId", "t", "useTranslation", "THREAD_PLUGIN", "_count", "_setCount", "useState", "rerenderEditor", "count", "autoFocus", "setAutoFocus", "threadScrollRef", "useRef", "themeMode", "useThemeContext", "textboxMetadata", "getMessageMetadata", "messageRef", "extensions", "useMemo", "createBasicExtensions", "placeholder", "createThemeExtensions", "listener", "onChange", "text", "command", "scrollToEnd", "behavior", "setTimeout", "scrollIntoView", "block", "useLayoutEffect", "handleCreate", "length", "messages", "push", "makeRef", "create", "MessageType", "sender", "identityKey", "toHex", "timestamp", "Date", "toISOString", "undefined", "handleDelete", "id", "messageIndex", "findIndex", "Ref", "hasObjectId", "splice", "React", "Thread", "classNames", "ScrollArea", "Root", "Viewport", "div", "role", "className", "mx", "threadLayout", "RefArray", "allResolvedTargets", "map", "message", "MessageContainer", "onDelete", "ref", "Scrollbar", "Thumb", "MessageTextbox", "onSend", "ThreadFooter"]
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-thread/src/capabilities/index.ts
|
|
2
|
-
import { lazy } from "@dxos/app-framework";
|
|
3
|
-
var IntentResolver = lazy(() => import("./intent-resolver-FAFQ54NP.mjs"));
|
|
4
|
-
var Markdown = lazy(() => import("./markdown-RPYOUBVR.mjs"));
|
|
5
|
-
var ReactSurface = lazy(() => import("./react-surface-Y4MUSICN.mjs"));
|
|
6
|
-
var ThreadSettings = lazy(() => import("./settings-WQTE5AEZ.mjs"));
|
|
7
|
-
var ThreadState = lazy(() => import("./state-GNFUURIC.mjs"));
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
IntentResolver,
|
|
11
|
-
Markdown,
|
|
12
|
-
ReactSurface,
|
|
13
|
-
ThreadState
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=chunk-VOMIDDNO.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const Markdown = lazy(() => import('./markdown'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\nexport const ThreadSettings = lazy(() => import('./settings'));\nexport const ThreadState = lazy(() => import('./state'));\n\nexport * from './capabilities';\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,YAAY;AAEd,IAAMC,iBAAiBC,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMC,WAAWD,KAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAME,eAAeF,KAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMG,iBAAiBH,KAAK,MAAM,OAAO,yBAAA,CAAA;AACzC,IAAMI,cAAcJ,KAAK,MAAM,OAAO,sBAAA,CAAA;",
|
|
6
|
-
"names": ["lazy", "IntentResolver", "lazy", "Markdown", "ReactSurface", "ThreadSettings", "ThreadState"]
|
|
7
|
-
}
|