on develop help sign in
Merge branch 'develop' into prerender-lift-constraints
commit53ad86bb77c0d7532d65b9de8c6d047e3723053a authorKen Micklas <kmicklas@gmail.com> dateFri 26 Apr 2019, 11:23 (7 years ago) parentd005db4fed9a7c
17 files changed+182−90
CONTRIBUTING.md+60 README.md+1−1 chrome-test-utils/src/Test/Util/ChromeFlags.hs+1 reflex-dom-core/ChangeLog.md+7 reflex-dom-core/default.nix+1−1 reflex-dom-core/reflex-dom-core.cabal+4−3 reflex-dom-core/src/Foreign/JavaScript/Orphans.hs+2 reflex-dom-core/src/Reflex/Dom/Builder/Class.hs+2−2 reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs+63−65 reflex-dom-core/src/Reflex/Dom/Builder/Static.hs+1 reflex-dom-core/src/Reflex/Dom/Main.hs+3 reflex-dom-core/src/Reflex/Dom/Prerender.hs+2−1 reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs+1−1 reflex-dom-core/test/hydration.hs+9−4 reflex-dom/ChangeLog.md+10 reflex-dom/default.nix+4−3 reflex-dom/reflex-dom.cabal+11−9
CONTRIBUTING.mdnew file+60
@@ -0,0 +1,60 @@
1+# Contribution Guide
2+
3+Contributions and issue reports are encouraged and appreciated!
4+
5+- [Opening Issues](#opening-issues)
6+- [Submitting Changes](#submitting-changes)
7+ - [Guidelines for Commit Messages](#guidelines-for-commit-messages)
8+ - [Code Quality](#code-quality)
9+ - [Documentation](#documentation)
10+
11+## Opening Issues
12+
13+Before opening an issue, please check whether your issue has already been reported. Assuming it has not:
14+
15+* Describe the issue you're encountering or the suggestion you're making
16+* Include any relevant steps to reproduce or code samples you can. It's always easier for us to debug if we have something that demonstrates the error.
17+* Let us know what version of this project you were using. If you're using a github checkout, provide the git hash.
18+* Describe how you're building this project (i.e., via reflex-platform, cabal install, stack, obelisk, etc.). If you're using reflex-platform or obelisk, provide the git hash of your checkout.
19+
20+## Submitting Changes
21+
22+### Guidelines for Commit Messages
23+
24+#### Summary Line
25+The summary line of your commit message should summarize the changes being made. Commit messages should be written in the imperative mood and should describe what happens when the commit is applied.
26+
27+One way to think about it is that your commit message should be able to complete the sentence:
28+"When applied, this commit will..."
29+
30+#### Body
31+For breaking changes, new features, refactors, or other major changes, the body of the commit message should describe the motivation behind the change in greater detail and may include references to the issue tracker. The body shouldn't repeat code/comments from the diff.
32+
33+### Code Quality
34+
35+#### Warnings
36+
37+Your pull request should add no new warnings to the project. It should also generally not disable any warnings.
38+
39+#### Build and Test
40+
41+Make sure the project builds and that the tests pass! This will generally also be checked by CI before merge, but trying it yourself first means you'll catch problems earlier and your contribution can be merged that much sooner!
42+
43+### Documentation
44+
45+#### In the code
46+We're always striving to improve documentation. Please include [haddock](https://haskell-haddock.readthedocs.io/en/latest/index.html) documentation for any added code, and update the documentation for any code you modify.
47+
48+#### In the Changelog
49+Add an entry to the changelog when your PR:
50+* Adds a feature
51+* Deprecates something
52+* Includes a breaking change
53+* Makes any other change that will impact users
54+
55+You may need to add changelog entries to one or both of the changelogs in this repository:
56+* [reflex-dom-core's changelog](reflex-dom-core/ChangeLog.md)
57+* [reflex-dom's changelog](reflex-dom/ChangeLog.md)
58+
59+#### In the [Readme](README.md)
60+The readme is the first place a lot of people look for information about the repository. Update any parts of the readme that are affected by your PR.
README.md+1−1
@@ -18,5 +18,5 @@ A summary of Reflex-DOM functions is available in the [quick reference](Quickref
1818
1919### Hacking
2020
21−Use the `./scripts/hack-on dep/reflex-dom` script in [Reflex Platform](https://github.com/reflex-frp/reflex-platform) to checkout the source code of `reflex-dom` locally in `./dep/reflex-dom` directory.
21+Use the `./scripts/hack-on haskell-overlays/reflex-packages/dep/reflex-dom` script in [Reflex Platform](https://github.com/reflex-frp/reflex-platform) to checkout the source code of `reflex-dom` locally in `./dep/reflex-dom` directory.
2222Then do modifications to the source in place, and use the `./try-reflex` or `./scripts/work-on` scripts to create the shell to test your changes.
chrome-test-utils/src/Test/Util/ChromeFlags.hs+1
@@ -1,6 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22module Test.Util.ChromeFlags where
33
4+import Data.Semigroup
45import Data.Text
56import System.IO.Temp
67
reflex-dom-core/ChangeLog.mdnew file+7
@@ -0,0 +1,7 @@
1+# Revision history for reflex-dom-core
2+
3+## 0.5
4+
5+* Add HydrationDomBuilderT to support hydration of statically rendered DOM nodes. See the note at the top of Reflex.Dom.Builder.Immediate.
6+* As a result of the hydration changes, the Prerender class has changed, the type of `prerender` has changed and it is now a class method.
7+* Add the Reflex.Dom.Xhr.FormData module to make posting formdata over xhr more convenient.
reflex-dom-core/default.nix+1−1
@@ -25,7 +25,7 @@ let addGcTestDepends = drv: if (stdenv.system != "x86_64-linux" || stdenv.hostPl
2525 };
2626in mkDerivation (addGcTestDepends {
2727 pname = "reflex-dom-core";
28− version = "0.4";
28+ version = "0.5";
2929 src = ./.;
3030 libraryHaskellDepends = [
3131 aeson base bifunctors bimap blaze-builder bytestring constraints
reflex-dom-core/reflex-dom-core.cabal+4−3
@@ -1,5 +1,5 @@
11Name: reflex-dom-core
2−Version: 0.4
2+Version: 0.5
33Synopsis: Functional Reactive Web Apps with Reflex
44Description: Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine
55License: BSD3
@@ -17,6 +17,7 @@ extra-source-files: src-ghc/Foreign/JavaScript/Internal/Utils.hs
1717 src/Reflex/Dom/WebSocket/Foreign.hs
1818 src/Reflex/Dom/Xhr/ResponseType.hs
1919 src/Reflex/Dom/Xhr/Exception.hs
20+ ChangeLog.md
2021
2122flag use-template-haskell
2223 description: Use template haskell to generate lenses
@@ -66,7 +67,7 @@ library
6667 primitive >= 0.5 && < 0.7,
6768 random,
6869 ref-tf == 0.4.*,
69− reflex == 0.5.*,
70+ reflex == 0.6.*,
7071 semigroups >= 0.16 && < 0.19,
7172 stm == 2.4.*,
7273 text == 1.2.*,
@@ -191,7 +192,7 @@ test-suite hydration
191192 ghc-prof-options: -fprof-auto -optP-DPROFILING
192193 main-is: hydration.hs
193194 type: exitcode-stdio-1.0
194− if !os(linux) || !arch(x86_64)
195+ if !os(linux) || !arch(x86_64) || flag(profile-reflex)
195196 buildable: False
196197
197198-- broken test on base 4.11 & ghc 8.4.3
reflex-dom-core/src/Foreign/JavaScript/Orphans.hs+2
@@ -1,6 +1,8 @@
11{-# OPTIONS_HADDOCK hide #-}
22{-# LANGUAGE CPP #-}
33{-# LANGUAGE FlexibleContexts #-}
4+{-# LANGUAGE UndecidableInstances #-}
5+
46{-# OPTIONS_GHC -fno-warn-orphans #-}
57module Foreign.JavaScript.Orphans where
68
reflex-dom-core/src/Reflex/Dom/Builder/Class.hs+2−2
@@ -192,7 +192,7 @@ data CommentNodeConfig t
192192 }
193193
194194#ifndef USE_TEMPLATE_HASKELL
195−commentNodeConfig_initialContents :: Lens' (CommentNodeConfig t) Comment
195+commentNodeConfig_initialContents :: Lens' (CommentNodeConfig t) Text
196196commentNodeConfig_initialContents f (CommentNodeConfig a b) = (\a' -> CommentNodeConfig a' b) <$> f a
197197{-# INLINE commentNodeConfig_initialContents #-}
198198#endif
@@ -618,7 +618,7 @@ instance (DomBuilder t m, MonadHold t m, MonadFix m, Semigroup w) => DomBuilder
618618 placeRawElement = lift . placeRawElement
619619 wrapRawElement e = lift . wrapRawElement e
620620
621−instance (DomBuilder t m, MonadFix m, MonadHold t m, Group q, Query q, Additive q) => DomBuilder t (QueryT t q m) where
621+instance (DomBuilder t m, MonadFix m, MonadHold t m, Group q, Query q, Additive q, Eq q) => DomBuilder t (QueryT t q m) where
622622 type DomBuilderSpace (QueryT t q m) = DomBuilderSpace m
623623 textNode = liftTextNode
624624 commentNode = liftCommentNode
reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs+63−65
@@ -86,9 +86,6 @@ module Reflex.Dom.Builder.Immediate
8686 , ghcjsEventSpec_filters
8787 , ghcjsEventSpec_handler
8888 , GhcjsEventHandler (..)
89−#ifndef USE_TEMPLATE_HASKELL
90− , phantom2
91−#endif
9289 , drawChildUpdate
9390 , ChildReadyState (..)
9491 , mkHasFocus
@@ -138,6 +135,7 @@ import Data.Functor.Product
138135import Data.IORef
139136import Data.IntMap.Strict (IntMap)
140137import Data.Maybe
138+import Data.Monoid ((<>))
141139import Data.Some (Some(..))
142140import Data.Text (Text)
143141import Foreign.JavaScript.Internal.Utils
@@ -162,6 +160,9 @@ import Reflex.PerformEvent.Base (PerformEventT)
162160import Reflex.PerformEvent.Class
163161import Reflex.PostBuild.Base (PostBuildT)
164162import Reflex.PostBuild.Class
163+#ifdef PROFILE_REFLEX
164+import Reflex.Profiled
165+#endif
165166import Reflex.Requester.Base
166167import Reflex.Requester.Class
167168import Reflex.Spider (Spider, SpiderHost, Global)
@@ -198,6 +199,7 @@ import qualified Reflex.TriggerEvent.Base as TriggerEventT (askEvents)
198199
199200#ifndef USE_TEMPLATE_HASKELL
200201import Data.Functor.Contravariant (phantom)
202+import Control.Lens (Lens', Getter)
201203#endif
202204
203205#ifndef ghcjs_HOST_OS
@@ -527,17 +529,17 @@ wrap events e cfg = do
527529 return eventTriggerRefs
528530
529531{-# SPECIALIZE wrap
530− :: Chan [DSum (EventTriggerRef Spider) TriggerInvocation]
532+ :: Chan [DSum (EventTriggerRef DomTimeline) TriggerInvocation]
531533 -> DOM.Element
532− -> RawElementConfig er Spider HydrationDomSpace
533− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM (DMap EventName (EventFilterTriggerRef Spider er))
534+ -> RawElementConfig er DomTimeline HydrationDomSpace
535+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM (DMap EventName (EventFilterTriggerRef DomTimeline er))
534536 #-}
535537
536538{-# SPECIALIZE wrap
537− :: Chan [DSum (EventTriggerRef Spider) TriggerInvocation]
539+ :: Chan [DSum (EventTriggerRef DomTimeline) TriggerInvocation]
538540 -> DOM.Element
539− -> RawElementConfig er Spider GhcjsDomSpace
540− -> HydrationDomBuilderT GhcjsDomSpace Spider HydrationM (DMap EventName (EventFilterTriggerRef Spider er))
541+ -> RawElementConfig er DomTimeline GhcjsDomSpace
542+ -> HydrationDomBuilderT GhcjsDomSpace DomTimeline HydrationM (DMap EventName (EventFilterTriggerRef DomTimeline er))
541543 #-}
542544
543545{-# INLINE triggerBody #-}
@@ -573,23 +575,23 @@ triggerBody ctx cfg events eventTriggerRefs e (WrapArg en) t = case DMap.lookup
573575
574576{-# SPECIALIZE triggerBody
575577 :: DOM.JSContextRef
576− -> RawElementConfig er Spider HydrationDomSpace
577− -> Chan [DSum (EventTriggerRef Spider) TriggerInvocation]
578− -> DMap EventName (EventFilterTriggerRef Spider er)
578+ -> RawElementConfig er DomTimeline HydrationDomSpace
579+ -> Chan [DSum (EventTriggerRef DomTimeline) TriggerInvocation]
580+ -> DMap EventName (EventFilterTriggerRef DomTimeline er)
579581 -> DOM.Element
580582 -> WrapArg er EventName x
581− -> EventTrigger Spider x
583+ -> EventTrigger DomTimeline x
582584 -> IO (IO ())
583585 #-}
584586
585587{-# SPECIALIZE triggerBody
586588 :: DOM.JSContextRef
587− -> RawElementConfig er Spider GhcjsDomSpace
588− -> Chan [DSum (EventTriggerRef Spider) TriggerInvocation]
589− -> DMap EventName (EventFilterTriggerRef Spider er)
589+ -> RawElementConfig er DomTimeline GhcjsDomSpace
590+ -> Chan [DSum (EventTriggerRef DomTimeline) TriggerInvocation]
591+ -> DMap EventName (EventFilterTriggerRef DomTimeline er)
590592 -> DOM.Element
591593 -> WrapArg er EventName x
592− -> EventTrigger Spider x
594+ -> EventTrigger DomTimeline x
593595 -> IO (IO ())
594596 #-}
595597
@@ -638,15 +640,11 @@ data GhcjsEventSpec er = GhcjsEventSpec
638640newtype GhcjsEventHandler er = GhcjsEventHandler { unGhcjsEventHandler :: forall en. (EventName en, GhcjsDomEvent en) -> JSM (Maybe (er en)) }
639641
640642#ifndef USE_TEMPLATE_HASKELL
641−phantom2 :: (Functor f, Contravariant f) => f a -> f b
642−phantom2 = phantom
643−{-# INLINE phantom2 #-}
644−
645643ghcjsEventSpec_filters :: forall er . Lens' (GhcjsEventSpec er) (DMap EventName (GhcjsEventFilter er))
646644ghcjsEventSpec_filters f (GhcjsEventSpec a b) = (\a' -> GhcjsEventSpec a' b) <$> f a
647645{-# INLINE ghcjsEventSpec_filters #-}
648646ghcjsEventSpec_handler :: forall er en . Getter (GhcjsEventSpec er) ((EventName en, GhcjsDomEvent en) -> JSM (Maybe (er en)))
649−ghcjsEventSpec_handler f (GhcjsEventSpec _ (GhcjsEventHandler b)) = phantom2 (f b)
647+ghcjsEventSpec_handler f (GhcjsEventSpec _ (GhcjsEventHandler b)) = phantom (f b)
650648{-# INLINE ghcjsEventSpec_handler #-}
651649#endif
652650
@@ -694,16 +692,16 @@ elementImmediate elementTag cfg child = do
694692
695693{-# SPECIALIZE elementImmediate
696694 :: Text
697− -> ElementConfig er Spider HydrationDomSpace
698− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM a
699− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM (Element er GhcjsDomSpace Spider, a)
695+ -> ElementConfig er DomTimeline HydrationDomSpace
696+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM a
697+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM (Element er GhcjsDomSpace DomTimeline, a)
700698 #-}
701699
702700{-# SPECIALIZE elementImmediate
703701 :: Text
704− -> ElementConfig er Spider GhcjsDomSpace
705− -> HydrationDomBuilderT GhcjsDomSpace Spider HydrationM a
706− -> HydrationDomBuilderT GhcjsDomSpace Spider HydrationM (Element er GhcjsDomSpace Spider, a)
702+ -> ElementConfig er DomTimeline GhcjsDomSpace
703+ -> HydrationDomBuilderT GhcjsDomSpace DomTimeline HydrationM a
704+ -> HydrationDomBuilderT GhcjsDomSpace DomTimeline HydrationM (Element er GhcjsDomSpace DomTimeline, a)
707705 #-}
708706
709707-- For specialisation
@@ -740,9 +738,9 @@ elementInternal elementTag cfg child = getHydrationMode >>= \case
740738
741739{-# SPECIALIZE elementInternal
742740 :: Text
743− -> ElementConfig er Spider HydrationDomSpace
744− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM a
745− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM (Element er HydrationDomSpace Spider, a)
741+ -> ElementConfig er DomTimeline HydrationDomSpace
742+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM a
743+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM (Element er HydrationDomSpace DomTimeline, a)
746744 #-}
747745
748746{-# INLINE hydrateElement #-}
@@ -830,9 +828,9 @@ hydrateElement elementTag cfg child = do
830828
831829{-# SPECIALIZE hydrateElement
832830 :: Text
833− -> ElementConfig er Spider HydrationDomSpace
834− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM a
835− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM ((Element er HydrationDomSpace Spider, a), IORef DOM.Element)
831+ -> ElementConfig er DomTimeline HydrationDomSpace
832+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM a
833+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM ((Element er HydrationDomSpace DomTimeline, a), IORef DOM.Element)
836834 #-}
837835
838836{-# INLINE inputElementImmediate #-}
@@ -1699,17 +1697,17 @@ traverseIntMapWithKeyWithAdjust' = do
16991697 liftIO $ writeIORef placeholders $! fromMaybe phs $ apply filtered phs
17001698
17011699{-# SPECIALIZE traverseIntMapWithKeyWithAdjust'
1702− :: (IntMap.Key -> v -> HydrationDomBuilderT GhcjsDomSpace Spider HydrationM v')
1700+ :: (IntMap.Key -> v -> HydrationDomBuilderT GhcjsDomSpace DomTimeline HydrationM v')
17031701 -> IntMap v
1704− -> Event Spider (PatchIntMap v)
1705− -> HydrationDomBuilderT GhcjsDomSpace Spider HydrationM (IntMap v', Event Spider (PatchIntMap v'))
1702+ -> Event DomTimeline (PatchIntMap v)
1703+ -> HydrationDomBuilderT GhcjsDomSpace DomTimeline HydrationM (IntMap v', Event DomTimeline (PatchIntMap v'))
17061704 #-}
17071705
17081706{-# SPECIALIZE traverseIntMapWithKeyWithAdjust'
1709− :: (IntMap.Key -> v -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM v')
1707+ :: (IntMap.Key -> v -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM v')
17101708 -> IntMap v
1711− -> Event Spider (PatchIntMap v)
1712− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM (IntMap v', Event Spider (PatchIntMap v'))
1709+ -> Event DomTimeline (PatchIntMap v)
1710+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM (IntMap v', Event DomTimeline (PatchIntMap v'))
17131711 #-}
17141712
17151713data ChildReadyState a
@@ -1944,39 +1942,39 @@ hoistTraverseIntMapWithKeyWithAdjust base updateChildUnreadiness applyDomUpdate_
19441942 return (result0, result')
19451943
19461944{-# SPECIALIZE hoistTraverseIntMapWithKeyWithAdjust
1947− :: ((IntMap.Key -> v -> DomRenderHookT Spider HydrationM (TraverseChild Spider HydrationM Int v'))
1945+ :: ((IntMap.Key -> v -> DomRenderHookT DomTimeline HydrationM (TraverseChild DomTimeline HydrationM Int v'))
19481946 -> IntMap v
1949− -> Event Spider (PatchIntMap v)
1950− -> DomRenderHookT Spider HydrationM (IntMap (TraverseChild Spider HydrationM Int v'), Event Spider (PatchIntMap (TraverseChild Spider HydrationM Int v'))))
1951− -> (PatchIntMap (TraverseChild Spider HydrationM Int v')
1947+ -> Event DomTimeline (PatchIntMap v)
1948+ -> DomRenderHookT DomTimeline HydrationM (IntMap (TraverseChild DomTimeline HydrationM Int v'), Event DomTimeline (PatchIntMap (TraverseChild DomTimeline HydrationM Int v'))))
1949+ -> (PatchIntMap (TraverseChild DomTimeline HydrationM Int v')
19521950 -> IntMap (IORef (ChildReadyState Int))
19531951 -> IO (IntMap (IORef (ChildReadyState Int))))
19541952 -> (IORef (IntMap DOM.Text)
19551953 -> DOM.Text
1956− -> PatchIntMap (TraverseChild Spider HydrationM Int v')
1954+ -> PatchIntMap (TraverseChild DomTimeline HydrationM Int v')
19571955 -> JSM ())
1958− -> (IntMap.Key -> v -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM v')
1956+ -> (IntMap.Key -> v -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM v')
19591957 -> IntMap v
1960− -> Event Spider (PatchIntMap v)
1961− -> HydrationDomBuilderT HydrationDomSpace Spider HydrationM (IntMap v', Event Spider (PatchIntMap v'))
1958+ -> Event DomTimeline (PatchIntMap v)
1959+ -> HydrationDomBuilderT HydrationDomSpace DomTimeline HydrationM (IntMap v', Event DomTimeline (PatchIntMap v'))
19621960 #-}
19631961
19641962{-# SPECIALIZE hoistTraverseIntMapWithKeyWithAdjust
1965− :: ((IntMap.Key -> v -> DomRenderHookT Spider HydrationM (TraverseChild Spider HydrationM Int v'))
1963+ :: ((IntMap.Key -> v -> DomRenderHookT DomTimeline HydrationM (TraverseChild DomTimeline HydrationM Int v'))
19661964 -> IntMap v
1967− -> Event Spider (PatchIntMap v)
1968− -> DomRenderHookT Spider HydrationM (IntMap (TraverseChild Spider HydrationM Int v'), Event Spider (PatchIntMap (TraverseChild Spider HydrationM Int v'))))
1969− -> (PatchIntMap (TraverseChild Spider HydrationM Int v')
1965+ -> Event DomTimeline (PatchIntMap v)
1966+ -> DomRenderHookT DomTimeline HydrationM (IntMap (TraverseChild DomTimeline HydrationM Int v'), Event DomTimeline (PatchIntMap (TraverseChild DomTimeline HydrationM Int v'))))
1967+ -> (PatchIntMap (TraverseChild DomTimeline HydrationM Int v')
19701968 -> IntMap (IORef (ChildReadyState Int))
19711969 -> IO (IntMap (IORef (ChildReadyState Int))))
19721970 -> (IORef (IntMap DOM.Text)
19731971 -> DOM.Text
1974− -> PatchIntMap (TraverseChild Spider HydrationM Int v')
1972+ -> PatchIntMap (TraverseChild DomTimeline HydrationM Int v')
19751973 -> JSM ())
1976− -> (IntMap.Key -> v -> HydrationDomBuilderT GhcjsDomSpace Spider HydrationM v')
1974+ -> (IntMap.Key -> v -> HydrationDomBuilderT GhcjsDomSpace DomTimeline HydrationM v')
19771975 -> IntMap v
1978− -> Event Spider (PatchIntMap v)
1979− -> HydrationDomBuilderT GhcjsDomSpace Spider HydrationM (IntMap v', Event Spider (PatchIntMap v'))
1976+ -> Event DomTimeline (PatchIntMap v)
1977+ -> HydrationDomBuilderT GhcjsDomSpace DomTimeline HydrationM (IntMap v', Event DomTimeline (PatchIntMap v'))
19801978 #-}
19811979
19821980data TraverseChildImmediate k = TraverseChildImmediate
@@ -2046,17 +2044,17 @@ drawChildUpdate initialEnv markReady child = do
20462044 }
20472045
20482046{-# SPECIALIZE drawChildUpdate
2049− :: HydrationDomBuilderEnv Spider HydrationM
2047+ :: HydrationDomBuilderEnv DomTimeline HydrationM
20502048 -> (IORef (ChildReadyState Int) -> JSM ())
2051− -> HydrationDomBuilderT s Spider HydrationM (Identity a)
2052− -> DomRenderHookT Spider HydrationM (Compose (TraverseChild Spider HydrationM Int) Identity a)
2049+ -> HydrationDomBuilderT s DomTimeline HydrationM (Identity a)
2050+ -> DomRenderHookT DomTimeline HydrationM (Compose (TraverseChild DomTimeline HydrationM Int) Identity a)
20532051 #-}
20542052
20552053{-# SPECIALIZE drawChildUpdate
2056− :: HydrationDomBuilderEnv Spider HydrationM
2054+ :: HydrationDomBuilderEnv DomTimeline HydrationM
20572055 -> (IORef (ChildReadyState (Some k)) -> JSM ())
2058− -> HydrationDomBuilderT s Spider HydrationM (f a)
2059− -> DomRenderHookT Spider HydrationM (Compose (TraverseChild Spider HydrationM (Some k)) f a)
2056+ -> HydrationDomBuilderT s DomTimeline HydrationM (f a)
2057+ -> DomRenderHookT DomTimeline HydrationM (Compose (TraverseChild DomTimeline HydrationM (Some k)) f a)
20602058 #-}
20612059
20622060{-# INLINABLE drawChildUpdateInt #-}
@@ -2068,10 +2066,10 @@ drawChildUpdateInt :: (MonadIO m, MonadJSM m, Reflex t)
20682066drawChildUpdateInt env mark m = fmap runIdentity . getCompose <$> drawChildUpdate env mark (Identity <$> m)
20692067
20702068{-# SPECIALIZE drawChildUpdateInt
2071− :: HydrationDomBuilderEnv Spider HydrationM
2069+ :: HydrationDomBuilderEnv DomTimeline HydrationM
20722070 -> (IORef (ChildReadyState k) -> JSM ())
2073− -> HydrationDomBuilderT s Spider HydrationM v
2074− -> DomRenderHookT Spider HydrationM (TraverseChild Spider HydrationM k v)
2071+ -> HydrationDomBuilderT s DomTimeline HydrationM v
2072+ -> DomRenderHookT DomTimeline HydrationM (TraverseChild DomTimeline HydrationM k v)
20752073 #-}
20762074
20772075{-# INLINE mkHasFocus #-}
reflex-dom-core/src/Reflex/Dom/Builder/Static.hs+1
@@ -37,6 +37,7 @@ import Data.IntMap (IntMap)
3737import qualified Data.IntMap as IntMap
3838import qualified Data.Map as Map
3939import Data.Map.Misc (applyMap)
40+import Data.Monoid ((<>))
4041import qualified Data.Set as Set
4142import Data.Text (Text)
4243import qualified Data.Text as T
reflex-dom-core/src/Reflex/Dom/Main.hs+3
@@ -27,6 +27,9 @@ import Reflex.PostBuild.Base
2727import Reflex.Spider (Global, Spider, SpiderHost, runSpiderHost)
2828import Reflex.TriggerEvent.Base
2929import Reflex.TriggerEvent.Class
30+#ifdef PROFILE_REFLEX
31+import Reflex.Profiled
32+#endif
3033
3134import Control.Concurrent
3235import Control.Lens
reflex-dom-core/src/Reflex/Dom/Prerender.hs+2−1
@@ -27,6 +27,7 @@ import Control.Monad.Primitive (PrimMonad)
2727import Control.Monad.Reader
2828import Control.Monad.Ref (MonadRef(..))
2929import Data.IORef (IORef, newIORef)
30+import Data.Semigroup (Semigroup)
3031import Data.Text (Text)
3132import Data.Void
3233import Foreign.JavaScript.TH
@@ -244,7 +245,7 @@ instance (Prerender js t m, MonadFix m, Reflex t) => Prerender js t (RequesterT
244245 responses <- fmap (fmapCheap unMultiEntry) $ requesting' $ fmapCheap multiEntry $ switch $ current requestsDyn
245246 pure result
246247
247−instance (Prerender js t m, Monad m, Reflex t, MonadFix m, Group q, Additive q, Query q) => Prerender js t (QueryT t q m) where
248+instance (Prerender js t m, Monad m, Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q) => Prerender js t (QueryT t q m) where
248249 type Client (QueryT t q m) = QueryT t q (Client m)
249250 prerender server client = mdo
250251 result <- queryDyn query
reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs+1−1
@@ -108,7 +108,7 @@ virtualList heightPx rowPx maxIndex i0 setI keyToIndex items0 itemsUpdate itemBu
108108 uniqWindow <- holdUniqDyn window
109109 return (uniqWindow, result)
110110 where
111− toStyleAttr m = "style" =: Map.foldWithKey (\k v s -> k <> ":" <> v <> ";" <> s) "" m
111+ toStyleAttr m = "style" =: Map.foldrWithKey (\k v s -> k <> ":" <> v <> ";" <> s) "" m
112112 mkViewport h = toStyleAttr $ "overflow" =: "auto" <> "position" =: "absolute" <>
113113 "left" =: "0" <> "right" =: "0" <> "height" =: (T.pack (show h) <> "px")
114114 mkContainer h = toStyleAttr $ "position" =: "relative" <> "height" =: (T.pack (show h) <> "px")
reflex-dom-core/test/hydration.hs+9−4
@@ -35,6 +35,7 @@ import Data.GADT.Compare.TH
3535import Data.GADT.Show.TH
3636import Data.IORef (IORef)
3737import Data.Maybe
38+import Data.Monoid
3839import Data.Proxy
3940import Data.Text (Text)
4041import Language.Javascript.JSaddle (syncPoint, liftJSM)
@@ -54,9 +55,9 @@ import System.Process
5455import qualified Test.HUnit as HUnit (assertEqual, assertFailure)
5556import qualified Test.Hspec as H
5657import Test.Hspec (xit)
57−import Test.Hspec.WebDriver hiding (runWD, click, uploadFile)
58+import Test.Hspec.WebDriver hiding (runWD, click, uploadFile, WD)
5859import qualified Test.Hspec.WebDriver as WD
59−import Test.WebDriver (WD)
60+import Test.WebDriver (WD(..))
6061
6162import qualified Data.ByteString.Lazy as LBS
6263import qualified Data.Dependent.Map as DMap
@@ -77,7 +78,11 @@ seleniumPort = 8000
7778jsaddlePort = 8001
7879
7980-- TODO Remove orphan
80−deriving instance MonadRef WD
81+instance MonadRef WD where
82+ type Ref WD = Ref IO
83+ newRef = WD . newRef
84+ readRef = WD . readRef
85+ writeRef r = WD . writeRef r
8186
8287assertEqual :: (MonadIO m, Eq a, Show a) => String -> a -> a -> m ()
8388assertEqual a b = liftIO . HUnit.assertEqual a b
@@ -130,7 +135,7 @@ main = do
130135 withSeleniumServer $ \selenium -> do
131136 browserPath <- liftIO $ T.strip . T.pack <$> readProcess "which" [ "chromium" ] ""
132137 when (T.null browserPath) $ fail "No browser found"
133− withDebugging <- isJust <$> lookupEnv "DEBUG"
138+ withDebugging <- isNothing <$> lookupEnv "NO_DEBUG"
134139 let wdConfig = WD.defaultConfig { WD.wdPort = fromIntegral $ _selenium_portNumber selenium }
135140 chromeCaps' = WD.getCaps $ chromeConfig browserPath chromeFlags
136141 hspec (tests withDebugging wdConfig [chromeCaps'] selenium) `finally` _selenium_stopServer selenium
reflex-dom/ChangeLog.mdnew file+10
@@ -0,0 +1,10 @@
1+# Revision history for reflex-dom
2+
3+* The default jsaddle backend on macOS when built from nix
4+ is now jsaddle-wkwebview, matching the behaviour of cabal
5+ builds.
6+
7+## 0.5
8+
9+* Re-export new hydration widget "mainWidget" functions.
10+* The use-warp flag now properly takes precedence on macOS.
reflex-dom/default.nix+4−3
@@ -1,16 +1,17 @@
11{ mkDerivation, base, bytestring, jsaddle-webkit2gtk, jsaddle-wkwebview, jsaddle-warp, reflex
22, reflex-dom-core, stdenv, text, ghc, hostPlatform, jsaddle-clib, android-activity ? null
3−, ghcBackend ? if hostPlatform.isDarwin then "warp" else "webkit2gtk"
3+, ghcBackend ? if hostPlatform.isDarwin then "wkwebview" else "webkit2gtk"
44}:
5−assert (builtins.elem ghcBackend [ "warp" "webkit2gtk" ]);
5+assert (builtins.elem ghcBackend [ "warp" "webkit2gtk" "wkwebview" ]);
66let isAndroid = hostPlatform.libc == "bionic";
77 ghcBackendPackage = {
88 webkit2gtk = jsaddle-webkit2gtk;
99 warp = jsaddle-warp;
10+ wkwebview = jsaddle-wkwebview;
1011 }.${ghcBackend};
1112in mkDerivation {
1213 pname = "reflex-dom";
13− version = "0.4";
14+ version = "0.5";
1415 src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
1516 libraryHaskellDepends = [
1617 base bytestring reflex reflex-dom-core text
reflex-dom/reflex-dom.cabal+11−9
@@ -1,5 +1,5 @@
11Name: reflex-dom
2−Version: 0.4
2+Version: 0.5
33Synopsis: Functional Reactive Web Apps with Reflex
44Description:
55 Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine.
@@ -13,7 +13,9 @@ Stability: Experimental
1313Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
1414Build-type: Simple
1515cabal-version: >=1.24
16−extra-source-files: java/org/reflexfrp/reflexdom/MainWidget.java
16+extra-source-files:
17+ java/org/reflexfrp/reflexdom/MainWidget.java
18+ ChangeLog.md
1719
1820flag use-warp
1921 description: Use jsaddle-warp server
@@ -62,20 +64,20 @@ library
6264 build-depends:
6365 base >= 4.7 && < 4.12,
6466 bytestring == 0.10.*,
65− reflex == 0.5.*,
66− reflex-dom-core >=0.4 && <0.5,
67+ reflex == 0.6.*,
68+ reflex-dom-core >=0.5 && <0.6,
6769 text == 1.2.*
6870 if !impl(ghcjs)
69− if os(osx) || os(ios)
71+ if flag(use-warp) && (os(linux) || os(osx))
7072 build-depends:
71− data-default == 0.7.*,
7273 jsaddle,
73− jsaddle-wkwebview
74+ jsaddle-warp
7475 else
75− if flag(use-warp)
76+ if os(osx) || os(ios)
7677 build-depends:
78+ data-default == 0.7.*,
7779 jsaddle,
78− jsaddle-warp
80+ jsaddle-wkwebview
7981 else
8082 if flag(webkit2gtk)
8183 build-depends: