@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.
- package/package.json +1 -1
- package/dist/color.d.ts +0 -9
- package/dist/color.js +0 -9
- package/dist/components/editor/GalleryAlbum/AlbumImageGallery.d.ts +0 -8
- package/dist/components/editor/GalleryAlbum/AlbumImageGallery.js +0 -28
- package/dist/components/editor/GalleryAlbum/ImageItem.d.ts +0 -10
- package/dist/components/editor/GalleryAlbum/ImageItem.js +0 -81
- package/dist/components/editor/HAccordionAspectRatio.d.ts +0 -14
- package/dist/components/editor/HAccordionAspectRatio.js +0 -102
- package/dist/components/editor/HAccordionColor.d.ts +0 -16
- package/dist/components/editor/HAccordionColor.js +0 -282
- package/dist/components/editor/HAccordionColorAdjustment.d.ts +0 -35
- package/dist/components/editor/HAccordionColorAdjustment.js +0 -31
- package/dist/components/editor/HAccordionDetails.d.ts +0 -12
- package/dist/components/editor/HAccordionDetails.js +0 -157
- package/dist/components/editor/HAccordionLight.d.ts +0 -20
- package/dist/components/editor/HAccordionLight.js +0 -414
- package/dist/components/editor/HAccordionPreset.d.ts +0 -23
- package/dist/components/editor/HAccordionPreset.js +0 -50
- package/dist/components/editor/HAlertBox.d.ts +0 -8
- package/dist/components/editor/HAlertBox.js +0 -55
- package/dist/components/editor/HAspectRatioMobile.d.ts +0 -0
- package/dist/components/editor/HAspectRatioMobile.js +0 -1
- package/dist/components/editor/HBulkAccordionColorAdjustment.d.ts +0 -55
- package/dist/components/editor/HBulkAccordionColorAdjustment.js +0 -31
- package/dist/components/editor/HBulkAccordionColorAdjustmentColors.d.ts +0 -20
- package/dist/components/editor/HBulkAccordionColorAdjustmentColors.js +0 -121
- package/dist/components/editor/HBulkAccordionColorAdjustmentDetails.d.ts +0 -12
- package/dist/components/editor/HBulkAccordionColorAdjustmentDetails.js +0 -65
- package/dist/components/editor/HBulkAccordionColorAdjustmentLight.d.ts +0 -28
- package/dist/components/editor/HBulkAccordionColorAdjustmentLight.js +0 -177
- package/dist/components/editor/HBulkColorAdjustmentMobile.d.ts +0 -53
- package/dist/components/editor/HBulkColorAdjustmentMobile.js +0 -16
- package/dist/components/editor/HBulkColorMobile.d.ts +0 -20
- package/dist/components/editor/HBulkColorMobile.js +0 -121
- package/dist/components/editor/HBulkDetailsMobile.d.ts +0 -12
- package/dist/components/editor/HBulkDetailsMobile.js +0 -65
- package/dist/components/editor/HBulkLightMobile.d.ts +0 -28
- package/dist/components/editor/HBulkLightMobile.js +0 -192
- package/dist/components/editor/HBulkPreset.d.ts +0 -24
- package/dist/components/editor/HBulkPreset.js +0 -43
- package/dist/components/editor/HBulkPresetMobile.d.ts +0 -15
- package/dist/components/editor/HBulkPresetMobile.js +0 -26
- package/dist/components/editor/HDialogBox.d.ts +0 -18
- package/dist/components/editor/HDialogBox.js +0 -51
- package/dist/components/editor/HDialogCopy.d.ts +0 -40
- package/dist/components/editor/HDialogCopy.js +0 -80
- package/dist/components/editor/HFooter.d.ts +0 -12
- package/dist/components/editor/HFooter.js +0 -24
- package/dist/components/editor/HHeaderEditor.d.ts +0 -17
- package/dist/components/editor/HHeaderEditor.js +0 -36
- package/dist/components/editor/HImageEditorBulkDekstop.d.ts +0 -15
- package/dist/components/editor/HImageEditorBulkDekstop.js +0 -29
- package/dist/components/editor/HImageEditorBulkMobile.d.ts +0 -72
- package/dist/components/editor/HImageEditorBulkMobile.js +0 -81
- package/dist/components/editor/HImageEditorDekstop.d.ts +0 -15
- package/dist/components/editor/HImageEditorDekstop.js +0 -29
- package/dist/components/editor/HImageEditorMobile.d.ts +0 -51
- package/dist/components/editor/HImageEditorMobile.js +0 -92
- package/dist/components/editor/HImageEditorMobileLayout.d.ts +0 -14
- package/dist/components/editor/HImageEditorMobileLayout.js +0 -58
- package/dist/components/editor/HModalEditorDekstop.d.ts +0 -13
- package/dist/components/editor/HModalEditorDekstop.js +0 -22
- package/dist/components/editor/HModalMobile.d.ts +0 -13
- package/dist/components/editor/HModalMobile.js +0 -7
- package/dist/components/editor/HPresetDelete.d.ts +0 -7
- package/dist/components/editor/HPresetDelete.js +0 -7
- package/dist/components/editor/HPresetOptionMenu.d.ts +0 -9
- package/dist/components/editor/HPresetOptionMenu.js +0 -20
- package/dist/components/editor/HSliderColorMobile.d.ts +0 -16
- package/dist/components/editor/HSliderColorMobile.js +0 -270
- package/dist/components/editor/HSliderDetailsMobile.d.ts +0 -12
- package/dist/components/editor/HSliderDetailsMobile.js +0 -154
- package/dist/components/editor/HSliderLightMobile.d.ts +0 -20
- package/dist/components/editor/HSliderLightMobile.js +0 -420
- package/dist/components/editor/HTabAspectRatioMobile.d.ts +0 -0
- package/dist/components/editor/HTabAspectRatioMobile.js +0 -1
- package/dist/components/editor/HTabColorAdjustmentMobile.d.ts +0 -33
- package/dist/components/editor/HTabColorAdjustmentMobile.js +0 -16
- package/dist/components/editor/HTabPresetMobile.d.ts +0 -14
- package/dist/components/editor/HTabPresetMobile.js +0 -10
- package/dist/components/editor/HTextField.d.ts +0 -14
- package/dist/components/editor/HTextField.js +0 -51
- package/dist/components/editor/HWatermarkView.d.ts +0 -6
- package/dist/components/editor/HWatermarkView.js +0 -16
- package/dist/components/editor/svg/Tick.d.ts +0 -2
- package/dist/components/editor/svg/Tick.js +0 -6
- package/dist/components/modal/HModalDialog.d.ts +0 -12
- package/dist/components/modal/HModalDialog.js +0 -18
- package/dist/components/modal/HModalRename.d.ts +0 -14
- package/dist/components/modal/HModalRename.js +0 -35
- package/dist/hooks/demo/HonchoEditorBulkDemo.d.ts +0 -3
- package/dist/hooks/demo/HonchoEditorBulkDemo.js +0 -410
- package/dist/hooks/demo/HonchoEditorSingleCleanDemo.d.ts +0 -3
- package/dist/hooks/demo/HonchoEditorSingleCleanDemo.js +0 -354
- package/dist/hooks/demo/index.d.ts +0 -2
- package/dist/hooks/demo/index.js +0 -2
- package/dist/hooks/editor/type.d.ts +0 -174
- package/dist/hooks/editor/type.js +0 -1
- package/dist/hooks/editor/useHonchoEditorBulk.d.ts +0 -96
- package/dist/hooks/editor/useHonchoEditorBulk.js +0 -427
- package/dist/hooks/editor/useHonchoEditorSingle.d.ts +0 -44
- package/dist/hooks/editor/useHonchoEditorSingle.js +0 -162
- package/dist/hooks/useAdjustmentHistory.d.ts +0 -97
- package/dist/hooks/useAdjustmentHistory.js +0 -493
- package/dist/hooks/useAdjustmentHistoryBatch.d.ts +0 -177
- package/dist/hooks/useAdjustmentHistoryBatch.js +0 -1189
- package/dist/hooks/useGallerySwipe.d.ts +0 -36
- package/dist/hooks/useGallerySwipe.js +0 -344
- package/dist/hooks/usePaging.d.ts +0 -89
- package/dist/hooks/usePaging.js +0 -211
- package/dist/hooks/usePreset.d.ts +0 -82
- package/dist/hooks/usePreset.js +0 -344
- package/dist/index.d.ts +0 -41
- package/dist/index.js +0 -44
- package/dist/lib/context/EditorContext.d.ts +0 -28
- package/dist/lib/context/EditorContext.js +0 -60
- package/dist/lib/context/EditorProcessingService.d.ts +0 -36
- package/dist/lib/context/EditorProcessingService.js +0 -249
- package/dist/lib/editor/honcho-editor.d.ts +0 -324
- package/dist/lib/editor/honcho-editor.js +0 -825
- package/dist/lib/hooks/useEditor.d.ts +0 -22
- package/dist/lib/hooks/useEditor.js +0 -35
- package/dist/lib/hooks/useEditorHeadless.d.ts +0 -34
- package/dist/lib/hooks/useEditorHeadless.js +0 -207
- package/dist/lib/hooks/useImageProcessor.d.ts +0 -18
- package/dist/lib/hooks/useImageProcessor.js +0 -113
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -1
- package/dist/themes/colors.d.ts +0 -12
- package/dist/themes/colors.js +0 -12
- package/dist/themes/honchoTheme.d.ts +0 -25
- package/dist/themes/honchoTheme.js +0 -94
- package/dist/utils/adjustment.d.ts +0 -6
- package/dist/utils/adjustment.js +0 -48
- package/dist/utils/imageLoader.d.ts +0 -11
- package/dist/utils/imageLoader.js +0 -48
- package/dist/utils/isMobile.d.ts +0 -1
- package/dist/utils/isMobile.js +0 -5
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Controller, Preset, AdjustmentState } from './editor/type';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration options for the preset hook
|
|
4
|
-
*/
|
|
5
|
-
export interface PresetOptions {
|
|
6
|
-
/** Enable development warnings for debugging */
|
|
7
|
-
devWarnings?: boolean;
|
|
8
|
-
/** Auto-load presets on hook initialization */
|
|
9
|
-
autoLoad?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Information about the current preset state
|
|
13
|
-
*/
|
|
14
|
-
export interface PresetInfo {
|
|
15
|
-
/** Whether presets are currently being loaded */
|
|
16
|
-
isLoading: boolean;
|
|
17
|
-
/** Error message if any operation failed */
|
|
18
|
-
error: string | null;
|
|
19
|
-
/** Number of presets currently managed */
|
|
20
|
-
count: number;
|
|
21
|
-
/** Whether the hook has been initialized */
|
|
22
|
-
isInitialized: boolean;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Actions available for preset management
|
|
26
|
-
*/
|
|
27
|
-
export interface PresetActions {
|
|
28
|
-
/** Create a new preset */
|
|
29
|
-
create: (name: string, settings: AdjustmentState) => Promise<Preset | null>;
|
|
30
|
-
/** Rename an existing preset */
|
|
31
|
-
rename: (presetId: string, newName: string) => Promise<boolean>;
|
|
32
|
-
/** Delete a preset */
|
|
33
|
-
delete: (presetId: string) => Promise<boolean>;
|
|
34
|
-
/** Load/refresh presets from backend */
|
|
35
|
-
load: () => Promise<void>;
|
|
36
|
-
/** Find preset that matches the given adjustment state */
|
|
37
|
-
findByAdjustments: (adjustments: AdjustmentState) => Preset | null;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Return type for the usePreset hook
|
|
41
|
-
*/
|
|
42
|
-
export interface UsePresetReturn {
|
|
43
|
-
/** Current list of presets */
|
|
44
|
-
presets: Preset[];
|
|
45
|
-
/** Information about preset state */
|
|
46
|
-
info: PresetInfo;
|
|
47
|
-
/** Available preset actions */
|
|
48
|
-
actions: PresetActions;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Hook for managing presets with backend communication through Controller.
|
|
52
|
-
*
|
|
53
|
-
* **Key Features:**
|
|
54
|
-
* - **Backend Communication**: All operations go through the provided Controller
|
|
55
|
-
* - **Local State Management**: Maintains local preset list for UI performance
|
|
56
|
-
* - **CRUD Operations**: Create, rename, delete, and list presets
|
|
57
|
-
* - **Error Handling**: Provides error states for failed operations
|
|
58
|
-
* - **Auto-loading**: Optional automatic preset loading on initialization
|
|
59
|
-
*
|
|
60
|
-
* **Typical Usage:**
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const { presets, actions, info } = usePreset(controller, firebaseUid, { autoLoad: true });
|
|
63
|
-
*
|
|
64
|
-
* // Create preset
|
|
65
|
-
* const newPreset = await actions.create('My Preset', adjustmentState);
|
|
66
|
-
*
|
|
67
|
-
* // Rename preset
|
|
68
|
-
* const success = await actions.rename(presetId, 'New Name');
|
|
69
|
-
*
|
|
70
|
-
* // Delete preset
|
|
71
|
-
* const deleted = await actions.delete(presetId);
|
|
72
|
-
*
|
|
73
|
-
* // Manual reload
|
|
74
|
-
* await actions.load();
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @param controller - Backend controller for API communication
|
|
78
|
-
* @param firebaseUid - User identifier for backend operations
|
|
79
|
-
* @param options - Configuration options
|
|
80
|
-
* @returns Object with presets, info, and actions
|
|
81
|
-
*/
|
|
82
|
-
export declare function usePreset(controller: Controller | null, firebaseUid: string, options?: PresetOptions): UsePresetReturn;
|
package/dist/hooks/usePreset.js
DELETED
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook for managing presets with backend communication through Controller.
|
|
4
|
-
*
|
|
5
|
-
* **Key Features:**
|
|
6
|
-
* - **Backend Communication**: All operations go through the provided Controller
|
|
7
|
-
* - **Local State Management**: Maintains local preset list for UI performance
|
|
8
|
-
* - **CRUD Operations**: Create, rename, delete, and list presets
|
|
9
|
-
* - **Error Handling**: Provides error states for failed operations
|
|
10
|
-
* - **Auto-loading**: Optional automatic preset loading on initialization
|
|
11
|
-
*
|
|
12
|
-
* **Typical Usage:**
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const { presets, actions, info } = usePreset(controller, firebaseUid, { autoLoad: true });
|
|
15
|
-
*
|
|
16
|
-
* // Create preset
|
|
17
|
-
* const newPreset = await actions.create('My Preset', adjustmentState);
|
|
18
|
-
*
|
|
19
|
-
* // Rename preset
|
|
20
|
-
* const success = await actions.rename(presetId, 'New Name');
|
|
21
|
-
*
|
|
22
|
-
* // Delete preset
|
|
23
|
-
* const deleted = await actions.delete(presetId);
|
|
24
|
-
*
|
|
25
|
-
* // Manual reload
|
|
26
|
-
* await actions.load();
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @param controller - Backend controller for API communication
|
|
30
|
-
* @param firebaseUid - User identifier for backend operations
|
|
31
|
-
* @param options - Configuration options
|
|
32
|
-
* @returns Object with presets, info, and actions
|
|
33
|
-
*/
|
|
34
|
-
export function usePreset(controller, firebaseUid, options = {}) {
|
|
35
|
-
// Memoize options to prevent re-renders when object is recreated with same values
|
|
36
|
-
const memoizedOptions = useMemo(() => ({
|
|
37
|
-
devWarnings: options.devWarnings ?? false,
|
|
38
|
-
autoLoad: options.autoLoad ?? false
|
|
39
|
-
}), [options.devWarnings, options.autoLoad]);
|
|
40
|
-
// Core state
|
|
41
|
-
const [presets, setPresets] = useState([]);
|
|
42
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
43
|
-
const [error, setError] = useState(null);
|
|
44
|
-
const [isInitialized, setIsInitialized] = useState(false);
|
|
45
|
-
// Helper function to log debug messages - memoized to prevent re-renders
|
|
46
|
-
const debugLog = useCallback((message, data) => {
|
|
47
|
-
if (memoizedOptions.devWarnings) {
|
|
48
|
-
console.log(`[usePreset] ${message}`, data || '');
|
|
49
|
-
}
|
|
50
|
-
}, [memoizedOptions.devWarnings]);
|
|
51
|
-
// Stable references for controller and firebaseUid to detect actual changes
|
|
52
|
-
const stableControllerRef = useRef(controller);
|
|
53
|
-
const stableFirebaseUidRef = useRef(firebaseUid);
|
|
54
|
-
const prevStableControllerRef = useRef(controller);
|
|
55
|
-
const prevStableFirebaseUidRef = useRef(firebaseUid);
|
|
56
|
-
// Update refs only when values actually change (by reference)
|
|
57
|
-
if (stableControllerRef.current !== controller) {
|
|
58
|
-
stableControllerRef.current = controller;
|
|
59
|
-
}
|
|
60
|
-
if (stableFirebaseUidRef.current !== firebaseUid) {
|
|
61
|
-
stableFirebaseUidRef.current = firebaseUid;
|
|
62
|
-
}
|
|
63
|
-
// Helper function to handle errors
|
|
64
|
-
const handleError = useCallback((operation, error) => {
|
|
65
|
-
const errorMessage = `Failed to ${operation}: ${error instanceof Error ? error.message : String(error)}`;
|
|
66
|
-
setError(errorMessage);
|
|
67
|
-
debugLog(`Error in ${operation}`, error);
|
|
68
|
-
return false;
|
|
69
|
-
}, [debugLog]);
|
|
70
|
-
// Load presets from backend
|
|
71
|
-
const load = useCallback(async () => {
|
|
72
|
-
console.log("Load Presets Get Function Called");
|
|
73
|
-
if (!stableControllerRef.current || !stableFirebaseUidRef.current) {
|
|
74
|
-
debugLog('Load skipped: missing controller or firebaseUid');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
setIsLoading(true);
|
|
78
|
-
setError(null);
|
|
79
|
-
try {
|
|
80
|
-
debugLog('Loading presets from backend...');
|
|
81
|
-
const loadedPresets = await stableControllerRef.current.getPresets(stableFirebaseUidRef.current);
|
|
82
|
-
// Ensure we always have an array
|
|
83
|
-
const presetsArray = Array.isArray(loadedPresets) ? loadedPresets : [];
|
|
84
|
-
setPresets(presetsArray);
|
|
85
|
-
setIsInitialized(true);
|
|
86
|
-
debugLog('Presets loaded successfully', { count: presetsArray.length });
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
handleError('load presets', err);
|
|
90
|
-
setPresets([]); // Clear presets on error
|
|
91
|
-
}
|
|
92
|
-
finally {
|
|
93
|
-
setIsLoading(false);
|
|
94
|
-
}
|
|
95
|
-
}, [debugLog, handleError]);
|
|
96
|
-
// Fire-and-forget version of load for internal use
|
|
97
|
-
const loadInBackground = useCallback(() => {
|
|
98
|
-
if (!stableControllerRef.current || !stableFirebaseUidRef.current) {
|
|
99
|
-
debugLog('Background load skipped: missing controller or firebaseUid');
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
debugLog('Background loading presets...');
|
|
103
|
-
// Don't set loading state for background operations
|
|
104
|
-
stableControllerRef.current.getPresets(stableFirebaseUidRef.current)
|
|
105
|
-
.then((loadedPresets) => {
|
|
106
|
-
// Ensure we always have an array
|
|
107
|
-
const presetsArray = Array.isArray(loadedPresets) ? loadedPresets : [];
|
|
108
|
-
setPresets(presetsArray);
|
|
109
|
-
if (!isInitialized) {
|
|
110
|
-
setIsInitialized(true);
|
|
111
|
-
}
|
|
112
|
-
debugLog('Background presets loaded successfully', { count: presetsArray.length });
|
|
113
|
-
})
|
|
114
|
-
.catch((err) => {
|
|
115
|
-
debugLog('Background load failed:', err);
|
|
116
|
-
// Don't set error state for background operations
|
|
117
|
-
});
|
|
118
|
-
}, [debugLog, isInitialized]);
|
|
119
|
-
// Create a new preset
|
|
120
|
-
const create = useCallback(async (name, settings) => {
|
|
121
|
-
console.log("Create Preset Get Function Called");
|
|
122
|
-
if (!stableControllerRef.current || !stableFirebaseUidRef.current) {
|
|
123
|
-
debugLog('Create skipped: missing controller or firebaseUid');
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
if (!name.trim()) {
|
|
127
|
-
setError('Preset name cannot be empty');
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
setIsLoading(true);
|
|
131
|
-
setError(null);
|
|
132
|
-
try {
|
|
133
|
-
debugLog('Creating preset...', { name, settings });
|
|
134
|
-
// Fire the create request but don't wait for preset data in response
|
|
135
|
-
await stableControllerRef.current.createPreset(stableFirebaseUidRef.current, name, settings);
|
|
136
|
-
debugLog('Preset creation request completed');
|
|
137
|
-
const newPreset = {
|
|
138
|
-
id: `temp-${Date.now()}`, // Use a temporary ID
|
|
139
|
-
name: name,
|
|
140
|
-
is_default: false,
|
|
141
|
-
temperature: settings.tempScore,
|
|
142
|
-
tint: settings.tintScore,
|
|
143
|
-
saturation: settings.saturationScore,
|
|
144
|
-
vibrance: settings.vibranceScore,
|
|
145
|
-
exposure: settings.exposureScore,
|
|
146
|
-
contrast: settings.contrastScore,
|
|
147
|
-
highlights: settings.highlightsScore,
|
|
148
|
-
shadows: settings.shadowsScore,
|
|
149
|
-
whites: settings.whitesScore,
|
|
150
|
-
blacks: settings.blacksScore,
|
|
151
|
-
clarity: settings.clarityScore,
|
|
152
|
-
sharpness: settings.sharpnessScore,
|
|
153
|
-
};
|
|
154
|
-
// Add the new preset to the local state immediately
|
|
155
|
-
setPresets(prev => [...prev, newPreset]);
|
|
156
|
-
// Fire and forget: Schedule a delayed refresh to get updated preset list
|
|
157
|
-
setTimeout(() => {
|
|
158
|
-
debugLog('Refreshing presets after create (fire and forget)');
|
|
159
|
-
loadInBackground();
|
|
160
|
-
}, 500); // 500ms delay to allow backend processing
|
|
161
|
-
// Return a minimal success indicator since we don't have the actual preset data
|
|
162
|
-
// return { id: 'pending', name, is_default: false } as Preset;
|
|
163
|
-
return newPreset;
|
|
164
|
-
}
|
|
165
|
-
catch (err) {
|
|
166
|
-
handleError('create preset', err);
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
finally {
|
|
170
|
-
setIsLoading(false);
|
|
171
|
-
}
|
|
172
|
-
// loadInBackground
|
|
173
|
-
}, [presets, debugLog, handleError, loadInBackground]);
|
|
174
|
-
// Rename an existing preset
|
|
175
|
-
const rename = useCallback(async (presetId, newName) => {
|
|
176
|
-
if (!stableControllerRef.current || !stableFirebaseUidRef.current) {
|
|
177
|
-
debugLog('Rename skipped: missing controller or firebaseUid');
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
if (!newName.trim()) {
|
|
181
|
-
setError('Preset name cannot be empty');
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
const existingPreset = Array.isArray(presets) ? presets.find(p => p.id === presetId) : null;
|
|
185
|
-
if (!existingPreset) {
|
|
186
|
-
setError('Preset not found');
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
// Check for duplicate names (excluding the current preset)
|
|
190
|
-
if (Array.isArray(presets) && presets.some(p => p.id !== presetId && p.name.toLowerCase() === newName.toLowerCase())) {
|
|
191
|
-
setError('A preset with this name already exists');
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
setIsLoading(true);
|
|
195
|
-
setError(null);
|
|
196
|
-
try {
|
|
197
|
-
debugLog('Renaming preset...', { presetId, oldName: existingPreset.name, newName });
|
|
198
|
-
const updatedPreset = { ...existingPreset, name: newName };
|
|
199
|
-
await stableControllerRef.current.updatePreset(stableFirebaseUidRef.current, updatedPreset);
|
|
200
|
-
// Update local state
|
|
201
|
-
setPresets(prev => prev.map(p => p.id === presetId ? updatedPreset : p));
|
|
202
|
-
debugLog('Preset renamed successfully');
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
catch (err) {
|
|
206
|
-
handleError('rename preset', err);
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
finally {
|
|
210
|
-
setIsLoading(false);
|
|
211
|
-
}
|
|
212
|
-
}, [presets, debugLog, handleError]);
|
|
213
|
-
// Delete a preset
|
|
214
|
-
const deletePreset = useCallback(async (presetId) => {
|
|
215
|
-
console.log("Delete Presets Get Function Called");
|
|
216
|
-
if (!stableControllerRef.current || !stableFirebaseUidRef.current) {
|
|
217
|
-
debugLog('Delete skipped: missing controller or firebaseUid');
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
const existingPreset = Array.isArray(presets) ? presets.find(p => p.id === presetId) : null;
|
|
221
|
-
if (!existingPreset) {
|
|
222
|
-
setError('Preset not found');
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
setIsLoading(true);
|
|
226
|
-
setError(null);
|
|
227
|
-
try {
|
|
228
|
-
debugLog('Deleting preset...', { presetId, name: existingPreset.name });
|
|
229
|
-
await stableControllerRef.current.deletePreset(stableFirebaseUidRef.current, presetId);
|
|
230
|
-
// Remove from local state
|
|
231
|
-
setPresets(prev => prev.filter(p => p.id !== presetId));
|
|
232
|
-
debugLog('Preset deleted successfully');
|
|
233
|
-
return true;
|
|
234
|
-
}
|
|
235
|
-
catch (err) {
|
|
236
|
-
handleError('delete preset', err);
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
finally {
|
|
240
|
-
setIsLoading(false);
|
|
241
|
-
}
|
|
242
|
-
}, [presets, debugLog, handleError]);
|
|
243
|
-
// Find preset that matches the given adjustment state
|
|
244
|
-
const findByAdjustments = useCallback((adjustments) => {
|
|
245
|
-
// Helper function to normalize adjustment values (treat null/undefined as 0)
|
|
246
|
-
const normalizeValue = (value) => {
|
|
247
|
-
return value ?? 0;
|
|
248
|
-
};
|
|
249
|
-
// Helper function to convert Preset to AdjustmentState for comparison
|
|
250
|
-
const presetToAdjustmentState = (preset) => {
|
|
251
|
-
return {
|
|
252
|
-
tempScore: normalizeValue(preset.temperature),
|
|
253
|
-
tintScore: normalizeValue(preset.tint),
|
|
254
|
-
vibranceScore: normalizeValue(preset.vibrance),
|
|
255
|
-
saturationScore: normalizeValue(preset.saturation),
|
|
256
|
-
exposureScore: normalizeValue(preset.exposure),
|
|
257
|
-
highlightsScore: normalizeValue(preset.highlights),
|
|
258
|
-
shadowsScore: normalizeValue(preset.shadows),
|
|
259
|
-
whitesScore: normalizeValue(preset.whites),
|
|
260
|
-
blacksScore: normalizeValue(preset.blacks),
|
|
261
|
-
contrastScore: normalizeValue(preset.contrast),
|
|
262
|
-
clarityScore: normalizeValue(preset.clarity),
|
|
263
|
-
sharpnessScore: normalizeValue(preset.sharpness)
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
// Helper function to compare two adjustment states
|
|
267
|
-
const adjustmentsMatch = (presetSettings, current) => {
|
|
268
|
-
const keys = [
|
|
269
|
-
'tempScore', 'tintScore', 'vibranceScore', 'saturationScore',
|
|
270
|
-
'exposureScore', 'highlightsScore', 'shadowsScore', 'whitesScore',
|
|
271
|
-
'blacksScore', 'contrastScore', 'clarityScore', 'sharpnessScore'
|
|
272
|
-
];
|
|
273
|
-
return keys.every(key => normalizeValue(presetSettings[key]) === normalizeValue(current[key]));
|
|
274
|
-
};
|
|
275
|
-
debugLog('Finding preset by adjustments...', adjustments);
|
|
276
|
-
// Find preset that matches the current adjustments
|
|
277
|
-
const matchingPreset = Array.isArray(presets) ? presets.find(preset => {
|
|
278
|
-
const presetAdjustments = presetToAdjustmentState(preset);
|
|
279
|
-
return adjustmentsMatch(presetAdjustments, adjustments);
|
|
280
|
-
}) : null;
|
|
281
|
-
if (matchingPreset) {
|
|
282
|
-
debugLog('Found matching preset:', matchingPreset);
|
|
283
|
-
return matchingPreset;
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
debugLog('No matching preset found');
|
|
287
|
-
return null;
|
|
288
|
-
}
|
|
289
|
-
}, [presets, debugLog]);
|
|
290
|
-
// Auto-load presets on initialization or when firebaseUid becomes available
|
|
291
|
-
useEffect(() => {
|
|
292
|
-
const hasValidCredentials = stableControllerRef.current && stableFirebaseUidRef.current;
|
|
293
|
-
const shouldAutoLoad = memoizedOptions.autoLoad && hasValidCredentials;
|
|
294
|
-
if (shouldAutoLoad && !isInitialized) {
|
|
295
|
-
debugLog('Auto-loading presets on initialization...');
|
|
296
|
-
load();
|
|
297
|
-
}
|
|
298
|
-
else if (shouldAutoLoad && isInitialized) {
|
|
299
|
-
// If we're already initialized but firebaseUid changed to a new valid value, reload
|
|
300
|
-
const firebaseUidChanged = prevStableFirebaseUidRef.current !== stableFirebaseUidRef.current;
|
|
301
|
-
if (firebaseUidChanged && stableFirebaseUidRef.current) {
|
|
302
|
-
debugLog('Auto-loading presets due to firebaseUid change...');
|
|
303
|
-
load();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}, [memoizedOptions.autoLoad, stableControllerRef.current, stableFirebaseUidRef.current, isInitialized, load]);
|
|
307
|
-
// Clear state when controller or firebaseUid changes - but only when they actually change
|
|
308
|
-
useEffect(() => {
|
|
309
|
-
const controllerChanged = prevStableControllerRef.current !== stableControllerRef.current;
|
|
310
|
-
const firebaseUidChanged = prevStableFirebaseUidRef.current !== stableFirebaseUidRef.current;
|
|
311
|
-
if ((controllerChanged || firebaseUidChanged) && isInitialized) {
|
|
312
|
-
debugLog('Controller or firebaseUid changed, clearing state');
|
|
313
|
-
setError(null);
|
|
314
|
-
// Only reset initialization if firebaseUid became null/empty
|
|
315
|
-
if (firebaseUidChanged && !stableFirebaseUidRef.current) {
|
|
316
|
-
setIsInitialized(false);
|
|
317
|
-
setPresets([]); // Clear presets when user changes
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
prevStableControllerRef.current = stableControllerRef.current;
|
|
321
|
-
prevStableFirebaseUidRef.current = stableFirebaseUidRef.current;
|
|
322
|
-
}, [stableControllerRef.current, stableFirebaseUidRef.current, isInitialized, debugLog]);
|
|
323
|
-
// Preset info object - memoized to prevent re-renders
|
|
324
|
-
const info = useMemo(() => ({
|
|
325
|
-
isLoading,
|
|
326
|
-
error,
|
|
327
|
-
count: Array.isArray(presets) ? presets.length : 0,
|
|
328
|
-
isInitialized
|
|
329
|
-
}), [isLoading, error, presets, isInitialized]);
|
|
330
|
-
// Actions object - memoized to prevent re-renders when functions don't change
|
|
331
|
-
const actions = useMemo(() => ({
|
|
332
|
-
create,
|
|
333
|
-
rename,
|
|
334
|
-
delete: deletePreset,
|
|
335
|
-
load,
|
|
336
|
-
findByAdjustments
|
|
337
|
-
}), [create, rename, deletePreset, load, findByAdjustments]);
|
|
338
|
-
// Return object - memoized to prevent re-renders when values don't change
|
|
339
|
-
return useMemo(() => ({
|
|
340
|
-
presets,
|
|
341
|
-
info,
|
|
342
|
-
actions
|
|
343
|
-
}), [presets, info, actions]);
|
|
344
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export { HonchoEditorBulkDemo } from './hooks/demo/HonchoEditorBulkDemo';
|
|
2
|
-
export { HonchoEditorSingleCleanDemo } from './hooks/demo/HonchoEditorSingleCleanDemo';
|
|
3
|
-
export { useHonchoEditorSingle } from './hooks/editor/useHonchoEditorSingle';
|
|
4
|
-
export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
|
|
5
|
-
export type { Controller, AdjustmentState, Preset, ImageItem, ColorAdjustment, CreateEditorTaskRequest, EditorHistoryEntry, GetGalleryUpdateTimestampResponse, GetHistoryResponse, } from './hooks/editor/type';
|
|
6
|
-
export type { PhotoData } from './hooks/editor/useHonchoEditorBulk';
|
|
7
|
-
export type { Gallery, Content } from './hooks/editor/type';
|
|
8
|
-
export { default as HHeaderEditor } from './components/editor/HHeaderEditor';
|
|
9
|
-
export { default as HFooter } from './components/editor/HFooter';
|
|
10
|
-
export { default as HAccordionColorAdjustment } from './components/editor/HAccordionColorAdjustment';
|
|
11
|
-
export { default as HAccordionPreset } from './components/editor/HAccordionPreset';
|
|
12
|
-
export { HBaseDialog, HDialogForPreset } from './components/editor/HDialogBox';
|
|
13
|
-
export { HDialogCopy, HDialogPreset } from './components/editor/HDialogCopy';
|
|
14
|
-
export { default as HImageEditorMobile } from './components/editor/HImageEditorMobile';
|
|
15
|
-
export { default as HImageEditorDesktop } from './components/editor/HImageEditorDekstop';
|
|
16
|
-
export { default as HImageEditorBulkDekstop } from './components/editor/HImageEditorBulkDekstop';
|
|
17
|
-
export { default as HImageEditorBulkMobile } from './components/editor/HImageEditorBulkMobile';
|
|
18
|
-
export { default as HBulkAccordionColorAdjustment } from './components/editor/HBulkAccordionColorAdjustment';
|
|
19
|
-
export { default as HBulkPreset } from './components/editor/HBulkPreset';
|
|
20
|
-
export { default as HModalEditorDekstop } from './components/editor/HModalEditorDekstop';
|
|
21
|
-
export { HTextField, HTextFieldRename } from './components/editor/HTextField';
|
|
22
|
-
export { default as HWatermarkView } from './components/editor/HWatermarkView';
|
|
23
|
-
export { default as HModalMobile } from './components/editor/HModalMobile';
|
|
24
|
-
export { default as HPresetOptionsMenu } from './components/editor/HPresetOptionMenu';
|
|
25
|
-
export { HAlertInternetBox, HAlertCopyBox, HAlertInternetConnectionBox, HAlertPresetSave } from './components/editor/HAlertBox';
|
|
26
|
-
export { AlbumImageGallery } from './components/editor/GalleryAlbum/AlbumImageGallery';
|
|
27
|
-
export { default as GalleryImageItem } from './components/editor/GalleryAlbum/ImageItem';
|
|
28
|
-
export { EditorProvider, useEditorContext } from './lib/context/EditorContext';
|
|
29
|
-
export { useImageProcessor } from './lib/hooks/useImageProcessor';
|
|
30
|
-
export { useEditorHeadless } from './lib/hooks/useEditorHeadless';
|
|
31
|
-
export { ImageSize, HonchoEditor, AdjustmentValues, AdjustmentRange, AdjustmentRanges } from './lib/editor/honcho-editor';
|
|
32
|
-
export { default as HPresetDeleteDialog } from './components/editor/HPresetDelete';
|
|
33
|
-
export { default as HModalDialog } from './components/modal/HModalDialog';
|
|
34
|
-
export { default as HModalRename } from './components/modal/HModalRename';
|
|
35
|
-
export { useAdjustmentHistory, type UseAdjustmentHistoryReturn, type HistoryInfo, type HistoryActions, type HistoryConfig } from './hooks/useAdjustmentHistory';
|
|
36
|
-
export { useAdjustmentHistoryBatch, type UseAdjustmentHistoryBatchReturn, type BatchAdjustmentState, type ImageAdjustmentConfig, type BatchHistoryInfo, type BatchHistoryActions, type BatchHistoryConfig } from './hooks/useAdjustmentHistoryBatch';
|
|
37
|
-
export { usePreset, type UsePresetReturn, type PresetInfo, type PresetActions, type PresetOptions } from './hooks/usePreset';
|
|
38
|
-
export { usePaging, type UsePagingReturn, type PagingInfo, type PagingActions, type PagingOptions } from './hooks/usePaging';
|
|
39
|
-
export { default as useColors } from './themes/colors';
|
|
40
|
-
export { default as useHonchoTypography } from './themes/honchoTheme';
|
|
41
|
-
export { default as useIsMobile } from './utils/isMobile';
|
package/dist/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// START: delete later
|
|
2
|
-
export { HonchoEditorBulkDemo } from './hooks/demo/HonchoEditorBulkDemo';
|
|
3
|
-
export { HonchoEditorSingleCleanDemo } from './hooks/demo/HonchoEditorSingleCleanDemo';
|
|
4
|
-
// END
|
|
5
|
-
export { useHonchoEditorSingle } from './hooks/editor/useHonchoEditorSingle';
|
|
6
|
-
export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
|
|
7
|
-
export { default as HHeaderEditor } from './components/editor/HHeaderEditor';
|
|
8
|
-
export { default as HFooter } from './components/editor/HFooter';
|
|
9
|
-
export { default as HAccordionColorAdjustment } from './components/editor/HAccordionColorAdjustment';
|
|
10
|
-
export { default as HAccordionPreset } from './components/editor/HAccordionPreset';
|
|
11
|
-
export { HBaseDialog, HDialogForPreset } from './components/editor/HDialogBox';
|
|
12
|
-
export { HDialogCopy, HDialogPreset } from './components/editor/HDialogCopy';
|
|
13
|
-
export { default as HImageEditorMobile } from './components/editor/HImageEditorMobile';
|
|
14
|
-
export { default as HImageEditorDesktop } from './components/editor/HImageEditorDekstop';
|
|
15
|
-
export { default as HImageEditorBulkDekstop } from './components/editor/HImageEditorBulkDekstop';
|
|
16
|
-
export { default as HImageEditorBulkMobile } from './components/editor/HImageEditorBulkMobile';
|
|
17
|
-
export { default as HBulkAccordionColorAdjustment } from './components/editor/HBulkAccordionColorAdjustment';
|
|
18
|
-
export { default as HBulkPreset } from './components/editor/HBulkPreset';
|
|
19
|
-
export { default as HModalEditorDekstop } from './components/editor/HModalEditorDekstop';
|
|
20
|
-
export { HTextField, HTextFieldRename } from './components/editor/HTextField';
|
|
21
|
-
export { default as HWatermarkView } from './components/editor/HWatermarkView';
|
|
22
|
-
export { default as HModalMobile } from './components/editor/HModalMobile';
|
|
23
|
-
export { default as HPresetOptionsMenu } from './components/editor/HPresetOptionMenu';
|
|
24
|
-
export { HAlertInternetBox, HAlertCopyBox, HAlertInternetConnectionBox, HAlertPresetSave } from './components/editor/HAlertBox';
|
|
25
|
-
export { AlbumImageGallery } from './components/editor/GalleryAlbum/AlbumImageGallery';
|
|
26
|
-
export { default as GalleryImageItem } from './components/editor/GalleryAlbum/ImageItem';
|
|
27
|
-
export { EditorProvider, useEditorContext } from './lib/context/EditorContext';
|
|
28
|
-
export { useImageProcessor } from './lib/hooks/useImageProcessor';
|
|
29
|
-
export { useEditorHeadless } from './lib/hooks/useEditorHeadless';
|
|
30
|
-
export { HonchoEditor } from './lib/editor/honcho-editor';
|
|
31
|
-
export { default as HPresetDeleteDialog } from './components/editor/HPresetDelete';
|
|
32
|
-
export { default as HModalDialog } from './components/modal/HModalDialog';
|
|
33
|
-
export { default as HModalRename } from './components/modal/HModalRename';
|
|
34
|
-
// --- History Hooks ---
|
|
35
|
-
export { useAdjustmentHistory } from './hooks/useAdjustmentHistory';
|
|
36
|
-
export { useAdjustmentHistoryBatch } from './hooks/useAdjustmentHistoryBatch';
|
|
37
|
-
// --- Preset Hook ---
|
|
38
|
-
export { usePreset } from './hooks/usePreset';
|
|
39
|
-
// --- Paging Hook ---
|
|
40
|
-
export { usePaging } from './hooks/usePaging';
|
|
41
|
-
// --- Theme & Utils ---
|
|
42
|
-
export { default as useColors } from './themes/colors';
|
|
43
|
-
export { default as useHonchoTypography } from './themes/honchoTheme';
|
|
44
|
-
export { default as useIsMobile } from './utils/isMobile';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditorProcessingService } from '../context/EditorProcessingService';
|
|
3
|
-
import HonchoEditor from "../editor/honcho-editor";
|
|
4
|
-
interface EditorContextValue {
|
|
5
|
-
isReady: boolean;
|
|
6
|
-
error: Error | null;
|
|
7
|
-
processingService: EditorProcessingService;
|
|
8
|
-
queueStatus: {
|
|
9
|
-
queueLength: number;
|
|
10
|
-
isProcessing: boolean;
|
|
11
|
-
hasProcessor: boolean;
|
|
12
|
-
};
|
|
13
|
-
editor: HonchoEditor | null;
|
|
14
|
-
loadImageFromUrl: ((url: string) => Promise<{
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
}>) | null;
|
|
18
|
-
}
|
|
19
|
-
interface EditorProviderProps {
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
/** URL to the honcho-photo-editor.js script (defaults to '/honcho-photo-editor.js') */
|
|
22
|
-
scriptUrl?: string;
|
|
23
|
-
/** URL to the honcho-photo-editor.wasm file (defaults to '/honcho-photo-editor.wasm') */
|
|
24
|
-
wasmUrl?: string;
|
|
25
|
-
}
|
|
26
|
-
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
27
|
-
export declare const useEditorContext: () => EditorContextValue;
|
|
28
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useEffect, useState } from 'react';
|
|
4
|
-
import { useEditorHeadless } from '../hooks/useEditorHeadless';
|
|
5
|
-
import { EditorProcessingService } from '../context/EditorProcessingService';
|
|
6
|
-
const EditorContext = createContext(null);
|
|
7
|
-
export const EditorProvider = ({ children, scriptUrl = '/honcho-photo-editor.js', wasmUrl = '/honcho-photo-editor.wasm' }) => {
|
|
8
|
-
// Single editor instance for the entire app
|
|
9
|
-
const { editor, isReady, error, processImage, loadImageFromUrl } = useEditorHeadless({ scriptUrl, wasmUrl });
|
|
10
|
-
// Single processing service instance
|
|
11
|
-
const [processingService] = useState(() => new EditorProcessingService());
|
|
12
|
-
const [queueStatus, setQueueStatus] = useState(processingService.getQueueStatus());
|
|
13
|
-
// Connect the editor to the processing service when ready
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (isReady && processImage) {
|
|
16
|
-
console.debug('Connecting editor to processing service - editor ready:', isReady);
|
|
17
|
-
processingService.setProcessor(processImage);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
console.debug('Editor not ready yet - isReady:', isReady, 'processImage:', !!processImage);
|
|
21
|
-
}
|
|
22
|
-
}, [isReady, processImage, processingService]);
|
|
23
|
-
// Update queue status periodically - now event-driven instead of polling
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const updateStatus = () => {
|
|
26
|
-
setQueueStatus(processingService.getQueueStatus());
|
|
27
|
-
};
|
|
28
|
-
// Add listener for immediate updates
|
|
29
|
-
processingService.addStatusChangeListener(updateStatus);
|
|
30
|
-
// Optional: Keep a fallback interval for safety (much less frequent)
|
|
31
|
-
const interval = setInterval(updateStatus, 5000); // 5 seconds instead of 1
|
|
32
|
-
return () => {
|
|
33
|
-
processingService.removeStatusChangeListener(updateStatus);
|
|
34
|
-
clearInterval(interval);
|
|
35
|
-
};
|
|
36
|
-
}, [processingService]);
|
|
37
|
-
// Cleanup on unmount
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
return () => {
|
|
40
|
-
processingService.cleanup(); // Use new cleanup method
|
|
41
|
-
};
|
|
42
|
-
}, [processingService]);
|
|
43
|
-
const contextValue = {
|
|
44
|
-
isReady,
|
|
45
|
-
error,
|
|
46
|
-
processingService,
|
|
47
|
-
queueStatus,
|
|
48
|
-
editor: editor,
|
|
49
|
-
loadImageFromUrl
|
|
50
|
-
};
|
|
51
|
-
return (_jsx(EditorContext.Provider, { value: contextValue, children: children }));
|
|
52
|
-
};
|
|
53
|
-
// Custom hook to use the editor context
|
|
54
|
-
export const useEditorContext = () => {
|
|
55
|
-
const context = useContext(EditorContext);
|
|
56
|
-
if (!context) {
|
|
57
|
-
throw new Error('useEditorContext must be used within an EditorProvider');
|
|
58
|
-
}
|
|
59
|
-
return context;
|
|
60
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { AdjustmentValues } from '../editor/honcho-editor';
|
|
2
|
-
export interface EditorTask {
|
|
3
|
-
id: string;
|
|
4
|
-
path: string;
|
|
5
|
-
frame: string | null;
|
|
6
|
-
adjustments?: Partial<AdjustmentValues>;
|
|
7
|
-
priority?: number;
|
|
8
|
-
abortSignal?: AbortSignal;
|
|
9
|
-
}
|
|
10
|
-
export interface EditorResponse {
|
|
11
|
-
id: string;
|
|
12
|
-
path: string;
|
|
13
|
-
}
|
|
14
|
-
export declare class EditorProcessingService {
|
|
15
|
-
private processingQueue;
|
|
16
|
-
private isProcessing;
|
|
17
|
-
private processImage?;
|
|
18
|
-
private pendingProcessingTimeout?;
|
|
19
|
-
private statusChangeListeners;
|
|
20
|
-
constructor();
|
|
21
|
-
setProcessor(processImage: (task: EditorTask) => Promise<EditorResponse>): void;
|
|
22
|
-
addStatusChangeListener(listener: () => void): void;
|
|
23
|
-
removeStatusChangeListener(listener: () => void): void;
|
|
24
|
-
private notifyStatusChange;
|
|
25
|
-
requestProcessing(task: EditorTask): Promise<EditorResponse>;
|
|
26
|
-
private scheduleProcessing;
|
|
27
|
-
private processQueue;
|
|
28
|
-
private removeFromQueue;
|
|
29
|
-
getQueueStatus(): {
|
|
30
|
-
queueLength: number;
|
|
31
|
-
isProcessing: boolean;
|
|
32
|
-
hasProcessor: boolean;
|
|
33
|
-
};
|
|
34
|
-
clearQueue(): void;
|
|
35
|
-
cleanup(): void;
|
|
36
|
-
}
|