index
Defined in: styles/registry.ts:22
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:26
| Parameter | Type |
|---|---|
prefix |
string |
reservedVarOwners |
ReadonlyMap<string, string> |
sharedVarPaths |
ReadonlySet<string> |
get classKeys(): readonly string[];
Defined in: styles/registry.ts:98
Handle keys across all modules. Compact-name domain for a full stylesheet.
readonly string[]
get cssVarKeys(): readonly string[];
Defined in: styles/registry.ts:105
Theme and contextual-var keys across all modules.
readonly string[]
get modules(): readonly StylesModule<StylesObject>[];
Defined in: styles/registry.ts:86
Registered modules, sorted by name.
readonly StylesModule<StylesObject>[]
freeze(options?): StyleRegistrySnapshot;
Defined in: styles/registry.ts:119
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. |
module(name):
| StylesModule<StylesObject>
| undefined;
Defined in: styles/registry.ts:93
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:37
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:61
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 recordRuleDeps, 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:101
Reachable entries for one render or one stylesheet.
new StylesCollector(__namedParameters): StylesCollector;
Defined in: collector.ts:120
| Parameter | Type |
|---|---|
__namedParameters |
StylesCollectorOptions |
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
names |
readonly |
StyleNameMode |
The naming mode (compact vs readable). | collector.ts:105 |
prefix |
readonly |
string |
Emitted class name prefix. | collector.ts:109 |
registry |
readonly |
StyleRegistry |
Associated registry. | collector.ts:107 |
target |
readonly |
StyleTarget |
The target collection mode. | collector.ts:103 |
get collectedEntries(): readonly StyleEntry[];
Defined in: collector.ts:351
Collected style entries sorted for emission (base rules before all @media/@container blocks).
readonly StyleEntry[]
get collectedThemeDeps(): ReadonlySet<string>;
Defined in: collector.ts:356
Theme token paths that survive reachability; emitted in the theme scope block.
ReadonlySet<string>
get collectedVarDeps(): ReadonlySet<`vars/${string}`>;
Defined in: collector.ts:361
Contextual var paths that survive reachability; used by the runtime for compact-name substitution.
ReadonlySet<`vars/${string}`>
createResolver(): StyleNameResolver;
Defined in: collector.ts:333
Creates a StyleNameResolver scoped to this collector's current dep set.
reachableDefaults(handle, groupPath): ReadonlySet<string>;
Defined in: collector.ts:376
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:275
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:143
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:196
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:222
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 StyleHandle[] |
Handles resolved during this render pass (e.g. from resolveClassName). |
readonly StyleHandle[]
Handles that were retained. Empty untargeted handles are omitted in compact mode.
useRulesWhenDepsMet(module): void;
Defined in: collector.ts:251
Collects auto rules on module whose every selector dependency is already collected.
| Parameter | Type |
|---|---|
module |
StylesModule |
void
useThemeVar(path): void;
Defined in: collector.ts:328
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: 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:97
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:99 |
deps |
readonly |
StyleDeps |
Reachability tracking dependencies. | styles/types.ts:101 |
Defined in: styles/types.ts:59
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:61 |
keys |
readonly |
readonly DefaultKeyDeps[] |
Defaults registered within this group. | styles/types.ts:63 |
Defined in: styles/types.ts:67
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:69 |
path |
readonly |
`vars/${string}` |
Full CSS variable path (e.g. vars/group/key). |
styles/types.ts:71 |
valueDeps |
readonly |
object |
Theme/var paths referenced by the default value. Kept if the key is reachable. | styles/types.ts:73 |
valueDeps.theme |
readonly |
ReadonlySet<string> |
Theme-token paths the default value interpolates. | styles/types.ts:75 |
valueDeps.vars |
readonly |
ReadonlySet<`vars/${string}`> |
Contextual-var paths the default value interpolates. | styles/types.ts:77 |
Defined in: engine.ts:69
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:99 |
createNameResolver |
readonly |
(options) => StyleNameResolver |
Creates a standalone name resolver using this distillery's prefix. | engine.ts:117 |
createStyleModule |
readonly |
<TStyles>(name, factory) => StylesModule<ResolvedStyles<TStyles>> |
Named handle tree plus tokens. | engine.ts:89 |
dev |
readonly |
boolean |
When true, collectors warn about no-op handles. |
engine.ts:87 |
environment |
readonly |
DistilleryEnvironment<TTokens> |
Resolved environment (tokens, prefix, derived theme vars). | engine.ts:74 |
liveCollection |
readonly |
(options?) => LiveCollection |
Readable collection for one live render; keeps sink current as handles resolve. |
engine.ts:109 |
primitiveStyles |
readonly |
<TStyles>(name, factory) => StylesModule<ResolvedStyles<TStyles>> |
Named handles plus tokens only. | engine.ts:94 |
registry |
readonly |
StyleRegistry |
The module registry accumulating collected handles and rules. | engine.ts:85 |
renderStyles |
readonly |
(collector, resolver?, options?) => string |
Emits collected CSS for this environment. | engine.ts:111 |
resolveValues |
readonly |
(scheme, variation?) => ValuesOf<TTheme> |
Nested literal values for one scheme. Optional variation is a name from variations. |
engine.ts:80 |
stylesheetCollector |
readonly |
(names?, options?) => StylesCollector |
Collector preloaded with every registered module. No-op warnings require dev: true; pass { warn } to capture them. |
engine.ts:104 |
themeVars |
readonly |
Readonly<Record<string, ThemeVarDefinition>> |
Derived theme-var registry, same object as environment.themeVars. |
engine.ts:78 |
tokens |
readonly |
TTokens |
Derived token tree, same object as environment.tokens. |
engine.ts:76 |
Defined in: environment.ts:43
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:45 |
sharedVars? |
readonly |
ReadonlySet<`vars/${string}`> |
Cross-module contextual-var paths. Module-local vars(...) groups are not listed here. |
environment.ts:51 |
themeScope |
readonly |
string |
Selector wrapping emitted theme-var declarations. | environment.ts:47 |
themeVars |
readonly |
Readonly<Record<string, ThemeVarDefinition>> |
Theme token path → definition. Emission sorts paths. | environment.ts:49 |
tokens |
readonly |
TTokens |
Typed token tree, surfaced as tokens on the authoring API. |
environment.ts:53 |
variations? |
readonly |
Readonly<Record<string, ResolvedThemeVariation>> |
Named variations resolved against themeVars. Absent when no variations were declared. |
environment.ts:55 |
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. 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 |
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:59
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:61 |
css |
readonly |
() => string |
Renders the CSS collected so far. | engine.ts:65 |
resolveClassName |
readonly |
(...handles) => string |
Collects handles and returns their readable class names, space-separated. |
engine.ts:63 |
Defined in: engine.ts:45
Sink, render options, and warning sink for Distillery.liveCollection.
| Property | Type | Description | Defined in |
|---|---|---|---|
render? |
RenderStylesOptions |
Options forwarded to renderStyles by css(). |
engine.ts:49 |
sink? |
StyleSink |
Invalidated whenever the collection grows. Nothing is written before the first handle. | engine.ts:47 |
warn? |
(message) => void |
Warning sink for no-op handles. Used only when the distillery has dev: true. |
engine.ts:51 |
Defined in: local_vars.ts:53
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:55 |
defaults |
readonly |
readonly object[] |
Ordered list of variable defaults. | local_vars.ts:61 |
groupId |
readonly |
string |
Unique ID for the group. | local_vars.ts:57 |
groupPath |
readonly |
`vars/${string}` |
Group prefix path. | local_vars.ts:59 |
Defined in: local_vars.ts:34
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:36 |
groupId |
readonly |
string |
Unique ID for the group. | local_vars.ts:38 |
overrides |
readonly |
readonly object[] |
Ordered list of variable overrides. | local_vars.ts:40 |
Defined in: local_vars.ts:18
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:20 |
path |
readonly |
`vars/${string}` |
Canonical group/key path. | local_vars.ts:22 |
propName |
readonly |
`--${string}` |
Actual emitted CSS custom property name. | local_vars.ts:24 |
ref |
readonly |
`var(--${string})` |
Usable CSS var(...) reference string. |
local_vars.ts:26 |
toPrimitive: string;
Defined in: local_vars.ts:30
Template interpolation; same as LocalVarRef.toString.
| Parameter | Type |
|---|---|
hint |
string |
string
toString(): string;
Defined in: local_vars.ts:28
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:278
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:280 |
tokens |
TTokens |
Environment token tree. | styles/types.ts:282 |
Defined in: runtime.ts:67
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:77 |
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:69 |
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:75 |
themeValueOverrides? |
Partial<Record<string, string>> |
Override a theme token's emitted value. | runtime.ts:79 |
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:148
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:150 |
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. |
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:219
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:221 |
decls |
(strings, ...values) => Declarations |
Creates a declaration block template for direct CSS properties. | styles/types.ts:226 |
tokens |
TTokens |
Environment token tree. | styles/types.ts:236 |
vars |
<TKey>(group, defaults) => LocalVarGroup<TKey> |
Module-local CSS variable group. Interpolate ${group}, ${group.key}, or ${group.set({...})}. |
styles/types.ts:231 |
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 |
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:105
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:117 |
key |
readonly |
string |
Full path joined by dots. | styles/types.ts:113 |
kind |
readonly |
"handle" |
Discriminant for StyleEntry. | styles/types.ts:107 |
localName |
readonly |
string |
Leaf key if at root, or composed path for nested handles. | styles/types.ts:111 |
moduleName |
readonly |
string |
The registered module name this handle belongs to. | styles/types.ts:109 |
readableName |
readonly |
string |
Predictable name used for output CSS classes. | styles/types.ts:115 |
variant |
readonly |
boolean |
true when produced inside variants(...). Skipped by StylesCollector.use. |
styles/types.ts:119 |
resolveClassName(context): string;
Defined in: styles/types.ts:121
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:154
@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; see finding media-block-ordering. |
styles/types.ts:160 |
key |
readonly |
string |
Stable identity for deduplication across multiple renders. | styles/types.ts:162 |
kind |
readonly |
"media" |
Discriminant for StyleEntry. | styles/types.ts:156 |
moduleName |
readonly |
string |
The registered module name this media block belongs to. | styles/types.ts:164 |
query |
readonly |
string |
The conditional query (e.g. (min-width: 600px)). |
styles/types.ts:166 |
rules |
readonly |
readonly StyleRule[] |
Inner rules collected inside this block. | styles/types.ts:168 |
variant |
readonly |
boolean |
true when produced inside variants(...). |
styles/types.ts:170 |
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:198
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:200 |
cssVarKeys |
readonly |
readonly string[] |
Collected custom property (CSS variable) keys. | styles/types.ts:202 |
Defined in: styles/types.ts:128
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:144 |
declarations |
readonly |
Declarations |
CSS properties for this rule. | styles/types.ts:138 |
dependsOn |
readonly |
ReadonlySet<string> |
Handle keys this selector reads. Empty until assignEntries fills it. |
styles/types.ts:142 |
key |
readonly |
string |
Unique key for this rule within the module. | styles/types.ts:134 |
kind |
readonly |
"rule" |
Discriminant for StyleEntry. | styles/types.ts:130 |
moduleName |
readonly |
string |
The registered module name this rule belongs to. | styles/types.ts:132 |
selector |
readonly |
(h) => string |
Selector string factory receiving a resolver for & and other handles. |
styles/types.ts:136 |
variant |
readonly |
boolean |
true when produced inside variants(...). |
styles/types.ts:140 |
Defined in: collector.ts:85
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:95 |
names |
StyleNameMode |
Desired name mode (compact or readable). |
collector.ts:89 |
prefix |
string |
Brand prefix forwarded to the name resolver. | collector.ts:93 |
registry |
StyleRegistry |
Registry modules were authored against; used for auto-collection and compact-name snapshots. | collector.ts:91 |
target |
StyleTarget |
Target context (e.g. artifact or stylesheet). |
collector.ts:87 |
warn? |
(message) => void |
Warning sink for no-op handles. Used only when dev is true. Defaults to console.warn. |
collector.ts:97 |
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:180
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:186 |
handleList |
readonly |
readonly StyleHandle[] |
Flat list of just the style handles defined in this module. | styles/types.ts:188 |
handles |
readonly |
TStyles |
Authored tree of handles, rules, and media; variants nest as records. | styles/types.ts:184 |
name |
readonly |
string |
The unique registered name of the module. | styles/types.ts:182 |
themeDeps |
readonly |
ReadonlySet<string> |
Aggregated theme dependencies across all entries. | styles/types.ts:190 |
varDeps |
readonly |
ReadonlySet<`vars/${string}`> |
Aggregated variable dependencies across all entries. | styles/types.ts:192 |
Defined in: runtime.ts:83
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:87 |
variation |
readonly |
string |
Name passed in DistilleryOptions.variations. |
runtime.ts:85 |
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:94
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:79
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:74
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:206
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:174
One registered handle, selector rule, or at-rule block.
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:176
Selector factory: call with a handle, or read sibling local names as .class strings.
type StylesObject = Record<string, unknown>;
Defined in: styles/types.ts:196
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.
| Parameter | Type |
|---|---|
value |
string |
cq |
string |
function combineClassNames(context, ...handles): string;
Defined in: styles/authoring.ts:203
Resolves handles through the collector's class-name resolver.
| Parameter | Type | Description |
|---|---|---|
context |
{ resolveClassName: (...handles) => string; } |
Object exposing resolveClassName (e.g. a React render context). |
context.resolveClassName |
(...handles) => string |
- |
...handles |
readonly StyleHandle[] |
One or more handles to resolve and join. |
string
function container(query, rules): StyleMedia;
Defined in: styles/authoring.ts:140
@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.
| Parameter | Type |
|---|---|
path |
`vars/${string}` |
prop |
`--${string}` |
function createDistillery<TTheme>(options): Distillery<TokensOf<TTheme>, TTheme>;
Defined in: engine.ts:128
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:171
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:121
@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:39
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 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.
| Parameter | Type |
|---|---|
value |
string |
cq |
string |
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:186
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>.