Skip to content

Releases: ciscoheat/sveltekit-superforms

v1.5.0

23 Jul 08:56
Compare
Choose a tag to compare

Fixed

  • A boolean schema field didn't accept a boolean false value when posted, it was coerced as true.
  • A SuperDebug truncated string showed only the whole string length, not the truncated.

Added

  • Added customValidity option to superForm, which will use the browser's validation message reporting for validation errors. More information and an example here.
  • Added emptyIfZero option to numberProxy and intProxy.

v1.4.0

20 Jul 10:40
Compare
Choose a tag to compare

Fixed

  • When multiple forms exists with the same id, the warning is now displayed on superForm instantiation, not just when new form data is received.
  • Fixed client-side validation for Date schema fields. (#232)
  • numberProxy and intProxy now works with the empty option. (#232)
  • Fixed timer state in combination with navigation events.

Added

  • Added delimiter option to numberProxy.

v1.3.0

14 Jul 13:52
Compare
Choose a tag to compare

Fixed

  • Fixed persisting form data when component used data from $page in combination with onDestroy. (#164, thank you to everyone in that thread!)
  • Fixed exception message when the dataType option isn't set to 'json' and the schema contains a nested object. (#225)
  • Superforms are now ignoring normal SvelteKit form actions when they are posted. (#230)

Added

  • More configuration options, customizable styling, automatic promise and store support for SuperDebug, thanks to Josue!

v1.2.0

06 Jul 10:26
1f9eb0f
Compare
Choose a tag to compare

Added

  • The scrollToError option can now take the same parameters as scrollIntoView, which makes it work for nested scrollbars.
  • Added setError signature, to more conveniently set a form-level error: setError(form, 'Form-level error message')

Fixed

  • If the resetForm option was enabled, the form was reset even if fail was returned.

v1.1.3

29 Jun 18:38
Compare
Choose a tag to compare

Fixed

  • Form-level errors couldn't be overwritten.
  • Array-level errors couldn't be added with setError.
  • Native string enums weren't working when posting the actual string value.

v1.1.2

24 Jun 09:55
Compare
Choose a tag to compare

Added

  • Svelte 4 compatibility.

v1.1.1

20 Jun 16:58
Compare
Choose a tag to compare

A quick-fix for the Set feature in 1.1.0.

Fixed

  • Set comparison added in 1.1.0 wasn't fully functional.

v1.1.0

20 Jun 15:24
Compare
Choose a tag to compare

Added

  • Support for Set in schemas, using z.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 true always returned true when 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

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.