@umituz/web-canvas 1.0.6 → 1.1.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 (41) hide show
  1. package/README.md +33 -0
  2. package/dist/CanvasConfig-HFgH7irb.d.mts +310 -0
  3. package/dist/CanvasConfig-HFgH7irb.d.ts +310 -0
  4. package/dist/application/index.d.mts +78 -0
  5. package/dist/application/index.d.ts +78 -0
  6. package/dist/application/index.js +1146 -0
  7. package/dist/application/index.mjs +11 -0
  8. package/dist/chunk-DNKRSL6D.mjs +358 -0
  9. package/dist/chunk-HJ24NSQA.mjs +777 -0
  10. package/dist/chunk-MC6PNV2F.mjs +34 -0
  11. package/dist/chunk-TZGTTYTZ.mjs +0 -0
  12. package/dist/chunk-UOGTEMIJ.mjs +712 -0
  13. package/dist/chunk-Z6IB4BQV.mjs +31 -0
  14. package/dist/domain/config/index.d.mts +87 -0
  15. package/dist/domain/config/index.d.ts +87 -0
  16. package/dist/domain/config/index.js +92 -0
  17. package/dist/domain/config/index.mjs +15 -0
  18. package/dist/domain/index.d.mts +45 -0
  19. package/dist/domain/index.d.ts +45 -0
  20. package/dist/domain/index.js +137 -0
  21. package/dist/domain/index.mjs +55 -0
  22. package/dist/index.d.mts +7 -0
  23. package/dist/index.d.ts +7 -0
  24. package/dist/index.js +1927 -0
  25. package/dist/index.mjs +40 -0
  26. package/dist/infrastructure/index.d.mts +198 -0
  27. package/dist/infrastructure/index.d.ts +198 -0
  28. package/dist/infrastructure/index.js +765 -0
  29. package/dist/infrastructure/index.mjs +13 -0
  30. package/dist/presentation/index.d.mts +145 -0
  31. package/dist/presentation/index.d.ts +145 -0
  32. package/dist/presentation/index.js +1911 -0
  33. package/dist/presentation/index.mjs +16 -0
  34. package/dist/report.types-DWDnprBx.d.mts +76 -0
  35. package/dist/report.types-DWDnprBx.d.ts +76 -0
  36. package/package.json +8 -2
  37. package/src/domain/types/freehand.types.ts +42 -0
  38. package/src/domain/types/index.ts +1 -0
  39. package/src/index.ts +10 -0
  40. package/src/presentation/hooks/useFreehandCanvas.ts +244 -0
  41. package/src/presentation/index.ts +1 -0
@@ -0,0 +1,13 @@
1
+ import {
2
+ CanvasRenderer,
3
+ DeviceConfigService,
4
+ PatternRenderer,
5
+ ScreenshotRenderer
6
+ } from "../chunk-UOGTEMIJ.mjs";
7
+ import "../chunk-MC6PNV2F.mjs";
8
+ export {
9
+ CanvasRenderer,
10
+ DeviceConfigService,
11
+ PatternRenderer,
12
+ ScreenshotRenderer
13
+ };
@@ -0,0 +1,145 @@
1
+ import { S as ScreenshotContent, o as ScreenshotDesign, L as Language, A as AppStoreMetadata, t as ScreenshotTemplate, p as ScreenshotFormat, s as ScreenshotProject, a as CanvasConfig, d as CanvasExportOptions, j as CanvasResult } from '../CanvasConfig-HFgH7irb.mjs';
2
+ import { ScreenshotStudioConfig } from '../domain/config/index.mjs';
3
+ import { P as PDFExportOptions, R as ReportData, E as ExcelExportOptions } from '../report.types-DWDnprBx.mjs';
4
+ import { FreehandStroke, UseFreehandCanvasOptions } from '../domain/index.mjs';
5
+
6
+ /**
7
+ * useScreenshotStudio Hook
8
+ * React hook for screenshot studio functionality
9
+ */
10
+
11
+ /**
12
+ * useScreenshotStudio hook options
13
+ */
14
+ interface UseScreenshotStudioOptions {
15
+ config?: Partial<ScreenshotStudioConfig>;
16
+ onShowToast?: (title: string, description?: string) => void;
17
+ }
18
+ /**
19
+ * useScreenshotStudio hook return
20
+ */
21
+ interface UseScreenshotStudioReturn {
22
+ screens: ScreenshotContent[];
23
+ design: ScreenshotDesign;
24
+ currentLanguage: Language;
25
+ selectedScreenId: string;
26
+ activeScreen: ScreenshotContent;
27
+ isProcessing: boolean;
28
+ isAnalyzing: boolean;
29
+ appMetadata: AppStoreMetadata;
30
+ appIcon: string | null;
31
+ projectId: string | null;
32
+ updateDesign: (updates: Partial<ScreenshotDesign>) => void;
33
+ updateActiveScreen: (updates: Partial<ScreenshotContent>) => void;
34
+ setSelectedScreenId: (screenId: string) => void;
35
+ changeLanguage: (newLanguage: Language) => void;
36
+ addScreen: () => void;
37
+ removeScreen: (screenId: string) => void;
38
+ duplicateScreen: (screenId: string) => void;
39
+ applyTemplate: (template: ScreenshotTemplate) => void;
40
+ generateDesignedScreenshot: (screenId: string) => Promise<{
41
+ url: string;
42
+ id: string;
43
+ } | undefined>;
44
+ exportAllScreensAsZip: (format?: ScreenshotFormat) => Promise<void>;
45
+ handleAIMagic?: (screenId: string) => Promise<void>;
46
+ handleTranslate?: (screenId: string, targetLang: Language) => Promise<void>;
47
+ handleGenerateMetadata?: () => Promise<void>;
48
+ setAppMetadata: (metadata: AppStoreMetadata) => void;
49
+ setAppIcon: (icon: string | null) => void;
50
+ setProjectId: (id: string | null) => void;
51
+ _getProjectState: () => ScreenshotProject;
52
+ _loadProjectState: (state: Partial<ScreenshotProject>) => void;
53
+ }
54
+ /**
55
+ * useScreenshotStudio hook
56
+ */
57
+ declare function useScreenshotStudio(options?: UseScreenshotStudioOptions): UseScreenshotStudioReturn;
58
+
59
+ /**
60
+ * useCanvasExport Hook
61
+ * React hook for canvas export operations
62
+ */
63
+
64
+ /**
65
+ * useCanvasExport hook options
66
+ */
67
+ interface UseCanvasExportOptions {
68
+ config?: CanvasConfig;
69
+ }
70
+ /**
71
+ * useCanvasExport hook return
72
+ */
73
+ interface UseCanvasExportReturn {
74
+ isExporting: boolean;
75
+ progress: number;
76
+ error: string | null;
77
+ exportToBlob: (canvas: HTMLCanvasElement, options?: CanvasExportOptions) => Promise<CanvasResult | null>;
78
+ exportToDataURL: (canvas: HTMLCanvasElement, format?: string, quality?: number) => string | null;
79
+ downloadCanvas: (canvas: HTMLCanvasElement, filename: string, options?: CanvasExportOptions) => Promise<void>;
80
+ cloneCanvas: (canvas: HTMLCanvasElement) => HTMLCanvasElement | null;
81
+ }
82
+ /**
83
+ * useCanvasExport hook
84
+ */
85
+ declare function useCanvasExport(options?: UseCanvasExportOptions): UseCanvasExportReturn;
86
+
87
+ /**
88
+ * useReportExport Hook
89
+ * React hook for report export operations
90
+ */
91
+
92
+ /**
93
+ * useReportExport hook return
94
+ */
95
+ interface UseReportExportReturn {
96
+ isExporting: boolean;
97
+ error: string | null;
98
+ exportToPDF: (elementId: string, options?: PDFExportOptions) => Promise<void>;
99
+ exportCanvasToPDF: (canvas: HTMLCanvasElement, options?: PDFExportOptions) => Promise<void>;
100
+ exportMultipleToPDF: (elementIds: string[], options?: PDFExportOptions) => Promise<void>;
101
+ exportToExcel: (data: ReportData, options?: ExcelExportOptions) => Promise<void>;
102
+ exportToCSV: (data: ReportData, filename?: string, delimiter?: ',' | ';') => void;
103
+ }
104
+ /**
105
+ * useReportExport hook
106
+ */
107
+ declare function useReportExport(): UseReportExportReturn;
108
+
109
+ /**
110
+ * useFreehandCanvas Hook
111
+ * React hook for pointer-based freehand drawing on a canvas
112
+ */
113
+
114
+ /**
115
+ * Return value of the useFreehandCanvas hook
116
+ */
117
+ interface UseFreehandCanvasReturn {
118
+ /** Ref to attach to the <canvas> element that captures drawing. */
119
+ canvasRef: React.RefObject<HTMLCanvasElement | null>;
120
+ /** Remove the most recent stroke. */
121
+ undo: () => void;
122
+ /** Remove all strokes. */
123
+ clear: () => void;
124
+ /** Number of committed strokes. */
125
+ strokeCount: number;
126
+ /** True when no strokes are committed. */
127
+ isEmpty: boolean;
128
+ /** Snapshot of committed strokes (safe to serialize). */
129
+ getStrokes: () => FreehandStroke[];
130
+ }
131
+ /**
132
+ * useFreehandCanvas hook
133
+ *
134
+ * Attaches pointer-event drawing to a canvas element. The canvas is sized to
135
+ * its CSS box at device-pixel resolution (and re-rendered on resize), strokes
136
+ * are replayed from captured points so undo/clear are lossless, and stylus
137
+ * pressure modulates line width when the pointer reports it.
138
+ *
139
+ * The canvas gets `touch-action: none` applied so drawing works on touch
140
+ * screens without scrolling the page. Consumers typically layer the canvas
141
+ * over their own guide content (e.g. a faint glyph to trace).
142
+ */
143
+ declare function useFreehandCanvas(options?: UseFreehandCanvasOptions): UseFreehandCanvasReturn;
144
+
145
+ export { type UseCanvasExportOptions, type UseCanvasExportReturn, type UseFreehandCanvasReturn, type UseReportExportReturn, type UseScreenshotStudioOptions, type UseScreenshotStudioReturn, useCanvasExport, useFreehandCanvas, useReportExport, useScreenshotStudio };
@@ -0,0 +1,145 @@
1
+ import { S as ScreenshotContent, o as ScreenshotDesign, L as Language, A as AppStoreMetadata, t as ScreenshotTemplate, p as ScreenshotFormat, s as ScreenshotProject, a as CanvasConfig, d as CanvasExportOptions, j as CanvasResult } from '../CanvasConfig-HFgH7irb.js';
2
+ import { ScreenshotStudioConfig } from '../domain/config/index.js';
3
+ import { P as PDFExportOptions, R as ReportData, E as ExcelExportOptions } from '../report.types-DWDnprBx.js';
4
+ import { FreehandStroke, UseFreehandCanvasOptions } from '../domain/index.js';
5
+
6
+ /**
7
+ * useScreenshotStudio Hook
8
+ * React hook for screenshot studio functionality
9
+ */
10
+
11
+ /**
12
+ * useScreenshotStudio hook options
13
+ */
14
+ interface UseScreenshotStudioOptions {
15
+ config?: Partial<ScreenshotStudioConfig>;
16
+ onShowToast?: (title: string, description?: string) => void;
17
+ }
18
+ /**
19
+ * useScreenshotStudio hook return
20
+ */
21
+ interface UseScreenshotStudioReturn {
22
+ screens: ScreenshotContent[];
23
+ design: ScreenshotDesign;
24
+ currentLanguage: Language;
25
+ selectedScreenId: string;
26
+ activeScreen: ScreenshotContent;
27
+ isProcessing: boolean;
28
+ isAnalyzing: boolean;
29
+ appMetadata: AppStoreMetadata;
30
+ appIcon: string | null;
31
+ projectId: string | null;
32
+ updateDesign: (updates: Partial<ScreenshotDesign>) => void;
33
+ updateActiveScreen: (updates: Partial<ScreenshotContent>) => void;
34
+ setSelectedScreenId: (screenId: string) => void;
35
+ changeLanguage: (newLanguage: Language) => void;
36
+ addScreen: () => void;
37
+ removeScreen: (screenId: string) => void;
38
+ duplicateScreen: (screenId: string) => void;
39
+ applyTemplate: (template: ScreenshotTemplate) => void;
40
+ generateDesignedScreenshot: (screenId: string) => Promise<{
41
+ url: string;
42
+ id: string;
43
+ } | undefined>;
44
+ exportAllScreensAsZip: (format?: ScreenshotFormat) => Promise<void>;
45
+ handleAIMagic?: (screenId: string) => Promise<void>;
46
+ handleTranslate?: (screenId: string, targetLang: Language) => Promise<void>;
47
+ handleGenerateMetadata?: () => Promise<void>;
48
+ setAppMetadata: (metadata: AppStoreMetadata) => void;
49
+ setAppIcon: (icon: string | null) => void;
50
+ setProjectId: (id: string | null) => void;
51
+ _getProjectState: () => ScreenshotProject;
52
+ _loadProjectState: (state: Partial<ScreenshotProject>) => void;
53
+ }
54
+ /**
55
+ * useScreenshotStudio hook
56
+ */
57
+ declare function useScreenshotStudio(options?: UseScreenshotStudioOptions): UseScreenshotStudioReturn;
58
+
59
+ /**
60
+ * useCanvasExport Hook
61
+ * React hook for canvas export operations
62
+ */
63
+
64
+ /**
65
+ * useCanvasExport hook options
66
+ */
67
+ interface UseCanvasExportOptions {
68
+ config?: CanvasConfig;
69
+ }
70
+ /**
71
+ * useCanvasExport hook return
72
+ */
73
+ interface UseCanvasExportReturn {
74
+ isExporting: boolean;
75
+ progress: number;
76
+ error: string | null;
77
+ exportToBlob: (canvas: HTMLCanvasElement, options?: CanvasExportOptions) => Promise<CanvasResult | null>;
78
+ exportToDataURL: (canvas: HTMLCanvasElement, format?: string, quality?: number) => string | null;
79
+ downloadCanvas: (canvas: HTMLCanvasElement, filename: string, options?: CanvasExportOptions) => Promise<void>;
80
+ cloneCanvas: (canvas: HTMLCanvasElement) => HTMLCanvasElement | null;
81
+ }
82
+ /**
83
+ * useCanvasExport hook
84
+ */
85
+ declare function useCanvasExport(options?: UseCanvasExportOptions): UseCanvasExportReturn;
86
+
87
+ /**
88
+ * useReportExport Hook
89
+ * React hook for report export operations
90
+ */
91
+
92
+ /**
93
+ * useReportExport hook return
94
+ */
95
+ interface UseReportExportReturn {
96
+ isExporting: boolean;
97
+ error: string | null;
98
+ exportToPDF: (elementId: string, options?: PDFExportOptions) => Promise<void>;
99
+ exportCanvasToPDF: (canvas: HTMLCanvasElement, options?: PDFExportOptions) => Promise<void>;
100
+ exportMultipleToPDF: (elementIds: string[], options?: PDFExportOptions) => Promise<void>;
101
+ exportToExcel: (data: ReportData, options?: ExcelExportOptions) => Promise<void>;
102
+ exportToCSV: (data: ReportData, filename?: string, delimiter?: ',' | ';') => void;
103
+ }
104
+ /**
105
+ * useReportExport hook
106
+ */
107
+ declare function useReportExport(): UseReportExportReturn;
108
+
109
+ /**
110
+ * useFreehandCanvas Hook
111
+ * React hook for pointer-based freehand drawing on a canvas
112
+ */
113
+
114
+ /**
115
+ * Return value of the useFreehandCanvas hook
116
+ */
117
+ interface UseFreehandCanvasReturn {
118
+ /** Ref to attach to the <canvas> element that captures drawing. */
119
+ canvasRef: React.RefObject<HTMLCanvasElement | null>;
120
+ /** Remove the most recent stroke. */
121
+ undo: () => void;
122
+ /** Remove all strokes. */
123
+ clear: () => void;
124
+ /** Number of committed strokes. */
125
+ strokeCount: number;
126
+ /** True when no strokes are committed. */
127
+ isEmpty: boolean;
128
+ /** Snapshot of committed strokes (safe to serialize). */
129
+ getStrokes: () => FreehandStroke[];
130
+ }
131
+ /**
132
+ * useFreehandCanvas hook
133
+ *
134
+ * Attaches pointer-event drawing to a canvas element. The canvas is sized to
135
+ * its CSS box at device-pixel resolution (and re-rendered on resize), strokes
136
+ * are replayed from captured points so undo/clear are lossless, and stylus
137
+ * pressure modulates line width when the pointer reports it.
138
+ *
139
+ * The canvas gets `touch-action: none` applied so drawing works on touch
140
+ * screens without scrolling the page. Consumers typically layer the canvas
141
+ * over their own guide content (e.g. a faint glyph to trace).
142
+ */
143
+ declare function useFreehandCanvas(options?: UseFreehandCanvasOptions): UseFreehandCanvasReturn;
144
+
145
+ export { type UseCanvasExportOptions, type UseCanvasExportReturn, type UseFreehandCanvasReturn, type UseReportExportReturn, type UseScreenshotStudioOptions, type UseScreenshotStudioReturn, useCanvasExport, useFreehandCanvas, useReportExport, useScreenshotStudio };