@yogiswara/honcho-editor-ui 2.1.4 → 2.1.6

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.
@@ -44,6 +44,13 @@ export interface EditorConfig {
44
44
  transformation_adjustment: TransformationAdjustment[];
45
45
  watermarks: Watermark[];
46
46
  }
47
+ export interface Content {
48
+ key: string;
49
+ path: string;
50
+ size: number;
51
+ width: number;
52
+ height: number;
53
+ }
47
54
  export interface GallerySetup {
48
55
  src: string;
49
56
  original: string;
@@ -4,6 +4,7 @@ import { Gallery, ResponseGalleryPaging } from '../../hooks/editor/type';
4
4
  export interface PhotoData {
5
5
  key: string;
6
6
  src: string;
7
+ original: string;
7
8
  width: number;
8
9
  height: number;
9
10
  alt: string;
@@ -3,15 +3,19 @@ import { useState, useCallback, useEffect, useMemo } from 'react';
3
3
  import { useAdjustmentHistory } from '../useAdjustmentHistory';
4
4
  import { useAdjustmentHistoryBatch } from '../useAdjustmentHistoryBatch';
5
5
  // Helper function to map the API response to the format our UI component needs
6
- const mapGalleryToPhotoData = (gallery) => ({
7
- key: gallery.id,
8
- src: gallery.raw_edited?.path || gallery.download?.path || '',
9
- width: gallery.raw_edited?.width || 1, // Default to 1 to prevent division by zero
10
- height: gallery.raw_edited?.height || 1,
11
- alt: gallery.id || 'gallery image',
12
- isSelected: false, // All images start as unselected
13
- originalData: gallery,
14
- });
6
+ const mapGalleryToPhotoData = (gallery) => {
7
+ const bestAvailableImage = gallery.thumbnail || gallery.download || { path: '', width: 1, height: 1, key: gallery.id, size: 0 };
8
+ return {
9
+ key: gallery.id,
10
+ src: bestAvailableImage.path,
11
+ original: gallery.download?.path || bestAvailableImage.path,
12
+ width: bestAvailableImage.width || 1,
13
+ height: bestAvailableImage.height || 1,
14
+ alt: gallery.id || 'gallery image',
15
+ isSelected: false,
16
+ originalData: gallery,
17
+ };
18
+ };
15
19
  const initialAdjustments = {
16
20
  tempScore: 0, tintScore: 0, vibranceScore: 0, exposureScore: 0, highlightsScore: 0, shadowsScore: 0,
17
21
  whitesScore: 0, blacksScore: 0, saturationScore: 0, contrastScore: 0, clarityScore: 0, sharpnessScore: 0,
@@ -52,17 +56,11 @@ export function useHonchoEditorBulk(controllerBulk, eventID, firebaseUid) {
52
56
  const lastSelectedId = selectedImageIds.length > 0 ? selectedImageIds[selectedImageIds.length - 1] : eventID;
53
57
  controllerBulk.handleBack(firebaseUid, lastSelectedId);
54
58
  }, [controllerBulk, firebaseUid, selectedImageIds, eventID]);
55
- const handleSelectedMode = useCallback(() => {
56
- setIsSelectedMode(true);
57
- }, []);
59
+ const handleSelectedMode = useCallback(() => setIsSelectedMode(true), []);
58
60
  const handleToggleSelect = useCallback((photoToToggle) => () => {
59
- setImageCollection(currentCollection => currentCollection.map(photo => photo.key === photoToToggle.key
60
- ? { ...photo, isSelected: !photo.isSelected }
61
- : photo));
62
- // Automatically enter selection mode on first selection
63
- if (!isSelectedMode) {
61
+ setImageCollection(current => current.map(p => p.key === photoToToggle.key ? { ...p, isSelected: !p.isSelected } : p));
62
+ if (!isSelectedMode)
64
63
  setIsSelectedMode(true);
65
- }
66
64
  }, [isSelectedMode]);
67
65
  const handlePreview = useCallback((photo) => () => {
68
66
  console.log("Previewing image:", photo.key);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { useHonchoEditor } from './hooks/editor/useHonchoEditor';
2
2
  export type { Controller, AdjustmentState, Preset, ImageItem, } from './hooks/editor/useHonchoEditor';
3
+ export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
4
+ export type { PhotoData, ControllerBulk } from './hooks/editor/useHonchoEditorBulk';
3
5
  export type { Gallery, Content } from './hooks/editor/type';
4
6
  export { default as HHeaderEditor } from './components/editor/HHeaderEditor';
5
7
  export { default as HFooter } from './components/editor/HFooter';
@@ -19,7 +21,6 @@ export { default as HWatermarkView } from './components/editor/HWatermarkView';
19
21
  export { default as HModalMobile } from './components/editor/HModalMobile';
20
22
  export { default as HPresetOptionsMenu } from './components/editor/HPresetOptionMenu';
21
23
  export { HAlertInternetBox, HAlertCopyBox, HAlertInternetConnectionBox, HAlertPresetSave } from './components/editor/HAlertBox';
22
- export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
23
24
  export { default as AlbumImageGallery } from './components/editor/GalleryAlbum/AlbumImageGallery';
24
25
  export { default as GalleryImageItem } from './components/editor/GalleryAlbum/ImageItem';
25
26
  export { useAdjustmentHistory, type UseAdjustmentHistoryReturn, type HistoryInfo, type HistoryActions, type HistoryConfig } from './hooks/useAdjustmentHistory';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { useHonchoEditor } from './hooks/editor/useHonchoEditor';
2
+ export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
2
3
  export { default as HHeaderEditor } from './components/editor/HHeaderEditor';
3
4
  export { default as HFooter } from './components/editor/HFooter';
4
5
  export { default as HAccordionColorAdjustment } from './components/editor/HAccordionColorAdjustment';
@@ -17,7 +18,6 @@ export { default as HWatermarkView } from './components/editor/HWatermarkView';
17
18
  export { default as HModalMobile } from './components/editor/HModalMobile';
18
19
  export { default as HPresetOptionsMenu } from './components/editor/HPresetOptionMenu';
19
20
  export { HAlertInternetBox, HAlertCopyBox, HAlertInternetConnectionBox, HAlertPresetSave } from './components/editor/HAlertBox';
20
- export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
21
21
  export { default as AlbumImageGallery } from './components/editor/GalleryAlbum/AlbumImageGallery';
22
22
  export { default as GalleryImageItem } from './components/editor/GalleryAlbum/ImageItem';
23
23
  // --- History Hooks ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "A complete UI component library for the Honcho photo editor.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",