Shpadoinkle-html-0.3.0.0: A typed, template generated Html DSL, and helpers.

Safe HaskellNone
LanguageHaskell2010

Shpadoinkle.Html

Description

This module re-exports the complete HTML DSL,

Synopsis

Documentation

newtype Debounce m a b Source #

Constructors

Debounce 

Fields

data Throttle m a b Source #

runThrottle :: Throttle m a b -> (a -> (Text, Prop m b)) -> a -> (Text, Prop m b) Source #

injectProps :: [(Text, Prop m a)] -> Html m a -> Html m a Source #

Inject props into an existing Node.

mapProps :: ([(Text, Prop m a)] -> [(Text, Prop m a)]) -> Html m a -> Html m a Source #

Transform the properties of some Node. This has no effect on TextNodes or Potatoes.

listen :: Text -> (a -> a) -> (Text, Prop m a) Source #

Construct a listener from its Text name and an output value.

listenC :: Text -> Continuation m a -> (Text, Prop m a) Source #

Construct a listener from its name and an event handler.

listenRaw :: Text -> (RawNode -> RawEvent -> JSM (Continuation m a)) -> (Text, Prop m a) Source #

Construct a listener from its name and an event handler.

listener :: Continuation m a -> Prop m a Source #

Construct a simple listener property that will perform an action.

text :: Text -> Html m a Source #

Construct a text node.

baked :: JSM (RawNode, STM (Continuation m a)) -> Html m a Source #

Construct a Potato from a JSM action producing a RawNode.

listenerProp :: (RawNode -> RawEvent -> JSM (Continuation m a)) -> Prop m a Source #

Create an event listener property.

dataProp :: JSVal -> Prop m a Source #

Create a data property.

data Html (m :: Type -> Type) a Source #

This is the core type in Backend. Please note, this is NOT the Virtual DOM used by Backend. This type backs a DSL that is then interpreted into Virtual DOM by the Backend of your choosing. HTML comments are not supported. This is Church encoded for performance reasons.

Instances
Continuous Html

Given a lens, you can change the type of an Html by using the lens to convert the types of the Continuations inside it.

Instance details

Defined in Shpadoinkle.Core

Methods

mapC :: (Continuation m a -> Continuation m b) -> Html m a -> Html m b Source #

Applicative m => Functor EndoIso EndoIso (Html m :: Type -> Type)

Html m is a functor in the EndoIso category, where the objects are types and the morphisms are EndoIsos.

Instance details

Defined in Shpadoinkle.Core

Methods

map :: EndoIso a b -> EndoIso (Html m a) (Html m b) Source #

IsString (Html m a)

Strings are overloaded as HTML text nodes: "hiya" = TextNode "hiya"

Instance details

Defined in Shpadoinkle.Core

Methods

fromString :: String -> Html m a Source #

data Prop (a :: Type -> Type) b Source #

Properties of a DOM node. Backend does not use attributes directly, but rather is focused on the more capable properties that may be set on a DOM node in JavaScript. If you wish to add attributes, you may do so by setting its corresponding property.

Instances
Continuous Prop

Given a lens, you can change the type of a Prop by using the lens to convert the types of the Continuations which it contains if it is a listener.

Instance details

Defined in Shpadoinkle.Core

Methods

mapC :: (Continuation m a -> Continuation m b) -> Prop m a -> Prop m b Source #

IsString [(Text, Prop m a)]

Strings are overloaded as the class property: "active" = ("className", PText "active")

Instance details

Defined in Shpadoinkle.Core

Methods

fromString :: String -> [(Text, Prop m a)] Source #

Applicative m => Functor EndoIso EndoIso (Prop m :: Type -> Type)

Prop is a functor in the EndoIso category, where the objects are types and the morphisms are EndoIsos.

Instance details

Defined in Shpadoinkle.Core

Methods

map :: EndoIso a b -> EndoIso (Prop m a) (Prop m b) Source #

Eq (Prop m a) 
Instance details

Defined in Shpadoinkle.Core

Methods

(==) :: Prop m a -> Prop m a -> Bool Source #

(/=) :: Prop m a -> Prop m a -> Bool Source #

IsString (Prop m a)

Strings are overloaded as text props: ("id", "foo") = ("id", PText "foo")

Instance details

Defined in Shpadoinkle.Core

Methods

fromString :: String -> Prop m a Source #