@formisch/solid 0.7.5 → 0.8.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.
package/dist/dev.js CHANGED
@@ -43,7 +43,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
43
43
  initializeFieldStore(internalFieldStore.children[index], schema.item, initialInput[index], path);
44
44
  path.pop();
45
45
  }
46
- } else for (let index = 0; index < schema.items; index++) {
46
+ } else for (let index = 0; index < schema.items.length; index++) {
47
47
  internalFieldStore.children[index] = {};
48
48
  path.push(index);
49
49
  initializeFieldStore(internalFieldStore.children[index], schema.items[index], initialInput?.[index], path);
@@ -277,7 +277,7 @@ function setNestedInput(internalFieldStore, input) {
277
277
  }
278
278
  for (let index = 0; index < arrayInput.length; index++) setNestedInput(internalFieldStore.children[index], arrayInput[index]);
279
279
  internalFieldStore.input.value = input == null ? input : true;
280
- internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== items.length;
280
+ internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== internalFieldStore.items.value.length;
281
281
  } else if (internalFieldStore.kind === "object") {
282
282
  for (const key in internalFieldStore.children) setNestedInput(internalFieldStore.children[key], input?.[key]);
283
283
  internalFieldStore.input.value = input == null ? input : true;
@@ -652,6 +652,14 @@ function useField(form, config) {
652
652
  get isValid() {
653
653
  return getIsValid();
654
654
  },
655
+ onInput(value) {
656
+ setFieldInput(getInternalFormStore(), getPath(), value);
657
+ validateIfRequired(
658
+ getInternalFormStore(),
659
+ getInternalFieldStore(),
660
+ "input"
661
+ );
662
+ },
655
663
  props: {
656
664
  get name() {
657
665
  return getInternalFieldStore().name;
package/dist/dev.jsx CHANGED
@@ -41,7 +41,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
41
41
  initializeFieldStore(internalFieldStore.children[index], schema.item, initialInput[index], path);
42
42
  path.pop();
43
43
  }
44
- } else for (let index = 0; index < schema.items; index++) {
44
+ } else for (let index = 0; index < schema.items.length; index++) {
45
45
  internalFieldStore.children[index] = {};
46
46
  path.push(index);
47
47
  initializeFieldStore(internalFieldStore.children[index], schema.items[index], initialInput?.[index], path);
@@ -275,7 +275,7 @@ function setNestedInput(internalFieldStore, input) {
275
275
  }
276
276
  for (let index = 0; index < arrayInput.length; index++) setNestedInput(internalFieldStore.children[index], arrayInput[index]);
277
277
  internalFieldStore.input.value = input == null ? input : true;
278
- internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== items.length;
278
+ internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== internalFieldStore.items.value.length;
279
279
  } else if (internalFieldStore.kind === "object") {
280
280
  for (const key in internalFieldStore.children) setNestedInput(internalFieldStore.children[key], input?.[key]);
281
281
  internalFieldStore.input.value = input == null ? input : true;
@@ -657,6 +657,14 @@ function useField(form, config) {
657
657
  get isValid() {
658
658
  return getIsValid();
659
659
  },
660
+ onInput(value) {
661
+ setFieldInput(getInternalFormStore(), getPath(), value);
662
+ validateIfRequired(
663
+ getInternalFormStore(),
664
+ getInternalFieldStore(),
665
+ "input"
666
+ );
667
+ },
660
668
  props: {
661
669
  get name() {
662
670
  return getInternalFieldStore().name;
package/dist/index.d.ts CHANGED
@@ -860,6 +860,10 @@ interface FieldStore<TSchema extends Schema = Schema, TFieldPath extends Require
860
860
  */
861
861
  readonly isValid: boolean;
862
862
  /**
863
+ * Sets the field input value programmatically.
864
+ */
865
+ readonly onInput: (value: PartialValues<PathValue<v.InferInput<TSchema>, TFieldPath>>) => void;
866
+ /**
863
867
  * The props to spread onto the field element for integration.
864
868
  */
865
869
  readonly props: FieldElementProps;
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
43
43
  initializeFieldStore(internalFieldStore.children[index], schema.item, initialInput[index], path);
44
44
  path.pop();
45
45
  }
46
- } else for (let index = 0; index < schema.items; index++) {
46
+ } else for (let index = 0; index < schema.items.length; index++) {
47
47
  internalFieldStore.children[index] = {};
48
48
  path.push(index);
49
49
  initializeFieldStore(internalFieldStore.children[index], schema.items[index], initialInput?.[index], path);
@@ -277,7 +277,7 @@ function setNestedInput(internalFieldStore, input) {
277
277
  }
278
278
  for (let index = 0; index < arrayInput.length; index++) setNestedInput(internalFieldStore.children[index], arrayInput[index]);
279
279
  internalFieldStore.input.value = input == null ? input : true;
280
- internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== items.length;
280
+ internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== internalFieldStore.items.value.length;
281
281
  } else if (internalFieldStore.kind === "object") {
282
282
  for (const key in internalFieldStore.children) setNestedInput(internalFieldStore.children[key], input?.[key]);
283
283
  internalFieldStore.input.value = input == null ? input : true;
@@ -652,6 +652,14 @@ function useField(form, config) {
652
652
  get isValid() {
653
653
  return getIsValid();
654
654
  },
655
+ onInput(value) {
656
+ setFieldInput(getInternalFormStore(), getPath(), value);
657
+ validateIfRequired(
658
+ getInternalFormStore(),
659
+ getInternalFieldStore(),
660
+ "input"
661
+ );
662
+ },
655
663
  props: {
656
664
  get name() {
657
665
  return getInternalFieldStore().name;
package/dist/index.jsx CHANGED
@@ -41,7 +41,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
41
41
  initializeFieldStore(internalFieldStore.children[index], schema.item, initialInput[index], path);
42
42
  path.pop();
43
43
  }
44
- } else for (let index = 0; index < schema.items; index++) {
44
+ } else for (let index = 0; index < schema.items.length; index++) {
45
45
  internalFieldStore.children[index] = {};
46
46
  path.push(index);
47
47
  initializeFieldStore(internalFieldStore.children[index], schema.items[index], initialInput?.[index], path);
@@ -275,7 +275,7 @@ function setNestedInput(internalFieldStore, input) {
275
275
  }
276
276
  for (let index = 0; index < arrayInput.length; index++) setNestedInput(internalFieldStore.children[index], arrayInput[index]);
277
277
  internalFieldStore.input.value = input == null ? input : true;
278
- internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== items.length;
278
+ internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== internalFieldStore.items.value.length;
279
279
  } else if (internalFieldStore.kind === "object") {
280
280
  for (const key in internalFieldStore.children) setNestedInput(internalFieldStore.children[key], input?.[key]);
281
281
  internalFieldStore.input.value = input == null ? input : true;
@@ -657,6 +657,14 @@ function useField(form, config) {
657
657
  get isValid() {
658
658
  return getIsValid();
659
659
  },
660
+ onInput(value) {
661
+ setFieldInput(getInternalFormStore(), getPath(), value);
662
+ validateIfRequired(
663
+ getInternalFormStore(),
664
+ getInternalFieldStore(),
665
+ "input"
666
+ );
667
+ },
660
668
  props: {
661
669
  get name() {
662
670
  return getInternalFieldStore().name;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/solid",
3
3
  "description": "The modular and type-safe form library for SolidJS",
4
- "version": "0.7.5",
4
+ "version": "0.8.0",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -44,12 +44,8 @@
44
44
  "access": "public"
45
45
  },
46
46
  "devDependencies": {
47
- "@eslint/js": "^9.31.0",
48
47
  "@vitest/coverage-v8": "^3.2.4",
49
48
  "eslint": "^9.31.0",
50
- "eslint-plugin-import": "^2.32.0",
51
- "eslint-plugin-jsdoc": "^51.3.4",
52
- "eslint-plugin-security": "^3.0.1",
53
49
  "eslint-plugin-solid": "^0.14.5",
54
50
  "jsdom": "^26.1.0",
55
51
  "rollup": "^4.45.0",
@@ -59,11 +55,11 @@
59
55
  "tsup": "^8.5.0",
60
56
  "tsup-preset-solid": "^2.2.0",
61
57
  "typescript": "^5.8.3",
62
- "typescript-eslint": "^8.36.0",
63
58
  "valibot": "^1.2.0",
64
59
  "vitest": "3.2.4",
65
- "@formisch/core": "0.4.5",
66
- "@formisch/methods": "0.5.2"
60
+ "@formisch/methods": "0.6.0",
61
+ "@formisch/eslint-config": "0.1.0",
62
+ "@formisch/core": "0.5.0"
67
63
  },
68
64
  "peerDependencies": {
69
65
  "solid-js": "^1.6.0",
@@ -78,7 +74,6 @@
78
74
  "browser": {},
79
75
  "typesVersions": {},
80
76
  "scripts": {
81
- "test": "vitest --typecheck",
82
77
  "lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
83
78
  "lint.fix": "eslint \"src/**/*.ts*\" --fix",
84
79
  "format": "prettier --write ./src",