@formisch/svelte 0.5.6 → 0.6.0

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.
@@ -547,7 +547,7 @@ declare function validateIfRequired(internalFormStore: InternalFormStore, intern
547
547
  /**
548
548
  * Framework type.
549
549
  */
550
- type Framework = "preact" | "qwik" | "solid" | "svelte" | "vanilla" | "vue";
550
+ type Framework = "preact" | "qwik" | "react" | "solid" | "svelte" | "vue";
551
551
  //#endregion
552
552
  //#region src/framework/index.svelte.d.ts
553
553
  /**
@@ -86,7 +86,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
86
86
  initializeFieldStore(internalFieldStore.children[index], schema.item, initialInput[index], path);
87
87
  path.pop();
88
88
  }
89
- } else for (let index = 0; index < schema.items; index++) {
89
+ } else for (let index = 0; index < schema.items.length; index++) {
90
90
  internalFieldStore.children[index] = {};
91
91
  path.push(index);
92
92
  initializeFieldStore(internalFieldStore.children[index], schema.items[index], initialInput?.[index], path);
@@ -426,7 +426,7 @@ function setNestedInput(internalFieldStore, input) {
426
426
  }
427
427
  for (let index = 0; index < arrayInput.length; index++) setNestedInput(internalFieldStore.children[index], arrayInput[index]);
428
428
  internalFieldStore.input.value = input == null ? input : true;
429
- internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== items.length;
429
+ internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== internalFieldStore.items.value.length;
430
430
  } else if (internalFieldStore.kind === "object") {
431
431
  for (const key in internalFieldStore.children) setNestedInput(internalFieldStore.children[key], input?.[key]);
432
432
  internalFieldStore.input.value = input == null ? input : true;
@@ -29,6 +29,10 @@ export function useField(form, config) {
29
29
  get isValid() {
30
30
  return isValid;
31
31
  },
32
+ onInput(value) {
33
+ setFieldInput(internalFormStore, path, value);
34
+ validateIfRequired(internalFormStore, internalFieldStore, 'input');
35
+ },
32
36
  props: {
33
37
  get name() {
34
38
  return internalFieldStore.name;
@@ -62,6 +62,10 @@ export interface FieldStore<TSchema extends Schema = Schema, TFieldPath extends
62
62
  * Whether the field is valid according to the schema.
63
63
  */
64
64
  readonly isValid: boolean;
65
+ /**
66
+ * Sets the field input value programmatically.
67
+ */
68
+ readonly onInput: (value: PartialValues<PathValue<v.InferInput<TSchema>, TFieldPath>>) => void;
65
69
  /**
66
70
  * The props for the field element.
67
71
  */
@@ -1,2 +1,9 @@
1
1
  import type { MaybeGetter } from '../../types/index';
2
+ /**
3
+ * Unwraps a value that may be a getter function.
4
+ *
5
+ * @param value The value or getter function.
6
+ *
7
+ * @returns The unwrapped value.
8
+ */
2
9
  export declare function unwrap<T>(value: MaybeGetter<T>): T;
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.5.6",
4
+ "version": "0.6.0",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -37,7 +37,6 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@eslint/compat": "^1.3.2",
40
- "@eslint/js": "^9.35.0",
41
40
  "@sveltejs/adapter-auto": "^6.1.0",
42
41
  "@sveltejs/kit": "^2.37.1",
43
42
  "@sveltejs/package": "^2.5.0",
@@ -49,11 +48,11 @@
49
48
  "svelte": "^5.38.8",
50
49
  "svelte-check": "^4.3.1",
51
50
  "typescript": "^5.9.2",
52
- "typescript-eslint": "^8.43.0",
53
51
  "valibot": "^1.2.0",
54
52
  "vite": "^7.1.5",
55
- "@formisch/core": "0.4.5",
56
- "@formisch/methods": "0.5.2"
53
+ "@formisch/core": "0.5.0",
54
+ "@formisch/eslint-config": "0.1.0",
55
+ "@formisch/methods": "0.6.0"
57
56
  },
58
57
  "peerDependencies": {
59
58
  "svelte": "^5.29.0",