mayoiga 0.1.4 → 0.1.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/component.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +17 -17
- package/src/component.tsx +1 -1
- package/src/index.ts +2 -2
- package/yarn.lock +504 -341
package/dist/component.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SliceProps, FieldProps, StateRestriction, Controller } from './index';
|
|
2
|
-
declare type ControlledComponentProps<State, Props> = Props & {
|
|
2
|
+
declare type ControlledComponentProps<State extends StateRestriction, Props> = Props & {
|
|
3
3
|
controller: Controller<State>;
|
|
4
4
|
};
|
|
5
5
|
export declare function Slicer<State extends StateRestriction, R extends ReadonlyArray<unknown>>(props: ControlledComponentProps<State, SliceProps<State, R>>): JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare type SliceProps<State extends StateRestriction, Selected extends
|
|
|
43
43
|
*/
|
|
44
44
|
deps?: ReadonlyArray<unknown>;
|
|
45
45
|
};
|
|
46
|
-
declare type FormControllerBehavior<StateBeforeValidation> = {
|
|
46
|
+
declare type FormControllerBehavior<StateBeforeValidation extends StateRestriction> = {
|
|
47
47
|
/** For testing */
|
|
48
48
|
peek: (eyeball: (prev: FullFormState<StateBeforeValidation>) => void) => (prev: FullFormState<StateBeforeValidation>) => FullFormState<StateBeforeValidation>;
|
|
49
49
|
reset: () => () => FullFormState<StateBeforeValidation>;
|
|
@@ -101,6 +101,6 @@ declare type FormHook<State extends StateRestriction, Schema extends ZodType<any
|
|
|
101
101
|
/**
|
|
102
102
|
* @typeParam InitialState should be shallow
|
|
103
103
|
*/
|
|
104
|
-
export declare function createFormHook<StateBeforeValidation, Schema extends ZodType<any, any, any>>(initialState: StateBeforeValidation, schema: Schema): FormHook<StateBeforeValidation, Schema>;
|
|
104
|
+
export declare function createFormHook<StateBeforeValidation extends StateRestriction, Schema extends ZodType<any, any, any>>(initialState: StateBeforeValidation, schema: Schema): FormHook<StateBeforeValidation, Schema>;
|
|
105
105
|
export declare function useFormSlice<State extends StateRestriction, Sliced>(formController: Controller<State>, selector: (s: FullFormState<State>) => Sliced): readonly [Sliced, ActionsCanBePublic<State>];
|
|
106
106
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mayoiga",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Type safe hook based form library for React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,24 +46,24 @@
|
|
|
46
46
|
"nozuchi": "^0.0.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@testing-library/react": "^13.
|
|
50
|
-
"@testing-library/user-event": "^14.
|
|
49
|
+
"@testing-library/react": "^13.4.0",
|
|
50
|
+
"@testing-library/user-event": "^14.4.3",
|
|
51
51
|
"@types/node": "^17.0.23",
|
|
52
|
-
"@types/react": "^18.0.
|
|
52
|
+
"@types/react": "^18.0.19",
|
|
53
53
|
"@types/use-sync-external-store": "^0.0.3",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
55
|
-
"@typescript-eslint/parser": "^5.
|
|
56
|
-
"eslint": "^8.
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
55
|
+
"@typescript-eslint/parser": "^5.36.2",
|
|
56
|
+
"eslint": "^8.23.0",
|
|
57
57
|
"eslint-plugin-import": "^2.26.0",
|
|
58
|
-
"eslint-plugin-testing-library": "^5.3
|
|
59
|
-
"jsdom": "^
|
|
60
|
-
"prettier": "^2.
|
|
61
|
-
"react": "^18.
|
|
62
|
-
"react-dom": "^18.
|
|
63
|
-
"typedoc": "^0.
|
|
64
|
-
"typescript": "^4.
|
|
65
|
-
"use-sync-external-store": "^1.
|
|
66
|
-
"vitest": "^0.
|
|
67
|
-
"zod": "^3.
|
|
58
|
+
"eslint-plugin-testing-library": "^5.6.3",
|
|
59
|
+
"jsdom": "^20.0.0",
|
|
60
|
+
"prettier": "^2.7.1",
|
|
61
|
+
"react": "^18.2.0",
|
|
62
|
+
"react-dom": "^18.2.0",
|
|
63
|
+
"typedoc": "^0.23.14",
|
|
64
|
+
"typescript": "^4.8.3",
|
|
65
|
+
"use-sync-external-store": "^1.2.0",
|
|
66
|
+
"vitest": "^0.23.2",
|
|
67
|
+
"zod": "^3.19.1"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/component.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type {SliceProps, FieldProps, StateRestriction, Controller} from './index';
|
|
4
4
|
|
|
5
|
-
type ControlledComponentProps<State, Props> = Props & {
|
|
5
|
+
type ControlledComponentProps<State extends StateRestriction, Props> = Props & {
|
|
6
6
|
controller: Controller<State>;
|
|
7
7
|
};
|
|
8
8
|
|
package/src/index.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type SliceProps<State extends StateRestriction, Selected extends Readonly
|
|
|
57
57
|
deps?: ReadonlyArray<unknown>;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
type FormControllerBehavior<StateBeforeValidation> = {
|
|
60
|
+
type FormControllerBehavior<StateBeforeValidation extends StateRestriction> = {
|
|
61
61
|
/** For testing */
|
|
62
62
|
peek: (
|
|
63
63
|
eyeball: (prev: FullFormState<StateBeforeValidation>) => void,
|
|
@@ -234,7 +234,7 @@ type FormHook<State extends StateRestriction, Schema extends ZodType<any, any, a
|
|
|
234
234
|
/**
|
|
235
235
|
* @typeParam InitialState should be shallow
|
|
236
236
|
*/
|
|
237
|
-
export function createFormHook<StateBeforeValidation, Schema extends ZodType<any, any, any>>(
|
|
237
|
+
export function createFormHook<StateBeforeValidation extends StateRestriction, Schema extends ZodType<any, any, any>>(
|
|
238
238
|
initialState: StateBeforeValidation,
|
|
239
239
|
schema: Schema,
|
|
240
240
|
): FormHook<StateBeforeValidation, Schema> {
|