Module vnode_ffi

Module vnode_ffi 

Source
Expand description

VNode FFI - Functions for constructing VNodes from Windjammer code

This module provides a stable FFI interface that Windjammer components can use to construct VNodes. This enables cross-platform UI rendering:

  • Web: VNode → HTML (via simple_renderer)
  • Desktop: VNode → egui (via desktop_renderer)

The design uses opaque handles (u64) to reference VNodes stored in a thread-local registry. This avoids complex memory management across the FFI boundary.

Functions§

vnode_attr
Add a static attribute to a VNode
vnode_button
Create a button element
vnode_child
Add a child VNode to a parent VNode The child is consumed (moved from registry to parent’s children)
vnode_class
Add a class to a VNode (convenience for class attribute)
vnode_clear
Clear all VNodes from the registry (for cleanup between renders)
vnode_div
Create a div element with optional class and style
vnode_element
Create a new element VNode with a tag name Returns a handle to the VNode
vnode_get
Get a reference to a VNode (without removing it)
vnode_span
Create a span element with text content
vnode_style
Add inline style to a VNode
vnode_take
Get the VNode for a handle and remove it from the registry This is called when the VNode tree is complete and ready to render
vnode_text
Create a text VNode Returns a handle to the VNode