@dxos/plugin-thread 0.6.11 → 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 -153
- 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 -196
- 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/CommentContainer.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 +46 -111
- package/src/components/ChatContainer.tsx +4 -4
- package/src/components/CommentContainer.tsx +10 -7
- package/src/components/Comments.stories.tsx +2 -2
- 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,10 +444,10 @@ 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
|
};
|
|
335
|
-
var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
|
|
336
451
|
var ThreadPlugin = () => {
|
|
337
452
|
const settings = new import_local_storage.LocalStorageStore(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
338
453
|
const state = (0, import_echo_schema2.create)({
|
|
@@ -350,7 +465,6 @@ var ThreadPlugin = () => {
|
|
|
350
465
|
let attentionPlugin;
|
|
351
466
|
let navigationPlugin;
|
|
352
467
|
let intentPlugin;
|
|
353
|
-
let dispatch;
|
|
354
468
|
const unsubscribeCallbacks = [];
|
|
355
469
|
return {
|
|
356
470
|
meta: import_chunk_BWBONZGU.meta_default,
|
|
@@ -364,20 +478,22 @@ var ThreadPlugin = () => {
|
|
|
364
478
|
attentionPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_attention.parseAttentionPlugin);
|
|
365
479
|
navigationPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseNavigationPlugin);
|
|
366
480
|
intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
367
|
-
dispatch = intentPlugin?.provides.intent.dispatch;
|
|
368
481
|
const graphPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
|
|
369
482
|
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
370
483
|
if (!client) {
|
|
371
484
|
return;
|
|
372
485
|
}
|
|
373
|
-
const channelsQuery = client.spaces.query(import_echo.Filter.schema(
|
|
486
|
+
const channelsQuery = client.spaces.query(import_echo.Filter.schema(import_types.ChannelType));
|
|
374
487
|
const queryUnsubscribe = channelsQuery.subscribe();
|
|
375
488
|
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
376
489
|
const attention = attentionPlugin?.provides.attention;
|
|
377
490
|
if (!attention?.attended) {
|
|
378
491
|
return;
|
|
379
492
|
}
|
|
380
|
-
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
|
+
});
|
|
381
497
|
if (firstAttendedNodeWithComments) {
|
|
382
498
|
void intentPlugin?.provides.intent.dispatch({
|
|
383
499
|
action: import_app_framework.NavigationAction.OPEN,
|
|
@@ -399,7 +515,7 @@ var ThreadPlugin = () => {
|
|
|
399
515
|
settings: settings.values,
|
|
400
516
|
metadata: {
|
|
401
517
|
records: {
|
|
402
|
-
[
|
|
518
|
+
[import_types.ChannelType.typename]: {
|
|
403
519
|
placeholder: [
|
|
404
520
|
"channel title placeholder",
|
|
405
521
|
{
|
|
@@ -411,11 +527,11 @@ var ThreadPlugin = () => {
|
|
|
411
527
|
// TODO(wittjosiah): Move out of metadata.
|
|
412
528
|
loadReferences: (channel) => (0, import_echo.loadObjectReferences)(channel, (channel2) => channel2.threads)
|
|
413
529
|
},
|
|
414
|
-
[
|
|
530
|
+
[import_types.ThreadType.typename]: {
|
|
415
531
|
// TODO(wittjosiah): Move out of metadata.
|
|
416
532
|
loadReferences: (thread) => (0, import_echo.loadObjectReferences)(thread, (thread2) => thread2.messages)
|
|
417
533
|
},
|
|
418
|
-
[
|
|
534
|
+
[import_types.MessageType.typename]: {
|
|
419
535
|
// TODO(wittjosiah): Move out of metadata.
|
|
420
536
|
loadReferences: (message) => []
|
|
421
537
|
},
|
|
@@ -446,17 +562,17 @@ var ThreadPlugin = () => {
|
|
|
446
562
|
],
|
|
447
563
|
echo: {
|
|
448
564
|
schema: [
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
565
|
+
import_types.ChannelType,
|
|
566
|
+
import_types.ThreadType,
|
|
567
|
+
import_types.MessageType
|
|
452
568
|
]
|
|
453
569
|
},
|
|
454
570
|
graph: {
|
|
455
571
|
builder: (plugins) => {
|
|
456
572
|
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
457
|
-
const
|
|
573
|
+
const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
|
|
458
574
|
const metadataResolver = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
459
|
-
if (!client || !
|
|
575
|
+
if (!client || !dispatch || !metadataResolver) {
|
|
460
576
|
return [];
|
|
461
577
|
}
|
|
462
578
|
return [
|
|
@@ -502,7 +618,7 @@ var ThreadPlugin = () => {
|
|
|
502
618
|
const toggle = () => {
|
|
503
619
|
const newToggleState = !viewState.showResolvedThreads;
|
|
504
620
|
viewState.showResolvedThreads = newToggleState;
|
|
505
|
-
void
|
|
621
|
+
void dispatch({
|
|
506
622
|
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
507
623
|
data: {
|
|
508
624
|
name: "threads.toggle-show-resolved",
|
|
@@ -527,14 +643,15 @@ var ThreadPlugin = () => {
|
|
|
527
643
|
],
|
|
528
644
|
menuItemType: "toggle",
|
|
529
645
|
isChecked: viewState.showResolvedThreads,
|
|
530
|
-
testId: "threadPlugin.toggleShowResolved"
|
|
646
|
+
testId: "threadPlugin.toggleShowResolved",
|
|
647
|
+
iconSymbol: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
|
|
531
648
|
}
|
|
532
649
|
}
|
|
533
650
|
];
|
|
534
651
|
}
|
|
535
652
|
}),
|
|
536
653
|
(0, import_plugin_graph.createExtension)({
|
|
537
|
-
id:
|
|
654
|
+
id: import_chunk_4B2ARV7L.ThreadAction.CREATE,
|
|
538
655
|
filter: (node) => !!settings.values.standalone && (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
539
656
|
actions: ({ node }) => {
|
|
540
657
|
const id = node.id.split("/").at(-1);
|
|
@@ -549,10 +666,10 @@ var ThreadPlugin = () => {
|
|
|
549
666
|
{
|
|
550
667
|
id: `${import_chunk_BWBONZGU.THREAD_PLUGIN}/create/${node.id}`,
|
|
551
668
|
data: async () => {
|
|
552
|
-
await
|
|
669
|
+
await dispatch([
|
|
553
670
|
{
|
|
554
671
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
555
|
-
action:
|
|
672
|
+
action: import_chunk_4B2ARV7L.ThreadAction.CREATE
|
|
556
673
|
},
|
|
557
674
|
{
|
|
558
675
|
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
@@ -587,7 +704,7 @@ var ThreadPlugin = () => {
|
|
|
587
704
|
component: ({ data, role }) => {
|
|
588
705
|
switch (role) {
|
|
589
706
|
case "main": {
|
|
590
|
-
return data.active instanceof
|
|
707
|
+
return data.active instanceof import_types.ChannelType && data.active.threads[0] ? /* @__PURE__ */ import_react2.default.createElement(ThreadMain, {
|
|
591
708
|
thread: data.active.threads[0]
|
|
592
709
|
}) : null;
|
|
593
710
|
}
|
|
@@ -599,9 +716,7 @@ var ThreadPlugin = () => {
|
|
|
599
716
|
case "article":
|
|
600
717
|
case "complementary": {
|
|
601
718
|
const location = navigationPlugin?.provides.location;
|
|
602
|
-
|
|
603
|
-
const threadProvides = threadsIntegrators.map((p) => p.provides.thread);
|
|
604
|
-
if (data.object instanceof import_types2.ChannelType && data.object.threads[0]) {
|
|
719
|
+
if (data.object instanceof import_types.ChannelType && data.object.threads[0]) {
|
|
605
720
|
const channel = data.object;
|
|
606
721
|
if ((0, import_app_framework.isLayoutParts)(location?.active) && location.active.main) {
|
|
607
722
|
const layoutEntries = location.active.main;
|
|
@@ -619,91 +734,23 @@ var ThreadPlugin = () => {
|
|
|
619
734
|
thread: data.object.threads[0]
|
|
620
735
|
});
|
|
621
736
|
}
|
|
622
|
-
if (data.subject instanceof
|
|
623
|
-
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, {
|
|
624
739
|
attendableId: data.subject.id
|
|
625
|
-
}), /* @__PURE__ */ import_react2.default.createElement(
|
|
740
|
+
}), /* @__PURE__ */ import_react2.default.createElement(import_chunk_T7TXCNHL.ChatContainer, {
|
|
626
741
|
thread: data.subject
|
|
627
742
|
}));
|
|
628
743
|
}
|
|
629
744
|
if (data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads)) {
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
qualifiedSubjectId
|
|
640
|
-
]);
|
|
641
|
-
const attendableAttrs = (0, import_react_ui_attention.createAttendableAttributes)(qualifiedSubjectId);
|
|
642
|
-
const { showResolvedThreads } = getViewState(qualifiedSubjectId);
|
|
643
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
644
|
-
role: "none",
|
|
645
|
-
className: "contents group/attention",
|
|
646
|
-
...attendableAttrs
|
|
647
|
-
}, role === "complementary" && /* @__PURE__ */ import_react2.default.createElement(CommentsHeading, {
|
|
648
|
-
attendableId: qualifiedSubjectId
|
|
649
|
-
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Root, {
|
|
650
|
-
classNames: "row-span-2"
|
|
651
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Viewport, null, /* @__PURE__ */ import_react2.default.createElement(CommentsContainer, {
|
|
652
|
-
threads,
|
|
653
|
-
detached,
|
|
654
|
-
currentId: attention.has(qualifiedSubjectId) ? state.current : void 0,
|
|
655
|
-
autoFocusCurrentTextbox: state.focus,
|
|
656
|
-
showResolvedThreads,
|
|
657
|
-
onThreadAttend: (thread) => {
|
|
658
|
-
if (state.current !== thread.id) {
|
|
659
|
-
state.current = thread.id;
|
|
660
|
-
void dispatch?.({
|
|
661
|
-
action: import_app_framework.LayoutAction.SCROLL_INTO_VIEW,
|
|
662
|
-
data: {
|
|
663
|
-
id: (0, import_echo.fullyQualifiedId)(data.subject),
|
|
664
|
-
thread: (0, import_echo.fullyQualifiedId)(thread),
|
|
665
|
-
cursor: thread.anchor
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
},
|
|
670
|
-
onThreadDelete: (thread) => dispatch?.({
|
|
671
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
672
|
-
action: import_chunk_D5GOVXHS.ThreadAction.DELETE,
|
|
673
|
-
data: {
|
|
674
|
-
subject: data.subject,
|
|
675
|
-
thread
|
|
676
|
-
}
|
|
677
|
-
}),
|
|
678
|
-
onMessageDelete: (thread, messageId) => dispatch?.({
|
|
679
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
680
|
-
action: import_chunk_D5GOVXHS.ThreadAction.DELETE_MESSAGE,
|
|
681
|
-
data: {
|
|
682
|
-
subject: data.subject,
|
|
683
|
-
thread,
|
|
684
|
-
messageId
|
|
685
|
-
}
|
|
686
|
-
}),
|
|
687
|
-
onThreadToggleResolved: (thread) => dispatch?.({
|
|
688
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
689
|
-
action: import_chunk_D5GOVXHS.ThreadAction.TOGGLE_RESOLVED,
|
|
690
|
-
data: {
|
|
691
|
-
thread
|
|
692
|
-
}
|
|
693
|
-
}),
|
|
694
|
-
onComment: (thread) => {
|
|
695
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
696
|
-
action: import_chunk_D5GOVXHS.ThreadAction.ON_MESSAGE_ADD,
|
|
697
|
-
data: {
|
|
698
|
-
thread,
|
|
699
|
-
subject: data.subject
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
704
|
-
role: "none",
|
|
705
|
-
className: "bs-10"
|
|
706
|
-
}), /* @__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
|
+
});
|
|
707
754
|
}
|
|
708
755
|
}
|
|
709
756
|
}
|
|
@@ -713,11 +760,24 @@ var ThreadPlugin = () => {
|
|
|
713
760
|
intent: {
|
|
714
761
|
resolver: async (intent) => {
|
|
715
762
|
switch (intent.action) {
|
|
716
|
-
case
|
|
763
|
+
case import_chunk_4B2ARV7L.ThreadAction.CREATE: {
|
|
717
764
|
if (intent.data && intent.data.cursor !== void 0) {
|
|
718
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
|
+
}
|
|
719
779
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
720
|
-
const thread = (0, import_echo_schema2.create)(
|
|
780
|
+
const thread = (0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
721
781
|
name,
|
|
722
782
|
anchor: cursor,
|
|
723
783
|
messages: [],
|
|
@@ -744,9 +804,9 @@ var ThreadPlugin = () => {
|
|
|
744
804
|
}
|
|
745
805
|
},
|
|
746
806
|
{
|
|
747
|
-
action:
|
|
807
|
+
action: import_chunk_4B2ARV7L.ThreadAction.SELECT,
|
|
748
808
|
data: {
|
|
749
|
-
current: thread
|
|
809
|
+
current: (0, import_echo.fullyQualifiedId)(thread),
|
|
750
810
|
focus: true
|
|
751
811
|
}
|
|
752
812
|
},
|
|
@@ -763,9 +823,9 @@ var ThreadPlugin = () => {
|
|
|
763
823
|
};
|
|
764
824
|
} else {
|
|
765
825
|
return {
|
|
766
|
-
data: (0, import_echo_schema2.create)(
|
|
826
|
+
data: (0, import_echo_schema2.create)(import_types.ChannelType, {
|
|
767
827
|
threads: [
|
|
768
|
-
(0, import_echo_schema2.create)(
|
|
828
|
+
(0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
769
829
|
messages: []
|
|
770
830
|
})
|
|
771
831
|
]
|
|
@@ -773,16 +833,16 @@ var ThreadPlugin = () => {
|
|
|
773
833
|
};
|
|
774
834
|
}
|
|
775
835
|
}
|
|
776
|
-
case
|
|
836
|
+
case import_chunk_4B2ARV7L.ThreadAction.SELECT: {
|
|
777
837
|
state.focus = intent.data?.current === state.current ? state.focus : intent.data?.focus;
|
|
778
838
|
state.current = intent.data?.current;
|
|
779
839
|
return {
|
|
780
840
|
data: true
|
|
781
841
|
};
|
|
782
842
|
}
|
|
783
|
-
case
|
|
843
|
+
case import_chunk_4B2ARV7L.ThreadAction.TOGGLE_RESOLVED: {
|
|
784
844
|
const { thread } = intent.data ?? {};
|
|
785
|
-
if (!(thread instanceof
|
|
845
|
+
if (!(thread instanceof import_types.ThreadType)) {
|
|
786
846
|
return;
|
|
787
847
|
}
|
|
788
848
|
if (thread.status === "active" || thread.status === void 0) {
|
|
@@ -809,9 +869,9 @@ var ThreadPlugin = () => {
|
|
|
809
869
|
]
|
|
810
870
|
};
|
|
811
871
|
}
|
|
812
|
-
case
|
|
872
|
+
case import_chunk_4B2ARV7L.ThreadAction.DELETE: {
|
|
813
873
|
const { subject, thread } = intent.data ?? {};
|
|
814
|
-
if (!(
|
|
874
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
815
875
|
return;
|
|
816
876
|
}
|
|
817
877
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -820,7 +880,9 @@ var ThreadPlugin = () => {
|
|
|
820
880
|
const index = stagingArea.findIndex((t) => t.id === thread.id);
|
|
821
881
|
if (index !== -1) {
|
|
822
882
|
stagingArea.splice(index, 1);
|
|
823
|
-
return
|
|
883
|
+
return {
|
|
884
|
+
data: true
|
|
885
|
+
};
|
|
824
886
|
}
|
|
825
887
|
}
|
|
826
888
|
const space = (0, import_echo.getSpace)(thread);
|
|
@@ -879,9 +941,9 @@ var ThreadPlugin = () => {
|
|
|
879
941
|
}
|
|
880
942
|
break;
|
|
881
943
|
}
|
|
882
|
-
case
|
|
944
|
+
case import_chunk_4B2ARV7L.ThreadAction.ON_MESSAGE_ADD: {
|
|
883
945
|
const { thread, subject } = intent.data ?? {};
|
|
884
|
-
if (!(thread instanceof
|
|
946
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject && Array.isArray(subject.threads))) {
|
|
885
947
|
return;
|
|
886
948
|
}
|
|
887
949
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -922,10 +984,10 @@ var ThreadPlugin = () => {
|
|
|
922
984
|
]
|
|
923
985
|
};
|
|
924
986
|
}
|
|
925
|
-
case
|
|
987
|
+
case import_chunk_4B2ARV7L.ThreadAction.DELETE_MESSAGE: {
|
|
926
988
|
const { subject, thread, messageId } = intent.data ?? {};
|
|
927
989
|
const space = (0, import_echo.getSpace)(subject);
|
|
928
|
-
if (!(
|
|
990
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
929
991
|
return;
|
|
930
992
|
}
|
|
931
993
|
if (!intent.undo) {
|
|
@@ -939,7 +1001,7 @@ var ThreadPlugin = () => {
|
|
|
939
1001
|
intents: [
|
|
940
1002
|
[
|
|
941
1003
|
{
|
|
942
|
-
action:
|
|
1004
|
+
action: import_chunk_4B2ARV7L.ThreadAction.DELETE,
|
|
943
1005
|
data: {
|
|
944
1006
|
subject,
|
|
945
1007
|
thread
|
|
@@ -967,7 +1029,7 @@ var ThreadPlugin = () => {
|
|
|
967
1029
|
name: "threads.message.delete",
|
|
968
1030
|
properties: {
|
|
969
1031
|
threadId: thread.id,
|
|
970
|
-
spaceId: space
|
|
1032
|
+
spaceId: space?.id
|
|
971
1033
|
}
|
|
972
1034
|
}
|
|
973
1035
|
}
|
|
@@ -977,7 +1039,7 @@ var ThreadPlugin = () => {
|
|
|
977
1039
|
} else if (intent.undo) {
|
|
978
1040
|
const message = intent.data?.message;
|
|
979
1041
|
const messageIndex = intent.data?.messageIndex;
|
|
980
|
-
if (!(message instanceof
|
|
1042
|
+
if (!(message instanceof import_types.MessageType) || !(typeof messageIndex === "number")) {
|
|
981
1043
|
return;
|
|
982
1044
|
}
|
|
983
1045
|
thread.messages.splice(messageIndex, 0, message);
|
|
@@ -991,7 +1053,7 @@ var ThreadPlugin = () => {
|
|
|
991
1053
|
name: "threads.message.undo-delete",
|
|
992
1054
|
properties: {
|
|
993
1055
|
threadId: thread.id,
|
|
994
|
-
spaceId: space
|
|
1056
|
+
spaceId: space?.id
|
|
995
1057
|
}
|
|
996
1058
|
}
|
|
997
1059
|
}
|
|
@@ -1033,7 +1095,7 @@ var ThreadPlugin = () => {
|
|
|
1033
1095
|
}
|
|
1034
1096
|
}),
|
|
1035
1097
|
(0, import_react_ui_editor.createExternalCommentSync)(doc.id, (sink) => (0, import_signals_core.effect)(() => sink()), () => threads.value.filter((thread) => thread?.anchor).map((thread) => ({
|
|
1036
|
-
id: thread
|
|
1098
|
+
id: (0, import_echo.fullyQualifiedId)(thread),
|
|
1037
1099
|
cursor: thread.anchor
|
|
1038
1100
|
}))),
|
|
1039
1101
|
(0, import_react_ui_editor.comments)({
|
|
@@ -1044,7 +1106,7 @@ var ThreadPlugin = () => {
|
|
|
1044
1106
|
"content"
|
|
1045
1107
|
]), start, end);
|
|
1046
1108
|
void intentPlugin?.provides.intent.dispatch({
|
|
1047
|
-
action:
|
|
1109
|
+
action: import_chunk_4B2ARV7L.ThreadAction.CREATE,
|
|
1048
1110
|
data: {
|
|
1049
1111
|
cursor,
|
|
1050
1112
|
name,
|
|
@@ -1055,7 +1117,7 @@ var ThreadPlugin = () => {
|
|
|
1055
1117
|
onDelete: ({ id }) => {
|
|
1056
1118
|
const stagingArea = state.staging[(0, import_echo.fullyQualifiedId)(doc)];
|
|
1057
1119
|
if (stagingArea) {
|
|
1058
|
-
const index = stagingArea.findIndex((thread2) => thread2
|
|
1120
|
+
const index = stagingArea.findIndex((thread2) => (0, import_echo.fullyQualifiedId)(thread2) === id);
|
|
1059
1121
|
if (index !== -1) {
|
|
1060
1122
|
stagingArea.splice(index, 1);
|
|
1061
1123
|
}
|
|
@@ -1066,8 +1128,8 @@ var ThreadPlugin = () => {
|
|
|
1066
1128
|
}
|
|
1067
1129
|
},
|
|
1068
1130
|
onUpdate: ({ id, cursor }) => {
|
|
1069
|
-
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => thread2
|
|
1070
|
-
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) {
|
|
1071
1133
|
const [start, end] = thread.anchor.split(":");
|
|
1072
1134
|
thread.name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
1073
1135
|
"content"
|
|
@@ -1076,11 +1138,11 @@ var ThreadPlugin = () => {
|
|
|
1076
1138
|
}
|
|
1077
1139
|
},
|
|
1078
1140
|
onSelect: ({ selection: { current, closest } }) => {
|
|
1079
|
-
const
|
|
1080
|
-
if (
|
|
1081
|
-
void
|
|
1141
|
+
const dispatch = intentPlugin?.provides.intent.dispatch;
|
|
1142
|
+
if (dispatch) {
|
|
1143
|
+
void dispatch([
|
|
1082
1144
|
{
|
|
1083
|
-
action:
|
|
1145
|
+
action: import_chunk_4B2ARV7L.ThreadAction.SELECT,
|
|
1084
1146
|
data: {
|
|
1085
1147
|
current: current ?? closest
|
|
1086
1148
|
}
|