oficina / estilo Public

The door's card: the whole table, and its own widths

GPT-6 Astra on f2d50d0: APPROVE AFTER FIXES, three medium.

- The card implements the whole table (Fiesta's rst-stack), in estilo's
  own properties: 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; an h3 to h6
  --rst-sp-4; else --rst-sp-3. Each relation sets its own custom
  property, read in the table's order by one margin rule, so
  specificity never decides it; a heading the card holds directly is
  spaced by the stack, one nested deeper keeps no margin.
- A picture, a button or a direct action link keeps its own width
  (align-self: flex-start); a full-width action stays full width.
- The smart door's heading takes no 2px: rastrillo's own door heading
  declares none, so the allowance's claim was wrong. The rhythm drive
  no longer audits the smart door, whose card holds rastrillo's partial
  that estilo's pinned rastrillo cannot draw (the stand-in has its
  shape only); it audits an app's own card instead, drawn through
  estilo-door-open with every relation of the table, a picture and a
  lone button, and asserts each gap and both widths. Each assertion
  fails with its rule removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 36de00c51230132d0824a5ceedf95460daa0c509 parent f2d50d0
5 files changed, +141 −27
  • chrome/chrome.css +44 −16
  • chrome/rhythm.browser.mjs +16 −4
  • chrome/rhythm_browser_test.go +77 −4
  • chrome/screen_test.go +1 −1
  • chrome/unchanged_test.go +3 −2

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.004s
ok  	amadan.net/oficina/estilo.git/brand	0.005s
ok  	amadan.net/oficina/estilo.git/busy	0.009s
ok  	amadan.net/oficina/estilo.git/callui	0.006s
ok  	amadan.net/oficina/estilo.git/chrome	4.535s
?   	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.004s
ok  	amadan.net/oficina/estilo.git/desk	0.004s
ok  	amadan.net/oficina/estilo.git/googleimport	3.170s
ok  	amadan.net/oficina/estilo.git/homeconnect	0.005s
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.118s
ok  	amadan.net/oficina/estilo.git/side	0.142s
ok  	amadan.net/oficina/estilo.git/sky	0.031s
ok  	amadan.net/oficina/estilo.git/theme	0.013s
=== spacing ===
go run amadan.net/rastrillo/fiesta/cmd/fiesta@v1.6.0 spacing .
diff --git a/chrome/chrome.css b/chrome/chrome.css
index dbef7e6..3f6b956 100644
--- a/chrome/chrome.css
+++ b/chrome/chrome.css
@@ -272,12 +272,26 @@
}
/* 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 because an app's tokens.css
- may predate it. After the brand, which heads the card as a page
- header heads a page, --rst-sp-5; after the heading, --rst-sp-2; above
- an actions row (a paragraph holding the card's action, or Forget),
- --rst-sp-4, or --rst-sp-2 under another action; anything else,
- --rst-sp-3. A column, so nothing collapses. */
+ (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;
@@ -289,17 +303,31 @@
border-radius: 20px;
box-shadow: 0 0 0 1px light-dark(transparent, var(--rst-line)), var(--rst-shadow-lift);
}
-[estilo-signin] > * { margin-block: 0; }
-[estilo-signin] > * + * { margin-block-start: var(--rst-sp-3); }
-[estilo-signin] > :is(p:has(> [estilo-signin-action]), [estilo-signin-forget]) { margin-block-start: var(--rst-sp-4); }
-[estilo-signin] > :is(p:has(> [estilo-signin-action]), [estilo-signin-forget]) + :is(p:has(> [estilo-signin-action]), [estilo-signin-forget]) { margin-block-start: var(--rst-sp-2); }
-[estilo-signin] > [estilo-brand] + * { margin-block-start: var(--rst-sp-5); }
-/* After the heading wins over an actions row, so the :is() carries the
- actions row's weight. */
-[estilo-signin] > h1 + :is(*, p:has(> [estilo-signin-action]), [estilo-signin-forget]) { margin-block-start: var(--rst-sp-2); }
+[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] 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) {
@@ -329,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; /* spacing-allow: rastrillo's own door heading margin, restated with its size */ 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
diff --git a/chrome/rhythm.browser.mjs b/chrome/rhythm.browser.mjs
index bda4cdb..9c15656 100644
--- a/chrome/rhythm.browser.mjs
+++ b/chrome/rhythm.browser.mjs
@@ -7,9 +7,11 @@
// ESTILO_PLAYWRIGHT=<path to the playwright package> \
// node rhythm.browser.mjs <job JSON>
//
-// Job: {origin, engines, viewports, pages, root, script, shots}. Output:
-// one entry per engine, {engine, version, error, pages: [{page,
-// viewport, findings}]}. With shots set to a directory, each page is
+// 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'
@@ -30,7 +32,17 @@ for (const engine of job.engines) {
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])
- result.pages.push({ page: name, viewport, findings })
+ 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()
diff --git a/chrome/rhythm_browser_test.go b/chrome/rhythm_browser_test.go
index 3b92b86..0892776 100644
--- a/chrome/rhythm_browser_test.go
+++ b/chrome/rhythm_browser_test.go
@@ -51,8 +51,10 @@ type doorRhythm struct {
Version string `json:"version"`
Error string `json:"error"`
Pages []struct {
- Page string `json:"page"`
- Viewport int `json:"viewport"`
+ 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"`
@@ -63,8 +65,53 @@ type doorRhythm struct {
} `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 the smart door.
+// 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."}
@@ -80,7 +127,7 @@ func doorPages(t *testing.T) map[string]string {
"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),
- "screen": renderScreen(t, "estilo-signin-screen", SignInScreen{App: "Calendar", Icon: "/i.svg", State: standInState{Federated: &standInFederated{Href: "/oauth", Label: "Oficina ID"}}}),
+ "open": openCard(t),
}
}
@@ -109,6 +156,10 @@ func TestTheDoorKeepsTheRhythm(t *testing.T) {
_, _ = 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>`)
@@ -127,6 +178,8 @@ func TestTheDoorKeepsTheRhythm(t *testing.T) {
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))
@@ -158,6 +211,26 @@ func TestTheDoorKeepsTheRhythm(t *testing.T) {
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 fa1ef39..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; /* spacing-allow: rastrillo's own door heading margin, restated with its size */ 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) {
diff --git a/chrome/unchanged_test.go b/chrome/unchanged_test.go
index 858b853..46b6e42 100644
--- a/chrome/unchanged_test.go
+++ b/chrome/unchanged_test.go
@@ -83,9 +83,10 @@ const barStackMarker = "\n/* ── Bar stack"
// 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.
+// 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 = "245b74a330bb1fd223348973e8ab00a1af70bc8602a10c8aa7ccc9549d5785a5"
+ mainChromeCSS = "97baefd498e9339c39a07e0ace6cbd1d7cc3cc5a326804ce673ebf0e6af1dbcd"
mainMenuCSS = "90defb24148756958619c1e96db2bb2bc663f92b4acbb19ea94f9e037ecbab63"
)