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.
- CssAttribute
Selector - Attribute selector (
[attr],[attr="value"], …). - CssDeclaration
Vec - CssDeclaration
VecSlice - C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
- CssNth
Child Pattern - Pattern for
:nth-child(An+B)selectors, wherepattern_repeatis A andoffsetis 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)).
- CssPath
Selector Vec - CssPath
Selector VecSlice - C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
- CssRule
Block - One block of rules that applies a bunch of rules to a “path” in the style, i.e.
div#myid.myclass -> { ("justify-content", "center") } - CssRule
Block Vec - CssRule
Block VecSlice - C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
- CssVec
- CssVec
Slice - C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
- Dynamic
CssProperty - A
DynamicCssPropertyis a type of css property that can be changed on possibly every frame by the Rust code - for example to implement anOn::Hoverbehaviour.
Enums§
- Attribute
Match Op - Operator that compares an attribute value against a target string.
- BoxOr
Static - 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: valuepair, static or dynamic - CssDeclaration
VecDestructor - CssNth
Child Selector - Selector for the
:nth-child()CSS pseudo-class. - CssPath
Pseudo Selector - CssPath
Selector - CssPath
Selector VecDestructor - CssProperty
Value - A CSS property value that may be an explicit value or a CSS-wide keyword
(
auto,none,initial,inherit,revert,unset). - CssRule
Block VecDestructor - CssVec
Destructor - Node
Type Tag - Signifies the type of a DOM node without carrying any associated data
- Node
Type TagParse Error - Error returned when a CSS tag name string cannot be mapped to a
NodeTypeTag. - Node
Type TagParse Error Owned - Owned version of
NodeTypeTagParseErrorfor storage across lifetime boundaries. - Option
Css - Option
CssDeclaration - Option
CssPath Selector - Option
CssRule Block
Traits§
- Print
AsCss Value - 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§
- BoxOr
Static String - Type alias:
BoxOrStatic<AzString>— used by NodeType::Text and NodeType::Icon. - BoxOr
Static Style BoxShadow - Type alias:
BoxOrStatic<StyleBoxShadow>— used by codegen for FFI monomorphization. - CssContent
Group - A group of CSS path selectors, used during selector matching.
- CssDeclaration
VecDestructor Type - CssPath
Selector VecDestructor Type - CssRule
Block VecDestructor Type - CssVec
Destructor Type