abstract class
Tessell::Kit::Component
- Tessell::Kit::Component
- Reference
- Object
Direct Known Subclasses
- Tessell::Kit::Barrier
- Tessell::Kit::Button
- Tessell::Kit::Checkbox
- Tessell::Kit::Container
- Tessell::Kit::Dialog
- Tessell::Kit::Image
- Tessell::Kit::Input
- Tessell::Kit::ScrollView
- Tessell::Kit::Select
- Tessell::Kit::SelectPopup
- Tessell::Kit::Spacer
- Tessell::Kit::Text
- Tessell::Kit::Tooltip
- Tessell::Kit::VirtualList
Defined in:
tessell/kit/component.crConstructors
Instance Method Summary
- #a11y_active_cell : Bool | Nil
-
#a11y_children_count : Int32 | Nil
虚拟列表等需要报告逻辑子节点总数的组件覆盖此值。
- #a11y_col : Int32 | Nil
- #a11y_col_count : Int32 | Nil
- #a11y_col_index_text : String | Nil
- #a11y_enabled : Bool
-
#a11y_first_visible_index : Int32 | Nil
可视窗口在逻辑总量中的起点(虚拟化网格用)。
- #a11y_name : String
- #a11y_role : A11y::Role
-
#a11y_row : Int32 | Nil
---- 二维网格语义(issue #31)---- 虚拟化大控件的 a11y 契约:坐标/选区/表头语义经结构化字段声明, 不再把坐标拼进 a11y_value 字符串。全部默认 nil/false——既有组件 零改动;表格类组件按需覆盖。
- #a11y_row_count : Int32 | Nil
-
#a11y_row_index_text : String | Nil
行列表头的朗读文本(如 "A"/"1");nil = 非表头。
- #a11y_scroll_offset : Int32
- #a11y_selected : Bool | Nil
- #a11y_value : String
- #arrange(ctx : Context, bounds : Rect) : Nil
- #attach(child : Component) : Component
- #bounds : Rect
- #bounds=(bounds : Rect)
-
#clip_bounds : Rect | Nil
子组件可返回绝对坐标的裁切矩形;Root 会同步到 Node#clip。
-
#collect_components(sink : Array(Component)) : Nil
Root 用它遍历整棵树建立 Node ↔ Component 映射。 用显式 sink 而不是递归 block:Crystal 对 yield 转发块会内联展开。
-
#dispose : Nil
组件销毁:停掉其响应式作用域(幂等)。Root 在组件移出树时调用; 重新挂回树的组件需重建 watch(与 Node 生命周期同口径)。
- #emit(b : UI::Builder, ctx : Context) : Nil
- #enabled : Bool
- #enabled=(enabled : Bool)
- #focusable? : Bool
- #focused : Bool
- #focused=(focused : Bool)
- #handle(event : Event, ctx : Context) : Bool
- #hit?(point : Point) : Bool
- #key : UI::UiKey
- #mark_structure_dirty : Nil
- #measure(ctx : Context, constraints : Constraints) : Size
- #on_focus_changed(focused : Bool) : Nil
- #paint(p : Painter, ctx : Context) : Nil
-
#paint_token : UInt32
声明里的 paint token:状态变化时改变,UI.apply 只把该节点标 Paint。
- #parent : Component | Nil
- #parent=(value : Component | Nil) : Nil
-
#signal_owner : Tessell::Signal::Owner
懒创建的响应式作用域。首次 watch 时才分配(不用响应式的组件零开销)。
-
#signal_owner? : Tessell::Signal::Owner | Nil
非创建读取(For 行复用把组件 owner 收编到行 owner 时用)。
-
#structure_dirty : Bool
结构变更标记(issue #51):
Container#add/remove等结构修改后沿父链打到 树根,Root#build消费一次并补一次 arrange——运行期增删子组件的宿主不必 再手动root.layout。只向上标记,不扩散到兄弟子树。 -
#structure_dirty=(structure_dirty : Bool)
结构变更标记(issue #51):
Container#add/remove等结构修改后沿父链打到 树根,Root#build消费一次并补一次 arrange——运行期增删子组件的宿主不必 再手动root.layout。只向上标记,不扩散到兄弟子树。 -
#take_structure_dirty : Bool
取走并清空本节点的结构脏标记(Root 消费;只取根节点,子节点残留标记无害)。
- #tick(now_ms : Int64, ctx : Context) : Nil
- #tooltip_delay_ms : Int32
- #tooltip_delay_ms=(tooltip_delay_ms : Int32)
- #tooltip_text : String | Nil
- #tooltip_text=(tooltip_text : String | Nil)
- #visible : Bool
- #visible=(visible : Bool)
-
#wants_tab? : Bool
Tab 键语义(issue #16):默认 false——Tab 由 Root 走焦点环。 内部自带 Tab 导航的组件(表格、代码编辑器、树控件)覆盖为 true, Root 会先把 Tab/Shift+Tab 投递给当前焦点组件,组件返回 true 即消费。 Ctrl/Meta+Tab 恒定保留给焦点环,是键盘用户离开该组件的出口。
-
#watch(&handler : -> Nil) : Tessell::Signal::Effect
在组件作用域注册 effect(Solid 语义:创建即首跑)。handler 更新组件 状态 → 下一帧 Root#build 的 decl diff 自动产出失效(Layout/Paint), 与 #42 重入守卫安全组合(effect 内直接调 root.build 也只延迟为二段 提交)。组件销毁时 effect 自动停止。
Constructor Detail
Instance Method Detail
---- 二维网格语义(issue #31)---- 虚拟化大控件的 a11y 契约:坐标/选区/表头语义经结构化字段声明, 不再把坐标拼进 a11y_value 字符串。全部默认 nil/false——既有组件 零改动;表格类组件按需覆盖。
Root 用它遍历整棵树建立 Node ↔ Component 映射。 用显式 sink 而不是递归 block:Crystal 对 yield 转发块会内联展开。
结构变更标记(issue #51):Container#add/remove 等结构修改后沿父链打到
树根,Root#build 消费一次并补一次 arrange——运行期增删子组件的宿主不必
再手动 root.layout。只向上标记,不扩散到兄弟子树。
结构变更标记(issue #51):Container#add/remove 等结构修改后沿父链打到
树根,Root#build 消费一次并补一次 arrange——运行期增删子组件的宿主不必
再手动 root.layout。只向上标记,不扩散到兄弟子树。
Tab 键语义(issue #16):默认 false——Tab 由 Root 走焦点环。 内部自带 Tab 导航的组件(表格、代码编辑器、树控件)覆盖为 true, Root 会先把 Tab/Shift+Tab 投递给当前焦点组件,组件返回 true 即消费。 Ctrl/Meta+Tab 恒定保留给焦点环,是键盘用户离开该组件的出口。
在组件作用域注册 effect(Solid 语义:创建即首跑)。handler 更新组件 状态 → 下一帧 Root#build 的 decl diff 自动产出失效(Layout/Paint), 与 #42 重入守卫安全组合(effect 内直接调 root.build 也只延迟为二段 提交)。组件销毁时 effect 自动停止。