@dxos/react-ui-thread 0.8.4-main.fd6878d → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/dist/lib/browser/chunk-QFRRLZVL.mjs +31 -0
- package/dist/lib/browser/chunk-QFRRLZVL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +508 -221
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +9 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/Message/Message.d.ts +81 -10
- package/dist/types/src/Message/Message.d.ts.map +1 -1
- package/dist/types/src/Message/Message.stories.d.ts +27 -17
- package/dist/types/src/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/Message/index.d.ts +2 -1
- package/dist/types/src/Message/index.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.d.ts +76 -13
- package/dist/types/src/Thread/Thread.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.stories.d.ts +33 -5
- package/dist/types/src/Thread/Thread.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/index.d.ts +2 -1
- package/dist/types/src/Thread/index.d.ts.map +1 -1
- package/dist/types/src/command.d.ts +3 -0
- package/dist/types/src/command.d.ts.map +1 -0
- package/dist/types/src/context.d.ts +227 -0
- package/dist/types/src/context.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +7 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +9 -14
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +17 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +36 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -28
- package/src/Message/Message.stories.tsx +40 -29
- package/src/Message/Message.tsx +327 -69
- package/src/Message/index.ts +10 -1
- package/src/Thread/Thread.stories.tsx +28 -72
- package/src/Thread/Thread.tsx +296 -38
- package/src/Thread/index.ts +9 -1
- package/src/command.ts +58 -0
- package/src/context.ts +21 -0
- package/src/index.ts +28 -6
- package/src/testing.ts +48 -0
- package/src/translations.ts +16 -11
- package/src/types.ts +38 -5
- package/dist/types/src/Thread/Comments.stories.d.ts +0 -52
- package/dist/types/src/Thread/Comments.stories.d.ts.map +0 -1
- package/src/Thread/Comments.stories.tsx +0 -371
- package/src/testing.tsx +0 -57
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = 'react-ui-thread';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {\n 'plugin name': 'Threads',\n 'thread title placeholder': 'New thread',\n 'thread title label': 'Title',\n 'delete thread label': 'Delete',\n 'create thread label': 'Create thread',\n 'message placeholder': 'Enter message...',\n 'comment placeholder': 'Enter comment...',\n 'settings standalone label': 'Enable standalone thread creation',\n 'anonymous label': 'Anonymous',\n 'enter to send message': 'Enter to add ⏎',\n },\n },\n },\n] as const satisfies Resource[];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { Icon, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/react-ui-theme';\n\nimport { translationKey } from '../translations';\nimport type { ThreadEntity } from '../types';\n\n// TODO(burdon): Why is this exported?\nexport const threadLayout = 'is-full place-self-start grid grid-cols-[var(--rail-size)_1fr]';\n\n//\n// Root\n//\n\ntype ThreadRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & ThreadEntity & { current?: boolean };\n\nconst ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(\n ({ current, children, classNames, ...props }, forwardedRef) => {\n return (\n <div\n role='group'\n data-testid='thread'\n {...(current && { 'aria-current': typeof current === 'string' ? current : 'location' })}\n {...props}\n className={mx(\n threadLayout,\n hoverableFocusedWithinControls,\n 'bg-[var(--surface-bg)] current-related attention-surface [--controls-opacity:0]',\n classNames,\n )}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\n//\n// Heading\n//\n\ntype ThreadHeaderProps = ThemedClassName<ComponentPropsWithRef<'div'>> & { detached?: boolean };\n\nconst ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(\n ({ classNames, children, detached, ...props }, forwardedRef) => {\n return (\n <>\n <div role='none' className='flex items-center justify-center text-description'>\n <Icon icon='ph--caret-double-right--regular' />\n </div>\n <div role='none' className='flex items-center overflow-hidden'>\n <p\n role='heading'\n data-testid='thread.heading'\n {...props}\n className={mx(\n 'mie-2 text-description font-medium truncate italic',\n detached && 'line-through decoration-1',\n )}\n ref={forwardedRef}\n >\n {children}\n </p>\n </div>\n </>\n );\n },\n);\n\n//\n// Status\n//\n\ntype ThreadStatusProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {\n activity?: boolean;\n};\n\nconst ThreadStatus = forwardRef<HTMLDivElement, ThreadStatusProps>(\n ({ activity, classNames, children, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n return (\n <div\n {...props}\n className={mx(\n 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pie-2 text-xs text-description',\n classNames,\n )}\n ref={forwardedRef}\n >\n <Icon\n icon='ph--spinner--bold'\n classNames='is-6 bs-4 invisible data-[visible=show]:visible animate-spin-slow'\n data-visible={activity ? 'show' : 'hide'}\n />\n <span className='truncate min-is-0' aria-live='polite'>\n {activity ? children : null}\n </span>\n <span className={mx('text-end', hoverableControlItem)}>{t('enter to send message')}</span>\n </div>\n );\n },\n);\n\nexport const Thread = {\n Root: ThreadRoot,\n Header: ThreadHeader,\n Status: ThreadStatus,\n};\n\nexport type { ThreadRootProps, ThreadHeaderProps as ThreadHeadingProps, ThreadStatusProps };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\nimport React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';\n\n// TODO(burdon): Remove dep.\nimport { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { type UseTextEditorProps, keymap, listener, useTextEditor } from '@dxos/react-ui-editor';\nimport { focusRing, mx } from '@dxos/react-ui-theme';\nimport { hexToEmoji, hexToHue, isNotFalsy } from '@dxos/util';\n\nimport { translationKey } from '../translations';\nimport { type MessageMetadata } from '../types';\n\nconst avatarSize = 7;\n\nexport type MessageRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> &\n MessageMetadata &\n Partial<{ continues: boolean }>;\n\nexport const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(\n (\n { authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps },\n forwardedRef,\n ) => {\n return (\n // Must wrap the message since Avatar.Label may be used in the content.\n <Avatar.Root>\n <div\n role='none'\n data-testid='thread.message'\n {...rootProps}\n className={mx('grid grid-cols-subgrid col-span-2', classNames)}\n ref={forwardedRef}\n >\n <div role='none' className='flex flex-col items-center gap-2 pbs-2'>\n <Avatar.Content\n size={avatarSize}\n hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}\n fallback={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')}\n {...(authorImgSrc && { imgSrc: authorImgSrc })}\n />\n {continues && <div role='none' className='is-px grow bg-separator' />}\n </div>\n <div role='none' className='plb-1 min-is-0'>\n {children}\n </div>\n </div>\n </Avatar.Root>\n );\n },\n);\n\nexport type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> &\n Pick<MessageMetadata, 'authorName' | 'timestamp'>;\n\nexport const MessageHeading = ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => {\n return (\n <div role='none' {...props} className={mx('flex gap-2 items-start', classNames)}>\n <p className='grow'>\n <MessageAuthorName authorName={authorName} />\n {timestamp && <MessageTime timestamp={timestamp} />}\n </p>\n {children}\n </div>\n );\n};\n\nexport type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;\n\nexport const MessageAuthorName = ({ authorName }: MessageAuthorNameProps) => {\n const { t } = useTranslation(translationKey);\n return (\n <Avatar.Label classNames='block truncate text-sm text-subdued'>{authorName ?? t('anonymous label')}</Avatar.Label>\n );\n};\n\nexport type MessageTimeProps = Pick<MessageMetadata, 'timestamp'>;\n\nexport const MessageTime = ({ timestamp }: MessageTimeProps) => {\n const { dtLocale } = useTranslation(translationKey);\n const dt = timestamp ? new Date(timestamp) : undefined;\n return (\n <time className='block text-subdued text-xs pbe-0.5' dateTime={dt?.toISOString()}>\n {dt ? formatDistanceToNow(dt, { locale: dtLocale, addSuffix: true }) : ''}\n </time>\n );\n};\n\nexport type MessageBodyProps = ComponentPropsWithoutRef<'p'>;\n\nexport const MessageBody = ({ children, ...props }: MessageBodyProps) => {\n return <p {...props}>{children}</p>;\n};\n\nexport type MessageTextboxProps = {\n disabled?: boolean;\n onSend?: () => void;\n onClear?: () => void;\n onEditorFocus?: () => void;\n} & MessageMetadata &\n UseTextEditorProps;\n\nconst keyBindings = ({ onSend, onClear }: Pick<MessageTextboxProps, 'onSend' | 'onClear'>) => [\n {\n key: 'Enter',\n run: () => {\n if (onSend) {\n onSend();\n return true;\n } else {\n return false;\n }\n },\n },\n {\n // TODO(burdon): Other key bindings.\n key: 'Meta+Backspace',\n run: () => {\n if (onClear) {\n onClear();\n return true;\n } else {\n return false;\n }\n },\n },\n];\n\nexport const MessageTextbox = ({\n id,\n authorId,\n authorName,\n authorImgSrc,\n authorAvatarProps,\n disabled,\n extensions,\n onSend,\n onClear,\n onEditorFocus,\n ...editorProps\n}: MessageTextboxProps) => {\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n extensions: [\n keymap.of(keyBindings({ onSend, onClear })),\n listener({\n onFocus: (focusing) => {\n if (focusing) {\n onEditorFocus?.();\n }\n },\n }),\n extensions,\n ].filter(isNotFalsy),\n ...editorProps,\n }),\n [id, extensions],\n );\n\n return (\n <MessageRoot {...{ id, authorId, authorName, authorImgSrc, authorAvatarProps }} continues={false}>\n <div\n role='none'\n ref={parentRef}\n className={mx('plb-0.5 mie-1 rounded-sm', focusRing, disabled && 'opacity-50')}\n {...focusAttributes}\n />\n </MessageRoot>\n );\n};\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,cAAAA,GAAiB;QAChB,eAAe;QACf,4BAA4B;QAC5B,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,6BAA6B;QAC7B,mBAAmB;QACnB,yBAAyB;MAC3B;IACF;EACF;;;;;ACpBF,OAAOE,SAAqCC,kBAAkB;AAE9D,SAASC,MAA4BC,sBAAsB;AAC3D,SAASC,sBAAsBC,gCAAgCC,UAAU;AAMlE,IAAMC,eAAe;AAQ5B,IAAMC,aAAaC,2BACjB,CAAC,EAAEC,SAASC,UAAUC,YAAY,GAAGC,MAAAA,GAASC,iBAAAA;;;AAC5C,WACE,sBAAA,cAACC,OAAAA;MACCC,MAAK;MACLC,eAAY;MACX,GAAIP,WAAW;QAAE,gBAAgB,OAAOA,YAAY,WAAWA,UAAU;MAAW;MACpF,GAAGG;MACJK,WAAWC,GACTZ,cACAa,gCACA,mFACAR,UAAAA;MAEFS,KAAKP;OAEJH,QAAAA;;;;AAGP,CAAA;AASF,IAAMW,eAAeb,2BACnB,CAAC,EAAEG,YAAYD,UAAUY,UAAU,GAAGV,MAAAA,GAASC,iBAAAA;;;AAC7C,WACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACC,OAAAA;MAAIC,MAAK;MAAOE,WAAU;OACzB,s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CC,MAAK;MACLI,KAAKyC;MACL3C,WAAWC,IAAG,4BAA4BoD,WAAWd,YAAY,YAAA;MAChE,GAAGK;;;;;AAIZ;",
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/Thread/Thread.tsx", "../../../src/command.ts", "../../../src/context.ts", "../../../src/Message/Message.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, {\n type ComponentPropsWithRef,\n type ReactNode,\n forwardRef,\n type PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport {\n type ComposableProps,\n Icon,\n IconButton,\n ScrollArea,\n type ThemedClassName,\n composable,\n composableProps,\n useThemeContext,\n useTranslation,\n} from '@dxos/react-ui';\nimport { Mosaic, type MosaicTileProps } from '@dxos/react-ui-mosaic';\nimport { type Message as MessageType } from '@dxos/types';\nimport { type Extension, createBasicExtensions, createThemeExtensions, listener } from '@dxos/ui-editor';\nimport { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';\n\nimport { command } from '../command';\nimport { ThreadContextProvider, useThreadContext } from '../context';\nimport { Message } from '../Message';\nimport { translationKey } from '../translations';\nimport { type MessageMetadata, type ThreadContextValue } from '../types';\n\nconst getMessageId = (message: MessageType.Message) => Obj.getURI(message);\n\n//\n// Root\n//\n\nexport type ThreadRootProps = PropsWithChildren<\n Omit<ThreadContextValue, 'components'> & Partial<Pick<ThreadContextValue, 'components'>>\n>;\n\n/**\n * Headless root of a thread. Provides message-tile context (metadata resolver,\n * injected renderers, callbacks) and the Mosaic root that `Thread.Messages`\n * renders its virtual stack within. Renders no DOM of its own — wrap the visible\n * thread chrome in `Thread.Content`.\n */\nconst ThreadRoot = ({\n children,\n getMetadata,\n components,\n identityDid,\n editable,\n onMessageDelete,\n onAcceptProposal,\n}: ThreadRootProps) => {\n // Composer focus handler registered by Thread.Textbox; invoked by Thread.Header's caret.\n const composerFocus = useRef<(() => void) | undefined>(undefined);\n\n const registerComposerFocus = useCallback((focus: (() => void) | undefined) => {\n composerFocus.current = focus;\n }, []);\n\n const focusComposer = useCallback(() => composerFocus.current?.(), []);\n\n return (\n <ThreadContextProvider\n getMetadata={getMetadata}\n components={components ?? {}}\n identityDid={identityDid}\n editable={editable}\n registerComposerFocus={registerComposerFocus}\n focusComposer={focusComposer}\n onMessageDelete={onMessageDelete}\n onAcceptProposal={onAcceptProposal}\n >\n <Mosaic.Root>{children}</Mosaic.Root>\n </ThreadContextProvider>\n );\n};\n\nThreadRoot.displayName = 'Thread.Root';\n\n//\n// Content\n//\n\ntype ThreadContentExtra = {\n id?: string;\n current?: boolean | string;\n} & Pick<ComponentPropsWithRef<'div'>, 'onClickCapture' | 'onFocusCapture'>;\n\nexport type ThreadContentProps = ComposableProps<ThreadContentExtra>;\n\n/** Visible thread container (the attention surface that hosts header / messages / composer). */\nconst ThreadContent = composable<HTMLDivElement, ThreadContentExtra>(\n ({ children, current, id, ...props }, forwardedRef) => {\n return (\n <div\n {...composableProps(props, {\n role: 'group',\n classNames: [\n 'flex flex-col bg-[var(--surface-bg)] current-related dx-attention-surface [--controls-opacity:0]',\n hoverableFocusedWithinControls,\n ],\n })}\n data-testid='thread'\n id={id}\n aria-current={current ? 'location' : undefined}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\nThreadContent.displayName = 'Thread.Content';\n\n//\n// Header\n//\n\nexport type ThreadHeaderProps = Omit<\n ComposableProps<{\n /** Snippet text rendered inside a `<p>` (a string, not a DOM element). */\n title?: string;\n detached?: boolean;\n /** Whether this is the current/selected thread; accents the title. */\n current?: boolean;\n /** Trailing controls rendered in the right column (aligns with message-tile controls). */\n controls?: ReactNode;\n /** Invoked when the caret affordance is activated to select/focus this thread. */\n onSelect?: () => void;\n }>,\n 'children'\n>;\n\n/**\n * Thread header row: caret (rail) · snippet (content) · controls. Owns its own\n * `[rail · 1fr · controls]` grid so the trailing controls align with message-tile\n * controls (which use the same template) — no grid is leaked in from the caller.\n */\nconst ThreadHeader = composable<HTMLDivElement, ThreadHeaderProps>(\n ({ title, detached, current, controls, onSelect, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n const { focusComposer } = useThreadContext('Thread.Header');\n const handleSelect = useCallback(() => {\n onSelect?.();\n focusComposer();\n }, [onSelect, focusComposer]);\n\n return (\n <div\n {...composableProps(props, {\n classNames: [\n 'grid grid-cols-[var(--dx-rail-size)_1fr_min-content] items-center',\n hoverableControls,\n hoverableFocusedWithinControls,\n ],\n })}\n ref={forwardedRef}\n >\n <div className='flex items-center justify-center'>\n <IconButton\n iconOnly\n variant='ghost'\n density='sm'\n icon='ph--caret-double-right--regular'\n label={t('select-thread.label')}\n classNames='text-description'\n onClick={handleSelect}\n />\n </div>\n <div className='flex items-center overflow-hidden'>\n <p\n role='heading'\n data-testid='thread.heading'\n className={mx(\n 'me-2 font-medium truncate italic',\n current ? 'text-accent-text' : 'text-description',\n detached && 'line-through decoration-1',\n )}\n >\n {title}\n </p>\n </div>\n {controls}\n </div>\n );\n },\n);\n\nThreadHeader.displayName = 'Thread.Header';\n\n//\n// Messages\n//\n\nconst MessageTileAdapter = ({\n id,\n data,\n location,\n draggable,\n current,\n selected,\n}: MosaicTileProps<MessageType.Message>) => (\n <Mosaic.Tile id={id} data={data} location={location} draggable={draggable} current={current} selected={selected}>\n <Message.Tile message={data} />\n </Mosaic.Tile>\n);\n\nexport type ThreadMessagesProps = ThemedClassName<{\n messages: readonly MessageType.Message[];\n /** Estimated tile height for the virtualizer. */\n estimateSize?: number;\n currentId?: string;\n}>;\n\n/** Virtualized stack of message tiles (via Mosaic), within an internal scroll area. */\nconst ThreadMessages = ({ messages, estimateSize = 80, currentId, classNames }: ThreadMessagesProps) => {\n const [viewport, setViewport] = useState<HTMLElement | null>(null);\n const items = useMemo(() => messages.filter(Boolean), [messages]);\n\n return (\n <Mosaic.Container\n asChild\n orientation='vertical'\n autoScroll={viewport}\n currentId={currentId}\n eventHandler={{ id: 'thread', canDrop: () => false }}\n >\n <ScrollArea.Root classNames={mx('col-span-2', classNames)} orientation='vertical'>\n <ScrollArea.Viewport ref={setViewport}>\n <Mosaic.VirtualStack\n items={items}\n getId={getMessageId}\n Tile={MessageTileAdapter}\n draggable={false}\n getScrollElement={() => viewport}\n estimateSize={() => estimateSize}\n />\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n </Mosaic.Container>\n );\n};\n\nThreadMessages.displayName = 'Thread.Messages';\n\n//\n// Textbox\n//\n\nexport type ThreadTextboxProps = MessageMetadata & {\n placeholder?: string;\n autoFocus?: boolean;\n disabled?: boolean;\n extensions?: Extension;\n /**\n * Called with the composer content on send. Return `true` to accept (the\n * editor is cleared and remounted), `false` to reject.\n */\n onSend?: (text: string) => boolean;\n};\n\n/** Message composer pinned at the foot of a thread. */\nconst ThreadTextbox = ({ placeholder, autoFocus, disabled, extensions, onSend, ...metadata }: ThreadTextboxProps) => {\n const { t } = useTranslation(translationKey);\n const { themeMode } = useThemeContext();\n const { registerComposerFocus } = useThreadContext('Thread.Textbox');\n const composerRef = useRef<{ focus: () => void } | null>(null);\n const messageRef = useRef('');\n const [count, setCount] = useState(0);\n\n // Expose the composer's focus to Thread.Root so the header caret can focus it.\n useEffect(() => {\n registerComposerFocus(() => composerRef.current?.focus());\n return () => registerComposerFocus(undefined);\n }, [registerComposerFocus]);\n\n const editorExtensions = useMemo(\n () =>\n [\n createBasicExtensions({ placeholder: placeholder ?? t('message.placeholder') }),\n createThemeExtensions({ themeMode }),\n listener({ onChange: ({ text }) => (messageRef.current = text) }),\n command,\n extensions,\n ].filter(Boolean) as Extension[],\n [themeMode, placeholder, t, extensions, count],\n );\n\n const handleSend = useCallback(() => {\n const text = messageRef.current;\n if (!text?.length || !onSend) {\n return;\n }\n if (onSend(text)) {\n messageRef.current = '';\n setCount((value) => value + 1);\n }\n }, []);\n\n return (\n <Message.Textbox\n ref={composerRef}\n {...metadata}\n autoFocus={autoFocus}\n disabled={disabled}\n extensions={editorExtensions}\n onSend={handleSend}\n />\n );\n};\n\nThreadTextbox.displayName = 'Thread.Textbox';\n\n//\n// Status\n//\n\nexport type ThreadStatusProps = ThemedClassName<PropsWithChildren> & {\n activity?: boolean;\n};\n\nconst ThreadStatus = forwardRef<HTMLDivElement, ThreadStatusProps>(\n ({ activity, classNames, children, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n return (\n <div\n {...props}\n className={mx(\n 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pe-2 text-xs text-description',\n classNames,\n )}\n ref={forwardedRef}\n >\n <Icon\n icon='ph--spinner--bold'\n classNames='w-6 h-4 invisible data-[visible=show]:visible animate-spin-slow'\n data-visible={activity ? 'show' : 'hide'}\n />\n <span className='truncate min-w-0' aria-live='polite'>\n {activity ? children : null}\n </span>\n <span className={mx('text-end', hoverableControlItem)}>{t('enter-to-send.message')}</span>\n </div>\n );\n },\n);\n\nThreadStatus.displayName = 'Thread.Status';\n\n//\n// Thread\n//\n\nexport const Thread = {\n Root: ThreadRoot,\n Content: ThreadContent,\n Header: ThreadHeader,\n Messages: ThreadMessages,\n Textbox: ThreadTextbox,\n Status: ThreadStatus,\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { HighlightStyle, StreamLanguage, syntaxHighlighting } from '@codemirror/language';\nimport { type Extension } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\n\nimport { tags } from '@dxos/ui-editor';\nimport { mx } from '@dxos/ui-theme';\n\n/**\n * Highlights leading slash-commands (e.g. `/resolve`) and `@mention` tags\n * (e.g. `@Kai`, anywhere) in the message composer.\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 // Leading slash-command (first token only).\n if (state.count === 1 && stream.match(/^\\/\\w+/)) {\n return 'tagName';\n }\n // @mention (anywhere).\n if (stream.match(/^@\\w+/)) {\n return 'labelName';\n }\n stream.next();\n return null;\n },\n});\n\nconst styles = HighlightStyle.define([\n {\n tag: tags.tagName,\n class: mx('dx-tag dx-tag--indigo'),\n },\n {\n tag: tags.labelName,\n class: mx('dx-tag dx-tag--blue'),\n },\n]);\n\n// Center the inline `.dx-tag` pills on the text line. `.dx-tag` is `inline-block`\n// with vertical padding, so on a CodeMirror line it baseline-aligns and rides\n// high; overriding `vertical-align` recentres it (cf. the `cm-reference-pill`\n// precedent in `@dxos/react-ui-chat`).\nconst theme = EditorView.theme({\n '.dx-tag': {\n verticalAlign: 'bottom',\n },\n});\n\nexport const command: Extension = [parser, syntaxHighlighting(styles), theme];\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\n\nimport { type ThreadContextValue } from './types';\n\n/**\n * Context provided by `Thread.Root` and consumed by its parts. Extends the\n * consumer-facing {@link ThreadContextValue} with internal coordination (e.g.\n * focusing the composer from the header's select affordance).\n */\nexport type ThreadContext = ThreadContextValue & {\n /** Register the composer's focus handler (set by `Thread.Textbox`). */\n registerComposerFocus: (focus: (() => void) | undefined) => void;\n /** Focus the thread composer (used by `Thread.Header`'s select affordance). */\n focusComposer: () => void;\n};\n\nexport const [ThreadContextProvider, useThreadContext] = createContext<ThreadContext>('Thread');\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { EditorView } from '@codemirror/view';\nimport { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\nimport React, {\n type ComponentPropsWithRef,\n type ComponentPropsWithoutRef,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { Obj, Ref } from '@dxos/echo';\nimport {\n Avatar,\n IconButton,\n type ThemedClassName,\n useOnTransition,\n useThemeContext,\n useTranslation,\n} from '@dxos/react-ui';\nimport { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';\nimport { type ContentBlock, type Message as MessageType } from '@dxos/types';\nimport { createBasicExtensions, createThemeExtensions, keymap, listener } from '@dxos/ui-editor';\nimport { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';\nimport { hexToEmoji, hexToHue, isTruthy } from '@dxos/util';\n\nimport { command } from '../command';\nimport { useThreadContext } from '../context';\nimport { translationKey } from '../translations';\nimport { type MessageMetadata } from '../types';\n\nconst avatarSize = 7;\n\nconst buttonGroupClassNames = 'flex flex-row items-center gap-0.5 pe-2';\nconst buttonClassNames = 'p-1! transition-opacity';\n\n//\n// Root\n//\n\nexport type MessageRootProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & MessageMetadata & Partial<{ continues: boolean; controls: ReactNode }>\n>;\n\n// TODO(burdon): Show authorName on tooltip.\nconst MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(\n (\n {\n authorImgSrc,\n authorId,\n authorName,\n authorAvatarProps,\n continues = true,\n controls,\n children,\n classNames,\n ...rootProps\n },\n forwardedRef,\n ) => {\n // Must wrap the message since Avatar.Label may be used in the content.\n // Columns mirror Thread.Header (avatar/rail · content · controls) so trailing\n // controls align with the thread header's controls.\n return (\n <Avatar.Root>\n <div\n data-testid='thread.message'\n {...rootProps}\n className={mx('grid grid-cols-[var(--dx-rail-size)_1fr_min-content] w-full', classNames)}\n ref={forwardedRef}\n >\n <div className='flex flex-col items-center gap-2 pt-1'>\n <Avatar.Content\n size={avatarSize}\n hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}\n fallback={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')}\n {...(authorImgSrc && { imgSrc: authorImgSrc })}\n />\n {continues && <div className='w-px grow bg-separator' />}\n </div>\n <div className='py-1 min-w-0'>{children}</div>\n {controls && <div className='self-start'>{controls}</div>}\n </div>\n </Avatar.Root>\n );\n },\n);\n\nMessageRoot.displayName = 'Message.Root';\n\n//\n// Heading\n//\n\nexport type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> &\n Pick<MessageMetadata, 'authorName' | 'timestamp'>;\n\nconst MessageHeading = ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => {\n return (\n <div {...props} className={mx('flex gap-2 items-start', classNames)}>\n <p className='grow'>\n <MessageAuthorName authorName={authorName} />\n {timestamp && <MessageTime timestamp={timestamp} />}\n </p>\n {children}\n </div>\n );\n};\n\nMessageHeading.displayName = 'Message.Heading';\n\nexport type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;\n\nconst MessageAuthorName = ({ authorName }: MessageAuthorNameProps) => {\n const { t } = useTranslation(translationKey);\n return (\n <Avatar.Label classNames='block truncate text-sm text-subdued'>{authorName ?? t('anonymous.label')}</Avatar.Label>\n );\n};\n\nMessageAuthorName.displayName = 'Message.AuthorName';\n\nexport type MessageTimeProps = Pick<MessageMetadata, 'timestamp'>;\n\nconst MessageTime = ({ timestamp }: MessageTimeProps) => {\n const { dtLocale } = useTranslation(translationKey);\n const dt = timestamp ? new Date(timestamp) : undefined;\n return (\n <time className='block text-subdued text-xs pb-0.5' dateTime={dt?.toISOString()}>\n {dt ? formatDistanceToNow(dt, { locale: dtLocale, addSuffix: true }) : ''}\n </time>\n );\n};\n\nMessageTime.displayName = 'Message.Time';\n\n//\n// Body\n//\n\nexport type MessageBodyProps = {\n /** The message whose content blocks are rendered. */\n message: MessageType.Message;\n /** When true, the local user authored this message. */\n isAuthor?: boolean;\n /** When true, the text block is editable. */\n editing?: boolean;\n /** Persist an edited text block. */\n onSave?: (text: string) => void;\n};\n\n/**\n * Renders a message's content blocks: text (via editor), proposal, and\n * object/reference tiles (delegated to the injected `Object` component).\n */\nconst MessageBody = ({ message, isAuthor, editing, onSave }: MessageBodyProps) => {\n const { components } = useThreadContext('Message.Body');\n const textBlockIndex = message.blocks.findIndex((block) => block._tag === 'text');\n const textBlock = textBlockIndex !== -1 ? (message.blocks[textBlockIndex] as ContentBlock.Text) : undefined;\n const proposalBlock = message.blocks.find((block) => block._tag === 'proposal') as ContentBlock.Proposal | undefined;\n const references = message.blocks\n .filter((block) => block._tag === 'reference')\n .map((block) => (block as ContentBlock.Reference).reference);\n const Object = components.Object;\n\n return (\n <>\n {textBlock && <TextBlock block={textBlock} isAuthor={isAuthor} editing={editing} onSave={onSave} />}\n {proposalBlock && <div className='me-4 italic'>{proposalBlock.text}</div>}\n {Object &&\n Ref.Array.targets(references).map((reference, index) => (\n <Object key={index} subject={reference as Obj.Unknown} />\n ))}\n </>\n );\n};\n\nMessageBody.displayName = 'Message.Body';\n\nconst TextBlock = ({\n block,\n isAuthor,\n editing,\n onSave,\n}: {\n block: ContentBlock.Text;\n isAuthor?: boolean;\n editing?: boolean;\n onSave?: (text: string) => void;\n}) => {\n const { themeMode } = useThemeContext();\n const inMemoryContentRef = useRef(block.text);\n\n const handleDocumentChange = useCallback((next: string) => {\n inMemoryContentRef.current = next;\n }, []);\n\n const saveDocumentChange = useCallback(() => {\n onSave?.(inMemoryContentRef.current);\n }, [onSave]);\n\n useOnTransition(editing, true, false, saveDocumentChange);\n\n const { parentRef, focusAttributes, view } = useTextEditor(\n () => ({\n initialValue: block.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 [block.text, editing, isAuthor, themeMode, handleDocumentChange],\n );\n\n useEffect(() => {\n if (editing) {\n view?.focus();\n }\n }, [editing, view]);\n\n return <div ref={parentRef} className='me-4' {...focusAttributes} />;\n};\n\n//\n// Textbox\n//\n\nexport type MessageTextboxProps = {\n disabled?: boolean;\n onSend?: () => void;\n onClear?: () => void;\n onEditorFocus?: () => void;\n} & MessageMetadata &\n UseTextEditorProps;\n\nconst keyBindings = ({ onSend, onClear }: Pick<MessageTextboxProps, 'onSend' | 'onClear'>) => [\n {\n key: 'Enter',\n run: () => {\n if (onSend) {\n onSend();\n return true;\n }\n return false;\n },\n },\n {\n key: 'Meta+Backspace',\n run: () => {\n if (onClear) {\n onClear();\n return true;\n }\n return false;\n },\n },\n];\n\nexport type MessageTextboxHandle = { focus: () => void };\n\nconst MessageTextbox = forwardRef<MessageTextboxHandle, MessageTextboxProps>(\n (\n {\n id,\n authorId,\n authorName,\n authorImgSrc,\n authorAvatarProps,\n disabled,\n extensions,\n onSend,\n onClear,\n onEditorFocus,\n ...editorProps\n },\n forwardedRef,\n ) => {\n const { parentRef, focusAttributes, view } = useTextEditor(\n () => ({\n id,\n extensions: [\n keymap.of(keyBindings({ onSend, onClear })),\n listener({\n onFocus: ({ focusing }) => {\n if (focusing) {\n onEditorFocus?.();\n }\n },\n }),\n extensions,\n ].filter(isTruthy),\n ...editorProps,\n }),\n [id, extensions],\n );\n\n useImperativeHandle(forwardedRef, () => ({ focus: () => view?.focus() }), [view]);\n\n return (\n <MessageRoot {...{ id, authorId, authorName, authorImgSrc, authorAvatarProps }} continues={false}>\n <div\n ref={parentRef}\n className={mx('py-0.5 me-1 rounded-xs dx-focus-ring', disabled && 'opacity-50')}\n {...focusAttributes}\n />\n </MessageRoot>\n );\n },\n);\n\nMessageTextbox.displayName = 'Message.Textbox';\n\n//\n// Tile\n//\n\nexport type MessageTileProps = {\n message: MessageType.Message;\n classNames?: MessageRootProps['classNames'];\n};\n\n/**\n * Full message tile (frame + heading + controls + body). Reads `Thread.Root`\n * context for metadata resolution, injected renderers, and callbacks. This is\n * the unit rendered by `Thread.Messages`.\n */\nconst MessageTile = ({ message, classNames }: MessageTileProps) => {\n const { t } = useTranslation(translationKey);\n const { getMetadata, identityDid, editable, onMessageDelete, onAcceptProposal } = useThreadContext('Message.Tile');\n const [editing, setEditing] = useState(false);\n\n const metadata = getMetadata(message);\n const isAuthor = !!identityDid && identityDid === metadata.authorId;\n const hasProposal = message.blocks.some((block) => block._tag === 'proposal');\n\n const handleEdit = useCallback(() => setEditing((value) => !value), []);\n const handleDelete = useCallback(() => onMessageDelete?.(message.id), [onMessageDelete, message.id]);\n const handleAcceptProposal = useCallback(() => onAcceptProposal?.(message.id), [onAcceptProposal, message.id]);\n const handleSave = useCallback(\n (text: string) => {\n Obj.update(message, (message) => {\n const block = message.blocks.find((block) => block._tag === 'text');\n if (block && block._tag === 'text') {\n block.text = text;\n }\n });\n },\n [message],\n );\n\n const showEdit = isAuthor && editable;\n const showAccept = hasProposal && !!onAcceptProposal;\n const showDelete = !!onMessageDelete;\n const controls =\n showEdit || showAccept || showDelete ? (\n <div className={buttonGroupClassNames}>\n {showEdit && (\n <IconButton\n data-testid={editing ? 'thread.message.save' : 'thread.message.edit'}\n variant='ghost'\n icon={editing ? 'ph--check--regular' : 'ph--pencil-simple--regular'}\n iconOnly\n label={t(editing ? 'save-message.label' : 'edit-message.label')}\n classNames={[buttonClassNames, hoverableControlItem]}\n onClick={handleEdit}\n />\n )}\n {showAccept && (\n <IconButton\n data-testid='thread.message.accept'\n variant='ghost'\n icon='ph--check--regular'\n iconOnly\n label={t('accept-proposal.label')}\n classNames={[buttonClassNames, hoverableControlItem]}\n onClick={handleAcceptProposal}\n />\n )}\n {showDelete && (\n <IconButton\n data-testid='thread.message.delete'\n variant='ghost'\n icon='ph--x--regular'\n iconOnly\n label={t('delete-message.label')}\n classNames={[buttonClassNames, hoverableControlItem]}\n onClick={handleDelete}\n />\n )}\n </div>\n ) : undefined;\n\n return (\n <MessageRoot\n {...metadata}\n controls={controls}\n classNames={[hoverableControls, hoverableFocusedWithinControls, classNames]}\n >\n <MessageHeading authorName={metadata.authorName} timestamp={metadata.timestamp} />\n <MessageBody message={message} isAuthor={isAuthor} editing={editing} onSave={handleSave} />\n </MessageRoot>\n );\n};\n\nMessageTile.displayName = 'Message.Tile';\n\n//\n// Message\n//\n\nexport const Message = {\n Root: MessageRoot,\n Heading: MessageHeading,\n AuthorName: MessageAuthorName,\n Time: MessageTime,\n Body: MessageBody,\n Textbox: MessageTextbox,\n Tile: MessageTile,\n};\n"],
|
|
5
|
+
"mappings": ";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gG,MAAAA;IACC9D,MAAK;IACLrB,YAAW;IACXoF,gBAAcF,WAAW,SAAS;MAEpC,gBAAA/F,OAAA,cAACkG,QAAAA;IAAKrE,WAAU;IAAmBsE,aAAU;KAC1CJ,WAAW9G,WAAW,IAAA,GAEzB,gBAAAe,OAAA,cAACkG,QAAAA;IAAKrE,WAAWS,IAAG,YAAY8D,qBAAAA;KAAwB7E,EAAE,uBAAA,CAAA,CAAA;AAGhE,CAAA;AAGFsE,aAAazF,cAAc;AAMpB,IAAMiG,SAAS;EACpBlG,MAAMnB;EACNsH,SAASjG;EACTkG,QAAQrF;EACRsF,UAAU1D;EACV8C,SAASxB;EACTqC,QAAQZ;AACV;",
|
|
6
|
+
"names": ["React", "forwardRef", "useCallback", "useEffect", "useMemo", "useRef", "useState", "Obj", "Icon", "IconButton", "ScrollArea", "composable", "composableProps", "useThemeContext", "useTranslation", "Mosaic", "createBasicExtensions", "createThemeExtensions", "listener", "hoverableControlItem", "hoverableControls", "hoverableFocusedWithinControls", "mx", "HighlightStyle", "StreamLanguage", "syntaxHighlighting", "EditorView", "tags", "mx", "parser", "define", "startState", "count", "token", "stream", "state", "eatSpace", "match", "next", "styles", "tag", "tagName", "class", "labelName", "theme", "verticalAlign", "command", "createContext", "ThreadContextProvider", "useThreadContext", "EditorView", "formatDistanceToNow", "React", "forwardRef", "useCallback", "useEffect", "useImperativeHandle", "useRef", "useState", "Obj", "Ref", "Avatar", "IconButton", "useOnTransition", "useThemeContext", "useTranslation", "useTextEditor", "createBasicExtensions", "createThemeExtensions", "keymap", "listener", "hoverableControlItem", "hoverableControls", "hoverableFocusedWithinControls", "mx", "hexToEmoji", "hexToHue", "isTruthy", "avatarSize", "buttonGroupClassNames", "buttonClassNames", "MessageRoot", "forwardRef", "authorImgSrc", "authorId", "authorName", "authorAvatarProps", "continues", "controls", "children", "classNames", "rootProps", "forwardedRef", "Avatar", "Root", "div", "data-testid", "className", "mx", "ref", "Content", "size", "hue", "hexToHue", "fallback", "emoji", "hexToEmoji", "imgSrc", "displayName", "MessageHeading", "timestamp", "props", "p", "MessageAuthorName", "MessageTime", "t", "useTranslation", "translationKey", "Label", "dtLocale", "dt", "Date", "undefined", "time", "dateTime", "toISOString", "formatDistanceToNow", "locale", "addSuffix", "MessageBody", "message", "isAuthor", "editing", "onSave", "components", "useThreadContext", "textBlockIndex", "blocks", "findIndex", "block", "_tag", "textBlock", "proposalBlock", "find", "references", "filter", "map", "reference", "Object", "TextBlock", "text", "Ref", "Array", "targets", "index", "key", "subject", "themeMode", "useThemeContext", "inMemoryContentRef", "useRef", "handleDocumentChange", "useCallback", "next", "current", "saveDocumentChange", "useOnTransition", "parentRef", "focusAttributes", "view", "useTextEditor", "initialValue", "extensions", "createBasicExtensions", "readOnly", "createThemeExtensions", "command", "EditorView", "updateListener", "of", "update", "docChanged", "state", "doc", "toString", "useEffect", "focus", "keyBindings", "onSend", "onClear", "run", "MessageTextbox", "id", "disabled", "onEditorFocus", "editorProps", "keymap", "listener", "onFocus", "focusing", "isTruthy", "useImperativeHandle", "MessageTile", "getMetadata", "identityDid", "editable", "onMessageDelete", "onAcceptProposal", "setEditing", "useState", "metadata", "hasProposal", "some", "handleEdit", "value", "handleDelete", "handleAcceptProposal", "handleSave", "Obj", "showEdit", "showAccept", "showDelete", "IconButton", "variant", "icon", "iconOnly", "label", "hoverableControlItem", "onClick", "hoverableControls", "hoverableFocusedWithinControls", "Message", "Heading", "AuthorName", "Time", "Body", "Textbox", "Tile", "getMessageId", "message", "Obj", "getURI", "ThreadRoot", "children", "getMetadata", "components", "identityDid", "editable", "onMessageDelete", "onAcceptProposal", "composerFocus", "useRef", "undefined", "registerComposerFocus", "useCallback", "focus", "current", "focusComposer", "React", "ThreadContextProvider", "Mosaic", "Root", "displayName", "ThreadContent", "composable", "id", "props", "forwardedRef", "div", "composableProps", "role", "classNames", "hoverableFocusedWithinControls", "data-testid", "aria-current", "ref", "ThreadHeader", "title", "detached", "controls", "onSelect", "t", "useTranslation", "translationKey", "useThreadContext", "handleSelect", "hoverableControls", "className", "IconButton", "iconOnly", "variant", "density", "icon", "label", "onClick", "p", "mx", "MessageTileAdapter", "data", "location", "draggable", "selected", "Tile", "Message", "ThreadMessages", "messages", "estimateSize", "currentId", "viewport", "setViewport", "useState", "items", "useMemo", "filter", "Boolean", "Container", "asChild", "orientation", "autoScroll", "eventHandler", "canDrop", "ScrollArea", "Viewport", "VirtualStack", "getId", "getScrollElement", "ThreadTextbox", "placeholder", "autoFocus", "disabled", "extensions", "onSend", "metadata", "themeMode", "useThemeContext", "composerRef", "messageRef", "count", "setCount", "useEffect", "editorExtensions", "createBasicExtensions", "createThemeExtensions", "listener", "onChange", "text", "command", "handleSend", "length", "value", "Textbox", "ThreadStatus", "forwardRef", "activity", "Icon", "data-visible", "span", "aria-live", "hoverableControlItem", "Thread", "Content", "Header", "Messages", "Status"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/translations.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/command.ts":{"bytes":5542,"imports":[{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/context.ts":{"bytes":1631,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true}],"format":"esm"},"src/translations.ts":{"bytes":3046,"imports":[],"format":"esm"},"src/Message/Message.tsx":{"bytes":40849,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/command.ts","kind":"import-statement","original":"../command"},{"path":"src/context.ts","kind":"import-statement","original":"../context"},{"path":"src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"src/Message/index.ts":{"bytes":685,"imports":[{"path":"src/Message/Message.tsx","kind":"import-statement","original":"./Message"}],"format":"esm"},"src/Thread/Thread.tsx":{"bytes":31930,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/command.ts","kind":"import-statement","original":"../command"},{"path":"src/context.ts","kind":"import-statement","original":"../context"},{"path":"src/Message/index.ts","kind":"import-statement","original":"../Message"},{"path":"src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"src/Thread/index.ts":{"bytes":643,"imports":[{"path":"src/Thread/Thread.tsx","kind":"import-statement","original":"./Thread"}],"format":"esm"},"src/index.ts":{"bytes":1539,"imports":[{"path":"src/Thread/index.ts","kind":"import-statement","original":"./Thread"},{"path":"src/Message/index.ts","kind":"import-statement","original":"./Message"},{"path":"src/command.ts","kind":"import-statement","original":"./command"},{"path":"src/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":42741},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-QFRRLZVL.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Message","Thread","command","useThreadContext"],"entryPoint":"src/index.ts","inputs":{"src/Thread/Thread.tsx":{"bytesInOutput":7266},"src/command.ts":{"bytesInOutput":922},"src/context.ts":{"bytesInOutput":130},"src/Message/Message.tsx":{"bytesInOutput":10086},"src/Message/index.ts":{"bytesInOutput":0},"src/Thread/index.ts":{"bytesInOutput":0},"src/index.ts":{"bytesInOutput":0}},"bytes":18677},"dist/lib/browser/translations.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/translations.mjs":{"imports":[{"path":"dist/lib/browser/chunk-QFRRLZVL.mjs","kind":"import-statement"}],"exports":["translationKey","translations"],"entryPoint":"src/translations.ts","inputs":{},"bytes":160},"dist/lib/browser/chunk-QFRRLZVL.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1440},"dist/lib/browser/chunk-QFRRLZVL.mjs":{"imports":[],"exports":["translationKey","translations"],"inputs":{"src/translations.ts":{"bytesInOutput":835}},"bytes":948}}}
|
|
@@ -1,24 +1,95 @@
|
|
|
1
|
-
import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
2
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
3
|
import { type UseTextEditorProps } from '@dxos/react-ui-editor';
|
|
4
|
+
import { type Message as MessageType } from '@dxos/types';
|
|
4
5
|
import { type MessageMetadata } from '../types';
|
|
5
|
-
export type MessageRootProps = ThemedClassName<ComponentPropsWithRef<'div'
|
|
6
|
+
export type MessageRootProps = ThemedClassName<ComponentPropsWithRef<'div'> & MessageMetadata & Partial<{
|
|
6
7
|
continues: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
controls: ReactNode;
|
|
9
|
+
}>>;
|
|
9
10
|
export type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & Pick<MessageMetadata, 'authorName' | 'timestamp'>;
|
|
10
|
-
|
|
11
|
+
declare function MessageHeading({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps): React.JSX.Element;
|
|
12
|
+
declare namespace MessageHeading {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
11
15
|
export type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;
|
|
12
|
-
|
|
16
|
+
declare function MessageAuthorName({ authorName }: MessageAuthorNameProps): React.JSX.Element;
|
|
17
|
+
declare namespace MessageAuthorName {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
13
20
|
export type MessageTimeProps = Pick<MessageMetadata, 'timestamp'>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
declare function MessageTime({ timestamp }: MessageTimeProps): React.JSX.Element;
|
|
22
|
+
declare namespace MessageTime {
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
25
|
+
export type MessageBodyProps = {
|
|
26
|
+
/** The message whose content blocks are rendered. */
|
|
27
|
+
message: MessageType.Message;
|
|
28
|
+
/** When true, the local user authored this message. */
|
|
29
|
+
isAuthor?: boolean;
|
|
30
|
+
/** When true, the text block is editable. */
|
|
31
|
+
editing?: boolean;
|
|
32
|
+
/** Persist an edited text block. */
|
|
33
|
+
onSave?: (text: string) => void;
|
|
34
|
+
};
|
|
35
|
+
declare function MessageBody({ message, isAuthor, editing, onSave }: MessageBodyProps): React.JSX.Element;
|
|
36
|
+
declare namespace MessageBody {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
17
39
|
export type MessageTextboxProps = {
|
|
18
40
|
disabled?: boolean;
|
|
19
41
|
onSend?: () => void;
|
|
20
42
|
onClear?: () => void;
|
|
21
43
|
onEditorFocus?: () => void;
|
|
22
44
|
} & MessageMetadata & UseTextEditorProps;
|
|
23
|
-
export
|
|
45
|
+
export type MessageTextboxHandle = {
|
|
46
|
+
focus: () => void;
|
|
47
|
+
};
|
|
48
|
+
export type MessageTileProps = {
|
|
49
|
+
message: MessageType.Message;
|
|
50
|
+
classNames?: MessageRootProps['classNames'];
|
|
51
|
+
};
|
|
52
|
+
declare function MessageTile({ message, classNames }: MessageTileProps): React.JSX.Element;
|
|
53
|
+
declare namespace MessageTile {
|
|
54
|
+
var displayName: string;
|
|
55
|
+
}
|
|
56
|
+
export declare const Message: {
|
|
57
|
+
Root: React.ForwardRefExoticComponent<Omit<MessageRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
Heading: {
|
|
59
|
+
({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps): React.JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
AuthorName: {
|
|
63
|
+
({ authorName }: MessageAuthorNameProps): React.JSX.Element;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
|
66
|
+
Time: {
|
|
67
|
+
({ timestamp }: MessageTimeProps): React.JSX.Element;
|
|
68
|
+
displayName: string;
|
|
69
|
+
};
|
|
70
|
+
Body: {
|
|
71
|
+
({ message, isAuthor, editing, onSave }: MessageBodyProps): React.JSX.Element;
|
|
72
|
+
displayName: string;
|
|
73
|
+
};
|
|
74
|
+
Textbox: React.ForwardRefExoticComponent<{
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
onSend?: () => void;
|
|
77
|
+
onClear?: () => void;
|
|
78
|
+
onEditorFocus?: () => void;
|
|
79
|
+
} & MessageMetadata & Pick<import("@codemirror/state").EditorStateConfig, "extensions"> & {
|
|
80
|
+
id?: string;
|
|
81
|
+
doc?: import("@codemirror/state").Text;
|
|
82
|
+
initialValue?: string;
|
|
83
|
+
autoFocus?: boolean;
|
|
84
|
+
scrollTo?: number;
|
|
85
|
+
selection?: import("@dxos/ui-editor").EditorSelection;
|
|
86
|
+
selectionEnd?: boolean;
|
|
87
|
+
debug?: boolean;
|
|
88
|
+
} & React.RefAttributes<MessageTextboxHandle>>;
|
|
89
|
+
Tile: {
|
|
90
|
+
({ message, classNames }: MessageTileProps): React.JSX.Element;
|
|
91
|
+
displayName: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export {};
|
|
24
95
|
//# sourceMappingURL=Message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EACZ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,KAAK,eAAe,EAIrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAqB,KAAK,OAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ7E,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAWhD,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAC5C,qBAAqB,CAAC,KAAK,CAAC,GAAG,eAAe,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,SAAS,CAA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C7B,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;CAC7C,CAAC;6BAOmB,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,gBAAgB;;;;AAoF9D,eAAO,MAAM,OAAO;IAClB,IAAI;IACJ,OAAO;oEAjU0E,mBAAmB;;;IAkUpG,UAAU;yBAlT+B,sBAAsB;;;IAmT/D,IAAI;wBAxS8B,gBAAgB;;;IAySlD,IAAI;iDA1QuD,gBAAgB;;;IA2Q3E,OAAO;mBA5LI,OAAO;iBACT,MAAM,IAAI;kBACT,MAAM,IAAI;wBACJ,MAAM,IAAI;;;;;;;;;;;IA0L1B,IAAI;kCA3FwC,gBAAgB;;;CA4F7D,CAAC"}
|
|
@@ -1,29 +1,39 @@
|
|
|
1
|
-
import '@
|
|
1
|
+
import { type StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
type StoryProps = {
|
|
4
|
+
editable: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const meta: {
|
|
4
7
|
title: string;
|
|
5
|
-
|
|
6
|
-
render: () => React.JSX.Element;
|
|
8
|
+
render: ({ editable }: StoryProps) => React.JSX.Element;
|
|
7
9
|
decorators: import("@storybook/react").Decorator[];
|
|
8
10
|
parameters: {
|
|
11
|
+
layout: string;
|
|
9
12
|
translations: [{
|
|
10
13
|
readonly 'en-US': {
|
|
11
|
-
readonly "react-ui-thread": {
|
|
12
|
-
readonly 'plugin
|
|
13
|
-
readonly 'thread
|
|
14
|
-
readonly 'thread
|
|
15
|
-
readonly 'delete
|
|
16
|
-
readonly '
|
|
17
|
-
readonly '
|
|
18
|
-
readonly '
|
|
19
|
-
readonly '
|
|
20
|
-
readonly '
|
|
21
|
-
readonly '
|
|
14
|
+
readonly "@dxos/react-ui-thread": {
|
|
15
|
+
readonly 'plugin.name': 'Threads';
|
|
16
|
+
readonly 'thread-title.placeholder': 'New thread';
|
|
17
|
+
readonly 'thread-title.label': 'Title';
|
|
18
|
+
readonly 'delete-thread.label': 'Delete';
|
|
19
|
+
readonly 'select-thread.label': 'Select comment';
|
|
20
|
+
readonly 'create-thread.label': 'Create thread';
|
|
21
|
+
readonly 'message.placeholder': 'Enter message...';
|
|
22
|
+
readonly 'comment.placeholder': 'Enter comment...';
|
|
23
|
+
readonly 'settings-standalone.label': 'Enable standalone thread creation';
|
|
24
|
+
readonly 'anonymous.label': 'Anonymous';
|
|
25
|
+
readonly 'enter-to-send.message': 'Enter to add \u23CE';
|
|
26
|
+
readonly 'edit-message.label': 'Edit';
|
|
27
|
+
readonly 'save-message.label': 'Save';
|
|
28
|
+
readonly 'delete-message.label': 'Delete';
|
|
29
|
+
readonly 'accept-proposal.label': 'Accept proposal';
|
|
22
30
|
};
|
|
23
31
|
};
|
|
24
32
|
}];
|
|
25
33
|
};
|
|
26
34
|
};
|
|
27
|
-
export default
|
|
28
|
-
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
export declare const Editable: Story;
|
|
38
|
+
export declare const NonEditable: Story;
|
|
29
39
|
//# sourceMappingURL=Message.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.stories.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"Message.stories.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAkB,MAAM,OAAO,CAAC;AAUvC,KAAK,UAAU,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAkBxC,QAAA,MAAM,IAAI;;2BAd0B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBT,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAItB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Message } from './Message';
|
|
2
|
+
export type { MessageRootProps, MessageHeadingProps, MessageAuthorNameProps, MessageTimeProps, MessageBodyProps, MessageTextboxProps, MessageTileProps, } from './Message';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Message/index.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Message/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC"}
|
|
@@ -1,20 +1,83 @@
|
|
|
1
|
-
import React, { type ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
|
|
1
|
+
import React, { type ComponentPropsWithRef, type ReactNode, type PropsWithChildren } from 'react';
|
|
2
|
+
import { type ComposableProps, type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
+
import { type Message as MessageType } from '@dxos/types';
|
|
4
|
+
import { type Extension } from '@dxos/ui-editor';
|
|
5
|
+
import { type MessageMetadata, type ThreadContextValue } from '../types';
|
|
6
|
+
export type ThreadRootProps = PropsWithChildren<Omit<ThreadContextValue, 'components'> & Partial<Pick<ThreadContextValue, 'components'>>>;
|
|
7
|
+
declare function ThreadRoot({ children, getMetadata, components, identityDid, editable, onMessageDelete, onAcceptProposal }: ThreadRootProps): React.JSX.Element;
|
|
8
|
+
declare namespace ThreadRoot {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
type ThreadContentExtra = {
|
|
12
|
+
id?: string;
|
|
13
|
+
current?: boolean | string;
|
|
14
|
+
} & Pick<ComponentPropsWithRef<'div'>, 'onClickCapture' | 'onFocusCapture'>;
|
|
15
|
+
export type ThreadContentProps = ComposableProps<ThreadContentExtra>;
|
|
16
|
+
export type ThreadHeaderProps = Omit<ComposableProps<{
|
|
17
|
+
/** Snippet text rendered inside a `<p>` (a string, not a DOM element). */
|
|
18
|
+
title?: string;
|
|
9
19
|
detached?: boolean;
|
|
20
|
+
/** Whether this is the current/selected thread; accents the title. */
|
|
21
|
+
current?: boolean;
|
|
22
|
+
/** Trailing controls rendered in the right column (aligns with message-tile controls). */
|
|
23
|
+
controls?: ReactNode;
|
|
24
|
+
/** Invoked when the caret affordance is activated to select/focus this thread. */
|
|
25
|
+
onSelect?: () => void;
|
|
26
|
+
}>, 'children'>;
|
|
27
|
+
export type ThreadMessagesProps = ThemedClassName<{
|
|
28
|
+
messages: readonly MessageType.Message[];
|
|
29
|
+
/** Estimated tile height for the virtualizer. */
|
|
30
|
+
estimateSize?: number;
|
|
31
|
+
currentId?: string;
|
|
32
|
+
}>;
|
|
33
|
+
declare function ThreadMessages({ messages, estimateSize, currentId, classNames }: ThreadMessagesProps): React.JSX.Element;
|
|
34
|
+
declare namespace ThreadMessages {
|
|
35
|
+
var displayName: string;
|
|
36
|
+
}
|
|
37
|
+
export type ThreadTextboxProps = MessageMetadata & {
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
autoFocus?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
extensions?: Extension;
|
|
42
|
+
/**
|
|
43
|
+
* Called with the composer content on send. Return `true` to accept (the
|
|
44
|
+
* editor is cleared and remounted), `false` to reject.
|
|
45
|
+
*/
|
|
46
|
+
onSend?: (text: string) => boolean;
|
|
10
47
|
};
|
|
11
|
-
|
|
48
|
+
declare function ThreadTextbox({ placeholder, autoFocus, disabled, extensions, onSend, ...metadata }: ThreadTextboxProps): React.JSX.Element;
|
|
49
|
+
declare namespace ThreadTextbox {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
export type ThreadStatusProps = ThemedClassName<PropsWithChildren> & {
|
|
12
53
|
activity?: boolean;
|
|
13
54
|
};
|
|
14
55
|
export declare const Thread: {
|
|
15
|
-
Root:
|
|
16
|
-
|
|
17
|
-
|
|
56
|
+
Root: {
|
|
57
|
+
({ children, getMetadata, components, identityDid, editable, onMessageDelete, onAcceptProposal, }: ThreadRootProps): React.JSX.Element;
|
|
58
|
+
displayName: string;
|
|
59
|
+
};
|
|
60
|
+
Content: React.ForwardRefExoticComponent<Omit<ThreadContentExtra, "className"> & {
|
|
61
|
+
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
62
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
63
|
+
Header: React.ForwardRefExoticComponent<Omit<ThreadHeaderProps, "className"> & {
|
|
64
|
+
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
65
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
Messages: {
|
|
67
|
+
({ messages, estimateSize, currentId, classNames }: ThreadMessagesProps): React.JSX.Element;
|
|
68
|
+
displayName: string;
|
|
69
|
+
};
|
|
70
|
+
Textbox: {
|
|
71
|
+
({ placeholder, autoFocus, disabled, extensions, onSend, ...metadata }: ThreadTextboxProps): React.JSX.Element;
|
|
72
|
+
displayName: string;
|
|
73
|
+
};
|
|
74
|
+
Status: React.ForwardRefExoticComponent<Omit<{
|
|
75
|
+
children?: ReactNode | undefined;
|
|
76
|
+
}, "className"> & {
|
|
77
|
+
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
78
|
+
} & {
|
|
79
|
+
activity?: boolean;
|
|
80
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
18
81
|
};
|
|
19
|
-
export
|
|
82
|
+
export {};
|
|
20
83
|
//# sourceMappingURL=Thread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thread.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Thread.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EAEd,KAAK,iBAAiB,EAMvB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,KAAK,eAAe,EAIpB,KAAK,eAAe,EAKrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,OAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,KAAK,SAAS,EAA0D,MAAM,iBAAiB,CAAC;AAOzG,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAQzE,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAC7C,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACzF,CAAC;4BAQkB,EAClB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,eAAe,EACf,gBAAgB,EACjB,EAAE,eAAe;;;;AAgClB,KAAK,kBAAkB,GAAG;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B,GAAG,IAAI,CAAC,qB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AAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkCF,eAAO,MAAM,MAAM;IACjB,IAAI;2GAhTH,eAAe;;;IAiThB,OAAO;;;IACP,MAAM;;;IACN,QAAQ;4DA9IsE,mBAAmB;;;IA+IjG,OAAO;gFAhGqF,kBAAkB;;;IAiG9G,MAAM;;;;;mBAzCK,OAAO;;CA0CnB,CAAC"}
|
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
import '@
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
render: () => React.JSX.Element;
|
|
6
|
+
decorators: import("@storybook/react").Decorator[];
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
translations: [{
|
|
10
|
+
readonly 'en-US': {
|
|
11
|
+
readonly "@dxos/react-ui-thread": {
|
|
12
|
+
readonly 'plugin.name': 'Threads';
|
|
13
|
+
readonly 'thread-title.placeholder': 'New thread';
|
|
14
|
+
readonly 'thread-title.label': 'Title';
|
|
15
|
+
readonly 'delete-thread.label': 'Delete';
|
|
16
|
+
readonly 'select-thread.label': 'Select comment';
|
|
17
|
+
readonly 'create-thread.label': 'Create thread';
|
|
18
|
+
readonly 'message.placeholder': 'Enter message...';
|
|
19
|
+
readonly 'comment.placeholder': 'Enter comment...';
|
|
20
|
+
readonly 'settings-standalone.label': 'Enable standalone thread creation';
|
|
21
|
+
readonly 'anonymous.label': 'Anonymous';
|
|
22
|
+
readonly 'enter-to-send.message': 'Enter to add \u23CE';
|
|
23
|
+
readonly 'edit-message.label': 'Edit';
|
|
24
|
+
readonly 'save-message.label': 'Save';
|
|
25
|
+
readonly 'delete-message.label': 'Delete';
|
|
26
|
+
readonly 'accept-proposal.label': 'Accept proposal';
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
5
32
|
export default meta;
|
|
6
|
-
|
|
33
|
+
type Story = StoryObj<typeof meta>;
|
|
34
|
+
export declare const Default: Story;
|
|
7
35
|
//# sourceMappingURL=Thread.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thread.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"Thread.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AA+BxC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ2B,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Thread/index.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Thread/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAoDnD,eAAO,MAAM,OAAO,EAAE,SAAuD,CAAC"}
|