@@ -67,32 +67,23 @@ attributeToString (Attribute str) =
67
67
68
68
{- Tags -}
69
69
70
- html = [ Tag " html" ]
71
- body = [ Tag " body" ]
72
- div = [ Tag " div" ]
73
- span = [ Tag " span" ]
74
- nowrap = [ Tag " nowrap" ]
75
- button = [ Tag " button" ]
76
- h1 = [ Tag " h1" ]
77
- h2 = [ Tag " h2" ]
78
- h3 = [ Tag " h3" ]
79
- h4 = [ Tag " h4" ]
80
- p = [ Tag " p" ]
81
- ol = [ Tag " ol" ]
82
- input = [ Tag " input" ]
70
+ html = Tag " html"
71
+ body = Tag " body"
72
+ div = Tag " div"
73
+ span = Tag " span"
74
+ nowrap = Tag " nowrap"
75
+ button = Tag " button"
76
+ h1 = Tag " h1"
77
+ h2 = Tag " h2"
78
+ h3 = Tag " h3"
79
+ h4 = Tag " h4"
80
+ p = Tag " p"
81
+ ol = Tag " ol"
82
+ input = Tag " input"
83
83
84
84
tagToString ( Tag str) = str
85
85
86
86
87
- type alias ElementSelector =
88
- List Tag
89
-
90
- customElement : String -> ElementSelector
91
- customElement str =
92
- [ Tag str ]
93
-
94
-
95
-
96
87
-- TODO these are just for @media - maybe improve type guarantees?
97
88
screen = " screen"
98
89
print = " print"
@@ -412,8 +403,14 @@ styleWithPrefix prefix (Style selector attrs children) childSelector =
412
403
|> Style selector attrs
413
404
414
405
415
- (|%|) : Style class id -> ElementSelector -> Style class id
416
- (|%|) ( Style selector attrs children) tags =
406
+ (|%|) : Style class id -> Tag -> Style class id
407
+ (|%|) ( Style selector attrs children) tag =
408
+ children ++ [ Style ( tagToString tag) [] [] ]
409
+ |> Style selector attrs
410
+
411
+
412
+ (|%|...) : Style class id -> List Tag -> Style class id
413
+ (|%|...) ( Style selector attrs children) tags =
417
414
let
418
415
childSelector =
419
416
tags
@@ -433,24 +430,16 @@ styleWithPrefix prefix (Style selector attrs children) childSelector =
433
430
434
431
435
432
-- TODO use tagToString
436
- (|>%|) : Style class id -> ElementSelector -> Style class id
437
- (|>%|) ( Style selector attrs children) tags =
438
- let
439
- selectorFromTag tag =
440
- case splitStartLast children of
441
- ( _, Nothing ) ->
442
- selector ++ " > " ++ tagToString tag
443
-
444
- ( start, Just ( Style activeSelector _ _) ) ->
445
- activeSelector ++ " > " ++ tagToString tag
433
+ (|>%|) : Style class id -> Tag -> Style class id
434
+ (|>%|) ( Style selector attrs children) tag =
435
+ case splitStartLast children of
436
+ ( _, Nothing ) ->
437
+ children ++ [ Style ( selector ++ " > " ++ tagToString tag) [] [] ]
438
+ |> Style selector attrs
446
439
447
- childSelector =
448
- tags
449
- |> List . map selectorFromTag
450
- |> String . join " , "
451
- in
452
- children ++ [ Style childSelector [] [] ]
453
- |> Style selector attrs
440
+ ( start, Just ( Style activeSelector _ _) ) ->
441
+ children ++ [ Style ( activeSelector ++ " > " ++ tagToString tag) [] [] ]
442
+ |> Style selector attrs
454
443
455
444
456
445
(|.|) : Style class id -> class -> Style class id
0 commit comments