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.geometry/Geometry/Line/index.html

Module 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.