@nmmty/lazycanvas 0.6.0 → 0.6.2

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 (59) 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 +17 -25
  8. package/dist/structures/components/BaseLayer.js +16 -18
  9. package/dist/structures/components/BezierLayer.d.ts +29 -21
  10. package/dist/structures/components/BezierLayer.js +22 -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 +15 -15
  16. package/dist/structures/components/ImageLayer.js +11 -11
  17. package/dist/structures/components/LineLayer.d.ts +28 -20
  18. package/dist/structures/components/LineLayer.js +21 -19
  19. package/dist/structures/components/MorphLayer.d.ts +29 -21
  20. package/dist/structures/components/MorphLayer.js +19 -17
  21. package/dist/structures/components/Path2DLayer.d.ts +21 -72
  22. package/dist/structures/components/Path2DLayer.js +4 -108
  23. package/dist/structures/components/QuadraticLayer.d.ts +30 -22
  24. package/dist/structures/components/QuadraticLayer.js +23 -21
  25. package/dist/structures/components/TextLayer.d.ts +54 -41
  26. package/dist/structures/components/TextLayer.js +165 -69
  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/types/types.d.ts +7 -1
  57. package/dist/utils/utils.d.ts +5 -5
  58. package/dist/utils/utils.js +8 -2
  59. package/package.json +1 -2
@@ -15,8 +15,8 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
15
15
  props;
16
16
  /**
17
17
  * Constructs a new BezierLayer instance.
18
- * @param props {IBezierLayerProps} - The properties of the Bezier layer.
19
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
18
+ * @param {IBezierLayerProps} [props] - The properties of the Bezier layer.
19
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
20
20
  */
21
21
  constructor(props, misc) {
22
22
  super(types_1.LayerType.BezierCurve, props || {}, misc);
@@ -25,7 +25,7 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
25
25
  }
26
26
  /**
27
27
  * Sets the control points of the Bezier layer.
28
- * @param controlPoints {Array<{ x: ScaleType, y: ScaleType }>} - The control points of the Bezier layer.
28
+ * @param {Array<{ x: ScaleType, y: ScaleType }>} [controlPoints] - The control points of the Bezier layer.
29
29
  * @returns {this} The current instance for chaining.
30
30
  * @throws {LazyError} If the number of control points is not exactly 2.
31
31
  */
@@ -37,8 +37,8 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
37
37
  }
38
38
  /**
39
39
  * Sets the end position of the Bezier layer.
40
- * @param x {ScaleType} - The x-coordinate of the end point.
41
- * @param y {ScaleType} - The y-coordinate of the end point.
40
+ * @param {ScaleType} [x] - The x-coordinate of the end point.
41
+ * @param {ScaleType} [y] - The y-coordinate of the end point.
42
42
  * @returns {this} The current instance for chaining.
43
43
  */
44
44
  setEndPosition(x, y) {
@@ -47,7 +47,7 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
47
47
  }
48
48
  /**
49
49
  * Sets the color of the Bezier layer.
50
- * @param color {ColorType} - The color of the layer.
50
+ * @param {ColorType} [color] - The color of the layer.
51
51
  * @returns {this} The current instance for chaining.
52
52
  * @throws {LazyError} If the color is not provided or invalid.
53
53
  */
@@ -61,12 +61,12 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
61
61
  }
62
62
  /**
63
63
  * Sets the stroke properties of the Bezier layer.
64
- * @param width {number} - The width of the stroke.
65
- * @param cap {string} - The cap style of the stroke.
66
- * @param join {string} - The join style of the stroke.
67
- * @param dash {number[]} - The dash pattern of the stroke.
68
- * @param dashOffset {number} - The dash offset of the stroke.
69
- * @param miterLimit {number} - The miter limit of the stroke.
64
+ * @param {number} [width] - The width of the stroke.
65
+ * @param {string} [cap] - The cap style of the stroke.
66
+ * @param {string} [join] - The join style of the stroke.
67
+ * @param {number[]} [dash] - The dash pattern of the stroke.
68
+ * @param {number} [dashOffset] - The dash offset of the stroke.
69
+ * @param {number} [miterLimit] - The miter limit of the stroke.
70
70
  * @returns {this} The current instance for chaining.
71
71
  */
72
72
  setStroke(width, cap, join, dash, dashOffset, miterLimit) {
@@ -82,9 +82,9 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
82
82
  }
83
83
  /**
84
84
  * Calculates the bounding box of the Bezier layer.
85
- * @param ctx {SKRSContext2D} - The canvas rendering context.
86
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
87
- * @param manager {LayersManager} - The layers manager.
85
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
86
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
87
+ * @param {LayersManager} [manager] - The layers manager.
88
88
  * @returns {Object} The bounding box details including max, min, center, width, and height.
89
89
  */
90
90
  getBoundingBox(ctx, canvas, manager) {
@@ -104,10 +104,10 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
104
104
  }
105
105
  /**
106
106
  * Draws the Bezier layer on the canvas.
107
- * @param ctx {SKRSContext2D} - The canvas rendering context.
108
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
109
- * @param manager {LayersManager} - The layers manager.
110
- * @param debug {boolean} - Whether to enable debug logging.
107
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
108
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
109
+ * @param {LayersManager} [manager] - The layers manager.
110
+ * @param {boolean} [debug] - Whether to enable debug logging.
111
111
  */
112
112
  async draw(ctx, canvas, manager, debug) {
113
113
  const parcer = (0, utils_1.parser)(ctx, canvas, manager);
@@ -173,12 +173,14 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
173
173
  }
174
174
  /**
175
175
  * Validates the properties of the Bezier layer.
176
- * @param data {IBezierLayerProps} - The properties to validate.
176
+ * @param {IBezierLayerProps} [data] - The properties to validate.
177
177
  * @returns {IBezierLayerProps} The validated properties.
178
178
  */
179
179
  validateProps(data) {
180
180
  return {
181
181
  ...super.validateProps(data),
182
+ filled: data.filled || false,
183
+ fillStyle: data.fillStyle || '#000000',
182
184
  centring: data.centring || types_1.Centring.None,
183
185
  controlPoints: data.controlPoints || [{ x: 0, y: 0 }, { x: 0, y: 0 }],
184
186
  endPoint: data.endPoint || { x: 0, y: 0 },
@@ -1,6 +1,6 @@
1
1
  import { ScaleType, LayerType, AnyCentring, AnyGlobalCompositeOperation } from "../../types";
2
2
  import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
3
- import { LayersManager } from "../managers/LayersManager";
3
+ import { LayersManager } from "../managers";
4
4
  import { IBaseLayerMisc } from "./BaseLayer";
5
5
  /**
6
6
  * Interface representing a Clear Layer.
@@ -87,55 +87,55 @@ export declare class ClearLayer implements IClearLayer {
87
87
  props: IClearLayerProps;
88
88
  /**
89
89
  * Constructs a new ClearLayer instance.
90
- * @param props {IClearLayerProps} - The properties of the Clear Layer.
91
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
90
+ * @param {IClearLayerProps} [props] - The properties of the Clear Layer.
91
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
92
92
  */
93
93
  constructor(props?: IClearLayerProps, misc?: IBaseLayerMisc);
94
94
  /**
95
95
  * Sets the position of the layer in the 2D plane.
96
- * @param x {ScaleType} - The x-coordinate of the layer.
97
- * @param y {ScaleType} - The y-coordinate of the layer.
96
+ * @param {ScaleType} [x] - The x-coordinate of the layer.
97
+ * @param {ScaleType} [y] - The y-coordinate of the layer.
98
98
  * @returns {this} The current instance for chaining.
99
99
  */
100
100
  setPosition(x: ScaleType, y: ScaleType): this;
101
101
  /**
102
102
  * Sets the size of the layer.
103
- * @param width {ScaleType} - The width of the layer.
104
- * @param height {ScaleType} - The height of the layer.
103
+ * @param {ScaleType} [width] - The width of the layer.
104
+ * @param {ScaleType} [height] - The height of the layer.
105
105
  * @returns {this} The current instance for chaining.
106
106
  */
107
107
  setSize(width: ScaleType, height: ScaleType): this;
108
108
  /**
109
109
  * Sets the unique identifier of the layer.
110
110
  *
111
- * @param {string} id - The unique identifier.
111
+ * @param {string} [id] - The unique identifier.
112
112
  * @returns {this} The current instance for chaining.
113
113
  */
114
114
  setID(id: string): this;
115
115
  /**
116
116
  * Sets the centring type of the layer.
117
- * @param centring {AnyCentring} - The centring type of the layer.
117
+ * @param {AnyCentring} [centring] - The centring type of the layer.
118
118
  * @returns {this} The current instance for chaining.
119
119
  */
120
120
  setCentring(centring: AnyCentring): this;
121
121
  /**
122
122
  * Sets the visibility of the layer.
123
- * @param visible {boolean} - The visibility state of the layer.
123
+ * @param {boolean} [visible] - The visibility state of the layer.
124
124
  * @returns {this} The current instance for chaining.
125
125
  */
126
126
  setVisible(visible: boolean): this;
127
127
  /**
128
128
  * Sets the z-index of the layer.
129
- * @param zIndex {number} - The z-index value of the layer.
129
+ * @param {number} [zIndex] - The z-index value of the layer.
130
130
  * @returns {this} The current instance for chaining.
131
131
  */
132
132
  setZIndex(zIndex: number): this;
133
133
  /**
134
134
  * Draws the Clear Layer on the canvas.
135
- * @param ctx {SKRSContext2D} - The canvas rendering context.
136
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
137
- * @param manager {LayersManager} - The layers manager.
138
- * @param debug {boolean} - Whether to enable debug logging.
135
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
136
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
137
+ * @param {LayersManager} [manager] - The layers manager.
138
+ * @param {boolean} [debug] - Whether to enable debug logging.
139
139
  */
140
140
  draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
141
141
  /**
@@ -31,8 +31,8 @@ class ClearLayer {
31
31
  props;
32
32
  /**
33
33
  * Constructs a new ClearLayer instance.
34
- * @param props {IClearLayerProps} - The properties of the Clear Layer.
35
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
34
+ * @param {IClearLayerProps} [props] - The properties of the Clear Layer.
35
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
36
36
  */
37
37
  constructor(props, misc) {
38
38
  this.id = misc?.id || (0, utils_2.generateID)(types_1.LayerType.Clear);
@@ -44,8 +44,8 @@ class ClearLayer {
44
44
  }
45
45
  /**
46
46
  * Sets the position of the layer in the 2D plane.
47
- * @param x {ScaleType} - The x-coordinate of the layer.
48
- * @param y {ScaleType} - The y-coordinate of the layer.
47
+ * @param {ScaleType} [x] - The x-coordinate of the layer.
48
+ * @param {ScaleType} [y] - The y-coordinate of the layer.
49
49
  * @returns {this} The current instance for chaining.
50
50
  */
51
51
  setPosition(x, y) {
@@ -55,8 +55,8 @@ class ClearLayer {
55
55
  }
56
56
  /**
57
57
  * Sets the size of the layer.
58
- * @param width {ScaleType} - The width of the layer.
59
- * @param height {ScaleType} - The height of the layer.
58
+ * @param {ScaleType} [width] - The width of the layer.
59
+ * @param {ScaleType} [height] - The height of the layer.
60
60
  * @returns {this} The current instance for chaining.
61
61
  */
62
62
  setSize(width, height) {
@@ -69,7 +69,7 @@ class ClearLayer {
69
69
  /**
70
70
  * Sets the unique identifier of the layer.
71
71
  *
72
- * @param {string} id - The unique identifier.
72
+ * @param {string} [id] - The unique identifier.
73
73
  * @returns {this} The current instance for chaining.
74
74
  */
75
75
  setID(id) {
@@ -78,7 +78,7 @@ class ClearLayer {
78
78
  }
79
79
  /**
80
80
  * Sets the centring type of the layer.
81
- * @param centring {AnyCentring} - The centring type of the layer.
81
+ * @param {AnyCentring} [centring] - The centring type of the layer.
82
82
  * @returns {this} The current instance for chaining.
83
83
  */
84
84
  setCentring(centring) {
@@ -87,7 +87,7 @@ class ClearLayer {
87
87
  }
88
88
  /**
89
89
  * Sets the visibility of the layer.
90
- * @param visible {boolean} - The visibility state of the layer.
90
+ * @param {boolean} [visible] - The visibility state of the layer.
91
91
  * @returns {this} The current instance for chaining.
92
92
  */
93
93
  setVisible(visible) {
@@ -96,7 +96,7 @@ class ClearLayer {
96
96
  }
97
97
  /**
98
98
  * Sets the z-index of the layer.
99
- * @param zIndex {number} - The z-index value of the layer.
99
+ * @param {number} [zIndex] - The z-index value of the layer.
100
100
  * @returns {this} The current instance for chaining.
101
101
  */
102
102
  setZIndex(zIndex) {
@@ -105,10 +105,10 @@ class ClearLayer {
105
105
  }
106
106
  /**
107
107
  * Draws the Clear Layer on the canvas.
108
- * @param ctx {SKRSContext2D} - The canvas rendering context.
109
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
110
- * @param manager {LayersManager} - The layers manager.
111
- * @param debug {boolean} - Whether to enable debug logging.
108
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
109
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
110
+ * @param {LayersManager} [manager] - The layers manager.
111
+ * @param {boolean} [debug] - Whether to enable debug logging.
112
112
  */
113
113
  async draw(ctx, canvas, manager, debug) {
114
114
  const parcer = (0, utils_1.parser)(ctx, canvas, manager);
@@ -1,6 +1,6 @@
1
1
  import { AnyGlobalCompositeOperation, AnyLayer, LayerType } from "../../types";
2
2
  import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
3
- import { LayersManager } from "../managers/LayersManager";
3
+ import { LayersManager } from "../managers";
4
4
  /**
5
5
  * Interface representing a group of layers.
6
6
  */
@@ -63,10 +63,9 @@ export declare class Group implements IGroup {
63
63
  props?: IGroupProps;
64
64
  /**
65
65
  * Constructs a new Group instance.
66
- * @param opts {Object} - Optional parameters for the group.
67
- * @param opts.id {string} - The unique identifier of the group.
68
- * @param opts.visible {boolean} - The visibility of the group.
69
- * @param opts.zIndex {number} - The z-index of the group.
66
+ * @param {string} [opts.id] - The unique identifier of the group.
67
+ * @param {boolean} [opts.visible] - The visibility of the group.
68
+ * @param {number} [opts.zIndex] - The z-index of the group.
70
69
  */
71
70
  constructor(opts?: {
72
71
  id?: string;
@@ -75,31 +74,31 @@ export declare class Group implements IGroup {
75
74
  });
76
75
  /**
77
76
  * Sets the ID of the group.
78
- * @param id {string} - The unique identifier of the group.
77
+ * @param {string} [id] - The unique identifier of the group.
79
78
  * @returns {this} The current instance for chaining.
80
79
  */
81
80
  setID(id: string): this;
82
81
  /**
83
82
  * Sets the visibility of the group.
84
- * @param visible {boolean} - The visibility state of the group.
83
+ * @param {boolean} [visible] - The visibility state of the group.
85
84
  * @returns {this} The current instance for chaining.
86
85
  */
87
86
  setVisible(visible: boolean): this;
88
87
  /**
89
88
  * Sets the z-index of the group.
90
- * @param zIndex {number} - The z-index value of the group.
89
+ * @param {number} [zIndex] - The z-index value of the group.
91
90
  * @returns {this} The current instance for chaining.
92
91
  */
93
92
  setZIndex(zIndex: number): this;
94
93
  /**
95
94
  * Adds components to the group.
96
- * @param components {AnyLayer[]} - The components to add to the group.
95
+ * @param {AnyLayer[]} [components] - The components to add to the group.
97
96
  * @returns {this} The current instance for chaining.
98
97
  */
99
98
  add(...components: AnyLayer[]): this;
100
99
  /**
101
100
  * Removes a component from the group by its ID.
102
- * @param id {string} - The unique identifier of the component to remove.
101
+ * @param {string} [id] - The unique identifier of the component to remove.
103
102
  * @returns {this} The current instance for chaining.
104
103
  */
105
104
  remove(id: string): this;
@@ -110,7 +109,7 @@ export declare class Group implements IGroup {
110
109
  clear(): this;
111
110
  /**
112
111
  * Retrieves a component from the group by its ID.
113
- * @param id {string} - The unique identifier of the component to retrieve.
112
+ * @param {string} [id] - The unique identifier of the component to retrieve.
114
113
  * @returns {AnyLayer | undefined} The component with the specified ID, or undefined if not found.
115
114
  */
116
115
  get(id: string): AnyLayer | undefined;
@@ -31,10 +31,9 @@ class Group {
31
31
  props;
32
32
  /**
33
33
  * Constructs a new Group instance.
34
- * @param opts {Object} - Optional parameters for the group.
35
- * @param opts.id {string} - The unique identifier of the group.
36
- * @param opts.visible {boolean} - The visibility of the group.
37
- * @param opts.zIndex {number} - The z-index of the group.
34
+ * @param {string} [opts.id] - The unique identifier of the group.
35
+ * @param {boolean} [opts.visible] - The visibility of the group.
36
+ * @param {number} [opts.zIndex] - The z-index of the group.
38
37
  */
39
38
  constructor(opts) {
40
39
  this.id = opts?.id || (0, utils_1.generateID)(types_1.LayerType.Group);
@@ -45,7 +44,7 @@ class Group {
45
44
  }
46
45
  /**
47
46
  * Sets the ID of the group.
48
- * @param id {string} - The unique identifier of the group.
47
+ * @param {string} [id] - The unique identifier of the group.
49
48
  * @returns {this} The current instance for chaining.
50
49
  */
51
50
  setID(id) {
@@ -54,7 +53,7 @@ class Group {
54
53
  }
55
54
  /**
56
55
  * Sets the visibility of the group.
57
- * @param visible {boolean} - The visibility state of the group.
56
+ * @param {boolean} [visible] - The visibility state of the group.
58
57
  * @returns {this} The current instance for chaining.
59
58
  */
60
59
  setVisible(visible) {
@@ -63,7 +62,7 @@ class Group {
63
62
  }
64
63
  /**
65
64
  * Sets the z-index of the group.
66
- * @param zIndex {number} - The z-index value of the group.
65
+ * @param {number} [zIndex] - The z-index value of the group.
67
66
  * @returns {this} The current instance for chaining.
68
67
  */
69
68
  setZIndex(zIndex) {
@@ -72,7 +71,7 @@ class Group {
72
71
  }
73
72
  /**
74
73
  * Adds components to the group.
75
- * @param components {AnyLayer[]} - The components to add to the group.
74
+ * @param {AnyLayer[]} [components] - The components to add to the group.
76
75
  * @returns {this} The current instance for chaining.
77
76
  */
78
77
  add(...components) {
@@ -84,7 +83,7 @@ class Group {
84
83
  }
85
84
  /**
86
85
  * Removes a component from the group by its ID.
87
- * @param id {string} - The unique identifier of the component to remove.
86
+ * @param {string} [id] - The unique identifier of the component to remove.
88
87
  * @returns {this} The current instance for chaining.
89
88
  */
90
89
  remove(id) {
@@ -101,7 +100,7 @@ class Group {
101
100
  }
102
101
  /**
103
102
  * Retrieves a component from the group by its ID.
104
- * @param id {string} - The unique identifier of the component to retrieve.
103
+ * @param {string} [id] - The unique identifier of the component to retrieve.
105
104
  * @returns {AnyLayer | undefined} The component with the specified ID, or undefined if not found.
106
105
  */
107
106
  get(id) {
@@ -1,7 +1,7 @@
1
1
  import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
2
- import { ScaleType, LayerType, radiusCorner } from "../../types";
2
+ import { 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 an Image Layer.
7
7
  */
@@ -39,7 +39,7 @@ export interface IImageLayerProps extends IBaseLayerProps {
39
39
  * The radius of the image.
40
40
  */
41
41
  radius: {
42
- [corner in radiusCorner]?: ScaleType;
42
+ [corner in RadiusCorner]?: ScaleType;
43
43
  };
44
44
  };
45
45
  }
@@ -53,33 +53,33 @@ export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
53
53
  props: IImageLayerProps;
54
54
  /**
55
55
  * Constructs a new ImageLayer instance.
56
- * @param props {IImageLayerProps} - The properties of the Image Layer.
57
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
56
+ * @param {IImageLayerProps} [props] - The properties of the Image Layer.
57
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
58
58
  */
59
59
  constructor(props?: IImageLayerProps, misc?: IBaseLayerMisc);
60
60
  /**
61
61
  * Sets the source of the image.
62
- * @param src {string} - The source of the image, which can be a URL or file path.
62
+ * @param {string} [src] - The source of the image, which can be a URL or file path.
63
63
  * @returns {this} The current instance for chaining.
64
64
  * @throws {LazyError} If the source is not a valid URL.
65
65
  */
66
66
  setSrc(src: string): this;
67
67
  /**
68
68
  * Sets the size of the image.
69
- * @param width {ScaleType} - The width of the image.
70
- * @param height {ScaleType} - The height of the image.
71
- * @param radius {{ [corner in radiusCorner]?: ScaleType }} - The radius of the image (optional).
69
+ * @param {ScaleType} [width] - The width of the image.
70
+ * @param {ScaleType} [height] - The height of the image.
71
+ * @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the image (optional).
72
72
  * @returns {this} The current instance for chaining.
73
73
  */
74
74
  setSize(width: ScaleType, height: ScaleType, radius?: {
75
- [corner in radiusCorner]?: ScaleType;
75
+ [corner in RadiusCorner]?: ScaleType;
76
76
  }): this;
77
77
  /**
78
78
  * Draws the Image Layer on the canvas.
79
- * @param ctx {SKRSContext2D} - The canvas rendering context.
80
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
81
- * @param manager {LayersManager} - The layers manager.
82
- * @param debug {boolean} - Whether to enable debug logging.
79
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
80
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
81
+ * @param {LayersManager} [manager] - The layers manager.
82
+ * @param {boolean} [debug] - Whether to enable debug logging.
83
83
  * @throws {LazyError} If the image could not be loaded.
84
84
  */
85
85
  draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
@@ -90,7 +90,7 @@ export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
90
90
  toJSON(): IImageLayer;
91
91
  /**
92
92
  * Validates the properties of the Image Layer.
93
- * @param data {IImageLayerProps} - The properties to validate.
93
+ * @param {IImageLayerProps} [data] - The properties to validate.
94
94
  * @returns {IImageLayerProps} The validated properties.
95
95
  */
96
96
  protected validateProps(data: IImageLayerProps): IImageLayerProps;
@@ -17,8 +17,8 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
17
17
  props;
18
18
  /**
19
19
  * Constructs a new ImageLayer instance.
20
- * @param props {IImageLayerProps} - The properties of the Image Layer.
21
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
20
+ * @param {IImageLayerProps} [props] - The properties of the Image Layer.
21
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
22
22
  */
23
23
  constructor(props, misc) {
24
24
  super(types_1.LayerType.Image, props || {}, misc);
@@ -27,7 +27,7 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
27
27
  }
28
28
  /**
29
29
  * Sets the source of the image.
30
- * @param src {string} - The source of the image, which can be a URL or file path.
30
+ * @param {string} [src] - The source of the image, which can be a URL or file path.
31
31
  * @returns {this} The current instance for chaining.
32
32
  * @throws {LazyError} If the source is not a valid URL.
33
33
  */
@@ -39,9 +39,9 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
39
39
  }
40
40
  /**
41
41
  * Sets the size of the image.
42
- * @param width {ScaleType} - The width of the image.
43
- * @param height {ScaleType} - The height of the image.
44
- * @param radius {{ [corner in radiusCorner]?: ScaleType }} - The radius of the image (optional).
42
+ * @param {ScaleType} [width] - The width of the image.
43
+ * @param {ScaleType} [height] - The height of the image.
44
+ * @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the image (optional).
45
45
  * @returns {this} The current instance for chaining.
46
46
  */
47
47
  setSize(width, height, radius) {
@@ -54,10 +54,10 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
54
54
  }
55
55
  /**
56
56
  * Draws the Image Layer on the canvas.
57
- * @param ctx {SKRSContext2D} - The canvas rendering context.
58
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
59
- * @param manager {LayersManager} - The layers manager.
60
- * @param debug {boolean} - Whether to enable debug logging.
57
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
58
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
59
+ * @param {LayersManager} [manager] - The layers manager.
60
+ * @param {boolean} [debug] - Whether to enable debug logging.
61
61
  * @throws {LazyError} If the image could not be loaded.
62
62
  */
63
63
  async draw(ctx, canvas, manager, debug) {
@@ -120,7 +120,7 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
120
120
  }
121
121
  /**
122
122
  * Validates the properties of the Image Layer.
123
- * @param data {IImageLayerProps} - The properties to validate.
123
+ * @param {IImageLayerProps} [data] - The properties to validate.
124
124
  * @returns {IImageLayerProps} The validated properties.
125
125
  */
126
126
  validateProps(data) {
@@ -1,7 +1,7 @@
1
1
  import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
2
2
  import { ColorType, ScaleType, 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 Line Layer.
7
7
  */
@@ -32,6 +32,14 @@ export interface ILineLayerProps extends IBaseLayerProps {
32
32
  */
33
33
  y: ScaleType;
34
34
  };
35
+ /**
36
+ * Whether the layer is filled.
37
+ */
38
+ filled: boolean;
39
+ /**
40
+ * The fill style (color or pattern) of the layer.
41
+ */
42
+ fillStyle: ColorType;
35
43
  /**
36
44
  * The stroke properties of the line.
37
45
  */
@@ -72,40 +80,40 @@ export declare class LineLayer extends BaseLayer<ILineLayerProps> {
72
80
  props: ILineLayerProps;
73
81
  /**
74
82
  * Constructs a new LineLayer instance.
75
- * @param props {ILineLayerProps} - The properties of the Line Layer.
76
- * @param misc {IBaseLayerMisc} - Miscellaneous options for the layer.
83
+ * @param {ILineLayerProps} [props] - The properties of the Line Layer.
84
+ * @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
77
85
  */
78
86
  constructor(props?: ILineLayerProps, misc?: IBaseLayerMisc);
79
87
  /**
80
88
  * Sets the end position of the line layer.
81
- * @param x {ScaleType} - The x-coordinate of the end point.
82
- * @param y {ScaleType} - The y-coordinate of the end point.
89
+ * @param {ScaleType} [x] - The x-coordinate of the end point.
90
+ * @param {ScaleType} [y] - The y-coordinate of the end point.
83
91
  * @returns {this} The current instance for chaining.
84
92
  */
85
93
  setEndPosition(x: ScaleType, y: ScaleType): this;
86
94
  /**
87
95
  * Sets the color of the line layer.
88
- * @param color {ColorType} - The color of the line.
96
+ * @param {ColorType} [color] - The color of the layer.
89
97
  * @returns {this} The current instance for chaining.
90
98
  * @throws {LazyError} If the color is not provided or invalid.
91
99
  */
92
100
  setColor(color: ColorType): this;
93
101
  /**
94
102
  * Sets the stroke properties of the line layer.
95
- * @param width {number} - The width of the stroke.
96
- * @param cap {CanvasLineCap} - The cap style of the stroke.
97
- * @param join {CanvasLineJoin} - The join style of the stroke.
98
- * @param dash {number[]} - The dash pattern of the stroke.
99
- * @param dashOffset {number} - The dash offset of the stroke.
100
- * @param miterLimit {number} - The miter limit of the stroke.
103
+ * @param {number} [width] - The width of the stroke.
104
+ * @param {string} [cap] - The cap style of the stroke.
105
+ * @param {string} [join] - The join style of the stroke.
106
+ * @param {number[]} [dash] - The dash pattern of the stroke.
107
+ * @param {number} [dashOffset] - The dash offset of the stroke.
108
+ * @param {number} [miterLimit] - The miter limit of the stroke.
101
109
  * @returns {this} The current instance for chaining.
102
110
  */
103
111
  setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
104
112
  /**
105
113
  * Calculates the bounding box of the line layer.
106
- * @param ctx {SKRSContext2D} - The canvas rendering context.
107
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
108
- * @param manager {LayersManager} - The layers manager.
114
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
115
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
116
+ * @param {LayersManager} [manager] - The layers manager.
109
117
  * @returns {Object} The bounding box details including start and end points, width, and height.
110
118
  */
111
119
  getBoundingBox(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager): {
@@ -118,10 +126,10 @@ export declare class LineLayer extends BaseLayer<ILineLayerProps> {
118
126
  };
119
127
  /**
120
128
  * Draws the line layer on the canvas.
121
- * @param ctx {SKRSContext2D} - The canvas rendering context.
122
- * @param canvas {Canvas | SvgCanvas} - The canvas instance.
123
- * @param manager {LayersManager} - The layers manager.
124
- * @param debug {boolean} - Whether to enable debug logging.
129
+ * @param {SKRSContext2D} [ctx] - The canvas rendering context.
130
+ * @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
131
+ * @param {LayersManager} [manager] - The layers manager.
132
+ * @param {boolean} [debug] - Whether to enable debug logging.
125
133
  */
126
134
  draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
127
135
  /**
@@ -131,7 +139,7 @@ export declare class LineLayer extends BaseLayer<ILineLayerProps> {
131
139
  toJSON(): ILineLayer;
132
140
  /**
133
141
  * Validates the properties of the Line Layer.
134
- * @param data {ILineLayerProps} - The properties to validate.
142
+ * @param {ILineLayerProps} [data] - The properties to validate.
135
143
  * @returns {ILineLayerProps} The validated properties.
136
144
  */
137
145
  protected validateProps(data: ILineLayerProps): ILineLayerProps;