4 | import Text.CSS.Length
5 | import Text.CSS.Percentage
17 | fr : Cast Flex a => Bits16 -> a
21 | (.fr) : Cast Flex a => Bits16 -> a
25 | Interpolation Flex where
26 | interpolate f = "\{show f.value}fr"
33 | data MinMaxValue : Type where
35 | MML : Length -> MinMaxValue
36 | MMP : Percentage -> MinMaxValue
37 | MMF : Flex -> MinMaxValue
38 | MinContent : MinMaxValue
39 | MaxContent : MinMaxValue
42 | Cast Length MinMaxValue where
46 | Cast Percentage MinMaxValue where
50 | Cast Flex MinMaxValue where
54 | Interpolation MinMaxValue where
55 | interpolate Auto = "auto"
56 | interpolate MinContent = "min-content"
57 | interpolate MaxContent = "max-content"
58 | interpolate (MML x) = interpolate x
59 | interpolate (MMP x) = interpolate x
60 | interpolate (MMF x) = interpolate x
68 | data GridValue : Type where
69 | GL : Length -> GridValue
70 | GP : Percentage -> GridValue
71 | GF : Flex -> GridValue
72 | MinMax : (min,max : MinMaxValue) -> GridValue
73 | MaxContent : GridValue
74 | MinContent : GridValue
77 | Interpolation GridValue where
78 | interpolate (GL x) = interpolate x
79 | interpolate (GP x) = interpolate x
80 | interpolate (GF x) = interpolate x
81 | interpolate (MinMax min max) = "minmax(\{min}, \{max})"
82 | interpolate MaxContent = "max-content"
83 | interpolate MinContent = "min-content"
86 | Interpolation (List GridValue) where
87 | interpolate = fastConcat . intersperse " " . map interpolate
90 | Cast Length GridValue where
94 | Cast Percentage GridValue where
98 | Cast Flex GridValue where
106 | data GridPosition : Type where
107 | At : Bits32 -> GridPosition
108 | FromTo : Bits32 -> Bits32 -> GridPosition
111 | Interpolation GridPosition where
112 | interpolate (At x) = show x
113 | interpolate (FromTo x y) = "\{show x} / \{show y}"