@dxos/plugin-thread 0.6.12-main.5cc132e → 0.6.12-main.c4a728f

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 (64) hide show
  1. package/dist/lib/browser/{ThreadArticle-6L6BGE4Z.mjs → ThreadArticle-4VU752F4.mjs} +3 -3
  2. package/dist/lib/{node-esm/ThreadMain-DU6LBSN3.mjs → browser/ThreadMain-ML3P4XSD.mjs} +3 -3
  3. package/dist/lib/browser/{chunk-5IBJO53M.mjs → chunk-7NUYW5IW.mjs} +2 -5
  4. package/dist/lib/browser/chunk-7NUYW5IW.mjs.map +7 -0
  5. package/dist/lib/{node-esm/chunk-U5UVX4ZP.mjs → browser/chunk-GJRBBPXI.mjs} +2 -2
  6. package/dist/lib/browser/{chunk-AVC4CGJM.mjs → chunk-XF5QKI75.mjs} +8 -6
  7. package/dist/lib/browser/chunk-XF5QKI75.mjs.map +7 -0
  8. package/dist/lib/browser/index.mjs +34 -68
  9. package/dist/lib/browser/index.mjs.map +3 -3
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/meta.mjs +1 -1
  12. package/dist/lib/browser/types.mjs +2 -2
  13. package/dist/lib/node/{ThreadArticle-7BWXVIJ4.cjs → ThreadArticle-ERUHPHVT.cjs} +7 -7
  14. package/dist/lib/node/{ThreadMain-XSRB6NKJ.cjs → ThreadMain-6DN7FDNB.cjs} +7 -7
  15. package/dist/lib/node/{chunk-BWBONZGU.cjs → chunk-6EVXCSDS.cjs} +5 -18
  16. package/dist/lib/node/chunk-6EVXCSDS.cjs.map +7 -0
  17. package/dist/lib/node/{chunk-4B2ARV7L.cjs → chunk-FXD3DYMO.cjs} +6 -6
  18. package/dist/lib/node/{chunk-T7TXCNHL.cjs → chunk-PZVUW4W2.cjs} +61 -59
  19. package/dist/lib/node/chunk-PZVUW4W2.cjs.map +7 -0
  20. package/dist/lib/node/index.cjs +144 -178
  21. package/dist/lib/node/index.cjs.map +3 -3
  22. package/dist/lib/node/meta.cjs +4 -4
  23. package/dist/lib/node/meta.cjs.map +1 -1
  24. package/dist/lib/node/meta.json +1 -1
  25. package/dist/lib/node/types.cjs +3 -3
  26. package/dist/lib/node/types.cjs.map +1 -1
  27. package/dist/lib/node-esm/{ThreadArticle-6L6BGE4Z.mjs → ThreadArticle-NKI5F4W5.mjs} +4 -3
  28. package/dist/lib/node-esm/{ThreadArticle-6L6BGE4Z.mjs.map → ThreadArticle-NKI5F4W5.mjs.map} +1 -1
  29. package/dist/lib/{browser/ThreadMain-DU6LBSN3.mjs → node-esm/ThreadMain-2A3VQLCW.mjs} +4 -3
  30. package/dist/lib/node-esm/{ThreadMain-DU6LBSN3.mjs.map → ThreadMain-2A3VQLCW.mjs.map} +1 -1
  31. package/dist/lib/node-esm/{chunk-AVC4CGJM.mjs → chunk-A44C4MTQ.mjs} +9 -6
  32. package/dist/lib/node-esm/chunk-A44C4MTQ.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-5IBJO53M.mjs → chunk-Y475KZTX.mjs} +4 -5
  34. package/dist/lib/node-esm/chunk-Y475KZTX.mjs.map +7 -0
  35. package/dist/lib/{browser/chunk-U5UVX4ZP.mjs → node-esm/chunk-YO46JGAE.mjs} +3 -2
  36. package/dist/lib/node-esm/{chunk-U5UVX4ZP.mjs.map → chunk-YO46JGAE.mjs.map} +1 -1
  37. package/dist/lib/node-esm/index.mjs +35 -68
  38. package/dist/lib/node-esm/index.mjs.map +3 -3
  39. package/dist/lib/node-esm/meta.json +1 -1
  40. package/dist/lib/node-esm/meta.mjs +2 -1
  41. package/dist/lib/node-esm/types.mjs +3 -2
  42. package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
  43. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  44. package/dist/types/src/components/testing.d.ts +2 -0
  45. package/dist/types/src/components/testing.d.ts.map +1 -1
  46. package/dist/types/src/meta.d.ts +1 -4
  47. package/dist/types/src/meta.d.ts.map +1 -1
  48. package/package.json +30 -30
  49. package/src/ThreadPlugin.tsx +27 -72
  50. package/src/components/ChatContainer.tsx +3 -4
  51. package/src/components/CommentsContainer.tsx +4 -4
  52. package/src/meta.tsx +1 -5
  53. package/dist/lib/browser/chunk-5IBJO53M.mjs.map +0 -7
  54. package/dist/lib/browser/chunk-AVC4CGJM.mjs.map +0 -7
  55. package/dist/lib/node/chunk-BWBONZGU.cjs.map +0 -7
  56. package/dist/lib/node/chunk-T7TXCNHL.cjs.map +0 -7
  57. package/dist/lib/node-esm/chunk-5IBJO53M.mjs.map +0 -7
  58. package/dist/lib/node-esm/chunk-AVC4CGJM.mjs.map +0 -7
  59. /package/dist/lib/browser/{ThreadArticle-6L6BGE4Z.mjs.map → ThreadArticle-4VU752F4.mjs.map} +0 -0
  60. /package/dist/lib/browser/{ThreadMain-DU6LBSN3.mjs.map → ThreadMain-ML3P4XSD.mjs.map} +0 -0
  61. /package/dist/lib/browser/{chunk-U5UVX4ZP.mjs.map → chunk-GJRBBPXI.mjs.map} +0 -0
  62. /package/dist/lib/node/{ThreadArticle-7BWXVIJ4.cjs.map → ThreadArticle-ERUHPHVT.cjs.map} +0 -0
  63. /package/dist/lib/node/{ThreadMain-XSRB6NKJ.cjs.map → ThreadMain-6DN7FDNB.cjs.map} +0 -0
  64. /package/dist/lib/node/{chunk-4B2ARV7L.cjs.map → chunk-FXD3DYMO.cjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ChatContainer
3
- } from "./chunk-AVC4CGJM.mjs";
4
- import "./chunk-5IBJO53M.mjs";
3
+ } from "./chunk-XF5QKI75.mjs";
4
+ import "./chunk-7NUYW5IW.mjs";
5
5
 
6
6
  // packages/plugins/plugin-thread/src/components/ThreadArticle.tsx
7
7
  import React from "react";
@@ -15,4 +15,4 @@ var ThreadArticle_default = ThreadArticle;
15
15
  export {
16
16
  ThreadArticle_default as default
17
17
  };
18
- //# sourceMappingURL=ThreadArticle-6L6BGE4Z.mjs.map
18
+ //# sourceMappingURL=ThreadArticle-4VU752F4.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ChatContainer
3
- } from "./chunk-AVC4CGJM.mjs";
4
- import "./chunk-5IBJO53M.mjs";
3
+ } from "./chunk-XF5QKI75.mjs";
4
+ import "./chunk-7NUYW5IW.mjs";
5
5
 
6
6
  // packages/plugins/plugin-thread/src/components/ThreadMain.tsx
7
7
  import React from "react";
@@ -23,4 +23,4 @@ var ThreadMain_default = ThreadMain;
23
23
  export {
24
24
  ThreadMain_default as default
25
25
  };
26
- //# sourceMappingURL=ThreadMain-DU6LBSN3.mjs.map
26
+ //# sourceMappingURL=ThreadMain-ML3P4XSD.mjs.map
@@ -1,6 +1,4 @@
1
1
  // packages/plugins/plugin-thread/src/meta.tsx
2
- import { Chat } from "@phosphor-icons/react";
3
- import React from "react";
4
2
  import { pluginMeta } from "@dxos/app-framework";
5
3
  var THREAD_PLUGIN = "dxos.org/plugin/thread";
6
4
  var THREAD_ITEM = `${THREAD_PLUGIN}/item`;
@@ -9,8 +7,7 @@ var meta_default = pluginMeta({
9
7
  name: "Threads",
10
8
  // TODO(wittjosiah): Update once scope of threads expands.
11
9
  description: "Comment threads on documents.",
12
- iconComponent: (props) => /* @__PURE__ */ React.createElement(Chat, props),
13
- iconSymbol: "ph--chat--regular"
10
+ icon: "ph--chat--regular"
14
11
  });
15
12
 
16
13
  export {
@@ -18,4 +15,4 @@ export {
18
15
  THREAD_ITEM,
19
16
  meta_default
20
17
  };
21
- //# sourceMappingURL=chunk-5IBJO53M.mjs.map
18
+ //# sourceMappingURL=chunk-7NUYW5IW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { pluginMeta } from '@dxos/app-framework';\n\nexport const THREAD_PLUGIN = 'dxos.org/plugin/thread';\nexport const THREAD_ITEM = `${THREAD_PLUGIN}/item`;\n\nexport default pluginMeta({\n id: THREAD_PLUGIN,\n name: 'Threads',\n // TODO(wittjosiah): Update once scope of threads expands.\n description: 'Comment threads on documents.',\n icon: 'ph--chat--regular',\n});\n"],
5
+ "mappings": ";AAIA,SAASA,kBAAkB;AAEpB,IAAMC,gBAAgB;AACtB,IAAMC,cAAc,GAAGD,aAAAA;AAE9B,IAAA,eAAeE,WAAW;EACxBC,IAAIH;EACJI,MAAM;;EAENC,aAAa;EACbC,MAAM;AACR,CAAA;",
6
+ "names": ["pluginMeta", "THREAD_PLUGIN", "THREAD_ITEM", "pluginMeta", "id", "name", "description", "icon"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  THREAD_PLUGIN
3
- } from "./chunk-5IBJO53M.mjs";
3
+ } from "./chunk-7NUYW5IW.mjs";
4
4
 
5
5
  // packages/plugins/plugin-thread/src/types.ts
6
6
  var THREAD_ACTION = `${THREAD_PLUGIN}/action`;
@@ -17,4 +17,4 @@ var ThreadAction;
17
17
  export {
18
18
  ThreadAction
19
19
  };
20
- //# sourceMappingURL=chunk-U5UVX4ZP.mjs.map
20
+ //# sourceMappingURL=chunk-GJRBBPXI.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  THREAD_ITEM,
3
3
  THREAD_PLUGIN
4
- } from "./chunk-5IBJO53M.mjs";
4
+ } from "./chunk-7NUYW5IW.mjs";
5
5
 
6
6
  // packages/plugins/plugin-thread/src/hooks/useStatus.ts
7
7
  import { useEffect, useState } from "react";
@@ -72,14 +72,13 @@ var useOnEditAnalytics = (message, editing) => {
72
72
  };
73
73
 
74
74
  // packages/plugins/plugin-thread/src/components/ChatContainer.tsx
75
- import { Chat } from "@phosphor-icons/react";
76
75
  import React2, { useLayoutEffect, useMemo, useRef as useRef2, useState as useState3 } from "react";
77
76
  import { create } from "@dxos/echo-schema";
78
77
  import { MessageType } from "@dxos/plugin-space/types";
79
78
  import { fullyQualifiedId, getSpace as getSpace2, useMembers } from "@dxos/react-client/echo";
80
79
  import { useIdentity as useIdentity2 } from "@dxos/react-client/halo";
81
- import { ScrollArea, useThemeContext as useThemeContext2, useTranslation as useTranslation2 } from "@dxos/react-ui";
82
- import { PlankHeading, plankHeadingIconProps } from "@dxos/react-ui-deck";
80
+ import { Icon, ScrollArea, useThemeContext as useThemeContext2, useTranslation as useTranslation2 } from "@dxos/react-ui";
81
+ import { PlankHeading } from "@dxos/react-ui-deck";
83
82
  import { createBasicExtensions as createBasicExtensions2, createThemeExtensions as createThemeExtensions2, listener } from "@dxos/react-ui-editor";
84
83
  import { mx as mx3 } from "@dxos/react-ui-theme";
85
84
  import { MessageTextbox, Thread, ThreadFooter, threadLayout } from "@dxos/react-ui-thread";
@@ -304,7 +303,10 @@ var ChatHeading = ({ attendableId }) => {
304
303
  className: "flex items-center"
305
304
  }, /* @__PURE__ */ React2.createElement(PlankHeading.Button, {
306
305
  attendableId
307
- }, /* @__PURE__ */ React2.createElement(Chat, plankHeadingIconProps)), /* @__PURE__ */ React2.createElement(PlankHeading.Label, {
306
+ }, /* @__PURE__ */ React2.createElement(Icon, {
307
+ icon: "ph--chat--regular",
308
+ size: 5
309
+ })), /* @__PURE__ */ React2.createElement(PlankHeading.Label, {
308
310
  attendableId
309
311
  }, t("chat heading")));
310
312
  };
@@ -407,4 +409,4 @@ export {
407
409
  ChatHeading,
408
410
  ChatContainer
409
411
  };
410
- //# sourceMappingURL=chunk-AVC4CGJM.mjs.map
412
+ //# sourceMappingURL=chunk-XF5QKI75.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hooks/useStatus.ts", "../../../src/hooks/analytics.ts", "../../../src/components/ChatContainer.tsx", "../../../src/components/MessageContainer.tsx", "../../../src/components/command-extension.ts", "../../../src/util.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\n\n// TODO(burdon): Generalize and factor out.\nexport const useStatus = (space?: Space, channel?: string) => {\n const [processing, setProcessing] = useState(false);\n useEffect(() => {\n if (!space || !channel) {\n return;\n }\n\n const unsubscribe = space.listen(`status/${channel}`, (status) => {\n const { event } = status.payload ?? {};\n setProcessing(event === 'processing');\n });\n\n const t = setInterval(() => {\n setProcessing((prev: any) => {\n if (typeof prev?.ts === 'number' && Date.now() - prev.ts > 30_000) {\n return undefined;\n } else {\n return prev;\n }\n });\n }, 1_000);\n\n return () => {\n unsubscribe();\n clearInterval(t);\n };\n }, [space, channel]);\n\n return processing;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { useIntentDispatcher } from '@dxos/app-framework';\nimport { type ReactiveObject } from '@dxos/echo-schema';\nimport { ObservabilityAction } from '@dxos/plugin-observability/meta';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { useOnTransition } from '@dxos/react-ui';\n\nexport const useAnalyticsCallback = (spaceId: string | undefined, name: string, meta?: any) => {\n const dispatch = useIntentDispatcher();\n\n return useCallback(\n (dynamicMeta?: any) => {\n void dispatch({\n action: ObservabilityAction.SEND_EVENT,\n data: {\n name,\n properties: { ...meta, ...dynamicMeta, spaceId },\n },\n });\n },\n [dispatch, name, meta, spaceId],\n );\n};\n\nexport const useOnEditAnalytics = (message: ReactiveObject<any>, editing: boolean) => {\n const space = getSpace(message);\n\n const onEditAnalytics = useAnalyticsCallback(space?.id, 'threads.comment-edited', {\n messageId: message.id,\n messageLength: message.text.length,\n });\n\n useOnTransition(editing, true, false, onEditAnalytics);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport { create } from '@dxos/echo-schema';\nimport { MessageType } from '@dxos/plugin-space/types';\nimport { fullyQualifiedId, getSpace, useMembers } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { Icon, ScrollArea, useThemeContext, useTranslation } from '@dxos/react-ui';\nimport { PlankHeading } from '@dxos/react-ui-deck';\nimport { createBasicExtensions, createThemeExtensions, listener } from '@dxos/react-ui-editor';\nimport { mx } from '@dxos/react-ui-theme';\nimport { MessageTextbox, type MessageTextboxProps, Thread, ThreadFooter, threadLayout } from '@dxos/react-ui-thread';\nimport { nonNullable } from '@dxos/util';\n\nimport { MessageContainer } from './MessageContainer';\nimport { command } from './command-extension';\nimport { type ThreadContainerProps } from './types';\nimport { useStatus } from '../hooks';\nimport { THREAD_PLUGIN } from '../meta';\nimport { getMessageMetadata } from '../util';\n\nexport const ChatHeading = ({ attendableId }: { attendableId?: string }) => {\n const { t } = useTranslation(THREAD_PLUGIN);\n return (\n <div role='none' className='flex items-center'>\n <PlankHeading.Button attendableId={attendableId}>\n <Icon icon='ph--chat--regular' size={5} />\n </PlankHeading.Button>\n <PlankHeading.Label attendableId={attendableId}>{t('chat heading')}</PlankHeading.Label>\n </div>\n );\n};\n\nexport const ChatContainer = ({ thread, context, current, autoFocusTextbox }: ThreadContainerProps) => {\n const identity = useIdentity()!;\n const space = getSpace(thread);\n const members = useMembers(space?.key);\n const activity = useStatus(space, fullyQualifiedId(thread));\n const { t } = useTranslation(THREAD_PLUGIN);\n // TODO(wittjosiah): This is a hack to reset the editor after a message is sent.\n const [_count, _setCount] = useState(0);\n const rerenderEditor = () => _setCount((count) => count + 1);\n const [autoFocus, setAutoFocus] = useState(autoFocusTextbox);\n const threadScrollRef = useRef<HTMLDivElement | null>(null);\n const { themeMode } = useThemeContext();\n\n const textboxMetadata = getMessageMetadata(fullyQualifiedId(thread), identity);\n const messageRef = useRef('');\n const extensions = useMemo(\n () => [\n createBasicExtensions({ placeholder: t('message placeholder') }),\n createThemeExtensions({ themeMode }),\n listener({ onChange: (text) => (messageRef.current = text) }),\n command,\n ],\n [themeMode, _count],\n );\n\n // TODO(thure): Factor out.\n // TODO(thure): `flex-col-reverse` does not work to start the container scrolled to the end while also using\n // `ScrollArea`. This is the least-bad way I found to scroll to the end on mount. Note that 0ms was insufficient\n // for the desired effect; this is likely hardware-dependent and should be reevaluated.\n const scrollToEnd = (behavior: ScrollBehavior) =>\n setTimeout(() => threadScrollRef.current?.scrollIntoView({ behavior, block: 'end' }), 10);\n\n useLayoutEffect(() => {\n scrollToEnd('instant');\n }, []);\n\n // TODO(burdon): Change to model.\n const handleCreate: MessageTextboxProps['onSend'] = () => {\n if (!messageRef.current?.length) {\n return false;\n }\n\n thread.messages.push(\n create(MessageType, {\n sender: { identityKey: identity.identityKey.toHex() },\n timestamp: new Date().toISOString(),\n text: messageRef.current,\n context,\n }),\n );\n\n messageRef.current = '';\n setAutoFocus(true);\n scrollToEnd('smooth');\n rerenderEditor();\n return true;\n };\n\n const handleDelete = (id: string) => {\n const messageIndex = thread.messages.filter(nonNullable).findIndex((message) => message.id === id);\n if (messageIndex !== -1) {\n thread.messages.splice(messageIndex, 1);\n }\n };\n\n return (\n <Thread\n current={current}\n id={fullyQualifiedId(thread)}\n classNames='bs-full grid-rows-[1fr_min-content_min-content] overflow-hidden transition-[padding-block-end] [[data-sidebar-inline-start-state=open]_&]:lg:pbe-0'\n >\n <ScrollArea.Root classNames='col-span-2'>\n <ScrollArea.Viewport classNames='overflow-anchored after:overflow-anchor after:block after:bs-px after:-mbs-px [&>div]:min-bs-full [&>div]:!grid [&>div]:grid-rows-[1fr_0]'>\n <div role='none' className={mx(threadLayout, 'place-self-end')}>\n {thread.messages.filter(nonNullable).map((message) => (\n <MessageContainer key={message.id} message={message} members={members} onDelete={handleDelete} />\n ))}\n </div>\n {/* NOTE(thure): This can’t also be the `overflow-anchor` because `ScrollArea` injects an interceding node that contains this necessary ref’d element. */}\n <div role='none' className='bs-px -mbs-px' ref={threadScrollRef} />\n <ScrollArea.Scrollbar>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n <MessageTextbox extensions={extensions} autoFocus={autoFocus} onSend={handleCreate} {...textboxMetadata} />\n <ThreadFooter activity={activity}>{t('activity message')}</ThreadFooter>\n </Thread>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { EditorView } from '@codemirror/view';\nimport { Check, PencilSimple, X } from '@phosphor-icons/react';\nimport React, { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { type Expando, type EchoReactiveObject } from '@dxos/echo-schema';\nimport { type MessageType } from '@dxos/plugin-space/types';\nimport { PublicKey } from '@dxos/react-client';\nimport { type SpaceMember } from '@dxos/react-client/echo';\nimport { useIdentity, type Identity } from '@dxos/react-client/halo';\nimport {\n Button,\n ButtonGroup,\n DensityProvider,\n Tooltip,\n useOnTransition,\n useThemeContext,\n useTranslation,\n} from '@dxos/react-ui';\nimport { createBasicExtensions, createThemeExtensions, useTextEditor } from '@dxos/react-ui-editor';\nimport { Mosaic, type MosaicTileComponent } from '@dxos/react-ui-mosaic';\nimport {\n getSize,\n hoverableControlItem,\n hoverableControls,\n hoverableFocusedWithinControls,\n mx,\n} from '@dxos/react-ui-theme';\nimport { MessageHeading, MessageRoot } from '@dxos/react-ui-thread';\nimport { nonNullable } from '@dxos/util';\n\nimport { command } from './command-extension';\nimport { useOnEditAnalytics } from '../hooks';\nimport { THREAD_ITEM, THREAD_PLUGIN } from '../meta';\nimport { getMessageMetadata } from '../util';\n\nconst messageControlClassNames = ['p-1 min-bs-0 transition-opacity items-start', hoverableControlItem];\n\nexport const MessageContainer = ({\n message,\n members,\n onDelete,\n}: {\n message: MessageType;\n members: SpaceMember[];\n onDelete?: (id: string) => void;\n}) => {\n const senderIdentity = members.find(\n (member) => message.sender.identityKey && PublicKey.equals(member.identity.identityKey, message.sender.identityKey),\n )?.identity;\n const messageMetadata = getMessageMetadata(message.id, senderIdentity);\n const userIsAuthor = useIdentity()?.identityKey.toHex() === messageMetadata.authorId;\n const [editing, setEditing] = useState(false);\n const handleDelete = useCallback(() => onDelete?.(message.id), [message, onDelete]);\n const { t } = useTranslation(THREAD_PLUGIN);\n const editLabel = t(editing ? 'save message label' : 'edit message label');\n const deleteLabel = t('delete message label');\n\n return (\n <MessageRoot {...messageMetadata} classNames={[hoverableControls, hoverableFocusedWithinControls]}>\n <MessageHeading authorName={messageMetadata.authorName} timestamp={messageMetadata.timestamp}>\n <ButtonGroup classNames='mie-1'>\n {userIsAuthor && (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Button\n variant='ghost'\n data-testid={editing ? 'thread.message.save' : 'thread.message.edit'}\n classNames={messageControlClassNames}\n onClick={() => setEditing((editing) => !editing)}\n >\n <span className='sr-only'>{editLabel}</span>\n {editing ? <Check className={getSize(4)} /> : <PencilSimple className={getSize(4)} />}\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content classNames='z-[21]'>\n {editLabel}\n <Tooltip.Arrow />\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n )}\n {onDelete && (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Button\n variant='ghost'\n data-testid='thread.message.delete'\n classNames={messageControlClassNames}\n onClick={() => handleDelete()}\n >\n <span className='sr-only'>{deleteLabel}</span>\n <X className={getSize(4)} />\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content classNames='z-[21]'>\n {deleteLabel}\n <Tooltip.Arrow />\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n )}\n </ButtonGroup>\n </MessageHeading>\n <TextboxBlock message={message} isAuthor={userIsAuthor} editing={editing} />\n {message.parts?.filter(nonNullable).map((part, index) => <MessagePart key={index} part={part} />)}\n </MessageRoot>\n );\n};\n\nconst MessagePart = ({ part }: { part: Expando }) => {\n return (\n <Mosaic.Container id={part.id}>\n <Mosaic.DraggableTile type={THREAD_ITEM} path={part.id} item={part} Component={MessageBlockObjectTile} />\n </Mosaic.Container>\n );\n};\n\nconst TextboxBlock = ({\n message,\n isAuthor,\n editing,\n}: {\n message: MessageType;\n editing?: boolean;\n isAuthor?: boolean;\n identity?: Identity;\n}) => {\n const { themeMode } = useThemeContext();\n const inMemoryContentRef = useRef(message.text);\n\n const handleDocumentChange = useCallback((newState: string) => {\n inMemoryContentRef.current = newState;\n }, []);\n\n const saveDocumentChange = useCallback(() => {\n message.text = inMemoryContentRef.current;\n }, [message]);\n\n useOnTransition(editing, true, false, saveDocumentChange);\n\n const { parentRef, focusAttributes, view } = useTextEditor(\n () => ({\n initialValue: message.text,\n extensions: [\n createBasicExtensions({ readonly: !isAuthor || !editing }),\n createThemeExtensions({ themeMode }),\n command,\n EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n handleDocumentChange(update.state.doc.toString());\n }\n }),\n ],\n }),\n [message.text, editing, isAuthor, themeMode, handleDocumentChange],\n );\n\n useEffect(() => {\n editing && view?.focus();\n }, [editing, view]);\n\n useOnEditAnalytics(message, !!editing);\n\n return <div role='none' ref={parentRef} className='mie-4' {...focusAttributes} />;\n};\n\nconst MessageBlockObjectTile: MosaicTileComponent<EchoReactiveObject<any>> = forwardRef(\n ({ draggableStyle, draggableProps, item, active, ...props }, forwardedRef) => {\n let title = item.name ?? item.title ?? item.__typename ?? 'Object';\n if (typeof title !== 'string') {\n title = title?.content ?? '';\n }\n\n return (\n <div\n role='group'\n className={mx('grid col-span-3 py-1 pr-4', hoverableControls, hoverableFocusedWithinControls)}\n style={draggableStyle}\n ref={forwardedRef}\n >\n <DensityProvider density='fine'>\n <Surface\n role='card'\n limit={1}\n data={{ content: item }}\n draggableProps={draggableProps}\n fallback={title}\n {...props}\n />\n </DensityProvider>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { StreamLanguage, HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { type Extension } from '@codemirror/state';\n\nimport { tags } from '@dxos/react-ui-editor';\nimport { mx, tagRoot } from '@dxos/react-ui-theme';\n\n/**\n * https://github.com/codemirror/stream-parser/blob/main/test/test-stream-parser.ts\n */\nconst parser = StreamLanguage.define<{ count: number }>({\n startState: () => ({ count: 0 }),\n token: (stream, state) => {\n state.count++;\n if (stream.eatSpace()) {\n return null;\n }\n if (state.count === 1 && stream.match(/^(\\/\\w+)/)) {\n return 'tagName';\n }\n stream.next();\n return null;\n },\n});\n\nconst styles = HighlightStyle.define([\n {\n tag: tags.tagName,\n class: mx(tagRoot({ palette: 'cyan' }), 'text-baseText font-medium'),\n },\n]);\n\nexport const command: Extension = [parser, syntaxHighlighting(styles)];\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { generateName } from '@dxos/display-name';\nimport { type PublicKey } from '@dxos/react-client';\nimport { type Identity } from '@dxos/react-client/halo';\nimport { type MessageMetadata } from '@dxos/react-ui-thread';\nimport { hexToFallback } from '@dxos/util';\n\nexport type MessagePropertiesProvider = (identityKey: PublicKey | undefined) => MessageMetadata;\n\nexport const getMessageMetadata = (id: string, identity?: Identity): MessageMetadata => {\n const fallback = hexToFallback(identity?.identityKey.toHex() ?? '0');\n return {\n id,\n authorId: identity?.identityKey.toHex(),\n authorName:\n identity?.profile?.displayName ??\n (identity?.identityKey ? generateName(identity.identityKey.toHex()) : undefined),\n authorAvatarProps: {\n hue: identity?.profile?.data?.hue ?? fallback.hue,\n emoji: identity?.profile?.data?.emoji ?? fallback.emoji,\n },\n };\n};\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,WAAWC,gBAAgB;AAK7B,IAAMC,YAAY,CAACC,OAAeC,YAAAA;AACvC,QAAM,CAACC,YAAYC,aAAAA,IAAiBC,SAAS,KAAA;AAC7CC,YAAU,MAAA;AACR,QAAI,CAACL,SAAS,CAACC,SAAS;AACtB;IACF;AAEA,UAAMK,cAAcN,MAAMO,OAAO,UAAUN,OAAAA,IAAW,CAACO,WAAAA;AACrD,YAAM,EAAEC,MAAK,IAAKD,OAAOE,WAAW,CAAC;AACrCP,oBAAcM,UAAU,YAAA;IAC1B,CAAA;AAEA,UAAME,IAAIC,YAAY,MAAA;AACpBT,oBAAc,CAACU,SAAAA;AACb,YAAI,OAAOA,MAAMC,OAAO,YAAYC,KAAKC,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E,OAAA,cAAC4E,WAAWC,MAAI;IAACF,YAAW;KAC1B,gBAAA3E,OAAA,cAAC4E,WAAWE,UAAQ;IAACH,YAAW;KAC9B,gBAAA3E,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAW4E,IAAGC,cAAc,gBAAA;KAC1CrE,OAAO6C,SAASa,OAAOC,YAAAA,EAAaW,IAAI,CAACT,YACxC,gBAAAxE,OAAA,cAACkF,kBAAAA;IAAiB7D,KAAKmD,QAAQL;IAAIK;IAAkBrD;IAAkBgE,UAAUjB;QAIrF,gBAAAlE,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;IAAgBiF,KAAKpD;MAChD,gBAAAhC,OAAA,cAAC4E,WAAWS,WAAS,MACnB,gBAAArF,OAAA,cAAC4E,WAAWU,OAAK,IAAA,CAAA,CAAA,CAAA,GAIvB,gBAAAtF,OAAA,cAACuF,gBAAAA;IAAehD;IAAwBT;IAAsB0D,QAAQlC;IAAe,GAAGlB;MACxF,gBAAApC,OAAA,cAACyF,cAAAA;IAAanE;KAAqBzB,EAAE,kBAAA,CAAA,CAAA;AAG3C;",
6
+ "names": ["useEffect", "useState", "useStatus", "space", "channel", "processing", "setProcessing", "useState", "useEffect", "unsubscribe", "listen", "status", "event", "payload", "t", "setInterval", "prev", "ts", "Date", "now", "undefined", "clearInterval", "useCallback", "useIntentDispatcher", "ObservabilityAction", "getSpace", "useOnTransition", "useAnalyticsCallback", "spaceId", "name", "meta", "dispatch", "useIntentDispatcher", "useCallback", "dynamicMeta", "action", "ObservabilityAction", "SEND_EVENT", "data", "properties", "useOnEditAnalytics", "message", "editing", "space", "getSpace", "onEditAnalytics", "id", "messageId", "messageLength", "text", "length", "useOnTransition", "React", "useLayoutEffect", "useMemo", "useRef", "useState", "create", "MessageType", "fullyQualifiedId", "getSpace", "useMembers", "useIdentity", "Icon", "ScrollArea", "useThemeContext", "useTranslation", "PlankHeading", "createBasicExtensions", "createThemeExtensions", "listener", "mx", "MessageTextbox", "Thread", "ThreadFooter", "threadLayout", "nonNullable", "EditorView", "Check", "PencilSimple", "X", "React", "forwardRef", "useCallback", "useEffect", "useRef", "useState", "Surface", "PublicKey", "useIdentity", "Button", "ButtonGroup", "DensityProvider", "Tooltip", "useOnTransition", "useThemeContext", "useTranslation", "createBasicExtensions", "createThemeExtensions", "useTextEditor", "Mosaic", "getSize", "hoverableControlItem", "hoverableControls", "hoverableFocusedWithinControls", "mx", "MessageHeading", "MessageRoot", "nonNullable", "StreamLanguage", "HighlightStyle", "syntaxHighlighting", "tags", "mx", "tagRoot", "parser", "StreamLanguage", "define", "startState", "count", "token", "stream", "state", "eatSpace", "match", "next", "styles", "HighlightStyle", "tag", "tags", "tagName", "class", "mx", "tagRoot", "palette", "command", "syntaxHighlighting", "generateName", "hexToFallback", "getMessageMetadata", "id", "identity", "fallback", "hexToFallback", "identityKey", "toHex", "authorId", "authorName", "profile", "displayName", "generateName", "undefined", "authorAvatarProps", "hue", "data", "emoji", "messageControlClassNames", "hoverableControlItem", "MessageContainer", "message", "members", "onDelete", "senderIdentity", "find", "member", "sender", "identityKey", "PublicKey", "equals", "identity", "messageMetadata", "getMessageMetadata", "id", "userIsAuthor", "useIdentity", "toHex", "authorId", "editing", "setEditing", "useState", "handleDelete", "useCallback", "t", "useTranslation", "THREAD_PLUGIN", "editLabel", "deleteLabel", "MessageRoot", "classNames", "hoverableControls", "hoverableFocusedWithinControls", "MessageHeading", "authorName", "timestamp", "ButtonGroup", "Tooltip", "Root", "Trigger", "asChild", "Button", "variant", "data-testid", "onClick", "span", "className", "Check", "getSize", "PencilSimple", "Portal", "Content", "Arrow", "X", "TextboxBlock", "isAuthor", "parts", "filter", "nonNullable", "map", "part", "index", "MessagePart", "key", "Mosaic", "Container", "DraggableTile", "type", "THREAD_ITEM", "path", "item", "Component", "MessageBlockObjectTile", "themeMode", "useThemeContext", "inMemoryContentRef", "useRef", "text", "handleDocumentChange", "newState", "current", "saveDocumentChange", "useOnTransition", "parentRef", "focusAttributes", "view", "useTextEditor", "initialValue", "extensions", "createBasicExtensions", "readonly", "createThemeExtensions", "command", "EditorView", "updateListener", "of", "update", "docChanged", "state", "doc", "toString", "useEffect", "focus", "useOnEditAnalytics", "div", "role", "ref", "forwardRef", "draggableStyle", "draggableProps", "active", "props", "forwardedRef", "title", "name", "__typename", "content", "mx", "style", "DensityProvider", "density", "Surface", "limit", "data", "fallback", "ChatHeading", "attendableId", "t", "useTranslation", "THREAD_PLUGIN", "React", "div", "role", "className", "PlankHeading", "Button", "Icon", "icon", "size", "Label", "ChatContainer", "thread", "context", "current", "autoFocusTextbox", "identity", "useIdentity", "space", "getSpace", "members", "useMembers", "key", "activity", "useStatus", "fullyQualifiedId", "_count", "_setCount", "useState", "rerenderEditor", "count", "autoFocus", "setAutoFocus", "threadScrollRef", "useRef", "themeMode", "useThemeContext", "textboxMetadata", "getMessageMetadata", "messageRef", "extensions", "useMemo", "createBasicExtensions", "placeholder", "createThemeExtensions", "listener", "onChange", "text", "command", "scrollToEnd", "behavior", "setTimeout", "scrollIntoView", "block", "useLayoutEffect", "handleCreate", "length", "messages", "push", "create", "MessageType", "sender", "identityKey", "toHex", "timestamp", "Date", "toISOString", "handleDelete", "id", "messageIndex", "filter", "nonNullable", "findIndex", "message", "splice", "Thread", "classNames", "ScrollArea", "Root", "Viewport", "mx", "threadLayout", "map", "MessageContainer", "onDelete", "ref", "Scrollbar", "Thumb", "MessageTextbox", "onSend", "ThreadFooter"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ThreadAction
3
- } from "./chunk-U5UVX4ZP.mjs";
3
+ } from "./chunk-GJRBBPXI.mjs";
4
4
  import {
5
5
  ChatContainer,
6
6
  ChatHeading,
@@ -10,29 +10,27 @@ import {
10
10
  useAnalyticsCallback,
11
11
  useOnEditAnalytics,
12
12
  useStatus
13
- } from "./chunk-AVC4CGJM.mjs";
13
+ } from "./chunk-XF5QKI75.mjs";
14
14
  import {
15
15
  THREAD_ITEM,
16
16
  THREAD_PLUGIN,
17
17
  meta_default
18
- } from "./chunk-5IBJO53M.mjs";
18
+ } from "./chunk-7NUYW5IW.mjs";
19
19
 
20
20
  // packages/plugins/plugin-thread/src/ThreadPlugin.tsx
21
- import { Chat } from "@phosphor-icons/react";
22
21
  import { computed, effect } from "@preact/signals-core";
23
22
  import React6 from "react";
24
- import { LayoutAction as LayoutAction2, NavigationAction, parseIntentPlugin, parseNavigationPlugin, resolvePlugin, parseGraphPlugin, SLUG_PATH_SEPARATOR, SLUG_COLLECTION_INDICATOR, isLayoutParts, parseMetadataResolverPlugin } from "@dxos/app-framework";
23
+ import { LayoutAction as LayoutAction2, NavigationAction, parseIntentPlugin, parseNavigationPlugin, resolvePlugin, isLayoutParts, parseMetadataResolverPlugin } from "@dxos/app-framework";
25
24
  import { getTypename } from "@dxos/echo-schema";
26
25
  import { create as create2 } from "@dxos/echo-schema";
27
26
  import { LocalStorageStore } from "@dxos/local-storage";
28
27
  import { log } from "@dxos/log";
29
- import { parseAttentionPlugin } from "@dxos/plugin-attention";
30
28
  import { parseClientPlugin } from "@dxos/plugin-client";
31
- import { createExtension, isActionGroup } from "@dxos/plugin-graph";
29
+ import { createExtension, isActionGroup, toSignal } from "@dxos/plugin-graph";
32
30
  import { ObservabilityAction } from "@dxos/plugin-observability/meta";
33
31
  import { SpaceAction } from "@dxos/plugin-space";
34
32
  import { ThreadType, MessageType as MessageType2, ChannelType } from "@dxos/plugin-space/types";
35
- import { getSpace as getSpace2, getTextInRange, Filter, createDocAccessor, fullyQualifiedId as fullyQualifiedId4, loadObjectReferences } from "@dxos/react-client/echo";
33
+ import { getSpace as getSpace2, getTextInRange, createDocAccessor, fullyQualifiedId as fullyQualifiedId4, loadObjectReferences } from "@dxos/react-client/echo";
36
34
  import { comments, createExternalCommentSync, listener as listener2 } from "@dxos/react-ui-editor";
37
35
  import { translations as threadTranslations } from "@dxos/react-ui-thread";
38
36
  import { nonNullable as nonNullable3 } from "@dxos/util";
@@ -214,11 +212,11 @@ var CommentContainer = ({ thread, detached, context, current, autoFocusTextbox,
214
212
  };
215
213
 
216
214
  // packages/plugins/plugin-thread/src/components/CommentsContainer.tsx
217
- import { ChatText, Quotes } from "@phosphor-icons/react";
215
+ import { ChatText } from "@phosphor-icons/react";
218
216
  import React3, { useEffect as useEffect2 } from "react";
219
217
  import { fullyQualifiedId as fullyQualifiedId2 } from "@dxos/react-client/echo";
220
- import { useTranslation as useTranslation3, Trans } from "@dxos/react-ui";
221
- import { PlankHeading, plankHeadingIconProps } from "@dxos/react-ui-deck";
218
+ import { useTranslation as useTranslation3, Icon, Trans } from "@dxos/react-ui";
219
+ import { PlankHeading } from "@dxos/react-ui-deck";
222
220
  import { descriptionText, mx as mx2 } from "@dxos/react-ui-theme";
223
221
  var CommentsHeading = ({ attendableId }) => {
224
222
  const { t } = useTranslation3(THREAD_PLUGIN);
@@ -227,7 +225,10 @@ var CommentsHeading = ({ attendableId }) => {
227
225
  className: "flex items-center"
228
226
  }, /* @__PURE__ */ React3.createElement(PlankHeading.Button, {
229
227
  attendableId
230
- }, /* @__PURE__ */ React3.createElement(Quotes, plankHeadingIconProps)), /* @__PURE__ */ React3.createElement(PlankHeading.Label, {
228
+ }, /* @__PURE__ */ React3.createElement(Icon, {
229
+ icon: "ph--quotes--regular",
230
+ size: 5
231
+ })), /* @__PURE__ */ React3.createElement(PlankHeading.Label, {
231
232
  attendableId
232
233
  }, t("comments heading")));
233
234
  };
@@ -283,8 +284,8 @@ var CommentsContainer = ({ threads, detached = [], currentId, autoFocusCurrentTe
283
284
  };
284
285
 
285
286
  // packages/plugins/plugin-thread/src/components/index.ts
286
- var ThreadMain = React4.lazy(() => import("./ThreadMain-DU6LBSN3.mjs"));
287
- var ThreadArticle = React4.lazy(() => import("./ThreadArticle-6L6BGE4Z.mjs"));
287
+ var ThreadMain = React4.lazy(() => import("./ThreadMain-ML3P4XSD.mjs"));
288
+ var ThreadArticle = React4.lazy(() => import("./ThreadArticle-4VU752F4.mjs"));
288
289
 
289
290
  // packages/plugins/plugin-thread/src/components/ThreadComplementary.tsx
290
291
  import React5, { useEffect as useEffect3, useMemo as useMemo2 } from "react";
@@ -457,7 +458,6 @@ var ThreadPlugin = () => {
457
458
  }
458
459
  return viewStore[subjectId];
459
460
  };
460
- let attentionPlugin;
461
461
  let navigationPlugin;
462
462
  let intentPlugin;
463
463
  const unsubscribeCallbacks = [];
@@ -470,38 +470,8 @@ var ThreadPlugin = () => {
470
470
  allowUndefined: true
471
471
  })
472
472
  });
473
- attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
474
473
  navigationPlugin = resolvePlugin(plugins, parseNavigationPlugin);
475
474
  intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
476
- const graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
477
- const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
478
- if (!client) {
479
- return;
480
- }
481
- const channelsQuery = client.spaces.query(Filter.schema(ChannelType));
482
- const queryUnsubscribe = channelsQuery.subscribe();
483
- const unsubscribe = effect(() => {
484
- const attention = attentionPlugin?.provides.attention;
485
- if (!attention?.attended) {
486
- return;
487
- }
488
- const firstAttendedNodeWithComments = Array.from(attention.attended).map((id) => graphPlugin?.provides.graph.findNode(id)).find((node) => {
489
- const data = node?.data;
490
- return Array.isArray(data?.threads) && data.threads.length > 0;
491
- });
492
- if (firstAttendedNodeWithComments) {
493
- void intentPlugin?.provides.intent.dispatch({
494
- action: NavigationAction.OPEN,
495
- data: {
496
- activeParts: {
497
- complementary: `${firstAttendedNodeWithComments.id}${SLUG_PATH_SEPARATOR}comments`
498
- }
499
- }
500
- });
501
- }
502
- });
503
- unsubscribeCallbacks.push(queryUnsubscribe);
504
- unsubscribeCallbacks.push(unsubscribe);
505
475
  },
506
476
  unload: async () => {
507
477
  unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
@@ -517,8 +487,7 @@ var ThreadPlugin = () => {
517
487
  ns: THREAD_PLUGIN
518
488
  }
519
489
  ],
520
- icon: (props) => /* @__PURE__ */ React6.createElement(Chat, props),
521
- iconSymbol: "ph--chat--regular",
490
+ icon: "ph--chat--regular",
522
491
  // TODO(wittjosiah): Move out of metadata.
523
492
  loadReferences: (channel) => loadObjectReferences(channel, (channel2) => channel2.threads)
524
493
  },
@@ -577,27 +546,33 @@ var ThreadPlugin = () => {
577
546
  if (!id.endsWith("~comments")) {
578
547
  return;
579
548
  }
580
- const docId = id.split("~").at(0);
581
- const [spaceId, objectId] = docId?.split(":") ?? [];
549
+ const subjectId = id.split("~").at(0);
550
+ const [spaceId, objectId] = subjectId?.split(":") ?? [];
582
551
  const space = client.spaces.get().find((space2) => space2.id === spaceId);
583
- const doc = space?.db.getObjectById(objectId);
584
- if (!doc || !docId) {
552
+ const object = toSignal((onChange) => {
553
+ const timeout = setTimeout(async () => {
554
+ await space?.db.loadObjectById(objectId);
555
+ onChange();
556
+ });
557
+ return () => clearTimeout(timeout);
558
+ }, () => space?.db.getObjectById(objectId), subjectId);
559
+ if (!object || !subjectId) {
585
560
  return;
586
561
  }
587
- const docMeta = metadataResolver(getTypename(doc) ?? "");
588
- const label = docMeta.label?.(doc) || doc.name || docMeta.placeholder || [
562
+ const meta = metadataResolver(getTypename(object) ?? "");
563
+ const label = meta.label?.(object) || object.name || meta.placeholder || [
589
564
  "unnamed object threads label",
590
565
  {
591
566
  ns: THREAD_PLUGIN
592
567
  }
593
568
  ];
594
- const viewState = getViewState(docId);
569
+ const viewState = getViewState(subjectId);
595
570
  return {
596
571
  id,
597
572
  type: "orphan-comments-for-subject",
598
- data: doc,
573
+ data: object,
599
574
  properties: {
600
- icon: meta_default.iconComponent,
575
+ icon: meta.icon,
601
576
  label,
602
577
  showResolvedThreads: viewState.showResolvedThreads
603
578
  }
@@ -639,7 +614,7 @@ var ThreadPlugin = () => {
639
614
  menuItemType: "toggle",
640
615
  isChecked: viewState.showResolvedThreads,
641
616
  testId: "threadPlugin.toggleShowResolved",
642
- iconSymbol: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
617
+ icon: viewState.showResolvedThreads ? "ph--eye-slash--regular" : "ph--eye--regular"
643
618
  }
644
619
  }
645
620
  ];
@@ -684,8 +659,7 @@ var ThreadPlugin = () => {
684
659
  ns: THREAD_PLUGIN
685
660
  }
686
661
  ],
687
- icon: (props) => /* @__PURE__ */ React6.createElement(Chat, props),
688
- iconSymbol: "ph--chat--regular",
662
+ icon: "ph--chat--regular",
689
663
  testId: "threadPlugin.createObject"
690
664
  }
691
665
  }
@@ -764,7 +738,7 @@ var ThreadPlugin = () => {
764
738
  } catch (e) {
765
739
  log.error("Subject does not support threads array", subject?.typename, {
766
740
  F: __dxlog_file,
767
- L: 369,
741
+ L: 332,
768
742
  S: void 0,
769
743
  C: (f, a) => f(...a)
770
744
  });
@@ -790,14 +764,6 @@ var ThreadPlugin = () => {
790
764
  data: thread,
791
765
  intents: [
792
766
  [
793
- {
794
- action: NavigationAction.OPEN,
795
- data: {
796
- activeParts: {
797
- complementary: `${subjectId}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`
798
- }
799
- }
800
- },
801
767
  {
802
768
  action: ThreadAction.SELECT,
803
769
  data: {