@yogiswara/honcho-editor-ui 2.7.13 → 2.7.14

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 (139) hide show
  1. package/package.json +1 -1
  2. package/dist/color.d.ts +0 -9
  3. package/dist/color.js +0 -9
  4. package/dist/components/editor/GalleryAlbum/AlbumImageGallery.d.ts +0 -8
  5. package/dist/components/editor/GalleryAlbum/AlbumImageGallery.js +0 -28
  6. package/dist/components/editor/GalleryAlbum/ImageItem.d.ts +0 -10
  7. package/dist/components/editor/GalleryAlbum/ImageItem.js +0 -81
  8. package/dist/components/editor/HAccordionAspectRatio.d.ts +0 -14
  9. package/dist/components/editor/HAccordionAspectRatio.js +0 -102
  10. package/dist/components/editor/HAccordionColor.d.ts +0 -16
  11. package/dist/components/editor/HAccordionColor.js +0 -282
  12. package/dist/components/editor/HAccordionColorAdjustment.d.ts +0 -35
  13. package/dist/components/editor/HAccordionColorAdjustment.js +0 -31
  14. package/dist/components/editor/HAccordionDetails.d.ts +0 -12
  15. package/dist/components/editor/HAccordionDetails.js +0 -157
  16. package/dist/components/editor/HAccordionLight.d.ts +0 -20
  17. package/dist/components/editor/HAccordionLight.js +0 -414
  18. package/dist/components/editor/HAccordionPreset.d.ts +0 -23
  19. package/dist/components/editor/HAccordionPreset.js +0 -50
  20. package/dist/components/editor/HAlertBox.d.ts +0 -8
  21. package/dist/components/editor/HAlertBox.js +0 -55
  22. package/dist/components/editor/HAspectRatioMobile.d.ts +0 -0
  23. package/dist/components/editor/HAspectRatioMobile.js +0 -1
  24. package/dist/components/editor/HBulkAccordionColorAdjustment.d.ts +0 -55
  25. package/dist/components/editor/HBulkAccordionColorAdjustment.js +0 -31
  26. package/dist/components/editor/HBulkAccordionColorAdjustmentColors.d.ts +0 -20
  27. package/dist/components/editor/HBulkAccordionColorAdjustmentColors.js +0 -121
  28. package/dist/components/editor/HBulkAccordionColorAdjustmentDetails.d.ts +0 -12
  29. package/dist/components/editor/HBulkAccordionColorAdjustmentDetails.js +0 -65
  30. package/dist/components/editor/HBulkAccordionColorAdjustmentLight.d.ts +0 -28
  31. package/dist/components/editor/HBulkAccordionColorAdjustmentLight.js +0 -177
  32. package/dist/components/editor/HBulkColorAdjustmentMobile.d.ts +0 -53
  33. package/dist/components/editor/HBulkColorAdjustmentMobile.js +0 -16
  34. package/dist/components/editor/HBulkColorMobile.d.ts +0 -20
  35. package/dist/components/editor/HBulkColorMobile.js +0 -121
  36. package/dist/components/editor/HBulkDetailsMobile.d.ts +0 -12
  37. package/dist/components/editor/HBulkDetailsMobile.js +0 -65
  38. package/dist/components/editor/HBulkLightMobile.d.ts +0 -28
  39. package/dist/components/editor/HBulkLightMobile.js +0 -192
  40. package/dist/components/editor/HBulkPreset.d.ts +0 -24
  41. package/dist/components/editor/HBulkPreset.js +0 -43
  42. package/dist/components/editor/HBulkPresetMobile.d.ts +0 -15
  43. package/dist/components/editor/HBulkPresetMobile.js +0 -26
  44. package/dist/components/editor/HDialogBox.d.ts +0 -18
  45. package/dist/components/editor/HDialogBox.js +0 -51
  46. package/dist/components/editor/HDialogCopy.d.ts +0 -40
  47. package/dist/components/editor/HDialogCopy.js +0 -80
  48. package/dist/components/editor/HFooter.d.ts +0 -12
  49. package/dist/components/editor/HFooter.js +0 -24
  50. package/dist/components/editor/HHeaderEditor.d.ts +0 -17
  51. package/dist/components/editor/HHeaderEditor.js +0 -36
  52. package/dist/components/editor/HImageEditorBulkDekstop.d.ts +0 -15
  53. package/dist/components/editor/HImageEditorBulkDekstop.js +0 -29
  54. package/dist/components/editor/HImageEditorBulkMobile.d.ts +0 -72
  55. package/dist/components/editor/HImageEditorBulkMobile.js +0 -81
  56. package/dist/components/editor/HImageEditorDekstop.d.ts +0 -15
  57. package/dist/components/editor/HImageEditorDekstop.js +0 -29
  58. package/dist/components/editor/HImageEditorMobile.d.ts +0 -51
  59. package/dist/components/editor/HImageEditorMobile.js +0 -92
  60. package/dist/components/editor/HImageEditorMobileLayout.d.ts +0 -14
  61. package/dist/components/editor/HImageEditorMobileLayout.js +0 -58
  62. package/dist/components/editor/HModalEditorDekstop.d.ts +0 -13
  63. package/dist/components/editor/HModalEditorDekstop.js +0 -22
  64. package/dist/components/editor/HModalMobile.d.ts +0 -13
  65. package/dist/components/editor/HModalMobile.js +0 -7
  66. package/dist/components/editor/HPresetDelete.d.ts +0 -7
  67. package/dist/components/editor/HPresetDelete.js +0 -7
  68. package/dist/components/editor/HPresetOptionMenu.d.ts +0 -9
  69. package/dist/components/editor/HPresetOptionMenu.js +0 -20
  70. package/dist/components/editor/HSliderColorMobile.d.ts +0 -16
  71. package/dist/components/editor/HSliderColorMobile.js +0 -270
  72. package/dist/components/editor/HSliderDetailsMobile.d.ts +0 -12
  73. package/dist/components/editor/HSliderDetailsMobile.js +0 -154
  74. package/dist/components/editor/HSliderLightMobile.d.ts +0 -20
  75. package/dist/components/editor/HSliderLightMobile.js +0 -420
  76. package/dist/components/editor/HTabAspectRatioMobile.d.ts +0 -0
  77. package/dist/components/editor/HTabAspectRatioMobile.js +0 -1
  78. package/dist/components/editor/HTabColorAdjustmentMobile.d.ts +0 -33
  79. package/dist/components/editor/HTabColorAdjustmentMobile.js +0 -16
  80. package/dist/components/editor/HTabPresetMobile.d.ts +0 -14
  81. package/dist/components/editor/HTabPresetMobile.js +0 -10
  82. package/dist/components/editor/HTextField.d.ts +0 -14
  83. package/dist/components/editor/HTextField.js +0 -51
  84. package/dist/components/editor/HWatermarkView.d.ts +0 -6
  85. package/dist/components/editor/HWatermarkView.js +0 -16
  86. package/dist/components/editor/svg/Tick.d.ts +0 -2
  87. package/dist/components/editor/svg/Tick.js +0 -6
  88. package/dist/components/modal/HModalDialog.d.ts +0 -12
  89. package/dist/components/modal/HModalDialog.js +0 -18
  90. package/dist/components/modal/HModalRename.d.ts +0 -14
  91. package/dist/components/modal/HModalRename.js +0 -35
  92. package/dist/hooks/demo/HonchoEditorBulkDemo.d.ts +0 -3
  93. package/dist/hooks/demo/HonchoEditorBulkDemo.js +0 -410
  94. package/dist/hooks/demo/HonchoEditorSingleCleanDemo.d.ts +0 -3
  95. package/dist/hooks/demo/HonchoEditorSingleCleanDemo.js +0 -354
  96. package/dist/hooks/demo/index.d.ts +0 -2
  97. package/dist/hooks/demo/index.js +0 -2
  98. package/dist/hooks/editor/type.d.ts +0 -174
  99. package/dist/hooks/editor/type.js +0 -1
  100. package/dist/hooks/editor/useHonchoEditorBulk.d.ts +0 -96
  101. package/dist/hooks/editor/useHonchoEditorBulk.js +0 -427
  102. package/dist/hooks/editor/useHonchoEditorSingle.d.ts +0 -44
  103. package/dist/hooks/editor/useHonchoEditorSingle.js +0 -162
  104. package/dist/hooks/useAdjustmentHistory.d.ts +0 -97
  105. package/dist/hooks/useAdjustmentHistory.js +0 -493
  106. package/dist/hooks/useAdjustmentHistoryBatch.d.ts +0 -177
  107. package/dist/hooks/useAdjustmentHistoryBatch.js +0 -1189
  108. package/dist/hooks/useGallerySwipe.d.ts +0 -36
  109. package/dist/hooks/useGallerySwipe.js +0 -344
  110. package/dist/hooks/usePaging.d.ts +0 -89
  111. package/dist/hooks/usePaging.js +0 -211
  112. package/dist/hooks/usePreset.d.ts +0 -82
  113. package/dist/hooks/usePreset.js +0 -344
  114. package/dist/index.d.ts +0 -41
  115. package/dist/index.js +0 -44
  116. package/dist/lib/context/EditorContext.d.ts +0 -28
  117. package/dist/lib/context/EditorContext.js +0 -60
  118. package/dist/lib/context/EditorProcessingService.d.ts +0 -36
  119. package/dist/lib/context/EditorProcessingService.js +0 -249
  120. package/dist/lib/editor/honcho-editor.d.ts +0 -324
  121. package/dist/lib/editor/honcho-editor.js +0 -825
  122. package/dist/lib/hooks/useEditor.d.ts +0 -22
  123. package/dist/lib/hooks/useEditor.js +0 -35
  124. package/dist/lib/hooks/useEditorHeadless.d.ts +0 -34
  125. package/dist/lib/hooks/useEditorHeadless.js +0 -207
  126. package/dist/lib/hooks/useImageProcessor.d.ts +0 -18
  127. package/dist/lib/hooks/useImageProcessor.js +0 -113
  128. package/dist/setupTests.d.ts +0 -1
  129. package/dist/setupTests.js +0 -1
  130. package/dist/themes/colors.d.ts +0 -12
  131. package/dist/themes/colors.js +0 -12
  132. package/dist/themes/honchoTheme.d.ts +0 -25
  133. package/dist/themes/honchoTheme.js +0 -94
  134. package/dist/utils/adjustment.d.ts +0 -6
  135. package/dist/utils/adjustment.js +0 -48
  136. package/dist/utils/imageLoader.d.ts +0 -11
  137. package/dist/utils/imageLoader.js +0 -48
  138. package/dist/utils/isMobile.d.ts +0 -1
  139. package/dist/utils/isMobile.js +0 -5
@@ -1,22 +0,0 @@
1
- import type { EditorTask, EditorResponse } from '../context/EditorProcessingService';
2
- interface UseEditorOptions {
3
- priority?: number;
4
- }
5
- interface UseEditorResult {
6
- processImage: (task: Omit<EditorTask, 'priority'>) => Promise<EditorResponse>;
7
- isEditorReady: boolean;
8
- editorError: Error | null;
9
- queueStatus: {
10
- queueLength: number;
11
- isProcessing: boolean;
12
- hasProcessor: boolean;
13
- };
14
- }
15
- /**
16
- * Lightweight hook for components to request image processing
17
- * Uses the global editor instance via context
18
- */
19
- export declare const useEditor: (options?: UseEditorOptions) => UseEditorResult;
20
- export declare const useEditorHighPriority: () => UseEditorResult;
21
- export declare const useEditorLowPriority: () => UseEditorResult;
22
- export {};
@@ -1,35 +0,0 @@
1
- 'use client';
2
- import { useCallback } from 'react';
3
- import { useEditorContext } from '../context/EditorContext';
4
- /**
5
- * Lightweight hook for components to request image processing
6
- * Uses the global editor instance via context
7
- */
8
- export const useEditor = (options = {}) => {
9
- const { isReady, error, processingService, queueStatus } = useEditorContext();
10
- const { priority = 0 } = options;
11
- const processImage = useCallback(async (task) => {
12
- if (!isReady) {
13
- throw new Error('Editor not ready');
14
- }
15
- const taskWithPriority = {
16
- ...task,
17
- priority,
18
- };
19
- return processingService.requestProcessing(taskWithPriority);
20
- }, [isReady, processingService, priority]);
21
- return {
22
- processImage,
23
- isEditorReady: isReady,
24
- editorError: error,
25
- queueStatus,
26
- };
27
- };
28
- // Convenience hook for high-priority processing (e.g., visible images)
29
- export const useEditorHighPriority = () => {
30
- return useEditor({ priority: 10 });
31
- };
32
- // Convenience hook for low-priority processing (e.g., off-screen images)
33
- export const useEditorLowPriority = () => {
34
- return useEditor({ priority: 1 });
35
- };
@@ -1,34 +0,0 @@
1
- import type { AdjustmentValues, HonchoEditor } from '../editor/honcho-editor';
2
- declare global {
3
- interface Window {
4
- HonchoEditor: new () => any;
5
- HonchoEditorUtils: {
6
- imageDataToBlob: (imageData: ImageData, format?: string, quality?: number) => Promise<Blob>;
7
- };
8
- }
9
- }
10
- interface EditorTask {
11
- id: string;
12
- path: string;
13
- frame: string | null;
14
- adjustments?: Partial<AdjustmentValues>;
15
- }
16
- interface EditorResponse {
17
- id: string;
18
- path: string;
19
- }
20
- interface UseEditorHeadlessOptions {
21
- scriptUrl?: string;
22
- wasmUrl?: string;
23
- }
24
- export declare function useEditorHeadless(options?: UseEditorHeadlessOptions): {
25
- editor: HonchoEditor | null;
26
- isReady: boolean;
27
- error: Error | null;
28
- processImage: (task: EditorTask) => Promise<EditorResponse>;
29
- loadImageFromUrl: (url: string) => Promise<{
30
- width: number;
31
- height: number;
32
- }>;
33
- };
34
- export {};
@@ -1,207 +0,0 @@
1
- 'use client';
2
- import { useState, useEffect, useRef, useCallback } from 'react';
3
- import { loadImageAsFile } from '../../utils/imageLoader';
4
- export function useEditorHeadless(options = {}) {
5
- const { scriptUrl = '/honcho-photo-editor.js', wasmUrl = '/honcho-photo-editor.wasm' } = options;
6
- const editorRef = useRef(null);
7
- const [isReady, setIsReady] = useState(false);
8
- const [error, setError] = useState(null);
9
- const [isScriptLoaded, setIsScriptLoaded] = useState(false);
10
- // Load script dynamically without component
11
- useEffect(() => {
12
- const loadScripts = async () => {
13
- // Check if HonchoEditor is already available
14
- if (window.HonchoEditor) {
15
- console.debug('HonchoEditor already available globally');
16
- setIsScriptLoaded(true);
17
- return;
18
- }
19
- // Load WASM module first
20
- const loadWasmModule = () => {
21
- return new Promise((resolve, reject) => {
22
- // Check if WASM module is already loaded
23
- if (document.querySelector(`script[src="${scriptUrl}"]`)) {
24
- console.debug('WASM module script already exists');
25
- resolve();
26
- return;
27
- }
28
- console.debug(`Loading WASM module from: ${scriptUrl}`);
29
- const wasmScript = document.createElement('script');
30
- wasmScript.src = scriptUrl;
31
- wasmScript.async = true;
32
- wasmScript.onload = () => {
33
- console.debug('WASM module script loaded');
34
- resolve();
35
- };
36
- wasmScript.onerror = () => {
37
- console.error(`Failed to load WASM module from: ${scriptUrl}`);
38
- reject(new Error('Failed to load WASM module'));
39
- };
40
- document.head.appendChild(wasmScript);
41
- });
42
- };
43
- // Load wrapper script that creates HonchoEditor constructor
44
- const loadWrapperScript = () => {
45
- return new Promise((resolve, reject) => {
46
- const wrapperUrl = '/honcho-editor.js';
47
- // Check if wrapper script is already loaded
48
- if (document.querySelector(`script[src="${wrapperUrl}"]`)) {
49
- console.debug('Wrapper script already exists');
50
- resolve();
51
- return;
52
- }
53
- console.debug(`Loading HonchoEditor wrapper from: ${wrapperUrl}`);
54
- const wrapperScript = document.createElement('script');
55
- wrapperScript.src = wrapperUrl;
56
- wrapperScript.async = true;
57
- wrapperScript.onload = () => {
58
- console.debug('Wrapper script loaded');
59
- resolve();
60
- };
61
- wrapperScript.onerror = () => {
62
- console.error(`Failed to load wrapper script from: ${wrapperUrl}`);
63
- reject(new Error('Failed to load wrapper script'));
64
- };
65
- document.head.appendChild(wrapperScript);
66
- });
67
- };
68
- try {
69
- // Load WASM module first
70
- await loadWasmModule();
71
- // Then load the wrapper that creates the constructor
72
- await loadWrapperScript();
73
- // Wait for HonchoEditor constructor to be available
74
- const waitForConstructor = () => {
75
- return new Promise((resolve, reject) => {
76
- const checkInterval = setInterval(() => {
77
- if (window.HonchoEditor && typeof window.HonchoEditor === 'function') {
78
- console.debug('HonchoEditor constructor now available');
79
- clearInterval(checkInterval);
80
- resolve();
81
- }
82
- }, 100);
83
- // Timeout after 10 seconds
84
- setTimeout(() => {
85
- clearInterval(checkInterval);
86
- if (!window.HonchoEditor) {
87
- console.error('Timeout waiting for HonchoEditor constructor');
88
- reject(new Error('Timeout waiting for HonchoEditor constructor'));
89
- }
90
- }, 10000);
91
- });
92
- };
93
- await waitForConstructor();
94
- setIsScriptLoaded(true);
95
- }
96
- catch (error) {
97
- console.error('Failed to load HonchoEditor scripts:', error);
98
- setError(error instanceof Error ? error : new Error(String(error)));
99
- }
100
- };
101
- loadScripts();
102
- // Cleanup scripts on unmount (but be careful not to remove if other components need it)
103
- return () => {
104
- // Don't remove the scripts on unmount as other components might need them
105
- // The scripts should stay loaded for the lifetime of the app
106
- };
107
- }, [scriptUrl]);
108
- // Initialize editor when script is loaded
109
- useEffect(() => {
110
- if (!isScriptLoaded)
111
- return;
112
- const initialize = async () => {
113
- try {
114
- console.debug('Script loaded, initializing editor...');
115
- // Double-check that HonchoEditor is available
116
- if (!window.HonchoEditor) {
117
- throw new Error('window.HonchoEditor is not available');
118
- }
119
- if (typeof window.HonchoEditor !== 'function') {
120
- throw new Error(`window.HonchoEditor is not a constructor (type: ${typeof window.HonchoEditor})`);
121
- }
122
- if (!editorRef.current) {
123
- console.debug('Creating new HonchoEditor instance...');
124
- editorRef.current = new window.HonchoEditor();
125
- console.debug('HonchoEditor instance created successfully');
126
- }
127
- console.debug('Initializing HonchoEditor...');
128
- await editorRef.current.initialize(false);
129
- console.debug('HonchoEditor initialized successfully');
130
- setIsReady(true);
131
- }
132
- catch (e) {
133
- console.error("Failed to initialize editor:", e);
134
- setError(e instanceof Error ? e : new Error(String(e)));
135
- }
136
- };
137
- initialize();
138
- return () => {
139
- if (editorRef.current) {
140
- console.debug('Cleaning up HonchoEditor...');
141
- editorRef.current?.cleanup();
142
- }
143
- };
144
- }, [isScriptLoaded]);
145
- // Process single image task
146
- const processImage = useCallback(async (task) => {
147
- if (!editorRef.current || !isReady) {
148
- throw new Error('Editor not ready');
149
- }
150
- try {
151
- console.debug(`Processing image: ${task.id}`);
152
- // Load original image as File using the new utility
153
- const imageFile = await loadImageAsFile(task.path);
154
- // Load frame if provided
155
- let frameFile = null;
156
- if (task.frame) {
157
- frameFile = await loadImageAsFile(task.frame);
158
- }
159
- // Process image using HonchoEditor's one-shot method
160
- const processedImageData = await editorRef.current.processImageOneShot(imageFile, task.adjustments, frameFile);
161
- // Convert ImageData to Blob
162
- const processedBlob = await window.HonchoEditorUtils.imageDataToBlob(processedImageData);
163
- // Create blob URL for processed result
164
- const blobUrl = URL.createObjectURL(processedBlob);
165
- return { id: task.id, path: blobUrl };
166
- }
167
- catch (error) {
168
- console.error(`Failed to process image ${task.id}:`, error);
169
- throw new Error(`Failed to process image: ${error instanceof Error ? error.message : 'Unknown error'}`);
170
- }
171
- }, [isReady]);
172
- // Helper function to load image from URL with CORS handling
173
- const loadImageFromUrl = useCallback(async (url) => {
174
- if (!editorRef.current || !isReady) {
175
- throw new Error('Editor not ready');
176
- }
177
- try {
178
- console.debug(`Loading image from URL: ${url}`);
179
- // First try direct load with CORS
180
- try {
181
- const size = await editorRef.current.loadImageFromUrl(url);
182
- console.debug('Image loaded successfully via direct URL');
183
- return size;
184
- }
185
- catch (directError) {
186
- console.warn('Direct URL load failed, trying blob approach:', directError);
187
- // Fallback: Load as File using the new utility
188
- const imageFile = await loadImageAsFile(url);
189
- // Load via file method
190
- const size = await editorRef.current.loadImageFromFile(imageFile);
191
- console.debug('Image loaded successfully via file fallback');
192
- return size;
193
- }
194
- }
195
- catch (error) {
196
- console.error(`Failed to load image from URL ${url}:`, error);
197
- throw new Error(`Failed to load image: ${error instanceof Error ? error.message : 'Unknown error'}`);
198
- }
199
- }, [isReady]);
200
- return {
201
- editor: editorRef.current,
202
- isReady,
203
- error,
204
- processImage,
205
- loadImageFromUrl
206
- };
207
- }
@@ -1,18 +0,0 @@
1
- import type { AdjustmentValues } from '../editor/honcho-editor';
2
- interface UseImageProcessorProps {
3
- photoId: string;
4
- photoSrc: string;
5
- enableEditor?: boolean;
6
- adjustments?: Partial<AdjustmentValues>;
7
- frame?: string | null;
8
- priority?: 'high' | 'low';
9
- abortSignal?: AbortSignal;
10
- }
11
- interface UseImageProcessorReturn {
12
- processedImageSrc: string;
13
- isProcessingComplete: boolean;
14
- cancelProcessing: () => void;
15
- isProcessing: boolean;
16
- }
17
- export declare function useImageProcessor({ photoId, photoSrc, enableEditor, adjustments, frame, priority, abortSignal, }: UseImageProcessorProps): UseImageProcessorReturn;
18
- export {};
@@ -1,113 +0,0 @@
1
- import { useState, useEffect, useMemo, useRef } from 'react';
2
- import { useEditorHighPriority, useEditorLowPriority } from '../hooks/useEditor';
3
- export function useImageProcessor({ photoId, photoSrc, enableEditor = true, adjustments, frame, priority = 'low', abortSignal, }) {
4
- const { processImage, isEditorReady } = priority === 'high'
5
- ? useEditorHighPriority()
6
- : useEditorLowPriority();
7
- // State for processed image and processing status
8
- const [processedImageSrc, setProcessedImageSrc] = useState(photoSrc);
9
- const [isProcessingComplete, setIsProcessingComplete] = useState(false);
10
- const [isProcessing, setIsProcessing] = useState(false);
11
- // Internal abort controller for this hook
12
- const abortControllerRef = useRef(null);
13
- // Function to cancel current processing
14
- const cancelProcessing = () => {
15
- if (abortControllerRef.current) {
16
- abortControllerRef.current.abort();
17
- abortControllerRef.current = null;
18
- }
19
- setIsProcessing(false);
20
- console.debug(`[useImageProcessor] Cancelled processing for image ${photoId}`);
21
- };
22
- // Memoize adjustments to prevent unnecessary effect triggers
23
- const adjustmentsString = useMemo(() => adjustments ? JSON.stringify(adjustments) : '', [adjustments]);
24
- const frameMemoized = useMemo(() => frame ? frame : null, [frame]);
25
- // Process image when adjustments change
26
- useEffect(() => {
27
- // Cancel any previous processing
28
- if (abortControllerRef.current) {
29
- abortControllerRef.current.abort();
30
- }
31
- if (!enableEditor || !isEditorReady || !adjustments) {
32
- console.debug("Skipping editor processing:", {
33
- enableEditor,
34
- isEditorReady,
35
- hasAdjustments: !!adjustments,
36
- hasFrame: frameMemoized,
37
- photoId
38
- });
39
- setProcessedImageSrc(photoSrc);
40
- setIsProcessingComplete(true);
41
- setIsProcessing(false);
42
- return;
43
- }
44
- // Create new abort controller for this processing cycle
45
- const controller = new AbortController();
46
- abortControllerRef.current = controller;
47
- // Reset processing state when starting new processing
48
- setIsProcessingComplete(false);
49
- setIsProcessing(true);
50
- const processImageWithEditor = async () => {
51
- try {
52
- // Check if already aborted before starting
53
- if (controller.signal.aborted || abortSignal?.aborted) {
54
- console.debug(`[useImageProcessor] Aborted before processing started for image ${photoId}`);
55
- return;
56
- }
57
- console.debug(`[useImageProcessor] Starting processing for image ${photoId}`);
58
- const result = await processImage({
59
- id: photoId,
60
- path: photoSrc,
61
- frame: frameMemoized,
62
- adjustments: adjustments,
63
- abortSignal: controller.signal // Pass the abort signal to the processing service
64
- });
65
- // Check if aborted after processing completes
66
- if (!controller.signal.aborted && !abortSignal?.aborted) {
67
- console.debug(`[useImageProcessor] Completed processing for image ${photoId}`);
68
- setProcessedImageSrc(result.path);
69
- setIsProcessingComplete(true);
70
- setIsProcessing(false);
71
- }
72
- else {
73
- console.debug(`[useImageProcessor] Aborted after processing completed for image ${photoId}`);
74
- }
75
- }
76
- catch (error) {
77
- if (error.name === 'AbortError' || controller.signal.aborted || abortSignal?.aborted) {
78
- console.debug(`[useImageProcessor] Processing cancelled for image ${photoId}`);
79
- }
80
- else {
81
- console.error({ error, photoKey: photoId, isEditorReady }, 'Failed to process image with editor');
82
- }
83
- setIsProcessing(false);
84
- }
85
- };
86
- processImageWithEditor();
87
- return () => {
88
- // Cleanup: abort the controller when effect cleanup runs
89
- controller.abort();
90
- if (abortControllerRef.current === controller) {
91
- abortControllerRef.current = null;
92
- }
93
- };
94
- }, [photoSrc, adjustmentsString, frameMemoized, enableEditor, isEditorReady, processImage, photoId, abortSignal]);
95
- // Listen to external abort signal
96
- useEffect(() => {
97
- if (!abortSignal)
98
- return;
99
- const handleAbort = () => {
100
- cancelProcessing();
101
- };
102
- abortSignal.addEventListener('abort', handleAbort);
103
- return () => {
104
- abortSignal.removeEventListener('abort', handleAbort);
105
- };
106
- }, [abortSignal]);
107
- return {
108
- processedImageSrc,
109
- isProcessingComplete,
110
- cancelProcessing,
111
- isProcessing
112
- };
113
- }
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,12 +0,0 @@
1
- interface Colors {
2
- onSurface: string;
3
- surface: string;
4
- onSurfaceVariant: string;
5
- onSurfaceVariant1: string;
6
- outlineVariant: string;
7
- error: string;
8
- onBackground: string;
9
- background: string;
10
- }
11
- export default function useColors(): Colors;
12
- export {};
@@ -1,12 +0,0 @@
1
- export default function useColors() {
2
- return {
3
- onSurface: "#1C1B1F",
4
- surface: "#FFFFFF",
5
- onSurfaceVariant: "#949494",
6
- onSurfaceVariant1: "#656369",
7
- outlineVariant: "#EDEDED",
8
- error: "#DC362E",
9
- onBackground: "#000000",
10
- background: "#FFFFFF"
11
- };
12
- }
@@ -1,25 +0,0 @@
1
- interface HonchoTypography {
2
- displayLarge: FontStyle;
3
- displayMedium: FontStyle;
4
- displaySmall: FontStyle;
5
- headlineLarge: FontStyle;
6
- headlineMedium: FontStyle;
7
- headlineSmall: FontStyle;
8
- titleLarge: FontStyle;
9
- titleMedium: FontStyle;
10
- titleSmall: FontStyle;
11
- bodyLarge: FontStyle;
12
- bodyMedium: FontStyle;
13
- bodySmall: FontStyle;
14
- labelLarge: FontStyle;
15
- labelMedium: FontStyle;
16
- labelSmall: FontStyle;
17
- }
18
- interface FontStyle {
19
- fontSize: number;
20
- lineHeight: string;
21
- fontWeight: number;
22
- letterSpacing: string;
23
- }
24
- export default function useHonchoTypography(): HonchoTypography;
25
- export {};
@@ -1,94 +0,0 @@
1
- export default function useHonchoTypography() {
2
- return {
3
- displayLarge: {
4
- fontSize: 57,
5
- lineHeight: "64px",
6
- fontWeight: 500,
7
- letterSpacing: "0px"
8
- },
9
- displayMedium: {
10
- fontSize: 45,
11
- lineHeight: "52px",
12
- fontWeight: 500,
13
- letterSpacing: "0px"
14
- },
15
- displaySmall: {
16
- fontSize: 36,
17
- lineHeight: "44px",
18
- fontWeight: 500,
19
- letterSpacing: "0px"
20
- },
21
- headlineLarge: {
22
- fontSize: 32,
23
- lineHeight: "40px",
24
- fontWeight: 500,
25
- letterSpacing: "0px"
26
- },
27
- headlineMedium: {
28
- fontSize: 28,
29
- lineHeight: "36px",
30
- fontWeight: 500,
31
- letterSpacing: "0px"
32
- },
33
- headlineSmall: {
34
- fontSize: 24,
35
- lineHeight: "32px",
36
- fontWeight: 500,
37
- letterSpacing: "0px"
38
- },
39
- titleLarge: {
40
- fontSize: 18,
41
- lineHeight: "24px",
42
- fontWeight: 500,
43
- letterSpacing: "0px"
44
- },
45
- titleMedium: {
46
- fontSize: 16,
47
- lineHeight: "24px",
48
- fontWeight: 500,
49
- letterSpacing: "0.15px"
50
- },
51
- titleSmall: {
52
- fontSize: 14,
53
- lineHeight: "20px",
54
- fontWeight: 500,
55
- letterSpacing: "0.1px"
56
- },
57
- bodyLarge: {
58
- fontSize: 16,
59
- lineHeight: "24px",
60
- fontWeight: 400,
61
- letterSpacing: "0.5px"
62
- },
63
- bodyMedium: {
64
- fontSize: 14,
65
- lineHeight: "20px",
66
- fontWeight: 400,
67
- letterSpacing: "0.25px"
68
- },
69
- bodySmall: {
70
- fontSize: 12,
71
- lineHeight: "16px",
72
- fontWeight: 400,
73
- letterSpacing: "0.4px"
74
- },
75
- labelLarge: {
76
- fontSize: 16,
77
- lineHeight: "24px",
78
- fontWeight: 500,
79
- letterSpacing: "0.1px"
80
- },
81
- labelMedium: {
82
- fontSize: 14,
83
- lineHeight: "20px",
84
- fontWeight: 500,
85
- letterSpacing: "0.1px"
86
- },
87
- labelSmall: {
88
- fontSize: 12,
89
- lineHeight: "16px",
90
- fontWeight: 500,
91
- letterSpacing: "0.1px"
92
- },
93
- };
94
- }
@@ -1,6 +0,0 @@
1
- import { ColorAdjustment } from "../hooks/editor/type";
2
- import { AdjustmentState } from "../hooks/editor/type";
3
- import { AdjustmentValues } from "../lib/editor/honcho-editor";
4
- export declare function mapAdjustmentStateToAdjustmentEditor(state: AdjustmentState): AdjustmentValues;
5
- export declare function mapColorAdjustmentToAdjustmentState(colors: ColorAdjustment): AdjustmentState;
6
- export declare function mapAdjustmentStateToColorAdjustment(state: AdjustmentState): ColorAdjustment;
@@ -1,48 +0,0 @@
1
- export function mapAdjustmentStateToAdjustmentEditor(state) {
2
- return {
3
- temperature: state.tempScore,
4
- tint: state.tintScore,
5
- saturation: state.saturationScore,
6
- vibrance: state.vibranceScore,
7
- exposure: state.exposureScore,
8
- contrast: state.contrastScore,
9
- highlights: state.highlightsScore,
10
- shadows: state.shadowsScore,
11
- whites: state.whitesScore,
12
- blacks: state.blacksScore,
13
- clarity: state.clarityScore,
14
- sharpness: state.sharpnessScore,
15
- };
16
- }
17
- export function mapColorAdjustmentToAdjustmentState(colors) {
18
- return {
19
- tempScore: colors.temperature,
20
- tintScore: colors.tint,
21
- vibranceScore: colors.vibrance,
22
- saturationScore: colors.saturation,
23
- exposureScore: colors.exposure,
24
- highlightsScore: colors.highlights,
25
- shadowsScore: colors.shadows,
26
- whitesScore: colors.whites,
27
- blacksScore: colors.blacks,
28
- contrastScore: colors.contrast,
29
- clarityScore: colors.clarity,
30
- sharpnessScore: colors.sharpness
31
- };
32
- }
33
- export function mapAdjustmentStateToColorAdjustment(state) {
34
- return {
35
- temperature: state.tempScore,
36
- tint: state.tintScore,
37
- vibrance: state.vibranceScore,
38
- saturation: state.saturationScore,
39
- exposure: state.exposureScore,
40
- contrast: state.contrastScore,
41
- highlights: state.highlightsScore,
42
- shadows: state.shadowsScore,
43
- whites: state.whitesScore,
44
- blacks: state.blacksScore,
45
- clarity: state.clarityScore,
46
- sharpness: state.sharpnessScore
47
- };
48
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Image loading utilities with CORS handling and fallback mechanisms
3
- */
4
- /**
5
- * Load image as blob with CORS handling and proxy fallback
6
- */
7
- export declare function loadImageAsBlob(url: string): Promise<Blob>;
8
- /**
9
- * Load image from URL and convert to File object with CORS handling and fallback mechanisms
10
- */
11
- export declare function loadImageAsFile(url: string): Promise<File>;