index
Defined in: styles/registry.ts:23
Registered style modules for one distillery. Throws on duplicate module names or colliding readable class/var names.
new StyleRegistry(
prefix,
reservedVarOwners?,
sharedVarPaths?
): StyleRegistry;
Defined in: styles/registry.ts:28
| Parameter | Type |
|---|---|
prefix |
string |
reservedVarOwners |
ReadonlyMap<string, string> |
sharedVarPaths |
ReadonlySet<string> |
get classKeys(): readonly string[];
Defined in: styles/registry.ts:111
Handle keys across all modules. Compact-name domain for a full stylesheet.
readonly string[]
get cssVarKeys(): readonly string[];
Defined in: styles/registry.ts:118
Theme and contextual-var keys across all modules.
readonly string[]
get modules(): readonly StylesModule<StylesObject>[];
Defined in: styles/registry.ts:99
Registered modules, sorted by name.
readonly StylesModule<StylesObject>[]
freeze(options?): StyleRegistrySnapshot;
Defined in: styles/registry.ts:132
Frozen class and CSS-var keys for a StyleNameResolver.
| Parameter | Type | Description |
|---|---|---|
options |
{ classKeys?: Iterable<string, any, any>; cssVarKeys?: Iterable<string, any, any>; } |
Overrides the registry-wide key sets when compact-naming a subset. |
options.classKeys? |
Iterable<string, any, any> |
Compact class-name domain override. |
options.cssVarKeys? |
Iterable<string, any, any> |
Compact CSS-var domain override. |
handle(key): StyleHandle | undefined;
Defined in: styles/registry.ts:60
Looks up a registered handle by its key (<module>/<localName>).
| Parameter | Type |
|---|---|
key |
string |
StyleHandle | undefined
module(name):
| StylesModule<StylesObject>
| undefined;
Defined in: styles/registry.ts:106
Looks up a module by the name passed to createStyleModule.
| Parameter | Type |
|---|---|
name |
string |
| StylesModule<StylesObject>
| undefined
registerModule(module): void;
Defined in: styles/registry.ts:39
Adds module to this registry.
| Parameter | Type |
|---|---|
module |
StylesModule |
void
If another module already uses this name, or if a readable class or CSS-variable name collides (including themeVars and sharedVars).
targetsHandle(key): boolean;
Defined in: styles/registry.ts:74
True when some rule, or some inner rule of an @media / @container block, reads key in its selector.
A nested & rule records its owning handle through trackRuleDeps, so a handle with an empty self block but real nested rules is targeted. A rule-less nested block targets nothing.
| Parameter | Type |
|---|---|
key |
string |
boolean
Defined in: collector.ts:103
Reachable entries for one render or one stylesheet.
new StylesCollector(__namedParameters): StylesCollector;
Defined in: collector.ts:125
| Parameter | Type |
|---|---|
__namedParameters |
StylesCollectorOptions |
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
names |
readonly |
StyleNameMode |
The naming mode (compact vs readable). | collector.ts:107 |
prefix |
readonly |
string |
Emitted class name prefix. | collector.ts:111 |
registry |
readonly |
StyleRegistry |
Associated registry. | collector.ts:109 |
target |
readonly |
StyleTarget |
The target collection mode. | collector.ts:105 |
get collectedEntries(): readonly StyleEntry[];
Defined in: collector.ts:384
Collected style entries sorted for emission (base rules before all @media/@container blocks).
readonly StyleEntry[]
get collectedThemeDeps(): ReadonlySet<string>;
Defined in: collector.ts:389
Theme token paths that survive reachability; emitted in the theme scope block.
ReadonlySet<string>
get collectedVarDeps(): ReadonlySet<`vars/${string}`>;
Defined in: collector.ts:394
Contextual var paths that survive reachability; used by the runtime for compact-name substitution.
ReadonlySet<`vars/${string}`>
createResolver(): StyleNameResolver;
Defined in: collector.ts:366
Creates a StyleNameResolver scoped to this collector's current dep set.
reachableDefaults(handle, groupPath): ReadonlySet<string>;
Defined in: collector.ts:404
Returns the variable keys within groupPath that are reachable from handle or from any collected rule targeting it.
| Parameter | Type | Description |
|---|---|---|
handle |
StyleHandle |
Handle whose declaration refs and dependent rules are consulted. |
groupPath |
`vars/${string}` |
Group prefix path (e.g. vars/chip/look). |
ReadonlySet<string>
subscribe(listener): () => void;
Defined in: collector.ts:294
Calls listener after a public mutation adds an entry, handle, theme var, or contextual var.
Fires at most once per outermost call; nested calls such as use([a, b]) batch into it.
| Parameter | Type | Description |
|---|---|---|
listener |
() => void |
Called with no arguments after the collection grows. |
Unsubscribes listener.
() => void
use(value): void;
Defined in: collector.ts:148
Collects a module's non-variant entries, or one explicit entry.
Variant entries stay off this path; collect them via useHandles.
| Parameter | Type | Description |
|---|---|---|
value |
| StyleEntry | readonly StyleEntry[] | StylesModule<StylesObject> |
Module (all non-variant entries), a single entry, or an array of entries. |
void
useAllEntries(module): void;
Defined in: collector.ts:198
Collects every entry on module, including variants. Used by the stylesheet target.
| Parameter | Type | Description |
|---|---|---|
module |
StylesModule |
Module whose entries should all be collected. |
void
useHandles(handles): readonly StyleHandle[];
Defined in: collector.ts:225
Collects handles and auto-includes rules whose selector deps are all present.
Media blocks gain inner rules whose deps are met and keep rules already collected.
| Parameter | Type | Description |
|---|---|---|
handles |
readonly StyleHandleRef[] |
Handles resolved during this render pass (e.g. from resolveClassName). A bare { key } resolves through the registry. |
readonly StyleHandle[]
Handles that were retained. Empty untargeted handles are omitted in compact mode.
If a { key } names no handle registered with this collector's registry.
useRulesWhenDepsMet(module): void;
Defined in: collector.ts:270
Collects auto rules on module whose every selector dependency is already collected.
| Parameter | Type |
|---|---|
module |
StylesModule |
void
useThemeVar(path): void;
Defined in: collector.ts:361
Marks a theme token path as reachable so it appears in the emitted theme block, even if no collected declaration reads it.
| Parameter | Type |
|---|---|
path |
string |
void
Defined in: styles/authoring.ts:195
Anything exposing resolveClassName, e.g. a React render context or a LiveCollection.
| Property | Type | Description | Defined in |
|---|---|---|---|
resolveClassName |
(...handles) => string |
Collects handles and returns their class names, space-separated. |
styles/authoring.ts:197 |
Defined in: tokens/contextual_var.ts:25
Represents a contextual CSS variable. Stringifies to var(--...).
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"contextual-var" |
Brand for isContextualCssVar. | tokens/contextual_var.ts:27 |
name |
readonly |
ContextualCssVarName |
Wrapper yielding just the custom property name. | tokens/contextual_var.ts:31 |
path |
readonly |
`vars/${string}` |
Group/key path for this variable. | tokens/contextual_var.ts:29 |
ref |
readonly |
`var(--${string})` |
Usable CSS var(...) reference string. |
tokens/contextual_var.ts:33 |
toPrimitive: string;
Defined in: tokens/contextual_var.ts:37
Template interpolation; same as ContextualCssVar.toString.
| Parameter | Type |
|---|---|
hint |
string |
string
toString(): string;
Defined in: tokens/contextual_var.ts:35
Stringifies to ContextualCssVar.ref.
string
Defined in: tokens/contextual_var.ts:11
Represents a contextual CSS variable name. Stringifies to its custom property name.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"contextual-var-name" |
Brand for isContextualCssVarName. | tokens/contextual_var.ts:13 |
name |
readonly |
`--${string}` |
Actual emitted CSS custom property name. | tokens/contextual_var.ts:17 |
path |
readonly |
`vars/${string}` |
Group/key path for this variable. | tokens/contextual_var.ts:15 |
toPrimitive: string;
Defined in: tokens/contextual_var.ts:21
Template interpolation; same as ContextualCssVarName.toString.
| Parameter | Type |
|---|---|
hint |
string |
string
toString(): string;
Defined in: tokens/contextual_var.ts:19
Stringifies to ContextualCssVarName.name.
string
Defined in: dom_sink.ts:21
Host document and optional flush scheduler for a <style> sink.
| Property | Type | Description | Defined in |
|---|---|---|---|
document |
DocumentLike |
Document that creates the style element. | dom_sink.ts:23 |
parent? |
StyleParentLike |
Node that receives the style element, e.g. a ShadowRoot. Defaults to document.head. |
dom_sink.ts:25 |
schedule? |
(flush) => void |
Defers the flush. Defaults to queueMicrotask. |
dom_sink.ts:27 |
Defined in: tokens/theme_token.ts:11
Represents a CSS theme token. Stringifies to var(--...).
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"theme-token" |
Brand for isCssToken. | tokens/theme_token.ts:13 |
cssVar |
readonly |
`--${string}` |
Actual emitted CSS custom property name. | tokens/theme_token.ts:17 |
path |
readonly |
string |
Path string mapping to this token in the environment. | tokens/theme_token.ts:15 |
ref |
readonly |
`var(--${string})` |
Usable CSS var(...) reference string. |
tokens/theme_token.ts:19 |
toPrimitive: string;
Defined in: tokens/theme_token.ts:23
Template interpolation; same as CssToken.toString.
| Parameter | Type |
|---|---|
hint |
string |
string
toString(): string;
Defined in: tokens/theme_token.ts:21
Stringifies to CssToken.ref.
string
Defined in: styles/types.ts:101
Authored CSS plus the deps the collector uses for reachability.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
css |
readonly |
readonly DeclarationSegment[] |
Interleaved literal CSS and local variable markers. | styles/types.ts:103 |
deps |
readonly |
StyleDeps |
Reachability tracking dependencies. | styles/types.ts:105 |
Defined in: styles/types.ts:61
One t.vars(...) group's default-emission metadata.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
groupPath |
readonly |
`vars/${string}` |
Target variable namespace group. | styles/types.ts:63 |
keys |
readonly |
readonly DefaultKeyDeps[] |
Defaults registered within this group. | styles/types.ts:65 |
Defined in: styles/types.ts:69
One key inside a DefaultGroupDeps group.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
key |
readonly |
string |
The specific variable key within the group. | styles/types.ts:71 |
path |
readonly |
`vars/${string}` |
Full CSS variable path (e.g. vars/group/key). |
styles/types.ts:73 |
valueDeps |
readonly |
object |
Theme/var paths referenced by the default value. Kept if the key is reachable. | styles/types.ts:75 |
valueDeps.theme |
readonly |
ReadonlySet<string> |
Theme-token paths the default value interpolates. | styles/types.ts:77 |
valueDeps.vars |
readonly |
ReadonlySet<`vars/${string}`> |
Contextual-var paths the default value interpolates. | styles/types.ts:79 |
Defined in: engine.ts:73
One component library's binding: environment, registry, and pre-bound operations. Destructure-safe (no this).
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
artifactCollector |
readonly |
(names, options?) => StylesCollector |
Collector for one render. Class-name resolution collects as a side effect. No-op warnings require dev: true; pass { warn } to capture them. |
engine.ts:107 |
contextualVar |
readonly |
(path) => ContextualCssVar |
Shared contextual var for a path declared in sharedVars, named cssVarName(prefix, path). Throws for an undeclared path. |
engine.ts:95 |
createNameResolver |
readonly |
(options) => StyleNameResolver |
Creates a standalone name resolver using this distillery's prefix. | engine.ts:125 |
createStyleModule |
readonly |
<TStyles>(name, factory) => StylesModule<ResolvedStyles<TStyles>> |
Named handle tree plus tokens. | engine.ts:97 |
dev |
readonly |
boolean |
When true, collectors warn about no-op handles and module authoring warns about contextual-var name drift. |
engine.ts:93 |
environment |
readonly |
DistilleryEnvironment<TTokens> |
Resolved environment (tokens, prefix, derived theme vars). | engine.ts:78 |
liveCollection |
readonly |
(options?) => LiveCollection |
Readable collection for one live render; keeps sink current as handles resolve. |
engine.ts:117 |
owns |
readonly |
(handle) => boolean |
true when handle was authored in a module registered with this distillery, including an Emotion wrapper of one. A bare { key } is checked by key. |
engine.ts:91 |
primitiveStyles |
readonly |
<TStyles>(name, factory) => StylesModule<ResolvedStyles<TStyles>> |
Named handles plus tokens only. | engine.ts:102 |
registry |
readonly |
StyleRegistry |
The module registry accumulating collected handles and rules. | engine.ts:89 |
renderStyles |
readonly |
(collector, resolver?, options?) => string |
Emits collected CSS for this environment. | engine.ts:119 |
resolveValues |
readonly |
(scheme, variation?) => ValuesOf<TTheme> |
Nested literal values for one scheme. Optional variation is a name from variations. |
engine.ts:84 |
stylesheetCollector |
readonly |
(names?, options?) => StylesCollector |
Collector preloaded with every registered module. No-op warnings require dev: true; pass { warn } to capture them. |
engine.ts:112 |
themeVars |
readonly |
Readonly<Record<string, ThemeVarDefinition>> |
Derived theme-var registry, same object as environment.themeVars. |
engine.ts:82 |
tokens |
readonly |
TTokens |
Derived token tree, same object as environment.tokens. |
engine.ts:80 |
Defined in: environment.ts:45
Resolved environment: derived themeVars / tokens plus the bind-time prefix and scope.
| Type Parameter | Default type |
|---|---|
TTokens |
unknown |
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
prefix |
readonly |
string |
Brand identifier used in readable class and CSS-variable names. Must be a CSS identifier segment. | environment.ts:47 |
sharedVars? |
readonly |
ReadonlySet<`vars/${string}`> |
Cross-module contextual-var paths. Module-local vars(...) groups are not listed here. |
environment.ts:53 |
themeScope |
readonly |
string |
Selector wrapping emitted theme-var declarations. | environment.ts:49 |
themeVars |
readonly |
Readonly<Record<string, ThemeVarDefinition>> |
Theme token path → definition. Emission sorts paths. | environment.ts:51 |
tokens |
readonly |
TTokens |
Typed token tree, surfaced as tokens on the authoring API. |
environment.ts:55 |
variations? |
readonly |
Readonly<Record<string, ResolvedThemeVariation>> |
Named variations resolved against themeVars. Absent when no variations were declared. |
environment.ts:57 |
Defined in: environment.ts:27
Authoring input to createDistillery.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
dev? |
readonly |
boolean |
When true, collectors warn about no-op handles and module authoring warns about contextual-var name drift. Default false. Does not affect the single-copy guard. |
environment.ts:39 |
prefix |
readonly |
string |
Brand identifier used in readable class and CSS-variable names. Must be a CSS identifier segment. | environment.ts:29 |
sharedVars? |
readonly |
readonly `vars/${string}`[] |
Cross-module contextual-var paths. Names are cssVarName(prefix, path). Module-local vars(...) groups are not listed here. |
environment.ts:37 |
theme |
readonly |
TTheme |
Nested value tree. Strings and lightDark leaves become theme vars; ScaleToken leaves inline. |
environment.ts:33 |
themeScope |
readonly |
string |
Selector wrapping emitted theme-var declarations. | environment.ts:31 |
variations? |
readonly |
Readonly<Record<string, ThemeVariation<TTheme>>> |
Named partial variations of theme. Declaring a variation does not emit it; name it at renderStyles. |
environment.ts:35 |
warn? |
readonly |
(message) => void |
Sink for dev warnings. Defaults to console.warn. A collector's own { warn } overrides it. |
environment.ts:41 |
Defined in: dom_sink.ts:13
Minimal interface for a DOM Document able to create and append style tags.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
head |
readonly |
StyleParentLike |
Default parent for the created style element. | dom_sink.ts:17 |
createElement(tagName): StyleElementLike;
Defined in: dom_sink.ts:15
Creates a <style> element.
| Parameter | Type |
|---|---|
tagName |
"style" |
Defined in: engine.ts:63
Readable collection filled by one live render.
Readable only: compact names depend on the complete collected set and need two passes.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
collector |
readonly |
StylesCollector |
Underlying readable artifact collector. Mutations here (e.g. use(globalModule), useThemeVar) also invalidate the sink. |
engine.ts:65 |
css |
readonly |
() => string |
Renders the CSS collected so far. | engine.ts:69 |
resolveClassName |
readonly |
(...handles) => string |
Collects handles and returns their readable class names, space-separated. A bare { key } resolves through the registry. |
engine.ts:67 |
Defined in: engine.ts:49
Sink, render options, and warning sink for Distillery.liveCollection.
| Property | Type | Description | Defined in |
|---|---|---|---|
render? |
RenderStylesOptions |
Options forwarded to renderStyles by css(). |
engine.ts:53 |
sink? |
StyleSink |
Invalidated whenever the collection grows. Nothing is written before the first handle. | engine.ts:51 |
warn? |
(message) => void |
Warning sink for no-op handles. Used only when the distillery has dev: true. |
engine.ts:55 |
Defined in: local_vars.ts:54
Interpolation marker representing ${group} defaults.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"local-var-default-marker" |
Brand distinguishing a ${group} default marker. |
local_vars.ts:56 |
defaults |
readonly |
readonly object[] |
Ordered list of variable defaults. | local_vars.ts:62 |
groupId |
readonly |
string |
Unique ID for the group. | local_vars.ts:58 |
groupPath |
readonly |
`vars/${string}` |
Group prefix path. | local_vars.ts:60 |
Defined in: local_vars.ts:35
Interpolation marker representing .set(...) overrides.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"local-var-override-marker" |
Brand distinguishing a .set(...) override marker. |
local_vars.ts:37 |
groupId |
readonly |
string |
Unique ID for the group. | local_vars.ts:39 |
overrides |
readonly |
readonly object[] |
Ordered list of variable overrides. | local_vars.ts:41 |
Defined in: local_vars.ts:19
Reference to a local CSS variable. Stringifies to var(--...).
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"local-var-ref" |
Brand distinguishing a local-var ref from other interpolations. | local_vars.ts:21 |
path |
readonly |
`vars/${string}` |
Canonical group/key path. | local_vars.ts:23 |
propName |
readonly |
`--${string}` |
Actual emitted CSS custom property name. | local_vars.ts:25 |
ref |
readonly |
`var(--${string})` |
Usable CSS var(...) reference string. |
local_vars.ts:27 |
toPrimitive: string;
Defined in: local_vars.ts:31
Template interpolation; same as LocalVarRef.toString.
| Parameter | Type |
|---|---|
hint |
string |
string
toString(): string;
Defined in: local_vars.ts:29
Stringifies to LocalVarRef.ref.
string
Defined in: theme.ts:89
Media-conditioned variation. media is intrinsic; it is not a selector.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
media |
readonly |
string |
Media query wrapping this variation's emitted diffs. | theme.ts:91 |
variation |
readonly |
DeepPartialTheme<T> |
Partial variation of the base theme. | theme.ts:93 |
Defined in: styles/types.ts:280
Narrow t for primitiveStyles: handles and tokens only.
| Type Parameter | Default type |
|---|---|
TTokens |
unknown |
| Property | Type | Description | Defined in |
|---|---|---|---|
style |
(strings, ...values) => PendingStyleHandle |
Creates named style handles using the same template tag as css. |
styles/types.ts:282 |
tokens |
TTokens |
Environment token tree. | styles/types.ts:284 |
Defined in: runtime.ts:75
Per-render variation selection, scheme flatten, alternate blocks, and value overrides.
| Property | Type | Description | Defined in |
|---|---|---|---|
alternates? |
readonly ThemeAlternate[] |
Extra blocks for runtime switching. Each entry emits only the variation's diff. | runtime.ts:85 |
flatten? |
string |
Flatten this declared variation into themeScope. Default is the base. A media variation does not replace the primary block; it wraps its diffs in @media. |
runtime.ts:77 |
scheme? |
"light" | "dark" |
Emit one scheme's literal instead of light-dark(...). For a target with no color scheme to resolve the function against — an image or PDF backend, email HTML, an older browser. |
runtime.ts:83 |
themeValueOverrides? |
Partial<Record<string, string>> |
Override a theme token's emitted value, keyed by path, for values known only at request time. Wins over flatten and scheme. To emit one color scheme, use scheme instead of overriding every lightDark token. |
runtime.ts:87 |
Defined in: theme.ts:101
One named variation resolved against the base at construction.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
diffs |
readonly |
Readonly<Record<string, ThemeVarDefinition>> |
Paths whose serialized value differs from the base. | theme.ts:109 |
media? |
readonly |
string |
Intrinsic media query, when declared. | theme.ts:105 |
name |
readonly |
string |
Name passed in variations. |
theme.ts:103 |
themeVars |
readonly |
Readonly<Record<string, ThemeVarDefinition>> |
Base theme vars with this variation applied. | theme.ts:107 |
Defined in: styles/types.ts:155
Options for rule.
| Property | Type | Description | Defined in |
|---|---|---|---|
auto? |
boolean |
When false, the collector must use this rule explicitly. Defaults to true. |
styles/types.ts:157 |
Defined in: tokens/scale_token.ts:11
Represents a CSS scale size token. Stringifies to its literal value.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"scale-token" |
Brand for isScaleToken. | tokens/scale_token.ts:13 |
cq |
readonly |
string |
Container-query-relative variant of value; equal to value unless given. |
tokens/scale_token.ts:17 |
value |
readonly |
string |
Literal CSS value, inlined into declarations. | tokens/scale_token.ts:15 |
toPrimitive: string;
Defined in: tokens/scale_token.ts:21
Template interpolation; same as ScaleToken.toString.
| Parameter | Type |
|---|---|
hint |
string |
string
toString(): string;
Defined in: tokens/scale_token.ts:19
Stringifies to ScaleToken.value.
string
Defined in: tokens/light_dark.ts:11
Scheme-varying color pair. Compiles to light-dark(light, dark).
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
__kind |
readonly |
"scheme-pair" |
Brand for isSchemePair. | tokens/light_dark.ts:13 |
dark |
readonly |
string |
Dark color-scheme value. Must be a CSS <color>. |
tokens/light_dark.ts:17 |
light |
readonly |
string |
Light color-scheme value. Must be a CSS <color>. |
tokens/light_dark.ts:15 |
Defined in: styles/types.ts:224
Authoring API passed to createStyleModule factories.
| Type Parameter | Default type |
|---|---|
TTokens |
unknown |
| Property | Type | Description | Defined in |
|---|---|---|---|
css |
(strings, ...values) => PendingStyleHandle |
Creates a handle template where nested & and @media flatten into sibling rules. |
styles/types.ts:226 |
decls |
(strings, ...values) => Declarations |
Creates a declaration block template for direct CSS properties. | styles/types.ts:231 |
tokens |
TTokens |
Environment token tree. | styles/types.ts:241 |
vars |
<TKey>(group, defaults) => LocalVarGroup<TKey> |
Module-local CSS variable group. Interpolate ${group}, ${group.key}, or ${group.set({...})}. |
styles/types.ts:236 |
Defined in: styles/types.ts:47
Reachability sets captured while authoring a declaration block.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
defaults |
readonly |
readonly DefaultGroupDeps[] |
t.vars(...) default-emission sites, resolved after collection. |
styles/types.ts:55 |
refs |
readonly |
ReadonlySet<`vars/${string}`> |
Read-side var(...) paths. Drives default-emission reachability. |
styles/types.ts:53 |
theme |
readonly |
ReadonlySet<string> |
Theme-token paths interpolated into this block. | styles/types.ts:49 |
varNames? |
readonly |
ReadonlyMap<`vars/${string}`, ReadonlySet<string>> |
Custom-property names each contextual var was interpolated under, by path. | styles/types.ts:57 |
vars |
readonly |
ReadonlySet<`vars/${string}`> |
Unconditional writes and reads. Default-marker keys land here only when reachable. | styles/types.ts:51 |
Defined in: sink.ts:15
Minimal interface for a DOM <style> element.
| Property | Type | Description | Defined in |
|---|---|---|---|
textContent |
string | null |
Current stylesheet text, or null before the first flush. |
sink.ts:17 |
Defined in: styles/types.ts:109
A named class: readable name, declarations, and collection identity.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
declarations |
readonly |
Declarations |
CSS properties for this handle. | styles/types.ts:121 |
key |
readonly |
string |
Full path joined by dots. | styles/types.ts:117 |
kind |
readonly |
"handle" |
Discriminant for StyleEntry. | styles/types.ts:111 |
localName |
readonly |
string |
Leaf key if at root, or composed path for nested handles. | styles/types.ts:115 |
moduleName |
readonly |
string |
The registered module name this handle belongs to. | styles/types.ts:113 |
readableName |
readonly |
string |
Predictable name used for output CSS classes. | styles/types.ts:119 |
variant |
readonly |
boolean |
true when produced inside variants(...). Skipped by StylesCollector.use. |
styles/types.ts:123 |
resolveClassName(context): string;
Defined in: styles/types.ts:125
Produces the final class name via the provided resolver context.
| Parameter | Type | Description |
|---|---|---|
context |
{ resolveClassName: (...handles) => string; } |
- |
context.resolveClassName |
(...handles) => string |
Joins one or more handles into a class-name string. |
string
Defined in: styles/types.ts:161
@media or @container block wrapping inner StyleRules.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
atRule? |
readonly |
"media" | "container" |
At-rule this entry emits. kind stays 'media' so collector rank and deps apply uniformly. |
styles/types.ts:165 |
key |
readonly |
string |
Stable identity for deduplication across multiple renders. | styles/types.ts:167 |
kind |
readonly |
"media" |
Discriminant for StyleEntry. | styles/types.ts:163 |
moduleName |
readonly |
string |
The registered module name this media block belongs to. | styles/types.ts:169 |
query |
readonly |
string |
The conditional query (e.g. (min-width: 600px)). |
styles/types.ts:171 |
rules |
readonly |
readonly StyleRule[] |
Inner rules collected inside this block. | styles/types.ts:173 |
variant |
readonly |
boolean |
true when produced inside variants(...). |
styles/types.ts:175 |
Defined in: names.ts:14
Context for resolving keys into final class or custom-property names.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
names |
readonly |
StyleNameMode |
The naming mode used by this resolver. | names.ts:16 |
className(key, readableName?): string;
Defined in: names.ts:18
Resolves a handle key into a CSS class name.
| Parameter | Type |
|---|---|
key |
string |
readableName? |
string |
string
cssVar(key): `--${string}`;
Defined in: names.ts:20
Resolves a variable key into a custom property name.
| Parameter | Type |
|---|---|
key |
string |
`--${string}`
cssVarRef(key): `var(--${string})`;
Defined in: names.ts:22
Resolves a variable key into a var(...) reference.
| Parameter | Type |
|---|---|
key |
string |
`var(--${string})`
Defined in: names.ts:26
Inputs for createStyleNameResolver.
| Property | Type | Description | Defined in |
|---|---|---|---|
classKeys? |
Iterable<string, any, any> |
Keys defining the compact class-name domain. | names.ts:32 |
cssVarKeys? |
Iterable<string, any, any> |
Keys defining the compact custom-property domain. | names.ts:34 |
names |
StyleNameMode |
Naming strategy (compact or readable). |
names.ts:28 |
prefix |
string |
Brand prefix for readable names (<prefix>-<key> / --<prefix>-<key>), e.g. 'aui'. |
names.ts:30 |
Defined in: sink.ts:21
Node that receives a managed <style> element, e.g. document.head or a ShadowRoot.
appendChild(node): void;
Defined in: sink.ts:24
Appends the managed style element.
| Parameter | Type |
|---|---|
node |
StyleElementLike |
void
Defined in: styles/types.ts:203
Class and CSS-var key snapshot used to build a StyleNameResolver.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
classKeys |
readonly |
readonly string[] |
Collected readable class names from registered modules. | styles/types.ts:205 |
cssVarKeys |
readonly |
readonly string[] |
Collected custom property (CSS variable) keys. | styles/types.ts:207 |
Defined in: styles/types.ts:135
A selector plus declarations, optionally auto-collected from handle deps.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
auto |
readonly |
boolean |
When false, skip auto-collection; the caller must use the rule. |
styles/types.ts:151 |
declarations |
readonly |
Declarations |
CSS properties for this rule. | styles/types.ts:145 |
dependsOn |
readonly |
ReadonlySet<string> |
Handle keys this selector reads. Empty until the module is constructed. | styles/types.ts:149 |
key |
readonly |
string |
Unique key for this rule within the module. | styles/types.ts:141 |
kind |
readonly |
"rule" |
Discriminant for StyleEntry. | styles/types.ts:137 |
moduleName |
readonly |
string |
The registered module name this rule belongs to. | styles/types.ts:139 |
selector |
readonly |
(h) => string |
Selector string factory receiving a resolver for & and other handles. |
styles/types.ts:143 |
variant |
readonly |
boolean |
true when produced inside variants(...). |
styles/types.ts:147 |
Defined in: collector.ts:87
Target, naming mode, registry, and prefix for one StylesCollector.
| Property | Type | Description | Defined in |
|---|---|---|---|
dev? |
boolean |
When true, emit no-op-handle warnings through warn. Inherited from createDistillery({ dev }). |
collector.ts:97 |
names |
StyleNameMode |
Desired name mode (compact or readable). |
collector.ts:91 |
prefix |
string |
Brand prefix forwarded to the name resolver. | collector.ts:95 |
registry |
StyleRegistry |
Registry modules were authored against; used for auto-collection and compact-name snapshots. | collector.ts:93 |
target |
StyleTarget |
Target context (e.g. artifact or stylesheet). |
collector.ts:89 |
warn? |
(message) => void |
Warning sink for no-op handles. Used only when dev is true. The distillery passes its own sink; a bare collector defaults to console.warn. |
collector.ts:99 |
Defined in: sink.ts:9
Receives stylesheet invalidation from a live collection or Emotion compat modules.
invalidate(render): void;
Defined in: sink.ts:11
Marks the sink dirty. render produces the current stylesheet when it flushes.
| Parameter | Type |
|---|---|
render |
() => string |
void
Defined in: styles/types.ts:185
Named handle tree plus flat entries after createStyleModule.
| Type Parameter | Default type |
|---|---|
TStyles |
StylesObject |
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
entries |
readonly |
readonly StyleEntry[] |
Flat list of style entries (handles, rules, media) defined in this module. | styles/types.ts:191 |
handleList |
readonly |
readonly StyleHandle[] |
Flat list of just the style handles defined in this module. | styles/types.ts:193 |
handles |
readonly |
TStyles |
Authored tree of handles, rules, and media; variants nest as records. | styles/types.ts:189 |
name |
readonly |
string |
The unique registered name of the module. | styles/types.ts:187 |
themeDeps |
readonly |
ReadonlySet<string> |
Aggregated theme dependencies across all entries. | styles/types.ts:195 |
varDeps |
readonly |
ReadonlySet<`vars/${string}`> |
Aggregated variable dependencies across all entries. | styles/types.ts:197 |
Defined in: runtime.ts:91
One runtime-switched variation. selector is required unless the variation declares media.
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
selector? |
readonly |
string |
Consuming page selector, composed with themeScope. |
runtime.ts:95 |
variation |
readonly |
string |
Name passed in DistilleryOptions.variations. |
runtime.ts:93 |
Defined in: environment.ts:15
One theme CSS variable. Differing light/dark fold into light-dark(...).
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
cssVar |
readonly |
`--${string}` |
Emitted CSS custom property name. Equal to cssVarName(prefix, path). |
environment.ts:19 |
dark |
readonly |
string |
Value for dark color scheme. Equal to light for scheme-invariant tokens. |
environment.ts:23 |
light |
readonly |
string |
Value for light color scheme. | environment.ts:21 |
path |
readonly |
string |
Theme-tree path this definition was derived from. | environment.ts:17 |
type ContextualVarPath = `vars/${string}`;
Defined in: styles/types.ts:32
Canonical vars/<group>/<key> path for a contextual or module-local CSS variable.
type CssValue =
| string
| number
| CssToken
| ContextualCssVar
| ContextualCssVarName
| ScaleToken
| LocalVarRef;
Defined in: styles/types.ts:37
Values accepted by t.vars(...) defaults and .set(...).
type CssVarPath = string;
Defined in: styles/types.ts:34
Theme-token path or any other CSS-var key the resolver knows.
type DeclarationSegment = string | LocalVarMarker;
Defined in: styles/types.ts:98
Literal CSS text or a local-var interpolation marker.
type DeepPartialTheme<T> = T extends ScaleToken ? ScaleToken : T extends SchemePair | string ? string | SchemePair : T extends object ? { readonly [K in keyof T]?: DeepPartialTheme<T[K]> } : never;
Defined in: theme.ts:80
Partial variation of a ThemeTree. Leaves may change kind between string and SchemePair.
| Type Parameter |
|---|
T |
type LocalVarGroup<TKey> = { readonly [P in TKey]: LocalVarRef } & object;
Defined in: local_vars.ts:80
Value returned by t.vars(...). Interpolate ${group}, ${group.key}, or ${group.set({...})}.
set(overrides): LocalVarOverrideMarker;
Builds a marker that writes the given keys at the interpolation site.
| Parameter | Type |
|---|---|
overrides |
Partial<Record<TKey, CssValue>> |
| Type Parameter |
|---|
TKey extends string |
type LocalVarMarker =
| LocalVarOverrideMarker
| LocalVarDefaultMarker;
Defined in: local_vars.ts:75
Interpolation marker: ${group} defaults or ${group.set(...)} overrides.
type PathsOf<T, Prefix> = T extends ScaleToken ? never : T extends SchemePair | string ? Prefix extends "" ? never : Prefix : T extends object ? { [K in keyof T & string]: PathsOf<T[K], Prefix extends "" ? K : `${Prefix}/${K}`> }[keyof T & string] : never;
Defined in: theme.ts:55
Slash-delimited theme-var paths (excludes ScaleToken leaves).
| Type Parameter | Default type |
|---|---|
T |
- |
Prefix extends string |
"" |
type ResolvedStyles<TValue> = TValue extends PendingStyleHandle ? StyleHandle : TValue extends StyleRule ? StyleRule : TValue extends StyleMedia ? StyleMedia : TValue extends readonly infer TItem[] ? readonly ResolvedStyles<TItem>[] : TValue extends Record<string, unknown> ? { [TKey in keyof TValue]: ResolvedStyles<TValue[TKey]> } : TValue;
Defined in: styles/types.ts:211
Resolves nested pending handles, rules, and medias into their runtime types.
| Type Parameter |
|---|
TValue |
type SchemeValueTree = object;
Defined in: theme.ts:32
Per-scheme value tree accepted by zipSchemes.
[key: string]:
| string
| ScaleToken
| SchemeValueTree
type StyleEntry =
| StyleHandle
| StyleRule
| StyleMedia;
Defined in: styles/types.ts:179
One registered handle, selector rule, or at-rule block.
type StyleHandleRef = Pick<StyleHandle, "key">;
Defined in: styles/types.ts:132
A handle, or anything carrying a registered handle's key; see StylesCollector.useHandles.
type StyleNameMode = "compact" | "readable";
Defined in: names.ts:9
Naming scheme: compact assigns sequential identifiers by sorted key index, readable emits descriptive ones.
type StyleSelectorResolver = (handle) => string & Record<string, string>;
Defined in: styles/types.ts:181
Selector factory: call with a handle, or read sibling local names as .class strings.
type StylesObject = Record<string, unknown>;
Defined in: styles/types.ts:201
Authored module tree before ResolvedStyles substitution.
type StyleTarget = "artifact" | "stylesheet";
Defined in: names.ts:11
Destination format for the CSS collection.
type ThemeTree = object;
Defined in: theme.ts:27
Nested authoring tree. Keys must match /^[A-Za-z_][A-Za-z0-9_]*$/.
[key: string]: ThemeLeaf | ThemeTree
type ThemeVariation<T> =
| DeepPartialTheme<T>
| MediaThemeVariation<T>;
Defined in: theme.ts:97
Named variation: a partial of the base, or a media-conditioned partial.
type TokensOf<T> = T extends ScaleToken ? ScaleToken : T extends SchemePair | string ? CssToken : T extends object ? { readonly [K in keyof T]: TokensOf<T[K]> } : never;
Defined in: theme.ts:37
Token tree derived from an authoring ThemeTree.
| Type Parameter |
|---|
T |
type ValuesOf<T> = T extends ScaleToken ? string : T extends SchemePair | string ? string : T extends object ? { readonly [K in keyof T]: ValuesOf<T[K]> } : never;
Defined in: theme.ts:46
Literal-value tree for one scheme. ScaleToken leaves use .value.
| Type Parameter |
|---|
T |
type Zipped<T> = T extends ScaleToken ? ScaleToken : T extends string ? string | SchemePair : T extends object ? { readonly [K in keyof T]: Zipped<T[K]> } : never;
Defined in: theme.ts:71
zipSchemes output: equal strings collapse; differing strings become SchemePair.
| Type Parameter |
|---|
T |
const cq: (value, cq) => ScaleToken = scaleToken;
Defined in: tokens/scale_token.ts:37
Alias of scaleToken for theme-tree authoring.
Literal size token. Stringifies to value; cq is the container-relative variant and defaults to value.
| Parameter | Type | Default value |
|---|---|---|
value |
string |
undefined |
cq |
string |
value |
function combineClassNames(context, ...handles): string;
Defined in: styles/authoring.ts:207
Resolves handles through the collector's class-name resolver.
| Parameter | Type | Description |
|---|---|---|
context |
ClassNameContext |
Object exposing resolveClassName (e.g. a React render context). |
...handles |
readonly StyleHandle[] |
One or more handles to resolve and join. |
string
Use resolveClassNames, which also renders without a context.
function container(query, rules): StyleMedia;
Defined in: styles/authoring.ts:137
@container block. kind stays 'media' so emission rank matches media.
| Parameter | Type | Description |
|---|---|---|
query |
string |
Container query string (e.g. (min-width: 400px)). |
rules |
readonly StyleRule[] |
Inner rules scoped to this block. |
function contextualVar(path, prop): ContextualCssVar;
Defined in: tokens/contextual_var.ts:41
Shared contextual var. Stringifies to var(<prop>); .name is the ident. For a path in sharedVars, prefer distillery.contextualVar(path), which derives prop; this form is for a var another library names.
| Parameter | Type |
|---|---|
path |
`vars/${string}` |
prop |
`--${string}` |
function createDistillery<TTheme>(options): Distillery<TokensOf<TTheme>, TTheme>;
Defined in: engine.ts:136
Binds the engine to one library's prefix and theme tree.
| Type Parameter |
|---|
TTheme extends ThemeTree |
| Parameter | Type | Description |
|---|---|---|
options |
DistilleryOptions<TTheme> |
Brand prefix, theme scope, and authoring theme tree. |
Distillery<TokensOf<TTheme>, TTheme>
If prefix is not a CSS identifier segment, if a theme key contains a hyphen, if a lightDark value is not a CSS <color>, if a named variation disagrees with the base, or if themeVars / sharedVars claim the same readable custom-property name.
function createDomSink(__namedParameters): StyleSink;
Defined in: dom_sink.ts:33
One managed <style> element, rewritten on each flush.
| Parameter | Type |
|---|---|
__namedParameters |
CreateDomSinkOptions |
function createStyleNameResolver(__namedParameters): StyleNameResolver;
Defined in: names.ts:102
Maps semantic keys to readable (<prefix>-<key>) or compact (a, b, …) names.
| Parameter | Type |
|---|---|
__namedParameters |
StyleNameResolverOptions |
function css(strings, ...values): PendingStyleHandle;
Defined in: styles/authoring.ts:37
Handle template. Nested & / @media flatten into sibling rules.
| Parameter | Type |
|---|---|
strings |
TemplateStringsArray |
...values |
readonly unknown[] |
PendingStyleHandle
function cssVarName(prefix, path): `--${string}`;
Defined in: names.ts:86
Readable custom-property name: --${prefix}-${path} with / joined on - and a leading vars/ stripped.
| Parameter | Type | Description |
|---|---|---|
prefix |
string |
Brand prefix (e.g. 'eui'). |
path |
string |
Theme or contextual-var path (e.g. 'colors/ink', 'vars/chip/look/bg'). |
`--${string}`
function decls(strings, ...values): Declarations;
Defined in: styles/authoring.ts:31
Declaration-block template. Interpolations stringify; local-var markers stay until render.
| Parameter | Type |
|---|---|
strings |
TemplateStringsArray |
...values |
readonly unknown[] |
function isContextualCssVar(value): value is ContextualCssVar;
Defined in: tokens/contextual_var.ts:66
true when value is a ContextualCssVar.
| Parameter | Type | Description |
|---|---|---|
value |
unknown |
Value to test. |
value is ContextualCssVar
function isContextualCssVarName(value): value is ContextualCssVarName;
Defined in: tokens/contextual_var.ts:70
true when value is a ContextualCssVarName.
| Parameter | Type | Description |
|---|---|---|
value |
unknown |
Value to test. |
value is ContextualCssVarName
function isCssToken(value): value is CssToken;
Defined in: tokens/theme_token.ts:41
true when value is a CssToken.
| Parameter | Type | Description |
|---|---|---|
value |
unknown |
Value to test. |
value is CssToken
function isScaleToken(value): value is ScaleToken;
Defined in: tokens/scale_token.ts:40
true when value is a ScaleToken.
| Parameter | Type | Description |
|---|---|---|
value |
unknown |
Value to test. |
value is ScaleToken
function lightDark(light, dark): SchemePair;
Defined in: tokens/light_dark.ts:31
Scheme-varying color pair. Both sides must be CSS <color> values.
| Parameter | Type | Description |
|---|---|---|
light |
string |
Light color-scheme value. |
dark |
string |
Dark color-scheme value. |
If either value is not a CSS <color>.
function mapDomain<TKey, TValue>(domain, factory): Record<TKey, TValue>;
Defined in: styles/authoring.ts:168
Builds a record keyed by domain. No CSS-collection side effect.
| Type Parameter |
|---|
TKey extends string |
TValue |
| Parameter | Type | Description |
|---|---|---|
domain |
readonly TKey[] |
All valid keys (e.g. ['primary', 'secondary']). |
factory |
(value) => TValue |
Called once per key. |
Record<TKey, TValue>
function media(query, rules): StyleMedia;
Defined in: styles/authoring.ts:118
@media block wrapping rules.
| Parameter | Type | Description |
|---|---|---|
query |
string |
Media query string (e.g. (min-width: 600px)). |
rules |
readonly StyleRule[] |
Inner rules scoped to this block. |
function renderStyles(
environment,
collector,
resolver?,
options?
): string;
Defined in: runtime.ts:41
Emits collected CSS: theme block, then entries, minified.
| Parameter | Type | Description |
|---|---|---|
environment |
DistilleryEnvironment<unknown> |
Theme vars, prefix, and scope for this render. |
collector |
StylesCollector |
Reachable entries and deps. |
resolver |
StyleNameResolver |
Defaults to collector.createResolver(). |
options |
RenderStylesOptions |
- |
string
function resolveClassNames(context, ...handles): string;
Defined in: styles/authoring.ts:220
Class names for handles through context, or their readable names when there is none.
The fallback lets a view render outside a collecting tree (a unit test, a plain DOM mount) and still wear stable class names.
| Parameter | Type | Description |
|---|---|---|
context |
ClassNameContext | null | undefined |
Object exposing resolveClassName, or null / undefined outside a collecting render. |
...handles |
readonly StyleHandle[] |
One or more handles to resolve and join. |
string
function resolveThemeValues<T>(
theme,
themeVars,
scheme,
variation?
): ValuesOf<T>;
Defined in: theme.ts:142
Nested literal values for one scheme. Walks theme so ScaleToken leaves resolve to .value.
| Type Parameter |
|---|
T extends ThemeTree |
| Parameter | Type | Description |
|---|---|---|
theme |
T |
Authoring tree that produced themeVars. |
themeVars |
Readonly<Record<string, ThemeVarDefinition>> |
Base registry from Distillery.themeVars. |
scheme |
"light" | "dark" |
Which side of each ThemeVarDefinition to read. |
variation? |
ResolvedThemeVariation |
When set, overridden paths come from variation.diffs; everything else stays on themeVars. |
ValuesOf<T>
function rule(
selector,
declarations,
options?
): StyleRule;
Defined in: styles/authoring.ts:97
Selector plus declarations. dependsOn is filled when the module is constructed.
| Parameter | Type | Description |
|---|---|---|
selector |
(h) => string |
Factory receiving a StyleSelectorResolver; uses & and handle aliases. |
declarations |
Declarations |
CSS properties for this rule. |
options |
RuleOptions |
auto controls whether the rule self-collects when its handle dependencies are met. |
function scaleToken(value, cq?): ScaleToken;
Defined in: tokens/scale_token.ts:25
Literal size token. Stringifies to value; cq is the container-relative variant and defaults to value.
| Parameter | Type | Default value |
|---|---|---|
value |
string |
undefined |
cq |
string |
value |
function themeToken(path, cssVar): CssToken;
Defined in: tokens/theme_token.ts:27
Theme token that stringifies to var(<cssVar>).
| Parameter | Type |
|---|---|
path |
string |
cssVar |
`--${string}` |
function variants<TKey, TValue>(domain, factory): Record<TKey, TValue>;
Defined in: styles/authoring.ts:183
Builds a record of styles keyed by domain. Each value is marked variant so StylesCollector.use skips it.
| Type Parameter |
|---|
TKey extends string |
TValue |
| Parameter | Type | Description |
|---|---|---|
domain |
readonly TKey[] |
All valid variant keys (e.g. ['primary', 'secondary']). |
factory |
(value) => TValue |
Called once per key; returns the handle or nested style object for that variant. |
Record<TKey, TValue>
function zipSchemes<T>(light, dark): Zipped<T>;
Defined in: theme.ts:119
Folds two per-scheme trees into one authoring tree. Equal string leaves stay bare; differing strings become lightDark. ScaleToken leaves must agree.
| Type Parameter |
|---|
T extends SchemeValueTree |
| Parameter | Type | Description |
|---|---|---|
light |
T |
Light-scheme value tree. |
dark |
T |
Dark-scheme value tree. |
Zipped<T>
If shapes, leaf kinds, or scale values disagree, or if a differing string pair is not a CSS <color>.