@zayne-labs/toolkit-react 0.10.23 → 0.10.24
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,2 +1,2 @@
|
|
|
1
|
-
import { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowComparedSelector, useShallowComparedValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../index-
|
|
1
|
+
import { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowComparedSelector, useShallowComparedValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../index-ByW4GDLQ.js";
|
|
2
2
|
export { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowComparedSelector, useShallowComparedValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyFunction, CallbackFn, NonEmptyArray, Prettify, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react1 from "react";
|
|
3
3
|
import { RefCallback, useEffect } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
|
|
5
5
|
import { AnimationIntervalOptions, LocationInfo, LocationStoreApi, LocationStoreOptions, ScrollObserverOptions, StorageOptions, StorageStoreApi, StoreApi, URLSearchParamsInit } from "@zayne-labs/toolkit-core";
|
|
6
6
|
|
|
7
7
|
//#region src/hooks/createCustomContext.d.ts
|
|
@@ -19,8 +19,8 @@ type CustomContextOptions<TContextValue, TStrict extends boolean> = {
|
|
|
19
19
|
strict?: TStrict;
|
|
20
20
|
};
|
|
21
21
|
type UseCustomContextResult<TContextValue, TStrict extends boolean> = TStrict extends true ? TContextValue : TContextValue | null;
|
|
22
|
-
declare const createCustomContext: <TContextValue, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [
|
|
23
|
-
$inferUnion:
|
|
22
|
+
declare const createCustomContext: <TContextValue, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [react1.Context<TContextValue | null>, () => UseCustomContextResult<TContextValue, TStrict>] & {
|
|
23
|
+
$inferUnion: react1.Context<TContextValue | null> | (() => UseCustomContextResult<TContextValue, TStrict>);
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region src/hooks/effects/useAfterMountEffect.d.ts
|
|
@@ -89,7 +89,7 @@ type UseClickOutsideOptions<TElement extends HTMLElement> = {
|
|
|
89
89
|
ref?: Array<React.RefObject<TElement>> | React.RefObject<TElement>;
|
|
90
90
|
};
|
|
91
91
|
declare const useClickOutside: <TElement extends HTMLElement>(options: UseClickOutsideOptions<TElement>) => {
|
|
92
|
-
ref:
|
|
92
|
+
ref: react1.RefObject<TElement | null>;
|
|
93
93
|
};
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region src/hooks/useConstant.d.ts
|
|
@@ -112,13 +112,13 @@ declare const useDebouncedFn: <TParams>(callBackFn: CallbackFn<TParams>, delay:
|
|
|
112
112
|
cancelMaxWait(): void;
|
|
113
113
|
};
|
|
114
114
|
declare const useDebouncedState: <TValue>(defaultValue: TValue, delay: number | undefined) => readonly [TValue, {
|
|
115
|
-
(...params:
|
|
116
|
-
(params:
|
|
115
|
+
(...params: react1.SetStateAction<TValue>[]): void;
|
|
116
|
+
(params: react1.SetStateAction<TValue> | react1.SetStateAction<TValue>[], overrideOptions: {
|
|
117
117
|
$delay: number;
|
|
118
118
|
}): void;
|
|
119
119
|
cancel: () => void;
|
|
120
120
|
cancelMaxWait(): void;
|
|
121
|
-
},
|
|
121
|
+
}, react1.Dispatch<react1.SetStateAction<TValue>>];
|
|
122
122
|
//#endregion
|
|
123
123
|
//#region src/hooks/useDisclosure.d.ts
|
|
124
124
|
type DisclosureOptions = {
|
|
@@ -168,13 +168,13 @@ declare const useIsServer: () => boolean;
|
|
|
168
168
|
//#endregion
|
|
169
169
|
//#region src/hooks/useLocationState.d.ts
|
|
170
170
|
type UseLocationResult<TSlice> = [state: TSlice, actions: LocationStoreApi];
|
|
171
|
-
declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<
|
|
172
|
-
push: (url: string |
|
|
173
|
-
state?:
|
|
171
|
+
declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core0.StoreApi<_zayne_labs_toolkit_core0.URLInfoObject>, "setState" | "resetState"> & {
|
|
172
|
+
push: (url: string | _zayne_labs_toolkit_core0.PartialURLInfo, options?: {
|
|
173
|
+
state?: _zayne_labs_toolkit_core0.PartialURLInfo["state"];
|
|
174
174
|
}) => void;
|
|
175
175
|
replace: LocationStoreApi["push"];
|
|
176
176
|
triggerPopstateEvent: (nextLocationState?: LocationInfo["state"]) => void;
|
|
177
|
-
} & (<TSlice =
|
|
177
|
+
} & (<TSlice = _zayne_labs_toolkit_core0.URLInfoObject>(selector?: SelectorFn<LocationInfo, TSlice>) => UseLocationResult<TSlice>);
|
|
178
178
|
declare const useLocationState: <TSlice = LocationInfo>(selector?: SelectorFn<LocationInfo, TSlice>, options?: LocationStoreOptions) => UseLocationResult<TSlice>;
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region src/hooks/useToggle.d.ts
|
|
@@ -229,7 +229,7 @@ declare const useSearch: <TData>(initialData: TData[], delay?: number) => {
|
|
|
229
229
|
data: TData[];
|
|
230
230
|
isLoading: boolean;
|
|
231
231
|
query: string;
|
|
232
|
-
setQuery:
|
|
232
|
+
setQuery: react1.Dispatch<react1.SetStateAction<string>>;
|
|
233
233
|
};
|
|
234
234
|
//#endregion
|
|
235
235
|
//#region src/hooks/useSearchParams.d.ts
|
|
@@ -238,11 +238,11 @@ type UseSearchParamsOptions = LocationStoreOptions & {
|
|
|
238
238
|
};
|
|
239
239
|
declare const useSearchParams: <TSearchParams extends URLSearchParamsInit>(options?: UseSearchParamsOptions) => readonly [URLSearchParams, {
|
|
240
240
|
(newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)): void;
|
|
241
|
-
triggerPopstateEvent: (nextLocationState?:
|
|
241
|
+
triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core0.LocationInfo["state"]) => void;
|
|
242
242
|
}];
|
|
243
243
|
declare const useSearchParamsObject: <TSearchParams extends Record<string, string>>(options?: UseSearchParamsOptions) => readonly [TSearchParams, {
|
|
244
244
|
(newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)): void;
|
|
245
|
-
triggerPopstateEvent: (nextLocationState?:
|
|
245
|
+
triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core0.LocationInfo["state"]) => void;
|
|
246
246
|
}];
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/hooks/useShallowCompare.d.ts
|
|
@@ -255,7 +255,7 @@ type UseStorageResult<TState, TSlice = TState> = [state: TSlice, actions: Storag
|
|
|
255
255
|
* @description Creates a custom hook that returns a storage state and actions to modify it. You can use this if you need shared options.
|
|
256
256
|
* @note You must use this if you want to be able to prevent syncing state across tabs.
|
|
257
257
|
*/
|
|
258
|
-
declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) =>
|
|
258
|
+
declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core0.StoreApi<TState> & {
|
|
259
259
|
removeState: () => void;
|
|
260
260
|
} & (<TSlice = TState>(selector?: SelectorFn<TState, TSlice>) => UseStorageResult<TState, TSlice>);
|
|
261
261
|
type UseStorageStateOptions<TValue> = Omit<StorageOptions<TValue>, "initialValue" | "key">;
|
|
@@ -278,4 +278,4 @@ declare const useThrottleByFrame: <TParams>(callbackFn: CallbackFn<TParams>) =>
|
|
|
278
278
|
};
|
|
279
279
|
//#endregion
|
|
280
280
|
export { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useIsServer, useLazyRef, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowComparedSelector, useShallowComparedValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
|
|
281
|
-
//# sourceMappingURL=index-
|
|
281
|
+
//# sourceMappingURL=index-ByW4GDLQ.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomContextOptions } from "../index-
|
|
1
|
+
import { CustomContextOptions } from "../index-ByW4GDLQ.js";
|
|
2
2
|
import { AnyObject, Prettify, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react0 from "react";
|
|
4
4
|
import { StoreApi } from "@zayne-labs/toolkit-core";
|
|
5
5
|
import * as zustand0 from "zustand";
|
|
6
6
|
import { Mutate, StateCreator as StateCreator$1, StoreMutatorIdentifier, UseBoundStore } from "zustand";
|
|
@@ -9,7 +9,7 @@ import { Mutate, StateCreator as StateCreator$1, StoreMutatorIdentifier, UseBoun
|
|
|
9
9
|
declare const createZustandContext: <TState extends Record<string, unknown>, TStore extends StoreApi<TState> = StoreApi<TState>>(options?: CustomContextOptions<TStore, true>) => [ZustandStoreContextProvider: (props: {
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
store: TStore;
|
|
12
|
-
}) =>
|
|
12
|
+
}) => react0.FunctionComponentElement<react0.ProviderProps<TStore | null>>, useZustandStoreContext: <TResult = TState>(selector?: SelectorFn<TState, TResult>) => TResult];
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/zustand/createZustandStoreWithCombine.d.ts
|
|
15
15
|
type Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/toolkit-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.24",
|
|
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",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@zayne-labs/toolkit-core": "0.10.
|
|
51
|
-
"@zayne-labs/toolkit-type-helpers": "0.10.
|
|
50
|
+
"@zayne-labs/toolkit-core": "0.10.24",
|
|
51
|
+
"@zayne-labs/toolkit-type-helpers": "0.10.24"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@arethetypeswrong/cli": "^0.18.2",
|