reflex-dom 0.4 → 0.5
raw patch · 5 files changed
+44/−21 lines, 5 filesdep ~reflexdep ~reflex-dom-corenew-uploader
Dependency ranges changed: reflex, reflex-dom-core
Files
- ChangeLog.md +6/−0
- benchmarks/krausest.hs +7/−7
- reflex-dom.cabal +11/−9
- src/Reflex/Dom.hs +2/−1
- src/Reflex/Dom/Internal.hs +18/−4
+ ChangeLog.md view
@@ -0,0 +1,6 @@+# Revision history for reflex-dom++## 0.5++* Re-export new hydration widget "mainWidget" functions.+* The use-warp flag now properly takes precedence on macOS.
benchmarks/krausest.hs view
@@ -28,15 +28,15 @@ seed <- randomIO mainWidgetWithHead' (\_ -> headW, \_ -> bodyW seed) -titleW :: MonadWidget t m => m ()+titleW :: DomBuilder t m => m () titleW = text "Reflex-dom keyed" -headW :: MonadWidget t m => m ()+headW :: DomBuilder t m => m () headW = do el "title" titleW elAttr "link" ("href" =: "/css/currentStyle.css" <> "rel" =: "stylesheet") blank -bodyW :: forall t m. MonadWidget t m => Entropy -> m ()+bodyW :: forall t m. (MonadFix m, MonadHold t m, DomBuilder t m) => Entropy -> m () bodyW seed = divClass "main" $ divClass "container" $ mdo buttonEvents <- divClass "jumbotron" $ divClass "row" $ do divClass "col-md-6" $ el "h1" titleW@@ -75,14 +75,14 @@ (m', dt) = f (m, t) t' = applyAlways dt t -buttonW :: MonadWidget t m => Text -> Text -> a -> m (Event t a)+buttonW :: DomBuilder t m => Text -> Text -> a -> m (Event t a) buttonW id txt val = divClass "col-sm-6 smallpad" $ buttonW' ("class" =: "btn btn-primary btn-block" <> "id" =: id) where buttonW' attrs = do (b, _) <- elAttr' "button" attrs $ text txt pure $ val <$ domEvent Click b -tableW :: MonadWidget t m => Event t TableDiff -> m (Event t (IntMap Step))+tableW :: (MonadHold t m, DomBuilder t m) => Event t TableDiff -> m (Event t (IntMap Step)) tableW diff = do elClass "table" "table table-hover table-striped test-data" $ do el "tbody" $ do@@ -90,7 +90,7 @@ rowEvents <- holdIncremental v0 v' return $ mergeIntIncremental rowEvents -rowW :: MonadWidget t m => Row -> m (Event t Step)+rowW :: DomBuilder t m => Row -> m (Event t Step) rowW row = elClass "tr" (if selected row then "danger" else "") $ do elClass "td" "col-md-1" $ do@@ -102,7 +102,7 @@ where tagClick f el = f row <$ (domEvent Click el) -deleteW :: MonadWidget t m => m ()+deleteW :: DomBuilder t m => m () deleteW = el "a" $ elAttr "span" ("aria-hidden" =: "true" <> "class" =: "glyphicon glyphicon-remove") blank
reflex-dom.cabal view
@@ -1,5 +1,5 @@ Name: reflex-dom-Version: 0.4+Version: 0.5 Synopsis: Functional Reactive Web Apps with Reflex Description: Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine.@@ -13,7 +13,9 @@ Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface Build-type: Simple cabal-version: >=1.24-extra-source-files: java/org/reflexfrp/reflexdom/MainWidget.java+extra-source-files:+ java/org/reflexfrp/reflexdom/MainWidget.java+ ChangeLog.md flag use-warp description: Use jsaddle-warp server@@ -62,20 +64,20 @@ build-depends: base >= 4.7 && < 4.12, bytestring == 0.10.*,- reflex == 0.5.*,- reflex-dom-core >=0.4 && <0.5,+ reflex == 0.6.*,+ reflex-dom-core >=0.5 && <0.6, text == 1.2.* if !impl(ghcjs)- if os(osx) || os(ios)+ if flag(use-warp) && (os(linux) || os(osx)) build-depends:- data-default == 0.7.*, jsaddle,- jsaddle-wkwebview+ jsaddle-warp else- if flag(use-warp)+ if os(osx) || os(ios) build-depends:+ data-default == 0.7.*, jsaddle,- jsaddle-warp+ jsaddle-wkwebview else if flag(webkit2gtk) build-depends:
src/Reflex/Dom.hs view
@@ -6,5 +6,6 @@ import Foreign.JavaScript.Orphans () import Reflex.Dom.Core as X hiding (mainWidget, mainWidgetInElementById, mainWidgetWithCss,- mainWidgetWithHead, mainWidgetWithHead', runApp')+ mainWidgetWithHead, mainWidgetWithHead', runApp',+ mainHydrationWidgetWithHead, mainHydrationWidgetWithHead') import Reflex.Dom.Internal as X
src/Reflex/Dom/Internal.hs view
@@ -4,18 +4,24 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} module Reflex.Dom.Internal- (module Main, run, mainWidget, mainWidgetWithHead, mainWidgetWithCss,- mainWidgetWithHead', mainWidgetInElementById, runApp') where+ ( module Main+ , run+ , mainWidget+ , mainWidgetWithHead, mainWidgetWithCss, mainWidgetWithHead', mainWidgetInElementById, runApp'+ , mainHydrationWidgetWithHead, mainHydrationWidgetWithHead'+ ) where import Data.ByteString (ByteString) import Data.Text (Text) import Reflex.Dom.Core (Widget) import Reflex.Dom.Main as Main hiding (mainWidget, mainWidgetWithHead, mainWidgetWithCss,- mainWidgetWithHead', mainWidgetInElementById, runApp')+ mainWidgetWithHead', mainWidgetInElementById, runApp',+ mainHydrationWidgetWithHead, mainHydrationWidgetWithHead') import qualified Reflex.Dom.Main as Main (mainWidget, mainWidgetWithHead, mainWidgetWithCss,- mainWidgetWithHead', mainWidgetInElementById, runApp')+ mainWidgetWithHead', mainWidgetInElementById, runApp',+ mainHydrationWidgetWithHead, mainHydrationWidgetWithHead') #if defined(ghcjs_HOST_OS) run :: a -> a@@ -101,3 +107,11 @@ runApp' :: (forall x. AppInput DomTimeline -> Widget x (AppOutput DomTimeline)) -> IO () runApp' app = run $ Main.runApp' app {-# INLINE runApp' #-}++mainHydrationWidgetWithHead :: (forall x. HydrationWidget x ()) -> (forall x. HydrationWidget x ()) -> IO ()+mainHydrationWidgetWithHead h b = run $ Main.mainHydrationWidgetWithHead h b+{-# INLINE mainHydrationWidgetWithHead #-}++mainHydrationWidgetWithHead' :: HydrationWidget () () -> HydrationWidget () () -> IO ()+mainHydrationWidgetWithHead' h b = run $ Main.mainHydrationWidgetWithHead' h b+{-# INLINE mainHydrationWidgetWithHead' #-}