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

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,6 +22,16 @@ 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
36
  stroke: string;
25
37
  hoverStroke: string;
@@ -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,6 +64,7 @@ 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;
@@ -60,13 +75,16 @@ pointerDown: (event: TPointerEventInfo<TPointerEvent>) => any;
60
75
  pointerMove: (event: TPointerEventInfo<TPointerEvent>) => any;
61
76
  pointerUp: (event: TPointerEventInfo<TPointerEvent>) => any;
62
77
  loaded: () => any;
78
+ reload: () => any;
63
79
  }, string, PublicProps, Readonly<ComponentProps> & Readonly<{
64
80
  onPointerDown?: ((event: TPointerEventInfo<TPointerEvent>) => any) | undefined;
65
81
  onPointerMove?: ((event: TPointerEventInfo<TPointerEvent>) => any) | undefined;
66
82
  onPointerUp?: ((event: TPointerEventInfo<TPointerEvent>) => any) | undefined;
67
83
  onLoaded?: (() => any) | undefined;
84
+ onReload?: (() => any) | undefined;
68
85
  }>, {
69
86
  page: number;
87
+ selectionOptions: TOptions<FabricObjectProps>;
70
88
  canvasId: string;
71
89
  fileZoom: number;
72
90
  fileScale: number;
@@ -118,6 +136,8 @@ export declare type SelectedEvent = Partial<TEvent> & {
118
136
  target: FabricObject<Partial<FabricObjectProps>, SerializedObjectProps, ObjectEvents>;
119
137
  };
120
138
 
139
+ declare function setPDF(): Promise<void>;
140
+
121
141
  export declare interface SpecifyPageArgs {
122
142
  page: number;
123
143
  PDFBase64: string;
@@ -134,7 +154,9 @@ export declare interface TCornerPoint {
134
154
  br: Point;
135
155
  }
136
156
 
137
- export declare function useFabric(params?: FabricHookParams): {
157
+ export declare function useFabric(params?: FabricHookParams & {
158
+ selectionOptions?: Ref<TOptions<FabricObjectProps>>;
159
+ }): {
138
160
  createCanvas: () => Canvas | undefined;
139
161
  loadFile: (file: File, password?: string) => Promise<{
140
162
  pages: number;
@@ -143,7 +165,7 @@ export declare function useFabric(params?: FabricHookParams): {
143
165
  updateDate: number;
144
166
  PDFBase64: string;
145
167
  } | undefined>;
146
- specifyPage: (params: SpecifyPageArgs) => void;
168
+ specifyPage: (params: SpecifyPageArgs) => Promise<number>;
147
169
  renderImage: ({ url, scale }: RenderImageArgs) => Promise<void>;
148
170
  addFabric: (src: string, options?: TOptions<ImageProps>, offset?: DropOffset) => Promise<void>;
149
171
  addTextFabric: (text: string, options?: TOptions<TextProps>, offset?: DropOffset) => void;