Skip to content

Releases: ciscoheat/sveltekit-superforms

v1.0.0

12 Jun 12:59
Compare
Choose a tag to compare

Changed

  • It's not possible to send arbitrary data to superForm anymore, a SuperValidated structure is required, which is returned from superValidate on the server and superValidateSync, so in most cases this is not a problem.
  • message/setMessage and setError can only set a status in the range 400-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 Validation type is now called SuperValidated.
  • StringPath and StringPathLeaves are renamed to FormPath and FormPathLeaves.

Removed

  • The valid option is removed from message, any status >= 400 will return a fail.
  • The $valid, $empty and $firstError stores are removed from the client, they weren't that useful. allErrors can be used instead, together with the $posted store.
  • empty is removed from SuperForm.
  • options.noErrors is removed. Use options.errors instead.
  • The virtually unused meta has 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 error was thrown.
  • Form-level errors can be added with setError, using an empty string as path.
  • Explicitly setting a form id for multiple forms is not required anymore when using use: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.
  • FieldPath is gone - the following methods are now using a string accessor like tags[2].id instead of an array like ['tags', 2, 'id']: validate, setError and all proxy methods (ending with Proxy). This also applies to generic components.
  • The signature for allErrors and firstError has changed to { path: string; messages: string[] }.
  • The literal "any" is now an allowed value in step for constraints.
  • Multiple regex and step are now allowed on a schema field. A warning will be emitted by default, that can be turned off.
  • The signature for options.resetForm has changed to boolean | () => boolean (it was async before).
  • The undocumented defaultData is now called defaultValues.
  • Added [aria-invalid="true"] to errorSelector option.
  • options.resetForm now works without use: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._errors in the $errors store.
  • validate will now validate the whole form when it's called with no arguments.
  • Support for passthrough() on a schema, superValidate will allow extra keys in that case.
  • Added a posted store, a boolean which is false if the form hasn't been posted during its current lifetime.
  • reset now has an additional data option that can be used to re-populate the form with data, and id to set a different form id.
  • intProxy, numberProxy, dateProxy and stringProxy now have an empty option, so empty values can be set to null or undefined.

v1.0.0-rc.4

09 Jun 10:43
Compare
Choose a tag to compare
v1.0.0-rc.4 Pre-release
Pre-release

Read the announcement and migration guide here.

Changed

  • It's not possible to send arbitrary data to superForm anymore, a SuperValidated structure is required, which is returned from superValidate on the server and superValidateSync, so in most cases this is not a problem.
  • Reverted that message/setMessage and setError will 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 error was thrown.
  • Form-level errors can be added with setError, using an empty string as path.

v1.0.0-rc.3

06 Jun 20:47
Compare
Choose a tag to compare
v1.0.0-rc.3 Pre-release
Pre-release

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 null or undefined to superForm anymore. Use superValidate, or pass a complete data object to superForm. Default values can be added with the defaultValues function.
  • The valid option is removed from message, any status >= 400 will return a fail.

Changed

  • message/setMessage and setError will 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._errors in the $errors store.
  • validate will now validate the whole form when it's called with no arguments.
  • Support for passthrough() on a schema, superValidate will allow extra keys in that case.

v1.0.0-rc.2

03 Jun 20:31
Compare
Choose a tag to compare
v1.0.0-rc.2 Pre-release
Pre-release

Read the announcement and migration guide here: https://github.com/ciscoheat/sveltekit-superforms/discussions/168

Changed

  • The Validation type is now called SuperValidated.
  • StringPath and StringPathLeaves are renamed to FormPath and FormPathLeaves.

Removed

  • The $valid, $empty and $firstError stores are removed from the client, they weren't that useful. allErrors can be used instead, together with the $posted store.
  • empty is removed from SuperForm

Fixed

  • Async validation works again for custom validators and superValidate.

Added

  • Added a posted store, a boolean which is false if the form hasn't been posted during its current lifetime.
  • reset now has an additional data option that can be used to re-populate the form with data, and id to set a different form id.
  • intProxy, numberProxy, dateProxy and stringProxy now have an empty option, so empty values can be set to null or undefined.

v1.0.0-rc.1

30 May 15:12
Compare
Choose a tag to compare
v1.0.0-rc.1 Pre-release
Pre-release

Read the announcement and migration guide here: https://github.com/ciscoheat/sveltekit-superforms/discussions/168

Changed

  • Explicitly setting a form id for multiple forms is not required anymore when using use: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.
  • setError doesn't handle form-level errors anymore, use refine/superRefine on the schema, or the message helper.
  • FieldPath is gone - the following methods are now using a string accessor like tags[2].id instead of an array like ['tags', 2, 'id']: validate, setError and all proxy methods (ending with Proxy). This also applies to generic components.
  • The signature for allErrors and firstError has changed to { path: string; messages: string[] }.
  • The literal "any" is now an allowed value in step for constraints.
  • Multiple regex and step is now allowed in a schema. A warning will be emitted by default, that can be turned off.
  • The signature for options.resetForm has changed to boolean | () => boolean (it was async before).
  • The undocumented defaultData is now called defaultValues.
  • Added [aria-invalid="true"] to errorSelector option.
  • options.resetForm now works without use:enhance!

Removed

  • options.noErrors is removed. Use options.errors instead.
  • The virtually unused meta has 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

22 May 13:41
Compare
Choose a tag to compare

[0.8.7] - 2023-05-22

Fixed

  • onUpdate didn't cancel applyAction and invalidateAll.
  • Hopefully fixed excessively deep infinity type instantiation on message helper.
  • Removed errors.clear optional parameter undefinePath, which was left there by mistake.

Added

  • onUpdate now has formEl in its signature.

v0.8.6

06 May 06:37
Compare
Choose a tag to compare

[0.8.6] - 2023-05-06

Fixed

  • Posting without Javascript enabled in the browser didn't detect new validation data.

v0.8.5

04 May 14:40
Compare
Choose a tag to compare

[0.8.5] - 2023-05-04

Fixed

  • capture and restore are now hoisted functions.
  • Fixed timing issues with radio buttons and validation with side-effects.
  • Using standard array access to fix problems with iOS and iPadOS <= 15.3
  • Fixed client validation problems with multi-select fields.
  • Client validation now runs properly when $form is modified directly by assignment.

v0.8.4

27 Apr 13:13
Compare
Choose a tag to compare

[0.8.4] - 2023-04-27

Fixed

  • Select fields had some timing issue, but should now work properly with client-side validation.
  • Fixed a few problems with error/tainted checking for client-side validation.
  • Typing should now work properly with schema fields containing union types.

v0.8.3

26 Apr 13:40
Compare
Choose a tag to compare

[0.8.3] - 2023-04-26

Fixed

  • Realtime validation now takes refine and superRefine fully into account. If a schema uses them, the whole schema will be validated, to ensure that side effects are propagated to the correct fields.