PhiaUiDesign.Canvas.Scene (phia_ui v0.1.17)

Copy Markdown View Source

ETS-backed scene graph for the design canvas.

Each scene is an ETS table containing Node structs keyed by their ID. A special :root entry tracks the top-level node IDs.

Summary

Functions

Get all nodes as a flat list

Get all unique component names used in the scene

Count total nodes in the scene

Delete a node from the scene

Destroy the scene (delete ETS table)

Find nodes matching a predicate function

Get a node by ID

Get root-level children IDs

Get all JS hooks needed by components in the scene

Insert a node into the scene

Insert a PhiaUI component into the scene

Insert an HTML element into the scene

Move a node to a new parent at a given index

Create a new empty scene

Build the scene as a tree structure (nested maps)

Update a node's component attrs

Update a node's attributes

Types

scene_id()

@type scene_id() :: reference()

Functions

all_nodes(scene)

Get all nodes as a flat list

components_used(scene)

Get all unique component names used in the scene

count(scene)

Count total nodes in the scene

delete_node(scene, node_id)

Delete a node from the scene

destroy(scene)

Destroy the scene (delete ETS table)

find_nodes(scene, predicate)

Find nodes matching a predicate function

get_node(scene, node_id)

Get a node by ID

get_root_children(scene)

Get root-level children IDs

hooks_needed(scene)

Get all JS hooks needed by components in the scene

insert(scene, node)

Insert a node into the scene

insert_component(scene, component_name, opts \\ [])

Insert a PhiaUI component into the scene

insert_element(scene, tag, opts \\ [])

Insert an HTML element into the scene

move_node(scene, node_id, new_parent_id, index \\ -1)

Move a node to a new parent at a given index

new()

Create a new empty scene

to_tree(scene)

Build the scene as a tree structure (nested maps)

update_attrs(scene, node_id, attr_changes)

Update a node's component attrs

update_node(scene, node_id, changes)

Update a node's attributes