Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .claude/skills/openbot-screen-layout/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/layout/page-parts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
<div
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/ui/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const itemVariants = cva(
},
/*
* Linear's settings row: 16px in from every edge and 12px between media, text and actions.
* A title over a one-line description comes to 65px, a single line to 48px.
* A title over a one-line description comes to 67px, a single line to 47px.
*/
size: {
default: "gap-3 px-4 py-3.5",
Expand Down
22 changes: 8 additions & 14 deletions app/src/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,19 @@ body {
*/

/*
* Text is sized on a 15px base while everything else is on Tailwind's 16px rem.
* Text is on Tailwind's own type scale, in whole pixels.
*
* The root stays at the browser's 16px so spacing, sizes and radii land on Tailwind's 4px grid
* (`p-4` is 16px, `h-8` is 32px). Only type keeps the scale it had under the old 15px root: each
* size below is Tailwind's default multiplied by 15/16, so `text-sm` is still 13.125px. Line
* heights are Tailwind's own unitless ratios and scale with them. `body` reads `--text-base`, so
* unclassed text is 15px too.
* The root is the browser's 16px, and no `--text-*` step is set here, so each one is Tailwind's
* default: `text-xs` is 12px, `text-sm` 14px, `text-base` 16px, `text-lg` 18px, `text-xl` 20px,
* `text-2xl` 24px, `text-3xl` 30px and `text-4xl` 36px, each with Tailwind's line height. `body`
* reads `text-base`, so unclassed text is 16px. Text was once 15/16 of these, which put every
* step on a fraction of a pixel and made it smaller than the same step in shadcn.
*
* `--text-conversation` is ours: the size a conversation's messages are set in.
*/
@theme inline {
--text-xs: 0.703125rem; /* 11.25px */
--text-sm: 0.8203125rem; /* 13.125px */
--text-base: 0.9375rem; /* 15px */
--text-conversation: 1rem;
--text-conversation--line-height: 1.5;
--text-lg: 1.0546875rem; /* 16.875px */
--text-xl: 1.171875rem; /* 18.75px */
--text-2xl: 1.40625rem; /* 22.5px */
--text-3xl: 1.7578125rem; /* 28.125px */
--text-4xl: 2.109375rem; /* 33.75px */
--font-heading: var(--font-sans);
--font-sans: "Figtree Variable", ui-sans-serif, system-ui, sans-serif;
--color-sidebar-ring: var(--sidebar-ring);
Expand Down
5 changes: 3 additions & 2 deletions app/tests/artifacts-kit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,9 @@ describe("the artifacts kit", () => {
// 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\);/,
Expand Down
2 changes: 1 addition & 1 deletion app/tests/connect-your-ai.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions app/tests/conversation-row-text.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 5 additions & 2 deletions app/tests/skins-window-buttons.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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<string, Awaited<ReturnType<typeof corner>>> = {};
Expand Down
6 changes: 3 additions & 3 deletions app/tests/ui-look-guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions desktop/src-tauri/src/first_paint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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}");
}
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions desktop/src/setup-page-first.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions desktop/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions docs/app-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/design-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
Loading