galhui
Version:
UI library using galho framework
32 lines (31 loc) • 1.42 kB
TypeScript
import { Dic, Key, bool, int, str } from "galho/util.js";
/**request animation frame each frame, if fn returns false cancel animation
* @returns function that cancel the renderer of current animation
*/
export declare function anim(fn: () => any): () => void;
export declare function arrayToDic<T, U>(arr: Array<T>, callback: (value: T, index: number) => [Key, U]): Dic<U>;
/**
* map dictionary
* @param dic
* @param fn
*/
export declare function filterDic<T>(dic: Dic<T>, fn?: (value: T, key: string) => any): Dic<T>;
export declare function filterDic<T extends Dic>(dic: T, fn?: (value: any, key: any) => any): T;
export declare function anyProp<T = any>(dic: Dic<T>, fn?: (value: T, key: string) => unknown): boolean;
export declare function extend<T extends object, U = Partial<T>>(obj: T, extension: U, override?: bool): T & U;
export declare function UUID(size: int): any;
export declare class Time {
i: Date;
constructor(i: Date);
get y(): number;
get M(): number;
get d(): number;
get h(): number;
get m(): number;
get s(): number;
}
export declare function time(d?: Date | int | str): Time;
export declare function pad(v: Key, max?: int, fill?: Key): string;
export declare function date(t?: Date | int | str): string;
export declare function dateTime(t?: Date | int | str, sep?: string, noSec?: bool): string;
export declare function month(t?: Date | int | str): string;