| 1 | {{/* presenter — GET /p/{session}/notes for a session with a position: |
| 2 | the presenter window (spec §5), drawn by the server. |
| 3 | |
| 4 | Paul's mockup (docs/superpowers/specs/2026-11-17-presenter-mockup.html) |
| 5 | with its ids as presenter-* attributes: the header, then the three |
| 6 | panels — the slide on screen now, what comes next, the notes — |
| 7 | placed on a 12×12 grid by the cookie's arrangement (presenter_window.go |
| 8 | writes it into the <style> below, so the first paint is final). |
| 9 | |
| 10 | It never scrolls: static/presenter.css makes html and body exactly |
| 11 | the viewport. Only the notes scroll, inside their own panel. |
| 12 | |
| 13 | With scripts off every control is a form that posts a press and |
| 14 | redirects back to ?slide=N&step=k, which draws that state; the |
| 15 | position is a link to the picker (?pick=1). With them, the |
| 16 | presenter bundle (fixtures/presenter-window.mjs) holds the whole |
| 17 | talk (data-talk) and moves the window at once, from memory, on every |
| 18 | press; it ticks the clock and the timer, and draws every sentence |
| 19 | from the data-text-* below. An empty talk has nothing to move, and |
| 20 | keeps static/present.js for the clock and to follow the session. |
| 21 | |
| 22 | Arrange this window (fixtures/presenter-arrange.mjs) shows the bar |
| 23 | under the header and makes the panels movable on their grid: each |
| 24 | panel a named group (data-arrange-name), the selected one given the |
| 25 | eight buttons of presenter-arrange-tools, every change said in the |
| 26 | bar's live region. It needs the script; without it all of this |
| 27 | stays hidden. */}} |
| 28 | {{define "page-head"}}<link rel="stylesheet" href="{{asset "static/slides.css"}}"> |
| 29 | <link rel="stylesheet" href="{{asset "static/presenter.css"}}"> |
| 30 | <style>{{.ArrangeCSS}}</style> |
| 31 | {{- if .Empty}} |
| 32 | <script defer src="{{asset "static/present.js"}}"></script> |
| 33 | {{- else}} |
| 34 | {{/* Blocking, before the bundle: keeps the keys pressed before the |
| 35 | bundle has mounted (static/presskeys.js). */}} |
| 36 | <script src="{{asset "static/presskeys.js"}}"></script> |
| 37 | <script type="module" src="{{.Bundle}}"></script> |
| 38 | {{- end}}{{end}} |
| 39 | {{define "presenter-fields"}}<input type="hidden" name="op" value="{{.Op}}"> |
| 40 | {{- with .Slide}}<input type="hidden" name="slide" value="{{.}}">{{end}} |
| 41 | {{- with .Token}}<input type="hidden" name="t" value="{{.}}">{{end}} |
| 42 | <input type="hidden" name="press" value="{{.Press}}">{{end}} |
| 43 | {{define "main"}}{{$L := localizer $}}<main id="main" presenter data-session="{{.Session}}" |
| 44 | {{- if not .Empty}} data-slide="{{.Slide}}" data-step="{{.Step}}" data-mode="{{.Mode}}"{{end}} |
| 45 | data-blackout="{{if .Blackout}}true{{else}}false{{end}}" |
| 46 | {{- with .Token}} data-remote-token="{{.}}"{{end}} |
| 47 | {{- if not .Empty}} |
| 48 | data-talk="{{.TalkHref}}" data-stream="{{.StreamHref}}" data-command="{{.Action}}" |
| 49 | {{- with .Words}} |
| 50 | data-text-progress="{{.Progress}}" data-text-step="{{.Step}}" |
| 51 | data-text-next-step="{{.NextStep}}" data-text-next-slide="{{.NextSlide}}" data-text-next-end="{{.NextEnd}}" |
| 52 | data-text-mode-core="{{.ModeCore}}" data-text-mode-full="{{.ModeFull}}" data-text-black="{{.Black}}" |
| 53 | data-text-menu-full="{{.MenuFull}}" data-text-menu-core="{{.MenuCore}}" data-text-nonotes="{{.NoNotes}}" |
| 54 | data-text-loading="{{.Loading}}" data-text-loading-failed="{{.LoadingFailed}}" data-text-offline="{{.Offline}}" |
| 55 | data-text-pick-field="{{.PickField}}" data-text-pick-count="{{.PickCount}}" data-text-pick-matches="{{.PickMatches}}" |
| 56 | data-text-pick-none="{{.PickNone}}" data-text-pick-full="{{.PickFull}}" data-text-pick-title="{{.PickTitle}}" |
| 57 | data-text-arrange-where="{{.ArrangeWhere}}" |
| 58 | {{- end}} |
| 59 | {{- end}}> |
| 60 | <div presenter-head> |
| 61 | {{- if not .Empty}} |
| 62 | <a presenter-pos slides-counter href="{{.PickHref}}" title="{{.PickLabel}}"><span presenter-count>{{.Counter}}</span>{{icon "chevron-down"}}</a> |
| 63 | {{- if .StepCount}} |
| 64 | <span presenter-stepcount role="status"><span presenter-track aria-hidden="true"> |
| 65 | {{- range .Track}}<i{{if .}} data-done{{end}}></i>{{end -}} |
| 66 | </span><span presenter-steptext>{{.StepCount}}</span></span> |
| 67 | {{- end}} |
| 68 | {{- with .ModeBadge}} |
| 69 | <span presenter-mode>{{.}}</span> |
| 70 | {{- end}} |
| 71 | {{- if .Blackout}} |
| 72 | <span presenter-black>{{.BlackLabel}}</span> |
| 73 | {{- end}} |
| 74 | <span presenter-status role="status"></span> |
| 75 | <span presenter-presses> |
| 76 | <form method="post" action="{{.Action}}" data-busy="false"> |
| 77 | {{template "presenter-fields" (withL (.Back) $L)}} |
| 78 | <button type="submit" presenter-press="prev">{{.BackLabel}}</button> |
| 79 | </form> |
| 80 | <form method="post" action="{{.Action}}" data-busy="false"> |
| 81 | {{template "presenter-fields" (withL (.Forward) $L)}} |
| 82 | <button type="submit" presenter-press="next">{{.ForwardLabel}}</button> |
| 83 | </form> |
| 84 | </span> |
| 85 | {{- end}} |
| 86 | <form presenter-timer method="post" action="{{.Action}}" data-busy="false"> |
| 87 | {{template "presenter-fields" (withL (.TimerReset) $L)}} |
| 88 | <button type="submit" presenter-elapsed title="{{.TimerLabel}}" |
| 89 | {{- if .TimerSince}} data-timer-since="{{.TimerSince}}"{{end}}>{{.Timer}}</button> |
| 90 | </form> |
| 91 | <span presenter-clock title="{{.ClockLabel}}" data-clock>{{.Clock}}</span> |
| 92 | <details presenter-more-menu> |
| 93 | <summary presenter-more aria-label="{{.MoreLabel}}" title="{{.MoreLabel}}">{{icon "ellipsis"}}</summary> |
| 94 | <div presenter-menu> |
| 95 | {{- with .Menu}} |
| 96 | <form method="post" action="{{.PairAction}}" target="slides-pair" data-busy="false"> |
| 97 | <button type="submit">{{.PairLabel}}</button> |
| 98 | </form> |
| 99 | <a href="{{.WindowHref}}" target="slides-window">{{.WindowLabel}}</a> |
| 100 | <form method="post" action="{{$.Action}}" data-busy="false"> |
| 101 | {{template "presenter-fields" (withL (.Mode) $L)}} |
| 102 | <button type="submit">{{.ModeLabel}}</button> |
| 103 | </form> |
| 104 | <button type="button" presenter-arrange>{{.ArrangeLabel}}</button> |
| 105 | <hr> |
| 106 | <a href="{{.DeckHref}}">{{.DeckLabel}}</a> |
| 107 | <form method="post" action="{{$.Action}}" data-busy="false"> |
| 108 | {{template "presenter-fields" (withL (.End) $L)}} |
| 109 | <button type="submit">{{.EndLabel}}</button> |
| 110 | </form> |
| 111 | {{- end}} |
| 112 | </div> |
| 113 | </details> |
| 114 | </div> |
| 115 | {{/* The empty talk's state. A window that opens on one shows it; one |
| 116 | already open keeps it hidden until every slide is parked or gone, |
| 117 | and its script shows it then (presenter-window.mjs's drawEmpty). */}} |
| 118 | <div presenter-empty{{if not .Empty}} hidden{{end}}> |
| 119 | {{template "empty-state" dict "L" $L "Title" .EmptyTitle "Body" .EmptyBody}} |
| 120 | </div> |
| 121 | {{if not .Empty}} |
| 122 | <div presenter-arrange-bar hidden> |
| 123 | <div presenter-arrange-words><span>{{.ArrangeHint}}</span> |
| 124 | <small id="presenter-arrange-help">{{.ArrangeHelp}}</small> |
| 125 | <small presenter-arrange-status role="status" aria-live="polite"></small></div> |
| 126 | <button type="button" presenter-arrange-reset>{{.ArrangeReset}}</button> |
| 127 | <button type="button" presenter-arrange-done>{{.ArrangeDone}}</button> |
| 128 | </div> |
| 129 | <div presenter-panels> |
| 130 | <div presenter-panel="now" data-arrange-name="{{.NowName}}"> |
| 131 | <div presenter-fit> |
| 132 | <div presenter-frame{{if .Blackout}} data-black{{end}}><div presenter-scale>{{.Now}}</div></div> |
| 133 | </div> |
| 134 | </div> |
| 135 | <div presenter-panel="next" data-arrange-name="{{.NextName}}"> |
| 136 | <p presenter-next-label>{{icon "arrow-right"}}<span>{{.NextLabel}}</span></p> |
| 137 | <div presenter-fit> |
| 138 | {{- if .Next}} |
| 139 | <div presenter-frame><div presenter-scale>{{.Next}}</div></div> |
| 140 | {{- else}} |
| 141 | <div presenter-frame data-end></div> |
| 142 | {{- end}} |
| 143 | </div> |
| 144 | </div> |
| 145 | <div presenter-panel="notes" data-arrange-name="{{.NotesName}}"> |
| 146 | <div presenter-notes data-notes-mode="{{if .NotesFit}}fit{{else}}scroll{{end}}" tabindex="0"> |
| 147 | {{- range .Parts}} |
| 148 | <section presenter-part{{with .State}} data-part="{{.}}"{{end}}>{{.HTML}}</section> |
| 149 | {{- else}} |
| 150 | <p presenter-nonotes>{{.NoNotes}}</p> |
| 151 | {{- end}} |
| 152 | </div> |
| 153 | <div presenter-tools role="toolbar" aria-label="{{.ToolsLabel}}"> |
| 154 | <button type="button" presenter-notes-fit aria-pressed="{{if .NotesFit}}true{{else}}false{{end}}" aria-label="{{.FitLabel}}" title="{{.FitLabel}}">{{icon "shrink"}}</button> |
| 155 | <button type="button" presenter-notes-scroll aria-pressed="{{if .NotesFit}}false{{else}}true{{end}}" aria-label="{{.ScrollLabel}}" title="{{.ScrollLabel}}">{{icon "move-vertical"}}</button> |
| 156 | <hr> |
| 157 | <button type="button" presenter-notes-smaller aria-label="{{.SmallerLabel}}" title="{{.SmallerLabel}}">{{icon "a-arrow-down"}}</button> |
| 158 | <button type="button" presenter-notes-larger aria-label="{{.LargerLabel}}" title="{{.LargerLabel}}">{{icon "a-arrow-up"}}</button> |
| 159 | </div> |
| 160 | </div> |
| 161 | <div presenter-arrange-tools role="group" hidden> |
| 162 | {{- range .ArrangeTools}} |
| 163 | <button type="button" data-arrange-op="{{.Op}}" aria-label="{{.Label}}" title="{{.Label}}">{{icon .Icon}}</button> |
| 164 | {{- end}} |
| 165 | </div> |
| 166 | </div> |
| 167 | {{end}} |
| 168 | </main>{{end}} |
| 169 | {{define "content"}}{{end}} |
| 170 | |