tiny.css
Overview · API · Code relationships · Verification · Audit
Overview
A CSS cascade engine: tokenizer, selector grammar, cascade, and typed computed values, with no allocation once a sheet's storage is sealed.
Shape
token turns bytes into CSS Syntax Level 3 tokens. selector turns a prelude into compounds of interned atoms, a specificity, and a bucket key. property holds the closed property set with each property's grammar, initial value, and inheritance. value turns a value span into a sixteen byte declaration record. sheet runs all four over one source and publishes the flat tables. match walks a compound chain against an element vtable, and cascade folds the winning declarations into a computed style.
Two phase memory discipline
Parsing splits into an allocation free inspection pass (Limits.inspect) that counts every array, and an emission pass that fills a single aligned block (Storage). Both passes run the same parser over the same sink, so a counted bound and a filled result cannot drift. Once sealed into .steady the parser performs no allocation and asserts admission rather than growing.
Ownership
Every published slice borrows from the sheet placement, and every string borrows from the caller owned source bytes, so the source must outlive the sheet. Workspace frees the previous block when it grows, which invalidates any StyleSheet returned by an earlier parse.
Import direction
This package names no node model. An element reaches the matcher through the match.Element function table, and element type and role names reach it as atoms the consumer resolves once through StyleSheet.token.
Definitions
Actions
Public operations.
mediaListApplies: Whether any query inquery_listselectsmedia.build: Fills an admitted placement fromsourceand publishes the sheet.parseDeclarationValue: Splits an authored value into its body and its!importantflag.
Types and contracts
Public types and contracts.
Declaration: One authored declaration, borrowed from the sheet source.MediaEnvironmentMediaTypeRule: One style rule.Selector: One compiled selector.Specificity: The four specificity fields, ordered from strongest to weakest.StyleSheet: A parsed stylesheet.Storage: The single aligned block one sheet owns for the whole of its life.Workspace: A sheet parser that grows its storage to the largest source it has seen.Limits: The exact bound one source and one media environment produce.Placement: The typed slices one acquired block resolves into.Capacity: The aligned byte layout oneLimitsproduces.
Namespaces
Public namespaces.
scan: Byte level CSS scanning shared by the sheet parser and the media reader.atom: Interned identifier atoms.match: Selector matching over an element interface, plus the rule bucket index.selector: The selector grammar: compounds, combinators, specificity, and bucket keys.cascade: The cascade: origin, importance, specificity, source order, inheritance, the four CSS wide keywords, custom properties, andvar()substitution.property: The closed property set: identifiers, initial values, inheritance, and the value grammar each property accepts.value: Typed CSS values and the sixteen byte declaration record they lower into.token: The CSS Syntax Level 3 tokenizer.media: Media types, the media environment, and media query evaluation.sheet: The stylesheet: rule parsing, two phase storage, and the tables matching and the cascade read.bucket: The rule bucket index: one sorted entry per selector, keyed by the strongest key its rightmost compound carries.
Values and defaults
Public values and defaults.
storage_alignment: The alignment the whole sheet block is acquired at.
Code relationships
Direct static dependencies extracted from parsed source by semantic graph analysis.
Uses: tiny.accy, tiny.bench, tiny.hypothesis, tiny.sys, tiny.xkb
Used by: tiny.accy, tiny.choir, tiny.smg, tiny.ui, tiny.windowing
Verification
No verification records are cataloged for this module in this build.
Audit
| Evidence | Value |
|---|---|
| Source | lib/css/src/root.zig |
| Definitions | 25 of 27 documented |
| Members | 0 of 0 documented |
| Public names | 27 API, 291 indexed |
| Version | 26.7.0 |
| Revision | daab053ee433 |