@dxos/react-ui-chat 0.8.4-main.c85a9c8dae → 0.8.4-main.d05539e30a

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 (44) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/index.mjs +95 -24
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/translations.mjs +14 -0
  6. package/dist/lib/browser/translations.mjs.map +7 -0
  7. package/dist/lib/node-esm/index.mjs +95 -24
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/lib/node-esm/translations.mjs +16 -0
  11. package/dist/lib/node-esm/translations.mjs.map +7 -0
  12. package/dist/types/src/components/ChatDialog/ChatDialog.d.ts +16 -0
  13. package/dist/types/src/components/ChatDialog/ChatDialog.d.ts.map +1 -1
  14. package/dist/types/src/components/ChatDialog/ChatDialog.stories.d.ts.map +1 -1
  15. package/dist/types/src/components/ChatEditor/ChatEditor.d.ts.map +1 -1
  16. package/dist/types/src/components/ChatEditor/ChatEditor.stories.d.ts.map +1 -1
  17. package/dist/types/src/components/ChatEditor/references.d.ts.map +1 -1
  18. package/dist/types/src/components/ChatStatus/ChatStatus.d.ts +40 -0
  19. package/dist/types/src/components/ChatStatus/ChatStatus.d.ts.map +1 -0
  20. package/dist/types/src/components/ChatStatus/ChatStatus.stories.d.ts +27 -0
  21. package/dist/types/src/components/ChatStatus/ChatStatus.stories.d.ts.map +1 -0
  22. package/dist/types/src/components/ChatStatus/format.d.ts +7 -0
  23. package/dist/types/src/components/ChatStatus/format.d.ts.map +1 -0
  24. package/dist/types/src/components/ChatStatus/format.test.d.ts +2 -0
  25. package/dist/types/src/components/ChatStatus/format.test.d.ts.map +1 -0
  26. package/dist/types/src/components/ChatStatus/index.d.ts +3 -0
  27. package/dist/types/src/components/ChatStatus/index.d.ts.map +1 -0
  28. package/dist/types/src/components/index.d.ts +1 -0
  29. package/dist/types/src/components/index.d.ts.map +1 -1
  30. package/dist/types/src/index.d.ts +0 -1
  31. package/dist/types/src/index.d.ts.map +1 -1
  32. package/dist/types/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +37 -31
  34. package/src/components/ChatDialog/ChatDialog.stories.tsx +1 -1
  35. package/src/components/ChatDialog/ChatDialog.tsx +1 -1
  36. package/src/components/ChatEditor/ChatEditor.stories.tsx +3 -3
  37. package/src/components/ChatEditor/ChatEditor.tsx +3 -1
  38. package/src/components/ChatStatus/ChatStatus.stories.tsx +130 -0
  39. package/src/components/ChatStatus/ChatStatus.tsx +183 -0
  40. package/src/components/ChatStatus/format.test.ts +48 -0
  41. package/src/components/ChatStatus/format.ts +27 -0
  42. package/src/components/ChatStatus/index.ts +6 -0
  43. package/src/components/index.ts +1 -0
  44. package/src/index.ts +0 -1
@@ -29,7 +29,6 @@ var ChatDialogRoot = ({ children, open: openProp = false, expanded: expandedProp
29
29
  open,
30
30
  onOpenChange: setOpen
31
31
  }, /* @__PURE__ */ React.createElement("div", {
32
- role: "none",
33
32
  className: "dx-dialog__overlay bg-transparent pointer-events-none",
34
33
  "data-block-align": "end"
35
34
  }, /* @__PURE__ */ React.createElement(Dialog.Content, {
@@ -110,15 +109,7 @@ import { Mutex } from "@dxos/async";
110
109
  import { invariant } from "@dxos/invariant";
111
110
  var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-chat/src/components/ChatEditor/references.ts";
112
111
  var references = ({ provider, triggerCharacter = "@", debug = false }) => {
113
- invariant(triggerCharacter.length === 1, void 0, {
114
- F: __dxlog_file,
115
- L: 56,
116
- S: void 0,
117
- A: [
118
- "triggerCharacter.length === 1",
119
- ""
120
- ]
121
- });
112
+ invariant(triggerCharacter.length === 1, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 14, S: void 0, A: ["triggerCharacter.length === 1", ""] });
122
113
  const decorationField = ViewPlugin.fromClass(class ReferenceView {
123
114
  // TODO(burdon): Why?
124
115
  _mutex = new Mutex();
@@ -231,7 +222,7 @@ var ReferenceWidget = class extends WidgetType {
231
222
  import React2, { forwardRef, useMemo } from "react";
232
223
  import { useThemeContext } from "@dxos/react-ui";
233
224
  import { Editor } from "@dxos/react-ui-editor";
234
- import { createBasicExtensions, createThemeExtensions, submit } from "@dxos/ui-editor";
225
+ import { createBasicExtensions, createThemeExtensions, submit, xmlFormatting } from "@dxos/ui-editor";
235
226
  import { isTruthy } from "@dxos/util";
236
227
  var useChatExtensions = ({ extensions, lineWrapping = false, placeholder, onSubmit }) => {
237
228
  const { themeMode } = useThemeContext();
@@ -244,6 +235,7 @@ var useChatExtensions = ({ extensions, lineWrapping = false, placeholder, onSubm
244
235
  lineWrapping,
245
236
  placeholder
246
237
  }),
238
+ xmlFormatting(),
247
239
  submit({
248
240
  onSubmit
249
241
  }),
@@ -254,7 +246,7 @@ var useChatExtensions = ({ extensions, lineWrapping = false, placeholder, onSubm
254
246
  onSubmit
255
247
  ]);
256
248
  };
257
- var ChatEditor = /* @__PURE__ */ forwardRef(({ classNames, autoFocus, extensions: extensionsProp, lineWrapping = false, placeholder, onSubmit }, forwardRef2) => {
249
+ var ChatEditor = /* @__PURE__ */ forwardRef(({ classNames, autoFocus, extensions: extensionsProp, lineWrapping = false, placeholder, onSubmit }, forwardRef3) => {
258
250
  const extensions = useChatExtensions({
259
251
  extensions: extensionsProp,
260
252
  lineWrapping,
@@ -262,29 +254,108 @@ var ChatEditor = /* @__PURE__ */ forwardRef(({ classNames, autoFocus, extensions
262
254
  onSubmit
263
255
  });
264
256
  return /* @__PURE__ */ React2.createElement(Editor.Root, {
265
- ref: forwardRef2
266
- }, /* @__PURE__ */ React2.createElement(Editor.Content, {
257
+ ref: forwardRef3
258
+ }, /* @__PURE__ */ React2.createElement(Editor.View, {
267
259
  classNames,
268
260
  autoFocus,
269
261
  extensions
270
262
  }));
271
263
  });
272
264
 
273
- // src/translations.ts
274
- var translationKey = "@dxos/react-ui-chat";
275
- var translations = [
276
- {
277
- "en-US": {
278
- [translationKey]: {}
265
+ // src/components/ChatStatus/ChatStatus.tsx
266
+ import { createContext as createContext2 } from "@radix-ui/react-context";
267
+ import React3, { forwardRef as forwardRef2, useEffect as useEffect2, useImperativeHandle, useState as useState2 } from "react";
268
+ import { mx as mx2 } from "@dxos/ui-theme";
269
+
270
+ // src/components/ChatStatus/format.ts
271
+ var SECOND = 1e3;
272
+ var MINUTE = 60 * SECOND;
273
+ var HOUR = 60 * MINUTE;
274
+ var formatElapsed = (ms) => {
275
+ const safe = Math.max(0, ms);
276
+ if (safe < MINUTE) {
277
+ return `${Math.floor(safe / SECOND)}s`;
278
+ }
279
+ if (safe < HOUR) {
280
+ const m2 = Math.floor(safe / MINUTE);
281
+ const s = Math.floor(safe % MINUTE / SECOND);
282
+ return `${m2}m ${s}s`;
283
+ }
284
+ const h = Math.floor(safe / HOUR);
285
+ const m = Math.floor(safe % HOUR / MINUTE);
286
+ return `${h}h ${m}m`;
287
+ };
288
+
289
+ // src/components/ChatStatus/ChatStatus.tsx
290
+ var TICK_MS = 1e3;
291
+ var [ChatStatusProvider, useChatStatusContext] = createContext2("ChatStatus");
292
+ var Root = /* @__PURE__ */ forwardRef2(({ classNames, children, defaultRunning = true }, forwardedRef) => {
293
+ const [elapsed, setElapsed] = useState2(0);
294
+ const [running, setRunning] = useState2(defaultRunning);
295
+ useEffect2(() => {
296
+ if (!running) {
297
+ return;
279
298
  }
299
+ const startedAt = Date.now() - elapsed * TICK_MS;
300
+ let timeout;
301
+ const tick = () => {
302
+ setElapsed(Math.floor((Date.now() - startedAt) / TICK_MS));
303
+ timeout = setTimeout(tick, TICK_MS - Date.now() % TICK_MS);
304
+ };
305
+ timeout = setTimeout(tick, TICK_MS - Date.now() % TICK_MS);
306
+ return () => clearTimeout(timeout);
307
+ }, [
308
+ running
309
+ ]);
310
+ useImperativeHandle(forwardedRef, () => ({
311
+ start: () => setRunning(true),
312
+ stop: () => setRunning(false)
313
+ }), []);
314
+ return /* @__PURE__ */ React3.createElement(ChatStatusProvider, {
315
+ elapsed,
316
+ running
317
+ }, /* @__PURE__ */ React3.createElement("span", {
318
+ className: mx2("inline-flex items-center gap-2 text-description font-mono tabular-nums", classNames)
319
+ }, children));
320
+ });
321
+ Root.displayName = "ChatChatStatus.Root";
322
+ var Icon2 = ({ classNames, children }) => {
323
+ if (children !== void 0) {
324
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
280
325
  }
281
- ];
326
+ return /* @__PURE__ */ React3.createElement("span", {
327
+ "aria-hidden": "true",
328
+ className: mx2("inline-block size-2 rounded-full bg-current animate-halo-pulse", classNames)
329
+ });
330
+ };
331
+ var Stopwatch = ({ classNames, offset = 0 }) => {
332
+ const { elapsed } = useChatStatusContext("ChatChatStatus.Stopwatch");
333
+ return /* @__PURE__ */ React3.createElement("span", {
334
+ "aria-live": "off",
335
+ className: mx2(classNames)
336
+ }, formatElapsed((elapsed + offset) * 1e3));
337
+ };
338
+ var Separator = ({ classNames }) => /* @__PURE__ */ React3.createElement("span", {
339
+ "aria-hidden": "true",
340
+ className: mx2("opacity-50", classNames)
341
+ }, "\xB7");
342
+ var Text = ({ classNames, children }) => /* @__PURE__ */ React3.createElement("span", {
343
+ className: mx2(classNames)
344
+ }, children);
345
+ var ChatStatus = {
346
+ Root,
347
+ Icon: Icon2,
348
+ Stopwatch,
349
+ Separator,
350
+ Text
351
+ };
282
352
  export {
283
353
  ChatDialog,
284
354
  ChatEditor,
355
+ ChatStatus,
356
+ formatElapsed,
285
357
  references,
286
- translationKey,
287
- translations,
288
- useChatExtensions
358
+ useChatExtensions,
359
+ useChatStatusContext
289
360
  };
290
361
  //# sourceMappingURL=index.mjs.map
@@ -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/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} 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 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.Content classNames={classNames} autoFocus={autoFocus} extensions={extensions} />\n </Editor.Root>\n );\n },\n);\n", "//\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": ";;;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,IAAwBC,cAAsC,YAAA;AAchG,IAAMC,iBAAiB,CAAC,EACtBN,UACAO,MAAMC,WAAW,OACjBC,UAAUC,eAAe,OACzBC,cACAC,kBACAC,SAAQ,MACY;AACpB,QAAM,CAACC,MAAMC,OAAAA,IAAWC,SAAe,aAAA;AACvC,QAAM,CAACT,MAAMU,OAAAA,IAAWC,mBAA4BV,UAAUG,YAAAA;AAC9D,QAAM,CAACF,UAAUU,WAAAA,IAAeD,mBAA4BR,cAAcE,gBAAAA;AAI1E,SACE,sBAAA,c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AcC;IAAY,CAAA;IAC1EQ,OAAO;MAAEP;IAAS,CAAA;IAClBH;IACAW,OAAOC,QAAAA,GACX;IAACR;IAAWJ;IAAYG;GAAS;AAErC;AAEO,IAAMU,aAAaC,2BACxB,CAAC,EAAEC,YAAYC,WAAWhB,YAAYiB,gBAAgBhB,eAAe,OAAOC,aAAaC,SAAQ,GAAIW,gBAAAA;AACnG,QAAMd,aAAaD,kBAAkB;IAAEC,YAAYiB;IAAgBhB;IAAcC;IAAaC;EAAS,CAAA;AAGvG,SACE,gBAAAe,OAAA,cAACC,OAAOC,MAAI;IAACC,KAAKP;KAChB,gBAAAI,OAAA,cAACC,OAAOG,SAAO;IAACP;IAAwBC;IAAsBhB;;AAGpE,CAAA;;;ACjDK,IAAMuB,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", "openProp", "expanded", "expandedProp", "onOpenChange", "onExpandedChange", "onEscape", "size", "setSize", "useState", "setOpen", "useControlledState", "setExpanded", "Dialog", "Root", "modal", "role", "data-block-align", "Content", "inOverlayLayout", "classNames", "onEscapeKeyDown", "onInteractOutside", "displayName", "CHAT_DIALOG_HEADER_NAME", "ChatDialogHeader", "title", "mx", "Close", "Icon", "icon", "Title", "onClick", "IconButton", "variant", "iconOnly", "label", "CHAT_DIALOG_CONTENT_NAME", "ChatDialogContent", "useEffect", "style", "sizeStyle", "maxBlockSize", "resizeAttributes", "ResizeHandle", "side", "iconPosition", "defaultSize", "fallbackSize", "minSize", "onSizeChange", "CHAT_DIALOG_FOOTER_NAME", "ChatDialogFooter", "ChatDialog", "Header", "Footer", "autocompletion", "completionKeymap", "RangeSet", "Decoration", "EditorView", "ViewPlugin", "WidgetType", "keymap", "Mutex", "invariant", "references", "provider", "triggerCharacter", "debug", "length", "decorationField", "fromClass", "ReferenceView", "_mutex", "decorations", "set", "view", "queueMicrotask", "guard", "acquire", "_computeDecorations", "release", "update", "docChanged", "text", "state", "doc", "toString", "matchAll", "RegExp", "match", "reference", "uri", "slice", "data", "resolveReference", "push", "replace", "widget", "ReferenceWidget", "range", "index", "v", "provide", "atomicRanges", "of", "plugin", "empty", "theme", "borderRadius", "borderWidth", "marginRight", "marginLeft", "tooltipClass", "activateOnTyping", "aboveCursor", "closeOnBlur", "override", "context", "matchBefore", "to", "from", "query", "getReferences", "filter", "options", "map", "label", "apply", "ignoreEvent", "eq", "other", "toDOM", "span", "document", "createElement", "textContent", "className", "React", "forwardRef", "useMemo", "useThemeContext", "Editor", "createBasicExtensions", "createThemeExtensions", "submit", "isTruthy", "useChatExtensions", "extensions", "lineWrapping", "placeholder", "onSubmit", "themeMode", "useThemeContext", "useMemo", "createThemeExtensions", "createBasicExtensions", "bracketMatching", "submit", "filter", "isTruthy", "ChatEditor", "forwardRef", "classNames", "autoFocus", "extensionsProp", "React", "Editor", "Root", "ref", "Content", "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 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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AAU;IAAMT,WAAWC,IAAG3B,UAAAA;KACjCoC,eAAehC,UAAU6B,UAAU,GAAA,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", "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":17552,"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":480,"imports":[{"path":"src/components/ChatDialog/ChatDialog.tsx","kind":"import-statement","original":"./ChatDialog"}],"format":"esm"},"src/components/ChatEditor/references.ts":{"bytes":16061,"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":5856,"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":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":1055,"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":21223},"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}],"exports":["ChatDialog","ChatEditor","references","translationKey","translations","useChatExtensions"],"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":3687},"src/components/ChatEditor/index.ts":{"bytesInOutput":0},"src/components/ChatEditor/ChatEditor.tsx":{"bytesInOutput":1210},"src/index.ts":{"bytesInOutput":0},"src/translations.ts":{"bytesInOutput":124}},"bytes":9800}}}
1
+ {"inputs":{"src/components/ChatDialog/ChatDialog.tsx":{"bytes":17382,"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":28817},"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":4368},"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":12685},"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,11 +7,27 @@ 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
33
  ({ children, open: openProp, expanded: expandedProp, onOpenChange, onExpandedChange, onEscape, }: ChatDialogRootProps): React.JSX.Element;
@@ -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,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C,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC,CAAC;gCAEqB,EACtB,QAAQ,EACR,IAAI,EAAE,QAAgB,EACtB,QAAQ,EAAE,YAAoB,EAC9B,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACT,EAAE,mBAAmB;;;;AA2CtB,KAAK,qBAAqB,GAAG,eAAe,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;kCAEuB,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,qBAAqB;;;;AAwCtE,KAAK,sBAAsB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;mCAEtC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,sBAAsB;;;;AAwC3E,KAAK,qBAAqB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;kCAEtC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,qBAAqB;;;;AAUzE,eAAO,MAAM,UAAU;IACrB,IAAI;0GA9IH,mBAAmB;;;IA+IpB,MAAM;gCAhGyC,qBAAqB;;;IAiGpE,OAAO;mCAvD4C,sBAAsB;;;IAwDzE,MAAM;mCAd4C,qBAAqB;;;CAexE,CAAC"}
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC8B,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 +1 @@
1
- {"version":3,"file":"ChatEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/ChatEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAU,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAInB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,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,GAAI,qDAA6D,eAAe,gBAY7G,CAAC;AAEF,eAAO,MAAM,UAAU;iBArBN,SAAS;iBACT,iBAAiB;;;8CA+BjC,CAAC"}
1
+ {"version":3,"file":"ChatEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/ChatEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAU,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAKnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,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"}
@@ -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;AAGF,eAAO,MAAM,eAAe,EAAE,KAuB7B,CAAC;AAkBF,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/references.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,mBAAmB,CAAC;AAe7D,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACtE,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,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,GAAI,uCAAqD,iBAAiB,KAAG,SAyGnG,CAAC"}
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/references.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,mBAAmB,CAAC;AAe7D,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACtE,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,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"}