@umituz/web-canvas 1.2.1 → 1.2.2
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/package.json +1 -1
- package/src/application/index.ts +0 -4
- package/src/application/services/ReportService.ts +0 -22
- package/src/application/services/ScreenshotStudioService.ts +1 -35
- package/src/domain/config/CanvasConfig.ts +0 -16
- package/src/domain/config/DeviceConfig.ts +0 -18
- package/src/domain/config/ScreenshotStudioConfig.ts +0 -29
- package/src/domain/config/index.ts +0 -4
- package/src/domain/index.ts +0 -4
- package/src/domain/types/canvas.types.ts +1 -35
- package/src/domain/types/index.ts +0 -4
- package/src/domain/types/report.types.ts +0 -31
- package/src/domain/types/screenshot.types.ts +1 -65
- package/src/index.ts +0 -12
- package/src/infrastructure/index.ts +0 -4
- package/src/infrastructure/renderers/CanvasRenderer.ts +0 -55
- package/src/infrastructure/renderers/PatternRenderer.ts +0 -30
- package/src/infrastructure/renderers/ScreenshotRenderer.ts +0 -48
- package/src/infrastructure/services/DeviceConfigService.ts +0 -10
- package/src/infrastructure/services/minimalXlsx.ts +0 -11
- package/src/presentation/hooks/useCanvasExport.ts +2 -22
- package/src/presentation/hooks/useReportExport.ts +0 -12
- package/src/presentation/hooks/useScreenshotStudio.ts +1 -45
- package/src/presentation/index.ts +0 -4
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useScreenshotStudio Hook
|
|
3
|
-
* React hook for screenshot studio functionality
|
|
4
|
-
*/
|
|
5
1
|
|
|
6
2
|
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
7
3
|
import type {
|
|
@@ -20,19 +16,12 @@ import type { ScreenshotStudioConfig } from '../../domain/config/ScreenshotStudi
|
|
|
20
16
|
import { DEFAULT_SCREENSHOT_STUDIO_CONFIG } from '../../domain/config/ScreenshotStudioConfig';
|
|
21
17
|
import { ScreenshotStudioService } from '../../application/services/ScreenshotStudioService';
|
|
22
18
|
|
|
23
|
-
/**
|
|
24
|
-
* useScreenshotStudio hook options
|
|
25
|
-
*/
|
|
26
19
|
export interface UseScreenshotStudioOptions {
|
|
27
20
|
config?: Partial<ScreenshotStudioConfig>;
|
|
28
21
|
onShowToast?: (title: string, description?: string) => void;
|
|
29
22
|
}
|
|
30
23
|
|
|
31
|
-
/**
|
|
32
|
-
* useScreenshotStudio hook return
|
|
33
|
-
*/
|
|
34
24
|
export interface UseScreenshotStudioReturn {
|
|
35
|
-
// State
|
|
36
25
|
screens: ScreenshotContent[];
|
|
37
26
|
design: ScreenshotDesign;
|
|
38
27
|
currentLanguage: Language;
|
|
@@ -44,33 +33,26 @@ export interface UseScreenshotStudioReturn {
|
|
|
44
33
|
appIcon: string | null;
|
|
45
34
|
projectId: string | null;
|
|
46
35
|
|
|
47
|
-
// Design management
|
|
48
36
|
updateDesign: (updates: Partial<ScreenshotDesign>) => void;
|
|
49
37
|
updateActiveScreen: (updates: Partial<ScreenshotContent>) => void;
|
|
50
38
|
setSelectedScreenId: (screenId: string) => void;
|
|
51
39
|
|
|
52
|
-
// Language management
|
|
53
40
|
changeLanguage: (newLanguage: Language) => void;
|
|
54
41
|
|
|
55
|
-
// Screen management
|
|
56
42
|
addScreen: () => void;
|
|
57
43
|
removeScreen: (screenId: string) => void;
|
|
58
44
|
duplicateScreen: (screenId: string) => void;
|
|
59
45
|
|
|
60
|
-
// Template management
|
|
61
46
|
applyTemplate: (template: ScreenshotTemplate) => void;
|
|
62
47
|
|
|
63
|
-
// Generation
|
|
64
48
|
generateDesignedScreenshot: (
|
|
65
49
|
screenId: string
|
|
66
50
|
) => Promise<{ url: string; id: string } | undefined>;
|
|
67
51
|
|
|
68
|
-
// Export
|
|
69
52
|
exportAllScreensAsZip: (
|
|
70
53
|
format?: ScreenshotFormat
|
|
71
54
|
) => Promise<void>;
|
|
72
55
|
|
|
73
|
-
// AI features (if available)
|
|
74
56
|
handleAIMagic?: (screenId: string) => Promise<void>;
|
|
75
57
|
handleTranslate?: (
|
|
76
58
|
screenId: string,
|
|
@@ -78,7 +60,6 @@ export interface UseScreenshotStudioReturn {
|
|
|
78
60
|
) => Promise<void>;
|
|
79
61
|
handleGenerateMetadata?: () => Promise<void>;
|
|
80
62
|
|
|
81
|
-
// Project management
|
|
82
63
|
setAppMetadata: (metadata: AppStoreMetadata) => void;
|
|
83
64
|
setAppIcon: (icon: string | null) => void;
|
|
84
65
|
setProjectId: (id: string | null) => void;
|
|
@@ -86,9 +67,6 @@ export interface UseScreenshotStudioReturn {
|
|
|
86
67
|
_loadProjectState: (state: Partial<ScreenshotProject>) => void;
|
|
87
68
|
}
|
|
88
69
|
|
|
89
|
-
/**
|
|
90
|
-
* Default screens
|
|
91
|
-
*/
|
|
92
70
|
const DEFAULT_SCREENS: ScreenshotContent[] = [
|
|
93
71
|
{
|
|
94
72
|
id: '1',
|
|
@@ -132,9 +110,6 @@ const DEFAULT_SCREENS: ScreenshotContent[] = [
|
|
|
132
110
|
},
|
|
133
111
|
];
|
|
134
112
|
|
|
135
|
-
/**
|
|
136
|
-
* Default design
|
|
137
|
-
*/
|
|
138
113
|
const DEFAULT_DESIGN: ScreenshotDesign = {
|
|
139
114
|
backgroundColor: '#6366f1',
|
|
140
115
|
backgroundGradientEnd: '#a855f7',
|
|
@@ -169,9 +144,6 @@ const DEFAULT_DESIGN: ScreenshotDesign = {
|
|
|
169
144
|
isPanoramic: false,
|
|
170
145
|
};
|
|
171
146
|
|
|
172
|
-
/**
|
|
173
|
-
* Default app metadata
|
|
174
|
-
*/
|
|
175
147
|
const DEFAULT_APP_METADATA: AppStoreMetadata = {
|
|
176
148
|
appName: 'Growdo',
|
|
177
149
|
subtitle: 'AI Content Generator',
|
|
@@ -182,9 +154,6 @@ const DEFAULT_APP_METADATA: AppStoreMetadata = {
|
|
|
182
154
|
whatsNew: 'New Design Studio integration!',
|
|
183
155
|
};
|
|
184
156
|
|
|
185
|
-
/**
|
|
186
|
-
* useScreenshotStudio hook
|
|
187
|
-
*/
|
|
188
157
|
export function useScreenshotStudio(
|
|
189
158
|
options: UseScreenshotStudioOptions = {}
|
|
190
159
|
): UseScreenshotStudioReturn {
|
|
@@ -200,21 +169,10 @@ export function useScreenshotStudio(
|
|
|
200
169
|
|
|
201
170
|
const serviceRef = useRef<ScreenshotStudioService | null>(null);
|
|
202
171
|
|
|
203
|
-
// Initialize service once
|
|
204
172
|
if (!serviceRef.current) {
|
|
205
173
|
serviceRef.current = new ScreenshotStudioService(fullConfig);
|
|
206
174
|
}
|
|
207
175
|
|
|
208
|
-
// Cleanup on unmount
|
|
209
|
-
useEffect(() => {
|
|
210
|
-
return () => {
|
|
211
|
-
// Clean up service resources if needed
|
|
212
|
-
if (serviceRef.current) {
|
|
213
|
-
// Any cleanup logic can go here
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
}, []);
|
|
217
|
-
|
|
218
176
|
const [screens, setScreens] = useState<ScreenshotContent[]>(DEFAULT_SCREENS);
|
|
219
177
|
const [design, setDesign] = useState<ScreenshotDesign>(DEFAULT_DESIGN);
|
|
220
178
|
const [currentLanguage, setCurrentLanguage] = useState<Language>(
|
|
@@ -414,13 +372,11 @@ export function useScreenshotStudio(
|
|
|
414
372
|
} finally {
|
|
415
373
|
setIsProcessing(false);
|
|
416
374
|
|
|
417
|
-
// Clean up object URL after a delay
|
|
418
375
|
if (url) {
|
|
419
376
|
setTimeout(() => {
|
|
420
377
|
try {
|
|
421
378
|
URL.revokeObjectURL(url!);
|
|
422
|
-
} catch
|
|
423
|
-
// Ignore cleanup errors
|
|
379
|
+
} catch {
|
|
424
380
|
}
|
|
425
381
|
}, 100);
|
|
426
382
|
}
|