on develop help sign in
Update Resize constraints
cbe1056Luigy Leon
src/Reflex/Dom/Widget/Resize.hs+5−3
@@ -4,12 +4,14 @@ module Reflex.Dom.Widget.Resize where
4import Reflex
4import Reflex
5import Reflex.Dom.PostBuild.Class
5import Reflex.Dom.PostBuild.Class
6import Reflex.Dom.PerformEvent.Class
6import Reflex.Dom.PerformEvent.Class
7+import Reflex.Dom.Builder.Class
7import Reflex.Dom.Builder.Immediate
8import Reflex.Dom.Builder.Immediate
8import Reflex.Dom.Class
9import Reflex.Dom.Class
9import Reflex.Dom.Old
10import Reflex.Dom.Old
10import Reflex.Dom.Widget.Basic
11import Reflex.Dom.Widget.Basic
11
12
12import Control.Monad
13import Control.Monad
14+import Control.Monad.Fix
13import Control.Monad.IO.Class
15import Control.Monad.IO.Class
14import Data.Map (Map)
16import Data.Map (Map)
15import Data.Text (Text)
17import Data.Text (Text)
@@ -21,16 +23,16 @@ import qualified Data.Map as Map
21
23
22-- | A widget that wraps the given widget in a div and fires an event when resized.
24-- | A widget that wraps the given widget in a div and fires an event when resized.
23-- Adapted from github.com/marcj/css-element-queries
25-- Adapted from github.com/marcj/css-element-queries
24−resizeDetector :: MonadWidget t m => m a -> m (Event t (), a)
26+resizeDetector :: (DomBuilder t m, PostBuild t m, TriggerEvent t m, PerformEvent t m, MonadHold t m, DomBuilderSpace m ~ GhcjsDomSpace, MonadIO (Performable m), MonadIO m, MonadFix m) => m a -> m (Event t (), a)
25resizeDetector = resizeDetectorWithStyle ""
27resizeDetector = resizeDetectorWithStyle ""
26
28
27−resizeDetectorWithStyle :: MonadWidget t m
29+resizeDetectorWithStyle :: (DomBuilder t m, PostBuild t m, TriggerEvent t m, PerformEvent t m, MonadHold t m, DomBuilderSpace m ~ GhcjsDomSpace, MonadIO (Performable m), MonadIO m, MonadFix m)
28 => Text -- ^ A css style string. Warning: It should not contain the "position" style attribute.
30 => Text -- ^ A css style string. Warning: It should not contain the "position" style attribute.
29 -> m a -- ^ The embedded widget
31 -> m a -- ^ The embedded widget
30 -> m (Event t (), a) -- ^ An 'Event' that fires on resize, and the result of the embedded widget
32 -> m (Event t (), a) -- ^ An 'Event' that fires on resize, and the result of the embedded widget
31resizeDetectorWithStyle styleString w = resizeDetectorWithAttrs ("style" =: styleString) w
33resizeDetectorWithStyle styleString w = resizeDetectorWithAttrs ("style" =: styleString) w
32
34
33−resizeDetectorWithAttrs :: MonadWidget t m
35+resizeDetectorWithAttrs :: (DomBuilder t m, PostBuild t m, TriggerEvent t m, PerformEvent t m, MonadHold t m, DomBuilderSpace m ~ GhcjsDomSpace, MonadIO (Performable m), MonadIO m, MonadFix m)
34 => Map Text Text -- ^ A map of attributes. Warning: It should not modify the "position" style attribute.
36 => Map Text Text -- ^ A map of attributes. Warning: It should not modify the "position" style attribute.
35 -> m a -- ^ The embedded widget
37 -> m a -- ^ The embedded widget
36 -> m (Event t (), a) -- ^ An 'Event' that fires on resize, and the result of the embedded widget
38 -> m (Event t (), a) -- ^ An 'Event' that fires on resize, and the result of the embedded widget