From 1d01ca77dc1d9fdbe147a25eda9c355d008de95b Mon Sep 17 00:00:00 2001 From: PJ Date: Mon, 25 May 2026 18:11:01 +0530 Subject: [PATCH] feat(hierarchy): add editable signal with native derivation --- internal/hierarchy/hierarchy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/hierarchy/hierarchy.go b/internal/hierarchy/hierarchy.go index 56c1511..dbe3fff 100644 --- a/internal/hierarchy/hierarchy.go +++ b/internal/hierarchy/hierarchy.go @@ -66,6 +66,7 @@ type Element struct { Checked bool `json:"checked,omitempty"` Focused bool `json:"focused,omitempty"` Selected bool `json:"selected,omitempty"` + Editable bool `json:"editable,omitempty"` Bounds Bounds `json:"bounds"` Attributes map[string]string `json:"attrs,omitempty"` } @@ -91,6 +92,7 @@ type treeNodeJSON struct { Focused *bool `json:"focused"` Checked *bool `json:"checked"` Selected *bool `json:"selected"` + Editable *bool `json:"editable"` } // Selector describes a multi-attribute AND match. @@ -221,6 +223,11 @@ func elementFromNode(node *treeNodeJSON) *Element { if node.Selected != nil { element.Selected = *node.Selected } + if node.Editable != nil { + element.Editable = *node.Editable + } else { + element.Editable = strings.Contains(element.Class, "EditText") || attrs["hintText"] != "" + } if b, ok := attrs["bounds"]; ok && b != "" { bounds, err := parseBounds(b) @@ -246,6 +253,7 @@ func elementFromNode(node *treeNodeJSON) *Element { if node.Selected != nil { element.Attributes["selected"] = strconv.FormatBool(*node.Selected) } + element.Attributes["editable"] = strconv.FormatBool(element.Editable) return element }