LiveStyle.Property (LiveStyle v0.12.0)
View SourceCSS property information and lookups.
This module provides compile-time generated function clauses for efficient property lookups, following the pattern used by the unicode library.
All property data is loaded from external files at compile time via
LiveStyle.PropertyMetadata, enabling:
- O(1) pattern-matched lookups instead of runtime lookups
- Automatic recompilation when data files change
- Single source of truth for property metadata
Property Categories
CSS properties are categorized by their specificity level:
:shorthands_of_shorthands- Affect many properties (e.g.,margin,padding):shorthands_of_longhands- Expand to fewer properties (e.g.,margin-block):longhand_logical- Logical longhand properties (default):longhand_physical- Physical longhand properties (e.g.,margin-top)
Examples
iex> LiveStyle.Property.category("margin")
:shorthands_of_shorthands
iex> LiveStyle.Property.category("color")
:longhand_logical
Summary
Functions
Returns the category of a CSS property.
Returns true if the property is a disallowed shorthand in strict mode.
Returns true if the property is allowed in @position-try rules.
Returns all position-try properties as a MapSet.
Returns true if the property needs value flipping in RTL mode.
Returns the appropriate unit suffix for a numeric value of this property.
Functions
Returns the category of a CSS property.
Categories determine property priority in the generated CSS.
Categories
:shorthands_of_shorthands- Priority 1000 (e.g.,margin,padding):shorthands_of_longhands- Priority 2000 (e.g.,margin-block,border-color):longhand_logical- Priority 3000 (default for unlisted properties):longhand_physical- Priority 4000 (e.g.,margin-top,width)
Examples
iex> LiveStyle.Property.category("margin")
:shorthands_of_shorthands
iex> LiveStyle.Property.category("border-color")
:shorthands_of_longhands
iex> LiveStyle.Property.category("color")
:longhand_logical
iex> LiveStyle.Property.category("width")
:longhand_physical
Returns true if the property is a disallowed shorthand in strict mode.
Examples
iex> LiveStyle.Property.disallowed_shorthand?("background")
true
iex> LiveStyle.Property.disallowed_shorthand?("margin")
false
Returns true if the property is allowed in @position-try rules.
Examples
iex> LiveStyle.Property.position_try?("top")
true
iex> LiveStyle.Property.position_try?("width")
true
iex> LiveStyle.Property.position_try?("color")
false
Returns all position-try properties as a MapSet.
Returns true if the property needs value flipping in RTL mode.
Properties like float, clear have values that need to be flipped
(e.g., start -> right in RTL). Note that text-align is NOT included
because browsers handle start/end natively.
Examples
iex> LiveStyle.Property.rtl_value?("float")
true
iex> LiveStyle.Property.rtl_value?("clear")
true
iex> LiveStyle.Property.rtl_value?("color")
false
Returns the appropriate unit suffix for a numeric value of this property.
Examples
iex> LiveStyle.Property.unit_suffix("width")
"px"
iex> LiveStyle.Property.unit_suffix("opacity")
""
iex> LiveStyle.Property.unit_suffix("animation-duration")
"ms"