Repository navigation
Host core: a headless view model every UI shares - #112
Merged
Merged
Conversation
This was referenced Nov 20, 2026
There was a problem hiding this comment.
🟡 Changes recommended
The playback override enables the layout, but the VS Code Playback component still returns null outside animated mode, leaving playback hidden in the affected views.
1 open issue
What changed in this PR
This PR centralizes host UI decisions in a shared, headless view model, reducing duplicated behavior between the default UI, VS Code UI, and custom hosts.
Changes:
- Adds shared helpers for view selection, control visibility, scope choices, and summary toggles.
- Migrates both built-in UIs to shared defaults, with configurable playback visibility and consistent zoom gating.
- Documents the public API and adds tests for the shared behavior.
| File | Description |
|---|---|
packages/host/vscode-ui/src/view/toolbar-content.ts |
Uses shared control visibility decisions. |
packages/host/vscode-ui/src/view/props.ts |
Adds the playback visibility option. |
packages/host/vscode-ui/src/view.tsx |
Adopts shared view selection and controls. |
packages/host/vscode-ui/src/summary-bar.tsx |
Uses shared summary toggles and tooltips. |
packages/host/vscode-ui/src/scope-switch.tsx |
Uses shared scope options and labels. |
packages/host/vscode-ui/src/features.ts |
Re-exports core features under existing names. |
packages/host/vscode-ui/src/explorer.tsx |
Forwards the playback visibility option. |
packages/host/core/test/view-model.test.mjs |
Tests shared view-model behavior. |
packages/host/core/src/view-model.ts |
Defines shared features and presentation decisions. |
packages/host/core/src/view-choice.ts |
Adds the shared view-selection hook. |
packages/host/core/src/ui/view/props.ts |
Adds the playback visibility option. |
packages/host/core/src/ui/view.tsx |
Adopts shared view selection and controls. |
packages/host/core/src/ui/view-controls.tsx |
Imports view types from core. |
packages/host/core/src/ui/summary-bar.tsx |
Uses shared summary toggles and tooltips. |
packages/host/core/src/ui/settings-menu.tsx |
Imports shared feature definitions. |
packages/host/core/src/ui/scope-switch.tsx |
Uses shared scope choices. |
packages/host/core/src/ui/features.ts |
Removes definitions moved into core. |
packages/host/core/src/ui/explorer.tsx |
Forwards the playback visibility option. |
packages/host/core/src/ui/blocks.tsx |
Preserves existing feature exports. |
packages/host/core/src/ui/about.tsx |
Uses the shared renderer label helper. |
packages/host/core/src/summary.ts |
Adds reusable summary toggle helpers. |
packages/host/core/src/index.ts |
Exports the new public API. |
packages/host/core/browser/modes.spec.ts |
Updates the side-by-side playback expectation. |
docs/guides/host-ui.md |
Documents playback defaults and shared behavior. |
docs/guides/host-core.md |
Documents the view model and override points. |
Review effort: Balanced
agorischek
force-pushed
the
toolbar-sides
branch
2 times, most recently
from
November 21, 2026 00:37
9197352 to
5e47319
Compare
agorischek
force-pushed
the
headless-view-model
branch
from
November 21, 2026 00:43
8d77a7c to
dfe2e20
Compare
agorischek
force-pushed
the
toolbar-sides
branch
2 times, most recently
from
November 21, 2026 01:15
993aceb to
b1d2c11
Compare
agorischek
force-pushed
the
headless-view-model
branch
from
November 21, 2026 01:37
dfe2e20 to
2f5e4fd
Compare
agorischek
force-pushed
the
toolbar-sides
branch
6 times, most recently
from
November 21, 2026 05:28
05a5719 to
b10ac76
Compare
agorischek
force-pushed
the
headless-view-model
branch
3 times, most recently
from
November 21, 2026 17:39
415c5f4 to
fcdeef9
Compare
Which views a host offers and which controls show were worked out separately in the default UI, the VS Code UI and
the Playground's Primer UI, and the copies had drifted. They are now the core's (`view-model.ts`), with one default
each and typed options to change it:
- `offeredViews`, `shownView`, `recoveryView`, `viewLabel` and the `useViewChoice` hook;
- `viewControls(projection, {features, view, playbackInViews?})`: the modes and mode switch, scope, playback, zoom and
the varied toggle;
- `scopeChoice`: the scope switch's options, titles and "nothing hidden" note;
- `summaryToggle`, `summaryToggleTitle` and `summaryFactTitle`;
- `ProjectionFeatures`, `featureOn`, `offeredModes` and `rendererLabel`, moved from the default UI.
Playback now shows only in the Animated mode, in every view, as the VS Code UI and Primer already did; the default UI
showed it beside the table and text views in every mode. `playbackInViews: 'always'` keeps that. The default UI's zoom
group, like the VS Code UI's, now also needs `rendererControls`.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…le and text views `viewControls` could ask for playback beside the table and text views in every mode, but the VS Code UI's `Playback` and its Space shortcut still required the Animated mode. Both now take `always` from the toolbar, as the default UI's `Playback` does. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
agorischek
force-pushed
the
headless-view-model
branch
from
November 21, 2026 18:28
9fb13a8 to
a385848
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #65 (
toolbar-sides), which touchesui/view.tsx; GitHub retargets it tomainonce #58 and #65 merge.Why
A custom host UI had to rebuild the layer between the controller and its widgets: which views exist and which one shows, when playback, the mode switch, zoom and the varied toggle show, and what the scope switch offers. The default UI, the VS Code UI and the Playground's Primer UI each had a copy, and the copies had drifted:
ui/view.tsx), only in Animated in the VS Code UI and Primer;rendererControls, the default UI didn't;The general rule, from the user: consistent defaults, but configurable. Each behaviour has one default in the core, and a surface changes it through a typed option, never by copying the implementation.
What's in the core now
packages/host/core/src/view-model.ts(pure) andview-choice.ts(one hook), exported from@githubnext/projections-host:offeredViews,shownView,recoveryView,viewLabeluseViewChoice(projection, features, initialView){views, view, setView, recoverView}, showing the renderer's view when a renderer arrives.viewControls(projection, {features, view, playbackInViews?})modes,modeSwitch,scope,playback,zoom,zoomControls,varied.scopeChoice(projection),scopeNamessummaryToggle,summaryToggleTitle,summaryFactTitleProjectionFeatures,featureOn,offeredModes,rendererLabel/uiand the VS Code UI re-export them under their existing names (VscodeProjectionFeatures,on).Override points:
playbackInViews: 'animated' | 'always'onviewControls,ProjectionView,VscodeProjectionViewand both explorers;features,initialViewand the definition'spresentation.Behaviour changes, as decided
playbackInViews: 'always'restores that.rendererControls, as the VS Code UI's and Primer's did, and draws no zoom controls while the renderer has failed.Consumers
ui/view.tsx,scope-switch.tsx,summary-bar.tsx) and the VS Code UI (view.tsx,view/toolbar-content.ts,scope-switch.tsx,summary-bar.tsx) use the core's view model.ui/features.tsis gone.Docs
docs/guides/host-core.mdgains "The view model", with the defaults and override points.docs/guides/host-ui.mdstates the playback rule and points to it.Tests
packages/host/core/test/view-model.test.mjs(node:test, 8 tests) covers:playbackInViews: 'always';browser/modes.spec.ts: the table view in side by side now expects no playback.Run locally:
tools check --fast: pass, typecheck included.node --test test/view-model.test.mjs test/summary.test.mjs test/settings.test.mjs: 22/22.I built only the TypeScript layers this needs (schemas, renderer SDK, the engine's
js) and no Rust. Browser suites are left to CI.