@conform-to/dom 0.7.0-pre.3 → 0.7.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/intent.js +22 -18
- package/intent.mjs +22 -18
- package/package.json +1 -1
package/intent.js
CHANGED
|
@@ -72,25 +72,29 @@ function requestIntent(form, buttonProps) {
|
|
|
72
72
|
dom.requestSubmit(form, submitter);
|
|
73
73
|
}
|
|
74
74
|
function parseIntent(intent) {
|
|
75
|
-
var
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
var seperatorIndex = intent.indexOf('/');
|
|
76
|
+
if (seperatorIndex > -1) {
|
|
77
|
+
var type = intent.slice(0, seperatorIndex);
|
|
78
|
+
var _payload = intent.slice(seperatorIndex + 1);
|
|
79
|
+
if (typeof _payload !== 'undefined') {
|
|
80
|
+
try {
|
|
81
|
+
switch (type) {
|
|
82
|
+
case 'validate':
|
|
83
|
+
return {
|
|
84
|
+
type,
|
|
85
|
+
payload: _payload
|
|
86
|
+
};
|
|
87
|
+
case 'list':
|
|
88
|
+
return {
|
|
89
|
+
type,
|
|
90
|
+
payload: JSON.parse(_payload)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
} catch (error) {
|
|
94
|
+
throw new Error("Failed parsing intent: ".concat(intent), {
|
|
95
|
+
cause: error
|
|
96
|
+
});
|
|
89
97
|
}
|
|
90
|
-
} catch (error) {
|
|
91
|
-
throw new Error("Failed parsing intent: ".concat(intent), {
|
|
92
|
-
cause: error
|
|
93
|
-
});
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
return null;
|
package/intent.mjs
CHANGED
|
@@ -68,25 +68,29 @@ function requestIntent(form, buttonProps) {
|
|
|
68
68
|
requestSubmit(form, submitter);
|
|
69
69
|
}
|
|
70
70
|
function parseIntent(intent) {
|
|
71
|
-
var
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
71
|
+
var seperatorIndex = intent.indexOf('/');
|
|
72
|
+
if (seperatorIndex > -1) {
|
|
73
|
+
var type = intent.slice(0, seperatorIndex);
|
|
74
|
+
var _payload = intent.slice(seperatorIndex + 1);
|
|
75
|
+
if (typeof _payload !== 'undefined') {
|
|
76
|
+
try {
|
|
77
|
+
switch (type) {
|
|
78
|
+
case 'validate':
|
|
79
|
+
return {
|
|
80
|
+
type,
|
|
81
|
+
payload: _payload
|
|
82
|
+
};
|
|
83
|
+
case 'list':
|
|
84
|
+
return {
|
|
85
|
+
type,
|
|
86
|
+
payload: JSON.parse(_payload)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
throw new Error("Failed parsing intent: ".concat(intent), {
|
|
91
|
+
cause: error
|
|
92
|
+
});
|
|
85
93
|
}
|
|
86
|
-
} catch (error) {
|
|
87
|
-
throw new Error("Failed parsing intent: ".concat(intent), {
|
|
88
|
-
cause: error
|
|
89
|
-
});
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
return null;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A set of opinionated helpers built on top of the Constraint Validation API",
|
|
4
4
|
"homepage": "https://conform.guide",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.7.0
|
|
6
|
+
"version": "0.7.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"module": "index.mjs",
|
|
9
9
|
"types": "index.d.ts",
|