@arbidocs/blocks 0.4.9 → 0.4.10

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 (73) hide show
  1. package/README.md +9 -0
  2. package/dist/StreamedArtifactEditor-5BMNWSS4.cjs +106 -0
  3. package/dist/StreamedArtifactEditor-5BMNWSS4.cjs.map +1 -0
  4. package/dist/StreamedArtifactEditor-6ETUHNQN.js +104 -0
  5. package/dist/StreamedArtifactEditor-6ETUHNQN.js.map +1 -0
  6. package/dist/agents/index.cjs +163 -163
  7. package/dist/agents/index.js +6 -6
  8. package/dist/artifacts/ArtifactEditor.d.ts +24 -1
  9. package/dist/artifacts/ArtifactToolbar.d.ts +3 -1
  10. package/dist/artifacts/StreamedArtifactFrame.d.ts +36 -0
  11. package/dist/artifacts/editor/index.cjs +11 -82
  12. package/dist/artifacts/editor/index.cjs.map +1 -1
  13. package/dist/artifacts/editor/index.js +2 -83
  14. package/dist/artifacts/editor/index.js.map +1 -1
  15. package/dist/artifacts/index.cjs +92 -800
  16. package/dist/artifacts/index.cjs.map +1 -1
  17. package/dist/artifacts/index.d.ts +2 -1
  18. package/dist/artifacts/index.js +3 -784
  19. package/dist/artifacts/index.js.map +1 -1
  20. package/dist/chat/index.cjs +65 -65
  21. package/dist/chat/index.js +3 -3
  22. package/dist/{chunk-JLOYWXRB.js → chunk-557EU3G4.js} +3 -3
  23. package/dist/{chunk-JLOYWXRB.js.map → chunk-557EU3G4.js.map} +1 -1
  24. package/dist/{chunk-5LUI4G5R.js → chunk-BV7FEMSI.js} +3 -3
  25. package/dist/{chunk-5LUI4G5R.js.map → chunk-BV7FEMSI.js.map} +1 -1
  26. package/dist/{chunk-CVFBSUXL.js → chunk-D5BZVKIF.js} +6 -6
  27. package/dist/{chunk-CVFBSUXL.js.map → chunk-D5BZVKIF.js.map} +1 -1
  28. package/dist/{chunk-YVIOCITQ.cjs → chunk-DCEI37AX.cjs} +3 -3
  29. package/dist/{chunk-YVIOCITQ.cjs.map → chunk-DCEI37AX.cjs.map} +1 -1
  30. package/dist/chunk-DTLOXXPN.js +831 -0
  31. package/dist/chunk-DTLOXXPN.js.map +1 -0
  32. package/dist/chunk-HSFGOA6V.js +86 -0
  33. package/dist/chunk-HSFGOA6V.js.map +1 -0
  34. package/dist/{chunk-IMA6I73C.js → chunk-ILOYJE63.js} +3 -3
  35. package/dist/{chunk-IMA6I73C.js.map → chunk-ILOYJE63.js.map} +1 -1
  36. package/dist/chunk-LOJVUGBJ.js +67 -0
  37. package/dist/chunk-LOJVUGBJ.js.map +1 -0
  38. package/dist/chunk-PVK3GAMH.cjs +852 -0
  39. package/dist/chunk-PVK3GAMH.cjs.map +1 -0
  40. package/dist/chunk-QVBZESYQ.cjs +70 -0
  41. package/dist/chunk-QVBZESYQ.cjs.map +1 -0
  42. package/dist/{chunk-67HGXV4I.cjs → chunk-RMIACB7N.cjs} +6 -6
  43. package/dist/{chunk-67HGXV4I.cjs.map → chunk-RMIACB7N.cjs.map} +1 -1
  44. package/dist/chunk-RUNQFXPH.cjs +89 -0
  45. package/dist/chunk-RUNQFXPH.cjs.map +1 -0
  46. package/dist/{chunk-TO4FAMQP.cjs → chunk-XKSFJYOD.cjs} +3 -3
  47. package/dist/{chunk-TO4FAMQP.cjs.map → chunk-XKSFJYOD.cjs.map} +1 -1
  48. package/dist/{chunk-22T6KHGB.cjs → chunk-YWSWRTGH.cjs} +4 -4
  49. package/dist/{chunk-22T6KHGB.cjs.map → chunk-YWSWRTGH.cjs.map} +1 -1
  50. package/dist/connect/index.cjs +97 -23
  51. package/dist/connect/index.cjs.map +1 -1
  52. package/dist/connect/index.d.ts +1 -0
  53. package/dist/connect/index.js +79 -6
  54. package/dist/connect/index.js.map +1 -1
  55. package/dist/connection/StreamedArtifact.d.ts +43 -0
  56. package/dist/connection/StreamedArtifactEditor.d.ts +31 -0
  57. package/dist/facts/index.cjs +1 -1
  58. package/dist/facts/index.js +1 -1
  59. package/dist/files/index.cjs +5 -5
  60. package/dist/files/index.js +7 -7
  61. package/dist/index.cjs +550 -550
  62. package/dist/index.js +17 -17
  63. package/dist/settings/index.cjs +32 -32
  64. package/dist/settings/index.js +3 -3
  65. package/dist/shell/index.cjs +33 -33
  66. package/dist/shell/index.js +3 -3
  67. package/dist/site/index.cjs +14 -14
  68. package/dist/site/index.js +2 -2
  69. package/dist/studio/index.cjs +3 -3
  70. package/dist/studio/index.js +3 -3
  71. package/dist/workspaces/index.cjs +2 -2
  72. package/dist/workspaces/index.js +2 -2
  73. package/package.json +3 -3
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
5
+ var react = require('react');
6
+ var editor = require('@mdxeditor/editor');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function DictationSlot({
10
+ render
11
+ }) {
12
+ const insertMarkdown = editor.usePublisher(editor.insertMarkdown$);
13
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: render(insertMarkdown) });
14
+ }
15
+ var DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS = {
16
+ editor: "Document editor",
17
+ placeholder: "Start typing\u2026"
18
+ };
19
+ function ArtifactMarkdownEditor({
20
+ markdown,
21
+ onChange,
22
+ onNormalized,
23
+ dictation,
24
+ labels,
25
+ testId
26
+ }) {
27
+ const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels };
28
+ const ref = react.useRef(null);
29
+ const pendingNormalizationRef = react.useRef(true);
30
+ return /* @__PURE__ */ jsxRuntime.jsx(
31
+ "div",
32
+ {
33
+ role: "group",
34
+ "aria-label": l.editor,
35
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "artifact-markdown-editor" }),
36
+ className: "h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11",
37
+ children: /* @__PURE__ */ jsxRuntime.jsx(
38
+ editor.MDXEditor,
39
+ {
40
+ ref,
41
+ markdown,
42
+ onChange: (next) => {
43
+ if (pendingNormalizationRef.current) {
44
+ pendingNormalizationRef.current = false;
45
+ onNormalized?.(next);
46
+ }
47
+ onChange(next);
48
+ },
49
+ contentEditableClassName: "markdown-content max-w-none px-6 py-4 outline-none min-h-full",
50
+ className: "h-full overflow-auto bg-background",
51
+ placeholder: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: l.placeholder }),
52
+ plugins: [
53
+ editor.headingsPlugin(),
54
+ editor.listsPlugin(),
55
+ editor.quotePlugin(),
56
+ editor.thematicBreakPlugin(),
57
+ editor.linkPlugin(),
58
+ editor.linkDialogPlugin(),
59
+ editor.tablePlugin(),
60
+ editor.markdownShortcutPlugin(),
61
+ editor.toolbarPlugin({
62
+ toolbarContents: () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
63
+ /* @__PURE__ */ jsxRuntime.jsx(editor.UndoRedo, {}),
64
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
65
+ /* @__PURE__ */ jsxRuntime.jsx(editor.BoldItalicUnderlineToggles, {}),
66
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
67
+ /* @__PURE__ */ jsxRuntime.jsx(editor.BlockTypeSelect, {}),
68
+ /* @__PURE__ */ jsxRuntime.jsx(editor.ListsToggle, {}),
69
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
70
+ /* @__PURE__ */ jsxRuntime.jsx(editor.CreateLink, {}),
71
+ /* @__PURE__ */ jsxRuntime.jsx(editor.InsertTable, {}),
72
+ /* @__PURE__ */ jsxRuntime.jsx(editor.InsertThematicBreak, {}),
73
+ dictation && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
74
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
75
+ /* @__PURE__ */ jsxRuntime.jsx(DictationSlot, { render: dictation })
76
+ ] })
77
+ ] })
78
+ })
79
+ ]
80
+ }
81
+ )
82
+ }
83
+ );
84
+ }
85
+
86
+ exports.ArtifactMarkdownEditor = ArtifactMarkdownEditor;
87
+ exports.DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS = DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS;
88
+ //# sourceMappingURL=chunk-RUNQFXPH.cjs.map
89
+ //# sourceMappingURL=chunk-RUNQFXPH.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/artifacts/editor/ArtifactMarkdownEditor.tsx"],"names":["usePublisher","insertMarkdown$","jsx","Fragment","useRef","testIdOr","MDXEditor","headingsPlugin","listsPlugin","quotePlugin","thematicBreakPlugin","linkPlugin","linkDialogPlugin","tablePlugin","markdownShortcutPlugin","toolbarPlugin","jsxs","UndoRedo","Separator","BoldItalicUnderlineToggles","BlockTypeSelect","ListsToggle","CreateLink","InsertTable","InsertThematicBreak"],"mappings":";;;;;;;AA2BA,SAAS,aAAA,CAAc;AAAA,EACrB;AACF,CAAA,EAEuB;AACrB,EAAA,MAAM,cAAA,GAAiBA,oBAAaC,sBAAe,CAAA;AACnD,EAAA,uBAAOC,cAAA,CAAAC,mBAAA,EAAA,EAAG,QAAA,EAAA,MAAA,CAAO,cAAc,CAAA,EAAE,CAAA;AACnC;AAQO,IAAM,uCAAA,GAAwE;AAAA,EACnF,MAAA,EAAQ,iBAAA;AAAA,EACR,WAAA,EAAa;AACf;AAkCO,SAAS,sBAAA,CAAuB;AAAA,EACrC,QAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAoD;AAClD,EAAA,MAAM,CAAA,GAAI,EAAE,GAAG,uCAAA,EAAyC,GAAG,MAAA,EAAO;AAClE,EAAA,MAAM,GAAA,GAAMC,aAAyB,IAAI,CAAA;AAGzC,EAAA,MAAM,uBAAA,GAA0BA,aAAO,IAAI,C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CACVE,sBAAA,EAAA,EAAgB,CAAA;AAAA,+CAChBC,kBAAA,EAAA,EAAY,CAAA;AAAA,+CACZH,gBAAA,EAAA,EAAU,CAAA;AAAA,+CACVI,iBAAA,EAAA,EAAW,CAAA;AAAA,+CACXC,kBAAA,EAAA,EAAY,CAAA;AAAA,+CACZC,0BAAA,EAAA,EAAoB,CAAA;AAAA,gBACpB,6BACCR,eAAA,CAAAb,mBAAA,EAAA,EACE,QAAA,EAAA;AAAA,kCAAAD,cAAA,CAACgB,gBAAA,EAAA,EAAU,CAAA;AAAA,kCACXhB,cAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAQ,SAAA,EAAW;AAAA,iBAAA,EACpC;AAAA,eAAA,EAEJ;AAAA,aAEH;AAAA;AACH;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-RUNQFXPH.cjs","sourcesContent":["import { useRef, type ReactNode } from 'react'\nimport {\n MDXEditor,\n type MDXEditorMethods,\n headingsPlugin,\n listsPlugin,\n quotePlugin,\n thematicBreakPlugin,\n linkPlugin,\n linkDialogPlugin,\n tablePlugin,\n markdownShortcutPlugin,\n toolbarPlugin,\n UndoRedo,\n BoldItalicUnderlineToggles,\n BlockTypeSelect,\n ListsToggle,\n CreateLink,\n InsertTable,\n InsertThematicBreak,\n Separator,\n insertMarkdown$,\n usePublisher,\n} from '@mdxeditor/editor'\nimport { testIdOr } from '../../chat/test-id'\n\n/** Renders the host's dictation control; `insert` puts text at the cursor. */\nfunction DictationSlot({\n render,\n}: {\n render: (insert: (markdown: string) => void) => ReactNode\n}): React.ReactElement {\n const insertMarkdown = usePublisher(insertMarkdown$)\n return <>{render(insertMarkdown)}</>\n}\n\nexport interface ArtifactMarkdownEditorLabels {\n /** The accessible name of the editor region. */\n editor: string\n placeholder: string\n}\n\nexport const DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS: ArtifactMarkdownEditorLabels = {\n editor: 'Document editor',\n placeholder: 'Start typing…',\n}\n\nexport interface ArtifactMarkdownEditorProps {\n /** Current markdown (controlled by the parent). */\n markdown: string\n /** Called with the new markdown whenever the document changes. */\n onChange: (markdown: string) => void\n /**\n * Fired exactly once per editor instance, with the markdown the editor produces on mount.\n * MDXEditor canonicalises the source as it parses (table padding, escapes, thematic-break\n * style), so the first `onChange` after mount is the round-tripped form of the input, not a\n * user edit. Use it to adopt the normalised form as the baseline so entering edit mode does\n * not look dirty. Remount via `key` to receive it for the next document.\n */\n onNormalized?: (normalized: string) => void\n /**\n * A dictation control for the toolbar (the host owns recording and transcription, for example\n * `@arbidocs/react`'s `InlineMicButton`). It gets a function that inserts text at the cursor.\n */\n dictation?: (insert: (markdown: string) => void) => ReactNode\n labels?: Partial<ArtifactMarkdownEditorLabels>\n testId?: string\n}\n\n/**\n * WYSIWYG editor for artifact documents: the user edits the rendered document directly and the\n * editor round-trips Markdown, so `onChange` always yields markdown a save can persist unchanged.\n *\n *\n * Heavy (Lexical via MDXEditor): mount it behind a lazy boundary. The host imports\n * `@mdxeditor/editor/style.css` once and, from the module that lazily imports this one, a module\n * that defines the global `Prism` FIRST (assign the prismjs core to `globalThis.Prism`):\n * `@lexical/code` reads it while it evaluates, and a library cannot order that in every bundler.\n */\nexport function ArtifactMarkdownEditor({\n markdown,\n onChange,\n onNormalized,\n dictation,\n labels,\n testId,\n}: ArtifactMarkdownEditorProps): React.ReactElement {\n const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels }\n const ref = useRef<MDXEditorMethods>(null)\n // Latched until MDXEditor fires its first onChange after mount: that is the canonicalisation\n // round-trip, not a user edit.\n const pendingNormalizationRef = useRef(true)\n\n return (\n <div\n role=\"group\"\n aria-label={l.editor}\n data-testid={testIdOr(testId, { testId: 'artifact-markdown-editor' })}\n className=\"h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11\"\n >\n <MDXEditor\n ref={ref}\n markdown={markdown}\n onChange={(next) => {\n if (pendingNormalizationRef.current) {\n pendingNormalizationRef.current = false\n onNormalized?.(next)\n }\n onChange(next)\n }}\n contentEditableClassName=\"markdown-content max-w-none px-6 py-4 outline-none min-h-full\"\n className=\"h-full overflow-auto bg-background\"\n placeholder={<span className=\"text-muted-foreground\">{l.placeholder}</span>}\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n thematicBreakPlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n markdownShortcutPlugin(),\n toolbarPlugin({\n toolbarContents: () => (\n <>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <Separator />\n <BlockTypeSelect />\n <ListsToggle />\n <Separator />\n <CreateLink />\n <InsertTable />\n <InsertThematicBreak />\n {dictation && (\n <>\n <Separator />\n <DictationSlot render={dictation} />\n </>\n )}\n </>\n ),\n }),\n ]}\n />\n </div>\n )\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkFX3K6LNZ_cjs = require('./chunk-FX3K6LNZ.cjs');
5
4
  var chunkVGOFFCMT_cjs = require('./chunk-VGOFFCMT.cjs');
5
+ var chunkFX3K6LNZ_cjs = require('./chunk-FX3K6LNZ.cjs');
6
6
  var react = require('react');
7
7
  var shell = require('@arbidocs/react/shell');
8
8
  var jsxRuntime = require('react/jsx-runtime');
@@ -33,5 +33,5 @@ function Toaster({
33
33
 
34
34
  exports.DEFAULT_DOCK_WIDTH = DEFAULT_DOCK_WIDTH;
35
35
  exports.Toaster = Toaster;
36
- //# sourceMappingURL=chunk-TO4FAMQP.cjs.map
37
- //# sourceMappingURL=chunk-TO4FAMQP.cjs.map
36
+ //# sourceMappingURL=chunk-XKSFJYOD.cjs.map
37
+ //# sourceMappingURL=chunk-XKSFJYOD.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shell/Toaster.tsx"],"names":["useIsPhone","useMemo","SHELL_BOTTOM_INSET_VAR","KitToaster"],"mappings":";;;;;;;;AAMO,I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EAAK,QAAA,EAAU,YAAA,EAAc,SAAS,CAAC,CAAA;AAE3C,EAAA,sCAAQC,aAAA,EAAA,EAAW,QAAA,EAAoB,QAAgB,YAAA,EAAc,MAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC1F","file":"chunk-TO4FAMQP.cjs","sourcesContent":["import { useMemo } from 'react'\nimport { Toaster as KitToaster, type ToasterProps } from '@arbidocs/react/shell'\nimport { SHELL_BOTTOM_INSET_VAR } from '../lib/bottom-inset'\nimport { useIsPhone } from '../lib/use-media-query'\n\n/** The assistant dock's default width, in CSS px (`AssistantDock`'s `width` default). */\nexport const DEFAULT_DOCK_WIDTH = 380\n\nexport interface ShellToasterProps extends Omit<ToasterProps, 'offset' | 'mobileOffset'> {\n /**\n * A right-hand dock (the assistant chat) is open beside the content. A right-aligned stack then\n * slides left by `dockWidth` so it never sits on the dock. On a phone the dock is a full-screen\n * modal, so no shift applies. `AssistantToaster` from `@arbidocs/blocks/chat` wires this for you.\n */\n dockOpen?: boolean\n /** Width of the open dock: a number is px, a string any CSS length. Default 380. */\n dockWidth?: number | string\n /** Gap kept to the screen edges, any CSS length. Default `1rem` (`0.75rem` on a phone). */\n edgeGap?: string\n}\n\nconst asLength = (v: number | string) => (typeof v === 'number' ? `${v}px` : v)\n\n/**\n * The shell's toast stack: the shared sonner `Toaster` placed so it never covers shell chrome.\n * Default position is bottom-right. It keeps clear of:\n *\n * - pinned bottom bars (the phone tab bar, the chat composer), through `--shell-bottom-inset`\n * that `useShellBottomInset` publishes; a bottom stack sits `edgeGap` above it;\n * - the device's home indicator and notch (`env(safe-area-inset-*)`);\n * - an open right-hand dock (`dockOpen` + `dockWidth`).\n *\n * Mount it once near the app root. Every other sonner prop (`theme`, `closeButton`,\n * `toastOptions`, ...) passes through; fire toasts with `notify.*` / `toast` from `@arbidocs/react`.\n */\nexport function Toaster({\n position = 'bottom-right',\n dockOpen = false,\n dockWidth = DEFAULT_DOCK_WIDTH,\n edgeGap,\n ...props\n}: ShellToasterProps) {\n const isPhone = useIsPhone()\n const gap = edgeGap ?? (isPhone ? '0.75rem' : '1rem')\n const isBottom = position.startsWith('bottom')\n const isRight = position.endsWith('right')\n const shiftForDock = dockOpen && isRight && !isPhone\n\n const offset = useMemo(() => {\n const inset = `calc(max(var(${SHELL_BOTTOM_INSET_VAR}, 0px), env(safe-area-inset-bottom, 0px)) + ${gap})`\n const top = `calc(env(safe-area-inset-top, 0px) + ${gap})`\n const right = shiftForDock\n ? `calc(${asLength(dockWidth)} + ${gap})`\n : `calc(env(safe-area-inset-right, 0px) + ${gap})`\n const left = `calc(env(safe-area-inset-left, 0px) + ${gap})`\n return isBottom ? { bottom: inset, right, left } : { top, right, left }\n }, [gap, isBottom, shiftForDock, dockWidth])\n\n return <KitToaster position={position} offset={offset} mobileOffset={offset} {...props} />\n}\n"]}
1
+ {"version":3,"sources":["../src/shell/Toaster.tsx"],"names":["useIsPhone","useMemo","SHELL_BOTTOM_INSET_VAR","KitToaster"],"mappings":";;;;;;;;AAMO,IAAM,kBAAA,GAAqB;AAelC,IAAM,QAAA,GAAW,CAAC,CAAA,KAAwB,OAAO,MAAM,QAAA,GAAW,CAAA,EAAG,CAAC,CAAA,EAAA,CAAA,GAAO,CAAA;AActE,SAAS,OAAA,CAAQ;AAAA,EACtB,QAAA,GAAW,cAAA;AAAA,EACX,QAAA,GAAW,KAAA;AAAA,EACX,SAAA,GAAY,kBAAA;AAAA,EACZ,OAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAsB;AACpB,EAAA,MAAM,UAAUA,4BAAA,EAAW;AAC3B,EAAA,MAAM,GAAA,GAAM,OAAA,KAAY,OAAA,GAAU,SAAA,GAAY,MAAA,CAAA;AAC9C,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,UAAA,CAAW,QAAQ,CAAA;AAC7C,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,QAAA,CAAS,OAAO,CAAA;AACzC,EAAA,MAAM,YAAA,GAAe,QAAA,IAAY,OAAA,IAAW,CAAC,OAAA;AAE7C,EAAA,MAAM,MAAA,GAASC,cAAQ,MAAM;AAC3B,IAAA,MAAM,KAAA,GAAQ,CAAA,aAAA,EAAgBC,wCAAsB,CAAA,4CAAA,EAA+C,GAAG,CAAA,CAAA,CAAA;AACtG,IAAA,MAAM,GAAA,GAAM,wCAAwC,GAAG,CAAA,CAAA,CAAA;AACvD,IAAA,MAAM,KAAA,GAAQ,YAAA,GACV,CAAA,KAAA,EAAQ,QAAA,CAAS,SAAS,CAAC,CAAA,GAAA,EAAM,GAAG,CAAA,CAAA,CAAA,GACpC,CAAA,uCAAA,EAA0C,GAAG,CAAA,CAAA,CAAA;AACjD,IAAA,MAAM,IAAA,GAAO,yCAAyC,GAAG,CAAA,CAAA,CAAA;AACzD,IAAA,OAAO,QAAA,GAAW,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAK,GAAI,EAAE,GAAA,EAAK,KAAA,EAAO,IAAA,EAAK;AAAA,EACxE,GAAG,CAAC,GAAA,EAAK,QAAA,EAAU,YAAA,EAAc,SAAS,CAAC,CAAA;AAE3C,EAAA,sCAAQC,aAAA,EAAA,EAAW,QAAA,EAAoB,QAAgB,YAAA,EAAc,MAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC1F","file":"chunk-XKSFJYOD.cjs","sourcesContent":["import { useMemo } from 'react'\nimport { Toaster as KitToaster, type ToasterProps } from '@arbidocs/react/shell'\nimport { SHELL_BOTTOM_INSET_VAR } from '../lib/bottom-inset'\nimport { useIsPhone } from '../lib/use-media-query'\n\n/** The assistant dock's default width, in CSS px (`AssistantDock`'s `width` default). */\nexport const DEFAULT_DOCK_WIDTH = 380\n\nexport interface ShellToasterProps extends Omit<ToasterProps, 'offset' | 'mobileOffset'> {\n /**\n * A right-hand dock (the assistant chat) is open beside the content. A right-aligned stack then\n * slides left by `dockWidth` so it never sits on the dock. On a phone the dock is a full-screen\n * modal, so no shift applies. `AssistantToaster` from `@arbidocs/blocks/chat` wires this for you.\n */\n dockOpen?: boolean\n /** Width of the open dock: a number is px, a string any CSS length. Default 380. */\n dockWidth?: number | string\n /** Gap kept to the screen edges, any CSS length. Default `1rem` (`0.75rem` on a phone). */\n edgeGap?: string\n}\n\nconst asLength = (v: number | string) => (typeof v === 'number' ? `${v}px` : v)\n\n/**\n * The shell's toast stack: the shared sonner `Toaster` placed so it never covers shell chrome.\n * Default position is bottom-right. It keeps clear of:\n *\n * - pinned bottom bars (the phone tab bar, the chat composer), through `--shell-bottom-inset`\n * that `useShellBottomInset` publishes; a bottom stack sits `edgeGap` above it;\n * - the device's home indicator and notch (`env(safe-area-inset-*)`);\n * - an open right-hand dock (`dockOpen` + `dockWidth`).\n *\n * Mount it once near the app root. Every other sonner prop (`theme`, `closeButton`,\n * `toastOptions`, ...) passes through; fire toasts with `notify.*` / `toast` from `@arbidocs/react`.\n */\nexport function Toaster({\n position = 'bottom-right',\n dockOpen = false,\n dockWidth = DEFAULT_DOCK_WIDTH,\n edgeGap,\n ...props\n}: ShellToasterProps) {\n const isPhone = useIsPhone()\n const gap = edgeGap ?? (isPhone ? '0.75rem' : '1rem')\n const isBottom = position.startsWith('bottom')\n const isRight = position.endsWith('right')\n const shiftForDock = dockOpen && isRight && !isPhone\n\n const offset = useMemo(() => {\n const inset = `calc(max(var(${SHELL_BOTTOM_INSET_VAR}, 0px), env(safe-area-inset-bottom, 0px)) + ${gap})`\n const top = `calc(env(safe-area-inset-top, 0px) + ${gap})`\n const right = shiftForDock\n ? `calc(${asLength(dockWidth)} + ${gap})`\n : `calc(env(safe-area-inset-right, 0px) + ${gap})`\n const left = `calc(env(safe-area-inset-left, 0px) + ${gap})`\n return isBottom ? { bottom: inset, right, left } : { top, right, left }\n }, [gap, isBottom, shiftForDock, dockWidth])\n\n return <KitToaster position={position} offset={offset} mobileOffset={offset} {...props} />\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkTO4FAMQP_cjs = require('./chunk-TO4FAMQP.cjs');
4
+ var chunkXKSFJYOD_cjs = require('./chunk-XKSFJYOD.cjs');
5
5
  var chunkPRVKJ5XL_cjs = require('./chunk-PRVKJ5XL.cjs');
6
6
  var chunkVGOFFCMT_cjs = require('./chunk-VGOFFCMT.cjs');
7
7
  var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
@@ -1630,7 +1630,7 @@ function LabelPinRow({
1630
1630
  function AssistantToaster(props) {
1631
1631
  const dock = chunkPRVKJ5XL_cjs.useAssistantDock();
1632
1632
  const { isDockAvailable } = chunkPRVKJ5XL_cjs.useChatSurface();
1633
- return /* @__PURE__ */ jsxRuntime.jsx(chunkTO4FAMQP_cjs.Toaster, { ...props, dockOpen: dock.isOpen && isDockAvailable });
1633
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkXKSFJYOD_cjs.Toaster, { ...props, dockOpen: dock.isOpen && isDockAvailable });
1634
1634
  }
1635
1635
 
1636
1636
  exports.AssistantToaster = AssistantToaster;
@@ -1695,5 +1695,5 @@ exports.isLongPastedText = isLongPastedText;
1695
1695
  exports.useDismissibleCard = useDismissibleCard;
1696
1696
  exports.useListKeyNav = useListKeyNav;
1697
1697
  exports.useLongPaste = useLongPaste;
1698
- //# sourceMappingURL=chunk-22T6KHGB.cjs.map
1699
- //# sourceMappingURL=chunk-22T6KHGB.cjs.map
1698
+ //# sourceMappingURL=chunk-YWSWRTGH.cjs.map
1699
+ //# sourceMappingURL=chunk-YWSWRTGH.cjs.map