@dxos/plugin-thread 0.8.1 → 0.8.2-main.2f9c567
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 → ChatContainer-UTQWOBXM.mjs} +6 -6
- package/dist/lib/browser/ChatContainer-UTQWOBXM.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-6W4UKJDI.mjs → app-graph-builder-SQD3KQKB.mjs} +2 -2
- package/dist/lib/browser/app-graph-builder-SQD3KQKB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TFVPUPOO.mjs → chunk-2E5LHYLQ.mjs} +2 -2
- package/dist/lib/{node-esm/chunk-ADTVMESP.mjs.map → browser/chunk-2E5LHYLQ.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-QDJ3Y6WF.mjs → chunk-32EIWOAL.mjs} +1 -1
- package/dist/lib/browser/{chunk-QDJ3Y6WF.mjs.map → chunk-32EIWOAL.mjs.map} +1 -1
- package/dist/lib/browser/chunk-AM4MYXGU.mjs +93 -0
- package/dist/lib/browser/chunk-AM4MYXGU.mjs.map +7 -0
- package/dist/lib/browser/chunk-UT6IV2FX.mjs +17 -0
- package/dist/lib/browser/index.mjs +8 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-QAY4FLLM.mjs → intent-resolver-EDSAXXNW.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-EDSAXXNW.mjs.map +7 -0
- package/dist/lib/browser/{markdown-7KXBXCUS.mjs → markdown-M4QAJXHG.mjs} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-MT3OWULR.mjs → react-surface-FUWNPSKX.mjs} +8 -8
- package/dist/lib/browser/{react-surface-MT3OWULR.mjs.map → react-surface-FUWNPSKX.mjs.map} +3 -3
- package/dist/lib/browser/{settings-4FEC7EAX.mjs → settings-SSYDISA6.mjs} +4 -4
- package/dist/lib/browser/settings-SSYDISA6.mjs.map +7 -0
- package/dist/lib/browser/{state-PNMSLKAH.mjs → state-KBGI3QTR.mjs} +4 -4
- package/dist/lib/browser/state-KBGI3QTR.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{ChatContainer-4FNDRF3G.cjs → ChatContainer-VO5B47V4.cjs} +11 -11
- package/dist/lib/node/ChatContainer-VO5B47V4.cjs.map +7 -0
- package/dist/lib/node/{app-graph-builder-HZNWT4QU.cjs → app-graph-builder-G45JDZWQ.cjs} +5 -5
- package/dist/lib/node/app-graph-builder-G45JDZWQ.cjs.map +7 -0
- package/dist/lib/node/{chunk-E7Z3BKRQ.cjs → chunk-BUYO7P2A.cjs} +6 -6
- package/dist/lib/node/chunk-BUYO7P2A.cjs.map +7 -0
- package/dist/lib/node/{chunk-46BSFPBV.cjs → chunk-HG7J3YR3.cjs} +44 -44
- package/dist/lib/node/chunk-HG7J3YR3.cjs.map +7 -0
- package/dist/lib/node/{chunk-S2A6BXEA.cjs → chunk-KYLJU47G.cjs} +10 -10
- package/dist/lib/node/{chunk-AKINTFBH.cjs → chunk-NO6WQR36.cjs} +4 -4
- package/dist/lib/node/{chunk-AKINTFBH.cjs.map → chunk-NO6WQR36.cjs.map} +1 -1
- package/dist/lib/node/index.cjs +15 -15
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-S6FE5OR7.cjs → intent-resolver-ECFDZLCG.cjs} +17 -17
- package/dist/lib/node/intent-resolver-ECFDZLCG.cjs.map +7 -0
- package/dist/lib/node/{markdown-L2WMCQKM.cjs → markdown-G5NDD5EJ.cjs} +7 -7
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-Z45BYECE.cjs → react-surface-G7GXAK5G.cjs} +18 -18
- package/dist/lib/node/{react-surface-Z45BYECE.cjs.map → react-surface-G7GXAK5G.cjs.map} +3 -3
- package/dist/lib/node/{settings-IXCPE55J.cjs → settings-PV6MGI52.cjs} +7 -7
- package/dist/lib/node/settings-PV6MGI52.cjs.map +7 -0
- package/dist/lib/node/{state-AT73KPGZ.cjs → state-FOHMAVSU.cjs} +6 -6
- package/dist/lib/node/state-FOHMAVSU.cjs.map +7 -0
- package/dist/lib/node/types.cjs +3 -3
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{ChatContainer-NYLCL6QA.mjs → ChatContainer-IAX56SIL.mjs} +6 -6
- package/dist/lib/node-esm/ChatContainer-IAX56SIL.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-M3KK5QJH.mjs → app-graph-builder-25K4ELOR.mjs} +2 -2
- package/dist/lib/node-esm/app-graph-builder-25K4ELOR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ADTVMESP.mjs → chunk-CBAEGDBZ.mjs} +2 -2
- package/dist/lib/node-esm/chunk-CBAEGDBZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J56FORYF.mjs → chunk-IZWN4KAY.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-J56FORYF.mjs.map → chunk-IZWN4KAY.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-KUQP2ES3.mjs +19 -0
- package/dist/lib/node-esm/chunk-XTZJQJY4.mjs +94 -0
- package/dist/lib/node-esm/chunk-XTZJQJY4.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +8 -8
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-OURFRSSF.mjs → intent-resolver-GHN5XIMY.mjs} +7 -7
- package/dist/lib/node-esm/intent-resolver-GHN5XIMY.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-ZKU23UVD.mjs → markdown-WMR5AZRI.mjs} +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-KIJ767JK.mjs → react-surface-FSBMYEZJ.mjs} +8 -8
- package/dist/lib/node-esm/{react-surface-KIJ767JK.mjs.map → react-surface-FSBMYEZJ.mjs.map} +3 -3
- package/dist/lib/node-esm/{settings-ZUJQ4LWI.mjs → settings-TJ53GIH3.mjs} +4 -4
- package/dist/lib/node-esm/settings-TJ53GIH3.mjs.map +7 -0
- package/dist/lib/node-esm/{state-SSDX5O67.mjs → state-IRLEO2SB.mjs} +4 -4
- package/dist/lib/node-esm/state-IRLEO2SB.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts +5 -4
- package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +159 -50
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +2 -2
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/hooks/analytics.d.ts +3 -3
- package/dist/types/src/hooks/analytics.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +328 -61
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +35 -33
- package/src/ThreadPlugin.tsx +7 -7
- package/src/capabilities/app-graph-builder.ts +3 -3
- package/src/capabilities/intent-resolver.ts +5 -5
- package/src/capabilities/settings.ts +2 -2
- package/src/capabilities/state.ts +3 -3
- package/src/components/Chat.stories.tsx +4 -4
- package/src/components/ChatContainer.tsx +4 -4
- package/src/components/Comments.stories.tsx +2 -2
- package/src/components/CommentsContainer.tsx +2 -8
- package/src/components/MessageContainer.tsx +9 -12
- package/src/components/testing.ts +4 -4
- package/src/components/types.ts +2 -2
- package/src/hooks/analytics.ts +4 -4
- package/src/types.ts +40 -40
- package/dist/lib/browser/ChatContainer-IOOAQW6S.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-6W4UKJDI.mjs.map +0 -7
- package/dist/lib/browser/chunk-S5ZR4FYW.mjs +0 -17
- package/dist/lib/browser/chunk-TFVPUPOO.mjs.map +0 -7
- package/dist/lib/browser/chunk-WOG72DWE.mjs +0 -93
- package/dist/lib/browser/chunk-WOG72DWE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-QAY4FLLM.mjs.map +0 -7
- package/dist/lib/browser/settings-4FEC7EAX.mjs.map +0 -7
- package/dist/lib/browser/state-PNMSLKAH.mjs.map +0 -7
- package/dist/lib/node/ChatContainer-4FNDRF3G.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-HZNWT4QU.cjs.map +0 -7
- package/dist/lib/node/chunk-46BSFPBV.cjs.map +0 -7
- package/dist/lib/node/chunk-E7Z3BKRQ.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-S6FE5OR7.cjs.map +0 -7
- package/dist/lib/node/settings-IXCPE55J.cjs.map +0 -7
- package/dist/lib/node/state-AT73KPGZ.cjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-NYLCL6QA.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-M3KK5QJH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E446MGLP.mjs +0 -94
- package/dist/lib/node-esm/chunk-E446MGLP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WSE23GSG.mjs +0 -19
- package/dist/lib/node-esm/intent-resolver-OURFRSSF.mjs.map +0 -7
- package/dist/lib/node-esm/settings-ZUJQ4LWI.mjs.map +0 -7
- package/dist/lib/node-esm/state-SSDX5O67.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-S5ZR4FYW.mjs.map → chunk-UT6IV2FX.mjs.map} +0 -0
- /package/dist/lib/browser/{markdown-7KXBXCUS.mjs.map → markdown-M4QAJXHG.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-S2A6BXEA.cjs.map → chunk-KYLJU47G.cjs.map} +0 -0
- /package/dist/lib/node/{markdown-L2WMCQKM.cjs.map → markdown-G5NDD5EJ.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-WSE23GSG.mjs.map → chunk-KUQP2ES3.mjs.map} +0 -0
- /package/dist/lib/node-esm/{markdown-ZKU23UVD.mjs.map → markdown-WMR5AZRI.mjs.map} +0 -0
|
@@ -11,8 +11,8 @@ import { log } from '@dxos/log';
|
|
|
11
11
|
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
|
|
12
12
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
13
13
|
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { live, fullyQualifiedId, getSpace, makeRef } from '@dxos/react-client/echo';
|
|
15
|
+
import { DataType } from '@dxos/schema';
|
|
16
16
|
|
|
17
17
|
import { ThreadCapabilities } from './capabilities';
|
|
18
18
|
import { THREAD_PLUGIN } from '../meta';
|
|
@@ -24,7 +24,7 @@ export default (context: PluginsContext) =>
|
|
|
24
24
|
intent: ThreadAction.CreateChannel,
|
|
25
25
|
resolve: ({ spaceId, name }) => ({
|
|
26
26
|
data: {
|
|
27
|
-
object:
|
|
27
|
+
object: live(ChannelType, {
|
|
28
28
|
name,
|
|
29
29
|
queue: refFromDXN(new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, spaceId, ObjectId.random()])),
|
|
30
30
|
}),
|
|
@@ -47,7 +47,7 @@ export default (context: PluginsContext) =>
|
|
|
47
47
|
|
|
48
48
|
const { state } = context.requestCapability(ThreadCapabilities.MutableState);
|
|
49
49
|
const subjectId = fullyQualifiedId(subject);
|
|
50
|
-
const thread =
|
|
50
|
+
const thread = live(ThreadType, { name, anchor: cursor, messages: [], status: 'staged' });
|
|
51
51
|
const draft = state.drafts[subjectId];
|
|
52
52
|
if (draft) {
|
|
53
53
|
draft.push(thread);
|
|
@@ -172,7 +172,7 @@ export default (context: PluginsContext) =>
|
|
|
172
172
|
invariant(space, 'Space not found');
|
|
173
173
|
const intents = [];
|
|
174
174
|
|
|
175
|
-
const message =
|
|
175
|
+
const message = live(DataType.Message, {
|
|
176
176
|
sender,
|
|
177
177
|
created: new Date().toISOString(),
|
|
178
178
|
blocks: [{ type: 'text', text }],
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
6
|
+
import { live } from '@dxos/live-object';
|
|
7
7
|
|
|
8
8
|
import { THREAD_PLUGIN } from '../meta';
|
|
9
9
|
import { type ThreadSettingsProps, ThreadSettingsSchema } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
|
-
const settings =
|
|
12
|
+
const settings = live<ThreadSettingsProps>({});
|
|
13
13
|
return contributes(Capabilities.Settings, { schema: ThreadSettingsSchema, prefix: THREAD_PLUGIN, value: settings });
|
|
14
14
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { contributes } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
6
|
+
import { live } from '@dxos/live-object';
|
|
7
7
|
|
|
8
8
|
import { ThreadCapabilities } from './capabilities';
|
|
9
9
|
import { type ThreadState, type ViewStore } from '../types';
|
|
@@ -11,8 +11,8 @@ import { type ThreadState, type ViewStore } from '../types';
|
|
|
11
11
|
const initialViewState = { showResolvedThreads: false };
|
|
12
12
|
|
|
13
13
|
export default () => {
|
|
14
|
-
const state =
|
|
15
|
-
const viewStore =
|
|
14
|
+
const state = live<ThreadState>({ activities: {}, drafts: {} });
|
|
15
|
+
const viewStore = live<ViewStore>({});
|
|
16
16
|
|
|
17
17
|
const getViewState = (subjectId: string) => {
|
|
18
18
|
if (!viewStore[subjectId]) {
|
|
@@ -15,11 +15,11 @@ import { refFromDXN } from '@dxos/live-object';
|
|
|
15
15
|
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
16
16
|
import { faker } from '@dxos/random';
|
|
17
17
|
import { useClient } from '@dxos/react-client';
|
|
18
|
-
import {
|
|
18
|
+
import { live, type Space } from '@dxos/react-client/echo';
|
|
19
19
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
20
20
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
21
21
|
import { Thread } from '@dxos/react-ui-thread';
|
|
22
|
-
import {
|
|
22
|
+
import { DataType } from '@dxos/schema';
|
|
23
23
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
24
24
|
|
|
25
25
|
import { ChatContainer } from './ChatContainer';
|
|
@@ -38,7 +38,7 @@ const Story = () => {
|
|
|
38
38
|
setTimeout(async () => {
|
|
39
39
|
const space = await client.spaces.create();
|
|
40
40
|
const channel = space.db.add(
|
|
41
|
-
|
|
41
|
+
live(ChannelType, {
|
|
42
42
|
queue: refFromDXN(new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, space.id, ObjectId.random()])),
|
|
43
43
|
}),
|
|
44
44
|
);
|
|
@@ -81,7 +81,7 @@ const meta: Meta = {
|
|
|
81
81
|
}),
|
|
82
82
|
withTheme,
|
|
83
83
|
withLayout({ fullscreen: true, tooltips: true }),
|
|
84
|
-
withClientProvider({ createSpace: true, types: [ThreadType,
|
|
84
|
+
withClientProvider({ createSpace: true, types: [ThreadType, DataType.Message] }),
|
|
85
85
|
],
|
|
86
86
|
parameters: { translations },
|
|
87
87
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { create } from '@dxos/echo-schema';
|
|
8
8
|
import { type DXN } from '@dxos/keys';
|
|
9
9
|
import { makeRef } from '@dxos/live-object';
|
|
10
10
|
import { type Space, useMembers, useQueue } from '@dxos/react-client/echo';
|
|
@@ -14,7 +14,7 @@ import { createBasicExtensions, createThemeExtensions, listener } from '@dxos/re
|
|
|
14
14
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
15
15
|
import { mx } from '@dxos/react-ui-theme';
|
|
16
16
|
import { MessageTextbox, type MessageTextboxProps, Thread, ThreadFooter, threadLayout } from '@dxos/react-ui-thread';
|
|
17
|
-
import {
|
|
17
|
+
import { DataType } from '@dxos/schema';
|
|
18
18
|
|
|
19
19
|
import { MessageContainer } from './MessageContainer';
|
|
20
20
|
import { command } from './command-extension';
|
|
@@ -44,7 +44,7 @@ export const ChatContainer = ({ space, dxn, context, current, autoFocusTextbox }
|
|
|
44
44
|
const id = dxn.toString();
|
|
45
45
|
const identity = useIdentity()!;
|
|
46
46
|
const members = useMembers(space?.key);
|
|
47
|
-
const queue = useQueue<
|
|
47
|
+
const queue = useQueue<DataType.Message>(dxn, { pollInterval: 1_000 });
|
|
48
48
|
const activity = useStatus(space, id);
|
|
49
49
|
const { t } = useTranslation(THREAD_PLUGIN);
|
|
50
50
|
// TODO(wittjosiah): This is a hack to reset the editor after a message is sent.
|
|
@@ -84,7 +84,7 @@ export const ChatContainer = ({ space, dxn, context, current, autoFocusTextbox }
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
queue.append([
|
|
87
|
-
|
|
87
|
+
create(DataType.Message, {
|
|
88
88
|
sender: { identityDid: identity.did },
|
|
89
89
|
created: new Date().toISOString(),
|
|
90
90
|
blocks: [{ type: 'text', text: messageRef.current }],
|
|
@@ -14,7 +14,7 @@ import { faker } from '@dxos/random';
|
|
|
14
14
|
import { Filter, fullyQualifiedId, useQuery, useSpace } from '@dxos/react-client/echo';
|
|
15
15
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
16
16
|
import { type ClientRepeatedComponentProps, ClientRepeater } from '@dxos/react-client/testing';
|
|
17
|
-
import {
|
|
17
|
+
import { DataType } from '@dxos/schema';
|
|
18
18
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
19
19
|
|
|
20
20
|
import { CommentsContainer } from './CommentsContainer';
|
|
@@ -59,7 +59,7 @@ export const Default = {};
|
|
|
59
59
|
const meta: Meta = {
|
|
60
60
|
title: 'plugins/plugin-thread/Comments',
|
|
61
61
|
// TODO(wittjosiah): Use decorator.
|
|
62
|
-
render: () => <ClientRepeater component={Story} createIdentity createSpace types={[ThreadType,
|
|
62
|
+
render: () => <ClientRepeater component={Story} createIdentity createSpace types={[ThreadType, DataType.Message]} />,
|
|
63
63
|
decorators: [
|
|
64
64
|
withTheme,
|
|
65
65
|
withLayout({ fullscreen: true, tooltips: true }),
|
|
@@ -8,7 +8,7 @@ import React, { useEffect } from 'react';
|
|
|
8
8
|
import { type ThreadType } from '@dxos/plugin-space/types';
|
|
9
9
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
10
10
|
import { useTranslation, Trans } from '@dxos/react-ui';
|
|
11
|
-
import {
|
|
11
|
+
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
12
12
|
|
|
13
13
|
import { CommentContainer } from './CommentContainer';
|
|
14
14
|
import { type ThreadContainerProps } from './types';
|
|
@@ -59,13 +59,7 @@ export const CommentsContainer = ({
|
|
|
59
59
|
);
|
|
60
60
|
})
|
|
61
61
|
) : (
|
|
62
|
-
<div
|
|
63
|
-
role='alert'
|
|
64
|
-
className={mx(
|
|
65
|
-
descriptionText,
|
|
66
|
-
'place-self-center border border-dashed border-unAccent rounded-lg text-center p-4 m-4',
|
|
67
|
-
)}
|
|
68
|
-
>
|
|
62
|
+
<div role='alert' className={mx(descriptionMessage, 'place-self-center rounded-lg text-center m-4')}>
|
|
69
63
|
<h2 className='mbe-2 font-medium text-baseText'>{t('no comments title')}</h2>
|
|
70
64
|
<p>
|
|
71
65
|
<Trans
|
|
@@ -9,7 +9,7 @@ import React, { forwardRef, useCallback, useEffect, useRef, useState } from 'rea
|
|
|
9
9
|
import { Surface } from '@dxos/app-framework';
|
|
10
10
|
import { RefArray } from '@dxos/live-object';
|
|
11
11
|
import { PublicKey } from '@dxos/react-client';
|
|
12
|
-
import { type
|
|
12
|
+
import { type AnyLiveObject, type Expando, type SpaceMember } from '@dxos/react-client/echo';
|
|
13
13
|
import { useIdentity, type Identity } from '@dxos/react-client/halo';
|
|
14
14
|
import { Button, ButtonGroup, Tooltip, useOnTransition, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
15
15
|
import { createBasicExtensions, createThemeExtensions, useTextEditor } from '@dxos/react-ui-editor';
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
mx,
|
|
22
22
|
} from '@dxos/react-ui-theme';
|
|
23
23
|
import { MessageHeading, MessageRoot } from '@dxos/react-ui-thread';
|
|
24
|
-
import { type
|
|
24
|
+
import { type DataType } from '@dxos/schema';
|
|
25
25
|
|
|
26
26
|
import { command } from './command-extension';
|
|
27
27
|
import { useOnEditAnalytics } from '../hooks';
|
|
@@ -31,17 +31,14 @@ import { getMessageMetadata } from '../util';
|
|
|
31
31
|
// TODO(thure): #8149
|
|
32
32
|
const messageControlClassNames = ['!p-1 !min-bs-0 transition-opacity', hoverableControlItem];
|
|
33
33
|
|
|
34
|
-
export
|
|
35
|
-
message
|
|
36
|
-
members,
|
|
37
|
-
editable = false,
|
|
38
|
-
onDelete,
|
|
39
|
-
}: {
|
|
40
|
-
message: MessageType;
|
|
34
|
+
export type MessageContainerProps = {
|
|
35
|
+
message: DataType.Message;
|
|
41
36
|
members: SpaceMember[];
|
|
42
37
|
editable?: boolean;
|
|
43
38
|
onDelete?: (id: string) => void;
|
|
44
|
-
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const MessageContainer = ({ message, members, editable = false, onDelete }: MessageContainerProps) => {
|
|
45
42
|
const senderIdentity = members.find(
|
|
46
43
|
(member) =>
|
|
47
44
|
(message.sender.identityDid && member.identity.did === message.sender.identityDid) ||
|
|
@@ -124,7 +121,7 @@ const TextboxBlock = ({
|
|
|
124
121
|
isAuthor,
|
|
125
122
|
editing,
|
|
126
123
|
}: {
|
|
127
|
-
block:
|
|
124
|
+
block: DataType.MessageBlock.Text;
|
|
128
125
|
editing?: boolean;
|
|
129
126
|
isAuthor?: boolean;
|
|
130
127
|
identity?: Identity;
|
|
@@ -166,7 +163,7 @@ const TextboxBlock = ({
|
|
|
166
163
|
return <div role='none' ref={parentRef} className='mie-4' {...focusAttributes} />;
|
|
167
164
|
};
|
|
168
165
|
|
|
169
|
-
const MessageBlockObjectTile = forwardRef<HTMLDivElement, { subject:
|
|
166
|
+
const MessageBlockObjectTile = forwardRef<HTMLDivElement, { subject: AnyLiveObject<any> }>(
|
|
170
167
|
({ subject }, forwardedRef) => {
|
|
171
168
|
let title = subject.name ?? subject.title ?? subject.type ?? 'Object';
|
|
172
169
|
if (typeof title !== 'string') {
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { IdentityDid } from '@dxos/keys';
|
|
6
|
-
import {
|
|
6
|
+
import { live, makeRef } from '@dxos/live-object';
|
|
7
7
|
import { ThreadType } from '@dxos/plugin-space/types';
|
|
8
8
|
import { faker } from '@dxos/random';
|
|
9
9
|
import { type Identity } from '@dxos/react-client/halo';
|
|
10
|
-
import {
|
|
10
|
+
import { DataType } from '@dxos/schema';
|
|
11
11
|
|
|
12
12
|
export const createCommentThread = (identity: Identity) => {
|
|
13
|
-
return
|
|
13
|
+
return live(ThreadType, {
|
|
14
14
|
messages: faker.helpers.multiple(
|
|
15
15
|
() =>
|
|
16
16
|
makeRef(
|
|
17
|
-
|
|
17
|
+
live(DataType.Message, {
|
|
18
18
|
sender: {
|
|
19
19
|
identityDid: faker.datatype.boolean() ? identity.did : IdentityDid.random(),
|
|
20
20
|
},
|
package/src/components/types.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type AnyLiveObject } from '@dxos/client/echo';
|
|
6
6
|
import { type ThreadType } from '@dxos/plugin-space/types';
|
|
7
7
|
import { type ThreadProps } from '@dxos/react-ui-thread';
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ import { type ThreadProps } from '@dxos/react-ui-thread';
|
|
|
20
20
|
*/
|
|
21
21
|
export type ThreadContainerProps = {
|
|
22
22
|
thread: ThreadType;
|
|
23
|
-
context?:
|
|
23
|
+
context?: AnyLiveObject<any>;
|
|
24
24
|
autoFocusTextbox?: boolean;
|
|
25
25
|
onTextboxFocus?: () => void;
|
|
26
26
|
detached?: boolean;
|
package/src/hooks/analytics.ts
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
|
|
7
7
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import { type
|
|
8
|
+
import { type Live } from '@dxos/live-object';
|
|
9
9
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
10
10
|
import { getSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { useOnTransition } from '@dxos/react-ui';
|
|
12
|
-
import { type
|
|
12
|
+
import { type DataType } from '@dxos/schema';
|
|
13
13
|
|
|
14
14
|
export const useOnEditAnalytics = (
|
|
15
|
-
message:
|
|
16
|
-
textBlock:
|
|
15
|
+
message: Live<any>,
|
|
16
|
+
textBlock: DataType.MessageBlock.Text | undefined,
|
|
17
17
|
editing: boolean,
|
|
18
18
|
) => {
|
|
19
19
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
package/src/types.ts
CHANGED
|
@@ -2,86 +2,86 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { SpaceIdSchema } from '@dxos/echo-schema';
|
|
6
8
|
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
7
9
|
import { EchoObjectSchema } from '@dxos/react-client/echo';
|
|
8
|
-
import {
|
|
10
|
+
import { DataType } from '@dxos/schema';
|
|
9
11
|
|
|
10
12
|
import { THREAD_PLUGIN } from './meta';
|
|
11
13
|
|
|
12
14
|
export namespace ThreadAction {
|
|
13
15
|
const THREAD_ACTION = `${THREAD_PLUGIN}/action`;
|
|
14
16
|
|
|
15
|
-
export class CreateChannel extends
|
|
16
|
-
input:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name: S.optional(S.String),
|
|
17
|
+
export class CreateChannel extends Schema.TaggedClass<CreateChannel>()(`${THREAD_ACTION}/create-channel`, {
|
|
18
|
+
input: Schema.Struct({
|
|
19
|
+
spaceId: SpaceIdSchema,
|
|
20
|
+
name: Schema.optional(Schema.String),
|
|
20
21
|
}),
|
|
21
|
-
output:
|
|
22
|
+
output: Schema.Struct({
|
|
22
23
|
object: ChannelType,
|
|
23
24
|
}),
|
|
24
25
|
}) {}
|
|
25
26
|
|
|
26
|
-
export class Create extends
|
|
27
|
-
input:
|
|
28
|
-
name:
|
|
29
|
-
cursor:
|
|
27
|
+
export class Create extends Schema.TaggedClass<Create>()(`${THREAD_ACTION}/create`, {
|
|
28
|
+
input: Schema.Struct({
|
|
29
|
+
name: Schema.optional(Schema.String),
|
|
30
|
+
cursor: Schema.String,
|
|
30
31
|
subject: EchoObjectSchema,
|
|
31
32
|
}),
|
|
32
|
-
output:
|
|
33
|
+
output: Schema.Struct({
|
|
33
34
|
object: ThreadType,
|
|
34
35
|
}),
|
|
35
36
|
}) {}
|
|
36
37
|
|
|
37
|
-
export class
|
|
38
|
-
input:
|
|
39
|
-
|
|
38
|
+
export class Delete extends Schema.TaggedClass<Delete>()(`${THREAD_ACTION}/delete`, {
|
|
39
|
+
input: Schema.Struct({
|
|
40
|
+
thread: ThreadType,
|
|
41
|
+
subject: EchoObjectSchema,
|
|
42
|
+
cursor: Schema.optional(Schema.String),
|
|
40
43
|
}),
|
|
41
|
-
output:
|
|
44
|
+
output: Schema.Void,
|
|
42
45
|
}) {}
|
|
43
46
|
|
|
44
|
-
export class
|
|
45
|
-
input:
|
|
46
|
-
|
|
47
|
+
export class Select extends Schema.TaggedClass<Select>()(`${THREAD_ACTION}/select`, {
|
|
48
|
+
input: Schema.Struct({
|
|
49
|
+
current: Schema.String,
|
|
47
50
|
}),
|
|
48
|
-
output:
|
|
51
|
+
output: Schema.Void,
|
|
49
52
|
}) {}
|
|
50
53
|
|
|
51
|
-
export class
|
|
52
|
-
input:
|
|
54
|
+
export class ToggleResolved extends Schema.TaggedClass<ToggleResolved>()(`${THREAD_ACTION}/toggle-resolved`, {
|
|
55
|
+
input: Schema.Struct({
|
|
53
56
|
thread: ThreadType,
|
|
54
|
-
subject: EchoObjectSchema,
|
|
55
|
-
cursor: S.optional(S.String),
|
|
56
57
|
}),
|
|
57
|
-
output:
|
|
58
|
+
output: Schema.Void,
|
|
58
59
|
}) {}
|
|
59
60
|
|
|
60
|
-
export class AddMessage extends
|
|
61
|
-
input:
|
|
61
|
+
export class AddMessage extends Schema.TaggedClass<AddMessage>()(`${THREAD_ACTION}/add-message`, {
|
|
62
|
+
input: Schema.Struct({
|
|
62
63
|
subject: EchoObjectSchema,
|
|
63
64
|
thread: ThreadType,
|
|
64
|
-
sender:
|
|
65
|
-
text:
|
|
65
|
+
sender: DataType.Actor,
|
|
66
|
+
text: Schema.String,
|
|
66
67
|
}),
|
|
67
|
-
output:
|
|
68
|
+
output: Schema.Void,
|
|
68
69
|
}) {}
|
|
69
70
|
|
|
70
|
-
export class DeleteMessage extends
|
|
71
|
-
input:
|
|
71
|
+
export class DeleteMessage extends Schema.TaggedClass<DeleteMessage>()(`${THREAD_ACTION}/delete-message`, {
|
|
72
|
+
input: Schema.Struct({
|
|
72
73
|
thread: ThreadType,
|
|
73
74
|
subject: EchoObjectSchema,
|
|
74
|
-
messageId:
|
|
75
|
-
message:
|
|
76
|
-
messageIndex:
|
|
75
|
+
messageId: Schema.String,
|
|
76
|
+
message: Schema.optional(DataType.Message),
|
|
77
|
+
messageIndex: Schema.optional(Schema.Number),
|
|
77
78
|
}),
|
|
78
|
-
output:
|
|
79
|
+
output: Schema.Void,
|
|
79
80
|
}) {}
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
export const ThreadSettingsSchema =
|
|
83
|
-
|
|
84
|
-
export type ThreadSettingsProps = S.Schema.Type<typeof ThreadSettingsSchema>;
|
|
83
|
+
export const ThreadSettingsSchema = Schema.mutable(Schema.Struct({}));
|
|
84
|
+
export type ThreadSettingsProps = Schema.Schema.Type<typeof ThreadSettingsSchema>;
|
|
85
85
|
|
|
86
86
|
export interface ThreadModel {
|
|
87
87
|
root: ThreadType;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/ChatContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport { createStatic } from '@dxos/echo-schema';\nimport { type DXN } from '@dxos/keys';\nimport { makeRef } from '@dxos/live-object';\nimport { type Space, useMembers, useQueue } 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';\nimport { MessageType } from '@dxos/schema';\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 type ChatContainerProps = Omit<ThreadContainerProps, 'thread'> & {\n space: Space;\n dxn: DXN;\n};\n\nexport const ChatContainer = ({ space, dxn, context, current, autoFocusTextbox }: ChatContainerProps) => {\n const id = dxn.toString();\n const identity = useIdentity()!;\n const members = useMembers(space?.key);\n const queue = useQueue<MessageType>(dxn, { pollInterval: 1_000 });\n const activity = useStatus(space, id);\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(id, 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 || !queue) {\n return false;\n }\n\n queue.append([\n createStatic(MessageType, {\n sender: { identityDid: identity.did },\n created: new Date().toISOString(),\n blocks: [{ type: 'text', text: messageRef.current }],\n properties: context ? { context: makeRef(context) } : undefined,\n }),\n ]);\n\n messageRef.current = '';\n setAutoFocus(true);\n scrollToEnd('smooth');\n rerenderEditor();\n return true;\n };\n\n return (\n <Thread\n current={current}\n id={id}\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 {(queue?.items ?? []).map((message) => (\n <MessageContainer key={message.id} message={message} members={members} />\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\nexport default ChatContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,OAAOA,SAASC,iBAAiBC,SAASC,QAAQC,gBAAgB;AAElE,SAASC,oBAAoB;AAE7B,SAASC,eAAe;AACxB,SAAqBC,YAAYC,gBAAgB;AACjD,SAASC,mBAAmB;AAC5B,SAASC,MAAMC,YAAYC,iBAAiBC,sBAAsB;AAClE,SAASC,uBAAuBC,uBAAuBC,gBAAgB;AACvE,SAASC,iBAAiB;AAC1B,SAASC,UAAU;AACnB,SAASC,gBAA0CC,QAAQC,cAAcC,oBAAoB;AAC7F,SAASC,mBAAmB;AASrB,IAAMC,cAAc,CAAC,EAAEC,aAAY,MAA6B;AACrE,QAAM,EAAEC,EAAC,IAAKC,eAAeC,aAAAA;AAC7B,SACE,sBAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,sBAAA,cAACC,UAAUC,aAAW;IAACR;KACrB,sBAAA,cAACS,MAAAA;IAA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ChB,WAAW3B,SAAS4C,UAAU,CAACnC,OAAO;AACzC,aAAO;IACT;AAEAA,UAAMoC,OAAO;MACXC,aAAaC,aAAa;QACxBC,QAAQ;UAAEC,aAAa7C,SAAS8C;QAAI;QACpCC,UAAS,oBAAIC,KAAAA,GAAOC,YAAW;QAC/BC,QAAQ;UAAC;YAAEC,MAAM;YAAQpB,MAAMR,WAAW3B;UAAQ;;QAClDwD,YAAYzD,UAAU;UAAEA,SAAS0D,QAAQ1D,OAAAA;QAAS,IAAI2D;MACxD,CAAA;KACD;AAED/B,eAAW3B,UAAU;AACrBoB,iBAAa,IAAA;AACbiB,gBAAY,QAAA;AACZpB,mBAAAA;AACA,WAAO;EACT;AAEA,SACE,sBAAA,cAAC0C,QAAAA;IACC3D;IACAE;IACA0D,YAAW;KAEX,sBAAA,cAACC,WAAWC,MAAI;IAACF,YAAW;KAC1B,sBAAA,cAACC,WAAWE,UAAQ;IAACH,YAAW;KAC9B,sBAAA,cAACzE,OAAAA;IAAIC,MAAK;IAAOC,WAAW2E,GAAGC,cAAc,gBAAA;MACzCxD,OAAOyD,SAAS,CAAA,GAAIC,IAAI,CAACC,YACzB,sBAAA,cAACC,kBAAAA;IAAiB7D,KAAK4D,QAAQlE;IAAIkE;IAAkB9D;QAIzD,sBAAA,cAACnB,OAAAA;IAAIC,MAAK;IAAOC,WAAU;IAAgBiF,KAAKjD;MAChD,sBAAA,cAACwC,WAAWU,WAAS,MACnB,sBAAA,cAACV,WAAWW,OAAK,IAAA,CAAA,CAAA,CAAA,GAIvB,sBAAA,cAACC,gBAAAA;IAAe7C;IAAwBT;IAAsBuD,QAAQ/B;IAAe,GAAGlB;MACxF,sBAAA,cAACkD,cAAAA;IAAa/D;KAAqB5B,EAAE,kBAAA,CAAA,CAAA;AAG3C;AAEA,IAAA,wBAAeY;",
|
|
6
|
-
"names": ["React", "useLayoutEffect", "useMemo", "useRef", "useState", "createStatic", "makeRef", "useMembers", "useQueue", "useIdentity", "Icon", "ScrollArea", "useThemeContext", "useTranslation", "createBasicExtensions", "createThemeExtensions", "listener", "StackItem", "mx", "MessageTextbox", "Thread", "ThreadFooter", "threadLayout", "MessageType", "ChatHeading", "attendableId", "t", "useTranslation", "THREAD_PLUGIN", "div", "role", "className", "StackItem", "SigilButton", "Icon", "icon", "size", "HeadingLabel", "ChatContainer", "space", "dxn", "context", "current", "autoFocusTextbox", "id", "toString", "identity", "useIdentity", "members", "useMembers", "key", "queue", "useQueue", "pollInterval", "activity", "useStatus", "_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", "append", "createStatic", "MessageType", "sender", "identityDid", "did", "created", "Date", "toISOString", "blocks", "type", "properties", "makeRef", "undefined", "Thread", "classNames", "ScrollArea", "Root", "Viewport", "mx", "threadLayout", "items", "map", "message", "MessageContainer", "ref", "Scrollbar", "Thumb", "MessageTextbox", "onSend", "ThreadFooter"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { type ReactiveEchoObject } from '@dxos/client/echo';\nimport { PLANK_COMPANION_TYPE, ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\n\nimport { meta } from '../meta';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/comments`,\n // TODO(wittjosiah): Support comments on any object.\n // filter: (node): node is Node<ReactiveEchoObject<any>> => isEchoObject(node.data),\n filter: (node): node is Node<ReactiveEchoObject<any>> =>\n !!node.data && typeof node.data === 'object' && 'threads' in node.data && Array.isArray(node.data.threads),\n connector: ({ node }) => [\n {\n id: [node.id, 'comments'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'comments',\n properties: {\n label: ['comments label', { ns: meta.id }],\n icon: 'ph--chat-text--regular',\n disposition: 'hidden',\n position: 'hoist',\n },\n },\n ],\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAcC,mBAAwC;AAE/D,SAASC,sBAAsBC,iCAAiC;AAChE,SAASC,uBAAkC;AAI3C,IAAA,4BAAe,CAACC,YACdC,YAAYC,aAAaC,iBAAiB;EACxCC,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;;;IAGdE,QAAQ,CAACC,SACP,CAAC,CAACA,KAAKC,QAAQ,OAAOD,KAAKC,SAAS,YAAY,aAAaD,KAAKC,QAAQC,MAAMC,QAAQH,KAAKC,KAAKG,OAAO;IAC3GC,WAAW,CAAC,EAAEL,KAAI,MAAO;MACvB;QACEH,IAAI;UAACG,KAAKH;UAAI;UAAYS,KAAKC,yBAAAA;QAC/BC,MAAMC;QACNR,MAAM;QACNS,YAAY;UACVC,OAAO;YAAC;YAAkB;cAAEC,IAAId,KAAKD;YAAG;;UACxCgB,MAAM;UACNC,aAAa;UACbC,UAAU;QACZ;MACF;;EAEJ,CAAA;CACD;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "PLANK_COMPANION_TYPE", "ATTENDABLE_PATH_SEPARATOR", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "filter", "node", "data", "Array", "isArray", "threads", "connector", "join", "ATTENDABLE_PATH_SEPARATOR", "type", "PLANK_COMPANION_TYPE", "properties", "label", "ns", "icon", "disposition", "position"]
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-thread/src/capabilities/index.ts
|
|
2
|
-
import { lazy } from "@dxos/app-framework";
|
|
3
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-6W4UKJDI.mjs"));
|
|
4
|
-
var IntentResolver = lazy(() => import("./intent-resolver-QAY4FLLM.mjs"));
|
|
5
|
-
var Markdown = lazy(() => import("./markdown-7KXBXCUS.mjs"));
|
|
6
|
-
var ReactSurface = lazy(() => import("./react-surface-MT3OWULR.mjs"));
|
|
7
|
-
var ThreadSettings = lazy(() => import("./settings-4FEC7EAX.mjs"));
|
|
8
|
-
var ThreadState = lazy(() => import("./state-PNMSLKAH.mjs"));
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
AppGraphBuilder,
|
|
12
|
-
IntentResolver,
|
|
13
|
-
Markdown,
|
|
14
|
-
ReactSurface,
|
|
15
|
-
ThreadState
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=chunk-S5ZR4FYW.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/command-extension.ts", "../../../src/util.ts", "../../../src/components/MessageContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\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?.did,\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", "//\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 { 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';\nimport { type TextContentBlock, type MessageType } from '@dxos/schema';\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 editable = false,\n onDelete,\n}: {\n message: MessageType;\n members: SpaceMember[];\n editable?: boolean;\n onDelete?: (id: string) => void;\n}) => {\n const senderIdentity = members.find(\n (member) =>\n (message.sender.identityDid && member.identity.did === message.sender.identityDid) ||\n (message.sender.identityKey && PublicKey.equals(member.identity.identityKey, message.sender.identityKey)),\n )?.identity;\n const messageMetadata = getMessageMetadata(message.id, senderIdentity);\n const userIsAuthor = useIdentity()?.did === 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 const textBlock = message.blocks.find((block) => block.type === 'text');\n const references = message.blocks.filter((block) => block.type === 'reference').map((block) => block.reference);\n\n useOnEditAnalytics(message, textBlock, !!editing);\n\n return (\n <MessageRoot {...messageMetadata} classNames={[hoverableControls, hoverableFocusedWithinControls]}>\n <MessageHeading authorName={messageMetadata.authorName} timestamp={messageMetadata.timestamp}>\n <ButtonGroup classNames='mie-1'>\n {userIsAuthor && editable && (\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 {textBlock && <TextboxBlock block={textBlock} isAuthor={userIsAuthor} editing={editing} />}\n {RefArray.targets(references).map((reference, index) => (\n <MessagePart key={index} part={reference} />\n ))}\n </MessageRoot>\n );\n};\n\nconst MessagePart = ({ part }: { part: Expando }) => {\n return <MessageBlockObjectTile subject={part} />;\n};\n\nconst TextboxBlock = ({\n block,\n isAuthor,\n editing,\n}: {\n block: TextContentBlock;\n editing?: boolean;\n isAuthor?: boolean;\n identity?: Identity;\n}) => {\n const { themeMode } = useThemeContext();\n const inMemoryContentRef = useRef(block.text);\n\n const handleDocumentChange = useCallback((newState: string) => {\n inMemoryContentRef.current = newState;\n }, []);\n\n const saveDocumentChange = useCallback(() => {\n block.text = inMemoryContentRef.current;\n }, [block]);\n\n useOnTransition(editing, true, false, saveDocumentChange);\n\n const { parentRef, focusAttributes, view } = useTextEditor(\n () => ({\n initialValue: block.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 [block.text, editing, isAuthor, themeMode, handleDocumentChange],\n );\n\n useEffect(() => {\n editing && view?.focus();\n }, [editing, view]);\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"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,SAASA,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,KAAKE,OAAOG,MAAM,UAAA,GAAa;AACjD,aAAO;IACT;AACAH,WAAOI,KAAI;AACX,WAAO;EACT;AACF,CAAA;AAEA,IAAMC,SAASC,eAAeV,OAAO;EACnC;IAAEW,KAAKC,KAAKC;IAASC,OAAOC,GAAG,iDAAA;EAAmD;CACnF;AAEM,IAAMC,UAAqB;EAAClB;EAAQmB,mBAAmBR,MAAAA;;;;AC5B9D,SAASS,oBAAoB;AAI7B,SAASC,qBAAqB;AAIvB,IAAMC,qBAAqB,CAACC,IAAYC,aAAAA;AAC7C,QAAMC,WAAWC,cAAcF,UAAUG,YAAYC,MAAAA,KAAW,GAAA;AAChE,SAAO;IACLL;IACAM,UAAUL,UAAUM;IACpBC,YACEP,UAAUQ,SAASC,gBAClBT,UAAUG,cAAcO,aAAaV,SAASG,YAAYC,MAAK,CAAA,IAAMO;IACxEC,mBAAmB;MACjBC,KAAKb,UAAUQ,SAASM,MAAMD,OAAOZ,SAASY;MAC9CE,OAAOf,UAAUQ,SAASM,MAAMC,SAASd,SAASc;IACpD;EACF;AACF;;;ACrBA,SAASC,kBAAkB;AAC3B,SAASC,OAAOC,cAAcC,SAAS;AACvC,OAAOC,SAASC,YAAYC,aAAaC,WAAWC,QAAQC,gBAAgB;AAE5E,SAASC,eAAe;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GAAImC,iBAAAA;AACZ,MAAIC,QAAQpC,QAAQqC,QAAQrC,QAAQoC,SAASpC,QAAQxC,QAAQ;AAC7D,MAAI,OAAO4E,UAAU,UAAU;AAC7BA,YAAQA,OAAOE,WAAW;EAC5B;AAEA,SACE,sBAAA,cAACP,OAAAA;IACCC,MAAK;IACLjD,WAAWwD,IAAG,6BAA6BvE,mBAAmBC,8BAAAA;IAC9DgE,KAAKE;KAEL,sBAAA,cAACK,SAAAA;IAAQR,MAAK;IAAOS,OAAO;IAAGC,MAAM;MAAE1C;IAAQ;IAAG2C,UAAUP;;AAGlE,CAAA;",
|
|
6
|
-
"names": ["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", "did", "authorName", "profile", "displayName", "generateName", "undefined", "authorAvatarProps", "hue", "data", "emoji", "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", "messageControlClassNames", "hoverableControlItem", "MessageContainer", "message", "members", "editable", "onDelete", "senderIdentity", "find", "member", "sender", "identityDid", "identity", "did", "identityKey", "PublicKey", "equals", "messageMetadata", "getMessageMetadata", "id", "userIsAuthor", "useIdentity", "authorId", "editing", "setEditing", "useState", "handleDelete", "useCallback", "t", "useTranslation", "THREAD_PLUGIN", "editLabel", "deleteLabel", "textBlock", "blocks", "block", "type", "references", "filter", "map", "reference", "useOnEditAnalytics", "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", "targets", "index", "MessagePart", "key", "part", "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", "div", "role", "ref", "forwardRef", "forwardedRef", "title", "name", "content", "mx", "Surface", "limit", "data", "fallback"]
|
|
7
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
THREAD_PLUGIN
|
|
3
|
-
} from "./chunk-WBJLUUOK.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/plugin-thread/src/types.ts
|
|
6
|
-
import { S } from "@dxos/echo-schema";
|
|
7
|
-
import { ChannelType, ThreadType } from "@dxos/plugin-space/types";
|
|
8
|
-
import { EchoObjectSchema } from "@dxos/react-client/echo";
|
|
9
|
-
import { ActorSchema, MessageType } from "@dxos/schema";
|
|
10
|
-
var ThreadAction;
|
|
11
|
-
(function(ThreadAction2) {
|
|
12
|
-
const THREAD_ACTION = `${THREAD_PLUGIN}/action`;
|
|
13
|
-
class CreateChannel extends S.TaggedClass()(`${THREAD_ACTION}/create-channel`, {
|
|
14
|
-
input: S.Struct({
|
|
15
|
-
// TODO(wittjosiah): Should be SpaceId.
|
|
16
|
-
spaceId: S.String,
|
|
17
|
-
name: S.optional(S.String)
|
|
18
|
-
}),
|
|
19
|
-
output: S.Struct({
|
|
20
|
-
object: ChannelType
|
|
21
|
-
})
|
|
22
|
-
}) {
|
|
23
|
-
}
|
|
24
|
-
ThreadAction2.CreateChannel = CreateChannel;
|
|
25
|
-
class Create extends S.TaggedClass()(`${THREAD_ACTION}/create`, {
|
|
26
|
-
input: S.Struct({
|
|
27
|
-
name: S.optional(S.String),
|
|
28
|
-
cursor: S.String,
|
|
29
|
-
subject: EchoObjectSchema
|
|
30
|
-
}),
|
|
31
|
-
output: S.Struct({
|
|
32
|
-
object: ThreadType
|
|
33
|
-
})
|
|
34
|
-
}) {
|
|
35
|
-
}
|
|
36
|
-
ThreadAction2.Create = Create;
|
|
37
|
-
class Select extends S.TaggedClass()(`${THREAD_ACTION}/select`, {
|
|
38
|
-
input: S.Struct({
|
|
39
|
-
current: S.String
|
|
40
|
-
}),
|
|
41
|
-
output: S.Void
|
|
42
|
-
}) {
|
|
43
|
-
}
|
|
44
|
-
ThreadAction2.Select = Select;
|
|
45
|
-
class ToggleResolved extends S.TaggedClass()(`${THREAD_ACTION}/toggle-resolved`, {
|
|
46
|
-
input: S.Struct({
|
|
47
|
-
thread: ThreadType
|
|
48
|
-
}),
|
|
49
|
-
output: S.Void
|
|
50
|
-
}) {
|
|
51
|
-
}
|
|
52
|
-
ThreadAction2.ToggleResolved = ToggleResolved;
|
|
53
|
-
class Delete extends S.TaggedClass()(`${THREAD_ACTION}/delete`, {
|
|
54
|
-
input: S.Struct({
|
|
55
|
-
thread: ThreadType,
|
|
56
|
-
subject: EchoObjectSchema,
|
|
57
|
-
cursor: S.optional(S.String)
|
|
58
|
-
}),
|
|
59
|
-
output: S.Void
|
|
60
|
-
}) {
|
|
61
|
-
}
|
|
62
|
-
ThreadAction2.Delete = Delete;
|
|
63
|
-
class AddMessage extends S.TaggedClass()(`${THREAD_ACTION}/add-message`, {
|
|
64
|
-
input: S.Struct({
|
|
65
|
-
subject: EchoObjectSchema,
|
|
66
|
-
thread: ThreadType,
|
|
67
|
-
sender: ActorSchema,
|
|
68
|
-
text: S.String
|
|
69
|
-
}),
|
|
70
|
-
output: S.Void
|
|
71
|
-
}) {
|
|
72
|
-
}
|
|
73
|
-
ThreadAction2.AddMessage = AddMessage;
|
|
74
|
-
class DeleteMessage extends S.TaggedClass()(`${THREAD_ACTION}/delete-message`, {
|
|
75
|
-
input: S.Struct({
|
|
76
|
-
thread: ThreadType,
|
|
77
|
-
subject: EchoObjectSchema,
|
|
78
|
-
messageId: S.String,
|
|
79
|
-
message: S.optional(MessageType),
|
|
80
|
-
messageIndex: S.optional(S.Number)
|
|
81
|
-
}),
|
|
82
|
-
output: S.Void
|
|
83
|
-
}) {
|
|
84
|
-
}
|
|
85
|
-
ThreadAction2.DeleteMessage = DeleteMessage;
|
|
86
|
-
})(ThreadAction || (ThreadAction = {}));
|
|
87
|
-
var ThreadSettingsSchema = S.mutable(S.Struct({}));
|
|
88
|
-
|
|
89
|
-
export {
|
|
90
|
-
ThreadAction,
|
|
91
|
-
ThreadSettingsSchema
|
|
92
|
-
};
|
|
93
|
-
//# sourceMappingURL=chunk-WOG72DWE.mjs.map
|