modern-canvas 0.21.1 → 0.21.2

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
@@ -6339,7 +6339,6 @@ var Y = class extends C {
6339
6339
  _instance;
6340
6340
  _container;
6341
6341
  _texture;
6342
- _node;
6343
6342
  _dirty = !1;
6344
6343
  _scheduled = !1;
6345
6344
  constructor(e) {
@@ -6401,26 +6400,26 @@ var Y = class extends C {
6401
6400
  width: e,
6402
6401
  height: t
6403
6402
  }), this._instance.setOption(this._toOption(), !0), !this._texture) {
6404
- let n = this._container.querySelector("canvas");
6405
- if (!n) return;
6403
+ let e = this._container.querySelector("canvas");
6404
+ if (!e) return;
6406
6405
  this._texture = new rr({
6407
- source: n,
6406
+ source: e,
6408
6407
  pixelRatio: 1
6409
6408
  });
6410
- let r = z.parse({
6411
- is: "TextureRect2D",
6412
- style: {
6413
- left: 0,
6414
- top: 0,
6415
- width: e,
6416
- height: t
6417
- }
6418
- }, "Element2D");
6419
- r.texture = this._texture, this._node = r, this._parent.appendChild(r, "back");
6420
6409
  }
6421
- this._node?.size.set(e, t), this._texture?.requestUpdate("source"), this._parent.requestDraw();
6410
+ this._texture.requestUpdate("source"), this._parent.requestDraw();
6422
6411
  }
6423
6412
  }
6413
+ draw() {
6414
+ let e = this._texture;
6415
+ if (!e?.isValid()) return;
6416
+ let { width: t, height: n } = this._parent.size, r = this._parent.context;
6417
+ this._parent.shape.draw(!0), r.fillStyle = e;
6418
+ let { a: i, c: a, tx: o, b: s, d: c, ty: l } = new v().scale(1 / t, 1 / n), u, d;
6419
+ r.fill({ transformUv: (e, t) => {
6420
+ u = e[t], d = e[t + 1], e[t] = i * u + a * d + o, e[t + 1] = s * u + c * d + l;
6421
+ } });
6422
+ }
6424
6423
  _toOption() {
6425
6424
  let { type: e, categories: t } = this, n = e === "pie" || e === "doughnut", r = e === "bar", i = this.grouping === "stacked" || this.grouping === "percentStacked", a = {
6426
6425
  title: this.title ? {
@@ -6465,7 +6464,7 @@ var Y = class extends C {
6465
6464
  })), a;
6466
6465
  }
6467
6466
  _teardown() {
6468
- this._instance?.dispose(), this._instance = void 0, this._container = void 0, this._texture = void 0, this._node &&= (this._parent.removeChild(this._node), this._node.destroy(), void 0);
6467
+ this._instance?.dispose(), this._instance = void 0, this._container = void 0, this._texture = void 0;
6469
6468
  }
6470
6469
  _destroy() {
6471
6470
  this._teardown();
@@ -7532,7 +7531,7 @@ var Z = {
7532
7531
  return new yt(this._getPointArray().map((e) => (e.x += t.x, e.y += t.y, e)), this.globalRotation);
7533
7532
  }
7534
7533
  _draw() {
7535
- super._draw(), this._background.isValid() && (this._shape.draw(!this._background.fillWithShape), this._background.draw()), this._fill.isValid() && (this._shape.draw(), this._fill.draw()), this._outline.isValid() && (this._shape.draw(), this._outline.draw()), this._foreground.isValid() && (this._shape.draw(!this._foreground.fillWithShape), this._foreground.draw()), this._text.isValid() && this._text.draw(), this._drawContent();
7534
+ super._draw(), this._background.isValid() && (this._shape.draw(!this._background.fillWithShape), this._background.draw()), this._fill.isValid() && (this._shape.draw(), this._fill.draw()), this._outline.isValid() && (this._shape.draw(), this._outline.draw()), this._foreground.isValid() && (this._shape.draw(!this._foreground.fillWithShape), this._foreground.draw()), this._text.isValid() && this._text.draw(), this._chart.isValid() && this._chart.draw(), this._drawContent();
7536
7535
  }
7537
7536
  _drawContent() {}
7538
7537
  input(e, t) {
@@ -7586,7 +7585,7 @@ var Z = {
7586
7585
  ya = O([x("Element2D"), D("design:paramtypes", [typeof (ma = typeof Partial < "u" && Partial) == "function" ? ma : Object, Array])], ya);
7587
7586
  //#endregion
7588
7587
  //#region src/scene/2d/TextureRect2D.ts
7589
- var ba, xa = class extends ya {
7588
+ var ba = class extends ya {
7590
7589
  texture;
7591
7590
  constructor(e, t = []) {
7592
7591
  super(), this.setProperties(e).append(t);
@@ -7600,11 +7599,7 @@ var ba, xa = class extends ya {
7600
7599
  } });
7601
7600
  }
7602
7601
  }
7603
- };
7604
- xa = O([x("TextureRect2D"), D("design:paramtypes", [typeof (ba = typeof Partial < "u" && Partial) == "function" ? ba : Object, Array])], xa);
7605
- //#endregion
7606
- //#region src/scene/2d/Lottie2D.ts
7607
- var Sa, Ca = class extends xa {
7602
+ }, xa, Sa = class extends ba {
7608
7603
  texture = new rr();
7609
7604
  animation;
7610
7605
  _lastTime = NaN;
@@ -7635,10 +7630,10 @@ var Sa, Ca = class extends xa {
7635
7630
  this.currentTime !== this._lastTime && (this._lastTime = this.currentTime, this.animation?.goToAndStop(this.currentTime, !1), this.texture.requestUpdate("source"), this.requestDraw()), super._process(e);
7636
7631
  }
7637
7632
  };
7638
- O([_({ fallback: "" }), D("design:type", String)], Ca.prototype, "src", void 0), Ca = O([x("Lottie2D"), D("design:paramtypes", [typeof (Sa = typeof Partial < "u" && Partial) == "function" ? Sa : Object, Array])], Ca);
7633
+ O([_({ fallback: "" }), D("design:type", String)], Sa.prototype, "src", void 0), Sa = O([x("Lottie2D"), D("design:paramtypes", [typeof (xa = typeof Partial < "u" && Partial) == "function" ? xa : Object, Array])], Sa);
7639
7634
  //#endregion
7640
7635
  //#region src/scene/2d/TransformRect2D.ts
7641
- var wa = class extends ya {
7636
+ var Ca = class extends ya {
7642
7637
  constructor(e, t = []) {
7643
7638
  super(), this.setProperties(e).append(t);
7644
7639
  }
@@ -7661,10 +7656,10 @@ var wa = class extends ya {
7661
7656
  this.context.rect(0, 0, e, t), this.context.strokeStyle = "#00FF00", this.context.stroke(), this._drawCircle(0, 0), this._drawCircle(e, t), this._drawCircle(0, t), this._drawEllipse(0, t / 2), this._drawCircle(e, 0), this._drawEllipse(e, t / 2);
7662
7657
  }
7663
7658
  };
7664
- O([_({ fallback: 6 }), D("design:type", Number)], wa.prototype, "handleSize", void 0);
7659
+ O([_({ fallback: 6 }), D("design:type", Number)], Ca.prototype, "handleSize", void 0);
7665
7660
  //#endregion
7666
7661
  //#region src/scene/2d/Video2D.ts
7667
- var Ta, Ea = class extends xa {
7662
+ var wa, Ta = class extends ba {
7668
7663
  get videoDuration() {
7669
7664
  return (this.texture?.duration ?? 0) * 1e3;
7670
7665
  }
@@ -7704,11 +7699,11 @@ var Ta, Ea = class extends xa {
7704
7699
  super._process(e), this._updateVideoCurrentTime();
7705
7700
  }
7706
7701
  };
7707
- O([_({ fallback: "" }), D("design:type", String)], Ea.prototype, "src", void 0), Ea = O([x("Video2D"), D("design:paramtypes", [typeof (Ta = typeof Partial < "u" && Partial) == "function" ? Ta : Object, Array])], Ea);
7702
+ O([_({ fallback: "" }), D("design:type", String)], Ta.prototype, "src", void 0), Ta = O([x("Video2D"), D("design:paramtypes", [typeof (wa = typeof Partial < "u" && Partial) == "function" ? wa : Object, Array])], Ta);
7708
7703
  //#endregion
7709
7704
  //#region src/scene/animation/Animation.ts
7710
- var Da, Oa = (e) => e, ka = Na(.25, .1, .25, 1), Aa = Na(.42, 0, 1, 1), ja = Na(0, 0, .58, 1), Ma = Na(.42, 0, .58, 1);
7711
- function Na(e, t, n, r) {
7705
+ var Ea, Da = (e) => e, Oa = Ma(.25, .1, .25, 1), ka = Ma(.42, 0, 1, 1), Aa = Ma(0, 0, .58, 1), ja = Ma(.42, 0, .58, 1);
7706
+ function Ma(e, t, n, r) {
7712
7707
  let i = 1e-6, a = 3 * e - 3 * n + 1, o = 3 * n - 6 * e, s = 3 * e, c = 3 * t - 3 * r + 1, l = 3 * r - 6 * t, u = 3 * t, d = (e) => (3 * a * e + 2 * o) * e + s, f = (e) => ((a * e + o) * e + s) * e, p = (e) => ((c * e + l) * e + u) * e;
7713
7708
  function m(e) {
7714
7709
  let t = e, n, r;
@@ -7728,13 +7723,13 @@ function Na(e, t, n, r) {
7728
7723
  }
7729
7724
  return (e) => p(m(e));
7730
7725
  }
7731
- var Pa = {
7732
- linear: Oa,
7733
- ease: ka,
7734
- easeIn: Aa,
7735
- easeOut: ja,
7736
- easeInOut: Ma
7737
- }, Fa = class extends B {
7726
+ var Na = {
7727
+ linear: Da,
7728
+ ease: Oa,
7729
+ easeIn: ka,
7730
+ easeOut: Aa,
7731
+ easeInOut: ja
7732
+ }, Pa = class extends B {
7738
7733
  _keyframes = [];
7739
7734
  _isFirstUpdatePosition = !1;
7740
7735
  _cachedProps = new t();
@@ -7817,10 +7812,10 @@ var Pa = {
7817
7812
  });
7818
7813
  }
7819
7814
  _parseEasing(e) {
7820
- if (!e) return Pa.linear;
7821
- if (e in Pa) return Pa[e];
7815
+ if (!e) return Na.linear;
7816
+ if (e in Na) return Na[e];
7822
7817
  let t = e.replace(/cubic-bezier\((.+)\)/, "$1").split(",").map((e) => Number(e));
7823
- return Na(t[0], t[1], t[2], t[3]);
7818
+ return Ma(t[0], t[1], t[2], t[3]);
7824
7819
  }
7825
7820
  _parseKeyframes(e, t) {
7826
7821
  let n, r = this._keyframes;
@@ -7898,14 +7893,14 @@ var Pa = {
7898
7893
  });
7899
7894
  }
7900
7895
  };
7901
- O([_({ fallback: "parent" }), D("design:type", Object)], Fa.prototype, "effectMode", void 0), O([_({ default: () => [] }), D("design:type", Array)], Fa.prototype, "keyframes", void 0), O([_(), D("design:type", Object)], Fa.prototype, "easing", void 0), Fa = O([x("Animation", {
7896
+ O([_({ fallback: "parent" }), D("design:type", Object)], Pa.prototype, "effectMode", void 0), O([_({ default: () => [] }), D("design:type", Array)], Pa.prototype, "keyframes", void 0), O([_(), D("design:type", Object)], Pa.prototype, "easing", void 0), Pa = O([x("Animation", {
7902
7897
  renderMode: "disabled",
7903
7898
  processSortMode: "parent-before",
7904
7899
  duration: 2e3
7905
- }), D("design:paramtypes", [typeof (Da = typeof Partial < "u" && Partial) == "function" ? Da : Object, Array])], Fa);
7900
+ }), D("design:paramtypes", [typeof (Ea = typeof Partial < "u" && Partial) == "function" ? Ea : Object, Array])], Pa);
7906
7901
  //#endregion
7907
7902
  //#region src/scene/audio/html/HTMLAudioContext.ts
7908
- var Ia = class t extends e {
7903
+ var Fa = class t extends e {
7909
7904
  static _instance;
7910
7905
  static get instance() {
7911
7906
  return this._instance ||= new t(), this._instance;
@@ -7935,7 +7930,7 @@ var Ia = class t extends e {
7935
7930
  togglePause() {
7936
7931
  return this.paused = !this.paused, this.refreshPaused(), this.paused;
7937
7932
  }
7938
- }, La = class t extends e {
7933
+ }, Ia = class t extends e {
7939
7934
  static PADDING = .1;
7940
7935
  _source = null;
7941
7936
  _audio = null;
@@ -8062,7 +8057,7 @@ var Ia = class t extends e {
8062
8057
  let e = this._source;
8063
8058
  e && (e.onended = null, e.onplay = null, e.onpause = null, this._stop()), this._source = null, this._playbackRate = 1, this._volume = 1, this._loop = !1, this._end = 0, this._start = 0, this._duration = 0, this._playing = !1, this._pausedReal = !1, this._paused = !1, this._muted = !1, this._audio &&= (this._audio.context.off("refresh", this.refresh), this._audio.context.off("refreshPaused", this.refreshPaused), null);
8064
8059
  }
8065
- }, Ra = class {
8060
+ }, La = class {
8066
8061
  parent;
8067
8062
  source = new globalThis.Audio();
8068
8063
  _src = "";
@@ -8079,7 +8074,7 @@ var Ia = class t extends e {
8079
8074
  return !!this.source && this.source.readyState === 4;
8080
8075
  }
8081
8076
  get context() {
8082
- return Ia.instance;
8077
+ return Fa.instance;
8083
8078
  }
8084
8079
  constructor(e) {
8085
8080
  this.parent = e;
@@ -8090,9 +8085,9 @@ var Ia = class t extends e {
8090
8085
  });
8091
8086
  }
8092
8087
  createSound() {
8093
- return new La();
8088
+ return new Ia();
8094
8089
  }
8095
- }, za = class extends e {
8090
+ }, Ra = class extends e {
8096
8091
  _input;
8097
8092
  _output;
8098
8093
  _processers = [];
@@ -8114,7 +8109,7 @@ var Ia = class t extends e {
8114
8109
  get destination() {
8115
8110
  return this._input;
8116
8111
  }
8117
- }, Ba = class {
8112
+ }, za = class {
8118
8113
  destination;
8119
8114
  source;
8120
8115
  constructor(e, t = null) {
@@ -8129,21 +8124,21 @@ var Ia = class t extends e {
8129
8124
  };
8130
8125
  //#endregion
8131
8126
  //#region src/scene/audio/web/WebAudioContext.ts
8132
- function Va() {
8127
+ function Ba() {
8133
8128
  if (ze) return new AudioContext();
8134
8129
  if (Be) {
8135
8130
  let e = globalThis.webkitAudioContext;
8136
8131
  return new e();
8137
8132
  } else throw Error("Failed to createAudioContext");
8138
8133
  }
8139
- function Ha(e, t, n) {
8134
+ function Va(e, t, n) {
8140
8135
  if (Ve) return new OfflineAudioContext(e, t, n);
8141
8136
  if (He) {
8142
8137
  let r = globalThis.webkitOfflineAudioContext;
8143
8138
  return new r(e, t, n);
8144
8139
  } else throw Error("Failed to createOfflineAudioContext");
8145
8140
  }
8146
- var Ua = class e extends za {
8141
+ var Ha = class e extends Ra {
8147
8142
  static _instance;
8148
8143
  static get instance() {
8149
8144
  return this._instance ||= new e(), this._instance;
@@ -8184,7 +8179,7 @@ var Ua = class e extends za {
8184
8179
  _compressor;
8185
8180
  _analyser;
8186
8181
  constructor() {
8187
- let e = Va(), t = Ha(1, 2, Ve ? Math.max(8e3, Math.min(96e3, e.sampleRate)) : 44100), n = e.createDynamicsCompressor(), r = e.createAnalyser();
8182
+ let e = Ba(), t = Va(1, 2, Ve ? Math.max(8e3, Math.min(96e3, e.sampleRate)) : 44100), n = e.createDynamicsCompressor(), r = e.createAnalyser();
8188
8183
  r.connect(n), n.connect(e.destination), super(r, n), this._context = e, this._offlineContext = t, this._compressor = n, this._analyser = r, this._locked = e.state === "suspended" && (Ie || Le), We && (this._locked && (this._unlock(), document.addEventListener("mousedown", this._unlock, !0), document.addEventListener("touchstart", this._unlock, !0), document.addEventListener("touchend", this._unlock, !0)), globalThis.addEventListener("focus", this._onFocus), globalThis.addEventListener("blur", this._onBlur));
8189
8184
  }
8190
8185
  _onFocus() {
@@ -8225,7 +8220,7 @@ var Ua = class e extends za {
8225
8220
  setParamValue(e, t) {
8226
8221
  e.setValueAtTime ? e.setValueAtTime(t, this._context.currentTime) : e.value = t;
8227
8222
  }
8228
- }, Wa = class extends e {
8223
+ }, Ua = class extends e {
8229
8224
  _audio = null;
8230
8225
  _sourceNode = null;
8231
8226
  _gain = null;
@@ -8358,7 +8353,7 @@ var Ua = class e extends za {
8358
8353
  destroy() {
8359
8354
  super.destroy(), this._stop(), this._gain?.disconnect(), this._gain = null, this._audio?.context.off("refresh", this.refresh), this._audio?.context.off("refreshPaused", this.refreshPaused), this._audio = null, this._processors.forEach((e) => e.disconnect()), this._processors.length = 0, this._end = 0, this._playbackRate = 1, this._volume = 1, this._loop = !1, this._elapsed = 0, this._duration = 0, this._paused = !1, this._muted = !1, this._pausedReal = !1;
8360
8355
  }
8361
- }, Ga = class extends za {
8356
+ }, Wa = class extends Ra {
8362
8357
  parent;
8363
8358
  _sourceBuffer;
8364
8359
  _sourceNode;
@@ -8366,7 +8361,7 @@ var Ua = class e extends za {
8366
8361
  gain;
8367
8362
  analyser;
8368
8363
  get context() {
8369
- return Ua.instance;
8364
+ return Ha.instance;
8370
8365
  }
8371
8366
  get isPlayable() {
8372
8367
  return !!this._sourceNode.buffer;
@@ -8381,8 +8376,8 @@ var Ua = class e extends za {
8381
8376
  this._sourceNode.buffer = e;
8382
8377
  }
8383
8378
  constructor(e) {
8384
- let t = Ua.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
8385
- n.connect(i), i.connect(r), r.connect(Ua.instance.destination), super(i, r), this.parent = e, this._sourceNode = n, this.gain = r, this.analyser = i;
8379
+ let t = Ha.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
8380
+ n.connect(i), i.connect(r), r.connect(Ha.instance.destination), super(i, r), this.parent = e, this._sourceNode = n, this.gain = r, this.analyser = i;
8386
8381
  }
8387
8382
  async load() {
8388
8383
  return this._sourceLoad ||= new Promise((e) => {
@@ -8395,7 +8390,7 @@ var Ua = class e extends za {
8395
8390
  });
8396
8391
  }
8397
8392
  _decode(e) {
8398
- return Promise.resolve(e instanceof AudioBuffer ? e : Ua.decode(e)).then((e) => (this.parent.isLoaded = !0, this.buffer = e, e));
8393
+ return Promise.resolve(e instanceof AudioBuffer ? e : Ha.decode(e)).then((e) => (this.parent.isLoaded = !0, this.buffer = e, e));
8399
8394
  }
8400
8395
  cloneSource() {
8401
8396
  let e = this.context, t = this._sourceNode, n = e.audioContext.createBufferSource(), r = e.audioContext.createGain();
@@ -8405,15 +8400,15 @@ var Ua = class e extends za {
8405
8400
  };
8406
8401
  }
8407
8402
  createSound() {
8408
- return new Wa();
8403
+ return new Ua();
8409
8404
  }
8410
- }, Ka, qa = class extends B {
8405
+ }, Ga, Ka = class extends B {
8411
8406
  static {
8412
- Ka = this;
8407
+ Ga = this;
8413
8408
  }
8414
8409
  static _soundPool = [];
8415
8410
  _sounds = [];
8416
- _platformAudio = Ue ? new Ga(this) : new Ra(this);
8411
+ _platformAudio = Ue ? new Wa(this) : new La(this);
8417
8412
  get platformAudio() {
8418
8413
  return this._platformAudio;
8419
8414
  }
@@ -8506,7 +8501,7 @@ var Ua = class e extends za {
8506
8501
  this._sounds.length = 0;
8507
8502
  }
8508
8503
  _createSound() {
8509
- return Ka._soundPool.length > 0 ? Ka._soundPool.pop().init(this._platformAudio) : this._platformAudio.createSound().init(this._platformAudio);
8504
+ return Ga._soundPool.length > 0 ? Ga._soundPool.pop().init(this._platformAudio) : this._platformAudio.createSound().init(this._platformAudio);
8510
8505
  }
8511
8506
  refresh() {
8512
8507
  for (let e = this._sounds.length, t = 0; t < e; t++) this._sounds[t].refresh();
@@ -8522,7 +8517,7 @@ var Ua = class e extends za {
8522
8517
  this._recycleSound(e);
8523
8518
  };
8524
8519
  _recycleSound(e) {
8525
- e.destroy(), Ka._soundPool.includes(e) || Ka._soundPool.push(e);
8520
+ e.destroy(), Ga._soundPool.includes(e) || Ga._soundPool.push(e);
8526
8521
  }
8527
8522
  _prevTime = 0;
8528
8523
  _timer = 0;
@@ -8538,10 +8533,10 @@ var Ua = class e extends za {
8538
8533
  }, 100);
8539
8534
  }
8540
8535
  };
8541
- qa = Ka = O([x("Audio"), D("design:paramtypes", [Object])], qa);
8536
+ Ka = Ga = O([x("Audio"), D("design:paramtypes", [Object])], Ka);
8542
8537
  //#endregion
8543
8538
  //#region src/scene/audio/AudioSpectrum.ts
8544
- var Ja = class extends Pr {}, Ya, Xa = class extends ya {
8539
+ var qa = class extends Pr {}, Ja, Ya = class extends ya {
8545
8540
  _audioBuffer;
8546
8541
  _src = (() => {
8547
8542
  let e = tt();
@@ -8565,7 +8560,7 @@ var Ja = class extends Pr {}, Ya, Xa = class extends ya {
8565
8560
  }
8566
8561
  }
8567
8562
  async _loadSrc(e) {
8568
- await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) => Ua.decode(e)).then((e) => {
8563
+ await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) => Ha.decode(e)).then((e) => {
8569
8564
  this._audioBuffer = e, this.syncTexture(!0);
8570
8565
  });
8571
8566
  }
@@ -8600,12 +8595,12 @@ var Ja = class extends Pr {}, Ya, Xa = class extends ya {
8600
8595
  this.syncTexture(), super._process(e);
8601
8596
  }
8602
8597
  };
8603
- O([_(), D("design:type", Object)], Xa.prototype, "src", void 0), O([_({ fallback: 0 }), D("design:type", Number)], Xa.prototype, "gap", void 0), O([_({ fallback: "#000000" }), D("design:type", String)], Xa.prototype, "color", void 0), Xa = O([x("AudioWaveform"), D("design:paramtypes", [typeof (Ya = typeof Partial < "u" && Partial) == "function" ? Ya : Object])], Xa);
8598
+ O([_(), D("design:type", Object)], Ya.prototype, "src", void 0), O([_({ fallback: 0 }), D("design:type", Number)], Ya.prototype, "gap", void 0), O([_({ fallback: "#000000" }), D("design:type", String)], Ya.prototype, "color", void 0), Ya = O([x("AudioWaveform"), D("design:paramtypes", [typeof (Ja = typeof Partial < "u" && Partial) == "function" ? Ja : Object])], Ya);
8604
8599
  //#endregion
8605
8600
  //#region src/scene/transitions/KawaseTransition.ts
8606
- var Za, Qa = class extends Mr {
8601
+ var Xa, Za = class extends Mr {
8607
8602
  static {
8608
- Za = this;
8603
+ Xa = this;
8609
8604
  }
8610
8605
  blur = 10;
8611
8606
  quality = 10;
@@ -8624,7 +8619,7 @@ var Za, Qa = class extends Mr {
8624
8619
  let d = 1 / s, f = 1 / c, p = [], m, h = o - 1;
8625
8620
  for (let e = 0; e < h; e++) m = u[e] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p });
8626
8621
  m = u[h] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p }), l.forEach((t) => {
8627
- I.draw(e, Za.material, {
8622
+ I.draw(e, Xa.material, {
8628
8623
  sampler: r,
8629
8624
  progress: i,
8630
8625
  ...t
@@ -8632,31 +8627,31 @@ var Za, Qa = class extends Mr {
8632
8627
  });
8633
8628
  }
8634
8629
  };
8635
- Qa = Za = O([x("KawaseTransition")], Qa);
8630
+ Za = Xa = O([x("KawaseTransition")], Za);
8636
8631
  //#endregion
8637
8632
  //#region src/scene/transitions/LeftEraseTransition.ts
8638
- var $a, eo = class extends Mr {
8633
+ var Qa, $a = class extends Mr {
8639
8634
  static {
8640
- $a = this;
8635
+ Qa = this;
8641
8636
  }
8642
8637
  static material = new F({ gl: {
8643
8638
  vertex: "attribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
8644
8639
  fragment: "precision highp float;\nvarying vec2 vUv;\nuniform float progress;\nuniform sampler2D previous;\nuniform sampler2D next;\n\nfloat easeInOutQuint(float t) {\n return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;\n}\n\nvoid main() {\n vec4 src1Color = texture2D(previous, vUv);\n vec4 src2Color = texture2D(next, vUv);\n float mProgress = 1.0 - progress;\n float mixPercent = 0.0;\n if (vUv.x <= mProgress) {\n mixPercent = 1.0;\n }\n gl_FragColor = mix(src2Color, src1Color, mixPercent);\n}"
8645
8640
  } });
8646
8641
  apply(e) {
8647
- I.draw(e, $a.material, {
8642
+ I.draw(e, Qa.material, {
8648
8643
  previous: 0,
8649
8644
  next: 1,
8650
8645
  progress: this.currentTimeProgress
8651
8646
  });
8652
8647
  }
8653
8648
  };
8654
- eo = $a = O([x("LeftEraseTransition")], eo);
8649
+ $a = Qa = O([x("LeftEraseTransition")], $a);
8655
8650
  //#endregion
8656
8651
  //#region src/scene/transitions/TiltShiftTransition.ts
8657
- var to, no = class extends Mr {
8652
+ var eo, to = class extends Mr {
8658
8653
  static {
8659
- to = this;
8654
+ eo = this;
8660
8655
  }
8661
8656
  blur = 100;
8662
8657
  gradientBlur = 600;
@@ -8668,7 +8663,7 @@ var to, no = class extends Mr {
8668
8663
  let n = this.currentTimeProgress, r, i;
8669
8664
  n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
8670
8665
  let a = t.width, o = t.height, s = [0, o / 2], c = [600, o / 2], l = [a, o], u = c[0] - s[0], d = c[1] - s[1], f = Math.sqrt(u * u + d * d);
8671
- I.draw(e, to.material, {
8666
+ I.draw(e, eo.material, {
8672
8667
  sampler: r,
8673
8668
  progress: i,
8674
8669
  blur: this.blur,
@@ -8677,7 +8672,7 @@ var to, no = class extends Mr {
8677
8672
  end: c,
8678
8673
  delta: [u / f, d / f],
8679
8674
  texSize: l
8680
- }), I.draw(e, to.material, {
8675
+ }), I.draw(e, eo.material, {
8681
8676
  sampler: r,
8682
8677
  progress: i,
8683
8678
  blur: this.blur,
@@ -8689,12 +8684,12 @@ var to, no = class extends Mr {
8689
8684
  });
8690
8685
  }
8691
8686
  };
8692
- no = to = O([x("TiltShiftTransition")], no);
8687
+ to = eo = O([x("TiltShiftTransition")], to);
8693
8688
  //#endregion
8694
8689
  //#region src/scene/transitions/TwistTransition.ts
8695
- var ro, io = class extends Mr {
8690
+ var no, ro = class extends Mr {
8696
8691
  static {
8697
- ro = this;
8692
+ no = this;
8698
8693
  }
8699
8694
  radius;
8700
8695
  angle = 4;
@@ -8708,7 +8703,7 @@ var ro, io = class extends Mr {
8708
8703
  let n = this.currentTimeProgress, r, i;
8709
8704
  n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
8710
8705
  let a = t.width, o = t.height;
8711
- I.draw(e, ro.material, {
8706
+ I.draw(e, no.material, {
8712
8707
  sampler: r,
8713
8708
  progress: i,
8714
8709
  filterArea: [
@@ -8724,10 +8719,10 @@ var ro, io = class extends Mr {
8724
8719
  });
8725
8720
  }
8726
8721
  };
8727
- io = ro = O([x("TwistTransition")], io);
8722
+ ro = no = O([x("TwistTransition")], ro);
8728
8723
  //#endregion
8729
8724
  //#region src/asset/loaders/GifLoader.ts
8730
- var ao = class extends Rn {
8725
+ var io = class extends Rn {
8731
8726
  install(e) {
8732
8727
  let t = async (t) => {
8733
8728
  let { decodeFrames: n } = await import("modern-gif");
@@ -8744,14 +8739,14 @@ var ao = class extends Rn {
8744
8739
  e.register(n, t);
8745
8740
  }), e.gif = this, this;
8746
8741
  }
8747
- }, oo = class extends Rn {
8742
+ }, ao = class extends Rn {
8748
8743
  install(e) {
8749
8744
  let t = async (e) => JSON.parse(await e.text());
8750
8745
  return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), ["application/json"].forEach((n) => {
8751
8746
  e.register(n, t);
8752
8747
  }), e.json = this, this;
8753
8748
  }
8754
- }, so = class extends Rn {
8749
+ }, oo = class extends Rn {
8755
8750
  install(e) {
8756
8751
  return this.load = async (t, n) => (await import("lottie-web").then((e) => e.default)).loadAnimation({
8757
8752
  container: null,
@@ -8762,12 +8757,12 @@ var ao = class extends Rn {
8762
8757
  animationData: await e.loadBy(t, () => e.fetch(t).then((e) => e.json()))
8763
8758
  }), e.lottie = this, this;
8764
8759
  }
8765
- }, co = class extends Rn {
8760
+ }, so = class extends Rn {
8766
8761
  install(e) {
8767
8762
  let t = async (e) => e.text();
8768
8763
  return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), e.text = this, this;
8769
8764
  }
8770
- }, lo = class extends Rn {
8765
+ }, co = class extends Rn {
8771
8766
  install(e) {
8772
8767
  let t = (t) => e.fetchImageBitmap(t, { premultiplyAlpha: "premultiply" }).then((e) => new R({
8773
8768
  source: e,
@@ -8791,11 +8786,11 @@ var ao = class extends Rn {
8791
8786
  e.register(n, t);
8792
8787
  }), e.texture = this, this;
8793
8788
  }
8794
- }, uo = class extends Rn {
8789
+ }, lo = class extends Rn {
8795
8790
  install(e) {
8796
8791
  return this.load = (t) => e.awaitBy(() => new cr(t).load()), e.video = this, this;
8797
8792
  }
8798
- }, fo = Object.entries({
8793
+ }, uo = Object.entries({
8799
8794
  "font/woff": ["woff"],
8800
8795
  "font/ttf": ["ttf"],
8801
8796
  "font/otf": ["otf"],
@@ -8811,31 +8806,31 @@ var ao = class extends Rn {
8811
8806
  "image/webp": ["webp"],
8812
8807
  "application/json": ["json"]
8813
8808
  });
8814
- function po(e) {
8815
- for (let [t, n] of fo) if (n.includes(e)) return t;
8809
+ function fo(e) {
8810
+ for (let [t, n] of uo) if (n.includes(e)) return t;
8816
8811
  }
8817
- function mo(e) {
8812
+ function po(e) {
8818
8813
  let t;
8819
8814
  if (e.startsWith("data:")) t = e.match(/^data:(.+?);/)?.[1];
8820
8815
  else if (e.startsWith("http")) {
8821
8816
  let n = e.split(/[#?]/)[0].split(".").pop()?.trim();
8822
- n && (t = po(n));
8817
+ n && (t = fo(n));
8823
8818
  }
8824
8819
  return t;
8825
8820
  }
8826
8821
  //#endregion
8827
8822
  //#region src/asset/Assets.ts
8828
- var ho = "WeakRef" in globalThis, go = class extends e {
8823
+ var mo = "WeakRef" in globalThis, ho = class extends e {
8829
8824
  defaultHandler = (e) => e;
8830
8825
  _handlers = /* @__PURE__ */ new Map();
8831
8826
  _handleing = /* @__PURE__ */ new Map();
8832
8827
  _handled = /* @__PURE__ */ new Map();
8833
- _gc = ho ? new FinalizationRegistry((e) => {
8828
+ _gc = mo ? new FinalizationRegistry((e) => {
8834
8829
  let t = this.get(e);
8835
8830
  t && "destroy" in t && t.destroy(), this._handled.delete(e);
8836
8831
  }) : void 0;
8837
8832
  constructor() {
8838
- super(), ho || S.on(this.gc.bind(this), { sort: 2 });
8833
+ super(), mo || S.on(this.gc.bind(this), { sort: 2 });
8839
8834
  }
8840
8835
  use(e) {
8841
8836
  return e.install(this), this;
@@ -8884,11 +8879,11 @@ var ho = "WeakRef" in globalThis, go = class extends e {
8884
8879
  }
8885
8880
  get(e) {
8886
8881
  let t = this._handled.get(e);
8887
- return ho && t instanceof WeakRef && (t = t.deref(), t || this._handleing.delete(e)), t;
8882
+ return mo && t instanceof WeakRef && (t = t.deref(), t || this._handleing.delete(e)), t;
8888
8883
  }
8889
8884
  set(e, t) {
8890
8885
  let n = t;
8891
- ho && typeof t == "object" && (this._gc.register(t, e), n = new WeakRef(t)), this._handled.set(e, n);
8886
+ mo && typeof t == "object" && (this._gc.register(t, e), n = new WeakRef(t)), this._handled.set(e, n);
8892
8887
  }
8893
8888
  async awaitBy(e) {
8894
8889
  let t = e(), n = c();
@@ -8903,7 +8898,7 @@ var ho = "WeakRef" in globalThis, go = class extends e {
8903
8898
  return this._handleing.set(e, r), r;
8904
8899
  }
8905
8900
  async load(e, t) {
8906
- let n = await this.loadBy(e), r = mo(e);
8901
+ let n = await this.loadBy(e), r = po(e);
8907
8902
  return r === void 0 && (r = n.type?.split(";")[0] ?? void 0), ((r ? this._handlers.get(r) : void 0) ?? this.defaultHandler)(n, t);
8908
8903
  }
8909
8904
  async waitUntilLoad() {
@@ -8917,14 +8912,14 @@ var ho = "WeakRef" in globalThis, go = class extends e {
8917
8912
  n && "destroy" in n && n.destroy();
8918
8913
  }), this._handled.clear();
8919
8914
  }
8920
- }, $ = new go().use(new zn()).use(new ao()).use(new oo()).use(new so()).use(new co()).use(new lo()).use(new uo()), _o = {
8915
+ }, $ = new ho().use(new zn()).use(new io()).use(new ao()).use(new oo()).use(new so()).use(new co()).use(new lo()), go = {
8921
8916
  alpha: !0,
8922
8917
  stencil: !0,
8923
8918
  antialias: !1,
8924
8919
  premultipliedAlpha: !0,
8925
8920
  preserveDrawingBuffer: !1,
8926
8921
  powerPreference: "default"
8927
- }, vo = class extends Ar {
8922
+ }, _o = class extends Ar {
8928
8923
  renderer;
8929
8924
  get view() {
8930
8925
  return this.renderer.view;
@@ -8957,12 +8952,12 @@ var ho = "WeakRef" in globalThis, go = class extends e {
8957
8952
  constructor(e = {}) {
8958
8953
  let { view: t, width: n, height: r, pixelRatio: i = Ke, autoResize: a, data: o } = e;
8959
8954
  super(), this.renderer = new Ln(t, {
8960
- alpha: _o.alpha ?? e.alpha,
8961
- stencil: _o.stencil ?? e.stencil,
8962
- antialias: _o.antialias ?? e.antialias,
8963
- premultipliedAlpha: _o.premultipliedAlpha ?? e.premultipliedAlpha,
8964
- preserveDrawingBuffer: _o.preserveDrawingBuffer ?? e.preserveDrawingBuffer,
8965
- powerPreference: _o.powerPreference ?? e.powerPreference
8955
+ alpha: go.alpha ?? e.alpha,
8956
+ stencil: go.stencil ?? e.stencil,
8957
+ antialias: go.antialias ?? e.antialias,
8958
+ premultipliedAlpha: go.premultipliedAlpha ?? e.premultipliedAlpha,
8959
+ preserveDrawingBuffer: go.preserveDrawingBuffer ?? e.preserveDrawingBuffer,
8960
+ powerPreference: go.powerPreference ?? e.powerPreference
8966
8961
  }), this._setupInput(), this.pixelRatio = i, a ? !t && this.renderer.view && (this.renderer.view.style.width = "100%", this.renderer.view.style.height = "100%") : this.resize(n || this.gl.drawingBufferWidth || this.view?.clientWidth || 200, r || this.gl.drawingBufferHeight || this.view?.clientHeight || 200, !t), this.setProperties(e), o && this.root.append(o);
8967
8962
  }
8968
8963
  _updateProperty(e, t, n) {
@@ -9045,22 +9040,22 @@ var ho = "WeakRef" in globalThis, go = class extends e {
9045
9040
  super._destroy(), this._resizeObserver?.disconnect(), this.renderer.destroy();
9046
9041
  }
9047
9042
  };
9048
- O([_({ fallback: !1 }), D("design:type", Boolean)], vo.prototype, "autoResize", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], vo.prototype, "autoStart", void 0);
9043
+ O([_({ fallback: !1 }), D("design:type", Boolean)], _o.prototype, "autoResize", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], _o.prototype, "autoStart", void 0);
9049
9044
  //#endregion
9050
9045
  //#region src/render.ts
9051
- var yo, bo = [], xo = !1;
9052
- function So() {
9053
- return yo ??= new vo({
9046
+ var vo, yo = [], bo = !1;
9047
+ function xo() {
9048
+ return vo ??= new _o({
9054
9049
  pixelRatio: 1,
9055
9050
  width: 1,
9056
9051
  height: 1,
9057
9052
  preserveDrawingBuffer: !0
9058
9053
  });
9059
9054
  }
9060
- async function Co(e = 100) {
9061
- if (!xo) {
9062
- for (xo = !0; bo.length;) {
9063
- let t = bo.shift();
9055
+ async function So(e = 100) {
9056
+ if (!bo) {
9057
+ for (bo = !0; yo.length;) {
9058
+ let t = yo.shift();
9064
9059
  if (t) try {
9065
9060
  await t();
9066
9061
  } catch (e) {
@@ -9068,11 +9063,11 @@ async function Co(e = 100) {
9068
9063
  }
9069
9064
  else await new Promise((t) => setTimeout(t, e));
9070
9065
  }
9071
- xo = !1;
9066
+ bo = !1;
9072
9067
  }
9073
9068
  }
9074
- async function wo(e) {
9075
- let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f = So();
9069
+ async function Co(e) {
9070
+ let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f = xo();
9076
9071
  if (f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resize(u, d, !0), f.root.removeChildren(!0), f.root.append(a), await s?.(f), await f.waitAndRender(), o.length) {
9077
9072
  let e = o.length, t = o[e - 1];
9078
9073
  for (let n = 0; n < e; n++) {
@@ -9090,15 +9085,15 @@ async function wo(e) {
9090
9085
  toCanvas2D: () => f.toCanvas2D(new ImageData(p, u, d))
9091
9086
  };
9092
9087
  }
9093
- async function To(e) {
9088
+ async function wo(e) {
9094
9089
  return new Promise((t) => {
9095
- bo.push(async () => t(await wo(e).then((e) => e.toCanvas2D()))), Co();
9090
+ yo.push(async () => t(await Co(e).then((e) => e.toCanvas2D()))), So();
9096
9091
  });
9097
9092
  }
9098
- async function Eo(e) {
9093
+ async function To(e) {
9099
9094
  return new Promise((t) => {
9100
- bo.push(async () => t(await wo(e).then((e) => e.pixels))), Co();
9095
+ yo.push(async () => t(await Co(e).then((e) => e.pixels))), So();
9101
9096
  });
9102
9097
  }
9103
9098
  //#endregion
9104
- export { mt as Aabb2D, nr as AnimatedTexture, Fa as Animation, go as Assets, qa as Audio, za as AudioPipeline, Ba as AudioProcessor, Ja as AudioSpectrum, Xa as AudioWaveform, k as BufferUsage, Ir as Camera2D, ur as CanvasContext, Cr as CanvasItem, rr as CanvasTexture, T as Color, U as ColorAdjustEffect, Yr as ColorFilterEffect, vt as ColorMatrix, $r as ColorOverlayEffect, ni as ColorRemoveEffect, oi as ColorReplaceEffect, ir as ColorTexture, C as CoreObject, ht as DEG_TO_RAD, Ke as DEVICE_PIXEL_RATIO, W as DrawboardEffect, gi as DropShadowEffect, H as Effect, $n as EffectMaterial, ya as Element2D, Hi as Element2DBackground, Y as Element2DChart, Ki as Element2DConnection, J as Element2DFill, Ji as Element2DForeground, Yi as Element2DOutline, Xi as Element2DShadow, Zi as Element2DShape, Qi as Element2DStyle, na as Element2DTable, X as Element2DText, yi as EmbossEffect, vo as Engine, pa as Flexbox, zn as FontLoader, pi as GaussianBlurEffect, Wn as Geometry, ao as GifLoader, on as GlBatch2DSystem, tn as GlBlendMode, Ct as GlBuffer, jt as GlBufferSystem, St as GlBufferTarget, un as GlMaskSystem, Ut as GlProgram, mn as GlRenderTarget, hn as GlRenderTargetSystem, Qt as GlShaderSystem, rn as GlState, an as GlStateSystem, fn as GlStencilSystem, A as GlSystem, pn as GlViewportSystem, G as GlitchEffect, K as GodrayEffect, ar as GradientTexture, Ra as HTMLAudio, Ia as HTMLAudioContext, La as HTMLSound, We as IN_BROWSER, Ge as IN_MAC_OS, Vn as IndexBuffer, ft as Input, ot as InputEvent, oo as JsonLoader, Oi as KawaseBlurEffect, Qa as KawaseTransition, st as KeyboardInputEvent, eo as LeftEraseTransition, Rn as Loader, Ca as Lottie2D, so as LottieLoader, xt as MainLoop, ji as MaskEffect, F as Material, fr as Meta, ct as MouseInputEvent, z as Node, Pr as Node2D, yt as Obb2D, q as OutlineEffect, ye as PI, be as PI_2, Li as PixelateEffect, or as PixelsTexture, lt as PointerInputEvent, bt as Projection2D, qn as QuadGeometry, I as QuadUvGeometry, gt as RAD_TO_DEG, pt as RefCounted, L as RenderTarget, Tt as Renderer, w as Resource, ze as SUPPORTS_AUDIO_CONTEXT, Le as SUPPORTS_CLICK_EVENTS, Re as SUPPORTS_CREATE_IMAGE_BITMAP, je as SUPPORTS_IMAGE_BITMAP, Fe as SUPPORTS_MOUSE_EVENTS, Ve as SUPPORTS_OFFLINE_AUDIO_CONTEXT, Ne as SUPPORTS_POINTER_EVENTS, Me as SUPPORTS_RESIZE_OBSERVER, Ie as SUPPORTS_TOUCH_EVENTS, Ae as SUPPORTS_WEBGL2, Be as SUPPORTS_WEBKIT_AUDIO_CONTEXT, He as SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, Ue as SUPPORTS_WEB_AUDIO, Pe as SUPPORTS_WHEEL_EVENTS, Ar as SceneTree, co as TextLoader, R as Texture2D, lo as TextureLoader, xa as TextureRect2D, S as Ticker, no as TiltShiftTransition, Or as Timeline, B as TimelineNode, wa as TransformRect2D, Mr as Transition, io as TwistTransition, Dt as UniformGroup, tr as UvGeometry, er as UvMaterial, P as VertexAttribute, N as VertexBuffer, Ea as Video2D, uo as VideoLoader, cr as VideoTexture, V as Viewport, lr as ViewportTexture, Ga as WebAudio, Ua as WebAudioContext, Ln as WebGLRenderer, Wa as WebSound, ut as WheelInputEvent, kr as Window, Bi as ZoomBlurEffect, Q as alignMap, $ as assets, Lr as axisDir, fa as boxSizingMap, _t as clamp, Di as clampFrag, tt as createHTMLCanvas, At as createIdFromString, _e as createNode, rt as crossOrigin, Na as cubicBezier, x as customNode, ge as customNodes, _o as defaultOptions, nt as determineCrossOrigin, oa as directionMap, aa as displayMap, ka as ease, Aa as easeIn, Ma as easeInOut, ja as easeOut, Z as edgeMap, sa as flexDirectionMap, ca as flexWrapMap, Ei as frag, et as getCanvasFactory, Te as getDefaultCssPropertyValue, So as getRenderEngine, ia as gutterMap, at as instanceId, Xe as isCanvasElement, qe as isElementNode, Ye as isImageElement, xe as isPow2, Je as isVideoElement, Ze as isWebgl2, la as justifyMap, E as lerp, Oa as linear, cn as log2, nn as mapGlBlendModes, sn as nextPow2, ve as nextTick, ua as overflowMap, Ur as parseCssFilter, De as parseCssFunctions, Ee as parseCssProperty, Wr as parseCssTransformOrigin, da as positionTypeMap, To as render, Eo as renderPixels, xr as resetBatchPool, Rr as routeConnection, $e as setCanvasFactory, dn as stencilModeMap, Pa as timingFunctions };
9099
+ export { mt as Aabb2D, nr as AnimatedTexture, Pa as Animation, ho as Assets, Ka as Audio, Ra as AudioPipeline, za as AudioProcessor, qa as AudioSpectrum, Ya as AudioWaveform, k as BufferUsage, Ir as Camera2D, ur as CanvasContext, Cr as CanvasItem, rr as CanvasTexture, T as Color, U as ColorAdjustEffect, Yr as ColorFilterEffect, vt as ColorMatrix, $r as ColorOverlayEffect, ni as ColorRemoveEffect, oi as ColorReplaceEffect, ir as ColorTexture, C as CoreObject, ht as DEG_TO_RAD, Ke as DEVICE_PIXEL_RATIO, W as DrawboardEffect, gi as DropShadowEffect, H as Effect, $n as EffectMaterial, ya as Element2D, Hi as Element2DBackground, Y as Element2DChart, Ki as Element2DConnection, J as Element2DFill, Ji as Element2DForeground, Yi as Element2DOutline, Xi as Element2DShadow, Zi as Element2DShape, Qi as Element2DStyle, na as Element2DTable, X as Element2DText, yi as EmbossEffect, _o as Engine, pa as Flexbox, zn as FontLoader, pi as GaussianBlurEffect, Wn as Geometry, io as GifLoader, on as GlBatch2DSystem, tn as GlBlendMode, Ct as GlBuffer, jt as GlBufferSystem, St as GlBufferTarget, un as GlMaskSystem, Ut as GlProgram, mn as GlRenderTarget, hn as GlRenderTargetSystem, Qt as GlShaderSystem, rn as GlState, an as GlStateSystem, fn as GlStencilSystem, A as GlSystem, pn as GlViewportSystem, G as GlitchEffect, K as GodrayEffect, ar as GradientTexture, La as HTMLAudio, Fa as HTMLAudioContext, Ia as HTMLSound, We as IN_BROWSER, Ge as IN_MAC_OS, Vn as IndexBuffer, ft as Input, ot as InputEvent, ao as JsonLoader, Oi as KawaseBlurEffect, Za as KawaseTransition, st as KeyboardInputEvent, $a as LeftEraseTransition, Rn as Loader, Sa as Lottie2D, oo as LottieLoader, xt as MainLoop, ji as MaskEffect, F as Material, fr as Meta, ct as MouseInputEvent, z as Node, Pr as Node2D, yt as Obb2D, q as OutlineEffect, ye as PI, be as PI_2, Li as PixelateEffect, or as PixelsTexture, lt as PointerInputEvent, bt as Projection2D, qn as QuadGeometry, I as QuadUvGeometry, gt as RAD_TO_DEG, pt as RefCounted, L as RenderTarget, Tt as Renderer, w as Resource, ze as SUPPORTS_AUDIO_CONTEXT, Le as SUPPORTS_CLICK_EVENTS, Re as SUPPORTS_CREATE_IMAGE_BITMAP, je as SUPPORTS_IMAGE_BITMAP, Fe as SUPPORTS_MOUSE_EVENTS, Ve as SUPPORTS_OFFLINE_AUDIO_CONTEXT, Ne as SUPPORTS_POINTER_EVENTS, Me as SUPPORTS_RESIZE_OBSERVER, Ie as SUPPORTS_TOUCH_EVENTS, Ae as SUPPORTS_WEBGL2, Be as SUPPORTS_WEBKIT_AUDIO_CONTEXT, He as SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, Ue as SUPPORTS_WEB_AUDIO, Pe as SUPPORTS_WHEEL_EVENTS, Ar as SceneTree, so as TextLoader, R as Texture2D, co as TextureLoader, ba as TextureRect2D, S as Ticker, to as TiltShiftTransition, Or as Timeline, B as TimelineNode, Ca as TransformRect2D, Mr as Transition, ro as TwistTransition, Dt as UniformGroup, tr as UvGeometry, er as UvMaterial, P as VertexAttribute, N as VertexBuffer, Ta as Video2D, lo as VideoLoader, cr as VideoTexture, V as Viewport, lr as ViewportTexture, Wa as WebAudio, Ha as WebAudioContext, Ln as WebGLRenderer, Ua as WebSound, ut as WheelInputEvent, kr as Window, Bi as ZoomBlurEffect, Q as alignMap, $ as assets, Lr as axisDir, fa as boxSizingMap, _t as clamp, Di as clampFrag, tt as createHTMLCanvas, At as createIdFromString, _e as createNode, rt as crossOrigin, Ma as cubicBezier, x as customNode, ge as customNodes, go as defaultOptions, nt as determineCrossOrigin, oa as directionMap, aa as displayMap, Oa as ease, ka as easeIn, ja as easeInOut, Aa as easeOut, Z as edgeMap, sa as flexDirectionMap, ca as flexWrapMap, Ei as frag, et as getCanvasFactory, Te as getDefaultCssPropertyValue, xo as getRenderEngine, ia as gutterMap, at as instanceId, Xe as isCanvasElement, qe as isElementNode, Ye as isImageElement, xe as isPow2, Je as isVideoElement, Ze as isWebgl2, la as justifyMap, E as lerp, Da as linear, cn as log2, nn as mapGlBlendModes, sn as nextPow2, ve as nextTick, ua as overflowMap, Ur as parseCssFilter, De as parseCssFunctions, Ee as parseCssProperty, Wr as parseCssTransformOrigin, da as positionTypeMap, wo as render, To as renderPixels, xr as resetBatchPool, Rr as routeConnection, $e as setCanvasFactory, dn as stencilModeMap, Na as timingFunctions };
@@ -1,14 +1,13 @@
1
1
  import type { Chart, NormalizedChart } from 'modern-idoc';
2
- import type { TextureRect2D } from '../TextureRect2D';
3
2
  import type { Element2D } from './Element2D';
4
3
  import { CoreObject } from '../../../core';
5
4
  import { CanvasTexture } from '../../resources';
6
5
  /**
7
- * Renders an idoc chart with echarts (optional dependency): echarts draws into an
8
- * offscreen canvas which is uploaded as a CanvasTexture on a TextureRect2D child in
9
- * the parent's `back` layer (same "library canvas texture" pattern as Lottie2D).
10
- * Updates are microtask-coalesced. Without echarts installed, charts render nothing
11
- * (a one-time warning is logged).
6
+ * Renders an idoc chart with echarts (optional dependency). echarts draws into an
7
+ * offscreen canvas, which is uploaded as a CanvasTexture and drawn directly onto the
8
+ * parent element in `draw()` the same way fill/background paint a texture, so the
9
+ * chart is the element's own content (no extra child node). Updates are
10
+ * microtask-coalesced. Without echarts installed, charts render nothing (warned once).
12
11
  */
13
12
  export declare class Element2DChart extends CoreObject implements NormalizedChart {
14
13
  protected _parent: Element2D;
@@ -24,7 +23,6 @@ export declare class Element2DChart extends CoreObject implements NormalizedChar
24
23
  protected _instance?: any;
25
24
  protected _container?: HTMLElement;
26
25
  protected _texture?: CanvasTexture;
27
- protected _node?: TextureRect2D;
28
26
  protected _dirty: boolean;
29
27
  protected _scheduled: boolean;
30
28
  constructor(_parent: Element2D);
@@ -32,7 +30,10 @@ export declare class Element2DChart extends CoreObject implements NormalizedChar
32
30
  protected _updateProperty(key: string, value: any, oldValue: any): void;
33
31
  protected _requestUpdate(): void;
34
32
  isValid(): boolean;
33
+ /** Render with echarts into the offscreen canvas backing `_texture`. */
35
34
  update(): Promise<void>;
35
+ /** Paint the echarts texture onto the element, like fill/background do. */
36
+ draw(): void;
36
37
  /** Map the normalized idoc chart to an echarts option. */
37
38
  protected _toOption(): Record<string, any>;
38
39
  protected _teardown(): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.21.1",
4
+ "version": "0.21.2",
5
5
  "packageManager": "pnpm@10.19.0",
6
6
  "description": "A JavaScript WebGL rendering engine. only the ESM.",
7
7
  "author": "wxm",