4 | import Text.CSS.Length
5 | import Text.CSS.Percentage
17 | fr : Cast Flex a => Bits16 -> a
21 | Interpolation Flex where
22 | interpolate f = "\{show f.value}fr"
29 | data MinMaxValue : Type where
31 | MML : Length -> MinMaxValue
32 | MMP : Percentage -> MinMaxValue
33 | MMF : Flex -> MinMaxValue
34 | MinContent : MinMaxValue
35 | MaxContent : MinMaxValue
38 | Cast Length MinMaxValue where
42 | Cast Percentage MinMaxValue where
46 | Cast Flex MinMaxValue where
50 | Interpolation MinMaxValue where
51 | interpolate Auto = "auto"
52 | interpolate MinContent = "min-content"
53 | interpolate MaxContent = "max-content"
54 | interpolate (MML x) = interpolate x
55 | interpolate (MMP x) = interpolate x
56 | interpolate (MMF x) = interpolate x
64 | data GridValue : Type where
65 | GL : Length -> GridValue
66 | GP : Percentage -> GridValue
67 | GF : Flex -> GridValue
68 | MinMax : (min,max : MinMaxValue) -> GridValue
69 | MaxContent : GridValue
70 | MinContent : GridValue
73 | Interpolation GridValue where
74 | interpolate (GL x) = interpolate x
75 | interpolate (GP x) = interpolate x
76 | interpolate (GF x) = interpolate x
77 | interpolate (MinMax min max) = "minmax(\{min}, \{max})"
78 | interpolate MaxContent = "max-content"
79 | interpolate MinContent = "min-content"
82 | Interpolation (List GridValue) where
83 | interpolate = fastConcat . intersperse " " . map interpolate
86 | Cast Length GridValue where
90 | Cast Percentage GridValue where
94 | Cast Flex GridValue where
102 | data GridPosition : Type where
103 | At : Bits32 -> GridPosition
104 | FromTo : Bits32 -> Bits32 -> GridPosition
107 | Interpolation GridPosition where
108 | interpolate (At x) = show x
109 | interpolate (FromTo x y) = "\{show x} / \{show y}"