@dxos/plugin-thread 0.6.12-main.5cc132e → 0.6.12-main.7907542
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/{ThreadArticle-6L6BGE4Z.mjs → ThreadArticle-4VU752F4.mjs} +3 -3
- package/dist/lib/{node-esm/ThreadMain-DU6LBSN3.mjs → browser/ThreadMain-ML3P4XSD.mjs} +3 -3
- package/dist/lib/browser/{chunk-5IBJO53M.mjs → chunk-7NUYW5IW.mjs} +2 -5
- package/dist/lib/browser/chunk-7NUYW5IW.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-U5UVX4ZP.mjs → browser/chunk-GJRBBPXI.mjs} +2 -2
- package/dist/lib/browser/{chunk-AVC4CGJM.mjs → chunk-XF5QKI75.mjs} +8 -6
- package/dist/lib/browser/chunk-XF5QKI75.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +46 -111
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/{ThreadArticle-7BWXVIJ4.cjs → ThreadArticle-ERUHPHVT.cjs} +7 -7
- package/dist/lib/node/{ThreadMain-XSRB6NKJ.cjs → ThreadMain-6DN7FDNB.cjs} +7 -7
- package/dist/lib/node/{chunk-BWBONZGU.cjs → chunk-6EVXCSDS.cjs} +5 -18
- package/dist/lib/node/chunk-6EVXCSDS.cjs.map +7 -0
- package/dist/lib/node/{chunk-4B2ARV7L.cjs → chunk-FXD3DYMO.cjs} +6 -6
- package/dist/lib/node/{chunk-T7TXCNHL.cjs → chunk-PZVUW4W2.cjs} +61 -59
- package/dist/lib/node/chunk-PZVUW4W2.cjs.map +7 -0
- package/dist/lib/node/index.cjs +145 -210
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.cjs +4 -4
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +3 -3
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{ThreadArticle-6L6BGE4Z.mjs → ThreadArticle-NKI5F4W5.mjs} +4 -3
- package/dist/lib/node-esm/{ThreadArticle-6L6BGE4Z.mjs.map → ThreadArticle-NKI5F4W5.mjs.map} +1 -1
- package/dist/lib/{browser/ThreadMain-DU6LBSN3.mjs → node-esm/ThreadMain-2A3VQLCW.mjs} +4 -3
- package/dist/lib/node-esm/{ThreadMain-DU6LBSN3.mjs.map → ThreadMain-2A3VQLCW.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-AVC4CGJM.mjs → chunk-A44C4MTQ.mjs} +9 -6
- package/dist/lib/node-esm/chunk-A44C4MTQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5IBJO53M.mjs → chunk-Y475KZTX.mjs} +4 -5
- package/dist/lib/node-esm/chunk-Y475KZTX.mjs.map +7 -0
- package/dist/lib/{browser/chunk-U5UVX4ZP.mjs → node-esm/chunk-YO46JGAE.mjs} +3 -2
- package/dist/lib/node-esm/{chunk-U5UVX4ZP.mjs.map → chunk-YO46JGAE.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +47 -111
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +2 -1
- package/dist/lib/node-esm/types.mjs +3 -2
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentContainer.d.ts +1 -1
- package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts +1 -5
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts +1 -2
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +2 -0
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/ThreadPlugin.tsx +31 -78
- package/src/components/ChatContainer.tsx +3 -4
- package/src/components/CommentContainer.tsx +8 -12
- package/src/components/CommentsContainer.tsx +1 -18
- package/src/components/ThreadComplementary.tsx +5 -12
- package/src/meta.tsx +1 -5
- package/dist/lib/browser/chunk-5IBJO53M.mjs.map +0 -7
- package/dist/lib/browser/chunk-AVC4CGJM.mjs.map +0 -7
- package/dist/lib/node/chunk-BWBONZGU.cjs.map +0 -7
- package/dist/lib/node/chunk-T7TXCNHL.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-5IBJO53M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AVC4CGJM.mjs.map +0 -7
- /package/dist/lib/browser/{ThreadArticle-6L6BGE4Z.mjs.map → ThreadArticle-4VU752F4.mjs.map} +0 -0
- /package/dist/lib/browser/{ThreadMain-DU6LBSN3.mjs.map → ThreadMain-ML3P4XSD.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-U5UVX4ZP.mjs.map → chunk-GJRBBPXI.mjs.map} +0 -0
- /package/dist/lib/node/{ThreadArticle-7BWXVIJ4.cjs.map → ThreadArticle-ERUHPHVT.cjs.map} +0 -0
- /package/dist/lib/node/{ThreadMain-XSRB6NKJ.cjs.map → ThreadMain-6DN7FDNB.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-4B2ARV7L.cjs.map → chunk-FXD3DYMO.cjs.map} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
ThreadAction
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YO46JGAE.mjs";
|
|
4
5
|
import {
|
|
5
6
|
ChatContainer,
|
|
6
7
|
ChatHeading,
|
|
@@ -10,29 +11,27 @@ import {
|
|
|
10
11
|
useAnalyticsCallback,
|
|
11
12
|
useOnEditAnalytics,
|
|
12
13
|
useStatus
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-A44C4MTQ.mjs";
|
|
14
15
|
import {
|
|
15
16
|
THREAD_ITEM,
|
|
16
17
|
THREAD_PLUGIN,
|
|
17
18
|
meta_default
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Y475KZTX.mjs";
|
|
19
20
|
|
|
20
21
|
// packages/plugins/plugin-thread/src/ThreadPlugin.tsx
|
|
21
|
-
import { Chat } from "@phosphor-icons/react";
|
|
22
22
|
import { computed, effect } from "@preact/signals-core";
|
|
23
23
|
import React6 from "react";
|
|
24
|
-
import { LayoutAction as LayoutAction2, NavigationAction, parseIntentPlugin, parseNavigationPlugin, resolvePlugin,
|
|
24
|
+
import { LayoutAction as LayoutAction2, NavigationAction, parseIntentPlugin, parseNavigationPlugin, resolvePlugin, isLayoutParts, parseMetadataResolverPlugin } from "@dxos/app-framework";
|
|
25
25
|
import { getTypename } from "@dxos/echo-schema";
|
|
26
26
|
import { create as create2 } from "@dxos/echo-schema";
|
|
27
27
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
28
28
|
import { log } from "@dxos/log";
|
|
29
|
-
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
30
29
|
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
31
|
-
import { createExtension, isActionGroup } from "@dxos/plugin-graph";
|
|
30
|
+
import { createExtension, isActionGroup, toSignal } from "@dxos/plugin-graph";
|
|
32
31
|
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
33
32
|
import { SpaceAction } from "@dxos/plugin-space";
|
|
34
33
|
import { ThreadType, MessageType as MessageType2, ChannelType } from "@dxos/plugin-space/types";
|
|
35
|
-
import { getSpace as getSpace2, getTextInRange,
|
|
34
|
+
import { getSpace as getSpace2, getTextInRange, createDocAccessor, fullyQualifiedId as fullyQualifiedId4, loadObjectReferences } from "@dxos/react-client/echo";
|
|
36
35
|
import { comments, createExternalCommentSync, listener as listener2 } from "@dxos/react-ui-editor";
|
|
37
36
|
import { translations as threadTranslations } from "@dxos/react-ui-thread";
|
|
38
37
|
import { nonNullable as nonNullable3 } from "@dxos/util";
|
|
@@ -56,7 +55,7 @@ var ThreadSettings = ({ settings }) => {
|
|
|
56
55
|
|
|
57
56
|
// packages/plugins/plugin-thread/src/components/CommentContainer.tsx
|
|
58
57
|
import { CheckCircle, X } from "@phosphor-icons/react";
|
|
59
|
-
import React2, { useCallback,
|
|
58
|
+
import React2, { useCallback, useMemo, useRef, useState } from "react";
|
|
60
59
|
import { create } from "@dxos/echo-schema";
|
|
61
60
|
import { MessageType } from "@dxos/plugin-space/types";
|
|
62
61
|
import { fullyQualifiedId, getSpace, useMembers } from "@dxos/react-client/echo";
|
|
@@ -112,14 +111,13 @@ var DeleteThreadButton = ({ onDelete }) => {
|
|
|
112
111
|
classNames: "z-[21]"
|
|
113
112
|
}, label, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))));
|
|
114
113
|
};
|
|
115
|
-
var CommentContainer = ({ thread, detached, context, current,
|
|
114
|
+
var CommentContainer = ({ thread, detached, context, current, onAttend, onThreadDelete, onMessageDelete, onResolve, onComment }) => {
|
|
116
115
|
const identity = useIdentity();
|
|
117
116
|
const space = getSpace(thread);
|
|
118
117
|
const members = useMembers(space?.key);
|
|
119
118
|
const activity = useStatus(space, fullyQualifiedId(thread));
|
|
120
119
|
const { t } = useTranslation2(THREAD_PLUGIN);
|
|
121
120
|
const threadScrollRef = useRef(null);
|
|
122
|
-
const [autoFocus, setAutoFocus] = useState(!!autoFocusTextbox);
|
|
123
121
|
const { themeMode } = useThemeContext();
|
|
124
122
|
const textboxMetadata = getMessageMetadata(fullyQualifiedId(thread), identity);
|
|
125
123
|
const [_count, _setCount] = useState(0);
|
|
@@ -139,11 +137,6 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
139
137
|
], [
|
|
140
138
|
_count
|
|
141
139
|
]);
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
setAutoFocus(!!autoFocusTextbox);
|
|
144
|
-
}, [
|
|
145
|
-
autoFocusTextbox
|
|
146
|
-
]);
|
|
147
140
|
const scrollToEnd = (behavior) => setTimeout(() => threadScrollRef.current?.scrollIntoView({
|
|
148
141
|
behavior,
|
|
149
142
|
block: "end"
|
|
@@ -162,7 +155,6 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
162
155
|
}));
|
|
163
156
|
onComment?.(thread);
|
|
164
157
|
messageRef.current = "";
|
|
165
|
-
setAutoFocus(true);
|
|
166
158
|
scrollToEnd("instant");
|
|
167
159
|
rerenderEditor();
|
|
168
160
|
return true;
|
|
@@ -201,7 +193,6 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
201
193
|
onDelete: (id) => onMessageDelete?.(id)
|
|
202
194
|
})), /* @__PURE__ */ React2.createElement(MessageTextbox, {
|
|
203
195
|
extensions,
|
|
204
|
-
autoFocus,
|
|
205
196
|
onSend: handleCreate,
|
|
206
197
|
...textboxMetadata
|
|
207
198
|
}), /* @__PURE__ */ React2.createElement(ThreadFooter, {
|
|
@@ -214,27 +205,15 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
214
205
|
};
|
|
215
206
|
|
|
216
207
|
// packages/plugins/plugin-thread/src/components/CommentsContainer.tsx
|
|
217
|
-
import { ChatText
|
|
218
|
-
import React3, { useEffect
|
|
208
|
+
import { ChatText } from "@phosphor-icons/react";
|
|
209
|
+
import React3, { useEffect } from "react";
|
|
219
210
|
import { fullyQualifiedId as fullyQualifiedId2 } from "@dxos/react-client/echo";
|
|
220
211
|
import { useTranslation as useTranslation3, Trans } from "@dxos/react-ui";
|
|
221
|
-
import { PlankHeading, plankHeadingIconProps } from "@dxos/react-ui-deck";
|
|
222
212
|
import { descriptionText, mx as mx2 } from "@dxos/react-ui-theme";
|
|
223
|
-
var
|
|
224
|
-
const { t } = useTranslation3(THREAD_PLUGIN);
|
|
225
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
226
|
-
role: "none",
|
|
227
|
-
className: "flex items-center"
|
|
228
|
-
}, /* @__PURE__ */ React3.createElement(PlankHeading.Button, {
|
|
229
|
-
attendableId
|
|
230
|
-
}, /* @__PURE__ */ React3.createElement(Quotes, plankHeadingIconProps)), /* @__PURE__ */ React3.createElement(PlankHeading.Label, {
|
|
231
|
-
attendableId
|
|
232
|
-
}, t("comments heading")));
|
|
233
|
-
};
|
|
234
|
-
var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTextbox, showResolvedThreads, onThreadAttend, onThreadDelete, onMessageDelete, onThreadToggleResolved, ...props }) => {
|
|
213
|
+
var CommentsContainer = ({ threads, detached = [], currentId, showResolvedThreads, onThreadAttend, onThreadDelete, onMessageDelete, onThreadToggleResolved, ...props }) => {
|
|
235
214
|
const { t } = useTranslation3(THREAD_PLUGIN);
|
|
236
215
|
const filteredThreads = showResolvedThreads ? threads : threads.filter((thread) => !(thread?.status === "resolved"));
|
|
237
|
-
|
|
216
|
+
useEffect(() => {
|
|
238
217
|
if (currentId) {
|
|
239
218
|
document.getElementById(currentId)?.scrollIntoView({
|
|
240
219
|
behavior: "smooth",
|
|
@@ -251,7 +230,6 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
|
|
|
251
230
|
thread,
|
|
252
231
|
current: currentId === threadId,
|
|
253
232
|
detached: detached.includes(threadId),
|
|
254
|
-
autoFocusTextbox: autoFocusCurrentTextbox && currentId === threadId,
|
|
255
233
|
...onThreadAttend && {
|
|
256
234
|
onAttend: () => onThreadAttend(thread)
|
|
257
235
|
},
|
|
@@ -283,18 +261,18 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
|
|
|
283
261
|
};
|
|
284
262
|
|
|
285
263
|
// packages/plugins/plugin-thread/src/components/index.ts
|
|
286
|
-
var ThreadMain = React4.lazy(() => import("./ThreadMain-
|
|
287
|
-
var ThreadArticle = React4.lazy(() => import("./ThreadArticle-
|
|
264
|
+
var ThreadMain = React4.lazy(() => import("./ThreadMain-2A3VQLCW.mjs"));
|
|
265
|
+
var ThreadArticle = React4.lazy(() => import("./ThreadArticle-NKI5F4W5.mjs"));
|
|
288
266
|
|
|
289
267
|
// packages/plugins/plugin-thread/src/components/ThreadComplementary.tsx
|
|
290
|
-
import React5, { useEffect as
|
|
268
|
+
import React5, { useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
291
269
|
import { LayoutAction, useIntentDispatcher, useResolvePlugins } from "@dxos/app-framework";
|
|
292
270
|
import { fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
|
|
293
271
|
import { ScrollArea } from "@dxos/react-ui";
|
|
294
|
-
import {
|
|
272
|
+
import { useAttended } from "@dxos/react-ui-attention";
|
|
295
273
|
import { nonNullable as nonNullable2 } from "@dxos/util";
|
|
296
274
|
var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
|
|
297
|
-
var ThreadComplementary = ({ role, subject, stagedThreads, current,
|
|
275
|
+
var ThreadComplementary = ({ role, subject, stagedThreads, current, showResolvedThreads }) => {
|
|
298
276
|
const dispatch = useIntentDispatcher();
|
|
299
277
|
const threadsIntegrators = useResolvePlugins(providesThreadsConfig);
|
|
300
278
|
const threadProvides = useMemo2(() => threadsIntegrators.map((p) => p.provides.thread), [
|
|
@@ -319,7 +297,7 @@ var ThreadComplementary = ({ role, subject, stagedThreads, current, focus, showR
|
|
|
319
297
|
}, [
|
|
320
298
|
threads
|
|
321
299
|
]);
|
|
322
|
-
|
|
300
|
+
useEffect2(() => {
|
|
323
301
|
if (!sort) {
|
|
324
302
|
return;
|
|
325
303
|
}
|
|
@@ -328,22 +306,17 @@ var ThreadComplementary = ({ role, subject, stagedThreads, current, focus, showR
|
|
|
328
306
|
sort,
|
|
329
307
|
threads
|
|
330
308
|
]);
|
|
331
|
-
const
|
|
309
|
+
const attended = useAttended();
|
|
332
310
|
const qualifiedSubjectId = fullyQualifiedId3(subject);
|
|
333
|
-
const attendableAttrs = createAttendableAttributes(qualifiedSubjectId);
|
|
334
311
|
return /* @__PURE__ */ React5.createElement("div", {
|
|
335
312
|
role: "none",
|
|
336
|
-
className: "contents
|
|
337
|
-
|
|
338
|
-
}, role === "complementary" && /* @__PURE__ */ React5.createElement(CommentsHeading, {
|
|
339
|
-
attendableId: qualifiedSubjectId
|
|
340
|
-
}), /* @__PURE__ */ React5.createElement(ScrollArea.Root, {
|
|
313
|
+
className: "contents"
|
|
314
|
+
}, /* @__PURE__ */ React5.createElement(ScrollArea.Root, {
|
|
341
315
|
classNames: "row-span-2"
|
|
342
316
|
}, /* @__PURE__ */ React5.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React5.createElement(CommentsContainer, {
|
|
343
317
|
threads,
|
|
344
318
|
detached: detachedIds,
|
|
345
|
-
currentId: attended.
|
|
346
|
-
autoFocusCurrentTextbox: focus,
|
|
319
|
+
currentId: attended.includes(qualifiedSubjectId) ? current : void 0,
|
|
347
320
|
showResolvedThreads,
|
|
348
321
|
onThreadAttend: (thread) => {
|
|
349
322
|
const threadId = fullyQualifiedId3(thread);
|
|
@@ -457,7 +430,6 @@ var ThreadPlugin = () => {
|
|
|
457
430
|
}
|
|
458
431
|
return viewStore[subjectId];
|
|
459
432
|
};
|
|
460
|
-
let attentionPlugin;
|
|
461
433
|
let navigationPlugin;
|
|
462
434
|
let intentPlugin;
|
|
463
435
|
const unsubscribeCallbacks = [];
|
|
@@ -470,38 +442,8 @@ var ThreadPlugin = () => {
|
|
|
470
442
|
allowUndefined: true
|
|
471
443
|
})
|
|
472
444
|
});
|
|
473
|
-
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
474
445
|
navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin);
|
|
475
446
|
intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
476
|
-
const graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
477
|
-
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
478
|
-
if (!client) {
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
const channelsQuery = client.spaces.query(Filter.schema(ChannelType));
|
|
482
|
-
const queryUnsubscribe = channelsQuery.subscribe();
|
|
483
|
-
const unsubscribe = effect(() => {
|
|
484
|
-
const attention = attentionPlugin?.provides.attention;
|
|
485
|
-
if (!attention?.attended) {
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
const firstAttendedNodeWithComments = Array.from(attention.attended).map((id) => graphPlugin?.provides.graph.findNode(id)).find((node) => {
|
|
489
|
-
const data = node?.data;
|
|
490
|
-
return Array.isArray(data?.threads) && data.threads.length > 0;
|
|
491
|
-
});
|
|
492
|
-
if (firstAttendedNodeWithComments) {
|
|
493
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
494
|
-
action: NavigationAction.OPEN,
|
|
495
|
-
data: {
|
|
496
|
-
activeParts: {
|
|
497
|
-
complementary: `${firstAttendedNodeWithComments.id}${SLUG_PATH_SEPARATOR}comments`
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
unsubscribeCallbacks.push(queryUnsubscribe);
|
|
504
|
-
unsubscribeCallbacks.push(unsubscribe);
|
|
505
447
|
},
|
|
506
448
|
unload: async () => {
|
|
507
449
|
unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
|
|
@@ -517,8 +459,7 @@ var ThreadPlugin = () => {
|
|
|
517
459
|
ns: THREAD_PLUGIN
|
|
518
460
|
}
|
|
519
461
|
],
|
|
520
|
-
icon:
|
|
521
|
-
iconSymbol: "ph--chat--regular",
|
|
462
|
+
icon: "ph--chat--regular",
|
|
522
463
|
// TODO(wittjosiah): Move out of metadata.
|
|
523
464
|
loadReferences: (channel) => loadObjectReferences(channel, (channel2) => channel2.threads)
|
|
524
465
|
},
|
|
@@ -577,29 +518,36 @@ var ThreadPlugin = () => {
|
|
|
577
518
|
if (!id.endsWith("~comments")) {
|
|
578
519
|
return;
|
|
579
520
|
}
|
|
580
|
-
const
|
|
581
|
-
const [spaceId, objectId] =
|
|
521
|
+
const subjectId = id.split("~").at(0);
|
|
522
|
+
const [spaceId, objectId] = subjectId?.split(":") ?? [];
|
|
582
523
|
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
583
|
-
const
|
|
584
|
-
|
|
524
|
+
const object = toSignal((onChange) => {
|
|
525
|
+
const timeout = setTimeout(async () => {
|
|
526
|
+
await space?.db.loadObjectById(objectId);
|
|
527
|
+
onChange();
|
|
528
|
+
});
|
|
529
|
+
return () => clearTimeout(timeout);
|
|
530
|
+
}, () => space?.db.getObjectById(objectId), subjectId);
|
|
531
|
+
if (!object || !subjectId) {
|
|
585
532
|
return;
|
|
586
533
|
}
|
|
587
|
-
const
|
|
588
|
-
const label =
|
|
534
|
+
const meta = metadataResolver(getTypename(object) ?? "");
|
|
535
|
+
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
589
536
|
"unnamed object threads label",
|
|
590
537
|
{
|
|
591
538
|
ns: THREAD_PLUGIN
|
|
592
539
|
}
|
|
593
540
|
];
|
|
594
|
-
const viewState = getViewState(
|
|
541
|
+
const viewState = getViewState(subjectId);
|
|
595
542
|
return {
|
|
596
543
|
id,
|
|
597
544
|
type: "orphan-comments-for-subject",
|
|
598
|
-
data:
|
|
545
|
+
data: null,
|
|
599
546
|
properties: {
|
|
600
|
-
icon:
|
|
547
|
+
icon: "ph--chat-text--regular",
|
|
601
548
|
label,
|
|
602
|
-
showResolvedThreads: viewState.showResolvedThreads
|
|
549
|
+
showResolvedThreads: viewState.showResolvedThreads,
|
|
550
|
+
object
|
|
603
551
|
}
|
|
604
552
|
};
|
|
605
553
|
},
|
|
@@ -639,7 +587,7 @@ var ThreadPlugin = () => {
|
|
|
639
587
|
menuItemType: "toggle",
|
|
640
588
|
isChecked: viewState.showResolvedThreads,
|
|
641
589
|
testId: "threadPlugin.toggleShowResolved",
|
|
642
|
-
|
|
590
|
+
icon: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
|
|
643
591
|
}
|
|
644
592
|
}
|
|
645
593
|
];
|
|
@@ -684,8 +632,7 @@ var ThreadPlugin = () => {
|
|
|
684
632
|
ns: THREAD_PLUGIN
|
|
685
633
|
}
|
|
686
634
|
],
|
|
687
|
-
icon:
|
|
688
|
-
iconSymbol: "ph--chat--regular",
|
|
635
|
+
icon: "ph--chat--regular",
|
|
689
636
|
testId: "threadPlugin.createObject"
|
|
690
637
|
}
|
|
691
638
|
}
|
|
@@ -743,7 +690,6 @@ var ThreadPlugin = () => {
|
|
|
743
690
|
subject: data.subject,
|
|
744
691
|
stagedThreads: state.staging[fullyQualifiedId4(data.subject)],
|
|
745
692
|
current: state.current,
|
|
746
|
-
focus: true,
|
|
747
693
|
showResolvedThreads
|
|
748
694
|
});
|
|
749
695
|
}
|
|
@@ -764,7 +710,7 @@ var ThreadPlugin = () => {
|
|
|
764
710
|
} catch (e) {
|
|
765
711
|
log.error("Subject does not support threads array", subject?.typename, {
|
|
766
712
|
F: __dxlog_file,
|
|
767
|
-
L:
|
|
713
|
+
L: 331,
|
|
768
714
|
S: void 0,
|
|
769
715
|
C: (f, a) => f(...a)
|
|
770
716
|
});
|
|
@@ -790,19 +736,10 @@ var ThreadPlugin = () => {
|
|
|
790
736
|
data: thread,
|
|
791
737
|
intents: [
|
|
792
738
|
[
|
|
793
|
-
{
|
|
794
|
-
action: NavigationAction.OPEN,
|
|
795
|
-
data: {
|
|
796
|
-
activeParts: {
|
|
797
|
-
complementary: `${subjectId}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
},
|
|
801
739
|
{
|
|
802
740
|
action: ThreadAction.SELECT,
|
|
803
741
|
data: {
|
|
804
|
-
current: fullyQualifiedId4(thread)
|
|
805
|
-
focus: true
|
|
742
|
+
current: fullyQualifiedId4(thread)
|
|
806
743
|
}
|
|
807
744
|
},
|
|
808
745
|
{
|
|
@@ -829,7 +766,6 @@ var ThreadPlugin = () => {
|
|
|
829
766
|
}
|
|
830
767
|
}
|
|
831
768
|
case ThreadAction.SELECT: {
|
|
832
|
-
state.focus = intent.data?.current === state.current ? state.focus : intent.data?.focus;
|
|
833
769
|
state.current = intent.data?.current;
|
|
834
770
|
return {
|
|
835
771
|
data: true
|
|
@@ -1089,12 +1025,12 @@ var ThreadPlugin = () => {
|
|
|
1089
1025
|
});
|
|
1090
1026
|
}
|
|
1091
1027
|
}),
|
|
1092
|
-
createExternalCommentSync(doc
|
|
1028
|
+
createExternalCommentSync(fullyQualifiedId4(doc), (sink) => effect(() => sink()), () => threads.value.filter((thread) => thread?.anchor).map((thread) => ({
|
|
1093
1029
|
id: fullyQualifiedId4(thread),
|
|
1094
1030
|
cursor: thread.anchor
|
|
1095
1031
|
}))),
|
|
1096
1032
|
comments({
|
|
1097
|
-
id: doc
|
|
1033
|
+
id: fullyQualifiedId4(doc),
|
|
1098
1034
|
onCreate: ({ cursor }) => {
|
|
1099
1035
|
const [start, end] = cursor.split(":");
|
|
1100
1036
|
const name = doc.content && getTextInRange(createDocAccessor(doc.content, [
|