@umituz/web-canvas 1.0.0

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.
Files changed (55) hide show
  1. package/dist/CanvasConfig-pzoE0RHD.d.mts +310 -0
  2. package/dist/CanvasConfig-pzoE0RHD.d.ts +310 -0
  3. package/dist/application/index.d.mts +78 -0
  4. package/dist/application/index.d.ts +78 -0
  5. package/dist/application/index.js +1083 -0
  6. package/dist/application/index.mjs +11 -0
  7. package/dist/chunk-BN7JTXL7.mjs +346 -0
  8. package/dist/chunk-MC6PNV2F.mjs +34 -0
  9. package/dist/chunk-SF6WND7M.mjs +547 -0
  10. package/dist/chunk-TZGTTYTZ.mjs +0 -0
  11. package/dist/chunk-WMKPCJFI.mjs +661 -0
  12. package/dist/chunk-Z6IB4BQV.mjs +31 -0
  13. package/dist/domain/config/index.d.mts +87 -0
  14. package/dist/domain/config/index.d.ts +87 -0
  15. package/dist/domain/config/index.js +92 -0
  16. package/dist/domain/config/index.mjs +15 -0
  17. package/dist/domain/index.d.mts +79 -0
  18. package/dist/domain/index.d.ts +79 -0
  19. package/dist/domain/index.js +137 -0
  20. package/dist/domain/index.mjs +55 -0
  21. package/dist/index.d.mts +6 -0
  22. package/dist/index.d.ts +6 -0
  23. package/dist/index.js +1633 -0
  24. package/dist/index.mjs +38 -0
  25. package/dist/infrastructure/index.d.mts +174 -0
  26. package/dist/infrastructure/index.d.ts +174 -0
  27. package/dist/infrastructure/index.js +714 -0
  28. package/dist/infrastructure/index.mjs +13 -0
  29. package/dist/presentation/index.d.mts +108 -0
  30. package/dist/presentation/index.d.ts +108 -0
  31. package/dist/presentation/index.js +1617 -0
  32. package/dist/presentation/index.mjs +14 -0
  33. package/package.json +86 -0
  34. package/src/application/index.ts +7 -0
  35. package/src/application/services/ReportService.ts +200 -0
  36. package/src/application/services/ScreenshotStudioService.ts +243 -0
  37. package/src/domain/config/CanvasConfig.ts +36 -0
  38. package/src/domain/config/DeviceConfig.ts +47 -0
  39. package/src/domain/config/ScreenshotStudioConfig.ts +82 -0
  40. package/src/domain/config/index.ts +8 -0
  41. package/src/domain/index.ts +7 -0
  42. package/src/domain/types/canvas.types.ts +85 -0
  43. package/src/domain/types/index.ts +8 -0
  44. package/src/domain/types/report.types.ts +83 -0
  45. package/src/domain/types/screenshot.types.ts +238 -0
  46. package/src/index.ts +102 -0
  47. package/src/infrastructure/index.ts +9 -0
  48. package/src/infrastructure/renderers/CanvasRenderer.ts +287 -0
  49. package/src/infrastructure/renderers/PatternRenderer.ts +160 -0
  50. package/src/infrastructure/renderers/ScreenshotRenderer.ts +331 -0
  51. package/src/infrastructure/services/DeviceConfigService.ts +144 -0
  52. package/src/presentation/hooks/useCanvasExport.ts +162 -0
  53. package/src/presentation/hooks/useReportExport.ts +161 -0
  54. package/src/presentation/hooks/useScreenshotStudio.ts +480 -0
  55. package/src/presentation/index.ts +8 -0
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Screenshot Studio Configuration
3
+ * Complete screenshot studio configuration
4
+ */
5
+
6
+ import type { CanvasConfig } from './CanvasConfig';
7
+ import type { DeviceConfigOption } from './DeviceConfig';
8
+ import type { ScreenshotFormat, Language } from '../types/screenshot.types';
9
+
10
+ /**
11
+ * Export configuration
12
+ */
13
+ export interface ExportConfig {
14
+ /** Include ASO metadata in export */
15
+ includeMetadata?: boolean;
16
+ /** ZIP filename template */
17
+ zipFilename?: string;
18
+ /** Folder structure */
19
+ folderStructure?: 'flat' | 'by-language' | 'by-device';
20
+ /** Default export format */
21
+ defaultFormat?: ScreenshotFormat;
22
+ }
23
+
24
+ /**
25
+ * AI configuration
26
+ */
27
+ export interface AIConfig {
28
+ /** Enable AI features */
29
+ enabled?: boolean;
30
+ /** AI provider */
31
+ provider?: 'gemini' | 'openai' | 'anthropic';
32
+ /** API key (if needed) */
33
+ apiKey?: string;
34
+ }
35
+
36
+ /**
37
+ * Screenshot studio configuration
38
+ */
39
+ export interface ScreenshotStudioConfig {
40
+ /** Canvas configuration */
41
+ canvas?: CanvasConfig;
42
+ /** Device configuration */
43
+ device?: DeviceConfigOption;
44
+ /** Export configuration */
45
+ export?: ExportConfig;
46
+ /** AI configuration */
47
+ ai?: AIConfig;
48
+ /** Supported languages */
49
+ languages?: Language[];
50
+ /** Default language */
51
+ defaultLanguage?: Language;
52
+ }
53
+
54
+ /**
55
+ * Default screenshot studio configuration
56
+ */
57
+ export const DEFAULT_SCREENSHOT_STUDIO_CONFIG: ScreenshotStudioConfig = {
58
+ canvas: {
59
+ defaultFormat: 'png' as any,
60
+ defaultQuality: 0.9,
61
+ scale: 2,
62
+ useCORS: true,
63
+ },
64
+ device: {
65
+ devices: ['iphone-15-pro' as any],
66
+ defaultDevice: 'iphone-15-pro' as any,
67
+ showFrame: true,
68
+ frameColor: '#1f2937',
69
+ frameThickness: 8,
70
+ },
71
+ export: {
72
+ includeMetadata: true,
73
+ folderStructure: 'by-language',
74
+ defaultFormat: 'png' as any,
75
+ },
76
+ ai: {
77
+ enabled: true,
78
+ provider: 'gemini',
79
+ },
80
+ languages: ['en-US', 'tr-TR', 'de-DE', 'fr-FR', 'es-ES', 'ja-JP'],
81
+ defaultLanguage: 'en-US',
82
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Domain Config Index
3
+ * Export all configuration interfaces and defaults
4
+ */
5
+
6
+ export * from './CanvasConfig';
7
+ export * from './DeviceConfig';
8
+ export * from './ScreenshotStudioConfig';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Domain Layer Index
3
+ * Export all domain types and configurations
4
+ */
5
+
6
+ export * from './types';
7
+ export * from './config';
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Canvas Types
3
+ * Core canvas operation types
4
+ */
5
+
6
+ /**
7
+ * Canvas format options
8
+ */
9
+ export type CanvasFormat = 'png' | 'jpeg' | 'webp';
10
+
11
+ /**
12
+ * Canvas render quality
13
+ */
14
+ export type CanvasQuality = number; // 0.0 to 1.0
15
+
16
+ /**
17
+ * Canvas dimensions
18
+ */
19
+ export interface CanvasDimensions {
20
+ width: number;
21
+ height: number;
22
+ }
23
+
24
+ /**
25
+ * Canvas position
26
+ */
27
+ export interface CanvasPosition {
28
+ x: number;
29
+ y: number;
30
+ }
31
+
32
+ /**
33
+ * Canvas rectangle
34
+ */
35
+ export interface CanvasRect extends CanvasPosition, CanvasDimensions {}
36
+
37
+ /**
38
+ * Canvas color
39
+ */
40
+ export type CanvasColor = string;
41
+
42
+ /**
43
+ * Canvas context configuration
44
+ */
45
+ export interface CanvasContextConfig {
46
+ fillStyle?: CanvasColor;
47
+ strokeStyle?: CanvasColor;
48
+ lineWidth?: number;
49
+ lineCap?: 'butt' | 'round' | 'square';
50
+ lineJoin?: 'round' | 'bevel' | 'miter';
51
+ globalAlpha?: number;
52
+ font?: string;
53
+ textAlign?: CanvasTextAlign;
54
+ textBaseline?: CanvasTextBaseline;
55
+ }
56
+
57
+ /**
58
+ * Canvas export options
59
+ */
60
+ export interface CanvasExportOptions {
61
+ format?: CanvasFormat;
62
+ quality?: CanvasQuality;
63
+ scale?: number;
64
+ backgroundColor?: string;
65
+ useCORS?: boolean;
66
+ }
67
+
68
+ /**
69
+ * Canvas result
70
+ */
71
+ export interface CanvasResult {
72
+ blob: Blob;
73
+ url: string;
74
+ dimensions: CanvasDimensions;
75
+ format: CanvasFormat;
76
+ size: number;
77
+ }
78
+
79
+ /**
80
+ * Canvas operation callback
81
+ */
82
+ export type CanvasOperation<T> = (
83
+ ctx: CanvasRenderingContext2D,
84
+ dimensions: CanvasDimensions
85
+ ) => T;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Domain Types Index
3
+ * Export all domain types
4
+ */
5
+
6
+ export * from './canvas.types';
7
+ export * from './screenshot.types';
8
+ export * from './report.types';
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Report Types
3
+ * PDF export and report generation types
4
+ */
5
+
6
+ /**
7
+ * Report item type
8
+ */
9
+ export type ReportItemType = 'app' | 'campaign' | 'post';
10
+
11
+ /**
12
+ * Report item
13
+ */
14
+ export interface ReportItem {
15
+ name: string;
16
+ type: ReportItemType;
17
+ metrics: Record<string, number | string>;
18
+ details: Record<string, string | number | boolean | null | undefined>;
19
+ }
20
+
21
+ /**
22
+ * Report summary
23
+ */
24
+ export interface ReportSummary {
25
+ totalReach: number;
26
+ totalEngagement: number;
27
+ averageScore: number;
28
+ }
29
+
30
+ /**
31
+ * Report data
32
+ */
33
+ export interface ReportData {
34
+ title: string;
35
+ dateRange: string;
36
+ items: ReportItem[];
37
+ summary: ReportSummary;
38
+ }
39
+
40
+ /**
41
+ * Export format
42
+ */
43
+ export type ExportFormat = 'pdf' | 'excel' | 'csv';
44
+
45
+ /**
46
+ * PDF export options
47
+ */
48
+ export interface PDFExportOptions {
49
+ filename?: string;
50
+ scale?: number;
51
+ useCORS?: boolean;
52
+ backgroundColor?: string;
53
+ format?: 'a4' | 'letter' | 'legal';
54
+ }
55
+
56
+ /**
57
+ * Excel export options
58
+ */
59
+ export interface ExcelExportOptions {
60
+ filename?: string;
61
+ sheetName?: string;
62
+ includeSummary?: boolean;
63
+ }
64
+
65
+ /**
66
+ * CSV export options
67
+ */
68
+ export interface CSVExportOptions {
69
+ filename?: string;
70
+ delimiter?: ',' | ';';
71
+ includeHeaders?: boolean;
72
+ }
73
+
74
+ /**
75
+ * Report export result
76
+ */
77
+ export interface ReportExportResult {
78
+ format: ExportFormat;
79
+ filename: string;
80
+ size: number;
81
+ url: string;
82
+ timestamp: Date;
83
+ }
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Screenshot Types
3
+ * Screenshot generation and device frame types
4
+ */
5
+
6
+ /**
7
+ * Device type
8
+ */
9
+ export type DeviceType =
10
+ | 'iphone-15-pro'
11
+ | 'iphone-15'
12
+ | 'iphone-se'
13
+ | 'ipad-pro'
14
+ | 'ipad'
15
+ | 'android-phone'
16
+ | 'android-tablet'
17
+ | 'desktop';
18
+
19
+ /**
20
+ * Device type enum (for backward compatibility)
21
+ */
22
+ export const DeviceTypeEnum = {
23
+ IPHONE_15_PRO: 'iphone-15-pro',
24
+ IPHONE_15: 'iphone-15',
25
+ IPHONE_SE: 'iphone-se',
26
+ IPAD_PRO: 'ipad-pro',
27
+ IPAD: 'ipad',
28
+ ANDROID_PHONE: 'android-phone',
29
+ ANDROID_TABLET: 'android-tablet',
30
+ DESKTOP: 'desktop',
31
+ } as const;
32
+
33
+ /**
34
+ * Frame style options
35
+ */
36
+ export type FrameStyle = 'realistic' | 'minimal' | 'none';
37
+
38
+ /**
39
+ * Frame style enum (for backward compatibility)
40
+ */
41
+ export const FrameStyleEnum = {
42
+ REALISTIC: 'realistic',
43
+ MINIMAL: 'minimal',
44
+ NONE: 'none',
45
+ } as const;
46
+
47
+ /**
48
+ * Layout style options
49
+ */
50
+ export type LayoutStyle = 'text-top' | 'text-bottom' | 'text-overlay';
51
+
52
+ /**
53
+ * Layout style enum (for backward compatibility)
54
+ */
55
+ export const LayoutStyleEnum = {
56
+ TEXT_TOP: 'text-top',
57
+ TEXT_BOTTOM: 'text-bottom',
58
+ TEXT_OVERLAY: 'text-overlay',
59
+ } as const;
60
+
61
+ /**
62
+ * Background pattern options
63
+ */
64
+ export type BackgroundPattern =
65
+ | 'none'
66
+ | 'dots'
67
+ | 'grid'
68
+ | 'lines'
69
+ | 'waves'
70
+ | 'checkers';
71
+
72
+ /**
73
+ * Background pattern enum (for backward compatibility)
74
+ */
75
+ export const BackgroundPatternEnum = {
76
+ NONE: 'none',
77
+ DOTS: 'dots',
78
+ GRID: 'grid',
79
+ LINES: 'lines',
80
+ WAVES: 'waves',
81
+ CHECKERS: 'checkers',
82
+ } as const;
83
+
84
+ /**
85
+ * Screenshot format
86
+ */
87
+ export type ScreenshotFormat = 'png' | 'jpeg' | 'webp';
88
+
89
+ /**
90
+ * Screenshot format enum (for backward compatibility)
91
+ */
92
+ export const ScreenshotFormatEnum = {
93
+ PNG: 'png',
94
+ JPEG: 'jpeg',
95
+ WEBP: 'webp',
96
+ } as const;
97
+
98
+ /**
99
+ * Language code
100
+ */
101
+ export type Language = string;
102
+
103
+ /**
104
+ * Device dimensions
105
+ */
106
+ export interface DeviceDimensions {
107
+ width: number;
108
+ height: number;
109
+ scale?: number;
110
+ }
111
+
112
+ /**
113
+ * Device configuration
114
+ */
115
+ export interface DeviceConfig {
116
+ type: DeviceType;
117
+ name: string;
118
+ dimensions: DeviceDimensions;
119
+ isPhone?: boolean;
120
+ isTablet?: boolean;
121
+ hasNotch?: boolean;
122
+ cornerRadius?: number;
123
+ frameThickness?: number;
124
+ }
125
+
126
+ /**
127
+ * Screenshot content
128
+ */
129
+ export interface ScreenshotContent {
130
+ id: string;
131
+ title: string;
132
+ subtitle: string;
133
+ screenshot: string | null;
134
+ translations: Record<Language, { title: string; subtitle: string }>;
135
+ imageFit?: 'cover' | 'contain' | 'fill';
136
+ imageZoom?: number;
137
+ imageAnchorX?: number;
138
+ imageAnchorY?: number;
139
+ }
140
+
141
+ /**
142
+ * Screenshot design
143
+ */
144
+ export interface ScreenshotDesign {
145
+ backgroundColor: string;
146
+ backgroundGradientEnd?: string | null;
147
+ backgroundImage?: string | null;
148
+ backgroundBlur?: number;
149
+ backgroundOverlayOpacity?: number;
150
+ backgroundPattern?: BackgroundPattern;
151
+ textColor: string;
152
+ highlightColor: string;
153
+ textAlign: 'left' | 'center' | 'right';
154
+ deviceColor: string;
155
+ deviceType: DeviceType;
156
+ frameStyle: FrameStyle;
157
+ layout: LayoutStyle;
158
+ scale: number;
159
+ fontFamily: string;
160
+ titleFontSize: number;
161
+ subtitleFontSize: number;
162
+ titleFontWeight: string;
163
+ subtitleFontWeight: string;
164
+ textCase?: 'uppercase' | 'lowercase' | 'none';
165
+ lineHeight?: number;
166
+ letterSpacing?: number;
167
+ rotation?: number;
168
+ rotationX?: number;
169
+ rotationY?: number;
170
+ rotationZ?: number;
171
+ offsetY?: number;
172
+ shadowIntensity?: number;
173
+ padding?: number;
174
+ gap?: number;
175
+ isPanoramic?: boolean;
176
+ }
177
+
178
+ /**
179
+ * Screenshot metadata
180
+ */
181
+ export interface ScreenshotMetadata {
182
+ id: string;
183
+ deviceType: DeviceType;
184
+ dimensions: DeviceDimensions;
185
+ format: ScreenshotFormat;
186
+ timestamp: Date;
187
+ fileSize: number;
188
+ url: string;
189
+ }
190
+
191
+ /**
192
+ * Screenshot generation options
193
+ */
194
+ export interface ScreenshotGenerationOptions {
195
+ deviceType: DeviceType;
196
+ format?: ScreenshotFormat;
197
+ quality?: number;
198
+ customDimensions?: DeviceDimensions;
199
+ }
200
+
201
+ /**
202
+ * Screenshot template
203
+ */
204
+ export interface ScreenshotTemplate {
205
+ id: string;
206
+ name: string;
207
+ description: string;
208
+ design: Partial<ScreenshotDesign>;
209
+ thumbnail?: string;
210
+ }
211
+
212
+ /**
213
+ * App Store metadata
214
+ */
215
+ export interface AppStoreMetadata {
216
+ appName: string;
217
+ subtitle: string;
218
+ promotionalText: string;
219
+ keywords: string;
220
+ description: string;
221
+ whatsNew: string;
222
+ }
223
+
224
+ /**
225
+ * Screenshot project
226
+ */
227
+ export interface ScreenshotProject {
228
+ id: string;
229
+ name: string;
230
+ design: ScreenshotDesign;
231
+ screens: ScreenshotContent[];
232
+ currentLanguage: Language;
233
+ selectedScreenId: string;
234
+ appMetadata: AppStoreMetadata;
235
+ appIcon: string | null;
236
+ createdAt: Date;
237
+ updatedAt: Date;
238
+ }
package/src/index.ts ADDED
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @umituz/web-canvas
3
+ * Comprehensive canvas and screenshot generation library
4
+ */
5
+
6
+ // Domain exports
7
+ export type {
8
+ // Canvas types
9
+ CanvasFormat,
10
+ CanvasQuality,
11
+ CanvasDimensions,
12
+ CanvasPosition,
13
+ CanvasRect,
14
+ CanvasColor,
15
+ CanvasContextConfig,
16
+ CanvasExportOptions,
17
+ CanvasResult,
18
+ CanvasOperation,
19
+
20
+ // Screenshot types
21
+ DeviceType,
22
+ FrameStyle,
23
+ LayoutStyle,
24
+ BackgroundPattern,
25
+ ScreenshotFormat,
26
+ Language,
27
+ DeviceDimensions,
28
+ DeviceConfig,
29
+ ScreenshotContent,
30
+ ScreenshotDesign,
31
+ ScreenshotMetadata,
32
+ ScreenshotGenerationOptions,
33
+ ScreenshotTemplate,
34
+ AppStoreMetadata,
35
+ ScreenshotProject,
36
+
37
+ // Report types
38
+ ReportItemType,
39
+ ReportItem,
40
+ ReportSummary,
41
+ ReportData,
42
+ ExportFormat,
43
+ PDFExportOptions,
44
+ ExcelExportOptions,
45
+ CSVExportOptions,
46
+ ReportExportResult,
47
+ } from './domain/types';
48
+
49
+ export type {
50
+ CanvasConfig,
51
+ DeviceConfigOption,
52
+ ScreenshotStudioConfig,
53
+ ExportConfig,
54
+ AIConfig,
55
+ } from './domain/config';
56
+
57
+ export {
58
+ DEFAULT_CANVAS_CONFIG,
59
+ } from './domain/config/CanvasConfig';
60
+
61
+ export {
62
+ DEFAULT_DEVICE_CONFIG,
63
+ DEVICE_DIMENSIONS,
64
+ } from './domain/config/DeviceConfig';
65
+
66
+ export {
67
+ DEFAULT_SCREENSHOT_STUDIO_CONFIG,
68
+ } from './domain/config/ScreenshotStudioConfig';
69
+
70
+ // Infrastructure exports
71
+ export { CanvasRenderer } from './infrastructure/renderers/CanvasRenderer';
72
+ export { PatternRenderer } from './infrastructure/renderers/PatternRenderer';
73
+ export {
74
+ ScreenshotRenderer,
75
+ } from './infrastructure/renderers/ScreenshotRenderer';
76
+ export {
77
+ DeviceConfigService,
78
+ } from './infrastructure/services/DeviceConfigService';
79
+
80
+ // Application exports
81
+ export {
82
+ ScreenshotStudioService,
83
+ } from './application/services/ScreenshotStudioService';
84
+ export { ReportService } from './application/services/ReportService';
85
+
86
+ // Presentation exports
87
+ export {
88
+ useScreenshotStudio,
89
+ type UseScreenshotStudioOptions,
90
+ type UseScreenshotStudioReturn,
91
+ } from './presentation/hooks/useScreenshotStudio';
92
+
93
+ export {
94
+ useCanvasExport,
95
+ type UseCanvasExportOptions,
96
+ type UseCanvasExportReturn,
97
+ } from './presentation/hooks/useCanvasExport';
98
+
99
+ export {
100
+ useReportExport,
101
+ type UseReportExportReturn,
102
+ } from './presentation/hooks/useReportExport';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Infrastructure Layer Index
3
+ * Export all infrastructure services and renderers
4
+ */
5
+
6
+ export * from './services/DeviceConfigService';
7
+ export * from './renderers/CanvasRenderer';
8
+ export * from './renderers/PatternRenderer';
9
+ export * from './renderers/ScreenshotRenderer';