Expand description
Typed atomic CSS for hypersig.
A Style is built from one method per standard CSS property, and per
anchor positioning property, which MDN’s data still marks experimental
although every major engine ships it. A misspelled property or keyword
does not compile. Each declaration becomes
one class whose name is derived from the declaration, and a Sheet
collects the styles a page uses and writes each rule once.
The property list, each property’s keywords, the pseudo-classes, the
pseudo-elements, and the named colors are generated from MDN’s CSS data
(mdn-data 2.37.2). Where a property accepts a value made of one keyword
or one value of a type in value, that value is typed. The forms the
generator leaves out, such as margin: 0 auto or a calc(), go through
value::Raw and are not checked. Ranges are not checked either, so a
negative width is accepted and the browser drops it.
Use it through the hypersig crate.
Modules§
- pattern
- Layouts used often enough to name, each a function that returns a
Style. - value
- The value types a property method accepts, and functions that build them.
Structs§
- Bucket
- The rules of one place in the order: one cascade layer, one set of
conditions, and one shorthand rank, or one
@keyframesrule. - Font
Face - A font the page loads, written as
@font-face. - Global
- Rules for elements by their tag, and the fonts the page loads.
- Keyframes
- The steps of an animation, written as
@keyframes <name>. - Sheet
- The rules for a set of styles, each declaration written once.
- Style
- A set of CSS declarations, each of which becomes one class.
- Theme
- Values for tokens across the whole page, written on
:root. - Token
- A named value of type
T, written as the custom property--<name>.
Enums§
- Condition
- A condition that
Style::onapplies a part of a style under. - Container
- A width of the nearest query container a part of a style applies from.
- Element
- An HTML element, by its tag.
- Media
- A media feature a part of a style applies under.
- Property
- A standard CSS property, or one of the anchor positioning properties.
- Pseudo
Class - A standard pseudo-class without arguments.
- Pseudo
Element - A standard pseudo-element without arguments, and
::picker(select). - Selector
- What a
Globalrule applies to.
Constants§
- BASE_
LAYER - The cascade layer of a
Global’s rules, afterTOKEN_LAYERand beforeLAYER, so an element’s classes override them. - LAYER
- The cascade layer of the classes from
Sheet::add. - TOGGLED_
LAYER - The cascade layer of the classes from
Sheet::add_toggled, which comes afterLAYER, so a toggled declaration overrides an element’s own. - TOKEN_
LAYER - The cascade layer of a
Theme’s values, beforeLAYER.
Traits§
- Token
Value - A value type a
Tokencan hold.