oficina / docs Public

Docs: a richer index and editor — documents as paper on a desk, a floating toolbar

The index shows each document as its own first page (the exporter's
page-one line boxes, at shelf size), with the recency groups side by
side on one shelf under a single-hue Docs glow. Search is one field
with its submit inside; New document creates straight away (the
handler already titles a blank one).

The editor sits on a blue-grey desk that follows the reader's scheme
(registered --docs-desk, so page gaps inside the light-scheme paper
match), with layered paper shadows, and on wide screens the
formatting bar floats as one rounded dock with quiet selects. Below
64rem the strip and its wrapping and phone rules are unchanged.

TestNoZoomOnTap waits on the search field now that the title field
is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 72c8d9be51f3964a8bee2c1a5baea908fd7d70a6 parent 3f5b4b6
5 files changed, +498 −275
  • internal/docs/handlers.go +22 −24
  • internal/docs/render.go +4 −5
  • internal/docs/views/list.html +316 −220
  • internal/docs/views/show.html +154 −24
  • internal/docs/zoom_browser_test.go +2 −2

CI passed — run details

diff --git a/internal/docs/handlers.go b/internal/docs/handlers.go
index dae406a..4770247 100644
--- a/internal/docs/handlers.go
+++ b/internal/docs/handlers.go
@@ -117,7 +117,7 @@ type handlers struct {
// a row's Title and When are the document's own data, not authored
// copy, so list.html prints them directly rather than through T.
//
-// CreateLabel and CreatePlaceholder back the create form list.html
+// CreateLabel backs the create button list.html
// renders in its page header — present regardless of Groups, so it
// reaches a person with no documents yet exactly as it reaches
// everyone else (fix round 1: the original version of this screen
@@ -142,13 +142,12 @@ type listPage struct {
// as the editor a reader could type into. (Re-review, finding 3.)
CanCreate bool
- Title string
- Groups []docGroup
- EmptyTitle string
- EmptyBody string
- CreateLabel string
- CreatePlaceholder string
- SignOutLabel string
+ Title string
+ Groups []docGroup
+ EmptyTitle string
+ EmptyBody string
+ CreateLabel string
+ SignOutLabel string
// Query is what was searched for, echoed back into the field so a
// result page is a page a person can edit and re-submit rather
@@ -288,22 +287,21 @@ func (h *handlers) list(w http.ResponseWriter, r *http.Request) {
h.acceptPartial(r)
data := listPage{
- HomeLinkLabel: h.homeLinkLabel(r),
- CanCreate: h.member(r),
- Title: rastrillo.T(r, "docs.list.title"),
- EmptyTitle: rastrillo.T(r, "docs.list.empty.title"),
- EmptyBody: rastrillo.T(r, "docs.list.empty.body"),
- CreateLabel: rastrillo.T(r, "docs.list.create.label"),
- CreatePlaceholder: rastrillo.T(r, "docs.list.create.placeholder"),
- SignOutLabel: rastrillo.T(r, "docs.signout.label"),
- Query: query,
- SearchLabel: rastrillo.T(r, "docs.list.search.label"),
- SearchPlace: rastrillo.T(r, "docs.list.search.placeholder"),
- NoResultsHead: rastrillo.T(r, "docs.list.search.none.title"),
- NoResultsBody: rastrillo.T(r, "docs.list.search.none.body"),
- ClearLabel: rastrillo.T(r, "docs.list.search.clear"),
- JumpTo: newJumpToView(r),
- JumpToScript: jumpToScriptPath(),
+ HomeLinkLabel: h.homeLinkLabel(r),
+ CanCreate: h.member(r),
+ Title: rastrillo.T(r, "docs.list.title"),
+ EmptyTitle: rastrillo.T(r, "docs.list.empty.title"),
+ EmptyBody: rastrillo.T(r, "docs.list.empty.body"),
+ CreateLabel: rastrillo.T(r, "docs.list.create.label"),
+ SignOutLabel: rastrillo.T(r, "docs.signout.label"),
+ Query: query,
+ SearchLabel: rastrillo.T(r, "docs.list.search.label"),
+ SearchPlace: rastrillo.T(r, "docs.list.search.placeholder"),
+ NoResultsHead: rastrillo.T(r, "docs.list.search.none.title"),
+ NoResultsBody: rastrillo.T(r, "docs.list.search.none.body"),
+ ClearLabel: rastrillo.T(r, "docs.list.search.clear"),
+ JumpTo: newJumpToView(r),
+ JumpToScript: jumpToScriptPath(),
}
// The list is the app's root: its tab says just "Docs". A result page
// names what was searched for (spec §10).
diff --git a/internal/docs/render.go b/internal/docs/render.go
index 6613a0d..dbe473c 100644
--- a/internal/docs/render.go
+++ b/internal/docs/render.go
@@ -156,10 +156,9 @@ var Catalog = rastrillo.Catalog{
// header, present whether or not Groups is empty (fix round 1:
// the plan had scoped a create *control* out of every task, so the
// screen this plan exists for could not be driven from a browser
- // at all). label is both the submit button's text and the title
- // field's accessible name; placeholder is that field's hint text.
- "docs.list.create.label": "New document",
- "docs.list.create.placeholder": "Title",
+ // at all). label is the button's text: it creates an "Untitled
+ // document" (docs.document.untitled), titled in the document itself.
+ "docs.list.create.label": "New document",
// docs.list.search.* — finding a document by its title (spec
// §15.2). The field is a GET form, so a search is a link and works
@@ -174,7 +173,7 @@ var Catalog = rastrillo.Catalog{
// "nothing found FOR THIS" are different amounts of help when you
// have mistyped.
"docs.list.search.label": "Search documents",
- "docs.list.search.placeholder": "Search",
+ "docs.list.search.placeholder": "Search by title",
"docs.list.search.none.title": "No documents match",
"docs.list.search.none.body": "Nothing here has that in its title. Check the spelling, or try a shorter word.",
"docs.list.search.clear": "Clear search",
diff --git a/internal/docs/views/list.html b/internal/docs/views/list.html
index 243478c..f1ce5bf 100644
--- a/internal/docs/views/list.html
+++ b/internal/docs/views/list.html
@@ -9,6 +9,12 @@
renders unconditionally, so the control reaches a person with no
documents yet exactly the same way it reaches everyone else,
rather than only appearing once there is something to list.
+ It is one button and no title field: the handler already names a
+ blank title "Untitled document", and the title is editable in the
+ document's own bar, which is where a person is when they know
+ what the document is called. Asking first put two text fields
+ side by side in the header, and the second read as a second
+ search box.
[docs-header-actions] wraps the search form and that create form
as one group: [rst-page-header]'s flex/space-between rule wants at
@@ -54,231 +60,325 @@
which is what an empty document, and a document whose structure
could not be read, both get. */}}
{{define "thumb"}}<span docs-thumb aria-hidden="true">{{if .Bars}}<svg viewBox="0 0 {{.W}} {{.H}}" preserveAspectRatio="xMidYMin slice">{{range .Bars}}<rect x="{{.X}}" y="{{.Y}}" width="{{.W}}" height="{{.H}}"/>{{end}}</svg>{{end}}</span>{{end}}
+{{/* tile — one document on the shelf. */}}
+{{define "tile"}}<li docs-tile>
+ <span docs-tile-title><a href="{{.Href}}">{{.Title}}</a></span>
+ {{template "thumb" .Thumb}}
+ <span docs-tile-meta><span docs-row-when>{{.When}}</span>{{if .SharedNote}}<span docs-row-shared>{{.SharedNote}}</span>{{end}}</span>
+ </li>{{end}}
{{define "content"}}<style>
- /* [docs-thumb] holds a real rendering of the document's page one:
- the <svg> inside it is the line boxes the PDF exporter's own
- layout placed, through export.PageOne (see preview.go). It was
- reserved and deliberately empty until that existed — "reserved
- space, not a placeholder image" — and the box is unchanged now
- that it is filled, which is what that reservation was for.
- 26×34 is literal: the brief's own figure, and within a percent
- of a US-Letter page's aspect at row scale, so the page inside it
- is not distorted to fit. */
- [docs-thumb] {
- display: block;
- flex: none;
- inline-size: 26px;
- block-size: 34px;
- border: 1px solid var(--rst-line-strong);
- border-radius: var(--rst-radius-sm);
- background: var(--rst-surface);
- overflow: hidden;
+ /* The desk. The list is the person's documents laid out as the paper
+ they are, so the page under them is a desk rather than a form: the
+ suite's background, lit from above by a wash of Docs' own hue (the
+ icon's glow, estilo theme/apps.go hue 262, at the aurora's
+ lightness). One hue only, as the app icons have; the suite's full
+ aurora stays on Home. It is painted on the body so it can reach
+ the bar and the edges without anything here overflowing. */
+ body:has([docs-list]) {
+ background:
+ radial-gradient(ellipse 70rem 28rem at 50% -6rem,
+ light-dark(oklch(0.86 0.06 262 / 0.55), oklch(0.42 0.08 262 / 0.35)),
+ transparent 70%)
+ no-repeat,
+ var(--rst-bg);
}
- [docs-thumb] > svg {
- display: block;
- inline-size: 100%;
- block-size: 100%;
+ [docs-list] {
+ padding-block: var(--rst-sp-4) var(--rst-sp-6);
}
- /* The fill is a token rather than a presentation attribute on each
- rect: var() in an SVG presentation attribute has a patchy support
- history, and a token here follows the theme the way every other
- colour on this page does. Nothing about the thumbnail carries
- meaning by colour alone — a heading reads as a heading because
- its bar is taller, which is the real ratio between the two type
- sizes. */
- [docs-thumb] rect {
- fill: var(--rst-text-muted);
+ /* The header: the screen's name, large and set tight, with search
+ and create on the same line. It wraps under the title on a phone,
+ search first, at full width. */
+ [docs-list-head] {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: space-between;
+ gap: var(--rst-sp-3) var(--rst-sp-5);
+ margin-block-end: var(--rst-sp-5);
}
- [docs-group-label] {
+ [docs-list-head] h1 {
margin: 0;
- padding: var(--rst-sp-3) var(--rst-sp-3) var(--rst-sp-1);
- font-size: var(--rst-fs-xs);
+ font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
font-weight: 700;
- letter-spacing: 0.04em;
- text-transform: uppercase;
- color: var(--rst-text-muted);
- }
- [docs-row-when] {
- flex: none;
- color: var(--rst-text-muted);
- font-size: var(--rst-fs-sm);
+ letter-spacing: -0.025em;
+ line-height: 1.1;
}
- /* No row-click rule here on purpose, and it is worth saying why,
- because the measurement that argues for one is misleading.
- A row's title link measures 268×16 — well under the 24×24 WCAG
- 2.2 AA target minimum, with the thumbnail and the whole right
- half of the row apparently dead. That reading is wrong, and
- getBoundingClientRect is what makes it wrong: it reports an
- element's own box and cannot see an absolutely positioned
- pseudo-element. rastrillo already stretches this link over the
- whole row. tokens.css gives [rst-row] position: relative, gives
- [rst-row]:hover the --rst-surface-2 tint, and gives
- [rst-row-main] > a::after content:"" with inset: 0, under its own
- comment: "The name link's overlay makes the whole row clickable
- without nesting one anchor inside another."
- Our markup already matches that selector, so the row is fully
- clickable, fully hover-tinted and past 24×24 with nothing of ours
- involved. An earlier version of this file added [docs-row] and
- [docs-row-link]::after restating those exact declarations, and a
- hit test then "confirmed" a fix that had changed nothing — the
- probe was hitting rastrillo's overlay both before and after.
- If you are about to add one: hit-test the row before you change
- anything, not only after. */
- /* [docs-header-actions]: the header's one flex child opposite the
- titles — [rst-page-header]'s space-between rule places it there
- with no layout rule of its own beyond this; everything it holds
- (the search form and the create form — sign-out moved into the
- shell's account control, see the note at the top of this file)
- lays out as one inline group inside it. */
+ /* [docs-header-actions]: search and create as one group. They stay
+ two separate <form>s, never one, because they are unrelated
+ actions with different methods and targets (GET / vs POST
+ /documents) and must never be merged into one submit. */
[docs-header-actions] {
display: flex;
- flex-wrap: wrap;
+ flex: 1 1 22rem;
+ justify-content: flex-end;
align-items: center;
gap: var(--rst-sp-3);
+ min-inline-size: 0;
}
- /* [docs-create-form]: the title field and its submit button as one
- inline row — nowrap, deliberately, and this is the part that took
- two attempts.
- A wrapping flex line does not shrink its items to fit; it breaks
- first and shrinks only what still does not fit afterwards. So
- with wrap on, the button dropped to a second line and the field —
- now alone on the first one, with room to grow — sprang back to
- its 14rem maximum, which is how a fix aimed at making the header
- shorter measured exactly as tall as before it (175px, unchanged).
- nowrap is what forces the field to give up width to its button
- instead of the button giving up the line.
- The button itself is flex: none so the whole shortfall comes out
- of the field. Shared proportionally, both would shrink, and
- "New document" would start wrapping or clipping inside a control
- that had no reason to be narrower.
- One thing to watch when the other eleven catalogs land: nowrap
- plus a non-shrinking button means a locale whose
- docs.list.create.label is wider than about 270px overflows the
- 320px column rather than wrapping out of it. English is 131px and
- is the only catalog today, so this is a note rather than a bug —
- but it is a real edge, and the fix when it arrives is a
- wrap allowance keyed to the label, not a smaller field. */
- [docs-create-form] {
+ /* Search is one field with its submit inside it, at the start, as the
+ magnifier. The button keeps "Search documents" as its name, so a
+ pointer, a screen reader and Enter from the field all reach the
+ same submit. The field takes whatever the row leaves it, down to
+ nothing: min-inline-size: 0 lifts a flex item's automatic minimum,
+ which for an <input> is its content and would otherwise push the
+ page sideways at 320px (SC 1.4.10, which this app supports with
+ no exemption; the old two-control form failed it once). */
+ [docs-search-form] {
+ position: relative;
display: flex;
- flex-wrap: nowrap;
- gap: var(--rst-sp-2);
+ flex: 0 1 20rem;
+ min-inline-size: 0;
}
- [docs-create-form] button {
+ [docs-search-form] [rst-input] {
+ flex: 1 1 auto;
+ min-inline-size: 0;
+ min-block-size: 40px;
+ padding-inline-start: 40px;
+ border-color: transparent;
+ border-radius: var(--rst-radius-pill);
+ background: light-dark(rgb(255 255 255 / 0.8), rgb(255 255 255 / 0.06));
+ box-shadow: inset 0 0 0 1px var(--rst-line), 0 1px 2px light-dark(rgb(20 30 60 / 0.06), transparent);
+ }
+ [docs-search-form] [rst-input]:hover {
+ box-shadow: inset 0 0 0 1px var(--rst-line-strong);
+ }
+ [docs-search-submit] {
+ position: absolute;
+ inset-block: 0;
+ inset-inline-start: 2px;
+ display: grid;
+ place-items: center;
+ inline-size: 38px;
+ padding: 0;
+ border: 0;
+ border-radius: var(--rst-radius-pill);
+ background: transparent;
+ color: var(--rst-text-muted);
+ cursor: pointer;
+ }
+ [docs-search-submit]:hover {
+ color: var(--rst-accent);
+ }
+ [docs-search-submit] svg,
+ [docs-create-form] svg {
+ inline-size: 18px;
+ block-size: 18px;
+ fill: none;
+ stroke: currentColor;
+ stroke-width: 2;
+ stroke-linecap: round;
+ }
+ [docs-create-form] {
flex: none;
}
- /* The title field shares its line with the submit button instead of
- holding a fixed 14rem and pushing it onto a line of its own.
- Measured at 320px — the reflow width spec §10.3 commits to —
- before this changed: a fixed 14rem (224px) field could not sit
- beside a 131px button in a 288px content column, so the field,
- "New document" and "Sign out" each took a full row and the header
- stood 175px tall, putting the first document 223px down a 720px
- viewport. Just under a third of the screen spent on chrome before
- a single thing a person came here to read.
- flex-basis 10rem with room to shrink is what lets the field and
- its button share one line in that column; the 14rem cap keeps the
- desktop header exactly as it was, since the form still sizes to
- its max-content there. min-inline-size: 0 is load-bearing — a
- flex item's automatic minimum size is its content, so without it
- an <input> refuses to shrink below its default size and the row
- overflows rather than fitting. */
- [docs-create-form] [rst-input] {
- flex: 1 1 10rem;
- min-inline-size: 0;
- max-inline-size: 14rem;
- }
- /* [docs-search-form] is the same inline row as the create form, with
- one difference: it does NOT wrap. The header carries several
- controls, and with wrapping allowed the search button dropped onto
- a line of its own under its own field while the create form stayed
- whole — which reads as two rows of unrelated chrome rather than as
- one field and its button.
-
- Staying on one row is only safe because the FIELD shrinks, and
- that is the part this rule got wrong for a while. It previously
- carried a comment asserting that the group wrapping at
- [docs-header-actions] meant "a 320px viewport puts each form on
- its own line intact rather than breaking one of them in half".
- That was never measured and was wrong. The field held a fixed
- 11rem, its button holds a label that does not wrap, and
- max-inline-size: 100% resolves against a form whose own width is
- its content — so the form set a min-content floor of about 334px
- and simply stood wider than the 288px column. Measured on
- origin/main at 7507a33 with scripts/browser-drive.sh: the list
- page scrolled sideways at 320px, scrollWidth 356 against a 320
- viewport, with this form's button the innermost offender at
- x=356.
-
- That is a WCAG 2.2 SC 1.4.10 failure, which AGENTS.md allows no
- exemption from, traded for a desktop layout nicety by a comment
- that sounded like it had been checked.
-
- Note what the floor did to its NEIGHBOUR. [docs-create-form] was
- measured over the edge too, at x=350, and it is correctly written
- — it shrinks exactly as it should. It overflowed because a
- wrapping flex container is at least as wide as its widest item's
- min-content, so this form's 334px floor widened every line in the
- group, including the one the create form had to itself. Fixing
- the field below fixes both; there was never a second bug. Worth
- knowing before someone "fixes" the create form as well.
-
- The fix is that the field takes what is left after the button
- rather than claiming a width: flex 1 1 with a small basis, and
- min-inline-size 0 to lift a flex item's automatic minimum, which
- is its content size and is what an <input> otherwise refuses to
- go below. The 11rem cap keeps the desktop header exactly as it
- was. */
- [docs-search-form] {
- display: flex;
- flex-wrap: nowrap;
+ /* A phone: the title and "New document" share the first line, and
+ search takes the whole second one, where its hint has room to be
+ read. display: contents lets the two forms join the header's own
+ row; they stay two separate forms. */
+ @media (max-width: 36rem) {
+ [docs-header-actions] {
+ display: contents;
+ }
+ [docs-list-head] h1 {
+ flex: 1 1 auto;
+ }
+ [docs-search-form] {
+ order: 3;
+ flex: 1 1 100%;
+ }
+ }
+ [docs-create-form] button {
+ display: inline-flex;
align-items: center;
gap: var(--rst-sp-2);
- max-inline-size: 100%;
+ min-block-size: 40px;
+ padding-inline: var(--rst-sp-4) var(--rst-sp-5);
+ border-radius: var(--rst-radius-pill);
+ white-space: nowrap;
+ box-shadow: 0 1px 0 rgb(255 255 255 / 0.18) inset, 0 6px 16px -6px color-mix(in oklab, var(--rst-accent) 70%, transparent);
}
- [docs-search-form] [rst-input] {
- flex: 1 1 6rem;
+ /* The shelf: every document as its own first page, side by side,
+ each page --docs-tile wide. The recency groups (spec §6.4) sit
+ side by side on the same shelf rather than each taking a band of
+ the screen, each with its heading over its own pages: "Today",
+ two pages, "Yesterday", one, and so on along the row, wrapping
+ like words. A group with more pages than fit on one line takes
+ the whole width and wraps inside itself. */
+ [docs-list] {
+ --docs-tile: 10.5rem;
+ --docs-tile-gap: var(--rst-sp-5);
+ }
+ [docs-groups] {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--rst-sp-6) calc(var(--docs-tile-gap) * 2);
+ }
+ [docs-group] {
+ flex: 0 1 auto;
min-inline-size: 0;
- max-inline-size: 11rem;
- }
- /* The submit button is for a pointer and for a screen reader; a
- keyboard user submits with Enter from the field, which a
- single-input form does natively. It stays visible rather than
- becoming an icon because "Search documents" is also the field's
- accessible name and the two agreeing is worth more than the
- width.
- flex: 0 0 auto for the same reason: the whole shortfall comes out
- of the field, so the button keeps its whole label. It is the
- words that are load-bearing here, not the box.
- The locale caveat, stated as the sequence it actually is rather
- than as a single threshold. Because the field gives way first and
- the button never shrinks, a wider label eats the FIELD long
- before anything overflows: a ~200px label leaves about 80px of
- field, ~270px leaves a sliver, and only past ~280px — the 288px
- column less the gap — does anything cross the edge. So the first
- failure a wide catalog produces is a search box too narrow to
- read what you typed, which is a usability problem and not a
- 1.4.10 one; the overflow comes later. English is 131px and is the
- only catalog today. The fix when it arrives is a wrap allowance
- keyed to the label, not a smaller field.
- ([docs-create-form]'s own comment above states the same caveat as
- a bare "wider than about 270px overflows", which is the second
- half of this sequence and not the part that bites first.) */
- [docs-search-form] button {
+ }
+ /* A group's heading is a quiet label over its pages: sentence case,
+ the muted ink, weight doing the work rather than capitals, with a
+ hairline running out to the group's edge so the pages under it
+ read as one run. */
+ [docs-group-label] {
+ display: flex;
+ align-items: center;
+ gap: var(--rst-sp-3);
+ margin: 0 0 var(--rst-sp-4);
+ font-size: var(--rst-fs-sm, 0.875rem);
+ font-weight: 600;
+ color: var(--rst-text-muted);
white-space: nowrap;
- flex: 0 0 auto;
+ }
+ [docs-group-label]::after {
+ content: "";
+ flex: 1 1 auto;
+ min-inline-size: var(--rst-sp-5);
+ border-block-start: 1px solid light-dark(rgb(23 32 60 / 0.12), rgb(255 255 255 / 0.12));
+ }
+ [docs-shelf] {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--rst-sp-6) var(--docs-tile-gap);
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ }
+ [docs-shelf] > [docs-tile] {
+ inline-size: var(--docs-tile);
+ }
+ /* Two pages to a row on a phone, edge to edge of the column. */
+ @media (max-width: 30rem) {
+ [docs-list] {
+ --docs-tile-gap: var(--rst-sp-4);
+ }
+ [docs-group] {
+ flex-basis: 100%;
+ }
+ [docs-shelf] > [docs-tile] {
+ inline-size: calc((100% - var(--docs-tile-gap)) / 2);
+ }
+ }
+ /* One document. The title link is stretched over the whole tile by
+ its ::after, the same overlay rastrillo's rows use, so the paper,
+ the title and the date are all one target without nesting
+ anything interactive inside the link. */
+ [docs-tile] {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ gap: var(--rst-sp-1);
+ min-inline-size: 0;
+ }
+ [docs-tile-title] {
+ order: 2;
+ margin-block-start: var(--rst-sp-3);
+ font-size: var(--rst-fs-sm, 0.875rem);
+ font-weight: 600;
+ line-height: 1.3;
+ overflow-wrap: anywhere;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ line-clamp: 2;
+ overflow: hidden;
+ }
+ [docs-tile-title] a {
+ color: var(--rst-text);
+ text-decoration: none;
+ }
+ [docs-tile-title] a::after {
+ content: "";
+ position: absolute;
+ inset: -6px;
+ border-radius: var(--rst-radius-sm);
+ }
+ [docs-tile-title] a:focus-visible {
+ outline: none;
+ }
+ [docs-tile-title] a:focus-visible::after {
+ outline: 2px solid var(--rst-accent);
+ outline-offset: 2px;
+ }
+ [docs-tile-meta] {
+ order: 3;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0 var(--rst-sp-2);
+ color: var(--rst-text-muted);
+ font-size: var(--rst-fs-xs, 0.75rem);
+ }
+ /* [docs-thumb] holds a real rendering of the document's page one:
+ the <svg> inside it is the line boxes the PDF exporter's own
+ layout placed, through export.PageOne (see preview.go). At shelf
+ size it reads as the page it is, margins and all, so the box is
+ the page's own aspect (612 by 792, the viewBox) and the paper is
+ the literal white a document always is (spec §10.2), in either
+ theme. An empty document is the same sheet with nothing on it. */
+ [docs-thumb] {
+ order: 1;
+ display: block;
+ inline-size: 100%;
+ aspect-ratio: 612 / 792;
+ border-radius: 3px;
+ background: #ffffff;
+ overflow: hidden;
+ box-shadow:
+ 0 0 0 1px light-dark(rgb(23 32 60 / 0.07), rgb(255 255 255 / 0.06)),
+ 0 1px 2px rgb(23 32 60 / 0.08),
+ 0 10px 24px -12px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7));
+ transition: transform 180ms cubic-bezier(.2, .7, .2, 1), box-shadow 180ms ease;
+ }
+ [docs-thumb] > svg {
+ display: block;
+ inline-size: 100%;
+ block-size: 100%;
+ }
+ /* The lines of text, in a soft ink. Nothing about the thumbnail
+ carries meaning by colour: a heading reads as a heading because
+ its bar is taller, which is the real ratio between the two type
+ sizes. */
+ [docs-thumb] rect {
+ fill: #b9c0cc;
+ }
+ /* Picking a page up: it lifts and takes the accent's edge. The
+ motion answers the pointer, and is dropped for reduced motion,
+ where the edge alone says the same thing. */
+ [docs-tile]:hover [docs-thumb],
+ [docs-tile]:has(a:focus-visible) [docs-thumb] {
+ transform: translateY(-4px);
+ box-shadow:
+ 0 0 0 1.5px var(--rst-accent),
+ 0 2px 4px rgb(23 32 60 / 0.08),
+ 0 18px 32px -14px light-dark(rgb(23 32 60 / 0.35), rgb(0 0 0 / 0.8));
+ }
+ [docs-tile]:hover [docs-tile-title] a {
+ color: var(--rst-accent);
+ }
+ @media (prefers-reduced-motion: reduce) {
+ [docs-thumb] {
+ transition: none;
+ }
+ [docs-tile]:hover [docs-thumb],
+ [docs-tile]:has(a:focus-visible) [docs-thumb] {
+ transform: none;
+ }
}
/* The way back out of a result page, under the results rather than
in the header: it is about the list being shown, not about the
controls that produced it. */
[docs-search-clear] {
- margin-block-start: var(--rst-sp-3);
+ margin-block-start: var(--rst-sp-6);
font-size: var(--rst-fs-sm);
}
+ [docs-list] [rst-empty] {
+ margin-block-start: var(--rst-sp-6);
+ }
</style>
-<header rst-page-header>
- <div rst-page-header-titles>
- <h1>{{.Title}}</h1>
- </div>
+<div docs-list>
+<header docs-list-head>
+ <h1>{{.Title}}</h1>
<div docs-header-actions>
{{/* Search (spec §15.2's title search). A GET form, so a search
is a link — bookmarkable, reloadable, and reachable with the
@@ -293,30 +393,27 @@
<form docs-search-form method="get" action="/" role="search">
<input rst-input docs-search-input type="search" name="q" value="{{.Query}}"
placeholder="{{.SearchPlace}}" aria-label="{{.SearchLabel}}" autocomplete="off">
- <button rst-btn="ghost" type="submit">{{.SearchLabel}}</button>
+ <button docs-search-submit type="submit" title="{{.SearchLabel}}" aria-label="{{.SearchLabel}}"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><circle cx="8.5" cy="8.5" r="5.5"/><path d="m13 13 4 4"/></svg></button>
</form>
{{if .CanCreate}} <form docs-create-form method="post" action="/documents">
- <input rst-input type="text" name="title" placeholder="{{.CreatePlaceholder}}" aria-label="{{.CreateLabel}}" autocomplete="off">
- <button rst-btn="primary" type="submit">{{.CreateLabel}}</button>
+ <button rst-btn="primary" type="submit"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M10 4v12M4 10h12"/></svg>{{.CreateLabel}}</button>
</form>{{end}}
</div>
</header>
{{if .PartialCatalog}}{{template "callout" (dict "Body" .PartialCatalog "Tone" "warning")}}{{end}}
-{{/* Searching renders a ranked, UNGROUPED result list. Recency
+{{/* Searching renders a ranked, UNGROUPED result shelf. Recency
grouping is what an unfiltered list is for; grouping ranked
- results under "Today" and "Earlier" would order the same rows
- twice by two different rules and show only the second. */}}
+ results under "Today" and "Earlier" would order the same pages
+ twice by two different rules and show only the second.
+
+ Each tile's link comes first in the markup and the paper is put
+ back above it by order: so a screen reader, and the tab order,
+ meet the title first, and the page's picture is decoration. */}}
{{if .Searching}}
{{if .Results}}
-<div rst-list>
- {{range .Results}}
- <div rst-row>
- {{template "thumb" .Thumb}}
- <span rst-row-main><a href="{{.Href}}">{{.Title}}</a></span>
- <span docs-row-when>{{.When}}</span>{{if .SharedNote}}<span rst-muted docs-row-shared>{{.SharedNote}}</span>{{end}}
- </div>
- {{end}}
-</div>
+<ul docs-shelf>
+ {{range .Results}}{{template "tile" .}}{{end}}
+</ul>
{{else}}
<div rst-empty>
<h2 rst-empty-title>{{.NoResultsHead}}</h2>
@@ -325,16 +422,14 @@
{{end}}
<p docs-search-clear><a href="/">{{.ClearLabel}}</a></p>
{{else if .Groups}}
-<div rst-list>
+<div docs-groups>
{{range .Groups}}
- <h2 docs-group-label>{{.Label}}</h2>
- {{range .Rows}}
- <div rst-row>
- {{template "thumb" .Thumb}}
- <span rst-row-main><a href="{{.Href}}">{{.Title}}</a></span>
- <span docs-row-when>{{.When}}</span>{{if .SharedNote}}<span rst-muted docs-row-shared>{{.SharedNote}}</span>{{end}}
- </div>
- {{end}}
+ <section docs-group>
+ <h2 docs-group-label>{{.Label}}</h2>
+ <ul docs-shelf>
+ {{range .Rows}}{{template "tile" .}}{{end}}
+ </ul>
+ </section>
{{end}}
</div>
{{else}}
@@ -343,5 +438,6 @@
<p rst-empty-body>{{.EmptyBody}}</p>
</div>
{{end}}
+</div>
{{template "docs-jumpto" .}}
{{end}}
diff --git a/internal/docs/views/show.html b/internal/docs/views/show.html
index 8593ae3..18e3869 100644
--- a/internal/docs/views/show.html
+++ b/internal/docs/views/show.html
@@ -94,14 +94,41 @@
550 as the page's subject and editable in place for a writer. It
used to be [docs-shell-title], a 12.5px regular span that could not
be renamed. */
- /* [docs-canvas] is the tray the page sits in — it is chrome around
- paper, so it stays close to the surrounding theme's tone, but it
- still opts out of the scheme (color-scheme: light) because its
- own background below is a literal, not a token: a scheme without
- a matching literal is what makes dark-mode form controls repaint
- themselves onto a light strip. */
+ /* The desk the paper sits on, and the ink of what is written on the
+ desk (page numbers) rather than on the paper. A cool grey taken
+ from Docs' own hue, so the page reads as lit paper on a surface
+ rather than a white box on a grey one; dark in dark mode, where
+ the paper stays paper.
+
+ Registered as <color> so light-dark() resolves where they are
+ declared, on :root, in the reader's scheme, and the resolved
+ colour is what inherits. [docs-page] is color-scheme: light (its
+ colours are literals, spec §10.2), and an unregistered property
+ would re-resolve inside it to the light desk: the gap between two
+ sheets would be a light strip on a dark desk. */
+ @property --docs-desk {
+ syntax: "<color>";
+ inherits: true;
+ initial-value: #e3e7ee;
+ }
+ @property --docs-desk-ink {
+ syntax: "<color>";
+ inherits: true;
+ initial-value: #586070;
+ }
+ :root {
+ --docs-desk: light-dark(#e3e7ee, #0e1015);
+ --docs-desk-ink: light-dark(#586070, #9aa1ad);
+ }
+ /* The whole screen is the desk: the strip beside the floating
+ toolbar is desk, not page background. */
+ body:has([docs-canvas]) {
+ background: var(--docs-desk);
+ }
+ /* [docs-canvas] is the tray the page sits in — chrome around paper,
+ so it takes the reader's scheme; the paper itself opts out (see
+ [docs-page]). */
[docs-canvas] {
- color-scheme: light;
display: flex;
justify-content: center;
/* Less air above the sheet than below it. The tray used to carry
@@ -113,7 +140,7 @@
the bar; --rst-sp-6 below is scroll run-out, which wants to stay
generous. */
padding: var(--rst-sp-5) var(--rst-sp-4) var(--rst-sp-6);
- background: #d8d8dc;
+ background: var(--docs-desk);
}
/* [docs-page]: white, centred, with margins — literal colours per
spec §10.2, not var(--rst-surface)/var(--rst-text): a document
@@ -130,9 +157,17 @@
min-block-size: 11in;
margin-block-end: var(--rst-sp-6);
padding: 1in;
+ color-scheme: light;
background: #ffffff;
color: #1a1a1a;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 12px rgba(0, 0, 0, 0.12);
+ border-radius: 2px;
+ /* Paper lying on the desk: a hairline edge, a contact shadow, and
+ a long soft one from a light above. */
+ box-shadow:
+ 0 0 0 1px rgb(23 32 60 / 0.06),
+ 0 1px 2px rgb(23 32 60 / 0.10),
+ 0 4px 8px -2px rgb(23 32 60 / 0.06),
+ 0 24px 48px -18px rgb(23 32 60 / 0.30);
}
/* Narrow screens stop simulating paper, because at phone widths the
simulation costs more than it says.
@@ -408,6 +443,7 @@
screen (spec §10.2) and both must simply stop existing here —
printing a grey background wastes a reader's ink to reproduce a
metaphor. */
+ body:has([docs-canvas]),
[docs-canvas] {
display: block;
padding: 0;
@@ -444,19 +480,19 @@
margin-block: 1em;
margin-inline: -1in;
padding-inline-end: 1in;
- background: #d8d8dc;
+ background: var(--docs-desk);
box-shadow:
- inset 0 1px 0 rgba(0, 0, 0, 0.16),
- inset 0 -1px 0 rgba(0, 0, 0, 0.16);
+ inset 0 1px 0 rgb(23 32 60 / 0.10),
+ inset 0 6px 10px -6px rgb(23 32 60 / 0.22),
+ inset 0 -1px 0 rgb(23 32 60 / 0.06);
user-select: none;
}
- /* The number of the page starting BELOW the gap. Quiet, and a literal
- colour for the same reason the gap's own is: it sits on the desk,
- not on the paper. */
+ /* The number of the page starting BELOW the gap. Quiet, and the
+ desk's ink rather than the paper's: it sits on the desk. */
/* Furniture, so the chrome's face rather than one of the document's:
a webfont here would be held or swapped like the text. */
[docs-page-number] {
- color: #5a5a60;
+ color: var(--docs-desk-ink);
font-family: var(--rst-font, system-ui), sans-serif;
font-size: 9pt;
}
@@ -905,14 +941,16 @@
display: inline-flex;
align-items: center;
justify-content: center;
- min-inline-size: 28px;
- min-block-size: 28px;
+ min-inline-size: 32px;
+ min-block-size: 32px;
padding: 0 4px;
border: 0;
- /* Square: a borderless toolbar button's hover and pressed backgrounds
- are in-flow highlights (the suite's square rule, spec §11 and Paul's
- §13 Q4 answer). The bordered selects beside them keep day's radius. */
- border-radius: 0;
+ /* Rounded, like the dock they sit in (below). The square
+ borderless buttons of the shared-chrome round (spec §13 Q4) sat
+ in a full-width strip; inside a rounded bar a square highlight
+ reads as a mistake. */
+ border-radius: var(--rst-radius-sm);
+ transition: background-color 120ms ease, color 120ms ease;
background: transparent;
color: var(--rst-text);
font: inherit;
@@ -920,7 +958,7 @@
cursor: pointer;
}
[docs-tool]:hover:not(:disabled) {
- background: var(--rst-accent-soft);
+ background: var(--rst-surface-2);
}
/* aria-pressed is the state, and colour is not allowed to be the only
thing that shows it (§10.3, and AGENTS.md's "no exemptions").
@@ -960,7 +998,7 @@
background: var(--rst-accent-soft);
color: var(--rst-accent);
font-weight: 700;
- box-shadow: inset 0 0 0 1px currentColor;
+ box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 45%, transparent);
}
[docs-tool]:disabled {
color: var(--rst-text-faint);
@@ -1137,6 +1175,98 @@
font-size: max(1rem, 1em);
}
}
+ /* The dock. On a screen wide enough to hold the whole toolbar on one
+ line, the formatting bar stops being a full-width strip and floats
+ over the desk as one rounded bar, centred over the paper; the menu
+ bar above it keeps the chrome's own surface. The page scrolls
+ under it.
+
+ No layout shift, which is what the toolbar rules above were
+ measured for: the dock is one row (nowrap) of fixed-width
+ controls, the three selects included, so it is the same width
+ before ui/select.js swaps them for comboboxes as after, and the
+ same height from the first paint. 64rem is where the whole dock
+ fits with room to spare; below it the strip and its wrapping and
+ phone rules stand as they were. */
+ @media screen and (min-width: 64rem) {
+ [docs-chrome] {
+ background: transparent;
+ border-block-end: 0;
+ }
+ [docs-chrome] > [estilo-menubar] {
+ background: var(--rst-surface);
+ border-block-end: 1px solid var(--rst-line);
+ }
+ [docs-bar] {
+ justify-content: center;
+ padding: var(--rst-sp-3) var(--rst-sp-4) 0;
+ pointer-events: none;
+ }
+ [docs-toolbar] {
+ flex: none;
+ flex-wrap: nowrap;
+ gap: var(--rst-sp-1);
+ padding: 4px 6px;
+ border-radius: 14px;
+ background: light-dark(rgb(255 255 255 / 0.86), rgb(32 35 43 / 0.86));
+ -webkit-backdrop-filter: saturate(1.4) blur(14px);
+ backdrop-filter: saturate(1.4) blur(14px);
+ box-shadow:
+ 0 0 0 1px light-dark(rgb(23 32 60 / 0.08), rgb(255 255 255 / 0.08)),
+ 0 1px 2px rgb(23 32 60 / 0.08),
+ 0 12px 28px -12px light-dark(rgb(23 32 60 / 0.30), rgb(0 0 0 / 0.7));
+ pointer-events: auto;
+ }
+ [docs-toolbar-group] + [docs-toolbar-group] {
+ margin-inline-start: var(--rst-sp-1);
+ padding-inline-start: var(--rst-sp-1);
+ }
+ [docs-toolbar] [rst-combo],
+ [docs-tool-select] {
+ flex: none;
+ inline-size: 8.5rem;
+ }
+ [docs-toolbar] [rst-combo]:has(#docs-select-size-combo),
+ #docs-select-size {
+ inline-size: 4rem;
+ }
+ /* The selects are quiet in the dock: no box until the pointer is
+ on one, a chevron saying it opens. The open or focused one keeps
+ its field. */
+ [docs-toolbar] [rst-combo] [rst-input],
+ [docs-tool-select] {
+ min-block-size: 32px;
+ padding-inline: var(--rst-sp-2) 22px;
+ border-color: transparent;
+ border-radius: var(--rst-radius-sm);
+ background: transparent;
+ font-weight: 500;
+ text-overflow: ellipsis;
+ }
+ [docs-toolbar] [rst-combo]:hover [rst-input]:not(:disabled),
+ [docs-tool-select]:hover:not(:disabled) {
+ background: var(--rst-surface-2);
+ }
+ [docs-toolbar] [rst-combo] [rst-input]:focus {
+ border-color: var(--rst-line-strong);
+ background: var(--rst-surface);
+ }
+ [docs-toolbar] [rst-combo]::after {
+ content: "";
+ position: absolute;
+ inset-inline-end: 8px;
+ inset-block-start: calc(50% - 5px);
+ inline-size: 10px;
+ block-size: 10px;
+ background: var(--rst-text-muted);
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
+ pointer-events: none;
+ }
+ [docs-canvas] {
+ padding-block-start: var(--rst-sp-5);
+ }
+ }
</style>
{{/* This page has no [rst-page-header]. It used to, and what it held
is not gone — every piece of it moved to where its equivalent
diff --git a/internal/docs/zoom_browser_test.go b/internal/docs/zoom_browser_test.go
index 2c0eb94..feabbb2 100644
--- a/internal/docs/zoom_browser_test.go
+++ b/internal/docs/zoom_browser_test.go
@@ -123,7 +123,7 @@ func TestNoZoomOnTap(t *testing.T) {
}
run("sign in", set...)
- measure("/", `input[name="title"]`)
+ measure("/", `input[name="q"]`)
// The toolbar's three selects, once select.js has enhanced them, and
// the title field in the bar.
measure("/d/"+sqid, `[contenteditable="true"]`,
@@ -138,7 +138,7 @@ func TestNoZoomOnTap(t *testing.T) {
once = true
measure("/d/"+sqid+"/share", `[docs-share-url-input]`)
once = false
- measure("/", `input[name="title"]`,
+ measure("/", `input[name="q"]`,
chromedp.Evaluate(`document.dispatchEvent(new KeyboardEvent('keydown', {key: 'k', ctrlKey: true, bubbles: true}))`, nil),
chromedp.WaitVisible(`[docs-jumpto-input]`, chromedp.ByQuery))
}