diff --git a/.claude/skills/openbot-screen-layout/SKILL.md b/.claude/skills/openbot-screen-layout/SKILL.md index 2ca169bed6..25b0fe22bf 100644 --- a/.claude/skills/openbot-screen-layout/SKILL.md +++ b/.claude/skills/openbot-screen-layout/SKILL.md @@ -72,7 +72,7 @@ components above; a screen that sets its own is drifting. | Section heading → description | 4px | `PageSection` | | Heading block → section content | 16px | `PageRows` / `PageEmpty` (`mt-4`) | | Controls stacked inside a section | 12px | the screen, with `gap-3` | -| A row in `PageRows` | 65px with a description, never under 56px | `Item` (`px-4 py-3.5 gap-3`), `PageRows` (`min-h-14`) | +| A row in `PageRows` | 67px with a description, never under 56px | `Item` (`px-4 py-3.5 gap-3`), `PageRows` (`min-h-14`) | | Divider between rows | inset 16px from both edges | `PageRows`, on every horizontal `Separator` inside it | The 32px under the title is deliberately tighter than the 48px between sections: the title belongs @@ -204,10 +204,8 @@ Only where the request asks for a dialog (Screens, Not Dialogs). ## Units The root is the browser's 16px, so Tailwind's spacing, sizes and widths are their documented values -(`p-4` is 16px, `max-w-3xl` is 768px) and land on its 4px grid. Text is the exception: `styles.css` -sets every `--text-*` to Tailwind's default times 15/16, so `text-sm` is 13.125px and body text is -15px. That is the scale this app has always read at; do not size text in px or rem by hand to match -the docs. +(`p-4` is 16px, `max-w-3xl` is 768px) and land on its 4px grid. Text is on Tailwind's own scale +too: `text-xs` is 12px, `text-sm` 14px and body text 16px. Do not size text in px or rem by hand. Even so, never hardcode a pixel constant derived from a Tailwind token, and never compute a ratio from one. Measure the element — `offsetWidth`, `clientWidth`, a `ResizeObserver` — and scale from what diff --git a/app/src/components/channels/composer/attachment-strip.tsx b/app/src/components/channels/composer/attachment-strip.tsx index d35762a47a..f56485fc6c 100644 --- a/app/src/components/channels/composer/attachment-strip.tsx +++ b/app/src/components/channels/composer/attachment-strip.tsx @@ -131,7 +131,7 @@ export function AttachmentStrip({ * ON THE SIZE LINE, NOT UNDER IT, AND THAT IS A LAYOUT CONSTRAINT RATHER THAN A * PREFERENCE. The tile's height is fixed so that a file and a thumbnail read as * one row. A third line does not fit: with three lines the two in-flow children - * need 65px (a 20px icon and three 15px lines) inside a 62px box. Something + * need 68px (a 20px icon and three 16px lines) inside a 62px box. Something * has to give, and the only choices are the icon shrinking to 17px or the text * spilling past the border. Folding the warning onto this line keeps two. * diff --git a/app/src/components/layout/page-parts.tsx b/app/src/components/layout/page-parts.tsx index 1e7969c99b..07606938d5 100644 --- a/app/src/components/layout/page-parts.tsx +++ b/app/src/components/layout/page-parts.tsx @@ -173,8 +173,8 @@ export function PageRows({ * inside a card of divided rows painted a hover as a floating pill: a middle row has no corners, * and the first and last cannot be concentric with the card while sitting a border inside it. * - * Every row is at least 56px, whatever it holds. A title over a description is 65px; a lone - * line would be 48px and look stunted beside it, so it is held up to the floor. A description + * Every row is at least 56px, whatever it holds. A title over a description is 67px; a lone + * line would be 47px and look stunted beside it, so it is held up to the floor. A description * that wraps to a second line still grows the row rather than being clipped. */
{ // Dark under `.dark`, and not inside an artifact drawn in its own light scheme. /\.dark\\:bg-card:is\(\.dark \*, \[data-color-scheme="dark"\], \[data-color-scheme="dark"\] \*\):not\(\[data-color-scheme="light"\], \[data-color-scheme="light"\] \*\)\s*{\s*background-color: var\(--card\);/, /\.rounded-lg\s*{\s*border-radius: var\(--radius\);/, - // The app's type scale: 15/16 of Tailwind's. - /\.text-sm\s*{\s*font-size: 0\.8203125rem;/, + // The app's type scale: Tailwind's own, so text-sm is 14px. + /\.text-sm\s*{\s*font-size: var\(--text-sm\);/, + /--text-sm: 0\.875rem;/, /\.data-open\\:animate-in:where\(\[data-state="open"\]\)/, // The app's base layer and its text face. /border-color: var\(--border\);/, diff --git a/app/tests/connect-your-ai.test.tsx b/app/tests/connect-your-ai.test.tsx index b5a87f5640..1762f600b2 100644 --- a/app/tests/connect-your-ai.test.tsx +++ b/app/tests/connect-your-ai.test.tsx @@ -2254,7 +2254,7 @@ describe.skipIf(!asked)("Connect your AI on OpenBot Cloud", () => { expect(room).not.toBeNull(); // Clear of the fade, and no further: the frame keeps the fade's height above the // buttons for every step, so a step adding room of its own doubles the gap. Within a - // pixel, for the sub-pixel sizes text is drawn at (styles.css scales it by 15/16). + // pixel, for the sub-pixel line heights of Tailwind's type scale. expect(room ?? -2).toBeGreaterThanOrEqual(-1); expect(room ?? Number.POSITIVE_INFINITY).toBeLessThanOrEqual(8); if (shots) { diff --git a/app/tests/conversation-row-text.test.ts b/app/tests/conversation-row-text.test.ts index 0f5cfc3f33..bad95a2cfe 100644 --- a/app/tests/conversation-row-text.test.ts +++ b/app/tests/conversation-row-text.test.ts @@ -4,8 +4,8 @@ import { classes } from "./ui-look-rules"; /* * A conversation row's second voice (its time, the "Working" label and the preview line) stays at - * the 12px it has always had. text-xs (11.25px) would make it smaller, which the look rules out, - * and text-sm (13.1px) made it the title's size, so the row lost its hierarchy. + * the 12px it has always had. text-sm (14px) made it the title's size, so the row lost its + * hierarchy. */ const source = readFileSync( diff --git a/app/tests/skins-window-buttons.test.tsx b/app/tests/skins-window-buttons.test.tsx index 27a78bb3f3..bf06391096 100644 --- a/app/tests/skins-window-buttons.test.tsx +++ b/app/tests/skins-window-buttons.test.tsx @@ -493,8 +493,11 @@ describe.skipIf(!asked)("the skins and the window's buttons", () => { "[data-openduet-page] header p": { x: 485, y: 25 }, }, "openduet-pane": { 'button[aria-label="Menu"]': { x: 16, y: 20 } }, + // The banner's line is text-sm, centred in its 28px row. On the whole-pixel type scale it + // is 14px on a 20px line (was 13.125px on 18.75px), so its top is 1px higher. The row and + // the banner have not moved. "openduet-update": { - '[aria-label="OpenBot update"] p': { x: 16, y: 11 }, + '[aria-label="OpenBot update"] p': { x: 16, y: 10 }, }, opendots: { 'nav[aria-label="Workspace navigation"] a': { x: 6, y: 16 }, @@ -514,7 +517,7 @@ describe.skipIf(!asked)("the skins and the window's buttons", () => { 'button[aria-label="Open conversations and menu"]': { x: 20, y: 16 }, }, "openfuse-update": { - '[aria-label="OpenBot update"] p': { x: 16, y: 11 }, + '[aria-label="OpenBot update"] p': { x: 16, y: 10 }, }, }; const seen: Record>> = {}; diff --git a/app/tests/ui-look-guard.test.ts b/app/tests/ui-look-guard.test.ts index 5f58698d0e..44bee77be4 100644 --- a/app/tests/ui-look-guard.test.ts +++ b/app/tests/ui-look-guard.test.ts @@ -218,9 +218,9 @@ const CLEAN = [ "components/app-sidebar/conversations-panel.tsx", "components/app-sidebar/bots-panel.tsx", "components/app-sidebar/channel.tsx", - // Not channel-item-content.tsx: its time, Working label and preview line keep their 12px, which - // no step on this scale draws (text-xs is 11.25px, text-sm 13.1px). They stay on the allowlist - // with that reason, held by conversation-row-text.test.ts. + // Not channel-item-content.tsx: its time, Working label and preview line keep their 12px, written + // by hand from when no step drew 12px. text-xs is 12px now, so they can move to it and come off + // the allowlist. Until then conversation-row-text.test.ts holds them at 12px. // The message box. "components/channels/composer/composer.tsx", // Home, and a Bot's tile on it and on Bots. diff --git a/desktop/src-tauri/src/first_paint.rs b/desktop/src-tauri/src/first_paint.rs index 9f30e7e8ea..d4ee61764e 100644 --- a/desktop/src-tauri/src/first_paint.rs +++ b/desktop/src-tauri/src/first_paint.rs @@ -95,7 +95,7 @@ page 10px in from the window's top, right and bottom edges (`margin: 10px 10px 1 window). Its heading shares a line with the sidebar's title: under Windows' own title bar the sidebar starts 24px down (`--rail-top`), then the 32px lockup and the 20px gap under it, so 76px (`--head-top`); in a window 640px tall or less 20px, 32px and 12px, so 64px. Then the h1's line -(22.5px at 1.3) and the gap after it (8px), and the lede's line (22px). Rectangles are left, top, +(24px at 1.3) and the gap after it (8px), and the lede's line (22px). Rectangles are left, top, right, bottom. */ #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -133,16 +133,16 @@ pub fn sheet(width: i32, height: i32, scale: f64) -> Sheet { .min(right - px(1.0 + pad)) .max(text_left); let heading_top = px(head_top); - let heading_bottom = heading_top + px(22.5 * 1.3); + let heading_bottom = heading_top + px(24.0 * 1.3); let line_top = heading_bottom + px(8.0); let line_bottom = line_top + px(22.0); Sheet { card: [left, top, right, bottom], radius: px(14.0), heading: [text_left, heading_top, text_right, heading_bottom], - heading_px: px(22.5), + heading_px: px(24.0), line: [text_left, line_top, text_right, line_bottom], - line_px: px(15.0), + line_px: px(16.0), } } @@ -877,8 +877,8 @@ mod tests { "--lockup-gap: 12px;", "--radius: 0.625rem;", "border-radius: calc(var(--radius) * 1.4);", - "--text-2xl: 1.40625rem; /* 22.5px */", - "--text-base: 0.9375rem; /* 15px */", + "--text-2xl: 1.5rem; /* 24px */", + "--text-base: 1rem; /* 16px */", ] { assert!(styles.contains(token), "styles.css no longer has {token}"); } @@ -899,7 +899,7 @@ mod tests { assert_eq!(at.card, [320, 10, 990, 828]); assert_eq!(at.heading[..2], [369, 76]); assert_eq!(at.heading[2], 990 - 49); - assert_eq!((at.heading_px, at.line_px, at.radius), (23, 15, 14)); + assert_eq!((at.heading_px, at.line_px, at.radius), (24, 16, 14)); // A wide window: the 36rem column centred in the page. let wide = sheet(1600, 1000, 1.0); assert_eq!(wide.heading[0], 320 + 1 + (1280 - 12 - 576) / 2); diff --git a/desktop/src/setup-page-first.css b/desktop/src/setup-page-first.css index 1b9d3667f9..afd967f7ec 100644 --- a/desktop/src/setup-page-first.css +++ b/desktop/src/setup-page-first.css @@ -457,9 +457,9 @@ main:has(> .sheet.welcome.page-first) .rail .tile.with-marks > .cloud-marks { gap: 16px; } - /* Room for the full Docker directions: four lines in Figtree at the smallest window, 720x560. */ + /* Room for the full Docker directions: five lines in Figtree at the smallest window, 720x560. */ .update-progress .journey.handing-off .journey-said { - min-height: 4lh; + min-height: 5lh; } .update-progress > .update-data-reassurance { diff --git a/desktop/src/styles.css b/desktop/src/styles.css index 377e817dac..1a1f04365c 100644 --- a/desktop/src/styles.css +++ b/desktop/src/styles.css @@ -5,7 +5,7 @@ * `bun run tokens:generate` rather than approximated, so the * window someone sets up in looks like the product it turns into: Figtree, OpenBot's lavender frame * with a white card on it, its near-black primary button, its periwinkle focus ring, its 10px radius - * and its type scale (on a 15px base, as the app sets text). The app's shadcn names are kept as + * and its type scale (Tailwind's, in whole pixels, as the app's). The app's shadcn names are kept as * written (`--background`, `--card`, `--muted-foreground`, ...) and the names these screens were * first written against are mapped onto them below, so every rule still reads one vocabulary. * @@ -46,13 +46,13 @@ --radius-lg: var(--radius); --radius-xl: calc(var(--radius) * 1.4); - /* OpenBot's type scale: Tailwind's sizes times 15/16 (theme.css `@theme`). */ - --text-xs: 0.703125rem; /* 11.25px */ - --text-sm: 0.8203125rem; /* 13.125px */ - --text-base: 0.9375rem; /* 15px */ - --text-lg: 1.0546875rem; /* 16.875px */ - --text-2xl: 1.40625rem; /* 22.5px */ - --text-3xl: 1.7578125rem; /* 28.125px */ + /* OpenBot's type scale: Tailwind's own, in whole pixels, as the app's (theme.css). */ + --text-xs: 0.75rem; /* 12px */ + --text-sm: 0.875rem; /* 14px */ + --text-base: 1rem; /* 16px */ + --text-lg: 1.125rem; /* 18px */ + --text-2xl: 1.5rem; /* 24px */ + --text-3xl: 1.875rem; /* 30px */ /* Tailwind's shadows, which the app's cards and popovers use. */ --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05); diff --git a/docs/app-guidelines.md b/docs/app-guidelines.md index 038e7e9e7a..f86c3960a2 100644 --- a/docs/app-guidelines.md +++ b/docs/app-guidelines.md @@ -213,11 +213,13 @@ data is already written down, in the skills under `.claude/skills/`: ### The look The web app keeps one look, drawn by the primitives in `app/src/components/ui` and the scheme's -tokens. A screen draws with them and adds no look of its own. Sizes stay: this look changes how -things are drawn, not how big they are. +tokens. A screen draws with them and adds no look of its own. Sizes come from the scales: a +screen takes the step it needs and never sets one of its own. A size changes only when its scale +changes, for every screen at once, in a change agreed first. 1. **Colors.** Only the scheme's tokens, as above. -2. **Type.** Figtree and the type scale in `theme.css`. Controls, rows and navigation are +2. **Type.** Figtree on Tailwind's own type scale, in whole pixels: `text-xs` is 12px, `text-sm` + 14px, `text-base` 16px and a page title's `text-2xl` 24px. Controls, rows and navigation are `text-sm`; labels, times and counts are `text-xs`. No text size written by hand (`text-[13px]`). 3. **Corners.** All from `--radius`, 10px, the design's radius base. Controls are `rounded-md` (8px), cards and the page's panel `rounded-lg` (10px), menus, dialogs and the message box diff --git a/docs/design-system.md b/docs/design-system.md index af7416f38c..ab269a6804 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -101,8 +101,8 @@ changed in `tokens/src/scheme.ts` and written out with `bun run tokens:generate` - **The shared scales keep their meaning.** `rounded-lg`, `text-sm`, `p-4` and `shadow-lg` mean what they mean in Tailwind and shadcn. Corners all come from the one `--radius`: to make the app rounder or sharper, change that one value, as the look did. Don't set `--radius-lg` and its - neighbors to pixel values of your own. The type scale and the spacing grid in `theme.css` are - not redefined to match a design. + neighbors to pixel values of your own. The type scale and the spacing grid are Tailwind's own, + and are not redefined to match a design. - **Names are a contract.** A customer's theme sets tokens by name. A token is never renamed or removed; change its value. @@ -135,8 +135,8 @@ changed in `tokens/src/scheme.ts` and written out with `bun run tokens:generate` icons a screen draws with. What it leaves to this page: - **No pixel value copied from a design** (`w-[91px]`, `h-[43px]`). Use the nearest step of the - scale, never a smaller one. Sizes stay: a new look changes how things are drawn, not how big they - are. + scale, never a smaller one. A look changes how things are drawn. A change of size is a change to + a scale, for every screen at once, agreed first. - **One typeface and one icon set, in every app.** Figtree and Hugeicons' free set today, in the web app, OpenBot Desktop and the extension. Changing either is a change for all three at once, agreed first. It never lands in one app. Figtree covers Latin only: Cyrillic, Greek and other