From e110f7afac89322a2af4f3c4ebafe303be044cc2 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 18 Jun 2026 22:06:53 -0500 Subject: refactor(theme-studio): cut the face model over to weight/slant/objects I replaced the legacy bold/italic/underline/strike booleans with the final model shape across both sides of the tool. weight (light/normal/medium/semibold/bold/heavy) and slant (normal/italic/oblique) replace the bold/italic flags, underline becomes {style: line|wave, color}, strike becomes {color}, and null means unset. A single migration converts a legacy face on the way in, mirrored as migrateLegacyFace in app-core.js and migrate_legacy in face_specs.py so the JS and Python models can't drift. It runs on import (applyImported, mergePackagesInto) and on every seed that face_spec touches. The captured-snapshot seed (default_faces.seed) narrows the same way it did before. Only bold and italic survive, as weight "bold" and slant "italic", so the generated themes stay byte-identical. The B/I/U/S toggle buttons keep working through a transitional bridge (legacyStyleOn / toggleLegacyStyle). The weight/slant dropdowns and underline/strike controls that replace them land next. The live previews read the new shape, with a weight name mapped to a numeric CSS font-weight. The cutover is proven emit-neutral two ways. An ERT test asserts the migrated shapes emit the same attributes as the legacy booleans, and deep-migrating every face in dupre, distinguished, sterling, now, theme, and WIP then running build-theme yields byte-identical output. Full suite green: Python 59, Node 200, ERT 41, plus the browser hash gates. --- scripts/theme-studio/default_faces.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'scripts/theme-studio/default_faces.py') diff --git a/scripts/theme-studio/default_faces.py b/scripts/theme-studio/default_faces.py index ce2bf3196..c8f7167d1 100644 --- a/scripts/theme-studio/default_faces.py +++ b/scripts/theme-studio/default_faces.py @@ -44,14 +44,19 @@ class DefaultFaces: out["fg"] = fg if bg: out["bg"] = bg + # Representation-only cutover: the snapshot's bold/italic become the new + # weight/slant shape, and underline/strike become objects. The same + # narrowing as before (only "bold"/"italic" survive; richer weights and + # underline colors wait for the snapshot refresh), so the emitted theme + # is byte-identical. if data.get("weight") == "bold": - out["bold"] = True + out["weight"] = "bold" if data.get("slant") == "italic": - out["italic"] = True + out["slant"] = "italic" if data.get("underline"): - out["underline"] = True + out["underline"] = {"style": "line", "color": None} if data.get("strike"): - out["strike"] = True + out["strike"] = {"color": None} if data.get("inherit"): out["inherit"] = data.get("inherit") if data.get("height") and data.get("height") != 1: -- cgit v1.2.3