miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Html.Types

Description

Construct custom properties on DOM elements

div_ [ prop "id" "foo" ] [ ]
Synopsis

Types

newtype VTree Source #

Virtual DOM implemented as a JavaScript Object. Used for diffing, patching and event delegation. Not meant to be constructed directly, see View instead.

Constructors

VTree 

Fields

data View action Source #

Core type for constructing a virtual DOM in Haskell

Instances

Instances details
Functor View Source # 
Instance details

Defined in Miso.Types

Methods

fmap :: (a -> b) -> View a -> View b #

(<$) :: a -> View b -> View a #

HasRouter (View a :: Type) Source #

View

Instance details

Defined in Miso.Router

Methods

mkRouter :: Proxy (View a) -> Proxy a0 -> RouteT (View a) a0 -> Router a0 Source #

HasLink (View a :: Type) Source #

For constructing type-safe links

Instance details

Defined in Miso.Types

Methods

toLink :: (Link -> a0) -> Proxy (View a) -> Link -> MkLink (View a) a0 Source #

IsString (View a) Source #

IsString instance

Instance details

Defined in Miso.Types

Methods

fromString :: String -> View a #

ToHtml (View a) Source #

Render a View to a L.ByteString

Instance details

Defined in Miso.Render

Methods

toHtml :: View a -> ByteString Source #

ToHtml [View a] Source #

Render a [View] to a L.ByteString

Instance details

Defined in Miso.Render

Methods

toHtml :: [View a] -> ByteString Source #

ToView (View action) Source # 
Instance details

Defined in Miso.Types

Associated Types

type ToViewAction (View action) 
Instance details

Defined in Miso.Types

type ToViewAction (View action) = action

Methods

toView :: View action -> View (ToViewAction (View action)) Source #

type RouteT (View a :: Type) x Source # 
Instance details

Defined in Miso.Router

type RouteT (View a :: Type) x = x
type MkLink (View a :: Type) b Source # 
Instance details

Defined in Miso.Types

type MkLink (View a :: Type) b = b
type ToViewAction (View action) Source # 
Instance details

Defined in Miso.Types

type ToViewAction (View action) = action

data Attribute action Source #

Attribute of a vnode in a View.

The Sink callback can be used to dispatch actions which are fed back to the update function. This is especially useful for event handlers like the onclick attribute. The second argument represents the vnode the attribute is attached to.

Instances

Instances details
Functor Attribute Source # 
Instance details

Defined in Miso.Types

Methods

fmap :: (a -> b) -> Attribute a -> Attribute b #

(<$) :: a -> Attribute b -> Attribute a #

newtype Key Source #

A unique key for a dom node.

This key is only used to speed up diffing the children of a DOM node, the actual content is not important. The keys of the children of a given DOM node must be unique. Failure to satisfy this invariant gives undefined behavior at runtime.

Constructors

Key MisoString 

Instances

Instances details
ToJSON Key Source # 
Instance details

Defined in Miso.Types

IsString Key Source # 
Instance details

Defined in Miso.Types

Methods

fromString :: String -> Key #

Show Key Source # 
Instance details

Defined in Miso.Types

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

Eq Key Source # 
Instance details

Defined in Miso.Types

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

ToJSVal Key Source #

ToJSVal instance for Key

Instance details

Defined in Miso.Types

ToKey Key Source #

Identity instance

Instance details

Defined in Miso.Types

Methods

toKey :: Key -> Key Source #

data NS Source #

Namespace of DOM elements.

Constructors

HTML

HTML Namespace

SVG

SVG Namespace

MATHML

MATHML Namespace

Instances

Instances details
Show NS Source # 
Instance details

Defined in Miso.Types

Methods

showsPrec :: Int -> NS -> ShowS #

show :: NS -> String #

showList :: [NS] -> ShowS #

Eq NS Source # 
Instance details

Defined in Miso.Types

Methods

(==) :: NS -> NS -> Bool #

(/=) :: NS -> NS -> Bool #

ToJSVal NS Source # 
Instance details

Defined in Miso.Types

Classes

class ToView a where Source #

Convenience class for using View

Associated Types

type ToViewAction a Source #

Methods

toView :: a -> View (ToViewAction a) Source #

Instances

Instances details
ToView (View action) Source # 
Instance details

Defined in Miso.Types

Associated Types

type ToViewAction (View action) 
Instance details

Defined in Miso.Types

type ToViewAction (View action) = action

Methods

toView :: View action -> View (ToViewAction (View action)) Source #

ToView (Component name model action) Source # 
Instance details

Defined in Miso.Types

Associated Types

type ToViewAction (Component name model action) 
Instance details

Defined in Miso.Types

type ToViewAction (Component name model action) = action

Methods

toView :: Component name model action -> View (ToViewAction (Component name model action)) Source #

Combinators

node :: NS -> MisoString -> [Attribute action] -> [View action] -> View action Source #

Create a new Miso.Html.Types.VNode.

node ns tag key attrs children creates a new node with tag tag and Key key in the namespace ns. All attrs are called when the node is created and its children are initialized to children.

text :: MisoString -> View action Source #

Create a new Text with the given content.

textRaw :: MisoString -> View action Source #

TextRaw creation. Don't use directly

rawHtml :: MisoString -> View action Source #

Create a new Miso.Html.Types.TextRaw.

expandable a rawHtml node takes raw HTML and attempts to convert it to a VTree at runtime. This is a way to dynamically populate the virtual DOM from HTML received at runtime. If rawHtml cannot parse the HTML it will not render.