import { D as DependencyListTyped } from './react-tools.Ozx07lAu.js'; import { EffectCallback, DependencyList, DispatchWithoutAction } from 'react'; import { C as CompareFn } from './react-tools.Bn4eWtTP.js'; /** * Parameters accepted by [useEffectAbortable](https://react-tools.ndria.dev/hooks/lifecycle/useEffectAbortable). * * @template T - The tuple type of the dependency list. Inferred automatically from the `deps` argument, providing stricter typing than the standard `DependencyList`. */ type UseEffectAbortableProps = { /** * The effect callback, receiving an {@link AbortSignal} that is automatically * aborted when the effect is cleaned up (i.e. when `deps` change or the * component unmounts). Supports four return shapes: * - **`void`** — No cleanup needed; the signal abortion is the only teardown. * - **`Promise`** — An async effect with no additional cleanup. * - **`() => void`** — A synchronous cleanup function, called before the next * effect run or on unmount, in addition to aborting the signal. * - **`Promise<() => void>`** — An async effect that resolves with a cleanup * function, called before the next effect run or on unmount. */ cb: (signal: AbortSignal) => void | Promise | (() => void) | Promise<() => void>; /** * A strictly-typed dependency array (same semantics as `useEffect`). The effect * re-runs and the previous {@link AbortSignal} is aborted whenever any dependency * changes. Using {@link DependencyListTyped} instead of the standard * `DependencyList` provides compile-time checking of dependency types. */ deps: DependencyListTyped; }; /** * Return value of [useIsMounted](https://react-tools.ndria.dev/hooks/lifecycle/useIsMounted). * * A stable function that returns `true` when the component is currently mounted * and `false` after it has unmounted. Useful for guarding async callbacks or * deferred operations that should not update state after the component is gone. */ type UseIsMountedResult = () => boolean; /** * Parameters accepted by [useLogger](https://react-tools.ndria.dev/hooks/lifecycle/useLogger). */ type UseLoggerProps = { /** * The display name of the component being logged, used as a prefix in all * console output (e.g. `"MyComponent mounted"`, `"MyComponent updated"`). */ name: string; /** * The current props of the component. On each render the hook compares these * with the previous render's props and logs which individual properties changed, * along with their old and new values. */ props: object; }; /** * **`useEffectAbortable`**: custom useEffect with a unified cancellation mechanism to ensure complete cleanup and to prevent the warning that appears on old React version _"Can't perform a React state update on an unmounted component"_. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useEffectAbortable) * @template T - The tuple type of the dependency list. Inferred automatically from the `deps` argument, providing stricter typing than the standard `DependencyList`. * @param {UseEffectAbortableProps} cb - {@link UseEffectAbortableProps} * @param {UseEffectAbortableProps} deps - {@link UseEffectAbortableProps} * @returns {void} result */ declare const useEffectAbortable: (cb: UseEffectAbortableProps["cb"], deps: UseEffectAbortableProps["deps"]) => void; /** * **`useEffectCompare`**: custom useEffect that reexecutes EffectCallback only when comparator function, received as third parameter, returns true. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useEffectCompare) * @template T - The tuple type of the dependency list entries. Defaults to `unknown` when not specified. * @param {EffectCallback} cb * @param {DependencyListTyped} deps - {@link DependencyListTyped} * @param {CompareFn} [compareFn] - {@link CompareFn} * @returns {void} result */ declare const useEffectCompare: (cb: EffectCallback, deps: DependencyListTyped, compareFn?: CompareFn) => void; /** * **`useEffectDeepCompare`**: custom useEffect that reexecutes EffectCallback only when deps are different in depth. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useEffectDeepCompare) * @param {EffectCallback} cb * @param {DependencyList} deps - {@link DependencyList} * @returns {void} result */ declare const useEffectDeepCompare: (cb: EffectCallback, deps: DependencyList) => void; /** * **`useEffectOnce`**: Hook to executes _effect_ and _clean up_ after component mount __only once__. It prevents _React 18 StrictMode_ behavior if present, otherwise it works like a normal _useEffect_ with empty dependencies array. * * __*N.B.*__ Not use in a component with normal _useEffect_, if it executes a _React.DispatchAction_, because this action is executes twice if there is _React.StrictMode_. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useEffectOnce) * @param {EffectCallback} effect * @returns {void} result */ declare const useEffectOnce: (effect: EffectCallback) => void; /** * **`useLayoutEffectAbortable`**: custom useLayoutEffect with a unified cancellation mechanism to ensure complete cleanup and to prevent the warning that appears on old React version _"Can't perform a React state update on an unmounted component"_. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useLayoutEffectAbortable) * @template T - The tuple type of the dependency list. Inferred automatically from the `deps` argument, providing stricter typing than the standard `DependencyList`. * @param {UseEffectAbortableProps} cb - {@link UseEffectAbortableProps} * @param {UseEffectAbortableProps} deps - {@link UseEffectAbortableProps} * @returns {void} result */ declare const useLayoutEffectAbortable: (cb: UseEffectAbortableProps["cb"], deps: UseEffectAbortableProps["deps"]) => void; /** * **`useLayoutEffectCompare`**: custom useLayoutEffect that reexecutes EffectCallback only when comparator function, received as third parameter, returns true. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useLayoutEffectCompare) * @template T - The tuple type of the dependency list entries. Defaults to `unknown` when not specified. * @param {EffectCallback} cb * @param {DependencyListTyped} deps - {@link DependencyListTyped} * @param {CompareFn} [compareFn] - {@link CompareFn} * @returns {void} result */ declare const useLayoutEffectCompare: (cb: EffectCallback, deps: DependencyListTyped, compareFn?: CompareFn) => void; /** * **`useLayoutEffectDeepCompare`**: custom useEffect that reexecutes EffectCallback only when deps are different in depth. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useLayoutEffectDeepCompare) * @param {EffectCallback} cb * @param {DependencyList} deps - {@link DependencyList} * @returns {void} result */ declare const useLayoutEffectDeepCompare: (cb: EffectCallback, deps: DependencyList) => void; /** * **`useLayoutEffectOnce`**: Hook to executes _effect_ and _clean up_ after component mount __only once__. It prevents _React 18 StrictMode_ behavior if present, otherwise it works like a normal _useLayoutEffect_ with empty dependencies array. * * __*N.B.*__ Not use in a component with normal _useLayoutEffect_, if it executes a _React.DispatchAction_, because this action is executes twice if there is _React.StrictMode_. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useLayoutEffectOnce) * @param {EffectCallback} effect * @returns {void} result */ declare const useLayoutEffectOnce: (effect: EffectCallback) => void; /** * **`useRerender`**: Hook to force a render. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useRerender) * @template T - The type of the internal counter value. Only relevant when `withValue` is `true` — ignored in the `DispatchWithoutAction` overload. * @param {boolean} [withValue] * @returns {UseRerenderResult} result - {@link UseRerenderResult} */ declare function useRerender(withValue?: never): DispatchWithoutAction; declare function useRerender(withValue?: false): DispatchWithoutAction; declare function useRerender(withValue?: true): [T, DispatchWithoutAction]; /** * **`useIsMounted`**: Hoos to know when a component is mounted or not. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useIsMounted) * @returns {UseIsMountedResult} result - {@link UseIsMountedResult} */ declare const useIsMounted: () => UseIsMountedResult; /** * __`useDeferredValue`__: _useDeferredValue_ hook polyfilled for React versions below 18. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useDeferredValue) * @template T - The type of the value to defer. Inferred automatically from the * @param {T} param * @returns {T} result */ declare function useDeferredValuePolyfill(value: T): T; declare const useDeferredValue: typeof useDeferredValuePolyfill; /** * **`useLogger`**: Hook to log componet details during Lifecycle events. * @see [📖 Documentation](https://react-tools.ndria.dev/hooks/lifecycle/useLogger) * @param {UseLoggerProps["name"]} name - {@link UseLoggerProps} * @param {UseLoggerProps["props"]} props - {@link UseLoggerProps} * @returns {void} result */ declare const useLogger: (name: UseLoggerProps["name"], props: UseLoggerProps["props"]) => void; export { useEffectAbortable as a, useEffectCompare as b, useEffectDeepCompare as c, useEffectOnce as d, useIsMounted as e, useLayoutEffectAbortable as f, useLayoutEffectCompare as g, useLayoutEffectDeepCompare as h, useLayoutEffectOnce as i, useLogger as j, useRerender as k, useDeferredValue as u }; export type { UseEffectAbortableProps as U, UseIsMountedResult as l, UseLoggerProps as m };