@steveesamson/microform 0.0.8 → 0.0.10
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/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/types.d.ts +3 -3
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
|
-
import type {
|
|
3
|
-
declare const
|
|
4
|
-
export default
|
|
2
|
+
import type { MicroFormProps, MicroFormReturn } from './types.js';
|
|
3
|
+
declare const microForm: (props?: MicroFormProps) => MicroFormReturn;
|
|
4
|
+
export default microForm;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
2
|
import { writable, derived, get } from 'svelte/store';
|
|
3
3
|
import { formAction } from './form-action.js';
|
|
4
|
-
const
|
|
4
|
+
const microForm = (props) => {
|
|
5
5
|
// form default values
|
|
6
6
|
const data = props?.data || {};
|
|
7
7
|
// form values
|
|
@@ -62,4 +62,4 @@ const useForm = (props) => {
|
|
|
62
62
|
reset,
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
export default
|
|
65
|
+
export default microForm;
|
package/dist/types.d.ts
CHANGED
|
@@ -34,15 +34,15 @@ export type FormSubmit = (_data: Params) => void;
|
|
|
34
34
|
export type FormOptions = {
|
|
35
35
|
validateEvent: ValidateEvent;
|
|
36
36
|
};
|
|
37
|
-
export type
|
|
37
|
+
export type MicroFormProps = {
|
|
38
38
|
data?: Params;
|
|
39
39
|
options?: FormOptions;
|
|
40
40
|
};
|
|
41
41
|
export type FormSanity = Readable<boolean>;
|
|
42
|
-
export type
|
|
42
|
+
export type MicroFormReturn = {
|
|
43
43
|
values: FormValues;
|
|
44
44
|
errors: FormErrors;
|
|
45
|
-
form: (node: HTMLElement, eventProps?: ActionOptions) =>
|
|
45
|
+
form: (node: HTMLElement, eventProps?: ActionOptions) => FormReturn;
|
|
46
46
|
valid: FormSanity;
|
|
47
47
|
submit: (formNode: HTMLFormElement, handler: FormSubmit) => void;
|
|
48
48
|
onsubmit: (handler: FormSubmit) => (e: Event) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steveesamson/microform",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"postbuild": "touch ./docs/.nojekyll",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
|
-
"svelte": "./dist/index.js"
|
|
24
|
+
"svelte": "./dist/index.js",
|
|
25
|
+
"default": "./dist/index.js"
|
|
25
26
|
}
|
|
26
27
|
},
|
|
27
28
|
"author": "Steve S. Samson <stevee.samson@gmail.com> (http://github.com/steveesamson)",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"typescript": "^5.0.0",
|
|
58
59
|
"vite": "^5.0.3"
|
|
59
60
|
},
|
|
60
|
-
"
|
|
61
|
+
"default": "./dist/index.js",
|
|
61
62
|
"types": "./dist/index.d.ts",
|
|
62
63
|
"type": "module",
|
|
63
64
|
"keywords": [
|