package cascade

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

Module Css.CalcSource

Builder functions for calc() expressions.

Sourceval add : 'a calc -> 'a calc -> 'a calc

add left right is left + right.

Sourceval sub : 'a calc -> 'a calc -> 'a calc

sub left right is left - right.

Sourceval mul : 'a calc -> 'a calc -> 'a calc

mul left right is left * right.

Sourceval div : 'a calc -> 'a calc -> 'a calc

div left right is left / right.

Sourceval (+) : 'a calc -> 'a calc -> 'a calc

x + y is add x y.

Sourceval (-) : 'a calc -> 'a calc -> 'a calc

x - y is sub x y.

Sourceval (*) : 'a calc -> 'a calc -> 'a calc

x * y is mul x y.

Sourceval (/) : 'a calc -> 'a calc -> 'a calc

x / y is div x y.

Sourceval length : length -> length calc

length len is len lifted into calc.

Sourceval var : ?default:'a -> ?fallback:'a fallback -> string -> 'a calc

var ?default ?fallback name is a variable reference for calc expressions. Example: var "spacing" or var ~fallback:(Rem 1.2) "tw-leading".

Sourceval float : float -> 'a calc

float f is a numeric value for calc expressions. It is unitless, so it works in a calc of any leaf type (e.g. a flex-basis multiplier), not only lengths.

Sourceval infinity : 'a calc

infinity is the CSS infinity value for calc expressions.

Sourceval px : float -> length calc

px n is a pixel value for calc expressions.

Sourceval rem : float -> length calc

rem f is a rem value for calc expressions.

Sourceval em : float -> length calc

em f is an em value for calc expressions.

Sourceval pct : float -> length calc

pct f is a percentage value for calc expressions.

Sourceval nested : 'a calc -> 'a calc

nested inner wraps inner in an explicit nested calc() call. This produces output like calc(calc(...)*...) instead of calc(...*...).

Sourceval parens : 'a calc -> 'a calc

parens inner wraps inner in parentheses only. This produces output like calc(...*(...)) instead of calc(...*calc(...)).