aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/theme-studio.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-19 10:33:30 -0400
committerCraig Jennings <c@cjennings.net>2026-06-19 10:33:30 -0400
commitb7118f4f2389d62a9bae0eb1a78549f585e37658 (patch)
treeace9736001d71650a809e7dda3ceb7944693d63e /scripts/theme-studio/theme-studio.html
parentf8c00d70eea934875cdb5729e4bd671d9c687310 (diff)
downloaddotemacs-b7118f4f2389d62a9bae0eb1a78549f585e37658.tar.gz
dotemacs-b7118f4f2389d62a9bae0eb1a78549f585e37658.zip
refactor(theme-studio): extract per-package previews into previews.js
The ~28 renderXxxPreview functions plus ofs/os/previewLines were ~460 lines of bespoke sample content sitting in the middle of the controller. I moved them to a new previews.js, spliced into the page through a PREVIEWS_J token the same way the other inlined libs are, and left the PACKAGE_PREVIEWS registry and dispatcher in app.js. app.js drops from 1233 to 759 lines, and the sample data now lives apart from the table/control machinery.
Diffstat (limited to 'scripts/theme-studio/theme-studio.html')
-rw-r--r--scripts/theme-studio/theme-studio.html7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/theme-studio/theme-studio.html b/scripts/theme-studio/theme-studio.html
index 63869d36..23346800 100644
--- a/scripts/theme-studio/theme-studio.html
+++ b/scripts/theme-studio/theme-studio.html
@@ -2377,6 +2377,12 @@ function buildPkgTable(){
applyTableSort('pkgbody');
updateLockToggle('pkg');
}
+// The per-package preview renderers live in previews.js, spliced here so the
+// PACKAGE_PREVIEWS registry below can reference them.
+// previews.js -- the bespoke per-package preview renderers, extracted from
+// app.js. Pure preview HTML builders (ofs/os/previewLines + renderXxxPreview);
+// they reference shared globals (PKGMAP, MAP, faceCss, effFg, ...) and are
+// inlined into the page's single script element via the PREVIEWS_J token in app.js.
function ofs(app,face){const f=PKGMAP[app][face]||{},fg=effFg(pkgEffFg(app,face)),bg=pkgEffBg(app,face);return faceCss(f,fg,bg,{fontSize:(f.height||1),boxBg:bg||MAP['bg']});}
function os(app,face,txt){return `<span data-face="${face}" style="${ofs(app,face)}">${txt}</span>`;}
// Shared wrapper for the line-based package previews: a monospace pre block.
@@ -2836,6 +2842,7 @@ function renderMarkdownPreview(){const a='markdown-mode',L=[];
L.push(os(a,'markdown-html-tag-delimiter-face','&lt;')+os(a,'markdown-html-tag-name-face','kbd')+os(a,'markdown-html-tag-delimiter-face','&gt;')+'Ctrl-C'+os(a,'markdown-html-tag-delimiter-face','&lt;/')+os(a,'markdown-html-tag-name-face','kbd')+os(a,'markdown-html-tag-delimiter-face','&gt;'));
L.push(os(a,'markdown-footnote-marker-face','[^1]:')+' '+os(a,'markdown-footnote-text-face','the footnote text.'));
return previewLines(L);}
+
const PACKAGE_PREVIEWS={
autodim:renderAutodimPreview,markdown:renderMarkdownPreview,
org:renderOrgPreview,magit:renderMagitPreview,elfeed:renderElfeedPreview,ghostel:renderGhostelPreview,