File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ tooltips = do
151151 css
152152 " tooltips"
153153 " .tooltips:hover > .tooltip"
154- [ Declaration " visibility " " visible " ]
154+ (declarations hidden)
155155
156156 red = HexColor " #F00"
157157
@@ -224,8 +224,8 @@ texts = col ~ gap 10 . pad 20 $ do
224224 -- el ~ bg Error . bg Warning ~ if True then bold else id $ "Warning"
225225
226226 el ~ pad 10 $ do
227- el ~ descendentOf " htmx-request" flexRow . hide $ " Loading..."
228- el ~ descendentOf " htmx-request" hide . flexRow $ " Normal Content"
227+ el ~ descendentOf " htmx-request" flexRow . display None $ " Loading..."
228+ el ~ descendentOf " htmx-request" (display None ) . flexRow $ " Normal Content"
229229
230230 el ~ italic $ " Italic Text"
231231 el ~ underline $ " Underline Text"
Original file line number Diff line number Diff line change @@ -196,11 +196,6 @@ left :: (Styleable h) => Length -> CSS h -> CSS h
196196left l = utility (" left" -. l) [" left" :. style l]
197197
198198
199- -- | Hide an element. See 'display'
200- hide :: (Styleable h ) => CSS h -> CSS h
201- hide = display None
202-
203-
204199data FlexDirection
205200 = Row
206201 | Column
@@ -270,10 +265,6 @@ visible :: (Styleable h) => CSS h -> CSS h
270265visible = utility " hidden" [" visibility" :. " visible" ]
271266
272267
273- -- what if you set flex-shrink later?
274- -- it has undefined behavior
275- --
276-
277268-- | Set to a specific width
278269width :: (Styleable h ) => Length -> CSS h -> CSS h
279270width n =
Original file line number Diff line number Diff line change @@ -139,15 +139,6 @@ ruleSelectorF rs =
139139 GeneratedRule _ f -> f
140140
141141
142- -- where
143- -- pseudos = mconcat . fmap pseudoSuffix
144-
145- -- rulePseudo :: Rule -> [Pseudo]
146- -- rulePseudo r =
147- -- case r.selector of
148- -- CustomRule _ -> []
149- -- FromClass ps _ -> ps
150-
151142ruleCustomSelector :: Rule -> Maybe Selector
152143ruleCustomSelector r =
153144 case r. selector of
Original file line number Diff line number Diff line change @@ -44,12 +44,6 @@ newtype CSS h = CSS {rules :: [Rule]}
4444 deriving newtype (Monoid , Semigroup )
4545
4646
47- runCSS :: (CSS h -> CSS h ) -> [Rule ]
48- runCSS f =
49- let CSS rs = f mempty
50- in rs
51-
52-
5347mapRules :: (Rule -> Rule ) -> CSS a -> CSS a
5448mapRules f (CSS rs) = CSS $ fmap f rs
5549
@@ -70,5 +64,14 @@ utility cn ds (CSS rs) =
7064 CSS $ rule cn ds : rs
7165
7266
73- test :: (Styleable h ) => Int -> CSS h -> CSS h
74- test n = utility " woot" [" key" :. style n]
67+ -- | Get all the rules for combined utilities
68+ rules :: (CSS [Rule ] -> CSS [Rule ]) -> [Rule ]
69+ rules f =
70+ let CSS rs = f mempty
71+ in rs
72+
73+
74+ -- | Get all the declarations for a utility or combination of them
75+ declarations :: (CSS [Rule ] -> CSS [Rule ]) -> [Declaration ]
76+ declarations f =
77+ mconcat $ fmap (. properties) (rules f)
Original file line number Diff line number Diff line change @@ -16,15 +16,15 @@ mainSpec :: Spec
1616mainSpec = do
1717 describe " PropertyStyle" $ do
1818 it " should compile, and set both the className and styles" $ do
19- let rs = runCSS @ [ Rule ] $ list Decimal
19+ let rs = rules $ list Decimal
2020 length rs `shouldBe` 1
2121 [c] <- pure rs
2222 ruleClassName c `shouldBe` ClassName " list-decimal"
2323 ruleSelector c `shouldBe` " .list-decimal"
2424 c. properties `shouldBe` [" list-style-type" :. " decimal" ]
2525
2626 it " should work with outside member None" $ do
27- let rs = runCSS @ [ Rule ] $ list None
27+ let rs = rules $ list None
2828 length rs `shouldBe` 1
2929 [c] <- pure rs
3030 ruleClassName c `shouldBe` ClassName " list-none"
You can’t perform that action at this time.
0 commit comments