diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-24 19:17:23 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-24 19:17:23 -0400 |
| commit | 9f2d432f506dd36bed503bfe684b116e07681141 (patch) | |
| tree | 1ccee6c143e706a1cb5b44cf8ad4ea6b6e17fb1b /scripts/theme-studio/theme-studio.html | |
| parent | 120e589dd7e81c7203a5d5c050ba4b5089f553a6 (diff) | |
| download | dotemacs-9f2d432f506dd36bed503bfe684b116e07681141.tar.gz dotemacs-9f2d432f506dd36bed503bfe684b116e07681141.zip | |
refactor(theme-studio): extract control factories to controls.js, drop dead previewFaceAttrs
I split the custom dropdown, detail-editor, and expander factories out of app.js into controls.js (205 lines), spliced back at a CONTROLS_J token by generate.py. The token sits at the exact extraction point, so the assembled page is byte-identical and every gate passes unchanged. app.js drops from 927 to 721 lines.
I also removed previewFaceAttrs (function, export, and test). It was test-only dead code whose docstring stalely claimed the gate calls it. The gate uses assertPreviewFaces instead.
Diffstat (limited to 'scripts/theme-studio/theme-studio.html')
| -rw-r--r-- | scripts/theme-studio/theme-studio.html | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/scripts/theme-studio/theme-studio.html b/scripts/theme-studio/theme-studio.html index c35be0a48..a9fe41db0 100644 --- a/scripts/theme-studio/theme-studio.html +++ b/scripts/theme-studio/theme-studio.html @@ -1209,15 +1209,6 @@ function locateFaceMeta(owner,face,registry){ return e||{owner,face,unassigned:true}; } -// The owner-aware membership check the preview gate calls: the entry's attributes -// when (owner, face) is a known face of that owner, null when it isn't (a bad -// owner is rejected). A known face with no non-default attributes returns {} -- -// still truthy, so membership reads cleanly off the result. -function previewFaceAttrs(owner,face,registry){ - const e=registry&®istry[locateKey(owner,face)]; - return e?e.attrs:null; -} - // Clickable predicate: an element is on-pane only when its owner is the pane being // viewed. Recomputed from the current view at render time (never stored in the // registry), since switching panes changes clickability but not ownership. @@ -1728,6 +1719,10 @@ function renderCode(){ cp.onclick=(e)=>{const s=e.target.closest('[data-k]');if(s)flashAssign(s.dataset.k);}; buildMockFrame(); } +// controls.js -- the custom dropdown / detail-editor / expander control +// factories, extracted from app.js for navigability. Inlined raw at the +// CONTROLS_J token: these are hoisting function declarations plus the +// dropdown popup state, so the token's position preserves execution order. // Custom color dropdown: a real swatch + name + hex per row, since native // <option> background colors render unreliably on Linux Chrome. The popup is // fixed-positioned on <body> so a table's overflow can't clip it. @@ -1933,6 +1928,7 @@ function mkExpander(face,colspan,onChange,opts={}){ setGlyph();syncExpandAllBtns();}; refreshNd();setGlyph(); return {btn,detail,locks};} + // Expand/collapse every row in a table at once, then sync the per-row triangles. function setAllExpanded(tableId,expand){ const tb=document.getElementById(tableId);if(!tb)return; |
