Reads the live MJ theme (--mj-* custom properties on the document root) and
layers it over SetupStyles(), producing a ComponentStyles that follows the
host's active theme — including dark mode and interactive-state (hover/active/
focus) families — instead of the frozen default palette. This is the Phase 1
theme bridge that gives generated components shell↔content cohesion.
DOM-guarded: in non-DOM environments (Node test harness, SSR) there is no
computed theme to read, so it returns SetupStyles() unchanged. Any individual
token that is absent falls back to its SetupStyles() default, so a page
without MJ tokens loaded also degrades cleanly.
Parameters
Optionalroot: Element
optional element to read tokens from (defaults to document root).
Reads the live MJ theme (
--mj-*custom properties on the document root) and layers it overSetupStyles(), producing aComponentStylesthat follows the host's active theme — including dark mode and interactive-state (hover/active/ focus) families — instead of the frozen default palette. This is the Phase 1 theme bridge that gives generated components shell↔content cohesion.DOM-guarded: in non-DOM environments (Node test harness, SSR) there is no computed theme to read, so it returns
SetupStyles()unchanged. Any individual token that is absent falls back to itsSetupStyles()default, so a page without MJ tokens loaded also degrades cleanly.