@ -186,6 +186,43 @@ interface ActiveEidosSpaceScaleSpec {
readonly options : ApplySpacingOptions ;
}
/ * *
* A whole - system theme seed — one config that composes the five runtime
* builders ( color · type · depth · shape · space ) . Every axis is optional ;
* { @link ActiveEidos . applyTheme } sets the axes you provide and reverts the
* ones you omit to the authored foundation ( atomic whole - theme semantics ) .
* For surgical per - axis tweaks use the individual ` apply{Color,Type,…} ` methods .
* /
export interface ThemeSeed {
/** Brand color seed → whole color scheme (see {@link ActiveEidos.applyColorScheme}). */
readonly color? : string | Oklch ;
/** Modular type-scale seed → `--font-size-*` ladder. */
readonly type ? : TypeScaleSeed ;
/** Per-plane depth cue overrides → `--depth-{plane}-*`. */
readonly depth? : DepthOverrides ;
/** Shape channel seed (smoothing / nestGap / families) → `--shape-*`. */
readonly shape? : ShapeSeed ;
/** Space scale seed (base unit / growth) → `--space-*`. */
readonly space? : SpaceScaleSeed ;
}
/** Options for {@link ActiveEidos.applyTheme}. */
export interface ApplyThemeOptions {
/** CSS selector every axis targets. @default ':root' */
readonly selector? : string ;
/** Color-axis options (variant / temper / theme / mode / per-role overrides). */
readonly color? : Omit < ApplyColorSchemeOptions , ' selector ' > ;
}
/** The composed result of {@link ActiveEidos.applyTheme} — per-axis introspection. */
export interface ApplyThemeResult {
readonly color? : BuildSchemeResult ;
readonly type ? : BuildTypeScaleResult ;
readonly depth? : BuildDepthResult ;
readonly shape? : BuildShapeResult ;
readonly space? : BuildSpaceScaleResult ;
}
export interface ActiveEidosOptions {
readonly config? : EidosConfig | EidosConfigDocument ;
readonly themeBase? : EidosConfigPatch ;
@ -599,6 +636,62 @@ export class ActiveEidos {
this . apply ( ) ;
}
/ * *
* Apply a whole - system theme from one seed — the capstone of the runtime
* builders . Composes color · type · depth · shape · space in a SINGLE managed
* write ( vs five separate ` apply* ` calls ) , atomically : the axes you provide are
* set , the ones you omit revert to the authored foundation . The "jaula abierta"
* in one call . Returns a per - axis { @link ApplyThemeResult } for introspection .
*
* For surgical per - axis tweaks ( leaving the rest untouched ) use the individual
* ` apply{Color,Type,Depth,Shape,Spacing} ` methods instead .
* /
applyTheme ( seed : ThemeSeed , options : ApplyThemeOptions = { } ) : ApplyThemeResult {
const selector = options . selector ? ? DEFAULT_SCHEME_SELECTOR ;
this . # schemeSpec =
seed . color !== undefined
? { seed : seed.color , options : { . . . options . color , selector } }
: undefined ;
this . # typeScaleSpec =
seed . type !== undefined ? { seed : seed.type , options : { selector } } : undefined ;
this . # depthSpec =
seed . depth !== undefined ? { planes : seed.depth , options : { selector } } : undefined ;
this . # shapeSpec =
seed . shape !== undefined ? { seed : seed.shape , options : { selector } } : undefined ;
this . # spaceScaleSpec =
seed . space !== undefined ? { seed : seed.space , options : { selector } } : undefined ;
this . apply ( ) ;
return {
color : this. # schemeSpec ? this . # buildSchemeResult ( ) : undefined ,
type : seed . type !== undefined ? buildTypeScale ( seed . type ) : undefined ,
depth : seed.depth !== undefined ? buildDepth ( seed . depth ) : undefined ,
shape : seed.shape !== undefined ? buildShape ( seed . shape ) : undefined ,
space : seed.space !== undefined ? buildSpaceScale ( seed . space ) : undefined
} ;
}
/** Remove an applied theme, reverting EVERY axis to the authored foundation. */
clearTheme ( ) : void {
if (
! this . # schemeSpec &&
! this . # typeScaleSpec &&
! this . # depthSpec &&
! this . # shapeSpec &&
! this . # spaceScaleSpec
) {
return ;
}
this . # schemeSpec = undefined ;
this . # typeScaleSpec = undefined ;
this . # depthSpec = undefined ;
this . # shapeSpec = undefined ;
this . # spaceScaleSpec = undefined ;
this . apply ( ) ;
}
# buildSchemeResult ( ) : BuildSchemeResult {
const spec = this . # schemeSpec ;
if ( ! spec ) throw new ActiveEidosConfigError ( 'no color scheme applied' ) ;