Commit 65758d01f for llama.cpp
commit 65758d01f5eee145e71e3e903d930574cb5d523e
Author: Aleksander Grygier <aleksander.grygier@gmail.com>
Date: Wed Nov 18 09:45:36 2026 +0100
ui: Storybook follow-ups: generated DESIGN.md tokens, shared helpers and one Llama Mono (#32523)
* ui: generate DESIGN.md's token sections from the CSS
Add scripts/design-md.js in ui/apps/chat (npm run design:tokens, and npm
run check:design in CI), which writes the colors, typography and rounded
sections of DESIGN.md's front matter from llama-brand's colors.css and
Llama UI's primitives, semantic tokens and font stacks. The front matter
had drifted: it gave Matte's surfaces as the light base and system-ui for
every text role. Twins are now written wherever a token resolves
differently in dark mode (-dark) or in Matte (-matte).
Describe the floating panel's rim as the CSS draws it, on the border,
and say which parts of DESIGN.md are generated and which are kept by hand.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: say the Storybooks show accessibility findings without enforcing them
Both Storybooks keep a11y test 'todo': under 'error' 98 of the stories
fail, most on colour contrast of the muted foreground and on nested
interactive controls, which need design changes. Reword the Uses tile
and record the reason next to the setting.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: list every Llama Chat group in the Introduction's Sections figure
The figure said it was in sidebar order but left out Forms, Actions,
Badges, Misc, Servers and PWA. Its list moves to sections.ts, and a unit
test checks it against storySort in .storybook/preview.ts, which has to
stay inline there because Storybook parses it as written.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: load the package's Llama Mono in both Storybooks
The library's Storybook declared Llama Mono a second time from
tests/stories/brand/fonts, a 72276-byte file that differs from the
76896-byte one the package ships, so its pages showed a Llama Mono that
does not ship. Drop both Storybooks' copies: theme.css already loads the
package's font.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: take Llama Chat's shared Storybook helpers from Llama UI
Llama Chat kept copies of the Editorial, Chapters, StateGallery,
StateGalleryItem, svx.d.ts and docs.css that live with the library's
stories. Its stories now import them as $llama-ui-stories/..., an alias
its Storybook config and tsconfig.json map onto ui/lib/ui/tests/stories,
the way it already compiles the library from source; docs.css and
svx.d.ts are referenced by path. The library's Editorial takes Llama
Chat's newer list numbering. An empty svelte.config.js next to the
stories keeps Llama Chat's svelte-check from loading the library's
vite.config.ts, as src/svelte.config.js does for the sources.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: pin the library's Storybook to Llama Chat's versions
ui/lib/ui used ^10.6.2 with @storybook/addon-mcp at 10.6.2, while
ui/apps/chat pins 10.6.6, so one tree had two Storybooks. Pin the
library's Storybook packages exactly to Llama Chat's: 10.6.6,
addon-svelte-csf 5.1.6 and @chromatic-com/storybook 5.5.1.
Assisted-by: Claude (Opus 5.5 Medium)
diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml
index 96fb51625..10d7ed0ed 100644
--- a/.github/workflows/ui.yml
+++ b/.github/workflows/ui.yml
@@ -93,6 +93,11 @@ jobs:
run: npm run lint
working-directory: ui/apps/chat
+ - name: Check DESIGN.md is current with the tokens
+ if: ${{ always() && steps.setup.conclusion == 'success' }}
+ run: npm run check:design
+ working-directory: ui/apps/chat
+
- name: Install Playwright browsers
id: playwright
if: ${{ always() && steps.setup.conclusion == 'success' }}
diff --git a/ui/apps/chat/.storybook/docs.css b/ui/apps/chat/.storybook/docs.css
deleted file mode 100644
index 4a2f1facc..000000000
--- a/ui/apps/chat/.storybook/docs.css
+++ /dev/null
@@ -1,91 +0,0 @@
-@reference '../src/app.css';
-
-/*
- * MDX pages that wrap their content in <Unstyled><div className="ds-docs"> drop
- * Storybook's docs theme and take colours, font and type roles from the design system.
- */
-.sbdocs-wrapper:has(.ds-docs) {
- background: var(--surface-page);
-}
-
-.ds-docs {
- @apply mx-auto max-w-3xl font-sans text-body text-fg-default;
-
- & :where(h1) {
- @apply mb-4 text-heading;
- }
-
- & :where(h2) {
- @apply mt-10 mb-3 border-b border-line-default pb-2 text-title;
- }
-
- & :where(h3) {
- @apply mt-6 mb-2 text-body font-semibold;
- }
-
- & :where(h4, h5, h6) {
- @apply mt-4 mb-2 text-label;
- }
-
- & :where(p, ul, ol, blockquote, table, pre) {
- @apply my-3;
- }
-
- & :where(ul) {
- @apply list-disc pl-6;
- }
-
- & :where(ol) {
- @apply list-decimal pl-6;
- }
-
- & :where(li) {
- @apply my-1;
- }
-
- & :where(strong) {
- @apply font-semibold;
- }
-
- & :where(a) {
- @apply underline underline-offset-2 hover:text-fg-muted;
- }
-
- & :where(blockquote) {
- @apply border-l-2 border-line-default pl-4 text-fg-muted;
- }
-
- /* a note that stands out from the running text: a quiet panel with the accent on its edge */
- & :where(.callout) {
- @apply my-6 rounded-panel border-l-2 border-(--art-cinder) bg-surface-muted px-5 py-4;
-
- & > :where(p) {
- @apply my-0;
- }
- }
-
- & :where(hr) {
- @apply my-8 border-line-default;
- }
-
- /* inline code only, with a selector that outranks the code the Markdown block renders */
- & :not(pre) > code {
- @apply rounded-control border-0 bg-surface-code px-1 py-0.5 font-mono text-[0.875em] text-(--fg-code);
- }
-
- & :where(pre) {
- @apply overflow-x-auto rounded-panel bg-surface-code p-4 text-body-sm;
- }
-
- & :where(table) {
- @apply w-full border-collapse text-body-sm;
- }
-
- & :where(th, td) {
- @apply border-b border-line-default px-3 py-2 text-left align-top;
- }
-
- & :where(th) {
- @apply text-label;
- }
-}
diff --git a/ui/apps/chat/.storybook/main.ts b/ui/apps/chat/.storybook/main.ts
index 076f24481..3e8c1a39d 100644
--- a/ui/apps/chat/.storybook/main.ts
+++ b/ui/apps/chat/.storybook/main.ts
@@ -6,6 +6,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
// Llama UI's stories live with the library (ui/lib/ui/tests/stories), which runs and tests them in its own
// Storybook; this one shows them too, under Llama UI, next to Llama Chat's own. The library's front page stays its own.
+// Llama Chat's stories take the helpers they share with the library's (the Editorial, the state gallery) from there
+// too, as $llama-ui-stories/..., which tsconfig.json maps for TypeScript
const LLAMA_UI_STORIES = resolve(__dirname, '../../../lib/ui/tests/stories');
const config: StorybookConfig = {
@@ -36,6 +38,15 @@ const config: StorybookConfig = {
];
// the library's stories import Storybook from where they live, where only this app's packages are installed
config.resolve = config.resolve || {};
+ config.resolve.alias = [
+ ...(Array.isArray(config.resolve.alias)
+ ? config.resolve.alias
+ : Object.entries(config.resolve.alias || {}).map(([find, replacement]) => ({
+ find,
+ replacement
+ }))),
+ { find: '$llama-ui-stories', replacement: LLAMA_UI_STORIES }
+ ];
config.resolve.dedupe = [
...(config.resolve.dedupe || []),
'@storybook/addon-svelte-csf',
diff --git a/ui/apps/chat/.storybook/preview.ts b/ui/apps/chat/.storybook/preview.ts
index 671aa2f95..7e7a58d16 100644
--- a/ui/apps/chat/.storybook/preview.ts
+++ b/ui/apps/chat/.storybook/preview.ts
@@ -2,7 +2,8 @@ import '../src/app.css';
import { MEDIA_QUERIES } from '#lib/constants/pwa.constants.ts';
import { SurfaceTheme } from '#lib/enums/ui.enums.ts';
import { applySurfaceTheme } from '#lib/utils/css.ts';
-import './docs.css';
+// the docs pages' styles, shared with the library's Storybook
+import '../../../lib/ui/.storybook/docs.css';
import { applyColorScheme } from './color-scheme';
import ModeWatcherDecorator from './decorators/ModeWatcherDecorator.svelte';
import TooltipProviderDecorator from './decorators/TooltipProviderDecorator.svelte';
@@ -76,9 +77,10 @@ const preview: Preview = {
},
a11y: {
- // 'todo' - show a11y violations in the test UI only
- // 'error' - fail CI on a11y violations
- // 'off' - skip a11y checks entirely
+ // 'todo' shows violations in the Accessibility panel and the test UI without failing a test; 'error' would
+ // fail CI on them. Not yet 'error': about half the stories fail it, most on colour contrast (the muted
+ // foreground on the light surfaces, below 4.5:1) and nested interactive controls, which need design changes
+ // rather than story fixes. Switch once those are settled
test: 'todo'
}
},
diff --git a/ui/apps/chat/AGENTS.md b/ui/apps/chat/AGENTS.md
index c4c0a0f3c..f585ec54f 100644
--- a/ui/apps/chat/AGENTS.md
+++ b/ui/apps/chat/AGENTS.md
@@ -2,8 +2,8 @@
These add to the repository's [AGENTS.md](../../../AGENTS.md) for work in `ui/apps/chat`: **Llama Chat**, the chat client that llama-server bundles. **Llama UI**, the library, is `ui/lib/ui` (`@ggml-org/llama-ui`): Chat imports its tokens, fonts and base components from there (`@ggml-org/llama-ui/ui/<name>`) and keeps no copy of them. `DESIGN.md` and the Storybook live here; the brand book, `BRAND.md`, and the brand and communications pages are in [ggml-org/llama-brand](https://github.com/ggml-org/llama-brand), with their own Storybook.
-- **Design:** [DESIGN.md](DESIGN.md) holds the tokens, roles and rules, written for agents. Follow it for anything visual; when it and the CSS disagree, the CSS wins and DESIGN.md is updated.
-- **Stories:** a story lives with the code it shows. Llama UI's (its foundations, base components, app components and Model UI) are in `ui/lib/ui/tests/stories`, titled `Llama UI/...`, and run as the library's tests; this app's Storybook shows them too. Llama Chat's are in `tests/stories/<area>`, one folder per `src/lib/components/app/<area>` (`chat/` has one per Chat folder), titled `Llama Chat/<Area>/<Component>`. An accessibility story sits next to its component's, as `<Component>.a11y.stories.svelte`, titled `.../<Component>/Accessibility`.
+- **Design:** [DESIGN.md](DESIGN.md) holds the tokens, roles and rules, written for agents. Follow it for anything visual. Its token sections (`colors`, `typography`, `rounded`) are generated from the CSS with `npm run design:tokens`, and CI checks they are current; the rest is written by hand, and when it and the CSS disagree, the CSS wins and DESIGN.md is updated.
+- **Stories:** a story lives with the code it shows. Llama UI's (its foundations, base components, app components and Model UI) are in `ui/lib/ui/tests/stories`, titled `Llama UI/...`, and run as the library's tests; this app's Storybook shows them too. Llama Chat's are in `tests/stories/<area>`, one folder per `src/lib/components/app/<area>` (`chat/` has one per Chat folder), titled `Llama Chat/<Area>/<Component>`. An accessibility story sits next to its component's, as `<Component>.a11y.stories.svelte`, titled `.../<Component>/Accessibility`. The story helpers both Storybooks use (the Editorial the prose pages are set in, `StateGallery`) live with the library's stories and are imported here as `$llama-ui-stories/...`; reuse them rather than copying them here.
- **Components:** the `SKILL.md` next to a component folder (such as [src/lib/components/app/SKILL.md](src/lib/components/app/SKILL.md)) holds that folder's conventions.
## Content is Markdown, custom pieces are Svelte: .svx
diff --git a/ui/apps/chat/DESIGN.md b/ui/apps/chat/DESIGN.md
index 708a656d5..971685e1b 100644
--- a/ui/apps/chat/DESIGN.md
+++ b/ui/apps/chat/DESIGN.md
@@ -5,10 +5,14 @@ description: >-
Llama UI, the design system and components of Llama Chat, the chat client llama-server
bundles. Neutral and quiet: frosted matte surfaces with faint
blue-grey hairlines, near-flat fills, and status colours for success, warning, error and info. Tokens come in
- three tiers: primitives, semantic tokens (with a "-dark" twin where dark mode differs)
- and components. Generated from ui/lib/ui/src/lib/styles/tokens/*.css.
+ three tiers: primitives, semantic tokens (with a "-dark" twin where dark mode differs and a
+ "-matte" twin where the Matte light theme does) and components. The colors, typography and
+ rounded sections are generated from ui/lib/ui/src/lib/styles by `npm run design:tokens` in
+ ui/apps/chat; spacing, components and the prose are kept in sync with the CSS by hand.
colors:
primary: '{colors.action-primary}'
+ brand-ink: '#111111'
+ brand-light: '#fafafa'
neutral-0: 'oklch(1 0 0)'
neutral-25: 'oklch(0.988 0 0)'
neutral-50: 'oklch(0.985 0 0)'
@@ -18,28 +22,30 @@ colors:
neutral-300: 'oklch(0.87 0 0)'
neutral-400: 'oklch(0.708 0 0)'
neutral-500: 'oklch(0.556 0 0)'
+ neutral-600: 'oklch(0.439 0 0)'
+ neutral-700: 'oklch(0.371 0 0)'
neutral-750: 'oklch(0.29 0 0)'
neutral-800: 'oklch(0.269 0 0)'
neutral-900: 'oklch(0.205 0 0)'
neutral-925: 'oklch(0.16 0 0)'
neutral-950: 'oklch(0.145 0 0)'
- cool-gray-50: 'oklch(0.958 0.002 250)'
- cool-gray-100: 'oklch(0.938 0.004 250)'
- cool-gray-200: 'oklch(0.91 0.005 250)'
- cool-gray-300: 'oklch(0.86 0.007 250)'
- cool-gray-400: 'oklch(0.81 0.01 250)'
- art-day-sky: 'oklch(0.78 0.075 245)'
- art-night-sky: 'oklch(0.33 0.07 256)'
- art-cinder: 'oklch(0.68 0.18 46)'
- art-cinder-light: 'oklch(0.85 0.065 46)'
sand-50: 'oklch(0.965 0.01 80)'
sand-100: 'oklch(0.936 0.015 81)'
sand-200: 'oklch(0.89 0.02 80)'
sand-400: 'oklch(0.72 0.025 76)'
sand-900: 'oklch(0.272 0.013 72)'
+ art-day-sky: 'oklch(0.78 0.075 245)'
+ art-night-sky: 'oklch(0.33 0.07 256)'
+ art-cinder: 'oklch(0.68 0.18 46)'
+ art-cinder-light: 'oklch(0.85 0.065 46)'
+ cool-gray-50: 'oklch(0.958 0.002 250)'
+ cool-gray-100: 'oklch(0.938 0.004 250)'
+ cool-gray-200: 'oklch(0.91 0.005 250)'
+ cool-gray-300: 'oklch(0.86 0.007 250)'
+ cool-gray-400: 'oklch(0.81 0.01 250)'
red-400: 'oklch(0.69 0.2 27)'
- red-500: 'oklch(0.6 0.235 27)'
red-450: 'oklch(0.635 0.229 28)'
+ red-500: 'oklch(0.6 0.235 27)'
red-550: 'oklch(0.588 0.236 28)'
red-600: 'oklch(0.55 0.22 27)'
red-800: 'oklch(0.43 0.17 27)'
@@ -69,19 +75,32 @@ colors:
white-a18: 'oklch(1 0 0 / 0.18)'
white-a20: 'oklch(1 0 0 / 0.2)'
white-a30: 'oklch(1 0 0 / 0.3)'
+ white-a40: 'oklch(1 0 0 / 0.4)'
white-a50: 'oklch(1 0 0 / 0.5)'
+ white-a85: 'oklch(1 0 0 / 0.85)'
+ black-a3: 'oklch(0 0 0 / 0.03)'
+ black-a4: 'oklch(0 0 0 / 0.04)'
+ black-a5: 'oklch(0 0 0 / 0.05)'
black-a6: 'oklch(0 0 0 / 0.06)'
+ black-a8: 'oklch(0 0 0 / 0.08)'
+ black-a10: 'oklch(0 0 0 / 0.1)'
+ black-a12: 'oklch(0 0 0 / 0.12)'
+ black-a18: 'oklch(0 0 0 / 0.18)'
+ black-a25: 'oklch(0 0 0 / 0.25)'
black-a30: 'oklch(0 0 0 / 0.3)'
+ black-a35: 'oklch(0 0 0 / 0.35)'
black-a40: 'oklch(0 0 0 / 0.4)'
- surface-page: '{colors.neutral-0}'
+ black-a55: 'oklch(0 0 0 / 0.55)'
+ black-a60: 'oklch(0 0 0 / 0.6)'
+ surface-page: '{colors.neutral-25}'
surface-muted: '{colors.neutral-100}'
surface-emphasis: '{colors.neutral-150}'
surface-selected: '{colors.neutral-150}'
surface-raised: '{colors.neutral-0}'
surface-lifted: '{colors.neutral-0}'
surface-pressed: '{colors.neutral-0}'
- surface-glass: 'oklch(0.97 0 0 / 0.6)'
- surface-code: '{colors.neutral-50}'
+ surface-glass: 'oklch(1 0 0 / 0.8)'
+ surface-code: '{colors.neutral-100}'
surface-overlay: '{colors.black-a40}'
fg-default: '{colors.neutral-950}'
fg-muted: '{colors.neutral-500}'
@@ -124,7 +143,7 @@ colors:
action-quiet: 'oklch(0.97 0 0 / 0.3)'
action-quiet-hover: '{colors.neutral-100}'
action-ghost-hover: 'oklch(0.556 0 0 / 0.1)'
- field-background: 'oklch(1 0 0)'
+ field-background: '{colors.neutral-0}'
field-shade: '{colors.black-a6}'
status-danger: '{colors.fill-danger}'
status-danger-rim: '{colors.red-400}'
@@ -142,6 +161,15 @@ colors:
highlight-inverse: '{colors.white-a12}'
sheen-start: '{colors.white-a20}'
sheen-end: 'transparent'
+ elevation-ring: '{colors.black-a5}'
+ surface-page-matte: '{colors.neutral-0}'
+ surface-glass-matte: 'oklch(0.97 0 0 / 0.6)'
+ surface-code-matte: '{colors.neutral-50}'
+ surface-success-matte: 'color-mix(in oklab, {colors.fill-success} 11%, {colors.surface-page-matte})'
+ surface-warning-matte: 'color-mix(in oklab, {colors.fill-warning} 11%, {colors.surface-page-matte})'
+ surface-danger-matte: 'color-mix(in oklab, {colors.fill-danger} 11%, {colors.surface-page-matte})'
+ surface-info-matte: 'color-mix(in oklab, {colors.fill-info} 11%, {colors.surface-page-matte})'
+ field-background-matte: '{colors.surface-page-matte}'
surface-page-dark: '{colors.neutral-925}'
surface-muted-dark: '{colors.neutral-800}'
surface-emphasis-dark: '{colors.neutral-750}'
@@ -193,46 +221,51 @@ colors:
action-ghost-hover-dark: 'oklch(0.708 0 0 / 0.1)'
field-background-dark: '{colors.white-a9}'
field-shade-dark: '{colors.black-a30}'
+ status-danger-dark: '{colors.fill-danger-dark}'
+ status-warning-dark: '{colors.fill-warning-dark}'
+ status-success-dark: '{colors.fill-success-dark}'
+ status-info-dark: '{colors.fill-info-dark}'
highlight-inner-dark: '{colors.white-a4}'
sheen-start-dark: '{colors.white-a2}'
+ elevation-ring-dark: '{colors.white-a18}'
typography:
- heading:
- fontFamily: system-ui
- fontSize: 1.5rem
- fontWeight: 600
- lineHeight: 2rem
- title:
- fontFamily: system-ui
- fontSize: 1.125rem
- fontWeight: 600
- lineHeight: 1.75rem
body:
- fontFamily: system-ui
+ fontFamily: 'Llama Sans'
fontSize: 1rem
fontWeight: 400
lineHeight: 1.5rem
body-sm:
- fontFamily: system-ui
+ fontFamily: 'Llama Sans'
fontSize: 0.875rem
fontWeight: 400
lineHeight: 1.25rem
label:
- fontFamily: system-ui
+ fontFamily: 'Llama Sans'
fontSize: 0.875rem
fontWeight: 500
lineHeight: 1.25rem
label-sm:
- fontFamily: system-ui
+ fontFamily: 'Llama Sans'
fontSize: 0.75rem
fontWeight: 500
lineHeight: 1rem
caption:
- fontFamily: system-ui
+ fontFamily: 'Llama Sans'
fontSize: 0.75rem
fontWeight: 400
lineHeight: 1rem
+ title:
+ fontFamily: 'Llama Sans'
+ fontSize: 1.125rem
+ fontWeight: 600
+ lineHeight: 1.75rem
+ heading:
+ fontFamily: 'Llama Sans'
+ fontSize: 1.5rem
+ fontWeight: 600
+ lineHeight: 2rem
code:
- fontFamily: Llama Mono
+ fontFamily: 'Llama Mono'
fontSize: 0.875rem
fontWeight: 400
lineHeight: 1.25rem
@@ -336,6 +369,10 @@ components:
backgroundColor: '{colors.edge-raised}'
floating-panel-edge-dark:
backgroundColor: '{colors.edge-raised-dark}'
+ floating-panel-rim:
+ backgroundColor: '{colors.highlight-inner}'
+ floating-panel-rim-dark:
+ backgroundColor: '{colors.highlight-inner-dark}'
dialog:
backgroundColor: '#ffffff'
textColor: '{colors.fg-default}'
@@ -778,12 +815,16 @@ Design tokens come in three tiers, each in its own file under `ui/lib/ui/src/lib
`button-secondary-background-hover`. They point at semantic tokens, and components read
them as `bg-(--button-primary-background)` and similar.
-The front matter of this file mirrors those three files. When they disagree, the CSS wins
-and this file should be updated to match. Storybook shows every tier under **Llama UI ›
-Foundations › Colors**.
+The front matter's `colors`, `typography` and `rounded` are generated from the primitives, the
+semantic tokens and the font stacks by `npm run design:tokens` in `ui/apps/chat`, and CI fails
+when they are out of date (`npm run check:design`): change the CSS and run it, never edit them
+here. The `spacing` and `components` sections and the prose are written by hand; when they
+disagree with the CSS, the CSS wins and this file is updated to match. Storybook shows every
+tier under **Llama UI › Foundations › Colors**.
-Light mode is the base. A semantic token whose dark value differs has a `-dark` twin here,
-and components list a `-dark` entry wherever their colours change. Translucent component
+Paper light mode is the base. A semantic token that resolves differently in dark mode has a
+`-dark` twin here, and one that resolves differently in Matte a `-matte` twin; components list
+a `-dark` entry wherever their colours change. Translucent component
fills are given as they render over the page, so contrast checks see the real colour.
## Colors
@@ -935,10 +976,12 @@ matches the role of the surface instead of combining raw shadows.
`inset-group-surface` point those slots at one component's tokens, so each component needs
a single class.
- **`matte-float`** and **`matte-float-modal`:** menus, popovers, select lists, hover cards
- and drawers, and dialogs over the page colour. An 86% opaque panel with blur, a faint edge
- and a deeper shadow. The edge is a hairline ring baked into the shadow as its last layer,
- never a border next to a shadow, which would read as a double edge; the panel's border stays transparent so its size does not change. In light mode dialogs are solid white instead: over the dimmed page a
- translucent white turns grey.
+ and drawers, and dialogs over the page colour. An 86% opaque panel with blur, a faint edge,
+ a rim and a deeper shadow. The edge is a hairline ring baked into the shadow as its last
+ layer (`float-panel-edge`). The panel's 1px border is its rim, the inner highlight
+ (`float-panel-highlight`) right inside the ring; an inset shadow for the rim would sit inside
+ the border instead, and the 1px between the two would draw a double edge. In light mode
+ dialogs are solid white instead: over the dimmed page a translucent white turns grey.
- **`matte-key`:** buttons, selects, toggles and tabs. The matte finish: on top of the
button's own fill it adds a light blur, a fill barely lighter at the top (`--key-sheen`, 12% white in light mode, 2% in dark)
and a small drop shadow. It never changes the button colour and draws no rim of its own: every
diff --git a/ui/apps/chat/package.json b/ui/apps/chat/package.json
index ae3455084..1120f6f87 100644
--- a/ui/apps/chat/package.json
+++ b/ui/apps/chat/package.json
@@ -11,6 +11,8 @@
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
+ "check:design": "node scripts/design-md.js --check",
+ "design:tokens": "node scripts/design-md.js",
"reset": "rm -rf .svelte-kit node_modules",
"format": "eslint --fix . && prettier --write .",
"format:files": "sh -c 'eslint --fix \"$@\" && prettier --write \"$@\"' sh",
diff --git a/ui/apps/chat/scripts/design-md.js b/ui/apps/chat/scripts/design-md.js
new file mode 100644
index 000000000..316bf9acd
--- /dev/null
+++ b/ui/apps/chat/scripts/design-md.js
@@ -0,0 +1,301 @@
+#!/usr/bin/env node
+
+/**
+ * Writes the token sections of DESIGN.md's front matter (`colors`, `typography` and `rounded`) from the CSS they
+ * mirror, so the file agents read cannot drift from the code:
+ *
+ * - the brand's colours, @ggml-org/llama-brand's css/colors.css,
+ * - Llama UI's primitives and semantic tokens, ui/lib/ui/src/lib/styles/tokens/{primitives,semantic}.css,
+ * - Llama UI's font stacks, ui/lib/ui/src/lib/styles/theme.css.
+ *
+ * Everything else in DESIGN.md, the `spacing` and `components` sections and the prose, is written by hand.
+ *
+ * Usage: node scripts/design-md.js [--check]
+ *
+ * --check writes nothing and exits with 1 if DESIGN.md is not current, for CI (`npm run check:design`).
+ */
+
+import { readFileSync, writeFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+
+const app = new URL('../', import.meta.url);
+const styles = new URL('../../../lib/ui/src/lib/styles/', import.meta.url);
+const DESIGN_MD = fileURLToPath(new URL('DESIGN.md', app));
+const SOURCES = {
+ brand: fileURLToPath(new URL('node_modules/@ggml-org/llama-brand/css/colors.css', app)),
+ primitives: fileURLToPath(new URL('tokens/primitives.css', styles)),
+ semantic: fileURLToPath(new URL('tokens/semantic.css', styles)),
+ theme: fileURLToPath(new URL('theme.css', styles))
+};
+// the selectors of the themes a semantic token may change in, and the suffix its twin takes here
+const THEMES = [
+ { selector: '.theme-matte:not(.dark)', suffix: '-matte' },
+ { selector: '.dark', suffix: '-dark' }
+];
+// the type roles, by the @theme names Tailwind turns into text-body, text-label-sm, ...: a size with a line height
+const TYPE_ROLE = /^--text-([a-z]+(?:-[a-z]+)*)$/;
+// code takes the body-sm role in the mono stack (see `:where(code, pre, kbd, samp)` in theme.css)
+const CODE_ROLE = 'body-sm';
+// Tailwind's own `rounded-full`, for lamps, avatars and round buttons; the other corners are roles in semantic.css
+const ROUNDED_FULL = '9999px';
+// the sections this script owns, in the order they appear in the front matter; the next one is written by hand
+const SECTIONS = ['colors', 'typography', 'rounded'];
+const NEXT_SECTION = 'spacing';
+
+/** @param {string} css @returns {string} */
+function stripComments(css) {
+ return css.replace(/\/\*[\s\S]*?\*\//g, '');
+}
+
+/**
+ * The custom properties declared in each top-level block, by the block's selector (or at-rule).
+ * @param {string} css
+ * @returns {Map<string, Map<string, string>>}
+ */
+function parseBlocks(css) {
+ /** @type {Map<string, Map<string, string>>} */
+ const blocks = new Map();
+ const source = stripComments(css);
+
+ let depth = 0;
+ let start = 0;
+ let selector = '';
+
+ for (let i = 0; i < source.length; i++) {
+ const char = source[i];
+
+ if (char === '{') {
+ if (depth === 0) {
+ selector = source.slice(start, i).trim().split(';').pop()?.trim() ?? '';
+ start = i + 1;
+ }
+
+ depth++;
+ } else if (char === '}') {
+ depth--;
+
+ if (depth === 0) {
+ const declarations = blocks.get(selector) ?? new Map();
+
+ for (const [, name, value] of source
+ .slice(start, i)
+ .matchAll(/(--[\w-]+)\s*:\s*([^;]+);/g)) {
+ declarations.set(name, value.replace(/\s+/g, ' ').trim());
+ }
+
+ blocks.set(selector, declarations);
+ start = i + 1;
+ }
+ }
+ }
+
+ return blocks;
+}
+
+/** @param {string} path @returns {Map<string, Map<string, string>>} */
+function readBlocks(path) {
+ return parseBlocks(readFileSync(path, 'utf8'));
+}
+
+/** @param {string} value */
+const isColorLiteral = (value) =>
+ /^#[0-9a-f]{3,8}$/i.test(value) ||
+ value === 'transparent' ||
+ /^(oklch|oklab|rgb|hsl)\([^()]*\)$/.test(value);
+/** @param {string} value */
+const isColorMix = (value) => /^color-mix\(.*\)$/.test(value) && !/\)\s*,/.test(value);
+/** @param {string} value */
+const varName = (value) => /^var\(--([\w-]+)\)$/.exec(value)?.[1];
+
+function build() {
+ const brand = readBlocks(SOURCES.brand).get(':root') ?? new Map();
+ const primitiveBlocks = readBlocks(SOURCES.primitives);
+ const primitives = new Map([...brand, ...(primitiveBlocks.get(':root') ?? [])]);
+ const semanticBlocks = readBlocks(SOURCES.semantic);
+ const semantic = semanticBlocks.get(':root') ?? new Map();
+ const inline = semanticBlocks.get('@theme inline') ?? new Map();
+ const theme = readBlocks(SOURCES.theme);
+ /** @type {Map<string, string>} name (no dashes) to literal colour */
+ const primitiveColors = new Map();
+
+ for (const [name, value] of primitives) {
+ if (isColorLiteral(value)) primitiveColors.set(name.slice(2), value);
+ }
+
+ /** @param {string} value @param {Map<string, string>} scope */
+ const isColor = (value, scope) => {
+ if (isColorLiteral(value) || isColorMix(value)) return true;
+
+ const ref = varName(value);
+
+ if (!ref) return false;
+
+ if (primitiveColors.has(ref)) return true;
+
+ const next = scope.get(`--${ref}`);
+
+ return next !== undefined && isColor(next, scope);
+ };
+ const semanticColors = [...semantic].filter(([, value]) => isColor(value, semantic));
+ const semanticNames = new Set(semanticColors.map(([name]) => name.slice(2)));
+ /**
+ * A token's value as the front matter writes it: a reference to another token, a literal, or a mix of them. A
+ * primitive faded with transparent (`color-mix(in oklch, var(--neutral-100) 30%, transparent)`) is written as the
+ * colour it is, with its alpha (`oklch(0.97 0 0 / 0.3)`).
+ * @param {string} value
+ * @param {(name: string) => string} ref the front matter name a token reference points at
+ */
+ const render = (value, ref) => {
+ const faded = /^color-mix\(in oklch, var\(--([\w-]+)\) (\d+(?:\.\d+)?)%, transparent\)$/.exec(
+ value
+ );
+ const base = faded && primitiveColors.get(faded[1]);
+
+ if (faded && base && /^oklch\([^/]*\)$/.test(base)) {
+ return `${base.slice(0, -1)} / ${Number(faded[2]) / 100})`;
+ }
+
+ return value.replace(/var\(--([\w-]+)\)/g, (_, name) => `{colors.${ref(name)}}`);
+ };
+ /** @type {[string, string][]} */
+ const colors = [['primary', '{colors.action-primary}']];
+
+ for (const [name, value] of primitiveColors) colors.push([name, value]);
+
+ /** @type {Map<string, string>} */
+ const base = new Map();
+
+ for (const [name, value] of semanticColors) {
+ const rendered = render(value, (n) => n);
+
+ base.set(name, rendered);
+ colors.push([name.slice(2), rendered]);
+ }
+
+ // a twin per theme wherever the token resolves differently there, directly or through a token it points at
+ for (const { selector, suffix } of THEMES) {
+ const overrides = semanticBlocks.get(selector) ?? new Map();
+ /** @type {Set<string>} */
+ const twins = new Set();
+ /** @type {Map<string, string>} */
+ const rendered = new Map();
+ // twins resolve in dependency order: a reference to a token that has a twin points at the twin
+ /** @param {string} name */
+ const resolve = (name) => {
+ if (rendered.has(name)) return /** @type {string} */ (rendered.get(name));
+
+ const value = overrides.get(name) ?? semantic.get(name) ?? '';
+
+ for (const [, ref] of value.matchAll(/var\(--([\w-]+)\)/g)) {
+ if (semanticNames.has(ref)) resolve(`--${ref}`);
+ }
+
+ const result = render(value, (n) => (twins.has(n) ? `${n}${suffix}` : n));
+
+ rendered.set(name, result);
+
+ if (result !== base.get(name)) twins.add(name.slice(2));
+
+ return result;
+ };
+
+ for (const [name] of semanticColors) resolve(name);
+
+ for (const [name] of semanticColors) {
+ if (twins.has(name.slice(2)))
+ colors.push([`${name.slice(2)}${suffix}`, rendered.get(name) ?? '']);
+ }
+ }
+
+ const firstFamily = (/** @type {string | undefined} */ stack) =>
+ stack?.split(',')[0].trim().replace(/^'|'$/g, '') ?? 'system-ui';
+ const sans = firstFamily(theme.get('@theme inline')?.get('--font-sans'));
+ const mono = firstFamily(theme.get(':root')?.get('--font-mono'));
+ /** @param {string | undefined} value */
+ const length = (value) => {
+ const name = value && varName(value);
+
+ return (name && primitives.get(`--${name}`)) ?? value ?? '';
+ };
+ /** @type {[string, Record<string, string>][]} */
+ const typography = [];
+
+ for (const [name, value] of inline) {
+ const role = TYPE_ROLE.exec(name)?.[1];
+
+ if (!role || !inline.has(`${name}--line-height`)) continue;
+
+ typography.push([
+ role,
+ {
+ fontFamily: sans,
+ fontSize: length(value),
+ fontWeight: length(inline.get(`${name}--font-weight`)),
+ lineHeight: length(inline.get(`${name}--line-height`))
+ }
+ ]);
+ }
+
+ const code = typography.find(([role]) => role === CODE_ROLE);
+
+ if (code) typography.push(['code', { ...code[1], fontFamily: mono }]);
+
+ /** @type {[string, string][]} */
+ const rounded = [];
+
+ for (const [name, value] of inline) {
+ const role = /^--radius-([a-z-]+)$/.exec(name)?.[1];
+
+ if (role) rounded.push([role, length(value)]);
+ }
+
+ rounded.push(['full', ROUNDED_FULL]);
+
+ /** @param {string} value */
+ const quote = (value) => (/^[\w.-]+$/.test(value) ? value : `'${value.replace(/'/g, "''")}'`);
+ const lines = ['colors:'];
+
+ for (const [name, value] of colors) lines.push(` ${name}: '${value.replace(/'/g, "''")}'`);
+
+ lines.push('typography:');
+
+ for (const [role, style] of typography) {
+ lines.push(` ${role}:`);
+
+ for (const [key, value] of Object.entries(style)) lines.push(` ${key}: ${quote(value)}`);
+ }
+
+ lines.push('rounded:');
+
+ for (const [role, value] of rounded) lines.push(` ${role}: ${value}`);
+
+ return lines.join('\n') + '\n';
+}
+
+const check = process.argv.includes('--check');
+const current = readFileSync(DESIGN_MD, 'utf8');
+const start = current.indexOf(`\n${SECTIONS[0]}:\n`) + 1;
+const end = current.indexOf(`\n${NEXT_SECTION}:\n`) + 1;
+
+if (!current.startsWith('---\n') || start <= 0 || end <= start) {
+ console.error(`DESIGN.md: no front matter with ${SECTIONS[0]}: ... ${NEXT_SECTION}: in it`);
+ process.exit(1);
+}
+
+const next = current.slice(0, start) + build() + current.slice(end);
+
+if (check) {
+ if (next !== current) {
+ console.error(
+ 'DESIGN.md is out of date with the tokens: run `npm run design:tokens` in ui/apps/chat and commit it.'
+ );
+ process.exit(1);
+ }
+
+ console.log('DESIGN.md is current.');
+} else if (next !== current) {
+ writeFileSync(DESIGN_MD, next);
+ console.log('DESIGN.md updated.');
+} else {
+ console.log('DESIGN.md is already current.');
+}
diff --git a/ui/apps/chat/tests/stories/actions/ActionIconCopyToClipboard.stories.svelte b/ui/apps/chat/tests/stories/actions/ActionIconCopyToClipboard.stories.svelte
index b3fecbd7c..93671ad61 100644
--- a/ui/apps/chat/tests/stories/actions/ActionIconCopyToClipboard.stories.svelte
+++ b/ui/apps/chat/tests/stories/actions/ActionIconCopyToClipboard.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { ActionIconCopyToClipboard } from '#lib/components/app/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// Llama UI's ActionIcon that copies a text, under messages, code blocks and commands
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/badges/InfoBadges.stories.svelte b/ui/apps/chat/tests/stories/badges/InfoBadges.stories.svelte
index 27e604312..43d380913 100644
--- a/ui/apps/chat/tests/stories/badges/InfoBadges.stories.svelte
+++ b/ui/apps/chat/tests/stories/badges/InfoBadges.stories.svelte
@@ -1,10 +1,10 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { Clock, Gauge } from '@lucide/svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { BadgeInfo, BadgesModality } from '#lib/components/app/index.ts';
import { ModelModality } from '#lib/enums/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// the clickable info badges for message statistics and models, and the modality icons
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/brand/fonts/LlamaMono.woff2 b/ui/apps/chat/tests/stories/brand/fonts/LlamaMono.woff2
deleted file mode 100644
index c8cd45657..000000000
Binary files a/ui/apps/chat/tests/stories/brand/fonts/LlamaMono.woff2 and /dev/null differ
diff --git a/ui/apps/chat/tests/stories/brand/fonts/fonts.css b/ui/apps/chat/tests/stories/brand/fonts/fonts.css
deleted file mode 100644
index 8d9409b2f..000000000
--- a/ui/apps/chat/tests/stories/brand/fonts/fonts.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Llama Mono for the brand showcases (logo and type); Llama Sans is the design system's own (src/app.css) */
-@font-face {
- font-family: 'Llama Mono';
- src: url('./LlamaMono.woff2') format('woff2');
- font-weight: 400 700;
- font-style: normal;
- font-display: block;
-}
diff --git a/ui/apps/chat/tests/stories/brand/logo-showcase/ShowcaseFrame.svelte b/ui/apps/chat/tests/stories/brand/logo-showcase/ShowcaseFrame.svelte
index 05899dc7f..19727f425 100644
--- a/ui/apps/chat/tests/stories/brand/logo-showcase/ShowcaseFrame.svelte
+++ b/ui/apps/chat/tests/stories/brand/logo-showcase/ShowcaseFrame.svelte
@@ -5,7 +5,6 @@
-->
<script lang="ts">
import './lib/styles/logo.css';
- import '../fonts/fonts.css';
import type { Snippet } from 'svelte';
let { children }: { children: Snippet } = $props();
diff --git a/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsList.stories.svelte b/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsList.stories.svelte
index a145cef3a..c32d4a072 100644
--- a/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsList.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsList.stories.svelte
@@ -1,6 +1,4 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import {
audioAttachment,
gradientAttachment,
@@ -28,6 +26,8 @@
} from '../screen/fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatAttachmentsList from '#lib/components/app/chat/ChatAttachments/ChatAttachmentsList/ChatAttachmentsList.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatAttachmentsList,
diff --git a/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsListItemMcpResource.stories.svelte b/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsListItemMcpResource.stories.svelte
index 5553ee002..08c8db74f 100644
--- a/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsListItemMcpResource.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/attachments/ChatAttachmentsListItemMcpResource.stories.svelte
@@ -1,6 +1,4 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import {
mcpResourceAttachment,
mcpResourceImageAttachment,
@@ -8,6 +6,8 @@
} from '../screen/fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatAttachmentsListItemMcpResource from '#lib/components/app/chat/ChatAttachments/ChatAttachmentsList/ChatAttachmentsListItem/ChatAttachmentsListItemMcpResource.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatAttachmentsListItemMcpResource,
diff --git a/ui/apps/chat/tests/stories/chat/form/ChatFormActionRecord.stories.svelte b/ui/apps/chat/tests/stories/chat/form/ChatFormActionRecord.stories.svelte
index 4ddd18fc4..476e9397c 100644
--- a/ui/apps/chat/tests/stories/chat/form/ChatFormActionRecord.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/form/ChatFormActionRecord.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatFormActionRecord from '#lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionRecord.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatFormActionRecord,
diff --git a/ui/apps/chat/tests/stories/chat/form/ChatFormActionSubmit.stories.svelte b/ui/apps/chat/tests/stories/chat/form/ChatFormActionSubmit.stories.svelte
index caf929080..196bc2f86 100644
--- a/ui/apps/chat/tests/stories/chat/form/ChatFormActionSubmit.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/form/ChatFormActionSubmit.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatFormActionSubmit from '#lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionSubmit.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatFormActionSubmit,
diff --git a/ui/apps/chat/tests/stories/chat/form/ChatFormInput.stories.svelte b/ui/apps/chat/tests/stories/chat/form/ChatFormInput.stories.svelte
index 5c41912fe..e74c23086 100644
--- a/ui/apps/chat/tests/stories/chat/form/ChatFormInput.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/form/ChatFormInput.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { SERVER_HOME } from './fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatFormInput from '#lib/components/app/chat/ChatForm/ChatFormInput/ChatFormInput.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatFormInput,
diff --git a/ui/apps/chat/tests/stories/chat/form/ChatFormPickerCommand.stories.svelte b/ui/apps/chat/tests/stories/chat/form/ChatFormPickerCommand.stories.svelte
index 1c3b4825d..eecff5c37 100644
--- a/ui/apps/chat/tests/stories/chat/form/ChatFormPickerCommand.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/form/ChatFormPickerCommand.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { chatCommands } from './fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatFormPickerCommand from '#lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormPickerCommand.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
import { fn } from 'storybook/test';
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionCard.stories.svelte b/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionCard.stories.svelte
index a834943e1..c56efb31f 100644
--- a/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionCard.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionCard.stories.svelte
@@ -1,10 +1,10 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatMessageActionCardContinueRequest from '#lib/components/app/chat/ChatMessages/ChatMessageActions/ChatMessageActionCard/ChatMessageActionCardContinueRequest.svelte';
import ChatMessageActionCardPermissionRequest from '#lib/components/app/chat/ChatMessages/ChatMessageActions/ChatMessageActionCard/ChatMessageActionCardPermissionRequest.svelte';
import { BuiltInTool } from '#lib/enums/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatMessageActionCardPermissionRequest,
diff --git a/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionIcons.stories.svelte b/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionIcons.stories.svelte
index 958dcad91..60c2f45a0 100644
--- a/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionIcons.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/messages/ChatMessageActionIcons.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import ActionIconsStoryHost from './ActionIconsStoryHost.svelte';
import { siblingInfo } from './fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
args: {
diff --git a/ui/apps/chat/tests/stories/chat/messages/ChatMessageReasoningBlock.stories.svelte b/ui/apps/chat/tests/stories/chat/messages/ChatMessageReasoningBlock.stories.svelte
index de7b1ec14..1c3ee6c2e 100644
--- a/ui/apps/chat/tests/stories/chat/messages/ChatMessageReasoningBlock.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/messages/ChatMessageReasoningBlock.stories.svelte
@@ -1,6 +1,4 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import {
reasoningInterruptedSection,
reasoningPendingSection,
@@ -9,6 +7,8 @@
} from './fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatMessageReasoningBlock from '#lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatMessageReasoningBlock,
diff --git a/ui/apps/chat/tests/stories/chat/messages/ChatMessageStatistics.stories.svelte b/ui/apps/chat/tests/stories/chat/messages/ChatMessageStatistics.stories.svelte
index b511a3138..cf5acfc04 100644
--- a/ui/apps/chat/tests/stories/chat/messages/ChatMessageStatistics.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/messages/ChatMessageStatistics.stories.svelte
@@ -1,10 +1,10 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { agenticTimings } from './fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatMessageStatistics from '#lib/components/app/chat/ChatMessages/ChatMessageStatistics/ChatMessageStatistics.svelte';
import { ChatMessageStatisticsMode, ChatMessageStatsView } from '#lib/enums/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatMessageStatistics,
diff --git a/ui/apps/chat/tests/stories/chat/messages/ChatMessageToolCallBlock.stories.svelte b/ui/apps/chat/tests/stories/chat/messages/ChatMessageToolCallBlock.stories.svelte
index ed1030895..0d0accc04 100644
--- a/ui/apps/chat/tests/stories/chat/messages/ChatMessageToolCallBlock.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/messages/ChatMessageToolCallBlock.stories.svelte
@@ -1,6 +1,4 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import {
defaultToolMarkdownSection,
defaultToolPendingSection,
@@ -27,6 +25,8 @@
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatMessageToolCallBlock from '#lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlock.svelte';
import { AgenticSectionType } from '#lib/enums/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatMessageToolCallBlock,
diff --git a/ui/apps/chat/tests/stories/chat/messages/ChatMessageUserPending.stories.svelte b/ui/apps/chat/tests/stories/chat/messages/ChatMessageUserPending.stories.svelte
index cdb32f16d..bea6cec5a 100644
--- a/ui/apps/chat/tests/stories/chat/messages/ChatMessageUserPending.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/messages/ChatMessageUserPending.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { userAttachments } from './fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatMessageUserPending from '#lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageUser/ChatMessageUserPending.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatMessageUserPending,
diff --git a/ui/apps/chat/tests/stories/chat/tabs/ChatTabsItem.stories.svelte b/ui/apps/chat/tests/stories/chat/tabs/ChatTabsItem.stories.svelte
index 969a18d41..c51ee56c3 100644
--- a/ui/apps/chat/tests/stories/chat/tabs/ChatTabsItem.stories.svelte
+++ b/ui/apps/chat/tests/stories/chat/tabs/ChatTabsItem.stories.svelte
@@ -1,10 +1,10 @@
<script lang="ts" module>
- import StateGallery from '../../helpers/StateGallery.svelte';
- import StateGalleryItem from '../../helpers/StateGalleryItem.svelte';
import { SquarePen } from '@lucide/svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ChatTabsItem from '#lib/components/app/chat/ChatTabs/ChatTabsItem.svelte';
import { NEW_CHAT_LABEL, NEW_CHAT_TAB_ID } from '#lib/constants/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: ChatTabsItem,
diff --git a/ui/apps/chat/tests/stories/editorial/Chapters.svelte b/ui/apps/chat/tests/stories/editorial/Chapters.svelte
deleted file mode 100644
index 439b5597d..000000000
--- a/ui/apps/chat/tests/stories/editorial/Chapters.svelte
+++ /dev/null
@@ -1,153 +0,0 @@
-<!--
- The chapter navigation: the page's section heads as a list fixed at the right, centred. Every chapter is set at one size;
- inactive ones are dimmed, and the one being read is in the full foreground colour. Clicking a chapter scrolls to
- it. Shown only where there is room beside the text.
--->
-<script lang="ts">
- let { root }: { root: HTMLElement | undefined } = $props();
-
- let chapters: { el: HTMLElement; id: string; n: string; title: string }[] = $state([]);
- let active = $state(0);
-
- // runs once the page it navigates is mounted
- $effect(() => {
- if (!root) return;
-
- const list = [...root.querySelectorAll<HTMLElement>(':scope > h2')].map((el, i) => {
- const n = String(i + 1).padStart(2, '0');
-
- el.id ||= `chapter-${n}`;
-
- return { el, id: el.id, n, title: el.textContent?.trim() ?? '' };
- });
-
- chapters = list;
-
- // the active chapter is the last one whose head has passed 40% of the way down the screen
- let frame = 0;
-
- const update = () => {
- frame = 0;
- const line = window.innerHeight * 0.4;
- const index = list.findLastIndex(({ el }) => el.getBoundingClientRect().top <= line);
-
- active = Math.max(0, index);
- };
- const onScroll = () => (frame ||= requestAnimationFrame(update));
-
- update();
- window.addEventListener('scroll', onScroll, { passive: true });
- window.addEventListener('resize', onScroll);
-
- return () => {
- cancelAnimationFrame(frame);
- window.removeEventListener('scroll', onScroll);
- window.removeEventListener('resize', onScroll);
- };
- });
-
- function go(event: MouseEvent, el: HTMLElement) {
- event.preventDefault();
- const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
-
- window.scrollTo({
- behavior: reduce ? 'auto' : 'smooth',
- top: el.getBoundingClientRect().top + window.scrollY - 32
- });
- }
-</script>
-
-{#if chapters.length}
- <nav aria-label="Chapters" class="chapters">
- <ol>
- {#each chapters as chapter, i (chapter.id)}
- <li>
- <a
- aria-current={i === active ? 'location' : undefined}
- class={{ active: i === active }}
- href="#{chapter.id}"
- onclick={(event) => go(event, chapter.el)}
- >
- <span class="n">{chapter.n}</span>
-
- <span class="title">{chapter.title}</span>
- </a>
- </li>
- {/each}
- </ol>
- </nav>
-{/if}
-
-<style>
- .chapters {
- --mono: 'Llama Mono', ui-monospace, monospace;
- position: fixed;
- top: 50%;
- right: clamp(16px, 2.5vw, 40px);
- z-index: 10;
- display: none;
- width: 13rem;
- transform: translateY(-50%);
- }
-
- /* only where the column leaves room for it */
- @media (width >= 1440px) {
- .chapters {
- display: block;
- }
- }
-
- ol {
- display: grid;
- gap: 2px;
- margin: 0;
- padding: 0;
- list-style: none;
- }
-
- a {
- display: grid;
- grid-template-columns: 1.75rem 1fr;
- align-items: baseline;
- padding-block: 4px;
- color: var(--fg-muted);
- font-size: 14px;
- line-height: 1.3;
- text-decoration: none;
- opacity: 0.6;
- transition:
- color 200ms ease-out,
- opacity 200ms ease-out;
- }
-
- a:hover {
- opacity: 1;
- }
-
- a.active {
- color: var(--fg-default);
- font-weight: 500;
- opacity: 1;
- }
-
- .n {
- font: 500 10px var(--mono);
- letter-spacing: 0.04em;
- }
-
- a.active .n {
- color: var(--art-cinder);
- }
-
- a:focus-visible {
- border-radius: 4px;
- outline: 2px solid var(--line-focus);
- outline-offset: 2px;
- }
-
- @media (prefers-reduced-motion: reduce) {
- a {
- transition: none;
- }
- }
-</style>
diff --git a/ui/apps/chat/tests/stories/editorial/Editorial.svelte b/ui/apps/chat/tests/stories/editorial/Editorial.svelte
deleted file mode 100644
index cdc71ad11..000000000
--- a/ui/apps/chat/tests/stories/editorial/Editorial.svelte
+++ /dev/null
@@ -1,205 +0,0 @@
-<!--
- The page the Storybook's prose pages are set on: an editorial column of running text at a reading size, with figures that
- break out wider and pull quotes in Display. Numbered section heads, the numbers in cinder (the mark on a detail),
- and the chapter navigation fixed at the right.
--->
-<script lang="ts">
- import '../brand/fonts/fonts.css';
- import Chapters from './Chapters.svelte';
- import type { Snippet } from 'svelte';
-
- let { children }: { children: Snippet } = $props();
-
- let article: HTMLElement | undefined = $state();
-</script>
-
-<article bind:this={article} class="editorial">{@render children()}</article>
-
-<Chapters root={article} />
-
-<style>
- .editorial {
- --mono: 'Llama Mono', ui-monospace, 'SF Mono', Menlo, monospace;
- --text: min(40rem, calc(100% - 32px));
- display: grid;
- grid-template-columns:
- [full-start] minmax(16px, 1fr) [wide-start] minmax(0, 9rem) [text-start] var(--text)
- [text-end] minmax(0, 9rem) [wide-end] minmax(16px, 1fr) [full-end];
- counter-reset: section;
- min-height: 100vh;
- padding: clamp(40px, 8vw, 112px) 0 clamp(64px, 10vw, 160px);
- background: var(--surface-page);
- color: var(--fg-default);
- font: 400 18px / 1.6 var(--font-sans);
- text-wrap: pretty;
- }
-
- .editorial > :global(*) {
- grid-column: text;
- margin: 0;
- min-width: 0;
- }
-
- .editorial > :global(* + *) {
- margin-top: 1.1em;
- }
-
- .editorial > :global(.wide) {
- grid-column: wide;
- }
-
- /* the masthead: a kicker, the title in Display, the lead and a rule under it */
- .editorial > :global(.kicker) {
- color: var(--fg-muted);
- font: 500 12px / 1.4 var(--mono);
- letter-spacing: 0.08em;
- text-transform: uppercase;
- }
-
- .editorial > :global(h1) {
- grid-column: wide;
- margin-top: 20px;
- font-size: clamp(48px, 9vw, 112px);
- font-weight: 700;
- letter-spacing: -0.01em;
- line-height: 1;
- }
-
- .editorial > :global(.lead) {
- margin-top: 32px;
- color: var(--fg-muted);
- font-size: clamp(20px, 2.4vw, 24px);
- line-height: 1.45;
- text-wrap: balance;
- }
-
- .editorial > :global(.lead strong) {
- color: var(--fg-default);
- font-weight: 500;
- }
-
- /* each section opens on a hairline, its number above the heading */
- .editorial > :global(h2) {
- counter-increment: section;
- margin-top: clamp(72px, 10vw, 120px);
- padding-top: 20px;
- border-top: 1px solid var(--line-default);
- font-size: clamp(28px, 3.6vw, 40px);
- font-weight: 600;
- letter-spacing: -0.005em;
- line-height: 1.15;
- text-wrap: balance;
- }
-
- .editorial > :global(h2)::before {
- content: counter(section, decimal-leading-zero);
- display: block;
- margin-bottom: 16px;
- color: var(--art-cinder);
- font: 500 13px / 1 var(--mono);
- letter-spacing: 0.04em;
- }
-
- .editorial > :global(h2 + *) {
- margin-top: 24px;
- }
-
- .editorial :global(strong) {
- font-weight: 600;
- }
-
- .editorial :global(em) {
- font-style: italic;
- }
-
- .editorial :global(a) {
- text-decoration: underline;
- text-decoration-color: var(--line-default);
- text-underline-offset: 3px;
- }
-
- .editorial :global(:not(pre) > code) {
- padding: 0.1em 0.3em;
- border-radius: 6px;
- background: var(--surface-code);
- font: 0.85em var(--mono);
- }
-
- /* a footnote marker, and the note it points to: small and muted, under the figure */
- .editorial :global(sup) {
- color: var(--art-cinder);
- font: 500 0.75em var(--mono);
- line-height: 0;
- }
-
- .editorial > :global(.note) {
- color: var(--fg-muted);
- font-size: 14px;
- line-height: 1.5;
- }
-
- .editorial > :global(ul) {
- padding-left: 1.2em;
- list-style: disc;
- }
-
- .editorial > :global(ul li + li) {
- margin-top: 0.5em;
- }
-
- .editorial > :global(ul li::marker) {
- color: var(--fg-muted);
- }
-
- /* a pull quote: Display size, wider than the text, with a cinder rule */
- .editorial > :global(.pull) {
- grid-column: wide;
- margin-block: clamp(40px, 6vw, 72px);
- padding-left: clamp(16px, 3vw, 32px);
- border-left: 2px solid var(--art-cinder);
- font-size: clamp(28px, 4.4vw, 48px);
- font-weight: 600;
- letter-spacing: -0.01em;
- line-height: 1.12;
- text-wrap: balance;
- }
-
- .editorial > :global(.pull + *) {
- margin-top: 0;
- }
-
- /* the closing rules: big numbers in the margin */
- .editorial > :global(ol) {
- counter-reset: rule;
- display: grid;
- gap: 20px;
- margin-top: 32px;
- list-style: none;
- }
-
- /* the number set inline in the indent, so it sits on the first line's baseline and the item's text, code and links
- flow as one run */
- .editorial > :global(ol li) {
- counter-increment: rule;
- padding-bottom: 20px;
- padding-left: 3rem;
- border-bottom: 1px solid var(--line-default);
- font-size: 20px;
- line-height: 1.45;
- }
-
- .editorial > :global(ol li)::before {
- content: counter(rule);
- display: inline-block;
- width: 3rem;
- margin-left: -3rem;
- color: var(--fg-muted);
- font: 500 13px var(--mono);
- }
-
- .editorial > :global(.colophon) {
- margin-top: 72px;
- color: var(--fg-muted);
- font: 400 13px / 1.6 var(--mono);
- }
-</style>
diff --git a/ui/apps/chat/tests/stories/forms/HighlightedMatch.stories.svelte b/ui/apps/chat/tests/stories/forms/HighlightedMatch.stories.svelte
index 9eb502f47..046acaef2 100644
--- a/ui/apps/chat/tests/stories/forms/HighlightedMatch.stories.svelte
+++ b/ui/apps/chat/tests/stories/forms/HighlightedMatch.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { HighlightedMatch } from '#lib/components/app/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// how a search query is marked in the sidebar's, the model lists' and the pickers' results
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/forms/InputWithSuggestions.stories.svelte b/ui/apps/chat/tests/stories/forms/InputWithSuggestions.stories.svelte
index 57f4e8fee..441d0bd95 100644
--- a/ui/apps/chat/tests/stories/forms/InputWithSuggestions.stories.svelte
+++ b/ui/apps/chat/tests/stories/forms/InputWithSuggestions.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { InputWithSuggestions } from '#lib/components/app/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// a field with an autocomplete list under it; the caller owns the suggestions and the keys
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/forms/KeyValuePairs.stories.svelte b/ui/apps/chat/tests/stories/forms/KeyValuePairs.stories.svelte
index 50e6a7e37..ed803f6de 100644
--- a/ui/apps/chat/tests/stories/forms/KeyValuePairs.stories.svelte
+++ b/ui/apps/chat/tests/stories/forms/KeyValuePairs.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { KeyValuePairs } from '#lib/components/app/index.ts';
import type { KeyValuePair } from '#lib/types/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// the editable key and value list, as used for MCP server headers
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/foundations/SafeAreas.stories.svelte b/ui/apps/chat/tests/stories/foundations/SafeAreas.stories.svelte
index d2d37842e..d4ae8c652 100644
--- a/ui/apps/chat/tests/stories/foundations/SafeAreas.stories.svelte
+++ b/ui/apps/chat/tests/stories/foundations/SafeAreas.stories.svelte
@@ -1,7 +1,7 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// the safe-area utilities from src/lib/styles/safe-area.css, in phone frames that simulate an
// installed iPhone app's insets (they are 0 in a desktop browser)
diff --git a/ui/apps/chat/tests/stories/helpers/StateGallery.svelte b/ui/apps/chat/tests/stories/helpers/StateGallery.svelte
deleted file mode 100644
index 30399e9a0..000000000
--- a/ui/apps/chat/tests/stories/helpers/StateGallery.svelte
+++ /dev/null
@@ -1,52 +0,0 @@
-<!--
- Lays out one component in several visual states side by side, each under a small
- label. `columns` sets a fixed column count; leave it out to fill the row with
- cells of at least `minItemWidth`, or of exactly `itemWidth`. Either way a cell
- narrows to the gallery's width on a narrower screen, one to a row. `width` caps
- the gallery (72rem by default).
--->
-<script lang="ts">
- import type { Snippet } from 'svelte';
-
- interface Props {
- children: Snippet;
- columns?: number;
- /** a fixed cell width: as many cells to a row as fit, each this wide */
- itemWidth?: string;
- minItemWidth?: string;
- title?: string;
- width?: string;
- }
-
- let {
- children,
- columns,
- itemWidth,
- minItemWidth = '14rem',
- title,
- width = '72rem'
- }: Props = $props();
-
- let gridTemplate = $derived(
- columns
- ? `repeat(${columns}, minmax(0, 1fr))`
- : itemWidth
- ? `repeat(auto-fill, minmax(min(${itemWidth}, 100%), ${itemWidth}))`
- : `repeat(auto-fill, minmax(min(${minItemWidth}, 100%), 1fr))`
- );
-</script>
-
-<section style:width="min({width}, calc(100vw - 2rem))" class="p-4">
- {#if title}
- <h2 class="mb-4 text-sm font-medium text-muted-foreground">{title}</h2>
- {/if}
-
- <!-- a query container, so a cell can take the gallery's whole width (StateGalleryItem's `full`) -->
- <div
- style:container-type="inline-size"
- style:grid-template-columns={gridTemplate}
- class="grid items-start gap-x-6 gap-y-8"
- >
- {@render children()}
- </div>
-</section>
diff --git a/ui/apps/chat/tests/stories/helpers/StateGalleryItem.svelte b/ui/apps/chat/tests/stories/helpers/StateGalleryItem.svelte
deleted file mode 100644
index 005bea001..000000000
--- a/ui/apps/chat/tests/stories/helpers/StateGalleryItem.svelte
+++ /dev/null
@@ -1,35 +0,0 @@
-<!-- One labelled cell of a StateGallery. `span` lets a wide state take several columns, `full` the whole row. -->
-<script lang="ts">
- import type { Snippet } from 'svelte';
-
- interface Props {
- children: Snippet;
- /** the gallery's whole width, past its columns when they don't fill it */
- full?: boolean;
- label: string;
- note?: string;
- span?: number;
- }
-
- let { children, full = false, label, note, span = 1 }: Props = $props();
-</script>
-
-<figure
- style:grid-column={full ? '1 / -1' : `span ${span}`}
- style:width={full ? '100cqw' : undefined}
- class="m-0 flex min-w-0 flex-col gap-2"
->
- <figcaption class="flex items-baseline gap-2 text-[11px] font-medium tracking-wide uppercase">
- <span class="text-muted-foreground">{label}</span>
-
- {#if note}
- <span class="truncate font-normal tracking-normal text-muted-foreground/70 normal-case"
- >{note}</span
- >
- {/if}
- </figcaption>
-
- <div class="min-w-0">
- {@render children()}
- </div>
-</figure>
diff --git a/ui/apps/chat/tests/stories/introduction/Introduction.stories.svelte b/ui/apps/chat/tests/stories/introduction/Introduction.stories.svelte
index a0eb2594a..10921e5ca 100644
--- a/ui/apps/chat/tests/stories/introduction/Introduction.stories.svelte
+++ b/ui/apps/chat/tests/stories/introduction/Introduction.stories.svelte
@@ -1,7 +1,7 @@
<script lang="ts" module>
- import Editorial from '../editorial/Editorial.svelte';
import Introduction from './Introduction.svx';
import { defineMeta } from '@storybook/addon-svelte-csf';
+ import Editorial from '$llama-ui-stories/editorial/Editorial.svelte';
// the Storybook's front page: what it is for, how we think, how the products fit together and how it is laid out
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/introduction/Introduction.svx b/ui/apps/chat/tests/stories/introduction/Introduction.svx
index ff870aa64..86c2e818b 100644
--- a/ui/apps/chat/tests/stories/introduction/Introduction.svx
+++ b/ui/apps/chat/tests/stories/introduction/Introduction.svx
@@ -45,7 +45,7 @@ The component library **Llama UI**, built on the **Llama Brand** (the icon, Llam
<Products />
</Figure>
-Inside Llama UI, the tokens go from primitives to semantic roles to components, in `ui/lib/ui/src/lib/styles/tokens/`, and `DESIGN.md` is generated from them. Llama UI draws the interface and handles interaction; each app owns its own state.
+Inside Llama UI, the tokens go from primitives to semantic roles to components, in `ui/lib/ui/src/lib/styles/tokens/`, and the token sections of `DESIGN.md` are generated from them (`npm run design:tokens`); its rules are written by hand. Llama UI draws the interface and handles interaction; each app owns its own state.
## How it's laid out
diff --git a/ui/apps/chat/tests/stories/introduction/Sections.svelte b/ui/apps/chat/tests/stories/introduction/Sections.svelte
index 568b5ac19..baa8b68da 100644
--- a/ui/apps/chat/tests/stories/introduction/Sections.svelte
+++ b/ui/apps/chat/tests/stories/introduction/Sections.svelte
@@ -4,44 +4,21 @@
-->
<script lang="ts">
import { PATHS, SIZE } from '../brand/logo-showcase/lib/logo';
+ import { STORYBOOK_SECTIONS } from './sections';
import { BookOpen, Bot, LayoutGrid, MessageSquare } from '@lucide/svelte';
- const sections = [
- {
- here: true,
- holds: 'What this is, and how it fits together',
- icon: BookOpen,
- name: 'Introduction',
- pages: []
- },
- {
- holds: 'The rules, for agents',
- icon: Bot,
- name: 'Agents',
- pages: ['Design guidelines']
- },
- {
- holds: 'The library: its foundations, components and Model UI',
- icon: LayoutGrid,
- name: 'Llama UI',
- pages: ['Foundations', 'Components', 'App components', 'Models', 'Mockups']
- },
- {
- holds: 'The app: its screens and the parts they are built from',
- icon: MessageSquare,
- name: 'Llama Chat',
- pages: [
- 'Foundations',
- 'Chat',
- 'Content',
- 'Models',
- 'MCP',
- 'Navigation',
- 'Settings',
- 'Dialogs'
- ]
- }
- ];
+ const ICONS: Record<string, typeof BookOpen> = {
+ Agents: Bot,
+ Introduction: BookOpen,
+ 'Llama Chat': MessageSquare,
+ 'Llama UI': LayoutGrid
+ };
+
+ const sections = STORYBOOK_SECTIONS.map((section) => ({
+ ...section,
+ here: section.name === 'Introduction',
+ icon: ICONS[section.name]
+ }));
</script>
<ol class="sections">
diff --git a/ui/apps/chat/tests/stories/introduction/Uses.svelte b/ui/apps/chat/tests/stories/introduction/Uses.svelte
index 4c10841d7..36f5d2686 100644
--- a/ui/apps/chat/tests/stories/introduction/Uses.svelte
+++ b/ui/apps/chat/tests/stories/introduction/Uses.svelte
@@ -1,6 +1,7 @@
<!--
What this Storybook is for, as four tiles: designing with the real system, building from the components, checking with
- the accessibility addon and handing over to agents. Each has its icon, its name and one line.
+ the accessibility addon (its findings are shown, not yet enforced; see a11y in .storybook/preview.ts) and handing over
+ to agents. Each has its icon, its name and one line.
-->
<script lang="ts">
import { Blocks, CircleCheck, PenTool, Send } from '@lucide/svelte';
@@ -18,12 +19,12 @@
},
{
icon: CircleCheck,
- line: 'Every story is the real code, checked for accessibility',
+ line: 'Every story is the real code; the Accessibility panel lists what it misses',
name: 'Checking'
},
{
icon: Send,
- line: 'The rules are written for agents in DESIGN.md, from the tokens',
+ line: 'The rules are written for agents in DESIGN.md, its tokens generated from the CSS',
name: 'Handing over'
}
];
diff --git a/ui/apps/chat/tests/stories/introduction/sections.ts b/ui/apps/chat/tests/stories/introduction/sections.ts
new file mode 100644
index 000000000..2713f2c23
--- /dev/null
+++ b/ui/apps/chat/tests/stories/introduction/sections.ts
@@ -0,0 +1,50 @@
+/**
+ * The Storybook's top-level sections and the groups under each, in sidebar order, for the Introduction's Sections
+ * figure. Storybook reads the sidebar order from `storySort` in .storybook/preview.ts, which it parses as written, so
+ * this list cannot be imported there; tests/unit/storybook-sections.test.ts checks that the two match.
+ */
+export interface StorybookSection {
+ /** What the section holds, in one line. */
+ holds: string;
+ name: string;
+ /** The groups under it, as the sidebar lists them. */
+ pages: string[];
+}
+
+export const STORYBOOK_SECTIONS: StorybookSection[] = [
+ {
+ holds: 'What this is, and how it fits together',
+ name: 'Introduction',
+ pages: []
+ },
+ {
+ holds: 'The rules, for agents',
+ name: 'Agents',
+ pages: ['Design guidelines']
+ },
+ {
+ holds: 'The library: its foundations, components and Model UI',
+ name: 'Llama UI',
+ pages: ['Foundations', 'Components', 'App components', 'Models', 'Mockups']
+ },
+ {
+ holds: 'The app: its screens and the parts they are built from',
+ name: 'Llama Chat',
+ pages: [
+ 'Foundations',
+ 'Chat',
+ 'Content',
+ 'Models',
+ 'MCP',
+ 'Navigation',
+ 'Settings',
+ 'Dialogs',
+ 'Forms',
+ 'Actions',
+ 'Badges',
+ 'Misc',
+ 'Servers',
+ 'PWA'
+ ]
+ }
+];
diff --git a/ui/apps/chat/tests/stories/mcp/McpServerCard.stories.svelte b/ui/apps/chat/tests/stories/mcp/McpServerCard.stories.svelte
index bd7c8b218..c2d3f4c56 100644
--- a/ui/apps/chat/tests/stories/mcp/McpServerCard.stories.svelte
+++ b/ui/apps/chat/tests/stories/mcp/McpServerCard.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { seedServerHealth, servers } from './fixtures';
import { defineMeta } from '@storybook/addon-svelte-csf';
import McpServerCard from '#lib/components/app/mcp/McpServerCard/McpServerCard.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
const { Story } = defineMeta({
component: McpServerCard,
diff --git a/ui/apps/chat/tests/stories/misc/CollapsibleSection.stories.svelte b/ui/apps/chat/tests/stories/misc/CollapsibleSection.stories.svelte
index 886612b62..578550b49 100644
--- a/ui/apps/chat/tests/stories/misc/CollapsibleSection.stories.svelte
+++ b/ui/apps/chat/tests/stories/misc/CollapsibleSection.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { CollapsibleSection } from '#lib/components/app/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// the animated show and hide section used by sidebar groups and model lists
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/misc/KeyboardShortcutInfo.stories.svelte b/ui/apps/chat/tests/stories/misc/KeyboardShortcutInfo.stories.svelte
index c9c1dbb8b..c89e0343e 100644
--- a/ui/apps/chat/tests/stories/misc/KeyboardShortcutInfo.stories.svelte
+++ b/ui/apps/chat/tests/stories/misc/KeyboardShortcutInfo.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { KeyboardShortcutInfo } from '#lib/components/app/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// shortcut hints in menus; hidden by default and shown by the row's hover, so forced visible here
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/misc/ScrollCarousel.stories.svelte b/ui/apps/chat/tests/stories/misc/ScrollCarousel.stories.svelte
index 856800ecb..07cd2a030 100644
--- a/ui/apps/chat/tests/stories/misc/ScrollCarousel.stories.svelte
+++ b/ui/apps/chat/tests/stories/misc/ScrollCarousel.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { ScrollCarousel } from '#lib/components/app/index.ts';
import { ScrollCarouselVariant } from '#lib/enums/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// the horizontal scroller behind attachment rows and chat tabs
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/misc/TruncatedText.stories.svelte b/ui/apps/chat/tests/stories/misc/TruncatedText.stories.svelte
index 119dbb57c..7dfa0ca25 100644
--- a/ui/apps/chat/tests/stories/misc/TruncatedText.stories.svelte
+++ b/ui/apps/chat/tests/stories/misc/TruncatedText.stories.svelte
@@ -1,8 +1,8 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import { TruncatedText } from '#lib/components/app/index.ts';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// one line of text that shows the full value in a tooltip only when it is cut off
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/servers/ServerSplash.stories.svelte b/ui/apps/chat/tests/stories/servers/ServerSplash.stories.svelte
index 6b34ae952..09a804670 100644
--- a/ui/apps/chat/tests/stories/servers/ServerSplash.stories.svelte
+++ b/ui/apps/chat/tests/stories/servers/ServerSplash.stories.svelte
@@ -1,9 +1,9 @@
<script lang="ts" module>
- import StateGallery from '../helpers/StateGallery.svelte';
- import StateGalleryItem from '../helpers/StateGalleryItem.svelte';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ServerErrorSplash from '#lib/components/app/servers/ServerErrorSplash.svelte';
import ServerLoadingSplash from '#lib/components/app/servers/ServerLoadingSplash.svelte';
+ import StateGallery from '$llama-ui-stories/helpers/StateGallery.svelte';
+ import StateGalleryItem from '$llama-ui-stories/helpers/StateGalleryItem.svelte';
// the loading and error splashes are the two screens shown before the app connects
const { Story } = defineMeta({
diff --git a/ui/apps/chat/tests/stories/svx.d.ts b/ui/apps/chat/tests/stories/svx.d.ts
deleted file mode 100644
index 88dce6044..000000000
--- a/ui/apps/chat/tests/stories/svx.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-// .svx pages (mdsvex) import as Svelte components
-declare module '*.svx' {
- import type { Component } from 'svelte';
- const page: Component;
- export default page;
-}
diff --git a/ui/apps/chat/tests/unit/storybook-sections.test.ts b/ui/apps/chat/tests/unit/storybook-sections.test.ts
new file mode 100644
index 000000000..ce817a87b
--- /dev/null
+++ b/ui/apps/chat/tests/unit/storybook-sections.test.ts
@@ -0,0 +1,35 @@
+import { STORYBOOK_SECTIONS } from '../stories/introduction/sections';
+import { readFileSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { getStorySortParameter } from 'storybook/internal/csf-tools';
+import { describe, expect, it } from 'vitest';
+
+// the Introduction's Sections figure lists the sidebar's sections and their groups; the sidebar takes its order from
+// storySort in .storybook/preview.ts, which Storybook parses as written, so the figure keeps its own copy
+const PREVIEW = resolve(dirname(fileURLToPath(import.meta.url)), '../../.storybook/preview.ts');
+
+type Order = (string | Order)[];
+
+/** The names at one level of a storySort order, without the nested orders that follow them. */
+function sections(order: Order): { name: string; children: Order }[] {
+ return order.flatMap((entry, index) => {
+ if (typeof entry !== 'string') return [];
+
+ const next = order[index + 1];
+
+ return [{ children: Array.isArray(next) ? next : [], name: entry }];
+ });
+}
+
+describe("the Introduction's Sections figure", () => {
+ it("lists the sidebar's sections and their groups, in sidebar order", () => {
+ const storySort = getStorySortParameter(readFileSync(PREVIEW, 'utf8')) as { order: Order };
+ const sidebar = sections(storySort.order).map(({ children, name }) => ({
+ name,
+ pages: sections(children).map((child) => child.name)
+ }));
+
+ expect(STORYBOOK_SECTIONS.map(({ name, pages }) => ({ name, pages }))).toEqual(sidebar);
+ });
+});
diff --git a/ui/apps/chat/tsconfig.json b/ui/apps/chat/tsconfig.json
index abe5aed2e..4d4c701d3 100644
--- a/ui/apps/chat/tsconfig.json
+++ b/ui/apps/chat/tsconfig.json
@@ -15,6 +15,7 @@
"@ggml-org/llama-ui/fonts.css": ["../../lib/ui/src/lib/styles/fonts.css"],
"@ggml-org/llama-ui/surfaces.css": ["../../lib/ui/src/lib/styles/surfaces.css"],
"@ggml-org/llama-ui": ["../../lib/ui/src/lib/index.ts"],
+ "$llama-ui-stories/*": ["../../lib/ui/tests/stories/*"],
"@internationalized/date": ["./node_modules/@internationalized/date"],
"@internationalized/date/*": ["./node_modules/@internationalized/date/*"],
"@lucide/svelte": ["./node_modules/@lucide/svelte"],
@@ -58,6 +59,7 @@
"tests/**/*.ts",
"tests/**/*.svelte",
".storybook/**/*.ts",
+ "../../lib/ui/tests/stories/svx.d.ts",
".storybook/**/*.svelte"
],
"exclude": ["src/lib/services/sandbox-worker.js", "src/lib/vendors/**", "src/service-worker"]
diff --git a/ui/lib/ui/.storybook/preview.ts b/ui/lib/ui/.storybook/preview.ts
index 9994a5554..05ff2ad7c 100644
--- a/ui/lib/ui/.storybook/preview.ts
+++ b/ui/lib/ui/.storybook/preview.ts
@@ -42,9 +42,10 @@ const preview: Preview = {
},
a11y: {
- // 'todo' - show a11y violations in the test UI only
- // 'error' - fail CI on a11y violations
- // 'off' - skip a11y checks entirely
+ // 'todo' shows violations in the Accessibility panel and the test UI without failing a test; 'error' would
+ // fail CI on them. Not yet 'error': about half the stories fail it, most on colour contrast (the muted
+ // foreground on the light surfaces, below 4.5:1) and nested interactive controls, which need design changes
+ // rather than story fixes. Switch once those are settled
test: 'todo'
}
},
diff --git a/ui/lib/ui/package-lock.json b/ui/lib/ui/package-lock.json
index e202661ec..40a2751d6 100644
--- a/ui/lib/ui/package-lock.json
+++ b/ui/lib/ui/package-lock.json
@@ -20,13 +20,13 @@
"vaul-svelte": "1.0.0-next.7"
},
"devDependencies": {
- "@chromatic-com/storybook": "^5.5.1",
- "@storybook/addon-a11y": "^10.6.2",
- "@storybook/addon-docs": "^10.6.2",
- "@storybook/addon-mcp": "10.6.2",
- "@storybook/addon-svelte-csf": "^5.1.5",
- "@storybook/addon-vitest": "^10.6.2",
- "@storybook/sveltekit": "^10.6.2",
+ "@chromatic-com/storybook": "5.5.1",
+ "@storybook/addon-a11y": "10.6.6",
+ "@storybook/addon-docs": "10.6.6",
+ "@storybook/addon-mcp": "10.6.6",
+ "@storybook/addon-svelte-csf": "5.1.6",
+ "@storybook/addon-vitest": "10.6.6",
+ "@storybook/sveltekit": "10.6.6",
"@sveltejs/adapter-auto": "^8.0.0",
"@sveltejs/kit": "^3.0.0",
"@sveltejs/package": "^2.5.8",
@@ -39,7 +39,7 @@
"mode-watcher": "^1.1.0",
"playwright": "^1.60.0",
"publint": "^0.3.21",
- "storybook": "^10.6.2",
+ "storybook": "10.6.6",
"svelte": "^5.57.1",
"svelte-check": "^4.6.0",
"tailwindcss": "^4.3.3",
@@ -2342,9 +2342,9 @@
"license": "MIT"
},
"node_modules/@storybook/addon-a11y": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/addon-a11y/-/addon-a11y-10.6.2.tgz",
- "integrity": "sha512-zleS+btwrTRcUf3opbZntKsEt6PTqAtxsek08tx5jh5fRvd6wWmtnwW3uaBcypfIKnheTB3KGljJwFX+Mc+Umg==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/addon-a11y/-/addon-a11y-10.6.6.tgz",
+ "integrity": "sha512-+LdCNVDELDqYWWbWkMX8LH9CXxDXnizfzvyJUVfkdF5CPZFRZu1xpv+jvLBFEumw/sQmizPZUXlw8zbdO1jvEQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2356,19 +2356,19 @@
"url": "https://opencollective.com/storybook"
},
"peerDependencies": {
- "storybook": "^10.6.2"
+ "storybook": "^10.6.6"
}
},
"node_modules/@storybook/addon-docs": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/addon-docs/-/addon-docs-10.6.2.tgz",
- "integrity": "sha512-f7Rv/rzX1sk4lUDTeoIRkXWcWvNwLv7vBnfpFGb3f88MliB+M4ZekGKNiKtrmi44uLFt52gzwwPzj2eGDu0DQQ==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/addon-docs/-/addon-docs-10.6.6.tgz",
+ "integrity": "sha512-yflMNPrxk+QNuH0dPFgUk+AhVOa+Cz48bKz3/72eFDB8viWS9R0mQVBvKUxTIHOSUyDbaRyQiIeaL/pCvwW2jg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@mdx-js/react": "^3.0.0",
"@storybook/icons": "^2.0.2",
- "@storybook/react-dom-shim": "10.6.2",
+ "@storybook/react-dom-shim": "10.6.6",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"ts-dedent": "^2.0.0",
@@ -2380,7 +2380,7 @@
},
"peerDependencies": {
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
- "storybook": "^10.6.2"
+ "storybook": "^10.6.6"
},
"peerDependenciesMeta": {
"@types/react": {
@@ -2389,9 +2389,9 @@
}
},
"node_modules/@storybook/addon-mcp": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/addon-mcp/-/addon-mcp-10.6.2.tgz",
- "integrity": "sha512-AY18igxEq+8pEmzFreSklY6nxYe5xHZdqOqHCg10vT6Ms7pYb0XdnSG94mesJ6Zp+1E4o65WDfmsgMadEvJsfw==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/addon-mcp/-/addon-mcp-10.6.6.tgz",
+ "integrity": "sha512-JMXgHRuJCI5tbjxE4mk38VMUmaETHOGwAYlxVcPI3SwGHeVWUTHhLMJiLZN6JIkkAT71J75o5q1Zi9kFUoXBOg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2405,8 +2405,8 @@
"url": "https://opencollective.com/storybook"
},
"peerDependencies": {
- "@storybook/addon-vitest": "^10.6.2",
- "storybook": "^10.6.2"
+ "@storybook/addon-vitest": "^10.6.6",
+ "storybook": "^10.6.6"
},
"peerDependenciesMeta": {
"@storybook/addon-vitest": {
@@ -2415,9 +2415,9 @@
}
},
"node_modules/@storybook/addon-svelte-csf": {
- "version": "5.1.5",
- "resolved": "https://registry.npmjs.org/@storybook/addon-svelte-csf/-/addon-svelte-csf-5.1.5.tgz",
- "integrity": "sha512-lYc9tyFIowXtd/hlapngtGhw6YUZMSU5KezHqJl84lRkahsNtmtqHl/mJjRRJG2ZQIWgw6xBUi4PvVvTxPwqzQ==",
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/@storybook/addon-svelte-csf/-/addon-svelte-csf-5.1.6.tgz",
+ "integrity": "sha512-Pzzfr9Lqx0p6a2IBVRlR3zIhA8usl46ADcSSHoe2cU1hICB2HqpDyukqXFSK1NFuTP53yDH99LBbl7drii9l4Q==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2458,9 +2458,9 @@
}
},
"node_modules/@storybook/addon-vitest": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/addon-vitest/-/addon-vitest-10.6.2.tgz",
- "integrity": "sha512-gyyBzncvUyEgWQR3LinnGuI4UsWIUYLyw1u8i244aTxmY4uxCYjsDmUNkaSr8xQzNz8nh2Ckh3G4bO4SvJ6nJQ==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/addon-vitest/-/addon-vitest-10.6.6.tgz",
+ "integrity": "sha512-wyCJ6922tD/xxcADk0lnKqZ5OiekD59oIyt7iUZM7X/nUOqfoY3AU4kwvvIM+6sd68YUT8QyTmGZAzyiLVduFA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2472,11 +2472,10 @@
"url": "https://opencollective.com/storybook"
},
"peerDependencies": {
- "@vitest/browser": "^3.0.0 || ^4.0.0 || ^5.0.0",
+ "@vitest/browser": "^4.0.0 || ^5.0.0",
"@vitest/browser-playwright": "^4.0.0 || ^5.0.0",
- "@vitest/runner": "^3.0.0 || ^4.0.0 || ^5.0.0",
- "storybook": "^10.6.2",
- "vitest": "^3.0.0 || ^4.0.0 || ^5.0.0"
+ "storybook": "^10.6.6",
+ "vitest": "^4.0.0 || ^5.0.0"
},
"peerDependenciesMeta": {
"@vitest/browser": {
@@ -2485,18 +2484,15 @@
"@vitest/browser-playwright": {
"optional": true
},
- "@vitest/runner": {
- "optional": true
- },
"vitest": {
"optional": true
}
}
},
"node_modules/@storybook/builder-vite": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/builder-vite/-/builder-vite-10.6.2.tgz",
- "integrity": "sha512-SzeQEGjvybdhP2coF4aIX6JX/7rZTrQCpRU3vAEO/R98Vr3xM8jdg7a3nvt91TeF/P8iWqljLIpaDjTdk2r/sQ==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/builder-vite/-/builder-vite-10.6.6.tgz",
+ "integrity": "sha512-DIA992qGuPZpTZqupWuhw3upWc6Qphm0tQFfSnCpgr5Nlvhe0C5Mth9eYz7CUpy49szJ6eOgQ2V8ktKtKaXyNA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2507,7 +2503,7 @@
"url": "https://opencollective.com/storybook"
},
"peerDependencies": {
- "storybook": "^10.6.2",
+ "storybook": "^10.6.6",
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
@@ -2539,9 +2535,9 @@
}
},
"node_modules/@storybook/react-dom-shim": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/react-dom-shim/-/react-dom-shim-10.6.2.tgz",
- "integrity": "sha512-k0262Vqxjk3wHeg3g/QO/ENDrkC7kkbuwsFSXOdYr7Sl888tsF1DAS7uQ/gr+s/BRz1FLYRX7wBY3smEUV4MJg==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/react-dom-shim/-/react-dom-shim-10.6.6.tgz",
+ "integrity": "sha512-yZNOsGoBvn+ywgf7WR+nHddBpIh/k24IOfAeMte6JA1rMB9defuPyhuMMENEyLfofqNYFnj1D+CB4XppnO3nBA==",
"dev": true,
"license": "MIT",
"funding": {
@@ -2553,7 +2549,7 @@
"@types/react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
- "storybook": "^10.6.2"
+ "storybook": "^10.6.6"
},
"peerDependenciesMeta": {
"@types/react": {
@@ -2565,9 +2561,9 @@
}
},
"node_modules/@storybook/svelte": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/svelte/-/svelte-10.6.2.tgz",
- "integrity": "sha512-P4LfcT2fGEYcqn4CFVkel/TvCHFxLUF8E/H/M8LqU/beJGr0f0c87L64QvDaJJiGjARRWTK1mvd0z8eSYO96Nw==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/svelte/-/svelte-10.6.6.tgz",
+ "integrity": "sha512-KIfKv7pP3SKVDDdYH1AwaX//hLsubmiHsMb1eknXiEkMkhPIfPFftJWZaUQTAbW0edM3NmvuYwJEnmAOKRMDnw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2579,19 +2575,19 @@
"url": "https://opencollective.com/storybook"
},
"peerDependencies": {
- "storybook": "^10.6.2",
+ "storybook": "^10.6.6",
"svelte": "^5.0.0"
}
},
"node_modules/@storybook/svelte-vite": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/svelte-vite/-/svelte-vite-10.6.2.tgz",
- "integrity": "sha512-IjSm98aMRNX0iH5A0i8VK1oUOak8Vq8r0O1xHozb7esjz0bVTznwx6sOGKkfhV8k0n1Vn5e2YzvXJR5m5Rqo8A==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/svelte-vite/-/svelte-vite-10.6.6.tgz",
+ "integrity": "sha512-KISBR4aUKMgxicqeHRmn/86nKGDRxttJO2fl7b3AzI2qoUn0gLCGi0iZxz7FR92WcPOVbe4qZcTWnsNNSUvz3Q==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@storybook/builder-vite": "10.6.2",
- "@storybook/svelte": "10.6.2",
+ "@storybook/builder-vite": "10.6.6",
+ "@storybook/svelte": "10.6.6",
"magic-string": "^1.1.0",
"svelte2tsx": "^0.7.55",
"typescript": "^4.9.4 || ^5.0.0"
@@ -2602,7 +2598,7 @@
},
"peerDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
- "storybook": "^10.6.2",
+ "storybook": "^10.6.6",
"svelte": "^5.0.0",
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
}
@@ -2638,22 +2634,22 @@
}
},
"node_modules/@storybook/sveltekit": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/@storybook/sveltekit/-/sveltekit-10.6.2.tgz",
- "integrity": "sha512-YfwJz+rlArrZSiMhTLA7TrPSwmcK3vqKa0yIDZaRfmQuP8YuwQop1CCic719VZ9kbYgMbsboCOAhZIr/ZtMreg==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/@storybook/sveltekit/-/sveltekit-10.6.6.tgz",
+ "integrity": "sha512-nYIzBNSBqwvwpFj8rMj+HPls1fIj+XzPjJ+3/NANGjmAuZToNCzOcGr6hgr3tkRbUETYRIrVKKEYb7JUtjlg/w==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@storybook/builder-vite": "10.6.2",
- "@storybook/svelte": "10.6.2",
- "@storybook/svelte-vite": "10.6.2"
+ "@storybook/builder-vite": "10.6.6",
+ "@storybook/svelte": "10.6.6",
+ "@storybook/svelte-vite": "10.6.6"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/storybook"
},
"peerDependencies": {
- "storybook": "^10.6.2",
+ "storybook": "^10.6.6",
"svelte": "^5.0.0",
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
}
@@ -6040,9 +6036,9 @@
"license": "MIT"
},
"node_modules/storybook": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/storybook/-/storybook-10.6.2.tgz",
- "integrity": "sha512-qHDINMiapxFUxYb+xC3j8u7Y+85X3u+/PlytE/wmnyg+bU0agCW3jUmWP4vIh2MioO2jTK/2B3Lcw6IpRFzQBA==",
+ "version": "10.6.6",
+ "resolved": "https://registry.npmjs.org/storybook/-/storybook-10.6.6.tgz",
+ "integrity": "sha512-lCROrR6Fj+WDBoJu4yp6o/cqcg376Sg85hiUnTh00I0EStk8xFRvTdzRuNWHlLA8itQrkz6Lo/IqFZ1FVXMiAA==",
"dev": true,
"license": "MIT",
"dependencies": {
diff --git a/ui/lib/ui/package.json b/ui/lib/ui/package.json
index d0648d601..ff86bd63e 100644
--- a/ui/lib/ui/package.json
+++ b/ui/lib/ui/package.json
@@ -79,13 +79,13 @@
"watch:package": "svelte-kit sync && svelte-package -w"
},
"devDependencies": {
- "@chromatic-com/storybook": "^5.5.1",
- "@storybook/addon-a11y": "^10.6.2",
- "@storybook/addon-docs": "^10.6.2",
- "@storybook/addon-mcp": "10.6.2",
- "@storybook/addon-svelte-csf": "^5.1.5",
- "@storybook/addon-vitest": "^10.6.2",
- "@storybook/sveltekit": "^10.6.2",
+ "@chromatic-com/storybook": "5.5.1",
+ "@storybook/addon-a11y": "10.6.6",
+ "@storybook/addon-docs": "10.6.6",
+ "@storybook/addon-mcp": "10.6.6",
+ "@storybook/addon-svelte-csf": "5.1.6",
+ "@storybook/addon-vitest": "10.6.6",
+ "@storybook/sveltekit": "10.6.6",
"@sveltejs/adapter-auto": "^8.0.0",
"@sveltejs/kit": "^3.0.0",
"@sveltejs/package": "^2.5.8",
@@ -98,7 +98,7 @@
"mode-watcher": "^1.1.0",
"playwright": "^1.60.0",
"publint": "^0.3.21",
- "storybook": "^10.6.2",
+ "storybook": "10.6.6",
"svelte": "^5.57.1",
"svelte-check": "^4.6.0",
"tailwindcss": "^4.3.3",
diff --git a/ui/lib/ui/tests/stories/brand/fonts/LlamaMono.woff2 b/ui/lib/ui/tests/stories/brand/fonts/LlamaMono.woff2
deleted file mode 100644
index f43b2588d..000000000
Binary files a/ui/lib/ui/tests/stories/brand/fonts/LlamaMono.woff2 and /dev/null differ
diff --git a/ui/lib/ui/tests/stories/brand/fonts/OFL.txt b/ui/lib/ui/tests/stories/brand/fonts/OFL.txt
deleted file mode 100644
index 04e95fc55..000000000
--- a/ui/lib/ui/tests/stories/brand/fonts/OFL.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)
-
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at:
-https://openfontlicense.org
-
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide
-development of collaborative font projects, to support the font creation
-efforts of academic and linguistic communities, and to provide a free and
-open framework in which fonts may be shared and improved in partnership
-with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and
-redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded,
-redistributed and/or sold with any software provided that any reserved
-names are not used by derivative works. The fonts and derivatives,
-however, cannot be released under any other type of license. The
-requirement for fonts to remain under this license does not apply
-to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright
-Holder(s) under this license and clearly marked as such. This may
-include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the
-copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as
-distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting,
-or substituting -- in part or in whole -- any of the components of the
-Original Version, by changing formats or by porting the Font Software to a
-new environment.
-
-"Author" refers to any designer, engineer, programmer, technical
-writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Font Software, to use, study, copy, merge, embed, modify,
-redistribute, and sell modified and unmodified copies of the Font
-Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components,
-in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled,
-redistributed and/or sold with any software, provided that each copy
-contains the above copyright notice and this license. These can be
-included either as stand-alone text files, human-readable headers or
-in the appropriate machine-readable metadata fields within text or
-binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font
-Name(s) unless explicit written permission is granted by the corresponding
-Copyright Holder. This restriction only applies to the primary font name as
-presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
-Software shall not be used to promote, endorse or advertise any
-Modified Version, except to acknowledge the contribution(s) of the
-Copyright Holder(s) and the Author(s) or with their explicit written
-permission.
-
-5) The Font Software, modified or unmodified, in part or in whole,
-must be distributed entirely under this license, and must not be
-distributed under any other license. The requirement for fonts to
-remain under this license does not apply to any document created
-using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are
-not met.
-
-DISCLAIMER
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
-OTHER DEALINGS IN THE FONT SOFTWARE.
\ No newline at end of file
diff --git a/ui/lib/ui/tests/stories/brand/fonts/fonts.css b/ui/lib/ui/tests/stories/brand/fonts/fonts.css
deleted file mode 100644
index 8d9409b2f..000000000
--- a/ui/lib/ui/tests/stories/brand/fonts/fonts.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Llama Mono for the brand showcases (logo and type); Llama Sans is the design system's own (src/app.css) */
-@font-face {
- font-family: 'Llama Mono';
- src: url('./LlamaMono.woff2') format('woff2');
- font-weight: 400 700;
- font-style: normal;
- font-display: block;
-}
diff --git a/ui/lib/ui/tests/stories/editorial/Editorial.svelte b/ui/lib/ui/tests/stories/editorial/Editorial.svelte
index 068b55624..434848698 100644
--- a/ui/lib/ui/tests/stories/editorial/Editorial.svelte
+++ b/ui/lib/ui/tests/stories/editorial/Editorial.svelte
@@ -4,7 +4,6 @@
and the chapter navigation fixed at the right.
-->
<script lang="ts">
- import '../brand/fonts/fonts.css';
import Chapters from './Chapters.svelte';
import type { Snippet } from 'svelte';
@@ -177,12 +176,12 @@
list-style: none;
}
+ /* the number set inline in the indent, so it sits on the first line's baseline and the item's text, code and links
+ flow as one run */
.editorial > :global(ol li) {
counter-increment: rule;
- display: grid;
- grid-template-columns: 3rem 1fr;
- align-items: baseline;
padding-bottom: 20px;
+ padding-left: 3rem;
border-bottom: 1px solid var(--line-default);
font-size: 20px;
line-height: 1.45;
@@ -190,6 +189,9 @@
.editorial > :global(ol li)::before {
content: counter(rule);
+ display: inline-block;
+ width: 3rem;
+ margin-left: -3rem;
color: var(--fg-muted);
font: 500 13px var(--mono);
}
diff --git a/ui/lib/ui/tests/stories/svelte.config.js b/ui/lib/ui/tests/stories/svelte.config.js
new file mode 100644
index 000000000..ba5809b83
--- /dev/null
+++ b/ui/lib/ui/tests/stories/svelte.config.js
@@ -0,0 +1,5 @@
+// Llama Chat (ui/apps/chat) imports the helpers its stories share with these (the Editorial, the state gallery), so
+// its svelte-check reads them too and looks upwards from each file for a Svelte config. Without this one it would load
+// vite.config.ts two levels up, which needs this package's own dependencies installed (see src/svelte.config.js).
+// This package's Storybook is configured in vite.config.ts and .storybook.
+export default {};