Reference

ViewDOM only has a few public symbols to be used by other packages. Here’s the API.

ViewDOM.

viewdom.Context(children=None, **kwargs)

Like the React Conext API.

class viewdom.VDOMNode(tag, props, children)

Implementation of a node with three slots.

Parameters:
  • tag (str) –

  • props (Mapping) –

  • children (List[Union[str, VDOMNode]]) –

viewdom.encode_prop(k, v)

If possible, reduce an attribute to just the name.

viewdom.flatten(value)

Reduce a sequence.

viewdom.htm(cache_maxsize=128)

The callable function to act as decorator.

Return type:

Callable[[str], Union[Sequence[VDOMNode], VDOMNode]]

viewdom.relaxed_call(callable_, registry=None, children=None, props=None)

Get the correct implementation and call it to produce a vdom.

Parameters:
  • registry (Optional[Registry]) –

  • props (Optional[dict[str, Any]]) –

Return type:

Union[Sequence[VDOMNode], VDOMNode]

viewdom.render(value, registry=None, **kwargs)

Render a VDOM to a string.

Parameters:
  • value (Union[Sequence[VDOMNode], VDOMNode]) –

  • registry (Optional[Registry]) –

Return type:

str

viewdom.render_gen(value, registry=None, children=None)

Render as a generator.

Parameters:

registry (Optional[Registry]) –

viewdom.use_context(key, default=None)

Similar to the React use context API.