Skip to content

Commit

Permalink
Improve documentation (#293)
Browse files Browse the repository at this point in the history
* fix comments alignment in animation modules

* escape slashes to avoid italics in haddock

* fix grammar

* remove onClick and onClickReq from config docs for externalLink
  • Loading branch information
Deltaspace0 authored Mar 21, 2024
1 parent 94d7f24 commit d0241b2
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/Monomer/Core/Combinators.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Monomer.Graphics.Types
Given two values, usually model, checks if merge is required for a given widget.
The first parameter usually corresponds to the current 'WidgetEnv', the second
to the old value/model, and the third to the new/model.
to the old value\/model, and the third to the new value\/model.
This is used, for example, by _composite_ and _box_.
-}
Expand Down
4 changes: 2 additions & 2 deletions src/Monomer/Widgets/Animation/Fade.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ animFadeIn managed = animFadeIn_ def managed
-- | Animates a widget from not visible state to fully visible. Accepts config.
animFadeIn_
:: WidgetEvent e
=> [FadeCfg s e] -- ^ The config options.
=> [FadeCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animFadeIn_ configs managed = makeNode configs managed True
Expand All @@ -107,7 +107,7 @@ animFadeOut managed = animFadeOut_ def managed
-- | Animates a widget from visible state to not visible. Accepts config.
animFadeOut_
:: WidgetEvent e
=> [FadeCfg s e] -- ^ The config options.
=> [FadeCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animFadeOut_ configs managed = makeNode configs managed False
Expand Down
2 changes: 1 addition & 1 deletion src/Monomer/Widgets/Animation/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ animShake managed = animShake_ def managed
-- | Shakes a widget. Accepts config.
animShake_
:: WidgetEvent e
=> [ShakeCfg s e] -- ^ The config options.
=> [ShakeCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animShake_ configs managed = node where
Expand Down
4 changes: 2 additions & 2 deletions src/Monomer/Widgets/Animation/Slide.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ animSlideIn managed = animSlideIn_ def managed
-- to left). Accepts config.
animSlideIn_
:: WidgetEvent e
=> [SlideCfg s e] -- ^ The config options.
=> [SlideCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animSlideIn_ configs managed = makeNode configs managed True
Expand All @@ -142,7 +142,7 @@ animSlideOut managed = animSlideOut_ def managed
-- visible (defaults to left). Accepts config.
animSlideOut_
:: WidgetEvent e
=> [SlideCfg s e] -- ^ The config options.
=> [SlideCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animSlideOut_ configs managed = makeNode configs managed False
Expand Down
6 changes: 3 additions & 3 deletions src/Monomer/Widgets/Animation/Transform.hs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ animTransform f managed = animTransform_ def f managed
animTransform_
:: WidgetEvent e
=> [TransformCfg s e] -- ^ The config options.
-> Transformer -- ^ Transformations from time (in ms) and viewport.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
-> Transformer -- ^ Transformations from time (in ms) and viewport.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animTransform_ configs f managed = node where
node = defaultWidgetNode widgetType widget
& L.info . L.focusable .~ False
Expand Down
4 changes: 2 additions & 2 deletions src/Monomer/Widgets/Animation/Wipe.hs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ animWipeIn managed = animWipeIn_ def managed
-- to left). Accepts config.
animWipeIn_
:: WidgetEvent e
=> [WipeCfg s e] -- ^ The config options.
=> [WipeCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animWipeIn_ configs managed = makeNode configs managed True
Expand All @@ -160,7 +160,7 @@ animWipeOut managed = animWipeOut_ def managed
-- visible (defaults to left). Accepts config.
animWipeOut_
:: WidgetEvent e
=> [WipeCfg s e] -- ^ The config options.
=> [WipeCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animWipeOut_ configs managed = makeNode configs managed False
Expand Down
4 changes: 2 additions & 2 deletions src/Monomer/Widgets/Animation/Zoom.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ animZoomIn managed = animZoomIn_ def managed
-- | Animates a widget to fully visible by increasing scale. Accepts config.
animZoomIn_
:: WidgetEvent e
=> [ZoomCfg s e] -- ^ The config options.
=> [ZoomCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animZoomIn_ configs managed = makeNode configs managed True
Expand All @@ -108,7 +108,7 @@ animZoomOut managed = animZoomOut_ def managed
-- | Animates a widget to not visible by decreasing scale. Accepts config.
animZoomOut_
:: WidgetEvent e
=> [ZoomCfg s e] -- ^ The config options.
=> [ZoomCfg s e] -- ^ The config options.
-> WidgetNode s e -- ^ The child node.
-> WidgetNode s e -- ^ The created animation container.
animZoomOut_ configs managed = makeNode configs managed False
Expand Down
12 changes: 6 additions & 6 deletions src/Monomer/Widgets/Singles/DateField.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ Configuration options for dateField:
- 'onChange': event to raise when the value changes.
- 'onChangeReq': 'WidgetRequest' to generate when the value changes.
- 'dateFormatDelimiter': which text delimiter to separate year, month and day.
- 'dateFormatDDMMYYYY': using the current delimiter, accept DD/MM/YYYY.
- 'dateFormatMMDDYYYY': using the current delimiter, accept MM/DD/YYYY.
- 'dateFormatYYYYMMDD': using the current delimiter, accept YYYY/MM/DD.
- 'dateFormatDDMMYYYY': using the current delimiter, accept DD\/MM\/YYYY.
- 'dateFormatMMDDYYYY': using the current delimiter, accept MM\/DD\/YYYY.
- 'dateFormatYYYYMMDD': using the current delimiter, accept YYYY\/MM\/DD.
-}
data DateFieldCfg s e a = DateFieldCfg {
_dfcCaretWidth :: Maybe Double,
Expand Down Expand Up @@ -320,19 +320,19 @@ dateFormatDelimiter delim = def {
_dfcDateDelim = Just delim
}

-- | Date format DD/MM/YYYY, using the appropriate delimiter.
-- | Date format DD\/MM\/YYYY, using the appropriate delimiter.
dateFormatDDMMYYYY :: DateFieldCfg s e a
dateFormatDDMMYYYY = def {
_dfcDateFormat = Just FormatDDMMYYYY
}

-- | Date format MM/DD/YYYY, using the appropriate delimiter.
-- | Date format MM\/DD\/YYYY, using the appropriate delimiter.
dateFormatMMDDYYYY :: DateFieldCfg s e a
dateFormatMMDDYYYY = def {
_dfcDateFormat = Just FormatMMDDYYYY
}

-- | Date format YYYY/MM/DD, using the appropriate delimiter.
-- | Date format YYYY\/MM\/DD, using the appropriate delimiter.
dateFormatYYYYMMDD :: DateFieldCfg s e a
dateFormatYYYYMMDD = def {
_dfcDateFormat = Just FormatYYYYMMDD
Expand Down
2 changes: 0 additions & 2 deletions src/Monomer/Widgets/Singles/ExternalLink.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ Configuration options for externalLink:
- 'onFocusReq': 'WidgetRequest' to generate when focus is received.
- 'onBlur': event to raise when focus is lost.
- 'onBlurReq': 'WidgetRequest' to generate when focus is lost.
- 'onClick': event to raise when button is clicked.
- 'onClickReq': 'WidgetRequest' to generate when button is clicked.
-}
data ExternalLinkCfg s e = ExternalLinkCfg {
_elcLabelCfg :: LabelCfg s e,
Expand Down
8 changes: 4 additions & 4 deletions src/Monomer/Widgets/Util/Theme.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Monomer.Core.WidgetTypes

import qualified Monomer.Core.Lens as L

-- | Updates a the field of style with the field value from the active theme.
-- | Updates the field of style with the field value from the active theme.
collectThemeField_
:: WidgetEnv s e -- ^ The widget environment (to get the theme).
-> Lens' StyleState (Maybe t) -- ^ The target field of the style.
Expand All @@ -47,9 +47,9 @@ collectThemeField_ wenv fieldStyle fieldTheme target = style where

-- | Collects all the style states from a given field in the active theme.
collectTheme
:: WidgetEnv s e -- ^ The widget environment (to get the theme).
-> Lens' ThemeState StyleState -- ^ The field into the theme
-> Style -- ^ The collected style.
:: WidgetEnv s e -- ^ The widget environment (to get the theme).
-> Lens' ThemeState StyleState -- ^ The field into the theme.
-> Style -- ^ The collected style.
collectTheme wenv fieldT = style where
basic = Just $ wenv ^. L.theme . L.basic . fieldT
hover = Just $ wenv ^. L.theme . L.hover . fieldT
Expand Down
2 changes: 1 addition & 1 deletion src/Monomer/Widgets/Util/Widget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ nodeMatches oldNode newNode = infoMatches oldInfo newInfo where
newInfo = newNode ^. L.info

{-|
Checks if the path the node in the provided result changed compared to the old
Checks if the path of the node in the provided result changed from the old
node. In case it did, it appends a SetWidgetPath request to keep track of the
new location.
-}
Expand Down

0 comments on commit d0241b2

Please sign in to comment.