@nmmty/lazycanvas 0.6.0-dev.f33019 → 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.
- package/dist/helpers/Utlis.d.ts +28 -0
- package/dist/helpers/Utlis.js +78 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +19 -0
- package/dist/index.d.ts +5 -10
- package/dist/index.js +5 -29
- package/dist/structures/LazyCanvas.d.ts +46 -13
- package/dist/structures/LazyCanvas.js +66 -22
- package/dist/structures/components/BaseLayer.d.ts +16 -16
- package/dist/structures/components/BaseLayer.js +17 -17
- package/dist/structures/components/BezierLayer.d.ts +21 -21
- package/dist/structures/components/BezierLayer.js +20 -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 +12 -14
- package/dist/structures/components/ImageLayer.js +11 -11
- package/dist/structures/components/LineLayer.d.ts +20 -20
- package/dist/structures/components/LineLayer.js +19 -19
- package/dist/structures/components/MorphLayer.d.ts +18 -24
- package/dist/structures/components/MorphLayer.js +18 -26
- package/dist/structures/components/Path2DLayer.d.ts +4 -78
- package/dist/structures/components/Path2DLayer.js +2 -116
- package/dist/structures/components/QuadraticLayer.d.ts +22 -22
- package/dist/structures/components/QuadraticLayer.js +21 -21
- package/dist/structures/components/TextLayer.d.ts +37 -43
- package/dist/structures/components/TextLayer.js +37 -45
- package/dist/structures/helpers/Exporter.d.ts +9 -11
- package/dist/structures/helpers/Exporter.js +49 -32
- package/dist/structures/helpers/Font.d.ts +4 -6
- 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 +29 -19
- package/dist/structures/helpers/readers/YAMLReader.d.ts +4 -4
- package/dist/structures/helpers/readers/YAMLReader.js +21 -11
- 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 +22 -12
- package/dist/structures/managers/LayersManager.js +27 -12
- package/dist/structures/managers/PluginManager.d.ts +230 -0
- package/dist/structures/managers/PluginManager.js +182 -0
- package/dist/structures/managers/RenderManager.d.ts +10 -12
- package/dist/structures/managers/RenderManager.js +31 -16
- package/dist/structures/managers/index.d.ts +5 -0
- package/dist/structures/managers/index.js +21 -0
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +15 -16
- package/package.json +59 -56
|
@@ -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;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.JSONReader = void 0;
|
|
27
37
|
const types_1 = require("../../../types");
|
|
@@ -37,9 +47,9 @@ const path = __importStar(require("path"));
|
|
|
37
47
|
class JSONReader {
|
|
38
48
|
/**
|
|
39
49
|
* Reads JSON data and converts it into a LazyCanvas instance.
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @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.
|
|
43
53
|
* @returns {LazyCanvas} The created LazyCanvas instance.
|
|
44
54
|
* @throws {LazyError} If the data contains invalid options or no layers are found.
|
|
45
55
|
*/
|
|
@@ -66,9 +76,9 @@ class JSONReader {
|
|
|
66
76
|
}
|
|
67
77
|
/**
|
|
68
78
|
* Reads a JSON file and converts it into a LazyCanvas instance.
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
71
|
-
* @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.
|
|
72
82
|
* @returns {LazyCanvas} The created LazyCanvas instance.
|
|
73
83
|
* @throws {LazyError} If the file does not exist.
|
|
74
84
|
*/
|
|
@@ -84,9 +94,9 @@ class JSONReader {
|
|
|
84
94
|
}
|
|
85
95
|
/**
|
|
86
96
|
* Parses an array of JSON layers into an array of AnyLayer or Group instances.
|
|
87
|
-
* @param
|
|
88
|
-
* @param
|
|
89
|
-
* @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.
|
|
90
100
|
* @returns {Array<AnyLayer | Group>} The parsed layers.
|
|
91
101
|
*/
|
|
92
102
|
static layersParse(data, opts) {
|
|
@@ -108,8 +118,8 @@ class JSONReader {
|
|
|
108
118
|
}
|
|
109
119
|
/**
|
|
110
120
|
* Parses a single JSON layer into an AnyLayer or Group instance.
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
121
|
+
* @param {JSONLayer | IGroup | Group} [layer] - The JSON layer to parse.
|
|
122
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
113
123
|
* @returns {AnyLayer | Group} The parsed layer.
|
|
114
124
|
*/
|
|
115
125
|
static layerParse(layer, misc) {
|
|
@@ -144,7 +154,7 @@ class JSONReader {
|
|
|
144
154
|
}
|
|
145
155
|
/**
|
|
146
156
|
* Parses the fill style of a layer.
|
|
147
|
-
* @param
|
|
157
|
+
* @param {JSONLayer} [layer] - The layer whose fill style is to be parsed.
|
|
148
158
|
* @returns {string | Gradient | Pattern} The parsed fill style.
|
|
149
159
|
*/
|
|
150
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
|
*/
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.YAMLReader = void 0;
|
|
27
37
|
const JSONReader_1 = require("./JSONReader");
|
|
@@ -32,8 +42,8 @@ const path = __importStar(require("path"));
|
|
|
32
42
|
class YAMLReader {
|
|
33
43
|
/**
|
|
34
44
|
* Reads a YAML string and converts it to a LazyCanvas object.
|
|
35
|
-
* @param data - The YAML string to read.
|
|
36
|
-
* @param opts - Optional parameters for debugging.
|
|
45
|
+
* @param {string} [data] - The YAML string to read.
|
|
46
|
+
* @param {Object} [opts] - Optional parameters for debugging.
|
|
37
47
|
* @returns A Promise that resolves to a LazyCanvas object.
|
|
38
48
|
*/
|
|
39
49
|
static read(data, opts) {
|
|
@@ -50,8 +60,8 @@ class YAMLReader {
|
|
|
50
60
|
}
|
|
51
61
|
/**
|
|
52
62
|
* Reads a YAML file and converts it to a LazyCanvas object.
|
|
53
|
-
* @param filePath - The path to the YAML file.
|
|
54
|
-
* @param opts - Optional parameters for debugging.
|
|
63
|
+
* @param {string} [filePath] - The path to the YAML file.
|
|
64
|
+
* @param {Object} [opts] - Optional parameters for debugging.
|
|
55
65
|
* @returns A Promise that resolves to a LazyCanvas object.
|
|
56
66
|
* @throws LazyError if the file does not exist or has an invalid extension.
|
|
57
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;
|
|
@@ -19,8 +19,8 @@ class FontsManager {
|
|
|
19
19
|
debug;
|
|
20
20
|
/**
|
|
21
21
|
* Constructs a new FontsManager instance.
|
|
22
|
-
* @param
|
|
23
|
-
* @param opts.debug
|
|
22
|
+
* @param {Object} [opts] - Optional settings for the FontsManager.
|
|
23
|
+
* @param {boolean} [opts.debug] - Whether debugging is enabled.
|
|
24
24
|
*/
|
|
25
25
|
constructor(opts) {
|
|
26
26
|
this.map = new Map();
|
|
@@ -29,7 +29,7 @@ class FontsManager {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Loads fonts into the manager from a given font list.
|
|
32
|
-
* @param
|
|
32
|
+
* @param {IFonts} [fontList] - The fonts to load into the manager.
|
|
33
33
|
* @returns {this} The current instance for chaining.
|
|
34
34
|
*/
|
|
35
35
|
loadFonts(fontList) {
|
|
@@ -46,9 +46,8 @@ class FontsManager {
|
|
|
46
46
|
/**
|
|
47
47
|
* Replace base fonts with custom fonts by special file.
|
|
48
48
|
* Use this method before loading fonts by `FontManager`.
|
|
49
|
-
* The file should be generated by the following instructions in MD file.
|
|
50
|
-
* @
|
|
51
|
-
* @param fonts {Font[]} - The fonts to add to the manager.
|
|
49
|
+
* The file should be generated by the following instructions in [MD file](https://github.com/NMMTY/LazyCanvas/blob/main/scripts/FontsGenerate.md).
|
|
50
|
+
* @param {Font[]} [fonts] - The fonts to add to the manager.
|
|
52
51
|
* @returns {this} The current instance for chaining.
|
|
53
52
|
* @throws {LazyError} If required font properties are missing or the font already exists.
|
|
54
53
|
*/
|
|
@@ -76,7 +75,7 @@ class FontsManager {
|
|
|
76
75
|
}
|
|
77
76
|
/**
|
|
78
77
|
* Removes fonts from the manager.
|
|
79
|
-
* @param
|
|
78
|
+
* @param {Array<{ family: string, weight: string }>} [array] - The family and weight of the fonts to remove.
|
|
80
79
|
* @returns {this} The current instance for chaining.
|
|
81
80
|
*/
|
|
82
81
|
remove(...array) {
|
|
@@ -95,8 +94,8 @@ class FontsManager {
|
|
|
95
94
|
}
|
|
96
95
|
/**
|
|
97
96
|
* Retrieves a font or fonts from the manager.
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
97
|
+
* @param {string} [family] - The family of the font to retrieve.
|
|
98
|
+
* @param {string} [weight] - The weight of the font to retrieve (optional).
|
|
100
99
|
* @returns {Font | Font[] | undefined} The retrieved font(s) or undefined if not found.
|
|
101
100
|
*/
|
|
102
101
|
get(family, weight) {
|
|
@@ -106,8 +105,8 @@ class FontsManager {
|
|
|
106
105
|
}
|
|
107
106
|
/**
|
|
108
107
|
* Checks if a font exists in the manager.
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
108
|
+
* @param {string} [family] - The family of the font to check.
|
|
109
|
+
* @param {string} [weight] - The weight of the font to check (optional).
|
|
111
110
|
* @returns {boolean} True if the font exists, false otherwise.
|
|
112
111
|
*/
|
|
113
112
|
has(family, weight) {
|
|
@@ -145,8 +144,8 @@ class FontsManager {
|
|
|
145
144
|
}
|
|
146
145
|
/**
|
|
147
146
|
* Iterates over the fonts in the manager.
|
|
148
|
-
* @param
|
|
149
|
-
* @param
|
|
147
|
+
* @param {Function} [callbackfn] - The function to execute on each font.
|
|
148
|
+
* @param {any} [thisArg] - The `this` context to use (optional).
|
|
150
149
|
* @returns {this} The current instance for chaining.
|
|
151
150
|
*/
|
|
152
151
|
forEach(callbackfn, thisArg) {
|
|
@@ -162,7 +161,7 @@ class FontsManager {
|
|
|
162
161
|
}
|
|
163
162
|
/**
|
|
164
163
|
* Populates the font map from a JSON object.
|
|
165
|
-
* @param
|
|
164
|
+
* @param {object} [json] - The JSON object to populate the map from.
|
|
166
165
|
* @returns {this} The current instance for chaining.
|
|
167
166
|
*/
|
|
168
167
|
fromJSON(json) {
|
|
@@ -178,7 +177,7 @@ class FontsManager {
|
|
|
178
177
|
}
|
|
179
178
|
/**
|
|
180
179
|
* Populates the font map from an array of fonts.
|
|
181
|
-
* @param
|
|
180
|
+
* @param {Font[]} [array] - The array of fonts to populate the map from.
|
|
182
181
|
* @returns {this} The current instance for chaining.
|
|
183
182
|
*/
|
|
184
183
|
fromArray(array) {
|