LiveStyle.Class (LiveStyle v0.13.1)
View SourceStyle class definition and lookup for LiveStyle.
This is an internal module that handles the processing of class/2 declarations.
You typically don't use this module directly - instead use LiveStyle with
the class/2 macro.
Responsibilities
- Defining static and dynamic style classes
- Looking up class entries by module and name
- Orchestrating declaration processing via specialized processors
Internal API Example
# Static class (called by class macro)
LiveStyle.Class.define(MyModule, :button, [display: "flex", padding: "8px"])
# Dynamic class
LiveStyle.Class.define_dynamic(MyModule, :opacity, [:opacity])
# Fetch
LiveStyle.Class.fetch!(MyModule, :button)
# => %{class_string: "x1234 x5678", atomic_classes: [...], ...}
Summary
Functions
Defines a static style class directly in a manifest (for batch operations).
Defines a dynamic style class directly in a manifest (for batch operations).
Defines a static style class.
Defines a dynamic style class.
Fetches a Class by reference.
Gets the Class reference value.
Functions
@spec batch_define(LiveStyle.Manifest.t(), module(), atom(), keyword(), keyword()) :: LiveStyle.Manifest.t()
Defines a static style class directly in a manifest (for batch operations).
This is used by @before_compile to batch all class definitions in a single
manifest update, reducing lock contention during compilation.
Returns the updated manifest.
@spec batch_define_dynamic(LiveStyle.Manifest.t(), module(), atom(), [atom()]) :: LiveStyle.Manifest.t()
Defines a dynamic style class directly in a manifest (for batch operations).
This is used by @before_compile to batch all class definitions in a single
manifest update, reducing lock contention during compilation.
Returns the updated manifest.
Defines a static style class.
Parameters
module- The module defining the classname- The class name (atom)declarations- Keyword list of CSS property declarationsopts- Options including:fileand:linefor validation warnings
Example
LiveStyle.Class.define(MyModule, :button, [display: "flex"])
Defines a dynamic style class.
Dynamic classes use CSS variables that are set at runtime via inline styles.
Parameters
module- The module defining the classname- The class name (atom)all_props- List of all CSS properties in the class
Example
LiveStyle.Class.define_dynamic(MyModule, :opacity, [:opacity])
Fetches a Class by reference.
Returns the entry. Raises if not found.
Gets the Class reference value.