type cols = [ | `None | `Subgrid | `Cols of int ] type rows = [ | `None | `Subgrid | `Rows of int ] type span = [ | `Auto | `Full | `Span of int | `Start of int | `End of int ] type flow = [ | `Row | `Col | `Dense | `Row_dense | `Col_dense ] type t = [ | `Template_cols of cols | `Template_rows of rows | `Col of span | `Row of span | `Auto_flow of flow | `Auto_cols of [`Auto | `Min | `Max | `Fr of int] | `Auto_rows of [`Auto | `Min | `Max | `Fr of int] ] let to_class = function | `Template_cols `None -> Css.make "grid-cols-none" | `Template_cols `Subgrid -> Css.make "grid-cols-subgrid" | `Template_cols (`Cols n) -> Css.make (Printf.sprintf "grid-cols-%d" n) | `Template_rows `None -> Css.make "grid-rows-none" | `Template_rows `Subgrid -> Css.make "grid-rows-subgrid" | `Template_rows (`Rows n) -> Css.make (Printf.sprintf "grid-rows-%d" n) | `Col `Auto -> Css.make "col-auto" | `Col `Full -> Css.make "col-full" | `Col (`Span n) -> Css.make (Printf.sprintf "col-span-%d" n) | `Col (`Start n) -> Css.make (Printf.sprintf "col-start-%d" n) | `Col (`End n) -> Css.make (Printf.sprintf "col-end-%d" n) | `Row `Auto -> Css.make "row-auto" | `Row `Full -> Css.make "row-full" | `Row (`Span n) -> Css.make (Printf.sprintf "row-span-%d" n) | `Row (`Start n) -> Css.make (Printf.sprintf "row-start-%d" n) | `Row (`End n) -> Css.make (Printf.sprintf "row-end-%d" n) | `Auto_flow `Row -> Css.make "grid-flow-row" | `Auto_flow `Col -> Css.make "grid-flow-col" | `Auto_flow `Dense -> Css.make "grid-flow-dense" | `Auto_flow `Row_dense -> Css.make "grid-flow-row-dense" | `Auto_flow `Col_dense -> Css.make "grid-flow-col-dense" | `Auto_cols `Auto -> Css.make "auto-cols-auto" | `Auto_cols `Min -> Css.make "auto-cols-min" | `Auto_cols `Max -> Css.make "auto-cols-max" | `Auto_cols (`Fr n) -> Css.make (Printf.sprintf "auto-cols-fr-%d" n) | `Auto_rows `Auto -> Css.make "auto-rows-auto" | `Auto_rows `Min -> Css.make "auto-rows-min" | `Auto_rows `Max -> Css.make "auto-rows-max" | `Auto_rows (`Fr n) -> Css.make (Printf.sprintf "auto-rows-fr-%d" n) let template_cols cols = `Template_cols cols let template_rows rows = `Template_rows rows let col span = `Col span let row span = `Row span let auto_flow flow = `Auto_flow flow let auto_cols cols = `Auto_cols cols let auto_rows rows = `Auto_rows rows let combine ts = Css.concat (List.map to_class ts)