{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }[] Absolute color variants for all hues and intensities. Non-adaptive: these don't change between light and dark color schemes.
CSS framework and design system for semantic HTML
31 modules ยท 669 declarations
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }[] Absolute color variants for all hues and intensities. Non-adaptive: these don't change between light and dark color schemes.
css_class_extractor.ts view source
AcornPlugin Acorn plugin type - a function that extends the Parser class.
Set<string> All modifier names for quick lookup
readonly ["00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100"] "00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" Map<string, ModifierDefinition> Map of ancestor modifier names to their CSS output
example_class_utilities.ts view source
string[] Array - all elements extracted
css_plugin_options.ts view source
BaseCssOption Type for the base_css option used by CSS generators.
Supports four forms:
- undefined - Use default style.css (framework defaults)
- null - Disable base styles entirely (explicit opt-out)
- string - Custom CSS to replace defaults
- (default_css) => string - Callback to modify default CSS
See module documentation for the undefined vs null convention.
BaseDiagnostic Base diagnostic with common fields.
level'error' | 'warning'messagestringsuggestionstring | null{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["xs3", "xs2", "xs", "sm", "md", "lg", "xl"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly [1, 2, 3, 4, 5, 6, 7, 8, 9] "xs" | "sm" | "md" | "lg" | "xl" | "xs3" | "xs2" 6 | 4 | 1 | 3 | 5 | 7 | 2 | 8 | 9 class_variable_index.ts view source
(definitions: Record<string, CssClassDefinition | undefined>): CssClassVariableIndex Builds an index of CSS variables used by each class definition.
definitionsCSS class definitions to index
Record<string, CssClassDefinition | undefined>CssClassVariableIndex CssClassVariableIndex with variable lookups
(variables: { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }[], content_hash: string): VariableDependencyGraph Builds a dependency graph from an array of style variables.
variablesarray of StyleVariable objects
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }[]content_hashhash of the source for cache invalidation
stringVariableDependencyGraph (variables: VariablesOption): VariableDependencyGraph Builds a variable dependency graph from a variables option. Handles all option forms: undefined (defaults), null (disabled), array, or callback.
variablesthe variables option from generator config
VariableDependencyGraph VariableDependencyGraph built from the resolved variables
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } CacheDeps Cache-related file system deps. Abstracted to enable test isolation from the actual filesystem.
Named CacheDeps (not FsDeps) because it only covers
the specific deps needed for cache management, not general
filesystem access.
read_textReads a text file.
Returns null if file doesn't exist.
(options: {path: string}) => Promise<string | null>write_text_atomicWrites a text file atomically (temp file + rename for crash safety). Creates parent directories if they don't exist.
(options: {
path: string;
content: string;
}) => Promise<Result<object, {message: string}>>unlinkRemoves a file. Succeeds silently if file doesn't exist.
(options: {path: string}) => Promise<Result<object, {message: string}>>CachedExtraction Cached extraction result for a single file.
Uses null instead of empty arrays to avoid allocation overhead.
vCache version - invalidates cache when bumped
numbercontent_hashSHA-256 hash of the source file contents
stringclassesClasses as [name, locations] tuples, or null if none
Array<[string, Array<SourceLocation>]> | nullexplicit_classesClasses from
Array<string> | nulldiagnosticsExtraction diagnostics, or null if none
Array<ExtractionDiagnostic> | nullelementsHTML elements found in the file, or null if none
Array<string> | nullexplicit_elementsElements from
Array<string> | nullexplicit_variablesVariables from
Array<string> | null(value: string): string | null Checks if a value contains a possibly invalid calc expression.
valuethe formatted CSS value
stringstring | null warning message if suspicious, null otherwise
css_class_generators.ts view source
ClassTemplateFn<T1, T2, T3> T1stringT2stringT3stringclass_variable_index.ts view source
(index: CssClassVariableIndex, class_names: Iterable<string>): Set<string> Collects all variables used by a set of classes.
indexthe class variable index
class_namesclass names to collect variables from
Iterable<string>Set<string> set of all variable names used by the classes
style_rule_parser.ts view source
(index: StyleRuleIndex, included_indices: Set<number>): Set<string> Collects all CSS variables used by the included rules.
indexthe StyleRuleIndex
included_indicesset of rule indices to include
Set<number>Set<string> set of variable names (without -- prefix)
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["light", "dark"] ColorScheme[] readonly ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] ColorScheme "dark" | "light" "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" style_rule_parser.ts view source
CoreReason Reasons a rule is considered "core" and always included.
style_rule_parser.ts view source
CoreStyleRule A core style rule that is always included in output.
is_coretruecore_reason(diagnostic: InterpreterDiagnostic, locations: SourceLocation[] | null): GenerationDiagnostic Converts an InterpreterDiagnostic to a GenerationDiagnostic with locations.
diagnosticinterpreter diagnostic to convert
locationssource locations where the class was used
SourceLocation[] | nullGenerationDiagnostic style_rule_parser.ts view source
(css: string): StyleRuleIndex Creates a StyleRuleIndex from a custom CSS string. Use this to parse user-provided base styles instead of loading from file.
cssraw CSS string to parse
stringStyleRuleIndex 6 CSS cache version. Bump when any of these change:
- CachedExtraction schema
- extract_css_classes_with_locations() logic or output
- ExtractionDiagnostic or SourceLocation structure
v1: Initial version with classes and diagnostics v2: Use null instead of empty arrays, add explicit_classes, elements, css_variables v3: Add explicit_elements, explicit_variables for
css_class_composites.ts view source
Record<string, CssClassDefinition | undefined> css_class_definitions.ts view source
Record<string, CssClassDefinition | undefined> All built-in CSS class definitions (token classes + composites).
``generate_classes_css``
css_class_interpreters.ts view source
CssClassDefinitionInterpreter[] Collection of all builtin interpreters for dynamic CSS class generation.
Order matters: modified_class_interpreter runs first to handle hover:box before
css_literal_interpreter tries to interpret it as hover:box (property:value).
css_class_generators.ts view source
readonly ["top", "right", "bottom", "left"] css_class_interpreters.ts view source
CssClassDefinitionInterpreter Interpreter for CSS-literal classes (e.g., display:flex, hover:opacity:80%).
Generates full CSS rulesets including any modifier wrappers.
css_plugin_options.ts view source
CssCacheOptions Options for cache behavior.
cache_dirCache directory relative to project root.
stringdepsFilesystem deps for cache management. Defaults to production implementation. Override for testing.
css_class_generation.ts view source
CssClassDefinition Full union including interpreters.
css_class_generation.ts view source
CssClassDefinitionBase commentstringcss_class_generation.ts view source
CssClassDefinitionComposition Pure utility composition (composes only).
composesArray<string>declarationneverrulesetnevercss_class_generation.ts view source
CssClassDefinitionDeclaration Custom CSS declaration (optionally seeded with composes).
declarationstringcomposesArray<string>rulesetnevercss_class_generation.ts view source
CssClassDefinitionInterpreter Interpreter for dynamic CSS class generation based on pattern matching.
patternRegExpinterpret(matched: RegExpMatchArray, ctx: CssClassInterpreterContext) => string | nullcss_class_generation.ts view source
CssClassDefinitionRuleset Full ruleset with selectors.
rulesetstringclassesneverdeclarationnevercss_class_generation.ts view source
CssClassDefinitionStatic Static definitions (not interpreter-based).
Collection of CSS classes extracted from source files.
Tracks classes per-file for efficient incremental updates.
Handles include/exclude filtering and explicit class tracking.
Uses null instead of empty collections to avoid allocation overhead.
constructorCreates a new CssClasses collection.
type new (additional_classes?: Set<string> | null, exclude_classes?: Set<string> | null): CssClasses
additional_classesclasses to always include (also treated as explicit for warnings)
Set<string> | nullnullexclude_classesclasses to exclude from output (also suppresses warnings)
Set<string> | nullnulladdAdds extraction results for a file. Replaces any previous classes and diagnostics for this file.
type (id: string, data: ExtractionData): void
idfile identifier
stringdataextraction data fields to store for this file
voiddeletetype (id: string): void
idstringvoidgetGets all unique class names as a Set (with exclude filter applied).
type (): Set<string>
Set<string>get_with_locationsGets all classes with their source locations (with exclude filter applied). Locations from additional_classes are null.
type (): Map<string, SourceLocation[] | null>
Map<string, SourceLocation[] | null>get_allGets all classes and their locations in a single call.
More efficient than calling get() and get_with_locations() separately
when both are needed (avoids potential double recalculation).
Results have exclude filter applied and explicit_classes includes additional_classes.
type (): { all_classes: Set<string>; all_classes_with_locations: Map<string, SourceLocation[] | null>; explicit_classes: Set<string> | null; all_elements: Set<...>; explicit_elements: Set<...> | null; explicit_variables: Set<...> | null; }
{ all_classes: Set<string>; all_classes_with_locations: Map<string, SourceLocation[] | null>; explicit_classes: Set<string> | null; all_elements: Set<...>; explicit_elements: Set<...> | null; explicit_variables: Set<...> | null; }get_diagnosticsGets all extraction diagnostics from all files.
type (): ExtractionDiagnostic[]
ExtractionDiagnostic[]css_class_generation.ts view source
CssClassInterpreterContext Context passed to CSS class interpreters. Provides access to logging, diagnostics collection, and the class registry.
logOptional logger for warnings/errors
LoggerdiagnosticsDiagnostics array to collect warnings and errors
Array<InterpreterDiagnostic>class_definitionsAll known CSS class definitions (token + composite classes)
Record<string, CssClassDefinition | undefined>css_propertiesValid CSS properties for literal validation, or null to skip validation
Set<string> | nullcss_plugin_options.ts view source
CssClassOptions Options for CSS class definitions and interpretation. Controls how classes are defined and how dynamic classes are generated.
class_definitionsAdditional class definitions to merge with defaults.
User definitions take precedence over defaults with the same name.
Required when include_default_classes is false.
Record<string, CssClassDefinition | undefined>include_default_classesWhether to include default class definitions (token and composite classes).
When false, class_definitions is required.
booleanclass_interpretersCustom interpreters for dynamic class generation. Replaces the builtin interpreters entirely if provided.
Array<CssClassDefinitionInterpreter>class_variable_index.ts view source
CssClassVariableIndex Index mapping class names to their CSS variable dependencies.
by_classMap from class name to set of variable names (without -- prefix)
Map<string, Set<string>>css_plugin_options.ts view source
CssDiagnosticsOptions Options for error and warning handling.
on_errorHow to handle CSS-literal errors during generation. - 'log': Log errors, skip invalid classes, continue - 'throw': Throw on first error, fail the build
'log' | 'throw'on_warningHow to handle warnings during generation. - 'log': Log warnings, continue - 'throw': Throw on first warning, fail the build - 'ignore': Suppress warnings entirely
'log' | 'throw' | 'ignore'css_class_generators.ts view source
"top" | "right" | "bottom" | "left" css_plugin_options.ts view source
CssExtractionOptions Options for CSS class extraction from source files. Controls which files to scan and how to parse them.
filter_fileFilter function to determine which files to extract classes from. By default, extracts from .svelte, .html, .ts, .js, .tsx, .jsx files, excluding test files and .gen files.
acorn_pluginsAdditional acorn plugins for parsing.
Use acorn-jsx for React/Preact/Solid projects.
Array<AcornPlugin>Error thrown when CSS generation encounters errors or warnings
(depending on on_error and on_warning settings).
Contains the full diagnostics array for programmatic access.
Errordiagnosticstype Array<Diagnostic>
constructortype new (diagnostics: Diagnostic[]): CssGenerationError
diagnosticsDiagnostic[]css_plugin_options.ts view source
CssGeneratorBaseOptions Combined base options shared by both Gro and Vite plugins. These options work identically in both contexts.
CssLiteralOutput Information needed to generate CSS output for a CSS-literal class.
declarationCSS declaration (property: value;)
stringselectorFull CSS selector including pseudo-classes/elements
stringmedia_wrapperMedia query wrapper if any
string | nullancestor_wrapperAncestor wrapper if any
string | nullCssLiteralParseResult Result of parsing a CSS-literal class name.
Uses a discriminated union (Result type) because parsing a single class is binary: it either succeeds or fails entirely. This differs from ExtractionResult which uses embedded diagnostics because file extraction can partially succeed (some classes extracted, others have errors).
Uses | null for diagnostics to avoid allocating empty arrays.
Callers should use a guard pattern: if (result.diagnostics) { ... }
css_plugin_options.ts view source
CssOutputOptions Options for CSS output generation (theme + base + utilities). Controls how the three CSS layers are combined.
base_cssBase styles (element defaults) configuration.
- undefined (default): Use default style.css
- null: Disable base styles entirely
- string: Custom CSS to replace defaults
- (default_css) => string: Callback to modify default CSS
variablesTheme variables configuration.
- undefined (default): Use default variables from fuz_css
- null: Disable theme entirely
- Array<StyleVariable>: Custom variable definitions (replaces defaults)
- (defaults) => Array<StyleVariable>: Callback to modify default variables
theme_specificitySpecificity multiplier for theme CSS selectors.
Defaults to 1 which generates :root, higher values generate more specific selectors (e.g., :root:root).
numberadditional_classesClasses to always include in the output, regardless of detection. Useful for dynamically generated class names that can't be statically extracted.
Iterable<string>additional_elementsAdditional HTML elements to always include base styles for.
Use 'all' to include all base styles regardless of detection.
Useful for elements generated at runtime via document.createElement().
Iterable<string> | 'all'additional_variablesAdditional CSS variables to always include in theme output.
Use 'all' to include all theme variables regardless of detection.
Useful for variables referenced dynamically.
Iterable<string> | 'all'exclude_classesClasses to exclude from the output, even if detected. Useful for filtering out false positives from extraction.
Iterable<string>exclude_elementsElements to exclude from base CSS output, even if detected. Useful for filtering out elements you don't want styles for.
Iterable<string>exclude_variablesCSS variables to exclude from theme output, even if referenced. Useful for filtering out variables you don't want in the theme.
Iterable<string>css_bundled_resolution.ts view source
CssResolutionOptions Options for CSS resolution.
style_rule_indexIndex of style.css rules
variable_graphDependency graph for theme variables
class_variable_indexIndex mapping classes to variables
detected_elementsHTML elements detected in source files
Set<string>detected_classesCSS classes detected in source files
Set<string>detected_css_variablesCSS variables directly referenced in source files
Set<string>utility_variables_usedCSS variables used by generated utility classes
Set<string>additional_elementsAdditional elements to always include, or 'all' to include all base styles
Iterable<string> | 'all'additional_variablesAdditional variables to always include, or 'all' to include all theme variables
Iterable<string> | 'all'theme_specificitySpecificity multiplier for theme selector (default 1)
numberinclude_statsWhether to include resolution statistics in result
booleanwarn_unmatched_elementsWarn when detected elements have no matching style rules (default false)
booleanexclude_elementsElements to exclude from base CSS output, even if detected.
Iterable<string>exclude_variablesCSS variables to exclude from theme output, even if referenced.
Iterable<string>explicit_elementsElements explicitly annotated via
Set<string> | nullexplicit_variablesVariables explicitly annotated via
Set<string> | nullcss_bundled_resolution.ts view source
CssResolutionResult Result from CSS resolution.
theme_cssCSS for theme variables (light and dark)
stringbase_cssCSS for base styles (from style.css)
stringresolved_variablesAll resolved variable names (including transitive deps)
Set<string>included_rule_indicesIndices of rules included from the style index
Set<number>included_elementsElement names that were matched
Set<string>diagnosticsDiagnostics from resolution
Array<GenerationDiagnostic>statsResolution statistics (only when include_stats is true)
css_bundled_resolution.ts view source
CssResolutionStats Statistics from CSS resolution (only included when include_stats is true).
element_countNumber of HTML elements included
numberelementsList of HTML element names included
Array<string>included_rulesNumber of rules included from style.css
numbertotal_rulesTotal number of rules in style.css
numbervariable_countNumber of CSS variables resolved (including transitive deps)
number{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100"] "00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" CacheDeps Default filesystem deps using node:fs/promises.
".fuz/cache/css" Default cache directory relative to project root.
Theme Theme[] These are super basic proof-of-concept themes.
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }[] These are implicitly the variables for the base theme.
See also the empty variables array of the base theme above.
(deps: CacheDeps, cache_path: string): Promise<void> Deletes a cached extraction file. Silently succeeds if the file doesn't exist.
depsfilesystem deps for dependency injection
cache_pathabsolute path to the cache file
stringPromise<void> example_class_utilities.ts view source
"mb_xs4" *_class suffix (snake_case)
example_class_utilities.ts view source
"mb_xs3" SCREAMING_SNAKE_CASE naming
example_class_utilities.ts view source
"mb_xl3" *class_list suffix (snake_case)
example_class_utilities.ts view source
"mb_xl5 ml_xl2" *class_lists suffix (snake_case) - plural, multiple classes
example_class_utilities.ts view source
"mb_md" *class_name suffix (snake_case)
example_class_utilities.ts view source
"mb_xl ml_lg" *class_names suffix (snake_case) - plural, multiple classes
example_class_utilities.ts view source
"mb_xs ml_sm" *_classes suffix (snake_case) - plural, multiple classes
example_class_utilities.ts view source
"mb_xs5" *Class suffix (camelCase)
example_class_utilities.ts view source
"mb_xs2 ml_xs" *Classes suffix (camelCase) - plural, multiple classes
example_class_utilities.ts view source
"mb_xl2" *ClassList suffix (camelCase)
example_class_utilities.ts view source
"mb_xl4 ml_xl" *ClassLists suffix (camelCase) - plural, multiple classes
example_class_utilities.ts view source
"mb_sm" *ClassName suffix (camelCase)
example_class_utilities.ts view source
"mb_lg ml_md" *ClassNames suffix (camelCase) - plural, multiple classes
Diagnostic Union of all diagnostic types.
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["xs", "sm", "md", "lg", "xl"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } "xs" | "sm" | "md" | "lg" | "xl" { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } css_class_generation.ts view source
(name: string): string Escapes special characters in a CSS class name for use in a selector.
CSS selectors require escaping of characters like :, %, (, ), etc.
namestringstring escape_css_selector('display:flex') // 'display\\:flex'
escape_css_selector('opacity:80%') // 'opacity\\:80\\%'
escape_css_selector('nth-child(2n)') // 'nth-child\\(2n\\)'(segments: string[], class_name: string): ModifierExtractionResult Extracts and validates modifiers from the beginning of a segments array. Modifiers are consumed from the front until a non-modifier segment is found.
Used by both CSS-literal parsing and modified class interpretation.
segmentsarray of colon-separated segments
string[]class_nameoriginal class name for error messages
stringModifierExtractionResult ModifierExtractionResult with modifiers and remaining segments, or error
(segment: string, prefix: string): string | null Extracts content from balanced parentheses after a prefix. Supports nested parens for calc(), clamp(), min(), max(), etc.
segmentthe full segment to parse (e.g., "min-width(calc(100vw - 200px))")
stringprefixthe prefix before the opening paren (e.g., "min-width")
stringstring | null the content inside the balanced parens, or null if no match/unbalanced
extract_balanced_parens("min-width(800px)", "min-width") // "800px"
extract_balanced_parens("min-width(calc(100vw - 20px))", "min-width") // "calc(100vw - 20px)"
extract_balanced_parens("min-width(calc(100vw)", "min-width") // null (unbalanced)css_class_extractor.ts view source
(source: string, options?: ExtractCssClassesOptions): Set<string> | null Unified extraction function that auto-detects file type. Returns just the class names as a Set.
sourcethe file source code
stringoptionsextraction options
{}Set<string> | null set of class names, or null if none found
css_class_extractor.ts view source
(source: string, options?: ExtractCssClassesOptions): ExtractionResult Unified extraction function that auto-detects file type. Returns full extraction result with locations and diagnostics.
sourcethe file source code
stringoptionsextraction options
{}ExtractionResult full extraction result with classes, tracked variables, and diagnostics
css_ruleset_parser.ts view source
(css: string, rules: ParsedRule[]): string | null Extracts the CSS comment from a ruleset (if any). Looks for comments before the first rule.
cssraw CSS string
stringrulesparsed rules
ParsedRule[]string | null comment text without delimiters, or null if no comment
css_variable_utils.ts view source
(css: string): Set<string> Extracts CSS variable names from a CSS string.
Parses var(--name) patterns and returns the variable names
without the -- prefix. Handles fallback values by extracting
only the primary variable reference.
cssCSS string potentially containing var(--*) references
stringSet<string> set of variable names (without -- prefix)
extract_css_variables('color: var(--text_color);')
// โ Set { 'text_color' }
extract_css_variables('background: var(--bg_1, var(--bg_2));')
// โ Set { 'bg_1', 'bg_2' }
extract_css_variables('padding: 1rem;')
// โ Set {}css_class_extractor.ts view source
(source: string, file?: string): ExtractionResult Extracts CSS classes from a Svelte file using AST parsing.
sourcethe Svelte file source code
stringfilefile path for location tracking
string'<unknown>'ExtractionResult extraction result with classes, tracked variables, elements, and diagnostics
css_class_extractor.ts view source
(source: string, file?: string, acorn_plugins?: AcornPlugin[] | undefined): ExtractionResult Extracts CSS classes from a TypeScript/JS file using AST parsing.
sourcethe TS/JS file source code
stringfilefile path for location tracking
string'<unknown>'acorn_plugins?additional acorn plugins (e.g., acorn-jsx for React)
AcornPlugin[] | undefinedExtractionResult extraction result with classes, tracked variables, elements, and diagnostics
css_class_generation.ts view source
(declaration: string): string | null Extracts the CSS property name from a single-property declaration string.
Returns null for multi-property declarations (composites with multiple semicolons).
declarationstringstring | null extract_primary_property('border-radius: var(--border_radius_sm);') // 'border-radius'
extract_primary_property('display: flex; align-items: center;') // null(class_name: string): string[] Extracts colon-separated segments from a class name, handling parentheses. Parenthesized content (like function arguments) is kept intact.
class_namestringstring[] extract_segments('md:hover:display:flex') // โ ['md', 'hover', 'display', 'flex']
extract_segments('nth-child(2n+1):color:red') // โ ['nth-child(2n+1)', 'color', 'red']
extract_segments('width:calc(100%-20px)') // โ ['width', 'calc(100%-20px)']css_class_extractor.ts view source
ExtractCssClassesOptions Options for CSS class extraction.
filenameFile path used to determine extraction method (Svelte vs TS) and for location tracking in diagnostics.
stringacorn_pluginsAdditional acorn plugins to use when parsing TS/JS files.
Useful for adding JSX support via acorn-jsx for React projects.
Array<AcornPlugin>ExtractedModifiers Extracted modifiers from a class name. Used by both CSS-literal parsing and modified class interpretation.
mediaMedia modifier (breakpoint or feature query)
ModifierDefinition | nullancestorAncestor modifier (dark/light)
ModifierDefinition | nullstatesState modifiers in alphabetical order (can have multiple)
Array<ModifierDefinition>pseudo_elementPseudo-element modifier (before, after, etc.)
ModifierDefinition | nullcss_class_extractor.ts view source
ExtractionData Cacheable extraction data fields shared between extraction and caching layers.
Uses null instead of empty collections to avoid allocation overhead.
classesMap from class name to locations where it was used, or null if none. Keys = unique classes, values = locations for diagnostics/IDE integration.
Map<string, Array<SourceLocation>> | nullexplicit_classesClasses explicitly annotated via @fuz-classes comments, or null if none.
These produce errors if they can't be resolved during generation.
Set<string> | nulldiagnosticsDiagnostics from the extraction phase, or null if none
Array<ExtractionDiagnostic> | nullelementsHTML elements found in the file, or null if none. Used for including only the style.css rules needed.
Set<string> | nullexplicit_elementsElements explicitly annotated via @fuz-elements comments, or null if none.
These should produce errors if they have no matching style rules.
Set<string> | nullexplicit_variablesVariables explicitly annotated via @fuz-variables comments, or null if none.
These produce errors if they can't be resolved to theme variables.
Set<string> | nullExtractionDiagnostic Diagnostic from the extraction phase.
phase'extraction'locationcss_class_extractor.ts view source
ExtractionResult Extraction result with classes mapped to their source locations.
Extends ExtractionData with tracked_vars which is internal to AST walking.
Uses embedded diagnostics (rather than a Result type) because file extraction can partially succeed: some classes may be extracted while others produce errors. This differs from CssLiteralParseResult which uses a discriminated union because single-class parsing is binary success/failure.
tracked_varsVariables that were used in class contexts, or null if none
Set<string> | null{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } FileFilter Filter function to determine which files to process for CSS class extraction.
(path: string): boolean Default file filter for CSS class extraction.
Includes .svelte, .html, .ts, .js, .tsx, .jsx files.
Excludes test files (.test.ts, .spec.ts) and generated files (.gen.ts).
Excludes files in test directories (/test/, /tests/, /__tests__/, /__mocks__/).
pathstringboolean css_ruleset_parser.ts view source
(selector: string, class_pos: number): number Finds the end position of the compound selector containing the class at class_pos. A compound selector is a sequence of simple selectors without combinators.
selectorthe CSS selector string
stringclass_posposition of the . in .class_name
numbernumber position where state modifiers should be inserted (before any pseudo-element)
(graph: VariableDependencyGraph, name: string): string | null Finds the most similar variable in the graph to the given name. Returns null if no variable exceeds the similarity threshold.
graphthe variable dependency graph
namethe variable name to find similar matches for
stringstring | null the most similar variable name, or null if none are similar enough
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["font_family_sans", "font_family_serif", "font_family_mono"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } string[] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["xs", "sm", "md", "lg", "xl", "xl2", "xl3", "xl4", "xl5", "xl6", "xl7", "xl8", "xl9"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } "font_family_sans" | "font_family_serif" | "font_family_mono" (value: string): string Formats a CSS-literal value for CSS output.
- Replaces ~ with space
- Ensures space before !important
valueraw value from class name
stringstring formatted CSS value
(d: Diagnostic): string Formats a diagnostic for display.
dstring css_class_generators.ts view source
(value: string): string Format width/height values for CSS (handles 0, auto, percentages, pixels, content values, and CSS variables). Used by width and height properties.
valuestringstring css_class_generators.ts view source
(value: string): string Format spacing values for CSS (handles 0, auto, percentages, pixels, and CSS variables). Used by margin, padding, gap, inset, top/right/bottom/left, etc.
valuestringstring css_class_generators.ts view source
(str: string): string strstringstring (cached: CachedExtraction): ExtractionData Converts a cached extraction back to the runtime format. Preserves null semantics (null = empty).
cachedcached extraction data
ExtractionData example_class_utilities.ts view source
"shadow_lg" Comment hint - extracted via
vite_plugin_fuz_css.ts view source
"/* generated by vite_plugin_fuz_css */" Banner comment at the top and bottom of generated CSS output.
(options?: GenFuzCssOptions): Gen options{}Gen style_rule_parser.ts view source
(index: StyleRuleIndex, included_indices: Set<number>): string Generates CSS from a StyleRuleIndex with only the included rules.
indexthe StyleRuleIndex
included_indicesset of rule indices to include
Set<number>string CSS string with only included rules, in original order
css_class_generators.ts view source
(values: Iterable<string>, formatter?: ((value: string) => string) | undefined): Record<string, CssClassDefinition> Generate border radius corner classes for all four corners. Creates classes for top-left, top-right, bottom-left, bottom-right corners.
valuesthe values to generate classes for
Iterable<string>formatter?optional function to format values
((value: string) => string) | undefinedRecord<string, CssClassDefinition> css_bundled_resolution.ts view source
(result: CssResolutionResult, utility_css: string, options?: GenerateBundledCssOptions): string Generates combined CSS output from resolution result.
resultresolution result from resolve_css
utility_cssgenerated utility CSS (from generate_classes_css)
stringoptionsoutput options
{}string combined CSS string
css_class_generators.ts view source
<T1 = string, T2 = string, T3 = string>(template: ClassTemplateFn<T1, T2, T3>, values: Iterable<T1>, secondary?: Iterable<T2> | undefined, tertiary?: Iterable<...> | undefined): Record<...> Generates CSS class declarations from templates. Supports up to 3 dimensions of multiplicative combinations.
templatefunction that generates CSS from values, can return null to skip
ClassTemplateFn<T1, T2, T3>valuesprimary iterable of values
Iterable<T1>secondary?optional second dimension (makes it multiplicative)
Iterable<T2> | undefinedtertiary?optional third dimension for even more combinations
Iterable<T3> | undefinedRecord<string, CssClassDefinition> // Simple list
generate_classes(
v => ({ name: `position_${v}`, css: `position: ${v};` }),
['static', 'relative', 'absolute']
)// Two dimensions (multiplicative)
generate_classes(
(dir, size) => ({ name: `m${dir}_${size}`, css: `margin-${dir}: ${size};` }),
['top', 'bottom'],
['0', '1px', '2px']
)css_class_generation.ts view source
(options: GenerateClassesCssOptions): GenerateClassesCssResult optionsGenerateClassesCssResult (output: CssLiteralOutput): string Generates simple CSS for a CSS-literal class (without grouping). Used by the interpreter for basic output.
outputthe CSS-literal output info
string CSS string for this class
(parsed: ParsedCssLiteral): string Generates the CSS declaration for a parsed CSS-literal class.
parsedstring css_class_generators.ts view source
(property: string, values: Iterable<string>, formatter?: ((v: string) => string) | undefined): Record<string, CssClassDefinition> Generate directional classes for properties like margin and padding. Creates classes for all directions: base, top, right, bottom, left, x (horizontal), y (vertical).
propertythe base CSS property name (e.g. 'margin', 'padding')
stringvaluesthe values to generate classes for
Iterable<string>formatter?optional function to format values (defaults to identity)
((v: string) => string) | undefinedRecord<string, CssClassDefinition> css_ruleset_parser.ts view source
(original_ruleset: string, original_class: string, new_class_escaped: string, state_css: string, pseudo_element_css: string, media_wrapper: string | null, ancestor_wrapper: string | null): ModifiedRulesetResult Generates CSS for a modified ruleset with applied modifiers.
Conflict handling is per-selector within selector lists:
- For .plain:hover, .plain:active with hover: modifier, only .plain:hover skips
the :hover addition; .plain:active still gets :hover appended.
- For multiple states like :hover:focus, each is checked individually; conflicting
states are skipped while non-conflicting ones are still applied.
original_rulesetthe original CSS ruleset string
stringoriginal_classthe base class name
stringnew_class_escapedthe escaped new class name with modifiers
stringstate_cssstate modifier CSS (e.g., ":hover" or ":hover:focus")
stringpseudo_element_csspseudo-element modifier CSS (e.g., "::before")
stringmedia_wrappermedia query wrapper (e.g., "@media (width >= 48rem)")
string | nullancestor_wrapperancestor wrapper (e.g., ":root.dark")
string | nullModifiedRulesetResult result with generated CSS and information about skipped modifiers
css_class_generators.ts view source
(property: string, values: Iterable<string>, formatter?: ((value: string) => string) | undefined, prefix?: string): Record<string, CssClassDefinition> Generate classes for a single CSS property with various values.
propertythe CSS property name (e.g. 'font-size', 'gap')
stringvaluesthe values to generate classes for
Iterable<string>formatter?optional function to format values (e.g. v => var(--space_${v}))
((value: string) => string) | undefinedprefixoptional class name prefix (defaults to property with dashes replaced by underscores)
stringformat_variable_name(property)Record<string, CssClassDefinition> (escaped_class_name: string, parsed: ParsedCssLiteral): string Generates the CSS selector for a parsed CSS-literal class. Includes state pseudo-classes and pseudo-element in the selector.
escaped_class_namestringparsedstring css_class_generators.ts view source
(sizes: Iterable<string>, alpha_mapping: Record<string, string>): Record<string, CssClassDefinition> Generate shadow classes for various shadow types and sizes. Creates classes for regular, top, bottom, inset, inset-top, and inset-bottom shadows. Each shadow uses color-mix with alpha values for transparency.
sizesthe shadow size variants (xs, sm, md, lg, xl)
Iterable<string>alpha_mappingmapping of sizes to alpha numbers (1-5)
Record<string, string>Record<string, CssClassDefinition> (graph: VariableDependencyGraph, resolved_variables: Set<string>, specificity?: number): { light_css: string; dark_css: string; } Generates theme CSS for the resolved variables.
graphthe variable dependency graph
resolved_variablesset of variable names to include
Set<string>specificitynumber of times to repeat the selector (default 1)
number1{ light_css: string; dark_css: string; } object with light_css and dark_css strings
css_bundled_resolution.ts view source
GenerateBundledCssOptions Options for bundled CSS output generation.
include_themeInclude theme variables section.
booleaninclude_baseInclude base styles section.
booleaninclude_utilitiesInclude utility classes section.
booleancss_class_generation.ts view source
GenerateClassesCssOptions class_namesIterable<string>class_definitionsRecord<string, CssClassDefinition | undefined>interpretersArray<CssClassDefinitionInterpreter>css_propertiesValid CSS properties for literal validation, or null to skip validation
Set<string> | nulllogLoggerclass_locationsMap<string, Array<SourceLocation> | null>explicit_classesClasses that were explicitly annotated (via
Set<string> | nullcss_class_generation.ts view source
GenerateClassesCssResult Result from CSS class generation.
cssstringdiagnosticsArray<GenerationDiagnostic>variables_usedCSS variables used by the generated classes (without -- prefix)
Set<string>css_class_generators.ts view source
GeneratedClassResult GenerationDiagnostic Diagnostic from the generation phase.
phase'generation'level'error' | 'warning'messagestringsuggestionstring | nullidentifierThe class name, element name, or variable name this diagnostic refers to
stringlocationsSource locations where this class was used, or null if from additional_classes
Array<SourceLocation> | nullGenFuzCssOptions Options for the Gro CSS generator. Extends the shared base options with Gro-specific settings.
include_statsWhether to include file and resolution statistics in the output.
booleanproject_rootProject root directory. Source paths must be under this directory.
stringconcurrencyMax concurrent file processing (cache read + extract). Bottlenecked by CPU-bound AST parsing.
numbercache_io_concurrencyMax concurrent cache writes and deletes (I/O-bound).
number(): string[] Gets all modifier names for error message suggestions.
string[] (graph: VariableDependencyGraph): Set<string> Gets all variable names from the graph.
graphthe variable dependency graph
Set<string> set of all variable names in the graph
(source_path: string, cache_dir: string, project_root: string): string Computes the cache file path for a source file.
Cache structure mirrors source tree: src/lib/Foo.svelte โ .fuz/cache/css/src/lib/Foo.svelte.json
source_pathabsolute path to the source file
stringcache_dirabsolute path to the cache directory
stringproject_rootnormalized project root (must end with /)
stringstring class_variable_index.ts view source
(index: CssClassVariableIndex, class_name: string): Set<string> | null Gets variables used by a specific class.
indexthe class variable index
class_namename of the class to lookup
stringSet<string> | null set of variable names (without -- prefix), or null if class not found
class_variable_index.ts view source
(index: CssClassVariableIndex, variable_name: string): string[] Gets all class names that use a specific variable.
indexthe class variable index
variable_namevariable name to search for (without -- prefix)
stringstring[] array of class names that use this variable
(file_id: string, cache_dir: string, project_root: string): string Computes cache path for a file, handling both internal and external paths.
Internal files use relative paths mirroring source tree.
External files (outside project root) use hashed absolute paths in _external/.
file_idabsolute path to the source file
stringcache_dirabsolute path to the cache directory
stringproject_rootnormalized project root (must end with /)
stringstring style_rule_parser.ts view source
(index: StyleRuleIndex, detected_elements: Set<string>, detected_classes: Set<string>): Set<number> Gets rules that should be included based on detected elements and classes.
indexthe StyleRuleIndex to query
detected_elementsset of HTML element names found in source
Set<string>detected_classesset of CSS class names found in source
Set<string>Set<number> set of rule indices to include
(segment: string): (ModifierDefinition & { is_arbitrary?: boolean | undefined; }) | null Gets the modifier definition for a segment. Handles both static modifiers and dynamic patterns (arbitrary breakpoints, parameterized states).
segmentstring(ModifierDefinition & { is_arbitrary?: boolean | undefined; }) | null the modifier definition or null if not a known modifier
css_variable_utils.ts view source
(css: string): boolean Checks if a CSS string contains any CSS variable references.
More efficient than extract_css_variables when you only need to know if variables exist, not what they are.
cssCSS string to check
stringboolean true if the string contains var(--*) patterns
(modifiers: ExtractedModifiers): boolean Checks if extracted modifiers contain any modifier. Useful for tooling that needs to detect modified classes.
modifiersboolean css_class_extractor.ts view source
(data: ExtractionData): boolean Returns true if the extraction data has any non-null fields.
databoolean (parsed: ParsedCssLiteral): boolean Checks if a parsed CSS literal has any modifiers.
parsedboolean (graph: VariableDependencyGraph, name: string): boolean Checks if a variable exists in the graph.
graphthe variable dependency graph
namevariable name to check (without -- prefix)
stringboolean true if the variable exists in the graph
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["xs", "sm", "md", "lg", "xl", "xl2", "xl3"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { icon_size_xs: string; icon_size_sm: string; icon_size_md: string; icon_size_lg: string; icon_size_xl: string; icon_size_xl2: string; icon_size_xl3: string; } "xs" | "sm" | "md" | "lg" | "xl" | "xl2" | "xl3" { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100"] "00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" (class_name: string, escaped_class_name: string, css_properties: Set<string> | null): InterpretCssLiteralResult Interprets a CSS-literal class and returns CSS generation info.
Callers should first check is_possible_css_literal() to filter non-CSS-literal classes.
class_namethe class name to interpret
stringescaped_class_namethe CSS-escaped version of the class name
stringcss_propertiesset of valid CSS properties from load_css_properties().
Pass null to skip property validation.
Set<string> | nullInterpretCssLiteralResult result with output and warnings on success, or error on failure
InterpretCssLiteralResult Result of interpreting a CSS-literal class.
Uses | null for warnings to avoid allocating empty arrays.
Callers should use a guard pattern: if (result.warnings) { ... }
InterpreterDiagnostic Diagnostic from CSS class interpretation. Used internally by interpreters; converted to GenerationDiagnostic with locations.
level'error' | 'warning'messagestringidentifierThe class name, element name, or variable name this diagnostic refers to
stringsuggestionstring | null(class_name: string): boolean Checks if a class name could be a CSS-literal class. Quick check before attempting full parse.
class_namethe class name to check
stringboolean true if it could be CSS-literal syntax
css_ruleset_parser.ts view source
(rules: ParsedRule[], escaped_class_name: string): boolean Checks if a ruleset has only a single simple selector (just the class name). Used to detect rulesets that could be converted to declaration format.
rulesparsed rules from the ruleset
ParsedRule[]escaped_class_namethe CSS-escaped class name (e.g., "box" or "hover\\:card")
stringboolean true if there's exactly one rule with selector ".class_name"
(property: string, properties: Set<string> | null): boolean Checks if a property name is a valid CSS property. Custom properties (--*) always return true.
propertythe CSS property name to validate
stringpropertiesset of valid CSS properties from load_css_properties().
Pass null to skip validation.
Set<string> | nullboolean true if valid CSS property or custom property
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } string[] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["xs", "sm", "md", "lg", "xl"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } "xs" | "sm" | "md" | "lg" | "xl" { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } LiteralResolutionResult Result of attempting to resolve a CSS literal for composition.
(deps: CacheDeps, cache_path: string): Promise<CachedExtraction | null> Loads a cached extraction result from disk.
Returns null if the cache is missing, corrupted, or has a version mismatch.
This makes the cache self-healing: any error triggers re-extraction.
depsfilesystem deps for dependency injection
cache_pathabsolute path to the cache file
stringPromise<CachedExtraction | null> (): Promise<Set<string>> Loads CSS properties from @webref/css.
Returns a fresh Set each time - callers should cache the result if needed.
Promise<Set<string>> style_rule_parser.ts view source
(deps: CacheDeps, style_css_path?: string | undefined): Promise<string> Loads the raw default style.css content.
depsfilesystem deps for dependency injection
style_css_path?path to style.css (defaults to package's style.css)
string | undefinedPromise<string> promise resolving to the CSS string
style_rule_parser.ts view source
(deps: CacheDeps, style_css_path?: string | undefined): Promise<StyleRuleIndex> Loads and parses the default style.css file.
depsfilesystem deps for dependency injection
style_css_path?path to style.css (defaults to package's style.css)
string | undefinedPromise<StyleRuleIndex> promise resolving to StyleRuleIndex
example_class_utilities.ts view source
"mt_md" Logical AND - truthy value extracted
Map<string, ModifierDefinition> Map of media modifier names to their CSS output
css_class_definitions.ts view source
(user_definitions: Record<string, CssClassDefinition | undefined> | undefined, include_defaults: boolean): Record<string, CssClassDefinition | undefined> Merges user class definitions with the built-in defaults. User definitions take precedence over defaults with the same name.
user_definitionsuser-provided class definitions to merge
Record<string, CssClassDefinition | undefined> | undefinedinclude_defaultswhether to include built-in definitions
booleanRecord<string, CssClassDefinition | undefined> merged class definitions
Error - if `include_defaults` is false and no user definitions providedcss_class_interpreters.ts view source
CssClassDefinitionInterpreter Interpreter for modified token/composite classes (e.g., hover:p_md, md:box, dark:hover:panel).
Applies modifiers to existing declaration-based or ruleset-based classes.
This interpreter must run BEFORE css_literal_interpreter to handle cases like hover:box
where box is a known class (not a CSS property).
css_ruleset_parser.ts view source
ModifiedRulesetResult Result from generating a modified ruleset.
Uses | null for skipped_modifiers to avoid allocating empty arrays.
Callers should use a guard pattern: if (result.skipped_modifiers) { ... }
cssThe generated CSS
stringskipped_modifiersInformation about modifiers that were skipped for certain rules, or null if none
Array<SkippedModifierInfo> | nullcss_ruleset_parser.ts view source
ModifiedSelectorGroupResult Result from modifying a selector group with conflict detection.
Uses | null for skipped_modifiers to avoid allocating empty arrays.
Callers should use a guard pattern: if (result.skipped_modifiers) { ... }
selectorThe modified selector list as a string
stringskipped_modifiersInformation about modifiers skipped for specific selectors, or null if none
Array<SkippedModifierInfo> | nullModifierDefinition Definition for a single modifier.
nameThe prefix used in class names (e.g., 'hover', 'md', 'dark')
stringtypeType determines position in modifier order and CSS output behavior
cssThe CSS output - wrapper for media/ancestor, suffix for state/pseudo-element
stringorderOptional ordering within type (for breakpoints, sorted by this value)
numberModifierExtractionResult Result of extracting modifiers from segments.
ModifierDefinition[] All modifier definitions in a single declarative structure. Adding a new modifier requires only adding to this array.
ModifierType Type of modifier determining its position in the class name and CSS output.
Order in class names: [media:][ancestor:][state...:][pseudo-element:]property:value
css_ruleset_parser.ts view source
(selector_group: string, original_class: string, new_class_escaped: string, states_to_add: string[], pseudo_element_css: string): ModifiedSelectorGroupResult Modifies a selector list (comma-separated selectors) to add modifiers. Handles conflicts per-selector: if one selector in a list has a conflict, only that selector skips the modifier; other selectors still get it.
selector_groupCSS selector list (may contain commas)
stringoriginal_classthe base class name
stringnew_class_escapedthe escaped new class name
stringstates_to_addindividual state modifiers (e.g., [":hover", ":focus"])
string[]pseudo_element_csspseudo-element modifier CSS to insert (e.g., "::before")
stringModifiedSelectorGroupResult result with modified selector list and information about skipped modifiers
css_ruleset_parser.ts view source
(selector: string, original_class: string, new_class_escaped: string, state_css: string, pseudo_element_css: string): string Modifies a single CSS selector to add modifiers.
selectora single CSS selector (not a selector list)
stringoriginal_classthe base class name (e.g., "menu_item")
stringnew_class_escapedthe escaped new class name (e.g., "hover\\:menu_item")
stringstate_cssstate modifier CSS to insert (e.g., ":hover")
stringpseudo_element_csspseudo-element modifier CSS to insert (e.g., "::before")
stringstring modified selector
modify_single_selector('.menu_item', 'menu_item', 'hover\\:menu_item', ':hover', '')
// โ '.hover\\:menu_item:hover'
modify_single_selector('.menu_item .icon', 'menu_item', 'hover\\:menu_item', ':hover', '')
// โ '.hover\\:menu_item:hover .icon'
modify_single_selector('.menu_item.selected', 'menu_item', 'hover\\:menu_item', ':hover', '')
// โ '.hover\\:menu_item.selected:hover'style_rule_parser.ts view source
NonCoreStyleRule A non-core style rule included only when its elements/classes are detected.
is_corefalsecore_reasonnullRegExp Pattern for parameterized nth-child: nth-child(2n+1):
RegExp Pattern for parameterized nth-last-child: nth-last-child(2n+1):
RegExp Pattern for parameterized nth-last-of-type: nth-last-of-type(2n):
RegExp Pattern for parameterized nth-of-type: nth-of-type(2n):
readonly ["00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100"] readonly ["min", "00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100", "max"] "00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" The standard numeric scale used across multiple variable families. Provides 13 steps from 00 (surface/subtle) to 100 (contrast/bold).
"00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" | "min" | "max" Numeric scale with min/max extremes for scales that need untinted endpoints. Used by text and shade scales where min/max represent pure black/white values.
example_class_utilities.ts view source
{ mt_xl2: string; mt_xl3: string; } Object - keys extracted as class names
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["focus", "active"] "focus" | "active" (segment: string): string | null Parses an arbitrary breakpoint modifier. Supports nested parentheses for calc(), clamp(), min(), max(), var(). Requires value to start with a digit or known CSS function to catch obvious mistakes.
segmentstringstring | null the CSS media query or null if not an arbitrary breakpoint
parse_arbitrary_breakpoint("min-width(800px)") // "@media (width >= 800px)"
parse_arbitrary_breakpoint("min-width(calc(100vw - 200px))") // "@media (width >= calc(100vw - 200px))"
parse_arbitrary_breakpoint("min-width(px)") // null (invalid - no digit or function)(class_name: string, css_properties: Set<string> | null): CssLiteralParseResult Parses a CSS-literal class name into its components.
class_namethe class name to parse
stringcss_propertiesset of valid CSS properties from load_css_properties().
Pass null to skip property validation.
Set<string> | nullCssLiteralParseResult CssLiteralParseResult with parsed data or error
(segment: string): { name: string; css: string; type: "state"; } | null Parses a parameterized state modifier (nth-child, nth-last-child, nth-of-type, nth-last-of-type).
segmentstring{ name: string; css: string; type: "state"; } | null object with name (including parameter) and CSS, or null if not parameterized
css_ruleset_parser.ts view source
(css: string): ParsedRuleset Parses a CSS ruleset string using Svelte's CSS parser.
cssraw CSS string (e.g., ".box { display: flex; }")
stringParsedRuleset ParsedRuleset with structured rule data and positions
style_rule_parser.ts view source
(css: string, content_hash: string): StyleRuleIndex Parses a CSS stylesheet into a StyleRuleIndex.
cssraw CSS string (e.g., contents of style.css)
stringcontent_hashhash of the CSS for cache invalidation
stringStyleRuleIndex StyleRuleIndex with rules and lookup maps
ParsedCssLiteral Parsed CSS-literal class with all components extracted.
class_nameOriginal class name
stringmediaMedia modifier (breakpoint or feature query)
ModifierDefinition | nullancestorAncestor modifier (dark/light)
ModifierDefinition | nullstatesState modifiers in alphabetical order (can have multiple)
Array<ModifierDefinition>pseudo_elementPseudo-element modifier (before, after, etc.)
ModifierDefinition | nullpropertyCSS property name
stringvalueCSS value (with ~ replaced by spaces)
stringcss_ruleset_parser.ts view source
ParsedRule A parsed CSS rule with its components and positions.
selectorFull selector string (e.g., ".box", ".selectable:hover")
stringselector_startStart position of selector in original CSS (0-indexed)
numberselector_endEnd position of selector in original CSS
numberdeclarationsThe declarations block (without braces)
stringrule_startStart position of the entire rule
numberrule_endEnd position of the entire rule
numbercss_ruleset_parser.ts view source
ParsedRuleset Result of parsing a CSS ruleset.
rulesAll rules in the ruleset
Array<ParsedRule>Map<string, ModifierDefinition> Map of pseudo-element modifier names to their CSS output
(theme: Theme, options?: RenderThemeStyleOptions): string themeoptions{}string (variable: { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }, dark?: boolean, comments?: boolean): string variable{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }darkbooleanfalsecommentsbooleantruestring RenderThemeStyleOptions commentsbooleanidstring | nullempty_default_themebooleanspecificityRepeats the theme selector to handle unpredictable head content insertion order. Accepts any integer >= 1, defaults to 2.
numberstyle_rule_parser.ts view source
(base_css: BaseCssOption, deps: CacheDeps): Promise<StyleRuleIndex | null> Resolves a base_css option to a StyleRuleIndex.
Handles all option forms: undefined (defaults), null (disabled), string, or callback.
base_cssthe base_css option from generator config
depsfilesystem deps for loading default CSS
Promise<StyleRuleIndex | null> promise resolving to StyleRuleIndex, or null if disabled
css_class_resolution.ts view source
(def: CssClassDefinitionStatic, class_name: string, definitions: Record<string, CssClassDefinition | undefined>, css_properties?: Set<...> | null): ResolveComposesResult Resolves a class definition's declaration, handling composes composition.
If the definition has a composes property, resolves those classes recursively
and combines with any explicit declaration. If no composes, returns the
explicit declaration directly.
defthe class definition to resolve
class_namethe name of the class being resolved (for error messages)
stringdefinitionsrecord of all known class definitions
Record<string, CssClassDefinition | undefined>css_propertiesset of valid CSS properties for literal validation, or null to skip
Set<string> | nullnullResolveComposesResult combined declaration or an error
css_class_resolution.ts view source
(class_names: string[], definitions: Record<string, CssClassDefinition | undefined>, resolution_stack: Set<string>, visited: Set<string>, original_class_name: string, css_properties?: Set<...> | null): ResolveComposesResult Resolves an array of class names to their combined CSS declarations.
Recursively resolves nested composes arrays and combines all declarations.
Validates that referenced classes exist and are resolvable (not rulesets or interpreters).
Supports unmodified CSS literals (e.g., text-align:center) in the composes array.
Deduplication behavior: - Diamond dependencies (class reached via different composition branches) are silently skipped - Redundant listings (class already included by an earlier sibling in this array) emit a warning
class_namesarray of class names to resolve
string[]definitionsrecord of all known class definitions
Record<string, CssClassDefinition | undefined>resolution_stackset of class names currently being resolved (for cycle detection)
Set<string>visitedset of all class names already resolved (for deduplication)
Set<string>original_class_namethe class name being defined (for error messages)
stringcss_propertiesset of valid CSS properties for literal validation, or null to skip
Set<string> | nullnullResolveComposesResult combined declarations or an error
css_bundled_resolution.ts view source
(options: CssResolutionOptions): CssResolutionResult Resolves which CSS to include based on detected usage.
Algorithm: 1. Collect rules: core rules + element-matching + class-matching 2. Collect variables: from rules, class defs, utility generation, detected vars, additional_variables 3. Resolve transitive variable dependencies 4. Generate output: theme_css (light+dark), base_css (source order)
optionsresolution options including indexes, detected usage, and config
CssResolutionResult resolution result with theme CSS, base CSS, and diagnostics
(variables: VariablesOption): { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }[] Resolves a variables option to a concrete array of style variables.
variablesthe variables option (undefined, null, array, or callback)
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; }[] resolved array of style variables, or empty array if null
(graph: VariableDependencyGraph, initial_variables: Iterable<string>): ResolveVariablesResult Resolves variables transitively using DFS with cycle detection. When a variable is requested, all variables it depends on are included. Both light and dark dependencies are always resolved together.
graphthe variable dependency graph
initial_variablesinitial set of variable names to resolve
Iterable<string>ResolveVariablesResult ResolveVariablesResult with all transitive dependencies
css_class_resolution.ts view source
ResolveComposesResult Result from resolving a composes array to combined declarations.
ResolveVariablesResult Result from transitive variable resolution.
variablesAll resolved variable names
Set<string>warningsWarning messages for cycles
Array<string>missingVariable names that were requested but not found in the graph
Set<string>css_ruleset_parser.ts view source
(rules: ParsedRule[], escaped_class_name: string): boolean Checks if any selector in the ruleset contains the expected class name. Used to validate that ruleset definitions match their key.
rulesparsed rules from the ruleset
ParsedRule[]escaped_class_namethe CSS-escaped class name (e.g., "clickable" or "hover\\:card")
stringboolean true if at least one selector contains ".class_name"
(deps: CacheDeps, cache_path: string, content_hash: string, extraction: ExtractionData): Promise<void> Saves an extraction result to the cache. Uses atomic write (temp file + rename) for crash safety. Normalizes empty collections to null to avoid allocation overhead on load.
depsfilesystem deps for dependency injection
cache_pathabsolute path to the cache file
stringcontent_hashSHA-256 hash of the source file contents
stringextractionextraction data to cache
Promise<void> { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["min", "00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100", "max"] readonly ["00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100"] "00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" | "min" | "max" Full shade scale including min/max extremes for untinted surfaces.
"00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["umbra", "highlight", "glow", "shroud"] readonly ["xs", "sm", "md", "lg", "xl"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["shadow_", "shadow_top_", "shadow_bottom_", "shadow_inset_", "shadow_inset_top_", "shadow_inset_bottom_"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } "00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" "umbra" | "highlight" | "glow" | "shroud" "xs" | "sm" | "md" | "lg" | "xl" "xs" | "sm" | "md" | "lg" | "xl" | "xl2" | "xl3" | "xl4" | "xl5" | "xl6" | "xl7" | "xl8" | "xl9" css_ruleset_parser.ts view source
SkippedModifierInfo Information about a modifier that was skipped for a selector during ruleset modification. The selector is still included in output, just without the conflicting modifier applied.
selectorThe specific selector where the modifier was skipped (not the full selector list)
stringreasonReason the modifier was skipped
'pseudo_element_conflict' | 'state_conflict'conflicting_modifierThe conflicting modifier that was not applied (e.g., "::before" or ":hover")
stringcss_class_extractor.ts view source
Helper class for converting character offsets to line/column positions. Svelte template nodes (Comment, Text, ExpressionTag) only have char offsets, so this class enables efficient conversion.
Build: O(n) where n = source length Lookup: O(log m) where m = number of lines (binary search)
line_startstype Array<number>
constructortype new (source: string): SourceIndex
sourcestringget_locationConverts a character offset to a source location.
type (offset: number, file: string): SourceLocation
offset0-based character offset in the source
numberfilefile path for the location
stringSourceLocation with 1-based line and column
SourceLocation Source location for IDE/LSP integration.
filestringline1-based line number
numbercolumn1-based column number
number{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["xs5", "xs4", "xs3", "xs2", "xs", "sm", "md", "lg", "xl", "xl2", "xl3", "xl4", "xl5", "xl6", "xl7", "xl8", "xl9", "xl10", "xl11", "xl12", "xl13", "xl14", "xl15"] { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } "xs" | "sm" | "md" | "lg" | "xl" | "xl2" | "xl3" | "xl4" | "xl5" | "xl6" | "xl7" | "xl8" | "xl9" | "xs5" | "xs4" | "xs3" | "xs2" | "xl10" | "xl11" | "xl12" | "xl13" | "xl14" | "xl15" css_ruleset_parser.ts view source
(selector_group: string): string[] Splits a selector list by commas, respecting parentheses, brackets, and quoted strings.
selector_groupstringstring[] split_selector_list('.a, .b') // โ ['.a', '.b']
split_selector_list('.a:not(.b), .c') // โ ['.a:not(.b)', '.c']
split_selector_list('.a[data-x="a,b"], .c') // โ ['.a[data-x="a,b"]', '.c']Map<string, ModifierDefinition> Map of state modifier names to their CSS output
RegExp style_rule_parser.ts view source
StyleRule A parsed style rule with metadata for filtering.
Discriminated union: check is_core to narrow to CoreStyleRule or NonCoreStyleRule.
All rules have a consistent shape - core_reason is null for non-core rules.
style_rule_parser.ts view source
StyleRuleBase Base fields shared by all style rules.
cssThe full CSS text for this rule (including selector and declarations)
stringelementsHTML element names this rule targets (e.g., 'button', 'input')
Set<string>classesCSS class names this rule targets (e.g., 'unstyled', 'selected')
Set<string>variables_usedCSS variables referenced in declarations
Set<string>orderOriginal order in style.css (for preserving cascade)
numberstyle_rule_parser.ts view source
StyleRuleIndex Index of parsed style rules for efficient lookup.
rulesAll rules in original order
Array<StyleRule>by_elementRules indexed by element name
Map<string, Array<number>>by_classRules indexed by class name
Map<string, Array<number>>content_hashContent hash for cache invalidation
stringZodObject<{ name: ZodString; light: ZodOptional<ZodString>; dark: ZodOptional<ZodString>; summary: ZodOptional<ZodString>; }, $strip> Zod schema for validating StyleVariable objects.
Use safeParse for validation; the StyleVariable type is defined separately
to preserve the Flavored brand on name.
StyleVariableInfo Information about a single style variable and its dependencies.
nameVariable name (without -- prefix)
stringlight_depsVariables referenced in the light value
Set<string>dark_depsVariables referenced in the dark value
Set<string>light_cssThe CSS value for light mode, or undefined if not defined
string | undefineddark_cssThe CSS value for dark mode, or undefined if not defined
string | undefinedZodString (typo: string, properties: Set<string> | null): string | null Suggests a correct property name for a typo using Levenshtein distance.
typothe mistyped property name
stringpropertiesset of valid CSS properties from load_css_properties().
Pass null to skip suggestions.
Set<string> | nullstring | null the suggested property or null if no close match (Levenshtein distance > 2)
(typo: string): string | null Suggests a correct modifier name for a typo using Levenshtein distance.
typothe mistyped modifier name
stringstring | null the suggested modifier or null if no close match (Levenshtein distance > 2)
example_class_utilities.ts view source
"mt_xs" | "mt_sm" Ternary expression - both branches extracted
{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } readonly ["min", "00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100", "max"] readonly ["00", "05", "10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "100"] "00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" | "min" | "max" Full text scale including min/max extremes for knockout text.
"00" | "05" | "10" | "20" | "30" | "40" | "50" | "60" | "70" | "80" | "90" | "95" | "100" Theme namestringvariablesArray<StyleVariable>{ name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } { name: string; light?: string | undefined; dark?: string | undefined; summary?: string | undefined; } (class_name: string, css_properties: Set<string> | null, context_class_name: string): LiteralResolutionResult Attempts to resolve a class name as an unmodified CSS literal for composition.
Used by resolve_composes to support literals in composes arrays.
Returns the declaration if successful, null if not a literal, or an error
if it's a literal with issues (modifiers, invalid property, etc.).
class_namethe class name to try resolving
stringcss_propertiesset of valid CSS properties, or null to skip validation
Set<string> | nullcontext_class_namethe class being defined (for error messages)
stringLiteralResolutionResult resolution result with declaration, or error, or null if not a literal
VariableDependencyGraph Dependency graph for style variables.
variablesMap from variable name to its info
Map<string, StyleVariableInfo>content_hashContent hash for cache invalidation
stringcss_plugin_options.ts view source
VariablesOption Type for the variables option used by CSS generators.
Supports four forms:
- undefined - Use default variables (framework defaults)
- null - Disable theme generation entirely (explicit opt-out)
- Array<StyleVariable> - Custom variables array (replaces defaults)
- (defaults) => Array<StyleVariable> - Callback to modify defaults
See module documentation for the undefined vs null convention.
vite_plugin_fuz_css.ts view source
(options?: VitePluginFuzCssOptions): Plugin$1<any> Creates the fuz_css Vite plugin.
Extracts CSS classes from source files during Vite's transform phase
and generates optimized CSS via the virtual:fuz.css virtual module.
options{}Plugin$1<any> vite_plugin_fuz_css.ts view source
VitePluginFuzCssOptions Options for the fuz_css Vite plugin. Extends the shared base options (no additional Vite-specific options currently needed).
2147483647 Maximum value for CSS z-index property (32-bit signed integer max).