Calendar's 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 four views is Fiesta's stack (layout.html's <main rst-stack>), button rows are rst-actions, and the hand margins the stack replaces are gone. - Spacing check: `make spacing` in `make ci` (ci.d/25-spacing), skipping only rastrillo's tokens.css. 5 declarations off the scale before, 0 after; 4 allowances, all the month grid's 2px cell internals. - Rhythm audit: TestEveryScreenKeepsTheRhythm in `make browser`, through the production stack at 1280 and 390px, around the grids: every view, event and series pages, settings, reminders, calendars and a subscription link, import and its result, booking pages, a 404, and the stranger's booking from the page to a cancellation. 17 findings on origin/main's templates and CSS, 0 after. - rastrillo v0.45.0 (Paul's ruling), Fiesta v1.6.1, estilo 6238a47 (writeestilo), tokens.css re-copied, credits regenerated. The test mains list their Keymail fixtures in KeymailServers (SetKeymailServersForTest; nil in production) and TestAuthIsBuiltAsDeployed builds auth as a deployment does; the door's Keymail copy is rastrillo's own. Reported to rastrillo as discussion 402. Review: Claude Fable, no High; 3 Medium and the Lows fixed, then a narrow re-review, fixed. make ci, make browser and hub CI green. Not deployed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from feat/rhythm into main.
26 files changed,
+597
−100
.amadan/ci.d/25-spacing+2 −0AGENTS.md+20 −3Makefile+17 −3README.md+1 −1go.mod+8 −4go.sum+8 −6internal/calendar/auth.go+14 −1internal/calendar/auth_deployed_test.go+56 −0internal/calendar/credits/notices.json+2 −2internal/calendar/keymail_signin_test.go+1 −0internal/calendar/signin_browser_test.go+1 −1internal/calendar/signin_door_states_test.go+3 −2internal/calendar/static/brand/brand.css+1 −1internal/calendar/static/calendar.css+4 −13internal/calendar/static/chrome.css+104 −49internal/calendar/static/menu.css+8 −8internal/calendar/static/tokens.css+84 −0internal/calendar/templates/book_gone.html+1 −1internal/calendar/templates/book_manage.html+1 −1internal/calendar/templates/event.html+1 −1internal/calendar/templates/layout.html+4 −1internal/calendar/templates/reminders.html+1 −1internal/calendar/templates/share.html+1 −1internal/calendar/testing.go+8 −0internal/calendartest/main_test.go+3 −0internal/calendartest/rhythm_browser_test.go+243 −0
CI passed — run details
CI log
=== vet === go vet ./... go vet -tags browser ./internal/calendartest/ ./internal/calendar/ === fmt === === spacing === go tool fiesta spacing -skip tokens.css internal/calendar/static === test === go test ./... ok amadan.net/oficina/calendar/cmd/calendar 0.143s ? amadan.net/oficina/calendar/cmd/calendar-contract [no test files] ok amadan.net/oficina/calendar/internal/calendar 28.656s ? amadan.net/oficina/calendar/internal/calendar/icons [no test files] ? amadan.net/oficina/calendar/internal/calendar/keymailtest [no test files] ? amadan.net/oficina/calendar/internal/calendar/seal [no test files] ? amadan.net/oficina/calendar/internal/calendar/teamstate [no test files] ok amadan.net/oficina/calendar/internal/calendartest 4.045s ok amadan.net/oficina/calendar/internal/guardstest 0.101s ? amadan.net/oficina/calendar/scripts/writeestilo [no test files] === migration-check === go tool rastrillo migration check rastrillo migration check: models and migrations agree
diff --git a/.amadan/ci.d/25-spacing b/.amadan/ci.d/25-spacing| new file mode 100755 |
| index 0000000..53c0bd3 |
| --- /dev/null |
| +++ b/.amadan/ci.d/25-spacing |
| @@ -0,0 +1,2 @@ |
| +#!/bin/sh |
| +exec make spacing |
diff --git a/AGENTS.md b/AGENTS.md| index 98b833f..b64f468 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -226,6 +226,14 @@ relying on remembering one, make it a test instead. |
| `about:blank` without one. `TestBrowserWalk` drives now, but fails |
| at its first sign-in (no link is mailed after its form submit), and |
| is not in `make browser`; do not assume it ran. |
| +- `make browser` also runs `TestEveryScreenKeepsTheRhythm`: Fiesta's |
| + rhythm audit over every screen at 1280 and 390px, through the |
| + production stack, reading around the calendar grids. Every page but |
| + the four views is Fiesta's stack (`<main rst-stack>`, layout.html): |
| + a page adds no margins between its blocks, and its button rows are |
| + `rst-actions`. `make spacing` (in `make ci`) holds every margin, |
| + padding and gap in Calendar's CSS to `var(--rst-sp-N)` or a |
| + `/* spacing-allow: why */`. |
| - **A control styled with `font: inherit` under a selector heavier than |
| a bare `input`** loses tokens.css's 16px-on-touch rule. Restate |
| `font-size: max(1rem, 1em)` for it under `(pointer: coarse)`, as |
| @@ -253,7 +261,16 @@ relying on remembering one, make it a test instead. |
| path, doctor compares nothing and `--fix` refuses**: copy the drifted |
| files out of the new module's `ui/` by hand, and |
| TestVendoredAssetsMatchTheLibrary says which. That is how v0.42.0 came |
| - in (smart door, 2026-11-22: tokens.css, select.js, datetime.js). The |
| + in (smart door, 2026-11-22: tokens.css, select.js, datetime.js), and |
| + v0.45.0 (the spacing rollout, 2026-11-22: tokens.css, which carries |
| + Fiesta's stack). |
| +- **From v0.45.0 an unlisted Keymail server is dialed only at a public |
| + address**, by a client rastrillo clones from `http.DefaultTransport`. |
| + The tests' in-process Keymail fixtures (`keymailtest`) wrap that |
| + transport, so the test mains list their servers with |
| + `SetKeymailServersForTest` and auth reaches them through its |
| + listed-servers guard. Deployments leave `KeymailServers` nil. The door |
| + never names Keymail from v0.45.0: its words are rastrillo's. The |
| library's newer scripts (fiesta.js, live.js, anchor.js, light.js, |
| transition.js, copy.js) are not linked by the layout and are listed in |
| `vendoredIsMine` as deliberately absent. doctor's template checks are |
| @@ -389,8 +406,8 @@ Squash-merge only when the work is done, it is approved, and CI is |
| actually green — checked, not assumed. Review on a deployed canary, |
| never localhost. |
| -`make ci` is the one gate: vet, gofmt, tests, migration check. The same |
| -definition CI runs. Run it before every push. |
| +`make ci` is the one gate: vet, gofmt, the spacing check, tests, |
| +migration check. The same definition CI runs. Run it before every push. |
| ## Review |
diff --git a/Makefile b/Makefile| index 520efa3..c88a23c 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -25,7 +25,7 @@ RELEASE_BIN := releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH) |
| # make release VERSION=v0.1.0 |
| VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null) |
| -.PHONY: build release version-check deps test vet fmt-check migration-check ci browser |
| +.PHONY: build release version-check deps test vet fmt-check spacing migration-check ci browser |
| # build is the compile check: with more than one package matched, go |
| # build discards the output, so this catches a broken package without |
| @@ -113,6 +113,16 @@ vet: deps |
| fmt-check: |
| @out=$$(gofmt -l .); if [ -n "$$out" ]; then echo "gofmt needed:"; echo "$$out"; exit 1; fi |
| +# Fiesta's spacing check (Paul, 2026-11-22: no ad-hoc spacing): every |
| +# margin, padding and gap in Calendar's 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 not ours to |
| +# space. estilo's files (theme, busy, chrome, menu, sky, base, written by |
| +# scripts/writeestilo) are read too: they are on the scale, and a bump |
| +# that brings one that is not should fail here, not pass unseen. |
| +spacing: |
| + go tool fiesta spacing -skip tokens.css internal/calendar/static |
| + |
| # A step of its own, not folded into another target's recipe: ci.d/ |
| # steps each exec one make target, so migration-check needs its own |
| # name to get its own reported step on a runner with step support. |
| @@ -133,7 +143,7 @@ migration-check: |
| # fails the build the moment models.go and migrations/ disagree, |
| # instead of at boot on whatever machine notices next. If the app |
| # declares manifest resources, also add: rastrillo generate --check |
| -ci: vet fmt-check test migration-check |
| +ci: vet fmt-check spacing test migration-check |
| # The browser gate: the quick-add box driven in a real Chromium, with |
| # script and then with JavaScript disabled. |
| @@ -150,13 +160,17 @@ ci: vet fmt-check test migration-check |
| # that is unset. The CSP check is the one served through rastrillo's |
| # production stack, so it is the one that sees the real policy. |
| # |
| +# TestEveryScreenKeepsTheRhythm is Fiesta's rhythm audit over every |
| +# screen at 1280 and 390px, through the production stack, reading |
| +# around the calendar grids themselves. |
| +# |
| # TestSmartDoorInABrowser (internal/calendar) is the sign-in door in every |
| # state at 320px and 1280px: no sideways scroll, 24px targets, the Oficina |
| # glyph drawn. It forces the light scheme itself. On macOS, run with |
| # TMPDIR=/tmp if a unix socket path is too long. |
| browser: |
| npm install --no-save playwright |
| - RASTRILLO_CHROME="$(RASTRILLO_CHROME)" go test -tags browser -run 'InARealBrowser|OnTap|OnANarrowScreen|SurviveTheProductionCSP' ./internal/calendartest/ |
| + RASTRILLO_CHROME="$(RASTRILLO_CHROME)" go test -tags browser -run 'InARealBrowser|OnTap|OnANarrowScreen|SurviveTheProductionCSP|KeepsTheRhythm' ./internal/calendartest/ |
| RASTRILLO_CHROME="$(RASTRILLO_CHROME)" go test -tags browser -run 'SmartDoorInABrowser' ./internal/calendar/ |
| # The Playwright cache's Chromium: older caches hold Chromium.app, newer |
diff --git a/README.md b/README.md| index 605caca..4c6e632 100644 |
| --- a/README.md |
| +++ b/README.md |
| @@ -107,7 +107,7 @@ times each link has been polled, because a feed is not free. |
| ## Running it |
| ```sh |
| -make ci # vet, gofmt, tests, migration check — the one gate |
| +make ci # vet, gofmt, spacing, tests, migration check — the one gate |
| make release # the stripped linux/arm64 binary |
| ``` |
diff --git a/go.mod b/go.mod| index da3c32b..4218aaf 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -7,14 +7,14 @@ toolchain go1.26.5 |
| require ( |
| amadan.net/oficina/home/connect v0.0.0-20261122114341-150d94e2370f |
| amadan.net/oficina/home/handoff v0.0.0-20261122114341-150d94e2370f |
| - amadan.net/rastrillo/rastrillo v0.42.0 |
| + amadan.net/rastrillo/rastrillo v0.45.0 |
| github.com/carlosframework/rastrillo v0.23.0 |
| github.com/chromedp/chromedp v0.21.0 |
| github.com/go-chi/chi/v5 v5.3.2 |
| gorm.io/gorm v1.31.2 |
| ) |
| -require amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803 |
| +require amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e |
| require ( |
| github.com/BurntSushi/toml v1.6.0 // indirect |
| @@ -43,11 +43,11 @@ require ( |
| amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816 |
| amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2 |
| amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2 |
| + amadan.net/rastrillo/fiesta v1.6.1 |
| amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3 |
| ) |
| require ( |
| - amadan.net/rastrillo/fiesta v1.5.0 // indirect |
| amadan.net/rastrillo/rastrillo/money v0.1.0 // indirect |
| github.com/google/jsonschema-go v0.4.3 // indirect |
| github.com/modelcontextprotocol/go-sdk v1.8.0 // indirect |
| @@ -58,10 +58,14 @@ require ( |
| github.com/tdewolff/parse/v2 v2.8.16 // indirect |
| github.com/yosida95/uritemplate/v3 v3.0.2 // indirect |
| golang.org/x/mod v0.38.0 // indirect |
| + golang.org/x/net v0.58.0 // indirect |
| golang.org/x/oauth2 v0.35.0 // indirect |
| golang.org/x/sync v0.22.0 // indirect |
| golang.org/x/time v0.15.0 // indirect |
| golang.org/x/tools v0.48.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 4d1861c..bc1e8ad 100644 |
| --- a/go.sum |
| +++ b/go.sum |
| @@ -1,7 +1,7 @@ |
| amadan.net/oficina/agent-access.git v0.0.0-20261025011012-4b94ff9e8a8d h1:bSsf1NXVhXTfLLB9J7a5v9CqzdKj8CALHZ6W3H7A/4M= |
| amadan.net/oficina/agent-access.git v0.0.0-20261025011012-4b94ff9e8a8d/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-20261122114341-150d94e2370f h1:gnH04Aq06V9RVdv2OSdg+MqluUzsXZcnzSC+fUZ8gxg= |
| amadan.net/oficina/home/connect v0.0.0-20261122114341-150d94e2370f/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= |
| @@ -86,6 +86,8 @@ golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= |
| golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= |
| golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= |
| golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= |
| +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= |
| +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= |
| golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= |
| golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= |
| golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= |
diff --git a/internal/calendar/auth.go b/internal/calendar/auth.go| index 9dd70f9..92ed731 100644 |
| --- a/internal/calendar/auth.go |
| +++ b/internal/calendar/auth.go |
| @@ -242,10 +242,23 @@ func newAuthPlugin(origin string, writer *sql.DB, instanceKey string, mailer mai |
| // (schema, assets, a form that needs JavaScript). |
| ProofOff: true, |
| Subject: chrome.EmailSubject("Calendar"), |
| - 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 tests list servers (keymailTestServers). |
| + KeymailServers: keymailTestServers, |
| + Logger: logger, |
| }) |
| } |
| +// keymailTestServers is rauth.Config.KeymailServers, and nil outside |
| +// 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 the test mains |
| +// list their host (SetKeymailServersForTest) and auth reaches them |
| +// through its listed-servers guard instead. |
| +var keymailTestServers []string |
| + |
| // authPages are the two pages auth asks the app for (newAuthPlugin). |
| type authPages struct { |
| refused func(http.ResponseWriter, *http.Request, rauth.Identity) |
diff --git a/internal/calendar/auth_deployed_test.go b/internal/calendar/auth_deployed_test.go| new file mode 100644 |
| index 0000000..8c373ed |
| --- /dev/null |
| +++ b/internal/calendar/auth_deployed_test.go |
| @@ -0,0 +1,56 @@ |
| +package calendar |
| + |
| +import ( |
| + "io" |
| + "log/slog" |
| + "net/http" |
| + "net/http/httptest" |
| + "os" |
| + "os/exec" |
| + "path/filepath" |
| + "testing" |
| +) |
| + |
| +const asDeployedEnv = "CALENDAR_TEST_AUTH_AS_DEPLOYED" |
| + |
| +// listKeymailFixtures is TestMain's first step. It lists the Keymail |
| +// fixture's host for every test here (SetKeymailServersForTest), except |
| +// in TestAuthIsBuiltAsDeployed's child, which it runs with no fixtures |
| +// and no list, and exits. |
| +func listKeymailFixtures(m *testing.M) { |
| + if os.Getenv(asDeployedEnv) == "1" { |
| + os.Exit(m.Run()) |
| + } |
| + SetKeymailServersForTest([]string{keymailHost}) |
| +} |
| + |
| +// TestAuthIsBuiltAsDeployed: every other test here lists its Keymail |
| +// fixture's host (SetKeymailServersForTest), 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") |
| + } |
| + a, err := New(Config{DBPath: filepath.Join(t.TempDir(), "calendar.db"), Env: "development", Origin: "https://calendar.example.test", Logger: slog.New(slog.NewTextHandler(io.Discard, nil))}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { a.Close() }) |
| + rec := httptest.NewRecorder() |
| + a.Handler().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "https://calendar.example.test/signin", nil)) |
| + if rec.Code != http.StatusOK { |
| + t.Fatalf("GET /signin: %d", rec.Code) |
| + } |
| +} |
diff --git a/internal/calendar/credits/notices.json b/internal/calendar/credits/notices.json| index b9fc4a6..4027f34 100644 |
| --- a/internal/calendar/credits/notices.json |
| +++ b/internal/calendar/credits/notices.json |
| @@ -35,7 +35,7 @@ |
| }, |
| { |
| "Name": "amadan.net/rastrillo/fiesta", |
| - "Version": "v1.5.0", |
| + "Version": "v1.6.1", |
| "SourceURL": "https://amadan.net/rastrillo/fiesta", |
| "Notices": [ |
| { |
| @@ -46,7 +46,7 @@ |
| }, |
| { |
| "Name": "amadan.net/rastrillo/rastrillo", |
| - "Version": "v0.42.0", |
| + "Version": "v0.45.0", |
| "SourceURL": "https://amadan.net/rastrillo/rastrillo", |
| "Notices": [ |
| { |
diff --git a/internal/calendar/keymail_signin_test.go b/internal/calendar/keymail_signin_test.go| index 256df17..5b33f94 100644 |
| --- a/internal/calendar/keymail_signin_test.go |
| +++ b/internal/calendar/keymail_signin_test.go |
| @@ -29,6 +29,7 @@ import ( |
| // query is answered NXDOMAIN and only the Keymail fixtures a test |
| // registers answer HTTPS (keymailtest). |
| func TestMain(m *testing.M) { |
| + listKeymailFixtures(m) |
| restore, err := keymailtest.Install() |
| if err != nil { |
| fmt.Fprintln(os.Stderr, "keymailtest.Install:", err) |
diff --git a/internal/calendar/signin_browser_test.go b/internal/calendar/signin_browser_test.go| index 81d6f8e..ef34f68 100644 |
| --- a/internal/calendar/signin_browser_test.go |
| +++ b/internal/calendar/signin_browser_test.go |
| @@ -173,7 +173,7 @@ func TestSmartDoorInABrowser(t *testing.T) { |
| {name: "step-up", path: "/signin?reauth=1", heading: "Sign in to Calendar"}, |
| {name: "sent", path: "/signin?sent=1", heading: "Check your email"}, |
| {name: "confirm", path: confirm, heading: "Sign in to Calendar"}, |
| - {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"}, |
| } { |
| for _, width := range []int64{320, 1280} { |
diff --git a/internal/calendar/signin_door_states_test.go b/internal/calendar/signin_door_states_test.go| index ac4e2e3..630786e 100644 |
| --- a/internal/calendar/signin_door_states_test.go |
| +++ b/internal/calendar/signin_door_states_test.go |
| @@ -70,7 +70,8 @@ func TestSmartDoorStatesWithHome(t *testing.T) { |
| not: []string{">Email</span>"}}, |
| {name: "Keymail remembered", path: "/signin", |
| record: &lastsignin.Record{Method: lastsignin.MethodKeymail, Address: "bob@example.test"}, |
| - want: []string{"Continue to Keymail", `name="expect" value="keymail"`, "as <bdi>bob@example.test</bdi>", otherWays}}, |
| + // rastrillo v0.45.0: the door never names Keymail. |
| + want: []string{"Continue as <bdi>bob@example.test</bdi>", `name="expect" value="keymail"`, otherWays}}, |
| {name: "problem", path: "/signin?err=expired", record: oficina, |
| want: []string{"That link has expired or was already used.", emailField}, |
| not: []string{oficinaButton}, |
| @@ -78,7 +79,7 @@ func TestSmartDoorStatesWithHome(t *testing.T) { |
| {name: "rate", path: "/signin?err=rate", |
| want: []string{"Too many tries. Try again in a few minutes.", emailField}}, |
| {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: "removed is team mode's alone", path: "/signin?err=removed", |
| want: []string{"Something went wrong. Try again."}, |
| not: []string{appProblem, signinRemoved}}, |
diff --git a/internal/calendar/static/brand/brand.css b/internal/calendar/static/brand/brand.css| index 27e25ad..475fb08 100644 |
| --- a/internal/calendar/static/brand/brand.css |
| +++ b/internal/calendar/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/calendar/static/calendar.css b/internal/calendar/static/calendar.css| index 2f6bad0..862f164 100644 |
| --- a/internal/calendar/static/calendar.css |
| +++ b/internal/calendar/static/calendar.css |
| @@ -112,7 +112,7 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| [cal-day-cell] { |
| display: flex; |
| flex-direction: column; |
| - gap: 2px; |
| + gap: 2px; /* spacing-allow: the month grid's chips, stacked tight so a 7.5rem day holds three and its "+N more" */ |
| height: 100%; |
| padding: var(--rst-sp-1); |
| } |
| @@ -128,7 +128,7 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| color: var(--rst-text-muted); |
| display: block; |
| font-size: var(--rst-fs-sm); |
| - padding: 2px; |
| + padding: 2px; /* spacing-allow: the day's number tucked into its cell's corner */ |
| text-decoration: none; |
| } |
| @@ -149,7 +149,7 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| [cal-more] { |
| color: var(--rst-text-muted); |
| font-size: var(--rst-fs-xs); |
| - padding-inline-start: 2px; |
| + padding-inline-start: 2px; /* spacing-allow: "+N more" sits on the day number's 2px inset, in the month grid's cell */ |
| } |
| /* ── Chips ─────────────────────────────────────────────────────── */ |
| @@ -168,7 +168,7 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| font-size: var(--rst-fs-sm); |
| gap: var(--rst-sp-1); |
| overflow: hidden; |
| - padding: 2px var(--rst-sp-1); |
| + padding: 2px var(--rst-sp-1); /* spacing-allow: a chip is one line of small text, the calendar's own unit in the month cell, the agenda and the day and week columns */ |
| text-decoration: none; |
| white-space: nowrap; |
| } |
| @@ -617,8 +617,6 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| padding-inline-start: var(--rst-sp-4); |
| } |
| -[cal-book-page] { margin-block-end: var(--rst-sp-4); } |
| - |
| [cal-book-page-body] { padding: var(--rst-sp-3); } |
| [cal-book-url] { font-size: var(--rst-fs-sm); overflow-wrap: anywhere; } |
| @@ -648,7 +646,6 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| display: flex; |
| flex-wrap: wrap; |
| gap: var(--rst-sp-2); |
| - margin-block-end: var(--rst-sp-4); |
| } |
| [cal-book-days] { list-style: none; margin: 0; padding: 0; } |
| @@ -660,7 +657,6 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| display: flex; |
| flex-wrap: wrap; |
| gap: var(--rst-sp-2); |
| - margin-block: var(--rst-sp-3); |
| } |
| [cal-book-details] { padding: var(--rst-sp-3); } |
| @@ -670,7 +666,6 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| display: flex; |
| flex-wrap: wrap; |
| gap: var(--rst-sp-2); |
| - margin-block: var(--rst-sp-4) var(--rst-sp-2); |
| } |
| /* The booker's closing row (rastrillo's form-foot, reached through our |
| @@ -712,16 +707,12 @@ html { scroll-padding-block-start: var(--estilo-bar-block-size); } |
| font: inherit; |
| font-size: var(--rst-fs-sm); |
| } |
| -[cal-notices] + [cal-bar] { |
| - margin-top: var(--rst-sp-3); |
| -} |
| [cal-reminder-add] { |
| display: flex; |
| align-items: flex-end; |
| gap: var(--rst-sp-2); |
| margin-top: var(--rst-sp-3); |
| } |
| -[cal-feed-new] { margin-top: var(--rst-sp-4); } |
| /* A calendar's swatch on the Calendars list: its hue, the one value the |
| * attribute still carries. */ |
| [cal-dot] { |
diff --git a/internal/calendar/static/chrome.css b/internal/calendar/static/chrome.css| index 83a482f..95a4320 100644 |
| --- a/internal/calendar/static/chrome.css |
| +++ b/internal/calendar/static/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,81 @@ |
| --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 or its hint |
| + ([estilo-signin-hint]), a hint after |
| + its input --rst-sp-2 |
| + an h1 or h2, a section |
| + ([estilo-signin-section]), 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. |
| + |
| + As in Fiesta's stack, the column's gap is the table's smallest step |
| + and a child's margin is the rest of its answer: a hidden child (or a |
| + hidden input) is no flex item and takes no gap, so the block after |
| + one keeps --rst-sp-2 and never touches what is above it. */ |
| [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); |
| + gap: var(--rst-sp-2); |
| 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] > :not([hidden], [type="hidden"]) + :not([hidden]) { |
| + /* spacing-allow: the table's step less the column's --rst-sp-2 gap; margin and gap together are the step */ |
| + margin-block-start: calc(var(--estilo-stack-heading, var(--estilo-stack-actions, var(--estilo-stack-control, var(--estilo-stack-section, var(--estilo-stack-sub, var(--rst-sp-3)))))) - var(--rst-sp-2)); |
| +} |
| +[estilo-signin] > :is(img, button, a[estilo-signin-action]) { align-self: flex-start; } |
| +[estilo-signin] > :not([hidden], [type="hidden"]) + :is(h3, h4, h5, h6) { --estilo-stack-sub: var(--rst-sp-4); } |
| +[estilo-signin] > :not([hidden], [type="hidden"]) + :is(h1, h2), |
| +[estilo-signin] > :not([hidden], [type="hidden"]) + [estilo-signin-section], |
| +[estilo-signin] > [estilo-brand] + * { --estilo-stack-section: var(--rst-sp-5); } |
| +[estilo-signin] > :is(label, [estilo-signin-hint]) + :is(input, select, textarea), |
| +[estilo-signin] > :is(input, select, textarea) + [estilo-signin-hint] { --estilo-stack-control: var(--rst-sp-2); } |
| +[estilo-signin] > :not([hidden], [type="hidden"]) + :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 +369,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 +391,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 +402,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 +490,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 +504,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 +527,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 +556,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 +579,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 +601,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 +617,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 +652,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 +701,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 +751,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 +784,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 +794,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/internal/calendar/static/menu.css b/internal/calendar/static/menu.css| index 9070652..eb420e2 100644 |
| --- a/internal/calendar/static/menu.css |
| +++ b/internal/calendar/static/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/internal/calendar/static/tokens.css b/internal/calendar/static/tokens.css| index 3ae9664..07f8b10 100644 |
| --- a/internal/calendar/static/tokens.css |
| +++ b/internal/calendar/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/calendar/templates/book_gone.html b/internal/calendar/templates/book_gone.html| index 5f820bd..929fbd8 100644 |
| --- a/internal/calendar/templates/book_gone.html |
| +++ b/internal/calendar/templates/book_gone.html |
| @@ -7,5 +7,5 @@ |
| </header> |
| <p>{{.Data.Why}}</p> |
| -{{if .Data.Path}}<p><a rst-btn href="{{.Data.Path}}?zone={{.Data.Zone}}">Book a time</a></p>{{end}} |
| +{{if .Data.Path}}<div rst-actions><a rst-btn href="{{.Data.Path}}?zone={{.Data.Zone}}">Book a time</a></div>{{end}} |
| {{end}} |
diff --git a/internal/calendar/templates/book_manage.html b/internal/calendar/templates/book_manage.html| index 4b906ab..cececb4 100644 |
| --- a/internal/calendar/templates/book_manage.html |
| +++ b/internal/calendar/templates/book_manage.html |
| @@ -16,7 +16,7 @@ |
| {{template "detail-list" dict "Items" $items}} |
| {{with .Data.HostWhen}}<p cal-elsewhere>That is {{.}} where {{$.Data.HostName}} is.</p>{{end}} |
| -<div cal-book-manage-actions> |
| +<div rst-actions cal-book-manage-actions> |
| <a rst-btn="primary" href="/book/m/{{.Data.Token}}/calendar.ics">Add to calendar</a> |
| <a rst-btn href="/book/m/{{.Data.Token}}/reschedule">Reschedule</a> |
| <form method="post" action="/book/m/{{.Data.Token}}/cancel"> |
diff --git a/internal/calendar/templates/event.html b/internal/calendar/templates/event.html| index 2ae8dc9..9711a2e 100644 |
| --- a/internal/calendar/templates/event.html |
| +++ b/internal/calendar/templates/event.html |
| @@ -103,7 +103,7 @@ |
| </div> |
| </section> |
| -<div cal-bar> |
| +<div rst-actions cal-bar> |
| <a rst-btn="ghost" href="/events/{{.Data.Event.ID}}.ics">Download as .ics</a> |
| {{if .Data.Event.Writable}} |
| {{/* The destructive action is a link to its own page, never a |
diff --git a/internal/calendar/templates/layout.html b/internal/calendar/templates/layout.html| index 47df9bc..d58a452 100644 |
| --- a/internal/calendar/templates/layout.html |
| +++ b/internal/calendar/templates/layout.html |
| @@ -35,7 +35,10 @@ |
| <div estilo-shell> |
| <a rst-skip href="#main">{{.Chrome.Labels.Skip}}</a> |
| {{template "estilo-bar" .Chrome}} |
| - {{block "main" .}}<main rst-page id="main">{{template "content" .}}</main>{{end}} |
| + {{/* Every page but the four calendar views (which supply their own |
| + <main>) is Fiesta's stack: rst-stack spaces the page's blocks, |
| + its header, headings, prose, forms and buttons, by one table. */}} |
| + {{block "main" .}}<main rst-page rst-stack id="main">{{template "content" .}}</main>{{end}} |
| <footer rst-shell-foot>{{block "foot" .}}{{end}}</footer> |
| </div> |
| </body> |
diff --git a/internal/calendar/templates/reminders.html b/internal/calendar/templates/reminders.html| index fd41415..11faf9e 100644 |
| --- a/internal/calendar/templates/reminders.html |
| +++ b/internal/calendar/templates/reminders.html |
| @@ -24,7 +24,7 @@ |
| </div> |
| {{end}} |
| </div> |
| -<div cal-bar> |
| +<div rst-actions cal-bar> |
| <form method="post" action="/reminders/dismiss"> |
| <button rst-btn type="submit">Dismiss all</button> |
| </form> |
diff --git a/internal/calendar/templates/share.html b/internal/calendar/templates/share.html| index 65d23fd..e02ab20 100644 |
| --- a/internal/calendar/templates/share.html |
| +++ b/internal/calendar/templates/share.html |
| @@ -46,7 +46,7 @@ |
| "Body" "A link lets another calendar app read this one. Nothing is shared until you make one."}} |
| {{end}} |
| -<form cal-feed-new method="post" action="/calendars/{{.Data.Calendar.ID}}/feeds"> |
| +<form rst-actions cal-feed-new method="post" action="/calendars/{{.Data.Calendar.ID}}/feeds"> |
| <button rst-btn="primary" type="submit">Create a subscription link</button> |
| </form> |
| {{end}} |
diff --git a/internal/calendar/testing.go b/internal/calendar/testing.go| index f2d2411..ff0b15e 100644 |
| --- a/internal/calendar/testing.go |
| +++ b/internal/calendar/testing.go |
| @@ -256,3 +256,11 @@ func (a *App) TrySendNowForTest(bookingID int64) bool { |
| func (a *App) FlushSigninMailForTest() { |
| a.signinMail.wait() |
| } |
| + |
| +// SetKeymailServersForTest lists the Keymail servers every App built |
| +// afterwards in this process may contact (rauth.Config.KeymailServers): |
| +// a test main's in-process fixtures, behind keymailtest's transport. An |
| +// empty, non-nil list means none. Never called outside tests. |
| +func SetKeymailServersForTest(servers []string) { |
| + keymailTestServers = servers |
| +} |
diff --git a/internal/calendartest/main_test.go b/internal/calendartest/main_test.go| index 97f7ee6..e344369 100644 |
| --- a/internal/calendartest/main_test.go |
| +++ b/internal/calendartest/main_test.go |
| @@ -11,6 +11,7 @@ import ( |
| "testing" |
| "time" |
| + calendar "amadan.net/oficina/calendar/internal/calendar" |
| "amadan.net/oficina/calendar/internal/calendar/keymailtest" |
| ) |
| @@ -20,6 +21,8 @@ import ( |
| // query is answered NXDOMAIN; no fixture is registered here, so every |
| // address is plain email. |
| func TestMain(m *testing.M) { |
| + // No fixture is registered here, so no server is listed either. |
| + calendar.SetKeymailServersForTest([]string{}) |
| restore, err := keymailtest.Install() |
| if err != nil { |
| fmt.Fprintln(os.Stderr, "keymailtest.Install:", err) |
diff --git a/internal/calendartest/rhythm_browser_test.go b/internal/calendartest/rhythm_browser_test.go| new file mode 100644 |
| index 0000000..ee90283 |
| --- /dev/null |
| +++ b/internal/calendartest/rhythm_browser_test.go |
| @@ -0,0 +1,243 @@ |
| +//go:build browser |
| + |
| +package calendartest |
| + |
| +import ( |
| + "context" |
| + "fmt" |
| + "io" |
| + "log/slog" |
| + "net/http" |
| + "os" |
| + "path/filepath" |
| + "regexp" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/rastrillo/fiesta/check/rhythm" |
| + "amadan.net/rastrillo/rastrillo" |
| + "amadan.net/rastrillo/rastrillo/harness" |
| + "github.com/chromedp/chromedp" |
| + |
| + calendar "amadan.net/oficina/calendar/internal/calendar" |
| +) |
| + |
| +// TestEveryScreenKeepsTheRhythm: each of Calendar's 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 the calendar grids themselves (the month's |
| +// table, the day's and week's columns of hours), whose cells are |
| +// drawn to the clock and the calendar, not to the page's rhythm. |
| +// |
| +// On the tree before <main> was Fiesta's stack it fails, with 15 |
| +// findings, all on the stranger's booking pages: the zone form 14px |
| +// under the page's description, and gaps the browser's own paragraph |
| +// and list margins set. Help → Open source is estilo's credits page, |
| +// left to estilo. |
| +func TestEveryScreenKeepsTheRhythm(t *testing.T) { |
| + var app *calendar.App |
| + rig := harness.New(t, func(origin string) http.Handler { |
| + a, err := calendar.New(calendar.Config{ |
| + DBPath: filepath.Join(t.TempDir(), "calendar.db"), |
| + Env: "development", |
| + Origin: origin, |
| + Logger: slog.New(slog.NewTextHandler(io.Discard, nil)), |
| + }) |
| + if err != nil { |
| + t.Fatalf("calendar.New: %v", err) |
| + } |
| + t.Cleanup(func() { a.Close() }) |
| + app = a |
| + h, closeFn, err := rastrillo.Handler(a.ServeOptions(rastrillo.Options{Logger: slog.New(slog.NewTextHandler(io.Discard, nil))})) |
| + if err != nil { |
| + t.Fatalf("rastrillo.Handler: %v", err) |
| + } |
| + if closeFn != nil { |
| + t.Cleanup(func() { _ = closeFn() }) |
| + } |
| + return h |
| + }) |
| + session := signInOverHTTP(t, app, rig.Origin, "host@example.com") |
| + |
| + // A published booking page, so the stranger's side has a page to |
| + // draw and the host's list has a row. |
| + ctx := context.Background() |
| + st := app.StoreForTest() |
| + host := app.PersonByAddressForTest(t, "host@example.com") |
| + if err := st.SaveHandle(ctx, host.ID, "paul"); err != nil { |
| + t.Fatal(err) |
| + } |
| + ws, _ := calendar.ParseAvailability("every day 9-5") |
| + page, err := st.CreateBookingPage(ctx, host.ID, calendar.BookingPageInput{ |
| + Title: "Quick chat", Description: "Half an hour.", Availability: "every day 9-5", |
| + DurationMin: 30, HorizonDays: 30}, ws) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := st.PublishBookingPage(ctx, host.ID, page.ID, true); err != nil { |
| + t.Fatal(err) |
| + } |
| + |
| + run := func(what string, actions ...chromedp.Action[chromedp.Void]) { |
| + t.Helper() |
| + c, cancel := context.WithTimeout(rig.Context(), 30*time.Second) |
| + defer cancel() |
| + if err := chromedp.Do(c, actions...); err != nil { |
| + t.Fatalf("%s: %v", what, err) |
| + } |
| + } |
| + // Each screen is read at a desktop width and again at a phone's. |
| + // With a path, it is loaded first, once, and must still be at that |
| + // path when read: a lost session lands on the sign-in door, whose |
| + // rhythm is not this page's. A path written "~prefix" is the page |
| + // the last step landed on, which must be under prefix. ready is a |
| + // selector only that screen draws, its main h1 must read heading |
| + // (an error page at the same address has its own), and main must |
| + // hold at least blocks elements, so a page that drew nothing cannot |
| + // pass by having nothing to measure. |
| + grids := []string{"[cal-month]", "[cal-grid]", "[cal-week-scroll]"} |
| + audit := func(name, path, ready string, blocks int, heading string) { |
| + t.Helper() |
| + landed := strings.HasPrefix(path, "~") |
| + for i, width := range []int64{1280, 390} { |
| + var found []rhythm.Finding |
| + var at, h1 string |
| + var drawn int |
| + actions := []chromedp.Action[chromedp.Void]{deviceMetrics(width, 900)} |
| + if i == 0 && !landed { |
| + actions = append(actions, chromedp.Navigate(rig.Origin+path)) |
| + } |
| + actions = append(actions, |
| + chromedp.WaitVisible(chromedp.CSS(ready)), |
| + evalInto(&at, `location.pathname + location.search`), |
| + evalInto(&h1, `(document.querySelector('main h1') || {}).textContent || ''`), |
| + evalInto(&drawn, `document.querySelectorAll('main *').length`), |
| + evalInto(&found, rhythm.Expression("main", rhythm.Options{Skip: grids}))) |
| + run(name, actions...) |
| + if landed && !strings.HasPrefix(at, path[1:]) || !landed && at != path { |
| + t.Fatalf("%s: the browser is at %s, not %s", name, at, strings.TrimPrefix(path, "~")) |
| + } |
| + if strings.TrimSpace(h1) != heading { |
| + t.Fatalf("%s: the page's heading is %q, not %q", name, h1, heading) |
| + } |
| + if drawn < blocks { |
| + t.Fatalf("%s at %dpx: main holds %d elements, 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", `input[name="address"]`, 3, "Sign in to Calendar") |
| + |
| + run("sign in", setCookie(rig.Origin, session)) |
| + |
| + var at string |
| + run("create an event", |
| + chromedp.Navigate(rig.Origin+"/events/new?start=2026-09-02T09:30&end=2026-09-02T10:00"), |
| + chromedp.WaitVisible(chromedp.CSS(`input[name="title"]`)), |
| + chromedp.SendKeys(chromedp.CSS(`input[name="title"]`), "Standup"), |
| + chromedp.Click(chromedp.CSS(`form[action="/events"] button[type="submit"]`)), |
| + chromedp.WaitVisible(chromedp.CSS(`form[action$="/reminders"]`)), |
| + harness.Into(&at, chromedp.Location()), |
| + ) |
| + event := regexp.MustCompile(`/events/\d+`).FindString(at) |
| + if event == "" { |
| + t.Fatalf("creating an event landed on %s", at) |
| + } |
| + // A repeating one, whose page and delete offer the series. |
| + personal, err := st.DefaultCalendarID(ctx, host.ID) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + weekly, err := st.CreateEvent(ctx, host.ID, calendar.EventInput{CalendarID: personal, Title: "Weekly review", |
| + StartLocal: "2026-09-03T15:00", EndLocal: "2026-09-03T16:00", TZ: "UTC", RRule: "FREQ=WEEKLY"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + series := fmt.Sprintf("/events/%d", weekly.ID) |
| + |
| + for _, view := range []struct{ path, ready, heading string }{ |
| + {"/day/2026-09-02", `main [cal-grid]`, "Wednesday 2 September"}, |
| + {"/week/2026-09-02", `main [cal-week-scroll]`, "Week of 31 August 2026"}, |
| + {"/month/2026-09", `main [cal-month]`, "September 2026"}, |
| + {"/agenda?from=2026-09-02", `main[cal-view] [cal-day-chips]`, "Agenda"}, |
| + } { |
| + audit(view.path, view.path, view.ready, 40, view.heading) |
| + } |
| + audit("a new event", "/events/new", `input[name="title"]`, 40, "New event") |
| + audit("editing an event", event+"/edit", `input[name="title"]`, 40, "Edit event") |
| + audit("an event", event, `form[action$="/reminders"]`, 20, "Standup") |
| + audit("deleting an event", event+"/delete", `main form[action$="/delete"]`, 4, "Delete “Standup”?") |
| + audit("a repeating event", series, `form[action$="/reminders"]`, 20, "Weekly review") |
| + audit("deleting a repeating event", series+"/delete", `main form[action$="/delete"] fieldset`, 15, "Delete “Weekly review”?") |
| + audit("settings", "/settings", `main form`, 100, "Settings") |
| + audit("reminders", "/reminders", `main [rst-empty] a[href="/settings"], main [cal-notices]`, 6, "Reminders") |
| + audit("calendars", "/calendars", `main [cal-dot]`, 12, "Calendars") |
| + audit("sharing a calendar", "/calendars/1/share", `form[cal-feed-new]`, 12, "Team") |
| + run("make a subscription link", |
| + chromedp.Navigate(rig.Origin+"/calendars/1/share"), |
| + chromedp.WaitVisible(chromedp.CSS(`form[cal-feed-new] button`)), |
| + chromedp.Click(chromedp.CSS(`form[cal-feed-new] button`)), |
| + chromedp.WaitVisible(chromedp.CSS(`main [rst-list], main ul`))) |
| + audit("sharing a calendar, with a link", "~/calendars/1/share?token=", `form[cal-feed-new]`, 20, "Team") |
| + audit("import", "/import", `main form input[type=file]`, 20, "Import a calendar") |
| + ics := filepath.Join(t.TempDir(), "one.ics") |
| + if err := os.WriteFile(ics, []byte("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//test//EN\r\nBEGIN:VEVENT\r\nUID:one@test\r\nDTSTAMP:20260901T000000Z\r\nDTSTART:20260904T100000Z\r\nDTEND:20260904T110000Z\r\nSUMMARY:Imported\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"), 0o600); err != nil { |
| + t.Fatal(err) |
| + } |
| + run("import a file", |
| + chromedp.Navigate(rig.Origin+"/import"), |
| + chromedp.WaitVisible(chromedp.CSS(`input[type=file]`)), |
| + chromedp.SetUploadFiles(`input[type=file]`, []string{ics}), |
| + chromedp.Click(chromedp.CSS(`form[action="/import"] button[type=submit]`)), |
| + chromedp.WaitNotPresent(chromedp.CSS(`form[action="/import"] input[type=file]`))) |
| + audit("import done", "~/import", `main [rst-page-header]`, 10, "Imported") |
| + audit("booking pages", "/settings/booking", `main [cal-book-page]`, 20, "Booking pages") |
| + audit("a new booking page", "/settings/booking/new", `main form`, 30, "New booking page") |
| + audit("a page that is not there", "/events/999999", `main h1`, 4, "We can’t find that page") |
| + |
| + // The stranger's side: the page, a day's slots, a slot's details, |
| + // the hold, then the mailed link: confirm, manage, reschedule, |
| + // cancel. |
| + public := "/book/paul/" + page.Code + "?zone=UTC" |
| + audit("the booking page", public, `[cal-book-days] a`, 100, "Quick chat") |
| + var day string |
| + run("a booking day", evalInto(&day, `document.querySelector('[cal-book-days] a').getAttribute('href')`)) |
| + audit("a booking day", day, `[cal-book-slot]`, 100, "Quick chat") |
| + run("a slot", chromedp.Click(chromedp.CSS(`[cal-book-slot]`)), chromedp.WaitVisible(chromedp.CSS(`[cal-book-details] input[name="name"]`))) |
| + audit("a slot's details", "~/book/paul/"+page.Code, `[cal-book-details] input[name="name"]`, 60, "Quick chat") |
| + run("hold it", |
| + chromedp.SendKeys(chromedp.CSS(`#name`), "Doc"), |
| + chromedp.SendKeys(chromedp.CSS(`#address`), "doc@example.com"), |
| + chromedp.Click(chromedp.CSS(`[cal-book-details] button[type=submit]`)), |
| + chromedp.WaitNotPresent(chromedp.CSS(`[cal-book-details]`))) |
| + audit("the hold, sent", "~/book/paul/"+page.Code, `main [rst-page-header-sub]`, 8, "Check your mail") |
| + mail, err := app.LastMailForTest() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + manage := regexp.MustCompile(`/book/m/[0-9a-f]{64}`).FindString(mail) |
| + if manage == "" { |
| + t.Fatalf("no manage link in the hold mail") |
| + } |
| + audit("the hold, to confirm", manage, `form[action$="/confirm"]`, 10, "Confirm your booking") |
| + run("confirm it", |
| + chromedp.Click(chromedp.CSS(`form[action$="/confirm"] button`)), |
| + chromedp.WaitVisible(chromedp.CSS(`[cal-book-manage-actions]`))) |
| + audit("a booking", "~"+manage+"/confirm", `[cal-book-manage-actions]`, 12, "Quick chat") |
| + audit("rescheduling a booking", manage+"/reschedule", `[cal-book-days] a`, 100, "Quick chat") |
| + run("cancel it", |
| + chromedp.Navigate(rig.Origin+manage), |
| + chromedp.WaitVisible(chromedp.CSS(`form[action$="/cancel"] button`)), |
| + chromedp.Click(chromedp.CSS(`form[action$="/cancel"] button`)), |
| + chromedp.WaitNotPresent(chromedp.CSS(`form[action$="/cancel"]`))) |
| + audit("a cancelled booking", "~"+manage+"/cancel", `main p`, 6, "Quick chat") |
| +} |