css_class_generators.ts view source
ClassTemplateFn<T1, T2, T3> generics
T1
stringT2
stringT3
string12 declarations
css_class_generators.ts view source
ClassTemplateFn<T1, T2, T3> T1stringT2stringT3stringcss_class_generators.ts view source
readonly ["top", "right", "bottom", "left"] css_class_generators.ts view source
"top" | "right" | "bottom" | "left" 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 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_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_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_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> 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> css_class_generators.ts view source
GeneratedClassResult