css_class_generation.ts

CSS class generation utilities.

Produces CSS output from class definitions, handles interpretation of dynamic classes, and provides collection management for extracted classes.

Declarations
#

12 declarations

view source

CssClassDefinition
#

CssClassDefinitionBase
#

CssClassDefinitionComposition
#

CssClassDefinitionDeclaration
#

CssClassDefinitionInterpreter
#

css_class_generation.ts view source

CssClassDefinitionInterpreter

Interpreter for dynamic CSS class generation based on pattern matching.

inheritance

pattern

type RegExp

interpret

type (matched: RegExpMatchArray, ctx: CssClassInterpreterContext) => string | null

CssClassDefinitionRuleset
#

CssClassDefinitionStatic
#

CssClassInterpreterContext
#

css_class_generation.ts view source

CssClassInterpreterContext

Context passed to CSS class interpreters. Provides access to logging, diagnostics collection, and the class registry.

log

Optional logger for warnings/errors

type Logger

diagnostics

Diagnostics array to collect warnings and errors

type Array<InterpreterDiagnostic>

class_definitions

All known CSS class definitions (token + composite classes)

type Record<string, CssClassDefinition | undefined>

css_properties

Valid CSS properties for literal validation, or null to skip validation

type Set<string> | null

escape_css_selector
#

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.

name

type string

returns

string

examples

Example 1

generate_classes_css
#

GenerateClassesCssOptions
#

css_class_generation.ts view source

GenerateClassesCssOptions

class_names

type Iterable<string>

class_definitions

type Record<string, CssClassDefinition | undefined>

interpreters

type Array<CssClassDefinitionInterpreter>

css_properties

Valid CSS properties for literal validation, or null to skip validation

type Set<string> | null

log

type Logger

class_locations

type Map<string, Array<SourceLocation> | null>

explicit_classes

Classes that were explicitly annotated (via

type Set<string> | null

GenerateClassesCssResult
#

Depends on
#

Imported by
#