@dxos/plugin-thread 0.7.2 → 0.7.3-staging.971cd8d

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