diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-16 06:27:08 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-16 06:27:08 -0500 |
| commit | 5551f9e9bccc68dad61edf5d3500cd6149abe05d (patch) | |
| tree | a00537dfc2152777e7822b27604d3bf4ed4d709c /scripts/theme-studio/app.js | |
| parent | 0b640358c287e908753e6dcd32b1583ad45b2ce9 (diff) | |
| download | dotemacs-5551f9e9bccc68dad61edf5d3500cd6149abe05d.tar.gz dotemacs-5551f9e9bccc68dad61edf5d3500cd6149abe05d.zip | |
feat(theme-studio): prev/next arrows to step the view dropdown
I added left and right arrow buttons flanking the view dropdown. They step the selection to the previous or next item and re-render the faces table and preview, so you can walk the list without reopening the dropdown. A pure stepViewIndex helper clamps the index to the option range, no wrap. stepView sets the selection and calls onViewChange.
Diffstat (limited to 'scripts/theme-studio/app.js')
| -rw-r--r-- | scripts/theme-studio/app.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/theme-studio/app.js b/scripts/theme-studio/app.js index 07ca06fe..f2c322aa 100644 --- a/scripts/theme-studio/app.js +++ b/scripts/theme-studio/app.js @@ -528,6 +528,13 @@ function buildViewSel(){const s=document.getElementById('viewsel');if(!s)return; const og=document.createElement('optgroup');og.label='package faces'; for(const app of appViewKeysSorted(APPS))og.appendChild(mk(app,APPS[app].label)); s.appendChild(og);} +// The ‹ › buttons flanking the dropdown step the selection by DIR and re-render +// the view (faces table + preview), so you can walk the list without reopening it. +function stepView(dir){ + const s=document.getElementById('viewsel');if(!s)return; + const i=stepViewIndex(s.selectedIndex,s.options.length,dir); + if(i!==s.selectedIndex){s.selectedIndex=i;onViewChange();} +} function onViewChange(){const s=document.getElementById('viewsel');const v=(s&&s.value)||'@code'; const show=(id,on)=>{const e=document.getElementById(id);if(e)e.style.display=on?'':'none';}; show('view-code',v==='@code');show('view-ui',v==='@ui');show('view-pkg',v[0]!=='@'); |
