Skip to main content

Module css

Module css 

Source
Expand description

Stylesheet types: rules, selectors, declarations, and specificity. Types and methods used to describe the style of an application.

This module defines the core CSS data model:

  • [Css] contains one or more [Stylesheet]s, each holding [CssRuleBlock]s.
  • A [CssRuleBlock] pairs a [CssPath] (selector) with [CssDeclaration]s (properties).
  • [CssPropertyValue<T>] wraps individual property values with CSS keywords (auto, inherit, initial, etc.).
  • [BoxOrStatic<T>] is a smart-pointer enum for heap-allocated or static CSS values.
  • [NodeTypeTag] enumerates all recognized HTML/SVG element types for selector matching.

Modules§

rule_priority
Layer priority for CssRuleBlock. Lower numbers cascade first; higher numbers override earlier layers at the same specificity.

Structs§

Css
Css stylesheet - contains a parsed CSS stylesheet in “rule blocks”, i.e. blocks of key-value pairs associated with a selector path.
CssAttributeSelector
Attribute selector ([attr], [attr="value"], …).
CssDeclarationVec
CssDeclarationVecSlice
C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
CssNthChildPattern
Pattern for :nth-child(An+B) selectors, where pattern_repeat is A and offset is B.
CssPath
Represents a full CSS path (i.e. the “div#id.class” selector belonging to a CSS “content group” (the following key-value block)).
CssPathSelectorVec
CssPathSelectorVecSlice
C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
CssRuleBlock
One block of rules that applies a bunch of rules to a “path” in the style, i.e. div#myid.myclass -> { ("justify-content", "center") }
CssRuleBlockVec
CssRuleBlockVecSlice
C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
CssVec
CssVecSlice
C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
DynamicCssProperty
A DynamicCssProperty is a type of css property that can be changed on possibly every frame by the Rust code - for example to implement an On::Hover behaviour.

Enums§

AttributeMatchOp
Operator that compares an attribute value against a target string.
BoxOrStatic
A value that is either heap-allocated (parsed at runtime) or a compile-time static reference. Used to reduce enum size for large CSS property payloads by storing them behind a pointer instead of inline.
CssDeclaration
Contains one parsed key: value pair, static or dynamic
CssDeclarationVecDestructor
CssNthChildSelector
Selector for the :nth-child() CSS pseudo-class.
CssPathPseudoSelector
CssPathSelector
CssPathSelectorVecDestructor
CssPropertyValue
A CSS property value that may be an explicit value or a CSS-wide keyword (auto, none, initial, inherit, revert, unset).
CssRuleBlockVecDestructor
CssVecDestructor
NodeTypeTag
Signifies the type of a DOM node without carrying any associated data
NodeTypeTagParseError
Error returned when a CSS tag name string cannot be mapped to a NodeTypeTag.
NodeTypeTagParseErrorOwned
Owned version of NodeTypeTagParseError for storage across lifetime boundaries.
OptionCss
OptionCssDeclaration
OptionCssPathSelector
OptionCssRuleBlock

Traits§

PrintAsCssValue
Trait for types that can format themselves as a CSS property value string.

Functions§

get_specificity
Returns specificity of the given css path. Further information can be found on the w3 website.

Type Aliases§

BoxOrStaticString
Type alias: BoxOrStatic<AzString> — used by NodeType::Text and NodeType::Icon.
BoxOrStaticStyleBoxShadow
Type alias: BoxOrStatic<StyleBoxShadow> — used by codegen for FFI monomorphization.
CssContentGroup
A group of CSS path selectors, used during selector matching.
CssDeclarationVecDestructorType
CssPathSelectorVecDestructorType
CssRuleBlockVecDestructorType
CssVecDestructorType