@dxos/plugin-thread 0.10.0 → 0.11.1
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/{neutral/ThreadPlugin.mjs → ThreadPlugin.mjs} +26 -66
- package/dist/lib/ThreadPlugin.mjs.map +1 -0
- package/dist/lib/ThreadPlugin.node.mjs +19 -0
- package/dist/lib/ThreadPlugin.node.mjs.map +1 -0
- package/dist/lib/ThreadPlugin.workerd.mjs +19 -0
- package/dist/lib/ThreadPlugin.workerd.mjs.map +1 -0
- package/dist/lib/capabilities/node.mjs +8 -0
- package/dist/lib/capabilities/node.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +11 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-ChannelArticle.mjs +104 -0
- package/dist/lib/chunk-ChannelArticle.mjs.map +1 -0
- package/dist/lib/chunk-ChannelCreatePanel.mjs +41 -0
- package/dist/lib/chunk-ChannelCreatePanel.mjs.map +1 -0
- package/dist/lib/chunk-ThreadArticle.mjs +58 -0
- package/dist/lib/chunk-ThreadArticle.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +49 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-append-channel-message.mjs +30 -0
- package/dist/lib/chunk-append-channel-message.mjs.map +1 -0
- package/dist/lib/chunk-channel-backend-feed.mjs +68 -0
- package/dist/lib/chunk-channel-backend-feed.mjs.map +1 -0
- package/dist/lib/chunk-create-channel.mjs +31 -0
- package/dist/lib/chunk-create-channel.mjs.map +1 -0
- package/dist/lib/chunk-create-object.mjs +36 -0
- package/dist/lib/chunk-create-object.mjs.map +1 -0
- package/dist/lib/{neutral/chunk-A5JYVGL2.mjs → chunk-meta.mjs} +20 -25
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +11 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-paths.mjs +8 -0
- package/dist/lib/chunk-paths.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +38 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-types.mjs +99 -0
- package/dist/lib/chunk-types.mjs.map +1 -0
- package/dist/lib/components.mjs +105 -0
- package/dist/lib/components.mjs.map +1 -0
- package/dist/lib/containers.mjs +9 -0
- package/dist/lib/containers.mjs.map +1 -0
- package/dist/lib/hooks.mjs +45 -0
- package/dist/lib/hooks.mjs.map +1 -0
- package/dist/lib/index.mjs +5 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/operations.mjs +7 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/translations.mjs +84 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +2 -0
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/ThreadPlugin.node.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/channel-backend-feed.d.ts +1 -1
- package/dist/types/src/capabilities/channel-backend-feed.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +5 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/{Chat/Chat.d.ts → MessageThread/MessageThread.d.ts} +11 -12
- package/dist/types/src/components/MessageThread/MessageThread.d.ts.map +1 -0
- package/dist/types/src/components/MessageThread/index.d.ts +2 -0
- package/dist/types/src/components/MessageThread/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts +4 -9
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts +4 -1
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ChannelCreatePanel/ChannelCreatePanel.d.ts +4 -8
- package/dist/types/src/containers/ChannelCreatePanel/ChannelCreatePanel.d.ts.map +1 -1
- package/dist/types/src/containers/ThreadArticle/ThreadArticle.d.ts +1 -3
- package/dist/types/src/containers/ThreadArticle/ThreadArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ThreadArticle/ThreadArticle.stories.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +14 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +2 -1
- package/package.json +54 -46
- package/src/ThreadPlugin.node.ts +1 -2
- package/src/ThreadPlugin.test.ts +5 -2
- package/src/ThreadPlugin.tsx +1 -10
- package/src/capabilities/app-graph-builder.ts +5 -3
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/node.ts +18 -0
- package/src/capabilities/{react-surface.tsx → react-surface.ts} +6 -14
- package/src/components/{Chat/Chat.tsx → MessageThread/MessageThread.tsx} +20 -17
- package/src/components/{Chat → MessageThread}/index.ts +1 -1
- package/src/components/index.ts +1 -1
- package/src/containers/ChannelArticle/ChannelArticle.stories.tsx +4 -1
- package/src/containers/ChannelArticle/ChannelArticle.tsx +6 -4
- package/src/containers/ChannelCreatePanel/ChannelCreatePanel.tsx +4 -3
- package/src/containers/ThreadArticle/ThreadArticle.stories.tsx +4 -2
- package/src/containers/ThreadArticle/ThreadArticle.tsx +30 -18
- package/src/paths.ts +3 -3
- package/src/util.ts +21 -7
- package/dist/lib/neutral/ChannelArticle-CTYSCRTR.mjs +0 -122
- package/dist/lib/neutral/ChannelArticle-CTYSCRTR.mjs.map +0 -7
- package/dist/lib/neutral/ChannelCreatePanel-NUXXKHZQ.mjs +0 -38
- package/dist/lib/neutral/ChannelCreatePanel-NUXXKHZQ.mjs.map +0 -7
- package/dist/lib/neutral/ThreadArticle-ROQXQLEZ.mjs +0 -57
- package/dist/lib/neutral/ThreadArticle-ROQXQLEZ.mjs.map +0 -7
- package/dist/lib/neutral/ThreadPlugin.mjs.map +0 -7
- package/dist/lib/neutral/ThreadPlugin.node.mjs +0 -29
- package/dist/lib/neutral/ThreadPlugin.node.mjs.map +0 -7
- package/dist/lib/neutral/ThreadPlugin.workerd.mjs +0 -27
- package/dist/lib/neutral/ThreadPlugin.workerd.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-NZOWDFE5.mjs +0 -65
- package/dist/lib/neutral/app-graph-builder-NZOWDFE5.mjs.map +0 -7
- package/dist/lib/neutral/append-channel-message-YIIJY6GX.mjs +0 -34
- package/dist/lib/neutral/append-channel-message-YIIJY6GX.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/index.mjs +0 -19
- package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
- package/dist/lib/neutral/channel-backend-feed-TOS55NID.mjs +0 -57
- package/dist/lib/neutral/channel-backend-feed-TOS55NID.mjs.map +0 -7
- package/dist/lib/neutral/chunk-5VTDNDBV.mjs +0 -109
- package/dist/lib/neutral/chunk-5VTDNDBV.mjs.map +0 -7
- package/dist/lib/neutral/chunk-A5JYVGL2.mjs.map +0 -7
- package/dist/lib/neutral/chunk-GM3SGQMJ.mjs +0 -69
- package/dist/lib/neutral/chunk-GM3SGQMJ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J7OTCRYF.mjs +0 -12
- package/dist/lib/neutral/chunk-J7OTCRYF.mjs.map +0 -7
- package/dist/lib/neutral/chunk-XPUQE4Y7.mjs +0 -8
- package/dist/lib/neutral/chunk-XPUQE4Y7.mjs.map +0 -7
- package/dist/lib/neutral/components/index.mjs +0 -96
- package/dist/lib/neutral/components/index.mjs.map +0 -7
- package/dist/lib/neutral/containers/index.mjs +0 -13
- package/dist/lib/neutral/containers/index.mjs.map +0 -7
- package/dist/lib/neutral/create-channel-4CA7P2M5.mjs +0 -41
- package/dist/lib/neutral/create-channel-4CA7P2M5.mjs.map +0 -7
- package/dist/lib/neutral/create-object-O3TZ2MCJ.mjs +0 -45
- package/dist/lib/neutral/create-object-O3TZ2MCJ.mjs.map +0 -7
- package/dist/lib/neutral/hooks/index.mjs +0 -11
- package/dist/lib/neutral/hooks/index.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -34
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/meta.mjs +0 -10
- package/dist/lib/neutral/meta.mjs.map +0 -7
- package/dist/lib/neutral/navigation-resolver-LSTZL32O.mjs +0 -18
- package/dist/lib/neutral/navigation-resolver-LSTZL32O.mjs.map +0 -7
- package/dist/lib/neutral/operation-handler-RU6K2S4L.mjs +0 -13
- package/dist/lib/neutral/operation-handler-RU6K2S4L.mjs.map +0 -7
- package/dist/lib/neutral/operations/index.mjs +0 -8
- package/dist/lib/neutral/operations/index.mjs.map +0 -7
- package/dist/lib/neutral/plugin.mjs +0 -16
- package/dist/lib/neutral/plugin.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-H2EKIMSK.mjs +0 -49
- package/dist/lib/neutral/react-surface-H2EKIMSK.mjs.map +0 -7
- package/dist/lib/neutral/translations.mjs +0 -91
- package/dist/lib/neutral/translations.mjs.map +0 -7
- package/dist/lib/neutral/types/index.mjs +0 -16
- package/dist/lib/neutral/types/index.mjs.map +0 -7
- package/dist/types/src/capabilities/navigation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Chat/Chat.d.ts.map +0 -1
- package/dist/types/src/components/Chat/index.d.ts +0 -2
- package/dist/types/src/components/Chat/index.d.ts.map +0 -1
- package/src/capabilities/navigation-resolver.ts +0 -20
|
@@ -5,20 +5,19 @@
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Obj, Ref } from '@dxos/echo';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
+
import { useIdentity, useMembers } from '@dxos/halo-react';
|
|
9
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel, type ThemedClassName } from '@dxos/react-ui';
|
|
11
11
|
import { composable, composableProps } from '@dxos/react-ui';
|
|
12
12
|
import { type ThreadContentProps } from '@dxos/react-ui-thread';
|
|
13
13
|
import { Message, type Thread } from '@dxos/types';
|
|
14
14
|
import { isNonNullable } from '@dxos/util';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { MessageThread } from '#components';
|
|
17
17
|
import { useStatus } from '#hooks';
|
|
18
18
|
|
|
19
19
|
export type ThreadArticleProps = ThemedClassName<
|
|
20
20
|
{
|
|
21
|
-
space: Space;
|
|
22
21
|
thread: Thread.Thread;
|
|
23
22
|
context?: Obj.Unknown;
|
|
24
23
|
autoFocus?: boolean;
|
|
@@ -30,7 +29,9 @@ export type ThreadArticleProps = ThemedClassName<
|
|
|
30
29
|
* onto `thread.messages`. Used for comment threads and the meeting in-call chat.
|
|
31
30
|
*/
|
|
32
31
|
export const ThreadArticle = composable<HTMLDivElement, ThreadArticleProps>(
|
|
33
|
-
({
|
|
32
|
+
({ thread, context, autoFocus, current, ...props }, forwardedRef) => {
|
|
33
|
+
// Members and presence are space-scoped; a thread outside a space has nothing to resolve against.
|
|
34
|
+
const space = getSpace(thread);
|
|
34
35
|
const id = Obj.getURI(thread);
|
|
35
36
|
const identity = useIdentity()!;
|
|
36
37
|
const members = useMembers(space?.id);
|
|
@@ -57,19 +58,30 @@ export const ThreadArticle = composable<HTMLDivElement, ThreadArticleProps>(
|
|
|
57
58
|
return true;
|
|
58
59
|
};
|
|
59
60
|
|
|
61
|
+
if (!space) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
return (
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
<Panel.Root>
|
|
67
|
+
<Panel.Toolbar></Panel.Toolbar>
|
|
68
|
+
<Panel.Content asChild>
|
|
69
|
+
<MessageThread
|
|
70
|
+
{...composableProps(props)}
|
|
71
|
+
id={id}
|
|
72
|
+
identity={identity}
|
|
73
|
+
members={members}
|
|
74
|
+
messages={messages}
|
|
75
|
+
activity={activity}
|
|
76
|
+
onSend={handleSend}
|
|
77
|
+
autoFocus={autoFocus}
|
|
78
|
+
current={current}
|
|
79
|
+
ref={forwardedRef}
|
|
80
|
+
/>
|
|
81
|
+
</Panel.Content>
|
|
82
|
+
</Panel.Root>
|
|
73
83
|
);
|
|
74
84
|
},
|
|
75
85
|
);
|
|
86
|
+
|
|
87
|
+
ThreadArticle.displayName = 'ThreadArticle';
|
package/src/paths.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { GraphPath } from '@dxos/app-toolkit';
|
|
6
6
|
import { Channel } from '@dxos/types';
|
|
7
7
|
|
|
8
|
-
const { getSectionPath: getChannelsPath, getObjectPath: getChannelPath } =
|
|
8
|
+
const { getSectionPath: getChannelsPath, getObjectPath: getChannelPath } = GraphPath.createTypeSectionPaths(
|
|
9
9
|
Channel.Channel,
|
|
10
|
-
{ groupId:
|
|
10
|
+
{ groupId: GraphPath.GroupSegments.communications },
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
export { getChannelPath, getChannelsPath };
|
package/src/util.ts
CHANGED
|
@@ -3,10 +3,21 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { generateName } from '@dxos/display-name';
|
|
6
|
-
import { type Identity } from '@dxos/react-client/halo';
|
|
7
6
|
import { type MessageMetadata } from '@dxos/react-ui-thread';
|
|
8
7
|
import { hexToFallback, toFallback } from '@dxos/util';
|
|
9
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Minimal author shape for message metadata. Satisfied by both the `@dxos/halo`
|
|
11
|
+
* `Identity.Info` and `Space.Member` (hex `identityKey`, flat `displayName`/`data`).
|
|
12
|
+
*/
|
|
13
|
+
export type MessageAuthor = {
|
|
14
|
+
did?: string;
|
|
15
|
+
identityKey?: string;
|
|
16
|
+
displayName?: string;
|
|
17
|
+
// Arbitrary profile metadata (matches the `@dxos/halo` `Schema.Any`-valued `data`).
|
|
18
|
+
data?: { readonly [key: string]: any };
|
|
19
|
+
};
|
|
20
|
+
|
|
10
21
|
/**
|
|
11
22
|
* Stable hash for an arbitrary string — used as the avatar-fallback seed for
|
|
12
23
|
* external senders who have no DXOS identity (e.g. Slack/Discord-synced
|
|
@@ -28,28 +39,31 @@ const hashString = (s: string): number => {
|
|
|
28
39
|
|
|
29
40
|
export const getMessageMetadata = (
|
|
30
41
|
id: string,
|
|
31
|
-
identity?:
|
|
42
|
+
identity?: MessageAuthor,
|
|
32
43
|
/**
|
|
33
44
|
* Externally-sourced sender info (Slack/Discord/etc). Used only when no
|
|
34
45
|
* matching DXOS `identity` is available — provides `name`/`email` for the
|
|
35
46
|
* author label and a stable seed for the avatar fallback.
|
|
36
47
|
*/
|
|
37
48
|
fallbackSender?: { name?: string; email?: string },
|
|
49
|
+
/** ISO date string when the message was sent; omitted for the composer's own metadata. */
|
|
50
|
+
created?: string,
|
|
38
51
|
): MessageMetadata => {
|
|
39
52
|
const fallback = identity?.identityKey
|
|
40
|
-
? hexToFallback(identity.identityKey
|
|
53
|
+
? hexToFallback(identity.identityKey)
|
|
41
54
|
: toFallback(hashString(fallbackSender?.name ?? fallbackSender?.email ?? '0'));
|
|
42
55
|
return {
|
|
43
56
|
id,
|
|
57
|
+
timestamp: created,
|
|
44
58
|
authorId: identity?.did,
|
|
45
59
|
authorName:
|
|
46
|
-
identity?.
|
|
47
|
-
(identity?.identityKey ? generateName(identity.identityKey
|
|
60
|
+
identity?.displayName ??
|
|
61
|
+
(identity?.identityKey ? generateName(identity.identityKey) : undefined) ??
|
|
48
62
|
fallbackSender?.name ??
|
|
49
63
|
fallbackSender?.email,
|
|
50
64
|
authorAvatarProps: {
|
|
51
|
-
hue: identity?.
|
|
52
|
-
emoji: identity?.
|
|
65
|
+
hue: identity?.data?.hue ?? fallback.hue,
|
|
66
|
+
emoji: identity?.data?.emoji ?? fallback.emoji,
|
|
53
67
|
},
|
|
54
68
|
};
|
|
55
69
|
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/containers/ChannelArticle/ChannelArticle.tsx
|
|
4
|
-
import { Atom, useAtomValue } from "@effect-atom/atom-react";
|
|
5
|
-
import React, { useCallback } from "react";
|
|
6
|
-
import { Surface, useCapabilities, useOperationInvoker } from "@dxos/app-framework/ui";
|
|
7
|
-
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
8
|
-
import { Obj } from "@dxos/echo";
|
|
9
|
-
import { CallsCapabilities } from "@dxos/plugin-calls/types";
|
|
10
|
-
import { getSpace, useMembers } from "@dxos/react-client/echo";
|
|
11
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
12
|
-
import { Panel } from "@dxos/react-ui";
|
|
13
|
-
import { Menu, MenuBuilder, useMenuBuilder } from "@dxos/react-ui-menu";
|
|
14
|
-
import { Chat } from "#components";
|
|
15
|
-
import { useMessages, useStatus } from "#hooks";
|
|
16
|
-
import { meta } from "#meta";
|
|
17
|
-
import { ThreadCapabilities, ThreadOperation, resolveProvider } from "#types";
|
|
18
|
-
var NOT_JOINED = Atom.make(false);
|
|
19
|
-
var NO_ROOM = Atom.make(void 0);
|
|
20
|
-
var ChannelArticle = ({ role, subject: channel, attendableId, chatOnly }) => {
|
|
21
|
-
const identity = useIdentity();
|
|
22
|
-
const space = channel ? getSpace(channel) : void 0;
|
|
23
|
-
const members = useMembers(space?.id);
|
|
24
|
-
const id = channel ? Obj.getURI(channel) : void 0;
|
|
25
|
-
const activity = useStatus(space, id);
|
|
26
|
-
const { invokePromise } = useOperationInvoker();
|
|
27
|
-
const providers = useCapabilities(ThreadCapabilities.ChannelBackend);
|
|
28
|
-
const provider = channel ? resolveProvider(providers, channel.backend.kind) : void 0;
|
|
29
|
-
const messages = useMessages(channel);
|
|
30
|
-
const readOnly = channel ? provider?.readOnly?.(channel) ?? Obj.getMeta(channel).keys.length > 0 : false;
|
|
31
|
-
const callProvider = useCapabilities(CallsCapabilities.CallTransportProvider)[0];
|
|
32
|
-
const callManager = useCapabilities(CallsCapabilities.Manager)[0];
|
|
33
|
-
const joined = useAtomValue(callManager?.joinedAtom ?? NOT_JOINED);
|
|
34
|
-
const currentRoomId = useAtomValue(callManager?.roomIdAtom ?? NO_ROOM);
|
|
35
|
-
const inThisCall = !!id && joined && currentRoomId === id;
|
|
36
|
-
const showCall = inThisCall && !chatOnly;
|
|
37
|
-
const canStartCall = !!callProvider && !inThisCall;
|
|
38
|
-
const handleStartCall = useCallback(async () => {
|
|
39
|
-
if (!callProvider || !id) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
await callProvider.join(id);
|
|
43
|
-
}, [
|
|
44
|
-
callProvider,
|
|
45
|
-
id
|
|
46
|
-
]);
|
|
47
|
-
const menuActions = useMenuBuilder(() => {
|
|
48
|
-
const builder = MenuBuilder.make().root({
|
|
49
|
-
label: [
|
|
50
|
-
"channel-toolbar.title",
|
|
51
|
-
{
|
|
52
|
-
ns: meta.profile.key
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
});
|
|
56
|
-
if (canStartCall) {
|
|
57
|
-
builder.action("start-video-call", {
|
|
58
|
-
label: [
|
|
59
|
-
"start-video-call.menu",
|
|
60
|
-
{
|
|
61
|
-
ns: meta.profile.key
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
icon: "ph--video-camera--regular"
|
|
65
|
-
}, () => {
|
|
66
|
-
void handleStartCall();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return builder.build();
|
|
70
|
-
}, [
|
|
71
|
-
canStartCall,
|
|
72
|
-
handleStartCall
|
|
73
|
-
]);
|
|
74
|
-
const handleSend = (text) => {
|
|
75
|
-
if (!channel || !identity || readOnly) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
void invokePromise(ThreadOperation.AppendChannelMessage, {
|
|
79
|
-
channel,
|
|
80
|
-
sender: {
|
|
81
|
-
identityDid: identity.did
|
|
82
|
-
},
|
|
83
|
-
text
|
|
84
|
-
});
|
|
85
|
-
return true;
|
|
86
|
-
};
|
|
87
|
-
if (!space || !channel || !id) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
return /* @__PURE__ */ React.createElement(Panel.Root, {
|
|
91
|
-
role
|
|
92
|
-
}, canStartCall && /* @__PURE__ */ React.createElement(Menu.Root, {
|
|
93
|
-
...menuActions,
|
|
94
|
-
attendableId
|
|
95
|
-
}, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
|
|
96
|
-
asChild: true
|
|
97
|
-
}, /* @__PURE__ */ React.createElement(Menu.Toolbar, null))), showCall ? /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
98
|
-
type: AppSurface.Article,
|
|
99
|
-
data: {
|
|
100
|
-
subject: {
|
|
101
|
-
roomId: id
|
|
102
|
-
},
|
|
103
|
-
attendableId
|
|
104
|
-
},
|
|
105
|
-
limit: 1
|
|
106
|
-
})) : /* @__PURE__ */ React.createElement(Panel.Content, {
|
|
107
|
-
asChild: true
|
|
108
|
-
}, /* @__PURE__ */ React.createElement(Chat, {
|
|
109
|
-
id,
|
|
110
|
-
classNames: "dx-document",
|
|
111
|
-
identity: identity ?? void 0,
|
|
112
|
-
members,
|
|
113
|
-
messages,
|
|
114
|
-
activity,
|
|
115
|
-
onSend: handleSend,
|
|
116
|
-
readOnly
|
|
117
|
-
})));
|
|
118
|
-
};
|
|
119
|
-
export {
|
|
120
|
-
ChannelArticle as default
|
|
121
|
-
};
|
|
122
|
-
//# sourceMappingURL=ChannelArticle-CTYSCRTR.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/ChannelArticle/ChannelArticle.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom, useAtomValue } from '@effect-atom/atom-react';\nimport React, { useCallback } from 'react';\n\nimport { Surface, useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { CallsCapabilities } from '@dxos/plugin-calls/types';\nimport { getSpace, useMembers } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { Panel } from '@dxos/react-ui';\nimport { Menu, MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';\nimport { type Channel } from '@dxos/types';\n\nimport { Chat } from '#components';\nimport { useMessages, useStatus } from '#hooks';\nimport { meta } from '#meta';\nimport { ThreadCapabilities, ThreadOperation, resolveProvider } from '#types';\n\n// Stable fallbacks so `useAtomValue` always receives an atom when plugin-calls isn't present.\nconst NOT_JOINED = Atom.make(false);\nconst NO_ROOM = Atom.make<string | undefined>(undefined);\n\nexport type ChannelArticleProps = AppSurface.ObjectArticleProps<\n Channel.Channel | undefined,\n {\n roomId?: string;\n fullscreen?: boolean;\n /** Always render the chat, even while in this channel's call (used by the in-call chat companion). */\n chatOnly?: boolean;\n }\n>;\n\n/**\n * Channel article: renders the channel chat inside a document panel. Messages\n * are read and written through the channel's backend provider (resolved by\n * `channel.backend.kind`), so the container is agnostic to where messages are\n * stored. Read-only state defaults to the provider's policy, or to \"channel\n * carries foreign-key `Obj.Meta`\" when the provider has none. When plugin-calls is present, a\n * \"Start video call\" action switches the article to the call surface and the chat moves to a companion.\n */\nexport const ChannelArticle = ({ role, subject: channel, attendableId, chatOnly }: ChannelArticleProps) => {\n const identity = useIdentity();\n const space = channel ? getSpace(channel) : undefined;\n const members = useMembers(space?.id);\n const id = channel ? Obj.getURI(channel) : undefined;\n const activity = useStatus(space, id);\n const { invokePromise } = useOperationInvoker();\n\n const providers = useCapabilities(ThreadCapabilities.ChannelBackend);\n const provider = channel ? resolveProvider(providers, channel.backend.kind) : undefined;\n const messages = useMessages(channel);\n const readOnly = channel ? (provider?.readOnly?.(channel) ?? Obj.getMeta(channel).keys.length > 0) : false;\n\n const callProvider = useCapabilities(CallsCapabilities.CallTransportProvider)[0];\n const callManager = useCapabilities(CallsCapabilities.Manager)[0];\n const joined = useAtomValue(callManager?.joinedAtom ?? NOT_JOINED);\n const currentRoomId = useAtomValue(callManager?.roomIdAtom ?? NO_ROOM);\n // `chatOnly` (the in-call chat companion) keeps showing messages so the call lives only in the primary.\n const inThisCall = !!id && joined && currentRoomId === id;\n const showCall = inThisCall && !chatOnly;\n const canStartCall = !!callProvider && !inThisCall;\n\n const handleStartCall = useCallback(async () => {\n if (!callProvider || !id) {\n return;\n }\n await callProvider.join(id);\n }, [callProvider, id]);\n\n const menuActions = useMenuBuilder(() => {\n const builder = MenuBuilder.make().root({ label: ['channel-toolbar.title', { ns: meta.profile.key }] });\n if (canStartCall) {\n builder.action(\n 'start-video-call',\n { label: ['start-video-call.menu', { ns: meta.profile.key }], icon: 'ph--video-camera--regular' },\n () => {\n void handleStartCall();\n },\n );\n }\n return builder.build();\n }, [canStartCall, handleStartCall]);\n\n const handleSend = (text: string) => {\n if (!channel || !identity || readOnly) {\n return false;\n }\n\n void invokePromise(ThreadOperation.AppendChannelMessage, {\n channel,\n sender: { identityDid: identity.did },\n text,\n });\n\n return true;\n };\n\n if (!space || !channel || !id) {\n return null;\n }\n\n return (\n <Panel.Root role={role}>\n {canStartCall && (\n <Menu.Root {...menuActions} attendableId={attendableId}>\n <Panel.Toolbar asChild>\n <Menu.Toolbar />\n </Panel.Toolbar>\n </Menu.Root>\n )}\n {showCall ? (\n <Panel.Content>\n <Surface.Surface type={AppSurface.Article} data={{ subject: { roomId: id }, attendableId }} limit={1} />\n </Panel.Content>\n ) : (\n <Panel.Content asChild>\n <Chat\n id={id}\n classNames='dx-document'\n identity={identity ?? undefined}\n members={members}\n messages={messages}\n activity={activity}\n onSend={handleSend}\n readOnly={readOnly}\n />\n </Panel.Content>\n )}\n </Panel.Root>\n );\n};\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["Atom", "useAtomValue", "React", "useCallback", "Surface", "useCapabilities", "useOperationInvoker", "AppSurface", "Obj", "CallsCapabilities", "getSpace", "useMembers", "useIdentity", "Panel", "Menu", "MenuBuilder", "useMenuBuilder", "Chat", "useMessages", "useStatus", "meta", "ThreadCapabilities", "ThreadOperation", "resolveProvider", "NOT_JOINED", "make", "NO_ROOM", "undefined", "ChannelArticle", "role", "subject", "channel", "attendableId", "chatOnly", "identity", "space", "members", "id", "getURI", "activity", "invokePromise", "providers", "ChannelBackend", "provider", "backend", "kind", "messages", "readOnly", "getMeta", "keys", "length", "callProvider", "CallTransportProvider", "callManager", "Manager", "joined", "joinedAtom", "currentRoomId", "roomIdAtom", "inThisCall", "showCall", "canStartCall", "handleStartCall", "join", "menuActions", "builder", "root", "label", "ns", "profile", "key", "action", "icon", "build", "handleSend", "text", "AppendChannelMessage", "sender", "identityDid", "did", "Root", "Toolbar", "asChild", "Content", "type", "Article", "data", "roomId", "limit", "classNames", "onSend"]
|
|
7
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/containers/ChannelCreatePanel/ChannelCreatePanel.tsx
|
|
4
|
-
import React, { useCallback, useMemo } from "react";
|
|
5
|
-
import { useCapabilities } from "@dxos/app-framework/ui";
|
|
6
|
-
import { Obj } from "@dxos/echo";
|
|
7
|
-
import { Column } from "@dxos/react-ui";
|
|
8
|
-
import { Form } from "@dxos/react-ui-form";
|
|
9
|
-
import { ThreadCapabilities, buildChannelFormSchema } from "#types";
|
|
10
|
-
var ChannelCreatePanel = ({ target, onCreateObject }) => {
|
|
11
|
-
const providers = useCapabilities(ThreadCapabilities.ChannelBackend);
|
|
12
|
-
const schema = useMemo(() => buildChannelFormSchema(providers), [
|
|
13
|
-
providers
|
|
14
|
-
]);
|
|
15
|
-
const handleSave = useCallback((values) => {
|
|
16
|
-
const { name, backend } = values;
|
|
17
|
-
const { kind, ...options } = backend ?? {};
|
|
18
|
-
void onCreateObject({
|
|
19
|
-
name,
|
|
20
|
-
kind,
|
|
21
|
-
options
|
|
22
|
-
});
|
|
23
|
-
}, [
|
|
24
|
-
onCreateObject
|
|
25
|
-
]);
|
|
26
|
-
return /* @__PURE__ */ React.createElement(Form.Root, {
|
|
27
|
-
autoFocus: true,
|
|
28
|
-
db: Obj.isObject(target) ? Obj.getDatabase(target) : target,
|
|
29
|
-
schema,
|
|
30
|
-
defaultValues: {},
|
|
31
|
-
onSave: handleSave,
|
|
32
|
-
testId: "create-channel-form"
|
|
33
|
-
}, /* @__PURE__ */ React.createElement(Column.Center, null, /* @__PURE__ */ React.createElement(Form.Content, null, /* @__PURE__ */ React.createElement(Form.FieldSet, null), /* @__PURE__ */ React.createElement(Form.Submit, null))));
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
ChannelCreatePanel as default
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=ChannelCreatePanel-NUXXKHZQ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/ChannelCreatePanel/ChannelCreatePanel.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { useCapabilities } from '@dxos/app-framework/ui';\nimport { Obj } from '@dxos/echo';\nimport { type SpaceCapabilities } from '@dxos/plugin-space';\nimport { Column } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { ThreadCapabilities, buildChannelFormSchema } from '#types';\n\n/**\n * Provider-driven create panel for channels. Reads the registered\n * `ChannelBackend` providers and renders a react-ui-form whose schema is the\n * assembled `{ name?, backend: Union(...) }` — a backend selector plus the\n * selected provider's create fields (just a name field when there is a single\n * field-less provider).\n */\nexport const ChannelCreatePanel = ({ target, onCreateObject }: SpaceCapabilities.CreateObjectCustomPanelProps) => {\n const providers = useCapabilities(ThreadCapabilities.ChannelBackend);\n const schema = useMemo(() => buildChannelFormSchema(providers), [providers]);\n\n const handleSave = useCallback(\n (values: { name?: string; backend?: { kind: string } & Record<string, unknown> }) => {\n const { name, backend } = values;\n const { kind, ...options } = backend ?? {};\n void onCreateObject({ name, kind, options });\n },\n [onCreateObject],\n );\n\n return (\n <Form.Root\n autoFocus\n db={Obj.isObject(target) ? Obj.getDatabase(target) : target}\n schema={schema}\n defaultValues={{}}\n onSave={handleSave}\n testId='create-channel-form'\n >\n <Column.Center>\n <Form.Content>\n <Form.FieldSet />\n <Form.Submit />\n </Form.Content>\n </Column.Center>\n </Form.Root>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;AAIA,OAAOA,SAASC,aAAaC,eAAe;AAE5C,SAASC,uBAAuB;AAChC,SAASC,WAAW;AAEpB,SAASC,cAAc;AACvB,SAASC,YAAY;AAErB,SAASC,oBAAoBC,8BAA8B;AASpD,IAAMC,qBAAqB,CAAC,EAAEC,QAAQC,eAAc,MAAkD;AAC3G,QAAMC,YAAYT,gBAAgBI,mBAAmBM,cAAc;AACnE,QAAMC,SAASZ,QAAQ,MAAMM,uBAAuBI,SAAAA,GAAY;IAACA;GAAU;AAE3E,QAAMG,aAAad,YACjB,CAACe,WAAAA;AACC,UAAM,EAAEC,MAAMC,QAAO,IAAKF;AAC1B,UAAM,EAAEG,MAAM,GAAGC,QAAAA,IAAYF,WAAW,CAAC;AACzC,SAAKP,eAAe;MAAEM;MAAME;MAAMC;IAAQ,CAAA;EAC5C,GACA;IAACT;GAAe;AAGlB,SACE,sBAAA,cAACL,KAAKe,MAAI;IACRC,WAAAA;IACAC,IAAInB,IAAIoB,SAASd,MAAAA,IAAUN,IAAIqB,YAAYf,MAAAA,IAAUA;IACrDI;IACAY,eAAe,CAAC;IAChBC,QAAQZ;IACRa,QAAO;KAEP,sBAAA,cAACvB,OAAOwB,QAAM,MACZ,sBAAA,cAACvB,KAAKwB,SAAO,MACX,sBAAA,cAACxB,KAAKyB,UAAQ,IAAA,GACd,sBAAA,cAACzB,KAAK0B,QAAM,IAAA,CAAA,CAAA,CAAA;AAKtB;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "useCapabilities", "Obj", "Column", "Form", "ThreadCapabilities", "buildChannelFormSchema", "ChannelCreatePanel", "target", "onCreateObject", "providers", "ChannelBackend", "schema", "handleSave", "values", "name", "backend", "kind", "options", "Root", "autoFocus", "db", "isObject", "getDatabase", "defaultValues", "onSave", "testId", "Center", "Content", "FieldSet", "Submit"]
|
|
7
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/containers/ThreadArticle/ThreadArticle.tsx
|
|
4
|
-
import React, { useMemo } from "react";
|
|
5
|
-
import { Obj, Ref } from "@dxos/echo";
|
|
6
|
-
import { useMembers } from "@dxos/react-client/echo";
|
|
7
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
8
|
-
import { composable, composableProps } from "@dxos/react-ui";
|
|
9
|
-
import { Message } from "@dxos/types";
|
|
10
|
-
import { isNonNullable } from "@dxos/util";
|
|
11
|
-
import { Chat } from "#components";
|
|
12
|
-
import { useStatus } from "#hooks";
|
|
13
|
-
var ThreadArticle = composable(({ space, thread, context, autoFocus, current, ...props }, forwardedRef) => {
|
|
14
|
-
const id = Obj.getURI(thread);
|
|
15
|
-
const identity = useIdentity();
|
|
16
|
-
const members = useMembers(space?.id);
|
|
17
|
-
const activity = useStatus(space, id);
|
|
18
|
-
const messages = useMemo(() => thread.messages.map((message) => message.target).filter(isNonNullable), [
|
|
19
|
-
thread.messages
|
|
20
|
-
]);
|
|
21
|
-
const handleSend = (text) => {
|
|
22
|
-
Obj.update(thread, (thread2) => {
|
|
23
|
-
thread2.messages.push(Ref.make(Obj.make(Message.Message, {
|
|
24
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
25
|
-
sender: {
|
|
26
|
-
identityDid: identity.did
|
|
27
|
-
},
|
|
28
|
-
blocks: [
|
|
29
|
-
{
|
|
30
|
-
_tag: "text",
|
|
31
|
-
text
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
properties: context ? {
|
|
35
|
-
context: Ref.make(context)
|
|
36
|
-
} : void 0
|
|
37
|
-
})));
|
|
38
|
-
});
|
|
39
|
-
return true;
|
|
40
|
-
};
|
|
41
|
-
return /* @__PURE__ */ React.createElement(Chat, {
|
|
42
|
-
...composableProps(props),
|
|
43
|
-
id,
|
|
44
|
-
identity,
|
|
45
|
-
members,
|
|
46
|
-
messages,
|
|
47
|
-
activity,
|
|
48
|
-
onSend: handleSend,
|
|
49
|
-
autoFocus,
|
|
50
|
-
current,
|
|
51
|
-
ref: forwardedRef
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
export {
|
|
55
|
-
ThreadArticle as default
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=ThreadArticle-ROQXQLEZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/ThreadArticle/ThreadArticle.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useMemo } from 'react';\n\nimport { Obj, Ref } from '@dxos/echo';\nimport { type Space, useMembers } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { type ThreadContentProps } from '@dxos/react-ui-thread';\nimport { Message, type Thread } from '@dxos/types';\nimport { isNonNullable } from '@dxos/util';\n\nimport { Chat } from '#components';\nimport { useStatus } from '#hooks';\n\nexport type ThreadArticleProps = ThemedClassName<\n {\n space: Space;\n thread: Thread.Thread;\n context?: Obj.Unknown;\n autoFocus?: boolean;\n } & Pick<ThreadContentProps, 'current'>\n>;\n\n/**\n * Renders an AutoMerge {@link Thread} as a chat: appends new messages by pushing\n * onto `thread.messages`. Used for comment threads and the meeting in-call chat.\n */\nexport const ThreadArticle = composable<HTMLDivElement, ThreadArticleProps>(\n ({ space, thread, context, autoFocus, current, ...props }, forwardedRef) => {\n const id = Obj.getURI(thread);\n const identity = useIdentity()!;\n const members = useMembers(space?.id);\n const activity = useStatus(space, id);\n\n const messages = useMemo(\n () => thread.messages.map((message) => message.target).filter(isNonNullable),\n [thread.messages],\n );\n\n const handleSend = (text: string) => {\n Obj.update(thread, (thread) => {\n thread.messages.push(\n Ref.make(\n Obj.make(Message.Message, {\n created: new Date().toISOString(),\n sender: { identityDid: identity.did },\n blocks: [{ _tag: 'text', text }],\n properties: context ? { context: Ref.make(context) } : undefined,\n }),\n ),\n );\n });\n return true;\n };\n\n return (\n <Chat\n {...composableProps(props)}\n id={id}\n identity={identity}\n members={members}\n messages={messages}\n activity={activity}\n onSend={handleSend}\n autoFocus={autoFocus}\n current={current}\n ref={forwardedRef}\n />\n );\n },\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,OAAOA,SAASC,eAAe;AAE/B,SAASC,KAAKC,WAAW;AACzB,SAAqBC,kBAAkB;AACvC,SAASC,mBAAmB;AAE5B,SAASC,YAAYC,uBAAuB;AAE5C,SAASC,eAA4B;AACrC,SAASC,qBAAqB;AAE9B,SAASC,YAAY;AACrB,SAASC,iBAAiB;AAenB,IAAMC,gBAAgBN,WAC3B,CAAC,EAAEO,OAAOC,QAAQC,SAASC,WAAWC,SAAS,GAAGC,MAAAA,GAASC,iBAAAA;AACzD,QAAMC,KAAKlB,IAAImB,OAAOP,MAAAA;AACtB,QAAMQ,WAAWjB,YAAAA;AACjB,QAAMkB,UAAUnB,WAAWS,OAAOO,EAAAA;AAClC,QAAMI,WAAWb,UAAUE,OAAOO,EAAAA;AAElC,QAAMK,WAAWxB,QACf,MAAMa,OAAOW,SAASC,IAAI,CAACC,YAAYA,QAAQC,MAAM,EAAEC,OAAOpB,aAAAA,GAC9D;IAACK,OAAOW;GAAS;AAGnB,QAAMK,aAAa,CAACC,SAAAA;AAClB7B,QAAI8B,OAAOlB,QAAQ,CAACA,YAAAA;AAClBA,MAAAA,QAAOW,SAASQ,KACd9B,IAAI+B,KACFhC,IAAIgC,KAAK1B,QAAQA,SAAS;QACxB2B,UAAS,oBAAIC,KAAAA,GAAOC,YAAW;QAC/BC,QAAQ;UAAEC,aAAajB,SAASkB;QAAI;QACpCC,QAAQ;UAAC;YAAEC,MAAM;YAAQX;UAAK;;QAC9BY,YAAY5B,UAAU;UAAEA,SAASZ,IAAI+B,KAAKnB,OAAAA;QAAS,IAAI6B;MACzD,CAAA,CAAA,CAAA;IAGN,CAAA;AACA,WAAO;EACT;AAEA,SACE,sBAAA,cAAClC,MAAAA;IACE,GAAGH,gBAAgBW,KAAAA;IACpBE;IACAE;IACAC;IACAE;IACAD;IACAqB,QAAQf;IACRd;IACAC;IACA6B,KAAK3B;;AAGX,CAAA;",
|
|
6
|
-
"names": ["React", "useMemo", "Obj", "Ref", "useMembers", "useIdentity", "composable", "composableProps", "Message", "isNonNullable", "Chat", "useStatus", "ThreadArticle", "space", "thread", "context", "autoFocus", "current", "props", "forwardedRef", "id", "getURI", "identity", "members", "activity", "messages", "map", "message", "target", "filter", "handleSend", "text", "update", "push", "make", "created", "Date", "toISOString", "sender", "identityDid", "did", "blocks", "_tag", "properties", "undefined", "onSend", "ref"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ThreadPlugin.tsx", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-thread/PLUGIN.mdl"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ActivationEvents, Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { ClientEvents } from '@dxos/plugin-client';\nimport { translations as threadTranslations } from '@dxos/react-ui-thread/translations';\nimport { Channel, Message, Thread } from '@dxos/types';\n\nimport {\n AppGraphBuilder,\n ChannelBackendFeed,\n CreateObject,\n NavigationResolver,\n OperationHandler,\n ReactSurface,\n} from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\n// TODO(wittjosiah): Rename to ChatPlugin.\n\nexport const ThreadPlugin = Plugin.define(meta).pipe(\n AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),\n AppPlugin.addNavigationResolverModule({ activatesOn: ClientEvents.ClientReady, activate: NavigationResolver }),\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({\n schema: [Channel.Channel, Message.Message, Thread.Thread],\n }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations: [...translations, ...threadTranslations] }),\n // Default local-feed channel backend. Other plugins contribute additional\n // `ChannelBackend` providers (e.g. ATProto) earlier in plugin order.\n Plugin.addModule({\n id: 'channel-backend-feed',\n activatesOn: ActivationEvents.Startup,\n activate: ChannelBackendFeed,\n }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n);\n\nexport default ThreadPlugin;\n", "---\nid: org.dxos.plugin.thread\nname: ThreadPlugin\nversion: 0.1.0\n---\n\nThreadPlugin provides chat: channels backed by an ECHO feed and free-standing message threads.\nIt renders the channel article + companion surfaces and a thread surface, and contributes the\noperations that create a channel and append messages. Shared message/thread UI comes from\n`@dxos/react-ui-thread`, and the `Channel`/`Message`/`Thread` schema comes from `@dxos/types`.\nDocument comments and the comment-thread AI agent live in `@dxos/plugin-comments`.\n\n## Extensions\n\nThe following extension dialects are used in this document.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype Channel\n desc: |\n A chat channel. Defined in @dxos/types. Carries an optional `feed` Ref whose\n queue holds the channel's Message objects in order.\n```\n\n## Operations\n\n```mdl\nop OnCreateSpace\n key: org.dxos.plugin.thread.operation.onCreateSpace\n desc: On space creation, create a default \"General\" channel in the root collection.\n```\n\n```mdl\nop CreateChannel\n key: org.dxos.plugin.thread.operation.createChannel\n desc: Create a new Channel in the given space.\n in:\n spaceId: SpaceId\n name?: String\n out:\n object: Channel\n```\n\n```mdl\nop AppendChannelMessage\n key: org.dxos.plugin.thread.operation.appendChannelMessage\n desc: Append a Message authored by `sender` to the channel's feed.\n in:\n channel: Channel\n sender: Actor\n text: String\n```\n\n## Features\n\n```mdl\nfeat F-1: Channel chat\n req F-1.1: A Channel article MUST render its feed messages newest-last with a\n pinned composer; sending invokes AppendChannelMessage.\n req F-1.2: Externally-synced channels (those carrying foreign-key Obj.Meta) MUST\n render read-only \u2014 the composer is suppressed.\n```\n\n```mdl\nfeat F-2: Thread chat\n req F-2.1: A Thread article MUST render the thread's messages and append new\n messages by pushing onto `thread.messages`.\n```\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SAASC,gBAAgBC,0BAA0B;AACnD,SAASC,SAASC,SAASC,cAAc;AAEzC,SACEC,iBACAC,oBACAC,cACAC,oBACAC,kBACAC,oBACK;AACP,SAASC,YAAY;AACrB,SAASX,oBAAoB;;;ACnB7B;;;AD0BO,IAAMY,eAAeC,OAAOC,OAAOC,IAAAA,EAAMC;EAC9CC,UAAUC,kBAAkB;IAAEC,UAAUC;EAAgB,CAAA;EACxDH,UAAUI,4BAA4B;IAAEC,aAAaC,aAAaC;IAAaL,UAAUM;EAAmB,CAAA;EAC5GR,UAAUS,sBAAsB;IAAEP,UAAUQ;EAAa,CAAA;EACzDV,UAAUW,0BAA0B;IAAET,UAAUU;EAAiB,CAAA;EACjEZ,UAAUa,gBAAgB;IACxBC,QAAQ;MAACC,QAAQA;MAASC,QAAQA;MAASC,OAAOA;;EACpD,CAAA;EACAjB,UAAUkB,iBAAiB;IAAEhB,UAAUiB;EAAa,CAAA;EACpDnB,UAAUoB,sBAAsB;IAAEC,cAAc;SAAIA;SAAiBC;;EAAoB,CAAA;;;EAGzF1B,OAAO2B,UAAU;IACfC,IAAI;IACJnB,aAAaoB,iBAAiBC;IAC9BxB,UAAUyB;EACZ,CAAA;EACA3B,UAAU4B,qBAAqB;IAC7BC,OAAO;MAAEC,UAAUhC,KAAKiC,QAAQC;MAAKC,MAAM;MAAcC,SAASC;MAAYC,UAAU;IAAoB;EAC9G,CAAA;EACAxC,OAAOyC;AAAI;AAGb,IAAA,uBAAe1C;",
|
|
6
|
-
"names": ["ActivationEvents", "Plugin", "AppPlugin", "ClientEvents", "translations", "threadTranslations", "Channel", "Message", "Thread", "AppGraphBuilder", "ChannelBackendFeed", "CreateObject", "NavigationResolver", "OperationHandler", "ReactSurface", "meta", "ThreadPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addAppGraphModule", "activate", "AppGraphBuilder", "addNavigationResolverModule", "activatesOn", "ClientEvents", "ClientReady", "NavigationResolver", "addCreateObjectModule", "CreateObject", "addOperationHandlerModule", "OperationHandler", "addSchemaModule", "schema", "Channel", "Message", "Thread", "addSurfaceModule", "ReactSurface", "addTranslationsModule", "translations", "threadTranslations", "addModule", "id", "ActivationEvents", "Startup", "ChannelBackendFeed", "addPluginAssetModule", "asset", "pluginId", "profile", "key", "path", "content", "pluginSpec", "mimeType", "make"]
|
|
7
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/ThreadPlugin.node.ts
|
|
4
|
-
import { ActivationEvents, Plugin } from "@dxos/app-framework";
|
|
5
|
-
import { AppPlugin } from "@dxos/app-toolkit";
|
|
6
|
-
import { Channel, Message, Thread } from "@dxos/types";
|
|
7
|
-
import { ChannelBackendFeed, CreateObject, OperationHandler } from "#capabilities";
|
|
8
|
-
import { meta } from "#meta";
|
|
9
|
-
var ThreadPlugin = Plugin.define(meta).pipe(AppPlugin.addCreateObjectModule({
|
|
10
|
-
activate: CreateObject
|
|
11
|
-
}), AppPlugin.addOperationHandlerModule({
|
|
12
|
-
activate: OperationHandler
|
|
13
|
-
}), AppPlugin.addSchemaModule({
|
|
14
|
-
schema: [
|
|
15
|
-
Channel.Channel,
|
|
16
|
-
Message.Message,
|
|
17
|
-
Thread.Thread
|
|
18
|
-
]
|
|
19
|
-
}), Plugin.addModule({
|
|
20
|
-
id: "channel-backend-feed",
|
|
21
|
-
activatesOn: ActivationEvents.Startup,
|
|
22
|
-
activate: ChannelBackendFeed
|
|
23
|
-
}), Plugin.make);
|
|
24
|
-
var ThreadPlugin_node_default = ThreadPlugin;
|
|
25
|
-
export {
|
|
26
|
-
ThreadPlugin,
|
|
27
|
-
ThreadPlugin_node_default as default
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=ThreadPlugin.node.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ThreadPlugin.node.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ActivationEvents, Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Channel, Message, Thread } from '@dxos/types';\n\nimport { ChannelBackendFeed, CreateObject, OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\n\nexport const ThreadPlugin = Plugin.define(meta).pipe(\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({\n schema: [Channel.Channel, Message.Message, Thread.Thread],\n }),\n Plugin.addModule({\n id: 'channel-backend-feed',\n activatesOn: ActivationEvents.Startup,\n activate: ChannelBackendFeed,\n }),\n Plugin.make,\n);\n\nexport default ThreadPlugin;\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,iBAAiB;AAC1B,SAASC,SAASC,SAASC,cAAc;AAEzC,SAASC,oBAAoBC,cAAcC,wBAAwB;AACnE,SAASC,YAAY;AAEd,IAAMC,eAAeT,OAAOU,OAAOF,IAAAA,EAAMG,KAC9CV,UAAUW,sBAAsB;EAAEC,UAAUP;AAAa,CAAA,GACzDL,UAAUa,0BAA0B;EAAED,UAAUN;AAAiB,CAAA,GACjEN,UAAUc,gBAAgB;EACxBC,QAAQ;IAACd,QAAQA;IAASC,QAAQA;IAASC,OAAOA;;AACpD,CAAA,GACAJ,OAAOiB,UAAU;EACfC,IAAI;EACJC,aAAapB,iBAAiBqB;EAC9BP,UAAUR;AACZ,CAAA,GACAL,OAAOqB,IAAI;AAGb,IAAA,4BAAeZ;",
|
|
6
|
-
"names": ["ActivationEvents", "Plugin", "AppPlugin", "Channel", "Message", "Thread", "ChannelBackendFeed", "CreateObject", "OperationHandler", "meta", "ThreadPlugin", "define", "pipe", "addCreateObjectModule", "activate", "addOperationHandlerModule", "addSchemaModule", "schema", "addModule", "id", "activatesOn", "Startup", "make"]
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/ThreadPlugin.workerd.ts
|
|
4
|
-
import { ActivationEvents, Plugin } from "@dxos/app-framework";
|
|
5
|
-
import { AppPlugin } from "@dxos/app-toolkit";
|
|
6
|
-
import { Channel, Message, Thread } from "@dxos/types";
|
|
7
|
-
import { ChannelBackendFeed, OperationHandler } from "#capabilities";
|
|
8
|
-
import { meta } from "#meta";
|
|
9
|
-
var ThreadPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({
|
|
10
|
-
activate: OperationHandler
|
|
11
|
-
}), AppPlugin.addSchemaModule({
|
|
12
|
-
schema: [
|
|
13
|
-
Channel.Channel,
|
|
14
|
-
Message.Message,
|
|
15
|
-
Thread.Thread
|
|
16
|
-
]
|
|
17
|
-
}), Plugin.addModule({
|
|
18
|
-
id: "channel-backend-feed",
|
|
19
|
-
activatesOn: ActivationEvents.Startup,
|
|
20
|
-
activate: ChannelBackendFeed
|
|
21
|
-
}), Plugin.make);
|
|
22
|
-
var ThreadPlugin_workerd_default = ThreadPlugin;
|
|
23
|
-
export {
|
|
24
|
-
ThreadPlugin,
|
|
25
|
-
ThreadPlugin_workerd_default as default
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=ThreadPlugin.workerd.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ThreadPlugin.workerd.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ActivationEvents, Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Channel, Message, Thread } from '@dxos/types';\n\nimport { ChannelBackendFeed, OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\n\nexport const ThreadPlugin = Plugin.define(meta).pipe(\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({\n schema: [Channel.Channel, Message.Message, Thread.Thread],\n }),\n Plugin.addModule({\n id: 'channel-backend-feed',\n activatesOn: ActivationEvents.Startup,\n activate: ChannelBackendFeed,\n }),\n Plugin.make,\n);\n\nexport default ThreadPlugin;\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,iBAAiB;AAC1B,SAASC,SAASC,SAASC,cAAc;AAEzC,SAASC,oBAAoBC,wBAAwB;AACrD,SAASC,YAAY;AAEd,IAAMC,eAAeR,OAAOS,OAAOF,IAAAA,EAAMG,KAC9CT,UAAUU,0BAA0B;EAAEC,UAAUN;AAAiB,CAAA,GACjEL,UAAUY,gBAAgB;EACxBC,QAAQ;IAACZ,QAAQA;IAASC,QAAQA;IAASC,OAAOA;;AACpD,CAAA,GACAJ,OAAOe,UAAU;EACfC,IAAI;EACJC,aAAalB,iBAAiBmB;EAC9BN,UAAUP;AACZ,CAAA,GACAL,OAAOmB,IAAI;AAGb,IAAA,+BAAeX;",
|
|
6
|
-
"names": ["ActivationEvents", "Plugin", "AppPlugin", "Channel", "Message", "Thread", "ChannelBackendFeed", "OperationHandler", "meta", "ThreadPlugin", "define", "pipe", "addOperationHandlerModule", "activate", "addSchemaModule", "schema", "addModule", "id", "activatesOn", "Startup", "make"]
|
|
7
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getChannelsPath
|
|
3
|
-
} from "./chunk-J7OTCRYF.mjs";
|
|
4
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/app-graph-builder.ts
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capability } from "@dxos/app-framework";
|
|
9
|
-
import { AppCapabilities, AppNode, AppNodeMatcher, Paths, TypeSection } from "@dxos/app-toolkit";
|
|
10
|
-
import { Operation } from "@dxos/compute";
|
|
11
|
-
import { Obj, Type } from "@dxos/echo";
|
|
12
|
-
import { CallsCapabilities } from "@dxos/plugin-calls/types";
|
|
13
|
-
import { GraphBuilder } from "@dxos/plugin-graph";
|
|
14
|
-
import { SpaceOperation } from "@dxos/plugin-space";
|
|
15
|
-
import { Channel } from "@dxos/types";
|
|
16
|
-
import { Position } from "@dxos/util";
|
|
17
|
-
import { meta } from "#meta";
|
|
18
|
-
var channelTypename = Type.getTypename(Channel.Channel);
|
|
19
|
-
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
20
|
-
const capabilities = yield* Capability.Service;
|
|
21
|
-
const extensions = yield* Effect.all([
|
|
22
|
-
TypeSection.createTypeSectionExtension(Channel.Channel, {
|
|
23
|
-
match: AppNodeMatcher.whenNavTreeGroup(Paths.GroupTypes.communications),
|
|
24
|
-
createObject: (space) => Operation.invoke(SpaceOperation.OpenCreateObject, {
|
|
25
|
-
target: space.db,
|
|
26
|
-
typename: channelTypename,
|
|
27
|
-
targetNodeId: getChannelsPath(space.db.spaceId)
|
|
28
|
-
})
|
|
29
|
-
}),
|
|
30
|
-
GraphBuilder.createTypeExtension({
|
|
31
|
-
id: "channelChatCompanion",
|
|
32
|
-
type: Channel.Channel,
|
|
33
|
-
connector: (channel, get) => {
|
|
34
|
-
const [callManager] = get(capabilities.atom(CallsCapabilities.Manager));
|
|
35
|
-
if (!callManager) {
|
|
36
|
-
return Effect.succeed([]);
|
|
37
|
-
}
|
|
38
|
-
const joined = get(callManager.joinedAtom);
|
|
39
|
-
const roomId = get(callManager.roomIdAtom);
|
|
40
|
-
if (!joined || roomId !== Obj.getURI(channel)) {
|
|
41
|
-
return Effect.succeed([]);
|
|
42
|
-
}
|
|
43
|
-
return Effect.succeed([
|
|
44
|
-
AppNode.makeCompanion({
|
|
45
|
-
id: "chat",
|
|
46
|
-
label: [
|
|
47
|
-
"channel-companion.label",
|
|
48
|
-
{
|
|
49
|
-
ns: meta.profile.key
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
icon: "ph--hash--regular",
|
|
53
|
-
data: "chat",
|
|
54
|
-
position: Position.first
|
|
55
|
-
})
|
|
56
|
-
]);
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
]);
|
|
60
|
-
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
61
|
-
}));
|
|
62
|
-
export {
|
|
63
|
-
app_graph_builder_default as default
|
|
64
|
-
};
|
|
65
|
-
//# sourceMappingURL=app-graph-builder-NZOWDFE5.mjs.map
|
|
@@ -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 * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities, AppNode, AppNodeMatcher, Paths, TypeSection } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\nimport { Obj, Type } from '@dxos/echo';\nimport { CallsCapabilities } from '@dxos/plugin-calls/types';\nimport { GraphBuilder } from '@dxos/plugin-graph';\nimport { SpaceOperation } from '@dxos/plugin-space';\nimport { Channel } from '@dxos/types';\nimport { Position } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nimport { getChannelsPath } from '../paths';\n\nconst channelTypename = Type.getTypename(Channel.Channel);\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const capabilities = yield* Capability.Service;\n\n const extensions = yield* Effect.all([\n TypeSection.createTypeSectionExtension(Channel.Channel, {\n match: AppNodeMatcher.whenNavTreeGroup(Paths.GroupTypes.communications),\n createObject: (space) =>\n Operation.invoke(SpaceOperation.OpenCreateObject, {\n target: space.db,\n typename: channelTypename,\n targetNodeId: getChannelsPath(space.db.spaceId),\n }),\n }),\n\n GraphBuilder.createTypeExtension({\n id: 'channelChatCompanion',\n type: Channel.Channel,\n connector: (channel, get) => {\n const [callManager] = get(capabilities.atom(CallsCapabilities.Manager));\n if (!callManager) {\n return Effect.succeed([]);\n }\n const joined = get(callManager.joinedAtom);\n const roomId = get(callManager.roomIdAtom);\n if (!joined || roomId !== Obj.getURI(channel)) {\n return Effect.succeed([]);\n }\n\n return Effect.succeed([\n AppNode.makeCompanion({\n id: 'chat',\n label: ['channel-companion.label', { ns: meta.profile.key }],\n icon: 'ph--hash--regular',\n data: 'chat',\n position: Position.first,\n }),\n ]);\n },\n }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiBC,SAASC,gBAAgBC,OAAOC,mBAAmB;AAC7E,SAASC,iBAAiB;AAC1B,SAASC,KAAKC,YAAY;AAC1B,SAASC,yBAAyB;AAClC,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,eAAe;AACxB,SAASC,gBAAgB;AAEzB,SAASC,YAAY;AAIrB,IAAMC,kBAAkBC,KAAKC,YAAYC,QAAQA,OAAO;AAExD,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,eAAe,OAAOH,WAAWI;AAEvC,QAAMC,aAAa,OAAcC,WAAI;IACnCC,YAAYC,2BAA2BT,QAAQA,SAAS;MACtDU,OAAOC,eAAeC,iBAAiBC,MAAMC,WAAWC,cAAc;MACtEC,cAAc,CAACC,UACbC,UAAUC,OAAOC,eAAeC,kBAAkB;QAChDC,QAAQL,MAAMM;QACdC,UAAU3B;QACV4B,cAAcC,gBAAgBT,MAAMM,GAAGI,OAAO;MAChD,CAAA;IACJ,CAAA;IAEAC,aAAaC,oBAAoB;MAC/BC,IAAI;MACJC,MAAM/B,QAAQA;MACdgC,WAAW,CAACC,SAASC,QAAAA;AACnB,cAAM,CAACC,WAAAA,IAAeD,IAAI9B,aAAagC,KAAKC,kBAAkBC,OAAO,CAAA;AACrE,YAAI,CAACH,aAAa;AAChB,iBAAcI,eAAQ,CAAA,CAAE;QAC1B;AACA,cAAMC,SAASN,IAAIC,YAAYM,UAAU;AACzC,cAAMC,SAASR,IAAIC,YAAYQ,UAAU;AACzC,YAAI,CAACH,UAAUE,WAAWE,IAAIC,OAAOZ,OAAAA,GAAU;AAC7C,iBAAcM,eAAQ,CAAA,CAAE;QAC1B;AAEA,eAAcA,eAAQ;UACpBO,QAAQC,cAAc;YACpBjB,IAAI;YACJkB,OAAO;cAAC;cAA2B;gBAAEC,IAAIC,KAAKC,QAAQC;cAAI;;YAC1DC,MAAM;YACNC,MAAM;YACNC,UAAUC,SAASC;UACrB,CAAA;SACD;MACH;IACF,CAAA;GACD;AAED,SAAOxD,WAAWyD,YAAYC,gBAAgBC,iBAAiBtD,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "AppCapabilities", "AppNode", "AppNodeMatcher", "Paths", "TypeSection", "Operation", "Obj", "Type", "CallsCapabilities", "GraphBuilder", "SpaceOperation", "Channel", "Position", "meta", "channelTypename", "Type", "getTypename", "Channel", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "extensions", "all", "TypeSection", "createTypeSectionExtension", "match", "AppNodeMatcher", "whenNavTreeGroup", "Paths", "GroupTypes", "communications", "createObject", "space", "Operation", "invoke", "SpaceOperation", "OpenCreateObject", "target", "db", "typename", "targetNodeId", "getChannelsPath", "spaceId", "GraphBuilder", "createTypeExtension", "id", "type", "connector", "channel", "get", "callManager", "atom", "CallsCapabilities", "Manager", "succeed", "joined", "joinedAtom", "roomId", "roomIdAtom", "Obj", "getURI", "AppNode", "makeCompanion", "label", "ns", "meta", "profile", "key", "icon", "data", "position", "Position", "first", "contributes", "AppCapabilities", "AppGraphBuilder"]
|
|
7
|
-
}
|