Skip to content

feat(form): expose form values + autocomplete hooks for custom dependent components#30

Open
stmh wants to merge 1 commit into
mainfrom
feat/dependent-autocomplete-hooks
Open

feat(form): expose form values + autocomplete hooks for custom dependent components#30
stmh wants to merge 1 commit into
mainfrom
feat/dependent-autocomplete-hooks

Conversation

@stmh
Copy link
Copy Markdown
Collaborator

@stmh stmh commented May 16, 2026

Summary

Implements the four API extensions proposed in #29 so consumers can build custom dependent-autocomplete field components without forking the library.

  • flowdrop:getFormValues context in ConfigForm.svelte — registered field components can read sibling form values to resolve dependencies.
  • Registry branch in FormField.svelte — mirrors the existing branch in FormFieldLight.svelte, so custom components registered via fieldComponentRegistry get rendered in the full form too, with autocomplete and dependencies props forwarded.
  • autocomplete / dependencies props forwarded in FormFieldLight.svelte — the registered-component branch now passes both through, matching the new FormField branch.
  • FieldSchema.dependencies type added in form/types.tsRecord<string, string> mapping URL param → sibling field name.
  • form/autocomplete subpath export — new src/lib/form/autocomplete.ts barrel re-exports FormAutocomplete so consumers can wrap it without reaching into private paths; corresponding entry added to package.json exports.

Together these are the minimum hooks needed for a downstream app to ship its own dependent-autocomplete field (e.g. an autocomplete whose query depends on the value of another field in the same form) using only public API.

Closes #29.

Test plan

  • prettier --check on changed files (clean)
  • svelte-check on touched files (no new errors; one pre-existing error in Playground.svelte is unrelated)
  • Maintainer review of API surface
  • Consumer smoke test: register a custom component that reads getContext('flowdrop:getFormValues') and renders FormAutocomplete with dependencies

@stmh stmh requested a review from d34dman May 16, 2026 20:13
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.

Enable custom dependent-autocomplete via field registry (4 small API extensions)

1 participant