lib/css/src/root.zig

daab053ee43316e1809a84551d573ddd1e5bf3d2

 1 //! A CSS cascade engine: tokenizer, selector grammar, cascade, and typed
 2 //! computed values, with no allocation once a sheet's storage is sealed.
 3 //!
 4 //! ### Shape
 5 //!
 6 //! `token` turns bytes into CSS Syntax Level 3 tokens. `selector` turns a
 7 //! prelude into compounds of interned atoms, a specificity, and a bucket key.
 8 //! `property` holds the closed property set with each property's grammar,
 9 //! initial value, and inheritance. `value` turns a value span into a sixteen
10 //! byte declaration record. `sheet` runs all four over one source and publishes
11 //! the flat tables. `match` walks a compound chain against an element vtable,
12 //! and `cascade` folds the winning declarations into a computed style.
13 //!
14 //! ### Two phase memory discipline
15 //!
16 //! Parsing splits into an allocation free inspection pass (`Limits.inspect`)
17 //! that counts every array, and an emission pass that fills a single aligned
18 //! block (`Storage`). Both passes run the same parser over the same sink, so a
19 //! counted bound and a filled result cannot drift. Once sealed into `.steady`
20 //! the parser performs no allocation and asserts admission rather than growing.
21 //!
22 //! ### Ownership
23 //!
24 //! Every published slice borrows from the sheet placement, and every string
25 //! borrows from the caller owned source bytes, so the source must outlive the
26 //! sheet. `Workspace` frees the previous block when it grows, which invalidates
27 //! any `StyleSheet` returned by an earlier `parse`.
28 //!
29 //! ### Import direction
30 //!
31 //! This package names no node model. An element reaches the matcher through the
32 //! `match.Element` function table, and element type and role names reach it as
33 //! atoms the consumer resolves once through `StyleSheet.token`.
34 
35 pub const atom = @import("atom.zig");
36 pub const bucket = @import("bucket.zig");
37 pub const cascade = @import("cascade/root.zig");
38 pub const match = @import("match/root.zig");
39 pub const media = @import("media.zig");
40 pub const property = @import("property/root.zig");
41 pub const scan = @import("scan.zig");
42 pub const selector = @import("selector/root.zig");
43 pub const sheet = @import("sheet.zig");
44 pub const token = @import("token/root.zig");
45 pub const value = @import("value/root.zig");
46 
47 pub const Capacity = sheet.Capacity;
48 pub const Declaration = sheet.Declaration;
49 pub const Limits = sheet.Limits;
50 pub const MediaEnvironment = sheet.MediaEnvironment;
51 pub const MediaType = sheet.MediaType;
52 pub const Placement = sheet.Placement;
53 pub const Rule = sheet.Rule;
54 pub const Selector = selector.Selector;
55 pub const Specificity = selector.Specificity;
56 pub const Storage = sheet.Storage;
57 pub const StyleSheet = sheet.StyleSheet;
58 pub const Workspace = sheet.Workspace;
59 pub const build = sheet.build;
60 pub const mediaListApplies = sheet.mediaListApplies;
61 pub const parseDeclarationValue = sheet.parseDeclarationValue;
62 pub const storage_alignment = sheet.storage_alignment;