@formisch/svelte 0.5.1 → 0.5.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/dist/core/index.svelte.d.ts +0 -3
- package/dist/core/index.svelte.js +22 -23
- package/package.json +2 -2
|
@@ -548,9 +548,6 @@ declare function validateIfRequired(internalFormStore: InternalFormStore, intern
|
|
|
548
548
|
* Framework type.
|
|
549
549
|
*/
|
|
550
550
|
type Framework = "preact" | "qwik" | "solid" | "svelte" | "vue";
|
|
551
|
-
/**
|
|
552
|
-
* The current framework being used.
|
|
553
|
-
*/
|
|
554
551
|
//#endregion
|
|
555
552
|
//#region src/framework/index.svelte.d.ts
|
|
556
553
|
/**
|
|
@@ -71,9 +71,9 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
71
71
|
const initialElements = [];
|
|
72
72
|
internalFieldStore.initialElements = initialElements;
|
|
73
73
|
internalFieldStore.elements = initialElements;
|
|
74
|
-
internalFieldStore.errors = createSignal(null);
|
|
75
|
-
internalFieldStore.isTouched = createSignal(false);
|
|
76
|
-
internalFieldStore.isDirty = createSignal(false);
|
|
74
|
+
internalFieldStore.errors = /* @__PURE__ */ createSignal(null);
|
|
75
|
+
internalFieldStore.isTouched = /* @__PURE__ */ createSignal(false);
|
|
76
|
+
internalFieldStore.isDirty = /* @__PURE__ */ createSignal(false);
|
|
77
77
|
if (schema.type === "array" || schema.type === "loose_tuple" || schema.type === "strict_tuple" || schema.type === "tuple") {
|
|
78
78
|
if (internalFieldStore.kind && internalFieldStore.kind !== "array") throw new Error(`Store initialized as "${internalFieldStore.kind}" cannot be reinitialized as "array"`);
|
|
79
79
|
internalFieldStore.kind = "array";
|
|
@@ -93,13 +93,13 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
93
93
|
path.pop();
|
|
94
94
|
}
|
|
95
95
|
const arrayInput = nullish && initialInput == null ? initialInput : true;
|
|
96
|
-
internalFieldStore.initialInput = createSignal(arrayInput);
|
|
97
|
-
internalFieldStore.startInput = createSignal(arrayInput);
|
|
98
|
-
internalFieldStore.input = createSignal(arrayInput);
|
|
96
|
+
internalFieldStore.initialInput = /* @__PURE__ */ createSignal(arrayInput);
|
|
97
|
+
internalFieldStore.startInput = /* @__PURE__ */ createSignal(arrayInput);
|
|
98
|
+
internalFieldStore.input = /* @__PURE__ */ createSignal(arrayInput);
|
|
99
99
|
const initialItems = internalFieldStore.children.map(createId);
|
|
100
|
-
internalFieldStore.initialItems = createSignal(initialItems);
|
|
101
|
-
internalFieldStore.startItems = createSignal(initialItems);
|
|
102
|
-
internalFieldStore.items = createSignal(initialItems);
|
|
100
|
+
internalFieldStore.initialItems = /* @__PURE__ */ createSignal(initialItems);
|
|
101
|
+
internalFieldStore.startItems = /* @__PURE__ */ createSignal(initialItems);
|
|
102
|
+
internalFieldStore.items = /* @__PURE__ */ createSignal(initialItems);
|
|
103
103
|
}
|
|
104
104
|
} else if (schema.type === "loose_object" || schema.type === "object" || schema.type === "strict_object") {
|
|
105
105
|
if (internalFieldStore.kind && internalFieldStore.kind !== "object") throw new Error(`Store initialized as "${internalFieldStore.kind}" cannot be reinitialized as "object"`);
|
|
@@ -113,16 +113,16 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
113
113
|
path.pop();
|
|
114
114
|
}
|
|
115
115
|
const objectInput = nullish && initialInput == null ? initialInput : true;
|
|
116
|
-
internalFieldStore.initialInput = createSignal(objectInput);
|
|
117
|
-
internalFieldStore.startInput = createSignal(objectInput);
|
|
118
|
-
internalFieldStore.input = createSignal(objectInput);
|
|
116
|
+
internalFieldStore.initialInput = /* @__PURE__ */ createSignal(objectInput);
|
|
117
|
+
internalFieldStore.startInput = /* @__PURE__ */ createSignal(objectInput);
|
|
118
|
+
internalFieldStore.input = /* @__PURE__ */ createSignal(objectInput);
|
|
119
119
|
}
|
|
120
120
|
} else {
|
|
121
121
|
internalFieldStore.kind = "value";
|
|
122
122
|
if (internalFieldStore.kind === "value") {
|
|
123
|
-
internalFieldStore.initialInput = createSignal(initialInput);
|
|
124
|
-
internalFieldStore.startInput = createSignal(initialInput);
|
|
125
|
-
internalFieldStore.input = createSignal(initialInput);
|
|
123
|
+
internalFieldStore.initialInput = /* @__PURE__ */ createSignal(initialInput);
|
|
124
|
+
internalFieldStore.startInput = /* @__PURE__ */ createSignal(initialInput);
|
|
125
|
+
internalFieldStore.input = /* @__PURE__ */ createSignal(initialInput);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -324,9 +324,8 @@ function getElementInput(element, internalFieldStore) {
|
|
|
324
324
|
return element.checked;
|
|
325
325
|
}
|
|
326
326
|
if (element.type === "radio") {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
return prevValue.filter((value) => value !== element.value);
|
|
327
|
+
if (element.checked) return element.value;
|
|
328
|
+
return untrack(() => /* @__PURE__ */ getFieldInput(internalFieldStore));
|
|
330
329
|
}
|
|
331
330
|
if (element.type === "file") {
|
|
332
331
|
if (element.multiple) return [...element.files];
|
|
@@ -526,9 +525,9 @@ function createFormStore(config, parse) {
|
|
|
526
525
|
store.validate = config.validate ?? "submit";
|
|
527
526
|
store.revalidate = config.revalidate ?? "input";
|
|
528
527
|
store.parse = parse;
|
|
529
|
-
store.isSubmitting = createSignal(false);
|
|
530
|
-
store.isSubmitted = createSignal(false);
|
|
531
|
-
store.isValidating = createSignal(false);
|
|
528
|
+
store.isSubmitting = /* @__PURE__ */ createSignal(false);
|
|
529
|
+
store.isSubmitted = /* @__PURE__ */ createSignal(false);
|
|
530
|
+
store.isValidating = /* @__PURE__ */ createSignal(false);
|
|
532
531
|
return store;
|
|
533
532
|
}
|
|
534
533
|
|
|
@@ -547,7 +546,7 @@ function createFormStore(config, parse) {
|
|
|
547
546
|
async function validateFormInput(internalFormStore, config) {
|
|
548
547
|
internalFormStore.validators++;
|
|
549
548
|
internalFormStore.isValidating.value = true;
|
|
550
|
-
const result = await internalFormStore.parse(untrack(() => getFieldInput(internalFormStore)));
|
|
549
|
+
const result = await internalFormStore.parse(untrack(() => /* @__PURE__ */ getFieldInput(internalFormStore)));
|
|
551
550
|
let rootErrors;
|
|
552
551
|
let nestedErrors;
|
|
553
552
|
if (result.issues) {
|
|
@@ -599,7 +598,7 @@ async function validateFormInput(internalFormStore, config) {
|
|
|
599
598
|
* @param validationMode The validation mode that triggered this check.
|
|
600
599
|
*/
|
|
601
600
|
function validateIfRequired(internalFormStore, internalFieldStore, validationMode) {
|
|
602
|
-
if (validationMode === (internalFormStore.validate === "initial" || (internalFormStore.validate === "submit" ? untrack(() => internalFormStore.isSubmitted.value) : untrack(() => getFieldBool(internalFieldStore, "errors"))) ? internalFormStore.revalidate : internalFormStore.validate)) validateFormInput(internalFormStore);
|
|
601
|
+
if (validationMode === (internalFormStore.validate === "initial" || (internalFormStore.validate === "submit" ? untrack(() => internalFormStore.isSubmitted.value) : untrack(() => /* @__PURE__ */ getFieldBool(internalFieldStore, "errors"))) ? internalFormStore.revalidate : internalFormStore.validate)) validateFormInput(internalFormStore);
|
|
603
602
|
}
|
|
604
603
|
|
|
605
604
|
//#endregion
|
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.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabian Hiller",
|
|
7
7
|
"homepage": "https://formisch.dev",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"typescript": "^5.9.2",
|
|
52
52
|
"typescript-eslint": "^8.43.0",
|
|
53
53
|
"vite": "^7.1.5",
|
|
54
|
-
"@formisch/core": "0.4.
|
|
54
|
+
"@formisch/core": "0.4.3",
|
|
55
55
|
"@formisch/methods": "0.5.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|