Spacing on the scale, and the door's card a stack
Paul, 2026-11-22, on the spacing survey: "Release and start the rollout". Estilo goes first, because every app's door and chrome inherit it. Fiesta 1.6.0 holds the scale's stack and gates. - The door's card is a stack, in estilo's own rules (an app's tokens.css may predate Fiesta's rst-stack): children's block margins go, and the space above each follows the table: after a heading --rst-sp-2; an actions row (a button, the card's action or a paragraph holding it, Forget) --rst-sp-4, or --rst-sp-2 under another; an input after its label --rst-sp-2; an h1 or h2, or anything after the brand, --rst-sp-5 (brand to heading was 22px); an h3 to h6 --rst-sp-4; else --rst-sp-3. Each relation sets its own property, read in the table's order. Pictures, buttons and direct action links keep their width. Card padding --rst-sp-6 (was 34/40/32px), --rst-sp-5 under 520px (was 26/22/24); the door's phone insets 16/24px (were 14/28); the brand's gap 8px (was 10); the smart door's heading loses an unexplained 2px. - chrome, menu, side, desk, callui, brand and credits CSS: every margin, padding and gap is a var(--rst-sp-N): 64 declarations converted (31 of them a step's value typed by hand). Ten stay off the scale, each with a spacing-allow naming the geometry: the door's full-bleed and its 9vh top, the title field's padding-and-border pull, the menubar title's 2px overhang, the side's 1px row hairlines (three), the rail tooltip's 50px/19px placement (four). - make test-spacing (CI step 50-spacing) runs Fiesta's spacing check via go run .../cmd/fiesta@v1.6.0, never a go.mod requirement: estilo is in every app's module graph and must not move their Fiesta. - chrome/rhythm_browser_test.go runs Fiesta's rhythm audit (testdata/rhythm.js, byte for byte v1.6.0's) over every door page and an app's own card in Chromium and WebKit at 1440 and 390px, and asserts the table's gaps and the widths; clean, where main's door reports 22px and 14px off-scale gaps. - Design guards moved deliberately: chrome.css's main-rules hash and menu.css's, desk's 12px pin, the door's pill and heading strings. AGENTS.md records the spacing standard. Review: GPT-6 Astra (Fable at its weekly limit), two rounds: APPROVE AFTER FIXES at f2d50d0 (three medium: the table only partly applied, stretched pictures and buttons, the smart door's 2px and test), then APPROVE at 36de00c. Two Lows left as follow-ups: a direct hint or section in an app's card gets 12px (no estilo hook names them), and a [hidden] sibling after a heading turns its 8px into 12px. Hub CI green at 36de00c; make test and make test-browser green locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from feat/stack-rhythm into main.
17 files changed,
+812
−89
.amadan/ci.d/50-spacing+8 −0AGENTS.md+9 −0Makefile+13 −2brand/brand.css+1 −1callui/callui.css+1 −1chrome/chrome.css+92 −49chrome/rhythm.browser.mjs+57 −0chrome/rhythm_browser_test.go+236 −0chrome/screen_test.go+2 −2chrome/stack_test.go+1 −1chrome/testdata/rhythm.js+352 −0chrome/unchanged_test.go+9 −3credits/credits.css+2 −2desk/desk.css+3 −3desk/desk_test.go+2 −1menu/menu.css+8 −8side/side.css+16 −16
CI passed — run details
CI log
=== modcache === all modules verified === vet === CGO_ENABLED=0 go vet ./... CGO_ENABLED=0 go vet -tags browser ./... === fmt === === build === CGO_ENABLED=0 go build -buildvcs=false ./... === go-test === CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/estilo.git/base 0.005s ok amadan.net/oficina/estilo.git/brand 0.003s ok amadan.net/oficina/estilo.git/busy 0.010s ok amadan.net/oficina/estilo.git/callui 0.010s ok amadan.net/oficina/estilo.git/chrome 1.017s ? amadan.net/oficina/estilo.git/cmd/oficina-notices [no test files] ok amadan.net/oficina/estilo.git/colophon 0.022s ok amadan.net/oficina/estilo.git/credits 0.006s ok amadan.net/oficina/estilo.git/credits/catalog 0.010s ok amadan.net/oficina/estilo.git/desk 0.005s ok amadan.net/oficina/estilo.git/googleimport 0.187s ok amadan.net/oficina/estilo.git/homeconnect 0.006s ok amadan.net/oficina/estilo.git/internal/lint 0.006s ? amadan.net/oficina/estilo.git/internal/tokencheck [no test files] ok amadan.net/oficina/estilo.git/menu 0.011s ok amadan.net/oficina/estilo.git/savestatus 0.110s ok amadan.net/oficina/estilo.git/side 0.140s ok amadan.net/oficina/estilo.git/sky 0.034s ok amadan.net/oficina/estilo.git/theme 0.013s === spacing === go run amadan.net/rastrillo/fiesta/cmd/fiesta@v1.6.0 spacing . go: downloading amadan.net/rastrillo/fiesta v1.6.0 go: downloading golang.org/x/text v0.41.0 go: downloading golang.org/x/net v0.58.0
diff --git a/.amadan/ci.d/50-spacing b/.amadan/ci.d/50-spacing| new file mode 100755 |
| index 0000000..680369b |
| --- /dev/null |
| +++ b/.amadan/ci.d/50-spacing |
| @@ -0,0 +1,8 @@ |
| +#!/bin/sh |
| +# One step of estilo's CI. It runs a Makefile target rather than its own |
| +# copy of the commands, so CI and the local gate stay ONE definition: |
| +# `make test` runs these same targets in this same order, and |
| +# `make test-spacing` is exactly what CI runs here. Debugging CI is |
| +# running it. |
| +set -eu |
| +exec make test-spacing |
diff --git a/AGENTS.md b/AGENTS.md| index b6e89fd..d3f6e27 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -287,6 +287,15 @@ Inherited from rastrillo's gates, and not negotiable downward: |
| - **Contrast arithmetic copied verbatim** from `ui/contrast_test.go`, never |
| reimplemented — two gates disagreeing by a rounding decision is a gate |
| that certifies the wrong thing while passing. |
| +- **Spacing on the scale** (Paul, 2026-11-22: "The spacing is all over |
| + the place here... Can we somehow put something in place"). Every |
| + margin, padding and gap is `var(--rst-sp-1)` to `var(--rst-sp-6)`, or |
| + says why not in a `/* spacing-allow: why */` comment beside it: |
| + geometry, never a preference. `make test-spacing` (Fiesta's spacing |
| + check, run with `go run` at a version so estilo never requires Fiesta) |
| + is a CI step. Blocks follow Fiesta's stack table (its DESIGN.md, "The |
| + stack"), written in estilo's own rules, because an app's `tokens.css` |
| + may predate `rst-stack`: the door's card is one. |
| --- |
diff --git a/Makefile b/Makefile| index 327653a..945ee8d 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -1,4 +1,4 @@ |
| -.PHONY: build test test-modcache test-vet test-fmt test-build test-go test-browser |
| +.PHONY: build test test-modcache test-vet test-fmt test-build test-go test-spacing test-browser |
| # CGO_ENABLED=0 for the same reason sheets-core sets it: nothing here |
| # should grow a cgo dependency by accident. estilo has no cgo-driven |
| @@ -18,7 +18,7 @@ build: |
| # and the theme's gates (token set, contrast, accent goldens) — runs last. |
| # test-modcache goes first: nothing after it means anything if the |
| # dependencies on disk are not the ones go.sum names. |
| -test: test-modcache test-vet test-fmt test-build test-go |
| +test: test-modcache test-vet test-fmt test-build test-go test-spacing |
| # Checks the module cache holds exactly what go.sum names, and re-fetches |
| # any module Go reports as modified: it removes the exact directory or zip |
| @@ -69,6 +69,17 @@ test-build: |
| test-go: |
| CGO_ENABLED=0 go test -count=1 ./... |
| +# Every margin, padding and gap in estilo's stylesheets is a step of the |
| +# spacing scale, var(--rst-sp-1) to var(--rst-sp-6), or says why it is |
| +# not in a /* spacing-allow: why */ comment beside it: Fiesta's spacing |
| +# check (DESIGN.md, "Checking the rhythm"). go run with a version, not a |
| +# require or a tool directive: estilo is imported by every app, and a |
| +# Fiesta requirement here would join their module graphs and move the |
| +# Fiesta their rastrillo was built against. |
| +FIESTA_VERSION := v1.6.0 |
| +test-spacing: |
| + go run amadan.net/rastrillo/fiesta/cmd/fiesta@$(FIESTA_VERSION) spacing . |
| + |
| # The browser checks: not part of `make test` (and so not CI), because |
| # they need Node 22+ and Playwright with its browsers (ESTILO_PLAYWRIGHT |
| # for the package's directory if it is not resolvable from theme/; |
diff --git a/brand/brand.css b/brand/brand.css| index 27e25ad..475fb08 100644 |
| --- a/brand/brand.css |
| +++ b/brand/brand.css |
| @@ -3,7 +3,7 @@ |
| [estilo-brand] { |
| display: inline-flex; |
| align-items: center; |
| - gap: .5rem; |
| + gap: var(--rst-sp-2); |
| min-block-size: 24px; |
| } |
| [estilo-brand-icon] { |
diff --git a/callui/callui.css b/callui/callui.css| index 86e3a29..61952c7 100644 |
| --- a/callui/callui.css |
| +++ b/callui/callui.css |
| @@ -41,7 +41,7 @@ |
| } |
| [estilo-call-segmented] { |
| display: flex; |
| - padding: 3px; |
| + padding: var(--rst-sp-1); |
| border: 1px solid var(--rst-line); |
| border-radius: 12px; |
| background: var(--rst-surface-2); |
diff --git a/chrome/chrome.css b/chrome/chrome.css| index 83a482f..3f6b956 100644 |
| --- a/chrome/chrome.css |
| +++ b/chrome/chrome.css |
| @@ -25,7 +25,7 @@ |
| [estilo-bar-brand] { |
| display: inline-flex; |
| align-items: center; |
| - gap: 0.5rem; |
| + gap: var(--rst-sp-2); |
| flex: none; |
| color: var(--rst-text); |
| font-weight: 650; |
| @@ -63,11 +63,11 @@ |
| display: inline-flex; |
| align-items: center; |
| justify-content: center; |
| - gap: 0.3rem; |
| + gap: var(--rst-sp-1); |
| box-sizing: border-box; |
| min-inline-size: var(--estilo-trigger-size); |
| block-size: var(--estilo-trigger-size); |
| - padding-inline: 0.4rem; |
| + padding-inline: var(--rst-sp-2); |
| border-radius: 0; /* in-flow: square */ |
| color: var(--rst-text-muted); |
| font-size: var(--rst-fs-sm); |
| @@ -124,7 +124,7 @@ |
| block-size: 2rem; |
| inline-size: 100%; |
| min-inline-size: 6rem; |
| - padding-inline: 0.4rem; |
| + padding-inline: var(--rst-sp-2); |
| border: 1px solid transparent; |
| border-radius: var(--rst-radius-sm); |
| background: transparent; |
| @@ -168,13 +168,13 @@ |
| /* The app switcher: a float, so its tiles may be rounded. */ |
| [estilo-switcher] { position: relative; } |
| [estilo-switcher-panel] { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 4px); } |
| -[estilo-switcher-grid] { display: grid; grid-template-columns: repeat(3, 5.5rem); gap: 0.25rem; } |
| +[estilo-switcher-grid] { display: grid; grid-template-columns: repeat(3, 5.5rem); gap: var(--rst-sp-1); } |
| [estilo-switcher-app] { |
| display: flex; |
| flex-direction: column; |
| align-items: center; |
| - gap: 0.35rem; |
| - padding: 0.6rem 0.25rem; |
| + gap: var(--rst-sp-1); |
| + padding: var(--rst-sp-2) var(--rst-sp-1); |
| border-radius: var(--rst-radius-sm); /* inside a float: rounded is allowed */ |
| color: var(--rst-text); |
| font-size: var(--rst-fs-xs); |
| @@ -210,7 +210,7 @@ |
| font-size: var(--rst-fs-xs); |
| font-weight: 650; |
| } |
| -[estilo-menu-identity] { display: grid; gap: 0.1rem; padding: 0.5rem var(--estilo-item-padding-inline, 0.65rem); } |
| +[estilo-menu-identity] { display: grid; gap: 0; padding: var(--rst-sp-2) var(--estilo-item-padding-inline, var(--rst-sp-3)); } |
| [estilo-menu-identity-label] { color: var(--rst-text-muted); font-size: var(--rst-fs-xs); } |
| [estilo-menu-identity-name] { font-weight: 600; overflow-wrap: anywhere; } |
| [estilo-menu-identity-address] { color: var(--rst-text-muted); overflow-wrap: anywhere; } |
| @@ -258,8 +258,8 @@ |
| :root:has([estilo-door]) { overflow-x: clip; --rst-scrollbar-gutter: auto; scrollbar-gutter: auto; } |
| [estilo-door] { |
| box-sizing: border-box; |
| - margin-inline: calc(50% - 50vw); |
| - padding: max(40px, 9vh) var(--rst-sp-4) var(--rst-sp-6); |
| + margin-inline: calc(50% - 50vw); /* spacing-allow: full-bleed, the door spans the viewport whatever column it sits in */ |
| + padding: max(var(--rst-sp-6), 9vh) var(--rst-sp-4) var(--rst-sp-6); /* spacing-allow: the card sits lower on a taller window, 9vh down */ |
| min-block-size: 680px; |
| /* The whole sky lies inside the door, fading in and out, so the door's |
| edges never cut it: under an app's bar there is no page top to hide |
| @@ -270,25 +270,69 @@ |
| --estilo-sky-top: 67px; |
| --estilo-sky-height: 560px; |
| } |
| +/* The card is a stack: its children's own block margins go, and the |
| + space above each comes from the table Fiesta's rst-stack uses |
| + (DESIGN.md, "The stack"), written here in estilo's own names because |
| + an app's tokens.css may predate it: |
| + |
| + after a heading (h1 to h6) --rst-sp-2 |
| + an actions row: a button, the card's |
| + action or a paragraph holding it, |
| + Forget (under another action: |
| + --rst-sp-2) --rst-sp-4 |
| + an input after its label --rst-sp-2 |
| + an h1 or h2, or anything after the brand, |
| + which heads the card as a page header |
| + heads a page --rst-sp-5 |
| + an h3 to h6 --rst-sp-4 |
| + anything else --rst-sp-3 |
| + |
| + Higher in the table wins: each relation sets its own property on the |
| + child, and the one margin rule reads them in the table's order, so |
| + specificity never decides it; every child resets them first, so |
| + content nested in the card never inherits an answer. A column, so |
| + nothing collapses; a button or a picture keeps its own width. */ |
| [estilo-signin] { |
| box-sizing: border-box; |
| + display: flex; |
| + flex-direction: column; |
| max-inline-size: 460px; |
| margin: 0 auto; |
| - padding: 34px 40px 32px; |
| + padding: var(--rst-sp-6); |
| background: var(--rst-surface); |
| border-radius: 20px; |
| box-shadow: 0 0 0 1px light-dark(transparent, var(--rst-line)), var(--rst-shadow-lift); |
| } |
| -[estilo-signin] > [estilo-brand] { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; } |
| +[estilo-signin] > * { |
| + --estilo-stack-heading: initial; |
| + --estilo-stack-actions: initial; |
| + --estilo-stack-control: initial; |
| + --estilo-stack-section: initial; |
| + --estilo-stack-sub: initial; |
| + margin-block: 0; |
| +} |
| +[estilo-signin] > * + * { |
| + margin-block-start: var(--estilo-stack-heading, var(--estilo-stack-actions, var(--estilo-stack-control, var(--estilo-stack-section, var(--estilo-stack-sub, var(--rst-sp-3)))))); |
| +} |
| +[estilo-signin] > :is(img, button, a[estilo-signin-action]) { align-self: flex-start; } |
| +[estilo-signin] > * + :is(h3, h4, h5, h6) { --estilo-stack-sub: var(--rst-sp-4); } |
| +[estilo-signin] > * + :is(h1, h2), |
| +[estilo-signin] > [estilo-brand] + * { --estilo-stack-section: var(--rst-sp-5); } |
| +[estilo-signin] > label + :is(input, select, textarea) { --estilo-stack-control: var(--rst-sp-2); } |
| +[estilo-signin] > * + :is(button, [estilo-signin-action], [estilo-signin-forget], p:has(> [estilo-signin-action]), p:has(> button)) { --estilo-stack-actions: var(--rst-sp-4); } |
| +[estilo-signin] > :is(button, [estilo-signin-action], [estilo-signin-forget], p:has(> [estilo-signin-action]), p:has(> button)) + :is(button, [estilo-signin-action], [estilo-signin-forget], p:has(> [estilo-signin-action]), p:has(> button)) { --estilo-stack-actions: var(--rst-sp-2); } |
| +[estilo-signin] > :is(h1, h2, h3, h4, h5, h6) + * { --estilo-stack-heading: var(--rst-sp-2); } |
| +[estilo-signin] > [estilo-brand] { display: flex; align-items: center; gap: var(--rst-sp-2); font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; } |
| [estilo-signin] > [estilo-brand] [estilo-brand-icon] { inline-size: 36px; block-size: 36px; } |
| -[estilo-signin] h1 { margin: 0; font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; } |
| -[estilo-signin-lede] { margin: 0.5rem 0 var(--rst-sp-4); color: var(--rst-text-muted); } |
| -[estilo-signin] > h1 + :not([estilo-signin-lede]) { margin-block-start: var(--rst-sp-4); } |
| -[estilo-signin-form] { max-inline-size: none; margin-block-start: var(--rst-sp-4); } |
| -[estilo-signin-body] { margin: var(--rst-sp-4) 0; } |
| +[estilo-signin] h1 { font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; } |
| +/* A heading the card holds directly is spaced by the stack above; one |
| + nested deeper brings no margin of its own. */ |
| +[estilo-signin] * h1 { margin: 0; } |
| +[estilo-signin-lede] { color: var(--rst-text-muted); } |
| +[estilo-signin-form] { max-inline-size: none; } |
| @media (max-width: 520px) { |
| - [estilo-door] { padding-inline: 14px; padding-block-start: 28px; } |
| - [estilo-signin] { padding: 26px 22px 24px; } |
| + [estilo-door] { padding-inline: var(--rst-sp-4); padding-block-start: var(--rst-sp-5); } |
| + [estilo-signin] { padding: var(--rst-sp-5); } |
| } |
| /* The door's links are drawn here, not left to the app: an app that does |
| not link base.css (Calendar, Memoria, Calls, Fichas) showed the browser's |
| @@ -313,7 +357,7 @@ |
| stylesheets are linked in never decides it. */ |
| [estilo-signin-screen] > section { display: block; inline-size: auto; max-inline-size: none; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; } |
| [estilo-signin-screen] > section > :first-child:not(:only-child):not(:has(h1)) { display: none; } |
| -[estilo-signin] [estilo-signin-screen] h1 { margin: 0 0 2px; font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; } |
| +[estilo-signin] [estilo-signin-screen] h1 { margin: 0; font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; } |
| /* The door's buttons are the smart door's (Paul, 2026-11-21, "yes to pill |
| buttons"), on every card the door draws. The card's main action is a |
| full-width pill, 44px tall, lit from above, its shadow tinted by its |
| @@ -335,7 +379,7 @@ |
| rules give it the door's shape. A hidden button stays hidden. */ |
| [estilo-signin] :is([estilo-signin-form] [type="submit"], [estilo-signin-action]:not([estilo-signin-action~="quiet"])):not([hidden]) { |
| display: flex; inline-size: 100%; box-sizing: border-box; justify-content: center; align-items: center; |
| - min-block-size: 44px; padding-inline: 18px; border-radius: 999px; font-weight: 600; text-decoration: none; |
| + min-block-size: 44px; padding-inline: var(--rst-sp-4); border-radius: 999px; font-weight: 600; text-decoration: none; |
| } |
| /* The glow lifts the pill only at rest: pressed, rastrillo's own pressed |
| shadow draws it sinking. */ |
| @@ -346,10 +390,9 @@ |
| [estilo-signin] [estilo-signin-action~="danger"] { |
| --estilo-signin-glow: light-dark(color-mix(in srgb, var(--rst-danger-fill, var(--rst-tone-negative-fg)) 60%, transparent), color-mix(in srgb, var(--rst-danger-fill, var(--rst-tone-negative-fg)) 30%, transparent)); |
| } |
| -[estilo-signin-forget] { margin: var(--rst-sp-2) 0 0; } |
| [estilo-signin] :is([estilo-signin-action~="quiet"], [estilo-signin-forget] > button):not([hidden]) { |
| display: flex; inline-size: fit-content; margin-inline: auto; justify-content: center; align-items: center; |
| - min-block-size: 2.5rem; padding: 0 0.875rem; border-color: transparent; border-radius: 999px; background: transparent; box-shadow: none; |
| + min-block-size: 2.5rem; padding: 0 var(--rst-sp-3); border-color: transparent; border-radius: 999px; background: transparent; box-shadow: none; |
| color: var(--rst-text-muted); font-size: calc(var(--rst-fs-base) * 0.9375); font-weight: 500; text-decoration: none; |
| } |
| /* On touch, and on a narrow screen, a quiet control is a full tap target, |
| @@ -435,7 +478,7 @@ |
| grid-area: menus; |
| align-self: stretch; |
| min-inline-size: 0; |
| - margin-inline: calc(var(--rst-sp-3) - var(--rst-sp-4)); /* the menus' edge 12px in, as Docs' own row had it */ |
| + margin-inline: calc(-1 * var(--rst-sp-1)); /* the menus' edge 12px in (the bar's 16px less 4px), as Docs' own row had it */ |
| } |
| } |
| @@ -449,7 +492,7 @@ |
| 1px above that edge. */ |
| @media (min-width: 800px) { |
| :root:has([estilo-bar~="stacked"]) { --estilo-bar-block-size: 56px; } /* PUBLIC */ |
| - [estilo-bar~="stacked"] { gap: 12px; padding-inline: 12px; } |
| + [estilo-bar~="stacked"] { gap: var(--rst-sp-3); padding-inline: var(--rst-sp-3); } |
| [estilo-bar~="stacked"] [estilo-bar-brand] img { inline-size: 32px; block-size: 32px; } |
| [estilo-bar~="stacked"] [estilo-bar-name] { display: none; } |
| [estilo-bar-stack] { |
| @@ -472,8 +515,8 @@ |
| [estilo-bar~="stacked"] [estilo-bar-title-input] { |
| block-size: 24px; |
| padding-block: 0; |
| - margin-inline-start: calc(-0.4rem - 1px); /* the field's padding and border pulled back: the text sits on the edge */ |
| - max-inline-size: calc(100% + 0.4rem + 1px); /* the form is that much narrower than the field: the cap gives it back */ |
| + margin-inline-start: calc(-1 * var(--rst-sp-2) - 1px); /* spacing-allow: the field's padding and 1px border pulled back, so its text sits on the edge */ |
| + max-inline-size: calc(100% + var(--rst-sp-2) + 1px); /* the form is that much narrower than the field: the cap gives it back */ |
| font-size: 16px; |
| line-height: 24px; |
| font-weight: 600; |
| @@ -501,7 +544,7 @@ |
| min-block-size: 0; |
| min-inline-size: 0; |
| margin: 0; |
| - padding: 0 10px; |
| + padding: 0 var(--rst-sp-2); |
| border: 1px solid transparent; |
| border-radius: 999px; |
| background-color: var(--rst-accent-soft); |
| @@ -524,16 +567,16 @@ |
| position: relative; |
| inset-block-start: 1px; |
| block-size: 20px; |
| - max-inline-size: calc(100% + 7px); |
| - margin-inline-start: -7px; /* the titles' padding pulled back: the first title's text sits on the edge */ |
| + max-inline-size: calc(100% + var(--rst-sp-2)); |
| + margin-inline-start: calc(-1 * var(--rst-sp-2)); /* the titles' padding pulled back: the first title's text sits on the edge */ |
| } |
| [estilo-bar~="stacked"] [estilo-menubar] { block-size: 20px; min-block-size: 0; align-items: center; flex-wrap: nowrap; } |
| [estilo-bar~="stacked"] [estilo-menubar-menu] { block-size: 20px; } |
| [estilo-bar~="stacked"] [estilo-menubar-title] { |
| block-size: 24px; |
| min-block-size: 0; |
| - margin-block: -2px; |
| - padding-inline: 7px; |
| + margin-block: -2px; /* spacing-allow: the 24px highlight overhangs the 20px row by 2px each way and takes no room */ |
| + padding-inline: var(--rst-sp-2); |
| border-radius: 6px; |
| color: var(--rst-text-muted); |
| font-size: 13px; |
| @@ -546,14 +589,14 @@ |
| /* Every panel in the stacked header matches it: 28px rows, 13px type, |
| shortcuts muted, 4px padding and a 10px radius. */ |
| [estilo-bar~="stacked"] [estilo-menu] { |
| - --estilo-float-padding: 4px; |
| - --estilo-item-padding-block: 4px; |
| - --estilo-item-padding-inline: 10px; |
| + --estilo-float-padding: var(--rst-sp-1); |
| + --estilo-item-padding-block: var(--rst-sp-1); |
| + --estilo-item-padding-inline: var(--rst-sp-3); |
| border-radius: 10px; |
| font-size: 13px; |
| } |
| [estilo-bar~="stacked"] [estilo-menu-item] { min-block-size: 28px; border-radius: 6px; } |
| - [estilo-bar~="stacked"] [estilo-menu] hr { margin-block: 4px; } |
| + [estilo-bar~="stacked"] [estilo-menu] hr { margin-block: var(--rst-sp-1); } |
| [estilo-bar~="stacked"] [estilo-menu-key] { color: var(--rst-text-muted); font-size: 12px; } |
| /* The controls set, in a bar with a slot: every action a 28px pill, |
| @@ -562,16 +605,16 @@ |
| the person's. Lit from above as the index's New document is, and far |
| fainter in dark. */ |
| :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end], |
| - :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-actions] { gap: 8px; } |
| + :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-actions] { gap: var(--rst-sp-2); } |
| :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button) { |
| display: inline-flex; |
| align-items: center; |
| - gap: 6px; |
| + gap: var(--rst-sp-2); |
| box-sizing: border-box; |
| block-size: 28px; |
| min-block-size: 28px; |
| min-inline-size: 28px; |
| - padding: 0 12px; |
| + padding: 0 var(--rst-sp-3); |
| border: 0; |
| border-radius: 999px; |
| background-color: transparent; |
| @@ -597,7 +640,7 @@ |
| and a shadow tinted with its own accent, 0 5px 12px -5px. */ |
| :is([estilo-bar-control~="primary"] > a, [estilo-bar-control~="primary"] > button, [estilo-bar-control~="primary"] > form > button), |
| :is([estilo-bar-control~="primary"] > a, [estilo-bar-control~="primary"] > button, [estilo-bar-control~="primary"] > form > button):hover:not(:disabled) { |
| - padding-inline: 14px; |
| + padding-inline: var(--rst-sp-4); |
| background-color: var(--rst-accent); |
| color: var(--rst-on-accent); |
| box-shadow: |
| @@ -646,8 +689,8 @@ |
| lead. Below 64rem a WideOnly action is hidden, so it does not count |
| there. */ |
| :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-lead], > [estilo-bar-actions] > :not([estilo-bar-control~="wide"])) > [estilo-account] { |
| - margin-inline-start: 4px; |
| - padding-inline-start: 12px; |
| + margin-inline-start: var(--rst-sp-1); |
| + padding-inline-start: var(--rst-sp-3); |
| background: linear-gradient(var(--rst-line), var(--rst-line)) left center / 1px 20px no-repeat; |
| } |
| :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-lead], > [estilo-bar-actions] > :not([estilo-bar-control~="wide"])) > [estilo-account]:dir(rtl) { |
| @@ -696,8 +739,8 @@ |
| } |
| @media (min-width: 64rem) { |
| :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-actions]) > [estilo-account] { |
| - margin-inline-start: 4px; |
| - padding-inline-start: 12px; |
| + margin-inline-start: var(--rst-sp-1); |
| + padding-inline-start: var(--rst-sp-3); |
| background: linear-gradient(var(--rst-line), var(--rst-line)) left center / 1px 20px no-repeat; |
| } |
| :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-actions]) > [estilo-account]:dir(rtl) { |
| @@ -729,9 +772,9 @@ |
| [estilo-appearance] { |
| display: grid; |
| grid-template-columns: repeat(3, minmax(0, 1fr)); |
| - gap: 2px; |
| - margin: 2px 6px 6px; |
| - padding: 3px; |
| + gap: var(--rst-sp-1); |
| + margin: var(--rst-sp-1) var(--rst-sp-2) var(--rst-sp-2); |
| + padding: var(--rst-sp-1); |
| border-radius: 10px; |
| background: var(--rst-surface-2); |
| box-shadow: inset 0 1px 2px light-dark(rgb(23 32 60 / 0.06), rgb(0 0 0 / 0.25)); |
| @@ -739,9 +782,9 @@ |
| [estilo-appearance] [estilo-menu-item] { |
| flex-direction: column; |
| justify-content: center; |
| - gap: 4px; |
| + gap: var(--rst-sp-1); |
| min-block-size: 46px; |
| - padding: 6px 4px; |
| + padding: var(--rst-sp-2) var(--rst-sp-1); |
| border-radius: 8px; |
| background: none; |
| color: var(--rst-text-muted); |
diff --git a/chrome/rhythm.browser.mjs b/chrome/rhythm.browser.mjs| new file mode 100644 |
| index 0000000..9c15656 |
| --- /dev/null |
| +++ b/chrome/rhythm.browser.mjs |
| @@ -0,0 +1,57 @@ |
| +// rhythm.browser.mjs: open each door page, in each engine and viewport, |
| +// and run Fiesta's rhythm audit (testdata/rhythm.js) over the card. |
| +// Driven by rhythm_browser_test.go (go test -tags browser ./chrome), |
| +// which serves the pages and makes every assertion; this file only |
| +// drives the browsers and reports what the audit found. |
| +// |
| +// ESTILO_PLAYWRIGHT=<path to the playwright package> \ |
| +// node rhythm.browser.mjs <job JSON> |
| +// |
| +// Job: {origin, engines, viewports, pages, root, script, sizes, gaps, |
| +// shots}. Output: one entry per engine, {engine, version, error, pages: |
| +// [{page, viewport, findings, sizes, gaps}]}: sizes is each selector's |
| +// [width, height] and gaps the space above it from its previous |
| +// sibling, or null where the page has no such element. With shots set to a directory, each page is |
| +// also saved there as <engine>-<viewport>-<page>.png. |
| +import { createRequire } from 'node:module' |
| + |
| +const require = createRequire(import.meta.url) |
| +const pw = require(process.env.ESTILO_PLAYWRIGHT || 'playwright') |
| +const job = JSON.parse(process.argv[2]) |
| + |
| +const results = [] |
| +for (const engine of job.engines) { |
| + const result = { engine, version: '', error: '', pages: [] } |
| + let browser |
| + try { |
| + browser = await pw[engine].launch() |
| + result.version = browser.version() |
| + for (const viewport of job.viewports) { |
| + const page = await browser.newPage({ viewport: { width: viewport, height: 900 }, colorScheme: 'light' }) |
| + for (const name of job.pages) { |
| + await page.goto(job.origin + '/' + name) |
| + await page.evaluate(() => document.fonts.ready) |
| + const findings = await page.evaluate(([script, root]) => (0, eval)(script)(root, {}), [job.script, job.root]) |
| + const sizes = await page.evaluate((sels) => Object.fromEntries(sels.map((s) => { |
| + const el = document.querySelector(s) |
| + const r = el ? el.getBoundingClientRect() : null |
| + return [s, r ? [r.width, r.height] : null] |
| + })), job.sizes || []) |
| + const gaps = await page.evaluate((sels) => Object.fromEntries(sels.map((s) => { |
| + const el = document.querySelector(s) |
| + const prev = el && el.previousElementSibling |
| + return [s, prev ? el.getBoundingClientRect().top - prev.getBoundingClientRect().bottom : null] |
| + })), job.gaps || []) |
| + result.pages.push({ page: name, viewport, findings, sizes, gaps }) |
| + if (job.shots) await page.screenshot({ path: `${job.shots}/${engine}-${viewport}-${name}.png`, fullPage: true }) |
| + } |
| + await page.close() |
| + } |
| + } catch (err) { |
| + result.error = String(err && err.stack || err) |
| + } finally { |
| + if (browser) await browser.close() |
| + } |
| + results.push(result) |
| +} |
| +process.stdout.write(JSON.stringify(results)) |
diff --git a/chrome/rhythm_browser_test.go b/chrome/rhythm_browser_test.go| new file mode 100644 |
| index 0000000..0892776 |
| --- /dev/null |
| +++ b/chrome/rhythm_browser_test.go |
| @@ -0,0 +1,236 @@ |
| +//go:build browser |
| + |
| +// The door's rhythm, measured: Fiesta's rhythm audit (its check/rhythm, |
| +// v1.6.0, copied into testdata/rhythm.js because estilo does not require |
| +// Fiesta; see the Makefile's test-spacing) over the card of every door |
| +// page, in real engines, on a desktop and a phone. It reports two blocks |
| +// whose gap is not a step of the spacing scale, text and a control less |
| +// than --rst-sp-2 apart, and a heading no closer to its content than to |
| +// what comes before it. Not part of `make test`: it needs Node 22+ and |
| +// Playwright (ESTILO_PLAYWRIGHT, ESTILO_BROWSERS as for the title check). |
| +// ESTILO_SHOTS=<dir> saves each page there to look at. |
| +package chrome |
| + |
| +import ( |
| + "bytes" |
| + "encoding/json" |
| + "fmt" |
| + "net/http" |
| + "net/http/httptest" |
| + "os" |
| + "os/exec" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/estilo.git/base" |
| + "amadan.net/oficina/estilo.git/theme" |
| + "github.com/carlosframework/rastrillo/ui" |
| +) |
| + |
| +const doorPage = `<!doctype html> |
| +<html lang="en"> |
| +<head> |
| +<meta charset="utf-8"> |
| +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| +<link rel="stylesheet" href="/tokens.css"> |
| +<link rel="stylesheet" href="/theme.css"> |
| +<link rel="stylesheet" href="/base.css"> |
| +<link rel="stylesheet" href="/brand.css"> |
| +<link rel="stylesheet" href="/chrome.css"> |
| +</head> |
| +<body> |
| +<main id="main" rst-page> |
| +%s |
| +</main> |
| +</body> |
| +</html> |
| +` |
| + |
| +type doorRhythm struct { |
| + Engine string `json:"engine"` |
| + Version string `json:"version"` |
| + Error string `json:"error"` |
| + Pages []struct { |
| + Page string `json:"page"` |
| + Viewport int `json:"viewport"` |
| + Sizes map[string][]float64 `json:"sizes"` |
| + Gaps map[string]*float64 `json:"gaps"` |
| + Findings []struct { |
| + Kind string `json:"kind"` |
| + Gap float64 `json:"gap"` |
| + Before string `json:"before"` |
| + After string `json:"after"` |
| + Message string `json:"message"` |
| + } `json:"findings"` |
| + } `json:"pages"` |
| +} |
| + |
| +func openCard(t *testing.T) string { |
| + t.Helper() |
| + open := render(t, "estilo-door-open", SignIn{Icon: "/i.svg", App: "Calendar"}) |
| + body := ` |
| + <h1 id="g-h1">Join your team</h1> |
| + <p id="g-lede">Calendar keeps your team's schedule in one place.</p> |
| + <h2 id="g-h2">Your details</h2> |
| + <label id="g-label" for="door-name">Your name</label> |
| + <input id="g-input" type="text"> |
| + <p id="g-hint">Shown to your team.</p> |
| + <h3 id="g-h3">Notifications</h3> |
| + <img id="door-img" src="/dot.svg" alt=""> |
| + <p id="g-after-img">We'll email you when someone invites you.</p> |
| + <button id="door-button" type="button">Join</button>` |
| + return open + body + render(t, "estilo-door-close", nil) |
| +} |
| + |
| +// openGaps is the table, in the open card: the space above each block, |
| +// in CSS pixels at a 16px root. |
| +var openGaps = map[string]float64{ |
| + "#g-h1": 24, // after the brand |
| + "#g-lede": 8, // after a heading |
| + "#g-h2": 24, // before an h2 |
| + "#g-label": 8, // after a heading |
| + "#g-input": 8, // an input after its label |
| + "#g-hint": 12, // anything else |
| + "#g-h3": 16, // before an h3 |
| + "#door-img": 8, // after a heading |
| + "#g-after-img": 12, // anything else |
| + "#door-button": 16, // before a button |
| +} |
| + |
| +func openGapNames() []string { |
| + var names []string |
| + for id := range openGaps { |
| + names = append(names, id) |
| + } |
| + return names |
| +} |
| + |
| +// doorPages is every page the door draws, with the states that change |
| +// what the card holds (a lede, an error, the notices), and an app's own |
| +// card drawn through estilo-door-open, holding every relation of the |
| +// table, a picture and a lone button. The smart door is not here: its |
| +// card holds rastrillo's partial, whose rhythm is rastrillo's, and |
| +// estilo pins a rastrillo that has none (testdata/signin-stand-in.html |
| +// stands in for its shape only); an app drawing it audits the real one. |
| +func doorPages(t *testing.T) map[string]string { |
| + t.Helper() |
| + notice := SignInNotice{Icon: "/i.svg", App: "Calendar", Heading: "Check your email", Body: "We sent a link to ada@example.com. It works once and expires soon."} |
| + sent := notice |
| + sent.Link = &Link{Href: "/signin", Label: "Use a different email"} |
| + out := notice |
| + out.Heading, out.Body = "You're signed out", "You signed out of Calendar on this device." |
| + out.Link = &Link{Href: "/signin", Label: "Sign in"} |
| + out.Forget = &ForgetForm{Action: "/signin/forget", Label: "Forget me on this device"} |
| + return map[string]string{ |
| + "form": render(t, "estilo-signin", SignIn{Icon: "/i.svg", App: "Calendar", Action: "/signin"}), |
| + "lede": render(t, "estilo-signin", SignIn{Icon: "/i.svg", App: "Calendar", Action: "/signin", Lede: "Use the address your team invited."}), |
| + "error": render(t, "estilo-signin", SignIn{Icon: "/i.svg", App: "Calendar", Action: "/signin", Lede: "Use the address your team invited.", Error: "That link has expired.", Address: "ada@", AddressError: "That doesn't look like an email address."}), |
| + "sent": render(t, "estilo-signin-sent", sent), |
| + "signed-out": render(t, "estilo-signed-out", out), |
| + "open": openCard(t), |
| + } |
| +} |
| + |
| +func TestTheDoorKeepsTheRhythm(t *testing.T) { |
| + if _, err := exec.LookPath("node"); err != nil { |
| + t.Fatal("node is required (Node 22+)") |
| + } |
| + pages := doorPages(t) |
| + mux := http.NewServeMux() |
| + var names []string |
| + for name, card := range pages { |
| + names = append(names, name) |
| + mux.HandleFunc("GET /"+name, func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Content-Type", "text/html; charset=utf-8") |
| + fmt.Fprintf(w, doorPage, card) |
| + }) |
| + } |
| + brandCSS, err := os.ReadFile("../brand/brand.css") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + assets := map[string][]byte{"/tokens.css": ui.TokensCSS(), "/theme.css": theme.CSS(), "/base.css": base.CSS(), "/brand.css": brandCSS, "/chrome.css": CSS()} |
| + for path, body := range assets { |
| + mux.HandleFunc("GET "+path, func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Content-Type", "text/css; charset=utf-8") |
| + _, _ = w.Write(body) |
| + }) |
| + } |
| + mux.HandleFunc("GET /dot.svg", func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Content-Type", "image/svg+xml") |
| + fmt.Fprint(w, `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="10" cy="10" r="10" fill="#888"/></svg>`) |
| + }) |
| + mux.HandleFunc("GET /i.svg", func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Content-Type", "image/svg+xml") |
| + fmt.Fprint(w, `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><rect width="36" height="36" rx="8" fill="#888"/></svg>`) |
| + }) |
| + srv := httptest.NewServer(mux) |
| + t.Cleanup(srv.Close) |
| + |
| + script, err := os.ReadFile("testdata/rhythm.js") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + engines := strings.Split(os.Getenv("ESTILO_BROWSERS"), ",") |
| + if engines[0] == "" { |
| + engines = []string{"chromium", "webkit"} |
| + } |
| + job, _ := json.Marshal(map[string]any{ |
| + "origin": srv.URL, "engines": engines, "viewports": []int{1440, 390}, |
| + "pages": names, "root": "[estilo-signin]", "script": string(script), |
| + "sizes": []string{"#door-img", "#door-button"}, |
| + "gaps": openGapNames(), |
| + "shots": os.Getenv("ESTILO_SHOTS"), |
| + }) |
| + cmd := exec.Command("node", "rhythm.browser.mjs", string(job)) |
| + cmd.Stderr = os.Stderr |
| + raw, err := cmd.Output() |
| + if err != nil { |
| + t.Fatalf("node rhythm.browser.mjs: %v", err) |
| + } |
| + var results []doorRhythm |
| + if err := json.Unmarshal(raw, &results); err != nil { |
| + t.Fatalf("driver output: %v\n%s", err, raw) |
| + } |
| + if len(results) != len(engines) { |
| + t.Fatalf("%d engines asked for, %d reported", len(engines), len(results)) |
| + } |
| + for _, r := range results { |
| + if r.Error != "" { |
| + t.Errorf("%s did not run: %s", r.Engine, r.Error) |
| + continue |
| + } |
| + if len(r.Pages) != 2*len(names) { |
| + t.Errorf("%s audited %d pages, want %d", r.Engine, len(r.Pages), 2*len(names)) |
| + } |
| + for _, p := range r.Pages { |
| + var report bytes.Buffer |
| + for _, f := range p.Findings { |
| + fmt.Fprintf(&report, "\n\t%s: %s\n\t\tabove: %s\n\t\tbelow: %s", f.Kind, f.Message, f.Before, f.After) |
| + } |
| + if report.Len() > 0 { |
| + t.Errorf("%s %s, %s at %dpx:%s", r.Engine, r.Version, p.Page, p.Viewport, report.String()) |
| + } |
| + if p.Page != "open" { |
| + continue |
| + } |
| + // A column stretches its children; a picture and a lone |
| + // button keep their own width. |
| + if img := p.Sizes["#door-img"]; len(img) != 2 || img[0] != 20 || img[1] != 20 { |
| + t.Errorf("%s, the card's 20x20 picture at %dpx is %v", r.Engine, p.Viewport, img) |
| + } |
| + if b := p.Sizes["#door-button"]; len(b) != 2 || b[0] > 200 { |
| + t.Errorf("%s, the card's lone button at %dpx is %v wide: stretched across the card", r.Engine, p.Viewport, b) |
| + } |
| + for id, want := range openGaps { |
| + got := p.Gaps[id] |
| + switch { |
| + case got == nil: |
| + t.Errorf("%s, the card's %s at %dpx: not measured", r.Engine, id, p.Viewport) |
| + case *got < want-0.5 || *got > want+0.5: |
| + t.Errorf("%s, the card's %s at %dpx: %.1fpx above it, want %vpx", r.Engine, id, p.Viewport, *got, want) |
| + } |
| + } |
| + } |
| + } |
| +} |
diff --git a/chrome/screen_test.go b/chrome/screen_test.go| index a791e54..31aa3f1 100644 |
| --- a/chrome/screen_test.go |
| +++ b/chrome/screen_test.go |
| @@ -100,7 +100,7 @@ func TestTheSmartDoorHasOneBrand(t *testing.T) { |
| src := string(CSS()) |
| for _, want := range []string{ |
| "[estilo-signin-screen] > section > :first-child:not(:only-child):not(:has(h1)) { display: none; }", |
| - "[estilo-signin] [estilo-signin-screen] h1 { margin: 0 0 2px; font-size: 1.75rem;", |
| + "[estilo-signin] [estilo-signin-screen] h1 { margin: 0; font-size: 1.75rem;", |
| "[estilo-signin-screen] > section { display: block; inline-size: auto; max-inline-size: none; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }", |
| } { |
| if !strings.Contains(src, want) { |
| @@ -210,7 +210,7 @@ func TestTheDoorsButtonsArePills(t *testing.T) { |
| src := string(CSS()) |
| for _, want := range []string{ |
| `[estilo-signin] :is([estilo-signin-form] [type="submit"], [estilo-signin-action]:not([estilo-signin-action~="quiet"])):not([hidden]) {`, |
| - "min-block-size: 44px; padding-inline: 18px; border-radius: 999px; font-weight: 600;", |
| + "min-block-size: 44px; padding-inline: var(--rst-sp-4); border-radius: 999px; font-weight: 600;", |
| "inset 0 1px 0 rgb(255 255 255 / 0.22)", |
| `[estilo-signin] [estilo-signin-action~="danger"] {`, |
| "--estilo-signin-glow: light-dark(color-mix(in srgb, var(--rst-danger-fill", |
diff --git a/chrome/stack_test.go b/chrome/stack_test.go| index 537702a..fc43a5b 100644 |
| --- a/chrome/stack_test.go |
| +++ b/chrome/stack_test.go |
| @@ -379,7 +379,7 @@ func TestTheWideTitleCapAllowsForItsPulledBackMargin(t *testing.T) { |
| src = src[strings.Index(src, barStackMarker):] |
| wide := src[strings.Index(src, "@media (min-width: 800px) {"):] |
| rule := regexp.MustCompile(`\[estilo-bar~="stacked"\] \[estilo-bar-title-input\] \{[^}]*\}`).FindString(wide) |
| - if !strings.Contains(rule, "margin-inline-start: calc(-0.4rem - 1px);") || !strings.Contains(rule, "max-inline-size: calc(100% + 0.4rem + 1px);") { |
| + if !strings.Contains(rule, "margin-inline-start: calc(-1 * var(--rst-sp-2) - 1px);") || !strings.Contains(rule, "max-inline-size: calc(100% + var(--rst-sp-2) + 1px);") { |
| t.Errorf("the wide title field's cap does not give back its pulled-back margin:\n%s", rule) |
| } |
| } |
diff --git a/chrome/testdata/rhythm.js b/chrome/testdata/rhythm.js| new file mode 100644 |
| index 0000000..7a6ce38 |
| --- /dev/null |
| +++ b/chrome/testdata/rhythm.js |
| @@ -0,0 +1,352 @@ |
| +// Fiesta's rhythm audit: the runtime half of the spacing rule |
| +// (DESIGN.md, "Spacing"). It walks a page's content as the browser laid |
| +// it out and reports three things a reader sees and a stylesheet check |
| +// cannot: |
| +// |
| +// off-scale two blocks, one under the other, whose gap is not a |
| +// step of the spacing scale (0, or --rst-sp-1 to 6); |
| +// touching text directly above or below a control (a button, a |
| +// field, a disclosure) with less than --rst-sp-2 between, |
| +// unless the text is the control's own <label>; |
| +// heading a heading further from its own content than it is from |
| +// what comes before it, so it reads as belonging to the |
| +// block above. |
| +// |
| +// It is one function expression, evaluated in the page: the Go package |
| +// beside it wraps it as rhythm.Expression for a chromedp drive, and |
| +// any other driver can evaluate the file and call it. It reads the |
| +// layout and changes nothing. |
| +// |
| +// It walks the content flow: the root, and every element in it that |
| +// holds blocks, except Fiesta's components (an element carrying an |
| +// rst- name other than the layout ones), whose insides are Fiesta's to |
| +// space and its own gates to check, text blocks (p, headings, lists, |
| +// tables, pre), controls, and whatever options.skip names. |
| +(function fiestaRhythm(root, options) { |
| + options = options || {}; |
| + var tolerance = typeof options.tolerance === "number" && options.tolerance > 0 ? options.tolerance : 0.5; |
| + var skip = options.skip || []; |
| + var start = typeof root === "string" ? document.querySelector(root) : root; |
| + if (!start) { |
| + return [{ kind: "missing", gap: 0, before: "", after: "", message: "no element matches " + root }]; |
| + } |
| + |
| + var htmlStyle = getComputedStyle(document.documentElement); |
| + var rem = parseFloat(htmlStyle.fontSize) || 16; |
| + var defaults = [0.25, 0.5, 0.75, 1, 1.5, 2.5]; |
| + var scale = [0]; |
| + for (var step = 1; step <= 6; step++) { |
| + scale.push(length(htmlStyle.getPropertyValue("--rst-sp-" + step), defaults[step - 1] * rem)); |
| + } |
| + |
| + // length reads a token's value: a rem, px or bare zero length. |
| + function length(value, fallback) { |
| + var m = /^\s*(-?[0-9.]+)(rem|px)?\s*$/.exec(value || ""); |
| + if (!m) return fallback; |
| + var n = parseFloat(m[1]); |
| + return m[2] === "rem" ? n * rem : n; |
| + } |
| + |
| + var layoutNames = { "rst-page": 1, "rst-stack": 1, "rst-section": 1 }; |
| + var textTags = { P: 1, H1: 1, H2: 1, H3: 1, H4: 1, H5: 1, H6: 1, UL: 1, OL: 1, DL: 1, TABLE: 1, PRE: 1, BLOCKQUOTE: 1, FIGURE: 1, SVG: 1, IMG: 1, VIDEO: 1, CANVAS: 1, IFRAME: 1, svg: 1 }; |
| + var headingTags = { H1: 1, H2: 1, H3: 1, H4: 1, H5: 1, H6: 1 }; |
| + |
| + function skipped(el) { |
| + for (var i = 0; i < skip.length; i++) { |
| + if (el.matches(skip[i])) return true; |
| + } |
| + return false; |
| + } |
| + |
| + // rstNames is every rst- name an element carries, attribute or class. |
| + function rstNames(el) { |
| + var names = []; |
| + for (var i = 0; i < el.attributes.length; i++) { |
| + var name = el.attributes[i].name; |
| + if (name.indexOf("rst-") === 0) names.push(name); |
| + } |
| + el.classList.forEach(function (c) { |
| + if (c.indexOf("rst-") === 0) names.push(c.split("__")[0].split("--")[0]); |
| + }); |
| + return names; |
| + } |
| + |
| + function isComponent(el) { |
| + var names = rstNames(el); |
| + for (var i = 0; i < names.length; i++) { |
| + if (!layoutNames[names[i]]) return true; |
| + } |
| + return false; |
| + } |
| + |
| + function isControl(el) { |
| + var tag = el.tagName; |
| + if (tag === "BUTTON" || tag === "SELECT" || tag === "TEXTAREA" || tag === "SUMMARY") return true; |
| + if (tag === "INPUT") return el.type !== "hidden"; |
| + if (el.hasAttribute("rst-btn") || el.classList.contains("rst-btn")) return true; |
| + var role = el.getAttribute("role"); |
| + return role === "button" || role === "switch" || role === "checkbox" || role === "radio" || role === "textbox" || role === "combobox"; |
| + } |
| + |
| + function isHeading(el) { |
| + return !!headingTags[el.tagName] || el.getAttribute("role") === "heading"; |
| + } |
| + |
| + function shown(el) { |
| + var style = getComputedStyle(el); |
| + if (style.display === "none" || style.visibility === "hidden") return false; |
| + if (style.position === "absolute" || style.position === "fixed" || style.float !== "none") return false; |
| + var box = el.getBoundingClientRect(); |
| + return box.height > 0 && box.width > 0; |
| + } |
| + |
| + var atomic = { "inline-block": 1, "inline-flex": 1, "inline-grid": 1, "inline-table": 1 }; |
| + |
| + // flow is a container's blocks in order: its block-level children, |
| + // and a control that sits on a line of its own, looking through |
| + // display: contents. A boxless wrapper that is skipped or a component |
| + // is a boundary, null: its children are not the page's to space, and |
| + // the blocks either side of it are not neighbours. |
| + function flow(container) { |
| + var out = []; |
| + for (var el = container.firstElementChild; el; el = el.nextElementSibling) { |
| + var style = getComputedStyle(el); |
| + if (style.display === "contents") { |
| + if (skipped(el) || isComponent(el)) { |
| + if (el.firstElementChild || el.textContent.trim() !== "") out.push(null); |
| + } else { |
| + out.push.apply(out, flow(el)); |
| + } |
| + continue; |
| + } |
| + if (el.tagName === "SCRIPT" || el.tagName === "TEMPLATE") continue; |
| + if (style.display.indexOf("inline") === 0 && !(atomic[style.display] && isControl(el))) continue; |
| + if (shown(el)) out.push(el); |
| + } |
| + return out; |
| + } |
| + |
| + // lineBox is the band a text node's lines take: the content box of |
| + // the block they sit in, found through inline and boxless wrappers, |
| + // so the block's padding and border are space, not text. |
| + function lineBox(node) { |
| + var el = node.parentElement; |
| + while (el && el.parentElement) { |
| + var display = getComputedStyle(el).display; |
| + if (display !== "contents" && display.indexOf("inline") !== 0) break; |
| + el = el.parentElement; |
| + } |
| + return el ? contentBox(el) : null; |
| + } |
| + |
| + // edge finds what an element begins (first) or ends (!first) with, |
| + // looking through wrappers: { kind: "text" or "control", node, box: |
| + // the text's own lines or the control's border box }, or null. |
| + // A skipped region is { kind: "excluded" }: what it holds is not the |
| + // page's, and neither is what lies past it. |
| + function edge(el, first) { |
| + if (skipped(el)) return { kind: "excluded" }; |
| + if (isControl(el)) return { kind: "control", node: el, box: el.getBoundingClientRect() }; |
| + var nodes = el.childNodes; |
| + for (var k = 0; k < nodes.length; k++) { |
| + var node = nodes[first ? k : nodes.length - 1 - k]; |
| + if (node.nodeType === 3) { |
| + if (node.textContent.trim() === "") continue; |
| + var box = lineBox(node); |
| + if (box) return { kind: "text", node: node, box: box }; |
| + continue; |
| + } |
| + if (node.nodeType !== 1) continue; |
| + var style = getComputedStyle(node); |
| + if (style.display === "none" || style.visibility === "hidden") continue; |
| + var found = edge(node, first); |
| + if (found) return found; |
| + } |
| + return null; |
| + } |
| + |
| + function describe(el) { |
| + var out = el.tagName.toLowerCase(); |
| + if (el.id) out += "#" + el.id; |
| + for (var i = 0; i < el.attributes.length; i++) { |
| + var a = el.attributes[i].name; |
| + if (a !== "id" && a !== "class" && a !== "style" && a.indexOf("aria-") !== 0 && a.indexOf("-") > 0) { |
| + out += "[" + a + "]"; |
| + break; |
| + } |
| + } |
| + var text = (el.textContent || "").replace(/\s+/g, " ").trim(); |
| + if (text) out += " “" + (text.length > 40 ? text.slice(0, 39) + "…" : text) + "”"; |
| + return out; |
| + } |
| + |
| + // labels says whether a text edge is the label of a control edge: a |
| + // field's own name sits as close to it as the field's design says. |
| + function labels(text, control) { |
| + var label = text.node.parentElement && text.node.parentElement.closest("label"); |
| + return !!label && !!control.node.labels && Array.prototype.indexOf.call(control.node.labels, label) >= 0; |
| + } |
| + |
| + // contentBox is an element's border box less its padding and border: |
| + // where its own text starts and ends. |
| + function contentBox(el) { |
| + var r = el.getBoundingClientRect(); |
| + var cs = getComputedStyle(el); |
| + return { |
| + top: r.top + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth), |
| + bottom: r.bottom - parseFloat(cs.paddingBottom) - parseFloat(cs.borderBottomWidth) |
| + }; |
| + } |
| + |
| + // content is the first (or last) thing a block shows, and where it |
| + // starts and ends: through generic wrappers, whose padding is space, |
| + // to a control or a component (its border box), or |
| + // to text, raw or in inline elements (the content box it sits in). |
| + // It is null when the edge is a region the audit does not read (a |
| + // skipped or component region with no box): what is past it is not |
| + // the neighbour, so nothing is measured across it. |
| + function content(el, first) { |
| + for (;;) { |
| + if (skipped(el)) return null; |
| + if (isComponent(el) || isControl(el)) { |
| + var r = el.getBoundingClientRect(); |
| + return { el: el, top: r.top, bottom: r.bottom }; |
| + } |
| + var text = !!textTags[el.tagName]; |
| + for (var n = el.firstChild; n && !text; n = n.nextSibling) { |
| + if (n.nodeType === 3 && n.textContent.trim() !== "") text = true; |
| + } |
| + var kids = text ? [] : flow(el); |
| + var next = first ? kids[0] : kids[kids.length - 1]; |
| + if (next === null) return null; |
| + if (!next) { |
| + var box = contentBox(el); |
| + return { el: el, top: box.top, bottom: box.bottom }; |
| + } |
| + el = next; |
| + } |
| + } |
| + |
| + function onScale(gap) { |
| + for (var i = 0; i < scale.length; i++) { |
| + if (Math.abs(gap - scale[i]) <= tolerance) return true; |
| + } |
| + return false; |
| + } |
| + |
| + function round(n) { |
| + return Math.round(n * 10) / 10; |
| + } |
| + |
| + var findings = []; |
| + var gapBefore = new Map(); |
| + var nextOf = new Map(); |
| + var firstChildOf = new Map(); |
| + var lastChildOf = new Map(); |
| + var excludedBefore = new Set(); |
| + var headings = []; |
| + |
| + function walk(container) { |
| + var kids = flow(container); |
| + if (kids.length && kids[0]) firstChildOf.set(kids[0], container); |
| + if (kids.length && kids[kids.length - 1]) lastChildOf.set(kids[kids.length - 1], container); |
| + for (var i = 0; i < kids.length; i++) { |
| + var b = kids[i]; |
| + if (!b) continue; |
| + if (i > 0 && (!kids[i - 1] || skipped(kids[i - 1]))) excludedBefore.add(b); |
| + if (isHeading(b)) headings.push(b); |
| + if (i > 0 && kids[i - 1]) measure(kids[i - 1], b); |
| + if (!skipped(b) && !isComponent(b) && !isControl(b) && !textTags[b.tagName]) walk(b); |
| + } |
| + } |
| + |
| + function measure(a, b) { |
| + var ra = a.getBoundingClientRect(); |
| + var rb = b.getBoundingClientRect(); |
| + var stacked = rb.top >= ra.bottom - tolerance && rb.left < ra.right && ra.left < rb.right; |
| + if (!stacked || skipped(a) || skipped(b)) return; |
| + var gap = rb.top - ra.bottom; |
| + gapBefore.set(b, { gap: gap, from: a }); |
| + nextOf.set(a, b); |
| + if (!onScale(gap)) { |
| + findings.push({ |
| + kind: "off-scale", gap: round(gap), before: describe(a), after: describe(b), |
| + message: round(gap) + "px between blocks is not a step of the spacing scale" |
| + }); |
| + } |
| + var above = edge(a, false); |
| + var below = edge(b, true); |
| + if (!above || !below || above.kind === below.kind || above.kind === "excluded" || below.kind === "excluded") return; |
| + if (above.kind === "text" ? labels(above, below) : labels(below, above)) return; |
| + var space = below.box.top - above.box.bottom; |
| + if (space < scale[2] - tolerance) { |
| + findings.push({ |
| + kind: "touching", gap: round(space), before: describe(a), after: describe(b), |
| + message: "text and a control are " + round(space) + "px apart; they need --rst-sp-2 (" + round(scale[2]) + "px) or more" |
| + }); |
| + } |
| + } |
| + |
| + // before is the space that opens a heading: from the bottom of the |
| + // block before it, or, when it opens a container, before the |
| + // container, and so on up, to the heading's own top, so a section's |
| + // padding counts. |
| + // |
| + // It is undefined when nothing comes before the heading, and null |
| + // when what does is a region the audit does not read: then the space |
| + // is unknown, and the heading is not held to anything. |
| + function before(h) { |
| + for (var at = h; at && at !== start; at = firstChildOf.get(at)) { |
| + if (excludedBefore.has(at)) return null; |
| + if (gapBefore.has(at)) { |
| + var last = content(gapBefore.get(at).from, false); |
| + return last ? h.getBoundingClientRect().top - last.bottom : null; |
| + } |
| + if (!firstChildOf.has(at)) return undefined; |
| + } |
| + return undefined; |
| + } |
| + |
| + // after is the block a heading's content starts with and the space |
| + // to it: its next block, or, when it ends a wrapper (a header |
| + // holding only the heading), the block after the wrapper. |
| + function after(h) { |
| + for (var at = h; at && at !== start; at = lastChildOf.get(at)) { |
| + if (nextOf.has(at)) { |
| + var next = content(nextOf.get(at), true); |
| + return next ? { el: next.el, gap: next.top - h.getBoundingClientRect().bottom } : null; |
| + } |
| + if (!lastChildOf.has(at)) return null; |
| + } |
| + return null; |
| + } |
| + |
| + walk(start); |
| + |
| + // The space that opens a section is the space before each heading of |
| + // a level; a heading with nothing before it on the page is held to |
| + // the smallest of those for its level. |
| + var opening = {}; |
| + headings.forEach(function (h) { |
| + var gap = before(h); |
| + if (typeof gap === "number") { |
| + opening[h.tagName] = Math.min(opening[h.tagName] === undefined ? Infinity : opening[h.tagName], gap); |
| + } |
| + }); |
| + headings.forEach(function (h) { |
| + var next = after(h); |
| + if (!next) return; |
| + var open = before(h); |
| + if (open === null) return; |
| + if (open === undefined) open = opening[h.tagName]; |
| + if (open === undefined) return; |
| + if (next.gap >= open - tolerance) { |
| + findings.push({ |
| + kind: "heading", gap: round(next.gap), before: describe(h), after: describe(next.el), |
| + message: "a heading is " + round(next.gap) + "px from its content and " + round(open) + |
| + "px from what comes before it; it should sit closer to its content" |
| + }); |
| + } |
| + }); |
| + return findings; |
| +}) |
diff --git a/chrome/unchanged_test.go b/chrome/unchanged_test.go| index 4be4221..46b6e42 100644 |
| --- a/chrome/unchanged_test.go |
| +++ b/chrome/unchanged_test.go |
| @@ -78,10 +78,16 @@ const barStackMarker = "\n/* ── Bar stack" |
| // feat/smart-door, for the door's rules only (the footer slot removed; |
| // the smart door and the signed-out page's Forget added), and again on |
| // feat/door-pills, for the door's rules only (the door's buttons drawn as |
| -// pills, Paul 2026-11-21): no bar rule changed. |
| +// pills, Paul 2026-11-21): no bar rule changed. Both were updated on |
| +// feat/stack-rhythm (Paul 2026-11-22, "Release and start the rollout"): |
| +// every margin, padding and gap on the spacing scale, the door's card a |
| +// stack. The bar and its menus move by a pixel or two (the trigger's |
| +// padding 0.4rem to 0.5rem, a menu row's 0.4rem to 0.25rem and 0.65rem |
| +// to 0.75rem), and nothing else in their rules changed; the door's card |
| +// became a stack, its rules all keyed on estilo-signin. |
| const ( |
| - mainChromeCSS = "d3fd4b3440932c3d797be502bfe6d1e450ecd21b26d5d3913069e8368446d29e" |
| - mainMenuCSS = "6b3435a18591d20ad62b40df3e64e159b501f9d1c183b2f42aa32b4faa9c0669" |
| + mainChromeCSS = "97baefd498e9339c39a07e0ace6cbd1d7cc3cc5a326804ce673ebf0e6af1dbcd" |
| + mainMenuCSS = "90defb24148756958619c1e96db2bb2bc663f92b4acbb19ea94f9e037ecbab63" |
| ) |
| // optInHooks are the attributes only a bar with a slot, a WideOnly or |
diff --git a/credits/credits.css b/credits/credits.css| index 55bbec2..0d696f7 100644 |
| --- a/credits/credits.css |
| +++ b/credits/credits.css |
| @@ -1,7 +1,7 @@ |
| [estilo-credits] { min-inline-size: 0; overflow-wrap: anywhere; } |
| [estilo-credits] > ul { list-style: none; padding: 0; } |
| -[estilo-credits] > ul > li { border-block-end: 1px solid var(--rst-line); padding-block: .5rem; } |
| -[estilo-credits] summary { min-block-size: 24px; padding-block: .5rem; cursor: pointer; } |
| +[estilo-credits] > ul > li { border-block-end: 1px solid var(--rst-line); padding-block: var(--rst-sp-2); } |
| +[estilo-credits] summary { min-block-size: 24px; padding-block: var(--rst-sp-2); cursor: pointer; } |
| [estilo-credits] a { display: inline-block; min-block-size: 24px; max-inline-size: 100%; } |
| [estilo-credits] pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; } |
| [estilo-credits-version] { font-size: .875em; } |
diff --git a/desk/desk.css b/desk/desk.css| index 43d31f9..3874edd 100644 |
| --- a/desk/desk.css |
| +++ b/desk/desk.css |
| @@ -24,7 +24,7 @@ |
| /* The card: glass with the line as its rim. Surface only. */ |
| [estilo-card] { |
| box-sizing: border-box; |
| - padding: 12px; |
| + padding: var(--rst-sp-3); |
| border: 1px solid transparent; |
| border-radius: 12px; |
| background: |
| @@ -54,7 +54,7 @@ |
| inline-size: var(--estilo-inspector-inline-size); |
| display: flex; |
| flex-direction: column; |
| - gap: 14px; |
| + gap: var(--rst-sp-3); |
| overflow-y: auto; |
| overscroll-behavior: contain; |
| font-size: 13px; |
| @@ -64,7 +64,7 @@ |
| [estilo-inspector-group] { |
| display: flex; |
| flex-wrap: wrap; |
| - gap: 6px 2px; |
| + gap: var(--rst-sp-2) var(--rst-sp-1); |
| margin: 0; |
| padding: 0; |
| border: 0; |
diff --git a/desk/desk_test.go b/desk/desk_test.go| index 4499051..4d028b3 100644 |
| --- a/desk/desk_test.go |
| +++ b/desk/desk_test.go |
| @@ -18,6 +18,7 @@ func TestDeskTokensAreDefined(t *testing.T) { |
| } |
| // The values are Docs' own, copied; a change here is a design decision. |
| +// The card's 12px padding is written as --rst-sp-3 since feat/stack-rhythm. |
| func TestCardAndSegAreDocs(t *testing.T) { |
| src := string(CSS()) |
| for _, want := range pins { |
| @@ -33,7 +34,7 @@ var pins = []string{ |
| "--estilo-inspector-inline-size: 248px", |
| "--estilo-inspector-inset: 12px", |
| "border-radius: 12px", |
| - "padding: 12px", |
| + "padding: var(--rst-sp-3)", |
| "light-dark(rgb(255 255 255 / 0.92), rgb(32 35 43 / 0.92))", |
| "0 28px 56px -20px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7))", |
| "backdrop-filter: saturate(1.4) blur(14px)", |
diff --git a/menu/menu.css b/menu/menu.css| index 9070652..eb420e2 100644 |
| --- a/menu/menu.css |
| +++ b/menu/menu.css |
| @@ -5,9 +5,9 @@ |
| in the page flow, so it is square (the suite's square rule). */ |
| :root { |
| --estilo-float-radius: 9px; /* rastrillo's hard-coded dropdown value, named. PUBLIC */ |
| - --estilo-float-padding: 0.25rem; |
| - --estilo-item-padding-block: 0.4rem; |
| - --estilo-item-padding-inline: 0.65rem; |
| + --estilo-float-padding: var(--rst-sp-1); |
| + --estilo-item-padding-block: var(--rst-sp-1); |
| + --estilo-item-padding-inline: var(--rst-sp-3); |
| } |
| [estilo-menu] { |
| box-sizing: border-box; |
| @@ -46,7 +46,7 @@ |
| [estilo-menu-item] { |
| display: flex; |
| align-items: center; |
| - gap: 0.5rem; |
| + gap: var(--rst-sp-2); |
| box-sizing: border-box; |
| inline-size: 100%; |
| min-block-size: 2rem; |
| @@ -88,7 +88,7 @@ |
| [estilo-menu-key] { |
| flex: none; |
| margin-inline-start: auto; |
| - padding-inline-start: 1.5rem; |
| + padding-inline-start: var(--rst-sp-5); |
| color: var(--rst-text-muted); |
| font: inherit; |
| font-size: var(--rst-fs-xs); |
| @@ -98,11 +98,11 @@ |
| [estilo-menu] hr { |
| border: 0; |
| border-block-start: 1px solid var(--rst-line); |
| - margin: 0.25rem 0; |
| + margin: var(--rst-sp-1) 0; |
| } |
| [estilo-menu-heading] { |
| margin: 0; |
| - padding: 0.5rem var(--estilo-item-padding-inline) 0.25rem; |
| + padding: var(--rst-sp-2) var(--estilo-item-padding-inline) var(--rst-sp-1); |
| color: var(--rst-text-muted); |
| font-size: var(--rst-fs-xs); |
| font-weight: 600; /* no text-transform */ |
| @@ -124,7 +124,7 @@ |
| box-sizing: border-box; |
| block-size: 100%; |
| min-block-size: 2rem; |
| - padding-inline: 0.6rem; |
| + padding-inline: var(--rst-sp-2); |
| border-radius: 0; /* square: in-flow */ |
| color: var(--rst-text); |
| font-size: var(--rst-fs-sm); |
diff --git a/side/side.css b/side/side.css| index bb03b9d..e405d52 100644 |
| --- a/side/side.css |
| +++ b/side/side.css |
| @@ -43,9 +43,9 @@ |
| block-size: calc(100dvh - var(--estilo-bar-block-size, 56px)); |
| display: flex; |
| flex-direction: column; |
| - gap: 1px; |
| + gap: 1px; /* spacing-allow: a hairline between rows, so two highlighted rows never merge */ |
| overflow: auto; |
| - padding: 10px 8px 12px; |
| + padding: var(--rst-sp-3) var(--rst-sp-2); |
| background: light-dark(#f8f9fb, #191b21); |
| border-inline-end: 1px solid var(--rst-line); |
| font-size: 13px; |
| @@ -56,10 +56,10 @@ |
| display: grid; |
| grid-template-columns: 16px minmax(0, 1fr) auto; |
| align-items: center; |
| - column-gap: 10px; |
| + column-gap: var(--rst-sp-3); |
| inline-size: 100%; |
| min-block-size: 30px; |
| - padding: 0 8px 0 10px; |
| + padding: 0 var(--rst-sp-2); |
| border: 0; |
| border-radius: 8px; |
| background: none; |
| @@ -86,21 +86,21 @@ |
| [estilo-side-lock] { display: inline-flex; color: var(--rst-text-muted); } |
| [estilo-side-lock] > svg { inline-size: 12px; block-size: 12px; } |
| [estilo-side-head] { |
| - margin: 14px 0 2px; |
| - padding: 0 8px 0 10px; |
| + margin: var(--rst-sp-3) 0 var(--rst-sp-1); |
| + padding: 0 var(--rst-sp-2); |
| color: var(--rst-text-faint, var(--rst-text-muted)); |
| font-size: 11.5px; |
| font-weight: 600; |
| line-height: 22px; |
| } |
| -[estilo-side-foot] { margin-block-start: auto; padding-block-start: 10px; display: grid; gap: 1px; } |
| +[estilo-side-foot] { margin-block-start: auto; padding-block-start: var(--rst-sp-3); display: grid; gap: 1px; /* spacing-allow: the rows' hairline, as above */ } |
| [estilo-side-foot] form { display: contents; } |
| kbd[estilo-side-key] { |
| display: inline-flex; |
| align-items: center; |
| justify-content: center; |
| min-inline-size: 1.4em; |
| - padding: 0 5px; |
| + padding: 0 var(--rst-sp-1); |
| border: 1px solid var(--rst-line); |
| border-block-end-width: 2px; |
| border-radius: 5px; |
| @@ -128,7 +128,7 @@ kbd[estilo-side-key] { |
| it. side.js dismisses it on Escape (data-estilo-side-tip="off") until |
| the next hover or focus. ── */ |
| @media (min-width: 800px) { |
| - [estilo-side-frame~="rail"] [estilo-side] { padding-inline: 8px; align-items: center; } |
| + [estilo-side-frame~="rail"] [estilo-side] { padding-inline: var(--rst-sp-2); align-items: center; } |
| [estilo-side-frame~="rail"] [estilo-side-item] { |
| grid-template-columns: 18px; |
| justify-content: center; |
| @@ -156,11 +156,11 @@ kbd[estilo-side-key] { |
| } |
| [estilo-side-frame~="rail"] [estilo-side-label] { |
| position: fixed; |
| - margin-inline-start: 50px; |
| - margin-block-start: 19px; |
| + margin-inline-start: 50px; /* spacing-allow: the tooltip hangs 10px beside the 40px rail row it labels */ |
| + margin-block-start: 19px; /* spacing-allow: the middle of the 38px row, so the tooltip centres on it */ |
| translate: 0 -50%; |
| z-index: 30; |
| - padding: 4px 8px; |
| + padding: var(--rst-sp-1) var(--rst-sp-2); |
| border-radius: 6px; |
| background: var(--rst-text); |
| color: var(--rst-surface); |
| @@ -186,7 +186,7 @@ kbd[estilo-side-key] { |
| } |
| } |
| @media (min-width: 800px) and (max-width: 79.99rem) { |
| - [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side] { padding-inline: 8px; align-items: center; } |
| + [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side] { padding-inline: var(--rst-sp-2); align-items: center; } |
| [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item] { |
| grid-template-columns: 18px; |
| justify-content: center; |
| @@ -214,11 +214,11 @@ kbd[estilo-side-key] { |
| } |
| [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-label] { |
| position: fixed; |
| - margin-inline-start: 50px; |
| - margin-block-start: 19px; |
| + margin-inline-start: 50px; /* spacing-allow: the tooltip hangs 10px beside the 40px rail row it labels */ |
| + margin-block-start: 19px; /* spacing-allow: the middle of the 38px row, so the tooltip centres on it */ |
| translate: 0 -50%; |
| z-index: 30; |
| - padding: 4px 8px; |
| + padding: var(--rst-sp-1) var(--rst-sp-2); |
| border-radius: 6px; |
| background: var(--rst-text); |
| color: var(--rst-surface); |