Repository navigation
feat(core): change details (source, cancel) on every value callback - #607
Merged
Merged
Conversation
Every onXChange on the shared value contract, and the controls that keep
their own state (Input, Textarea, NumberInput, OTPInput, ColorInput, Tabs,
DatePicker, RangeSlider), now pass ChangeDetails after the value: source
(pointer, keyboard, agent, programmatic), the DOM event when there is one,
and cancel(), which keeps an uncontrolled component as it was.
withChangeSource("agent", fn) marks an assistant's changes. SegmentedControl
keeps its event second and passes details third.
First step toward an agent bridge in core (snapshot, act, query).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gNJtyAjxtXFsms7HWCd1w
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtyAjxtXFsms7HWCd1w
useControllableState now reads changeDetails, so it moves to core's internal/ and fx copies both, held to core's by the parity test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtyAjxtXFsms7HWCd1w
This was referenced Nov 25, 2026
12 tasks done
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.
Requested by Lorant · project thread
Step 1 of making Once UI agent-operable (study: UI SDK vs Once UI). Before core can let an agent drive a live page, every control has to report who changed it and let the app refuse the change.
What changes
onXChangeon the shared value contract (useControllableState) now passes a second argument,details: ChangeDetails:source(pointer,keyboard,agent,programmatic), the DOMeventwhen one was passed, andcancel(). A canceled change leaves an uncontrolled component as it was.withChangeSource("agent", fn)(exported) marks the changesfnmakes. The bridge in step 2 wraps its actions in it, and apps can use it to pass a press's source on after anawait.window.event. A relayedinput.click()or a checkboxchangefalls back to the last pointerdown or keydown seen in the capture phase within the last second.detailsthird, sostudio'sSetFontkeeps working.detailsis optional in the prop types, so a wrapper that calls the callback with the value alone still compiles.Compatibility
This is additive at runtime. The one thing that shows: a test asserting
toHaveBeenCalledWith(value)on one of these callbacks now sees the extra argument. That's why 38 test files change. They only gained achangeDetailsmatcher (src/test/changeDetails.ts) or.slice(0, 1)onmock.calls. The CHANGELOG says so under Unreleased, so this goes out in a minor, not a patch. Generatedai/files are left for the release regeneration, as AGENTS.md asks.Checks
tsc --noEmit: 0 errorspnpm build: passesvitest run: 350 files, 4,913 tests pass, including the newchange-details.test.tsx(pointer vs keyboard, cancel on Switch, Input and Tabs, agent source, SegmentedControl's argument order)Generated by Claude Code