@faasjs/react 8.0.0-beta.5 → 8.0.0-beta.6
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/README.md +23 -17
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +10 -9
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,26 +14,26 @@ React plugin for FaasJS.
|
|
|
14
14
|
- Compatible with [why-did-you-render](https://github.com/welldone-software/why-did-you-render).
|
|
15
15
|
- Additional React functions:
|
|
16
16
|
- Utils:
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
17
|
+
- `equal`: Compare two values for deep equality.
|
|
18
|
+
- `createSplittingContext`: Create a context for code splitting.
|
|
19
|
+
- `useSplittingState`: Create splitting states.
|
|
20
20
|
- Hooks:
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
21
|
+
- `useEqualMemoize`: Memoize a value with deep equality.
|
|
22
|
+
- `useEqualEffect`: Run an effect with deep equality.
|
|
23
|
+
- `useEqualMemo`: Memoize a value with deep equality.
|
|
24
|
+
- `useEqualCallback`: Memoize a callback with deep equality.
|
|
25
|
+
- `useConstant`: Create a constant value with hooks.
|
|
26
|
+
- `usePrevious`: Get the previous value of a state.
|
|
27
|
+
- `useStateRef`: Create a state with a ref.
|
|
28
28
|
- Components:
|
|
29
|
-
-
|
|
30
|
-
-
|
|
29
|
+
- `OptionalWrapper`: Render a component optionally.
|
|
30
|
+
- `ErrorBoundary`: Catch errors in the component tree.
|
|
31
31
|
- Fetch Data:
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
32
|
+
- `faas`: Fetch data from FaasJS.
|
|
33
|
+
- `useFaas`: Fetch data from FaasJS with hooks.
|
|
34
|
+
- `useFaasStream`: Fetch streaming data from FaasJS with hooks.
|
|
35
|
+
- `FaasDataWrapper`: Fetch data from FaasJS with a wrapper component.
|
|
36
|
+
- `withFaasData`: Fetch data from FaasJS using a higher-order component (HOC).
|
|
37
37
|
|
|
38
38
|
## Install
|
|
39
39
|
|
|
@@ -48,6 +48,7 @@ npm install @faasjs/react react
|
|
|
48
48
|
- [faas](functions/faas.md)
|
|
49
49
|
- [FaasReactClient](functions/FaasReactClient.md)
|
|
50
50
|
- [Form](functions/Form.md)
|
|
51
|
+
- [FormInput](functions/FormInput.md)
|
|
51
52
|
- [FormItem](functions/FormItem.md)
|
|
52
53
|
- [getClient](functions/getClient.md)
|
|
53
54
|
- [OptionalWrapper](functions/OptionalWrapper.md)
|
|
@@ -91,6 +92,7 @@ npm install @faasjs/react react
|
|
|
91
92
|
- [FormDefaultRulesOptions](type-aliases/FormDefaultRulesOptions.md)
|
|
92
93
|
- [FormElementTypes](type-aliases/FormElementTypes.md)
|
|
93
94
|
- [FormInputElementProps](type-aliases/FormInputElementProps.md)
|
|
95
|
+
- [FormInputProps](type-aliases/FormInputProps.md)
|
|
94
96
|
- [FormItemName](type-aliases/FormItemName.md)
|
|
95
97
|
- [FormItemProps](type-aliases/FormItemProps.md)
|
|
96
98
|
- [FormLabelElementProps](type-aliases/FormLabelElementProps.md)
|
|
@@ -98,11 +100,15 @@ npm install @faasjs/react react
|
|
|
98
100
|
- [FormProps](type-aliases/FormProps.md)
|
|
99
101
|
- [FormRule](type-aliases/FormRule.md)
|
|
100
102
|
- [FormRules](type-aliases/FormRules.md)
|
|
103
|
+
- [InferFormInputProps](type-aliases/InferFormInputProps.md)
|
|
101
104
|
- [InferFormRulesOptions](type-aliases/InferFormRulesOptions.md)
|
|
105
|
+
- [InferRuleOption](type-aliases/InferRuleOption.md)
|
|
102
106
|
- [OnError](type-aliases/OnError.md)
|
|
103
107
|
- [OptionalWrapperProps](type-aliases/OptionalWrapperProps.md)
|
|
104
108
|
- [Options](type-aliases/Options.md)
|
|
105
109
|
- [ResponseHeaders](type-aliases/ResponseHeaders.md)
|
|
110
|
+
- [StateSetters](type-aliases/StateSetters.md)
|
|
111
|
+
- [StatesWithSetters](type-aliases/StatesWithSetters.md)
|
|
106
112
|
- [useFaasOptions](type-aliases/useFaasOptions.md)
|
|
107
113
|
- [UseFaasStreamOptions](type-aliases/UseFaasStreamOptions.md)
|
|
108
114
|
- [UseFaasStreamResult](type-aliases/UseFaasStreamResult.md)
|
package/dist/index.cjs
CHANGED
|
@@ -748,6 +748,7 @@ exports.FormContextProvider = FormContextProvider;
|
|
|
748
748
|
exports.FormDefaultElements = FormDefaultElements;
|
|
749
749
|
exports.FormDefaultLang = FormDefaultLang;
|
|
750
750
|
exports.FormDefaultRules = FormDefaultRules;
|
|
751
|
+
exports.FormInput = FormInput;
|
|
751
752
|
exports.FormItem = FormItem;
|
|
752
753
|
exports.OptionalWrapper = OptionalWrapper;
|
|
753
754
|
exports.createSplittingContext = createSplittingContext;
|
package/dist/index.d.ts
CHANGED
|
@@ -127,9 +127,7 @@ type FaasReactClientInstance = {
|
|
|
127
127
|
/**
|
|
128
128
|
* Before use faas, you should initialize a FaasReactClient.
|
|
129
129
|
*
|
|
130
|
-
* @
|
|
131
|
-
* @param props.options {Options} The options of client
|
|
132
|
-
* @returns {FaasReactClientInstance}
|
|
130
|
+
* @returns FaasReactClient instance.
|
|
133
131
|
*
|
|
134
132
|
* @example
|
|
135
133
|
* ```ts
|
|
@@ -328,9 +326,6 @@ type InferFormRulesOptions<T> = {
|
|
|
328
326
|
};
|
|
329
327
|
/**
|
|
330
328
|
* Default validation rules for a form.
|
|
331
|
-
*
|
|
332
|
-
* @constant
|
|
333
|
-
* @type {FormRules}
|
|
334
329
|
*/
|
|
335
330
|
declare const FormDefaultRules: FormRules;
|
|
336
331
|
type FormDefaultRulesOptions = InferFormRulesOptions<typeof FormDefaultRules>;
|
|
@@ -341,6 +336,13 @@ type FormInputProps<FormElements extends FormElementTypes = FormElementTypes> =
|
|
|
341
336
|
Input?: ComponentType<FormInputElementProps>;
|
|
342
337
|
props?: InferFormInputProps<FormElements['Input']>;
|
|
343
338
|
};
|
|
339
|
+
declare function FormInput({ name, rules, ...rest }: FormInputProps & {
|
|
340
|
+
name: string;
|
|
341
|
+
rules?: FormDefaultRulesOptions;
|
|
342
|
+
}): react_jsx_runtime.JSX.Element;
|
|
343
|
+
declare namespace FormInput {
|
|
344
|
+
var displayName: string;
|
|
345
|
+
}
|
|
344
346
|
|
|
345
347
|
type FormItemName = string;
|
|
346
348
|
type FormItemProps<FormElements extends FormElementTypes = FormElementTypes, FormRulesOptions extends Record<string, any> = FormDefaultRulesOptions> = {
|
|
@@ -561,9 +563,8 @@ declare function createSplittingContext<T extends Record<string, any>>(defaultVa
|
|
|
561
563
|
use: <NewT extends T = T>() => Readonly<NewT>;
|
|
562
564
|
};
|
|
563
565
|
|
|
564
|
-
type SetPrefix<S extends string | number | symbol> = S extends string ? S extends `${infer First}${infer Rest}` ? `set${Capitalize<First>}${Rest}` : never : never;
|
|
565
566
|
type StateSetters<T> = {
|
|
566
|
-
[K in keyof T as
|
|
567
|
+
[K in keyof T as K extends string ? K extends `${infer First}${infer Rest}` ? `set${Capitalize<First>}${Rest}` : never : never]: Dispatch<SetStateAction<T[K]>>;
|
|
567
568
|
};
|
|
568
569
|
type StatesWithSetters<T> = T & StateSetters<T>;
|
|
569
570
|
/**
|
|
@@ -667,4 +668,4 @@ declare function usePrevious<T = any>(value: T): T | undefined;
|
|
|
667
668
|
*/
|
|
668
669
|
declare function useStateRef<T = any>(initialValue?: T): [T, Dispatch<SetStateAction<T>>, RefObject<T>];
|
|
669
670
|
|
|
670
|
-
export { ErrorBoundary, type ErrorBoundaryProps, type ErrorChildrenProps, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasDataWrapperRef, FaasReactClient, type FaasReactClientInstance, type FaasReactClientOptions, FormContainer as Form, type FormButtonElementProps, type FormContextProps, FormContextProvider, FormDefaultElements, FormDefaultLang, FormDefaultRules, type FormDefaultRulesOptions, type FormElementTypes, type FormInputElementProps, FormItem, type FormItemName, type FormItemProps, type FormLabelElementProps, type FormLang, type FormProps, type FormRule, type FormRules, type InferFormRulesOptions, type OnError, OptionalWrapper, type OptionalWrapperProps, type UseFaasStreamOptions, type UseFaasStreamResult, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, type useFaasOptions, useFaasStream, useFormContext, usePrevious, useSplittingState, useStateRef, validValues, withFaasData };
|
|
671
|
+
export { ErrorBoundary, type ErrorBoundaryProps, type ErrorChildrenProps, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasDataWrapperRef, FaasReactClient, type FaasReactClientInstance, type FaasReactClientOptions, FormContainer as Form, type FormButtonElementProps, type FormContextProps, FormContextProvider, FormDefaultElements, FormDefaultLang, FormDefaultRules, type FormDefaultRulesOptions, type FormElementTypes, FormInput, type FormInputElementProps, type FormInputProps, FormItem, type FormItemName, type FormItemProps, type FormLabelElementProps, type FormLang, type FormProps, type FormRule, type FormRules, type InferFormInputProps, type InferFormRulesOptions, type InferRuleOption, type OnError, OptionalWrapper, type OptionalWrapperProps, type StateSetters, type StatesWithSetters, type UseFaasStreamOptions, type UseFaasStreamResult, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, type useFaasOptions, useFaasStream, useFormContext, usePrevious, useSplittingState, useStateRef, validValues, withFaasData };
|
package/dist/index.mjs
CHANGED
|
@@ -738,4 +738,4 @@ function usePrevious(value) {
|
|
|
738
738
|
return ref.current;
|
|
739
739
|
}
|
|
740
740
|
|
|
741
|
-
export { ErrorBoundary, FaasDataWrapper, FaasReactClient, FormContainer as Form, FormContextProvider, FormDefaultElements, FormDefaultLang, FormDefaultRules, FormItem, OptionalWrapper, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, useFaasStream, useFormContext, usePrevious, useSplittingState, useStateRef, validValues, withFaasData };
|
|
741
|
+
export { ErrorBoundary, FaasDataWrapper, FaasReactClient, FormContainer as Form, FormContextProvider, FormDefaultElements, FormDefaultLang, FormDefaultRules, FormInput, FormItem, OptionalWrapper, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, useFaasStream, useFormContext, usePrevious, useSplittingState, useStateRef, validValues, withFaasData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-beta.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
},
|
|
25
25
|
"funding": "https://github.com/sponsors/faasjs",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "tsup src/index.
|
|
27
|
+
"build": "tsup src/index.ts --config ../../tsup.config.ts --external react"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@faasjs/browser": ">=
|
|
33
|
+
"@faasjs/browser": ">=8.0.0-beta.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@faasjs/browser": ">=
|
|
36
|
+
"@faasjs/browser": ">=8.0.0-beta.6",
|
|
37
37
|
"@types/react": "^19.0.0",
|
|
38
38
|
"react": "^19.0.0"
|
|
39
39
|
},
|