type direction = | Row | Row_reverse | Col | Col_reverse type wrap = | Wrap | Wrap_reverse | Nowrap type justify = | Normal | Start | End | Center | Between | Around | Evenly | Stretch type align_items = | Start | End | Center | Baseline | Stretch type align_content = | Normal | Start | End | Center | Between | Around | Evenly | Stretch | Baseline type align_self = | Auto | Start | End | Center | Stretch | Baseline type t = | Direction of direction | Wrap_setting of wrap | Justify of justify | Align_items of align_items | Align_content of align_content | Align_self of align_self | Grow of int option | Shrink of int option | Basis of Size.t | Flex of [`Initial | `One | `Auto | `None] let to_class = function | Direction Row -> Css.make "flex-row" | Direction Row_reverse -> Css.make "flex-row-reverse" | Direction Col -> Css.make "flex-col" | Direction Col_reverse -> Css.make "flex-col-reverse" | Wrap_setting Wrap -> Css.make "flex-wrap" | Wrap_setting Wrap_reverse -> Css.make "flex-wrap-reverse" | Wrap_setting Nowrap -> Css.make "flex-nowrap" | Justify Normal -> Css.make "justify-normal" | Justify Start -> Css.make "justify-start" | Justify End -> Css.make "justify-end" | Justify Center -> Css.make "justify-center" | Justify Between -> Css.make "justify-between" | Justify Around -> Css.make "justify-around" | Justify Evenly -> Css.make "justify-evenly" | Justify Stretch -> Css.make "justify-stretch" | Align_items Start -> Css.make "items-start" | Align_items End -> Css.make "items-end" | Align_items Center -> Css.make "items-center" | Align_items Baseline -> Css.make "items-baseline" | Align_items Stretch -> Css.make "items-stretch" | Align_content Normal -> Css.make "content-normal" | Align_content Start -> Css.make "content-start" | Align_content End -> Css.make "content-end" | Align_content Center -> Css.make "content-center" | Align_content Between -> Css.make "content-between" | Align_content Around -> Css.make "content-around" | Align_content Evenly -> Css.make "content-evenly" | Align_content Stretch -> Css.make "content-stretch" | Align_content Baseline -> Css.make "content-baseline" | Align_self Auto -> Css.make "self-auto" | Align_self Start -> Css.make "self-start" | Align_self End -> Css.make "self-end" | Align_self Center -> Css.make "self-center" | Align_self Stretch -> Css.make "self-stretch" | Align_self Baseline -> Css.make "self-baseline" | Grow None -> Css.make "grow-0" | Grow (Some 0) -> Css.make "grow-0" | Grow (Some n) -> Css.make (Printf.sprintf "grow-%d" n) | Shrink None -> Css.make "shrink-0" | Shrink (Some 0) -> Css.make "shrink-0" | Shrink (Some n) -> Css.make (Printf.sprintf "shrink-%d" n) | Basis size -> Css.make (Printf.sprintf "basis-%s" (Size.to_string size)) | Flex `Initial -> Css.make "flex-initial" | Flex `One -> Css.make "flex-1" | Flex `Auto -> Css.make "flex-auto" | Flex `None -> Css.make "flex-none" let direction d = Direction d let wrap w = Wrap_setting w let justify j = Justify j let align_items a = Align_items a let align_content a = Align_content a let align_self a = Align_self a let grow g = Grow g let shrink s = Shrink s let basis b = Basis b let flex f = Flex f let combine ts = Css.concat (List.map to_class ts)