@@ -34,10 +34,8 @@ import GHCJS.DOM.Element (castToElement)
3434import qualified GHCJS.DOM.Element as Element
3535import GHCJS.DOM.EventM (on)
3636import qualified GHCJS.DOM.FileList as FileList
37−import GHCJS.DOM.HTMLInputElement (HTMLInputElement, castToHTMLInputElement)
3837import GHCJS.DOM.HTMLSelectElement (castToHTMLSelectElement)
3938import qualified GHCJS.DOM.HTMLSelectElement as HTMLSelectElement
40−import GHCJS.DOM.HTMLTextAreaElement (HTMLTextAreaElement, castToHTMLTextAreaElement)
4139import GHCJS.DOM.Types (File)
4240import Reflex.Class
4341import Reflex.Dynamic
@@ -52,14 +50,14 @@ import qualified Text.Read as T
5250import qualified GHCJS.DOM.Event as Event
5351import qualified GHCJS.DOM.HTMLInputElement as Input
5452
55−data TextInput t
53+data TextInput d t
5654 = TextInput { _textInput_value :: Dynamic t Text
5755 , _textInput_input :: Event t Text
5856 , _textInput_keypress :: Event t Int
5957 , _textInput_keydown :: Event t Int
6058 , _textInput_keyup :: Event t Int
6159 , _textInput_hasFocus :: Dynamic t Bool
62− , _textInput_element :: HTMLInputElement
60+ , _textInput_element :: RawElement d
6361 }
6462
6563data TextInputConfig t
@@ -79,7 +77,7 @@ instance Reflex t => Default (TextInputConfig t) where
7977
8078-- | Create an input whose value is a string. By default, the "type" attribute is set to "text", but it can be changed using the _textInputConfig_inputType field. Note that only types for which the value is always a string will work - types whose value may be null will not work properly with this widget.
8179{-# INLINABLE textInput #-}
82−textInput :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextInputConfig t -> m (TextInput t)
80+textInput :: (DomBuilder t m, PostBuild t m) => TextInputConfig t -> m (TextInput (DomBuilderSpace m) t)
8381textInput (TextInputConfig inputType initial eSetValue dAttrs) = do
8482 modifyAttrs <- dynamicAttributesToModifyAttributes $ fmap (Map.insert "type" inputType) dAttrs
8583 i <- inputElement $ def
@@ -93,11 +91,11 @@ textInput (TextInputConfig inputType initial eSetValue dAttrs) = do
9391 , _textInput_keydown = domEvent Keydown i
9492 , _textInput_keyup = domEvent Keyup i
9593 , _textInput_hasFocus = _inputElement_hasFocus i
96− , _textInput_element = castToHTMLInputElement $ _element_raw $ _inputElement_element i
94+ , _textInput_element = _element_raw $ _inputElement_element i
9795 }
9896
9997{-# INLINABLE textInputGetEnter #-}
100−textInputGetEnter :: Reflex t => TextInput t -> Event t ()
98+textInputGetEnter :: Reflex t => TextInput d t -> Event t ()
10199textInputGetEnter i = fmapMaybe (\n -> if keyCodeLookup n == Enter then Just () else Nothing) $ _textInput_keypress i
102100
103101data RangeInputConfig t
@@ -113,18 +111,18 @@ instance Reflex t => Default (RangeInputConfig t) where
113111 , _rangeInputConfig_attributes = constDyn mempty
114112 }
115113
116−data RangeInput t
114+data RangeInput d t
117115 = RangeInput { _rangeInput_value :: Dynamic t Float
118116 , _rangeInput_input :: Event t Float
119117 , _rangeInput_mouseup :: Event t (Int, Int)
120118 , _rangeInput_hasFocus :: Dynamic t Bool
121− , _rangeInput_element :: HTMLInputElement
119+ , _rangeInput_element :: RawInputElement d
122120 }
123121
124122-- | Create an input whose value is a float.
125123-- https://www.w3.org/wiki/HTML/Elements/input/range
126124{-# INLINABLE rangeInput #-}
127−rangeInput :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => RangeInputConfig t -> m (RangeInput t)
125+rangeInput :: (DomBuilder t m, PostBuild t m) => RangeInputConfig t -> m (RangeInput (DomBuilderSpace m) t)
128126rangeInput (RangeInputConfig initial eSetValue dAttrs) = do
129127 modifyAttrs <- dynamicAttributesToModifyAttributes $ fmap (Map.insert "type" "range") dAttrs
130128 i <- inputElement $ def
@@ -136,7 +134,7 @@ rangeInput (RangeInputConfig initial eSetValue dAttrs) = do
136134 , _rangeInput_input = read . T.unpack <$> _inputElement_input i
137135 , _rangeInput_mouseup = domEvent Mouseup i
138136 , _rangeInput_hasFocus = _inputElement_hasFocus i
139− , _rangeInput_element = castToHTMLInputElement $ _element_raw $ _inputElement_element i
137+ , _rangeInput_element = _inputElement_raw i
140138 }
141139
142140data TextAreaConfig t
@@ -152,16 +150,16 @@ instance Reflex t => Default (TextAreaConfig t) where
152150 , _textAreaConfig_attributes = constDyn mempty
153151 }
154152
155−data TextArea t
153+data TextArea d t
156154 = TextArea { _textArea_value :: Dynamic t Text
157155 , _textArea_input :: Event t Text
158156 , _textArea_hasFocus :: Dynamic t Bool
159157 , _textArea_keypress :: Event t Int
160− , _textArea_element :: HTMLTextAreaElement
158+ , _textArea_element :: RawTextAreaElement d
161159 }
162160
163161{-# INLINABLE textArea #-}
164−textArea :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextAreaConfig t -> m (TextArea t)
162+textArea :: (DomBuilder t m, PostBuild t m) => TextAreaConfig t -> m (TextArea (DomBuilderSpace m) t)
165163textArea (TextAreaConfig initial eSet attrs) = do
166164 modifyAttrs <- dynamicAttributesToModifyAttributes attrs
167165 i <- textAreaElement $ def
@@ -173,7 +171,7 @@ textArea (TextAreaConfig initial eSet attrs) = do
173171 , _textArea_input = _textAreaElement_input i
174172 , _textArea_keypress = domEvent Keypress i
175173 , _textArea_hasFocus = _textAreaElement_hasFocus i
176− , _textArea_element = castToHTMLTextAreaElement $ _element_raw $ _textAreaElement_element i
174+ , _textArea_element = _textAreaElement_raw i
177175 }
178176
179177data CheckboxConfig t
@@ -515,12 +513,12 @@ class HasValue a where
515513 type Value a :: *
516514 value :: a -> Value a
517515
518−instance HasValue (TextArea t) where
519− type Value (TextArea t) = Dynamic t Text
516+instance HasValue (TextArea d t) where
517+ type Value (TextArea d t) = Dynamic t Text
520518 value = _textArea_value
521519
522−instance HasValue (TextInput t) where
523− type Value (TextInput t) = Dynamic t Text
520+instance HasValue (TextInput d t) where
521+ type Value (TextInput d t) = Dynamic t Text
524522 value = _textInput_value
525523
526524instance HasValue (FileInput d t) where