@dxos/react-ui-chat 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef

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 (51) hide show
  1. package/dist/lib/browser/index.mjs +232 -250
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/translations.mjs +14 -0
  5. package/dist/lib/browser/translations.mjs.map +7 -0
  6. package/dist/lib/node-esm/index.mjs +232 -250
  7. package/dist/lib/node-esm/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/meta.json +1 -1
  9. package/dist/lib/node-esm/translations.mjs +16 -0
  10. package/dist/lib/node-esm/translations.mjs.map +7 -0
  11. package/dist/types/src/components/ChatDialog/ChatDialog.d.ts +17 -1
  12. package/dist/types/src/components/ChatDialog/ChatDialog.d.ts.map +1 -1
  13. package/dist/types/src/components/ChatDialog/ChatDialog.stories.d.ts +2 -3
  14. package/dist/types/src/components/ChatDialog/ChatDialog.stories.d.ts.map +1 -1
  15. package/dist/types/src/components/ChatEditor/ChatEditor.d.ts +7 -8
  16. package/dist/types/src/components/ChatEditor/ChatEditor.d.ts.map +1 -1
  17. package/dist/types/src/components/ChatEditor/ChatEditor.stories.d.ts +3 -3
  18. package/dist/types/src/components/ChatEditor/ChatEditor.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/ChatEditor/references.d.ts +4 -0
  20. package/dist/types/src/components/ChatEditor/references.d.ts.map +1 -1
  21. package/dist/types/src/components/ChatStatus/ChatStatus.d.ts +40 -0
  22. package/dist/types/src/components/ChatStatus/ChatStatus.d.ts.map +1 -0
  23. package/dist/types/src/components/ChatStatus/ChatStatus.stories.d.ts +27 -0
  24. package/dist/types/src/components/ChatStatus/ChatStatus.stories.d.ts.map +1 -0
  25. package/dist/types/src/components/ChatStatus/format.d.ts +7 -0
  26. package/dist/types/src/components/ChatStatus/format.d.ts.map +1 -0
  27. package/dist/types/src/components/ChatStatus/format.test.d.ts +2 -0
  28. package/dist/types/src/components/ChatStatus/format.test.d.ts.map +1 -0
  29. package/dist/types/src/components/ChatStatus/index.d.ts +3 -0
  30. package/dist/types/src/components/ChatStatus/index.d.ts.map +1 -0
  31. package/dist/types/src/components/index.d.ts +1 -0
  32. package/dist/types/src/components/index.d.ts.map +1 -1
  33. package/dist/types/src/index.d.ts +0 -1
  34. package/dist/types/src/index.d.ts.map +1 -1
  35. package/dist/types/src/translations.d.ts +2 -2
  36. package/dist/types/src/translations.d.ts.map +1 -1
  37. package/dist/types/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +46 -38
  39. package/src/components/ChatDialog/ChatDialog.stories.tsx +4 -5
  40. package/src/components/ChatDialog/ChatDialog.tsx +27 -17
  41. package/src/components/ChatEditor/ChatEditor.stories.tsx +19 -17
  42. package/src/components/ChatEditor/ChatEditor.tsx +33 -85
  43. package/src/components/ChatEditor/references.ts +18 -12
  44. package/src/components/ChatStatus/ChatStatus.stories.tsx +130 -0
  45. package/src/components/ChatStatus/ChatStatus.tsx +183 -0
  46. package/src/components/ChatStatus/format.test.ts +48 -0
  47. package/src/components/ChatStatus/format.ts +27 -0
  48. package/src/components/ChatStatus/index.ts +6 -0
  49. package/src/components/index.ts +1 -0
  50. package/src/index.ts +0 -1
  51. package/src/translations.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/ChatDialog/ChatDialog.tsx", "../../../src/components/ChatEditor/references.ts", "../../../src/components/ChatEditor/ChatEditor.tsx", "../../../src/translations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { type Dispatch, type PropsWithChildren, type SetStateAction, useEffect, useState } from 'react';\n\nimport { Dialog, Icon, IconButton, type ThemedClassName, useControlledState } from '@dxos/react-ui';\nimport { ResizeHandle, type Size, resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst preventDefault = (event: Event) => event.preventDefault();\n\n// TODO(burdon): Factor out.\nconst Endcap = ({ children }: PropsWithChildren) => {\n return (\n <div className='grid w-[var(--rail-action)] h-[var(--rail-action)] items-center justify-center'>{children}</div>\n );\n};\n\n//\n// Context\n//\n\ntype ChatDialogContextValue = {\n open: boolean;\n setOpen: Dispatch<SetStateAction<boolean>>;\n expanded: boolean;\n setExpanded: Dispatch<SetStateAction<boolean>>;\n size: Size;\n setSize: Dispatch<SetStateAction<Size>>;\n};\n\nconst [ChatDialogContextProvider, useChatDialogContext] = createContext<ChatDialogContextValue>('ChatDialog');\n\n//\n// Root\n//\n\ntype ChatDialogRootProps = PropsWithChildren<{\n open?: boolean;\n expanded?: boolean;\n onOpenChange?: (open: boolean) => void;\n onExpandedChange?: (expanded: boolean) => void;\n onEscape?: () => void;\n}>;\n\nconst ChatDialogRoot = ({\n children,\n open: _open = false,\n expanded: expandedParam = false,\n onOpenChange,\n onExpandedChange,\n onEscape,\n}: ChatDialogRootProps) => {\n const [size, setSize] = useState<Size>('min-content');\n const [open, setOpen] = useControlledState<boolean>(_open, onOpenChange);\n const [expanded, setExpanded] = useControlledState<boolean>(expandedParam, onExpandedChange);\n\n // NOTE: We set the min size to 5rem (80px), and the header and prompt bar to 40px (i.e., the rail-size) each.\n // The dialog has no vertical padding and has box-content so that when closed it collapses to the size of the header and prompt bar.\n return (\n <ChatDialogContextProvider\n open={open}\n setOpen={setOpen}\n expanded={expanded}\n setExpanded={setExpanded}\n size={size}\n setSize={setSize}\n >\n <Dialog.Root modal={false} open={open} onOpenChange={setOpen}>\n <div role='none' className='dx-dialog__overlay bg-transparent pointer-events-none' data-block-align='end'>\n <Dialog.Content\n inOverlayLayout\n classNames={[\n 'grid grid-rows-[var(--rail-action)_1fr_min-content] p-0 overflow-hidden',\n 'box-content md:is-[35rem] md:max-is-none pointer-events-auto',\n ]}\n onEscapeKeyDown={onEscape}\n onInteractOutside={preventDefault}\n >\n {children}\n </Dialog.Content>\n </div>\n </Dialog.Root>\n </ChatDialogContextProvider>\n );\n};\n\nChatDialogRoot.displayName = 'ChatDialog.Root';\n\n//\n// Header\n//\n\ntype ChatDialogHeaderProps = ThemedClassName<{\n title?: string;\n}>;\n\nconst ChatDialogHeader = ({ classNames, title }: ChatDialogHeaderProps) => {\n const { expanded, setExpanded } = useChatDialogContext(ChatDialogHeader.displayName);\n\n return (\n <div className={mx('grid grid-cols-[var(--rail-action)_1fr_min-content] items-center overflow-hidden', classNames)}>\n <Endcap>\n <Dialog.Close>\n <Icon icon='ph--x--regular' />\n </Dialog.Close>\n </Endcap>\n <Dialog.Title\n classNames='flex w-full justify-center text-sm text-subdued select-none cursor-pointer'\n onClick={() => setExpanded((expanded) => !expanded)}\n >\n {title}\n </Dialog.Title>\n <Endcap>\n <IconButton\n variant='ghost'\n icon='ph--caret-up--regular'\n iconOnly\n classNames={mx('!p-1 [&>svg]:transition [&>svg]:duration-200', expanded && '[&>svg]:rotate-180')}\n label={expanded ? 'Close' : 'Open'}\n onClick={() => setExpanded((expanded) => !expanded)}\n />\n </Endcap>\n </div>\n );\n};\n\nChatDialogHeader.displayName = 'ChatDialog.Header';\n\n//\n// Content\n//\n\ntype ChatDialogContentProps = ThemedClassName<PropsWithChildren>;\n\nconst ChatDialogContent = ({ children, classNames }: ChatDialogContentProps) => {\n const { expanded, size, setSize } = useChatDialogContext(ChatDialogContent.displayName);\n useEffect(() => {\n setSize(expanded ? 'min-content' : 0);\n }, [expanded]);\n\n return (\n <div\n className={mx(\n 'flex flex-col overflow-y-auto border-t border-b border-subduedSeparator',\n 'transition-[block-size] ease-in-out duration-0 [&:not([data-dx-resizing=\"true\"])]:duration-200',\n classNames,\n )}\n style={{\n ...sizeStyle(size, 'vertical', true),\n maxBlockSize: 'calc(100dvh - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 14rem)',\n }}\n {...resizeAttributes}\n >\n <ResizeHandle\n side='block-start'\n iconPosition='center'\n defaultSize='min-content'\n fallbackSize={0}\n minSize={0}\n onSizeChange={setSize}\n />\n {children}\n </div>\n );\n};\n\nChatDialogContent.displayName = 'ChatDialog.Content';\n\n//\n// Footer\n//\n\ntype ChatDialogFooterProps = ThemedClassName<PropsWithChildren>;\n\nconst ChatDialogFooter = ({ children, classNames }: ChatDialogFooterProps) => {\n return <div className={mx(classNames)}>{children}</div>;\n};\n\nChatDialogFooter.displayName = 'ChatDialog.Footer';\n\n//\n// ChatDialog\n//\n\nexport const ChatDialog = {\n Root: ChatDialogRoot,\n Header: ChatDialogHeader,\n Content: ChatDialogContent,\n Footer: ChatDialogFooter,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type CompletionResult, autocompletion, completionKeymap } from '@codemirror/autocomplete';\nimport { type Extension, RangeSet } from '@codemirror/state';\nimport {\n Decoration,\n type DecorationSet,\n EditorView,\n ViewPlugin,\n type ViewUpdate,\n WidgetType,\n keymap,\n} from '@codemirror/view';\n\nimport { Mutex } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\n\n// TODO(dmaretskyi): Consider adding details renderer for when you hover over the reference.\nexport type ReferenceData = {\n uri: string;\n label: string;\n};\n\nexport interface ReferencesProvider {\n getReferences({ query }: { query: string }): Promise<ReferenceData[]>;\n resolveReference({ uri }: { uri: string }): Promise<ReferenceData | null>;\n}\n\nexport type ReferencesOptions = {\n provider: ReferencesProvider;\n\n /**\n * @default '@'\n */\n triggerCharacter?: string;\n\n /**\n * Prevent the autocomplete from closing when the user blurs the editor.\n * @default false\n */\n debug?: boolean;\n};\n\n/**\n * Lookup object references.\n */\nexport const references = ({ provider, triggerCharacter = '@', debug = false }: ReferencesOptions): Extension => {\n invariant(triggerCharacter.length === 1);\n\n const decorationField = ViewPlugin.fromClass(\n class ReferenceView {\n // TODO(burdon): Why?\n private _mutex = new Mutex();\n\n decorations: DecorationSet = Decoration.set([]);\n\n constructor(view: EditorView) {\n queueMicrotask(async () => {\n const guard = await this._mutex.acquire();\n try {\n this.decorations = await this._computeDecorations(view);\n } finally {\n guard.release();\n }\n });\n }\n\n update(update: ViewUpdate) {\n if (update.docChanged) {\n queueMicrotask(async () => {\n const guard = await this._mutex.acquire();\n try {\n this.decorations = await this._computeDecorations(update.view);\n } finally {\n guard.release();\n }\n });\n }\n }\n\n private async _computeDecorations(view: EditorView): Promise<DecorationSet> {\n const text = view.state.doc.toString();\n const references = text.matchAll(new RegExp(`${triggerCharacter}[a-zA-Z0-9@:]+\\\\s`, 'g'));\n\n const decorations = [];\n for (const match of references) {\n const reference = match[0];\n const uri = reference.slice(1, -1);\n const data = await provider.resolveReference({ uri });\n if (data) {\n decorations.push(\n Decoration.replace({\n widget: new ReferenceWidget(data),\n }).range(match.index!, match.index! + reference.length),\n );\n }\n }\n\n return Decoration.set(decorations);\n }\n },\n {\n decorations: (v) => v.decorations,\n provide: (plugin) => [\n EditorView.atomicRanges.of(\n (view): DecorationSet => view.plugin(decorationField)?.decorations ?? RangeSet.empty,\n ),\n ],\n },\n );\n\n return [\n decorationField,\n\n EditorView.theme({\n '.cm-reference-pill': {\n borderRadius: '0.25rem',\n borderWidth: '1px',\n marginRight: '0.25rem',\n marginLeft: '0.25rem',\n },\n }),\n\n autocompletion({\n tooltipClass: () => 'shadow rounded',\n activateOnTyping: true,\n aboveCursor: true,\n closeOnBlur: !debug,\n override: [\n async (context): Promise<CompletionResult | null> => {\n const match = context.matchBefore(new RegExp(`${triggerCharacter}[a-zA-Z0-9]+`));\n if (!match || match?.to === match?.from) {\n return null;\n }\n\n const query = match.text.slice(1);\n const references = await provider.getReferences({ query });\n return {\n from: match.from,\n filter: false,\n options: references.map((reference) => ({\n label: reference.label,\n apply: `${triggerCharacter}${reference.uri} `,\n })),\n };\n },\n ],\n }),\n\n keymap.of(completionKeymap),\n ];\n};\n\nclass ReferenceWidget extends WidgetType {\n constructor(private data: ReferenceData) {\n super();\n }\n\n override toDOM(): HTMLSpanElement {\n const span = document.createElement('span');\n span.textContent = `@ ${this.data.label}`;\n span.className = 'cm-reference-pill';\n return span;\n }\n\n override eq(other: ReferenceWidget): boolean {\n return other.data.uri === this.data.uri;\n }\n\n override ignoreEvent(): boolean {\n return true;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Extension } from '@codemirror/state';\nimport { keymap } from '@codemirror/view';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport React, { forwardRef, useImperativeHandle } from 'react';\n\nimport { type ThemedClassName, useThemeContext } from '@dxos/react-ui';\nimport {\n type AutocompleteOptions,\n type BasicExtensionsOptions,\n type UseTextEditorProps,\n autocomplete,\n createBasicExtensions,\n createThemeExtensions,\n useTextEditor,\n} from '@dxos/react-ui-editor';\nimport { mx } from '@dxos/react-ui-theme';\nimport { isTruthy } from '@dxos/util';\n\nimport { type ReferencesOptions, references as referencesExtension } from './references';\n\nexport interface ChatEditorController {\n focus(): void;\n getText(): string;\n setText(text: string): void;\n}\n\nexport type ChatEditorProps = ThemedClassName<\n {\n extensions?: Extension;\n references?: ReferencesOptions;\n } & AutocompleteOptions &\n Pick<UseTextEditorProps, 'id' | 'autoFocus'> &\n Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>\n>;\n\nexport const ChatEditor = forwardRef<ChatEditorController, ChatEditorProps>(\n (\n { classNames, extensions, references, autoFocus, lineWrapping = false, placeholder, onSubmit, onSuggest, onCancel },\n forwardRef,\n ) => {\n const { themeMode } = useThemeContext();\n const { findNextFocusable, findPrevFocusable } = useFocusFinders();\n const { parentRef, view } = useTextEditor(\n () => ({\n debug: true,\n autoFocus,\n extensions: [\n createThemeExtensions({ themeMode }),\n createBasicExtensions({ bracketMatching: false, lineWrapping, placeholder }),\n createBasicExtensions({\n bracketMatching: false,\n lineWrapping,\n placeholder,\n }),\n autocomplete({ onSubmit, onSuggest, onCancel }),\n references ? referencesExtension({ provider: references.provider }) : [],\n // TODO(burdon): Standardize.\n keymap.of([\n {\n key: 'Tab',\n preventDefault: true,\n run: (view) => {\n findNextFocusable(view.dom)?.focus();\n return true;\n },\n },\n {\n key: 'Shift-Tab',\n preventDefault: true,\n run: (view) => {\n findPrevFocusable(view.dom)?.focus();\n return true;\n },\n },\n ]),\n extensions,\n ].filter(isTruthy),\n }),\n [themeMode, extensions, onSubmit, onSuggest, onCancel],\n );\n\n // Expose editor view.\n useImperativeHandle(forwardRef, () => {\n return {\n focus: () => {\n view?.focus();\n },\n getText: () => view?.state.doc.toString() ?? '',\n setText: (text: string) => {\n view?.dispatch({\n changes: {\n from: 0,\n to: view.state.doc.length,\n insert: text,\n },\n selection: {\n anchor: text.length,\n head: text.length,\n },\n });\n },\n };\n }, [view, onSubmit]);\n\n return <div ref={parentRef} className={mx('is-full', classNames)} />;\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = 'react-ui-chat';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {},\n },\n },\n] as const satisfies Resource[];\n"],
5
- "mappings": ";;;;AAIA,SAASA,qBAAqB;AAC9B,OAAOC,SAAqEC,WAAWC,gBAAgB;AAEvG,SAASC,QAAQC,MAAMC,YAAkCC,0BAA0B;AACnF,SAASC,cAAyBC,kBAAkBC,iBAAiB;AACrE,SAASC,UAAU;AAEnB,IAAMC,iBAAiB,CAACC,UAAiBA,MAAMD,eAAc;AAG7D,IAAME,SAAS,CAAC,EAAEC,SAAQ,MAAqB;;;AAC7C,WACE,sBAAA,cAACC,OAAAA;MAAIC,WAAU;OAAkFF,QAAAA;;;;AAErG;AAeA,IAAM,CAACG,2BAA2BC,oBAAAA,IAAwBC,cAAsC,YAAA;AAchG,IAAMC,iBAAiB,CAAC,EACtBN,UACAO,MAAMC,QAAQ,OACdC,UAAUC,gBAAgB,OAC1BC,cACAC,kBACAC,SAAQ,MACY;;;AACpB,UAAM,CAACC,MAAMC,OAAAA,IAAWC,SAAe,aAAA;AACvC,UAAM,CAACT,MAAMU,OAAAA,IAAWC,mBAA4BV,OAAOG,YA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V;YACAO,WAAW;cACTC,QAAQR,KAAKK;cACbI,MAAMT,KAAKK;YACb;UACF,CAAA;QACF;MACF;IACF,GAAG;MAAC7B;MAAMT;KAAS;AAEnB,WAAO,gBAAA2C,OAAA,cAACC,OAAAA;MAAIC,KAAKrC;MAAWsC,WAAWC,IAAG,WAAWrD,UAAAA;;;;;AACvD,CAAA;;;ACvGK,IAAMsD,iBAAiB;AAEvB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,cAAAA,GAAiB,CAAC;IACrB;EACF;;",
6
- "names": ["createContext", "React", "useEffect", "useState", "Dialog", "Icon", "IconButton", "useControlledState", "ResizeHandle", "resizeAttributes", "sizeStyle", "mx", "preventDefault", "event", "Endcap", "children", "div", "className", "ChatDialogContextProvider", "useChatDialogContext", "createContext", "ChatDialogRoot", "open", "_open", "expanded", "expandedParam", "onOpenChange", "onExpandedChange", "onEscape", "size", "setSize", "useState", "setOpen", "useControlledState", "setExpanded", "Dialog", "Root", "modal", "role", "data-block-align", "Content", "inOverlayLayout", "classNames", "onEscapeKeyDown", "onInteractOutside", "displayName", "ChatDialogHeader", "title", "mx", "Close", "Icon", "icon", "Title", "onClick", "IconButton", "variant", "iconOnly", "label", "ChatDialogContent", "useEffect", "style", "sizeStyle", "maxBlockSize", "resizeAttributes", "ResizeHandle", "side", "iconPosition", "defaultSize", "fallbackSize", "minSize", "onSizeChange", "ChatDialogFooter", "ChatDialog", "Header", "Footer", "autocompletion", "completionKeymap", "RangeSet", "Decoration", "EditorView", "ViewPlugin", "WidgetType", "keymap", "Mutex", "invariant", "references", "provider", "triggerCharacter", "debug", "length", "decorationField", "fromClass", "ReferenceView", "update", "docChanged", "queueMicrotask", "guard", "_mutex", "acquire", "decorations", "_computeDecorations", "view", "release", "text", "state", "doc", "toString", "matchAll", "RegExp", "match", "reference", "uri", "slice", "data", "resolveReference", "push", "replace", "widget", "ReferenceWidget", "range", "index", "set", "v", "provide", "plugin", "atomicRanges", "of", "empty", "theme", "borderRadius", "borderWidth", "marginRight", "marginLeft", "tooltipClass", "activateOnTyping", "aboveCursor", "closeOnBlur", "override", "context", "matchBefore", "to", "from", "query", "getReferences", "filter", "options", "map", "label", "apply", "toDOM", "span", "document", "createElement", "textContent", "className", "eq", "other", "ignoreEvent", "keymap", "useFocusFinders", "React", "forwardRef", "useImperativeHandle", "useThemeContext", "autocomplete", "createBasicExtensions", "createThemeExtensions", "useTextEditor", "mx", "isTruthy", "ChatEditor", "forwardRef", "classNames", "extensions", "references", "autoFocus", "lineWrapping", "placeholder", "onSubmit", "onSuggest", "onCancel", "themeMode", "useThemeContext", "findNextFocusable", "findPrevFocusable", "useFocusFinders", "parentRef", "view", "useTextEditor", "debug", "createThemeExtensions", "createBasicExtensions", "bracketMatching", "autocomplete", "referencesExtension", "provider", "keymap", "of", "key", "preventDefault", "run", "dom", "focus", "filter", "isTruthy", "useImperativeHandle", "getText", "state", "doc", "toString", "setText", "text", "dispatch", "changes", "from", "to", "length", "insert", "selection", "anchor", "head", "React", "div", "ref", "className", "mx", "translationKey", "translations"]
3
+ "sources": ["../../../src/components/ChatDialog/ChatDialog.tsx", "../../../src/components/ChatEditor/references.ts", "../../../src/components/ChatEditor/ChatEditor.tsx", "../../../src/components/ChatStatus/ChatStatus.tsx", "../../../src/components/ChatStatus/format.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { type Dispatch, type PropsWithChildren, type SetStateAction, useEffect, useState } from 'react';\n\nimport { Dialog, Icon, IconButton, type ThemedClassName, useControlledState } from '@dxos/react-ui';\nimport { ResizeHandle, type Size, resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';\nimport { mx } from '@dxos/ui-theme';\n\nconst preventDefault = (event: Event) => event.preventDefault();\n\n// TODO(burdon): Factor out.\nconst Endcap = ({ children }: PropsWithChildren) => {\n return (\n <div className='grid w-[var(--dx-rail-action)] h-[var(--dx-rail-action)] items-center justify-center'>\n {children}\n </div>\n );\n};\n\n//\n// Context\n//\n\ntype ChatDialogContextValue = {\n open: boolean;\n setOpen: Dispatch<SetStateAction<boolean>>;\n expanded: boolean;\n setExpanded: Dispatch<SetStateAction<boolean>>;\n size: Size;\n setSize: Dispatch<SetStateAction<Size>>;\n};\n\nconst [ChatDialogContextProvider, useChatDialogContext] = createContext<ChatDialogContextValue>('ChatDialog');\n\n//\n// Root\n//\n\ntype ChatDialogRootProps = PropsWithChildren<{\n open?: boolean;\n expanded?: boolean;\n onOpenChange?: (open: boolean) => void;\n onExpandedChange?: (expanded: boolean) => void;\n onEscape?: () => void;\n}>;\n\nconst ChatDialogRoot = ({\n children,\n open: openProp = false,\n expanded: expandedProp = false,\n onOpenChange,\n onExpandedChange,\n onEscape,\n}: ChatDialogRootProps) => {\n const [size, setSize] = useState<Size>('min-content');\n const [open, setOpen] = useControlledState<boolean>(openProp, onOpenChange);\n const [expanded, setExpanded] = useControlledState<boolean>(expandedProp, onExpandedChange);\n\n // NOTE: We set the min size to 5rem (80px), and the header and prompt bar to 40px (i.e., the rail-size) each.\n // The dialog has no vertical padding and has box-content so that when closed it collapses to the size of the header and prompt bar.\n return (\n <ChatDialogContextProvider\n open={open}\n setOpen={setOpen}\n expanded={expanded}\n setExpanded={setExpanded}\n size={size}\n setSize={setSize}\n >\n <Dialog.Root modal={false} open={open} onOpenChange={setOpen}>\n <div role='none' className='dx-dialog__overlay bg-transparent pointer-events-none' data-block-align='end'>\n <Dialog.Content\n size='md'\n inOverlayLayout\n classNames={[\n 'grid grid-rows-[var(--dx-rail-action)_1fr_min-content] p-0 overflow-hidden box-content pointer-events-auto',\n ]}\n onEscapeKeyDown={onEscape}\n onInteractOutside={preventDefault}\n >\n {children}\n </Dialog.Content>\n </div>\n </Dialog.Root>\n </ChatDialogContextProvider>\n );\n};\n\nChatDialogRoot.displayName = 'ChatDialog.Root';\n\n//\n// Header\n//\n\nconst CHAT_DIALOG_HEADER_NAME = 'ChatDialog.Header';\n\ntype ChatDialogHeaderProps = ThemedClassName<{\n title?: string;\n}>;\n\nconst ChatDialogHeader = ({ classNames, title }: ChatDialogHeaderProps) => {\n const { expanded, setExpanded } = useChatDialogContext(CHAT_DIALOG_HEADER_NAME);\n\n return (\n <div\n className={mx('grid grid-cols-[var(--dx-rail-action)_1fr_min-content] items-center overflow-hidden', classNames)}\n >\n <Endcap>\n <Dialog.Close>\n <Icon icon='ph--x--regular' />\n </Dialog.Close>\n </Endcap>\n <Dialog.Title\n classNames='flex w-full justify-center text-sm text-subdued select-none cursor-pointer'\n onClick={() => setExpanded((expanded) => !expanded)}\n >\n {title}\n </Dialog.Title>\n <Endcap>\n <IconButton\n variant='ghost'\n icon='ph--caret-up--regular'\n iconOnly\n classNames={mx('p-1! [&>svg]:transition [&>svg]:duration-200', expanded && '[&>svg]:rotate-180')}\n label={expanded ? 'Close' : 'Open'}\n onClick={() => setExpanded((expanded) => !expanded)}\n />\n </Endcap>\n </div>\n );\n};\n\nChatDialogHeader.displayName = CHAT_DIALOG_HEADER_NAME;\n\n//\n// Content\n//\n\nconst CHAT_DIALOG_CONTENT_NAME = 'ChatDialog.Content';\n\ntype ChatDialogContentProps = ThemedClassName<PropsWithChildren>;\n\nconst ChatDialogContent = ({ children, classNames }: ChatDialogContentProps) => {\n const { expanded, size, setSize } = useChatDialogContext(CHAT_DIALOG_CONTENT_NAME);\n useEffect(() => {\n setSize(expanded ? 'min-content' : 0);\n }, [expanded]);\n\n return (\n <div\n className={mx(\n 'border-t border-b border-subdued-separator',\n 'transition ease-in-out duration-0 [&:not([data-dx-resizing=\"true\"])]:duration-200',\n classNames,\n )}\n style={{\n ...sizeStyle(size, 'vertical', true),\n maxBlockSize: 'calc(100dvh - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 14rem)',\n }}\n {...resizeAttributes}\n >\n <ResizeHandle\n side='block-start'\n iconPosition='center'\n defaultSize='min-content'\n fallbackSize={0}\n minSize={0}\n onSizeChange={setSize}\n />\n {children}\n </div>\n );\n};\n\nChatDialogContent.displayName = CHAT_DIALOG_CONTENT_NAME;\n\n//\n// Footer\n//\n\nconst CHAT_DIALOG_FOOTER_NAME = 'ChatDialog.Footer';\n\ntype ChatDialogFooterProps = ThemedClassName<PropsWithChildren>;\n\nconst ChatDialogFooter = ({ children, classNames }: ChatDialogFooterProps) => {\n return <div className={mx(classNames)}>{children}</div>;\n};\n\nChatDialogFooter.displayName = CHAT_DIALOG_FOOTER_NAME;\n\n//\n// ChatDialog\n//\n\nexport const ChatDialog = {\n Root: ChatDialogRoot,\n Header: ChatDialogHeader,\n Content: ChatDialogContent,\n Footer: ChatDialogFooter,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type CompletionResult, autocompletion, completionKeymap } from '@codemirror/autocomplete';\nimport { type Extension, RangeSet } from '@codemirror/state';\nimport {\n Decoration,\n type DecorationSet,\n EditorView,\n ViewPlugin,\n type ViewUpdate,\n WidgetType,\n keymap,\n} from '@codemirror/view';\n\nimport { Mutex } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\n\n// TODO(dmaretskyi): Consider adding details renderer for when you hover over the reference.\nexport type ReferenceData = {\n uri: string; // TODO(burdon): Rename dxn.\n label: string;\n};\n\n/**\n * @deprecated\n */\n// TODO(burdon): Remove.\nexport interface ReferencesProvider {\n getReferences({ query }: { query: string }): Promise<ReferenceData[]>;\n resolveReference({ uri }: { uri: string }): Promise<ReferenceData | null>;\n}\n\nexport type ReferencesOptions = {\n provider: ReferencesProvider;\n\n /**\n * @default '@'\n */\n triggerCharacter?: string;\n\n /**\n * Prevent the autocomplete from closing when the user blurs the editor.\n * @default false\n */\n debug?: boolean;\n};\n\n/**\n * Lookup object references.\n * @deprecated\n */\n// TODO(burdon): Remove.\nexport const references = ({ provider, triggerCharacter = '@', debug = false }: ReferencesOptions): Extension => {\n invariant(triggerCharacter.length === 1);\n\n const decorationField = ViewPlugin.fromClass(\n class ReferenceView {\n // TODO(burdon): Why?\n private _mutex = new Mutex();\n\n decorations: DecorationSet = Decoration.set([]);\n\n constructor(view: EditorView) {\n queueMicrotask(async () => {\n const guard = await this._mutex.acquire();\n try {\n this.decorations = await this._computeDecorations(view);\n } finally {\n guard.release();\n }\n });\n }\n\n update(update: ViewUpdate) {\n if (update.docChanged) {\n queueMicrotask(async () => {\n const guard = await this._mutex.acquire();\n try {\n this.decorations = await this._computeDecorations(update.view);\n } finally {\n guard.release();\n }\n });\n }\n }\n\n private async _computeDecorations(view: EditorView): Promise<DecorationSet> {\n const text = view.state.doc.toString();\n const references = text.matchAll(new RegExp(`${triggerCharacter}[a-zA-Z0-9@:]+\\\\s`, 'g'));\n\n const decorations = [];\n for (const match of references) {\n const reference = match[0];\n const uri = reference.slice(1, -1);\n const data = await provider.resolveReference({ uri });\n if (data) {\n decorations.push(\n Decoration.replace({\n widget: new ReferenceWidget(data),\n }).range(match.index!, match.index! + reference.length),\n );\n }\n }\n\n return Decoration.set(decorations);\n }\n },\n {\n decorations: (v) => v.decorations,\n provide: () => [\n EditorView.atomicRanges.of(\n (view): DecorationSet => view.plugin(decorationField)?.decorations ?? RangeSet.empty,\n ),\n ],\n },\n );\n\n return [\n decorationField,\n\n EditorView.theme({\n '.cm-reference-pill': {\n borderRadius: '0.25rem',\n borderWidth: '1px',\n marginRight: '0.25rem',\n marginLeft: '0.25rem',\n },\n }),\n\n autocompletion({\n tooltipClass: () => 'shadow rounded-sm',\n activateOnTyping: true,\n aboveCursor: true,\n closeOnBlur: !debug,\n override: [\n async (context): Promise<CompletionResult | null> => {\n const match = context.matchBefore(new RegExp(`${triggerCharacter}[a-zA-Z0-9]+`));\n if (!match || match?.to === match?.from) {\n return null;\n }\n\n const query = match.text.slice(1);\n const references = await provider.getReferences({ query });\n return {\n from: match.from,\n filter: false,\n options: references.map((reference) => ({\n label: reference.label,\n apply: `${triggerCharacter}${reference.uri} `,\n })),\n };\n },\n ],\n }),\n\n keymap.of(completionKeymap),\n ];\n};\n\nclass ReferenceWidget extends WidgetType {\n constructor(private data: ReferenceData) {\n super();\n }\n\n override ignoreEvent() {\n return true;\n }\n\n override eq(other: this) {\n return this.data.uri === other.data.uri;\n }\n\n override toDOM() {\n const span = document.createElement('span');\n span.textContent = `@${this.data.label}`;\n span.className = 'cm-reference-pill';\n return span;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Extension } from '@codemirror/state';\nimport React, { forwardRef, useMemo } from 'react';\n\nimport { type ThemedClassName, useThemeContext } from '@dxos/react-ui';\nimport { Editor, type EditorController, type UseTextEditorProps } from '@dxos/react-ui-editor';\nimport {\n type BasicExtensionsOptions,\n type SubmitOptions,\n createBasicExtensions,\n createThemeExtensions,\n submit,\n xmlFormatting,\n} from '@dxos/ui-editor';\nimport { isTruthy } from '@dxos/util';\n\nimport { type ReferencesOptions } from './references';\n\nexport interface ChatEditorController extends EditorController {}\n\nexport type ChatEditorProps = ThemedClassName<\n {\n extensions?: Extension;\n references?: ReferencesOptions;\n } & (SubmitOptions &\n Pick<UseTextEditorProps, 'id' | 'autoFocus'> &\n Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>)\n>;\n\nexport const useChatExtensions = ({ extensions, lineWrapping = false, placeholder, onSubmit }: ChatEditorProps) => {\n const { themeMode } = useThemeContext();\n return useMemo<Extension[]>(\n () =>\n [\n createThemeExtensions({ themeMode }),\n createBasicExtensions({ bracketMatching: false, lineWrapping, placeholder }),\n xmlFormatting(),\n submit({ onSubmit }),\n extensions,\n ].filter(isTruthy),\n [themeMode, extensions, onSubmit],\n );\n};\n\nexport const ChatEditor = forwardRef<ChatEditorController, ChatEditorProps>(\n ({ classNames, autoFocus, extensions: extensionsProp, lineWrapping = false, placeholder, onSubmit }, forwardRef) => {\n const extensions = useChatExtensions({ extensions: extensionsProp, lineWrapping, placeholder, onSubmit });\n\n // TODO(burdon): Popover.\n return (\n <Editor.Root ref={forwardRef}>\n <Editor.View classNames={classNames} autoFocus={autoFocus} extensions={extensions} />\n </Editor.Root>\n );\n },\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { type PropsWithChildren, type Ref, forwardRef, useEffect, useImperativeHandle, useState } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { formatElapsed } from './format';\n\nconst TICK_MS = 1_000;\n\n//\n// Context\n//\n\ntype ChatStatusContextValue = {\n /** Whole seconds elapsed since ChatStatus.Root mounted. Only advances while `running` is true. */\n elapsed: number;\n /** Whether the ChatStatus.Root tick is currently active. Toggled via the ChatStatusController. */\n running: boolean;\n};\n\nconst [ChatStatusProvider, useChatStatusContext] = createContext<ChatStatusContextValue>('ChatStatus');\n\nexport { useChatStatusContext };\n\n//\n// Controller\n//\n\nexport type ChatStatusController = {\n /** Resume the tick. No-op if already running. */\n start: () => void;\n /** Pause the tick. The reported `elapsed` freezes at its last value. */\n stop: () => void;\n};\n\n//\n// Root\n//\n\nexport type RootProps = ThemedClassName<\n PropsWithChildren<{\n /** Whether the tick starts running on mount. Defaults to `true`. */\n defaultRunning?: boolean;\n }>\n>;\n\nconst Root = forwardRef<ChatStatusController, RootProps>(\n ({ classNames, children, defaultRunning = true }: RootProps, forwardedRef: Ref<ChatStatusController>) => {\n const [elapsed, setElapsed] = useState(0);\n const [running, setRunning] = useState(defaultRunning);\n\n useEffect(() => {\n if (!running) {\n return;\n }\n\n // Anchor to a wall-clock timestamp so `elapsed` self-corrects after\n // tab-throttling: browsers clamp setTimeout to >=1s in inactive tabs\n // and >=1min when the page is hidden, so a count-the-ticks approach\n // would under-report after a background period. Computing elapsed from\n // (Date.now() - startedAt) restores the true wall-clock value on the\n // next fired tick. The initial elapsed (preserved across stop/start)\n // is folded into the anchor so paused intervals are excluded.\n const startedAt = Date.now() - elapsed * TICK_MS;\n let timeout: ReturnType<typeof setTimeout>;\n const tick = () => {\n setElapsed(Math.floor((Date.now() - startedAt) / TICK_MS));\n timeout = setTimeout(tick, TICK_MS - (Date.now() % TICK_MS));\n };\n timeout = setTimeout(tick, TICK_MS - (Date.now() % TICK_MS));\n return () => clearTimeout(timeout);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `elapsed` is\n // captured once at resume; depending on it would restart the timer on\n // every tick.\n }, [running]);\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n start: () => setRunning(true),\n stop: () => setRunning(false),\n }),\n [],\n );\n\n return (\n <ChatStatusProvider elapsed={elapsed} running={running}>\n <span className={mx('inline-flex items-center gap-2 text-description font-mono tabular-nums', classNames)}>\n {children}\n </span>\n </ChatStatusProvider>\n );\n },\n);\n\nRoot.displayName = 'ChatChatStatus.Root';\n\n//\n// Icon\n//\n\nexport type IconProps = ThemedClassName<PropsWithChildren>;\n\n/**\n * Animated leading indicator. Defaults to a halo-pulse dot. Pass children to override.\n */\nconst Icon = ({ classNames, children }: IconProps) => {\n if (children !== undefined) {\n return <>{children}</>;\n }\n return (\n <span\n aria-hidden='true'\n className={mx('inline-block size-2 rounded-full bg-current animate-halo-pulse', classNames)}\n />\n );\n};\n\n//\n// Stopwatch\n//\n\nexport type StopwatchProps = ThemedClassName<{\n /** Seconds to add to the context elapsed value before formatting. Defaults to 0. */\n offset?: number;\n}>;\n\n/**\n * Elapsed-time display, driven by the ChatStatus.Root context tick.\n * Use `offset` to shift the displayed value; remount `ChatStatus.Root` to reset the underlying counter.\n * Marked `aria-live='off'` so screen readers don't announce every tick.\n */\nconst Stopwatch = ({ classNames, offset = 0 }: StopwatchProps) => {\n const { elapsed } = useChatStatusContext('ChatChatStatus.Stopwatch');\n return (\n <span aria-live='off' className={mx(classNames)}>\n {formatElapsed((elapsed + offset) * 1_000)}\n </span>\n );\n};\n\n//\n// Separator\n//\n\nexport type SeparatorProps = ThemedClassName<unknown>;\n\n/**\n * Middle-dot separator. Decorative — `aria-hidden`.\n */\nconst Separator = ({ classNames }: SeparatorProps) => (\n <span aria-hidden='true' className={mx('opacity-50', classNames)}>\n ·\n </span>\n);\n\n//\n// Text\n//\n\nexport type TextProps = ThemedClassName<PropsWithChildren>;\n\n/**\n * Generic text node — useful for token counts and other inline metadata.\n */\nconst Text = ({ classNames, children }: TextProps) => <span className={mx(classNames)}>{children}</span>;\n\n//\n// ChatStatus\n//\n\nexport const ChatStatus = {\n Root,\n Icon,\n Stopwatch,\n Separator,\n Text,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nconst SECOND = 1_000;\nconst MINUTE = 60 * SECOND;\nconst HOUR = 60 * MINUTE;\n\n/**\n * Formats elapsed milliseconds as a human-readable duration.\n * Tiers: `Ns` (< 60s), `Nm Xs` (< 60m), `Nh Xm` (≥ 60m).\n * Negative inputs clamp to `0s`.\n */\nexport const formatElapsed = (ms: number): string => {\n const safe = Math.max(0, ms);\n if (safe < MINUTE) {\n return `${Math.floor(safe / SECOND)}s`;\n }\n if (safe < HOUR) {\n const m = Math.floor(safe / MINUTE);\n const s = Math.floor((safe % MINUTE) / SECOND);\n return `${m}m ${s}s`;\n }\n const h = Math.floor(safe / HOUR);\n const m = Math.floor((safe % HOUR) / MINUTE);\n return `${h}h ${m}m`;\n};\n"],
5
+ "mappings": ";;;AAIA,SAASA,qBAAqB;AAC9B,OAAOC,SAAqEC,WAAWC,gBAAgB;AAEvG,SAASC,QAAQC,MAAMC,YAAkCC,0BAA0B;AACnF,SAASC,cAAyBC,kBAAkBC,iBAAiB;AACrE,SAASC,UAAU;AAEnB,IAAMC,iBAAiB,CAACC,UAAiBA,MAAMD,eAAc;AAG7D,IAAME,SAAS,CAAC,EAAEC,SAAQ,MAAqB;AAC7C,SACE,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACZF,QAAAA;AAGP;AAeA,IAAM,CAACG,2BAA2BC,oBAAAA,IAAwBnB,cAAsC,YAAA;AAchG,IAAMoB,iBAAiB,CAAC,EACtBL,UACAM,MAAMC,WAAW,OACjBC,UAAUC,eAAe,OACzBC,cACAC,kBACAC,SAAQ,MACY;AACpB,QAAM,CAACC,MAAMC,OAAAA,IAAW1B,SAAe,aAAA;AACv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CAAA;AAG1C;AAWA,IAAMI,YAAY,CAAC,EAAErC,WAAU,MAC7B,gBAAAuB,OAAA,cAACE,QAAAA;EAAKM,eAAY;EAAOL,WAAWC,IAAG,cAAc3B,UAAAA;GAAa,MAAA;AAcpE,IAAMsC,OAAO,CAAC,EAAEtC,YAAYC,SAAQ,MAAkB,gBAAAsB,OAAA,cAACE,QAAAA;EAAKC,WAAWC,IAAG3B,UAAAA;GAAcC,QAAAA;AAMjF,IAAMsC,aAAa;EACxBzC;EACA+B,MAAAA;EACAG;EACAK;EACAC;AACF;",
6
+ "names": ["createContext", "React", "useEffect", "useState", "Dialog", "Icon", "IconButton", "useControlledState", "ResizeHandle", "resizeAttributes", "sizeStyle", "mx", "preventDefault", "event", "Endcap", "children", "div", "className", "ChatDialogContextProvider", "useChatDialogContext", "ChatDialogRoot", "open", "openProp", "expanded", "expandedProp", "onOpenChange", "onExpandedChange", "onEscape", "size", "setSize", "setOpen", "setExpanded", "Root", "modal", "role", "data-block-align", "Content", "inOverlayLayout", "classNames", "onEscapeKeyDown", "onInteractOutside", "displayName", "CHAT_DIALOG_HEADER_NAME", "ChatDialogHeader", "title", "Close", "icon", "Title", "onClick", "variant", "iconOnly", "label", "CHAT_DIALOG_CONTENT_NAME", "ChatDialogContent", "style", "maxBlockSize", "side", "iconPosition", "defaultSize", "fallbackSize", "minSize", "onSizeChange", "CHAT_DIALOG_FOOTER_NAME", "ChatDialogFooter", "ChatDialog", "Header", "Footer", "autocompletion", "completionKeymap", "RangeSet", "Decoration", "EditorView", "ViewPlugin", "WidgetType", "keymap", "Mutex", "invariant", "decorationField", "fromClass", "ReferenceView", "_mutex", "view", "queueMicrotask", "guard", "decorations", "_computeDecorations", "update", "text", "matchAll", "references", "match", "reference", "uri", "data", "provider", "widget", "index", "atomicRanges", "borderRadius", "marginRight", "marginLeft", "activateOnTyping", "aboveCursor", "closeOnBlur", "debug", "override", "context", "query", "filter", "options", "label", "apply", "triggerCharacter", "ignoreEvent", "other", "toDOM", "span", "className", "React", "forwardRef", "useMemo", "useThemeContext", "Editor", "createBasicExtensions", "createThemeExtensions", "submit", "xmlFormatting", "isTruthy", "useChatExtensions", "extensions", "lineWrapping", "placeholder", "onSubmit", "themeMode", "bracketMatching", "filter", "ChatEditor", "classNames", "autoFocus", "extensionsProp", "Root", "ref", "View", "createContext", "React", "forwardRef", "useEffect", "useImperativeHandle", "useState", "mx", "SECOND", "MINUTE", "HOUR", "formatElapsed", "ms", "safe", "Math", "max", "floor", "m", "s", "h", "TICK_MS", "ChatStatusProvider", "useChatStatusContext", "createContext", "Root", "forwardRef", "classNames", "children", "defaultRunning", "forwardedRef", "elapsed", "setElapsed", "useState", "running", "setRunning", "useEffect", "startedAt", "Date", "now", "TICK_MS", "timeout", "tick", "Math", "floor", "setTimeout", "clearTimeout", "useImperativeHandle", "start", "stop", "React", "ChatStatusProvider", "span", "className", "mx", "displayName", "Icon", "undefined", "aria-hidden", "Stopwatch", "offset", "useChatStatusContext", "aria-live", "formatElapsed", "Separator", "Text", "ChatStatus"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/components/ChatDialog/ChatDialog.tsx":{"bytes":17762,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-dnd","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/ChatDialog/index.ts":{"bytes":480,"imports":[{"path":"src/components/ChatDialog/ChatDialog.tsx","kind":"import-statement","original":"./ChatDialog"}],"format":"esm"},"src/components/ChatEditor/references.ts":{"bytes":16344,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/components/ChatEditor/ChatEditor.tsx":{"bytes":11709,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","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/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/components/ChatEditor/references.ts","kind":"import-statement","original":"./references"}],"format":"esm"},"src/components/ChatEditor/index.ts":{"bytes":574,"imports":[{"path":"src/components/ChatEditor/references.ts","kind":"import-statement","original":"./references"},{"path":"src/components/ChatEditor/ChatEditor.tsx","kind":"import-statement","original":"./ChatEditor"}],"format":"esm"},"src/components/index.ts":{"bytes":563,"imports":[{"path":"src/components/ChatDialog/index.ts","kind":"import-statement","original":"./ChatDialog"},{"path":"src/components/ChatEditor/index.ts","kind":"import-statement","original":"./ChatEditor"}],"format":"esm"},"src/translations.ts":{"bytes":1041,"imports":[],"format":"esm"},"src/index.ts":{"bytes":558,"imports":[{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23611},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-dnd","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","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/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["ChatDialog","ChatEditor","references","translationKey","translations"],"entryPoint":"src/index.ts","inputs":{"src/components/ChatDialog/ChatDialog.tsx":{"bytesInOutput":4874},"src/components/ChatDialog/index.ts":{"bytesInOutput":0},"src/components/index.ts":{"bytesInOutput":0},"src/components/ChatEditor/references.ts":{"bytesInOutput":3999},"src/components/ChatEditor/index.ts":{"bytesInOutput":0},"src/components/ChatEditor/ChatEditor.tsx":{"bytesInOutput":2824},"src/index.ts":{"bytesInOutput":0},"src/translations.ts":{"bytesInOutput":118}},"bytes":12187}}}
1
+ {"inputs":{"src/components/ChatDialog/ChatDialog.tsx":{"bytes":17444,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-dnd","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/ChatDialog/index.ts":{"bytes":382,"imports":[{"path":"src/components/ChatDialog/ChatDialog.tsx","kind":"import-statement","original":"./ChatDialog"}],"format":"esm"},"src/components/ChatEditor/references.ts":{"bytes":15988,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/components/ChatEditor/ChatEditor.tsx":{"bytes":5885,"imports":[{"path":"react","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/util","kind":"import-statement","external":true}],"format":"esm"},"src/components/ChatEditor/index.ts":{"bytes":476,"imports":[{"path":"src/components/ChatEditor/references.ts","kind":"import-statement","original":"./references"},{"path":"src/components/ChatEditor/ChatEditor.tsx","kind":"import-statement","original":"./ChatEditor"}],"format":"esm"},"src/components/ChatStatus/format.ts":{"bytes":2700,"imports":[],"format":"esm"},"src/components/ChatStatus/ChatStatus.tsx":{"bytes":13936,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/components/ChatStatus/format.ts","kind":"import-statement","original":"./format"}],"format":"esm"},"src/components/ChatStatus/index.ts":{"bytes":464,"imports":[{"path":"src/components/ChatStatus/ChatStatus.tsx","kind":"import-statement","original":"./ChatStatus"},{"path":"src/components/ChatStatus/format.ts","kind":"import-statement","original":"./format"}],"format":"esm"},"src/components/index.ts":{"bytes":566,"imports":[{"path":"src/components/ChatDialog/index.ts","kind":"import-statement","original":"./ChatDialog"},{"path":"src/components/ChatEditor/index.ts","kind":"import-statement","original":"./ChatEditor"},{"path":"src/components/ChatStatus/index.ts","kind":"import-statement","original":"./ChatStatus"}],"format":"esm"},"src/index.ts":{"bytes":382,"imports":[{"path":"src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"},"src/translations.ts":{"bytes":968,"imports":[],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":28850},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-dnd","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"react","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/util","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["ChatDialog","ChatEditor","ChatStatus","formatElapsed","references","useChatExtensions","useChatStatusContext"],"entryPoint":"src/index.ts","inputs":{"src/components/ChatDialog/ChatDialog.tsx":{"bytesInOutput":4386},"src/components/ChatDialog/index.ts":{"bytesInOutput":0},"src/components/index.ts":{"bytesInOutput":0},"src/components/ChatEditor/references.ts":{"bytesInOutput":3675},"src/components/ChatEditor/index.ts":{"bytesInOutput":0},"src/components/ChatEditor/ChatEditor.tsx":{"bytesInOutput":1243},"src/components/ChatStatus/ChatStatus.tsx":{"bytesInOutput":2424},"src/components/ChatStatus/format.ts":{"bytesInOutput":455},"src/components/ChatStatus/index.ts":{"bytesInOutput":0},"src/index.ts":{"bytesInOutput":0}},"bytes":12703},"dist/lib/node-esm/translations.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":525},"dist/lib/node-esm/translations.mjs":{"imports":[],"exports":["translationKey","translations"],"entryPoint":"src/translations.ts","inputs":{"src/translations.ts":{"bytesInOutput":124}},"bytes":327}}}
@@ -0,0 +1,16 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/translations.ts
4
+ var translationKey = "@dxos/react-ui-chat";
5
+ var translations = [
6
+ {
7
+ "en-US": {
8
+ [translationKey]: {}
9
+ }
10
+ }
11
+ ];
12
+ export {
13
+ translationKey,
14
+ translations
15
+ };
16
+ //# sourceMappingURL=translations.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = '@dxos/react-ui-chat';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {},\n },\n },\n] as const satisfies Resource[];\n"],
5
+ "mappings": ";;;AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,cAAAA,GAAiB,CAAC;IACrB;EACF;;",
6
+ "names": ["translationKey", "translations"]
7
+ }
@@ -7,14 +7,30 @@ type ChatDialogRootProps = PropsWithChildren<{
7
7
  onExpandedChange?: (expanded: boolean) => void;
8
8
  onEscape?: () => void;
9
9
  }>;
10
+ declare function ChatDialogRoot({ children, open: openProp, expanded: expandedProp, onOpenChange, onExpandedChange, onEscape }: ChatDialogRootProps): React.JSX.Element;
11
+ declare namespace ChatDialogRoot {
12
+ var displayName: string;
13
+ }
10
14
  type ChatDialogHeaderProps = ThemedClassName<{
11
15
  title?: string;
12
16
  }>;
17
+ declare function ChatDialogHeader({ classNames, title }: ChatDialogHeaderProps): React.JSX.Element;
18
+ declare namespace ChatDialogHeader {
19
+ var displayName: string;
20
+ }
13
21
  type ChatDialogContentProps = ThemedClassName<PropsWithChildren>;
22
+ declare function ChatDialogContent({ children, classNames }: ChatDialogContentProps): React.JSX.Element;
23
+ declare namespace ChatDialogContent {
24
+ var displayName: string;
25
+ }
14
26
  type ChatDialogFooterProps = ThemedClassName<PropsWithChildren>;
27
+ declare function ChatDialogFooter({ children, classNames }: ChatDialogFooterProps): React.JSX.Element;
28
+ declare namespace ChatDialogFooter {
29
+ var displayName: string;
30
+ }
15
31
  export declare const ChatDialog: {
16
32
  Root: {
17
- ({ children, open: _open, expanded: expandedParam, onOpenChange, onExpandedChange, onEscape, }: ChatDialogRootProps): React.JSX.Element;
33
+ ({ children, open: openProp, expanded: expandedProp, onOpenChange, onExpandedChange, onEscape, }: ChatDialogRootProps): React.JSX.Element;
18
34
  displayName: string;
19
35
  };
20
36
  Header: {
@@ -1 +1 @@
1
- {"version":3,"file":"ChatDialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatDialog/ChatDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAiB,KAAK,iBAAiB,EAA4C,MAAM,OAAO,CAAC;AAE/G,OAAO,EAA4B,KAAK,eAAe,EAAsB,MAAM,gBAAgB,CAAC;AAgCpG,KAAK,mBAAmB,GAAG,iBAAiB,CAAC;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC,CAAC;AAkDH,KAAK,qBAAqB,GAAG,eAAe,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAsCH,KAAK,sBAAsB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAwCjE,KAAK,qBAAqB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAYhE,eAAO,MAAM,UAAU;;wGArIpB,mBAAmB;;;;gCA6C2B,qBAAqB;;;;mCAsCjB,sBAAsB;;;;mCAwCvB,qBAAqB;;;CAexE,CAAC"}
1
+ {"version":3,"file":"ChatDialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatDialog/ChatDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KA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enChange, onExpandedChange, onEscape, }: {
6
+ ({ children, open: openProp, expanded: expandedProp, onOpenChange, onExpandedChange, onEscape, }: {
7
7
  open?: boolean;
8
8
  expanded?: boolean;
9
9
  onOpenChange?: (open: boolean) => void;
@@ -25,10 +25,9 @@ declare const meta: {
25
25
  }) => React.JSX.Element;
26
26
  decorators: import("@storybook/react").Decorator[];
27
27
  parameters: {
28
- layout: string;
29
28
  translations: [{
30
29
  readonly 'en-US': {
31
- readonly "react-ui-chat": {};
30
+ readonly "@dxos/react-ui-chat": {};
32
31
  };
33
32
  }];
34
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ChatDialog.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatDialog/ChatDialog.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C8B,CAAC;AAEzC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
1
+ {"version":3,"file":"ChatDialog.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatDialog/ChatDialog.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC8B,CAAC;eAE1B,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -1,21 +1,20 @@
1
1
  import { type Extension } from '@codemirror/state';
2
2
  import React from 'react';
3
3
  import { type ThemedClassName } from '@dxos/react-ui';
4
- import { type AutocompleteOptions, type BasicExtensionsOptions, type UseTextEditorProps } from '@dxos/react-ui-editor';
4
+ import { type EditorController, type UseTextEditorProps } from '@dxos/react-ui-editor';
5
+ import { type BasicExtensionsOptions, type SubmitOptions } from '@dxos/ui-editor';
5
6
  import { type ReferencesOptions } from './references';
6
- export interface ChatEditorController {
7
- focus(): void;
8
- getText(): string;
9
- setText(text: string): void;
7
+ export interface ChatEditorController extends EditorController {
10
8
  }
11
9
  export type ChatEditorProps = ThemedClassName<{
12
10
  extensions?: Extension;
13
11
  references?: ReferencesOptions;
14
- } & AutocompleteOptions & Pick<UseTextEditorProps, 'id' | 'autoFocus'> & Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>>;
12
+ } & (SubmitOptions & Pick<UseTextEditorProps, 'id' | 'autoFocus'> & Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>)>;
13
+ export declare const useChatExtensions: ({ extensions, lineWrapping, placeholder, onSubmit }: ChatEditorProps) => Extension[];
15
14
  export declare const ChatEditor: React.ForwardRefExoticComponent<Omit<{
16
15
  extensions?: Extension;
17
16
  references?: ReferencesOptions;
18
- } & AutocompleteOptions & Pick<UseTextEditorProps, "autoFocus" | "id"> & Pick<BasicExtensionsOptions, "lineWrapping" | "placeholder">, "className"> & {
19
- classNames?: import("@dxos/react-ui-types").ClassNameValue;
17
+ } & SubmitOptions & Pick<UseTextEditorProps, "autoFocus" | "id"> & Pick<BasicExtensionsOptions, "lineWrapping" | "placeholder">, "className"> & {
18
+ classNames?: import("@dxos/ui-types").ClassNameValue;
20
19
  } & React.RefAttributes<ChatEditorController>>;
21
20
  //# sourceMappingURL=ChatEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/ChatEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mB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AW,oBAAqB,SAAQ,gBAAgB;CAAG;AAEjE,MAAM,MAAM,eAAe,GAAG,eAAe,CAC3C;IACE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC,GAAG,CAAC,aAAa,GAChB,IAAI,CAAC,kBAAkB,EAAE,IAAI,GAAG,WAAW,CAAC,GAC5C,IAAI,CAAC,sBAAsB,EAAE,cAAc,GAAG,aAAa,CAAC,CAAC,CAChE,CAAC;AAEF,eAAO,MAAM,iBAAiB,wDAAiE,eAAe,gBAa7G,CAAC;AAEF,eAAO,MAAM,UAAU;iBAtBN,SAAS;iBACT,iBAAiB;;;8CAgCjC,CAAC"}
@@ -4,15 +4,15 @@ declare const meta: {
4
4
  component: import("react").ForwardRefExoticComponent<Omit<{
5
5
  extensions?: import("@codemirror/state").Extension;
6
6
  references?: import("./references").ReferencesOptions;
7
- } & import("@dxos/react-ui-editor").AutocompleteOptions & Pick<import("@dxos/react-ui-editor").UseTextEditorProps, "autoFocus" | "id"> & Pick<import("@dxos/react-ui-editor").BasicExtensionsOptions, "lineWrapping" | "placeholder">, "className"> & {
8
- classNames?: import("@dxos/react-ui-types").ClassNameValue;
7
+ } & import("@dxos/ui-editor").SubmitOptions & Pick<import("@dxos/react-ui-editor").UseTextEditorProps, "autoFocus" | "id"> & Pick<import("@dxos/ui-editor").BasicExtensionsOptions, "lineWrapping" | "placeholder">, "className"> & {
8
+ classNames?: import("@dxos/ui-types").ClassNameValue;
9
9
  } & import("react").RefAttributes<import("./ChatEditor").ChatEditorController>>;
10
10
  decorators: import("@storybook/react").Decorator[];
11
11
  parameters: {
12
12
  layout: string;
13
13
  translations: [{
14
14
  readonly 'en-US': {
15
- readonly "react-ui-chat": {};
15
+ readonly "@dxos/react-ui-chat": {};
16
16
  };
17
17
  }];
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ChatEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/ChatEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUjE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;CAQyB,CAAC;AAEpC,eAAe,IAAI,CAAC;AAIpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAuB7B,CAAC;AAiBF,eAAO,MAAM,cAAc,EAAE,KAkB5B,CAAC"}
1
+ {"version":3,"file":"ChatEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/ChatEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUjE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;CAQyB,CAAC;eAErB,IAAI;AAInB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,KAsB7B,CAAC;AAkBF,eAAO,MAAM,cAAc,EAAE,KAkB5B,CAAC"}
@@ -3,6 +3,9 @@ export type ReferenceData = {
3
3
  uri: string;
4
4
  label: string;
5
5
  };
6
+ /**
7
+ * @deprecated
8
+ */
6
9
  export interface ReferencesProvider {
7
10
  getReferences({ query }: {
8
11
  query: string;
@@ -25,6 +28,7 @@ export type ReferencesOptions = {
25
28
  };
26
29
  /**
27
30
  * Lookup object references.
31
+ * @deprecated
28
32
  */
29
33
  export declare const references: ({ provider, triggerCharacter, debug }: ReferencesOptions) => Extension;
30
34
  //# sourceMappingURL=references.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/references.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK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AM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;GAGG;AAEH,eAAO,MAAM,UAAU,0CAAyD,iBAAiB,KAAG,SAyGnG,CAAC"}
@@ -0,0 +1,40 @@
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import { type ThemedClassName } from '@dxos/react-ui';
3
+ type ChatStatusContextValue = {
4
+ /** Whole seconds elapsed since ChatStatus.Root mounted. Only advances while `running` is true. */
5
+ elapsed: number;
6
+ /** Whether the ChatStatus.Root tick is currently active. Toggled via the ChatStatusController. */
7
+ running: boolean;
8
+ };
9
+ declare const useChatStatusContext: (consumerName: string) => ChatStatusContextValue;
10
+ export { useChatStatusContext };
11
+ export type ChatStatusController = {
12
+ /** Resume the tick. No-op if already running. */
13
+ start: () => void;
14
+ /** Pause the tick. The reported `elapsed` freezes at its last value. */
15
+ stop: () => void;
16
+ };
17
+ export type RootProps = ThemedClassName<PropsWithChildren<{
18
+ /** Whether the tick starts running on mount. Defaults to `true`. */
19
+ defaultRunning?: boolean;
20
+ }>>;
21
+ export type IconProps = ThemedClassName<PropsWithChildren>;
22
+ export type StopwatchProps = ThemedClassName<{
23
+ /** Seconds to add to the context elapsed value before formatting. Defaults to 0. */
24
+ offset?: number;
25
+ }>;
26
+ export type SeparatorProps = ThemedClassName<unknown>;
27
+ export type TextProps = ThemedClassName<PropsWithChildren>;
28
+ export declare const ChatStatus: {
29
+ Root: React.ForwardRefExoticComponent<Omit<PropsWithChildren<{
30
+ /** Whether the tick starts running on mount. Defaults to `true`. */
31
+ defaultRunning?: boolean;
32
+ }>, "className"> & {
33
+ classNames?: import("@dxos/ui-types").ClassNameValue;
34
+ } & React.RefAttributes<ChatStatusController>>;
35
+ Icon: ({ classNames, children }: IconProps) => React.JSX.Element;
36
+ Stopwatch: ({ classNames, offset }: StopwatchProps) => React.JSX.Element;
37
+ Separator: ({ classNames }: SeparatorProps) => React.JSX.Element;
38
+ Text: ({ classNames, children }: TextProps) => React.JSX.Element;
39
+ };
40
+ //# sourceMappingURL=ChatStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/ChatStatus.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAkE,MAAM,OAAO,CAAC;AAEtH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAWtD,KAAK,sBAAsB,GAAG;IAC5B,kGAAkG;IAClG,OAAO,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,QAAA,MAA2B,oBAAoB,kDAAuD,CAAC;AAEvG,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAMhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,iDAAiD;IACjD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,wEAAwE;IACxE,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAMF,MAAM,MAAM,SAAS,GAAG,eAAe,CACrC,iBAAiB,CAAC;IAChB,oEAAoE;IACpE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC,CACH,CAAC;AAyDF,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAqB3D,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC;IAC3C,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAoBH,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAetD,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAW3D,eAAO,MAAM,UAAU;;QAlInB,oEAAoE;yBACnD,OAAO;;;;qCAgEY,SAAS;wCA0BF,cAAc;gCAkB1B,cAAc;qCAeT,SAAS;CAYhD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ import { type ChatStatusController } from './ChatStatus';
4
+ declare const meta: {
5
+ title: string;
6
+ component: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<{
7
+ defaultRunning?: boolean;
8
+ }>, "className"> & {
9
+ classNames?: import("@dxos/ui-types").ClassNameValue;
10
+ } & React.RefAttributes<ChatStatusController>>;
11
+ decorators: import("@storybook/react").Decorator[];
12
+ parameters: {
13
+ layout: string;
14
+ };
15
+ };
16
+ export default meta;
17
+ type Story = StoryObj<typeof meta>;
18
+ export declare const Default: Story;
19
+ export declare const WithMeta: Story;
20
+ export declare const WithCustomIcon: Story;
21
+ export declare const LongRunning: Story;
22
+ export declare const TextOnly: Story;
23
+ /**
24
+ * Demonstrates the imperative controller — start/stop the 1Hz tick from the outside.
25
+ */
26
+ export declare const Controller: Story;
27
+ //# sourceMappingURL=ChatStatus.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatStatus.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/ChatStatus.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAiB,MAAM,OAAO,CAAC;AAMtC,OAAO,EAAc,KAAK,oBAAoB,EAAwB,MAAM,cAAc,CAAC;AAE3F,QAAA,MAAM,IAAI;;;;;;;;;QAQN,MAAM;;CAE8B,CAAC;eAE1B,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAsBF,eAAO,MAAM,cAAc,EAAE,KAa5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAWzB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAkBxB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Formats elapsed milliseconds as a human-readable duration.
3
+ * Tiers: `Ns` (< 60s), `Nm Xs` (< 60m), `Nh Xm` (≥ 60m).
4
+ * Negative inputs clamp to `0s`.
5
+ */
6
+ export declare const formatElapsed: (ms: number) => string;
7
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/format.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAa1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/format.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './ChatStatus';
2
+ export * from './format';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatStatus/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './ChatDialog';
2
2
  export * from './ChatEditor';
3
+ export * from './ChatStatus';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from './components';
2
- export * from './translations';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
@@ -1,7 +1,7 @@
1
- export declare const translationKey = "react-ui-chat";
1
+ export declare const translationKey = "@dxos/react-ui-chat";
2
2
  export declare const translations: [{
3
3
  readonly 'en-US': {
4
- readonly "react-ui-chat": {};
4
+ readonly "@dxos/react-ui-chat": {};
5
5
  };
6
6
  }];
7
7
  //# sourceMappingURL=translations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C,eAAO,MAAM,YAAY;;;;EAMM,CAAC"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,YAAY;;;;EAMM,CAAC"}