@zayne-labs/toolkit-react 0.9.56 → 0.10.0

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, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../index-ByBT4lEU.js";
2
- export { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
1
+ import { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompare, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../index-CyMTab9t.js";
2
+ export { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompare, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
@@ -1,3 +1,3 @@
1
- import { ContextError, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../hooks-DjqgsmLX.js";
1
+ import { ContextError, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompare, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect } from "../hooks-D7cLOqht.js";
2
2
 
3
- export { ContextError, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
3
+ export { ContextError, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompare, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
@@ -1,6 +1,6 @@
1
1
  import { defineEnum, isArray, isBoolean, isFunction, isPlainObject } from "@zayne-labs/toolkit-type-helpers";
2
2
  import { createContext, use, useCallback, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
- import { copyToClipboard, createExternalStorageStore, createLocationStore, createScrollObserver, createSearchParams, debounce, lockScroll, on, onClickOutside, setAnimationInterval, throttleByFrame, throttleBySetTimeout, throttleByTime, toArray } from "@zayne-labs/toolkit-core";
3
+ import { copyToClipboard, createExternalStorageStore, createLocationStore, createScrollObserver, createSearchParams, debounce, lockScroll, on, onClickOutside, setAnimationInterval, shallowCompare, throttleByFrame, throttleBySetTimeout, throttleByTime, toArray } from "@zayne-labs/toolkit-core";
4
4
 
5
5
  //#region src/hooks/createCustomContext.ts
6
6
  var ContextError = class extends Error {
@@ -301,6 +301,18 @@ const useIsServer = () => {
301
301
  return isServer;
302
302
  };
303
303
 
304
+ //#endregion
305
+ //#region src/hooks/useShallowCompare.ts
306
+ const useShallowCompare = (selector) => {
307
+ const prev = useRef(void 0);
308
+ const shallowSelector = (state) => {
309
+ const nextState = selector(state);
310
+ if (shallowCompare(prev.current, nextState)) return prev.current;
311
+ return prev.current = nextState;
312
+ };
313
+ return shallowSelector;
314
+ };
315
+
304
316
  //#endregion
305
317
  //#region src/hooks/useStore.ts
306
318
  const identity = (value) => value;
@@ -571,5 +583,5 @@ const useThrottleByFrame = (callbackFn) => {
571
583
  };
572
584
 
573
585
  //#endregion
574
- export { ContextError, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
575
- //# sourceMappingURL=hooks-DjqgsmLX.js.map
586
+ export { ContextError, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompare, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
587
+ //# sourceMappingURL=hooks-D7cLOqht.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-D7cLOqht.js","names":["hook: string","provider: string","options: CustomContextOptions<TContextValue, TStrict>","callbackFn: TCallback | undefined","useAfterMountEffect: typeof useEffect","effect: () => Promise<ReturnType<React.EffectCallback>>","deps?: React.DependencyList","callBackFn: React.EffectCallback","callBackFn: () => void","cleanUpFn: Destructor","target: HTMLElement","className: string","elementsInfoArray: ElementsInfoArray<TTargetElement>","initCallbackFn: () => TResult","options: AnimationOptions","refOrRefArray: Array<React.RefObject<TElement>> | React.RefObject<TElement>","callback: (event: MouseEvent | TouchEvent) => void","options?: UseClickOutsideOptions","value: string","callBackFn: CallbackFn<TParams>","delay: number | undefined","defaultValue: TValue","initialValue: InitialState","newValue?: TValue","options: DisclosureOptions","value?: TValue","selector: SelectorFn<TState, TResult>","state: TState","value: TState","store: StoreApi<TState>","selector: SelectorFn<TState, TSlice>","options?: LocationStoreOptions","useLocationState","selector?: SelectorFn<LocationInfo, TSlice>","useAnimationPresence: UseSpecificPresence","value: boolean","newValue?: TValue","useTransitionPresence: UseSpecificPresence","value: boolean","newValue?: TValue","usePresence: UsePresence","options: ScrollObserverOptions","observedElementRef: RefCallback<TElement>","item: unknown","item: Record<string, unknown>","query: string","initialData: TData[]","delay?: number","options?: UseSearchParamsOptions","newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)","newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)","baseOptions: StorageOptions<TState>","useStorageState","selector?: SelectorFn<TState, TSlice>","key: string","initialValue?: TValue","options?: UseStorageStateOptions<TValue> & { select?: SelectorFn<TValue, TSlice> }","callbackFn: CallbackFn<TParams>","delay: number"],"sources":["../../src/hooks/createCustomContext.ts","../../src/hooks/useCallbackRef.ts","../../src/hooks/effects/useAfterMountEffect.ts","../../src/hooks/effects/useAsyncEffect.ts","../../src/hooks/effects/useEffectOnce.ts","../../src/hooks/effects/useLifeCycle.ts","../../src/hooks/effects/useMountEffect.ts","../../src/hooks/effects/useUnMountEffect.ts","../../src/hooks/useAnimateElementRefs.ts","../../src/hooks/useConstant.ts","../../src/hooks/useAnimationInterval.ts","../../src/hooks/useClickOutside.ts","../../src/hooks/useCopyToClipboard.ts","../../src/hooks/useDebounce.ts","../../src/hooks/useToggle.ts","../../src/hooks/useDisclosure.ts","../../src/hooks/useIsServer.ts","../../src/hooks/useShallowCompare.ts","../../src/hooks/useStore.ts","../../src/hooks/useLocationState.ts","../../src/hooks/usePresence/useAnimationPresence.ts","../../src/hooks/usePresence/useTransitionPresence.ts","../../src/hooks/usePresence/usePresence.ts","../../src/hooks/useScrollObserver.ts","../../src/hooks/useSearch.ts","../../src/hooks/useSearchParams.ts","../../src/hooks/useStorageState.ts","../../src/hooks/useThrottle.ts"],"sourcesContent":["import { defineEnum } from \"@zayne-labs/toolkit-type-helpers\";\nimport { createContext, use } from \"react\";\n\nexport class ContextError extends Error {\n\toverride name = \"ContextError\";\n\n\tconstructor(...args: Parameters<typeof Error>) {\n\t\tsuper(...args);\n\n\t\tError.captureStackTrace(this, this.constructor);\n\t}\n}\n\nexport const getErrorMessage = (hook: string, provider: string) => {\n\treturn `${hook} returned \"null\". Did you forget to wrap the necessary components within ${provider}?`;\n};\n\nexport type CustomContextOptions<TContextValue, TStrict extends boolean> = {\n\tdefaultValue?: TContextValue | null;\n\terrorMessage?: string;\n\textension?: (contextValue: NoInfer<TContextValue> | null) => TContextValue | null;\n\thookName?: string;\n\tname?: string;\n\tproviderName?: string;\n\tstrict?: TStrict;\n};\n\ntype UseCustomContextResult<TContextValue, TStrict extends boolean> =\n\tTStrict extends true ? TContextValue : TContextValue | null;\n\nconst createCustomContext = <TContextValue, TStrict extends boolean = true>(\n\toptions: CustomContextOptions<TContextValue, TStrict> = {}\n) => {\n\tconst {\n\t\tdefaultValue = null,\n\t\terrorMessage,\n\t\textension,\n\t\thookName = \"useUnnamedContext\",\n\t\tproviderName = \"UnnamedContextProvider\",\n\t\tname = providerName.endsWith(\"Provider\") ? providerName.slice(0, -8) : \"UnnamedContext\",\n\t\tstrict = true,\n\t} = options;\n\n\tconst Context = createContext<TContextValue | null>(defaultValue);\n\n\tContext.displayName = name;\n\n\tconst useCustomContext = (): UseCustomContextResult<TContextValue, TStrict> => {\n\t\tconst contextValue = use(Context);\n\n\t\tconst extendedContextValue = extension?.(contextValue) ?? contextValue;\n\n\t\tif (strict && extendedContextValue === null) {\n\t\t\tthrow new ContextError(errorMessage ?? getErrorMessage(hookName, providerName));\n\t\t}\n\n\t\treturn extendedContextValue as NonNullable<typeof extendedContextValue>;\n\t};\n\n\treturn defineEnum([Context, useCustomContext]);\n};\n\nexport { createCustomContext };\n","import type { AnyFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useCallback, useLayoutEffect, useRef } from \"react\";\n\n/**\n * Returns a stable function that always points to the latest version of the callback function.\n * @param callbackFn - The function to reference\n * @returns a stable function that always points to the latest version of the callback function\n */\n\nconst useCallbackRef = <TCallback = AnyFunction>(callbackFn: TCallback | undefined) => {\n\tconst callbackRef = useRef(callbackFn);\n\n\tuseLayoutEffect(() => {\n\t\t// == Doing this instead updating it during render cuz according to Dan Abramov, render should be pure\n\t\tcallbackRef.current = callbackFn;\n\t}, [callbackFn]);\n\n\tconst savedCallback = useCallback(\n\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- callbackRef.current can be null in some cases\n\t\t(...params: unknown[]) => (callbackRef.current as AnyFunction)?.(...params) as unknown,\n\t\t[]\n\t);\n\n\treturn savedCallback as TCallback;\n};\n\nexport { useCallbackRef };\n","import { useEffect, useRef } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nconst useAfterMountEffect: typeof useEffect = (callBackFn, deps) => {\n\tconst isFirstMount = useRef(true);\n\tconst stableCallback = useCallbackRef(callBackFn);\n\n\tuseEffect(() => {\n\t\tif (isFirstMount.current) {\n\t\t\tisFirstMount.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\tstableCallback();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableCallback is stable\n\t}, deps);\n};\nexport { useAfterMountEffect };\n","import { useEffect, useState } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nexport function useAsyncEffect(\n\teffect: () => Promise<ReturnType<React.EffectCallback>>,\n\tdeps?: React.DependencyList\n) {\n\tconst stableEffectCallback = useCallbackRef(effect);\n\tconst [destroy, setDestroy] = useState<ReturnType<React.EffectCallback>>();\n\n\tuseEffect(() => {\n\t\tconst e = stableEffectCallback();\n\n\t\tasync function execute() {\n\t\t\tsetDestroy(await e);\n\t\t}\n\n\t\tvoid execute();\n\n\t\treturn () => void destroy?.();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableEffectCallback is stable\n\t}, deps);\n}\n","import { useEffect, useRef } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nconst useEffectOnce = (callBackFn: React.EffectCallback) => {\n\tconst stableCallback = useCallbackRef(callBackFn);\n\n\tconst effectGuard = useRef(false);\n\n\t// == savedCallback is always stable so no worries about re-execution of this effect\n\tuseEffect(() => {\n\t\tif (effectGuard.current) return;\n\n\t\teffectGuard.current = true;\n\n\t\treturn stableCallback();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableCallback is stable\n\t}, []);\n};\n\nexport { useEffectOnce };\n","import { useEffect } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nexport type Destructor = ReturnType<React.EffectCallback>;\n\ntype LifeCycleOptions = {\n\tonMount?: () => void;\n\tonUnmount?: Destructor;\n};\n\nconst useLifeCycle = ({ onMount, onUnmount }: LifeCycleOptions) => {\n\tconst stableOnMount = useCallbackRef(onMount);\n\tconst stableOnUnmount = useCallbackRef(onUnmount);\n\n\tuseEffect(() => {\n\t\tstableOnMount();\n\n\t\treturn stableOnUnmount;\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableOnMount and stableOnUnmount are stable\n\t}, []);\n};\n\nexport { useLifeCycle };\n","import { useLifeCycle } from \"./useLifeCycle\";\n\nconst useMountEffect = (callBackFn: () => void) => {\n\tuseLifeCycle({ onMount: callBackFn });\n};\n\nexport { useMountEffect };\n","import { type Destructor, useLifeCycle } from \"./useLifeCycle\";\n\nconst useUnmountEffect = (cleanUpFn: Destructor) => useLifeCycle({ onUnmount: cleanUpFn });\n\nexport { useUnmountEffect };\n","import { on } from \"@zayne-labs/toolkit-core\";\nimport { type NonEmptyArray, isArray } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useCallback, useRef } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\n\ntype ElementsInfoArray<TTargetElement extends string> = NonEmptyArray<{\n\tanimationClass: string;\n\ttargetElement: TTargetElement;\n}>;\n\nconst removeClass = (target: HTMLElement, className: string) => () => target.classList.remove(className);\n\n/**\n * This is a custom React hook that adds and removes animation classes to specified HTML elements.\n * @param elementsInfoArray - An array of objects that contain information about the animation class and the target HTML element.\n * @returns - An object containing the refs of the animated elements and a function to handle the initiation and removal animation.\n */\n\nconst useAnimateElementRefs = <TTargetElement extends string>(\n\telementsInfoArray: ElementsInfoArray<TTargetElement>\n) => {\n\tconst elementsRef = useRef<Record<TTargetElement, HTMLElement | null>>({} as never);\n\n\tconst addAnimationClasses = useCallbackRef(() => {\n\t\tif (!isArray(elementsInfoArray)) {\n\t\t\tconsole.error(\"elementsInfo is not an Array\");\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const { animationClass, targetElement } of elementsInfoArray) {\n\t\t\tif (!elementsRef.current[targetElement]) {\n\t\t\t\tconsole.error(\"ElementError\", `\"${targetElement}\" element does not exist`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\telementsRef.current[targetElement].classList.add(animationClass);\n\t\t}\n\t});\n\n\tconst removeAnimationClasses = useCallbackRef(() => {\n\t\tif (!isArray(elementsInfoArray)) {\n\t\t\tconsole.error(\"elementsInfo is not an Array\");\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const { animationClass, targetElement } of elementsInfoArray) {\n\t\t\tif (!elementsRef.current[targetElement]) {\n\t\t\t\tconsole.error(\"ElementError\", `\"${targetElement}\" element does not exist`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ton(\n\t\t\t\t\"transitionend\",\n\t\t\t\telementsRef.current[targetElement],\n\t\t\t\tremoveClass(elementsRef.current[targetElement], animationClass)\n\t\t\t);\n\n\t\t\ton(\n\t\t\t\t\"animationend\",\n\t\t\t\telementsRef.current[targetElement],\n\t\t\t\tremoveClass(elementsRef.current[targetElement], animationClass)\n\t\t\t);\n\t\t}\n\t});\n\n\t// Add animation classes to elements and remove them after the animation ends\n\tconst handleElementsAnimation = useCallback(() => {\n\t\taddAnimationClasses();\n\n\t\tremoveAnimationClasses();\n\t}, [addAnimationClasses, removeAnimationClasses]);\n\n\treturn { animatedElements: elementsRef.current, handleElementsAnimation };\n};\n\nexport { useAnimateElementRefs };\n","import { useRef } from \"react\";\n\nconst useConstant = <TResult>(initCallbackFn: () => TResult) => {\n\tconst resultRef = useRef<TResult | null>(null);\n\n\t// eslint-disable-next-line ts-eslint/prefer-nullish-coalescing -- The current case is justified since it's optimizable by the react compiler\n\tif (resultRef.current === null) {\n\t\tresultRef.current = initCallbackFn();\n\t}\n\n\treturn resultRef.current;\n};\n\nexport { useConstant };\n","import { type AnimationIntervalOptions, setAnimationInterval } from \"@zayne-labs/toolkit-core\";\nimport type { Prettify } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useEffect } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\ntype AnimationOptions = Prettify<\n\tAnimationIntervalOptions & {\n\t\tintervalDuration: number | null;\n\t\tonAnimation: () => void;\n\t}\n>;\n\nconst useAnimationInterval = (options: AnimationOptions) => {\n\tconst { intervalDuration, onAnimation, once } = options;\n\n\tconst latestCallback = useCallbackRef(onAnimation);\n\n\t// prettier-ignore\n\tconst { start, stop } = useConstant(() => setAnimationInterval(latestCallback, intervalDuration, { once }));\n\n\tuseEffect(() => {\n\t\tif (intervalDuration === null) return;\n\n\t\tstart();\n\n\t\treturn stop;\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- start and stop are stable\n\t}, [intervalDuration]);\n\n\treturn { start, stop };\n};\n\nexport { useAnimationInterval };\n","import { onClickOutside, toArray } from \"@zayne-labs/toolkit-core\";\nimport { useEffect } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\n\ntype UseClickOutsideOptions = {\n\tenabled?: boolean;\n};\n\nconst useClickOutside = <TElement extends HTMLElement>(\n\trefOrRefArray: Array<React.RefObject<TElement>> | React.RefObject<TElement>,\n\tcallback: (event: MouseEvent | TouchEvent) => void,\n\toptions?: UseClickOutsideOptions\n) => {\n\tconst { enabled = true } = options ?? {};\n\n\tconst savedCallback = useCallbackRef(callback);\n\n\tuseEffect(() => {\n\t\tif (!enabled) return;\n\n\t\tconst controller = new AbortController();\n\n\t\tconst elementArray = toArray(refOrRefArray).map((ref) => ref.current);\n\n\t\tonClickOutside(elementArray, savedCallback, { signal: controller.signal });\n\n\t\treturn () => {\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [enabled, refOrRefArray, savedCallback]);\n};\n\nexport { useClickOutside };\n","import { copyToClipboard } from \"@zayne-labs/toolkit-core\";\nimport { useState } from \"react\";\n\nconst useCopyToClipboard = () => {\n\tconst [state, setState] = useState(\"\");\n\n\tconst handleCopy = (value: string) => {\n\t\tsetState(value);\n\t\tvoid copyToClipboard(value);\n\t};\n\n\treturn { copiedValue: state, handleCopy };\n};\n\nexport { useCopyToClipboard };\n","import { debounce } from \"@zayne-labs/toolkit-core\";\nimport type { CallbackFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useState } from \"react\";\nimport { useUnmountEffect } from \"./effects/useUnMountEffect\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\nexport const useDebouncedFn = <TParams>(callBackFn: CallbackFn<TParams>, delay: number | undefined) => {\n\tconst latestCallback = useCallbackRef(callBackFn);\n\n\tconst debouncedFn = useConstant(() => debounce(latestCallback, delay));\n\n\tuseUnmountEffect(() => {\n\t\tdebouncedFn.cancel();\n\t\tdebouncedFn.cancelMaxWait();\n\t});\n\n\treturn debouncedFn;\n};\n\nexport const useDebouncedState = <TValue>(defaultValue: TValue, delay: number | undefined) => {\n\tconst [value, setValue] = useState(defaultValue);\n\n\tconst setDebouncedValue = useConstant(() => debounce(setValue, delay));\n\n\tuseUnmountEffect(() => {\n\t\tsetDebouncedValue.cancel();\n\t\tsetDebouncedValue.cancelMaxWait();\n\t});\n\n\treturn [value, setDebouncedValue, setValue] as const;\n};\n","import { useCallback, useState } from \"react\";\n\ntype InitialState = boolean | (() => boolean);\n\nconst useToggle = (initialValue: InitialState = false) => {\n\tconst [value, setValue] = useState(initialValue);\n\n\tconst toggle = useCallback(<TValue>(newValue?: TValue) => {\n\t\tif (typeof newValue === \"boolean\") {\n\t\t\tsetValue(newValue);\n\t\t\treturn;\n\t\t}\n\n\t\tsetValue((prev) => !prev);\n\t}, []);\n\n\treturn [value, toggle] as const;\n};\n\nexport { useToggle };\n","import { lockScroll } from \"@zayne-labs/toolkit-core\";\nimport { isBoolean } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useToggle } from \"./useToggle\";\n\ntype DisclosureOptions = {\n\thasScrollControl?: boolean;\n\tinitialState?: boolean | (() => boolean);\n};\n\nconst useDisclosure = (options: DisclosureOptions = {}) => {\n\tconst { hasScrollControl = false, initialState = false } = options;\n\tconst [isOpen, toggleIsOpen] = useToggle(initialState);\n\n\tconst onOpen = useCallbackRef(() => {\n\t\ttoggleIsOpen(true);\n\t\thasScrollControl && lockScroll({ lock: true });\n\t});\n\n\tconst onClose = useCallbackRef(() => {\n\t\ttoggleIsOpen(false);\n\t\thasScrollControl && lockScroll({ lock: false });\n\t});\n\n\tconst onToggle = useCallbackRef(<TValue>(value?: TValue) => {\n\t\tif (isBoolean(value)) {\n\t\t\ttoggleIsOpen(value);\n\t\t\thasScrollControl && lockScroll({ lock: value });\n\t\t\treturn;\n\t\t}\n\n\t\tisOpen ? onClose() : onOpen();\n\t});\n\n\tconst api = useMemo(() => ({ isOpen, onClose, onOpen, onToggle }), [isOpen, onClose, onOpen, onToggle]);\n\n\treturn api;\n};\nexport { useDisclosure };\n","import { useSyncExternalStore } from \"react\";\n\nconst noopStore = {\n\tgetServerSnapshot: () => true,\n\tgetSnapshot: () => false,\n\t// eslint-disable-next-line unicorn/consistent-function-scoping -- It's fine\n\tsubscribe: () => () => {},\n};\n\n/**\n * @description Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nconst useIsServer = () => {\n\tconst isServer = useSyncExternalStore(\n\t\tnoopStore.subscribe,\n\t\tnoopStore.getSnapshot,\n\t\tnoopStore.getServerSnapshot\n\t);\n\n\treturn isServer;\n};\n\nexport { useIsServer };\n","import { shallowCompare } from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useRef } from \"react\";\n\nconst useShallowCompare = <TState, TResult>(selector: SelectorFn<TState, TResult>) => {\n\tconst prev = useRef<TResult>(undefined as never);\n\n\tconst shallowSelector = (state: TState) => {\n\t\tconst nextState = selector(state);\n\n\t\tif (shallowCompare(prev.current, nextState)) {\n\t\t\treturn prev.current;\n\t\t}\n\n\t\treturn (prev.current = nextState);\n\t};\n\n\treturn shallowSelector;\n};\n\nexport { useShallowCompare };\n","import type { StoreApi } from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useDebugValue, useSyncExternalStore } from \"react\";\n\nconst identity = <TState>(value: TState) => value;\n\nconst useStore = <TState, TSlice = TState>(\n\tstore: StoreApi<TState>,\n\tselector: SelectorFn<TState, TSlice> = identity as never\n) => {\n\tconst slice = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => selector(store.getState()),\n\t\t() => selector(store.getInitialState())\n\t);\n\n\tuseDebugValue(slice);\n\n\treturn slice;\n};\n\nexport { useStore };\n","import {\n\tcreateLocationStore,\n\ttype LocationInfo,\n\ttype LocationStoreApi,\n\ttype LocationStoreOptions,\n} from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useConstant } from \"./useConstant\";\nimport { useStore } from \"./useStore\";\n\ntype UseLocationResult<TSlice> = [state: TSlice, actions: LocationStoreApi];\n\nexport const createUseLocationState = (options?: LocationStoreOptions) => {\n\tconst locationStore = createLocationStore(options);\n\n\ttype UseBoundLocationState = LocationStoreApi\n\t\t& (<TSlice = LocationInfo>(\n\t\t\tselector?: SelectorFn<LocationInfo, TSlice>\n\t\t) => UseLocationResult<TSlice>);\n\n\tconst useLocationState = <TSlice = LocationInfo>(\n\t\tselector?: SelectorFn<LocationInfo, TSlice>\n\t): UseLocationResult<TSlice> => {\n\t\tconst stateSlice = useStore(locationStore as never, selector);\n\n\t\treturn [stateSlice, locationStore];\n\t};\n\n\tObject.assign(useLocationState, locationStore);\n\n\treturn useLocationState as UseBoundLocationState;\n};\n\nexport const useLocationState = <TSlice = LocationInfo>(\n\tselector?: SelectorFn<LocationInfo, TSlice>,\n\toptions?: LocationStoreOptions\n): UseLocationResult<TSlice> => {\n\tconst locationStore = useConstant(() => createLocationStore(options));\n\n\tconst stateSlice = useStore(locationStore as never, selector);\n\n\treturn [stateSlice, locationStore];\n};\n","import { on } from \"@zayne-labs/toolkit-core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\nimport { useDebouncedState } from \"../useDebounce\";\nimport type { UseSpecificPresence } from \"./types\";\n\nconst useAnimationPresence: UseSpecificPresence = (options = {}) => {\n\tconst { defaultValue = true, duration, onExitComplete } = options;\n\n\tconst [isShown, setIsShown] = useState(defaultValue);\n\n\tconst [isMounted, setDebouncedIsMounted, setRegularIsMounted] = useDebouncedState(\n\t\tdefaultValue,\n\t\tduration\n\t);\n\tconst elementRef = useRef<HTMLElement>(null);\n\n\tconst stableOnExitComplete = useCallbackRef(onExitComplete);\n\n\tuseEffect(() => {\n\t\t!isMounted && stableOnExitComplete();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableOnExitComplete is stable\n\t}, [isMounted]);\n\n\tconst handleIsMountedWithoutRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetRegularIsMounted(true);\n\t\t\treturn;\n\t\t}\n\n\t\tsetDebouncedIsMounted(false);\n\t};\n\n\tconst handleIsMountedWithRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetRegularIsMounted(true);\n\t\t\treturn;\n\t\t}\n\n\t\ton(\"animationend\", elementRef.current, () => {\n\t\t\tsetDebouncedIsMounted.cancel();\n\t\t\tsetRegularIsMounted(false);\n\t\t});\n\t};\n\n\tconst toggleVisibility = useCallbackRef(<TValue>(newValue?: TValue) => {\n\t\tconst handleSetIsMounted = !duration ? handleIsMountedWithRef : handleIsMountedWithoutRef;\n\n\t\tif (typeof newValue === \"boolean\") {\n\t\t\tsetIsShown(newValue);\n\t\t\thandleSetIsMounted(newValue);\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsShown(!isShown);\n\t\thandleSetIsMounted(!isShown);\n\t});\n\n\treturn {\n\t\tisPresent: isMounted,\n\t\tisVisible: isShown,\n\t\ttoggleVisibility,\n\t\t...(duration === undefined && { elementRef }),\n\t} as never;\n};\n\nexport { useAnimationPresence };\n","import { on } from \"@zayne-labs/toolkit-core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\nimport { useDebouncedState } from \"../useDebounce\";\nimport type { UseSpecificPresence } from \"./types\";\n\nconst useTransitionPresence: UseSpecificPresence = (options = {}) => {\n\tconst { defaultValue = true, duration, onExitComplete } = options;\n\n\tconst [isShown, setIsShown] = useState(defaultValue);\n\n\tconst [isMounted, setDebouncedIsMounted, setRegularIsMounted] = useDebouncedState(\n\t\tdefaultValue,\n\t\tduration\n\t);\n\tconst elementRef = useRef<HTMLElement>(null);\n\tconst stableOnExitComplete = useCallbackRef(onExitComplete);\n\n\tconst handleIsMountedWithoutRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetDebouncedIsMounted(value, { $delay: 0 });\n\t\t\treturn;\n\t\t}\n\n\t\tsetDebouncedIsMounted(false);\n\t};\n\n\tconst handleIsMountedWithRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetDebouncedIsMounted(value, { $delay: 0 });\n\t\t\treturn;\n\t\t}\n\n\t\ton(\"transitionend\", elementRef.current, () => {\n\t\t\tsetDebouncedIsMounted.cancel();\n\t\t\tsetRegularIsMounted(false);\n\t\t});\n\t};\n\n\tconst toggleVisibility = useCallbackRef(<TValue>(newValue?: TValue) => {\n\t\tconst handleSetIsMounted = !duration ? handleIsMountedWithRef : handleIsMountedWithoutRef;\n\n\t\tif (typeof newValue === \"boolean\") {\n\t\t\tsetIsShown(newValue);\n\t\t\thandleSetIsMounted(newValue);\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsShown(!isShown);\n\t\thandleSetIsMounted(!isShown);\n\t});\n\n\tuseEffect(() => {\n\t\t!isMounted && stableOnExitComplete();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableOnExitComplete is stable\n\t}, [isMounted]);\n\n\treturn {\n\t\tisPresent: isMounted || isShown,\n\t\tisVisible: isMounted && isShown,\n\t\ttoggleVisibility,\n\t\t...(duration === undefined && { elementRef }),\n\t} as never;\n};\n\nexport { useTransitionPresence };\n","import type { UsePresence } from \"./types\";\nimport { useAnimationPresence } from \"./useAnimationPresence\";\nimport { useTransitionPresence } from \"./useTransitionPresence\";\n\n/**\n * usePresence hook provides a way to animate an element, before removing it from the DOM.\n * @param defaultValue - The default value for the presence state. Defaults to `true`.\n * @param options - The options for the usePresence hook.\n * @returns A object containing the boolean that should be used to conditionally render the element (isPresent), another boolean used to toggle the animation classes, and a function to toggle the state.\n */\n\nconst usePresence: UsePresence = (options = {}) => {\n\tconst { type = \"transition\", ...restOfOptions } = options;\n\n\tconst useSpecificPresence = type === \"transition\" ? useTransitionPresence : useAnimationPresence;\n\n\treturn useSpecificPresence(restOfOptions);\n};\n\nexport { usePresence };\n","import { type ScrollObserverOptions, createScrollObserver } from \"@zayne-labs/toolkit-core\";\nimport { type RefCallback, useState } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\nconst useScrollObserver = <TElement extends HTMLElement>(options: ScrollObserverOptions = {}) => {\n\tconst { onIntersection, rootMargin = \"10px 0px 0px 0px\", ...restOfOptions } = options;\n\n\tconst [isScrolled, setIsScrolled] = useState(false);\n\n\tconst savedOnIntersection = useCallbackRef(onIntersection);\n\n\tconst { handleObservation } = useConstant(() => {\n\t\treturn createScrollObserver({\n\t\t\tonIntersection: (entry, observer) => {\n\t\t\t\tconst newIsScrolledState = !entry.isIntersecting;\n\n\t\t\t\tsetIsScrolled(newIsScrolledState);\n\n\t\t\t\t// eslint-disable-next-line no-param-reassign -- Mutation is fine here\n\t\t\t\t(entry.target as HTMLElement).dataset.scrolled = String(newIsScrolledState);\n\n\t\t\t\tsavedOnIntersection(entry, observer);\n\t\t\t},\n\t\t\trootMargin,\n\t\t\t...restOfOptions,\n\t\t});\n\t});\n\n\tconst observedElementRef: RefCallback<TElement> = useCallbackRef((element) => {\n\t\tconst cleanupFn = handleObservation(element);\n\n\t\t// == React 18 may not call the cleanup function so we need to call it manually on element unmount\n\t\tif (!element) {\n\t\t\tcleanupFn?.();\n\t\t\treturn;\n\t\t}\n\n\t\treturn cleanupFn;\n\t});\n\n\treturn { isScrolled, observedElementRef };\n};\n\nexport { useScrollObserver };\n","import { isPlainObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useState } from \"react\";\nimport { useAfterMountEffect } from \"./effects/useAfterMountEffect\";\nimport { useDebouncedFn } from \"./useDebounce\";\n\nconst isSerializable = (item: unknown): item is boolean | number | string =>\n\ttypeof item === \"string\" || typeof item === \"number\" || typeof item === \"boolean\";\n\nconst checkObjectPropsForQuery = (item: Record<string, unknown>, query: string): boolean => {\n\tfor (const value of Object.values(item)) {\n\t\tif (isSerializable(value) && value.toString().toLowerCase().includes(query)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\nconst useSearch = <TData>(initialData: TData[], delay?: number) => {\n\tconst [searchQuery, setSearchQuery] = useState(\"\");\n\tconst [filteredData, setFilteredData] = useState(initialData);\n\tconst [isLoading, setIsLoading] = useState(false);\n\n\tconst handleDebouncedSearch = useDebouncedFn(() => {\n\t\tconst query = searchQuery.toLowerCase();\n\n\t\tconst filteredResults = initialData.filter((item) => {\n\t\t\tif (isSerializable(item)) {\n\t\t\t\treturn item.toString().toLowerCase().includes(query);\n\t\t\t}\n\n\t\t\tif (isPlainObject(item)) {\n\t\t\t\treturn checkObjectPropsForQuery(item, query);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t});\n\n\t\tsetFilteredData(filteredResults);\n\t\tsetIsLoading(false);\n\t}, delay);\n\n\tuseAfterMountEffect(() => {\n\t\tsetIsLoading(true);\n\t\thandleDebouncedSearch();\n\t}, [searchQuery]);\n\n\treturn { data: filteredData, isLoading, query: searchQuery, setQuery: setSearchQuery };\n};\n\nexport { useSearch };\n","import {\n\ttype LocationStoreOptions,\n\ttype URLSearchParamsInit,\n\tcreateSearchParams,\n} from \"@zayne-labs/toolkit-core\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useLocationState } from \"./useLocationState\";\n\ntype UseSearchParamsOptions = LocationStoreOptions & {\n\taction?: \"push\" | \"replace\";\n};\n\nexport const useSearchParams = <TSearchParams extends URLSearchParamsInit>(\n\toptions?: UseSearchParamsOptions\n) => {\n\tconst { action = \"push\", ...restOfOptions } = options ?? {};\n\n\tconst [searchParams, actions] = useLocationState((state) => state.search, restOfOptions);\n\n\tconst setSearchParams = (\n\t\tnewQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)\n\t) => {\n\t\tconst params = isFunction(newQueryParams) ? newQueryParams(searchParams) : newQueryParams;\n\n\t\tconst nextSearchParams = createSearchParams(params);\n\n\t\tactions[action]({ search: nextSearchParams });\n\t};\n\n\tsetSearchParams.triggerPopstateEvent = actions.triggerPopstateEvent;\n\n\treturn [searchParams, setSearchParams] as const;\n};\n\nexport const useSearchParamsObject = <TSearchParams extends Record<string, string>>(\n\toptions?: UseSearchParamsOptions\n) => {\n\tconst [searchParams, setSearchParams] = useSearchParams(options);\n\n\tconst searchParamsObject = Object.fromEntries(searchParams) as TSearchParams;\n\n\tconst setSearchParamsObject = (\n\t\tnewQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)\n\t) => {\n\t\tconst params = isFunction(newQueryParams) ? newQueryParams(searchParamsObject) : newQueryParams;\n\n\t\tsetSearchParams(params);\n\t};\n\n\tsetSearchParamsObject.triggerPopstateEvent = setSearchParams.triggerPopstateEvent;\n\n\treturn [searchParamsObject, setSearchParamsObject] as const;\n};\n","import {\n\tcreateExternalStorageStore,\n\ttype StorageOptions,\n\ttype StorageStoreApi,\n} from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useConstant } from \"./useConstant\";\nimport { useStore } from \"./useStore\";\n\ntype UseStorageResult<TState, TSlice = TState> = [state: TSlice, actions: StorageStoreApi<TState>];\n\n/**\n * @description Creates a custom hook that returns a storage state and actions to modify it. You can use this if you need shared options.\n * @note You must use this if you want to be able to prevent syncing state across tabs.\n */\nexport const createUseStorageState = <TState>(baseOptions: StorageOptions<TState>) => {\n\tconst externalStore = createExternalStorageStore(baseOptions);\n\n\ttype UseBoundStorageState = StorageStoreApi<TState>\n\t\t& (<TSlice = TState>(selector?: SelectorFn<TState, TSlice>) => UseStorageResult<TState, TSlice>);\n\n\tconst useStorageState = <TSlice = TState>(\n\t\tselector?: SelectorFn<TState, TSlice>\n\t): UseStorageResult<TState, TSlice> => {\n\t\tconst stateInStorage = useStore(externalStore, selector);\n\n\t\treturn [stateInStorage, externalStore];\n\t};\n\n\tObject.assign(useStorageState, externalStore);\n\n\treturn useStorageState as UseBoundStorageState;\n};\n\ntype UseStorageStateOptions<TValue> = Omit<StorageOptions<TValue>, \"initialValue\" | \"key\">;\n\nexport const useStorageState = <TValue, TSlice = TValue>(\n\tkey: string,\n\tinitialValue?: TValue,\n\toptions?: UseStorageStateOptions<TValue> & { select?: SelectorFn<TValue, TSlice> }\n): UseStorageResult<TValue, TSlice> => {\n\tconst { select, ...restOfOptions } = options ?? {};\n\n\tconst externalStore = useConstant(() => {\n\t\treturn createExternalStorageStore({ initialValue, key, ...restOfOptions });\n\t});\n\n\tconst stateInStorage = useStore(externalStore as never, select as never);\n\n\treturn [stateInStorage as never, externalStore];\n};\n","import { throttleByFrame, throttleBySetTimeout, throttleByTime } from \"@zayne-labs/toolkit-core\";\nimport type { CallbackFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useUnmountEffect } from \"./effects\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\nexport const useThrottleBySetTimeout = <TParams>(callbackFn: CallbackFn<TParams>, delay: number) => {\n\tconst latestCallback = useCallbackRef(callbackFn);\n\n\tconst throttledCallback = useConstant(() => throttleBySetTimeout(latestCallback, delay));\n\n\tuseUnmountEffect(() => throttledCallback.cancelTimeout());\n\n\treturn throttledCallback;\n};\n\nexport const useThrottleByTimer = <TParams>(callbackFn: CallbackFn<TParams>, delay: number) => {\n\tconst latestCallback = useCallbackRef(callbackFn);\n\n\tconst throttledCallback = useConstant(() => throttleByTime(latestCallback, delay));\n\n\treturn throttledCallback;\n};\n\nexport const useThrottleByFrame = <TParams>(callbackFn: CallbackFn<TParams>) => {\n\tconst latestCallback = useCallbackRef(callbackFn);\n\n\tconst throttledCallback = useConstant(() => throttleByFrame(latestCallback));\n\n\tuseUnmountEffect(() => throttledCallback.cancelAnimation());\n\n\treturn throttledCallback;\n};\n"],"mappings":";;;;;AAGA,IAAa,eAAb,cAAkC,MAAM;CACvC,AAAS,OAAO;CAEhB,YAAY,GAAG,MAAgC;AAC9C,QAAM,GAAG,KAAK;AAEd,QAAM,kBAAkB,MAAM,KAAK,YAAY;CAC/C;AACD;AAED,MAAa,kBAAkB,CAACA,MAAcC,aAAqB;AAClE,SAAQ,EAAE,KAAK,2EAA2E,SAAS;AACnG;AAeD,MAAM,sBAAsB,CAC3BC,UAAwD,CAAE,MACtD;CACJ,MAAM,EACL,eAAe,MACf,cACA,WACA,WAAW,qBACX,eAAe,0BACf,OAAO,aAAa,SAAS,WAAW,GAAG,aAAa,MAAM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D,MAAM,gBAAgB,YAAY,MAAM;AACvC,SAAO,2BAA2B;GAAE;GAAc;GAAK,GAAG;EAAe,EAAC;CAC1E,EAAC;CAEF,MAAM,iBAAiB,SAAS,eAAwB,OAAgB;AAExE,QAAO,CAAC,gBAAyB,aAAc;AAC/C;;;;AC5CD,MAAa,0BAA0B,CAAUC,YAAiCC,UAAkB;CACnG,MAAM,iBAAiB,eAAe,WAAW;CAEjD,MAAM,oBAAoB,YAAY,MAAM,qBAAqB,gBAAgB,MAAM,CAAC;AAExF,kBAAiB,MAAM,kBAAkB,eAAe,CAAC;AAEzD,QAAO;AACP;AAED,MAAa,qBAAqB,CAAUD,YAAiCC,UAAkB;CAC9F,MAAM,iBAAiB,eAAe,WAAW;CAEjD,MAAM,oBAAoB,YAAY,MAAM,eAAe,gBAAgB,MAAM,CAAC;AAElF,QAAO;AACP;AAED,MAAa,qBAAqB,CAAUD,eAAoC;CAC/E,MAAM,iBAAiB,eAAe,WAAW;CAEjD,MAAM,oBAAoB,YAAY,MAAM,gBAAgB,eAAe,CAAC;AAE5E,kBAAiB,MAAM,kBAAkB,iBAAiB,CAAC;AAE3D,QAAO;AACP"}
@@ -1,7 +1,7 @@
1
1
  import { AnyFunction, CallbackFn, NonEmptyArray, Prettify, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
2
- import * as react5 from "react";
2
+ import * as react0 from "react";
3
3
  import { RefCallback, useEffect } from "react";
4
- import * as _zayne_labs_toolkit_core12 from "@zayne-labs/toolkit-core";
4
+ import * as _zayne_labs_toolkit_core7 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
@@ -20,8 +20,8 @@ type CustomContextOptions<TContextValue, TStrict extends boolean> = {
20
20
  strict?: TStrict;
21
21
  };
22
22
  type UseCustomContextResult<TContextValue, TStrict extends boolean> = TStrict extends true ? TContextValue : TContextValue | null;
23
- declare const createCustomContext: <TContextValue, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [react5.Context<TContextValue | null>, () => UseCustomContextResult<TContextValue, TStrict>] & {
24
- "~inferredUnion": react5.Context<TContextValue | null> | (() => UseCustomContextResult<TContextValue, TStrict>);
23
+ declare const createCustomContext: <TContextValue, TStrict extends boolean = true>(options?: CustomContextOptions<TContextValue, TStrict>) => [react0.Context<TContextValue | null>, () => UseCustomContextResult<TContextValue, TStrict>] & {
24
+ "~inferredUnion": react0.Context<TContextValue | null> | (() => UseCustomContextResult<TContextValue, TStrict>);
25
25
  };
26
26
  //#endregion
27
27
  //#region src/hooks/effects/useAfterMountEffect.d.ts
@@ -108,13 +108,13 @@ declare const useDebouncedFn: <TParams>(callBackFn: CallbackFn<TParams>, delay:
108
108
  cancelMaxWait(): void;
109
109
  };
110
110
  declare const useDebouncedState: <TValue>(defaultValue: TValue, delay: number | undefined) => readonly [TValue, {
111
- (...params: react5.SetStateAction<TValue>[]): void;
112
- (params: react5.SetStateAction<TValue> | react5.SetStateAction<TValue>[], overrideOptions: {
111
+ (...params: react0.SetStateAction<TValue>[]): void;
112
+ (params: react0.SetStateAction<TValue> | react0.SetStateAction<TValue>[], overrideOptions: {
113
113
  $delay: number;
114
114
  }): void;
115
115
  cancel: () => void;
116
116
  cancelMaxWait(): void;
117
- }, react5.Dispatch<react5.SetStateAction<TValue>>];
117
+ }, react0.Dispatch<react0.SetStateAction<TValue>>];
118
118
  //#endregion
119
119
  //#region src/hooks/useDisclosure.d.ts
120
120
  type DisclosureOptions = {
@@ -136,15 +136,18 @@ declare const useDisclosure: (options?: DisclosureOptions) => {
136
136
  */
137
137
  declare const useIsServer: () => boolean;
138
138
  //#endregion
139
+ //#region src/hooks/useShallowCompare.d.ts
140
+ declare const useShallowCompare: <TState, TResult>(selector: SelectorFn<TState, TResult>) => (state: TState) => TResult;
141
+ //#endregion
139
142
  //#region src/hooks/useLocationState.d.ts
140
143
  type UseLocationResult<TSlice> = [state: TSlice, actions: LocationStoreApi];
141
- declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core12.StoreApi<_zayne_labs_toolkit_core12.URLInfoObject>, "setState" | "resetState"> & {
142
- push: (url: string | _zayne_labs_toolkit_core12.PartialURLInfo, options?: {
143
- state?: _zayne_labs_toolkit_core12.PartialURLInfo["state"];
144
+ declare const createUseLocationState: (options?: LocationStoreOptions) => Omit<_zayne_labs_toolkit_core7.StoreApi<_zayne_labs_toolkit_core7.URLInfoObject>, "resetState" | "setState"> & {
145
+ push: (url: string | _zayne_labs_toolkit_core7.PartialURLInfo, options?: {
146
+ state?: _zayne_labs_toolkit_core7.PartialURLInfo["state"];
144
147
  }) => void;
145
148
  replace: LocationStoreApi["push"];
146
149
  triggerPopstateEvent: (nextLocationState?: LocationInfo["state"]) => void;
147
- } & (<TSlice = _zayne_labs_toolkit_core12.URLInfoObject>(selector?: SelectorFn<LocationInfo, TSlice>) => UseLocationResult<TSlice>);
150
+ } & (<TSlice = _zayne_labs_toolkit_core7.URLInfoObject>(selector?: SelectorFn<LocationInfo, TSlice>) => UseLocationResult<TSlice>);
148
151
  declare const useLocationState: <TSlice = LocationInfo>(selector?: SelectorFn<LocationInfo, TSlice>, options?: LocationStoreOptions) => UseLocationResult<TSlice>;
149
152
  //#endregion
150
153
  //#region src/hooks/useToggle.d.ts
@@ -199,7 +202,7 @@ declare const useSearch: <TData>(initialData: TData[], delay?: number) => {
199
202
  data: TData[];
200
203
  isLoading: boolean;
201
204
  query: string;
202
- setQuery: react5.Dispatch<react5.SetStateAction<string>>;
205
+ setQuery: react0.Dispatch<react0.SetStateAction<string>>;
203
206
  };
204
207
  //#endregion
205
208
  //#region src/hooks/useSearchParams.d.ts
@@ -208,11 +211,11 @@ type UseSearchParamsOptions = LocationStoreOptions & {
208
211
  };
209
212
  declare const useSearchParams: <TSearchParams extends URLSearchParamsInit>(options?: UseSearchParamsOptions) => readonly [URLSearchParams, {
210
213
  (newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)): void;
211
- triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core12.LocationInfo["state"]) => void;
214
+ triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core7.LocationInfo["state"]) => void;
212
215
  }];
213
216
  declare const useSearchParamsObject: <TSearchParams extends Record<string, string>>(options?: UseSearchParamsOptions) => readonly [TSearchParams, {
214
217
  (newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)): void;
215
- triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core12.LocationInfo["state"]) => void;
218
+ triggerPopstateEvent: (nextLocationState?: _zayne_labs_toolkit_core7.LocationInfo["state"]) => void;
216
219
  }];
217
220
  //#endregion
218
221
  //#region src/hooks/useStorageState.d.ts
@@ -221,7 +224,7 @@ type UseStorageResult<TState, TSlice = TState> = [state: TSlice, actions: Storag
221
224
  * @description Creates a custom hook that returns a storage state and actions to modify it. You can use this if you need shared options.
222
225
  * @note You must use this if you want to be able to prevent syncing state across tabs.
223
226
  */
224
- declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core12.StoreApi<TState> & {
227
+ declare const createUseStorageState: <TState>(baseOptions: StorageOptions<TState>) => _zayne_labs_toolkit_core7.StoreApi<TState> & {
225
228
  removeState: () => void;
226
229
  } & (<TSlice = TState>(selector?: SelectorFn<TState, TSlice>) => UseStorageResult<TState, TSlice>);
227
230
  type UseStorageStateOptions<TValue> = Omit<StorageOptions<TValue>, "initialValue" | "key">;
@@ -243,5 +246,5 @@ declare const useThrottleByFrame: <TParams>(callbackFn: CallbackFn<TParams>) =>
243
246
  cancelAnimation(): void;
244
247
  };
245
248
  //#endregion
246
- export { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
247
- //# sourceMappingURL=index-ByBT4lEU.d.ts.map
249
+ export { ContextError, CustomContextOptions, createCustomContext, createUseLocationState, createUseStorageState, getErrorMessage, useAfterMountEffect, useAnimateElementRefs, useAnimationInterval, useAsyncEffect, useCallbackRef, useClickOutside, useConstant, useCopyToClipboard, useDebouncedFn, useDebouncedState, useDisclosure, useEffectOnce, useIsServer, useLifeCycle, useLocationState, useMountEffect, usePresence, useScrollObserver, useSearch, useSearchParams, useSearchParamsObject, useShallowCompare, useStorageState, useStore, useThrottleByFrame, useThrottleBySetTimeout, useThrottleByTimer, useToggle, useUnmountEffect };
250
+ //# sourceMappingURL=index-CyMTab9t.d.ts.map
@@ -1,26 +1,21 @@
1
- import { CustomContextOptions } from "../index-ByBT4lEU.js";
1
+ import { CustomContextOptions } from "../index-CyMTab9t.js";
2
2
  import { AnyObject, Prettify, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
3
- import * as react0 from "react";
3
+ import * as react17 from "react";
4
4
  import { StoreApi } from "@zayne-labs/toolkit-core";
5
- import * as zustand2 from "zustand";
6
- import { Mutate, StateCreator as StateCreator$1, StoreApi as StoreApi$1, StoreMutatorIdentifier, UseBoundStore } from "zustand";
5
+ import * as zustand19 from "zustand";
6
+ import { Mutate, StateCreator as StateCreator$1, StoreMutatorIdentifier, UseBoundStore } from "zustand";
7
7
 
8
8
  //#region src/zustand/createZustandContext.d.ts
9
- declare const createZustandContext: <TState extends Record<string, unknown>, TStore extends StoreApi$1<TState> = StoreApi$1<TState>>(options?: CustomContextOptions<TStore, true>) => [ZustandStoreContextProvider: (props: ({
10
- store: TStore;
11
- storeCreator?: undefined;
12
- } | {
13
- storeCreator: () => TStore;
14
- store?: undefined;
15
- }) & {
9
+ declare const createZustandContext: <TState extends Record<string, unknown>, TStore extends StoreApi<TState> = StoreApi<TState>>(options?: CustomContextOptions<TStore, true>) => [ZustandStoreContextProvider: (props: {
16
10
  children: React.ReactNode;
17
- }) => react0.DetailedReactHTMLElement<react0.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, useZustandStoreContext: <TResult = TState>(selector?: SelectorFn<TState, TResult>) => TResult];
11
+ store: TStore;
12
+ }) => react17.FunctionComponentElement<react17.ProviderProps<TStore | null>>, useZustandStoreContext: <TResult = TState>(selector?: SelectorFn<TState, TResult>) => TResult];
18
13
  //#endregion
19
14
  //#region src/zustand/createZustandStoreWithCombine.d.ts
20
15
  type Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;
21
16
  declare const combine: <TInitialState extends AnyObject, TExtraState extends AnyObject, Mps extends Array<[StoreMutatorIdentifier, unknown]> = [], Mcs extends Array<[StoreMutatorIdentifier, unknown]> = []>(initialState: TInitialState, storeCreator: StateCreator$1<TInitialState, Mps, Mcs, TExtraState>) => StateCreator$1<Write<TInitialState, TExtraState>, Mps, Mcs>;
22
- declare const createStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => zustand2.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: (Omit<TInitialState, keyof TExtraState> & TExtraState)[Key] } : never>;
23
- declare const createWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => zustand2.UseBoundStore<zustand2.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: (Omit<TInitialState, keyof TExtraState> & TExtraState)[Key] } : never>>;
17
+ declare const createStoreWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => zustand19.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: (Omit<TInitialState, keyof TExtraState> & TExtraState)[Key] } : never>;
18
+ declare const createWithCombine: <TInitialState extends AnyObject, TExtraState extends AnyObject>(...params: Parameters<typeof combine<TInitialState, TExtraState>>) => zustand19.UseBoundStore<zustand19.StoreApi<Omit<TInitialState, keyof TExtraState> & TExtraState extends infer T ? { [Key in keyof T]: (Omit<TInitialState, keyof TExtraState> & TExtraState)[Key] } : never>>;
24
19
  //#endregion
25
20
  //#region src/zustand/createZustandStoreWithSubscribe.d.ts
26
21
  type Get<T, K, F> = K extends keyof T ? T[K] : F;
@@ -1,25 +1,19 @@
1
- import { createCustomContext, useConstant, useStore } from "../hooks-DjqgsmLX.js";
1
+ import { createCustomContext, useConstant, useStore } from "../hooks-D7cLOqht.js";
2
2
  import { createElement } from "react";
3
3
  import { createStore } from "@zayne-labs/toolkit-core";
4
- import { create, createStore as createStore$1, useStore as useStore$1 } from "zustand";
4
+ import { create, createStore as createStore$1 } from "zustand";
5
5
 
6
6
  //#region src/zustand/createZustandContext.ts
7
7
  const createZustandContext = (options) => {
8
8
  const [Provider, useCustomContext] = createCustomContext(options);
9
9
  function ZustandStoreContextProvider(props) {
10
- const { children, store, storeCreator } = props;
11
- const useZustandStore = useConstant(() => {
12
- switch (true) {
13
- case Boolean(storeCreator): return storeCreator();
14
- case Boolean(store): return store;
15
- default: throw new Error("No store provided");
16
- }
17
- });
18
- return createElement(Provider, { value: useZustandStore }, children);
10
+ const { children, store } = props;
11
+ const zustandStore = useConstant(() => store);
12
+ return createElement(Provider, { value: zustandStore }, children);
19
13
  }
20
14
  const useZustandStoreContext = (selector) => {
21
15
  const zustandStore = useCustomContext();
22
- return useStore$1(zustandStore, selector);
16
+ return useStore(zustandStore, selector);
23
17
  };
24
18
  return [ZustandStoreContextProvider, useZustandStoreContext];
25
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options?: CustomContextOptions<TStore, true>","props: ZustandStoreContextProviderProps","selector?: SelectorFn<TState, TResult>","initialState: TInitialState","storeCreator: StateCreator<TInitialState, Mps, Mcs, TExtraState>","stateInitializer: StateCreator<TState> | undefined","createState: StateCreator<TState>","selector?: SelectorFn<TState, unknown>"],"sources":["../../../src/zustand/createZustandContext.ts","../../../src/zustand/createZustandStoreWithCombine.ts","../../../src/zustand/createZustandStoreWithSubscribe.ts"],"sourcesContent":["import type { SelectorFn, UnionDiscriminator } from \"@zayne-labs/toolkit-type-helpers\";\nimport { createElement } from \"react\";\nimport { type StoreApi, useStore } from \"zustand\";\nimport { type CustomContextOptions, createCustomContext, useConstant } from \"../hooks\";\n\nconst createZustandContext = <\n\tTState extends Record<string, unknown>,\n\tTStore extends StoreApi<TState> = StoreApi<TState>,\n>(\n\toptions?: CustomContextOptions<TStore, true>\n) => {\n\tconst [Provider, useCustomContext] = createCustomContext(options);\n\n\ttype ZustandStoreContextProviderProps = UnionDiscriminator<\n\t\t[{ store: TStore }, { storeCreator: () => TStore }]\n\t> & { children: React.ReactNode };\n\n\tfunction ZustandStoreContextProvider(props: ZustandStoreContextProviderProps) {\n\t\tconst { children, store, storeCreator } = props;\n\n\t\tconst useZustandStore = useConstant(() => {\n\t\t\tswitch (true) {\n\t\t\t\tcase Boolean(storeCreator): {\n\t\t\t\t\treturn storeCreator();\n\t\t\t\t}\n\t\t\t\tcase Boolean(store): {\n\t\t\t\t\treturn store;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"No store provided\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn createElement(Provider, { value: useZustandStore }, children);\n\t}\n\n\tconst useZustandStoreContext = <TResult = TState>(selector?: SelectorFn<TState, TResult>): TResult => {\n\t\tconst zustandStore = useCustomContext();\n\n\t\treturn useStore(zustandStore, selector as never);\n\t};\n\n\treturn [ZustandStoreContextProvider, useZustandStoreContext] as [\n\t\tZustandStoreContextProvider: typeof ZustandStoreContextProvider,\n\t\tuseZustandStoreContext: typeof useZustandStoreContext,\n\t];\n};\n\nexport { createZustandContext };\n","import type { AnyFunction, AnyObject, Prettify } from \"@zayne-labs/toolkit-type-helpers\";\nimport { create, createStore, type StateCreator, type StoreMutatorIdentifier } from \"zustand\";\n\ntype Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;\n\nexport const combine =\n\t<\n\t\tTInitialState extends AnyObject,\n\t\tTExtraState extends AnyObject,\n\t\tMps extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\t\tMcs extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\t>(\n\t\tinitialState: TInitialState,\n\t\tstoreCreator: StateCreator<TInitialState, Mps, Mcs, TExtraState>\n\t): StateCreator<Write<TInitialState, TExtraState>, Mps, Mcs> =>\n\t// eslint-disable-next-line ts-eslint/no-unsafe-return -- We don't know what the storeCreator will return\n\t(...params) => ({\n\t\t...initialState,\n\t\t...(storeCreator as AnyFunction)(...params),\n\t});\n\nexport const createStoreWithCombine = <TInitialState extends AnyObject, TExtraState extends AnyObject>(\n\t...params: Parameters<typeof combine<TInitialState, TExtraState>>\n) => createStore(combine(...params));\n\nexport const createWithCombine = <TInitialState extends AnyObject, TExtraState extends AnyObject>(\n\t...params: Parameters<typeof combine<TInitialState, TExtraState>>\n) => create(combine(...params));\n","import { createStore, type StoreApi } from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { Mutate, StoreMutatorIdentifier, UseBoundStore } from \"zustand\";\nimport { useStore } from \"@/hooks\";\n\ntype Get<T, K, F> = K extends keyof T ? T[K] : F;\n\nexport type StateCreator<\n\tT,\n\tMis extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\tMos extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\tU = T,\n> = { $$storeMutators?: Mos } & ((\n\tsetState: Get<Mutate<StoreApi<T>, Mis>, \"setState\", never>,\n\tgetState: Get<Mutate<StoreApi<T>, Mis>, \"getState\", never>,\n\tstore: Mutate<StoreApi<T>, Mis>\n) => U);\n\ntype CreateStoreWithSubscribe = {\n\t<T, Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t): Mutate<StoreApi<T>, Mos>;\n\n\t<T>(): <Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t) => Mutate<StoreApi<T>, Mos>;\n};\n\nexport const createStoreWithSubscribe = (<TState>(stateInitializer: StateCreator<TState> | undefined) =>\n\tstateInitializer ? createStore(stateInitializer) : createStore) as CreateStoreWithSubscribe;\n\ntype CreateWithSubscribe = {\n\t<T, Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t): UseBoundStore<Mutate<StoreApi<T>, Mos>>;\n\t<T>(): <Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t) => UseBoundStore<Mutate<StoreApi<T>, Mos>>;\n};\n\nconst createWithSubscribeImpl = <TState>(createState: StateCreator<TState>) => {\n\tconst store = createStore(createState);\n\n\tconst useBoundStore = (selector?: SelectorFn<TState, unknown>) => useStore(store, selector);\n\n\tObject.assign(useBoundStore, store);\n\n\treturn useBoundStore;\n};\n\nexport const createWithSubscribe = (<TState>(stateInitializer: StateCreator<TState> | undefined) =>\n\tstateInitializer ?\n\t\tcreateWithSubscribeImpl(stateInitializer)\n\t:\tcreateWithSubscribeImpl) as CreateWithSubscribe;\n"],"mappings":";;;;;;AAKA,MAAM,uBAAuB,CAI5BA,YACI;CACJ,MAAM,CAAC,UAAU,iBAAiB,GAAG,oBAAoB,QAAQ;CAMjE,SAAS,4BAA4BC,OAAyC;EAC7E,MAAM,EAAE,UAAU,OAAO,cAAc,GAAG;EAE1C,MAAM,kBAAkB,YAAY,MAAM;AACzC,WAAQ,MAAR;IACC,KAAK,QAAQ,aAAa,CACzB,QAAO,cAAc;IAEtB,KAAK,QAAQ,MAAM,CAClB,QAAO;IAER,QACC,OAAM,IAAI,MAAM;GAEjB;EACD,EAAC;AAEF,SAAO,cAAc,UAAU,EAAE,OAAO,gBAAiB,GAAE,SAAS;CACpE;CAED,MAAM,yBAAyB,CAAmBC,aAAoD;EACrG,MAAM,eAAe,kBAAkB;AAEvC,SAAO,WAAS,cAAc,SAAkB;CAChD;AAED,QAAO,CAAC,6BAA6B,sBAAuB;AAI5D;;;;AC1CD,MAAa,UACZ,CAMCC,cACAC,iBAGD,CAAC,GAAG,YAAY;CACf,GAAG;CACH,GAAG,AAAC,aAA6B,GAAG,OAAO;AAC3C;AAEF,MAAa,yBAAyB,CACrC,GAAG,WACC,cAAY,QAAQ,GAAG,OAAO,CAAC;AAEpC,MAAa,oBAAoB,CAChC,GAAG,WACC,OAAO,QAAQ,GAAG,OAAO,CAAC;;;;ACC/B,MAAa,2BAA4B,CAASC,qBACjD,mBAAmB,YAAY,iBAAiB,GAAG;AAWpD,MAAM,0BAA0B,CAASC,gBAAsC;CAC9E,MAAM,QAAQ,YAAY,YAAY;CAEtC,MAAM,gBAAgB,CAACC,aAA2C,SAAS,OAAO,SAAS;AAE3F,QAAO,OAAO,eAAe,MAAM;AAEnC,QAAO;AACP;AAED,MAAa,sBAAuB,CAASF,qBAC5C,mBACC,wBAAwB,iBAAiB,GACxC"}
1
+ {"version":3,"file":"index.js","names":["options?: CustomContextOptions<TStore, true>","props: ZustandStoreContextProviderProps","selector?: SelectorFn<TState, TResult>","initialState: TInitialState","storeCreator: StateCreator<TInitialState, Mps, Mcs, TExtraState>","stateInitializer: StateCreator<TState> | undefined","createState: StateCreator<TState>","selector?: SelectorFn<TState, unknown>"],"sources":["../../../src/zustand/createZustandContext.ts","../../../src/zustand/createZustandStoreWithCombine.ts","../../../src/zustand/createZustandStoreWithSubscribe.ts"],"sourcesContent":["import type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { createElement } from \"react\";\nimport { type CustomContextOptions, createCustomContext, useConstant, useStore } from \"../hooks\";\nimport type { StoreApi } from \"@zayne-labs/toolkit-core\";\n\nconst createZustandContext = <\n\tTState extends Record<string, unknown>,\n\tTStore extends StoreApi<TState> = StoreApi<TState>,\n>(\n\toptions?: CustomContextOptions<TStore, true>\n) => {\n\tconst [Provider, useCustomContext] = createCustomContext(options);\n\n\ttype ZustandStoreContextProviderProps = {\n\t\tchildren: React.ReactNode;\n\t\tstore: TStore;\n\t};\n\n\tfunction ZustandStoreContextProvider(props: ZustandStoreContextProviderProps) {\n\t\tconst { children, store } = props;\n\n\t\tconst zustandStore = useConstant(() => store);\n\n\t\treturn createElement(Provider, { value: zustandStore }, children);\n\t}\n\n\tconst useZustandStoreContext = <TResult = TState>(selector?: SelectorFn<TState, TResult>): TResult => {\n\t\tconst zustandStore = useCustomContext();\n\n\t\treturn useStore(zustandStore, selector);\n\t};\n\n\treturn [ZustandStoreContextProvider, useZustandStoreContext] as [\n\t\tZustandStoreContextProvider: typeof ZustandStoreContextProvider,\n\t\tuseZustandStoreContext: typeof useZustandStoreContext,\n\t];\n};\n\nexport { createZustandContext };\n","import type { AnyFunction, AnyObject, Prettify } from \"@zayne-labs/toolkit-type-helpers\";\nimport { create, createStore, type StateCreator, type StoreMutatorIdentifier } from \"zustand\";\n\ntype Write<TInitialState, TExtraState> = Prettify<Omit<TInitialState, keyof TExtraState> & TExtraState>;\n\nexport const combine =\n\t<\n\t\tTInitialState extends AnyObject,\n\t\tTExtraState extends AnyObject,\n\t\tMps extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\t\tMcs extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\t>(\n\t\tinitialState: TInitialState,\n\t\tstoreCreator: StateCreator<TInitialState, Mps, Mcs, TExtraState>\n\t): StateCreator<Write<TInitialState, TExtraState>, Mps, Mcs> =>\n\t// eslint-disable-next-line ts-eslint/no-unsafe-return -- We don't know what the storeCreator will return\n\t(...params) => ({\n\t\t...initialState,\n\t\t...(storeCreator as AnyFunction)(...params),\n\t});\n\nexport const createStoreWithCombine = <TInitialState extends AnyObject, TExtraState extends AnyObject>(\n\t...params: Parameters<typeof combine<TInitialState, TExtraState>>\n) => createStore(combine(...params));\n\nexport const createWithCombine = <TInitialState extends AnyObject, TExtraState extends AnyObject>(\n\t...params: Parameters<typeof combine<TInitialState, TExtraState>>\n) => create(combine(...params));\n","import { createStore, type StoreApi } from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { Mutate, StoreMutatorIdentifier, UseBoundStore } from \"zustand\";\nimport { useStore } from \"@/hooks\";\n\ntype Get<T, K, F> = K extends keyof T ? T[K] : F;\n\nexport type StateCreator<\n\tT,\n\tMis extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\tMos extends Array<[StoreMutatorIdentifier, unknown]> = [],\n\tU = T,\n> = { $$storeMutators?: Mos } & ((\n\tsetState: Get<Mutate<StoreApi<T>, Mis>, \"setState\", never>,\n\tgetState: Get<Mutate<StoreApi<T>, Mis>, \"getState\", never>,\n\tstore: Mutate<StoreApi<T>, Mis>\n) => U);\n\ntype CreateStoreWithSubscribe = {\n\t<T, Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t): Mutate<StoreApi<T>, Mos>;\n\n\t<T>(): <Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t) => Mutate<StoreApi<T>, Mos>;\n};\n\nexport const createStoreWithSubscribe = (<TState>(stateInitializer: StateCreator<TState> | undefined) =>\n\tstateInitializer ? createStore(stateInitializer) : createStore) as CreateStoreWithSubscribe;\n\ntype CreateWithSubscribe = {\n\t<T, Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t): UseBoundStore<Mutate<StoreApi<T>, Mos>>;\n\t<T>(): <Mos extends Array<[StoreMutatorIdentifier, unknown]> = []>(\n\t\tinitializer: StateCreator<T, [], Mos>\n\t) => UseBoundStore<Mutate<StoreApi<T>, Mos>>;\n};\n\nconst createWithSubscribeImpl = <TState>(createState: StateCreator<TState>) => {\n\tconst store = createStore(createState);\n\n\tconst useBoundStore = (selector?: SelectorFn<TState, unknown>) => useStore(store, selector);\n\n\tObject.assign(useBoundStore, store);\n\n\treturn useBoundStore;\n};\n\nexport const createWithSubscribe = (<TState>(stateInitializer: StateCreator<TState> | undefined) =>\n\tstateInitializer ?\n\t\tcreateWithSubscribeImpl(stateInitializer)\n\t:\tcreateWithSubscribeImpl) as CreateWithSubscribe;\n"],"mappings":";;;;;;AAKA,MAAM,uBAAuB,CAI5BA,YACI;CACJ,MAAM,CAAC,UAAU,iBAAiB,GAAG,oBAAoB,QAAQ;CAOjE,SAAS,4BAA4BC,OAAyC;EAC7E,MAAM,EAAE,UAAU,OAAO,GAAG;EAE5B,MAAM,eAAe,YAAY,MAAM,MAAM;AAE7C,SAAO,cAAc,UAAU,EAAE,OAAO,aAAc,GAAE,SAAS;CACjE;CAED,MAAM,yBAAyB,CAAmBC,aAAoD;EACrG,MAAM,eAAe,kBAAkB;AAEvC,SAAO,SAAS,cAAc,SAAS;CACvC;AAED,QAAO,CAAC,6BAA6B,sBAAuB;AAI5D;;;;AC/BD,MAAa,UACZ,CAMCC,cACAC,iBAGD,CAAC,GAAG,YAAY;CACf,GAAG;CACH,GAAG,AAAC,aAA6B,GAAG,OAAO;AAC3C;AAEF,MAAa,yBAAyB,CACrC,GAAG,WACC,cAAY,QAAQ,GAAG,OAAO,CAAC;AAEpC,MAAa,oBAAoB,CAChC,GAAG,WACC,OAAO,QAAQ,GAAG,OAAO,CAAC;;;;ACC/B,MAAa,2BAA4B,CAASC,qBACjD,mBAAmB,YAAY,iBAAiB,GAAG;AAWpD,MAAM,0BAA0B,CAASC,gBAAsC;CAC9E,MAAM,QAAQ,YAAY,YAAY;CAEtC,MAAM,gBAAgB,CAACC,aAA2C,SAAS,OAAO,SAAS;AAE3F,QAAO,OAAO,eAAe,MAAM;AAEnC,QAAO;AACP;AAED,MAAa,sBAAuB,CAASF,qBAC5C,mBACC,wBAAwB,iBAAiB,GACxC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/toolkit-react",
3
3
  "type": "module",
4
- "version": "0.9.56",
4
+ "version": "0.10.0",
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.9.56",
51
- "@zayne-labs/toolkit-type-helpers": "0.9.56"
50
+ "@zayne-labs/toolkit-core": "0.10.0",
51
+ "@zayne-labs/toolkit-type-helpers": "0.10.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@arethetypeswrong/cli": "^0.18.2",
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks-DjqgsmLX.js","names":["hook: string","provider: string","options: CustomContextOptions<TContextValue, TStrict>","callbackFn: TCallback | undefined","useAfterMountEffect: typeof useEffect","effect: () => Promise<ReturnType<React.EffectCallback>>","deps?: React.DependencyList","callBackFn: React.EffectCallback","callBackFn: () => void","cleanUpFn: Destructor","target: HTMLElement","className: string","elementsInfoArray: ElementsInfoArray<TTargetElement>","initCallbackFn: () => TResult","options: AnimationOptions","refOrRefArray: Array<React.RefObject<TElement>> | React.RefObject<TElement>","callback: (event: MouseEvent | TouchEvent) => void","options?: UseClickOutsideOptions","value: string","callBackFn: CallbackFn<TParams>","delay: number | undefined","defaultValue: TValue","initialValue: InitialState","newValue?: TValue","options: DisclosureOptions","value?: TValue","value: TState","store: StoreApi<TState>","selector: SelectorFn<TState, TSlice>","options?: LocationStoreOptions","useLocationState","selector?: SelectorFn<LocationInfo, TSlice>","useAnimationPresence: UseSpecificPresence","value: boolean","newValue?: TValue","useTransitionPresence: UseSpecificPresence","value: boolean","newValue?: TValue","usePresence: UsePresence","options: ScrollObserverOptions","observedElementRef: RefCallback<TElement>","item: unknown","item: Record<string, unknown>","query: string","initialData: TData[]","delay?: number","options?: UseSearchParamsOptions","newQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)","newQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)","baseOptions: StorageOptions<TState>","useStorageState","selector?: SelectorFn<TState, TSlice>","key: string","initialValue?: TValue","options?: UseStorageStateOptions<TValue> & { select?: SelectorFn<TValue, TSlice> }","callbackFn: CallbackFn<TParams>","delay: number"],"sources":["../../src/hooks/createCustomContext.ts","../../src/hooks/useCallbackRef.ts","../../src/hooks/effects/useAfterMountEffect.ts","../../src/hooks/effects/useAsyncEffect.ts","../../src/hooks/effects/useEffectOnce.ts","../../src/hooks/effects/useLifeCycle.ts","../../src/hooks/effects/useMountEffect.ts","../../src/hooks/effects/useUnMountEffect.ts","../../src/hooks/useAnimateElementRefs.ts","../../src/hooks/useConstant.ts","../../src/hooks/useAnimationInterval.ts","../../src/hooks/useClickOutside.ts","../../src/hooks/useCopyToClipboard.ts","../../src/hooks/useDebounce.ts","../../src/hooks/useToggle.ts","../../src/hooks/useDisclosure.ts","../../src/hooks/useIsServer.ts","../../src/hooks/useStore.ts","../../src/hooks/useLocationState.ts","../../src/hooks/usePresence/useAnimationPresence.ts","../../src/hooks/usePresence/useTransitionPresence.ts","../../src/hooks/usePresence/usePresence.ts","../../src/hooks/useScrollObserver.ts","../../src/hooks/useSearch.ts","../../src/hooks/useSearchParams.ts","../../src/hooks/useStorageState.ts","../../src/hooks/useThrottle.ts"],"sourcesContent":["import { defineEnum } from \"@zayne-labs/toolkit-type-helpers\";\nimport { createContext, use } from \"react\";\n\nexport class ContextError extends Error {\n\toverride name = \"ContextError\";\n\n\tconstructor(...args: Parameters<typeof Error>) {\n\t\tsuper(...args);\n\n\t\tError.captureStackTrace(this, this.constructor);\n\t}\n}\n\nexport const getErrorMessage = (hook: string, provider: string) => {\n\treturn `${hook} returned \"null\". Did you forget to wrap the necessary components within ${provider}?`;\n};\n\nexport type CustomContextOptions<TContextValue, TStrict extends boolean> = {\n\tdefaultValue?: TContextValue | null;\n\terrorMessage?: string;\n\textension?: (contextValue: NoInfer<TContextValue> | null) => TContextValue | null;\n\thookName?: string;\n\tname?: string;\n\tproviderName?: string;\n\tstrict?: TStrict;\n};\n\ntype UseCustomContextResult<TContextValue, TStrict extends boolean> =\n\tTStrict extends true ? TContextValue : TContextValue | null;\n\nconst createCustomContext = <TContextValue, TStrict extends boolean = true>(\n\toptions: CustomContextOptions<TContextValue, TStrict> = {}\n) => {\n\tconst {\n\t\tdefaultValue = null,\n\t\terrorMessage,\n\t\textension,\n\t\thookName = \"useUnnamedContext\",\n\t\tproviderName = \"UnnamedContextProvider\",\n\t\tname = providerName.endsWith(\"Provider\") ? providerName.slice(0, -8) : \"UnnamedContext\",\n\t\tstrict = true,\n\t} = options;\n\n\tconst Context = createContext<TContextValue | null>(defaultValue);\n\n\tContext.displayName = name;\n\n\tconst useCustomContext = (): UseCustomContextResult<TContextValue, TStrict> => {\n\t\tconst contextValue = use(Context);\n\n\t\tconst extendedContextValue = extension?.(contextValue) ?? contextValue;\n\n\t\tif (strict && extendedContextValue === null) {\n\t\t\tthrow new ContextError(errorMessage ?? getErrorMessage(hookName, providerName));\n\t\t}\n\n\t\treturn extendedContextValue as NonNullable<typeof extendedContextValue>;\n\t};\n\n\treturn defineEnum([Context, useCustomContext]);\n};\n\nexport { createCustomContext };\n","import type { AnyFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useCallback, useLayoutEffect, useRef } from \"react\";\n\n/**\n * Returns a stable function that always points to the latest version of the callback function.\n * @param callbackFn - The function to reference\n * @returns a stable function that always points to the latest version of the callback function\n */\n\nconst useCallbackRef = <TCallback = AnyFunction>(callbackFn: TCallback | undefined) => {\n\tconst callbackRef = useRef(callbackFn);\n\n\tuseLayoutEffect(() => {\n\t\t// == Doing this instead updating it during render cuz according to Dan Abramov, render should be pure\n\t\tcallbackRef.current = callbackFn;\n\t}, [callbackFn]);\n\n\tconst savedCallback = useCallback(\n\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- callbackRef.current can be null in some cases\n\t\t(...params: unknown[]) => (callbackRef.current as AnyFunction)?.(...params) as unknown,\n\t\t[]\n\t);\n\n\treturn savedCallback as TCallback;\n};\n\nexport { useCallbackRef };\n","import { useEffect, useRef } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nconst useAfterMountEffect: typeof useEffect = (callBackFn, deps) => {\n\tconst isFirstMount = useRef(true);\n\tconst stableCallback = useCallbackRef(callBackFn);\n\n\tuseEffect(() => {\n\t\tif (isFirstMount.current) {\n\t\t\tisFirstMount.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\tstableCallback();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableCallback is stable\n\t}, deps);\n};\nexport { useAfterMountEffect };\n","import { useEffect, useState } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nexport function useAsyncEffect(\n\teffect: () => Promise<ReturnType<React.EffectCallback>>,\n\tdeps?: React.DependencyList\n) {\n\tconst stableEffectCallback = useCallbackRef(effect);\n\tconst [destroy, setDestroy] = useState<ReturnType<React.EffectCallback>>();\n\n\tuseEffect(() => {\n\t\tconst e = stableEffectCallback();\n\n\t\tasync function execute() {\n\t\t\tsetDestroy(await e);\n\t\t}\n\n\t\tvoid execute();\n\n\t\treturn () => void destroy?.();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableEffectCallback is stable\n\t}, deps);\n}\n","import { useEffect, useRef } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nconst useEffectOnce = (callBackFn: React.EffectCallback) => {\n\tconst stableCallback = useCallbackRef(callBackFn);\n\n\tconst effectGuard = useRef(false);\n\n\t// == savedCallback is always stable so no worries about re-execution of this effect\n\tuseEffect(() => {\n\t\tif (effectGuard.current) return;\n\n\t\teffectGuard.current = true;\n\n\t\treturn stableCallback();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableCallback is stable\n\t}, []);\n};\n\nexport { useEffectOnce };\n","import { useEffect } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\n\nexport type Destructor = ReturnType<React.EffectCallback>;\n\ntype LifeCycleOptions = {\n\tonMount?: () => void;\n\tonUnmount?: Destructor;\n};\n\nconst useLifeCycle = ({ onMount, onUnmount }: LifeCycleOptions) => {\n\tconst stableOnMount = useCallbackRef(onMount);\n\tconst stableOnUnmount = useCallbackRef(onUnmount);\n\n\tuseEffect(() => {\n\t\tstableOnMount();\n\n\t\treturn stableOnUnmount;\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableOnMount and stableOnUnmount are stable\n\t}, []);\n};\n\nexport { useLifeCycle };\n","import { useLifeCycle } from \"./useLifeCycle\";\n\nconst useMountEffect = (callBackFn: () => void) => {\n\tuseLifeCycle({ onMount: callBackFn });\n};\n\nexport { useMountEffect };\n","import { type Destructor, useLifeCycle } from \"./useLifeCycle\";\n\nconst useUnmountEffect = (cleanUpFn: Destructor) => useLifeCycle({ onUnmount: cleanUpFn });\n\nexport { useUnmountEffect };\n","import { on } from \"@zayne-labs/toolkit-core\";\nimport { type NonEmptyArray, isArray } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useCallback, useRef } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\n\ntype ElementsInfoArray<TTargetElement extends string> = NonEmptyArray<{\n\tanimationClass: string;\n\ttargetElement: TTargetElement;\n}>;\n\nconst removeClass = (target: HTMLElement, className: string) => () => target.classList.remove(className);\n\n/**\n * This is a custom React hook that adds and removes animation classes to specified HTML elements.\n * @param elementsInfoArray - An array of objects that contain information about the animation class and the target HTML element.\n * @returns - An object containing the refs of the animated elements and a function to handle the initiation and removal animation.\n */\n\nconst useAnimateElementRefs = <TTargetElement extends string>(\n\telementsInfoArray: ElementsInfoArray<TTargetElement>\n) => {\n\tconst elementsRef = useRef<Record<TTargetElement, HTMLElement | null>>({} as never);\n\n\tconst addAnimationClasses = useCallbackRef(() => {\n\t\tif (!isArray(elementsInfoArray)) {\n\t\t\tconsole.error(\"elementsInfo is not an Array\");\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const { animationClass, targetElement } of elementsInfoArray) {\n\t\t\tif (!elementsRef.current[targetElement]) {\n\t\t\t\tconsole.error(\"ElementError\", `\"${targetElement}\" element does not exist`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\telementsRef.current[targetElement].classList.add(animationClass);\n\t\t}\n\t});\n\n\tconst removeAnimationClasses = useCallbackRef(() => {\n\t\tif (!isArray(elementsInfoArray)) {\n\t\t\tconsole.error(\"elementsInfo is not an Array\");\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const { animationClass, targetElement } of elementsInfoArray) {\n\t\t\tif (!elementsRef.current[targetElement]) {\n\t\t\t\tconsole.error(\"ElementError\", `\"${targetElement}\" element does not exist`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ton(\n\t\t\t\t\"transitionend\",\n\t\t\t\telementsRef.current[targetElement],\n\t\t\t\tremoveClass(elementsRef.current[targetElement], animationClass)\n\t\t\t);\n\n\t\t\ton(\n\t\t\t\t\"animationend\",\n\t\t\t\telementsRef.current[targetElement],\n\t\t\t\tremoveClass(elementsRef.current[targetElement], animationClass)\n\t\t\t);\n\t\t}\n\t});\n\n\t// Add animation classes to elements and remove them after the animation ends\n\tconst handleElementsAnimation = useCallback(() => {\n\t\taddAnimationClasses();\n\n\t\tremoveAnimationClasses();\n\t}, [addAnimationClasses, removeAnimationClasses]);\n\n\treturn { animatedElements: elementsRef.current, handleElementsAnimation };\n};\n\nexport { useAnimateElementRefs };\n","import { useRef } from \"react\";\n\nconst useConstant = <TResult>(initCallbackFn: () => TResult) => {\n\tconst resultRef = useRef<TResult | null>(null);\n\n\t// eslint-disable-next-line ts-eslint/prefer-nullish-coalescing -- The current case is justified since it's optimizable by the react compiler\n\tif (resultRef.current === null) {\n\t\tresultRef.current = initCallbackFn();\n\t}\n\n\treturn resultRef.current;\n};\n\nexport { useConstant };\n","import { type AnimationIntervalOptions, setAnimationInterval } from \"@zayne-labs/toolkit-core\";\nimport type { Prettify } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useEffect } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\ntype AnimationOptions = Prettify<\n\tAnimationIntervalOptions & {\n\t\tintervalDuration: number | null;\n\t\tonAnimation: () => void;\n\t}\n>;\n\nconst useAnimationInterval = (options: AnimationOptions) => {\n\tconst { intervalDuration, onAnimation, once } = options;\n\n\tconst latestCallback = useCallbackRef(onAnimation);\n\n\t// prettier-ignore\n\tconst { start, stop } = useConstant(() => setAnimationInterval(latestCallback, intervalDuration, { once }));\n\n\tuseEffect(() => {\n\t\tif (intervalDuration === null) return;\n\n\t\tstart();\n\n\t\treturn stop;\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- start and stop are stable\n\t}, [intervalDuration]);\n\n\treturn { start, stop };\n};\n\nexport { useAnimationInterval };\n","import { onClickOutside, toArray } from \"@zayne-labs/toolkit-core\";\nimport { useEffect } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\n\ntype UseClickOutsideOptions = {\n\tenabled?: boolean;\n};\n\nconst useClickOutside = <TElement extends HTMLElement>(\n\trefOrRefArray: Array<React.RefObject<TElement>> | React.RefObject<TElement>,\n\tcallback: (event: MouseEvent | TouchEvent) => void,\n\toptions?: UseClickOutsideOptions\n) => {\n\tconst { enabled = true } = options ?? {};\n\n\tconst savedCallback = useCallbackRef(callback);\n\n\tuseEffect(() => {\n\t\tif (!enabled) return;\n\n\t\tconst controller = new AbortController();\n\n\t\tconst elementArray = toArray(refOrRefArray).map((ref) => ref.current);\n\n\t\tonClickOutside(elementArray, savedCallback, { signal: controller.signal });\n\n\t\treturn () => {\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [enabled, refOrRefArray, savedCallback]);\n};\n\nexport { useClickOutside };\n","import { copyToClipboard } from \"@zayne-labs/toolkit-core\";\nimport { useState } from \"react\";\n\nconst useCopyToClipboard = () => {\n\tconst [state, setState] = useState(\"\");\n\n\tconst handleCopy = (value: string) => {\n\t\tsetState(value);\n\t\tvoid copyToClipboard(value);\n\t};\n\n\treturn { copiedValue: state, handleCopy };\n};\n\nexport { useCopyToClipboard };\n","import { debounce } from \"@zayne-labs/toolkit-core\";\nimport type { CallbackFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useState } from \"react\";\nimport { useUnmountEffect } from \"./effects/useUnMountEffect\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\nexport const useDebouncedFn = <TParams>(callBackFn: CallbackFn<TParams>, delay: number | undefined) => {\n\tconst latestCallback = useCallbackRef(callBackFn);\n\n\tconst debouncedFn = useConstant(() => debounce(latestCallback, delay));\n\n\tuseUnmountEffect(() => {\n\t\tdebouncedFn.cancel();\n\t\tdebouncedFn.cancelMaxWait();\n\t});\n\n\treturn debouncedFn;\n};\n\nexport const useDebouncedState = <TValue>(defaultValue: TValue, delay: number | undefined) => {\n\tconst [value, setValue] = useState(defaultValue);\n\n\tconst setDebouncedValue = useConstant(() => debounce(setValue, delay));\n\n\tuseUnmountEffect(() => {\n\t\tsetDebouncedValue.cancel();\n\t\tsetDebouncedValue.cancelMaxWait();\n\t});\n\n\treturn [value, setDebouncedValue, setValue] as const;\n};\n","import { useCallback, useState } from \"react\";\n\ntype InitialState = boolean | (() => boolean);\n\nconst useToggle = (initialValue: InitialState = false) => {\n\tconst [value, setValue] = useState(initialValue);\n\n\tconst toggle = useCallback(<TValue>(newValue?: TValue) => {\n\t\tif (typeof newValue === \"boolean\") {\n\t\t\tsetValue(newValue);\n\t\t\treturn;\n\t\t}\n\n\t\tsetValue((prev) => !prev);\n\t}, []);\n\n\treturn [value, toggle] as const;\n};\n\nexport { useToggle };\n","import { lockScroll } from \"@zayne-labs/toolkit-core\";\nimport { isBoolean } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useToggle } from \"./useToggle\";\n\ntype DisclosureOptions = {\n\thasScrollControl?: boolean;\n\tinitialState?: boolean | (() => boolean);\n};\n\nconst useDisclosure = (options: DisclosureOptions = {}) => {\n\tconst { hasScrollControl = false, initialState = false } = options;\n\tconst [isOpen, toggleIsOpen] = useToggle(initialState);\n\n\tconst onOpen = useCallbackRef(() => {\n\t\ttoggleIsOpen(true);\n\t\thasScrollControl && lockScroll({ lock: true });\n\t});\n\n\tconst onClose = useCallbackRef(() => {\n\t\ttoggleIsOpen(false);\n\t\thasScrollControl && lockScroll({ lock: false });\n\t});\n\n\tconst onToggle = useCallbackRef(<TValue>(value?: TValue) => {\n\t\tif (isBoolean(value)) {\n\t\t\ttoggleIsOpen(value);\n\t\t\thasScrollControl && lockScroll({ lock: value });\n\t\t\treturn;\n\t\t}\n\n\t\tisOpen ? onClose() : onOpen();\n\t});\n\n\tconst api = useMemo(() => ({ isOpen, onClose, onOpen, onToggle }), [isOpen, onClose, onOpen, onToggle]);\n\n\treturn api;\n};\nexport { useDisclosure };\n","import { useSyncExternalStore } from \"react\";\n\nconst noopStore = {\n\tgetServerSnapshot: () => true,\n\tgetSnapshot: () => false,\n\t// eslint-disable-next-line unicorn/consistent-function-scoping -- It's fine\n\tsubscribe: () => () => {},\n};\n\n/**\n * @description Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nconst useIsServer = () => {\n\tconst isServer = useSyncExternalStore(\n\t\tnoopStore.subscribe,\n\t\tnoopStore.getSnapshot,\n\t\tnoopStore.getServerSnapshot\n\t);\n\n\treturn isServer;\n};\n\nexport { useIsServer };\n","import type { StoreApi } from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useDebugValue, useSyncExternalStore } from \"react\";\n\nconst identity = <TState>(value: TState) => value;\n\nconst useStore = <TState, TSlice = TState>(\n\tstore: StoreApi<TState>,\n\tselector: SelectorFn<TState, TSlice> = identity as never\n) => {\n\tconst slice = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => selector(store.getState()),\n\t\t() => selector(store.getInitialState())\n\t);\n\n\tuseDebugValue(slice);\n\n\treturn slice;\n};\n\nexport { useStore };\n","import {\n\tcreateLocationStore,\n\ttype LocationInfo,\n\ttype LocationStoreApi,\n\ttype LocationStoreOptions,\n} from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useConstant } from \"./useConstant\";\nimport { useStore } from \"./useStore\";\n\ntype UseLocationResult<TSlice> = [state: TSlice, actions: LocationStoreApi];\n\nexport const createUseLocationState = (options?: LocationStoreOptions) => {\n\tconst locationStore = createLocationStore(options);\n\n\ttype UseBoundLocationState = LocationStoreApi\n\t\t& (<TSlice = LocationInfo>(\n\t\t\tselector?: SelectorFn<LocationInfo, TSlice>\n\t\t) => UseLocationResult<TSlice>);\n\n\tconst useLocationState = <TSlice = LocationInfo>(\n\t\tselector?: SelectorFn<LocationInfo, TSlice>\n\t): UseLocationResult<TSlice> => {\n\t\tconst stateSlice = useStore(locationStore as never, selector);\n\n\t\treturn [stateSlice, locationStore];\n\t};\n\n\tObject.assign(useLocationState, locationStore);\n\n\treturn useLocationState as UseBoundLocationState;\n};\n\nexport const useLocationState = <TSlice = LocationInfo>(\n\tselector?: SelectorFn<LocationInfo, TSlice>,\n\toptions?: LocationStoreOptions\n): UseLocationResult<TSlice> => {\n\tconst locationStore = useConstant(() => createLocationStore(options));\n\n\tconst stateSlice = useStore(locationStore as never, selector);\n\n\treturn [stateSlice, locationStore];\n};\n","import { on } from \"@zayne-labs/toolkit-core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\nimport { useDebouncedState } from \"../useDebounce\";\nimport type { UseSpecificPresence } from \"./types\";\n\nconst useAnimationPresence: UseSpecificPresence = (options = {}) => {\n\tconst { defaultValue = true, duration, onExitComplete } = options;\n\n\tconst [isShown, setIsShown] = useState(defaultValue);\n\n\tconst [isMounted, setDebouncedIsMounted, setRegularIsMounted] = useDebouncedState(\n\t\tdefaultValue,\n\t\tduration\n\t);\n\tconst elementRef = useRef<HTMLElement>(null);\n\n\tconst stableOnExitComplete = useCallbackRef(onExitComplete);\n\n\tuseEffect(() => {\n\t\t!isMounted && stableOnExitComplete();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableOnExitComplete is stable\n\t}, [isMounted]);\n\n\tconst handleIsMountedWithoutRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetRegularIsMounted(true);\n\t\t\treturn;\n\t\t}\n\n\t\tsetDebouncedIsMounted(false);\n\t};\n\n\tconst handleIsMountedWithRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetRegularIsMounted(true);\n\t\t\treturn;\n\t\t}\n\n\t\ton(\"animationend\", elementRef.current, () => {\n\t\t\tsetDebouncedIsMounted.cancel();\n\t\t\tsetRegularIsMounted(false);\n\t\t});\n\t};\n\n\tconst toggleVisibility = useCallbackRef(<TValue>(newValue?: TValue) => {\n\t\tconst handleSetIsMounted = !duration ? handleIsMountedWithRef : handleIsMountedWithoutRef;\n\n\t\tif (typeof newValue === \"boolean\") {\n\t\t\tsetIsShown(newValue);\n\t\t\thandleSetIsMounted(newValue);\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsShown(!isShown);\n\t\thandleSetIsMounted(!isShown);\n\t});\n\n\treturn {\n\t\tisPresent: isMounted,\n\t\tisVisible: isShown,\n\t\ttoggleVisibility,\n\t\t...(duration === undefined && { elementRef }),\n\t} as never;\n};\n\nexport { useAnimationPresence };\n","import { on } from \"@zayne-labs/toolkit-core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useCallbackRef } from \"../useCallbackRef\";\nimport { useDebouncedState } from \"../useDebounce\";\nimport type { UseSpecificPresence } from \"./types\";\n\nconst useTransitionPresence: UseSpecificPresence = (options = {}) => {\n\tconst { defaultValue = true, duration, onExitComplete } = options;\n\n\tconst [isShown, setIsShown] = useState(defaultValue);\n\n\tconst [isMounted, setDebouncedIsMounted, setRegularIsMounted] = useDebouncedState(\n\t\tdefaultValue,\n\t\tduration\n\t);\n\tconst elementRef = useRef<HTMLElement>(null);\n\tconst stableOnExitComplete = useCallbackRef(onExitComplete);\n\n\tconst handleIsMountedWithoutRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetDebouncedIsMounted(value, { $delay: 0 });\n\t\t\treturn;\n\t\t}\n\n\t\tsetDebouncedIsMounted(false);\n\t};\n\n\tconst handleIsMountedWithRef = (value: boolean) => {\n\t\tif (value) {\n\t\t\tsetDebouncedIsMounted(value, { $delay: 0 });\n\t\t\treturn;\n\t\t}\n\n\t\ton(\"transitionend\", elementRef.current, () => {\n\t\t\tsetDebouncedIsMounted.cancel();\n\t\t\tsetRegularIsMounted(false);\n\t\t});\n\t};\n\n\tconst toggleVisibility = useCallbackRef(<TValue>(newValue?: TValue) => {\n\t\tconst handleSetIsMounted = !duration ? handleIsMountedWithRef : handleIsMountedWithoutRef;\n\n\t\tif (typeof newValue === \"boolean\") {\n\t\t\tsetIsShown(newValue);\n\t\t\thandleSetIsMounted(newValue);\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsShown(!isShown);\n\t\thandleSetIsMounted(!isShown);\n\t});\n\n\tuseEffect(() => {\n\t\t!isMounted && stableOnExitComplete();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- stableOnExitComplete is stable\n\t}, [isMounted]);\n\n\treturn {\n\t\tisPresent: isMounted || isShown,\n\t\tisVisible: isMounted && isShown,\n\t\ttoggleVisibility,\n\t\t...(duration === undefined && { elementRef }),\n\t} as never;\n};\n\nexport { useTransitionPresence };\n","import type { UsePresence } from \"./types\";\nimport { useAnimationPresence } from \"./useAnimationPresence\";\nimport { useTransitionPresence } from \"./useTransitionPresence\";\n\n/**\n * usePresence hook provides a way to animate an element, before removing it from the DOM.\n * @param defaultValue - The default value for the presence state. Defaults to `true`.\n * @param options - The options for the usePresence hook.\n * @returns A object containing the boolean that should be used to conditionally render the element (isPresent), another boolean used to toggle the animation classes, and a function to toggle the state.\n */\n\nconst usePresence: UsePresence = (options = {}) => {\n\tconst { type = \"transition\", ...restOfOptions } = options;\n\n\tconst useSpecificPresence = type === \"transition\" ? useTransitionPresence : useAnimationPresence;\n\n\treturn useSpecificPresence(restOfOptions);\n};\n\nexport { usePresence };\n","import { type ScrollObserverOptions, createScrollObserver } from \"@zayne-labs/toolkit-core\";\nimport { type RefCallback, useState } from \"react\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\nconst useScrollObserver = <TElement extends HTMLElement>(options: ScrollObserverOptions = {}) => {\n\tconst { onIntersection, rootMargin = \"10px 0px 0px 0px\", ...restOfOptions } = options;\n\n\tconst [isScrolled, setIsScrolled] = useState(false);\n\n\tconst savedOnIntersection = useCallbackRef(onIntersection);\n\n\tconst { handleObservation } = useConstant(() => {\n\t\treturn createScrollObserver({\n\t\t\tonIntersection: (entry, observer) => {\n\t\t\t\tconst newIsScrolledState = !entry.isIntersecting;\n\n\t\t\t\tsetIsScrolled(newIsScrolledState);\n\n\t\t\t\t// eslint-disable-next-line no-param-reassign -- Mutation is fine here\n\t\t\t\t(entry.target as HTMLElement).dataset.scrolled = String(newIsScrolledState);\n\n\t\t\t\tsavedOnIntersection(entry, observer);\n\t\t\t},\n\t\t\trootMargin,\n\t\t\t...restOfOptions,\n\t\t});\n\t});\n\n\tconst observedElementRef: RefCallback<TElement> = useCallbackRef((element) => {\n\t\tconst cleanupFn = handleObservation(element);\n\n\t\t// == React 18 may not call the cleanup function so we need to call it manually on element unmount\n\t\tif (!element) {\n\t\t\tcleanupFn?.();\n\t\t\treturn;\n\t\t}\n\n\t\treturn cleanupFn;\n\t});\n\n\treturn { isScrolled, observedElementRef };\n};\n\nexport { useScrollObserver };\n","import { isPlainObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useState } from \"react\";\nimport { useAfterMountEffect } from \"./effects/useAfterMountEffect\";\nimport { useDebouncedFn } from \"./useDebounce\";\n\nconst isSerializable = (item: unknown): item is boolean | number | string =>\n\ttypeof item === \"string\" || typeof item === \"number\" || typeof item === \"boolean\";\n\nconst checkObjectPropsForQuery = (item: Record<string, unknown>, query: string): boolean => {\n\tfor (const value of Object.values(item)) {\n\t\tif (isSerializable(value) && value.toString().toLowerCase().includes(query)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\nconst useSearch = <TData>(initialData: TData[], delay?: number) => {\n\tconst [searchQuery, setSearchQuery] = useState(\"\");\n\tconst [filteredData, setFilteredData] = useState(initialData);\n\tconst [isLoading, setIsLoading] = useState(false);\n\n\tconst handleDebouncedSearch = useDebouncedFn(() => {\n\t\tconst query = searchQuery.toLowerCase();\n\n\t\tconst filteredResults = initialData.filter((item) => {\n\t\t\tif (isSerializable(item)) {\n\t\t\t\treturn item.toString().toLowerCase().includes(query);\n\t\t\t}\n\n\t\t\tif (isPlainObject(item)) {\n\t\t\t\treturn checkObjectPropsForQuery(item, query);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t});\n\n\t\tsetFilteredData(filteredResults);\n\t\tsetIsLoading(false);\n\t}, delay);\n\n\tuseAfterMountEffect(() => {\n\t\tsetIsLoading(true);\n\t\thandleDebouncedSearch();\n\t}, [searchQuery]);\n\n\treturn { data: filteredData, isLoading, query: searchQuery, setQuery: setSearchQuery };\n};\n\nexport { useSearch };\n","import {\n\ttype LocationStoreOptions,\n\ttype URLSearchParamsInit,\n\tcreateSearchParams,\n} from \"@zayne-labs/toolkit-core\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useLocationState } from \"./useLocationState\";\n\ntype UseSearchParamsOptions = LocationStoreOptions & {\n\taction?: \"push\" | \"replace\";\n};\n\nexport const useSearchParams = <TSearchParams extends URLSearchParamsInit>(\n\toptions?: UseSearchParamsOptions\n) => {\n\tconst { action = \"push\", ...restOfOptions } = options ?? {};\n\n\tconst [searchParams, actions] = useLocationState((state) => state.search, restOfOptions);\n\n\tconst setSearchParams = (\n\t\tnewQueryParams: TSearchParams | ((prev: URLSearchParams) => TSearchParams)\n\t) => {\n\t\tconst params = isFunction(newQueryParams) ? newQueryParams(searchParams) : newQueryParams;\n\n\t\tconst nextSearchParams = createSearchParams(params);\n\n\t\tactions[action]({ search: nextSearchParams });\n\t};\n\n\tsetSearchParams.triggerPopstateEvent = actions.triggerPopstateEvent;\n\n\treturn [searchParams, setSearchParams] as const;\n};\n\nexport const useSearchParamsObject = <TSearchParams extends Record<string, string>>(\n\toptions?: UseSearchParamsOptions\n) => {\n\tconst [searchParams, setSearchParams] = useSearchParams(options);\n\n\tconst searchParamsObject = Object.fromEntries(searchParams) as TSearchParams;\n\n\tconst setSearchParamsObject = (\n\t\tnewQueryParams: TSearchParams | ((prev: TSearchParams) => TSearchParams)\n\t) => {\n\t\tconst params = isFunction(newQueryParams) ? newQueryParams(searchParamsObject) : newQueryParams;\n\n\t\tsetSearchParams(params);\n\t};\n\n\tsetSearchParamsObject.triggerPopstateEvent = setSearchParams.triggerPopstateEvent;\n\n\treturn [searchParamsObject, setSearchParamsObject] as const;\n};\n","import {\n\tcreateExternalStorageStore,\n\ttype StorageOptions,\n\ttype StorageStoreApi,\n} from \"@zayne-labs/toolkit-core\";\nimport type { SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useConstant } from \"./useConstant\";\nimport { useStore } from \"./useStore\";\n\ntype UseStorageResult<TState, TSlice = TState> = [state: TSlice, actions: StorageStoreApi<TState>];\n\n/**\n * @description Creates a custom hook that returns a storage state and actions to modify it. You can use this if you need shared options.\n * @note You must use this if you want to be able to prevent syncing state across tabs.\n */\nexport const createUseStorageState = <TState>(baseOptions: StorageOptions<TState>) => {\n\tconst externalStore = createExternalStorageStore(baseOptions);\n\n\ttype UseBoundStorageState = StorageStoreApi<TState>\n\t\t& (<TSlice = TState>(selector?: SelectorFn<TState, TSlice>) => UseStorageResult<TState, TSlice>);\n\n\tconst useStorageState = <TSlice = TState>(\n\t\tselector?: SelectorFn<TState, TSlice>\n\t): UseStorageResult<TState, TSlice> => {\n\t\tconst stateInStorage = useStore(externalStore, selector);\n\n\t\treturn [stateInStorage, externalStore];\n\t};\n\n\tObject.assign(useStorageState, externalStore);\n\n\treturn useStorageState as UseBoundStorageState;\n};\n\ntype UseStorageStateOptions<TValue> = Omit<StorageOptions<TValue>, \"initialValue\" | \"key\">;\n\nexport const useStorageState = <TValue, TSlice = TValue>(\n\tkey: string,\n\tinitialValue?: TValue,\n\toptions?: UseStorageStateOptions<TValue> & { select?: SelectorFn<TValue, TSlice> }\n): UseStorageResult<TValue, TSlice> => {\n\tconst { select, ...restOfOptions } = options ?? {};\n\n\tconst externalStore = useConstant(() => {\n\t\treturn createExternalStorageStore({ initialValue, key, ...restOfOptions });\n\t});\n\n\tconst stateInStorage = useStore(externalStore as never, select as never);\n\n\treturn [stateInStorage as never, externalStore];\n};\n","import { throttleByFrame, throttleBySetTimeout, throttleByTime } from \"@zayne-labs/toolkit-core\";\nimport type { CallbackFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useUnmountEffect } from \"./effects\";\nimport { useCallbackRef } from \"./useCallbackRef\";\nimport { useConstant } from \"./useConstant\";\n\nexport const useThrottleBySetTimeout = <TParams>(callbackFn: CallbackFn<TParams>, delay: number) => {\n\tconst latestCallback = useCallbackRef(callbackFn);\n\n\tconst throttledCallback = useConstant(() => throttleBySetTimeout(latestCallback, delay));\n\n\tuseUnmountEffect(() => throttledCallback.cancelTimeout());\n\n\treturn throttledCallback;\n};\n\nexport const useThrottleByTimer = <TParams>(callbackFn: CallbackFn<TParams>, delay: number) => {\n\tconst latestCallback = useCallbackRef(callbackFn);\n\n\tconst throttledCallback = useConstant(() => throttleByTime(latestCallback, delay));\n\n\treturn throttledCallback;\n};\n\nexport const useThrottleByFrame = <TParams>(callbackFn: CallbackFn<TParams>) => {\n\tconst latestCallback = useCallbackRef(callbackFn);\n\n\tconst throttledCallback = useConstant(() => throttleByFrame(latestCallback));\n\n\tuseUnmountEffect(() => throttledCallback.cancelAnimation());\n\n\treturn throttledCallback;\n};\n"],"mappings":";;;;;AAGA,IAAa,eAAb,cAAkC,MAAM;CACvC,AAAS,OAAO;CAEhB,YAAY,GAAG,MAAgC;AAC9C,QAAM,GAAG,KAAK;AAEd,QAAM,kBAAkB,MAAM,KAAK,YAAY;CAC/C;AACD;AAED,MAAa,kBAAkB,CAACA,MAAcC,aAAqB;AAClE,SAAQ,EAAE,KAAK,2EAA2E,SAAS;AACnG;AAeD,MAAM,sBAAsB,CAC3BC,UAAwD,CAAE,MACtD;CACJ,MAAM,EACL,eAAe,MACf,cACA,WACA,WAAW,qBACX,eAAe,0BACf,OAAO,aAAa,SAAS,WAAW,GAAG,aAAa,MAAM,GAAG,GAAG,GAAG,kBACvE,SAAS,MACT,GAAG;CAEJ,MAAM,UAAU,cAAoC,aAAa;AAEjE,SAAQ,cAAc;CAEtB,MAAM,mBAAmB,MAAsD;EAC9E,MAAM,eAAe,IAAI,QAAQ;EAEjC,MAAM,uBAAuB,YAAY,aAAa,IAAI;AAE1D,MAAI,UAAU,yBAAyB,KACtC,OAAM,IAAI,aAAa,gBAAgB,gBAAgB,UAAU,aAAa;AAG/E,SAAO;CACP;AAED,QAAO,WAAW,CAAC,SAAS,gBAAiB,EAAC;AAC9C;;;;;;;;;ACnDD,MAAM,iBAAiB,CAA0BC,eAAsC;CACtF,MAAM,cAAc,OAAO,WAAW;AAEtC,iBAAgB,MAAM;AAErB,cAAY,UAAU;CACtB,GAAE,CAAC,UAAW,EAAC;CAEhB,MAAM,gBAAgB,YAErB,CAAC,GAAG,WAAsB,AAAC,YAAY,UAA0B,GAAG,OAAO,EA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