@yogiswara/honcho-editor-ui 2.10.2 → 2.10.4

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.
@@ -9,19 +9,38 @@ export default function useSliderEvents(onDragStart, onDragEnd, isBatchMode) {
9
9
  if (!isBatchMode) {
10
10
  onDragStart();
11
11
  }
12
+ // Add document listeners when dragging starts
13
+ document.addEventListener("mouseup", handleMouseUp);
14
+ document.addEventListener("touchend", handleTouchEnd);
15
+ };
16
+ const handleTouchStart = () => {
17
+ if (!isBatchMode) {
18
+ onDragStart();
19
+ }
20
+ // Add document listeners when dragging starts
21
+ document.addEventListener("mouseup", handleMouseUp);
22
+ document.addEventListener("touchend", handleTouchEnd);
12
23
  };
13
24
  const handleMouseUp = () => {
14
25
  onDragEnd();
26
+ // Remove document listeners when dragging ends
27
+ document.removeEventListener("mouseup", handleMouseUp);
28
+ document.removeEventListener("touchend", handleTouchEnd);
29
+ };
30
+ const handleTouchEnd = () => {
31
+ onDragEnd();
32
+ // Remove document listeners when dragging ends
33
+ document.removeEventListener("mouseup", handleMouseUp);
34
+ document.removeEventListener("touchend", handleTouchEnd);
15
35
  };
16
36
  sliderElement.addEventListener("mousedown", handleMouseDown);
17
- sliderElement.addEventListener("mouseup", handleMouseUp);
18
- sliderElement.addEventListener("touchstart", handleMouseDown);
19
- sliderElement.addEventListener("touchend", handleMouseUp);
37
+ sliderElement.addEventListener("touchstart", handleTouchStart);
20
38
  return () => {
21
39
  sliderElement.removeEventListener("mousedown", handleMouseDown);
22
- sliderElement.removeEventListener("mouseup", handleMouseUp);
23
- sliderElement.removeEventListener("touchstart", handleMouseDown);
24
- sliderElement.removeEventListener("touchend", handleMouseUp);
40
+ sliderElement.removeEventListener("touchstart", handleTouchStart);
41
+ // Clean up any remaining document listeners
42
+ document.removeEventListener("mouseup", handleMouseUp);
43
+ document.removeEventListener("touchend", handleTouchEnd);
25
44
  };
26
45
  }, [onDragStart, onDragEnd, isBatchMode]);
27
46
  return sliderRef; // Return the ref to be attached to the slider
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
5
5
  export type { Controller, AdjustmentState, Preset, ImageItem, ColorAdjustment, CreateEditorTaskRequest, EditorHistoryEntry, GetGalleryUpdateTimestampResponse, GetHistoryResponse, } from './hooks/editor/type';
6
6
  export type { PhotoData } from './hooks/editor/useHonchoEditorBulk';
7
7
  export type { Gallery, Content } from './hooks/editor/type';
8
+ export { partialAdjustmentStateToAdjustmentState, mapAdjustmentStateToAdjustmentEditor, mapColorAdjustmentToAdjustmentState, mapAdjustmentStateToColorAdjustment } from './utils/adjustment';
8
9
  export { default as HHeaderEditor } from './components/editor/HHeaderEditor';
9
10
  export { default as HFooter } from './components/editor/HFooter';
10
11
  export { default as HAccordionColorAdjustment } from './components/editor/HAccordionColorAdjustment';
@@ -39,4 +40,4 @@ export { usePaging, type UsePagingReturn, type PagingInfo, type PagingActions, t
39
40
  export { default as useColors } from './themes/colors';
40
41
  export { default as useHonchoTypography } from './themes/honchoTheme';
41
42
  export { default as useIsMobile } from './utils/isMobile';
42
- export { default as useSliderEvents } from '../src/components/editor/sliderComponents/useSliderEvents';
43
+ export { default as useSliderEvents } from './components/editor/sliderComponents/useSliderEvents';
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ export { HonchoEditorSingleCleanDemo } from './hooks/demo/HonchoEditorSingleClea
4
4
  // END
5
5
  export { useHonchoEditorSingle } from './hooks/editor/useHonchoEditorSingle';
6
6
  export { useHonchoEditorBulk } from './hooks/editor/useHonchoEditorBulk';
7
+ export { partialAdjustmentStateToAdjustmentState, mapAdjustmentStateToAdjustmentEditor, mapColorAdjustmentToAdjustmentState, mapAdjustmentStateToColorAdjustment } from './utils/adjustment';
7
8
  export { default as HHeaderEditor } from './components/editor/HHeaderEditor';
8
9
  export { default as HFooter } from './components/editor/HFooter';
9
10
  export { default as HAccordionColorAdjustment } from './components/editor/HAccordionColorAdjustment';
@@ -42,4 +43,4 @@ export { usePaging } from './hooks/usePaging';
42
43
  export { default as useColors } from './themes/colors';
43
44
  export { default as useHonchoTypography } from './themes/honchoTheme';
44
45
  export { default as useIsMobile } from './utils/isMobile';
45
- export { default as useSliderEvents } from '../src/components/editor/sliderComponents/useSliderEvents';
46
+ export { default as useSliderEvents } from './components/editor/sliderComponents/useSliderEvents';
@@ -4,3 +4,4 @@ import { AdjustmentValues } from "../lib/editor/honcho-editor";
4
4
  export declare function mapAdjustmentStateToAdjustmentEditor(state: AdjustmentState): AdjustmentValues;
5
5
  export declare function mapColorAdjustmentToAdjustmentState(colors: ColorAdjustment): AdjustmentState;
6
6
  export declare function mapAdjustmentStateToColorAdjustment(state: AdjustmentState): ColorAdjustment;
7
+ export declare function partialAdjustmentStateToAdjustmentState(partial: Partial<AdjustmentState>): AdjustmentState;
@@ -46,3 +46,19 @@ export function mapAdjustmentStateToColorAdjustment(state) {
46
46
  sharpness: state.sharpnessScore
47
47
  };
48
48
  }
49
+ export function partialAdjustmentStateToAdjustmentState(partial) {
50
+ return {
51
+ tempScore: partial.tempScore ?? 0,
52
+ tintScore: partial.tintScore ?? 0,
53
+ saturationScore: partial.saturationScore ?? 0,
54
+ vibranceScore: partial.vibranceScore ?? 0,
55
+ exposureScore: partial.exposureScore ?? 0,
56
+ contrastScore: partial.contrastScore ?? 0,
57
+ highlightsScore: partial.highlightsScore ?? 0,
58
+ shadowsScore: partial.shadowsScore ?? 0,
59
+ whitesScore: partial.whitesScore ?? 0,
60
+ blacksScore: partial.blacksScore ?? 0,
61
+ clarityScore: partial.clarityScore ?? 0,
62
+ sharpnessScore: partial.sharpnessScore ?? 0,
63
+ };
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "2.10.2",
3
+ "version": "2.10.4",
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",