@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.
Files changed (64) hide show
  1. package/dist/lib/browser/{ThreadArticle-6L6BGE4Z.mjs → ThreadArticle-4VU752F4.mjs} +3 -3
  2. package/dist/lib/{node-esm/ThreadMain-DU6LBSN3.mjs → browser/ThreadMain-ML3P4XSD.mjs} +3 -3
  3. package/dist/lib/browser/{chunk-5IBJO53M.mjs → chunk-7NUYW5IW.mjs} +2 -5
  4. package/dist/lib/browser/chunk-7NUYW5IW.mjs.map +7 -0
  5. package/dist/lib/{node-esm/chunk-U5UVX4ZP.mjs → browser/chunk-GJRBBPXI.mjs} +2 -2
  6. package/dist/lib/browser/{chunk-AVC4CGJM.mjs → chunk-XF5QKI75.mjs} +8 -6
  7. package/dist/lib/browser/chunk-XF5QKI75.mjs.map +7 -0
  8. package/dist/lib/browser/index.mjs +34 -68
  9. package/dist/lib/browser/index.mjs.map +3 -3
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/meta.mjs +1 -1
  12. package/dist/lib/browser/types.mjs +2 -2
  13. package/dist/lib/node/{ThreadArticle-7BWXVIJ4.cjs → ThreadArticle-ERUHPHVT.cjs} +7 -7
  14. package/dist/lib/node/{ThreadMain-XSRB6NKJ.cjs → ThreadMain-6DN7FDNB.cjs} +7 -7
  15. package/dist/lib/node/{chunk-BWBONZGU.cjs → chunk-6EVXCSDS.cjs} +5 -18
  16. package/dist/lib/node/chunk-6EVXCSDS.cjs.map +7 -0
  17. package/dist/lib/node/{chunk-4B2ARV7L.cjs → chunk-FXD3DYMO.cjs} +6 -6
  18. package/dist/lib/node/{chunk-T7TXCNHL.cjs → chunk-PZVUW4W2.cjs} +61 -59
  19. package/dist/lib/node/chunk-PZVUW4W2.cjs.map +7 -0
  20. package/dist/lib/node/index.cjs +144 -178
  21. package/dist/lib/node/index.cjs.map +3 -3
  22. package/dist/lib/node/meta.cjs +4 -4
  23. package/dist/lib/node/meta.cjs.map +1 -1
  24. package/dist/lib/node/meta.json +1 -1
  25. package/dist/lib/node/types.cjs +3 -3
  26. package/dist/lib/node/types.cjs.map +1 -1
  27. package/dist/lib/node-esm/{ThreadArticle-6L6BGE4Z.mjs → ThreadArticle-NKI5F4W5.mjs} +4 -3
  28. package/dist/lib/node-esm/{ThreadArticle-6L6BGE4Z.mjs.map → ThreadArticle-NKI5F4W5.mjs.map} +1 -1
  29. package/dist/lib/{browser/ThreadMain-DU6LBSN3.mjs → node-esm/ThreadMain-2A3VQLCW.mjs} +4 -3
  30. package/dist/lib/node-esm/{ThreadMain-DU6LBSN3.mjs.map → ThreadMain-2A3VQLCW.mjs.map} +1 -1
  31. package/dist/lib/node-esm/{chunk-AVC4CGJM.mjs → chunk-A44C4MTQ.mjs} +9 -6
  32. package/dist/lib/node-esm/chunk-A44C4MTQ.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-5IBJO53M.mjs → chunk-Y475KZTX.mjs} +4 -5
  34. package/dist/lib/node-esm/chunk-Y475KZTX.mjs.map +7 -0
  35. package/dist/lib/{browser/chunk-U5UVX4ZP.mjs → node-esm/chunk-YO46JGAE.mjs} +3 -2
  36. package/dist/lib/node-esm/{chunk-U5UVX4ZP.mjs.map → chunk-YO46JGAE.mjs.map} +1 -1
  37. package/dist/lib/node-esm/index.mjs +35 -68
  38. package/dist/lib/node-esm/index.mjs.map +3 -3
  39. package/dist/lib/node-esm/meta.json +1 -1
  40. package/dist/lib/node-esm/meta.mjs +2 -1
  41. package/dist/lib/node-esm/types.mjs +3 -2
  42. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  43. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  44. package/dist/types/src/components/testing.d.ts +2 -0
  45. package/dist/types/src/components/testing.d.ts.map +1 -1
  46. package/dist/types/src/meta.d.ts +1 -4
  47. package/dist/types/src/meta.d.ts.map +1 -1
  48. package/package.json +30 -30
  49. package/src/ThreadPlugin.tsx +26 -72
  50. package/src/components/ChatContainer.tsx +3 -4
  51. package/src/components/CommentsContainer.tsx +4 -4
  52. package/src/meta.tsx +1 -5
  53. package/dist/lib/browser/chunk-5IBJO53M.mjs.map +0 -7
  54. package/dist/lib/browser/chunk-AVC4CGJM.mjs.map +0 -7
  55. package/dist/lib/node/chunk-BWBONZGU.cjs.map +0 -7
  56. package/dist/lib/node/chunk-T7TXCNHL.cjs.map +0 -7
  57. package/dist/lib/node-esm/chunk-5IBJO53M.mjs.map +0 -7
  58. package/dist/lib/node-esm/chunk-AVC4CGJM.mjs.map +0 -7
  59. /package/dist/lib/browser/{ThreadArticle-6L6BGE4Z.mjs.map → ThreadArticle-4VU752F4.mjs.map} +0 -0
  60. /package/dist/lib/browser/{ThreadMain-DU6LBSN3.mjs.map → ThreadMain-ML3P4XSD.mjs.map} +0 -0
  61. /package/dist/lib/browser/{chunk-U5UVX4ZP.mjs.map → chunk-GJRBBPXI.mjs.map} +0 -0
  62. /package/dist/lib/node/{ThreadArticle-7BWXVIJ4.cjs.map → ThreadArticle-ERUHPHVT.cjs.map} +0 -0
  63. /package/dist/lib/node/{ThreadMain-XSRB6NKJ.cjs.map → ThreadMain-6DN7FDNB.cjs.map} +0 -0
  64. /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-U5UVX4ZP.mjs";
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-AVC4CGJM.mjs";
14
+ } from "./chunk-A44C4MTQ.mjs";
14
15
  import {
15
16
  THREAD_ITEM,
16
17
  THREAD_PLUGIN,
17
18
  meta_default
18
- } from "./chunk-5IBJO53M.mjs";
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, parseGraphPlugin, SLUG_PATH_SEPARATOR, SLUG_COLLECTION_INDICATOR, isLayoutParts, parseMetadataResolverPlugin } from "@dxos/app-framework";
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, Filter, createDocAccessor, fullyQualifiedId as fullyQualifiedId4, loadObjectReferences } from "@dxos/react-client/echo";
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, Quotes } from "@phosphor-icons/react";
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, plankHeadingIconProps } from "@dxos/react-ui-deck";
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(Quotes, plankHeadingIconProps)), /* @__PURE__ */ React3.createElement(PlankHeading.Label, {
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-DU6LBSN3.mjs"));
287
- var ThreadArticle = React4.lazy(() => import("./ThreadArticle-6L6BGE4Z.mjs"));
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: (props) => /* @__PURE__ */ React6.createElement(Chat, props),
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 docId = id.split("~").at(0);
581
- const [spaceId, objectId] = docId?.split(":") ?? [];
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 doc = space?.db.getObjectById(objectId);
584
- if (!doc || !docId) {
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 docMeta = metadataResolver(getTypename(doc) ?? "");
588
- const label = docMeta.label?.(doc) || doc.name || docMeta.placeholder || [
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(docId);
570
+ const viewState = getViewState(subjectId);
595
571
  return {
596
572
  id,
597
573
  type: "orphan-comments-for-subject",
598
- data: doc,
574
+ data: object,
599
575
  properties: {
600
- icon: meta_default.iconComponent,
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
- iconSymbol: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
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: (props) => /* @__PURE__ */ React6.createElement(Chat, props),
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: 369,
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: {