@copilotkit/core 2.0.0-rc.3 → 2.0.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-configuration.cjs +269 -0
- package/dist/chat-configuration.cjs.map +1 -0
- package/dist/chat-configuration.d.cts +123 -0
- package/dist/chat-configuration.d.cts.map +1 -0
- package/dist/chat-configuration.d.mts +123 -0
- package/dist/chat-configuration.d.mts.map +1 -0
- package/dist/chat-configuration.mjs +268 -0
- package/dist/chat-configuration.mjs.map +1 -0
- package/dist/index.cjs +12148 -2154
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3908
- package/dist/index.d.mts +3 -3908
- package/dist/index.mjs +11879 -2155
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +14425 -2184
- package/dist/index.umd.js.map +1 -1
- package/dist/learning-bridge-6XU87AJD.d.cts +10903 -0
- package/dist/learning-bridge-6XU87AJD.d.cts.map +1 -0
- package/dist/learning-bridge-JEJAH81x.d.mts +10903 -0
- package/dist/learning-bridge-JEJAH81x.d.mts.map +1 -0
- package/dist/styles.cjs +1 -1
- package/dist/styles.cjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.mjs +1 -1
- package/dist/styles.mjs.map +1 -1
- package/dist/viewport-D9ZX0xqz.mjs +954 -0
- package/dist/viewport-D9ZX0xqz.mjs.map +1 -0
- package/dist/viewport-GwjIosf7.cjs +1182 -0
- package/dist/viewport-GwjIosf7.cjs.map +1 -0
- package/package.json +14 -9
- package/tsdown.config.ts +11 -2
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport-D9ZX0xqz.mjs","names":[],"sources":["../src/chat/dom.ts","../src/chat/viewport.ts"],"sourcesContent":["/**\n * DOM helpers that the chat views of React, Vue, and Angular share: the\n * docked sidebar's page margins, popup dismissal and exit animation, the\n * default popup and sidebar sizes, the lightbox's view-transition morph and\n * focus handling, document previews, the scroll-to-bottom check, and\n * element size watchers.\n *\n * Nothing here touches the DOM at import time, so it is safe to import\n * during server rendering.\n */\n\nimport type { Attachment } from \"@copilotkit/shared\";\nimport { ɵMOBILE_MAX_WIDTH_QUERY } from \"./viewport\";\n\n// ---------------------------------------------------------------------------\n// CSS dimensions\n// ---------------------------------------------------------------------------\n\n/**\n * Turn a width or height prop into a CSS value.\n *\n * @param value - A number of pixels, or a CSS length such as `\"30rem\"`.\n * @param fallback - The pixels to use when `value` is missing, not finite,\n * or an empty string.\n *\n * @example\n * ```ts\n * ɵdimensionToCss(420, 480); // \"420px\"\n * ɵdimensionToCss(\" 30rem \", 480); // \"30rem\"\n * ɵdimensionToCss(undefined, 480); // \"480px\"\n * ```\n */\nexport function ɵdimensionToCss(\n value: number | string | undefined,\n fallback: number,\n) {\n if (typeof value === \"number\" && Number.isFinite(value)) return `${value}px`;\n if (typeof value === \"string\" && value.trim().length > 0) return value.trim();\n return `${fallback}px`;\n}\n\n// ---------------------------------------------------------------------------\n// Docked sidebar\n// ---------------------------------------------------------------------------\n\n/** The side of the page a sidebar docks to. */\nexport type ɵSidebarPosition = \"left\" | \"right\";\n\n/** Where the docked sidebar sits and how wide it is. */\nexport interface ɵDockedSidebarPlacement {\n position: ɵSidebarPosition;\n /** A CSS width, for example from {@link ɵdimensionToCss}. */\n width: string;\n}\n\n/** Options for one change of the page margins. */\nexport interface ɵDockedSidebarTransition {\n /** Animate the margin for this many ms. Leave out to change it at once. */\n transitionMs?: number;\n}\n\nconst ONLY_ONE_DOCKED_SIDEBAR =\n \"[CopilotKit] Only one docked CopilotSidebar may be open per document.\";\n\n/**\n * Gives one docked sidebar at a time the page's inline margin on its side,\n * and puts back the margins the page had before when it lets go.\n *\n * Get the registry of a document with {@link ɵdockedSidebarRegistryFor}.\n */\nexport class ɵDockedSidebarRegistry {\n private owner: symbol | undefined;\n private original = { start: \"\", end: \"\", transition: \"\" };\n private restoreTimer: ReturnType<typeof setTimeout> | undefined;\n private readonly warned = new Set<symbol>();\n\n constructor(private readonly document: Document) {}\n\n /**\n * Take the page margins for `owner`.\n *\n * @returns `true` when `owner` now has them. `false`, with a warning, when\n * another sidebar has them.\n */\n acquire(owner: symbol) {\n if (this.owner === owner) return true;\n if (this.owner !== undefined) {\n if (!this.warned.has(owner)) {\n this.warned.add(owner);\n console.warn(ONLY_ONE_DOCKED_SIDEBAR);\n }\n return false;\n }\n const style = this.document.body.style;\n // While a release still animates, the transition on the page is ours,\n // so keep the page's own one from before.\n const transition =\n this.restoreTimer === undefined\n ? style.transition\n : this.original.transition;\n this.original = {\n start: style.marginInlineStart,\n end: style.marginInlineEnd,\n transition,\n };\n this.cancelRestore();\n this.owner = owner;\n return true;\n }\n\n /** Set the margin on the sidebar's side. Does nothing unless `owner` has it. */\n update(\n owner: symbol,\n placement: ɵDockedSidebarPlacement,\n options: ɵDockedSidebarTransition = {},\n ) {\n if (this.owner !== owner) return;\n const style = this.document.body.style;\n this.applyTransition(options.transitionMs);\n style.marginInlineStart =\n placement.position === \"left\" ? placement.width : this.original.start;\n style.marginInlineEnd =\n placement.position === \"right\" ? placement.width : this.original.end;\n }\n\n /**\n * Put back the page's own margins and let go. Does nothing unless `owner`\n * has the margins.\n */\n release(owner: symbol, options: ɵDockedSidebarTransition = {}) {\n this.warned.delete(owner);\n if (this.owner !== owner) return;\n const style = this.document.body.style;\n this.applyTransition(options.transitionMs);\n style.marginInlineStart = this.original.start;\n style.marginInlineEnd = this.original.end;\n this.owner = undefined;\n if (options.transitionMs === undefined) return;\n this.restoreTimer = setTimeout(() => {\n this.restoreTimer = undefined;\n if (this.owner === undefined) style.transition = this.original.transition;\n }, options.transitionMs);\n }\n\n private applyTransition(transitionMs: number | undefined) {\n const style = this.document.body.style;\n this.cancelRestore();\n style.transition =\n transitionMs === undefined\n ? this.original.transition\n : `margin-inline-start ${transitionMs}ms ease, margin-inline-end ${transitionMs}ms ease`;\n }\n\n private cancelRestore() {\n if (this.restoreTimer === undefined) return;\n clearTimeout(this.restoreTimer);\n this.restoreTimer = undefined;\n }\n}\n\nconst registries = new WeakMap<Document, ɵDockedSidebarRegistry>();\n\n/** The one {@link ɵDockedSidebarRegistry} of `document`. */\nexport function ɵdockedSidebarRegistryFor(document: Document) {\n let registry = registries.get(document);\n if (!registry) {\n registry = new ɵDockedSidebarRegistry(document);\n registries.set(document, registry);\n }\n return registry;\n}\n\n/** What {@link ɵDockedSidebar.set} reads. */\nexport interface ɵDockedSidebarState extends ɵDockedSidebarPlacement {\n open: boolean;\n}\n\n/**\n * Makes room on the page for an open sidebar, on desktop viewports only\n * (wider than 767px). It follows viewport changes, animates every change\n * after the first, and gives the page its margins back on `dispose()`.\n *\n * Create it with {@link ɵcreateDockedSidebar}.\n */\nexport class ɵDockedSidebar {\n private readonly owner = Symbol(\"copilot-sidebar\");\n private readonly registry: ɵDockedSidebarRegistry;\n private readonly media: MediaQueryList | undefined;\n private state: ɵDockedSidebarState | undefined;\n private owns = false;\n private hasApplied = false;\n\n constructor(\n document: Document,\n private readonly transitionMs: number,\n ) {\n this.registry = ɵdockedSidebarRegistryFor(document);\n this.media = document.defaultView?.matchMedia?.(ɵMOBILE_MAX_WIDTH_QUERY);\n this.media?.addEventListener(\"change\", this.apply);\n }\n\n /**\n * `true` while this sidebar has the page margin. `false` when it is closed,\n * on a mobile viewport, or when another docked sidebar has the margin.\n */\n get isDocked() {\n return this.owns;\n }\n\n /** Apply the sidebar's open state, side, and width. */\n set(state: ɵDockedSidebarState) {\n this.state = state;\n this.apply();\n }\n\n /** Give the margins back at once and stop following the viewport. */\n dispose() {\n this.media?.removeEventListener(\"change\", this.apply);\n this.registry.release(this.owner);\n this.owns = false;\n }\n\n private readonly apply = () => {\n const state = this.state;\n if (!state) return;\n const transition = this.hasApplied\n ? { transitionMs: this.transitionMs }\n : {};\n this.hasApplied = true;\n const isDocked = state.open && !this.media?.matches;\n\n if (!isDocked) {\n if (this.owns) this.registry.release(this.owner, transition);\n this.owns = false;\n return;\n }\n this.owns = this.owns || this.registry.acquire(this.owner);\n if (this.owns) this.registry.update(this.owner, state, transition);\n };\n}\n\n/**\n * Create the controller that reserves the page margin for a docked sidebar.\n *\n * @param document - The page.\n * @param options - `transitionMs`: how long margin changes animate.\n *\n * @example\n * ```ts\n * const dock = ɵcreateDockedSidebar(document, { transitionMs: 260 });\n * dock.set({ open: true, position: \"right\", width: \"480px\" });\n * dock.dispose(); // on unmount\n * ```\n */\nexport function ɵcreateDockedSidebar(\n document: Document,\n options: { transitionMs: number },\n) {\n return new ɵDockedSidebar(document, options.transitionMs);\n}\n\n// ---------------------------------------------------------------------------\n// Popup dismissal\n// ---------------------------------------------------------------------------\n\n/** How long the popup's open animation runs, in ms. */\nexport const ɵPOPUP_ANIMATION_MS = 200;\n\n/** The popup's width when the `width` prop is missing, in px. */\nexport const ɵPOPUP_DEFAULT_WIDTH = 420;\n\n/** The popup's height when the `height` prop is missing, in px. */\nexport const ɵPOPUP_DEFAULT_HEIGHT = 560;\n\n/** The sidebar's width when the `width` prop is missing, in px. */\nexport const ɵSIDEBAR_DEFAULT_WIDTH = 480;\n\n/** How long the docked sidebar's page margin animates, in ms. */\nexport const ɵSIDEBAR_TRANSITION_MS = 260;\n\n/** Whether a closing panel is still in the DOM. */\nexport interface ɵExitPresenceState {\n /** Render the panel. */\n isRendered: boolean;\n /** The panel is closed but still plays its exit animation. */\n isClosing: boolean;\n}\n\n/**\n * Keeps a closed panel in the DOM for its exit animation, then removes it.\n * Opening again during the animation cancels the removal.\n *\n * Create it with {@link ɵcreateExitPresence}. Each change makes a new state\n * object, so `getState` works with React's `useSyncExternalStore`.\n */\nexport class ɵExitPresence {\n private state: ɵExitPresenceState;\n private timer: ReturnType<typeof setTimeout> | undefined;\n private readonly listeners = new Set<(state: ɵExitPresenceState) => void>();\n\n constructor(\n open: boolean,\n private readonly durationMs: number,\n ) {\n this.state = { isRendered: open, isClosing: false };\n }\n\n /** The current state. */\n readonly getState = () => this.state;\n\n /**\n * Call `listener` on each change.\n *\n * @returns The unsubscribe function.\n */\n readonly subscribe = (listener: (state: ɵExitPresenceState) => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n /** Apply the panel's open state. */\n setOpen(open: boolean) {\n if (open) {\n this.clearTimer();\n this.set({ isRendered: true, isClosing: false });\n return;\n }\n if (!this.state.isRendered || this.timer !== undefined) return;\n this.set({ isRendered: true, isClosing: true });\n this.timer = setTimeout(() => {\n this.timer = undefined;\n this.set({ isRendered: false, isClosing: false });\n }, this.durationMs);\n }\n\n /** Cancel a pending removal. */\n dispose() {\n this.clearTimer();\n }\n\n private set(next: ɵExitPresenceState) {\n const current = this.state;\n if (\n current.isRendered === next.isRendered &&\n current.isClosing === next.isClosing\n ) {\n return;\n }\n this.state = next;\n for (const listener of this.listeners) listener(next);\n }\n\n private clearTimer() {\n if (this.timer === undefined) return;\n clearTimeout(this.timer);\n this.timer = undefined;\n }\n}\n\n/**\n * Create the exit-animation state of a popup or another panel.\n *\n * @param open - Whether the panel starts open.\n * @param options - `durationMs`: how long the exit animation runs. Default:\n * {@link ɵPOPUP_ANIMATION_MS}.\n *\n * @example\n * ```ts\n * const presence = ɵcreateExitPresence(isOpen);\n * presence.subscribe(({ isRendered, isClosing }) => render(isRendered, isClosing));\n * presence.setOpen(false); // renders until the animation ends\n * presence.dispose(); // on unmount\n * ```\n */\nexport function ɵcreateExitPresence(\n open: boolean,\n options: { durationMs?: number } = {},\n) {\n return new ɵExitPresence(open, options.durationMs ?? ɵPOPUP_ANIMATION_MS);\n}\n\nexport interface ɵPopupDismissOptions {\n /** The popup's panel. Reads it at event time. */\n getContainer: () => HTMLElement | null | undefined;\n /** Close the popup. */\n onDismiss: () => void;\n /** `true` to also close on a pointer down outside the popup. */\n clickOutsideToClose: boolean;\n}\n\n/**\n * Close an open popup on Escape and, when asked, on a pointer down outside\n * it, and move focus into it once its open animation ends.\n *\n * A pointer down on the chat toggle button, or in a chat popover (which\n * renders in a portal, outside the panel), does not close the popup. Focus\n * moves to the panel only when nothing inside it has focus yet.\n *\n * Call it when the popup opens, and call the returned function when it\n * closes or unmounts.\n *\n * @param options - The panel, the close callback, and whether a click\n * outside closes.\n */\nexport function ɵbindPopupDismiss(options: ɵPopupDismissOptions) {\n if (typeof window === \"undefined\") return () => {};\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return;\n event.preventDefault();\n options.onDismiss();\n };\n\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target;\n if (!(target instanceof Node)) return;\n if (options.getContainer()?.contains(target)) return;\n const element = target instanceof Element ? target : target.parentElement;\n const isExempt = element?.closest(\n \"[data-slot='chat-toggle-button'], [data-copilotkit-popover]\",\n );\n if (isExempt) return;\n options.onDismiss();\n };\n\n const focusTimer = setTimeout(() => {\n const container = options.getContainer();\n if (\n container &&\n !container.contains(container.ownerDocument.activeElement)\n ) {\n container.focus({ preventScroll: true });\n }\n }, ɵPOPUP_ANIMATION_MS);\n\n window.addEventListener(\"keydown\", handleKeyDown);\n if (options.clickOutsideToClose) {\n document.addEventListener(\"pointerdown\", handlePointerDown);\n }\n\n return () => {\n clearTimeout(focusTimer);\n window.removeEventListener(\"keydown\", handleKeyDown);\n document.removeEventListener(\"pointerdown\", handlePointerDown);\n };\n}\n\n// ---------------------------------------------------------------------------\n// Lightbox\n// ---------------------------------------------------------------------------\n\n/**\n * Open or close a lightbox with the View Transition API, so the thumbnail\n * morphs into the preview and back.\n *\n * `view-transition-name` must be on one element at a time: on the\n * thumbnail before the change and on the preview after it. Bind `name` to\n * the preview element. Without the API, or without a thumbnail, `apply`\n * runs with no animation.\n *\n * @param thumbnail - The element the preview grows from.\n * @param name - A `view-transition-name`, unique on the page.\n * @param apply - Renders the change. It must finish the DOM update before\n * it returns or resolves (React: `flushSync`; Vue: `await nextTick()`).\n * @param direction - `\"open\"` or `\"close\"`.\n */\nexport function ɵmorphViewTransition(\n thumbnail: HTMLElement | null | undefined,\n name: string,\n apply: () => void | Promise<void>,\n direction: \"open\" | \"close\",\n) {\n const doc = typeof document === \"undefined\" ? undefined : document;\n const canMorph =\n !!thumbnail && typeof doc?.startViewTransition === \"function\";\n if (!canMorph || !thumbnail || !doc) {\n void apply();\n return;\n }\n\n if (direction === \"open\") {\n thumbnail.style.viewTransitionName = name;\n doc.startViewTransition(async () => {\n thumbnail.style.viewTransitionName = \"\";\n await apply();\n });\n return;\n }\n\n const transition = doc.startViewTransition(async () => {\n await apply();\n thumbnail.style.viewTransitionName = name;\n });\n const clear = () => {\n thumbnail.style.viewTransitionName = \"\";\n };\n transition.finished.then(clear, clear);\n}\n\n// Elements that can take focus.\nconst FOCUSABLE_ELEMENTS = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"audio[controls]\",\n \"video[controls]\",\n \"iframe\",\n \"[tabindex]\",\n];\n\nconst FOCUSABLE = FOCUSABLE_ELEMENTS.map((selector) =>\n selector === \"[tabindex]\" ? '[tabindex]:not([tabindex=\"-1\"])' : selector,\n).join(\", \");\n\n/**\n * Elements Tab stops at: the focusable ones without `tabindex=\"-1\"`. Radix\n * focus guards, which only pass focus on, are left out.\n */\nexport const ɵTAB_STOP_SELECTOR = FOCUSABLE_ELEMENTS.map(\n (selector) =>\n `${selector}:not([tabindex=\"-1\"]):not([data-radix-focus-guard])`,\n).join(\", \");\n\n/**\n * Approximately the element Tab reaches after `element`, in document order.\n * Elements inside `skip` (for example a popover in a portal) and inside\n * `[hidden]` or `[inert]` are passed over.\n *\n * @returns The next tab stop, or `null` when there is none.\n */\nexport function ɵnextTabStop(element: Element, skip: Element | null) {\n const all = Array.from(\n element.ownerDocument.querySelectorAll<HTMLElement>(ɵTAB_STOP_SELECTOR),\n ).filter(\n (candidate) =>\n candidate === element ||\n (!skip?.contains(candidate) && !candidate.closest(\"[hidden], [inert]\")),\n );\n const index = all.findIndex((candidate) => candidate === element);\n return index === -1 ? null : (all[index + 1] ?? null);\n}\n\n/**\n * Whether focus on `element` came from the keyboard. A pointer click also\n * focuses buttons, and this tells the two apart.\n */\nexport function ɵisFocusVisible(element: Element) {\n try {\n return element.matches(\":focus-visible\");\n } catch {\n // Browsers without `:focus-visible` throw on the selector.\n return false;\n }\n}\n\nexport interface ɵDialogFocusOptions {\n /** Where focus goes on open. Default: the first focusable element. */\n initialFocus?: HTMLElement | null;\n /** Where focus goes on close. Default: the element focused on open. */\n returnFocusTo?: HTMLElement | null;\n}\n\n/**\n * Make `root` behave as a modal dialog for keyboard users: focus moves into\n * it, Tab and Shift+Tab wrap inside it, and focus goes back to the opener\n * when the returned function runs.\n *\n * @param root - The dialog element.\n * @param options - Where focus goes on open and on close.\n * @returns A function that removes the trap and returns focus.\n */\nexport function ɵbindDialogFocus(\n root: HTMLElement,\n options: ɵDialogFocusOptions = {},\n) {\n const doc = root.ownerDocument;\n const active = doc.activeElement;\n const opener = active instanceof HTMLElement ? active : null;\n const focusables = () =>\n Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE));\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Tab\") return;\n const elements = focusables();\n const first = elements[0];\n const last = elements[elements.length - 1];\n if (!first || !last) {\n event.preventDefault();\n return;\n }\n const current = doc.activeElement;\n const isOutside = !root.contains(current);\n if (event.shiftKey && (current === first || isOutside)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && (current === last || isOutside)) {\n event.preventDefault();\n first.focus();\n }\n };\n\n root.addEventListener(\"keydown\", handleKeyDown);\n (options.initialFocus ?? focusables()[0])?.focus();\n\n return () => {\n root.removeEventListener(\"keydown\", handleKeyDown);\n const target = options.returnFocusTo ?? opener;\n if (target?.isConnected) target.focus();\n };\n}\n\n// ---------------------------------------------------------------------------\n// Document preview\n// ---------------------------------------------------------------------------\n\ntype AttachmentSource = Attachment[\"source\"];\n\n/**\n * Which in-browser preview a document gets.\n *\n * @param mimeType - The document's MIME type.\n * @returns `\"pdf\"`, `\"text\"` (for `text/*`), or `null` when the browser\n * cannot preview it.\n */\nexport function ɵcanPreviewDocument(mimeType: string | undefined) {\n if (!mimeType) return null;\n if (mimeType.includes(\"pdf\")) return \"pdf\";\n if (mimeType.startsWith(\"text/\")) return \"text\";\n return null;\n}\n\nfunction decodeBase64(value: string) {\n const binary = atob(value);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return bytes;\n}\n\n/**\n * A URL a browser can show in an `<iframe>` for an attachment's source.\n *\n * Browsers block `data:` URLs for PDFs in frames, so base64 data becomes a\n * `blob:` URL. Call `revoke()` when the preview closes.\n *\n * @param source - The attachment's source.\n * @returns `{ url, revoke }`, or `null` when the data is not valid base64.\n */\nexport function ɵcreateObjectUrlFromSource(source: AttachmentSource) {\n if (source.type === \"url\") return { url: source.value, revoke: () => {} };\n try {\n const blob = new Blob([decodeBase64(source.value)], {\n type: source.mimeType || \"application/octet-stream\",\n });\n const url = URL.createObjectURL(blob);\n return { url, revoke: () => URL.revokeObjectURL(url) };\n } catch (error) {\n console.error(\"[CopilotKit] Failed to decode attachment data:\", error);\n return null;\n }\n}\n\n/**\n * The text of a text attachment, for a `<pre>` preview.\n *\n * @param source - The attachment's source.\n * @returns The base64 data decoded as UTF-8, the raw value when it is not\n * valid base64, or `null` for a URL source (show it in a frame instead).\n */\nexport function ɵdecodeTextSource(source: AttachmentSource) {\n if (source.type !== \"data\") return null;\n try {\n return new TextDecoder().decode(decodeBase64(source.value));\n } catch {\n return source.value;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Scroll to bottom\n// ---------------------------------------------------------------------------\n\n/** How close to the end, in pixels, still counts as scrolled to the bottom. */\nexport const ɵSCROLL_BOTTOM_THRESHOLD_PX = 12;\n\n/**\n * Whether a scroll container shows the end of its content.\n *\n * @param element - The scroll container.\n * @param threshold - The pixels from the end that still count. Default:\n * {@link ɵSCROLL_BOTTOM_THRESHOLD_PX}.\n */\nexport function ɵisScrolledToBottom(\n element: Pick<HTMLElement, \"scrollHeight\" | \"scrollTop\" | \"clientHeight\">,\n threshold = ɵSCROLL_BOTTOM_THRESHOLD_PX,\n) {\n const distance =\n element.scrollHeight - element.scrollTop - element.clientHeight;\n return distance <= threshold;\n}\n\n/**\n * Whether a scroll container shows the end of `content`, an element inside\n * it. Use it when empty space follows the messages, such as the\n * `pin-to-send` spacer: scrolling into that space shows no more messages.\n *\n * @param element - The scroll container.\n * @param content - The element that holds the messages.\n * @param threshold - The pixels of `content` below the viewport that still\n * count. Default: {@link ɵSCROLL_BOTTOM_THRESHOLD_PX}.\n */\nexport function ɵisContentScrolledToBottom(\n element: Element,\n content: Element,\n threshold = ɵSCROLL_BOTTOM_THRESHOLD_PX,\n) {\n const hiddenBelow =\n content.getBoundingClientRect().bottom -\n element.getBoundingClientRect().bottom;\n return hiddenBelow <= threshold;\n}\n\n// ---------------------------------------------------------------------------\n// Element size\n// ---------------------------------------------------------------------------\n\n/** How long an element counts as resizing after its last size change, in ms. */\nexport const ɵRESIZE_SETTLE_MS = 250;\n\n/** What {@link ɵwatchElementHeight} reports. */\nexport interface ɵElementHeightState {\n /** The content-box height, in px. */\n height: number;\n /** The height changed less than `settleMs` ago. */\n isResizing: boolean;\n}\n\n/**\n * Report an element's height now and on each change. `isResizing` is `true`\n * from a change until the height stays the same for `settleMs`, so callers\n * can hide UI, such as the scroll-to-bottom button, while a layout moves.\n *\n * The first call reads `offsetHeight`. Later calls read the\n * `ResizeObserver` content box. Without `ResizeObserver`, only the first\n * call happens.\n *\n * @param element - The element to measure.\n * @param listener - Gets the height and the resizing state.\n * @param options - `settleMs`: default {@link ɵRESIZE_SETTLE_MS}.\n * @returns A function that stops the watch.\n */\nexport function ɵwatchElementHeight(\n element: HTMLElement,\n listener: (state: ɵElementHeightState) => void,\n options: { settleMs?: number } = {},\n) {\n const settleMs = options.settleMs ?? ɵRESIZE_SETTLE_MS;\n let height = element.offsetHeight;\n let timer: ReturnType<typeof setTimeout> | undefined;\n listener({ height, isResizing: false });\n if (typeof ResizeObserver === \"undefined\") return () => {};\n\n const observer = new ResizeObserver((entries) => {\n const next = entries[entries.length - 1]?.contentRect.height;\n if (next === undefined || next === height) return;\n height = next;\n if (timer !== undefined) clearTimeout(timer);\n if (settleMs <= 0) {\n listener({ height, isResizing: false });\n return;\n }\n listener({ height, isResizing: true });\n timer = setTimeout(() => {\n timer = undefined;\n listener({ height, isResizing: false });\n }, settleMs);\n });\n observer.observe(element);\n\n return () => {\n observer.disconnect();\n if (timer !== undefined) clearTimeout(timer);\n };\n}\n\n/**\n * Report an element's border-box width now and on each change, skipping\n * zero widths (a hidden element). Uses `ResizeObserver`, or the window's\n * `resize` event without it.\n *\n * @param element - The element to measure, for example a sidebar.\n * @param listener - Gets the width in px.\n * @returns A function that stops the watch.\n */\nexport function ɵwatchElementWidth(\n element: HTMLElement,\n listener: (width: number) => void,\n) {\n const update = () => {\n const width = element.getBoundingClientRect().width;\n if (width > 0) listener(width);\n };\n update();\n if (typeof ResizeObserver !== \"undefined\") {\n const observer = new ResizeObserver(update);\n observer.observe(element);\n return () => observer.disconnect();\n }\n const view = element.ownerDocument.defaultView;\n if (!view) return () => {};\n view.addEventListener(\"resize\", update);\n return () => view.removeEventListener(\"resize\", update);\n}\n","import { ɵSCROLL_BOTTOM_THRESHOLD_PX, ɵisScrolledToBottom } from \"./dom\";\n\n/** How the chat scrolls as messages arrive. */\nexport type ɵAutoScrollMode = \"pin-to-bottom\" | \"pin-to-send\" | \"none\";\n\nconst AUTO_SCROLL_MODES: readonly string[] = [\n \"pin-to-bottom\",\n \"pin-to-send\",\n \"none\",\n] satisfies readonly ɵAutoScrollMode[];\n\nconst isAutoScrollMode = (value: string): value is ɵAutoScrollMode =>\n AUTO_SCROLL_MODES.includes(value);\n\n/**\n * Turns the `autoScroll` prop into a mode. `true` and a missing value mean\n * `\"pin-to-bottom\"`, `false` means `\"none\"`, and an unknown string falls back\n * to `\"pin-to-bottom\"`.\n */\nexport function ɵnormalizeAutoScroll(\n value: ɵAutoScrollMode | boolean | undefined,\n) {\n if (value === false) return \"none\";\n if (value === undefined || value === true) return \"pin-to-bottom\";\n return isAutoScrollMode(value) ? value : \"pin-to-bottom\";\n}\n\n/**\n * Media query for the mobile range, where the threads drawer and the chat\n * modal are mutually exclusive.\n */\nexport const ɵMOBILE_MAX_WIDTH_QUERY = \"(max-width: 767px)\";\n\n/** `window.matchMedia` for the mobile query, or `null` without a DOM. */\nconst mobileMediaQuery = () => {\n const hasMatchMedia =\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\";\n return hasMatchMedia ? window.matchMedia(ɵMOBILE_MAX_WIDTH_QUERY) : null;\n};\n\n/**\n * Whether the viewport is in the mobile range (`<768px`). `false` during SSR\n * and where `window.matchMedia` is missing (some test runners and webviews).\n */\nexport function ɵisMobileViewport() {\n return mobileMediaQuery()?.matches ?? false;\n}\n\n/**\n * Calls `listener` with {@link ɵisMobileViewport} now and each time the\n * viewport enters or leaves the mobile range. Does nothing without\n * `window.matchMedia`. Returns the unsubscribe function.\n */\nexport function ɵwatchMobileViewport(listener: (isMobile: boolean) => void) {\n const query = mobileMediaQuery();\n if (query === null) return () => {};\n const update = () => listener(query.matches);\n update();\n query.addEventListener(\"change\", update);\n return () => query.removeEventListener(\"change\", update);\n}\n\n/**\n * The on-screen keyboard is treated as open once it covers more than this\n * many pixels of the layout viewport.\n */\nexport const ɵKEYBOARD_OPEN_THRESHOLD_PX = 150;\n\n/** The mobile on-screen keyboard and the height left for the page. */\nexport interface ɵKeyboardState {\n isKeyboardOpen: boolean;\n keyboardHeight: number;\n /** Height of the visual viewport, the part the keyboard does not cover. */\n availableHeight: number;\n /** Height of the layout viewport (`window.innerHeight`). */\n viewportHeight: number;\n}\n\n/**\n * Reads the keyboard state with the Visual Viewport API: the keyboard height\n * is `innerHeight - visualViewport.height`, clamped to 0. Without the API (or\n * during SSR) it reports a closed keyboard and the full window height.\n */\nexport function ɵreadKeyboardState() {\n if (typeof window === \"undefined\") return closedKeyboard(0);\n const visualViewport = window.visualViewport;\n if (!visualViewport) return closedKeyboard(window.innerHeight);\n const layoutHeight = window.innerHeight;\n const keyboardHeight = Math.max(0, layoutHeight - visualViewport.height);\n return {\n isKeyboardOpen: keyboardHeight > ɵKEYBOARD_OPEN_THRESHOLD_PX,\n keyboardHeight,\n availableHeight: visualViewport.height,\n viewportHeight: layoutHeight,\n };\n}\n\nconst closedKeyboard = (height: number): ɵKeyboardState => ({\n isKeyboardOpen: false,\n keyboardHeight: 0,\n availableHeight: height,\n viewportHeight: height,\n});\n\n/**\n * The state for the first render, before {@link ɵwatchKeyboardState} reads\n * the visual viewport: a closed keyboard over the full window height (0\n * during SSR).\n */\nexport function ɵinitialKeyboardState() {\n return closedKeyboard(typeof window === \"undefined\" ? 0 : window.innerHeight);\n}\n\n/**\n * Calls `listener` with {@link ɵreadKeyboardState} now and on each visual\n * viewport resize or scroll. Does nothing during SSR or without the Visual\n * Viewport API. Returns the unsubscribe function.\n */\nexport function ɵwatchKeyboardState(listener: (state: ɵKeyboardState) => void) {\n if (typeof window === \"undefined\") return () => {};\n const visualViewport = window.visualViewport;\n if (!visualViewport) return () => {};\n const update = () => listener(ɵreadKeyboardState());\n update();\n visualViewport.addEventListener(\"resize\", update);\n visualViewport.addEventListener(\"scroll\", update);\n return () => {\n visualViewport.removeEventListener(\"resize\", update);\n visualViewport.removeEventListener(\"scroll\", update);\n };\n}\n\n/** Input for {@link ɵpinMessageToTop}. */\nexport interface ɵPinMessageToTopOptions {\n /** The scroll container of the message list. */\n scrollEl: HTMLElement;\n /** The element that holds the messages, inside `scrollEl`. */\n contentEl: HTMLElement;\n /** The spacer after the messages, sized so the message can reach the top. */\n spacerEl: HTMLElement;\n /** The `data-message-id` of the message to pin. */\n messageId: string;\n /** Space between the top of the viewport and the message bubble, in px. */\n topOffset?: number;\n}\n\n/** Escapes `id` for a CSS attribute selector, also without `CSS.escape`. */\nconst escapeSelectorValue = (id: string) =>\n typeof CSS !== \"undefined\" && typeof CSS.escape === \"function\"\n ? CSS.escape(id)\n : id.replace(/[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~]/g, \"\\\\$&\");\n\n/**\n * Offset of `el` from the top of `stopAt`'s content, including `stopAt`'s\n * scroll. Uses `getBoundingClientRect`, so it works for any CSS position.\n */\nconst offsetTopWithin = (el: HTMLElement, stopAt: HTMLElement) =>\n el.getBoundingClientRect().top -\n stopAt.getBoundingClientRect().top +\n stopAt.scrollTop;\n\n/**\n * Pins a sent message to the top of the chat: sizes the spacer so the\n * message bubble can scroll to `topOffset` from the viewport top, scrolls\n * there on the next frame, and then shrinks the spacer as the reply below\n * grows, so the bubble stays put.\n *\n * The message element's top padding is scrolled off-screen: the bubble, not\n * its padded box, is pinned. Does nothing when no element in `contentEl` has\n * `data-message-id` equal to `messageId`. Skips the scroll without\n * `requestAnimationFrame` and the spacer updates without `ResizeObserver`.\n *\n * @returns A function that cancels the scroll and stops the spacer updates.\n * It returns `false` when it cancelled a scroll that had not run yet, so the\n * caller can pin the same send again. React's StrictMode tears an effect\n * down before the next frame, so the first run never scrolls.\n *\n * @example\n * ```ts\n * const unpin = ɵpinMessageToTop({ scrollEl, contentEl, spacerEl, messageId });\n * // On the next send or on unmount:\n * unpin();\n * ```\n */\nexport function ɵpinMessageToTop({\n scrollEl,\n contentEl,\n spacerEl,\n messageId,\n topOffset = 16,\n}: ɵPinMessageToTopOptions) {\n const targetEl = contentEl.querySelector<HTMLElement>(\n `[data-message-id=\"${escapeSelectorValue(messageId)}\"]`,\n );\n if (!targetEl) return () => true;\n\n const viewportHeight = scrollEl.clientHeight;\n const userMessageHeight = targetEl.getBoundingClientRect().height;\n const paddingTop = parseFloat(getComputedStyle(targetEl).paddingTop) || 0;\n const bubbleHeight = Math.max(0, userMessageHeight - paddingTop);\n const spacerHeight = Math.max(0, viewportHeight - bubbleHeight - topOffset);\n spacerEl.style.height = `${spacerHeight}px`;\n\n let scrolled = false;\n const frame =\n typeof requestAnimationFrame === \"function\"\n ? requestAnimationFrame(() => {\n scrolled = true;\n const targetTop =\n offsetTopWithin(targetEl, scrollEl) + paddingTop - topOffset;\n scrollEl.scrollTo({\n top: Math.max(0, targetTop),\n behavior: \"smooth\",\n });\n })\n : null;\n\n // As the content below the pinned message grows or shrinks, change the\n // spacer by the same amount, so the space below the bubble stays the same.\n const observer =\n typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(() => {\n const contentHeight = contentEl.getBoundingClientRect().height;\n const consumedBelow =\n contentHeight -\n offsetTopWithin(targetEl, contentEl) -\n userMessageHeight;\n const remaining = Math.max(0, spacerHeight - consumedBelow);\n spacerEl.style.height = `${remaining}px`;\n });\n observer?.observe(contentEl);\n\n return (): boolean => {\n if (frame !== null && typeof cancelAnimationFrame === \"function\")\n cancelAnimationFrame(frame);\n observer?.disconnect();\n return frame === null || scrolled;\n };\n}\n\n/** Input for {@link ɵcreateStickToBottom}. */\nexport interface ɵStickToBottomOptions {\n /** The scroll container of the message list. */\n scrollElement: HTMLElement;\n /**\n * The element that holds the messages. Its size changes and DOM changes\n * keep the list at the bottom. Default: `scrollElement`.\n */\n contentElement?: HTMLElement;\n /**\n * The pixels from the end that still count as the bottom. Default:\n * {@link ɵSCROLL_BOTTOM_THRESHOLD_PX}.\n */\n threshold?: number;\n /**\n * `true` to follow new content while the reader is at the bottom. `false`\n * only tracks the position, for the scroll-to-bottom button. Default:\n * `true`.\n */\n follow?: boolean;\n /** How the first scroll to the bottom moves. Default: `\"instant\"`. */\n initialBehavior?: ScrollBehavior;\n /** How the scrolls that follow new content move. Default: `\"instant\"`. */\n followBehavior?: ScrollBehavior;\n /**\n * Runs when {@link ɵStickToBottom.isAtBottom} changes. The value starts as\n * `true`, so the first call is the first `false`.\n */\n onChange?: (isAtBottom: boolean) => void;\n}\n\n/**\n * Keeps a message list at its bottom while content arrives, and stops when\n * the reader scrolls up. Scrolling back to the bottom, or a call to\n * {@link ɵStickToBottom.scrollToBottom}, starts it again.\n *\n * Content changes come from a `ResizeObserver` on both elements and a\n * `MutationObserver` on the content. Without them, only scroll events and\n * explicit calls update it.\n *\n * Create it with {@link ɵcreateStickToBottom}.\n */\nexport class ɵStickToBottom {\n private readonly scrollElement: HTMLElement;\n private readonly contentElement: HTMLElement;\n private readonly threshold: number;\n private readonly followBehavior: ScrollBehavior;\n private readonly onChange: ((isAtBottom: boolean) => void) | undefined;\n private follow: boolean;\n /** The reader has not scrolled away from the bottom. */\n private stuck = true;\n /** A smooth scroll to the bottom is on its way. */\n private smoothPending = false;\n /** `scrollTop` right after the last instant scroll to the bottom. */\n private programmaticTop: number | null = null;\n private lastTop: number;\n /** The largest `scrollTop` at the last read, to tell when content shrank. */\n private lastMaxTop: number;\n private reported = true;\n private frame: number | null = null;\n private readonly observers: { disconnect(): void }[] = [];\n\n constructor(options: ɵStickToBottomOptions) {\n this.scrollElement = options.scrollElement;\n this.contentElement = options.contentElement ?? options.scrollElement;\n this.threshold = options.threshold ?? ɵSCROLL_BOTTOM_THRESHOLD_PX;\n this.followBehavior = options.followBehavior ?? \"instant\";\n this.onChange = options.onChange;\n this.follow = options.follow ?? true;\n this.lastTop = this.scrollElement.scrollTop;\n this.lastMaxTop = this.maxTop();\n\n this.scrollElement.addEventListener(\"scroll\", this.update);\n this.scrollElement.addEventListener(\"scrollend\", this.handleScrollEnd);\n this.observeContent();\n\n if (this.follow) {\n this.scrollToEnd(options.initialBehavior ?? \"instant\");\n // The first layout can still move after mount (fonts, images, slots).\n if (typeof requestAnimationFrame === \"function\") {\n this.frame = requestAnimationFrame(() => {\n this.frame = null;\n this.followContent();\n });\n }\n } else {\n this.report();\n }\n }\n\n /**\n * `true` when the list shows its end, or when it follows new content and\n * is on its way there.\n */\n get isAtBottom() {\n return this.atBottom() || (this.follow && this.stuck);\n }\n\n /** Turn following new content on or off. */\n setFollow(follow: boolean) {\n if (this.follow === follow) return;\n this.follow = follow;\n this.followContent();\n this.report();\n }\n\n /**\n * Scroll to the end and follow new content again.\n *\n * @param behavior - Default: `\"smooth\"`.\n */\n scrollToBottom(behavior: ScrollBehavior = \"smooth\") {\n this.stuck = true;\n this.scrollToEnd(behavior);\n }\n\n /**\n * Read the scroll position again, as a scroll event does. Call it when the\n * framework handles scroll events itself.\n */\n readonly update = () => {\n const top = this.scrollElement.scrollTop;\n if (this.movedUp(top)) {\n // Any step up leaves the bottom, also one inside the threshold.\n this.leave();\n } else if (this.atBottom()) {\n this.stuck = true;\n this.smoothPending = false;\n } else if (top === this.programmaticTop) {\n // The scroll event of our own instant scroll. Content grew after it,\n // so the reader did not move away.\n } else if (this.smoothPending && top >= this.lastTop) {\n // A smooth scroll to the bottom is still moving down.\n } else {\n this.leave();\n }\n this.remember(top);\n this.report();\n };\n\n /** Stop listening and observing. */\n dispose() {\n this.scrollElement.removeEventListener(\"scroll\", this.update);\n this.scrollElement.removeEventListener(\"scrollend\", this.handleScrollEnd);\n for (const observer of this.observers) observer.disconnect();\n this.observers.length = 0;\n if (this.frame !== null && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(this.frame);\n }\n this.frame = null;\n }\n\n private readonly handleScrollEnd = () => {\n this.smoothPending = false;\n };\n\n private readonly followContent = () => {\n // The reader can move before the scroll event of that move arrives.\n const top = this.scrollElement.scrollTop;\n if (this.movedUp(top)) this.leave();\n this.remember(top);\n if (this.follow && this.stuck) this.scrollToEnd(this.followBehavior);\n else this.report();\n };\n\n private observeContent() {\n if (typeof ResizeObserver !== \"undefined\") {\n const resize = new ResizeObserver(this.followContent);\n resize.observe(this.scrollElement);\n if (this.contentElement !== this.scrollElement) {\n resize.observe(this.contentElement);\n }\n this.observers.push(resize);\n }\n if (typeof MutationObserver !== \"undefined\") {\n const mutation = new MutationObserver(this.followContent);\n mutation.observe(this.contentElement, {\n childList: true,\n subtree: true,\n characterData: true,\n });\n this.observers.push(mutation);\n }\n }\n\n private scrollToEnd(behavior: ScrollBehavior) {\n const element = this.scrollElement;\n const smooth = behavior === \"smooth\";\n if (typeof element.scrollTo === \"function\") {\n element.scrollTo({ top: element.scrollHeight, behavior });\n } else {\n element.scrollTop = element.scrollHeight;\n }\n this.smoothPending = smooth && !this.atBottom();\n this.programmaticTop = smooth ? null : element.scrollTop;\n this.remember(element.scrollTop);\n this.report();\n }\n\n /**\n * `scrollTop` went down since the last read because the reader scrolled\n * up. Not when the content (or the viewport) changed so that the browser\n * clamped `scrollTop`, and not for the controller's own scroll.\n */\n private movedUp(top: number) {\n const shrank = this.maxTop() < this.lastMaxTop;\n return top < this.lastTop && !shrank && top !== this.programmaticTop;\n }\n\n private leave() {\n this.stuck = false;\n this.smoothPending = false;\n this.programmaticTop = null;\n }\n\n private remember(top: number) {\n this.lastTop = top;\n this.lastMaxTop = this.maxTop();\n }\n\n private maxTop() {\n const element = this.scrollElement;\n return element.scrollHeight - element.clientHeight;\n }\n\n private atBottom() {\n return ɵisScrolledToBottom(this.scrollElement, this.threshold);\n }\n\n private report() {\n const next = this.isAtBottom;\n if (next === this.reported) return;\n this.reported = next;\n this.onChange?.(next);\n }\n}\n\n/**\n * Create the controller that keeps a message list at its bottom.\n *\n * @example\n * ```ts\n * const stick = ɵcreateStickToBottom({\n * scrollElement,\n * contentElement,\n * onChange: (isAtBottom) => (showButton = !isAtBottom),\n * });\n * button.onclick = () => stick.scrollToBottom();\n * stick.dispose(); // on unmount\n * ```\n */\nexport function ɵcreateStickToBottom(options: ɵStickToBottomOptions) {\n return new ɵStickToBottom(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,SAAgB,gBACd,OACA,UACA;AACA,KAAI,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM,CAAE,QAAO,GAAG,MAAM;AACzE,KAAI,OAAO,UAAU,YAAY,MAAM,MAAM,CAAC,SAAS,EAAG,QAAO,MAAM,MAAM;AAC7E,QAAO,GAAG,SAAS;;AAuBrB,MAAM,0BACJ;;;;;;;AAQF,IAAa,yBAAb,MAAoC;CAClC,AAAQ;CACR,AAAQ,WAAW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