Commit ba8521a44 for llama.cpp
commit ba8521a44eaa91c5ecab0e5571cb75fc84c106b8
Author: Aleksander Grygier <aleksander.grygier@gmail.com>
Date: Tue Nov 24 15:29:51 2026 +0100
ui: smooth chat form height and working directory chip across routes (#32950)
* ui: ease the chat form height and fade the working directory chip across routes
Assisted-by: Claude (Opus 5.5 Medium)
* ui: open the room for the working directory chip first, then fade it in
Assisted-by: Claude (Opus 5.5 Medium)
* ui: skip the working directory chip transition when the route changes
Assisted-by: Claude (Opus 5.5 Medium)
* ui: resize the working directory chip's box in full before fading the chip in
Assisted-by: Claude (Opus 5.5 Medium)
* ui: halve the working directory chip transition
Assisted-by: Claude (Opus 5.5 Medium)
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte
index 2f9fe042e..cff5eb1da 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte
@@ -6,6 +6,8 @@
import * as Popover from '@ggml-org/llama-ui/ui/popover';
import { FolderOpen, X } from '@lucide/svelte';
import {
+ CHAT_FORM_CHIP_SPLIT,
+ CHAT_FORM_CHIP_TRANSITION_MS,
DEFAULT_MOBILE_BREAKPOINT,
HOME_TILDE,
SEARCH,
@@ -18,6 +20,8 @@
import { ToolsService } from '#lib/services/tools.service.ts';
import { conversationsStore, deviceStore, toolsStore } from '#lib/stores/index.ts';
import { abbreviateHome, runGlobSearchWithChildren } from '#lib/utils/index.ts';
+ import { page } from '$app/state';
+ import { cubicInOut } from 'svelte/easing';
// Microtask delay so the popover's focus scope tears down first.
const FOCUS_DELAY_MS = 0;
@@ -302,28 +306,69 @@
}
}
+ // the chip leaves with the directory it showed, instead of emptying while it fades out
+ let chipDirectory = $state<string | null>(null);
+
+ $effect(() => {
+ if (directory) chipDirectory = directory;
+ });
+
+ // A route change swaps the chip along with the whole form, which fades on its own: only a
+ // directory set or cleared on the same route animates. The effect runs before the DOM
+ // update that adds or removes the chip, so the transition sees the change as it starts.
+ const ROUTE_SWAP_WINDOW_MS = 100;
+ let routeChangedAt = -Infinity;
+
+ const routeJustChanged = () => performance.now() - routeChangedAt < ROUTE_SWAP_WINDOW_MS;
+
+ $effect.pre(() => {
+ void page.params.id;
+
+ routeChangedAt = performance.now();
+ });
+
+ // two steps: the box that holds the chip resizes to its full height first (the form below
+ // it follows), then the chip fades in; leaving runs the same curve backwards, so it fades
+ // out before the box closes
+ function chipTransition(node: Element) {
+ const height = node.getBoundingClientRect().height;
+
+ return {
+ css: (t: number) => {
+ const resize = cubicInOut(Math.min(t / CHAT_FORM_CHIP_SPLIT, 1));
+ const fade = Math.max((t - CHAT_FORM_CHIP_SPLIT) / (1 - CHAT_FORM_CHIP_SPLIT), 0);
+
+ return `overflow: hidden; height: ${height * resize}px; opacity: ${fade};`;
+ },
+ delay: 0,
+ duration: routeJustChanged() ? 0 : CHAT_FORM_CHIP_TRANSITION_MS
+ };
+ }
+
let innerWidth = $state(0);
const showTooltip = $derived(innerWidth > DEFAULT_MOBILE_BREAKPOINT);
</script>
{#if showChip}
- <button
- class={[
- 'justify-self-start flex min-w-0 w-auto items-center gap-1 mt-1.5 py-1 px-2 backdrop-blur-2xl rounded-md',
- className
- ]}
- {disabled}
- onclick={onOpen}
- type="button"
- >
- <ChatFormCurrentWorkingDirectoryChip
- {directory}
+ <div transition:chipTransition class="grid">
+ <button
+ class={[
+ 'justify-self-start flex min-w-0 w-auto items-center gap-1 mt-1.5 py-1 px-2 backdrop-blur-2xl rounded-md',
+ className
+ ]}
{disabled}
- {homeBase}
- onClear={handleDismiss}
- {showTooltip}
- />
- </button>
+ onclick={onOpen}
+ type="button"
+ >
+ <ChatFormCurrentWorkingDirectoryChip
+ directory={directory ?? chipDirectory}
+ {disabled}
+ {homeBase}
+ onClear={handleDismiss}
+ {showTooltip}
+ />
+ </button>
+ </div>
{/if}
<!-- the drawer's version is roomier: the header's inset, rows spaced for a finger and
diff --git a/ui/apps/chat/src/lib/constants/chat-form.constants.ts b/ui/apps/chat/src/lib/constants/chat-form.constants.ts
index 263fc8a87..ff1d5b4ae 100644
--- a/ui/apps/chat/src/lib/constants/chat-form.constants.ts
+++ b/ui/apps/chat/src/lib/constants/chat-form.constants.ts
@@ -65,3 +65,9 @@ export const CHAT_FORM_EASE_OUT = 'cubic-bezier(0.32, 0.72, 0, 1)';
/** The phone's corner keys and header stepping aside for the expanded form, and back. */
export const CHAT_FORM_CHROME_FADE_MS = 150;
+
+/** The working directory chip's enter and exit, in two steps: room first, then the fade. */
+export const CHAT_FORM_CHIP_TRANSITION_MS = 250;
+
+/** Share of the chip's transition spent on the room; the fade takes the rest. */
+export const CHAT_FORM_CHIP_SPLIT = 0.5;