module React.Elements
(
classParent
, classLeaf
, exportClassLeaf
, importLeafClass
, importParentClass
, ExportedNode
, ExportedClass
) where
import Control.Applicative
import Data.Aeson as Aeson
import qualified Data.HashMap.Strict as H
import Data.IORef
import Data.Monoid
import Data.String
import Data.Void
import System.IO.Unsafe
import React.Class
import React.GHCJS
import React.Imports
import React.Interpret
import React.Registry
import React.Types
classParent' :: ReactClass props state insig exsig ctx
-> ReactNode insig
-> props
-> ReactNode exsig
classParent' cls children props = ComponentElement
(ReactComponentElement cls children Nothing Nothing props)
classLeaf' :: ReactClass props state insig exsig ctx
-> props
-> ReactNode exsig
classLeaf' cls props = ComponentElement
(ReactComponentElement cls mempty Nothing Nothing props)
classParent :: ClassCtx ctx
=> ClassConfig props state insig exsig ctx
-> ReactNode insig
-> props
-> ReactNode exsig
classParent = classParent' . createClass
classLeaf :: ClassCtx ctx
=> ClassConfig props state insig exsig ctx
-> props
-> ReactNode exsig
classLeaf = classLeaf' . createClass
data ExportedClass_
type ExportedClass = JSRef ExportedClass_
newtype ExportedNode sig = ExportedNode (IO JSAny)
instance ToJSRef (ExportedNode sig) where
toJSRef (ExportedNode n) = castRef <$> n
exportClassLeaf :: ClassCtx ctx
=> ClassConfig props state insig exsig ctx
-> ExportedClass
exportClassLeaf conf =
castRef $ classForeign $ createClass conf
importLeafClass :: ToJSRef props
=> ImportedClass props sig
-> props
-> ReactNode sig
importLeafClass elem props = ForeignClass elem props mempty
importParentClass :: ToJSRef props
=> ImportedClass props sig
-> props
-> ReactNode sig
-> ReactNode sig
importParentClass elem props children = ForeignClass elem props children