on develop help sign in
Merge branch 'develop' into cn-return-correct-result-for-wheel
commit1b87f3c909256ce8538fe86a225ffb31bad4276d authorCarlo Nucera <meditans@gmail.com> dateFri 3 Jan 2020, 10:38 (7 years ago) parented29dad94c2607
10 files changed+88−135
default.nix−53 dep/reflex-platform/github.json+2−2 reflex-dom-core/ChangeLog.md+20−1 reflex-dom-core/reflex-dom-core.cabal+3−3 reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+12−25 reflex-dom-core/src/Reflex/Dom/Widget/Input.hs+5−39 reflex-dom/ChangeLog.md+10−1 reflex-dom/java/org/reflexfrp/reflexdom/MainWidget.java+6 reflex-dom/reflex-dom.cabal+3−3 release.nix+27−8
default.nixdeleted−53
@@ -1,53 +0,0 @@
1−haskellPackages: let
2− pkgs = haskellPackages.callPackage ({ pkgs }: pkgs) {};
3− inherit (pkgs) stdenv;
4− haskellLib = pkgs.haskell.lib;
5−in {
6− reflex-dom-core = let
7− inherit (haskellPackages) ghc;
8− noGcTest = stdenv.hostPlatform.system != "x86_64-linux"
9− || stdenv.hostPlatform != stdenv.buildPlatform
10− || (ghc.isGhcjs or false);
11− in haskellLib.overrideCabal
12− (haskellPackages.callCabal2nix "reflex-dom-core" ./reflex-dom-core { })
13− (drv: {
14− #TODO: Get hlint working for cross-compilation
15− doCheck = stdenv.hostPlatform == stdenv.buildPlatform && !(ghc.isGhcjs or false);
16−
17− # The headless browser run as part of the tests will exit without this
18− preBuild = ''
19− export HOME="$PWD"
20− '';
21−
22− # Show some output while running tests, so we might notice what's wrong
23− testTarget = "--show-details=streaming";
24−
25− testHaskellDepends = with haskellPackages; (drv.testHaskellDepends or []) ++ stdenv.lib.optionals (!noGcTest) [
26− temporary
27− jsaddle-warp
28− process
29− chrome-test-utils
30− ];
31−
32− testSystemDepends = with pkgs; (drv.testSystemDepends or []) ++ [
33− selenium-server-standalone which
34− ] ++ stdenv.lib.optionals (!noGcTest) [
35− chromium
36− pkgs.iproute
37− ];
38− } // stdenv.lib.optionalAttrs (!noGcTest) {
39− # The headless browser run as part of gc tests would hang/crash without this
40− preCheck = ''
41− export FONTCONFIG_PATH=${pkgs.fontconfig.out}/etc/fonts
42− '';
43− });
44− reflex-dom = haskellLib.overrideCabal
45− (haskellPackages.callCabal2nix "reflex-dom" ./reflex-dom { })
46− (drv: {
47− # Hack until https://github.com/NixOS/cabal2nix/pull/432 lands
48− libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ stdenv.lib.optionals (with stdenv.hostPlatform; isAndroid && is32bit) [
49− haskellPackages.android-activity
50− ];
51− });
52− chrome-test-utils = haskellPackages.callCabal2nix "chrome-test-utils" ./chrome-test-utils {};
53−}
dep/reflex-platform/github.json+2−2
@@ -2,6 +2,6 @@
22 "owner": "reflex-frp",
33 "repo": "reflex-platform",
44 "branch": "develop",
5− "rev": "338fc907e37d70e6469c529456f33221fb05ca1f",
6− "sha256": "08gfhpp0pkvvi1wnlpcn6wmpzdjvy5z7dy1h66gp2w8b5cx8hx5h"
5+ "rev": "e7b76dd552a10916c7d8702c11292dac4f4299ea",
6+ "sha256": "0s1183arrwldcs50qhzgnv94v24n9bgq6dfq64wp0a3q2nzyvgwh"
77}
reflex-dom-core/ChangeLog.md+20−1
@@ -1,6 +1,25 @@
11# Revision history for reflex-dom-core
22
3−## Unreleased
3+## 0.5.3
4+
5+* Deprecate a number of old inflexible widget helpers in `Reflex.Dom.Widget.Basic`:
6+
7+ * `Link`
8+ * `button`
9+ * `dtdd`
10+ * `linkClass`
11+ * `link`
12+ * `tabDisplay`
13+ * `tableDynAttr`
14+
15+ And in `Reflex.Dom.Widget.Input`:
16+
17+ * `TextInput`
18+ * `TextAreaConfig`
19+ * `CheckboxConfig`
20+ * `FileInput`
21+
22+ * Add `< 0.7` upper bound for reflex
423
524* *breaking change* The wheel event now is of `WheelEventResult` rather than `()`.
625 This provides information about the wheels motion beyond the fact that it merely moved.
reflex-dom-core/reflex-dom-core.cabal+3−3
@@ -1,5 +1,5 @@
11Name: reflex-dom-core
2−Version: 0.5.2.0
2+Version: 0.5.3
33Synopsis: Functional Reactive Web Apps with Reflex
44Description: Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine
55License: BSD3
@@ -63,7 +63,7 @@ library
6363 directory >= 1.2 && < 1.4,
6464 exception-transformers == 0.4.*,
6565 ghcjs-dom >= 0.9.1.0 && < 0.10,
66− jsaddle >=0.9.0.0 && <0.10,
66+ jsaddle >= 0.9.0.0 && < 0.10,
6767 -- keycode-0.2 has a bug on firefox
6868 keycode >= 0.2.1 && < 0.3,
6969 lens >= 4.7 && < 5,
@@ -72,7 +72,7 @@ library
7272 primitive >= 0.5 && < 0.7,
7373 random,
7474 ref-tf == 0.4.*,
75− reflex >= 0.6.2,
75+ reflex >= 0.6.2 && < 0.7,
7676 semigroups >= 0.16 && < 0.19,
7777 stm >= 2.4 && < 2.6,
7878 text == 1.2.*,
reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+12−25
@@ -138,6 +138,7 @@ dynComment t = do
138138display :: (PostBuild t m, DomBuilder t m, Show a) => Dynamic t a -> m ()
139139display = dynText . fmap (T.pack . show)
140140
141+{-# DEPRECATED button "Use 'elAttr'' in combination with 'domEvent' instead" #-}
141142button :: DomBuilder t m => Text -> m (Event t ())
142143button t = do
143144 (e, _) <- element "button" def $ text t
@@ -145,7 +146,9 @@ button t = do
145146
146147--TODO: Should this be renamed to 'widgetView' for consistency with 'widgetHold'?
147148-- | Given a Dynamic of widget-creating actions, create a widget that is recreated whenever the Dynamic updates.
148−-- The returned Event of widget results occurs when the Dynamic does.
149+-- The returned Event occurs whenever the child widget is updated, which is
150+-- at post-build in addition to the times at which the input Dynamic is
151+-- updated, and its value is the result of running the widget.
149152-- Note: Often, the type @a@ is an 'Event', in which case the return value is an Event-of-Events that would typically be flattened (via 'switchHold').
150153dyn :: (Adjustable t m, NotReady t m, PostBuild t m) => Dynamic t (m a) -> m (Event t a)
151154dyn = networkView
@@ -269,45 +272,25 @@ dynamicAttributesToModifyAttributesWithInitial attrs0 d = do
269272 return $ if Map.null p then Nothing else Just p
270273 return modificationsNeeded
271274
272−--------------------------------------------------------------------------------
273−-- Copied and pasted from Reflex.Widget.Class
274−--------------------------------------------------------------------------------
275−
276−{-
277−schedulePostBuild x = performEvent_ . (x <$) =<< getPostBuild
278−
279−elDynHtml' :: DomBuilder t m => Text -> Dynamic t Text -> m (El t)
280−elDynHtml' elementTag html = do
281− e <- buildEmptyElement elementTag (Map.empty :: Map Text Text)
282− schedulePostBuild $ setInnerHTML e . Just =<< sample (current html)
283− performEvent_ $ fmap (setInnerHTML e . Just) $ updated html
284− wrapElement defaultDomEventHandler e
285−
286−elDynHtmlAttr' :: DomBuilder t m => Text -> Map Text Text -> Dynamic t Text -> m (El t)
287−elDynHtmlAttr' elementTag attrs html = do
288− e <- buildEmptyElement elementTag attrs
289− schedulePostBuild $ setInnerHTML e . Just =<< sample (current html)
290− performEvent_ $ fmap (setInnerHTML e . Just) $ updated html
291− wrapElement defaultDomEventHandler e
292−-}
293−
275+{-# DEPRECATED Link "Will be removed when 'linkClass' and 'link' are removed. Follow those functions' deprecation instructions." #-}
294276newtype Link t
295277 = Link { _link_clicked :: Event t ()
296278 }
297279
298−-- | >>> linkClass "Click here" "link-class"
299−-- > <a class="link-class">Click here</a>
280+{-# DEPRECATED linkClass "Use 'elAttr'' in combination with 'domEvent' for just clicks. Use 'routeLink' for Obelisk navigation" #-}
300281linkClass :: DomBuilder t m => Text -> Text -> m (Link t)
301282linkClass s c = do
302283 (l,_) <- elAttr' "a" ("class" =: c) $ text s
303284 return $ Link $ domEvent Click l
304285
286+{-# DEPRECATED link "Use 'elAttr'' in combination with 'domEvent' for just clicks. Use 'routeLink' for Obelisk navigation" #-}
305287link :: DomBuilder t m => Text -> m (Link t)
306288link s = linkClass s ""
307289
308290divClass :: forall t m a. DomBuilder t m => Text -> m a -> m a
309291divClass = elClass "div"
310292
293+{-# DEPRECATED dtdd "Use an application specific widget generating function" #-}
311294dtdd :: forall t m a. DomBuilder t m => Text -> m a -> m a
312295dtdd h w = do
313296 el "dt" $ text h
@@ -316,7 +299,9 @@ dtdd h w = do
316299blank :: forall m. Monad m => m ()
317300blank = return ()
318301
302+-- TODO: Move to an example project.
319303-- | A widget to display a table with static columns and dynamic rows.
304+{-# DEPRECATED tableDynAttr "Use an application specific widget generating function" #-}
320305tableDynAttr :: forall t m r k v. (Ord k, DomBuilder t m, MonadHold t m, PostBuild t m, MonadFix m)
321306 => Text -- ^ Class applied to <table> element
322307 -> [(Text, k -> Dynamic t r -> m v)] -- ^ Columns of (header, row key -> row value -> child widget)
@@ -332,9 +317,11 @@ tableDynAttr klass cols dRows rowAttrs = elAttr "div" (Map.singleton "style" "zo
332317 dAttrs <- rowAttrs k
333318 elDynAttr' "tr" dAttrs $ mapM (\x -> el "td" $ snd x k r) cols)
334319
320+-- TODO: Move to an example project.
335321-- | A widget to construct a tabbed view that shows only one of its child widgets at a time.
336322-- Creates a header bar containing a <ul> with one <li> per child; clicking a <li> displays
337323-- the corresponding child and hides all others.
324+{-# DEPRECATED tabDisplay "Use an application specific widget generating function" #-}
338325tabDisplay :: forall t m k. (MonadFix m, DomBuilder t m, MonadHold t m, PostBuild t m, Ord k)
339326 => Text -- ^ Class applied to <ul> element
340327 -> Text -- ^ Class applied to currently active <li> element
reflex-dom-core/src/Reflex/Dom/Widget/Input.hs+5−39
@@ -54,6 +54,7 @@ import qualified Text.Read as T
5454import qualified GHCJS.DOM.Event as Event
5555import qualified GHCJS.DOM.HTMLInputElement as Input
5656
57+{-# DEPRECATED TextInput, _textInput_element, TextInputConfig, textInput "Use 'inputElement' directly" #-}
5758data TextInput t
5859 = TextInput { _textInput_value :: Dynamic t Text
5960 , _textInput_input :: Event t Text
@@ -161,6 +162,7 @@ rangeInput (RangeInputConfig initial eSetValue dAttrs) = do
161162 , _rangeInput_element = _inputElement_raw i
162163 }
163164
165+{-# DEPRECATED TextAreaConfig, TextArea, textArea "Use 'textAreaElement' directly" #-}
164166data TextAreaConfig t
165167 = TextAreaConfig { _textAreaConfig_initialValue :: Text
166168 , _textAreaConfig_setValue :: Event t Text
@@ -198,6 +200,7 @@ textArea (TextAreaConfig initial eSet attrs) = do
198200 , _textArea_element = _textAreaElement_raw i
199201 }
200202
203+{-# DEPRECATED CheckboxConfig, Checkbox, checkbox, checkboxView, CheckboxViewEventResultType, regularToCheckboxViewEventType, CheckboxViewEventResult "Use 'inputElement' directly" #-}
201204data CheckboxConfig t
202205 = CheckboxConfig { _checkboxConfig_setValue :: Event t Bool
203206 , _checkboxConfig_attributes :: Dynamic t (Map Text Text)
@@ -287,7 +290,7 @@ regularToCheckboxViewEventType en r = case en of
287290
288291newtype CheckboxViewEventResult en = CheckboxViewEventResult { unCheckboxViewEventResult :: CheckboxViewEventResultType en }
289292
290−--TODO
293+-- | Create a view only checkbox
291294{-# INLINABLE checkboxView #-}
292295checkboxView :: forall t m. (DomBuilder t m, DomBuilderSpace m ~ GhcjsDomSpace, PostBuild t m, MonadHold t m) => Dynamic t (Map Text Text) -> Dynamic t Bool -> m (Event t Bool)
293296checkboxView dAttrs dValue = do
@@ -321,6 +324,7 @@ checkboxView dAttrs dValue = do
321324 i <- inputElement inputElementConfig
322325 return $ unCheckboxViewEventResult <$> select (_element_events $ _inputElement_element i) (WrapArg Click)
323326
327+{-# DEPRECATED FileInput, FileInputConfig, fileInput "Use 'inputElement' directly" #-}
324328data FileInput d t
325329 = FileInput { _fileInput_value :: Dynamic t [File]
326330 , _fileInput_element :: RawInputElement d
@@ -681,41 +685,3 @@ instance HasValue (Dropdown t k) where
681685instance HasValue (Checkbox t) where
682686 type Value (Checkbox t) = Dynamic t Bool
683687 value = _checkbox_value
684−
685−{-
686−type family Controller sm t a where
687− Controller Edit t a = (a, Event t a) -- Initial value and setter
688− Controller View t a = Dynamic t a -- Value (always)
689−
690−type family Output sm t a where
691− Output Edit t a = Dynamic t a -- Value (always)
692− Output View t a = Event t a -- Requested changes
693−
694−data CheckboxConfig sm t
695− = CheckboxConfig { _checkbox_input :: Controller sm t Bool
696− , _checkbox_attributes :: Attributes
697− }
698−
699−instance Reflex t => Default (CheckboxConfig Edit t) where
700− def = CheckboxConfig (False, never) mempty
701−
702−data Checkbox sm t
703− = Checkbox { _checkbox_output :: Output sm t Bool
704− }
705−
706−data StateMode = Edit | View
707−
708−--TODO: There must be a more generic way to get this witness and allow us to case on the type-level StateMode
709−data StateModeWitness (sm :: StateMode) where
710− EditWitness :: StateModeWitness Edit
711− ViewWitness :: StateModeWitness View
712−
713−class HasStateModeWitness (sm :: StateMode) where
714− stateModeWitness :: StateModeWitness sm
715−
716−instance HasStateModeWitness Edit where
717− stateModeWitness = EditWitness
718−
719−instance HasStateModeWitness View where
720− stateModeWitness = ViewWitness
721−-}
reflex-dom/ChangeLog.md+10−1
@@ -1,6 +1,15 @@
11# Revision history for reflex-dom
22
3−## 0.5.1
3+## 0.5.3
4+
5+* On Android, enable prompting the user for geolocation
6+ permissions on demand by default. See
7+ https://developer.android.com/reference/android/webkit/WebChromeClient.html#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)
8+ for details.
9+
10+ * Add `< 0.7` upper bound for reflex
11+
12+## 0.5.2
413
514* The default jsaddle backend on macOS when built from nix
615 is now jsaddle-wkwebview, matching the behaviour of cabal
reflex-dom/java/org/reflexfrp/reflexdom/MainWidget.java+6
@@ -8,6 +8,7 @@ import android.util.Log;
88import android.view.ViewGroup.LayoutParams;
99import android.view.Window;
1010import android.webkit.CookieManager;
11+import android.webkit.GeolocationPermissions;
1112import android.webkit.JavascriptInterface;
1213import android.webkit.MimeTypeMap;
1314import android.webkit.PermissionRequest;
@@ -122,6 +123,11 @@ public class MainWidget {
122123 public Bitmap getDefaultVideoPoster() {
123124 return Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888);
124125 }
126+
127+ @Override
128+ public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
129+ callback.invoke(origin, true, false);
130+ }
125131 });
126132
127133 wv.addJavascriptInterface(new JSaddleCallbacks(jsaddleCallbacks), "jsaddle");
reflex-dom/reflex-dom.cabal+3−3
@@ -1,5 +1,5 @@
11Name: reflex-dom
2−Version: 0.5.2.0
2+Version: 0.5.3
33Synopsis: Functional Reactive Web Apps with Reflex
44Description:
55 Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine.
@@ -59,8 +59,8 @@ library
5959 build-depends:
6060 base >= 4.7 && < 4.13,
6161 bytestring == 0.10.*,
62− reflex >= 0.6.2,
63− reflex-dom-core >=0.5.2 && <0.6,
62+ reflex >= 0.6.2 && < 0.7,
63+ reflex-dom-core >=0.5.2 && < 0.6,
6464 text == 1.2.*
6565 if !impl(ghcjs)
6666 if flag(use-warp) && (os(linux) || os(osx))
release.nix+27−8
@@ -17,16 +17,35 @@ let
1717 ] ++ lib.optionals (reflex-platform.iosSupport) [
1818 "ghcIosAarch64"
1919 ];
20− hsPkgs = lib.genAttrs compilers (ghc: let
21− ghc' = reflex-platform.${ghc}.override {
22− overrides = self: super: import ./. self;
20+ compilerPkgs = lib.genAttrs compilers (ghc: let
21+ reflex-platform = reflex-platform-fun {
22+ inherit system;
23+ haskellOverlays = [
24+ # Use this package's source for reflex
25+ (self: super: {
26+ _dep = super._dep // {
27+ reflex-dom = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [
28+ "release.nix"
29+ ".git"
30+ "dist"
31+ ])) ./.;
32+ };
33+ })
34+ ];
2335 };
24− in {
25− inherit (ghc') reflex-dom reflex-dom-core;
36+ all = {
37+ inherit (reflex-platform.${ghc})
38+ reflex-dom-core
39+ reflex-dom
40+ ;
41+ };
42+ in all // {
43+ cache = reflex-platform.pinBuildInputs "reflex-${system}-${ghc}"
44+ (builtins.attrValues all);
2645 });
27− in hsPkgs // {
28− cache = reflex-platform.pinBuildInputs "reflex-dom-${system}"
29− (lib.concatLists (map builtins.attrValues (builtins.attrValues hsPkgs)));
46+ in compilerPkgs // {
47+ cache = reflex-platform.pinBuildInputs "reflex-${system}"
48+ (map (a: a.cache) (builtins.attrValues compilerPkgs));
3049 });
3150
3251 metaCache = native-reflex-platform.pinBuildInputs "reflex-dom-everywhere"