(themeDefinition: ThemeDefinition)
| 205 | } |
| 206 | |
| 207 | export function compileTheme(themeDefinition: ThemeDefinition): Theme { |
| 208 | const validated = validateTheme(themeDefinition); |
| 209 | const cached = compiledThemeCache.get(validated); |
| 210 | if (cached) return cached; |
| 211 | |
| 212 | const compiled = Object.freeze({ |
| 213 | definition: validated, |
| 214 | colors: buildColorIndex(validated), |
| 215 | spacing: buildSpacing(validated.spacing), |
| 216 | focusIndicator: Object.freeze({ ...validated.focusIndicator }) as FocusIndicatorTokens, |
| 217 | }); |
| 218 | compiledThemeCache.set(validated, compiled); |
| 219 | return compiled; |
| 220 | } |
| 221 | |
| 222 | export function blendTheme(from: Theme, to: Theme, t: number): Theme { |
| 223 | const clampedT = Math.max(0, Math.min(1, t)); |
no test coverage detected