oficina / estilo Public

chrome: the smart door (estilo-signin-screen), Forget on signed out, no footer slot

Step 2 of Home's smart-door spec (docs/superpowers/specs/2026-11-19-smart-door.md,
approved by Paul 2026-11-19).

- estilo-signin-screen (chrome.SignInScreen): rastrillo's ui "signin"
  partial drawn inside the Oficina door, with the sky behind and the
  app's mark and name at the card's head. Template-only and duck-typed:
  estilo pins the old rastrillo path, so it reads State.Unavailable and
  calls "signin" by name; the app parses its own rastrillo's templates
  alongside. Draws nothing, the door included, when Unavailable or with
  no State. estilo-signin-screen-title renders rastrillo's signin-title
  for the same state.
- One brand on the card: estilo passes Brand{Name: App} with no Mark and
  HideBrand true (not read by rastrillo yet); chrome.css flattens the
  partial's own card and hides its brand column by structure, since
  rst- selectors are rastrillo's to write.
- chrome.OficinaGlyph: the two fanned cards in currentColor, inline, for
  auth.FederatedDoor.Icon.
- estilo-signed-out: a quiet "Forget me on this device" POST form
  (SignInNotice.Forgetting; DoorCopy.Forget).
- SignIn.OpenSource and the door's footer styles removed (Paul: no
  footer links on the door). estilo-signin otherwise unchanged.
- Tests render the screen around a stand-in partial
  (chrome/testdata/signin-stand-in.html). mainChromeCSS updated for the
  door's rules only; no bar rule changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 26f66aa340d8629d1d85f3e9d56e7bff2903cd25 parent a92bf2e
10 files changed, +388 −26
  • README.md +14 −0
  • chrome/chrome.css +23 −4
  • chrome/chrome.go +53 −2
  • chrome/chrome_test.go +13 −7
  • chrome/door.go +17 −2
  • chrome/door_test.go +3 −2
  • chrome/screen_test.go +201 −0
  • chrome/templates/signin.html +44 −7
  • chrome/testdata/signin-stand-in.html +16 −0
  • chrome/unchanged_test.go +4 −2

CI passed — run details

CI log
=== modcache ===
all modules verified
=== vet ===
CGO_ENABLED=0 go vet ./...
CGO_ENABLED=0 go vet -tags browser ./...
=== fmt ===
=== build ===
CGO_ENABLED=0 go build -buildvcs=false ./...
=== go-test ===
CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/estilo.git/base	0.004s
ok  	amadan.net/oficina/estilo.git/brand	0.003s
ok  	amadan.net/oficina/estilo.git/busy	0.009s
ok  	amadan.net/oficina/estilo.git/callui	0.004s
ok  	amadan.net/oficina/estilo.git/chrome	3.891s
?   	amadan.net/oficina/estilo.git/cmd/oficina-notices	[no test files]
ok  	amadan.net/oficina/estilo.git/colophon	0.022s
ok  	amadan.net/oficina/estilo.git/credits	0.005s
ok  	amadan.net/oficina/estilo.git/credits/catalog	0.004s
ok  	amadan.net/oficina/estilo.git/desk	0.004s
ok  	amadan.net/oficina/estilo.git/googleimport	2.090s
ok  	amadan.net/oficina/estilo.git/homeconnect	0.005s
ok  	amadan.net/oficina/estilo.git/internal/lint	0.006s
?   	amadan.net/oficina/estilo.git/internal/tokencheck	[no test files]
ok  	amadan.net/oficina/estilo.git/menu	0.010s
ok  	amadan.net/oficina/estilo.git/savestatus	0.132s
ok  	amadan.net/oficina/estilo.git/sky	0.031s
ok  	amadan.net/oficina/estilo.git/theme	0.009s
diff --git a/README.md b/README.md
index 683790f..b99e0b6 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,20 @@ and keeps it out of the Menu sheet, and `menu.Item.Controls` is a toggle
account menu's Appearance is a three-way segmented selector that
`chrome.js` switches in place.
+The smart door (spec `docs/superpowers/specs/2026-11-19-smart-door.md` in
+Home, step 2) is `estilo-signin-screen` with `chrome.SignInScreen`:
+rastrillo's sign-in screen, its ui `signin` partial (the remembered way
+in, Other ways to sign in and the chooser), drawn inside the door, with
+the sky behind and the app's mark and name at the card's head. It is
+duck-typed, because estilo pins the old rastrillo path: the app passes its
+`auth.SigninState` and `*ui.Localizer` as `State` and `L`, and parses its
+own rastrillo's `ui.Templates()` alongside estilo's. With
+`State.Unavailable` it draws nothing. `chrome.OficinaGlyph` is the icon for
+the Oficina ID door (`auth.FederatedDoor.Icon`), and
+`SignInNotice.Forgetting` adds "Forget me on this device" to the
+signed-out page. `estilo-signin` stays for apps that haven't moved; the
+door carries no footer links.
+
`desk` is the grey desk an editor sits on (`--estilo-desk`), the floating
glass card (`estilo-card`), the inspector built on it (`estilo-inspector`,
with `estilo-inspector-group` and `estilo-inspector-label`) and the
diff --git a/chrome/chrome.css b/chrome/chrome.css
index 92d0fd4..ed1c9b6 100644
--- a/chrome/chrome.css
+++ b/chrome/chrome.css
@@ -290,15 +290,34 @@
[estilo-door] { padding-inline: 14px; padding-block-start: 28px; }
[estilo-signin] { padding: 26px 22px 24px; }
}
-[estilo-signin-foot] { margin-block-start: var(--rst-sp-6); font-size: var(--rst-fs-xs); color: var(--rst-text-muted); }
/* 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
blue on the card. As base.css does, a link in the card is the app's
colour at the lowest specificity, so a link drawn as a button keeps the
- button's; the foot's is quiet, like its text. */
+ button's. The card has no footer links (Paul, 2026-11-19). */
:where([estilo-signin]) a { color: var(--rst-accent); text-underline-offset: 0.15em; }
-[estilo-signin-foot] a { color: inherit; }
-[estilo-signin-foot] a:hover, [estilo-signin-foot] a:focus-visible { color: var(--rst-text); }
+/* The smart door (estilo-signin-screen): rastrillo's sign-in partial in
+ the card, inside [estilo-signin-screen]. The partial is a card of its
+ own, made for the stage shell, with its brand in a column beside the
+ way in; here the door is the card and its head is the brand, so the
+ partial's surface, edge, padding and columns go, and so does its brand
+ (the one brand on the card is the door's). Its buttons, rows and quiet
+ controls are rastrillo's own. The partial is reached by structure, not
+ by its rst- names, which are rastrillo's to style (AGENTS.md,
+ Vocabulary): its card is a <section> of two children, the brand column
+ then the door, and the brand is hidden only while there are two, so a
+ partial that draws no brand (HideBrand) keeps its door. */
+[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) { display: none; }
+[estilo-signin-screen] h1 { margin-block-end: 2px; }
+/* Signed out: "Forget me on this device", a quiet text button under Sign
+ in, drawn as the smart door's small controls are (medium weight, the
+ muted ink that darkens on hover, a touch smaller than body text, a soft
+ pill on hover and focus). Pulled back by its own padding so its words
+ line up with the card's text above. */
+[estilo-signin-forget] { margin: var(--rst-sp-2) 0 0; }
+[estilo-signin-forget] > button { margin-inline-start: -0.875rem; min-block-size: 2.5rem; padding: 0 0.875rem; 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; }
+[estilo-signin-forget] > button:hover, [estilo-signin-forget] > button:focus-visible { background: var(--rst-surface-2); color: var(--rst-text); }
/* ── Bar stack (Docs' I2 editor header, spec 2026-11-11) ────────────────
Everything below is opt-in. Each rule is keyed on a hook only a bar
diff --git a/chrome/chrome.go b/chrome/chrome.go
index 01a1606..e6cbf5b 100644
--- a/chrome/chrome.go
+++ b/chrome/chrome.go
@@ -56,7 +56,8 @@ func JS() []byte { return append([]byte(nil), js...) }
// Templates holds estilo-bar, estilo-bar-title, estilo-bar-title-fit,
// estilo-bar-actions, estilo-bar-action, estilo-account, estilo-switcher, estilo-error, estilo-signin,
-// estilo-signin-sent, estilo-signed-out and the bar's icons.
+// estilo-signin-screen, estilo-signin-screen-title, estilo-signin-sent,
+// estilo-signed-out and the bar's icons.
func Templates() embed.FS { return templateFS }
// Link is a labelled destination. Current marks the page being shown.
@@ -293,11 +294,58 @@ type SignIn struct {
Action, Return string
Hidden []Hidden
Address, AddressError string
- OpenSource *Link
// Copy replaces the door's English (nil) with another locale's set.
Copy *DoorCopy
}
+// SignInScreen is estilo-signin-screen's data: rastrillo's sign-in screen
+// (its ui "signin" partial) drawn as the Oficina door, with the sky behind
+// and the app's mark and name at the card's head (smart-door spec,
+// home docs/superpowers/specs/2026-11-19-smart-door.md, step 2).
+//
+// Duck-typed, because estilo pins the old rastrillo module path and
+// cannot import the release that has the partial: the template reads
+// State.Unavailable and hands State, L and Preview on to the partial by
+// name. So the app must parse its own rastrillo's ui.Templates() with
+// ui.Funcs() alongside this package, or the call to "signin" fails.
+type SignInScreen struct {
+ // Icon is the app's mark at the card's head, and App its name beside
+ // it, which is also the partial's Brand.Name ("Sign in to Docs"), so
+ // it is required. Sky is the sky behind, as for SignIn.
+ Icon, App string
+ Sky sky.View
+ // State is the request's auth.SigninState (or a pointer to one), after
+ // PrepareSigninResponse. With State.Unavailable set, or a nil State,
+ // the template draws nothing at all, not even the door.
+ State any
+ // L is the request's *ui.Localizer, handed to the partial as its L.
+ L any
+ // Preview is the partial's gallery mode; false on a real page.
+ Preview bool
+}
+
+// OficinaGlyph is the Oficina ID glyph, the mark's two fanned cards alone,
+// in currentColor: the icon of "Continue with Oficina ID". Pass it as
+// rastrillo auth's FederatedDoor.Icon. It is never the full-colour app
+// icon, whose gradient tile fights the button's fill (smart-door spec,
+// "How the buttons look"). Inline, so the door makes no request for it and
+// draws no late icon; hidden from assistive technology, because the
+// button's words say what it is. The width and height are only the size
+// with no stylesheet: rastrillo's door sizes it.
+const OficinaGlyph template.HTML = `<svg viewBox="18 20 62 60" width="20" height="20" aria-hidden="true" focusable="false">` +
+ `<rect x="30.62" y="23.78" width="45.60" height="36.48" rx="7.98" fill="currentColor" opacity=".55"/>` +
+ `<rect x="22.64" y="36.32" width="50.16" height="38.76" rx="7.98" fill="currentColor"/></svg>`
+
+// ForgetForm is the signed-out page's "Forget me on this device": a POST
+// to Action, rastrillo auth's Forget (Config.ForgetPath), which forgets
+// how this browser last signed in. Return is posted as return_to when
+// set, and Hidden as written (a CSRF token, for an app whose Forget wants
+// one). Build it with SignInNotice.Forgetting, which supplies the label.
+type ForgetForm struct {
+ Action, Return, Label string
+ Hidden []Hidden
+}
+
// SignInNotice is the data of estilo-signin-sent and estilo-signed-out,
// and of any other notice drawn as the door (the Keymail hand-off, the
// hub's account pages). For the door's own two, build it with Sent or
@@ -308,6 +356,9 @@ type SignInNotice struct {
App string
Sky sky.View
Link *Link
+ // Forget is the signed-out page's quiet "Forget me on this device"
+ // form, under its Sign in; nil draws none.
+ Forget *ForgetForm
// Copy replaces the door's English (nil) with another locale's set.
Copy *DoorCopy
// page is the tab title's page, set by Sent and SignedOut.
diff --git a/chrome/chrome_test.go b/chrome/chrome_test.go
index e3c8978..c7c126e 100644
--- a/chrome/chrome_test.go
+++ b/chrome/chrome_test.go
@@ -322,8 +322,8 @@ func TestSignInPages(t *testing.T) {
for locale, label := range locales {
t.Run(locale, func(t *testing.T) {
esc := template.HTMLEscapeString
- html := render(t, "estilo-signin", SignIn{Icon: "/i.svg", Copy: &DoorCopy{Heading: label + "-h", AddressLabel: label + "-addr", Help: label + "-help", Submit: label + "-submit"}, Lede: label + "-lede", Error: label + "-err", Action: "/signin", Return: "/d/abc", Hidden: []Hidden{{"force", "1"}}, OpenSource: &Link{Href: "/credits", Label: label + "-os"}})
- for _, want := range []string{"<h1>" + esc(label) + "-h</h1>", esc(label) + "-lede", `rst-tone="negative" role="alert"`, esc(label) + "-err", `action="/signin" novalidate`, `name="return_to" value="/d/abc"`, `name="force" value="1"`, `type="email"`, `autocomplete="email"`, esc(label) + "-addr", esc(label) + "-help", esc(label) + "-submit", esc(label) + "-os"} {
+ html := render(t, "estilo-signin", SignIn{Icon: "/i.svg", Copy: &DoorCopy{Heading: label + "-h", AddressLabel: label + "-addr", Help: label + "-help", Submit: label + "-submit"}, Lede: label + "-lede", Error: label + "-err", Action: "/signin", Return: "/d/abc", Hidden: []Hidden{{"force", "1"}}})
+ for _, want := range []string{"<h1>" + esc(label) + "-h</h1>", esc(label) + "-lede", `rst-tone="negative" role="alert"`, esc(label) + "-err", `action="/signin" novalidate`, `name="return_to" value="/d/abc"`, `name="force" value="1"`, `type="email"`, `autocomplete="email"`, esc(label) + "-addr", esc(label) + "-help", esc(label) + "-submit"} {
if !strings.Contains(html, want) {
t.Fatalf("missing %q in %s", want, html)
}
@@ -484,13 +484,19 @@ func TestSignInIsTheOficinaDoor(t *testing.T) {
}
// The card styles its own links: an app that styles no bare <a> would
-// otherwise show the browser's default blue on the door.
+// otherwise show the browser's default blue on the door. And the card has
+// no footer links (Paul, 2026-11-19): the OpenSource slot is gone, with
+// its styles.
func TestTheDoorStylesItsLinks(t *testing.T) {
src := string(CSS())
- for _, want := range []string{":where([estilo-signin]) a", "[estilo-signin-foot] a"} {
- if !strings.Contains(src, want) {
- t.Errorf("chrome.css does not style %q", want)
- }
+ if !strings.Contains(src, ":where([estilo-signin]) a") {
+ t.Error("chrome.css does not style the door's links")
+ }
+ if strings.Contains(src, "estilo-signin-foot") {
+ t.Error("chrome.css still styles the door's footer")
+ }
+ if h := render(t, "estilo-signin", SignIn{Icon: "/i.svg", App: "Docs", Action: "/signin"}); strings.Contains(h, "estilo-signin-foot") {
+ t.Error("the door still draws a footer", h)
}
}
diff --git a/chrome/door.go b/chrome/door.go
index 946b7b6..3d04469 100644
--- a/chrome/door.go
+++ b/chrome/door.go
@@ -44,8 +44,9 @@ type DoorCopy struct {
// body, and the link back to the form.
SentHeading, SentBody, Again string
// The signed-out page: the tab title's page, the heading, the body
- // ({app} is the app's name) and the Sign in button.
- SignedOutPage, SignedOutHeading, SignedOutBody, SignIn string
+ // ({app} is the app's name), the Sign in button and the quiet
+ // "Forget me on this device" under it.
+ SignedOutPage, SignedOutHeading, SignedOutBody, SignIn, Forget string
// The sign-in email: subject ({app}) and body ({app} and {link}).
EmailSubject, EmailBody string
}
@@ -68,6 +69,7 @@ var English = DoorCopy{
SignedOutHeading: "You’re signed out",
SignedOutBody: "You’ve signed out of {app} on this device.",
SignIn: "Sign in",
+ Forget: "Forget me on this device",
EmailSubject: "Sign in to {app}",
EmailBody: "Here’s your link to sign in to {app}:\n\n{link}\n\nIt works once and expires in " + linkMinutes + ". If you didn’t ask for it, you can ignore this email.",
}
@@ -142,6 +144,19 @@ func (n SignInNotice) SignedOut(signin string) SignInNotice {
return n
}
+// Forgetting adds "Forget me on this device" to a signed-out page, under
+// its Sign in: a POST to action, rastrillo auth's Forget, carrying
+// returnTo as return_to when it is set, and hidden as written. A shared
+// computer's way to leave nothing behind (smart-door spec, "Signed out").
+// An empty action adds nothing.
+func (n SignInNotice) Forgetting(action, returnTo string, hidden ...Hidden) SignInNotice {
+ n.Forget = nil
+ if action != "" {
+ n.Forget = &ForgetForm{Action: action, Return: returnTo, Label: copyOf(n.Copy).Forget, Hidden: hidden}
+ }
+ return n
+}
+
// Page is the notice's part of the tab title: the door's own for Sent and
// SignedOut ("Check your email", "Signed out"), otherwise the heading.
func (n SignInNotice) Page() string {
diff --git a/chrome/door_test.go b/chrome/door_test.go
index aa9a52d..8c8d452 100644
--- a/chrome/door_test.go
+++ b/chrome/door_test.go
@@ -27,6 +27,7 @@ func TestDoorCopyIsPinned(t *testing.T) {
{"SignedOutHeading", English.SignedOutHeading, "You’re signed out"},
{"SignedOutBody", English.signedOutBody("Calls"), "You’ve signed out of Calls on this device."},
{"SignIn", English.SignIn, "Sign in"},
+ {"Forget", English.Forget, "Forget me on this device"},
} {
if c.got != c.want {
t.Errorf("%s = %q, want %q", c.name, c.got, c.want)
@@ -124,7 +125,7 @@ func TestDoorCopyIsReplaceablePerLocale(t *testing.T) {
for locale, label := range locales {
t.Run(locale, func(t *testing.T) {
esc := template.HTMLEscapeString
- c := &DoorCopy{Heading: label + "-h", AddressLabel: label + "-addr", Help: label + "-help", Submit: label + "-submit", SentHeading: label + "-sent", SentBody: label + "-sentbody", Again: label + "-again", SignedOutPage: label + "-outpage", SignedOutHeading: label + "-out", SignedOutBody: label + " {app}-outbody", SignIn: label + "-in"}
+ c := &DoorCopy{Heading: label + "-h", AddressLabel: label + "-addr", Help: label + "-help", Submit: label + "-submit", SentHeading: label + "-sent", SentBody: label + "-sentbody", Again: label + "-again", SignedOutPage: label + "-outpage", SignedOutHeading: label + "-out", SignedOutBody: label + " {app}-outbody", SignIn: label + "-in", Forget: label + "-forget"}
html := render(t, "estilo-signin", SignIn{Icon: "/i.svg", App: "Docs", Copy: c, Action: "/signin"})
for _, want := range []string{"<h1>" + esc(label) + "-h</h1>", esc(label) + "-addr", esc(label) + "-help", esc(label) + "-submit"} {
if !strings.Contains(html, want) {
@@ -135,7 +136,7 @@ func TestDoorCopyIsReplaceablePerLocale(t *testing.T) {
if h := render(t, "estilo-signin-sent", n.Sent("/signin")); !strings.Contains(h, esc(label)+"-sentbody") || !strings.Contains(h, esc(label)+"-again") {
t.Fatal("sent", h)
}
- if h := render(t, "estilo-signed-out", n.SignedOut("/signin")); !strings.Contains(h, esc(label)+" Docs-outbody") || !strings.Contains(h, esc(label)+"-in") {
+ if h := render(t, "estilo-signed-out", n.SignedOut("/signin").Forgetting("/auth/forget", "")); !strings.Contains(h, esc(label)+" Docs-outbody") || !strings.Contains(h, esc(label)+"-in") || !strings.Contains(h, esc(label)+"-forget</button>") {
t.Fatal("signed out", h)
}
if got := n.SignedOut("/signin").Title(); got != label+"-outpage · Docs" {
diff --git a/chrome/screen_test.go b/chrome/screen_test.go
new file mode 100644
index 0000000..670fb80
--- /dev/null
+++ b/chrome/screen_test.go
@@ -0,0 +1,201 @@
+package chrome
+
+import (
+ "bytes"
+ "html/template"
+ "regexp"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/estilo.git/sky"
+)
+
+// standInState and standInFederated stand in for rastrillo auth's
+// SigninState and FederatedDoor: estilo-signin-screen is duck-typed, so
+// any value with the fields it and the partial read will do.
+type standInState struct {
+ Unavailable bool
+ Federated *standInFederated
+}
+
+type standInFederated struct {
+ Href, Label string
+ Icon template.HTML
+}
+
+// renderScreen renders name with testdata/signin-stand-in.html parsed
+// after estilo's templates, as an app parses its rastrillo's ui.Templates()
+// alongside them.
+func renderScreen(t *testing.T, name string, data any) string {
+ t.Helper()
+ view, err := parse(t).ParseFiles("testdata/signin-stand-in.html")
+ if err != nil {
+ t.Fatal(err)
+ }
+ var out bytes.Buffer
+ if err := view.ExecuteTemplate(&out, name, data); err != nil {
+ t.Fatal(err)
+ }
+ return out.String()
+}
+
+func docsScreen(st any) SignInScreen {
+ return SignInScreen{Icon: "/static/estilo/brand/docs.svg", App: "Docs", Sky: sky.For("docs.oficina.works"), State: st, L: "stand-in-localizer"}
+}
+
+// The smart door is rastrillo's screen inside the Oficina door: the sky,
+// then the card, its head the app's mark and name, then the partial.
+func TestTheSmartDoorDrawsTheScreenInTheDoor(t *testing.T) {
+ st := standInState{Federated: &standInFederated{Href: "/signin/oficina?return_to=%2Fd%2Fabc", Label: "Oficina ID", Icon: OficinaGlyph}}
+ html := renderScreen(t, "estilo-signin-screen", docsScreen(st))
+ order := []string{
+ `<div estilo-door estilo-sky-host>`,
+ `estilo-sky-layer=`,
+ `<section estilo-signin>`,
+ `<p estilo-brand><img estilo-brand-icon="listing" src="/static/estilo/brand/docs.svg" alt="" width="36" height="36"><span>Docs</span></p>`,
+ `<div estilo-signin-screen>`,
+ `<section rst-signin aria-labelledby="rst-signin-heading">`,
+ `<h1 id="rst-signin-heading">Sign in to Docs</h1>`,
+ `<a rst-btn="primary block" href="/signin/oficina?return_to=%2Fd%2Fabc">` + string(OficinaGlyph) + `<span>Continue with Oficina ID</span></a>`,
+ "</section>\n</div>\n</section>\n</div>",
+ }
+ at := 0
+ for _, want := range order {
+ i := strings.Index(html[at:], want)
+ if i < 0 {
+ t.Fatalf("the smart door lacks %q after byte %d:\n%s", want, at, html)
+ }
+ at += i + len(want)
+ }
+ // What estilo hands the partial: the app's name as Brand.Name, no Mark
+ // (the door's head is the brand), the localizer, Preview, and the ask
+ // not to draw its brand.
+ for _, want := range []string{`data-stand-in-l="stand-in-localizer"`, `data-stand-in-preview="false"`, `data-stand-in-hide-brand="true"`} {
+ if !strings.Contains(html, want) {
+ t.Errorf("the partial was not handed %q:\n%s", want, html)
+ }
+ }
+ if strings.Contains(html, "rst-signin-mark") {
+ t.Error("estilo passed the partial a Mark: the card would show the app's mark twice")
+ }
+ if h := renderScreen(t, "estilo-signin-screen", SignInScreen{App: "Docs", Icon: "/i.svg", State: st, Preview: true}); !strings.Contains(h, `data-stand-in-preview="true"`) {
+ t.Error("Preview was not handed on", h)
+ }
+ // A pointer to the state reads the same.
+ if h := renderScreen(t, "estilo-signin-screen", docsScreen(&st)); !strings.Contains(h, `<section rst-signin`) {
+ t.Error("a *SigninState drew no screen", h)
+ }
+ // The door's own scripts are none: anything the screen loads is the
+ // partial's (its passkey module), never inline script from estilo.
+ if strings.Contains(html, "<script") {
+ t.Error("the door drew a script", html)
+ }
+}
+
+// Exactly one brand on the card: the door's head. The partial still draws
+// its brand column until rastrillo reads HideBrand, so chrome.css hides
+// it (the first of the partial's two children, never an only child), and
+// flattens the partial's own card into the door's.
+func TestTheSmartDoorHasOneBrand(t *testing.T) {
+ src := string(CSS())
+ for _, want := range []string{
+ "[estilo-signin-screen] > section > :first-child:not(:only-child) { display: none; }",
+ "[estilo-signin-screen] > section { display: block; inline-size: auto; max-inline-size: none; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }",
+ } {
+ if !strings.Contains(src, want) {
+ t.Errorf("chrome.css lacks %q", want)
+ }
+ }
+ html := renderScreen(t, "estilo-signin-screen", docsScreen(standInState{}))
+ if n := strings.Count(html, "<p estilo-brand>"); n != 1 {
+ t.Errorf("the door drew its head %d times", n)
+ }
+ // The structure the hiding rule relies on: the wrapper's one child is
+ // the partial's card, whose first child is its brand column.
+ if !regexp.MustCompile(`<div estilo-signin-screen>\s*<section rst-signin[^>]*>\s*<div rst-signin-brand>`).MatchString(html) {
+ t.Errorf("the partial is not where chrome.css looks for it:\n%s", html)
+ }
+}
+
+// Under a base path, or with no state, there is no sign-in here: nothing
+// is drawn, the door included, and the app answers as it did before.
+func TestTheSmartDoorDrawsNothingWhenUnavailable(t *testing.T) {
+ for name, st := range map[string]any{
+ "unavailable": standInState{Unavailable: true},
+ "unavailable pointer": &standInState{Unavailable: true},
+ "nil": nil,
+ "nil pointer": (*standInState)(nil),
+ } {
+ if h := renderScreen(t, "estilo-signin-screen", docsScreen(st)); strings.TrimSpace(h) != "" {
+ t.Errorf("%s: drew %q", name, h)
+ }
+ if h := renderScreen(t, "estilo-signin-screen-title", docsScreen(st)); name == "nil" && h != "" {
+ t.Errorf("%s: a title %q", name, h)
+ }
+ }
+}
+
+// The tab title is rastrillo's, for the same state and name as the heading.
+func TestTheSmartDoorTitleIsThePartials(t *testing.T) {
+ if got := renderScreen(t, "estilo-signin-screen-title", docsScreen(standInState{})); got != "Sign in to Docs" {
+ t.Errorf("title %q", got)
+ }
+}
+
+// The Oficina ID glyph is the mark's two fanned cards alone, one colour
+// (currentColor), hidden from assistive technology, and inline.
+func TestOficinaGlyph(t *testing.T) {
+ g := string(OficinaGlyph)
+ for _, want := range []string{`<svg viewBox="18 20 62 60"`, `aria-hidden="true"`, `focusable="false"`} {
+ if !strings.Contains(g, want) {
+ t.Errorf("the glyph lacks %q", want)
+ }
+ }
+ if n := strings.Count(g, "<rect "); n != 2 {
+ t.Errorf("the glyph has %d cards, want 2", n)
+ }
+ for _, m := range regexp.MustCompile(`(fill|stroke)="([^"]*)"`).FindAllStringSubmatch(g, -1) {
+ if m[2] != "currentColor" {
+ t.Errorf("the glyph paints %s=%q: it must be one colour, currentColor", m[1], m[2])
+ }
+ }
+ for _, banned := range []string{"<script", "href", "<image", "<use", "url(", "style="} {
+ if strings.Contains(g, banned) {
+ t.Errorf("the glyph carries %q: it must be self-contained", banned)
+ }
+ }
+}
+
+// Signed out: a quiet "Forget me on this device" under Sign in, a POST to
+// rastrillo auth's Forget, for a shared computer.
+func TestSignedOutOffersForget(t *testing.T) {
+ n := SignInNotice{Icon: "/i.svg", App: "Docs"}.SignedOut("/signin").Forgetting("/auth/forget", "/d/abc", Hidden{"csrf", "tok"})
+ html := render(t, "estilo-signed-out", n)
+ want := ` <p><a rst-btn="primary" href="/signin">Sign in</a></p>
+ <form estilo-signin-forget method="post" action="/auth/forget">
+ <input type="hidden" name="return_to" value="/d/abc">
+ <input type="hidden" name="csrf" value="tok">
+ <button rst-btn="ghost" type="submit">Forget me on this device</button>
+ </form>
+</section>`
+ if !strings.Contains(html, want) {
+ t.Errorf("signed-out lacks the Forget form:\n%s\nwant:\n%s", html, want)
+ }
+ // No return, no return_to; no action, no form; not asked, not drawn.
+ if h := render(t, "estilo-signed-out", n.Forgetting("/auth/forget", "")); strings.Contains(h, "return_to") {
+ t.Error("an empty return posted return_to", h)
+ }
+ for _, h := range []string{
+ render(t, "estilo-signed-out", n.Forgetting("", "/d/abc")),
+ render(t, "estilo-signed-out", SignInNotice{Icon: "/i.svg", App: "Docs"}.SignedOut("/signin")),
+ } {
+ if strings.Contains(h, "estilo-signin-forget") {
+ t.Error("a Forget form nobody asked for", h)
+ }
+ }
+ // Its look is the door's quiet control, and keys only on its own hook.
+ src := string(CSS())
+ if !strings.Contains(src, "[estilo-signin-forget] > button {") || !strings.Contains(src, "color: var(--rst-text-muted); font-size: calc(var(--rst-fs-base) * 0.9375); font-weight: 500; }") {
+ t.Error("chrome.css does not draw Forget as a quiet text button")
+ }
+}
diff --git a/chrome/templates/signin.html b/chrome/templates/signin.html
index b845801..4b030b4 100644
--- a/chrome/templates/signin.html
+++ b/chrome/templates/signin.html
@@ -1,6 +1,7 @@
-{{/* The sign-in pages: the form, the check-your-email state and the
- signed-out page. Each is the body of a page in the app's normal
- layout, whose bar shows the brand only (no account, no Sign in).
+{{/* The sign-in pages: the form, the smart door, the check-your-email
+ state and the signed-out page. Each is the body of a page in the
+ app's normal layout, whose bar shows the brand only (no account, no
+ Sign in).
estilo-signin uses rastrillo's "field" and "callout" partials, so parse
ui.Templates() with ui.Funcs() alongside this package. The form sets
@@ -46,11 +47,34 @@
{{template "field" (dict "ID" "estilo-signin-address" "Name" "address" "Type" "email" "Label" .AddressLabel "Autocomplete" "email" "Required" true "Autofocus" true "Value" .Address "Help" .Help "Error" .AddressError)}}
<div rst-form-foot><button rst-btn="primary" type="submit">{{.Submit}}</button></div>
</form>
- {{- with .OpenSource}}
- <p estilo-signin-foot><a href="{{.Href}}">{{.Label}}</a></p>
- {{- end}}
{{template "estilo-door-close"}}{{end}}
+{{/* estilo-signin-screen: the smart door. rastrillo's sign-in screen (its
+ ui "signin" partial: the remembered way in, Other ways to sign in, the
+ chooser, Sent, Continue and Confirm) drawn inside the door: the sky
+ behind, and the app's mark and name at the card's head, which is the
+ one brand on the card. The partial's own brand column is hidden in
+ chrome.css, and HideBrand asks it not to draw one at all; the
+ released partial does not read that key yet, and a key it does not
+ read changes nothing.
+
+ Duck-typed, because estilo pins the old rastrillo path: it reads
+ .State.Unavailable and calls "signin" by name, so the app parses its
+ own rastrillo's ui.Templates() with ui.Funcs() alongside this package.
+ With State.Unavailable (or no State) it draws nothing, the door
+ included, and the app answers as it did before. Data:
+ chrome.SignInScreen. */}}
+{{define "estilo-signin-screen"}}{{with .State}}{{if not .Unavailable}}{{template "estilo-door-open" $}}
+<div estilo-signin-screen>
+{{template "signin" (dict "State" $.State "Brand" (dict "Name" $.App) "L" $.L "Preview" $.Preview "HideBrand" true)}}
+</div>
+{{template "estilo-door-close"}}{{end}}{{end}}{{end}}
+
+{{/* estilo-signin-screen-title: the screen's tab title, rastrillo's
+ "signin-title" for the same state and the same name, so the title and
+ the heading always say the same thing. Data: chrome.SignInScreen. */}}
+{{define "estilo-signin-screen-title"}}{{with .State}}{{template "signin-title" (dict "State" $.State "Brand" (dict "Name" $.App) "L" $.L)}}{{end}}{{end}}
+
{{/* estilo-signin-sent: replaces the form once a link has been sent. Link
goes back to the form, keeping the return. Data: chrome.SignInNotice. */}}
{{define "estilo-signin-sent"}}{{template "estilo-door-open" .}}
@@ -62,11 +86,24 @@
{{template "estilo-door-close"}}{{end}}
{{/* estilo-signed-out: where Sign out lands. Link is the primary
- "Sign in". Data: chrome.SignInNotice. */}}
+ "Sign in"; Forget, under it, the quiet "Forget me on this device", a
+ POST to rastrillo auth's Forget (SignInNotice.Forgetting). Data:
+ chrome.SignInNotice. */}}
{{define "estilo-signed-out"}}{{template "estilo-door-open" .}}
<h1>{{.Heading}}</h1>
<p estilo-signin-body>{{.Body}}</p>
{{- with .Link}}
<p><a rst-btn="primary" href="{{.Href}}">{{.Label}}</a></p>
{{- end}}
+ {{- with .Forget}}
+ <form estilo-signin-forget method="post" action="{{.Action}}">
+ {{- with .Return}}
+ <input type="hidden" name="return_to" value="{{.}}">
+ {{- end}}
+ {{- range .Hidden}}
+ <input type="hidden" name="{{.Name}}" value="{{.Value}}">
+ {{- end}}
+ <button rst-btn="ghost" type="submit">{{.Label}}</button>
+ </form>
+ {{- end}}
{{template "estilo-door-close"}}{{end}}
diff --git a/chrome/testdata/signin-stand-in.html b/chrome/testdata/signin-stand-in.html
new file mode 100644
index 0000000..89210ba
--- /dev/null
+++ b/chrome/testdata/signin-stand-in.html
@@ -0,0 +1,16 @@
+{{/* A stand-in for rastrillo's ui "signin" and "signin-title" partials
+ (feat/smart-door, ui/partials/signin.html), for estilo's own tests:
+ estilo pins the old rastrillo path, which has neither, so its tests
+ render estilo-signin-screen around this instead. It keeps the real
+ partial's outer shape (the rst-signin card, its brand column, then the
+ door) and the rule that an unavailable state draws nothing, and it
+ writes back the keys it was handed, so a test can see what estilo
+ passes. The real partial is the apps' to render. */}}
+{{define "signin"}}{{$s := .State}}{{if not $s.Unavailable}}<section rst-signin aria-labelledby="rst-signin-heading">
+<div rst-signin-brand>{{with .Brand.Mark}}<div rst-signin-mark>{{.}}</div>{{end}}<p rst-signin-name>{{.Brand.Name}}</p></div>
+<div rst-signin-door="one-way" data-stand-in-l="{{.L}}" data-stand-in-preview="{{.Preview}}" data-stand-in-hide-brand="{{.HideBrand}}">
+<h1 id="rst-signin-heading">Sign in to {{.Brand.Name}}</h1>
+{{with $s.Federated}}<a rst-btn="primary block" href="{{.Href}}">{{.Icon}}<span>Continue with {{.Label}}</span></a>
+{{end}}</div>
+</section>{{end}}{{end}}
+{{define "signin-title"}}Sign in to {{.Brand.Name}}{{end}}
diff --git a/chrome/unchanged_test.go b/chrome/unchanged_test.go
index eb091f9..8962be4 100644
--- a/chrome/unchanged_test.go
+++ b/chrome/unchanged_test.go
@@ -73,9 +73,11 @@ const barStackMarker = "\n/* ── Bar stack"
// mainCSS is the sha256 of chrome.css on main at f6d5605 (and of menu.css,
// which bar-stack does not touch). A change to the bar's own rules for
// every app is a design decision: make it deliberately, and update these
-// with the reason in the commit.
+// with the reason in the commit. Last updated on feat/smart-door: the
+// door's rules only (the footer slot removed; the smart door and the
+// signed-out page's Forget added), no bar rule.
const (
- mainChromeCSS = "273cb84c55d6f28bff4cc03bcba9401b4cdfbee343fe01765159317beee5cab9"
+ mainChromeCSS = "1fe15a4dee594222db73269d53ce049a303e48ef1d00f8ae44c947a6671fb4e4"
mainMenuCSS = "6b3435a18591d20ad62b40df3e64e159b501f9d1c183b2f42aa32b4faa9c0669"
)