Cascade.MediaSourceStructured media conditions for type-safe media query construction.
type name = | Width| Height| Inline_size| Block_size| Aspect_ratio| Resolution| Color| Color_index| Monochrome| Grid| Horizontal_viewport_segments| Vertical_viewport_segments| Orientation| Hover| Any_hover| Pointer| Any_pointer| Update| Overflow_block| Overflow_inline| Scan| Color_gamut| Video_color_gamut| Dynamic_range| Video_dynamic_range| Display_mode| Environment_blending| Prefers_color_scheme| Prefers_reduced_motion| Prefers_reduced_transparency| Prefers_reduced_data| Prefers_contrast| Forced_colors| Inverted_colors| Scripting| Min of name| Max of name| Other of stringtype ident = | Infinite| Portrait| Landscape| None| Hover| Coarse| Fine| Slow| Fast| Interlace| Progressive| Srgb| P3| Rec2020| Standard| High| Optional_paged| Paged| Scroll| Fullscreen| Standalone| Minimal_ui| Browser| Picture_in_picture| Opaque| Additive| Subtractive| Light| Dark| No_preference| Reduce| Less| More| Custom| Active| Inverted| Back| Initial_only| Enabled| Other of stringtype value = | Length of Values.length| Integer of int| Number of float| Ratio of int * int| Resolution_value of float * string| Ident of ident| Function of string * stringenv(--name) / var(...) / calc(...) etc. captured as a function name plus its raw argument body.
equal_value a b tests media feature values structurally.
Media Queries 4 sec. 3.1 <general-enclosed>: a grammatical but unrecognised query, kept verbatim. Its result is unknown, which becomes false wherever a boolean is expected.
Comma-separated media query list.
of_string_strict s parses s as a media query without branch recovery.
of_components components parses an already-tokenized media query. Invalid branches recover to not all unless recover is false.
of_function_body s parses the body of a conditional media(...) function. Unlike a standalone media query, a single feature appears without its outer parentheses in this grammar.
of_function_components components parses an already-tokenized conditional media(...) body.
string_of_ident ident serializes a media identifier value.
to_string ?minify t serialises t as CSS source text. The default ~minify:false keeps the pretty form ((min-width: 30em)); pass ~minify:true for the compact form ((min-width:30em)).
lower_for_minify t applies the target-fact grammar upgrades used under minify: min-X/max-X plain features become the range form X>=V/X<=V, and a lower bound paired with an upper bound on the same feature across an and collapses into the two-sided interval V<=name<=V.
A precomputed sort key for compare. Deriving the order serializes the query and re-extracts its kind, both of which allocate; a sort that compares raw queries pays that on every comparison. Precompute a key once per query with sort_key and compare with compare_keys.
compare_keys k1 k2 orders two queries by their precomputed keys, with no allocation. compare_keys (sort_key a) (sort_key b) = compare a b.
sort_by project items orders items by the media query project returns for each, serializing each query exactly once. Sorting this way, rather than with List.sort (fun a b -> compare (project a) (project b)), is the point of sort_key: the comparator form re-derives and re-serializes a query on every comparison, which a sort does O(n log n) times. The sort is stable.
equal_kind a b tests media query categories for equality.
group_order k is the sort key used to group queries by kind.