@dxos/plugin-thread 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b

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 (185) hide show
  1. package/dist/lib/browser/ThreadContainer-OI5M262D.mjs +19 -0
  2. package/dist/lib/browser/ThreadContainer-OI5M262D.mjs.map +7 -0
  3. package/dist/lib/browser/app-graph-builder-Q7A2ZRUA.mjs +121 -0
  4. package/dist/lib/browser/app-graph-builder-Q7A2ZRUA.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-ENERBDYI.mjs → chunk-636QDHE3.mjs} +3 -3
  6. package/dist/lib/browser/chunk-636QDHE3.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-BD3J6HEY.mjs +18 -0
  8. package/dist/lib/browser/chunk-BD3J6HEY.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-BNEWNQBO.mjs +71 -0
  10. package/dist/lib/browser/chunk-BNEWNQBO.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-OD2IZKRP.mjs → chunk-GQVZK3BQ.mjs} +21 -87
  12. package/dist/lib/browser/chunk-GQVZK3BQ.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-NAO3LZMZ.mjs +16 -0
  14. package/dist/lib/browser/chunk-NAO3LZMZ.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-6KTMQPL4.mjs → chunk-NO5AZLUZ.mjs} +7 -3
  16. package/dist/lib/browser/chunk-NO5AZLUZ.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +149 -939
  18. package/dist/lib/browser/index.mjs.map +4 -4
  19. package/dist/lib/browser/intent-resolver-QFP6L3AF.mjs +287 -0
  20. package/dist/lib/browser/intent-resolver-QFP6L3AF.mjs.map +7 -0
  21. package/dist/lib/browser/markdown-2NBXKXCY.mjs +112 -0
  22. package/dist/lib/browser/markdown-2NBXKXCY.mjs.map +7 -0
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/react-surface-PXYCYPWA.mjs +410 -0
  25. package/dist/lib/browser/react-surface-PXYCYPWA.mjs.map +7 -0
  26. package/dist/lib/browser/settings-TKOPRXSU.mjs +22 -0
  27. package/dist/lib/browser/settings-TKOPRXSU.mjs.map +7 -0
  28. package/dist/lib/browser/state-GNFUURIC.mjs +33 -0
  29. package/dist/lib/browser/state-GNFUURIC.mjs.map +7 -0
  30. package/dist/lib/browser/types.mjs +6 -4
  31. package/dist/lib/node/{ThreadArticle-ZCNMFBAO.cjs → ThreadContainer-L6TPQJWA.cjs} +14 -13
  32. package/dist/lib/node/ThreadContainer-L6TPQJWA.cjs.map +7 -0
  33. package/dist/lib/node/app-graph-builder-ZXW5KUDK.cjs +135 -0
  34. package/dist/lib/node/app-graph-builder-ZXW5KUDK.cjs.map +7 -0
  35. package/dist/lib/node/{chunk-2CB5AVBL.cjs → chunk-2TK6J6BN.cjs} +70 -138
  36. package/dist/lib/node/chunk-2TK6J6BN.cjs.map +7 -0
  37. package/dist/lib/node/{chunk-VW2P26MZ.cjs → chunk-AUVKOX5Q.cjs} +13 -8
  38. package/dist/lib/node/chunk-AUVKOX5Q.cjs.map +7 -0
  39. package/dist/lib/node/chunk-AWSTZ2KN.cjs +93 -0
  40. package/dist/lib/node/chunk-AWSTZ2KN.cjs.map +7 -0
  41. package/dist/lib/node/{chunk-IC2NICNC.cjs → chunk-F735VMTN.cjs} +7 -7
  42. package/dist/lib/node/chunk-F735VMTN.cjs.map +7 -0
  43. package/dist/lib/node/{meta.cjs → chunk-FPWNZ6TB.cjs} +13 -10
  44. package/dist/lib/node/chunk-FPWNZ6TB.cjs.map +7 -0
  45. package/dist/lib/node/{ThreadMain-5AYGCXXP.cjs → chunk-S5LH7AIT.cjs} +26 -23
  46. package/dist/lib/node/chunk-S5LH7AIT.cjs.map +7 -0
  47. package/dist/lib/node/index.cjs +147 -933
  48. package/dist/lib/node/index.cjs.map +4 -4
  49. package/dist/lib/node/intent-resolver-ZSOQILPJ.cjs +299 -0
  50. package/dist/lib/node/intent-resolver-ZSOQILPJ.cjs.map +7 -0
  51. package/dist/lib/node/markdown-FWRKMSKV.cjs +122 -0
  52. package/dist/lib/node/markdown-FWRKMSKV.cjs.map +7 -0
  53. package/dist/lib/node/meta.json +1 -1
  54. package/dist/lib/node/react-surface-CPDCOLUZ.cjs +412 -0
  55. package/dist/lib/node/react-surface-CPDCOLUZ.cjs.map +7 -0
  56. package/dist/lib/node/settings-TH4YSUVU.cjs +36 -0
  57. package/dist/lib/node/settings-TH4YSUVU.cjs.map +7 -0
  58. package/dist/lib/node/state-TQWEZ6B3.cjs +49 -0
  59. package/dist/lib/node/state-TQWEZ6B3.cjs.map +7 -0
  60. package/dist/lib/node/types.cjs +6 -4
  61. package/dist/lib/node/types.cjs.map +2 -2
  62. package/dist/lib/node-esm/ThreadContainer-HE46AQJH.mjs +20 -0
  63. package/dist/lib/node-esm/ThreadContainer-HE46AQJH.mjs.map +7 -0
  64. package/dist/lib/node-esm/app-graph-builder-ATS6HGE6.mjs +122 -0
  65. package/dist/lib/node-esm/app-graph-builder-ATS6HGE6.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-7YYL6QVU.mjs +20 -0
  67. package/dist/lib/node-esm/chunk-7YYL6QVU.mjs.map +7 -0
  68. package/dist/lib/node-esm/{chunk-AQ74G3GY.mjs → chunk-AZCU7SHI.mjs} +21 -87
  69. package/dist/lib/node-esm/chunk-AZCU7SHI.mjs.map +7 -0
  70. package/dist/lib/node-esm/{chunk-RMYATBXM.mjs → chunk-B3CF35MY.mjs} +7 -3
  71. package/dist/lib/node-esm/chunk-B3CF35MY.mjs.map +7 -0
  72. package/dist/lib/node-esm/{chunk-7QRGG25F.mjs → chunk-FXUATCLW.mjs} +3 -3
  73. package/dist/lib/node-esm/chunk-FXUATCLW.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-HLWJTUWZ.mjs +73 -0
  75. package/dist/lib/node-esm/chunk-HLWJTUWZ.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-ZJITX3TO.mjs +17 -0
  77. package/dist/lib/node-esm/chunk-ZJITX3TO.mjs.map +7 -0
  78. package/dist/lib/node-esm/index.mjs +149 -939
  79. package/dist/lib/node-esm/index.mjs.map +4 -4
  80. package/dist/lib/node-esm/intent-resolver-MHP4C2NZ.mjs +288 -0
  81. package/dist/lib/node-esm/intent-resolver-MHP4C2NZ.mjs.map +7 -0
  82. package/dist/lib/node-esm/markdown-6AQFDAW3.mjs +113 -0
  83. package/dist/lib/node-esm/markdown-6AQFDAW3.mjs.map +7 -0
  84. package/dist/lib/node-esm/meta.json +1 -1
  85. package/dist/lib/node-esm/react-surface-RD4F2LRT.mjs +411 -0
  86. package/dist/lib/node-esm/react-surface-RD4F2LRT.mjs.map +7 -0
  87. package/dist/lib/node-esm/settings-KEDRR7RM.mjs +23 -0
  88. package/dist/lib/node-esm/settings-KEDRR7RM.mjs.map +7 -0
  89. package/dist/lib/node-esm/state-7MLR27YG.mjs +34 -0
  90. package/dist/lib/node-esm/state-7MLR27YG.mjs.map +7 -0
  91. package/dist/lib/node-esm/types.mjs +6 -4
  92. package/dist/types/src/ThreadPlugin.d.ts +1 -3
  93. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  94. package/dist/types/src/capabilities/app-graph-builder.d.ts +180 -0
  95. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  96. package/dist/types/src/capabilities/capabilities.d.ts +15 -0
  97. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  98. package/dist/types/src/capabilities/index.d.ts +187 -0
  99. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  100. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  101. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  102. package/dist/types/src/capabilities/markdown.d.ts +4 -0
  103. package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
  104. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  105. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  106. package/dist/types/src/capabilities/settings.d.ts +4 -0
  107. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  108. package/dist/types/src/capabilities/state.d.ts +7 -0
  109. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  110. package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
  111. package/dist/types/src/components/CommentContainer.d.ts +1 -1
  112. package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
  113. package/dist/types/src/components/CommentsContainer.d.ts +2 -7
  114. package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
  115. package/dist/types/src/components/ThreadComplementary.d.ts +1 -5
  116. package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
  117. package/dist/types/src/components/ThreadContainer.d.ts +7 -0
  118. package/dist/types/src/components/ThreadContainer.d.ts.map +1 -0
  119. package/dist/types/src/components/command-extension.d.ts.map +1 -1
  120. package/dist/types/src/components/index.d.ts +3 -15
  121. package/dist/types/src/components/index.d.ts.map +1 -1
  122. package/dist/types/src/components/types.d.ts +5 -5
  123. package/dist/types/src/components/types.d.ts.map +1 -1
  124. package/dist/types/src/index.d.ts +1 -3
  125. package/dist/types/src/index.d.ts.map +1 -1
  126. package/dist/types/src/meta.d.ts +1 -2
  127. package/dist/types/src/meta.d.ts.map +1 -1
  128. package/dist/types/src/translations.d.ts +3 -0
  129. package/dist/types/src/translations.d.ts.map +1 -1
  130. package/dist/types/src/types.d.ts +10 -14
  131. package/dist/types/src/types.d.ts.map +1 -1
  132. package/dist/types/tsconfig.tsbuildinfo +1 -1
  133. package/package.json +30 -38
  134. package/src/ThreadPlugin.tsx +104 -470
  135. package/src/capabilities/app-graph-builder.ts +120 -0
  136. package/src/capabilities/capabilities.ts +19 -0
  137. package/src/capabilities/index.ts +14 -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 +56 -0
  141. package/src/capabilities/settings.ts +14 -0
  142. package/src/capabilities/state.ts +25 -0
  143. package/src/components/Chat.stories.tsx +25 -23
  144. package/src/components/CommentContainer.tsx +16 -30
  145. package/src/components/CommentsContainer.tsx +1 -17
  146. package/src/components/ThreadComplementary.tsx +85 -48
  147. package/src/components/ThreadContainer.tsx +22 -0
  148. package/src/components/ThreadSettings.tsx +3 -3
  149. package/src/components/command-extension.ts +2 -5
  150. package/src/components/index.ts +1 -2
  151. package/src/components/types.ts +5 -5
  152. package/src/index.ts +1 -5
  153. package/src/meta.ts +1 -1
  154. package/src/translations.ts +1 -0
  155. package/src/types.ts +10 -29
  156. package/dist/lib/browser/ThreadArticle-EWLTNU6Z.mjs +0 -18
  157. package/dist/lib/browser/ThreadArticle-EWLTNU6Z.mjs.map +0 -7
  158. package/dist/lib/browser/ThreadMain-ABEDFWHC.mjs +0 -26
  159. package/dist/lib/browser/ThreadMain-ABEDFWHC.mjs.map +0 -7
  160. package/dist/lib/browser/chunk-6KTMQPL4.mjs.map +0 -7
  161. package/dist/lib/browser/chunk-ENERBDYI.mjs.map +0 -7
  162. package/dist/lib/browser/chunk-OD2IZKRP.mjs.map +0 -7
  163. package/dist/lib/browser/meta.mjs +0 -11
  164. package/dist/lib/browser/meta.mjs.map +0 -7
  165. package/dist/lib/node/ThreadArticle-ZCNMFBAO.cjs.map +0 -7
  166. package/dist/lib/node/ThreadMain-5AYGCXXP.cjs.map +0 -7
  167. package/dist/lib/node/chunk-2CB5AVBL.cjs.map +0 -7
  168. package/dist/lib/node/chunk-IC2NICNC.cjs.map +0 -7
  169. package/dist/lib/node/chunk-VW2P26MZ.cjs.map +0 -7
  170. package/dist/lib/node/meta.cjs.map +0 -7
  171. package/dist/lib/node-esm/ThreadArticle-F37HYTOU.mjs +0 -19
  172. package/dist/lib/node-esm/ThreadArticle-F37HYTOU.mjs.map +0 -7
  173. package/dist/lib/node-esm/ThreadMain-OL6ZHNZY.mjs +0 -27
  174. package/dist/lib/node-esm/ThreadMain-OL6ZHNZY.mjs.map +0 -7
  175. package/dist/lib/node-esm/chunk-7QRGG25F.mjs.map +0 -7
  176. package/dist/lib/node-esm/chunk-AQ74G3GY.mjs.map +0 -7
  177. package/dist/lib/node-esm/chunk-RMYATBXM.mjs.map +0 -7
  178. package/dist/lib/node-esm/meta.mjs +0 -12
  179. package/dist/lib/node-esm/meta.mjs.map +0 -7
  180. package/dist/types/src/components/ThreadArticle.d.ts +0 -5
  181. package/dist/types/src/components/ThreadArticle.d.ts.map +0 -1
  182. package/dist/types/src/components/ThreadMain.d.ts +0 -7
  183. package/dist/types/src/components/ThreadMain.d.ts.map +0 -1
  184. package/src/components/ThreadArticle.tsx +0 -18
  185. 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,428 +15,37 @@ 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_S5LH7AIT = require("./chunk-S5LH7AIT.cjs");
31
+ var import_chunk_FPWNZ6TB = require("./chunk-FPWNZ6TB.cjs");
32
+ var import_chunk_AWSTZ2KN = require("./chunk-AWSTZ2KN.cjs");
33
+ var import_chunk_AUVKOX5Q = require("./chunk-AUVKOX5Q.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");
50
- var import_plugin_space = require("@dxos/plugin-space");
51
- var import_types3 = require("@dxos/plugin-space/types");
36
+ var import_plugin_client = require("@dxos/plugin-client");
37
+ var import_plugin_deck = require("@dxos/plugin-deck");
38
+ var import_types = require("@dxos/plugin-space/types");
52
39
  var import_echo = require("@dxos/react-client/echo");
53
40
  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
- };
41
+ var import_types2 = require("@dxos/plugin-space/types");
435
42
  var translations_default = [
436
43
  {
437
44
  "en-US": {
438
- [import_types6.ChannelType.typename]: {
45
+ [import_types2.ChannelType.typename]: {
439
46
  "typename label": "Channel"
440
47
  },
441
- [import_chunk_IC2NICNC.THREAD_PLUGIN]: {
48
+ [import_chunk_F735VMTN.THREAD_PLUGIN]: {
442
49
  "plugin name": "Threads",
443
50
  "channel name placeholder": "New channel",
444
51
  "channel title label": "Title",
@@ -465,547 +72,154 @@ var translations_default = [
465
72
  "save message label": "Save",
466
73
  "edit message label": "Edit",
467
74
  "delete message label": "Delete message",
468
- "open comments panel label": "Show Comments"
75
+ "open comments panel label": "Show Comments",
76
+ "comments panel label": "Comments"
469
77
  }
470
78
  }
471
79
  }
472
80
  ];
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
81
+ var ThreadPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_F735VMTN.meta, [
82
+ (0, import_app_framework.defineModule)({
83
+ id: `${import_chunk_F735VMTN.meta.id}/module/settings`,
84
+ activatesOn: import_app_framework.Events.SetupSettings,
85
+ activate: import_chunk_S5LH7AIT.ThreadSettings
86
+ }),
87
+ (0, import_app_framework.defineModule)({
88
+ id: `${import_chunk_F735VMTN.meta.id}/module/state`,
89
+ activatesOn: import_app_framework.Events.Startup,
90
+ activate: import_chunk_S5LH7AIT.ThreadState
91
+ }),
92
+ (0, import_app_framework.defineModule)({
93
+ id: `${import_chunk_F735VMTN.meta.id}/module/translations`,
94
+ activatesOn: import_app_framework.Events.SetupTranslations,
95
+ activate: () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.Translations, [
96
+ ...translations_default,
97
+ ...import_react_ui_thread.translations
98
+ ])
99
+ }),
100
+ (0, import_app_framework.defineModule)({
101
+ id: `${import_chunk_F735VMTN.meta.id}/module/metadata`,
102
+ activatesOn: import_app_framework.Events.SetupMetadata,
103
+ activate: () => [
104
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
105
+ id: import_types.ChannelType.typename,
106
+ metadata: {
107
+ createObject: (props) => (0, import_app_framework.createIntent)(import_chunk_AUVKOX5Q.ThreadAction.Create, props),
108
+ placeholder: [
109
+ "channel name placeholder",
110
+ {
111
+ ns: import_chunk_F735VMTN.THREAD_PLUGIN
112
+ }
507
113
  ],
508
- // TODO(wittjosiah): Requires reload.
509
- ...settings.values.standalone ? {
510
- schema: [
511
- import_types3.ChannelType
512
- ]
513
- } : {}
114
+ icon: "ph--chat--regular",
115
+ // TODO(wittjosiah): Move out of metadata.
116
+ loadReferences: async (channel) => await import_echo.RefArray.loadAll(channel.threads ?? [])
514
117
  }
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
- }
118
+ }),
119
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
120
+ id: import_types.ThreadType.typename,
121
+ metadata: {
122
+ // TODO(wittjosiah): Move out of metadata.
123
+ loadReferences: async (thread) => await import_echo.RefArray.loadAll(thread.messages ?? [])
566
124
  }
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);
125
+ }),
126
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
127
+ id: import_types.MessageType.typename,
128
+ metadata: {
129
+ // TODO(wittjosiah): Move out of metadata.
130
+ loadReferences: (message) => []
131
+ }
132
+ }),
133
+ (0, import_app_framework.contributes)(import_app_framework.Capabilities.Metadata, {
134
+ id: import_chunk_F735VMTN.THREAD_ITEM,
135
+ metadata: {
136
+ parse: (item, type) => {
137
+ switch (type) {
138
+ case "node":
640
139
  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
- }));
140
+ id: item.id,
141
+ label: item.title,
142
+ data: item
670
143
  };
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) {
144
+ case "object":
145
+ return item;
146
+ case "view-object":
942
147
  return {
943
- intents: [
944
- (0, import_app_framework.createIntent)(import_chunk_VW2P26MZ.ThreadAction.Delete, {
945
- subject,
946
- thread
947
- })
948
- ]
148
+ id: `${item.id}-view`,
149
+ object: item
949
150
  };
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
151
  }
993
- })
994
- ]
995
- },
996
- markdown: {
997
- extensions: ({ document: doc }) => {
998
- return threads(state, doc, intentPlugin?.provides.intent.dispatchPromise);
152
+ }
999
153
  }
154
+ })
155
+ ]
156
+ }),
157
+ (0, import_app_framework.defineModule)({
158
+ id: `${import_chunk_F735VMTN.meta.id}/module/schema`,
159
+ activatesOn: import_plugin_client.ClientEvents.SetupSchema,
160
+ activate: () => (0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.SystemSchema, [
161
+ import_types.ThreadType,
162
+ import_types.MessageType
163
+ ])
164
+ }),
165
+ (0, import_app_framework.defineModule)({
166
+ id: `${import_chunk_F735VMTN.meta.id}/module/channel-schema`,
167
+ activatesOn: (0, import_app_framework.allOf)(import_app_framework.Events.SettingsReady, import_plugin_client.ClientEvents.ClientReady),
168
+ activate: (context) => {
169
+ const client = context.requestCapability(import_plugin_client.ClientCapabilities.Client);
170
+ const settings = context.requestCapability(import_app_framework.Capabilities.SettingsStore).getStore(import_chunk_F735VMTN.THREAD_PLUGIN).value;
171
+ if (settings.standalone) {
172
+ client.addTypes([
173
+ import_types.ChannelType
174
+ ]);
175
+ return (0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.Schema, [
176
+ import_types.ChannelType
177
+ ]);
1000
178
  }
179
+ return [];
1001
180
  }
1002
- };
1003
- };
1004
- var src_default = ThreadPlugin;
181
+ }),
182
+ (0, import_app_framework.defineModule)({
183
+ id: `${import_chunk_F735VMTN.meta.id}/module/complementary-panel`,
184
+ activatesOn: import_app_framework.Events.Startup,
185
+ activate: () => (0, import_app_framework.contributes)(import_plugin_deck.DeckCapabilities.ComplementaryPanel, {
186
+ id: "comments",
187
+ label: [
188
+ "comments panel label",
189
+ {
190
+ ns: import_chunk_F735VMTN.THREAD_PLUGIN
191
+ }
192
+ ],
193
+ icon: "ph--chat-text--regular"
194
+ })
195
+ }),
196
+ (0, import_app_framework.defineModule)({
197
+ id: `${import_chunk_F735VMTN.meta.id}/module/markdown`,
198
+ activatesOn: import_app_framework.Events.Startup,
199
+ activate: import_chunk_S5LH7AIT.Markdown
200
+ }),
201
+ (0, import_app_framework.defineModule)({
202
+ id: `${import_chunk_F735VMTN.meta.id}/module/react-surface`,
203
+ activatesOn: import_app_framework.Events.SetupSurfaces,
204
+ activate: import_chunk_S5LH7AIT.ReactSurface
205
+ }),
206
+ (0, import_app_framework.defineModule)({
207
+ id: `${import_chunk_F735VMTN.meta.id}/module/intent-resolver`,
208
+ activatesOn: import_app_framework.Events.SetupIntents,
209
+ activate: import_chunk_S5LH7AIT.IntentResolver
210
+ }),
211
+ (0, import_app_framework.defineModule)({
212
+ id: `${import_chunk_F735VMTN.meta.id}/module/app-graph-builder`,
213
+ activatesOn: import_app_framework.Events.SetupAppGraph,
214
+ activate: import_chunk_S5LH7AIT.AppGraphBuilder
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