Tailwind classes in OCaml
1type overflow =
2 | Auto
3 | Hidden
4 | Clip
5 | Visible
6 | Scroll
7
8type box_sizing =
9 | Border_box
10 | Content_box
11
12type object_fit =
13 | Contain
14 | Cover
15 | Fill
16 | None
17 | Scale_down
18
19type object_position =
20 | Bottom | Center | Left | Left_bottom | Left_top
21 | Right | Right_bottom | Right_top | Top
22
23type t =
24 | Width of Size.t
25 | Height of Size.t
26 | Min_width of Size.t
27 | Max_width of Size.t
28 | Min_height of Size.t
29 | Max_height of Size.t
30 | Overflow of [`All | `X | `Y] * overflow
31 | Box_sizing of box_sizing
32 | Object_fit of object_fit
33 | Object_position of object_position
34 | Aspect of [`Auto | `Square | `Video | `Ratio of int * int]
35
36let to_class = function
37 | Width size -> Css.make (Printf.sprintf "w-%s" (Size.to_string size))
38 | Height size -> Css.make (Printf.sprintf "h-%s" (Size.to_string size))
39 | Min_width size -> Css.make (Printf.sprintf "min-w-%s" (Size.to_string size))
40 | Max_width size -> Css.make (Printf.sprintf "max-w-%s" (Size.to_string size))
41 | Min_height size -> Css.make (Printf.sprintf "min-h-%s" (Size.to_string size))
42 | Max_height size -> Css.make (Printf.sprintf "max-h-%s" (Size.to_string size))
43 | Overflow (`All, Auto) -> Css.make "overflow-auto"
44 | Overflow (`All, Hidden) -> Css.make "overflow-hidden"
45 | Overflow (`All, Clip) -> Css.make "overflow-clip"
46 | Overflow (`All, Visible) -> Css.make "overflow-visible"
47 | Overflow (`All, Scroll) -> Css.make "overflow-scroll"
48 | Overflow (`X, Auto) -> Css.make "overflow-x-auto"
49 | Overflow (`X, Hidden) -> Css.make "overflow-x-hidden"
50 | Overflow (`X, Clip) -> Css.make "overflow-x-clip"
51 | Overflow (`X, Visible) -> Css.make "overflow-x-visible"
52 | Overflow (`X, Scroll) -> Css.make "overflow-x-scroll"
53 | Overflow (`Y, Auto) -> Css.make "overflow-y-auto"
54 | Overflow (`Y, Hidden) -> Css.make "overflow-y-hidden"
55 | Overflow (`Y, Clip) -> Css.make "overflow-y-clip"
56 | Overflow (`Y, Visible) -> Css.make "overflow-y-visible"
57 | Overflow (`Y, Scroll) -> Css.make "overflow-y-scroll"
58 | Box_sizing Border_box -> Css.make "box-border"
59 | Box_sizing Content_box -> Css.make "box-content"
60 | Object_fit Contain -> Css.make "object-contain"
61 | Object_fit Cover -> Css.make "object-cover"
62 | Object_fit Fill -> Css.make "object-fill"
63 | Object_fit None -> Css.make "object-none"
64 | Object_fit Scale_down -> Css.make "object-scale-down"
65 | Object_position Bottom -> Css.make "object-bottom"
66 | Object_position Center -> Css.make "object-center"
67 | Object_position Left -> Css.make "object-left"
68 | Object_position Left_bottom -> Css.make "object-left-bottom"
69 | Object_position Left_top -> Css.make "object-left-top"
70 | Object_position Right -> Css.make "object-right"
71 | Object_position Right_bottom -> Css.make "object-right-bottom"
72 | Object_position Right_top -> Css.make "object-right-top"
73 | Object_position Top -> Css.make "object-top"
74 | Aspect `Auto -> Css.make "aspect-auto"
75 | Aspect `Square -> Css.make "aspect-square"
76 | Aspect `Video -> Css.make "aspect-video"
77 | Aspect (`Ratio (w, h)) -> Css.make (Printf.sprintf "aspect-[%d/%d]" w h)
78
79let width size = Width size
80let height size = Height size
81let min_width size = Min_width size
82let max_width size = Max_width size
83let min_height size = Min_height size
84let max_height size = Max_height size
85let overflow dir overflow = Overflow (dir, overflow)
86let box_sizing bs = Box_sizing bs
87let object_fit of_ = Object_fit of_
88let object_position op = Object_position op
89let aspect a = Aspect a
90
91let w_full = Css.make "w-full"
92let w_screen = Css.make "w-screen"
93let w_auto = Css.make "w-auto"
94let w_fit = Css.make "w-fit"
95
96let h_full = Css.make "h-full"
97let h_screen = Css.make "h-screen"
98let h_auto = Css.make "h-auto"
99let h_fit = Css.make "h-fit"