0 | module Text.CSS.Property
5 | import Text.CSS.Color
7 | import Text.CSS.Flexbox
9 | import Text.CSS.Length
10 | import Text.CSS.ListStyleType
11 | import Text.CSS.Percentage
17 | data BoxSizing = BorderBox | ContentBox
20 | Interpolation BoxSizing where
21 | interpolate BorderBox = "border-box"
22 | interpolate ContentBox = "content-box"
26 | data Direction = LTR | RTL
29 | Interpolation Direction where
30 | interpolate LTR = "ltr"
31 | interpolate RTL = "rtl"
35 | interface AreaTag a where
36 | showTag : a -> String
39 | data Display : Type where
42 | Area : {0 n,m : Nat}
45 | => (rows : Vect (S m) GridValue)
46 | -> (columns : Vect (S n) GridValue)
47 | -> (area : Vect (S m) (Vect (S n) a))
52 | {auto _ : AreaTag a}
53 | -> Vect (S m) GridValue
54 | -> Vect (S n) GridValue
55 | -> Vect (S m) (Vect (S n) a)
57 | renderArea rs cs as =
58 | let rsStr := "grid-template-rows: \{toList rs}"
59 | csStr := "grid-template-columns: \{toList cs}"
60 | aStr := fastConcat . intersperse " " . map col $
toList as
61 | in "display: grid; \{rsStr}; \{csStr}; grid-template-areas: \{aStr}"
64 | col : Vect (S n) a -> String
66 | let str := concat . intersperse " " . map showTag $
toList vs
71 | data FlexBasis : Type where
72 | FL : Length -> FlexBasis
73 | FP : Percentage -> FlexBasis
76 | Interpolation FlexBasis where
77 | interpolate (FL x) = interpolate x
78 | interpolate (FP x) = interpolate x
81 | Cast Length FlexBasis where
85 | Cast Percentage FlexBasis where
90 | data FontSize : Type where
91 | FL : Length -> FontSize
92 | FP : Percentage -> FontSize
100 | XXXLarge : FontSize
103 | Interpolation FontSize where
104 | interpolate (FL x) = interpolate x
105 | interpolate (FP x) = interpolate x
106 | interpolate XXSmall = "xx-small"
107 | interpolate XSmall = "x-small"
108 | interpolate Small = "small"
109 | interpolate Medium = "medium"
110 | interpolate Large = "large"
111 | interpolate XLarge = "x-large"
112 | interpolate XXLarge = "xx-large"
113 | interpolate XXXLarge = "xxx-large"
116 | Cast Length FontSize where
120 | Cast Percentage FontSize where
123 | namespace FontWeight
125 | data FontWeight : Type where
126 | Normal : FontWeight
128 | Lighter : FontWeight
129 | Bolder : FontWeight
141 | Interpolation FontWeight where
142 | interpolate Normal = "normal"
143 | interpolate Bold = "bold"
144 | interpolate Lighter = "lighter"
145 | interpolate Bolder = "bolder"
146 | interpolate FW100 = "100"
147 | interpolate FW200 = "200"
148 | interpolate FW300 = "300"
149 | interpolate FW400 = "400"
150 | interpolate FW500 = "500"
151 | interpolate FW600 = "600"
152 | interpolate FW700 = "700"
153 | interpolate FW800 = "800"
154 | interpolate FW900 = "900"
156 | namespace BorderRadius
158 | data BorderRadius : Type where
159 | BL : Length -> BorderRadius
160 | BP : Percentage -> BorderRadius
161 | BS : String -> BorderRadius
164 | Interpolation BorderRadius where
165 | interpolate (BL x) = interpolate x
166 | interpolate (BP x) = interpolate x
167 | interpolate (BS x) = x
170 | Cast Length BorderRadius where
174 | Cast Percentage BorderRadius where
178 | FromString BorderRadius where
181 | namespace BorderStyle
183 | data BorderStyle : Type where
185 | Hidden : BorderStyle
186 | Dotted : BorderStyle
187 | Dashed : BorderStyle
188 | Solid : BorderStyle
190 | Groove : BorderStyle
191 | Ridge : BorderStyle
192 | Inset : BorderStyle
193 | Outset : BorderStyle
197 | Interpolation BorderStyle where
198 | interpolate None = "none"
199 | interpolate Hidden = "hidden"
200 | interpolate Dotted = "dotted"
201 | interpolate Dashed = "dashed"
202 | interpolate Solid = "solid"
203 | interpolate Dbl = "double"
204 | interpolate Groove = "groove"
205 | interpolate Ridge = "ridge"
206 | interpolate Inset = "inset"
207 | interpolate Outset = "outset"
209 | namespace BorderWidth
211 | data BorderWidth : Type where
212 | BL : Length -> BorderWidth
214 | Medium : BorderWidth
215 | Thick : BorderWidth
218 | Interpolation BorderWidth where
219 | interpolate (BL x) = interpolate x
220 | interpolate Thin = "thin"
221 | interpolate Medium = "medium"
222 | interpolate Thick = "thick"
225 | Cast Length BorderWidth where
235 | data Overflow : Type where
261 | Interpolation Overflow where
262 | interpolate Visible = "visible"
263 | interpolate Hidden = "hidden"
264 | interpolate Clip = "clip"
265 | interpolate Scroll = "scroll"
266 | interpolate Auto = "auto"
268 | namespace TextAlign
270 | data TextAlign : Type where
282 | Justify : TextAlign
285 | Interpolation TextAlign where
286 | interpolate Start = "start"
287 | interpolate End = "end"
288 | interpolate Left = "left"
289 | interpolate Right = "right"
290 | interpolate Center = "center"
291 | interpolate Justify = "justify"
293 | namespace TextDecorationLine
296 | data TextDecorationLine : Type where
297 | None : TextDecorationLine
298 | Underline : TextDecorationLine
299 | Overline : TextDecorationLine
300 | LineThrough : TextDecorationLine
303 | Interpolation TextDecorationLine where
304 | interpolate None = "none"
305 | interpolate Underline = "underline"
306 | interpolate Overline = "overline"
307 | interpolate LineThrough = "line-through"
309 | namespace TextDecorationStyle
312 | data TextDecorationStyle : Type where
313 | Solid : TextDecorationStyle
314 | Dbl : TextDecorationStyle
315 | Dotted : TextDecorationStyle
316 | Dashed : TextDecorationStyle
317 | Wavy : TextDecorationStyle
320 | Interpolation TextDecorationStyle where
321 | interpolate Solid = "solid"
322 | interpolate Dbl = "double"
323 | interpolate Dotted = "dotted"
324 | interpolate Dashed = "dashed"
325 | interpolate Wavy = "wavy"
327 | namespace TextOverflow
329 | data TextOverflow = Clip | Ellipsis
332 | Interpolation TextOverflow where
333 | interpolate Clip = "clip"
334 | interpolate Ellipsis = "ellipsis"
338 | data Width : Type where
339 | WL : Length -> Width
340 | WP : Percentage -> Width
343 | Interpolation Width where
344 | interpolate (WL x) = interpolate x
345 | interpolate (WP x) = interpolate x
348 | Cast Length Width where
352 | Cast Percentage Width where
355 | namespace WiteSpace
359 | data WhiteSpace : Type where
363 | Normal : WhiteSpace
366 | Nowrap : WhiteSpace
375 | PreWrap : WhiteSpace
378 | PreLine : WhiteSpace
389 | BreakSpaces : WhiteSpace
392 | Interpolation WhiteSpace where
393 | interpolate Normal = "normal"
394 | interpolate Nowrap = "nowrap"
395 | interpolate Pre = "pre"
396 | interpolate PreWrap = "pre-wrap"
397 | interpolate PreLine = "pre-line"
398 | interpolate BreakSpaces = "break-spaces"