@nmmty/lazycanvas 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/ReadMe.md +1 -0
  2. package/dist/helpers/Filters.d.ts +10 -10
  3. package/dist/helpers/Fonts.d.ts +1 -1
  4. package/dist/helpers/FontsList.d.ts +1 -1
  5. package/dist/helpers/FontsList.js +19 -19
  6. package/dist/index.d.ts +11 -20
  7. package/dist/index.js +40 -47
  8. package/dist/structures/LazyCanvas.d.ts +126 -19
  9. package/dist/structures/LazyCanvas.js +100 -35
  10. package/dist/structures/components/BaseLayer.d.ts +188 -38
  11. package/dist/structures/components/BaseLayer.js +89 -43
  12. package/dist/structures/components/BezierLayer.d.ts +111 -33
  13. package/dist/structures/components/BezierLayer.js +72 -32
  14. package/dist/structures/components/ClearLayer.d.ts +120 -17
  15. package/dist/structures/components/ClearLayer.js +83 -22
  16. package/dist/structures/components/Group.d.ts +88 -20
  17. package/dist/structures/components/Group.js +69 -29
  18. package/dist/structures/components/ImageLayer.d.ts +76 -12
  19. package/dist/structures/components/ImageLayer.js +43 -39
  20. package/dist/structures/components/LineLayer.d.ts +111 -18
  21. package/dist/structures/components/LineLayer.js +57 -29
  22. package/dist/structures/components/MorphLayer.d.ts +109 -21
  23. package/dist/structures/components/MorphLayer.js +52 -33
  24. package/dist/structures/components/Path2DLayer.d.ts +164 -0
  25. package/dist/structures/components/Path2DLayer.js +293 -0
  26. package/dist/structures/components/QuadraticLayer.d.ts +108 -22
  27. package/dist/structures/components/QuadraticLayer.js +64 -38
  28. package/dist/structures/components/TextLayer.d.ts +201 -40
  29. package/dist/structures/components/TextLayer.js +98 -55
  30. package/dist/structures/components/index.d.ts +10 -0
  31. package/dist/structures/components/index.js +26 -0
  32. package/dist/structures/helpers/Exporter.d.ts +52 -0
  33. package/dist/structures/helpers/Exporter.js +168 -0
  34. package/dist/structures/helpers/Font.d.ts +64 -10
  35. package/dist/structures/helpers/Font.js +38 -11
  36. package/dist/structures/helpers/Gradient.d.ts +96 -9
  37. package/dist/structures/helpers/Gradient.js +49 -19
  38. package/dist/structures/helpers/Link.d.ts +52 -8
  39. package/dist/structures/helpers/Link.js +42 -11
  40. package/dist/structures/helpers/Pattern.d.ts +52 -7
  41. package/dist/structures/helpers/Pattern.js +48 -42
  42. package/dist/structures/helpers/index.d.ts +6 -0
  43. package/dist/structures/helpers/index.js +22 -0
  44. package/dist/structures/helpers/readers/JSONReader.d.ts +49 -0
  45. package/dist/structures/helpers/readers/JSONReader.js +172 -0
  46. package/dist/structures/helpers/readers/SVGReader.d.ts +20 -0
  47. package/dist/structures/helpers/readers/SVGReader.js +577 -0
  48. package/dist/structures/helpers/readers/YAMLReader.d.ts +0 -0
  49. package/dist/structures/helpers/readers/YAMLReader.js +1 -0
  50. package/dist/structures/managers/AnimationManager.d.ts +96 -20
  51. package/dist/structures/managers/AnimationManager.js +54 -26
  52. package/dist/structures/managers/FontsManager.d.ts +76 -32
  53. package/dist/structures/managers/FontsManager.js +70 -45
  54. package/dist/structures/managers/LayersManager.d.ts +84 -32
  55. package/dist/structures/managers/LayersManager.js +66 -28
  56. package/dist/structures/managers/RenderManager.d.ts +60 -6
  57. package/dist/structures/managers/RenderManager.js +120 -40
  58. package/dist/types/enum.d.ts +11 -6
  59. package/dist/types/enum.js +17 -12
  60. package/dist/types/index.d.ts +2 -19
  61. package/dist/types/index.js +17 -0
  62. package/dist/utils/LazyUtil.js +2 -2
  63. package/dist/utils/utils.d.ts +9 -11
  64. package/dist/utils/utils.js +163 -234
  65. package/package.json +4 -5
package/ReadMe.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/%40nmmty%2Flazycanvas.svg)](https://www.npmjs.com/package/@nmmty/lazycanvas)
4
4
  [![downloads](https://img.shields.io/npm/dm/%40nmmty%2Flazycanvas.svg)](https://www.npmjs.com/package/@nmmty/lazycanvas)
5
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/NMMTY/LazyCanvas)
5
6
 
6
7
  A simple way to interact with [`@napi-rs/canvas`](https://github.com/Brooooooklyn/canvas) in an advanced way!
7
8
  LazyCanvas provides you with classes and methods to interact with canvas more easily.
@@ -7,19 +7,19 @@ export declare const Filters: {
7
7
  * @param radius {number} - The `radius` of the blur.
8
8
  * @returns {string}
9
9
  */
10
- blur(radius: number): string;
10
+ blur(radius: number): `blur(${number}px)`;
11
11
  /**
12
12
  * @description Adjusts the brightness of the input image. A value of `0%` will create an image that is completely black, while a value of `100%` leaves the input unchanged. If no value is specified, it defaults to `100%`.
13
13
  * @param amount {number} - The `amount` of the brightness.
14
14
  * @returns {string}
15
15
  */
16
- brightness(amount: number): string;
16
+ brightness(amount: number): `brightness(${number}%)`;
17
17
  /**
18
18
  * @description Adjusts the contrast of the input image. A value of `0%` will create an image that is completely black, while a value of `100%` leaves the input unchanged. If no value is specified, it defaults to `100%`.
19
19
  * @param amount {number} - The `amount` of the contrast.
20
20
  * @returns {string}
21
21
  */
22
- contrast(amount: number): string;
22
+ contrast(amount: number): `contrast(${number}%)`;
23
23
  /**
24
24
  * @description Applies a drop shadow effect to the input image. The value of `color` is the color of the shadow. The `offsetX` and `offsetY` values are the horizontal and vertical distances of the shadow, and the `blurRadius` is the amount of blur. If no value is specified, it defaults to `0`.
25
25
  * @param color {string} - The `color` of the shadow.
@@ -28,41 +28,41 @@ export declare const Filters: {
28
28
  * @param blurRadius {number} - The `blurRadius` of the shadow.
29
29
  * @returns {string}
30
30
  */
31
- dropShadow(color: string, offsetX: number, offsetY: number, blurRadius: number): string;
31
+ dropShadow(color: string, offsetX: number, offsetY: number, blurRadius: number): `drop-shadow(${number}px ${number}px ${number}px ${string})`;
32
32
  /**
33
33
  * @description Converts the input image to grayscale. A value of `0%` is completely unmodified, while a value of `100%` will make the image completely grayscale.
34
34
  * @param amount {number} - The `amount` of the grayscale.
35
35
  * @returns {string}
36
36
  */
37
- grayscale(amount: number): string;
37
+ grayscale(amount: number): `grayscale(${number}%)`;
38
38
  /**
39
39
  * @description Applies a hue rotation to the input image. The value of `angle` defines the number of degrees around the color circle the input samples will be adjusted. A value of `0deg` leaves the input unchanged.
40
40
  * @param angle {number} - The `angle` of the hue rotation.
41
41
  * @returns {string}
42
42
  */
43
- hueRotate(angle: number): string;
43
+ hueRotate(angle: number): `hue-rotate(${number}deg)`;
44
44
  /**
45
45
  * @description Inverts the samples in the input image. A value of `0%` leaves the input unchanged, while a value of `100%` is completely inverted.
46
46
  * @param amount {number} - The `amount` of the invert.
47
47
  * @returns {string}
48
48
  */
49
- invert(amount: number): string;
49
+ invert(amount: number): `invert(${number}%)`;
50
50
  /**
51
51
  * @description Sets the opacity of the input image. A value of `0%` is completely transparent, while a value of `100%` is completely opaque.
52
52
  * @param amount {number} - The `amount` of the opacity.
53
53
  * @returns {string}
54
54
  */
55
- opacity(amount: number): string;
55
+ opacity(amount: number): `opacity(${number}%)`;
56
56
  /**
57
57
  * @description Saturates the input image. A value of `0%` is completely unmodified, while a value of `100%` is completely saturated.
58
58
  * @param amount {number} - The `amount` of the saturation.
59
59
  * @returns {string}
60
60
  */
61
- saturate(amount: number): string;
61
+ saturate(amount: number): `saturate(${number}%)`;
62
62
  /**
63
63
  * @description Converts the input image to sepia. A value of `0%` is completely unmodified, while a value of `100%` is completely sepia.
64
64
  * @param amount {number} - The `amount` of the sepia.
65
65
  * @returns {string}
66
66
  */
67
- sepia(amount: number): string;
67
+ sepia(amount: number): `sepia(${number}%)`;
68
68
  };
@@ -1,4 +1,4 @@
1
- import { IFonts } from "../types/helpers/Font";
1
+ import { IFonts } from "../structures/helpers";
2
2
  /**
3
3
  * The bundled fonts in this package.
4
4
  * Used fonts:
@@ -1,4 +1,4 @@
1
- import { FontWeight } from "../types/enum";
1
+ import { FontWeight } from "../types";
2
2
  /**
3
3
  * The bundled fonts in this package.
4
4
  * Used fonts:
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FontsList = void 0;
4
- const enum_1 = require("../types/enum");
4
+ const types_1 = require("../types");
5
5
  /**
6
6
  * The bundled fonts in this package.
7
7
  * Used fonts:
@@ -9,57 +9,57 @@ const enum_1 = require("../types/enum");
9
9
  */
10
10
  exports.FontsList = {
11
11
  Geist_Thin(size) {
12
- return { family: 'Geist', size, weight: enum_1.FontWeight.Thin };
12
+ return { family: 'Geist', size, weight: types_1.FontWeight.Thin };
13
13
  },
14
14
  Geist_ExtraLight(size) {
15
- return { family: 'Geist', size, weight: enum_1.FontWeight.ExtraLight };
15
+ return { family: 'Geist', size, weight: types_1.FontWeight.ExtraLight };
16
16
  },
17
17
  Geist_Light(size) {
18
- return { family: 'Geist', size, weight: enum_1.FontWeight.Light };
18
+ return { family: 'Geist', size, weight: types_1.FontWeight.Light };
19
19
  },
20
20
  Geist_Regular(size) {
21
- return { family: 'Geist', size, weight: enum_1.FontWeight.Regular };
21
+ return { family: 'Geist', size, weight: types_1.FontWeight.Regular };
22
22
  },
23
23
  Geist_Medium(size) {
24
- return { family: 'Geist', size, weight: enum_1.FontWeight.Medium };
24
+ return { family: 'Geist', size, weight: types_1.FontWeight.Medium };
25
25
  },
26
26
  Geist_SemiBold(size) {
27
- return { family: 'Geist', size, weight: enum_1.FontWeight.SemiBold };
27
+ return { family: 'Geist', size, weight: types_1.FontWeight.SemiBold };
28
28
  },
29
29
  Geist_Bold(size) {
30
- return { family: 'Geist', size, weight: enum_1.FontWeight.Bold };
30
+ return { family: 'Geist', size, weight: types_1.FontWeight.Bold };
31
31
  },
32
32
  Geist_ExtraBold(size) {
33
- return { family: 'Geist', size, weight: enum_1.FontWeight.ExtraBold };
33
+ return { family: 'Geist', size, weight: types_1.FontWeight.ExtraBold };
34
34
  },
35
35
  Geist_Black(size) {
36
- return { family: 'Geist', size, weight: enum_1.FontWeight.Black };
36
+ return { family: 'Geist', size, weight: types_1.FontWeight.Black };
37
37
  },
38
38
  GeistMono_Thin(size) {
39
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.Thin };
39
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.Thin };
40
40
  },
41
41
  GeistMono_ExtraLight(size) {
42
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.ExtraLight };
42
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.ExtraLight };
43
43
  },
44
44
  GeistMono_Light(size) {
45
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.Light };
45
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.Light };
46
46
  },
47
47
  GeistMono_Regular(size) {
48
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.Regular };
48
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.Regular };
49
49
  },
50
50
  GeistMono_Medium(size) {
51
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.Medium };
51
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.Medium };
52
52
  },
53
53
  GeistMono_SemiBold(size) {
54
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.SemiBold };
54
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.SemiBold };
55
55
  },
56
56
  GeistMono_Bold(size) {
57
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.Bold };
57
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.Bold };
58
58
  },
59
59
  GeistMono_Black(size) {
60
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.Black };
60
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.Black };
61
61
  },
62
62
  GeistMono_ExtraBlack(size) {
63
- return { family: 'GeistMono', size, weight: enum_1.FontWeight.ExtraBlack };
63
+ return { family: 'GeistMono', size, weight: types_1.FontWeight.ExtraBlack };
64
64
  },
65
65
  };
package/dist/index.d.ts CHANGED
@@ -1,20 +1,11 @@
1
- import { LazyCanvas } from "./structures/LazyCanvas";
2
- import { ImageLayer } from "./structures/components/ImageLayer";
3
- import { MorphLayer } from "./structures/components/MorphLayer";
4
- import { TextLayer } from "./structures/components/TextLayer";
5
- import { BezierLayer } from "./structures/components/BezierLayer";
6
- import { QuadraticLayer } from "./structures/components/QuadraticLayer";
7
- import { LineLayer } from "./structures/components/LineLayer";
8
- import { ClearLayer } from "./structures/components/ClearLayer";
9
- import { BaseLayer } from "./structures/components/BaseLayer";
10
- import { Group } from "./structures/components/Group";
11
- import { LayerType, LayerScaleType, LineCap, LineJoin, TextAlign, TextDirection, TextBaseline, FontWeight, Export, Centring, PatternType, SaveFormat, GradientType, LinkType } from "./types/enum";
12
- import { Font } from "./structures/helpers/Font";
13
- import { Gradient } from "./structures/helpers/Gradient";
14
- import { Pattern } from "./structures/helpers/Pattern";
15
- import { Link } from "./structures/helpers/Link";
16
- import { saveFile } from "./utils/utils";
17
- import { Filters } from "./helpers/Filters";
18
- import { FontsList } from "./helpers/FontsList";
19
- export { LazyCanvas, ImageLayer, MorphLayer, TextLayer, BezierLayer, QuadraticLayer, LineLayer, ClearLayer, BaseLayer, Group, Font, Gradient, Pattern, Link, LayerScaleType, LayerType, FontWeight, GradientType, Export, LineCap, LineJoin, TextAlign, TextDirection, TextBaseline, SaveFormat, Centring, PatternType, LinkType, saveFile, Filters, FontsList, };
20
- export type { AnyLayer, AnyCentring, AnyPatternType, AnyGradientType, AnyTextAlign, AnyTextDirection, AnyTextBaseline, AnyWeight, AnyExport, AnyLineCap, AnyLineJoin, AnySaveFormat, AnyLinkType, AnyGlobalCompositeOperation, AnyColorSpace, ScaleType, ColorType, Point, PointNumber, GradientPoint, GradientColorStop, Transform, ILazyCanvas, IFont, IFonts, IGradient, IPattern, IImageLayer, IImageLayerProps, IMorphLayer, IMorphLayerProps, ITextLayer, ITextLayerProps, IBezierLayer, IBezierLayerProps, IQuadraticLayer, IQuadraticLayerProps, ILineLayer, ILineLayerProps, IBaseLayer, IBaseLayerProps, IGroup, ILink, IFontsManager, ILayersManager, IRenderManager } from "./types";
1
+ export { LazyCanvas, ILazyCanvas, ILazyCanvasOptions, IOLazyCanvas, } from "./structures/LazyCanvas";
2
+ export { IFontsManager } from "./structures/managers/FontsManager";
3
+ export { IAnimationManager, IAnimationOptions } from "./structures/managers/AnimationManager";
4
+ export { IRenderManager } from "./structures/managers/RenderManager";
5
+ export { ILayersManager } from "./structures/managers/LayersManager";
6
+ export * from "./structures/components";
7
+ export { LayerType, LayerScaleType, LineCap, LineJoin, TextAlign, TextDirection, TextBaseline, FontWeight, Export, Centring, PatternType, GradientType, LinkType } from "./types";
8
+ export { Font, IFont, IFonts, Gradient, IGradient, GradientPoint, GradientColorStop, Pattern, IPattern, Link, ILink, Exporter, JSONReader } from "./structures/helpers";
9
+ export { Filters } from "./helpers/Filters";
10
+ export { FontsList } from "./helpers/FontsList";
11
+ export type { AnyLayer, AnyCentring, AnyPatternType, AnyGradientType, AnyTextAlign, AnyTextDirection, AnyTextBaseline, AnyWeight, AnyLineCap, AnyLineJoin, AnyExport, AnyLinkType, AnyGlobalCompositeOperation, AnyColorSpace, ScaleType, ColorType, Point, PointNumber, Transform, Extensions } from "./types";
package/dist/index.js CHANGED
@@ -1,52 +1,45 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FontsList = exports.Filters = exports.saveFile = exports.LinkType = exports.PatternType = exports.Centring = exports.SaveFormat = exports.TextBaseline = exports.TextDirection = exports.TextAlign = exports.LineJoin = exports.LineCap = exports.Export = exports.GradientType = exports.FontWeight = exports.LayerType = exports.LayerScaleType = exports.Link = exports.Pattern = exports.Gradient = exports.Font = exports.Group = exports.BaseLayer = exports.ClearLayer = exports.LineLayer = exports.QuadraticLayer = exports.BezierLayer = exports.TextLayer = exports.MorphLayer = exports.ImageLayer = exports.LazyCanvas = void 0;
4
- const LazyCanvas_1 = require("./structures/LazyCanvas");
17
+ exports.FontsList = exports.Filters = exports.JSONReader = exports.Exporter = exports.Link = exports.Pattern = exports.Gradient = exports.Font = exports.LinkType = exports.GradientType = exports.PatternType = exports.Centring = exports.Export = exports.FontWeight = exports.TextBaseline = exports.TextDirection = exports.TextAlign = exports.LineJoin = exports.LineCap = exports.LayerScaleType = exports.LayerType = exports.LazyCanvas = void 0;
18
+ var LazyCanvas_1 = require("./structures/LazyCanvas");
5
19
  Object.defineProperty(exports, "LazyCanvas", { enumerable: true, get: function () { return LazyCanvas_1.LazyCanvas; } });
6
- const ImageLayer_1 = require("./structures/components/ImageLayer");
7
- Object.defineProperty(exports, "ImageLayer", { enumerable: true, get: function () { return ImageLayer_1.ImageLayer; } });
8
- const MorphLayer_1 = require("./structures/components/MorphLayer");
9
- Object.defineProperty(exports, "MorphLayer", { enumerable: true, get: function () { return MorphLayer_1.MorphLayer; } });
10
- const TextLayer_1 = require("./structures/components/TextLayer");
11
- Object.defineProperty(exports, "TextLayer", { enumerable: true, get: function () { return TextLayer_1.TextLayer; } });
12
- const BezierLayer_1 = require("./structures/components/BezierLayer");
13
- Object.defineProperty(exports, "BezierLayer", { enumerable: true, get: function () { return BezierLayer_1.BezierLayer; } });
14
- const QuadraticLayer_1 = require("./structures/components/QuadraticLayer");
15
- Object.defineProperty(exports, "QuadraticLayer", { enumerable: true, get: function () { return QuadraticLayer_1.QuadraticLayer; } });
16
- const LineLayer_1 = require("./structures/components/LineLayer");
17
- Object.defineProperty(exports, "LineLayer", { enumerable: true, get: function () { return LineLayer_1.LineLayer; } });
18
- const ClearLayer_1 = require("./structures/components/ClearLayer");
19
- Object.defineProperty(exports, "ClearLayer", { enumerable: true, get: function () { return ClearLayer_1.ClearLayer; } });
20
- const BaseLayer_1 = require("./structures/components/BaseLayer");
21
- Object.defineProperty(exports, "BaseLayer", { enumerable: true, get: function () { return BaseLayer_1.BaseLayer; } });
22
- const Group_1 = require("./structures/components/Group");
23
- Object.defineProperty(exports, "Group", { enumerable: true, get: function () { return Group_1.Group; } });
24
- const enum_1 = require("./types/enum");
25
- Object.defineProperty(exports, "LayerType", { enumerable: true, get: function () { return enum_1.LayerType; } });
26
- Object.defineProperty(exports, "LayerScaleType", { enumerable: true, get: function () { return enum_1.LayerScaleType; } });
27
- Object.defineProperty(exports, "LineCap", { enumerable: true, get: function () { return enum_1.LineCap; } });
28
- Object.defineProperty(exports, "LineJoin", { enumerable: true, get: function () { return enum_1.LineJoin; } });
29
- Object.defineProperty(exports, "TextAlign", { enumerable: true, get: function () { return enum_1.TextAlign; } });
30
- Object.defineProperty(exports, "TextDirection", { enumerable: true, get: function () { return enum_1.TextDirection; } });
31
- Object.defineProperty(exports, "TextBaseline", { enumerable: true, get: function () { return enum_1.TextBaseline; } });
32
- Object.defineProperty(exports, "FontWeight", { enumerable: true, get: function () { return enum_1.FontWeight; } });
33
- Object.defineProperty(exports, "Export", { enumerable: true, get: function () { return enum_1.Export; } });
34
- Object.defineProperty(exports, "Centring", { enumerable: true, get: function () { return enum_1.Centring; } });
35
- Object.defineProperty(exports, "PatternType", { enumerable: true, get: function () { return enum_1.PatternType; } });
36
- Object.defineProperty(exports, "SaveFormat", { enumerable: true, get: function () { return enum_1.SaveFormat; } });
37
- Object.defineProperty(exports, "GradientType", { enumerable: true, get: function () { return enum_1.GradientType; } });
38
- Object.defineProperty(exports, "LinkType", { enumerable: true, get: function () { return enum_1.LinkType; } });
39
- const Font_1 = require("./structures/helpers/Font");
40
- Object.defineProperty(exports, "Font", { enumerable: true, get: function () { return Font_1.Font; } });
41
- const Gradient_1 = require("./structures/helpers/Gradient");
42
- Object.defineProperty(exports, "Gradient", { enumerable: true, get: function () { return Gradient_1.Gradient; } });
43
- const Pattern_1 = require("./structures/helpers/Pattern");
44
- Object.defineProperty(exports, "Pattern", { enumerable: true, get: function () { return Pattern_1.Pattern; } });
45
- const Link_1 = require("./structures/helpers/Link");
46
- Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
47
- const utils_1 = require("./utils/utils");
48
- Object.defineProperty(exports, "saveFile", { enumerable: true, get: function () { return utils_1.saveFile; } });
49
- const Filters_1 = require("./helpers/Filters");
20
+ __exportStar(require("./structures/components"), exports);
21
+ var types_1 = require("./types");
22
+ Object.defineProperty(exports, "LayerType", { enumerable: true, get: function () { return types_1.LayerType; } });
23
+ Object.defineProperty(exports, "LayerScaleType", { enumerable: true, get: function () { return types_1.LayerScaleType; } });
24
+ Object.defineProperty(exports, "LineCap", { enumerable: true, get: function () { return types_1.LineCap; } });
25
+ Object.defineProperty(exports, "LineJoin", { enumerable: true, get: function () { return types_1.LineJoin; } });
26
+ Object.defineProperty(exports, "TextAlign", { enumerable: true, get: function () { return types_1.TextAlign; } });
27
+ Object.defineProperty(exports, "TextDirection", { enumerable: true, get: function () { return types_1.TextDirection; } });
28
+ Object.defineProperty(exports, "TextBaseline", { enumerable: true, get: function () { return types_1.TextBaseline; } });
29
+ Object.defineProperty(exports, "FontWeight", { enumerable: true, get: function () { return types_1.FontWeight; } });
30
+ Object.defineProperty(exports, "Export", { enumerable: true, get: function () { return types_1.Export; } });
31
+ Object.defineProperty(exports, "Centring", { enumerable: true, get: function () { return types_1.Centring; } });
32
+ Object.defineProperty(exports, "PatternType", { enumerable: true, get: function () { return types_1.PatternType; } });
33
+ Object.defineProperty(exports, "GradientType", { enumerable: true, get: function () { return types_1.GradientType; } });
34
+ Object.defineProperty(exports, "LinkType", { enumerable: true, get: function () { return types_1.LinkType; } });
35
+ var helpers_1 = require("./structures/helpers");
36
+ Object.defineProperty(exports, "Font", { enumerable: true, get: function () { return helpers_1.Font; } });
37
+ Object.defineProperty(exports, "Gradient", { enumerable: true, get: function () { return helpers_1.Gradient; } });
38
+ Object.defineProperty(exports, "Pattern", { enumerable: true, get: function () { return helpers_1.Pattern; } });
39
+ Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return helpers_1.Link; } });
40
+ Object.defineProperty(exports, "Exporter", { enumerable: true, get: function () { return helpers_1.Exporter; } });
41
+ Object.defineProperty(exports, "JSONReader", { enumerable: true, get: function () { return helpers_1.JSONReader; } });
42
+ var Filters_1 = require("./helpers/Filters");
50
43
  Object.defineProperty(exports, "Filters", { enumerable: true, get: function () { return Filters_1.Filters; } });
51
- const FontsList_1 = require("./helpers/FontsList");
44
+ var FontsList_1 = require("./helpers/FontsList");
52
45
  Object.defineProperty(exports, "FontsList", { enumerable: true, get: function () { return FontsList_1.FontsList; } });
@@ -1,34 +1,141 @@
1
- import { AnyExport, ILazyCanvas } from "../types";
2
- import { Canvas, SKRSContext2D, SvgExportFlag } from "@napi-rs/canvas";
1
+ import { AnyExport, JSONLayer } from "../types";
2
+ import { Canvas, SKRSContext2D, SvgCanvas, SvgExportFlag } from "@napi-rs/canvas";
3
3
  import { LayersManager } from "./managers/LayersManager";
4
4
  import { RenderManager } from "./managers/RenderManager";
5
5
  import { FontsManager } from "./managers/FontsManager";
6
- import { AnimationManager } from "./managers/AnimationManager";
7
- export declare class LazyCanvas implements ILazyCanvas {
8
- width: number | 0;
9
- height: number | 0;
10
- canvas: Canvas;
6
+ import { AnimationManager, IAnimationOptions } from "./managers/AnimationManager";
7
+ import { Group } from "./components";
8
+ /**
9
+ * Interface representing the LazyCanvas structure.
10
+ */
11
+ export interface ILazyCanvas {
12
+ /**
13
+ * The canvas instance, which can be either a Canvas or SvgCanvas.
14
+ */
15
+ canvas: Canvas | SvgCanvas;
16
+ /**
17
+ * The 2D rendering context of the canvas.
18
+ */
11
19
  ctx: SKRSContext2D;
12
- layers: LayersManager;
13
- render: RenderManager;
14
- fonts: FontsManager;
15
- animation: AnimationManager;
20
+ /**
21
+ * The manager object containing various managers for layers, rendering, fonts, and animation.
22
+ */
23
+ manager: {
24
+ layers: LayersManager;
25
+ render: RenderManager;
26
+ fonts: FontsManager;
27
+ animation: AnimationManager;
28
+ };
29
+ /**
30
+ * The options for configuring the LazyCanvas instance.
31
+ */
32
+ options: ILazyCanvasOptions;
33
+ }
34
+ /**
35
+ * Interface representing the options for LazyCanvas.
36
+ */
37
+ export interface ILazyCanvasOptions {
38
+ /**
39
+ * The width of the canvas.
40
+ */
41
+ width: number;
42
+ /**
43
+ * The height of the canvas.
44
+ */
45
+ height: number;
46
+ /**
47
+ * Whether the canvas is animated.
48
+ */
49
+ animated: boolean;
50
+ /**
51
+ * The export type for the canvas (e.g., buffer, SVG, etc.).
52
+ */
16
53
  exportType: AnyExport;
17
- constructor(debug?: boolean);
18
54
  /**
19
- * Set the export type
20
- * @param type {AnyExport} - The `export` type
55
+ * The SVG export flag for encoding paths.
56
+ */
57
+ flag: SvgExportFlag;
58
+ }
59
+ /**
60
+ * Interface representing the input options for LazyCanvas.
61
+ */
62
+ export interface IOLazyCanvas {
63
+ /**
64
+ * The options for configuring the LazyCanvas instance.
65
+ */
66
+ options: ILazyCanvasOptions;
67
+ /**
68
+ * The animation options for the LazyCanvas instance.
69
+ */
70
+ animation: IAnimationOptions;
71
+ /**
72
+ * The layers to be added to the LazyCanvas instance.
73
+ */
74
+ layers: Array<JSONLayer | Group>;
75
+ }
76
+ /**
77
+ * Class representing a LazyCanvas, which provides a structured way to manage canvas rendering.
78
+ */
79
+ export declare class LazyCanvas implements ILazyCanvas {
80
+ /**
81
+ * The canvas instance, which can be either a Canvas or SvgCanvas.
82
+ */
83
+ canvas: Canvas | SvgCanvas;
84
+ /**
85
+ * The 2D rendering context of the canvas.
86
+ */
87
+ ctx: SKRSContext2D;
88
+ /**
89
+ * The manager object containing various managers for layers, rendering, fonts, and animation.
90
+ */
91
+ manager: {
92
+ layers: LayersManager;
93
+ render: RenderManager;
94
+ fonts: FontsManager;
95
+ animation: AnimationManager;
96
+ };
97
+ /**
98
+ * The options for configuring the LazyCanvas instance.
99
+ */
100
+ options: ILazyCanvasOptions;
101
+ /**
102
+ * Constructs a new LazyCanvas instance.
103
+ * @param opts {Object} - Optional settings for the LazyCanvas instance.
104
+ * @param opts.debug {boolean} - Whether debugging is enabled.
105
+ * @param opts.settings {IOLazyCanvas} - The input settings for the LazyCanvas instance.
106
+ */
107
+ constructor(opts?: {
108
+ debug?: boolean;
109
+ settings?: IOLazyCanvas;
110
+ });
111
+ /**
112
+ * Sets the export type for the canvas.
113
+ * @param type {AnyExport} - The export type (e.g., buffer, SVG, etc.).
114
+ * @returns {this} The current instance for chaining.
21
115
  */
22
116
  setExportType(type: AnyExport): this;
23
117
  /**
24
- * Set the SVG export flag. This method should be called after `setExportType` method.
25
- * @param flag {SvgExportFlag} - The `flag` of the SVG export
118
+ * Sets the SVG export flag. This method should be called after `setExportType`.
119
+ * @param flag {SvgExportFlag} - The SVG export flag.
120
+ * @returns {this} The current instance for chaining.
26
121
  */
27
122
  setSvgExportFlag(flag: SvgExportFlag): this;
28
123
  /**
29
- * Create a new canvas. This method should be called before any other methods.
30
- * @param width {number} - The `width` of the canvas
31
- * @param height {number} - The `height` of the canvas
124
+ * Enables animation for the canvas.
125
+ * @returns {this} The current instance for chaining.
126
+ */
127
+ animated(): this;
128
+ /**
129
+ * Resizes the canvas to the specified dimensions.
130
+ * @param ratio {number} - The ratio to resize the canvas.
131
+ * @returns {this} The current instance for chaining.
132
+ */
133
+ resize(ratio: number): this;
134
+ /**
135
+ * Creates a new canvas with the specified dimensions.
136
+ * @param width {number} - The width of the canvas.
137
+ * @param height {number} - The height of the canvas.
138
+ * @returns {this} The current instance for chaining.
32
139
  */
33
140
  create(width: number, height: number): this;
34
141
  }