Plan: the editor, tidied
One estilo task (the desk part, from Docs' rules) and ten Slides tasks: estilo at head and the grey desk; a page that never scrolls and a pinned New slide; the icon view switch; the phone frame; floating notes; the floating card and Format; the card following the selection; its fields regrouped; the bar's pills and the cover; the gate and the handoff. Nothing is pushed or merged without Paul.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 file changed,
+278
−0
docs/superpowers/plans/2026-11-16-editor-tidy.md+278 −0
diff --git a/docs/superpowers/plans/2026-11-16-editor-tidy.md b/docs/superpowers/plans/2026-11-16-editor-tidy.md| new file mode 100644 |
| index 0000000..6923198 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-16-editor-tidy.md |
| @@ -0,0 +1,278 @@ |
| +# The editor, tidied — implementation plan |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** The Slides editor gets Docs' grey desk, a floating inspector that follows the selection, floating notes, a pinned New slide pill, a three-icon view switch and a phone-shaped phone frame, with no change to any document state. |
| + |
| +**Architecture:** The shared look (floating card, labelled groups, segmented control, desk colour) becomes a new estilo part, `desk`, written from Docs' rules; Slides pins it and uses it. In Slides the server renders the final layout (the card's open or closed state comes from a cookie); one root attribute, `data-inspect`, says what the card shows, and CSS does the showing. Three small new JS modules own the new behaviour (`inspect.mjs`, `notes-card.mjs`, `phone-frame.mjs`); `editor-entry.js` only wires them. |
| + |
| +**Tech Stack:** Go templates and CSS in `internal/slides`; the editor bundle in `fixtures/*.mjs` (built to `internal/slides/static/editor.<hash>.js`); estilo as a Go module; chromedp browser tests in `internal/slidestest` (build tag `browser`); `node --test` for the JS modules. |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-16-editor-tidy-design.md` (cited as **§n**). The mockup beside it shows where things go, not which fields exist; the spec wins. |
| + |
| +## Global Constraints |
| + |
| +- **No document state changes** (§ intro). No field, op, migration, Rust core or renderer change. If a task seems to need one, stop and report. |
| +- **Two repos, two branches.** estilo: worktree `~/amadan.net/oficina/estilo-desk`, branch `desk`, cut from `origin/main` after `git fetch` (head was `4d5b935`). Slides: worktree `~/amadan.net/oficina/slides-editor-tidy`, branch `editor-tidy`, cut from `origin/main` after `git fetch` (was `cb30df5`), then `git cherry-pick` the commits of `design/editor-tidy` (docs only) so the spec, mockup and this plan travel with the code. |
| +- **Nothing is pushed, merged or posted without Paul's word.** Each branch needs an amadan discussion before merge, posted as the agent account, never as Paul; squash merge only on green `amadan ci status -branch <name>` (`AGENTS.md`). Tasks A1 and B10 stop at "ready to push" and ask. |
| +- **Every string is a catalog key** in `internal/slides/locales/en.toml` (the only locale) and listed in `editorStrings` (`internal/slides/editor.go:183`). The strings table below is a proposal: run the copy-review skill once with Paul before Task B4 and use his wording verbatim. |
| +- **Icons are lucide, inline**, added to `internal/slides/icons/icons.go` with the same `<svg class="icon" …>` wrapper as its neighbours, and to the credits inventory (`make ci` runs `credits-check`). |
| +- **Never a flash; the stage is not a second renderer** (`AGENTS.md`). The font-wait inert list (`fixtures/editor-fonts.mjs:168-175`) is not edited: every new control lives inside one of its six selectors. |
| +- **Accessibility:** WCAG 2.2 AA; targets at least 24×24 CSS px; icon-only buttons carry `aria-label`; no information by colour or dot alone; 320px reflow below 1100px as today. |
| +- **JS house rules:** `editor-entry.js` is wiring only; every other module stays under 300 lines; each new module has a `*.test.mjs` run by `cd fixtures && node --test *.test.mjs`. |
| +- **The bundle is committed.** After any `fixtures/` change: `cd fixtures && npm ci && node build-bundles.mjs`, delete the old `internal/slides/static/editor.<hash>.js`, commit the new one. The gate rebuilds and diffs. |
| +- **Gates.** While iterating: `go test ./internal/slidestest/ -run <Test>` and the one JS test. Before each commit: `make ci`. Once before handing off: `./.amadan/ci.d/10-gate`, then `go test -tags browser ./internal/slidestest/` (outside the gate; Chromium needs its sandbox off). Leave `GOCACHE` at its default; the `GOCACHE` line in earlier plans is superseded. |
| +- **Shared machine.** Scratch under `$TMPDIR`; bind any server to `127.0.0.1` or `100.119.180.57`; stop what you start; no `sudo`. |
| +- **Commits:** subject under 80 characters, blank line, body; end with `Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>`. |
| + |
| +### Names every task shares |
| + |
| +| Name | Meaning | |
| +|---|---| |
| +| `--estilo-desk`, `--estilo-desk-ink` | Desk ground and the muted ink on it. | |
| +| `[estilo-card]` | The floating surface: 12px radius, Docs' background, border and shadow. | |
| +| `[estilo-inspector]` | A card's inside: 13px type, a column of groups 14px apart, scrolls inside itself. | |
| +| `[estilo-inspector-group]`, `[estilo-inspector-label]` | A labelled group and its label. | |
| +| `[estilo-seg]`, `[estilo-seg-item]` | Segmented control and one segment (button, or label wrapping a radio). | |
| +| `--estilo-inspector-inline-size` (248px), `--estilo-inspector-inset` (12px) | The card's width and its gap from the desk's edges. | |
| +| `[slides-editor][data-inspect="box\|notes\|slide"]` | What the card shows. Server renders `slide`. | |
| +| `<aside slides-inspector id="slides-inspector" data-state="open\|closed">` | The card. Replaces `<details slides-inspector>`. | |
| +| Cookie `slides-inspector=open\|closed; Path=/; Max-Age=31536000; SameSite=Lax` | The card's remembered state; absent means open. | |
| +| `[slides-notes-pane][data-state="open\|closed"]`, `[slides-notes-open]`, `[slides-notes-close]`, `[slides-notes-resize]` | Notes card, the icon that opens it, its ×, its top edge. | |
| +| `NOTES_KEY` (exists), `NOTES_HEIGHT_KEY = 'slides.editor.notes.height'` | `localStorage` keys for notes open/closed and height in px. | |
| +| `[slides-phone-screen]`, `--slides-phone-scale` | The 390×844 screen inside `[slides-stage-phone]` and its scale. | |
| + |
| +### Strings (proposal for copy review) |
| + |
| +| Key (under `slides.editor.`) | English | Note | |
| +|---|---|---| |
| +| `head.format` | Format | Bar button. Replaces `head.inspector`; the View menu row keeps its own key, `view.inspector`. | |
| +| `notes.title` | Notes | Notes card heading. | |
| +| `notes.close` | Close notes | The ×. | |
| +| `notes.open` | Show notes | The icon, slide without notes. | |
| +| `notes.open.has` | Show notes (this slide has notes) | The icon, slide with notes. | |
| +| `notes.resize` | Resize notes | The top edge. Not in §8's list; needed for its accessible name. | |
| +| `view.both.title` | Both, side by side | Tooltip and name of the third icon; `view.both` stays for the menu. | |
| +| `group.style`, `group.image`, `group.description`, `group.place`, `group.boxes`, `group.slide` | Style, Image, Description, Place, Boxes, This slide | Group labels. Reuse an existing key instead wherever its English is identical (`format.label` is already "Text"; Alignment, On a phone and the Deck heading have keys). | |
| + |
| +Removed: `head.inspector`, the inspector's summary title, `inspector.empty`, `slide.notes.show` (the View menu row reads `view.notes`). |
| + |
| +## Review Focus |
| + |
| +1. **A window under 1100px, down to 320px, and a short one (1280×600).** The card is in the flow under the stage, regrouped; Format still shows and hides it; no sideways scroll; at 1280×600 the card and notes scroll inside themselves. Pinned in B6 (`TestTidyNarrowAndShortWindows`). |
| +2. **The selected box disappears** (a collaborator deletes it, or this person undoes its creation). The card returns to the slide's options; it never shows an empty box. Pinned in B7 (`inspect.test.mjs`, `TestTidyCardSurvivesBoxRemoval`). |
| +3. **An old preference, and cookies blocked.** A `localStorage` inspector preference from before is honoured once and moved to the cookie; with cookies blocked, Format still toggles for the session. Pinned in B6 (`head.test.mjs`). |
| +4. **A deck with no slides.** The card shows the deck's options only, the notes icon is disabled, New slide is still pinned and works. Pinned in B7 (`TestTidyEmptyDeck`). |
| +5. **Fonts still loading.** The card, the notes card, its icon and the New slide pill are inert with the rest, and nothing moves when the fonts arrive. Pinned in B5 and B6 (assertions added beside `fonts_browser_test.go:746,982`). |
| + |
| +--- |
| + |
| +## File map |
| + |
| +| Path | Change | |
| +|---|---| |
| +| estilo `desk/desk.go`, `desk/desk.css`, `desk/desk_test.go` | New part. `func CSS() []byte`. | |
| +| `go.mod`, `go.sum`, `internal/slides/render.go`, `templates/layout.html` | Pin estilo; serve and link `static/estilo/desk.css`. | |
| +| `internal/slides/static/desk.css`, `decks.css` | Desk colour from the token; deck list ground. | |
| +| `internal/slides/icons/icons.go` | `monitor`, `smartphone`, `monitor-smartphone`, `notebook-pen`. | |
| +| `internal/slides/templates/editor.html` | Bar, strip foot, stage bar, notes card, inspector card. | |
| +| `internal/slides/static/editor.css` | Page grid, strip, switch, phone frame, notes, card. | |
| +| `internal/slides/editor.go` | `inspectorState`, `editorStrings`, the template's `Inspector` field. | |
| +| `fixtures/inspect.mjs`, `notes-card.mjs`, `phone-frame.mjs` (+ `.test.mjs`) | New modules. | |
| +| `fixtures/head.mjs`, `format-bar.mjs`, `inspector.mjs`, `inspector-block.mjs`, `switcher.mjs`, `editor-entry.js` | Changed as each task says. | |
| +| `internal/slidestest/editor_tidy_test.go` | HTML tests (in the gate). | |
| +| `internal/slidestest/browser_editor_tidy_test.go` (`//go:build browser`) | Browser tests (outside the gate). | |
| +| `internal/slidestest/harness_test.go` | `deckWithSlides(t, a, cookies, n int) string`. | |
| + |
| +--- |
| + |
| +## Part A: estilo |
| + |
| +### Task A1: The `desk` part |
| + |
| +**Files:** Create `desk/desk.go`, `desk/desk.css`, `desk/desk_test.go` in the estilo worktree. Reference (read only): Docs `internal/docs/views/show.html` at Docs' `origin/main` (`b45b7b2`), the inspector rules near lines 1365-1420 and the `--docs-desk` declarations. |
| + |
| +**Interfaces:** |
| +- Produces: package `desk` with `func CSS() []byte`; the tokens and attributes in "Names every task shares". |
| + |
| +- [ ] **Step 1: Write the failing tests** in `desk/desk_test.go`, in the style of `menu/menu_test.go:25` (`TestFloatsAreRoundedAndMenubarTitlesSquare`): `TestDeskTokensAreDefined` (`tokencheck.Undefined(CSS())` is empty) and `TestCardAndSegAreDocs`, which asserts `CSS()` contains each of these literals, one `t.Errorf` per miss: |
| + |
| +```go |
| +var pins = []string{ |
| + "--estilo-desk: light-dark(#e3e7ee, #0e1015)", |
| + "--estilo-desk-ink: light-dark(#586070, #9aa1ad)", |
| + "--estilo-inspector-inline-size: 248px", |
| + "--estilo-inspector-inset: 12px", |
| + "border-radius: 12px", |
| + "padding: 12px", |
| + "light-dark(rgb(255 255 255 / 0.92), rgb(32 35 43 / 0.92))", |
| + "0 28px 56px -20px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7))", |
| + "backdrop-filter: saturate(1.4) blur(14px)", |
| + "font: 650 11px/14px", |
| + "block-size: 28px", |
| + "box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 45%, transparent)", |
| + "outline: 2px solid Highlight", |
| +} |
| +``` |
| + |
| +- [ ] **Step 2: Run** `go test ./desk/` — fails: package has no `CSS`. |
| +- [ ] **Step 3: Write `desk.go` and `desk.css`.** Copy Docs' values exactly, renaming `docs-inspector` → `estilo-card` + `estilo-inspector`, `docs-toolbar-group` → `estilo-inspector-group`, `docs-toolbar-label` → `estilo-inspector-label`, `docs-tool` → `estilo-seg-item` inside `[estilo-seg]`. Decisions the copy does not make: |
| + - `[estilo-card]` is the surface only (background, border, radius, shadow, the `::before` backdrop). It sets no position: the app places it. |
| + - `[estilo-inspector]` sets `font-size: 13px`, a column with `gap: 14px`, `overflow-y: auto`, `overscroll-behavior: contain`, and `[data-state="closed"] { display: none }`. |
| + - A segment is selected when `[aria-pressed="true"]` **or** `:has(input:checked)`, so one control serves toggles and radios. Focus ring on `:focus-visible` and on `:has(input:focus-visible)`. A segment is at least 28px tall and 24px wide. |
| + - A group with nothing showing is not shown: `[estilo-inspector-group]:not(:has(> :not([estilo-inspector-label], [hidden]))) { display: none }`. |
| + - Selects, text and number fields inside `[estilo-inspector]` take Docs' select rule (`block-size: 28px; border: 1px solid var(--rst-line); border-radius: 8px; font-size: 13px; font-weight: 500`). |
| + - No `rst-` selectors (`internal/lint/prefix_test.go` fails on them); `rst-` custom properties are read, as `chrome.css` reads them. |
| + - A header comment names the Docs commit the values came from. |
| +- [ ] **Step 4: Run** `make test` — passes, including the prefix lint. |
| +- [ ] **Step 5: Commit** (`desk: the floating card, its groups, the segmented control`). Report "ready to push" and ask Paul before pushing and opening the estilo discussion. Part B may start on the pushed commit; it does not wait for the merge. |
| + |
| +--- |
| + |
| +## Part B: Slides |
| + |
| +### Task B1: Pin estilo, the desk colour, the deck list ground |
| + |
| +**Files:** `go.mod`, `go.sum`, `internal/slides/render.go:75-83`, `templates/layout.html`, `static/desk.css`, `static/decks.css:13-20`, `static/theme.css` and the other files `scripts/writeestilo` rewrites; test `internal/slidestest/editor_tidy_test.go`. |
| + |
| +**Interfaces:** |
| +- Consumes: A1's pushed commit. |
| +- Produces: `static/estilo/desk.css` served and linked on every page that links `chrome.css`; `--slides-desk` now `var(--estilo-desk)`. |
| + |
| +- [ ] **Step 1: Failing tests.** `TestEditorTidyServesEstiloDesk`: `GET /static/estilo/desk.css` is 200 and contains `--estilo-desk:`; the editor page and the deck list each link it. `TestEditorTidyDeskIsEstilos`: `static/desk.css` contains `var(--estilo-desk)` and not `#ebe7e2`; `static/decks.css` contains no `gradient` inside the `body:has([slides-decks])` rule. |
| +- [ ] **Step 2: Run** `go test ./internal/slidestest/ -run TestEditorTidy` — fails. |
| +- [ ] **Step 3: Implement.** `go get amadan.net/oficina/estilo.git@<A1 commit>`; `go run ./scripts/writeestilo`; add `desk.css` to `staticFiles()` and a `<link>` after `chrome.css`; `--slides-desk` reads the token (keep its `@property` registration, with initial value `#e3e7ee`); the deck list's ground is `var(--slides-desk)`. |
| +- [ ] **Step 4: Run** the two tests, then `go test ./internal/slides/ -run 'TestThemeIsEstilosForSlides|TestBusyFilesAreEstilos'`, then `go test -tags browser ./internal/slidestest/ -run 'Head|Bar|Menu'`. The pin moves estilo from `260f98c` to head, which also brings the stacked-bar changes: fix what breaks in Slides' own header CSS (`editor.css:152-395`) and list every visible difference in the commit body. |
| +- [ ] **Step 5: Commit** (`Editor: estilo at head with the desk part; Docs' grey desk`). |
| + |
| +### Task B2: The page never scrolls; the strip and the pinned New slide |
| + |
| +**Files:** `static/editor.css` (root grid 38-46, desk 74-84 and 1285-1304, strip 455-500, 563-655, 1306-1321), `templates/editor.html:317-355`, `harness_test.go`, `browser_editor_tidy_test.go`. |
| + |
| +**Interfaces:** |
| +- Produces: `deckWithSlides(t, a, cookies, n)` returning the editor path of a deck with `n` slides, the first carrying 400 words of notes; `[slides-strip-foot]`, a non-scrolling foot of `[slides-strip-nav]` holding `[slides-strip-add]`. |
| + |
| +- [ ] **Step 1: Failing browser tests.** `TestTidyPageNeverScrolls`: for a 40-slide deck at 1280×720 and at 1920×1080, `document.documentElement.scrollHeight === window.innerHeight` and `scrollWidth === innerWidth`. (B5 and B7 extend this test with notes open and a box selected.) `TestTidyNewSlideStaysInView`: with the strip scrolled to its top and to its end, `[slides-strip-add]`'s rect is inside the viewport and inside `[slides-strip-nav]`; clicking it adds a 41st slide; the layouts popover's bottom edge is at or above the pill's top edge. |
| +- [ ] **Step 2: Run** `go test -tags browser ./internal/slidestest/ -run TestTidy` — fails. |
| +- [ ] **Step 3: Implement.** From 1100px: `[slides-editor] { block-size: 100dvh; overflow: hidden }`, the desk row `minmax(0, 1fr)`, every pane `min-block-size: 0`; `[slides-strip]` is the only scroller in the strip (`overflow-y: auto`). Under 1100px the stacked column scrolls the page as today. `[slides-strip-add]` moves out of the `<ol>` into `<div slides-strip-foot>`; the button and `[slides-layouts-toggle]` render as one pill (shared border, a hairline between them, radius on the outer ends only); `#slides-layouts` opens upward. The strip's ground is the bar's surface with a 1px `var(--rst-line)` on its desk edge. |
| +- [ ] **Step 4: Run** the two tests and `-run Strip` (existing strip browser tests) — pass. |
| +- [ ] **Step 5: Commit** (`Editor: a page that never scrolls; New slide pinned to the strip`). |
| + |
| +### Task B3: Icons and the view switch |
| + |
| +**Files:** `icons/icons.go`, the credits inventory, `templates/editor.html:357-381`, `static/editor.css:982-1016`, `fixtures/switcher.mjs` (only if a selector changes), `editor_tidy_test.go`, `browser_editor_tidy_test.go`. |
| + |
| +**Interfaces:** |
| +- Produces: icons `monitor`, `smartphone`, `monitor-smartphone`, `notebook-pen`; `fieldset[slides-switcher][estilo-seg]` whose three `label[estilo-seg-item]` each wrap a visually hidden `input[type=radio][name="slides-view"]` and an icon. |
| + |
| +- [ ] **Step 1: Failing tests.** `TestEditorTidyViewSwitchIsThreeIconRadios`: the editor HTML has exactly three `name="slides-view"` radios (`desktop`, `phone`, `both`), each inside an `estilo-seg-item` label with an `aria-label` and a `title` from `view.desktop`, `view.phone`, `view.both.title`, and each label contains `<svg class="icon"`. Browser, `TestTidyViewSwitch`: clicking each icon, and ArrowRight from the first, lights exactly one and shows the frames it names (desktop: only `[data-vp="desktop"]`; phone: only `[slides-stage-phone]`; both: both); the View menu's three rows still do the same. |
| +- [ ] **Step 2: Run** — fails (icons missing; markup is text radios). |
| +- [ ] **Step 3: Implement.** Add the four icons from lucide's current release and their credit lines. Restyle the fieldset with `[estilo-seg]`; keep the `<legend>` visually hidden. No behaviour change in `switcher.mjs`. |
| +- [ ] **Step 4: Run** both tests, `make ci` (credits-check) — pass. |
| +- [ ] **Step 5: Commit** (`Editor: the view switch is three icons`). |
| + |
| +### Task B4: The phone frame |
| + |
| +Run the copy review of the strings table with Paul before this task. |
| + |
| +**Files:** create `fixtures/phone-frame.mjs`, `fixtures/phone-frame.test.mjs`; `templates/editor.html:388-393`, `static/editor.css:1020-1050`, `fixtures/editor-entry.js` (wiring); `browser_editor_tidy_test.go`. |
| + |
| +**Interfaces:** |
| +- Produces: `mountPhoneFrame({ stagesEl }) → { destroy() }`, which keeps `--slides-phone-scale` on `[slides-stage-phone]` equal to `min(1, availableBlockSize / 844)` through a `ResizeObserver`; `phoneScale(available: number): number` exported for the unit test. |
| + |
| +- [ ] **Step 1: Failing tests.** `phone-frame.test.mjs`: `phoneScale(844) === 1`, `phoneScale(2000) === 1`, `phoneScale(422) === 0.5`, `phoneScale(0) === 0`. Browser, `TestTidyPhoneFrame`, at 1280×720 in phone view and in both: the frame's rect has `width / height` within 1% of `390 / 844`; its bottom is at or above the stage's bottom; the HTML inside `[slides-phone-screen]` equals what the stage showed in phone view before this task (capture the string from `main` into a testdata file first); a slide taller than 844px scrolls inside `[slides-phone-screen]` and not the page; the slide's offset from the screen's top equals its offset from the page's top in the viewer loaded at 390×844. |
| +- [ ] **Step 2: Run** — fails. |
| +- [ ] **Step 3: Implement.** `[slides-stage-phone]` is `390 × 844` px scaled by `--slides-phone-scale` from its top centre, with a 28px corner radius and the paper shadow the desktop frame has; its layout box is the scaled size so Both sits side by side without overlap. `[slides-phone-screen]` is `inline-size: 390px; block-size: 844px; overflow-y: auto`, on the viewer's page ground and with the viewer's phone placement (read both from the viewer's stylesheet; reuse its custom properties, do not copy values). The fetched phone HTML goes in the screen unchanged. |
| +- [ ] **Step 4: Run** both tests and `-run Phone` (existing `browser_phone_test.go`) — pass. |
| +- [ ] **Step 5: Rebuild the bundle; commit** (`Editor: the phone view is a phone`). |
| + |
| +### Task B5: Floating notes |
| + |
| +**Files:** create `fixtures/notes-card.mjs`, `fixtures/notes-card.test.mjs`; `templates/editor.html:357-397`, `static/editor.css:682-709`, `fixtures/editor-entry.js:79,563-573` (the notes code moves out; wiring stays), `fixtures/head.mjs` (View → notes calls the module), `editor.go` (`editorStrings`), `en.toml`; tests in both tidy files and beside `fonts_browser_test.go:746`. |
| + |
| +**Interfaces:** |
| +- Produces: `mountNotesCard({ root, storage = localStorage, hasNotes: () => boolean }) → { open(), close(), toggle(), isOpen(): boolean, refresh() }`. `refresh()` re-reads `hasNotes()` and updates the icon's dot (`data-has-notes`) and `aria-label`; editor-entry calls it on slide change and on every notes change. `clampHeight(px: number, deskPx: number, lineHeightPx: number): number` exported. |
| +- Consumes: `NOTES_KEY` semantics as they are in `editor-entry.js:563-573` today (same stored values). |
| + |
| +- [ ] **Step 1: Failing tests.** `notes-card.test.mjs`: `open/close/toggle` set `data-state` and write `NOTES_KEY` with today's values; a stored closed state mounts closed; `clampHeight` returns at least two lines plus the head and at most half the desk; `refresh()` swaps the label between `notes.open` and `notes.open.has` and sets `data-has-notes`; ArrowUp and ArrowDown on `[slides-notes-resize]` change the height by 16px, Home and End go to the limits, and each writes `NOTES_HEIGHT_KEY`. HTML, `TestEditorTidyNotesMarkup`: `[slides-notes-pane]` is inside `[slides-stage-pane]`, carries `estilo-card`, holds an `h2` (`notes.title`), `button[slides-notes-close]` with `aria-label`, `[slides-notes-resize]` with `role="separator"`, `aria-orientation="horizontal"`, `tabindex="0"` and `aria-label`, and `<div slides-notes ` (the line-358 assertion in `editor_test.go` stays true); `button[slides-notes-open]` exists; `name="slides-notes"` and `slides-notes-toggle` are gone. Browser, `TestTidyNotes`: × closes; the icon and View → Show notes reopen; the dot shows exactly when the slide has notes, across a slide change and after deleting the notes' text; dragging the top edge resizes within the limits and the height survives a reload; with notes open the stage frame's bottom is at or above the notes card's top. Extend `TestTidyPageNeverScrolls` with notes open on the 400-word slide. Font-wait: the notes card and its icon are inert while fonts load. |
| +- [ ] **Step 2: Run** — fails. |
| +- [ ] **Step 3: Implement.** The notes card is the last child of `[slides-stage-pane]`, in the flow (so the stage gives up its height by layout, with no reserve arithmetic), inset 12px, `[estilo-card]`, default height 144px, its body the only scroller. Closed, it is `display: none` and `[slides-notes-open]` shows at the pane's bottom start corner (`position: absolute`, 12px in, 32×32, icon `notebook-pen`, a 6px accent dot when `data-has-notes`). `[slides-notes]` keeps its attribute, its binding and its plugins untouched. Focus: closing by × moves focus to the icon; opening moves it into the notes. |
| +- [ ] **Step 4: Run** the new tests, then `-run 'Saving|SaveStatus|Leaving|Fonts'` under `-tags browser` unchanged — pass. |
| +- [ ] **Step 5: Rebuild the bundle; commit** (`Editor: notes float at the foot of the desk`). |
| + |
| +### Task B6: The inspector is a floating card, shown by Format |
| + |
| +**Files:** `templates/editor.html:203,166-171,400-713` (the wrapper and the button only; fields move in B8), `editor.go`, `static/editor.css:785-967,1285-1304,1396-1460`, `fixtures/head.mjs`, `fixtures/head.test.mjs` (new), `en.toml`; `editor_test.go:212` (`TestEditorInspectorMarkupIsFormsWithLabels` slices from `<aside slides-inspector`), both tidy test files. |
| + |
| +**Interfaces:** |
| +- Produces: `func inspectorState(r *http.Request) string` (`"open"` unless the cookie says `closed`), rendered as `data-state` on the aside and `aria-expanded` on the button; the Format button `<button estilo-bar-control slides-press data-view-toggle="inspector" aria-expanded aria-controls="slides-inspector">` with icon `pencil` and visible text `head.format`; `mountHead(...)` additionally returns `showInspector(on: boolean, { focus = false } = {})` and `inspectorShown(): boolean`. |
| +- Consumes: A1's `[estilo-card]`, `[estilo-inspector]`. |
| + |
| +- [ ] **Step 1: Failing tests.** HTML: `TestEditorTidyInspectorState` (no cookie → `data-state="open"` and `aria-expanded="true"`; cookie `slides-inspector=closed` → `closed` and `false`; any other value → open); the aside has `estilo-card estilo-inspector`, an `aria-label`, no `<summary>` and no element whose text is the old Inspector title; the Format button precedes Share. `head.test.mjs`: toggling writes the cookie string in "Names"; a stored `localStorage['slides.editor.inspector']` (`'on'` or `'off'`, as `head.mjs:42` writes today) with no cookie is applied once, written to the cookie as `open` or `closed` and removed; the View menu's `[data-view-toggle="inspector"]` row keeps `aria-pressed` in step with the button's `aria-expanded`; when `document.cookie` cannot be written the toggle still flips `data-state` and `aria-expanded`; `showInspector(true, { focus: true })` focuses the first focusable control in the card, and hiding it restores focus to the element focused before. Browser, `TestTidyCardFloats` at 1280×720: the card's rect is inside the desk, 12px from its top and end edges, 248px wide; its bottom is at least 12px above the desk's bottom; with every Block group showing it scrolls inside itself; the desktop frame's right edge is left of the card's left edge while it shows, and the frame's centre moves to the desk's centre when it hides; no reload flash (the first paint with the `closed` cookie has no card: screenshot before scripts run, with the bundle request blocked). `TestTidyNarrowAndShortWindows` (Review Focus 1): at 1000×800, 320×700 and 1280×600 as described there. |
| +- [ ] **Step 2: Run** — fails. |
| +- [ ] **Step 3: Implement.** `<details>`/`<summary>` become the aside. From 1100px the desk grid is `"strip stage"` only; the card is `position: absolute` in `[slides-desk]` with the insets and size above and `max-block-size: calc(100% - 24px)`; `[slides-editor]:has([slides-inspector][data-state="open"]) [slides-stage-pane]` gets `padding-inline-end: calc(var(--estilo-inspector-inline-size) + var(--estilo-inspector-inset) + 16px)`, which also keeps the notes card clear of it (§5). Under 1100px the aside is in the flow under the stage with no shadow. `data-inspector-off` goes, and so does `aria-pressed` on the bar button (the View menu's checkable row keeps it). One owner for `aria-expanded`: read estilo's `chrome.js`; if it handles `data-estilo-toggle`, add that attribute and let `head.mjs` only write the cookie and manage focus; otherwise `head.mjs` does all three. The actions that force the inspector open today (`head.mjs`, the delete-ask handler) call `showInspector(true, { focus: true })`. |
| +- [ ] **Step 4: Run** the new tests, `TestEditorInspectorMarkupIsFormsWithLabels`, and the Fonts browser tests (the card is still `[slides-inspector]`, so the inert list is unchanged; assert it) — pass. |
| +- [ ] **Step 5: Rebuild the bundle; commit** (`Editor: the inspector is a floating card, shown by Format`). |
| + |
| +### Task B7: The card follows the selection |
| + |
| +**Files:** create `fixtures/inspect.mjs`, `fixtures/inspect.test.mjs`; `fixtures/format-bar.mjs`, `selection.mjs`, `inspector.mjs`, `inspector-block.mjs`, `editor-entry.js:765` and the selection wiring; `templates/editor.html` (root attribute); `static/editor.css`; both tidy test files. |
| + |
| +**Interfaces:** |
| +- Produces: |
| + - `mountInspect({ root, onChange = () => {} }) → { selection(ids: string[]), caret(where: 'stage' | 'notes'), reset(), current(): 'box' | 'notes' | 'slide' }`. It writes `root.dataset.inspect` and calls `onChange(kind)` only when the kind changes. Rules: `selection(ids)` with ids → `box`; with none → `slide` unless the current kind is `notes`; `caret('notes')` → `notes`; `caret('stage')` leaves the kind to `selection`; `reset()` → `slide`. |
| + - `mountFormatBar({ root, keys, onCaret = () => {} })` and `plugin(where = 'stage')`; the bar calls `onCaret(where)` when a view carrying that plugin takes focus. `editor-entry.js` passes `plugin('notes')` as `notesPlugins`. |
| +- Consumes: B6's `showInspector`; `mountSelection`'s `onChange`. |
| + |
| +- [ ] **Step 1: Failing tests.** `inspect.test.mjs`: the rules above, one case each, plus: ids then `[]` → `slide` (Review Focus 2); `caret('notes')` then `selection([])` stays `notes`; then `selection(['a'])` → `box`; `onChange` not called for a repeat. Browser: `TestTidyCardFollowsSelection`: for one box of each of the eleven kinds, clicking it sets `data-inspect="box"` and the visible named controls in the card are exactly that kind's set (compare against the `data-types` attributes, read from the DOM); the caret in the notes → `notes` and only the marks show; clicking the desk, clicking a slide in the strip and Esc in a box → `slide` and the Slide, Boxes and Deck groups show; a second browser session selecting a box leaves the first session's `data-inspect` unchanged. `TestTidyCardSurvivesBoxRemoval`: session B deletes the box session A has selected → A's card shows the slide's options within one second. `TestTidyEmptyDeck` (Review Focus 4). |
| +- [ ] **Step 2: Run** — fails. |
| +- [ ] **Step 3: Implement.** The server renders `data-inspect="slide"`. Which form shows is CSS on `data-inspect` alone: `box` → the block form; `notes` → the block form with every child but the marks group hidden; `slide` → the slide form then the deck form. `inspector.mjs` and `inspector-block.mjs` stop setting `hidden` on the three forms and keep setting it on controls. `selection.mjs`'s `onChange` feeds `inspect.selection`; a desk click and a strip click call `reset()`; Escape in the notes calls `reset()`. Extend `TestTidyPageNeverScrolls` with a canvas shape selected. |
| +- [ ] **Step 4: Run** the new tests and the existing editor browser tests (`-run 'Editor|Presence|Modal'`) — pass. |
| +- [ ] **Step 5: Rebuild the bundle; commit** (`Editor: the card shows the selection's options and no others`). |
| + |
| +### Task B8: The card's contents, regrouped |
| + |
| +**Files:** `templates/editor.html:357-381` (the marks leave the stage bar), `400-713` (regrouped); `static/editor.css:969-977,1464-1504`; `fixtures/head.mjs`, `commands.mjs:58-70`, `inspector.mjs`, `editor-entry.js:939`; `en.toml`, `editor.go`; `editor_tidy_test.go`, `browser_editor_tidy_test.go`. |
| + |
| +**Interfaces:** |
| +- Consumes: `data-inspect` (B7), `showInspector` (B6), `[estilo-inspector-group]`, `[estilo-seg]` (A1). |
| +- Produces: inside the block form, in this order, groups named by `data-group`: `style`, `text`, `alignment`, `image`, `description`, `place`, `phone`, then `[slides-block-delete]`; inside the slide form: `[slides-confirm]` first, then `slide`, `boxes`; the deck form under a rule with one group, `deck`. Each group is `<div estilo-inspector-group role="group" aria-labelledby="slides-g-<name>" data-group="<name>">` with `<span estilo-inspector-label id="slides-g-<name>">`. |
| + |
| +- [ ] **Step 1: Write the "nothing is lost" test from `main`, before touching the template.** `TestEditorTidyNothingIsLost` holds a table `{needle, section, group}` built from `origin/main`'s `editor.html`: every `name="rst-deck-*"`, `name="rst-slide-*"`, `name="rst-block-*"`, every `data-command` in the three forms, the five `data-mark` buttons, the eleven `data-add-block`, the `[slides-blocks-buttons]` template, `[slides-unused-assets]`, `[slides-phone-badge]`, `[slides-confirm]`. It asserts each needle appears inside the aside, inside the form for `section`, inside the group for `group` (per §4.2 and §4.3; `rst-block-radius` under `image`, `rst-block-cite` under `style`, `block-move-up` and `block-move-down` under `place`). It asserts five commands are **absent** from the aside and present elsewhere: `slide-move-up`, `slide-move-down`, `slide-add-after`, `duplicate-slide`, `slide-delete-ask` of which the Slide menu in `[slides-menubar]` still holds `duplicate-slide`, `slide-move-up`, `slide-move-down`, `slide-delete-ask` and `new-slide` (adding), and the strip item template still holds `data-slide-command` `add-after`, `duplicate`, `move-up`, `move-down`, `delete`. It asserts `[slides-stage-bar]` contains `slides-switcher` and no `data-mark`. Commit this test alone first, failing only on grouping. |
| +- [ ] **Step 2: Failing browser tests.** `TestTidyMarksInCard`: with text selected in a box and in the notes, each of the five marks in the card toggles the mark, shows it pressed, is disabled where the pill was (a code block), and the shortcuts in `Keys` (`editor.go:283-287`: Mod+B, Mod+I, Mod+E, Mod+Shift+H, Mod+K) still work; clicking a mark does not move the caret out of the text. `TestTidyKeyboardOnlyBox`: on a canvas slide with one shape, using the keyboard alone, with the card showing and again starting with it hidden (View → Inspector): reach the Boxes list, choose the shape, change its fill, press Esc (the card returns to the slide's options and focus is on that box's list button), choose it again, Delete block. `TestTidyDeleteSlideConfirmsInCard`: with the card hidden, Slide → Delete slide and a strip menu's Delete each show the card on the slide's options with focus on the confirmation; Cancel hides nothing, deletes nothing and returns focus to the invoking control; Delete deletes. |
| +- [ ] **Step 3: Run** — fails. |
| +- [ ] **Step 4: Implement.** Move the fields into the groups; no `name`, `data-prop`, `data-types`, `data-layout` or command changes. `[slides-format]` becomes the `text` group's body (a `[estilo-seg]` of five `button[estilo-seg-item][data-mark]`, still `role="toolbar"`), so `mountFormatBar`'s one-bar lookup still finds it; `shouldLetGo` treats the whole card as the bar. Segmented controls replace radio rows where the choices are short (slide layout, alignment, image fit); selects stay selects. `x`, `y`, `w`, `h` sit two by two. The five slide commands leave the slide form; the Insert menu's `[slides-inspector] [data-add-block]` lookup still resolves. Escape inside the card with `data-inspect="box"` clears the selection and focuses `[data-select-block="<id>"]`; choosing from the list focuses the first control of the box's options. |
| +- [ ] **Step 5: Run** steps 1 and 2, `TestEditorInspectorMarkupIsFormsWithLabels` (still three forms, at least 30 labelled named controls, eleven `data-add-block`), and the whole browser suite once — pass. |
| +- [ ] **Step 6: Rebuild the bundle; commit** (`Editor: the card's fields regrouped; marks in the card; slide actions out`). |
| + |
| +### Task B9: The bar's buttons, and the deck cover centred |
| + |
| +**Files:** `templates/editor.html:90-272`, `static/editor.css:152-395`; for the cover, wherever the fault is: `static/decks.css:140-156`, `templates/decks.html:40`, or `internal/slides/layout/layout.go:227,329-331` and `regions.go:109` against `static/slides.css:222-226`; tests in the tidy files and, if the engine is at fault, `internal/slides/layout`. |
| + |
| +**Interfaces:** |
| +- Consumes: estilo's controls set at head (`chrome.css:495-550`): `[estilo-bar-control]`, `~="primary"`. |
| + |
| +- [ ] **Step 1: Failing tests.** `TestEditorTidyBarControls`: in `[slides-head-end]`, in order: save status, `[slides-history]` (undo and redo in one pill), Format, Share, Present, switcher, account; Format and Share carry `estilo-bar-control`, Present carries `estilo-bar-control="primary"`. Browser, `TestTidyCoverIsCentred`: for a deck whose first slide is a `title` slide with a heading only, fetch the tile's `….svg?w=480`, inline it, and assert the union of its text elements' `getBBox()` is centred in the frame within 2% on both axes; and the tile's `img` rect is centred in `[slides-cover]` within 1px. |
| +- [ ] **Step 2: Run** — record which of the two cover assertions fails. Use superpowers:systematic-debugging; do not guess between the candidates. |
| +- [ ] **Step 3: Implement.** Bar: swap Slides' own pill rules for estilo's controls set; delete the CSS that becomes dead. Cover: fix the layer the failing assertion names. If it is the layout engine, add a `layout` test for the `title` template with no body region first, then fix `place()`, and regenerate only the golden files that case touches (list them in the commit body; the PDF and thumbnails change for those slides, which is the bug being fixed and not a rendering change this slice forbids). |
| +- [ ] **Step 4: Run** both tests, `go test ./internal/slides/layout/`, `-run 'Thumb|Export|Decks'` — pass. |
| +- [ ] **Step 5: Commit** (`Editor: estilo's pills in the bar; a deck's cover is centred`). |
| + |
| +### Task B10: Strings, dead code, the full gate, the handoff |
| + |
| +**Files:** `en.toml`, `editor.go:183`, `static/editor.css`, `AGENTS.md` (only where it names the inspector, the pill or the notes switch), `go.mod`. |
| + |
| +- [ ] **Step 1: Failing tests.** `TestEditorTidyStrings`: every key in the approved strings table is in `en.toml` and `editorStrings`; no key in `editorStrings` is unread by `editor.html`; the removed keys are gone. `TestEditorTidyNoDeadSelectors`: `editor.css` and `fixtures/*.mjs` contain none of `data-inspector-off`, `slides-notes-toggle`, `slides-head-tool`, `details[slides-inspector]`. |
| +- [ ] **Step 2: Run** — fails; fix; run — passes. |
| +- [ ] **Step 3: Full verification, once.** `./.amadan/ci.d/10-gate`; `go test -tags browser ./internal/slidestest/`; `cd fixtures && node --test *.test.mjs`. Paste the three summaries into the report as they are, failures included. |
| +- [ ] **Step 4: The side-by-side screenshot** (§7): the open card in Slides (a heading selected) and in Docs, at 1280×720, light and dark, into `$TMPDIR`, for the discussion. |
| +- [ ] **Step 5: Review.** An Astra review of the whole branch against the spec's anti-goals (§0.3) and this plan's Review Focus; fix what it finds or record why not. |
| +- [ ] **Step 6: Commit; report "ready to push" for both branches and stop.** On Paul's word: push estilo, open its discussion, squash-merge on green; `go get amadan.net/oficina/estilo.git@<merged commit>`, `go run ./scripts/writeestilo`, re-run step 3, commit; then push Slides and open its discussion with the screenshot, the list of visible changes from B1, and §11's open questions. Clean up: scratch files, any server, both worktrees once merged. |
| + |
| +--- |
| + |
| +## Self-review |
| + |
| +- **Spec coverage.** §2 page, strip, New slide → B2; bar → B6, B9; view switch → B3. §3 → B1 (ground), B9 (cover). §4 card, §4.4 → B6; §4.1 → B7; §4.2, §4.3, E10 → B8. §5 → B5. §6.1 → B4; §6.2 → B8 (the field moves, unchanged). §7 → A1, B10 step 4. §8's twelve tests → B2 (scroll, New slide), B8 (nothing lost, marks, keyboard, delete), B7 (selection), B5 (notes), B3 (switch), B4 (phone), B9 (cover), A1 (numbers). |
| +- **Calls this plan makes that the spec left open** (§10): the card is 248px, as Docs'; notes default to 144px; the phone is 390×844 with a 28px radius, scaled to fit; the page stops scrolling from 1100px and the stacked column below that scrolls as today; the notes card sits in the flow of the stage pane; one extra string, Resize notes. |
| +- **Risk to watch.** B1 moves estilo across every change between `260f98c` and head, and B9 may change golden files if the cover fault is in the layout engine. Both are named in their tasks and reported in the discussion. |