@dxos/plugin-thread 0.6.11 → 0.6.12-main.568932b
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-4VU752F4.mjs} +3 -3
- package/dist/lib/browser/{ThreadMain-ZDCRC6RG.mjs → ThreadMain-ML3P4XSD.mjs} +3 -3
- package/dist/lib/browser/{chunk-5IBJO53M.mjs → chunk-7NUYW5IW.mjs} +2 -5
- package/dist/lib/browser/chunk-7NUYW5IW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GKPZHUT3.mjs → chunk-GJRBBPXI.mjs} +2 -2
- package/dist/lib/browser/{chunk-GKPZHUT3.mjs.map → chunk-GJRBBPXI.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-P7ZE5N5M.mjs → chunk-XF5QKI75.mjs} +13 -11
- package/dist/lib/browser/chunk-XF5QKI75.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +233 -234
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/{ThreadArticle-DO56JXBU.cjs → ThreadArticle-ERUHPHVT.cjs} +7 -7
- package/dist/lib/node/{ThreadMain-XJX75GHG.cjs → ThreadMain-6DN7FDNB.cjs} +7 -7
- package/dist/lib/node/{chunk-BWBONZGU.cjs → chunk-6EVXCSDS.cjs} +5 -18
- package/dist/lib/node/chunk-6EVXCSDS.cjs.map +7 -0
- package/dist/lib/node/{chunk-D5GOVXHS.cjs → chunk-FXD3DYMO.cjs} +6 -6
- package/dist/lib/node/{chunk-D5GOVXHS.cjs.map → chunk-FXD3DYMO.cjs.map} +1 -1
- package/dist/lib/node/{chunk-5PZNPPQF.cjs → chunk-PZVUW4W2.cjs} +65 -63
- package/dist/lib/node/chunk-PZVUW4W2.cjs.map +7 -0
- package/dist/lib/node/index.cjs +313 -316
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +4 -4
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +3 -3
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/ThreadArticle-NKI5F4W5.mjs +19 -0
- package/dist/lib/node-esm/ThreadArticle-NKI5F4W5.mjs.map +7 -0
- package/dist/lib/node-esm/ThreadMain-2A3VQLCW.mjs +27 -0
- package/dist/lib/node-esm/ThreadMain-2A3VQLCW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-A44C4MTQ.mjs +413 -0
- package/dist/lib/node-esm/chunk-A44C4MTQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y475KZTX.mjs +20 -0
- package/dist/lib/node-esm/chunk-Y475KZTX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YO46JGAE.mjs +21 -0
- package/dist/lib/node-esm/chunk-YO46JGAE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1102 -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 +12 -0
- package/dist/lib/node-esm/meta.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +9 -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/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentContainer.d.ts +1 -1
- package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts +1 -5
- 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 +10 -0
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -0
- package/dist/types/src/components/testing.d.ts +2 -0
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -4
- package/dist/types/src/meta.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 +40 -37
- package/src/ThreadPlugin.tsx +70 -182
- package/src/components/ChatContainer.tsx +7 -8
- package/src/components/CommentContainer.tsx +18 -19
- package/src/components/Comments.stories.tsx +2 -2
- package/src/components/CommentsContainer.tsx +18 -31
- package/src/components/MessageContainer.tsx +2 -1
- package/src/components/ThreadComplementary.tsx +113 -0
- package/src/meta.tsx +1 -5
- package/src/types.ts +1 -1
- package/dist/lib/browser/chunk-5IBJO53M.mjs.map +0 -7
- package/dist/lib/browser/chunk-P7ZE5N5M.mjs.map +0 -7
- package/dist/lib/node/chunk-5PZNPPQF.cjs.map +0 -7
- package/dist/lib/node/chunk-BWBONZGU.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-4VU752F4.mjs.map} +0 -0
- /package/dist/lib/browser/{ThreadMain-ZDCRC6RG.mjs.map → ThreadMain-ML3P4XSD.mjs.map} +0 -0
- /package/dist/lib/node/{ThreadArticle-DO56JXBU.cjs.map → ThreadArticle-ERUHPHVT.cjs.map} +0 -0
- /package/dist/lib/node/{ThreadMain-XJX75GHG.cjs.map → ThreadMain-6DN7FDNB.cjs.map} +0 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,73 +28,75 @@ 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_FXD3DYMO.ThreadAction,
|
|
32
32
|
ThreadPlugin: () => ThreadPlugin,
|
|
33
33
|
default: () => src_default,
|
|
34
|
-
useAnalyticsCallback: () =>
|
|
35
|
-
useOnEditAnalytics: () =>
|
|
36
|
-
useStatus: () =>
|
|
34
|
+
useAnalyticsCallback: () => import_chunk_PZVUW4W2.useAnalyticsCallback,
|
|
35
|
+
useOnEditAnalytics: () => import_chunk_PZVUW4W2.useOnEditAnalytics,
|
|
36
|
+
useStatus: () => import_chunk_PZVUW4W2.useStatus
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(node_exports);
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var import_react = require("@phosphor-icons/react");
|
|
39
|
+
var import_chunk_FXD3DYMO = require("./chunk-FXD3DYMO.cjs");
|
|
40
|
+
var import_chunk_PZVUW4W2 = require("./chunk-PZVUW4W2.cjs");
|
|
41
|
+
var import_chunk_6EVXCSDS = require("./chunk-6EVXCSDS.cjs");
|
|
43
42
|
var import_signals_core = require("@preact/signals-core");
|
|
44
|
-
var
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
45
44
|
var import_app_framework = require("@dxos/app-framework");
|
|
46
45
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
47
46
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
48
47
|
var import_local_storage = require("@dxos/local-storage");
|
|
49
|
-
var
|
|
48
|
+
var import_log = require("@dxos/log");
|
|
50
49
|
var import_plugin_client = require("@dxos/plugin-client");
|
|
51
50
|
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
52
|
-
var import_types = require("@dxos/plugin-markdown/types");
|
|
53
51
|
var import_meta = require("@dxos/plugin-observability/meta");
|
|
54
52
|
var import_plugin_space = require("@dxos/plugin-space");
|
|
55
|
-
var
|
|
53
|
+
var import_types = require("@dxos/plugin-space/types");
|
|
56
54
|
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
55
|
var import_react_ui_editor = require("@dxos/react-ui-editor");
|
|
60
56
|
var import_react_ui_thread = require("@dxos/react-ui-thread");
|
|
61
57
|
var import_util = require("@dxos/util");
|
|
58
|
+
var import_react2 = __toESM(require("react"));
|
|
62
59
|
var import_react3 = __toESM(require("react"));
|
|
63
|
-
var import_react4 = __toESM(require("react"));
|
|
64
60
|
var import_plugin_settings = require("@dxos/plugin-settings");
|
|
65
|
-
var
|
|
66
|
-
var
|
|
67
|
-
var
|
|
61
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
62
|
+
var import_react4 = require("@phosphor-icons/react");
|
|
63
|
+
var import_react5 = __toESM(require("react"));
|
|
68
64
|
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
69
|
-
var
|
|
65
|
+
var import_types2 = require("@dxos/plugin-space/types");
|
|
70
66
|
var import_echo2 = require("@dxos/react-client/echo");
|
|
71
67
|
var import_halo = require("@dxos/react-client/halo");
|
|
72
|
-
var
|
|
68
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
|
73
69
|
var import_react_ui_editor2 = require("@dxos/react-ui-editor");
|
|
74
70
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
75
71
|
var import_react_ui_thread2 = require("@dxos/react-ui-thread");
|
|
76
72
|
var import_util2 = require("@dxos/util");
|
|
77
|
-
var
|
|
73
|
+
var import_react6 = require("@phosphor-icons/react");
|
|
74
|
+
var import_react7 = __toESM(require("react"));
|
|
75
|
+
var import_echo3 = require("@dxos/react-client/echo");
|
|
76
|
+
var import_react_ui3 = require("@dxos/react-ui");
|
|
77
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
78
78
|
var import_react8 = __toESM(require("react"));
|
|
79
|
+
var import_app_framework2 = require("@dxos/app-framework");
|
|
80
|
+
var import_echo4 = require("@dxos/react-client/echo");
|
|
79
81
|
var import_react_ui4 = require("@dxos/react-ui");
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
+
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
83
|
+
var import_util3 = require("@dxos/util");
|
|
82
84
|
var ThreadSettings = ({ settings }) => {
|
|
83
|
-
const { t } = (0,
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
86
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, /* @__PURE__ */ import_react3.default.createElement(import_plugin_settings.SettingsValue, {
|
|
85
87
|
label: t("settings standalone label")
|
|
86
|
-
}, /* @__PURE__ */
|
|
88
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Input.Switch, {
|
|
87
89
|
checked: settings.standalone,
|
|
88
90
|
onCheckedChange: (checked) => settings.standalone = !!checked
|
|
89
91
|
})));
|
|
90
92
|
};
|
|
91
93
|
var sizeClass = (0, import_react_ui_theme.getSize)(4);
|
|
92
94
|
var ToggleResolvedButton = ({ isResolved, onResolve }) => {
|
|
93
|
-
const { t } = (0,
|
|
95
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
94
96
|
const label = t(isResolved ? "mark as unresolved label" : "mark as resolved label");
|
|
95
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
96
98
|
asChild: true
|
|
97
|
-
}, /* @__PURE__ */
|
|
99
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Button, {
|
|
98
100
|
variant: "ghost",
|
|
99
101
|
"data-testid": "thread.toggle-resolved",
|
|
100
102
|
onClick: onResolve,
|
|
@@ -102,23 +104,23 @@ var ToggleResolvedButton = ({ isResolved, onResolve }) => {
|
|
|
102
104
|
"min-bs-0 p-1",
|
|
103
105
|
!isResolved && import_react_ui_theme.hoverableControlItem
|
|
104
106
|
]
|
|
105
|
-
}, /* @__PURE__ */
|
|
107
|
+
}, /* @__PURE__ */ import_react5.default.createElement("span", {
|
|
106
108
|
className: "sr-only"
|
|
107
|
-
}, label), isResolved ? /* @__PURE__ */
|
|
109
|
+
}, label), isResolved ? /* @__PURE__ */ import_react5.default.createElement(import_react4.CheckCircle, {
|
|
108
110
|
className: sizeClass,
|
|
109
111
|
weight: "fill"
|
|
110
|
-
}) : /* @__PURE__ */
|
|
112
|
+
}) : /* @__PURE__ */ import_react5.default.createElement(import_react4.CheckCircle, {
|
|
111
113
|
className: sizeClass
|
|
112
|
-
}))), /* @__PURE__ */
|
|
114
|
+
}))), /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
113
115
|
classNames: "z-[21]"
|
|
114
|
-
}, label, /* @__PURE__ */
|
|
116
|
+
}, label, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Arrow, null))));
|
|
115
117
|
};
|
|
116
118
|
var DeleteThreadButton = ({ onDelete }) => {
|
|
117
|
-
const { t } = (0,
|
|
119
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
118
120
|
const label = t("delete thread label");
|
|
119
|
-
return /* @__PURE__ */
|
|
121
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
120
122
|
asChild: true
|
|
121
|
-
}, /* @__PURE__ */
|
|
123
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Button, {
|
|
122
124
|
variant: "ghost",
|
|
123
125
|
"data-testid": "thread.delete",
|
|
124
126
|
onClick: onDelete,
|
|
@@ -126,28 +128,27 @@ var DeleteThreadButton = ({ onDelete }) => {
|
|
|
126
128
|
"min-bs-0 p-1",
|
|
127
129
|
import_react_ui_theme.hoverableControlItem
|
|
128
130
|
]
|
|
129
|
-
}, /* @__PURE__ */
|
|
131
|
+
}, /* @__PURE__ */ import_react5.default.createElement("span", {
|
|
130
132
|
className: "sr-only"
|
|
131
|
-
}, label), /* @__PURE__ */
|
|
133
|
+
}, label), /* @__PURE__ */ import_react5.default.createElement(import_react4.X, {
|
|
132
134
|
className: sizeClass
|
|
133
|
-
}))), /* @__PURE__ */
|
|
135
|
+
}))), /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
134
136
|
classNames: "z-[21]"
|
|
135
|
-
}, label, /* @__PURE__ */
|
|
137
|
+
}, label, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Arrow, null))));
|
|
136
138
|
};
|
|
137
|
-
var CommentContainer = ({ thread, detached, context, current,
|
|
139
|
+
var CommentContainer = ({ thread, detached, context, current, onAttend, onThreadDelete, onMessageDelete, onResolve, onComment }) => {
|
|
138
140
|
const identity = (0, import_halo.useIdentity)();
|
|
139
141
|
const space = (0, import_echo2.getSpace)(thread);
|
|
140
142
|
const members = (0, import_echo2.useMembers)(space?.key);
|
|
141
|
-
const activity = (0,
|
|
142
|
-
const { t } = (0,
|
|
143
|
-
const threadScrollRef = (0,
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const [_count, _setCount] = (0, import_react6.useState)(0);
|
|
143
|
+
const activity = (0, import_chunk_PZVUW4W2.useStatus)(space, (0, import_echo2.fullyQualifiedId)(thread));
|
|
144
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
145
|
+
const threadScrollRef = (0, import_react5.useRef)(null);
|
|
146
|
+
const { themeMode } = (0, import_react_ui2.useThemeContext)();
|
|
147
|
+
const textboxMetadata = (0, import_chunk_PZVUW4W2.getMessageMetadata)((0, import_echo2.fullyQualifiedId)(thread), identity);
|
|
148
|
+
const [_count, _setCount] = (0, import_react5.useState)(0);
|
|
148
149
|
const rerenderEditor = () => _setCount((count) => count + 1);
|
|
149
|
-
const messageRef = (0,
|
|
150
|
-
const extensions = (0,
|
|
150
|
+
const messageRef = (0, import_react5.useRef)("");
|
|
151
|
+
const extensions = (0, import_react5.useMemo)(() => [
|
|
151
152
|
(0, import_react_ui_editor2.createBasicExtensions)({
|
|
152
153
|
placeholder: t("message placeholder")
|
|
153
154
|
}),
|
|
@@ -157,24 +158,19 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
157
158
|
(0, import_react_ui_editor2.listener)({
|
|
158
159
|
onChange: (text) => messageRef.current = text
|
|
159
160
|
}),
|
|
160
|
-
|
|
161
|
+
import_chunk_PZVUW4W2.command
|
|
161
162
|
], [
|
|
162
163
|
_count
|
|
163
164
|
]);
|
|
164
|
-
(0, import_react6.useEffect)(() => {
|
|
165
|
-
setAutoFocus(!!autoFocusTextbox);
|
|
166
|
-
}, [
|
|
167
|
-
autoFocusTextbox
|
|
168
|
-
]);
|
|
169
165
|
const scrollToEnd = (behavior) => setTimeout(() => threadScrollRef.current?.scrollIntoView({
|
|
170
166
|
behavior,
|
|
171
167
|
block: "end"
|
|
172
168
|
}), 10);
|
|
173
|
-
const handleCreate = (0,
|
|
169
|
+
const handleCreate = (0, import_react5.useCallback)(() => {
|
|
174
170
|
if (!messageRef.current) {
|
|
175
171
|
return false;
|
|
176
172
|
}
|
|
177
|
-
thread.messages.push((0, import_echo_schema3.create)(
|
|
173
|
+
thread.messages.push((0, import_echo_schema3.create)(import_types2.MessageType, {
|
|
178
174
|
sender: {
|
|
179
175
|
identityKey: identity.identityKey.toHex()
|
|
180
176
|
},
|
|
@@ -184,7 +180,6 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
184
180
|
}));
|
|
185
181
|
onComment?.(thread);
|
|
186
182
|
messageRef.current = "";
|
|
187
|
-
setAutoFocus(true);
|
|
188
183
|
scrollToEnd("instant");
|
|
189
184
|
rerenderEditor();
|
|
190
185
|
return true;
|
|
@@ -192,64 +187,51 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
192
187
|
thread,
|
|
193
188
|
identity
|
|
194
189
|
]);
|
|
195
|
-
|
|
196
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui_thread2.Thread, {
|
|
190
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.Thread, {
|
|
197
191
|
onClickCapture: onAttend,
|
|
198
192
|
onFocusCapture: onAttend,
|
|
199
193
|
current,
|
|
200
|
-
id: thread
|
|
201
|
-
}, /* @__PURE__ */
|
|
194
|
+
id: (0, import_echo2.fullyQualifiedId)(thread)
|
|
195
|
+
}, /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
202
196
|
role: "none",
|
|
203
197
|
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__ */
|
|
198
|
+
}, detached ? /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
205
199
|
asChild: true
|
|
206
|
-
}, /* @__PURE__ */
|
|
200
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.ThreadHeading, {
|
|
207
201
|
detached: true
|
|
208
|
-
}, thread.name ?? t("thread title placeholder"))), /* @__PURE__ */
|
|
202
|
+
}, thread.name ?? t("thread title placeholder"))), /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
209
203
|
classNames: "z-[21]",
|
|
210
204
|
side: "top"
|
|
211
|
-
}, t("detached thread label"), /* @__PURE__ */
|
|
205
|
+
}, t("detached thread label"), /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Arrow, null)))) : /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.ThreadHeading, null, thread.name ?? t("thread title placeholder")), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
212
206
|
className: "flex flex-row items-center pli-1"
|
|
213
|
-
}, thread.status === "staged" && /* @__PURE__ */
|
|
207
|
+
}, thread.status === "staged" && /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tag, {
|
|
214
208
|
palette: "neutral"
|
|
215
|
-
}, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */
|
|
209
|
+
}, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */ import_react5.default.createElement(ToggleResolvedButton, {
|
|
216
210
|
isResolved: thread?.status === "resolved",
|
|
217
211
|
onResolve
|
|
218
|
-
}), onThreadDelete && /* @__PURE__ */
|
|
212
|
+
}), onThreadDelete && /* @__PURE__ */ import_react5.default.createElement(DeleteThreadButton, {
|
|
219
213
|
onDelete: onThreadDelete
|
|
220
|
-
}))), thread.messages.filter(import_util2.nonNullable).map((message) => /* @__PURE__ */
|
|
214
|
+
}))), thread.messages.filter(import_util2.nonNullable).map((message) => /* @__PURE__ */ import_react5.default.createElement(import_chunk_PZVUW4W2.MessageContainer, {
|
|
221
215
|
key: message.id,
|
|
222
216
|
message,
|
|
223
217
|
members,
|
|
224
|
-
onDelete:
|
|
225
|
-
})), /* @__PURE__ */
|
|
218
|
+
onDelete: (id) => onMessageDelete?.(id)
|
|
219
|
+
})), /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.MessageTextbox, {
|
|
226
220
|
extensions,
|
|
227
|
-
autoFocus,
|
|
228
221
|
onSend: handleCreate,
|
|
229
222
|
...textboxMetadata
|
|
230
|
-
}), /* @__PURE__ */
|
|
223
|
+
}), /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.ThreadFooter, {
|
|
231
224
|
activity
|
|
232
|
-
}, t("activity message")), /* @__PURE__ */
|
|
225
|
+
}, t("activity message")), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
233
226
|
role: "none",
|
|
234
227
|
className: "bs-px -mbs-px",
|
|
235
228
|
ref: threadScrollRef
|
|
236
229
|
}));
|
|
237
230
|
};
|
|
238
|
-
var
|
|
239
|
-
const { t } = (0,
|
|
240
|
-
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
241
|
-
role: "none",
|
|
242
|
-
className: "flex items-center"
|
|
243
|
-
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui_deck.PlankHeading.Button, {
|
|
244
|
-
attendableId
|
|
245
|
-
}, /* @__PURE__ */ import_react8.default.createElement(import_react7.Quotes, import_react_ui_deck.plankHeadingIconProps)), /* @__PURE__ */ import_react8.default.createElement(import_react_ui_deck.PlankHeading.Label, {
|
|
246
|
-
attendableId
|
|
247
|
-
}, t("comments heading")));
|
|
248
|
-
};
|
|
249
|
-
var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTextbox, showResolvedThreads, onThreadAttend, onThreadDelete, onMessageDelete, onThreadToggleResolved, ...props }) => {
|
|
250
|
-
const { t } = (0, import_react_ui4.useTranslation)(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
231
|
+
var CommentsContainer = ({ threads, detached = [], currentId, showResolvedThreads, onThreadAttend, onThreadDelete, onMessageDelete, onThreadToggleResolved, ...props }) => {
|
|
232
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
251
233
|
const filteredThreads = showResolvedThreads ? threads : threads.filter((thread) => !(thread?.status === "resolved"));
|
|
252
|
-
(0,
|
|
234
|
+
(0, import_react7.useEffect)(() => {
|
|
253
235
|
if (currentId) {
|
|
254
236
|
document.getElementById(currentId)?.scrollIntoView({
|
|
255
237
|
behavior: "smooth",
|
|
@@ -259,46 +241,151 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
|
|
|
259
241
|
}, [
|
|
260
242
|
currentId
|
|
261
243
|
]);
|
|
262
|
-
return /* @__PURE__ */
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
onThreadDelete
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
onMessageDelete
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
244
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, filteredThreads.length > 0 ? filteredThreads.map((thread) => {
|
|
245
|
+
const threadId = (0, import_echo3.fullyQualifiedId)(thread);
|
|
246
|
+
return /* @__PURE__ */ import_react7.default.createElement(CommentContainer, {
|
|
247
|
+
key: threadId,
|
|
248
|
+
thread,
|
|
249
|
+
current: currentId === threadId,
|
|
250
|
+
detached: detached.includes(threadId),
|
|
251
|
+
...onThreadAttend && {
|
|
252
|
+
onAttend: () => onThreadAttend(thread)
|
|
253
|
+
},
|
|
254
|
+
...onThreadDelete && {
|
|
255
|
+
onThreadDelete: () => onThreadDelete(thread)
|
|
256
|
+
},
|
|
257
|
+
...onMessageDelete && {
|
|
258
|
+
onMessageDelete: (messageId) => onMessageDelete(thread, messageId)
|
|
259
|
+
},
|
|
260
|
+
...onThreadToggleResolved && {
|
|
261
|
+
onResolve: () => onThreadToggleResolved(thread)
|
|
262
|
+
},
|
|
263
|
+
...props
|
|
264
|
+
});
|
|
265
|
+
}) : /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
282
266
|
role: "alert",
|
|
283
267
|
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
|
-
}, /* @__PURE__ */
|
|
268
|
+
}, /* @__PURE__ */ import_react7.default.createElement("h2", {
|
|
285
269
|
className: "mbe-2 font-medium text-baseText"
|
|
286
|
-
}, t("no comments title")), /* @__PURE__ */
|
|
270
|
+
}, t("no comments title")), /* @__PURE__ */ import_react7.default.createElement("p", null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Trans, {
|
|
287
271
|
t,
|
|
288
272
|
i18nKey: "no comments message",
|
|
289
273
|
components: {
|
|
290
|
-
commentIcon: /* @__PURE__ */
|
|
274
|
+
commentIcon: /* @__PURE__ */ import_react7.default.createElement(import_react6.ChatText, {
|
|
291
275
|
className: "inline-block"
|
|
292
276
|
})
|
|
293
277
|
}
|
|
294
278
|
}))));
|
|
295
279
|
};
|
|
296
|
-
var ThreadMain =
|
|
297
|
-
var ThreadArticle =
|
|
280
|
+
var ThreadMain = import_react2.default.lazy(() => import("./ThreadMain-6DN7FDNB.cjs"));
|
|
281
|
+
var ThreadArticle = import_react2.default.lazy(() => import("./ThreadArticle-ERUHPHVT.cjs"));
|
|
282
|
+
var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
|
|
283
|
+
var ThreadComplementary = ({ role, subject, stagedThreads, current, showResolvedThreads }) => {
|
|
284
|
+
const dispatch = (0, import_app_framework2.useIntentDispatcher)();
|
|
285
|
+
const threadsIntegrators = (0, import_app_framework2.useResolvePlugins)(providesThreadsConfig);
|
|
286
|
+
const threadProvides = (0, import_react8.useMemo)(() => threadsIntegrators.map((p) => p.provides.thread), [
|
|
287
|
+
threadsIntegrators
|
|
288
|
+
]);
|
|
289
|
+
const createSort = (0, import_react8.useMemo)(() => threadProvides.find((p) => p.predicate(subject))?.createSort, [
|
|
290
|
+
threadProvides,
|
|
291
|
+
subject
|
|
292
|
+
]);
|
|
293
|
+
const sort = (0, import_react8.useMemo)(() => createSort?.(subject), [
|
|
294
|
+
createSort,
|
|
295
|
+
subject
|
|
296
|
+
]);
|
|
297
|
+
const threads = (0, import_react8.useMemo)(() => {
|
|
298
|
+
return subject.threads.concat(stagedThreads ?? []).filter(import_util3.nonNullable);
|
|
299
|
+
}, [
|
|
300
|
+
JSON.stringify(subject.threads),
|
|
301
|
+
JSON.stringify(stagedThreads)
|
|
302
|
+
]);
|
|
303
|
+
const detachedIds = (0, import_react8.useMemo)(() => {
|
|
304
|
+
return threads.filter(({ anchor }) => !anchor).map((thread) => (0, import_echo4.fullyQualifiedId)(thread));
|
|
305
|
+
}, [
|
|
306
|
+
threads
|
|
307
|
+
]);
|
|
308
|
+
(0, import_react8.useEffect)(() => {
|
|
309
|
+
if (!sort) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
threads.sort((a, b) => sort(a?.anchor, b?.anchor));
|
|
313
|
+
}, [
|
|
314
|
+
sort,
|
|
315
|
+
threads
|
|
316
|
+
]);
|
|
317
|
+
const attended = (0, import_react_ui_attention.useAttended)();
|
|
318
|
+
const qualifiedSubjectId = (0, import_echo4.fullyQualifiedId)(subject);
|
|
319
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
320
|
+
role: "none",
|
|
321
|
+
className: "contents"
|
|
322
|
+
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Root, {
|
|
323
|
+
classNames: "row-span-2"
|
|
324
|
+
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Viewport, null, /* @__PURE__ */ import_react8.default.createElement(CommentsContainer, {
|
|
325
|
+
threads,
|
|
326
|
+
detached: detachedIds,
|
|
327
|
+
currentId: attended.includes(qualifiedSubjectId) ? current : void 0,
|
|
328
|
+
showResolvedThreads,
|
|
329
|
+
onThreadAttend: (thread) => {
|
|
330
|
+
const threadId = (0, import_echo4.fullyQualifiedId)(thread);
|
|
331
|
+
if (current !== threadId) {
|
|
332
|
+
current = threadId;
|
|
333
|
+
void dispatch?.([
|
|
334
|
+
{
|
|
335
|
+
action: import_app_framework2.LayoutAction.SCROLL_INTO_VIEW,
|
|
336
|
+
data: {
|
|
337
|
+
id: (0, import_echo4.fullyQualifiedId)(subject),
|
|
338
|
+
thread: threadId,
|
|
339
|
+
cursor: thread.anchor
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
]);
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
onThreadDelete: (thread) => {
|
|
346
|
+
return dispatch({
|
|
347
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
348
|
+
action: import_chunk_FXD3DYMO.ThreadAction.DELETE,
|
|
349
|
+
data: {
|
|
350
|
+
subject,
|
|
351
|
+
thread
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
onMessageDelete: (thread, messageId) => dispatch({
|
|
356
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
357
|
+
action: import_chunk_FXD3DYMO.ThreadAction.DELETE_MESSAGE,
|
|
358
|
+
data: {
|
|
359
|
+
subject,
|
|
360
|
+
thread,
|
|
361
|
+
messageId
|
|
362
|
+
}
|
|
363
|
+
}),
|
|
364
|
+
onThreadToggleResolved: (thread) => dispatch({
|
|
365
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
366
|
+
action: import_chunk_FXD3DYMO.ThreadAction.TOGGLE_RESOLVED,
|
|
367
|
+
data: {
|
|
368
|
+
thread
|
|
369
|
+
}
|
|
370
|
+
}),
|
|
371
|
+
onComment: (thread) => {
|
|
372
|
+
void dispatch({
|
|
373
|
+
action: import_chunk_FXD3DYMO.ThreadAction.ON_MESSAGE_ADD,
|
|
374
|
+
data: {
|
|
375
|
+
thread,
|
|
376
|
+
subject
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}), /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
381
|
+
role: "none",
|
|
382
|
+
className: "bs-10"
|
|
383
|
+
}), /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Scrollbar, null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Thumb, null)))));
|
|
384
|
+
};
|
|
298
385
|
var translations_default = [
|
|
299
386
|
{
|
|
300
387
|
"en-US": {
|
|
301
|
-
[
|
|
388
|
+
[import_chunk_6EVXCSDS.THREAD_PLUGIN]: {
|
|
302
389
|
"plugin name": "Threads",
|
|
303
390
|
"channel name placeholder": "New channel",
|
|
304
391
|
"channel title label": "Title",
|
|
@@ -329,12 +416,12 @@ var translations_default = [
|
|
|
329
416
|
}
|
|
330
417
|
}
|
|
331
418
|
];
|
|
419
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-thread/src/ThreadPlugin.tsx";
|
|
332
420
|
var initialViewState = {
|
|
333
421
|
showResolvedThreads: false
|
|
334
422
|
};
|
|
335
|
-
var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
|
|
336
423
|
var ThreadPlugin = () => {
|
|
337
|
-
const settings = new import_local_storage.LocalStorageStore(
|
|
424
|
+
const settings = new import_local_storage.LocalStorageStore(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
338
425
|
const state = (0, import_echo_schema2.create)({
|
|
339
426
|
staging: {}
|
|
340
427
|
});
|
|
@@ -347,13 +434,11 @@ var ThreadPlugin = () => {
|
|
|
347
434
|
}
|
|
348
435
|
return viewStore[subjectId];
|
|
349
436
|
};
|
|
350
|
-
let attentionPlugin;
|
|
351
437
|
let navigationPlugin;
|
|
352
438
|
let intentPlugin;
|
|
353
|
-
let dispatch;
|
|
354
439
|
const unsubscribeCallbacks = [];
|
|
355
440
|
return {
|
|
356
|
-
meta:
|
|
441
|
+
meta: import_chunk_6EVXCSDS.meta_default,
|
|
357
442
|
ready: async (plugins) => {
|
|
358
443
|
settings.prop({
|
|
359
444
|
key: "standalone",
|
|
@@ -361,36 +446,8 @@ var ThreadPlugin = () => {
|
|
|
361
446
|
allowUndefined: true
|
|
362
447
|
})
|
|
363
448
|
});
|
|
364
|
-
attentionPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_attention.parseAttentionPlugin);
|
|
365
449
|
navigationPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseNavigationPlugin);
|
|
366
450
|
intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
367
|
-
dispatch = intentPlugin?.provides.intent.dispatch;
|
|
368
|
-
const graphPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
|
|
369
|
-
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
370
|
-
if (!client) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
const channelsQuery = client.spaces.query(import_echo.Filter.schema(import_types2.ChannelType));
|
|
374
|
-
const queryUnsubscribe = channelsQuery.subscribe();
|
|
375
|
-
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
376
|
-
const attention = attentionPlugin?.provides.attention;
|
|
377
|
-
if (!attention?.attended) {
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
const firstAttendedNodeWithComments = Array.from(attention.attended).map((id) => graphPlugin?.provides.graph.findNode(id)).find((node) => node?.data instanceof import_types.DocumentType && (node.data.threads?.length ?? 0) > 0);
|
|
381
|
-
if (firstAttendedNodeWithComments) {
|
|
382
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
383
|
-
action: import_app_framework.NavigationAction.OPEN,
|
|
384
|
-
data: {
|
|
385
|
-
activeParts: {
|
|
386
|
-
complementary: `${firstAttendedNodeWithComments.id}${import_app_framework.SLUG_PATH_SEPARATOR}comments`
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
unsubscribeCallbacks.push(queryUnsubscribe);
|
|
393
|
-
unsubscribeCallbacks.push(unsubscribe);
|
|
394
451
|
},
|
|
395
452
|
unload: async () => {
|
|
396
453
|
unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
|
|
@@ -399,27 +456,26 @@ var ThreadPlugin = () => {
|
|
|
399
456
|
settings: settings.values,
|
|
400
457
|
metadata: {
|
|
401
458
|
records: {
|
|
402
|
-
[
|
|
459
|
+
[import_types.ChannelType.typename]: {
|
|
403
460
|
placeholder: [
|
|
404
461
|
"channel title placeholder",
|
|
405
462
|
{
|
|
406
|
-
ns:
|
|
463
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
407
464
|
}
|
|
408
465
|
],
|
|
409
|
-
icon:
|
|
410
|
-
iconSymbol: "ph--chat--regular",
|
|
466
|
+
icon: "ph--chat--regular",
|
|
411
467
|
// TODO(wittjosiah): Move out of metadata.
|
|
412
468
|
loadReferences: (channel) => (0, import_echo.loadObjectReferences)(channel, (channel2) => channel2.threads)
|
|
413
469
|
},
|
|
414
|
-
[
|
|
470
|
+
[import_types.ThreadType.typename]: {
|
|
415
471
|
// TODO(wittjosiah): Move out of metadata.
|
|
416
472
|
loadReferences: (thread) => (0, import_echo.loadObjectReferences)(thread, (thread2) => thread2.messages)
|
|
417
473
|
},
|
|
418
|
-
[
|
|
474
|
+
[import_types.MessageType.typename]: {
|
|
419
475
|
// TODO(wittjosiah): Move out of metadata.
|
|
420
476
|
loadReferences: (message) => []
|
|
421
477
|
},
|
|
422
|
-
[
|
|
478
|
+
[import_chunk_6EVXCSDS.THREAD_ITEM]: {
|
|
423
479
|
parse: (item, type) => {
|
|
424
480
|
switch (type) {
|
|
425
481
|
case "node":
|
|
@@ -446,49 +502,56 @@ var ThreadPlugin = () => {
|
|
|
446
502
|
],
|
|
447
503
|
echo: {
|
|
448
504
|
schema: [
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
505
|
+
import_types.ChannelType,
|
|
506
|
+
import_types.ThreadType,
|
|
507
|
+
import_types.MessageType
|
|
452
508
|
]
|
|
453
509
|
},
|
|
454
510
|
graph: {
|
|
455
511
|
builder: (plugins) => {
|
|
456
512
|
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
457
|
-
const
|
|
513
|
+
const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
|
|
458
514
|
const metadataResolver = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
459
|
-
if (!client || !
|
|
515
|
+
if (!client || !dispatch || !metadataResolver) {
|
|
460
516
|
return [];
|
|
461
517
|
}
|
|
462
518
|
return [
|
|
463
519
|
(0, import_plugin_graph.createExtension)({
|
|
464
|
-
id: `${
|
|
520
|
+
id: `${import_chunk_6EVXCSDS.THREAD_PLUGIN}/comments-for-subject`,
|
|
465
521
|
resolver: ({ id }) => {
|
|
466
522
|
if (!id.endsWith("~comments")) {
|
|
467
523
|
return;
|
|
468
524
|
}
|
|
469
|
-
const
|
|
470
|
-
const [spaceId, objectId] =
|
|
525
|
+
const subjectId = id.split("~").at(0);
|
|
526
|
+
const [spaceId, objectId] = subjectId?.split(":") ?? [];
|
|
471
527
|
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
472
|
-
const
|
|
473
|
-
|
|
528
|
+
const object = (0, import_plugin_graph.toSignal)((onChange) => {
|
|
529
|
+
const timeout = setTimeout(async () => {
|
|
530
|
+
await space?.db.loadObjectById(objectId);
|
|
531
|
+
onChange();
|
|
532
|
+
});
|
|
533
|
+
return () => clearTimeout(timeout);
|
|
534
|
+
}, () => space?.db.getObjectById(objectId), subjectId);
|
|
535
|
+
if (!object || !subjectId) {
|
|
474
536
|
return;
|
|
475
537
|
}
|
|
476
|
-
const
|
|
477
|
-
const label =
|
|
538
|
+
const meta = metadataResolver((0, import_echo_schema.getTypename)(object) ?? "");
|
|
539
|
+
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
478
540
|
"unnamed object threads label",
|
|
479
541
|
{
|
|
480
|
-
ns:
|
|
542
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
481
543
|
}
|
|
482
544
|
];
|
|
483
|
-
const viewState = getViewState(
|
|
545
|
+
const viewState = getViewState(subjectId);
|
|
484
546
|
return {
|
|
485
547
|
id,
|
|
486
548
|
type: "orphan-comments-for-subject",
|
|
487
|
-
data:
|
|
549
|
+
data: null,
|
|
488
550
|
properties: {
|
|
489
|
-
icon:
|
|
551
|
+
icon: "ph--chat-text--regular",
|
|
490
552
|
label,
|
|
491
|
-
showResolvedThreads: viewState.showResolvedThreads
|
|
553
|
+
showResolvedThreads: viewState.showResolvedThreads,
|
|
554
|
+
object
|
|
492
555
|
}
|
|
493
556
|
};
|
|
494
557
|
},
|
|
@@ -502,7 +565,7 @@ var ThreadPlugin = () => {
|
|
|
502
565
|
const toggle = () => {
|
|
503
566
|
const newToggleState = !viewState.showResolvedThreads;
|
|
504
567
|
viewState.showResolvedThreads = newToggleState;
|
|
505
|
-
void
|
|
568
|
+
void dispatch({
|
|
506
569
|
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
507
570
|
data: {
|
|
508
571
|
name: "threads.toggle-show-resolved",
|
|
@@ -516,25 +579,26 @@ var ThreadPlugin = () => {
|
|
|
516
579
|
};
|
|
517
580
|
return [
|
|
518
581
|
{
|
|
519
|
-
id: `${
|
|
582
|
+
id: `${import_chunk_6EVXCSDS.THREAD_PLUGIN}/toggle-show-resolved/${node.id}`,
|
|
520
583
|
data: toggle,
|
|
521
584
|
properties: {
|
|
522
585
|
label: [
|
|
523
586
|
"toggle show resolved",
|
|
524
587
|
{
|
|
525
|
-
ns:
|
|
588
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
526
589
|
}
|
|
527
590
|
],
|
|
528
591
|
menuItemType: "toggle",
|
|
529
592
|
isChecked: viewState.showResolvedThreads,
|
|
530
|
-
testId: "threadPlugin.toggleShowResolved"
|
|
593
|
+
testId: "threadPlugin.toggleShowResolved",
|
|
594
|
+
icon: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
|
|
531
595
|
}
|
|
532
596
|
}
|
|
533
597
|
];
|
|
534
598
|
}
|
|
535
599
|
}),
|
|
536
600
|
(0, import_plugin_graph.createExtension)({
|
|
537
|
-
id:
|
|
601
|
+
id: import_chunk_FXD3DYMO.ThreadAction.CREATE,
|
|
538
602
|
filter: (node) => !!settings.values.standalone && (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
539
603
|
actions: ({ node }) => {
|
|
540
604
|
const id = node.id.split("/").at(-1);
|
|
@@ -547,12 +611,12 @@ var ThreadPlugin = () => {
|
|
|
547
611
|
}
|
|
548
612
|
return [
|
|
549
613
|
{
|
|
550
|
-
id: `${
|
|
614
|
+
id: `${import_chunk_6EVXCSDS.THREAD_PLUGIN}/create/${node.id}`,
|
|
551
615
|
data: async () => {
|
|
552
|
-
await
|
|
616
|
+
await dispatch([
|
|
553
617
|
{
|
|
554
|
-
plugin:
|
|
555
|
-
action:
|
|
618
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
619
|
+
action: import_chunk_FXD3DYMO.ThreadAction.CREATE
|
|
556
620
|
},
|
|
557
621
|
{
|
|
558
622
|
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
@@ -569,11 +633,10 @@ var ThreadPlugin = () => {
|
|
|
569
633
|
label: [
|
|
570
634
|
"create channel label",
|
|
571
635
|
{
|
|
572
|
-
ns:
|
|
636
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
573
637
|
}
|
|
574
638
|
],
|
|
575
|
-
icon:
|
|
576
|
-
iconSymbol: "ph--chat--regular",
|
|
639
|
+
icon: "ph--chat--regular",
|
|
577
640
|
testId: "threadPlugin.createObject"
|
|
578
641
|
}
|
|
579
642
|
}
|
|
@@ -587,21 +650,19 @@ var ThreadPlugin = () => {
|
|
|
587
650
|
component: ({ data, role }) => {
|
|
588
651
|
switch (role) {
|
|
589
652
|
case "main": {
|
|
590
|
-
return data.active instanceof
|
|
653
|
+
return data.active instanceof import_types.ChannelType && data.active.threads[0] ? /* @__PURE__ */ import_react.default.createElement(ThreadMain, {
|
|
591
654
|
thread: data.active.threads[0]
|
|
592
655
|
}) : null;
|
|
593
656
|
}
|
|
594
657
|
case "settings": {
|
|
595
|
-
return data.plugin ===
|
|
658
|
+
return data.plugin === import_chunk_6EVXCSDS.meta_default.id ? /* @__PURE__ */ import_react.default.createElement(ThreadSettings, {
|
|
596
659
|
settings: settings.values
|
|
597
660
|
}) : null;
|
|
598
661
|
}
|
|
599
662
|
case "article":
|
|
600
663
|
case "complementary": {
|
|
601
664
|
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]) {
|
|
665
|
+
if (data.object instanceof import_types.ChannelType && data.object.threads[0]) {
|
|
605
666
|
const channel = data.object;
|
|
606
667
|
if ((0, import_app_framework.isLayoutParts)(location?.active) && location.active.main) {
|
|
607
668
|
const layoutEntries = location.active.main;
|
|
@@ -609,101 +670,32 @@ var ThreadPlugin = () => {
|
|
|
609
670
|
if (currentPosition > 0) {
|
|
610
671
|
const objectToTheLeft = layoutEntries[currentPosition - 1];
|
|
611
672
|
const context = (0, import_echo.getSpace)(data.object)?.db.getObjectById(objectToTheLeft.id);
|
|
612
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ import_react.default.createElement(ThreadArticle, {
|
|
613
674
|
thread: data.object.threads[0],
|
|
614
675
|
context
|
|
615
676
|
});
|
|
616
677
|
}
|
|
617
678
|
}
|
|
618
|
-
return /* @__PURE__ */
|
|
679
|
+
return /* @__PURE__ */ import_react.default.createElement(ThreadArticle, {
|
|
619
680
|
thread: data.object.threads[0]
|
|
620
681
|
});
|
|
621
682
|
}
|
|
622
|
-
if (data.subject instanceof
|
|
623
|
-
return /* @__PURE__ */
|
|
683
|
+
if (data.subject instanceof import_types.ThreadType) {
|
|
684
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_chunk_PZVUW4W2.ChatHeading, {
|
|
624
685
|
attendableId: data.subject.id
|
|
625
|
-
}), /* @__PURE__ */
|
|
686
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_chunk_PZVUW4W2.ChatContainer, {
|
|
626
687
|
thread: data.subject
|
|
627
688
|
}));
|
|
628
689
|
}
|
|
629
690
|
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
|
-
const attention = attentionPlugin?.provides.attention?.attended ?? /* @__PURE__ */ new Set([
|
|
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)))));
|
|
691
|
+
const { showResolvedThreads } = getViewState((0, import_echo.fullyQualifiedId)(data.subject));
|
|
692
|
+
return /* @__PURE__ */ import_react.default.createElement(ThreadComplementary, {
|
|
693
|
+
role,
|
|
694
|
+
subject: data.subject,
|
|
695
|
+
stagedThreads: state.staging[(0, import_echo.fullyQualifiedId)(data.subject)],
|
|
696
|
+
current: state.current,
|
|
697
|
+
showResolvedThreads
|
|
698
|
+
});
|
|
707
699
|
}
|
|
708
700
|
}
|
|
709
701
|
}
|
|
@@ -713,11 +705,24 @@ var ThreadPlugin = () => {
|
|
|
713
705
|
intent: {
|
|
714
706
|
resolver: async (intent) => {
|
|
715
707
|
switch (intent.action) {
|
|
716
|
-
case
|
|
708
|
+
case import_chunk_FXD3DYMO.ThreadAction.CREATE: {
|
|
717
709
|
if (intent.data && intent.data.cursor !== void 0) {
|
|
718
710
|
const { cursor, name, subject } = intent.data;
|
|
711
|
+
if (subject?.threads === void 0) {
|
|
712
|
+
try {
|
|
713
|
+
subject.threads = [];
|
|
714
|
+
} catch (e) {
|
|
715
|
+
import_log.log.error("Subject does not support threads array", subject?.typename, {
|
|
716
|
+
F: __dxlog_file,
|
|
717
|
+
L: 331,
|
|
718
|
+
S: void 0,
|
|
719
|
+
C: (f, a) => f(...a)
|
|
720
|
+
});
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
719
724
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
720
|
-
const thread = (0, import_echo_schema2.create)(
|
|
725
|
+
const thread = (0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
721
726
|
name,
|
|
722
727
|
anchor: cursor,
|
|
723
728
|
messages: [],
|
|
@@ -736,18 +741,9 @@ var ThreadPlugin = () => {
|
|
|
736
741
|
intents: [
|
|
737
742
|
[
|
|
738
743
|
{
|
|
739
|
-
action:
|
|
740
|
-
data: {
|
|
741
|
-
activeParts: {
|
|
742
|
-
complementary: `${subjectId}${import_app_framework.SLUG_PATH_SEPARATOR}comments${import_app_framework.SLUG_COLLECTION_INDICATOR}`
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
{
|
|
747
|
-
action: import_chunk_D5GOVXHS.ThreadAction.SELECT,
|
|
744
|
+
action: import_chunk_FXD3DYMO.ThreadAction.SELECT,
|
|
748
745
|
data: {
|
|
749
|
-
current: thread
|
|
750
|
-
focus: true
|
|
746
|
+
current: (0, import_echo.fullyQualifiedId)(thread)
|
|
751
747
|
}
|
|
752
748
|
},
|
|
753
749
|
{
|
|
@@ -763,9 +759,9 @@ var ThreadPlugin = () => {
|
|
|
763
759
|
};
|
|
764
760
|
} else {
|
|
765
761
|
return {
|
|
766
|
-
data: (0, import_echo_schema2.create)(
|
|
762
|
+
data: (0, import_echo_schema2.create)(import_types.ChannelType, {
|
|
767
763
|
threads: [
|
|
768
|
-
(0, import_echo_schema2.create)(
|
|
764
|
+
(0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
769
765
|
messages: []
|
|
770
766
|
})
|
|
771
767
|
]
|
|
@@ -773,16 +769,15 @@ var ThreadPlugin = () => {
|
|
|
773
769
|
};
|
|
774
770
|
}
|
|
775
771
|
}
|
|
776
|
-
case
|
|
777
|
-
state.focus = intent.data?.current === state.current ? state.focus : intent.data?.focus;
|
|
772
|
+
case import_chunk_FXD3DYMO.ThreadAction.SELECT: {
|
|
778
773
|
state.current = intent.data?.current;
|
|
779
774
|
return {
|
|
780
775
|
data: true
|
|
781
776
|
};
|
|
782
777
|
}
|
|
783
|
-
case
|
|
778
|
+
case import_chunk_FXD3DYMO.ThreadAction.TOGGLE_RESOLVED: {
|
|
784
779
|
const { thread } = intent.data ?? {};
|
|
785
|
-
if (!(thread instanceof
|
|
780
|
+
if (!(thread instanceof import_types.ThreadType)) {
|
|
786
781
|
return;
|
|
787
782
|
}
|
|
788
783
|
if (thread.status === "active" || thread.status === void 0) {
|
|
@@ -809,9 +804,9 @@ var ThreadPlugin = () => {
|
|
|
809
804
|
]
|
|
810
805
|
};
|
|
811
806
|
}
|
|
812
|
-
case
|
|
807
|
+
case import_chunk_FXD3DYMO.ThreadAction.DELETE: {
|
|
813
808
|
const { subject, thread } = intent.data ?? {};
|
|
814
|
-
if (!(
|
|
809
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
815
810
|
return;
|
|
816
811
|
}
|
|
817
812
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -820,7 +815,9 @@ var ThreadPlugin = () => {
|
|
|
820
815
|
const index = stagingArea.findIndex((t) => t.id === thread.id);
|
|
821
816
|
if (index !== -1) {
|
|
822
817
|
stagingArea.splice(index, 1);
|
|
823
|
-
return
|
|
818
|
+
return {
|
|
819
|
+
data: true
|
|
820
|
+
};
|
|
824
821
|
}
|
|
825
822
|
}
|
|
826
823
|
const space = (0, import_echo.getSpace)(thread);
|
|
@@ -836,7 +833,7 @@ var ThreadPlugin = () => {
|
|
|
836
833
|
space.db.remove(thread);
|
|
837
834
|
return {
|
|
838
835
|
undoable: {
|
|
839
|
-
message: translations_default[0]["en-US"][
|
|
836
|
+
message: translations_default[0]["en-US"][import_chunk_6EVXCSDS.THREAD_PLUGIN]["thread deleted label"],
|
|
840
837
|
data: {
|
|
841
838
|
cursor
|
|
842
839
|
}
|
|
@@ -879,9 +876,9 @@ var ThreadPlugin = () => {
|
|
|
879
876
|
}
|
|
880
877
|
break;
|
|
881
878
|
}
|
|
882
|
-
case
|
|
879
|
+
case import_chunk_FXD3DYMO.ThreadAction.ON_MESSAGE_ADD: {
|
|
883
880
|
const { thread, subject } = intent.data ?? {};
|
|
884
|
-
if (!(thread instanceof
|
|
881
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject && Array.isArray(subject.threads))) {
|
|
885
882
|
return;
|
|
886
883
|
}
|
|
887
884
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -922,10 +919,10 @@ var ThreadPlugin = () => {
|
|
|
922
919
|
]
|
|
923
920
|
};
|
|
924
921
|
}
|
|
925
|
-
case
|
|
922
|
+
case import_chunk_FXD3DYMO.ThreadAction.DELETE_MESSAGE: {
|
|
926
923
|
const { subject, thread, messageId } = intent.data ?? {};
|
|
927
924
|
const space = (0, import_echo.getSpace)(subject);
|
|
928
|
-
if (!(
|
|
925
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
929
926
|
return;
|
|
930
927
|
}
|
|
931
928
|
if (!intent.undo) {
|
|
@@ -939,7 +936,7 @@ var ThreadPlugin = () => {
|
|
|
939
936
|
intents: [
|
|
940
937
|
[
|
|
941
938
|
{
|
|
942
|
-
action:
|
|
939
|
+
action: import_chunk_FXD3DYMO.ThreadAction.DELETE,
|
|
943
940
|
data: {
|
|
944
941
|
subject,
|
|
945
942
|
thread
|
|
@@ -953,7 +950,7 @@ var ThreadPlugin = () => {
|
|
|
953
950
|
}
|
|
954
951
|
return {
|
|
955
952
|
undoable: {
|
|
956
|
-
message: translations_default[0]["en-US"][
|
|
953
|
+
message: translations_default[0]["en-US"][import_chunk_6EVXCSDS.THREAD_PLUGIN]["message deleted label"],
|
|
957
954
|
data: {
|
|
958
955
|
message,
|
|
959
956
|
messageIndex
|
|
@@ -967,7 +964,7 @@ var ThreadPlugin = () => {
|
|
|
967
964
|
name: "threads.message.delete",
|
|
968
965
|
properties: {
|
|
969
966
|
threadId: thread.id,
|
|
970
|
-
spaceId: space
|
|
967
|
+
spaceId: space?.id
|
|
971
968
|
}
|
|
972
969
|
}
|
|
973
970
|
}
|
|
@@ -977,7 +974,7 @@ var ThreadPlugin = () => {
|
|
|
977
974
|
} else if (intent.undo) {
|
|
978
975
|
const message = intent.data?.message;
|
|
979
976
|
const messageIndex = intent.data?.messageIndex;
|
|
980
|
-
if (!(message instanceof
|
|
977
|
+
if (!(message instanceof import_types.MessageType) || !(typeof messageIndex === "number")) {
|
|
981
978
|
return;
|
|
982
979
|
}
|
|
983
980
|
thread.messages.splice(messageIndex, 0, message);
|
|
@@ -991,7 +988,7 @@ var ThreadPlugin = () => {
|
|
|
991
988
|
name: "threads.message.undo-delete",
|
|
992
989
|
properties: {
|
|
993
990
|
threadId: thread.id,
|
|
994
|
-
spaceId: space
|
|
991
|
+
spaceId: space?.id
|
|
995
992
|
}
|
|
996
993
|
}
|
|
997
994
|
}
|
|
@@ -1032,19 +1029,19 @@ var ThreadPlugin = () => {
|
|
|
1032
1029
|
});
|
|
1033
1030
|
}
|
|
1034
1031
|
}),
|
|
1035
|
-
(0, import_react_ui_editor.createExternalCommentSync)(doc
|
|
1036
|
-
id: thread
|
|
1032
|
+
(0, import_react_ui_editor.createExternalCommentSync)((0, import_echo.fullyQualifiedId)(doc), (sink) => (0, import_signals_core.effect)(() => sink()), () => threads.value.filter((thread) => thread?.anchor).map((thread) => ({
|
|
1033
|
+
id: (0, import_echo.fullyQualifiedId)(thread),
|
|
1037
1034
|
cursor: thread.anchor
|
|
1038
1035
|
}))),
|
|
1039
1036
|
(0, import_react_ui_editor.comments)({
|
|
1040
|
-
id: doc
|
|
1037
|
+
id: (0, import_echo.fullyQualifiedId)(doc),
|
|
1041
1038
|
onCreate: ({ cursor }) => {
|
|
1042
1039
|
const [start, end] = cursor.split(":");
|
|
1043
1040
|
const name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
1044
1041
|
"content"
|
|
1045
1042
|
]), start, end);
|
|
1046
1043
|
void intentPlugin?.provides.intent.dispatch({
|
|
1047
|
-
action:
|
|
1044
|
+
action: import_chunk_FXD3DYMO.ThreadAction.CREATE,
|
|
1048
1045
|
data: {
|
|
1049
1046
|
cursor,
|
|
1050
1047
|
name,
|
|
@@ -1055,7 +1052,7 @@ var ThreadPlugin = () => {
|
|
|
1055
1052
|
onDelete: ({ id }) => {
|
|
1056
1053
|
const stagingArea = state.staging[(0, import_echo.fullyQualifiedId)(doc)];
|
|
1057
1054
|
if (stagingArea) {
|
|
1058
|
-
const index = stagingArea.findIndex((thread2) => thread2
|
|
1055
|
+
const index = stagingArea.findIndex((thread2) => (0, import_echo.fullyQualifiedId)(thread2) === id);
|
|
1059
1056
|
if (index !== -1) {
|
|
1060
1057
|
stagingArea.splice(index, 1);
|
|
1061
1058
|
}
|
|
@@ -1066,8 +1063,8 @@ var ThreadPlugin = () => {
|
|
|
1066
1063
|
}
|
|
1067
1064
|
},
|
|
1068
1065
|
onUpdate: ({ id, cursor }) => {
|
|
1069
|
-
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => thread2
|
|
1070
|
-
if (thread instanceof
|
|
1066
|
+
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => (0, import_echo.fullyQualifiedId)(thread2) === id) ?? doc.threads.find((thread2) => thread2?.id === id);
|
|
1067
|
+
if (thread instanceof import_types.ThreadType && thread.anchor) {
|
|
1071
1068
|
const [start, end] = thread.anchor.split(":");
|
|
1072
1069
|
thread.name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
1073
1070
|
"content"
|
|
@@ -1076,11 +1073,11 @@ var ThreadPlugin = () => {
|
|
|
1076
1073
|
}
|
|
1077
1074
|
},
|
|
1078
1075
|
onSelect: ({ selection: { current, closest } }) => {
|
|
1079
|
-
const
|
|
1080
|
-
if (
|
|
1081
|
-
void
|
|
1076
|
+
const dispatch = intentPlugin?.provides.intent.dispatch;
|
|
1077
|
+
if (dispatch) {
|
|
1078
|
+
void dispatch([
|
|
1082
1079
|
{
|
|
1083
|
-
action:
|
|
1080
|
+
action: import_chunk_FXD3DYMO.ThreadAction.SELECT,
|
|
1084
1081
|
data: {
|
|
1085
1082
|
current: current ?? closest
|
|
1086
1083
|
}
|