Add hideable presenter bars with edge and context-menu recovery

This commit is contained in:
Dandaedre 2026-11-19 16:50:02 +01:00
parent 9f79ba1c15
commit 1fc48c6b5e
7 changed files with 97 additions and 10 deletions

2
Cargo.lock generated
View File

@ -921,7 +921,7 @@ dependencies = [
[[package]] [[package]]
name = "pdf-presenter" name = "pdf-presenter"
version = "0.1.10" version = "0.1.11"
dependencies = [ dependencies = [
"font8x8", "font8x8",
"softbuffer", "softbuffer",

View File

@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
resolver = "3" resolver = "3"
[workspace.package] [workspace.package]
version = "0.1.10" version = "0.1.11"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter" repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"

View File

@ -2,6 +2,16 @@
## Unreleased ## Unreleased
### 0.1.11
- Add independently hideable presenter header/footer to the HTML concept, with
edge-hover reveal and right-click controls to restore/pin either bar. Hidden bars
release space; transient reveals overlay the content and remain usable on hover.
- Save pinned bar visibility per project/globally. Older layouts default to both
visible; temporary reveals never change saved preferences. Native UI remains pending.
Validation: JavaScript syntax and 67 Firefox checks (19 bar-visibility/recovery,
24 layout/persistence and 24 slide-browser/display-group regressions).
### 0.1.10 ### 0.1.10
- Add number + Enter slide jumps and a separate windowed thumbnail browser to the - Add number + Enter slide jumps and a separate windowed thumbnail browser to the

View File

@ -13,30 +13,33 @@ main{display:flex;flex-direction:column;min-height:430px;max-width:none}.preview
.layout-save{position:sticky;bottom:-24px;background:#192528;padding:16px 0 24px;border-top:1px solid var(--line);margin-top:18px;display:grid;gap:8px}.layout-save button{font-size:12px}.layout-save p{margin:0;font-size:12px}.project-picker{display:flex;gap:8px;align-items:center}.project-picker select{max-width:180px} .layout-save{position:sticky;bottom:-24px;background:#192528;padding:16px 0 24px;border-top:1px solid var(--line);margin-top:18px;display:grid;gap:8px}.layout-save button{font-size:12px}.layout-save p{margin:0;font-size:12px}.project-picker{display:flex;gap:8px;align-items:center}.project-picker select{max-width:180px}
.no-previews .notes{flex:1 1 0!important;margin-top:0}footer #outputBadge{font-size:11px;color:var(--accent)} .no-previews .notes{flex:1 1 0!important;margin-top:0}footer #outputBadge{font-size:11px;color:var(--accent)}
.screen-roles{display:grid;gap:10px;margin:18px 0}.screen-role{display:flex;align-items:center;justify-content:space-between;gap:12px}.jump-indicator{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#243e39;color:#dffff5;border:1px solid #67e2cd;border-radius:12px;padding:18px 28px;z-index:20;box-shadow:0 12px 40px #0008} .screen-roles{display:grid;gap:10px;margin:18px 0}.screen-role{display:flex;align-items:center;justify-content:space-between;gap:12px}.jump-indicator{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#243e39;color:#dffff5;border:1px solid #67e2cd;border-radius:12px;padding:18px 28px;z-index:20;box-shadow:0 12px 40px #0008}
.chrome-menu{position:fixed;z-index:30;width:230px;padding:8px;background:#203033;border:1px solid #557177;border-radius:10px;box-shadow:0 12px 45px #0008}.chrome-menu button{display:block;width:100%;text-align:left;border:0;background:transparent}.chrome-menu button:hover{background:#35484c}#presenterHeader.peek{position:fixed;top:var(--concept-height,0px);left:0;right:0;z-index:8;background:#192528;box-shadow:0 12px 35px #0008}#presenterFooter.peek{position:fixed;bottom:0;left:0;right:0;margin:0;padding:14px 24px;z-index:8;background:#192528;box-shadow:0 -12px 35px #0008}.layout-open #presenterFooter.peek{right:330px}.menu{z-index:10}@media(max-width:850px){.layout-open #presenterFooter.peek{right:0}}
</style> </style>
</head> </head>
<body> <body>
<div class="concept"><span><strong>INTERACTIVE CONCEPT</strong> · Mock slides and screens. No real display or system settings change.</span><label class="project-picker">Demo project <select id="demoProject"><option value="ideas">Making room for ideas</option><option value="workshop">Workshop</option></select></label><label>Test setup <select id="topology"><option value="3">3 screens</option><option value="4">4 screens</option><option value="2">Projector disconnected</option><option value="1">Laptop only</option></select></label></div> <div class="concept"><span><strong>INTERACTIVE CONCEPT</strong> · Mock slides and screens. No real display or system settings change.</span><label class="project-picker">Demo project <select id="demoProject"><option value="ideas">Making room for ideas</option><option value="workshop">Workshop</option></select></label><label>Test setup <select id="topology"><option value="3">3 screens</option><option value="4">4 screens</option><option value="2">Projector disconnected</option><option value="1">Laptop only</option></select></label></div>
<header><span class="brand">P</span><button id="menuButton" aria-expanded="false" aria-controls="menu">☰ Menu</button><div class="doc"><b id="projectTitle">Making room for ideas</b><small>demo.pdf · 12 slides</small></div><div class="toolbar"><button id="displayButton">Displays · 1 → 3</button><button id="blankButton">Blank presentation</button><button id="slidesButton">All slides</button><button id="layoutButton" class="layout-button" aria-controls="layoutPanel" aria-expanded="false">Layout</button><div id="elapsedWidget" class="clock-widget"><small>Elapsed</small><span class="timer" id="timer">00:00</span></div><div id="clockWidget" class="clock-widget"><small>Time</small><span class="timer" id="wallClock">00:00</span></div></div></header> <header id="presenterHeader"><span class="brand">P</span><button id="menuButton" aria-expanded="false" aria-controls="menu">☰ Menu</button><div class="doc"><b id="projectTitle">Making room for ideas</b><small>demo.pdf · 12 slides</small></div><div class="toolbar"><button id="hideHeader" title="Hide header; move near the top edge to reveal" aria-label="Hide header">⌃</button><button id="displayButton">Displays · 1 → 3</button><button id="blankButton">Blank presentation</button><button id="slidesButton">All slides</button><button id="layoutButton" class="layout-button" aria-controls="layoutPanel" aria-expanded="false">Layout</button><div id="elapsedWidget" class="clock-widget"><small>Elapsed</small><span class="timer" id="timer">00:00</span></div><div id="clockWidget" class="clock-widget"><small>Time</small><span class="timer" id="wallClock">00:00</span></div></div></header>
<nav id="menu" class="menu" aria-label="Presenter menu" hidden><button disabled>Open PDF… <small>Planned</small></button><button disabled>Open picture folder… <small>Planned</small></button><hr><button id="menuDisplays">Displays <small>Assign screens</small></button><button id="menuLayout">Layout <small>Show, hide & resize</small></button><button id="menuSettings">Settings <small>Preview</small></button><hr><button id="resetTimer">Reset timer</button><button id="resetDemo">Reset demo</button></nav> <nav id="menu" class="menu" aria-label="Presenter menu" hidden><button disabled>Open PDF… <small>Planned</small></button><button disabled>Open picture folder… <small>Planned</small></button><hr><button id="menuDisplays">Displays <small>Assign screens</small></button><button id="menuLayout">Layout <small>Show, hide & resize</small></button><button id="menuSettings">Settings <small>Preview</small></button><hr><button id="resetTimer">Reset timer</button><button id="resetDemo">Reset demo</button></nav>
<main><div class="previews" id="previews"><section id="previousPreview" class="previous-preview"><div class="caption"><span>PREVIOUS</span><span id="previousCount"></span></div><div class="slide"><span class="eyebrow">LOOKING BACK</span><h1 id="previousTitle">Start of presentation</h1><div class="orb"></div></div></section><section id="currentPreview"><div class="caption"><span>CURRENT · <span id="currentCount">1 / 12</span></span></div><div class="slide"><span class="eyebrow">BEFFROI / FIELD NOTES</span><h1 id="currentTitle">Making room<br>for ideas.</h1><p id="currentSubtitle">A clear view. A little space. A better presentation.</p><div class="orb"></div><span class="slide-foot">DESIGN SESSION · NOVEMBER 2026</span></div></section><section class="next" id="nextPreview"><div class="caption"><span>NEXT</span><span id="nextCount">2 / 12</span></div><div class="slide"><span class="eyebrow">THE STARTING POINT</span><h1 id="nextTitle">Keep the<br>focus.</h1><div class="orb"></div></div><div class="next-hint">Your slides go to <strong id="destination">Screen 3 · Epson projector</strong>.<br>Menus and notes stay on the presenter screen.</div></section></div> <main><div class="previews" id="previews"><section id="previousPreview" class="previous-preview"><div class="caption"><span>PREVIOUS</span><span id="previousCount"></span></div><div class="slide"><span class="eyebrow">LOOKING BACK</span><h1 id="previousTitle">Start of presentation</h1><div class="orb"></div></div></section><section id="currentPreview"><div class="caption"><span>CURRENT · <span id="currentCount">1 / 12</span></span></div><div class="slide"><span class="eyebrow">BEFFROI / FIELD NOTES</span><h1 id="currentTitle">Making room<br>for ideas.</h1><p id="currentSubtitle">A clear view. A little space. A better presentation.</p><div class="orb"></div><span class="slide-foot">DESIGN SESSION · NOVEMBER 2026</span></div></section><section class="next" id="nextPreview"><div class="caption"><span>NEXT</span><span id="nextCount">2 / 12</span></div><div class="slide"><span class="eyebrow">THE STARTING POINT</span><h1 id="nextTitle">Keep the<br>focus.</h1><div class="orb"></div></div><div class="next-hint">Your slides go to <strong id="destination">Screen 3 · Epson projector</strong>.<br>Menus and notes stay on the presenter screen.</div></section></div>
<section class="notes" id="notesWidget"><div class="caption"><span>PRESENTER NOTES <small> · auto-fit</small></span><div class="notes-tools"><button id="longNotes">Try long notes</button><button id="notesLayout">Resize & visibility</button></div></div><div class="note-box" id="noteBox"><p class="note-text" id="noteText"></p></div></section> <section class="notes" id="notesWidget"><div class="caption"><span>PRESENTER NOTES <small> · auto-fit</small></span><div class="notes-tools"><button id="longNotes">Try long notes</button><button id="notesLayout">Resize & visibility</button></div></div><div class="note-box" id="noteBox"><p class="note-text" id="noteText"></p></div></section>
<footer><button id="previous">← Previous</button><button class="primary" id="next">Next →</button><span class="kbd">← → slides · number + Enter to jump · B blank</span><b id="outputBadge">PRESENTATION VISIBLE</b><span class="status" id="routeStatus">Presenter 1 · Presentation 3</span></footer><div id="toast" role="status" aria-live="polite"></div></main> <footer id="presenterFooter"><button id="previous">← Previous</button><button class="primary" id="next">Next →</button><span class="kbd">← → slides · number + Enter to jump · B blank</span><b id="outputBadge">PRESENTATION VISIBLE</b><span class="status" id="routeStatus">Presenter 1 · Presentation 3</span><button id="hideFooter" title="Hide footer; move near the bottom edge to reveal" aria-label="Hide footer">⌄</button></footer><div id="toast" role="status" aria-live="polite"></div></main>
<aside id="layoutPanel" class="layout-panel" aria-labelledby="layoutTitle" hidden> <aside id="layoutPanel" class="layout-panel" aria-labelledby="layoutTitle" hidden>
<div class="heading"><div><h2 id="layoutTitle">Your presenter view</h2><span class="pill">LIVE LAYOUT</span></div><button id="closeLayout" class="close" aria-label="Close layout">✕</button></div> <div class="heading"><div><h2 id="layoutTitle">Your presenter view</h2><span class="pill">LIVE LAYOUT</span></div><button id="closeLayout" class="close" aria-label="Close layout">✕</button></div>
<p>Keep what helps you speak. Hidden items give their space to the rest. Presentation output stays unchanged.</p> <p>Keep what helps you speak. Hidden items give their space to the rest. Presentation output stays unchanged.</p>
<div class="presets"><button id="balancedLayout">Balanced</button><button id="focusLayout">Slide focus</button><button id="speakerLayout">Notes first</button></div> <div class="presets"><button id="balancedLayout">Balanced</button><button id="focusLayout">Slide focus</button><button id="speakerLayout">Notes first</button></div>
<div id="layoutControls"></div> <div class="layout-control"><label><input id="showHeader" type="checkbox" checked> Keep header visible</label><label style="margin-top:12px"><input id="showFooter" type="checkbox" checked> Keep footer visible</label><small>Hidden bars reveal near the top/bottom edge. Right-click anywhere on the presenter to show them again.</small></div><div id="layoutControls"></div>
<small>Preview sizes share the available width. Notes size controls their share of the height; text always fits. Clock sizes control their text size.</small> <small>Preview sizes share the available width. Notes size controls their share of the height; text always fits. Clock sizes control their text size.</small>
<small>Project layouts override the default for all projects. Saved layouts persist in this browser; native configuration remains planned.</small> <small>Project layouts override the default for all projects. Saved layouts persist in this browser; native configuration remains planned.</small>
<div class="layout-save"><button class="primary" id="saveProjectLayout">Save layout · This project</button><button id="saveGlobalLayout">Save layout · All projects</button><button id="useGlobalLayout">Use all-projects default</button><p id="layoutSaveStatus" role="status" aria-live="polite"></p></div> <div class="layout-save"><button class="primary" id="saveProjectLayout">Save layout · This project</button><button id="saveGlobalLayout">Save layout · All projects</button><button id="useGlobalLayout">Use all-projects default</button><p id="layoutSaveStatus" role="status" aria-live="polite"></p></div>
</aside> </aside>
<dialog id="displayDialog" aria-labelledby="displayTitle"><div class="dialog-head"><div><h2 id="displayTitle">Where should each view go?</h2><small>Presenter = your controls and notes. Presentation = slides for viewers.</small></div><button aria-label="Close displays" data-close="displayDialog">✕</button></div><div class="dialog-body"><div style="display:flex;justify-content:space-between;align-items:center"><span class="pill">CONNECTED SCREENS · SIMULATED</span><button id="identify">Identify screens</button></div><div class="map" id="screenMap"></div><div id="screenRoles" class="screen-roles"></div><button id="swap">⇄ Swap presenter and presentation groups</button><div class="checks"><label><input id="presenterFull" type="checkbox" checked> Presenter fullscreen</label><label><input id="presentationFull" type="checkbox" checked> Presentation fullscreen</label><label><input id="remember" type="checkbox" checked> Remember this setup</label></div><div class="notice" id="displayNotice">Choose destinations, then Apply. Unused screens stay untouched.</div></div><div class="dialog-actions"><small>Changes apply together.</small><button data-close="displayDialog">Cancel</button><button class="primary" id="apply">Apply setup</button></div></dialog> <dialog id="displayDialog" aria-labelledby="displayTitle"><div class="dialog-head"><div><h2 id="displayTitle">Where should each view go?</h2><small>Presenter = your controls and notes. Presentation = slides for viewers.</small></div><button aria-label="Close displays" data-close="displayDialog">✕</button></div><div class="dialog-body"><div style="display:flex;justify-content:space-between;align-items:center"><span class="pill">CONNECTED SCREENS · SIMULATED</span><button id="identify">Identify screens</button></div><div class="map" id="screenMap"></div><div id="screenRoles" class="screen-roles"></div><button id="swap">⇄ Swap presenter and presentation groups</button><div class="checks"><label><input id="presenterFull" type="checkbox" checked> Presenter fullscreen</label><label><input id="presentationFull" type="checkbox" checked> Presentation fullscreen</label><label><input id="remember" type="checkbox" checked> Remember this setup</label></div><div class="notice" id="displayNotice">Choose destinations, then Apply. Unused screens stay untouched.</div></div><div class="dialog-actions"><small>Changes apply together.</small><button data-close="displayDialog">Cancel</button><button class="primary" id="apply">Apply setup</button></div></dialog>
<dialog id="settingsDialog" aria-labelledby="settingsTitle"><div class="dialog-head"><div><h2 id="settingsTitle">Settings</h2><small>Proposed app behavior · not operating-system settings</small></div><button aria-label="Close settings" data-close="settingsDialog">✕</button></div><div class="dialog-body"><div class="settings-row"><b>Remember your screens</b><br><span class="muted">Keep preferred screen identities, fullscreen choices and notes layout in a per-user configuration. Temporary fallback does not replace your preferred setup.</span></div><div class="settings-row"><b>Configuration location</b><br><code>Linux: $XDG_CONFIG_HOME/pdf-presenter/settings.toml</code><br><small>Defaults to ~/.config/pdf-presenter/settings.toml</small><br><code>Windows: %APPDATA%\Beffroi\PdfPresenter\settings.toml</code><br><code>macOS: ~/Library/Application Support/Beffroi/PdfPresenter/settings.toml</code></div><div class="settings-row"><b>Keep screens awake during presentation</b><br><span class="muted">Planned native feature. Includes paused and blanked output; this HTML does not inhibit sleep.</span></div><div class="notice">Saved layouts persist in this browser, with project overrides above the all-projects default. Screen assignments remain session-only. The native app's global configuration is not implemented yet.</div></div><div class="dialog-actions"><button class="primary" data-close="settingsDialog">Done</button></div></dialog> <dialog id="settingsDialog" aria-labelledby="settingsTitle"><div class="dialog-head"><div><h2 id="settingsTitle">Settings</h2><small>Proposed app behavior · not operating-system settings</small></div><button aria-label="Close settings" data-close="settingsDialog">✕</button></div><div class="dialog-body"><div class="settings-row"><b>Remember your screens</b><br><span class="muted">Keep preferred screen identities, fullscreen choices and notes layout in a per-user configuration. Temporary fallback does not replace your preferred setup.</span></div><div class="settings-row"><b>Configuration location</b><br><code>Linux: $XDG_CONFIG_HOME/pdf-presenter/settings.toml</code><br><small>Defaults to ~/.config/pdf-presenter/settings.toml</small><br><code>Windows: %APPDATA%\Beffroi\PdfPresenter\settings.toml</code><br><code>macOS: ~/Library/Application Support/Beffroi/PdfPresenter/settings.toml</code></div><div class="settings-row"><b>Keep screens awake during presentation</b><br><span class="muted">Planned native feature. Includes paused and blanked output; this HTML does not inhibit sleep.</span></div><div class="notice">Saved layouts persist in this browser, with project overrides above the all-projects default. Screen assignments remain session-only. The native app's global configuration is not implemented yet.</div></div><div class="dialog-actions"><button class="primary" data-close="settingsDialog">Done</button></div></dialog>
<nav id="chromeMenu" class="chrome-menu" aria-label="Presenter visibility" hidden><button id="contextHeader">Hide header</button><button id="contextFooter">Hide footer</button><button id="contextBoth">Show header and footer</button><button id="contextLayout">Layout…</button></nav>
<div id="jumpIndicator" class="jump-indicator" role="status" hidden></div> <div id="jumpIndicator" class="jump-indicator" role="status" hidden></div>
<template id="galleryTemplate"> <template id="galleryTemplate">
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>All slides · PDF Presenter</title><style> <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>All slides · PDF Presenter</title><style>
:root{color-scheme:dark;font-family:system-ui,sans-serif;background:#11191b;color:#edf4f4}*{box-sizing:border-box}body{margin:0}button,select,input{font:inherit}button,select{background:#263638;color:inherit;border:1px solid #536468;border-radius:7px;padding:9px 12px;cursor:pointer}button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid #67e2cd;outline-offset:3px}header{position:sticky;top:0;background:#192528;z-index:2;padding:16px 20px;display:flex;align-items:center;flex-wrap:wrap;gap:16px;border-bottom:1px solid #435458}h1{font-size:20px;margin:0;margin-right:auto}label{font-size:13px;display:flex;gap:8px;align-items:center}input{accent-color:#67e2cd}#galleryGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--thumb,220px)),1fr));gap:20px;padding:24px}.thumbnail{background:none;border:2px solid transparent;text-align:left;padding:5px;color:#c8d6d7}.thumbnail.selected{border-color:#e6b66b}.thumbnail.live .thumb-art{box-shadow:inset 0 0 0 3px #67e2cd}.thumb-art{aspect-ratio:16/9;display:flex;align-items:center;padding:18px;background:#daeae2;color:#153730;font-size:clamp(16px,2vw,27px);font-weight:700;border-radius:5px;overflow:hidden}.thumbnail:nth-child(even) .thumb-art{background:#294d44;color:#e1eee7}.thumb-caption{display:flex;justify-content:space-between;font-size:12px;margin:8px 2px}.live-tag{color:#67e2cd}footer{position:sticky;bottom:0;background:#192528;border-top:1px solid #435458;padding:14px 20px;display:flex;gap:14px;align-items:center;flex-wrap:wrap}#showSelected{background:#67e2cd;color:#102824;font-weight:700}#galleryStatus{flex:1;font-size:13px}#placementHint{font-size:12px;color:#acbec0;margin:12px 24px}#jumpIndicator{position:fixed;bottom:80px;left:50%;transform:translateX(-50%);padding:16px;background:#31564d;border-radius:10px;z-index:5}[hidden]{display:none!important} :root{color-scheme:dark;font-family:system-ui,sans-serif;background:#11191b;color:#edf4f4}*{box-sizing:border-box}body{margin:0}button,select,input{font:inherit}button,select{background:#263638;color:inherit;border:1px solid #536468;border-radius:7px;padding:9px 12px;cursor:pointer}button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid #67e2cd;outline-offset:3px}header{position:sticky;top:0;background:#192528;z-index:2;padding:16px 20px;display:flex;align-items:center;flex-wrap:wrap;gap:16px;border-bottom:1px solid #435458}h1{font-size:20px;margin:0;margin-right:auto}label{font-size:13px;display:flex;gap:8px;align-items:center}input{accent-color:#67e2cd}#galleryGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--thumb,220px)),1fr));gap:20px;padding:24px}.thumbnail{background:none;border:2px solid transparent;text-align:left;padding:5px;color:#c8d6d7}.thumbnail.selected{border-color:#e6b66b}.thumbnail.live .thumb-art{box-shadow:inset 0 0 0 3px #67e2cd}.thumb-art{aspect-ratio:16/9;display:flex;align-items:center;padding:18px;background:#daeae2;color:#153730;font-size:clamp(16px,2vw,27px);font-weight:700;border-radius:5px;overflow:hidden}.thumbnail:nth-child(even) .thumb-art{background:#294d44;color:#e1eee7}.thumb-caption{display:flex;justify-content:space-between;font-size:12px;margin:8px 2px}.live-tag{color:#67e2cd}footer{position:sticky;bottom:0;background:#192528;border-top:1px solid #435458;padding:14px 20px;display:flex;gap:14px;align-items:center;flex-wrap:wrap}#showSelected{background:#67e2cd;color:#102824;font-weight:700}#galleryStatus{flex:1;font-size:13px}#placementHint{font-size:12px;color:#acbec0;margin:12px 24px}#jumpIndicator{position:fixed;bottom:80px;left:50%;transform:translateX(-50%);padding:16px;background:#31564d;border-radius:10px;z-index:5}[hidden]{display:none!important}
</style></head><body><header><h1>All slides</h1><label>Preview size <input id="thumbnailSize" type="range" min="130" max="380" value="220"></label><label><input id="changeOnClick" type="checkbox"> Change on click</label><label>Open on <select id="galleryMonitor"></select></label></header><p id="placementHint">Windowed by default. Monitor selection is simulated in this HTML prototype.</p><main id="galleryGrid" aria-label="Slide thumbnails"></main><footer><span id="galleryStatus" role="status"></span><button id="showSelected">Show selected slide</button><button id="closeGallery">Close</button></footer><div id="jumpIndicator" role="status" hidden></div></body></html> </style></head><body><header><h1>All slides</h1><label>Preview size <input id="thumbnailSize" type="range" min="130" max="380" value="220"></label><label><input id="changeOnClick" type="checkbox"> Change on click</label><label>Open on <select id="galleryMonitor"></select></label></header><p id="placementHint">Windowed by default. Monitor selection is simulated in this HTML prototype.</p><main id="galleryGrid" aria-label="Slide thumbnails"></main><footer><span id="galleryStatus" role="status"></span><button id="showSelected">Show selected slide</button><button id="closeGallery">Close</button></footer><div id="jumpIndicator" role="status" hidden></div></body></html>
</template> </template>
<script> <script>
@ -47,7 +50,7 @@ const titles=['Making room for ideas.','Keep the focus.','A shared perspective.'
let count=3,page=0,blank=false,long=false,start=Date.now(),active={presenter:[1],presentation:[3],presenterFull:true,presentationFull:true},preferred=structuredClone(active),draft=structuredClone(active); let count=3,page=0,blank=false,long=false,start=Date.now(),active={presenter:[1],presentation:[3],presenterFull:true,presentationFull:true},preferred=structuredClone(active),draft=structuredClone(active);
const message=text=>$('toast').textContent=text; const message=text=>$('toast').textContent=text;
document.querySelectorAll('.previews .slide').forEach(slide=>{const stage=document.createElement('div');stage.className='slide-stage';slide.before(stage);stage.append(slide);}); document.querySelectorAll('.previews .slide').forEach(slide=>{const stage=document.createElement('div');stage.className='slide-stage';slide.before(stage);stage.append(slide);});
const layoutDefaults={previous:{show:true,size:60},current:{show:true,size:130},next:{show:true,size:75},notes:{show:true,size:28},elapsed:{show:true,size:28},clock:{show:true,size:28}}; const layoutDefaults={previous:{show:true,size:60},current:{show:true,size:130},next:{show:true,size:75},notes:{show:true,size:28},elapsed:{show:true,size:28},clock:{show:true,size:28},chrome:{header:true,footer:true}};
let layout=structuredClone(layoutDefaults); let layout=structuredClone(layoutDefaults);
const layoutSpecs=[['previous','Previous slide',30,160,'weight'],['current','Current slide',60,200,'weight'],['next','Next slide',30,160,'weight'],['notes','Notes',12,65,'%'],['elapsed','Elapsed time',16,72,'px'],['clock','Time · HH:MM',16,72,'px']]; const layoutSpecs=[['previous','Previous slide',30,160,'weight'],['current','Current slide',60,200,'weight'],['next','Next slide',30,160,'weight'],['notes','Notes',12,65,'%'],['elapsed','Elapsed time',16,72,'px'],['clock','Time · HH:MM',16,72,'px']];
const layoutStorageKey='pdf-presenter.menu-layouts.v1'; const layoutStorageKey='pdf-presenter.menu-layouts.v1';
@ -57,7 +60,9 @@ function validateLayout(value){
if(!value||typeof value!=='object')throw Error('Invalid layout'); if(!value||typeof value!=='object')throw Error('Invalid layout');
const clean={}; const clean={};
for(const [key,,min,max] of layoutSpecs){const entry=value[key];if(!entry||typeof entry.show!=='boolean'||!Number.isInteger(entry.size)||entry.size<min||entry.size>max)throw Error('Invalid layout widget');clean[key]={show:entry.show,size:entry.size};} for(const [key,,min,max] of layoutSpecs){const entry=value[key];if(!entry||typeof entry.show!=='boolean'||!Number.isInteger(entry.size)||entry.size<min||entry.size>max)throw Error('Invalid layout widget');clean[key]={show:entry.show,size:entry.size};}
return clean; const chrome=Object.hasOwn(value,'chrome')?value.chrome:{header:true,footer:true};
if(!chrome||typeof chrome.header!=='boolean'||typeof chrome.footer!=='boolean')throw Error('Invalid chrome visibility');
clean.chrome={header:chrome.header,footer:chrome.footer};return clean;
} }
function readLayouts(){ function readLayouts(){
const raw=localStorage.getItem(layoutStorageKey);if(raw===null)return emptyLayouts(); const raw=localStorage.getItem(layoutStorageKey);if(raw===null)return emptyLayouts();
@ -80,8 +85,9 @@ $('saveProjectLayout').onclick=()=>saveLayout('project');$('saveGlobalLayout').o
$('useGlobalLayout').onclick=()=>{try{const saved=readLayouts();delete saved.projects[projectId];localStorage.setItem(layoutStorageKey,JSON.stringify(saved));restoreLayout();}catch{layoutStatus('Could not remove this project’s override. Your current layout is unchanged.');}}; $('useGlobalLayout').onclick=()=>{try{const saved=readLayouts();delete saved.projects[projectId];localStorage.setItem(layoutStorageKey,JSON.stringify(saved));restoreLayout();}catch{layoutStatus('Could not remove this project’s override. Your current layout is unchanged.');}};
$('demoProject').onchange=()=>{projectId=$('demoProject').value;$('projectTitle').textContent=$('demoProject').selectedOptions[0].textContent;restoreLayout();message('Demo project switched. Unsaved layout edits were discarded.');}; $('demoProject').onchange=()=>{projectId=$('demoProject').value;$('projectTitle').textContent=$('demoProject').selectedOptions[0].textContent;restoreLayout();message('Demo project switched. Unsaved layout edits were discarded.');};
const widgets={previous:'previousPreview',current:'currentPreview',next:'nextPreview',notes:'notesWidget',elapsed:'elapsedWidget',clock:'clockWidget'}; const widgets={previous:'previousPreview',current:'currentPreview',next:'nextPreview',notes:'notesWidget',elapsed:'elapsedWidget',clock:'clockWidget'};
function availableHeight(){const main=document.querySelector('main');main.style.height=Math.max(430,innerHeight-main.getBoundingClientRect().top)+'px';} function availableHeight(){document.documentElement.style.setProperty('--concept-height',document.querySelector('.concept').getBoundingClientRect().bottom+'px');const main=document.querySelector('main');main.style.height=Math.max(430,innerHeight-main.getBoundingClientRect().top)+'px';}
function applyLayout(){ function applyLayout(){
resetChromePeek();
layoutStatus('Layout changes are not saved until you choose a save scope.'); layoutStatus('Layout changes are not saved until you choose a save scope.');
for(const [key] of layoutSpecs){$(widgets[key]).hidden=!layout[key].show;const toggle=$('show-'+key);if(toggle)toggle.checked=layout[key].show;$('size-'+key).value=layout[key].size;$('size-'+key).disabled=!layout[key].show;$('value-'+key).textContent=layout[key].size+(key==='notes'?'%':['clock','elapsed'].includes(key)?'px':'');} for(const [key] of layoutSpecs){$(widgets[key]).hidden=!layout[key].show;const toggle=$('show-'+key);if(toggle)toggle.checked=layout[key].show;$('size-'+key).value=layout[key].size;$('size-'+key).disabled=!layout[key].show;$('value-'+key).textContent=layout[key].size+(key==='notes'?'%':['clock','elapsed'].includes(key)?'px':'');}
const noPreviews=!['previous','current','next'].some(k=>layout[k].show);$('previews').hidden=noPreviews;document.querySelector('main').classList.toggle('no-previews',noPreviews); const noPreviews=!['previous','current','next'].some(k=>layout[k].show);$('previews').hidden=noPreviews;document.querySelector('main').classList.toggle('no-previews',noPreviews);
@ -95,6 +101,30 @@ $('layoutButton').onclick=()=>{closeMenu();setLayoutOpen($('layoutPanel').hidden
$('balancedLayout').onclick=()=>{layout=structuredClone(layoutDefaults);applyLayout();}; $('balancedLayout').onclick=()=>{layout=structuredClone(layoutDefaults);applyLayout();};
$('focusLayout').onclick=()=>{layout=structuredClone(layoutDefaults);for(const k of ['previous','next','notes','elapsed','clock'])layout[k].show=false;applyLayout();}; $('focusLayout').onclick=()=>{layout=structuredClone(layoutDefaults);for(const k of ['previous','next','notes','elapsed','clock'])layout[k].show=false;applyLayout();};
$('speakerLayout').onclick=()=>{layout=structuredClone(layoutDefaults);layout.previous.show=false;layout.notes.size=52;layout.next.size=50;applyLayout();}; $('speakerLayout').onclick=()=>{layout=structuredClone(layoutDefaults);layout.previous.show=false;layout.notes.size=52;layout.next.size=50;applyLayout();};
const chromePeek={header:false,footer:false};
const chromeTimers={header:null,footer:null};
let chromePointerTarget=null;
const chromeElement=key=>$(key==='header'?'presenterHeader':'presenterFooter');
function paintChrome(){
for(const key of ['header','footer']){const bar=chromeElement(key);bar.hidden=!layout.chrome[key]&&!chromePeek[key];bar.classList.toggle('peek',!layout.chrome[key]&&chromePeek[key]);$(key==='header'?'showHeader':'showFooter').checked=layout.chrome[key];}
$('hideHeader').textContent=layout.chrome.header?'⌃':'Keep header';$('hideHeader').setAttribute('aria-label',layout.chrome.header?'Hide header':'Keep header visible');$('hideFooter').textContent=layout.chrome.footer?'⌄':'Keep footer';$('hideFooter').setAttribute('aria-label',layout.chrome.footer?'Hide footer':'Keep footer visible');
availableHeight();fitNotes();
}
function resetChromePeek(){for(const key of ['header','footer']){clearTimeout(chromeTimers[key]);chromePeek[key]=false;}paintChrome();}
function setChromePinned(key,visible){layout.chrome[key]=visible;if(!visible&&chromeElement(key).contains(document.activeElement))document.activeElement.blur();if(key==='header'&&!visible)closeMenu();applyLayout();}
function chromeBusy(key){const bar=chromeElement(key);return bar.contains(chromePointerTarget)||bar.contains(document.activeElement)||(key==='header'&&!$('menu').hidden);}
function scheduleChromeHide(key){clearTimeout(chromeTimers[key]);chromeTimers[key]=setTimeout(()=>{if(!chromeBusy(key)){chromePeek[key]=false;paintChrome();}},650);}
function revealChrome(key){if(layout.chrome[key])return;clearTimeout(chromeTimers[key]);if(chromePeek[key])return;chromePeek[key]=true;paintChrome();}
$('showHeader').onchange=()=>setChromePinned('header',$('showHeader').checked);$('showFooter').onchange=()=>setChromePinned('footer',$('showFooter').checked);
$('hideHeader').onclick=()=>setChromePinned('header',!layout.chrome.header);$('hideFooter').onclick=()=>setChromePinned('footer',!layout.chrome.footer);
document.addEventListener('pointermove',e=>{chromePointerTarget=e.target;if(document.querySelector('dialog[open]')||!$('chromeMenu').hidden)return;const nearTop=e.clientY<=document.querySelector('.concept').getBoundingClientRect().bottom+14;const nearBottom=e.clientY>=innerHeight-18;for(const [key,near] of [['header',nearTop],['footer',nearBottom]]){if(near)revealChrome(key);else if(chromePeek[key]){if(chromeBusy(key))clearTimeout(chromeTimers[key]);else scheduleChromeHide(key);}}});
document.addEventListener('pointerleave',()=>{chromePointerTarget=null;for(const key of ['header','footer'])scheduleChromeHide(key);});
for(const key of ['header','footer'])chromeElement(key).addEventListener('focusout',()=>scheduleChromeHide(key));
function closeChromeMenu(){const hadFocus=$('chromeMenu').contains(document.activeElement);$('chromeMenu').hidden=true;if(hadFocus){document.body.tabIndex=-1;document.body.focus({preventScroll:true});}}
document.addEventListener('contextmenu',e=>{if(e.target.closest('input,textarea,select')||e.target.isContentEditable||document.querySelector('dialog[open]'))return;e.preventDefault();closeMenu();$('contextHeader').textContent=layout.chrome.header?'Hide header':'Show header';$('contextFooter').textContent=layout.chrome.footer?'Hide footer':'Show footer';const menu=$('chromeMenu');menu.hidden=false;const rect=menu.getBoundingClientRect();menu.style.left=Math.max(8,Math.min(e.clientX,innerWidth-rect.width-8))+'px';menu.style.top=Math.max(8,Math.min(e.clientY,innerHeight-rect.height-8))+'px';$('contextHeader').focus();});
$('contextHeader').onclick=()=>{setChromePinned('header',!layout.chrome.header);closeChromeMenu();};$('contextFooter').onclick=()=>{setChromePinned('footer',!layout.chrome.footer);closeChromeMenu();};$('contextBoth').onclick=()=>{layout.chrome={header:true,footer:true};applyLayout();closeChromeMenu();};$('contextLayout').onclick=()=>{closeChromeMenu();openLayout();};
document.addEventListener('pointerdown',e=>{if(!$('chromeMenu').contains(e.target))closeChromeMenu();});
new ResizeObserver(availableHeight).observe(document.querySelector('.concept'));
new ResizeObserver(availableHeight).observe(document.querySelector('header'));window.addEventListener('resize',availableHeight); new ResizeObserver(availableHeight).observe(document.querySelector('header'));window.addEventListener('resize',availableHeight);
function closeMenu(){$('menu').hidden=true;$('menuButton').setAttribute('aria-expanded','false');} function closeMenu(){$('menu').hidden=true;$('menuButton').setAttribute('aria-expanded','false');}
@ -166,7 +196,7 @@ function handleNumberJump(e,doc){
const indicator=doc.getElementById('jumpIndicator');indicator.hidden=false;indicator.textContent=`Go to slide ${digits} · Enter to show · Esc to cancel`;return true; const indicator=doc.getElementById('jumpIndicator');indicator.hidden=false;indicator.textContent=`Go to slide ${digits} · Enter to show · Esc to cancel`;return true;
} }
$('menuSettings').onclick=()=>{closeMenu();$('settingsDialog').showModal();};$('menuLayout').onclick=openLayout;$('resetTimer').onclick=()=>{start=Date.now();closeMenu();};$('resetDemo').onclick=()=>location.reload();document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).close());document.addEventListener('pointerdown',e=>{if(!$('menu').contains(e.target)&&!$('menuButton').contains(e.target))closeMenu();});document.addEventListener('focusin',e=>{if(e.target.matches('input,select,textarea'))clearJump(document);}); $('menuSettings').onclick=()=>{closeMenu();$('settingsDialog').showModal();};$('menuLayout').onclick=openLayout;$('resetTimer').onclick=()=>{start=Date.now();closeMenu();};$('resetDemo').onclick=()=>location.reload();document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).close());document.addEventListener('pointerdown',e=>{if(!$('menu').contains(e.target)&&!$('menuButton').contains(e.target))closeMenu();});document.addEventListener('focusin',e=>{if(e.target.matches('input,select,textarea'))clearJump(document);});
document.addEventListener('keydown',e=>{if(document.querySelector('dialog[open]'))return;if(handleNumberJump(e,document))return;if(e.key==='Escape'){closeMenu();if(!$('layoutPanel').hidden){setLayoutOpen(false);$('layoutButton').focus();}return;}if(e.ctrlKey||e.metaKey||e.altKey||e.isComposing||e.target.isContentEditable||['INPUT','SELECT','TEXTAREA','BUTTON'].includes(document.activeElement.tagName)||!$('menu').hidden)return;if(e.key==='ArrowRight'||e.key===' '){e.preventDefault();clearJump(document);move(1);}if(e.key==='ArrowLeft'){e.preventDefault();clearJump(document);move(-1);}if(e.key.toLowerCase()==='b'&&active.presentation.length){blank=!blank;render();}}); document.addEventListener('keydown',e=>{if(!$('chromeMenu').hidden){if(e.key==='Escape'){e.preventDefault();closeChromeMenu();}return;}if(document.querySelector('dialog[open]'))return;if(handleNumberJump(e,document))return;if(e.key==='Escape'){closeMenu();if(!$('layoutPanel').hidden){setLayoutOpen(false);$('layoutButton').focus();}return;}if(e.ctrlKey||e.metaKey||e.altKey||e.isComposing||e.target.isContentEditable||['INPUT','SELECT','TEXTAREA','BUTTON'].includes(document.activeElement.tagName)||!$('menu').hidden)return;if(e.key==='ArrowRight'||e.key===' '){e.preventDefault();clearJump(document);move(1);}if(e.key==='ArrowLeft'){e.preventDefault();clearJump(document);move(-1);}if(e.key.toLowerCase()==='b'&&active.presentation.length){blank=!blank;render();}});
function updateClocks(){const seconds=Math.floor((Date.now()-start)/1000);$('timer').textContent=String(Math.floor(seconds/60)).padStart(2,'0')+':'+String(seconds%60).padStart(2,'0');const now=new Date();$('wallClock').textContent=String(now.getHours()).padStart(2,'0')+':'+String(now.getMinutes()).padStart(2,'0');}setInterval(updateClocks,1000);updateClocks();restoreLayout();render(); function updateClocks(){const seconds=Math.floor((Date.now()-start)/1000);$('timer').textContent=String(Math.floor(seconds/60)).padStart(2,'0')+':'+String(seconds%60).padStart(2,'0');const now=new Date();$('wallClock').textContent=String(now.getHours()).padStart(2,'0')+':'+String(now.getMinutes()).padStart(2,'0');}setInterval(updateClocks,1000);updateClocks();restoreLayout();render();
</script> </script>
</body></html> </body></html>

View File

@ -94,6 +94,8 @@ Depends on usable PDF output and acknowledged displayed-slide state.
requested/preparing/displayed slides and blank state; keep every dialog on presenter. requested/preparing/displayed slides and blank state; keep every dialog on presenter.
Let the speaker independently show/hide and resize previous/current/next previews, notes, Let the speaker independently show/hide and resize previous/current/next previews, notes,
elapsed time and local HH:MM time. Hidden widgets reclaim space. elapsed time and local HH:MM time. Hidden widgets reclaim space.
Header/footer can be hidden independently and recovered by edge hover or right-click;
persist pinned visibility with project/global layouts, not temporary reveals.
Provide explicit project and all-project saves; project layouts override the global Provide explicit project and all-project saves; project layouts override the global
default, with an action to remove the current project override. Keep complete default, with an action to remove the current project override. Keep complete
notes fitted, and persist layout visibility/sizes in the global settings contract. notes fitted, and persist layout visibility/sizes in the global settings contract.

View File

@ -11,6 +11,12 @@ Each layout contains `previous`, `current`, `next`, `notes`, `elapsed` and `cloc
Each widget has a boolean `show` and an integer `size`. Every widget, including current, can be hidden. Each widget has a boolean `show` and an integer `size`. Every widget, including current, can be hidden.
Preview sizes are relative width weights: previous/next 30–160, current 60–200. Preview sizes are relative width weights: previous/next 30–160, current 60–200.
Notes size is a height percentage 12–65; elapsed/clock sizes are CSS pixels 16–72. Notes size is a height percentage 12–65; elapsed/clock sizes are CSS pixels 16–72.
Layouts also carry `chrome: {"header": true, "footer": true}` with boolean pinned
visibility. Old version-1 records omitting `chrome` load with both visible; explicit
invalid types are rejected. Temporary edge reveals are never saved. Hidden bars
reveal as overlays near the corresponding edge, and can be pinned from the right-click
menu or their own button. Hiding them releases layout space; clocks inside a hidden
header are hidden with it, without losing their individual visibility preferences.
No document contents, notes, screen assignments or elapsed time are persisted. No document contents, notes, screen assignments or elapsed time are persisted.
Load precedence: project override, global default, built-in balanced layout. Load precedence: project override, global default, built-in balanced layout.
@ -24,7 +30,7 @@ it does not erase saved layouts.
Example (a complete all-project default without overrides): Example (a complete all-project default without overrides):
```json ```json
{"version":1,"global":{"previous":{"show":true,"size":60},"current":{"show":true,"size":130},"next":{"show":true,"size":75},"notes":{"show":true,"size":28},"elapsed":{"show":true,"size":28},"clock":{"show":true,"size":28}},"projects":{}} {"version":1,"global":{"previous":{"show":true,"size":60},"current":{"show":true,"size":130},"next":{"show":true,"size":75},"notes":{"show":true,"size":28},"elapsed":{"show":true,"size":28},"clock":{"show":true,"size":28},"chrome":{"header":true,"footer":true}},"projects":{}}
``` ```
Reject unsupported versions, malformed envelopes, missing widgets, wrong types, Reject unsupported versions, malformed envelopes, missing widgets, wrong types,
@ -49,3 +55,7 @@ It is not a native-application or physical-display acceptance test.
Version 1 now accepts `current.show: false`; previously saved layouts remain valid. Version 1 now accepts `current.show: false`; previously saved layouts remain valid.
With all slide previews hidden, visible notes expand into the released space. With all slide previews hidden, visible notes expand into the released space.
`tests/browser/chrome-visibility.js` additionally checks saved bar visibility, legacy
record defaults, edge reveal, pointer/focus retention and right-click recovery. Append
it to a temporary HTML copy and wait for its asynchronous PASS/FAIL report.

View File

@ -0,0 +1,35 @@
// Append to a temporary copy of the concept. Wait for the asynchronous PASS/FAIL report.
window.addEventListener('load', async () => {
const results=[];const check=(value,label)=>{if(!value)throw Error(label);results.push(label);};
const wait=()=>new Promise(resolve=>setTimeout(resolve,750));
const pointer=(target,y)=>target.dispatchEvent(new PointerEvent('pointermove',{bubbles:true,clientX:300,clientY:y}));
const original=localStorage.getItem(layoutStorageKey);
try {
layout=structuredClone(layoutDefaults);applyLayout();
const main=document.querySelector('main');const initial=main.clientHeight;
$('hideHeader').click();$('hideFooter').click();
check($('presenterHeader').hidden&&$('presenterFooter').hidden,'Both bars can be hidden');
check(main.clientHeight>initial,'Hidden header releases height');
check(layout.elapsed.show&&layout.clock.show,'Clock preferences preserved while header hidden');
pointer(document.body,2);check(!$('presenterHeader').hidden&&$('presenterHeader').classList.contains('peek'),'Top edge reveals header');
check(main.clientHeight>initial,'Reveal overlays without taking layout space');
check(!layout.chrome.header,'Transient reveal does not pin header');
pointer($('presenterHeader'),80);await wait();check(!$('presenterHeader').hidden,'Header remains while pointer is on it');
pointer(document.body,innerHeight/2);await wait();check($('presenterHeader').hidden,'Header hides after leaving');
pointer(document.body,innerHeight-2);check(!$('presenterFooter').hidden,'Bottom edge reveals footer');
$('next').focus();pointer(document.body,innerHeight/2);await wait();check(!$('presenterFooter').hidden,'Keyboard focus keeps revealed bar usable');
$('next').blur();await wait();check($('presenterFooter').hidden,'Footer hides after focus leaves');
document.body.dispatchEvent(new MouseEvent('contextmenu',{bubbles:true,cancelable:true,clientX:innerWidth-2,clientY:innerHeight-2}));
check(!$('chromeMenu').hidden&&$('contextHeader').textContent==='Show header','Right-click offers recovery');
const r=$('chromeMenu').getBoundingClientRect();check(r.right<=innerWidth&&r.bottom<=innerHeight,'Context menu stays inside viewport');
$('contextBoth').click();check(!$('presenterHeader').hidden&&!$('presenterFooter').hidden&&layout.chrome.header&&layout.chrome.footer,'Context menu restores both bars');
setChromePinned('header',false);setChromePinned('footer',false);saveLayout('project');layout=structuredClone(layoutDefaults);restoreLayout();
check(!layout.chrome.header&&!layout.chrome.footer,'Hidden bars round-trip per project');
saveLayout('global');check(!readLayouts().global.chrome.header,'Global save includes visibility');
const old=structuredClone(layoutDefaults);delete old.chrome;check(validateLayout(old).chrome.header&&validateLayout(old).chrome.footer,'Older records migrate to visible bars');
let rejected=false;try{validateLayout({...old,chrome:{header:'false',footer:true}});}catch{rejected=true;}check(rejected,'Malformed chrome rejected');
pointer(document.body,2);$('hideHeader').click();check(layout.chrome.header&&!$('presenterHeader').classList.contains('peek'),'Revealed bar can be pinned');
const report=document.createElement('pre');report.style='position:fixed;inset:0;background:#102820;color:white;padding:24px;z-index:100;font:16px monospace;overflow:auto';report.textContent=`PASS · ${results.length} browser checks\n\n${results.join('\n')}`;document.body.append(report);
}catch(error){document.body.textContent='FAIL: '+error.message;}
finally{if(original===null)localStorage.removeItem(layoutStorageKey);else localStorage.setItem(layoutStorageKey,original);}
});