oficina / slides Public

Slides viewer: the slide on the desk, the deck's actions as pills, a filmstrip of pictures

The viewer takes the editor's look (I2, after Docs): the warm desk, the
slide as paper on it, the actions as one row of pills, the pager centred
under the slide, the notes a card, and the filmstrip the server's own
pictures of each slide (thumbs.go, from this surface's capability, so a
share link's strip is fetched over the share link), numbered, the
current one ringed and aria-current.

Also: the editor's New slide row keeps its layout toggle compact when
the strip runs across the top.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev d535d0b34776615b5e8e6989287f88c342d4dda5 parent b106244
3 files changed, +137 −17
  • internal/slides/static/editor.css +3 −1
  • internal/slides/templates/viewer.html +128 −16
  • internal/slides/viewer.go +6 −0
diff --git a/internal/slides/static/editor.css b/internal/slides/static/editor.css
index c797f27..250ddaf 100644
--- a/internal/slides/static/editor.css
+++ b/internal/slides/static/editor.css
@@ -453,9 +453,10 @@ body:has([slides-editor]) {
[slides-strip-add] {
display: flex;
gap: 2px;
+ max-inline-size: 20rem;
padding: var(--rst-sp-2) 6px;
}
-[slides-strip-add] > [rst-btn] {
+[slides-strip-add] > [rst-btn]:first-child {
border-end-end-radius: 4px;
border-start-end-radius: 4px;
flex: 1 1 auto;
@@ -466,6 +467,7 @@ body:has([slides-editor]) {
anchor-name: --slides-strip-add;
}
[slides-layouts-toggle] {
+ flex: none;
border-end-start-radius: 4px;
border-start-start-radius: 4px;
padding-inline: 8px;
diff --git a/internal/slides/templates/viewer.html b/internal/slides/templates/viewer.html
index 3ef20b9..9aca78d 100644
--- a/internal/slides/templates/viewer.html
+++ b/internal/slides/templates/viewer.html
@@ -22,23 +22,75 @@
{{define "page-head"}}<link rel="stylesheet" href="{{asset "static/slides.css"}}">
<style>
/* The chrome around the slide. Everything a slide itself looks like
- is slides.css; these five rules only place the viewer's own parts,
- and each one is an app attribute (slides-*) so nothing here can
- collide with the rst-* vocabulary. */
- [slides-stage] {
- margin-block: var(--rst-sp-4);
+ is slides.css; these rules only place the viewer's own parts, each
+ an app attribute (slides-*) so nothing here can collide with the
+ rst-* vocabulary. The look is the editor's (I2, after Docs): the
+ slide is paper on a desk, the deck's actions one set of pills, and
+ the filmstrip the slides' own pictures. */
+ @property --slides-desk {
+ syntax: "<color>";
+ inherits: true;
+ initial-value: #ebe7e2;
+ }
+ :root {
+ --slides-desk: light-dark(#ebe7e2, #0e1014);
+ }
+ body:has([slides-viewer]) {
+ background: var(--slides-desk);
+ }
+ [slides-viewer] {
+ margin-inline: auto;
+ max-inline-size: 72rem;
+ }
+ [slides-viewer] [rst-page-header] {
+ border: 0;
+ margin-block-end: var(--rst-sp-3);
+ padding: 0;
+ }
+ [slides-viewer] [rst-page-header] h1 {
+ font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.4rem);
+ letter-spacing: -0.02em;
}
[slides-tools] {
+ align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--rst-sp-2);
}
+ [slides-tools] form {
+ margin: 0;
+ }
+ [slides-tools] [rst-btn] {
+ border-radius: 999px;
+ min-block-size: 36px;
+ padding-inline: 16px;
+ }
+ [slides-tools] [rst-btn]:not([rst-btn="primary"]) {
+ background: var(--rst-surface);
+ }
+ [slides-viewer] [slides-stage] {
+ margin-block: var(--rst-sp-4) var(--rst-sp-3);
+ }
+ [slides-viewer] [slides-stage] > [slides-slide] {
+ border-radius: 6px;
+ box-shadow:
+ 0 0 0 1px rgb(40 28 12 / 0.06),
+ 0 1px 2px rgb(40 28 12 / 0.10),
+ 0 18px 40px -18px rgb(40 28 12 / 0.40);
+ }
[slides-pager] {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--rst-sp-3);
}
+ [slides-viewer] [slides-pager] {
+ justify-content: center;
+ }
+ [slides-pager] [rst-btn] {
+ border-radius: 999px;
+ min-block-size: 36px;
+ }
/* A pager end — the previous link on slide one — is plain text, not
a disabled control: there is nowhere to go, so there is nothing to
put in the tab order. */
@@ -47,25 +99,85 @@
color: var(--rst-text-muted);
margin: 0;
}
+ [slides-counter] {
+ font-variant-numeric: tabular-nums;
+ min-inline-size: 6em;
+ text-align: center;
+ }
+ [slides-viewer] details[slides-notes] {
+ background: var(--rst-surface);
+ border-radius: 12px;
+ box-shadow: 0 0 0 1px light-dark(rgb(40 28 12 / 0.07), rgb(255 255 255 / 0.07));
+ margin-block: var(--rst-sp-4) 0;
+ padding: 12px 18px;
+ }
+ [slides-viewer] details[slides-notes] > summary {
+ color: var(--rst-text-muted);
+ cursor: pointer;
+ font-size: 13px;
+ font-weight: 600;
+ min-block-size: 24px;
+ }
+ [slides-film-nav] {
+ margin-block-start: var(--rst-sp-5);
+ }
[slides-film] {
- display: flex;
- flex-wrap: wrap;
- gap: var(--rst-sp-2);
+ counter-reset: slides-film;
+ display: grid;
+ gap: var(--rst-sp-3);
+ grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
list-style: none;
margin: 0;
padding: 0;
}
+ [slides-film] > li {
+ counter-increment: slides-film;
+ }
[slides-film] a {
- display: inline-block;
- /* 24 by 24 is the floor a pointer target has to meet (WCAG 2.2 AA);
- the padding is what gets a one-word slide name there. */
+ color: var(--rst-text-muted);
+ display: grid;
+ font-size: 12px;
+ font-weight: 600;
+ gap: 6px;
+ /* 24 by 24 is the floor a pointer target has to meet (WCAG 2.2 AA). */
min-height: 24px;
- padding: var(--rst-sp-1) var(--rst-sp-2);
+ text-decoration: none;
+ }
+ [slides-film] a > span::before {
+ content: counter(slides-film) " ";
+ font-weight: 500;
+ white-space: pre;
+ }
+ [slides-film-thumb] {
+ aspect-ratio: 16 / 9;
+ background: var(--rst-surface);
+ border-radius: 6px;
+ box-shadow:
+ 0 0 0 1px light-dark(rgb(40 28 12 / 0.08), rgb(255 255 255 / 0.08)),
+ 0 4px 10px -6px rgb(40 28 12 / 0.25);
+ block-size: auto;
+ display: block;
+ inline-size: 100%;
+ object-fit: contain;
+ transition: transform 160ms ease;
+ }
+ [slides-film] a:hover [slides-film-thumb] {
+ transform: translateY(-1px);
}
+ /* The current slide: ringed in the accent AND aria-current, and its
+ name in full ink — never colour alone. */
[slides-film] a[aria-current="true"] {
- background: var(--rst-accent-soft);
- border-radius: var(--rst-radius-sm);
- font-weight: 600;
+ color: var(--rst-text);
+ }
+ [slides-film] a[aria-current="true"] [slides-film-thumb] {
+ box-shadow: 0 0 0 2px var(--rst-accent), 0 0 0 5px var(--rst-accent-soft);
+ }
+ [slides-film] a:focus-visible {
+ outline: none;
+ }
+ [slides-film] a:focus-visible [slides-film-thumb] {
+ outline: 2px solid var(--rst-accent);
+ outline-offset: 3px;
}
</style>{{end}}
{{define "content"}}
@@ -138,7 +250,7 @@
<nav slides-film-nav aria-label="{{.FilmLabel}}">
<ol slides-film>
{{range .Film}}
- <li><a href="{{.Href}}"{{if .Current}} aria-current="true"{{end}}>{{.Label}}</a></li>
+ <li><a href="{{.Href}}"{{if .Current}} aria-current="true"{{end}}><img slides-film-thumb src="{{.Thumb}}" alt="" width="1920" height="1080" loading="lazy"><span>{{.Label}}</span></a></li>
{{end}}
</ol>
</nav>
diff --git a/internal/slides/viewer.go b/internal/slides/viewer.go
index afaaead..4187cc3 100644
--- a/internal/slides/viewer.go
+++ b/internal/slides/viewer.go
@@ -15,6 +15,7 @@
package slides
import (
+ "fmt"
"html/template"
"net/http"
"strconv"
@@ -50,6 +51,10 @@ type filmItem struct {
Href string
Label string
Current bool
+ // Thumb is the server's picture of the slide (thumbs.go), from this
+ // surface's own capability, so a share link's filmstrip is fetched
+ // over the share link.
+ Thumb string
}
// viewerPage is the whole viewer screen. Mode is what the template
@@ -291,6 +296,7 @@ func (a *app) renderViewer(w http.ResponseWriter, r *http.Request, d Deck, mode,
Href: viewerHref(base, i+1, vp, false),
Label: slideLabel(r, sl, i+1),
Current: i == index,
+ Thumb: fmt.Sprintf("%s/slides/%s.svg?seq=%d", base, sl.ID, d.Seq),
})
}