@dxos/plugin-thread 0.8.1-staging.391c573 → 0.8.1-staging.5be625a
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/ChannelContainer-ITIG7L7P.mjs +75 -0
- package/dist/lib/browser/ChannelContainer-ITIG7L7P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NAO3LZMZ.mjs → chunk-NOOMCX5E.mjs} +3 -2
- package/dist/lib/browser/chunk-NOOMCX5E.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UPKU23DA.mjs → chunk-NRMJGYMA.mjs} +50 -43
- package/dist/lib/browser/chunk-NRMJGYMA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YK3ICB7G.mjs → chunk-SJPT347G.mjs} +19 -6
- package/dist/lib/browser/chunk-SJPT347G.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BNEWNQBO.mjs → chunk-SMQYULO6.mjs} +16 -4
- package/dist/lib/browser/{chunk-BNEWNQBO.mjs.map → chunk-SMQYULO6.mjs.map} +4 -4
- 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/index.mjs +42 -31
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-FAFQ54NP.mjs → intent-resolver-FSG3ZOIM.mjs} +65 -62
- package/dist/lib/browser/intent-resolver-FSG3ZOIM.mjs.map +7 -0
- package/dist/lib/browser/{markdown-RPYOUBVR.mjs → markdown-MYZQDQFY.mjs} +6 -6
- package/dist/lib/browser/markdown-MYZQDQFY.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-Y4MUSICN.mjs → react-surface-KOYRIK3E.mjs} +25 -32
- package/dist/lib/browser/react-surface-KOYRIK3E.mjs.map +7 -0
- package/dist/lib/browser/{settings-WQTE5AEZ.mjs → settings-5CREE7BH.mjs} +3 -3
- package/dist/lib/browser/{state-GNFUURIC.mjs → state-HPUFZBB7.mjs} +4 -3
- package/dist/lib/browser/state-HPUFZBB7.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/ChannelContainer-F7345XW2.cjs +99 -0
- package/dist/lib/node/ChannelContainer-F7345XW2.cjs.map +7 -0
- package/dist/lib/node/{chunk-CMEMMYDL.cjs → chunk-AXTPNGRI.cjs} +23 -10
- package/dist/lib/node/chunk-AXTPNGRI.cjs.map +7 -0
- package/dist/lib/node/{chunk-RQR5Z23G.cjs → chunk-DGV5ABT6.cjs} +52 -45
- package/dist/lib/node/chunk-DGV5ABT6.cjs.map +7 -0
- package/dist/lib/node/{chunk-AWSTZ2KN.cjs → chunk-JBOC6MIE.cjs} +30 -6
- package/dist/lib/node/chunk-JBOC6MIE.cjs.map +7 -0
- 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-FPWNZ6TB.cjs → chunk-VEVJBOWK.cjs} +8 -7
- package/dist/lib/node/chunk-VEVJBOWK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +77 -67
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{intent-resolver-DVBEXJ33.cjs → intent-resolver-NBME5QSW.cjs} +79 -76
- package/dist/lib/node/intent-resolver-NBME5QSW.cjs.map +7 -0
- package/dist/lib/node/{markdown-ELRGISXE.cjs → markdown-QBQTARMD.cjs} +12 -12
- package/dist/lib/node/markdown-QBQTARMD.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-7HLTN5XS.cjs → react-surface-ICWYXRJU.cjs} +46 -53
- package/dist/lib/node/react-surface-ICWYXRJU.cjs.map +7 -0
- package/dist/lib/node/{settings-7VQYARM5.cjs → settings-XOLYNUHH.cjs} +8 -8
- package/dist/lib/node/{state-TQWEZ6B3.cjs → state-JMI5ZXZI.cjs} +8 -7
- package/dist/lib/node/state-JMI5ZXZI.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/ChannelContainer-GP6Y6JSN.mjs +76 -0
- package/dist/lib/node-esm/ChannelContainer-GP6Y6JSN.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-33NDMQQQ.mjs → chunk-FZXTP57V.mjs} +19 -6
- package/dist/lib/node-esm/chunk-FZXTP57V.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CISLDOH7.mjs → chunk-TW2NME6Z.mjs} +50 -43
- package/dist/lib/node-esm/chunk-TW2NME6Z.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZJITX3TO.mjs → chunk-TXW5SIBN.mjs} +3 -2
- package/dist/lib/node-esm/chunk-TXW5SIBN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HLWJTUWZ.mjs → chunk-XQO5DGHF.mjs} +16 -4
- package/dist/lib/node-esm/{chunk-HLWJTUWZ.mjs.map → chunk-XQO5DGHF.mjs.map} +4 -4
- package/dist/lib/node-esm/index.mjs +42 -31
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-DHVLBNCC.mjs → intent-resolver-QQCCKVEW.mjs} +65 -62
- package/dist/lib/node-esm/intent-resolver-QQCCKVEW.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-23OB7EZG.mjs → markdown-QO5HK24O.mjs} +6 -6
- package/dist/lib/node-esm/markdown-QO5HK24O.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-AZHTTR6J.mjs → react-surface-Z4CLCKTN.mjs} +25 -32
- package/dist/lib/node-esm/react-surface-Z4CLCKTN.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-SGMM7UDT.mjs → settings-32PBKVBB.mjs} +3 -3
- package/dist/lib/node-esm/{state-7MLR27YG.mjs → state-PSZO57LP.mjs} +4 -3
- package/dist/lib/node-esm/state-PSZO57LP.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/capabilities.d.ts +5 -0
- package/dist/types/src/capabilities/capabilities.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/ChannelContainer.d.ts +9 -0
- package/dist/types/src/components/ChannelContainer.d.ts.map +1 -0
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +7 -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.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts +3 -2
- 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/index.d.ts +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +44 -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 -1
- 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 +2 -9
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +20 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +33 -30
- package/src/ThreadPlugin.tsx +11 -7
- package/src/capabilities/capabilities.ts +6 -0
- package/src/capabilities/intent-resolver.ts +39 -33
- package/src/capabilities/react-surface.tsx +6 -18
- package/src/capabilities/state.ts +1 -1
- package/src/components/ChannelContainer.tsx +80 -0
- package/src/components/Chat.stories.tsx +19 -9
- package/src/components/ChatContainer.tsx +27 -29
- package/src/components/CommentContainer.tsx +8 -2
- package/src/components/Comments.stories.tsx +2 -1
- package/src/components/MessageContainer.tsx +18 -14
- package/src/components/ThreadComplementary.tsx +5 -4
- package/src/components/index.ts +1 -1
- package/src/components/testing.ts +4 -27
- package/src/events.ts +11 -0
- package/src/extensions/threads.ts +2 -2
- package/src/hooks/analytics.ts +7 -2
- package/src/index.ts +2 -0
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -3
- package/src/types.ts +18 -4
- package/dist/lib/browser/ThreadContainer-6OP5AG2W.mjs +0 -19
- package/dist/lib/browser/ThreadContainer-6OP5AG2W.mjs.map +0 -7
- package/dist/lib/browser/chunk-NAO3LZMZ.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 +0 -50
- 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-FPWNZ6TB.cjs.map +0 -7
- 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/chunk-ZJITX3TO.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/{settings-WQTE5AEZ.mjs.map → settings-5CREE7BH.mjs.map} +0 -0
- /package/dist/lib/node/{settings-7VQYARM5.cjs.map → settings-XOLYNUHH.cjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-SGMM7UDT.mjs.map → settings-32PBKVBB.mjs.map} +0 -0
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { createStatic } from '@dxos/echo-schema';
|
|
8
|
+
import { type DXN } from '@dxos/keys';
|
|
9
|
+
import { makeRef } from '@dxos/live-object';
|
|
10
|
+
import { type Space, useMembers, useQueue } from '@dxos/react-client/echo';
|
|
11
11
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
12
12
|
import { Icon, ScrollArea, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
13
13
|
import { createBasicExtensions, createThemeExtensions, listener } from '@dxos/react-ui-editor';
|
|
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 { MessageType } from '@dxos/schema';
|
|
17
18
|
|
|
18
19
|
import { MessageContainer } from './MessageContainer';
|
|
19
20
|
import { command } from './command-extension';
|
|
@@ -34,11 +35,17 @@ export const ChatHeading = ({ attendableId }: { attendableId?: string }) => {
|
|
|
34
35
|
);
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
export
|
|
38
|
+
export type ChatContainerProps = Omit<ThreadContainerProps, 'thread'> & {
|
|
39
|
+
space: Space;
|
|
40
|
+
dxn: DXN;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const ChatContainer = ({ space, dxn, context, current, autoFocusTextbox }: ChatContainerProps) => {
|
|
44
|
+
const id = dxn.toString();
|
|
38
45
|
const identity = useIdentity()!;
|
|
39
|
-
const space = getSpace(thread);
|
|
40
46
|
const members = useMembers(space?.key);
|
|
41
|
-
const
|
|
47
|
+
const queue = useQueue<MessageType>(dxn, { pollInterval: 1_000 });
|
|
48
|
+
const activity = useStatus(space, id);
|
|
42
49
|
const { t } = useTranslation(THREAD_PLUGIN);
|
|
43
50
|
// TODO(wittjosiah): This is a hack to reset the editor after a message is sent.
|
|
44
51
|
const [_count, _setCount] = useState(0);
|
|
@@ -47,7 +54,7 @@ export const ChatContainer = ({ thread, context, current, autoFocusTextbox }: Th
|
|
|
47
54
|
const threadScrollRef = useRef<HTMLDivElement | null>(null);
|
|
48
55
|
const { themeMode } = useThemeContext();
|
|
49
56
|
|
|
50
|
-
const textboxMetadata = getMessageMetadata(
|
|
57
|
+
const textboxMetadata = getMessageMetadata(id, identity);
|
|
51
58
|
const messageRef = useRef('');
|
|
52
59
|
const extensions = useMemo(
|
|
53
60
|
() => [
|
|
@@ -72,20 +79,18 @@ export const ChatContainer = ({ thread, context, current, autoFocusTextbox }: Th
|
|
|
72
79
|
|
|
73
80
|
// TODO(burdon): Change to model.
|
|
74
81
|
const handleCreate: MessageTextboxProps['onSend'] = () => {
|
|
75
|
-
if (!messageRef.current?.length) {
|
|
82
|
+
if (!messageRef.current?.length || !queue) {
|
|
76
83
|
return false;
|
|
77
84
|
}
|
|
78
85
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
),
|
|
88
|
-
);
|
|
86
|
+
queue.append([
|
|
87
|
+
createStatic(MessageType, {
|
|
88
|
+
sender: { identityKey: identity.identityKey.toHex() },
|
|
89
|
+
created: new Date().toISOString(),
|
|
90
|
+
blocks: [{ type: 'text', text: messageRef.current }],
|
|
91
|
+
properties: context ? { context: makeRef(context) } : undefined,
|
|
92
|
+
}),
|
|
93
|
+
]);
|
|
89
94
|
|
|
90
95
|
messageRef.current = '';
|
|
91
96
|
setAutoFocus(true);
|
|
@@ -94,24 +99,17 @@ export const ChatContainer = ({ thread, context, current, autoFocusTextbox }: Th
|
|
|
94
99
|
return true;
|
|
95
100
|
};
|
|
96
101
|
|
|
97
|
-
const handleDelete = (id: string) => {
|
|
98
|
-
const messageIndex = thread.messages.findIndex(Ref.hasObjectId(id));
|
|
99
|
-
if (messageIndex !== -1) {
|
|
100
|
-
thread.messages.splice(messageIndex, 1);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
102
|
return (
|
|
105
103
|
<Thread
|
|
106
104
|
current={current}
|
|
107
|
-
id={
|
|
105
|
+
id={id}
|
|
108
106
|
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'
|
|
109
107
|
>
|
|
110
108
|
<ScrollArea.Root classNames='col-span-2'>
|
|
111
109
|
<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]'>
|
|
112
110
|
<div role='none' className={mx(threadLayout, 'place-self-end')}>
|
|
113
|
-
{
|
|
114
|
-
<MessageContainer key={message.id} message={message} members={members}
|
|
111
|
+
{(queue?.items ?? []).map((message) => (
|
|
112
|
+
<MessageContainer key={message.id} message={message} members={members} />
|
|
115
113
|
))}
|
|
116
114
|
</div>
|
|
117
115
|
{/* NOTE(thure): This can’t also be the `overflow-anchor` because `ScrollArea` injects an interceding node that contains this necessary ref’d element. */}
|
|
@@ -179,8 +179,14 @@ export const CommentContainer = ({
|
|
|
179
179
|
</div>
|
|
180
180
|
</div>
|
|
181
181
|
{/** TODO(dmaretskyi): How's `thread.messages` undefined? */}
|
|
182
|
-
{RefArray.
|
|
183
|
-
<MessageContainer
|
|
182
|
+
{RefArray.targets(thread.messages?.filter(isNonNullable) ?? []).map((message) => (
|
|
183
|
+
<MessageContainer
|
|
184
|
+
key={message.id}
|
|
185
|
+
editable
|
|
186
|
+
message={message}
|
|
187
|
+
members={members}
|
|
188
|
+
onDelete={handleMessageDelete}
|
|
189
|
+
/>
|
|
184
190
|
))}
|
|
185
191
|
{/*
|
|
186
192
|
TODO(wittjosiah): Can't autofocus this generally.
|
|
@@ -9,11 +9,12 @@ import React, { useEffect, useState } from 'react';
|
|
|
9
9
|
|
|
10
10
|
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import {
|
|
12
|
+
import { ThreadType } from '@dxos/plugin-space/types';
|
|
13
13
|
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 { MessageType } from '@dxos/schema';
|
|
17
18
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
18
19
|
|
|
19
20
|
import { CommentsContainer } from './CommentsContainer';
|
|
@@ -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,10 +34,12 @@ 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(
|
|
@@ -50,12 +52,16 @@ export const MessageContainer = ({
|
|
|
50
52
|
const { t } = useTranslation(THREAD_PLUGIN);
|
|
51
53
|
const editLabel = t(editing ? 'save message label' : 'edit message label');
|
|
52
54
|
const deleteLabel = t('delete message label');
|
|
55
|
+
const textBlock = message.blocks.find((block) => block.type === 'text');
|
|
56
|
+
const references = message.blocks.filter((block) => block.type === 'reference').map((block) => block.reference);
|
|
57
|
+
|
|
58
|
+
useOnEditAnalytics(message, textBlock, !!editing);
|
|
53
59
|
|
|
54
60
|
return (
|
|
55
61
|
<MessageRoot {...messageMetadata} classNames={[hoverableControls, hoverableFocusedWithinControls]}>
|
|
56
62
|
<MessageHeading authorName={messageMetadata.authorName} timestamp={messageMetadata.timestamp}>
|
|
57
63
|
<ButtonGroup classNames='mie-1'>
|
|
58
|
-
{userIsAuthor && (
|
|
64
|
+
{userIsAuthor && editable && (
|
|
59
65
|
<Tooltip.Root>
|
|
60
66
|
<Tooltip.Trigger asChild>
|
|
61
67
|
<Button
|
|
@@ -99,9 +105,9 @@ export const MessageContainer = ({
|
|
|
99
105
|
)}
|
|
100
106
|
</ButtonGroup>
|
|
101
107
|
</MessageHeading>
|
|
102
|
-
<TextboxBlock
|
|
103
|
-
{RefArray.
|
|
104
|
-
<MessagePart key={index} part={
|
|
108
|
+
{textBlock && <TextboxBlock block={textBlock} isAuthor={userIsAuthor} editing={editing} />}
|
|
109
|
+
{RefArray.targets(references).map((reference, index) => (
|
|
110
|
+
<MessagePart key={index} part={reference} />
|
|
105
111
|
))}
|
|
106
112
|
</MessageRoot>
|
|
107
113
|
);
|
|
@@ -112,31 +118,31 @@ const MessagePart = ({ part }: { part: Expando }) => {
|
|
|
112
118
|
};
|
|
113
119
|
|
|
114
120
|
const TextboxBlock = ({
|
|
115
|
-
|
|
121
|
+
block,
|
|
116
122
|
isAuthor,
|
|
117
123
|
editing,
|
|
118
124
|
}: {
|
|
119
|
-
|
|
125
|
+
block: TextContentBlock;
|
|
120
126
|
editing?: boolean;
|
|
121
127
|
isAuthor?: boolean;
|
|
122
128
|
identity?: Identity;
|
|
123
129
|
}) => {
|
|
124
130
|
const { themeMode } = useThemeContext();
|
|
125
|
-
const inMemoryContentRef = useRef(
|
|
131
|
+
const inMemoryContentRef = useRef(block.text);
|
|
126
132
|
|
|
127
133
|
const handleDocumentChange = useCallback((newState: string) => {
|
|
128
134
|
inMemoryContentRef.current = newState;
|
|
129
135
|
}, []);
|
|
130
136
|
|
|
131
137
|
const saveDocumentChange = useCallback(() => {
|
|
132
|
-
|
|
133
|
-
}, [
|
|
138
|
+
block.text = inMemoryContentRef.current;
|
|
139
|
+
}, [block]);
|
|
134
140
|
|
|
135
141
|
useOnTransition(editing, true, false, saveDocumentChange);
|
|
136
142
|
|
|
137
143
|
const { parentRef, focusAttributes, view } = useTextEditor(
|
|
138
144
|
() => ({
|
|
139
|
-
initialValue:
|
|
145
|
+
initialValue: block.text,
|
|
140
146
|
extensions: [
|
|
141
147
|
createBasicExtensions({ readonly: !isAuthor || !editing }),
|
|
142
148
|
createThemeExtensions({ themeMode }),
|
|
@@ -148,15 +154,13 @@ const TextboxBlock = ({
|
|
|
148
154
|
}),
|
|
149
155
|
],
|
|
150
156
|
}),
|
|
151
|
-
[
|
|
157
|
+
[block.text, editing, isAuthor, themeMode, handleDocumentChange],
|
|
152
158
|
);
|
|
153
159
|
|
|
154
160
|
useEffect(() => {
|
|
155
161
|
editing && view?.focus();
|
|
156
162
|
}, [editing, view]);
|
|
157
163
|
|
|
158
|
-
useOnEditAnalytics(message, !!editing);
|
|
159
|
-
|
|
160
164
|
return <div role='none' ref={parentRef} className='mie-4' {...focusAttributes} />;
|
|
161
165
|
};
|
|
162
166
|
|
|
@@ -6,12 +6,13 @@ 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 {
|
|
9
|
+
import { type ThreadType } from '@dxos/plugin-space/types';
|
|
10
10
|
import { create, fullyQualifiedId, makeRef, 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
14
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
15
|
+
import { MessageType } from '@dxos/schema';
|
|
15
16
|
import { isNonNullable } from '@dxos/util';
|
|
16
17
|
|
|
17
18
|
import { ThreadCapabilities as LocalThreadCapabilities } from '../capabilities';
|
|
@@ -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[];
|
|
@@ -92,8 +93,8 @@ export const ThreadComplementary = ({ subject }: { subject: any }) => {
|
|
|
92
93
|
makeRef(
|
|
93
94
|
create(MessageType, {
|
|
94
95
|
sender: { identityKey: identity?.identityKey.toHex() },
|
|
95
|
-
|
|
96
|
-
text: message,
|
|
96
|
+
created: new Date().toISOString(),
|
|
97
|
+
blocks: [{ type: 'text', text: message }],
|
|
97
98
|
// TODO(wittjosiah): Context based on attention.
|
|
98
99
|
// context: context ? makeRef(context) : undefined,
|
|
99
100
|
}),
|
package/src/components/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const ChannelContainer = lazy(() => import('./ChannelContainer'));
|
|
8
8
|
|
|
9
9
|
// TODO(wittjosiah): Suspense boundary for sidebar?
|
|
10
10
|
export * from './CommentContainer';
|
|
@@ -2,35 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Expando } from '@dxos/echo-schema';
|
|
6
5
|
import { PublicKey } 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, {
|
|
@@ -41,8 +18,8 @@ export const createCommentThread = (identity: Identity) => {
|
|
|
41
18
|
sender: {
|
|
42
19
|
identityKey: faker.datatype.boolean() ? identity.identityKey.toHex() : PublicKey.random().toHex(),
|
|
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.
|
package/src/hooks/analytics.ts
CHANGED
|
@@ -9,6 +9,7 @@ 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
14
|
export const useAnalyticsCallback = (spaceId: string | undefined, name: string, meta?: any) => {
|
|
14
15
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -23,12 +24,16 @@ export const useAnalyticsCallback = (spaceId: string | undefined, name: string,
|
|
|
23
24
|
);
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
export const useOnEditAnalytics = (
|
|
27
|
+
export const useOnEditAnalytics = (
|
|
28
|
+
message: ReactiveObject<any>,
|
|
29
|
+
textBlock: TextContentBlock | undefined,
|
|
30
|
+
editing: boolean,
|
|
31
|
+
) => {
|
|
27
32
|
const space = getSpace(message);
|
|
28
33
|
|
|
29
34
|
const onEditAnalytics = useAnalyticsCallback(space?.id, 'threads.comment-edited', {
|
|
30
35
|
messageId: message.id,
|
|
31
|
-
messageLength:
|
|
36
|
+
messageLength: textBlock?.text.length,
|
|
32
37
|
});
|
|
33
38
|
|
|
34
39
|
useOnTransition(editing, true, false, onEditAnalytics);
|
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',
|
package/src/types.ts
CHANGED
|
@@ -3,22 +3,34 @@
|
|
|
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 { 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
|
|
|
@@ -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;
|
|
@@ -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/capabilities/capabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type DeepReadonly } from '@dxos/util';\n\nimport { THREAD_PLUGIN } from '../meta';\nimport { type ViewState, type ThreadState } from '../types';\n\nexport namespace ThreadCapabilities {\n type GetViewState = (subjectId: string) => ViewState;\n export const State = defineCapability<{ state: DeepReadonly<ThreadState>; getViewState: GetViewState }>(\n `${THREAD_PLUGIN}/capability/state`,\n );\n export const MutableState = defineCapability<{ state: ThreadState; getViewState: GetViewState }>(\n `${THREAD_PLUGIN}/capability/state`,\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,wBAAwB;;UAMhBC,qBAAAA;sBAEFC,QAAQC,iBACnB,GAAGC,aAAAA,mBAAgC;sBAExBC,eAAeF,iBAC1B,GAAGC,aAAAA,mBAAgC;AAEvC,GARiBH,uBAAAA,qBAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["defineCapability", "ThreadCapabilities", "State", "defineCapability", "THREAD_PLUGIN", "MutableState"]
|
|
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;AAC1B,SAASC,MAAAA,WAAU;AACnB,SAASC,gBAA0CC,QAAQC,cAAcC,oBAAoB;;;ACX7F,SAASC,kBAAkB;AAC3B,SAASC,OAAOC,cAAcC,SAAS;AACvC,OAAOC,SAASC,YAAYC,aAAaC,WAAWC,QAAQC,gBAAgB;AAE5E,SAASC,eAAe;AACxB,SAASC,gBAAgB;AAEzB,SAASC,iBAAiB;AAE1B,SAASC,mBAAkC;AAC3C,SAASC,QAAQC,aAAaC,SAASC,iBAAiBC,iBAAiBC,sBAAsB;AAC/F,SAASC,uBAAuBC,uBAAuBC,qBAAqB;AAC5E,SACEC,SACAC,sBACAC,mBACAC,gCACAC,MAAAA,WACK;AACP,SAASC,gBAAgBC,mBAAmB;;;ACnB5C,SAASC,gBAAgBC,gBAAgBC,0BAA0B;AAGnE,SAASC,YAAY;AACrB,SAASC,UAAU;AAKnB,IAAMC,SAASC,eAAeC,OAA0B;EACtDC,YAAY,OAAO;IAAEC,OAAO;EAAE;EAC9BC,OAAO,CAACC,QAAQC,UAAAA;AACdA,UAAMH;AACN,QAAIE,OAAOE,SAAQ,GAAI;AACrB,aAAO;IACT;AACA,QAAID,MAAMH,UAAU,K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AAA;KAC1CC,UAASC,mBAAmB/E,OAAOgD,YAAY,CAAA,CAAE,EAAEgC,IAAI,CAACC,YACvD,gBAAAd,OAAA,cAACe,kBAAAA;IAAiBxE,KAAKuE,QAAQpB;IAAIoB;IAAkBzE;IAAkB2E,UAAUvB;QAIrF,gBAAAO,OAAA,cAACM,OAAAA;IAAIC,MAAK;IAAOC,WAAU;IAAgBS,KAAK5D;MAChD,gBAAA2C,OAAA,cAACG,WAAWe,WAAS,MACnB,gBAAAlB,OAAA,cAACG,WAAWgB,OAAK,IAAA,CAAA,CAAA,CAAA,GAIvB,gBAAAnB,OAAA,cAACoB,gBAAAA;IAAexD;IAAwBT;IAAsBkE,QAAQ1C;IAAe,GAAGlB;MACxF,gBAAAuC,OAAA,cAACsB,cAAAA;IAAa9E;KAAqBG,EAAE,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
|
-
}
|