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.mjs CHANGED
@@ -239,12 +239,13 @@ function defineProperty(constructor, name, declaration = {}) {
239
239
  }
240
240
  };
241
241
  }
242
+ const getDefaultValue = () => typeof defaultValue === "function" ? defaultValue() : defaultValue;
242
243
  Object.defineProperty(constructor.prototype, name, {
243
244
  get() {
244
- return descriptor.get?.call(this) ?? defaultValue;
245
+ return descriptor.get?.call(this) ?? getDefaultValue();
245
246
  },
246
247
  set(value) {
247
- const oldValue = descriptor.get?.call(this) ?? defaultValue;
248
+ const oldValue = descriptor.get?.call(this) ?? getDefaultValue();
248
249
  descriptor.set?.call(this, value);
249
250
  this.requestUpdate?.(name, oldValue, declaration);
250
251
  },
@@ -505,7 +506,7 @@ class CoreObject extends EventEmitter {
505
506
  this._defaultProperties = {};
506
507
  for (const [name, property] of this.getPropertyDeclarations()) {
507
508
  if (!property.protected && !property.alias) {
508
- this._defaultProperties[name] = property.default;
509
+ this._defaultProperties[name] = typeof property.default === "function" ? property.default() : property.default;
509
510
  }
510
511
  }
511
512
  }
@@ -5165,7 +5166,7 @@ class GradientTexture extends Texture2D {
5165
5166
  if (!ctx) {
5166
5167
  throw new Error("Failed to parse linear gradient, get canvas context is null.");
5167
5168
  }
5168
- let { angle, stops } = linearGradient;
5169
+ let { angle = 0, stops } = linearGradient;
5169
5170
  angle -= Math.PI / 2;
5170
5171
  const halfWidth = width / 2;
5171
5172
  const halfHeight = height / 2;
@@ -6141,7 +6142,7 @@ __decorateClass$R([
6141
6142
  property({ default: "default" })
6142
6143
  ], Node.prototype, "internalMode", 2);
6143
6144
  __decorateClass$R([
6144
- property({ default: {} })
6145
+ property({ default: () => ({}) })
6145
6146
  ], Node.prototype, "meta", 2);
6146
6147
  Node = __decorateClass$R([
6147
6148
  customNode("Node")
@@ -6931,7 +6932,7 @@ void main(void) {
6931
6932
  }`
6932
6933
  }));
6933
6934
  __decorateClass$L([
6934
- property({ default: [] })
6935
+ property({ default: () => [] })
6935
6936
  ], ColorOverlayEffect.prototype, "colors", 2);
6936
6937
  __decorateClass$L([
6937
6938
  property({ default: 0.5 })
@@ -7016,7 +7017,7 @@ void main(void) {
7016
7017
  }`
7017
7018
  }));
7018
7019
  __decorateClass$K([
7019
- property({ default: [] })
7020
+ property({ default: () => [] })
7020
7021
  ], ColorRemoveEffect.prototype, "colors", 2);
7021
7022
  __decorateClass$K([
7022
7023
  property({ default: 0.5 })
@@ -8384,7 +8385,7 @@ __decorateClass$A([
8384
8385
  property({ default: true })
8385
8386
  ], GodrayEffect.prototype, "parallel", 2);
8386
8387
  __decorateClass$A([
8387
- property({ default: [0, 0] })
8388
+ property({ default: () => [0, 0] })
8388
8389
  ], GodrayEffect.prototype, "center", 2);
8389
8390
  __decorateClass$A([
8390
8391
  property({ default: 1 })
@@ -9312,10 +9313,10 @@ __decorateClass$p([
9312
9313
  property()
9313
9314
  ], BaseElement2DShape.prototype, "svg");
9314
9315
  __decorateClass$p([
9315
- property({ default: [0, 0, 1, 1] })
9316
+ property({ default: () => [0, 0, 1, 1] })
9316
9317
  ], BaseElement2DShape.prototype, "viewBox");
9317
9318
  __decorateClass$p([
9318
- property({ default: [] })
9319
+ property({ default: () => [] })
9319
9320
  ], BaseElement2DShape.prototype, "data");
9320
9321
 
9321
9322
  class BaseElement2DStyle extends Resource {
@@ -11255,7 +11256,7 @@ __decorateClass$d([
11255
11256
  property({ default: false })
11256
11257
  ], Animation.prototype, "loop", 2);
11257
11258
  __decorateClass$d([
11258
- property({ default: [] })
11259
+ property({ default: () => [] })
11259
11260
  ], Animation.prototype, "keyframes", 2);
11260
11261
  __decorateClass$d([
11261
11262
  property()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.4.44",
4
+ "version": "0.4.45",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",