@formisch/vue 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 CHANGED
@@ -31,7 +31,7 @@ const loginForm = useForm({ schema: LoginSchema });
31
31
  </script>
32
32
 
33
33
  <template>
34
- <Form :of="loginForm" @submit="(output) => console.log(output)">
34
+ <Form :of="loginForm" @submit="(output, event) => console.log(output)">
35
35
  <Field :of="loginForm" :path="['email']" v-slot="field">
36
36
  <div>
37
37
  <input v-model="field.input" v-bind="field.props" type="email" />
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import * as vue0 from "vue";
2
+ import * as vue1 from "vue";
3
3
  import { ComponentPublicInstance, MaybeRefOrGetter, ShallowRef as Signal } from "vue";
4
4
 
5
5
  //#region ../../packages/core/dist/index.vue.d.ts
@@ -187,23 +187,27 @@ declare const INTERNAL: "~internal";
187
187
  /**
188
188
  * Checks if a type is `any`.
189
189
  */
190
- type IsAny<Type> = 0 extends 1 & Type ? true : false;
190
+ type IsAny<T> = 0 extends 1 & T ? true : false;
191
191
  /**
192
192
  * Checks if a type is `never`.
193
193
  */
194
- type IsNever<Type> = [Type] extends [never] ? true : false;
194
+ type IsNever<T> = [T] extends [never] ? true : false;
195
195
  /**
196
196
  * Constructs a type that is maybe a promise.
197
197
  */
198
- type MaybePromise<TValue> = TValue | Promise<TValue>;
198
+ type MaybePromise<T> = T | Promise<T>;
199
199
  /**
200
200
  * Makes all properties deeply optional.
201
201
  */
202
- type DeepPartial<TValue> = TValue extends readonly unknown[] ? number extends TValue["length"] ? TValue : { [Key in keyof TValue]?: DeepPartial<TValue[Key]> | undefined } : TValue extends Record<PropertyKey, unknown> ? { [Key in keyof TValue]?: DeepPartial<TValue[Key]> | undefined } : TValue | undefined;
202
+ type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TValue]?: DeepPartial<TValue[TKey]> | undefined } : TValue | undefined;
203
203
  /**
204
204
  * Makes all value properties optional.
205
+ *
206
+ * Hint: For dynamic arrays, only plain objects and nested arrays have their
207
+ * values made optional. Primitives and class instances are kept as-is to avoid
208
+ * types like `(string | undefined)[]`.
205
209
  */
206
- type PartialValues<TValue> = TValue extends readonly unknown[] ? number extends TValue["length"] ? TValue : { [Key in keyof TValue]: PartialValues<TValue[Key]> } : TValue extends Record<PropertyKey, unknown> ? { [Key in keyof TValue]: PartialValues<TValue[Key]> } : TValue | undefined;
210
+ 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;
207
211
  //#endregion
208
212
  //#region src/types/form.d.ts
209
213
  /**
@@ -238,7 +242,7 @@ interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObj
238
242
  /**
239
243
  * The element of the form.
240
244
  */
241
- element?: HTMLFormElement;
245
+ element?: HTMLFormElement | undefined;
242
246
  /**
243
247
  * The number of active validators.
244
248
  */
@@ -312,7 +316,7 @@ type KeyOf<TValue> = IsAny<TValue> extends true ? never : TValue extends readonl
312
316
  * properties that do not exist in all union options are not accessible
313
317
  * and result in "any" when accessed.
314
318
  */
315
- type MergeUnion<T> = { [K in KeyOf<T>]: T extends Record<K, infer V> ? V : never };
319
+ type MergeUnion<TValue> = { [TKey in KeyOf<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
316
320
  /**
317
321
  * Lazily evaluates only the first valid path segment based on the given value.
318
322
  */
@@ -644,7 +648,7 @@ interface ResetFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPa
644
648
  * The new initial input to reset the field to. If provided, replaces the
645
649
  * field's initial input.
646
650
  */
647
- readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath>>;
651
+ readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath>> | undefined;
648
652
  }
649
653
  /**
650
654
  * Resets a specific field or the entire form to its initial state. Provides
@@ -955,14 +959,14 @@ interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends Require
955
959
  readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
956
960
  }
957
961
  declare const __VLS_export$2: <TSchema extends Schema, TFieldPath extends RequiredPath>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
958
- props: __VLS_PrettifyLocal$2<FieldProps<TSchema, TFieldPath>> & vue0.PublicProps;
962
+ props: __VLS_PrettifyLocal$2<FieldProps<TSchema, TFieldPath>> & vue1.PublicProps;
959
963
  expose: (exposed: {}) => void;
960
964
  attrs: any;
961
965
  slots: {
962
966
  default(props: FieldStore<TSchema, TFieldPath>): any;
963
967
  };
964
968
  emit: {};
965
- }>) => vue0.VNode & {
969
+ }>) => vue1.VNode & {
966
970
  __ctx?: Awaited<typeof __VLS_setup>;
967
971
  };
968
972
  declare const _default: typeof __VLS_export$2;
@@ -983,14 +987,14 @@ interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath exten
983
987
  readonly path: ValidArrayPath<v.InferInput<TSchema>, TFieldArrayPath>;
984
988
  }
985
989
  declare const __VLS_export$1: <TSchema extends Schema, TFieldArrayPath extends RequiredPath>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$1<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
986
- props: __VLS_PrettifyLocal$1<FieldArrayProps<TSchema, TFieldArrayPath>> & vue0.PublicProps;
990
+ props: __VLS_PrettifyLocal$1<FieldArrayProps<TSchema, TFieldArrayPath>> & vue1.PublicProps;
987
991
  expose: (exposed: {}) => void;
988
992
  attrs: any;
989
993
  slots: {
990
994
  default(props: FieldArrayStore<TSchema, TFieldArrayPath>): any;
991
995
  };
992
996
  emit: {};
993
- }>) => vue0.VNode & {
997
+ }>) => vue1.VNode & {
994
998
  __ctx?: Awaited<typeof __VLS_setup>;
995
999
  };
996
1000
  declare const _default$1: typeof __VLS_export$1;
@@ -1011,14 +1015,14 @@ interface FormProps<TSchema extends Schema = Schema> {
1011
1015
  onSubmit: SubmitHandler<TSchema> | SubmitEventHandler<TSchema>;
1012
1016
  }
1013
1017
  declare const __VLS_export: <TSchema extends Schema = Schema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
1014
- props: __VLS_PrettifyLocal<FormProps<TSchema>> & vue0.PublicProps;
1018
+ props: __VLS_PrettifyLocal<FormProps<TSchema>> & vue1.PublicProps;
1015
1019
  expose: (exposed: {}) => void;
1016
1020
  attrs: any;
1017
1021
  slots: {
1018
1022
  default?: (props: {}) => any;
1019
1023
  };
1020
1024
  emit: {};
1021
- }>) => vue0.VNode & {
1025
+ }>) => vue1.VNode & {
1022
1026
  __ctx?: Awaited<typeof __VLS_setup>;
1023
1027
  };
1024
1028
  declare const _default$2: typeof __VLS_export;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/vue",
3
3
  "description": "The modular and type-safe form library for Vue",
4
- "version": "0.7.0",
4
+ "version": "0.7.2",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -43,9 +43,9 @@
43
43
  "valibot": "^1.2.0",
44
44
  "vue": "^3.5.18",
45
45
  "vue-tsc": "^3.0.4",
46
- "@formisch/eslint-config": "0.1.0",
47
- "@formisch/core": "0.6.0",
48
- "@formisch/methods": "0.7.0"
46
+ "@formisch/methods": "0.7.0",
47
+ "@formisch/core": "0.6.2",
48
+ "@formisch/eslint-config": "0.1.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "typescript": ">=5",