@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,354 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
-
import { Box, Container, Typography, Button, Card, CardMedia, CardContent, Alert, CircularProgress, Paper, Divider, TextField, Stack, Slider, Grid, IconButton, Tooltip, } from '@mui/material';
|
|
4
|
-
import { NavigateBefore, NavigateNext, Undo, Redo, RestartAlt, ZoomIn, ZoomOut, FitScreen, Home, Palette } from '@mui/icons-material';
|
|
5
|
-
import { useHonchoEditorSingle } from '../editor/useHonchoEditorSingle';
|
|
6
|
-
import { useEditorHeadless } from '../../lib/hooks/useEditorHeadless';
|
|
7
|
-
// Mock data and controller (same as before)
|
|
8
|
-
// Mock data for demonstration
|
|
9
|
-
const createMockGallery = (id, adjustments) => ({
|
|
10
|
-
id,
|
|
11
|
-
uid: 'demo-user',
|
|
12
|
-
event_id: 'demo-event',
|
|
13
|
-
download: {
|
|
14
|
-
key: `${id}-download`,
|
|
15
|
-
path: `https://picsum.photos/800/600?random=${id}`,
|
|
16
|
-
size: 1024000,
|
|
17
|
-
width: 800,
|
|
18
|
-
height: 600,
|
|
19
|
-
},
|
|
20
|
-
download_edited: {
|
|
21
|
-
key: `${id}-download-edited`,
|
|
22
|
-
path: `https://picsum.photos/800/600?random=${id}`,
|
|
23
|
-
size: 1024000,
|
|
24
|
-
width: 800,
|
|
25
|
-
height: 600,
|
|
26
|
-
},
|
|
27
|
-
thumbnail: {
|
|
28
|
-
key: `${id}-thumb`,
|
|
29
|
-
path: `https://picsum.photos/300/200?random=${id}`,
|
|
30
|
-
size: 50000,
|
|
31
|
-
width: 300,
|
|
32
|
-
height: 200,
|
|
33
|
-
},
|
|
34
|
-
thumbnail_edited: {
|
|
35
|
-
key: `${id}-thumb-edited`,
|
|
36
|
-
path: `https://picsum.photos/300/200?random=${id}`,
|
|
37
|
-
size: 50000,
|
|
38
|
-
width: 300,
|
|
39
|
-
height: 200,
|
|
40
|
-
},
|
|
41
|
-
is_original: true,
|
|
42
|
-
available: true,
|
|
43
|
-
show_gallery: true,
|
|
44
|
-
editor_config: {
|
|
45
|
-
color_adjustment: {
|
|
46
|
-
temperature: adjustments?.tempScore || 0,
|
|
47
|
-
tint: adjustments?.tintScore || 0,
|
|
48
|
-
vibrance: adjustments?.vibranceScore || 0,
|
|
49
|
-
saturation: adjustments?.saturationScore || 0,
|
|
50
|
-
exposure: adjustments?.exposureScore || 0,
|
|
51
|
-
highlights: adjustments?.highlightsScore || 0,
|
|
52
|
-
shadows: adjustments?.shadowsScore || 0,
|
|
53
|
-
whites: adjustments?.whitesScore || 0,
|
|
54
|
-
blacks: adjustments?.blacksScore || 0,
|
|
55
|
-
contrast: adjustments?.contrastScore || 0,
|
|
56
|
-
clarity: adjustments?.clarityScore || 0,
|
|
57
|
-
sharpness: adjustments?.sharpnessScore || 0,
|
|
58
|
-
},
|
|
59
|
-
transformation_adjustment: [],
|
|
60
|
-
watermarks: [],
|
|
61
|
-
},
|
|
62
|
-
log: {
|
|
63
|
-
created_at: new Date().toISOString(),
|
|
64
|
-
updated_at: new Date().toISOString(),
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
const createMockController = () => {
|
|
68
|
-
console.log('🏭 createMockController() called - Creating new mock controller instance');
|
|
69
|
-
const mockImages = [
|
|
70
|
-
createMockGallery('1', { tempScore: 5, exposureScore: 2 }),
|
|
71
|
-
createMockGallery('2', { contrastScore: -3, clarityScore: 8 }),
|
|
72
|
-
createMockGallery('3', { vibranceScore: 10, saturationScore: 5 }),
|
|
73
|
-
createMockGallery('4', { tempScore: -8, tintScore: 4 }),
|
|
74
|
-
createMockGallery('5', { exposureScore: -5, shadowsScore: 15 }),
|
|
75
|
-
];
|
|
76
|
-
return {
|
|
77
|
-
onGetImage: async (uid, imageId) => {
|
|
78
|
-
console.log(`[Controller] 📷 onGetImage called: uid=${uid}, imageId=${imageId}`);
|
|
79
|
-
await new Promise(resolve => setTimeout(resolve, 300));
|
|
80
|
-
const image = mockImages.find(img => img.id === imageId);
|
|
81
|
-
if (!image)
|
|
82
|
-
throw new Error(`Image ${imageId} not found`);
|
|
83
|
-
console.log(`[Controller] 📷 onGetImage returning image:`, image.id);
|
|
84
|
-
return image;
|
|
85
|
-
},
|
|
86
|
-
getImageList: async (uid, eventId, page) => {
|
|
87
|
-
console.log(`[Controller] 📋 getImageList called: uid=${uid}, eventId=${eventId}, page=${page}`);
|
|
88
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
89
|
-
const pageSize = 4;
|
|
90
|
-
const startIndex = (page - 1) * pageSize;
|
|
91
|
-
const endIndex = startIndex + pageSize;
|
|
92
|
-
const pageImages = mockImages.slice(startIndex, endIndex);
|
|
93
|
-
console.log(`[Controller] 📋 getImageList returning ${pageImages.length} images for page ${page}`);
|
|
94
|
-
return {
|
|
95
|
-
gallery: pageImages,
|
|
96
|
-
limit: pageSize,
|
|
97
|
-
current_page: page,
|
|
98
|
-
prev_page: page > 1 ? page - 1 : 0,
|
|
99
|
-
next_page: endIndex < mockImages.length ? page + 1 : 0,
|
|
100
|
-
sum_of_image: pageImages.length,
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
syncConfig: async (uid) => {
|
|
104
|
-
console.log(`[Controller] 🔄 syncConfig called: uid=${uid}`);
|
|
105
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
106
|
-
},
|
|
107
|
-
handleBack: (uid, imageId) => {
|
|
108
|
-
console.log(`[Controller] ⬅️ handleBack called: uid=${uid}, imageId=${imageId}`);
|
|
109
|
-
console.log(`Back to gallery from image: ${imageId}`);
|
|
110
|
-
},
|
|
111
|
-
getPresets: async (uid) => {
|
|
112
|
-
console.log(`[Controller] 🎨 getPresets called: uid=${uid}`);
|
|
113
|
-
await new Promise(resolve => setTimeout(resolve, 300));
|
|
114
|
-
const presets = [
|
|
115
|
-
{ id: '1', name: 'Warm Sunset', is_default: false, temperature: 15, tint: 5, saturation: 8, vibrance: 12, exposure: 2, contrast: 5, highlights: -10, shadows: 8, whites: 3, blacks: -5, clarity: 4, sharpness: 6 },
|
|
116
|
-
{ id: '2', name: 'Cool Morning', is_default: false, temperature: -12, tint: -3, saturation: -2, vibrance: 5, exposure: 1, contrast: 3, highlights: -5, shadows: 12, whites: 8, blacks: -8, clarity: 6, sharpness: 4 },
|
|
117
|
-
{ id: '3', name: 'High Contrast', is_default: false, temperature: 0, tint: 0, saturation: 5, vibrance: 8, exposure: 0, contrast: 20, highlights: -15, shadows: 15, whites: 10, blacks: -10, clarity: 15, sharpness: 8 },
|
|
118
|
-
];
|
|
119
|
-
console.log(`🎨 getPresets returning ${presets.length} presets`);
|
|
120
|
-
return presets;
|
|
121
|
-
},
|
|
122
|
-
createPreset: async (uid, name, settings) => {
|
|
123
|
-
console.log(`[Controller] ➕ createPreset called: uid=${uid}, name=${name}`, settings);
|
|
124
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
125
|
-
console.log(`Creating preset: ${name}`, settings);
|
|
126
|
-
},
|
|
127
|
-
deletePreset: async (uid, presetId) => {
|
|
128
|
-
console.log(`[Controller] 🗑️ deletePreset called: uid=${uid}, presetId=${presetId}`);
|
|
129
|
-
await new Promise(resolve => setTimeout(resolve, 300));
|
|
130
|
-
console.log(`Deleting preset: ${presetId}`);
|
|
131
|
-
},
|
|
132
|
-
updatePreset: async (uid, data) => {
|
|
133
|
-
console.log(`[Controller] 🔄 updatePreset called: uid=${uid}`, data);
|
|
134
|
-
await new Promise(resolve => setTimeout(resolve, 300));
|
|
135
|
-
console.log(`Updating preset:`, data);
|
|
136
|
-
},
|
|
137
|
-
createEditorConfig: async (uid, payload) => {
|
|
138
|
-
console.log(`[Controller] ⚙️ createEditorConfig called: uid=${uid}`, payload);
|
|
139
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
140
|
-
console.log('Creating editor config:', payload);
|
|
141
|
-
},
|
|
142
|
-
getEditorHistory: async (uid, imageId) => {
|
|
143
|
-
console.log(`[Controller] 📚 getEditorHistory called: uid=${uid}, imageId=${imageId}`);
|
|
144
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
145
|
-
return { current_task_id: "", history: [] };
|
|
146
|
-
},
|
|
147
|
-
getGalleryUpdateTimestamp: async (uid, eventId) => {
|
|
148
|
-
console.log(`[Controller] ⏰ getGalleryUpdateTimestamp called: uid=${uid}, eventId=${eventId}`);
|
|
149
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
150
|
-
return { gallery: [] };
|
|
151
|
-
},
|
|
152
|
-
setHistoryIndex: async (uid, imageId, taskId) => {
|
|
153
|
-
console.log(`[Controller] 📍 setHistoryIndex called: uid=${uid}, imageId=${imageId}, taskId=${taskId}`);
|
|
154
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
155
|
-
console.log(`Setting history index for image ${imageId} to task ${taskId}`);
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
// Dumb Adjustment Slider Component
|
|
160
|
-
const AdjustmentSlider = ({ label, value, field, onValueChange, onDragStart, onDragEnd, isBatchMode, min = -100, max = 100, step = 1 }) => {
|
|
161
|
-
return (_jsxs(Box, { sx: { mb: 2 }, children: [_jsxs(Typography, { variant: "body2", gutterBottom: true, children: [label, ": ", value, isBatchMode && (_jsx(Box, { component: "span", sx: {
|
|
162
|
-
ml: 1,
|
|
163
|
-
px: 1,
|
|
164
|
-
py: 0.25,
|
|
165
|
-
backgroundColor: 'warning.main',
|
|
166
|
-
color: 'warning.contrastText',
|
|
167
|
-
borderRadius: 1,
|
|
168
|
-
fontSize: '0.75rem',
|
|
169
|
-
fontWeight: 'bold'
|
|
170
|
-
}, children: "LIVE EDIT" }))] }), _jsx(Slider, { value: value, onChange: (_, newValue) => {
|
|
171
|
-
const numValue = newValue;
|
|
172
|
-
onValueChange(field, numValue);
|
|
173
|
-
}, onMouseDown: () => {
|
|
174
|
-
if (!isBatchMode) {
|
|
175
|
-
onDragStart();
|
|
176
|
-
}
|
|
177
|
-
}, onMouseUp: () => {
|
|
178
|
-
onDragEnd();
|
|
179
|
-
}, onTouchStart: () => {
|
|
180
|
-
if (!isBatchMode) {
|
|
181
|
-
onDragStart();
|
|
182
|
-
}
|
|
183
|
-
}, onTouchEnd: () => {
|
|
184
|
-
onDragEnd();
|
|
185
|
-
}, min: min, max: max, step: step, valueLabelDisplay: "auto", size: "small" })] }));
|
|
186
|
-
};
|
|
187
|
-
// Dumb Preset Card Component
|
|
188
|
-
const PresetCard = ({ preset, onApply, onDelete, isActive }) => (_jsx(Card, { sx: {
|
|
189
|
-
border: isActive ? 2 : 1,
|
|
190
|
-
borderColor: isActive ? 'primary.main' : 'divider',
|
|
191
|
-
cursor: 'pointer',
|
|
192
|
-
transition: 'all 0.2s',
|
|
193
|
-
'&:hover': {
|
|
194
|
-
boxShadow: 2,
|
|
195
|
-
transform: 'translateY(-1px)',
|
|
196
|
-
}
|
|
197
|
-
}, onClick: () => onApply(preset), children: _jsxs(CardContent, { sx: { p: 2, '&:last-child': { pb: 2 } }, children: [_jsxs(Typography, { variant: "subtitle2", gutterBottom: true, children: [preset.name, isActive && ' ✓'] }), _jsxs(Typography, { variant: "caption", color: "text.secondary", display: "block", sx: { mb: 1 }, children: ["Temp: ", preset.temperature > 0 ? '+' : '', preset.temperature, ", Exp: ", preset.exposure > 0 ? '+' : '', preset.exposure, ", Con: ", preset.contrast > 0 ? '+' : '', preset.contrast] }), _jsxs(Box, { sx: { mt: 1, display: 'flex', gap: 1 }, children: [_jsx(Button, { size: "small", variant: "outlined", onClick: (e) => {
|
|
198
|
-
e.stopPropagation();
|
|
199
|
-
onApply(preset);
|
|
200
|
-
}, children: "Apply" }), _jsx(Button, { size: "small", variant: "outlined", color: "error", onClick: (e) => {
|
|
201
|
-
e.stopPropagation();
|
|
202
|
-
onDelete(preset.id);
|
|
203
|
-
}, children: "Delete" })] })] }) }));
|
|
204
|
-
export const HonchoEditorSingleCleanDemo = () => {
|
|
205
|
-
// Initialize mock controller
|
|
206
|
-
const [controller] = useState(() => createMockController());
|
|
207
|
-
// UI state (only UI-specific state here)
|
|
208
|
-
const [showAdjustments, setShowAdjustments] = useState(true);
|
|
209
|
-
const [newPresetName, setNewPresetName] = useState('');
|
|
210
|
-
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
211
|
-
// Business logic hook - handles adjustments, presets, navigation
|
|
212
|
-
const { state, actions } = useHonchoEditorSingle({
|
|
213
|
-
controller,
|
|
214
|
-
initImageId: '1',
|
|
215
|
-
firebaseUid: 'demo-user'
|
|
216
|
-
});
|
|
217
|
-
// Editor hook - handles editor operations separately
|
|
218
|
-
const editorHeadless = useEditorHeadless({
|
|
219
|
-
scriptUrl: '/honcho-photo-editor.js',
|
|
220
|
-
wasmUrl: '/honcho-photo-editor.wasm'
|
|
221
|
-
});
|
|
222
|
-
// Refs for canvas rendering
|
|
223
|
-
const canvasRef = useRef(null);
|
|
224
|
-
// Load image when gallery data changes
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
if (state.currentImageData && editorHeadless.isReady && editorHeadless.loadImageFromUrl) {
|
|
227
|
-
console.log('Loading image to editor:', state.currentImageData.id);
|
|
228
|
-
setIsImageLoaded(false);
|
|
229
|
-
const imageUrl = state.currentImageData.raw_edited?.path || state.currentImageData.download.path;
|
|
230
|
-
editorHeadless.loadImageFromUrl(imageUrl)
|
|
231
|
-
.then((size) => {
|
|
232
|
-
console.log('Image loaded successfully:', size);
|
|
233
|
-
setIsImageLoaded(true);
|
|
234
|
-
})
|
|
235
|
-
.catch((error) => {
|
|
236
|
-
console.error('Error loading image:', error);
|
|
237
|
-
setIsImageLoaded(false);
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}, [state.currentImageData, editorHeadless.isReady, editorHeadless.loadImageFromUrl]);
|
|
241
|
-
// Apply adjustments to editor when they change
|
|
242
|
-
useEffect(() => {
|
|
243
|
-
if (editorHeadless.editor && isImageLoaded && canvasRef.current) {
|
|
244
|
-
console.log('Applying adjustments to editor:', state.currentAdjustments);
|
|
245
|
-
// Get converted adjustments from business logic hook
|
|
246
|
-
const editorAdjustments = actions.getEditorAdjustments();
|
|
247
|
-
try {
|
|
248
|
-
editorHeadless.editor.setAdjustments(editorAdjustments);
|
|
249
|
-
editorHeadless.editor.processImage();
|
|
250
|
-
editorHeadless.editor.renderToCanvas(canvasRef.current);
|
|
251
|
-
console.log('Rendered to canvas successfully');
|
|
252
|
-
}
|
|
253
|
-
catch (error) {
|
|
254
|
-
console.error('Error rendering to canvas:', error);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}, [state.currentAdjustments, editorHeadless.editor, isImageLoaded, actions]);
|
|
258
|
-
// Helper functions that only handle UI logic
|
|
259
|
-
const handleCreatePreset = async () => {
|
|
260
|
-
if (!newPresetName.trim())
|
|
261
|
-
return;
|
|
262
|
-
try {
|
|
263
|
-
const preset = await actions.createPreset(newPresetName, state.currentAdjustments);
|
|
264
|
-
if (preset) {
|
|
265
|
-
setNewPresetName('');
|
|
266
|
-
console.log('Preset created successfully:', preset);
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
console.error('Failed to create preset');
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
catch (error) {
|
|
273
|
-
console.error('Error creating preset:', error);
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
const navigationNext = useCallback(() => {
|
|
277
|
-
// Must be set to avoid adjust without image
|
|
278
|
-
setIsImageLoaded(false);
|
|
279
|
-
actions.navigateNext();
|
|
280
|
-
}, [actions]);
|
|
281
|
-
const navigationPrev = useCallback(() => {
|
|
282
|
-
// Must be set to avoid adjust without image
|
|
283
|
-
setIsImageLoaded(false);
|
|
284
|
-
actions.navigatePrev();
|
|
285
|
-
}, [actions]);
|
|
286
|
-
const getAdjustmentSummary = (adjustments) => {
|
|
287
|
-
const summary = [];
|
|
288
|
-
if (adjustments.tempScore !== 0)
|
|
289
|
-
summary.push(`Temp: ${adjustments.tempScore > 0 ? '+' : ''}${adjustments.tempScore}`);
|
|
290
|
-
if (adjustments.exposureScore !== 0)
|
|
291
|
-
summary.push(`Exp: ${adjustments.exposureScore > 0 ? '+' : ''}${adjustments.exposureScore}`);
|
|
292
|
-
if (adjustments.contrastScore !== 0)
|
|
293
|
-
summary.push(`Con: ${adjustments.contrastScore > 0 ? '+' : ''}${adjustments.contrastScore}`);
|
|
294
|
-
if (adjustments.clarityScore !== 0)
|
|
295
|
-
summary.push(`Cla: ${adjustments.clarityScore > 0 ? '+' : ''}${adjustments.clarityScore}`);
|
|
296
|
-
return summary.join(', ') || 'No adjustments';
|
|
297
|
-
};
|
|
298
|
-
return (_jsxs(Container, { maxWidth: "xl", sx: { py: 4 }, children: [_jsx(Typography, { variant: "h3", gutterBottom: true, align: "center", children: "Clean Honcho Editor Single Image Demo" }), _jsx(Typography, { variant: "subtitle1", align: "center", color: "text.secondary", gutterBottom: true, children: "This is a \"dumb\" view-only component that consumes state from useHonchoEditorSingle" }), (state.galleryError || state.presetsError) && (_jsx(Alert, { severity: "error", sx: { mb: 3 }, children: state.galleryError || state.presetsError })), _jsxs(Grid, { container: true, spacing: 3, children: [_jsx(Grid, { item: true, xs: 12, md: 8, children: _jsxs(Paper, { sx: { p: 2, mb: 2 }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 2 }, children: [_jsxs(Typography, { variant: "h6", children: ["Image ", state.currentImageData?.id, state.activePreset && ` - ${state.activePreset.name}`] }), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Tooltip, { title: "Previous Image", children: _jsx("span", { children: _jsx(IconButton, { onClick: navigationPrev, disabled: !state.isPrevAvailable || state.isGalleryLoading, children: _jsx(NavigateBefore, {}) }) }) }), _jsx(Tooltip, { title: "Next Image", children: _jsx("span", { children: _jsx(IconButton, { onClick: navigationNext, disabled: !state.isNextAvailable || state.isGalleryLoading, children: _jsx(NavigateNext, {}) }) }) }), _jsx(Tooltip, { title: "Back to Gallery", children: _jsx(IconButton, { onClick: () => console.log('Back to gallery'), children: _jsx(Home, {}) }) }), _jsx(Divider, { orientation: "vertical", flexItem: true }), _jsx(Tooltip, { title: "Zoom In", children: _jsx(IconButton, { onClick: () => console.log('Zoom in'), children: _jsx(ZoomIn, {}) }) }), _jsx(Tooltip, { title: "Zoom Out", children: _jsx(IconButton, { onClick: () => console.log('Zoom out'), children: _jsx(ZoomOut, {}) }) }), _jsx(Tooltip, { title: "Fit to Screen", children: _jsx(IconButton, { onClick: () => console.log('Fit to screen'), children: _jsx(FitScreen, {}) }) }), _jsx(Typography, { variant: "body2", sx: { alignSelf: 'center', minWidth: '60px' }, children: "100%" })] })] }), _jsxs(Box, { sx: {
|
|
299
|
-
position: 'relative',
|
|
300
|
-
width: '100%',
|
|
301
|
-
height: '500px',
|
|
302
|
-
bgcolor: '#f5f5f5',
|
|
303
|
-
border: 1,
|
|
304
|
-
borderColor: 'divider',
|
|
305
|
-
borderRadius: 1,
|
|
306
|
-
overflow: 'hidden',
|
|
307
|
-
display: 'flex',
|
|
308
|
-
alignItems: 'center',
|
|
309
|
-
justifyContent: 'center'
|
|
310
|
-
}, children: [editorHeadless.isReady && (_jsx(Box, { sx: {
|
|
311
|
-
position: 'absolute',
|
|
312
|
-
top: 8,
|
|
313
|
-
right: 8,
|
|
314
|
-
zIndex: 3,
|
|
315
|
-
px: 1,
|
|
316
|
-
py: 0.5,
|
|
317
|
-
backgroundColor: 'success.main',
|
|
318
|
-
color: 'success.contrastText',
|
|
319
|
-
borderRadius: 1,
|
|
320
|
-
fontSize: '0.75rem',
|
|
321
|
-
fontWeight: 'bold'
|
|
322
|
-
}, children: "EDITOR ACTIVE" })), state.currentImageData ? (_jsx(CardMedia, { component: "img", image: state.currentImageData.download.path, alt: `Image ${state.currentImageData.id}`, sx: {
|
|
323
|
-
maxWidth: '100%',
|
|
324
|
-
maxHeight: '100%',
|
|
325
|
-
objectFit: 'contain',
|
|
326
|
-
transition: 'transform 0.1s ease-out',
|
|
327
|
-
opacity: editorHeadless.isReady ? 0.3 : 1,
|
|
328
|
-
zIndex: 1
|
|
329
|
-
} })) : state.isGalleryLoading ? (_jsx(CircularProgress, {})) : (_jsx(Typography, { color: "text.secondary", children: "No image loaded" })), _jsx("canvas", { ref: canvasRef, style: {
|
|
330
|
-
position: 'absolute',
|
|
331
|
-
top: 0,
|
|
332
|
-
left: 0,
|
|
333
|
-
width: '100%',
|
|
334
|
-
height: '100%',
|
|
335
|
-
objectFit: 'contain',
|
|
336
|
-
pointerEvents: 'none',
|
|
337
|
-
zIndex: state.currentImageData && editorHeadless.isReady ? 2 : 0,
|
|
338
|
-
opacity: state.currentImageData && editorHeadless.isReady ? 1 : 0,
|
|
339
|
-
} })] }), _jsxs(Stack, { direction: "row", justifyContent: "center", spacing: 1, sx: { mt: 2 }, children: [_jsx(Tooltip, { title: "Undo", children: _jsx("span", { children: _jsx(Button, { variant: "outlined", size: "small", onClick: actions.undo, disabled: !state.canUndo, startIcon: _jsx(Undo, {}), children: "Undo" }) }) }), _jsx(Tooltip, { title: "Redo", children: _jsx("span", { children: _jsx(Button, { variant: "outlined", size: "small", onClick: actions.redo, disabled: !state.canRedo, startIcon: _jsx(Redo, {}), children: "Redo" }) }) }), _jsx(Tooltip, { title: "Reset All", children: _jsx(Button, { variant: "outlined", size: "small", onClick: actions.reset, color: "warning", startIcon: _jsx(RestartAlt, {}), children: "Reset" }) })] }), _jsx(Box, { sx: { mt: 2, p: 1, bgcolor: 'grey.50', borderRadius: 1 }, children: _jsxs(Typography, { variant: "caption", color: "text.secondary", children: ["Current Adjustments: ", getAdjustmentSummary(state.currentAdjustments), state.isBatchMode && (_jsx(Box, { component: "span", sx: {
|
|
340
|
-
ml: 1,
|
|
341
|
-
px: 1,
|
|
342
|
-
py: 0.25,
|
|
343
|
-
backgroundColor: 'warning.main',
|
|
344
|
-
color: 'warning.contrastText',
|
|
345
|
-
borderRadius: 1,
|
|
346
|
-
fontSize: '0.625rem',
|
|
347
|
-
fontWeight: 'bold'
|
|
348
|
-
}, children: "BATCH MODE" }))] }) })] }) }), _jsxs(Grid, { item: true, xs: 12, md: 4, children: [_jsxs(Paper, { sx: { p: 2, mb: 2 }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 2 }, children: [_jsx(Typography, { variant: "h6", children: "Controls" }), _jsxs(Button, { variant: "outlined", size: "small", onClick: () => setShowAdjustments(!showAdjustments), startIcon: _jsx(Palette, {}), children: [showAdjustments ? 'Hide' : 'Show', " Adjustments"] })] }), showAdjustments && (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "subtitle2", gutterBottom: true, sx: { mt: 2 }, children: "Color" }), _jsx(AdjustmentSlider, { label: "Temperature", value: state.currentAdjustments.tempScore, field: "tempScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Tint", value: state.currentAdjustments.tintScore, field: "tintScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Vibrance", value: state.currentAdjustments.vibranceScore, field: "vibranceScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Saturation", value: state.currentAdjustments.saturationScore, field: "saturationScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(Divider, { sx: { my: 2 } }), _jsx(Typography, { variant: "subtitle2", gutterBottom: true, children: "Light" }), _jsx(AdjustmentSlider, { label: "Exposure", value: state.currentAdjustments.exposureScore, field: "exposureScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Contrast", value: state.currentAdjustments.contrastScore, field: "contrastScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Highlights", value: state.currentAdjustments.highlightsScore, field: "highlightsScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Shadows", value: state.currentAdjustments.shadowsScore, field: "shadowsScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Whites", value: state.currentAdjustments.whitesScore, field: "whitesScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Blacks", value: state.currentAdjustments.blacksScore, field: "blacksScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(Divider, { sx: { my: 2 } }), _jsx(Typography, { variant: "subtitle2", gutterBottom: true, children: "Details" }), _jsx(AdjustmentSlider, { label: "Clarity", value: state.currentAdjustments.clarityScore, field: "clarityScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode }), _jsx(AdjustmentSlider, { label: "Sharpness", value: state.currentAdjustments.sharpnessScore, field: "sharpnessScore", onValueChange: actions.updateAdjustment, onDragStart: actions.startBatchMode, onDragEnd: actions.endBatchMode, isBatchMode: state.isBatchMode })] }))] }), _jsxs(Paper, { sx: { p: 2 }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 2 }, children: [_jsxs(Typography, { variant: "h6", children: ["Presets (", state.presets.length, ")"] }), _jsx(Button, { variant: "outlined", size: "small", onClick: actions.loadPresets, disabled: state.presetsLoading, children: "Refresh" })] }), state.presetsError && (_jsx(Alert, { severity: "error", sx: { mb: 2 }, children: state.presetsError })), state.presetsLoading && (_jsx(Box, { display: "flex", justifyContent: "center", py: 2, children: _jsx(CircularProgress, { size: 20 }) })), _jsxs(Box, { sx: { mb: 2 }, children: [_jsx(Typography, { variant: "subtitle2", gutterBottom: true, children: "Quick Actions" }), _jsxs(Stack, { direction: "row", spacing: 1, flexWrap: "wrap", useFlexGap: true, children: [_jsx(Button, { size: "small", variant: !state.activePreset ? "contained" : "outlined", onClick: actions.reset, children: "Reset All" }), state.activePreset && (_jsxs(Button, { size: "small", variant: "outlined", color: "info", disabled: true, children: ["Active: ", state.activePreset.name] }))] })] }), _jsx(Divider, { sx: { my: 2 } }), _jsx(Stack, { spacing: 1, sx: { maxHeight: '300px', overflowY: 'auto' }, children: state.presets.length === 0 && !state.presetsLoading ? (_jsx(Typography, { variant: "body2", color: "text.secondary", sx: { textAlign: 'center', py: 2 }, children: "No presets available. Create your first preset below!" })) : (state.presets.map((preset) => (_jsx(PresetCard, { preset: preset, onApply: actions.applyPreset, onDelete: actions.deletePreset, isActive: state.activePreset?.id === preset.id }, preset.id)))) }), _jsx(Divider, { sx: { my: 2 } }), _jsx(Typography, { variant: "subtitle2", gutterBottom: true, children: "Create New Preset" }), _jsx(Typography, { variant: "caption", color: "text.secondary", display: "block", sx: { mb: 1 }, children: "Save current adjustments as a new preset" }), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(TextField, { placeholder: "Enter preset name...", value: newPresetName, onChange: (e) => setNewPresetName(e.target.value), size: "small", fullWidth: true, onKeyPress: (e) => {
|
|
349
|
-
if (e.key === 'Enter') {
|
|
350
|
-
handleCreatePreset();
|
|
351
|
-
}
|
|
352
|
-
} }), _jsx(Button, { variant: "contained", size: "small", onClick: handleCreatePreset, disabled: !newPresetName.trim() || state.presetsLoading, children: "Create" })] })] })] })] }), _jsxs(Box, { mt: 4, children: [_jsx(Divider, {}), _jsx(Typography, { variant: "body2", color: "text.secondary", align: "center", sx: { mt: 2 }, children: "Clean Architecture Demo: This component is \"dumb\" and only renders UI. All logic is handled by useHonchoEditorSingle hook." }), _jsx(Paper, { sx: { p: 2, mt: 2, bgcolor: 'grey.50' }, children: _jsxs(Typography, { variant: "caption", display: "block", children: [_jsx("strong", { children: "Debug Info:" }), _jsx("br", {}), "Current Image: ", state.currentImageData?.id, " | Gallery Loading: ", state.isGalleryLoading ? 'Yes' : 'No', " | Image Loaded: ", isImageLoaded ? 'Yes' : 'No', " | Next Available: ", state.isNextAvailable ? 'Yes' : 'No', " | Prev Available: ", state.isPrevAvailable ? 'Yes' : 'No', " | Active Preset: ", state.activePreset?.name || 'None', " | Can Undo: ", state.canUndo ? 'Yes' : 'No', " | Can Redo: ", state.canRedo ? 'Yes' : 'No', " | Batch Mode: ", state.isBatchMode ? 'Yes' : 'No', " | Editor Ready: ", editorHeadless.isReady ? 'Yes' : 'No'] }) })] })] }));
|
|
353
|
-
};
|
|
354
|
-
export default HonchoEditorSingleCleanDemo;
|
package/dist/hooks/demo/index.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
interface Log {
|
|
2
|
-
created_at: string;
|
|
3
|
-
updated_at: string;
|
|
4
|
-
}
|
|
5
|
-
export interface Content {
|
|
6
|
-
key: string;
|
|
7
|
-
path: string;
|
|
8
|
-
size: number;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}
|
|
12
|
-
export interface ColorAdjustment {
|
|
13
|
-
temperature: number;
|
|
14
|
-
tint: number;
|
|
15
|
-
saturation: number;
|
|
16
|
-
vibrance: number;
|
|
17
|
-
exposure: number;
|
|
18
|
-
contrast: number;
|
|
19
|
-
highlights: number;
|
|
20
|
-
shadows: number;
|
|
21
|
-
whites: number;
|
|
22
|
-
blacks: number;
|
|
23
|
-
clarity: number;
|
|
24
|
-
sharpness: number;
|
|
25
|
-
}
|
|
26
|
-
export interface TransformationAdjustment {
|
|
27
|
-
angle_score?: number;
|
|
28
|
-
direction?: "cw" | "ccw";
|
|
29
|
-
scale_score?: number;
|
|
30
|
-
keep_dimension?: boolean;
|
|
31
|
-
flip_mode?: "horizontal" | "vertical" | "mix";
|
|
32
|
-
aspect_ratio?: string;
|
|
33
|
-
width?: number;
|
|
34
|
-
height?: number;
|
|
35
|
-
}
|
|
36
|
-
export interface Watermark {
|
|
37
|
-
path: string;
|
|
38
|
-
max_pct: [number, number];
|
|
39
|
-
anchor: [string, number | null, number[] | null];
|
|
40
|
-
rotate_deg: [number, "cw" | "ccw"];
|
|
41
|
-
}
|
|
42
|
-
export interface EditorConfig {
|
|
43
|
-
color_adjustment: ColorAdjustment;
|
|
44
|
-
transformation_adjustment?: TransformationAdjustment[];
|
|
45
|
-
watermarks?: Watermark[];
|
|
46
|
-
}
|
|
47
|
-
export interface Content {
|
|
48
|
-
key: string;
|
|
49
|
-
path: string;
|
|
50
|
-
size: number;
|
|
51
|
-
width: number;
|
|
52
|
-
height: number;
|
|
53
|
-
}
|
|
54
|
-
export interface GallerySetup {
|
|
55
|
-
src: string;
|
|
56
|
-
original: string;
|
|
57
|
-
srcSet?: string | string[] | undefined;
|
|
58
|
-
sizes?: string | string[] | undefined;
|
|
59
|
-
width: number;
|
|
60
|
-
height: number;
|
|
61
|
-
alt: string | undefined;
|
|
62
|
-
key: string | undefined;
|
|
63
|
-
frame?: string | undefined;
|
|
64
|
-
isSelected?: boolean | undefined;
|
|
65
|
-
}
|
|
66
|
-
export interface Gallery {
|
|
67
|
-
id: string;
|
|
68
|
-
uid: string;
|
|
69
|
-
event_id: string;
|
|
70
|
-
download: Content;
|
|
71
|
-
download_edited: Content;
|
|
72
|
-
raw?: Content;
|
|
73
|
-
raw_edited?: Content;
|
|
74
|
-
raw_preview?: Content;
|
|
75
|
-
raw_thumbnail?: Content;
|
|
76
|
-
original?: Content;
|
|
77
|
-
original_edited?: Content;
|
|
78
|
-
large?: Content;
|
|
79
|
-
large_edited?: Content;
|
|
80
|
-
medium?: Content;
|
|
81
|
-
medium_edited?: Content;
|
|
82
|
-
small?: Content;
|
|
83
|
-
small_edited?: Content;
|
|
84
|
-
mini?: Content;
|
|
85
|
-
mini_edited?: Content;
|
|
86
|
-
create_from?: string[];
|
|
87
|
-
thumbnail: Content;
|
|
88
|
-
thumbnail_edited: Content;
|
|
89
|
-
is_original: boolean;
|
|
90
|
-
available: boolean;
|
|
91
|
-
show_gallery: boolean;
|
|
92
|
-
editor_config?: EditorConfig;
|
|
93
|
-
log: Log;
|
|
94
|
-
}
|
|
95
|
-
export interface ResponseGalleryPaging {
|
|
96
|
-
gallery: Gallery[];
|
|
97
|
-
limit: number;
|
|
98
|
-
current_page: number;
|
|
99
|
-
prev_page: number;
|
|
100
|
-
next_page: number;
|
|
101
|
-
sum_of_image?: number;
|
|
102
|
-
}
|
|
103
|
-
export interface EditorHistoryEntry {
|
|
104
|
-
id: string;
|
|
105
|
-
gallery_id: string;
|
|
106
|
-
event_id: string;
|
|
107
|
-
task_id: string;
|
|
108
|
-
editor_config: EditorConfig;
|
|
109
|
-
log: Log;
|
|
110
|
-
}
|
|
111
|
-
export interface CreateEditorTaskRequest {
|
|
112
|
-
gallery_id: string;
|
|
113
|
-
task_id: string;
|
|
114
|
-
color_adjustment: ColorAdjustment;
|
|
115
|
-
replace_from?: string;
|
|
116
|
-
}
|
|
117
|
-
export interface GetHistoryResponse {
|
|
118
|
-
current_task_id: string;
|
|
119
|
-
history: EditorHistoryEntry[];
|
|
120
|
-
}
|
|
121
|
-
export interface GetGalleryUpdateTimestampResponse {
|
|
122
|
-
gallery: string[];
|
|
123
|
-
}
|
|
124
|
-
export interface AdjustmentState {
|
|
125
|
-
tempScore: number;
|
|
126
|
-
tintScore: number;
|
|
127
|
-
vibranceScore: number;
|
|
128
|
-
saturationScore: number;
|
|
129
|
-
exposureScore: number;
|
|
130
|
-
highlightsScore: number;
|
|
131
|
-
shadowsScore: number;
|
|
132
|
-
whitesScore: number;
|
|
133
|
-
blacksScore: number;
|
|
134
|
-
contrastScore: number;
|
|
135
|
-
clarityScore: number;
|
|
136
|
-
sharpnessScore: number;
|
|
137
|
-
}
|
|
138
|
-
export interface Preset {
|
|
139
|
-
id: string;
|
|
140
|
-
name: string;
|
|
141
|
-
is_default: boolean;
|
|
142
|
-
temperature: number;
|
|
143
|
-
tint: number;
|
|
144
|
-
saturation: number;
|
|
145
|
-
vibrance: number;
|
|
146
|
-
exposure: number;
|
|
147
|
-
contrast: number;
|
|
148
|
-
highlights: number;
|
|
149
|
-
shadows: number;
|
|
150
|
-
whites: number;
|
|
151
|
-
blacks: number;
|
|
152
|
-
clarity: number;
|
|
153
|
-
sharpness: number;
|
|
154
|
-
}
|
|
155
|
-
export interface Controller {
|
|
156
|
-
onGetImage(firebaseUid: string, imageID: string): Promise<Gallery>;
|
|
157
|
-
getImageList(firebaseUid: string, eventId: string, page: number): Promise<ResponseGalleryPaging>;
|
|
158
|
-
syncConfig(firebaseUid: string): Promise<void>;
|
|
159
|
-
handleBack(firebaseUid: string, imageID: string): void;
|
|
160
|
-
getPresets(firebaseUid: string): Promise<Preset[]>;
|
|
161
|
-
createPreset(firebaseUid: string, name: string, settings: AdjustmentState): Promise<void>;
|
|
162
|
-
deletePreset(firebaseUid: string, presetId: string): Promise<void>;
|
|
163
|
-
updatePreset(firebaseUid: string, data: Preset): Promise<void>;
|
|
164
|
-
createEditorConfig(firebaseUid: string, payload: CreateEditorTaskRequest): Promise<void>;
|
|
165
|
-
getEditorHistory(firebaseUid: string, imageID: string): Promise<GetHistoryResponse>;
|
|
166
|
-
getGalleryUpdateTimestamp(firebaseUid: string, eventID: string, timestamp: number): Promise<GetGalleryUpdateTimestampResponse>;
|
|
167
|
-
setHistoryIndex(firebaseUid: string, imageID: string, taskID: string): Promise<void>;
|
|
168
|
-
}
|
|
169
|
-
export interface ImageItem {
|
|
170
|
-
id: string;
|
|
171
|
-
url: string;
|
|
172
|
-
file: File;
|
|
173
|
-
}
|
|
174
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { SelectChangeEvent } from "@mui/material";
|
|
2
|
-
import { Controller, Preset } from './type';
|
|
3
|
-
import { AdjustmentValues } from "../../lib/editor/honcho-editor";
|
|
4
|
-
export interface PhotoData {
|
|
5
|
-
key: string;
|
|
6
|
-
src: string;
|
|
7
|
-
original: string;
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
alt: string;
|
|
11
|
-
isSelected: boolean;
|
|
12
|
-
adjustments?: Partial<AdjustmentValues>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Hook for bulk photo editing with multi-image backend synchronization.
|
|
16
|
-
*
|
|
17
|
-
* **Multi-Image Backend Sync:**
|
|
18
|
-
* - Each selected image maintains its own history and backend state
|
|
19
|
-
* - History operations (undo/redo) trigger separate controller.setHistoryIndex() calls for each selected image
|
|
20
|
-
* - Preset application triggers separate controller.createEditorConfig() calls for each selected image
|
|
21
|
-
* - Adjustment changes trigger separate controller.createEditorConfig() calls for each selected image
|
|
22
|
-
*
|
|
23
|
-
* **Key Features:**
|
|
24
|
-
* - Individual history tracking per image with backend persistence
|
|
25
|
-
* - Bulk operations that respect per-image differences
|
|
26
|
-
* - Automatic backend synchronization for all state changes
|
|
27
|
-
* - Comprehensive logging of multi-image operations
|
|
28
|
-
*/
|
|
29
|
-
export declare function useHonchoEditorBulk(controller: Controller, eventID: string, firebaseUid: string): {
|
|
30
|
-
imageData: PhotoData[];
|
|
31
|
-
isLoading: boolean;
|
|
32
|
-
error: string | null;
|
|
33
|
-
selectedIds: string[];
|
|
34
|
-
hasMore: boolean;
|
|
35
|
-
handleBackCallbackBulk: () => void;
|
|
36
|
-
presets: Preset[];
|
|
37
|
-
selectedBulkPreset: string;
|
|
38
|
-
activePreset: Preset | null;
|
|
39
|
-
handleSelectBulkPreset: (event: SelectChangeEvent<string>) => void;
|
|
40
|
-
presetActions: import("../usePreset").PresetActions;
|
|
41
|
-
handleToggleImageSelection: (imageId: string) => void;
|
|
42
|
-
handleLoadMore: () => Promise<void>;
|
|
43
|
-
handleRefresh: () => Promise<void>;
|
|
44
|
-
handleBulkTempDecreaseMax: () => void;
|
|
45
|
-
handleBulkTempDecrease: () => void;
|
|
46
|
-
handleBulkTempIncrease: () => void;
|
|
47
|
-
handleBulkTempIncreaseMax: () => void;
|
|
48
|
-
handleBulkTintDecreaseMax: () => void;
|
|
49
|
-
handleBulkTintDecrease: () => void;
|
|
50
|
-
handleBulkTintIncrease: () => void;
|
|
51
|
-
handleBulkTintIncreaseMax: () => void;
|
|
52
|
-
handleBulkVibranceDecreaseMax: () => void;
|
|
53
|
-
handleBulkVibranceDecrease: () => void;
|
|
54
|
-
handleBulkVibranceIncrease: () => void;
|
|
55
|
-
handleBulkVibranceIncreaseMax: () => void;
|
|
56
|
-
handleBulkSaturationDecreaseMax: () => void;
|
|
57
|
-
handleBulkSaturationDecrease: () => void;
|
|
58
|
-
handleBulkSaturationIncrease: () => void;
|
|
59
|
-
handleBulkSaturationIncreaseMax: () => void;
|
|
60
|
-
handleBulkExposureDecreaseMax: () => void;
|
|
61
|
-
handleBulkExposureDecrease: () => void;
|
|
62
|
-
handleBulkExposureIncrease: () => void;
|
|
63
|
-
handleBulkExposureIncreaseMax: () => void;
|
|
64
|
-
handleBulkContrastDecreaseMax: () => void;
|
|
65
|
-
handleBulkContrastDecrease: () => void;
|
|
66
|
-
handleBulkContrastIncrease: () => void;
|
|
67
|
-
handleBulkContrastIncreaseMax: () => void;
|
|
68
|
-
handleBulkHighlightsDecreaseMax: () => void;
|
|
69
|
-
handleBulkHighlightsDecrease: () => void;
|
|
70
|
-
handleBulkHighlightsIncrease: () => void;
|
|
71
|
-
handleBulkHighlightsIncreaseMax: () => void;
|
|
72
|
-
handleBulkShadowsDecreaseMax: () => void;
|
|
73
|
-
handleBulkShadowsDecrease: () => void;
|
|
74
|
-
handleBulkShadowsIncrease: () => void;
|
|
75
|
-
handleBulkShadowsIncreaseMax: () => void;
|
|
76
|
-
handleBulkWhitesDecreaseMax: () => void;
|
|
77
|
-
handleBulkWhitesDecrease: () => void;
|
|
78
|
-
handleBulkWhitesIncrease: () => void;
|
|
79
|
-
handleBulkWhitesIncreaseMax: () => void;
|
|
80
|
-
handleBulkBlacksDecreaseMax: () => void;
|
|
81
|
-
handleBulkBlacksDecrease: () => void;
|
|
82
|
-
handleBulkBlacksIncrease: () => void;
|
|
83
|
-
handleBulkBlacksIncreaseMax: () => void;
|
|
84
|
-
handleBulkClarityDecreaseMax: () => void;
|
|
85
|
-
handleBulkClarityDecrease: () => void;
|
|
86
|
-
handleBulkClarityIncrease: () => void;
|
|
87
|
-
handleBulkClarityIncreaseMax: () => void;
|
|
88
|
-
handleBulkSharpnessDecreaseMax: () => void;
|
|
89
|
-
handleBulkSharpnessDecrease: () => void;
|
|
90
|
-
handleBulkSharpnessIncrease: () => void;
|
|
91
|
-
handleBulkSharpnessIncreaseMax: () => void;
|
|
92
|
-
handleUndo: () => void;
|
|
93
|
-
handleRedo: () => void;
|
|
94
|
-
handleReset: (imageIds?: string[]) => void;
|
|
95
|
-
historyInfo: import("../useAdjustmentHistoryBatch").BatchHistoryInfo;
|
|
96
|
-
};
|