package toffee

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Style.Repetition_countSource

CSS Grid track repetition counts.

This module defines how track definitions repeat in CSS Grid layouts. Repetitions can be explicit (repeat N times) or automatic (fill/fit the container).

See CSS Grid Level 1 - Auto-repeat for the specification of auto-repeated track definitions.

Sourcetype t =
  1. | Count of int
    (*

    Repeat the track definition exactly N times. N must be positive.

    *)
  2. | Auto_fill
    (*

    Generate tracks to fill the container. See MDN auto-fill.

    *)
  3. | Auto_fit
    (*

    Generate tracks to fit the container. See MDN auto-fit.

    *)

Constructors

Sourceval count : int -> t

count n creates a repetition count of exactly n times.

Raises Invalid_argument if n is not positive.

Sourceval auto_fill : t

auto_fill creates an auto-fill repetition.

Sourceval auto_fit : t

auto_fit creates an auto-fit repetition.

Predicates

Sourceval is_auto : t -> bool

is_auto t returns true if t is Auto_fill or Auto_fit.

Comparison and Equality

Sourceval equal : t -> t -> bool

equal a b returns true if a and b represent the same repetition count.

Sourceval compare : t -> t -> int

compare a b provides a total ordering over repetition counts. Count values are ordered first by their integer value, followed by Auto_fill, then Auto_fit.

Conversion

Sourceval to_string : t -> string

to_string t converts t to its CSS representation. Count n yields the integer as a string, Auto_fill yields "auto-fill", and Auto_fit yields "auto-fit".

Sourceval of_string : string -> (t, string) result

of_string s parses s as a repetition count. Accepts "auto-fit", "auto-fill", or a positive integer string. Returns Error msg if s is invalid.

Sourceval pp : Format.formatter -> t -> unit

pp fmt t outputs t to fmt using to_string.