oficina / sheets Public

Sheets' screens on the spacing scale, and the two gates

Paul, 2026-11-22: "Release and start the rollout" of Fiesta's spacing
rhythm (spacing-rollout/BRIEF.md).

- Every page but the grid is Fiesta's stack: layout.html's default
  <main> is rst-stack, and the import report's and Google Drive's
  sections are rst-stack rst-section. Dead hand margins on the sheet and
  share lists are gone; estilo's Google chooser, which brings no CSS,
  is spaced on the scale here until estilo does it.
- Spacing check: `make test-spacing` (in `make test`, ci.d/15-spacing),
  skipping rastrillo's tokens.css and vendor/. 4 declarations off the
  scale before, 0 after; 2 allowances (estilo's menu item inset; a
  toolbar glyph and its caret).
- Rhythm audit: TestEveryScreenKeepsTheRhythm in `make test-browser`,
  through the production stack at 1280 and 390px, around the grid and
  the table view's cells. 37 findings on origin/main's templates and
  CSS, 0 after. Each audit checks it is still on its page and that the
  page drew something.
- rastrillo v0.45.0 (Paul's ruling), Fiesta v1.6.1, estilo 6238a47;
  tokens.css re-copied (the stack rules only). v0.45.0's auth.New
  panics when http.DefaultTransport is wrapped, as keymailtest does, so
  the tests list their fixture host in KeymailServers
  (keymailTestServers, nil in production) and
  TestAuthIsBuiltAsDeployed builds auth as a deployment does in a
  child process. The door's Keymail copy is rastrillo v0.45.0's own;
  the tests now expect it. Reported to rastrillo as discussion 402.

Review: Claude Fable, no High; 3 Medium and 5 Low fixed, then a narrow
re-review of the v0.45.0 and audit changes, fixed. make test,
make test-browser and hub CI green. Not deployed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from feat/rhythm into main.
claude agent, operated by paul@keymail.dev 26d271a5dae9c56330bd3b35cc70376261f86763 parent 66e5391
15 files changed, +333 −38
  • .amadan/ci.d/15-spacing +6 −0
  • Makefile +15 −4
  • go.mod +7 −4
  • go.sum +6 −6
  • internal/sheets/auth.go +14 −1
  • internal/sheets/keymail_signin_test.go +33 −0
  • internal/sheets/rhythm_browser_test.go +119 −0
  • internal/sheets/signin_browser_test.go +1 −1
  • internal/sheets/signin_door_states_test.go +3 −2
  • internal/sheets/static/brand/brand.css +1 −1
  • internal/sheets/static/sheets.css +34 −12
  • internal/sheets/static/tokens.css +84 −0
  • internal/sheets/templates/import.html +1 −1
  • internal/sheets/templates/import_report.html +4 −4
  • internal/sheets/templates/layout.html +5 −2

CI passed — run details

CI log
amadan: .amadan/timeout: this job's budget is 15m0s (this runner allows up to 30m0s)
=== vet ===
CGO_ENABLED=0 go vet ./...
go: downloading amadan.net/rastrillo/rastrillo v0.45.0
go: downloading amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e
go: downloading amadan.net/rastrillo/fiesta v1.6.1
CGO_ENABLED=0 go vet -tags browser ./internal/sheets/
=== spacing ===
go tool fiesta spacing -skip 'vendor/*.css' -skip 'tokens.css' internal/sheets/static
=== fmt ===
=== build ===
CGO_ENABLED=0 go build ./...
=== migrations ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
=== go-test ===
CGO_ENABLED=0 go test -count=1 ./...
?   	amadan.net/oficina/sheets/cmd/sheets	[no test files]
?   	amadan.net/oficina/sheets/cmd/sheets-contract	[no test files]
ok  	amadan.net/oficina/sheets/internal/guardstest	0.174s
ok  	amadan.net/oficina/sheets/internal/sheets	15.874s
ok  	amadan.net/oficina/sheets/internal/sheets/calc	0.014s
ok  	amadan.net/oficina/sheets/internal/sheets/format	0.004s
?   	amadan.net/oficina/sheets/internal/sheets/keymailtest	[no test files]
ok  	amadan.net/oficina/sheets/internal/sheets/live	0.058s
ok  	amadan.net/oficina/sheets/internal/sheets/seal	0.002s
ok  	amadan.net/oficina/sheets/internal/sheets/sealtest	0.002s
ok  	amadan.net/oficina/sheets/internal/sheets/store	6.298s
ok  	amadan.net/oficina/sheets/internal/sheets/teamstate	0.128s
ok  	amadan.net/oficina/sheets/internal/sheets/xlsx	4.583s
?   	amadan.net/oficina/sheets/tools/gencorpus	[no test files]
=== race ===
go test -race -count=1 ./internal/sheets/store/... ./internal/sheets/live/...
ok  	amadan.net/oficina/sheets/internal/sheets/store	72.531s
ok  	amadan.net/oficina/sheets/internal/sheets/live	1.066s

landed from feat/rhythm

diff --git a/.amadan/ci.d/15-spacing b/.amadan/ci.d/15-spacing
new file mode 100755
index 0000000..dabf60e
--- /dev/null
+++ b/.amadan/ci.d/15-spacing
@@ -0,0 +1,6 @@
+#!/bin/sh
+# One step of Sheets' CI, like the others: a Makefile target, so CI and
+# `make test` are one definition. Fiesta's spacing check over Sheets'
+# own stylesheets.
+set -eu
+exec make test-spacing
diff --git a/Makefile b/Makefile
index ae42cc4..bfb122e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
comma := ,
export GOPRIVATE := $(if $(GOPRIVATE),$(GOPRIVATE)$(comma))amadan.net/oficina/estilo.git,amadan.net/oficina/agent-access.git
-.PHONY: build release test test-vet test-fmt test-build test-migrations test-go test-race test-browser
+.PHONY: build release test test-vet test-fmt test-spacing test-build test-migrations test-go test-race test-browser
# One binary, CGO_ENABLED=0, cgo-free SQLite (AGENTS.md / Deploys). Set
# per-target below rather than exported globally, because test-race is
@@ -61,7 +61,7 @@ release:
# test-migrations needs the app to compile but no database and no test
# suite, plain `go test` (tens of seconds, dominated by the store
# package) comes next, and -race — by far the slowest step — runs last.
-test: test-vet test-fmt test-build test-migrations test-go test-race
+test: test-vet test-fmt test-spacing test-build test-migrations test-go test-race
# Also vets the browser-tagged tests: they are outside `make test`, and a
# test behind a tag that nothing compiles rots silently.
@@ -79,6 +79,15 @@ test-fmt:
exit 1; \
fi
+
+# Fiesta's spacing check (Paul, 2026-11-22: no ad-hoc spacing): every
+# margin, padding and gap in Sheets' own stylesheets is a
+# var(--rst-sp-N), or says why not with /* spacing-allow: why */.
+# tokens.css is rastrillo's, re-copied on each upgrade, and vendor/ is
+# Jspreadsheet's and jSuites': neither is ours to space.
+test-spacing:
+ go tool fiesta spacing -skip 'vendor/*.css' -skip 'tokens.css' internal/sheets/static
+
test-build:
CGO_ENABLED=0 go build ./...
@@ -132,11 +141,13 @@ test-race:
# only; on a Mac set RASTRILLO_CHROME to Playwright's or Chrome's binary).
# Deliberately NOT part of `test`: the gate CI runs on every push must
# not need a browser. Run it before shipping a change to the CSS or to
-# rastrillo's pin. The filter runs four tests: OnTap matches both
+# rastrillo's pin. The filter runs five tests: OnTap matches both
# TestNoZoomOnTap (the iOS zoom-on-tap check) and TestFormatMenuFitsOnTap;
# TestDocumentStylesSurviveTheProductionCSP and TestSmartDoorInABrowser
# are served through rastrillo's production stack, so they see the real
# CSP. TestSmartDoorInABrowser forces the light scheme itself; the others
# measure whichever scheme the browser starts in.
+# TestEveryScreenKeepsTheRhythm is Fiesta's rhythm audit over every
+# screen but the grid's own surface, at 1280 and 390px.
test-browser:
- CGO_ENABLED=0 go test -tags browser -count=1 -run 'OnTap|DocumentStyles|SmartDoorInABrowser' ./internal/sheets/
+ CGO_ENABLED=0 go test -tags browser -count=1 -run 'OnTap|DocumentStyles|SmartDoorInABrowser|KeepsTheRhythm' ./internal/sheets/
diff --git a/go.mod b/go.mod
index d28cda0..7338338 100644
--- a/go.mod
+++ b/go.mod
@@ -4,13 +4,14 @@ go 1.26.0
require (
amadan.net/oficina/agent-access.git v0.0.0-20261024232549-8ed8ba826000
- amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803
+ amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e
amadan.net/oficina/home/connect v0.0.0-20261121235253-98726fac99a7
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816
amadan.net/oficina/home/handoff v0.0.0-20261121235253-98726fac99a7
amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2
amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2
- amadan.net/rastrillo/rastrillo v0.42.0
+ amadan.net/rastrillo/fiesta v1.6.1
+ amadan.net/rastrillo/rastrillo v0.45.0
github.com/carlosframework/rastrillo v0.23.0
github.com/chromedp/cdproto v0.158.6
github.com/chromedp/chromedp v0.21.0
@@ -23,7 +24,6 @@ require (
)
require (
- amadan.net/rastrillo/fiesta v1.5.0 // indirect
amadan.net/rastrillo/rastrillo/money v0.1.0 // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/danieljoos/wincred v1.2.3 // indirect
@@ -69,4 +69,7 @@ require (
modernc.org/sqlite v1.55.0 // indirect
)
-tool amadan.net/rastrillo/rastrillo/cmd/rastrillo
+tool (
+ amadan.net/rastrillo/fiesta/cmd/fiesta
+ amadan.net/rastrillo/rastrillo/cmd/rastrillo
+)
diff --git a/go.sum b/go.sum
index 8e33cd0..cd23d09 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,7 @@
amadan.net/oficina/agent-access.git v0.0.0-20261024232549-8ed8ba826000 h1:L07nc+dmLI7c1PBkSkbnrjOK5f8p6OBbA/yTxznxCAw=
amadan.net/oficina/agent-access.git v0.0.0-20261024232549-8ed8ba826000/go.mod h1:Ph9PIa3VE1IEaUzZiQH6D+IQ6HThWWGfVr0ecMMgrFA=
-amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803 h1:yl1LyYZW3/722xRPnXMu5veg4sZGjyDMJFLqOWST0ws=
-amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803/go.mod h1:2UFIFrbTrhew8EFM0C94WmTo2OASM2pHEgT4jzeE/s8=
+amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e h1:g2EvXlQAleAEFsc4yIBvS7ycMG3GyuEySEOia0yo8nY=
+amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e/go.mod h1:2UFIFrbTrhew8EFM0C94WmTo2OASM2pHEgT4jzeE/s8=
amadan.net/oficina/home/connect v0.0.0-20261121235253-98726fac99a7 h1:hytRIC++gbCt0rLcNn2O+EcPKkBdnfEodINDo8gT6jw=
amadan.net/oficina/home/connect v0.0.0-20261121235253-98726fac99a7/go.mod h1:B45bHBZF5AtFJqy4d1qSDNDOqYcNkSz1qD20TLF1DI8=
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816 h1:AFDuOio0MxNxN9ZWVc3lul1QHkNjNUCO56kXpe/Fw3I=
@@ -12,12 +12,12 @@ amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2 h1:yKUTS0nOiVw
amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2/go.mod h1:gqshuXyDtFZUCYbhuZyV3Epc51pUcsLbpqAqiA5UiXg=
amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2 h1:0PQiRUkC+9cbTHE67Y4/SmW1sPH1NNWNwTceNFyMjTY=
amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2/go.mod h1:dXBZeB2ic33SIZiGUCzafmviUT8TYWgzSYZvo2rM6zA=
-amadan.net/rastrillo/fiesta v1.5.0 h1:wKfTsL5zRMofJBAqOxNlCY7aCtgHCtfwvTPBMA+ZA20=
-amadan.net/rastrillo/fiesta v1.5.0/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
+amadan.net/rastrillo/fiesta v1.6.1 h1:WYgHt652+uQj6eR0Y0JLin+XrdRPGk1WPW7o0lSrc94=
+amadan.net/rastrillo/fiesta v1.6.1/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3 h1:5EFx7BLJj/+G/rt8bTmeyMWVfF5s5Sns7ajTvX4w/I8=
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3/go.mod h1:ZaaxeE278dJltdrLwmwpxUjQ5wuKzqDAVSNRet+WupY=
-amadan.net/rastrillo/rastrillo v0.42.0 h1:RJ0ecpdb2kMqwW9216bBpUqzpboxLYKb/51wq/+ceyo=
-amadan.net/rastrillo/rastrillo v0.42.0/go.mod h1:0bufVMz8D4aWvxvJjehW70T8Jsvytrp1YEwoIzFTKm8=
+amadan.net/rastrillo/rastrillo v0.45.0 h1:zJfxetxg/H/CkCBFIvdGQbiATQ0hV3JR7H82AMk4bmM=
+amadan.net/rastrillo/rastrillo v0.45.0/go.mod h1:Vk7QL+RePyKtcP+7XclR9hpSDp/CjrVo37TENKifaFY=
amadan.net/rastrillo/rastrillo/money v0.1.0 h1:MxU4oqNrW8abxRTkgZBv24OYNpFnvonajNqeLIzmmaM=
amadan.net/rastrillo/rastrillo/money v0.1.0/go.mod h1:cmgkjBEIQh1pFSYvQk0UU6oPYS8kSDypdT9+t4Flx0U=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
diff --git a/internal/sheets/auth.go b/internal/sheets/auth.go
index aa06139..d646f68 100644
--- a/internal/sheets/auth.go
+++ b/internal/sheets/auth.go
@@ -169,6 +169,15 @@ func splitOwners(raw string) []string {
return out
}
+// keymailTestServers is auth.Config.KeymailServers, and nil outside
+// this package's tests. From rastrillo v0.45.0 an unlisted Keymail
+// server is dialed only at a public address, by a client cloned from
+// http.DefaultTransport; the tests' in-process Keymail fixtures
+// (keymailtest) answer behind a wrapped DefaultTransport at a name
+// nothing resolves, so TestMain lists their host here, and auth reaches
+// them through its listed-servers guard instead.
+var keymailTestServers []string
+
// NewAuth wires the sign-in flow. Exactly one per process: auth's
// underlying flow carries rate-limiter state on the value, so one per
// request would get a fresh empty budget every time and rate-limit
@@ -234,7 +243,11 @@ func NewAuth(db *sql.DB, env AuthEnv, logger *slog.Logger, app *App) (*auth.Auth
// offer sign-in, and has to be told it worked.
SignedInPath: signedInPath,
Subject: chrome.EmailSubject("Sheets"),
- Logger: logger,
+ // nil in every deployment: rastrillo's default, any server an
+ // address's own _keymail delegation names, dialed only at a
+ // public address. Only the tests list one (keymailTestServers).
+ KeymailServers: keymailTestServers,
+ Logger: logger,
})
if err != nil {
queue.close()
diff --git a/internal/sheets/keymail_signin_test.go b/internal/sheets/keymail_signin_test.go
index 9311d0c..9c68ff4 100644
--- a/internal/sheets/keymail_signin_test.go
+++ b/internal/sheets/keymail_signin_test.go
@@ -7,6 +7,7 @@ import (
"net/http/httptest"
"net/url"
"os"
+ "os/exec"
"regexp"
"strings"
"testing"
@@ -20,6 +21,11 @@ import (
// registers answer HTTPS (keymailtest). Before it, every POST /signin
// in this suite classified its address against the real network.
func TestMain(m *testing.M) {
+ if os.Getenv(asDeployedEnv) == "1" {
+ // TestAuthIsBuiltAsDeployed's child: no fixtures, no list.
+ os.Exit(m.Run())
+ }
+ keymailTestServers = []string{keymailHost}
restore, err := keymailtest.Install()
if err != nil {
fmt.Fprintln(os.Stderr, "keymailtest.Install:", err)
@@ -254,3 +260,30 @@ func TestKeymailRefusalIsTheDoor(t *testing.T) {
t.Fatal("anybody can show the refusal by visiting /signin?err=refused")
}
}
+
+const asDeployedEnv = "SHEETS_TEST_AUTH_AS_DEPLOYED"
+
+// TestAuthIsBuiltAsDeployed: every other test here lists its Keymail
+// fixture's host (keymailTestServers), so auth takes its listed-servers
+// path. A deployment lists none, and from rastrillo v0.45.0 that path
+// builds a public-address-only client from http.DefaultTransport. This
+// builds the app that way, in a child process with neither the list nor
+// keymailtest's transport, and opens the door.
+func TestAuthIsBuiltAsDeployed(t *testing.T) {
+ if os.Getenv(asDeployedEnv) != "1" {
+ cmd := exec.Command(os.Args[0], "-test.run=^TestAuthIsBuiltAsDeployed$", "-test.count=1")
+ cmd.Env = append(os.Environ(), asDeployedEnv+"=1")
+ if out, err := cmd.CombinedOutput(); err != nil {
+ t.Fatalf("built as deployed: %v\n%s", err, out)
+ }
+ return
+ }
+ if keymailTestServers != nil {
+ t.Fatal("the child lists Keymail servers; it is meant to be built as deployed")
+ }
+ app, _ := appWithRecorder(t)
+ rec := do(t, app, httptest.NewRequest(http.MethodGet, "/signin", nil))
+ if rec.Code != http.StatusOK {
+ t.Fatalf("GET /signin: %d", rec.Code)
+ }
+}
diff --git a/internal/sheets/rhythm_browser_test.go b/internal/sheets/rhythm_browser_test.go
new file mode 100644
index 0000000..4be5bcf
--- /dev/null
+++ b/internal/sheets/rhythm_browser_test.go
@@ -0,0 +1,119 @@
+//go:build browser
+
+package sheets
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/estilo.git/googleimport"
+ "amadan.net/rastrillo/fiesta/check/rhythm"
+ "amadan.net/rastrillo/rastrillo/harness"
+ "github.com/chromedp/cdproto/emulation"
+ "github.com/chromedp/chromedp"
+)
+
+// TestEveryScreenKeepsTheRhythm: each of Sheets' own screens, read by
+// Fiesta's rhythm audit (Paul, 2026-11-22: "Can we somehow put
+// something in place to avoid weird spacing issues like this in
+// future?"), served through the production stack. Every gap between
+// two of a page's blocks is a step of the spacing scale, no text rests
+// on a control, and every heading sits closer to its own content than
+// to what comes before it, at a desktop width and a phone's.
+//
+// The audit reads around what is not the page's to space: the grid
+// (Jspreadsheet's canvas, its toolbar, menus and tab strip, which have
+// a density of their own) and the cells of the scriptless table view,
+// which are the sheet's.
+func TestEveryScreenKeepsTheRhythm(t *testing.T) {
+ app, cookies := signIn(t)
+ s, cells := newSheet(t, app, cookies, "Quarterly plan")
+ postCell(t, app, cookies, cells, `{"r":0,"c":0,"raw":"Revenue"}`)
+ // A workbook whose report has lines, so the report's list is read.
+ report := importWorkbook(t, app, cookies, googleWorkbook(t, googleRows))
+
+ // The import page with Google Drive configured: its section is
+ // drawn only then.
+ google := New(Config{DB: app.db, Auth: app.auth, Sealer: app.sealer, Origin: testOrigin, Admit: app.admit,
+ GoogleImport: googleimport.Config{ClientID: "123456789-client.apps.googleusercontent.com", APIKey: "AIzaPublicBrowserKey123456789", AppID: "123456789"}})
+
+ // Both instances on one origin: a page asked for with
+ // ?instance=google, and what it loads, are the Google one's.
+ served, googleServed := productionHandler(t, app), productionHandler(t, google)
+ rig := harness.New(t, func(origin string) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.Query().Get("instance") == "google" || strings.Contains(r.Header.Get("Referer"), "instance=google") {
+ googleServed.ServeHTTP(w, r)
+ return
+ }
+ served.ServeHTTP(w, r)
+ })
+ })
+ // Each screen is loaded once, at a desktop width, and read there and
+ // again at a phone's. ready is a selector only that screen draws, the
+ // browser must still be on path when it is read (a lost session
+ // lands on the sign-in door, whose rhythm is not this page's), and
+ // main must hold at least blocks children, so a page that drew
+ // nothing cannot pass by having nothing to measure.
+ audit := func(name, path, ready string, blocks int, skip []string) {
+ t.Helper()
+ for i, width := range []int64{1280, 390} {
+ ctx, cancel := context.WithTimeout(rig.Context(), 30*time.Second)
+ var found []rhythm.Finding
+ var at string
+ var drawn int
+ actions := []chromedp.Action[chromedp.Void]{
+ command(emulation.SetDeviceMetricsOverride, emulation.SetDeviceMetricsOverrideParams{Width: width, Height: 900, DeviceScaleFactor: 1}),
+ }
+ if i == 0 {
+ actions = append(actions, chromedp.Navigate(rig.Origin+path))
+ }
+ actions = append(actions,
+ chromedp.WaitVisible(chromedp.CSS(ready)),
+ evalInto(&at, `location.pathname + location.search`),
+ evalInto(&drawn, `[...document.querySelector('main').children].filter(e => e.getClientRects().length > 0).length`),
+ evalInto(&found, rhythm.Expression("main", rhythm.Options{Skip: skip})))
+ err := chromedp.Do(ctx, actions...)
+ cancel()
+ if err != nil {
+ t.Fatalf("%s at %dpx: %v", name, width, err)
+ }
+ if at != path {
+ t.Fatalf("%s: the browser is at %s, not %s", name, at, path)
+ }
+ if drawn < blocks {
+ t.Fatalf("%s at %dpx: main draws %d blocks, want at least %d", name, width, drawn, blocks)
+ }
+ if len(found) > 0 {
+ t.Errorf("%s at %dpx: %s", name, width, rhythm.Report(found))
+ }
+ }
+ }
+
+ audit("the sign-in door", "/signin", `[estilo-signin-screen] input[name="address"]`, 1, nil)
+
+ var set []chromedp.Action[chromedp.Void]
+ for _, c := range cookies {
+ set = append(set, setCookie(rig.Origin, c))
+ }
+ rig.Run(set...)
+
+ sheet := fmt.Sprintf("/sheets/%d", s.ID)
+ audit("the list", "/sheets", `[data-sheet-list]`, 2, nil)
+ // The sheet is the grid and its chrome, all of it a component's
+ // own: what is left is the formula row and the notices.
+ audit("the sheet", sheet, `td[data-x="0"][data-y="0"]`, 1,
+ []string{"[data-sheet-grid]", "[data-menubar]", "[data-toolbar]", "[data-tabstrip]"})
+ audit("share", sheet+"/share", `#role`, 6, nil)
+ audit("comments", sheet+"/comments", `main textarea[name], main form[rst-form]`, 3, nil)
+ audit("history", sheet+"/history", `main form[action$="/undo"]`, 3, nil)
+ audit("the table view", sheet+"/table", `table[data-cell-table]`, 3, []string{"table[data-cell-table]"})
+ audit("import", "/sheets/import", `main input[type=file]`, 2, nil)
+ audit("an import report", report, `[data-import-report]`, 3, nil)
+
+ audit("import, with Google Drive", "/sheets/import?instance=google", `main [estilo-google-import]`, 3, nil)
+}
diff --git a/internal/sheets/signin_browser_test.go b/internal/sheets/signin_browser_test.go
index 551d89a..fff8571 100644
--- a/internal/sheets/signin_browser_test.go
+++ b/internal/sheets/signin_browser_test.go
@@ -144,7 +144,7 @@ func TestSmartDoorInABrowser(t *testing.T) {
{name: "step-up", path: "/signin?reauth=1", heading: "Sign in to Sheets"},
{name: "sent", path: "/signin?sent=1", heading: "Check your email"},
{name: "confirm", path: confirm, heading: "Sign in to Sheets"},
- {name: "continuation", path: continuePreviewPath, heading: "Taking you to Keymail"},
+ {name: "continuation", path: continuePreviewPath, heading: "Signing you in"}, // rastrillo v0.45.0 never names Keymail
{name: "signed out", path: "/signed-out", heading: "You’re signed out"},
} {
mu.Lock()
diff --git a/internal/sheets/signin_door_states_test.go b/internal/sheets/signin_door_states_test.go
index ab3e73c..27a53cf 100644
--- a/internal/sheets/signin_door_states_test.go
+++ b/internal/sheets/signin_door_states_test.go
@@ -65,13 +65,14 @@ func TestSmartDoorStatesWithHome(t *testing.T) {
not: []string{">Email</span>"}},
{name: "Keymail remembered", path: "/signin",
record: &lastsignin.Record{Method: lastsignin.MethodKeymail, Address: "bob@example.com"},
- want: []string{"Continue to Keymail", `name="expect" value="keymail"`, "as <bdi>bob@example.com</bdi>", otherWays}},
+ // rastrillo v0.45.0: the door never names Keymail.
+ want: []string{"Continue as <bdi>bob@example.com</bdi>", `name="expect" value="keymail"`, otherWays}},
{name: "problem", path: "/signin?err=rate", record: oficina,
want: []string{"Too many tries. Try again in a few minutes.", emailField},
not: []string{oficinaButton},
title: "Problem signing in to Sheets"},
{name: "a failed Keymail keeps force", path: "/signin?err=keymail&force=1",
- want: []string{"Keymail couldn't confirm it's you.", `name="force" value="1"`, "Send me a link instead"}},
+ want: []string{"We couldn't confirm it's you.", `name="force" value="1"`, "Send me a link instead"}},
{name: "sent", path: "/signin?sent=1",
want: []string{"Check your email", "We sent a link to your inbox.", "Use a different email"},
not: []string{oficinaButton, emailField},
diff --git a/internal/sheets/static/brand/brand.css b/internal/sheets/static/brand/brand.css
index 27e25ad..475fb08 100644
--- a/internal/sheets/static/brand/brand.css
+++ b/internal/sheets/static/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/internal/sheets/static/sheets.css b/internal/sheets/static/sheets.css
index 05fca0f..85704b1 100644
--- a/internal/sheets/static/sheets.css
+++ b/internal/sheets/static/sheets.css
@@ -71,7 +71,8 @@
* inline padding as estilo's items, so their labels line up with the
* item text above and below. */
[data-menubar] [estilo-menu] > [data-size-form] {
- padding: var(--rst-sp-1) var(--estilo-item-padding-inline, 0.65rem);
+ /* spacing-allow: estilo's item inset, declared in estilo's menu.css, which this check does not read */
+ padding: var(--rst-sp-1) var(--estilo-item-padding-inline, var(--rst-sp-3));
}
/* ── The keyboard shortcuts dialog ──────────────────────────────────
@@ -161,7 +162,7 @@
display: inline-flex;
font: inherit;
font-size: var(--rst-fs-sm);
- gap: 0.1rem;
+ gap: 0.1rem; /* spacing-allow: a tool's glyph and its caret read as one mark */
justify-content: center;
min-block-size: 1.75rem;
min-inline-size: 1.75rem;
@@ -899,6 +900,14 @@
z-index: 50;
}
+/* The overlay is position: fixed, but it is also <main>'s child, and
+ * the stack gives every child after the first a block-start margin,
+ * which a fixed box still takes: it opened 4px below the window's top.
+ * (0,3,0), as the stack's own rule, and later. */
+[rst-stack] > [data-drop-page][rst-modal-overlay] {
+ margin: 0;
+}
+
[data-drop-page] [rst-modal-panel] {
max-width: 24rem;
transition: border-color 120ms ease;
@@ -1145,7 +1154,7 @@
[data-cell-format] select {
font-size: var(--rst-fs-xs);
- padding-block: 0.15rem;
+ padding-block: var(--rst-sp-1);
}
/* ── The list's thumbnails ───────────────────────────────────────────
@@ -1173,16 +1182,11 @@
* never had — not to drop the semantics that make the list announce as
* one to a screen reader.
*
- * The block margin is REPLACED rather than removed. Nothing in
- * rastrillo stacks the children of [rst-page] — there is no
- * `> * + *` rule — so what separated this card from the import form
- * above it was the <ul>'s own UA `margin-block: 1em`. Zeroing the
- * shorthand would have closed that gap as a side effect of fixing the
- * padding, so the margin is restated from the token scale, which is
- * where every other gap on the page comes from. */
+ * It sets no block margin: <main> is Fiesta's stack (layout.html),
+ * which spaces the list from whatever is above and below it, and whose
+ * child rule zeroes the <ul>'s UA `margin-block: 1em` anyway. */
[data-sheet-list] {
list-style: none;
- margin-block: var(--rst-sp-4);
margin-inline: 0;
padding: 0;
}
@@ -1214,7 +1218,6 @@
* columns directly, so the narrow rule restates them. */
[data-share-list] {
list-style: none;
- margin-block: var(--rst-sp-3) var(--rst-sp-4);
margin-inline: 0;
padding: 0;
}
@@ -1318,3 +1321,22 @@
display: inline;
margin-inline-start: var(--rst-sp-2);
}
+
+/* ── Import from Google Drive ─────────────────────────────────────────
+ *
+ * estilo's chooser (estilo-google-import) brings markup and no
+ * stylesheet, so its paragraphs kept the browser's 1em margins: its
+ * disclosure sat 24px under its heading and its status 60-odd px under
+ * the disclosure, around the Choose button the script reveals. Spaced
+ * here as a column on the scale, the buttons at their own width, until
+ * estilo spaces it itself. */
+[estilo-google-import] {
+ align-items: flex-start;
+ display: flex;
+ flex-direction: column;
+ gap: var(--rst-sp-3);
+}
+
+[estilo-google-import] p {
+ margin: 0;
+}
diff --git a/internal/sheets/static/tokens.css b/internal/sheets/static/tokens.css
index 3ae9664..07f8b10 100644
--- a/internal/sheets/static/tokens.css
+++ b/internal/sheets/static/tokens.css
@@ -2476,6 +2476,90 @@ small.rst-field__hint, small[rst-field-hint] { display: block; font-size: var(--
and every caller writes by hand, is rst-form-bar now. */
.rst-form-foot, [rst-form-foot] { display: flex; gap: var(--rst-sp-3); margin-block-start: var(--rst-sp-3); }
+/* ── stack: a page's vertical rhythm ──────────────────────────────────
+ The blocks a screen is written in, a heading, a paragraph, a hint, a
+ card, a row of buttons, are spaced by the stack they sit in and by
+ nothing else. Hand-rolled margins gave every screen its own rhythm:
+ a heading further from its own text than from the section before
+ it, a hint resting on the button under it. So a stack is a flex
+ column, where no margin collapses, every child's own block margins
+ are zeroed, and the space before each child is read off one table
+ by what it is and what it follows (DESIGN.md, "Spacing"):
+
+ after a heading (h1 to h6) --rst-sp-2
+ before an actions row, a button --rst-sp-4
+ a label or hint, then its input, or an
+ input, then its hint --rst-sp-2
+ before h1, h2 or a section, or after
+ the page header --rst-sp-5
+ before h3 to h6 --rst-sp-4
+ anything else --rst-sp-3
+
+ Higher in the table wins. Each relation sets its own custom property
+ on the child, and the one margin rule reads them in the table's
+ order through var() fallbacks, so which rule wins is written in one
+ place rather than left to specificity. Every child resets all five
+ first, so a nested stack's child never inherits its parent's answer.
+ rst-section marks a child that opens a new section; a section that
+ holds blocks of its own is a stack too, <section rst-stack
+ rst-section>.
+
+ The column's gap is the table's smallest step, --rst-sp-2, and a
+ child's block-start margin is the rest of its answer. The gap is
+ the floor: it falls only between children that are drawn, so a
+ [hidden] child, which a sibling selector cannot see past, costs the
+ block after it its relation but never leaves it touching. A hidden
+ input, a form's CSRF field, is passed over the same way, so the
+ first block after one still opens the stack flush. */
+.rst-stack, [rst-stack] { display: flex; flex-direction: column; gap: var(--rst-sp-2); }
+.rst-stack > :not([hidden]), [rst-stack] > :not([hidden]) {
+ --rst-stack-actions: initial;
+ --rst-stack-heading: initial;
+ --rst-stack-control: initial;
+ --rst-stack-section: initial;
+ --rst-stack-sub: initial;
+ margin-block: 0;
+}
+.rst-stack > :not([hidden], [type="hidden"]) + :not([hidden]), [rst-stack] > :not([hidden], [type="hidden"]) + :not([hidden]) {
+ margin-block-start: calc(var(--rst-stack-heading, var(--rst-stack-actions, var(--rst-stack-control, var(--rst-stack-section, var(--rst-stack-sub, var(--rst-sp-3)))))) - var(--rst-sp-2));
+}
+/* A column stretches its children across; a button or a picture keeps
+ its own width. */
+.rst-stack > button, [rst-stack] > button, .rst-stack > .rst-btn, [rst-stack] > [rst-btn], .rst-stack > img, [rst-stack] > img { align-self: flex-start; }
+.rst-stack > :not([hidden], [type="hidden"]) + h3, [rst-stack] > :not([hidden], [type="hidden"]) + h3,
+.rst-stack > :not([hidden], [type="hidden"]) + h4, [rst-stack] > :not([hidden], [type="hidden"]) + h4,
+.rst-stack > :not([hidden], [type="hidden"]) + h5, [rst-stack] > :not([hidden], [type="hidden"]) + h5,
+.rst-stack > :not([hidden], [type="hidden"]) + h6, [rst-stack] > :not([hidden], [type="hidden"]) + h6 { --rst-stack-sub: var(--rst-sp-4); }
+.rst-stack > :not([hidden], [type="hidden"]) + h1, [rst-stack] > :not([hidden], [type="hidden"]) + h1,
+.rst-stack > :not([hidden], [type="hidden"]) + h2, [rst-stack] > :not([hidden], [type="hidden"]) + h2,
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-section, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-section],
+.rst-stack > .rst-page-header + :not([hidden]), [rst-stack] > [rst-page-header] + :not([hidden]) { --rst-stack-section: var(--rst-sp-5); }
+.rst-stack > label + input:not([hidden]), [rst-stack] > label + input:not([hidden]),
+.rst-stack > label + select:not([hidden]), [rst-stack] > label + select:not([hidden]),
+.rst-stack > label + textarea:not([hidden]), [rst-stack] > label + textarea:not([hidden]),
+.rst-stack > .rst-field__help + input:not([hidden]), [rst-stack] > [rst-field-help] + input:not([hidden]),
+.rst-stack > .rst-field__help + select:not([hidden]), [rst-stack] > [rst-field-help] + select:not([hidden]),
+.rst-stack > .rst-field__help + textarea:not([hidden]), [rst-stack] > [rst-field-help] + textarea:not([hidden]),
+.rst-stack > input + .rst-field__help, [rst-stack] > input + [rst-field-help],
+.rst-stack > select + .rst-field__help, [rst-stack] > select + [rst-field-help],
+.rst-stack > textarea + .rst-field__help, [rst-stack] > textarea + [rst-field-help] { --rst-stack-control: var(--rst-sp-2); }
+.rst-stack > h1 + :not([hidden]), [rst-stack] > h1 + :not([hidden]),
+.rst-stack > h2 + :not([hidden]), [rst-stack] > h2 + :not([hidden]),
+.rst-stack > h3 + :not([hidden]), [rst-stack] > h3 + :not([hidden]),
+.rst-stack > h4 + :not([hidden]), [rst-stack] > h4 + :not([hidden]),
+.rst-stack > h5 + :not([hidden]), [rst-stack] > h5 + :not([hidden]),
+.rst-stack > h6 + :not([hidden]), [rst-stack] > h6 + :not([hidden]) { --rst-stack-heading: var(--rst-sp-2); }
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-actions, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-actions],
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-form-foot, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-form-foot],
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-form-actions, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-form-actions],
+.rst-stack > :not([hidden], [type="hidden"]) + button, [rst-stack] > :not([hidden], [type="hidden"]) + button,
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-btn, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-btn] { --rst-stack-actions: var(--rst-sp-4); }
+/* The actions row: buttons, links styled as buttons, and the one-button
+ forms a POST action needs, side by side and wrapping on a phone. A
+ form stays a box (display: contents would make it one no driver can
+ see), and a one-button form is as wide as its button. */
+.rst-actions, [rst-actions] { align-items: center; display: flex; flex-wrap: wrap; gap: var(--rst-sp-2); }
+
@media (prefers-reduced-motion: reduce) {
.rst-switch__track, [rst-switch-track], .rst-switch[data-rst-settle] .rst-switch__track, [rst-switch][data-rst-settle] [rst-switch-track], .rst-tblock > .rst-tblock__head[data-rst-settle] > .rst-switch__track, [rst-tblock] > [rst-tblock-head][data-rst-settle] > [rst-switch-track] { transition: none; }
}
diff --git a/internal/sheets/templates/import.html b/internal/sheets/templates/import.html
index e9ef46f..933809a 100644
--- a/internal/sheets/templates/import.html
+++ b/internal/sheets/templates/import.html
@@ -63,7 +63,7 @@ the import finishes.</p>
scripting off the component says how to download from Google and
use the form instead. */}}
{{if .Data.Google.Enabled}}
-<section>
+<section rst-stack rst-section>
<h2>From Google Drive</h2>
{{template "estilo-google-import" .Data.Google}}
</section>
diff --git a/internal/sheets/templates/import_report.html b/internal/sheets/templates/import_report.html
index 68f63ef..ba6c832 100644
--- a/internal/sheets/templates/import_report.html
+++ b/internal/sheets/templates/import_report.html
@@ -10,7 +10,7 @@
{{/* Always shown, whatever the report holds: a report can only list
what it detected, so the page says what import carries at all
rather than let an empty list read as "everything". */}}
-<section>
+<section rst-stack rst-section>
<h2>What import carries</h2>
<p>The first worksheet's values; formulas Sheets can calculate; number
formats written as format codes; fill and text colours; bold, italic and
@@ -22,12 +22,12 @@ original file.</p>
{{template "callout" (dict "Body" (printf "Only the first worksheet came across. %d other worksheet(s) were left out." .Data.OmittedWorksheets) "Tone" "warning")}}
{{end}}
-<section>
+<section rst-stack rst-section>
<h2>What changed or was left out</h2>
{{if .Data.Lines}}
-<ul data-import-report>
+<ul rst-stack data-import-report>
{{range .Data.Lines}}
-<li>
+<li rst-stack>
<p><strong>{{.Title}}</strong>: {{.Count}}</p>
{{with .Detail}}<p>{{.}}</p>{{end}}
{{if .Cells}}<p rst-field-help>Cells: {{range $i, $c := .Cells}}{{if $i}}, {{end}}{{$c}}{{end}}{{if .More}}, and {{.More}} more{{end}}.</p>{{end}}
diff --git a/internal/sheets/templates/layout.html b/internal/sheets/templates/layout.html
index 8cee111..1ebd150 100644
--- a/internal/sheets/templates/layout.html
+++ b/internal/sheets/templates/layout.html
@@ -58,11 +58,14 @@
the grid's <main> taking the rest (estilo chrome.css). That is why
the grid can fill the screen without this app subtracting a bar
height it would have to guess. The "main" block lets the grid page
- supply its own <main>, without rst-page's padding and max width. */}}
+ supply its own <main>, without rst-page's padding and max width.
+ Every other page's <main> is Fiesta's stack (rst-stack): it spaces
+ the page's blocks, its header, headings, prose, forms and buttons,
+ by one table, so no page sets a margin between them by hand. */}}
<div estilo-shell{{with .Frame.Shell}}="{{.}}"{{end}}>
<a rst-skip href="#main">{{.Frame.Chrome.Labels.Skip}}</a>
{{template "estilo-bar" .Frame.Chrome}}
-{{block "main" .}}<main rst-page id="main">{{template "content" .}}</main>{{end}}
+{{block "main" .}}<main rst-page rst-stack id="main">{{template "content" .}}</main>{{end}}
</div>
{{if .Frame.Shortcuts}}{{template "shortcuts-dialog" .Frame.Keys}}{{end}}
</body>