@umituz/web-canvas 1.0.7 → 1.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/README.md +33 -0
- package/dist/CanvasConfig-HFgH7irb.d.mts +310 -0
- package/dist/CanvasConfig-HFgH7irb.d.ts +310 -0
- package/dist/application/index.d.mts +78 -0
- package/dist/application/index.d.ts +78 -0
- package/dist/application/index.js +1146 -0
- package/dist/application/index.mjs +11 -0
- package/dist/chunk-DNKRSL6D.mjs +358 -0
- package/dist/chunk-MC6PNV2F.mjs +34 -0
- package/dist/chunk-TZGTTYTZ.mjs +0 -0
- package/dist/chunk-UOGTEMIJ.mjs +712 -0
- package/dist/chunk-YKXOSUMF.mjs +781 -0
- package/dist/chunk-Z6IB4BQV.mjs +31 -0
- package/dist/domain/config/index.d.mts +87 -0
- package/dist/domain/config/index.d.ts +87 -0
- package/dist/domain/config/index.js +92 -0
- package/dist/domain/config/index.mjs +15 -0
- package/dist/domain/index.d.mts +45 -0
- package/dist/domain/index.d.ts +45 -0
- package/dist/domain/index.js +137 -0
- package/dist/domain/index.mjs +55 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1931 -0
- package/dist/index.mjs +40 -0
- package/dist/infrastructure/index.d.mts +198 -0
- package/dist/infrastructure/index.d.ts +198 -0
- package/dist/infrastructure/index.js +765 -0
- package/dist/infrastructure/index.mjs +13 -0
- package/dist/presentation/index.d.mts +145 -0
- package/dist/presentation/index.d.ts +145 -0
- package/dist/presentation/index.js +1915 -0
- package/dist/presentation/index.mjs +16 -0
- package/dist/report.types-DWDnprBx.d.mts +76 -0
- package/dist/report.types-DWDnprBx.d.ts +76 -0
- package/package.json +9 -3
- package/src/domain/types/freehand.types.ts +42 -0
- package/src/domain/types/index.ts +1 -0
- package/src/index.ts +10 -0
- package/src/presentation/hooks/useFreehandCanvas.ts +250 -0
- package/src/presentation/index.ts +1 -0
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Comprehensive canvas and screenshot generation library with device frames, patte
|
|
|
9
9
|
- PDF export functionality
|
|
10
10
|
- Pattern generation
|
|
11
11
|
- HTML2Canvas integration
|
|
12
|
+
- Freehand drawing (`useFreehandCanvas`): mouse, touch and stylus with pressure
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
14
15
|
|
|
@@ -27,6 +28,38 @@ const screenshot = await generateScreenshot({
|
|
|
27
28
|
});
|
|
28
29
|
```
|
|
29
30
|
|
|
31
|
+
### Freehand drawing
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { useFreehandCanvas } from '@umituz/web-canvas/hooks';
|
|
35
|
+
|
|
36
|
+
function SignaturePad() {
|
|
37
|
+
const { canvasRef, undo, clear, isEmpty, strokeCount } = useFreehandCanvas({
|
|
38
|
+
brushSize: 3,
|
|
39
|
+
color: '#1a1a1a',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
<canvas ref={canvasRef} style={{ width: 400, height: 200 }} />
|
|
45
|
+
<button onClick={undo} disabled={strokeCount === 0}>Undo</button>
|
|
46
|
+
<button onClick={clear} disabled={isEmpty}>Clear</button>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The hook attaches pointer-event drawing to the canvas, sizes the backing
|
|
53
|
+
store to the CSS box at device-pixel resolution (redrawing on resize),
|
|
54
|
+
replays strokes from captured points so `undo`/`clear` are lossless, and
|
|
55
|
+
modulates line width with stylus pressure when the pointer reports it.
|
|
56
|
+
`touch-action: none` is applied automatically so drawing works on touch
|
|
57
|
+
screens. Layer the canvas over your own guide content (e.g. a faint glyph
|
|
58
|
+
to trace) for handwriting practice UIs.
|
|
59
|
+
|
|
60
|
+
Combine with `useCanvasExport` from the same package to download the
|
|
61
|
+
drawing as PNG/JPEG/WebP.
|
|
62
|
+
|
|
30
63
|
## License
|
|
31
64
|
|
|
32
65
|
MIT
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screenshot Types
|
|
3
|
+
* Screenshot generation and device frame types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Device type
|
|
7
|
+
*/
|
|
8
|
+
type DeviceType = 'iphone-15-pro' | 'iphone-15' | 'iphone-se' | 'ipad-pro' | 'ipad' | 'android-phone' | 'android-tablet' | 'desktop';
|
|
9
|
+
/**
|
|
10
|
+
* Device type enum (for backward compatibility)
|
|
11
|
+
*/
|
|
12
|
+
declare const DeviceTypeEnum: {
|
|
13
|
+
readonly IPHONE_15_PRO: "iphone-15-pro";
|
|
14
|
+
readonly IPHONE_15: "iphone-15";
|
|
15
|
+
readonly IPHONE_SE: "iphone-se";
|
|
16
|
+
readonly IPAD_PRO: "ipad-pro";
|
|
17
|
+
readonly IPAD: "ipad";
|
|
18
|
+
readonly ANDROID_PHONE: "android-phone";
|
|
19
|
+
readonly ANDROID_TABLET: "android-tablet";
|
|
20
|
+
readonly DESKTOP: "desktop";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Frame style options
|
|
24
|
+
*/
|
|
25
|
+
type FrameStyle = 'realistic' | 'minimal' | 'none';
|
|
26
|
+
/**
|
|
27
|
+
* Frame style enum (for backward compatibility)
|
|
28
|
+
*/
|
|
29
|
+
declare const FrameStyleEnum: {
|
|
30
|
+
readonly REALISTIC: "realistic";
|
|
31
|
+
readonly MINIMAL: "minimal";
|
|
32
|
+
readonly NONE: "none";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Layout style options
|
|
36
|
+
*/
|
|
37
|
+
type LayoutStyle = 'text-top' | 'text-bottom' | 'text-overlay';
|
|
38
|
+
/**
|
|
39
|
+
* Layout style enum (for backward compatibility)
|
|
40
|
+
*/
|
|
41
|
+
declare const LayoutStyleEnum: {
|
|
42
|
+
readonly TEXT_TOP: "text-top";
|
|
43
|
+
readonly TEXT_BOTTOM: "text-bottom";
|
|
44
|
+
readonly TEXT_OVERLAY: "text-overlay";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Background pattern options
|
|
48
|
+
*/
|
|
49
|
+
type BackgroundPattern = 'none' | 'dots' | 'grid' | 'lines' | 'waves' | 'checkers';
|
|
50
|
+
/**
|
|
51
|
+
* Background pattern enum (for backward compatibility)
|
|
52
|
+
*/
|
|
53
|
+
declare const BackgroundPatternEnum: {
|
|
54
|
+
readonly NONE: "none";
|
|
55
|
+
readonly DOTS: "dots";
|
|
56
|
+
readonly GRID: "grid";
|
|
57
|
+
readonly LINES: "lines";
|
|
58
|
+
readonly WAVES: "waves";
|
|
59
|
+
readonly CHECKERS: "checkers";
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Screenshot format
|
|
63
|
+
*/
|
|
64
|
+
type ScreenshotFormat = 'png' | 'jpeg' | 'webp';
|
|
65
|
+
/**
|
|
66
|
+
* Screenshot format enum (for backward compatibility)
|
|
67
|
+
*/
|
|
68
|
+
declare const ScreenshotFormatEnum: {
|
|
69
|
+
readonly PNG: "png";
|
|
70
|
+
readonly JPEG: "jpeg";
|
|
71
|
+
readonly WEBP: "webp";
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Language code
|
|
75
|
+
*/
|
|
76
|
+
type Language = string;
|
|
77
|
+
/**
|
|
78
|
+
* Device dimensions
|
|
79
|
+
*/
|
|
80
|
+
interface DeviceDimensions {
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
scale?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Device configuration
|
|
87
|
+
*/
|
|
88
|
+
interface DeviceConfig {
|
|
89
|
+
type: DeviceType;
|
|
90
|
+
name: string;
|
|
91
|
+
dimensions: DeviceDimensions;
|
|
92
|
+
isPhone?: boolean;
|
|
93
|
+
isTablet?: boolean;
|
|
94
|
+
hasNotch?: boolean;
|
|
95
|
+
cornerRadius?: number;
|
|
96
|
+
frameThickness?: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Screenshot content
|
|
100
|
+
*/
|
|
101
|
+
interface ScreenshotContent {
|
|
102
|
+
id: string;
|
|
103
|
+
title: string;
|
|
104
|
+
subtitle: string;
|
|
105
|
+
screenshot: string | null;
|
|
106
|
+
translations: Record<Language, {
|
|
107
|
+
title: string;
|
|
108
|
+
subtitle: string;
|
|
109
|
+
}>;
|
|
110
|
+
imageFit?: 'cover' | 'contain' | 'fill';
|
|
111
|
+
imageZoom?: number;
|
|
112
|
+
imageAnchorX?: number;
|
|
113
|
+
imageAnchorY?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Screenshot design
|
|
117
|
+
*/
|
|
118
|
+
interface ScreenshotDesign {
|
|
119
|
+
backgroundColor: string;
|
|
120
|
+
backgroundGradientEnd?: string | null;
|
|
121
|
+
backgroundImage?: string | null;
|
|
122
|
+
backgroundBlur?: number;
|
|
123
|
+
backgroundOverlayOpacity?: number;
|
|
124
|
+
backgroundPattern?: BackgroundPattern;
|
|
125
|
+
textColor: string;
|
|
126
|
+
highlightColor: string;
|
|
127
|
+
textAlign: 'left' | 'center' | 'right';
|
|
128
|
+
deviceColor: string;
|
|
129
|
+
deviceType: DeviceType;
|
|
130
|
+
frameStyle: FrameStyle;
|
|
131
|
+
layout: LayoutStyle;
|
|
132
|
+
scale: number;
|
|
133
|
+
fontFamily: string;
|
|
134
|
+
titleFontSize: number;
|
|
135
|
+
subtitleFontSize: number;
|
|
136
|
+
titleFontWeight: string;
|
|
137
|
+
subtitleFontWeight: string;
|
|
138
|
+
textCase?: 'uppercase' | 'lowercase' | 'none';
|
|
139
|
+
lineHeight?: number;
|
|
140
|
+
letterSpacing?: number;
|
|
141
|
+
rotation?: number;
|
|
142
|
+
rotationX?: number;
|
|
143
|
+
rotationY?: number;
|
|
144
|
+
rotationZ?: number;
|
|
145
|
+
offsetY?: number;
|
|
146
|
+
shadowIntensity?: number;
|
|
147
|
+
padding?: number;
|
|
148
|
+
gap?: number;
|
|
149
|
+
isPanoramic?: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Screenshot metadata
|
|
153
|
+
*/
|
|
154
|
+
interface ScreenshotMetadata {
|
|
155
|
+
id: string;
|
|
156
|
+
deviceType: DeviceType;
|
|
157
|
+
dimensions: DeviceDimensions;
|
|
158
|
+
format: ScreenshotFormat;
|
|
159
|
+
timestamp: Date;
|
|
160
|
+
fileSize: number;
|
|
161
|
+
url: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Screenshot generation options
|
|
165
|
+
*/
|
|
166
|
+
interface ScreenshotGenerationOptions {
|
|
167
|
+
deviceType: DeviceType;
|
|
168
|
+
format?: ScreenshotFormat;
|
|
169
|
+
quality?: number;
|
|
170
|
+
customDimensions?: DeviceDimensions;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Screenshot template
|
|
174
|
+
*/
|
|
175
|
+
interface ScreenshotTemplate {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
description: string;
|
|
179
|
+
design: Partial<ScreenshotDesign>;
|
|
180
|
+
thumbnail?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* App Store metadata
|
|
184
|
+
*/
|
|
185
|
+
interface AppStoreMetadata {
|
|
186
|
+
appName: string;
|
|
187
|
+
subtitle: string;
|
|
188
|
+
promotionalText: string;
|
|
189
|
+
keywords: string;
|
|
190
|
+
description: string;
|
|
191
|
+
whatsNew: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Screenshot project
|
|
195
|
+
*/
|
|
196
|
+
interface ScreenshotProject {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
design: ScreenshotDesign;
|
|
200
|
+
screens: ScreenshotContent[];
|
|
201
|
+
currentLanguage: Language;
|
|
202
|
+
selectedScreenId: string;
|
|
203
|
+
appMetadata: AppStoreMetadata;
|
|
204
|
+
appIcon: string | null;
|
|
205
|
+
createdAt: Date;
|
|
206
|
+
updatedAt: Date;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Canvas Types
|
|
211
|
+
* Core canvas operation types
|
|
212
|
+
*/
|
|
213
|
+
/**
|
|
214
|
+
* Canvas format options
|
|
215
|
+
*/
|
|
216
|
+
type CanvasFormat = 'png' | 'jpeg' | 'webp';
|
|
217
|
+
/**
|
|
218
|
+
* Canvas render quality
|
|
219
|
+
*/
|
|
220
|
+
type CanvasQuality = number;
|
|
221
|
+
/**
|
|
222
|
+
* Canvas dimensions
|
|
223
|
+
*/
|
|
224
|
+
interface CanvasDimensions {
|
|
225
|
+
width: number;
|
|
226
|
+
height: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Canvas position
|
|
230
|
+
*/
|
|
231
|
+
interface CanvasPosition {
|
|
232
|
+
x: number;
|
|
233
|
+
y: number;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Canvas rectangle
|
|
237
|
+
*/
|
|
238
|
+
interface CanvasRect extends CanvasPosition, CanvasDimensions {
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Canvas color
|
|
242
|
+
*/
|
|
243
|
+
type CanvasColor = string;
|
|
244
|
+
/**
|
|
245
|
+
* Canvas context configuration
|
|
246
|
+
*/
|
|
247
|
+
interface CanvasContextConfig {
|
|
248
|
+
fillStyle?: CanvasColor;
|
|
249
|
+
strokeStyle?: CanvasColor;
|
|
250
|
+
lineWidth?: number;
|
|
251
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
252
|
+
lineJoin?: 'round' | 'bevel' | 'miter';
|
|
253
|
+
globalAlpha?: number;
|
|
254
|
+
font?: string;
|
|
255
|
+
textAlign?: CanvasTextAlign;
|
|
256
|
+
textBaseline?: CanvasTextBaseline;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Canvas export options
|
|
260
|
+
*/
|
|
261
|
+
interface CanvasExportOptions {
|
|
262
|
+
format?: CanvasFormat;
|
|
263
|
+
quality?: CanvasQuality;
|
|
264
|
+
scale?: number;
|
|
265
|
+
backgroundColor?: string;
|
|
266
|
+
useCORS?: boolean;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Canvas result
|
|
270
|
+
*/
|
|
271
|
+
interface CanvasResult {
|
|
272
|
+
blob: Blob;
|
|
273
|
+
url: string;
|
|
274
|
+
dimensions: CanvasDimensions;
|
|
275
|
+
format: CanvasFormat;
|
|
276
|
+
size: number;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Canvas operation callback
|
|
280
|
+
*/
|
|
281
|
+
type CanvasOperation<T> = (ctx: CanvasRenderingContext2D, dimensions: CanvasDimensions) => T;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Canvas Configuration
|
|
285
|
+
* Canvas operation configuration
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Canvas configuration
|
|
290
|
+
*/
|
|
291
|
+
interface CanvasConfig {
|
|
292
|
+
/** Default export format */
|
|
293
|
+
defaultFormat?: CanvasFormat;
|
|
294
|
+
/** Default quality (0.0 - 1.0) */
|
|
295
|
+
defaultQuality?: CanvasQuality;
|
|
296
|
+
/** Maximum dimension (width or height) */
|
|
297
|
+
maxDimension?: number;
|
|
298
|
+
/** Scale factor for high-resolution exports */
|
|
299
|
+
scale?: number;
|
|
300
|
+
/** Default background color */
|
|
301
|
+
backgroundColor?: string;
|
|
302
|
+
/** Enable CORS for cross-origin images */
|
|
303
|
+
useCORS?: boolean;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Default canvas configuration
|
|
307
|
+
*/
|
|
308
|
+
declare const DEFAULT_CANVAS_CONFIG: CanvasConfig;
|
|
309
|
+
|
|
310
|
+
export { type AppStoreMetadata as A, type BackgroundPattern as B, type CanvasColor as C, DEFAULT_CANVAS_CONFIG as D, type FrameStyle as F, type Language as L, type ScreenshotContent as S, type CanvasConfig as a, type CanvasContextConfig as b, type CanvasDimensions as c, type CanvasExportOptions as d, type CanvasFormat as e, type CanvasOperation as f, type CanvasPosition as g, type CanvasQuality as h, type CanvasRect as i, type CanvasResult as j, type DeviceConfig as k, type DeviceDimensions as l, type DeviceType as m, type LayoutStyle as n, type ScreenshotDesign as o, type ScreenshotFormat as p, type ScreenshotGenerationOptions as q, type ScreenshotMetadata as r, type ScreenshotProject as s, type ScreenshotTemplate as t, BackgroundPatternEnum as u, DeviceTypeEnum as v, FrameStyleEnum as w, LayoutStyleEnum as x, ScreenshotFormatEnum as y };
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screenshot Types
|
|
3
|
+
* Screenshot generation and device frame types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Device type
|
|
7
|
+
*/
|
|
8
|
+
type DeviceType = 'iphone-15-pro' | 'iphone-15' | 'iphone-se' | 'ipad-pro' | 'ipad' | 'android-phone' | 'android-tablet' | 'desktop';
|
|
9
|
+
/**
|
|
10
|
+
* Device type enum (for backward compatibility)
|
|
11
|
+
*/
|
|
12
|
+
declare const DeviceTypeEnum: {
|
|
13
|
+
readonly IPHONE_15_PRO: "iphone-15-pro";
|
|
14
|
+
readonly IPHONE_15: "iphone-15";
|
|
15
|
+
readonly IPHONE_SE: "iphone-se";
|
|
16
|
+
readonly IPAD_PRO: "ipad-pro";
|
|
17
|
+
readonly IPAD: "ipad";
|
|
18
|
+
readonly ANDROID_PHONE: "android-phone";
|
|
19
|
+
readonly ANDROID_TABLET: "android-tablet";
|
|
20
|
+
readonly DESKTOP: "desktop";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Frame style options
|
|
24
|
+
*/
|
|
25
|
+
type FrameStyle = 'realistic' | 'minimal' | 'none';
|
|
26
|
+
/**
|
|
27
|
+
* Frame style enum (for backward compatibility)
|
|
28
|
+
*/
|
|
29
|
+
declare const FrameStyleEnum: {
|
|
30
|
+
readonly REALISTIC: "realistic";
|
|
31
|
+
readonly MINIMAL: "minimal";
|
|
32
|
+
readonly NONE: "none";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Layout style options
|
|
36
|
+
*/
|
|
37
|
+
type LayoutStyle = 'text-top' | 'text-bottom' | 'text-overlay';
|
|
38
|
+
/**
|
|
39
|
+
* Layout style enum (for backward compatibility)
|
|
40
|
+
*/
|
|
41
|
+
declare const LayoutStyleEnum: {
|
|
42
|
+
readonly TEXT_TOP: "text-top";
|
|
43
|
+
readonly TEXT_BOTTOM: "text-bottom";
|
|
44
|
+
readonly TEXT_OVERLAY: "text-overlay";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Background pattern options
|
|
48
|
+
*/
|
|
49
|
+
type BackgroundPattern = 'none' | 'dots' | 'grid' | 'lines' | 'waves' | 'checkers';
|
|
50
|
+
/**
|
|
51
|
+
* Background pattern enum (for backward compatibility)
|
|
52
|
+
*/
|
|
53
|
+
declare const BackgroundPatternEnum: {
|
|
54
|
+
readonly NONE: "none";
|
|
55
|
+
readonly DOTS: "dots";
|
|
56
|
+
readonly GRID: "grid";
|
|
57
|
+
readonly LINES: "lines";
|
|
58
|
+
readonly WAVES: "waves";
|
|
59
|
+
readonly CHECKERS: "checkers";
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Screenshot format
|
|
63
|
+
*/
|
|
64
|
+
type ScreenshotFormat = 'png' | 'jpeg' | 'webp';
|
|
65
|
+
/**
|
|
66
|
+
* Screenshot format enum (for backward compatibility)
|
|
67
|
+
*/
|
|
68
|
+
declare const ScreenshotFormatEnum: {
|
|
69
|
+
readonly PNG: "png";
|
|
70
|
+
readonly JPEG: "jpeg";
|
|
71
|
+
readonly WEBP: "webp";
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Language code
|
|
75
|
+
*/
|
|
76
|
+
type Language = string;
|
|
77
|
+
/**
|
|
78
|
+
* Device dimensions
|
|
79
|
+
*/
|
|
80
|
+
interface DeviceDimensions {
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
scale?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Device configuration
|
|
87
|
+
*/
|
|
88
|
+
interface DeviceConfig {
|
|
89
|
+
type: DeviceType;
|
|
90
|
+
name: string;
|
|
91
|
+
dimensions: DeviceDimensions;
|
|
92
|
+
isPhone?: boolean;
|
|
93
|
+
isTablet?: boolean;
|
|
94
|
+
hasNotch?: boolean;
|
|
95
|
+
cornerRadius?: number;
|
|
96
|
+
frameThickness?: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Screenshot content
|
|
100
|
+
*/
|
|
101
|
+
interface ScreenshotContent {
|
|
102
|
+
id: string;
|
|
103
|
+
title: string;
|
|
104
|
+
subtitle: string;
|
|
105
|
+
screenshot: string | null;
|
|
106
|
+
translations: Record<Language, {
|
|
107
|
+
title: string;
|
|
108
|
+
subtitle: string;
|
|
109
|
+
}>;
|
|
110
|
+
imageFit?: 'cover' | 'contain' | 'fill';
|
|
111
|
+
imageZoom?: number;
|
|
112
|
+
imageAnchorX?: number;
|
|
113
|
+
imageAnchorY?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Screenshot design
|
|
117
|
+
*/
|
|
118
|
+
interface ScreenshotDesign {
|
|
119
|
+
backgroundColor: string;
|
|
120
|
+
backgroundGradientEnd?: string | null;
|
|
121
|
+
backgroundImage?: string | null;
|
|
122
|
+
backgroundBlur?: number;
|
|
123
|
+
backgroundOverlayOpacity?: number;
|
|
124
|
+
backgroundPattern?: BackgroundPattern;
|
|
125
|
+
textColor: string;
|
|
126
|
+
highlightColor: string;
|
|
127
|
+
textAlign: 'left' | 'center' | 'right';
|
|
128
|
+
deviceColor: string;
|
|
129
|
+
deviceType: DeviceType;
|
|
130
|
+
frameStyle: FrameStyle;
|
|
131
|
+
layout: LayoutStyle;
|
|
132
|
+
scale: number;
|
|
133
|
+
fontFamily: string;
|
|
134
|
+
titleFontSize: number;
|
|
135
|
+
subtitleFontSize: number;
|
|
136
|
+
titleFontWeight: string;
|
|
137
|
+
subtitleFontWeight: string;
|
|
138
|
+
textCase?: 'uppercase' | 'lowercase' | 'none';
|
|
139
|
+
lineHeight?: number;
|
|
140
|
+
letterSpacing?: number;
|
|
141
|
+
rotation?: number;
|
|
142
|
+
rotationX?: number;
|
|
143
|
+
rotationY?: number;
|
|
144
|
+
rotationZ?: number;
|
|
145
|
+
offsetY?: number;
|
|
146
|
+
shadowIntensity?: number;
|
|
147
|
+
padding?: number;
|
|
148
|
+
gap?: number;
|
|
149
|
+
isPanoramic?: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Screenshot metadata
|
|
153
|
+
*/
|
|
154
|
+
interface ScreenshotMetadata {
|
|
155
|
+
id: string;
|
|
156
|
+
deviceType: DeviceType;
|
|
157
|
+
dimensions: DeviceDimensions;
|
|
158
|
+
format: ScreenshotFormat;
|
|
159
|
+
timestamp: Date;
|
|
160
|
+
fileSize: number;
|
|
161
|
+
url: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Screenshot generation options
|
|
165
|
+
*/
|
|
166
|
+
interface ScreenshotGenerationOptions {
|
|
167
|
+
deviceType: DeviceType;
|
|
168
|
+
format?: ScreenshotFormat;
|
|
169
|
+
quality?: number;
|
|
170
|
+
customDimensions?: DeviceDimensions;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Screenshot template
|
|
174
|
+
*/
|
|
175
|
+
interface ScreenshotTemplate {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
description: string;
|
|
179
|
+
design: Partial<ScreenshotDesign>;
|
|
180
|
+
thumbnail?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* App Store metadata
|
|
184
|
+
*/
|
|
185
|
+
interface AppStoreMetadata {
|
|
186
|
+
appName: string;
|
|
187
|
+
subtitle: string;
|
|
188
|
+
promotionalText: string;
|
|
189
|
+
keywords: string;
|
|
190
|
+
description: string;
|
|
191
|
+
whatsNew: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Screenshot project
|
|
195
|
+
*/
|
|
196
|
+
interface ScreenshotProject {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
design: ScreenshotDesign;
|
|
200
|
+
screens: ScreenshotContent[];
|
|
201
|
+
currentLanguage: Language;
|
|
202
|
+
selectedScreenId: string;
|
|
203
|
+
appMetadata: AppStoreMetadata;
|
|
204
|
+
appIcon: string | null;
|
|
205
|
+
createdAt: Date;
|
|
206
|
+
updatedAt: Date;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Canvas Types
|
|
211
|
+
* Core canvas operation types
|
|
212
|
+
*/
|
|
213
|
+
/**
|
|
214
|
+
* Canvas format options
|
|
215
|
+
*/
|
|
216
|
+
type CanvasFormat = 'png' | 'jpeg' | 'webp';
|
|
217
|
+
/**
|
|
218
|
+
* Canvas render quality
|
|
219
|
+
*/
|
|
220
|
+
type CanvasQuality = number;
|
|
221
|
+
/**
|
|
222
|
+
* Canvas dimensions
|
|
223
|
+
*/
|
|
224
|
+
interface CanvasDimensions {
|
|
225
|
+
width: number;
|
|
226
|
+
height: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Canvas position
|
|
230
|
+
*/
|
|
231
|
+
interface CanvasPosition {
|
|
232
|
+
x: number;
|
|
233
|
+
y: number;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Canvas rectangle
|
|
237
|
+
*/
|
|
238
|
+
interface CanvasRect extends CanvasPosition, CanvasDimensions {
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Canvas color
|
|
242
|
+
*/
|
|
243
|
+
type CanvasColor = string;
|
|
244
|
+
/**
|
|
245
|
+
* Canvas context configuration
|
|
246
|
+
*/
|
|
247
|
+
interface CanvasContextConfig {
|
|
248
|
+
fillStyle?: CanvasColor;
|
|
249
|
+
strokeStyle?: CanvasColor;
|
|
250
|
+
lineWidth?: number;
|
|
251
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
252
|
+
lineJoin?: 'round' | 'bevel' | 'miter';
|
|
253
|
+
globalAlpha?: number;
|
|
254
|
+
font?: string;
|
|
255
|
+
textAlign?: CanvasTextAlign;
|
|
256
|
+
textBaseline?: CanvasTextBaseline;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Canvas export options
|
|
260
|
+
*/
|
|
261
|
+
interface CanvasExportOptions {
|
|
262
|
+
format?: CanvasFormat;
|
|
263
|
+
quality?: CanvasQuality;
|
|
264
|
+
scale?: number;
|
|
265
|
+
backgroundColor?: string;
|
|
266
|
+
useCORS?: boolean;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Canvas result
|
|
270
|
+
*/
|
|
271
|
+
interface CanvasResult {
|
|
272
|
+
blob: Blob;
|
|
273
|
+
url: string;
|
|
274
|
+
dimensions: CanvasDimensions;
|
|
275
|
+
format: CanvasFormat;
|
|
276
|
+
size: number;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Canvas operation callback
|
|
280
|
+
*/
|
|
281
|
+
type CanvasOperation<T> = (ctx: CanvasRenderingContext2D, dimensions: CanvasDimensions) => T;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Canvas Configuration
|
|
285
|
+
* Canvas operation configuration
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Canvas configuration
|
|
290
|
+
*/
|
|
291
|
+
interface CanvasConfig {
|
|
292
|
+
/** Default export format */
|
|
293
|
+
defaultFormat?: CanvasFormat;
|
|
294
|
+
/** Default quality (0.0 - 1.0) */
|
|
295
|
+
defaultQuality?: CanvasQuality;
|
|
296
|
+
/** Maximum dimension (width or height) */
|
|
297
|
+
maxDimension?: number;
|
|
298
|
+
/** Scale factor for high-resolution exports */
|
|
299
|
+
scale?: number;
|
|
300
|
+
/** Default background color */
|
|
301
|
+
backgroundColor?: string;
|
|
302
|
+
/** Enable CORS for cross-origin images */
|
|
303
|
+
useCORS?: boolean;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Default canvas configuration
|
|
307
|
+
*/
|
|
308
|
+
declare const DEFAULT_CANVAS_CONFIG: CanvasConfig;
|
|
309
|
+
|
|
310
|
+
export { type AppStoreMetadata as A, type BackgroundPattern as B, type CanvasColor as C, DEFAULT_CANVAS_CONFIG as D, type FrameStyle as F, type Language as L, type ScreenshotContent as S, type CanvasConfig as a, type CanvasContextConfig as b, type CanvasDimensions as c, type CanvasExportOptions as d, type CanvasFormat as e, type CanvasOperation as f, type CanvasPosition as g, type CanvasQuality as h, type CanvasRect as i, type CanvasResult as j, type DeviceConfig as k, type DeviceDimensions as l, type DeviceType as m, type LayoutStyle as n, type ScreenshotDesign as o, type ScreenshotFormat as p, type ScreenshotGenerationOptions as q, type ScreenshotMetadata as r, type ScreenshotProject as s, type ScreenshotTemplate as t, BackgroundPatternEnum as u, DeviceTypeEnum as v, FrameStyleEnum as w, LayoutStyleEnum as x, ScreenshotFormatEnum as y };
|