@webamoki/web-svelte 0.5.10 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { type } from 'arktype';
2
2
  import { type SuperValidated } from 'sveltekit-superforms';
3
3
  export declare function prepareForm<S extends type.Any<Record<string, unknown>>>(validated: SuperValidated<S['infer']> | S['infer'], schema: S, options?: Partial<{
4
4
  invalidateAll: boolean;
5
+ resetForm: boolean;
5
6
  onSuccess: (form: Readonly<SuperValidated<S['infer'], App.Superforms.Message, S['infer']>>) => void;
6
7
  }>): {
7
8
  form: import("sveltekit-superforms").SuperForm<S["infer"], any>;
@@ -11,6 +12,7 @@ export declare function prepareForm<S extends type.Any<Record<string, unknown>>>
11
12
  };
12
13
  export declare function prepareEmptyForm<S extends type.Any<Record<string, unknown>>>(schema: S, options?: Partial<{
13
14
  invalidateAll: boolean;
15
+ resetForm: boolean;
14
16
  onSuccess: (form: Readonly<SuperValidated<S['infer'], App.Superforms.Message, S['infer']>>) => void;
15
17
  }>): {
16
18
  form: import("sveltekit-superforms").SuperForm<S["infer"], any>;
@@ -4,12 +4,12 @@ import { type } from 'arktype';
4
4
  import { defaults, fail, superForm, superValidate } from 'sveltekit-superforms';
5
5
  import { arktype, arktypeClient } from 'sveltekit-superforms/adapters';
6
6
  export function prepareForm(validated, schema, options) {
7
- const _invalidateAll = options?.invalidateAll === undefined ? false : true;
8
7
  const form = superForm(validated, {
9
8
  validators: arktypeClient(schema),
10
9
  dataType: 'json',
11
- invalidateAll: _invalidateAll,
10
+ invalidateAll: options?.invalidateAll ?? false,
12
11
  transport: dateTransport,
12
+ resetForm: options?.resetForm ?? true,
13
13
  onUpdated({ form }) {
14
14
  if (form.valid) {
15
15
  options?.onSuccess?.(form);
@@ -30,12 +30,12 @@ export function prepareForm(validated, schema, options) {
30
30
  return { form, data: form.form, delayed, errors };
31
31
  }
32
32
  export function prepareEmptyForm(schema, options) {
33
- const _invalidateAll = options?.invalidateAll === undefined ? false : true;
34
33
  const form = superForm(defaults(arktype(schema)), {
35
34
  validators: arktypeClient(schema),
36
35
  dataType: 'json',
37
- invalidateAll: _invalidateAll,
36
+ invalidateAll: options?.invalidateAll === undefined ? false : true,
38
37
  transport: dateTransport,
38
+ resetForm: options?.resetForm === undefined ? true : false,
39
39
  onUpdated({ form }) {
40
40
  if (form.valid) {
41
41
  options?.onSuccess?.(form);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.10",
6
+ "version": "0.5.11",
7
7
  "license": "MIT",
8
8
  "files": [
9
9
  "dist",