@nmmty/lazycanvas 0.6.0-dev.1a1f37 → 0.6.0-dev.f33019
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/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/structures/components/BaseLayer.d.ts +3 -2
- package/dist/structures/components/BaseLayer.js +15 -10
- package/dist/structures/components/BezierLayer.d.ts +6 -0
- package/dist/structures/components/BezierLayer.js +23 -4
- package/dist/structures/components/ClearLayer.d.ts +1 -0
- package/dist/structures/components/ClearLayer.js +14 -8
- package/dist/structures/components/ImageLayer.d.ts +6 -0
- package/dist/structures/components/ImageLayer.js +21 -5
- package/dist/structures/components/LineLayer.d.ts +6 -0
- package/dist/structures/components/LineLayer.js +27 -6
- package/dist/structures/components/MorphLayer.d.ts +6 -0
- package/dist/structures/components/MorphLayer.js +25 -6
- package/dist/structures/components/Path2DLayer.d.ts +6 -0
- package/dist/structures/components/Path2DLayer.js +23 -1
- package/dist/structures/components/QuadraticLayer.d.ts +6 -0
- package/dist/structures/components/QuadraticLayer.js +23 -4
- package/dist/structures/components/TextLayer.d.ts +11 -5
- package/dist/structures/components/TextLayer.js +35 -23
- package/dist/structures/helpers/Gradient.d.ts +48 -11
- package/dist/structures/helpers/Gradient.js +133 -8
- package/dist/structures/helpers/index.d.ts +1 -0
- package/dist/structures/helpers/index.js +1 -0
- package/dist/structures/helpers/readers/JSONReader.js +3 -3
- package/dist/structures/helpers/readers/YAMLReader.d.ts +22 -0
- package/dist/structures/helpers/readers/YAMLReader.js +73 -0
- package/dist/utils/utils.d.ts +13 -3
- package/dist/utils/utils.js +10 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { IRenderManager } from "./structures/managers/RenderManager";
|
|
|
5
5
|
export { ILayersManager } from "./structures/managers/LayersManager";
|
|
6
6
|
export * from "./structures/components";
|
|
7
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";
|
|
8
|
+
export { Font, IFont, IFonts, Gradient, IGradient, GradientPoint, GradientColorStop, Pattern, IPattern, Link, ILink, Exporter, JSONReader, YAMLReader } from "./structures/helpers";
|
|
9
9
|
export { Filters } from "./helpers/Filters";
|
|
10
10
|
export { FontsList } from "./helpers/FontsList";
|
|
11
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
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
17
|
+
exports.FontsList = exports.Filters = exports.YAMLReader = 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
18
|
var LazyCanvas_1 = require("./structures/LazyCanvas");
|
|
19
19
|
Object.defineProperty(exports, "LazyCanvas", { enumerable: true, get: function () { return LazyCanvas_1.LazyCanvas; } });
|
|
20
20
|
__exportStar(require("./structures/components"), exports);
|
|
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "Pattern", { enumerable: true, get: function () {
|
|
|
39
39
|
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return helpers_1.Link; } });
|
|
40
40
|
Object.defineProperty(exports, "Exporter", { enumerable: true, get: function () { return helpers_1.Exporter; } });
|
|
41
41
|
Object.defineProperty(exports, "JSONReader", { enumerable: true, get: function () { return helpers_1.JSONReader; } });
|
|
42
|
+
Object.defineProperty(exports, "YAMLReader", { enumerable: true, get: function () { return helpers_1.YAMLReader; } });
|
|
42
43
|
var Filters_1 = require("./helpers/Filters");
|
|
43
44
|
Object.defineProperty(exports, "Filters", { enumerable: true, get: function () { return Filters_1.Filters; } });
|
|
44
45
|
var FontsList_1 = require("./helpers/FontsList");
|
|
@@ -43,7 +43,7 @@ export interface IBaseLayerProps {
|
|
|
43
43
|
/**
|
|
44
44
|
* The filter effects applied to the layer.
|
|
45
45
|
*/
|
|
46
|
-
filter
|
|
46
|
+
filter?: string;
|
|
47
47
|
/**
|
|
48
48
|
* The opacity of the layer, ranging from 0 to 1.
|
|
49
49
|
*/
|
|
@@ -59,7 +59,7 @@ export interface IBaseLayerProps {
|
|
|
59
59
|
/**
|
|
60
60
|
* The shadow properties of the layer.
|
|
61
61
|
*/
|
|
62
|
-
shadow
|
|
62
|
+
shadow?: {
|
|
63
63
|
/**
|
|
64
64
|
* The color of the shadow.
|
|
65
65
|
*/
|
|
@@ -233,4 +233,5 @@ export declare class BaseLayer<T extends IBaseLayerProps> {
|
|
|
233
233
|
* @returns {IBaseLayer} The JSON representation of the layer.
|
|
234
234
|
*/
|
|
235
235
|
toJSON(): IBaseLayer;
|
|
236
|
+
protected validateProps(data: T): T;
|
|
236
237
|
}
|
|
@@ -48,16 +48,7 @@ class BaseLayer {
|
|
|
48
48
|
this.zIndex = misc?.zIndex || 1;
|
|
49
49
|
this.visible = misc?.visible || true;
|
|
50
50
|
this.props = props ? props : {};
|
|
51
|
-
|
|
52
|
-
this.props.x = 0;
|
|
53
|
-
if (!this.props.y)
|
|
54
|
-
this.props.y = 0;
|
|
55
|
-
if (!this.props.opacity)
|
|
56
|
-
this.props.opacity = 1;
|
|
57
|
-
if (!this.props.centring)
|
|
58
|
-
this.props.centring = types_1.Centring.Center;
|
|
59
|
-
if (!this.props.transform)
|
|
60
|
-
this.props.transform = {};
|
|
51
|
+
this.props = this.validateProps(this.props);
|
|
61
52
|
}
|
|
62
53
|
/**
|
|
63
54
|
* Sets the position of the layer in the 2D plane.
|
|
@@ -207,5 +198,19 @@ class BaseLayer {
|
|
|
207
198
|
props: this.props,
|
|
208
199
|
};
|
|
209
200
|
}
|
|
201
|
+
validateProps(data) {
|
|
202
|
+
return {
|
|
203
|
+
...data,
|
|
204
|
+
x: data.x || 0,
|
|
205
|
+
y: data.y || 0,
|
|
206
|
+
centring: data.centring || types_1.Centring.Center,
|
|
207
|
+
filter: data.filter || '',
|
|
208
|
+
opacity: data.opacity || 1,
|
|
209
|
+
filled: data.filled || false,
|
|
210
|
+
fillStyle: data.fillStyle || '#000000',
|
|
211
|
+
transform: data.transform || {},
|
|
212
|
+
globalComposite: data.globalComposite || 'source-over',
|
|
213
|
+
};
|
|
214
|
+
}
|
|
210
215
|
}
|
|
211
216
|
exports.BaseLayer = BaseLayer;
|
|
@@ -133,4 +133,10 @@ export declare class BezierLayer extends BaseLayer<IBezierLayerProps> {
|
|
|
133
133
|
* @returns {IBezierLayer} The JSON representation of the Bezier layer.
|
|
134
134
|
*/
|
|
135
135
|
toJSON(): IBezierLayer;
|
|
136
|
+
/**
|
|
137
|
+
* Validates the properties of the Bezier layer.
|
|
138
|
+
* @param data {IBezierLayerProps} - The properties to validate.
|
|
139
|
+
* @returns {IBezierLayerProps} The validated properties.
|
|
140
|
+
*/
|
|
141
|
+
protected validateProps(data: IBezierLayerProps): IBezierLayerProps;
|
|
136
142
|
}
|
|
@@ -21,9 +21,7 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
21
21
|
constructor(props, misc) {
|
|
22
22
|
super(types_1.LayerType.BezierCurve, props || {}, misc);
|
|
23
23
|
this.props = props ? props : {};
|
|
24
|
-
|
|
25
|
-
this.props.fillStyle = '#000000';
|
|
26
|
-
this.props.centring = types_1.Centring.None;
|
|
24
|
+
this.props = this.validateProps(this.props);
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
29
27
|
* Sets the control points of the Bezier layer.
|
|
@@ -124,7 +122,7 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
124
122
|
ye: { v: this.props.endPoint.y, options: LazyUtil_1.defaultArg.vl(true) }
|
|
125
123
|
});
|
|
126
124
|
const { max, min, center, width, height } = (0, utils_1.getBoundingBoxBezier)([{ x: xs, y: ys }, { x: cp1x, y: cp1y }, { x: cp2x, y: cp2y }, { x: xe, y: ye }]);
|
|
127
|
-
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
125
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle, { debug, layer: { width, height, x: min.x, y: min.y, align: 'none' }, manager });
|
|
128
126
|
if (debug)
|
|
129
127
|
LazyUtil_1.LazyLog.log('none', `BezierLayer:`, { xs, ys, cp1x, cp1y, cp2x, cp2y, xe, ye, max, min, center, width, height, fillStyle });
|
|
130
128
|
ctx.save();
|
|
@@ -173,5 +171,26 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
173
171
|
}
|
|
174
172
|
return { ...data, props: copy };
|
|
175
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Validates the properties of the Bezier layer.
|
|
176
|
+
* @param data {IBezierLayerProps} - The properties to validate.
|
|
177
|
+
* @returns {IBezierLayerProps} The validated properties.
|
|
178
|
+
*/
|
|
179
|
+
validateProps(data) {
|
|
180
|
+
return {
|
|
181
|
+
...super.validateProps(data),
|
|
182
|
+
centring: data.centring || types_1.Centring.None,
|
|
183
|
+
controlPoints: data.controlPoints || [{ x: 0, y: 0 }, { x: 0, y: 0 }],
|
|
184
|
+
endPoint: data.endPoint || { x: 0, y: 0 },
|
|
185
|
+
stroke: {
|
|
186
|
+
width: data.stroke?.width || 1,
|
|
187
|
+
cap: data.stroke?.cap || 'butt',
|
|
188
|
+
join: data.stroke?.join || 'miter',
|
|
189
|
+
dashOffset: data.stroke?.dashOffset || 0,
|
|
190
|
+
dash: data.stroke?.dash || [],
|
|
191
|
+
miterLimit: data.stroke?.miterLimit || 10,
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
176
195
|
}
|
|
177
196
|
exports.BezierLayer = BezierLayer;
|
|
@@ -39,14 +39,8 @@ class ClearLayer {
|
|
|
39
39
|
this.type = types_1.LayerType.Clear;
|
|
40
40
|
this.zIndex = misc?.zIndex || 1;
|
|
41
41
|
this.visible = misc?.visible || true;
|
|
42
|
-
this.props = props ? props : {
|
|
43
|
-
|
|
44
|
-
y: 0,
|
|
45
|
-
size: {
|
|
46
|
-
width: 0,
|
|
47
|
-
height: 0
|
|
48
|
-
}
|
|
49
|
-
};
|
|
42
|
+
this.props = props ? props : {};
|
|
43
|
+
this.props = this.validateProps(this.props);
|
|
50
44
|
}
|
|
51
45
|
/**
|
|
52
46
|
* Sets the position of the layer in the 2D plane.
|
|
@@ -148,5 +142,17 @@ class ClearLayer {
|
|
|
148
142
|
props: copy,
|
|
149
143
|
};
|
|
150
144
|
}
|
|
145
|
+
validateProps(props) {
|
|
146
|
+
return {
|
|
147
|
+
x: props.x || 0,
|
|
148
|
+
y: props.y || 0,
|
|
149
|
+
size: {
|
|
150
|
+
width: props.size?.width || 0,
|
|
151
|
+
height: props.size?.height || 0
|
|
152
|
+
},
|
|
153
|
+
centring: props.centring || 'none',
|
|
154
|
+
globalComposite: props.globalComposite || 'source-over'
|
|
155
|
+
};
|
|
156
|
+
}
|
|
151
157
|
}
|
|
152
158
|
exports.ClearLayer = ClearLayer;
|
|
@@ -90,4 +90,10 @@ export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
|
|
|
90
90
|
* @returns {IImageLayer} The JSON representation of the Image Layer.
|
|
91
91
|
*/
|
|
92
92
|
toJSON(): IImageLayer;
|
|
93
|
+
/**
|
|
94
|
+
* Validates the properties of the Image Layer.
|
|
95
|
+
* @param data {IImageLayerProps} - The properties to validate.
|
|
96
|
+
* @returns {IImageLayerProps} The validated properties.
|
|
97
|
+
*/
|
|
98
|
+
protected validateProps(data: IImageLayerProps): IImageLayerProps;
|
|
93
99
|
}
|
|
@@ -23,7 +23,7 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
23
23
|
constructor(props, misc) {
|
|
24
24
|
super(types_1.LayerType.Image, props || {}, misc);
|
|
25
25
|
this.props = props ? props : {};
|
|
26
|
-
this.props
|
|
26
|
+
this.props = this.validateProps(this.props);
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Sets the source of the image.
|
|
@@ -79,15 +79,15 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
79
79
|
if (debug)
|
|
80
80
|
LazyUtil_1.LazyLog.log('none', `ImageLayer:`, { x, y, w, h, rad });
|
|
81
81
|
ctx.save();
|
|
82
|
-
(0, utils_1.transform)(ctx, this.props.transform, { width: w, height: h, x, y, type: this.type });
|
|
83
|
-
(0, utils_1.drawShadow)(ctx, this.props.shadow);
|
|
84
|
-
(0, utils_1.opacity)(ctx, this.props.opacity);
|
|
85
|
-
(0, utils_1.filters)(ctx, this.props.filter);
|
|
86
82
|
let image = await (0, canvas_1.loadImage)(this.props.src);
|
|
87
83
|
image.width = w;
|
|
88
84
|
image.height = h;
|
|
89
85
|
if (!image)
|
|
90
86
|
throw new LazyUtil_1.LazyError('The image could not be loaded');
|
|
87
|
+
(0, utils_1.transform)(ctx, this.props.transform, { width: w, height: h, x, y, type: this.type });
|
|
88
|
+
(0, utils_1.drawShadow)(ctx, this.props.shadow);
|
|
89
|
+
(0, utils_1.opacity)(ctx, this.props.opacity);
|
|
90
|
+
(0, utils_1.filters)(ctx, this.props.filter);
|
|
91
91
|
if (Object.keys(rad).length > 0) {
|
|
92
92
|
ctx.beginPath();
|
|
93
93
|
ctx.moveTo(x + (w / 2), y);
|
|
@@ -118,5 +118,21 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
118
118
|
}
|
|
119
119
|
return { ...data };
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Validates the properties of the Image Layer.
|
|
123
|
+
* @param data {IImageLayerProps} - The properties to validate.
|
|
124
|
+
* @returns {IImageLayerProps} The validated properties.
|
|
125
|
+
*/
|
|
126
|
+
validateProps(data) {
|
|
127
|
+
return {
|
|
128
|
+
...super.validateProps(data),
|
|
129
|
+
src: data.src || '',
|
|
130
|
+
size: {
|
|
131
|
+
width: data.size?.width || 0,
|
|
132
|
+
height: data.size?.height || 0,
|
|
133
|
+
radius: data.size?.radius || { all: 0 }
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
121
137
|
}
|
|
122
138
|
exports.ImageLayer = ImageLayer;
|
|
@@ -129,4 +129,10 @@ export declare class LineLayer extends BaseLayer<ILineLayerProps> {
|
|
|
129
129
|
* @returns {ILineLayer} The JSON representation of the Line Layer.
|
|
130
130
|
*/
|
|
131
131
|
toJSON(): ILineLayer;
|
|
132
|
+
/**
|
|
133
|
+
* Validates the properties of the Line Layer.
|
|
134
|
+
* @param data {ILineLayerProps} - The properties to validate.
|
|
135
|
+
* @returns {ILineLayerProps} The validated properties.
|
|
136
|
+
*/
|
|
137
|
+
protected validateProps(data: ILineLayerProps): ILineLayerProps;
|
|
132
138
|
}
|
|
@@ -21,9 +21,7 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
21
21
|
constructor(props, misc) {
|
|
22
22
|
super(types_1.LayerType.Line, props || {}, misc);
|
|
23
23
|
this.props = props ? props : {};
|
|
24
|
-
|
|
25
|
-
this.props.fillStyle = '#000000';
|
|
26
|
-
this.props.centring = types_1.Centring.None;
|
|
24
|
+
this.props = this.validateProps(this.props);
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
29
27
|
* Sets the end position of the line layer.
|
|
@@ -104,9 +102,9 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
104
102
|
xe: { v: this.props.endPoint.x },
|
|
105
103
|
ye: { v: this.props.endPoint.y, options: LazyUtil_1.defaultArg.vl(true) },
|
|
106
104
|
});
|
|
107
|
-
let width = xe - xs;
|
|
108
|
-
let height = ye - ys;
|
|
109
|
-
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
105
|
+
let width = Math.abs(xe - xs);
|
|
106
|
+
let height = Math.abs(ye - ys);
|
|
107
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle, { debug, layer: { width, height, x: Math.min(xs, xe), y: Math.min(ys, ye), align: 'none' }, manager });
|
|
110
108
|
if (debug)
|
|
111
109
|
LazyUtil_1.LazyLog.log('none', `LineLayer:`, { xs, ys, xe, ye, width, height });
|
|
112
110
|
ctx.save();
|
|
@@ -142,5 +140,28 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
142
140
|
}
|
|
143
141
|
return { ...data, props: copy };
|
|
144
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Validates the properties of the Line Layer.
|
|
145
|
+
* @param data {ILineLayerProps} - The properties to validate.
|
|
146
|
+
* @returns {ILineLayerProps} The validated properties.
|
|
147
|
+
*/
|
|
148
|
+
validateProps(data) {
|
|
149
|
+
return {
|
|
150
|
+
...super.validateProps(data),
|
|
151
|
+
centring: data.centring || types_1.Centring.None,
|
|
152
|
+
endPoint: {
|
|
153
|
+
x: data.endPoint?.x || 0,
|
|
154
|
+
y: data.endPoint?.y || 0,
|
|
155
|
+
},
|
|
156
|
+
stroke: {
|
|
157
|
+
width: data.stroke?.width || 1,
|
|
158
|
+
cap: data.stroke?.cap || 'butt',
|
|
159
|
+
join: data.stroke?.join || 'miter',
|
|
160
|
+
dashOffset: data.stroke?.dashOffset || 0,
|
|
161
|
+
dash: data.stroke?.dash || [],
|
|
162
|
+
miterLimit: data.stroke?.miterLimit || 10,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
145
166
|
}
|
|
146
167
|
exports.LineLayer = LineLayer;
|
|
@@ -129,4 +129,10 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
|
|
|
129
129
|
* @returns {IMorphLayer} The JSON representation of the Morph Layer.
|
|
130
130
|
*/
|
|
131
131
|
toJSON(): IMorphLayer;
|
|
132
|
+
/**
|
|
133
|
+
* Validates the properties of the Morph Layer.
|
|
134
|
+
* @param data {IMorphLayerProps} - The properties to validate.
|
|
135
|
+
* @returns {IMorphLayerProps} The validated properties.
|
|
136
|
+
*/
|
|
137
|
+
protected validateProps(data: IMorphLayerProps): IMorphLayerProps;
|
|
132
138
|
}
|
|
@@ -22,11 +22,7 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
22
22
|
constructor(props, misc) {
|
|
23
23
|
super(types_1.LayerType.Morph, props || {}, misc);
|
|
24
24
|
this.props = props ? props : {};
|
|
25
|
-
|
|
26
|
-
this.props.fillStyle = '#000000';
|
|
27
|
-
if (!this.props.filled && this.props.filled !== false)
|
|
28
|
-
this.props.filled = true;
|
|
29
|
-
this.props.centring = types_1.Centring.Center;
|
|
25
|
+
this.props = this.validateProps(this.props);
|
|
30
26
|
}
|
|
31
27
|
/**
|
|
32
28
|
* Sets the size of the Morph Layer.
|
|
@@ -110,7 +106,7 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
110
106
|
}
|
|
111
107
|
}
|
|
112
108
|
let { x, y } = (0, utils_1.centring)(this.props.centring, this.type, w, h, xs, ys);
|
|
113
|
-
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
109
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle, { debug, layer: { width: w, height: h, x: xs, y: ys, align: this.props.centring }, manager });
|
|
114
110
|
if (debug)
|
|
115
111
|
LazyUtil_1.LazyLog.log('none', `MorphLayer:`, { x, y, w, h, rad });
|
|
116
112
|
ctx.save();
|
|
@@ -160,5 +156,28 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
160
156
|
}
|
|
161
157
|
return { ...data, props: copy };
|
|
162
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Validates the properties of the Morph Layer.
|
|
161
|
+
* @param data {IMorphLayerProps} - The properties to validate.
|
|
162
|
+
* @returns {IMorphLayerProps} The validated properties.
|
|
163
|
+
*/
|
|
164
|
+
validateProps(data) {
|
|
165
|
+
return {
|
|
166
|
+
...super.validateProps(data),
|
|
167
|
+
size: {
|
|
168
|
+
width: data.size?.width || 100,
|
|
169
|
+
height: data.size?.height || 100,
|
|
170
|
+
radius: data.size?.radius || { all: 0 },
|
|
171
|
+
},
|
|
172
|
+
stroke: {
|
|
173
|
+
width: data.stroke?.width || 1,
|
|
174
|
+
cap: data.stroke?.cap || 'butt',
|
|
175
|
+
join: data.stroke?.join || 'miter',
|
|
176
|
+
dashOffset: data.stroke?.dashOffset || 0,
|
|
177
|
+
dash: data.stroke?.dash || [],
|
|
178
|
+
miterLimit: data.stroke?.miterLimit || 10,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
163
182
|
}
|
|
164
183
|
exports.MorphLayer = MorphLayer;
|
|
@@ -161,4 +161,10 @@ export declare class Path2DLayer extends BaseLayer<IPath2DLayerProps> {
|
|
|
161
161
|
* @returns {IPath2DLayer} The JSON representation of the Path2D Layer.
|
|
162
162
|
*/
|
|
163
163
|
toJSON(): IPath2DLayer;
|
|
164
|
+
/**
|
|
165
|
+
* Validates the properties of the Path2D Layer.
|
|
166
|
+
* @param data {IPath2DLayerProps} - The properties to validate.
|
|
167
|
+
* @returns {IPath2DLayerProps} The validated properties.
|
|
168
|
+
*/
|
|
169
|
+
protected validateProps(data: IPath2DLayerProps): IPath2DLayerProps;
|
|
164
170
|
}
|
|
@@ -18,6 +18,7 @@ class Path2DLayer extends BaseLayer_1.BaseLayer {
|
|
|
18
18
|
this.zIndex = misc?.zIndex || 1;
|
|
19
19
|
this.visible = misc?.visible || true;
|
|
20
20
|
this.props = props ? props : {};
|
|
21
|
+
this.props = this.validateProps(this.props);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Sets the unique identifier of the layer.
|
|
@@ -252,7 +253,7 @@ class Path2DLayer extends BaseLayer_1.BaseLayer {
|
|
|
252
253
|
async draw(ctx, canvas, manager, debug) {
|
|
253
254
|
ctx.beginPath();
|
|
254
255
|
ctx.save();
|
|
255
|
-
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
256
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle, { debug, manager });
|
|
256
257
|
(0, utils_1.transform)(ctx, this.props.transform, { width: 0, height: 0, x: 0, y: 0, type: this.type });
|
|
257
258
|
(0, utils_1.opacity)(ctx, this.props.opacity);
|
|
258
259
|
ctx.globalCompositeOperation = this.props.globalComposite;
|
|
@@ -289,5 +290,26 @@ class Path2DLayer extends BaseLayer_1.BaseLayer {
|
|
|
289
290
|
props: this.props
|
|
290
291
|
};
|
|
291
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Validates the properties of the Path2D Layer.
|
|
295
|
+
* @param data {IPath2DLayerProps} - The properties to validate.
|
|
296
|
+
* @returns {IPath2DLayerProps} The validated properties.
|
|
297
|
+
*/
|
|
298
|
+
validateProps(data) {
|
|
299
|
+
return {
|
|
300
|
+
...super.validateProps(data),
|
|
301
|
+
path2D: data.path2D || new canvas_1.Path2D(),
|
|
302
|
+
stroke: {
|
|
303
|
+
width: data.stroke?.width || 1,
|
|
304
|
+
cap: data.stroke?.cap || 'butt',
|
|
305
|
+
join: data.stroke?.join || 'miter',
|
|
306
|
+
dashOffset: data.stroke?.dashOffset || 0,
|
|
307
|
+
dash: data.stroke?.dash || [],
|
|
308
|
+
miterLimit: data.stroke?.miterLimit || 10
|
|
309
|
+
},
|
|
310
|
+
loadFromSVG: data.loadFromSVG || false,
|
|
311
|
+
clipPath: data.clipPath || false
|
|
312
|
+
};
|
|
313
|
+
}
|
|
292
314
|
}
|
|
293
315
|
exports.Path2DLayer = Path2DLayer;
|
|
@@ -139,4 +139,10 @@ export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
|
|
|
139
139
|
* @returns {IQuadraticLayer} The JSON representation of the Quadratic Layer.
|
|
140
140
|
*/
|
|
141
141
|
toJSON(): IQuadraticLayer;
|
|
142
|
+
/**
|
|
143
|
+
* Validates the properties of the Quadratic Layer.
|
|
144
|
+
* @param data {IQuadraticLayerProps} - The properties to validate.
|
|
145
|
+
* @returns {IQuadraticLayerProps} The validated properties.
|
|
146
|
+
*/
|
|
147
|
+
protected validateProps(data: IQuadraticLayerProps): IQuadraticLayerProps;
|
|
142
148
|
}
|
|
@@ -21,9 +21,7 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
21
21
|
constructor(props, misc) {
|
|
22
22
|
super(types_1.LayerType.QuadraticCurve, props || {}, misc);
|
|
23
23
|
this.props = props ? props : {};
|
|
24
|
-
|
|
25
|
-
this.props.fillStyle = '#000000';
|
|
26
|
-
this.props.centring = types_1.Centring.None;
|
|
24
|
+
this.props = this.validateProps(this.props);
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
29
27
|
* Sets the control point of the quadratic layer.
|
|
@@ -118,7 +116,7 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
118
116
|
ye: { v: this.props.endPoint.y, options: LazyUtil_1.defaultArg.vl(true) }
|
|
119
117
|
});
|
|
120
118
|
const { max, min, center, width, height } = (0, utils_1.getBoundingBoxBezier)([{ x: xs, y: ys }, { x: cx, y: cy }, { x: xe, y: ye }]);
|
|
121
|
-
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
119
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle, { debug, layer: { width, height, x: min.x, y: min.y, align: 'none' }, manager });
|
|
122
120
|
if (debug)
|
|
123
121
|
LazyUtil_1.LazyLog.log('none', `BezierLayer:`, { xs, ys, cx, cy, xe, ye, max, min, center, width, height, fillStyle });
|
|
124
122
|
ctx.save();
|
|
@@ -154,5 +152,26 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
154
152
|
}
|
|
155
153
|
return { ...data, props: copy };
|
|
156
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Validates the properties of the Quadratic Layer.
|
|
157
|
+
* @param data {IQuadraticLayerProps} - The properties to validate.
|
|
158
|
+
* @returns {IQuadraticLayerProps} The validated properties.
|
|
159
|
+
*/
|
|
160
|
+
validateProps(data) {
|
|
161
|
+
return {
|
|
162
|
+
...super.validateProps(data),
|
|
163
|
+
centring: data.centring || types_1.Centring.None,
|
|
164
|
+
controlPoints: data.controlPoints || [{ x: 0, y: 0 }],
|
|
165
|
+
endPoint: data.endPoint || { x: 0, y: 0 },
|
|
166
|
+
stroke: {
|
|
167
|
+
width: data.stroke?.width || 1,
|
|
168
|
+
cap: data.stroke?.cap || 'butt',
|
|
169
|
+
join: data.stroke?.join || 'miter',
|
|
170
|
+
dashOffset: data.stroke?.dashOffset || 0,
|
|
171
|
+
dash: data.stroke?.dash || [],
|
|
172
|
+
miterLimit: data.stroke?.miterLimit || 10,
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
157
176
|
}
|
|
158
177
|
exports.QuadraticLayer = QuadraticLayer;
|
|
@@ -73,23 +73,23 @@ export interface ITextLayerProps extends IBaseLayerProps {
|
|
|
73
73
|
/**
|
|
74
74
|
* The baseline of the text.
|
|
75
75
|
*/
|
|
76
|
-
baseline
|
|
76
|
+
baseline?: AnyTextBaseline;
|
|
77
77
|
/**
|
|
78
78
|
* The direction of the text.
|
|
79
79
|
*/
|
|
80
|
-
direction
|
|
80
|
+
direction?: AnyTextDirection;
|
|
81
81
|
/**
|
|
82
82
|
* The spacing between letters.
|
|
83
83
|
*/
|
|
84
|
-
letterSpacing
|
|
84
|
+
letterSpacing?: number;
|
|
85
85
|
/**
|
|
86
86
|
* The spacing between words.
|
|
87
87
|
*/
|
|
88
|
-
wordSpacing
|
|
88
|
+
wordSpacing?: number;
|
|
89
89
|
/**
|
|
90
90
|
* The stroke properties of the text.
|
|
91
91
|
*/
|
|
92
|
-
stroke
|
|
92
|
+
stroke?: {
|
|
93
93
|
/**
|
|
94
94
|
* The width of the stroke.
|
|
95
95
|
*/
|
|
@@ -246,4 +246,10 @@ export declare class TextLayer extends BaseLayer<ITextLayerProps> {
|
|
|
246
246
|
* @returns {ITextLayer} The JSON representation of the Text Layer.
|
|
247
247
|
*/
|
|
248
248
|
toJSON(): ITextLayer;
|
|
249
|
+
/**
|
|
250
|
+
* Validates the properties of the Text Layer.
|
|
251
|
+
* @param props {ITextLayerProps} - The properties to validate.
|
|
252
|
+
* @returns {ITextLayerProps} The validated properties.
|
|
253
|
+
*/
|
|
254
|
+
protected validateProps(props: ITextLayerProps): ITextLayerProps;
|
|
249
255
|
}
|
|
@@ -21,25 +21,7 @@ class TextLayer extends BaseLayer_1.BaseLayer {
|
|
|
21
21
|
constructor(props, misc) {
|
|
22
22
|
super(types_1.LayerType.Text, props || {}, misc);
|
|
23
23
|
this.props = props ? props : {};
|
|
24
|
-
this.props
|
|
25
|
-
this.props.font = {
|
|
26
|
-
family: 'Geist',
|
|
27
|
-
size: 16,
|
|
28
|
-
weight: types_1.FontWeight.Regular,
|
|
29
|
-
};
|
|
30
|
-
this.props.fillStyle = '#ffffff';
|
|
31
|
-
this.props.filled = true;
|
|
32
|
-
this.props.multiline = {
|
|
33
|
-
enabled: false,
|
|
34
|
-
spacing: 1.1,
|
|
35
|
-
};
|
|
36
|
-
this.props.size = {
|
|
37
|
-
width: 'vw',
|
|
38
|
-
height: 0,
|
|
39
|
-
};
|
|
40
|
-
this.props.centring = types_1.Centring.Center;
|
|
41
|
-
this.props.wordSpacing = 0;
|
|
42
|
-
this.props.letterSpacing = 0;
|
|
24
|
+
this.props = this.validateProps(this.props);
|
|
43
25
|
}
|
|
44
26
|
/**
|
|
45
27
|
* Sets the text of the text layer.
|
|
@@ -229,12 +211,15 @@ class TextLayer extends BaseLayer_1.BaseLayer {
|
|
|
229
211
|
(0, utils_1.opacity)(ctx, this.props.opacity);
|
|
230
212
|
(0, utils_1.filters)(ctx, this.props.filter);
|
|
231
213
|
ctx.textAlign = this.props.align;
|
|
232
|
-
|
|
233
|
-
|
|
214
|
+
if (this.props.letterSpacing)
|
|
215
|
+
ctx.letterSpacing = `${this.props.letterSpacing}px`;
|
|
216
|
+
if (this.props.wordSpacing)
|
|
217
|
+
ctx.wordSpacing = `${this.props.wordSpacing}px`;
|
|
234
218
|
if (this.props.baseline)
|
|
235
219
|
ctx.textBaseline = this.props.baseline;
|
|
236
220
|
if (this.props.direction)
|
|
237
221
|
ctx.direction = this.props.direction;
|
|
222
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle, { debug, layer: { width: w, height: h, x, y, align: 'none' }, manager });
|
|
238
223
|
if (this.props.multiline.enabled) {
|
|
239
224
|
const words = this.props.text.split(' ');
|
|
240
225
|
let lines = [];
|
|
@@ -261,12 +246,12 @@ class TextLayer extends BaseLayer_1.BaseLayer {
|
|
|
261
246
|
break;
|
|
262
247
|
}
|
|
263
248
|
for (let line of lines) {
|
|
264
|
-
this.drawText(this.props, ctx,
|
|
249
|
+
this.drawText(this.props, ctx, fillStyle, line.text, line.x, line.y, w);
|
|
265
250
|
}
|
|
266
251
|
}
|
|
267
252
|
else {
|
|
268
253
|
ctx.font = `${this.props.font.weight} ${this.props.font.size}px ${this.props.font.family}`;
|
|
269
|
-
this.drawText(this.props, ctx,
|
|
254
|
+
this.drawText(this.props, ctx, fillStyle, this.props.text, x, y, w);
|
|
270
255
|
}
|
|
271
256
|
ctx.closePath();
|
|
272
257
|
ctx.restore();
|
|
@@ -311,5 +296,32 @@ class TextLayer extends BaseLayer_1.BaseLayer {
|
|
|
311
296
|
}
|
|
312
297
|
return { ...data, props: copy };
|
|
313
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Validates the properties of the Text Layer.
|
|
301
|
+
* @param props {ITextLayerProps} - The properties to validate.
|
|
302
|
+
* @returns {ITextLayerProps} The validated properties.
|
|
303
|
+
*/
|
|
304
|
+
validateProps(props) {
|
|
305
|
+
return {
|
|
306
|
+
...super.validateProps(props),
|
|
307
|
+
text: props.text || "",
|
|
308
|
+
font: {
|
|
309
|
+
family: props.font?.family || "Arial",
|
|
310
|
+
size: props.font?.size || 16,
|
|
311
|
+
weight: props.font?.weight || types_1.FontWeight.Regular,
|
|
312
|
+
},
|
|
313
|
+
multiline: {
|
|
314
|
+
enabled: props.multiline?.enabled || false,
|
|
315
|
+
spacing: props.multiline?.spacing || 1.1,
|
|
316
|
+
},
|
|
317
|
+
size: {
|
|
318
|
+
width: props.size?.width || "vw",
|
|
319
|
+
height: props.size?.height || 0,
|
|
320
|
+
},
|
|
321
|
+
align: props.align || types_1.TextAlign.Left,
|
|
322
|
+
fillStyle: props.fillStyle || "#000000",
|
|
323
|
+
filled: props.filled !== undefined ? props.filled : true,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
314
326
|
}
|
|
315
327
|
exports.TextLayer = TextLayer;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AnyGradientType, FillType, StringColorType } from "../../types";
|
|
1
|
+
import { AnyCentring, AnyGradientType, FillType, StringColorType, ScaleType } from "../../types";
|
|
2
2
|
import { SKRSContext2D } from "@napi-rs/canvas";
|
|
3
|
+
import { LayersManager } from "../managers/LayersManager";
|
|
3
4
|
/**
|
|
4
5
|
* Interface representing a gradient.
|
|
5
6
|
*/
|
|
@@ -20,6 +21,10 @@ export interface IGradient {
|
|
|
20
21
|
* The color stops for the gradient.
|
|
21
22
|
*/
|
|
22
23
|
stops: Array<GradientColorStop>;
|
|
24
|
+
/**
|
|
25
|
+
* The angle of the gradient (optional, used for linear gradients).
|
|
26
|
+
*/
|
|
27
|
+
angle?: number;
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
30
|
* Interface representing a color stop in a gradient.
|
|
@@ -41,19 +46,15 @@ export interface GradientPoint {
|
|
|
41
46
|
/**
|
|
42
47
|
* The x-coordinate of the point.
|
|
43
48
|
*/
|
|
44
|
-
x:
|
|
49
|
+
x: ScaleType;
|
|
45
50
|
/**
|
|
46
51
|
* The y-coordinate of the point.
|
|
47
52
|
*/
|
|
48
|
-
y:
|
|
53
|
+
y: ScaleType;
|
|
49
54
|
/**
|
|
50
55
|
* The radius of the point (optional, used for radial gradients).
|
|
51
56
|
*/
|
|
52
57
|
r?: number;
|
|
53
|
-
/**
|
|
54
|
-
* The starting angle of the point (optional, used for conic gradients).
|
|
55
|
-
*/
|
|
56
|
-
startAngle?: number;
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
60
|
* Class representing a gradient with properties and methods to manipulate it.
|
|
@@ -75,6 +76,10 @@ export declare class Gradient implements IGradient {
|
|
|
75
76
|
* The color stops for the gradient.
|
|
76
77
|
*/
|
|
77
78
|
stops: Array<GradientColorStop>;
|
|
79
|
+
/**
|
|
80
|
+
* The angle of the gradient (optional, used for linear gradients).
|
|
81
|
+
*/
|
|
82
|
+
angle?: number;
|
|
78
83
|
/**
|
|
79
84
|
* Constructs a new Gradient instance.
|
|
80
85
|
* @param opts {Object} - Optional properties for the gradient.
|
|
@@ -95,6 +100,18 @@ export declare class Gradient implements IGradient {
|
|
|
95
100
|
* @returns {this} The current instance for chaining.
|
|
96
101
|
*/
|
|
97
102
|
addPoints(...points: GradientPoint[]): this;
|
|
103
|
+
/**
|
|
104
|
+
* Sets the points of the gradient.
|
|
105
|
+
* @param points {GradientPoint[]} - The points to set for the gradient.
|
|
106
|
+
* @returns {this} The current instance for chaining.
|
|
107
|
+
*/
|
|
108
|
+
setPoints(...points: GradientPoint[]): this;
|
|
109
|
+
/**
|
|
110
|
+
* Removes points from the gradient by their indexes.
|
|
111
|
+
* @param indexes {number[]} - The indexes of the points to remove.
|
|
112
|
+
* @returns {this} The current instance for chaining.
|
|
113
|
+
*/
|
|
114
|
+
removePoints(...indexes: number[]): this;
|
|
98
115
|
/**
|
|
99
116
|
* Adds color stops to the gradient.
|
|
100
117
|
* @param stops {GradientColorStop[]} - The color stops to add to the gradient.
|
|
@@ -102,14 +119,34 @@ export declare class Gradient implements IGradient {
|
|
|
102
119
|
*/
|
|
103
120
|
addStops(...stops: GradientColorStop[]): this;
|
|
104
121
|
/**
|
|
105
|
-
*
|
|
106
|
-
* @param
|
|
107
|
-
* @returns {
|
|
122
|
+
* Sets the color stops of the gradient.
|
|
123
|
+
* @param stops {GradientColorStop[]} - The color stops to set for the gradient.
|
|
124
|
+
* @returns {this} The current instance for chaining.
|
|
125
|
+
*/
|
|
126
|
+
setStops(...stops: GradientColorStop[]): this;
|
|
127
|
+
/**
|
|
128
|
+
* Removes color stops from the gradient by their indexes.
|
|
129
|
+
* @param indexes {number[]} - The indexes of the color stops to remove.
|
|
130
|
+
* @returns {this} The current instance for chaining.
|
|
108
131
|
*/
|
|
109
|
-
|
|
132
|
+
removeStops(...indexes: number[]): this;
|
|
133
|
+
setAngle(angle: number): this;
|
|
134
|
+
draw(ctx: SKRSContext2D, opts?: {
|
|
135
|
+
debug?: boolean;
|
|
136
|
+
layer?: {
|
|
137
|
+
width: number;
|
|
138
|
+
height: number;
|
|
139
|
+
x: number;
|
|
140
|
+
y: number;
|
|
141
|
+
align: AnyCentring;
|
|
142
|
+
};
|
|
143
|
+
manager?: LayersManager;
|
|
144
|
+
}): CanvasGradient;
|
|
110
145
|
/**
|
|
111
146
|
* Converts the gradient to a JSON representation.
|
|
112
147
|
* @returns {IGradient} The JSON representation of the gradient.
|
|
113
148
|
*/
|
|
114
149
|
toJSON(): IGradient;
|
|
150
|
+
private getLinearGradientPoints;
|
|
151
|
+
private getPosition;
|
|
115
152
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Gradient = void 0;
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
|
+
const LazyUtil_1 = require("../../utils/LazyUtil");
|
|
6
|
+
const utils_1 = require("../../utils/utils");
|
|
5
7
|
/**
|
|
6
8
|
* Class representing a gradient with properties and methods to manipulate it.
|
|
7
9
|
*/
|
|
@@ -22,6 +24,10 @@ class Gradient {
|
|
|
22
24
|
* The color stops for the gradient.
|
|
23
25
|
*/
|
|
24
26
|
stops;
|
|
27
|
+
/**
|
|
28
|
+
* The angle of the gradient (optional, used for linear gradients).
|
|
29
|
+
*/
|
|
30
|
+
angle;
|
|
25
31
|
/**
|
|
26
32
|
* Constructs a new Gradient instance.
|
|
27
33
|
* @param opts {Object} - Optional properties for the gradient.
|
|
@@ -31,6 +37,7 @@ class Gradient {
|
|
|
31
37
|
this.type = opts?.props?.type || types_1.GradientType.Linear;
|
|
32
38
|
this.points = opts?.props?.points || [];
|
|
33
39
|
this.stops = opts?.props?.stops || [];
|
|
40
|
+
this.angle = opts?.props?.angle || 0;
|
|
34
41
|
}
|
|
35
42
|
/**
|
|
36
43
|
* Sets the type of the gradient.
|
|
@@ -50,6 +57,24 @@ class Gradient {
|
|
|
50
57
|
this.points.push(...points);
|
|
51
58
|
return this;
|
|
52
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets the points of the gradient.
|
|
62
|
+
* @param points {GradientPoint[]} - The points to set for the gradient.
|
|
63
|
+
* @returns {this} The current instance for chaining.
|
|
64
|
+
*/
|
|
65
|
+
setPoints(...points) {
|
|
66
|
+
this.points = points;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Removes points from the gradient by their indexes.
|
|
71
|
+
* @param indexes {number[]} - The indexes of the points to remove.
|
|
72
|
+
* @returns {this} The current instance for chaining.
|
|
73
|
+
*/
|
|
74
|
+
removePoints(...indexes) {
|
|
75
|
+
this.points = this.points.filter((_, index) => !indexes.includes(index));
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
53
78
|
/**
|
|
54
79
|
* Adds color stops to the gradient.
|
|
55
80
|
* @param stops {GradientColorStop[]} - The color stops to add to the gradient.
|
|
@@ -60,28 +85,74 @@ class Gradient {
|
|
|
60
85
|
return this;
|
|
61
86
|
}
|
|
62
87
|
/**
|
|
63
|
-
*
|
|
64
|
-
* @param
|
|
65
|
-
* @returns {
|
|
88
|
+
* Sets the color stops of the gradient.
|
|
89
|
+
* @param stops {GradientColorStop[]} - The color stops to set for the gradient.
|
|
90
|
+
* @returns {this} The current instance for chaining.
|
|
91
|
+
*/
|
|
92
|
+
setStops(...stops) {
|
|
93
|
+
this.stops = stops;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Removes color stops from the gradient by their indexes.
|
|
98
|
+
* @param indexes {number[]} - The indexes of the color stops to remove.
|
|
99
|
+
* @returns {this} The current instance for chaining.
|
|
66
100
|
*/
|
|
67
|
-
|
|
101
|
+
removeStops(...indexes) {
|
|
102
|
+
this.stops = this.stops.filter((_, index) => !indexes.includes(index));
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
setAngle(angle) {
|
|
106
|
+
this.angle = angle;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
draw(ctx, opts = { debug: false }) {
|
|
68
110
|
let gradientData = this.toJSON();
|
|
69
111
|
let gradient;
|
|
112
|
+
if (opts.debug)
|
|
113
|
+
LazyUtil_1.LazyLog.log('none', `Gradient:`, gradientData);
|
|
114
|
+
const parse = (0, utils_1.parser)(ctx, ctx.canvas, opts.manager);
|
|
115
|
+
const { x0, y0, x1, y1 } = parse.parseBatch({
|
|
116
|
+
x0: { v: gradientData.points[0]?.x || 0 },
|
|
117
|
+
y0: { v: gradientData.points[0]?.y || 0, options: LazyUtil_1.defaultArg.vl(true) },
|
|
118
|
+
x1: { v: gradientData.points[1]?.x || 0 },
|
|
119
|
+
y1: { v: gradientData.points[1]?.y || 0, options: LazyUtil_1.defaultArg.vl(true) }
|
|
120
|
+
});
|
|
121
|
+
if (opts.debug)
|
|
122
|
+
LazyUtil_1.LazyLog.log('none', `Gradient points:`, { x0, y0, x1, y1 });
|
|
70
123
|
switch (gradientData.type) {
|
|
71
124
|
case types_1.GradientType.Linear:
|
|
72
125
|
case "linear":
|
|
73
|
-
|
|
126
|
+
if (gradientData.type === "linear" && (gradientData.angle || gradientData.angle === 0) && opts.layer) {
|
|
127
|
+
const { width, height, x, y, align } = opts.layer;
|
|
128
|
+
const cx = this.getPosition(x, width, align, 'x');
|
|
129
|
+
const cy = this.getPosition(y, height, align, 'y');
|
|
130
|
+
const [p1, p2] = this.getLinearGradientPoints(cx, cy, width, height, gradientData.angle);
|
|
131
|
+
gradient = ctx.createLinearGradient(p1.x, p1.y, p2.x, p2.y);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
gradient = ctx.createLinearGradient(x0, y0, x1 || x0, y1 || y0);
|
|
135
|
+
}
|
|
74
136
|
break;
|
|
75
137
|
case types_1.GradientType.Radial:
|
|
76
138
|
case "radial":
|
|
77
|
-
gradient = ctx.createRadialGradient(
|
|
139
|
+
gradient = ctx.createRadialGradient(x0, y0, gradientData.points[0].r || 0, x1 || x0, y1 || y0, gradientData.points[1].r || 0);
|
|
78
140
|
break;
|
|
79
141
|
case types_1.GradientType.Conic:
|
|
80
142
|
case "conic":
|
|
81
|
-
gradient = ctx.createConicGradient(gradientData.
|
|
143
|
+
gradient = ctx.createConicGradient((gradientData.angle || 0) * (Math.PI / 180), x0, y0);
|
|
82
144
|
break;
|
|
83
145
|
default:
|
|
84
|
-
|
|
146
|
+
if ((gradientData.angle || gradientData.angle === 0) && opts.layer) {
|
|
147
|
+
const { width, height, x, y, align } = opts.layer;
|
|
148
|
+
const cx = this.getPosition(x, width, align, 'x');
|
|
149
|
+
const cy = this.getPosition(y, height, align, 'y');
|
|
150
|
+
const [p1, p2] = this.getLinearGradientPoints(cx, cy, width, height, gradientData.angle);
|
|
151
|
+
gradient = ctx.createLinearGradient(p1.x, p1.y, p2.x, p2.y);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
gradient = ctx.createLinearGradient(x0, y0, x1 || x0, y1 || y0);
|
|
155
|
+
}
|
|
85
156
|
break;
|
|
86
157
|
}
|
|
87
158
|
for (let stop of gradientData.stops) {
|
|
@@ -99,7 +170,61 @@ class Gradient {
|
|
|
99
170
|
type: this.type,
|
|
100
171
|
points: this.points,
|
|
101
172
|
stops: this.stops,
|
|
173
|
+
angle: this.angle
|
|
102
174
|
};
|
|
103
175
|
}
|
|
176
|
+
getLinearGradientPoints(cx, cy, w, h, angleInDegrees) {
|
|
177
|
+
const angle = angleInDegrees * (Math.PI / 180);
|
|
178
|
+
const x1 = cx;
|
|
179
|
+
const y1 = cy - h / 2;
|
|
180
|
+
const x2 = cx;
|
|
181
|
+
const y2 = cy + h / 2;
|
|
182
|
+
const cos = Math.cos(angle);
|
|
183
|
+
const sin = Math.sin(angle);
|
|
184
|
+
const x1r = cx + (x1 - cx) * cos - (y1 - cy) * sin;
|
|
185
|
+
const y1r = cy + (x1 - cx) * sin + (y1 - cy) * cos;
|
|
186
|
+
const x2r = cx + (x2 - cx) * cos - (y2 - cy) * sin;
|
|
187
|
+
const y2r = cy + (x2 - cx) * sin + (y2 - cy) * cos;
|
|
188
|
+
return [
|
|
189
|
+
{ x: x1r, y: y1r },
|
|
190
|
+
{ x: x2r, y: y2r }
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
getPosition(pos, side, align, type = 'x') {
|
|
194
|
+
switch (align) {
|
|
195
|
+
case types_1.Centring.StartTop:
|
|
196
|
+
case "start-top":
|
|
197
|
+
return type === 'x' ? pos + (side / 2) : pos + (side / 2);
|
|
198
|
+
case types_1.Centring.Start:
|
|
199
|
+
case "start":
|
|
200
|
+
return type === 'x' ? pos + (side / 2) : pos;
|
|
201
|
+
case types_1.Centring.StartBottom:
|
|
202
|
+
case "start-bottom":
|
|
203
|
+
return type === 'x' ? pos + (side / 2) : pos - (side / 2);
|
|
204
|
+
case types_1.Centring.CenterTop:
|
|
205
|
+
case "center-top":
|
|
206
|
+
return type === 'x' ? pos : pos - (side / 2);
|
|
207
|
+
case types_1.Centring.Center:
|
|
208
|
+
case "center":
|
|
209
|
+
return type === 'x' ? pos : pos;
|
|
210
|
+
case types_1.Centring.CenterBottom:
|
|
211
|
+
case "center-bottom":
|
|
212
|
+
return type === 'x' ? pos : pos - (side / 2);
|
|
213
|
+
case types_1.Centring.EndTop:
|
|
214
|
+
case "end-top":
|
|
215
|
+
return type === 'x' ? pos - (side / 2) : pos + (side / 2);
|
|
216
|
+
case types_1.Centring.End:
|
|
217
|
+
case "end":
|
|
218
|
+
return type === 'x' ? pos - (side / 2) : pos;
|
|
219
|
+
case types_1.Centring.EndBottom:
|
|
220
|
+
case "end-bottom":
|
|
221
|
+
return type === 'x' ? pos - (side / 2) : pos - (side / 2);
|
|
222
|
+
case types_1.Centring.None:
|
|
223
|
+
case "none":
|
|
224
|
+
return type === 'x' ? pos + (side / 2) : pos + (side / 2);
|
|
225
|
+
default:
|
|
226
|
+
throw new LazyUtil_1.LazyError(`Invalid centring type: ${align}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
104
229
|
}
|
|
105
230
|
exports.Gradient = Gradient;
|
|
@@ -58,7 +58,7 @@ class JSONReader {
|
|
|
58
58
|
}
|
|
59
59
|
if (opts?.debug)
|
|
60
60
|
LazyUtil_1.LazyLog.log("info", "Reading JSON...\nOptions:", data.options, "\nAnimation:", data.animation, "\nLayers Number:", data.layers.length, "\nLayers:", data.layers);
|
|
61
|
-
const layers = JSONReader.layersParse(data.layers);
|
|
61
|
+
const layers = JSONReader.layersParse(data.layers, opts);
|
|
62
62
|
const canvas = new LazyCanvas_1.LazyCanvas({ settings: data, debug: opts?.debug })
|
|
63
63
|
.create(data.options.width, data.options.height);
|
|
64
64
|
canvas.manager.layers.add(...layers);
|
|
@@ -99,7 +99,7 @@ class JSONReader {
|
|
|
99
99
|
visible: layer.visible,
|
|
100
100
|
};
|
|
101
101
|
if (layer.type === types_1.LayerType.Group) {
|
|
102
|
-
return new components_1.Group(misc).add(...layer.layers.map((l) => this.layerParse(l)));
|
|
102
|
+
return new components_1.Group(misc).add(...layer.layers.map((l) => this.layerParse(l, { id: l.id, zIndex: l.zIndex, visible: l.visible })));
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
105
|
return this.layerParse(layer, misc);
|
|
@@ -153,7 +153,6 @@ class JSONReader {
|
|
|
153
153
|
case 'gradient':
|
|
154
154
|
return new __1.Gradient({ props: layer.props.fillStyle });
|
|
155
155
|
case 'pattern':
|
|
156
|
-
console.log('Pattern:', layer.props.fillStyle);
|
|
157
156
|
return new __1.Pattern()
|
|
158
157
|
.setType(layer.props.fillStyle.type)
|
|
159
158
|
.setSrc(typeof layer.props.fillStyle.src === 'string' ? layer.props.fillStyle.src : this.read(layer.props.fillStyle.src));
|
|
@@ -162,6 +161,7 @@ class JSONReader {
|
|
|
162
161
|
}
|
|
163
162
|
}
|
|
164
163
|
else if ('fillStyle' in layer.props) {
|
|
164
|
+
console.log(layer.type, layer);
|
|
165
165
|
return layer.props.fillStyle || '#000000';
|
|
166
166
|
}
|
|
167
167
|
else {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LazyCanvas } from "../../LazyCanvas";
|
|
2
|
+
export declare class YAMLReader {
|
|
3
|
+
/**
|
|
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.
|
|
7
|
+
* @returns A Promise that resolves to a LazyCanvas object.
|
|
8
|
+
*/
|
|
9
|
+
static read(data: string, opts?: {
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
}): LazyCanvas;
|
|
12
|
+
/**
|
|
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.
|
|
16
|
+
* @returns A Promise that resolves to a LazyCanvas object.
|
|
17
|
+
* @throws LazyError if the file does not exist or has an invalid extension.
|
|
18
|
+
*/
|
|
19
|
+
static readFile(filePath: string, opts?: {
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
}): LazyCanvas;
|
|
22
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.YAMLReader = void 0;
|
|
27
|
+
const JSONReader_1 = require("./JSONReader");
|
|
28
|
+
const _yaml = __importStar(require("js-yaml"));
|
|
29
|
+
const fs = __importStar(require("fs"));
|
|
30
|
+
const LazyUtil_1 = require("../../../utils/LazyUtil");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
class YAMLReader {
|
|
33
|
+
/**
|
|
34
|
+
* 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.
|
|
37
|
+
* @returns A Promise that resolves to a LazyCanvas object.
|
|
38
|
+
*/
|
|
39
|
+
static read(data, opts) {
|
|
40
|
+
const yamlContent = _yaml.load(data);
|
|
41
|
+
if (opts?.debug) {
|
|
42
|
+
LazyUtil_1.LazyLog.log('info', 'YAML content loaded:', yamlContent);
|
|
43
|
+
}
|
|
44
|
+
if (typeof yamlContent === 'object' && yamlContent !== null) {
|
|
45
|
+
return JSONReader_1.JSONReader.read(yamlContent, opts);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
throw new LazyUtil_1.LazyError("Invalid YAML content: Expected an object.");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 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.
|
|
55
|
+
* @returns A Promise that resolves to a LazyCanvas object.
|
|
56
|
+
* @throws LazyError if the file does not exist or has an invalid extension.
|
|
57
|
+
*/
|
|
58
|
+
static readFile(filePath, opts) {
|
|
59
|
+
if (!fs.existsSync(filePath)) {
|
|
60
|
+
throw new LazyUtil_1.LazyError(`File not found: ${filePath}`);
|
|
61
|
+
}
|
|
62
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
63
|
+
if (ext !== '.yaml' && ext !== '.yml') {
|
|
64
|
+
throw new LazyUtil_1.LazyError(`Invalid file extension: ${ext}. Expected .yaml or .yml.`);
|
|
65
|
+
}
|
|
66
|
+
const data = fs.readFileSync(filePath, 'utf8');
|
|
67
|
+
if (opts?.debug) {
|
|
68
|
+
LazyUtil_1.LazyLog.log('info', `Reading YAML file: ${filePath}`);
|
|
69
|
+
}
|
|
70
|
+
return this.read(data, opts);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.YAMLReader = YAMLReader;
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -33,9 +33,19 @@ export declare function parser(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, m
|
|
|
33
33
|
}>): Record<string, number>;
|
|
34
34
|
};
|
|
35
35
|
export declare function drawShadow(ctx: SKRSContext2D, shadow: any): void;
|
|
36
|
-
export declare function opacity(ctx: SKRSContext2D, opacity
|
|
37
|
-
export declare function filters(ctx: SKRSContext2D, filters: string): void;
|
|
38
|
-
export declare function parseFillStyle(ctx: SKRSContext2D, color: ColorType
|
|
36
|
+
export declare function opacity(ctx: SKRSContext2D, opacity?: number): void;
|
|
37
|
+
export declare function filters(ctx: SKRSContext2D, filters: string | null | undefined): void;
|
|
38
|
+
export declare function parseFillStyle(ctx: SKRSContext2D, color: ColorType, opts: {
|
|
39
|
+
debug?: boolean;
|
|
40
|
+
layer?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
align: AnyCentring;
|
|
46
|
+
};
|
|
47
|
+
manager?: LayersManager;
|
|
48
|
+
}): string | Promise<CanvasPattern> | CanvasGradient;
|
|
39
49
|
export declare function transform(ctx: SKRSContext2D, transform: Transform, layer?: {
|
|
40
50
|
width: number;
|
|
41
51
|
height: number;
|
package/dist/utils/utils.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.generateID = generateID;
|
|
|
13
13
|
let percentReg = /^(\d+)%$/;
|
|
14
14
|
let pxReg = /^(\d+)px$/;
|
|
15
15
|
let canvasReg = /^(vw|vh|vmin|vmax)$/;
|
|
16
|
-
let linkReg = /^(link-w|link-h|link-x|link-y)-([A-Za-z0-9_]+)-(\d+)$/;
|
|
16
|
+
let linkReg = /^(link-w|link-h|link-x|link-y)-([A-Za-z0-9_]+)-(\d+(.\d+)?)$/;
|
|
17
17
|
let hexReg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
18
18
|
let rgbReg = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
|
|
19
19
|
let rgbaReg = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(0|0?\.\d+|1(\.0)?)\)$/;
|
|
@@ -122,7 +122,7 @@ function drawShadow(ctx, shadow) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
exports.drawShadow = drawShadow;
|
|
125
|
-
function opacity(ctx, opacity) {
|
|
125
|
+
function opacity(ctx, opacity = 1) {
|
|
126
126
|
if (opacity < 1) {
|
|
127
127
|
ctx.globalAlpha = opacity;
|
|
128
128
|
}
|
|
@@ -134,13 +134,13 @@ function filters(ctx, filters) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
exports.filters = filters;
|
|
137
|
-
function parseFillStyle(ctx, color) {
|
|
137
|
+
function parseFillStyle(ctx, color, opts) {
|
|
138
138
|
if (!ctx)
|
|
139
139
|
throw new LazyUtil_1.LazyError('The context is not defined');
|
|
140
140
|
if (!color)
|
|
141
141
|
throw new LazyUtil_1.LazyError('The color is not defined');
|
|
142
142
|
if (color instanceof helpers_1.Gradient || color instanceof helpers_1.Pattern) {
|
|
143
|
-
return color.draw(ctx);
|
|
143
|
+
return color.draw(ctx, opts);
|
|
144
144
|
}
|
|
145
145
|
return color;
|
|
146
146
|
}
|
|
@@ -232,6 +232,7 @@ function centring(centring, type, width, height, x, y) {
|
|
|
232
232
|
case types_1.LayerType.Morph:
|
|
233
233
|
case types_1.LayerType.Clear:
|
|
234
234
|
x -= width / 2;
|
|
235
|
+
y -= height;
|
|
235
236
|
break;
|
|
236
237
|
}
|
|
237
238
|
return { x, y };
|
|
@@ -258,9 +259,6 @@ function centring(centring, type, width, height, x, y) {
|
|
|
258
259
|
return { x, y };
|
|
259
260
|
case types_1.Centring.StartBottom:
|
|
260
261
|
case "start-bottom":
|
|
261
|
-
return { x, y };
|
|
262
|
-
case types_1.Centring.StartTop:
|
|
263
|
-
case "start-top":
|
|
264
262
|
switch (type) {
|
|
265
263
|
case types_1.LayerType.Image:
|
|
266
264
|
case types_1.LayerType.Morph:
|
|
@@ -269,6 +267,9 @@ function centring(centring, type, width, height, x, y) {
|
|
|
269
267
|
break;
|
|
270
268
|
}
|
|
271
269
|
return { x, y };
|
|
270
|
+
case types_1.Centring.StartTop:
|
|
271
|
+
case "start-top":
|
|
272
|
+
return { x, y };
|
|
272
273
|
case types_1.Centring.End:
|
|
273
274
|
case "end":
|
|
274
275
|
switch (type) {
|
|
@@ -287,6 +288,7 @@ function centring(centring, type, width, height, x, y) {
|
|
|
287
288
|
case types_1.LayerType.Morph:
|
|
288
289
|
case types_1.LayerType.Clear:
|
|
289
290
|
x -= width;
|
|
291
|
+
y -= height;
|
|
290
292
|
break;
|
|
291
293
|
}
|
|
292
294
|
return { x, y };
|
|
@@ -297,7 +299,6 @@ function centring(centring, type, width, height, x, y) {
|
|
|
297
299
|
case types_1.LayerType.Morph:
|
|
298
300
|
case types_1.LayerType.Clear:
|
|
299
301
|
x -= width;
|
|
300
|
-
y -= height;
|
|
301
302
|
break;
|
|
302
303
|
}
|
|
303
304
|
return { x, y };
|
|
@@ -375,7 +376,7 @@ function resizeLayers(layers, ratio) {
|
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
378
|
}
|
|
378
|
-
if ('stroke' in layer.props) {
|
|
379
|
+
if ('stroke' in layer.props && layer.props.stroke) {
|
|
379
380
|
layer.props.stroke.width = resize(layer.props.stroke.width, ratio);
|
|
380
381
|
}
|
|
381
382
|
if ('endPoint' in layer.props) {
|
package/package.json
CHANGED