@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,249 +0,0 @@
|
|
|
1
|
-
// Simple priority queue implementation using binary heap
|
|
2
|
-
class PriorityQueue {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.heap = [];
|
|
5
|
-
}
|
|
6
|
-
// Insert item maintaining priority order - O(log n)
|
|
7
|
-
enqueue(item) {
|
|
8
|
-
this.heap.push(item);
|
|
9
|
-
this.heapifyUp(this.heap.length - 1);
|
|
10
|
-
}
|
|
11
|
-
// Remove highest priority item - O(log n)
|
|
12
|
-
dequeue() {
|
|
13
|
-
if (this.heap.length === 0)
|
|
14
|
-
return undefined;
|
|
15
|
-
if (this.heap.length === 1)
|
|
16
|
-
return this.heap.pop();
|
|
17
|
-
const root = this.heap[0];
|
|
18
|
-
this.heap[0] = this.heap.pop();
|
|
19
|
-
this.heapifyDown(0);
|
|
20
|
-
return root;
|
|
21
|
-
}
|
|
22
|
-
get length() {
|
|
23
|
-
return this.heap.length;
|
|
24
|
-
}
|
|
25
|
-
clear() {
|
|
26
|
-
return this.heap.splice(0);
|
|
27
|
-
}
|
|
28
|
-
// Remove item by ID (for cancellation)
|
|
29
|
-
removeById(id) {
|
|
30
|
-
const index = this.heap.findIndex(item => item.id === id);
|
|
31
|
-
if (index === -1)
|
|
32
|
-
return false;
|
|
33
|
-
// Replace with last element and heapify
|
|
34
|
-
const removed = this.heap[index];
|
|
35
|
-
if (index === this.heap.length - 1) {
|
|
36
|
-
this.heap.pop();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.heap[index] = this.heap.pop();
|
|
40
|
-
// Re-heapify from this position
|
|
41
|
-
this.heapifyDown(index);
|
|
42
|
-
this.heapifyUp(index);
|
|
43
|
-
}
|
|
44
|
-
console.debug(`Removed task ${id} from queue`);
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
heapifyUp(index) {
|
|
48
|
-
while (index > 0) {
|
|
49
|
-
const parentIndex = Math.floor((index - 1) / 2);
|
|
50
|
-
if (this.compare(this.heap[index], this.heap[parentIndex]) <= 0)
|
|
51
|
-
break;
|
|
52
|
-
[this.heap[index], this.heap[parentIndex]] = [this.heap[parentIndex], this.heap[index]];
|
|
53
|
-
index = parentIndex;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
heapifyDown(index) {
|
|
57
|
-
while (true) {
|
|
58
|
-
let maxIndex = index;
|
|
59
|
-
const leftChild = 2 * index + 1;
|
|
60
|
-
const rightChild = 2 * index + 2;
|
|
61
|
-
if (leftChild < this.heap.length && this.compare(this.heap[leftChild], this.heap[maxIndex]) > 0) {
|
|
62
|
-
maxIndex = leftChild;
|
|
63
|
-
}
|
|
64
|
-
if (rightChild < this.heap.length && this.compare(this.heap[rightChild], this.heap[maxIndex]) > 0) {
|
|
65
|
-
maxIndex = rightChild;
|
|
66
|
-
}
|
|
67
|
-
if (maxIndex === index)
|
|
68
|
-
break;
|
|
69
|
-
[this.heap[index], this.heap[maxIndex]] = [this.heap[maxIndex], this.heap[index]];
|
|
70
|
-
index = maxIndex;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// Compare function: higher priority first, then older timestamp
|
|
74
|
-
compare(a, b) {
|
|
75
|
-
if (a.priority !== b.priority) {
|
|
76
|
-
return (a.priority || 0) - (b.priority || 0);
|
|
77
|
-
}
|
|
78
|
-
return b.timestamp - a.timestamp; // Older first (reversed for min-heap behavior)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
export class EditorProcessingService {
|
|
82
|
-
constructor() {
|
|
83
|
-
this.processingQueue = new PriorityQueue();
|
|
84
|
-
this.isProcessing = false;
|
|
85
|
-
this.statusChangeListeners = [];
|
|
86
|
-
console.debug('EditorProcessingService created');
|
|
87
|
-
}
|
|
88
|
-
// Set the processing function from the editor
|
|
89
|
-
setProcessor(processImage) {
|
|
90
|
-
this.processImage = processImage;
|
|
91
|
-
console.debug('Editor processor set, queue length:', this.processingQueue.length);
|
|
92
|
-
// Start processing if there are queued items
|
|
93
|
-
if (this.processingQueue.length > 0) {
|
|
94
|
-
this.scheduleProcessing();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// Add listener for status changes
|
|
98
|
-
addStatusChangeListener(listener) {
|
|
99
|
-
this.statusChangeListeners.push(listener);
|
|
100
|
-
}
|
|
101
|
-
// Remove status change listener
|
|
102
|
-
removeStatusChangeListener(listener) {
|
|
103
|
-
const index = this.statusChangeListeners.indexOf(listener);
|
|
104
|
-
if (index > -1) {
|
|
105
|
-
this.statusChangeListeners.splice(index, 1);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// Notify status change listeners
|
|
109
|
-
notifyStatusChange() {
|
|
110
|
-
this.statusChangeListeners.forEach(listener => listener());
|
|
111
|
-
}
|
|
112
|
-
// Add task to processing queue
|
|
113
|
-
async requestProcessing(task) {
|
|
114
|
-
return new Promise((resolve, reject) => {
|
|
115
|
-
// Check if already aborted before adding to queue
|
|
116
|
-
if (task.abortSignal?.aborted) {
|
|
117
|
-
console.debug(`Task ${task.id} already aborted, not adding to queue`);
|
|
118
|
-
reject(new Error('Task aborted before processing'));
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
// Validate that we have a processor
|
|
122
|
-
if (!this.processImage) {
|
|
123
|
-
console.warn('No processor available, rejecting task:', task.id);
|
|
124
|
-
reject(new Error('Editor not ready - processor not set'));
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const queueItem = {
|
|
128
|
-
...task,
|
|
129
|
-
priority: task.priority || 0,
|
|
130
|
-
resolve,
|
|
131
|
-
reject,
|
|
132
|
-
timestamp: Date.now(),
|
|
133
|
-
abortSignal: task.abortSignal,
|
|
134
|
-
};
|
|
135
|
-
// Set up abort listener to remove from queue if cancelled
|
|
136
|
-
if (task.abortSignal) {
|
|
137
|
-
const abortHandler = () => {
|
|
138
|
-
console.debug(`Task ${task.id} aborted, removing from queue if still pending`);
|
|
139
|
-
this.removeFromQueue(task.id);
|
|
140
|
-
reject(new Error('Task aborted'));
|
|
141
|
-
};
|
|
142
|
-
task.abortSignal.addEventListener('abort', abortHandler, { once: true });
|
|
143
|
-
}
|
|
144
|
-
// Add to priority queue - O(log n)
|
|
145
|
-
this.processingQueue.enqueue(queueItem);
|
|
146
|
-
console.debug(`Added task ${task.id} to queue. Queue length: ${this.processingQueue.length}`);
|
|
147
|
-
// Notify status change
|
|
148
|
-
this.notifyStatusChange();
|
|
149
|
-
// Schedule processing with debouncing
|
|
150
|
-
this.scheduleProcessing();
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
// Debounced processing to avoid starting processing on every single addition
|
|
154
|
-
scheduleProcessing() {
|
|
155
|
-
if (this.pendingProcessingTimeout) {
|
|
156
|
-
clearTimeout(this.pendingProcessingTimeout);
|
|
157
|
-
}
|
|
158
|
-
this.pendingProcessingTimeout = setTimeout(() => {
|
|
159
|
-
this.processQueue();
|
|
160
|
-
}, 5); // 5ms debounce
|
|
161
|
-
}
|
|
162
|
-
// Process queue sequentially
|
|
163
|
-
async processQueue() {
|
|
164
|
-
if (this.isProcessing || this.processingQueue.length === 0 || !this.processImage) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
this.isProcessing = true;
|
|
168
|
-
this.notifyStatusChange();
|
|
169
|
-
console.debug('Starting queue processing...');
|
|
170
|
-
while (this.processingQueue.length > 0) {
|
|
171
|
-
// Get highest priority item - O(log n) vs O(n log n) sorting
|
|
172
|
-
const item = this.processingQueue.dequeue();
|
|
173
|
-
// Check if the item was aborted before processing
|
|
174
|
-
if (item.abortSignal?.aborted) {
|
|
175
|
-
console.debug(`Skipping aborted task ${item.id}`);
|
|
176
|
-
item.reject(new Error('Task aborted'));
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
console.debug(`Processing task ${item.id} (priority: ${item.priority || 0}, queue remaining: ${this.processingQueue.length})`);
|
|
180
|
-
try {
|
|
181
|
-
// Check abort signal again before actual processing
|
|
182
|
-
if (item.abortSignal?.aborted) {
|
|
183
|
-
throw new Error('Task aborted during processing');
|
|
184
|
-
}
|
|
185
|
-
const result = await this.processImage(item);
|
|
186
|
-
// Final check before resolving
|
|
187
|
-
if (!item.abortSignal?.aborted) {
|
|
188
|
-
item.resolve(result);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
item.reject(new Error('Task aborted after processing'));
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
catch (error) {
|
|
195
|
-
console.error(`Failed to process task ${item.id}:`, error);
|
|
196
|
-
item.reject(error instanceof Error ? error : new Error(String(error)));
|
|
197
|
-
}
|
|
198
|
-
// Yield control to browser for UI updates - more efficient than setTimeout
|
|
199
|
-
await new Promise(resolve => {
|
|
200
|
-
if (typeof requestIdleCallback !== 'undefined') {
|
|
201
|
-
requestIdleCallback(resolve);
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
// Fallback for environments without requestIdleCallback
|
|
205
|
-
setTimeout(resolve, 0);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
// Notify status change after each item
|
|
209
|
-
this.notifyStatusChange();
|
|
210
|
-
}
|
|
211
|
-
this.isProcessing = false;
|
|
212
|
-
this.notifyStatusChange();
|
|
213
|
-
console.debug('Queue processing complete');
|
|
214
|
-
}
|
|
215
|
-
// Remove task from queue by ID
|
|
216
|
-
removeFromQueue(id) {
|
|
217
|
-
const removed = this.processingQueue.removeById(id);
|
|
218
|
-
if (removed) {
|
|
219
|
-
this.notifyStatusChange();
|
|
220
|
-
}
|
|
221
|
-
return removed;
|
|
222
|
-
}
|
|
223
|
-
// Get current queue status
|
|
224
|
-
getQueueStatus() {
|
|
225
|
-
return {
|
|
226
|
-
queueLength: this.processingQueue.length,
|
|
227
|
-
isProcessing: this.isProcessing,
|
|
228
|
-
hasProcessor: !!this.processImage,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
// Clear the queue (useful for cleanup)
|
|
232
|
-
clearQueue() {
|
|
233
|
-
const clearedItems = this.processingQueue.clear();
|
|
234
|
-
clearedItems.forEach(item => {
|
|
235
|
-
item.reject(new Error('Queue cleared'));
|
|
236
|
-
});
|
|
237
|
-
this.notifyStatusChange();
|
|
238
|
-
console.debug(`Cleared ${clearedItems.length} items from queue`);
|
|
239
|
-
}
|
|
240
|
-
// Cleanup method for removing timeouts
|
|
241
|
-
cleanup() {
|
|
242
|
-
if (this.pendingProcessingTimeout) {
|
|
243
|
-
clearTimeout(this.pendingProcessingTimeout);
|
|
244
|
-
this.pendingProcessingTimeout = undefined;
|
|
245
|
-
}
|
|
246
|
-
this.clearQueue();
|
|
247
|
-
this.statusChangeListeners.length = 0;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
export class HonchoEditor {
|
|
2
|
-
wasmModule: any;
|
|
3
|
-
isInitialized: boolean;
|
|
4
|
-
currentImageData: any;
|
|
5
|
-
canvas: HTMLCanvasElement | null;
|
|
6
|
-
currentWidth: number;
|
|
7
|
-
currentHeight: number;
|
|
8
|
-
/**
|
|
9
|
-
* Initialize the WASM module
|
|
10
|
-
* @param {boolean} verbose - Enable verbose logging (default: false)
|
|
11
|
-
*/
|
|
12
|
-
initialize(verbose?: boolean): Promise<boolean>;
|
|
13
|
-
/**
|
|
14
|
-
* Clean up resources before loading a new image
|
|
15
|
-
*/
|
|
16
|
-
cleanupForNewImage(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Load image from File object (drag & drop, file input)
|
|
19
|
-
*/
|
|
20
|
-
loadImageFromFile(file: any): Promise<any>;
|
|
21
|
-
/**
|
|
22
|
-
* Load image from URL
|
|
23
|
-
*/
|
|
24
|
-
loadImageFromUrl(url: any): Promise<any>;
|
|
25
|
-
/**
|
|
26
|
-
* Load image from HTML Image element
|
|
27
|
-
*/
|
|
28
|
-
loadImageFromImageElement(img: any): {
|
|
29
|
-
width: any;
|
|
30
|
-
height: any;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Load image from ImageData
|
|
34
|
-
*/
|
|
35
|
-
loadImageFromImageData(imageData: any): {
|
|
36
|
-
width: any;
|
|
37
|
-
height: any;
|
|
38
|
-
};
|
|
39
|
-
setExposure(value: any): void;
|
|
40
|
-
setContrast(value: any): void;
|
|
41
|
-
setHighlights(value: any): void;
|
|
42
|
-
setShadows(value: any): void;
|
|
43
|
-
setSaturation(value: any): void;
|
|
44
|
-
setVibrance(value: any): void;
|
|
45
|
-
setTemperature(value: any): void;
|
|
46
|
-
setTint(value: any): void;
|
|
47
|
-
setBlacks(value: any): void;
|
|
48
|
-
setWhites(value: any): void;
|
|
49
|
-
setClarity(value: any): void;
|
|
50
|
-
setSharpness(value: any): void;
|
|
51
|
-
/**
|
|
52
|
-
* Set multiple adjustments at once
|
|
53
|
-
*/
|
|
54
|
-
setAdjustments(adjustments: any): void;
|
|
55
|
-
/**
|
|
56
|
-
* Reset all adjustments to default values
|
|
57
|
-
*/
|
|
58
|
-
resetAdjustments(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Set a frame overlay from raw image data
|
|
61
|
-
* @param {Uint8Array} data - Raw RGBA image data
|
|
62
|
-
* @param {number} width - Frame width
|
|
63
|
-
* @param {number} height - Frame height
|
|
64
|
-
* @param {number} channels - Number of channels (usually 4 for RGBA)
|
|
65
|
-
* @returns {boolean} - true if frame was set successfully
|
|
66
|
-
*/
|
|
67
|
-
setFrame(data: Uint8Array, width: number, height: number, channels?: number): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Set a frame overlay from an ImageData object
|
|
70
|
-
* The frame will be scaled to match the image size and composited on top
|
|
71
|
-
* @param {ImageData} frameImageData - Frame image data (preferably with alpha channel)
|
|
72
|
-
* @returns {boolean} - true if frame was set successfully
|
|
73
|
-
*/
|
|
74
|
-
setFrameFromImageData(frameImageData: ImageData): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Set a frame overlay from an HTML Image element
|
|
77
|
-
* @param {HTMLImageElement} frameImage - Frame image element
|
|
78
|
-
* @returns {boolean} - true if frame was set successfully
|
|
79
|
-
*/
|
|
80
|
-
setFrameFromImage(frameImage: HTMLImageElement): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Set a frame overlay from a Canvas element
|
|
83
|
-
* @param {HTMLCanvasElement} frameCanvas - Frame canvas element
|
|
84
|
-
* @returns {boolean} - true if frame was set successfully
|
|
85
|
-
*/
|
|
86
|
-
setFrameFromCanvas(frameCanvas: HTMLCanvasElement): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Clear the current frame overlay
|
|
89
|
-
*/
|
|
90
|
-
clearFrame(): void;
|
|
91
|
-
/**
|
|
92
|
-
* Check if a frame is currently set
|
|
93
|
-
* @returns {boolean} - true if a frame is set
|
|
94
|
-
*/
|
|
95
|
-
hasFrame(): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* One-shot processing: load image, apply adjustments, get result
|
|
98
|
-
* Most efficient for single image processing or batch operations
|
|
99
|
-
*
|
|
100
|
-
* @param {File|ImageData|HTMLImageElement} imageSource - Image source (File, ImageData, or Image element)
|
|
101
|
-
* @param {Object} adjustments - Object containing adjustment values (-100 to 100)
|
|
102
|
-
* @param {File|ImageData|HTMLImageElement|null} frameSource - Optional frame source
|
|
103
|
-
* @returns {ImageData} - Processed image data
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* // Basic usage
|
|
107
|
-
* const result = await editor.processImageOneShot(imageFile, {
|
|
108
|
-
* exposure: 20,
|
|
109
|
-
* contrast: 15,
|
|
110
|
-
* saturation: 10
|
|
111
|
-
* });
|
|
112
|
-
*
|
|
113
|
-
* // With frame
|
|
114
|
-
* const result = await editor.processImageOneShot(imageFile, {
|
|
115
|
-
* exposure: 20,
|
|
116
|
-
* contrast: 15
|
|
117
|
-
* }, frameFile);
|
|
118
|
-
*
|
|
119
|
-
* // All adjustments
|
|
120
|
-
* const result = await editor.processImageOneShot(imageFile, {
|
|
121
|
-
* temperature: 10,
|
|
122
|
-
* tint: -5,
|
|
123
|
-
* exposure: 20,
|
|
124
|
-
* contrast: 15,
|
|
125
|
-
* highlights: -20,
|
|
126
|
-
* shadows: 30,
|
|
127
|
-
* saturation: 25,
|
|
128
|
-
* vibrance: 20,
|
|
129
|
-
* whites: 10,
|
|
130
|
-
* blacks: -10,
|
|
131
|
-
* clarity: 15,
|
|
132
|
-
* sharpness: 20
|
|
133
|
-
* });
|
|
134
|
-
*/
|
|
135
|
-
processImageOneShot(imageSource: File | ImageData | HTMLImageElement, adjustments?: Object, frameSource?: File | ImageData | HTMLImageElement | null): ImageData;
|
|
136
|
-
/**
|
|
137
|
-
* Helper method to load frame from File (for processImageOneShot)
|
|
138
|
-
*/
|
|
139
|
-
setFrameFromFile(frameFile: any): Promise<any>;
|
|
140
|
-
/**
|
|
141
|
-
* Manual processing trigger - call this after setting adjustments
|
|
142
|
-
*/
|
|
143
|
-
processImage(): void;
|
|
144
|
-
/**
|
|
145
|
-
* GPU Path: Render to canvas for real-time preview (<1ms)
|
|
146
|
-
*/
|
|
147
|
-
renderToCanvas(canvas: any): void;
|
|
148
|
-
/**
|
|
149
|
-
* CPU Path: Get processed image data for export (50-100ms)
|
|
150
|
-
*/
|
|
151
|
-
getProcessedImageData(): ImageData;
|
|
152
|
-
/**
|
|
153
|
-
* Get current image dimensions
|
|
154
|
-
*/
|
|
155
|
-
getImageSize(): {
|
|
156
|
-
width: number;
|
|
157
|
-
height: number;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Get current image width
|
|
161
|
-
*/
|
|
162
|
-
getWidth(): number;
|
|
163
|
-
/**
|
|
164
|
-
* Get current image height
|
|
165
|
-
*/
|
|
166
|
-
getHeight(): number;
|
|
167
|
-
/**
|
|
168
|
-
* Check if editor is initialized
|
|
169
|
-
*/
|
|
170
|
-
getInitialized(): boolean;
|
|
171
|
-
/**
|
|
172
|
-
* Get raw WASM module (advanced usage)
|
|
173
|
-
*/
|
|
174
|
-
getRawModule(): any;
|
|
175
|
-
/**
|
|
176
|
-
* Validate adjustment value against range
|
|
177
|
-
*/
|
|
178
|
-
validateAdjustment(name: any, value: any): void;
|
|
179
|
-
/**
|
|
180
|
-
* Cleanup resources
|
|
181
|
-
*/
|
|
182
|
-
cleanup(): void;
|
|
183
|
-
}
|
|
184
|
-
export namespace HonchoEditorUtils {
|
|
185
|
-
/**
|
|
186
|
-
* Convert ImageData to Blob for download
|
|
187
|
-
*/
|
|
188
|
-
function imageDataToBlob(imageData: any, format?: string, quality?: number): Promise<any>;
|
|
189
|
-
/**
|
|
190
|
-
* Download blob as file
|
|
191
|
-
*/
|
|
192
|
-
function downloadBlob(blob: any, filename: any): void;
|
|
193
|
-
/**
|
|
194
|
-
* Create debounced function for performance optimization
|
|
195
|
-
*/
|
|
196
|
-
function debounce(func: any, wait: any): (...args: any[]) => void;
|
|
197
|
-
/**
|
|
198
|
-
* Validate image file type
|
|
199
|
-
*/
|
|
200
|
-
function isValidImageFile(file: any): boolean;
|
|
201
|
-
/**
|
|
202
|
-
* Get file size in human readable format
|
|
203
|
-
*/
|
|
204
|
-
function formatFileSize(bytes: any): string;
|
|
205
|
-
}
|
|
206
|
-
export namespace ADJUSTMENT_RANGES {
|
|
207
|
-
namespace temperature {
|
|
208
|
-
export let min: number;
|
|
209
|
-
export let max: number;
|
|
210
|
-
let _default: number;
|
|
211
|
-
export { _default as default };
|
|
212
|
-
export let step: number;
|
|
213
|
-
}
|
|
214
|
-
namespace tint {
|
|
215
|
-
let min_1: number;
|
|
216
|
-
export { min_1 as min };
|
|
217
|
-
let max_1: number;
|
|
218
|
-
export { max_1 as max };
|
|
219
|
-
let _default_1: number;
|
|
220
|
-
export { _default_1 as default };
|
|
221
|
-
let step_1: number;
|
|
222
|
-
export { step_1 as step };
|
|
223
|
-
}
|
|
224
|
-
namespace saturation {
|
|
225
|
-
let min_2: number;
|
|
226
|
-
export { min_2 as min };
|
|
227
|
-
let max_2: number;
|
|
228
|
-
export { max_2 as max };
|
|
229
|
-
let _default_2: number;
|
|
230
|
-
export { _default_2 as default };
|
|
231
|
-
let step_2: number;
|
|
232
|
-
export { step_2 as step };
|
|
233
|
-
}
|
|
234
|
-
namespace vibrance {
|
|
235
|
-
let min_3: number;
|
|
236
|
-
export { min_3 as min };
|
|
237
|
-
let max_3: number;
|
|
238
|
-
export { max_3 as max };
|
|
239
|
-
let _default_3: number;
|
|
240
|
-
export { _default_3 as default };
|
|
241
|
-
let step_3: number;
|
|
242
|
-
export { step_3 as step };
|
|
243
|
-
}
|
|
244
|
-
namespace exposure {
|
|
245
|
-
let min_4: number;
|
|
246
|
-
export { min_4 as min };
|
|
247
|
-
let max_4: number;
|
|
248
|
-
export { max_4 as max };
|
|
249
|
-
let _default_4: number;
|
|
250
|
-
export { _default_4 as default };
|
|
251
|
-
let step_4: number;
|
|
252
|
-
export { step_4 as step };
|
|
253
|
-
}
|
|
254
|
-
namespace contrast {
|
|
255
|
-
let min_5: number;
|
|
256
|
-
export { min_5 as min };
|
|
257
|
-
let max_5: number;
|
|
258
|
-
export { max_5 as max };
|
|
259
|
-
let _default_5: number;
|
|
260
|
-
export { _default_5 as default };
|
|
261
|
-
let step_5: number;
|
|
262
|
-
export { step_5 as step };
|
|
263
|
-
}
|
|
264
|
-
namespace highlights {
|
|
265
|
-
let min_6: number;
|
|
266
|
-
export { min_6 as min };
|
|
267
|
-
let max_6: number;
|
|
268
|
-
export { max_6 as max };
|
|
269
|
-
let _default_6: number;
|
|
270
|
-
export { _default_6 as default };
|
|
271
|
-
let step_6: number;
|
|
272
|
-
export { step_6 as step };
|
|
273
|
-
}
|
|
274
|
-
namespace shadows {
|
|
275
|
-
let min_7: number;
|
|
276
|
-
export { min_7 as min };
|
|
277
|
-
let max_7: number;
|
|
278
|
-
export { max_7 as max };
|
|
279
|
-
let _default_7: number;
|
|
280
|
-
export { _default_7 as default };
|
|
281
|
-
let step_7: number;
|
|
282
|
-
export { step_7 as step };
|
|
283
|
-
}
|
|
284
|
-
namespace whites {
|
|
285
|
-
let min_8: number;
|
|
286
|
-
export { min_8 as min };
|
|
287
|
-
let max_8: number;
|
|
288
|
-
export { max_8 as max };
|
|
289
|
-
let _default_8: number;
|
|
290
|
-
export { _default_8 as default };
|
|
291
|
-
let step_8: number;
|
|
292
|
-
export { step_8 as step };
|
|
293
|
-
}
|
|
294
|
-
namespace blacks {
|
|
295
|
-
let min_9: number;
|
|
296
|
-
export { min_9 as min };
|
|
297
|
-
let max_9: number;
|
|
298
|
-
export { max_9 as max };
|
|
299
|
-
let _default_9: number;
|
|
300
|
-
export { _default_9 as default };
|
|
301
|
-
let step_9: number;
|
|
302
|
-
export { step_9 as step };
|
|
303
|
-
}
|
|
304
|
-
namespace clarity {
|
|
305
|
-
let min_10: number;
|
|
306
|
-
export { min_10 as min };
|
|
307
|
-
let max_10: number;
|
|
308
|
-
export { max_10 as max };
|
|
309
|
-
let _default_10: number;
|
|
310
|
-
export { _default_10 as default };
|
|
311
|
-
let step_10: number;
|
|
312
|
-
export { step_10 as step };
|
|
313
|
-
}
|
|
314
|
-
namespace sharpness {
|
|
315
|
-
let min_11: number;
|
|
316
|
-
export { min_11 as min };
|
|
317
|
-
let max_11: number;
|
|
318
|
-
export { max_11 as max };
|
|
319
|
-
let _default_11: number;
|
|
320
|
-
export { _default_11 as default };
|
|
321
|
-
let step_11: number;
|
|
322
|
-
export { step_11 as step };
|
|
323
|
-
}
|
|
324
|
-
}
|