Build custom elements with Elm. A component's Input record defines its
attributes, and its Output type defines its events.
Define a component. init receives the initial input. receive gets the
complete input after an attribute changes; return Nothing to ignore the
change. Keep any input needed by view in the component's state.
The list returned by update contains events for the host. Return [] when
there are none.
component =
Component.define
{ init = init
, receive = Just << Received
, update = update
, view = view
, subscriptions = always Sub.none
}The build tool uses these. Component authors do not call them directly.
Used by generated code to send an event to the host. Component authors
emit their Output values instead.
Connect a component to generated ports and codecs. The build tool calls
this from a generated Elm entry point; component modules use define.
An element keeps its state when it leaves the page and returns. Its subscriptions pause while it is detached.
A custom element definition. Create one with
define.