UNPKG

claritykit-svelte

Version:

A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility

107 lines 3.57 kB
/** * Creates a scale based on the specified type */ export declare function createScale(type: 'linear' | 'time' | 'band' | 'log', domain: [number, number] | string[], range: [number, number], padding?: number): any; /** * Gets the domain for a scale based on data and accessor */ export declare function getDomain<T>(data: T[], accessor: (d: T) => any, type?: 'linear' | 'time' | 'band' | 'log', padding?: number): any[]; /** * Formats a value based on its type */ export declare function formatValue(value: any, type?: 'number' | 'time' | 'percentage' | 'currency', format?: string): string; /** * Gets a color from a color scale or array */ export declare function getColor(value: any, colors: string[] | ((d: any) => string), index?: number): string; /** * Calculates the inner dimensions accounting for margins */ export declare function calculateInnerDimensions(width: number, height: number, margin: { top: number; right: number; bottom: number; left: number; }): { width: number; height: number; }; /** * Normalizes margin object */ export declare function normalizeMargin(margin: number | { top?: number; right?: number; bottom?: number; left?: number; }): { top: number; right: number; bottom: number; left: number; }; /** * Gets the position for a tooltip */ export declare function getTooltipPosition(event: MouseEvent, tooltip: HTMLElement, offset?: number): { left: number; top: number; }; /** * Debounce function for resize and scroll events */ export declare function debounce<T extends (...args: any[]) => any>(func: T, wait?: number): (...args: Parameters<T>) => void; /** * Throttle function for scroll and resize events */ export declare function throttle<T extends (...args: any[]) => any>(func: T, limit?: number): (...args: Parameters<T>) => void; /** * Clamps a value between min and max */ export declare function clamp(value: number, min: number, max: number): number; /** * Calculates the angle in radians from one point to another */ export declare function angleBetweenPoints(x1: number, y1: number, x2: number, y2: number): number; /** * Calculates the distance between two points */ export declare function distanceBetweenPoints(x1: number, y1: number, x2: number, y2: number): number; /** * Checks if a point is within a bounding box */ export declare function isPointInBounds(x: number, y: number, bounds: { x: number; y: number; width: number; height: number; }): boolean; /** * Generates a unique ID */ export declare function generateId(prefix?: string): string; /** * Merges default props with user props */ export declare function mergeProps<T extends Record<string, any>>(defaultProps: Partial<T>, userProps: Partial<T>): T; /** * Gets the value at a given path in an object */ export declare function getValueAtPath(obj: Record<string, any>, path: string | string[]): any; /** * Deeply clones an object */ export declare function deepClone<T>(obj: T): T; /** * Creates a memoized function */ export declare function memoize<T extends (...args: any[]) => any>(fn: T, keyFn?: (...args: Parameters<T>) => string): T; /** * Creates a formatter function for numbers */ export declare function createNumberFormatter(format?: string, fallback?: string): (value: number | null | undefined) => string; /** * Creates a date formatter function */ export declare function createDateFormatter(format?: string, fallback?: string): (date: Date | string | number | null | undefined) => string; //# sourceMappingURL=utils.d.ts.map