on develop help sign in
Squash similar deprecations together
8b34670Tom Smalley
reflex-dom-core/src/Reflex/Dom/Widget/Input.hs+4−18
@@ -54,7 +54,7 @@ import qualified Text.Read as T
54import qualified GHCJS.DOM.Event as Event
54import qualified GHCJS.DOM.Event as Event
55import qualified GHCJS.DOM.HTMLInputElement as Input
55import qualified GHCJS.DOM.HTMLInputElement as Input
56
56
57−{-# DEPRECATED TextInput "Use 'inputElement' directly" #-}
57+{-# DEPRECATED TextInput, _textInput_element, TextInputConfig, textInput, textInputGetEnter "Use 'inputElement' directly" #-}
58data TextInput t
58data TextInput t
59 = TextInput { _textInput_value :: Dynamic t Text
59 = TextInput { _textInput_value :: Dynamic t Text
60 , _textInput_input :: Event t Text
60 , _textInput_input :: Event t Text
@@ -65,7 +65,6 @@ data TextInput t
65 , _textInput_builderElement :: InputElement EventResult GhcjsDomSpace t
65 , _textInput_builderElement :: InputElement EventResult GhcjsDomSpace t
66 }
66 }
67
67
68−{-# DEPRECATED _textInput_element "Use 'inputElement' directly" #-}
69_textInput_element :: TextInput t -> HTMLInputElement
68_textInput_element :: TextInput t -> HTMLInputElement
70_textInput_element = _inputElement_raw . _textInput_builderElement
69_textInput_element = _inputElement_raw . _textInput_builderElement
71
70
@@ -73,7 +72,6 @@ instance Reflex t => HasDomEvent t (TextInput t) en where
73 type DomEventType (TextInput t) en = DomEventType (InputElement EventResult GhcjsDomSpace t) en
72 type DomEventType (TextInput t) en = DomEventType (InputElement EventResult GhcjsDomSpace t) en
74 domEvent en = domEvent en . _textInput_builderElement
73 domEvent en = domEvent en . _textInput_builderElement
75
74
76−{-# DEPRECATED TextInputConfig "Use 'inputElement' directly" #-}
77data TextInputConfig t
75data TextInputConfig t
78 = TextInputConfig { _textInputConfig_inputType :: Text
76 = TextInputConfig { _textInputConfig_inputType :: Text
79 , _textInputConfig_initialValue :: Text
77 , _textInputConfig_initialValue :: Text
@@ -89,7 +87,6 @@ instance Reflex t => Default (TextInputConfig t) where
89 , _textInputConfig_attributes = constDyn mempty
87 , _textInputConfig_attributes = constDyn mempty
90 }
88 }
91
89
92−{-# DEPRECATED textInput "Use 'inputElement' directly" #-}
93-- | 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.
90-- | 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.
94{-# INLINABLE textInput #-}
91{-# INLINABLE textInput #-}
95textInput :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextInputConfig t -> m (TextInput t)
92textInput :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextInputConfig t -> m (TextInput t)
@@ -110,7 +107,6 @@ textInput (TextInputConfig inputType initial eSetValue dAttrs) = do
110 }
107 }
111
108
112{-# INLINE textInputGetEnter #-}
109{-# INLINE textInputGetEnter #-}
113−{-# DEPRECATED textInputGetEnter "Use 'keypress Enter' instead" #-}
114textInputGetEnter :: Reflex t => TextInput t -> Event t ()
110textInputGetEnter :: Reflex t => TextInput t -> Event t ()
115textInputGetEnter = keypress Enter
111textInputGetEnter = keypress Enter
116
112
@@ -165,7 +161,7 @@ rangeInput (RangeInputConfig initial eSetValue dAttrs) = do
165 , _rangeInput_element = _inputElement_raw i
161 , _rangeInput_element = _inputElement_raw i
166 }
162 }
167
163
168−{-# DEPRECATED TextAreaConfig "Use 'textAreaElement' directly" #-}
164+{-# DEPRECATED TextAreaConfig, TextArea, textArea "Use 'textAreaElement' directly" #-}
169data TextAreaConfig t
165data TextAreaConfig t
170 = TextAreaConfig { _textAreaConfig_initialValue :: Text
166 = TextAreaConfig { _textAreaConfig_initialValue :: Text
171 , _textAreaConfig_setValue :: Event t Text
167 , _textAreaConfig_setValue :: Event t Text
@@ -179,7 +175,6 @@ instance Reflex t => Default (TextAreaConfig t) where
179 , _textAreaConfig_attributes = constDyn mempty
175 , _textAreaConfig_attributes = constDyn mempty
180 }
176 }
181
177
182−{-# DEPRECATED TextArea "Use 'textAreaElement' directly" #-}
183data TextArea t
178data TextArea t
184 = TextArea { _textArea_value :: Dynamic t Text
179 = TextArea { _textArea_value :: Dynamic t Text
185 , _textArea_input :: Event t Text
180 , _textArea_input :: Event t Text
@@ -188,7 +183,6 @@ data TextArea t
188 , _textArea_element :: HTMLTextAreaElement
183 , _textArea_element :: HTMLTextAreaElement
189 }
184 }
190
185
191−{-# DEPRECATED textArea "Use 'textAreaElement' directly" #-}
192{-# INLINABLE textArea #-}
186{-# INLINABLE textArea #-}
193textArea :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextAreaConfig t -> m (TextArea t)
187textArea :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextAreaConfig t -> m (TextArea t)
194textArea (TextAreaConfig initial eSet attrs) = do
188textArea (TextAreaConfig initial eSet attrs) = do
@@ -205,7 +199,7 @@ textArea (TextAreaConfig initial eSet attrs) = do
205 , _textArea_element = _textAreaElement_raw i
199 , _textArea_element = _textAreaElement_raw i
206 }
200 }
207
201
208−{-# DEPRECATED CheckboxConfig "Use 'inputElement' directly" #-}
202+{-# DEPRECATED CheckboxConfig, Checkbox, checkbox, checkboxView, CheckboxViewEventResultType, regularToCheckboxViewEventType, CheckboxViewEventResult "Use 'inputElement' directly" #-}
209data CheckboxConfig t
203data CheckboxConfig t
210 = CheckboxConfig { _checkboxConfig_setValue :: Event t Bool
204 = CheckboxConfig { _checkboxConfig_setValue :: Event t Bool
211 , _checkboxConfig_attributes :: Dynamic t (Map Text Text)
205 , _checkboxConfig_attributes :: Dynamic t (Map Text Text)
@@ -217,13 +211,11 @@ instance Reflex t => Default (CheckboxConfig t) where
217 , _checkboxConfig_attributes = constDyn mempty
211 , _checkboxConfig_attributes = constDyn mempty
218 }
212 }
219
213
220−{-# DEPRECATED Checkbox "Use 'inputElement' directly" #-}
221data Checkbox t
214data Checkbox t
222 = Checkbox { _checkbox_value :: Dynamic t Bool
215 = Checkbox { _checkbox_value :: Dynamic t Bool
223 , _checkbox_change :: Event t Bool
216 , _checkbox_change :: Event t Bool
224 }
217 }
225
218
226−{-# DEPRECATED checkbox "Use 'inputElement' directly" #-}
227-- | Create an editable checkbox
219-- | Create an editable checkbox
228-- Note: if the "type" or "checked" attributes are provided as attributes, they will be ignored
220-- Note: if the "type" or "checked" attributes are provided as attributes, they will be ignored
229{-# INLINABLE checkbox #-}
221{-# INLINABLE checkbox #-}
@@ -242,12 +234,10 @@ checkbox checked config = do
242 , _checkbox_change = _inputElement_checkedChange i
234 , _checkbox_change = _inputElement_checkedChange i
243 }
235 }
244
236
245−{-# DEPRECATED CheckboxViewEventResultType "Use 'inputElement' directly" #-}
246type family CheckboxViewEventResultType (en :: EventTag) :: * where
237type family CheckboxViewEventResultType (en :: EventTag) :: * where
247 CheckboxViewEventResultType 'ClickTag = Bool
238 CheckboxViewEventResultType 'ClickTag = Bool
248 CheckboxViewEventResultType t = EventResultType t
239 CheckboxViewEventResultType t = EventResultType t
249
240
250−{-# DEPRECATED regularToCheckboxViewEventType "Use 'inputElement' directly" #-}
251regularToCheckboxViewEventType :: EventName t -> EventResultType t -> CheckboxViewEventResultType t
241regularToCheckboxViewEventType :: EventName t -> EventResultType t -> CheckboxViewEventResultType t
252regularToCheckboxViewEventType en r = case en of
242regularToCheckboxViewEventType en r = case en of
253 Click -> error "regularToCheckboxViewEventType: EventName Click should never be encountered"
243 Click -> error "regularToCheckboxViewEventType: EventName Click should never be encountered"
@@ -297,10 +287,8 @@ regularToCheckboxViewEventType en r = case en of
297 Touchend -> r
287 Touchend -> r
298 Touchcancel -> r
288 Touchcancel -> r
299
289
300−{-# DEPRECATED CheckboxViewEventResult "Use 'inputElement' directly" #-}
301newtype CheckboxViewEventResult en = CheckboxViewEventResult { unCheckboxViewEventResult :: CheckboxViewEventResultType en }
290newtype CheckboxViewEventResult en = CheckboxViewEventResult { unCheckboxViewEventResult :: CheckboxViewEventResultType en }
302
291
303−{-# DEPRECATED checkboxView "Use 'inputElement' directly" #-}
304--TODO
292--TODO
305{-# INLINABLE checkboxView #-}
293{-# INLINABLE checkboxView #-}
306checkboxView :: 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)
294checkboxView :: 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)
@@ -335,13 +323,12 @@ checkboxView dAttrs dValue = do
335 i <- inputElement inputElementConfig
323 i <- inputElement inputElementConfig
336 return $ unCheckboxViewEventResult <$> select (_element_events $ _inputElement_element i) (WrapArg Click)
324 return $ unCheckboxViewEventResult <$> select (_element_events $ _inputElement_element i) (WrapArg Click)
337
325
338−{-# DEPRECATED FileInput "Use 'inputElement' directly" #-}
326+{-# DEPRECATED FileInput, FileInputConfig, fileInput "Use 'inputElement' directly" #-}
339data FileInput d t
327data FileInput d t
340 = FileInput { _fileInput_value :: Dynamic t [File]
328 = FileInput { _fileInput_value :: Dynamic t [File]
341 , _fileInput_element :: RawInputElement d
329 , _fileInput_element :: RawInputElement d
342 }
330 }
343
331
344−{-# DEPRECATED FileInputConfig "Use 'inputElement' directly" #-}
345newtype FileInputConfig t
332newtype FileInputConfig t
346 = FileInputConfig { _fileInputConfig_attributes :: Dynamic t (Map Text Text)
333 = FileInputConfig { _fileInputConfig_attributes :: Dynamic t (Map Text Text)
347 }
334 }
@@ -350,7 +337,6 @@ instance Reflex t => Default (FileInputConfig t) where
350 def = FileInputConfig { _fileInputConfig_attributes = constDyn mempty
337 def = FileInputConfig { _fileInputConfig_attributes = constDyn mempty
351 }
338 }
352
339
353−{-# DEPRECATED fileInput "Use 'inputElement' directly" #-}
354fileInput :: forall t m. (MonadIO m, MonadJSM m, MonadFix m, MonadHold t m, TriggerEvent t m, DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace)
340fileInput :: forall t m. (MonadIO m, MonadJSM m, MonadFix m, MonadHold t m, TriggerEvent t m, DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace)
355 => FileInputConfig t -> m (FileInput (DomBuilderSpace m) t)
341 => FileInputConfig t -> m (FileInput (DomBuilderSpace m) t)
356fileInput config = do
342fileInput config = do