@dxos/plugin-thread 0.6.11-staging.e6894a4 → 0.6.12-main.15a606f
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 +237 -210
- 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 +324 -299
- 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 +1133 -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/Chat.stories.d.ts +0 -1
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
- package/dist/types/src/components/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts +11 -0
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -0
- package/dist/types/src/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 +37 -34
- package/src/ThreadPlugin.tsx +70 -190
- package/src/components/Chat.stories.tsx +3 -3
- package/src/components/ChatContainer.tsx +7 -8
- package/src/components/CommentContainer.tsx +10 -7
- package/src/components/Comments.stories.tsx +10 -15
- package/src/components/CommentsContainer.tsx +22 -18
- package/src/components/MessageContainer.tsx +2 -1
- package/src/components/ThreadComplementary.tsx +120 -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,76 @@ 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
|
|
78
|
-
var
|
|
79
|
-
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");
|
|
80
77
|
var import_react_ui_deck = require("@dxos/react-ui-deck");
|
|
81
78
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
79
|
+
var import_react8 = __toESM(require("react"));
|
|
80
|
+
var import_app_framework2 = require("@dxos/app-framework");
|
|
81
|
+
var import_echo4 = require("@dxos/react-client/echo");
|
|
82
|
+
var import_react_ui4 = require("@dxos/react-ui");
|
|
83
|
+
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
84
|
+
var import_util3 = require("@dxos/util");
|
|
82
85
|
var ThreadSettings = ({ settings }) => {
|
|
83
|
-
const { t } = (0,
|
|
84
|
-
return /* @__PURE__ */
|
|
86
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
87
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, /* @__PURE__ */ import_react3.default.createElement(import_plugin_settings.SettingsValue, {
|
|
85
88
|
label: t("settings standalone label")
|
|
86
|
-
}, /* @__PURE__ */
|
|
89
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Input.Switch, {
|
|
87
90
|
checked: settings.standalone,
|
|
88
91
|
onCheckedChange: (checked) => settings.standalone = !!checked
|
|
89
92
|
})));
|
|
90
93
|
};
|
|
91
94
|
var sizeClass = (0, import_react_ui_theme.getSize)(4);
|
|
92
95
|
var ToggleResolvedButton = ({ isResolved, onResolve }) => {
|
|
93
|
-
const { t } = (0,
|
|
96
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
94
97
|
const label = t(isResolved ? "mark as unresolved label" : "mark as resolved label");
|
|
95
|
-
return /* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
96
99
|
asChild: true
|
|
97
|
-
}, /* @__PURE__ */
|
|
100
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Button, {
|
|
98
101
|
variant: "ghost",
|
|
99
102
|
"data-testid": "thread.toggle-resolved",
|
|
100
103
|
onClick: onResolve,
|
|
@@ -102,23 +105,23 @@ var ToggleResolvedButton = ({ isResolved, onResolve }) => {
|
|
|
102
105
|
"min-bs-0 p-1",
|
|
103
106
|
!isResolved && import_react_ui_theme.hoverableControlItem
|
|
104
107
|
]
|
|
105
|
-
}, /* @__PURE__ */
|
|
108
|
+
}, /* @__PURE__ */ import_react5.default.createElement("span", {
|
|
106
109
|
className: "sr-only"
|
|
107
|
-
}, label), isResolved ? /* @__PURE__ */
|
|
110
|
+
}, label), isResolved ? /* @__PURE__ */ import_react5.default.createElement(import_react4.CheckCircle, {
|
|
108
111
|
className: sizeClass,
|
|
109
112
|
weight: "fill"
|
|
110
|
-
}) : /* @__PURE__ */
|
|
113
|
+
}) : /* @__PURE__ */ import_react5.default.createElement(import_react4.CheckCircle, {
|
|
111
114
|
className: sizeClass
|
|
112
|
-
}))), /* @__PURE__ */
|
|
115
|
+
}))), /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
113
116
|
classNames: "z-[21]"
|
|
114
|
-
}, label, /* @__PURE__ */
|
|
117
|
+
}, label, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Arrow, null))));
|
|
115
118
|
};
|
|
116
119
|
var DeleteThreadButton = ({ onDelete }) => {
|
|
117
|
-
const { t } = (0,
|
|
120
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
118
121
|
const label = t("delete thread label");
|
|
119
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
120
123
|
asChild: true
|
|
121
|
-
}, /* @__PURE__ */
|
|
124
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Button, {
|
|
122
125
|
variant: "ghost",
|
|
123
126
|
"data-testid": "thread.delete",
|
|
124
127
|
onClick: onDelete,
|
|
@@ -126,28 +129,28 @@ var DeleteThreadButton = ({ onDelete }) => {
|
|
|
126
129
|
"min-bs-0 p-1",
|
|
127
130
|
import_react_ui_theme.hoverableControlItem
|
|
128
131
|
]
|
|
129
|
-
}, /* @__PURE__ */
|
|
132
|
+
}, /* @__PURE__ */ import_react5.default.createElement("span", {
|
|
130
133
|
className: "sr-only"
|
|
131
|
-
}, label), /* @__PURE__ */
|
|
134
|
+
}, label), /* @__PURE__ */ import_react5.default.createElement(import_react4.X, {
|
|
132
135
|
className: sizeClass
|
|
133
|
-
}))), /* @__PURE__ */
|
|
136
|
+
}))), /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
134
137
|
classNames: "z-[21]"
|
|
135
|
-
}, label, /* @__PURE__ */
|
|
138
|
+
}, label, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Arrow, null))));
|
|
136
139
|
};
|
|
137
140
|
var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox, onAttend, onThreadDelete, onMessageDelete, onResolve, onComment }) => {
|
|
138
141
|
const identity = (0, import_halo.useIdentity)();
|
|
139
142
|
const space = (0, import_echo2.getSpace)(thread);
|
|
140
143
|
const members = (0, import_echo2.useMembers)(space?.key);
|
|
141
|
-
const activity = (0,
|
|
142
|
-
const { t } = (0,
|
|
143
|
-
const threadScrollRef = (0,
|
|
144
|
-
const [autoFocus, setAutoFocus] = (0,
|
|
145
|
-
const { themeMode } = (0,
|
|
146
|
-
const textboxMetadata = (0,
|
|
147
|
-
const [_count, _setCount] = (0,
|
|
144
|
+
const activity = (0, import_chunk_PZVUW4W2.useStatus)(space, (0, import_echo2.fullyQualifiedId)(thread));
|
|
145
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
146
|
+
const threadScrollRef = (0, import_react5.useRef)(null);
|
|
147
|
+
const [autoFocus, setAutoFocus] = (0, import_react5.useState)(!!autoFocusTextbox);
|
|
148
|
+
const { themeMode } = (0, import_react_ui2.useThemeContext)();
|
|
149
|
+
const textboxMetadata = (0, import_chunk_PZVUW4W2.getMessageMetadata)((0, import_echo2.fullyQualifiedId)(thread), identity);
|
|
150
|
+
const [_count, _setCount] = (0, import_react5.useState)(0);
|
|
148
151
|
const rerenderEditor = () => _setCount((count) => count + 1);
|
|
149
|
-
const messageRef = (0,
|
|
150
|
-
const extensions = (0,
|
|
152
|
+
const messageRef = (0, import_react5.useRef)("");
|
|
153
|
+
const extensions = (0, import_react5.useMemo)(() => [
|
|
151
154
|
(0, import_react_ui_editor2.createBasicExtensions)({
|
|
152
155
|
placeholder: t("message placeholder")
|
|
153
156
|
}),
|
|
@@ -157,11 +160,11 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
157
160
|
(0, import_react_ui_editor2.listener)({
|
|
158
161
|
onChange: (text) => messageRef.current = text
|
|
159
162
|
}),
|
|
160
|
-
|
|
163
|
+
import_chunk_PZVUW4W2.command
|
|
161
164
|
], [
|
|
162
165
|
_count
|
|
163
166
|
]);
|
|
164
|
-
(0,
|
|
167
|
+
(0, import_react5.useEffect)(() => {
|
|
165
168
|
setAutoFocus(!!autoFocusTextbox);
|
|
166
169
|
}, [
|
|
167
170
|
autoFocusTextbox
|
|
@@ -170,11 +173,11 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
170
173
|
behavior,
|
|
171
174
|
block: "end"
|
|
172
175
|
}), 10);
|
|
173
|
-
const handleCreate = (0,
|
|
176
|
+
const handleCreate = (0, import_react5.useCallback)(() => {
|
|
174
177
|
if (!messageRef.current) {
|
|
175
178
|
return false;
|
|
176
179
|
}
|
|
177
|
-
thread.messages.push((0, import_echo_schema3.create)(
|
|
180
|
+
thread.messages.push((0, import_echo_schema3.create)(import_types2.MessageType, {
|
|
178
181
|
sender: {
|
|
179
182
|
identityKey: identity.identityKey.toHex()
|
|
180
183
|
},
|
|
@@ -192,64 +195,66 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
|
|
|
192
195
|
thread,
|
|
193
196
|
identity
|
|
194
197
|
]);
|
|
195
|
-
|
|
196
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui_thread2.Thread, {
|
|
198
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.Thread, {
|
|
197
199
|
onClickCapture: onAttend,
|
|
198
200
|
onFocusCapture: onAttend,
|
|
199
201
|
current,
|
|
200
|
-
id: thread
|
|
201
|
-
}, /* @__PURE__ */
|
|
202
|
+
id: (0, import_echo2.fullyQualifiedId)(thread)
|
|
203
|
+
}, /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
202
204
|
role: "none",
|
|
203
205
|
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__ */
|
|
206
|
+
}, detached ? /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
205
207
|
asChild: true
|
|
206
|
-
}, /* @__PURE__ */
|
|
208
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.ThreadHeading, {
|
|
207
209
|
detached: true
|
|
208
|
-
}, thread.name ?? t("thread title placeholder"))), /* @__PURE__ */
|
|
210
|
+
}, 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
211
|
classNames: "z-[21]",
|
|
210
212
|
side: "top"
|
|
211
|
-
}, t("detached thread label"), /* @__PURE__ */
|
|
213
|
+
}, 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
214
|
className: "flex flex-row items-center pli-1"
|
|
213
|
-
}, thread.status === "staged" && /* @__PURE__ */
|
|
215
|
+
}, thread.status === "staged" && /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Tag, {
|
|
214
216
|
palette: "neutral"
|
|
215
|
-
}, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */
|
|
217
|
+
}, t("draft button")), onResolve && !(thread?.status === "staged") && /* @__PURE__ */ import_react5.default.createElement(ToggleResolvedButton, {
|
|
216
218
|
isResolved: thread?.status === "resolved",
|
|
217
219
|
onResolve
|
|
218
|
-
}), onThreadDelete && /* @__PURE__ */
|
|
220
|
+
}), onThreadDelete && /* @__PURE__ */ import_react5.default.createElement(DeleteThreadButton, {
|
|
219
221
|
onDelete: onThreadDelete
|
|
220
|
-
}))), thread.messages.filter(import_util2.nonNullable).map((message) => /* @__PURE__ */
|
|
222
|
+
}))), thread.messages.filter(import_util2.nonNullable).map((message) => /* @__PURE__ */ import_react5.default.createElement(import_chunk_PZVUW4W2.MessageContainer, {
|
|
221
223
|
key: message.id,
|
|
222
224
|
message,
|
|
223
225
|
members,
|
|
224
|
-
onDelete:
|
|
225
|
-
})), /* @__PURE__ */
|
|
226
|
+
onDelete: (id) => onMessageDelete?.(id)
|
|
227
|
+
})), /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.MessageTextbox, {
|
|
226
228
|
extensions,
|
|
227
229
|
autoFocus,
|
|
228
230
|
onSend: handleCreate,
|
|
229
231
|
...textboxMetadata
|
|
230
|
-
}), /* @__PURE__ */
|
|
232
|
+
}), /* @__PURE__ */ import_react5.default.createElement(import_react_ui_thread2.ThreadFooter, {
|
|
231
233
|
activity
|
|
232
|
-
}, t("activity message")), /* @__PURE__ */
|
|
234
|
+
}, t("activity message")), /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
233
235
|
role: "none",
|
|
234
236
|
className: "bs-px -mbs-px",
|
|
235
237
|
ref: threadScrollRef
|
|
236
238
|
}));
|
|
237
239
|
};
|
|
238
240
|
var CommentsHeading = ({ attendableId }) => {
|
|
239
|
-
const { t } = (0,
|
|
240
|
-
return /* @__PURE__ */
|
|
241
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
242
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
241
243
|
role: "none",
|
|
242
244
|
className: "flex items-center"
|
|
243
|
-
}, /* @__PURE__ */
|
|
245
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui_deck.PlankHeading.Button, {
|
|
244
246
|
attendableId
|
|
245
|
-
}, /* @__PURE__ */
|
|
247
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Icon, {
|
|
248
|
+
icon: "ph--quotes--regular",
|
|
249
|
+
size: 5
|
|
250
|
+
})), /* @__PURE__ */ import_react7.default.createElement(import_react_ui_deck.PlankHeading.Label, {
|
|
246
251
|
attendableId
|
|
247
252
|
}, t("comments heading")));
|
|
248
253
|
};
|
|
249
254
|
var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTextbox, showResolvedThreads, onThreadAttend, onThreadDelete, onMessageDelete, onThreadToggleResolved, ...props }) => {
|
|
250
|
-
const { t } = (0,
|
|
255
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
251
256
|
const filteredThreads = showResolvedThreads ? threads : threads.filter((thread) => !(thread?.status === "resolved"));
|
|
252
|
-
(0,
|
|
257
|
+
(0, import_react7.useEffect)(() => {
|
|
253
258
|
if (currentId) {
|
|
254
259
|
document.getElementById(currentId)?.scrollIntoView({
|
|
255
260
|
behavior: "smooth",
|
|
@@ -259,46 +264,157 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
|
|
|
259
264
|
}, [
|
|
260
265
|
currentId
|
|
261
266
|
]);
|
|
262
|
-
return /* @__PURE__ */
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
267
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, filteredThreads.length > 0 ? filteredThreads.map((thread) => {
|
|
268
|
+
const threadId = (0, import_echo3.fullyQualifiedId)(thread);
|
|
269
|
+
return /* @__PURE__ */ import_react7.default.createElement(CommentContainer, {
|
|
270
|
+
key: threadId,
|
|
271
|
+
thread,
|
|
272
|
+
current: currentId === threadId,
|
|
273
|
+
detached: detached.includes(threadId),
|
|
274
|
+
autoFocusTextbox: autoFocusCurrentTextbox && currentId === threadId,
|
|
275
|
+
...onThreadAttend && {
|
|
276
|
+
onAttend: () => onThreadAttend(thread)
|
|
277
|
+
},
|
|
278
|
+
...onThreadDelete && {
|
|
279
|
+
onThreadDelete: () => onThreadDelete(thread)
|
|
280
|
+
},
|
|
281
|
+
...onMessageDelete && {
|
|
282
|
+
onMessageDelete: (messageId) => onMessageDelete(thread, messageId)
|
|
283
|
+
},
|
|
284
|
+
...onThreadToggleResolved && {
|
|
285
|
+
onResolve: () => onThreadToggleResolved(thread)
|
|
286
|
+
},
|
|
287
|
+
...props
|
|
288
|
+
});
|
|
289
|
+
}) : /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
282
290
|
role: "alert",
|
|
283
291
|
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__ */
|
|
292
|
+
}, /* @__PURE__ */ import_react7.default.createElement("h2", {
|
|
285
293
|
className: "mbe-2 font-medium text-baseText"
|
|
286
|
-
}, t("no comments title")), /* @__PURE__ */
|
|
294
|
+
}, t("no comments title")), /* @__PURE__ */ import_react7.default.createElement("p", null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Trans, {
|
|
287
295
|
t,
|
|
288
296
|
i18nKey: "no comments message",
|
|
289
297
|
components: {
|
|
290
|
-
commentIcon: /* @__PURE__ */
|
|
298
|
+
commentIcon: /* @__PURE__ */ import_react7.default.createElement(import_react6.ChatText, {
|
|
291
299
|
className: "inline-block"
|
|
292
300
|
})
|
|
293
301
|
}
|
|
294
302
|
}))));
|
|
295
303
|
};
|
|
296
|
-
var ThreadMain =
|
|
297
|
-
var ThreadArticle =
|
|
304
|
+
var ThreadMain = import_react2.default.lazy(() => import("./ThreadMain-6DN7FDNB.cjs"));
|
|
305
|
+
var ThreadArticle = import_react2.default.lazy(() => import("./ThreadArticle-ERUHPHVT.cjs"));
|
|
306
|
+
var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
|
|
307
|
+
var ThreadComplementary = ({ role, subject, stagedThreads, current, focus, showResolvedThreads }) => {
|
|
308
|
+
const dispatch = (0, import_app_framework2.useIntentDispatcher)();
|
|
309
|
+
const threadsIntegrators = (0, import_app_framework2.useResolvePlugins)(providesThreadsConfig);
|
|
310
|
+
const threadProvides = (0, import_react8.useMemo)(() => threadsIntegrators.map((p) => p.provides.thread), [
|
|
311
|
+
threadsIntegrators
|
|
312
|
+
]);
|
|
313
|
+
const createSort = (0, import_react8.useMemo)(() => threadProvides.find((p) => p.predicate(subject))?.createSort, [
|
|
314
|
+
threadProvides,
|
|
315
|
+
subject
|
|
316
|
+
]);
|
|
317
|
+
const sort = (0, import_react8.useMemo)(() => createSort?.(subject), [
|
|
318
|
+
createSort,
|
|
319
|
+
subject
|
|
320
|
+
]);
|
|
321
|
+
const threads = (0, import_react8.useMemo)(() => {
|
|
322
|
+
return subject.threads.concat(stagedThreads ?? []).filter(import_util3.nonNullable);
|
|
323
|
+
}, [
|
|
324
|
+
JSON.stringify(subject.threads),
|
|
325
|
+
JSON.stringify(stagedThreads)
|
|
326
|
+
]);
|
|
327
|
+
const detachedIds = (0, import_react8.useMemo)(() => {
|
|
328
|
+
return threads.filter(({ anchor }) => !anchor).map((thread) => (0, import_echo4.fullyQualifiedId)(thread));
|
|
329
|
+
}, [
|
|
330
|
+
threads
|
|
331
|
+
]);
|
|
332
|
+
(0, import_react8.useEffect)(() => {
|
|
333
|
+
if (!sort) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
threads.sort((a, b) => sort(a?.anchor, b?.anchor));
|
|
337
|
+
}, [
|
|
338
|
+
sort,
|
|
339
|
+
threads
|
|
340
|
+
]);
|
|
341
|
+
const { attended } = (0, import_react_ui_attention.useAttentionContext)("Thread Complementary");
|
|
342
|
+
const qualifiedSubjectId = (0, import_echo4.fullyQualifiedId)(subject);
|
|
343
|
+
const attendableAttrs = (0, import_react_ui_attention.createAttendableAttributes)(qualifiedSubjectId);
|
|
344
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
345
|
+
role: "none",
|
|
346
|
+
className: "contents group/attention",
|
|
347
|
+
...attendableAttrs
|
|
348
|
+
}, role === "complementary" && /* @__PURE__ */ import_react8.default.createElement(CommentsHeading, {
|
|
349
|
+
attendableId: qualifiedSubjectId
|
|
350
|
+
}), /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Root, {
|
|
351
|
+
classNames: "row-span-2"
|
|
352
|
+
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Viewport, null, /* @__PURE__ */ import_react8.default.createElement(CommentsContainer, {
|
|
353
|
+
threads,
|
|
354
|
+
detached: detachedIds,
|
|
355
|
+
currentId: attended.has(qualifiedSubjectId) ? current : void 0,
|
|
356
|
+
autoFocusCurrentTextbox: focus,
|
|
357
|
+
showResolvedThreads,
|
|
358
|
+
onThreadAttend: (thread) => {
|
|
359
|
+
const threadId = (0, import_echo4.fullyQualifiedId)(thread);
|
|
360
|
+
if (current !== threadId) {
|
|
361
|
+
current = threadId;
|
|
362
|
+
void dispatch?.([
|
|
363
|
+
{
|
|
364
|
+
action: import_app_framework2.LayoutAction.SCROLL_INTO_VIEW,
|
|
365
|
+
data: {
|
|
366
|
+
id: (0, import_echo4.fullyQualifiedId)(subject),
|
|
367
|
+
thread: threadId,
|
|
368
|
+
cursor: thread.anchor
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
]);
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
onThreadDelete: (thread) => {
|
|
375
|
+
return dispatch({
|
|
376
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
377
|
+
action: import_chunk_FXD3DYMO.ThreadAction.DELETE,
|
|
378
|
+
data: {
|
|
379
|
+
subject,
|
|
380
|
+
thread
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
},
|
|
384
|
+
onMessageDelete: (thread, messageId) => dispatch({
|
|
385
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
386
|
+
action: import_chunk_FXD3DYMO.ThreadAction.DELETE_MESSAGE,
|
|
387
|
+
data: {
|
|
388
|
+
subject,
|
|
389
|
+
thread,
|
|
390
|
+
messageId
|
|
391
|
+
}
|
|
392
|
+
}),
|
|
393
|
+
onThreadToggleResolved: (thread) => dispatch({
|
|
394
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
395
|
+
action: import_chunk_FXD3DYMO.ThreadAction.TOGGLE_RESOLVED,
|
|
396
|
+
data: {
|
|
397
|
+
thread
|
|
398
|
+
}
|
|
399
|
+
}),
|
|
400
|
+
onComment: (thread) => {
|
|
401
|
+
void dispatch({
|
|
402
|
+
action: import_chunk_FXD3DYMO.ThreadAction.ON_MESSAGE_ADD,
|
|
403
|
+
data: {
|
|
404
|
+
thread,
|
|
405
|
+
subject
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}), /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
410
|
+
role: "none",
|
|
411
|
+
className: "bs-10"
|
|
412
|
+
}), /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Scrollbar, null, /* @__PURE__ */ import_react8.default.createElement(import_react_ui4.ScrollArea.Thumb, null)))));
|
|
413
|
+
};
|
|
298
414
|
var translations_default = [
|
|
299
415
|
{
|
|
300
416
|
"en-US": {
|
|
301
|
-
[
|
|
417
|
+
[import_chunk_6EVXCSDS.THREAD_PLUGIN]: {
|
|
302
418
|
"plugin name": "Threads",
|
|
303
419
|
"channel name placeholder": "New channel",
|
|
304
420
|
"channel title label": "Title",
|
|
@@ -329,11 +445,12 @@ var translations_default = [
|
|
|
329
445
|
}
|
|
330
446
|
}
|
|
331
447
|
];
|
|
448
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-thread/src/ThreadPlugin.tsx";
|
|
332
449
|
var initialViewState = {
|
|
333
450
|
showResolvedThreads: false
|
|
334
451
|
};
|
|
335
452
|
var ThreadPlugin = () => {
|
|
336
|
-
const settings = new import_local_storage.LocalStorageStore(
|
|
453
|
+
const settings = new import_local_storage.LocalStorageStore(import_chunk_6EVXCSDS.THREAD_PLUGIN);
|
|
337
454
|
const state = (0, import_echo_schema2.create)({
|
|
338
455
|
staging: {}
|
|
339
456
|
});
|
|
@@ -346,13 +463,11 @@ var ThreadPlugin = () => {
|
|
|
346
463
|
}
|
|
347
464
|
return viewStore[subjectId];
|
|
348
465
|
};
|
|
349
|
-
let attentionPlugin;
|
|
350
466
|
let navigationPlugin;
|
|
351
467
|
let intentPlugin;
|
|
352
|
-
let dispatch;
|
|
353
468
|
const unsubscribeCallbacks = [];
|
|
354
469
|
return {
|
|
355
|
-
meta:
|
|
470
|
+
meta: import_chunk_6EVXCSDS.meta_default,
|
|
356
471
|
ready: async (plugins) => {
|
|
357
472
|
settings.prop({
|
|
358
473
|
key: "standalone",
|
|
@@ -360,36 +475,8 @@ var ThreadPlugin = () => {
|
|
|
360
475
|
allowUndefined: true
|
|
361
476
|
})
|
|
362
477
|
});
|
|
363
|
-
attentionPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_attention.parseAttentionPlugin);
|
|
364
478
|
navigationPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseNavigationPlugin);
|
|
365
479
|
intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
366
|
-
dispatch = intentPlugin?.provides.intent.dispatch;
|
|
367
|
-
const graphPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
|
|
368
|
-
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
369
|
-
if (!client) {
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
const channelsQuery = client.spaces.query(import_echo.Filter.schema(import_types2.ChannelType));
|
|
373
|
-
const queryUnsubscribe = channelsQuery.subscribe();
|
|
374
|
-
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
375
|
-
const attention = attentionPlugin?.provides.attention;
|
|
376
|
-
if (!attention?.attended) {
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
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);
|
|
380
|
-
if (firstAttendedNodeWithComments) {
|
|
381
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
382
|
-
action: import_app_framework.NavigationAction.OPEN,
|
|
383
|
-
data: {
|
|
384
|
-
activeParts: {
|
|
385
|
-
complementary: `${firstAttendedNodeWithComments.id}${import_app_framework.SLUG_PATH_SEPARATOR}comments`
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
unsubscribeCallbacks.push(queryUnsubscribe);
|
|
392
|
-
unsubscribeCallbacks.push(unsubscribe);
|
|
393
480
|
},
|
|
394
481
|
unload: async () => {
|
|
395
482
|
unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
|
|
@@ -398,27 +485,26 @@ var ThreadPlugin = () => {
|
|
|
398
485
|
settings: settings.values,
|
|
399
486
|
metadata: {
|
|
400
487
|
records: {
|
|
401
|
-
[
|
|
488
|
+
[import_types.ChannelType.typename]: {
|
|
402
489
|
placeholder: [
|
|
403
490
|
"channel title placeholder",
|
|
404
491
|
{
|
|
405
|
-
ns:
|
|
492
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
406
493
|
}
|
|
407
494
|
],
|
|
408
|
-
icon:
|
|
409
|
-
iconSymbol: "ph--chat--regular",
|
|
495
|
+
icon: "ph--chat--regular",
|
|
410
496
|
// TODO(wittjosiah): Move out of metadata.
|
|
411
497
|
loadReferences: (channel) => (0, import_echo.loadObjectReferences)(channel, (channel2) => channel2.threads)
|
|
412
498
|
},
|
|
413
|
-
[
|
|
499
|
+
[import_types.ThreadType.typename]: {
|
|
414
500
|
// TODO(wittjosiah): Move out of metadata.
|
|
415
501
|
loadReferences: (thread) => (0, import_echo.loadObjectReferences)(thread, (thread2) => thread2.messages)
|
|
416
502
|
},
|
|
417
|
-
[
|
|
503
|
+
[import_types.MessageType.typename]: {
|
|
418
504
|
// TODO(wittjosiah): Move out of metadata.
|
|
419
505
|
loadReferences: (message) => []
|
|
420
506
|
},
|
|
421
|
-
[
|
|
507
|
+
[import_chunk_6EVXCSDS.THREAD_ITEM]: {
|
|
422
508
|
parse: (item, type) => {
|
|
423
509
|
switch (type) {
|
|
424
510
|
case "node":
|
|
@@ -445,47 +531,53 @@ var ThreadPlugin = () => {
|
|
|
445
531
|
],
|
|
446
532
|
echo: {
|
|
447
533
|
schema: [
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
534
|
+
import_types.ChannelType,
|
|
535
|
+
import_types.ThreadType,
|
|
536
|
+
import_types.MessageType
|
|
451
537
|
]
|
|
452
538
|
},
|
|
453
539
|
graph: {
|
|
454
540
|
builder: (plugins) => {
|
|
455
541
|
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
456
|
-
const
|
|
542
|
+
const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
|
|
457
543
|
const metadataResolver = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin)?.provides.metadata.resolver;
|
|
458
|
-
if (!client || !
|
|
544
|
+
if (!client || !dispatch || !metadataResolver) {
|
|
459
545
|
return [];
|
|
460
546
|
}
|
|
461
547
|
return [
|
|
462
548
|
(0, import_plugin_graph.createExtension)({
|
|
463
|
-
id: `${
|
|
549
|
+
id: `${import_chunk_6EVXCSDS.THREAD_PLUGIN}/comments-for-subject`,
|
|
464
550
|
resolver: ({ id }) => {
|
|
465
551
|
if (!id.endsWith("~comments")) {
|
|
466
552
|
return;
|
|
467
553
|
}
|
|
468
|
-
const
|
|
469
|
-
const [spaceId, objectId] =
|
|
554
|
+
const subjectId = id.split("~").at(0);
|
|
555
|
+
const [spaceId, objectId] = subjectId?.split(":") ?? [];
|
|
470
556
|
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
471
|
-
const
|
|
472
|
-
|
|
557
|
+
const object = (0, import_plugin_graph.toSignal)((onChange) => {
|
|
558
|
+
const timeout = setTimeout(async () => {
|
|
559
|
+
await space?.db.loadObjectById(objectId);
|
|
560
|
+
onChange();
|
|
561
|
+
});
|
|
562
|
+
return () => clearTimeout(timeout);
|
|
563
|
+
}, () => space?.db.getObjectById(objectId));
|
|
564
|
+
if (!object || !subjectId) {
|
|
473
565
|
return;
|
|
474
566
|
}
|
|
475
|
-
const
|
|
476
|
-
const label =
|
|
567
|
+
const meta = metadataResolver((0, import_echo_schema.getTypename)(object) ?? "");
|
|
568
|
+
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
477
569
|
"unnamed object threads label",
|
|
478
570
|
{
|
|
479
|
-
ns:
|
|
571
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
480
572
|
}
|
|
481
573
|
];
|
|
482
|
-
const viewState = getViewState(
|
|
574
|
+
const viewState = getViewState(subjectId);
|
|
483
575
|
return {
|
|
484
576
|
id,
|
|
485
577
|
type: "orphan-comments-for-subject",
|
|
486
|
-
data:
|
|
578
|
+
data: object,
|
|
487
579
|
properties: {
|
|
488
|
-
icon:
|
|
580
|
+
icon: meta.icon,
|
|
489
581
|
label,
|
|
490
582
|
showResolvedThreads: viewState.showResolvedThreads
|
|
491
583
|
}
|
|
@@ -501,7 +593,7 @@ var ThreadPlugin = () => {
|
|
|
501
593
|
const toggle = () => {
|
|
502
594
|
const newToggleState = !viewState.showResolvedThreads;
|
|
503
595
|
viewState.showResolvedThreads = newToggleState;
|
|
504
|
-
void
|
|
596
|
+
void dispatch({
|
|
505
597
|
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
506
598
|
data: {
|
|
507
599
|
name: "threads.toggle-show-resolved",
|
|
@@ -515,25 +607,26 @@ var ThreadPlugin = () => {
|
|
|
515
607
|
};
|
|
516
608
|
return [
|
|
517
609
|
{
|
|
518
|
-
id: `${
|
|
610
|
+
id: `${import_chunk_6EVXCSDS.THREAD_PLUGIN}/toggle-show-resolved/${node.id}`,
|
|
519
611
|
data: toggle,
|
|
520
612
|
properties: {
|
|
521
613
|
label: [
|
|
522
614
|
"toggle show resolved",
|
|
523
615
|
{
|
|
524
|
-
ns:
|
|
616
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
525
617
|
}
|
|
526
618
|
],
|
|
527
619
|
menuItemType: "toggle",
|
|
528
620
|
isChecked: viewState.showResolvedThreads,
|
|
529
|
-
testId: "threadPlugin.toggleShowResolved"
|
|
621
|
+
testId: "threadPlugin.toggleShowResolved",
|
|
622
|
+
icon: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
|
|
530
623
|
}
|
|
531
624
|
}
|
|
532
625
|
];
|
|
533
626
|
}
|
|
534
627
|
}),
|
|
535
628
|
(0, import_plugin_graph.createExtension)({
|
|
536
|
-
id:
|
|
629
|
+
id: import_chunk_FXD3DYMO.ThreadAction.CREATE,
|
|
537
630
|
filter: (node) => !!settings.values.standalone && (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
538
631
|
actions: ({ node }) => {
|
|
539
632
|
const id = node.id.split("/").at(-1);
|
|
@@ -546,12 +639,12 @@ var ThreadPlugin = () => {
|
|
|
546
639
|
}
|
|
547
640
|
return [
|
|
548
641
|
{
|
|
549
|
-
id: `${
|
|
642
|
+
id: `${import_chunk_6EVXCSDS.THREAD_PLUGIN}/create/${node.id}`,
|
|
550
643
|
data: async () => {
|
|
551
|
-
await
|
|
644
|
+
await dispatch([
|
|
552
645
|
{
|
|
553
|
-
plugin:
|
|
554
|
-
action:
|
|
646
|
+
plugin: import_chunk_6EVXCSDS.THREAD_PLUGIN,
|
|
647
|
+
action: import_chunk_FXD3DYMO.ThreadAction.CREATE
|
|
555
648
|
},
|
|
556
649
|
{
|
|
557
650
|
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
@@ -568,11 +661,10 @@ var ThreadPlugin = () => {
|
|
|
568
661
|
label: [
|
|
569
662
|
"create channel label",
|
|
570
663
|
{
|
|
571
|
-
ns:
|
|
664
|
+
ns: import_chunk_6EVXCSDS.THREAD_PLUGIN
|
|
572
665
|
}
|
|
573
666
|
],
|
|
574
|
-
icon:
|
|
575
|
-
iconSymbol: "ph--chat--regular",
|
|
667
|
+
icon: "ph--chat--regular",
|
|
576
668
|
testId: "threadPlugin.createObject"
|
|
577
669
|
}
|
|
578
670
|
}
|
|
@@ -586,25 +678,19 @@ var ThreadPlugin = () => {
|
|
|
586
678
|
component: ({ data, role }) => {
|
|
587
679
|
switch (role) {
|
|
588
680
|
case "main": {
|
|
589
|
-
return data.active instanceof
|
|
681
|
+
return data.active instanceof import_types.ChannelType && data.active.threads[0] ? /* @__PURE__ */ import_react.default.createElement(ThreadMain, {
|
|
590
682
|
thread: data.active.threads[0]
|
|
591
683
|
}) : null;
|
|
592
684
|
}
|
|
593
685
|
case "settings": {
|
|
594
|
-
return data.plugin ===
|
|
686
|
+
return data.plugin === import_chunk_6EVXCSDS.meta_default.id ? /* @__PURE__ */ import_react.default.createElement(ThreadSettings, {
|
|
595
687
|
settings: settings.values
|
|
596
688
|
}) : null;
|
|
597
689
|
}
|
|
598
690
|
case "article":
|
|
599
691
|
case "complementary": {
|
|
600
692
|
const location = navigationPlugin?.provides.location;
|
|
601
|
-
|
|
602
|
-
// TODO(Zan): More robust runtime check.
|
|
603
|
-
"thread" in plugin.provides ? plugin : void 0
|
|
604
|
-
), []);
|
|
605
|
-
const threadsIntegrators = (0, import_app_framework.useResolvePlugins)(providesThreadsConfig);
|
|
606
|
-
const threadProvides = threadsIntegrators.map((p) => p.provides.thread);
|
|
607
|
-
if (data.object instanceof import_types2.ChannelType && data.object.threads[0]) {
|
|
693
|
+
if (data.object instanceof import_types.ChannelType && data.object.threads[0]) {
|
|
608
694
|
const channel = data.object;
|
|
609
695
|
if ((0, import_app_framework.isLayoutParts)(location?.active) && location.active.main) {
|
|
610
696
|
const layoutEntries = location.active.main;
|
|
@@ -612,101 +698,33 @@ var ThreadPlugin = () => {
|
|
|
612
698
|
if (currentPosition > 0) {
|
|
613
699
|
const objectToTheLeft = layoutEntries[currentPosition - 1];
|
|
614
700
|
const context = (0, import_echo.getSpace)(data.object)?.db.getObjectById(objectToTheLeft.id);
|
|
615
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ import_react.default.createElement(ThreadArticle, {
|
|
616
702
|
thread: data.object.threads[0],
|
|
617
703
|
context
|
|
618
704
|
});
|
|
619
705
|
}
|
|
620
706
|
}
|
|
621
|
-
return /* @__PURE__ */
|
|
707
|
+
return /* @__PURE__ */ import_react.default.createElement(ThreadArticle, {
|
|
622
708
|
thread: data.object.threads[0]
|
|
623
709
|
});
|
|
624
710
|
}
|
|
625
|
-
if (data.subject instanceof
|
|
626
|
-
return /* @__PURE__ */
|
|
711
|
+
if (data.subject instanceof import_types.ThreadType) {
|
|
712
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_chunk_PZVUW4W2.ChatHeading, {
|
|
627
713
|
attendableId: data.subject.id
|
|
628
|
-
}), /* @__PURE__ */
|
|
714
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_chunk_PZVUW4W2.ChatContainer, {
|
|
629
715
|
thread: data.subject
|
|
630
716
|
}));
|
|
631
717
|
}
|
|
632
718
|
if (data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads)) {
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
qualifiedSubjectId
|
|
643
|
-
]);
|
|
644
|
-
const attendableAttrs = (0, import_react_ui_attention.createAttendableAttributes)(qualifiedSubjectId);
|
|
645
|
-
const { showResolvedThreads } = getViewState(qualifiedSubjectId);
|
|
646
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
647
|
-
role: "none",
|
|
648
|
-
className: "contents group/attention",
|
|
649
|
-
...attendableAttrs
|
|
650
|
-
}, role === "complementary" && /* @__PURE__ */ import_react2.default.createElement(CommentsHeading, {
|
|
651
|
-
attendableId: qualifiedSubjectId
|
|
652
|
-
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Root, {
|
|
653
|
-
classNames: "row-span-2"
|
|
654
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Viewport, null, /* @__PURE__ */ import_react2.default.createElement(CommentsContainer, {
|
|
655
|
-
threads,
|
|
656
|
-
detached,
|
|
657
|
-
currentId: attention.has(qualifiedSubjectId) ? state.current : void 0,
|
|
658
|
-
autoFocusCurrentTextbox: state.focus,
|
|
659
|
-
showResolvedThreads,
|
|
660
|
-
onThreadAttend: (thread) => {
|
|
661
|
-
if (state.current !== thread.id) {
|
|
662
|
-
state.current = thread.id;
|
|
663
|
-
void dispatch?.({
|
|
664
|
-
action: import_app_framework.LayoutAction.SCROLL_INTO_VIEW,
|
|
665
|
-
data: {
|
|
666
|
-
id: (0, import_echo.fullyQualifiedId)(data.subject),
|
|
667
|
-
thread: (0, import_echo.fullyQualifiedId)(thread),
|
|
668
|
-
cursor: thread.anchor
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
},
|
|
673
|
-
onThreadDelete: (thread) => dispatch?.({
|
|
674
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
675
|
-
action: import_chunk_D5GOVXHS.ThreadAction.DELETE,
|
|
676
|
-
data: {
|
|
677
|
-
subject: data.subject,
|
|
678
|
-
thread
|
|
679
|
-
}
|
|
680
|
-
}),
|
|
681
|
-
onMessageDelete: (thread, messageId) => dispatch?.({
|
|
682
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
683
|
-
action: import_chunk_D5GOVXHS.ThreadAction.DELETE_MESSAGE,
|
|
684
|
-
data: {
|
|
685
|
-
subject: data.subject,
|
|
686
|
-
thread,
|
|
687
|
-
messageId
|
|
688
|
-
}
|
|
689
|
-
}),
|
|
690
|
-
onThreadToggleResolved: (thread) => dispatch?.({
|
|
691
|
-
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
692
|
-
action: import_chunk_D5GOVXHS.ThreadAction.TOGGLE_RESOLVED,
|
|
693
|
-
data: {
|
|
694
|
-
thread
|
|
695
|
-
}
|
|
696
|
-
}),
|
|
697
|
-
onComment: (thread) => {
|
|
698
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
699
|
-
action: import_chunk_D5GOVXHS.ThreadAction.ON_MESSAGE_ADD,
|
|
700
|
-
data: {
|
|
701
|
-
thread,
|
|
702
|
-
subject: data.subject
|
|
703
|
-
}
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
707
|
-
role: "none",
|
|
708
|
-
className: "bs-10"
|
|
709
|
-
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Scrollbar, null, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Thumb, null)))));
|
|
719
|
+
const { showResolvedThreads } = getViewState((0, import_echo.fullyQualifiedId)(data.subject));
|
|
720
|
+
return /* @__PURE__ */ import_react.default.createElement(ThreadComplementary, {
|
|
721
|
+
role,
|
|
722
|
+
subject: data.subject,
|
|
723
|
+
stagedThreads: state.staging[(0, import_echo.fullyQualifiedId)(data.subject)],
|
|
724
|
+
current: state.current,
|
|
725
|
+
focus: true,
|
|
726
|
+
showResolvedThreads
|
|
727
|
+
});
|
|
710
728
|
}
|
|
711
729
|
}
|
|
712
730
|
}
|
|
@@ -716,11 +734,24 @@ var ThreadPlugin = () => {
|
|
|
716
734
|
intent: {
|
|
717
735
|
resolver: async (intent) => {
|
|
718
736
|
switch (intent.action) {
|
|
719
|
-
case
|
|
737
|
+
case import_chunk_FXD3DYMO.ThreadAction.CREATE: {
|
|
720
738
|
if (intent.data && intent.data.cursor !== void 0) {
|
|
721
739
|
const { cursor, name, subject } = intent.data;
|
|
740
|
+
if (subject?.threads === void 0) {
|
|
741
|
+
try {
|
|
742
|
+
subject.threads = [];
|
|
743
|
+
} catch (e) {
|
|
744
|
+
import_log.log.error("Subject does not support threads array", subject?.typename, {
|
|
745
|
+
F: __dxlog_file,
|
|
746
|
+
L: 331,
|
|
747
|
+
S: void 0,
|
|
748
|
+
C: (f, a) => f(...a)
|
|
749
|
+
});
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
722
753
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
723
|
-
const thread = (0, import_echo_schema2.create)(
|
|
754
|
+
const thread = (0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
724
755
|
name,
|
|
725
756
|
anchor: cursor,
|
|
726
757
|
messages: [],
|
|
@@ -739,17 +770,9 @@ var ThreadPlugin = () => {
|
|
|
739
770
|
intents: [
|
|
740
771
|
[
|
|
741
772
|
{
|
|
742
|
-
action:
|
|
743
|
-
data: {
|
|
744
|
-
activeParts: {
|
|
745
|
-
complementary: `${subjectId}${import_app_framework.SLUG_PATH_SEPARATOR}comments${import_app_framework.SLUG_COLLECTION_INDICATOR}`
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
action: import_chunk_D5GOVXHS.ThreadAction.SELECT,
|
|
773
|
+
action: import_chunk_FXD3DYMO.ThreadAction.SELECT,
|
|
751
774
|
data: {
|
|
752
|
-
current: thread
|
|
775
|
+
current: (0, import_echo.fullyQualifiedId)(thread),
|
|
753
776
|
focus: true
|
|
754
777
|
}
|
|
755
778
|
},
|
|
@@ -766,9 +789,9 @@ var ThreadPlugin = () => {
|
|
|
766
789
|
};
|
|
767
790
|
} else {
|
|
768
791
|
return {
|
|
769
|
-
data: (0, import_echo_schema2.create)(
|
|
792
|
+
data: (0, import_echo_schema2.create)(import_types.ChannelType, {
|
|
770
793
|
threads: [
|
|
771
|
-
(0, import_echo_schema2.create)(
|
|
794
|
+
(0, import_echo_schema2.create)(import_types.ThreadType, {
|
|
772
795
|
messages: []
|
|
773
796
|
})
|
|
774
797
|
]
|
|
@@ -776,16 +799,16 @@ var ThreadPlugin = () => {
|
|
|
776
799
|
};
|
|
777
800
|
}
|
|
778
801
|
}
|
|
779
|
-
case
|
|
802
|
+
case import_chunk_FXD3DYMO.ThreadAction.SELECT: {
|
|
780
803
|
state.focus = intent.data?.current === state.current ? state.focus : intent.data?.focus;
|
|
781
804
|
state.current = intent.data?.current;
|
|
782
805
|
return {
|
|
783
806
|
data: true
|
|
784
807
|
};
|
|
785
808
|
}
|
|
786
|
-
case
|
|
809
|
+
case import_chunk_FXD3DYMO.ThreadAction.TOGGLE_RESOLVED: {
|
|
787
810
|
const { thread } = intent.data ?? {};
|
|
788
|
-
if (!(thread instanceof
|
|
811
|
+
if (!(thread instanceof import_types.ThreadType)) {
|
|
789
812
|
return;
|
|
790
813
|
}
|
|
791
814
|
if (thread.status === "active" || thread.status === void 0) {
|
|
@@ -812,9 +835,9 @@ var ThreadPlugin = () => {
|
|
|
812
835
|
]
|
|
813
836
|
};
|
|
814
837
|
}
|
|
815
|
-
case
|
|
838
|
+
case import_chunk_FXD3DYMO.ThreadAction.DELETE: {
|
|
816
839
|
const { subject, thread } = intent.data ?? {};
|
|
817
|
-
if (!(
|
|
840
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
818
841
|
return;
|
|
819
842
|
}
|
|
820
843
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -823,7 +846,9 @@ var ThreadPlugin = () => {
|
|
|
823
846
|
const index = stagingArea.findIndex((t) => t.id === thread.id);
|
|
824
847
|
if (index !== -1) {
|
|
825
848
|
stagingArea.splice(index, 1);
|
|
826
|
-
return
|
|
849
|
+
return {
|
|
850
|
+
data: true
|
|
851
|
+
};
|
|
827
852
|
}
|
|
828
853
|
}
|
|
829
854
|
const space = (0, import_echo.getSpace)(thread);
|
|
@@ -839,7 +864,7 @@ var ThreadPlugin = () => {
|
|
|
839
864
|
space.db.remove(thread);
|
|
840
865
|
return {
|
|
841
866
|
undoable: {
|
|
842
|
-
message: translations_default[0]["en-US"][
|
|
867
|
+
message: translations_default[0]["en-US"][import_chunk_6EVXCSDS.THREAD_PLUGIN]["thread deleted label"],
|
|
843
868
|
data: {
|
|
844
869
|
cursor
|
|
845
870
|
}
|
|
@@ -882,9 +907,9 @@ var ThreadPlugin = () => {
|
|
|
882
907
|
}
|
|
883
908
|
break;
|
|
884
909
|
}
|
|
885
|
-
case
|
|
910
|
+
case import_chunk_FXD3DYMO.ThreadAction.ON_MESSAGE_ADD: {
|
|
886
911
|
const { thread, subject } = intent.data ?? {};
|
|
887
|
-
if (!(thread instanceof
|
|
912
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject && Array.isArray(subject.threads))) {
|
|
888
913
|
return;
|
|
889
914
|
}
|
|
890
915
|
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
@@ -925,10 +950,10 @@ var ThreadPlugin = () => {
|
|
|
925
950
|
]
|
|
926
951
|
};
|
|
927
952
|
}
|
|
928
|
-
case
|
|
953
|
+
case import_chunk_FXD3DYMO.ThreadAction.DELETE_MESSAGE: {
|
|
929
954
|
const { subject, thread, messageId } = intent.data ?? {};
|
|
930
955
|
const space = (0, import_echo.getSpace)(subject);
|
|
931
|
-
if (!(
|
|
956
|
+
if (!(thread instanceof import_types.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
932
957
|
return;
|
|
933
958
|
}
|
|
934
959
|
if (!intent.undo) {
|
|
@@ -942,7 +967,7 @@ var ThreadPlugin = () => {
|
|
|
942
967
|
intents: [
|
|
943
968
|
[
|
|
944
969
|
{
|
|
945
|
-
action:
|
|
970
|
+
action: import_chunk_FXD3DYMO.ThreadAction.DELETE,
|
|
946
971
|
data: {
|
|
947
972
|
subject,
|
|
948
973
|
thread
|
|
@@ -956,7 +981,7 @@ var ThreadPlugin = () => {
|
|
|
956
981
|
}
|
|
957
982
|
return {
|
|
958
983
|
undoable: {
|
|
959
|
-
message: translations_default[0]["en-US"][
|
|
984
|
+
message: translations_default[0]["en-US"][import_chunk_6EVXCSDS.THREAD_PLUGIN]["message deleted label"],
|
|
960
985
|
data: {
|
|
961
986
|
message,
|
|
962
987
|
messageIndex
|
|
@@ -970,7 +995,7 @@ var ThreadPlugin = () => {
|
|
|
970
995
|
name: "threads.message.delete",
|
|
971
996
|
properties: {
|
|
972
997
|
threadId: thread.id,
|
|
973
|
-
spaceId: space
|
|
998
|
+
spaceId: space?.id
|
|
974
999
|
}
|
|
975
1000
|
}
|
|
976
1001
|
}
|
|
@@ -980,7 +1005,7 @@ var ThreadPlugin = () => {
|
|
|
980
1005
|
} else if (intent.undo) {
|
|
981
1006
|
const message = intent.data?.message;
|
|
982
1007
|
const messageIndex = intent.data?.messageIndex;
|
|
983
|
-
if (!(message instanceof
|
|
1008
|
+
if (!(message instanceof import_types.MessageType) || !(typeof messageIndex === "number")) {
|
|
984
1009
|
return;
|
|
985
1010
|
}
|
|
986
1011
|
thread.messages.splice(messageIndex, 0, message);
|
|
@@ -994,7 +1019,7 @@ var ThreadPlugin = () => {
|
|
|
994
1019
|
name: "threads.message.undo-delete",
|
|
995
1020
|
properties: {
|
|
996
1021
|
threadId: thread.id,
|
|
997
|
-
spaceId: space
|
|
1022
|
+
spaceId: space?.id
|
|
998
1023
|
}
|
|
999
1024
|
}
|
|
1000
1025
|
}
|
|
@@ -1036,7 +1061,7 @@ var ThreadPlugin = () => {
|
|
|
1036
1061
|
}
|
|
1037
1062
|
}),
|
|
1038
1063
|
(0, import_react_ui_editor.createExternalCommentSync)(doc.id, (sink) => (0, import_signals_core.effect)(() => sink()), () => threads.value.filter((thread) => thread?.anchor).map((thread) => ({
|
|
1039
|
-
id: thread
|
|
1064
|
+
id: (0, import_echo.fullyQualifiedId)(thread),
|
|
1040
1065
|
cursor: thread.anchor
|
|
1041
1066
|
}))),
|
|
1042
1067
|
(0, import_react_ui_editor.comments)({
|
|
@@ -1047,7 +1072,7 @@ var ThreadPlugin = () => {
|
|
|
1047
1072
|
"content"
|
|
1048
1073
|
]), start, end);
|
|
1049
1074
|
void intentPlugin?.provides.intent.dispatch({
|
|
1050
|
-
action:
|
|
1075
|
+
action: import_chunk_FXD3DYMO.ThreadAction.CREATE,
|
|
1051
1076
|
data: {
|
|
1052
1077
|
cursor,
|
|
1053
1078
|
name,
|
|
@@ -1058,7 +1083,7 @@ var ThreadPlugin = () => {
|
|
|
1058
1083
|
onDelete: ({ id }) => {
|
|
1059
1084
|
const stagingArea = state.staging[(0, import_echo.fullyQualifiedId)(doc)];
|
|
1060
1085
|
if (stagingArea) {
|
|
1061
|
-
const index = stagingArea.findIndex((thread2) => thread2
|
|
1086
|
+
const index = stagingArea.findIndex((thread2) => (0, import_echo.fullyQualifiedId)(thread2) === id);
|
|
1062
1087
|
if (index !== -1) {
|
|
1063
1088
|
stagingArea.splice(index, 1);
|
|
1064
1089
|
}
|
|
@@ -1069,8 +1094,8 @@ var ThreadPlugin = () => {
|
|
|
1069
1094
|
}
|
|
1070
1095
|
},
|
|
1071
1096
|
onUpdate: ({ id, cursor }) => {
|
|
1072
|
-
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => thread2
|
|
1073
|
-
if (thread instanceof
|
|
1097
|
+
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => (0, import_echo.fullyQualifiedId)(thread2) === id) ?? doc.threads.find((thread2) => thread2?.id === id);
|
|
1098
|
+
if (thread instanceof import_types.ThreadType && thread.anchor) {
|
|
1074
1099
|
const [start, end] = thread.anchor.split(":");
|
|
1075
1100
|
thread.name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
1076
1101
|
"content"
|
|
@@ -1079,11 +1104,11 @@ var ThreadPlugin = () => {
|
|
|
1079
1104
|
}
|
|
1080
1105
|
},
|
|
1081
1106
|
onSelect: ({ selection: { current, closest } }) => {
|
|
1082
|
-
const
|
|
1083
|
-
if (
|
|
1084
|
-
void
|
|
1107
|
+
const dispatch = intentPlugin?.provides.intent.dispatch;
|
|
1108
|
+
if (dispatch) {
|
|
1109
|
+
void dispatch([
|
|
1085
1110
|
{
|
|
1086
|
-
action:
|
|
1111
|
+
action: import_chunk_FXD3DYMO.ThreadAction.SELECT,
|
|
1087
1112
|
data: {
|
|
1088
1113
|
current: current ?? closest
|
|
1089
1114
|
}
|