Lineage and bindings

Expressions and scope

Expressions are useful only when their scope is explicit. LZR tracks <set> bindings, component inputs, <foreach> item/index frames, protocol reads, and jq projections so the Inspector and agents can explain where a rendered value came from.

Live example from this corpuslzr
1  <set key="releasedCount"
2    value="{{ items | jq:'[.[] | select(.href)] | length' }}" />
3
4  <h2>{{ releasedCount }} -- {{ testNumber }} already available</h2>
5  <p>prefix {{ testNumber }} suffix</p>
6
7  <foreach items="{{ items }}" key="item">
8    {{ index + 1 }}. {{ item.title }}
9  </foreach>
Scope at: {{ item.title }}

Foreach frame current loop

itemobjectCurrent item from the foreach

indexnumberZero-based loop index

Template bindings <set> declarations

releasedCountnumberjq projection over items

testNumbernumberLiteral scalar set at the top of the page

From data reads

data://items.jsonarraySource array bound to items

Lineage for: {{ item.title }}
{{ item.title }}Expression itemForeach item binding itemsIterated collection data://items.jsonOrigin data read

Scope records

What the scope map should explain

RecordExample roleInspector behavior
Binding definitionA set-like value or component prop.Ctrl-click variable jumps to the owner expression.
Binding useA text or attribute emission.Hover highlights sibling uses in the same lexical scope.
Foreach itemCurrent item value.Hover highlights the corresponding foreach frame, not unrelated loops.
Foreach indexCurrent zero-based index.Highlight stays scoped to the active loop.
Protocol readConcrete data or source resource.Ctrl-click navigates to the Data tab or source owner.
Scope debugging commands shell
hypermake lzr scope-map src/expressions/mixed.html
hypermake affected-by src/expressions/mixed.html
hypermake explain rendered/public/expressions/mixed.html