oficina / docs Public

Clone
git clone https://amadan.net/oficina/docs

Plain git — no account needed to clone.

Download

Download this file

Docs editor, layout I2: stacked header, floating inspector, share popover

Status: revision 2, 2026-11-11, after Claude Fable 5.1's review (oficina/docs #105: CHANGES REQUIRED). The section "Revision 2: decisions from the review" at the end overrides anything above it that it contradicts. Branch: design/richer-ui (Docs) plus a new estilo branch, bar-stack. Mock-up: design/editor-looks, local only (../docs-editor-looks, brand/looks.js and looks.css). It is the reference for every measurement here and is never merged. It moves the chrome with script at load. The build must render it server-side.

Why

Paul asked on 2026-11-07 for Docs to feel "rich, inviting, assertive", and "less Docs clone, definitely not Word clone". He then worked through five layouts and four riffs on one of them in the live mock-up, and chose I2. Every ruling quoted below is his, from that session.

What I2 is

Header: one 56px block

  • Icon: 32px, 12px from the inline start. The app name is dropped beside it.
  • Title and menus: stacked to the right of the icon. - The title row is 24px: 16px type, weight 600, letter-spacing -0.01em. - The menu row is 20px: 13px type, muted. - Both start on one edge at 56px (12px padding, 32px icon, 12px gap).
  • Optical balance, measured at 2x in WebKit: - The title's capitals start at the icon's top (11px). The title row sits 2.5px below its box. - The menu row sits low in the header (1px offset). Its 24px highlight pill stops 3px above the header's bottom edge. - An open menu's panel starts 1px above that edge, hanging from it. - Rulings: "the top of the menu should hug the bottom of the header", then "a smidge", then "1px up and 1px down".
  • Menu bar: - estilo's 32px minimum height is dropped. - Menu titles get cursor: pointer. - The highlight is a 24px pill, 6px radius, made by 2px negative block margins so it takes no room. - Panels have 28px rows, 13px type, muted shortcut keys, 4px padding and a 10px radius.
  • Title field: - As wide as its title, never full width ("It should grow according to the title, not start out full-width"). - Sized from the field's own scrollWidth at zero width, plus its end padding and border. field-sizing: content, a canvas and a mirror span all came up short in WebKit. - Re-measured on input, on resize, after load and on document.fonts.ready.
  • Rename: shown only while the title is being edited. It is a 22px accent-soft pill inside the title row, not estilo's 2rem button.

Header controls: one set

  • Sizing: all 28px tall, pill-shaped, 13px type at weight 600, 8px apart.
  • Order: undo/redo, Format, Share, then a divider, then the avatar.
  • Undo/redo: one grey pill holding two 24px icon buttons, with a hairline between them. - It is lit from the top: a gradient, a 1px inner highlight and a contact shadow. - A hovered button lifts within it. - These are the editor's own undo/redo buttons, so they need the toolbar's command binding (below).
  • Format: a quiet pill that toggles the inspector. - It is accent-soft with accent text while the inspector is open. - It has aria-pressed and a pencil icon.
  • Share: the one filled pill, the page's main action. - It has a 1px top highlight and an accent-tinted shadow (0 5px 12px -5px), the index's New document at header scale.
  • Avatar: a 28px circle and nothing else ("It should just highlight the circle"). - Hover darkens the circle. While its menu is open it gets a 2px ring.
  • Divider before the avatar: - A 1px line, 20px tall, with 12px either side. - Only when actions precede it: there is none on the index ("We don't need the divider if there are no other header buttons").
  • Depth: everything follows the index's treatment ("should they get something of the 3D / highlight treatment").

Inspector, replacing the formatting bar on wide screens

  • Panel: - 248px wide, floating 12px below the header and 12px from the inline end. - 12px radius, glass background (backdrop blur), 12px padding. - Its sections sit 14px apart. Section labels are 11px, weight 650, muted.
  • Sections: - Style: the paragraph style picker full width, then font and size on one row (size column 64px). - Text: bold, italic and code. - Alignment: left, centre and right. - Lists: bulleted, numbered and quote. - Text, Alignment and Lists are joined segmented rows of 28px buttons. Undo/redo moved to the header ("History buttons probably should stay in the main header").
  • Light: - It is a rastrillo card, lit by light.js: a rim and wash near the pointer. - The glow is drawn from a reshaped --rst-card-lit, max(0, lit × 1.43 − 0.43), so it disappears about 0.5s after the pointer leaves, not about 2s ("taking slightly too long"). - The rim is accent 70% mixed into the line colour (30% in dark). The wash is accent 9% (4% in dark).
  • Back-lit hover: a hovered control brightens to the surface with an accent halo: - 0 0 0 1px accent 22%, 0 0 12px 1px accent 26%, lower in dark. - It sits above its segment neighbours. - Ruling: "need a sort of back-light hover state to compensate for the background glow".
  • Format toggle: - The open/closed state persists in a cookie and is rendered server-side. - First paint is already right. No flash, the same rule docs-view follows.
  • The sheet stays centred unless the inspector needs the room: - padding-inline-end: max(16px, 16px + 816px + 2R − 100vw), where R is the inspector width plus 12px margin plus a 16px gap. Measured at 1800px, 1440px and 1280px. - Ruling: "the inspector shouldn't push the sheet to the left unless there's not enough space". - With the inspector closed, the sheet is plainly centred.
  • Below 64rem: no inspector. The existing toolbar strip and its phone rules stand, with undo/redo back in the strip, because the header controls collapse there.

Share as a popover

  • Opening: Share… opens a popover anchored under its button (top: header bottom + 6px; right: the button's end), 420px wide. - No-JS fallback: the share page as it is now.
  • Contents, composed server-side as a fragment of the share page (a new GET variant, for example /d/{sqid}/share?panel=1, rendering only the panel): - Head: "Share “title”" and a close button. - Invite row: one rounded field holding the email input ("Add people by email"), a compact Can read / Can edit select and an Invite button. - People with access: the owner first ("(you)", Owner), then each grant with an initial avatar, its access, and an × to remove it. - General access: two rows with an icon, a one-line state and a rastrillo rst-switch. The switches are real checkboxes: click, drag (rastrillo.js) or Space. - Your team: private or team. - Anyone with the link: published or not. When just published it shows the one-time URL, a Copy link button and "Copy it now: the link is shown only this once". Later it offers "Make a new link". - Errors: a negative callout under the head. Only the page's own error; the link's once-only warning lives with the link.
  • Actions: every one posts to the existing endpoints with fetch, and the panel is redrawn from the fragment the 303 lands on.
  • Dismissal: - The popover is manual, with its own dismissal: a pointerdown outside it closes it, except on Share. - Share while open does nothing ("should do nothing. It's causing a flash"). - Esc closes it and returns focus to Share.
  • Phones: below 36rem it is a full-width sheet from the top, with focus kept inside it.
  • Owners only, as the share page is.

Appearance: three-way selector, switched in place

  • In estilo's account menu: Light, Dark and System as three equal segments in one well, an icon (sun, moon, display) over each word. The current one is raised (surface, or #2f333d in dark), with an accent icon.
  • Switching: - The page switches at once (data-theme, as chrome.ThemeAttr writes it) and saves the choice by POSTing /appearance in the background. - No busy spinner, no reload ("They're not doing an action ... they should just switch immediately"). - Without script, the form posts and redirects as now.

Dark mode

Every glow is far fainter in dark ("a lot more subtle"). Landed on the branch: 489163a. The inspector, halo and Share values above follow it.

Where each piece lives

The shared pieces go to estilo once, so every app gets them; that is Paul's stated direction.

estilo, branch bar-stack:

  1. chrome.Bar gains a stacked variant: a template slot under the title for the app's menu bar. - Docs passes its menubar markup, rendered by estilo-menubar from Docs' menuView as now. - When the slot is filled, the bar draws the 56px stacked header above; otherwise the one-row bar is unchanged. - The 52px public --estilo-bar-block-size becomes 56px in the stacked variant, and is published as such.
  2. Bar actions accept an app-rendered leading slot (the undo/redo pill). Docs fills it with its data-docs-command buttons, which the editor's toolbar plugin must bind (below).
  3. The controls-set styling, the avatar circle highlight and the conditional divider.
  4. Menu bar title pointer cursor, the highlight pill, and the tighter menu panel inside the stacked bar.
  5. The title field's sizing script (in chrome.js) and the compact Rename.
  6. Appearance as the segmented selector, switched in place (chrome.js), with the form marked data-busy="false".
  7. Upstream note, not this branch: rastrillo's scheme-menu could take the same selector.

Docs, on design/richer-ui:

  1. Pin the estilo bar-stack branch. Pass the menubar into the bar's slot and the undo/redo buttons into the actions slot.
  2. Toolbar binding: fixtures/toolbar.mjs binds buttons found under [docs-toolbar] at mount. - It must also bind the header's undo/redo, by data-docs-command under the bar's slot, and keep them in sync. - The roving tab stop covers only the inspector or strip, not the header pair.
  3. Inspector markup in show.html: an <aside> holding the toolbar's groups as labelled sections, each section a role="group" with an accessible name. - The groups stay inside one role="toolbar" so the existing plugin, roving focus and tests bind unchanged. - The strip toolbar and the inspector are the same element, laid out by width: a column in the aside at 64rem and above, the strip below.
  4. Format toggle: a cookie (docs-inspector), server-rendered state, and the pressed button state.
  5. The share panel fragment route and template, the popover script (a new bundle or brand script; no inline script, under the CSP), and the share page unchanged for no-JS.
  6. The sheet centring rule and the inspector's light and back-lit hover (brand/light.css, show.html).
  7. Serve rastrillo's current ui.ShimJS() in place of estilo's older busy.ShimJS(). It is busy-less too and adds the switch drag the share switches need. - Check first that nothing in Docs depends on the old shim's behaviour. - Better: estilo re-vendors the shim from Fiesta 1.3.0's rastrillo, and Docs keeps taking it from estilo.

Constraints that already bind, and how I2 meets them

  • No layout shift on load. The inspector and the strip are server-rendered at their final size. The Format state is server-rendered. The title width is set before first paint where possible (initial width from the server's measurement is not possible, so the field starts at max-content via CSS and the script corrects by a few pixels at most). - TestFontTheFirstRevealIsTheFinalLayout and the CLS checks must stay green.
  • Never FOUT (Paul, 2026-10-24). The header and inspector use the system UI face. The style list's previews use the chrome face, already landed.
  • SC 1.4.10 at 320px. Below 64rem nothing changes from today. The popover becomes a sheet.
  • Touch targets. Header controls are 28px and segmented buttons 28px: above 24px.
  • Keyboard and accessibility: - The popover gives focus to the email field on open, Esc returns focus, and Tab stays inside it on phones. - Switches are checkboxes with names. - Appearance buttons keep aria-pressed. - The Format toggle has aria-pressed and aria-controls on the aside.
  • Busy rule: POST actions keep the 650ms hold. Appearance and Format are view switches with no request held. Share's fetches carry no busy spinner unless slow, which is the GET rule's shape (landing in Fiesta 1.3.0).

Tests

  • Go: the stacked bar renders the slot and keeps the one-row bar when empty (estilo); the share fragment route is owner-only and 404s for others, as the page does; the Format cookie is rendered (Docs).
  • Browser (Chromium and WebKit): - header measurements: the edges at 56px and the 28px controls; - the inspector at 64rem and above versus the strip below; - sheet centring at three widths; - popover: open, invite, both switches, remove, Share-while-open does nothing, Esc; - Appearance switches in place with no navigation; - undo/redo from the header stay current (130eeeb); - the existing toolbar, font and zoom suites.

Out of scope

  • Sheets, Slides and other apps: they take the estilo pieces when they re-pin. Their own passes follow.
  • The share email notification: offered, not yet asked for.

Revision 2: decisions from the review (#105)

These override the sections above.

P1.1: the one-time link reaches the person who sees it

  • Redirect: a share POST sent from the popover carries panel=1 (a hidden field). When it is present, the handler's 303 goes to /d/{sqid}/share?panel=1, not to the full page. - So the render that calls oneShots.take is the fragment the popover shows.
  • Rendering: the fragment goes through renderShare, so it keeps the Cache-Control: no-store rule whenever it carries the URL. It uses a fragment template in place of the page.
  • Direct navigation: a request for ?panel=1 with Sec-Fetch-Dest: document, or with no Sec-Fetch-* at all, gets the full page. - So a typed or reloaded URL is never a bare fragment, and a fetch never gets a page.
  • Test: after a publish from the popover, the URL appears in exactly one response body: the fragment. A following GET of the page or the fragment does not show it.

P1.2: one undo/redo pair, outside the toolbar

  • Placement: undo and redo leave [docs-toolbar] at every width. The strip loses its History group. There is one pair, in the bar's lead slot, visible at every width the editor is. - The lead slot does not collapse into estilo's Menu sheet (see P1.3).
  • Binding: fixtures/toolbar.mjs binds the pair separately by data-docs-command under the bar's lead slot. They are bound and kept in sync like the rest, but are not in setupRoving's controls: they are two ordinary tab stops. - fixtures/browser-drive.mjs and every test that clicks the strip's undo move to the header pair.
  • Inspector keyboard: the inspector's role="toolbar" stays the one roving toolbar, with aria-orientation="horizontal". Left and Right move as today. - The vertical layout is visual only: its order is the reading order, so Left/Right still walk it. - Up/Down are not claimed.

P1.3: breakpoints aligned with estilo's

| Width | Lead slot (undo/redo) | Actions (Format, Share) | Formatting | |---|---|---|---| | 1024px and wider | visible | shown | inspector; Format toggles it | | 800–1023px | visible | Share only; Format is not rendered visible (no inspector to toggle) | today's strip under the header | | Below 800px | visible, before Menu | Share is a row in estilo's Menu sheet (estilo's existing rule) | today's strip |

  • Share below 800px: the popover script listens on every Share link in the bar, the sheet's row included. Below 36rem it opens as a full-width sheet.
  • Format: the toggle is an estilo action. Docs gives it data-wide-only, and estilo hides wide-only actions below 1024px in the bar and omits them from the sheet.

P2 decisions

  • estilo slot API, as data: - Bar.Menubar template.HTML is rendered under the title and makes the bar [estilo-bar~="stacked"]. - Bar.Lead template.HTML is rendered before the actions, at every width. - Both are rendered by Docs from views/ partials, so TestOurTemplatesUseTheAttributeGrammar and the markup tests still see them. - In the stacked variant the bar's height is published as --estilo-bar-block-size (56px) through :root:has([estilo-bar~="stacked"]). - No template redefinition.
  • Title width: - The server renders the input with a size attribute derived from the title's length, as a first approximation that cannot shift layout by more than a few pixels. Script corrects it. - It is capped at the space between the brand and the bar's end. - A title longer than the cap scrolls inside the field, as today.
  • Font wait: the header pair and Format join setInert's set (editor-entry.js:521), and fonts_browser_test.go's inert checks extend to them.
  • Busy rule in the popover: the popover's script cancels each submit and does its own feedback. A request taking more than 500ms puts a spinner on the pressed control, mirroring the GET rule. - It does not depend on Fiesta's busy.js.
  • Shim: estilo re-vendors rastrillo's current ui.ShimJS() (busy-less, with the switch drag) into busy/rastrillo.js with provenance, in the bar-stack branch or its own. Docs keeps taking it from estilo, and TestBusyRuleIsLinkedAndServed follows.
  • Format toggle: - The cookie docs-inspector defaults to open. - Without script, the button is rendered disabled and the inspector stays open, since a disabled control cannot claim to toggle. - It uses aria-expanded and aria-controls, not aria-pressed: it shows and hides a region.

P3 notes for implementation

  • Popover: - Position with logical insets, so RTL mirrors it. - Use CSS anchor positioning where supported, with the script's placement as the fallback. - On phones, use a modal <dialog> rather than a hand-made focus trap. - Honour defaultPrevented after chrome.js's capture-phase Esc.
  • Print: the inspector and popover are hidden.
  • Inspector light and back-lit hover: under (hover: hover), and with no transition under reduced motion.
  • Sheet centring: use the container's width (a container query unit or 100% of the canvas), not 100vw, which counts a classic scrollbar (show.html's own warning).
  • Coarse pointers: header controls and segments rise to 32px.
  • Appearance: if the background POST fails, the page stays switched for the visit and the selector says nothing. The next load shows the saved choice. Acceptable for a view preference; noted, not solved.
  • Native wrappers (native/) are unaffected: they render the same pages.

Reference values, not requirements

The sub-pixel optical offsets, shadow strings, the glow-fade curve, glow percentages, icon drawings and the title-measuring technique above are the mock-up's values. They are references to match by screenshot comparison against design/editor-looks, not mechanisms to copy.

Revision 2.1: from the re-review (#105, APPROVED WITH CHANGES)

  • C1, Format's home: estilo's Action gains two things. WideOnly hides the action below 64rem in the bar and omits it from the Menu sheet. A Toggle kind renders a <button aria-expanded aria-controls> that is disabled until script binds it. - Format is a WideOnly toggle. Sheets will want the same. - estilo states its breakpoints in rem (64rem), not px.
  • C2, the closed inspector: at 64rem and above with the inspector closed, every toolbar control is hidden but is still in the roving set. - toolbar-roving.mjs's reachable() filters on checkVisibility(), not only disabled, and re-runs on resize. - focusStop() returns false when nothing is visible, so Escape in the editor (editor-entry.js:824) stays put.
  • C3: docs-inspector=closed hides only the inspector at 64rem and above. Below that the strip shows regardless. There is a test at 1000px.
  • C4, Share from the Menu sheet: opening the popover closes <details estilo-bar-more>. Esc returns focus to the Menu trigger, not to the row inside the closed sheet.
  • C5, the busy shape of popover actions: awaiting Paul's ruling. - Either way, the script refuses a second in-flight submit and holds a switch at its new position until its request settles. If the request fails, the switch reverts with the error.
  • C6, decided by measurement (2026-11-11, WebKit, phone rules applied): the stacked header does not fit a phone, with or without the pair. - File–Help needs 261px. Beside the icon, the title, Menu and the avatar, 125px is left at 390px and 55px at 320px, and the title falls to "U…". - Below 800px: today's layout stands. The one-row bar (no Bar.Menubar stacking), the menu row in [docs-chrome], and the strip with undo/redo in it. - From 800px: the stacked header and the header pair. The pair lives in the strip's markup at every width, and CSS shows exactly one of the two homes: the strip's group below 800px, Bar.Lead from 800px. Both stay out of roving. - Bar.Menubar's stacking is therefore wide-only too: estilo draws the one-row bar below 800px, and the app keeps its own menu row there. - The 320px scrollWidth check covers the bar.
  • Test notes: - Go tests of the fragment set Sec-Fetch-Dest: empty. - sharePost's empty-address 400 path (share.go:273-282) also renders the fragment when panel=1 is in the body. - TestToolbarOptionValuesMatchTheBundle widens to the lead and inspector partials. - TestTheOwnerGetsAShareControlInTheBar is rewritten for the new actions order. - The size claim is that nothing after the title moves. - The shim is re-vendored from the rastrillo version Docs pins (v0.29.1-0.20261027164201-054787952dd2), so the drag script and the switch CSS come from one tree.

Revision 2.2: from the estilo bar-stack review (oficina/estilo #34, APPROVED WITH CHANGES)

  • One menu bar below 800px: the menubar is one piece of markup, Bar.Menubar, at every width. estilo draws it under the title from 800px and as the header's second row below 800px. Docs drops its own menu row in [docs-chrome]. This replaces C6's "the app keeps its own menu row there"; Claude Fable judged the change sound and better.
  • The bar's height below 800px is not a constant: it is 85px, or more when the menus wrap, and chrome.js publishes the real height. Docs reads --estilo-bar-block-size and never a number.
  • Format's state lives in the docs-inspector cookie: open by default, closed only for an exact closed, rendered server-side onto the inspector and into the toggle's aria-expanded.