Repository navigation
Conversation
Add the APIs a UI layer needs on top of the fill flow, and drop autoInit.
- lib/core/events.ts: aff:start, aff:field-filled, aff:done, aff:error as
bubbling CustomEvents, plus an HTMLElementEventMap augmentation so
event.detail is typed for consumers.
- FillResult: every filled entry carries `previous`, and the result carries
`missingRequired` over all fields of the form.
- lib/form/revert.ts: revertFill(result, keys?) restores those values
exactly, through the same native setters and input/change events.
- FillOptions.skipFilled excludes non-empty fields from the prompt, the
schema and the fill.
- AIFormFill.applyExtraction(data, fields, opts?) is the apply half of
fillForm, so a review step gets the same result and events.
- lib/core/controller.ts: createFormFill() resolves form, source and trigger
from elements or selectors and exposes fill/extract/applyExtracted/cancel/
undo/subscribe/getSnapshot/destroy over an idle-working-done-error state.
- readFieldValue(element) reads a field in the shape the library writes it.
BREAKING CHANGE: autoInit and AutoInitOptions are removed. Use
createFormFill({ form, source, trigger }), which takes elements or selectors
and has real teardown.
API Extractor drops `declare global` when it rolls declarations up, so
`pnpm build` appends the augmentation with scripts/append-event-types.js.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
Sorry @JDeffner, your pull request is larger than the review limit of 150,000 diff characters
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.
Adds the pieces a UI layer (element, React hook) needs on top of the fill flow.
Added
aff:start,aff:field-filled,aff:done,aff:erroras bubblingCustomEvents on the form, with anHTMLElementEventMapaugmentation soevent.detailis typed (fillFielddispatches on the field it wrote).FillResult.filled[].previousandFillResult.missingRequired(required fields still empty, over all fields of the form).revertFill(result, keys?)restores those values exactly, including empty strings, unchecked radio groups and multi-selects.FillOptions.skipFilleddrops non-empty fields from the prompt, the schema and the fill.AIFormFill.applyExtraction(data, fields, opts?), the apply half offillForm, for the review path.createFormFill(options), a headless controller:fill,extract,applyExtracted,cancel,undo,subscribe,getSnapshot,destroy, over anidle/working/done/errorsnapshot compatible withuseSyncExternalStore.readFieldValue(element).Breaking:
autoInit/AutoInitOptionsare removed; usecreateFormFill({ form, source, trigger }). README, CHANGELOG,docs/ARCHITECTURE.mdand the Basic/Voice demos are updated.Note for review: API Extractor drops
declare globalwhen it rolls declarations up, sopnpm buildnow appends the augmentation withscripts/append-event-types.js(vite.config.jswas off limits).pnpm lint,format:check,typecheck,test(164) andbuildpass;dist/is rebuilt.🤖 Generated with Claude Code