@webamoki/web-svelte 0.5.1 → 0.5.3
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.
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import { superForm, type SuperForm, type SuperValidated } from 'sveltekit-superforms';
|
|
7
7
|
import { arktypeClient } from 'sveltekit-superforms/adapters';
|
|
8
|
-
import type { SuperFormData } from 'sveltekit-superforms/client';
|
|
8
|
+
import type { SuperFormData, SuperFormErrors } from 'sveltekit-superforms/client';
|
|
9
|
+
import type { Readable } from 'svelte/store';
|
|
9
10
|
|
|
10
11
|
interface Props {
|
|
11
12
|
validated: SuperValidated<S['infer']> | S['infer'];
|
|
@@ -15,11 +16,18 @@
|
|
|
15
16
|
) => void;
|
|
16
17
|
invalidateAll?: boolean;
|
|
17
18
|
children: Snippet<
|
|
18
|
-
[
|
|
19
|
+
[
|
|
20
|
+
{
|
|
21
|
+
form: SuperForm<S['infer'], App.Superforms.Message>;
|
|
22
|
+
data: SuperFormData<S['infer']>;
|
|
23
|
+
delayed: Readable<boolean>;
|
|
24
|
+
errors: SuperFormErrors<S['infer']>;
|
|
25
|
+
}
|
|
26
|
+
]
|
|
19
27
|
>;
|
|
20
28
|
// TODO: Enforce use of resolve
|
|
21
29
|
action: string;
|
|
22
|
-
actionName
|
|
30
|
+
actionName: string;
|
|
23
31
|
class: string;
|
|
24
32
|
}
|
|
25
33
|
|
|
@@ -29,7 +37,7 @@
|
|
|
29
37
|
onSuccess,
|
|
30
38
|
invalidateAll = false,
|
|
31
39
|
children,
|
|
32
|
-
action,
|
|
40
|
+
action: _action,
|
|
33
41
|
actionName,
|
|
34
42
|
class: className
|
|
35
43
|
}: Props = $props();
|
|
@@ -54,10 +62,9 @@
|
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
});
|
|
57
|
-
const data = form
|
|
58
|
-
const _action = actionName ? `${action}?/${actionName}` : action;
|
|
65
|
+
const { form: data, delayed, errors } = form;
|
|
59
66
|
</script>
|
|
60
67
|
|
|
61
|
-
<form class={className} action={_action} method="POST" use:form.enhance>
|
|
62
|
-
{@render children({ form, data })}
|
|
68
|
+
<form class={className} action="{_action}?/{actionName}" method="POST" use:form.enhance>
|
|
69
|
+
{@render children({ form, data, delayed, errors })}
|
|
63
70
|
</form>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type } from 'arktype';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { type SuperForm, type SuperValidated } from 'sveltekit-superforms';
|
|
4
|
-
import type { SuperFormData } from 'sveltekit-superforms/client';
|
|
4
|
+
import type { SuperFormData, SuperFormErrors } from 'sveltekit-superforms/client';
|
|
5
|
+
import type { Readable } from 'svelte/store';
|
|
5
6
|
declare function $$render<S extends type.Any<Record<string, unknown>>>(): {
|
|
6
7
|
props: {
|
|
7
8
|
validated: SuperValidated<S["infer"]> | S["infer"];
|
|
@@ -11,9 +12,11 @@ declare function $$render<S extends type.Any<Record<string, unknown>>>(): {
|
|
|
11
12
|
children: Snippet<[{
|
|
12
13
|
form: SuperForm<S["infer"], App.Superforms.Message>;
|
|
13
14
|
data: SuperFormData<S["infer"]>;
|
|
15
|
+
delayed: Readable<boolean>;
|
|
16
|
+
errors: SuperFormErrors<S["infer"]>;
|
|
14
17
|
}]>;
|
|
15
18
|
action: string;
|
|
16
|
-
actionName
|
|
19
|
+
actionName: string;
|
|
17
20
|
class: string;
|
|
18
21
|
};
|
|
19
22
|
exports: {};
|
|
@@ -10,4 +10,5 @@ import WeekdayChoiceMulti from './ui/choice/WeekdayChoiceMulti.svelte';
|
|
|
10
10
|
import WeekdayChoiceField from './form/fields/WeekdayChoiceField.svelte';
|
|
11
11
|
import WeekdayChoiceMultiField from './form/fields/WeekdayChoiceMultiField.svelte';
|
|
12
12
|
import Button from './form/Button.svelte';
|
|
13
|
-
|
|
13
|
+
import Form from './form/Form.svelte';
|
|
14
|
+
export { Form, TextField, PasswordField, HexColorField, ChoiceMultiField, ChoiceField, WeekdayChoiceField, WeekdayChoiceMultiField, Choice, ChoiceMulti, WeekdayChoice, WeekdayChoiceMulti, Button };
|
package/dist/components/index.js
CHANGED
|
@@ -10,4 +10,5 @@ import WeekdayChoiceMulti from './ui/choice/WeekdayChoiceMulti.svelte';
|
|
|
10
10
|
import WeekdayChoiceField from './form/fields/WeekdayChoiceField.svelte';
|
|
11
11
|
import WeekdayChoiceMultiField from './form/fields/WeekdayChoiceMultiField.svelte';
|
|
12
12
|
import Button from './form/Button.svelte';
|
|
13
|
-
|
|
13
|
+
import Form from './form/Form.svelte';
|
|
14
|
+
export { Form, TextField, PasswordField, HexColorField, ChoiceMultiField, ChoiceField, WeekdayChoiceField, WeekdayChoiceMultiField, Choice, ChoiceMulti, WeekdayChoice, WeekdayChoiceMulti, Button };
|