aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/generate.py
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
commit2d71dde79e2781316aeda9c6713a3ae2d9bb9452 (patch)
tree01a19697494903b1785c57aa2294274313c9b1e2 /scripts/theme-studio/generate.py
parent1dbf036113a9c123819b13699008c1cdf203bd92 (diff)
downloaddotemacs-2d71dde79e2781316aeda9c6713a3ae2d9bb9452.tar.gz
dotemacs-2d71dde79e2781316aeda9c6713a3ae2d9bb9452.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/generate.py')
-rw-r--r--scripts/theme-studio/generate.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/theme-studio/generate.py b/scripts/theme-studio/generate.py
index 347a21976..3d8eae68d 100644
--- a/scripts/theme-studio/generate.py
+++ b/scripts/theme-studio/generate.py
@@ -37,6 +37,9 @@ COLORMATH_BODY=strip_exports(read_text('colormath.js'))
# (MAP_J, PALETTE_J, COLORMATH_J, ...); those are filled after it is spliced in.
STYLES=read_text('styles.css')
APP_BODY=read_text('app.js')
+# Bespoke per-package preview renderers, spliced into the page <script> via the
+# PREVIEWS_J token in app.js. No imports/exports, so read raw.
+PREVIEWS_BODY=read_text('previews.js')
# Pure package-model + dropdown logic, inlined into the page (and unit-tested via
# test-app-core.mjs) the same way colormath.js is.
APP_CORE_BODY=strip_exports(read_text('app-core.js'))
@@ -290,6 +293,7 @@ HTML=read_text('theme-studio.template.html')
def fill_data(s):
return (s.replace("COLORMATH_J",COLORMATH_BODY)
.replace("APP_CORE_J",APP_CORE_BODY)
+ .replace("PREVIEWS_J",PREVIEWS_BODY)
.replace("APP_UTIL_J",APP_UTIL_BODY)
.replace("PALETTE_GENERATOR_CORE_J",PALETTE_GENERATOR_CORE_BODY)
.replace("PALETTE_GENERATOR_UI_J",PALETTE_GENERATOR_UI_BODY)