') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); refactor(css): consolidate token strata into maka-tokens (Round C) by jackwener · Pull Request #869 · apache/maka · GitHub
Skip to content

refactor(css): consolidate token strata into maka-tokens (Round C) - #869

Merged
jackwener merged 1 commit into
mainfrom
refactor/css-token-consolidation
Jul 13, 2026
Merged

refactor(css): consolidate token strata into maka-tokens (Round C)#869
jackwener merged 1 commit into
mainfrom
refactor/css-token-consolidation

Conversation

@jackwener

Copy link
Copy Markdown
Member

Round C of notes/frontend-simplification-map-2026-07-13.md. Pure reorganization — zero computed-value change.

Problem

Two parallel token systems coexisted (--color-bg-/--color-text- in reference-shell.css/theme-glass.css vs the authoritative --background/--foreground family), so nobody knew which token was authoritative and new code cargo-culted whichever file it saw last.

Change (census-driven, machine-generated consumer counts)

  • reference-shell.css: 16 dead tokens deleted (zero consumers), 3 live color-aliases moved into maka-tokens.css, 4 layout-locals kept with their rules (162→147 lines)
  • theme-glass.css: 2 darwin token overrides relocated to maka-tokens; glass-material rules stay (195→150)
  • maka-tokens.css gains a token-authority README header (authority order + alias policy) and absorbs the aliases/overrides; superseded hue-80 archaeology condensed (1509→1540)
  • All four theme scopes migrated (:root / .dark / darwin light / darwin dark); darwin overrides kept unlayered so cascade specificity is exactly preserved
  • Zero-consumer tokens that are governance-scale members (z-index/control-height/spacing/radius/406) re-pinned, not deleted

Gates

desktop 2397/2397 · ui 125/125 · typecheck · check-dead-css · knip both workspaces 0 · alignment auditor exit 0. CDP before/after light+dark on turn-narrative/module-skills/settings-general/onboarding: 7/8 byte-identical, 1 rasterization-drift confirmed pixel-equivalent. Contracts grepped first and re-pinned (chat-chrome-no-gradient, important-audit, composer-single-source, 406). Implemented by an opus worktree agent; branch based on current main tip so the gated tree is the merge result.

Two parallel token systems coexisted: the --color-bg-*/--color-text-*
family (reference-shell.css + theme-glass.css) vs the authoritative
--background/--foreground family. Nobody knew which was canonical.
Census (machine-generated, var() consumers across all CSS+TSX):
- reference-shell.css: 23 defined -> 16 dead (removed), 3 live color
aliases (--color-bg-container/--color-border-tertiary/
--color-text-quaternary) moved to maka-tokens, 4 live layout-locals
(--agents-layout-bg/--agents-content-area-bg/-gap, --sidebar-width)
kept in-file with their layout rules.
- theme-glass.css: 2 darwin token overrides (--color-bg-container
light+dark, --color-text-quaternary) relocated to maka-tokens; all
glass-material + text/label rules stay.
maka-tokens.css now owns every token definition and carries a
token-authority README (authoritative --background family vs
compatibility --color-* aliases + alias policy). Both themes migrated
(:root + .dark + darwin light/dark). Superseded hue-80 archaeology
condensed (it named the deleted tokens).
Pure reorganization: no computed value changed. The shipped
`--color-bg-container: var(--background)` exception kept as-is.
maka-tokens internal zero-consumer tokens are governance-contract scale
members (z-index/control-height/spacing/radius/406) and were re-pinned,
not deleted.
Gates: desktop 2397/2397, ui 125/125, typecheck 0, check-dead-css
clean, knip desktop+ui 0, auditor exit 0. CDP light+dark captures
(turn-narrative/module-skills/settings-general/first-run) before/after:
7/8 byte-identical, 1 rasterization-drift-only (eyeball identical).
@jackwener
jackwener merged commit 56d6ee4 into mainJul 13, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the refactor/css-token-consolidation branch July 14, 2026 05:05
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jackwener