export declare namespace Ddan { type KV = Record; interface IKeyValuePart { key: string; value: T; } interface IPoint { x: number; y: number; } type KeyValue = Required>; type Function = (...args: any[]) => void; type PFunction = Promise | Function; type Callback = (...args: T) => R; type Action = Callback; type Task = Callback<[T[]], R>; type Func = Callback<[], R>; type Func1 = Callback<[T], R>; type Func2 = Callback<[T0, T1], R>; type Func3 = Callback<[T0, T1, T2], R>; type Func4 = Callback<[T0, T1, T2, T3], R>; type Result = T | Promise; type SafeResult = [any, undefined] | [null, T]; type PSafeResult = Promise>; type noop = (...args: any[]) => any; type ObjToKeyValUnion = { [K in keyof T]: { key: K; value: T[K]; }; }[keyof T]; type ObjToKeyValArray = { [K in keyof T]: [K, T[K]]; }[keyof T]; type ObjToSelectedValueUnion = { [K in keyof T]: T[K]; }[keyof T]; type Optional = Omit & Partial>; type GetOptional = { [P in keyof T as T[P] extends Required[P] ? never : P]: T[P]; }; interface IHttpHost { hash: string; href: string; url: string; origin: string; host: string; protocol: string; hostname: string; port: string; query: string; } interface IGetset { set(value?: T): void; get(): T | undefined; } interface IEvent { clear: () => void; on: (name: string, handler: Function, tag?: string) => void; emit: (name: string, ...args: any[]) => void; off: (name: string, handler: Function) => void; remove: (name: string) => void; removeByTag: (tag: string) => void; once: (name: string, handler: Function) => void; has: (name: string) => boolean; } interface IPersist { key: string; storage?: IStorage; fields: string[]; save: (data: any) => any; read: () => any; handleSave: (target: IDStore, key: string) => void; } interface IStorage { getItem?: (key: string) => string | null; removeItem?: (key: string) => void; setItem?: (key: string, value: string) => void; setStorageSync?: (key: string, data: any) => void; removeStorageSync?: (key: string) => void; getStorageSync?: (key: string) => any; } interface IDPersistConfig { key: string; fields: string[]; storage: IStorage; } interface IDStore { [key: string]: any; getters?: Record; setters?: Record; actions?: Record; persist?: IDPersistConfig; __persist?: IPersist; } type TStoreGetterFunction = (arg: IDStore) => any; type TStoreCommitFunction = (name: string, payload: any) => void; type TStoreSetterFunction = (arg: IDStore, payload: any) => boolean; type TStoreActionFunction = (arg: IDStore & { commit: TStoreCommitFunction; }, payload: any) => any; interface ILoopFrame { start: () => ILoopFrame; stop: () => ILoopFrame; restart: () => ILoopFrame; on: (cb: Function) => ILoopFrame; off: (cb: Function) => ILoopFrame; } interface ICountdown { countdown: number; timestamp: number; seconds: number; d: number; dd: string; h: number; hh: string; m: number; mm: string; s: number; ss: string; S: number; SS: string; SSS: string; desc: string; } interface ITime { date?: Date; timestamp: number; yyyy?: number; yy?: string; M?: number; MM?: string; d: number; dd: string; h: number; hh: string; m: number; mm: string; s: number; ss: string; S: number; SS: string; SSS: string; toDate: () => ITime; toCountdown: (regFormat?: string) => Ddan.ICountdown; add: (ms: number) => ITime; format: (regFormat?: string) => string; } interface IRegexRule { key: string; flag?: 'i' | 'g' | 'm' | 'gi' | 'mi'; value: string; } interface IIgnoreParams { ignoreUndefined?: boolean; ignoreNull?: boolean; ignoreZero?: boolean; ignoreEmptyArray?: boolean; ignoreEmptyString?: boolean; cover?: boolean; } /** * leading 开始执行 * trailing 结束执行 */ interface IDebounceOption { leading?: boolean; maxWait?: number; trailing?: boolean; } interface IPipeline { push(func?: Function): IPipeline; clear(): IPipeline; whenAll(): Promise; } interface ISafeTask { run(): PSafeResult; } } export declare namespace dd { interface IHttpRequest { url: string; host: string; options: IHttpRequestInit; } interface IHttpApiConfig { [key: string]: IHttpRequestInit; } type ResponseInterceptFunc = Ddan.Func1; type RequestInterceptFunc = Ddan.Func1; interface IHttpConfig { host?: string; config: IHttpApiConfig; handleRequest?: RequestInterceptFunc | RequestInterceptFunc[]; handleResponse?: ResponseInterceptFunc | ResponseInterceptFunc[]; handleError?: Ddan.Func1; } interface IHttpRequestInit extends RequestInit { [key: string]: any; url: string; model?: string; method: 'get' | 'post' | 'put'; body?: string; plugins?: Record; } interface IHttp { host: string; interceptors: { request: any; response: any; }; fetch: (name: string, payload?: Record) => Promise; [key: string]: any; } interface IHttpResponse { response: Response & Record; config?: Ddan.KV; refetch: () => Promise; } interface IMiniHttpOptions { reqConfig?: any; api: (payload: any) => any; requestEncrypt?: (payload: any) => any; responseDecrypt?: (payload: any) => any; handleError?: (error: any) => void; } interface IDWatermarkParams { [key: string]: any; t?: number; g?: 'nw' | 'north' | 'ne' | 'west' | 'center' | 'east' | 'sw' | 'south' | 'se'; x?: number; y?: number; voffset?: number; fill?: 0 | 1; padx?: number; pady?: number; } interface IDWatermarkText { type?: 'd3F5LXplbmhlaQ' | 'd3F5LW1pY3JvaGVp' | 'ZmFuZ3poZW5nc2h1c29uZw' | 'ZmFuZ3poZW5na2FpdGk' | 'ZmFuZ3poZW5naGVpdGk' | 'ZmFuZ3poZW5nZmFuZ3Nvbmc' | 'ZHJvaWRzYW5zZmFsbGJhY2s'; color?: string; size?: number; shadow?: number; rotate?: number; padx?: number; pady?: number; } }