on master help sign in
Stop using JavaScript module

potentially dangerous because the JS.fromString conversions have been taken out

commit549c2aa08fbb5c507848ecdbbe09b36089644267 authorEvan Czaplicki <info@elm-lang.org> dateFri 21 Feb 2014, 18:02 (13 years ago) parent84bada9
1 file changed+10−13
libraries/Graphics/Element.elm+10−13
libraries/Graphics/Element.elm+10−13
@@ -39,8 +39,6 @@ If you need more precision, you can create custom positions.
3939
4040import Basics (..)
4141import Native.Utils
42−import JavaScript as JS
43−import JavaScript (JSString)
4442import List as List
4543import Color (..)
4644import Maybe (Maybe, Just, Nothing)
@@ -51,8 +49,8 @@ type Properties = {
5149 height : Int,
5250 opacity : Float,
5351 color : Maybe Color,
54− href : JSString,
55− tag : JSString,
52+ href : String,
53+ tag : String,
5654 hover : (),
5755 click : ()
5856 }
@@ -120,21 +118,20 @@ with a link like this: `/facts-about-animals.elm#all-about-badgers`
120118-}
121119tag : String -> Element -> Element
122120tag name e = let p = e.props in
123− { element=e.element, props={p | tag <- JS.fromString name} }
121+ { element=e.element, props={p | tag <- name} }
124122
125123{-| Create an `Element` that is a hyper-link. -}
126124link : String -> Element -> Element
127125link href e = let p = e.props in
128− { element=e.element, props={p | href <- JS.fromString href} }
126+ { element=e.element, props={p | href <- href} }
129127
130−emptyStr = JS.fromString ""
131128newElement w h e =
132− { props = Properties (Native.Utils.guid ()) w h 1 Nothing emptyStr emptyStr () ()
129+ { props = Properties (Native.Utils.guid ()) w h 1 Nothing "" "" () ()
133130 , element = e
134131 }
135132
136133data ElementPrim
137− = Image ImageStyle Int Int JSString
134+ = Image ImageStyle Int Int String
138135 | Container Position Element
139136 | Flow Direction [Element]
140137 | Spacer
@@ -145,13 +142,13 @@ data ImageStyle = Plain | Fitted | Cropped (Int,Int) | Tiled
145142
146143{-| Create an image given a width, height, and image source. -}
147144image : Int -> Int -> String -> Element
148−image w h src = newElement w h (Image Plain w h (JS.fromString src))
145+image w h src = newElement w h (Image Plain w h src)
149146
150147{-| Create a fitted image given a width, height, and image source.
151148This will crop the picture to best fill the given dimensions.
152149-}
153150fittedImage : Int -> Int -> String -> Element
154−fittedImage w h src = newElement w h (Image Fitted w h (JS.fromString src))
151+fittedImage w h src = newElement w h (Image Fitted w h src)
155152
156153{-| Create a cropped image. Take a rectangle out of the picture starting
157154at the given top left coordinate. If you have a 140-by-140 image,
@@ -161,11 +158,11 @@ the following will cut a 100-by-100 square out of the middle of it.
161158-}
162159croppedImage : (Int,Int) -> Int -> Int -> String -> Element
163160croppedImage pos w h src =
164− newElement w h (Image (Cropped pos) w h (JS.fromString src))
161+ newElement w h (Image (Cropped pos) w h src)
165162
166163tiledImage : Int -> Int -> String -> Element
167164tiledImage w h src =
168− newElement w h (Image Tiled w h (JS.fromString src))
165+ newElement w h (Image Tiled w h src)
169166
170167data Three = P | Z | N
171168data Pos = Absolute Int | Relative Float