@yogiswara/honcho-editor-ui 1.0.10 → 1.0.11

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,30 +9,68 @@ export interface Content {
9
9
  width: number;
10
10
  height: number;
11
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
+ }
12
47
  export interface Gallery {
13
48
  id: string;
14
49
  uid: string;
15
50
  event_id: string;
16
51
  download: Content;
17
- download_edited: Content;
52
+ download_edited: Content | null;
18
53
  raw?: Content;
19
54
  raw_edited?: Content;
55
+ raw_preview?: Content;
56
+ raw_thumbnail?: Content;
20
57
  original?: Content;
21
- original_edited?: Content;
58
+ original_edited?: Content | null;
22
59
  large?: Content;
23
- large_edited?: Content;
24
- medium?: Content;
25
- medium_edited?: Content;
26
- small?: Content;
27
- small_edited?: Content;
28
- mini?: Content;
29
- mini_edited?: Content;
60
+ large_edited?: Content | null;
61
+ medium?: Content | null;
62
+ medium_edited?: Content | null;
63
+ small?: Content | null;
64
+ small_edited?: Content | null;
65
+ mini?: Content | null;
66
+ mini_edited?: Content | null;
30
67
  create_from?: string[];
31
68
  thumbnail: Content;
32
- thumbnail_edited: Content;
69
+ thumbnail_edited: Content | null;
33
70
  is_original: boolean;
34
71
  available: boolean;
35
72
  show_gallery: boolean;
73
+ editor_config?: EditorConfig;
36
74
  log: Log;
37
75
  }
38
76
  export {};
@@ -6,12 +6,12 @@ declare global {
6
6
  }
7
7
  }
8
8
  export interface Controller {
9
- onGetImage(firebaseUid: string, imageID: string): Promise<Gallery | null>;
9
+ onGetImage(firebaseUid: string, imageID: string): Promise<Gallery>;
10
10
  getImageList(firebaseUid: string): Promise<Gallery[]>;
11
11
  syncConfig(firebaseUid: string): Promise<void>;
12
12
  handleBack(firebaseUid: string): void;
13
13
  getPresets(firebaseUid: string): Promise<Preset[]>;
14
- createPreset(firebaseUid: string, name: string, settings: AdjustmentState): Promise<Preset | null>;
14
+ createPreset(firebaseUid: string, name: string, settings: AdjustmentState): Promise<Preset>;
15
15
  deletePreset(firebaseUid: string, presetId: string): Promise<void>;
16
16
  renamePreset(firebaseUid: string, presetId: string, newName: string): Promise<void>;
17
17
  }
@@ -47,11 +47,11 @@ export declare function useHonchoEditor(controller: Controller, initImageId: str
47
47
  fileInputRef: import("react").MutableRefObject<HTMLInputElement | null>;
48
48
  displayedToken: string | null;
49
49
  handleBack: (firebaseUid: string) => void;
50
- onGetImage: (firebaseUid: string, imageID: string) => Promise<Gallery | null>;
50
+ onGetImage: (firebaseUid: string, imageID: string) => Promise<Gallery>;
51
51
  getImageList: (firebaseUid: string) => Promise<Gallery[]>;
52
52
  syncConfig: (firebaseUid: string) => Promise<void>;
53
53
  getPresets: (firebaseUid: string) => Promise<Preset[]>;
54
- createPreset: (firebaseUid: string, name: string, settings: AdjustmentState) => Promise<Preset | null>;
54
+ createPreset: (firebaseUid: string, name: string, settings: AdjustmentState) => Promise<Preset>;
55
55
  deletePreset: (firebaseUid: string, presetId: string) => Promise<void>;
56
56
  renamePreset: (firebaseUid: string, presetId: string, newName: string) => Promise<void>;
57
57
  panelRef: import("react").MutableRefObject<HTMLDivElement | null>;
@@ -265,8 +265,11 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
265
265
  setEditorStatus("Fetching image...");
266
266
  try {
267
267
  const gallery = await controller.onGetImage(firebaseUid, imageId);
268
- if (gallery && gallery.original && gallery.original.path) {
269
- await loadImageFromUrl(gallery.original.path);
268
+ const imagePath = gallery?.raw_edited?.path
269
+ ? gallery.raw_edited.path
270
+ : gallery?.download?.path;
271
+ if (imagePath) {
272
+ await loadImageFromUrl(imagePath);
270
273
  }
271
274
  else {
272
275
  throw new Error("Controller did not return a valid image object with path.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
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",