@dxos/plugin-thread 0.7.2-staging.6d26b2a → 0.7.3-main.2dd075e
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-Z6SU7SJW.mjs → ThreadArticle-6IXTL7CH.mjs} +2 -2
- package/dist/lib/browser/{ThreadMain-SFTBLHNW.mjs → ThreadMain-4IAS67KE.mjs} +2 -2
- package/dist/lib/browser/{chunk-A5AARDTP.mjs → chunk-52HWDLBR.mjs} +2 -2
- package/dist/lib/browser/{chunk-A5AARDTP.mjs.map → chunk-52HWDLBR.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-3VHVY4H7.mjs → chunk-XUHNZID5.mjs} +1 -1
- package/dist/lib/browser/chunk-XUHNZID5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +41 -34
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{ThreadArticle-QQMCCCH5.cjs → ThreadArticle-I7ADXDW3.cjs} +6 -6
- package/dist/lib/node/{ThreadMain-UYUGGUOM.cjs → ThreadMain-MRNJC3TI.cjs} +6 -6
- package/dist/lib/node/{chunk-ANGUPCW3.cjs → chunk-XFO6D2LG.cjs} +4 -4
- package/dist/lib/node/chunk-XFO6D2LG.cjs.map +7 -0
- package/dist/lib/node/{chunk-AWJEBUB4.cjs → chunk-YCDM2SZM.cjs} +6 -6
- package/dist/lib/node/{chunk-AWJEBUB4.cjs.map → chunk-YCDM2SZM.cjs.map} +1 -1
- package/dist/lib/node/index.cjs +94 -87
- package/dist/lib/node/index.cjs.map +3 -3
- 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-VV37UVYP.mjs → ThreadArticle-CJHYMF2W.mjs} +2 -2
- package/dist/lib/node-esm/{ThreadMain-RXIKQI3K.mjs → ThreadMain-VISGW4IF.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-CWPZCZ2F.mjs → chunk-I5MU54RT.mjs} +1 -1
- package/dist/lib/node-esm/chunk-I5MU54RT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MANBTNSY.mjs → chunk-JG7MXH6O.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-MANBTNSY.mjs.map → chunk-JG7MXH6O.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +41 -34
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/ThreadPlugin.d.ts +1 -1
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +2 -2
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/analytics.d.ts +1 -1
- package/dist/types/src/translations.d.ts +59 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +30 -29
- package/src/ThreadPlugin.tsx +39 -26
- package/src/components/ChatContainer.tsx +1 -1
- package/src/components/CommentContainer.tsx +1 -1
- package/src/components/ThreadComplementary.tsx +3 -0
- package/src/components/testing.ts +2 -1
- package/src/hooks/analytics.ts +1 -1
- package/src/translations.ts +5 -0
- package/src/types.ts +1 -1
- package/dist/lib/browser/chunk-3VHVY4H7.mjs.map +0 -7
- package/dist/lib/node/chunk-ANGUPCW3.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-CWPZCZ2F.mjs.map +0 -7
- /package/dist/lib/browser/{ThreadArticle-Z6SU7SJW.mjs.map → ThreadArticle-6IXTL7CH.mjs.map} +0 -0
- /package/dist/lib/browser/{ThreadMain-SFTBLHNW.mjs.map → ThreadMain-4IAS67KE.mjs.map} +0 -0
- /package/dist/lib/node/{ThreadArticle-QQMCCCH5.cjs.map → ThreadArticle-I7ADXDW3.cjs.map} +0 -0
- /package/dist/lib/node/{ThreadMain-UYUGGUOM.cjs.map → ThreadMain-MRNJC3TI.cjs.map} +0 -0
- /package/dist/lib/node-esm/{ThreadArticle-VV37UVYP.mjs.map → ThreadArticle-CJHYMF2W.mjs.map} +0 -0
- /package/dist/lib/node-esm/{ThreadMain-RXIKQI3K.mjs.map → ThreadMain-VISGW4IF.mjs.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_XFO6D2LG.ThreadAction,
|
|
32
32
|
ThreadPlugin: () => ThreadPlugin,
|
|
33
33
|
default: () => src_default,
|
|
34
|
-
useAnalyticsCallback: () =>
|
|
35
|
-
useOnEditAnalytics: () =>
|
|
36
|
-
useStatus: () =>
|
|
34
|
+
useAnalyticsCallback: () => import_chunk_YCDM2SZM.useAnalyticsCallback,
|
|
35
|
+
useOnEditAnalytics: () => import_chunk_YCDM2SZM.useOnEditAnalytics,
|
|
36
|
+
useStatus: () => import_chunk_YCDM2SZM.useStatus
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(node_exports);
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_chunk_XFO6D2LG = require("./chunk-XFO6D2LG.cjs");
|
|
40
|
+
var import_chunk_YCDM2SZM = require("./chunk-YCDM2SZM.cjs");
|
|
41
41
|
var import_chunk_IC2NICNC = require("./chunk-IC2NICNC.cjs");
|
|
42
42
|
var import_react = __toESM(require("react"));
|
|
43
43
|
var import_app_framework = require("@dxos/app-framework");
|
|
@@ -49,14 +49,13 @@ var import_meta = require("@dxos/plugin-observability/meta");
|
|
|
49
49
|
var import_plugin_space = require("@dxos/plugin-space");
|
|
50
50
|
var import_types = require("@dxos/plugin-space/types");
|
|
51
51
|
var import_echo = require("@dxos/react-client/echo");
|
|
52
|
-
var import_echo2 = require("@dxos/react-client/echo");
|
|
53
52
|
var import_react_ui_thread = require("@dxos/react-ui-thread");
|
|
54
53
|
var import_react2 = require("react");
|
|
55
54
|
var import_react3 = require("@phosphor-icons/react");
|
|
56
55
|
var import_react4 = __toESM(require("react"));
|
|
57
|
-
var
|
|
56
|
+
var import_live_object = require("@dxos/live-object");
|
|
58
57
|
var import_types2 = require("@dxos/plugin-space/types");
|
|
59
|
-
var
|
|
58
|
+
var import_echo2 = require("@dxos/react-client/echo");
|
|
60
59
|
var import_halo = require("@dxos/react-client/halo");
|
|
61
60
|
var import_react_ui = require("@dxos/react-ui");
|
|
62
61
|
var import_react_ui_editor = require("@dxos/react-ui-editor");
|
|
@@ -65,12 +64,12 @@ var import_react_ui_thread2 = require("@dxos/react-ui-thread");
|
|
|
65
64
|
var import_util = require("@dxos/util");
|
|
66
65
|
var import_react5 = require("@phosphor-icons/react");
|
|
67
66
|
var import_react6 = __toESM(require("react"));
|
|
68
|
-
var
|
|
67
|
+
var import_echo3 = require("@dxos/react-client/echo");
|
|
69
68
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
70
69
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
71
70
|
var import_react7 = __toESM(require("react"));
|
|
72
71
|
var import_app_framework2 = require("@dxos/app-framework");
|
|
73
|
-
var
|
|
72
|
+
var import_echo4 = require("@dxos/react-client/echo");
|
|
74
73
|
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
75
74
|
var import_util2 = require("@dxos/util");
|
|
76
75
|
var import_react8 = __toESM(require("react"));
|
|
@@ -79,9 +78,10 @@ var import_react_ui_form = require("@dxos/react-ui-form");
|
|
|
79
78
|
var import_view = require("@codemirror/view");
|
|
80
79
|
var import_signals_core = require("@preact/signals-core");
|
|
81
80
|
var import_types3 = require("@dxos/plugin-space/types");
|
|
82
|
-
var
|
|
81
|
+
var import_echo5 = require("@dxos/react-client/echo");
|
|
83
82
|
var import_react_ui_editor2 = require("@dxos/react-ui-editor");
|
|
84
83
|
var import_util3 = require("@dxos/util");
|
|
84
|
+
var import_types4 = require("@dxos/plugin-space/types");
|
|
85
85
|
var sizeClass = (0, import_react_ui_theme.getSize)(4);
|
|
86
86
|
var commentControlClassNames = "!p-1 !min-bs-0 transition-opacity";
|
|
87
87
|
var ToggleResolvedButton = ({ isResolved, onResolve }) => {
|
|
@@ -131,13 +131,13 @@ var DeleteThreadButton = ({ onDelete }) => {
|
|
|
131
131
|
};
|
|
132
132
|
var CommentContainer = ({ thread, detached, context, current, onAttend, onThreadDelete, onMessageDelete, onResolve, onComment }) => {
|
|
133
133
|
const identity = (0, import_halo.useIdentity)();
|
|
134
|
-
const space = (0,
|
|
135
|
-
const members = (0,
|
|
136
|
-
const activity = (0,
|
|
134
|
+
const space = (0, import_echo2.getSpace)(thread);
|
|
135
|
+
const members = (0, import_echo2.useMembers)(space?.key);
|
|
136
|
+
const activity = (0, import_chunk_YCDM2SZM.useStatus)(space, (0, import_echo2.fullyQualifiedId)(thread));
|
|
137
137
|
const { t } = (0, import_react_ui.useTranslation)(import_chunk_IC2NICNC.THREAD_PLUGIN);
|
|
138
138
|
const threadScrollRef = (0, import_react4.useRef)(null);
|
|
139
139
|
const { themeMode } = (0, import_react_ui.useThemeContext)();
|
|
140
|
-
const textboxMetadata = (0,
|
|
140
|
+
const textboxMetadata = (0, import_chunk_YCDM2SZM.getMessageMetadata)((0, import_echo2.fullyQualifiedId)(thread), identity);
|
|
141
141
|
const [_count, _setCount] = (0, import_react4.useState)(0);
|
|
142
142
|
const rerenderEditor = () => _setCount((count) => count + 1);
|
|
143
143
|
const messageRef = (0, import_react4.useRef)("");
|
|
@@ -151,7 +151,7 @@ var CommentContainer = ({ thread, detached, context, current, onAttend, onThread
|
|
|
151
151
|
(0, import_react_ui_editor.listener)({
|
|
152
152
|
onChange: (text) => messageRef.current = text
|
|
153
153
|
}),
|
|
154
|
-
|
|
154
|
+
import_chunk_YCDM2SZM.command
|
|
155
155
|
], [
|
|
156
156
|
_count
|
|
157
157
|
]);
|
|
@@ -163,7 +163,7 @@ var CommentContainer = ({ thread, detached, context, current, onAttend, onThread
|
|
|
163
163
|
if (!messageRef.current) {
|
|
164
164
|
return false;
|
|
165
165
|
}
|
|
166
|
-
thread.messages.push((0,
|
|
166
|
+
thread.messages.push((0, import_live_object.create)(import_types2.MessageType, {
|
|
167
167
|
sender: {
|
|
168
168
|
identityKey: identity.identityKey.toHex()
|
|
169
169
|
},
|
|
@@ -184,7 +184,7 @@ var CommentContainer = ({ thread, detached, context, current, onAttend, onThread
|
|
|
184
184
|
onClickCapture: onAttend,
|
|
185
185
|
onFocusCapture: onAttend,
|
|
186
186
|
current,
|
|
187
|
-
id: (0,
|
|
187
|
+
id: (0, import_echo2.fullyQualifiedId)(thread)
|
|
188
188
|
}, /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
189
189
|
role: "none",
|
|
190
190
|
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,7 +204,7 @@ var CommentContainer = ({ thread, detached, context, current, onAttend, onThread
|
|
|
204
204
|
onResolve
|
|
205
205
|
}), onThreadDelete && /* @__PURE__ */ import_react4.default.createElement(DeleteThreadButton, {
|
|
206
206
|
onDelete: onThreadDelete
|
|
207
|
-
}))), thread.messages.filter(import_util.nonNullable).map((message) => /* @__PURE__ */ import_react4.default.createElement(
|
|
207
|
+
}))), thread.messages.filter(import_util.nonNullable).map((message) => /* @__PURE__ */ import_react4.default.createElement(import_chunk_YCDM2SZM.MessageContainer, {
|
|
208
208
|
key: message.id,
|
|
209
209
|
message,
|
|
210
210
|
members,
|
|
@@ -235,7 +235,7 @@ var CommentsContainer = ({ threads: threads2, detached = [], currentId, showReso
|
|
|
235
235
|
currentId
|
|
236
236
|
]);
|
|
237
237
|
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, filteredThreads.length > 0 ? filteredThreads.map((thread) => {
|
|
238
|
-
const threadId = (0,
|
|
238
|
+
const threadId = (0, import_echo3.fullyQualifiedId)(thread);
|
|
239
239
|
return /* @__PURE__ */ import_react6.default.createElement(CommentContainer, {
|
|
240
240
|
key: threadId,
|
|
241
241
|
thread,
|
|
@@ -292,7 +292,7 @@ var ThreadComplementary = ({ role, subject, drafts, current, showResolvedThreads
|
|
|
292
292
|
JSON.stringify(drafts)
|
|
293
293
|
]);
|
|
294
294
|
const detachedIds = (0, import_react7.useMemo)(() => {
|
|
295
|
-
return threads2.filter(({ anchor }) => !anchor).map((thread) => (0,
|
|
295
|
+
return threads2.filter(({ anchor }) => !anchor).map((thread) => (0, import_echo4.fullyQualifiedId)(thread));
|
|
296
296
|
}, [
|
|
297
297
|
threads2
|
|
298
298
|
]);
|
|
@@ -306,21 +306,21 @@ var ThreadComplementary = ({ role, subject, drafts, current, showResolvedThreads
|
|
|
306
306
|
threads2
|
|
307
307
|
]);
|
|
308
308
|
const attended = (0, import_react_ui_attention.useAttended)();
|
|
309
|
-
const qualifiedSubjectId = (0,
|
|
309
|
+
const qualifiedSubjectId = (0, import_echo4.fullyQualifiedId)(subject);
|
|
310
310
|
return /* @__PURE__ */ import_react7.default.createElement(CommentsContainer, {
|
|
311
311
|
threads: threads2,
|
|
312
312
|
detached: detachedIds,
|
|
313
313
|
currentId: attended.includes(qualifiedSubjectId) ? current : void 0,
|
|
314
314
|
showResolvedThreads,
|
|
315
315
|
onThreadAttend: (thread) => {
|
|
316
|
-
const threadId = (0,
|
|
316
|
+
const threadId = (0, import_echo4.fullyQualifiedId)(thread);
|
|
317
317
|
if (current !== threadId) {
|
|
318
318
|
current = threadId;
|
|
319
319
|
void dispatch?.([
|
|
320
320
|
{
|
|
321
321
|
action: import_app_framework2.LayoutAction.SCROLL_INTO_VIEW,
|
|
322
322
|
data: {
|
|
323
|
-
id: (0,
|
|
323
|
+
id: (0, import_echo4.fullyQualifiedId)(subject),
|
|
324
324
|
thread: threadId,
|
|
325
325
|
cursor: thread.anchor
|
|
326
326
|
}
|
|
@@ -331,7 +331,7 @@ var ThreadComplementary = ({ role, subject, drafts, current, showResolvedThreads
|
|
|
331
331
|
onThreadDelete: (thread) => {
|
|
332
332
|
return dispatch({
|
|
333
333
|
plugin: import_chunk_IC2NICNC.THREAD_PLUGIN,
|
|
334
|
-
action:
|
|
334
|
+
action: import_chunk_XFO6D2LG.ThreadAction.DELETE,
|
|
335
335
|
data: {
|
|
336
336
|
subject,
|
|
337
337
|
thread
|
|
@@ -340,7 +340,7 @@ var ThreadComplementary = ({ role, subject, drafts, current, showResolvedThreads
|
|
|
340
340
|
},
|
|
341
341
|
onMessageDelete: (thread, messageId) => dispatch({
|
|
342
342
|
plugin: import_chunk_IC2NICNC.THREAD_PLUGIN,
|
|
343
|
-
action:
|
|
343
|
+
action: import_chunk_XFO6D2LG.ThreadAction.DELETE_MESSAGE,
|
|
344
344
|
data: {
|
|
345
345
|
subject,
|
|
346
346
|
thread,
|
|
@@ -349,14 +349,14 @@ var ThreadComplementary = ({ role, subject, drafts, current, showResolvedThreads
|
|
|
349
349
|
}),
|
|
350
350
|
onThreadToggleResolved: (thread) => dispatch({
|
|
351
351
|
plugin: import_chunk_IC2NICNC.THREAD_PLUGIN,
|
|
352
|
-
action:
|
|
352
|
+
action: import_chunk_XFO6D2LG.ThreadAction.TOGGLE_RESOLVED,
|
|
353
353
|
data: {
|
|
354
354
|
thread
|
|
355
355
|
}
|
|
356
356
|
}),
|
|
357
357
|
onComment: (thread) => {
|
|
358
358
|
void dispatch({
|
|
359
|
-
action:
|
|
359
|
+
action: import_chunk_XFO6D2LG.ThreadAction.ON_MESSAGE_ADD,
|
|
360
360
|
data: {
|
|
361
361
|
thread,
|
|
362
362
|
subject
|
|
@@ -374,18 +374,18 @@ var ThreadSettings = ({ settings }) => {
|
|
|
374
374
|
onCheckedChange: (checked) => settings.standalone = !!checked
|
|
375
375
|
})));
|
|
376
376
|
};
|
|
377
|
-
var ThreadMain = (0, import_react2.lazy)(() => import("./ThreadMain-
|
|
378
|
-
var ThreadArticle = (0, import_react2.lazy)(() => import("./ThreadArticle-
|
|
377
|
+
var ThreadMain = (0, import_react2.lazy)(() => import("./ThreadMain-MRNJC3TI.cjs"));
|
|
378
|
+
var ThreadArticle = (0, import_react2.lazy)(() => import("./ThreadArticle-I7ADXDW3.cjs"));
|
|
379
379
|
var getName = (doc, anchor) => {
|
|
380
380
|
if (doc.content) {
|
|
381
381
|
const [start, end] = anchor.split(":");
|
|
382
|
-
return (0,
|
|
382
|
+
return (0, import_echo5.getTextInRange)((0, import_echo5.createDocAccessor)(doc.content, [
|
|
383
383
|
"content"
|
|
384
384
|
]), start, end);
|
|
385
385
|
}
|
|
386
386
|
};
|
|
387
387
|
var threads = (state, doc, dispatch) => {
|
|
388
|
-
const space = doc && (0,
|
|
388
|
+
const space = doc && (0, import_echo5.getSpace)(doc);
|
|
389
389
|
if (!doc || !space || !dispatch) {
|
|
390
390
|
return [
|
|
391
391
|
(0, import_react_ui_editor2.comments)()
|
|
@@ -393,7 +393,7 @@ var threads = (state, doc, dispatch) => {
|
|
|
393
393
|
}
|
|
394
394
|
const threads2 = (0, import_signals_core.computed)(() => [
|
|
395
395
|
...doc.threads.filter(import_util3.nonNullable),
|
|
396
|
-
...state.drafts[(0,
|
|
396
|
+
...state.drafts[(0, import_echo5.fullyQualifiedId)(doc)] ?? []
|
|
397
397
|
].filter((thread) => !(thread?.status === "resolved")));
|
|
398
398
|
return [
|
|
399
399
|
import_view.EditorView.updateListener.of((update) => {
|
|
@@ -408,16 +408,16 @@ var threads = (state, doc, dispatch) => {
|
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
}),
|
|
411
|
-
(0, import_react_ui_editor2.createExternalCommentSync)((0,
|
|
412
|
-
id: (0,
|
|
411
|
+
(0, import_react_ui_editor2.createExternalCommentSync)((0, import_echo5.fullyQualifiedId)(doc), (sink) => (0, import_signals_core.effect)(() => sink()), () => threads2.value.filter((thread) => thread?.anchor).map((thread) => ({
|
|
412
|
+
id: (0, import_echo5.fullyQualifiedId)(thread),
|
|
413
413
|
cursor: thread.anchor
|
|
414
414
|
}))),
|
|
415
415
|
(0, import_react_ui_editor2.comments)({
|
|
416
|
-
id: (0,
|
|
416
|
+
id: (0, import_echo5.fullyQualifiedId)(doc),
|
|
417
417
|
onCreate: ({ cursor }) => {
|
|
418
418
|
const name = getName(doc, cursor);
|
|
419
419
|
void dispatch({
|
|
420
|
-
action:
|
|
420
|
+
action: import_chunk_XFO6D2LG.ThreadAction.CREATE,
|
|
421
421
|
data: {
|
|
422
422
|
cursor,
|
|
423
423
|
name,
|
|
@@ -426,9 +426,9 @@ var threads = (state, doc, dispatch) => {
|
|
|
426
426
|
});
|
|
427
427
|
},
|
|
428
428
|
onDelete: ({ id }) => {
|
|
429
|
-
const draft = state.drafts[(0,
|
|
429
|
+
const draft = state.drafts[(0, import_echo5.fullyQualifiedId)(doc)];
|
|
430
430
|
if (draft) {
|
|
431
|
-
const index = draft.findIndex((thread2) => (0,
|
|
431
|
+
const index = draft.findIndex((thread2) => (0, import_echo5.fullyQualifiedId)(thread2) === id);
|
|
432
432
|
if (index !== -1) {
|
|
433
433
|
draft.splice(index, 1);
|
|
434
434
|
}
|
|
@@ -439,7 +439,7 @@ var threads = (state, doc, dispatch) => {
|
|
|
439
439
|
}
|
|
440
440
|
},
|
|
441
441
|
onUpdate: ({ id, cursor }) => {
|
|
442
|
-
const thread = state.drafts[(0,
|
|
442
|
+
const thread = state.drafts[(0, import_echo5.fullyQualifiedId)(doc)]?.find((thread2) => (0, import_echo5.fullyQualifiedId)(thread2) === id) ?? doc.threads.find((thread2) => thread2?.id === id);
|
|
443
443
|
if (thread instanceof import_types3.ThreadType && thread.anchor) {
|
|
444
444
|
thread.name = getName(doc, thread.anchor);
|
|
445
445
|
thread.anchor = cursor;
|
|
@@ -447,7 +447,7 @@ var threads = (state, doc, dispatch) => {
|
|
|
447
447
|
},
|
|
448
448
|
onSelect: ({ selection: { current, closest } }) => {
|
|
449
449
|
void dispatch({
|
|
450
|
-
action:
|
|
450
|
+
action: import_chunk_XFO6D2LG.ThreadAction.SELECT,
|
|
451
451
|
data: {
|
|
452
452
|
current: current ?? closest,
|
|
453
453
|
skipOpen: true
|
|
@@ -460,6 +460,9 @@ var threads = (state, doc, dispatch) => {
|
|
|
460
460
|
var translations_default = [
|
|
461
461
|
{
|
|
462
462
|
"en-US": {
|
|
463
|
+
[import_types4.ChannelType.typename]: {
|
|
464
|
+
"typename label": "Channel"
|
|
465
|
+
},
|
|
463
466
|
[import_chunk_IC2NICNC.THREAD_PLUGIN]: {
|
|
464
467
|
"plugin name": "Threads",
|
|
465
468
|
"channel name placeholder": "New channel",
|
|
@@ -515,13 +518,29 @@ var ThreadPlugin = () => {
|
|
|
515
518
|
const unsubscribeCallbacks = [];
|
|
516
519
|
return {
|
|
517
520
|
meta: import_chunk_IC2NICNC.meta_default,
|
|
518
|
-
|
|
521
|
+
initialize: async () => {
|
|
519
522
|
settings.prop({
|
|
520
523
|
key: "standalone",
|
|
521
524
|
type: import_local_storage.LocalStorageStore.bool({
|
|
522
525
|
allowUndefined: true
|
|
523
526
|
})
|
|
524
527
|
});
|
|
528
|
+
return {
|
|
529
|
+
echo: {
|
|
530
|
+
system: [
|
|
531
|
+
import_types.ThreadType,
|
|
532
|
+
import_types.MessageType
|
|
533
|
+
],
|
|
534
|
+
// TODO(wittjosiah): Requires reload.
|
|
535
|
+
...settings.values.standalone ? {
|
|
536
|
+
schema: [
|
|
537
|
+
import_types.ChannelType
|
|
538
|
+
]
|
|
539
|
+
} : {}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
},
|
|
543
|
+
ready: async (plugins) => {
|
|
525
544
|
navigationPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseNavigationPlugin);
|
|
526
545
|
intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
527
546
|
},
|
|
@@ -541,11 +560,11 @@ var ThreadPlugin = () => {
|
|
|
541
560
|
],
|
|
542
561
|
icon: "ph--chat--regular",
|
|
543
562
|
// TODO(wittjosiah): Move out of metadata.
|
|
544
|
-
loadReferences: (channel) => (0,
|
|
563
|
+
loadReferences: (channel) => (0, import_echo.loadObjectReferences)(channel, (channel2) => channel2.threads)
|
|
545
564
|
},
|
|
546
565
|
[import_types.ThreadType.typename]: {
|
|
547
566
|
// TODO(wittjosiah): Move out of metadata.
|
|
548
|
-
loadReferences: (thread) => (0,
|
|
567
|
+
loadReferences: (thread) => (0, import_echo.loadObjectReferences)(thread, (thread2) => thread2.messages)
|
|
549
568
|
},
|
|
550
569
|
[import_types.MessageType.typename]: {
|
|
551
570
|
// TODO(wittjosiah): Move out of metadata.
|
|
@@ -576,13 +595,6 @@ var ThreadPlugin = () => {
|
|
|
576
595
|
...translations_default,
|
|
577
596
|
...import_react_ui_thread.translations
|
|
578
597
|
],
|
|
579
|
-
echo: {
|
|
580
|
-
schema: [
|
|
581
|
-
import_types.ChannelType,
|
|
582
|
-
import_types.ThreadType,
|
|
583
|
-
import_types.MessageType
|
|
584
|
-
]
|
|
585
|
-
},
|
|
586
598
|
complementary: {
|
|
587
599
|
panels: [
|
|
588
600
|
{
|
|
@@ -615,8 +627,9 @@ var ThreadPlugin = () => {
|
|
|
615
627
|
return;
|
|
616
628
|
}
|
|
617
629
|
const [subjectId] = id.split("~");
|
|
618
|
-
const { spaceId, objectId } = (0,
|
|
619
|
-
const
|
|
630
|
+
const { spaceId, objectId } = (0, import_echo.parseId)(subjectId);
|
|
631
|
+
const spaces = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
632
|
+
const space = spaces?.find((space2) => space2.id === spaceId && space2.state.get() === import_echo.SpaceState.SPACE_READY);
|
|
620
633
|
if (!objectId) {
|
|
621
634
|
return {
|
|
622
635
|
id,
|
|
@@ -636,15 +649,9 @@ var ThreadPlugin = () => {
|
|
|
636
649
|
}
|
|
637
650
|
};
|
|
638
651
|
}
|
|
639
|
-
const object = (0,
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
id: objectId
|
|
643
|
-
}).first();
|
|
644
|
-
onChange();
|
|
645
|
-
});
|
|
646
|
-
return () => clearTimeout(timeout);
|
|
647
|
-
}, () => space?.db.getObjectById(objectId), subjectId);
|
|
652
|
+
const [object] = (0, import_plugin_space.memoizeQuery)(space, {
|
|
653
|
+
id: objectId
|
|
654
|
+
});
|
|
648
655
|
if (!object || !subjectId) {
|
|
649
656
|
return;
|
|
650
657
|
}
|
|
@@ -711,7 +718,7 @@ var ThreadPlugin = () => {
|
|
|
711
718
|
}
|
|
712
719
|
}),
|
|
713
720
|
(0, import_plugin_graph.createExtension)({
|
|
714
|
-
id:
|
|
721
|
+
id: import_chunk_XFO6D2LG.ThreadAction.CREATE,
|
|
715
722
|
filter: (node) => !!settings.values.standalone && (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
716
723
|
actions: ({ node }) => {
|
|
717
724
|
const id = node.id.split("/").at(-1);
|
|
@@ -729,7 +736,7 @@ var ThreadPlugin = () => {
|
|
|
729
736
|
await dispatch([
|
|
730
737
|
{
|
|
731
738
|
plugin: import_chunk_IC2NICNC.THREAD_PLUGIN,
|
|
732
|
-
action:
|
|
739
|
+
action: import_chunk_XFO6D2LG.ThreadAction.CREATE
|
|
733
740
|
},
|
|
734
741
|
{
|
|
735
742
|
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
@@ -781,7 +788,7 @@ var ThreadPlugin = () => {
|
|
|
781
788
|
const currentPosition = layoutEntries.findIndex((entry) => channel.id === entry.id);
|
|
782
789
|
if (currentPosition > 0) {
|
|
783
790
|
const objectToTheLeft = layoutEntries[currentPosition - 1];
|
|
784
|
-
const context = (0,
|
|
791
|
+
const context = (0, import_echo.getSpace)(data.object)?.db.getObjectById(objectToTheLeft.id);
|
|
785
792
|
return /* @__PURE__ */ import_react.default.createElement(ThreadArticle, {
|
|
786
793
|
thread: data.object.threads[0],
|
|
787
794
|
context
|
|
@@ -793,9 +800,9 @@ var ThreadPlugin = () => {
|
|
|
793
800
|
});
|
|
794
801
|
}
|
|
795
802
|
if (data.subject instanceof import_types.ThreadType) {
|
|
796
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
803
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_chunk_YCDM2SZM.ChatHeading, {
|
|
797
804
|
attendableId: data.subject.id
|
|
798
|
-
}), /* @__PURE__ */ import_react.default.createElement(
|
|
805
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_chunk_YCDM2SZM.ChatContainer, {
|
|
799
806
|
thread: data.subject
|
|
800
807
|
}));
|
|
801
808
|
}
|
|
@@ -803,11 +810,11 @@ var ThreadPlugin = () => {
|
|
|
803
810
|
}
|
|
804
811
|
case "complementary--comments": {
|
|
805
812
|
if (data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads) && !(data.subject instanceof import_types.ChannelType)) {
|
|
806
|
-
const { showResolvedThreads } = getViewState((0,
|
|
813
|
+
const { showResolvedThreads } = getViewState((0, import_echo.fullyQualifiedId)(data.subject));
|
|
807
814
|
return /* @__PURE__ */ import_react.default.createElement(ThreadComplementary, {
|
|
808
815
|
role,
|
|
809
816
|
subject: data.subject,
|
|
810
|
-
drafts: state.drafts[(0,
|
|
817
|
+
drafts: state.drafts[(0, import_echo.fullyQualifiedId)(data.subject)],
|
|
811
818
|
current: state.current,
|
|
812
819
|
showResolvedThreads
|
|
813
820
|
});
|
|
@@ -821,7 +828,7 @@ var ThreadPlugin = () => {
|
|
|
821
828
|
intent: {
|
|
822
829
|
resolver: async (intent) => {
|
|
823
830
|
switch (intent.action) {
|
|
824
|
-
case
|
|
831
|
+
case import_chunk_XFO6D2LG.ThreadAction.CREATE: {
|
|
825
832
|
if (intent.data && intent.data.cursor !== void 0) {
|
|
826
833
|
const { cursor, name, subject } = intent.data;
|
|
827
834
|
if (subject?.threads === void 0) {
|
|
@@ -830,14 +837,14 @@ var ThreadPlugin = () => {
|
|
|
830
837
|
} catch (err) {
|
|
831
838
|
import_log.log.error("Subject does not support threads array", subject?.typename, {
|
|
832
839
|
F: __dxlog_file,
|
|
833
|
-
L:
|
|
840
|
+
L: 370,
|
|
834
841
|
S: void 0,
|
|
835
842
|
C: (f, a) => f(...a)
|
|
836
843
|
});
|
|
837
844
|
return;
|
|
838
845
|
}
|
|
839
846
|
}
|
|
840
|
-
const subjectId = (0,
|
|
847
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
841
848
|
const thread = (0, import_echo.create)(import_types.ThreadType, {
|
|
842
849
|
name,
|
|
843
850
|
anchor: cursor,
|
|
@@ -857,9 +864,9 @@ var ThreadPlugin = () => {
|
|
|
857
864
|
intents: [
|
|
858
865
|
[
|
|
859
866
|
{
|
|
860
|
-
action:
|
|
867
|
+
action: import_chunk_XFO6D2LG.ThreadAction.SELECT,
|
|
861
868
|
data: {
|
|
862
|
-
current: (0,
|
|
869
|
+
current: (0, import_echo.fullyQualifiedId)(thread)
|
|
863
870
|
}
|
|
864
871
|
}
|
|
865
872
|
],
|
|
@@ -896,7 +903,7 @@ var ThreadPlugin = () => {
|
|
|
896
903
|
};
|
|
897
904
|
}
|
|
898
905
|
}
|
|
899
|
-
case
|
|
906
|
+
case import_chunk_XFO6D2LG.ThreadAction.SELECT: {
|
|
900
907
|
state.current = intent.data?.current;
|
|
901
908
|
return {
|
|
902
909
|
data: true,
|
|
@@ -914,7 +921,7 @@ var ThreadPlugin = () => {
|
|
|
914
921
|
] : []
|
|
915
922
|
};
|
|
916
923
|
}
|
|
917
|
-
case
|
|
924
|
+
case import_chunk_XFO6D2LG.ThreadAction.TOGGLE_RESOLVED: {
|
|
918
925
|
const { thread } = intent.data ?? {};
|
|
919
926
|
if (!(thread instanceof import_types.ThreadType)) {
|
|
920
927
|
return;
|
|
@@ -924,7 +931,7 @@ var ThreadPlugin = () => {
|
|
|
924
931
|
} else if (thread.status === "resolved") {
|
|
925
932
|
thread.status = "active";
|
|
926
933
|
}
|
|
927
|
-
const space = (0,
|
|
934
|
+
const space = (0, import_echo.getSpace)(thread);
|
|
928
935
|
const spaceId = space?.id;
|
|
929
936
|
return {
|
|
930
937
|
data: true,
|
|
@@ -944,12 +951,12 @@ var ThreadPlugin = () => {
|
|
|
944
951
|
]
|
|
945
952
|
};
|
|
946
953
|
}
|
|
947
|
-
case
|
|
954
|
+
case import_chunk_XFO6D2LG.ThreadAction.DELETE: {
|
|
948
955
|
const { subject, thread } = intent.data ?? {};
|
|
949
956
|
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
950
957
|
return;
|
|
951
958
|
}
|
|
952
|
-
const subjectId = (0,
|
|
959
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
953
960
|
const draft = state.drafts[subjectId];
|
|
954
961
|
if (draft) {
|
|
955
962
|
const index = draft.findIndex((t) => t.id === thread.id);
|
|
@@ -960,7 +967,7 @@ var ThreadPlugin = () => {
|
|
|
960
967
|
};
|
|
961
968
|
}
|
|
962
969
|
}
|
|
963
|
-
const space = (0,
|
|
970
|
+
const space = (0, import_echo.getSpace)(thread);
|
|
964
971
|
if (!space || !subject.threads) {
|
|
965
972
|
return;
|
|
966
973
|
}
|
|
@@ -1016,13 +1023,13 @@ var ThreadPlugin = () => {
|
|
|
1016
1023
|
}
|
|
1017
1024
|
break;
|
|
1018
1025
|
}
|
|
1019
|
-
case
|
|
1026
|
+
case import_chunk_XFO6D2LG.ThreadAction.ON_MESSAGE_ADD: {
|
|
1020
1027
|
const { thread, subject } = intent.data ?? {};
|
|
1021
1028
|
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject && Array.isArray(subject.threads))) {
|
|
1022
1029
|
return;
|
|
1023
1030
|
}
|
|
1024
|
-
const subjectId = (0,
|
|
1025
|
-
const space = (0,
|
|
1031
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
1032
|
+
const space = (0, import_echo.getSpace)(subject);
|
|
1026
1033
|
const intents = [];
|
|
1027
1034
|
const analyticsProperties = {
|
|
1028
1035
|
threadId: thread.id,
|
|
@@ -1059,9 +1066,9 @@ var ThreadPlugin = () => {
|
|
|
1059
1066
|
]
|
|
1060
1067
|
};
|
|
1061
1068
|
}
|
|
1062
|
-
case
|
|
1069
|
+
case import_chunk_XFO6D2LG.ThreadAction.DELETE_MESSAGE: {
|
|
1063
1070
|
const { subject, thread, messageId } = intent.data ?? {};
|
|
1064
|
-
const space = (0,
|
|
1071
|
+
const space = (0, import_echo.getSpace)(subject);
|
|
1065
1072
|
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
1066
1073
|
return;
|
|
1067
1074
|
}
|
|
@@ -1076,7 +1083,7 @@ var ThreadPlugin = () => {
|
|
|
1076
1083
|
intents: [
|
|
1077
1084
|
[
|
|
1078
1085
|
{
|
|
1079
|
-
action:
|
|
1086
|
+
action: import_chunk_XFO6D2LG.ThreadAction.DELETE,
|
|
1080
1087
|
data: {
|
|
1081
1088
|
subject,
|
|
1082
1089
|
thread
|