Skip to content

feat(dialogs): add multi-select columns - #90

Merged
fx merged 6 commits into
mainfrom
feat/multi-select
Oct 18, 2026
Merged

fx merged 6 commits into
mainfrom
feat/multi-select

Conversation

@fx

@fx fx commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Summary

A select column can now declare multiple: true. In such a column, Space ticks the option under the bar instead of reaching the filter, and Enter takes every tick. Options can be pre-ticked with selected: true, which is accepted only in a multiple column and rejected at any depth anywhere else. The function form and the embedded Select share this validation.

Every SelectResult now carries selected. It holds the ticked values of every column open at completion, left to right and in supplied order within each column, including ticked options the filter hides. When none of those columns holds a tick, it holds the completing option's value alone, so a dialog with no multiple column always resolves [value]. value and values keep their meaning, and a ticked option's fields are never collected.

Spec: Dialogs: Multi-Select. Change: 0037 Add Multi-Select.

Changes

  • plugins/dialogs/contract.ts: SelectRequest.multiple, selected on the option base, and SelectResult.selected
  • plugins/dialogs/index.ts: a pre-tick validation with its cycle guard keyed on the request, run by both select and Select
  • plugins/dialogs/select.ts: ticks kept in a ref beside the stack, keyed by the path of option indices that opened each column, so two options sharing a sub-request do not share ticks and a re-opened column keeps its ticks. Pre-ticks seed a column when it first opens. Space is handled before the filter edit (exactly " " with no ctrl or meta). The hint shows Space tick. selected is computed on plain Enter, on a finished field collection, and on a submitted text leaf
  • plugins/dialogs/columns.ts: a ■/□ tick cell at the start of every row of a multiple column, reserved before the width is split. It is drawn as marker, and as cursor under the bar. The header row is offset by the same two columns
  • The grid is unchanged; a new test confirms it never declares multiple and maps back only the completing row
  • Test doubles that construct a SelectResult now fill selected. The demo's JSON output gains the field
  • New test/dialogs-multi-select.test.ts covers every Multi-Select scenario through select, plus ticking and submission through an embedded Select in a host session, the hint, the tick cell geometry, and the theme variable
  • demo multiple scenario; the plugin guide gains "Tick several options"; the spec, change doc, and docs index are marked complete

Test plan

  • bun run check passes (Biome, tsc, bun test at 100% statement, function, and line coverage, and the build)
  • bun test test/dialogs-multi-select.test.ts passes, with one test named after each Multi-Select scenario
  • bun test test/grid-select.test.ts passes, including "what a grid leaves to multi-select"
  • bun test test/plugin-consumer.test.ts passes with the packed consumer building a multiple request and reading selected
  • bun test test/demo.test.ts test/demo-scenarios.test.ts passes, including the multiple scenario reporting selected: ["beta"]
  • grep -c '\- \[ \]' docs/changes/0037-add-multi-select.md prints 0, and docs/index.yml lists 0037 as complete

fx added 4 commits October 18, 2026 19:15
A select column may now declare `multiple`. Space ticks the option
under the bar without reaching the filter, ticks are kept per column
by the path of option indices that opened it, and pre-ticks declared
with `selected: true` seed a column the first time it opens. A
pre-tick outside a multiple column is rejected before anything is
drawn, at every reachable depth, by both the function form and the
embedded component.

Every result now carries `selected`: the ticks of every open column,
left to right and in supplied order, or the completing option's value
alone when none is ticked. A multiple column draws a tick cell at the
start of every row, reserved before the width is split, and its hint
names `Space tick`.

Test doubles that construct a `SelectResult` fill the new field.
Every Multi-Select scenario runs through `select`, alongside ticking
and submission through an embedded `Select` in a host session, the
hint naming `Space tick` only in a multiple column, the tick cell
under the cursor bar and offsetting a header, and the default theme
drawing it as `marker`. The grid is confirmed to declare no multiple
column and to map back the completing row alone, and the published
consumer fixture builds a multiple request and reads `selected`.
`bun run demo multiple` shows a ticking root column with one host
opening ticked, and a region column it opens that ticks as well, so a
single answer can carry ticks from both. The help text says how Space
and Enter behave in such a column, and the catalogue tests check that
no scenario pre-ticks outside a column that ticks.
The plugin guide's dialogs section gains a section on ticking several
options: the per-column `multiple` setting, the pre-tick and where it
is accepted, Space, the tick cell, the `selected` list on every result,
and that a test double constructing a `SelectResult` now fills it. The
dialogs spec marks Multi-Select implemented with a changelog row, and
the change is complete in its document and the docs index.
Copilot AI lite review requested due to automatic review settings October 18, 2026 19:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The contract and plugin-guide documentation currently contains wording that can mislead consumers about when SelectOption.selected is permitted (it’s selected: true that requires multiple, not the field itself).

2 open issues
What changed in this PR

Adds per-column multi-select support to the dialogs select UI and contract, including ticking behavior (Space), result shape changes (SelectResult.selected), and corresponding documentation/demo/test updates.

Changes:

  • Extend the published dialogs contract with SelectRequest.multiple, SelectOption.selected, and required SelectResult.selected.
  • Implement tick state management in the dialogs select view (per-column path keying), Space-to-tick behavior, hint updates, and tick-cell rendering.
  • Add broad test coverage (new multi-select test suite + updates to existing tests) and update docs/change tracking + demo scenario.
File Description
test/​plugin-consumer.test.ts Updates consumer fixture to exercise multiple requests and read result.selected.
test/​grid-select.test.ts Adds regression coverage that grid→dialogs mapping never declares multi-select and ignores selected when mapping back.
test/​dialogs-plugin.test.ts Updates expected SelectResult shapes to include required selected.
test/​dialogs-multi-select.test.ts New end-to-end multi-select test suite (function form + embedded Select + presentation assertions).
test/​dialogs-embedded.test.ts Updates embedded dialog component expectations to include selected.
test/​demo.test.ts Updates demo output expectations to include selected; adds terminal-driven multi-select scenario assertion.
test/​demo-scenarios.test.ts Updates demo stubs/results for selected; adds assertions for pre-tick placement and multi-select scenario properties.
plugins/​dialogs/​select.ts Implements ticking, tick storage keyed by column path, Space handling, hint logic, and selected computation on completion paths.
plugins/​dialogs/​index.ts Adds request validation for invalid pre-ticks and wires multiple into SelectViewRequest.
plugins/​dialogs/​contract.ts Updates published types/docs for multiple, selected pre-tick, and required SelectResult.selected.
plugins/​dialogs/​columns.ts Adds tick glyphs/cell layout and rendering support for ticking columns.
docs/​specs/​dialogs/​index.md Marks multi-select implemented and documents behavior, plus changelog entry.
docs/​manual/​plugins.md Updates plugin guide to document multiple, ticking, and selected results.
docs/​index.yml Marks change 0037 as complete.
docs/​index.md Marks change 0037 as complete in the docs index table.
docs/​changes/​0037-add-multi-select.md Marks change complete and checks off tracked tasks.
demo/​scenarios.ts Adds a multiple demo scenario and updates help text to mention ticking.
demo/​index.ts Documents the new demo multiple scenario in the top-level demo help comment.

Review effort: Lite

Comment thread docs/manual/plugins.md Resolved
Comment thread plugins/dialogs/contract.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes a published capability contract and core interactive dialog behavior, so it should receive final human review despite strong test coverage.

No open issues 🎉

2 resolved since last review

Review effort: Lite

Three embedded-component tests flipped a host's state to make a
component active, waited a fixed few milliseconds, and pressed a key.
On a loaded runner the activated render may not have committed by
then, so the component's input subscription is still off, the key is
dropped, and the test times out waiting for a callback.

Each host now records, in an effect, that the active render committed,
and the test waits for that instead. The host is the root and a
parent's effects run after its children's, so once it reports the
commit the component's input subscription exists. Where the fixed
pause also gave a differing frame time to appear, it stays after the
wait. No assertion changed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It introduces a contract-level behavior change and substantial interactive-state logic where final confidence typically depends on running the full test plan/coverage checks end-to-end.

No open issues 🎉

Review effort: Lite

@fx
fx merged commit f812737 into main Oct 18, 2026
2 checks passed
@fx
fx deleted the feat/multi-select branch October 18, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants