Cascade.Stylesheet_intfSourceCSS stylesheet interface types
type import_rule = {url : string;URL or string to import
*)layer : string option;Optional layer name
*)supports : Supports.t option;Optional supports condition
*)media : Media.t option;Optional media query
*)}A CSS \@import rule
type 'a property_rule = {name : string;syntax : 'a Variables.syntax;inherits : bool;initial_value : 'a option;}Type-safe CSS @property rule with typed syntax and initial value
type cascade_layer_candidate = {layer : string option;Explicit layer name, or None for the implicit unlayered layer.
important : bool;Whether this candidate comes from an important declaration.
*)source_order : int;Later source-order values win after layer precedence ties.
*)value : string;Test/API payload representing the cascaded value.
*)}A minimal same-origin/same-specificity cascade candidate used to model the layer and source-order parts of the cascade sorting order.
type cascade_origin_candidate = {origin : cascade_origin;Origin bucket that contributes this same-property candidate.
*)important : bool;Whether this candidate comes from an important declaration.
*)source_order : int;Later source-order values win after origin/importance ties.
*)value : string;Test/API payload representing the cascaded value.
*)}A minimal same-specificity cascade candidate used to model origin, importance, and source-order sorting.
A declared value contributed by one property declaration before cascade sorting. The value is the declaration's minified CSS value string.
Result of applying the non-layout parts of specified-value defaulting.
@namespace prelude URI form. CSS Namespaces 3 1: <string> and url(<string>) are spec-equivalent; url_form further distinguishes whether the url() body itself quoted its argument so the pretty-printer can round-trip the source spelling. Under --minify the printer collapses every form to the bare quoted string (the shortest spelling).
type cascade_candidate = {origin : cascade_origin;layer : string option;important : bool;specificity : int;scope_hops : int option;source_order : int;value : string;}A same-property cascade candidate covering the cascade ordering criteria this library can model without a DOM: origin/importance, layer, specificity, scoping proximity, and source order.
type rule = {selector : Selector.t;declarations : Declaration.declaration list;nested : statement list;merge_key : string option;}A CSS rule with a selector, declarations, optional nested rules/at-rules, and an optional merge key for combining rules with identical declarations. When merge_key is Some key, rules with the same key and identical declarations can be combined into a single rule with a selector list.
and statement = | Rule of rule| Declarations of Declaration.declaration listBare declarations for CSS nesting (no selector)
*)| Bang_comment of stringPreserved /*! ... */ comment (license header convention). The body excludes the surrounding /*! / */ delimiters.
| Charset of string@charset "UTF-8";
| Import of import_rule@import url(...) layer(...) supports(...);
| Namespace of string option * namespace_url@namespace prefix? url;
| Property : 'a property_rule -> statement@property --name { ... }
| Layer_decl of string list@layer theme, base, utilities;
| Layer of string option * block@layer name? { ... }
| Media of Media.t * block@media (...) { ... }
| Container of string option * Container.t option * block@container name? (...) { ... }
| Supports of Supports.t * block@supports (...) { ... }
| Moz_document of moz_document_condition list * block@-moz-document url-prefix(...) { ... }
| Starting_style of block@starting-style { ... }
| When of conditional * block@when media(...) { ... }
| Else of conditional option * block@else supports(...)? { ... }
| Supports_condition of string * Declaration.declaration list@supports-condition --name { ... }
| Origin of cascade_origin * blockAPI-level wrapper recording the cascade origin of a stylesheet block. It has no CSS surface syntax, but lets optimizers and tests preserve origin boundaries.
*)| Scope of Selector.t option * Selector.t option * block@scope (start)? to (end)? { ... }
| Keyframes of string * keyframe list@keyframes name { ... }
| Webkit_keyframes of string * keyframe list@-webkit-keyframes name { ... }
| Moz_keyframes of string * keyframe list@-moz-keyframes name { ... }
| Font_face of font_face_descriptor list@font-face { ... }
| Counter_style of string * counter_style_descriptor list@counter-style name { ... }
| Page of page_selector list * Declaration.declaration list@page :first { ... }; empty list is a bare @page
| Page_with_margins of page_selector list
* page_descriptor list
* page_margin_rule list@page :first { margin: 1cm; @top-left { content: ... } }
| Font_palette_values of string * font_palette_descriptor list@font-palette-values --name { ... }
| Font_feature_values of Properties.font_family list
* font_feature_values_block list@font-feature-values <family-name># { @styleset { nice: 1 } }
| View_transition of view_transition_descriptor list@view-transition { navigation: auto }
| Position_try of string * Declaration.declaration list@position-try --name { top: anchor(...) }
| Viewport of viewport_prefix * viewport_descriptor list@viewport { ... } / @-ms-viewport { ... } (CSS Device Adaptation 1, deprecated but still emitted by minifiers for legacy IE).
| Unknown_at_rule of {}CSS Syntax 3 sec. 5.4.2 "consume an at-rule" preserves any unrecognised at-rule as raw text so authors can ship unknown vendor or future at-rules without dropping the whole stylesheet.
*)A CSS statement - either a rule or an at-rule
and conditional = | Media_condition of Media.t| Supports_condition_test of Supports.t| And of conditional * conditional| Or of conditional * conditionalRaw <name>:<value> pair inside @viewport / @-ms-viewport; viewport descriptors share names with regular CSS properties (e.g., width) but take a viewport-specific value grammar that includes device-width, device-height, so they aren't typed against the property reader.
and keyframe = {selector : Keyframe.selector;e.g., From, To, Percent 50.
declarations : Declaration.declaration list;}A single keyframe within \@keyframes
@page selector: an optional page name and zero or more pseudo-pages, e.g. invoice:blank:first
and font_palette_descriptor = | Palette_font_family of Properties.font_family list| Base_palette of font_palette_base| Override_colors of (int * Values.color) listand counter_style_descriptor = | System of counter_style_system| Symbols of string list| Suffix of string| Prefix of string| Fallback of string| Range of string| Pad of string| Negative of string| Additive_symbols of string| Speak_as of stringand font_variant_descriptor_value = | Ligature of Properties.font_variant_ligature| Caps of Properties.font_variant_caps| Numeric of Properties.font_variant_numeric_token| East_asian of Properties.east_asian_featureCSS page margin at-rule inside @page.
and font_face_descriptor = | Font_family of Properties.font_family listFont family name
*)| Src of Font_face.srcFont source (url(), local(), etc.)
*)| Font_style of Properties.font_stylenormal, italic, oblique
*)| Font_style_range of Properties.font_style * Properties.font_stylevariable font style range, e.g. normal italic
| Font_weight of Properties.font_weightnormal, bold, 100-900
*)| Font_weight_range of Properties.font_weight * Properties.font_weightvariable font weight range, e.g. 100 900
| Font_stretch of Properties.font_stretchnormal, condensed, expanded, etc.
*)| Font_stretch_range of stringvariable font stretch range
*)| Font_display of Properties.font_displayauto, block, swap, fallback, optional
*)| Unicode_range of Properties.unicode_range listCSS Fonts 4 sec. 4.5 comma-separated unicode-range list.
| Font_variant of font_variant_descriptorfont-variant descriptor
| Font_feature_settings of Properties.font_feature_settingsOpenType feature settings
*)| Font_variation_settings of Properties.font_variation_settingsVariable font settings
*)| Font_tech of stringfont-tech descriptor
| Size_adjust of Font_face.size_adjustSize adjustment percentage
*)| Ascent_override of Font_face.metric_overrideAscent metric override
*)| Descent_override of Font_face.metric_overrideDescent metric override
*)| Line_gap_override of Font_face.metric_overrideLine gap metric override
*)Font-face descriptors per CSS Fonts spec
Alias for backwards compatibility