Skip to Content

The UI tree

A tree artifact is the one artifact with a fixed shape, the normalized UI tree the app uses to map a pixel to source.

A tree artifact is the one artifact with a fixed shape, pitafix.tree/1: the normalized UI tree the app uses to map a pixel to source, without knowing the stack. Keep your toolkit's raw tree under another kind, such as raw-tree.

{"schema":"pitafix.tree/1","w":390,"h":844,
 "root":{"name":"TodayScreen","file":"feature/today/TodayScreen.kt","line":48,
         "bounds":{"x":0,"y":0,"w":390,"h":844},
         "children":[
           {"name":"FieldButton","role":"button","label":"On my way",
            "file":"feature/today/TodayScreen.kt","line":112,
            "bounds":{"x":16,"y":700,"w":358,"h":56}}]}}
  • w and h are the size in the pixels of the screenshot of the same phase. If the screenshot is 1170×2532 and the tree thinks in 390×844 points, scale: the app maps a point on the image straight into the tree.
  • Each node: name (the component or element — Compose function, React component, ERB partial), optional role, label and id from the UI, optional file (repo-relative) and line (the call site, 1-based), optional bounds, and children.
  • A node with no bounds is transparent: its children are still hit-tested. A node with no file and line is skipped when someone option-clicks for source. Library wrappers and design-system primitives are usually best dissolved — let their children rise — so a click on a button reads the screen's own call site.
  • Labels hold whatever the screen showed, secrets included. Redact before the file is written (see the rules), and say so on the artifact: "redaction":{"applied":true,"rulesVersion":"field-1","rawRetained":false}.

On this page