@zayne-labs/toolkit-react 0.12.3 → 0.12.5

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,4 +1,4 @@
1
- import * as react0 from "react";
1
+ import * as react1 from "react";
2
2
 
3
3
  //#region src/hooks/createCustomContext.d.ts
4
4
  type CustomContextOptions<TContextValue, TStrict extends boolean> = {
@@ -11,7 +11,7 @@ type CustomContextOptions<TContextValue, TStrict extends boolean> = {
11
11
  strict?: TStrict;
12
12
  };
13
13
  type UseCustomContext<TContextValue, TStrict extends boolean> = () => TStrict extends true ? TContextValue : TContextValue | null;
14
- declare const createCustomContext: <TContextValue = null, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [Provider: react0.Context<TContextValue>, useCustomContext: UseCustomContext<TContextValue, TStrict>];
14
+ declare const createCustomContext: <TContextValue = null, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [Provider: react1.Context<TContextValue>, useCustomContext: UseCustomContext<TContextValue, TStrict>];
15
15
  declare class ContextError extends Error {
16
16
  name: string;
17
17
  }
@@ -1,4 +1,4 @@
1
- import * as react0 from "react";
1
+ import * as react4 from "react";
2
2
  import { AllowedClipboardItems, CopyToClipboardOptions } from "@zayne-labs/toolkit-core";
3
3
 
4
4
  //#region src/hooks/useCopyToClipboard.d.ts
@@ -7,7 +7,7 @@ declare const useCopyToClipboard: (options?: CopyToClipboardOptions & {
7
7
  }) => {
8
8
  handleCopy: (valueToCopy: AllowedClipboardItems) => void;
9
9
  hasCopied: boolean;
10
- setValue: react0.Dispatch<react0.SetStateAction<AllowedClipboardItems>>;
10
+ setValue: react4.Dispatch<react4.SetStateAction<AllowedClipboardItems>>;
11
11
  value: AllowedClipboardItems;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react4 from "react";
1
+ import * as react6 from "react";
2
2
  import { CallbackFn } from "@zayne-labs/toolkit-type-helpers";
3
3
 
4
4
  //#region src/hooks/useDebounce.d.ts
@@ -11,13 +11,13 @@ declare const useDebouncedFn: <TParams>(callBackFn: CallbackFn<TParams>, delay:
11
11
  cancelMaxWait(): void;
12
12
  };
13
13
  declare const useDebouncedState: <TValue>(defaultValue: TValue, delay: number | undefined) => readonly [TValue, {
14
- (...params: react4.SetStateAction<TValue>[]): void;
15
- (params: react4.SetStateAction<TValue> | react4.SetStateAction<TValue>[], overrideOptions: {
14
+ (...params: react6.SetStateAction<TValue>[]): void;
15
+ (params: react6.SetStateAction<TValue> | react6.SetStateAction<TValue>[], overrideOptions: {
16
16
  $delay: number;
17
17
  }): void;
18
18
  cancel: () => void;
19
19
  cancelMaxWait(): void;
20
- }, react4.Dispatch<react4.SetStateAction<TValue>>];
20
+ }, react6.Dispatch<react6.SetStateAction<TValue>>];
21
21
  //#endregion
22
22
  export { useDebouncedFn, useDebouncedState };
23
23
  //# sourceMappingURL=useDebounce.d.ts.map
@@ -1,16 +1,16 @@
1
- import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
1
+ import * as _zayne_labs_toolkit_core1 from "@zayne-labs/toolkit-core";
2
2
  import { LocationInfo, LocationStoreApi, LocationStoreOptions } from "@zayne-labs/toolkit-core";
3
3
  import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
4
4
 
5
5
  //#region src/hooks/useLocationState.d.ts
6
6
  type UseLocationResult<TSlice> = [state: TSlice, actions: LocationStoreApi];
7
- declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core0.StoreApi<_zayne_labs_toolkit_core0.URLInfoObject>, "resetState" | "setState"> & {
8
- push: (url: string | _zayne_labs_toolkit_core0.PartialURLInfo, options?: {
9
- state?: _zayne_labs_toolkit_core0.PartialURLInfo["state"];
7
+ declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core1.StoreApi<_zayne_labs_toolkit_core1.URLInfoObject>, "setState" | "resetState"> & {
8
+ push: (url: string | _zayne_labs_toolkit_core1.PartialURLInfo, options?: {
9
+ state?: _zayne_labs_toolkit_core1.PartialURLInfo["state"];
10
10
  }) => void;
11
11
  replace: LocationStoreApi["push"];
12
12
  triggerPopstateEvent: (nextLocationState?: LocationInfo["state"]) => void;
13
- } & (<TSlice = _zayne_labs_toolkit_core0.URLInfoObject>(selector?: SelectorFn<LocationInfo, TSlice>) => UseLocationResult<TSlice>);
13
+ } & (<TSlice = _zayne_labs_toolkit_core1.URLInfoObject>(selector?: SelectorFn<LocationInfo, TSlice>) => UseLocationResult<TSlice>);
14
14
  declare const useLocationState: <TSlice = LocationInfo>(selector?: SelectorFn<LocationInfo, TSlice>, options?: LocationStoreOptions) => UseLocationResult<TSlice>;
15
15
  //#endregion
16
16
  export { createUseLocationState, useLocationState };
@@ -1,11 +1,11 @@
1
- import * as react9 from "react";
1
+ import * as react11 from "react";
2
2
 
3
3
  //#region src/hooks/useSearch.d.ts
4
4
  declare const useSearch: <TData>(initialData: TData[], delay?: number) => {
5
5
  data: TData[];
6
6
  isLoading: boolean;
7
7
  query: string;
8
- setQuery: react9.Dispatch<react9.SetStateAction<string>>;
8
+ setQuery: react11.Dispatch<react11.SetStateAction<string>>;
9
9
  };
10
10
  //#endregion
11
11
  export { useSearch };
@@ -1,12 +1,12 @@
1
- import * as _zayne_labs_toolkit_core4 from "@zayne-labs/toolkit-core";
1
+ import * as _zayne_labs_toolkit_core6 from "@zayne-labs/toolkit-core";
2
2
  import { LocationStoreOptions, URLSearchParamsInit } from "@zayne-labs/toolkit-core";
3
3
 
4
4
  //#region src/hooks/useSearchParams.d.ts
5
5
  type UseSearchParamsOptions = LocationStoreOptions & {
6
6
  action?: "push" | "replace";
7
7
  };
8
- declare const useSearchParams: <TSearchParams extends URLSearchParamsInit>(options?: UseSearchParamsOptions) => [searchParams: URLSearchParams, setSearchParams: (newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core4.LocationInfo["state"]) => void];
9
- declare const useSearchParamsObject: <TSearchParams extends Record<string, string>>(options?: UseSearchParamsOptions) => [searchParamsObject: TSearchParams, setSearchParamsObject: (newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core4.LocationInfo["state"]) => void];
8
+ declare const useSearchParams: <TSearchParams extends URLSearchParamsInit>(options?: UseSearchParamsOptions) => [searchParams: URLSearchParams, setSearchParams: (newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core6.LocationInfo["state"]) => void];
9
+ declare const useSearchParamsObject: <TSearchParams extends Record<string, string>>(options?: UseSearchParamsOptions) => [searchParamsObject: TSearchParams, setSearchParamsObject: (newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)) => void, triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core6.LocationInfo["state"]) => void];
10
10
  //#endregion
11
11
  export { useSearchParams, useSearchParamsObject };
12
12
  //# sourceMappingURL=useSearchParams.d.ts.map
@@ -1,4 +1,4 @@
1
- import * as _zayne_labs_toolkit_core6 from "@zayne-labs/toolkit-core";
1
+ import * as _zayne_labs_toolkit_core8 from "@zayne-labs/toolkit-core";
2
2
  import { StorageOptions, StorageStoreApi } from "@zayne-labs/toolkit-core";
3
3
  import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
4
4
 
@@ -8,7 +8,7 @@ type UseStorageResult<TState, TSlice = TState> = [state: TSlice, actions: Storag
8
8
  * @description Creates a custom hook that returns a storage state and actions to modify it. You can use this if you need shared options.
9
9
  * @note You must use this if you want to be able to prevent syncing state across tabs.
10
10
  */
11
- declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core6.StoreApi<TState> & {
11
+ declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core8.StoreApi<TState> & {
12
12
  removeState: () => void;
13
13
  } & (<TSlice = TState>(selector?: SelectorFn<TState, TSlice>) => UseStorageResult<TState, TSlice>);
14
14
  type UseStorageStateOptions<TValue> = Omit<StorageOptions<TValue>, "initialValue" | "key">;
@@ -1,5 +1,5 @@
1
1
  import { CustomContextOptions } from "../hooks/createCustomContext.js";
2
- import * as react11 from "react";
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";
5
5
 
@@ -7,7 +7,7 @@ import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
7
7
  declare const createZustandContext: <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
- }) => react11.FunctionComponentElement<react11.ProviderProps<TStore>>, useZustandStoreContext: <TResult = TState>(selector?: SelectorFn<TState, TResult>) => TResult];
10
+ }) => react0.FunctionComponentElement<react0.ProviderProps<TStore>>, useZustandStoreContext: <TResult = TState>(selector?: SelectorFn<TState, TResult>) => TResult];
11
11
  //#endregion
12
12
  export { createZustandContext };
13
13
  //# sourceMappingURL=createZustandContext.d.ts.map
@@ -1,12 +1,12 @@
1
1
  import { StateCreator, StoreMutatorIdentifier, UseBoundStore } from "./types.js";
2
- import * as _zayne_labs_toolkit_core7 from "@zayne-labs/toolkit-core";
2
+ import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
3
3
  import { AnyObject, Prettify } from "@zayne-labs/toolkit-type-helpers";
4
4
 
5
5
  //#region src/zustand/createZustandStoreWithCombine.d.ts
6
6
  type Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;
7
7
  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>;
8
- declare const createStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => _zayne_labs_toolkit_core7.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>;
9
- declare const createWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => UseBoundStore<_zayne_labs_toolkit_core7.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: T[Key] } : never>>;
8
+ declare const createStoreWithCombine: <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>;
9
+ declare const createWithCombine: <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>>;
10
10
  //#endregion
11
11
  export { combine, createStoreWithCombine, createWithCombine };
12
12
  //# sourceMappingURL=createZustandStoreWithCombine.d.ts.map
@@ -2,11 +2,11 @@ import { StoreApi } from "@zayne-labs/toolkit-core";
2
2
 
3
3
  //#region src/zustand/types.d.ts
4
4
  type StoreMutatorIdentifier = never;
5
- type Get<T, K, F> = K extends keyof T ? T[K] : F;
5
+ type Get<T$1, K, F> = K extends keyof T$1 ? T$1[K] : F;
6
6
  type Mutate<S, Ms> = number extends Ms["length" & keyof Ms] ? S : Ms extends [] ? S : Ms extends [[infer IgnoredMi, infer IgnoredMa], ...infer Mrs] ? Mutate<never, Mrs> : never;
7
- type StateCreator<T, Mis extends Array<[StoreMutatorIdentifier, unknown]> = [], Mos extends Array<[StoreMutatorIdentifier, unknown]> = [], U = T> = {
7
+ type StateCreator<T$1, Mis extends Array<[StoreMutatorIdentifier, unknown]> = [], Mos extends Array<[StoreMutatorIdentifier, unknown]> = [], U = T$1> = {
8
8
  $$storeMutators?: Mos;
9
- } & ((setState: Get<Mutate<StoreApi<T>, Mis>, "setState", never>, getState: Get<Mutate<StoreApi<T>, Mis>, "getState", never>, store: Mutate<StoreApi<T>, Mis>) => U);
9
+ } & ((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);
10
10
  type ExtractState<S> = S extends ({
11
11
  getState: () => infer T;
12
12
  }) ? T : never;
@@ -14,7 +14,7 @@ type UseBoundStore<S extends ReadonlyStoreApi<unknown>> = S & {
14
14
  (): ExtractState<S>;
15
15
  <U>(selector: (state: ExtractState<S>) => U): U;
16
16
  };
17
- type ReadonlyStoreApi<T> = Pick<StoreApi<T>, "getInitialState" | "getState" | "subscribe">;
17
+ type ReadonlyStoreApi<T$1> = Pick<StoreApi<T$1>, "getInitialState" | "getState" | "subscribe">;
18
18
  //#endregion
19
19
  export { Mutate, StateCreator, StoreMutatorIdentifier, UseBoundStore };
20
20
  //# sourceMappingURL=types.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.3",
4
+ "version": "0.12.5",
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",
@@ -44,8 +44,8 @@
44
44
  }
45
45
  },
46
46
  "dependencies": {
47
- "@zayne-labs/toolkit-core": "0.12.3",
48
- "@zayne-labs/toolkit-type-helpers": "0.12.3"
47
+ "@zayne-labs/toolkit-core": "0.12.5",
48
+ "@zayne-labs/toolkit-type-helpers": "0.12.5"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@arethetypeswrong/cli": "^0.18.2",
@@ -53,16 +53,16 @@
53
53
  "@size-limit/esbuild-why": "^11.2.0",
54
54
  "@size-limit/preset-small-lib": "^11.2.0",
55
55
  "@total-typescript/ts-reset": "^0.6.1",
56
- "@types/node": "^24.6.2",
57
- "@types/react": "^19.2.0",
58
- "@zayne-labs/tsconfig": "0.10.4",
56
+ "@types/node": "^24.9.1",
57
+ "@types/react": "^19.2.2",
58
+ "@zayne-labs/tsconfig": "0.11.4",
59
59
  "concurrently": "^9.2.1",
60
60
  "cross-env": "^10.1.0",
61
- "publint": "^0.3.13",
61
+ "publint": "^0.3.15",
62
62
  "react": "^19.2.0",
63
63
  "size-limit": "^11.2.0",
64
64
  "tailwind-merge": "3.3.1",
65
- "tsdown": "^0.15.6",
65
+ "tsdown": "^0.15.10",
66
66
  "typescript": "5.9.3"
67
67
  },
68
68
  "publishConfig": {