API reference
On this page 459
Every declaration below is extracted from zig-crosswind's source, with the doc comments as written there. A declaration listed without prose is public but undocumented in the source.
Root
types
const types = @import("core/types.zig")
allocator
const allocator = @import("core/allocator.zig")
string
const string = @import("utils/string.zig")
config
const config = @import("config/schema.zig")
config_loader
const config_loader = @import("config/loader.zig")
theme
const theme = @import("config/theme.zig")
Scanner
const Scanner = @import("scanner/scanner.zig").Scanner
FileScanner
const FileScanner = @import("scanner/file_scanner.zig").FileScanner
ContentExtractor
const ContentExtractor = @import("scanner/content_extractor.zig").ContentExtractor
class_parser
const class_parser = @import("parser/class_parser.zig")
ParsedClass
const ParsedClass = class_parser.ParsedClass
theme_reference
const theme_reference = @import("parser/theme_reference.zig")
grouped_syntax
const grouped_syntax = @import("parser/grouped_syntax.zig")
FileCache
const FileCache = @import("cache/file_cache.zig").FileCache
css_variable
const css_variable = @import("validator/css_variable.zig")
variant_registry
const variant_registry = @import("variants/registry.zig")
CSSGenerator
const CSSGenerator = @import("generator/css_generator.zig").CSSGenerator
CSSRule
const CSSRule = @import("generator/css_generator.zig").CSSRule
colors
const colors = @import("generator/colors.zig")
backgrounds
const backgrounds = @import("generator/backgrounds.zig")
borders
const borders = @import("generator/borders.zig")
sizing
const sizing = @import("generator/sizing.zig")
spacing
const spacing = @import("generator/spacing.zig")
typography
const typography = @import("generator/typography.zig")
layout
const layout = @import("generator/layout.zig")
flexbox
const flexbox = @import("generator/flexbox.zig")
grid
const grid = @import("generator/grid.zig")
shadows
const shadows = @import("generator/shadows.zig")
blend
const blend = @import("generator/blend.zig")
transforms
const transforms = @import("generator/transforms.zig")
filters
const filters = @import("generator/filters.zig")
transitions
const transitions = @import("generator/transitions.zig")
animations
const animations = @import("generator/animations.zig")
resets
const resets = @import("generator/resets.zig")
Plugin
const Plugin = @import("plugin/plugin.zig").Plugin
PluginContext
const PluginContext = @import("plugin/plugin.zig").PluginContext
PluginRegistry
const PluginRegistry = @import("plugin/plugin.zig").PluginRegistry
typographyPlugin
const typographyPlugin = @import("plugin/typography.zig").typographyPlugin
formsPlugin
const formsPlugin = @import("plugin/forms.zig").formsPlugin
CssError
const CssError = types.CssError
cssConfig
const cssConfig = config.cssConfig
BuildMode
const BuildMode = config.BuildMode
ClassName
const ClassName = types.ClassName
ScanResult
const ScanResult = types.ScanResult
version
const version = "0.1.0"
version_major
const version_major = 0
version_minor
const version_minor = 1
version_patch
const version_patch = 0
Css
const Css = struct
Initialize zig-css with configuration
init
fn init(alloc: std.mem.Allocator, io: std.Io, cfg: cssConfig) !Css
deinit
fn deinit(self: *Css) void
build
fn build(self: *Css) ![]const u8
Build CSS from configuration
getStats
fn getStats(self: *const Css) types.Stats
Get statistics
ConfigResult
const ConfigResult = config_loader.ConfigResult
loadConfigResult
fn loadConfigResult(alloc: std.mem.Allocator) !ConfigResult
Load configuration from default locations Returns ConfigResult which must be deinitialized by caller
loadConfigResultWithOptions
fn loadConfigResultWithOptions(
Load configuration with custom options Returns ConfigResult which must be deinitialized by caller
loadConfig
fn loadConfig(alloc: std.mem.Allocator) !cssConfig
Load configuration from default locations DEPRECATED: Use loadConfigResult() instead
loadConfigWithOptions
fn loadConfigWithOptions(
Load configuration with custom options DEPRECATED: Use loadConfigResultWithOptions() instead
types
CssError
const CssError = error
Fundamental error set for zig-css
ClassName
const ClassName = struct
Represents a utility class name that was extracted
deinit
fn deinit(self: *ClassName, allocator: std.mem.Allocator) void
SourceLocation
const SourceLocation = struct
Source location for debugging and error reporting
CSSRule
const CSSRule = struct
Represents a CSS rule
deinit
fn deinit(self: *CSSRule, allocator: std.mem.Allocator) void
Layer
const Layer = enum
CSS cascade layers
toString
fn toString(self: Layer) []const u8
BuildMode
const BuildMode = enum
Build mode for output optimization
shouldMinify
fn shouldMinify(self: BuildMode) bool
FileContent
const FileContent = struct
Represents extracted content from a file
deinit
fn deinit(self: *FileContent, allocator: std.mem.Allocator) void
CacheEntry
const CacheEntry = struct
Cache entry for processed files
deinit
fn deinit(self: *CacheEntry, allocator: std.mem.Allocator) void
ScanResult
const ScanResult = struct
Scan result containing all extracted classes
deinit
fn deinit(self: *ScanResult, allocator: std.mem.Allocator) void
Plugin
const Plugin = struct
Plugin interface
Variant
const Variant = struct
Represents a variant modifier
MemoryPool
const MemoryPool = struct
Memory pool for efficient allocation
init
fn init(backing_allocator: std.mem.Allocator) MemoryPool
allocator
fn allocator(self: *MemoryPool) std.mem.Allocator
deinit
fn deinit(self: *MemoryPool) void
reset
fn reset(self: *MemoryPool) void
Stats
const Stats = struct
Statistics for performance monitoring
report
fn report(self: Stats) void
allocator
AllocatorManager
const AllocatorManager = struct
Centralized allocator management for zig-css
init
fn init(base_allocator: std.mem.Allocator) AllocatorManager
requestAllocator
fn requestAllocator(self: *AllocatorManager) !std.mem.Allocator
Get allocator for request-scoped operations This arena will be reset between requests
resetRequest
fn resetRequest(self: *AllocatorManager) void
Reset request arena (call between build cycles)
baseAllocator
fn baseAllocator(self: *AllocatorManager) std.mem.Allocator
Get base allocator for long-lived allocations
deinit
fn deinit(self: *AllocatorManager) void
StringPool
const StringPool = struct
String pool for deduplication and interning
init
fn init(allocator: std.mem.Allocator) StringPool
intern
fn intern(self: *StringPool, str: []const u8) ![]const u8
Intern a string - returns a deduplicated copy
contains
fn contains(self: *StringPool, str: []const u8) bool
Check if string is already interned
count
fn count(self: *StringPool) usize
Get the number of unique strings
deinit
fn deinit(self: *StringPool) void
ObjectPool
fn ObjectPool(comptime T: type) type
Object pool for reusing allocations
init
fn init(allocator: std.mem.Allocator) Self
acquire
fn acquire(self: *Self) !*T
Acquire an object from the pool
release
fn release(self: *Self, obj: *T) !void
Release an object back to the pool
deinit
fn deinit(self: *Self) void
string
hashString
fn hashString(str: []const u8) u64
Fast string hashing using FNV-1a
StringBuilder
const StringBuilder = struct
StringBuilder for efficient string concatenation
init
fn init(allocator: std.mem.Allocator) StringBuilder
initCapacity
fn initCapacity(allocator: std.mem.Allocator, capacity: usize) !StringBuilder
append
fn append(self: *StringBuilder, str: []const u8) !void
appendChar
fn appendChar(self: *StringBuilder, char: u8) !void
clear
fn clear(self: *StringBuilder) void
toString
fn toString(self: *StringBuilder) []const u8
toOwnedSlice
fn toOwnedSlice(self: *StringBuilder) ![]u8
len
fn len(self: *const StringBuilder) usize
pop
fn pop(self: *StringBuilder) ?u8
deinit
fn deinit(self: *StringBuilder) void
toKebabCase
fn toKebabCase(allocator: std.mem.Allocator, str: []const u8) ![]u8
Case conversion utilities
toCamelCase
fn toCamelCase(allocator: std.mem.Allocator, str: []const u8) ![]u8
split
fn split(allocator: std.mem.Allocator, str: []const u8, delimiter: u8) ![][]const u8
Split string by delimiter
trim
fn trim(str: []const u8) []const u8
Trim whitespace from both ends
escapeCSSString
fn escapeCSSString(allocator: std.mem.Allocator, str: []const u8) ![]u8
Escape string for CSS
contains
fn contains(haystack: []const u8, needle: []const u8) bool
Check if string contains substring
startsWith
fn startsWith(str: []const u8, prefix: []const u8) bool
Check if string starts with prefix
endsWith
fn endsWith(str: []const u8, suffix: []const u8) bool
Check if string ends with suffix
config
cssConfig
const cssConfig = struct
zig-css configuration schema This uses zig-config for loading and merging configuration
ContentConfig
const ContentConfig = struct
ThemeConfig
const ThemeConfig = struct
BuildConfig
const BuildConfig = struct
BuildMode
const BuildMode = enum
PluginConfig
const PluginConfig = struct
CacheConfig
const CacheConfig = struct
DarkModeConfig
const DarkModeConfig = struct
DarkModeStrategy
const DarkModeStrategy = enum
AttributifyConfig
const AttributifyConfig = struct
Attributify mode configuration Allows using utility classes as HTML attributes Example:
GroupedSyntaxConfig
const GroupedSyntaxConfig = struct
Grouped syntax configuration (UnunuraCSS-style) Allows grouping utilities with brackets and colon syntax Example: flex[col jc-center ai-center] or bg:black
CorePluginsConfig
const CorePluginsConfig = struct
defaultConfig
fn defaultConfig() cssConfig
Default configuration
validate
fn validate(config: *const cssConfig) !void
Validate configuration
config_loader
ConfigResult
const ConfigResult = zig_config.ConfigResult(schema.cssConfig)
loadConfigResult
fn loadConfigResult(allocator: std.mem.Allocator, options: LoadOptions) !ConfigResult
Load zig-css configuration using zig-config Returns the full ConfigResult which must be deinitialized by the caller
loadConfig
fn loadConfig(allocator: std.mem.Allocator, options: LoadOptions) !schema.cssConfig
Load zig-css configuration using zig-config Note: The returned config owns its memory. Strings and arrays in the config must be freed by the caller using the same allocator. DEPRECATED: Use loadConfigResult() instead and call deinit() on the result WARNING: This function leaks memory - the ConfigResult is not properly cleaned up
LoadOptions
const LoadOptions = struct
findConfigFile
fn findConfigFile(allocator: std.mem.Allocator, cwd: ?[]const u8) !?[]const u8
Find configuration file
theme
ThemeConfig
const ThemeConfig = struct
Theme configuration structure Supports Tailwind-style theme values with nested paths
init
fn init(allocator: std.mem.Allocator) ThemeConfig
deinit
fn deinit(self: *ThemeConfig) void
resolve
fn resolve(self: *const ThemeConfig, path: []const u8) ?[]const u8
Resolve a theme path to its value Example: "colors.blue.500" -> "#3b82f6"
createDefault
fn createDefault(allocator: std.mem.Allocator) !ThemeConfig
Create default Tailwind theme
ThemeValue
const ThemeValue = union(enum)
Theme value (can be string or nested object)
deinit
fn deinit(self: *ThemeValue, allocator: std.mem.Allocator) void
asString
fn asString(self: *const ThemeValue) ?[]const u8
Scanner
Scanner
const Scanner = struct
Main scanner that coordinates file scanning and class extraction
ScanConfig
const ScanConfig = struct
Stats
const Stats = struct
report
fn report(self: *const Stats) void
init
fn init(allocator: std.mem.Allocator, io: std.Io, config: ScanConfig) Scanner
deinit
fn deinit(self: *Scanner) void
scan
fn scan(self: *Scanner) ![][]const u8
Scan all files and extract class names OPTIMIZED: Uses arena allocator for temporary allocations
clearCache
fn clearCache(self: *Scanner) !void
Clear cache
getStats
fn getStats(self: *const Scanner) Stats
Get statistics
FileScanner
FileScanner
const FileScanner = struct
File scanner for discovering source files
init
fn init(
scan
fn scan(self: *FileScanner) ![][]const u8
Scan all files matching include patterns
matchGlob
fn matchGlob(text: []const u8, pattern: []const u8) bool
Simple glob pattern matching
getExtension
fn getExtension(filename: []const u8) ?[]const u8
Get file extension
hasExtension
fn hasExtension(filename: []const u8, extensions: []const []const u8) bool
Check if file has one of the given extensions
ContentExtractor
ContentExtractor
const ContentExtractor = struct
Extract CSS class names from various file formats
init
fn init(allocator: std.mem.Allocator, io: std.Io) ContentExtractor
initWithConfig
fn initWithConfig(
extractFromFile
fn extractFromFile(self: *ContentExtractor, file_path: []const u8) ![][]const u8
Extract class names from a file
class_parser
VariantInfo
const VariantInfo = struct
Variant with optional name (for group/name or peer/name)
ParsedClass
const ParsedClass = struct
Parsed CSS class with variants
deinit
fn deinit(self: *ParsedClass, allocator: std.mem.Allocator) void
parseClass
fn parseClass(allocator: std.mem.Allocator, class_str: []const u8) !ParsedClass
Parse a CSS class string into components OPTIMIZED: Single-pass algorithm with state machine
parseUtility
fn parseUtility(utility: []const u8) struct
Parse utility name and value from utility string (e.g., "bg-blue-500" -> "bg", "blue-500") OPTIMIZED: Single-pass parsing
theme_reference
ThemeReference
const ThemeReference = struct
Parsed theme reference
deinit
fn deinit(self: *ThemeReference, allocator: std.mem.Allocator) void
isThemeReference
fn isThemeReference(value: []const u8) bool
Check if value is a theme reference
parseThemeReference
fn parseThemeReference(allocator: std.mem.Allocator, value: []const u8) !ThemeReference
Parse theme reference into components
resolveThemeReference
fn resolveThemeReference(
Resolve theme reference to actual value
grouped_syntax
GroupedSyntaxParser
const GroupedSyntaxParser = struct
Grouped Syntax Parser (UnunuraCSS-style) Parses and expands grouped utility patterns:
- Bracket syntax: flex[col jc-center ai-center] → flex-col justify-center items-center
- Colon shorthand: bg:black → bg-black
- Reset utilities: reset:meyer → special reset handling
init
fn init(allocator: std.mem.Allocator) GroupedSyntaxParser
parseAndExpand
fn parseAndExpand(self: *GroupedSyntaxParser, class_str: []const u8) !?[][]const u8
Parse a grouped syntax class and expand into standard utility classes Returns null if not a grouped syntax pattern
expandGroupedSyntax
fn expandGroupedSyntax(allocator: std.mem.Allocator, class_str: []const u8) !?[][]const u8
Convenience function to expand a class if it uses grouped syntax
processClasses
fn processClasses(allocator: std.mem.Allocator, classes: []const []const u8) ![][]const u8
Process a list of classes, expanding any grouped syntax patterns
FileCache
FileCache
const FileCache = struct
File-based cache for extracted classes OPTIMIZED VERSION - significantly reduced file I/O and allocations
deinit
fn deinit(self: *CacheEntry, allocator: std.mem.Allocator) void
init
fn init(allocator: std.mem.Allocator, io: std.Io, cache_dir: []const u8) FileCache
deinit
fn deinit(self: *FileCache) void
get
fn get(self: *FileCache, file_path: []const u8) !?[][]const u8
Get cached classes for a file if valid OPTIMIZED: Use mtime instead of expensive file hashing
put
fn put(
Store classes in cache OPTIMIZED: Reduced allocations
clear
fn clear(self: *FileCache) !void
Clear all cache entries
css_variable
isValidCSSVariable
fn isValidCSSVariable(value: []const u8) bool
Validates CSS custom property (variable) syntax Supports:
- var(--name)
- var(--name, fallback)
- var(--name-with-dashes)
- var(--name_with_underscores)
extractVariableName
fn extractVariableName(value: []const u8) ?[]const u8
Extract variable name from var() reference
extractFallback
fn extractFallback(value: []const u8) ?[]const u8
Extract fallback value from var() reference (if present)
variant_registry
VariantType
const VariantType = enum
Variant type categories
VariantDefinition
const VariantDefinition = struct
Variant definition
VariantRegistry
const VariantRegistry = struct
Comprehensive variant registry
init
fn init(allocator: std.mem.Allocator) VariantRegistry
deinit
fn deinit(self: *VariantRegistry) void
createDefault
fn createDefault(allocator: std.mem.Allocator) !VariantRegistry
Create registry with all default variants
get
fn get(self: *const VariantRegistry, name: []const u8) ?VariantDefinition
Get variant definition
has
fn has(self: *const VariantRegistry, name: []const u8) bool
Check if variant exists
count
fn count(self: *const VariantRegistry) usize
Get total variant count
CSSGenerator
CSSRule
const CSSRule = struct
CSS Rule builder
init
fn init(allocator: std.mem.Allocator, selector: []const u8) !CSSRule
deinit
fn deinit(self: *CSSRule, allocator: std.mem.Allocator) void
addDeclaration
fn addDeclaration(self: *CSSRule, allocator: std.mem.Allocator, property: []const u8, value: []const u8) !void
addDeclarationOwned
fn addDeclarationOwned(self: *CSSRule, allocator: std.mem.Allocator, property: []const u8, value: []const u8) !void
Add a declaration taking ownership of the value (useful for allocPrint results)
toString
fn toString(self: *const CSSRule, allocator: std.mem.Allocator) ![]const u8
CSSGenerator
const CSSGenerator = struct
CSS Generator for utility classes
DarkModeStrategy
const DarkModeStrategy = enum
Config
const Config = struct
init
fn init(allocator: std.mem.Allocator) CSSGenerator
initWithConfig
fn initWithConfig(allocator: std.mem.Allocator, config: Config) CSSGenerator
deinit
fn deinit(self: *CSSGenerator) void
generateForClass
fn generateForClass(self: *CSSGenerator, class_name: []const u8) !void
Generate CSS for a class name
createRule
fn createRule(self: *CSSGenerator, parsed: *const class_parser.ParsedClass) !CSSRule
Declaration
const Declaration = struct
Helper declaration struct for addUtility
addUtility
fn addUtility(self: *CSSGenerator, parsed: *const class_parser.ParsedClass, declarations: []const Declaration) !void
Helper method for compatibility with existing layout code
generate
fn generate(self: *CSSGenerator) ![]const u8
Generate all CSS rules as a string
colors
parseColorShade
fn parseColorShade(value: []const u8) ?struct
Parse a color value like "blue-500" into color and shade
resolveColor
fn resolveColor(value: []const u8) ?[]const u8
Resolve a color value to OKLCH string (e.g., "blue-500" -> "62.3% 0.214 259.815")
colors
const colors = struct
Backwards compatibility: Check if a color exists
has
fn has(color_name: []const u8) bool
backgrounds
generateBgAttachment
fn generateBgAttachment(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateBgClip
fn generateBgClip(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateBgColor
fn generateBgColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateBgOrigin
fn generateBgOrigin(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateBgPosition
fn generateBgPosition(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, position: []const u8) !void
generateBgRepeat
fn generateBgRepeat(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, repeat: []const u8) !void
generateBgSize
fn generateBgSize(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, size: []const u8) !void
generateBgNone
fn generateBgNone(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateBgGradient
fn generateBgGradient(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, direction: []const u8) !void
generateGradientFrom
fn generateGradientFrom(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateGradientVia
fn generateGradientVia(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateGradientTo
fn generateGradientTo(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateGradientFromPosition
fn generateGradientFromPosition(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, position: []const u8) !void
generateGradientViaPosition
fn generateGradientViaPosition(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, position: []const u8) !void
generateGradientToPosition
fn generateGradientToPosition(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, position: []const u8) !void
borders
generateRounded
fn generateRounded(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
generateRoundedSide
fn generateRoundedSide(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, side: []const u8, value: ?[]const u8) !void
generateRoundedCorner
fn generateRoundedCorner(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, corner: []const u8, value: ?[]const u8) !void
generateBorderWidth
fn generateBorderWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
generateBorderWidthSide
fn generateBorderWidthSide(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, side: []const u8, value: ?[]const u8) !void
generateBorderColor
fn generateBorderColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateBorderStyle
fn generateBorderStyle(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, style: []const u8) !void
generateDivideWidth
fn generateDivideWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, axis: []const u8, value: ?[]const u8) !void
generateDivideColor
fn generateDivideColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateDivideStyle
fn generateDivideStyle(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, style: []const u8) !void
generateOutlineWidth
fn generateOutlineWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
generateOutlineColor
fn generateOutlineColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateOutlineStyle
fn generateOutlineStyle(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, style: []const u8) !void
generateOutlineOffset
fn generateOutlineOffset(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateRingWidth
fn generateRingWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
generateRingInset
fn generateRingInset(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateRingColor
fn generateRingColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateRingOffsetWidth
fn generateRingOffsetWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateRingOffsetColor
fn generateRingOffsetColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
sizing
generateWidth
fn generateWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateMinWidth
fn generateMinWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateMaxWidth
fn generateMaxWidth(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateHeight
fn generateHeight(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateMinHeight
fn generateMinHeight(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateMaxHeight
fn generateMaxHeight(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateSize
fn generateSize(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
spacing
spacing_scale
const spacing_scale = std.StaticStringMap([]const u8).initComptime(.
Spacing scale (Tailwind defaults)
generatePadding
fn generatePadding(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Generate padding utilities
generateMargin
fn generateMargin(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Generate margin utilities (including negative margins)
generateGap
fn generateGap(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Generate gap utilities
generateSpaceBetween
fn generateSpaceBetween(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Generate space-between utilities (space-x-, space-y-) These add margin to all children except the first using > * + *
typography
generateFontFamily
fn generateFontFamily(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateFontSize
fn generateFontSize(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateAntialiased
fn generateAntialiased(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateSubpixelAntialiased
fn generateSubpixelAntialiased(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateItalic
fn generateItalic(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateNotItalic
fn generateNotItalic(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateFontWeight
fn generateFontWeight(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateFontVariantNumeric
fn generateFontVariantNumeric(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, variant: []const u8) !void
generateTracking
fn generateTracking(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateLineClamp
fn generateLineClamp(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateLeading
fn generateLeading(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateListStyle
fn generateListStyle(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateListInside
fn generateListInside(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateListOutside
fn generateListOutside(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateTextAlign
fn generateTextAlign(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, alignment: []const u8) !void
generateTextColor
fn generateTextColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateUnderline
fn generateUnderline(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateOverline
fn generateOverline(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateLineThrough
fn generateLineThrough(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateNoUnderline
fn generateNoUnderline(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateDecorationColor
fn generateDecorationColor(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateDecorationStyle
fn generateDecorationStyle(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, style: []const u8) !void
generateDecorationThickness
fn generateDecorationThickness(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateUnderlineOffset
fn generateUnderlineOffset(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateUppercase
fn generateUppercase(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateLowercase
fn generateLowercase(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateCapitalize
fn generateCapitalize(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateNormalCase
fn generateNormalCase(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateTruncate
fn generateTruncate(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateTextEllipsis
fn generateTextEllipsis(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateTextClip
fn generateTextClip(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
generateTextWrap
fn generateTextWrap(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, mode: []const u8) !void
generateIndent
fn generateIndent(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: []const u8) !void
generateAlign
fn generateAlign(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, alignment: []const u8) !void
generateWhitespace
fn generateWhitespace(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, mode: []const u8) !void
generateBreak
fn generateBreak(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, mode: []const u8) !void
generateHyphens
fn generateHyphens(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, mode: []const u8) !void
generateContentNone
fn generateContentNone(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
layout
generateDisplay
fn generateDisplay(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Display utilities
generatePosition
fn generatePosition(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Position utilities
generateInset
fn generateInset(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, side: []const u8, value: ?[]const u8) !void
Top/Right/Bottom/Left utilities (inset)
generateZIndex
fn generateZIndex(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Z-index utilities
generateOverflow
fn generateOverflow(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, axis: ?[]const u8, value: ?[]const u8) !void
Overflow utilities
generateOverscrollBehavior
fn generateOverscrollBehavior(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, axis: ?[]const u8, value: ?[]const u8) !void
Overscroll behavior utilities
generateVisibility
fn generateVisibility(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Visibility utilities
generateIsolation
fn generateIsolation(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Isolation utilities
generateFloat
fn generateFloat(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Float utilities
generateClear
fn generateClear(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Clear utilities
generateObjectFit
fn generateObjectFit(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Object-fit utilities
generateObjectPosition
fn generateObjectPosition(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Object-position utilities
generateAspectRatio
fn generateAspectRatio(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Aspect ratio utilities
generateContainer
fn generateContainer(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass) !void
Container utilities
generateBoxDecorationBreak
fn generateBoxDecorationBreak(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Box decoration break utilities
generateBoxSizing
fn generateBoxSizing(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Box sizing utilities
generateColumns
fn generateColumns(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Columns utilities
generateBreak
fn generateBreak(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, position: []const u8, value: ?[]const u8) !void
Break utilities (break-before, break-after, break-inside)
flexbox
generateFlexDirection
fn generateFlexDirection(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Flex direction utilities
generateFlexWrap
fn generateFlexWrap(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Flex wrap utilities
generateFlex
fn generateFlex(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Flex utilities (flex-grow, flex-shrink, flex-basis combined)
generateFlexGrow
fn generateFlexGrow(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Flex grow utilities
generateFlexShrink
fn generateFlexShrink(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Flex shrink utilities
generateFlexBasis
fn generateFlexBasis(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Flex basis utilities
generateJustifyContent
fn generateJustifyContent(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Justify content utilities
generateJustifyItems
fn generateJustifyItems(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Justify items utilities
generateJustifySelf
fn generateJustifySelf(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Justify self utilities
generateAlignContent
fn generateAlignContent(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Align content utilities
generateAlignItems
fn generateAlignItems(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Align items utilities
generateAlignSelf
fn generateAlignSelf(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Align self utilities
generatePlaceContent
fn generatePlaceContent(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Place content utilities
generatePlaceItems
fn generatePlaceItems(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Place items utilities
generatePlaceSelf
fn generatePlaceSelf(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Place self utilities
generateOrder
fn generateOrder(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Order utilities
grid
generateGridTemplateColumns
fn generateGridTemplateColumns(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Grid template columns utilities
generateGridColumn
fn generateGridColumn(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, property_type: []const u8, value: ?[]const u8) !void
Grid column utilities (span, start, end)
generateGridTemplateRows
fn generateGridTemplateRows(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Grid template rows utilities
generateGridRow
fn generateGridRow(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, property_type: []const u8, value: ?[]const u8) !void
Grid row utilities (span, start, end)
generateGridAutoFlow
fn generateGridAutoFlow(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Grid auto flow utilities
generateGridAutoColumns
fn generateGridAutoColumns(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Grid auto columns utilities
generateGridAutoRows
fn generateGridAutoRows(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, value: ?[]const u8) !void
Grid auto rows utilities
generateGap
fn generateGap(generator: *CSSGenerator, parsed: *const class_parser.ParsedClass, axis: ?[]const u8, value: ?[]const u8) !void
Gap utilities (for both flexbox and grid)
shadows
generateShadow
fn generateShadow(
Generate box-shadow utilities
generateShadowColor
fn generateShadowColor(
Generate shadow color utilities
blend
generateMixBlend
fn generateMixBlend(
Generate mix-blend-mode utilities
generateBgBlend
fn generateBgBlend(
Generate background-blend-mode utilities
transforms
generateScale
fn generateScale(
Generate scale utilities
generateScaleX
fn generateScaleX(
Generate scale-x utilities
generateScaleY
fn generateScaleY(
Generate scale-y utilities
generateRotate
fn generateRotate(
Generate rotate utilities
generateTranslateX
fn generateTranslateX(
Generate translate-x utilities
generateTranslateY
fn generateTranslateY(
Generate translate-y utilities
generateSkewX
fn generateSkewX(
Generate skew-x utilities
generateSkewY
fn generateSkewY(
Generate skew-y utilities
generateOrigin
fn generateOrigin(
Generate transform-origin utilities
generateTransformStyle
fn generateTransformStyle(
Transform-style utilities (for 3D transforms)
generatePerspective
fn generatePerspective(
Perspective utilities
generatePerspectiveOrigin
fn generatePerspectiveOrigin(
Perspective-origin utilities
generateBackfaceVisibility
fn generateBackfaceVisibility(
Backface-visibility utilities
generateAnimationIterationCount
fn generateAnimationIterationCount(
Animation iteration count utilities
generateAnimationDirection
fn generateAnimationDirection(
Animation direction utilities
generateAnimationFillMode
fn generateAnimationFillMode(
Animation fill mode utilities
generateAnimationPlayState
fn generateAnimationPlayState(
Animation play state utilities
filters
generateBlur
fn generateBlur(
Generate blur utilities
generateBrightness
fn generateBrightness(
Generate brightness utilities
generateContrast
fn generateContrast(
Generate contrast utilities
generateGrayscale
fn generateGrayscale(
Generate grayscale utilities
generateHueRotate
fn generateHueRotate(
Generate hue-rotate utilities
generateInvert
fn generateInvert(
Generate invert utilities
generateSaturate
fn generateSaturate(
Generate saturate utilities
generateSepia
fn generateSepia(
Generate sepia utilities
generateDropShadow
fn generateDropShadow(
Generate drop-shadow utilities
generateBackdropBlur
fn generateBackdropBlur(
Generate backdrop-blur utilities
generateBackdropBrightness
fn generateBackdropBrightness(
Generate backdrop-brightness utilities
generateBackdropContrast
fn generateBackdropContrast(
Generate backdrop-contrast utilities
generateBackdropGrayscale
fn generateBackdropGrayscale(
Generate backdrop-grayscale utilities
transitions
generateTransition
fn generateTransition(
Generate transition-property utilities
generateDuration
fn generateDuration(
Generate transition-duration utilities
generateEase
fn generateEase(
Generate transition-timing-function utilities
generateDelay
fn generateDelay(
Generate transition-delay utilities
animations
generateAnimate
fn generateAnimate(
Generate animation utilities
generateKeyframes
fn generateKeyframes(allocator: std.mem.Allocator) ![]const u8
Generate @keyframes for built-in animations This should be called once to add keyframes to the base layer
resets
ResetGenerator
const ResetGenerator = struct
CSS Reset Generator Generates various CSS reset styles based on reset type
init
fn init(allocator: std.mem.Allocator) ResetGenerator
generateReset
fn generateReset(self: *ResetGenerator, reset_type: []const u8) !?[]const u8
Generate CSS for a reset utility (e.g., reset-meyer, reset-normalize)
isResetClass
fn isResetClass(class: []const u8) bool
Check if a class is a reset utility
getResetType
fn getResetType(class: []const u8) ?[]const u8
Get the reset type from a reset class
Plugin
Plugin
const Plugin = struct
Plugin interface for extending zig-css
init
fn init(
execute
fn execute(self: *Plugin, ctx: *PluginContext) !void
PluginContext
const PluginContext = struct
Plugin context provides APIs for plugins to extend zig-css
init
fn init(allocator: std.mem.Allocator, config: *const cssConfig) PluginContext
deinit
fn deinit(self: *PluginContext) void
addBase
fn addBase(self: *PluginContext, selector: []const u8, styles: []const StyleDeclaration) !void
Add base styles (similar to Tailwind's addBase)
addComponents
fn addComponents(self: *PluginContext, selector: []const u8, styles: []const StyleDeclaration) !void
Add component styles (similar to Tailwind's addComponents)
addUtilities
fn addUtilities(self: *PluginContext, utilities: []const UtilityDefinition) !void
Add utility styles (similar to Tailwind's addUtilities)
addVariant
fn addVariant(self: *PluginContext, name: []const u8, definition: VariantDefinition) !void
Add custom variant (similar to Tailwind's addVariant)
theme
fn theme(self: *PluginContext, path: []const u8) ?[]const u8
Get theme value (similar to Tailwind's theme())
configValue
fn configValue(self: *PluginContext, path: []const u8) ?[]const u8
Get config value (similar to Tailwind's config())
escape
fn escape(self: *PluginContext, className: []const u8) ![]const u8
Escape class name (similar to Tailwind's e())
CustomStyle
const CustomStyle = struct
Custom style definition
init
fn init(allocator: std.mem.Allocator, selector: []const u8, declarations: []const StyleDeclaration) !CustomStyle
initFromUtility
fn initFromUtility(allocator: std.mem.Allocator, util: UtilityDefinition) !CustomStyle
deinit
fn deinit(self: *CustomStyle, allocator: std.mem.Allocator) void
toCss
fn toCss(self: *const CustomStyle, allocator: std.mem.Allocator) ![]const u8
StyleDeclaration
const StyleDeclaration = struct
Style declaration (property: value)
init
fn init(allocator: std.mem.Allocator, property: []const u8, value: []const u8) !StyleDeclaration
deinit
fn deinit(self: *StyleDeclaration, allocator: std.mem.Allocator) void
UtilityDefinition
const UtilityDefinition = struct
Utility definition
VariantDefinition
const VariantDefinition = struct
Variant definition
deinit
fn deinit(self: *VariantDefinition, allocator: std.mem.Allocator) void
PluginRegistry
const PluginRegistry = struct
Plugin registry
init
fn init(allocator: std.mem.Allocator) PluginRegistry
deinit
fn deinit(self: *PluginRegistry) void
register
fn register(self: *PluginRegistry, plugin: Plugin) !void
executeAll
fn executeAll(self: *PluginRegistry, ctx: *PluginContext) !void
typographyPlugin
typographyPlugin
fn typographyPlugin(ctx: *PluginContext) !void
Typography plugin - adds prose classes for beautiful typography
formsPlugin
formsPlugin
fn formsPlugin(ctx: *PluginContext) !void
Forms plugin - adds beautiful form styles