@zayne-labs/toolkit-react 0.12.6 → 0.12.7

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 useShallowCompSelector, d as useSearchParamsObject, f as useSearch, g as useIsHydrated, h as useLocationState, i as useThrottleByTimer, j as useMountEffect, k as useAnimateElementRefs, l as useShallowCompValue, 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-BKCZJdKX.js";
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 useShallowCompSelector, d as useSearchParamsObject, f as useSearch, g as useIsHydrated, h as useLocationState, i as useThrottleByTimer, j as useMountEffect, k as useAnimateElementRefs, l as useShallowCompValue, 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-Vdq-fljM.js";
2
2
  import "../index--n6VOfXE.js";
3
3
  export { ContextError, CustomContextOptions, UseCustomContext, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useComposeRefs, useConstant, useControllableProp, useControllableState, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsHydrated, useLazyRef, useLifeCycle, useLocationState, useMountEffect, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompSelector, useShallowCompValue, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
@@ -1,7 +1,7 @@
1
1
  import { D as PossibleRef, f as StateSetter } from "./index--n6VOfXE.js";
2
- import * as react12 from "react";
2
+ import * as react1 from "react";
3
3
  import { RefCallback, useEffect } from "react";
4
- import * as _zayne_labs_toolkit_core1 from "@zayne-labs/toolkit-core";
4
+ import * as _zayne_labs_toolkit_core3 from "@zayne-labs/toolkit-core";
5
5
  import { AllowedClipboardItems, AnimationIntervalOptions, CopyToClipboardOptions, LocationInfo, LocationStoreApi, LocationStoreOptions, ScrollObserverOptions, StorageOptions, StorageStoreApi, StoreApi, URLSearchParamsInit } from "@zayne-labs/toolkit-core";
6
6
  import { AnyFunction, CallbackFn, NonEmptyArray, Prettify, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
7
7
 
@@ -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: react12.Context<TContextValue>, useCustomContext: UseCustomContext<TContextValue, TStrict>];
19
+ declare const createCustomContext: <TContextValue = null, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [Provider: react1.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: react12.RefObject<TElement | null>;
91
+ ref: react1.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>>) => react12.RefCallback<TRef>;
95
+ declare const useComposeRefs: <TRef extends HTMLElement>(...refs: Array<PossibleRef<TRef>>) => react1.RefCallback<TRef>;
96
96
  //#endregion
97
97
  //#region src/hooks/useConstant.d.ts
98
98
  declare const useConstant: <TResult>(initFn: () => TResult) => TResult;
@@ -155,7 +155,7 @@ declare const useCopyToClipboard: (options?: CopyToClipboardOptions & {
155
155
  }) => {
156
156
  handleCopy: (valueToCopy: AllowedClipboardItems) => void;
157
157
  hasCopied: boolean;
158
- setValue: react12.Dispatch<react12.SetStateAction<AllowedClipboardItems>>;
158
+ setValue: react1.Dispatch<react1.SetStateAction<AllowedClipboardItems>>;
159
159
  value: AllowedClipboardItems;
160
160
  };
161
161
  //#endregion
@@ -169,13 +169,13 @@ declare const useDebouncedFn: <TParams>(callBackFn: CallbackFn<TParams>, delay:
169
169
  cancelMaxWait(): void;
170
170
  };
171
171
  declare const useDebouncedState: <TValue>(defaultValue: TValue, delay: number | undefined) => readonly [TValue, {
172
- (...params: react12.SetStateAction<TValue>[]): void;
173
- (params: react12.SetStateAction<TValue> | react12.SetStateAction<TValue>[], overrideOptions: {
172
+ (...params: react1.SetStateAction<TValue>[]): void;
173
+ (params: react1.SetStateAction<TValue> | react1.SetStateAction<TValue>[], overrideOptions: {
174
174
  $delay: number;
175
175
  }): void;
176
176
  cancel: () => void;
177
177
  cancelMaxWait(): void;
178
- }, react12.Dispatch<react12.SetStateAction<TValue>>];
178
+ }, react1.Dispatch<react1.SetStateAction<TValue>>];
179
179
  //#endregion
180
180
  //#region src/hooks/useDisclosure.d.ts
181
181
  type DisclosureOptions = {
@@ -217,13 +217,13 @@ declare const useIsHydrated: () => boolean;
217
217
  //#endregion
218
218
  //#region src/hooks/useLocationState.d.ts
219
219
  type UseLocationResult<TSlice> = [state: TSlice, actions: LocationStoreApi];
220
- declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core1.StoreApi<_zayne_labs_toolkit_core1.URLInfoObject>, "setState" | "resetState"> & {
221
- push: (url: string | _zayne_labs_toolkit_core1.PartialURLInfo, options?: {
222
- state?: _zayne_labs_toolkit_core1.PartialURLInfo["state"];
220
+ declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core3.StoreApi<_zayne_labs_toolkit_core3.URLInfoObject>, "setState" | "resetState"> & {
221
+ push: (url: string | _zayne_labs_toolkit_core3.PartialURLInfo, options?: {
222
+ state?: _zayne_labs_toolkit_core3.PartialURLInfo["state"];
223
223
  }) => void;
224
224
  replace: LocationStoreApi["push"];
225
225
  triggerPopstateEvent: (nextLocationState?: LocationInfo["state"]) => void;
226
- } & (<TSlice = _zayne_labs_toolkit_core1.URLInfoObject>(selector?: SelectorFn<LocationInfo, TSlice>) => UseLocationResult<TSlice>);
226
+ } & (<TSlice = _zayne_labs_toolkit_core3.URLInfoObject>(selector?: SelectorFn<LocationInfo, TSlice>) => UseLocationResult<TSlice>);
227
227
  declare const useLocationState: <TSlice = LocationInfo>(selector?: SelectorFn<LocationInfo, TSlice>, options?: LocationStoreOptions) => UseLocationResult<TSlice>;
228
228
  //#endregion
229
229
  //#region src/hooks/useScrollObserver.d.ts
@@ -237,15 +237,15 @@ declare const useSearch: <TData>(initialData: TData[], delay?: number) => {
237
237
  data: TData[];
238
238
  isLoading: boolean;
239
239
  query: string;
240
- setQuery: react12.Dispatch<react12.SetStateAction<string>>;
240
+ setQuery: react1.Dispatch<react1.SetStateAction<string>>;
241
241
  };
242
242
  //#endregion
243
243
  //#region src/hooks/useSearchParams.d.ts
244
244
  type UseSearchParamsOptions = LocationStoreOptions & {
245
245
  action?: "push" | "replace";
246
246
  };
247
- declare const useSearchParams: <TSearchParams extends URLSearchParamsInit>(options?: UseSearchParamsOptions) => [searchParams: URLSearchParams, setSearchParams: (newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core1.LocationInfo["state"]) => void];
248
- declare const useSearchParamsObject: <TSearchParams extends Record<string, string>>(options?: UseSearchParamsOptions) => [searchParamsObject: TSearchParams, setSearchParamsObject: (newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core1.LocationInfo["state"]) => void];
247
+ declare const useSearchParams: <TSearchParams extends URLSearchParamsInit>(options?: UseSearchParamsOptions) => [searchParams: URLSearchParams, setSearchParams: (newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core3.LocationInfo["state"]) => void];
248
+ declare const useSearchParamsObject: <TSearchParams extends Record<string, string>>(options?: UseSearchParamsOptions) => [searchParamsObject: TSearchParams, setSearchParamsObject: (newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core3.LocationInfo["state"]) => void];
249
249
  //#endregion
250
250
  //#region src/hooks/useShallowCompare.d.ts
251
251
  declare const useShallowCompSelector: <TState, TResult>(selector: SelectorFn<TState, TResult> | undefined) => (state: TState) => TResult;
@@ -257,7 +257,7 @@ type UseStorageResult<TState, TSlice = TState> = [state: TSlice, actions: Storag
257
257
  * @description Creates a custom hook that returns a storage state and actions to modify it. You can use this if you need shared options.
258
258
  * @note You must use this if you want to be able to prevent syncing state across tabs.
259
259
  */
260
- declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core1.StoreApi<TState> & {
260
+ declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core3.StoreApi<TState> & {
261
261
  removeState: () => void;
262
262
  } & (<TSlice = TState>(selector?: SelectorFn<TState, TSlice>) => UseStorageResult<TState, TSlice>);
263
263
  type UseStorageStateOptions<TValue> = Omit<StorageOptions<TValue>, "initialValue" | "key">;
@@ -284,4 +284,4 @@ type InitialState = boolean | (() => boolean);
284
284
  declare const useToggle: (initialValue?: InitialState) => [value: boolean, toggleValue: <TValue>(newValue?: TValue) => void];
285
285
  //#endregion
286
286
  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, useShallowCompSelector as c, useSearchParamsObject as d, useSearch as f, useIsHydrated as g, useLocationState as h, useThrottleByTimer as i, useMountEffect as j, useAnimateElementRefs as k, useShallowCompValue 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 };
287
- //# sourceMappingURL=index-BKCZJdKX.d.ts.map
287
+ //# sourceMappingURL=index-Vdq-fljM.d.ts.map
@@ -1,4 +1,4 @@
1
- import { L as CustomContextOptions } from "./index-BKCZJdKX.js";
1
+ import { L as CustomContextOptions } from "./index-Vdq-fljM.js";
2
2
  import * as react0 from "react";
3
3
  import { StoreApi } from "@zayne-labs/toolkit-core";
4
4
  import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
@@ -27,4 +27,4 @@ type StateCreator<T$1, Mis extends Array<[StoreMutatorIdentifier, unknown]> = []
27
27
  } & ((setState: Get<Mutate<StoreApi<T$1>, Mis>, "setState", never>, getState: Get<Mutate<StoreApi<T$1>, Mis>, "getState", never>, store: Mutate<StoreApi<T$1>, Mis>) => U);
28
28
  //#endregion
29
29
  export { createZustandContext as a, UseBoundStore as i, StateCreator as n, StoreMutatorIdentifier as r, Mutate as t };
30
- //# sourceMappingURL=types-5StIa9lq.d.ts.map
30
+ //# sourceMappingURL=types-BEFu9IRC.d.ts.map
@@ -1,7 +1,7 @@
1
- import "../../index-BKCZJdKX.js";
1
+ import "../../index-Vdq-fljM.js";
2
2
  import "../../index--n6VOfXE.js";
3
- import { a as createZustandContext, i as UseBoundStore, n as StateCreator, t as Mutate } from "../../types-5StIa9lq.js";
4
- import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
3
+ import { a as createZustandContext, i as UseBoundStore, n as StateCreator, t as Mutate } from "../../types-BEFu9IRC.js";
4
+ import * as _zayne_labs_toolkit_core1 from "@zayne-labs/toolkit-core";
5
5
  import { StoreApi } from "@zayne-labs/toolkit-core";
6
6
  import { AnyObject, Prettify } from "@zayne-labs/toolkit-type-helpers";
7
7
  import { StoreMutatorIdentifier } from "zustand";
@@ -21,8 +21,8 @@ declare const createReactStore: CreateWithSubscribe;
21
21
  //#region src/zustand/compatible/createReactStoreWithCombine.d.ts
22
22
  type Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;
23
23
  declare const combine: <TInitialState extends AnyObject, TExtraState extends AnyObject, Mps extends Array<[StoreMutatorIdentifier, unknown]> = [], Mcs extends Array<[StoreMutatorIdentifier, unknown]> = []>(initialState: TInitialState, storeCreator: StateCreator<TInitialState, Mps, Mcs, TExtraState>) => StateCreator<Write<TInitialState, TExtraState>, Mps, Mcs>;
24
- declare const createVanillaStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => _zayne_labs_toolkit_core0.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>;
25
- declare const createReactStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => UseBoundStore<_zayne_labs_toolkit_core0.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>>;
24
+ declare const createVanillaStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => _zayne_labs_toolkit_core1.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>;
25
+ declare const createReactStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => UseBoundStore<_zayne_labs_toolkit_core1.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>>;
26
26
  //#endregion
27
27
  export { combine, createReactStore, createReactStoreWithCombine, createVanillaStore, createVanillaStoreWithCombine, createZustandContext };
28
28
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,7 @@
1
- import "../../index-BKCZJdKX.js";
1
+ import "../../index-Vdq-fljM.js";
2
2
  import "../../index--n6VOfXE.js";
3
- import { a as createZustandContext, i as UseBoundStore, n as StateCreator, r as StoreMutatorIdentifier, t as Mutate } from "../../types-5StIa9lq.js";
4
- import * as _zayne_labs_toolkit_core9 from "@zayne-labs/toolkit-core";
3
+ import { a as createZustandContext, i as UseBoundStore, n as StateCreator, r as StoreMutatorIdentifier, t as Mutate } from "../../types-BEFu9IRC.js";
4
+ import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
5
5
  import { StoreApi } from "@zayne-labs/toolkit-core";
6
6
  import { AnyObject, Prettify } from "@zayne-labs/toolkit-type-helpers";
7
7
 
@@ -20,8 +20,8 @@ declare const createReactStore: CreateWithSubscribe;
20
20
  //#region src/zustand/new-implementation/createReactStoreWithCombine.d.ts
21
21
  type Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;
22
22
  declare const combine: <TInitialState extends AnyObject, TExtraState extends AnyObject, Mps extends Array<[StoreMutatorIdentifier, unknown]> = [], Mcs extends Array<[StoreMutatorIdentifier, unknown]> = []>(initialState: TInitialState, storeCreator: StateCreator<TInitialState, Mps, Mcs, TExtraState>) => StateCreator<Write<TInitialState, TExtraState>, Mps, Mcs>;
23
- declare const createVanillaStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => _zayne_labs_toolkit_core9.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>;
24
- declare const createReactStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => UseBoundStore<_zayne_labs_toolkit_core9.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>>;
23
+ declare const createVanillaStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => _zayne_labs_toolkit_core0.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>;
24
+ declare const createReactStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => UseBoundStore<_zayne_labs_toolkit_core0.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>>;
25
25
  //#endregion
26
26
  export { combine, createReactStore, createReactStoreWithCombine, createVanillaStore, createVanillaStoreWithCombine, createZustandContext };
27
27
  //# sourceMappingURL=index.d.ts.map
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.6",
4
+ "version": "0.12.7",
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",
@@ -23,7 +23,7 @@
23
23
  ".": "./dist/esm/hooks/index.js",
24
24
  "./utils": "./dist/esm/utils/index.js",
25
25
  "./zustand": "./dist/esm/zustand/new-implementation/index.js",
26
- "./zustand/compatible": "./dist/esm/zustand/compatible/index.js"
26
+ "./zustand-compat": "./dist/esm/zustand/compatible/index.js"
27
27
  },
28
28
  "files": [
29
29
  "dist"
@@ -49,8 +49,8 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@zayne-labs/toolkit-core": "0.12.6",
53
- "@zayne-labs/toolkit-type-helpers": "0.12.6"
52
+ "@zayne-labs/toolkit-core": "0.12.7",
53
+ "@zayne-labs/toolkit-type-helpers": "0.12.7"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@arethetypeswrong/cli": "^0.18.2",