GPUI.Tree (gpui v0.2.0-rc.1)

Copy Markdown View Source

Renderer-independent queries over GPUI.Element and serialized element trees.

Summary

Functions

Returns every node matching a selector.

Returns the first matching node, or nil.

Returns the first matching node or raises.

Returns the root-to-node path for the first match.

Returns all nodes in depth-first order.

Types

element_node()

@type element_node() :: GPUI.Element.t() | map()

selector()

@type selector() :: keyword()

Functions

all(tree, selector)

@spec all(element_node(), selector()) :: [element_node()]

Returns every node matching a selector.

find(tree, selector)

@spec find(element_node(), selector()) :: element_node() | nil

Returns the first matching node, or nil.

find!(tree, selector)

@spec find!(element_node(), selector()) :: element_node()

Returns the first matching node or raises.

path(tree, selector)

@spec path(element_node(), selector()) :: [element_node()] | nil

Returns the root-to-node path for the first match.

walk(node)

@spec walk(element_node()) :: [element_node()]

Returns all nodes in depth-first order.