WIP: spacing rhythm (checkpoint)
18 files changed,
+653
−221
go.mod+7 −4go.sum+6 −6internal/memoria/credits/notices.json+2 −2internal/memoria/static/brand/brand.css+1 −1internal/memoria/static/chrome.css+104 −49internal/memoria/static/memoria.css+127 −126internal/memoria/static/menu.css+8 −8internal/memoria/static/tokens.css+84 −0internal/memoria/templates/add.html+2 −2internal/memoria/templates/correct.html+3 −3internal/memoria/templates/delete.html+2 −2internal/memoria/templates/documents.html+1 −1internal/memoria/templates/feedback.html+3 −3internal/memoria/templates/index.html+5 −5internal/memoria/templates/layout.html+1 −1internal/memoria/templates/notion.html+7 −7internal/memoria/templates/reports.html+1 −1internal/memoriatest/rhythm_browser_test.go+289 −0
diff --git a/go.mod b/go.mod| index 86ac5ca..90afabe 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -6,7 +6,7 @@ toolchain go1.26.5 |
| require ( |
| amadan.net/oficina/agent-access.git v0.0.0-20261025011012-4b94ff9e8a8d |
| - amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803 |
| + amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e |
| amadan.net/oficina/home/connect v0.0.0-20261122114341-150d94e2370f |
| amadan.net/oficina/home/handoff v0.0.0-20261122114341-150d94e2370f |
| amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2 |
| @@ -27,12 +27,12 @@ require ( |
| ) |
| require ( |
| - amadan.net/rastrillo/rastrillo v0.43.0 |
| + amadan.net/rastrillo/fiesta v1.6.1 |
| + amadan.net/rastrillo/rastrillo v0.45.0 |
| github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 |
| ) |
| require ( |
| - amadan.net/rastrillo/fiesta v1.5.0 // indirect |
| amadan.net/rastrillo/rastrillo/money v0.1.0 // indirect |
| github.com/BurntSushi/toml v1.6.0 // indirect |
| github.com/danieljoos/wincred v1.2.3 // indirect |
| @@ -65,4 +65,7 @@ require ( |
| modernc.org/memory v1.11.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 fafa1e3..8d6772b 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/handoff v0.0.0-20261122114341-150d94e2370f h1:KVdTBLD+GWe9WJLpxmkOAHOKAHKMNd6yuC+cIRzEg+w= |
| @@ -12,12 +12,12 @@ amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2 h1:0PQiRUkC+ |
| amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2/go.mod h1:dXBZeB2ic33SIZiGUCzafmviUT8TYWgzSYZvo2rM6zA= |
| amadan.net/oficina/suite v0.0.0-20261102002704-91affa14eae4 h1:BP+KHZTSgL7HDCz9IL/gxKXmbmXQpclUlJIyQEY/N2E= |
| amadan.net/oficina/suite v0.0.0-20261102002704-91affa14eae4/go.mod h1:Xgw0N+DBiDzkhQHm/nIhgumfaiMElDg/KIFD1OxTm5w= |
| -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-20261114133130-c989034602fd h1:bZOyKxnshpVjbtWzNhZwnMnj/YjRaLWTg5XdNaVWWOA= |
| amadan.net/rastrillo/native/server v0.0.0-20261114133130-c989034602fd/go.mod h1:ZaaxeE278dJltdrLwmwpxUjQ5wuKzqDAVSNRet+WupY= |
| -amadan.net/rastrillo/rastrillo v0.43.0 h1:cJWZKfJ03xqMBKTh0J5tBLmefnIU8udi1jNq7x4E7f0= |
| -amadan.net/rastrillo/rastrillo v0.43.0/go.mod h1:0bufVMz8D4aWvxvJjehW70T8Jsvytrp1YEwoIzFTKm8= |
| +amadan.net/rastrillo/rastrillo v0.45.0 h1:zJfxetxg/H/CkCBFIvdGQbiATQ0hV3JR7H82AMk4bmM= |
| +amadan.net/rastrillo/rastrillo v0.45.0/go.mod h1:Vk7QL+RePyKtcP+7XclR9hpSDp/CjrVo37TENKifaFY= |
| amadan.net/rastrillo/rastrillo/money v0.1.0 h1:MxU4oqNrW8abxRTkgZBv24OYNpFnvonajNqeLIzmmaM= |
| amadan.net/rastrillo/rastrillo/money v0.1.0/go.mod h1:cmgkjBEIQh1pFSYvQk0UU6oPYS8kSDypdT9+t4Flx0U= |
| github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= |
diff --git a/internal/memoria/credits/notices.json b/internal/memoria/credits/notices.json| index 89427d0..4027f34 100644 |
| --- a/internal/memoria/credits/notices.json |
| +++ b/internal/memoria/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.43.0", |
| + "Version": "v0.45.0", |
| "SourceURL": "https://amadan.net/rastrillo/rastrillo", |
| "Notices": [ |
| { |
diff --git a/internal/memoria/static/brand/brand.css b/internal/memoria/static/brand/brand.css| index 27e25ad..475fb08 100644 |
| --- a/internal/memoria/static/brand/brand.css |
| +++ b/internal/memoria/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/memoria/static/chrome.css b/internal/memoria/static/chrome.css| index 83a482f..95a4320 100644 |
| --- a/internal/memoria/static/chrome.css |
| +++ b/internal/memoria/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/memoria/static/memoria.css b/internal/memoria/static/memoria.css| index b9a67d1..b2c6af1 100644 |
| --- a/internal/memoria/static/memoria.css |
| +++ b/internal/memoria/static/memoria.css |
| @@ -10,10 +10,16 @@ |
| * in) and a long one does not shift everything sideways. */ |
| html { scrollbar-gutter: stable; } |
| -/* 64rem is rastrillo's own column. Memoria narrowed it to 46rem, which on |
| - * a desktop left results and the documents table cramped in the middle |
| - * of the screen and wrapped dates over four lines (Paul, 2026-10-26). */ |
| -[rst-page] { box-sizing: border-box; margin: 0 auto; max-width: 64rem; padding: 1.5rem 1rem 4rem; } |
| +/* The column is rastrillo's [rst-page] (tokens.css), 64rem and padded on |
| + * the scale. Memoria narrowed it to 46rem once, which on a desktop left |
| + * results and the documents table cramped in the middle of the screen and |
| + * wrapped dates over four lines (Paul, 2026-10-26); it then restated the |
| + * column here with 4rem under it, off the scale, so it now takes Fiesta's. |
| + * |
| + * <main> is a stack (layout.html, Fiesta's "The stack"): every page's own |
| + * blocks are spaced by one table and by nothing else, so the rules below |
| + * set no margin between a page's blocks. A region that holds blocks of |
| + * its own is a stack too. */ |
| /* The header is estilo's bar (chrome.css) and is not styled here. The |
| * footer is exactly the column's width — [rst-page]'s 64rem less its 1rem |
| @@ -23,8 +29,8 @@ html { scrollbar-gutter: stable; } |
| [rst-page-footer] { |
| border-top: 1px solid var(--rst-line); |
| box-sizing: border-box; |
| - margin: 2rem auto 0; |
| - padding: 0.9rem 0 2rem; |
| + margin: var(--rst-sp-6) auto 0; |
| + padding: var(--rst-sp-4) 0 var(--rst-sp-6); |
| width: min(62rem, 100% - 2rem); |
| } |
| [rst-inline] { display: inline; } |
| @@ -42,16 +48,15 @@ html { scrollbar-gutter: stable; } |
| * is transparent. This file used to draw a second bordered box on the |
| * input, inside the first — the double border (polish audit §B3). Only |
| * the spacing below it is Memoria's. */ |
| -[rst-search] { margin-bottom: 1.5rem; } |
| /* The button sits inside the box with the same inset on every side |
| (Paul, 2026-10-31: "Button placement is off"). On a touch screen |
| rastrillo sets the box to the tap height with no vertical padding and |
| the button to the same tap height, so the button filled the box edge |
| - to edge; a small even padding gives it room. */ |
| -[rst-search] { padding: 0.3rem 0.3rem 0.3rem 0.75rem; } |
| -@media (pointer: coarse), (max-width: 40rem) { |
| - [rst-search] { padding: 0.25rem 0.25rem 0.25rem 0.75rem; } |
| -} |
| + to edge; a small even padding gives it room. One step, at every width: |
| + it was 0.3rem on a desktop and 0.25rem on a phone, the scale's |
| + --rst-sp-1 and a hand-typed near miss of it. The space under the box is |
| + the stack's. */ |
| +[rst-search] { padding: var(--rst-sp-1) var(--rst-sp-1) var(--rst-sp-1) var(--rst-sp-3); } |
| [rst-search-clear][hidden] { display: none; } |
| /* The front page with nothing searched (Paul, 2026-10-29): the wordmark |
| @@ -75,12 +80,12 @@ html { scrollbar-gutter: stable; } |
| overflow: hidden; |
| } |
| [rst-suggest-box][hidden] { display: none; } |
| -[rst-suggest-list] { list-style: none; margin: 0; padding: 0.35rem 0; } |
| +[rst-suggest-list] { list-style: none; margin: 0; padding: var(--rst-sp-1) 0; } |
| [rst-suggest-item] { |
| display: flex; |
| align-items: baseline; |
| - gap: 0.5rem; |
| - padding: 0.5rem 1rem; |
| + gap: var(--rst-sp-2); |
| + padding: var(--rst-sp-2) var(--rst-sp-4); |
| color: var(--rst-text); |
| text-decoration: none; |
| overflow: hidden; |
| @@ -103,51 +108,52 @@ html { scrollbar-gutter: stable; } |
| flex: none; |
| font: inherit; |
| font-size: 0.8125rem; |
| - margin-right: 0.75rem; |
| - padding: 0.2rem 0.75rem; |
| + margin-right: var(--rst-sp-3); |
| + padding: var(--rst-sp-1) var(--rst-sp-3); |
| } |
| [rst-suggest-copy]:hover { border-color: var(--rst-accent); color: var(--rst-accent-strong); } |
| [rst-suggest-copy][hidden] { display: none; } |
| [rst-suggest-fact] { |
| border-bottom: 1px solid var(--rst-line); |
| - padding-top: 0.65rem; |
| - padding-bottom: 0.75rem; |
| + padding-block: var(--rst-sp-3); |
| flex-wrap: wrap; |
| white-space: normal; |
| - row-gap: 0.15rem; |
| + row-gap: var(--rst-sp-1); |
| } |
| [rst-suggest-fact] strong { font-size: 1.125rem; } |
| [rst-suggest-fact-label] { color: var(--rst-text-muted); font-size: 0.875rem; } |
| [rst-suggest-all] { color: var(--rst-text-muted); font-size: 0.875rem; justify-content: space-between; } |
| -[rst-suggest-notice] { color: var(--rst-text-muted); font-size: 0.8125rem; padding: 0.4rem 1rem; } |
| +[rst-suggest-notice] { color: var(--rst-text-muted); font-size: 0.8125rem; padding: var(--rst-sp-2) var(--rst-sp-4); } |
| /* The box's middle on the screen's middle: the page's top padding is |
| half the screen less the bar, the main area's own padding and half the |
| box. The lists below it grow downwards and never move it. */ |
| -[rst-home] { padding-top: max(1rem, calc(50svh - 9.5rem)); min-height: 70svh; } |
| -[rst-home-notice] { font-size: 0.8125rem; margin: 0 0 0.4rem; } |
| +[rst-home] { |
| + /* spacing-allow: centres the search box on the screen; it is geometry, not rhythm */ |
| + padding-top: max(1rem, calc(50svh - 9.5rem)); |
| + min-height: 70svh; |
| +} |
| +[rst-home-notice] { font-size: 0.8125rem; } |
| [rst-home-try] { |
| align-items: center; |
| display: flex; |
| flex-wrap: wrap; |
| font-size: 0.875rem; |
| - gap: 0.4rem; |
| - margin: 1rem 0 0; |
| + gap: var(--rst-sp-2); |
| } |
| [rst-home-chip] { |
| background: var(--rst-surface); |
| border: 1px solid var(--rst-line); |
| border-radius: 999px; |
| color: var(--rst-text); |
| - padding: 0.25rem 0.75rem; |
| + padding: var(--rst-sp-1) var(--rst-sp-3); |
| text-decoration: none; |
| } |
| [rst-home-chip]:hover { border-color: var(--rst-accent); color: var(--rst-accent-strong); } |
| [rst-home-lists] { |
| display: grid; |
| grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); |
| - gap: 1.25rem 2.5rem; |
| - margin-top: 1.75rem; |
| + gap: var(--rst-sp-5) var(--rst-sp-6); |
| } |
| [rst-home-lists] [hidden] { display: none; } |
| [rst-home-label] { |
| @@ -158,7 +164,6 @@ html { scrollbar-gutter: stable; } |
| font-weight: 600; |
| justify-content: space-between; |
| letter-spacing: 0.06em; |
| - margin: 0 0 0.4rem; |
| text-transform: uppercase; |
| } |
| [rst-home-clear] { |
| @@ -176,34 +181,34 @@ html { scrollbar-gutter: stable; } |
| [rst-home-list] { list-style: none; margin: 0; padding: 0; } |
| /* The front page's lists are rastrillo's list rows; a little tighter |
| than its default, as a secondary part of a page. */ |
| -[rst-home-list] [rst-row] { padding: 0.55rem 0.5rem; margin: 0 -0.5rem; border-radius: 0.375rem; border-top: 0; border-bottom: 1px solid var(--rst-line); } |
| +[rst-home-list] [rst-row] { padding: var(--rst-sp-2); margin: 0 calc(-1 * var(--rst-sp-2)); border-radius: 0.375rem; border-top: 0; border-bottom: 1px solid var(--rst-line); } |
| [rst-home-list] [rst-row-main] > a { font-weight: 500; } |
| [rst-home-list] [rst-row-main] > a, |
| [rst-home-list] [rst-row-sub] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| [rst-home-list] [rst-row-main] > a { display: block; } |
| -[rst-home] [rst-search] { margin-bottom: 0.75rem; } |
| @media (max-width: 640px) { |
| - [rst-home] { padding-top: 18svh; } |
| + [rst-home] { padding-top: 18svh; /* spacing-allow: on a phone the box sits higher, clear of the keyboard; geometry, not rhythm */ } |
| } |
| -[rst-section] { border-top: 1px solid var(--rst-line); margin-top: 2.5rem; padding-top: 1rem; } |
| +/* A section of a page opens under a rule. The stack puts --rst-sp-5 |
| + * above it (rst-section); this is the rule and the space under it. Only |
| + * a <section>: the front page's lists open a section of the stack too, |
| + * with no rule. */ |
| +section[rst-section] { border-top: 1px solid var(--rst-line); padding-top: var(--rst-sp-4); } |
| /* A section's heading and its one action share a line. */ |
| [rst-section-head] { |
| align-items: center; |
| display: flex; |
| flex-wrap: wrap; |
| - gap: 0.75rem 1rem; |
| + gap: var(--rst-sp-3) var(--rst-sp-4); |
| justify-content: space-between; |
| - margin-bottom: 0.75rem; |
| } |
| -[rst-section-head] h2 { margin: 0; } |
| +[rst-section-head] :is(h1, h2) { margin: 0; } |
| -/* rastrillo's form bar is position:sticky; bottom:0, which is right for a |
| - * long settings page and wrong here — it floated the submit button over |
| - * the textarea it belongs under. Ours is an ordinary row. */ |
| -[rst-stack] [rst-form-bar] { position: static; margin-top: 1rem; } |
| -[rst-stack] { display: flex; flex-direction: column; gap: 0.35rem; } |
| -[rst-stack] label { font-weight: 560; margin-top: 0.6rem; } |
| +/* A form is a stack (tokens.css): label to field and field to hint |
| + * --rst-sp-2, a field to the next label --rst-sp-3, and its buttons |
| + * (rst-actions) --rst-sp-4 clear. Only the labels' weight is Memoria's. */ |
| +[rst-stack] label { font-weight: 560; } |
| /* A hint inside a label is quiet: muted and regular weight, not the |
| * label's 560 (polish audit r3 B7). */ |
| [rst-hint] { font-weight: 400; } |
| @@ -222,7 +227,7 @@ html { scrollbar-gutter: stable; } |
| color: var(--rst-text); |
| font: inherit; |
| max-inline-size: 100%; |
| - padding: 0.5rem 0.65rem; |
| + padding: var(--rst-sp-2) var(--rst-sp-3); |
| width: 100%; |
| } |
| [rst-stack] input:focus-visible, |
| @@ -247,9 +252,6 @@ html { scrollbar-gutter: stable; } |
| } |
| /* Pasted prose is prose: the body font, not a code box. */ |
| [rst-stack] textarea { resize: vertical; } |
| -/* A button is as wide as its label, not the column: [rst-stack] is a |
| - * flex column, which stretched Connect and Replace edge to edge. */ |
| -[rst-stack] > button { align-self: flex-start; } |
| /* The file chooser. The native control stays — it is what works with no |
| * script, and it says which files were chosen — but its button is drawn |
| @@ -263,8 +265,9 @@ html { scrollbar-gutter: stable; } |
| cursor: pointer; |
| font: inherit; |
| font-weight: 560; |
| - margin-inline-end: 0.75rem; |
| - padding: 0.4rem 0.8rem; |
| + margin-inline-end: var(--rst-sp-3); |
| + /* spacing-allow: drawn as the app's buttons are, at rastrillo's [rst-btn] padding */ |
| + padding: 0.45rem 0.75rem; |
| } |
| [rst-stack] input[type="file"]::file-selector-button:hover { background: var(--rst-surface-2); } |
| @@ -277,7 +280,7 @@ html { scrollbar-gutter: stable; } |
| [rst-dropzone~="ready"] { |
| border: 1px dashed var(--rst-line-strong, var(--rst-line)); |
| border-radius: var(--rst-radius-sm, 6px); |
| - padding: 0.7rem 0.75rem; |
| + padding: var(--rst-sp-3); |
| transition: background-color 0.12s ease, border-color 0.12s ease; |
| } |
| /* A file is over the page. The whole document is the drop target — the |
| @@ -289,7 +292,7 @@ html { scrollbar-gutter: stable; } |
| border-color: var(--rst-accent, var(--rst-line-strong)); |
| border-style: solid; |
| } |
| -[rst-dropzone-hint], [rst-dropzone-note] { font-size: 0.8125rem; margin: 0.5rem 0 0; } |
| +[rst-dropzone-hint], [rst-dropzone-note] { font-size: 0.8125rem; margin: var(--rst-sp-2) 0 0; } |
| /* Muted, and not with .rst-cell-mut: that utility exists only as a class, |
| * so `rst-cell-mut` written as an attribute selects nothing — and the |
| * class itself is a table-cell rule (nowrap, ellipsis) that would clip |
| @@ -337,12 +340,12 @@ html { scrollbar-gutter: stable; } |
| border: 1px solid var(--rst-line); |
| border-radius: var(--rst-radius, 8px); |
| box-shadow: var(--rst-shadow-pop, none); |
| - padding: 0.6rem 0.7rem; |
| + padding: var(--rst-sp-2) var(--rst-sp-3); |
| } |
| [rst-tray-head] { |
| align-items: center; |
| display: flex; |
| - gap: 0.5rem; |
| + gap: var(--rst-sp-2); |
| justify-content: space-between; |
| } |
| [rst-tray-title] { font-weight: 620; } |
| @@ -350,7 +353,7 @@ html { scrollbar-gutter: stable; } |
| * than growing a panel taller than the window. */ |
| [rst-tray-list] { |
| list-style: none; |
| - margin: 0.5rem 0 0; |
| + margin: var(--rst-sp-2) 0 0; |
| max-height: 40vh; |
| overflow-y: auto; |
| padding: 0; |
| @@ -358,9 +361,9 @@ html { scrollbar-gutter: stable; } |
| [rst-tray-row] { |
| border-top: 1px solid var(--rst-line); |
| display: grid; |
| - gap: 0.15rem 0.5rem; |
| + gap: var(--rst-sp-1) var(--rst-sp-2); |
| grid-template-columns: 1fr auto; |
| - padding: 0.4rem 0; |
| + padding: var(--rst-sp-2) 0; |
| } |
| [rst-tray-row]:first-child { border-top: 0; } |
| /* A filename has no spaces to break at, and the tray is narrow. */ |
| @@ -387,24 +390,24 @@ html { scrollbar-gutter: stable; } |
| grid-column: 1 / -1; |
| inline-size: 100%; |
| } |
| -[rst-tray-status] { margin: 0.5rem 0 0; } |
| +[rst-tray-status] { margin: var(--rst-sp-2) 0 0; } |
| /* Unhidden and empty from the moment the script runs, so it must cost no |
| * space until it says something — and the obvious "fix" for a stray |
| * half-line in the corner is to hide the region again, which is the bug |
| * this whole arrangement exists to avoid. |
| */ |
| [rst-tray-status]:empty { margin: 0; } |
| -[rst-tray-listed] { color: var(--rst-text-muted); margin: 0.4rem 0 0; } |
| +[rst-tray-listed] { color: var(--rst-text-muted); margin: var(--rst-sp-2) 0 0; } |
| [rst-results] { list-style: none; margin: 0; padding: 0; } |
| -[rst-result] { border-top: 1px solid var(--rst-line); padding: 1.1rem 0; } |
| +[rst-result] { border-top: 1px solid var(--rst-line); padding: var(--rst-sp-4) 0; } |
| /* The whole result opens it (Paul, 2026-10-26). search.js does the |
| * clicking and marks the list once it can; without the script the title |
| * is the link, as ever. Not a stretched overlay: that made snippet text |
| * impossible to select (review, 2026-10-26). */ |
| [rst-results-clickable] [rst-result] { cursor: pointer; } |
| @media (hover: hover) { |
| - [rst-results-clickable] [rst-result] { border-radius: var(--rst-radius-sm, 6px); margin-inline: -0.75rem; padding-inline: 0.75rem; } |
| + [rst-results-clickable] [rst-result] { border-radius: var(--rst-radius-sm, 6px); margin-inline: calc(-1 * var(--rst-sp-3)); padding-inline: var(--rst-sp-3); } |
| [rst-results-clickable] [rst-result]:hover { background: var(--rst-surface-2, var(--rst-line)); } |
| } |
| [rst-result]:first-child { border-top: 0; } |
| @@ -423,7 +426,6 @@ html { scrollbar-gutter: stable; } |
| color: var(--rst-text-muted); |
| display: block; |
| font-size: 0.8125rem; |
| - margin-bottom: 0.1rem; |
| } |
| /* Row titles — a result's, and a document's in the index table — are |
| * the row's subject, in the text colour like every list title in the |
| @@ -452,11 +454,10 @@ html { scrollbar-gutter: stable; } |
| color: var(--rst-text-muted); |
| display: block; |
| font-size: 0.8125rem; |
| - margin-top: 0.1rem; |
| } |
| /* The snippet keeps a readable measure inside the wider column: lines |
| * much past 75 characters are hard to follow back to their start. */ |
| -[rst-result-snippet] { line-height: 1.55; margin: 0.45rem 0 0.3rem; max-width: 80ch; } |
| +[rst-result-snippet] { line-height: 1.55; margin: var(--rst-sp-2) 0 var(--rst-sp-1); max-width: 80ch; } |
| /* Softer highlights: no padding, so a run of matched words reads as one |
| * phrase rather than a row of separate chips. */ |
| [rst-result-snippet] mark { |
| @@ -473,7 +474,7 @@ html { scrollbar-gutter: stable; } |
| Set by the server, never by the script; see internal/memoria/query. */ |
| [rst-result-primed] { |
| border-inline-start: 3px solid var(--rst-accent, var(--rst-text)); |
| - padding-inline-start: 0.7rem; |
| + padding-inline-start: var(--rst-sp-3); |
| } |
| [rst-result-primed]:first-child { border-top: 0; } |
| /* Arrowing into the list moves real focus, so the browser's own ring is |
| @@ -489,64 +490,71 @@ html { scrollbar-gutter: stable; } |
| light mode the card is white on the grey page; in dark it is the raised |
| surface. Passages run on as one document; the one a citation points at |
| is marked, in the margin, without moving the text. */ |
| -[rst-doc-meta] { font-size: 0.875rem; margin: 0 auto 0.75rem; max-width: 46rem; } |
| -[rst-doc-nav] { margin: 0 auto 0.4rem; max-width: 46rem; } |
| +[rst-doc-meta] { font-size: 0.875rem; margin-inline: auto; max-width: 46rem; inline-size: 100%; } |
| +[rst-doc-nav] { margin-inline: auto; max-width: 46rem; inline-size: 100%; } |
| [rst-paper] { |
| background: var(--rst-surface); |
| border: 1px solid var(--rst-line); |
| border-radius: calc(var(--rst-radius) * 1.5); |
| box-shadow: var(--rst-shadow-lift); |
| - margin: 0 auto 3rem; |
| - max-width: 46rem; |
| - padding: 2.75rem 3.25rem 3rem; |
| + /* <main> is a flex column, where auto margins shrink a box to its |
| + content: the width is stated. 51rem is the 46rem measure the text |
| + has always had, inside the card's padding. */ |
| + box-sizing: border-box; |
| + inline-size: 100%; |
| + margin-inline: auto; |
| + max-width: 51rem; |
| + padding: var(--rst-sp-6); |
| line-height: 1.65; |
| } |
| -[rst-doc-title] { font-size: 2rem; letter-spacing: -0.02em; margin: 0 0 1.5rem; } |
| -[rst-doc-heading] { margin: 1.75rem 0 0.5rem; } |
| +[rst-doc-title] { font-size: 2rem; letter-spacing: -0.02em; margin: 0 0 var(--rst-sp-5); } |
| +[rst-doc-heading] { margin: var(--rst-sp-5) 0 var(--rst-sp-2); } |
| h2[rst-doc-heading] { font-size: 1.35rem; } |
| h3[rst-doc-heading] { font-size: 1.1rem; } |
| -[rst-doc-subhead] { font-size: 1rem; margin: 1.25rem 0 0.4rem; } |
| -[rst-passage] { scroll-margin-top: 5rem; border-radius: 0.375rem; margin: 0 -0.75rem; padding: 0.15rem 0.75rem; } |
| +[rst-doc-subhead] { font-size: 1rem; margin: var(--rst-sp-4) 0 var(--rst-sp-2); } |
| +[rst-passage] { scroll-margin-top: 5rem; border-radius: 0.375rem; margin: 0 calc(-1 * var(--rst-sp-3)); padding: var(--rst-sp-1) var(--rst-sp-3); } |
| [rst-passage]:target { background: var(--rst-accent-soft); box-shadow: inset 3px 0 0 var(--rst-accent); } |
| -[rst-passage] p { margin: 0 0 0.9rem; } |
| +/* The document's own text: a paragraph, a list, a quote, a block of code |
| + * or a table ends one step above the next (and the passage's padding |
| + * gives the last one room inside its mark). A list indents by one wide |
| + * step a level. */ |
| +[rst-passage] p { margin: 0 0 var(--rst-sp-4); } |
| [rst-passage] a { overflow-wrap: anywhere; } |
| -[rst-doc-list] { margin: 0 0 0.9rem; padding-left: 1.4rem; } |
| -[rst-doc-list] li { margin: 0.15rem 0; } |
| -[rst-doc-list] li[rst-depth="1"] { margin-left: 1.4rem; } |
| -[rst-doc-list] li[rst-depth="2"] { margin-left: 2.8rem; } |
| -[rst-doc-list] li[rst-depth="3"] { margin-left: 4.2rem; } |
| -[rst-doc-list] li[rst-doc-todo] { list-style: none; margin-left: -1.4rem; } |
| +[rst-doc-list] { margin: 0 0 var(--rst-sp-4); padding-left: var(--rst-sp-5); } |
| +[rst-doc-list] li { margin: var(--rst-sp-1) 0; } |
| +[rst-doc-list] li[rst-depth="1"] { margin-left: var(--rst-sp-5); } |
| +[rst-doc-list] li[rst-depth="2"] { margin-left: 3rem; /* spacing-allow: a third level is two indents in, 2 x --rst-sp-5 */ } |
| +[rst-doc-list] li[rst-depth="3"] { margin-left: 4.5rem; /* spacing-allow: a fourth level is three indents in, 3 x --rst-sp-5 */ } |
| +[rst-doc-list] li[rst-doc-todo] { list-style: none; margin-left: calc(-1 * var(--rst-sp-5)); } |
| [rst-doc-props] { |
| display: grid; |
| grid-template-columns: minmax(7rem, max-content) 1fr; |
| - gap: 0.4rem 1.5rem; |
| - margin: 0 0 1.25rem; |
| - padding: 0.9rem 1rem; |
| + gap: var(--rst-sp-2) var(--rst-sp-5); |
| + margin: 0 0 var(--rst-sp-4); |
| + padding: var(--rst-sp-3) var(--rst-sp-4); |
| border: 1px solid var(--rst-line); |
| border-radius: var(--rst-radius); |
| background: var(--rst-surface-2); |
| } |
| [rst-doc-props] dt { color: var(--rst-text-muted); } |
| [rst-doc-props] dd { margin: 0; } |
| -[rst-doc-quote] { border-inline-start: 3px solid var(--rst-line-strong); color: var(--rst-text-muted); margin: 0 0 0.9rem; padding: 0.1rem 0 0.1rem 1rem; } |
| -[rst-doc-code] { background: var(--rst-surface-2); border-radius: var(--rst-radius); font-size: 0.875rem; margin: 0 0 0.9rem; overflow-x: auto; padding: 0.75rem 1rem; } |
| -[rst-doc-table] { margin: 0 0 1rem; overflow-x: auto; } |
| +[rst-doc-quote] { border-inline-start: 3px solid var(--rst-line-strong); color: var(--rst-text-muted); margin: 0 0 var(--rst-sp-4); padding: 0 0 0 var(--rst-sp-4); } |
| +[rst-doc-code] { background: var(--rst-surface-2); border-radius: var(--rst-radius); font-size: 0.875rem; margin: 0 0 var(--rst-sp-4); overflow-x: auto; padding: var(--rst-sp-3) var(--rst-sp-4); } |
| +[rst-doc-table] { margin: 0 0 var(--rst-sp-4); overflow-x: auto; } |
| [rst-doc-table] table { border-collapse: collapse; font-size: 0.9375rem; } |
| -[rst-doc-table] th, [rst-doc-table] td { border: 1px solid var(--rst-line); padding: 0.35rem 0.6rem; text-align: left; vertical-align: top; } |
| +[rst-doc-table] th, [rst-doc-table] td { border: 1px solid var(--rst-line); padding: var(--rst-sp-1) var(--rst-sp-2); text-align: left; vertical-align: top; } |
| [rst-doc-table] th { background: var(--rst-surface-2); } |
| @media (max-width: 640px) { |
| - [rst-paper] { padding: 1.5rem 1.25rem 2rem; border-radius: var(--rst-radius); } |
| + [rst-paper] { padding: var(--rst-sp-5) var(--rst-sp-4); border-radius: var(--rst-radius); } |
| [rst-doc-title] { font-size: 1.6rem; } |
| [rst-doc-props] { grid-template-columns: 1fr; gap: 0 0; } |
| - [rst-doc-props] dd { margin-bottom: 0.5rem; } |
| + [rst-doc-props] dd { margin-bottom: var(--rst-sp-2); } |
| } |
| -[rst-breadcrumb] { margin-bottom: 0.75rem; } |
| - |
| [rst-table] { border-collapse: collapse; width: 100%; } |
| [rst-table] th, [rst-table] td { |
| border-bottom: 1px solid var(--rst-line); |
| - padding: 0.45rem 0.5rem 0.45rem 0; |
| + padding: var(--rst-sp-2) var(--rst-sp-2) var(--rst-sp-2) 0; |
| text-align: start; |
| } |
| [rst-table] th { font-size: 0.8125rem; font-weight: 560; } |
| @@ -565,7 +573,7 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| @media (hover: none) { |
| [rst-docs] td:last-child [rst-btn] { border-color: var(--rst-line); color: var(--rst-text); } |
| } |
| -[rst-docs] th, [rst-docs] td { padding-inline-end: 1rem; } |
| +[rst-docs] th, [rst-docs] td { padding-inline-end: var(--rst-sp-4); } |
| [rst-docs] th:last-child, [rst-docs] td:last-child { padding-inline-end: 0; } |
| /* A wide table scrolls inside its own box rather than widening the page |
| * past a phone's screen. */ |
| @@ -588,31 +596,27 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| [rst-docs] th:nth-child(3), [rst-docs] td:nth-child(3) { display: none; } |
| } |
| -[rst-search-empty] { margin: 0 0 1rem; } |
| /* A typing request's note that §8.9 was deferred; never shown. */ |
| [rst-facts-deferred] { display: none; } |
| /* The Sources page's lists: rows with a rule between them. They were |
| * rastrillo's rounded rst-list card holding bare <li>s, so browser bullets |
| * sat inside the card with the text touching its edge. */ |
| -[rst-sources] { border-top: 1px solid var(--rst-line); list-style: none; margin: 0.75rem 0 0; padding: 0; } |
| -[rst-sources] > li { border-bottom: 1px solid var(--rst-line); display: grid; gap: 0.35rem; padding: 0.75rem 0; } |
| +[rst-sources] { border-top: 1px solid var(--rst-line); list-style: none; margin: 0; padding: 0; } |
| +[rst-sources] > li { border-bottom: 1px solid var(--rst-line); display: grid; gap: var(--rst-sp-2); padding: var(--rst-sp-3) 0; } |
| [rst-sources] > li > p { margin: 0; } |
| [rst-source-name] { font-weight: 600; } |
| /* The Notion import's figures: a two-column list, not the browser's |
| * indented one-per-line definition list. */ |
| -[rst-facts] { display: grid; gap: 0.35rem 1rem; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); margin: 0.75rem 0 0; } |
| +[rst-facts] { display: grid; gap: var(--rst-sp-2) var(--rst-sp-4); grid-template-columns: minmax(0, max-content) minmax(0, 1fr); margin: 0; } |
| [rst-facts] dt { color: var(--rst-text-muted); } |
| [rst-facts] dd { margin: 0; } |
| @media (max-width: 26rem) { |
| [rst-facts] { grid-template-columns: minmax(0, 1fr); } |
| - [rst-facts] dd { margin-bottom: 0.4rem; } |
| + [rst-facts] dd { margin-bottom: var(--rst-sp-2); } |
| } |
| -/* Delete, asked first (delete.html). */ |
| -[rst-confirm] form { display: flex; flex-wrap: wrap; gap: var(--rst-sp-2); margin-top: 1.25rem; } |
| - |
| /* §8.8's fact box: a validated fact lifted out of the passages below, |
| with its citation. Sits between the withholding notice and the result |
| list, and is styled to read as an answer rather than as a result — |
| @@ -622,15 +626,14 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| [rst-fact-box] { |
| border: 1px solid var(--rst-line); |
| border-radius: var(--rst-radius); |
| - padding: 1rem 1.15rem 0.75rem; |
| - margin: 0 0 1.25rem; |
| + padding: var(--rst-sp-4) var(--rst-sp-4) var(--rst-sp-3); |
| background: var(--rst-surface); |
| } |
| [rst-fact] { |
| align-items: baseline; |
| display: flex; |
| flex-wrap: wrap; |
| - gap: 0.15rem 0.6rem; |
| + gap: var(--rst-sp-1) var(--rst-sp-2); |
| margin: 0; |
| } |
| [rst-fact-label] { flex-basis: 100%; } |
| @@ -646,18 +649,19 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| color: var(--rst-tone-warning-fg, var(--rst-text)); |
| font-size: 0.75rem; |
| font-weight: 600; |
| + /* spacing-allow: a pill's word sits on its centre line, a hair inside the edge */ |
| padding: 0.1rem 0.5rem; |
| } |
| [rst-fact-report] { |
| font-size: 0.75rem; |
| - margin: 0.5rem 0 0; |
| + margin: var(--rst-sp-2) 0 0; |
| text-align: end; |
| } |
| [rst-fact-report] a { color: var(--rst-text-muted); } |
| [rst-fact] + [rst-fact], |
| [rst-fact-note] + [rst-fact] { |
| - margin-top: 0.5rem; |
| - padding-top: 0.5rem; |
| + margin-top: var(--rst-sp-2); |
| + padding-top: var(--rst-sp-2); |
| border-top: 1px solid var(--rst-line); |
| } |
| [rst-fact-label] { |
| @@ -678,7 +682,6 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| } |
| /* §8.8's ?explain=facts account: a plain disclosure under the box. */ |
| [rst-fact-explain] { |
| - margin: 0 0 1rem; |
| font-size: 0.8125rem; |
| } |
| [rst-fact-explain] summary { cursor: pointer; color: var(--rst-text-muted); } |
| @@ -688,7 +691,7 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| [rst-fact-note] { |
| color: var(--rst-text-muted); |
| font-size: 0.8125rem; |
| - margin: 0.5rem 0 0; |
| + margin: var(--rst-sp-2) 0 0; |
| } |
| /* §8.9: a row a model pointed at, rather than one a checksum validated. |
| @@ -701,51 +704,49 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| } |
| /* §8.10's correction page and the person's own reports. */ |
| -[rst-correct] fieldset { border: 0; margin: 1rem 0; padding: 0; } |
| -[rst-correct] legend { font-weight: 600; margin-bottom: 0.5rem; } |
| -[rst-correct-form] + [rst-correct-form] { border-top: 1px solid var(--rst-line); padding-top: 1rem; } |
| +[rst-correct] fieldset { border: 0; margin: 0; padding: 0; } |
| +[rst-correct] legend { font-weight: 600; margin-bottom: var(--rst-sp-2); } |
| +[rst-correct-form] + [rst-correct-form] { border-top: 1px solid var(--rst-line); padding-top: var(--rst-sp-4); } |
| [rst-correct-option] { |
| align-items: baseline; |
| border-top: 1px solid var(--rst-line); |
| cursor: pointer; |
| display: flex; |
| flex-wrap: wrap; |
| - gap: 0.25rem 0.6rem; |
| - padding: 0.6rem 0; |
| + gap: var(--rst-sp-1) var(--rst-sp-2); |
| + padding: var(--rst-sp-2) 0; |
| } |
| /* Phone numbers, eircodes and VAT numbers stay whole; an email or an |
| * IBAN can be long and wraps rather than widening the page. */ |
| [rst-correct-value] { font-variant-numeric: tabular-nums; font-weight: 600; overflow-wrap: anywhere; } |
| [rst-correct-value][rst-nowrap] { overflow-wrap: normal; white-space: nowrap; } |
| [rst-correct] textarea { width: 100%; } |
| -[rst-reports] { margin-top: 0.5rem; } |
| -[rst-report-list] { list-style: none; margin: 1rem 0 0; padding: 0; } |
| -[rst-report] { border-top: 1px solid var(--rst-line); padding: 0.9rem 0; } |
| -[rst-report] p { margin: 0 0 0.35rem; } |
| +[rst-report-list] { list-style: none; margin: 0; padding: 0; } |
| +[rst-report] { border-top: 1px solid var(--rst-line); padding: var(--rst-sp-3) 0; } |
| +[rst-report] p { margin: 0 0 var(--rst-sp-1); } |
| [rst-report-note] { color: var(--rst-text-muted); white-space: pre-wrap; } |
| /* §8.11's AI answer: marked 🤖 and named, quieter than a checked answer, |
| * with its citations as links. */ |
| -[rst-answer] { margin: 0 0 1.25rem; } |
| [rst-answer-pending]:empty { display: none; } |
| [rst-ai-answer] { |
| border: 1px solid var(--rst-line); |
| border-radius: var(--rst-radius); |
| background: var(--rst-surface); |
| - padding: 0.9rem 1.15rem; |
| + padding: var(--rst-sp-3) var(--rst-sp-4); |
| } |
| -[rst-ai-by] { color: var(--rst-text-muted); font-size: 0.8125rem; margin: 0 0 0.4rem; } |
| -[rst-ai-text] { line-height: 1.6; margin: 0 0 0.5rem; } |
| +[rst-ai-by] { color: var(--rst-text-muted); font-size: 0.8125rem; margin: 0 0 var(--rst-sp-2); } |
| +[rst-ai-text] { line-height: 1.6; margin: 0 0 var(--rst-sp-2); } |
| [rst-ai-text]:last-child { margin-bottom: 0; } |
| -[rst-ai-list] { line-height: 1.6; margin: 0 0 0.5rem; padding-left: 1.25rem; } |
| +[rst-ai-list] { line-height: 1.6; margin: 0 0 var(--rst-sp-2); padding-left: var(--rst-sp-5); } |
| [rst-ai-list]:last-child { margin-bottom: 0; } |
| -[rst-ai-list] li + li { margin-top: 0.2rem; } |
| +[rst-ai-list] li + li { margin-top: var(--rst-sp-1); } |
| [rst-ai-feedback] { |
| display: flex; |
| align-items: center; |
| justify-content: flex-end; |
| - gap: 0.25rem; |
| - margin: 0.5rem 0 0; |
| + gap: var(--rst-sp-1); |
| + margin: var(--rst-sp-2) 0 0; |
| font-size: 0.8125rem; |
| } |
| [rst-ai-cite] { font-size: 0.8125rem; text-decoration: none; } |
| @@ -754,7 +755,7 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| /* The footer is one quiet line; the egress statement opens under it. */ |
| [rst-foot-details] summary { cursor: pointer; font-size: 0.8125rem; list-style: none; } |
| [rst-foot-details] summary::-webkit-details-marker { display: none; } |
| -[rst-foot-details] p { font-size: 0.8125rem; margin: 0.5rem 0 0; } |
| +[rst-foot-details] p { font-size: 0.8125rem; margin: var(--rst-sp-2) 0 0; } |
| /* A table row or list item whose main link opens it (Paul, 2026-10-31: |
| any list item with a link should be clickable as a whole). Where a |
diff --git a/internal/memoria/static/menu.css b/internal/memoria/static/menu.css| index 9070652..eb420e2 100644 |
| --- a/internal/memoria/static/menu.css |
| +++ b/internal/memoria/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/memoria/static/tokens.css b/internal/memoria/static/tokens.css| index 3ae9664..07f8b10 100644 |
| --- a/internal/memoria/static/tokens.css |
| +++ b/internal/memoria/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/memoria/templates/add.html b/internal/memoria/templates/add.html| index bef8485..6d47516 100644 |
| --- a/internal/memoria/templates/add.html |
| +++ b/internal/memoria/templates/add.html |
| @@ -6,7 +6,7 @@ |
| back HERE with its outcome rather than to the index. The index keeps |
| search and the document list, and links here. */}} |
| <nav rst-breadcrumb><a href="/documents">← Documents</a></nav> |
| -<section> |
| +<section rst-stack> |
| <h1>Add content</h1> |
| <form method="post" action="/documents" enctype="multipart/form-data" rst-stack> |
| <label for="title">Title <span rst-muted rst-hint>{{.Drop.TitleHint}}</span></label> |
| @@ -84,7 +84,7 @@ |
| <p rst-dropzone-note role="status" aria-live="polite" hidden></p> |
| </div> |
| {{end}} |
| - <div rst-form-bar><button rst-btn="primary">Store it</button></div> |
| + <div rst-actions><button rst-btn="primary">Store it</button></div> |
| </form> |
| {{if .Flash}}<div rst-callout rst-tone="{{.FlashKind | tone}}"{{if eq .FlashKind "danger"}} role="alert"{{end}}><div rst-callout-body><p>{{.Flash}}</p></div></div>{{end}} |
diff --git a/internal/memoria/templates/correct.html b/internal/memoria/templates/correct.html| index 0753ec9..689af2a 100644 |
| --- a/internal/memoria/templates/correct.html |
| +++ b/internal/memoria/templates/correct.html |
| @@ -2,7 +2,7 @@ |
| handle, never a value or a span; the POST re-runs the ruled search |
| and accepts the choice only if it is still this person's. */}} |
| {{define "content"}} |
| -<section rst-correct> |
| +<section rst-correct rst-stack> |
| <h1>Is this wrong?</h1> |
| <p rst-muted>For “{{.Query}}”. Pick the right one, or “None of these”, and say why if you like. It is saved for you to look at later under <a href="/reports">Reports</a>.</p> |
| {{/* §4.1's loud withholding, as on the search page: without it a list |
| @@ -19,7 +19,7 @@ |
| <p rst-muted>Nothing here to correct for this search.</p> |
| {{end}} |
| {{range $k := .Kinds}} |
| - <form method="post" action="/facts/correct" rst-correct-form> |
| + <form method="post" action="/facts/correct" rst-correct-form rst-stack rst-section> |
| <input type="hidden" name="q" value="{{$.Query}}"> |
| <input type="hidden" name="kind" value="{{.Kind}}"> |
| <fieldset> |
| @@ -39,7 +39,7 @@ |
| </fieldset> |
| <label for="note-{{.Kind}}">Why? (optional)</label> |
| <textarea id="note-{{.Kind}}" name="note" rows="3"></textarea> |
| - <p><button rst-btn="primary" type="submit">Send</button> <a href="/?q={{$.Query}}">Back to the search</a></p> |
| + <div rst-actions><button rst-btn="primary" type="submit">Send</button> <a href="/?q={{$.Query}}">Back to the search</a></div> |
| </form> |
| {{end}} |
| </section> |
diff --git a/internal/memoria/templates/delete.html b/internal/memoria/templates/delete.html| index 481df2d..8140d68 100644 |
| --- a/internal/memoria/templates/delete.html |
| +++ b/internal/memoria/templates/delete.html |
| @@ -3,10 +3,10 @@ |
| and nothing on the page behind it can take a keystroke meant for it. |
| Data: documentPage, with Title and ID. */}} |
| {{define "content"}} |
| -<section rst-confirm> |
| +<section rst-stack> |
| <h1>Delete document</h1> |
| <p>Delete “{{.Title}}” from Memoria? Nobody here will find it in a search again, and this can’t be undone.</p> |
| - <form method="post" action="/documents/{{.ID}}/delete"> |
| + <form method="post" action="/documents/{{.ID}}/delete" rst-actions> |
| <button rst-btn="danger" type="submit">Delete</button> |
| <a rst-btn href="/documents">Cancel</a> |
| </form> |
diff --git a/internal/memoria/templates/documents.html b/internal/memoria/templates/documents.html| index 5314397..bf33da0 100644 |
| --- a/internal/memoria/templates/documents.html |
| +++ b/internal/memoria/templates/documents.html |
| @@ -4,7 +4,7 @@ |
| {{if .Notices}}<div rst-callout rst-tone="warning" rst-withheld><div rst-callout-body>{{range .Notices}}<p>{{.}}</p>{{end}}</div></div>{{end}} |
| {{if .Flash}}<div rst-callout rst-tone="{{.FlashKind | tone}}"{{if eq .FlashKind "danger"}} role="alert"{{end}}><div rst-callout-body><p>{{.Flash}}</p></div></div>{{end}} |
| -<section> |
| +<section rst-stack> |
| {{if .Partial}}{{template "partial" .}}{{else}}<div rst-section-head> |
| <h1>{{len .Documents}} document{{if ne (len .Documents) 1}}s{{end}}</h1> |
| <a rst-btn="primary" href="/add">Add content</a> |
diff --git a/internal/memoria/templates/feedback.html b/internal/memoria/templates/feedback.html| index 078f4b7..06547c0 100644 |
| --- a/internal/memoria/templates/feedback.html |
| +++ b/internal/memoria/templates/feedback.html |
| @@ -2,16 +2,16 @@ |
| wrong. No answer text is shown, because none is kept — the cited |
| passages are links, through their own pages' access checks. */}} |
| {{define "content"}} |
| -<section rst-correct> |
| +<section rst-correct rst-stack> |
| <h1>What was wrong?</h1> |
| <p rst-muted>Thanks — your 👎 on the AI answer for “{{.Feedback.Query}}” is saved under <a href="/reports">Reports</a>. Say what was wrong if you like.</p> |
| {{with .Feedback.Cited}} |
| <p rst-muted>It cited: {{range $i, $l := .}}{{if $i}} · {{end}}<a href="{{$l.Href}}">passage {{inc $i}}</a>{{if $l.Status}} ({{$l.Status}}){{end}}{{end}}</p> |
| {{end}} |
| - <form method="post" action="/answer/feedback/{{.Feedback.ID}}" rst-correct-form> |
| + <form method="post" action="/answer/feedback/{{.Feedback.ID}}" rst-correct-form rst-stack> |
| <label for="note">What was wrong? (optional)</label> |
| <textarea id="note" name="note" rows="3"></textarea> |
| - <p><button rst-btn="primary" type="submit">Send</button> <a href="/?q={{.Feedback.Query}}">Back to the search</a></p> |
| + <div rst-actions><button rst-btn="primary" type="submit">Send</button> <a href="/?q={{.Feedback.Query}}">Back to the search</a></div> |
| </form> |
| </section> |
| {{end}} |
diff --git a/internal/memoria/templates/index.html b/internal/memoria/templates/index.html| index d275e21..160ff15 100644 |
| --- a/internal/memoria/templates/index.html |
| +++ b/internal/memoria/templates/index.html |
| @@ -12,7 +12,7 @@ |
| last few searches and recently updated documents under it. A page |
| loaded WITH a query — a link, a reload, a scriptless submit — is a |
| results page and starts at the top. The documents list is /documents. */}} |
| -<div{{if not .Searched}} rst-home{{end}}> |
| +<div{{if not .Searched}} rst-home{{end}} rst-stack> |
| {{/* rst-suggest positions the typeahead under the box; search.js fills |
| rst-suggest-box from /suggest. Without the script it stays empty and |
| hidden, and Enter is the form's submit. */}} |
| @@ -43,8 +43,8 @@ |
| checked values, and people other documents mention (trysuggest.go). */}} |
| <p rst-home-try><span rst-muted>Try</span>{{range .}} <a href="/?q={{.}}" rst-home-chip>{{.}}</a>{{end}}</p> |
| {{end}} |
| -<div rst-home-lists> |
| - <section rst-home-history hidden> |
| +<div rst-home-lists rst-section> |
| + <section rst-home-history rst-stack hidden> |
| <h2 rst-home-label>Recent searches <button type="button" rst-home-clear>Clear</button></h2> |
| <ul rst-home-list></ul> |
| </section> |
| @@ -53,7 +53,7 @@ |
| withheld, an empty section with "Docs did not answer" is the loud |
| withholding §4.1 asks for, and no section at all would be silent |
| (Fable's review of e1f6829). */}} |
| - <section> |
| + <section rst-stack> |
| <h2 rst-home-label>Recently updated</h2> |
| {{range .RecentNotices}}<p rst-muted rst-home-notice>{{.}}</p>{{end}} |
| {{with .Recent}}<ul rst-home-list> |
| @@ -73,7 +73,7 @@ |
| from, written by the server. search.js reads it, not the box, to ask |
| for the AI answer: after a Back a browser restores the input's value |
| on its own schedule, and the box can disagree with the screen. */}} |
| -<div rst-refresh="results" |
| +<div rst-refresh="results" rst-stack rst-section |
| rst-search-results-for="{{.Query}}">{{template "results" .}}</div> |
| </div> |
diff --git a/internal/memoria/templates/layout.html b/internal/memoria/templates/layout.html| index 5804e64..412de80 100644 |
| --- a/internal/memoria/templates/layout.html |
| +++ b/internal/memoria/templates/layout.html |
| @@ -69,7 +69,7 @@ |
| <div estilo-shell> |
| <a rst-skip href="#main">{{.Frame.Chrome.Labels.Skip}}</a> |
| {{template "estilo-bar" (withL (.Frame.Chrome) $L)}} |
| -<main rst-page id="main"> |
| +<main rst-page rst-stack id="main"> |
| {{template "content" .}} |
| </main> |
| {{/* The footer is said only to somebody signed in: its count and its |
diff --git a/internal/memoria/templates/notion.html b/internal/memoria/templates/notion.html| index 9baeb34..c567430 100644 |
| --- a/internal/memoria/templates/notion.html |
| +++ b/internal/memoria/templates/notion.html |
| @@ -30,7 +30,7 @@ |
| </p></div> |
| </div> |
| - <section rst-section> |
| + <section rst-stack rst-section> |
| <h2>Connect</h2> |
| <ol rst-steps> |
| <li>In Notion, create an <strong>internal integration</strong> with |
| @@ -51,7 +51,7 @@ |
| {{else}} |
| - <section rst-section> |
| + <section rst-stack rst-section> |
| <h2>Connected</h2> |
| <p rst-muted> |
| {{if .Verified}}Token last checked {{.Verified}}.{{else}}Token stored.{{end}} |
| @@ -63,7 +63,7 @@ |
| <p>The page counts could not be read, so this says nothing about how much has been imported.</p> |
| {{end}} |
| - <form method="post" action="/connectors/notion/sync" rst-inline> |
| + <form method="post" action="/connectors/notion/sync" rst-actions> |
| <button rst-btn="primary"{{if .Run}}{{if .Run.Running}} disabled{{end}}{{end}}> |
| {{if .Run}}{{if .Run.Running}}Importing…{{else}}Import now{{end}}{{else}}Import now{{end}} |
| </button> |
| @@ -71,7 +71,7 @@ |
| </section> |
| {{if .Run}} |
| - <section rst-section> |
| + <section rst-stack rst-section> |
| <h2>Last import</h2> |
| {{/* A callout toned by the run's state (spec §4, runTone): a run in |
| progress or finished cleanly is info (untoned), one that finished |
| @@ -108,7 +108,7 @@ |
| </section> |
| {{end}} |
| - <section rst-section> |
| + <section rst-stack rst-section> |
| <h2>Replace the token</h2> |
| <p rst-muted> |
| Rotating a token replaces the stored one. The old token is not kept. |
| @@ -127,14 +127,14 @@ |
| </form> |
| </section> |
| - <section rst-section> |
| + <section rst-stack rst-section> |
| <h2>Disconnect</h2> |
| <p> |
| This removes the token and stops future imports. <strong>It deletes |
| nothing Memoria has already imported</strong> — those pages stay |
| here until someone deletes them in Memoria. |
| </p> |
| - <form method="post" action="/connectors/notion/disconnect" rst-inline> |
| + <form method="post" action="/connectors/notion/disconnect" rst-actions> |
| <button rst-btn="danger">Disconnect Notion</button> |
| </form> |
| </section> |
diff --git a/internal/memoria/templates/reports.html b/internal/memoria/templates/reports.html| index 5ad1403..6d1fe20 100644 |
| --- a/internal/memoria/templates/reports.html |
| +++ b/internal/memoria/templates/reports.html |
| @@ -2,7 +2,7 @@ |
| to the passage, through that page's own access check; this page |
| holds no passage text. */}} |
| {{define "content"}} |
| -<section rst-reports> |
| +<section rst-stack> |
| <h1>Reports</h1>{{if .Partial}} |
| {{template "partial" .}}{{else}} |
| {{if not .Reports}} |
diff --git a/internal/memoriatest/rhythm_browser_test.go b/internal/memoriatest/rhythm_browser_test.go| new file mode 100644 |
| index 0000000..fef7915 |
| --- /dev/null |
| +++ b/internal/memoriatest/rhythm_browser_test.go |
| @@ -0,0 +1,289 @@ |
| +//go:build browser |
| + |
| +// Fiesta's rhythm audit over Memoria's screens, in a real Chromium. Run |
| +// with `make browser`. |
| +// |
| +// Paul, 2026-11-22: "Can we somehow put something in place to avoid |
| +// weird spacing issues like this in future?", then "Release and start |
| +// the rollout". `make ci` runs the stylesheet half (go tool fiesta |
| +// spacing); this is the half only a laid-out page can answer: every gap |
| +// between two blocks is a step of the scale, no text rests on a control, |
| +// and every heading sits closer to its own content than to what comes |
| +// before it. |
| +// |
| +// The audit does not walk into an element carrying an rst- name other |
| +// than rst-page, rst-stack and rst-section, because those are Fiesta's |
| +// components, spaced by Fiesta. Memoria's own regions are rst- names too |
| +// (rst-home, rst-paper, rst-fact-box, rst-ai-answer, …), so to the audit |
| +// each would be one opaque block. Each page is therefore read from main |
| +// AND from each of those regions it shows, as roots of their own: a |
| +// root is always walked. Fiesta's own components inside them (a callout, |
| +// a table, a list row) are still Fiesta's. |
| +// |
| +// The skips, and only these: the document's own text inside the paper |
| +// card ([rst-passage], the renderer's paragraphs, lists, tables and |
| +// quotes, spaced as a document is and not as a screen), and the |
| +// connect pages' and the door's insides, which are estilo's and Home's |
| +// and audited there (estilo 6238a47; Home 8125a3c). |
| +// |
| +// Written against origin/main's memoria.css first (5d9034d): it failed |
| +// there with 43 findings across the screens (off-scale gaps such as the |
| +// 2rem above the footer, 1.75rem above the home lists and 1.1rem |
| +// results, and headings further from their text than from the block |
| +// before them), and passes on the stack. |
| +package memoriatest |
| + |
| +import ( |
| + "context" |
| + "fmt" |
| + "io" |
| + "log/slog" |
| + "net/http" |
| + "net/url" |
| + "path/filepath" |
| + "regexp" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/rastrillo/fiesta/check/rhythm" |
| + "amadan.net/rastrillo/rastrillo/db" |
| + "amadan.net/rastrillo/rastrillo/harness" |
| + "github.com/chromedp/cdproto/runtime" |
| + "github.com/chromedp/chromedp" |
| + |
| + memoria "amadan.net/oficina/memoria/internal/memoria" |
| + "amadan.net/oficina/memoria/internal/memoria/provider" |
| +) |
| + |
| +// quickAI answers at once, with a paragraph and a list, so the answer |
| +// card is drawn with both of its shapes. |
| +type quickAI struct{} |
| + |
| +func (quickAI) ExtractAddresses(context.Context, []string) ([]provider.Pointer, error) { |
| + return []provider.Pointer{}, nil |
| +} |
| + |
| +func (quickAI) Answer(context.Context, string, []string) ([]provider.Sentence, error) { |
| + return []provider.Sentence{ |
| + {Text: "The kitchen rota is pinned by the kettle.", Cite: []int{0}}, |
| + {Text: "- Mondays: Paul", Cite: []int{0}}, |
| + {Text: "- Tuesdays: Doc", Cite: []int{0}}, |
| + }, nil |
| +} |
| + |
| +// rhythmRegions are Memoria's own regions that hold blocks, each audited |
| +// as a root of its own where the page shows one (see above). |
| +var rhythmRegions = []string{ |
| + "[rst-home]", |
| + "[rst-home-lists] > section", |
| + "[rst-refresh=\"results\"]", |
| + "[rst-answer]", |
| + "[rst-ai-answer]", |
| + "[rst-fact-box]", |
| + "[rst-paper]", |
| + "[rst-correct]", |
| + "[rst-sources] > li", |
| + "[rst-report]", |
| + "[rst-page-footer]", |
| +} |
| + |
| +// rhythmSkip are the regions whose spacing is not the page's. |
| +var rhythmSkip = []string{ |
| + "[rst-passage]", |
| + "[rst-doc-props]", |
| + // The Colophon is estilo's template and estilo's stylesheet |
| + // (estilo/credits); its h1 and list keep the browser's margins, which |
| + // is estilo's to put on its stack. |
| + "[estilo-credits]", |
| +} |
| + |
| +// auditRhythm reads the page the browser is on from main and from each |
| +// of Memoria's regions it shows, and returns every finding. |
| +func auditRhythm(ctx context.Context) ([]rhythm.Finding, error) { |
| + var all []rhythm.Finding |
| + for _, root := range append([]string{"main"}, rhythmRegions...) { |
| + var present bool |
| + if err := chromedp.Do(ctx, evalInto(&present, fmt.Sprintf(`!!document.querySelector(%q)`, root))); err != nil { |
| + return nil, err |
| + } |
| + if !present { |
| + continue |
| + } |
| + var found []rhythm.Finding |
| + if err := chromedp.Do(ctx, evalInto(&found, rhythm.Expression(root, rhythm.Options{Skip: rhythmSkip}))); err != nil { |
| + return nil, fmt.Errorf("audit %s: %w", root, err) |
| + } |
| + for i := range found { |
| + found[i].Message = root + ": " + found[i].Message |
| + } |
| + all = append(all, found...) |
| + } |
| + return all, nil |
| +} |
| + |
| +// settle waits for the page's fonts, so the audit measures the type the |
| +// reader sees and not the fallback's. |
| +var settle = evalOnly(`document.fonts.ready.then(() => true)`, func(p *runtime.EvaluateParams) { p.AwaitPromise = new(true) }) |
| + |
| +// TestEveryScreenKeepsTheRhythm is the audit over every signed-in |
| +// screen, at a desktop width and a phone's. |
| +func TestEveryScreenKeepsTheRhythm(t *testing.T) { |
| + rig := harness.New(t, func(origin string) http.Handler { |
| + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) |
| + d, err := db.Open(filepath.Join(t.TempDir(), "app.db"), logger) |
| + if err != nil { |
| + t.Fatalf("db.Open: %v", err) |
| + } |
| + t.Cleanup(func() { d.Close() }) |
| + mux, a, err := memoria.AppForTest(d, origin, testDEK(t), logger) |
| + if err != nil { |
| + t.Fatalf("AppForTest: %v", err) |
| + } |
| + a.UseFakeModel(quickAI{}) |
| + for _, doc := range [][2]string{ |
| + {"Office", "## Office Address\n\nThe office phone number is: +353 (0)1 547 7854\n\n" + |
| + "We also have the following unused phone numbers: +353 (0)1 598 1234\n\nOffice VAT: IE3384527RH\n\n" + |
| + "### Directions\n\n- Take the Luas to Abbey Street\n- Walk north\n - Past the Spire\n\n> Ring the bell twice.\n\n" + |
| + "| Floor | Team |\n|---|---|\n| 1 | Sales |\n| 2 | Ops |\n"}, |
| + {"Kitchen", "## Rota\n\nThe kitchen rota is pinned by the kettle."}, |
| + {"Accounts", "## Contact\n\nAccounts email: accounts@tito-example.ie"}, |
| + } { |
| + if _, err := a.Store().Ingest(context.Background(), memoria.IngestSpec{Source: "upload", Key: doc[0], Title: doc[0], Body: doc[1]}); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + return mux |
| + }) |
| + |
| + run := func(what string, actions ...chromedp.Action[chromedp.Void]) { |
| + t.Helper() |
| + ctx, cancel := context.WithTimeout(rig.Context(), 30*time.Second) |
| + defer cancel() |
| + if err := chromedp.Do(ctx, actions...); err != nil { |
| + t.Fatalf("%s: %v", what, err) |
| + } |
| + } |
| + |
| + // A document's page, its delete question, a correction (so Reports |
| + // has a row) and a 👎 (so the feedback page exists). |
| + var at string |
| + run("find a document", |
| + chromedp.Navigate(rig.Origin+"/documents"), |
| + chromedp.WaitVisible(chromedp.CSS(`a[href^="/documents/"]`)), |
| + attributeInto(chromedp.CSS(`a[href^="/documents/"]`), "href", &at, nil), |
| + ) |
| + doc := regexp.MustCompile(`^/documents/\d+$`).FindString(at) |
| + if doc == "" { |
| + t.Fatalf("the documents list links no document (got %q)", at) |
| + } |
| + phone := "/facts/correct?q=" + url.QueryEscape("office phone number") |
| + run("report a correction", |
| + chromedp.Navigate(rig.Origin+phone), |
| + chromedp.WaitVisible(chromedp.CSS(`input[name="choice"]`)), |
| + chromedp.Click(chromedp.CSS(`input[name="choice"]`)), |
| + chromedp.Submit(chromedp.CSS(`input[name="choice"]`)), |
| + chromedp.WaitVisible(chromedp.CSS(`input[type="search"]`)), |
| + ) |
| + var feedback string |
| + run("rate an answer down", |
| + chromedp.Navigate(rig.Origin+"/?q="+url.QueryEscape("kitchen rota")), |
| + chromedp.WaitVisible(chromedp.CSS(`[rst-ai-feedback] button[value="down"]`)), |
| + chromedp.Click(chromedp.CSS(`[rst-ai-feedback] button[value="down"]`)), |
| + chromedp.WaitVisible(chromedp.CSS(`textarea[name="note"]`)), |
| + locationInto(&feedback), |
| + ) |
| + if u, err := url.Parse(feedback); err == nil { |
| + feedback = u.Path |
| + } |
| + |
| + screens := []struct{ path, ready string }{ |
| + {"/", `[rst-home]`}, |
| + {"/?q=" + url.QueryEscape("office phone number"), `[rst-fact-box]`}, |
| + {"/?q=" + url.QueryEscape("office phone number") + "&explain=facts", `[rst-fact-explain]`}, |
| + {"/?q=" + url.QueryEscape("kitchen rota"), `[rst-ai-answer]`}, |
| + {"/?q=" + url.QueryEscape("zebra crossings"), `[rst-search-empty]`}, |
| + {"/documents", `[rst-docs]`}, |
| + {doc, `[rst-paper]`}, |
| + {doc + "/delete", `form[action$="/delete"]`}, |
| + {"/add", `textarea[name="body"]`}, |
| + {"/connectors", `main h1`}, |
| + {"/connectors/notion", `input[name="token"]`}, |
| + {phone, `input[name="choice"]`}, |
| + {"/reports", `[rst-report]`}, |
| + {feedback, `textarea[name="note"]`}, |
| + {"/help/open-source", `main h1`}, |
| + {"/no-such-page", `main`}, |
| + } |
| + for _, width := range []int64{1280, 390} { |
| + for _, s := range screens { |
| + ctx, cancel := context.WithTimeout(rig.Context(), 30*time.Second) |
| + err := chromedp.Do(ctx, |
| + chromedp.EmulateViewport(width, 900), |
| + chromedp.Navigate(rig.Origin+s.path), |
| + chromedp.WaitVisible(chromedp.CSS(s.ready)), |
| + settle, |
| + ) |
| + var found []rhythm.Finding |
| + if err == nil { |
| + found, err = auditRhythm(ctx) |
| + } |
| + cancel() |
| + if err != nil { |
| + t.Fatalf("%s at %dpx: %v", s.path, width, err) |
| + } |
| + if len(found) > 0 { |
| + t.Errorf("%s at %dpx: %s", s.path, width, rhythm.Report(found)) |
| + } |
| + } |
| + } |
| +} |
| + |
| +// TestTheDoorKeepsTheRhythm: the signed-out pages, drawn through the |
| +// production App with sign-in wired: the door and /signed-out. |
| +func TestTheDoorKeepsTheRhythm(t *testing.T) { |
| + rig := harness.New(t, func(origin string) http.Handler { |
| + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) |
| + d, err := db.Open(filepath.Join(t.TempDir(), "app.db"), logger) |
| + if err != nil { |
| + t.Fatalf("db.Open: %v", err) |
| + } |
| + t.Cleanup(func() { d.Close() }) |
| + mux, a, err := memoria.App(d, origin, testDEK(t), logger) |
| + if err != nil { |
| + t.Fatalf("App: %v", err) |
| + } |
| + au, err := memoria.NewAuth(d.Writer(), memoria.AuthEnv{ |
| + Origin: origin, InstanceKey: "rhythm-test-instance-key", |
| + Owners: []string{dialTestOwner}, Mailer: &stubMailer{}, |
| + }, logger, a) |
| + if err != nil { |
| + t.Fatalf("NewAuth: %v", err) |
| + } |
| + a.UseAuth(au) |
| + a.SetOwners([]string{dialTestOwner}) |
| + a.MountAuth(mux, origin) |
| + return mux |
| + }) |
| + for _, width := range []int64{1280, 390} { |
| + for _, path := range []string{"/signin", "/signed-out"} { |
| + ctx, cancel := context.WithTimeout(rig.Context(), 30*time.Second) |
| + err := chromedp.Do(ctx, |
| + chromedp.EmulateViewport(width, 900), |
| + chromedp.Navigate(rig.Origin+path), |
| + chromedp.WaitVisible(chromedp.CSS(`main`)), |
| + settle, |
| + ) |
| + var found []rhythm.Finding |
| + if err == nil { |
| + found, err = auditRhythm(ctx) |
| + } |
| + cancel() |
| + if err != nil { |
| + t.Fatalf("%s at %dpx: %v", path, width, err) |
| + } |
| + if len(found) > 0 { |
| + t.Errorf("%s at %dpx: %s", path, width, rhythm.Report(found)) |
| + } |
| + } |
| + } |
| +} |