-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Jasery/feat-ts-support
feat: 添加TypeScript 类型支持
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
export class WxCanvas2d { | ||
create(opts: { | ||
query: string; | ||
rootWidth?: number; | ||
bgColor?: string; | ||
component?: any; | ||
radius?: number; | ||
}) : Promise<void>; | ||
|
||
draw(opts: { series: ISerie[] }) : Promise<void>; | ||
clear(): void; | ||
|
||
save(opts: { | ||
x?: number; | ||
y?: number; | ||
width?: number; | ||
height?: number; | ||
destWidth?: number; | ||
destHeight?: number; | ||
modalOption?: { | ||
title?: string; | ||
content?: string; | ||
success?: (res: { confirm: boolean, cancel: boolean }) => void; | ||
}; | ||
}) : Promise<{ tempFilePath: string }>; | ||
|
||
static use(plugin: IPlugin): void; | ||
} | ||
|
||
export interface ISerieType { | ||
name: string; | ||
handler: (config: Exclude<ISerie, 'type'>) => Promise<void>; | ||
} | ||
|
||
export interface IPlugin { | ||
name: string; | ||
handler: (opt: any) => void; | ||
} | ||
|
||
export interface ISerie { | ||
type: ISerieType; | ||
x?: number; | ||
y?: number; | ||
width?: number; | ||
height?: number; | ||
bgColor?: string; | ||
radius?: number; | ||
lineStyle?: { | ||
color?: string; | ||
width?: number; | ||
dash?: number[]; | ||
}; | ||
zIndex?: number; | ||
reverse?: boolean; | ||
r?: number; | ||
blur?: number; | ||
url?: string; | ||
mode?: string; | ||
text?: string; | ||
fontSize?: number; | ||
lineHeight?: number; | ||
ellipsis?: number; | ||
color?: string; | ||
align?: string; | ||
baseline?: string; | ||
fontWeight?: string; | ||
line?: { point: [number, number] }[]; | ||
'line.point'?: [number, number]; | ||
size?: number; | ||
} | ||
|
||
export const Arc: ISerieType; | ||
export const Blur: ISerieType; | ||
export const Image: ISerieType; | ||
export const Line: ISerieType; | ||
export const Qrcode: ISerieType; | ||
export const Rect: ISerieType; | ||
export const Text: ISerieType; | ||
|
||
export const Debugger: IPlugin; | ||
export const SaveToAlbum: IPlugin; |