on develop help sign in
Merge pull request #320 from crappygraphix/develop

Deprecate and document some functions in Widget.Basic and Widget.Input

commit5dc1f859d2bb0cc051a8c26db6841bfd7894b140 authorJohn Ericson <John.Ericson@Obsidian.Systems> dateWed 11 Dec 2019, 15:06 (7 years ago) parent9b7d3e491c0f59
3 files changed+19−3
reflex-dom-core/ChangeLog.md+9 reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+9−2 reflex-dom-core/src/Reflex/Dom/Widget/Input.hs+1−1
reflex-dom-core/ChangeLog.md+9
@@ -2,6 +2,15 @@
22
33## Unreleased
44
5+* Deprecate a number of old inflexible widget helpers in `Reflex.Dom.Widget.Basic`:
6+ * `Link`
7+ * `button`
8+ * `dtdd`
9+ * `linkClass`
10+ * `link`
11+ * `tabDisplay`
12+ * `tableDynAttr`
13+
514## 0.5.2
615
716* Update to use new dependent-sum/map packages and drop dependency on `*Tag` classes (e.g., `ShowTag`).
reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+9−2
@@ -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
@@ -291,23 +292,25 @@ elDynHtmlAttr' elementTag attrs html = do
291292 wrapElement defaultDomEventHandler e
292293-}
293294
295+{-# DEPRECATED Link "Will be removed when 'linkClass' and 'link' are removed" #-}
294296newtype Link t
295297 = Link { _link_clicked :: Event t ()
296298 }
297299
298−-- | >>> linkClass "Click here" "link-class"
299−-- > <a class="link-class">Click here</a>
300+{-# DEPRECATED linkClass "Use 'elAttr'' in combination with 'domEvent' for just clicks. Use 'routeLink' for Obelisk navigation" #-}
300301linkClass :: DomBuilder t m => Text -> Text -> m (Link t)
301302linkClass s c = do
302303 (l,_) <- elAttr' "a" ("class" =: c) $ text s
303304 return $ Link $ domEvent Click l
304305
306+{-# DEPRECATED link "Use 'elAttr'' in combination with 'domEvent' for just clicks. Use 'routeLink' for Obelisk navigation" #-}
305307link :: DomBuilder t m => Text -> m (Link t)
306308link s = linkClass s ""
307309
308310divClass :: forall t m a. DomBuilder t m => Text -> m a -> m a
309311divClass = elClass "div"
310312
313+{-# DEPRECATED dtdd "Use an application specific widget generating function" #-}
311314dtdd :: forall t m a. DomBuilder t m => Text -> m a -> m a
312315dtdd h w = do
313316 el "dt" $ text h
@@ -316,7 +319,9 @@ dtdd h w = do
316319blank :: forall m. Monad m => m ()
317320blank = return ()
318321
322+-- TODO: Move to an example project.
319323-- | A widget to display a table with static columns and dynamic rows.
324+{-# DEPRECATED tableDynAttr "Use an application specific widget generating function" #-}
320325tableDynAttr :: forall t m r k v. (Ord k, DomBuilder t m, MonadHold t m, PostBuild t m, MonadFix m)
321326 => Text -- ^ Class applied to <table> element
322327 -> [(Text, k -> Dynamic t r -> m v)] -- ^ Columns of (header, row key -> row value -> child widget)
@@ -332,9 +337,11 @@ tableDynAttr klass cols dRows rowAttrs = elAttr "div" (Map.singleton "style" "zo
332337 dAttrs <- rowAttrs k
333338 elDynAttr' "tr" dAttrs $ mapM (\x -> el "td" $ snd x k r) cols)
334339
340+-- TODO: Move to an example project.
335341-- | A widget to construct a tabbed view that shows only one of its child widgets at a time.
336342-- Creates a header bar containing a <ul> with one <li> per child; clicking a <li> displays
337343-- the corresponding child and hides all others.
344+{-# DEPRECATED tabDisplay "Use an application specific widget generating function" #-}
338345tabDisplay :: forall t m k. (MonadFix m, DomBuilder t m, MonadHold t m, PostBuild t m, Ord k)
339346 => Text -- ^ Class applied to <ul> element
340347 -> Text -- ^ Class applied to currently active <li> element
reflex-dom-core/src/Reflex/Dom/Widget/Input.hs+1−1
@@ -287,7 +287,7 @@ regularToCheckboxViewEventType en r = case en of
287287
288288newtype CheckboxViewEventResult en = CheckboxViewEventResult { unCheckboxViewEventResult :: CheckboxViewEventResultType en }
289289
290−--TODO
290+-- | Create a view only checkbox
291291{-# INLINABLE checkboxView #-}
292292checkboxView :: 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)
293293checkboxView dAttrs dValue = do