@component-hook/pdf-canvas 1.1.0-alpha.1 → 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.
@@ -2,8 +2,10 @@ import { Canvas } from 'fabric';
2
2
  import { ComponentOptionsMixin } from 'vue';
3
3
  import { ComponentProvideOptions } from 'vue';
4
4
  import { DefineComponent } from 'vue';
5
+ import { FabricImage } from 'fabric';
5
6
  import { FabricObject } from 'fabric';
6
7
  import { FabricObjectProps } from 'fabric';
8
+ import { FabricText } from 'fabric';
7
9
  import { ImageProps } from 'fabric';
8
10
  import { ObjectEvents } from 'fabric';
9
11
  import { Point } from 'fabric';
@@ -20,10 +22,20 @@ declare function addImage(src: string, options?: TOptions<ImageProps>, offset?:
20
22
 
21
23
  declare function addText(text: string, options?: TOptions<TextProps>, offset?: DropOffset): void;
22
24
 
25
+ export declare type CacheFabricImage = FabricImage & CacheProperties;
26
+
27
+ export declare type CacheFabricObject = FabricObject & CacheProperties;
28
+
29
+ export declare type CacheFabricText = FabricText & CacheProperties;
30
+
31
+ declare interface CacheProperties {
32
+ _cornerSize?: number;
33
+ }
34
+
23
35
  export declare interface CloseSvgOptions {
24
- stroke: string;
25
- hoverStroke: string;
26
- src: string;
36
+ stroke?: string;
37
+ hoverStroke?: string;
38
+ src?: string;
27
39
  }
28
40
 
29
41
  export declare interface ComponentProps {
@@ -38,7 +50,9 @@ export declare interface ComponentProps {
38
50
  password?: string;
39
51
  dropTextOptions?: TOptions<TextProps>;
40
52
  dropImageOptions?: TOptions<ImageProps>;
53
+ selectionOptions?: TOptions<FabricObjectProps>;
41
54
  closeSvgOptions?: CloseSvgOptions;
55
+ manualReload?: boolean;
42
56
  onDestroy?: (callback: () => void) => void;
43
57
  }
44
58
 
@@ -50,21 +64,30 @@ export declare interface CreateCloseFabricArgs {
50
64
  }
51
65
 
52
66
  declare const _default: DefineComponent<ComponentProps, {
67
+ reload: typeof setPDF;
53
68
  addImage: typeof addImage;
54
69
  addText: typeof addText;
55
70
  clearActive: () => void;
56
71
  deleteCanvas: () => void;
72
+ copyActiveFabric: () => Promise<void>;
73
+ deleteActiveFabric: () => void;
57
74
  canvasRef: Ref<HTMLCanvasElement | null, HTMLCanvasElement | null>;
58
75
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
59
76
  pointerDown: (event: TPointerEventInfo<TPointerEvent>) => any;
60
77
  pointerMove: (event: TPointerEventInfo<TPointerEvent>) => any;
61
78
  pointerUp: (event: TPointerEventInfo<TPointerEvent>) => any;
79
+ selectionCreated: (event: FabricSelectionCreatedEvent) => any;
80
+ selectionCleared: (event: FabricSelectionClearedEvent) => any;
62
81
  loaded: () => any;
82
+ reload: () => any;
63
83
  }, string, PublicProps, Readonly<ComponentProps> & Readonly<{
64
84
  onPointerDown?: ((event: TPointerEventInfo<TPointerEvent>) => any) | undefined;
65
85
  onPointerMove?: ((event: TPointerEventInfo<TPointerEvent>) => any) | undefined;
66
86
  onPointerUp?: ((event: TPointerEventInfo<TPointerEvent>) => any) | undefined;
87
+ onSelectionCreated?: ((event: FabricSelectionCreatedEvent) => any) | undefined;
88
+ onSelectionCleared?: ((event: FabricSelectionClearedEvent) => any) | undefined;
67
89
  onLoaded?: (() => any) | undefined;
90
+ onReload?: (() => any) | undefined;
68
91
  }>, {
69
92
  page: number;
70
93
  canvasId: string;
@@ -86,10 +109,20 @@ export declare interface FabricHookParams {
86
109
  pointerDown?: (event: FabricPointerEvent) => void;
87
110
  pointerMove?: (event: FabricPointerEvent) => void;
88
111
  pointerUp?: (event: FabricPointerEvent) => void;
112
+ selectionCreated?: (event: FabricSelectionCreatedEvent) => void;
113
+ selectionCleared?: (event: FabricSelectionClearedEvent) => void;
89
114
  }
90
115
 
91
116
  export declare type FabricPointerEvent = TPointerEventInfo<TPointerEvent>;
92
117
 
118
+ export declare type FabricSelectionClearedEvent = Partial<TEvent<TPointerEvent>> & {
119
+ deselected: FabricObject[];
120
+ };
121
+
122
+ export declare type FabricSelectionCreatedEvent = Partial<TEvent<TPointerEvent>> & {
123
+ selected: FabricObject[];
124
+ };
125
+
93
126
  export declare function loadFile(file: File, password?: string, id?: string): Promise<{
94
127
  pages: number;
95
128
  PDFId: string;
@@ -118,6 +151,8 @@ export declare type SelectedEvent = Partial<TEvent> & {
118
151
  target: FabricObject<Partial<FabricObjectProps>, SerializedObjectProps, ObjectEvents>;
119
152
  };
120
153
 
154
+ declare function setPDF(): Promise<void>;
155
+
121
156
  export declare interface SpecifyPageArgs {
122
157
  page: number;
123
158
  PDFBase64: string;
@@ -134,7 +169,9 @@ export declare interface TCornerPoint {
134
169
  br: Point;
135
170
  }
136
171
 
137
- export declare function useFabric(params?: FabricHookParams): {
172
+ export declare function useFabric(params?: FabricHookParams & {
173
+ selectionOptions?: Ref<TOptions<FabricObjectProps>>;
174
+ }): {
138
175
  createCanvas: () => Canvas | undefined;
139
176
  loadFile: (file: File, password?: string) => Promise<{
140
177
  pages: number;
@@ -143,7 +180,7 @@ export declare function useFabric(params?: FabricHookParams): {
143
180
  updateDate: number;
144
181
  PDFBase64: string;
145
182
  } | undefined>;
146
- specifyPage: (params: SpecifyPageArgs) => Promise<number>;
183
+ specifyPage: (specifyPageParams: SpecifyPageArgs) => Promise<number>;
147
184
  renderImage: ({ url, scale }: RenderImageArgs) => Promise<void>;
148
185
  addFabric: (src: string, options?: TOptions<ImageProps>, offset?: DropOffset) => Promise<void>;
149
186
  addTextFabric: (text: string, options?: TOptions<TextProps>, offset?: DropOffset) => void;
@@ -151,6 +188,8 @@ export declare function useFabric(params?: FabricHookParams): {
151
188
  deleteCanvas: () => void;
152
189
  scaleFabric: (scale: number, isCreate?: boolean) => void;
153
190
  setCloseSvgOptions: (options?: CloseSvgOptions) => void;
191
+ copyActiveFabric: () => Promise<void>;
192
+ deleteActiveFabric: () => void;
154
193
  };
155
194
 
156
195
  export { }