@codehz/draw-call 0.1.0 → 0.1.1
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/canvas-BYrCq8eS.d.mts +234 -0
- package/canvas-CkpP3RNK.d.cts +234 -0
- package/engine-C88lMGbX.mjs +606 -0
- package/engine-OyKoV7Gn.cjs +636 -0
- package/index.cjs +15 -619
- package/index.d.cts +3 -228
- package/index.d.mts +3 -228
- package/index.mjs +9 -611
- package/node.cjs +47 -0
- package/node.d.cts +12 -0
- package/node.d.mts +12 -0
- package/node.mjs +47 -0
- package/package.json +23 -9
package/index.d.cts
CHANGED
|
@@ -1,230 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface ColorStop {
|
|
4
|
-
offset: number;
|
|
5
|
-
color: string;
|
|
6
|
-
}
|
|
7
|
-
interface LinearGradientDescriptor {
|
|
8
|
-
type: "linear-gradient";
|
|
9
|
-
angle: number;
|
|
10
|
-
stops: ColorStop[];
|
|
11
|
-
}
|
|
12
|
-
interface RadialGradientDescriptor {
|
|
13
|
-
type: "radial-gradient";
|
|
14
|
-
startX?: number;
|
|
15
|
-
startY?: number;
|
|
16
|
-
startRadius?: number;
|
|
17
|
-
endX?: number;
|
|
18
|
-
endY?: number;
|
|
19
|
-
endRadius?: number;
|
|
20
|
-
stops: ColorStop[];
|
|
21
|
-
}
|
|
22
|
-
type GradientDescriptor = LinearGradientDescriptor | RadialGradientDescriptor;
|
|
23
|
-
type Color = string | CanvasGradient | CanvasPattern | GradientDescriptor;
|
|
24
|
-
declare function linearGradient(angle: number, ...stops: (string | [number, string])[]): LinearGradientDescriptor;
|
|
25
|
-
declare function radialGradient(options: {
|
|
26
|
-
startX?: number;
|
|
27
|
-
startY?: number;
|
|
28
|
-
startRadius?: number;
|
|
29
|
-
endX?: number;
|
|
30
|
-
endY?: number;
|
|
31
|
-
endRadius?: number;
|
|
32
|
-
}, ...stops: (string | [number, string])[]): RadialGradientDescriptor;
|
|
33
|
-
interface Spacing {
|
|
34
|
-
top?: number;
|
|
35
|
-
right?: number;
|
|
36
|
-
bottom?: number;
|
|
37
|
-
left?: number;
|
|
38
|
-
}
|
|
39
|
-
interface Border {
|
|
40
|
-
width?: number;
|
|
41
|
-
color?: Color;
|
|
42
|
-
radius?: number | [number, number, number, number];
|
|
43
|
-
}
|
|
44
|
-
interface Shadow {
|
|
45
|
-
offsetX?: number;
|
|
46
|
-
offsetY?: number;
|
|
47
|
-
blur?: number;
|
|
48
|
-
color?: Color;
|
|
49
|
-
}
|
|
50
|
-
interface FontProps {
|
|
51
|
-
family?: string;
|
|
52
|
-
size?: number;
|
|
53
|
-
weight?: number | "normal" | "bold";
|
|
54
|
-
style?: "normal" | "italic";
|
|
55
|
-
}
|
|
56
|
-
interface StrokeProps {
|
|
57
|
-
color: Color;
|
|
58
|
-
width: number;
|
|
59
|
-
dash?: number[];
|
|
60
|
-
cap?: "butt" | "round" | "square";
|
|
61
|
-
join?: "miter" | "round" | "bevel";
|
|
62
|
-
}
|
|
63
|
-
interface Bounds {
|
|
64
|
-
x: number;
|
|
65
|
-
y: number;
|
|
66
|
-
width: number;
|
|
67
|
-
height: number;
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/types/layout.d.ts
|
|
71
|
-
type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse";
|
|
72
|
-
type JustifyContent = "start" | "end" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
73
|
-
type AlignItems = "start" | "end" | "center" | "stretch" | "baseline";
|
|
74
|
-
type AlignSelf = "auto" | AlignItems;
|
|
75
|
-
interface LayoutProps {
|
|
76
|
-
width?: Size;
|
|
77
|
-
height?: Size;
|
|
78
|
-
minWidth?: number;
|
|
79
|
-
maxWidth?: number;
|
|
80
|
-
minHeight?: number;
|
|
81
|
-
maxHeight?: number;
|
|
82
|
-
margin?: number | Spacing;
|
|
83
|
-
padding?: number | Spacing;
|
|
84
|
-
flex?: number;
|
|
85
|
-
alignSelf?: AlignSelf;
|
|
86
|
-
}
|
|
87
|
-
interface ContainerLayoutProps extends LayoutProps {
|
|
88
|
-
direction?: FlexDirection;
|
|
89
|
-
justify?: JustifyContent;
|
|
90
|
-
align?: AlignItems;
|
|
91
|
-
gap?: number;
|
|
92
|
-
wrap?: boolean;
|
|
93
|
-
}
|
|
94
|
-
interface ComputedLayout {
|
|
95
|
-
x: number;
|
|
96
|
-
y: number;
|
|
97
|
-
width: number;
|
|
98
|
-
height: number;
|
|
99
|
-
contentX: number;
|
|
100
|
-
contentY: number;
|
|
101
|
-
contentWidth: number;
|
|
102
|
-
contentHeight: number;
|
|
103
|
-
}
|
|
104
|
-
interface LayoutConstraints {
|
|
105
|
-
minWidth: number;
|
|
106
|
-
maxWidth: number;
|
|
107
|
-
minHeight: number;
|
|
108
|
-
maxHeight: number;
|
|
109
|
-
}
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/types/components.d.ts
|
|
112
|
-
type ElementType = "box" | "text" | "image" | "shape" | "stack";
|
|
113
|
-
interface ElementBase {
|
|
114
|
-
type: ElementType;
|
|
115
|
-
}
|
|
116
|
-
interface BoxProps extends ContainerLayoutProps {
|
|
117
|
-
background?: Color;
|
|
118
|
-
border?: Border;
|
|
119
|
-
shadow?: Shadow;
|
|
120
|
-
opacity?: number;
|
|
121
|
-
clip?: boolean;
|
|
122
|
-
children?: Element[];
|
|
123
|
-
}
|
|
124
|
-
interface BoxElement extends ElementBase, BoxProps {
|
|
125
|
-
type: "box";
|
|
126
|
-
}
|
|
127
|
-
interface TextProps extends LayoutProps {
|
|
128
|
-
content: string;
|
|
129
|
-
font?: FontProps;
|
|
130
|
-
color?: Color;
|
|
131
|
-
align?: "left" | "center" | "right";
|
|
132
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
|
133
|
-
lineHeight?: number;
|
|
134
|
-
maxLines?: number;
|
|
135
|
-
ellipsis?: boolean;
|
|
136
|
-
wrap?: boolean;
|
|
137
|
-
shadow?: Shadow;
|
|
138
|
-
stroke?: StrokeProps;
|
|
139
|
-
}
|
|
140
|
-
interface TextElement extends ElementBase, TextProps {
|
|
141
|
-
type: "text";
|
|
142
|
-
}
|
|
143
|
-
interface ImageProps extends LayoutProps {
|
|
144
|
-
src: string | ImageBitmap | CanvasImageSource;
|
|
145
|
-
fit?: "contain" | "cover" | "fill" | "none" | "scale-down";
|
|
146
|
-
position?: {
|
|
147
|
-
x?: "left" | "center" | "right" | number;
|
|
148
|
-
y?: "top" | "center" | "bottom" | number;
|
|
149
|
-
};
|
|
150
|
-
border?: Border;
|
|
151
|
-
shadow?: Shadow;
|
|
152
|
-
opacity?: number;
|
|
153
|
-
}
|
|
154
|
-
interface ImageElement extends ElementBase, ImageProps {
|
|
155
|
-
type: "image";
|
|
156
|
-
}
|
|
157
|
-
type ShapeType = "rect" | "circle" | "ellipse" | "line" | "polygon" | "path";
|
|
158
|
-
interface ShapeProps extends LayoutProps {
|
|
159
|
-
shape: ShapeType;
|
|
160
|
-
fill?: Color;
|
|
161
|
-
stroke?: StrokeProps;
|
|
162
|
-
shadow?: Shadow;
|
|
163
|
-
points?: [number, number][];
|
|
164
|
-
path?: string;
|
|
165
|
-
}
|
|
166
|
-
interface ShapeElement extends ElementBase, ShapeProps {
|
|
167
|
-
type: "shape";
|
|
168
|
-
}
|
|
169
|
-
interface StackProps extends ContainerLayoutProps {
|
|
170
|
-
children: Element[];
|
|
171
|
-
background?: Color;
|
|
172
|
-
border?: Border;
|
|
173
|
-
shadow?: Shadow;
|
|
174
|
-
opacity?: number;
|
|
175
|
-
clip?: boolean;
|
|
176
|
-
}
|
|
177
|
-
interface StackElement extends ElementBase, StackProps {
|
|
178
|
-
type: "stack";
|
|
179
|
-
}
|
|
180
|
-
type Element = BoxElement | TextElement | ImageElement | ShapeElement | StackElement;
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/layout/measure.d.ts
|
|
183
|
-
interface MeasureContext {
|
|
184
|
-
measureText(text: string, font: FontProps): {
|
|
185
|
-
width: number;
|
|
186
|
-
height: number;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
declare function createCanvasMeasureContext(ctx: CanvasRenderingContext2D): MeasureContext;
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/layout/engine.d.ts
|
|
192
|
-
interface LayoutNode {
|
|
193
|
-
element: Element;
|
|
194
|
-
layout: ComputedLayout;
|
|
195
|
-
children: LayoutNode[];
|
|
196
|
-
lines?: string[];
|
|
197
|
-
}
|
|
198
|
-
declare function computeLayout(element: Element, ctx: MeasureContext, constraints: LayoutConstraints, x?: number, y?: number): LayoutNode;
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/canvas.d.ts
|
|
201
|
-
interface CanvasOptions {
|
|
202
|
-
width: number;
|
|
203
|
-
height: number;
|
|
204
|
-
pixelRatio?: number;
|
|
205
|
-
canvas?: {
|
|
206
|
-
getContext(type: "2d"): CanvasRenderingContext2D | null;
|
|
207
|
-
width: number;
|
|
208
|
-
height: number;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
interface LayoutSize {
|
|
212
|
-
width: number;
|
|
213
|
-
height: number;
|
|
214
|
-
}
|
|
215
|
-
interface DrawCallCanvas {
|
|
216
|
-
readonly width: number;
|
|
217
|
-
readonly height: number;
|
|
218
|
-
readonly pixelRatio: number;
|
|
219
|
-
render(element: Element): LayoutNode;
|
|
220
|
-
clear(): void;
|
|
221
|
-
getContext(): CanvasRenderingContext2D;
|
|
222
|
-
toDataURL(type?: string, quality?: number): string;
|
|
223
|
-
toBuffer(type?: "image/png" | "image/jpeg"): Promise<Buffer>;
|
|
224
|
-
}
|
|
225
|
-
declare function createCanvas(options: CanvasOptions): DrawCallCanvas;
|
|
226
|
-
declare function createCanvasAsync(options: Omit<CanvasOptions, "canvas">): Promise<DrawCallCanvas>;
|
|
227
|
-
//#endregion
|
|
1
|
+
import { A as Shadow, C as Bounds, D as GradientDescriptor, E as FontProps, F as radialGradient, M as Spacing, N as StrokeProps, O as LinearGradientDescriptor, P as linearGradient, S as Border, T as ColorStop, _ as AlignSelf, a as LayoutNode, b as JustifyContent, c as createCanvasMeasureContext, d as Element, f as StackElement, g as AlignItems, h as TextProps, i as createCanvas, j as Size, k as RadialGradientDescriptor, l as BoxElement, m as TextElement, n as DrawCallCanvas, o as computeLayout, p as StackProps, r as LayoutSize, s as MeasureContext, t as CanvasOptions, u as BoxProps, v as ContainerLayoutProps, w as Color, x as LayoutProps, y as FlexDirection } from "./canvas-CkpP3RNK.cjs";
|
|
2
|
+
|
|
228
3
|
//#region src/components/Box.d.ts
|
|
229
4
|
declare function Box(props: BoxProps): BoxElement;
|
|
230
5
|
//#endregion
|
|
@@ -234,4 +9,4 @@ declare function Stack(props: StackProps): StackElement;
|
|
|
234
9
|
//#region src/components/Text.d.ts
|
|
235
10
|
declare function Text(props: TextProps): TextElement;
|
|
236
11
|
//#endregion
|
|
237
|
-
export { type AlignItems, type AlignSelf, type Border, type Bounds, Box, type BoxElement, type BoxProps, type CanvasOptions, type Color, type ColorStop, type ContainerLayoutProps, type DrawCallCanvas, type Element, type FlexDirection, type FontProps, type GradientDescriptor, type JustifyContent, type LayoutNode, type LayoutProps, type LayoutSize, type LinearGradientDescriptor, type MeasureContext, type RadialGradientDescriptor, type Shadow, type Size, type Spacing, Stack, type StackElement, type StackProps, type StrokeProps, Text, type TextElement, type TextProps, computeLayout, createCanvas,
|
|
12
|
+
export { type AlignItems, type AlignSelf, type Border, type Bounds, Box, type BoxElement, type BoxProps, type CanvasOptions, type Color, type ColorStop, type ContainerLayoutProps, type DrawCallCanvas, type Element, type FlexDirection, type FontProps, type GradientDescriptor, type JustifyContent, type LayoutNode, type LayoutProps, type LayoutSize, type LinearGradientDescriptor, type MeasureContext, type RadialGradientDescriptor, type Shadow, type Size, type Spacing, Stack, type StackElement, type StackProps, type StrokeProps, Text, type TextElement, type TextProps, computeLayout, createCanvas, createCanvasMeasureContext, linearGradient, radialGradient };
|
package/index.d.mts
CHANGED
|
@@ -1,230 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface ColorStop {
|
|
4
|
-
offset: number;
|
|
5
|
-
color: string;
|
|
6
|
-
}
|
|
7
|
-
interface LinearGradientDescriptor {
|
|
8
|
-
type: "linear-gradient";
|
|
9
|
-
angle: number;
|
|
10
|
-
stops: ColorStop[];
|
|
11
|
-
}
|
|
12
|
-
interface RadialGradientDescriptor {
|
|
13
|
-
type: "radial-gradient";
|
|
14
|
-
startX?: number;
|
|
15
|
-
startY?: number;
|
|
16
|
-
startRadius?: number;
|
|
17
|
-
endX?: number;
|
|
18
|
-
endY?: number;
|
|
19
|
-
endRadius?: number;
|
|
20
|
-
stops: ColorStop[];
|
|
21
|
-
}
|
|
22
|
-
type GradientDescriptor = LinearGradientDescriptor | RadialGradientDescriptor;
|
|
23
|
-
type Color = string | CanvasGradient | CanvasPattern | GradientDescriptor;
|
|
24
|
-
declare function linearGradient(angle: number, ...stops: (string | [number, string])[]): LinearGradientDescriptor;
|
|
25
|
-
declare function radialGradient(options: {
|
|
26
|
-
startX?: number;
|
|
27
|
-
startY?: number;
|
|
28
|
-
startRadius?: number;
|
|
29
|
-
endX?: number;
|
|
30
|
-
endY?: number;
|
|
31
|
-
endRadius?: number;
|
|
32
|
-
}, ...stops: (string | [number, string])[]): RadialGradientDescriptor;
|
|
33
|
-
interface Spacing {
|
|
34
|
-
top?: number;
|
|
35
|
-
right?: number;
|
|
36
|
-
bottom?: number;
|
|
37
|
-
left?: number;
|
|
38
|
-
}
|
|
39
|
-
interface Border {
|
|
40
|
-
width?: number;
|
|
41
|
-
color?: Color;
|
|
42
|
-
radius?: number | [number, number, number, number];
|
|
43
|
-
}
|
|
44
|
-
interface Shadow {
|
|
45
|
-
offsetX?: number;
|
|
46
|
-
offsetY?: number;
|
|
47
|
-
blur?: number;
|
|
48
|
-
color?: Color;
|
|
49
|
-
}
|
|
50
|
-
interface FontProps {
|
|
51
|
-
family?: string;
|
|
52
|
-
size?: number;
|
|
53
|
-
weight?: number | "normal" | "bold";
|
|
54
|
-
style?: "normal" | "italic";
|
|
55
|
-
}
|
|
56
|
-
interface StrokeProps {
|
|
57
|
-
color: Color;
|
|
58
|
-
width: number;
|
|
59
|
-
dash?: number[];
|
|
60
|
-
cap?: "butt" | "round" | "square";
|
|
61
|
-
join?: "miter" | "round" | "bevel";
|
|
62
|
-
}
|
|
63
|
-
interface Bounds {
|
|
64
|
-
x: number;
|
|
65
|
-
y: number;
|
|
66
|
-
width: number;
|
|
67
|
-
height: number;
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/types/layout.d.ts
|
|
71
|
-
type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse";
|
|
72
|
-
type JustifyContent = "start" | "end" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
73
|
-
type AlignItems = "start" | "end" | "center" | "stretch" | "baseline";
|
|
74
|
-
type AlignSelf = "auto" | AlignItems;
|
|
75
|
-
interface LayoutProps {
|
|
76
|
-
width?: Size;
|
|
77
|
-
height?: Size;
|
|
78
|
-
minWidth?: number;
|
|
79
|
-
maxWidth?: number;
|
|
80
|
-
minHeight?: number;
|
|
81
|
-
maxHeight?: number;
|
|
82
|
-
margin?: number | Spacing;
|
|
83
|
-
padding?: number | Spacing;
|
|
84
|
-
flex?: number;
|
|
85
|
-
alignSelf?: AlignSelf;
|
|
86
|
-
}
|
|
87
|
-
interface ContainerLayoutProps extends LayoutProps {
|
|
88
|
-
direction?: FlexDirection;
|
|
89
|
-
justify?: JustifyContent;
|
|
90
|
-
align?: AlignItems;
|
|
91
|
-
gap?: number;
|
|
92
|
-
wrap?: boolean;
|
|
93
|
-
}
|
|
94
|
-
interface ComputedLayout {
|
|
95
|
-
x: number;
|
|
96
|
-
y: number;
|
|
97
|
-
width: number;
|
|
98
|
-
height: number;
|
|
99
|
-
contentX: number;
|
|
100
|
-
contentY: number;
|
|
101
|
-
contentWidth: number;
|
|
102
|
-
contentHeight: number;
|
|
103
|
-
}
|
|
104
|
-
interface LayoutConstraints {
|
|
105
|
-
minWidth: number;
|
|
106
|
-
maxWidth: number;
|
|
107
|
-
minHeight: number;
|
|
108
|
-
maxHeight: number;
|
|
109
|
-
}
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/types/components.d.ts
|
|
112
|
-
type ElementType = "box" | "text" | "image" | "shape" | "stack";
|
|
113
|
-
interface ElementBase {
|
|
114
|
-
type: ElementType;
|
|
115
|
-
}
|
|
116
|
-
interface BoxProps extends ContainerLayoutProps {
|
|
117
|
-
background?: Color;
|
|
118
|
-
border?: Border;
|
|
119
|
-
shadow?: Shadow;
|
|
120
|
-
opacity?: number;
|
|
121
|
-
clip?: boolean;
|
|
122
|
-
children?: Element[];
|
|
123
|
-
}
|
|
124
|
-
interface BoxElement extends ElementBase, BoxProps {
|
|
125
|
-
type: "box";
|
|
126
|
-
}
|
|
127
|
-
interface TextProps extends LayoutProps {
|
|
128
|
-
content: string;
|
|
129
|
-
font?: FontProps;
|
|
130
|
-
color?: Color;
|
|
131
|
-
align?: "left" | "center" | "right";
|
|
132
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
|
133
|
-
lineHeight?: number;
|
|
134
|
-
maxLines?: number;
|
|
135
|
-
ellipsis?: boolean;
|
|
136
|
-
wrap?: boolean;
|
|
137
|
-
shadow?: Shadow;
|
|
138
|
-
stroke?: StrokeProps;
|
|
139
|
-
}
|
|
140
|
-
interface TextElement extends ElementBase, TextProps {
|
|
141
|
-
type: "text";
|
|
142
|
-
}
|
|
143
|
-
interface ImageProps extends LayoutProps {
|
|
144
|
-
src: string | ImageBitmap | CanvasImageSource;
|
|
145
|
-
fit?: "contain" | "cover" | "fill" | "none" | "scale-down";
|
|
146
|
-
position?: {
|
|
147
|
-
x?: "left" | "center" | "right" | number;
|
|
148
|
-
y?: "top" | "center" | "bottom" | number;
|
|
149
|
-
};
|
|
150
|
-
border?: Border;
|
|
151
|
-
shadow?: Shadow;
|
|
152
|
-
opacity?: number;
|
|
153
|
-
}
|
|
154
|
-
interface ImageElement extends ElementBase, ImageProps {
|
|
155
|
-
type: "image";
|
|
156
|
-
}
|
|
157
|
-
type ShapeType = "rect" | "circle" | "ellipse" | "line" | "polygon" | "path";
|
|
158
|
-
interface ShapeProps extends LayoutProps {
|
|
159
|
-
shape: ShapeType;
|
|
160
|
-
fill?: Color;
|
|
161
|
-
stroke?: StrokeProps;
|
|
162
|
-
shadow?: Shadow;
|
|
163
|
-
points?: [number, number][];
|
|
164
|
-
path?: string;
|
|
165
|
-
}
|
|
166
|
-
interface ShapeElement extends ElementBase, ShapeProps {
|
|
167
|
-
type: "shape";
|
|
168
|
-
}
|
|
169
|
-
interface StackProps extends ContainerLayoutProps {
|
|
170
|
-
children: Element[];
|
|
171
|
-
background?: Color;
|
|
172
|
-
border?: Border;
|
|
173
|
-
shadow?: Shadow;
|
|
174
|
-
opacity?: number;
|
|
175
|
-
clip?: boolean;
|
|
176
|
-
}
|
|
177
|
-
interface StackElement extends ElementBase, StackProps {
|
|
178
|
-
type: "stack";
|
|
179
|
-
}
|
|
180
|
-
type Element = BoxElement | TextElement | ImageElement | ShapeElement | StackElement;
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/layout/measure.d.ts
|
|
183
|
-
interface MeasureContext {
|
|
184
|
-
measureText(text: string, font: FontProps): {
|
|
185
|
-
width: number;
|
|
186
|
-
height: number;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
declare function createCanvasMeasureContext(ctx: CanvasRenderingContext2D): MeasureContext;
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/layout/engine.d.ts
|
|
192
|
-
interface LayoutNode {
|
|
193
|
-
element: Element;
|
|
194
|
-
layout: ComputedLayout;
|
|
195
|
-
children: LayoutNode[];
|
|
196
|
-
lines?: string[];
|
|
197
|
-
}
|
|
198
|
-
declare function computeLayout(element: Element, ctx: MeasureContext, constraints: LayoutConstraints, x?: number, y?: number): LayoutNode;
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/canvas.d.ts
|
|
201
|
-
interface CanvasOptions {
|
|
202
|
-
width: number;
|
|
203
|
-
height: number;
|
|
204
|
-
pixelRatio?: number;
|
|
205
|
-
canvas?: {
|
|
206
|
-
getContext(type: "2d"): CanvasRenderingContext2D | null;
|
|
207
|
-
width: number;
|
|
208
|
-
height: number;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
interface LayoutSize {
|
|
212
|
-
width: number;
|
|
213
|
-
height: number;
|
|
214
|
-
}
|
|
215
|
-
interface DrawCallCanvas {
|
|
216
|
-
readonly width: number;
|
|
217
|
-
readonly height: number;
|
|
218
|
-
readonly pixelRatio: number;
|
|
219
|
-
render(element: Element): LayoutNode;
|
|
220
|
-
clear(): void;
|
|
221
|
-
getContext(): CanvasRenderingContext2D;
|
|
222
|
-
toDataURL(type?: string, quality?: number): string;
|
|
223
|
-
toBuffer(type?: "image/png" | "image/jpeg"): Promise<Buffer>;
|
|
224
|
-
}
|
|
225
|
-
declare function createCanvas(options: CanvasOptions): DrawCallCanvas;
|
|
226
|
-
declare function createCanvasAsync(options: Omit<CanvasOptions, "canvas">): Promise<DrawCallCanvas>;
|
|
227
|
-
//#endregion
|
|
1
|
+
import { A as Shadow, C as Bounds, D as GradientDescriptor, E as FontProps, F as radialGradient, M as Spacing, N as StrokeProps, O as LinearGradientDescriptor, P as linearGradient, S as Border, T as ColorStop, _ as AlignSelf, a as LayoutNode, b as JustifyContent, c as createCanvasMeasureContext, d as Element, f as StackElement, g as AlignItems, h as TextProps, i as createCanvas, j as Size, k as RadialGradientDescriptor, l as BoxElement, m as TextElement, n as DrawCallCanvas, o as computeLayout, p as StackProps, r as LayoutSize, s as MeasureContext, t as CanvasOptions, u as BoxProps, v as ContainerLayoutProps, w as Color, x as LayoutProps, y as FlexDirection } from "./canvas-BYrCq8eS.mjs";
|
|
2
|
+
|
|
228
3
|
//#region src/components/Box.d.ts
|
|
229
4
|
declare function Box(props: BoxProps): BoxElement;
|
|
230
5
|
//#endregion
|
|
@@ -234,4 +9,4 @@ declare function Stack(props: StackProps): StackElement;
|
|
|
234
9
|
//#region src/components/Text.d.ts
|
|
235
10
|
declare function Text(props: TextProps): TextElement;
|
|
236
11
|
//#endregion
|
|
237
|
-
export { type AlignItems, type AlignSelf, type Border, type Bounds, Box, type BoxElement, type BoxProps, type CanvasOptions, type Color, type ColorStop, type ContainerLayoutProps, type DrawCallCanvas, type Element, type FlexDirection, type FontProps, type GradientDescriptor, type JustifyContent, type LayoutNode, type LayoutProps, type LayoutSize, type LinearGradientDescriptor, type MeasureContext, type RadialGradientDescriptor, type Shadow, type Size, type Spacing, Stack, type StackElement, type StackProps, type StrokeProps, Text, type TextElement, type TextProps, computeLayout, createCanvas,
|
|
12
|
+
export { type AlignItems, type AlignSelf, type Border, type Bounds, Box, type BoxElement, type BoxProps, type CanvasOptions, type Color, type ColorStop, type ContainerLayoutProps, type DrawCallCanvas, type Element, type FlexDirection, type FontProps, type GradientDescriptor, type JustifyContent, type LayoutNode, type LayoutProps, type LayoutSize, type LinearGradientDescriptor, type MeasureContext, type RadialGradientDescriptor, type Shadow, type Size, type Spacing, Stack, type StackElement, type StackProps, type StrokeProps, Text, type TextElement, type TextProps, computeLayout, createCanvas, createCanvasMeasureContext, linearGradient, radialGradient };
|