ReferencePackages
@mwillbanks/tuil-theme
Theme tokens, variants, utilities, capabilities, and registries for tuil.
Overview
Theme tokens, variants, utilities, capabilities, and registries for tuil.
@mwillbanks/tuil-theme is independently installable and also participates in the
umbrella @mwillbanks/tuil runtime where applicable.
Installation
npm install @mwillbanks/tuil-themeHow it operates
Themes normalize token sets, component defaults, slots, variants, terminal capabilities, and spacing. Registries resolve named themes while ThemeController provides live observable switching.
API
| API | Signature | Description |
|---|---|---|
ColorScheme | type ColorScheme | Public type ColorScheme. |
compileUtilities | function compileUtilities | Public function compileUtilities. |
ComponentTheme | interface ComponentTheme | Public interface ComponentTheme. |
createDefaultThemeRegistry | function createDefaultThemeRegistry | Public function createDefaultThemeRegistry. |
createTheme | function createTheme | Public function createTheme. |
defaultLightTheme | constant defaultLightTheme | Public constant defaultLightTheme. |
defaultTheme | constant defaultTheme | Public constant defaultTheme. |
normalizeTheme | function normalizeTheme | Public function normalizeTheme. |
resolveComponentProps | function resolveComponentProps | Public function resolveComponentProps. |
resolveSlotProps | function resolveSlotProps | Public function resolveSlotProps. |
SemanticColor | interface SemanticColor | Public interface SemanticColor. |
SlotComponents | type SlotComponents | Public type SlotComponents. |
SlotMap | type SlotMap | Public type SlotMap. |
SlotPropFactory | type SlotPropFactory | Public type SlotPropFactory. |
SlotProps | type SlotProps | Public type SlotProps. |
SlottedComponentProps | interface SlottedComponentProps | Public interface SlottedComponentProps. |
SpacingToken | type SpacingToken | Public type SpacingToken. |
TerminalStyleProps | type TerminalStyleProps | Public type TerminalStyleProps. |
Theme | interface Theme | Public interface Theme. |
ThemeController | class ThemeController | Public class ThemeController. |
ThemeFactory | type ThemeFactory | Public type ThemeFactory. |
ThemeInput | type ThemeInput | Public type ThemeInput. |
ThemeProvider | function ThemeProvider | Public function ThemeProvider. |
ThemeRegistry | class ThemeRegistry | Public class ThemeRegistry. |
ThemeRegistryEntry | interface ThemeRegistryEntry | Public interface ThemeRegistryEntry. |
useTheme | function useTheme | Public function useTheme. |
Events and lifecycle
Theme changes use ThemeController.subscribe() so React consumers remain consistent with useSyncExternalStore.
All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.
Example
import { createDefaultThemeRegistry } from "@mwillbanks/tuil-theme";
const themes = createDefaultThemeRegistry();
app.themeController.set(themes.resolve("default-light"));