@nmmty/lazycanvas 0.6.0 → 0.6.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.
Files changed (57) hide show
  1. package/dist/helpers/index.d.ts +3 -0
  2. package/dist/helpers/index.js +19 -0
  3. package/dist/index.d.ts +5 -12
  4. package/dist/index.js +5 -31
  5. package/dist/structures/LazyCanvas.d.ts +12 -16
  6. package/dist/structures/LazyCanvas.js +24 -27
  7. package/dist/structures/components/BaseLayer.d.ts +16 -16
  8. package/dist/structures/components/BaseLayer.js +16 -16
  9. package/dist/structures/components/BezierLayer.d.ts +21 -21
  10. package/dist/structures/components/BezierLayer.js +20 -20
  11. package/dist/structures/components/ClearLayer.d.ts +15 -15
  12. package/dist/structures/components/ClearLayer.js +14 -14
  13. package/dist/structures/components/Group.d.ts +10 -11
  14. package/dist/structures/components/Group.js +9 -10
  15. package/dist/structures/components/ImageLayer.d.ts +12 -12
  16. package/dist/structures/components/ImageLayer.js +11 -11
  17. package/dist/structures/components/LineLayer.d.ts +20 -20
  18. package/dist/structures/components/LineLayer.js +19 -19
  19. package/dist/structures/components/MorphLayer.d.ts +18 -18
  20. package/dist/structures/components/MorphLayer.js +17 -17
  21. package/dist/structures/components/Path2DLayer.d.ts +4 -72
  22. package/dist/structures/components/Path2DLayer.js +2 -108
  23. package/dist/structures/components/QuadraticLayer.d.ts +22 -22
  24. package/dist/structures/components/QuadraticLayer.js +21 -21
  25. package/dist/structures/components/TextLayer.d.ts +37 -37
  26. package/dist/structures/components/TextLayer.js +36 -36
  27. package/dist/structures/helpers/Exporter.d.ts +9 -9
  28. package/dist/structures/helpers/Exporter.js +9 -9
  29. package/dist/structures/helpers/Font.d.ts +4 -4
  30. package/dist/structures/helpers/Font.js +4 -4
  31. package/dist/structures/helpers/Gradient.d.ts +15 -10
  32. package/dist/structures/helpers/Gradient.js +14 -9
  33. package/dist/structures/helpers/Link.d.ts +5 -5
  34. package/dist/structures/helpers/Link.js +5 -5
  35. package/dist/structures/helpers/Pattern.d.ts +5 -5
  36. package/dist/structures/helpers/Pattern.js +5 -5
  37. package/dist/structures/helpers/index.d.ts +7 -7
  38. package/dist/structures/helpers/readers/JSONReader.d.ts +12 -12
  39. package/dist/structures/helpers/readers/JSONReader.js +12 -12
  40. package/dist/structures/helpers/readers/YAMLReader.d.ts +4 -4
  41. package/dist/structures/helpers/readers/YAMLReader.js +4 -4
  42. package/dist/structures/managers/AnimationManager.d.ts +11 -11
  43. package/dist/structures/managers/AnimationManager.js +11 -11
  44. package/dist/structures/managers/FontsManager.d.ts +14 -15
  45. package/dist/structures/managers/FontsManager.js +14 -15
  46. package/dist/structures/managers/LayersManager.d.ts +15 -15
  47. package/dist/structures/managers/LayersManager.js +19 -19
  48. package/dist/structures/managers/PluginManager.d.ts +11 -9
  49. package/dist/structures/managers/PluginManager.js +9 -8
  50. package/dist/structures/managers/RenderManager.d.ts +10 -10
  51. package/dist/structures/managers/RenderManager.js +10 -10
  52. package/dist/structures/managers/index.d.ts +5 -0
  53. package/dist/structures/managers/index.js +21 -0
  54. package/dist/types/index.d.ts +0 -1
  55. package/dist/types/index.js +0 -1
  56. package/dist/utils/utils.d.ts +1 -1
  57. package/package.json +59 -60
@@ -15,8 +15,8 @@ class LineLayer extends BaseLayer_1.BaseLayer {
15
15
  props;
16
16
  /**
17
17
  * Constructs a new LineLayer instance.
18
- * @param props {ILineLayerProps} - The properties of the Line Layer.
19
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
18
+ * @param {ILineLayerProps} [props] - The properties of the Line Layer.
19
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
20
20
  */
21
21
  constructor(props, misc) {
22
22
  super(types_1.LayerType.Line, props || {}, misc);
@@ -25,8 +25,8 @@ class LineLayer extends BaseLayer_1.BaseLayer {
25
25
  }
26
26
  /**
27
27
  * Sets the end position of the line layer.
28
- * @param x {ScaleType} - The x-coordinate of the end point.
29
- * @param y {ScaleType} - The y-coordinate of the end point.
28
+ * @param {ScaleType} [x] - The x-coordinate of the end point.
29
+ * @param {ScaleType} [y] - The y-coordinate of the end point.
30
30
  * @returns {this} The current instance for chaining.
31
31
  */
32
32
  setEndPosition(x, y) {
@@ -35,7 +35,7 @@ class LineLayer extends BaseLayer_1.BaseLayer {
35
35
  }
36
36
  /**
37
37
  * Sets the color of the line layer.
38
- * @param color {ColorType} - The color of the line.
38
+ * @param {ColorType} [color] - The color of the layer.
39
39
  * @returns {this} The current instance for chaining.
40
40
  * @throws {LazyError} If the color is not provided or invalid.
41
41
  */
@@ -49,12 +49,12 @@ class LineLayer extends BaseLayer_1.BaseLayer {
49
49
  }
50
50
  /**
51
51
  * Sets the stroke properties of the line layer.
52
- * @param width {number} - The width of the stroke.
53
- * @param cap {CanvasLineCap} - The cap style of the stroke.
54
- * @param join {CanvasLineJoin} - The join style of the stroke.
55
- * @param dash {number[]} - The dash pattern of the stroke.
56
- * @param dashOffset {number} - The dash offset of the stroke.
57
- * @param miterLimit {number} - The miter limit of the stroke.
52
+ * @param {number} [width] - The width of the stroke.
53
+ * @param {string} [cap] - The cap style of the stroke.
54
+ * @param {string} [join] - The join style of the stroke.
55
+ * @param {number[]} [dash] - The dash pattern of the stroke.
56
+ * @param {number} [dashOffset] - The dash offset of the stroke.
57
+ * @param {number} [miterLimit] - The miter limit of the stroke.
58
58
  * @returns {this} The current instance for chaining.
59
59
  */
60
60
  setStroke(width, cap, join, dash, dashOffset, miterLimit) {
@@ -70,9 +70,9 @@ class LineLayer extends BaseLayer_1.BaseLayer {
70
70
  }
71
71
  /**
72
72
  * Calculates the bounding box of the line layer.
73
- * @param ctx {SKRSContext2D} - The canvas rendering context.
74
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
75
- * @param manager {LayersManager} - The layers manager.
73
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
74
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
75
+ * @param {LayersManager} [manager] - The layers manager.
76
76
  * @returns {Object} The bounding box details including start and end points, width, and height.
77
77
  */
78
78
  getBoundingBox(ctx, canvas, manager) {
@@ -89,10 +89,10 @@ class LineLayer extends BaseLayer_1.BaseLayer {
89
89
  }
90
90
  /**
91
91
  * Draws the line layer on the canvas.
92
- * @param ctx {SKRSContext2D} - The canvas rendering context.
93
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
94
- * @param manager {LayersManager} - The layers manager.
95
- * @param debug {boolean} - Whether to enable debug logging.
92
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
93
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
94
+ * @param {LayersManager} [manager] - The layers manager.
95
+ * @param {boolean} [debug] - Whether to enable debug logging.
96
96
  */
97
97
  async draw(ctx, canvas, manager, debug) {
98
98
  const parcer = (0, utils_1.parser)(ctx, canvas, manager);
@@ -142,7 +142,7 @@ class LineLayer extends BaseLayer_1.BaseLayer {
142
142
  }
143
143
  /**
144
144
  * Validates the properties of the Line Layer.
145
- * @param data {ILineLayerProps} - The properties to validate.
145
+ * @param {ILineLayerProps} [data] - The properties to validate.
146
146
  * @returns {ILineLayerProps} The validated properties.
147
147
  */
148
148
  validateProps(data) {
@@ -1,7 +1,7 @@
1
1
  import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
2
2
  import { ColorType, ScaleType, LayerType, radiusCorner } from "../../types";
3
3
  import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
4
- import { LayersManager } from "../managers/LayersManager";
4
+ import { LayersManager } from "../managers";
5
5
  /**
6
6
  * Interface representing a Morph Layer.
7
7
  */
@@ -78,15 +78,15 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
78
78
  props: IMorphLayerProps;
79
79
  /**
80
80
  * Constructs a new MorphLayer instance.
81
- * @param props {IMorphLayerProps} - The properties of the Morph Layer.
82
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
81
+ * @param {IMorphLayerProps} [props] - The properties of the Morph Layer.
82
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
83
83
  */
84
84
  constructor(props?: IMorphLayerProps, misc?: IBaseLayerMisc);
85
85
  /**
86
86
  * Sets the size of the Morph Layer.
87
- * @param width {ScaleType} - The width of the Morph Layer.
88
- * @param height {ScaleType} - The height of the Morph Layer.
89
- * @param radius {{ [corner in radiusCorner]?: ScaleType }} - The radius of the Morph Layer (optional).
87
+ * @param {ScaleType} [width] - The width of the Morph Layer.
88
+ * @param {ScaleType} [height] - The height of the Morph Layer.
89
+ * @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the Morph Layer (optional).
90
90
  * @returns {this} The current instance for chaining.
91
91
  */
92
92
  setSize(width: ScaleType, height: ScaleType, radius?: {
@@ -94,28 +94,28 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
94
94
  }): this;
95
95
  /**
96
96
  * Sets the color of the Morph Layer.
97
- * @param color {string} - The color of the Morph Layer.
97
+ * @param {ColorType} [color] - The color of the layer.
98
98
  * @returns {this} The current instance for chaining.
99
99
  * @throws {LazyError} If the color is not provided or invalid.
100
100
  */
101
101
  setColor(color: ColorType): this;
102
102
  /**
103
103
  * Sets the stroke properties of the Morph Layer.
104
- * @param width {number} - The width of the stroke.
105
- * @param cap {string} - The cap style of the stroke.
106
- * @param join {string} - The join style of the stroke.
107
- * @param dash {number[]} - The dash pattern of the stroke.
108
- * @param dashOffset {number} - The dash offset of the stroke.
109
- * @param miterLimit {number} - The miter limit of the stroke.
104
+ * @param {number} [width] - The width of the stroke.
105
+ * @param {string} [cap] - The cap style of the stroke.
106
+ * @param {string} [join] - The join style of the stroke.
107
+ * @param {number[]} [dash] - The dash pattern of the stroke.
108
+ * @param {number} [dashOffset] - The dash offset of the stroke.
109
+ * @param {number} [miterLimit] - The miter limit of the stroke.
110
110
  * @returns {this} The current instance for chaining.
111
111
  */
112
112
  setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
113
113
  /**
114
114
  * Draws the Morph Layer on the canvas.
115
- * @param ctx {SKRSContext2D} - The canvas rendering context.
116
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
117
- * @param manager {LayersManager} - The layers manager.
118
- * @param debug {boolean} - Whether to enable debug logging.
115
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
116
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
117
+ * @param {LayersManager} [manager] - The layers manager.
118
+ * @param {boolean} [debug] - Whether to enable debug logging.
119
119
  */
120
120
  draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
121
121
  /**
@@ -125,7 +125,7 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
125
125
  toJSON(): IMorphLayer;
126
126
  /**
127
127
  * Validates the properties of the Morph Layer.
128
- * @param data {IMorphLayerProps} - The properties to validate.
128
+ * @param {IMorphLayerProps} [data] - The properties to validate.
129
129
  * @returns {IMorphLayerProps} The validated properties.
130
130
  */
131
131
  protected validateProps(data: IMorphLayerProps): IMorphLayerProps;
@@ -16,8 +16,8 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
16
16
  props;
17
17
  /**
18
18
  * Constructs a new MorphLayer instance.
19
- * @param props {IMorphLayerProps} - The properties of the Morph Layer.
20
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
19
+ * @param {IMorphLayerProps} [props] - The properties of the Morph Layer.
20
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
21
21
  */
22
22
  constructor(props, misc) {
23
23
  super(types_1.LayerType.Morph, props || {}, misc);
@@ -26,9 +26,9 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
26
26
  }
27
27
  /**
28
28
  * Sets the size of the Morph Layer.
29
- * @param width {ScaleType} - The width of the Morph Layer.
30
- * @param height {ScaleType} - The height of the Morph Layer.
31
- * @param radius {{ [corner in radiusCorner]?: ScaleType }} - The radius of the Morph Layer (optional).
29
+ * @param {ScaleType} [width] - The width of the Morph Layer.
30
+ * @param {ScaleType} [height] - The height of the Morph Layer.
31
+ * @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the Morph Layer (optional).
32
32
  * @returns {this} The current instance for chaining.
33
33
  */
34
34
  setSize(width, height, radius) {
@@ -41,7 +41,7 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
41
41
  }
42
42
  /**
43
43
  * Sets the color of the Morph Layer.
44
- * @param color {string} - The color of the Morph Layer.
44
+ * @param {ColorType} [color] - The color of the layer.
45
45
  * @returns {this} The current instance for chaining.
46
46
  * @throws {LazyError} If the color is not provided or invalid.
47
47
  */
@@ -55,12 +55,12 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
55
55
  }
56
56
  /**
57
57
  * Sets the stroke properties of the Morph Layer.
58
- * @param width {number} - The width of the stroke.
59
- * @param cap {string} - The cap style of the stroke.
60
- * @param join {string} - The join style of the stroke.
61
- * @param dash {number[]} - The dash pattern of the stroke.
62
- * @param dashOffset {number} - The dash offset of the stroke.
63
- * @param miterLimit {number} - The miter limit of the stroke.
58
+ * @param {number} [width] - The width of the stroke.
59
+ * @param {string} [cap] - The cap style of the stroke.
60
+ * @param {string} [join] - The join style of the stroke.
61
+ * @param {number[]} [dash] - The dash pattern of the stroke.
62
+ * @param {number} [dashOffset] - The dash offset of the stroke.
63
+ * @param {number} [miterLimit] - The miter limit of the stroke.
64
64
  * @returns {this} The current instance for chaining.
65
65
  */
66
66
  setStroke(width, cap, join, dash, dashOffset, miterLimit) {
@@ -77,10 +77,10 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
77
77
  }
78
78
  /**
79
79
  * Draws the Morph Layer on the canvas.
80
- * @param ctx {SKRSContext2D} - The canvas rendering context.
81
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
82
- * @param manager {LayersManager} - The layers manager.
83
- * @param debug {boolean} - Whether to enable debug logging.
80
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
81
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
82
+ * @param {LayersManager} [manager] - The layers manager.
83
+ * @param {boolean} [debug] - Whether to enable debug logging.
84
84
  */
85
85
  async draw(ctx, canvas, manager, debug) {
86
86
  const parcer = (0, utils_1.parser)(ctx, canvas, manager);
@@ -150,7 +150,7 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
150
150
  }
151
151
  /**
152
152
  * Validates the properties of the Morph Layer.
153
- * @param data {IMorphLayerProps} - The properties to validate.
153
+ * @param {IMorphLayerProps} [data] - The properties to validate.
154
154
  * @returns {IMorphLayerProps} The validated properties.
155
155
  */
156
156
  validateProps(data) {
@@ -1,7 +1,7 @@
1
1
  import { Canvas, DOMMatrix2DInit, FillType, Path2D, PathOp, SKRSContext2D, StrokeOptions, SvgCanvas } from "@napi-rs/canvas";
2
- import { AnyFilter, AnyGlobalCompositeOperation, ColorType, LayerType } from "../../types";
2
+ import { ColorType, LayerType } from "../../types";
3
3
  import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
4
- import { LayersManager } from "../managers/LayersManager";
4
+ import { LayersManager } from "../managers";
5
5
  export interface IPath2DLayer extends IBaseLayer {
6
6
  type: LayerType.Path;
7
7
  props: IPath2DLayerProps;
@@ -47,77 +47,9 @@ export declare class Path2DLayer extends BaseLayer<IPath2DLayerProps> {
47
47
  visible: boolean;
48
48
  props: IPath2DLayerProps;
49
49
  constructor(props?: IPath2DLayerProps, misc?: IBaseLayerMisc);
50
- /**
51
- * Sets the unique identifier of the layer.
52
- *
53
- * @param {string} id - The unique identifier.
54
- * @returns {this} The current instance for chaining.
55
- */
56
- setID(id: string): this;
57
- /**
58
- * Sets the visibility of the layer.
59
- * @param visible {boolean} - The visibility state of the layer.
60
- * @returns {this} The current instance for chaining.
61
- */
62
- setVisible(visible: boolean): this;
63
- /**
64
- * Sets the z-index of the layer.
65
- * @param zIndex {number} - The z-index value of the layer.
66
- * @returns {this} The current instance for chaining.
67
- */
68
- setZIndex(zIndex: number): this;
69
- /**
70
- * Sets the global composite operation for the layer.
71
- * @param {AnyGlobalCompositeOperation} operation - The composite operation.
72
- * @returns {this} The current instance for chaining.
73
- */
74
- setGlobalCompositeOperation(operation: AnyGlobalCompositeOperation): this;
75
- /**
76
- * Sets the filter effects for the layer.
77
- * @param {...AnyFilter} filter - The filter effects to apply.
78
- * @returns {this} The current instance for chaining.
79
- */
80
- setFilters(...filter: AnyFilter[]): this;
81
- /**
82
- * Sets the transformation matrix of the layer.
83
- * @param {DOMMatrix2DInit} matrix - The transformation matrix.
84
- * @returns {this} The current instance for chaining.
85
- */
86
- setMatrix(matrix: DOMMatrix2DInit): this;
87
- /**
88
- * Sets the scale of the layer in the x and y directions.
89
- * @param {number} x - The scale factor in the x direction.
90
- * @param {number} y - The scale factor in the y direction.
91
- * @returns {this} The current instance for chaining.
92
- */
93
- setScale(x: number, y: number): this;
94
- /**
95
- * Sets the translation of the layer in the x and y directions.
96
- * @param {number} x - The translation in the x direction.
97
- * @param {number} y - The translation in the y direction.
98
- * @returns {this} The current instance for chaining.
99
- */
100
- setTranslate(x: number, y: number): this;
101
- /**
102
- * Sets the opacity of the layer.
103
- * @param {number} opacity - The opacity value, between 0 and 1.
104
- * @returns {this} The current instance for chaining.
105
- */
106
- setOpacity(opacity: number): this;
107
- /**
108
- * Sets the stroke properties of the Path2D Layer.
109
- * @param width {number} - The width of the stroke.
110
- * @param cap {string} - The cap style of the stroke.
111
- * @param join {string} - The join style of the stroke.
112
- * @param dash {number[]} - The dash pattern of the stroke.
113
- * @param dashOffset {number} - The dash offset of the stroke.
114
- * @param miterLimit {number} - The miter limit of the stroke.
115
- * @returns {this} The current instance for chaining.
116
- */
117
- setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
118
50
  /**
119
51
  * Sets the color of the Path2D Layer.
120
- * @param color {string} - The color of the Path2D Layer.
52
+ * @param {ColorType} [color] - The color of the layer.
121
53
  * @returns {this} The current instance for chaining.
122
54
  * @throws {LazyError} If the color is not provided or invalid.
123
55
  */
@@ -157,7 +89,7 @@ export declare class Path2DLayer extends BaseLayer<IPath2DLayerProps> {
157
89
  toJSON(): IPath2DLayer;
158
90
  /**
159
91
  * Validates the properties of the Path2D Layer.
160
- * @param data {IPath2DLayerProps} - The properties to validate.
92
+ * @param {IPath2DLayerProps} [data] - The properties to validate.
161
93
  * @returns {IPath2DLayerProps} The validated properties.
162
94
  */
163
95
  protected validateProps(data: IPath2DLayerProps): IPath2DLayerProps;
@@ -20,115 +20,9 @@ class Path2DLayer extends BaseLayer_1.BaseLayer {
20
20
  this.props = props ? props : {};
21
21
  this.props = this.validateProps(this.props);
22
22
  }
23
- /**
24
- * Sets the unique identifier of the layer.
25
- *
26
- * @param {string} id - The unique identifier.
27
- * @returns {this} The current instance for chaining.
28
- */
29
- setID(id) {
30
- this.id = id;
31
- return this;
32
- }
33
- /**
34
- * Sets the visibility of the layer.
35
- * @param visible {boolean} - The visibility state of the layer.
36
- * @returns {this} The current instance for chaining.
37
- */
38
- setVisible(visible) {
39
- this.visible = visible;
40
- return this;
41
- }
42
- /**
43
- * Sets the z-index of the layer.
44
- * @param zIndex {number} - The z-index value of the layer.
45
- * @returns {this} The current instance for chaining.
46
- */
47
- setZIndex(zIndex) {
48
- this.zIndex = zIndex;
49
- return this;
50
- }
51
- /**
52
- * Sets the global composite operation for the layer.
53
- * @param {AnyGlobalCompositeOperation} operation - The composite operation.
54
- * @returns {this} The current instance for chaining.
55
- */
56
- setGlobalCompositeOperation(operation) {
57
- this.props.globalComposite = operation;
58
- return this;
59
- }
60
- /**
61
- * Sets the filter effects for the layer.
62
- * @param {...AnyFilter} filter - The filter effects to apply.
63
- * @returns {this} The current instance for chaining.
64
- */
65
- setFilters(...filter) {
66
- this.props.filter = filter.join(' ');
67
- return this;
68
- }
69
- /**
70
- * Sets the transformation matrix of the layer.
71
- * @param {DOMMatrix2DInit} matrix - The transformation matrix.
72
- * @returns {this} The current instance for chaining.
73
- */
74
- setMatrix(matrix) {
75
- this.props.transform = { ...this.props.transform, matrix };
76
- return this;
77
- }
78
- /**
79
- * Sets the scale of the layer in the x and y directions.
80
- * @param {number} x - The scale factor in the x direction.
81
- * @param {number} y - The scale factor in the y direction.
82
- * @returns {this} The current instance for chaining.
83
- */
84
- setScale(x, y) {
85
- this.props.transform = { ...this.props.transform, scale: { x, y } };
86
- return this;
87
- }
88
- /**
89
- * Sets the translation of the layer in the x and y directions.
90
- * @param {number} x - The translation in the x direction.
91
- * @param {number} y - The translation in the y direction.
92
- * @returns {this} The current instance for chaining.
93
- */
94
- setTranslate(x, y) {
95
- this.props.transform = { ...this.props.transform, translate: { x, y } };
96
- return this;
97
- }
98
- /**
99
- * Sets the opacity of the layer.
100
- * @param {number} opacity - The opacity value, between 0 and 1.
101
- * @returns {this} The current instance for chaining.
102
- */
103
- setOpacity(opacity) {
104
- this.props.opacity = opacity;
105
- return this;
106
- }
107
- /**
108
- * Sets the stroke properties of the Path2D Layer.
109
- * @param width {number} - The width of the stroke.
110
- * @param cap {string} - The cap style of the stroke.
111
- * @param join {string} - The join style of the stroke.
112
- * @param dash {number[]} - The dash pattern of the stroke.
113
- * @param dashOffset {number} - The dash offset of the stroke.
114
- * @param miterLimit {number} - The miter limit of the stroke.
115
- * @returns {this} The current instance for chaining.
116
- */
117
- setStroke(width, cap, join, dash, dashOffset, miterLimit) {
118
- this.props.stroke = {
119
- width,
120
- cap: cap || 'butt',
121
- join: join || 'miter',
122
- dash: dash || [],
123
- dashOffset: dashOffset || 0,
124
- miterLimit: miterLimit || 10,
125
- };
126
- this.props.filled = false; // Ensure filled is false when stroke is set
127
- return this;
128
- }
129
23
  /**
130
24
  * Sets the color of the Path2D Layer.
131
- * @param color {string} - The color of the Path2D Layer.
25
+ * @param {ColorType} [color] - The color of the layer.
132
26
  * @returns {this} The current instance for chaining.
133
27
  * @throws {LazyError} If the color is not provided or invalid.
134
28
  */
@@ -284,7 +178,7 @@ class Path2DLayer extends BaseLayer_1.BaseLayer {
284
178
  }
285
179
  /**
286
180
  * Validates the properties of the Path2D Layer.
287
- * @param data {IPath2DLayerProps} - The properties to validate.
181
+ * @param {IPath2DLayerProps} [data] - The properties to validate.
288
182
  * @returns {IPath2DLayerProps} The validated properties.
289
183
  */
290
184
  validateProps(data) {
@@ -1,7 +1,7 @@
1
1
  import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
2
2
  import { ColorType, ScaleType, Point, LayerType } from "../../types";
3
3
  import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
4
- import { LayersManager } from "../managers/LayersManager";
4
+ import { LayersManager } from "../managers";
5
5
  /**
6
6
  * Interface representing a Quadratic Layer.
7
7
  */
@@ -67,47 +67,47 @@ export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
67
67
  props: IQuadraticLayerProps;
68
68
  /**
69
69
  * Constructs a new QuadraticLayer instance.
70
- * @param props {IQuadraticLayerProps} - The properties of the Quadratic Layer.
71
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
70
+ * @param {IQuadraticLayerProps} [props] - The properties of the Quadratic Layer.
71
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
72
72
  */
73
73
  constructor(props?: IQuadraticLayerProps, misc?: IBaseLayerMisc);
74
74
  /**
75
75
  * Sets the control point of the quadratic layer.
76
- * @param x {ScaleType} - The x-coordinate of the control point.
77
- * @param y {ScaleType} - The y-coordinate of the control point.
76
+ * @param {ScaleType} [x] - The x-coordinate of the control point.
77
+ * @param {ScaleType} [y] - The y-coordinate of the control point.
78
78
  * @returns {this} The current instance for chaining.
79
79
  */
80
80
  setControlPoint(x: ScaleType, y: ScaleType): this;
81
81
  /**
82
82
  * Sets the end point of the quadratic layer.
83
- * @param x {ScaleType} - The x-coordinate of the end point.
84
- * @param y {ScaleType} - The y-coordinate of the end point.
83
+ * @param {ScaleType} [x] - The x-coordinate of the end point.
84
+ * @param {ScaleType} [y] - The y-coordinate of the end point.
85
85
  * @returns {this} The current instance for chaining.
86
86
  */
87
87
  setEndPosition(x: ScaleType, y: ScaleType): this;
88
88
  /**
89
89
  * Sets the color of the layer.
90
- * @param color {ColorType} - The color of the layer.
90
+ * @param {ColorType} [color] - The color of the layer.
91
91
  * @returns {this} The current instance for chaining.
92
92
  * @throws {LazyError} If the color is not provided or invalid.
93
93
  */
94
94
  setColor(color: ColorType): this;
95
95
  /**
96
96
  * Sets the stroke properties of the layer.
97
- * @param width {number} - The width of the stroke.
98
- * @param cap {CanvasLineCap} - The cap style of the stroke.
99
- * @param join {CanvasLineJoin} - The join style of the stroke.
100
- * @param dash {number[]} - The dash pattern of the stroke.
101
- * @param dashOffset {number} - The dash offset of the stroke.
102
- * @param miterLimit {number} - The miter limit of the stroke.
97
+ * @param {number} [width] - The width of the stroke.
98
+ * @param {string} [cap] - The cap style of the stroke.
99
+ * @param {string} [join] - The join style of the stroke.
100
+ * @param {number[]} [dash] - The dash pattern of the stroke.
101
+ * @param {number} [dashOffset] - The dash offset of the stroke.
102
+ * @param {number} [miterLimit] - The miter limit of the stroke.
103
103
  * @returns {this} The current instance for chaining.
104
104
  */
105
105
  setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
106
106
  /**
107
107
  * Calculates the bounding box of the quadratic curve.
108
- * @param ctx {SKRSContext2D} - The canvas rendering context.
109
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
110
- * @param manager {LayersManager} - The layers manager.
108
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
109
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
110
+ * @param {LayersManager} [manager] - The layers manager.
111
111
  * @returns {Object} The bounding box details including max, min, center, width, and height.
112
112
  */
113
113
  getBoundingBox(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager): {
@@ -128,10 +128,10 @@ export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
128
128
  };
129
129
  /**
130
130
  * Draws the quadratic curve on the canvas.
131
- * @param ctx {SKRSContext2D} - The canvas rendering context.
132
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
133
- * @param manager {LayersManager} - The layers manager.
134
- * @param debug {boolean} - Whether to enable debug logging.
131
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
132
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
133
+ * @param {LayersManager} [manager] - The layers manager.
134
+ * @param {boolean} [debug] - Whether to enable debug logging.
135
135
  */
136
136
  draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
137
137
  /**
@@ -141,7 +141,7 @@ export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
141
141
  toJSON(): IQuadraticLayer;
142
142
  /**
143
143
  * Validates the properties of the Quadratic Layer.
144
- * @param data {IQuadraticLayerProps} - The properties to validate.
144
+ * @param {IQuadraticLayerProps} [data] - The properties to validate.
145
145
  * @returns {IQuadraticLayerProps} The validated properties.
146
146
  */
147
147
  protected validateProps(data: IQuadraticLayerProps): IQuadraticLayerProps;
@@ -15,8 +15,8 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
15
15
  props;
16
16
  /**
17
17
  * Constructs a new QuadraticLayer instance.
18
- * @param props {IQuadraticLayerProps} - The properties of the Quadratic Layer.
19
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
18
+ * @param {IQuadraticLayerProps} [props] - The properties of the Quadratic Layer.
19
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
20
20
  */
21
21
  constructor(props, misc) {
22
22
  super(types_1.LayerType.QuadraticCurve, props || {}, misc);
@@ -25,8 +25,8 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
25
25
  }
26
26
  /**
27
27
  * Sets the control point of the quadratic layer.
28
- * @param x {ScaleType} - The x-coordinate of the control point.
29
- * @param y {ScaleType} - The y-coordinate of the control point.
28
+ * @param {ScaleType} [x] - The x-coordinate of the control point.
29
+ * @param {ScaleType} [y] - The y-coordinate of the control point.
30
30
  * @returns {this} The current instance for chaining.
31
31
  */
32
32
  setControlPoint(x, y) {
@@ -35,8 +35,8 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
35
35
  }
36
36
  /**
37
37
  * Sets the end point of the quadratic layer.
38
- * @param x {ScaleType} - The x-coordinate of the end point.
39
- * @param y {ScaleType} - The y-coordinate of the end point.
38
+ * @param {ScaleType} [x] - The x-coordinate of the end point.
39
+ * @param {ScaleType} [y] - The y-coordinate of the end point.
40
40
  * @returns {this} The current instance for chaining.
41
41
  */
42
42
  setEndPosition(x, y) {
@@ -45,7 +45,7 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
45
45
  }
46
46
  /**
47
47
  * Sets the color of the layer.
48
- * @param color {ColorType} - The color of the layer.
48
+ * @param {ColorType} [color] - The color of the layer.
49
49
  * @returns {this} The current instance for chaining.
50
50
  * @throws {LazyError} If the color is not provided or invalid.
51
51
  */
@@ -59,12 +59,12 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
59
59
  }
60
60
  /**
61
61
  * Sets the stroke properties of the layer.
62
- * @param width {number} - The width of the stroke.
63
- * @param cap {CanvasLineCap} - The cap style of the stroke.
64
- * @param join {CanvasLineJoin} - The join style of the stroke.
65
- * @param dash {number[]} - The dash pattern of the stroke.
66
- * @param dashOffset {number} - The dash offset of the stroke.
67
- * @param miterLimit {number} - The miter limit of the stroke.
62
+ * @param {number} [width] - The width of the stroke.
63
+ * @param {string} [cap] - The cap style of the stroke.
64
+ * @param {string} [join] - The join style of the stroke.
65
+ * @param {number[]} [dash] - The dash pattern of the stroke.
66
+ * @param {number} [dashOffset] - The dash offset of the stroke.
67
+ * @param {number} [miterLimit] - The miter limit of the stroke.
68
68
  * @returns {this} The current instance for chaining.
69
69
  */
70
70
  setStroke(width, cap, join, dash, dashOffset, miterLimit) {
@@ -80,9 +80,9 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
80
80
  }
81
81
  /**
82
82
  * Calculates the bounding box of the quadratic curve.
83
- * @param ctx {SKRSContext2D} - The canvas rendering context.
84
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
85
- * @param manager {LayersManager} - The layers manager.
83
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
84
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
85
+ * @param {LayersManager} [manager] - The layers manager.
86
86
  * @returns {Object} The bounding box details including max, min, center, width, and height.
87
87
  */
88
88
  getBoundingBox(ctx, canvas, manager) {
@@ -100,10 +100,10 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
100
100
  }
101
101
  /**
102
102
  * Draws the quadratic curve on the canvas.
103
- * @param ctx {SKRSContext2D} - The canvas rendering context.
104
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
105
- * @param manager {LayersManager} - The layers manager.
106
- * @param debug {boolean} - Whether to enable debug logging.
103
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
104
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
105
+ * @param {LayersManager} [manager] - The layers manager.
106
+ * @param {boolean} [debug] - Whether to enable debug logging.
107
107
  */
108
108
  async draw(ctx, canvas, manager, debug) {
109
109
  const parcer = (0, utils_1.parser)(ctx, canvas, manager);
@@ -154,7 +154,7 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
154
154
  }
155
155
  /**
156
156
  * Validates the properties of the Quadratic Layer.
157
- * @param data {IQuadraticLayerProps} - The properties to validate.
157
+ * @param {IQuadraticLayerProps} [data] - The properties to validate.
158
158
  * @returns {IQuadraticLayerProps} The validated properties.
159
159
  */
160
160
  validateProps(data) {