@formisch/vue 0.7.2 → 0.7.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import * as vue1 from "vue";
2
+ import * as vue3 from "vue";
3
3
  import { ComponentPublicInstance, MaybeRefOrGetter, ShallowRef as Signal } from "vue";
4
4
 
5
5
  //#region ../../packages/core/dist/index.vue.d.ts
@@ -959,14 +959,14 @@ interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends Require
959
959
  readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
960
960
  }
961
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<{
962
- props: __VLS_PrettifyLocal$2<FieldProps<TSchema, TFieldPath>> & vue1.PublicProps;
962
+ props: __VLS_PrettifyLocal$2<FieldProps<TSchema, TFieldPath>> & vue3.PublicProps;
963
963
  expose: (exposed: {}) => void;
964
964
  attrs: any;
965
965
  slots: {
966
966
  default(props: FieldStore<TSchema, TFieldPath>): any;
967
967
  };
968
968
  emit: {};
969
- }>) => vue1.VNode & {
969
+ }>) => vue3.VNode & {
970
970
  __ctx?: Awaited<typeof __VLS_setup>;
971
971
  };
972
972
  declare const _default: typeof __VLS_export$2;
@@ -987,14 +987,14 @@ interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath exten
987
987
  readonly path: ValidArrayPath<v.InferInput<TSchema>, TFieldArrayPath>;
988
988
  }
989
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<{
990
- props: __VLS_PrettifyLocal$1<FieldArrayProps<TSchema, TFieldArrayPath>> & vue1.PublicProps;
990
+ props: __VLS_PrettifyLocal$1<FieldArrayProps<TSchema, TFieldArrayPath>> & vue3.PublicProps;
991
991
  expose: (exposed: {}) => void;
992
992
  attrs: any;
993
993
  slots: {
994
994
  default(props: FieldArrayStore<TSchema, TFieldArrayPath>): any;
995
995
  };
996
996
  emit: {};
997
- }>) => vue1.VNode & {
997
+ }>) => vue3.VNode & {
998
998
  __ctx?: Awaited<typeof __VLS_setup>;
999
999
  };
1000
1000
  declare const _default$1: typeof __VLS_export$1;
@@ -1015,14 +1015,14 @@ interface FormProps<TSchema extends Schema = Schema> {
1015
1015
  onSubmit: SubmitHandler<TSchema> | SubmitEventHandler<TSchema>;
1016
1016
  }
1017
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<{
1018
- props: __VLS_PrettifyLocal<FormProps<TSchema>> & vue1.PublicProps;
1018
+ props: __VLS_PrettifyLocal<FormProps<TSchema>> & vue3.PublicProps;
1019
1019
  expose: (exposed: {}) => void;
1020
1020
  attrs: any;
1021
1021
  slots: {
1022
1022
  default?: (props: {}) => any;
1023
1023
  };
1024
1024
  emit: {};
1025
- }>) => vue1.VNode & {
1025
+ }>) => vue3.VNode & {
1026
1026
  __ctx?: Awaited<typeof __VLS_setup>;
1027
1027
  };
1028
1028
  declare const _default$2: typeof __VLS_export;
package/dist/index.js CHANGED
@@ -50,10 +50,10 @@ function untrack(fn) {
50
50
  */
51
51
  function initializeFieldStore(internalFieldStore, schema, initialInput, path, nullish = false) {
52
52
  if (framework === "qwik" && schema.type === "lazy" || schema.type === "object_with_rest" || schema.type === "record" || schema.type === "tuple_with_rest" || schema.type === "promise") throw new Error(`"${schema.type}" schema is not supported`);
53
- else if (schema.type === "lazy") initializeFieldStore(internalFieldStore, schema.getter(void 0), initialInput, path);
53
+ else if (schema.type === "lazy") initializeFieldStore(internalFieldStore, schema.getter(void 0), initialInput, path, nullish);
54
54
  else if (schema.type === "exact_optional" || schema.type === "nullable" || schema.type === "nullish" || schema.type === "optional" || schema.type === "undefinedable") initializeFieldStore(internalFieldStore, schema.wrapped, initialInput === void 0 ? v.getDefault(schema) : initialInput, path, true);
55
55
  else if (schema.type === "non_nullable" || schema.type === "non_nullish" || schema.type === "non_optional") initializeFieldStore(internalFieldStore, schema.wrapped, initialInput, path);
56
- else if (schema.type === "intersect" || schema.type === "union" || schema.type === "variant") for (const schemaOption of schema.options) initializeFieldStore(internalFieldStore, schemaOption, initialInput, path);
56
+ else if (schema.type === "intersect" || schema.type === "union" || schema.type === "variant") for (const schemaOption of schema.options) initializeFieldStore(internalFieldStore, schemaOption, initialInput, path, nullish);
57
57
  else {
58
58
  internalFieldStore.schema = schema;
59
59
  internalFieldStore.name = JSON.stringify(path);
@@ -949,12 +949,15 @@ var Form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
949
949
  },
950
950
  setup(__props) {
951
951
  const props = __props;
952
- const handler = handleSubmit(props.of, props.onSubmit);
952
+ const handler = computed(() => handleSubmit(props.of, props.onSubmit));
953
953
  return (_ctx, _cache) => {
954
954
  return openBlock(), createElementBlock("form", {
955
955
  novalidate: "",
956
- onSubmit: _cache[0] || (_cache[0] = (...args) => unref(handler) && unref(handler)(...args))
957
- }, [renderSlot(_ctx.$slots, "default")], 32);
956
+ ref: (element) => {
957
+ if (element) __props.of[unref(INTERNAL)].element = element;
958
+ },
959
+ onSubmit: _cache[0] || (_cache[0] = (...args) => handler.value && handler.value(...args))
960
+ }, [renderSlot(_ctx.$slots, "default")], 544);
958
961
  };
959
962
  }
960
963
  });
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.2",
4
+ "version": "0.7.3",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -44,7 +44,7 @@
44
44
  "vue": "^3.5.18",
45
45
  "vue-tsc": "^3.0.4",
46
46
  "@formisch/methods": "0.7.0",
47
- "@formisch/core": "0.6.2",
47
+ "@formisch/core": "0.6.3",
48
48
  "@formisch/eslint-config": "0.1.0"
49
49
  },
50
50
  "peerDependencies": {