@zayne-labs/toolkit-react 0.12.27 → 0.12.28
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as useUnmountEffect, B as getErrorMessage, C as useConstant, D as useCallbackRef, E as useClickOutside, F as useAfterMountEffect, I as ContextError, L as CustomContextOptions, M as useLifeCycle, N as useEffectOnce, O as useAnimationInterval, P as useAsyncEffect, R as UseCustomContext, S as useControllableState, T as useComposeRefs, _ as useDisclosure, a as useStore, b as useCopyToClipboard, c as useCompareSelector, d as useSearchParamsObject, f as useSearch, g as useIsHydrated, h as useLocationState, i as useThrottleByTimer, j as useMountEffect, k as useAnimateElementRefs, l as useCompareValue, m as createUseLocationState, n as useThrottleByFrame, o as createUseStorageState, p as useScrollObserver, r as useThrottleBySetTimeout, s as useStorageState, t as useToggle, u as useSearchParams, v as useDebouncedFn, w as useLazyRef, x as useControllableProp, y as useDebouncedState, z as createCustomContext } from "../index-
|
|
1
|
+
import { A as useUnmountEffect, B as getErrorMessage, C as useConstant, D as useCallbackRef, E as useClickOutside, F as useAfterMountEffect, I as ContextError, L as CustomContextOptions, M as useLifeCycle, N as useEffectOnce, O as useAnimationInterval, P as useAsyncEffect, R as UseCustomContext, S as useControllableState, T as useComposeRefs, _ as useDisclosure, a as useStore, b as useCopyToClipboard, c as useCompareSelector, d as useSearchParamsObject, f as useSearch, g as useIsHydrated, h as useLocationState, i as useThrottleByTimer, j as useMountEffect, k as useAnimateElementRefs, l as useCompareValue, m as createUseLocationState, n as useThrottleByFrame, o as createUseStorageState, p as useScrollObserver, r as useThrottleBySetTimeout, s as useStorageState, t as useToggle, u as useSearchParams, v as useDebouncedFn, w as useLazyRef, x as useControllableProp, y as useDebouncedState, z as createCustomContext } from "../index-C4ao8dq4.js";
|
|
2
2
|
import "../index-6fIqihyt.js";
|
|
3
3
|
export { ContextError, CustomContextOptions, UseCustomContext, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useCompareSelector, useCompareValue, useComposeRefs, useConstant, useControllableProp, useControllableState, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useLazyRef, useLifeCycle, useLocationState, useMountEffect, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as PossibleRef, f as StateSetter } from "./index-6fIqihyt.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react0 from "react";
|
|
3
3
|
import { RefCallback, useEffect } from "react";
|
|
4
4
|
import * as _zayne_labs_toolkit_core2 from "@zayne-labs/toolkit-core";
|
|
5
5
|
import { AllowedClipboardItems, AnimationIntervalOptions, CompareFnOptions, CopyToClipboardOptions, LocationStoreApi, LocationStoreInfo, LocationStoreOptions, ScrollObserverOptions, StorageOptions, StorageStoreApi, StoreApi, URLSearchParamsInit } from "@zayne-labs/toolkit-core";
|
|
@@ -16,7 +16,7 @@ type CustomContextOptions<TContextValue, TStrict extends boolean> = {
|
|
|
16
16
|
strict?: TStrict;
|
|
17
17
|
};
|
|
18
18
|
type UseCustomContext<TContextValue, TStrict extends boolean> = () => TStrict extends true ? TContextValue : TContextValue | null;
|
|
19
|
-
declare const createCustomContext: <TContextValue = null, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [Provider:
|
|
19
|
+
declare const createCustomContext: <TContextValue = null, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [Provider: react0.Context<TContextValue>, useCustomContext: UseCustomContext<TContextValue, TStrict>];
|
|
20
20
|
declare class ContextError extends Error {
|
|
21
21
|
name: string;
|
|
22
22
|
}
|
|
@@ -88,11 +88,11 @@ type UseClickOutsideOptions<TElement extends HTMLElement> = {
|
|
|
88
88
|
ref?: Array<React.RefObject<TElement>> | React.RefObject<TElement>;
|
|
89
89
|
};
|
|
90
90
|
declare const useClickOutside: <TElement extends HTMLElement>(options: UseClickOutsideOptions<TElement>) => {
|
|
91
|
-
ref:
|
|
91
|
+
ref: react0.RefObject<TElement | null>;
|
|
92
92
|
};
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/hooks/useComposeRefs.d.ts
|
|
95
|
-
declare const useComposeRefs: <TRef extends HTMLElement>(...refs: Array<PossibleRef<TRef>>) =>
|
|
95
|
+
declare const useComposeRefs: <TRef extends HTMLElement>(...refs: Array<PossibleRef<TRef>>) => react0.RefCallback<TRef>;
|
|
96
96
|
//#endregion
|
|
97
97
|
//#region src/hooks/useConstant.d.ts
|
|
98
98
|
declare const useConstant: <TResult>(initFn: () => TResult) => TResult;
|
|
@@ -150,7 +150,7 @@ declare const useCopyToClipboard: (options?: CopyToClipboardOptions & {
|
|
|
150
150
|
}) => {
|
|
151
151
|
handleCopy: (valueToCopy: AllowedClipboardItems) => void;
|
|
152
152
|
hasCopied: boolean;
|
|
153
|
-
setValue:
|
|
153
|
+
setValue: react0.Dispatch<react0.SetStateAction<AllowedClipboardItems>>;
|
|
154
154
|
value: AllowedClipboardItems;
|
|
155
155
|
};
|
|
156
156
|
//#endregion
|
|
@@ -164,13 +164,13 @@ declare const useDebouncedFn: <TParams>(callBackFn: CallbackFn<TParams>, delay:
|
|
|
164
164
|
cancelMaxWait(): void;
|
|
165
165
|
};
|
|
166
166
|
declare const useDebouncedState: <TValue>(defaultValue: TValue, delay: number | undefined) => readonly [TValue, {
|
|
167
|
-
(...params:
|
|
168
|
-
(params:
|
|
167
|
+
(...params: react0.SetStateAction<TValue>[]): void;
|
|
168
|
+
(params: react0.SetStateAction<TValue> | react0.SetStateAction<TValue>[], overrideOptions: {
|
|
169
169
|
$delay: number;
|
|
170
170
|
}): void;
|
|
171
171
|
cancel: () => void;
|
|
172
172
|
cancelMaxWait(): void;
|
|
173
|
-
},
|
|
173
|
+
}, react0.Dispatch<react0.SetStateAction<TValue>>];
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/hooks/useDisclosure.d.ts
|
|
176
176
|
type DisclosureOptions = {
|
|
@@ -234,7 +234,7 @@ declare const useSearch: <TData>(initialData: TData[], delay?: number) => {
|
|
|
234
234
|
data: TData[];
|
|
235
235
|
isLoading: boolean;
|
|
236
236
|
query: string;
|
|
237
|
-
setQuery:
|
|
237
|
+
setQuery: react0.Dispatch<react0.SetStateAction<string>>;
|
|
238
238
|
};
|
|
239
239
|
//#endregion
|
|
240
240
|
//#region src/hooks/useSearchParams.d.ts
|
|
@@ -259,8 +259,28 @@ type UseStorageResult<TState, TSlice = TState> = [state: TSlice, actions: Storag
|
|
|
259
259
|
* @description Creates a custom hook that returns a storage state and actions to modify it. You can use this if you need shared options.
|
|
260
260
|
* @note You must use this if you want to be able to prevent syncing state across tabs.
|
|
261
261
|
*/
|
|
262
|
-
declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core2.StoreApi<TState> & {
|
|
262
|
+
declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => Omit<_zayne_labs_toolkit_core2.StoreApi<TState>, "setState"> & {
|
|
263
263
|
removeState: () => void;
|
|
264
|
+
setState: {
|
|
265
|
+
(stateUpdate: Partial<TState> | ((prevState: TState) => Partial<TState>), options?: ({
|
|
266
|
+
onNotifySync?: ((previousState: TState) => void) | undefined;
|
|
267
|
+
onNotifyViaBatch?: ((previousStateSnapshot: TState) => void) | undefined;
|
|
268
|
+
shouldNotifySync?: boolean | undefined;
|
|
269
|
+
} & {
|
|
270
|
+
storageAction?: "remove-item" | "set-item";
|
|
271
|
+
} & {
|
|
272
|
+
shouldReplace?: false;
|
|
273
|
+
}) | undefined): void;
|
|
274
|
+
(stateUpdate: TState | ((prevState: TState) => TState), options?: ({
|
|
275
|
+
onNotifySync?: ((previousState: TState) => void) | undefined;
|
|
276
|
+
onNotifyViaBatch?: ((previousStateSnapshot: TState) => void) | undefined;
|
|
277
|
+
shouldNotifySync?: boolean | undefined;
|
|
278
|
+
} & {
|
|
279
|
+
storageAction?: "remove-item" | "set-item";
|
|
280
|
+
} & {
|
|
281
|
+
shouldReplace: true;
|
|
282
|
+
}) | undefined): void;
|
|
283
|
+
};
|
|
264
284
|
} & (<TSlice = TState>(selector?: SelectorFn<TState, TSlice>) => UseStorageResult<TState, TSlice>);
|
|
265
285
|
type UseStorageStateOptions<TValue> = Omit<StorageOptions<TValue>, "initialValue" | "key">;
|
|
266
286
|
declare const useStorageState: <TValue, TSlice = TValue>(key: string, defaultValue?: TValue, options?: UseStorageStateOptions<TValue> & {
|
|
@@ -286,4 +306,4 @@ type InitialState = boolean | (() => boolean);
|
|
|
286
306
|
declare const useToggle: (initialValue?: InitialState) => [value: boolean, toggleValue: <TValue>(newValue?: TValue) => void];
|
|
287
307
|
//#endregion
|
|
288
308
|
export { useUnmountEffect as A, getErrorMessage as B, useConstant as C, useCallbackRef as D, useClickOutside as E, useAfterMountEffect as F, ContextError as I, CustomContextOptions as L, useLifeCycle as M, useEffectOnce as N, useAnimationInterval as O, useAsyncEffect as P, UseCustomContext as R, useControllableState as S, useComposeRefs as T, useDisclosure as _, useStore as a, useCopyToClipboard as b, useCompareSelector as c, useSearchParamsObject as d, useSearch as f, useIsHydrated as g, useLocationState as h, useThrottleByTimer as i, useMountEffect as j, useAnimateElementRefs as k, useCompareValue as l, createUseLocationState as m, useThrottleByFrame as n, createUseStorageState as o, useScrollObserver as p, useThrottleBySetTimeout as r, useStorageState as s, useToggle as t, useSearchParams as u, useDebouncedFn as v, useLazyRef as w, useControllableProp as x, useDebouncedState as y, createCustomContext as z };
|
|
289
|
-
//# sourceMappingURL=index-
|
|
309
|
+
//# sourceMappingURL=index-C4ao8dq4.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as CustomContextOptions } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { L as CustomContextOptions } from "./index-C4ao8dq4.js";
|
|
2
|
+
import * as react11 from "react";
|
|
3
3
|
import { StoreApi } from "@zayne-labs/toolkit-core";
|
|
4
4
|
import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
|
|
|
7
7
|
declare const createReactStoreContext: <TState extends Record<string, unknown>, TStore extends StoreApi<TState> = StoreApi<TState>>(options?: CustomContextOptions<TStore, true>) => [ZustandStoreContextProvider: (props: {
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
store: TStore;
|
|
10
|
-
}) =>
|
|
10
|
+
}) => react11.FunctionComponentElement<react11.ProviderProps<TStore>>, useZustandStoreContext: <TResult = TState>(selector?: SelectorFn<TState, TResult>) => TResult];
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/zustand/types.d.ts
|
|
13
13
|
type Get<T, K, F> = K extends keyof T ? T[K] : F;
|
|
@@ -21,4 +21,4 @@ type UseBoundStore<TStoreApi extends ReadonlyStoreApi<unknown>> = TStoreApi & {
|
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
|
23
23
|
export { UseBoundStore as n, createReactStoreContext as r, Get as t };
|
|
24
|
-
//# sourceMappingURL=types-
|
|
24
|
+
//# sourceMappingURL=types-44QWzWYw.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../index-
|
|
1
|
+
import "../../index-C4ao8dq4.js";
|
|
2
2
|
import "../../index-6fIqihyt.js";
|
|
3
|
-
import { n as UseBoundStore, r as createReactStoreContext, t as Get } from "../../types-
|
|
3
|
+
import { n as UseBoundStore, r as createReactStoreContext, t as Get } from "../../types-44QWzWYw.js";
|
|
4
4
|
import { StoreApi } from "@zayne-labs/toolkit-core";
|
|
5
5
|
import { Mutate, StoreMutatorIdentifier } from "zustand";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../index-
|
|
1
|
+
import "../index-C4ao8dq4.js";
|
|
2
2
|
import "../index-6fIqihyt.js";
|
|
3
|
-
import { n as UseBoundStore, r as createReactStoreContext } from "../types-
|
|
3
|
+
import { n as UseBoundStore, r as createReactStoreContext } from "../types-44QWzWYw.js";
|
|
4
4
|
import { StateInitializer, StoreApi } from "@zayne-labs/toolkit-core";
|
|
5
5
|
|
|
6
6
|
//#region src/zustand/createReactStore.d.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/toolkit-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.28",
|
|
5
5
|
"description": "A collection of utility functions, types and composables used by my other projects. Nothing too fancy but can be useful.",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@zayne-labs/toolkit-
|
|
53
|
-
"@zayne-labs/toolkit-
|
|
52
|
+
"@zayne-labs/toolkit-core": "0.12.28",
|
|
53
|
+
"@zayne-labs/toolkit-type-helpers": "0.12.28"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
61
61
|
"@types/node": "^25.0.9",
|
|
62
62
|
"@types/react": "^19.2.9",
|
|
63
|
-
"@zayne-labs/tsconfig": "0.11.
|
|
63
|
+
"@zayne-labs/tsconfig": "0.11.21",
|
|
64
64
|
"concurrently": "^9.2.1",
|
|
65
65
|
"cross-env": "^10.1.0",
|
|
66
66
|
"publint": "^0.3.16",
|