@leapfrog/interactive-canvas 0.1.0 → 1.0.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.
Files changed (61) hide show
  1. package/dist/{interactive-canvas.impl.d.ts → abstract-interactive-canvas.d.ts} +340 -305
  2. package/dist/dimensions/pixel-canvas-dimensions.d.ts +13 -13
  3. package/dist/dimensions/print-6-col-canvas-dimensions.d.ts +18 -18
  4. package/dist/dimensions/print-8-col-canvas-dimensions.d.ts +18 -18
  5. package/dist/font/font-library.d.ts +27 -22
  6. package/dist/font/font-library.interface.d.ts +24 -20
  7. package/dist/font/font.interface.d.ts +20 -20
  8. package/dist/font/unknown-font.d.ts +6 -6
  9. package/dist/headless-interactive-canvas.d.ts +9 -0
  10. package/dist/index.d.ts +49 -47
  11. package/dist/interactive-canvas.d.ts +8 -0
  12. package/dist/interactive-canvas.es.js +3193 -0
  13. package/dist/interactive-canvas.interface.d.ts +267 -221
  14. package/dist/interactive-canvas.js +3222 -34
  15. package/dist/layout/abstract-layout-manager.d.ts +17 -18
  16. package/dist/layout/advanced-layout-manager.d.ts +15 -15
  17. package/dist/layout/function/pin-to-bottom.layout-function.d.ts +4 -4
  18. package/dist/layout/function/redraw-all.layout-function.d.ts +4 -4
  19. package/dist/layout/function/reposition-borders.layout-function.d.ts +4 -4
  20. package/dist/layout/function/reposition-cutoffs.layout-function.d.ts +4 -4
  21. package/dist/layout/function/resize-canvas.layout-function.d.ts +4 -4
  22. package/dist/layout/function/stack-objects.layout-function.d.ts +11 -11
  23. package/dist/layout/function/update-object-dimensions.layout-function.d.ts +4 -4
  24. package/dist/layout/layout-manager.enum.d.ts +5 -5
  25. package/dist/layout/layout-manager.interface.d.ts +13 -13
  26. package/dist/layout/standard-layout-manager.d.ts +35 -36
  27. package/dist/mutator/mutable-background-color.interface.d.ts +15 -15
  28. package/dist/mutator/mutable-color.interface.d.ts +6 -6
  29. package/dist/mutator/mutable-image.interface.d.ts +28 -28
  30. package/dist/mutator/mutable-position.interface.d.ts +33 -33
  31. package/dist/mutator/mutable-text-style.interface.d.ts +163 -149
  32. package/dist/mutator/mutable-text.interface.d.ts +40 -40
  33. package/dist/object/abstract-canvas-object.d.ts +155 -155
  34. package/dist/object/canvas-object-data.d.ts +23 -23
  35. package/dist/object/canvas-object.interface.d.ts +96 -96
  36. package/dist/object/impl/border.d.ts +59 -60
  37. package/dist/object/impl/cutoff.d.ts +59 -60
  38. package/dist/object/impl/horizontal-rule.d.ts +88 -89
  39. package/dist/object/impl/image.d.ts +81 -82
  40. package/dist/object/impl/rectangle.d.ts +58 -59
  41. package/dist/object/impl/text.d.ts +264 -255
  42. package/dist/object/impl/vertical-rule.d.ts +88 -89
  43. package/dist/profile/canvas-profile.interface.d.ts +22 -22
  44. package/dist/profile/default-canvas-profile.d.ts +23 -23
  45. package/dist/types/canvas-dimension-restrictions.interface.d.ts +14 -14
  46. package/dist/types/canvas-dimensions.interface.d.ts +21 -21
  47. package/dist/types/canvas-state.interface.d.ts +11 -11
  48. package/dist/types/dimension-restrictions.interface.d.ts +6 -6
  49. package/dist/types/image-type.enum.d.ts +6 -6
  50. package/dist/types/margin.interface.d.ts +6 -6
  51. package/dist/types/object-dimensions.interface.d.ts +23 -23
  52. package/dist/types/object-type.enum.d.ts +10 -10
  53. package/dist/types/overflow.interface.d.ts +4 -4
  54. package/dist/types/position.interface.d.ts +6 -6
  55. package/dist/types/rect.interface.d.ts +6 -6
  56. package/dist/types/selection-data.interface.d.ts +19 -19
  57. package/dist/types/text-alignment.interface.d.ts +1 -1
  58. package/package.json +7 -9
  59. package/readme.md +12 -1
  60. package/dist/interactive-canvas.js.map +0 -1
  61. package/dist/interactive-canvas.nomin.js +0 -57456
@@ -1,60 +1,59 @@
1
- import { Observable } from "rxjs";
2
- import { ICanvasObject } from "../canvas-object.interface";
3
- import { IMutableColor } from "../..";
4
- import { AbstractCanvasObject } from "../abstract-canvas-object";
5
- import { InteractiveCanvas } from "../../interactive-canvas.impl";
6
- import { CanvasObjectData } from "../canvas-object-data";
7
- import { fabric } from "fabric";
8
- /**
9
- * Cutoff field. A cutoff rule that sits on the bottom of the canvas.
10
- */
11
- export interface ICutoff extends ICanvasObject, IMutableColor {
12
- /**
13
- * Get the width of the cutoff stroke.
14
- */
15
- getStrokeWidth(): number;
16
- /**
17
- * Get an observable of the width of the cutoff stroke.
18
- */
19
- getStrokeWidth$(): Observable<number>;
20
- /**
21
- * Set the cutoff stroke width.
22
- * @param width New width.
23
- */
24
- setStrokeWidth(width: number): void;
25
- }
26
- export declare class Cutoff extends AbstractCanvasObject<fabric.Rect> implements ICutoff {
27
- private readonly strokeWidth$;
28
- constructor(canvas: InteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
29
- /**
30
- * @override
31
- * @inheritDoc
32
- */
33
- getColor(): string;
34
- /**
35
- * @override
36
- * @inheritDoc
37
- */
38
- setColor(color: string): void;
39
- /**
40
- * @override
41
- * @inheritDoc
42
- */
43
- getStrokeWidth(): number;
44
- /**
45
- * @override
46
- * @inheritDoc
47
- */
48
- getStrokeWidth$(): Observable<number>;
49
- /**
50
- * @override
51
- * @inheritDoc
52
- */
53
- setStrokeWidth(width: number): void;
54
- updatePosition(): void;
55
- /**
56
- * @override
57
- * @inheritDoc
58
- */
59
- protected updateFabricObjectBehavior(): void;
60
- }
1
+ import { Observable } from "rxjs";
2
+ import { ICanvasObject } from "../canvas-object.interface";
3
+ import { IInteractiveCanvas, IMutableColor } from "../..";
4
+ import { AbstractCanvasObject } from "../abstract-canvas-object";
5
+ import { CanvasObjectData } from "../canvas-object-data";
6
+ import { fabric } from "fabric";
7
+ /**
8
+ * Cutoff field. A cutoff rule that sits on the bottom of the canvas.
9
+ */
10
+ export interface ICutoff extends ICanvasObject, IMutableColor {
11
+ /**
12
+ * Get the width of the cutoff stroke.
13
+ */
14
+ getStrokeWidth(): number;
15
+ /**
16
+ * Get an observable of the width of the cutoff stroke.
17
+ */
18
+ getStrokeWidth$(): Observable<number>;
19
+ /**
20
+ * Set the cutoff stroke width.
21
+ * @param width New width.
22
+ */
23
+ setStrokeWidth(width: number): void;
24
+ }
25
+ export declare class Cutoff extends AbstractCanvasObject<fabric.Rect> implements ICutoff {
26
+ private readonly strokeWidth$;
27
+ constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
28
+ /**
29
+ * @override
30
+ * @inheritDoc
31
+ */
32
+ getColor(): string;
33
+ /**
34
+ * @override
35
+ * @inheritDoc
36
+ */
37
+ setColor(color: string): void;
38
+ /**
39
+ * @override
40
+ * @inheritDoc
41
+ */
42
+ getStrokeWidth(): number;
43
+ /**
44
+ * @override
45
+ * @inheritDoc
46
+ */
47
+ getStrokeWidth$(): Observable<number>;
48
+ /**
49
+ * @override
50
+ * @inheritDoc
51
+ */
52
+ setStrokeWidth(width: number): void;
53
+ updatePosition(): void;
54
+ /**
55
+ * @override
56
+ * @inheritDoc
57
+ */
58
+ protected updateFabricObjectBehavior(): void;
59
+ }
@@ -1,89 +1,88 @@
1
- import { Observable } from "rxjs";
2
- import { ICanvasObject } from "../canvas-object.interface";
3
- import { IMutableColor, IMutablePosition } from "../..";
4
- import { AbstractCanvasObject } from "../abstract-canvas-object";
5
- import { CanvasObjectData } from "../canvas-object-data";
6
- import { InteractiveCanvas } from "../../interactive-canvas.impl";
7
- import { fabric } from "fabric";
8
- /**
9
- * Horizontal rule. A basic block of color in a thin line across the canvas.
10
- */
11
- export interface IHorizontalRule extends ICanvasObject, IMutableColor, IMutablePosition {
12
- /**
13
- * Get the width of the rule.
14
- */
15
- getStrokeWidth(): number;
16
- /**
17
- * Get an observable of the width of the rule.
18
- */
19
- getStrokeWidth$(): Observable<number>;
20
- /**
21
- * Set the rule width.
22
- * @param width New width.
23
- */
24
- setStrokeWidth(width: number): void;
25
- }
26
- export declare class HorizontalRule extends AbstractCanvasObject<fabric.Rect> implements IHorizontalRule {
27
- private readonly strokeWidth$;
28
- constructor(canvas: InteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
29
- /**
30
- * @override
31
- * @inheritDoc
32
- */
33
- getStrokeWidth(): number;
34
- /**
35
- * @override
36
- * @inheritDoc
37
- */
38
- getStrokeWidth$(): Observable<number>;
39
- /**
40
- * @override
41
- * @inheritDoc
42
- */
43
- setStrokeWidth(value: number): void;
44
- /**
45
- * @override
46
- * @inheritDoc
47
- */
48
- getColor(): string;
49
- /**
50
- * @override
51
- * @inheritDoc
52
- */
53
- setColor(color: string): void;
54
- /**
55
- * @override
56
- * @inheritDoc
57
- */
58
- centerHorizontally(): void;
59
- /**
60
- * @override
61
- * @inheritDoc
62
- */
63
- centerVertically(): void;
64
- /**
65
- * @override
66
- * @inheritDoc
67
- */
68
- setHeight(height: number): void;
69
- /**
70
- * @override
71
- * @inheritDoc
72
- */
73
- nudgeUp(): void;
74
- /**
75
- * @override
76
- * @inheritDoc
77
- */
78
- nudgeDown(): void;
79
- /**
80
- * @override
81
- * @inheritDoc
82
- */
83
- nudgeLeft(): void;
84
- /**
85
- * @override
86
- * @inheritDoc
87
- */
88
- nudgeRight(): void;
89
- }
1
+ import { Observable } from "rxjs";
2
+ import { ICanvasObject } from "../canvas-object.interface";
3
+ import { IInteractiveCanvas, IMutableColor, IMutablePosition } from "../..";
4
+ import { AbstractCanvasObject } from "../abstract-canvas-object";
5
+ import { CanvasObjectData } from "../canvas-object-data";
6
+ import { fabric } from "fabric";
7
+ /**
8
+ * Horizontal rule. A basic block of color in a thin line across the canvas.
9
+ */
10
+ export interface IHorizontalRule extends ICanvasObject, IMutableColor, IMutablePosition {
11
+ /**
12
+ * Get the width of the rule.
13
+ */
14
+ getStrokeWidth(): number;
15
+ /**
16
+ * Get an observable of the width of the rule.
17
+ */
18
+ getStrokeWidth$(): Observable<number>;
19
+ /**
20
+ * Set the rule width.
21
+ * @param width New width.
22
+ */
23
+ setStrokeWidth(width: number): void;
24
+ }
25
+ export declare class HorizontalRule extends AbstractCanvasObject<fabric.Rect> implements IHorizontalRule {
26
+ private readonly strokeWidth$;
27
+ constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
28
+ /**
29
+ * @override
30
+ * @inheritDoc
31
+ */
32
+ getStrokeWidth(): number;
33
+ /**
34
+ * @override
35
+ * @inheritDoc
36
+ */
37
+ getStrokeWidth$(): Observable<number>;
38
+ /**
39
+ * @override
40
+ * @inheritDoc
41
+ */
42
+ setStrokeWidth(value: number): void;
43
+ /**
44
+ * @override
45
+ * @inheritDoc
46
+ */
47
+ getColor(): string;
48
+ /**
49
+ * @override
50
+ * @inheritDoc
51
+ */
52
+ setColor(color: string): void;
53
+ /**
54
+ * @override
55
+ * @inheritDoc
56
+ */
57
+ centerHorizontally(): void;
58
+ /**
59
+ * @override
60
+ * @inheritDoc
61
+ */
62
+ centerVertically(): void;
63
+ /**
64
+ * @override
65
+ * @inheritDoc
66
+ */
67
+ setHeight(height: number): void;
68
+ /**
69
+ * @override
70
+ * @inheritDoc
71
+ */
72
+ nudgeUp(): void;
73
+ /**
74
+ * @override
75
+ * @inheritDoc
76
+ */
77
+ nudgeDown(): void;
78
+ /**
79
+ * @override
80
+ * @inheritDoc
81
+ */
82
+ nudgeLeft(): void;
83
+ /**
84
+ * @override
85
+ * @inheritDoc
86
+ */
87
+ nudgeRight(): void;
88
+ }
@@ -1,82 +1,81 @@
1
- import { IDimensionRestrictions, IMutableImage, IMutablePosition, IPosition } from "../..";
2
- import { ICanvasObject } from "../canvas-object.interface";
3
- import { AbstractCanvasObject } from "../abstract-canvas-object";
4
- import { InteractiveCanvas } from "../../interactive-canvas.impl";
5
- import { Observable } from "rxjs";
6
- import { CanvasObjectData } from "../canvas-object-data";
7
- import { fabric } from "fabric";
8
- /**
9
- * Image field. Displays a custom image on the canvas.
10
- */
11
- export interface IImage extends ICanvasObject, IMutableImage, IMutablePosition {
12
- }
13
- export declare class Image extends AbstractCanvasObject<fabric.Image> implements IImage {
14
- private readonly DEFAULT_RESTRICTIONS;
15
- private layoutWidth;
16
- private readonly imageUrl$;
17
- constructor(canvas: InteractiveCanvas, fabricObject: fabric.Image, persistedField?: CanvasObjectData);
18
- /**
19
- * @override
20
- * @inheritDoc
21
- */
22
- getImageUrl(): string;
23
- /**
24
- * @override
25
- * @inheritDoc
26
- */
27
- getImageUrl$(): Observable<string>;
28
- /**
29
- * @override
30
- * @inheritDoc
31
- */
32
- setImageUrl(url: string): void;
33
- /**
34
- * @override
35
- * @inheritDoc
36
- */
37
- setImageWidth(px: number, sizeRestrictions?: IDimensionRestrictions): number;
38
- /**
39
- * @override
40
- * @inheritDoc
41
- */
42
- centerHorizontally(): void;
43
- /**
44
- * @override
45
- * @inheritDoc
46
- */
47
- centerVertically(): void;
48
- /**
49
- * @override
50
- * @inheritDoc
51
- */
52
- setHeight(height: number): void;
53
- /**
54
- * @override
55
- * @inheritDoc
56
- */
57
- nudgeUp(): void;
58
- /**
59
- * @override
60
- * @inheritDoc
61
- */
62
- nudgeDown(): void;
63
- /**
64
- * @override
65
- * @inheritDoc
66
- */
67
- nudgeLeft(): void;
68
- /**
69
- * @override
70
- * @inheritDoc
71
- */
72
- nudgeRight(): void;
73
- /**
74
- * @override
75
- * @inheritDoc
76
- */
77
- setPosition(position: IPosition): void;
78
- private centerHorizontallyInLayoutWidth;
79
- private setCanvasImage;
80
- private getMinWidthBasedOnMinHeight;
81
- private getMaxWidthBasedOnMaxHeight;
82
- }
1
+ import { IDimensionRestrictions, IInteractiveCanvas, IMutableImage, IMutablePosition, IPosition } from "../..";
2
+ import { ICanvasObject } from "../canvas-object.interface";
3
+ import { AbstractCanvasObject } from "../abstract-canvas-object";
4
+ import { Observable } from "rxjs";
5
+ import { CanvasObjectData } from "../canvas-object-data";
6
+ import { fabric } from "fabric";
7
+ /**
8
+ * Image field. Displays a custom image on the canvas.
9
+ */
10
+ export interface IImage extends ICanvasObject, IMutableImage, IMutablePosition {
11
+ }
12
+ export declare class Image extends AbstractCanvasObject<fabric.Image> implements IImage {
13
+ private readonly DEFAULT_RESTRICTIONS;
14
+ private layoutWidth;
15
+ private readonly imageUrl$;
16
+ constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Image, persistedField?: CanvasObjectData);
17
+ /**
18
+ * @override
19
+ * @inheritDoc
20
+ */
21
+ getImageUrl(): string;
22
+ /**
23
+ * @override
24
+ * @inheritDoc
25
+ */
26
+ getImageUrl$(): Observable<string>;
27
+ /**
28
+ * @override
29
+ * @inheritDoc
30
+ */
31
+ setImageUrl(url: string): void;
32
+ /**
33
+ * @override
34
+ * @inheritDoc
35
+ */
36
+ setImageWidth(px: number, sizeRestrictions?: IDimensionRestrictions): number;
37
+ /**
38
+ * @override
39
+ * @inheritDoc
40
+ */
41
+ centerHorizontally(): void;
42
+ /**
43
+ * @override
44
+ * @inheritDoc
45
+ */
46
+ centerVertically(): void;
47
+ /**
48
+ * @override
49
+ * @inheritDoc
50
+ */
51
+ setHeight(height: number): void;
52
+ /**
53
+ * @override
54
+ * @inheritDoc
55
+ */
56
+ nudgeUp(): void;
57
+ /**
58
+ * @override
59
+ * @inheritDoc
60
+ */
61
+ nudgeDown(): void;
62
+ /**
63
+ * @override
64
+ * @inheritDoc
65
+ */
66
+ nudgeLeft(): void;
67
+ /**
68
+ * @override
69
+ * @inheritDoc
70
+ */
71
+ nudgeRight(): void;
72
+ /**
73
+ * @override
74
+ * @inheritDoc
75
+ */
76
+ setPosition(position: IPosition): void;
77
+ private centerHorizontallyInLayoutWidth;
78
+ private setCanvasImage;
79
+ private getMinWidthBasedOnMinHeight;
80
+ private getMaxWidthBasedOnMaxHeight;
81
+ }
@@ -1,59 +1,58 @@
1
- import { ICanvasObject } from "../canvas-object.interface";
2
- import { IMutableColor, IMutablePosition } from "../..";
3
- import { AbstractCanvasObject } from "../abstract-canvas-object";
4
- import { InteractiveCanvas } from "../../interactive-canvas.impl";
5
- import { CanvasObjectData } from "../canvas-object-data";
6
- import { fabric } from "fabric";
7
- /**
8
- * Rectangle field. A basic block of color that can be moved and scaled.
9
- */
10
- export interface IRectangle extends ICanvasObject, IMutableColor, IMutablePosition {
11
- }
12
- export declare class Rectangle extends AbstractCanvasObject<fabric.Rect> implements IRectangle {
13
- constructor(canvas: InteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
14
- /**
15
- * @override
16
- * @inheritDoc
17
- */
18
- getColor(): string;
19
- /**
20
- * @override
21
- * @inheritDoc
22
- */
23
- setColor(color: string): void;
24
- /**
25
- * @override
26
- * @inheritDoc
27
- */
28
- centerHorizontally(): void;
29
- /**
30
- * @override
31
- * @inheritDoc
32
- */
33
- centerVertically(): void;
34
- /**
35
- * @override
36
- * @inheritDoc
37
- */
38
- setHeight(height: number): void;
39
- /**
40
- * @override
41
- * @inheritDoc
42
- */
43
- nudgeUp(): void;
44
- /**
45
- * @override
46
- * @inheritDoc
47
- */
48
- nudgeDown(): void;
49
- /**
50
- * @override
51
- * @inheritDoc
52
- */
53
- nudgeLeft(): void;
54
- /**
55
- * @override
56
- * @inheritDoc
57
- */
58
- nudgeRight(): void;
59
- }
1
+ import { ICanvasObject } from "../canvas-object.interface";
2
+ import { IInteractiveCanvas, IMutableColor, IMutablePosition } from "../..";
3
+ import { AbstractCanvasObject } from "../abstract-canvas-object";
4
+ import { CanvasObjectData } from "../canvas-object-data";
5
+ import { fabric } from "fabric";
6
+ /**
7
+ * Rectangle field. A basic block of color that can be moved and scaled.
8
+ */
9
+ export interface IRectangle extends ICanvasObject, IMutableColor, IMutablePosition {
10
+ }
11
+ export declare class Rectangle extends AbstractCanvasObject<fabric.Rect> implements IRectangle {
12
+ constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
13
+ /**
14
+ * @override
15
+ * @inheritDoc
16
+ */
17
+ getColor(): string;
18
+ /**
19
+ * @override
20
+ * @inheritDoc
21
+ */
22
+ setColor(color: string): void;
23
+ /**
24
+ * @override
25
+ * @inheritDoc
26
+ */
27
+ centerHorizontally(): void;
28
+ /**
29
+ * @override
30
+ * @inheritDoc
31
+ */
32
+ centerVertically(): void;
33
+ /**
34
+ * @override
35
+ * @inheritDoc
36
+ */
37
+ setHeight(height: number): void;
38
+ /**
39
+ * @override
40
+ * @inheritDoc
41
+ */
42
+ nudgeUp(): void;
43
+ /**
44
+ * @override
45
+ * @inheritDoc
46
+ */
47
+ nudgeDown(): void;
48
+ /**
49
+ * @override
50
+ * @inheritDoc
51
+ */
52
+ nudgeLeft(): void;
53
+ /**
54
+ * @override
55
+ * @inheritDoc
56
+ */
57
+ nudgeRight(): void;
58
+ }