refract v0.1 · beta
Reference / Types

Types

refract ships full TypeScript types — your editor is the authoritative, always-current shape. This page is the map: the public types you'll actually name, grouped by role, each pointing at where its shape is documented. (Import them from @theme-registry/refract.)

Authoring

TypeWhat it isDocumented
RawThemeThe object you author — one optional key per subsystem.RawTheme anatomy
ColorsRaw · TypographyRaw · EffectsRaw · BordersRaw · AnimationRaw · LayoutRaw · ComponentsRawThe authored slice type for each subsystem.the subsystem pages
ExtendedPropertyThe { base, variants, responsive, modes } long form of a property.RawTheme anatomy
ColorInputA colour value — a hex string, an [r, g, b] tuple, or any resolvable CSS colour (oklch()/hsl()/rgb()/keyword).Colors

Theme & Model

TypeWhat it isDocumented
ThemeWhat createTheme returns — model, tokens, resolveToken, override, plus the adapter's surface.createTheme & the Theme
CreateThemeOptions{ adapter, media?, units?, baseFontSize? } — the second argument to createTheme.createTheme & the Theme
ThemeModelThe format-neutral held state — the single source of truth.createTheme & the Theme
RefA token leaf — { ref?, fn?, arg?, value? }; carries derivations.RawTheme anatomy
LiteralA resolved value — string | number.createTheme & the Theme
MediaConfig{ unit?, baseFontSize? } — units for query thresholds.createTheme & the Theme
UnitsConfig{ default?, "<subsystem>"?, "<subsystem>.<property>"? } — length units for declaration values (§21); the build-time twin lives on defineConfig.Length units

Adapter contract

TypeWhat it isDocumented
ThemeAdapterThe full adapter createTheme consumes.Writing an adapter
AdapterSpecWhat an adapter author writes — identity + bind.Writing an adapter
BoundSpecThe render surface bind returns — the four primitives + optional hooks.Writing an adapter
RenderContextThe bind context — { media, containers, resolve }.Writing an adapter

Adapter options

TypeWhat it isDocumented
CssAdapterOptionsOptions for createCssAdapter.CSS adapter
ScssAdapterOptionsOptions for createScssAdapter.SCSS adapter
JsonAdapterOptionsOptions for createJsonAdapter.JSON adapter
StyledComponentsAdapterOptionsOptions for createStyledComponentsAdapter.styled-components adapter

Build-time

TypeWhat it isDocumented
ThemeConfigThe defineConfig({ raw, targets }) shape.Build-time
EmitTargetOne output target — { adapter, outDir, emit?, guide? }.Build-time
EmitThe emit-mode directive — single / split / subsystem / components.Build-time
GuideConfigTunes the self-documenting llms.txt/manifest.json{ packageName?, llmsFile?, manifestFile? }.Self-documenting output
PreviewConfigTunes the human-facing preview.html{ file?, title?, inline? }.Human-facing preview

Tooling & errors

TypeWhat it isDocumented
RefractErrorEvery authoring/build error — carries a stable code (RefractErrorCode) and, for the aggregate, a failures list.Errors
AuditResult · AuditOptions · PairingScore · WcagLevelThe contrast-audit surface returned by audit(theme).Contrast audit
RefractDTCGExtensionThe recipe round-trip payload under the com.theme-registry.refract DTCG extension.DTCG interop
This is the surface you name directly. The package exports more (Model internals, the DTCG interop types, JSON-doc shapes) — all typed, all reachable from your editor's autocomplete on @theme-registry/refract. Shapes live in the .d.ts, so they can't drift from the code the way a hand-copied table would.
Technical documentation for @theme-registry/refract · all output is compiled client-side by the real library (CSS adapter). The chrome is theme-aware; the render panes carry each preset's own world. · MIT licensed.