| index f1ce5bf..5a7cc3b 100644 |
| --- a/internal/docs/views/list.html |
| +++ b/internal/docs/views/list.html |
| @@ -60,12 +60,22 @@ |
| 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> |
| +{{/* tile — one of the newest documents, as its first page. The whole |
| + tile is one link, paper, title and date: an overlay stretched from |
| + the title missed the paper in Safari, where the line-clamped title |
| + box clipped it. The link's name is its text, title first. */}} |
| +{{define "tile"}}<li><a docs-tile href="{{.Href}}"> |
| + <span docs-tile-title>{{.Title}}</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}} |
| + </a></li>{{end}} |
| +{{/* row — every older document, and every search result: rastrillo's |
| + row, whose title link it stretches over the whole row itself. */}} |
| +{{define "row"}}<div rst-row> |
| + {{template "thumb" .Thumb}} |
| + <span rst-row-main><a href="{{.Href}}">{{.Title}}</a></span> |
| + {{if .SharedNote}}<span rst-muted docs-row-shared>{{.SharedNote}}</span>{{end}}<span docs-row-when>{{.When}}</span> |
| + </div>{{end}} |
| {{define "content"}}<style> |
| /* 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 |
| @@ -197,79 +207,50 @@ |
| 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); |
| } |
| - /* 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; |
| - } |
| - /* 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; |
| - } |
| - [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)); |
| - } |
| + /* The shelf: the newest documents as their own first pages, one |
| + row of them across the column (recentShelf, handlers.go). On a |
| + phone it is a row you swipe, two and a bit pages wide, so the |
| + list below it is still on the first screen. */ |
| [docs-shelf] { |
| - display: flex; |
| - flex-wrap: wrap; |
| - gap: var(--rst-sp-6) var(--docs-tile-gap); |
| - margin: 0; |
| + display: grid; |
| + grid-template-columns: repeat(5, minmax(0, 1fr)); |
| + gap: var(--rst-sp-5); |
| + margin: 0 0 var(--rst-sp-6); |
| 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); |
| + @media (max-width: 48rem) { |
| + [docs-shelf] { |
| + grid-template-columns: none; |
| + grid-auto-flow: column; |
| + grid-auto-columns: 40%; |
| + gap: var(--rst-sp-4); |
| + overflow-x: auto; |
| + overscroll-behavior-x: contain; |
| + scroll-snap-type: x mandatory; |
| + scrollbar-width: none; |
| + /* Room for the pages' shadows and their lift inside the |
| + scroller, which clips both. */ |
| + margin-inline: calc(var(--rst-sp-4) * -1); |
| + padding: var(--rst-sp-2) var(--rst-sp-4) var(--rst-sp-4); |
| + scroll-padding-inline: var(--rst-sp-4); |
| } |
| - [docs-group] { |
| - flex-basis: 100%; |
| - } |
| - [docs-shelf] > [docs-tile] { |
| - inline-size: calc((100% - var(--docs-tile-gap)) / 2); |
| + [docs-shelf] > li { |
| + scroll-snap-align: start; |
| } |
| } |
| - /* 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; |
| + color: var(--rst-text); |
| + text-decoration: none; |
| + border-radius: var(--rst-radius-sm); |
| + } |
| + [docs-tile]:focus-visible { |
| + outline: 2px solid var(--rst-accent); |
| + outline-offset: 6px; |
| } |
| [docs-tile-title] { |
| order: 2; |
| @@ -284,23 +265,6 @@ |
| 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; |
| @@ -311,24 +275,21 @@ |
| } |
| /* [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. */ |
| + layout placed, through export.PageOne (see preview.go), in the |
| + page's own coordinates (612 by 792, the viewBox), margins and |
| + all. 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%; |
| + flex: none; |
| aspect-ratio: 612 / 792; |
| - border-radius: 3px; |
| + border-radius: 2px; |
| 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; |
| + 0 0 0 1px light-dark(rgb(23 32 60 / 0.10), rgb(255 255 255 / 0.08)), |
| + 0 1px 2px rgb(23 32 60 / 0.08); |
| } |
| [docs-thumb] > svg { |
| display: block; |
| @@ -342,29 +303,71 @@ |
| [docs-thumb] rect { |
| fill: #b9c0cc; |
| } |
| + /* On the shelf the page is the tile: full width, lying on the desk. */ |
| + [docs-tile] [docs-thumb] { |
| + order: 1; |
| + inline-size: 100%; |
| + border-radius: 3px; |
| + 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; |
| + } |
| /* 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] { |
| + [docs-tile]: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 { |
| + [docs-tile]:hover [docs-tile-title] { |
| color: var(--rst-accent); |
| } |
| @media (prefers-reduced-motion: reduce) { |
| - [docs-thumb] { |
| + [docs-tile] [docs-thumb] { |
| transition: none; |
| } |
| [docs-tile]:hover [docs-thumb], |
| - [docs-tile]:has(a:focus-visible) [docs-thumb] { |
| + [docs-tile]:focus-visible [docs-thumb] { |
| transform: none; |
| } |
| } |
| + /* The rows: everything older than the shelf, grouped by recency |
| + (spec §6.4), and every search result. rastrillo's list and row, |
| + with a small sheet of the page at the start of each. rastrillo |
| + already stretches the title link over the whole row ([rst-row] |
| + position: relative, [rst-row-main] > a::after inset: 0) and tints |
| + it on hover; nothing of ours restates that. */ |
| + [docs-list] [rst-list] { |
| + border-radius: var(--rst-radius); |
| + box-shadow: 0 1px 2px light-dark(rgb(23 32 60 / 0.05), transparent); |
| + } |
| + [docs-list] [rst-row] { |
| + gap: var(--rst-sp-3); |
| + } |
| + [rst-row] [docs-thumb] { |
| + inline-size: 26px; |
| + } |
| + /* A group's heading inside the list: sentence case, the muted ink, |
| + weight doing the work rather than capitals. */ |
| + [docs-group-label] { |
| + margin: 0; |
| + padding: var(--rst-sp-4) var(--rst-sp-4) var(--rst-sp-2); |
| + font-size: var(--rst-fs-sm, 0.875rem); |
| + font-weight: 600; |
| + color: var(--rst-text-muted); |
| + } |
| + [docs-row-when] { |
| + flex: none; |
| + color: var(--rst-text-muted); |
| + font-size: var(--rst-fs-sm); |
| + font-variant-numeric: tabular-nums; |
| + } |
| /* 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. */ |
| @@ -401,19 +404,17 @@ |
| </div> |
| </header> |
| {{if .PartialCatalog}}{{template "callout" (dict "Body" .PartialCatalog "Tone" "warning")}}{{end}} |
| -{{/* Searching renders a ranked, UNGROUPED result shelf. Recency |
| +{{/* Searching renders a ranked, UNGROUPED list of rows. Recency |
| grouping is what an unfiltered list is for; grouping ranked |
| - 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. */}} |
| + results under "Today" and "Earlier" would order the same rows |
| + twice by two different rules and show only the second. And a |
| + result is found by its title, so the shelf of pages, which is |
| + about what was worked on last, has no place here. */}} |
| {{if .Searching}} |
| {{if .Results}} |
| -<ul docs-shelf> |
| - {{range .Results}}{{template "tile" .}}{{end}} |
| -</ul> |
| +<div rst-list> |
| + {{range .Results}}{{template "row" .}}{{end}} |
| +</div> |
| {{else}} |
| <div rst-empty> |
| <h2 rst-empty-title>{{.NoResultsHead}}</h2> |
| @@ -421,17 +422,16 @@ |
| </div> |
| {{end}} |
| <p docs-search-clear><a href="/">{{.ClearLabel}}</a></p> |
| -{{else if .Groups}} |
| -<div docs-groups> |
| +{{else if or .Recent .Groups}} |
| +{{if .Recent}}<ul docs-shelf> |
| + {{range .Recent}}{{template "tile" .}}{{end}} |
| +</ul>{{end}} |
| +{{if .Groups}}<div rst-list> |
| {{range .Groups}} |
| - <section docs-group> |
| - <h2 docs-group-label>{{.Label}}</h2> |
| - <ul docs-shelf> |
| - {{range .Rows}}{{template "tile" .}}{{end}} |
| - </ul> |
| - </section> |
| + <h2 docs-group-label>{{.Label}}</h2> |
| + {{range .Rows}}{{template "row" .}}{{end}} |
| {{end}} |
| -</div> |
| +</div>{{end}} |
| {{else}} |
| <div rst-empty> |
| <h2 rst-empty-title>{{.EmptyTitle}}</h2> |