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
commitb7118f4f2389d62a9bae0eb1a78549f585e37658 (patch)
treeace9736001d71650a809e7dda3ceb7944693d63e /scripts/theme-studio/generate.py
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/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 347a2197..3d8eae68 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)