Drafter.Widget.Trait.Pipeline (drafter v0.3.1)

Copy Markdown View Source

Runs the trait event pipeline for a widget.

Events pass through each trait in declaration order. Each trait can pass, handle, or consume the event. After traits process, the event reaches the widget's own handler (unless consumed).

Summary

Functions

apply_post_render(trait_modules, strips, state, rect)

@spec apply_post_render([module()], [term()], map(), map()) :: [term()]

apply_pre_render(trait_modules, state, rect)

@spec apply_pre_render([module()], map(), map()) :: {map(), map()}

extract_trait_state(widget_state, trait_mod)

@spec extract_trait_state(map(), module()) :: map()

merge_trait_state(widget_state, trait_mod, trait_state)

@spec merge_trait_state(map(), module(), map()) :: map()

run(widget_module, trait_modules, event, state, handles, focusable)

@spec run(module(), [module()], term(), map(), [atom()], boolean()) ::
  {:ok, map()} | {:ok, map(), list()} | {:bubble, map()} | {:noreply, map()}

run_traits(trait_modules, event, state)

@spec run_traits([module()], term(), map()) :: {map(), boolean()}