* ui: bring @ggml-org/llama-ui into ui/lib/ui The design system package (tokens, fonts, surfaces, components and Model UI), so far in the temporary ggml-org/llama-ui repository at edaf518, moves to its home in ui/lib/ui, built with @sveltejs/package and published as @ggml-org/llama-ui from here. ui/lib holds the packages, one folder each. Its references to tools/ui now name ui/apps/chat, its package.json points at this repository, and the UI workflow type-checks and packs it. ui/README.md describes the layout. Assisted-by: Claude (Opus 5.5 Medium) * ui: Llama UI design system: tokens, surfaces and brand The design system from allozaur/docs/storybook-overhaul: three tiers of tokens, matte glass surfaces, Llama Sans and Llama Mono, and the base components on the new tokens (Tabs and GlassKey among them). It also restyles the stack's features with it, replacing the plain stand-ins they used until now. DESIGN.md is generated from the tokens. The Storybook that documents it is the next PR. Assisted-by: Claude (Opus 5.5 Medium) * ui: have Llama Chat use @ggml-org/llama-ui for its base components, tokens and fonts Llama Chat kept its own copy of the design system: 29 base components, the three tiers of tokens, the surfaces, the theme and the fonts, next to the 12 components ui/lib/ui held. The copy goes, and the library gets what it lacked. ui/lib/ui - the 17 base components the app had and the library did not (alert, alert-dialog, button-group, checkbox, collapsible, context-menu, dialog, drawer, dropdown-menu, empty, hover-card, radio-group, scroll-area, skeleton, table, tabs, textarea), with vaul-svelte for the drawer - the inset-group and selected-row tokens and surfaces - sources import each other by relative path instead of $lib, which in an app points at the app's own src/lib - theme.css no longer imports tw-animate-css: it is a peer dependency that the consumer imports before the theme, as it does Tailwind - 0.3.0 ui/apps/chat - imports the base components as @ggml-org/llama-ui/ui/<name> and cn/tv as @ggml-org/llama-ui/utils; app.css imports the library's theme.css - compiles the library from source, with no install or build of it: scripts/vite-plugin-llama-ui.ts resolves its entry points and what it imports, and svelte.config.js gives TypeScript the same paths - src/lib/components/ui, styles/tokens, styles/surfaces.css and assets/fonts are removed; components.json moves to the library Builds - CMake stages ui/lib/ui next to the app, keeping the layout of ui/, and rebuilds when a library source changes - the Dockerfiles copy the library's sources; the Nix derivation takes ui/ as its source The built CSS has the same rules in the same order, apart from one zero-specificity rule and the @font-face rules moving, plus ten utilities and two tokens that only the library's own components use. Assisted-by: Claude (Opus 5.5 Medium) * ui: AGENTS.md places Llama UI in ui/lib/ui Llama Chat's AGENTS.md says where each part lives: Llama UI is ui/lib/ui, and Chat imports its tokens, fonts and base components from there. Assisted-by: Claude (Opus 5.5 Medium) * ui: Llama Sans and Llama Mono from llama-brand's latest, and shell commands marked in bash code The fonts in ui/lib/ui come from llama-brand's latest, with optical sizes from 10 to 36. Bash code blocks mark shell commands and flags. Assisted-by: Claude (Opus 5.5 Medium) * ui: open submenus outside the menu they come from A submenu was rendered inside its parent menu, so the menu's scroll box clipped it: the glass menus' backdrop filter, and the filter and transform of the open animation, make the menu the containing block even for the fixed-position submenu. Dropdown and context submenus now render in a portal, like the menus themselves. Assisted-by: Claude (Opus 5.5 Medium) * ui: draw submenus like the menu they open from Submenus had smaller corners than their menus, and context menus had none of the dropdown's glass. Context-menu parts now match the dropdown's, and both submenus take the menu's corners and height cap, with their first row level with the row that opens them, 4px past the menu's edge. Sub-triggers take the items' radius and pointer. The submenus' height cap and zoom origin named the dropdown's CSS variables, which bits-ui does not set on submenus; they now use its --bits-menu-* ones. The chat group submenu takes the actions menu's z-[999999] layer, as it no longer renders inside that menu. Assisted-by: Claude (Opus 5.5 Medium) * ui: keep a late current-node write off a closed or switched conversation updateCurrentNode checked the active conversation, awaited the database write, then wrote currNode to whatever was active after it. When the conversation closed during the write it threw, and the reply ended in a streaming error dialog. When another conversation opened, that one got the wrong node. Assisted-by: Claude (Fable 5.2) * ui: have Llama Chat use the library's Model UI and app components Llama Chat still kept its own copies of what the library holds above the base components. It now takes them from @ggml-org/llama-ui too, and its copies go. ui/lib/ui - ModelId gains what Chat's had: the model's own draft kind, draft sidecars with their quant (ModelDraftSidecars, new), aliases, hideName and a tooltip, in the same badge order - entry points for them, like ui/<name>: @ggml-org/llama-ui/app/<group> (actions, content, forms, misc) and @ggml-org/llama-ui/models ui/apps/chat - ActionIcon, SearchInput, SyntaxHighlightedCode, Logo, ModelCapabilityIcons, ModelDownloadProgressBar and ModelDraftSidecars come from the library; Chat's copies and the two constants only they used are removed - ModelId and ModelOrgAvatar stay as thin wrappers: ModelId parses the raw id and applies the user's display settings, ModelOrgAvatar hides the avatar while Hub metadata is off - the svelte/* TypeScript path falls back to Svelte's types/index.d.ts: svelte/reactivity has no file of its own, so a library source importing it got its types from ui/lib/ui's own install when there was one Assisted-by: Claude (Opus 5.5 Medium) * ui: Llama UI takes the brand's colours and logo from llama-brand @ggml-org/llama-brand is now a dependency of the library, by the same GitHub tarball Llama Chat already installs, which now names it @ggml-org/llama-brand too. - primitives.css drops the 25 tokens it held copies of (the neutral greys, sand, the skies and cinder) and builds on llama-brand's css/colors.css instead; the skies' gradients point at llama-brand's. Apps import that file before theme.css, as they do Tailwind and tw-animate-css: the library's stylesheets import no package, so an app that compiles them from source resolves it from its own node_modules - Logo draws llama-brand's icon, in currentColor, and assets/logo.svg goes - Llama Chat's TypeScript paths resolve llama-brand from its own node_modules, like the library's other dependencies The fonts stay as the library's WOFF2 copies until llama-brand ships WOFF2 builds of them. Assisted-by: Claude (Opus 5.5 Medium) * ui: have Llama Chat take the library's constants, enums and helpers Llama Chat redefined most of what the library exports next to its components. Where the two were the same, Chat now re-exports the library's from the files that held them, so its own imports stay as they are. - the library gets entry points for them: @ggml-org/llama-ui/constants, @ggml-org/llama-ui/enums and @ggml-org/llama-ui/code, and @ggml-org/llama-ui/models carries the model data with the Model UI - from the library now: the shared CSS classes and code-block constants, the byte units, the memory-fit constants and minMemoryTierGb, the bit depth labels, the capability and modality icons, labels and order, ColorMode, TooltipSide, BooleanString, the model enums, ModelModalities, formatParameters, highlightCode and trimCodePadding - the library's modality order follows Chat's: vision, video, audio - Chat keeps its own where they differ: UI_DATA_ATTRS and ModelDownloadProgress are supersets of the library's (the latter extends it now), and formatFileSize counts in 1024s Assisted-by: Claude (Opus 5.5 Medium) * ui: give the chat form's add key and model selector a tighter shadow In light, the two keys inside the chat form, white on its white glass, took the control elevation, whose soft spread blended into the form. They take a new elevation-key instead: a 0.5px hairline all round and a 1px drop. In dark they keep the control elevation. Chosen from the options in Scrapbook › UI › Composer keys. - semantic tokens: --elevation-key (light: the hairline and the drop; dark: the control elevation) - component token: --chat-form-key-shadow, for the add key and every model selector trigger - DESIGN.md names it next to the other elevations Assisted-by: Claude (Opus 5.5 Medium)
379 lines
13 KiB
CSS
379 lines
13 KiB
CSS
@import 'tailwindcss';
|
|
@source '.';
|
|
/* stories may use classes the app does not, so tailwind scans them too */
|
|
@source '../tests/stories';
|
|
@plugin '@tailwindcss/forms';
|
|
@plugin '@tailwindcss/typography';
|
|
@import 'tw-animate-css';
|
|
/* the brand's colours, which Llama UI's primitives build on */
|
|
@import '@ggml-org/llama-brand/css/colors.css';
|
|
/* Llama UI's theme (ui/lib/ui): fonts, tokens, surfaces, the shadcn names and the base styles
|
|
its components read. By path rather than as @ggml-org/llama-ui/theme.css: prettier's Tailwind
|
|
plugin reads this file too, and it knows no aliases */
|
|
@import '../../../lib/ui/src/lib/styles/theme.css';
|
|
@import './lib/styles/safe-area.css';
|
|
|
|
:root {
|
|
/* the page runs under the status bar and over the home indicator
|
|
(viewport-fit=cover); what is pinned to a screen edge keeps clear of them
|
|
with the pt-safe / pb-safe utilities (see lib/styles/safe-area.css) */
|
|
--safe-area-top: env(safe-area-inset-top, 0px);
|
|
--safe-area-bottom: env(safe-area-inset-bottom, 0px);
|
|
/* where the phone's corner controls (menu toggle, context gauge, sidebar logo) sit */
|
|
--corner-control-top: calc(1rem + var(--safe-area-top));
|
|
/* where a phone page's title starts: a row below the corner controls */
|
|
--page-top: calc(var(--corner-control-top) + 3.75rem);
|
|
/* expanded desktop sidebar width, overridden once the user drags its edge */
|
|
--sidebar-width: 18rem;
|
|
/* phone sidebar width, which the page slides aside to reveal */
|
|
--sidebar-reveal: min(80dvw, 20rem);
|
|
/* the desktop sidebar's muted/60 over the page, made opaque so the slid page's corners can match it */
|
|
--sidebar-reveal-tint: color-mix(in oklab, var(--muted) 60%, var(--background));
|
|
/* how far the phone sidebar is open, 0 to 1, stepped every frame by useSidebarReveal */
|
|
--sidebar-reveal-progress: 0;
|
|
/* the same on a log curve: the sidebar's contents hold on until the page nearly covers them */
|
|
--sidebar-reveal-ease: calc(log(1 + 9 * var(--sidebar-reveal-progress)) / log(10));
|
|
/* the page background, blending into the sidebar tint as the phone sidebar opens */
|
|
--sidebar-reveal-bg: color-mix(
|
|
in oklab,
|
|
var(--sidebar-reveal-tint) calc(var(--sidebar-reveal-progress) * 100%),
|
|
var(--background)
|
|
);
|
|
--layer-popover: 1000000;
|
|
|
|
--chat-form-area-height: 8rem;
|
|
--chat-form-area-offset: 2rem;
|
|
--chat-form-padding-top: 6rem;
|
|
|
|
/* Nested surfaces, outermost first: the page, the sidebar on it, a group inset in the
|
|
sidebar (its footer) and a row in the group. A row keeps its corners concentric with the
|
|
group's: its radius is the group's less the padding between their edges. The sidebar's
|
|
actions above the footer share the row radius, so every action row rounds alike. See "Nested
|
|
surfaces" in the README; tests/client/nested-surfaces.svelte.test.ts holds the rule */
|
|
--surface-group-radius: var(--inset-group-radius);
|
|
--surface-group-padding: 0.25rem;
|
|
--surface-row-radius: calc(var(--surface-group-radius) - var(--surface-group-padding));
|
|
|
|
/* the chat form card holding one line of text, as it rests on a new chat */
|
|
--chat-form-collapsed-height: 6.375rem;
|
|
/* the empty chat form card, its text and actions in one row: a new chat centers its top edge */
|
|
--chat-form-resting-height: 3.375rem;
|
|
/* the chat form's corners while its text and actions share one row */
|
|
--chat-form-single-row-radius: 1.25rem;
|
|
/* the card's translucent fill over the page, made opaque: the phone sheet, and the page and Safari's bars around it */
|
|
--chat-form-sheet-fill: color-mix(in oklab, var(--muted) 60%, var(--background));
|
|
--max-message-height: max(24rem, min(80dvh, calc(100dvh - var(--chat-form-area-height) - 12rem)));
|
|
}
|
|
|
|
/* iOS 26 gives an installed app with viewport-fit=cover and a translucent status bar a
|
|
viewport short of that bar (WebKit bug 301108), but only while the page is shorter than
|
|
the screen. A page that reaches past it gets the full screen, after which this is 100%,
|
|
capped at the screen so it never scrolls; elsewhere the inset is 0 and it is 100% too. */
|
|
@media (display-mode: standalone) {
|
|
/* the installed app's status bar already sets them apart from the screen's edge */
|
|
:root {
|
|
--corner-control-top: calc(0.25rem + var(--safe-area-top));
|
|
}
|
|
|
|
html {
|
|
min-height: min(100lvh, calc(100% + var(--safe-area-top)));
|
|
}
|
|
}
|
|
|
|
@media (min-width: 640px) {
|
|
:root {
|
|
--chat-form-area-height: 24rem;
|
|
--chat-form-area-offset: 12rem;
|
|
--chat-form-padding-top: 6rem;
|
|
}
|
|
}
|
|
|
|
.dark {
|
|
--chat-form-sheet-fill: color-mix(in oklab, var(--muted) 75%, var(--background));
|
|
}
|
|
|
|
@layer base {
|
|
/* over the theme's page background: it blends into the sidebar tint as the phone sidebar opens */
|
|
body {
|
|
@apply bg-(--sidebar-reveal-bg);
|
|
scrollbar-width: thin;
|
|
scrollbar-gutter: stable;
|
|
}
|
|
|
|
/* While the chat form is a full-screen sheet on a phone, the page around it takes the
|
|
sheet's fill: iOS paints the installed app's status bar and home indicator areas, and
|
|
Safari tints its bars, from this background */
|
|
@media (width < 48rem) {
|
|
html[data-chat-form-sheet],
|
|
html[data-chat-form-sheet] body {
|
|
background-color: var(--chat-form-sheet-fill);
|
|
}
|
|
}
|
|
|
|
/* no elastic bounce past the ends of the page: it drags the sticky and
|
|
fixed bars (tab bar, chat form) along and they jump back on release */
|
|
html,
|
|
body {
|
|
overscroll-behavior: none;
|
|
}
|
|
|
|
/* no gray flash over a tapped control, which has its own press state, and
|
|
no text inflation when a phone turns to landscape */
|
|
html {
|
|
-webkit-tap-highlight-color: transparent;
|
|
-webkit-text-size-adjust: 100%;
|
|
text-size-adjust: 100%;
|
|
}
|
|
|
|
/* a tap clicks at once rather than waiting to see if it is a double-tap zoom */
|
|
button,
|
|
a,
|
|
[role='button'] {
|
|
touch-action: manipulation;
|
|
}
|
|
|
|
/* holding a control does not select its label or pop the link callout;
|
|
links stay selectable, as in a message they are content */
|
|
button,
|
|
[role='button'] {
|
|
-webkit-touch-callout: none;
|
|
-webkit-user-select: none;
|
|
user-select: none;
|
|
}
|
|
|
|
/* same for dialogs, whose panels and lists scroll on their own with sticky
|
|
headers and footers. Scroll containers only: Firefox treats an
|
|
overflow-hidden box (truncated text) as one, and with `none` it would
|
|
keep the wheel from reaching the list around it */
|
|
:is([role='dialog'], [role='alertdialog']),
|
|
:is([role='dialog'], [role='alertdialog'])
|
|
:is(.overflow-auto, .overflow-y-auto, [data-slot='scroll-area-viewport']) {
|
|
overscroll-behavior: none;
|
|
}
|
|
|
|
/* Global scrollbar styling - visible only on hover */
|
|
* {
|
|
scrollbar-width: thin;
|
|
scrollbar-color: transparent transparent;
|
|
}
|
|
|
|
*:hover {
|
|
scrollbar-color: color-mix(in oklch, var(--fg-muted) 30%, transparent) transparent;
|
|
}
|
|
|
|
*::-webkit-scrollbar {
|
|
width: 6px;
|
|
height: 6px;
|
|
}
|
|
|
|
*::-webkit-scrollbar-track {
|
|
background: transparent;
|
|
}
|
|
|
|
*::-webkit-scrollbar-thumb {
|
|
background: transparent;
|
|
border-radius: 3px;
|
|
transition: background 0.2s ease;
|
|
}
|
|
|
|
*:hover::-webkit-scrollbar-thumb {
|
|
background: color-mix(in oklch, var(--fg-muted) 30%, transparent);
|
|
}
|
|
|
|
*::-webkit-scrollbar-thumb:hover {
|
|
background: color-mix(in oklch, var(--fg-muted) 50%, transparent);
|
|
}
|
|
}
|
|
|
|
@layer utilities {
|
|
.scrollbar-hide {
|
|
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
&::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
/* Hide scrollbar for IE, Edge and Firefox */
|
|
-ms-overflow-style: none;
|
|
scrollbar-width: none;
|
|
}
|
|
|
|
/* Fade at the top edge of the chat, under the tab bar or a sticky header */
|
|
.chat-top-fade {
|
|
background: linear-gradient(
|
|
to bottom,
|
|
color-mix(in srgb, var(--background) 100%, transparent) 25%,
|
|
color-mix(in srgb, var(--background) 80%, transparent) 50%,
|
|
color-mix(in srgb, var(--background) 40%, transparent) 75%,
|
|
transparent 100%
|
|
);
|
|
}
|
|
|
|
/* The same fade at the top of a phone's screen: solid behind the status bar and the row of
|
|
corner controls under it (the menu key, the chat's header), fading out below them, so the
|
|
page scrolls away under them instead of into them. It rides on the page as it slides aside
|
|
for the sidebar and stays as it is: the rounded frame over the slid page clips it. */
|
|
.status-bar-fade {
|
|
/* down to where a page's content starts (--page-top): solid to the middle of the corner
|
|
row, then a long, even fade over its lower half and on to the content */
|
|
height: var(--page-top);
|
|
background: linear-gradient(
|
|
to bottom,
|
|
var(--background) calc(var(--corner-control-top) + 1.25rem),
|
|
color-mix(in srgb, var(--background) 55%, transparent)
|
|
calc(var(--corner-control-top) + 2.5rem),
|
|
transparent 100%
|
|
);
|
|
}
|
|
|
|
/* iOS Safari colours the screen's top, above the page, from a solid fixed element at the
|
|
page's top edge (theme-color no longer), and shows the page through it otherwise. The
|
|
fade above is a gradient, which it does not take, so this strip under it carries the
|
|
page's colour there, as the installed app has. Safari finds it by hit-testing the top
|
|
edge, so it takes taps (pointer-events: none would hide it) and is thicker than the
|
|
10px Safari ignores; what it covers sits under the fade's solid part anyway */
|
|
.status-bar-edge {
|
|
height: 0.75rem;
|
|
background-color: var(--background);
|
|
}
|
|
|
|
/* The bottom edge's counterpart, which Safari takes for its bottom toolbar the same way:
|
|
without it, it finds the chat form there and takes the form's colour */
|
|
.screen-bottom-edge {
|
|
height: 0.75rem;
|
|
background-color: var(--background);
|
|
}
|
|
|
|
/* The same fade at the bottom of a phone's screen: solid behind the home indicator and
|
|
fading out above it, so the page ends softly at the screen's edge and under the chat
|
|
form instead of running out under it. It stays through the slide as the top one does */
|
|
.screen-bottom-fade {
|
|
height: calc(var(--safe-area-bottom) + 3rem);
|
|
background: linear-gradient(
|
|
to top,
|
|
var(--background) var(--safe-area-bottom),
|
|
color-mix(in srgb, var(--background) 60%, transparent) calc(var(--safe-area-bottom) + 1.5rem),
|
|
transparent 100%
|
|
);
|
|
}
|
|
|
|
/* The sidebar's "Show more" row, stuck to its bottom: an opaque copy of the
|
|
panel's translucent muted tint, and a fade above it, like the one under
|
|
the tab bar, so the rows scrolling beneath end softly */
|
|
.sidebar-show-more {
|
|
--sidebar-surface: color-mix(in oklab, var(--muted) 60%, var(--background));
|
|
background: var(--sidebar-surface);
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
inset-inline: 0;
|
|
bottom: 100%;
|
|
height: 1rem;
|
|
pointer-events: none;
|
|
background: linear-gradient(
|
|
to top,
|
|
var(--sidebar-surface) 0%,
|
|
color-mix(in srgb, var(--sidebar-surface) 60%, transparent) 50%,
|
|
transparent 100%
|
|
);
|
|
}
|
|
}
|
|
|
|
/* An opaque copy of the sidebar panel's translucent tint, under what moves
|
|
over the other sections while dragged */
|
|
.sidebar-drag-surface,
|
|
.sidebar-drag-overlay {
|
|
background: color-mix(in oklab, var(--muted) 60%, var(--background));
|
|
}
|
|
|
|
/* the copy of a chat row that follows the pointer, raised above the page */
|
|
.sidebar-drag-overlay {
|
|
box-shadow:
|
|
0 10px 30px -10px rgb(0 0 0 / 0.35),
|
|
0 0 0 1px color-mix(in srgb, var(--foreground) 12%, transparent);
|
|
}
|
|
|
|
/* While something is dragged, what it passes over takes no hover: only the
|
|
sections themselves stay targets, for the drop */
|
|
body[data-sidebar-dragging] [data-sidebar-section] * {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.sidebar-drag-overlay {
|
|
position: fixed;
|
|
z-index: 1000;
|
|
border-radius: 0.5rem;
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* the phone sidebar's contents zoom out and fade as the page slides back over them */
|
|
.sidebar-reveal-content {
|
|
opacity: var(--sidebar-reveal-ease);
|
|
scale: calc(0.98 + 0.02 * var(--sidebar-reveal-ease));
|
|
}
|
|
|
|
/* the slid page's fixed bars, held where they sit on screen, see useSidebarReveal */
|
|
.sidebar-reveal-pin-top {
|
|
translate: 0 var(--sidebar-reveal-pin-top, 0px);
|
|
}
|
|
|
|
.sidebar-reveal-pin-bottom {
|
|
translate: 0 calc(-1 * var(--sidebar-reveal-pin-bottom, 0px));
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.sidebar-reveal-content {
|
|
scale: none;
|
|
}
|
|
}
|
|
|
|
.shimmer-text {
|
|
background: linear-gradient(
|
|
90deg,
|
|
var(--muted-foreground),
|
|
var(--foreground),
|
|
var(--muted-foreground)
|
|
);
|
|
background-size: 200% 100%;
|
|
background-clip: text;
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
font-weight: 500;
|
|
animation: shimmer 1s linear infinite;
|
|
}
|
|
|
|
@keyframes shimmer {
|
|
to {
|
|
background-position: -200% 0;
|
|
}
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.shimmer-text {
|
|
animation: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
.mermaidTooltip {
|
|
display: none !important;
|
|
}
|
|
|
|
/*
|
|
* While the page sticks to its bottom, the pin after the messages is its only
|
|
* scroll anchor, so the browser keeps the bottom in place as content above it
|
|
* grows or realizes its size. Browsers without overflow-anchor (WebKit) never
|
|
* get the attribute, see createStickToBottom.
|
|
*/
|
|
[data-stick-to-bottom] * {
|
|
overflow-anchor: none;
|
|
}
|
|
|
|
[data-stick-to-bottom] *:has(.stick-to-bottom-pin),
|
|
[data-stick-to-bottom] .stick-to-bottom-pin {
|
|
overflow-anchor: auto;
|
|
}
|
|
|
|
.stick-to-bottom-pin {
|
|
height: 1px;
|
|
}
|