@dxos/react-ui-chat 0.8.4-main.dedc0f3 → 0.8.4-main.e8ec1fe

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.
@@ -12,18 +12,18 @@ var Endcap = ({ children }) => {
12
12
  var _effect = _useSignals();
13
13
  try {
14
14
  return /* @__PURE__ */ React.createElement("div", {
15
- className: "grid w-[var(--rail-action)] h-[var(--rail-action)] items-center justify-center"
15
+ className: "grid is-[var(--rail-action)] bs-[var(--rail-action)] items-center justify-center"
16
16
  }, children);
17
17
  } finally {
18
18
  _effect.f();
19
19
  }
20
20
  };
21
21
  var [ChatDialogContextProvider, useChatDialogContext] = createContext("ChatDialog");
22
- var ChatDialogRoot = ({ children, open: _open = false, expanded: expandedParam = false, onOpenChange, onExpandedChange, onEscape }) => {
22
+ var ChatDialogRoot = ({ children, open: openParam = false, expanded: expandedParam = false, onOpenChange, onExpandedChange, onEscape }) => {
23
23
  var _effect = _useSignals();
24
24
  try {
25
25
  const [size, setSize] = useState("min-content");
26
- const [open, setOpen] = useControlledState(_open, onOpenChange);
26
+ const [open, setOpen] = useControlledState(openParam, onOpenChange);
27
27
  const [expanded, setExpanded] = useControlledState(expandedParam, onExpandedChange);
28
28
  return /* @__PURE__ */ React.createElement(ChatDialogContextProvider, {
29
29
  open,
@@ -63,7 +63,7 @@ var ChatDialogHeader = ({ classNames, title }) => {
63
63
  }, /* @__PURE__ */ React.createElement(Endcap, null, /* @__PURE__ */ React.createElement(Dialog.Close, null, /* @__PURE__ */ React.createElement(Icon, {
64
64
  icon: "ph--x--regular"
65
65
  }))), /* @__PURE__ */ React.createElement(Dialog.Title, {
66
- classNames: "flex w-full justify-center text-sm text-subdued select-none cursor-pointer",
66
+ classNames: "flex is-full justify-center text-sm text-subdued select-none cursor-pointer",
67
67
  onClick: () => setExpanded((expanded2) => !expanded2)
68
68
  }, title), /* @__PURE__ */ React.createElement(Endcap, null, /* @__PURE__ */ React.createElement(IconButton, {
69
69
  variant: "ghost",
@@ -88,7 +88,7 @@ var ChatDialogContent = ({ children, classNames }) => {
88
88
  expanded
89
89
  ]);
90
90
  return /* @__PURE__ */ React.createElement("div", {
91
- className: mx("flex flex-col overflow-y-auto border-t border-b border-subduedSeparator", 'transition-[block-size] ease-in-out duration-0 [&:not([data-dx-resizing="true"])]:duration-200', classNames),
91
+ className: mx("flex flex-col overflow-y-auto border-t border-be border-subduedSeparator", 'transition-[block-size] ease-in-out duration-0 [&:not([data-dx-resizing="true"])]:duration-200', classNames),
92
92
  style: {
93
93
  ...sizeStyle(size, "vertical", true),
94
94
  maxBlockSize: "calc(100dvh - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 14rem)"
@@ -131,24 +131,11 @@ import { RangeSet } from "@codemirror/state";
131
131
  import { Decoration, EditorView, ViewPlugin, WidgetType, keymap } from "@codemirror/view";
132
132
  import { Mutex } from "@dxos/async";
133
133
  import { invariant } from "@dxos/invariant";
134
- function _define_property(obj, key, value) {
135
- if (key in obj) {
136
- Object.defineProperty(obj, key, {
137
- value,
138
- enumerable: true,
139
- configurable: true,
140
- writable: true
141
- });
142
- } else {
143
- obj[key] = value;
144
- }
145
- return obj;
146
- }
147
134
  var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-chat/src/components/ChatEditor/references.ts";
148
135
  var references = ({ provider, triggerCharacter = "@", debug = false }) => {
149
136
  invariant(triggerCharacter.length === 1, void 0, {
150
137
  F: __dxlog_file,
151
- L: 50,
138
+ L: 56,
152
139
  S: void 0,
153
140
  A: [
154
141
  "triggerCharacter.length === 1",
@@ -156,6 +143,19 @@ var references = ({ provider, triggerCharacter = "@", debug = false }) => {
156
143
  ]
157
144
  });
158
145
  const decorationField = ViewPlugin.fromClass(class ReferenceView {
146
+ // TODO(burdon): Why?
147
+ _mutex = new Mutex();
148
+ decorations = Decoration.set([]);
149
+ constructor(view) {
150
+ queueMicrotask(async () => {
151
+ const guard = await this._mutex.acquire();
152
+ try {
153
+ this.decorations = await this._computeDecorations(view);
154
+ } finally {
155
+ guard.release();
156
+ }
157
+ });
158
+ }
159
159
  update(update) {
160
160
  if (update.docChanged) {
161
161
  queueMicrotask(async () => {
@@ -186,21 +186,9 @@ var references = ({ provider, triggerCharacter = "@", debug = false }) => {
186
186
  }
187
187
  return Decoration.set(decorations);
188
188
  }
189
- constructor(view) {
190
- _define_property(this, "_mutex", new Mutex());
191
- _define_property(this, "decorations", Decoration.set([]));
192
- queueMicrotask(async () => {
193
- const guard = await this._mutex.acquire();
194
- try {
195
- this.decorations = await this._computeDecorations(view);
196
- } finally {
197
- guard.release();
198
- }
199
- });
200
- }
201
189
  }, {
202
190
  decorations: (v) => v.decorations,
203
- provide: (plugin) => [
191
+ provide: () => [
204
192
  EditorView.atomicRanges.of((view) => view.plugin(decorationField)?.decorations ?? RangeSet.empty)
205
193
  ]
206
194
  });
@@ -244,91 +232,67 @@ var references = ({ provider, triggerCharacter = "@", debug = false }) => {
244
232
  ];
245
233
  };
246
234
  var ReferenceWidget = class extends WidgetType {
247
- toDOM() {
248
- const span = document.createElement("span");
249
- span.textContent = `@ ${this.data.label}`;
250
- span.className = "cm-reference-pill";
251
- return span;
252
- }
253
- eq(other) {
254
- return other.data.uri === this.data.uri;
235
+ data;
236
+ constructor(data) {
237
+ super(), this.data = data;
255
238
  }
256
239
  ignoreEvent() {
257
240
  return true;
258
241
  }
259
- constructor(data) {
260
- super(), _define_property(this, "data", void 0), this.data = data;
242
+ eq(other) {
243
+ return this.data.uri === other.data.uri;
244
+ }
245
+ toDOM() {
246
+ const span = document.createElement("span");
247
+ span.textContent = `@${this.data.label}`;
248
+ span.className = "cm-reference-pill";
249
+ return span;
261
250
  }
262
251
  };
263
252
 
264
253
  // src/components/ChatEditor/ChatEditor.tsx
265
254
  import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
266
- import React2, { forwardRef, useImperativeHandle } from "react";
255
+ import React2, { forwardRef, useMemo } from "react";
267
256
  import { useThemeContext } from "@dxos/react-ui";
268
- import { autocomplete, createBasicExtensions, createThemeExtensions, useTextEditor } from "@dxos/react-ui-editor";
269
- import { mx as mx2 } from "@dxos/react-ui-theme";
270
- import { isNonNullable } from "@dxos/util";
271
- var ChatEditor = /* @__PURE__ */ forwardRef(({ classNames, extensions, references: references2, autoFocus, lineWrapping = false, placeholder, onSubmit, onSuggest, onCancel }, forwardRef2) => {
257
+ import { Editor, createBasicExtensions, createThemeExtensions, submit } from "@dxos/react-ui-editor";
258
+ import { isTruthy } from "@dxos/util";
259
+ var useChatExtensions = ({ extensions, lineWrapping = false, placeholder, onSubmit }) => {
260
+ const { themeMode } = useThemeContext();
261
+ return useMemo(() => [
262
+ createThemeExtensions({
263
+ themeMode
264
+ }),
265
+ createBasicExtensions({
266
+ bracketMatching: false,
267
+ lineWrapping,
268
+ placeholder
269
+ }),
270
+ submit({
271
+ onSubmit
272
+ }),
273
+ extensions
274
+ ].filter(isTruthy), [
275
+ themeMode,
276
+ extensions,
277
+ onSubmit
278
+ ]);
279
+ };
280
+ var ChatEditor = /* @__PURE__ */ forwardRef(({ classNames, autoFocus, extensions: extensionsParam, lineWrapping = false, placeholder, onSubmit }, forwardRef2) => {
272
281
  var _effect = _useSignals2();
273
282
  try {
274
- const { themeMode } = useThemeContext();
275
- const { parentRef, view } = useTextEditor(() => ({
276
- debug: true,
277
- autoFocus,
278
- extensions: [
279
- createThemeExtensions({
280
- themeMode
281
- }),
282
- autocomplete({
283
- onSubmit,
284
- onSuggest,
285
- onCancel
286
- }),
287
- references2 ? references({
288
- provider: references2.provider
289
- }) : [],
290
- createBasicExtensions({
291
- bracketMatching: false,
292
- lineWrapping,
293
- placeholder
294
- }),
295
- extensions
296
- ].filter(isNonNullable)
297
- }), [
298
- themeMode,
299
- extensions,
300
- onSubmit,
301
- onSuggest,
302
- onCancel
303
- ]);
304
- useImperativeHandle(forwardRef2, () => {
305
- return {
306
- focus: () => {
307
- view?.focus();
308
- },
309
- getText: () => view?.state.doc.toString() ?? "",
310
- setText: (text) => {
311
- view?.dispatch({
312
- changes: {
313
- from: 0,
314
- to: view.state.doc.length,
315
- insert: text
316
- },
317
- selection: {
318
- anchor: text.length,
319
- head: text.length
320
- }
321
- });
322
- }
323
- };
324
- }, [
325
- view,
283
+ const extensions = useChatExtensions({
284
+ extensions: extensionsParam,
285
+ lineWrapping,
286
+ placeholder,
326
287
  onSubmit
327
- ]);
328
- return /* @__PURE__ */ React2.createElement("div", {
329
- ref: parentRef,
330
- className: mx2("is-full", classNames)
331
288
  });
289
+ return /* @__PURE__ */ React2.createElement(Editor.Root, {
290
+ ref: forwardRef2
291
+ }, /* @__PURE__ */ React2.createElement(Editor.Content, {
292
+ classNames,
293
+ autoFocus,
294
+ extensions
295
+ }));
332
296
  } finally {
333
297
  _effect.f();
334
298
  }
@@ -348,6 +312,7 @@ export {
348
312
  ChatEditor,
349
313
  references,
350
314
  translationKey,
351
- translations
315
+ translations,
316
+ useChatExtensions
352
317
  };
353
318
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 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 { isNonNullable } 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\n const { parentRef, view } = useTextEditor(\n () => ({\n debug: true,\n autoFocus,\n extensions: [\n createThemeExtensions({ themeMode }),\n autocomplete({ onSubmit, onSuggest, onCancel }),\n references ? referencesExtension({ provider: references.provider }) : [],\n createBasicExtensions({\n bracketMatching: false,\n lineWrapping,\n placeholder,\n }),\n extensions,\n ].filter(isNonNullable),\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,YAAAA;AAC3D,UAAM,CAACF,UAAUU,WAAAA,IAAeD,mBAA4BR,eAAeE,gBAAAA;AAI3E,WACE,sBAAA,cAACT,2BAAAA;MACCI;MACAU;MACAR;MACAU;MACAL;MACAC;OAEA,sBAAA,cAACK,OAAOC,MAAI;MAACC,OAAO;MAAOf;MAAYI,cAAcM;OACnD,sBAAA,cAAChB,OAAAA;MAAIsB,MAAK;MAAOrB,WAAU;MAAwDsB,oBAAiB;OAClG,sBAAA,cAACJ,OAAOK,SAAO;MACbC,iBAAAA;MACAC,YAAY;QACV;QACA;;MAEFC,iBAAiBf;MACjBgB,mBAAmBhC;OAElBG,QAAAA,CAAAA,CAAAA,CAAAA;;;;AAMb;AAEAM,eAAewB,cAAc;AAU7B,IAAMC,mBAAmB,CAAC,EAAEJ,YAAYK,MAAK,MAAyB;;;AACpE,UAAM,EAAEvB,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,MAAA;AAC9B,aAAO;QACLyB,OAAO,MAAA;AACLZ,gBAAMY,MAAAA;QACR;QACAC,SAAS,MAAMb,MAAMc,MAAMC,IAAIC,SAAAA,KAAc;QAC7CC,SAAS,CAACC,SAAAA;AACRlB,gBAAMmB,SAAS;YACbC,SAAS;cACPC,MAAM;cACNC,IAAItB,KAAKc,MAAMC,IAAIQ;cACnBC,QAAQN;YACV;YACAO,WAAW;cACTC,QAAQR,KAAKK;cACbI,MAAMT,KAAKK;YACb;UACF,CAAA;QACF;MACF;IACF,GAAG;MAACvB;MAAMN;KAAS;AAEnB,WAAO,gBAAAkC,OAAA,cAACC,OAAAA;MAAIC,KAAK/B;MAAWgC,WAAWC,IAAG,WAAW5C,UAAAA;;;;;AACvD,CAAA;;;ACjFK,IAAM6C,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", "React", "forwardRef", "useImperativeHandle", "useThemeContext", "autocomplete", "createBasicExtensions", "createThemeExtensions", "useTextEditor", "mx", "isNonNullable", "ChatEditor", "forwardRef", "classNames", "extensions", "references", "autoFocus", "lineWrapping", "placeholder", "onSubmit", "onSuggest", "onCancel", "themeMode", "useThemeContext", "parentRef", "view", "useTextEditor", "debug", "createThemeExtensions", "autocomplete", "referencesExtension", "provider", "createBasicExtensions", "bracketMatching", "filter", "isNonNullable", "useImperativeHandle", "focus", "getText", "state", "doc", "toString", "setText", "text", "dispatch", "changes", "from", "to", "length", "insert", "selection", "anchor", "head", "React", "div", "ref", "className", "mx", "translationKey", "translations"]
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 is-[var(--rail-action)] bs-[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: openParam = 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>(openParam, 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 is-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-be 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; // 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',\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 {\n type BasicExtensionsOptions,\n Editor,\n type EditorController,\n type SubmitOptions,\n type UseTextEditorProps,\n createBasicExtensions,\n createThemeExtensions,\n submit,\n} from '@dxos/react-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: extensionsParam, lineWrapping = false, placeholder, onSubmit }, forwardRef) => {\n const extensions = useChatExtensions({ extensions: extensionsParam, 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 = '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,SA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icon", "IconButton", "useControlledState", "ResizeHandle", "resizeAttributes", "sizeStyle", "mx", "preventDefault", "event", "Endcap", "children", "div", "className", "ChatDialogContextProvider", "useChatDialogContext", "createContext", "ChatDialogRoot", "open", "openParam", "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", "_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", "extensionsParam", "React", "Editor", "Root", "ref", "Content", "translationKey", "translations"]
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":8814,"imports":[{"path":"@preact-signals/safe-react/tracking","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":22284},"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":"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":2035},"src/index.ts":{"bytesInOutput":0},"src/translations.ts":{"bytesInOutput":118}},"bytes":11398}}}
1
+ {"inputs":{"src/components/ChatDialog/ChatDialog.tsx":{"bytes":17794,"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":16054,"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":5998,"imports":[{"path":"@preact-signals/safe-react/tracking","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/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":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":20951},"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":"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/util","kind":"import-statement","external":true}],"exports":["ChatDialog","ChatEditor","references","translationKey","translations","useChatExtensions"],"entryPoint":"src/index.ts","inputs":{"src/components/ChatDialog/ChatDialog.tsx":{"bytesInOutput":4886},"src/components/ChatDialog/index.ts":{"bytesInOutput":0},"src/components/index.ts":{"bytesInOutput":0},"src/components/ChatEditor/references.ts":{"bytesInOutput":3684},"src/components/ChatEditor/index.ts":{"bytesInOutput":0},"src/components/ChatEditor/ChatEditor.tsx":{"bytesInOutput":1361},"src/index.ts":{"bytesInOutput":0},"src/translations.ts":{"bytesInOutput":118}},"bytes":10442}}}
@@ -14,7 +14,7 @@ type ChatDialogContentProps = ThemedClassName<PropsWithChildren>;
14
14
  type ChatDialogFooterProps = ThemedClassName<PropsWithChildren>;
15
15
  export declare const ChatDialog: {
16
16
  Root: {
17
- ({ children, open: _open, expanded: expandedParam, onOpenChange, onExpandedChange, onEscape, }: ChatDialogRootProps): React.JSX.Element;
17
+ ({ children, open: openParam, expanded: expandedParam, onOpenChange, onExpandedChange, onEscape, }: ChatDialogRootProps): React.JSX.Element;
18
18
  displayName: string;
19
19
  };
20
20
  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,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;;4GArIpB,mBAAmB;;;;gCA6C2B,qBAAqB;;;;mCAsCjB,sBAAsB;;;;mCAwCvB,qBAAqB;;;CAexE,CAAC"}
@@ -1,10 +1,9 @@
1
- import '@dxos-theme';
2
1
  import { type StoryObj } from '@storybook/react-vite';
3
2
  import React from 'react';
4
3
  declare const meta: {
5
4
  title: string;
6
5
  component: {
7
- ({ children, open: _open, expanded: expandedParam, onOpenChange, onExpandedChange, onEscape, }: {
6
+ ({ children, open: openParam, expanded: expandedParam, onOpenChange, onExpandedChange, onEscape, }: {
8
7
  open?: boolean;
9
8
  expanded?: boolean;
10
9
  onOpenChange?: (open: boolean) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatDialog.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatDialog/ChatDialog.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,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;AAEzC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -1,21 +1,19 @@
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 BasicExtensionsOptions, type EditorController, type SubmitOptions, type UseTextEditorProps } from '@dxos/react-ui-editor';
5
5
  import { type ReferencesOptions } from './references';
6
- export interface ChatEditorController {
7
- focus(): void;
8
- getText(): string;
9
- setText(text: string): void;
6
+ export interface ChatEditorController extends EditorController {
10
7
  }
11
8
  export type ChatEditorProps = ThemedClassName<{
12
9
  extensions?: Extension;
13
10
  references?: ReferencesOptions;
14
- } & AutocompleteOptions & Pick<UseTextEditorProps, 'id' | 'autoFocus'> & Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>>;
11
+ } & (SubmitOptions & Pick<UseTextEditorProps, 'id' | 'autoFocus'> & Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>)>;
12
+ export declare const useChatExtensions: ({ extensions, lineWrapping, placeholder, onSubmit }: ChatEditorProps) => Extension[];
15
13
  export declare const ChatEditor: React.ForwardRefExoticComponent<Omit<{
16
14
  extensions?: Extension;
17
15
  references?: ReferencesOptions;
18
- } & AutocompleteOptions & Pick<UseTextEditorProps, "autoFocus" | "id"> & Pick<BasicExtensionsOptions, "lineWrapping" | "placeholder">, "className"> & {
16
+ } & SubmitOptions & Pick<UseTextEditorProps, "autoFocus" | "id"> & Pick<BasicExtensionsOptions, "lineWrapping" | "placeholder">, "className"> & {
19
17
  classNames?: import("@dxos/react-ui-types").ClassNameValue;
20
18
  } & React.RefAttributes<ChatEditorController>>;
21
19
  //# 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,mBAAmB,CAAC;AACnD,OAAO,KAA0C,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EAKxB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,KAAK,iBAAiB,EAAqC,MAAM,cAAc,CAAC;AAEzF,MAAM,WAAW,oBAAoB;IACnC,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,IAAI,MAAM,CAAC;IAClB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,CAC3C;IACE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC,GAAG,mBAAmB,GACrB,IAAI,CAAC,kBAAkB,EAAE,IAAI,GAAG,WAAW,CAAC,GAC5C,IAAI,CAAC,sBAAsB,EAAE,cAAc,GAAG,aAAa,CAAC,CAC/D,CAAC;AAEF,eAAO,MAAM,UAAU;iBAPN,SAAS;iBACT,iBAAiB;;;8CAyDjC,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,EACL,KAAK,sBAAsB,EAE3B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAIxB,MAAM,uBAAuB,CAAC;AAG/B,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,11 +1,10 @@
1
- import '@dxos-theme';
2
1
  import { type StoryObj } from '@storybook/react-vite';
3
2
  declare const meta: {
4
3
  title: string;
5
4
  component: import("react").ForwardRefExoticComponent<Omit<{
6
5
  extensions?: import("@codemirror/state").Extension;
7
6
  references?: import("./references").ReferencesOptions;
8
- } & 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"> & {
7
+ } & import("@dxos/react-ui-editor").SubmitOptions & Pick<import("@dxos/react-ui-editor").UseTextEditorProps, "autoFocus" | "id"> & Pick<import("@dxos/react-ui-editor").BasicExtensionsOptions, "lineWrapping" | "placeholder">, "className"> & {
9
8
  classNames?: import("@dxos/react-ui-types").ClassNameValue;
10
9
  } & import("react").RefAttributes<import("./ChatEditor").ChatEditorController>>;
11
10
  decorators: import("@storybook/react").Decorator[];
@@ -1 +1 @@
1
- {"version":3,"file":"ChatEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatEditor/ChatEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,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;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"}
@@ -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,SAAS,EAAY,MAAM,mBAAmB,CAAC;AAe7D,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,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;;GAEG;AACH,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,EA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