Skip to content

Releases: ciscoheat/sveltekit-superforms

v2.9.0

12 Mar 00:00
Compare
Choose a tag to compare

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 SPA option 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 superForm returned a form with an empty id, causing collisions, it is now a random string.
  • customValidity didn't clear without client-side validators.

v2.8.0

05 Mar 19:51
Compare
Choose a tag to compare

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 undefined to a field in the $errors store.
  • Intersections in Zod schemas weren't handled properly.
  • It wasn't possible to change the reference to the result in onResult.

v2.7.0

03 Mar 19:33
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • newState option for reset, to set a new state for future resets. Can be used instead of the data option.

Fixed

  • Empty file entries didn't return null for nullable schema fields. Ensure that all required file fields aren't set to nullable.
  • Allowed string index in $errors and $tainted.
  • submit can 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

24 Feb 08:31
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • Type narrowing for FormPath and its relatives, to filter the paths based on a specific type, like FormPathLeaves<T, Date>.
  • Proxy types: FieldProxy, FormFieldProxy and ArrayProxy.
  • Added invalidateAll option '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 the reset function on the latest load function data returned for the form.

Fixed

  • defaults didn't infer the input type, and didn't generate correct SuperValidated data, making superForm confused. Also fixed type signature and removed the jsonSchema option that wasn't applicable.
  • Using goto in events didn't work when the target page redirected.
  • FormPath and FormPathLeaves didn't handle fields with type unknown and any.
  • Missing boolean fields were valid in strict mode.

v2.5.0

21 Feb 15:45
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • get and set accessor for onChange.
  • submit method for superForm, a convenience instead of using requestSubmit. Requires use:enhance or that a HTMLElement inside 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.paths wasn't strongly typed to FormPath.
  • Initial data was dereferenced after calling superForm, so it wasn't possible to update it when using reset.
  • FormOptions type required a type parameter that should've been defaulted to Record<string, unknown>.
  • Auto-overflow on SuperDebug, for small spaces.

v2.4.0

20 Feb 10:17
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • Added config option 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.

v2.3.0

18 Feb 08:10
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Fixed

  • Depending on the JSON Schema, dates were sometimes set to undefined when posting invalid data.

Added

  • onSubmit.jsonData, to override what's being submitted, when dataType is set to 'json' and validation succeeds for $form.
  • onSubmit.validators, to temporarily override validators for the current submission.

v2.2.1

16 Feb 19:32
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Fixed

  • Added focusOnError option to SuperForm.validateForm type (it was only in the implementation).
  • Enums could not be detected as an invalid value if the posted value was an empty string, instead it defaulted to the enum first value.
  • $posted was reset by mistake to false after posting, when resetForm option was true.

v2.2.0

15 Feb 16:48
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • VineJS adapter!
  • Added focusOnError option to validateForm, default true.

Fixed

  • Autofocus is now working when using validateForm({ update: true }).
  • Default values are now applied properly for single-type unions, even a mix of integers and numbers.
  • SuperStruct types, $errors primarily, didn't handle nested data properly.

Changed

  • The inferred type parameters were swapped in message, it can now be used to specify the message type.

v2.1.0

13 Feb 14:05
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Fixed

  • Enums can now be a required field again, as they don't need an explicit default value anymore. If no explicit default value exists, the first enum value will be used.
  • Empty arrays were set to undefined when using dataType: 'json'.