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, viewdom.VDOMNode]]) –

Return type

None

viewdom.encode_prop(k, v)

If possible, reduce an attribute to just the name.

viewdom.flatten(value)

Reduce a sequence.

viewdom.htm(func=None, *, cache_maxsize=128)

The callable function to act as decorator.

Return type

Callable[[str], Union[Sequence[viewdom.VDOMNode], viewdom.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[hopscotch.registry.Registry]) –

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

Return type

Union[Sequence[viewdom.VDOMNode], viewdom.VDOMNode]

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

Render a VDOM to a string.

Parameters
Return type

str

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

Render as a generator.

Parameters

registry (Optional[hopscotch.registry.Registry]) –

viewdom.use_context(key, default=None)

Similar to the React use context API.