@component-hook/pdf-canvas 1.1.0-alpha.10 → 1.1.0-alpha.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.
@@ -26,9 +26,17 @@ declare interface CacheProperties {
26
26
  }
27
27
 
28
28
  export declare interface CloseSvgOptions {
29
- stroke: string;
30
- hoverStroke: string;
31
- src: string;
29
+ stroke?: string;
30
+ hoverStroke?: string;
31
+ src?: string;
32
+ }
33
+
34
+ declare interface ComponentEmits {
35
+ onLoaded?: () => void;
36
+ onReload?: () => void;
37
+ onPointerDown?: (event: TPointerEventInfo<TPointerEvent>) => void;
38
+ onPointerMove?: (event: TPointerEventInfo<TPointerEvent>) => void;
39
+ onPointerUp?: (event: TPointerEventInfo<TPointerEvent>) => void;
32
40
  }
33
41
 
34
42
  export declare interface ComponentProps {
@@ -63,10 +71,28 @@ export declare interface FabricHookParams {
63
71
  pointerDown?: (event: FabricPointerEvent) => void;
64
72
  pointerMove?: (event: FabricPointerEvent) => void;
65
73
  pointerUp?: (event: FabricPointerEvent) => void;
74
+ selectionCreated?: (event: FabricSelectionCreatedEvent) => void;
75
+ selectionCleared?: (event: FabricSelectionClearedEvent) => void;
66
76
  }
67
77
 
68
78
  export declare type FabricPointerEvent = TPointerEventInfo<TPointerEvent>;
69
79
 
80
+ export declare type FabricSelectionClearedEvent = Partial<TEvent<TPointerEvent>> & {
81
+ deselected: FabricObject[];
82
+ };
83
+
84
+ export declare type FabricSelectionCreatedEvent = Partial<TEvent<TPointerEvent>> & {
85
+ selected: FabricObject[];
86
+ };
87
+
88
+ export declare function loadFile(file: File, password?: string, id?: string): Promise<{
89
+ pages: number;
90
+ PDFId: string;
91
+ name: string;
92
+ updateDate: number;
93
+ PDFBase64: string;
94
+ } | undefined>;
95
+
70
96
  export declare interface PDF {
71
97
  PDFId: string;
72
98
  name: string;
@@ -78,10 +104,11 @@ export declare interface PDF {
78
104
  isUpdate?: boolean;
79
105
  }
80
106
 
81
- declare const PdfCanvas: ForwardRefExoticComponent<ComponentProps & RefAttributes<PdfCanvasHandle>>;
107
+ declare const PdfCanvas: ForwardRefExoticComponent<ComponentProps & ComponentEmits & RefAttributes<PdfCanvasHandle>>;
82
108
  export default PdfCanvas;
83
109
 
84
110
  export declare interface PdfCanvasHandle {
111
+ reload: () => Promise<void>;
85
112
  addImage: (src: string, options?: TOptions<ImageProps>) => void;
86
113
  addText: (text: string, options?: TOptions<TextProps>) => void;
87
114
  clearActive: () => void;
@@ -114,7 +141,9 @@ export declare interface TCornerPoint {
114
141
  br: Point;
115
142
  }
116
143
 
117
- export declare function useFabric(id?: string): {
144
+ export declare function useFabric(params?: FabricHookParams & {
145
+ selectionOptions?: TOptions<FabricObjectProps>;
146
+ }): {
118
147
  createCanvas: () => Canvas | undefined;
119
148
  loadFile: (file: File, password?: string) => Promise<{
120
149
  pages: number;
@@ -123,10 +152,10 @@ export declare function useFabric(id?: string): {
123
152
  updateDate: number;
124
153
  PDFBase64: string;
125
154
  } | undefined>;
126
- specifyPage: ({ page, PDFBase64, scale, password }: SpecifyPageArgs) => Promise<void>;
155
+ specifyPage: (specifyPageParams: SpecifyPageArgs) => Promise<number>;
127
156
  renderImage: ({ url, scale }: RenderImageArgs) => Promise<void>;
128
- addFabric: (src: string, options?: TOptions<ImageProps>) => Promise<void>;
129
- addTextFabric: (text: string, options?: TOptions<TextProps>) => void;
157
+ addFabric: (src: string, options?: TOptions<ImageProps>, offset?: DropOffset) => Promise<void>;
158
+ addTextFabric: (text: string, options?: TOptions<TextProps>, offset?: DropOffset) => void;
130
159
  clearActive: () => void;
131
160
  deleteCanvas: () => void;
132
161
  scaleFabric: (scale: number, isCreate?: boolean) => void;