package toffee
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/toffee.style/Style/Track_sizing_function/index.html
Module Style.Track_sizing_functionSource
CSS Grid track sizing functions.
A track sizing function specifies the minimum and maximum sizes of a grid track (row or column). Grid tracks automatically size between their minimum and maximum based on content size, available space, and the sizing constraints applied to the grid.
See MDN: grid-template-columns
type t = {min : Compact_length.t;(*Minimum track sizing function.
*)max : Compact_length.t;(*Maximum track sizing function.
*)
}A track sizing function combining minimum and maximum sizing constraints.
Construction
make ~min ~max creates a track sizing function with explicit min and max constraints.
auto creates a track sized automatically according to grid algorithm rules. Equivalent to minmax(auto, auto).
min_content creates a track sized to the smallest size that fits content with all soft line-wrapping opportunities taken. Equivalent to minmax(min-content, min-content).
max_content creates a track sized to the smallest size that fits content with no soft line-wrapping opportunities taken. Equivalent to minmax(max-content, max-content).
fr value creates a flexible track that takes a fraction of available space. The track receives value parts out of the sum of all fr values in the grid dimension. Equivalent to minmax(auto, <value>fr).
length value creates a fixed-size track with the specified length. Equivalent to minmax(<value>px, <value>px).
percent value creates a track sized as a percentage of the grid container.
The value is a fraction in the range 0.0, 1.0, where 0.5 represents 50%. See Compact_length for percentage conventions.
from_length_percentage lp creates a track from a length or percentage value, applying it to both min and max sizing functions.
fit_content lp creates a track sized by the fit-content formula: max(min-content, min(max-content, lp)).
The track takes the size of lp clamped between min-content and max-content sizes. Equivalent to minmax(auto, fit-content(<lp>)).
minmax ~min ~max creates a track sizing function with separate min and max constraints. Alias for make.
Accessors
min t returns the minimum sizing function.
max t returns the maximum sizing function.
min_sizing_function t returns the minimum sizing function. Alias for min.
max_sizing_function t returns the maximum sizing function. Alias for max.
Predicates
has_fixed_component t returns true if at least one component (min or max) is a fixed length or percentage value.
Comparison and Display
equal a b returns true if a and b represent the same track sizing function.
compare a b compares a and b lexicographically, first by min then by max.
to_string t converts t to a string representation. Returns a compact form when min equals max, otherwise returns minmax(min, max) form.
pp fmt t formats t for pretty-printing.