Module

Panda.Internal.Types

Package
purescript-panda
Repository
i-am-tom/purescript-panda

#ArrayUpdate Source

data ArrayUpdate value

An algebra for array updates. We use this to describe the ways in which we would like to update the DOM.

Constructors

#ComponentUpdate Source

newtype ComponentUpdate eff update state event

Components are updated using the array algebra, but specialised to component values.

Constructors

#MapUpdate Source

data MapUpdate value

An algebra for map updates.

Constructors

#PropertyUpdate Source

newtype PropertyUpdate

Properties are updated using the map algebra specialised to strings.

Constructors

#FX Source

type FX eff = (dom :: DOM, frp :: FRP, ref :: REF | eff)

The effects that are used within Panda.

#Property Source

data Property update state event

Properties are either static key/value pairs, listeners for DOM updates (that can then change the properties on an element), or producers of events (that then bubble up to the update function).

Constructors

#Children Source

data Children eff update state event

Children on elements can either be static (not looking for events), or dynamic. Note that the children of static children can be dynamic!

Constructors

#Component Source

data Component eff update state event

A component is either a delegate (embedded sub-application), element (with properties and children and an HTML representation), or just some text.

Constructors

#ComponentDelegate Source

type ComponentDelegate eff update state event subupdate substate subevent = { delegate :: Application eff subupdate substate subevent, focus :: { event :: subevent -> Maybe event, state :: state -> substate, update :: update -> Maybe subupdate } }

Component delegates allow us to reuse applications within larger applications, provided that we can wire up the two event systems. Note the possible leak here: in certain cases, we can isolate a sub-application as a black box within a larger application by ignoring all incoming updates and outgoing events.

#ComponentDelegateX Source

data ComponentDelegateX :: Row Effect -> Type -> Type -> Type -> Type

In practice, we don't really care what the types are within a sub-application, as long as we have an appropriate mapping to and from the parent types. So, we can existentialise these inner types.

#mkComponentDelegateX Source

mkComponentDelegateX :: forall subevent substate subupdate event state update eff. ComponentDelegate eff update state event subupdate substate subevent -> ComponentDelegateX eff update state event

Make an existential component delegate.

#runComponentDelegateX Source

runComponentDelegateX :: forall result event state update eff. (forall subevent substate subupdate. ComponentDelegate eff update state event subupdate substate subevent -> result) -> ComponentDelegateX eff update state event -> result

Retrieve a component delegate from an existentialised delegate, using the functions within focus to wire up the two applications.

#EventSystem Source

newtype EventSystem eff update state event

An event system defines the update/event mechanism for a particular component. When we update the DOM, we must remember to cancel outgoing elements, and register new update handlers.

Constructors

Instances

#Updater Source

type Updater eff update state event = ((state -> { state :: state, update :: update }) -> Eff eff Unit) -> { event :: event, state :: state } -> Eff eff Unit

Convenience synonym for defining the type of updaters within a Panda application.

#Application Source

type Application eff update state event = { initial :: { state :: state, update :: update }, subscription :: Event event, update :: Updater eff update state event, view :: Component eff update state event }

A Panda application is a view (written in the component DSL) that is interpreted into an element (to be attached to the DOM), an event stream (that is merged with the subscription) that feeds into the update function, that update function (which produces updates for the view), and intiial state and update.