@dxos/plugin-thread 0.6.11-staging.e6894a4 → 0.6.12-main.5cc132e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{ThreadArticle-O64ZECMF.mjs → ThreadArticle-6L6BGE4Z.mjs} +2 -2
- package/dist/lib/browser/{ThreadMain-ZDCRC6RG.mjs → ThreadMain-DU6LBSN3.mjs} +2 -2
- package/dist/lib/browser/{chunk-P7ZE5N5M.mjs → chunk-AVC4CGJM.mjs} +6 -6
- package/dist/lib/browser/chunk-AVC4CGJM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GKPZHUT3.mjs → chunk-U5UVX4ZP.mjs} +1 -1
- package/dist/lib/browser/{chunk-GKPZHUT3.mjs.map → chunk-U5UVX4ZP.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +217 -156
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{ThreadArticle-DO56JXBU.cjs → ThreadArticle-7BWXVIJ4.cjs} +6 -6
- package/dist/lib/node/{ThreadMain-XJX75GHG.cjs → ThreadMain-XSRB6NKJ.cjs} +6 -6
- package/dist/lib/node/{chunk-D5GOVXHS.cjs → chunk-4B2ARV7L.cjs} +4 -4
- package/dist/lib/node/{chunk-D5GOVXHS.cjs.map → chunk-4B2ARV7L.cjs.map} +1 -1
- package/dist/lib/node/{chunk-5PZNPPQF.cjs → chunk-T7TXCNHL.cjs} +8 -8
- package/dist/lib/node/chunk-T7TXCNHL.cjs.map +7 -0
- package/dist/lib/node/index.cjs +258 -199
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +2 -2
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/ThreadArticle-6L6BGE4Z.mjs +18 -0
- package/dist/lib/node-esm/ThreadArticle-6L6BGE4Z.mjs.map +7 -0
- package/dist/lib/node-esm/ThreadMain-DU6LBSN3.mjs +26 -0
- package/dist/lib/node-esm/ThreadMain-DU6LBSN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5IBJO53M.mjs +21 -0
- package/dist/lib/node-esm/chunk-5IBJO53M.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AVC4CGJM.mjs +410 -0
- package/dist/lib/node-esm/chunk-AVC4CGJM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-U5UVX4ZP.mjs +20 -0
- package/dist/lib/node-esm/chunk-U5UVX4ZP.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1166 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/meta.mjs +11 -0
- package/dist/lib/node-esm/meta.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +8 -0
- package/dist/lib/node-esm/types.mjs.map +7 -0
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/components/Chat.stories.d.ts +0 -1
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
- package/dist/types/src/components/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts +11 -0
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +35 -32
- package/src/ThreadPlugin.tsx +49 -123
- package/src/components/Chat.stories.tsx +3 -3
- package/src/components/ChatContainer.tsx +4 -4
- package/src/components/CommentContainer.tsx +10 -7
- package/src/components/Comments.stories.tsx +10 -15
- package/src/components/CommentsContainer.tsx +18 -14
- package/src/components/MessageContainer.tsx +2 -1
- package/src/components/ThreadComplementary.tsx +120 -0
- package/src/types.ts +1 -1
- package/dist/lib/browser/chunk-P7ZE5N5M.mjs.map +0 -7
- package/dist/lib/node/chunk-5PZNPPQF.cjs.map +0 -7
- package/dist/types/src/types.test.d.ts +0 -2
- package/dist/types/src/types.test.d.ts.map +0 -1
- package/src/types.test.ts +0 -13
- /package/dist/lib/browser/{ThreadArticle-O64ZECMF.mjs.map → ThreadArticle-6L6BGE4Z.mjs.map} +0 -0
- /package/dist/lib/browser/{ThreadMain-ZDCRC6RG.mjs.map → ThreadMain-DU6LBSN3.mjs.map} +0 -0
- /package/dist/lib/node/{ThreadArticle-DO56JXBU.cjs.map → ThreadArticle-7BWXVIJ4.cjs.map} +0 -0
- /package/dist/lib/node/{ThreadMain-XJX75GHG.cjs.map → ThreadMain-XSRB6NKJ.cjs.map} +0 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,16 +28,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
-
ThreadAction: () =>
|
|
31
|
+
ThreadAction: () => import_chunk_4B2ARV7L.ThreadAction,
|
|
32
32
|
ThreadPlugin: () => ThreadPlugin,
|
|
33
33
|
default: () => src_default,
|
|
34
|
-
useAnalyticsCallback: () =>
|
|
35
|
-
useOnEditAnalytics: () =>
|
|
36
|
-
useStatus: () =>
|
|
34
|
+
useAnalyticsCallback: () => import_chunk_T7TXCNHL.useAnalyticsCallback,
|
|
35
|
+
useOnEditAnalytics: () => import_chunk_T7TXCNHL.useOnEditAnalytics,
|
|
36
|
+
useStatus: () => import_chunk_T7TXCNHL.useStatus
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(node_exports);
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_chunk_4B2ARV7L = require("./chunk-4B2ARV7L.cjs");
|
|
40
|
+
var import_chunk_T7TXCNHL = require("./chunk-T7TXCNHL.cjs");
|
|
41
41
|
var import_chunk_BWBONZGU = require("./chunk-BWBONZGU.cjs");
|
|
42
42
|
var import_react = require("@phosphor-icons/react");
|
|
43
43
|
var import_signals_core = require("@preact/signals-core");
|
|
@@ -46,55 +46,60 @@ var import_app_framework = require("@dxos/app-framework");
|
|
|
46
46
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
47
47
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
48
48
|
var import_local_storage = require("@dxos/local-storage");
|
|
49
|
+
var import_log = require("@dxos/log");
|
|
49
50
|
var import_plugin_attention = require("@dxos/plugin-attention");
|
|
50
51
|
var import_plugin_client = require("@dxos/plugin-client");
|
|
51
52
|
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
52
|
-
var import_types = require("@dxos/plugin-markdown/types");
|
|
53
53
|
var import_meta = require("@dxos/plugin-observability/meta");
|
|
54
54
|
var import_plugin_space = require("@dxos/plugin-space");
|
|
55
|
-
var
|
|
55
|
+
var import_types = require("@dxos/plugin-space/types");
|
|
56
56
|
var import_echo = require("@dxos/react-client/echo");
|
|
57
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
58
|
-
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
59
57
|
var import_react_ui_editor = require("@dxos/react-ui-editor");
|
|
60
58
|
var import_react_ui_thread = require("@dxos/react-ui-thread");
|
|
61
59
|
var import_util = require("@dxos/util");
|
|
62
60
|
var import_react3 = __toESM(require("react"));
|
|
63
61
|
var import_react4 = __toESM(require("react"));
|
|
64
62
|
var import_plugin_settings = require("@dxos/plugin-settings");
|
|
65
|
-
var
|
|
63
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
66
64
|
var import_react5 = require("@phosphor-icons/react");
|
|
67
65
|
var import_react6 = __toESM(require("react"));
|
|
68
66
|
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
69
|
-
var
|
|
67
|
+
var import_types2 = require("@dxos/plugin-space/types");
|
|
70
68
|
var import_echo2 = require("@dxos/react-client/echo");
|
|
71
69
|
var import_halo = require("@dxos/react-client/halo");
|
|
72
|
-
var
|
|
70
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
|
73
71
|
var import_react_ui_editor2 = require("@dxos/react-ui-editor");
|
|
74
72
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
75
73
|
var import_react_ui_thread2 = require("@dxos/react-ui-thread");
|
|
76
74
|
var import_util2 = require("@dxos/util");
|
|
77
75
|
var import_react7 = require("@phosphor-icons/react");
|
|
78
76
|
var import_react8 = __toESM(require("react"));
|
|
79
|
-
var
|
|
77
|
+
var import_echo3 = require("@dxos/react-client/echo");
|
|
78
|
+
var import_react_ui3 = require("@dxos/react-ui");
|
|
80
79
|
var import_react_ui_deck = require("@dxos/react-ui-deck");
|
|
81
80
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
81
|
+
var import_react9 = __toESM(require("react"));
|
|
82
|
+
var import_app_framework2 = require("@dxos/app-framework");
|
|
83
|
+
var import_echo4 = require("@dxos/react-client/echo");
|
|
84
|
+
var import_react_ui4 = require("@dxos/react-ui");
|
|
85
|
+
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
86
|
+
var import_util3 = require("@dxos/util");
|
|
82
87
|
var ThreadSettings = ({ settings }) => {
|
|
83
|
-
const { t } = (0,
|
|
88
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
84
89
|
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_plugin_settings.SettingsValue, {
|
|
85
90
|
label: t("settings standalone label")
|
|
86
|
-
}, /* @__PURE__ */ import_react4.default.createElement(
|
|
91
|
+
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Input.Switch, {
|
|
87
92
|
checked: settings.standalone,
|
|
88
93
|
onCheckedChange: (checked) => settings.standalone = !!checked
|
|
89
94
|
})));
|
|
90
95
|
};
|
|
91
96
|
var sizeClass = (0, import_react_ui_theme.getSize)(4);
|
|
92
97
|
var ToggleResolvedButton = ({ isResolved, onResolve }) => {
|
|
93
|
-
const { t } = (0,
|
|
98
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
94
99
|
const label = t(isResolved ? "mark as unresolved label" : "mark as resolved label");
|
|
95
|
-
return /* @__PURE__ */ import_react6.default.createElement(
|
|
100
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
96
101
|
asChild: true
|
|
97
|
-
}, /* @__PURE__ */ import_react6.default.createElement(
|
|
102
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Button, {
|
|
98
103
|
variant: "ghost",
|
|
99
104
|
"data-testid": "thread.toggle-resolved",
|
|
100
105
|
onClick: onResolve,
|
|
@@ -109,16 +114,16 @@ var ToggleResolvedButton = ({ isResolved, onResolve }) => {
|
|
|
109
114
|
weight: "fill"
|
|
110
115
|
}) : /* @__PURE__ */ import_react6.default.createElement(import_react5.CheckCircle, {
|
|
111
116
|
className: sizeClass
|
|
112
|
-
}))), /* @__PURE__ */ import_react6.default.createElement(
|
|
117
|
+
}))), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
113
118
|
classNames: "z-[21]"
|
|
114
|
-
}, label, /* @__PURE__ */ import_react6.default.createElement(
|
|
119
|
+
}, label, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Arrow, null))));
|
|
115
120
|
};
|
|
116
121
|
var DeleteThreadButton = ({ onDelete }) => {
|
|
117
|
-
const { t } = (0,
|
|
122
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
118
123
|
const label = t("delete thread label");
|
|
119
|
-
return /* @__PURE__ */ import_react6.default.createElement(
|
|
124
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
120
125
|
asChild: true
|
|
121
|
-
}, /* @__PURE__ */ import_react6.default.createElement(
|
|
126
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Button, {
|
|
122
127
|
variant: "ghost",
|
|
123
128
|
"data-testid": "thread.delete",
|
|
124
129
|
onClick: onDelete,
|
|
@@ -130,20 +135,20 @@ var DeleteThreadButton = ({ onDelete }) => {
|
|
|
130
135
|
className: "sr-only"
|
|
131
136
|
}, label), /* @__PURE__ */ import_react6.default.createElement(import_react5.X, {
|
|
132
137
|
className: sizeClass
|
|
133
|
-
}))), /* @__PURE__ */ import_react6.default.createElement(
|
|
138
|
+
}))), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
134
139
|
classNames: "z-[21]"
|
|
135
|
-
}, label, /* @__PURE__ */ import_react6.default.createElement(
|
|
140
|
+
}, label, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Arrow, null))));
|
|
136
141
|
};
|
|
137
142
|
var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox, onAttend, onThreadDelete, onMessageDelete, onResolve, onComment }) => {
|
|
138
143
|
const identity = (0, import_halo.useIdentity)();
|
|
139
144
|
const space = (0, import_echo2.getSpace)(thread);
|
|
140
145
|
const members = (0, import_echo2.useMembers)(space?.key);
|
|
141
|
-
const activity = (0,
|
|
142
|
-
const { t } = (0,
|
|
146
|
+
const activity = (0, import_chunk_T7TXCNHL.useStatus)(space, (0, import_echo2.fullyQualifiedId)(thread));
|
|
147
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
143
148
|
const threadScrollRef = (0, import_react6.useRef)(null);
|
|
144
149
|
const [autoFocus, setAutoFocus] = (0, import_react6.useState)(!!autoFocusTextbox);
|
|
145
|
-
const { themeMode } = (0,
|
|
146
|
-
const textboxMetadata = (0,
|
|
150
|
+
const { themeMode } = (0, import_react_ui2.useThemeContext)();
|
|
151
|
+
const textboxMetadata = (0, import_chunk_T7TXCNHL.getMessageMetadata)((0, import_echo2.fullyQualifiedId)(thread), identity);
|
|
147
152
|
const [_count, _setCount] = (0, import_react6.useState)(0);
|
|
148
153
|
const rerenderEditor = () => _setCount((count) => count + 1);
|
|
149
154
|
const messageRef = (0, import_react6.useRef)("");
|
|
@@ -157,7 +162,7 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
157
162
|
(0, import_react_ui_editor2.listener)({
|
|
158
163
|
onChange: (text) => messageRef.current = text
|
|
159
164
|
}),
|
|
160
|
-
|
|
165
|
+
import_chunk_T7TXCNHL.command
|
|
161
166
|
], [
|
|
162
167
|
_count
|
|
163
168
|
]);
|
|
@@ -174,7 +179,7 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
174
179
|
if (!messageRef.current) {
|
|
175
180
|
return false;
|
|
176
181
|
}
|
|
177
|
-
thread.messages.push((0, import_echo_schema3.create)(
|
|
182
|
+
thread.messages.push((0, import_echo_schema3.create)(import_types2.MessageType, {
|
|
178
183
|
sender: {
|
|
179
184
|
identityKey: identity.identityKey.toHex()
|
|
180
185
|
},
|
|
@@ -192,36 +197,35 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
192
197
|
thread,
|
|
193
198
|
identity
|
|
194
199
|
]);
|
|
195
|
-
const handleDeleteMessage = (id) => onMessageDelete?.(id);
|
|
196
200
|
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui_thread2.Thread, {
|
|
197
201
|
onClickCapture: onAttend,
|
|
198
202
|
onFocusCapture: onAttend,
|
|
199
203
|
current,
|
|
200
|
-
id: thread
|
|
204
|
+
id: (0, import_echo2.fullyQualifiedId)(thread)
|
|
201
205
|
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
202
206
|
role: "none",
|
|
203
207
|
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)
|
|
204
|
-
}, detached ? /* @__PURE__ */ import_react6.default.createElement(
|
|
208
|
+
}, detached ? /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
205
209
|
asChild: true
|
|
206
210
|
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_thread2.ThreadHeading, {
|
|
207
211
|
detached: true
|
|
208
|
-
}, thread.name ?? t("thread title placeholder"))), /* @__PURE__ */ import_react6.default.createElement(
|
|
212
|
+
}, thread.name ?? t("thread title placeholder"))), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
209
213
|
classNames: "z-[21]",
|
|
210
214
|
side: "top"
|
|
211
|
-
}, t("detached thread label"), /* @__PURE__ */ import_react6.default.createElement(
|
|
215
|
+
}, t("detached thread label"), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tooltip.Arrow, null)))) : /* @__PURE__ */ import_react6.default.createElement(import_react_ui_thread2.ThreadHeading, null, thread.name ?? t("thread title placeholder")), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
212
216
|
className: "flex flex-row items-center pli-1"
|
|
213
|
-
}, thread.status === "staged" && /* @__PURE__ */ import_react6.default.createElement(
|
|
217
|
+
}, thread.status === "staged" && /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Tag, {
|
|
214
218
|
palette: "neutral"
|
|
215
219
|
}, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */ import_react6.default.createElement(ToggleResolvedButton, {
|
|
216
220
|
isResolved: thread?.status === "resolved",
|
|
217
221
|
onResolve
|
|
218
222
|
}), onThreadDelete && /* @__PURE__ */ import_react6.default.createElement(DeleteThreadButton, {
|
|
219
223
|
onDelete: onThreadDelete
|
|
220
|
-
}))), thread.messages.filter(import_util2.nonNullable).map((message) => /* @__PURE__ */ import_react6.default.createElement(
|
|
224
|
+
}))), thread.messages.filter(import_util2.nonNullable).map((message) => /* @__PURE__ */ import_react6.default.createElement(import_chunk_T7TXCNHL.MessageContainer, {
|
|
221
225
|
key: message.id,
|
|
222
226
|
message,
|
|
223
227
|
members,
|
|
224
|
-
onDelete:
|
|
228
|
+
onDelete: (id) => onMessageDelete?.(id)
|
|
225
229
|
})), /* @__PURE__ */ import_react6.default.createElement(import_react_ui_thread2.MessageTextbox, {
|
|
226
230
|
extensions,
|
|
227
231
|
autoFocus,
|
|
@@ -236,7 +240,7 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
236
240
|
}));
|
|
237
241
|
};
|
|
238
242
|
var CommentsHeading = ({ attendableId }) => {
|
|
239
|
-
const { t } = (0,
|
|
243
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
240
244
|
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
241
245
|
role: "none",
|
|
242
246
|
className: "flex items-center"
|
|
@@ -247,7 +251,7 @@ var CommentsHeading = ({ attendableId }) => {
|
|
|
247
251
|
}, t("comments heading")));
|
|
248
252
|
};
|
|
249
253
|
var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTextbox, showResolvedThreads, onThreadAttend, onThreadDelete, onMessageDelete, onThreadToggleResolved, ...props }) => {
|
|
250
|
-
const { t } = (0,
|
|
254
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
251
255
|
const filteredThreads = showResolvedThreads ? threads : threads.filter((thread) => !(thread?.status === "resolved"));
|
|
252
256
|
(0, import_react8.useEffect)(() => {
|
|
253
257
|
if (currentId) {
|
|
@@ -259,31 +263,34 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
|
|
|
259
263
|
}, [
|
|
260
264
|
currentId
|
|
261
265
|
]);
|
|
262
|
-
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, filteredThreads.length > 0 ? filteredThreads.map((thread) =>
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
266
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, filteredThreads.length > 0 ? filteredThreads.map((thread) => {
|
|
267
|
+
const threadId = (0, import_echo3.fullyQualifiedId)(thread);
|
|
268
|
+
return /* @__PURE__ */ import_react8.default.createElement(CommentContainer, {
|
|
269
|
+
key: threadId,
|
|
270
|
+
thread,
|
|
271
|
+
current: currentId === threadId,
|
|
272
|
+
detached: detached.includes(threadId),
|
|
273
|
+
autoFocusTextbox: autoFocusCurrentTextbox && currentId === threadId,
|
|
274
|
+
...onThreadAttend && {
|
|
275
|
+
onAttend: () => onThreadAttend(thread)
|
|
276
|
+
},
|
|
277
|
+
...onThreadDelete && {
|
|
278
|
+
onThreadDelete: () => onThreadDelete(thread)
|
|
279
|
+
},
|
|
280
|
+
...onMessageDelete && {
|
|
281
|
+
onMessageDelete: (messageId) => onMessageDelete(thread, messageId)
|
|
282
|
+
},
|
|
283
|
+
...onThreadToggleResolved && {
|
|
284
|
+
onResolve: () => onThreadToggleResolved(thread)
|
|
285
|
+
},
|
|
286
|
+
...props
|
|
287
|
+
});
|
|
288
|
+
}) : /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
282
289
|
role: "alert",
|
|
283
290
|
className: (0, import_react_ui_theme2.mx)(import_react_ui_theme2.descriptionText, "place-self-center border border-dashed border-neutral-400/50 rounded-lg text-center p-4 m-4")
|
|
284
291
|
}, /* @__PURE__ */ import_react8.default.createElement("h2", {
|
|
285
292
|
className: "mbe-2 font-medium text-baseText"
|
|
286
|
-
}, t("no comments title")), /* @__PURE__ */ import_react8.default.createElement("p", null, /* @__PURE__ */ import_react8.default.createElement(
|
|
293
|
+
}, t("no comments title")), /* @__PURE__ */ import_react8.default.createElement("p", null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui3.Trans, {
|
|
287
294
|
t,
|
|
288
295
|
i18nKey: "no comments message",
|
|
289
296
|
components: {
|
|
@@ -293,8 +300,116 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
|
|
|
293
300
|
}
|
|
294
301
|
}))));
|
|
295
302
|
};
|
|
296
|
-
var ThreadMain = import_react3.default.lazy(() => import("./ThreadMain-
|
|
297
|
-
var ThreadArticle = import_react3.default.lazy(() => import("./ThreadArticle-
|
|
303
|
+
var ThreadMain = import_react3.default.lazy(() => import("./ThreadMain-XSRB6NKJ.cjs"));
|
|
304
|
+
var ThreadArticle = import_react3.default.lazy(() => import("./ThreadArticle-7BWXVIJ4.cjs"));
|
|
305
|
+
var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
|
|
306
|
+
var ThreadComplementary = ({ role, subject, stagedThreads, current, focus, showResolvedThreads }) => {
|
|
307
|
+
const dispatch = (0, import_app_framework2.useIntentDispatcher)();
|
|
308
|
+
const threadsIntegrators = (0, import_app_framework2.useResolvePlugins)(providesThreadsConfig);
|
|
309
|
+
const threadProvides = (0, import_react9.useMemo)(() => threadsIntegrators.map((p) => p.provides.thread), [
|
|
310
|
+
threadsIntegrators
|
|
311
|
+
]);
|
|
312
|
+
const createSort = (0, import_react9.useMemo)(() => threadProvides.find((p) => p.predicate(subject))?.createSort, [
|
|
313
|
+
threadProvides,
|
|
314
|
+
subject
|
|
315
|
+
]);
|
|
316
|
+
const sort = (0, import_react9.useMemo)(() => createSort?.(subject), [
|
|
317
|
+
createSort,
|
|
318
|
+
subject
|
|
319
|
+
]);
|
|
320
|
+
const threads = (0, import_react9.useMemo)(() => {
|
|
321
|
+
return subject.threads.concat(stagedThreads ?? []).filter(import_util3.nonNullable);
|
|
322
|
+
}, [
|
|
323
|
+
JSON.stringify(subject.threads),
|
|
324
|
+
JSON.stringify(stagedThreads)
|
|
325
|
+
]);
|
|
326
|
+
const detachedIds = (0, import_react9.useMemo)(() => {
|
|
327
|
+
return threads.filter(({ anchor }) => !anchor).map((thread) => (0, import_echo4.fullyQualifiedId)(thread));
|
|
328
|
+
}, [
|
|
329
|
+
threads
|
|
330
|
+
]);
|
|
331
|
+
(0, import_react9.useEffect)(() => {
|
|
332
|
+
if (!sort) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
threads.sort((a, b) => sort(a?.anchor, b?.anchor));
|
|
336
|
+
}, [
|
|
337
|
+
sort,
|
|
338
|
+
threads
|
|
339
|
+
]);
|
|
340
|
+
const { attended } = (0, import_react_ui_attention.useAttentionContext)("Thread Complementary");
|
|
341
|
+
const qualifiedSubjectId = (0, import_echo4.fullyQualifiedId)(subject);
|
|
342
|
+
const attendableAttrs = (0, import_react_ui_attention.createAttendableAttributes)(qualifiedSubjectId);
|
|
343
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
344
|
+
role: "none",
|
|
345
|
+
className: "contents group/attention",
|
|
346
|
+
...attendableAttrs
|
|
347
|
+
}, role === "complementary" && /* @__PURE__ */ import_react9.default.createElement(CommentsHeading, {
|
|
348
|
+
attendableId: qualifiedSubjectId
|
|
349
|
+
}), /* @__PURE__ */ import_react9.default.createElement(import_react_ui4.ScrollArea.Root, {
|
|
350
|
+
classNames: "row-span-2"
|
|
351
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui4.ScrollArea.Viewport, null, /* @__PURE__ */ import_react9.default.createElement(CommentsContainer, {
|
|
352
|
+
threads,
|
|
353
|
+
detached: detachedIds,
|
|
354
|
+
currentId: attended.has(qualifiedSubjectId) ? current : void 0,
|
|
355
|
+
autoFocusCurrentTextbox: focus,
|
|
356
|
+
showResolvedThreads,
|
|
357
|
+
onThreadAttend: (thread) => {
|
|
358
|
+
const threadId = (0, import_echo4.fullyQualifiedId)(thread);
|
|
359
|
+
if (current !== threadId) {
|
|
360
|
+
current = threadId;
|
|
361
|
+
void dispatch?.([
|
|
362
|
+
{
|
|
363
|
+
action: import_app_framework2.LayoutAction.SCROLL_INTO_VIEW,
|
|
364
|
+
data: {
|
|
365
|
+
id: (0, import_echo4.fullyQualifiedId)(subject),
|
|
366
|
+
thread: threadId,
|
|
367
|
+
cursor: thread.anchor
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
]);
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
onThreadDelete: (thread) => {
|
|
374
|
+
return dispatch({
|
|
375
|
+
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
376
|
+
action: import_chunk_4B2ARV7L.ThreadAction.DELETE,
|
|
377
|
+
data: {
|
|
378
|
+
subject,
|
|
379
|
+
thread
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
},
|
|
383
|
+
onMessageDelete: (thread, messageId) => dispatch({
|
|
384
|
+
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
385
|
+
action: import_chunk_4B2ARV7L.ThreadAction.DELETE_MESSAGE,
|
|
386
|
+
data: {
|
|
387
|
+
subject,
|
|
388
|
+
thread,
|
|
389
|
+
messageId
|
|
390
|
+
}
|
|
391
|
+
}),
|
|
392
|
+
onThreadToggleResolved: (thread) => dispatch({
|
|
393
|
+
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
394
|
+
action: import_chunk_4B2ARV7L.ThreadAction.TOGGLE_RESOLVED,
|
|
395
|
+
data: {
|
|
396
|
+
thread
|
|
397
|
+
}
|
|
398
|
+
}),
|
|
399
|
+
onComment: (thread) => {
|
|
400
|
+
void dispatch({
|
|
401
|
+
action: import_chunk_4B2ARV7L.ThreadAction.ON_MESSAGE_ADD,
|
|
402
|
+
data: {
|
|
403
|
+
thread,
|
|
404
|
+
subject
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}), /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
409
|
+
role: "none",
|
|
410
|
+
className: "bs-10"
|
|
411
|
+
}), /* @__PURE__ */ import_react9.default.createElement(import_react_ui4.ScrollArea.Scrollbar, null, /* @__PURE__ */ import_react9.default.createElement(import_react_ui4.ScrollArea.Thumb, null)))));
|
|
412
|
+
};
|
|
298
413
|
var translations_default = [
|
|
299
414
|
{
|
|
300
415
|
"en-US": {
|
|
@@ -329,6 +444,7 @@ var translations_default = [
|
|
|
329
444
|
}
|
|
330
445
|
}
|
|
331
446
|
];
|
|
447
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-thread/src/ThreadPlugin.tsx";
|
|
332
448
|
var initialViewState = {
|
|
333
449
|
showResolvedThreads: false
|
|
334
450
|
};
|
|
@@ -349,7 +465,6 @@ var ThreadPlugin = () => {
|
|
|
349
465
|
let attentionPlugin;
|
|
350
466
|
let navigationPlugin;
|
|
351
467
|
let intentPlugin;
|
|
352
|
-
let dispatch;
|
|
353
468
|
const unsubscribeCallbacks = [];
|
|
354
469
|
return {
|
|
355
470
|
meta: import_chunk_BWBONZGU.meta_default,
|
|
@@ -363,20 +478,22 @@ var ThreadPlugin = () => {
|
|
|
363
478
|
attentionPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_attention.parseAttentionPlugin);
|
|
364
479
|
navigationPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseNavigationPlugin);
|
|
365
480
|
intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
366
|
-
dispatch = intentPlugin?.provides.intent.dispatch;
|
|
367
481
|
const graphPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
|
|
368
482
|
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
369
483
|
if (!client) {
|
|
370
484
|
return;
|
|
371
485
|
}
|
|
372
|
-
const channelsQuery = client.spaces.query(import_echo.Filter.schema(
|
|
486
|
+
const channelsQuery = client.spaces.query(import_echo.Filter.schema(import_types.ChannelType));
|
|
373
487
|
const queryUnsubscribe = channelsQuery.subscribe();
|
|
374
488
|
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
375
489
|
const attention = attentionPlugin?.provides.attention;
|
|
376
490
|
if (!attention?.attended) {
|
|
377
491
|
return;
|
|
378
492
|
}
|
|
379
|
-
const firstAttendedNodeWithComments = Array.from(attention.attended).map((id) => graphPlugin?.provides.graph.findNode(id)).find((node) =>
|
|
493
|
+
const firstAttendedNodeWithComments = Array.from(attention.attended).map((id) => graphPlugin?.provides.graph.findNode(id)).find((node) => {
|
|
494
|
+
const data = node?.data;
|
|
495
|
+
return Array.isArray(data?.threads) && data.threads.length > 0;
|
|
496
|
+
});
|
|
380
497
|
if (firstAttendedNodeWithComments) {
|
|
381
498
|
void intentPlugin?.provides.intent.dispatch({
|
|
382
499
|
action: import_app_framework.NavigationAction.OPEN,
|
|
@@ -398,7 +515,7 @@ var ThreadPlugin = () => {
|
|
|
398
515
|
settings: settings.values,
|
|
399
516
|
metadata: {
|
|
400
517
|
records: {
|
|
401
|
-
[
|
|
518
|
+
[import_types.ChannelType.typename]: {
|
|
402
519
|
placeholder: [
|
|
403
520
|
"channel title placeholder",
|
|
404
521
|
{
|
|
@@ -410,11 +527,11 @@ var ThreadPlugin = () => {
|
|
|
410
527
|
// TODO(wittjosiah): Move out of metadata.
|
|
411
528
|
loadReferences: (channel) => (0, import_echo.loadObjectReferences)(channel, (channel2) => channel2.threads)
|
|
412
529
|
},
|
|
413
|
-
[
|
|
530
|
+
[import_types.ThreadType.typename]: {
|
|
414
531
|
// TODO(wittjosiah): Move out of metadata.
|
|
415
532
|
loadReferences: (thread) => (0, import_echo.loadObjectReferences)(thread, (thread2) => thread2.messages)
|
|
416
533
|
},
|
|
417
|
-
[
|
|
534
|
+
[import_types.MessageType.typename]: {
|
|
418
535
|
// TODO(wittjosiah): Move out of metadata.
|
|
419
536
|
loadReferences: (message) => []
|
|
420
537
|
},
|
|
@@ -445,17 +562,17 @@ var ThreadPlugin = () => {
|
|
|
445
562
|
],
|
|
446
563
|
echo: {
|
|
447
564
|
schema: [
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
565
|
+
import_types.ChannelType,
|
|
566
|
+
import_types.ThreadType,
|
|
567
|
+
import_types.MessageType
|
|
451
568
|
]
|
|
452
569
|
},
|
|
453
570
|
graph: {
|
|
454
571
|
builder: (plugins) => {
|
|
455
572
|
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
456
|
-
const
|
|
573
|
+
const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
|
|
457
574
|
const metadataResolver = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
458
|
-
if (!client || !
|
|
575
|
+
if (!client || !dispatch || !metadataResolver) {
|
|
459
576
|
return [];
|
|
460
577
|
}
|
|
461
578
|
return [
|
|
@@ -501,7 +618,7 @@ var ThreadPlugin = () => {
|
|
|
501
618
|
const toggle = () => {
|
|
502
619
|
const newToggleState = !viewState.showResolvedThreads;
|
|
503
620
|
viewState.showResolvedThreads = newToggleState;
|
|
504
|
-
void
|
|
621
|
+
void dispatch({
|
|
505
622
|
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
506
623
|
data: {
|
|
507
624
|
name: "threads.toggle-show-resolved",
|
|
@@ -526,14 +643,15 @@ var ThreadPlugin = () => {
|
|
|
526
643
|
],
|
|
527
644
|
menuItemType: "toggle",
|
|
528
645
|
isChecked: viewState.showResolvedThreads,
|
|
529
|
-
testId: "threadPlugin.toggleShowResolved"
|
|
646
|
+
testId: "threadPlugin.toggleShowResolved",
|
|
647
|
+
iconSymbol: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
|
|
530
648
|
}
|
|
531
649
|
}
|
|
532
650
|
];
|
|
533
651
|
}
|
|
534
652
|
}),
|
|
535
653
|
(0, import_plugin_graph.createExtension)({
|
|
536
|
-
id:
|
|
654
|
+
id: import_chunk_4B2ARV7L.ThreadAction.CREATE,
|
|
537
655
|
filter: (node) => !!settings.values.standalone && (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
538
656
|
actions: ({ node }) => {
|
|
539
657
|
const id = node.id.split("/").at(-1);
|
|
@@ -548,10 +666,10 @@ var ThreadPlugin = () => {
|
|
|
548
666
|
{
|
|
549
667
|
id: `${import_chunk_BWBONZGU.THREAD_PLUGIN}/create/${node.id}`,
|
|
550
668
|
data: async () => {
|
|
551
|
-
await
|
|
669
|
+
await dispatch([
|
|
552
670
|
{
|
|
553
671
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
554
|
-
action:
|
|
672
|
+
action: import_chunk_4B2ARV7L.ThreadAction.CREATE
|
|
555
673
|
},
|
|
556
674
|
{
|
|
557
675
|
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
@@ -586,7 +704,7 @@ var ThreadPlugin = () => {
|
|
|
586
704
|
component: ({ data, role }) => {
|
|
587
705
|
switch (role) {
|
|
588
706
|
case "main": {
|
|
589
|
-
return data.active instanceof
|
|
707
|
+
return data.active instanceof import_types.ChannelType && data.active.threads[0] ? /* @__PURE__ */ import_react2.default.createElement(ThreadMain, {
|
|
590
708
|
thread: data.active.threads[0]
|
|
591
709
|
}) : null;
|
|
592
710
|
}
|
|
@@ -598,13 +716,7 @@ var ThreadPlugin = () => {
|
|
|
598
716
|
case "article":
|
|
599
717
|
case "complementary": {
|
|
600
718
|
const location = navigationPlugin?.provides.location;
|
|
601
|
-
|
|
602
|
-
// TODO(Zan): More robust runtime check.
|
|
603
|
-
"thread" in plugin.provides ? plugin : void 0
|
|
604
|
-
), []);
|
|
605
|
-
const threadsIntegrators = (0, import_app_framework.useResolvePlugins)(providesThreadsConfig);
|
|
606
|
-
const threadProvides = threadsIntegrators.map((p) => p.provides.thread);
|
|
607
|
-
if (data.object instanceof import_types2.ChannelType && data.object.threads[0]) {
|
|
719
|
+
if (data.object instanceof import_types.ChannelType && data.object.threads[0]) {
|
|
608
720
|
const channel = data.object;
|
|
609
721
|
if ((0, import_app_framework.isLayoutParts)(location?.active) && location.active.main) {
|
|
610
722
|
const layoutEntries = location.active.main;
|
|
@@ -622,91 +734,23 @@ var ThreadPlugin = () => {
|
|
|
622
734
|
thread: data.object.threads[0]
|
|
623
735
|
});
|
|
624
736
|
}
|
|
625
|
-
if (data.subject instanceof
|
|
626
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(
|
|
737
|
+
if (data.subject instanceof import_types.ThreadType) {
|
|
738
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_chunk_T7TXCNHL.ChatHeading, {
|
|
627
739
|
attendableId: data.subject.id
|
|
628
|
-
}), /* @__PURE__ */ import_react2.default.createElement(
|
|
740
|
+
}), /* @__PURE__ */ import_react2.default.createElement(import_chunk_T7TXCNHL.ChatContainer, {
|
|
629
741
|
thread: data.subject
|
|
630
742
|
}));
|
|
631
743
|
}
|
|
632
744
|
if (data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads)) {
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
qualifiedSubjectId
|
|
643
|
-
]);
|
|
644
|
-
const attendableAttrs = (0, import_react_ui_attention.createAttendableAttributes)(qualifiedSubjectId);
|
|
645
|
-
const { showResolvedThreads } = getViewState(qualifiedSubjectId);
|
|
646
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
647
|
-
role: "none",
|
|
648
|
-
className: "contents group/attention",
|
|
649
|
-
...attendableAttrs
|
|
650
|
-
}, role === "complementary" && /* @__PURE__ */ import_react2.default.createElement(CommentsHeading, {
|
|
651
|
-
attendableId: qualifiedSubjectId
|
|
652
|
-
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Root, {
|
|
653
|
-
classNames: "row-span-2"
|
|
654
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Viewport, null, /* @__PURE__ */ import_react2.default.createElement(CommentsContainer, {
|
|
655
|
-
threads,
|
|
656
|
-
detached,
|
|
657
|
-
currentId: attention.has(qualifiedSubjectId) ? state.current : void 0,
|
|
658
|
-
autoFocusCurrentTextbox: state.focus,
|
|
659
|
-
showResolvedThreads,
|
|
660
|
-
onThreadAttend: (thread) => {
|
|
661
|
-
if (state.current !== thread.id) {
|
|
662
|
-
state.current = thread.id;
|
|
663
|
-
void dispatch?.({
|
|
664
|
-
action: import_app_framework.LayoutAction.SCROLL_INTO_VIEW,
|
|
665
|
-
data: {
|
|
666
|
-
id: (0, import_echo.fullyQualifiedId)(data.subject),
|
|
667
|
-
thread: (0, import_echo.fullyQualifiedId)(thread),
|
|
668
|
-
cursor: thread.anchor
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
},
|
|
673
|
-
onThreadDelete: (thread) => dispatch?.({
|
|
674
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
675
|
-
action: import_chunk_D5GOVXHS.ThreadAction.DELETE,
|
|
676
|
-
data: {
|
|
677
|
-
subject: data.subject,
|
|
678
|
-
thread
|
|
679
|
-
}
|
|
680
|
-
}),
|
|
681
|
-
onMessageDelete: (thread, messageId) => dispatch?.({
|
|
682
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
683
|
-
action: import_chunk_D5GOVXHS.ThreadAction.DELETE_MESSAGE,
|
|
684
|
-
data: {
|
|
685
|
-
subject: data.subject,
|
|
686
|
-
thread,
|
|
687
|
-
messageId
|
|
688
|
-
}
|
|
689
|
-
}),
|
|
690
|
-
onThreadToggleResolved: (thread) => dispatch?.({
|
|
691
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
692
|
-
action: import_chunk_D5GOVXHS.ThreadAction.TOGGLE_RESOLVED,
|
|
693
|
-
data: {
|
|
694
|
-
thread
|
|
695
|
-
}
|
|
696
|
-
}),
|
|
697
|
-
onComment: (thread) => {
|
|
698
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
699
|
-
action: import_chunk_D5GOVXHS.ThreadAction.ON_MESSAGE_ADD,
|
|
700
|
-
data: {
|
|
701
|
-
thread,
|
|
702
|
-
subject: data.subject
|
|
703
|
-
}
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
707
|
-
role: "none",
|
|
708
|
-
className: "bs-10"
|
|
709
|
-
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Scrollbar, null, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Thumb, null)))));
|
|
745
|
+
const { showResolvedThreads } = getViewState((0, import_echo.fullyQualifiedId)(data.subject));
|
|
746
|
+
return /* @__PURE__ */ import_react2.default.createElement(ThreadComplementary, {
|
|
747
|
+
role,
|
|
748
|
+
subject: data.subject,
|
|
749
|
+
stagedThreads: state.staging[(0, import_echo.fullyQualifiedId)(data.subject)],
|
|
750
|
+
current: state.current,
|
|
751
|
+
focus: true,
|
|
752
|
+
showResolvedThreads
|
|
753
|
+
});
|
|
710
754
|
}
|
|
711
755
|
}
|
|
712
756
|
}
|
|
@@ -716,11 +760,24 @@ var ThreadPlugin = () => {
|
|
|
716
760
|
intent: {
|
|
717
761
|
resolver: async (intent) => {
|
|
718
762
|
switch (intent.action) {
|
|
719
|
-
case
|
|
763
|
+
case import_chunk_4B2ARV7L.ThreadAction.CREATE: {
|
|
720
764
|
if (intent.data && intent.data.cursor !== void 0) {
|
|
721
765
|
const { cursor, name, subject } = intent.data;
|
|
766
|
+
if (subject?.threads === void 0) {
|
|
767
|
+
try {
|
|
768
|
+
subject.threads = [];
|
|
769
|
+
} catch (e) {
|
|
770
|
+
import_log.log.error("Subject does not support threads array", subject?.typename, {
|
|
771
|
+
F: __dxlog_file,
|
|
772
|
+
L: 369,
|
|
773
|
+
S: void 0,
|
|
774
|
+
C: (f, a) => f(...a)
|
|
775
|
+
});
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
722
779
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
723
|
-
const thread = (0, import_echo_schema2.create)(
|
|
780
|
+
const thread = (0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
724
781
|
name,
|
|
725
782
|
anchor: cursor,
|
|
726
783
|
messages: [],
|
|
@@ -747,9 +804,9 @@ var ThreadPlugin = () => {
|
|
|
747
804
|
}
|
|
748
805
|
},
|
|
749
806
|
{
|
|
750
|
-
action:
|
|
807
|
+
action: import_chunk_4B2ARV7L.ThreadAction.SELECT,
|
|
751
808
|
data: {
|
|
752
|
-
current: thread
|
|
809
|
+
current: (0, import_echo.fullyQualifiedId)(thread),
|
|
753
810
|
focus: true
|
|
754
811
|
}
|
|
755
812
|
},
|
|
@@ -766,9 +823,9 @@ var ThreadPlugin = () => {
|
|
|
766
823
|
};
|
|
767
824
|
} else {
|
|
768
825
|
return {
|
|
769
|
-
data: (0, import_echo_schema2.create)(
|
|
826
|
+
data: (0, import_echo_schema2.create)(import_types.ChannelType, {
|
|
770
827
|
threads: [
|
|
771
|
-
(0, import_echo_schema2.create)(
|
|
828
|
+
(0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
772
829
|
messages: []
|
|
773
830
|
})
|
|
774
831
|
]
|
|
@@ -776,16 +833,16 @@ var ThreadPlugin = () => {
|
|
|
776
833
|
};
|
|
777
834
|
}
|
|
778
835
|
}
|
|
779
|
-
case
|
|
836
|
+
case import_chunk_4B2ARV7L.ThreadAction.SELECT: {
|
|
780
837
|
state.focus = intent.data?.current === state.current ? state.focus : intent.data?.focus;
|
|
781
838
|
state.current = intent.data?.current;
|
|
782
839
|
return {
|
|
783
840
|
data: true
|
|
784
841
|
};
|
|
785
842
|
}
|
|
786
|
-
case
|
|
843
|
+
case import_chunk_4B2ARV7L.ThreadAction.TOGGLE_RESOLVED: {
|
|
787
844
|
const { thread } = intent.data ?? {};
|
|
788
|
-
if (!(thread instanceof
|
|
845
|
+
if (!(thread instanceof import_types.ThreadType)) {
|
|
789
846
|
return;
|
|
790
847
|
}
|
|
791
848
|
if (thread.status === "active" || thread.status === void 0) {
|
|
@@ -812,9 +869,9 @@ var ThreadPlugin = () => {
|
|
|
812
869
|
]
|
|
813
870
|
};
|
|
814
871
|
}
|
|
815
|
-
case
|
|
872
|
+
case import_chunk_4B2ARV7L.ThreadAction.DELETE: {
|
|
816
873
|
const { subject, thread } = intent.data ?? {};
|
|
817
|
-
if (!(
|
|
874
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
818
875
|
return;
|
|
819
876
|
}
|
|
820
877
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -823,7 +880,9 @@ var ThreadPlugin = () => {
|
|
|
823
880
|
const index = stagingArea.findIndex((t) => t.id === thread.id);
|
|
824
881
|
if (index !== -1) {
|
|
825
882
|
stagingArea.splice(index, 1);
|
|
826
|
-
return
|
|
883
|
+
return {
|
|
884
|
+
data: true
|
|
885
|
+
};
|
|
827
886
|
}
|
|
828
887
|
}
|
|
829
888
|
const space = (0, import_echo.getSpace)(thread);
|
|
@@ -882,9 +941,9 @@ var ThreadPlugin = () => {
|
|
|
882
941
|
}
|
|
883
942
|
break;
|
|
884
943
|
}
|
|
885
|
-
case
|
|
944
|
+
case import_chunk_4B2ARV7L.ThreadAction.ON_MESSAGE_ADD: {
|
|
886
945
|
const { thread, subject } = intent.data ?? {};
|
|
887
|
-
if (!(thread instanceof
|
|
946
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject && Array.isArray(subject.threads))) {
|
|
888
947
|
return;
|
|
889
948
|
}
|
|
890
949
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -925,10 +984,10 @@ var ThreadPlugin = () => {
|
|
|
925
984
|
]
|
|
926
985
|
};
|
|
927
986
|
}
|
|
928
|
-
case
|
|
987
|
+
case import_chunk_4B2ARV7L.ThreadAction.DELETE_MESSAGE: {
|
|
929
988
|
const { subject, thread, messageId } = intent.data ?? {};
|
|
930
989
|
const space = (0, import_echo.getSpace)(subject);
|
|
931
|
-
if (!(
|
|
990
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
932
991
|
return;
|
|
933
992
|
}
|
|
934
993
|
if (!intent.undo) {
|
|
@@ -942,7 +1001,7 @@ var ThreadPlugin = () => {
|
|
|
942
1001
|
intents: [
|
|
943
1002
|
[
|
|
944
1003
|
{
|
|
945
|
-
action:
|
|
1004
|
+
action: import_chunk_4B2ARV7L.ThreadAction.DELETE,
|
|
946
1005
|
data: {
|
|
947
1006
|
subject,
|
|
948
1007
|
thread
|
|
@@ -970,7 +1029,7 @@ var ThreadPlugin = () => {
|
|
|
970
1029
|
name: "threads.message.delete",
|
|
971
1030
|
properties: {
|
|
972
1031
|
threadId: thread.id,
|
|
973
|
-
spaceId: space
|
|
1032
|
+
spaceId: space?.id
|
|
974
1033
|
}
|
|
975
1034
|
}
|
|
976
1035
|
}
|
|
@@ -980,7 +1039,7 @@ var ThreadPlugin = () => {
|
|
|
980
1039
|
} else if (intent.undo) {
|
|
981
1040
|
const message = intent.data?.message;
|
|
982
1041
|
const messageIndex = intent.data?.messageIndex;
|
|
983
|
-
if (!(message instanceof
|
|
1042
|
+
if (!(message instanceof import_types.MessageType) || !(typeof messageIndex === "number")) {
|
|
984
1043
|
return;
|
|
985
1044
|
}
|
|
986
1045
|
thread.messages.splice(messageIndex, 0, message);
|
|
@@ -994,7 +1053,7 @@ var ThreadPlugin = () => {
|
|
|
994
1053
|
name: "threads.message.undo-delete",
|
|
995
1054
|
properties: {
|
|
996
1055
|
threadId: thread.id,
|
|
997
|
-
spaceId: space
|
|
1056
|
+
spaceId: space?.id
|
|
998
1057
|
}
|
|
999
1058
|
}
|
|
1000
1059
|
}
|
|
@@ -1036,7 +1095,7 @@ var ThreadPlugin = () => {
|
|
|
1036
1095
|
}
|
|
1037
1096
|
}),
|
|
1038
1097
|
(0, import_react_ui_editor.createExternalCommentSync)(doc.id, (sink) => (0, import_signals_core.effect)(() => sink()), () => threads.value.filter((thread) => thread?.anchor).map((thread) => ({
|
|
1039
|
-
id: thread
|
|
1098
|
+
id: (0, import_echo.fullyQualifiedId)(thread),
|
|
1040
1099
|
cursor: thread.anchor
|
|
1041
1100
|
}))),
|
|
1042
1101
|
(0, import_react_ui_editor.comments)({
|
|
@@ -1047,7 +1106,7 @@ var ThreadPlugin = () => {
|
|
|
1047
1106
|
"content"
|
|
1048
1107
|
]), start, end);
|
|
1049
1108
|
void intentPlugin?.provides.intent.dispatch({
|
|
1050
|
-
action:
|
|
1109
|
+
action: import_chunk_4B2ARV7L.ThreadAction.CREATE,
|
|
1051
1110
|
data: {
|
|
1052
1111
|
cursor,
|
|
1053
1112
|
name,
|
|
@@ -1058,7 +1117,7 @@ var ThreadPlugin = () => {
|
|
|
1058
1117
|
onDelete: ({ id }) => {
|
|
1059
1118
|
const stagingArea = state.staging[(0, import_echo.fullyQualifiedId)(doc)];
|
|
1060
1119
|
if (stagingArea) {
|
|
1061
|
-
const index = stagingArea.findIndex((thread2) => thread2
|
|
1120
|
+
const index = stagingArea.findIndex((thread2) => (0, import_echo.fullyQualifiedId)(thread2) === id);
|
|
1062
1121
|
if (index !== -1) {
|
|
1063
1122
|
stagingArea.splice(index, 1);
|
|
1064
1123
|
}
|
|
@@ -1069,8 +1128,8 @@ var ThreadPlugin = () => {
|
|
|
1069
1128
|
}
|
|
1070
1129
|
},
|
|
1071
1130
|
onUpdate: ({ id, cursor }) => {
|
|
1072
|
-
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => thread2
|
|
1073
|
-
if (thread instanceof
|
|
1131
|
+
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => (0, import_echo.fullyQualifiedId)(thread2) === id) ?? doc.threads.find((thread2) => thread2?.id === id);
|
|
1132
|
+
if (thread instanceof import_types.ThreadType && thread.anchor) {
|
|
1074
1133
|
const [start, end] = thread.anchor.split(":");
|
|
1075
1134
|
thread.name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
1076
1135
|
"content"
|
|
@@ -1079,11 +1138,11 @@ var ThreadPlugin = () => {
|
|
|
1079
1138
|
}
|
|
1080
1139
|
},
|
|
1081
1140
|
onSelect: ({ selection: { current, closest } }) => {
|
|
1082
|
-
const
|
|
1083
|
-
if (
|
|
1084
|
-
void
|
|
1141
|
+
const dispatch = intentPlugin?.provides.intent.dispatch;
|
|
1142
|
+
if (dispatch) {
|
|
1143
|
+
void dispatch([
|
|
1085
1144
|
{
|
|
1086
|
-
action:
|
|
1145
|
+
action: import_chunk_4B2ARV7L.ThreadAction.SELECT,
|
|
1087
1146
|
data: {
|
|
1088
1147
|
current: current ?? closest
|
|
1089
1148
|
}
|