From fd1969eda49b2e6c562439ecea9430ace164e16d Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 24 Jun 2026 18:10:38 -0400 Subject: refactor(theme-studio): tier-1 simplification pass These are behavior-preserving cleanups from the refactor/simplify assessment, all test-verified. I merged syncMockHeight and syncPkgHeight into one syncPaneHeight(tableId, paneId), inlined the two single-use displayHex/displayName closures, dropped a pkgbody guard that buildPkgTable already does, and had paintUI call worstCellHtml instead of rebuilding the covered-contrast cell. I deleted the dead generatorHues "manual" branch (a copy of the fallback) and locateInfoLine (orphaned when I removed the preview info line earlier today). The two nerd-icons loaders now share _load_nerd_icons_artifact, with a sentinel so a null-file edge keeps its exact behavior. face_coverage.classify reads through named locals now, guarded by a new characterization test. Two assessment findings were wrong and skipped after I checked them against the code: LOCATE_REG is live (read by previewSpan), and normalizePaletteEntryCore doesn't exist. --- scripts/theme-studio/test-locate.mjs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'scripts/theme-studio/test-locate.mjs') diff --git a/scripts/theme-studio/test-locate.mjs b/scripts/theme-studio/test-locate.mjs index faac7f916..5e36aa808 100644 --- a/scripts/theme-studio/test-locate.mjs +++ b/scripts/theme-studio/test-locate.mjs @@ -8,7 +8,7 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import { - buildLocateRegistry, locateFaceMeta, formatLocateTitle, previewFaceAttrs, isLocateOnPane, locateInfoLine, + buildLocateRegistry, locateFaceMeta, formatLocateTitle, previewFaceAttrs, isLocateOnPane, } from './app-core.js'; // A constructed model: two package apps that BOTH own a face literally named @@ -142,22 +142,6 @@ test('formatLocateTitle: Error — an unassigned meta reads "unassigned"', () => assert.equal(formatLocateTitle(locateFaceMeta('org-faces', 'ghost', reg)), 'ghost, unassigned'); }); -// --- locateInfoLine: "section > face — value" ------------------------------- - -test('locateInfoLine: Normal — section > face — value (fg only, then fg / bg)', () => { - const reg = buildLocateRegistry(APPS, PKGMAP, UIMAP, MAP); - assert.equal(locateInfoLine(locateFaceMeta('org-faces', 'org-todo', reg)), 'org-faces > org-todo — #cc3333'); - const pkgmap = { app: { face: { fg: '#aabbcc', bg: '#223344', inherit: null, source: 'user' } } }; - const apps = { app: { label: 'App', faces: [['face', 'F', {}]] } }; - const reg2 = buildLocateRegistry(apps, pkgmap, {}, MAP); - assert.equal(locateInfoLine(locateFaceMeta('app', 'face', reg2)), 'App > face — #aabbcc / #223344'); -}); - -test('locateInfoLine: Error — an unassigned meta reads " — unassigned"', () => { - const reg = buildLocateRegistry(APPS, PKGMAP, UIMAP, MAP); - assert.equal(locateInfoLine(locateFaceMeta('org-faces', 'ghost', reg)), 'ghost — unassigned'); -}); - // --- previewFaceAttrs: owner-aware validation ------------------------------- test('previewFaceAttrs: Normal — a known owner/face validates; a bad owner is rejected', () => { -- cgit v1.2.3