Skip to content

feat: support cross-primitive callbacks / shared refs #15

@cassdeckard

Description

@cassdeckard

Summary

Design and implement support for callbacks that modify other primitives (e.g. a List item selection that updates a Table and a TextView). This requires shared references or imperative update hooks, which clash with YAML's declarative nature.

Background

Discovered while planning a tview presentation demo implementation via tviewyaml. The Table slide has a List whose items call functions that change the Table's borders, separator, selectable mode, and the code TextView's content.

Demo Usage

Table slide list items modify table and code TextView; requires shared refs; YAML is declarative.

Proposed Approach

  • Option A: Add ref or name to primitives; provide template functions like updateTable(ref, ...) or setTextViewText(ref, text) that the builder registers
  • Option B: Allow onSelected to receive a multi-step action that updates state consumed by other primitives (reactive)
  • Option C: Document as a known limitation; complex demos may need custom Go code

Relevant Files

  • config/types.goname/ref for primitives
  • builder/builder.go – register named primitives in context
  • template/builtins.go – imperative update functions
  • docs/tview-coverage.md – document approach or limitation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions