{-# LANGUAGE DeriveFunctor #-}
module Text.Blaze.Front.Event
( -- * Event handling
mapActions
-- ** Keyboard events
, onKeyDown
, onKeyUp
, onKeyPress
-- ** Focus events
, onFocus
, onBlur
-- ** Form events
, onValueChange
, onCheckedChange
, onSelectedChange
, onSubmit
-- ** Mouse events
, onClick
, onDoubleClick
, onMouseDown
, onMouseUp
, onMouseMove
, onMouseEnter
, onMouseLeave
, onMouseOver
, onMouseOut
-- ** UI Events
, onScroll
-- ** Wheel Events
, onWheel
) where
import Text.Blaze.Front.Internal (MarkupM(..), Attribute(..), Markup)
import Prelude
import Bridge
-- | Modify all event handlers attached to a 'Markup' tree so that the given
-- function is applied to the return values of their callbacks.
mapActions :: (act -> act') -> Markup act -> Markup act'
mapActions = MapActions
-- Keyboard events
-------------------------------------------------------------------------------
-- | The user has pressed a physical key while the target element was focused.
onKeyDown :: act -> Attribute act
onKeyDown = onEvent . OnKeyDown
-- | The user has released a phyiscal key while the target element was focused.
onKeyUp :: act -> Attribute act
onKeyUp = onEvent . OnKeyUp
-- | The user has input some ASCII character while the target element was
onKeyPress :: act -> Attribute act
onKeyPress = onEvent . OnKeyPress
-- Focus events
-------------------------------------------------------------------------------
-- | The focus has moved to the target element.
onFocus :: act -> Attribute act
onFocus = onEvent . OnFocus
-- | The focus has left the target element.
onBlur :: act -> Attribute act
onBlur = onEvent . OnBlur
-- Form events
-------------------------------------------------------------------------------
-- | The 'value' property of the target element has changed. The new value is
-- passed as a parameter to the callback. This handler is supported for
-- ,