Inspector: multi-view data inspection with a per-table view picker

This commit is contained in:
2026-06-28 22:13:34 +03:00
parent a75ea5b59e
commit 8cad80f738
10 changed files with 537 additions and 258 deletions
@@ -39,8 +39,8 @@ collection (`spec-fields`), config baking (`spec-config`), standalone export
view's columns in a composition whose views bind different datasets.
- **Extract inline data** (`app/stores/ExtractStore`) lifts only the top-level
`data` block.
- **Data inspector** (`core/result-data`, `DataInspector`) surfaces one input +
one resolved table; a composition produces several `source_<n>`/`data_<n>`.
- **Data inspector** (`DataInspector`) surfaces one input + one resolved table; a
composition produces several `source_<n>`/`data_<n>`.
- **`deriveSnippetName`** (`core/snippet`) reads top-level `mark`/`encoding` only,
so a composed spec falls back to the default name (graceful, not a bug).
- **Chart builder** is single-view by design; its strict round-trip hydration
@@ -73,12 +73,25 @@ collection (`spec-fields`), config baking (`spec-config`), standalone export
for every form (library ref case-insensitive, inline, named-inline, self-defined
`datasets`, url/generator → none); the three Monaco providers and the
facet/repeat defaults pass the cursor offset.
- **M4 — multi-view inspection** (pulled ahead of M3) — group the dataflow's
datasets into per-view input/resolved pairs (`result-data`) and add a view
selector to `DataInspector` (new interactive widget → `/council`). The data
inspector executes the live pipeline, so it is the place to review post-transform
rows (melt/fold/pivot/aggregate); today it surfaces one heuristic input/resolved
pair across the whole composition, with no per-view choice.
- **M4 — multi-view inspection** (pulled ahead of M3) — `core/inspect-views`
enumerates the distinct tables the marks draw (from the compiled Vega spec's
`from.data` + `data[].source` lineage), each with its input + resolved ends;
`RenderHandle.inspectData()` returns those tables with rows; `DataInspector` adds
a `SelectControl` view picker (hidden for the single-table case), labels via
`inspectViewLabel` (named dataset or "View N", never compiler names) + a
`columns · rows` cue. Enumerating by drawn table (not authored view) is forced by
Vega-Lite desugaring (a `point: true` line compiles to two layers). Replaced the
single-pair `core/result-data`.
- **M5 — live / interactive inspection** — make the inspector react to interactive
selections. A selection-as-**filter** (`filter: {param}`) recomputes a downstream
view's `data_N` live, so the inspector should re-read on selection change to show
the brushed result ("what am I visualizing _now_"); a selection-as-**highlight**
(a `condition` encoding) changes no data, so nothing to react to. Needs a refresh
model beyond the per-render `renderEpoch`: subscribe to the live view
(`view.addDataListener` / selection signals), debounced (a brush drag pulses
continuously — latency/interaction `/council` pass), and a default-on-vs-toggle
choice. Selection `*_store` tables are not drawn, so the M4 enumeration already
ignores them.
- **M3 — view-scoped extract** — seed Extract from the focused view's inline data
(reusing the cursor-scope machinery) and rewrite that view's `data`.