Files
llama.cpp/tools/ui/tests/client/nested-surfaces.svelte.test.ts
T
Aleksander Grygier 7592b61d3b ui: move Models, MCP and Settings to a sidebar footer (#32022)
* ui : move Models, MCP and Settings to a sidebar footer

The sidebar's actions split in two: New chat, Search and Projects stay at
its top, and Models, MCP and Settings move to a footer at its bottom, under
a thin rule, in the expanded sidebar and its collapsed strip alike. On a
phone the footer keeps clear of the home indicator, and Models stays
desktop-only as before. The search dialog still lists every action.

Assisted-by: Claude (Opus 5.5 Medium)

* ui : group the sidebar footer in an inset surface

The design system gains inset-group-surface, for rows grouped inside a glass
panel: white on the light glass and a faint tint of the text colour on the
dark one, with the sidebar's own ambient edge, no inner highlight, a faint
wide shade under it and the card radius. It is matte-glass pointed at its
own component tokens, like the sidebar and chat form surfaces, and reads as
part of the panel: no tight contact shadow or solid border like a button,
no inset shade like a field.

The sidebar footer uses it in place of the rule above Models, MCP and
Settings. DESIGN.md and the Surfaces page document it.

Assisted-by: Claude (Opus 5.5 Medium)

* ui : give the sidebar's logo button the add button's key look

Whenever the sidebar shows, open or peeking, its logo button takes the same
key as the chat form's add button (matte-key, white in light mode, a light
tint in dark), in place of its own muted fill. While the sidebar is hidden
the logo has no fill and no shadow, and hover and focus never change the
fill. It keeps its round shape and its own size.

Assisted-by: Claude (Opus 5.5 Medium)

* ui : put search in a round key at the top of the phone sidebar

On a phone the sidebar's Search row moves to a round key at the right end
of its top row, across from the logo, with the same key look as the logo
and the chat form's add button. It opens search as the row did. Desktop
keeps the Search row.

Assisted-by: Claude (Opus 5.5 Medium)

* ui : size the phone sidebar for a thumb and list its footer with the actions

On a phone the sidebar's actions and rows are 48px tall at 17px, flush one under
the other with 16px corners, its section headings 15px and grey, and its groups
28px apart. MCP and Settings join the top actions there: the footer is a desktop
pattern.

Assisted-by: Claude (Opus 5.5 Medium)

* ui : mark the selected sidebar row with a tinted inset surface

Assisted-by: Claude (Opus 5.5 Medium)

* ui: keep the phone sidebar's round keys white on the grey page

Assisted-by: Claude (Opus 5.5 Medium)

* ui : open Settings and MCP as pages on a phone, dialogs elsewhere

On a phone the sidebar opens them at #/settings and #/mcp-servers, with the menu key and a
title like any phone page. Pinned under the status bar, Settings' section tabs fill the
screen above them in the page's colour.

Assisted-by: Claude (Opus 5.5 Medium)

* ui : open a phone sidebar's pages behind it, settled before they slide back

A tap in the phone sidebar now opens its page while the current one is still aside and slides
back once it has rendered, instead of swapping pages mid-slide. The slid page's fixed bars are
pinned again as the page under them changes, the lock ends with the slide itself, and a
phone's new chat shows its form and greeting at once, without the move and entry they have
on a desktop.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: style the sidebar footer group and the selected row with master's classes until the design system lands

Assisted-by: Claude (Opus 5.5 Medium)

* ui: add GlassKey with master's styles for the phone sidebar's round keys

Assisted-by: Claude (Opus 5.5 Medium)

* ui: center the top edge of a new chat's form on the screen

The form rested 42px below the middle up to 2xl and 6px above it past
that; one drop, from the resting card's height, now puts its top edge on
the middle at every width from md up.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: round the sidebar's action rows concentric with the footer group

The sidebar stacks four surfaces: the page, the sidebar, the footer group
inset in it and a row in the group. app.css now names the group's radius
and padding, and derives the row radius from them (16px less 4px), so the
footer's rows run parallel to its corners; the actions at the top of the
sidebar share that radius. The footer moves to its own component, the
README documents the pattern, and a client test holds the rule on the
rendered footer.

A selected action row was bg-accent, the same grey as a hovered row in
light and darker than the footer's fill in dark, so it read as hovered or
not at all; it is now raised and edged, while a hover only tints.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: import demo chats through the Settings page on a phone

A phone opens Settings as a page now, not a dialog, so the demo harness
waited for a dialog that never came and every phone demo with traces
failed; it now imports through whichever of the two opens.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: count the sidebar's rows from their items in the surface test

The test expected three footer rows and two top actions, which the
stacked PRs change as they add Projects, Library and Servers; it now
expects as many rows as the sidebar has items.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: add a line on Meta+Enter off macOS too

The chat form takes Meta+Enter as Ctrl+Enter and leaves the newline to
the editor, but the editor bound only Mod-Enter, which is Ctrl off
macOS, so on Linux Meta+Enter neither sent nor added a line. This failed
the client test on CI's Linux runners, on master too.

Assisted-by: Claude (Opus 5.5 Medium)
2026-11-10 18:58:57 +01:00

86 lines
3.5 KiB
TypeScript

// The sidebar's footer is the third of four nested surfaces: the page, the sidebar on it, a
// group inset in the sidebar and a row in the group. This holds the rule app.css states for
// them, on what the browser actually renders: a row's corners are concentric with its
// group's, so its radius is the group's less the padding between their edges.
import '../../src/app.css';
import SidebarNavigationActions from '$lib/components/app/navigation/SidebarNavigation/SidebarNavigationActions.svelte';
import SidebarNavigationFooter from '$lib/components/app/navigation/SidebarNavigation/SidebarNavigationFooter.svelte';
import { SIDEBAR_ACTIONS_ITEMS, SIDEBAR_FOOTER_ITEMS } from '$lib/constants';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { page } from 'vitest/browser';
import { render } from 'vitest-browser-svelte';
function px(value: string): number {
return parseFloat(value);
}
async function renderFooter() {
const screen = render(SidebarNavigationFooter, {});
const rows = () => [...screen.container.querySelectorAll<HTMLElement>('[data-slot="button"]')];
await vi.waitFor(() => expect(rows()).toHaveLength(SIDEBAR_FOOTER_ITEMS.length));
const group = rows()[0].parentElement?.parentElement;
if (!group) throw new Error('footer group not rendered');
return { group, rows: rows() };
}
describe('nested surfaces', () => {
// the footer is a desktop's and a tablet's: a phone lists its items with the sidebar's actions
beforeEach(async () => {
await page.viewport(1280, 900);
});
it('round the footer group from its tokens', async () => {
const { group } = await renderFooter();
const root = getComputedStyle(document.documentElement);
const style = getComputedStyle(group);
// the tokens resolve, so the group is not left square or unpadded
expect(px(style.borderTopLeftRadius)).toBeGreaterThan(0);
expect(px(style.paddingTop)).toBeGreaterThan(0);
expect(root.getPropertyValue('--surface-group-radius').trim()).not.toBe('');
expect(root.getPropertyValue('--surface-group-padding').trim()).not.toBe('');
});
it('keep each footer row concentric with its group', async () => {
const { group, rows } = await renderFooter();
const style = getComputedStyle(group);
const expected = px(style.borderTopLeftRadius) - px(style.paddingTop);
for (const row of rows) {
const radius = getComputedStyle(row).borderTopLeftRadius;
expect(px(radius), row.textContent ?? '').toBeCloseTo(expected, 1);
}
});
it('inset each footer row by the group padding the radius accounts for', async () => {
const { group, rows } = await renderFooter();
const style = getComputedStyle(group);
const box = group.getBoundingClientRect();
// the hairline border sits outside the padding the radius is reduced by
const inner = box.left + px(style.borderLeftWidth) + px(style.paddingLeft);
for (const row of rows) {
expect(row.getBoundingClientRect().left).toBeCloseTo(inner, 0);
}
});
it('round the top actions of the sidebar like the footer rows', async () => {
const { rows: footerRows } = await renderFooter();
const expected = getComputedStyle(footerRows[0]).borderTopLeftRadius;
const top = render(SidebarNavigationActions, { class: '' });
const rows = () => [...top.container.querySelectorAll<HTMLElement>('[data-slot="button"]')];
await vi.waitFor(() => expect(rows()).toHaveLength(SIDEBAR_ACTIONS_ITEMS.length));
for (const row of rows()) {
expect(getComputedStyle(row).borderTopLeftRadius, row.textContent ?? '').toBe(expected);
}
});
});