@adea-ai/ui 0.152.0 → 0.152.2
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/components/composites/about-dialog/about-dialog.js +2 -2
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +3 -3
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +1 -1
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +3 -3
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +3 -3
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +1 -1
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +14 -1
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +1 -1
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +1 -1
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +2 -2
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
- package/dist/r/src/components/composites/terminal/terminal.tsx +2 -2
- package/dist/r/src/components/composites/update-dialog/channel-control.tsx +3 -3
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +3 -5
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
- package/dist/r/src/components/conversation/message-composer.tsx +1 -2
- package/dist/r/src/components/conversation/scroll-follow.ts +24 -1
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +1 -1
- package/dist/r/src/components/theme/appearance-panel.tsx +2 -4
- package/dist/vite/tailwind-sources.d.ts.map +1 -1
- package/dist/vite/tailwind-sources.js +49 -9
- package/dist/vite/tailwind-sources.js.map +1 -1
- package/package.json +1 -1
- package/src/components/composites/about-dialog/about-dialog.tsx +2 -2
- package/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
- package/src/components/composites/terminal/terminal.tsx +2 -2
- package/src/components/composites/update-dialog/channel-control.tsx +3 -3
- package/src/components/composites/update-dialog/update-dialog.tsx +3 -5
- package/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
- package/src/components/conversation/message-composer.tsx +1 -2
- package/src/components/conversation/scroll-follow.ts +24 -1
- package/src/components/layout/split-layout/split-layout.tsx +1 -1
- package/src/components/theme/appearance-panel.tsx +2 -4
- package/src/vite/tailwind-sources.ts +67 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-dialog.js","names":["createEffect","createMemo","createSignal","onCleanup","onMount","Show","splitProps","Accessor","JSX","Check","CircleStop","Download","ExternalLink","LoaderCircle","Monitor","RefreshCw","Sparkles","Badge","Button","ActionButton","Dialog","DialogClose","DialogContent","DialogDescription","DialogFooter","DialogHeader","DialogTitle","DialogTrigger","Progress","Heading","cn","formatBytes","formatReleaseDate","plainTextFromMarkdown","errorMessage","installedVersion","isActionable","isBusy","isInFlight","progressPercent","triggerLabel","describeTrigger","withPendingCancel","UpdateState","UpdatePhase","UpdateAdapter","Readonly","getStatus","Promise","check","install","expectedVersion","cancel","pollIntervalMs","openExternal","url","isDesktopRuntime","ChannelControlActions","disabled","recheck","beforeCheck","UpdateDialogProps","adapter","appName","appIcon","changelog","fallbackVersion","desktopOnlyMessage","channelControl","actions","Element","open","defaultOpen","onOpenChange","restoreFocusRef","HTMLElement","class","UpdateDialog","props","local","uncontrolledOpen","setUncontrolledOpen","setOpen","next","undefined","desktop","state","setState","busy","setBusy","error","setError","checkFailed","setCheckFailed","cancelPending","setCancelPending","lifecycleEpoch","activeOpenEpoch","channelCheckUnconfirmed","disposed","sessionGuard","epoch","failDiscardedCheck","message","fallback","phase","currentVersion","failCheck","loadStatus","isCurrent","status","previous","ignoresUnconfirmedChannelSnapshot","preservesSnapshot","caught","applyCheckResult","preserveOnFailure","current","clearStaleOffer","working","discardStaleOffer","channelSaved","checked","version","availableVersion","downloadedBytes","totalBytes","active","requestInFlight","timer","window","setInterval","Math","max","clearInterval","openRelease","notes","value","releaseNotes","channelControlDisabled","recheckChannel","progressValue","_$createComponent","children","when","as","variant","size","aria-label","_$memo","positioner","closeLabel","initialFocus","_el$","_tmpl$","_el$2","firstChild","_$insert","icon","_el$34","_tmpl$0","_$effect","_$setAttribute","_el$3","_tmpl$9","_el$4","_el$5","_el$6","_el$7","_el$8","nextSibling","_el$9","tone","type","tooltip","onClick","_el$0","_tmpl$2","_el$1","_el$35","_tmpl$1","_el$10","_tmpl$3","_el$11","_el$12","_el$13","_el$14","_el$16","_el$15","_el$17","_el$18","_el$20","_el$19","releaseDate","released","_el$36","_tmpl$10","_el$37","_el$21","_tmpl$4","_el$22","_el$23","_tmpl$5","restartRequired","_el$24","_tmpl$6","_el$25","_tmpl$7","_el$26","_el$27","_el$28","_el$29","_tmpl$8","_el$30","_el$31","_el$32","_el$33","releaseUrl","triggerLabel","describeTrigger","_$createComponent","_$memo","_$setAttribute"],"sources":["../../../../src/components/composites/update-dialog/update-dialog.tsx"],"sourcesContent":["import {\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n onMount,\n Show,\n splitProps,\n} from 'solid-js'\nimport type { Accessor, JSX } from 'solid-js'\nimport {\n Check,\n CircleStop,\n Download,\n ExternalLink,\n LoaderCircle,\n Monitor,\n RefreshCw,\n Sparkles,\n} from 'lucide-solid'\nimport { Badge } from '../../ui/badge'\nimport { Button } from '../../ui/button'\nimport { ActionButton } from '../action-button'\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from '../../ui/dialog'\nimport { Progress } from '../../ui/progress'\nimport { Heading } from '../../ui/typography'\nimport { cn } from '#lib/utils'\nimport { formatBytes, formatReleaseDate, plainTextFromMarkdown } from '#lib/version-notes'\nimport {\n errorMessage,\n installedVersion,\n isActionable,\n isBusy,\n isInFlight,\n progressPercent,\n triggerLabel as describeTrigger,\n withPendingCancel,\n type UpdateState,\n} from './update-model'\n\n/**\n * UpdateDialog.\n *\n * A software-update surface: the installed version, whether a newer release\n * exists, a download that shows its progress, and the release notes for what is\n * about to arrive.\n *\n * The transport is an adapter, because an update is the one thing a component\n * library genuinely cannot implement: it is signed, downloaded and applied by the\n * application's own updater, and the mechanism differs per shell. What *is*\n * general is the phase machine and the way each phase is presented — and that is\n * where the hard-won detail lives:\n *\n * **A refused install answers with a normal payload, not a rejection.** adea's\n * shell returns a status whose phase is `failed` when a download or an extract\n * fails, rather than throwing. Without handling that, clicking install looked like\n * nothing happened at all — the button spun, the phase never changed, and the\n * error sat unread in a field nobody rendered. The `failed` phase after an install\n * is therefore surfaced as an error, explicitly.\n *\n * **Busy is derived from the snapshot as well as from the click.** An update can\n * be downloading while the dialog is open — started before it opened, or by the\n * shell's own poll — so a local `busy` flag alone would offer an enabled Install\n * button mid-download.\n *\n * **Opening the dialog loads status first, then checks.** Status paints the\n * installed version immediately; the check is a network round trip. Doing them in\n * the other order leaves the dialog blank for as long as the check takes, on a\n * dialog whose first question is always \"what am I running?\".\n *\n * **A failed check is not a current result.** A cached `current` status can only\n * be shown as up to date after the latest check succeeds; a failed check remains\n * retryable and suppresses that claim.\n *\n * **Errors are not always `Error`s.** An adapter can reject with a string or a\n * structured safe message. Unknown object fields are never serialized into the\n * UI; a generic fallback is shown instead.\n *\n * The adapter's `isDesktopRuntime` gate exists because an update is a desktop\n * concern: a browser build has no installer, and the honest thing to show is that\n * updates are available in the desktop application rather than a disabled button\n * with no reason.\n */\n\nexport type { UpdatePhase, UpdateState } from './update-model'\n\n/**\n * The updater, as the application exposes it. Three calls, each answering with a\n * full snapshot rather than a delta — an updater's state is small, and a snapshot\n * cannot drift from the shell's own view of it.\n */\nexport type UpdateAdapter = Readonly<{\n /** The current state, without contacting the release channel. */\n getStatus(): Promise<UpdateState>\n /** Ask the release channel, and answer with what it found. */\n check(): Promise<UpdateState>\n /**\n * Download and apply `expectedVersion`.\n *\n * The argument is the version the caller believes is available, so the updater\n * can refuse a request that raced a newer release rather than installing the\n * wrong one.\n */\n install(expectedVersion: string): Promise<UpdateState>\n /** Optional native cancellation, available only while work is in flight. */\n cancel?(): Promise<UpdateState>\n /** Enable status polling during native work; omit for push-driven adapters. */\n pollIntervalMs?: number\n /** Route external links through the native shell when needed. */\n openExternal?(url: string): Promise<void>\n /** False in a browser build, where there is no installer to drive. */\n isDesktopRuntime(): boolean\n}>\n\nexport type ChannelControlActions = Readonly<{\n /** Disabled while the app is checking, downloading, installing, or saving a channel. */\n disabled: Accessor<boolean>\n /** Persist a channel change, then check that channel without retaining a stale offer. */\n recheck(beforeCheck?: () => Promise<void>): Promise<void>\n}>\n\nexport type UpdateDialogProps = {\n adapter: UpdateAdapter\n /** The application's name, used in the title and the copy. */\n appName?: string\n /** The actual desktop application icon, supplied by its host. */\n appIcon?: string\n /** Complete build-time history, also available before the native status arrives. */\n changelog?: string\n /** Shown before the first status arrives, so the dialog is never blank. */\n fallbackVersion?: string\n /** Copy for the adapter's non-desktop case. */\n desktopOnlyMessage?: string\n /**\n * Optional host-owned release-channel control, rendered in the version status\n * card. The host owns its accessible label and calls `recheck` after a selection;\n * the optional callback persists that selection before the dialog checks it.\n */\n channelControl?: (actions: ChannelControlActions) => JSX.Element\n /** A controlled open state. Omit for the trigger to manage its own. */\n open?: boolean\n /**\n * Start open, uncontrolled — for a caller that opens the dialog because it found\n * something (\"an update is available\") rather than because the user asked. The\n * trigger is still rendered, so the dialog is reachable again after closing.\n */\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /**\n * Supplies a stable external control to focus when a controlled dialog closes.\n * Useful when a menu or other layer closes before this dialog opens; when omitted,\n * the element focused immediately before the dialog opens is used when available.\n */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n /** Render only the panel, for a caller that provides its own dialog. */\n class?: string\n}\n\nexport function UpdateDialog(props: UpdateDialogProps) {\n const [local] = splitProps(props, [\n 'adapter',\n 'appName',\n 'appIcon',\n 'changelog',\n 'fallbackVersion',\n 'desktopOnlyMessage',\n 'channelControl',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'restoreFocusRef',\n 'class',\n ])\n\n const [uncontrolledOpen, setUncontrolledOpen] = createSignal(local.defaultOpen ?? false)\n const open = () => local.open ?? uncontrolledOpen()\n const setOpen = (next: boolean) => {\n if (local.open === undefined) setUncontrolledOpen(next)\n local.onOpenChange?.(next)\n }\n\n const appName = () => local.appName ?? 'the application'\n const desktop = () => local.adapter.isDesktopRuntime()\n const [state, setState] = createSignal<UpdateState | null>(null)\n const [busy, setBusy] = createSignal(false)\n const [error, setError] = createSignal('')\n const [checkFailed, setCheckFailed] = createSignal(false)\n const [cancelPending, setCancelPending] = createSignal(false)\n let lifecycleEpoch = 0\n let activeOpenEpoch: number | undefined\n let channelCheckUnconfirmed = false\n let disposed = false\n\n onCleanup(() => {\n disposed = true\n activeOpenEpoch = undefined\n lifecycleEpoch += 1\n })\n\n // Every async step belongs to the open session it started in: once the dialog\n // closes, reopens or unmounts, a late answer must not write into it.\n const sessionGuard =\n (epoch = activeOpenEpoch) =>\n () =>\n !disposed &&\n epoch !== undefined &&\n activeOpenEpoch === epoch &&\n lifecycleEpoch === epoch &&\n open()\n\n /** A check that failed after a channel change: there is no offer to keep showing. */\n const failDiscardedCheck = (message: string, fallback: string) => {\n setState({ phase: 'failed', currentVersion: state()?.currentVersion ?? '', error: message })\n failCheck(message, fallback)\n }\n\n const loadStatus = async (isCurrent: () => boolean = () => !disposed) => {\n if (!desktop() || !isCurrent()) return\n try {\n const status = await local.adapter.getStatus()\n const previous = state()\n const ignoresUnconfirmedChannelSnapshot = channelCheckUnconfirmed && isActionable(status)\n const preservesSnapshot =\n previous?.phase === 'available'\n ? status.phase === 'available' || isBusy(status)\n : isBusy(previous) && isBusy(status)\n if (\n isCurrent() &&\n !ignoresUnconfirmedChannelSnapshot &&\n !(checkFailed() && isActionable(previous) && !preservesSnapshot)\n ) {\n setState(status)\n }\n } catch (caught) {\n if (isCurrent()) setError(errorMessage(caught, 'Version status is unavailable'))\n }\n }\n\n onMount(() => {\n if (desktop() && !open()) {\n const epoch = lifecycleEpoch\n void loadStatus(() => !disposed && lifecycleEpoch === epoch)\n }\n })\n\n const failCheck = (caught: unknown, fallback: string) => {\n const message = errorMessage(caught, fallback)\n setCheckFailed(true)\n setError(message)\n }\n\n const applyCheckResult = (next: UpdateState, preserveOnFailure = true) => {\n if (next.phase === 'failed') {\n const current = state()\n if (!current || !preserveOnFailure) setState(next)\n failCheck(next.error, 'Could not check for updates')\n return\n }\n setState(next)\n setCheckFailed(false)\n setError('')\n }\n\n const check = async (\n beforeCheck?: () => Promise<void>,\n clearStaleOffer = beforeCheck !== undefined\n ) => {\n if (!desktop()) {\n setError(local.desktopOnlyMessage ?? `Update checks are available from the desktop app.`)\n return\n }\n const isCurrent = sessionGuard()\n if (!isCurrent()) return\n if (clearStaleOffer && working()) return\n if (clearStaleOffer) channelCheckUnconfirmed = true\n const discardStaleOffer = clearStaleOffer || channelCheckUnconfirmed\n setBusy(true)\n setError('')\n setCheckFailed(false)\n if (discardStaleOffer) {\n const current = state()\n if (current) setState({ phase: 'checking', currentVersion: current.currentVersion })\n }\n let channelSaved = beforeCheck === undefined\n try {\n await beforeCheck?.()\n channelSaved = true\n if (!isCurrent()) return\n const checked = await local.adapter.check()\n if (isCurrent()) {\n applyCheckResult(checked, !discardStaleOffer)\n if (discardStaleOffer && checked.phase !== 'failed') channelCheckUnconfirmed = false\n }\n } catch (caught) {\n if (isCurrent()) {\n if (discardStaleOffer) {\n const fallback = channelSaved\n ? 'Could not check for updates'\n : 'Could not save the update channel'\n failDiscardedCheck(errorMessage(caught, fallback), fallback)\n } else {\n failCheck(caught, 'Could not check for updates')\n await loadStatus(isCurrent)\n }\n }\n } finally {\n if (isCurrent()) setBusy(false)\n }\n }\n\n // Opening loads status first, then checks (see the header). Unlike `check`,\n // a failure here does not reload the status it has just asked for.\n createEffect(() => {\n if (!open() || !desktop()) {\n setCancelPending(false)\n if (activeOpenEpoch !== undefined) {\n activeOpenEpoch = undefined\n lifecycleEpoch += 1\n }\n return\n }\n const epoch = ++lifecycleEpoch\n activeOpenEpoch = epoch\n const isCurrent = sessionGuard(epoch)\n onCleanup(() => {\n if (activeOpenEpoch === epoch) {\n activeOpenEpoch = undefined\n lifecycleEpoch += 1\n }\n })\n setError('')\n setCheckFailed(false)\n setCancelPending(false)\n setBusy(true)\n void (async () => {\n try {\n const current = await local.adapter.getStatus()\n if (!isCurrent()) return\n const discardStaleOffer = channelCheckUnconfirmed\n setState(\n discardStaleOffer\n ? { phase: 'checking', currentVersion: current.currentVersion }\n : current\n )\n const checked = await local.adapter.check()\n if (isCurrent()) {\n applyCheckResult(checked, !discardStaleOffer)\n if (discardStaleOffer && checked.phase !== 'failed') channelCheckUnconfirmed = false\n }\n } catch (caught) {\n if (isCurrent()) {\n if (channelCheckUnconfirmed) {\n failDiscardedCheck(\n errorMessage(caught, 'Could not check for updates'),\n 'Could not check for updates'\n )\n } else {\n failCheck(caught, 'Could not check for updates')\n }\n }\n } finally {\n if (isCurrent()) setBusy(false)\n }\n })()\n })\n\n const install = async () => {\n const version = state()?.availableVersion\n const isCurrent = sessionGuard()\n if (!version || !isCurrent()) return\n setBusy(true)\n setError('')\n setState((current) =>\n current ? { ...current, phase: 'downloading', downloadedBytes: 0, totalBytes: null } : current\n )\n try {\n const next = await local.adapter.install(version)\n if (!isCurrent()) return\n setState(withPendingCancel(next, cancelPending()))\n // A refused install answers with a normal payload whose phase is `failed`.\n // Without this the click looked like nothing happened.\n if (next.phase === 'failed') {\n setError(errorMessage(next.error, 'Update installation failed'))\n } else {\n setCheckFailed(false)\n }\n } catch (caught) {\n if (!isCurrent()) return\n setError(errorMessage(caught, 'Update installation failed'))\n await loadStatus(isCurrent)\n } finally {\n if (isCurrent()) setBusy(false)\n }\n }\n\n // Poll only an open, active native operation. Epoch ownership prevents a late\n // status response from replacing a reopened dialog's newer snapshot.\n createEffect(() => {\n const phase = state()?.phase\n if (!open() || !desktop() || !local.adapter.pollIntervalMs || !isInFlight(phase)) return\n const isCurrent = sessionGuard()\n let active = true\n let requestInFlight = false\n const timer = window.setInterval(\n () => {\n if (requestInFlight) return\n requestInFlight = true\n void (async () => {\n try {\n const next = await local.adapter.getStatus()\n if (!active || !isCurrent()) return\n setState(withPendingCancel(next, cancelPending()))\n if (next.phase === 'failed')\n setError(errorMessage(next.error, 'Update installation failed'))\n } catch (caught) {\n if (active && isCurrent())\n setError(errorMessage(caught, 'Update progress is unavailable'))\n } finally {\n requestInFlight = false\n }\n })()\n },\n Math.max(250, local.adapter.pollIntervalMs)\n )\n onCleanup(() => {\n active = false\n window.clearInterval(timer)\n })\n })\n\n const cancel = async () => {\n if (!local.adapter.cancel || cancelPending() || state()?.phase === 'cancelling') return\n const isCurrent = sessionGuard()\n setError('')\n setCancelPending(true)\n setState((current) => (current ? { ...current, phase: 'cancelling' } : current))\n try {\n const next = await local.adapter.cancel()\n if (isCurrent()) setState(next)\n } catch (caught) {\n if (isCurrent()) {\n setError(errorMessage(caught, 'Could not cancel the update'))\n await loadStatus(isCurrent)\n }\n } finally {\n if (isCurrent()) setCancelPending(false)\n }\n }\n\n const openRelease = async (url: string) => {\n try {\n if (local.adapter.openExternal) await local.adapter.openExternal(url)\n else window.open(url, '_blank', 'noopener,noreferrer')\n } catch (caught) {\n if (!disposed) setError(errorMessage(caught, 'Could not open the release page'))\n }\n }\n\n const changelog = createMemo(() =>\n plainTextFromMarkdown(state()?.changelog || local.changelog || '')\n )\n const notes = () => {\n const value = state()?.releaseNotes\n return value ? plainTextFromMarkdown(value) : ''\n }\n const working = () => busy() || cancelPending() || isBusy(state())\n const channelControlDisabled = () => !desktop() || working()\n const recheckChannel = (beforeCheck?: () => Promise<void>) => check(beforeCheck, true)\n const isCurrent = () => state()?.phase === 'current' && !error() && !checkFailed() && !working()\n\n const triggerLabel = () =>\n describeTrigger({\n state: state(),\n checkFailed: checkFailed(),\n appName: appName(),\n fallbackVersion: local.fallbackVersion,\n })\n const progressValue = () => progressPercent(state())\n\n return (\n <Dialog open={open()} onOpenChange={setOpen}>\n <Show when={local.open === undefined}>\n <DialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Open version and updates: ${triggerLabel()}`}\n aria-haspopup=\"dialog\"\n >\n <Show when={state()?.phase === 'available'} fallback={<RefreshCw aria-hidden=\"true\" />}>\n <Sparkles aria-hidden=\"true\" />\n </Show>\n {triggerLabel()}\n </DialogTrigger>\n </Show>\n\n {/* The footer keeps the visible \"Close\"; the corner icon is named for the\n dialog so the two controls stay distinct to assistive tech. */}\n <DialogContent\n positioner=\"inset\"\n closeLabel=\"Close version and updates\"\n class={cn('flex max-h-full min-h-0 max-w-3xl flex-col overflow-hidden', local.class)}\n initialFocus=\"panel\"\n restoreFocusRef={local.restoreFocusRef}\n >\n <DialogHeader class=\"shrink-0\">\n <div class=\"flex items-center gap-3\">\n <Show\n when={local.appIcon}\n fallback={<Monitor class=\"size-10 text-primary\" aria-hidden=\"true\" />}\n >\n {(icon) => <img src={icon()} alt=\"\" class=\"size-10\" aria-hidden=\"true\" />}\n </Show>\n <div>\n <DialogTitle>Version & updates</DialogTitle>\n <DialogDescription>\n Keep {appName()} current and review what changed in each release.\n </DialogDescription>\n </div>\n </div>\n </DialogHeader>\n\n <div\n data-slot=\"update-dialog-scroll-region\"\n class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-5 overflow-y-auto p-6\"\n >\n <section\n class=\"rounded-xl border border-border bg-background/45 p-4\"\n aria-label=\"Version status\"\n >\n <div class=\"flex flex-wrap items-start justify-between gap-4\">\n <div class=\"flex flex-col gap-1\">\n <p class=\"text-2xs font-semibold tracking-widest text-muted-foreground uppercase\">\n Installed version\n </p>\n <Heading as=\"p\" size=\"page\" tone=\"foreground\">\n v{installedVersion(state(), local.fallbackVersion)}\n </Heading>\n <p class=\"text-sm text-muted-foreground\">\n <Show\n when={isCurrent()}\n fallback={\n <Show\n when={state()?.phase === 'available' && state()?.availableVersion}\n fallback={\n state()?.phase === 'unavailable'\n ? 'No signed package is published for this platform.'\n : state()?.phase === 'cancelled'\n ? 'Update cancelled. You can retry when ready.'\n : desktop()\n ? 'Check the release channel for the latest signed build.'\n : (local.desktopOnlyMessage ??\n `Open this dialog inside the desktop app to check for updates.`)\n }\n >\n {`A newer release, v${state()?.availableVersion}, is ready.`}\n </Show>\n }\n >\n You are running the latest release.\n </Show>\n </p>\n </div>\n <div class=\"flex flex-col items-end gap-2\">\n <ActionButton\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n tooltip=\"Check the release channel for the latest signed app version.\"\n disabled={!desktop() || working()}\n onClick={() => void check()}\n >\n <Show when={working()} fallback={<RefreshCw aria-hidden=\"true\" />}>\n <LoaderCircle class=\"animate-spin\" aria-hidden=\"true\" />\n </Show>\n {checkFailed() ? 'Retry update check' : 'Check latest version'}\n </ActionButton>\n {/* The up-to-date confirmation reads as the button's outcome,\n so it sits directly beneath it rather than floating as a\n full-width row between sections. */}\n <Show when={isCurrent()}>\n <p class=\"text-foreground flex items-center gap-2 text-sm\" role=\"status\">\n <Check class=\"size-4 text-success\" aria-hidden=\"true\" />\n {appName()} is up to date.\n </p>\n </Show>\n </div>\n </div>\n <Show when={local.channelControl}>\n {(channelControl) => (\n <div class=\"mt-4 border-t border-border pt-4\">\n {channelControl()({\n disabled: channelControlDisabled,\n recheck: recheckChannel,\n })}\n </div>\n )}\n </Show>\n </section>\n\n <Show\n when={\n state()?.availableVersion &&\n state()?.phase !== 'installed' &&\n state()?.phase !== 'unavailable'\n }\n >\n <section\n class=\"rounded-xl border border-primary/35 bg-primary-subtle p-4\"\n aria-label=\"Available update\"\n >\n <div class=\"flex flex-wrap items-start justify-between gap-4\">\n <div class=\"flex flex-col gap-1\">\n <p class=\"flex items-center gap-2 text-sm font-semibold\">\n <Sparkles class=\"size-4 text-primary\" aria-hidden=\"true\" />\n Version {state()?.availableVersion}{' '}\n {isInFlight(state()?.phase) ? 'is being prepared' : 'is ready'}\n </p>\n <p class=\"text-sm text-muted-foreground\">\n The signed installer is verified before {appName()} restarts.\n </p>\n <Show when={formatReleaseDate(state()?.releaseDate ?? null)}>\n {(released) => (\n <p class=\"text-xs text-muted-foreground\">Released {released()}</p>\n )}\n </Show>\n </div>\n <ActionButton\n type=\"button\"\n size=\"sm\"\n tooltip={`Download the signed update and restart ${appName()}.`}\n disabled={working()}\n onClick={() => void install()}\n >\n <Show when={working()} fallback={<Download aria-hidden=\"true\" />}>\n <LoaderCircle class=\"animate-spin\" aria-hidden=\"true\" />\n </Show>\n Install and restart\n </ActionButton>\n </div>\n </section>\n </Show>\n\n {/*\n Progress with both numbers: a bar alone does not distinguish a stalled\n download from a slow one, and \"12.4 MB of 48.1 MB\" does.\n */}\n <Show when={isInFlight(state()?.phase)}>\n <section class=\"grid gap-2\" aria-label=\"Update progress\">\n <Progress\n value={progressValue() ?? undefined}\n aria-label={\n state()?.phase === 'installing' ? 'Installing update' : 'Downloading update'\n }\n />\n <p class=\"text-xs text-muted-foreground\" role=\"status\">\n <Show\n when={state()?.phase === 'installing'}\n fallback={\n <Show when={progressValue() !== null} fallback=\"Downloading…\">\n {`${formatBytes(state()?.downloadedBytes ?? 0)} of ${formatBytes(\n state()?.totalBytes ?? 0\n )} · ${progressValue()}%`}\n </Show>\n }\n >\n Applying the update…\n </Show>\n </p>\n <Show when={local.adapter.cancel}>\n <ActionButton\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n tooltip=\"Stop the current update download or installation.\"\n disabled={cancelPending() || state()?.phase === 'cancelling'}\n onClick={() => void cancel()}\n >\n <CircleStop aria-hidden=\"true\" />\n {cancelPending() || state()?.phase === 'cancelling'\n ? 'Cancelling…'\n : 'Cancel update'}\n </ActionButton>\n </Show>\n </section>\n </Show>\n\n <Show when={state()?.phase === 'installed'}>\n <p class=\"text-foreground flex items-center gap-2 text-sm\" role=\"status\">\n <Check class=\"size-4 text-success\" aria-hidden=\"true\" />\n <Show when={state()?.restartRequired} fallback=\"The update is applied.\">\n Restart {appName()} to finish the update.\n </Show>\n </p>\n </Show>\n\n <Show when={error()}>\n <p\n class=\"text-foreground rounded-lg border border-destructive/35 bg-destructive-subtle px-3 py-2 text-sm\"\n role=\"alert\"\n >\n {error()}\n </p>\n </Show>\n\n <Show when={notes()}>\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center gap-2\">\n <h2 id=\"update-release-notes\" class=\"text-sm font-semibold text-foreground\">\n What changed in this release\n </h2>\n <Badge variant=\"subtle\" size=\"sm\">\n v{state()?.availableVersion}\n </Badge>\n </div>\n {/* A long text block with no focusable descendant: it needs its own tab\n stop, named by the heading above it, or a keyboard user cannot\n scroll it (`scrollable-region-focusable`). */}\n <div\n class=\"max-h-52 overflow-y-auto rounded-xl border border-border bg-background/45 p-4 font-code text-code leading-5 whitespace-pre-wrap text-muted-foreground\"\n role=\"region\"\n aria-labelledby=\"update-release-notes\"\n tabindex=\"0\"\n >\n {notes()}\n </div>\n </div>\n </Show>\n\n <Show when={changelog()}>\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center gap-2\">\n <h2 id=\"update-changelog\" class=\"text-sm font-semibold text-foreground\">\n Installed changelog\n </h2>\n {/* The version pill identifies which build's history this is —\n the same treatment the available-update heading carries. */}\n <Badge variant=\"subtle\" size=\"sm\">\n v{installedVersion(state(), local.fallbackVersion)}\n </Badge>\n </div>\n <p class=\"text-xs text-muted-foreground\">\n All versions and updates included with this installation.\n </p>\n {/* A long text block with no focusable descendant: it needs its own tab\n stop, named by the heading above it, or a keyboard user cannot\n scroll it (`scrollable-region-focusable`). */}\n <div\n class=\"max-h-72 overflow-y-auto rounded-xl border border-border bg-background/45 p-4 font-code text-code leading-5 whitespace-pre-wrap text-muted-foreground\"\n role=\"region\"\n aria-labelledby=\"update-changelog\"\n tabindex=\"0\"\n >\n {changelog()}\n </div>\n </div>\n </Show>\n </div>\n\n <DialogFooter>\n <Show when={state()?.releaseUrl}>\n {(url) => (\n <ActionButton\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n tooltip=\"Open the release history in your browser.\"\n // `noopener,noreferrer` because the release page is a different\n // origin and must not get a handle on this window.\n onClick={() => void openRelease(url())}\n >\n <ExternalLink aria-hidden=\"true\" />\n View releases\n </ActionButton>\n )}\n </Show>\n <DialogClose as={Button} variant=\"outline\" size=\"sm\" aria-label=\"Close\">\n Close\n </DialogClose>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuKA,SAAgB6E,aAAaC,OAA0B;CACrD,MAAM,CAACC,SAASzE,WAAWwE,OAAO;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAM,CAACE,kBAAkBC,uBAAuB/E,aAAa6E,MAAMP,eAAe,KAAK;CACvF,MAAMD,aAAaQ,MAAMR,QAAQS,iBAAiB;CAClD,MAAME,WAAWC,SAAkB;EACjC,IAAIJ,MAAMR,SAASa,KAAAA,GAAWH,oBAAoBE,IAAI;EACtDJ,MAAMN,eAAeU,IAAI;CAC3B;CAEA,MAAMpB,gBAAgBgB,MAAMhB,WAAW;CACvC,MAAMsB,gBAAgBN,MAAMjB,QAAQN,iBAAiB;CACrD,MAAM,CAAC8B,OAAOC,YAAYrF,aAAiC,IAAI;CAC/D,MAAM,CAACsF,MAAMC,WAAWvF,aAAa,KAAK;CAC1C,MAAM,CAACw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":3,"file":"update-dialog.js","names":["createEffect","createMemo","createSignal","onCleanup","onMount","Show","splitProps","Accessor","JSX","Check","CircleStop","Download","ExternalLink","LoaderCircle","Monitor","RefreshCw","Sparkles","Badge","Button","ActionButton","Dialog","DialogClose","DialogContent","DialogDescription","DialogFooter","DialogHeader","DialogTitle","DialogTrigger","Progress","Heading","cn","formatBytes","formatReleaseDate","plainTextFromMarkdown","errorMessage","installedVersion","isActionable","isBusy","isInFlight","progressPercent","triggerLabel","describeTrigger","withPendingCancel","UpdateState","UpdatePhase","UpdateAdapter","Readonly","getStatus","Promise","check","install","expectedVersion","cancel","pollIntervalMs","openExternal","url","isDesktopRuntime","ChannelControlActions","disabled","recheck","beforeCheck","UpdateDialogProps","adapter","appName","appIcon","changelog","fallbackVersion","desktopOnlyMessage","channelControl","actions","Element","open","defaultOpen","onOpenChange","restoreFocusRef","HTMLElement","class","UpdateDialog","props","local","uncontrolledOpen","setUncontrolledOpen","setOpen","next","undefined","desktop","state","setState","busy","setBusy","error","setError","checkFailed","setCheckFailed","cancelPending","setCancelPending","lifecycleEpoch","activeOpenEpoch","channelCheckUnconfirmed","disposed","sessionGuard","epoch","failDiscardedCheck","message","fallback","phase","currentVersion","failCheck","loadStatus","isCurrent","status","previous","ignoresUnconfirmedChannelSnapshot","preservesSnapshot","caught","applyCheckResult","preserveOnFailure","current","clearStaleOffer","working","discardStaleOffer","channelSaved","checked","version","availableVersion","downloadedBytes","totalBytes","active","requestInFlight","timer","window","setInterval","Math","max","clearInterval","openRelease","notes","value","releaseNotes","channelControlDisabled","recheckChannel","progressValue","_$createComponent","children","when","as","variant","size","aria-label","_$memo","positioner","closeLabel","initialFocus","_el$","_tmpl$","_el$2","firstChild","_$insert","icon","_el$34","_tmpl$0","_$effect","_$setAttribute","_el$3","_tmpl$9","_el$4","_el$5","_el$6","_el$7","_el$8","nextSibling","_el$9","tone","type","tooltip","onClick","_el$0","_tmpl$2","_el$1","_el$35","_tmpl$1","_el$10","_tmpl$3","_el$11","_el$12","_el$13","_el$14","_el$16","_el$15","_el$17","_el$18","_el$20","_el$19","releaseDate","released","_el$36","_tmpl$10","_el$37","_el$21","_tmpl$4","_el$22","_el$23","_tmpl$5","restartRequired","_el$24","_tmpl$6","_el$25","_tmpl$7","_el$26","_el$27","_el$28","_el$29","_tmpl$8","_el$30","_el$31","_el$32","_el$33","releaseUrl","triggerLabel","describeTrigger","_$createComponent","_$memo","_$setAttribute"],"sources":["../../../../src/components/composites/update-dialog/update-dialog.tsx"],"sourcesContent":["import {\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n onMount,\n Show,\n splitProps,\n} from 'solid-js'\nimport type { Accessor, JSX } from 'solid-js'\nimport {\n Check,\n CircleStop,\n Download,\n ExternalLink,\n LoaderCircle,\n Monitor,\n RefreshCw,\n Sparkles,\n} from 'lucide-solid'\nimport { Badge } from '../../ui/badge'\nimport { Button } from '../../ui/button'\nimport { ActionButton } from '../action-button'\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from '../../ui/dialog'\nimport { Progress } from '../../ui/progress'\nimport { Heading } from '../../ui/typography'\nimport { cn } from '#lib/utils'\nimport { formatBytes, formatReleaseDate, plainTextFromMarkdown } from '#lib/version-notes'\nimport {\n errorMessage,\n installedVersion,\n isActionable,\n isBusy,\n isInFlight,\n progressPercent,\n triggerLabel as describeTrigger,\n withPendingCancel,\n type UpdateState,\n} from './update-model'\n\n/**\n * UpdateDialog.\n *\n * A software-update surface: the installed version, whether a newer release\n * exists, a download that shows its progress, and the release notes for what is\n * about to arrive.\n *\n * The transport is an adapter, because an update is the one thing a component\n * library genuinely cannot implement: it is signed, downloaded and applied by the\n * application's own updater, and the mechanism differs per shell. What *is*\n * general is the phase machine and the way each phase is presented — and that is\n * where the hard-won detail lives:\n *\n * **A refused install answers with a normal payload, not a rejection.** adea's\n * shell returns a status whose phase is `failed` when a download or an extract\n * fails, rather than throwing. Without handling that, clicking install looked like\n * nothing happened at all — the button spun, the phase never changed, and the\n * error sat unread in a field nobody rendered. The `failed` phase after an install\n * is therefore surfaced as an error, explicitly.\n *\n * **Busy is derived from the snapshot as well as from the click.** An update can\n * be downloading while the dialog is open — started before it opened, or by the\n * shell's own poll — so a local `busy` flag alone would offer an enabled Install\n * button mid-download.\n *\n * **Opening the dialog loads status first, then checks.** Status paints the\n * installed version immediately; the check is a network round trip. Doing them in\n * the other order leaves the dialog blank for as long as the check takes, on a\n * dialog whose first question is always \"what am I running?\".\n *\n * **A failed check is not a current result.** A cached `current` status can only\n * be shown as up to date after the latest check succeeds; a failed check remains\n * retryable and suppresses that claim.\n *\n * **Errors are not always `Error`s.** An adapter can reject with a string or a\n * structured safe message. Unknown object fields are never serialized into the\n * UI; a generic fallback is shown instead.\n *\n * The adapter's `isDesktopRuntime` gate exists because an update is a desktop\n * concern: a browser build has no installer, and the honest thing to show is that\n * updates are available in the desktop application rather than a disabled button\n * with no reason.\n */\n\nexport type { UpdatePhase, UpdateState } from './update-model'\n\n/**\n * The updater, as the application exposes it. Three calls, each answering with a\n * full snapshot rather than a delta — an updater's state is small, and a snapshot\n * cannot drift from the shell's own view of it.\n */\nexport type UpdateAdapter = Readonly<{\n /** The current state, without contacting the release channel. */\n getStatus(): Promise<UpdateState>\n /** Ask the release channel, and answer with what it found. */\n check(): Promise<UpdateState>\n /**\n * Download and apply `expectedVersion`.\n *\n * The argument is the version the caller believes is available, so the updater\n * can refuse a request that raced a newer release rather than installing the\n * wrong one.\n */\n install(expectedVersion: string): Promise<UpdateState>\n /** Optional native cancellation, available only while work is in flight. */\n cancel?(): Promise<UpdateState>\n /** Enable status polling during native work; omit for push-driven adapters. */\n pollIntervalMs?: number\n /** Route external links through the native shell when needed. */\n openExternal?(url: string): Promise<void>\n /** False in a browser build, where there is no installer to drive. */\n isDesktopRuntime(): boolean\n}>\n\nexport type ChannelControlActions = Readonly<{\n /** Disabled while the app is checking, downloading, installing, or saving a channel. */\n disabled: Accessor<boolean>\n /** Persist a channel change, then check that channel without retaining a stale offer. */\n recheck(beforeCheck?: () => Promise<void>): Promise<void>\n}>\n\nexport type UpdateDialogProps = {\n adapter: UpdateAdapter\n /** The application's name, used in the title and the copy. */\n appName?: string\n /** The actual desktop application icon, supplied by its host. */\n appIcon?: string\n /** Complete build-time history, also available before the native status arrives. */\n changelog?: string\n /** Shown before the first status arrives, so the dialog is never blank. */\n fallbackVersion?: string\n /** Copy for the adapter's non-desktop case. */\n desktopOnlyMessage?: string\n /**\n * Optional host-owned release-channel control, rendered in the version status\n * card. The host owns its accessible label and calls `recheck` after a selection;\n * the optional callback persists that selection before the dialog checks it.\n */\n channelControl?: (actions: ChannelControlActions) => JSX.Element\n /** A controlled open state. Omit for the trigger to manage its own. */\n open?: boolean\n /**\n * Start open, uncontrolled — for a caller that opens the dialog because it found\n * something (\"an update is available\") rather than because the user asked. The\n * trigger is still rendered, so the dialog is reachable again after closing.\n */\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /**\n * Supplies a stable external control to focus when a controlled dialog closes.\n * Useful when a menu or other layer closes before this dialog opens; when omitted,\n * the element focused immediately before the dialog opens is used when available.\n */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n /** Render only the panel, for a caller that provides its own dialog. */\n class?: string\n}\n\nexport function UpdateDialog(props: UpdateDialogProps) {\n const [local] = splitProps(props, [\n 'adapter',\n 'appName',\n 'appIcon',\n 'changelog',\n 'fallbackVersion',\n 'desktopOnlyMessage',\n 'channelControl',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'restoreFocusRef',\n 'class',\n ])\n\n const [uncontrolledOpen, setUncontrolledOpen] = createSignal(local.defaultOpen ?? false)\n const open = () => local.open ?? uncontrolledOpen()\n const setOpen = (next: boolean) => {\n if (local.open === undefined) setUncontrolledOpen(next)\n local.onOpenChange?.(next)\n }\n\n const appName = () => local.appName ?? 'the application'\n const desktop = () => local.adapter.isDesktopRuntime()\n const [state, setState] = createSignal<UpdateState | null>(null)\n const [busy, setBusy] = createSignal(false)\n const [error, setError] = createSignal('')\n const [checkFailed, setCheckFailed] = createSignal(false)\n const [cancelPending, setCancelPending] = createSignal(false)\n let lifecycleEpoch = 0\n let activeOpenEpoch: number | undefined\n let channelCheckUnconfirmed = false\n let disposed = false\n\n onCleanup(() => {\n disposed = true\n activeOpenEpoch = undefined\n lifecycleEpoch += 1\n })\n\n // Every async step belongs to the open session it started in: once the dialog\n // closes, reopens or unmounts, a late answer must not write into it.\n const sessionGuard =\n (epoch = activeOpenEpoch) =>\n () =>\n !disposed &&\n epoch !== undefined &&\n activeOpenEpoch === epoch &&\n lifecycleEpoch === epoch &&\n open()\n\n /** A check that failed after a channel change: there is no offer to keep showing. */\n const failDiscardedCheck = (message: string, fallback: string) => {\n setState({ phase: 'failed', currentVersion: state()?.currentVersion ?? '', error: message })\n failCheck(message, fallback)\n }\n\n const loadStatus = async (isCurrent: () => boolean = () => !disposed) => {\n if (!desktop() || !isCurrent()) return\n try {\n const status = await local.adapter.getStatus()\n const previous = state()\n const ignoresUnconfirmedChannelSnapshot = channelCheckUnconfirmed && isActionable(status)\n const preservesSnapshot =\n previous?.phase === 'available'\n ? status.phase === 'available' || isBusy(status)\n : isBusy(previous) && isBusy(status)\n if (\n isCurrent() &&\n !ignoresUnconfirmedChannelSnapshot &&\n !(checkFailed() && isActionable(previous) && !preservesSnapshot)\n ) {\n setState(status)\n }\n } catch (caught) {\n if (isCurrent()) setError(errorMessage(caught, 'Version status is unavailable'))\n }\n }\n\n onMount(() => {\n if (desktop() && !open()) {\n const epoch = lifecycleEpoch\n void loadStatus(() => !disposed && lifecycleEpoch === epoch)\n }\n })\n\n const failCheck = (caught: unknown, fallback: string) => {\n const message = errorMessage(caught, fallback)\n setCheckFailed(true)\n setError(message)\n }\n\n const applyCheckResult = (next: UpdateState, preserveOnFailure = true) => {\n if (next.phase === 'failed') {\n const current = state()\n if (!current || !preserveOnFailure) setState(next)\n failCheck(next.error, 'Could not check for updates')\n return\n }\n setState(next)\n setCheckFailed(false)\n setError('')\n }\n\n const check = async (\n beforeCheck?: () => Promise<void>,\n clearStaleOffer = beforeCheck !== undefined\n ) => {\n if (!desktop()) {\n setError(local.desktopOnlyMessage ?? `Update checks are available from the desktop app.`)\n return\n }\n const isCurrent = sessionGuard()\n if (!isCurrent()) return\n if (clearStaleOffer && working()) return\n if (clearStaleOffer) channelCheckUnconfirmed = true\n const discardStaleOffer = clearStaleOffer || channelCheckUnconfirmed\n setBusy(true)\n setError('')\n setCheckFailed(false)\n if (discardStaleOffer) {\n const current = state()\n if (current) setState({ phase: 'checking', currentVersion: current.currentVersion })\n }\n let channelSaved = beforeCheck === undefined\n try {\n await beforeCheck?.()\n channelSaved = true\n if (!isCurrent()) return\n const checked = await local.adapter.check()\n if (isCurrent()) {\n applyCheckResult(checked, !discardStaleOffer)\n if (discardStaleOffer && checked.phase !== 'failed') channelCheckUnconfirmed = false\n }\n } catch (caught) {\n if (isCurrent()) {\n if (discardStaleOffer) {\n const fallback = channelSaved\n ? 'Could not check for updates'\n : 'Could not save the update channel'\n failDiscardedCheck(errorMessage(caught, fallback), fallback)\n } else {\n failCheck(caught, 'Could not check for updates')\n await loadStatus(isCurrent)\n }\n }\n } finally {\n if (isCurrent()) setBusy(false)\n }\n }\n\n // Opening loads status first, then checks (see the header). Unlike `check`,\n // a failure here does not reload the status it has just asked for.\n createEffect(() => {\n if (!open() || !desktop()) {\n setCancelPending(false)\n if (activeOpenEpoch !== undefined) {\n activeOpenEpoch = undefined\n lifecycleEpoch += 1\n }\n return\n }\n const epoch = ++lifecycleEpoch\n activeOpenEpoch = epoch\n const isCurrent = sessionGuard(epoch)\n onCleanup(() => {\n if (activeOpenEpoch === epoch) {\n activeOpenEpoch = undefined\n lifecycleEpoch += 1\n }\n })\n setError('')\n setCheckFailed(false)\n setCancelPending(false)\n setBusy(true)\n void (async () => {\n try {\n const current = await local.adapter.getStatus()\n if (!isCurrent()) return\n const discardStaleOffer = channelCheckUnconfirmed\n setState(\n discardStaleOffer\n ? { phase: 'checking', currentVersion: current.currentVersion }\n : current\n )\n const checked = await local.adapter.check()\n if (isCurrent()) {\n applyCheckResult(checked, !discardStaleOffer)\n if (discardStaleOffer && checked.phase !== 'failed') channelCheckUnconfirmed = false\n }\n } catch (caught) {\n if (isCurrent()) {\n if (channelCheckUnconfirmed) {\n failDiscardedCheck(\n errorMessage(caught, 'Could not check for updates'),\n 'Could not check for updates'\n )\n } else {\n failCheck(caught, 'Could not check for updates')\n }\n }\n } finally {\n if (isCurrent()) setBusy(false)\n }\n })()\n })\n\n const install = async () => {\n const version = state()?.availableVersion\n const isCurrent = sessionGuard()\n if (!version || !isCurrent()) return\n setBusy(true)\n setError('')\n setState((current) =>\n current ? { ...current, phase: 'downloading', downloadedBytes: 0, totalBytes: null } : current\n )\n try {\n const next = await local.adapter.install(version)\n if (!isCurrent()) return\n setState(withPendingCancel(next, cancelPending()))\n // A refused install answers with a normal payload whose phase is `failed`.\n // Without this the click looked like nothing happened.\n if (next.phase === 'failed') {\n setError(errorMessage(next.error, 'Update installation failed'))\n } else {\n setCheckFailed(false)\n }\n } catch (caught) {\n if (!isCurrent()) return\n setError(errorMessage(caught, 'Update installation failed'))\n await loadStatus(isCurrent)\n } finally {\n if (isCurrent()) setBusy(false)\n }\n }\n\n // Poll only an open, active native operation. Epoch ownership prevents a late\n // status response from replacing a reopened dialog's newer snapshot.\n createEffect(() => {\n const phase = state()?.phase\n if (!open() || !desktop() || !local.adapter.pollIntervalMs || !isInFlight(phase)) return\n const isCurrent = sessionGuard()\n let active = true\n let requestInFlight = false\n const timer = window.setInterval(\n () => {\n if (requestInFlight) return\n requestInFlight = true\n void (async () => {\n try {\n const next = await local.adapter.getStatus()\n if (!active || !isCurrent()) return\n setState(withPendingCancel(next, cancelPending()))\n if (next.phase === 'failed')\n setError(errorMessage(next.error, 'Update installation failed'))\n } catch (caught) {\n if (active && isCurrent())\n setError(errorMessage(caught, 'Update progress is unavailable'))\n } finally {\n requestInFlight = false\n }\n })()\n },\n Math.max(250, local.adapter.pollIntervalMs)\n )\n onCleanup(() => {\n active = false\n window.clearInterval(timer)\n })\n })\n\n const cancel = async () => {\n if (!local.adapter.cancel || cancelPending() || state()?.phase === 'cancelling') return\n const isCurrent = sessionGuard()\n setError('')\n setCancelPending(true)\n setState((current) => (current ? { ...current, phase: 'cancelling' } : current))\n try {\n const next = await local.adapter.cancel()\n if (isCurrent()) setState(next)\n } catch (caught) {\n if (isCurrent()) {\n setError(errorMessage(caught, 'Could not cancel the update'))\n await loadStatus(isCurrent)\n }\n } finally {\n if (isCurrent()) setCancelPending(false)\n }\n }\n\n const openRelease = async (url: string) => {\n try {\n if (local.adapter.openExternal) await local.adapter.openExternal(url)\n else window.open(url, '_blank', 'noopener,noreferrer')\n } catch (caught) {\n if (!disposed) setError(errorMessage(caught, 'Could not open the release page'))\n }\n }\n\n const changelog = createMemo(() =>\n plainTextFromMarkdown(state()?.changelog || local.changelog || '')\n )\n const notes = () => {\n const value = state()?.releaseNotes\n return value ? plainTextFromMarkdown(value) : ''\n }\n const working = () => busy() || cancelPending() || isBusy(state())\n const channelControlDisabled = () => !desktop() || working()\n const recheckChannel = (beforeCheck?: () => Promise<void>) => check(beforeCheck, true)\n const isCurrent = () => state()?.phase === 'current' && !error() && !checkFailed() && !working()\n\n const triggerLabel = () =>\n describeTrigger({\n state: state(),\n checkFailed: checkFailed(),\n appName: appName(),\n fallbackVersion: local.fallbackVersion,\n })\n const progressValue = () => progressPercent(state())\n\n return (\n <Dialog open={open()} onOpenChange={setOpen}>\n <Show when={local.open === undefined}>\n <DialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Open version and updates: ${triggerLabel()}`}\n aria-haspopup=\"dialog\"\n >\n <Show when={state()?.phase === 'available'} fallback={<RefreshCw aria-hidden=\"true\" />}>\n <Sparkles aria-hidden=\"true\" />\n </Show>\n {triggerLabel()}\n </DialogTrigger>\n </Show>\n\n {/* The footer keeps the visible \"Close\"; the corner icon is named for the\n dialog so the two controls stay distinct to assistive tech. */}\n <DialogContent\n positioner=\"inset\"\n closeLabel=\"Close version and updates\"\n class={cn('flex max-h-full min-h-0 max-w-3xl flex-col overflow-hidden', local.class)}\n initialFocus=\"panel\"\n restoreFocusRef={local.restoreFocusRef}\n >\n <DialogHeader class=\"shrink-0\">\n <div class=\"flex items-center gap-3\">\n <Show\n when={local.appIcon}\n fallback={<Monitor class=\"size-10 text-primary\" aria-hidden=\"true\" />}\n >\n {(icon) => <img src={icon()} alt=\"\" class=\"size-10\" aria-hidden=\"true\" />}\n </Show>\n <div>\n <DialogTitle>Version & updates</DialogTitle>\n <DialogDescription>\n Keep {appName()} current and review what changed in each release.\n </DialogDescription>\n </div>\n </div>\n </DialogHeader>\n\n <div\n data-slot=\"update-dialog-scroll-region\"\n class=\"flex min-h-0 min-w-0 flex-1 flex-col gap-5 overflow-y-auto p-6\"\n >\n <section\n class=\"rounded-xl border border-border bg-background/45 p-4\"\n aria-label=\"Version status\"\n >\n <div class=\"flex flex-wrap items-start justify-between gap-4\">\n <div class=\"flex flex-col gap-1\">\n <p class=\"text-2xs font-semibold tracking-widest text-muted-foreground uppercase\">\n Installed version\n </p>\n <Heading as=\"p\" size=\"page\" tone=\"foreground\">\n v{installedVersion(state(), local.fallbackVersion)}\n </Heading>\n <p class=\"text-sm text-muted-foreground\">\n <Show\n when={isCurrent()}\n fallback={\n <Show\n when={state()?.phase === 'available' && state()?.availableVersion}\n fallback={\n state()?.phase === 'unavailable'\n ? 'No signed package is published for this platform.'\n : state()?.phase === 'cancelled'\n ? 'Update cancelled. You can retry when ready.'\n : desktop()\n ? 'Check the release channel for the latest signed build.'\n : (local.desktopOnlyMessage ??\n `Check for updates in the desktop app.`)\n }\n >\n {`A newer release, v${state()?.availableVersion}, is ready.`}\n </Show>\n }\n >\n You are running the latest release.\n </Show>\n </p>\n </div>\n <div class=\"flex flex-col items-end gap-2\">\n <ActionButton\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n tooltip=\"Check for a newer version\"\n disabled={!desktop() || working()}\n onClick={() => void check()}\n >\n <Show when={working()} fallback={<RefreshCw aria-hidden=\"true\" />}>\n <LoaderCircle class=\"animate-spin\" aria-hidden=\"true\" />\n </Show>\n {checkFailed() ? 'Retry update check' : 'Check latest version'}\n </ActionButton>\n {/* The up-to-date confirmation reads as the button's outcome,\n so it sits directly beneath it rather than floating as a\n full-width row between sections. */}\n <Show when={isCurrent()}>\n <p class=\"text-foreground flex items-center gap-2 text-sm\" role=\"status\">\n <Check class=\"size-4 text-success\" aria-hidden=\"true\" />\n {appName()} is up to date.\n </p>\n </Show>\n </div>\n </div>\n <Show when={local.channelControl}>\n {(channelControl) => (\n <div class=\"mt-4 border-t border-border pt-4\">\n {channelControl()({\n disabled: channelControlDisabled,\n recheck: recheckChannel,\n })}\n </div>\n )}\n </Show>\n </section>\n\n <Show\n when={\n state()?.availableVersion &&\n state()?.phase !== 'installed' &&\n state()?.phase !== 'unavailable'\n }\n >\n <section\n class=\"rounded-xl border border-primary/35 bg-primary-subtle p-4\"\n aria-label=\"Available update\"\n >\n <div class=\"flex flex-wrap items-start justify-between gap-4\">\n <div class=\"flex flex-col gap-1\">\n <p class=\"flex items-center gap-2 text-sm font-semibold\">\n <Sparkles class=\"size-4 text-primary\" aria-hidden=\"true\" />\n Version {state()?.availableVersion}{' '}\n {isInFlight(state()?.phase) ? 'is being prepared' : 'is ready'}\n </p>\n <p class=\"text-sm text-muted-foreground\">\n The signed installer is verified before {appName()} restarts.\n </p>\n <Show when={formatReleaseDate(state()?.releaseDate ?? null)}>\n {(released) => (\n <p class=\"text-xs text-muted-foreground\">Released {released()}</p>\n )}\n </Show>\n </div>\n <ActionButton\n type=\"button\"\n size=\"sm\"\n tooltip={`Download the signed update and restart ${appName()}.`}\n disabled={working()}\n onClick={() => void install()}\n >\n <Show when={working()} fallback={<Download aria-hidden=\"true\" />}>\n <LoaderCircle class=\"animate-spin\" aria-hidden=\"true\" />\n </Show>\n Install and restart\n </ActionButton>\n </div>\n </section>\n </Show>\n\n {/*\n Progress with both numbers: a bar alone does not distinguish a stalled\n download from a slow one, and \"12.4 MB of 48.1 MB\" does.\n */}\n <Show when={isInFlight(state()?.phase)}>\n <section class=\"grid gap-2\" aria-label=\"Update progress\">\n <Progress\n value={progressValue() ?? undefined}\n aria-label={\n state()?.phase === 'installing' ? 'Installing update' : 'Downloading update'\n }\n />\n <p class=\"text-xs text-muted-foreground\" role=\"status\">\n <Show\n when={state()?.phase === 'installing'}\n fallback={\n <Show when={progressValue() !== null} fallback=\"Downloading…\">\n {`${formatBytes(state()?.downloadedBytes ?? 0)} of ${formatBytes(\n state()?.totalBytes ?? 0\n )} · ${progressValue()}%`}\n </Show>\n }\n >\n Applying the update…\n </Show>\n </p>\n <Show when={local.adapter.cancel}>\n <ActionButton\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n tooltip=\"Stop the current update download or installation.\"\n disabled={cancelPending() || state()?.phase === 'cancelling'}\n onClick={() => void cancel()}\n >\n <CircleStop aria-hidden=\"true\" />\n {cancelPending() || state()?.phase === 'cancelling'\n ? 'Cancelling…'\n : 'Cancel update'}\n </ActionButton>\n </Show>\n </section>\n </Show>\n\n <Show when={state()?.phase === 'installed'}>\n <p class=\"text-foreground flex items-center gap-2 text-sm\" role=\"status\">\n <Check class=\"size-4 text-success\" aria-hidden=\"true\" />\n <Show when={state()?.restartRequired} fallback=\"The update is applied.\">\n Restart {appName()} to finish the update.\n </Show>\n </p>\n </Show>\n\n <Show when={error()}>\n <p\n class=\"text-foreground rounded-lg border border-destructive/35 bg-destructive-subtle px-3 py-2 text-sm\"\n role=\"alert\"\n >\n {error()}\n </p>\n </Show>\n\n <Show when={notes()}>\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center gap-2\">\n <h2 id=\"update-release-notes\" class=\"text-sm font-semibold text-foreground\">\n What changed in this release\n </h2>\n <Badge variant=\"subtle\" size=\"sm\">\n v{state()?.availableVersion}\n </Badge>\n </div>\n {/* A long text block with no focusable descendant: it needs its own tab\n stop, named by the heading above it, or a keyboard user cannot\n scroll it (`scrollable-region-focusable`). */}\n <div\n class=\"max-h-52 overflow-y-auto rounded-xl border border-border bg-background/45 p-4 font-code text-code leading-5 whitespace-pre-wrap text-muted-foreground\"\n role=\"region\"\n aria-labelledby=\"update-release-notes\"\n tabindex=\"0\"\n >\n {notes()}\n </div>\n </div>\n </Show>\n\n <Show when={changelog()}>\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center gap-2\">\n <h2 id=\"update-changelog\" class=\"text-sm font-semibold text-foreground\">\n Installed changelog\n </h2>\n {/* The version pill identifies which build's history this is —\n the same treatment the available-update heading carries. */}\n <Badge variant=\"subtle\" size=\"sm\">\n v{installedVersion(state(), local.fallbackVersion)}\n </Badge>\n </div>\n <p class=\"text-xs text-muted-foreground\">Versions included with this installation.</p>\n {/* A long text block with no focusable descendant: it needs its own tab\n stop, named by the heading above it, or a keyboard user cannot\n scroll it (`scrollable-region-focusable`). */}\n <div\n class=\"max-h-72 overflow-y-auto rounded-xl border border-border bg-background/45 p-4 font-code text-code leading-5 whitespace-pre-wrap text-muted-foreground\"\n role=\"region\"\n aria-labelledby=\"update-changelog\"\n tabindex=\"0\"\n >\n {changelog()}\n </div>\n </div>\n </Show>\n </div>\n\n <DialogFooter>\n <Show when={state()?.releaseUrl}>\n {(url) => (\n <ActionButton\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n tooltip=\"Open the release history in your browser.\"\n // `noopener,noreferrer` because the release page is a different\n // origin and must not get a handle on this window.\n onClick={() => void openRelease(url())}\n >\n <ExternalLink aria-hidden=\"true\" />\n View releases\n </ActionButton>\n )}\n </Show>\n <DialogClose as={Button} variant=\"outline\" size=\"sm\" aria-label=\"Close\">\n Close\n </DialogClose>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuKA,SAAgB6E,aAAaC,OAA0B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AAD,gBACVzI,MAAI;QAAA,IAAC2I,OAAI;SAAA,OAAE1D,MAAM,CAAC,EAAEmI;QAAU;QAAA1E,WAC3BxF,QAAGuF,gBACF3H,cAAY;SACX0J,MAAI;SACJ3B,SAAO;SACPC,MAAI;SACJ2B,SAAO;SAGPC,eAAe,KAAKxC,YAAYhF,IAAI,CAAC;SAAC,IAAAwF,WAAA;UAAA,OAAA,CAAAD,gBAErClI,cAAY,EAAA,eAAA,OAAA,CAAA,GAAA,eAAA;SAAA;QAAA,CAAA;OAGhB,CAAA,GAAAkI,gBAEFzH,aAAW;QAAC4H,IAAI/H;QAAQgI,SAAO;QAAWC,MAAI;QAAA,cAAA;QAAAJ,UAAA;OAAA,CAAA,CAAA;MAAA,EAAA,CAAA;KAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAOzD"}
|
|
@@ -34,7 +34,7 @@ var _tmpl$12 = /*#__PURE__*/ template(`<span aria-hidden=true class="min-w-0 fle
|
|
|
34
34
|
* approval decisions and staged-content semantics are supplied by their owners.
|
|
35
35
|
*/
|
|
36
36
|
function ChatComposerShell(props) {
|
|
37
|
-
const composer = createComposerCore({ failureMessage: "Message not sent.
|
|
37
|
+
const composer = createComposerCore({ failureMessage: "Message not sent. Your draft is kept." });
|
|
38
38
|
const pending = composer.pending;
|
|
39
39
|
let field;
|
|
40
40
|
let restoreBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-composer-shell.js","names":["ChevronsDownUp","ChevronsUpDown","MoreHorizontal","ArrowUp","Show","createEffect","on","onCleanup","onMount","Accessor","JSX","ChatComposerControl","ChatComposerSharedProps","ChatComposerSubmitInput","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","Spinner","BusySendButton","BusySendMode","createComposerCore","ChatComposerInputRenderProps","ref","element","HTMLTextAreaElement","value","resetKey","inputLabel","placeholder","disabled","readOnly","composing","onCompositionStart","onCompositionEnd","onFocus","onBlur","onKeyDown","event","KeyboardEvent","ChatComposerShellProps","createSubmitExtra","input","Extra","onSubmit","Promise","renderInput","props","Element","ChatComposerShell","composer","failureMessage","pending","field","restoreBar","HTMLButtonElement","root","HTMLDivElement","focusFrame","focusTarget","selection","start","end","direction","active","collapsed","collapse","unavailable","blockedReason","cancelFocus","undefined","cancelAnimationFrame","requestFocus","target","requester","document","activeElement","requestAnimationFrame","approvalFocus","current","body","contains","focus","setSelectionRange","Math","min","length","yieldInputRestore","changeCollapsed","selectionStart","selectionEnd","selectionDirection","onChange","control","expandAndFocus","controlRef","reset","defer","action","busy","mode","canSend","selected","sendableActions","trim","submit","base","text","preview","first","split","find","line","slice","handleInputKeyDown","dismissError","key","shiftKey","defaultPrevented","claimEnter","metaKey","ctrlKey","_el$","_tmpl$1","_el$5","firstChild","_$use","_$insert","_$createComponent","when","children","knowledge","_el$2","_tmpl$","followUps","_el$3","_tmpl$2","band","_el$4","_tmpl$3","approval","_el$6","_tmpl$4","notices","_el$7","_tmpl$5","_el$8","_tmpl$6","error","message","_el$14","_tmpl$10","fallback","type","variant","size","aria-label","onClick","_tmpl$11","_el$16","_tmpl$12","_el$9","_tmpl$9","_el$1","_el$10","_el$12","nextSibling","addEventListener","preventDefault","attachments","_el$0","_tmpl$7","removeEventListener","menuItems","placement","as","onCloseAutoFocus","_$memo","onSelect","_tmpl$8","leadingActions","trailingActions","label","_$mergeProps","alternateActionHint","onFire","context","_el$13","_tmpl$0","_$createComponent","_$memo","_$mergeProps"],"sources":["../../../../src/components/conversation/internal/chat-composer-shell.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/ChatInput.tsx\n * at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport { ChevronsDownUp, ChevronsUpDown, MoreHorizontal, ArrowUp } from 'lucide-solid'\nimport { Show, createEffect, on, onCleanup, onMount, type Accessor, type JSX } from 'solid-js'\nimport type {\n ChatComposerControl,\n ChatComposerSharedProps,\n ChatComposerSubmitInput,\n} from '../chat-composer'\nimport { Button } from '../../ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { Spinner } from '../../ui/spinner'\nimport { BusySendButton, type BusySendMode } from '../busy-send-button'\nimport { createComposerCore } from '../composer-core'\n\n/** Private typed seam: public wrappers supply the native or atomic input. */\ntype ChatComposerInputRenderProps = {\n ref: (element: HTMLTextAreaElement | undefined) => void\n value: Accessor<string>\n resetKey: Accessor<unknown>\n inputLabel: Accessor<string>\n placeholder: Accessor<string>\n disabled: Accessor<boolean | undefined>\n readOnly: Accessor<boolean>\n composing: Accessor<boolean>\n onCompositionStart: () => void\n onCompositionEnd: () => void\n onFocus: () => void\n onBlur: () => void\n onKeyDown: (event: KeyboardEvent) => void\n}\n\ntype ChatComposerShellProps<Extra extends object> = ChatComposerSharedProps & {\n createSubmitExtra: (input: ChatComposerSubmitInput) => Extra\n onSubmit: (input: ChatComposerSubmitInput & Extra) => void | Promise<void>\n renderInput: (props: ChatComposerInputRenderProps) => JSX.Element\n}\n\n/**\n * Kiro's composer assembly: context/options, adjacent band, approval/notices,\n * staged content, input/action groups and a context shelf. Reading collapse\n * really unmounts the input and shelf and offers a labeled way back with draft\n * preview. The host retains the only draft, identities, preferences and services.\n *\n * Kobalte owns the options menu. Scoped imperative typing intent replaces the\n * donor global lookup/broadcast so a second composer cannot receive this draft\n * or focus. No animation starts from hidden geometry, no global shortcut, and no\n * runtime/permission/voice/optimizer authority is copied. More specific chips,\n * approval decisions and staged-content semantics are supplied by their owners.\n */\nexport function ChatComposerShell<Extra extends object>(props: ChatComposerShellProps<Extra>) {\n const composer = createComposerCore({\n failureMessage: 'Message not sent. Check your draft and retry when the connection recovers.',\n })\n const pending = composer.pending\n let field: HTMLTextAreaElement | undefined\n let restoreBar: HTMLButtonElement | undefined\n let root: HTMLDivElement | undefined\n let focusFrame: number | undefined\n let focusTarget: 'input' | 'bar' | undefined\n let selection:\n | { start: number; end: number; direction: 'forward' | 'backward' | 'none' }\n | undefined\n let active = true\n const collapsed = () => props.collapse?.value === true\n const unavailable = () => props.disabled || props.readOnly || !!props.blockedReason\n const cancelFocus = () => {\n if (focusFrame !== undefined) cancelAnimationFrame(focusFrame)\n focusFrame = undefined\n }\n const requestFocus = (target: 'input' | 'bar') => {\n cancelFocus()\n focusTarget = target\n const requester = document.activeElement\n focusFrame = requestAnimationFrame(() => {\n focusFrame = undefined\n if (!active || props.approvalFocus) return\n // Focus that moved elsewhere since the request (another conversation,\n // say, while a collapse or expand waited for this frame) is a newer\n // owner; taking it back would also drop whatever is being typed there.\n const current = document.activeElement\n if (\n current &&\n current !== document.body &&\n current !== requester &&\n !root?.contains(current)\n ) {\n focusTarget = undefined\n if (target === 'input') selection = undefined\n return\n }\n if (target === 'bar' && collapsed()) restoreBar?.focus()\n if (target === 'input' && !collapsed() && !props.disabled && field) {\n field.focus()\n if (selection)\n field.setSelectionRange(\n Math.min(selection.start, field.value.length),\n Math.min(selection.end, field.value.length),\n selection.direction\n )\n }\n focusTarget = undefined\n })\n }\n /**\n * A press or key in the input before the deferred expand restore runs is a\n * newer selection owner: the restore must not move its caret back.\n */\n const yieldInputRestore = () => {\n if (focusTarget !== 'input') return\n cancelFocus()\n focusTarget = undefined\n selection = undefined\n }\n const changeCollapsed = (value: boolean) => {\n if (!props.collapse || props.approvalFocus) return\n if (value && field)\n selection = {\n start: field.selectionStart,\n end: field.selectionEnd,\n direction: field.selectionDirection,\n }\n props.collapse.onChange(value)\n requestFocus(value ? 'bar' : 'input')\n }\n const control: ChatComposerControl = {\n focus() {\n if (collapsed() || props.approvalFocus || props.disabled || !field) return false\n field.focus()\n return true\n },\n expandAndFocus() {\n if (props.approvalFocus || props.disabled) return false\n if (collapsed()) changeCollapsed(false)\n else requestFocus('input')\n return true\n },\n }\n onMount(() => props.controlRef?.(control))\n createEffect(\n on(\n () => props.resetKey,\n () => {\n selection = undefined\n cancelFocus()\n focusTarget = undefined\n composer.reset()\n },\n { defer: true }\n )\n )\n onCleanup(() => {\n active = false\n cancelFocus()\n props.controlRef?.(undefined)\n })\n const action = (): 'send' | BusySendMode => props.busy?.mode ?? 'send'\n const canSend = (selected: 'send' | BusySendMode = action()) =>\n !unavailable() &&\n !pending() &&\n (props.sendableActions?.[selected] ?? props.value.trim().length > 0) &&\n !(selected !== 'send' && props.busy?.unavailable?.[selected])\n const submit = (selected: 'send' | BusySendMode = action()) => {\n if (!canSend(selected)) return\n const base: ChatComposerSubmitInput = { text: props.value, action: selected }\n const input = { ...base, ...props.createSubmitExtra(base) }\n void composer.submit(() => props.onSubmit(input))\n }\n const preview = () => {\n const first =\n props.value\n .split('\\n')\n .find((line) => line.trim().length > 0)\n ?.trim() ?? ''\n return first.length > 120 ? `${first.slice(0, 120)}…` : first\n }\n const handleInputKeyDown = (event: KeyboardEvent) => {\n yieldInputRestore()\n if (composer.dismissError(event)) return\n // Shift never sends here: Cmd/Ctrl+Enter is the busy composer's alternate action.\n if (event.key !== 'Enter' || event.shiftKey || event.defaultPrevented) return\n if (composer.claimEnter(event)) {\n const selected =\n props.busy && (event.metaKey || event.ctrlKey)\n ? props.busy.mode === 'steer'\n ? 'queue'\n : 'steer'\n : action()\n submit(selected)\n }\n }\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"chat-composer\"\n class=\"mx-auto flex w-full max-w-4xl flex-col px-4 pb-1\"\n >\n <Show when={!props.approvalFocus}>\n <Show when={props.knowledge}>\n <div data-slot=\"composer-knowledge\">{props.knowledge}</div>\n </Show>\n <Show when={props.followUps}>\n <div data-slot=\"composer-follow-ups\">{props.followUps}</div>\n </Show>\n </Show>\n <Show when={props.band}>\n <div data-slot=\"composer-band\">{props.band}</div>\n </Show>\n <div aria-hidden=\"true\" class=\"h-1.5 shrink-0\" />\n <Show when={props.approval}>\n <div data-slot=\"composer-approval\">{props.approval}</div>\n </Show>\n <Show when={props.notices}>\n <div data-slot=\"composer-notices\">{props.notices}</div>\n </Show>\n <Show when={props.blockedReason}>\n <p role=\"status\" class=\"text-muted-foreground mb-1 text-xs\">\n {props.blockedReason}\n </p>\n </Show>\n <Show when={composer.error()}>\n {(message) => (\n <p role=\"alert\" class=\"text-foreground mb-1 border-s-2 border-destructive ps-2 text-xs\">\n {message()}\n </p>\n )}\n </Show>\n <Show when={!props.approvalFocus}>\n <Show\n when={!collapsed()}\n fallback={\n <Button\n ref={(element) => {\n restoreBar = element\n onCleanup(() => {\n if (restoreBar === element) restoreBar = undefined\n })\n }}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n class=\"w-full justify-start\"\n aria-expanded={false}\n aria-label={`Show the message input${preview() ? `: ${preview()}` : ''}`}\n onClick={() => changeCollapsed(false)}\n >\n <ChevronsUpDown />\n <span aria-hidden=\"true\" class=\"shrink-0\">\n Show the message input\n </span>{' '}\n <Show when={preview()}>\n <span aria-hidden=\"true\" class=\"min-w-0 flex-1 truncate\">\n {preview()}\n </span>\n </Show>\n </Button>\n }\n >\n <form\n data-slot=\"composer-input-box\"\n class=\"border-input bg-card flex flex-col overflow-hidden rounded-2xl border transition-colors focus-within:border-ring\"\n onSubmit={(event) => {\n event.preventDefault()\n submit()\n }}\n >\n <Show when={props.attachments}>\n <div data-slot=\"composer-staged-content\">{props.attachments}</div>\n </Show>\n {props.renderInput({\n ref: (element) => {\n field = element\n if (element) {\n element.addEventListener('pointerdown', yieldInputRestore)\n onCleanup(() => {\n element.removeEventListener('pointerdown', yieldInputRestore)\n if (field === element) field = undefined\n })\n }\n },\n value: () => props.value,\n resetKey: () => props.resetKey,\n inputLabel: () => props.inputLabel ?? 'Message',\n placeholder: () => props.placeholder ?? 'Write a message…',\n disabled: () => props.disabled,\n readOnly: () => props.readOnly || pending(),\n composing: composer.composing,\n onCompositionStart: composer.onCompositionStart,\n onCompositionEnd: composer.onCompositionEnd,\n onFocus: composer.onFocus,\n onBlur: composer.onBlur,\n onKeyDown: handleInputKeyDown,\n })}\n <div\n data-slot=\"composer-action-row\"\n class=\"flex items-center justify-between gap-2 px-2.5 pb-2 pt-0.5\"\n >\n <div class=\"flex min-w-0 items-center gap-1\">\n <Show when={props.collapse || props.menuItems}>\n <DropdownMenu placement=\"top-start\">\n <DropdownMenuTrigger\n as={Button}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label=\"Message input options\"\n >\n <MoreHorizontal />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n onCloseAutoFocus={(event) => {\n if (focusTarget) event.preventDefault()\n }}\n >\n {props.menuItems}\n <Show when={props.collapse}>\n <DropdownMenuItem onSelect={() => changeCollapsed(true)}>\n <ChevronsDownUp />\n <div class=\"flex min-w-0 flex-col\">\n <span>Collapse the message input</span>\n <span class=\"text-muted-foreground text-xs\">\n Make room to read; keep your draft\n </span>\n </div>\n </DropdownMenuItem>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n </Show>\n {props.leadingActions}\n </div>\n <div class=\"flex shrink-0 items-center gap-1\">\n {props.trailingActions}\n <Show\n when={props.busy}\n fallback={\n <Button\n type=\"submit\"\n size=\"icon-sm\"\n disabled={!canSend()}\n aria-label={pending() ? 'Sending message' : 'Send message'}\n >\n <Show when={pending()} fallback={<ArrowUp />}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n </Button>\n }\n >\n {(busy) => (\n <BusySendButton\n {...busy()}\n alternateActionHint={\n canSend(busy().mode === 'steer' ? 'queue' : 'steer')\n ? 'Ctrl/Cmd+Enter uses the other action'\n : undefined\n }\n disabled={!canSend()}\n onFire={() => submit()}\n />\n )}\n </Show>\n </div>\n </div>\n </form>\n <Show when={props.context}>\n <div data-slot=\"composer-context\" class=\"flex min-w-0 items-center gap-2 pt-1\">\n {props.context}\n </div>\n </Show>\n </Show>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgBkD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,WAAQ;UAAA,OAAE,CAACuE,QAAQ;SAAC;SACpBoF,cAAchF,OAAO;QAAC,CAAA,CAAA;OAEzB,CAAA,GAAA,IAAA;OAAA,OAAAwD;MAAA,EAAA,CAAA,GAAAjC,gBAKR7H,MAAI;OAAA,IAAC8H,OAAI;QAAA,OAAElF,MAAM2I;OAAO;OAAA,IAAAxD,WAAA;QAAA,IAAAyD,SAAAC,QAAA;QAAA7D,OAAA4D,cAEpB5I,MAAM2I,OAAO;QAAA,OAAAC;OAAA;MAAA,CAAA,CAAA;KAAA;IAAA,CAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAjE;CAAA,EAAA,CAAA;AAO5B"}
|
|
1
|
+
{"version":3,"file":"chat-composer-shell.js","names":["ChevronsDownUp","ChevronsUpDown","MoreHorizontal","ArrowUp","Show","createEffect","on","onCleanup","onMount","Accessor","JSX","ChatComposerControl","ChatComposerSharedProps","ChatComposerSubmitInput","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","Spinner","BusySendButton","BusySendMode","createComposerCore","ChatComposerInputRenderProps","ref","element","HTMLTextAreaElement","value","resetKey","inputLabel","placeholder","disabled","readOnly","composing","onCompositionStart","onCompositionEnd","onFocus","onBlur","onKeyDown","event","KeyboardEvent","ChatComposerShellProps","createSubmitExtra","input","Extra","onSubmit","Promise","renderInput","props","Element","ChatComposerShell","composer","failureMessage","pending","field","restoreBar","HTMLButtonElement","root","HTMLDivElement","focusFrame","focusTarget","selection","start","end","direction","active","collapsed","collapse","unavailable","blockedReason","cancelFocus","undefined","cancelAnimationFrame","requestFocus","target","requester","document","activeElement","requestAnimationFrame","approvalFocus","current","body","contains","focus","setSelectionRange","Math","min","length","yieldInputRestore","changeCollapsed","selectionStart","selectionEnd","selectionDirection","onChange","control","expandAndFocus","controlRef","reset","defer","action","busy","mode","canSend","selected","sendableActions","trim","submit","base","text","preview","first","split","find","line","slice","handleInputKeyDown","dismissError","key","shiftKey","defaultPrevented","claimEnter","metaKey","ctrlKey","_el$","_tmpl$1","_el$5","firstChild","_$use","_$insert","_$createComponent","when","children","knowledge","_el$2","_tmpl$","followUps","_el$3","_tmpl$2","band","_el$4","_tmpl$3","approval","_el$6","_tmpl$4","notices","_el$7","_tmpl$5","_el$8","_tmpl$6","error","message","_el$14","_tmpl$10","fallback","type","variant","size","aria-label","onClick","_tmpl$11","_el$16","_tmpl$12","_el$9","_tmpl$9","_el$1","_el$10","_el$12","nextSibling","addEventListener","preventDefault","attachments","_el$0","_tmpl$7","removeEventListener","menuItems","placement","as","onCloseAutoFocus","_$memo","onSelect","_tmpl$8","leadingActions","trailingActions","label","_$mergeProps","alternateActionHint","onFire","context","_el$13","_tmpl$0","_$createComponent","_$memo","_$mergeProps"],"sources":["../../../../src/components/conversation/internal/chat-composer-shell.tsx"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/components/ChatInput.tsx\n * at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * Licensed under Apache-2.0; see LICENSE and NOTICE.\n */\nimport { ChevronsDownUp, ChevronsUpDown, MoreHorizontal, ArrowUp } from 'lucide-solid'\nimport { Show, createEffect, on, onCleanup, onMount, type Accessor, type JSX } from 'solid-js'\nimport type {\n ChatComposerControl,\n ChatComposerSharedProps,\n ChatComposerSubmitInput,\n} from '../chat-composer'\nimport { Button } from '../../ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu'\nimport { Spinner } from '../../ui/spinner'\nimport { BusySendButton, type BusySendMode } from '../busy-send-button'\nimport { createComposerCore } from '../composer-core'\n\n/** Private typed seam: public wrappers supply the native or atomic input. */\ntype ChatComposerInputRenderProps = {\n ref: (element: HTMLTextAreaElement | undefined) => void\n value: Accessor<string>\n resetKey: Accessor<unknown>\n inputLabel: Accessor<string>\n placeholder: Accessor<string>\n disabled: Accessor<boolean | undefined>\n readOnly: Accessor<boolean>\n composing: Accessor<boolean>\n onCompositionStart: () => void\n onCompositionEnd: () => void\n onFocus: () => void\n onBlur: () => void\n onKeyDown: (event: KeyboardEvent) => void\n}\n\ntype ChatComposerShellProps<Extra extends object> = ChatComposerSharedProps & {\n createSubmitExtra: (input: ChatComposerSubmitInput) => Extra\n onSubmit: (input: ChatComposerSubmitInput & Extra) => void | Promise<void>\n renderInput: (props: ChatComposerInputRenderProps) => JSX.Element\n}\n\n/**\n * Kiro's composer assembly: context/options, adjacent band, approval/notices,\n * staged content, input/action groups and a context shelf. Reading collapse\n * really unmounts the input and shelf and offers a labeled way back with draft\n * preview. The host retains the only draft, identities, preferences and services.\n *\n * Kobalte owns the options menu. Scoped imperative typing intent replaces the\n * donor global lookup/broadcast so a second composer cannot receive this draft\n * or focus. No animation starts from hidden geometry, no global shortcut, and no\n * runtime/permission/voice/optimizer authority is copied. More specific chips,\n * approval decisions and staged-content semantics are supplied by their owners.\n */\nexport function ChatComposerShell<Extra extends object>(props: ChatComposerShellProps<Extra>) {\n const composer = createComposerCore({\n failureMessage: 'Message not sent. Your draft is kept.',\n })\n const pending = composer.pending\n let field: HTMLTextAreaElement | undefined\n let restoreBar: HTMLButtonElement | undefined\n let root: HTMLDivElement | undefined\n let focusFrame: number | undefined\n let focusTarget: 'input' | 'bar' | undefined\n let selection:\n | { start: number; end: number; direction: 'forward' | 'backward' | 'none' }\n | undefined\n let active = true\n const collapsed = () => props.collapse?.value === true\n const unavailable = () => props.disabled || props.readOnly || !!props.blockedReason\n const cancelFocus = () => {\n if (focusFrame !== undefined) cancelAnimationFrame(focusFrame)\n focusFrame = undefined\n }\n const requestFocus = (target: 'input' | 'bar') => {\n cancelFocus()\n focusTarget = target\n const requester = document.activeElement\n focusFrame = requestAnimationFrame(() => {\n focusFrame = undefined\n if (!active || props.approvalFocus) return\n // Focus that moved elsewhere since the request (another conversation,\n // say, while a collapse or expand waited for this frame) is a newer\n // owner; taking it back would also drop whatever is being typed there.\n const current = document.activeElement\n if (\n current &&\n current !== document.body &&\n current !== requester &&\n !root?.contains(current)\n ) {\n focusTarget = undefined\n if (target === 'input') selection = undefined\n return\n }\n if (target === 'bar' && collapsed()) restoreBar?.focus()\n if (target === 'input' && !collapsed() && !props.disabled && field) {\n field.focus()\n if (selection)\n field.setSelectionRange(\n Math.min(selection.start, field.value.length),\n Math.min(selection.end, field.value.length),\n selection.direction\n )\n }\n focusTarget = undefined\n })\n }\n /**\n * A press or key in the input before the deferred expand restore runs is a\n * newer selection owner: the restore must not move its caret back.\n */\n const yieldInputRestore = () => {\n if (focusTarget !== 'input') return\n cancelFocus()\n focusTarget = undefined\n selection = undefined\n }\n const changeCollapsed = (value: boolean) => {\n if (!props.collapse || props.approvalFocus) return\n if (value && field)\n selection = {\n start: field.selectionStart,\n end: field.selectionEnd,\n direction: field.selectionDirection,\n }\n props.collapse.onChange(value)\n requestFocus(value ? 'bar' : 'input')\n }\n const control: ChatComposerControl = {\n focus() {\n if (collapsed() || props.approvalFocus || props.disabled || !field) return false\n field.focus()\n return true\n },\n expandAndFocus() {\n if (props.approvalFocus || props.disabled) return false\n if (collapsed()) changeCollapsed(false)\n else requestFocus('input')\n return true\n },\n }\n onMount(() => props.controlRef?.(control))\n createEffect(\n on(\n () => props.resetKey,\n () => {\n selection = undefined\n cancelFocus()\n focusTarget = undefined\n composer.reset()\n },\n { defer: true }\n )\n )\n onCleanup(() => {\n active = false\n cancelFocus()\n props.controlRef?.(undefined)\n })\n const action = (): 'send' | BusySendMode => props.busy?.mode ?? 'send'\n const canSend = (selected: 'send' | BusySendMode = action()) =>\n !unavailable() &&\n !pending() &&\n (props.sendableActions?.[selected] ?? props.value.trim().length > 0) &&\n !(selected !== 'send' && props.busy?.unavailable?.[selected])\n const submit = (selected: 'send' | BusySendMode = action()) => {\n if (!canSend(selected)) return\n const base: ChatComposerSubmitInput = { text: props.value, action: selected }\n const input = { ...base, ...props.createSubmitExtra(base) }\n void composer.submit(() => props.onSubmit(input))\n }\n const preview = () => {\n const first =\n props.value\n .split('\\n')\n .find((line) => line.trim().length > 0)\n ?.trim() ?? ''\n return first.length > 120 ? `${first.slice(0, 120)}…` : first\n }\n const handleInputKeyDown = (event: KeyboardEvent) => {\n yieldInputRestore()\n if (composer.dismissError(event)) return\n // Shift never sends here: Cmd/Ctrl+Enter is the busy composer's alternate action.\n if (event.key !== 'Enter' || event.shiftKey || event.defaultPrevented) return\n if (composer.claimEnter(event)) {\n const selected =\n props.busy && (event.metaKey || event.ctrlKey)\n ? props.busy.mode === 'steer'\n ? 'queue'\n : 'steer'\n : action()\n submit(selected)\n }\n }\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"chat-composer\"\n class=\"mx-auto flex w-full max-w-4xl flex-col px-4 pb-1\"\n >\n <Show when={!props.approvalFocus}>\n <Show when={props.knowledge}>\n <div data-slot=\"composer-knowledge\">{props.knowledge}</div>\n </Show>\n <Show when={props.followUps}>\n <div data-slot=\"composer-follow-ups\">{props.followUps}</div>\n </Show>\n </Show>\n <Show when={props.band}>\n <div data-slot=\"composer-band\">{props.band}</div>\n </Show>\n <div aria-hidden=\"true\" class=\"h-1.5 shrink-0\" />\n <Show when={props.approval}>\n <div data-slot=\"composer-approval\">{props.approval}</div>\n </Show>\n <Show when={props.notices}>\n <div data-slot=\"composer-notices\">{props.notices}</div>\n </Show>\n <Show when={props.blockedReason}>\n <p role=\"status\" class=\"text-muted-foreground mb-1 text-xs\">\n {props.blockedReason}\n </p>\n </Show>\n <Show when={composer.error()}>\n {(message) => (\n <p role=\"alert\" class=\"text-foreground mb-1 border-s-2 border-destructive ps-2 text-xs\">\n {message()}\n </p>\n )}\n </Show>\n <Show when={!props.approvalFocus}>\n <Show\n when={!collapsed()}\n fallback={\n <Button\n ref={(element) => {\n restoreBar = element\n onCleanup(() => {\n if (restoreBar === element) restoreBar = undefined\n })\n }}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n class=\"w-full justify-start\"\n aria-expanded={false}\n aria-label={`Show the message input${preview() ? `: ${preview()}` : ''}`}\n onClick={() => changeCollapsed(false)}\n >\n <ChevronsUpDown />\n <span aria-hidden=\"true\" class=\"shrink-0\">\n Show the message input\n </span>{' '}\n <Show when={preview()}>\n <span aria-hidden=\"true\" class=\"min-w-0 flex-1 truncate\">\n {preview()}\n </span>\n </Show>\n </Button>\n }\n >\n <form\n data-slot=\"composer-input-box\"\n class=\"border-input bg-card flex flex-col overflow-hidden rounded-2xl border transition-colors focus-within:border-ring\"\n onSubmit={(event) => {\n event.preventDefault()\n submit()\n }}\n >\n <Show when={props.attachments}>\n <div data-slot=\"composer-staged-content\">{props.attachments}</div>\n </Show>\n {props.renderInput({\n ref: (element) => {\n field = element\n if (element) {\n element.addEventListener('pointerdown', yieldInputRestore)\n onCleanup(() => {\n element.removeEventListener('pointerdown', yieldInputRestore)\n if (field === element) field = undefined\n })\n }\n },\n value: () => props.value,\n resetKey: () => props.resetKey,\n inputLabel: () => props.inputLabel ?? 'Message',\n placeholder: () => props.placeholder ?? 'Write a message…',\n disabled: () => props.disabled,\n readOnly: () => props.readOnly || pending(),\n composing: composer.composing,\n onCompositionStart: composer.onCompositionStart,\n onCompositionEnd: composer.onCompositionEnd,\n onFocus: composer.onFocus,\n onBlur: composer.onBlur,\n onKeyDown: handleInputKeyDown,\n })}\n <div\n data-slot=\"composer-action-row\"\n class=\"flex items-center justify-between gap-2 px-2.5 pb-2 pt-0.5\"\n >\n <div class=\"flex min-w-0 items-center gap-1\">\n <Show when={props.collapse || props.menuItems}>\n <DropdownMenu placement=\"top-start\">\n <DropdownMenuTrigger\n as={Button}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label=\"Message input options\"\n >\n <MoreHorizontal />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n onCloseAutoFocus={(event) => {\n if (focusTarget) event.preventDefault()\n }}\n >\n {props.menuItems}\n <Show when={props.collapse}>\n <DropdownMenuItem onSelect={() => changeCollapsed(true)}>\n <ChevronsDownUp />\n <div class=\"flex min-w-0 flex-col\">\n <span>Collapse the message input</span>\n <span class=\"text-muted-foreground text-xs\">\n Make room to read; keep your draft\n </span>\n </div>\n </DropdownMenuItem>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n </Show>\n {props.leadingActions}\n </div>\n <div class=\"flex shrink-0 items-center gap-1\">\n {props.trailingActions}\n <Show\n when={props.busy}\n fallback={\n <Button\n type=\"submit\"\n size=\"icon-sm\"\n disabled={!canSend()}\n aria-label={pending() ? 'Sending message' : 'Send message'}\n >\n <Show when={pending()} fallback={<ArrowUp />}>\n <Spinner size=\"sm\" label={false} />\n </Show>\n </Button>\n }\n >\n {(busy) => (\n <BusySendButton\n {...busy()}\n alternateActionHint={\n canSend(busy().mode === 'steer' ? 'queue' : 'steer')\n ? 'Ctrl/Cmd+Enter uses the other action'\n : undefined\n }\n disabled={!canSend()}\n onFire={() => submit()}\n />\n )}\n </Show>\n </div>\n </div>\n </form>\n <Show when={props.context}>\n <div data-slot=\"composer-context\" class=\"flex min-w-0 items-center gap-2 pt-1\">\n {props.context}\n </div>\n </Show>\n </Show>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgBkD,kBAAwCF,OAAsC;CAC5F,MAAMG,WAAW7B,mBAAmB,EAClC8B,gBAAgB,wCAClB,CAAC;CACD,MAAMC,UAAUF,SAASE;CACzB,IAAIC;CACJ,IAAIC;CACJ,IAAIE;CACJ,IAAIE;CACJ,IAAIC;CACJ,IAAIC;CAGJ,IAAII,SAAS;CACb,MAAMC,kBAAkBlB,MAAMmB,UAAUxC,UAAU;CAClD,MAAMyC,oBAAoBpB,MAAMjB,YAAYiB,MAAMhB,YAAY,CAAC,CAACgB,MAAMqB;CACtE,MAAMC,oBAAoB;EACxB,IAAIX,eAAeY,KAAAA,GAAWC,qBAAqBb,UAAU;EAC7DA,aAAaY,KAAAA;CACf;CACA,MAAME,gBAAgBC,WAA4B;EAChD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
{"version":3,"file":"message-composer.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message-composer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKxD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAMrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IAC5E,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,iEAAiE;IACjE,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB,0DAA0D;IAC1D,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,IAAI,CAAA;KAAE,CAAA;IAClD,iFAAiF;IACjF,QAAQ,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAA;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACrC,0DAA0D;IAC1D,WAAW,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CAC3C,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"message-composer.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message-composer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKxD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAMrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IAC5E,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,iEAAiE;IACjE,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB,0DAA0D;IAC1D,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,IAAI,CAAA;KAAE,CAAA;IAClD,iFAAiF;IACjF,QAAQ,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAA;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACrC,0DAA0D;IAC1D,WAAW,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CAC3C,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAiL1D;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,eAkB1E;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,eAetD"}
|
|
@@ -40,7 +40,7 @@ function MessageComposer(props) {
|
|
|
40
40
|
"inputResize",
|
|
41
41
|
"onKeyDown"
|
|
42
42
|
]);
|
|
43
|
-
const composer = createComposerCore({ failureMessage: "Message not sent. Your draft is
|
|
43
|
+
const composer = createComposerCore({ failureMessage: "Message not sent. Your draft is kept." });
|
|
44
44
|
const sending = composer.pending;
|
|
45
45
|
const descriptionId = `message-composer-help-${createUniqueId()}`;
|
|
46
46
|
const describedBy = () => [local.inputDescribedBy, local.inputDescription ? descriptionId : void 0].filter(Boolean).join(" ") || void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-composer.js","names":["CornerDownLeft","Paperclip","Send","X","ComponentProps","JSX","Ref","Show","createUniqueId","splitProps","callHandler","cn","ActionButton","Button","Kbd","Spinner","Textarea","createComposerCore","MessageComposerProps","Omit","value","onValueChange","onSubmit","Promise","placeholder","disabled","submitLabel","showHint","leading","Element","trailing","menu","status","replyTo","label","onDismiss","inputRef","HTMLTextAreaElement","inputId","inputLabel","inputDescription","inputDescribedBy","inputSize","inputResize","MessageComposer","props","local","rest","composer","failureMessage","sending","pending","descriptionId","describedBy","undefined","filter","Boolean","join","actionLabel","pendingLabel","toLowerCase","canSend","trim","length","send","submit","onKeyDown","EventHandlerUnion","KeyboardEvent","event","defaultPrevented","key","shiftKey","metaKey","ctrlKey","claimEnter","onFormKeyDown","HTMLFormElement","dismissError","preventDefault","stopPropagation","_el$","_tmpl$3","_el$3","firstChild","_el$4","_el$5","_el$10","nextSibling","$$keydown","addEventListener","_$spread","_$mergeProps","class","_$insert","_$createComponent","when","children","_el$2","_tmpl$","reply","_el$11","_tmpl$4","_el$12","_el$13","type","variant","size","tooltip","onClick","ref","r$","_ref$","id","onCompositionStart","onCompositionEnd","onFocus","onBlur","onInput","currentTarget","rows","aria-label","aria-describedby","resize","description","_el$14","_tmpl$5","_$setAttribute","_$memo","fallback","_el$6","_tmpl$2","_el$7","_el$8","_el$9","_el$1","_el$0","error","message","_el$15","_tmpl$6","_$effect","_$className","ComposerAttachmentButton","count","open","aria-expanded","ComposerHint","_el$16","_tmpl$7","_$delegateEvents","_$mergeProps","_$createComponent","_$memo","_$className","_$delegateEvents"],"sources":["../../../src/components/conversation/message-composer.tsx"],"sourcesContent":["import { CornerDownLeft, Paperclip, Send, X } from 'lucide-solid'\nimport type { ComponentProps, JSX, Ref } from 'solid-js'\nimport { Show, createUniqueId, splitProps } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { cn } from '#lib/utils'\nimport { ActionButton } from '../composites/action-button'\nimport { Button } from '../ui/button'\nimport { Kbd } from '../ui/kbd'\nimport { Spinner } from '../ui/spinner'\nimport { Textarea } from '../ui/textarea'\nimport { createComposerCore } from './composer-core'\n\n/**\n * MessageComposer.\n *\n * The field a message is written in. It is a form, and it behaves like one: Enter\n * sends, Shift+Enter breaks the line, Escape clears the error from anywhere in\n * the composer unless a nested control or an active IME already owns the key.\n *\n * ## What it does not know\n *\n * No mention model, no attachment model, no dictation, no idempotency keys. The\n * first version of this composer was written against adea's agent and artifact\n * types, which meant it could only ever be used by adea. Here the attachment control\n * is a *slot*, the mention menu is a slot, and a caller that has an agent model\n * renders one; a caller that does not gets a composer without it.\n *\n * ## The three things it does own\n *\n * **Enter sends, Shift+Enter breaks the line.** That is the convention every chat\n * application shares, and getting it wrong is the single most irritating thing a\n * composer can do. `⌘`/`Ctrl`+Enter is accepted too, because someone arriving from an\n * editor will try it.\n *\n * **The send button is disabled when there is nothing to send.** A control that\n * accepts a press and does nothing is worse than one that says it cannot.\n *\n * **The status region is `aria-live`.** \"Sending…\" and a failure both land there, so\n * a screen reader hears the outcome without the composer stealing focus.\n *\n * Enter ownership follows KiroCrew's pinned IME latch: candidate commits keep\n * their native default action, and the post-composition Enter cannot send or\n * insert an accidental newline. Composition abandoned by focus/blur recovers;\n * the Solid owner's cleanup settles its timer. See ime-guard.ts for provenance.\n */\nexport type MessageComposerProps = Omit<ComponentProps<'form'>, 'onSubmit'> & {\n /** The draft. Controlled: the caller owns the text, because it usually persists. */\n value: string\n onValueChange: (value: string) => void\n /** Called on send. A rejection is surfaced as an error and the draft is kept. */\n onSubmit: () => void | Promise<void>\n placeholder?: string\n /** Disable the whole composer, e.g. while the channel is read-only. */\n disabled?: boolean\n /** Accessible name and tooltip for the action, e.g. \"Reply\". */\n submitLabel?: string\n showHint?: boolean\n /** A leading control group, e.g. an attach button. */\n leading?: JSX.Element\n /** A trailing group before the send button, e.g. a dictation toggle. */\n trailing?: JSX.Element\n /** A menu rendered above the field, e.g. mention suggestions. */\n menu?: JSX.Element\n /**\n * Host progress rendered in the composer's own live region, e.g. dictation\n * state — plain paragraphs are progress, a `role=\"alert\"` paragraph is a\n * failure. Sending and send-failure copy stays the composer's own.\n */\n status?: JSX.Element\n /** The reply target, drawn as a strip above the field. */\n replyTo?: { label: string; onDismiss: () => void }\n /** Ref to the actual message textarea, for host focus and selection behavior. */\n inputRef?: Ref<HTMLTextAreaElement>\n inputId?: string\n /** Accessible name for the actual textarea. Defaults to \"Message\" or \"Reply message\". */\n inputLabel?: string\n /** Additional help text associated with the actual textarea. */\n inputDescription?: string\n /** Existing host description id, combined with `inputDescription` when supplied. */\n inputDescribedBy?: string\n /** Comfortable uses the shared 4rem minimum and 12rem maximum field heights. */\n inputSize?: 'default' | 'comfortable'\n /** The shared resize behavior for the actual textarea. */\n inputResize?: 'vertical' | 'none' | 'both'\n}\n\nexport function MessageComposer(props: MessageComposerProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'value',\n 'onValueChange',\n 'onSubmit',\n 'placeholder',\n 'disabled',\n 'submitLabel',\n 'showHint',\n 'leading',\n 'trailing',\n 'menu',\n 'status',\n 'replyTo',\n 'inputRef',\n 'inputId',\n 'inputLabel',\n 'inputDescription',\n 'inputDescribedBy',\n 'inputSize',\n 'inputResize',\n 'onKeyDown',\n ])\n\n const composer = createComposerCore({\n failureMessage:\n 'Message not sent. Your draft is still here; retry when the connection recovers.',\n })\n const sending = composer.pending\n const descriptionId = `message-composer-help-${createUniqueId()}`\n const describedBy = () =>\n [local.inputDescribedBy, local.inputDescription ? descriptionId : undefined]\n .filter(Boolean)\n .join(' ') || undefined\n const actionLabel = () => local.submitLabel ?? 'Send message'\n const pendingLabel = () =>\n `Sending ${local.submitLabel ? local.submitLabel.toLowerCase() : 'message'}`\n\n const canSend = () => local.value.trim().length > 0 && !local.disabled && !sending()\n\n const send = () => {\n if (canSend()) void composer.submit(() => local.onSubmit())\n }\n\n const onKeyDown: JSX.EventHandlerUnion<HTMLTextAreaElement, KeyboardEvent> = (event) => {\n if (event.defaultPrevented) return\n if (event.key !== 'Enter') return\n // Shift breaks the line; a bare Enter, or a modified one, sends.\n if (event.shiftKey && !event.metaKey && !event.ctrlKey) return\n if (composer.claimEnter(event)) send()\n }\n\n const onFormKeyDown: JSX.EventHandlerUnion<HTMLFormElement, KeyboardEvent> = (event) => {\n callHandler(local.onKeyDown, event)\n if (!composer.dismissError(event)) return\n event.preventDefault()\n event.stopPropagation()\n }\n\n return (\n <form\n data-slot=\"message-composer\"\n class={cn('flex flex-col gap-2', local.class)}\n onSubmit={(event) => {\n event.preventDefault()\n send()\n }}\n onKeyDown={onFormKeyDown}\n {...rest}\n >\n <Show when={local.menu}>\n <div>{local.menu}</div>\n </Show>\n\n <Show when={local.replyTo}>\n {(reply) => (\n <div class=\"bg-muted text-muted-foreground flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs\">\n <span class=\"min-w-0 flex-1 truncate\">Replying to {reply().label}</span>\n <ActionButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label=\"Cancel reply\"\n tooltip=\"Cancel reply\"\n onClick={() => reply().onDismiss()}\n >\n <X />\n </ActionButton>\n </div>\n )}\n </Show>\n\n <div\n class={cn(\n 'border-input bg-card flex flex-col gap-1 rounded-lg border p-2',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n local.disabled && 'opacity-50'\n )}\n >\n <Textarea\n ref={local.inputRef}\n id={local.inputId}\n onCompositionStart={composer.onCompositionStart}\n onCompositionEnd={composer.onCompositionEnd}\n onFocus={composer.onFocus}\n onBlur={composer.onBlur}\n value={local.value}\n onInput={(event) => local.onValueChange(event.currentTarget.value)}\n onKeyDown={onKeyDown}\n placeholder={local.placeholder ?? 'Write a message…'}\n disabled={local.disabled}\n rows={1}\n aria-label={\n local.inputLabel ?? (local.submitLabel ? `${local.submitLabel} message` : 'Message')\n }\n aria-describedby={describedBy()}\n variant=\"composer\"\n size={local.inputSize ?? 'comfortable'}\n resize={local.inputResize ?? 'vertical'}\n />\n <Show when={local.inputDescription}>\n {(description) => (\n <span id={descriptionId} class=\"sr-only\">\n {description()}\n </span>\n )}\n </Show>\n\n <div class=\"flex items-center gap-1\">\n <Show when={local.leading}>{local.leading}</Show>\n <div class=\"ms-auto flex items-center gap-1\">\n <Show when={local.trailing}>{local.trailing}</Show>\n <ActionButton\n type=\"submit\"\n size=\"icon-sm\"\n disabled={!canSend()}\n aria-label={sending() ? pendingLabel() : actionLabel()}\n tooltip={actionLabel()}\n >\n <Show when={sending()} fallback={<Send />}>\n <Spinner size=\"sm\" label={false} class=\"text-primary-foreground\" />\n </Show>\n </ActionButton>\n </div>\n </div>\n </div>\n\n <Show when={local.showHint}>\n <p class=\"text-muted-foreground flex items-center gap-1.5 text-2xs\">\n <Kbd>Enter</Kbd> to send\n <span aria-hidden=\"true\">·</span>\n <Kbd>Shift</Kbd> <Kbd>Enter</Kbd> for a new line\n </p>\n </Show>\n\n {/* A live region, so the outcome is announced without moving focus out of the\n field the user is typing in. */}\n <div role=\"status\" aria-live=\"polite\" class=\"min-h-0\">\n <Show\n when={sending()}\n fallback={\n <Show when={composer.error()}>\n {(message) => (\n <p class=\"text-foreground border-s-2 border-destructive ps-2 text-xs\">\n {message()}\n </p>\n )}\n </Show>\n }\n >\n {pendingLabel()}…\n </Show>\n <Show when={local.status}>{local.status}</Show>\n </div>\n </form>\n )\n}\n\n/**\n * The attachment control.\n *\n * A slot rather than a built-in, because what can be attached is the application's\n * business — but the *button* is shared, so it looks and behaves the same in both.\n * The count is announced, since a paperclip alone does not say whether anything is\n * attached.\n */\nexport function ComposerAttachmentButton(\n props: ComponentProps<typeof Button> & { count?: number; open?: boolean }\n) {\n const [local, rest] = splitProps(props, ['count', 'open', 'children'])\n\n return (\n <ActionButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={local.count ? `${local.count} attached, add an attachment` : 'Add an attachment'}\n aria-expanded={local.open}\n tooltip=\"Add an attachment\"\n class=\"text-muted-foreground\"\n {...rest}\n >\n {local.children ?? <Paperclip />}\n </ActionButton>\n )\n}\n\n/** The hint a composer shows when the field is empty, as a one-line prompt. */\nexport function ComposerHint(props: ComponentProps<'p'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <p\n class={cn('text-muted-foreground flex items-center gap-1.5 text-2xs', local.class)}\n {...rest}\n >\n {local.children ?? (\n <>\n <CornerDownLeft aria-hidden=\"true\" class=\"size-3\" />\n <Kbd>Enter</Kbd> to send\n </>\n )}\n </p>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsFA,SAAgB4C,gBAAgBC,OAA6B;CAC3D,MAAM,CAACC,OAAOC,QAAQtC,WAAWoC,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAW,CACZ;CAED,MAAMG,WAAW/B,mBAAmB,EAClCgC,gBACE,kFACJ,CAAC;CACD,MAAMC,UAAUF,SAASG;CACzB,MAAMC,gBAAgB,yBAAyB5C,eAAe;CAC9D,MAAM6C,oBACJ,CAACP,MAAML,kBAAkBK,MAAMN,mBAAmBY,gBAAgBE,KAAAA,CAAS,CAAC,CACzEC,OAAOC,OAAO,CAAC,CACfC,KAAK,GAAG,KAAKH,KAAAA;CAClB,MAAMI,oBAAoBZ,MAAMpB,eAAe;CAC/C,MAAMiC,qBACJ,WAAWb,MAAMpB,cAAcoB,MAAMpB,YAAYkC,YAAY,IAAI;CAEnE,MAAMC,gBAAgBf,MAAM1B,MAAM0C,KAAK,CAAC,CAACC,SAAS,KAAK,CAACjB,MAAMrB,YAAY,CAACyB,QAAQ;CAEnF,MAAMc,aAAa;EACjB,IAAIH,QAAQ,GAAG,SAAcI,aAAanB,MAAMxB,SAAS,CAAC;CAC5D;CAEA,MAAM4C,aAAwEG,U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BACGnF,cAAYgF,WAAA;EACXa,MAAI;EACJC,SAAO;EACPC,MAAI;EAAA,KAAA,gBAAA;GAAA,OACQqB,WAAA,CAAA,CAAAlF,MAAMkG,KAAK,CAAA,CAAA,IAAG,GAAGlG,MAAMkG,MAAK,gCAAiC;EAAmB;EAAA,KAAA,mBAAA;GAAA,OAC7ElG,MAAMmG;EAAI;EACzBrC,SAAO;EAAA,SAAA;CAAA,GAEH7D,MAAI,EAAA,IAAAkD,WAAA;EAAA,OAEPnD,MAAMmD,YAAQF,gBAAK9F,WAAS,CAAA,CAAA;CAAG,EAAA,CAAA,CAAA;AAGtC;;AAGA,SAAgBkJ,aAAatG,OAA4B;CACvD,MAAM,CAACC,OAAOC,QAAQtC,WAAWoC,OAAO,CAAC,SAAS,UAAU,CAAC;CAC7D,cAAA;EAAA,IAAAuG,SAAAC,QAAA;EAAA1D,OAAAyD,QAAAxD,WAAA,EAAA,KAAA,WAAA;GAAA,OAEWjF,GAAG,4DAA4DmC,MAAM+C,KAAK;EAAC,EAAA,GAC9E9C,IAAI,GAAA,OAAA,IAAA;EAAA+C,OAAAsD,cAEPtG,MAAMmD,YAAQ;GAAAF,gBAEV/F,gBAAc;IAAA,eAAA;IAAA,SAAA;GAAA,CAAA;GAAA+F,gBACdjF,KAAG,EAAAmF,UAAA,QAAA,CAAA;GAAA;EAAA,CAEP;EAAA,OAAAmD;CAAA,EAAA,CAAA;AAGP;AAACE,eAAA,CAAA,SAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"message-composer.js","names":["CornerDownLeft","Paperclip","Send","X","ComponentProps","JSX","Ref","Show","createUniqueId","splitProps","callHandler","cn","ActionButton","Button","Kbd","Spinner","Textarea","createComposerCore","MessageComposerProps","Omit","value","onValueChange","onSubmit","Promise","placeholder","disabled","submitLabel","showHint","leading","Element","trailing","menu","status","replyTo","label","onDismiss","inputRef","HTMLTextAreaElement","inputId","inputLabel","inputDescription","inputDescribedBy","inputSize","inputResize","MessageComposer","props","local","rest","composer","failureMessage","sending","pending","descriptionId","describedBy","undefined","filter","Boolean","join","actionLabel","pendingLabel","toLowerCase","canSend","trim","length","send","submit","onKeyDown","EventHandlerUnion","KeyboardEvent","event","defaultPrevented","key","shiftKey","metaKey","ctrlKey","claimEnter","onFormKeyDown","HTMLFormElement","dismissError","preventDefault","stopPropagation","_el$","_tmpl$3","_el$3","firstChild","_el$4","_el$5","_el$10","nextSibling","$$keydown","addEventListener","_$spread","_$mergeProps","class","_$insert","_$createComponent","when","children","_el$2","_tmpl$","reply","_el$11","_tmpl$4","_el$12","_el$13","type","variant","size","tooltip","onClick","ref","r$","_ref$","id","onCompositionStart","onCompositionEnd","onFocus","onBlur","onInput","currentTarget","rows","aria-label","aria-describedby","resize","description","_el$14","_tmpl$5","_$setAttribute","_$memo","fallback","_el$6","_tmpl$2","_el$7","_el$8","_el$9","_el$1","_el$0","error","message","_el$15","_tmpl$6","_$effect","_$className","ComposerAttachmentButton","count","open","aria-expanded","ComposerHint","_el$16","_tmpl$7","_$delegateEvents","_$mergeProps","_$createComponent","_$memo","_$className","_$delegateEvents"],"sources":["../../../src/components/conversation/message-composer.tsx"],"sourcesContent":["import { CornerDownLeft, Paperclip, Send, X } from 'lucide-solid'\nimport type { ComponentProps, JSX, Ref } from 'solid-js'\nimport { Show, createUniqueId, splitProps } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { cn } from '#lib/utils'\nimport { ActionButton } from '../composites/action-button'\nimport { Button } from '../ui/button'\nimport { Kbd } from '../ui/kbd'\nimport { Spinner } from '../ui/spinner'\nimport { Textarea } from '../ui/textarea'\nimport { createComposerCore } from './composer-core'\n\n/**\n * MessageComposer.\n *\n * The field a message is written in. It is a form, and it behaves like one: Enter\n * sends, Shift+Enter breaks the line, Escape clears the error from anywhere in\n * the composer unless a nested control or an active IME already owns the key.\n *\n * ## What it does not know\n *\n * No mention model, no attachment model, no dictation, no idempotency keys. The\n * first version of this composer was written against adea's agent and artifact\n * types, which meant it could only ever be used by adea. Here the attachment control\n * is a *slot*, the mention menu is a slot, and a caller that has an agent model\n * renders one; a caller that does not gets a composer without it.\n *\n * ## The three things it does own\n *\n * **Enter sends, Shift+Enter breaks the line.** That is the convention every chat\n * application shares, and getting it wrong is the single most irritating thing a\n * composer can do. `⌘`/`Ctrl`+Enter is accepted too, because someone arriving from an\n * editor will try it.\n *\n * **The send button is disabled when there is nothing to send.** A control that\n * accepts a press and does nothing is worse than one that says it cannot.\n *\n * **The status region is `aria-live`.** \"Sending…\" and a failure both land there, so\n * a screen reader hears the outcome without the composer stealing focus.\n *\n * Enter ownership follows KiroCrew's pinned IME latch: candidate commits keep\n * their native default action, and the post-composition Enter cannot send or\n * insert an accidental newline. Composition abandoned by focus/blur recovers;\n * the Solid owner's cleanup settles its timer. See ime-guard.ts for provenance.\n */\nexport type MessageComposerProps = Omit<ComponentProps<'form'>, 'onSubmit'> & {\n /** The draft. Controlled: the caller owns the text, because it usually persists. */\n value: string\n onValueChange: (value: string) => void\n /** Called on send. A rejection is surfaced as an error and the draft is kept. */\n onSubmit: () => void | Promise<void>\n placeholder?: string\n /** Disable the whole composer, e.g. while the channel is read-only. */\n disabled?: boolean\n /** Accessible name and tooltip for the action, e.g. \"Reply\". */\n submitLabel?: string\n showHint?: boolean\n /** A leading control group, e.g. an attach button. */\n leading?: JSX.Element\n /** A trailing group before the send button, e.g. a dictation toggle. */\n trailing?: JSX.Element\n /** A menu rendered above the field, e.g. mention suggestions. */\n menu?: JSX.Element\n /**\n * Host progress rendered in the composer's own live region, e.g. dictation\n * state — plain paragraphs are progress, a `role=\"alert\"` paragraph is a\n * failure. Sending and send-failure copy stays the composer's own.\n */\n status?: JSX.Element\n /** The reply target, drawn as a strip above the field. */\n replyTo?: { label: string; onDismiss: () => void }\n /** Ref to the actual message textarea, for host focus and selection behavior. */\n inputRef?: Ref<HTMLTextAreaElement>\n inputId?: string\n /** Accessible name for the actual textarea. Defaults to \"Message\" or \"Reply message\". */\n inputLabel?: string\n /** Additional help text associated with the actual textarea. */\n inputDescription?: string\n /** Existing host description id, combined with `inputDescription` when supplied. */\n inputDescribedBy?: string\n /** Comfortable uses the shared 4rem minimum and 12rem maximum field heights. */\n inputSize?: 'default' | 'comfortable'\n /** The shared resize behavior for the actual textarea. */\n inputResize?: 'vertical' | 'none' | 'both'\n}\n\nexport function MessageComposer(props: MessageComposerProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'value',\n 'onValueChange',\n 'onSubmit',\n 'placeholder',\n 'disabled',\n 'submitLabel',\n 'showHint',\n 'leading',\n 'trailing',\n 'menu',\n 'status',\n 'replyTo',\n 'inputRef',\n 'inputId',\n 'inputLabel',\n 'inputDescription',\n 'inputDescribedBy',\n 'inputSize',\n 'inputResize',\n 'onKeyDown',\n ])\n\n const composer = createComposerCore({\n failureMessage: 'Message not sent. Your draft is kept.',\n })\n const sending = composer.pending\n const descriptionId = `message-composer-help-${createUniqueId()}`\n const describedBy = () =>\n [local.inputDescribedBy, local.inputDescription ? descriptionId : undefined]\n .filter(Boolean)\n .join(' ') || undefined\n const actionLabel = () => local.submitLabel ?? 'Send message'\n const pendingLabel = () =>\n `Sending ${local.submitLabel ? local.submitLabel.toLowerCase() : 'message'}`\n\n const canSend = () => local.value.trim().length > 0 && !local.disabled && !sending()\n\n const send = () => {\n if (canSend()) void composer.submit(() => local.onSubmit())\n }\n\n const onKeyDown: JSX.EventHandlerUnion<HTMLTextAreaElement, KeyboardEvent> = (event) => {\n if (event.defaultPrevented) return\n if (event.key !== 'Enter') return\n // Shift breaks the line; a bare Enter, or a modified one, sends.\n if (event.shiftKey && !event.metaKey && !event.ctrlKey) return\n if (composer.claimEnter(event)) send()\n }\n\n const onFormKeyDown: JSX.EventHandlerUnion<HTMLFormElement, KeyboardEvent> = (event) => {\n callHandler(local.onKeyDown, event)\n if (!composer.dismissError(event)) return\n event.preventDefault()\n event.stopPropagation()\n }\n\n return (\n <form\n data-slot=\"message-composer\"\n class={cn('flex flex-col gap-2', local.class)}\n onSubmit={(event) => {\n event.preventDefault()\n send()\n }}\n onKeyDown={onFormKeyDown}\n {...rest}\n >\n <Show when={local.menu}>\n <div>{local.menu}</div>\n </Show>\n\n <Show when={local.replyTo}>\n {(reply) => (\n <div class=\"bg-muted text-muted-foreground flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs\">\n <span class=\"min-w-0 flex-1 truncate\">Replying to {reply().label}</span>\n <ActionButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label=\"Cancel reply\"\n tooltip=\"Cancel reply\"\n onClick={() => reply().onDismiss()}\n >\n <X />\n </ActionButton>\n </div>\n )}\n </Show>\n\n <div\n class={cn(\n 'border-input bg-card flex flex-col gap-1 rounded-lg border p-2',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n local.disabled && 'opacity-50'\n )}\n >\n <Textarea\n ref={local.inputRef}\n id={local.inputId}\n onCompositionStart={composer.onCompositionStart}\n onCompositionEnd={composer.onCompositionEnd}\n onFocus={composer.onFocus}\n onBlur={composer.onBlur}\n value={local.value}\n onInput={(event) => local.onValueChange(event.currentTarget.value)}\n onKeyDown={onKeyDown}\n placeholder={local.placeholder ?? 'Write a message…'}\n disabled={local.disabled}\n rows={1}\n aria-label={\n local.inputLabel ?? (local.submitLabel ? `${local.submitLabel} message` : 'Message')\n }\n aria-describedby={describedBy()}\n variant=\"composer\"\n size={local.inputSize ?? 'comfortable'}\n resize={local.inputResize ?? 'vertical'}\n />\n <Show when={local.inputDescription}>\n {(description) => (\n <span id={descriptionId} class=\"sr-only\">\n {description()}\n </span>\n )}\n </Show>\n\n <div class=\"flex items-center gap-1\">\n <Show when={local.leading}>{local.leading}</Show>\n <div class=\"ms-auto flex items-center gap-1\">\n <Show when={local.trailing}>{local.trailing}</Show>\n <ActionButton\n type=\"submit\"\n size=\"icon-sm\"\n disabled={!canSend()}\n aria-label={sending() ? pendingLabel() : actionLabel()}\n tooltip={actionLabel()}\n >\n <Show when={sending()} fallback={<Send />}>\n <Spinner size=\"sm\" label={false} class=\"text-primary-foreground\" />\n </Show>\n </ActionButton>\n </div>\n </div>\n </div>\n\n <Show when={local.showHint}>\n <p class=\"text-muted-foreground flex items-center gap-1.5 text-2xs\">\n <Kbd>Enter</Kbd> to send\n <span aria-hidden=\"true\">·</span>\n <Kbd>Shift</Kbd> <Kbd>Enter</Kbd> for a new line\n </p>\n </Show>\n\n {/* A live region, so the outcome is announced without moving focus out of the\n field the user is typing in. */}\n <div role=\"status\" aria-live=\"polite\" class=\"min-h-0\">\n <Show\n when={sending()}\n fallback={\n <Show when={composer.error()}>\n {(message) => (\n <p class=\"text-foreground border-s-2 border-destructive ps-2 text-xs\">\n {message()}\n </p>\n )}\n </Show>\n }\n >\n {pendingLabel()}…\n </Show>\n <Show when={local.status}>{local.status}</Show>\n </div>\n </form>\n )\n}\n\n/**\n * The attachment control.\n *\n * A slot rather than a built-in, because what can be attached is the application's\n * business — but the *button* is shared, so it looks and behaves the same in both.\n * The count is announced, since a paperclip alone does not say whether anything is\n * attached.\n */\nexport function ComposerAttachmentButton(\n props: ComponentProps<typeof Button> & { count?: number; open?: boolean }\n) {\n const [local, rest] = splitProps(props, ['count', 'open', 'children'])\n\n return (\n <ActionButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={local.count ? `${local.count} attached, add an attachment` : 'Add an attachment'}\n aria-expanded={local.open}\n tooltip=\"Add an attachment\"\n class=\"text-muted-foreground\"\n {...rest}\n >\n {local.children ?? <Paperclip />}\n </ActionButton>\n )\n}\n\n/** The hint a composer shows when the field is empty, as a one-line prompt. */\nexport function ComposerHint(props: ComponentProps<'p'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <p\n class={cn('text-muted-foreground flex items-center gap-1.5 text-2xs', local.class)}\n {...rest}\n >\n {local.children ?? (\n <>\n <CornerDownLeft aria-hidden=\"true\" class=\"size-3\" />\n <Kbd>Enter</Kbd> to send\n </>\n )}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GtC;;AAGA,SAAgBkJ,aAAatG,OAA4B;CACvD,MAAM,CAACC,OAAOC,QAAQtC,WAAWoC,OAAO,CAAC,SAAS,UAAU,CAAC;CAC7D,cAAA;EAAA,IAAAuG,SAAAC,QAAA;EAAA1D,OAAAyD,QAAAxD,WAAA,EAAA,KAAA,WAAA;GAAA,OAEWjF,GAAG,4DAA4DmC,MAAM+C,KAAK;EAAC,EAAA,GAC9E9C,IAAI,GAAA,OAAA,IAAA;EAAA+C,OAAAsD,cAEPtG,MAAMmD,YAAQ;GAAAF,gBAEV/F,gBAAc;IAAA,eAAA;IAAA,SAAA;GAAA,CAAA;GAAA+F,gBACdjF,KAAG,EAAAmF,UAAA,QAAA,CAAA;GAAA;EAAA,CAEP;EAAA,OAAAmD;CAAA,EAAA,CAAA;AAGP;AAACE,eAAA,CAAA,SAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-follow.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/scroll-follow.ts"],"names":[],"mappings":"AAkCA,sGAAsG;AACtG,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAAA;AAEvF,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,MAAM,MAAM,IAAI,CAAA;AAE/C,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,MAAM,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,2BAA2B,GAAG,SAAS,CAAA;IAC/D,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,IAAI,CAAA;CACnE;;;;;
|
|
1
|
+
{"version":3,"file":"scroll-follow.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/scroll-follow.ts"],"names":[],"mappings":"AAkCA,sGAAsG;AACtG,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAAA;AAEvF,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,MAAM,MAAM,IAAI,CAAA;AAE/C,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,MAAM,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,2BAA2B,GAAG,SAAS,CAAA;IAC/D,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,IAAI,CAAA;CACnE;;;;;4BAuU2B,cAAc;2BAKf,cAAc;EAIxC"}
|
|
@@ -13,6 +13,7 @@ function createScrollFollow(options) {
|
|
|
13
13
|
let readerMovedSinceWrite = false;
|
|
14
14
|
let previousTop = -1;
|
|
15
15
|
let lastScrollClientHeight = 0;
|
|
16
|
+
let endRow = null;
|
|
16
17
|
let pendingRestore;
|
|
17
18
|
let pendingRestoreUserIntent = false;
|
|
18
19
|
let holds = 0;
|
|
@@ -36,6 +37,7 @@ function createScrollFollow(options) {
|
|
|
36
37
|
};
|
|
37
38
|
onCleanup(reportPosition);
|
|
38
39
|
const rememberPosition = (element) => {
|
|
40
|
+
endRow = content?.lastElementChild ?? null;
|
|
39
41
|
lastWriteTop = element.scrollTop;
|
|
40
42
|
lastWriteClientHeight = element.clientHeight;
|
|
41
43
|
previousTop = element.scrollTop;
|
|
@@ -53,6 +55,11 @@ function createScrollFollow(options) {
|
|
|
53
55
|
readerMovedSinceWrite
|
|
54
56
|
})) rememberPosition(element);
|
|
55
57
|
};
|
|
58
|
+
const appendedHeight = () => {
|
|
59
|
+
const last = content?.lastElementChild;
|
|
60
|
+
if (!last || !endRow || last === endRow || endRow.parentElement !== content) return 0;
|
|
61
|
+
return Math.max(0, last.getBoundingClientRect().bottom - endRow.getBoundingClientRect().bottom);
|
|
62
|
+
};
|
|
56
63
|
const pinHeld = (element) => {
|
|
57
64
|
const geom = scrollGeometry(element);
|
|
58
65
|
stick = true;
|
|
@@ -194,7 +201,13 @@ function createScrollFollow(options) {
|
|
|
194
201
|
contentObserver = new MutationObserver(() => {
|
|
195
202
|
if (!scroller || !options.enabled() || pendingRestore || holds > 0 || !stick || readerMovedSinceWrite || lastWriteTop < 0) return;
|
|
196
203
|
if (scroller.scrollTop >= lastWriteTop - 2) return;
|
|
197
|
-
|
|
204
|
+
const geom = scrollGeometry(scroller);
|
|
205
|
+
if (isAtEnd(geom)) return rememberPosition(scroller);
|
|
206
|
+
const grown = appendedHeight();
|
|
207
|
+
if (grown > 0 && isAtEnd({
|
|
208
|
+
...geom,
|
|
209
|
+
scrollHeight: geom.scrollHeight - grown
|
|
210
|
+
})) rememberPosition(scroller);
|
|
198
211
|
});
|
|
199
212
|
contentObserver.observe(content, {
|
|
200
213
|
childList: true,
|