package toffee

  1. Overview
  2. Docs
CSS layout engine for OCaml (Flexbox, Grid, Block)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.1.0.tbz
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9

doc/toffee.style/Style/Grid_template_area/index.html

Module Style.Grid_template_areaSource

CSS grid template areas.

A grid template area defines a named rectangular region in a CSS grid. Named areas allow grid items to be positioned using semantic identifiers rather than numeric line indices. Multiple grid items can reference the same area name.

See MDN: grid-template-areas.

Sourcetype t = {
  1. name : string;
    (*

    The name identifying this grid area. Area names must match across all rows they span to form a valid rectangular region.

    *)
  2. row_start : int;
    (*

    The starting row line index in grid coordinates. Uses 1-based indexing.

    *)
  3. row_end : int;
    (*

    The ending row line index in grid coordinates. Exclusive bound using 1-based indexing.

    *)
  4. column_start : int;
    (*

    The starting column line index in grid coordinates. Uses 1-based indexing.

    *)
  5. column_end : int;
    (*

    The ending column line index in grid coordinates. Exclusive bound using 1-based indexing.

    *)
}

A named grid area.

Invariant: row_start < row_end and column_start < column_end for valid rectangular regions.

Constructors

Sourceval make : name:string -> row_start:int -> row_end:int -> column_start:int -> column_end:int -> t

make ~name ~row_start ~row_end ~column_start ~column_end creates a grid area.

Coordinates use 1-based indexing. The row_end and column_end values are exclusive bounds.

Precondition: row_start < row_end and column_start < column_end. This is not validated; invalid coordinates may cause incorrect layout behavior.

Accessors

Sourceval name : t -> string

name t returns the area's name identifier.

Sourceval row_start : t -> int

row_start t returns the starting row line index.

Sourceval row_end : t -> int

row_end t returns the ending row line index.

Sourceval column_start : t -> int

column_start t returns the starting column line index.

Sourceval column_end : t -> int

column_end t returns the ending column line index.

Comparison

Sourceval equal : t -> t -> bool

equal a b tests structural equality of grid areas.

Two areas are equal if all their fields match.

Sourceval compare : t -> t -> int

compare a b provides total ordering of grid areas.

Comparison proceeds lexicographically: name, then row_start, then row_end, then column_start, then column_end.