Releases: ciscoheat/sveltekit-superforms
v2.12.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- SPA action form now supports form elements as well, by adding its
use:enhanceon all related forms.
Fixed
- Fixed type inference for
FormPathwith nested arrays. Error output improved as well. - If method is "GET" or doesn't exist on an enhanced form, it's now automatically set to "POST". π
v2.11.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- The
ActionResultfor success or failure is now added to theonUpdateevent in theresultproperty. Can be used to access theActionDatamore easily. - Added a
failfunction, works the same as the SvelteKit fail, but removes files and setsform.validtofalse. options.configadded to the Zod adapter, so the JSON Schema generation can be customized.
Fixed
- Snapshots couldn't handle files. They are now reverted to their default value when captured and restored in a snapshot, including the tainted state for these fields.
v2.10.6
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Changed
- The clearOnSubmit option didn't clear the errors when supposed to. To avoid a breaking change, the default option for clearOnSubmit is now
message, noterrors-and-message, as it didn't work anyway.
Fixed
- the
event.result.errorsignature in onError was incorrect, it doesn't always matchApp.Error. It is now a union betweenApp.Error, The built-in JSErrorclass, and the default App.Error signature{ message: string }. See the server errors section for examples when the different kinds of errors are being created.
v2.10.5
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
fileProxy,filesProxy,fileFieldProxyandfilesFieldProxy, soFileobjects can be used withbind:fileson the input field. See file uploads for examples.- Exported
FormPathLeavesWithErrors, for thesetErrorfunction.
Fixed
- Support for
instanceandspecialvalidators for Valibot, which now enables File validation for Valibot! taintedMessagedidn't always work when navigating with the History API.tainteddidn't untaint automatically when using arrays.- Client-side validation triggered for incorrect fields when starting with the same name.
v2.9.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- "SPA action mode", the
SPAoption can now take a string, corresponding to a form action, and it will post there, even without a html form on the page. Especially useful for debounced server checks like available usernames. Example here
Fixed
- Fixed types for constraints, tainted and errors when using intersections and unions in schemas.
- Fixed SuperDebug collapsed height by preventing global css leak.
- Redirect in SPA mode cancelled normal redirects, preventing applyAction.
- Default objects sent to
superFormreturned a form with an empty id, causing collisions, it is now a random string. customValiditydidn't clear without client-side validators.
v2.8.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- Support for object unions, with implicit default values.
- Experimental Storybook support.
Fixed
- It wasn't possible to directly assign
undefinedto a field in the$errorsstore. - Intersections in Zod schemas weren't handled properly.
- It wasn't possible to change the reference to the result in
onResult.
v2.7.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
newStateoption forreset, to set a new state for future resets. Can be used instead of thedataoption.
Fixed
- Empty file entries didn't return
nullfor nullable schema fields. Ensure that all required file fields aren't set to nullable. - Allowed
stringindex in$errorsand$tainted. submitcan now be passed directly to event handlers.- Updated to latest
valibot-json-schema, with support for enums, amongst others. - Zod adapter now supports
ZodType.
v2.6.1
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- Type narrowing for
FormPathand its relatives, to filter the paths based on a specific type, likeFormPathLeaves<T, Date>. - Proxy types:
FieldProxy,FormFieldProxyandArrayProxy. - Added
invalidateAlloption'force', to always use the load function form data, instead of the one returned from the form action. Useful when updating the form data partially, to ensure that the data is refreshed from the server (a "pessimistic" update compared to the default, which is optimistic). Setting this also bases theresetfunction on the latest load function data returned for the form.
Fixed
defaultsdidn't infer the input type, and didn't generate correctSuperValidateddata, makingsuperFormconfused. Also fixed type signature and removed thejsonSchemaoption that wasn't applicable.- Using
gotoin events didn't work when the target page redirected. FormPathandFormPathLeavesdidn't handle fields with typeunknownandany.- Missing boolean fields were valid in strict mode.
v2.5.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
getandsetaccessor foronChange.submitmethod forsuperForm, a convenience instead of using requestSubmit. Requiresuse:enhanceor that aHTMLElementinside the form (or the form itself) is passed as an argument.
Fixed
- Type parameter was missing in
ChangeEvent, which should be of the inferred schema type. - Type for
onChange.pathswasn't strongly typed toFormPath. - Initial data was dereferenced after calling
superForm, so it wasn't possible to update it when usingreset. FormOptionstype required a type parameter that should've been defaulted toRecord<string, unknown>.- Auto-overflow on SuperDebug, for small spaces.
v2.4.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- Added
configoption to Valibot adapter, for the SchemaConfig type.
Fixed
- Nullable fields weren't always detected in JSON Schemas.
- Constraints weren't added when using default values for Arktype, Vine and Valibot schemas.
- Fixed null support for Joi, Arktype and Vine schemas.