Copyright | (C) 2016-2025 David M. Johnson |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <code@dmj.io> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Miso.Html.Types
Contents
Description
Construct custom properties on DOM elements
div_ [ prop "id" "foo" ] [ ]
Synopsis
- newtype VTree = VTree {}
- data View action
- = VNode NS MisoString [Attribute action] [View action]
- | VText MisoString
- | VTextRaw MisoString
- | VComp MisoString [Attribute action] SomeComponent
- data Attribute action
- = Property MisoString Value
- | Event (Sink action -> Object -> LogLevel -> Events -> JSM ())
- | Styles (Map MisoString MisoString)
- newtype Key = Key MisoString
- data NS
- class ToView a where
- type ToViewAction a
- toView :: a -> View (ToViewAction a)
- node :: NS -> MisoString -> [Attribute action] -> [View action] -> View action
- text :: MisoString -> View action
- textRaw :: MisoString -> View action
- rawHtml :: MisoString -> View action
Types
Core type for constructing a virtual DOM in Haskell
Constructors
VNode NS MisoString [Attribute action] [View action] | |
VText MisoString | |
VTextRaw MisoString | |
VComp MisoString [Attribute action] SomeComponent |
Instances
Functor View Source # | |||||
HasRouter (View a :: Type) Source # | View | ||||
HasLink (View a :: Type) Source # | For constructing type-safe links | ||||
IsString (View a) Source # |
| ||||
Defined in Miso.Types Methods fromString :: String -> View a # | |||||
ToHtml (View a) Source # | Render a | ||||
Defined in Miso.Render Methods toHtml :: View a -> ByteString Source # | |||||
ToHtml [View a] Source # | Render a | ||||
Defined in Miso.Render Methods toHtml :: [View a] -> ByteString Source # | |||||
ToView (View action) Source # | |||||
Defined in Miso.Types Associated Types
| |||||
type RouteT (View a :: Type) x Source # | |||||
Defined in Miso.Router | |||||
type MkLink (View a :: Type) b Source # | |||||
Defined in Miso.Types | |||||
type ToViewAction (View action) Source # | |||||
Defined in Miso.Types |
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.
Constructors
Property MisoString Value | |
Event (Sink action -> Object -> LogLevel -> Events -> JSM ()) | |
Styles (Map MisoString MisoString) |
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 |
Classes
Convenience class for using View
Associated Types
type ToViewAction a Source #
Methods
toView :: a -> View (ToViewAction a) Source #
Instances
ToView (View action) Source # | |||||
Defined in Miso.Types Associated Types
| |||||
ToView (Component name model action) Source # | |||||
Defined in Miso.Types Associated Types
|
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 #