react-chrono
Version:
A Modern Timeline component for React
43 lines • 1.66 kB
TypeScript
import { MutableRefObject } from 'react';
/**
* Hook that provides a stable callback reference that always calls the latest version
* @param callback - The callback function
* @returns A stable callback reference
*/
export declare const useStableCallback: <T extends (...args: any[]) => any>(callback: T) => T;
/**
* Hook that provides a stable ref that updates without causing re-renders
* @param value - The value to store in the ref
* @returns A ref containing the latest value
*/
export declare const useLatestRef: <T>(value: T) => MutableRefObject<T>;
/**
* Hook that runs a cleanup function on unmount
* @param cleanup - The cleanup function to run
*/
export declare const useUnmount: (cleanup: () => void) => void;
/**
* Hook that provides RAF-based throttling
* @param callback - The callback to throttle
* @returns Throttled callback
*/
export declare const useRAFThrottle: <T extends (...args: any[]) => void>(callback: T) => T;
/**
* Color format detection utilities
*/
export declare const HEX_COLOR_REGEX: RegExp;
export declare const RGB_COLOR_REGEX: RegExp;
export declare const RGBA_COLOR_REGEX: RegExp;
export declare const HSL_COLOR_REGEX: RegExp;
export declare const HSLA_COLOR_REGEX: RegExp;
export type ColorFormat = 'hex' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'unknown';
export declare const detectColorFormat: (color: string) => ColorFormat;
/**
* Adjusts RGB color opacity
*/
export declare const adjustRGBOpacity: (color: string, opacity: number) => string;
/**
* Adjusts HSL color opacity
*/
export declare const adjustHSLOpacity: (color: string, opacity: number) => string;
//# sourceMappingURL=utils.d.ts.map