react-simplikit 0.0.18 → 0.0.20
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/hooks/useBooleanState/index.d.cts +1 -1
- package/dist/hooks/useStorageState/index.d.cts +1 -1
- package/dist/utils/mergeRefs/index.d.cts +2 -0
- package/esm/hooks/useBooleanState/index.d.ts +1 -1
- package/esm/hooks/useStorageState/index.d.ts +1 -1
- package/esm/utils/mergeRefs/index.d.ts +2 -0
- package/package.json +3 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @param {boolean} [defaultValue=false] - The initial value of the state. Defaults to `false`.
|
|
7
7
|
*
|
|
8
|
-
* @returns {[state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
8
|
+
* @returns {readonly [state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
9
9
|
* - state `boolean` - The current state value;
|
|
10
10
|
* - setTrue `() => void` - A function to set the state to `true`;
|
|
11
11
|
* - setFalse `() => void` - A function to set the state to `false`;
|
|
@@ -27,7 +27,7 @@ type StorageStateOptionsWithDefaultValue<T> = StorageStateOptions<T> & {
|
|
|
27
27
|
* @param {Storage} [options.storage=localStorage] - The storage type (`localStorage` or `sessionStorage`). Defaults to `localStorage`.
|
|
28
28
|
* @param {T} [options.defaultValue] - The initial value if no existing value is found.
|
|
29
29
|
*
|
|
30
|
-
* @returns {[state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
30
|
+
* @returns {readonly [state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
31
31
|
* - state `Serializable<T> | undefined` - The current state value retrieved from storage;
|
|
32
32
|
* - setState `(value: SetStateAction<Serializable<T> | undefined>) => void` - A function to update and persist the state;
|
|
33
33
|
*
|
|
@@ -5,6 +5,8 @@ import { RefObject, RefCallback } from 'react';
|
|
|
5
5
|
* This function takes multiple refs (RefObject or RefCallback) and returns a single ref that updates all provided refs.
|
|
6
6
|
* It's useful when you need to pass multiple refs to a single element.
|
|
7
7
|
*
|
|
8
|
+
* @template T - The type of target to be referenced.
|
|
9
|
+
*
|
|
8
10
|
* @param {Array<RefObject<T> | RefCallback<T> | null | undefined>} refs - An array of refs to be merged. Each ref can be either a RefObject or RefCallback.
|
|
9
11
|
*
|
|
10
12
|
* @returns {RefCallback<T>} A single ref callback that updates all provided refs.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @param {boolean} [defaultValue=false] - The initial value of the state. Defaults to `false`.
|
|
7
7
|
*
|
|
8
|
-
* @returns {[state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
8
|
+
* @returns {readonly [state: boolean, setTrue: () => void, setFalse: () => void, toggle: () => void]} A tuple containing:
|
|
9
9
|
* - state `boolean` - The current state value;
|
|
10
10
|
* - setTrue `() => void` - A function to set the state to `true`;
|
|
11
11
|
* - setFalse `() => void` - A function to set the state to `false`;
|
|
@@ -27,7 +27,7 @@ type StorageStateOptionsWithDefaultValue<T> = StorageStateOptions<T> & {
|
|
|
27
27
|
* @param {Storage} [options.storage=localStorage] - The storage type (`localStorage` or `sessionStorage`). Defaults to `localStorage`.
|
|
28
28
|
* @param {T} [options.defaultValue] - The initial value if no existing value is found.
|
|
29
29
|
*
|
|
30
|
-
* @returns {[state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
30
|
+
* @returns {readonly [state: Serializable<T> | undefined, setState: (value: SetStateAction<Serializable<T> | undefined>) => void]} A tuple:
|
|
31
31
|
* - state `Serializable<T> | undefined` - The current state value retrieved from storage;
|
|
32
32
|
* - setState `(value: SetStateAction<Serializable<T> | undefined>) => void` - A function to update and persist the state;
|
|
33
33
|
*
|
|
@@ -5,6 +5,8 @@ import { RefObject, RefCallback } from 'react';
|
|
|
5
5
|
* This function takes multiple refs (RefObject or RefCallback) and returns a single ref that updates all provided refs.
|
|
6
6
|
* It's useful when you need to pass multiple refs to a single element.
|
|
7
7
|
*
|
|
8
|
+
* @template T - The type of target to be referenced.
|
|
9
|
+
*
|
|
8
10
|
* @param {Array<RefObject<T> | RefCallback<T> | null | undefined>} refs - An array of refs to be merged. Each ref can be either a RefObject or RefCallback.
|
|
9
11
|
*
|
|
10
12
|
* @returns {RefCallback<T>} A single ref callback that updates all provided refs.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-simplikit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"esm/**/*"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
+
"clean": "rimraf ./dist ./esm ./coverage ./node_modules",
|
|
22
23
|
"scaffold": "tsx .scripts/index.ts scaffold",
|
|
23
24
|
"docs:gen": "tsx .scripts/index.ts generate-docs",
|
|
24
25
|
"docs:dev": "vitepress dev",
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"prettier-plugin-sort-re-exports": "^0.1.0",
|
|
89
90
|
"react": "^19.0.0",
|
|
90
91
|
"react-dom": "^19.0.0",
|
|
92
|
+
"rimraf": "^6.0.1",
|
|
91
93
|
"tsup": "^8.3.5",
|
|
92
94
|
"tsx": "^4.19.2",
|
|
93
95
|
"typescript": "^5.7.2",
|