Module

Freedom.UI

Package
purescript-freedom
Repository
purescript-freedom/purescript-freedom

#Subscription Source

type Subscription state = Query state -> Effect Unit

The type of subscription.

Hooks of events that aren't related a specific node like window events, timers and so on.

#Renderer Source

type Renderer state = { getLatestRenderedChildren :: Effect (Array (VNode state)), renderChildren :: Node -> Array (VNode state) -> Effect Unit }

The type of rendering operations.

  • getLatestRenderedChildren: Get children already rendered.
  • renderChildren: Patch passed children with previous rendered children.

#Operation Source

type Operation state = { query :: Query state, renderer :: Renderer state }

The type of operations.

  • query: Operations for application state.
  • renderer: Operations for rendering.

#VObject Source

type VObject state = { children :: Array (VNode state), didCreate :: Element -> Operation state -> Effect Unit, didDelete :: Element -> Operation state -> Effect Unit, didUpdate :: Element -> Operation state -> Effect Unit, fingerprint :: String, handlers :: Object (Event -> Operation state -> Effect Unit), props :: Object String, tagName :: String }

The representation of a specified tag element.

#VNode Source

data VNode state

The type of virtual node.

Instances

#key Source

key :: forall state. String -> VNode state -> VNode state

Add a key to VNode.

#renderingManually Source

renderingManually :: forall state. VNode state -> VNode state

If you want to render children manually, you should use this.

#t Source

t :: forall state. String -> VNode state

Create a VNode of text.

#tag Source

tag :: forall state. String -> VNode state

Create a VNode of specified tag element.

#kids Source

kids :: forall state. Array (VNode state) -> VNode state -> VNode state

Add children.

#prop Source

prop :: forall state. String -> String -> VNode state -> VNode state

Add a property.

#handle Source

handle :: forall state. String -> (Event -> Operation state -> Effect Unit) -> VNode state -> VNode state

Bind an event handler.

#didCreate Source

didCreate :: forall state. (Element -> Operation state -> Effect Unit) -> VNode state -> VNode state

Bind didCreate lifecycle.

#didUpdate Source

didUpdate :: forall state. (Element -> Operation state -> Effect Unit) -> VNode state -> VNode state

Bind didUpdate lifecycle.

#didDelete Source

didDelete :: forall state. (Element -> Operation state -> Effect Unit) -> VNode state -> VNode state

Bind didDelete lifecycle.

#fingerprint Source

fingerprint :: forall state. String -> VNode state -> VNode state

Fingerprint to check equality of elements.

If it is same as previous rendered element's one, renderer skips rendering.

#modifyVObject Source

modifyVObject :: forall state. (VObject state -> VObject state) -> VNode state -> VNode state

The low level API for modifying a VNode of specified tag element.

#UI Source

newtype UI state

This is for internal. Do not use it.

#createUI Source

createUI :: forall state. String -> (state -> VNode state) -> Query state -> Styler -> Effect (UI state)

This is for internal. Do not use it.

#renderUI Source

renderUI :: forall state. UI state -> Effect Unit

This is for internal. Do not use it.