class Tessell::A11y::Builder

Defined in:

tessell/a11y/tree.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(focus : Input::FocusManager | Nil = nil) #

[View source]

Instance Method Detail

def build(root : Tessell::Node, sink : Array(A11y::Node)) : Nil #

DFS 先序遍历 retained 树,向复用 sink 追加 A11y::Node。 调用方/内部约定:每次 build 前先 clear sink(本方法内部也 clear,保证复用)。


[View source]
def build(root : Nil, sink : Array(A11y::Node)) : Nil #

J1: 空树 → sink 空


[View source]
def focused?(node : Tessell::Node) : Bool #

焦点实时查询:与 build 内 focused 同源,供 UI.a11y_emit 复用。


[View source]
def meta_for(id : UInt64) : Meta | Nil #

[View source]
def remove_meta(id : UInt64) : Bool #

删除指定节点的旁挂元数据,返回是否存在并已删除。 UI.apply 在节点被移除时必须调用,避免 id 复用(object_id)残留旧语义。


[View source]
def set_meta(id : UInt64, role : Role = Role::Group, name : String = "", value : String = "", focusable : Bool = false, enabled : Bool = true, children_count : Int32 | Nil = nil, scroll_offset : Int32 = 0, row : Int32 | Nil = nil, col : Int32 | Nil = nil, row_count : Int32 | Nil = nil, col_count : Int32 | Nil = nil, row_index_text : String | Nil = nil, col_index_text : String | Nil = nil, selected : Bool | Nil = nil, active : Bool | Nil = nil, first_visible_index : Int32 | Nil = nil) : Nil #

[View source]