Tailwind classes in OCaml
1type direction =
2 | Row
3 | Row_reverse
4 | Col
5 | Col_reverse
6
7type wrap =
8 | Wrap
9 | Wrap_reverse
10 | Nowrap
11
12type justify =
13 | Normal
14 | Start
15 | End
16 | Center
17 | Between
18 | Around
19 | Evenly
20 | Stretch
21
22type align_items =
23 | Start
24 | End
25 | Center
26 | Baseline
27 | Stretch
28
29type align_content =
30 | Normal
31 | Start
32 | End
33 | Center
34 | Between
35 | Around
36 | Evenly
37 | Stretch
38 | Baseline
39
40type align_self =
41 | Auto
42 | Start
43 | End
44 | Center
45 | Stretch
46 | Baseline
47
48type t =
49 | Direction of direction
50 | Wrap_setting of wrap
51 | Justify of justify
52 | Align_items of align_items
53 | Align_content of align_content
54 | Align_self of align_self
55 | Grow of int option
56 | Shrink of int option
57 | Basis of Size.t
58 | Flex of [`Initial | `One | `Auto | `None]
59
60let to_class = function
61 | Direction Row -> Css.make "flex-row"
62 | Direction Row_reverse -> Css.make "flex-row-reverse"
63 | Direction Col -> Css.make "flex-col"
64 | Direction Col_reverse -> Css.make "flex-col-reverse"
65 | Wrap_setting Wrap -> Css.make "flex-wrap"
66 | Wrap_setting Wrap_reverse -> Css.make "flex-wrap-reverse"
67 | Wrap_setting Nowrap -> Css.make "flex-nowrap"
68 | Justify Normal -> Css.make "justify-normal"
69 | Justify Start -> Css.make "justify-start"
70 | Justify End -> Css.make "justify-end"
71 | Justify Center -> Css.make "justify-center"
72 | Justify Between -> Css.make "justify-between"
73 | Justify Around -> Css.make "justify-around"
74 | Justify Evenly -> Css.make "justify-evenly"
75 | Justify Stretch -> Css.make "justify-stretch"
76 | Align_items Start -> Css.make "items-start"
77 | Align_items End -> Css.make "items-end"
78 | Align_items Center -> Css.make "items-center"
79 | Align_items Baseline -> Css.make "items-baseline"
80 | Align_items Stretch -> Css.make "items-stretch"
81 | Align_content Normal -> Css.make "content-normal"
82 | Align_content Start -> Css.make "content-start"
83 | Align_content End -> Css.make "content-end"
84 | Align_content Center -> Css.make "content-center"
85 | Align_content Between -> Css.make "content-between"
86 | Align_content Around -> Css.make "content-around"
87 | Align_content Evenly -> Css.make "content-evenly"
88 | Align_content Stretch -> Css.make "content-stretch"
89 | Align_content Baseline -> Css.make "content-baseline"
90 | Align_self Auto -> Css.make "self-auto"
91 | Align_self Start -> Css.make "self-start"
92 | Align_self End -> Css.make "self-end"
93 | Align_self Center -> Css.make "self-center"
94 | Align_self Stretch -> Css.make "self-stretch"
95 | Align_self Baseline -> Css.make "self-baseline"
96 | Grow None -> Css.make "grow-0"
97 | Grow (Some 0) -> Css.make "grow-0"
98 | Grow (Some n) -> Css.make (Printf.sprintf "grow-%d" n)
99 | Shrink None -> Css.make "shrink-0"
100 | Shrink (Some 0) -> Css.make "shrink-0"
101 | Shrink (Some n) -> Css.make (Printf.sprintf "shrink-%d" n)
102 | Basis size -> Css.make (Printf.sprintf "basis-%s" (Size.to_string size))
103 | Flex `Initial -> Css.make "flex-initial"
104 | Flex `One -> Css.make "flex-1"
105 | Flex `Auto -> Css.make "flex-auto"
106 | Flex `None -> Css.make "flex-none"
107
108let direction d = Direction d
109let wrap w = Wrap_setting w
110let justify j = Justify j
111let align_items a = Align_items a
112let align_content a = Align_content a
113let align_self a = Align_self a
114let grow g = Grow g
115let shrink s = Shrink s
116let basis b = Basis b
117let flex f = Flex f
118
119let combine ts = Css.concat (List.map to_class ts)