@nmmty/lazycanvas 0.6.5 → 1.0.0-dev.3
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/ReadMe.md +1 -1
- package/biome.json +41 -0
- package/dist/core/Interpolation.d.ts +30 -0
- package/dist/core/Interpolation.js +200 -0
- package/dist/core/Scene.d.ts +96 -0
- package/dist/core/Scene.js +172 -0
- package/dist/core/Signal.d.ts +133 -0
- package/dist/core/Signal.js +255 -0
- package/dist/core/SignalUtils.d.ts +133 -0
- package/dist/core/SignalUtils.js +333 -0
- package/dist/core/ThreadScheduler.d.ts +38 -0
- package/dist/core/ThreadScheduler.js +74 -0
- package/dist/helpers/Filters.js +1 -1
- package/dist/helpers/FontsList.js +18 -18
- package/dist/helpers/Utlis.d.ts +3 -3
- package/dist/helpers/Utlis.js +15 -18
- package/dist/helpers/index.d.ts +3 -3
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/jsx-runtime.d.ts +17 -0
- package/dist/jsx-runtime.js +111 -0
- package/dist/structures/LazyCanvas.d.ts +3 -45
- package/dist/structures/LazyCanvas.js +11 -74
- package/dist/structures/components/BaseLayer.d.ts +34 -12
- package/dist/structures/components/BaseLayer.js +68 -35
- package/dist/structures/components/BezierLayer.d.ts +16 -37
- package/dist/structures/components/BezierLayer.js +83 -46
- package/dist/structures/components/{Group.d.ts → Div.d.ts} +22 -16
- package/dist/structures/components/{Group.js → Div.js} +38 -39
- package/dist/structures/components/ImageLayer.d.ts +1 -1
- package/dist/structures/components/ImageLayer.js +24 -25
- package/dist/structures/components/LineLayer.d.ts +11 -37
- package/dist/structures/components/LineLayer.js +42 -42
- package/dist/structures/components/MorphLayer.d.ts +3 -32
- package/dist/structures/components/MorphLayer.js +32 -46
- package/dist/structures/components/Path2DLayer.d.ts +4 -32
- package/dist/structures/components/Path2DLayer.js +28 -33
- package/dist/structures/components/PolygonLayer.d.ts +2 -31
- package/dist/structures/components/PolygonLayer.js +35 -38
- package/dist/structures/components/QuadraticLayer.d.ts +16 -33
- package/dist/structures/components/QuadraticLayer.js +80 -42
- package/dist/structures/components/TextLayer.d.ts +4 -33
- package/dist/structures/components/TextLayer.js +60 -62
- package/dist/structures/components/index.d.ts +10 -11
- package/dist/structures/components/index.js +1 -2
- package/dist/structures/helpers/Exporter.d.ts +13 -4
- package/dist/structures/helpers/Exporter.js +79 -42
- package/dist/structures/helpers/Font.js +1 -17
- package/dist/structures/helpers/Gradient.js +32 -45
- package/dist/structures/helpers/Link.js +2 -14
- package/dist/structures/helpers/Pattern.js +9 -17
- package/dist/structures/helpers/index.d.ts +7 -7
- package/dist/structures/helpers/readers/JSONReader.d.ts +4 -4
- package/dist/structures/helpers/readers/JSONReader.js +32 -40
- package/dist/structures/helpers/readers/YAMLReader.js +5 -5
- package/dist/structures/managers/FontsManager.js +9 -18
- package/dist/structures/managers/LayersManager.d.ts +18 -28
- package/dist/structures/managers/LayersManager.js +14 -36
- package/dist/structures/managers/RenderManager.d.ts +1 -15
- package/dist/structures/managers/RenderManager.js +17 -110
- package/dist/structures/managers/index.d.ts +3 -5
- package/dist/structures/managers/index.js +0 -2
- package/dist/types/enum.d.ts +1 -2
- package/dist/types/enum.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/APNGEncoder.d.ts +67 -0
- package/dist/utils/APNGEncoder.js +205 -0
- package/dist/utils/DrawUtils.d.ts +9 -0
- package/dist/utils/DrawUtils.js +42 -0
- package/dist/utils/LazyUtil.js +1 -2
- package/dist/utils/utils.d.ts +4 -7
- package/dist/utils/utils.js +133 -76
- package/package.json +62 -59
- package/dist/structures/components/ClearLayer.d.ts +0 -147
- package/dist/structures/components/ClearLayer.js +0 -158
- package/dist/structures/managers/AnimationManager.d.ts +0 -120
- package/dist/structures/managers/AnimationManager.js +0 -99
- package/dist/structures/managers/PluginManager.d.ts +0 -230
- package/dist/structures/managers/PluginManager.js +0 -182
- package/dist/types/types.d.ts +0 -107
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { LazyCanvas } from "../LazyCanvas";
|
|
2
|
-
import { AnyLayer } from "../../types";
|
|
3
|
-
import { Group } from "../components";
|
|
4
|
-
import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
|
|
5
|
-
/**
|
|
6
|
-
* Interface representing a LazyCanvas plugin.
|
|
7
|
-
*/
|
|
8
|
-
export interface ILazyCanvasPlugin {
|
|
9
|
-
/**
|
|
10
|
-
* The unique name of the plugin.
|
|
11
|
-
*/
|
|
12
|
-
name: string;
|
|
13
|
-
/**
|
|
14
|
-
* The version of the plugin.
|
|
15
|
-
*/
|
|
16
|
-
version: string;
|
|
17
|
-
/**
|
|
18
|
-
* Optional description of the plugin.
|
|
19
|
-
*/
|
|
20
|
-
description?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Optional author of the plugin.
|
|
23
|
-
*/
|
|
24
|
-
author?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Optional dependencies on other plugins.
|
|
27
|
-
*/
|
|
28
|
-
dependencies?: string[];
|
|
29
|
-
/**
|
|
30
|
-
* Optional configuration object for the plugin.
|
|
31
|
-
*/
|
|
32
|
-
config?: any;
|
|
33
|
-
/**
|
|
34
|
-
* Optional private data storage for the plugin.
|
|
35
|
-
*/
|
|
36
|
-
private?: any;
|
|
37
|
-
/**
|
|
38
|
-
* Method called when the plugin is installed.
|
|
39
|
-
* @param canvas - The LazyCanvas instance.
|
|
40
|
-
* @returns true if installation was successful, false otherwise.
|
|
41
|
-
*/
|
|
42
|
-
install(canvas: LazyCanvas): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Optional method called when the plugin is uninstalled.
|
|
45
|
-
* @param canvas - The LazyCanvas instance.
|
|
46
|
-
* @returns true if uninstallation was successful, false otherwise.
|
|
47
|
-
*/
|
|
48
|
-
uninstall?(canvas: LazyCanvas): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Optional hooks for lifecycle events.
|
|
51
|
-
*/
|
|
52
|
-
hooks?: IPluginHooks;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Interface representing plugin hooks for lifecycle events.
|
|
56
|
-
*/
|
|
57
|
-
export interface IPluginHooks {
|
|
58
|
-
/**
|
|
59
|
-
* Called before rendering starts.
|
|
60
|
-
*/
|
|
61
|
-
beforeRender?(canvas: LazyCanvas): void;
|
|
62
|
-
/**
|
|
63
|
-
* Called after rendering completes.
|
|
64
|
-
*/
|
|
65
|
-
afterRender?(canvas: LazyCanvas): void;
|
|
66
|
-
/**
|
|
67
|
-
* Called before export starts.
|
|
68
|
-
*/
|
|
69
|
-
beforeExport?(canvas: LazyCanvas): void;
|
|
70
|
-
/**
|
|
71
|
-
* Called after export completes.
|
|
72
|
-
*/
|
|
73
|
-
afterExport?(canvas: LazyCanvas, result: string | Buffer<ArrayBufferLike> | SKRSContext2D | Canvas | SvgCanvas): void;
|
|
74
|
-
/**
|
|
75
|
-
* Called when canvas is resized.
|
|
76
|
-
*/
|
|
77
|
-
onResize?(canvas: LazyCanvas, ratio: number): void;
|
|
78
|
-
/**
|
|
79
|
-
* Called when a layer is added.
|
|
80
|
-
*/
|
|
81
|
-
onLayerAdded?(canvas: LazyCanvas, layer: AnyLayer | Group): void;
|
|
82
|
-
/**
|
|
83
|
-
* Called when a layer is removed.
|
|
84
|
-
*/
|
|
85
|
-
onLayerRemoved?(canvas: LazyCanvas, layerId: string): void;
|
|
86
|
-
/**
|
|
87
|
-
* Called when canvas is created/recreated.
|
|
88
|
-
*/
|
|
89
|
-
onCanvasCreated?(canvas: LazyCanvas, width: number, height: number): void;
|
|
90
|
-
/**
|
|
91
|
-
* Called when a layer is modified.
|
|
92
|
-
*/
|
|
93
|
-
onLayerModified?(canvas: LazyCanvas, layer: AnyLayer | Group): void;
|
|
94
|
-
/**
|
|
95
|
-
* Called when animation frame is processed.
|
|
96
|
-
*/
|
|
97
|
-
onAnimationFrame?(canvas: LazyCanvas, frame: number): void;
|
|
98
|
-
/**
|
|
99
|
-
* Called when an error occurs.
|
|
100
|
-
*/
|
|
101
|
-
onError?(canvas: LazyCanvas, error: Error): void;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Interface representing the PluginManager.
|
|
105
|
-
*/
|
|
106
|
-
export interface IPluginManager {
|
|
107
|
-
/**
|
|
108
|
-
* A map storing installed plugins with their names as keys.
|
|
109
|
-
*/
|
|
110
|
-
plugins: Map<string, ILazyCanvasPlugin>;
|
|
111
|
-
/**
|
|
112
|
-
* Whether debugging is enabled.
|
|
113
|
-
*/
|
|
114
|
-
debug: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Reference to the LazyCanvas instance.
|
|
117
|
-
*/
|
|
118
|
-
canvas: LazyCanvas;
|
|
119
|
-
/**
|
|
120
|
-
* Registers a plugin.
|
|
121
|
-
* @param plugin - The plugin to register.
|
|
122
|
-
*/
|
|
123
|
-
register(plugin: ILazyCanvasPlugin): void;
|
|
124
|
-
/**
|
|
125
|
-
* Unregisters a plugin by name.
|
|
126
|
-
* @param pluginName - The name of the plugin to unregister.
|
|
127
|
-
* @throws {LazyError} If the plugin is not found or if other plugins depend on it.
|
|
128
|
-
*/
|
|
129
|
-
unregister(pluginName: string): void;
|
|
130
|
-
/**
|
|
131
|
-
* Gets a plugin by name.
|
|
132
|
-
* @param pluginName - The name of the plugin.
|
|
133
|
-
*/
|
|
134
|
-
get(pluginName: string): ILazyCanvasPlugin | undefined;
|
|
135
|
-
/**
|
|
136
|
-
* Lists all registered plugin names.
|
|
137
|
-
*/
|
|
138
|
-
list(): string[];
|
|
139
|
-
/**
|
|
140
|
-
* Checks if a plugin is registered.
|
|
141
|
-
* @param pluginName - The name of the plugin.
|
|
142
|
-
*/
|
|
143
|
-
has(pluginName: string): boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Executes a hook for all plugins that implement it.
|
|
146
|
-
* @param hookName - The name of the hook to execute.
|
|
147
|
-
* @param args - Arguments to pass to the hook.
|
|
148
|
-
*/
|
|
149
|
-
executeHook(hookName: keyof IPluginHooks, ...args: any[]): void;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Class representing a manager for handling plugins.
|
|
153
|
-
*/
|
|
154
|
-
export declare class PluginManager implements IPluginManager {
|
|
155
|
-
/**
|
|
156
|
-
* A map storing installed plugins with their names as keys.
|
|
157
|
-
*/
|
|
158
|
-
plugins: Map<string, ILazyCanvasPlugin>;
|
|
159
|
-
/**
|
|
160
|
-
* Whether debugging is enabled.
|
|
161
|
-
*/
|
|
162
|
-
debug: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Reference to the LazyCanvas instance.
|
|
165
|
-
*/
|
|
166
|
-
canvas: LazyCanvas;
|
|
167
|
-
/**
|
|
168
|
-
* Constructs a new PluginManager instance.
|
|
169
|
-
* @param {LazyCanvas} [canvas] - The LazyCanvas instance.
|
|
170
|
-
* @param {Object} [opts] - Optional settings for the PluginManager.
|
|
171
|
-
* @param {boolean} [opts.debug] - Whether debugging is enabled.
|
|
172
|
-
*/
|
|
173
|
-
constructor(canvas: LazyCanvas, opts?: {
|
|
174
|
-
debug?: boolean;
|
|
175
|
-
});
|
|
176
|
-
/**
|
|
177
|
-
* Registers a plugin.
|
|
178
|
-
* @param {ILazyCanvasPlugin} [plugin] - The plugin to register.
|
|
179
|
-
* @throws {LazyError} If a plugin with the same name is already registered.
|
|
180
|
-
*/
|
|
181
|
-
register(plugin: ILazyCanvasPlugin): void;
|
|
182
|
-
/**
|
|
183
|
-
* Unregisters a plugin by name.
|
|
184
|
-
* @param {string} [pluginName] - The name of the plugin to unregister.
|
|
185
|
-
* @throws {LazyError} If the plugin is not found or if other plugins depend on it.
|
|
186
|
-
*/
|
|
187
|
-
unregister(pluginName: string): void;
|
|
188
|
-
/**
|
|
189
|
-
* Gets a plugin by name.
|
|
190
|
-
* @param {string} [pluginName] - The name of the plugin.
|
|
191
|
-
* @returns The plugin or undefined if not found.
|
|
192
|
-
*/
|
|
193
|
-
get(pluginName: string): ILazyCanvasPlugin | undefined;
|
|
194
|
-
/**
|
|
195
|
-
* Lists all registered plugin names.
|
|
196
|
-
* @returns Array of plugin names.
|
|
197
|
-
*/
|
|
198
|
-
list(): string[];
|
|
199
|
-
/**
|
|
200
|
-
* Checks if a plugin is registered.
|
|
201
|
-
* @param {string} [pluginName] - The name of the plugin.
|
|
202
|
-
* @returns True if the plugin is registered, false otherwise.
|
|
203
|
-
*/
|
|
204
|
-
has(pluginName: string): boolean;
|
|
205
|
-
/**
|
|
206
|
-
* Executes a hook for all plugins that implement it.
|
|
207
|
-
* @param {keyof IPluginHooks} [hookName] - The name of the hook to execute.
|
|
208
|
-
* @param {any} [args] - Arguments to pass to the hook.
|
|
209
|
-
*/
|
|
210
|
-
executeHook(hookName: keyof IPluginHooks, ...args: any[]): void;
|
|
211
|
-
/**
|
|
212
|
-
* Executes the onError hook for all plugins when an error occurs.
|
|
213
|
-
* @param error - The error that occurred.
|
|
214
|
-
*/
|
|
215
|
-
private executeErrorHook;
|
|
216
|
-
/**
|
|
217
|
-
* Gets plugin information.
|
|
218
|
-
* @returns Array of plugin information objects.
|
|
219
|
-
*/
|
|
220
|
-
getPluginInfo(): Array<{
|
|
221
|
-
name: string;
|
|
222
|
-
version: string;
|
|
223
|
-
description?: string;
|
|
224
|
-
dependencies?: string[];
|
|
225
|
-
}>;
|
|
226
|
-
/**
|
|
227
|
-
* Clears all plugins.
|
|
228
|
-
*/
|
|
229
|
-
clear(): void;
|
|
230
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PluginManager = void 0;
|
|
4
|
-
const LazyUtil_1 = require("../../utils/LazyUtil");
|
|
5
|
-
/**
|
|
6
|
-
* Class representing a manager for handling plugins.
|
|
7
|
-
*/
|
|
8
|
-
class PluginManager {
|
|
9
|
-
/**
|
|
10
|
-
* A map storing installed plugins with their names as keys.
|
|
11
|
-
*/
|
|
12
|
-
plugins;
|
|
13
|
-
/**
|
|
14
|
-
* Whether debugging is enabled.
|
|
15
|
-
*/
|
|
16
|
-
debug;
|
|
17
|
-
/**
|
|
18
|
-
* Reference to the LazyCanvas instance.
|
|
19
|
-
*/
|
|
20
|
-
canvas;
|
|
21
|
-
/**
|
|
22
|
-
* Constructs a new PluginManager instance.
|
|
23
|
-
* @param {LazyCanvas} [canvas] - The LazyCanvas instance.
|
|
24
|
-
* @param {Object} [opts] - Optional settings for the PluginManager.
|
|
25
|
-
* @param {boolean} [opts.debug] - Whether debugging is enabled.
|
|
26
|
-
*/
|
|
27
|
-
constructor(canvas, opts) {
|
|
28
|
-
this.plugins = new Map();
|
|
29
|
-
this.debug = opts?.debug || false;
|
|
30
|
-
this.canvas = canvas;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Registers a plugin.
|
|
34
|
-
* @param {ILazyCanvasPlugin} [plugin] - The plugin to register.
|
|
35
|
-
* @throws {LazyError} If a plugin with the same name is already registered.
|
|
36
|
-
*/
|
|
37
|
-
register(plugin) {
|
|
38
|
-
if (this.plugins.has(plugin.name)) {
|
|
39
|
-
throw new LazyUtil_1.LazyError(`Plugin '${plugin.name}' is already registered`);
|
|
40
|
-
}
|
|
41
|
-
// Check dependencies
|
|
42
|
-
if (plugin.dependencies) {
|
|
43
|
-
for (const dependency of plugin.dependencies) {
|
|
44
|
-
if (!this.plugins.has(dependency)) {
|
|
45
|
-
throw new LazyUtil_1.LazyError(`Plugin '${plugin.name}' requires dependency '${dependency}' which is not installed`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const result = plugin.install(this.canvas);
|
|
51
|
-
this.plugins.set(plugin.name, plugin);
|
|
52
|
-
if (this.debug) {
|
|
53
|
-
LazyUtil_1.LazyLog.log('info', `Plugin '${plugin.name}' v${plugin.version} registered successfully`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
throw new LazyUtil_1.LazyError(`Failed to install plugin '${plugin.name}': ${error}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Unregisters a plugin by name.
|
|
62
|
-
* @param {string} [pluginName] - The name of the plugin to unregister.
|
|
63
|
-
* @throws {LazyError} If the plugin is not found or if other plugins depend on it.
|
|
64
|
-
*/
|
|
65
|
-
unregister(pluginName) {
|
|
66
|
-
const plugin = this.plugins.get(pluginName);
|
|
67
|
-
if (!plugin) {
|
|
68
|
-
throw new LazyUtil_1.LazyError(`Plugin '${pluginName}' is not registered`);
|
|
69
|
-
}
|
|
70
|
-
// Check if other plugins depend on this one
|
|
71
|
-
this.plugins.forEach((p, name) => {
|
|
72
|
-
if (name !== pluginName && p.dependencies?.includes(pluginName)) {
|
|
73
|
-
throw new LazyUtil_1.LazyError(`Cannot unregister plugin '${pluginName}' because plugin '${name}' depends on it`);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
try {
|
|
77
|
-
if (plugin.uninstall) {
|
|
78
|
-
plugin.uninstall(this.canvas);
|
|
79
|
-
}
|
|
80
|
-
this.plugins.delete(pluginName);
|
|
81
|
-
if (this.debug) {
|
|
82
|
-
LazyUtil_1.LazyLog.log('info', `Plugin '${pluginName}' unregistered successfully`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
throw new LazyUtil_1.LazyError(`Failed to uninstall plugin '${pluginName}': ${error}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Gets a plugin by name.
|
|
91
|
-
* @param {string} [pluginName] - The name of the plugin.
|
|
92
|
-
* @returns The plugin or undefined if not found.
|
|
93
|
-
*/
|
|
94
|
-
get(pluginName) {
|
|
95
|
-
return this.plugins.get(pluginName);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Lists all registered plugin names.
|
|
99
|
-
* @returns Array of plugin names.
|
|
100
|
-
*/
|
|
101
|
-
list() {
|
|
102
|
-
return Array.from(this.plugins.keys());
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Checks if a plugin is registered.
|
|
106
|
-
* @param {string} [pluginName] - The name of the plugin.
|
|
107
|
-
* @returns True if the plugin is registered, false otherwise.
|
|
108
|
-
*/
|
|
109
|
-
has(pluginName) {
|
|
110
|
-
return this.plugins.has(pluginName);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Executes a hook for all plugins that implement it.
|
|
114
|
-
* @param {keyof IPluginHooks} [hookName] - The name of the hook to execute.
|
|
115
|
-
* @param {any} [args] - Arguments to pass to the hook.
|
|
116
|
-
*/
|
|
117
|
-
executeHook(hookName, ...args) {
|
|
118
|
-
this.plugins.forEach(plugin => {
|
|
119
|
-
try {
|
|
120
|
-
const hook = plugin.hooks?.[hookName];
|
|
121
|
-
if (hook) {
|
|
122
|
-
hook(...args);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
if (this.debug) {
|
|
127
|
-
LazyUtil_1.LazyLog.log('error', `Error executing hook '${hookName}' for plugin '${plugin.name}': ${error}`);
|
|
128
|
-
}
|
|
129
|
-
// Execute onError hook for all plugins when a hook fails
|
|
130
|
-
this.executeErrorHook(error);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Executes the onError hook for all plugins when an error occurs.
|
|
136
|
-
* @param error - The error that occurred.
|
|
137
|
-
*/
|
|
138
|
-
executeErrorHook(error) {
|
|
139
|
-
this.plugins.forEach(plugin => {
|
|
140
|
-
try {
|
|
141
|
-
const errorHook = plugin.hooks?.onError;
|
|
142
|
-
if (errorHook) {
|
|
143
|
-
errorHook(this.canvas, error);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch (hookError) {
|
|
147
|
-
if (this.debug) {
|
|
148
|
-
LazyUtil_1.LazyLog.log('error', `Error in onError hook for plugin '${plugin.name}': ${hookError}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Gets plugin information.
|
|
155
|
-
* @returns Array of plugin information objects.
|
|
156
|
-
*/
|
|
157
|
-
getPluginInfo() {
|
|
158
|
-
return Array.from(this.plugins.values()).map(plugin => ({
|
|
159
|
-
name: plugin.name,
|
|
160
|
-
version: plugin.version,
|
|
161
|
-
description: plugin.description,
|
|
162
|
-
dependencies: plugin.dependencies
|
|
163
|
-
}));
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Clears all plugins.
|
|
167
|
-
*/
|
|
168
|
-
clear() {
|
|
169
|
-
const pluginNames = this.list();
|
|
170
|
-
for (const name of pluginNames) {
|
|
171
|
-
try {
|
|
172
|
-
this.unregister(name);
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
if (this.debug) {
|
|
176
|
-
LazyUtil_1.LazyLog.log('error', `Error unregistering plugin '${name}': ${error}`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
exports.PluginManager = PluginManager;
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { Gradient, Link, Pattern } from "../structures/helpers";
|
|
2
|
-
import {
|
|
3
|
-
MorphLayer,
|
|
4
|
-
ImageLayer,
|
|
5
|
-
TextLayer,
|
|
6
|
-
BezierLayer,
|
|
7
|
-
QuadraticLayer,
|
|
8
|
-
LineLayer,
|
|
9
|
-
ClearLayer,
|
|
10
|
-
Path2DLayer,
|
|
11
|
-
IMorphLayer,
|
|
12
|
-
IBezierLayer,
|
|
13
|
-
IClearLayer,
|
|
14
|
-
IImageLayer,
|
|
15
|
-
ITextLayer,
|
|
16
|
-
IQuadraticLayer,
|
|
17
|
-
ILineLayer,
|
|
18
|
-
IPath2DLayer,
|
|
19
|
-
IPolygonLayer,
|
|
20
|
-
PolygonLayer
|
|
21
|
-
} from "../structures/components";
|
|
22
|
-
import {
|
|
23
|
-
FontWeight,
|
|
24
|
-
GradientType,
|
|
25
|
-
TextAlign,
|
|
26
|
-
TextBaseline,
|
|
27
|
-
TextDirection,
|
|
28
|
-
LineCap,
|
|
29
|
-
LineJoin,
|
|
30
|
-
Export,
|
|
31
|
-
Centring,
|
|
32
|
-
PatternType,
|
|
33
|
-
LinkType,
|
|
34
|
-
GlobalCompositeOperation,
|
|
35
|
-
ColorSpace,
|
|
36
|
-
} from "./enum";
|
|
37
|
-
|
|
38
|
-
export type ScaleType = `link-w-${string}-${number}` | `link-h-${string}-${number}` | `link-x-${string}-${number}` | `link-y-${string}-${number}` | `${number}%` | `${number}px` | number | 'vw' | 'vh' | 'vmin' | 'vmax' | Link;
|
|
39
|
-
|
|
40
|
-
export type StringColorType = `rgba(${number}, ${number}, ${number}, ${number})` | `rgb(${number}, ${number}, ${number})` | `hsl(${number}, ${number}%, ${number}%)` | `hsla(${number}, ${number}%, ${number}%, ${number})` | `#${string}` | string;
|
|
41
|
-
|
|
42
|
-
export type ColorType = Gradient | Pattern | StringColorType;
|
|
43
|
-
|
|
44
|
-
export type JSONLayer = IMorphLayer | IImageLayer | ITextLayer | IBezierLayer | IQuadraticLayer | ILineLayer | IClearLayer | IPath2DLayer | IPolygonLayer;
|
|
45
|
-
|
|
46
|
-
export type AnyLayer = MorphLayer | ImageLayer | TextLayer | BezierLayer | QuadraticLayer | LineLayer | ClearLayer | Path2DLayer | PolygonLayer;
|
|
47
|
-
|
|
48
|
-
export type AnyWeight = FontWeight | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
49
|
-
|
|
50
|
-
export type AnyGradientType = GradientType | 'linear' | 'radial' | 'conic';
|
|
51
|
-
|
|
52
|
-
export type AnyTextAlign = TextAlign | 'left' | 'right' | 'center' | 'start' | 'end';
|
|
53
|
-
|
|
54
|
-
export type AnyTextBaseline = TextBaseline | 'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom';
|
|
55
|
-
|
|
56
|
-
export type AnyTextDirection = TextDirection | 'ltr' | 'rtl' | 'inherit';
|
|
57
|
-
|
|
58
|
-
export type AnyLineCap = LineCap | 'butt' | 'round' | 'square';
|
|
59
|
-
|
|
60
|
-
export type AnyLineJoin = LineJoin | 'bevel' | 'round' | 'miter';
|
|
61
|
-
|
|
62
|
-
export type AnyExport = Export | 'canvas' | 'ctx' | 'buffer' | 'svg' | 'png' | 'jpeg' | 'jpg' | 'gif' | 'webp' | 'yaml' | 'json';
|
|
63
|
-
|
|
64
|
-
export type AnyCentring = Centring | 'start' | 'start-top' | 'start-bottom' | 'center' | 'center-top' | 'center-bottom' | 'end' | 'end-top' | 'end-bottom' | 'none';
|
|
65
|
-
|
|
66
|
-
export type AnyPatternType = PatternType | 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
|
|
67
|
-
|
|
68
|
-
export type AnyLinkType = LinkType | 'width' | 'height' | 'x' | 'y';
|
|
69
|
-
|
|
70
|
-
export type AnyGlobalCompositeOperation = GlobalCompositeOperation | 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
71
|
-
|
|
72
|
-
export type AnyColorSpace = ColorSpace | 'rgb565' | 'rgba4444' | 'rgba444';
|
|
73
|
-
|
|
74
|
-
export type AnyFilter = `sepia(${number}%)` | `saturate(${number}%)` | `opacity(${number}%)` | `invert(${number}%)` | `hue-rotate(${number}deg)` | `grayscale(${number}%)` | `drop-shadow(${number}px ${number}px ${number}px ${string})` | `contrast(${number}%)` | `brightness(${number}%)` | `blur(${number}px)`;
|
|
75
|
-
|
|
76
|
-
export type Point = {
|
|
77
|
-
x: ScaleType;
|
|
78
|
-
y: ScaleType;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export type PointNumber = {
|
|
82
|
-
x: number;
|
|
83
|
-
y: number;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export type Extensions = 'svg' | 'png' | 'jpeg' | 'jpg' | 'gif' | 'webp' | 'yaml' | 'json';
|
|
87
|
-
|
|
88
|
-
export interface Transform {
|
|
89
|
-
rotate: number;
|
|
90
|
-
scale: {
|
|
91
|
-
x: number;
|
|
92
|
-
y: number;
|
|
93
|
-
};
|
|
94
|
-
translate: {
|
|
95
|
-
x: number;
|
|
96
|
-
y: number;
|
|
97
|
-
};
|
|
98
|
-
matrix: DOMMatrix2DInit;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export type RadiusCorner = 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom' | 'all';
|
|
102
|
-
|
|
103
|
-
export type SubStringColor = {
|
|
104
|
-
color: StringColorType;
|
|
105
|
-
start: number;
|
|
106
|
-
end: number;
|
|
107
|
-
}
|