@willphan1712000/frontend 1.4.4 → 1.5.1
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.
- package/dist/index.d.mts +295 -99
- package/dist/index.d.ts +295 -99
- package/dist/index.js +1576 -740
- package/dist/index.mjs +1583 -731
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ type Options$2 = {
|
|
|
5
5
|
label: string;
|
|
6
6
|
value: string;
|
|
7
7
|
}[];
|
|
8
|
-
interface Props$
|
|
8
|
+
interface Props$c {
|
|
9
9
|
options: Options$2;
|
|
10
10
|
value: string;
|
|
11
11
|
onChange: (value: string) => void;
|
|
@@ -17,9 +17,9 @@ interface Props$b {
|
|
|
17
17
|
* @param onChange - a function to set a value
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
declare const DropdownSelect: ({ options, value, onChange }: Props$
|
|
20
|
+
declare const DropdownSelect: ({ options, value, onChange }: Props$c) => react_jsx_runtime.JSX.Element;
|
|
21
21
|
|
|
22
|
-
interface Props$
|
|
22
|
+
interface Props$b {
|
|
23
23
|
value: string;
|
|
24
24
|
onChange: (value: string) => void;
|
|
25
25
|
min?: string;
|
|
@@ -37,13 +37,13 @@ interface Props$a {
|
|
|
37
37
|
* @param onChange - to set a value
|
|
38
38
|
* @returns
|
|
39
39
|
*/
|
|
40
|
-
declare const RangeSlider: ({ min, max, color, width, value, onChange, }: Props$
|
|
40
|
+
declare const RangeSlider: ({ min, max, color, width, value, onChange, }: Props$b) => react_jsx_runtime.JSX.Element;
|
|
41
41
|
|
|
42
42
|
type Options$1 = {
|
|
43
43
|
label: ReactNode;
|
|
44
44
|
value: string;
|
|
45
45
|
}[];
|
|
46
|
-
interface Props$
|
|
46
|
+
interface Props$a {
|
|
47
47
|
value: string;
|
|
48
48
|
onChange: (value: string) => void;
|
|
49
49
|
width?: string;
|
|
@@ -57,9 +57,9 @@ interface Props$9 {
|
|
|
57
57
|
* @options - list of options, format [{ label: React Node Syntax, value: string }]
|
|
58
58
|
* @returns
|
|
59
59
|
*/
|
|
60
|
-
declare const OptionSlider: ({ value, onChange, width, options, color, }: Props$
|
|
60
|
+
declare const OptionSlider: ({ value, onChange, width, options, color, }: Props$a) => react_jsx_runtime.JSX.Element;
|
|
61
61
|
|
|
62
|
-
interface Props$
|
|
62
|
+
interface Props$9 {
|
|
63
63
|
value: string;
|
|
64
64
|
onChange: (value: string) => void;
|
|
65
65
|
width?: string;
|
|
@@ -71,13 +71,13 @@ interface Props$8 {
|
|
|
71
71
|
* @param width
|
|
72
72
|
* @returns
|
|
73
73
|
*/
|
|
74
|
-
declare const ColorPickerSlider: ({ value, onChange, width }: Props$
|
|
74
|
+
declare const ColorPickerSlider: ({ value, onChange, width }: Props$9) => react_jsx_runtime.JSX.Element;
|
|
75
75
|
|
|
76
76
|
type Options = {
|
|
77
77
|
label: string;
|
|
78
78
|
value: string;
|
|
79
79
|
}[];
|
|
80
|
-
interface Props$
|
|
80
|
+
interface Props$8 {
|
|
81
81
|
options: Options;
|
|
82
82
|
value: string[];
|
|
83
83
|
onChange: React.Dispatch<React.SetStateAction<string[]>>;
|
|
@@ -91,9 +91,9 @@ interface Props$7 {
|
|
|
91
91
|
* @param width - specify the width of the component
|
|
92
92
|
* @returns
|
|
93
93
|
*/
|
|
94
|
-
declare const MultiSelect: ({ options, value, onChange, width }: Props$
|
|
94
|
+
declare const MultiSelect: ({ options, value, onChange, width }: Props$8) => react_jsx_runtime.JSX.Element;
|
|
95
95
|
|
|
96
|
-
interface Props$
|
|
96
|
+
interface Props$7 {
|
|
97
97
|
buttonType?: 'gradient' | 'solid' | 'normal';
|
|
98
98
|
}
|
|
99
99
|
interface Data {
|
|
@@ -117,11 +117,14 @@ interface Children {
|
|
|
117
117
|
* @param second second color when using gradient button, default is #aa6392
|
|
118
118
|
* @returns button UI component
|
|
119
119
|
*/
|
|
120
|
-
declare const Button: ({ buttonType, content, main, first, second, text, isLoading, children, ...props }: Props$
|
|
120
|
+
declare const Button: ({ buttonType, content, main, first, second, text, isLoading, children, ...props }: Props$7 & Data & Children & React.ComponentProps<"button">) => react_jsx_runtime.JSX.Element;
|
|
121
121
|
|
|
122
|
-
interface Props$
|
|
122
|
+
interface Props$6 {
|
|
123
123
|
src?: string;
|
|
124
124
|
setValue: (src?: string) => void;
|
|
125
|
+
options?: {
|
|
126
|
+
defaultImage?: string;
|
|
127
|
+
};
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
127
130
|
* Avatar component. Combination of
|
|
@@ -135,17 +138,23 @@ interface Props$5 {
|
|
|
135
138
|
* @param src source of an image which will be converted to base64 format automatically
|
|
136
139
|
* @param setValue set state function for src
|
|
137
140
|
*
|
|
141
|
+
* @dataflow
|
|
142
|
+
* - source of an image can be undefined. This case, source should be set to default image. In case there is no default image provided, source should be undefined. As source of image is edited, source changes and updates on the image preview
|
|
143
|
+
* - Every source needs to be converted to base64 format using provided conversion method
|
|
144
|
+
* - There is a defaultImage reference that stores the value of default image across the entire component so it can be used to restore default image when clicking delete button or when source of image is undefined
|
|
145
|
+
* - There is an initialImage reference that stores the value of an initial value of image source
|
|
146
|
+
*
|
|
138
147
|
* @example
|
|
139
148
|
* ... component declaration
|
|
140
149
|
* const [src, setValue] = useState<string|undefined>(initialImageStringUrl)
|
|
141
150
|
*
|
|
142
151
|
* return (
|
|
143
|
-
* <Avatar src={src} setValue={setValue} />
|
|
152
|
+
* <Avatar src={src} setValue={setValue} options={{defaultImage: unknown}}/>
|
|
144
153
|
* )
|
|
145
154
|
*/
|
|
146
|
-
declare const Avatar: ({ src, setValue }: Props$
|
|
155
|
+
declare const Avatar: ({ src, setValue, options }: Props$6) => react_jsx_runtime.JSX.Element;
|
|
147
156
|
|
|
148
|
-
interface Props$
|
|
157
|
+
interface Props$5 {
|
|
149
158
|
value?: string;
|
|
150
159
|
setValue?: (value?: string) => void;
|
|
151
160
|
label?: string;
|
|
@@ -172,9 +181,9 @@ interface Props$4 {
|
|
|
172
181
|
* <InputGoogle value={value} setValue={setValue} label="Input Google Component Label" options={{ focusColor: "yellow" }}/>
|
|
173
182
|
* )
|
|
174
183
|
*/
|
|
175
|
-
declare const InputGoogle: ({ value, setValue, label, options, ...props }: Props$
|
|
184
|
+
declare const InputGoogle: ({ value, setValue, label, options, ...props }: Props$5 & React.ComponentProps<"input">) => react_jsx_runtime.JSX.Element;
|
|
176
185
|
|
|
177
|
-
interface Props$
|
|
186
|
+
interface Props$4 {
|
|
178
187
|
value?: string;
|
|
179
188
|
setValue?: (value?: string) => void;
|
|
180
189
|
label?: string;
|
|
@@ -198,10 +207,10 @@ interface Props$3 {
|
|
|
198
207
|
* <TextArea value={value} setValue={setValue} label="Text Component Label" options={{ focusColor: "yellow" }}/>
|
|
199
208
|
* )
|
|
200
209
|
*/
|
|
201
|
-
declare const TextArea: ({ value, setValue, label, options, ...props }: Props$
|
|
210
|
+
declare const TextArea: ({ value, setValue, label, options, ...props }: Props$4 & React.ComponentProps<"textarea">) => react_jsx_runtime.JSX.Element;
|
|
202
211
|
|
|
203
212
|
type FileType = 'image/*' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/svg+xml' | 'image/bmp' | 'image/tiff' | 'video/*' | 'video/mp4' | 'video/mpeg' | 'video/quicktime' | 'video/x-msvideo' | 'video/x-ms-wmv' | 'video/webm' | 'video/ogg' | 'audito/*' | 'audio/mpeg' | 'audio/wav' | 'audio/ogg' | 'audio/aac' | 'audio/flac' | 'audio/x-wav' | 'application/*' | 'application/pdf' | 'application/msword' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'application/vnd.ms-powerpoint' | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' | 'text/plain' | 'text/csv' | 'application/json' | 'application/zip' | 'application/octet-stream' | 'application/x-tar' | 'application/x-rar-compressed';
|
|
204
|
-
interface Props$
|
|
213
|
+
interface Props$3 {
|
|
205
214
|
file?: File;
|
|
206
215
|
onChoose: (file: File) => void;
|
|
207
216
|
onCancel?: () => void;
|
|
@@ -214,9 +223,9 @@ interface Props$2 {
|
|
|
214
223
|
* @param onCancel if a popup is closed without any chosen data
|
|
215
224
|
* @param acceptType accepted file type
|
|
216
225
|
*/
|
|
217
|
-
declare const InputFile: ({ file, onChoose, onCancel, acceptType, ...props }: Props$
|
|
226
|
+
declare const InputFile: ({ file, onChoose, onCancel, acceptType, ...props }: Props$3 & React$1.ComponentProps<"input">) => react_jsx_runtime.JSX.Element;
|
|
218
227
|
|
|
219
|
-
interface Props$
|
|
228
|
+
interface Props$2 {
|
|
220
229
|
setSrc?: (src?: string) => void;
|
|
221
230
|
}
|
|
222
231
|
/**
|
|
@@ -225,7 +234,7 @@ interface Props$1 {
|
|
|
225
234
|
* @param setSrc
|
|
226
235
|
* @returns
|
|
227
236
|
*/
|
|
228
|
-
declare const UploadImage: ({ setSrc, ...props }: Props$
|
|
237
|
+
declare const UploadImage: ({ setSrc, ...props }: Props$2 & React.ComponentProps<"input">) => react_jsx_runtime.JSX.Element;
|
|
229
238
|
|
|
230
239
|
/**
|
|
231
240
|
* A wrap around HTML Image Element
|
|
@@ -234,7 +243,7 @@ declare const UploadImage: ({ setSrc, ...props }: Props$1 & React.ComponentProps
|
|
|
234
243
|
*/
|
|
235
244
|
declare const Image$1: ({ ...props }: React.ComponentProps<"img">) => react_jsx_runtime.JSX.Element;
|
|
236
245
|
|
|
237
|
-
interface Props {
|
|
246
|
+
interface Props$1 {
|
|
238
247
|
src?: string;
|
|
239
248
|
setSrc?: (src?: string) => void;
|
|
240
249
|
isOpen?: boolean;
|
|
@@ -260,40 +269,42 @@ interface Props {
|
|
|
260
269
|
* - When hitting cancel button, it changes isOpen state
|
|
261
270
|
* - When hitting reset button, it runs reset method on transform object state
|
|
262
271
|
*/
|
|
263
|
-
declare const ImageEditor: ({ src, setSrc, isOpen, setOpen, isNew, }: Props) => react_jsx_runtime.JSX.Element | undefined;
|
|
272
|
+
declare const ImageEditor: ({ src, setSrc, isOpen, setOpen, isNew, }: Props$1) => react_jsx_runtime.JSX.Element | undefined;
|
|
264
273
|
|
|
265
|
-
interface
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
*/
|
|
278
|
-
drawImage(e: any, ctx: CanvasRenderingContext2D, x: number, y: number, scale: number, angle: number, canvas: HTMLCanvasElement, containerWidth: number, containerHeight: number): {
|
|
279
|
-
context: CanvasRenderingContext2D;
|
|
280
|
-
src: string;
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* Draw a color on canvas
|
|
284
|
-
*/
|
|
285
|
-
drawColor(type: string, color: string, ctx: CanvasRenderingContext2D, width: number, ratio: number): [CanvasRenderingContext2D, string];
|
|
274
|
+
interface WICanvas {
|
|
275
|
+
drawImage({ e, x, y, angle, width, height, containerHeight, containerWidth, }: {
|
|
276
|
+
e: HTMLImageElement;
|
|
277
|
+
x: number;
|
|
278
|
+
y: number;
|
|
279
|
+
angle: number;
|
|
280
|
+
width: number;
|
|
281
|
+
height: number;
|
|
282
|
+
containerWidth: number;
|
|
283
|
+
containerHeight: number;
|
|
284
|
+
}): void;
|
|
285
|
+
drawColor(type: string, color: string, width: number, ratio: number): void;
|
|
286
286
|
}
|
|
287
|
-
declare class Canvas implements
|
|
288
|
-
|
|
287
|
+
declare class Canvas implements WICanvas {
|
|
288
|
+
private canvas;
|
|
289
|
+
private canvas2DContext;
|
|
290
|
+
private src?;
|
|
291
|
+
constructor(width: number, height: number);
|
|
292
|
+
get(): {
|
|
289
293
|
canvas: HTMLCanvasElement;
|
|
290
294
|
context: CanvasRenderingContext2D;
|
|
295
|
+
src: string | undefined;
|
|
291
296
|
};
|
|
292
|
-
drawImage(e
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
+
drawImage({ e, x, y, angle, width, height, containerHeight, containerWidth, }: {
|
|
298
|
+
e: HTMLImageElement;
|
|
299
|
+
x: number;
|
|
300
|
+
y: number;
|
|
301
|
+
angle: number;
|
|
302
|
+
width: number;
|
|
303
|
+
height: number;
|
|
304
|
+
containerWidth: number;
|
|
305
|
+
containerHeight: number;
|
|
306
|
+
}): void;
|
|
307
|
+
drawColor(type: string, color: string, width: number, ratio: number): void;
|
|
297
308
|
}
|
|
298
309
|
|
|
299
310
|
declare const Image: {
|
|
@@ -304,7 +315,7 @@ declare const Image: {
|
|
|
304
315
|
*/
|
|
305
316
|
FromFileToImageSrc(file?: File | Blob): Promise<string | null>;
|
|
306
317
|
/**
|
|
307
|
-
*
|
|
318
|
+
* Take a url, look for the corresponding image file, and convert it to base64 format
|
|
308
319
|
* @param url
|
|
309
320
|
* @returns
|
|
310
321
|
*/
|
|
@@ -318,63 +329,175 @@ declare const Image: {
|
|
|
318
329
|
isBase64(url?: string): boolean;
|
|
319
330
|
};
|
|
320
331
|
|
|
332
|
+
interface IWElement {
|
|
333
|
+
/**
|
|
334
|
+
* Add Event Listener
|
|
335
|
+
* @param type
|
|
336
|
+
* @param listener
|
|
337
|
+
* @param options
|
|
338
|
+
*/
|
|
339
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
340
|
+
/**
|
|
341
|
+
* Get element dimension
|
|
342
|
+
*/
|
|
343
|
+
getDimension(): {
|
|
344
|
+
x: number;
|
|
345
|
+
y: number;
|
|
346
|
+
angle: number;
|
|
347
|
+
width: number;
|
|
348
|
+
height: number;
|
|
349
|
+
ratio: number;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Set element dimension
|
|
353
|
+
*/
|
|
354
|
+
setDimension({ x, y, angle, width, height, }: {
|
|
355
|
+
x?: number;
|
|
356
|
+
y?: number;
|
|
357
|
+
angle?: number;
|
|
358
|
+
width?: number;
|
|
359
|
+
height?: number;
|
|
360
|
+
}): void;
|
|
361
|
+
/**
|
|
362
|
+
* Set position css property
|
|
363
|
+
* @param position
|
|
364
|
+
*/
|
|
365
|
+
setPosition(position: 'fixed' | 'relative' | 'absolute' | 'unset'): void;
|
|
366
|
+
/**
|
|
367
|
+
* Perform drag
|
|
368
|
+
* @param x
|
|
369
|
+
* @param y
|
|
370
|
+
*/
|
|
371
|
+
drag(x?: number, y?: number): void;
|
|
372
|
+
/**
|
|
373
|
+
* Perform rotation
|
|
374
|
+
* @param angle
|
|
375
|
+
*/
|
|
376
|
+
rotate(angle?: number): void;
|
|
377
|
+
/**
|
|
378
|
+
* Perform resize
|
|
379
|
+
* @param width
|
|
380
|
+
* @param height
|
|
381
|
+
*/
|
|
382
|
+
resize(width?: number, height?: number): void;
|
|
383
|
+
/**
|
|
384
|
+
* Method runs a side effect handler for a specific element
|
|
385
|
+
*/
|
|
386
|
+
runSideEffectHandler(): void;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare class TransformOperationExtension {
|
|
390
|
+
private xOrigin;
|
|
391
|
+
private yOrigin;
|
|
392
|
+
private wOrigin;
|
|
393
|
+
private hOrigin;
|
|
394
|
+
private isSideEffect;
|
|
395
|
+
private sideEffectList;
|
|
396
|
+
subscribeSideEffect(element: IWElement): void;
|
|
397
|
+
runSideEffectHandler(): void;
|
|
398
|
+
setSideEffectState(value?: boolean): void;
|
|
399
|
+
getSideEffectState(): boolean;
|
|
400
|
+
setOrigin({ x, y, width, height, }: {
|
|
401
|
+
x: number;
|
|
402
|
+
y: number;
|
|
403
|
+
width: number;
|
|
404
|
+
height: number;
|
|
405
|
+
}): void;
|
|
406
|
+
getOrigin(): {
|
|
407
|
+
x: number;
|
|
408
|
+
y: number;
|
|
409
|
+
width: number;
|
|
410
|
+
height: number;
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
321
414
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* Element 3 : Image element
|
|
327
|
-
*
|
|
328
|
-
* Element 4 : Controller
|
|
329
|
-
*
|
|
330
|
-
* @example
|
|
331
|
-
* ```ts
|
|
332
|
-
* <div class="frame"> (2)
|
|
333
|
-
* <div class="wrapper"> (1)
|
|
334
|
-
* <img class="img__preview" /> (3)
|
|
335
|
-
* </div>
|
|
336
|
-
* </div>
|
|
337
|
-
* ```
|
|
415
|
+
* Transform Operation class
|
|
416
|
+
* - Design pattern used here is Composite Pattern
|
|
417
|
+
* - Implement IWElement as group of IWElement
|
|
338
418
|
*/
|
|
339
|
-
declare class
|
|
340
|
-
private
|
|
341
|
-
private ele2;
|
|
419
|
+
declare class TransformOperation extends TransformOperationExtension implements IWElement {
|
|
420
|
+
private list;
|
|
342
421
|
private x;
|
|
343
422
|
private y;
|
|
344
423
|
private angle;
|
|
345
|
-
private
|
|
346
|
-
private
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
initialize(): Promise<void>;
|
|
358
|
-
reset(): void;
|
|
359
|
-
setState({ x, y, angle, w, }: {
|
|
424
|
+
private width;
|
|
425
|
+
private height;
|
|
426
|
+
setPosition(position: 'fixed' | 'relative' | 'absolute' | 'unset'): void;
|
|
427
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
428
|
+
setDimension({ x, y, angle, width, height, }: {
|
|
429
|
+
x?: number;
|
|
430
|
+
y?: number;
|
|
431
|
+
angle?: number;
|
|
432
|
+
width?: number;
|
|
433
|
+
height?: number;
|
|
434
|
+
}): void;
|
|
435
|
+
getDimension(): {
|
|
360
436
|
x: number;
|
|
361
437
|
y: number;
|
|
362
438
|
angle: number;
|
|
363
|
-
|
|
439
|
+
width: number;
|
|
440
|
+
height: number;
|
|
441
|
+
ratio: number;
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* Register an HTML Element to the TransformOperation
|
|
445
|
+
* @param element
|
|
446
|
+
*/
|
|
447
|
+
subscribe(element: IWElement): void;
|
|
448
|
+
drag(x?: number, y?: number): void;
|
|
449
|
+
rotate(angle?: number): void;
|
|
450
|
+
resize(width?: number, height?: number): void;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface Props {
|
|
454
|
+
container: HTMLElement;
|
|
455
|
+
frame: HTMLElement;
|
|
456
|
+
img: HTMLImageElement;
|
|
457
|
+
controller: HTMLElement;
|
|
458
|
+
topLeft: HTMLElement;
|
|
459
|
+
topRight: HTMLElement;
|
|
460
|
+
bottomLeft: HTMLElement;
|
|
461
|
+
bottomRight: HTMLElement;
|
|
462
|
+
rotate: HTMLElement;
|
|
463
|
+
transformOperation: TransformOperation;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Transform is responsible for correctly setting dimension and side effect for editor
|
|
467
|
+
* - Intialize state
|
|
468
|
+
* - Get state
|
|
469
|
+
* - Set state
|
|
470
|
+
* - Reset state
|
|
471
|
+
*/
|
|
472
|
+
declare class Transform {
|
|
473
|
+
private frame;
|
|
474
|
+
private img;
|
|
475
|
+
private container;
|
|
476
|
+
private controller;
|
|
477
|
+
private topLeft;
|
|
478
|
+
private topRight;
|
|
479
|
+
private bottomLeft;
|
|
480
|
+
private bottomRight;
|
|
481
|
+
private rotate;
|
|
482
|
+
private transformOperation;
|
|
483
|
+
constructor({ container, frame, img, controller, topLeft, topRight, bottomLeft, bottomRight, rotate, transformOperation, }: Props);
|
|
484
|
+
initialize(): Transform;
|
|
485
|
+
setState({ x, y, angle, width, height, }: {
|
|
486
|
+
x?: number;
|
|
487
|
+
y?: number;
|
|
488
|
+
angle?: number;
|
|
489
|
+
width?: number;
|
|
490
|
+
height?: number;
|
|
364
491
|
}): void;
|
|
365
|
-
|
|
366
|
-
exportData(): {
|
|
492
|
+
getState(): {
|
|
367
493
|
x: number;
|
|
368
494
|
y: number;
|
|
369
495
|
angle: number;
|
|
370
|
-
|
|
371
|
-
|
|
496
|
+
width: number;
|
|
497
|
+
height: number;
|
|
498
|
+
ratio: number;
|
|
372
499
|
};
|
|
373
|
-
|
|
374
|
-
private resize;
|
|
375
|
-
private rotateBox;
|
|
376
|
-
private handleElementGoOffScreen;
|
|
377
|
-
private transform;
|
|
500
|
+
reset(): Transform;
|
|
378
501
|
}
|
|
379
502
|
|
|
380
503
|
interface HandleAsyncType<DataType> {
|
|
@@ -541,4 +664,77 @@ declare const SessionProvider: ({ value, children, }: {
|
|
|
541
664
|
*/
|
|
542
665
|
declare const useAuthClient: (auth: AuthInterface<SessionType>) => SessionContextType;
|
|
543
666
|
|
|
544
|
-
|
|
667
|
+
/**
|
|
668
|
+
* Linear Algebra library - Will Phan
|
|
669
|
+
* - Vector used in this library will be 3 dimension vector = [x, y, 1] : number[]
|
|
670
|
+
* - Accessing x by using vector[0]
|
|
671
|
+
* - Accessing y by using vector[1]
|
|
672
|
+
*/
|
|
673
|
+
declare const LinearAlgebra: {
|
|
674
|
+
/**
|
|
675
|
+
* Translate a point by a vector
|
|
676
|
+
* @param vector coordinates of a point
|
|
677
|
+
* @param translateVector vector for translation
|
|
678
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
679
|
+
*/
|
|
680
|
+
translateVector(vector: number[], translateVector: number[]): number[];
|
|
681
|
+
/**
|
|
682
|
+
* Rotate a vector by an angle in radian
|
|
683
|
+
* @param vector
|
|
684
|
+
* @param angle
|
|
685
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
686
|
+
*/
|
|
687
|
+
rotateVector(vector: number[], angle: number): number[];
|
|
688
|
+
/**
|
|
689
|
+
* Get opposite vector
|
|
690
|
+
* @param vector
|
|
691
|
+
*/
|
|
692
|
+
getOppositeVector(vector: number[]): number[];
|
|
693
|
+
/**
|
|
694
|
+
* Nicolas Mattia formula
|
|
695
|
+
* @param vector
|
|
696
|
+
* @param translate
|
|
697
|
+
* @param angle
|
|
698
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
699
|
+
*
|
|
700
|
+
* @link https://nmattia.com/posts/2020-03-03-drag-resize-rotate/
|
|
701
|
+
*/
|
|
702
|
+
NicolasMattia(vector: number[], translate: number[], angle: number): number[];
|
|
703
|
+
/**
|
|
704
|
+
* Set coofficient for a vector
|
|
705
|
+
* @param coefficient
|
|
706
|
+
* @param vector
|
|
707
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
708
|
+
*/
|
|
709
|
+
setCoefficient(coefficient: number, vector: number[]): number[];
|
|
710
|
+
/**
|
|
711
|
+
* Plus 2 vectors
|
|
712
|
+
* @param vector1
|
|
713
|
+
* @param vector2
|
|
714
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
715
|
+
*/
|
|
716
|
+
plusVectors(vector1: number[], vector2: number[]): number[];
|
|
717
|
+
/**
|
|
718
|
+
* Get middle vector from 2 vectors
|
|
719
|
+
* @param vector1
|
|
720
|
+
* @param vector2
|
|
721
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
722
|
+
*/
|
|
723
|
+
getMiddleVectorFrom(vector1: number[], vector2: number[]): number[];
|
|
724
|
+
/**
|
|
725
|
+
* Compute dot products between two vectors
|
|
726
|
+
* @param vector1
|
|
727
|
+
* @param vector2
|
|
728
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
729
|
+
*/
|
|
730
|
+
dotProduct(vector1: number[], vector2: number[]): number;
|
|
731
|
+
/**
|
|
732
|
+
* Get vector magnitude
|
|
733
|
+
* - formula : if vector = [x,y] => magnitude = square root of x^2 + y^2
|
|
734
|
+
* @param vector
|
|
735
|
+
* @throws Exception if the vector is not in 3 dimension
|
|
736
|
+
*/
|
|
737
|
+
getVectorMagnitude(vector: number[]): number;
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
export { type AuthInterface, Avatar, Button, Canvas, ColorPickerSlider, DropdownSelect, Image$1 as Image, ImageEditor, Image as ImageUtilities, InputFile, InputGoogle, LinearAlgebra, MultiSelect, OptionSlider, type Options$2 as Options, RangeSlider, SessionProvider, type SessionType, type Options$1 as SliderOptions, type StorageInterface, TextArea, Transform, UploadImage, tools, useAuthClient, useSession };
|