package toffee

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.2.0.tbz
sha256=ab48bc02082f9c1deea0769a13c2935df529536630745ec3a3d718f59656109b
sha512=c0f3c490e13ca60217d9d59c9bfdf3ada12e1565f04fe2a623e7c94298d519393eabe404e2317726712bf5e7fa860780a07494e77994ac05032e71f535c56910

doc/toffee.geometry/Toffee_geometry/Line/index.html

Module Toffee_geometry.LineSource

An abstract line with start and end positions.

A line represents any type that has a start and an end, used throughout the layout engine to represent pairs of values along an axis (e.g., padding, margin, or insets in a single direction).

Sourcetype 'a t = {
  1. start : 'a;
  2. end_ : 'a;
}

The type of a line with start and end values of type 'a.

The end_ field uses an underscore suffix to avoid conflict with the OCaml keyword end.

Constants

Sourceval both_true : bool t

A line with both start and end set to true.

Sourceval both_false : bool t

A line with both start and end set to false.

Creation

Sourceval make : 'a -> 'a -> 'a t

make start end_ creates a line.

Transformations

Sourceval map : ('a -> 'b) -> 'a t -> 'b t

map f line applies f to both start and end values.

Sourceval map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 f line1 line2 applies f to corresponding components.

Operations

Sourceval sum : float t -> float

sum line returns the sum of start and end values.

This is typically used when computing total padding or margins along an axis.

Comparison and display

Sourceval compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare cmp a b compares two lines using cmp.

Compares start fields first, then end_ fields if start values are equal.

Sourceval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal eq a b tests equality of two lines using eq.

Returns true if both start and end values are equal according to eq.

Sourceval to_string : ('a -> string) -> 'a t -> string

to_string f line converts line to a string representation using f to format individual values.

Sourceval pp : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit

pp f fmt line pretty-prints line to fmt using f to format individual values.