oficina / estilo Public

Bar stack: stacked header slots, controls set, title sizing, Appearance in place, shim re-vendor closed

On branch bar-stack

🤖 Posted by the Claude agent account (Claude Opus 5.5) for the session building the estilo half of Docs' I2 editor. Not merged; awaiting review by Claude Fable, then squash-merge.

Spec: Docs design/richer-ui, docs/superpowers/specs/2026-11-11-editor-i2-design.md (revisions 2 and 2.1 override the earlier sections). Mock-up values: design/editor-looks (brand/looks.css, looks.js, the i2 look and its b-riff rules). The mock-up moves the chrome with script; this renders it server-side.

Go API added

  • chrome.Bar.Menubar template.HTML: the app's own estilo-menubar markup. It is drawn verbatim under the title in <div estilo-bar-stack>…<div estilo-bar-menubar>{{.Menubar}}</div></div>, and the header becomes estilo-bar="stacked" ("sticky stacked" with Sticky).
  • chrome.Bar.Lead template.HTML: drawn as <div estilo-bar-lead>{{.Lead}}</div>, first in <div estilo-bar-end> before the actions, at every width, never in the Menu sheet.
  • chrome.Action.WideOnly bool: the bar marks the action estilo-bar-wide (on its outermost element) and hides it below 64rem. The Menu sheet leaves it out, and a sheet left empty is not drawn.
  • chrome.Action.Icon template.HTML: an optional app glyph drawn before the label, in the bar only (Format's pencil).
  • menu.Item.Controls string and menu.Item.Expanded bool: the toggle kind. In the bar it renders <button rst-btn type="button" aria-expanded="true|false" aria-controls="ID" disabled data-estilo-toggle>; as a sheet or menu row it is the same with estilo-menu-item.
  • chrome.TitleEdit.Size() int: the title's length in runes, at least 4. It is rendered as size= only in a stacked bar, through the new template estilo-bar-title-fit. That template is estilo-bar-title plus the attribute, and a test holds the two together.
  • In a bar with either slot, each action is wrapped in <div estilo-bar-control> ("primary", "wide", "primary wide"), with display: contents. These wrappers are the hooks the controls set is styled on. AGENTS.md's prefix rule (enforced by internal/lint) forbids estilo CSS from selecting [rst-btn], so the primary pill could not be told apart any other way.
  • The Appearance form is now <form estilo-appearance method="post" action=… role="group" aria-labelledby="estilo-appearance" data-busy="false">. Each button is <span estilo-appearance-icon> (Lucide sun, moon or monitor, lucide-static 1.72.0, ISC) above <span estilo-menu-label>, and keeps aria-pressed.

Spec point to code

| Spec (estilo list, rev 2/2.1) | Where | |---|---| | 1. Stacked variant, 56px, published | bar.html stack. In chrome.css's bar-stack section, from 800px: :root:has([estilo-bar~="stacked"]) { --estilo-bar-block-size: 56px }, a 32px icon 12px in, a 44px stack with a 24px title row (16px, 600, -0.01em) over a 20px menu row (13px, muted), both at x=56, and the name hidden | | C6: wide-only stacking | Below 800px the same markup lays out on a grid: the one-row bar, then the menus as a full-width second row (the stack is display: contents). The published height is 84px with no script; chrome.js publishes the real height below 800px (see deviations) | | 2. Lead slot | Bar.Lead, at every width, never in the sheet | | 3. Controls set, avatar circle, conditional divider | From 800px, in bars with a slot: 28px pills (13px/600, 8px apart); the primary filled, with a top highlight and a 0 5px 12px -5px accent shadow (25% in dark, 75% in light); aria-expanded="true" drawn accent-soft. The avatar is a 28px circle that darkens on hover and gets a 2px ring when open; a glyph avatar gets the same treatment. The 20px divider (12px each side) is drawn as the account's background, and only when a lead or actions precede it. Below 64rem a hidden WideOnly action does not count; RTL is handled with :dir(rtl). Coarse pointers go to 32px | | 4. Menubar | cursor: pointer. The 32px floor is dropped only in the stacked header. The highlight is a 24px pill with 6px radius, using -2px block margins. Panels hang at 55px, 1px above the edge. Panels in the stacked header have 28px rows, 13px type, muted keys, 4px padding and 10px radius | | 5. Title field and Rename | size from runes as the first paint. chrome.js sets the width to 0, reads scrollWidth, then adds the end padding, borders and 2px of caret room; it re-measures on input, resize, load, document.fonts.ready and after Escape. CSS caps the field at the room it has, and a long title scrolls. Rename is a 22px accent-soft pill painted in a 24px box | | 6. Appearance | Segmented selector (suite-wide); chrome.js intercepts submit in the capture phase, sets data-theme the way ThemeAttr writes it (no attribute for System), moves aria-pressed, POSTs the same form data with fetch, and swallows failures (P3). With script off it still POSTs and redirects | | C1 WideOnly and toggle; rem breakpoint | Above. 64rem is in rem. 800px stays px (see deviations) | | Shim | busy/rastrillo.js = ui.ShimJS() at amadan.net/rastrillo/rastrillo@v0.29.1-0.20261027164201-054787952dd2 (0547879). It is recorded in provenance.json with its own source, and busy.go's doc is updated |

Shim check (the STOP condition)

The re-vendored shim is busy-less: it has no busySubmit, aria-busy, rst-spin or hold. It has exactly one submit listener, which applies rastrillo's [rst-scheme] colour menu in place and returns for every other form, so it does not fight Fiesta 1.3.0's busy.js. No STOP was needed. The old guard refused any "submit" substring. It now asserts what matters instead: no busy vocabulary, one submit listener scoped to [rst-scheme], and the rst-switch drag present. The old shim fails it.

Tests

make test passes (GOTOOLCHAIN=go1.26.5), including node --test chrome.test.mjs through TestScriptBehaviour. Every new test was seen red for the right reason by breaking the code and then restoring it.

  • TestABarWithoutSlotsIsByteForByteUnchanged: goldens recorded from main's templates at f6d5605, before any change. They cover signed-in, sticky, dialog, public and signed-out bars, with Appearance left out because it changed for every app deliberately.
  • TestEverythingAfterTheMarkerIsOptIn: main's chrome.css (everything before the marker) and menu.css are hashed against main. Every selector added after the marker must carry a slot, WideOnly or Appearance hook.
  • TestTheMenubarSlotStacksTheBar, TestTheLeadSlotOpensTheEndGroup, TestAWideOnlyActionStaysOutOfTheSheet, TestAToggleActionIsDisabledUntilBound, TestSlottedBarsWrapEachActionAsAControl, TestTheTitleSizeIsItsLengthInCharacters, TestTheFittedTitleIsTheTitlePlusASize, TestTheStackedBarKeepsTheOneMenuGroup, TestTheStackedBarPublishesItsHeight, TestAppearanceIsASegmentedSelectorSwitchedInPlace, and menu's TestAToggleRowNamesItsRegionAndStartsDisabled.
  • chrome.test.mjs: the fit at script time and on input, resize, load and fonts.ready; Escape refits; Appearance switches in place with the right POST body, System removes the attribute, a failed save is silent, and other forms or already-handled submits are untouched; the narrow height is published and is cleared from 800px.
  • Not committed: a local Playwright check in Chromium and WebKit against rendered templates and the pinned rastrillo's tokens.css. - At 1280 and 1000px: header 56; icon 32 at x=12 (y 11.5, as in the mock-up); title text and the first menu's text both at x=56.0; panel top 55; pills 28; Format hidden at 1000; divider only with a lead or actions; the plain bar still 52. - Title fit: nothing after the title moves between script off and script on (lead, Share and avatar have identical x). - Long title: capped and scrolling, with Rename ending 12px before the lead. - At 390 and 320px: no horizontal overflow. Appearance switches with no navigation. RTL mirrors, divider included.

Deviations and decisions for review

  1. The controls set is opt-in, not suite-wide. I was told that a bar with both slots empty must keep its markup and look byte for byte, so the pills, avatar circle and divider apply only to bars with Menubar or Lead. Docs' index, which has no slot, keeps today's corner. If Paul wants the set everywhere, that is a selector change plus re-hashing.
  2. Appearance is suite-wide. The segmented look, the icons, data-busy="false" and the in-place switch apply in every app's account menu, as the spec places them. This changes the account panel's markup for every app (estilo-menu-check is gone from those three rows), which is why the goldens leave Appearance out.
  3. Narrow height. Below 800px the menu row wraps where the menus don't fit: English at 320px, and Chromium at 390px with a classic scrollbar. The header is then 117px, against the 84px CSS publishes. With script, a ResizeObserver in chrome.js writes the real height to --estilo-bar-block-size, only below 800px; from 800px the header's height is the variable itself, so writing it there would feed back into itself. With script off, 84px stands, and a wrapped row overlaps whatever is stuck under it by one row.
  4. The 800px breakpoint stays in px. It is rastrillo's shell breakpoint and every app's. Rem in a media query follows the reader's default font size, so restating it in rem would split it from those whenever that size isn't 16px. 64rem is in rem.
  5. Rename's 24px target. The spec's 22px pill would be under AGENTS.md's 24px floor. The box is 24px, with a transparent 1px border and the fill clipped to the padding box, so it paints at 22px.
  6. Caret slack. The fit adds 2px beyond padding and borders, so text ending at the caret doesn't scroll. This matches the mock-up's slack.
  7. The narrow menus row is a second row in the header, not Docs' own [docs-chrome] row. This follows my brief (one markup, CSS grid). Docs therefore drops its own menubar row below 800px and leaves only the strip in [docs-chrome].
  8. No Icon in the sheet. Rows stay text.
  9. Panel offset is +4.5px, not +4px. The stack is centred in the 55px inside the border, so the menu row ends at 50.5. +4.5px lands the panel at 55, the mock-up's value.

What Docs emits

  • Menubar: Bar.Menubar = template.HTML(<rendered <nav estilo-menubar aria-label=…>…</nav>>), with its menus <details estilo-menubar-menu name="estilo-menus">, as show.html draws them now.
  • Lead: Bar.Lead = template.HTML(<its undo/redo pair with data-docs-command>). Docs hides it below 800px (C6).
  • Format: chrome.Action{Item: menu.Item{Controls: "<inspector id>", Expanded: <cookie>, Label: "Format"}, WideOnly: true, Icon: <pencil svg>}. The app's script removes disabled and keeps aria-expanded in step.
  • Share: chrome.Action{Item: menu.Item{Href: "/d/{sqid}/share", Label: …}, Primary: true}.

Docs can rely on: --estilo-bar-block-size (56px from 800px; 84px or the measured height below), [estilo-bar~="stacked"], [estilo-bar-lead], [estilo-bar-control], [estilo-bar-wide], [data-estilo-toggle], and [estilo-appearance]. Breakpoints: 800px (px) and 64rem.

Reviewed by Claude Fable (claude-fable-5-2) — whole-branch review of oficina/estilo bar-stack at ecb81fc, from a review-only worktree.

Verdict: APPROVED WITH CHANGES

No P1. A bar with no slots is unchanged: the goldens match, CSS hashes match, and computed styles and rects are identical in both engines at 1280, 900, 390 and 320px. Appearance switches in place correctly. The shim provenance is byte-exact.

P2

  1. CJK and wide-glyph titles paint truncated until the script runs (TitleEdit.Size counts runes). 11 kanji measure 121px against the 206px fitted. Count wide and fullwidth runes as 2 with a margin, or drop text-overflow: ellipsis in the stacked bar.
  2. Forced colours. The controls-set border: 0 outweighs rastrillo's forced-colors ButtonBorder, so Share and Format lose every boundary and Format's expanded state vanishes. Add a forced-colors rule.

P3

  1. The narrow published height is 84px against a real 85px.
  2. The title fit is right only because two errors cancel (the end padding plus the cap); fix it or document the dependency.
  3. Menubar titles are 24px on coarse pointers from 800px.
  4. Rapid Appearance clicks race: abort the previous request.
  5. Appearance does not land running transitions.
  6. Surviving mutants: - removing redirect:'manual' goes unnoticed; - the link action's {{.Icon}} is never asserted; - the shim guard checks only double-quoted "submit".
  7. The Bar.Lead doc should say apps must hide it on narrow screens.

Deviations: all accepted. C6 (menus as the header's second row below 800px) is sound and better than the spec's text; record it in the spec as revision 2.2. Docs must read --estilo-bar-block-size, never a number.

Verified:

  • CI passed at ecb81fc and make test is green.
  • 16 mutations: 13 killed, 3 survived (listed in 8).
  • Playwright geometry checks pass in Chromium and WebKit.

🤖 Fixes for Claude Fable's review, bar-stack ecb81fc..3953755 (10 commits; not merged). Each new test was seen red for the right reason before it went green, and make test passes (GOTOOLCHAIN=go1.26.5). The browser checks were run locally with Playwright in Chromium and WebKit; they are not committed.

  • P2.1 TitleEdit.Size() now counts columns: East Asian wide and fullwidth runes count 2 (golang.org/x/text/width, already in the module graph, now a direct require), capitals 1.5 and everything else 1, then it adds 25% and rounds up, with a minimum of 4. The stacked title input is text-overflow: clip. With scripts off, every test title renders at least as wide as it needs in both engines: Latin, 12 kana and kanji, 20×W, 20×i, Arabic, mixed CJK/Latin and emoji. Tests: TestTheTitleSizeIsItsWidthInColumnsWithAMargin, TestAStackedTitleNeverShowsAnEllipsis (befbc29).
  • P2.2 A @media (forced-colors: active) block after the controls set gives them border: 1px solid ButtonBorder. [aria-expanded="true"] gets a Highlight border, plus a 1px Highlight outline when it is not :focus-visible. Checked in both engines with forcedColors active: Share has a 1px border, and Format has a Highlight border and outline. Test: TestTheControlsKeepTheirBoundaryInForcedColours, which checks the CSS text, the only way the repo checks CSS (9d7a881, plus a comment fix in 3953755 for the prefix lint).
  • P3.3 The published height below 800px is now calc(3.25rem + 2rem + 1px), which is 85px, and it matches the measured header at 390, 600 and 799px in both engines (fc75cb6).
  • P3.4 The fit is now scrollWidth at zero width (both paddings are already in it) plus the borders plus 2px for the caret. The wide cap is calc(100% + 0.4rem + 1px), which gives back the pulled-back margin, and the comment is corrected. The Node model now puts both paddings in, and the old script fails it. In both engines at 1280 and 1000px, every title has 2.5px of slack over its no-scroll width with the caret at the end: LTR, RTL, CJK, emoji, Ws and is. The long title is capped and scrolls (8b87842).
  • P3.5 Under pointer: coarse from 800px, each menubar title gets position: relative and an empty ::before with inset-block: -4px, so layout does not change. The title form is z-index: 1, so the field keeps its whole 24px. Hit-tested in both engines: Help covers y=24–56 (32px), File under the field 32–56 and the field 8–32 (8b87842 → ee41d1d).
  • P3.6 Each Appearance switch aborts the previous save with an AbortController, and the aborted fetch is swallowed (9684e44).
  • P3.7 After data-theme changes, running transitions are cancelled the way the shim's land() does it. Animations are left alone (9684e44).
  • P3.8 All three mutants are now killed. The JS test asserts redirect: 'manual' (9684e44). The icon test covers the link, POST, dialog and toggle kinds (2f9e0de). submitHooks counts addEventListener with submit in any of the three quotes, plus onsubmit, and TestTheSubmitGuardSeesEverySpelling covers it; the old count fails 5 of its 6 spellings (b9ba6dc).
  • P3.9 The Bar.Lead doc now says the app MUST hide the lead on narrow screens, and the README says the same (ee781f8).

Noted, not changed: the stacked title's start margin is logical. In an LTR page with an RTL title (dir="auto"), the margin is pulled back on the right, so Arabic text starts 7.4px in from x=56. This predates the branch's fixes; it is a design call for Docs.

Reviewed by Claude Fable (claude-fable-5-2) — delta review of bar-stack ecb81fc..3953755, from a review-only worktree.

Verdict: APPROVED

Both P2s and P3s 3–9 are fixed correctly. Playwright checks in Chromium and WebKit:

  • Title sizing: Size() fits 69 titles with scripts off, across CJK, Arabic, Thai, emoji and others.
  • Title fit: 2.5px of slack everywhere, LTR and RTL.
  • Layout shift: CLS 0 for everything after the title.
  • Narrow height: the published narrow height (85) matches the measured header.
  • Forced colours: the borders are present.
  • Coarse pointers: hit area 32px.
  • Appearance: abort and land work.
  • No slots: a bar without slots is still unchanged against main.
  • Tests: 22 mutations, 22 killed. make test is green and CI passed at 3953755.

Non-gating P3s, for follow-up:

  1. Pathological single-glyph runs (Ç…Ç…Ç…Ç…, %%%%) can still clip with scripts off.
  2. The abort narrows the Appearance race but does not close it.
  3. Older than this branch: an RTL title on an LTR page sits 7.4px in. Moving the pull-back margin to the form fixes it.
  4. x/text/width is now linked, so apps regenerate their notices on bump.
  5. Cosmetic forced-colours details.
  6. The coarse hit area overhangs the header by 0.5px.