Panda.Internal.Types
- Package
- purescript-panda
- Repository
- i-am-tom/purescript-panda
#ArrayUpdate Source
data ArrayUpdate valueAn 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 eventComponents are updated using the array algebra, but specialised to component values.
Constructors
ComponentUpdate (ArrayUpdate (Component eff update state event))
#PropertyUpdate Source
newtype PropertyUpdateProperties are updated using the map algebra specialised to strings.
Constructors
#Producer Source
data ProducerAll the possible event producers.
Constructors
OnAbortOnBlurOnChangeOnContextMenuOnClickOnDoubleClickOnDragOnDragEndOnDragEnterOnDragExitOnDragLeaveOnDragOverOnDragStartOnDropOnErrorOnFocusOnFocusInOnFocusOutOnInputOnInvalidOnKeyDownOnKeyPressOnKeyUpOnLoadOnMouseDownOnMouseEnterOnMouseLeaveOnMouseMoveOnMouseOverOnMouseOutOnMouseUpOnResetOnScrollOnSelectOnSubmitOnTransitionEnd
#Property Source
data Property update state eventProperties 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
PropertyStatic { key :: String, value :: String }PropertyWatcher ({ state :: state, update :: update } -> (Array PropertyUpdate))PropertyProducer { key :: Producer, onEvent :: Event -> Maybe event }
#Children Source
data Children eff update state eventChildren on elements can either be static (not looking for events), or dynamic. Note that the children of static children can be dynamic!
Constructors
StaticChildren (Array (Component eff update state event))DynamicChildren ({ state :: state, update :: update } -> (Array (ComponentUpdate eff update state event)))
#Component Source
data Component eff update state eventA component is either a delegate (embedded sub-application), element (with properties and children and an HTML representation), or just some text.
Constructors
ComponentDelegate (ComponentDelegateX eff update state event)ComponentElement { children :: Children eff update state event, properties :: Array (Property update state event), tagName :: String }CText String
#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.
#mkComponentDelegateX Source
mkComponentDelegateX :: forall subevent substate subupdate event state update eff. ComponentDelegate eff update state event subupdate substate subevent -> ComponentDelegateX eff update state eventMake 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 -> resultRetrieve 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 eventAn 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
EventSystem { cancel :: Eff eff Unit, events :: Event event, handleUpdate :: { state :: state, update :: update } -> Eff eff Unit }
Instances
Semigroup (EventSystem eff update state event)Monoid (EventSystem eff update state event)
#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.