modern-canvas 0.4.44 → 0.4.45
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.cjs +12 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +12 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -245,12 +245,13 @@ function defineProperty(constructor, name, declaration = {}) {
|
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
+
const getDefaultValue = () => typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
248
249
|
Object.defineProperty(constructor.prototype, name, {
|
|
249
250
|
get() {
|
|
250
|
-
return descriptor.get?.call(this) ??
|
|
251
|
+
return descriptor.get?.call(this) ?? getDefaultValue();
|
|
251
252
|
},
|
|
252
253
|
set(value) {
|
|
253
|
-
const oldValue = descriptor.get?.call(this) ??
|
|
254
|
+
const oldValue = descriptor.get?.call(this) ?? getDefaultValue();
|
|
254
255
|
descriptor.set?.call(this, value);
|
|
255
256
|
this.requestUpdate?.(name, oldValue, declaration);
|
|
256
257
|
},
|
|
@@ -511,7 +512,7 @@ class CoreObject extends EventEmitter {
|
|
|
511
512
|
this._defaultProperties = {};
|
|
512
513
|
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
513
514
|
if (!property.protected && !property.alias) {
|
|
514
|
-
this._defaultProperties[name] = property.default;
|
|
515
|
+
this._defaultProperties[name] = typeof property.default === "function" ? property.default() : property.default;
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
518
|
}
|
|
@@ -5171,7 +5172,7 @@ class GradientTexture extends Texture2D {
|
|
|
5171
5172
|
if (!ctx) {
|
|
5172
5173
|
throw new Error("Failed to parse linear gradient, get canvas context is null.");
|
|
5173
5174
|
}
|
|
5174
|
-
let { angle, stops } = linearGradient;
|
|
5175
|
+
let { angle = 0, stops } = linearGradient;
|
|
5175
5176
|
angle -= Math.PI / 2;
|
|
5176
5177
|
const halfWidth = width / 2;
|
|
5177
5178
|
const halfHeight = height / 2;
|
|
@@ -6147,7 +6148,7 @@ __decorateClass$R([
|
|
|
6147
6148
|
property({ default: "default" })
|
|
6148
6149
|
], exports.Node.prototype, "internalMode", 2);
|
|
6149
6150
|
__decorateClass$R([
|
|
6150
|
-
property({ default: {} })
|
|
6151
|
+
property({ default: () => ({}) })
|
|
6151
6152
|
], exports.Node.prototype, "meta", 2);
|
|
6152
6153
|
exports.Node = __decorateClass$R([
|
|
6153
6154
|
customNode("Node")
|
|
@@ -6937,7 +6938,7 @@ void main(void) {
|
|
|
6937
6938
|
}`
|
|
6938
6939
|
}));
|
|
6939
6940
|
__decorateClass$L([
|
|
6940
|
-
property({ default: [] })
|
|
6941
|
+
property({ default: () => [] })
|
|
6941
6942
|
], exports.ColorOverlayEffect.prototype, "colors", 2);
|
|
6942
6943
|
__decorateClass$L([
|
|
6943
6944
|
property({ default: 0.5 })
|
|
@@ -7022,7 +7023,7 @@ void main(void) {
|
|
|
7022
7023
|
}`
|
|
7023
7024
|
}));
|
|
7024
7025
|
__decorateClass$K([
|
|
7025
|
-
property({ default: [] })
|
|
7026
|
+
property({ default: () => [] })
|
|
7026
7027
|
], exports.ColorRemoveEffect.prototype, "colors", 2);
|
|
7027
7028
|
__decorateClass$K([
|
|
7028
7029
|
property({ default: 0.5 })
|
|
@@ -8390,7 +8391,7 @@ __decorateClass$A([
|
|
|
8390
8391
|
property({ default: true })
|
|
8391
8392
|
], exports.GodrayEffect.prototype, "parallel", 2);
|
|
8392
8393
|
__decorateClass$A([
|
|
8393
|
-
property({ default: [0, 0] })
|
|
8394
|
+
property({ default: () => [0, 0] })
|
|
8394
8395
|
], exports.GodrayEffect.prototype, "center", 2);
|
|
8395
8396
|
__decorateClass$A([
|
|
8396
8397
|
property({ default: 1 })
|
|
@@ -9318,10 +9319,10 @@ __decorateClass$p([
|
|
|
9318
9319
|
property()
|
|
9319
9320
|
], BaseElement2DShape.prototype, "svg");
|
|
9320
9321
|
__decorateClass$p([
|
|
9321
|
-
property({ default: [0, 0, 1, 1] })
|
|
9322
|
+
property({ default: () => [0, 0, 1, 1] })
|
|
9322
9323
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9323
9324
|
__decorateClass$p([
|
|
9324
|
-
property({ default: [] })
|
|
9325
|
+
property({ default: () => [] })
|
|
9325
9326
|
], BaseElement2DShape.prototype, "data");
|
|
9326
9327
|
|
|
9327
9328
|
class BaseElement2DStyle extends Resource {
|
|
@@ -11261,7 +11262,7 @@ __decorateClass$d([
|
|
|
11261
11262
|
property({ default: false })
|
|
11262
11263
|
], exports.Animation.prototype, "loop", 2);
|
|
11263
11264
|
__decorateClass$d([
|
|
11264
|
-
property({ default: [] })
|
|
11265
|
+
property({ default: () => [] })
|
|
11265
11266
|
], exports.Animation.prototype, "keyframes", 2);
|
|
11266
11267
|
__decorateClass$d([
|
|
11267
11268
|
property()
|
package/dist/index.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ declare const customNodes: Map<string, any>;
|
|
|
20
20
|
declare function customNode<T = Record<string, any>>(tag: string, defaultProperties?: Partial<T>): ClassDecorator;
|
|
21
21
|
|
|
22
22
|
interface PropertyDeclaration {
|
|
23
|
-
readonly default?: any;
|
|
23
|
+
readonly default?: any | (() => any);
|
|
24
24
|
readonly protected?: boolean;
|
|
25
25
|
readonly alias?: string;
|
|
26
26
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -20,7 +20,7 @@ declare const customNodes: Map<string, any>;
|
|
|
20
20
|
declare function customNode<T = Record<string, any>>(tag: string, defaultProperties?: Partial<T>): ClassDecorator;
|
|
21
21
|
|
|
22
22
|
interface PropertyDeclaration {
|
|
23
|
-
readonly default?: any;
|
|
23
|
+
readonly default?: any | (() => any);
|
|
24
24
|
readonly protected?: boolean;
|
|
25
25
|
readonly alias?: string;
|
|
26
26
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ declare const customNodes: Map<string, any>;
|
|
|
20
20
|
declare function customNode<T = Record<string, any>>(tag: string, defaultProperties?: Partial<T>): ClassDecorator;
|
|
21
21
|
|
|
22
22
|
interface PropertyDeclaration {
|
|
23
|
-
readonly default?: any;
|
|
23
|
+
readonly default?: any | (() => any);
|
|
24
24
|
readonly protected?: boolean;
|
|
25
25
|
readonly alias?: string;
|
|
26
26
|
}
|