modern-canvas 0.14.9 → 0.14.10

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineProperty as rs, Observable as ue, Reactivable as ss, parseColor as ni, property as h, isGradient as li, isColorFillObject as kr, clearUndef as is, idGenerator as as, normalizeFill as ci, isNone as V, normalizeBackground as hi, normalizeForeground as ui, normalizeOutline as di, normalizeShadow as fi, normalizeShape as pi, getDefaultStyle as _i, normalizeText as mi, normalizeTextContent as gi, getDefaultTextStyle as vi, getDefaultLayoutStyle as bi, RawWeakMap as yi } from "modern-idoc";
1
+ import { defineProperty as rs, Observable as de, Reactivable as ss, parseColor as ni, property as h, isGradient as li, isColorFillObject as kr, clearUndef as is, idGenerator as as, normalizeFill as ci, isNone as V, normalizeBackground as hi, normalizeForeground as ui, normalizeOutline as di, normalizeShadow as fi, normalizeShape as pi, getDefaultStyle as _i, normalizeText as mi, normalizeTextContent as gi, getDefaultTextStyle as vi, getDefaultLayoutStyle as bi, RawWeakMap as yi } from "modern-idoc";
2
2
  import { fonts as xi } from "modern-font";
3
3
  import { extend as wi } from "colord";
4
4
  import Pi from "colord/plugins/names";
@@ -342,7 +342,7 @@ const Zi = {
342
342
  touchmove: "pointermove",
343
343
  touchcancel: "pointercancel"
344
344
  };
345
- class Ji extends ue {
345
+ class Ji extends de {
346
346
  /**
347
347
  * Current event
348
348
  */
@@ -516,10 +516,10 @@ class Pe extends ss {
516
516
  class Qi extends Pe {
517
517
  //
518
518
  }
519
- class de extends Qi {
519
+ class fe extends Qi {
520
520
  //
521
521
  }
522
- class ne extends ue {
522
+ class le extends de {
523
523
  constructor(e, t, s) {
524
524
  super(), this.rows = e, this.cols = t, s ? this.set(s) : this.identity();
525
525
  }
@@ -531,9 +531,9 @@ class ne extends ue {
531
531
  operate(e, t, s) {
532
532
  const { cols: i, rows: a, length: o, _array: n } = this;
533
533
  let l;
534
- typeof t == "number" ? l = Array.from({ length: o }, () => t) : t instanceof Q || t instanceof ne ? l = t.toArray() : l = t;
534
+ typeof t == "number" ? l = Array.from({ length: o }, () => t) : t instanceof Q || t instanceof le ? l = t.toArray() : l = t;
535
535
  let c, u = [];
536
- if (s ? s instanceof Q || s instanceof ne ? c = s : u = s : t instanceof Q ? c = new t.constructor() : c = this, t instanceof Q) {
536
+ if (s ? s instanceof Q || s instanceof le ? c = s : u = s : t instanceof Q ? c = new t.constructor() : c = this, t instanceof Q) {
537
537
  const { dim: d } = t;
538
538
  switch (e) {
539
539
  case "*":
@@ -618,7 +618,7 @@ class ne extends ue {
618
618
  return this._array.slice();
619
619
  }
620
620
  }
621
- class Q extends ue {
621
+ class Q extends de {
622
622
  constructor(e) {
623
623
  super(), this.dim = e;
624
624
  }
@@ -629,9 +629,9 @@ class Q extends ue {
629
629
  operate(e, t, s) {
630
630
  const { dim: i, _array: a } = this;
631
631
  let o;
632
- typeof t == "number" ? o = Array.from({ length: i }, () => t) : t instanceof ne || t instanceof Q ? o = t.toArray() : o = t;
632
+ typeof t == "number" ? o = Array.from({ length: i }, () => t) : t instanceof le || t instanceof Q ? o = t.toArray() : o = t;
633
633
  let n, l = [];
634
- if (s ? s instanceof Q ? n = s : l = s : n = this, t instanceof ne) {
634
+ if (s ? s instanceof Q ? n = s : l = s : n = this, t instanceof le) {
635
635
  const { cols: c } = t;
636
636
  switch (e) {
637
637
  case "*":
@@ -929,7 +929,7 @@ class ee {
929
929
  }
930
930
  }
931
931
  wi([Pi]);
932
- class oe {
932
+ class ne {
933
933
  get value() {
934
934
  return this._value;
935
935
  }
@@ -1005,13 +1005,13 @@ class oe {
1005
1005
  return [this.r, this.g, this.b, this.a];
1006
1006
  }
1007
1007
  }
1008
- class ea extends ne {
1008
+ class ea extends le {
1009
1009
  constructor(e) {
1010
1010
  super(4, 4, e);
1011
1011
  }
1012
1012
  }
1013
1013
  const ar = pr / 180, dc = 180 / pr;
1014
- function le(r, e, t) {
1014
+ function ce(r, e, t) {
1015
1015
  return Math.max(e, Math.min(r, t));
1016
1016
  }
1017
1017
  function A(r, e, t) {
@@ -1035,7 +1035,7 @@ class ta extends Q {
1035
1035
  super(4), this.set(e, t, s, i);
1036
1036
  }
1037
1037
  }
1038
- class ps extends ne {
1038
+ class ps extends le {
1039
1039
  constructor(e) {
1040
1040
  super(4, 5, e);
1041
1041
  }
@@ -1165,7 +1165,7 @@ class ps extends ne {
1165
1165
  ]);
1166
1166
  }
1167
1167
  sepia(e = 1) {
1168
- const t = le(e, 0, 1);
1168
+ const t = ce(e, 0, 1);
1169
1169
  return this.multiply([
1170
1170
  A(1, 0.393, t),
1171
1171
  A(0, 0.7689999, t),
@@ -1214,7 +1214,7 @@ class ps extends ne {
1214
1214
  ]);
1215
1215
  }
1216
1216
  grayscale(e = 1) {
1217
- const t = le(e, 0, 1), s = A(1, 0.3, t), i = A(0, 0.3, t), a = A(1, 0.59, t), o = A(0, 0.59, t), n = A(1, 0.11, t), l = A(0, 0.11, t);
1217
+ const t = ce(e, 0, 1), s = A(1, 0.3, t), i = A(0, 0.3, t), a = A(1, 0.59, t), o = A(0, 0.59, t), n = A(1, 0.11, t), l = A(0, 0.11, t);
1218
1218
  return this.multiply([
1219
1219
  s,
1220
1220
  o,
@@ -1293,12 +1293,12 @@ class ps extends ne {
1293
1293
  return new ta(e[4] / 255, e[9] / 255, e[14] / 255, e[19] / 255);
1294
1294
  }
1295
1295
  }
1296
- class pc extends ne {
1296
+ class pc extends le {
1297
1297
  constructor(e) {
1298
1298
  super(2, 2, e);
1299
1299
  }
1300
1300
  }
1301
- class _s extends ne {
1301
+ class _s extends le {
1302
1302
  constructor(e) {
1303
1303
  super(3, 3, e);
1304
1304
  }
@@ -1428,8 +1428,8 @@ class ra extends _s {
1428
1428
  ]);
1429
1429
  }
1430
1430
  }
1431
- class I extends _s {
1432
- static _t2d = /* @__PURE__ */ new I();
1431
+ class M extends _s {
1432
+ static _t2d = /* @__PURE__ */ new M();
1433
1433
  premultiply(e) {
1434
1434
  return e.multiply(this, this);
1435
1435
  }
@@ -1440,7 +1440,7 @@ class I extends _s {
1440
1440
  return this.skew(0, e);
1441
1441
  }
1442
1442
  skew(e, t) {
1443
- return this.premultiply(I._t2d.makeSkew(e, t));
1443
+ return this.premultiply(M._t2d.makeSkew(e, t));
1444
1444
  }
1445
1445
  makeSkew(e, t) {
1446
1446
  const s = Math.tan(e), i = Math.tan(t);
@@ -1469,7 +1469,7 @@ class I extends _s {
1469
1469
  return this.translate(e, t, s);
1470
1470
  }
1471
1471
  translate(e, t, s = 0) {
1472
- return this.premultiply(I._t2d.makeTranslation(e, t, s));
1472
+ return this.premultiply(M._t2d.makeTranslation(e, t, s));
1473
1473
  }
1474
1474
  makeTranslation(e, t, s = 0) {
1475
1475
  return this.set([
@@ -1494,7 +1494,7 @@ class I extends _s {
1494
1494
  return this.scale(e, t, s);
1495
1495
  }
1496
1496
  scale(e, t, s = 1) {
1497
- return this.premultiply(I._t2d.makeScale(e, t, s));
1497
+ return this.premultiply(M._t2d.makeScale(e, t, s));
1498
1498
  }
1499
1499
  makeScale(e, t, s = 1) {
1500
1500
  return this.set([
@@ -1519,7 +1519,7 @@ class I extends _s {
1519
1519
  return this.rotate(e);
1520
1520
  }
1521
1521
  rotate(e) {
1522
- return this.premultiply(I._t2d.makeRotation(e));
1522
+ return this.premultiply(M._t2d.makeRotation(e));
1523
1523
  }
1524
1524
  rotate3d(e, t, s, i) {
1525
1525
  const [a, o, n] = this._rotate3d(e, t, s, i);
@@ -1681,7 +1681,7 @@ function oa(r, e) {
1681
1681
  let t = Fr[r];
1682
1682
  return t === void 0 && (Jt[e] === void 0 && (Jt[e] = 1), Fr[r] = t = Jt[e]++), t;
1683
1683
  }
1684
- class W extends ue {
1684
+ class W extends de {
1685
1685
  get _gl() {
1686
1686
  return this._renderer.gl;
1687
1687
  }
@@ -3774,7 +3774,7 @@ var qa = Object.defineProperty, ys = (r, e, t, s) => {
3774
3774
  (o = r[a]) && (i = o(e, t, i) || i);
3775
3775
  return i && qa(e, t, i), i;
3776
3776
  };
3777
- class We extends de {
3777
+ class We extends fe {
3778
3778
  constructor(e) {
3779
3779
  super(), this.setProperties(e);
3780
3780
  }
@@ -3790,7 +3790,7 @@ var Ya = Object.defineProperty, Gt = (r, e, t, s) => {
3790
3790
  (o = r[a]) && (i = o(e, t, i) || i);
3791
3791
  return i && Ya(e, t, i), i;
3792
3792
  };
3793
- class ke extends de {
3793
+ class ke extends fe {
3794
3794
  constructor(e = {}) {
3795
3795
  super(), this.setProperties(e);
3796
3796
  }
@@ -3815,7 +3815,7 @@ var Ka = Object.defineProperty, xs = (r, e, t, s) => {
3815
3815
  (o = r[a]) && (i = o(e, t, i) || i);
3816
3816
  return i && Ka(e, t, i), i;
3817
3817
  };
3818
- class xe extends de {
3818
+ class xe extends fe {
3819
3819
  constructor(e) {
3820
3820
  super(), this.setProperties(e);
3821
3821
  }
@@ -3831,7 +3831,7 @@ var Za = Object.defineProperty, Ue = (r, e, t, s) => {
3831
3831
  (o = r[a]) && (i = o(e, t, i) || i);
3832
3832
  return i && Za(e, t, i), i;
3833
3833
  };
3834
- class H extends de {
3834
+ class H extends fe {
3835
3835
  constructor(e) {
3836
3836
  super(), this.setProperties(e);
3837
3837
  }
@@ -3887,7 +3887,7 @@ function eo() {
3887
3887
  tint: new Float32Array([1, 1, 1, 1])
3888
3888
  };
3889
3889
  }
3890
- class E extends de {
3890
+ class E extends fe {
3891
3891
  static instance = new this();
3892
3892
  glProgram;
3893
3893
  constructor(e = {}) {
@@ -4075,7 +4075,7 @@ var io = Object.defineProperty, Ee = (r, e, t, s) => {
4075
4075
  (o = r[a]) && (i = o(e, t, i) || i);
4076
4076
  return i && io(e, t, i), i;
4077
4077
  };
4078
- class re extends de {
4078
+ class re extends fe {
4079
4079
  get valid() {
4080
4080
  return !!(this.width && this.height);
4081
4081
  }
@@ -4115,7 +4115,7 @@ var ao = Object.defineProperty, N = (r, e, t, s) => {
4115
4115
  (o = r[a]) && (i = o(e, t, i) || i);
4116
4116
  return i && ao(e, t, i), i;
4117
4117
  };
4118
- class x extends de {
4118
+ class x extends fe {
4119
4119
  static get EMPTY() {
4120
4120
  return new this({ width: 1, height: 1 });
4121
4121
  }
@@ -4230,7 +4230,7 @@ N([
4230
4230
  N([
4231
4231
  h({ fallback: !1 })
4232
4232
  ], x.prototype, "isPowerOfTwo");
4233
- class oo extends de {
4233
+ class oo extends fe {
4234
4234
  frames;
4235
4235
  frameIndex = 0;
4236
4236
  get currentFrame() {
@@ -4280,12 +4280,12 @@ class ws extends x {
4280
4280
  class vr extends x {
4281
4281
  static _cached = /* @__PURE__ */ new Map();
4282
4282
  static get(e) {
4283
- const t = new oe(e), s = t.toHex();
4283
+ const t = new ne(e), s = t.toHex();
4284
4284
  let i = this._cached.get(s);
4285
4285
  return i || (i = new vr(t), this._cached.set(s, i)), i;
4286
4286
  }
4287
4287
  constructor(e) {
4288
- const t = e instanceof oe ? e : new oe(e);
4288
+ const t = e instanceof ne ? e : new ne(e);
4289
4289
  super({
4290
4290
  width: 1,
4291
4291
  height: 1,
@@ -4641,7 +4641,7 @@ class po extends Pe {
4641
4641
  return { internalKey: `____${e}` };
4642
4642
  }
4643
4643
  }
4644
- var _o = Object.defineProperty, mo = Object.getOwnPropertyDescriptor, fe = (r, e, t, s) => {
4644
+ var _o = Object.defineProperty, mo = Object.getOwnPropertyDescriptor, ie = (r, e, t, s) => {
4645
4645
  for (var i = s > 1 ? void 0 : s ? mo(e, t) : e, a = r.length - 1, o; a >= 0; a--)
4646
4646
  (o = r[a]) && (i = (s ? o(e, t, i) : o(i)) || i);
4647
4647
  return s && i && _o(e, t, i), i;
@@ -4651,7 +4651,7 @@ function go(r) {
4651
4651
  let e = jr[r] ?? 0;
4652
4652
  return e++, jr[r] = e, e;
4653
4653
  }
4654
- let M = class extends Pe {
4654
+ let I = class extends Pe {
4655
4655
  _meta = new po(this);
4656
4656
  get meta() {
4657
4657
  return this._meta;
@@ -4851,6 +4851,16 @@ let M = class extends Pe {
4851
4851
  n.emit("process", r);
4852
4852
  }), t && (e.renderStack.currentCall = o), s && (this.emit("processed", r), e?.emit("nodeProcessed", this));
4853
4853
  }
4854
+ requestRender() {
4855
+ this.needsRender = !0;
4856
+ }
4857
+ _updateProperty(r, e, t) {
4858
+ switch (super._updateProperty(r, e, t), r) {
4859
+ case "needsRender":
4860
+ e && this._parent?.requestRender();
4861
+ break;
4862
+ }
4863
+ }
4854
4864
  render(r, e) {
4855
4865
  const t = this.mask;
4856
4866
  t && (r.flush(), r.mask.push(this, t)), this._render(r), e?.(), t && (r.flush(), r.mask.pop(this));
@@ -4873,7 +4883,7 @@ let M = class extends Pe {
4873
4883
  this.getNode(r)?.remove();
4874
4884
  }
4875
4885
  addSibling(r) {
4876
- return this.equal(r) || !this.hasParent() || r.hasParent() ? this : (r.internalMode = this.internalMode, this._parent.moveChild(r, this.getIndex() + 1), this);
4886
+ return this.equal(r) || !this.hasParent() ? this : (r.internalMode = this.internalMode, this._parent.moveChild(r, this.getIndex() + 1), this);
4877
4887
  }
4878
4888
  prepend(...r) {
4879
4889
  let e;
@@ -4884,7 +4894,7 @@ let M = class extends Pe {
4884
4894
  append(...r) {
4885
4895
  let e;
4886
4896
  Array.isArray(r[0]) ? e = r[0] : e = r, e.forEach((t) => {
4887
- t instanceof M ? this.appendChild(t) : this.appendChild(M.parse(t));
4897
+ t instanceof I ? this.appendChild(t) : this.appendChild(I.parse(t));
4888
4898
  });
4889
4899
  }
4890
4900
  before(...r) {
@@ -4903,9 +4913,9 @@ let M = class extends Pe {
4903
4913
  return !e.hasParent() || !this.equal(e.parent) || this.moveChild(r, e.getIndex()), r;
4904
4914
  }
4905
4915
  appendChild(r, e = r.internalMode) {
4906
- if (this.equal(r) || r.hasParent())
4916
+ if (this.equal(r))
4907
4917
  return r;
4908
- switch (e) {
4918
+ switch (r.hasParent() && r.remove(), e) {
4909
4919
  case "front":
4910
4920
  this._children.front.push(r);
4911
4921
  break;
@@ -4919,8 +4929,9 @@ let M = class extends Pe {
4919
4929
  return r.internalMode !== e && (r.internalMode = e), r.setParent(this), this.emit("appendChild", r), r;
4920
4930
  }
4921
4931
  moveChild(r, e, t = r.internalMode) {
4922
- if (this.equal(r) || r.hasParent() && !this.equal(r.parent))
4932
+ if (this.equal(r))
4923
4933
  return this;
4934
+ r.hasParent() && !this.equal(r.parent) && r.remove();
4924
4935
  const s = this._children.getInternal(r.internalMode), i = s.indexOf(r), a = this._children.getInternal(t);
4925
4936
  return (r.internalMode !== t || e !== i) && (i > -1 && s.splice(i, 1), r.setParent(this), e > -1 && e < a.length ? a.splice(e, 0, r) : a.push(r), i > -1 ? this.emit("moveChild", r, e, i) : this.emit("appendChild", r)), r.internalMode !== t && (r.internalMode = t), this;
4926
4937
  }
@@ -4982,6 +4993,7 @@ let M = class extends Pe {
4982
4993
  }
4983
4994
  // eslint-disable-next-line unused-imports/no-unused-vars
4984
4995
  _render(r) {
4996
+ this.needsRender = !1;
4985
4997
  }
4986
4998
  destroy() {
4987
4999
  super.destroy(), this._children.internal.forEach((r) => this.removeChild(r));
@@ -5000,46 +5012,49 @@ let M = class extends Pe {
5000
5012
  meta: this.meta.toJSON()
5001
5013
  });
5002
5014
  }
5003
- static parse(r) {
5015
+ static parse(r, e = "Node") {
5004
5016
  if (Array.isArray(r))
5005
- return r.map((n) => this.parse(n));
5006
- const { is: e, meta: t = {}, children: s, ...i } = r, a = fr.get(e ?? t.inCanvasIs ?? "Node") ?? M, o = new a({ ...i, meta: t });
5007
- return s?.forEach((n) => o.appendChild(this.parse(n))), o;
5017
+ return r.map((l) => this.parse(l));
5018
+ const { is: t, meta: s = {}, children: i, ...a } = r, o = fr.get(t ?? s.inCanvasIs ?? e) ?? I, n = new o({ ...a, meta: s });
5019
+ return i?.forEach((l) => n.appendChild(this.parse(l))), n;
5008
5020
  }
5009
5021
  };
5010
- fe([
5022
+ ie([
5011
5023
  h({ fallback: as() })
5012
- ], M.prototype, "id", 2);
5013
- fe([
5024
+ ], I.prototype, "id", 2);
5025
+ ie([
5014
5026
  h({ fallback: as() })
5015
- ], M.prototype, "name", 2);
5016
- fe([
5027
+ ], I.prototype, "name", 2);
5028
+ ie([
5017
5029
  h({ fallback: "inherit" })
5018
- ], M.prototype, "processMode", 2);
5019
- fe([
5030
+ ], I.prototype, "processMode", 2);
5031
+ ie([
5020
5032
  h({ fallback: "default" })
5021
- ], M.prototype, "processSortMode", 2);
5022
- fe([
5033
+ ], I.prototype, "processSortMode", 2);
5034
+ ie([
5023
5035
  h({ fallback: "inherit" })
5024
- ], M.prototype, "renderMode", 2);
5025
- fe([
5036
+ ], I.prototype, "renderMode", 2);
5037
+ ie([
5026
5038
  h({ fallback: "inherit" })
5027
- ], M.prototype, "inputMode", 2);
5028
- fe([
5039
+ ], I.prototype, "inputMode", 2);
5040
+ ie([
5029
5041
  h({ fallback: "default" })
5030
- ], M.prototype, "internalMode", 2);
5031
- fe([
5042
+ ], I.prototype, "internalMode", 2);
5043
+ ie([
5032
5044
  h({ internal: !0 })
5033
- ], M.prototype, "mask", 2);
5034
- M = fe([
5045
+ ], I.prototype, "mask", 2);
5046
+ ie([
5047
+ h({ internal: !0, default: !0 })
5048
+ ], I.prototype, "needsRender", 2);
5049
+ I = ie([
5035
5050
  b("Node")
5036
- ], M);
5051
+ ], I);
5037
5052
  var vo = Object.defineProperty, bo = Object.getOwnPropertyDescriptor, qe = (r, e, t, s) => {
5038
5053
  for (var i = s > 1 ? void 0 : s ? bo(e, t) : e, a = r.length - 1, o; a >= 0; a--)
5039
5054
  (o = r[a]) && (i = (s ? o(e, t, i) : o(i)) || i);
5040
5055
  return s && i && vo(e, t, i), i;
5041
5056
  };
5042
- let q = class extends M {
5057
+ let q = class extends I {
5043
5058
  constructor(r, e = []) {
5044
5059
  super(), this.setProperties(r).append(e);
5045
5060
  }
@@ -5057,7 +5072,7 @@ let q = class extends M {
5057
5072
  return this._parent?.globalStartTime ?? 0;
5058
5073
  }
5059
5074
  get currentTime() {
5060
- return le(this._currentTime, 0, this._duration);
5075
+ return ce(this._currentTime, 0, this._duration);
5061
5076
  }
5062
5077
  get globalStartTime() {
5063
5078
  return this._globalStartTime;
@@ -5069,7 +5084,7 @@ let q = class extends M {
5069
5084
  return this._globalStartTime + this._duration;
5070
5085
  }
5071
5086
  get currentTimeProgress() {
5072
- return this._duration ? le(this._currentTime / this._duration, 0, 1) : 0;
5087
+ return this._duration ? ce(this._currentTime / this._duration, 0, 1) : 0;
5073
5088
  }
5074
5089
  isInsideTimeRange() {
5075
5090
  const r = this._currentTime;
@@ -5123,10 +5138,10 @@ let Ge = class extends q {
5123
5138
  // Batch render
5124
5139
  context = new uo();
5125
5140
  _resetContext = !0;
5126
- needsRender = !0;
5141
+ needsDraw = !0;
5127
5142
  needsLayout = !1;
5128
5143
  needsPaint = !1;
5129
- _rawBatchables = [];
5144
+ _drawBatchables = [];
5130
5145
  _layoutBatchables = [];
5131
5146
  _batchables = [];
5132
5147
  constructor(r, e = []) {
@@ -5158,21 +5173,21 @@ let Ge = class extends q {
5158
5173
  canRender() {
5159
5174
  return super.canRender() && this.isVisibleInTree();
5160
5175
  }
5161
- requestRender() {
5162
- this.needsRender = !0;
5176
+ requestDraw() {
5177
+ this.needsDraw = !0, this.requestRender();
5163
5178
  }
5164
5179
  requestLayout() {
5165
- this.needsLayout = !0;
5180
+ this.needsLayout = !0, this.requestRender();
5166
5181
  }
5167
5182
  requestPaint() {
5168
- this.needsPaint = !0;
5183
+ this.needsPaint = !0, this.requestRender();
5169
5184
  }
5170
5185
  _updateGlobalVisible() {
5171
5186
  this._parentGlobalVisible = this.getParent()?.globalVisible, this._globalVisible = (this._parentGlobalVisible ?? !0) && this.visible && this.insideTimeRange;
5172
5187
  }
5173
5188
  _updateGlobalOpacity() {
5174
5189
  this._parentGlobalOpacity = this.getParent()?.opacity;
5175
- const r = le(this.opacity, 0, 1) * (this._parentGlobalOpacity ?? 1);
5190
+ const r = ce(this.opacity, 0, 1) * (this._parentGlobalOpacity ?? 1);
5176
5191
  this._globalOpacity !== r && (this._globalOpacity = r, this.requestPaint());
5177
5192
  }
5178
5193
  _draw() {
@@ -5210,14 +5225,17 @@ let Ge = class extends q {
5210
5225
  this._parentGlobalVisible !== e?.globalVisible && this._updateGlobalVisible(), this._parentGlobalOpacity !== e?.globalOpacity && this._updateGlobalOpacity();
5211
5226
  }
5212
5227
  _updateBatchables() {
5213
- const r = this.needsRender;
5228
+ if (!this.needsRender)
5229
+ return;
5230
+ this.needsRender = !1;
5231
+ const r = this.needsDraw;
5214
5232
  let e = this.needsLayout, t = this.needsPaint, s;
5215
- r && (this._rawBatchables = this._redraw(), e = !0), e && (this._layoutBatchables = this._relayout(this._rawBatchables), t = !0), t && (s = this._repaint(this._layoutBatchables)), r && this._resetContext && this.context.reset(), s && (this._batchables = s, this.needsRender = !1, this.needsLayout = !1, this.needsPaint = !1);
5233
+ r && (this._drawBatchables = this._redraw(), e = !0), e && (this._layoutBatchables = this._relayout(this._drawBatchables), t = !0), t && (s = this._repaint(this._layoutBatchables)), r && this._resetContext && this.context.reset(), s && (this._batchables = s, this.needsDraw = !1, this.needsLayout = !1, this.needsPaint = !1);
5216
5234
  }
5217
5235
  _handleViewportTexture(r) {
5218
5236
  const e = this.tree?.getPreviousViewport();
5219
5237
  if (e && "getRect" in this) {
5220
- const { a: t, d: s, tx: i, ty: a } = e.canvasTransform.toObject(), { vertices: o } = r, n = new I().scale(1 / e.width * t, -1 / e.height * s).translate(
5238
+ const { a: t, d: s, tx: i, ty: a } = e.canvasTransform.toObject(), { vertices: o } = r, n = new M().scale(1 / e.width * t, -1 / e.height * s).translate(
5221
5239
  - -i / e.width,
5222
5240
  1 + -a / e.height
5223
5241
  ), l = new Float32Array(o.length);
@@ -5259,8 +5277,8 @@ var wo = Object.defineProperty, Po = Object.getOwnPropertyDescriptor, Be = (r, e
5259
5277
  (o = r[a]) && (i = (s ? o(e, t, i) : o(i)) || i);
5260
5278
  return s && i && wo(e, t, i), i;
5261
5279
  };
5262
- let X = class extends M {
5263
- canvasTransform = new I();
5280
+ let X = class extends I {
5281
+ canvasTransform = new M();
5264
5282
  renderTargetIndex = 0;
5265
5283
  renderTargets = [
5266
5284
  new re(),
@@ -5363,7 +5381,6 @@ var Eo = Object.defineProperty, So = Object.getOwnPropertyDescriptor, _t = (r, e
5363
5381
  };
5364
5382
  let T = class extends q {
5365
5383
  material;
5366
- needsRender = !0;
5367
5384
  get _effectMode() {
5368
5385
  return this.effectMode ?? "parent";
5369
5386
  }
@@ -5380,9 +5397,6 @@ let T = class extends q {
5380
5397
  constructor(r, e = []) {
5381
5398
  super(), this._onProcessing = this._onProcessing.bind(this), this._onNodeProcessed = this._onNodeProcessed.bind(this), this.setProperties(r).append(e);
5382
5399
  }
5383
- requestRender() {
5384
- this.needsRender = !0;
5385
- }
5386
5400
  _updateProperty(r, e, t) {
5387
5401
  switch (super._updateProperty(r, e, t), r) {
5388
5402
  case "glsl": {
@@ -5610,10 +5624,10 @@ var Ro = Object.defineProperty, Ao = Object.getOwnPropertyDescriptor, Ye = (r, e
5610
5624
  (o = r[a]) && (i = (s ? o(e, t, i) : o(i)) || i);
5611
5625
  return s && i && Ro(e, t, i), i;
5612
5626
  };
5613
- let ce = class extends M {
5627
+ let he = class extends I {
5614
5628
  static from(r, e = !1) {
5615
5629
  const [t, s] = r ? Array.isArray(r) ? r : [0, r] : [];
5616
- return new ce({
5630
+ return new he({
5617
5631
  startTime: t,
5618
5632
  endTime: s,
5619
5633
  loop: e
@@ -5635,7 +5649,7 @@ let ce = class extends M {
5635
5649
  addTime(r) {
5636
5650
  const e = this.startTime, t = this.endTime;
5637
5651
  let s = this.currentTime;
5638
- return s = s + r, this.loop && s > t && (s = e + s % t), s = le(s, e, t), this.currentTime = s, this.emit("updateCurrentTime", s, r), this;
5652
+ return s = s + r, this.loop && s > t && (s = e + s % t), s = ce(s, e, t), this.currentTime = s, this.emit("updateCurrentTime", s, r), this;
5639
5653
  }
5640
5654
  _process(r) {
5641
5655
  super._process(r), this.paused || this.addTime(r);
@@ -5643,22 +5657,22 @@ let ce = class extends M {
5643
5657
  };
5644
5658
  Ye([
5645
5659
  h({ fallback: 0 })
5646
- ], ce.prototype, "startTime", 2);
5660
+ ], he.prototype, "startTime", 2);
5647
5661
  Ye([
5648
5662
  h({ fallback: 0 })
5649
- ], ce.prototype, "currentTime", 2);
5663
+ ], he.prototype, "currentTime", 2);
5650
5664
  Ye([
5651
5665
  h({ fallback: Number.MAX_SAFE_INTEGER })
5652
- ], ce.prototype, "endTime", 2);
5666
+ ], he.prototype, "endTime", 2);
5653
5667
  Ye([
5654
5668
  h({ fallback: !1 })
5655
- ], ce.prototype, "loop", 2);
5669
+ ], he.prototype, "loop", 2);
5656
5670
  Ye([
5657
5671
  h({ fallback: !1 })
5658
- ], ce.prototype, "paused", 2);
5659
- ce = Ye([
5672
+ ], he.prototype, "paused", 2);
5673
+ he = Ye([
5660
5674
  b("Timeline")
5661
- ], ce);
5675
+ ], he);
5662
5676
  var Co = Object.getOwnPropertyDescriptor, Oo = (r, e, t, s) => {
5663
5677
  for (var i = s > 1 ? void 0 : s ? Co(e, t) : e, a = r.length - 1, o; a >= 0; a--)
5664
5678
  (o = r[a]) && (i = o(i) || i);
@@ -5687,7 +5701,7 @@ class pe extends mr {
5687
5701
  input = new Ji();
5688
5702
  renderStack = new To();
5689
5703
  root = new nr().setTree(this);
5690
- _backgroundColor = new oe();
5704
+ _backgroundColor = new ne();
5691
5705
  _previousViewport;
5692
5706
  _currentViewport;
5693
5707
  getPreviousViewport() {
@@ -5752,7 +5766,7 @@ Se([
5752
5766
  h({ internal: !0, default: () => xi })
5753
5767
  ], pe.prototype, "fonts");
5754
5768
  Se([
5755
- h({ internal: !0, default: () => new ce() })
5769
+ h({ internal: !0, default: () => new he() })
5756
5770
  ], pe.prototype, "timeline");
5757
5771
  var Io = Object.getOwnPropertyDescriptor, Mo = (r, e, t, s) => {
5758
5772
  for (var i = s > 1 ? void 0 : s ? Io(e, t) : e, a = r.length - 1, o; a >= 0; a--)
@@ -5781,12 +5795,12 @@ let De = class extends Ge {
5781
5795
  scale = new C(1, 1).on("update", () => this.updateGlobalTransform());
5782
5796
  skew = new C().on("update", () => this.updateGlobalTransform());
5783
5797
  pivot = new C().on("update", () => this.updateGlobalTransform());
5784
- extraTransform = new I();
5785
- transform = new I();
5798
+ extraTransform = new M();
5799
+ transform = new M();
5786
5800
  globalPosition = new C();
5787
5801
  globalScale = new C();
5788
5802
  globalSkew = new C();
5789
- globalTransform = new I();
5803
+ globalTransform = new M();
5790
5804
  _parentTransformDirtyId;
5791
5805
  constructor(r, e = []) {
5792
5806
  super(), this.setProperties(r).append(e);
@@ -5858,7 +5872,7 @@ var Uo = Object.defineProperty, Bo = Object.getOwnPropertyDescriptor, wr = (r, e
5858
5872
  return s && i && Uo(e, t, i), i;
5859
5873
  };
5860
5874
  let Mt = class extends De {
5861
- canvasTransform = new I();
5875
+ canvasTransform = new M();
5862
5876
  _screenOffset = { x: 0, y: 0 };
5863
5877
  _zoom = new C(1, 1).on("update", () => this.updateTransform());
5864
5878
  get zoom() {
@@ -5904,8 +5918,8 @@ let Mt = class extends De {
5904
5918
  }
5905
5919
  setZoom(r, e = r) {
5906
5920
  return this._zoom.set(
5907
- le(r, this._minZoom.x, this._maxZoom.x),
5908
- le(e, this._minZoom.y, this._maxZoom.y)
5921
+ ce(r, this._minZoom.x, this._maxZoom.x),
5922
+ ce(e, this._minZoom.y, this._maxZoom.y)
5909
5923
  ), this;
5910
5924
  }
5911
5925
  _input(r, e) {
@@ -6033,7 +6047,7 @@ function vc(r) {
6033
6047
  }
6034
6048
  return e;
6035
6049
  }
6036
- function Lo(r, e, t, s = new I()) {
6050
+ function Lo(r, e, t, s = new M()) {
6037
6051
  return r = !r || r === "none" ? "" : r, Ft(r, { width: e, height: t }).reverse().forEach(({ name: i, args: a }) => {
6038
6052
  const o = a.map((n) => n.normalizedIntValue);
6039
6053
  switch (i) {
@@ -6307,7 +6321,7 @@ var As = Object.defineProperty, jo = Object.getOwnPropertyDescriptor, Wo = (r, e
6307
6321
  }, qo = (r, e, t) => Wo(r, e + "", t);
6308
6322
  const ot = 50;
6309
6323
  let He = class extends T {
6310
- _color = new oe();
6324
+ _color = new ne();
6311
6325
  constructor(r, e = []) {
6312
6326
  super(), this.setProperties(r).append(e);
6313
6327
  }
@@ -6391,7 +6405,7 @@ var Cs = Object.defineProperty, Yo = Object.getOwnPropertyDescriptor, Ko = (r, e
6391
6405
  return s && i && Cs(e, t, i), i;
6392
6406
  }, Zo = (r, e, t) => Ko(r, e + "", t);
6393
6407
  let Xe = class extends T {
6394
- _color = new oe();
6408
+ _color = new ne();
6395
6409
  constructor(r, e = []) {
6396
6410
  super(), this.setProperties(r).append(e);
6397
6411
  }
@@ -6461,7 +6475,7 @@ var Os = Object.defineProperty, Jo = Object.getOwnPropertyDescriptor, Qo = (r, e
6461
6475
  }, en = (r, e, t) => Qo(r, e + "", t);
6462
6476
  const st = 50;
6463
6477
  let je = class extends T {
6464
- _color = new oe();
6478
+ _color = new ne();
6465
6479
  constructor(r, e = []) {
6466
6480
  super(), this.setProperties(r).append(e);
6467
6481
  }
@@ -6832,7 +6846,7 @@ void main(void) {
6832
6846
  gl_FragColor += texture2D(sampler, vUv[8]) * 0.028532;
6833
6847
  }
6834
6848
  }`;
6835
- let he = class extends T {
6849
+ let ue = class extends T {
6836
6850
  constructor(r, e = []) {
6837
6851
  super(), this.setProperties(r).append(e);
6838
6852
  }
@@ -6840,21 +6854,21 @@ let he = class extends T {
6840
6854
  const t = 1 / e.width, s = 1 / e.height, i = Math.max(this.quality, 1);
6841
6855
  for (let a = 0; a < i; a++)
6842
6856
  e.redraw(r, () => {
6843
- P.draw(r, he.materialX, {
6857
+ P.draw(r, ue.materialX, {
6844
6858
  sampler: 0,
6845
6859
  uStrength: t * (this.strength / i)
6846
6860
  });
6847
6861
  });
6848
6862
  for (let a = 0; a < i; a++)
6849
6863
  e.redraw(r, () => {
6850
- P.draw(r, he.materialY, {
6864
+ P.draw(r, ue.materialY, {
6851
6865
  sampler: 0,
6852
6866
  uStrength: s * (this.strength / i)
6853
6867
  });
6854
6868
  });
6855
6869
  }
6856
6870
  };
6857
- Ms(he, "materialX", new E({
6871
+ Ms(ue, "materialX", new E({
6858
6872
  gl: {
6859
6873
  vertex: `attribute vec2 position;
6860
6874
  attribute vec2 uv;
@@ -6876,7 +6890,7 @@ void main(void) {
6876
6890
  fragment: Ns
6877
6891
  }
6878
6892
  }));
6879
- Ms(he, "materialY", new E({
6893
+ Ms(ue, "materialY", new E({
6880
6894
  gl: {
6881
6895
  vertex: `attribute vec2 position;
6882
6896
  attribute vec2 uv;
@@ -6900,22 +6914,22 @@ void main(void) {
6900
6914
  }));
6901
6915
  Tr([
6902
6916
  h({ fallback: 4 })
6903
- ], he.prototype, "strength", 2);
6917
+ ], ue.prototype, "strength", 2);
6904
6918
  Tr([
6905
6919
  h({ fallback: 3 })
6906
- ], he.prototype, "quality", 2);
6907
- he = Tr([
6920
+ ], ue.prototype, "quality", 2);
6921
+ ue = Tr([
6908
6922
  b("GaussianBlurEffect")
6909
- ], he);
6923
+ ], ue);
6910
6924
  var ks = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, cn = (r, e, t) => e in r ? ks(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Ke = (r, e, t, s) => {
6911
6925
  for (var i = s > 1 ? void 0 : s ? ln(e, t) : e, a = r.length - 1, o; a >= 0; a--)
6912
6926
  (o = r[a]) && (i = (s ? o(e, t, i) : o(i)) || i);
6913
6927
  return s && i && ks(e, t, i), i;
6914
6928
  }, hn = (r, e, t) => cn(r, e + "", t);
6915
6929
  let se = class extends T {
6916
- blurEffect = new he();
6930
+ blurEffect = new ue();
6917
6931
  viewport3 = new X();
6918
- _color = new oe();
6932
+ _color = new ne();
6919
6933
  constructor(r, e = []) {
6920
6934
  super(), this.setProperties(r).append(e);
6921
6935
  }
@@ -7034,7 +7048,7 @@ Bs([
7034
7048
  ct = Bs([
7035
7049
  b("EmbossEffect")
7036
7050
  ], ct);
7037
- var Ls = Object.defineProperty, pn = Object.getOwnPropertyDescriptor, _n = (r, e, t) => e in r ? Ls(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ie = (r, e, t, s) => {
7051
+ var Ls = Object.defineProperty, pn = Object.getOwnPropertyDescriptor, _n = (r, e, t) => e in r ? Ls(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ae = (r, e, t, s) => {
7038
7052
  for (var i = s > 1 ? void 0 : s ? pn(e, t) : e, a = r.length - 1, o; a >= 0; a--)
7039
7053
  (o = r[a]) && (i = (s ? o(e, t, i) : o(i)) || i);
7040
7054
  return s && i && Ls(e, t, i), i;
@@ -7187,34 +7201,34 @@ void main(void) {
7187
7201
  }`
7188
7202
  }
7189
7203
  }));
7190
- ie([
7204
+ ae([
7191
7205
  h({ fallback: 10 })
7192
7206
  ], G.prototype, "slices", 2);
7193
- ie([
7207
+ ae([
7194
7208
  h({ fallback: 512 })
7195
7209
  ], G.prototype, "sampleSize", 2);
7196
- ie([
7210
+ ae([
7197
7211
  h({ fallback: 100 })
7198
7212
  ], G.prototype, "offset", 2);
7199
- ie([
7213
+ ae([
7200
7214
  h({ fallback: 0 })
7201
7215
  ], G.prototype, "direction", 2);
7202
- ie([
7216
+ ae([
7203
7217
  h({ fallback: 2 })
7204
7218
  ], G.prototype, "fillMode", 2);
7205
- ie([
7219
+ ae([
7206
7220
  h({ fallback: 0 })
7207
7221
  ], G.prototype, "seed", 2);
7208
- ie([
7222
+ ae([
7209
7223
  h({ default: () => [2, 2] })
7210
7224
  ], G.prototype, "red", 2);
7211
- ie([
7225
+ ae([
7212
7226
  h({ default: () => [-10, 4] })
7213
7227
  ], G.prototype, "green", 2);
7214
- ie([
7228
+ ae([
7215
7229
  h({ default: () => [10, -4] })
7216
7230
  ], G.prototype, "blue", 2);
7217
- G = ie([
7231
+ G = ae([
7218
7232
  b("GlitchEffect")
7219
7233
  ], G);
7220
7234
  var Fs = Object.defineProperty, gn = Object.getOwnPropertyDescriptor, vn = (r, e, t) => e in r ? Fs(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Re = (r, e, t, s) => {
@@ -7633,7 +7647,7 @@ let L = class extends T {
7633
7647
  )).toFixed(7)
7634
7648
  );
7635
7649
  }
7636
- _color = new oe();
7650
+ _color = new ne();
7637
7651
  constructor(r, e = []) {
7638
7652
  super(), this.setProperties(r).append(e), this.material = new E({
7639
7653
  gl: {
@@ -8157,7 +8171,7 @@ class Ar {
8157
8171
  function Nt(r, e) {
8158
8172
  const { x: t, y: s, width: i, height: a } = e;
8159
8173
  let o = !1;
8160
- const n = new I().translate(-t, -s).scale(1 / i, 1 / a);
8174
+ const n = new M().translate(-t, -s).scale(1 / i, 1 / a);
8161
8175
  if (r.cropRect) {
8162
8176
  const {
8163
8177
  left: g = 0,
@@ -8229,7 +8243,7 @@ class F extends Pe {
8229
8243
  case "tile":
8230
8244
  case "opacity":
8231
8245
  case "enabled":
8232
- this.parent.requestRender();
8246
+ this.parent.requestDraw();
8233
8247
  break;
8234
8248
  case "image":
8235
8249
  case "linearGradient":
@@ -8257,7 +8271,7 @@ class F extends Pe {
8257
8271
  }
8258
8272
  }
8259
8273
  async _updateTexture() {
8260
- await this.loadTexture(), this.parent.requestRender();
8274
+ await this.loadTexture(), this.parent.requestDraw();
8261
8275
  }
8262
8276
  isValid() {
8263
8277
  return !!(this.enabled && (this.texture || this.animatedTexture || this.color || this.image === "viewport"));
@@ -8291,7 +8305,7 @@ class F extends Pe {
8291
8305
  i = o;
8292
8306
  break;
8293
8307
  }
8294
- return this.animatedTexture.frameIndex !== i && (this.animatedTexture.frameIndex = i, this.parent.requestRender()), this;
8308
+ return this.animatedTexture.frameIndex !== i && (this.animatedTexture.frameIndex = i, this.parent.requestDraw()), this;
8295
8309
  }
8296
8310
  process(e) {
8297
8311
  this.updateFrameIndex();
@@ -8344,7 +8358,7 @@ class js extends F {
8344
8358
  _updateProperty(e, t, s) {
8345
8359
  switch (super._updateProperty(e, t, s), e) {
8346
8360
  case "fillWithShape":
8347
- this.parent.requestRender();
8361
+ this.parent.requestDraw();
8348
8362
  break;
8349
8363
  }
8350
8364
  }
@@ -8366,7 +8380,7 @@ class Ws extends F {
8366
8380
  _updateProperty(e, t, s) {
8367
8381
  switch (super._updateProperty(e, t, s), e) {
8368
8382
  case "fillWithShape":
8369
- this.parent.requestRender();
8383
+ this.parent.requestDraw();
8370
8384
  break;
8371
8385
  }
8372
8386
  }
@@ -8392,7 +8406,7 @@ class Ze extends F {
8392
8406
  case "lineCap":
8393
8407
  case "lineJoin":
8394
8408
  case "enabled":
8395
- this.parent.requestRender();
8409
+ this.parent.requestDraw();
8396
8410
  break;
8397
8411
  }
8398
8412
  }
@@ -8487,7 +8501,7 @@ class Qe extends Pe {
8487
8501
  case "paths":
8488
8502
  case "viewBox":
8489
8503
  case "enabled":
8490
- this._updatePath2DSet(), this.parent.requestRender();
8504
+ this._updatePath2DSet(), this.parent.requestDraw();
8491
8505
  break;
8492
8506
  }
8493
8507
  }
@@ -8539,7 +8553,7 @@ bt([
8539
8553
  bt([
8540
8554
  h()
8541
8555
  ], Qe.prototype, "paths");
8542
- class cr extends de {
8556
+ class cr extends fe {
8543
8557
  constructor(e) {
8544
8558
  super(), this.setProperties(e);
8545
8559
  }
@@ -8558,7 +8572,7 @@ var jn = Object.defineProperty, me = (r, e, t, s) => {
8558
8572
  (o = r[a]) && (i = o(e, t, i) || i);
8559
8573
  return i && jn(e, t, i), i;
8560
8574
  };
8561
- class ae extends Pe {
8575
+ class oe extends Pe {
8562
8576
  constructor(e) {
8563
8577
  super(), this.parent = e, this.base = new Ri(), this.base.setPropertyAccessor(this);
8564
8578
  }
@@ -8577,7 +8591,7 @@ class ae extends Pe {
8577
8591
  _updateProperty(e, t, s) {
8578
8592
  switch (super._updateProperty(e, t, s), e) {
8579
8593
  case "enabled":
8580
- this.parent.requestRender();
8594
+ this.parent.requestDraw();
8581
8595
  break;
8582
8596
  case "effects":
8583
8597
  case "measureDom":
@@ -8595,7 +8609,7 @@ class ae extends Pe {
8595
8609
  this.base.fonts = this.base.fonts ?? this.parent.tree?.fonts, this.base.update(), this._texture.width = Math.ceil(this.base.boundingBox.width), this._texture.height = Math.ceil(this.base.boundingBox.height), this.base.render({
8596
8610
  view: this._texture.source,
8597
8611
  pixelRatio: this._texture.pixelRatio
8598
- }), this._texture.requestUpdate("source"), this.parent.requestRender();
8612
+ }), this._texture.requestUpdate("source"), this.parent.requestDraw();
8599
8613
  }
8600
8614
  _updateTextureMap() {
8601
8615
  this._textureMap.clear();
@@ -8622,7 +8636,7 @@ class ae extends Pe {
8622
8636
  t && Object.keys(t).length > 0 && (this._textureMap.set(e, {
8623
8637
  texture: await this._loadTexture(t, s),
8624
8638
  box: s
8625
- }), this.parent.requestRender());
8639
+ }), this.parent.requestDraw());
8626
8640
  }
8627
8641
  async _loadTexture(e, t) {
8628
8642
  return e.linearGradient || e.radialGradient ? new Vt(
@@ -8644,7 +8658,7 @@ class ae extends Pe {
8644
8658
  const e = this.parent;
8645
8659
  if (e.scale.x > 0 && e.scale.y > 0)
8646
8660
  return;
8647
- const t = e.scale.x * e.scale.y, s = e.pivot, i = new I().translate(-s.x, -s.y).scale(t > 0 ? 1 : -1, 1).translate(s.x, s.y), { a, c: o, tx: n, b: l, d: c, ty: u } = i.toObject();
8661
+ const t = e.scale.x * e.scale.y, s = e.pivot, i = new M().translate(-s.x, -s.y).scale(t > 0 ? 1 : -1, 1).translate(s.x, s.y), { a, c: o, tx: n, b: l, d: c, ty: u } = i.toObject();
8648
8662
  let d, f;
8649
8663
  return (m, p) => {
8650
8664
  d = m[p], f = m[p + 1], m[p] = a * d + o * f + n, m[p + 1] = l * d + c * f + u;
@@ -8708,7 +8722,7 @@ class ae extends Pe {
8708
8722
  _textureDraw(e) {
8709
8723
  const { left: t = 0, top: s = 0, width: i, height: a } = this.base.boundingBox;
8710
8724
  e.fillStyle = this._texture, e.rect(t, s, i, a);
8711
- const o = new I().translate(-t, -s).scale(1 / i, 1 / a), { a: n, c: l, tx: c, b: u, d, ty: f } = o.toObject();
8725
+ const o = new M().translate(-t, -s).scale(1 / i, 1 / a), { a: n, c: l, tx: c, b: u, d, ty: f } = o.toObject();
8712
8726
  let m, p;
8713
8727
  e.fill({
8714
8728
  transformUv: (_, g) => {
@@ -8726,38 +8740,38 @@ class ae extends Pe {
8726
8740
  const { width: t, height: s } = this.base.boundingBox, i = this.parent.getViewport();
8727
8741
  if (i) {
8728
8742
  const { a, d: o } = i.canvasTransform.toObject(), n = this._autoDrawMode;
8729
- t * a < this._autoDrawThreshold || s * o < this._autoDrawThreshold ? this._autoDrawMode = "texture" : this._autoDrawMode = "path", n !== this._autoDrawMode && this.parent.requestRender();
8743
+ t * a < this._autoDrawThreshold || s * o < this._autoDrawThreshold ? this._autoDrawMode = "texture" : this._autoDrawMode = "path", n !== this._autoDrawMode && this.parent.requestDraw();
8730
8744
  }
8731
8745
  }
8732
8746
  }
8733
8747
  }
8734
8748
  me([
8735
8749
  h({ fallback: !0 })
8736
- ], ae.prototype, "enabled");
8750
+ ], oe.prototype, "enabled");
8737
8751
  me([
8738
8752
  h({ fallback: () => [] })
8739
- ], ae.prototype, "content");
8753
+ ], oe.prototype, "content");
8740
8754
  me([
8741
8755
  h({ alias: "parent.style.json" })
8742
- ], ae.prototype, "style");
8756
+ ], oe.prototype, "style");
8743
8757
  me([
8744
8758
  h()
8745
- ], ae.prototype, "effects");
8759
+ ], oe.prototype, "effects");
8746
8760
  me([
8747
8761
  h()
8748
- ], ae.prototype, "fill");
8762
+ ], oe.prototype, "fill");
8749
8763
  me([
8750
8764
  h()
8751
- ], ae.prototype, "outline");
8765
+ ], oe.prototype, "outline");
8752
8766
  me([
8753
8767
  h({ alias: "base.measureDom" })
8754
- ], ae.prototype, "measureDom");
8768
+ ], oe.prototype, "measureDom");
8755
8769
  me([
8756
8770
  h({ alias: "base.fonts" })
8757
- ], ae.prototype, "fonts");
8771
+ ], oe.prototype, "fonts");
8758
8772
  me([
8759
8773
  h({ fallback: "auto" })
8760
- ], ae.prototype, "drawMode");
8774
+ ], oe.prototype, "drawMode");
8761
8775
  var Wn = Object.defineProperty, qn = Object.getOwnPropertyDescriptor, qs = (r, e, t, s) => {
8762
8776
  for (var i = s > 1 ? void 0 : s ? qn(e, t) : e, a = r.length - 1, o; a >= 0; a--)
8763
8777
  (o = r[a]) && (i = (s ? o(e, t, i) : o(i)) || i);
@@ -8767,7 +8781,7 @@ const Yn = new Set(Object.keys(bi())), Kn = new Set(Object.keys(vi()));
8767
8781
  let te = class extends De {
8768
8782
  _flex = new Ar(this);
8769
8783
  size = new C().on("update", () => {
8770
- this.onUpdateStyleProperty("transform", this.style.transform, void 0), this.onUpdateStyleProperty("transformOrigin", this.style.transformOrigin, void 0), this.updateGlobalTransform(), this.requestRender();
8784
+ this.onUpdateStyleProperty("transform", this.style.transform, void 0), this.onUpdateStyleProperty("transformOrigin", this.style.transformOrigin, void 0), this.updateGlobalTransform(), this.requestDraw();
8771
8785
  });
8772
8786
  _allowPointerEvents = !0;
8773
8787
  _overflowHidden = !1;
@@ -8815,7 +8829,7 @@ let te = class extends De {
8815
8829
  set foreground(r) {
8816
8830
  this._foreground.resetProperties().setProperties(r);
8817
8831
  }
8818
- _text = new ae(this);
8832
+ _text = new oe(this);
8819
8833
  get text() {
8820
8834
  return this._text;
8821
8835
  }
@@ -8883,10 +8897,10 @@ let te = class extends De {
8883
8897
  this.rotation = e * ar;
8884
8898
  break;
8885
8899
  case "scaleX":
8886
- this.scale.x = e, this.text.isValid() && (e ^ t) < 0 && this.requestRender();
8900
+ this.scale.x = e, this.text.isValid() && (e ^ t) < 0 && this.requestDraw();
8887
8901
  break;
8888
8902
  case "scaleY":
8889
- this.scale.y = e, this.text.isValid() && (e ^ t) < 0 && this.requestRender();
8903
+ this.scale.y = e, this.text.isValid() && (e ^ t) < 0 && this.requestDraw();
8890
8904
  break;
8891
8905
  case "skewX":
8892
8906
  this.skew.x = e;
@@ -8947,7 +8961,7 @@ let te = class extends De {
8947
8961
  this._allowPointerEvents = !V(e);
8948
8962
  break;
8949
8963
  case "borderRadius":
8950
- this.requestRender();
8964
+ this.requestDraw();
8951
8965
  break;
8952
8966
  }
8953
8967
  (Kn.has(r) || Yn.has(r)) && this.text.isValid() && this.text.update(), this._flex.updateStyleProperty(r, e, t), this._flex._node?.isDirty() && this.requestLayout();
@@ -9157,10 +9171,10 @@ let hr = class extends Ys {
9157
9171
  }
9158
9172
  }
9159
9173
  async _load() {
9160
- this.animation = await $.lottie.load(this.src, this.texture.source), this.duration = this.animation.getDuration(!1) * 1e3, this.texture.requestUpdate("source"), this.requestRender();
9174
+ this.animation = await $.lottie.load(this.src, this.texture.source), this.duration = this.animation.getDuration(!1) * 1e3, this.texture.requestUpdate("source"), this.requestDraw();
9161
9175
  }
9162
9176
  _process(r) {
9163
- this.animation?.goToAndStop(this.currentTime, !1), this.texture.requestUpdate("source"), this.requestRender(), super._process(r);
9177
+ this.animation?.goToAndStop(this.currentTime, !1), this.texture.requestUpdate("source"), this.requestDraw(), super._process(r);
9164
9178
  }
9165
9179
  };
9166
9180
  Ks([
@@ -9182,7 +9196,7 @@ class tl extends te {
9182
9196
  switch (super._updateStyleProperty(e, t, s), e) {
9183
9197
  case "width":
9184
9198
  case "height":
9185
- this.requestRender();
9199
+ this.requestDraw();
9186
9200
  break;
9187
9201
  }
9188
9202
  }
@@ -9224,7 +9238,7 @@ let ur = class extends Ys {
9224
9238
  return this._wait;
9225
9239
  }
9226
9240
  async _load(r) {
9227
- this.texture = await $.video.load(r), (!this.style.width || !this.style.height) && (this.style.width = this.texture.width, this.style.height = this.texture.height), this.requestRender();
9241
+ this.texture = await $.video.load(r), (!this.style.width || !this.style.height) && (this.style.width = this.texture.width, this.style.height = this.texture.height), this.requestDraw();
9228
9242
  }
9229
9243
  _updateVideoCurrentTime() {
9230
9244
  let r = this._currentTime;
@@ -9355,7 +9369,7 @@ let dt = class extends q {
9355
9369
  }
9356
9370
  const r = this._getTargets(), e = 1 / r.length, t = this.currentTimeProgress;
9357
9371
  r.forEach((s, i) => {
9358
- const a = e === 1 ? t : le(Math.max(0, t - e * i) / e, 0, 1), o = this._cachedProps.get(s);
9372
+ const a = e === 1 ? t : ce(Math.max(0, t - e * i) / e, 0, 1), o = this._cachedProps.get(s);
9359
9373
  if (!o)
9360
9374
  return;
9361
9375
  const n = this._parseKeyframes(a, o);
@@ -9490,7 +9504,7 @@ dt = Xt([
9490
9504
  duration: 2e3
9491
9505
  })
9492
9506
  ], dt);
9493
- class Cr extends ue {
9507
+ class Cr extends de {
9494
9508
  static _instance;
9495
9509
  static get instance() {
9496
9510
  return this._instance || (this._instance = new Cr()), this._instance;
@@ -9521,7 +9535,7 @@ class Cr extends ue {
9521
9535
  return this.paused = !this.paused, this.refreshPaused(), this.paused;
9522
9536
  }
9523
9537
  }
9524
- class kt extends ue {
9538
+ class kt extends de {
9525
9539
  static PADDING = 0.1;
9526
9540
  _source = null;
9527
9541
  _audio = null;
@@ -9688,7 +9702,7 @@ class ul {
9688
9702
  return new kt();
9689
9703
  }
9690
9704
  }
9691
- class Js extends ue {
9705
+ class Js extends de {
9692
9706
  constructor(e, t) {
9693
9707
  super(), this._input = e, this._output = t;
9694
9708
  }
@@ -9830,7 +9844,7 @@ class Ce extends Js {
9830
9844
  e.setValueAtTime ? e.setValueAtTime(t, this._context.currentTime) : e.value = t;
9831
9845
  }
9832
9846
  }
9833
- class pl extends ue {
9847
+ class pl extends de {
9834
9848
  _audio = null;
9835
9849
  _sourceNode = null;
9836
9850
  _gain = null;
@@ -10248,7 +10262,7 @@ let ft = class extends te {
10248
10262
  a.fillRect(f, m, p, _), c = 1, u = -1;
10249
10263
  }
10250
10264
  }
10251
- this._src?.requestUpdate("source"), this.requestRender();
10265
+ this._src?.requestUpdate("source"), this.requestDraw();
10252
10266
  }
10253
10267
  _process(r) {
10254
10268
  this.syncTexture(), super._process(r);
@@ -10672,7 +10686,7 @@ function Zl(r) {
10672
10686
  return e;
10673
10687
  }
10674
10688
  const Rt = "WeakRef" in globalThis;
10675
- class Jl extends ue {
10689
+ class Jl extends de {
10676
10690
  defaultHandler = (e) => e;
10677
10691
  _handlers = /* @__PURE__ */ new Map();
10678
10692
  _handleing = /* @__PURE__ */ new Map();
@@ -10989,7 +11003,7 @@ export {
10989
11003
  uo as CanvasContext,
10990
11004
  Ge as CanvasItem,
10991
11005
  ws as CanvasTexture,
10992
- oe as Color,
11006
+ ne as Color,
10993
11007
  j as ColorAdjustEffect,
10994
11008
  $e as ColorFilterEffect,
10995
11009
  ps as ColorMatrix,
@@ -11012,12 +11026,12 @@ export {
11012
11026
  Je as Element2DShadow,
11013
11027
  Qe as Element2DShape,
11014
11028
  cr as Element2DStyle,
11015
- ae as Element2DText,
11029
+ oe as Element2DText,
11016
11030
  ct as EmbossEffect,
11017
11031
  Or as Engine,
11018
11032
  Ar as FlexLayout,
11019
11033
  Wa as FontLoader,
11020
- he as GaussianBlurEffect,
11034
+ ue as GaussianBlurEffect,
11021
11035
  ke as Geometry,
11022
11036
  $l as GifLoader,
11023
11037
  Pa as GlBatch2DSystem,
@@ -11058,13 +11072,13 @@ export {
11058
11072
  mr as MainLoop,
11059
11073
  Ie as MaskEffect,
11060
11074
  E as Material,
11061
- ne as Matrix,
11075
+ le as Matrix,
11062
11076
  pc as Matrix2,
11063
11077
  _s as Matrix3,
11064
11078
  ea as Matrix4,
11065
11079
  po as Meta,
11066
11080
  fs as MouseInputEvent,
11067
- M as Node,
11081
+ I as Node,
11068
11082
  De as Node2D,
11069
11083
  Ot as Obb2D,
11070
11084
  L as OutlineEffect,
@@ -11080,7 +11094,7 @@ export {
11080
11094
  Qi as RefCounted,
11081
11095
  re as RenderTarget,
11082
11096
  gr as Renderer,
11083
- de as Resource,
11097
+ fe as Resource,
11084
11098
  ls as SUPPORTS_AUDIO_CONTEXT,
11085
11099
  Bi as SUPPORTS_CLICK_EVENTS,
11086
11100
  hc as SUPPORTS_CREATE_IMAGE_BITMAP,
@@ -11102,9 +11116,9 @@ export {
11102
11116
  Ys as TextureRect2D,
11103
11117
  B as Ticker,
11104
11118
  pt as TiltShiftTransition,
11105
- ce as Timeline,
11119
+ he as Timeline,
11106
11120
  q as TimelineNode,
11107
- I as Transform2D,
11121
+ M as Transform2D,
11108
11122
  tl as TransformRect2D,
11109
11123
  Ve as Transition,
11110
11124
  Lt as TwistTransition,
@@ -11130,7 +11144,7 @@ export {
11130
11144
  Le as alignMap,
11131
11145
  $ as assets,
11132
11146
  es as boxSizingMap,
11133
- le as clamp,
11147
+ ce as clamp,
11134
11148
  En as clampFrag,
11135
11149
  Hi as createHTMLCanvas,
11136
11150
  oa as createIdFromString,
@@ -29,10 +29,10 @@ export declare class CanvasItem extends TimelineNode {
29
29
  get globalOpacity(): number;
30
30
  context: CanvasContext;
31
31
  protected _resetContext: boolean;
32
- needsRender: boolean;
32
+ needsDraw: boolean;
33
33
  needsLayout: boolean;
34
34
  needsPaint: boolean;
35
- protected _rawBatchables: CanvasBatchable[];
35
+ protected _drawBatchables: CanvasBatchable[];
36
36
  protected _layoutBatchables: CanvasBatchable[];
37
37
  protected _batchables: CanvasBatchable[];
38
38
  constructor(properties?: Partial<CanvasItemProperties>, nodes?: Node[]);
@@ -41,7 +41,7 @@ export declare class CanvasItem extends TimelineNode {
41
41
  hide(): void;
42
42
  isVisibleInTree(): boolean;
43
43
  canRender(): boolean;
44
- requestRender(): void;
44
+ requestDraw(): void;
45
45
  requestLayout(): void;
46
46
  requestPaint(): void;
47
47
  protected _updateGlobalVisible(): void;
@@ -36,7 +36,6 @@ export declare class Effect extends TimelineNode implements Rectangulable {
36
36
  effectMode?: EffectMode;
37
37
  glsl?: string;
38
38
  glslSrc?: string;
39
- needsRender: boolean;
40
39
  protected get _effectMode(): EffectMode;
41
40
  /** Viewports */
42
41
  readonly viewport1: Viewport;
@@ -49,7 +48,6 @@ export declare class Effect extends TimelineNode implements Rectangulable {
49
48
  protected _nextSibling?: Node;
50
49
  protected _rect: RectangleLike;
51
50
  constructor(properties?: Partial<EffectProperties>, children?: Node[]);
52
- requestRender(): void;
53
51
  protected _updateProperty(key: string, value: any, oldValue: any): void;
54
52
  protected _treeEnter(tree: SceneTree): void;
55
53
  protected _treeExit(oldTree: SceneTree): void;
@@ -67,6 +67,7 @@ export declare class Node extends CoreObject {
67
67
  protected _meta: Meta;
68
68
  get meta(): Meta;
69
69
  set meta(value: Record<string, any>);
70
+ needsRender: boolean;
70
71
  protected _readyed: boolean;
71
72
  constructor(properties?: Partial<NodeProperties>, nodes?: Node[]);
72
73
  setProperties(properties?: Record<string, any>): this;
@@ -110,6 +111,8 @@ export declare class Node extends CoreObject {
110
111
  protected _onUnparented(oldParent: Node): void;
111
112
  protected _onReady(): void;
112
113
  protected _onProcess(delta?: number): void;
114
+ requestRender(): void;
115
+ protected _updateProperty(key: string, newValue: any, oldValue: any): void;
113
116
  render(renderer: GlRenderer, next?: () => void): void;
114
117
  input(event: InputEvent, key: InputEventKey): void;
115
118
  getIndex(): number;
@@ -145,5 +148,5 @@ export declare class Node extends CoreObject {
145
148
  destroy(): void;
146
149
  clone(): this;
147
150
  toJSON(): Record<string, any>;
148
- static parse(value: SerializedNode | SerializedNode[]): any;
151
+ static parse(value: SerializedNode | SerializedNode[], defaultInCanvasIs?: string): any;
149
152
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.14.9",
4
+ "version": "0.14.10",
5
5
  "packageManager": "pnpm@10.19.0",
6
6
  "description": "A JavaScript WebGL rendering engine. only the ESM.",
7
7
  "author": "wxm",