@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.
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +19 -0
- package/dist/index.d.ts +5 -12
- package/dist/index.js +5 -31
- package/dist/structures/LazyCanvas.d.ts +12 -16
- package/dist/structures/LazyCanvas.js +24 -27
- package/dist/structures/components/BaseLayer.d.ts +17 -25
- package/dist/structures/components/BaseLayer.js +16 -18
- package/dist/structures/components/BezierLayer.d.ts +29 -21
- package/dist/structures/components/BezierLayer.js +22 -20
- package/dist/structures/components/ClearLayer.d.ts +15 -15
- package/dist/structures/components/ClearLayer.js +14 -14
- package/dist/structures/components/Group.d.ts +10 -11
- package/dist/structures/components/Group.js +9 -10
- package/dist/structures/components/ImageLayer.d.ts +15 -15
- package/dist/structures/components/ImageLayer.js +11 -11
- package/dist/structures/components/LineLayer.d.ts +28 -20
- package/dist/structures/components/LineLayer.js +21 -19
- package/dist/structures/components/MorphLayer.d.ts +29 -21
- package/dist/structures/components/MorphLayer.js +19 -17
- package/dist/structures/components/Path2DLayer.d.ts +21 -72
- package/dist/structures/components/Path2DLayer.js +4 -108
- package/dist/structures/components/QuadraticLayer.d.ts +30 -22
- package/dist/structures/components/QuadraticLayer.js +23 -21
- package/dist/structures/components/TextLayer.d.ts +54 -41
- package/dist/structures/components/TextLayer.js +165 -69
- package/dist/structures/helpers/Exporter.d.ts +9 -9
- package/dist/structures/helpers/Exporter.js +9 -9
- package/dist/structures/helpers/Font.d.ts +4 -4
- package/dist/structures/helpers/Font.js +4 -4
- package/dist/structures/helpers/Gradient.d.ts +15 -10
- package/dist/structures/helpers/Gradient.js +14 -9
- package/dist/structures/helpers/Link.d.ts +5 -5
- package/dist/structures/helpers/Link.js +5 -5
- package/dist/structures/helpers/Pattern.d.ts +5 -5
- package/dist/structures/helpers/Pattern.js +5 -5
- package/dist/structures/helpers/index.d.ts +7 -7
- package/dist/structures/helpers/readers/JSONReader.d.ts +12 -12
- package/dist/structures/helpers/readers/JSONReader.js +12 -12
- package/dist/structures/helpers/readers/YAMLReader.d.ts +4 -4
- package/dist/structures/helpers/readers/YAMLReader.js +4 -4
- package/dist/structures/managers/AnimationManager.d.ts +11 -11
- package/dist/structures/managers/AnimationManager.js +11 -11
- package/dist/structures/managers/FontsManager.d.ts +14 -15
- package/dist/structures/managers/FontsManager.js +14 -15
- package/dist/structures/managers/LayersManager.d.ts +15 -15
- package/dist/structures/managers/LayersManager.js +19 -19
- package/dist/structures/managers/PluginManager.d.ts +11 -9
- package/dist/structures/managers/PluginManager.js +9 -8
- package/dist/structures/managers/RenderManager.d.ts +10 -10
- package/dist/structures/managers/RenderManager.js +10 -10
- package/dist/structures/managers/index.d.ts +5 -0
- package/dist/structures/managers/index.js +21 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/types.d.ts +7 -1
- package/dist/utils/utils.d.ts +5 -5
- package/dist/utils/utils.js +8 -2
- package/package.json +1 -2
|
@@ -30,8 +30,8 @@ class Gradient {
|
|
|
30
30
|
angle;
|
|
31
31
|
/**
|
|
32
32
|
* Constructs a new Gradient instance.
|
|
33
|
-
* @param
|
|
34
|
-
* @param opts.props
|
|
33
|
+
* @param {Object} [opts] - Optional properties for the gradient.
|
|
34
|
+
* @param {IGradient} [opts.props] - The gradient properties.
|
|
35
35
|
*/
|
|
36
36
|
constructor(opts) {
|
|
37
37
|
this.type = opts?.props?.type || types_1.GradientType.Linear;
|
|
@@ -41,7 +41,7 @@ class Gradient {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Sets the type of the gradient.
|
|
44
|
-
* @param
|
|
44
|
+
* @param {AnyGradientType} [type] - The type of the gradient (e.g., linear, radial, conic).
|
|
45
45
|
* @returns {this} The current instance for chaining.
|
|
46
46
|
*/
|
|
47
47
|
setType(type) {
|
|
@@ -50,7 +50,7 @@ class Gradient {
|
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Adds points to the gradient.
|
|
53
|
-
* @param
|
|
53
|
+
* @param {GradientPoint[]} [points] - The points to add to the gradient.
|
|
54
54
|
* @returns {this} The current instance for chaining.
|
|
55
55
|
*/
|
|
56
56
|
addPoints(...points) {
|
|
@@ -59,7 +59,7 @@ class Gradient {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Sets the points of the gradient.
|
|
62
|
-
* @param
|
|
62
|
+
* @param {GradientPoint[]} [points] - The points to set for the gradient.
|
|
63
63
|
* @returns {this} The current instance for chaining.
|
|
64
64
|
*/
|
|
65
65
|
setPoints(...points) {
|
|
@@ -68,7 +68,7 @@ class Gradient {
|
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Removes points from the gradient by their indexes.
|
|
71
|
-
* @param
|
|
71
|
+
* @param {number[]} [indexes] - The indexes of the points to remove.
|
|
72
72
|
* @returns {this} The current instance for chaining.
|
|
73
73
|
*/
|
|
74
74
|
removePoints(...indexes) {
|
|
@@ -77,7 +77,7 @@ class Gradient {
|
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Adds color stops to the gradient.
|
|
80
|
-
* @param
|
|
80
|
+
* @param {GradientColorStop[]} [stops] - The color stops to add to the gradient.
|
|
81
81
|
* @returns {this} The current instance for chaining.
|
|
82
82
|
*/
|
|
83
83
|
addStops(...stops) {
|
|
@@ -86,7 +86,7 @@ class Gradient {
|
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Sets the color stops of the gradient.
|
|
89
|
-
* @param
|
|
89
|
+
* @param {GradientColorStop[]} [stops] - The color stops to set for the gradient.
|
|
90
90
|
* @returns {this} The current instance for chaining.
|
|
91
91
|
*/
|
|
92
92
|
setStops(...stops) {
|
|
@@ -95,13 +95,18 @@ class Gradient {
|
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Removes color stops from the gradient by their indexes.
|
|
98
|
-
* @param
|
|
98
|
+
* @param {number[]} [indexes] - The indexes of the color stops to remove.
|
|
99
99
|
* @returns {this} The current instance for chaining.
|
|
100
100
|
*/
|
|
101
101
|
removeStops(...indexes) {
|
|
102
102
|
this.stops = this.stops.filter((_, index) => !indexes.includes(index));
|
|
103
103
|
return this;
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Sets the angle of the gradient (used for linear gradients).
|
|
107
|
+
* @param {number} [angle] - The angle in degrees.
|
|
108
|
+
* @returns {this} The current instance for chaining.
|
|
109
|
+
*/
|
|
105
110
|
setAngle(angle) {
|
|
106
111
|
this.angle = angle;
|
|
107
112
|
return this;
|
|
@@ -34,27 +34,27 @@ export declare class Link {
|
|
|
34
34
|
additionalSpacing: ScaleType;
|
|
35
35
|
/**
|
|
36
36
|
* Constructs a new Link instance.
|
|
37
|
-
* @param
|
|
38
|
-
* @param opts.props
|
|
37
|
+
* @param {Object} [opts] - Optional properties for the link.
|
|
38
|
+
* @param {ILink} [opts.props] - The link properties.
|
|
39
39
|
*/
|
|
40
40
|
constructor(opts?: {
|
|
41
41
|
props?: ILink;
|
|
42
42
|
});
|
|
43
43
|
/**
|
|
44
44
|
* Sets the source of the link.
|
|
45
|
-
* @param
|
|
45
|
+
* @param {string} [source] - The ID of the layer to link.
|
|
46
46
|
* @returns {this} The current instance for chaining.
|
|
47
47
|
*/
|
|
48
48
|
setSource(source: string): this;
|
|
49
49
|
/**
|
|
50
50
|
* Sets the type of the link.
|
|
51
|
-
* @param
|
|
51
|
+
* @param {AnyLinkType} [type] - The type of the link.
|
|
52
52
|
* @returns {this} The current instance for chaining.
|
|
53
53
|
*/
|
|
54
54
|
setType(type: AnyLinkType): this;
|
|
55
55
|
/**
|
|
56
56
|
* Sets the additional spacing of the link.
|
|
57
|
-
* @param
|
|
57
|
+
* @param {ScaleType} [additionalSpacing] - The additional spacing of the link.
|
|
58
58
|
* @returns {this} The current instance for chaining.
|
|
59
59
|
*/
|
|
60
60
|
setSpacing(additionalSpacing: ScaleType): this;
|
|
@@ -20,8 +20,8 @@ class Link {
|
|
|
20
20
|
additionalSpacing;
|
|
21
21
|
/**
|
|
22
22
|
* Constructs a new Link instance.
|
|
23
|
-
* @param
|
|
24
|
-
* @param opts.props
|
|
23
|
+
* @param {Object} [opts] - Optional properties for the link.
|
|
24
|
+
* @param {ILink} [opts.props] - The link properties.
|
|
25
25
|
*/
|
|
26
26
|
constructor(opts) {
|
|
27
27
|
this.source = opts?.props?.source || '';
|
|
@@ -30,7 +30,7 @@ class Link {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Sets the source of the link.
|
|
33
|
-
* @param
|
|
33
|
+
* @param {string} [source] - The ID of the layer to link.
|
|
34
34
|
* @returns {this} The current instance for chaining.
|
|
35
35
|
*/
|
|
36
36
|
setSource(source) {
|
|
@@ -39,7 +39,7 @@ class Link {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Sets the type of the link.
|
|
42
|
-
* @param
|
|
42
|
+
* @param {AnyLinkType} [type] - The type of the link.
|
|
43
43
|
* @returns {this} The current instance for chaining.
|
|
44
44
|
*/
|
|
45
45
|
setType(type) {
|
|
@@ -48,7 +48,7 @@ class Link {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Sets the additional spacing of the link.
|
|
51
|
-
* @param
|
|
51
|
+
* @param {ScaleType} [additionalSpacing] - The additional spacing of the link.
|
|
52
52
|
* @returns {this} The current instance for chaining.
|
|
53
53
|
*/
|
|
54
54
|
setSpacing(additionalSpacing) {
|
|
@@ -36,27 +36,27 @@ export declare class Pattern implements IPattern {
|
|
|
36
36
|
src: string | LazyCanvas;
|
|
37
37
|
/**
|
|
38
38
|
* Constructs a new Pattern instance.
|
|
39
|
-
* @param
|
|
40
|
-
* @param opts.props
|
|
39
|
+
* @param {Object} [opts] - Optional properties for the pattern.
|
|
40
|
+
* @param {IPattern} [opts.props] - The pattern properties.
|
|
41
41
|
*/
|
|
42
42
|
constructor(opts?: {
|
|
43
43
|
props?: IPattern;
|
|
44
44
|
});
|
|
45
45
|
/**
|
|
46
46
|
* Sets the type of the pattern.
|
|
47
|
-
* @param
|
|
47
|
+
* @param {AnyPatternType} [type] - The type of the pattern (e.g., repeat, no-repeat).
|
|
48
48
|
* @returns {this} The current instance for chaining.
|
|
49
49
|
*/
|
|
50
50
|
setType(type: AnyPatternType): this;
|
|
51
51
|
/**
|
|
52
52
|
* Sets the source of the pattern.
|
|
53
|
-
* @param
|
|
53
|
+
* @param {string | LazyCanvas} [src] - The source of the pattern, which can be a string (URL or path) or a LazyCanvas instance.
|
|
54
54
|
* @returns {this} The current instance for chaining.
|
|
55
55
|
*/
|
|
56
56
|
setSrc(src: string | LazyCanvas): this;
|
|
57
57
|
/**
|
|
58
58
|
* Draws the pattern on a canvas context.
|
|
59
|
-
* @param
|
|
59
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
60
60
|
* @returns {Promise<CanvasPattern>} The created pattern.
|
|
61
61
|
*/
|
|
62
62
|
draw(ctx: SKRSContext2D): Promise<CanvasPattern>;
|
|
@@ -24,8 +24,8 @@ class Pattern {
|
|
|
24
24
|
src;
|
|
25
25
|
/**
|
|
26
26
|
* Constructs a new Pattern instance.
|
|
27
|
-
* @param
|
|
28
|
-
* @param opts.props
|
|
27
|
+
* @param {Object} [opts] - Optional properties for the pattern.
|
|
28
|
+
* @param {IPattern} [opts.props] - The pattern properties.
|
|
29
29
|
*/
|
|
30
30
|
constructor(opts) {
|
|
31
31
|
this.type = opts?.props?.type || types_1.PatternType.Repeat;
|
|
@@ -33,7 +33,7 @@ class Pattern {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Sets the type of the pattern.
|
|
36
|
-
* @param
|
|
36
|
+
* @param {AnyPatternType} [type] - The type of the pattern (e.g., repeat, no-repeat).
|
|
37
37
|
* @returns {this} The current instance for chaining.
|
|
38
38
|
*/
|
|
39
39
|
setType(type) {
|
|
@@ -42,7 +42,7 @@ class Pattern {
|
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Sets the source of the pattern.
|
|
45
|
-
* @param
|
|
45
|
+
* @param {string | LazyCanvas} [src] - The source of the pattern, which can be a string (URL or path) or a LazyCanvas instance.
|
|
46
46
|
* @returns {this} The current instance for chaining.
|
|
47
47
|
*/
|
|
48
48
|
setSrc(src) {
|
|
@@ -51,7 +51,7 @@ class Pattern {
|
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Draws the pattern on a canvas context.
|
|
54
|
-
* @param
|
|
54
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
55
55
|
* @returns {Promise<CanvasPattern>} The created pattern.
|
|
56
56
|
*/
|
|
57
57
|
async draw(ctx) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from './Exporter';
|
|
2
|
+
export * from './Font';
|
|
3
|
+
export * from './Gradient';
|
|
4
|
+
export * from './Link';
|
|
5
|
+
export * from './Pattern';
|
|
6
|
+
export * from './readers/JSONReader';
|
|
7
|
+
export * from './readers/YAMLReader';
|
|
@@ -5,9 +5,9 @@ import { IOLazyCanvas, LazyCanvas } from "../../LazyCanvas";
|
|
|
5
5
|
export declare class JSONReader {
|
|
6
6
|
/**
|
|
7
7
|
* Reads JSON data and converts it into a LazyCanvas instance.
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param opts.debug
|
|
8
|
+
* @param {IOLazyCanvas} [data] - The JSON data to read.
|
|
9
|
+
* @param {Object} [opts] - Optional settings.
|
|
10
|
+
* @param {boolean} [opts.debug] - Whether to enable debug logging.
|
|
11
11
|
* @returns {LazyCanvas} The created LazyCanvas instance.
|
|
12
12
|
* @throws {LazyError} If the data contains invalid options or no layers are found.
|
|
13
13
|
*/
|
|
@@ -16,9 +16,9 @@ export declare class JSONReader {
|
|
|
16
16
|
}): LazyCanvas;
|
|
17
17
|
/**
|
|
18
18
|
* Reads a JSON file and converts it into a LazyCanvas instance.
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param opts.debug
|
|
19
|
+
* @param {string} [file] - The path to the JSON file.
|
|
20
|
+
* @param {Object} [opts] - Optional settings.
|
|
21
|
+
* @param {boolean} [opts.debug] - Whether to enable debug logging.
|
|
22
22
|
* @returns {LazyCanvas} The created LazyCanvas instance.
|
|
23
23
|
* @throws {LazyError} If the file does not exist.
|
|
24
24
|
*/
|
|
@@ -27,22 +27,22 @@ export declare class JSONReader {
|
|
|
27
27
|
}): LazyCanvas;
|
|
28
28
|
/**
|
|
29
29
|
* Parses an array of JSON layers into an array of AnyLayer or Group instances.
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param opts.debug
|
|
30
|
+
* @param {Array<JSONLayer | Group>} [data] - The array of JSON layers to parse.
|
|
31
|
+
* @param {Object} [opts] - Optional settings.
|
|
32
|
+
* @param {boolean} [opts.debug] - Whether to enable debug logging.
|
|
33
33
|
* @returns {Array<AnyLayer | Group>} The parsed layers.
|
|
34
34
|
*/
|
|
35
35
|
private static layersParse;
|
|
36
36
|
/**
|
|
37
37
|
* Parses a single JSON layer into an AnyLayer or Group instance.
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
38
|
+
* @param {JSONLayer | IGroup | Group} [layer] - The JSON layer to parse.
|
|
39
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
40
40
|
* @returns {AnyLayer | Group} The parsed layer.
|
|
41
41
|
*/
|
|
42
42
|
private static layerParse;
|
|
43
43
|
/**
|
|
44
44
|
* Parses the fill style of a layer.
|
|
45
|
-
* @param
|
|
45
|
+
* @param {JSONLayer} [layer] - The layer whose fill style is to be parsed.
|
|
46
46
|
* @returns {string | Gradient | Pattern} The parsed fill style.
|
|
47
47
|
*/
|
|
48
48
|
private static fillParse;
|
|
@@ -47,9 +47,9 @@ const path = __importStar(require("path"));
|
|
|
47
47
|
class JSONReader {
|
|
48
48
|
/**
|
|
49
49
|
* Reads JSON data and converts it into a LazyCanvas instance.
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @param opts.debug
|
|
50
|
+
* @param {IOLazyCanvas} [data] - The JSON data to read.
|
|
51
|
+
* @param {Object} [opts] - Optional settings.
|
|
52
|
+
* @param {boolean} [opts.debug] - Whether to enable debug logging.
|
|
53
53
|
* @returns {LazyCanvas} The created LazyCanvas instance.
|
|
54
54
|
* @throws {LazyError} If the data contains invalid options or no layers are found.
|
|
55
55
|
*/
|
|
@@ -76,9 +76,9 @@ class JSONReader {
|
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Reads a JSON file and converts it into a LazyCanvas instance.
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
81
|
-
* @param opts.debug
|
|
79
|
+
* @param {string} [file] - The path to the JSON file.
|
|
80
|
+
* @param {Object} [opts] - Optional settings.
|
|
81
|
+
* @param {boolean} [opts.debug] - Whether to enable debug logging.
|
|
82
82
|
* @returns {LazyCanvas} The created LazyCanvas instance.
|
|
83
83
|
* @throws {LazyError} If the file does not exist.
|
|
84
84
|
*/
|
|
@@ -94,9 +94,9 @@ class JSONReader {
|
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Parses an array of JSON layers into an array of AnyLayer or Group instances.
|
|
97
|
-
* @param
|
|
98
|
-
* @param
|
|
99
|
-
* @param opts.debug
|
|
97
|
+
* @param {Array<JSONLayer | Group>} [data] - The array of JSON layers to parse.
|
|
98
|
+
* @param {Object} [opts] - Optional settings.
|
|
99
|
+
* @param {boolean} [opts.debug] - Whether to enable debug logging.
|
|
100
100
|
* @returns {Array<AnyLayer | Group>} The parsed layers.
|
|
101
101
|
*/
|
|
102
102
|
static layersParse(data, opts) {
|
|
@@ -118,8 +118,8 @@ class JSONReader {
|
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Parses a single JSON layer into an AnyLayer or Group instance.
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
121
|
+
* @param {JSONLayer | IGroup | Group} [layer] - The JSON layer to parse.
|
|
122
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
123
123
|
* @returns {AnyLayer | Group} The parsed layer.
|
|
124
124
|
*/
|
|
125
125
|
static layerParse(layer, misc) {
|
|
@@ -154,7 +154,7 @@ class JSONReader {
|
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Parses the fill style of a layer.
|
|
157
|
-
* @param
|
|
157
|
+
* @param {JSONLayer} [layer] - The layer whose fill style is to be parsed.
|
|
158
158
|
* @returns {string | Gradient | Pattern} The parsed fill style.
|
|
159
159
|
*/
|
|
160
160
|
static fillParse(layer) {
|
|
@@ -2,8 +2,8 @@ import { LazyCanvas } from "../../LazyCanvas";
|
|
|
2
2
|
export declare class YAMLReader {
|
|
3
3
|
/**
|
|
4
4
|
* Reads a YAML string and converts it to a LazyCanvas object.
|
|
5
|
-
* @param data - The YAML string to read.
|
|
6
|
-
* @param opts - Optional parameters for debugging.
|
|
5
|
+
* @param {string} [data] - The YAML string to read.
|
|
6
|
+
* @param {Object} [opts] - Optional parameters for debugging.
|
|
7
7
|
* @returns A Promise that resolves to a LazyCanvas object.
|
|
8
8
|
*/
|
|
9
9
|
static read(data: string, opts?: {
|
|
@@ -11,8 +11,8 @@ export declare class YAMLReader {
|
|
|
11
11
|
}): LazyCanvas;
|
|
12
12
|
/**
|
|
13
13
|
* Reads a YAML file and converts it to a LazyCanvas object.
|
|
14
|
-
* @param filePath - The path to the YAML file.
|
|
15
|
-
* @param opts - Optional parameters for debugging.
|
|
14
|
+
* @param {string} [filePath] - The path to the YAML file.
|
|
15
|
+
* @param {Object} [opts] - Optional parameters for debugging.
|
|
16
16
|
* @returns A Promise that resolves to a LazyCanvas object.
|
|
17
17
|
* @throws LazyError if the file does not exist or has an invalid extension.
|
|
18
18
|
*/
|
|
@@ -42,8 +42,8 @@ const path = __importStar(require("path"));
|
|
|
42
42
|
class YAMLReader {
|
|
43
43
|
/**
|
|
44
44
|
* Reads a YAML string and converts it to a LazyCanvas object.
|
|
45
|
-
* @param data - The YAML string to read.
|
|
46
|
-
* @param opts - Optional parameters for debugging.
|
|
45
|
+
* @param {string} [data] - The YAML string to read.
|
|
46
|
+
* @param {Object} [opts] - Optional parameters for debugging.
|
|
47
47
|
* @returns A Promise that resolves to a LazyCanvas object.
|
|
48
48
|
*/
|
|
49
49
|
static read(data, opts) {
|
|
@@ -60,8 +60,8 @@ class YAMLReader {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Reads a YAML file and converts it to a LazyCanvas object.
|
|
63
|
-
* @param filePath - The path to the YAML file.
|
|
64
|
-
* @param opts - Optional parameters for debugging.
|
|
63
|
+
* @param {string} [filePath] - The path to the YAML file.
|
|
64
|
+
* @param {Object} [opts] - Optional parameters for debugging.
|
|
65
65
|
* @returns A Promise that resolves to a LazyCanvas object.
|
|
66
66
|
* @throws LazyError if the file does not exist or has an invalid extension.
|
|
67
67
|
*/
|
|
@@ -69,10 +69,10 @@ export declare class AnimationManager implements IAnimationManager {
|
|
|
69
69
|
debug: boolean;
|
|
70
70
|
/**
|
|
71
71
|
* Constructs a new AnimationManager instance.
|
|
72
|
-
* @param
|
|
73
|
-
* @param opts.debug
|
|
74
|
-
* @param opts.settings
|
|
75
|
-
* @param opts.settings.options
|
|
72
|
+
* @param {Object} [opts] - Optional settings for the animation manager.
|
|
73
|
+
* @param {boolean} [opts.debug] - Whether debugging is enabled.
|
|
74
|
+
* @param {Object} [opts.settings] - Additional settings for the animation manager.
|
|
75
|
+
* @param {IAnimationOptions} [opts.settings.options] - The animation options.
|
|
76
76
|
*/
|
|
77
77
|
constructor(opts?: {
|
|
78
78
|
debug?: boolean;
|
|
@@ -82,38 +82,38 @@ export declare class AnimationManager implements IAnimationManager {
|
|
|
82
82
|
});
|
|
83
83
|
/**
|
|
84
84
|
* Sets the frame rate of the animation.
|
|
85
|
-
* @param
|
|
85
|
+
* @param {number} [frameRate] - The frame rate of the animation (default is 30).
|
|
86
86
|
* @returns {this} The current instance for chaining.
|
|
87
87
|
*/
|
|
88
88
|
setFrameRate(frameRate: number): this;
|
|
89
89
|
/**
|
|
90
90
|
* Sets whether the animation should loop.
|
|
91
|
-
* @param
|
|
91
|
+
* @param {boolean} [loop] - Whether the animation should loop (default is true).
|
|
92
92
|
* @returns {this} The current instance for chaining.
|
|
93
93
|
*/
|
|
94
94
|
setLoop(loop: boolean): this;
|
|
95
95
|
/**
|
|
96
96
|
* Sets whether the animation should have transparency.
|
|
97
|
-
* @param
|
|
97
|
+
* @param {boolean} [transparency] - Whether the animation should have transparency (default is true).
|
|
98
98
|
* @returns {this} The current instance for chaining.
|
|
99
99
|
*/
|
|
100
100
|
setTransparent(transparency: boolean): this;
|
|
101
101
|
/**
|
|
102
102
|
* Sets the RGB format of the animation.
|
|
103
|
-
* @param
|
|
103
|
+
* @param {ColorSpace} [rgb] - The RGB format of the animation (default is RGB565).
|
|
104
104
|
* @returns {this} The current instance for chaining.
|
|
105
105
|
*/
|
|
106
106
|
setRGBFormat(rgb: AnyColorSpace): this;
|
|
107
107
|
/**
|
|
108
108
|
* Sets the maximum number of colors in the animation.
|
|
109
|
-
* @param
|
|
109
|
+
* @param {number} [maxColors] - The maximum number of colors (default is 256).
|
|
110
110
|
* @returns {this} The current instance for chaining.
|
|
111
111
|
*/
|
|
112
112
|
setMaxColors(maxColors: number): this;
|
|
113
113
|
/**
|
|
114
114
|
* Sets whether the content of previous frames will be cleared.
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
115
|
+
* @param {boolean} [clear] - Whether to clear the content of previous frames (default is true).
|
|
116
|
+
* @param {number} [bufferSize] - The size of the frame buffer (default is 0).
|
|
117
117
|
* @returns {this} The current instance for chaining.
|
|
118
118
|
*/
|
|
119
119
|
setClear(clear: boolean, bufferSize?: number): this;
|
|
@@ -16,10 +16,10 @@ class AnimationManager {
|
|
|
16
16
|
debug;
|
|
17
17
|
/**
|
|
18
18
|
* Constructs a new AnimationManager instance.
|
|
19
|
-
* @param
|
|
20
|
-
* @param opts.debug
|
|
21
|
-
* @param opts.settings
|
|
22
|
-
* @param opts.settings.options
|
|
19
|
+
* @param {Object} [opts] - Optional settings for the animation manager.
|
|
20
|
+
* @param {boolean} [opts.debug] - Whether debugging is enabled.
|
|
21
|
+
* @param {Object} [opts.settings] - Additional settings for the animation manager.
|
|
22
|
+
* @param {IAnimationOptions} [opts.settings.options] - The animation options.
|
|
23
23
|
*/
|
|
24
24
|
constructor(opts) {
|
|
25
25
|
this.options = opts?.settings?.options || {
|
|
@@ -39,7 +39,7 @@ class AnimationManager {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Sets the frame rate of the animation.
|
|
42
|
-
* @param
|
|
42
|
+
* @param {number} [frameRate] - The frame rate of the animation (default is 30).
|
|
43
43
|
* @returns {this} The current instance for chaining.
|
|
44
44
|
*/
|
|
45
45
|
setFrameRate(frameRate) {
|
|
@@ -48,7 +48,7 @@ class AnimationManager {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Sets whether the animation should loop.
|
|
51
|
-
* @param
|
|
51
|
+
* @param {boolean} [loop] - Whether the animation should loop (default is true).
|
|
52
52
|
* @returns {this} The current instance for chaining.
|
|
53
53
|
*/
|
|
54
54
|
setLoop(loop) {
|
|
@@ -57,7 +57,7 @@ class AnimationManager {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Sets whether the animation should have transparency.
|
|
60
|
-
* @param
|
|
60
|
+
* @param {boolean} [transparency] - Whether the animation should have transparency (default is true).
|
|
61
61
|
* @returns {this} The current instance for chaining.
|
|
62
62
|
*/
|
|
63
63
|
setTransparent(transparency) {
|
|
@@ -66,7 +66,7 @@ class AnimationManager {
|
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Sets the RGB format of the animation.
|
|
69
|
-
* @param
|
|
69
|
+
* @param {ColorSpace} [rgb] - The RGB format of the animation (default is RGB565).
|
|
70
70
|
* @returns {this} The current instance for chaining.
|
|
71
71
|
*/
|
|
72
72
|
setRGBFormat(rgb) {
|
|
@@ -75,7 +75,7 @@ class AnimationManager {
|
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Sets the maximum number of colors in the animation.
|
|
78
|
-
* @param
|
|
78
|
+
* @param {number} [maxColors] - The maximum number of colors (default is 256).
|
|
79
79
|
* @returns {this} The current instance for chaining.
|
|
80
80
|
*/
|
|
81
81
|
setMaxColors(maxColors) {
|
|
@@ -84,8 +84,8 @@ class AnimationManager {
|
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* Sets whether the content of previous frames will be cleared.
|
|
87
|
-
* @param
|
|
88
|
-
* @param
|
|
87
|
+
* @param {boolean} [clear] - Whether to clear the content of previous frames (default is true).
|
|
88
|
+
* @param {number} [bufferSize] - The size of the frame buffer (default is 0).
|
|
89
89
|
* @returns {this} The current instance for chaining.
|
|
90
90
|
*/
|
|
91
91
|
setClear(clear, bufferSize) {
|
|
@@ -26,31 +26,30 @@ export declare class FontsManager implements IFontsManager {
|
|
|
26
26
|
debug: boolean;
|
|
27
27
|
/**
|
|
28
28
|
* Constructs a new FontsManager instance.
|
|
29
|
-
* @param
|
|
30
|
-
* @param opts.debug
|
|
29
|
+
* @param {Object} [opts] - Optional settings for the FontsManager.
|
|
30
|
+
* @param {boolean} [opts.debug] - Whether debugging is enabled.
|
|
31
31
|
*/
|
|
32
32
|
constructor(opts?: {
|
|
33
33
|
debug?: boolean;
|
|
34
34
|
});
|
|
35
35
|
/**
|
|
36
36
|
* Loads fonts into the manager from a given font list.
|
|
37
|
-
* @param
|
|
37
|
+
* @param {IFonts} [fontList] - The fonts to load into the manager.
|
|
38
38
|
* @returns {this} The current instance for chaining.
|
|
39
39
|
*/
|
|
40
40
|
loadFonts(fontList: IFonts): this;
|
|
41
41
|
/**
|
|
42
42
|
* Replace base fonts with custom fonts by special file.
|
|
43
43
|
* Use this method before loading fonts by `FontManager`.
|
|
44
|
-
* The file should be generated by the following instructions in MD file.
|
|
45
|
-
* @
|
|
46
|
-
* @param fonts {Font[]} - The fonts to add to the manager.
|
|
44
|
+
* The file should be generated by the following instructions in [MD file](https://github.com/NMMTY/LazyCanvas/blob/main/scripts/FontsGenerate.md).
|
|
45
|
+
* @param {Font[]} [fonts] - The fonts to add to the manager.
|
|
47
46
|
* @returns {this} The current instance for chaining.
|
|
48
47
|
* @throws {LazyError} If required font properties are missing or the font already exists.
|
|
49
48
|
*/
|
|
50
49
|
add(...fonts: Font[]): this;
|
|
51
50
|
/**
|
|
52
51
|
* Removes fonts from the manager.
|
|
53
|
-
* @param
|
|
52
|
+
* @param {Array<{ family: string, weight: string }>} [array] - The family and weight of the fonts to remove.
|
|
54
53
|
* @returns {this} The current instance for chaining.
|
|
55
54
|
*/
|
|
56
55
|
remove(...array: Array<{
|
|
@@ -64,15 +63,15 @@ export declare class FontsManager implements IFontsManager {
|
|
|
64
63
|
clear(): this;
|
|
65
64
|
/**
|
|
66
65
|
* Retrieves a font or fonts from the manager.
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
66
|
+
* @param {string} [family] - The family of the font to retrieve.
|
|
67
|
+
* @param {string} [weight] - The weight of the font to retrieve (optional).
|
|
69
68
|
* @returns {Font | Font[] | undefined} The retrieved font(s) or undefined if not found.
|
|
70
69
|
*/
|
|
71
70
|
get(family: string, weight?: string): Font | Font[] | undefined;
|
|
72
71
|
/**
|
|
73
72
|
* Checks if a font exists in the manager.
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
73
|
+
* @param {string} [family] - The family of the font to check.
|
|
74
|
+
* @param {string} [weight] - The weight of the font to check (optional).
|
|
76
75
|
* @returns {boolean} True if the font exists, false otherwise.
|
|
77
76
|
*/
|
|
78
77
|
has(family: string, weight?: string): boolean;
|
|
@@ -98,8 +97,8 @@ export declare class FontsManager implements IFontsManager {
|
|
|
98
97
|
entries(): IterableIterator<[string, Font]>;
|
|
99
98
|
/**
|
|
100
99
|
* Iterates over the fonts in the manager.
|
|
101
|
-
* @param
|
|
102
|
-
* @param
|
|
100
|
+
* @param {Function} [callbackfn] - The function to execute on each font.
|
|
101
|
+
* @param {any} [thisArg] - The `this` context to use (optional).
|
|
103
102
|
* @returns {this} The current instance for chaining.
|
|
104
103
|
*/
|
|
105
104
|
forEach(callbackfn: (value: Font, key: string, map: Map<string, Font>) => void, thisArg?: any): this;
|
|
@@ -110,7 +109,7 @@ export declare class FontsManager implements IFontsManager {
|
|
|
110
109
|
toJSON(): object;
|
|
111
110
|
/**
|
|
112
111
|
* Populates the font map from a JSON object.
|
|
113
|
-
* @param
|
|
112
|
+
* @param {object} [json] - The JSON object to populate the map from.
|
|
114
113
|
* @returns {this} The current instance for chaining.
|
|
115
114
|
*/
|
|
116
115
|
fromJSON(json: object): this;
|
|
@@ -121,7 +120,7 @@ export declare class FontsManager implements IFontsManager {
|
|
|
121
120
|
toArray(): Font[];
|
|
122
121
|
/**
|
|
123
122
|
* Populates the font map from an array of fonts.
|
|
124
|
-
* @param
|
|
123
|
+
* @param {Font[]} [array] - The array of fonts to populate the map from.
|
|
125
124
|
* @returns {this} The current instance for chaining.
|
|
126
125
|
*/
|
|
127
126
|
fromArray(array: Font[]): this;
|