@webamoki/web-svelte 0.5.3 → 0.5.4

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.
@@ -3,13 +3,13 @@
3
3
  import { dateTransport } from '../../utils/index.js';
4
4
  import { type } from 'arktype';
5
5
  import type { Snippet } from 'svelte';
6
- import { superForm, type SuperForm, type SuperValidated } from 'sveltekit-superforms';
7
- import { arktypeClient } from 'sveltekit-superforms/adapters';
8
- import type { SuperFormData, SuperFormErrors } from 'sveltekit-superforms/client';
9
6
  import type { Readable } from 'svelte/store';
7
+ import { defaults, superForm, type SuperForm, type SuperValidated } from 'sveltekit-superforms';
8
+ import { arktype, arktypeClient } from 'sveltekit-superforms/adapters';
9
+ import type { SuperFormData, SuperFormErrors } from 'sveltekit-superforms/client';
10
10
 
11
11
  interface Props {
12
- validated: SuperValidated<S['infer']> | S['infer'];
12
+ validated?: SuperValidated<S['infer']> | S['infer'];
13
13
  schema: S;
14
14
  onSuccess?: (
15
15
  form: Readonly<SuperValidated<S['infer'], App.Superforms.Message, S['infer']>>
@@ -27,12 +27,12 @@
27
27
  >;
28
28
  // TODO: Enforce use of resolve
29
29
  action: string;
30
- actionName: string;
31
- class: string;
30
+ actionName?: string;
31
+ class?: string;
32
32
  }
33
33
 
34
34
  let {
35
- validated,
35
+ validated: _validated,
36
36
  schema,
37
37
  onSuccess,
38
38
  invalidateAll = false,
@@ -42,6 +42,7 @@
42
42
  class: className
43
43
  }: Props = $props();
44
44
 
45
+ let validated = _validated ?? defaults(arktype(schema));
45
46
  const form = superForm(validated, {
46
47
  validators: arktypeClient(schema),
47
48
  dataType: 'json',
@@ -1,11 +1,11 @@
1
1
  import { type } from 'arktype';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { Readable } from 'svelte/store';
3
4
  import { type SuperForm, type SuperValidated } from 'sveltekit-superforms';
4
5
  import type { SuperFormData, SuperFormErrors } from 'sveltekit-superforms/client';
5
- import type { Readable } from 'svelte/store';
6
6
  declare function $$render<S extends type.Any<Record<string, unknown>>>(): {
7
7
  props: {
8
- validated: SuperValidated<S["infer"]> | S["infer"];
8
+ validated?: SuperValidated<S["infer"]> | S["infer"];
9
9
  schema: S;
10
10
  onSuccess?: (form: Readonly<SuperValidated<S["infer"], App.Superforms.Message, S["infer"]>>) => void;
11
11
  invalidateAll?: boolean;
@@ -16,8 +16,8 @@ declare function $$render<S extends type.Any<Record<string, unknown>>>(): {
16
16
  errors: SuperFormErrors<S["infer"]>;
17
17
  }]>;
18
18
  action: string;
19
- actionName: string;
20
- class: string;
19
+ actionName?: string;
20
+ class?: string;
21
21
  };
22
22
  exports: {};
23
23
  bindings: "";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.3",
6
+ "version": "0.5.4",
7
7
  "license": "MIT",
8
8
  "files": [
9
9
  "dist",