-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell React bindings -- -- This package provides high level bindings to Facebook's React -- library, meant for use with Haste. -- -- React is a JavaScript library for building user interfaces. React (and -- React-Haskell) is focused on just UI - it's not a framework. -- -- Currently React-Haskell can render simple stateful components, but not -- what React calls classes. Put another way, React-Haskell doesn't -- support lifecycle methods yet. -- -- Here's a simple example which demonstrates basic elements, attributes, -- state, and handling events. -- --
--   -- We're creating a class with JSString state
--   data Example
--   instance ReactKey Example where
--       type ClassState Example = JSString
--       type AnimationState Example = ()
--       type Signal Example = JSString
--   
--   -- updating to the new state without animation
--   transition :: JSString -> JSString -> (JSString, [AnimConfig Example])
--   transition oldState signal = (signal, [])
--   
--   view :: JSString -> React Example ()
--   view str = div_ [ class_ "container" ] $ do
--       input_ [ value_ str, onChange (Just . targetValue) ]
--   
--   main :: IO ()
--   main = withElem "id" $ \elem ->
--       render elem =<< createClass view transition "" () []
--   
@package react-haskell @version 1.3.0.0 module React -- | 24-bit colors which can be interpolated. data Color Color :: Int -> Int -> Int -> Color getAnimationState :: Monad m => ReactT ty m (AnimationState ty) -- | Properties that can animate. -- -- Numeric values like width and height, as well as -- colors. class Animatable a interpolate :: Animatable a => Easing -> a -> a -> Double -> a animAdd :: Animatable a => a -> a -> a animSub :: Animatable a => a -> a -> a animZero :: Animatable a => a -- | A ReactClass is a standalone component of a user interface -- which contains the state necessary to render and animate itself. -- Classes are a tool for scoping. -- -- Use createClass to construct. data ReactClass ty -- | ReactClass smart contstructor. createClass :: (ClassState ty -> React ty ()) -> (ClassState ty -> Signal ty -> (ClassState ty, [AnimConfig ty])) -> ClassState ty -> AnimationState ty -> [Signal ty] -> IO (ReactClass ty) locally :: Monad m => Narrowing general local -> ReactT local m x -> ReactT general m x data Narrowing general local Narrowing :: (AnimationState general -> AnimationState local) -> (Signal local -> Signal general) -> Narrowing general local localizeAnimationState :: Narrowing general local -> AnimationState general -> AnimationState local generalizeSignal :: Narrowing general local -> Signal local -> Signal general cancelRender :: RenderHandle -> IO () render :: Elem -> ReactClass ty -> IO RenderHandle newtype ReactT ty m a ReactT :: (AnimationState ty -> m ([ReactNode (Signal ty)], a)) -> ReactT ty m a runReactT :: ReactT ty m a -> AnimationState ty -> m ([ReactNode (Signal ty)], a) type React ty = ReactT ty Identity -- | A ReactKey is a type, which conventionally has no constructors, -- mapping to the type of state, animation state, and signals associated -- with a page fragment or class. -- -- Example: -- --
--   data Slider -- note the key has no constructors
--   data SliderState = Open | Closed
--   data SliderSignal = SlideOpen | SlideClosed
--   
--   instance ReactKey Slider where
--       type ClassState Slider = SliderState
--       type AnimationState Slider = Double
--       type Signal Slider = SliderSignal
--   
--   -- this page fragment has access to the animation state Double and can
--   -- emit SliderSignals.
--   pageFragment :: React Slider ()
--   pageFragment = div_ ...
--   
--   -- this class stores the class state and animation state. its internals
--   -- can emit SliderSignals.
--   sliderClass :: ReactClass Slider ()
--   sliderClass = ...
--   
class ReactKey ty where type family ClassState ty :: * type family AnimationState ty :: * type family Signal ty :: * newtype RenderHandle RenderHandle :: Int -> RenderHandle data AnimConfig ty AnimConfig :: Double -> (a, a) -> Traversal' (AnimationState ty) a -> Easing -> (Bool -> Maybe (Signal ty)) -> AnimConfig ty -- | How long this animation lasts in milliseconds duration :: AnimConfig ty -> Double -- | Where does this animation start and end? endpoints :: AnimConfig ty -> (a, a) -- | Pointer to this field within AnimationState lens :: AnimConfig ty -> Traversal' (AnimationState ty) a -- | How is the animation eased? easing :: AnimConfig ty -> Easing -- | Do something when it's finished? onComplete :: AnimConfig ty -> Bool -> Maybe (Signal ty) -- | Standard easing functions. These are used to interpolate -- smoothly. -- -- See here for visualizations. data Easing Linear :: Easing EaseInQuad :: Easing EaseOutQuad :: Easing EaseInOutQuad :: Easing EaseInCubic :: Easing EaseOutCubic :: Easing EaseInOutCubic :: Easing EaseInQuart :: Easing EaseOutQuart :: Easing EaseInOutQuart :: Easing EaseInQuint :: Easing EaseOutQuint :: Easing EaseInOutQuint :: Easing EaseInElastic :: Easing EaseOutElastic :: Easing EaseInOutElastic :: Easing EaseInBounce :: Easing EaseOutBounce :: Easing EaseInOutBounce :: Easing EaseBezier :: Double -> Double -> Double -> Double -> Easing EaseInSine :: Easing EaseOutSine :: Easing -- | Low level properties common to all events data EventProperties e EventProperties :: !Bool -> !Bool -> !e -> !Bool -> !Int -> !Bool -> !e -> !JSString -> EventProperties e bubbles :: EventProperties e -> !Bool cancelable :: EventProperties e -> !Bool currentTarget :: EventProperties e -> !e defaultPrevented :: EventProperties e -> !Bool eventPhase :: EventProperties e -> !Int isTrusted :: EventProperties e -> !Bool evtTarget :: EventProperties e -> !e eventType :: EventProperties e -> !JSString data ModifierKeys ModifierKeys :: !Bool -> !Bool -> !Bool -> !Bool -> ModifierKeys altKey :: ModifierKeys -> !Bool ctrlKey :: ModifierKeys -> !Bool metaKey :: ModifierKeys -> !Bool shiftKey :: ModifierKeys -> !Bool data MouseEvent MouseEvent :: !ModifierKeys -> !Int -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> MouseEvent mouseModifierKeys :: MouseEvent -> !ModifierKeys buttonNum :: MouseEvent -> !Int clientX :: MouseEvent -> !Double clientY :: MouseEvent -> !Double pageX :: MouseEvent -> !Double pageY :: MouseEvent -> !Double screenX :: MouseEvent -> !Double screenY :: MouseEvent -> !Double data KeyboardEvent KeyboardEvent :: !ModifierKeys -> !Int -> !JSString -> !Int -> !JSString -> !Int -> !Bool -> !Int -> KeyboardEvent keyboardModifierKeys :: KeyboardEvent -> !ModifierKeys charCode :: KeyboardEvent -> !Int key :: KeyboardEvent -> !JSString keyCode :: KeyboardEvent -> !Int locale :: KeyboardEvent -> !JSString location :: KeyboardEvent -> !Int repeat :: KeyboardEvent -> !Bool which :: KeyboardEvent -> !Int newtype ChangeEvent ChangeEvent :: JSString -> ChangeEvent targetValue :: ChangeEvent -> JSString data FocusEvent e FocusEvent :: !e -> !e -> FocusEvent e domEventTarget :: FocusEvent e -> !e relatedTarget :: FocusEvent e -> !e