deact library

Classes

ComponentContext
A ComponentContext is the interface for component to the Deact API. It is provied to the component, when it is rendered.
ComponentNode
Super class for class-based components.
Deact
This interface provides an API to the Deact application.
DeactNode
A Deact application consists of a hierarchy of DeactNodes.
Deferred
Deact internally stores a deferred component as a class of this type.
ElementNode
A ElementNode is a DeactNode that represents a DOM element.
FragmentNode
A FragmentNode is a DeactNode with no content except its children.
Functional
Deact internally stores a functional component as a class of this type.
GlobalProvider
A combination of a GlobalStateProvider and a GlobalRefProvider.
GlobalRefProvider
The state of a component that implements this interface is global to all its child components.
GlobalRefProviderComponent<T>
A GlobalRefProvider introduces a Ref in the node hierarchy, that is accessible by every component beneath the provider. The components can read the value of the reference or change the value.
GlobalStateProvider
The state of a component that implements this interface is global to all its child components.
GlobalStateProviderComponent<T>
A GlobalStateProviderComponent introduces a State in the node hierarchy, that is accessible by every component beneath the provider. The components can just read that state or change the state. If the state is changed everything beneath the provider will be rerendered.
Ref<T>
A reference to a value.
RootNode
State<T>
A state for a component or a state provider.
TextNode
A TextNode is a DeactNode that adds a text to the DOM.

Extensions

DeactString on String
Adds the getter txt to the String class.

Functions

deact(String selector, RootNodeProvider root) Deact
The entrypoint to mount a Deact application to the DOM.
deferred(DeactNode builder(), {Object? key}) DeactNode
Normally, the effects of a component node are executed after the created node is rendered. Thus, any global state or reference created in an effect can't be accessed in the child nodes.
el(String name, {Object? key, Ref<Element?>? ref, Map<String, Object>? attributes, Map<String, Object>? listeners, Iterable<DeactNode>? children}) ElementNode
Creates an ElementNode node.
empty() FragmentNode
A FragmentNode with no children nodes. Renders nothing to the DOM. This is an alternative to providing null.
fc(FunctionalComponent builder, {Object? key}) DeactNode
A helper function to implement functional components.
fragment(Iterable<DeactNode> children) FragmentNode
Creates a Fragement node with the given children.
globalRef<T>({Object? key, required String name, T? initialValue, required Iterable<DeactNode> children}) DeactNode
Creates a GlobalRefProvider.
globalState<T>({Object? key, required String name, T? initialValue, required Iterable<DeactNode> children}) DeactNode
Creates a GlobalStateProviderComponent.
txt(String text) TextNode
Creates a TextNode node with the given text.

Typedefs

AfterRender = void Function(Deact)
Cleanup = void Function()
A function to be called to cleanup an effect.
Effect = Cleanup? Function()
An Effect is a function to be called when a compoenent was (re)rendered.
EventListener<E extends Event> = void Function(E event)
A listener for an HTML event.
FunctionalComponent = DeactNode Function(ComponentContext ctx)
A function that creates a component.
InitialValueProvider<T> = T Function()
A function to provide an intial value.
RootNodeProvider = DeactNode Function(Deact)
A function to provide the root node to the deact function.