cnum
Version:
Represent rational numbers in comfortably numeric way.
41 lines (40 loc) • 1.52 kB
TypeScript
export * from 'preact/hooks';
import { VNode, RefObject } from 'preact';
import './style.css';
export declare const axisLabelFormat: (coefficient: number, exponent: number) => string;
declare type TranslateFunction = (x: number, y: number) => void;
declare type ScaleFunction = (x: number, y: number) => void;
declare type GetContextFunction = (canvas: HTMLCanvasElement) => CanvasRenderingContext2D;
declare type InitFunction = (ctx: CanvasRenderingContext2D) => void;
declare type ReadyFunction = (whenReady: VoidFunction) => void;
declare type DrawFunction = (ctx: CanvasRenderingContext2D, frameCount: number) => void;
declare type ResizeFunction = (ctx: CanvasRenderingContext2D) => void;
declare type RenderFunction = () => void;
export interface CanvasOptions {
contextType?: string;
framesPerSecond?: number;
}
export interface CanvasMethods {
render: RenderFunction;
}
export interface CanvasProps {
ref?: RefObject<HTMLCanvasElement>;
className?: string;
getContext?: GetContextFunction;
init?: InitFunction;
ready?: ReadyFunction;
draw: DrawFunction;
onResize?: ResizeFunction;
animate?: boolean;
options?: CanvasOptions;
canvasMethodRefs?: CanvasMethods;
}
export interface Props {
locale?: string;
canvasMethodRefs?: CanvasMethods;
setTranslate?: TranslateFunction;
setScale?: ScaleFunction;
initialScale?: number;
framesPerSecond?: number;
}
export default function App(props: Props): VNode;