@component-hook/pdf-canvas 1.0.5-alpha.3 → 1.1.0-alpha.0

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.
@@ -16,9 +16,9 @@ import { TOptions } from 'fabric';
16
16
  import { TPointerEvent } from 'fabric';
17
17
  import { TPointerEventInfo } from 'fabric';
18
18
 
19
- declare function addImage(src: string, options?: TOptions<ImageProps>, size?: Record<'width' | 'height', number>): void;
19
+ declare function addImage(src: string, options?: TOptions<ImageProps>, offset?: DropOffset): void;
20
20
 
21
- declare function addText(text: string, options?: TOptions<TextProps>): void;
21
+ declare function addText(text: string, options?: TOptions<TextProps>, offset?: DropOffset): void;
22
22
 
23
23
  export declare interface CloseSvgOptions {
24
24
  stroke: string;
@@ -79,13 +79,25 @@ canvasRef: HTMLCanvasElement;
79
79
  }, HTMLDivElement>;
80
80
  export default _default;
81
81
 
82
+ export declare type DropOffset = Record<'x' | 'y', number>;
83
+
82
84
  export declare interface FabricHookParams {
83
85
  id: string;
84
- pointerDown?: (event: TPointerEventInfo<TPointerEvent>) => void;
85
- pointerMove?: (event: TPointerEventInfo<TPointerEvent>) => void;
86
- pointerUp?: (event: TPointerEventInfo<TPointerEvent>) => void;
86
+ pointerDown?: (event: FabricPointerEvent) => void;
87
+ pointerMove?: (event: FabricPointerEvent) => void;
88
+ pointerUp?: (event: FabricPointerEvent) => void;
87
89
  }
88
90
 
91
+ export declare type FabricPointerEvent = TPointerEventInfo<TPointerEvent>;
92
+
93
+ export declare function loadFile(file: File, password?: string, id?: string): Promise<{
94
+ pages: number;
95
+ PDFId: string;
96
+ name: string;
97
+ updateDate: number;
98
+ PDFBase64: string;
99
+ } | undefined>;
100
+
89
101
  export declare interface PDF {
90
102
  PDFId: string;
91
103
  name: string;
@@ -131,10 +143,10 @@ export declare function useFabric(params?: FabricHookParams): {
131
143
  updateDate: number;
132
144
  PDFBase64: string;
133
145
  } | undefined>;
134
- specifyPage: ({ page, PDFBase64, scale, password }: SpecifyPageArgs) => Promise<void>;
146
+ specifyPage: (params: SpecifyPageArgs) => void;
135
147
  renderImage: ({ url, scale }: RenderImageArgs) => Promise<void>;
136
- addFabric: (src: string, options?: TOptions<ImageProps>, size?: Record<"width" | "height", number>) => Promise<void>;
137
- addTextFabric: (text: string, options?: TOptions<TextProps>) => void;
148
+ addFabric: (src: string, options?: TOptions<ImageProps>, offset?: DropOffset) => Promise<void>;
149
+ addTextFabric: (text: string, options?: TOptions<TextProps>, offset?: DropOffset) => void;
138
150
  clearActive: () => void;
139
151
  deleteCanvas: () => void;
140
152
  scaleFabric: (scale: number, isCreate?: boolean) => void;