hypersig_style/lib.rs
1//! Typed atomic CSS for hypersig.
2//!
3//! A [`Style`] is built from one method per standard CSS property, and per
4//! anchor positioning property, which MDN's data still marks experimental
5//! although every major engine ships it. A misspelled property or keyword
6//! does not compile. Each declaration becomes
7//! one class whose name is derived from the declaration, and a [`Sheet`]
8//! collects the styles a page uses and writes each rule once.
9//!
10//! The property list, each property's keywords, the pseudo-classes, the
11//! pseudo-elements, and the named colors are generated from MDN's CSS data
12//! (`mdn-data` 2.37.2). Where a property accepts a value made of one keyword
13//! or one value of a type in [`value`], that value is typed. The forms the
14//! generator leaves out, such as `margin: 0 auto` or a `calc()`, go through
15//! [`value::Raw`] and are not checked. Ranges are not checked either, so a
16//! negative width is accepted and the browser drops it.
17//!
18//! Use it through the `hypersig` crate.
19#![doc(
20 html_logo_url = "https://imaimai17468.github.io/hypersig/icon.svg",
21 html_favicon_url = "https://imaimai17468.github.io/hypersig/icon.svg"
22)]
23
24mod condition;
25// Written by tests/generate.rs, whose output is kept as it writes it.
26#[rustfmt::skip]
27mod generated;
28mod global;
29mod keyframes;
30pub mod pattern;
31mod sheet;
32mod style;
33mod token;
34pub mod value;
35
36pub use condition::{Condition, Container, Media};
37pub use generated::{Property, PseudoClass, PseudoElement};
38pub use global::{Element, FontFace, Global, Selector};
39pub use keyframes::Keyframes;
40pub use sheet::{BASE_LAYER, Bucket, LAYER, Sheet, TOGGLED_LAYER, TOKEN_LAYER};
41pub use style::Style;
42pub use token::{Theme, Token, TokenValue};