Skip to content

Commit 54ba987

Browse files
authored
Merge pull request #15 from cryogenian/halogen-1.0.0
update for halogen#1.0.0
2 parents ba0ddee + 71a887d commit 54ba987

File tree

4 files changed

+16
-43
lines changed

4 files changed

+16
-43
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
],
2424
"dependencies": {
2525
"purescript-css": "^2.0.0",
26-
"purescript-halogen": "^0.12.0"
26+
"purescript-halogen": "1.0.0-rc.2"
2727
}
2828
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"license": "Apache-2.0",
44
"scripts": {
55
"clean": "rm -rf output .pulp-cache",
6-
"build": "pulp build --censor-lib --strict"
6+
"build": "pulp build -- --censor-lib --strict"
77
},
88
"devDependencies": {
9-
"pulp": "^9.0.1",
10-
"purescript": "0.10.1",
11-
"purescript-psa": "^0.3.9"
9+
"pulp": "^10.0.0",
10+
"purescript": "0.10.5",
11+
"purescript-psa": "^0.4.0"
1212
}
1313
}

src/Halogen/HTML/CSS.purs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,15 @@ import Data.Array (mapMaybe, concatMap, singleton)
1515
import Data.Either (Either)
1616
import Data.Foldable (foldMap)
1717
import Data.Maybe (Maybe(..), fromMaybe)
18-
import Data.Newtype (class Newtype)
18+
import Data.MediaType (MediaType(..))
1919
import Data.StrMap as SM
2020
import Data.String (joinWith)
2121
import Data.Tuple (Tuple(..))
2222

2323
import Halogen.HTML as HH
24-
import Halogen.HTML.Core (HTML, Prop, class IsProp, prop, propName, attrName)
2524
import Halogen.HTML.Elements as HE
26-
import Halogen.HTML.Properties as P
27-
28-
-- | A newtype for CSS styles
29-
newtype Styles = Styles (SM.StrMap String)
30-
31-
derive instance newtypeStylesNewtype Styles _
32-
33-
instance stylesIsPropIsProp Styles where
34-
toPropString _ _ (Styles m) =
35-
joinWith "; " $ SM.foldMap (\key value → [key <> ": " <> value]) m
25+
import Halogen.HTML.Properties as HP
26+
import Halogen.HTML.Core as HC
3627

3728
-- | Render a set of rules as an inline style.
3829
-- |
@@ -43,13 +34,16 @@ instance stylesIsProp ∷ IsProp Styles where
4334
-- | display block ]
4435
-- | [ ... ]
4536
-- | ```
46-
style i. CSS Prop i
37+
style i r. CSS HP.IProp (style String|r) i
4738
style =
48-
prop (propName "style") (Just $ attrName "style")
49-
<<< Styles
39+
HP.prop (HC.PropName "style")
40+
<<< toString
5041
<<< rules
5142
<<< runS
5243
where
44+
toString SM.StrMap String String
45+
toString = joinWith "; " <<< SM.foldMap (\key val [ key <> ": " <> val])
46+
5347
rules Array Rule SM.StrMap String
5448
rules rs = SM.fromFoldable properties
5549
where
@@ -64,8 +58,8 @@ style =
6458
rights = concatMap $ foldMap singleton
6559

6660
-- | Render a set of rules as a `style` element.
67-
stylesheet p i. CSS HTML p i
61+
stylesheet p i. CSS HC.HTML p i
6862
stylesheet css =
69-
HE.style [ P.type_ "text/css" ] [ HH.text content ]
63+
HE.style [ HP.type_ $ MediaType "text/css" ] [ HH.text content ]
7064
where
7165
content = fromMaybe "" $ renderedSheet $ render css

src/Halogen/HTML/CSS/Indexed.purs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)