on develop help sign in
Use keycode package instead of ad-hoc keycodes
581c8dbRyan Trinkle
default.nix+18−17
@@ -3,7 +3,7 @@
3, transformers, data-default, semigroups, blaze-builder, aeson
3, transformers, data-default, semigroups, blaze-builder, aeson
4, ghc, webkitgtk3-javascriptcore, exception-transformers
4, ghc, webkitgtk3-javascriptcore, exception-transformers
5, webkitgtk24x, dependent-sum-template, bifunctors, bimap
5, webkitgtk24x, dependent-sum-template, bifunctors, bimap
6−, raw-strings-qq, zenc, random, monad-control
6+, raw-strings-qq, zenc, random, monad-control, keycode
7}:
7}:
8
8
9mkDerivation {
9mkDerivation {
@@ -11,26 +11,27 @@ mkDerivation {
11 version = "0.3";
11 version = "0.3";
12 src = builtins.filterSource (path: type: baseNameOf path != ".git") ./.;
12 src = builtins.filterSource (path: type: baseNameOf path != ".git") ./.;
13 buildDepends = [
13 buildDepends = [
14− reflex
15− dependent-map
16− mtl
17− transformers
18− these
19− lens
20− ghcjs-dom
21− text
22− data-default
23− semigroups
24− ref-tf
25− blaze-builder
26 aeson
14 aeson
27− exception-transformers
28− dependent-sum-template
29 bifunctors
15 bifunctors
30− zenc
31− random
32 bimap
16 bimap
17+ blaze-builder
18+ data-default
19+ dependent-map
20+ dependent-sum-template
21+ exception-transformers
22+ ghcjs-dom
23+ keycode
24+ lens
33 monad-control
25 monad-control
26+ mtl
27+ random
28+ ref-tf
29+ reflex
30+ semigroups
31+ text
32+ these
33+ transformers
34+ zenc
34 ] ++ (if (ghc.pname or null) == "ghcjs" then [ ] else [ webkitgtk3-javascriptcore raw-strings-qq ]);
35 ] ++ (if (ghc.pname or null) == "ghcjs" then [ ] else [ webkitgtk3-javascriptcore raw-strings-qq ]);
35 pkgconfigDepends = if (ghc.pname or null) == "ghcjs" then [ ] else [ webkitgtk24x webkitgtk3-javascriptcore raw-strings-qq ];
36 pkgconfigDepends = if (ghc.pname or null) == "ghcjs" then [ ] else [ webkitgtk24x webkitgtk3-javascriptcore raw-strings-qq ];
36 license = null;
37 license = null;
reflex-dom.cabal+2−1
@@ -50,7 +50,8 @@ library
50 zenc == 0.1.*,
50 zenc == 0.1.*,
51 bifunctors >= 4.2 && < 6,
51 bifunctors >= 4.2 && < 6,
52 bimap >= 0.3 && < 0.4,
52 bimap >= 0.3 && < 0.4,
53− monad-control >= 1.0.1 && < 1.1
53+ monad-control >= 1.0.1 && < 1.1,
54+ keycode == 0.2.*
54
55
55 if impl(ghcjs)
56 if impl(ghcjs)
56 hs-source-dirs: src-ghcjs
57 hs-source-dirs: src-ghcjs
src/Reflex/Dom/Class.hs+8−5
@@ -1,27 +1,30 @@
1{-# LANGUAGE MultiParamTypeClasses #-}
1{-# LANGUAGE MultiParamTypeClasses #-}
2module Reflex.Dom.Class ( module Reflex.Dom.Class
2module Reflex.Dom.Class ( module Reflex.Dom.Class
3 , module Foreign.JavaScript.TH
3 , module Foreign.JavaScript.TH
4+ , module Web.KeyCode
4 ) where
5 ) where
5
6
7+import Data.Map (Map)
8+import qualified Data.Map as Map
6import Reflex.Class
9import Reflex.Class
10+import Web.KeyCode
11+
12+import Foreign.JavaScript.TH
7import Reflex.Dom.PerformEvent.Class
13import Reflex.Dom.PerformEvent.Class
8import Reflex.Dom.PostBuild.Class
14import Reflex.Dom.PostBuild.Class
9
15
10import Prelude hiding (concat, mapM, mapM_, sequence)
16import Prelude hiding (concat, mapM, mapM_, sequence)
11
17
12−import Foreign.JavaScript.TH
13−
14−import Data.Map (Map)
15−import qualified Data.Map as Map
16−
17-- | Alias for Data.Map.singleton
18-- | Alias for Data.Map.singleton
18(=:) :: k -> a -> Map k a
19(=:) :: k -> a -> Map k a
19(=:) = Map.singleton
20(=:) = Map.singleton
20infixr 7 =: -- Ought to bind tighter than <>, which is infixr 6
21infixr 7 =: -- Ought to bind tighter than <>, which is infixr 6
21
22
23+{-# DEPRECATED keycodeEnter "Instead of `x == keycodeEnter`, use `keyCodeLookup x == Enter`" #-}
22keycodeEnter :: Int
24keycodeEnter :: Int
23keycodeEnter = 13
25keycodeEnter = 13
24
26
27+{-# DEPRECATED keycodeEscape "Instead of `x == keycodeEscape`, use `keyCodeLookup x == Escape`" #-}
25keycodeEscape :: Int
28keycodeEscape :: Int
26keycodeEscape = 27
29keycodeEscape = 27
27
30
src/Reflex/Dom/Widget/Input.hs+1−1
@@ -104,7 +104,7 @@ textInput (TextInputConfig inputType initial eSetValue dAttrs) = do
104
104
105{-# INLINABLE textInputGetEnter #-}
105{-# INLINABLE textInputGetEnter #-}
106textInputGetEnter :: Reflex t => TextInput t -> Event t ()
106textInputGetEnter :: Reflex t => TextInput t -> Event t ()
107−textInputGetEnter i = fmapMaybe (\n -> if n == keycodeEnter then Just () else Nothing) $ _textInput_keypress i
107+textInputGetEnter i = fmapMaybe (\n -> if keyCodeLookup n == Enter then Just () else Nothing) $ _textInput_keypress i
108
108
109data TextAreaConfig t
109data TextAreaConfig t
110 = TextAreaConfig { _textAreaConfig_initialValue :: Text
110 = TextAreaConfig { _textAreaConfig_initialValue :: Text