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

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 (182) hide show
  1. package/dist/lib/browser/ThreadContainer-4VLBSBI7.mjs +19 -0
  2. package/dist/lib/browser/ThreadContainer-4VLBSBI7.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-2B3EXYZ7.mjs +18 -0
  6. package/dist/lib/browser/chunk-2B3EXYZ7.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-ENERBDYI.mjs → chunk-636QDHE3.mjs} +3 -3
  8. package/dist/lib/browser/chunk-636QDHE3.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-GQONSZ3J.mjs} +19 -83
  12. package/dist/lib/browser/chunk-GQONSZ3J.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-PIEZ3LKQ.mjs +275 -0
  20. package/dist/lib/browser/intent-resolver-PIEZ3LKQ.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-CHCZO4TI.mjs +412 -0
  25. package/dist/lib/browser/react-surface-CHCZO4TI.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-VOYLV4UL.cjs} +14 -13
  32. package/dist/lib/node/ThreadContainer-VOYLV4UL.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-6PUGKCPR.cjs} +69 -135
  36. package/dist/lib/node/chunk-6PUGKCPR.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-ZRN7B26W.cjs} +26 -23
  46. package/dist/lib/node/chunk-ZRN7B26W.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-X5O3SVLF.cjs +287 -0
  50. package/dist/lib/node/intent-resolver-X5O3SVLF.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-LO7S2HPR.cjs +414 -0
  55. package/dist/lib/node/react-surface-LO7S2HPR.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-7DZY2MWA.mjs +20 -0
  63. package/dist/lib/node-esm/ThreadContainer-7DZY2MWA.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-RMYATBXM.mjs → chunk-B3CF35MY.mjs} +7 -3
  67. package/dist/lib/node-esm/chunk-B3CF35MY.mjs.map +7 -0
  68. package/dist/lib/node-esm/{chunk-AQ74G3GY.mjs → chunk-DYFIKKDT.mjs} +19 -83
  69. package/dist/lib/node-esm/chunk-DYFIKKDT.mjs.map +7 -0
  70. package/dist/lib/node-esm/{chunk-7QRGG25F.mjs → chunk-FXUATCLW.mjs} +3 -3
  71. package/dist/lib/node-esm/chunk-FXUATCLW.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-GS2OILYF.mjs +20 -0
  73. package/dist/lib/node-esm/chunk-GS2OILYF.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-XJWT5X6T.mjs +276 -0
  81. package/dist/lib/node-esm/intent-resolver-XJWT5X6T.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-LAF3QIPB.mjs +413 -0
  86. package/dist/lib/node-esm/react-surface-LAF3QIPB.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/index.d.ts +3 -15
  120. package/dist/types/src/components/index.d.ts.map +1 -1
  121. package/dist/types/src/components/types.d.ts +5 -5
  122. package/dist/types/src/components/types.d.ts.map +1 -1
  123. package/dist/types/src/index.d.ts +1 -3
  124. package/dist/types/src/index.d.ts.map +1 -1
  125. package/dist/types/src/meta.d.ts +1 -2
  126. package/dist/types/src/meta.d.ts.map +1 -1
  127. package/dist/types/src/translations.d.ts +3 -0
  128. package/dist/types/src/translations.d.ts.map +1 -1
  129. package/dist/types/src/types.d.ts +10 -14
  130. package/dist/types/src/types.d.ts.map +1 -1
  131. package/dist/types/tsconfig.tsbuildinfo +1 -1
  132. package/package.json +30 -38
  133. package/src/ThreadPlugin.tsx +105 -470
  134. package/src/capabilities/app-graph-builder.ts +120 -0
  135. package/src/capabilities/capabilities.ts +19 -0
  136. package/src/capabilities/index.ts +14 -0
  137. package/src/capabilities/intent-resolver.ts +223 -0
  138. package/src/capabilities/markdown.ts +18 -0
  139. package/src/capabilities/react-surface.tsx +61 -0
  140. package/src/capabilities/settings.ts +14 -0
  141. package/src/capabilities/state.ts +25 -0
  142. package/src/components/Chat.stories.tsx +25 -23
  143. package/src/components/CommentContainer.tsx +16 -30
  144. package/src/components/CommentsContainer.tsx +1 -17
  145. package/src/components/ThreadComplementary.tsx +82 -48
  146. package/src/components/ThreadContainer.tsx +22 -0
  147. package/src/components/index.ts +1 -2
  148. package/src/components/types.ts +5 -5
  149. package/src/index.ts +1 -5
  150. package/src/meta.ts +1 -1
  151. package/src/translations.ts +1 -0
  152. package/src/types.ts +10 -29
  153. package/dist/lib/browser/ThreadArticle-EWLTNU6Z.mjs +0 -18
  154. package/dist/lib/browser/ThreadArticle-EWLTNU6Z.mjs.map +0 -7
  155. package/dist/lib/browser/ThreadMain-ABEDFWHC.mjs +0 -26
  156. package/dist/lib/browser/ThreadMain-ABEDFWHC.mjs.map +0 -7
  157. package/dist/lib/browser/chunk-6KTMQPL4.mjs.map +0 -7
  158. package/dist/lib/browser/chunk-ENERBDYI.mjs.map +0 -7
  159. package/dist/lib/browser/chunk-OD2IZKRP.mjs.map +0 -7
  160. package/dist/lib/browser/meta.mjs +0 -11
  161. package/dist/lib/browser/meta.mjs.map +0 -7
  162. package/dist/lib/node/ThreadArticle-ZCNMFBAO.cjs.map +0 -7
  163. package/dist/lib/node/ThreadMain-5AYGCXXP.cjs.map +0 -7
  164. package/dist/lib/node/chunk-2CB5AVBL.cjs.map +0 -7
  165. package/dist/lib/node/chunk-IC2NICNC.cjs.map +0 -7
  166. package/dist/lib/node/chunk-VW2P26MZ.cjs.map +0 -7
  167. package/dist/lib/node/meta.cjs.map +0 -7
  168. package/dist/lib/node-esm/ThreadArticle-F37HYTOU.mjs +0 -19
  169. package/dist/lib/node-esm/ThreadArticle-F37HYTOU.mjs.map +0 -7
  170. package/dist/lib/node-esm/ThreadMain-OL6ZHNZY.mjs +0 -27
  171. package/dist/lib/node-esm/ThreadMain-OL6ZHNZY.mjs.map +0 -7
  172. package/dist/lib/node-esm/chunk-7QRGG25F.mjs.map +0 -7
  173. package/dist/lib/node-esm/chunk-AQ74G3GY.mjs.map +0 -7
  174. package/dist/lib/node-esm/chunk-RMYATBXM.mjs.map +0 -7
  175. package/dist/lib/node-esm/meta.mjs +0 -12
  176. package/dist/lib/node-esm/meta.mjs.map +0 -7
  177. package/dist/types/src/components/ThreadArticle.d.ts +0 -5
  178. package/dist/types/src/components/ThreadArticle.d.ts.map +0 -1
  179. package/dist/types/src/components/ThreadMain.d.ts +0 -7
  180. package/dist/types/src/components/ThreadMain.d.ts.map +0 -1
  181. package/src/components/ThreadArticle.tsx +0 -18
  182. package/src/components/ThreadMain.tsx +0 -27
@@ -0,0 +1,412 @@
1
+ import "./chunk-2B3EXYZ7.mjs";
2
+ import {
3
+ ThreadCapabilities
4
+ } from "./chunk-NAO3LZMZ.mjs";
5
+ import {
6
+ MessageContainer,
7
+ command,
8
+ getMessageMetadata
9
+ } from "./chunk-GQONSZ3J.mjs";
10
+ import {
11
+ useStatus
12
+ } from "./chunk-BNEWNQBO.mjs";
13
+ import {
14
+ ThreadAction
15
+ } from "./chunk-NO5AZLUZ.mjs";
16
+ import {
17
+ THREAD_PLUGIN
18
+ } from "./chunk-636QDHE3.mjs";
19
+
20
+ // packages/plugins/plugin-thread/src/capabilities/react-surface.tsx
21
+ import React5 from "react";
22
+ import { Capabilities, contributes, createSurface, isLayoutParts, useCapability as useCapability2 } from "@dxos/app-framework";
23
+ import { ChannelType } from "@dxos/plugin-space/types";
24
+ import { getSpace as getSpace2 } from "@dxos/react-client/echo";
25
+
26
+ // packages/plugins/plugin-thread/src/components/index.ts
27
+ import { lazy } from "react";
28
+
29
+ // packages/plugins/plugin-thread/src/components/CommentContainer.tsx
30
+ import { CheckCircle, X } from "@phosphor-icons/react";
31
+ import React, { useCallback, useMemo, useRef, useState } from "react";
32
+ import { RefArray } from "@dxos/live-object";
33
+ import { fullyQualifiedId, getSpace, useMembers } from "@dxos/react-client/echo";
34
+ import { useIdentity } from "@dxos/react-client/halo";
35
+ import { Button, Tag, Tooltip, useThemeContext, useTranslation } from "@dxos/react-ui";
36
+ import { createBasicExtensions, createThemeExtensions, listener } from "@dxos/react-ui-editor";
37
+ import { getSize, hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from "@dxos/react-ui-theme";
38
+ import { MessageTextbox, Thread, ThreadFooter, ThreadHeading } from "@dxos/react-ui-thread";
39
+ import { nonNullable } from "@dxos/util";
40
+ var sizeClass = getSize(4);
41
+ var commentControlClassNames = "!p-1 !min-bs-0 transition-opacity";
42
+ var ToggleResolvedButton = ({ isResolved, onResolve }) => {
43
+ const { t } = useTranslation(THREAD_PLUGIN);
44
+ const label = t(isResolved ? "mark as unresolved label" : "mark as resolved label");
45
+ return /* @__PURE__ */ React.createElement(Tooltip.Root, null, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
46
+ asChild: true
47
+ }, /* @__PURE__ */ React.createElement(Button, {
48
+ variant: "ghost",
49
+ "data-testid": "thread.toggle-resolved",
50
+ onClick: onResolve,
51
+ classNames: [
52
+ commentControlClassNames,
53
+ !isResolved && hoverableControlItem
54
+ ]
55
+ }, /* @__PURE__ */ React.createElement("span", {
56
+ className: "sr-only"
57
+ }, label), isResolved ? /* @__PURE__ */ React.createElement(CheckCircle, {
58
+ className: sizeClass,
59
+ weight: "fill"
60
+ }) : /* @__PURE__ */ React.createElement(CheckCircle, {
61
+ className: sizeClass
62
+ }))), /* @__PURE__ */ React.createElement(Tooltip.Portal, null, /* @__PURE__ */ React.createElement(Tooltip.Content, null, label, /* @__PURE__ */ React.createElement(Tooltip.Arrow, null))));
63
+ };
64
+ var DeleteThreadButton = ({ onDelete }) => {
65
+ const { t } = useTranslation(THREAD_PLUGIN);
66
+ const label = t("delete thread label");
67
+ return /* @__PURE__ */ React.createElement(Tooltip.Root, null, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
68
+ asChild: true
69
+ }, /* @__PURE__ */ React.createElement(Button, {
70
+ variant: "ghost",
71
+ "data-testid": "thread.delete",
72
+ onClick: onDelete,
73
+ classNames: [
74
+ commentControlClassNames,
75
+ hoverableControlItem
76
+ ]
77
+ }, /* @__PURE__ */ React.createElement("span", {
78
+ className: "sr-only"
79
+ }, label), /* @__PURE__ */ React.createElement(X, {
80
+ className: sizeClass
81
+ }))), /* @__PURE__ */ React.createElement(Tooltip.Portal, null, /* @__PURE__ */ React.createElement(Tooltip.Content, {
82
+ classNames: "z-30"
83
+ }, label, /* @__PURE__ */ React.createElement(Tooltip.Arrow, null))));
84
+ };
85
+ var CommentContainer = ({ thread, detached, current, onAttend, onComment, onResolve, onMessageDelete, onThreadDelete }) => {
86
+ const identity = useIdentity();
87
+ const space = getSpace(thread);
88
+ const members = useMembers(space?.key);
89
+ const activity = useStatus(space, fullyQualifiedId(thread));
90
+ const { t } = useTranslation(THREAD_PLUGIN);
91
+ const threadScrollRef = useRef(null);
92
+ const { themeMode } = useThemeContext();
93
+ const textboxMetadata = getMessageMetadata(fullyQualifiedId(thread), identity);
94
+ const [_count, _setCount] = useState(0);
95
+ const rerenderEditor = () => _setCount((count) => count + 1);
96
+ const messageRef = useRef("");
97
+ const extensions = useMemo(() => [
98
+ createBasicExtensions({
99
+ placeholder: t("message placeholder")
100
+ }),
101
+ createThemeExtensions({
102
+ themeMode
103
+ }),
104
+ listener({
105
+ onChange: (text) => messageRef.current = text
106
+ }),
107
+ command
108
+ ], [
109
+ _count
110
+ ]);
111
+ const scrollToEnd = (behavior) => setTimeout(() => threadScrollRef.current?.scrollIntoView({
112
+ behavior,
113
+ block: "end"
114
+ }), 10);
115
+ const handleAttend = useCallback(() => onAttend?.(thread), [
116
+ onAttend,
117
+ thread
118
+ ]);
119
+ const handleResolve = useCallback(() => onResolve?.(thread), [
120
+ onResolve,
121
+ thread
122
+ ]);
123
+ const handleMessageDelete = useCallback((id) => onMessageDelete?.(thread, id), [
124
+ onMessageDelete,
125
+ thread
126
+ ]);
127
+ const handleThreadDelete = useCallback(() => onThreadDelete?.(thread), [
128
+ onThreadDelete,
129
+ thread
130
+ ]);
131
+ const handleComment = useCallback(() => {
132
+ if (!messageRef.current) {
133
+ return false;
134
+ }
135
+ onComment?.(thread, messageRef.current);
136
+ messageRef.current = "";
137
+ scrollToEnd("instant");
138
+ rerenderEditor();
139
+ return true;
140
+ }, [
141
+ thread,
142
+ identity
143
+ ]);
144
+ return /* @__PURE__ */ React.createElement(Thread, {
145
+ onClickCapture: handleAttend,
146
+ onFocusCapture: handleAttend,
147
+ current,
148
+ id: fullyQualifiedId(thread)
149
+ }, /* @__PURE__ */ React.createElement("div", {
150
+ role: "none",
151
+ className: mx("col-span-2 grid grid-cols-[var(--rail-size)_1fr_min-content]", hoverableControls, hoverableFocusedWithinControls)
152
+ }, detached ? /* @__PURE__ */ React.createElement(Tooltip.Root, null, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
153
+ asChild: true
154
+ }, /* @__PURE__ */ React.createElement(ThreadHeading, {
155
+ detached: true
156
+ }, thread.name)), /* @__PURE__ */ React.createElement(Tooltip.Portal, null, /* @__PURE__ */ React.createElement(Tooltip.Content, {
157
+ classNames: "z-30",
158
+ side: "top"
159
+ }, t("detached thread label"), /* @__PURE__ */ React.createElement(Tooltip.Arrow, null)))) : /* @__PURE__ */ React.createElement(ThreadHeading, null, thread.name), /* @__PURE__ */ React.createElement("div", {
160
+ className: "flex flex-row items-center pli-1"
161
+ }, thread.status === "staged" && /* @__PURE__ */ React.createElement(Tag, {
162
+ palette: "neutral"
163
+ }, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */ React.createElement(ToggleResolvedButton, {
164
+ isResolved: thread?.status === "resolved",
165
+ onResolve: handleResolve
166
+ }), onThreadDelete && /* @__PURE__ */ React.createElement(DeleteThreadButton, {
167
+ onDelete: handleThreadDelete
168
+ }))), RefArray.allResolvedTargets(thread.messages?.filter(nonNullable) ?? []).map((message) => /* @__PURE__ */ React.createElement(MessageContainer, {
169
+ key: message.id,
170
+ message,
171
+ members,
172
+ onDelete: handleMessageDelete
173
+ })), /* @__PURE__ */ React.createElement(MessageTextbox, {
174
+ extensions,
175
+ onSend: handleComment,
176
+ ...textboxMetadata
177
+ }), /* @__PURE__ */ React.createElement(ThreadFooter, {
178
+ activity
179
+ }, t("activity message")), /* @__PURE__ */ React.createElement("div", {
180
+ role: "none",
181
+ className: "bs-px -mbs-px",
182
+ ref: threadScrollRef
183
+ }));
184
+ };
185
+
186
+ // packages/plugins/plugin-thread/src/components/CommentsContainer.tsx
187
+ import { ChatText } from "@phosphor-icons/react";
188
+ import React2, { useEffect } from "react";
189
+ import { fullyQualifiedId as fullyQualifiedId2 } from "@dxos/react-client/echo";
190
+ import { useTranslation as useTranslation2, Trans } from "@dxos/react-ui";
191
+ import { descriptionText, mx as mx2 } from "@dxos/react-ui-theme";
192
+ var CommentsContainer = ({ threads, detached = [], currentId, showResolvedThreads, ...props }) => {
193
+ const { t } = useTranslation2(THREAD_PLUGIN);
194
+ const filteredThreads = showResolvedThreads ? threads : threads.filter((thread) => !(thread?.status === "resolved"));
195
+ useEffect(() => {
196
+ if (currentId) {
197
+ document.getElementById(currentId)?.scrollIntoView({
198
+ behavior: "smooth",
199
+ block: "end"
200
+ });
201
+ }
202
+ }, [
203
+ currentId
204
+ ]);
205
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, filteredThreads.length > 0 ? filteredThreads.map((thread) => {
206
+ const threadId = fullyQualifiedId2(thread);
207
+ return /* @__PURE__ */ React2.createElement(CommentContainer, {
208
+ key: threadId,
209
+ thread,
210
+ current: currentId === threadId,
211
+ detached: detached.includes(threadId),
212
+ ...props
213
+ });
214
+ }) : /* @__PURE__ */ React2.createElement("div", {
215
+ role: "alert",
216
+ className: mx2(descriptionText, "place-self-center border border-dashed border-unAccent rounded-lg text-center p-4 m-4")
217
+ }, /* @__PURE__ */ React2.createElement("h2", {
218
+ className: "mbe-2 font-medium text-baseText"
219
+ }, t("no comments title")), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement(Trans, {
220
+ t,
221
+ i18nKey: "no comments message",
222
+ components: {
223
+ commentIcon: /* @__PURE__ */ React2.createElement(ChatText, {
224
+ className: "inline-block"
225
+ })
226
+ }
227
+ }))));
228
+ };
229
+
230
+ // packages/plugins/plugin-thread/src/components/ThreadComplementary.tsx
231
+ import React3, { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2 } from "react";
232
+ import { createIntent, LayoutAction, useCapabilities, useCapability, useIntentDispatcher } from "@dxos/app-framework";
233
+ import { ThreadCapabilities as ThreadCapabilities2 } from "@dxos/plugin-space";
234
+ import { MessageType } from "@dxos/plugin-space/types";
235
+ import { create, fullyQualifiedId as fullyQualifiedId3, makeRef, RefArray as RefArray2 } from "@dxos/react-client/echo";
236
+ import { useIdentity as useIdentity2 } from "@dxos/react-client/halo";
237
+ import { useAttended } from "@dxos/react-ui-attention";
238
+ import { nonNullable as nonNullable2 } from "@dxos/util";
239
+ var ThreadComplementary = ({ subject }) => {
240
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
241
+ const identity = useIdentity2();
242
+ const { state, getViewState } = useCapability(ThreadCapabilities.MutableState);
243
+ const { showResolvedThreads } = getViewState(fullyQualifiedId3(subject));
244
+ const drafts = state.drafts[fullyQualifiedId3(subject)];
245
+ const threadsIntegrators = useCapabilities(ThreadCapabilities2.Thread);
246
+ const createSort = useMemo2(() => threadsIntegrators.find((p) => p.predicate(subject))?.createSort, [
247
+ threadsIntegrators,
248
+ subject
249
+ ]);
250
+ const sort = useMemo2(() => createSort?.(subject), [
251
+ createSort,
252
+ subject
253
+ ]);
254
+ const threadObjects = RefArray2.allResolvedTargets(subject.threads ?? []);
255
+ const threads = useMemo2(() => {
256
+ return threadObjects.concat(drafts ?? []).filter(nonNullable2);
257
+ }, [
258
+ JSON.stringify(threadObjects),
259
+ JSON.stringify(drafts)
260
+ ]);
261
+ const detachedIds = useMemo2(() => {
262
+ return threads.filter(({ anchor }) => !anchor).map((thread) => fullyQualifiedId3(thread));
263
+ }, [
264
+ threads
265
+ ]);
266
+ useEffect2(() => {
267
+ if (!sort) {
268
+ return;
269
+ }
270
+ threads.sort((a, b) => sort(a?.anchor, b?.anchor));
271
+ }, [
272
+ sort,
273
+ threads
274
+ ]);
275
+ const attended = useAttended();
276
+ const qualifiedSubjectId = fullyQualifiedId3(subject);
277
+ const handleAttend = useCallback2((thread) => {
278
+ const threadId = fullyQualifiedId3(thread);
279
+ if (state.current !== threadId) {
280
+ state.current = threadId;
281
+ void dispatch(createIntent(LayoutAction.ScrollIntoView, {
282
+ id: fullyQualifiedId3(subject),
283
+ cursor: thread.anchor,
284
+ ref: threadId
285
+ }));
286
+ }
287
+ }, [
288
+ state.current,
289
+ dispatch,
290
+ subject
291
+ ]);
292
+ const handleComment = useCallback2(async (thread, message) => {
293
+ thread.messages.push(makeRef(create(MessageType, {
294
+ sender: {
295
+ identityKey: identity?.identityKey.toHex()
296
+ },
297
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
298
+ text: message
299
+ })));
300
+ await dispatch(createIntent(ThreadAction.OnMessageAdd, {
301
+ thread,
302
+ subject
303
+ }));
304
+ state.current = fullyQualifiedId3(thread);
305
+ }, [
306
+ dispatch,
307
+ identity,
308
+ subject
309
+ ]);
310
+ const handleResolve = useCallback2((thread) => dispatch(createIntent(ThreadAction.ToggleResolved, {
311
+ thread
312
+ })), [
313
+ dispatch
314
+ ]);
315
+ const handleThreadDelete = useCallback2((thread) => dispatch(createIntent(ThreadAction.Delete, {
316
+ thread,
317
+ subject
318
+ })), [
319
+ dispatch,
320
+ subject
321
+ ]);
322
+ const handleMessageDelete = useCallback2((thread, messageId) => dispatch(createIntent(ThreadAction.DeleteMessage, {
323
+ thread,
324
+ subject,
325
+ messageId
326
+ })), [
327
+ dispatch,
328
+ subject
329
+ ]);
330
+ return /* @__PURE__ */ React3.createElement(CommentsContainer, {
331
+ threads,
332
+ detached: detachedIds,
333
+ currentId: attended.includes(qualifiedSubjectId) ? state.current : void 0,
334
+ showResolvedThreads,
335
+ onAttend: handleAttend,
336
+ onComment: handleComment,
337
+ onResolve: handleResolve,
338
+ onMessageDelete: handleMessageDelete,
339
+ onThreadDelete: handleThreadDelete
340
+ });
341
+ };
342
+
343
+ // packages/plugins/plugin-thread/src/components/ThreadSettings.tsx
344
+ import React4 from "react";
345
+ import { Input, useTranslation as useTranslation3 } from "@dxos/react-ui";
346
+ import { DeprecatedFormInput } from "@dxos/react-ui-form";
347
+ var ThreadSettings = ({ settings }) => {
348
+ const { t } = useTranslation3(THREAD_PLUGIN);
349
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(DeprecatedFormInput, {
350
+ label: t("settings standalone label")
351
+ }, /* @__PURE__ */ React4.createElement(Input.Switch, {
352
+ checked: settings.standalone,
353
+ onCheckedChange: (checked) => settings.standalone = !!checked
354
+ })));
355
+ };
356
+
357
+ // packages/plugins/plugin-thread/src/components/index.ts
358
+ var ThreadContainer = lazy(() => import("./ThreadContainer-4VLBSBI7.mjs"));
359
+
360
+ // packages/plugins/plugin-thread/src/capabilities/react-surface.tsx
361
+ var react_surface_default = () => contributes(Capabilities.ReactSurface, [
362
+ createSurface({
363
+ id: `${THREAD_PLUGIN}/channel`,
364
+ role: "article",
365
+ filter: (data) => data.subject instanceof ChannelType && !!data.subject.threads[0],
366
+ component: ({ data, role }) => {
367
+ const location = useCapability2(Capabilities.Location);
368
+ const channel = data.subject;
369
+ const thread = channel.threads[0].target;
370
+ if (isLayoutParts(location?.active) && location.active.main) {
371
+ const layoutEntries = location.active.main;
372
+ const currentPosition = layoutEntries.findIndex((entry) => channel.id === entry.id);
373
+ if (currentPosition > 0) {
374
+ const objectToTheLeft = layoutEntries[currentPosition - 1];
375
+ const context = getSpace2(channel)?.db.getObjectById(objectToTheLeft.id);
376
+ return /* @__PURE__ */ React5.createElement(ThreadContainer, {
377
+ role,
378
+ thread,
379
+ context
380
+ });
381
+ }
382
+ }
383
+ return /* @__PURE__ */ React5.createElement(ThreadContainer, {
384
+ role,
385
+ thread
386
+ });
387
+ }
388
+ }),
389
+ createSurface({
390
+ id: `${THREAD_PLUGIN}/thread`,
391
+ role: "complementary--comments",
392
+ filter: (data) => !!data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads) && !(data.subject instanceof ChannelType),
393
+ component: ({ data }) => /* @__PURE__ */ React5.createElement(ThreadComplementary, {
394
+ subject: data.subject
395
+ })
396
+ }),
397
+ createSurface({
398
+ id: `${THREAD_PLUGIN}/settings`,
399
+ role: "settings",
400
+ filter: (data) => data.subject === THREAD_PLUGIN,
401
+ component: () => {
402
+ const settings = useCapability2(Capabilities.SettingsStore).getStore(THREAD_PLUGIN).value;
403
+ return /* @__PURE__ */ React5.createElement(ThreadSettings, {
404
+ settings
405
+ });
406
+ }
407
+ })
408
+ ]);
409
+ export {
410
+ react_surface_default as default
411
+ };
412
+ //# sourceMappingURL=react-surface-CHCZO4TI.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/index.ts", "../../../src/components/CommentContainer.tsx", "../../../src/components/CommentsContainer.tsx", "../../../src/components/ThreadComplementary.tsx", "../../../src/components/ThreadSettings.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface, isLayoutParts, useCapability } from '@dxos/app-framework';\nimport { type Ref } from '@dxos/echo-schema';\nimport { ChannelType, type ThreadType } from '@dxos/plugin-space/types';\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { ThreadContainer, ThreadComplementary, ThreadSettings } from '../components';\nimport { THREAD_PLUGIN } from '../meta';\nimport { type ThreadSettingsProps } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${THREAD_PLUGIN}/channel`,\n role: 'article',\n filter: (data): data is { subject: ChannelType } =>\n data.subject instanceof ChannelType && !!data.subject.threads[0],\n component: ({ data, role }) => {\n const location = useCapability(Capabilities.Location);\n const channel = data.subject;\n const thread = channel.threads[0].target!;\n // TODO(zan): Maybe we should have utility for positional main object ids.\n if (isLayoutParts(location?.active) && location.active.main) {\n const layoutEntries = location.active.main;\n const currentPosition = layoutEntries.findIndex((entry) => channel.id === entry.id);\n if (currentPosition > 0) {\n const objectToTheLeft = layoutEntries[currentPosition - 1];\n const context = getSpace(channel)?.db.getObjectById(objectToTheLeft.id);\n return <ThreadContainer role={role} thread={thread} context={context} />;\n }\n }\n\n return <ThreadContainer role={role} thread={thread} />;\n },\n }),\n createSurface({\n id: `${THREAD_PLUGIN}/thread`,\n role: 'complementary--comments',\n filter: (data): data is { subject: { threads: Ref<ThreadType>[] } } =>\n !!data.subject &&\n typeof data.subject === 'object' &&\n 'threads' in data.subject &&\n Array.isArray(data.subject.threads) &&\n !(data.subject instanceof ChannelType),\n component: ({ data }) => <ThreadComplementary subject={data.subject} />,\n }),\n createSurface({\n id: `${THREAD_PLUGIN}/settings`,\n role: 'settings',\n filter: (data): data is any => data.subject === THREAD_PLUGIN,\n component: () => {\n const settings = useCapability(Capabilities.SettingsStore).getStore<ThreadSettingsProps>(THREAD_PLUGIN)!.value;\n return <ThreadSettings settings={settings} />;\n },\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport const ThreadContainer = lazy(() => import('./ThreadContainer'));\n\n// TODO(wittjosiah): Suspense boundary for sidebar?\nexport * from './CommentContainer';\nexport * from './CommentsContainer';\nexport * from './ChatContainer';\nexport * from './MessageContainer';\nexport * from './ThreadComplementary';\nexport * from './ThreadSettings';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CheckCircle, X } from '@phosphor-icons/react';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { RefArray } from '@dxos/live-object';\nimport { fullyQualifiedId, getSpace, useMembers } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { Button, Tag, Tooltip, useThemeContext, useTranslation } from '@dxos/react-ui';\nimport { createBasicExtensions, createThemeExtensions, listener } from '@dxos/react-ui-editor';\nimport {\n getSize,\n hoverableControlItem,\n hoverableControls,\n hoverableFocusedWithinControls,\n mx,\n} from '@dxos/react-ui-theme';\nimport { MessageTextbox, type MessageTextboxProps, Thread, ThreadFooter, ThreadHeading } from '@dxos/react-ui-thread';\nimport { nonNullable } from '@dxos/util';\n\nimport { MessageContainer } from './MessageContainer';\nimport { command } from './command-extension';\nimport { type ThreadContainerProps } from './types';\nimport { useStatus } from '../hooks';\nimport { THREAD_PLUGIN } from '../meta';\nimport { getMessageMetadata } from '../util';\n\nconst sizeClass = getSize(4);\n\n// TODO(thure): #8149\nconst commentControlClassNames = '!p-1 !min-bs-0 transition-opacity';\n\nconst ToggleResolvedButton = ({\n isResolved,\n onResolve,\n}: {\n isResolved: boolean | undefined;\n onResolve: () => void;\n}) => {\n const { t } = useTranslation(THREAD_PLUGIN);\n const label = t(isResolved ? 'mark as unresolved label' : 'mark as resolved label');\n return (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Button\n variant='ghost'\n data-testid='thread.toggle-resolved'\n onClick={onResolve}\n classNames={[commentControlClassNames, !isResolved && hoverableControlItem]}\n >\n <span className='sr-only'>{label}</span>\n {isResolved ? <CheckCircle className={sizeClass} weight='fill' /> : <CheckCircle className={sizeClass} />}\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n {label}\n <Tooltip.Arrow />\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n );\n};\n\nconst DeleteThreadButton = ({ onDelete }: { onDelete: () => void }) => {\n const { t } = useTranslation(THREAD_PLUGIN);\n const label = t('delete thread label');\n return (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Button\n variant='ghost'\n data-testid='thread.delete'\n onClick={onDelete}\n classNames={[commentControlClassNames, hoverableControlItem]}\n >\n <span className='sr-only'>{label}</span>\n <X className={sizeClass} />\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content classNames='z-30'>\n {label}\n <Tooltip.Arrow />\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n );\n};\n\nexport const CommentContainer = ({\n thread,\n detached,\n current,\n onAttend,\n onComment,\n onResolve,\n onMessageDelete,\n onThreadDelete,\n}: ThreadContainerProps) => {\n const identity = useIdentity()!;\n const space = getSpace(thread);\n const members = useMembers(space?.key);\n const activity = useStatus(space, fullyQualifiedId(thread));\n const { t } = useTranslation(THREAD_PLUGIN);\n const threadScrollRef = useRef<HTMLDivElement | null>(null);\n const { themeMode } = useThemeContext();\n\n const textboxMetadata = getMessageMetadata(fullyQualifiedId(thread), identity);\n // TODO(wittjosiah): This is a hack to reset the editor after a message is sent.\n const [_count, _setCount] = useState(0);\n const rerenderEditor = () => _setCount((count) => count + 1);\n const messageRef = useRef('');\n const extensions = useMemo(\n () => [\n createBasicExtensions({ placeholder: t('message placeholder') }),\n createThemeExtensions({ themeMode }),\n listener({ onChange: (text) => (messageRef.current = text) }),\n command,\n ],\n [_count],\n );\n\n // TODO(thure): Factor out.\n const scrollToEnd = (behavior: ScrollBehavior) =>\n setTimeout(() => threadScrollRef.current?.scrollIntoView({ behavior, block: 'end' }), 10);\n\n const handleAttend = useCallback(() => onAttend?.(thread), [onAttend, thread]);\n const handleResolve = useCallback(() => onResolve?.(thread), [onResolve, thread]);\n const handleMessageDelete = useCallback((id: string) => onMessageDelete?.(thread, id), [onMessageDelete, thread]);\n const handleThreadDelete = useCallback(() => onThreadDelete?.(thread), [onThreadDelete, thread]);\n\n const handleComment: MessageTextboxProps['onSend'] = useCallback(() => {\n if (!messageRef.current) {\n return false;\n }\n\n onComment?.(thread, messageRef.current);\n messageRef.current = '';\n scrollToEnd('instant');\n rerenderEditor();\n\n return true;\n }, [thread, identity]);\n\n return (\n <Thread onClickCapture={handleAttend} onFocusCapture={handleAttend} current={current} id={fullyQualifiedId(thread)}>\n <div\n role='none'\n className={mx(\n 'col-span-2 grid grid-cols-[var(--rail-size)_1fr_min-content]',\n hoverableControls,\n hoverableFocusedWithinControls,\n )}\n >\n {detached ? (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <ThreadHeading detached>{thread.name}</ThreadHeading>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content classNames='z-30' side='top'>\n {t('detached thread label')}\n <Tooltip.Arrow />\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n ) : (\n <ThreadHeading>{thread.name}</ThreadHeading>\n )}\n <div className='flex flex-row items-center pli-1'>\n {thread.status === 'staged' && <Tag palette='neutral'>{t('draft button')}</Tag>}\n {onResolve && !(thread?.status === 'staged') && (\n <ToggleResolvedButton isResolved={thread?.status === 'resolved'} onResolve={handleResolve} />\n )}\n {onThreadDelete && <DeleteThreadButton onDelete={handleThreadDelete} />}\n </div>\n </div>\n {/** TODO(dmaretskyi): How's `thread.messages` undefined? */}\n {RefArray.allResolvedTargets(thread.messages?.filter(nonNullable) ?? []).map((message) => (\n <MessageContainer key={message.id} message={message} members={members} onDelete={handleMessageDelete} />\n ))}\n {/*\n TODO(wittjosiah): Can't autofocus this generally.\n There can be multiple threads with inputs and they can't all be focused.\n Also, it steals focus from documents when first rendered.\n Need to find a way to autofocus in one scenario only: when a new thread is created.\n */}\n <MessageTextbox extensions={extensions} onSend={handleComment} {...textboxMetadata} />\n <ThreadFooter activity={activity}>{t('activity message')}</ThreadFooter>\n {/* NOTE(thure): This can’t also be the `overflow-anchor` because `ScrollArea` injects an interceding node that contains this necessary ref’d element. */}\n <div role='none' className='bs-px -mbs-px' ref={threadScrollRef} />\n </Thread>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { ChatText } from '@phosphor-icons/react';\nimport React, { useEffect } from 'react';\n\nimport { type ThreadType } from '@dxos/plugin-space/types';\nimport { fullyQualifiedId } from '@dxos/react-client/echo';\nimport { useTranslation, Trans } from '@dxos/react-ui';\nimport { descriptionText, mx } from '@dxos/react-ui-theme';\n\nimport { CommentContainer } from './CommentContainer';\nimport { type ThreadContainerProps } from './types';\nimport { THREAD_PLUGIN } from '../meta';\n\nexport type ThreadsContainerProps = Omit<ThreadContainerProps, 'thread' | 'detached' | 'current' | 'autoFocus'> & {\n threads: ThreadType[];\n /**\n * Threads that are no longer anchored to a position in the object.\n */\n detached?: string[];\n currentId?: string;\n showResolvedThreads?: boolean;\n};\n\n/**\n * Comment threads.\n */\nexport const CommentsContainer = ({\n threads,\n detached = [],\n currentId,\n showResolvedThreads,\n ...props\n}: ThreadsContainerProps) => {\n const { t } = useTranslation(THREAD_PLUGIN);\n const filteredThreads = showResolvedThreads ? threads : threads.filter((thread) => !(thread?.status === 'resolved'));\n\n useEffect(() => {\n if (currentId) {\n document.getElementById(currentId)?.scrollIntoView({ behavior: 'smooth', block: 'end' });\n }\n }, [currentId]);\n\n return (\n <>\n {filteredThreads.length > 0 ? (\n filteredThreads.map((thread) => {\n const threadId = fullyQualifiedId(thread);\n return (\n <CommentContainer\n key={threadId}\n thread={thread}\n current={currentId === threadId}\n detached={detached.includes(threadId)}\n {...props}\n />\n );\n })\n ) : (\n <div\n role='alert'\n className={mx(\n descriptionText,\n 'place-self-center border border-dashed border-unAccent rounded-lg text-center p-4 m-4',\n )}\n >\n <h2 className='mbe-2 font-medium text-baseText'>{t('no comments title')}</h2>\n <p>\n <Trans\n {...{\n t,\n i18nKey: 'no comments message',\n components: {\n commentIcon: <ChatText className='inline-block' />,\n },\n }}\n />\n </p>\n </div>\n )}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo } from 'react';\n\nimport { createIntent, LayoutAction, useCapabilities, useCapability, useIntentDispatcher } from '@dxos/app-framework';\nimport { ThreadCapabilities } from '@dxos/plugin-space';\nimport { MessageType, type ThreadType } from '@dxos/plugin-space/types';\nimport { create, fullyQualifiedId, makeRef, RefArray } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { useAttended } from '@dxos/react-ui-attention';\nimport { nonNullable } from '@dxos/util';\n\nimport { ThreadCapabilities as LocalThreadCapabilities } from '../capabilities';\nimport { CommentsContainer } from '../components';\nimport { ThreadAction } from '../types';\n\nexport const ThreadComplementary = ({ subject }: { subject: any }) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const identity = useIdentity();\n\n const { state, getViewState } = useCapability(LocalThreadCapabilities.MutableState);\n const { showResolvedThreads } = getViewState(fullyQualifiedId(subject));\n const drafts = state.drafts[fullyQualifiedId(subject)];\n\n const threadsIntegrators = useCapabilities(ThreadCapabilities.Thread);\n const createSort = useMemo(\n () => threadsIntegrators.find((p) => p.predicate(subject))?.createSort,\n [threadsIntegrators, subject],\n );\n const sort = useMemo(() => createSort?.(subject), [createSort, subject]);\n\n const threadObjects = RefArray.allResolvedTargets(subject.threads ?? []);\n\n const threads = useMemo(() => {\n return threadObjects.concat(drafts ?? []).filter(nonNullable) as ThreadType[];\n }, [JSON.stringify(threadObjects), JSON.stringify(drafts)]);\n\n const detachedIds = useMemo(() => {\n return threads.filter(({ anchor }) => !anchor).map((thread) => fullyQualifiedId(thread));\n }, [threads]);\n\n useEffect(() => {\n if (!sort) {\n return;\n }\n threads.sort((a, b) => sort(a?.anchor, b?.anchor));\n }, [sort, threads]);\n\n const attended = useAttended();\n const qualifiedSubjectId = fullyQualifiedId(subject);\n\n const handleAttend = useCallback(\n (thread: ThreadType) => {\n const threadId = fullyQualifiedId(thread);\n if (state.current !== threadId) {\n state.current = threadId;\n\n // TODO(wittjosiah): Should this be a thread-specific intent?\n // The layout doesn't know about threads and this working depends on other plugins conditionally handling it.\n // This may be overloading this intent or highjacking its intended purpose.\n void dispatch(\n createIntent(LayoutAction.ScrollIntoView, {\n id: fullyQualifiedId(subject),\n cursor: thread.anchor,\n ref: threadId,\n }),\n );\n }\n },\n [state.current, dispatch, subject],\n );\n\n const handleComment = useCallback(\n async (thread: ThreadType, message: string) => {\n thread.messages.push(\n makeRef(\n create(MessageType, {\n sender: { identityKey: identity?.identityKey.toHex() },\n timestamp: new Date().toISOString(),\n text: message,\n // TODO(wittjosiah): Context based on attention.\n // context: context ? makeRef(context) : undefined,\n }),\n ),\n );\n\n await dispatch(createIntent(ThreadAction.OnMessageAdd, { thread, subject }));\n\n state.current = fullyQualifiedId(thread);\n },\n [dispatch, identity, subject],\n );\n\n const handleResolve = useCallback(\n (thread: ThreadType) => dispatch(createIntent(ThreadAction.ToggleResolved, { thread })),\n [dispatch],\n );\n\n const handleThreadDelete = useCallback(\n (thread: ThreadType) => dispatch(createIntent(ThreadAction.Delete, { thread, subject })),\n [dispatch, subject],\n );\n\n const handleMessageDelete = useCallback(\n (thread: ThreadType, messageId: string) =>\n dispatch(createIntent(ThreadAction.DeleteMessage, { thread, subject, messageId })),\n [dispatch, subject],\n );\n\n return (\n <CommentsContainer\n threads={threads}\n detached={detachedIds}\n currentId={attended.includes(qualifiedSubjectId) ? state.current : undefined}\n showResolvedThreads={showResolvedThreads}\n onAttend={handleAttend}\n onComment={handleComment}\n onResolve={handleResolve}\n onMessageDelete={handleMessageDelete}\n onThreadDelete={handleThreadDelete}\n />\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { DeprecatedFormInput } from '@dxos/react-ui-form';\n\nimport { THREAD_PLUGIN } from '../meta';\nimport type { ThreadSettingsProps } from '../types';\n\nexport const ThreadSettings = ({ settings }: { settings: ThreadSettingsProps }) => {\n const { t } = useTranslation(THREAD_PLUGIN);\n\n return (\n <>\n <DeprecatedFormInput label={t('settings standalone label')}>\n <Input.Switch checked={settings.standalone} onCheckedChange={(checked) => (settings.standalone = !!checked)} />\n </DeprecatedFormInput>\n </>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,cAAcC,aAAaC,eAAeC,eAAeC,iBAAAA,sBAAqB;AAEvF,SAASC,mBAAoC;AAC7C,SAASC,YAAAA,iBAAgB;;;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AA;EACAd,cAAc;IACZC,IAAI,GAAGC,aAAAA;IACPC,MAAM;IACNC,QAAQ,CAACC,SACP,CAAC,CAACA,KAAKC,WACP,OAAOD,KAAKC,YAAY,YACxB,aAAaD,KAAKC,WAClBwB,MAAMC,QAAQ1B,KAAKC,QAAQE,OAAO,KAClC,EAAEH,KAAKC,mBAAmBC;IAC5BE,WAAW,CAAC,EAAEJ,KAAI,MAAO,gBAAAuB,OAAA,cAACI,qBAAAA;MAAoB1B,SAASD,KAAKC;;EAC9D,CAAA;EACAN,cAAc;IACZC,IAAI,GAAGC,aAAAA;IACPC,MAAM;IACNC,QAAQ,CAACC,SAAsBA,KAAKC,YAAYJ;IAChDO,WAAW,MAAA;AACT,YAAMwB,WAAWtB,eAAcb,aAAaoC,aAAa,EAAEC,SAA8BjC,aAAAA,EAAgBkC;AACzG,aAAO,gBAAAR,OAAA,cAACS,gBAAAA;QAAeJ;;IACzB;EACF,CAAA;CACD;",
6
+ "names": ["React", "Capabilities", "contributes", "createSurface", "isLayoutParts", "useCapability", "ChannelType", "getSpace", "lazy", "CheckCircle", "X", "React", "useCallback", "useMemo", "useRef", "useState", "RefArray", "fullyQualifiedId", "getSpace", "useMembers", "useIdentity", "Button", "Tag", "Tooltip", "useThemeContext", "useTranslation", "createBasicExtensions", "createThemeExtensions", "listener", "getSize", "hoverableControlItem", "hoverableControls", "hoverableFocusedWithinControls", "mx", "MessageTextbox", "Thread", "ThreadFooter", "ThreadHeading", "nonNullable", "sizeClass", "getSize", "commentControlClassNames", "ToggleResolvedButton", "isResolved", "onResolve", "t", "useTranslation", "THREAD_PLUGIN", "label", "Tooltip", "Root", "Trigger", "asChild", "Button", "variant", "data-testid", "onClick", "classNames", "hoverableControlItem", "span", "className", "CheckCircle", "weight", "Portal", "Content", "Arrow", "DeleteThreadButton", "onDelete", "X", "CommentContainer", "thread", "detached", "current", "onAttend", "onComment", "onMessageDelete", "onThreadDelete", "identity", "useIdentity", "space", "getSpace", "members", "useMembers", "key", "activity", "useStatus", "fullyQualifiedId", "threadScrollRef", "useRef", "themeMode", "useThemeContext", "textboxMetadata", "getMessageMetadata", "_count", "_setCount", "useState", "rerenderEditor", "count", "messageRef", "extensions", "useMemo", "createBasicExtensions", "placeholder", "createThemeExtensions", "listener", "onChange", "text", "command", "scrollToEnd", "behavior", "setTimeout", "scrollIntoView", "block", "handleAttend", "useCallback", "handleResolve", "handleMessageDelete", "id", "handleThreadDelete", "handleComment", "Thread", "onClickCapture", "onFocusCapture", "div", "role", "mx", "hoverableControls", "hoverableFocusedWithinControls", "ThreadHeading", "name", "side", "status", "Tag", "palette", "RefArray", "allResolvedTargets", "messages", "filter", "nonNullable", "map", "message", "MessageContainer", "MessageTextbox", "onSend", "ThreadFooter", "ref", "ChatText", "React", "useEffect", "fullyQualifiedId", "useTranslation", "Trans", "descriptionText", "mx", "CommentsContainer", "threads", "detached", "currentId", "showResolvedThreads", "props", "t", "useTranslation", "THREAD_PLUGIN", "filteredThreads", "filter", "thread", "status", "useEffect", "document", "getElementById", "scrollIntoView", "behavior", "block", "React", "length", "map", "threadId", "fullyQualifiedId", "CommentContainer", "key", "current", "includes", "div", "role", "className", "mx", "descriptionText", "h2", "p", "Trans", "i18nKey", "components", "commentIcon", "ChatText", "React", "useCallback", "useEffect", "useMemo", "createIntent", "LayoutAction", "useCapabilities", "useCapability", "useIntentDispatcher", "ThreadCapabilities", "MessageType", "create", "fullyQualifiedId", "makeRef", "RefArray", "useIdentity", "useAttended", "nonNullable", "ThreadComplementary", "subject", "dispatchPromise", "dispatch", "useIntentDispatcher", "identity", "useIdentity", "state", "getViewState", "useCapability", "LocalThreadCapabilities", "MutableState", "showResolvedThreads", "fullyQualifiedId", "drafts", "threadsIntegrators", "useCapabilities", "ThreadCapabilities", "Thread", "createSort", "useMemo", "find", "p", "predicate", "sort", "threadObjects", "RefArray", "allResolvedTargets", "threads", "concat", "filter", "nonNullable", "JSON", "stringify", "detachedIds", "anchor", "map", "thread", "useEffect", "a", "b", "attended", "useAttended", "qualifiedSubjectId", "handleAttend", "useCallback", "threadId", "current", "createIntent", "LayoutAction", "ScrollIntoView", "id", "cursor", "ref", "handleComment", "message", "messages", "push", "makeRef", "create", "MessageType", "sender", "identityKey", "toHex", "timestamp", "Date", "toISOString", "text", "ThreadAction", "OnMessageAdd", "handleResolve", "ToggleResolved", "handleThreadDelete", "Delete", "handleMessageDelete", "messageId", "DeleteMessage", "React", "CommentsContainer", "detached", "currentId", "includes", "undefined", "onAttend", "onComment", "onResolve", "onMessageDelete", "onThreadDelete", "React", "Input", "useTranslation", "DeprecatedFormInput", "ThreadSettings", "settings", "t", "useTranslation", "THREAD_PLUGIN", "React", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "standalone", "onCheckedChange", "ThreadContainer", "lazy", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "THREAD_PLUGIN", "role", "filter", "data", "subject", "ChannelType", "threads", "component", "location", "useCapability", "Location", "channel", "thread", "target", "isLayoutParts", "active", "main", "layoutEntries", "currentPosition", "findIndex", "entry", "objectToTheLeft", "context", "getSpace", "db", "getObjectById", "React", "ThreadContainer", "Array", "isArray", "ThreadComplementary", "settings", "SettingsStore", "getStore", "value", "ThreadSettings"]
7
+ }
@@ -0,0 +1,22 @@
1
+ import {
2
+ ThreadSettingsSchema
3
+ } from "./chunk-NO5AZLUZ.mjs";
4
+ import {
5
+ THREAD_PLUGIN
6
+ } from "./chunk-636QDHE3.mjs";
7
+
8
+ // packages/plugins/plugin-thread/src/capabilities/settings.ts
9
+ import { Capabilities, contributes } from "@dxos/app-framework";
10
+ import { create } from "@dxos/live-object";
11
+ var settings_default = () => {
12
+ const settings = create({});
13
+ return contributes(Capabilities.Settings, {
14
+ schema: ThreadSettingsSchema,
15
+ prefix: THREAD_PLUGIN,
16
+ value: settings
17
+ });
18
+ };
19
+ export {
20
+ settings_default as default
21
+ };
22
+ //# sourceMappingURL=settings-TKOPRXSU.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/settings.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes } from '@dxos/app-framework';\nimport { create } from '@dxos/live-object';\n\nimport { THREAD_PLUGIN } from '../meta';\nimport { type ThreadSettingsProps, ThreadSettingsSchema } from '../types';\n\nexport default () => {\n const settings = create<ThreadSettingsProps>({});\n return contributes(Capabilities.Settings, { schema: ThreadSettingsSchema, prefix: THREAD_PLUGIN, value: settings });\n};\n"],
5
+ "mappings": ";;;;;;;;AAIA,SAASA,cAAcC,mBAAmB;AAC1C,SAASC,cAAc;AAKvB,IAAA,mBAAe,MAAA;AACb,QAAMC,WAAWC,OAA4B,CAAC,CAAA;AAC9C,SAAOC,YAAYC,aAAaC,UAAU;IAAEC,QAAQC;IAAsBC,QAAQC;IAAeC,OAAOT;EAAS,CAAA;AACnH;",
6
+ "names": ["Capabilities", "contributes", "create", "settings", "create", "contributes", "Capabilities", "Settings", "schema", "ThreadSettingsSchema", "prefix", "THREAD_PLUGIN", "value"]
7
+ }
@@ -0,0 +1,33 @@
1
+ import {
2
+ ThreadCapabilities
3
+ } from "./chunk-NAO3LZMZ.mjs";
4
+ import "./chunk-636QDHE3.mjs";
5
+
6
+ // packages/plugins/plugin-thread/src/capabilities/state.ts
7
+ import { contributes } from "@dxos/app-framework";
8
+ import { create } from "@dxos/live-object";
9
+ var initialViewState = {
10
+ showResolvedThreads: false
11
+ };
12
+ var state_default = () => {
13
+ const state = create({
14
+ drafts: {}
15
+ });
16
+ const viewStore = create({});
17
+ const getViewState = (subjectId) => {
18
+ if (!viewStore[subjectId]) {
19
+ viewStore[subjectId] = {
20
+ ...initialViewState
21
+ };
22
+ }
23
+ return viewStore[subjectId];
24
+ };
25
+ return contributes(ThreadCapabilities.State, {
26
+ state,
27
+ getViewState
28
+ });
29
+ };
30
+ export {
31
+ state_default as default
32
+ };
33
+ //# sourceMappingURL=state-GNFUURIC.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/state.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes } from '@dxos/app-framework';\nimport { create } from '@dxos/live-object';\n\nimport { ThreadCapabilities } from './capabilities';\nimport { type ThreadState, type ViewStore } from '../types';\n\nconst initialViewState = { showResolvedThreads: false };\n\nexport default () => {\n const state = create<ThreadState>({ drafts: {} });\n const viewStore = create<ViewStore>({});\n\n const getViewState = (subjectId: string) => {\n if (!viewStore[subjectId]) {\n viewStore[subjectId] = { ...initialViewState };\n }\n return viewStore[subjectId];\n };\n\n return contributes(ThreadCapabilities.State, { state, getViewState });\n};\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,mBAAmB;AAC5B,SAASC,cAAc;AAKvB,IAAMC,mBAAmB;EAAEC,qBAAqB;AAAM;AAEtD,IAAA,gBAAe,MAAA;AACb,QAAMC,QAAQC,OAAoB;IAAEC,QAAQ,CAAC;EAAE,CAAA;AAC/C,QAAMC,YAAYF,OAAkB,CAAC,CAAA;AAErC,QAAMG,eAAe,CAACC,cAAAA;AACpB,QAAI,CAACF,UAAUE,SAAAA,GAAY;AACzBF,gBAAUE,SAAAA,IAAa;QAAE,GAAGP;MAAiB;IAC/C;AACA,WAAOK,UAAUE,SAAAA;EACnB;AAEA,SAAOC,YAAYC,mBAAmBC,OAAO;IAAER;IAAOI;EAAa,CAAA;AACrE;",
6
+ "names": ["contributes", "create", "initialViewState", "showResolvedThreads", "state", "create", "drafts", "viewStore", "getViewState", "subjectId", "contributes", "ThreadCapabilities", "State"]
7
+ }
@@ -1,8 +1,10 @@
1
1
  import {
2
- ThreadAction
3
- } from "./chunk-6KTMQPL4.mjs";
4
- import "./chunk-ENERBDYI.mjs";
2
+ ThreadAction,
3
+ ThreadSettingsSchema
4
+ } from "./chunk-NO5AZLUZ.mjs";
5
+ import "./chunk-636QDHE3.mjs";
5
6
  export {
6
- ThreadAction
7
+ ThreadAction,
8
+ ThreadSettingsSchema
7
9
  };
8
10
  //# sourceMappingURL=types.mjs.map
@@ -26,19 +26,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var ThreadArticle_ZCNMFBAO_exports = {};
30
- __export(ThreadArticle_ZCNMFBAO_exports, {
31
- default: () => ThreadArticle_default
29
+ var ThreadContainer_VOYLV4UL_exports = {};
30
+ __export(ThreadContainer_VOYLV4UL_exports, {
31
+ default: () => ThreadContainer_default
32
32
  });
33
- module.exports = __toCommonJS(ThreadArticle_ZCNMFBAO_exports);
34
- var import_chunk_2CB5AVBL = require("./chunk-2CB5AVBL.cjs");
35
- var import_chunk_IC2NICNC = require("./chunk-IC2NICNC.cjs");
33
+ module.exports = __toCommonJS(ThreadContainer_VOYLV4UL_exports);
34
+ var import_chunk_6PUGKCPR = require("./chunk-6PUGKCPR.cjs");
35
+ var import_chunk_AWSTZ2KN = require("./chunk-AWSTZ2KN.cjs");
36
+ var import_chunk_F735VMTN = require("./chunk-F735VMTN.cjs");
36
37
  var import_react = __toESM(require("react"));
37
- var ThreadArticle = (props) => {
38
- return /* @__PURE__ */ import_react.default.createElement("div", {
39
- role: "none",
40
- className: "row-span-2"
41
- }, /* @__PURE__ */ import_react.default.createElement(import_chunk_2CB5AVBL.ChatContainer, props));
38
+ var import_react_ui_stack = require("@dxos/react-ui-stack");
39
+ var ThreadContainer = ({ role, ...props }) => {
40
+ return /* @__PURE__ */ import_react.default.createElement(import_react_ui_stack.StackItem.Content, {
41
+ toolbar: false
42
+ }, /* @__PURE__ */ import_react.default.createElement(import_chunk_6PUGKCPR.ChatContainer, props));
42
43
  };
43
- var ThreadArticle_default = ThreadArticle;
44
- //# sourceMappingURL=ThreadArticle-ZCNMFBAO.cjs.map
44
+ var ThreadContainer_default = ThreadContainer;
45
+ //# sourceMappingURL=ThreadContainer-VOYLV4UL.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/ThreadContainer.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ComponentProps } from 'react';\n\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { ChatContainer } from './ChatContainer';\n\nconst ThreadContainer = ({\n role,\n ...props\n}: Pick<ComponentProps<typeof ChatContainer>, 'thread' | 'context'> & { role: string }) => {\n return (\n <StackItem.Content toolbar={false}>\n <ChatContainer {...props} />\n </StackItem.Content>\n );\n};\n\nexport default ThreadContainer;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA2C;AAE3C,4BAA0B;AAI1B,IAAMA,kBAAkB,CAAC,EACvBC,MACA,GAAGC,MAAAA,MACiF;AACpF,SACE,6BAAAC,QAAA,cAACC,gCAAUC,SAAO;IAACC,SAAS;KAC1B,6BAAAH,QAAA,cAACI,qCAAkBL,KAAAA,CAAAA;AAGzB;AAEA,IAAA,0BAAeF;",
6
+ "names": ["ThreadContainer", "role", "props", "React", "StackItem", "Content", "toolbar", "ChatContainer"]
7
+ }