Skip to main content

Module keyframes

Module keyframes 

Source
Expand description

Runtime registry for @keyframes rules.

dwind’s utility classes are generated as single declaration blocks, and the CSS binding pipeline has no notion of at-rules — so a @keyframes cannot be expressed as a utility. Historically every crate worked around that by hand-writing a &str blob and pushing it through dominator::stylesheet_raw at startup, which meant no deduplication, no collision detection, and every keyframe paying its cost whether or not the page used it.

This module is the shared alternative. A Keyframes is a const- constructible handle that injects its rule the first time anything asks for its name, and never again.

Prefer declaring these with the dwkeyframes! macro rather than by hand — it mints the matching animate-* utility class at the same time, so the class name stays checked by rustc.

Structs§

AnimationDecl
The declaration body of a generated animate-* utility.
Keyframes
A declared @keyframes rule.

Functions§

is_registered
Whether name has already been injected.
register
Injects @keyframes {name} { {body} } unless name is already registered.
registered_css
Every rule injected so far, concatenated. Intended for prerendering.