@hairy/react-lib 1.10.0 → 1.11.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/dist/index.d.ts +17 -16
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -20,48 +20,49 @@ declare namespace cls {
|
|
|
20
20
|
var append: (value: any, newClass: any) => any;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
type WrapperTag = keyof JSX.IntrinsicElements | Function;
|
|
24
|
+
type WrapperProps<Kag extends keyof JSX.IntrinsicElements | React.FC | unknown> = {
|
|
25
|
+
tag?: Kag;
|
|
26
|
+
} & (Kag extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[Kag] : unknown) & (Kag extends React.FC<infer P> ? P : unknown);
|
|
26
27
|
declare function wrapper(tag: any, props: unknown, children?: React.ReactNode): react.ReactNode;
|
|
27
28
|
|
|
28
|
-
type CaseProps<
|
|
29
|
+
type CaseProps<Kag> = WrapperProps<Kag> & {
|
|
29
30
|
cond?: BooleanLike;
|
|
30
31
|
children?: ReactNode;
|
|
31
32
|
};
|
|
32
|
-
declare function Case<
|
|
33
|
+
declare function Case<Tag extends WrapperTag>(props: CaseProps<Tag>): ReactNode;
|
|
33
34
|
|
|
34
|
-
type DefaultProps<
|
|
35
|
+
type DefaultProps<Tag> = WrapperProps<Tag> & {
|
|
35
36
|
children?: ReactNode;
|
|
36
37
|
};
|
|
37
|
-
declare function Default<
|
|
38
|
+
declare function Default<Tag extends WrapperTag>(props: DefaultProps<Tag>): ReactNode;
|
|
38
39
|
|
|
39
|
-
type IfProps<
|
|
40
|
+
type IfProps<Kag> = WrapperProps<Kag> & {
|
|
40
41
|
cond?: BooleanLike;
|
|
41
42
|
then?: ReactNode;
|
|
42
43
|
else?: ReactNode;
|
|
43
44
|
children?: ReactNode;
|
|
44
45
|
};
|
|
45
|
-
declare function If<K
|
|
46
|
+
declare function If<K extends WrapperTag>(props: IfProps<K>): ReactNode;
|
|
46
47
|
|
|
47
|
-
type ElseProps<
|
|
48
|
-
declare function Else<
|
|
48
|
+
type ElseProps<Tag> = IfProps<Tag>;
|
|
49
|
+
declare function Else<Tag extends WrapperTag>(props: ElseProps<Tag>): react.ReactNode;
|
|
49
50
|
|
|
50
51
|
interface SwitchProps extends PropsWithChildren {
|
|
51
52
|
value?: BooleanLike;
|
|
52
53
|
}
|
|
53
54
|
declare function Switch(props: SwitchProps): ReactElement<any, string | react.JSXElementConstructor<any>> | null;
|
|
54
55
|
|
|
55
|
-
type ThenProps<
|
|
56
|
-
declare function Then<
|
|
56
|
+
type ThenProps<Tag> = IfProps<Tag>;
|
|
57
|
+
declare function Then<Tag extends WrapperTag>(props: ThenProps<Tag>): react.ReactNode;
|
|
57
58
|
|
|
58
|
-
type UnlessProps<
|
|
59
|
+
type UnlessProps<Tag> = WrapperProps<Tag> & {
|
|
59
60
|
cond?: BooleanLike;
|
|
60
61
|
then?: ReactNode;
|
|
61
62
|
else?: ReactNode;
|
|
62
63
|
children?: ReactNode;
|
|
63
64
|
};
|
|
64
|
-
declare function Unless<
|
|
65
|
+
declare function Unless<Tag extends WrapperTag>(props: UnlessProps<Tag>): ReactNode;
|
|
65
66
|
|
|
66
67
|
interface InjectComponent<P> {
|
|
67
68
|
component: FC<P> | ComponentClass<P>;
|
|
@@ -208,4 +209,4 @@ declare function useStore<S extends object, A extends Actions<S>>(store: Store<S
|
|
|
208
209
|
|
|
209
210
|
type PropsWithDetailedHTML<T = HTMLDivElement> = DetailedHTMLProps<HTMLAttributes<T>, T>;
|
|
210
211
|
|
|
211
|
-
export { type Actions, type ActionsOmitThisParameter, type Argument, type ArgumentArray, type AsyncStoreOptions, type AsyncStorePlainOptions, Case, type CaseProps, Default, type DefaultProps, Else, type ElseProps, type EventBusListener, type FetchRequestInterceptCallback, type FetchResponseInterceptCallback, If, type IfProps, type InjectComponent, Injector, type InjectorProps, type Mapping, type PersistantOptions, type PropsWithDetailedHTML, type ReadonlyArgumentArray, type StateFromFunctionReturningPromise, type Store, type StoreDefine, type StoreOptions, Switch, type SwitchProps, Then, type ThenProps, Trans, type TransProps, Unless, type UnlessProps, type UseAsyncStateOptions, type Value, type WatchCallback, type WatchOptions, type WrapperProps, cls, defineAsyncStore, defineAsyncStorePlain, defineStore, proxyWithPersistant, useAsyncCallback, useAsyncState, useDebounce, useEventBus, useFetchRequestIntercept, useFetchResponseIntercept, useMounted, useStore, useWatch, useWhenever, wrapper };
|
|
212
|
+
export { type Actions, type ActionsOmitThisParameter, type Argument, type ArgumentArray, type AsyncStoreOptions, type AsyncStorePlainOptions, Case, type CaseProps, Default, type DefaultProps, Else, type ElseProps, type EventBusListener, type FetchRequestInterceptCallback, type FetchResponseInterceptCallback, If, type IfProps, type InjectComponent, Injector, type InjectorProps, type Mapping, type PersistantOptions, type PropsWithDetailedHTML, type ReadonlyArgumentArray, type StateFromFunctionReturningPromise, type Store, type StoreDefine, type StoreOptions, Switch, type SwitchProps, Then, type ThenProps, Trans, type TransProps, Unless, type UnlessProps, type UseAsyncStateOptions, type Value, type WatchCallback, type WatchOptions, type WrapperProps, type WrapperTag, cls, defineAsyncStore, defineAsyncStorePlain, defineStore, proxyWithPersistant, useAsyncCallback, useAsyncState, useDebounce, useEventBus, useFetchRequestIntercept, useFetchResponseIntercept, useMounted, useStore, useWatch, useWhenever, wrapper };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hairy/react-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.0",
|
|
5
5
|
"description": "Library for react",
|
|
6
6
|
"author": "Hairyf <wwu710632@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^18.2.0",
|
|
39
39
|
"react-i18next": "^14.1.2",
|
|
40
40
|
"react-use": "^17.6.0",
|
|
41
|
-
"@hairy/utils": "1.
|
|
41
|
+
"@hairy/utils": "1.11.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup",
|