Releases: ciscoheat/sveltekit-superforms
Releases Β· ciscoheat/sveltekit-superforms
v1.1.2
v1.1.1
v1.1.0
Added
- Support for
Setin schemas, usingz.set().
Fixed
- Nested array and object-level errors are now all cleared on a successful client-side validation. (#196)
- Boolean fields with a default value of
truealways returnedtruewhen validating. - Fixed infinite deep type instantiation on
message. (#143, thanks to Alisson Cavalcante Agiani) - Fixed typesVersions map that caused incorrect auto-import paths (#191, thanks to CokaKoala)
v1.0.0
Changed
- It's not possible to send arbitrary data to
superFormanymore, aSuperValidatedstructure is required, which is returned fromsuperValidateon the server andsuperValidateSync, so in most cases this is not a problem. message/setMessageandsetErrorcan only set a status in the range400-599.- As with a Zod schema with
refine/superRefine/transform, array and object validation now forces the whole Zod schema to be validated client-side, not just per field. - The
Validationtype is now calledSuperValidated. StringPathandStringPathLeavesare renamed toFormPathandFormPathLeaves.
Removed
- The
validoption is removed frommessage, any status >= 400 will return a fail. - The
$valid,$emptyand$firstErrorstores are removed from the client, they weren't that useful.allErrorscan be used instead, together with the$postedstore. emptyis removed fromSuperForm.options.noErrorsis removed. Useoptions.errorsinstead.- The virtually unused
metahas been removed. Use the Zod schema directly instead for reflection.
Fixed
- When a redirect response is received, form timers will not reset until after navigation or
onDestroy. - Fixed prototype mismatch for Zod schemas from different modules.
- SuperDebug color scheme updated. (Thanks to gregorymcmillan)
- Fixed flash messages being displayed early. This update also means that at least sveltekit-flash-message 1.0.0 is required to work together with Superforms.
- Form data was reset to its previous state when
errorwas thrown. - Form-level errors can be added with
setError, using an empty string as path. - Explicitly setting a form
idfor multiple forms is not required anymore when usinguse:enhance, unless the forms are using the same schema. An id can be specified in the options or in a hidden form field called__superform_id. FieldPathis gone - the following methods are now using a string accessor liketags[2].idinstead of an array like['tags', 2, 'id']:validate,setErrorand all proxy methods (ending withProxy). This also applies to generic components.- The signature for
allErrorsandfirstErrorhas changed to{ path: string; messages: string[] }. - The literal
"any"is now an allowed value instepfor constraints. - Multiple
regexandstepare now allowed on a schema field. A warning will be emitted by default, that can be turned off. - The signature for
options.resetFormhas changed toboolean | () => boolean(it was async before). - The undocumented
defaultDatais now calleddefaultValues. - Added
[aria-invalid="true"]toerrorSelectoroption. options.resetFormnow works withoutuse:enhance!- Fixed deprecation notices for
use:enhance.
Added
- New Superforms domain! https://superforms.rocks
- Added
superValidateSync, useful in components for SPA:s. - Added
defaultValues, which takes a schema and returns the default values for it. - Support for
ZodPipeline. - Arrays and objects in the schema can now have errors! They can be found at
field._errorsin the$errorsstore. validatewill now validate the whole form when it's called with no arguments.- Support for
passthrough()on a schema,superValidatewill allow extra keys in that case. - Added a
postedstore, a boolean which is false if the form hasn't been posted during its current lifetime. resetnow has an additionaldataoption that can be used to re-populate the form with data, andidto set a different form id.intProxy,numberProxy,dateProxyandstringProxynow have anemptyoption, so empty values can be set tonullorundefined.
v1.0.0-rc.4
Read the announcement and migration guide here.
Changed
- It's not possible to send arbitrary data to
superFormanymore, aSuperValidatedstructure is required, which is returned fromsuperValidateon the server andsuperValidateSync, so in most cases this is not a problem. - Reverted that
message/setMessageandsetErrorwill throw an error if status is lower than 400. Using a range error type check instead.
Fixed
- Fixed flash messages being displayed early. This update also means that at least sveltekit-flash-message 1.0.0-rc.3 is required to work together with Superforms.
- Form data was reset to its previous state when
errorwas thrown. - Form-level errors can be added with
setError, using an empty string as path.
v1.0.0-rc.3
The third and final RC for Superforms 1.0 has been released!
Read the announcement and migration guide here.
Removed
- For type safety, you cannot send
nullorundefinedtosuperFormanymore. UsesuperValidate, or pass a complete data object tosuperForm. Default values can be added with thedefaultValuesfunction. - The
validoption is removed frommessage, any status >= 400 will return a fail.
Changed
message/setMessageandsetErrorwill now throw an error if the status option is below 400.
Added
- Arrays and objects in the schema can now have errors! They can be found at
field._errorsin the$errorsstore. validatewill now validate the whole form when it's called with no arguments.- Support for
passthrough()on a schema,superValidatewill allow extra keys in that case.
v1.0.0-rc.2
Read the announcement and migration guide here: https://github.com/ciscoheat/sveltekit-superforms/discussions/168
Changed
- The
Validationtype is now calledSuperValidated. StringPathandStringPathLeavesare renamed toFormPathandFormPathLeaves.
Removed
- The
$valid,$emptyand$firstErrorstores are removed from the client, they weren't that useful.allErrorscan be used instead, together with the$postedstore. emptyis removed fromSuperForm
Fixed
- Async validation works again for custom validators and
superValidate.
Added
- Added a
postedstore, a boolean which is false if the form hasn't been posted during its current lifetime. resetnow has an additionaldataoption that can be used to re-populate the form with data, andidto set a different form id.intProxy,numberProxy,dateProxyandstringProxynow have anemptyoption, so empty values can be set tonullorundefined.
v1.0.0-rc.1
Read the announcement and migration guide here: https://github.com/ciscoheat/sveltekit-superforms/discussions/168
Changed
- Explicitly setting a form
idfor multiple forms is not required anymore when usinguse:enhance, unless the forms are using the same schema. An id can be specified in the options or in a hidden form field called__superform_id. setErrordoesn't handle form-level errors anymore, use refine/superRefine on the schema, or themessagehelper.FieldPathis gone - the following methods are now using a string accessor liketags[2].idinstead of an array like['tags', 2, 'id']:validate,setErrorand all proxy methods (ending withProxy). This also applies to generic components.- The signature for
allErrorsandfirstErrorhas changed to{ path: string; messages: string[] }. - The literal
"any"is now an allowed value instepfor constraints. - Multiple
regexandstepis now allowed in a schema. A warning will be emitted by default, that can be turned off. - The signature for
options.resetFormhas changed toboolean | () => boolean(it was async before). - The undocumented
defaultDatais now calleddefaultValues. - Added
[aria-invalid="true"]toerrorSelectoroption. options.resetFormnow works withoutuse:enhance!
Removed
options.noErrorsis removed. Useoptions.errorsinstead.- The virtually unused
metahas been removed. Use the Zod schema directly instead for reflection.
Fixed
- Fixed deprecation notices for
use:enhance.
Added
- Added
superValidateSync, useful in components for SPA:s. - Added
defaultValues, which takes a schema and returns the default values for it. - Support for
ZodPipeline.
v0.8.7
[0.8.7] - 2023-05-22
Fixed
onUpdatedidn't cancelapplyActionandinvalidateAll.- Hopefully fixed excessively deep infinity type instantiation on
messagehelper. - Removed
errors.clearoptional parameterundefinePath, which was left there by mistake.
Added
onUpdatenow hasformElin its signature.