novdom/parameter/modifier

Add Parameter to a Component when a specific State Event occurs.

Use this in combinations with novdom/state/component or novdom/state/list.

If the same Modifier is used multible times on the same Component the last one will be used.

Types

Options for the onreplacement and onchildren_replacement modifier. This determines when the render function of the new component is called.

pub type RenderCall {
  OnEnd
  OnStart
}

Constructors

  • OnEnd

    Render starts after the remove transition of the old component ends (so the old component is already removed).

  • OnStart

    Render starts as soon as the remove transition of the old component starts (so both components are visible together).

Functions

pub fn onchildren_replace(parameter: Parameter) -> Parameter

Add a modifier that fires when the children of the component are replaced. This can only be used on the novdom/state/list.map(..) component and will only fire when the full list is replaced (novdom/state/list.overwrite(..)is called).

Attention: The given parameter will apply directly on the children.

pub fn onchildren_replacement(
  parameter: Parameter,
  render_call: RenderCall,
) -> Parameter

Add a modifier that fires when the children of the component are getting replaced. This can only be used on the novdom/state/list.map(..) component and will only fire when the full list is replaced (novdom/state/list.update(..)is called).

Attention: The given parameter will apply directly on children if OnStart is used or apply on the parent if OnEnd is used (For tailwind use [&>*>*]: to apply on children anyway).
This will be fixed as soons as possible.

pub fn oninsert(parameter: Parameter) -> Parameter

Add a modifier that fires when the component is inserted to a list. See novdom/state/list.insert(..) for more information.

This will also fire when the component is initially rendered and no onrender modifier is present.
If oninsert and onreplace are both present, the first modifier added will determine the the onrender behavior.

pub fn onremove(parameter: Parameter) -> Parameter

Add a modifier that fires when the component is removed from a list. See novdom/state/list.remove(..) or novdom/state/component.if(..) for more information.

pub fn onrender(parameter: Parameter) -> Parameter

Add a modifier that fires when the component is initially rendered.

pub fn onreplace(parameter: Parameter) -> Parameter

Add a modifier that fires when the component replaces another component. See novdom/state/list.replace(..), novdom/state/component.ternary(..), or novdom/state/component.utilize(..) for more information.

This will also fire when the component is initially rendered and no onrender modifier is present.
If oninsert and onreplace are both present, the first modifier added will determine the the onrender behavior.

Furthermore, this will also fire when used as a list item, no onchildren_replace is present and the list is replaced. See onchildren_replacement(..) or onchildren_replace(..) for more information.

pub fn onreplace_insert() -> Parameter

Add a modifier that fires the used oninsert modifier when the component replaces another component.

Attention: When in use an ‘oninsert’ modifier needs to be applied on the same component. Otherwise this can lead to unexpected behaviors

pub fn onreplacement(
  parameter: Parameter,
  render_call: RenderCall,
) -> Parameter

Add a modifier that fires when the component is replaced by another component. See novdom/state/list.replace(..), novdom/state/component.ternary(..), or novdom/state/component.utilize(..) for more information.

The render_call determines when the render function of the new component is called.

This will also fire when the component is removed and no onremove modifier is present.

pub fn translate_onchildren_change(
  transition transition: Parameter,
) -> Parameter

Translates the children if they change in some way (e.g. if some are inserted, moved or deleted). This can only be used on the novdom/state/list.map(..) component.

Pass an Attribute that applies a transition that is used.

Search Document