@formisch/solid 0.9.3 → 0.9.5

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
@@ -394,6 +394,7 @@ function focus(form, config) {
394
394
  function getAllErrors(form) {
395
395
  let allErrors = null;
396
396
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
397
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
397
398
  const errors = internalFieldStore.errors.value;
398
399
  if (errors) if (allErrors) allErrors.push(...errors);
399
400
  else allErrors = [...errors];
@@ -439,7 +440,15 @@ function insert(form, config) {
439
440
  const newItems = [...items];
440
441
  newItems.splice(insertIndex, 0, createUniqueId());
441
442
  internalArrayStore.items.value = newItems;
442
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
443
+ for (let index = items.length; index > insertIndex; index--) {
444
+ if (!internalArrayStore.children[index]) {
445
+ const path = JSON.parse(internalArrayStore.name);
446
+ internalArrayStore.children[index] = {};
447
+ path.push(index);
448
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
449
+ }
450
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
451
+ }
443
452
  if (!internalArrayStore.children[insertIndex]) {
444
453
  const path = JSON.parse(internalArrayStore.name);
445
454
  internalArrayStore.children[insertIndex] = {};
package/dist/dev.jsx CHANGED
@@ -392,6 +392,7 @@ function focus(form, config) {
392
392
  function getAllErrors(form) {
393
393
  let allErrors = null;
394
394
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
395
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
395
396
  const errors = internalFieldStore.errors.value;
396
397
  if (errors) if (allErrors) allErrors.push(...errors);
397
398
  else allErrors = [...errors];
@@ -437,7 +438,15 @@ function insert(form, config) {
437
438
  const newItems = [...items];
438
439
  newItems.splice(insertIndex, 0, createId());
439
440
  internalArrayStore.items.value = newItems;
440
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
441
+ for (let index = items.length; index > insertIndex; index--) {
442
+ if (!internalArrayStore.children[index]) {
443
+ const path = JSON.parse(internalArrayStore.name);
444
+ internalArrayStore.children[index] = {};
445
+ path.push(index);
446
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
447
+ }
448
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
449
+ }
441
450
  if (!internalArrayStore.children[insertIndex]) {
442
451
  const path = JSON.parse(internalArrayStore.name);
443
452
  internalArrayStore.children[insertIndex] = {};
package/dist/index.d.ts CHANGED
@@ -1035,7 +1035,7 @@ type FormProps<TSchema extends Schema = Schema> = Omit<JSX.FormHTMLAttributes<HT
1035
1035
  /**
1036
1036
  * The submit handler called when the form is submitted and validation succeeds.
1037
1037
  */
1038
- readonly onSubmit: SubmitHandler<TSchema> | SubmitEventHandler<TSchema>;
1038
+ readonly onSubmit: SubmitEventHandler<TSchema>;
1039
1039
  };
1040
1040
  /**
1041
1041
  * Form component that manages form submission and applies internal state.
package/dist/index.js CHANGED
@@ -394,6 +394,7 @@ function focus(form, config) {
394
394
  function getAllErrors(form) {
395
395
  let allErrors = null;
396
396
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
397
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
397
398
  const errors = internalFieldStore.errors.value;
398
399
  if (errors) if (allErrors) allErrors.push(...errors);
399
400
  else allErrors = [...errors];
@@ -439,7 +440,15 @@ function insert(form, config) {
439
440
  const newItems = [...items];
440
441
  newItems.splice(insertIndex, 0, createUniqueId());
441
442
  internalArrayStore.items.value = newItems;
442
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
443
+ for (let index = items.length; index > insertIndex; index--) {
444
+ if (!internalArrayStore.children[index]) {
445
+ const path = JSON.parse(internalArrayStore.name);
446
+ internalArrayStore.children[index] = {};
447
+ path.push(index);
448
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
449
+ }
450
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
451
+ }
443
452
  if (!internalArrayStore.children[insertIndex]) {
444
453
  const path = JSON.parse(internalArrayStore.name);
445
454
  internalArrayStore.children[insertIndex] = {};
package/dist/index.jsx CHANGED
@@ -392,6 +392,7 @@ function focus(form, config) {
392
392
  function getAllErrors(form) {
393
393
  let allErrors = null;
394
394
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
395
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
395
396
  const errors = internalFieldStore.errors.value;
396
397
  if (errors) if (allErrors) allErrors.push(...errors);
397
398
  else allErrors = [...errors];
@@ -437,7 +438,15 @@ function insert(form, config) {
437
438
  const newItems = [...items];
438
439
  newItems.splice(insertIndex, 0, createId());
439
440
  internalArrayStore.items.value = newItems;
440
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
441
+ for (let index = items.length; index > insertIndex; index--) {
442
+ if (!internalArrayStore.children[index]) {
443
+ const path = JSON.parse(internalArrayStore.name);
444
+ internalArrayStore.children[index] = {};
445
+ path.push(index);
446
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
447
+ }
448
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
449
+ }
441
450
  if (!internalArrayStore.children[insertIndex]) {
442
451
  const path = JSON.parse(internalArrayStore.name);
443
452
  internalArrayStore.children[insertIndex] = {};
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.9.3",
4
+ "version": "0.9.5",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -43,7 +43,17 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
+ "scripts": {
47
+ "lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
48
+ "lint.fix": "eslint \"src/**/*.ts*\" --fix",
49
+ "format": "prettier --write ./src",
50
+ "format.check": "prettier --check ./src",
51
+ "build": "tsup && tsdown"
52
+ },
46
53
  "devDependencies": {
54
+ "@formisch/core": "workspace:*",
55
+ "@formisch/eslint-config": "workspace:*",
56
+ "@formisch/methods": "workspace:*",
47
57
  "@vitest/coverage-v8": "^3.2.4",
48
58
  "eslint": "^9.31.0",
49
59
  "eslint-plugin-solid": "^0.14.5",
@@ -56,10 +66,7 @@
56
66
  "tsup-preset-solid": "^2.2.0",
57
67
  "typescript": "^5.8.3",
58
68
  "valibot": "^1.2.0",
59
- "vitest": "3.2.4",
60
- "@formisch/core": "0.6.3",
61
- "@formisch/eslint-config": "0.1.0",
62
- "@formisch/methods": "0.7.0"
69
+ "vitest": "3.2.4"
63
70
  },
64
71
  "peerDependencies": {
65
72
  "solid-js": "^1.6.0",
@@ -72,12 +79,5 @@
72
79
  }
73
80
  },
74
81
  "browser": {},
75
- "typesVersions": {},
76
- "scripts": {
77
- "lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
78
- "lint.fix": "eslint \"src/**/*.ts*\" --fix",
79
- "format": "prettier --write ./src",
80
- "format.check": "prettier --check ./src",
81
- "build": "tsup && tsdown"
82
- }
83
- }
82
+ "typesVersions": {}
83
+ }