Press.CSS.Rule (press v0.1.0)

Copy Markdown View Source

A parsed CSS style rule (selector { declarations }), as produced by Press.CSS.Parser.parse/1.

selector is a list of compound-selector maps in left-to-right (outermost-to-innermost) order — see the internal selector parser for the shape and matching logic. declarations maps CSS property name to an already-parsed, typed value — box shorthands (margin, padding, border-*) are already expanded into longhand keys here, never left as a combined shorthand key. source_index is this rule's position among the other rules produced by the same parse/1 call; used by Press.Style.Cascade to break ties between rules of equal specificity from the same stylesheet source.

Summary

Types

t()

A parsed CSS style rule struct.

Types

t()

@type t() :: %Press.CSS.Rule{
  declarations: %{required(String.t()) => term()},
  selector: [map()],
  source_index: non_neg_integer(),
  specificity: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
}

A parsed CSS style rule struct.