threepenny-gui 0.8.0.0 → 0.8.0.1
raw patch · 4 files changed
+64/−4 lines, 4 filesdep ~basedep ~template-haskelldep ~websocketsnew-component:exe:threepenny-examples-svgPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, template-haskell, websockets
API changes (from Hackage documentation)
- Graphics.UI.Threepenny.Core: fromObjectProperty :: (FromJS a, ToJS a, FFI (JSFunction a)) => String -> Attr Element a
+ Graphics.UI.Threepenny.Core: fromObjectProperty :: (FromJS a, ToJS a) => String -> Attr Element a
Files
- CHANGELOG.md +5/−0
- samples/Svg.hs +44/−0
- src/Graphics/UI/Threepenny/Core.hs +1/−1
- threepenny-gui.cabal +14/−3
CHANGELOG.md view
@@ -1,5 +1,10 @@ ## Changelog for the `threepenny-gui` package +**0.8.0.1** — Maintenance release++* Bump dependencies for compatibility with GHC-8.2.1+* Bump dependencies to allow `websockets` 0.12+ **0.8.0.0** — Snapshot release Graphics.UI.Threepenny
+ samples/Svg.hs view
@@ -0,0 +1,44 @@+import Control.Monad (void)++import qualified Graphics.UI.Threepenny as UI+import Graphics.UI.Threepenny.Core+import qualified Graphics.UI.Threepenny.SVG as SVG++{-----------------------------------------------------------------------------+ SVG+------------------------------------------------------------------------------}+main :: IO ()+main = startGUI defaultConfig setup++setup :: Window -> UI ()+setup w = void $ do+ return w # set title "SVG"++ heading <- UI.h1 # set text "SVG Two Ways"++ getBody w #+ [element heading+ , UI.div #+ [svgElems, UI.h3 # set text "Individual SVG elements in Haskell"]+ , UI.div # set html strCircle #+ [UI.h3 # set text "SVG block as a Haskell string"]+ ]+++svgElems :: UI Element+svgElems = do+ context <- SVG.svg+ # set SVG.width "150"+ # set SVG.height "100"+ elemCircle <- SVG.circle+ # set SVG.cx "100"+ # set SVG.cy "50"+ # set SVG.r "40"+ # set SVG.stroke "green"+ # set SVG.stroke_width "4"+ # set SVG.fill "yellow"+ return context #+ [element elemCircle]+++strCircle :: String+strCircle = "<svg width=\"150\" height=\"100\">"+ ++ " <circle cx=\"100\" cy=\"50\" r=\"40\" stroke=\"gray\" stroke-width=\"4\" fill=\"orange\" />"+ ++ "</svg>"+
src/Graphics/UI/Threepenny/Core.hs view
@@ -346,7 +346,7 @@ get el = fmap from $ callFunction $ ffi "$(%1).prop(%2)" el name -- | Turn a JavaScript object property @.prop = ...@ into an attribute.-fromObjectProperty :: (FromJS a, ToJS a, FFI (JSFunction a)) => String -> Attr Element a+fromObjectProperty :: (FromJS a, ToJS a) => String -> Attr Element a fromObjectProperty name = mkReadWriteAttr get set where set v el = runFunction $ ffi ("%1." ++ name ++ " = %2") el v
threepenny-gui.cabal view
@@ -1,5 +1,5 @@ Name: threepenny-gui-Version: 0.8.0.0+Version: 0.8.0.1 Synopsis: GUI framework that uses the web browser as a display. Description: Threepenny-GUI is a GUI framework that uses the web browser as a display.@@ -120,11 +120,11 @@ ,snap-server >= 0.9.0 && < 1.1 ,snap-core >= 0.9.0 && < 1.1 ,stm >= 2.2 && < 2.5- ,template-haskell >= 2.7.0 && < 2.12+ ,template-haskell >= 2.7.0 && < 2.13 ,text >= 0.11 && < 1.3 ,transformers >= 0.3.0 && < 0.6 ,unordered-containers == 0.2.*- ,websockets >= 0.8 && < 0.12+ ,websockets >= 0.8 && < 0.13 ,websockets-snap >= 0.8 && < 0.11 ,vault == 0.3.* ,vector >= 0.10 && < 0.13@@ -226,5 +226,16 @@ else buildable: False main-is: DrumMachine.hs+ other-modules: Paths_threepenny_gui, Paths+ hs-source-dirs: samples++Executable threepenny-examples-svg+ if flag(buildExamples)+ cpp-options: -DCABAL+ build-depends: base >= 4 && < 5+ ,threepenny-gui+ else+ buildable: False+ main-is: Svg.hs other-modules: Paths_threepenny_gui, Paths hs-source-dirs: samples