@dxos/plugin-thread 0.7.5-main.499c70c → 0.7.5-main.6a330ac

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 (188) hide show
  1. package/dist/lib/browser/ThreadContainer-6OP5AG2W.mjs +19 -0
  2. package/dist/lib/browser/ThreadContainer-6OP5AG2W.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-ENERBDYI.mjs → chunk-636QDHE3.mjs} +3 -3
  4. package/dist/lib/browser/chunk-636QDHE3.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-BNEWNQBO.mjs +71 -0
  6. package/dist/lib/browser/chunk-BNEWNQBO.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-NAO3LZMZ.mjs +16 -0
  8. package/dist/lib/browser/chunk-NAO3LZMZ.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-OD2IZKRP.mjs → chunk-UPKU23DA.mjs} +29 -105
  10. package/dist/lib/browser/chunk-UPKU23DA.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-VOMIDDNO.mjs +15 -0
  12. package/dist/lib/browser/chunk-VOMIDDNO.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-6KTMQPL4.mjs → chunk-YK3ICB7G.mjs} +5 -3
  14. package/dist/lib/browser/chunk-YK3ICB7G.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +150 -942
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/intent-resolver-FAFQ54NP.mjs +287 -0
  18. package/dist/lib/browser/intent-resolver-FAFQ54NP.mjs.map +7 -0
  19. package/dist/lib/browser/markdown-RPYOUBVR.mjs +112 -0
  20. package/dist/lib/browser/markdown-RPYOUBVR.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/react-surface-Y4MUSICN.mjs +433 -0
  23. package/dist/lib/browser/react-surface-Y4MUSICN.mjs.map +7 -0
  24. package/dist/lib/browser/settings-WQTE5AEZ.mjs +22 -0
  25. package/dist/lib/browser/settings-WQTE5AEZ.mjs.map +7 -0
  26. package/dist/lib/browser/state-GNFUURIC.mjs +33 -0
  27. package/dist/lib/browser/state-GNFUURIC.mjs.map +7 -0
  28. package/dist/lib/browser/types.mjs +6 -4
  29. package/dist/lib/node/{ThreadArticle-ZCNMFBAO.cjs → ThreadContainer-LTKKLPXX.cjs} +14 -13
  30. package/dist/lib/node/ThreadContainer-LTKKLPXX.cjs.map +7 -0
  31. package/dist/lib/node/chunk-AWSTZ2KN.cjs +93 -0
  32. package/dist/lib/node/chunk-AWSTZ2KN.cjs.map +7 -0
  33. package/dist/lib/node/{ThreadMain-5AYGCXXP.cjs → chunk-BHFHFTHO.cjs} +21 -23
  34. package/dist/lib/node/chunk-BHFHFTHO.cjs.map +7 -0
  35. package/dist/lib/node/{chunk-VW2P26MZ.cjs → chunk-CMEMMYDL.cjs} +11 -8
  36. package/dist/lib/node/chunk-CMEMMYDL.cjs.map +7 -0
  37. package/dist/lib/node/{chunk-IC2NICNC.cjs → chunk-F735VMTN.cjs} +7 -7
  38. package/dist/lib/node/chunk-F735VMTN.cjs.map +7 -0
  39. package/dist/lib/node/{meta.cjs → chunk-FPWNZ6TB.cjs} +13 -10
  40. package/dist/lib/node/chunk-FPWNZ6TB.cjs.map +7 -0
  41. package/dist/lib/node/{chunk-2CB5AVBL.cjs → chunk-RQR5Z23G.cjs} +74 -151
  42. package/dist/lib/node/chunk-RQR5Z23G.cjs.map +7 -0
  43. package/dist/lib/node/index.cjs +149 -935
  44. package/dist/lib/node/index.cjs.map +4 -4
  45. package/dist/lib/node/intent-resolver-DVBEXJ33.cjs +299 -0
  46. package/dist/lib/node/intent-resolver-DVBEXJ33.cjs.map +7 -0
  47. package/dist/lib/node/markdown-ELRGISXE.cjs +122 -0
  48. package/dist/lib/node/markdown-ELRGISXE.cjs.map +7 -0
  49. package/dist/lib/node/meta.json +1 -1
  50. package/dist/lib/node/react-surface-7HLTN5XS.cjs +435 -0
  51. package/dist/lib/node/react-surface-7HLTN5XS.cjs.map +7 -0
  52. package/dist/lib/node/settings-7VQYARM5.cjs +36 -0
  53. package/dist/lib/node/settings-7VQYARM5.cjs.map +7 -0
  54. package/dist/lib/node/state-TQWEZ6B3.cjs +49 -0
  55. package/dist/lib/node/state-TQWEZ6B3.cjs.map +7 -0
  56. package/dist/lib/node/types.cjs +6 -4
  57. package/dist/lib/node/types.cjs.map +2 -2
  58. package/dist/lib/node-esm/ThreadContainer-SV74JFRH.mjs +20 -0
  59. package/dist/lib/node-esm/ThreadContainer-SV74JFRH.mjs.map +7 -0
  60. package/dist/lib/node-esm/{chunk-RMYATBXM.mjs → chunk-33NDMQQQ.mjs} +5 -3
  61. package/dist/lib/node-esm/chunk-33NDMQQQ.mjs.map +7 -0
  62. package/dist/lib/node-esm/{chunk-AQ74G3GY.mjs → chunk-CISLDOH7.mjs} +29 -105
  63. package/dist/lib/node-esm/chunk-CISLDOH7.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-7QRGG25F.mjs → chunk-FXUATCLW.mjs} +3 -3
  65. package/dist/lib/node-esm/chunk-FXUATCLW.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-HLWJTUWZ.mjs +73 -0
  67. package/dist/lib/node-esm/chunk-HLWJTUWZ.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-PJPVEO7E.mjs +17 -0
  69. package/dist/lib/node-esm/chunk-PJPVEO7E.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-ZJITX3TO.mjs +17 -0
  71. package/dist/lib/node-esm/chunk-ZJITX3TO.mjs.map +7 -0
  72. package/dist/lib/node-esm/index.mjs +150 -942
  73. package/dist/lib/node-esm/index.mjs.map +4 -4
  74. package/dist/lib/node-esm/intent-resolver-DHVLBNCC.mjs +288 -0
  75. package/dist/lib/node-esm/intent-resolver-DHVLBNCC.mjs.map +7 -0
  76. package/dist/lib/node-esm/markdown-23OB7EZG.mjs +113 -0
  77. package/dist/lib/node-esm/markdown-23OB7EZG.mjs.map +7 -0
  78. package/dist/lib/node-esm/meta.json +1 -1
  79. package/dist/lib/node-esm/react-surface-AZHTTR6J.mjs +434 -0
  80. package/dist/lib/node-esm/react-surface-AZHTTR6J.mjs.map +7 -0
  81. package/dist/lib/node-esm/settings-SGMM7UDT.mjs +23 -0
  82. package/dist/lib/node-esm/settings-SGMM7UDT.mjs.map +7 -0
  83. package/dist/lib/node-esm/state-7MLR27YG.mjs +34 -0
  84. package/dist/lib/node-esm/state-7MLR27YG.mjs.map +7 -0
  85. package/dist/lib/node-esm/types.mjs +6 -4
  86. package/dist/types/src/ThreadPlugin.d.ts +1 -3
  87. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  88. package/dist/types/src/capabilities/capabilities.d.ts +15 -0
  89. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  90. package/dist/types/src/capabilities/index.d.ts +10 -0
  91. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  92. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  93. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  94. package/dist/types/src/capabilities/markdown.d.ts +4 -0
  95. package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
  96. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  97. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  98. package/dist/types/src/capabilities/settings.d.ts +4 -0
  99. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  100. package/dist/types/src/capabilities/state.d.ts +7 -0
  101. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  102. package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/ChatContainer.d.ts +2 -3
  104. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  105. package/dist/types/src/components/CommentContainer.d.ts +1 -2
  106. package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
  107. package/dist/types/src/components/Comments.stories.d.ts.map +1 -1
  108. package/dist/types/src/components/CommentsContainer.d.ts +2 -8
  109. package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
  110. package/dist/types/src/components/MessageContainer.d.ts +1 -2
  111. package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
  112. package/dist/types/src/components/ThreadComplementary.d.ts +2 -7
  113. package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
  114. package/dist/types/src/components/ThreadContainer.d.ts +7 -0
  115. package/dist/types/src/components/ThreadContainer.d.ts.map +1 -0
  116. package/dist/types/src/components/ThreadSettings.d.ts +1 -2
  117. package/dist/types/src/components/ThreadSettings.d.ts.map +1 -1
  118. package/dist/types/src/components/command-extension.d.ts.map +1 -1
  119. package/dist/types/src/components/index.d.ts +3 -15
  120. package/dist/types/src/components/index.d.ts.map +1 -1
  121. package/dist/types/src/components/testing.d.ts +12 -12
  122. package/dist/types/src/components/testing.d.ts.map +1 -1
  123. package/dist/types/src/components/types.d.ts +5 -5
  124. package/dist/types/src/components/types.d.ts.map +1 -1
  125. package/dist/types/src/index.d.ts +1 -3
  126. package/dist/types/src/index.d.ts.map +1 -1
  127. package/dist/types/src/meta.d.ts +1 -2
  128. package/dist/types/src/meta.d.ts.map +1 -1
  129. package/dist/types/src/translations.d.ts +9 -3
  130. package/dist/types/src/translations.d.ts.map +1 -1
  131. package/dist/types/src/types.d.ts +12 -18
  132. package/dist/types/src/types.d.ts.map +1 -1
  133. package/dist/types/tsconfig.tsbuildinfo +1 -1
  134. package/package.json +31 -38
  135. package/src/ThreadPlugin.tsx +106 -475
  136. package/src/capabilities/capabilities.ts +19 -0
  137. package/src/capabilities/index.ts +13 -0
  138. package/src/capabilities/intent-resolver.ts +239 -0
  139. package/src/capabilities/markdown.ts +18 -0
  140. package/src/capabilities/react-surface.tsx +61 -0
  141. package/src/capabilities/settings.ts +14 -0
  142. package/src/capabilities/state.ts +25 -0
  143. package/src/components/Chat.stories.tsx +22 -24
  144. package/src/components/ChatContainer.tsx +2 -2
  145. package/src/components/CommentContainer.tsx +18 -32
  146. package/src/components/Comments.stories.tsx +8 -2
  147. package/src/components/CommentsContainer.tsx +1 -17
  148. package/src/components/MessageContainer.tsx +6 -19
  149. package/src/components/ThreadComplementary.tsx +118 -51
  150. package/src/components/ThreadContainer.tsx +22 -0
  151. package/src/components/ThreadSettings.tsx +5 -11
  152. package/src/components/command-extension.ts +2 -5
  153. package/src/components/index.ts +1 -2
  154. package/src/components/types.ts +5 -5
  155. package/src/index.ts +1 -5
  156. package/src/meta.ts +1 -1
  157. package/src/translations.ts +3 -1
  158. package/src/types.ts +6 -29
  159. package/dist/lib/browser/ThreadArticle-EWLTNU6Z.mjs +0 -18
  160. package/dist/lib/browser/ThreadArticle-EWLTNU6Z.mjs.map +0 -7
  161. package/dist/lib/browser/ThreadMain-ABEDFWHC.mjs +0 -26
  162. package/dist/lib/browser/ThreadMain-ABEDFWHC.mjs.map +0 -7
  163. package/dist/lib/browser/chunk-6KTMQPL4.mjs.map +0 -7
  164. package/dist/lib/browser/chunk-ENERBDYI.mjs.map +0 -7
  165. package/dist/lib/browser/chunk-OD2IZKRP.mjs.map +0 -7
  166. package/dist/lib/browser/meta.mjs +0 -11
  167. package/dist/lib/browser/meta.mjs.map +0 -7
  168. package/dist/lib/node/ThreadArticle-ZCNMFBAO.cjs.map +0 -7
  169. package/dist/lib/node/ThreadMain-5AYGCXXP.cjs.map +0 -7
  170. package/dist/lib/node/chunk-2CB5AVBL.cjs.map +0 -7
  171. package/dist/lib/node/chunk-IC2NICNC.cjs.map +0 -7
  172. package/dist/lib/node/chunk-VW2P26MZ.cjs.map +0 -7
  173. package/dist/lib/node/meta.cjs.map +0 -7
  174. package/dist/lib/node-esm/ThreadArticle-F37HYTOU.mjs +0 -19
  175. package/dist/lib/node-esm/ThreadArticle-F37HYTOU.mjs.map +0 -7
  176. package/dist/lib/node-esm/ThreadMain-OL6ZHNZY.mjs +0 -27
  177. package/dist/lib/node-esm/ThreadMain-OL6ZHNZY.mjs.map +0 -7
  178. package/dist/lib/node-esm/chunk-7QRGG25F.mjs.map +0 -7
  179. package/dist/lib/node-esm/chunk-AQ74G3GY.mjs.map +0 -7
  180. package/dist/lib/node-esm/chunk-RMYATBXM.mjs.map +0 -7
  181. package/dist/lib/node-esm/meta.mjs +0 -12
  182. package/dist/lib/node-esm/meta.mjs.map +0 -7
  183. package/dist/types/src/components/ThreadArticle.d.ts +0 -5
  184. package/dist/types/src/components/ThreadArticle.d.ts.map +0 -1
  185. package/dist/types/src/components/ThreadMain.d.ts +0 -7
  186. package/dist/types/src/components/ThreadMain.d.ts.map +0 -1
  187. package/src/components/ThreadArticle.tsx +0 -18
  188. package/src/components/ThreadMain.tsx +0 -27
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,435 +15,45 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var node_exports = {};
30
20
  __export(node_exports, {
31
- ThreadAction: () => import_chunk_VW2P26MZ.ThreadAction,
21
+ THREAD_ITEM: () => import_chunk_F735VMTN.THREAD_ITEM,
22
+ THREAD_PLUGIN: () => import_chunk_F735VMTN.THREAD_PLUGIN,
32
23
  ThreadPlugin: () => ThreadPlugin,
33
- default: () => src_default,
34
- useAnalyticsCallback: () => import_chunk_2CB5AVBL.useAnalyticsCallback,
35
- useOnEditAnalytics: () => import_chunk_2CB5AVBL.useOnEditAnalytics,
36
- useStatus: () => import_chunk_2CB5AVBL.useStatus
24
+ meta: () => import_chunk_F735VMTN.meta,
25
+ useAnalyticsCallback: () => import_chunk_AWSTZ2KN.useAnalyticsCallback,
26
+ useOnEditAnalytics: () => import_chunk_AWSTZ2KN.useOnEditAnalytics,
27
+ useStatus: () => import_chunk_AWSTZ2KN.useStatus
37
28
  });
38
29
  module.exports = __toCommonJS(node_exports);
39
- var import_chunk_VW2P26MZ = require("./chunk-VW2P26MZ.cjs");
40
- var import_chunk_2CB5AVBL = require("./chunk-2CB5AVBL.cjs");
41
- var import_chunk_IC2NICNC = require("./chunk-IC2NICNC.cjs");
42
- var import_react = __toESM(require("react"));
30
+ var import_chunk_BHFHFTHO = require("./chunk-BHFHFTHO.cjs");
31
+ var import_chunk_AWSTZ2KN = require("./chunk-AWSTZ2KN.cjs");
32
+ var import_chunk_CMEMMYDL = require("./chunk-CMEMMYDL.cjs");
33
+ var import_chunk_FPWNZ6TB = require("./chunk-FPWNZ6TB.cjs");
34
+ var import_chunk_F735VMTN = require("./chunk-F735VMTN.cjs");
43
35
  var import_app_framework = require("@dxos/app-framework");
44
- var import_echo_schema = require("@dxos/echo-schema");
45
- var import_local_storage = require("@dxos/local-storage");
46
- var import_log = require("@dxos/log");
47
- var import_types = require("@dxos/plugin-client/types");
48
- var import_plugin_graph = require("@dxos/plugin-graph");
49
- var import_types2 = require("@dxos/plugin-observability/types");
36
+ var import_plugin_client = require("@dxos/plugin-client");
37
+ var import_plugin_deck = require("@dxos/plugin-deck");
38
+ var import_plugin_markdown = require("@dxos/plugin-markdown");
50
39
  var import_plugin_space = require("@dxos/plugin-space");
51
- var import_types3 = require("@dxos/plugin-space/types");
40
+ var import_types = require("@dxos/plugin-space/types");
52
41
  var import_echo = require("@dxos/react-client/echo");
53
42
  var import_react_ui_thread = require("@dxos/react-ui-thread");
54
- var import_react2 = require("react");
55
- var import_react3 = require("@phosphor-icons/react");
56
- var import_react4 = __toESM(require("react"));
57
- var import_live_object = require("@dxos/live-object");
58
- var import_types4 = require("@dxos/plugin-space/types");
59
- var import_echo2 = require("@dxos/react-client/echo");
60
- var import_halo = require("@dxos/react-client/halo");
61
- var import_react_ui = require("@dxos/react-ui");
62
- var import_react_ui_editor = require("@dxos/react-ui-editor");
63
- var import_react_ui_theme = require("@dxos/react-ui-theme");
64
- var import_react_ui_thread2 = require("@dxos/react-ui-thread");
65
- var import_util = require("@dxos/util");
66
- var import_react5 = require("@phosphor-icons/react");
67
- var import_react6 = __toESM(require("react"));
68
- var import_echo3 = require("@dxos/react-client/echo");
69
- var import_react_ui2 = require("@dxos/react-ui");
70
- var import_react_ui_theme2 = require("@dxos/react-ui-theme");
71
- var import_react7 = __toESM(require("react"));
72
- var import_app_framework2 = require("@dxos/app-framework");
73
- var import_echo4 = require("@dxos/react-client/echo");
74
- var import_react_ui_attention = require("@dxos/react-ui-attention");
75
- var import_util2 = require("@dxos/util");
76
- var import_react8 = __toESM(require("react"));
77
- var import_react_ui3 = require("@dxos/react-ui");
78
- var import_react_ui_form = require("@dxos/react-ui-form");
79
- var import_view = require("@codemirror/view");
80
- var import_signals_core = require("@preact/signals-core");
81
- var import_app_framework3 = require("@dxos/app-framework");
82
- var import_echo_schema2 = require("@dxos/echo-schema");
83
- var import_live_object2 = require("@dxos/live-object");
84
- var import_types5 = require("@dxos/plugin-space/types");
85
- var import_echo5 = require("@dxos/react-client/echo");
86
- var import_react_ui_editor2 = require("@dxos/react-ui-editor");
87
- var import_types6 = require("@dxos/plugin-space/types");
88
- var sizeClass = (0, import_react_ui_theme.getSize)(4);
89
- var commentControlClassNames = "!p-1 !min-bs-0 transition-opacity";
90
- var ToggleResolvedButton = ({ isResolved, onResolve }) => {
91
- const { t } = (0, import_react_ui.useTranslation)(import_chunk_IC2NICNC.THREAD_PLUGIN);
92
- const label = t(isResolved ? "mark as unresolved label" : "mark as resolved label");
93
- return /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Root, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Trigger, {
94
- asChild: true
95
- }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Button, {
96
- variant: "ghost",
97
- "data-testid": "thread.toggle-resolved",
98
- onClick: onResolve,
99
- classNames: [
100
- commentControlClassNames,
101
- !isResolved && import_react_ui_theme.hoverableControlItem
102
- ]
103
- }, /* @__PURE__ */ import_react4.default.createElement("span", {
104
- className: "sr-only"
105
- }, label), isResolved ? /* @__PURE__ */ import_react4.default.createElement(import_react3.CheckCircle, {
106
- className: sizeClass,
107
- weight: "fill"
108
- }) : /* @__PURE__ */ import_react4.default.createElement(import_react3.CheckCircle, {
109
- className: sizeClass
110
- }))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Portal, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Content, null, label, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Arrow, null))));
111
- };
112
- var DeleteThreadButton = ({ onDelete }) => {
113
- const { t } = (0, import_react_ui.useTranslation)(import_chunk_IC2NICNC.THREAD_PLUGIN);
114
- const label = t("delete thread label");
115
- return /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Root, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Trigger, {
116
- asChild: true
117
- }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Button, {
118
- variant: "ghost",
119
- "data-testid": "thread.delete",
120
- onClick: onDelete,
121
- classNames: [
122
- commentControlClassNames,
123
- import_react_ui_theme.hoverableControlItem
124
- ]
125
- }, /* @__PURE__ */ import_react4.default.createElement("span", {
126
- className: "sr-only"
127
- }, label), /* @__PURE__ */ import_react4.default.createElement(import_react3.X, {
128
- className: sizeClass
129
- }))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Portal, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Content, {
130
- classNames: "z-30"
131
- }, label, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Arrow, null))));
132
- };
133
- var CommentContainer = ({ thread, detached, context, current, onAttend, onThreadDelete, onMessageDelete, onResolve, onComment }) => {
134
- const identity = (0, import_halo.useIdentity)();
135
- const space = (0, import_echo2.getSpace)(thread);
136
- const members = (0, import_echo2.useMembers)(space?.key);
137
- const activity = (0, import_chunk_2CB5AVBL.useStatus)(space, (0, import_echo2.fullyQualifiedId)(thread));
138
- const { t } = (0, import_react_ui.useTranslation)(import_chunk_IC2NICNC.THREAD_PLUGIN);
139
- const threadScrollRef = (0, import_react4.useRef)(null);
140
- const { themeMode } = (0, import_react_ui.useThemeContext)();
141
- const textboxMetadata = (0, import_chunk_2CB5AVBL.getMessageMetadata)((0, import_echo2.fullyQualifiedId)(thread), identity);
142
- const [_count, _setCount] = (0, import_react4.useState)(0);
143
- const rerenderEditor = () => _setCount((count) => count + 1);
144
- const messageRef = (0, import_react4.useRef)("");
145
- const extensions = (0, import_react4.useMemo)(() => [
146
- (0, import_react_ui_editor.createBasicExtensions)({
147
- placeholder: t("message placeholder")
148
- }),
149
- (0, import_react_ui_editor.createThemeExtensions)({
150
- themeMode
151
- }),
152
- (0, import_react_ui_editor.listener)({
153
- onChange: (text) => messageRef.current = text
154
- }),
155
- import_chunk_2CB5AVBL.command
156
- ], [
157
- _count
158
- ]);
159
- const scrollToEnd = (behavior) => setTimeout(() => threadScrollRef.current?.scrollIntoView({
160
- behavior,
161
- block: "end"
162
- }), 10);
163
- const handleCreate = (0, import_react4.useCallback)(() => {
164
- if (!messageRef.current) {
165
- return false;
166
- }
167
- thread.messages.push((0, import_live_object.makeRef)((0, import_live_object.create)(import_types4.MessageType, {
168
- sender: {
169
- identityKey: identity.identityKey.toHex()
170
- },
171
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
172
- text: messageRef.current,
173
- context: context ? (0, import_live_object.makeRef)(context) : void 0
174
- })));
175
- onComment?.(thread);
176
- messageRef.current = "";
177
- scrollToEnd("instant");
178
- rerenderEditor();
179
- return true;
180
- }, [
181
- thread,
182
- identity
183
- ]);
184
- return /* @__PURE__ */ import_react4.default.createElement(import_react_ui_thread2.Thread, {
185
- onClickCapture: onAttend,
186
- onFocusCapture: onAttend,
187
- current,
188
- id: (0, import_echo2.fullyQualifiedId)(thread)
189
- }, /* @__PURE__ */ import_react4.default.createElement("div", {
190
- role: "none",
191
- className: (0, import_react_ui_theme.mx)("col-span-2 grid grid-cols-[var(--rail-size)_1fr_min-content]", import_react_ui_theme.hoverableControls, import_react_ui_theme.hoverableFocusedWithinControls)
192
- }, detached ? /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Root, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Trigger, {
193
- asChild: true
194
- }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui_thread2.ThreadHeading, {
195
- detached: true
196
- }, thread.name)), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Portal, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Content, {
197
- classNames: "z-30",
198
- side: "top"
199
- }, t("detached thread label"), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tooltip.Arrow, null)))) : /* @__PURE__ */ import_react4.default.createElement(import_react_ui_thread2.ThreadHeading, null, thread.name), /* @__PURE__ */ import_react4.default.createElement("div", {
200
- className: "flex flex-row items-center pli-1"
201
- }, thread.status === "staged" && /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Tag, {
202
- palette: "neutral"
203
- }, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */ import_react4.default.createElement(ToggleResolvedButton, {
204
- isResolved: thread?.status === "resolved",
205
- onResolve
206
- }), onThreadDelete && /* @__PURE__ */ import_react4.default.createElement(DeleteThreadButton, {
207
- onDelete: onThreadDelete
208
- }))), import_live_object.RefArray.allResolvedTargets(thread.messages?.filter(import_util.nonNullable) ?? []).map((message) => /* @__PURE__ */ import_react4.default.createElement(import_chunk_2CB5AVBL.MessageContainer, {
209
- key: message.id,
210
- message,
211
- members,
212
- onDelete: (id) => onMessageDelete?.(id)
213
- })), /* @__PURE__ */ import_react4.default.createElement(import_react_ui_thread2.MessageTextbox, {
214
- extensions,
215
- onSend: handleCreate,
216
- ...textboxMetadata
217
- }), /* @__PURE__ */ import_react4.default.createElement(import_react_ui_thread2.ThreadFooter, {
218
- activity
219
- }, t("activity message")), /* @__PURE__ */ import_react4.default.createElement("div", {
220
- role: "none",
221
- className: "bs-px -mbs-px",
222
- ref: threadScrollRef
223
- }));
224
- };
225
- var CommentsContainer = ({ threads: threads2, detached = [], currentId, showResolvedThreads, onThreadAttend, onThreadDelete, onMessageDelete, onThreadToggleResolved, ...props }) => {
226
- const { t } = (0, import_react_ui2.useTranslation)(import_chunk_IC2NICNC.THREAD_PLUGIN);
227
- const filteredThreads = showResolvedThreads ? threads2 : threads2.filter((thread) => !(thread?.status === "resolved"));
228
- (0, import_react6.useEffect)(() => {
229
- if (currentId) {
230
- document.getElementById(currentId)?.scrollIntoView({
231
- behavior: "smooth",
232
- block: "end"
233
- });
234
- }
235
- }, [
236
- currentId
237
- ]);
238
- return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, filteredThreads.length > 0 ? filteredThreads.map((thread) => {
239
- const threadId = (0, import_echo3.fullyQualifiedId)(thread);
240
- return /* @__PURE__ */ import_react6.default.createElement(CommentContainer, {
241
- key: threadId,
242
- thread,
243
- current: currentId === threadId,
244
- detached: detached.includes(threadId),
245
- ...onThreadAttend && {
246
- onAttend: () => onThreadAttend(thread)
247
- },
248
- ...onThreadDelete && {
249
- onThreadDelete: () => onThreadDelete(thread)
250
- },
251
- ...onMessageDelete && {
252
- onMessageDelete: (messageId) => onMessageDelete(thread, messageId)
253
- },
254
- ...onThreadToggleResolved && {
255
- onResolve: () => onThreadToggleResolved(thread)
256
- },
257
- ...props
258
- });
259
- }) : /* @__PURE__ */ import_react6.default.createElement("div", {
260
- role: "alert",
261
- className: (0, import_react_ui_theme2.mx)(import_react_ui_theme2.descriptionText, "place-self-center border border-dashed border-unAccent rounded-lg text-center p-4 m-4")
262
- }, /* @__PURE__ */ import_react6.default.createElement("h2", {
263
- className: "mbe-2 font-medium text-baseText"
264
- }, t("no comments title")), /* @__PURE__ */ import_react6.default.createElement("p", null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Trans, {
265
- t,
266
- i18nKey: "no comments message",
267
- components: {
268
- commentIcon: /* @__PURE__ */ import_react6.default.createElement(import_react5.ChatText, {
269
- className: "inline-block"
270
- })
271
- }
272
- }))));
273
- };
274
- var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
275
- var ThreadComplementary = ({ subject, drafts, current, showResolvedThreads }) => {
276
- const { dispatchPromise: dispatch } = (0, import_app_framework2.useIntentDispatcher)();
277
- const threadsIntegrators = (0, import_app_framework2.useResolvePlugins)(providesThreadsConfig);
278
- const threadProvides = (0, import_react7.useMemo)(() => threadsIntegrators.map((p) => p.provides.thread), [
279
- threadsIntegrators
280
- ]);
281
- const createSort = (0, import_react7.useMemo)(() => threadProvides.find((p) => p.predicate(subject))?.createSort, [
282
- threadProvides,
283
- subject
284
- ]);
285
- const sort = (0, import_react7.useMemo)(() => createSort?.(subject), [
286
- createSort,
287
- subject
288
- ]);
289
- const threadObjects = import_echo4.RefArray.allResolvedTargets(subject.threads ?? []);
290
- const threads2 = (0, import_react7.useMemo)(() => {
291
- return threadObjects.concat(drafts ?? []).filter(import_util2.nonNullable);
292
- }, [
293
- JSON.stringify(threadObjects),
294
- JSON.stringify(drafts)
295
- ]);
296
- const detachedIds = (0, import_react7.useMemo)(() => {
297
- return threads2.filter(({ anchor }) => !anchor).map((thread) => (0, import_echo4.fullyQualifiedId)(thread));
298
- }, [
299
- threads2
300
- ]);
301
- (0, import_react7.useEffect)(() => {
302
- if (!sort) {
303
- return;
304
- }
305
- threads2.sort((a, b) => sort(a?.anchor, b?.anchor));
306
- }, [
307
- sort,
308
- threads2
309
- ]);
310
- const attended = (0, import_react_ui_attention.useAttended)();
311
- const qualifiedSubjectId = (0, import_echo4.fullyQualifiedId)(subject);
312
- return /* @__PURE__ */ import_react7.default.createElement(CommentsContainer, {
313
- threads: threads2,
314
- detached: detachedIds,
315
- currentId: attended.includes(qualifiedSubjectId) ? current : void 0,
316
- showResolvedThreads,
317
- onThreadAttend: (thread) => {
318
- const threadId = (0, import_echo4.fullyQualifiedId)(thread);
319
- if (current !== threadId) {
320
- current = threadId;
321
- void dispatch?.((0, import_app_framework2.createIntent)(import_app_framework2.LayoutAction.ScrollIntoView, {
322
- id: (0, import_echo4.fullyQualifiedId)(subject),
323
- cursor: thread.anchor,
324
- ref: threadId
325
- }));
326
- }
327
- },
328
- onThreadDelete: (thread) => dispatch((0, import_app_framework2.createIntent)(import_chunk_VW2P26MZ.ThreadAction.Delete, {
329
- thread,
330
- subject
331
- })),
332
- onMessageDelete: (thread, messageId) => dispatch((0, import_app_framework2.createIntent)(import_chunk_VW2P26MZ.ThreadAction.DeleteMessage, {
333
- thread,
334
- subject,
335
- messageId
336
- })),
337
- onThreadToggleResolved: (thread) => dispatch((0, import_app_framework2.createIntent)(import_chunk_VW2P26MZ.ThreadAction.ToggleResolved, {
338
- thread
339
- })),
340
- onComment: (thread) => dispatch((0, import_app_framework2.createIntent)(import_chunk_VW2P26MZ.ThreadAction.OnMessageAdd, {
341
- thread,
342
- subject
343
- }))
344
- });
345
- };
346
- var ThreadSettings = ({ settings }) => {
347
- const { t } = (0, import_react_ui3.useTranslation)(import_chunk_IC2NICNC.THREAD_PLUGIN);
348
- return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui_form.DeprecatedFormInput, {
349
- label: t("settings standalone label")
350
- }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui3.Input.Switch, {
351
- checked: settings.standalone,
352
- onCheckedChange: (checked) => settings.standalone = !!checked
353
- })));
354
- };
355
- var ThreadMain = (0, import_react2.lazy)(() => import("./ThreadMain-5AYGCXXP.cjs"));
356
- var ThreadArticle = (0, import_react2.lazy)(() => import("./ThreadArticle-ZCNMFBAO.cjs"));
357
- var getName = (doc, anchor) => {
358
- if (doc.content) {
359
- const [start, end] = anchor.split(":");
360
- return (0, import_echo5.getTextInRange)((0, import_echo5.createDocAccessor)(doc.content.target, [
361
- "content"
362
- ]), start, end);
363
- }
364
- };
365
- var threads = (state, doc, dispatch) => {
366
- const space = doc && (0, import_echo5.getSpace)(doc);
367
- if (!doc || !space || !dispatch) {
368
- return [
369
- (0, import_react_ui_editor2.comments)()
370
- ];
371
- }
372
- const threads2 = (0, import_signals_core.computed)(() => [
373
- ...import_live_object2.RefArray.allResolvedTargets(doc.threads),
374
- ...state.drafts[(0, import_echo5.fullyQualifiedId)(doc)] ?? []
375
- ].filter((thread) => !(thread?.status === "resolved")));
376
- return [
377
- import_view.EditorView.updateListener.of((update) => {
378
- if (update.docChanged) {
379
- import_live_object2.RefArray.allResolvedTargets(doc.threads).forEach((thread) => {
380
- if (thread.anchor) {
381
- const name = getName(doc, thread.anchor);
382
- if (name && name !== thread.name) {
383
- thread.name = name;
384
- }
385
- }
386
- });
387
- }
388
- }),
389
- (0, import_react_ui_editor2.createExternalCommentSync)((0, import_echo5.fullyQualifiedId)(doc), (sink) => (0, import_signals_core.effect)(() => sink()), () => threads2.value.filter((thread) => thread?.anchor).map((thread) => ({
390
- id: (0, import_echo5.fullyQualifiedId)(thread),
391
- cursor: thread.anchor
392
- }))),
393
- (0, import_react_ui_editor2.comments)({
394
- id: (0, import_echo5.fullyQualifiedId)(doc),
395
- onCreate: ({ cursor }) => {
396
- const name = getName(doc, cursor);
397
- void dispatch((0, import_app_framework3.createIntent)(import_chunk_VW2P26MZ.ThreadAction.Create, {
398
- cursor,
399
- name,
400
- subject: doc
401
- }));
402
- },
403
- onDelete: ({ id }) => {
404
- const draft = state.drafts[(0, import_echo5.fullyQualifiedId)(doc)];
405
- if (draft) {
406
- const index = draft.findIndex((thread2) => (0, import_echo5.fullyQualifiedId)(thread2) === id);
407
- if (index !== -1) {
408
- draft.splice(index, 1);
409
- }
410
- }
411
- const thread = doc.threads.find(import_echo_schema2.Ref.hasObjectId(id))?.target;
412
- if (thread) {
413
- thread.anchor = void 0;
414
- }
415
- },
416
- onUpdate: ({ id, cursor }) => {
417
- const thread = state.drafts[(0, import_echo5.fullyQualifiedId)(doc)]?.find((thread2) => (0, import_echo5.fullyQualifiedId)(thread2) === id) ?? doc.threads.find(import_echo_schema2.Ref.hasObjectId(id))?.target;
418
- if (thread instanceof import_types5.ThreadType && thread.anchor) {
419
- thread.name = getName(doc, thread.anchor);
420
- thread.anchor = cursor;
421
- }
422
- },
423
- onSelect: ({ selection }) => {
424
- const current = selection.current ?? selection.closest;
425
- if (current) {
426
- void dispatch((0, import_app_framework3.createIntent)(import_chunk_VW2P26MZ.ThreadAction.Select, {
427
- current,
428
- skipOpen: true
429
- }));
430
- }
431
- }
432
- })
433
- ];
434
- };
43
+ var import_types2 = require("@dxos/plugin-space/types");
435
44
  var translations_default = [
436
45
  {
437
46
  "en-US": {
438
- [import_types6.ChannelType.typename]: {
47
+ [import_types2.ChannelType.typename]: {
439
48
  "typename label": "Channel"
440
49
  },
441
- [import_chunk_IC2NICNC.THREAD_PLUGIN]: {
50
+ [import_chunk_F735VMTN.THREAD_PLUGIN]: {
442
51
  "plugin name": "Threads",
443
52
  "channel name placeholder": "New channel",
444
53
  "channel title label": "Title",
445
54
  "delete channel label": "Delete channel",
446
55
  "create channel label": "Create channel",
447
56
  "message placeholder": "Reply\u2026",
448
- "settings standalone label": "Enable channel creation (experimental)",
449
57
  "activity message": "Processing\u2026",
450
58
  "anonymous label": "Anonymous",
451
59
  "delete message block label": "Delete message block",
@@ -465,547 +73,153 @@ var translations_default = [
465
73
  "save message label": "Save",
466
74
  "edit message label": "Edit",
467
75
  "delete message label": "Delete message",
468
- "open comments panel label": "Show Comments"
76
+ "open comments panel label": "Show Comments",
77
+ "comments panel label": "Comments",
78
+ "show all label": "All comments",
79
+ "show unresolved label": "Unresolved only"
469
80
  }
470
81
  }
471
82
  }
472
83
  ];
473
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-thread/src/ThreadPlugin.tsx";
474
- var initialViewState = {
475
- showResolvedThreads: false
476
- };
477
- var ThreadPlugin = () => {
478
- const settings = new import_local_storage.LocalStorageStore(import_chunk_IC2NICNC.THREAD_PLUGIN);
479
- const state = (0, import_echo.create)({
480
- drafts: {}
481
- });
482
- const viewStore = (0, import_echo.create)({});
483
- const getViewState = (subjectId) => {
484
- if (!viewStore[subjectId]) {
485
- viewStore[subjectId] = {
486
- ...initialViewState
487
- };
488
- }
489
- return viewStore[subjectId];
490
- };
491
- let intentPlugin;
492
- const unsubscribeCallbacks = [];
493
- return {
494
- meta: import_chunk_IC2NICNC.meta_default,
495
- initialize: async () => {
496
- settings.prop({
497
- key: "standalone",
498
- type: import_local_storage.LocalStorageStore.bool({
499
- allowUndefined: true
500
- })
501
- });
502
- return {
503
- echo: {
504
- system: [
505
- import_types3.ThreadType,
506
- import_types3.MessageType
84
+ var ThreadPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_F735VMTN.meta, [
85
+ // TODO(wittjosiah): Currently not used but leaving because there will likely be settings for threads again.
86
+ // defineModule({
87
+ // id: `${meta.id}/module/settings`,
88
+ // activatesOn: Events.SetupSettings,
89
+ // activate: ThreadSettings,
90
+ // }),
91
+ (0, import_app_framework.defineModule)({
92
+ id: `${import_chunk_F735VMTN.meta.id}/module/state`,
93
+ // TODO(wittjosiah): Does not integrate with settings store.
94
+ // Should this be a different event?
95
+ // Should settings store be renamed to be more generic?
96
+ activatesOn: import_app_framework.Events.SetupSettings,
97
+ activate: import_chunk_BHFHFTHO.ThreadState
98
+ }),
99
+ (0, import_app_framework.defineModule)({
100
+ id: `${import_chunk_F735VMTN.meta.id}/module/translations`,
101
+ activatesOn: import_app_framework.Events.SetupTranslations,
102
+ activate: () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.Translations, [
103
+ ...translations_default,
104
+ ...import_react_ui_thread.translations
105
+ ])
106
+ }),
107
+ (0, import_app_framework.defineModule)({
108
+ id: `${import_chunk_F735VMTN.meta.id}/module/metadata`,
109
+ activatesOn: import_app_framework.Events.SetupMetadata,
110
+ activate: () => [
111
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
112
+ id: import_types.ChannelType.typename,
113
+ metadata: {
114
+ placeholder: [
115
+ "channel name placeholder",
116
+ {
117
+ ns: import_chunk_F735VMTN.THREAD_PLUGIN
118
+ }
507
119
  ],
508
- // TODO(wittjosiah): Requires reload.
509
- ...settings.values.standalone ? {
510
- schema: [
511
- import_types3.ChannelType
512
- ]
513
- } : {}
120
+ icon: "ph--chat--regular",
121
+ // TODO(wittjosiah): Move out of metadata.
122
+ loadReferences: async (channel) => await import_echo.RefArray.loadAll(channel.threads ?? [])
514
123
  }
515
- };
516
- },
517
- ready: async ({ plugins }) => {
518
- intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
519
- },
520
- unload: async () => {
521
- unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
522
- },
523
- provides: {
524
- settings: settings.values,
525
- metadata: {
526
- records: {
527
- [import_types3.ChannelType.typename]: {
528
- createObject: (props) => (0, import_app_framework.createIntent)(import_chunk_VW2P26MZ.ThreadAction.Create, props),
529
- placeholder: [
530
- "channel name placeholder",
531
- {
532
- ns: import_chunk_IC2NICNC.THREAD_PLUGIN
533
- }
534
- ],
535
- icon: "ph--chat--regular",
536
- // TODO(wittjosiah): Move out of metadata.
537
- loadReferences: async (channel) => await import_echo.RefArray.loadAll(channel.threads ?? [])
538
- },
539
- [import_types3.ThreadType.typename]: {
540
- // TODO(wittjosiah): Move out of metadata.
541
- loadReferences: async (thread) => await import_echo.RefArray.loadAll(thread.messages ?? [])
542
- },
543
- [import_types3.MessageType.typename]: {
544
- // TODO(wittjosiah): Move out of metadata.
545
- loadReferences: (message) => []
546
- },
547
- [import_chunk_IC2NICNC.THREAD_ITEM]: {
548
- parse: (item, type) => {
549
- switch (type) {
550
- case "node":
551
- return {
552
- id: item.id,
553
- label: item.title,
554
- data: item
555
- };
556
- case "object":
557
- return item;
558
- case "view-object":
559
- return {
560
- id: `${item.id}-view`,
561
- object: item
562
- };
563
- }
564
- }
565
- }
124
+ }),
125
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
126
+ id: import_types.ThreadType.typename,
127
+ metadata: {
128
+ // TODO(wittjosiah): Move out of metadata.
129
+ loadReferences: async (thread) => await import_echo.RefArray.loadAll(thread.messages ?? [])
566
130
  }
567
- },
568
- translations: [
569
- ...translations_default,
570
- ...import_react_ui_thread.translations
571
- ],
572
- complementary: {
573
- panels: [
574
- {
575
- id: "comments",
576
- label: [
577
- "open comments panel label",
578
- {
579
- ns: import_chunk_IC2NICNC.THREAD_PLUGIN
580
- }
581
- ],
582
- icon: "ph--chat-text--regular"
583
- }
584
- ]
585
- },
586
- graph: {
587
- builder: (plugins) => {
588
- const client = (0, import_app_framework.resolvePlugin)(plugins, import_types.parseClientPlugin)?.provides.client;
589
- const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatchPromise;
590
- const metadataResolver = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin)?.provides.metadata.resolver;
591
- if (!client || !dispatch || !metadataResolver) {
592
- return [];
593
- }
594
- const type = "orphan-comments-for-subject";
595
- const icon = "ph--chat-text--regular";
596
- return [
597
- (0, import_plugin_graph.createExtension)({
598
- id: `${import_chunk_IC2NICNC.THREAD_PLUGIN}/comments-for-subject`,
599
- resolver: ({ id }) => {
600
- if (!id.endsWith("~comments")) {
601
- return;
602
- }
603
- const [subjectId] = id.split("~");
604
- const { spaceId, objectId } = (0, import_echo.parseId)(subjectId);
605
- const spaces = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
606
- const space = spaces?.find((space2) => space2.id === spaceId && space2.state.get() === import_echo.SpaceState.SPACE_READY);
607
- if (!objectId) {
608
- return {
609
- id,
610
- type,
611
- data: null,
612
- properties: {
613
- icon,
614
- label: [
615
- "unnamed object threads label",
616
- {
617
- ns: import_chunk_IC2NICNC.THREAD_PLUGIN
618
- }
619
- ],
620
- showResolvedThreads: false,
621
- object: null,
622
- space
623
- }
624
- };
625
- }
626
- const [object] = (0, import_plugin_space.memoizeQuery)(space, {
627
- id: objectId
628
- });
629
- if (!object || !subjectId) {
630
- return;
631
- }
632
- const meta = metadataResolver((0, import_echo.getTypename)(object) ?? "");
633
- const label = meta.label?.(object) || object.name || meta.placeholder || [
634
- "unnamed object threads label",
635
- {
636
- ns: import_chunk_IC2NICNC.THREAD_PLUGIN
637
- }
638
- ];
639
- const viewState = getViewState(subjectId);
131
+ }),
132
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
133
+ id: import_types.MessageType.typename,
134
+ metadata: {
135
+ // TODO(wittjosiah): Move out of metadata.
136
+ loadReferences: (message) => []
137
+ }
138
+ }),
139
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
140
+ id: import_chunk_F735VMTN.THREAD_ITEM,
141
+ metadata: {
142
+ parse: (item, type) => {
143
+ switch (type) {
144
+ case "node":
640
145
  return {
641
- id,
642
- type,
643
- data: null,
644
- properties: {
645
- icon,
646
- label,
647
- showResolvedThreads: viewState.showResolvedThreads,
648
- object
649
- }
650
- };
651
- },
652
- actions: ({ node }) => {
653
- const dataId = node.id.split("~").at(0);
654
- if (!node.id.endsWith("~comments") || !dataId) {
655
- return;
656
- }
657
- const [spaceId, objectId] = dataId.split(":");
658
- const viewState = getViewState(dataId);
659
- const toggle = async () => {
660
- const newToggleState = !viewState.showResolvedThreads;
661
- viewState.showResolvedThreads = newToggleState;
662
- await dispatch((0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
663
- name: "threads.toggle-show-resolved",
664
- properties: {
665
- spaceId,
666
- threadId: objectId,
667
- showResolved: newToggleState
668
- }
669
- }));
146
+ id: item.id,
147
+ label: item.title,
148
+ data: item
670
149
  };
671
- return [
672
- {
673
- id: `${import_chunk_IC2NICNC.THREAD_PLUGIN}/toggle-show-resolved/${node.id}`,
674
- data: toggle,
675
- properties: {
676
- label: [
677
- "toggle show resolved",
678
- {
679
- ns: import_chunk_IC2NICNC.THREAD_PLUGIN
680
- }
681
- ],
682
- menuItemType: "toggle",
683
- isChecked: viewState.showResolvedThreads,
684
- testId: "threadPlugin.toggleShowResolved",
685
- icon: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
686
- }
687
- }
688
- ];
689
- }
690
- })
691
- ];
692
- }
693
- },
694
- surface: {
695
- definitions: ({ plugins }) => {
696
- const location = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseNavigationPlugin)?.provides.location;
697
- return [
698
- (0, import_app_framework.createSurface)({
699
- id: `${import_chunk_IC2NICNC.THREAD_PLUGIN}/channel`,
700
- role: "article",
701
- filter: (data) => data.subject instanceof import_types3.ChannelType && !!data.subject.threads[0],
702
- component: ({ data }) => {
703
- const channel = data.subject;
704
- const thread = channel.threads[0].target;
705
- if ((0, import_app_framework.isLayoutParts)(location?.active) && location.active.main) {
706
- const layoutEntries = location.active.main;
707
- const currentPosition = layoutEntries.findIndex((entry) => channel.id === entry.id);
708
- if (currentPosition > 0) {
709
- const objectToTheLeft = layoutEntries[currentPosition - 1];
710
- const context = (0, import_echo.getSpace)(channel)?.db.getObjectById(objectToTheLeft.id);
711
- return /* @__PURE__ */ import_react.default.createElement(ThreadArticle, {
712
- thread,
713
- context
714
- });
715
- }
716
- }
717
- return /* @__PURE__ */ import_react.default.createElement(ThreadArticle, {
718
- thread
719
- });
720
- }
721
- }),
722
- (0, import_app_framework.createSurface)({
723
- id: `${import_chunk_IC2NICNC.THREAD_PLUGIN}/thread`,
724
- role: "complementary--comments",
725
- filter: (data) => !!data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads) && !(data.subject instanceof import_types3.ChannelType),
726
- component: ({ data }) => {
727
- const { showResolvedThreads } = getViewState((0, import_echo.fullyQualifiedId)(data.subject));
728
- return /* @__PURE__ */ import_react.default.createElement(ThreadComplementary, {
729
- subject: data.subject,
730
- drafts: state.drafts[(0, import_echo.fullyQualifiedId)(data.subject)],
731
- current: state.current,
732
- showResolvedThreads
733
- });
734
- }
735
- }),
736
- (0, import_app_framework.createSurface)({
737
- id: `${import_chunk_IC2NICNC.THREAD_PLUGIN}/settings`,
738
- role: "settings",
739
- filter: (data) => data.plugin === import_chunk_IC2NICNC.THREAD_PLUGIN,
740
- component: () => /* @__PURE__ */ import_react.default.createElement(ThreadSettings, {
741
- settings: settings.values
742
- })
743
- })
744
- ];
745
- }
746
- },
747
- intent: {
748
- resolvers: () => [
749
- (0, import_app_framework.createResolver)(import_chunk_VW2P26MZ.ThreadAction.Create, ({ name, cursor, subject }) => {
750
- if (cursor && subject) {
751
- if (subject?.threads === void 0) {
752
- try {
753
- subject.threads = [];
754
- } catch (err) {
755
- import_log.log.error("Subject does not support threads array", subject?.typename, {
756
- F: __dxlog_file,
757
- L: 314,
758
- S: void 0,
759
- C: (f, a) => f(...a)
760
- });
761
- return;
762
- }
763
- }
764
- const subjectId = (0, import_echo.fullyQualifiedId)(subject);
765
- const thread = (0, import_echo.create)(import_types3.ThreadType, {
766
- name,
767
- anchor: cursor,
768
- messages: [],
769
- status: "staged"
770
- });
771
- const draft = state.drafts[subjectId];
772
- if (draft) {
773
- draft.push(thread);
774
- } else {
775
- state.drafts[subjectId] = [
776
- thread
777
- ];
778
- }
779
- return {
780
- data: {
781
- object: thread
782
- },
783
- intents: [
784
- (0, import_app_framework.createIntent)(import_chunk_VW2P26MZ.ThreadAction.Select, {
785
- current: (0, import_echo.fullyQualifiedId)(thread)
786
- }),
787
- (0, import_app_framework.createIntent)(import_app_framework.NavigationAction.Open, {
788
- activeParts: {
789
- complementary: "comments"
790
- }
791
- }),
792
- (0, import_app_framework.createIntent)(import_app_framework.LayoutAction.SetLayout, {
793
- element: "complementary",
794
- state: true
795
- })
796
- ]
797
- };
798
- } else {
799
- return {
800
- data: {
801
- object: (0, import_echo.create)(import_types3.ChannelType, {
802
- threads: [
803
- (0, import_echo.makeRef)((0, import_echo.create)(import_types3.ThreadType, {
804
- messages: []
805
- }))
806
- ]
807
- })
808
- }
809
- };
810
- }
811
- }),
812
- (0, import_app_framework.createResolver)(import_chunk_VW2P26MZ.ThreadAction.Select, ({ current, skipOpen }) => {
813
- state.current = current;
814
- return {
815
- intents: !skipOpen ? [
816
- (0, import_app_framework.createIntent)(import_app_framework.NavigationAction.Open, {
817
- activeParts: {
818
- complementary: "comments"
819
- }
820
- })
821
- ] : void 0
822
- };
823
- }),
824
- (0, import_app_framework.createResolver)(import_chunk_VW2P26MZ.ThreadAction.ToggleResolved, ({ thread }) => {
825
- if (thread.status === "active" || thread.status === void 0) {
826
- thread.status = "resolved";
827
- } else if (thread.status === "resolved") {
828
- thread.status = "active";
829
- }
830
- const space = (0, import_echo.getSpace)(thread);
831
- const spaceId = space?.id;
832
- return {
833
- intents: [
834
- (0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
835
- name: "threads.toggle-resolved",
836
- properties: {
837
- threadId: thread.id,
838
- spaceId
839
- }
840
- })
841
- ]
842
- };
843
- }),
844
- (0, import_app_framework.createResolver)(import_chunk_VW2P26MZ.ThreadAction.Delete, ({ subject, thread }, undo) => {
845
- const subjectId = (0, import_echo.fullyQualifiedId)(subject);
846
- const draft = state.drafts[subjectId];
847
- if (draft) {
848
- const index = draft.findIndex((t) => t.id === thread.id);
849
- if (index !== -1) {
850
- draft.splice(index, 1);
851
- return;
852
- }
853
- }
854
- const space = (0, import_echo.getSpace)(thread);
855
- if (!space || !subject.threads) {
856
- return;
857
- }
858
- if (!undo) {
859
- const index = subject.threads.findIndex((t) => t?.id === thread.id);
860
- const cursor = subject.threads[index]?.anchor;
861
- if (index !== -1) {
862
- subject.threads?.splice(index, 1);
863
- }
864
- space.db.remove(thread);
865
- return {
866
- undoable: {
867
- message: [
868
- "thread deleted label",
869
- {
870
- ns: import_chunk_IC2NICNC.THREAD_PLUGIN
871
- }
872
- ],
873
- data: {
874
- cursor
875
- }
876
- },
877
- intents: [
878
- (0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
879
- name: "threads.delete",
880
- properties: {
881
- threadId: thread.id,
882
- spaceId: space.id
883
- }
884
- })
885
- ]
886
- };
887
- } else {
888
- const savedThread = space.db.add(thread);
889
- subject.threads.push(savedThread);
890
- return {
891
- intents: [
892
- (0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
893
- name: "threads.undo-delete",
894
- properties: {
895
- threadId: thread.id,
896
- spaceId: space.id
897
- }
898
- })
899
- ]
900
- };
901
- }
902
- }),
903
- (0, import_app_framework.createResolver)(import_chunk_VW2P26MZ.ThreadAction.OnMessageAdd, ({ thread, subject }) => {
904
- const subjectId = (0, import_echo.fullyQualifiedId)(subject);
905
- const space = (0, import_echo.getSpace)(subject);
906
- const intents = [];
907
- const analyticsProperties = {
908
- threadId: thread.id,
909
- spaceId: space?.id
910
- };
911
- if (state.drafts[subjectId]?.find((t) => t === thread)) {
912
- thread.status = "active";
913
- subject.threads ? subject.threads.push((0, import_echo.makeRef)(thread)) : subject.threads = [
914
- (0, import_echo.makeRef)(thread)
915
- ];
916
- state.drafts[subjectId] = state.drafts[subjectId]?.filter(({ id }) => id !== thread.id);
917
- intents.push((0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
918
- name: "threads.thread-created",
919
- properties: analyticsProperties
920
- }));
921
- }
922
- intents.push((0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
923
- name: "threads.message-added",
924
- properties: {
925
- ...analyticsProperties,
926
- threadLength: thread.messages.length
927
- }
928
- }));
929
- return {
930
- intents
931
- };
932
- }),
933
- (0, import_app_framework.createResolver)(import_chunk_VW2P26MZ.ThreadAction.DeleteMessage, ({ subject, thread, messageId, message, messageIndex }, undo) => {
934
- const space = (0, import_echo.getSpace)(subject);
935
- if (!undo) {
936
- const messageIndex2 = thread.messages.findIndex(import_echo_schema.Ref.hasObjectId(messageId));
937
- const message2 = thread.messages[messageIndex2]?.target;
938
- if (!message2) {
939
- return;
940
- }
941
- if (messageIndex2 === 0 && thread.messages.length === 1) {
150
+ case "object":
151
+ return item;
152
+ case "view-object":
942
153
  return {
943
- intents: [
944
- (0, import_app_framework.createIntent)(import_chunk_VW2P26MZ.ThreadAction.Delete, {
945
- subject,
946
- thread
947
- })
948
- ]
154
+ id: `${item.id}-view`,
155
+ object: item
949
156
  };
950
- } else {
951
- thread.messages.splice(messageIndex2, 1);
952
- }
953
- return {
954
- undoable: {
955
- message: [
956
- "message deleted label",
957
- {
958
- ns: import_chunk_IC2NICNC.THREAD_PLUGIN
959
- }
960
- ],
961
- data: {
962
- message: message2,
963
- messageIndex: messageIndex2
964
- }
965
- },
966
- intents: [
967
- (0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
968
- name: "threads.message.delete",
969
- properties: {
970
- threadId: thread.id,
971
- spaceId: space?.id
972
- }
973
- })
974
- ]
975
- };
976
- } else {
977
- if (!messageIndex || !message) {
978
- return;
979
- }
980
- thread.messages.splice(messageIndex, 0, (0, import_echo.makeRef)(message));
981
- return {
982
- intents: [
983
- (0, import_app_framework.createIntent)(import_types2.ObservabilityAction.SendEvent, {
984
- name: "threads.message.undo-delete",
985
- properties: {
986
- threadId: thread.id,
987
- spaceId: space?.id
988
- }
989
- })
990
- ]
991
- };
992
157
  }
993
- })
994
- ]
995
- },
996
- markdown: {
997
- extensions: ({ document: doc }) => {
998
- return threads(state, doc, intentPlugin?.provides.intent.dispatchPromise);
158
+ }
999
159
  }
1000
- }
1001
- }
1002
- };
1003
- };
1004
- var src_default = ThreadPlugin;
160
+ })
161
+ ]
162
+ }),
163
+ (0, import_app_framework.defineModule)({
164
+ id: `${import_chunk_F735VMTN.meta.id}/module/object-form`,
165
+ activatesOn: import_plugin_client.ClientEvents.SetupSchema,
166
+ activate: () => (0, import_app_framework.contributes)(import_plugin_space.SpaceCapabilities.ObjectForm, (0, import_types.defineObjectForm)({
167
+ objectSchema: import_types.ChannelType,
168
+ getIntent: () => (0, import_app_framework.createIntent)(import_chunk_CMEMMYDL.ThreadAction.Create)
169
+ }))
170
+ }),
171
+ (0, import_app_framework.defineModule)({
172
+ id: `${import_chunk_F735VMTN.meta.id}/module/schema`,
173
+ activatesOn: import_plugin_client.ClientEvents.SetupSchema,
174
+ activate: () => (0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.Schema, [
175
+ import_types.ThreadType,
176
+ import_types.MessageType
177
+ ])
178
+ }),
179
+ (0, import_app_framework.defineModule)({
180
+ id: `${import_chunk_F735VMTN.meta.id}/module/complementary-panel`,
181
+ activatesOn: import_plugin_deck.DeckEvents.SetupComplementaryPanels,
182
+ activate: () => (0, import_app_framework.contributes)(import_plugin_deck.DeckCapabilities.ComplementaryPanel, {
183
+ id: "comments",
184
+ label: [
185
+ "comments panel label",
186
+ {
187
+ ns: import_chunk_F735VMTN.THREAD_PLUGIN
188
+ }
189
+ ],
190
+ icon: "ph--chat-text--regular",
191
+ position: "hoist",
192
+ // TODO(wittjosiah): Support comments on any object.
193
+ // filter: (node) => isEchoObject(node.data) && !!getSpace(node.data),
194
+ filter: (node) => !!node.data && typeof node.data === "object" && "threads" in node.data && Array.isArray(node.data.threads) && !(node.data instanceof import_types.ChannelType)
195
+ })
196
+ }),
197
+ (0, import_app_framework.defineModule)({
198
+ id: `${import_chunk_F735VMTN.meta.id}/module/markdown`,
199
+ activatesOn: import_plugin_markdown.MarkdownEvents.SetupExtensions,
200
+ activate: import_chunk_BHFHFTHO.Markdown
201
+ }),
202
+ (0, import_app_framework.defineModule)({
203
+ id: `${import_chunk_F735VMTN.meta.id}/module/react-surface`,
204
+ activatesOn: import_app_framework.Events.SetupReactSurface,
205
+ // TODO(wittjosiah): Should occur before the comments thread is loaded when surfaces activation is more granular.
206
+ activatesBefore: [
207
+ import_plugin_space.ThreadEvents.SetupThread
208
+ ],
209
+ activate: import_chunk_BHFHFTHO.ReactSurface
210
+ }),
211
+ (0, import_app_framework.defineModule)({
212
+ id: `${import_chunk_F735VMTN.meta.id}/module/intent-resolver`,
213
+ activatesOn: import_app_framework.Events.SetupIntentResolver,
214
+ activate: import_chunk_BHFHFTHO.IntentResolver
215
+ })
216
+ ]);
1005
217
  // Annotate the CommonJS export names for ESM import in node:
1006
218
  0 && (module.exports = {
1007
- ThreadAction,
219
+ THREAD_ITEM,
220
+ THREAD_PLUGIN,
1008
221
  ThreadPlugin,
222
+ meta,
1009
223
  useAnalyticsCallback,
1010
224
  useOnEditAnalytics,
1011
225
  useStatus