@dxos/plugin-thread 0.6.12-main.5cc132e → 0.6.12-main.c974201
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 +34 -68
- 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 +144 -178
- 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 +35 -68
- 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/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 +30 -30
- package/src/ThreadPlugin.tsx +26 -72
- package/src/components/ChatContainer.tsx +3 -4
- package/src/components/CommentsContainer.tsx +4 -4
- 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";
|
|
@@ -214,11 +213,11 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
214
213
|
};
|
|
215
214
|
|
|
216
215
|
// packages/plugins/plugin-thread/src/components/CommentsContainer.tsx
|
|
217
|
-
import { ChatText
|
|
216
|
+
import { ChatText } from "@phosphor-icons/react";
|
|
218
217
|
import React3, { useEffect as useEffect2 } from "react";
|
|
219
218
|
import { fullyQualifiedId as fullyQualifiedId2 } from "@dxos/react-client/echo";
|
|
220
|
-
import { useTranslation as useTranslation3, Trans } from "@dxos/react-ui";
|
|
221
|
-
import { PlankHeading
|
|
219
|
+
import { useTranslation as useTranslation3, Icon, Trans } from "@dxos/react-ui";
|
|
220
|
+
import { PlankHeading } from "@dxos/react-ui-deck";
|
|
222
221
|
import { descriptionText, mx as mx2 } from "@dxos/react-ui-theme";
|
|
223
222
|
var CommentsHeading = ({ attendableId }) => {
|
|
224
223
|
const { t } = useTranslation3(THREAD_PLUGIN);
|
|
@@ -227,7 +226,10 @@ var CommentsHeading = ({ attendableId }) => {
|
|
|
227
226
|
className: "flex items-center"
|
|
228
227
|
}, /* @__PURE__ */ React3.createElement(PlankHeading.Button, {
|
|
229
228
|
attendableId
|
|
230
|
-
}, /* @__PURE__ */ React3.createElement(
|
|
229
|
+
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
230
|
+
icon: "ph--quotes--regular",
|
|
231
|
+
size: 5
|
|
232
|
+
})), /* @__PURE__ */ React3.createElement(PlankHeading.Label, {
|
|
231
233
|
attendableId
|
|
232
234
|
}, t("comments heading")));
|
|
233
235
|
};
|
|
@@ -283,8 +285,8 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
|
|
|
283
285
|
};
|
|
284
286
|
|
|
285
287
|
// packages/plugins/plugin-thread/src/components/index.ts
|
|
286
|
-
var ThreadMain = React4.lazy(() => import("./ThreadMain-
|
|
287
|
-
var ThreadArticle = React4.lazy(() => import("./ThreadArticle-
|
|
288
|
+
var ThreadMain = React4.lazy(() => import("./ThreadMain-2A3VQLCW.mjs"));
|
|
289
|
+
var ThreadArticle = React4.lazy(() => import("./ThreadArticle-NKI5F4W5.mjs"));
|
|
288
290
|
|
|
289
291
|
// packages/plugins/plugin-thread/src/components/ThreadComplementary.tsx
|
|
290
292
|
import React5, { useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
|
@@ -457,7 +459,6 @@ var ThreadPlugin = () => {
|
|
|
457
459
|
}
|
|
458
460
|
return viewStore[subjectId];
|
|
459
461
|
};
|
|
460
|
-
let attentionPlugin;
|
|
461
462
|
let navigationPlugin;
|
|
462
463
|
let intentPlugin;
|
|
463
464
|
const unsubscribeCallbacks = [];
|
|
@@ -470,38 +471,8 @@ var ThreadPlugin = () => {
|
|
|
470
471
|
allowUndefined: true
|
|
471
472
|
})
|
|
472
473
|
});
|
|
473
|
-
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
474
474
|
navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin);
|
|
475
475
|
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
476
|
},
|
|
506
477
|
unload: async () => {
|
|
507
478
|
unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
|
|
@@ -517,8 +488,7 @@ var ThreadPlugin = () => {
|
|
|
517
488
|
ns: THREAD_PLUGIN
|
|
518
489
|
}
|
|
519
490
|
],
|
|
520
|
-
icon:
|
|
521
|
-
iconSymbol: "ph--chat--regular",
|
|
491
|
+
icon: "ph--chat--regular",
|
|
522
492
|
// TODO(wittjosiah): Move out of metadata.
|
|
523
493
|
loadReferences: (channel) => loadObjectReferences(channel, (channel2) => channel2.threads)
|
|
524
494
|
},
|
|
@@ -577,27 +547,33 @@ var ThreadPlugin = () => {
|
|
|
577
547
|
if (!id.endsWith("~comments")) {
|
|
578
548
|
return;
|
|
579
549
|
}
|
|
580
|
-
const
|
|
581
|
-
const [spaceId, objectId] =
|
|
550
|
+
const subjectId = id.split("~").at(0);
|
|
551
|
+
const [spaceId, objectId] = subjectId?.split(":") ?? [];
|
|
582
552
|
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
583
|
-
const
|
|
584
|
-
|
|
553
|
+
const object = toSignal((onChange) => {
|
|
554
|
+
const timeout = setTimeout(async () => {
|
|
555
|
+
await space?.db.loadObjectById(objectId);
|
|
556
|
+
onChange();
|
|
557
|
+
});
|
|
558
|
+
return () => clearTimeout(timeout);
|
|
559
|
+
}, () => space?.db.getObjectById(objectId));
|
|
560
|
+
if (!object || !subjectId) {
|
|
585
561
|
return;
|
|
586
562
|
}
|
|
587
|
-
const
|
|
588
|
-
const label =
|
|
563
|
+
const meta = metadataResolver(getTypename(object) ?? "");
|
|
564
|
+
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
589
565
|
"unnamed object threads label",
|
|
590
566
|
{
|
|
591
567
|
ns: THREAD_PLUGIN
|
|
592
568
|
}
|
|
593
569
|
];
|
|
594
|
-
const viewState = getViewState(
|
|
570
|
+
const viewState = getViewState(subjectId);
|
|
595
571
|
return {
|
|
596
572
|
id,
|
|
597
573
|
type: "orphan-comments-for-subject",
|
|
598
|
-
data:
|
|
574
|
+
data: object,
|
|
599
575
|
properties: {
|
|
600
|
-
icon:
|
|
576
|
+
icon: meta.icon,
|
|
601
577
|
label,
|
|
602
578
|
showResolvedThreads: viewState.showResolvedThreads
|
|
603
579
|
}
|
|
@@ -639,7 +615,7 @@ var ThreadPlugin = () => {
|
|
|
639
615
|
menuItemType: "toggle",
|
|
640
616
|
isChecked: viewState.showResolvedThreads,
|
|
641
617
|
testId: "threadPlugin.toggleShowResolved",
|
|
642
|
-
|
|
618
|
+
icon: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
|
|
643
619
|
}
|
|
644
620
|
}
|
|
645
621
|
];
|
|
@@ -684,8 +660,7 @@ var ThreadPlugin = () => {
|
|
|
684
660
|
ns: THREAD_PLUGIN
|
|
685
661
|
}
|
|
686
662
|
],
|
|
687
|
-
icon:
|
|
688
|
-
iconSymbol: "ph--chat--regular",
|
|
663
|
+
icon: "ph--chat--regular",
|
|
689
664
|
testId: "threadPlugin.createObject"
|
|
690
665
|
}
|
|
691
666
|
}
|
|
@@ -764,7 +739,7 @@ var ThreadPlugin = () => {
|
|
|
764
739
|
} catch (e) {
|
|
765
740
|
log.error("Subject does not support threads array", subject?.typename, {
|
|
766
741
|
F: __dxlog_file,
|
|
767
|
-
L:
|
|
742
|
+
L: 331,
|
|
768
743
|
S: void 0,
|
|
769
744
|
C: (f, a) => f(...a)
|
|
770
745
|
});
|
|
@@ -790,14 +765,6 @@ var ThreadPlugin = () => {
|
|
|
790
765
|
data: thread,
|
|
791
766
|
intents: [
|
|
792
767
|
[
|
|
793
|
-
{
|
|
794
|
-
action: NavigationAction.OPEN,
|
|
795
|
-
data: {
|
|
796
|
-
activeParts: {
|
|
797
|
-
complementary: `${subjectId}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
},
|
|
801
768
|
{
|
|
802
769
|
action: ThreadAction.SELECT,
|
|
803
770
|
data: {
|