Deckstride/docs/design/presenter-menu.html

203 lines
46 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Deckstride · Menu concept</title>
<style>
:root{color-scheme:dark;--bg:#101517;--panel:#192124;--line:#344145;--muted:#9baeb3;--text:#edf4f4;--accent:#67e2cd}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:15px system-ui,sans-serif}button,select,input{font:inherit}button,select{color:inherit;background:#263236;border:1px solid #45565b;border-radius:8px;padding:10px 14px;cursor:pointer}button:hover{background:#35484c}button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:3px}button:disabled{opacity:.45;cursor:default}.primary{background:var(--accent);color:#102824;border-color:var(--accent);font-weight:700}.primary:hover{background:#a0f1e2}.muted,small{color:var(--muted)}small{font-size:12px}.concept{background:#26322e;border-bottom:1px solid #40554c;padding:9px 24px;display:flex;align-items:center;justify-content:space-between;gap:16px;font-size:12px}.concept strong{letter-spacing:1.4px;color:#a7d9c9}.concept select{padding:4px 8px;font-size:12px}header{display:flex;gap:12px;align-items:center;padding:18px 24px;border-bottom:1px solid var(--line)}.brand{width:32px;height:32px;background:var(--accent);color:#102824;border-radius:8px;display:grid;place-items:center;font-weight:900}.doc{flex:1}.doc b{display:block}.toolbar{display:flex;gap:10px;align-items:center}.timer{font-size:24px;font-variant-numeric:tabular-nums;padding:0 12px}.live{color:var(--accent)}main{padding:22px 24px;max-width:1800px;margin:auto}.previews{display:grid;grid-template-columns:1.6fr 1fr;gap:22px;align-items:start}.caption{display:flex;justify-content:space-between;align-items:center;margin:0 0 10px;font-size:12px;font-weight:600;letter-spacing:1px;color:var(--muted)}.caption b{color:var(--accent)}.slide{aspect-ratio:16/9;border-radius:10px;overflow:hidden;background:#e4eee8;color:#162d2a;padding:7%;position:relative;display:flex;flex-direction:column;justify-content:center;border:1px solid #536962}.slide .eyebrow{font-size:clamp(9px,1vw,16px);letter-spacing:3px;font-weight:700}.slide h1{font-size:clamp(24px,3.8vw,64px);line-height:1.06;margin:18px 0;letter-spacing:-2px;max-width:80%;z-index:1}.slide p{font-size:clamp(10px,1.2vw,20px);max-width:75%;z-index:1}.orb{position:absolute;right:-10%;bottom:-45%;width:65%;aspect-ratio:1;border:32px solid #6db5a3;border-radius:50%;opacity:.65}.next .slide{background:#233f3b;color:#d5eae1}.next h1{font-size:clamp(20px,2.6vw,44px)}.next .orb{border-color:#4a8072}.slide-foot{position:absolute;bottom:7%;font-size:10px;letter-spacing:2px}.next-hint{margin-top:18px;padding:15px;border:1px solid var(--line);border-radius:8px;color:var(--muted);font-size:13px}.notes{margin-top:22px;border:1px solid var(--line);border-radius:10px;background:var(--panel);padding:16px 20px}.notes-tools{display:flex;gap:14px;align-items:center;font-size:12px;letter-spacing:0}.notes-tools button{font-size:12px;padding:5px 9px}.notes-tools label{display:flex;gap:8px;align-items:center}.notes-tools input{width:100px}.note-box{height:165px;overflow:hidden}.note-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.35;margin:0;max-width:100%}footer{display:flex;align-items:center;gap:12px;margin-top:18px}footer .status{margin-left:auto;font-size:13px}.kbd{font-size:12px;color:var(--muted);margin-left:8px}#toast{min-height:26px;padding-top:10px;color:var(--accent);font-size:13px}.menu{position:absolute;top:125px;left:24px;width:290px;background:#1d282b;border:1px solid #526267;border-radius:12px;padding:10px;box-shadow:0 20px 70px #0009;z-index:4}.menu button{display:flex;justify-content:space-between;width:100%;border:0;background:transparent;text-align:left}.menu button:hover{background:#344449}.menu hr{border:0;border-top:1px solid var(--line)}dialog{color:var(--text);background:#192124;border:1px solid #52676d;border-radius:16px;padding:0;width:min(860px,94vw);max-height:90vh;box-shadow:0 30px 100px #0008}dialog::backdrop{background:#050a0bcc;backdrop-filter:blur(4px)}.dialog-head{padding:24px 28px 18px;display:flex;justify-content:space-between;align-items:start;border-bottom:1px solid var(--line)}h2{margin:0 0 7px;font-size:25px}.dialog-body{padding:22px 28px}.map{display:flex;align-items:end;justify-content:center;gap:12px;min-height:190px;background:#11191b;border-radius:10px;padding:25px 15px;margin:16px 0}.monitor{width:155px;text-align:center}.monitor-face{border:2px solid #506367;border-radius:6px;aspect-ratio:16/10;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:6px;background:#243236}.monitor.presenter .monitor-face{border-color:var(--accent);background:#1d4039}.monitor.presentation .monitor-face{border-color:#c3b8ff;background:#36314b}.monitor-face b{font-size:25px}.monitor-face small{color:inherit}.monitor-name{font-size:11px;margin-top:10px;color:var(--muted)}.identify .monitor-face b{font-size:50px;color:#fff}.assignments{display:grid;grid-template-columns:1fr auto 1fr;gap:16px;align-items:end}.field label{display:block;margin-bottom:8px;font-size:13px;color:var(--muted)}.field select{width:100%}.checks{display:flex;flex-wrap:wrap;gap:22px;margin-top:24px;font-size:13px}.checks input{accent-color:var(--accent)}.notice{background:#293633;border-left:3px solid var(--accent);padding:12px 15px;font-size:13px;line-height:1.6;margin-top:20px}.dialog-actions{display:flex;gap:12px;justify-content:end;padding:18px 28px;border-top:1px solid var(--line)}.dialog-actions small{margin-right:auto;align-self:center}.settings-row{padding:16px 0;border-bottom:1px solid var(--line);line-height:1.7}.settings-row code{font-size:12px;overflow-wrap:anywhere}.pill{font-size:11px;letter-spacing:1px;color:var(--accent)}[hidden]{display:none!important}@media(max-width:760px){header{flex-wrap:wrap;padding:14px}.toolbar{flex-wrap:wrap}.timer{font-size:18px}.previews{grid-template-columns:1fr 1fr;gap:12px}main{padding:16px}.notes-tools{flex-wrap:wrap}.caption{flex-wrap:wrap;gap:8px}.assignments{grid-template-columns:1fr}.monitor{min-width:70px}.monitor-name{font-size:9px}.map{gap:6px;padding:12px 6px}.monitor-face small{font-size:9px}footer{flex-wrap:wrap}.kbd{display:none}.concept{flex-wrap:wrap}.menu{top:150px}.slide h1{letter-spacing:-1px}.dialog-body{padding:18px}}
/* Layout editing stays beside the live preview, not in a blocking dialog. */
header{flex-wrap:wrap}.toolbar{flex-wrap:wrap}.clock-widget{display:flex;flex-direction:column;align-items:center;min-width:0}.clock-widget small{font-size:10px;text-transform:uppercase;letter-spacing:1px}.timer{line-height:1.15;padding:0 6px}.layout-button[aria-expanded="true"]{border-color:var(--accent);color:var(--accent)}
main{display:flex;flex-direction:column;min-height:430px;max-width:none}.previews{flex:1;min-height:100px;align-items:stretch;gap:16px}.previews>section{min-width:0;min-height:0;display:flex;flex-direction:column;container-type:inline-size}.previews .slide{flex:1;min-height:0;aspect-ratio:auto;padding:8%;}.slide h1,.next h1{font-size:clamp(15px,8cqw,64px);letter-spacing:-1px;margin:12px 0}.slide .eyebrow{font-size:clamp(7px,2cqw,14px)}.slide p{font-size:clamp(9px,3cqw,20px)}.slide-foot{font-size:clamp(6px,1.5cqw,10px)}.previous-preview .slide{background:#253438;color:#b4c7c9}.notes{flex:0 0 28%;min-height:70px;display:flex;flex-direction:column;margin-top:16px}.note-box{height:auto;min-height:0;flex:1}footer{flex-shrink:0;flex-wrap:wrap;margin-top:14px}#toast{flex-shrink:0}.next-hint{display:none}.caption{flex-wrap:wrap;gap:6px}.notes-tools{flex-wrap:wrap}.layout-panel{position:fixed;right:0;top:0;bottom:0;width:330px;background:#192528;border-left:1px solid #4c6368;z-index:5;padding:24px;overflow:auto;box-shadow:-15px 0 60px #0004}.layout-panel h2{font-size:22px}.layout-panel p{font-size:13px;line-height:1.5;color:var(--muted)}.layout-panel .heading{display:flex;justify-content:space-between;align-items:start}.layout-control{padding:16px 0;border-bottom:1px solid var(--line)}.layout-control>label{display:flex;align-items:center;gap:8px;font-weight:600}.layout-control input[type=checkbox]{accent-color:var(--accent);width:17px;height:17px}.size-control{display:flex;align-items:center;gap:12px;margin-top:12px;color:var(--muted);font-size:12px}.size-control input{min-width:0;width:100%;accent-color:var(--accent)}.size-control output{min-width:44px;text-align:right}.layout-panel .presets{display:flex;gap:6px;flex-wrap:wrap;margin:18px 0}.presets button{font-size:12px;padding:8px}.layout-open header,.layout-open main{margin-right:330px}.layout-panel button.close{padding:5px 9px}.layout-panel small{line-height:1.6;display:block;margin-top:18px}@media(max-width:850px){.layout-open header,.layout-open main{margin-right:0}.layout-panel{width:min(330px,90vw)}.concept{padding:8px 14px}main{padding:14px}.slide .eyebrow,.slide-foot,.slide p{display:none}.toolbar{gap:6px}.toolbar button{padding:8px}.notes{padding:12px}.kbd{display:none}}
.slide-stage{flex:1;min-height:0;display:grid;place-items:center;container-type:size;background:#121c1f;border-radius:10px}.previews .slide-stage .slide{flex:none;width:min(100cqw,calc(100cqh * 16 / 9));height:auto;aspect-ratio:16/9;padding:7%;container-type:inline-size}.slide-stage .slide h1{font-size:clamp(12px,8cqw,64px)}
.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)}
.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>
</head>
<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>
<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>
<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>
<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>
<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>
<div class="presets"><button id="balancedLayout">Balanced</button><button id="focusLayout">Slide focus</button><button id="speakerLayout">Notes first</button></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>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>
</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="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/deckstride/settings.toml</code><br><small>Defaults to ~/.config/deckstride/settings.toml</small><br><code>Windows: %APPDATA%\Beffroi\Deckstride\settings.toml</code><br><code>macOS: ~/Library/Application Support/Beffroi/Deckstride/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>
<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 · Deckstride</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}
</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>
<script>
'use strict';
const $=id=>document.getElementById(id);
const screens=[{id:1,name:'Built-in display',size:'1920 × 1200'},{id:2,name:'Dell U2720Q',size:'3840 × 2160'},{id:3,name:'Epson projector',size:'1920 × 1080'},{id:4,name:'Side monitor',size:'2560 × 1440'}];
const titles=['Making room for ideas.','Keep the focus.','A shared perspective.','Less friction.','Space to think.','One clear message.','From idea to action.','Make it tangible.','Keep moving.','A wider view.','What comes next?','Thank you.'];
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;
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},chrome:{header:true,footer:true}};
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 layoutStorageKey='deckstride.menu-layouts.v1';
let projectId='ideas';
const emptyLayouts=()=>({version:1,global:null,projects:{}});
function validateLayout(value){
if(!value||typeof value!=='object')throw Error('Invalid layout');
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};}
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(){
const raw=localStorage.getItem(layoutStorageKey);if(raw===null)return emptyLayouts();
if(raw.length>20000)throw Error('Layout settings too large');
const data=JSON.parse(raw);if(data?.version!==1||!data.projects||typeof data.projects!=='object'||Array.isArray(data.projects))throw Error('Unsupported layout settings');
const clean=emptyLayouts();if(data.global!==null)clean.global=validateLayout(data.global);
for(const id of ['ideas','workshop'])if(Object.hasOwn(data.projects,id))clean.projects[id]=validateLayout(data.projects[id]);
return clean;
}
function layoutStatus(text){$('layoutSaveStatus').textContent=text;}
function restoreLayout(){
try{const saved=readLayouts();layout=structuredClone(saved.projects[projectId]||saved.global||layoutDefaults);applyLayout();layoutStatus(saved.projects[projectId]?'Loaded this project’s saved layout.':saved.global?'Using the saved all-projects default.':'Using the built-in layout.');}
catch{layout=structuredClone(layoutDefaults);applyLayout();layoutStatus('Saved layouts could not be read. Using the built-in layout; stored settings were not changed.');}
}
function saveLayout(scope){
try{const saved=readLayouts();if(scope==='project')saved.projects[projectId]=validateLayout(layout);else saved.global=validateLayout(layout);localStorage.setItem(layoutStorageKey,JSON.stringify(saved));layoutStatus(scope==='project'?'Saved for this project.':saved.projects[projectId]?'Default saved for all projects. This project still has its own saved layout; use the default below to replace it.':'Saved as the default for all projects. Existing project overrides are preserved.');}
catch{layoutStatus('Could not save layout. Browser storage may be unavailable or saved settings invalid. Your current layout is still usable.');}
}
$('saveProjectLayout').onclick=()=>saveLayout('project');$('saveGlobalLayout').onclick=()=>saveLayout('global');
$('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.');};
const widgets={previous:'previousPreview',current:'currentPreview',next:'nextPreview',notes:'notesWidget',elapsed:'elapsedWidget',clock:'clockWidget'};
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(){
resetChromePeek();
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':'');}
const noPreviews=!['previous','current','next'].some(k=>layout[k].show);$('previews').hidden=noPreviews;document.querySelector('main').classList.toggle('no-previews',noPreviews);
$('previews').style.gridTemplateColumns=['previous','current','next'].filter(k=>layout[k].show).map(k=>`minmax(0, ${layout[k].size}fr)`).join(' ');
$('notesWidget').style.flexBasis=layout.notes.size+'%';$('timer').style.fontSize=layout.elapsed.size+'px';$('wallClock').style.fontSize=layout.clock.size+'px';availableHeight();fitNotes();
}
function setLayoutOpen(open){$('layoutPanel').hidden=!open;document.body.classList.toggle('layout-open',open);$('layoutButton').setAttribute('aria-expanded',String(open));availableHeight();fitNotes();}
function openLayout(){closeMenu();setLayoutOpen(true);$('closeLayout').focus();}
for(const [key,label,min,max,unit] of layoutSpecs){const row=document.createElement('div');row.className='layout-control';row.innerHTML=`<label><input id="show-${key}" type="checkbox" checked>${label}</label><div class="size-control"><label for="size-${key}">Size</label><input id="size-${key}" type="range" min="${min}" max="${max}" value="${layout[key].size}" aria-label="${label} size"><output id="value-${key}" for="size-${key}"></output></div>`;$('layoutControls').append(row);$('show-'+key).onchange=()=>{layout[key].show=$('show-'+key).checked;applyLayout();};$('size-'+key).oninput=()=>{layout[key].size=Number($('size-'+key).value);applyLayout();};}
$('layoutButton').onclick=()=>{closeMenu();setLayoutOpen($('layoutPanel').hidden);};$('notesLayout').onclick=openLayout;$('closeLayout').onclick=()=>{setLayoutOpen(false);$('layoutButton').focus();};
$('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();};
$('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);
function closeMenu(){$('menu').hidden=true;$('menuButton').setAttribute('aria-expanded','false');}
$('menuButton').onclick=()=>{const open=$('menu').hidden;$('menu').hidden=!open;$('menuButton').setAttribute('aria-expanded',String(open));};
function fitNotes(){const box=$('noteBox'),text=$('noteText');if(!box.clientWidth||!box.clientHeight)return;let lo=.1,hi=48;for(let i=0;i<15;i++){const mid=(lo+hi)/2;text.style.fontSize=mid+'px';if(text.scrollHeight<=box.clientHeight&&text.scrollWidth<=box.clientWidth)lo=mid;else hi=mid;}text.style.fontSize=lo+'px';}
const shortNotes=['Welcome everyone. Give the room a moment to settle.\n\nIntroduce the idea: fewer distractions, more room for the message.','Keep attention on the main point. Let the slide support the story, rather than competing with it.'];
function render(){ $('previousTitle').textContent=titles[page-1]||'Start of presentation';$('previousCount').textContent=page>0?`${page} / 12`:''; $('currentTitle').textContent=titles[page];$('nextTitle').textContent=titles[page+1]||'End of presentation';$('currentCount').textContent=`${page+1} / 12`;$('nextCount').textContent=page<11?`${page+2} / 12`:'';$('previous').disabled=page===0;$('next').disabled=page===11;
$('noteText').textContent=long?Array.from({length:8},(_,i)=>`${i+1}. ${shortNotes[(page+i)%2]} Discuss the practical example, pause for questions, and connect this point to the next slide.`).join('\n\n'):shortNotes[page%2];
$('outputBadge').textContent=!active.presentation.length?'PRESENTATION SUSPENDED':blank?'PRESENTATION BLANKED':'PRESENTATION VISIBLE';$('blankButton').textContent=blank?'Show presentation':'Blank presentation';$('blankButton').disabled=!active.presentation.length;$('destination').textContent=active.presentation.length?`Screens ${active.presentation.join(', ')}`:'No screen · rehearsal only';$('displayButton').textContent=`Displays · ${active.presenter} → ${active.presentation.join(', ')||'—'}`;$('routeStatus').textContent=`Presenter ${active.presenter} · Presentation ${active.presentation.join(', ')||'suspended'}`;fitNotes();syncGallery();}
function move(delta){page=Math.max(0,Math.min(11,page+delta));render();}
$('previous').onclick=()=>move(-1);$('next').onclick=()=>move(1);$('blankButton').onclick=()=>{blank=!blank;render();};$('longNotes').onclick=()=>{long=!long;$('longNotes').textContent=long?'Use short notes':'Try long notes';render();};new ResizeObserver(fitNotes).observe($('noteBox'));
function drawMap(){
$('screenMap').replaceChildren();$('screenRoles').replaceChildren();
for(const screen of screens.slice(0,count)){
const role=draft.presenter.includes(screen.id)?'Presenter':draft.presentation.includes(screen.id)?'Presentation':'Unused';
const el=document.createElement('div');el.className='monitor '+role.toLowerCase();el.innerHTML=`<div class="monitor-face"><b>${screen.id}</b><small>${role}</small></div><div class="monitor-name">${screen.name}<br>${screen.size}</div>`;$('screenMap').append(el);
const row=document.createElement('label');row.className='screen-role';row.textContent=`${screen.id} · ${screen.name}`;const select=document.createElement('select');select.id='screenRole'+screen.id;select.setAttribute('aria-label',`Screen ${screen.id} role`);for(const name of ['Unused','Presenter','Presentation'])select.add(new Option(name,name.toLowerCase()));select.value=role.toLowerCase();select.onchange=()=>{for(const key of ['presenter','presentation'])draft[key]=draft[key].filter(id=>id!==screen.id);if(select.value!=='unused')draft[select.value].push(screen.id);drawMap();};row.append(select);$('screenRoles').append(row);
}
$('swap').disabled=!draft.presentation.length;$('apply').disabled=!draft.presenter.length;
$('displayNotice').textContent=!draft.presenter.length?'Choose at least one presenter screen before applying.':'Assign the same role to several screens to mirror it. Each screen has one role. Presentation may be off for rehearsal.';
}
function openDisplays(){closeMenu();draft=structuredClone(active);$('presenterFull').checked=draft.presenterFull;$('presentationFull').checked=draft.presentationFull;drawMap();if(!$('displayDialog').open)$('displayDialog').showModal();}
$('displayButton').onclick=openDisplays;$('menuDisplays').onclick=openDisplays;
$('swap').onclick=()=>{[draft.presenter,draft.presentation]=[draft.presentation,draft.presenter];drawMap();};
$('identify').onclick=()=>{$('screenMap').classList.add('identify');$('displayNotice').textContent='Native app: briefly overlay these numbers on the physical screens. Here: simulated labels only.';setTimeout(()=>$('screenMap').classList.remove('identify'),1800);};
$('apply').onclick=()=>{if(!draft.presenter.length)return;draft.presenterFull=$('presenterFull').checked;draft.presentationFull=$('presentationFull').checked;active=structuredClone(draft);if($('remember').checked)preferred=structuredClone(active);$('displayDialog').close();render();message('Screen groups applied'+($('remember').checked?' and remembered for this demo session.':'.'));};
$('topology').onchange=()=>{count=Number($('topology').value);const available=id=>id>0&&id<=count;const p=preferred.presenter.filter(available);if(!p.length)p.push(1);let output=preferred.presentation.filter(id=>available(id)&&!p.includes(id));if(!output.length&&preferred.presentation.length){const spare=screens.slice(0,count).find(s=>!p.includes(s.id));if(spare)output=[spare.id];}active={...preferred,presenter:p,presentation:output};blank=true;render();message('Simulated display change: presentation blanked. Surviving screen assignments retained; preferred setup unchanged.');if($('displayDialog').open)openDisplays();};
let galleryWindow=null;
const gallery={selected:0,size:220,changeOnClick:false,monitor:'presenter'};
function galleryTarget(){const id=Number(gallery.monitor);return id>0&&id<=count?id:active.presenter[0];}
function syncGallery(){
if(!galleryWindow||galleryWindow.closed)return;const doc=galleryWindow.document;
if(!doc.getElementById('galleryGrid'))return;
doc.querySelectorAll('.thumbnail').forEach((el,index)=>{el.classList.toggle('selected',index===gallery.selected);el.classList.toggle('live',index===page);el.setAttribute('aria-pressed',String(index===gallery.selected));el.querySelector('.live-tag').textContent=index===page?(blank?'CURRENT · BLANKED':'CURRENT'):'';});
doc.getElementById('galleryStatus').textContent=`Selected ${gallery.selected+1} · Current ${page+1} / ${titles.length} · ${gallery.changeOnClick?'Click changes presentation':'Browse safely — click only selects'}`;
const monitor=doc.getElementById('galleryMonitor');monitor.replaceChildren(new Option(`Presenter screen (${active.presenter[0]})`,'presenter'));for(const screen of screens.slice(0,count))monitor.add(new Option(`${screen.id} — ${screen.name}`,String(screen.id)));if(gallery.monitor!=='presenter'&&Number(gallery.monitor)>count)monitor.add(new Option(`${gallery.monitor} — disconnected (using presenter)`,gallery.monitor));monitor.value=gallery.monitor;
doc.getElementById('placementHint').textContent=`Windowed · Requested screen ${galleryTarget()}. HTML cannot route this window to the simulated monitors; drag it to position. Native placement will follow this choice.`;
}
function selectThumbnail(index){gallery.selected=index;if(gallery.changeOnClick)goToSlide(index+1);else syncGallery();}
function openGallery(){
closeMenu();if(galleryWindow&&!galleryWindow.closed){galleryWindow.focus();return;}
gallery.selected=page;gallery.changeOnClick=false;
galleryWindow=window.open('','deckstride-slide-browser',`popup=yes,width=1000,height=700,left=${window.screenX+60},top=${window.screenY+60}`);
if(!galleryWindow){message('Slide browser was blocked. Allow popups for this page, then click All slides again.');return;}
const doc=galleryWindow.document;doc.open();doc.write($('galleryTemplate').innerHTML);doc.close();
const grid=doc.getElementById('galleryGrid');grid.style.setProperty('--thumb',gallery.size+'px');
titles.forEach((title,index)=>{const button=doc.createElement('button');button.className='thumbnail';button.setAttribute('aria-label',`Slide ${index+1}: ${title}`);const art=doc.createElement('div');art.className='thumb-art';art.textContent=title;const caption=doc.createElement('div');caption.className='thumb-caption';caption.innerHTML=`<span>${index+1}</span><span class="live-tag"></span>`;button.append(art,caption);button.onclick=()=>selectThumbnail(index);grid.append(button);});
doc.getElementById('thumbnailSize').value=gallery.size;doc.getElementById('thumbnailSize').oninput=e=>{gallery.size=Number(e.target.value);grid.style.setProperty('--thumb',gallery.size+'px');};
doc.getElementById('changeOnClick').onchange=e=>{gallery.changeOnClick=e.target.checked;syncGallery();};
doc.getElementById('galleryMonitor').onchange=e=>{gallery.monitor=e.target.value;syncGallery();};
doc.getElementById('showSelected').onclick=()=>goToSlide(gallery.selected+1);doc.getElementById('closeGallery').onclick=()=>galleryWindow.close();
doc.addEventListener('keydown',e=>{if(handleNumberJump(e,doc))return;if(e.key==='Escape')galleryWindow.close();});
doc.addEventListener('focusin',e=>{if(e.target.matches('input,select,textarea'))clearJump(doc);});syncGallery();galleryWindow.focus();
}
$('slidesButton').onclick=openGallery;
window.addEventListener('pagehide',()=>{if(galleryWindow&&!galleryWindow.closed)galleryWindow.close();});
const numberJumps=new WeakMap();
function clearJump(doc){numberJumps.delete(doc);const indicator=doc.getElementById('jumpIndicator');if(indicator)indicator.hidden=true;}
function goToSlide(number){if(!Number.isInteger(number)||number<1||number>titles.length)return false;page=number-1;render();return true;}
function handleNumberJump(e,doc){
if(e.ctrlKey||e.metaKey||e.altKey||e.isComposing||e.target.isContentEditable||e.target.closest('input,select,textarea'))return false;
let digits=numberJumps.get(doc)||'';
if(/^\d$/.test(e.key)){e.preventDefault();digits=(digits+e.key).slice(0,6);numberJumps.set(doc,digits);}
else if(e.key==='Backspace'&&digits){e.preventDefault();digits=digits.slice(0,-1);if(!digits){clearJump(doc);return true;}numberJumps.set(doc,digits);}
else if(e.key==='Escape'&&digits){e.preventDefault();clearJump(doc);return true;}
else if(e.key==='Enter'&&digits){e.preventDefault();if(goToSlide(Number(digits)))clearJump(doc);else{const indicator=doc.getElementById('jumpIndicator');indicator.hidden=false;indicator.textContent=`Choose a slide from 1 to ${titles.length}. Backspace to edit · Esc to cancel.`;}return true;}
else return false;
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);});
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();
</script>
</body></html>