package cascade

  1. Overview
  2. Docs
CSS generation and manipulation library for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cascade-1.0.0.tbz
sha256=c11bbdc7ab0eee8c03cd162e3e7fd1cb20de62beb13342b3b150a89264ee0056
sha512=43fd97a55c3b1dc4db5c87aa1a5a047d902e902ab2064af3a7c5bf945ebc333f8cd90ecca8013c17be5b950498eace8e0094ee4319eba408285e2bec8d7cdf7b

doc/cascade/Cascade/Container/index.html

Module Cascade.ContainerSource

CSS container query condition types

Sourcetype component_values = Values.component_values

Container query condition type

Parsed CSS component values preserved inside style queries.

Sourcetype t =
  1. | Min_width_rem of float
    (*

    Container min-width in rem: @container (min-width:Xrem)

    *)
  2. | Min_width_px of int
    (*

    Container min-width in pixels: @container (min-width:Xpx)

    *)
  3. | Named of string * t
    (*

    Named container with condition: @container name (condition)

    *)
  4. | Style of {
    1. query : style_query;
    2. uppercase : bool;
      (*

      true when the source spelled the function as STYLE(...) (case preserved for round-trip fidelity); false for the canonical lowercase spelling.

      *)
    }
    (*

    Style query: style(--flag), style(property: value), or a custom-property range query, optionally composed with and, or, or not.

    *)
  5. | Scroll_state of {
    1. query : scroll_state_query;
    2. uppercase : bool;
      (*

      true when the source spelled the function as SCROLL-STATE(...).

      *)
    }
    (*

    Scroll-state query: scroll-state(stuck: top).

    *)
  6. | And of t * t
    (*

    (A) and (B)

    *)
  7. | Or of t * t
    (*

    (A) or (B)

    *)
  8. | Not of t
    (*

    not (A)

    *)
  9. | Feature_query of Media.t
    (*

    Container size/range feature query, e.g. (inline-size: 640px) or (inline-size > 30em).

    *)
Sourceand style_query =
  1. | Boolean of string
  2. | Declaration of {
    1. name : string;
    2. value : component_values;
    }
  3. | Range of style_range
  4. | All of style_query * style_query
  5. | Any of style_query * style_query
  6. | Neg of style_query
Sourceand style_range = {
  1. lower : component_values;
  2. lower_op : range_operator;
  3. name : string;
  4. upper_op : range_operator;
  5. upper : component_values;
}
Sourceand range_operator =
  1. | Lt
  2. | Lte
  3. | Gt
  4. | Gte
Sourceand scroll_state_query =
  1. | State of {
    1. name : string;
    2. value : string;
    }
  2. | Both of scroll_state_query * scroll_state_query
  3. | Either of scroll_state_query * scroll_state_query
  4. | Negated of scroll_state_query
Sourcetype kind =
  1. | Min_width
  2. | Other
    (*

    Coarse container condition category.

    *)
Sourceval kind : t -> kind

kind t classifies min-width-only conditions for compatibility helpers.

Sourceval lower_for_minify : t -> t

lower_for_minify t applies Media.lower_for_minify to every nested feature query, leaving the dedicated Min_width_*, style, and scroll-state forms untouched.

Sourceval to_string : ?minify:bool -> t -> string

to_string t converts a container condition to its CSS string representation. Typed Min_width_* shorthands keep their historical compact form; stylesheet printing uses to_stylesheet_string when pretty spacing is required.

Sourceval to_stylesheet_string : ?minify:bool -> t -> string

to_stylesheet_string t converts a container condition for stylesheet printing. Non-minified output keeps optional whitespace in typed shorthand feature queries.

Sourceval pp : t -> string

pp t returns a string representation of a container condition.

Sourceval of_string : string -> t

of_string s parses a container condition. Raises Failure for malformed conditions.

Sourceval feature : string -> Media.value -> t

feature name value is the typed container feature query constructed via Media.feature.

Sourceval style : ?value:string -> string -> t

style ?value prop is a style() query. With no value, prop must be a custom property and the query matches the boolean form style(--prop). With a value it matches style(prop: value). Constructs the canonical lowercase form.

Sourceval scroll_state : string -> string -> t

scroll_state prop value is the canonical lowercase Scroll_state query, matching scroll-state(prop: value).

Sourceval compare : t -> t -> int

compare t1 t2 compares two container conditions.