@idraw/util 0.3.0-alpha.6 → 0.3.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts DELETED
@@ -1,222 +0,0 @@
1
- import { TypeBoardSizeOptions } from '@idraw/types';
2
- import { TypeContext } from '@idraw/types';
3
-
4
- declare function angle(value: any): boolean;
5
-
6
- declare function attrs(attrs: any): boolean;
7
-
8
- declare function borderRadius(value: any): boolean;
9
-
10
- declare function borderWidth(value: any): boolean;
11
-
12
- export declare const check: {
13
- attrs: typeof attrs;
14
- textDesc: typeof textDesc;
15
- rectDesc: typeof rectDesc;
16
- circleDesc: typeof circleDesc;
17
- imageDesc: typeof imageDesc;
18
- svgDesc: typeof svgDesc;
19
- htmlDesc: typeof htmlDesc;
20
- };
21
-
22
- declare function circleDesc(desc: any): boolean;
23
-
24
- declare function color(value: any): boolean;
25
-
26
- export declare function compose(middleware: Middleware[]): (context: any, next?: Middleware) => any;
27
-
28
- export declare class Context implements TypeContext {
29
- private _opts;
30
- private _ctx;
31
- private _transform;
32
- constructor(ctx: CanvasRenderingContext2D, opts: Options);
33
- getContext(): CanvasRenderingContext2D;
34
- resetSize(opts: TypeBoardSizeOptions): void;
35
- calcDeviceNum(num: number): number;
36
- calcScreenNum(num: number): number;
37
- getSize(): {
38
- width: number;
39
- height: number;
40
- contextWidth: number;
41
- contextHeight: number;
42
- devicePixelRatio: number;
43
- };
44
- setTransform(config: Transform): void;
45
- getTransform(): {
46
- scale: number;
47
- scrollX: number;
48
- scrollY: number;
49
- };
50
- setFillStyle(color: string | CanvasPattern | CanvasGradient): void;
51
- fill(fillRule?: CanvasFillRule | undefined): void;
52
- arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void;
53
- rect(x: number, y: number, w: number, h: number): void;
54
- fillRect(x: number, y: number, w: number, h: number): void;
55
- clearRect(x: number, y: number, w: number, h: number): void;
56
- beginPath(): void;
57
- closePath(): void;
58
- lineTo(x: number, y: number): void;
59
- moveTo(x: number, y: number): void;
60
- arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
61
- setLineWidth(w: number): number;
62
- setLineDash(nums: number[]): void;
63
- isPointInPath(x: number, y: number): boolean;
64
- isPointInPathWithoutScroll(x: number, y: number): boolean;
65
- setStrokeStyle(color: string): void;
66
- stroke(): void;
67
- translate(x: number, y: number): void;
68
- rotate(angle: number): void;
69
- drawImage(...args: any[]): void;
70
- createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;
71
- measureText(text: string): TextMetrics;
72
- setTextAlign(align: CanvasTextAlign): void;
73
- fillText(text: string, x: number, y: number, maxWidth?: number | undefined): void;
74
- strokeText(text: string, x: number, y: number, maxWidth?: number | undefined): void;
75
- setFont(opts: {
76
- fontSize: number;
77
- fontFamily?: string;
78
- fontWeight?: 'bold';
79
- }): void;
80
- setTextBaseline(baseline: CanvasTextBaseline): void;
81
- setGlobalAlpha(alpha: number): void;
82
- save(): void;
83
- restore(): void;
84
- scale(ratioX: number, ratioY: number): void;
85
- setShadowColor(color: string): void;
86
- setShadowOffsetX(offsetX: number): void;
87
- setShadowOffsetY(offsetY: number): void;
88
- setShadowBlur(blur: number): void;
89
- ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean | undefined): void;
90
- private _doSize;
91
- private _doX;
92
- private _doY;
93
- }
94
-
95
- export declare function createUUID(): string;
96
-
97
- export declare function deepClone(target: any): any;
98
-
99
- export declare function delay(time: number): Promise<void>;
100
-
101
- export declare function downloadImageFromCanvas(canvas: HTMLCanvasElement, opts: {
102
- filename: string;
103
- type: ImageType;
104
- }): void;
105
-
106
- declare function fontFamily(value: any): boolean;
107
-
108
- declare function fontSize(value: any): boolean;
109
-
110
- declare function fontWeight(value: any): boolean;
111
-
112
- declare function h(value: any): boolean;
113
-
114
- declare function html(value: any): boolean;
115
-
116
- declare function htmlDesc(desc: any): boolean;
117
-
118
- declare function imageBase64(value: any): boolean;
119
-
120
- declare function imageDesc(desc: any): boolean;
121
-
122
- declare function imageSrc(value: any): boolean;
123
-
124
- declare type ImageType = 'image/jpeg' | 'image/png';
125
-
126
- declare function imageURL(value: any): boolean;
127
-
128
- export declare const is: {
129
- x: typeof x;
130
- y: typeof y;
131
- w: typeof w;
132
- h: typeof h;
133
- angle: typeof angle;
134
- number: typeof number;
135
- borderWidth: typeof borderWidth;
136
- borderRadius: typeof borderRadius;
137
- color: typeof color;
138
- imageSrc: typeof imageSrc;
139
- imageURL: typeof imageURL;
140
- imageBase64: typeof imageBase64;
141
- svg: typeof svg;
142
- html: typeof html;
143
- text: typeof text;
144
- fontSize: typeof fontSize;
145
- lineHeight: typeof lineHeight;
146
- textAlign: typeof textAlign;
147
- fontFamily: typeof fontFamily;
148
- fontWeight: typeof fontWeight;
149
- strokeWidth: typeof strokeWidth;
150
- };
151
-
152
- export declare function isColorStr(color?: string): boolean;
153
-
154
- export declare const istype: {
155
- type(data: any, lowerCase?: boolean): string;
156
- array(data: any): boolean;
157
- json(data: any): boolean;
158
- function(data: any): boolean;
159
- asyncFunction(data: any): boolean;
160
- string(data: any): boolean;
161
- number(data: any): boolean;
162
- undefined(data: any): boolean;
163
- null(data: any): boolean;
164
- promise(data: any): boolean;
165
- };
166
-
167
- declare function lineHeight(value: any): boolean;
168
-
169
- export declare function loadHTML(html: string, opts: {
170
- width: number;
171
- height: number;
172
- }): Promise<HTMLImageElement>;
173
-
174
- export declare function loadImage(src: string): Promise<HTMLImageElement>;
175
-
176
- export declare function loadSVG(svg: string): Promise<HTMLImageElement>;
177
-
178
- declare type Middleware = (ctx: any, next: Middleware) => any;
179
-
180
- declare function number(value: any): boolean;
181
-
182
- declare type Options = {
183
- width: number;
184
- height: number;
185
- contextWidth: number;
186
- contextHeight: number;
187
- devicePixelRatio: number;
188
- };
189
-
190
- declare function rectDesc(desc: any): boolean;
191
-
192
- declare function strokeWidth(value: any): boolean;
193
-
194
- declare function svg(value: any): boolean;
195
-
196
- declare function svgDesc(desc: any): boolean;
197
-
198
- declare function text(value: any): boolean;
199
-
200
- declare function textAlign(value: any): boolean;
201
-
202
- declare function textDesc(desc: any): boolean;
203
-
204
- export declare function throttle(fn: (...args: any[]) => any, timeout: number): (...args: any[]) => any;
205
-
206
- export declare function toColorHexNum(color: string): number;
207
-
208
- export declare function toColorHexStr(color: number): string;
209
-
210
- declare type Transform = {
211
- scale?: number;
212
- scrollX?: number;
213
- scrollY?: number;
214
- };
215
-
216
- declare function w(value: any): boolean;
217
-
218
- declare function x(value: any): boolean;
219
-
220
- declare function y(value: any): boolean;
221
-
222
- export { }