@formisch/svelte 0.7.0 → 0.7.2
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.
- package/README.md +1 -1
- package/dist/core/index.svelte.d.ts +11 -7
- package/dist/methods/index.svelte.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Every form starts with the `createForm` function. It initializes your form's sto
|
|
|
30
30
|
const loginForm = createForm({ schema: LoginSchema });
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
|
-
<Form of={loginForm} onsubmit={(output) => console.log(output)}>
|
|
33
|
+
<Form of={loginForm} onsubmit={(output, event) => console.log(output)}>
|
|
34
34
|
<Field of={loginForm} path={['email']}>
|
|
35
35
|
{#snippet children(field)}
|
|
36
36
|
<div>
|
|
@@ -200,23 +200,27 @@ declare const INTERNAL: "~internal";
|
|
|
200
200
|
/**
|
|
201
201
|
* Checks if a type is `any`.
|
|
202
202
|
*/
|
|
203
|
-
type IsAny<
|
|
203
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
204
204
|
/**
|
|
205
205
|
* Checks if a type is `never`.
|
|
206
206
|
*/
|
|
207
|
-
type IsNever<
|
|
207
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
208
208
|
/**
|
|
209
209
|
* Constructs a type that is maybe a promise.
|
|
210
210
|
*/
|
|
211
|
-
type MaybePromise<
|
|
211
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
212
212
|
/**
|
|
213
213
|
* Makes all properties deeply optional.
|
|
214
214
|
*/
|
|
215
|
-
type DeepPartial<TValue> = TValue extends
|
|
215
|
+
type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TValue]?: DeepPartial<TValue[TKey]> | undefined } : TValue | undefined;
|
|
216
216
|
/**
|
|
217
217
|
* Makes all value properties optional.
|
|
218
|
+
*
|
|
219
|
+
* Hint: For dynamic arrays, only plain objects and nested arrays have their
|
|
220
|
+
* values made optional. Primitives and class instances are kept as-is to avoid
|
|
221
|
+
* types like `(string | undefined)[]`.
|
|
218
222
|
*/
|
|
219
|
-
type PartialValues<TValue> = TValue extends readonly
|
|
223
|
+
type PartialValues<TValue> = TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? (TItem extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TItem]: PartialValues<TItem[TKey]> } : TItem)[] : { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue | undefined;
|
|
220
224
|
//#endregion
|
|
221
225
|
//#region src/types/form.d.ts
|
|
222
226
|
/**
|
|
@@ -251,7 +255,7 @@ interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObj
|
|
|
251
255
|
/**
|
|
252
256
|
* The element of the form.
|
|
253
257
|
*/
|
|
254
|
-
element?: HTMLFormElement;
|
|
258
|
+
element?: HTMLFormElement | undefined;
|
|
255
259
|
/**
|
|
256
260
|
* The number of active validators.
|
|
257
261
|
*/
|
|
@@ -325,7 +329,7 @@ type KeyOf<TValue> = IsAny<TValue> extends true ? never : TValue extends readonl
|
|
|
325
329
|
* properties that do not exist in all union options are not accessible
|
|
326
330
|
* and result in "any" when accessed.
|
|
327
331
|
*/
|
|
328
|
-
type MergeUnion<
|
|
332
|
+
type MergeUnion<TValue> = { [TKey in KeyOf<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
329
333
|
/**
|
|
330
334
|
* Lazily evaluates only the first valid path segment based on the given value.
|
|
331
335
|
*/
|
|
@@ -289,7 +289,7 @@ interface ResetFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPa
|
|
|
289
289
|
* The new initial input to reset the field to. If provided, replaces the
|
|
290
290
|
* field's initial input.
|
|
291
291
|
*/
|
|
292
|
-
readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath
|
|
292
|
+
readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath>> | undefined;
|
|
293
293
|
}
|
|
294
294
|
/**
|
|
295
295
|
* Resets a specific field or the entire form to its initial state. Provides
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formisch/svelte",
|
|
3
3
|
"description": "The modular and type-safe form library for Svelte",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabian Hiller",
|
|
7
7
|
"homepage": "https://formisch.dev",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"typescript": "^5.9.2",
|
|
51
51
|
"valibot": "^1.2.0",
|
|
52
52
|
"vite": "^7.1.5",
|
|
53
|
-
"@formisch/core": "0.6.
|
|
53
|
+
"@formisch/core": "0.6.2",
|
|
54
54
|
"@formisch/eslint-config": "0.1.0",
|
|
55
55
|
"@formisch/methods": "0.7.0"
|
|
56
56
|
},
|