modern-canvas 0.23.10 → 0.23.12
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
|
@@ -5011,6 +5011,9 @@ var Sr = class extends Tt {
|
|
|
5011
5011
|
root = new xr().setTree(this);
|
|
5012
5012
|
timeline = new br().setTree(this);
|
|
5013
5013
|
nodeMap = /* @__PURE__ */ new Map();
|
|
5014
|
+
_boundFonts;
|
|
5015
|
+
_textRemeasureScheduled = !1;
|
|
5016
|
+
_onFontLoad = () => this._scheduleTextRemeasure();
|
|
5014
5017
|
_backgroundColor = new T();
|
|
5015
5018
|
_previousViewport;
|
|
5016
5019
|
_currentViewport;
|
|
@@ -5027,13 +5030,27 @@ var Sr = class extends Tt {
|
|
|
5027
5030
|
return this.nodeMap.get(e);
|
|
5028
5031
|
}
|
|
5029
5032
|
constructor(e) {
|
|
5030
|
-
super(), this.on("nodeEnter", (e) => this.nodeMap.set(e.id, e)), this.on("nodeExit", (e) => this.nodeMap.delete(e.id)), this.setProperties(e);
|
|
5033
|
+
super(), this.on("nodeEnter", (e) => this.nodeMap.set(e.id, e)), this.on("nodeExit", (e) => this.nodeMap.delete(e.id)), this.setProperties(e), this._bindFonts(this.fonts);
|
|
5034
|
+
}
|
|
5035
|
+
_bindFonts(e) {
|
|
5036
|
+
this._boundFonts !== e && (this._boundFonts?.off("load", this._onFontLoad), this._boundFonts = e, e?.on("load", this._onFontLoad));
|
|
5037
|
+
}
|
|
5038
|
+
_scheduleTextRemeasure() {
|
|
5039
|
+
this._textRemeasureScheduled || (this._textRemeasureScheduled = !0, queueMicrotask(() => {
|
|
5040
|
+
this._textRemeasureScheduled = !1, this.nodeMap.forEach((e) => {
|
|
5041
|
+
let t = e.text;
|
|
5042
|
+
t?.enabled && typeof t.update == "function" && t.update();
|
|
5043
|
+
});
|
|
5044
|
+
}));
|
|
5031
5045
|
}
|
|
5032
5046
|
_updateProperty(e, t, n) {
|
|
5033
5047
|
switch (super._updateProperty(e, t, n), e) {
|
|
5034
5048
|
case "backgroundColor":
|
|
5035
5049
|
this._backgroundColor.value = t;
|
|
5036
5050
|
break;
|
|
5051
|
+
case "fonts":
|
|
5052
|
+
this._bindFonts(t), this._scheduleTextRemeasure();
|
|
5053
|
+
break;
|
|
5037
5054
|
}
|
|
5038
5055
|
}
|
|
5039
5056
|
setProperties(e) {
|
|
@@ -5058,7 +5075,7 @@ var Sr = class extends Tt {
|
|
|
5058
5075
|
t.activate(e, 0), L.draw(e), t.inactivate(e);
|
|
5059
5076
|
}
|
|
5060
5077
|
_destroy() {
|
|
5061
|
-
super._destroy(), this.root.destroy(), this.input.destroy(), this.nodeMap.clear();
|
|
5078
|
+
super._destroy(), this._bindFonts(void 0), this.root.destroy(), this.input.destroy(), this.nodeMap.clear();
|
|
5062
5079
|
}
|
|
5063
5080
|
};
|
|
5064
5081
|
k([_({ alias: "root.msaa" }), O("design:type", Boolean)], Sr.prototype, "msaa", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], Sr.prototype, "pixelate", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], Sr.prototype, "roundPixels", void 0), k([_(), O("design:type", Object)], Sr.prototype, "backgroundColor", void 0), k([_({
|
|
@@ -6474,7 +6491,7 @@ var X = class extends C {
|
|
|
6474
6491
|
}
|
|
6475
6492
|
let n = await yi();
|
|
6476
6493
|
if (!n) {
|
|
6477
|
-
console.warn("[modern-canvas] chart rendering requires the optional \"echarts\" dependency (e.g. `pnpm add echarts`)");
|
|
6494
|
+
console.warn("[modern-canvas] chart rendering requires the optional \"echarts\" dependency (e.g. `pnpm add echarts`)"), this._renderPlaceholder(e, t);
|
|
6478
6495
|
return;
|
|
6479
6496
|
}
|
|
6480
6497
|
if (!(this.destroyed || !this.isValid())) {
|
|
@@ -6505,6 +6522,16 @@ var X = class extends C {
|
|
|
6505
6522
|
this._texture.requestUpdate("source"), this._parent.requestDraw();
|
|
6506
6523
|
}
|
|
6507
6524
|
}
|
|
6525
|
+
_renderPlaceholder(e, t) {
|
|
6526
|
+
if (typeof document > "u" || !e || !t) return;
|
|
6527
|
+
let n = document.createElement("canvas");
|
|
6528
|
+
n.width = Math.ceil(e), n.height = Math.ceil(t);
|
|
6529
|
+
let r = n.getContext("2d");
|
|
6530
|
+
r && (r.fillStyle = "#f3f4f6", r.fillRect(0, 0, e, t), r.strokeStyle = "#d1d5db", r.setLineDash([6, 4]), r.strokeRect(1, 1, e - 2, t - 2), r.fillStyle = "#9ca3af", r.font = "14px sans-serif", r.textAlign = "center", r.textBaseline = "middle", r.fillText("图表需安装 echarts", e / 2, t / 2), this._texture ? this._texture.source = n : this._texture = new er({
|
|
6531
|
+
source: n,
|
|
6532
|
+
pixelRatio: 1
|
|
6533
|
+
}), this._texture.requestUpdate("source"), this._parent.requestDraw());
|
|
6534
|
+
}
|
|
6508
6535
|
draw() {
|
|
6509
6536
|
let e = this._texture;
|
|
6510
6537
|
if (!e?.isValid()) return;
|
|
@@ -7981,8 +8008,7 @@ function sa(e) {
|
|
|
7981
8008
|
let t = e.trim(), n = /^path\((.*)\)$/s.exec(t);
|
|
7982
8009
|
return n && (t = n[1].trim()), t.length >= 2 && (t[0] === "\"" || t[0] === "'") && t[t.length - 1] === t[0] && (t = t.slice(1, -1)), t.trim();
|
|
7983
8010
|
}
|
|
7984
|
-
|
|
7985
|
-
function pa(e, t, n, r) {
|
|
8011
|
+
function ca(e, t, n, r) {
|
|
7986
8012
|
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;
|
|
7987
8013
|
function m(e) {
|
|
7988
8014
|
let t = e, n, r;
|
|
@@ -8002,13 +8028,74 @@ function pa(e, t, n, r) {
|
|
|
8002
8028
|
}
|
|
8003
8029
|
return (e) => p(m(e));
|
|
8004
8030
|
}
|
|
8005
|
-
var
|
|
8006
|
-
linear:
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8031
|
+
var la = {
|
|
8032
|
+
linear: [
|
|
8033
|
+
0,
|
|
8034
|
+
0,
|
|
8035
|
+
1,
|
|
8036
|
+
1
|
|
8037
|
+
],
|
|
8038
|
+
ease: [
|
|
8039
|
+
.25,
|
|
8040
|
+
.1,
|
|
8041
|
+
.25,
|
|
8042
|
+
1
|
|
8043
|
+
],
|
|
8044
|
+
"ease-in": [
|
|
8045
|
+
.42,
|
|
8046
|
+
0,
|
|
8047
|
+
1,
|
|
8048
|
+
1
|
|
8049
|
+
],
|
|
8050
|
+
"ease-out": [
|
|
8051
|
+
0,
|
|
8052
|
+
0,
|
|
8053
|
+
.58,
|
|
8054
|
+
1
|
|
8055
|
+
],
|
|
8056
|
+
"ease-in-out": [
|
|
8057
|
+
.42,
|
|
8058
|
+
0,
|
|
8059
|
+
.58,
|
|
8060
|
+
1
|
|
8061
|
+
],
|
|
8062
|
+
"ease-in-quad": [
|
|
8063
|
+
.55,
|
|
8064
|
+
.085,
|
|
8065
|
+
.68,
|
|
8066
|
+
.53
|
|
8067
|
+
],
|
|
8068
|
+
"ease-out-quad": [
|
|
8069
|
+
.25,
|
|
8070
|
+
.46,
|
|
8071
|
+
.45,
|
|
8072
|
+
.94
|
|
8073
|
+
],
|
|
8074
|
+
"ease-in-out-quad": [
|
|
8075
|
+
.455,
|
|
8076
|
+
.03,
|
|
8077
|
+
.515,
|
|
8078
|
+
.955
|
|
8079
|
+
],
|
|
8080
|
+
"ease-in-cubic": [
|
|
8081
|
+
.55,
|
|
8082
|
+
.055,
|
|
8083
|
+
.675,
|
|
8084
|
+
.19
|
|
8085
|
+
],
|
|
8086
|
+
"ease-out-cubic": [
|
|
8087
|
+
.215,
|
|
8088
|
+
.61,
|
|
8089
|
+
.355,
|
|
8090
|
+
1
|
|
8091
|
+
],
|
|
8092
|
+
"ease-in-out-cubic": [
|
|
8093
|
+
.645,
|
|
8094
|
+
.045,
|
|
8095
|
+
.355,
|
|
8096
|
+
1
|
|
8097
|
+
]
|
|
8098
|
+
}, ua = Object.fromEntries(Object.entries(la).map(([e, [t, n, r, i]]) => [e, ca(t, n, r, i)])), da = class extends V {
|
|
8012
8099
|
_keyframes = [];
|
|
8013
8100
|
_isFirstUpdatePosition = !1;
|
|
8014
8101
|
_cachedProps = new t();
|
|
@@ -8095,10 +8182,14 @@ var ma = {
|
|
|
8095
8182
|
});
|
|
8096
8183
|
}
|
|
8097
8184
|
_parseEasing(e) {
|
|
8098
|
-
if (!e) return
|
|
8099
|
-
if (e in
|
|
8100
|
-
let t =
|
|
8101
|
-
|
|
8185
|
+
if (!e) return ua.linear;
|
|
8186
|
+
if (e in ua) return ua[e];
|
|
8187
|
+
let t = /cubic-bezier\((.+)\)/.exec(e);
|
|
8188
|
+
if (t) {
|
|
8189
|
+
let e = t[1].split(",").map((e) => Number(e));
|
|
8190
|
+
if (e.length === 4 && e.every((e) => !Number.isNaN(e))) return ca(e[0], e[1], e[2], e[3]);
|
|
8191
|
+
}
|
|
8192
|
+
return ua.linear;
|
|
8102
8193
|
}
|
|
8103
8194
|
_parseKeyframes(e, t) {
|
|
8104
8195
|
let n, r = this._keyframes;
|
|
@@ -8191,14 +8282,14 @@ var ma = {
|
|
|
8191
8282
|
});
|
|
8192
8283
|
}
|
|
8193
8284
|
};
|
|
8194
|
-
k([_({ fallback: "parent" }), O("design:type", Object)],
|
|
8285
|
+
k([_({ fallback: "parent" }), O("design:type", Object)], da.prototype, "effectMode", void 0), k([_({ default: () => [] }), O("design:type", Array)], da.prototype, "keyframes", void 0), k([_(), O("design:type", Object)], da.prototype, "easing", void 0), da = k([b("Animation", {
|
|
8195
8286
|
renderMode: "disabled",
|
|
8196
8287
|
processSortMode: "parent-before",
|
|
8197
8288
|
duration: 2e3
|
|
8198
|
-
}), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])],
|
|
8289
|
+
}), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], da);
|
|
8199
8290
|
//#endregion
|
|
8200
8291
|
//#region src/scene/audio/html/HTMLAudioContext.ts
|
|
8201
|
-
var
|
|
8292
|
+
var fa = class t extends e {
|
|
8202
8293
|
static _instance;
|
|
8203
8294
|
static get instance() {
|
|
8204
8295
|
return this._instance ||= new t(), this._instance;
|
|
@@ -8228,7 +8319,7 @@ var ga = class t extends e {
|
|
|
8228
8319
|
togglePause() {
|
|
8229
8320
|
return this.paused = !this.paused, this.refreshPaused(), this.paused;
|
|
8230
8321
|
}
|
|
8231
|
-
},
|
|
8322
|
+
}, pa = class t extends e {
|
|
8232
8323
|
static PADDING = .1;
|
|
8233
8324
|
_source = null;
|
|
8234
8325
|
_audio = null;
|
|
@@ -8355,7 +8446,7 @@ var ga = class t extends e {
|
|
|
8355
8446
|
let e = this._source;
|
|
8356
8447
|
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);
|
|
8357
8448
|
}
|
|
8358
|
-
},
|
|
8449
|
+
}, ma = class {
|
|
8359
8450
|
parent;
|
|
8360
8451
|
source = new globalThis.Audio();
|
|
8361
8452
|
_src = "";
|
|
@@ -8372,7 +8463,7 @@ var ga = class t extends e {
|
|
|
8372
8463
|
return !!this.source && this.source.readyState === 4;
|
|
8373
8464
|
}
|
|
8374
8465
|
get context() {
|
|
8375
|
-
return
|
|
8466
|
+
return fa.instance;
|
|
8376
8467
|
}
|
|
8377
8468
|
constructor(e) {
|
|
8378
8469
|
this.parent = e;
|
|
@@ -8383,9 +8474,9 @@ var ga = class t extends e {
|
|
|
8383
8474
|
});
|
|
8384
8475
|
}
|
|
8385
8476
|
createSound() {
|
|
8386
|
-
return new
|
|
8477
|
+
return new pa();
|
|
8387
8478
|
}
|
|
8388
|
-
},
|
|
8479
|
+
}, ha = class extends e {
|
|
8389
8480
|
_input;
|
|
8390
8481
|
_output;
|
|
8391
8482
|
_processers = [];
|
|
@@ -8407,7 +8498,7 @@ var ga = class t extends e {
|
|
|
8407
8498
|
get destination() {
|
|
8408
8499
|
return this._input;
|
|
8409
8500
|
}
|
|
8410
|
-
},
|
|
8501
|
+
}, ga = class {
|
|
8411
8502
|
destination;
|
|
8412
8503
|
source;
|
|
8413
8504
|
constructor(e, t = null) {
|
|
@@ -8422,21 +8513,21 @@ var ga = class t extends e {
|
|
|
8422
8513
|
};
|
|
8423
8514
|
//#endregion
|
|
8424
8515
|
//#region src/scene/audio/web/WebAudioContext.ts
|
|
8425
|
-
function
|
|
8516
|
+
function _a() {
|
|
8426
8517
|
if (He) return new AudioContext();
|
|
8427
8518
|
if (Ue) {
|
|
8428
8519
|
let e = globalThis.webkitAudioContext;
|
|
8429
8520
|
return new e();
|
|
8430
8521
|
} else throw Error("Failed to createAudioContext");
|
|
8431
8522
|
}
|
|
8432
|
-
function
|
|
8523
|
+
function va(e, t, n) {
|
|
8433
8524
|
if (We) return new OfflineAudioContext(e, t, n);
|
|
8434
8525
|
if (Ge) {
|
|
8435
8526
|
let r = globalThis.webkitOfflineAudioContext;
|
|
8436
8527
|
return new r(e, t, n);
|
|
8437
8528
|
} else throw Error("Failed to createOfflineAudioContext");
|
|
8438
8529
|
}
|
|
8439
|
-
var
|
|
8530
|
+
var ya = class e extends ha {
|
|
8440
8531
|
static _instance;
|
|
8441
8532
|
static get instance() {
|
|
8442
8533
|
return this._instance ||= new e(), this._instance;
|
|
@@ -8477,7 +8568,7 @@ var Ca = class e extends ya {
|
|
|
8477
8568
|
_compressor;
|
|
8478
8569
|
_analyser;
|
|
8479
8570
|
constructor() {
|
|
8480
|
-
let e =
|
|
8571
|
+
let e = _a(), t = va(1, 2, We ? Math.max(8e3, Math.min(96e3, e.sampleRate)) : 44100), n = e.createDynamicsCompressor(), r = e.createAnalyser();
|
|
8481
8572
|
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" && (ze || Be), qe && (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));
|
|
8482
8573
|
}
|
|
8483
8574
|
_onFocus() {
|
|
@@ -8518,7 +8609,7 @@ var Ca = class e extends ya {
|
|
|
8518
8609
|
setParamValue(e, t) {
|
|
8519
8610
|
e.setValueAtTime ? e.setValueAtTime(t, this._context.currentTime) : e.value = t;
|
|
8520
8611
|
}
|
|
8521
|
-
},
|
|
8612
|
+
}, ba = class extends e {
|
|
8522
8613
|
_audio = null;
|
|
8523
8614
|
_sourceNode = null;
|
|
8524
8615
|
_gain = null;
|
|
@@ -8651,7 +8742,7 @@ var Ca = class e extends ya {
|
|
|
8651
8742
|
destroy() {
|
|
8652
8743
|
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;
|
|
8653
8744
|
}
|
|
8654
|
-
},
|
|
8745
|
+
}, xa = class extends ha {
|
|
8655
8746
|
parent;
|
|
8656
8747
|
_sourceBuffer;
|
|
8657
8748
|
_sourceNode;
|
|
@@ -8659,7 +8750,7 @@ var Ca = class e extends ya {
|
|
|
8659
8750
|
gain;
|
|
8660
8751
|
analyser;
|
|
8661
8752
|
get context() {
|
|
8662
|
-
return
|
|
8753
|
+
return ya.instance;
|
|
8663
8754
|
}
|
|
8664
8755
|
get isPlayable() {
|
|
8665
8756
|
return !!this._sourceNode.buffer;
|
|
@@ -8674,8 +8765,8 @@ var Ca = class e extends ya {
|
|
|
8674
8765
|
this._sourceNode.buffer = e;
|
|
8675
8766
|
}
|
|
8676
8767
|
constructor(e) {
|
|
8677
|
-
let t =
|
|
8678
|
-
n.connect(i), i.connect(r), r.connect(
|
|
8768
|
+
let t = ya.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
|
|
8769
|
+
n.connect(i), i.connect(r), r.connect(ya.instance.destination), super(i, r), this.parent = e, this._sourceNode = n, this.gain = r, this.analyser = i;
|
|
8679
8770
|
}
|
|
8680
8771
|
async load() {
|
|
8681
8772
|
return this._sourceLoad ||= new Promise((e) => {
|
|
@@ -8688,7 +8779,7 @@ var Ca = class e extends ya {
|
|
|
8688
8779
|
});
|
|
8689
8780
|
}
|
|
8690
8781
|
_decode(e) {
|
|
8691
|
-
return Promise.resolve(e instanceof AudioBuffer ? e :
|
|
8782
|
+
return Promise.resolve(e instanceof AudioBuffer ? e : ya.decode(e)).then((e) => (this.parent.isLoaded = !0, this.buffer = e, e));
|
|
8692
8783
|
}
|
|
8693
8784
|
cloneSource() {
|
|
8694
8785
|
let e = this.context, t = this._sourceNode, n = e.audioContext.createBufferSource(), r = e.audioContext.createGain();
|
|
@@ -8698,15 +8789,15 @@ var Ca = class e extends ya {
|
|
|
8698
8789
|
};
|
|
8699
8790
|
}
|
|
8700
8791
|
createSound() {
|
|
8701
|
-
return new
|
|
8792
|
+
return new ba();
|
|
8702
8793
|
}
|
|
8703
|
-
},
|
|
8794
|
+
}, Sa, Ca = class extends V {
|
|
8704
8795
|
static {
|
|
8705
|
-
|
|
8796
|
+
Sa = this;
|
|
8706
8797
|
}
|
|
8707
8798
|
static _soundPool = [];
|
|
8708
8799
|
_sounds = [];
|
|
8709
|
-
_platformAudio = Ke ? new
|
|
8800
|
+
_platformAudio = Ke ? new xa(this) : new ma(this);
|
|
8710
8801
|
get platformAudio() {
|
|
8711
8802
|
return this._platformAudio;
|
|
8712
8803
|
}
|
|
@@ -8799,7 +8890,7 @@ var Ca = class e extends ya {
|
|
|
8799
8890
|
this._sounds.length = 0;
|
|
8800
8891
|
}
|
|
8801
8892
|
_createSound() {
|
|
8802
|
-
return
|
|
8893
|
+
return Sa._soundPool.length > 0 ? Sa._soundPool.pop().init(this._platformAudio) : this._platformAudio.createSound().init(this._platformAudio);
|
|
8803
8894
|
}
|
|
8804
8895
|
refresh() {
|
|
8805
8896
|
for (let e = this._sounds.length, t = 0; t < e; t++) this._sounds[t].refresh();
|
|
@@ -8815,7 +8906,7 @@ var Ca = class e extends ya {
|
|
|
8815
8906
|
this._recycleSound(e);
|
|
8816
8907
|
};
|
|
8817
8908
|
_recycleSound(e) {
|
|
8818
|
-
e.destroy(),
|
|
8909
|
+
e.destroy(), Sa._soundPool.includes(e) || Sa._soundPool.push(e);
|
|
8819
8910
|
}
|
|
8820
8911
|
_prevTime = 0;
|
|
8821
8912
|
_timer = 0;
|
|
@@ -8831,10 +8922,10 @@ var Ca = class e extends ya {
|
|
|
8831
8922
|
}, 100);
|
|
8832
8923
|
}
|
|
8833
8924
|
};
|
|
8834
|
-
|
|
8925
|
+
Ca = Sa = k([b("Audio"), O("design:paramtypes", [Object])], Ca);
|
|
8835
8926
|
//#endregion
|
|
8836
8927
|
//#region src/scene/audio/AudioSpectrum.ts
|
|
8837
|
-
var
|
|
8928
|
+
var wa = class extends wr {}, Ta = class extends ea {
|
|
8838
8929
|
_audioBuffer;
|
|
8839
8930
|
_src = (() => {
|
|
8840
8931
|
let e = S();
|
|
@@ -8858,7 +8949,7 @@ var Oa = class extends wr {}, ka = class extends ea {
|
|
|
8858
8949
|
}
|
|
8859
8950
|
}
|
|
8860
8951
|
async _loadSrc(e) {
|
|
8861
|
-
await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) =>
|
|
8952
|
+
await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) => ya.decode(e)).then((e) => {
|
|
8862
8953
|
this._audioBuffer = e, this.syncTexture(!0);
|
|
8863
8954
|
});
|
|
8864
8955
|
}
|
|
@@ -8893,12 +8984,12 @@ var Oa = class extends wr {}, ka = class extends ea {
|
|
|
8893
8984
|
this.syncTexture(), super._process(e);
|
|
8894
8985
|
}
|
|
8895
8986
|
};
|
|
8896
|
-
k([_(), O("design:type", Object)],
|
|
8987
|
+
k([_(), O("design:type", Object)], Ta.prototype, "src", void 0), k([_({ fallback: 0 }), O("design:type", Number)], Ta.prototype, "gap", void 0), k([_({ fallback: "#000000" }), O("design:type", String)], Ta.prototype, "color", void 0), Ta = k([b("AudioWaveform"), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial])], Ta);
|
|
8897
8988
|
//#endregion
|
|
8898
8989
|
//#region src/scene/transitions/KawaseTransition.ts
|
|
8899
|
-
var
|
|
8990
|
+
var Ea, Da = class extends Cr {
|
|
8900
8991
|
static {
|
|
8901
|
-
|
|
8992
|
+
Ea = this;
|
|
8902
8993
|
}
|
|
8903
8994
|
blur = 10;
|
|
8904
8995
|
quality = 10;
|
|
@@ -8917,7 +9008,7 @@ var Aa, ja = class extends Cr {
|
|
|
8917
9008
|
let d = 1 / s, f = 1 / c, p = [], m, h = o - 1;
|
|
8918
9009
|
for (let e = 0; e < h; e++) m = u[e] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p });
|
|
8919
9010
|
m = u[h] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p }), l.forEach((t) => {
|
|
8920
|
-
L.draw(e,
|
|
9011
|
+
L.draw(e, Ea.material, {
|
|
8921
9012
|
sampler: r,
|
|
8922
9013
|
progress: i,
|
|
8923
9014
|
...t
|
|
@@ -8925,31 +9016,31 @@ var Aa, ja = class extends Cr {
|
|
|
8925
9016
|
});
|
|
8926
9017
|
}
|
|
8927
9018
|
};
|
|
8928
|
-
|
|
9019
|
+
Da = Ea = k([b("KawaseTransition")], Da);
|
|
8929
9020
|
//#endregion
|
|
8930
9021
|
//#region src/scene/transitions/LeftEraseTransition.ts
|
|
8931
|
-
var
|
|
9022
|
+
var Oa, ka = class extends Cr {
|
|
8932
9023
|
static {
|
|
8933
|
-
|
|
9024
|
+
Oa = this;
|
|
8934
9025
|
}
|
|
8935
9026
|
static material = new I({ gl: {
|
|
8936
9027
|
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}",
|
|
8937
9028
|
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}"
|
|
8938
9029
|
} });
|
|
8939
9030
|
apply(e) {
|
|
8940
|
-
L.draw(e,
|
|
9031
|
+
L.draw(e, Oa.material, {
|
|
8941
9032
|
previous: 0,
|
|
8942
9033
|
next: 1,
|
|
8943
9034
|
progress: this.currentTimeProgress
|
|
8944
9035
|
});
|
|
8945
9036
|
}
|
|
8946
9037
|
};
|
|
8947
|
-
|
|
9038
|
+
ka = Oa = k([b("LeftEraseTransition")], ka);
|
|
8948
9039
|
//#endregion
|
|
8949
9040
|
//#region src/scene/transitions/TiltShiftTransition.ts
|
|
8950
|
-
var
|
|
9041
|
+
var Aa, ja = class extends Cr {
|
|
8951
9042
|
static {
|
|
8952
|
-
|
|
9043
|
+
Aa = this;
|
|
8953
9044
|
}
|
|
8954
9045
|
blur = 100;
|
|
8955
9046
|
gradientBlur = 600;
|
|
@@ -8961,7 +9052,7 @@ var Pa, Fa = class extends Cr {
|
|
|
8961
9052
|
let n = this.currentTimeProgress, r, i;
|
|
8962
9053
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
8963
9054
|
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);
|
|
8964
|
-
L.draw(e,
|
|
9055
|
+
L.draw(e, Aa.material, {
|
|
8965
9056
|
sampler: r,
|
|
8966
9057
|
progress: i,
|
|
8967
9058
|
blur: this.blur,
|
|
@@ -8970,7 +9061,7 @@ var Pa, Fa = class extends Cr {
|
|
|
8970
9061
|
end: c,
|
|
8971
9062
|
delta: [u / f, d / f],
|
|
8972
9063
|
texSize: l
|
|
8973
|
-
}), L.draw(e,
|
|
9064
|
+
}), L.draw(e, Aa.material, {
|
|
8974
9065
|
sampler: r,
|
|
8975
9066
|
progress: i,
|
|
8976
9067
|
blur: this.blur,
|
|
@@ -8982,12 +9073,12 @@ var Pa, Fa = class extends Cr {
|
|
|
8982
9073
|
});
|
|
8983
9074
|
}
|
|
8984
9075
|
};
|
|
8985
|
-
|
|
9076
|
+
ja = Aa = k([b("TiltShiftTransition")], ja);
|
|
8986
9077
|
//#endregion
|
|
8987
9078
|
//#region src/scene/transitions/TwistTransition.ts
|
|
8988
|
-
var
|
|
9079
|
+
var Ma, Na = class extends Cr {
|
|
8989
9080
|
static {
|
|
8990
|
-
|
|
9081
|
+
Ma = this;
|
|
8991
9082
|
}
|
|
8992
9083
|
radius;
|
|
8993
9084
|
angle = 4;
|
|
@@ -9001,7 +9092,7 @@ var Ia, La = class extends Cr {
|
|
|
9001
9092
|
let n = this.currentTimeProgress, r, i;
|
|
9002
9093
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
9003
9094
|
let a = t.width, o = t.height;
|
|
9004
|
-
L.draw(e,
|
|
9095
|
+
L.draw(e, Ma.material, {
|
|
9005
9096
|
sampler: r,
|
|
9006
9097
|
progress: i,
|
|
9007
9098
|
filterArea: [
|
|
@@ -9017,10 +9108,10 @@ var Ia, La = class extends Cr {
|
|
|
9017
9108
|
});
|
|
9018
9109
|
}
|
|
9019
9110
|
};
|
|
9020
|
-
|
|
9111
|
+
Na = Ma = k([b("TwistTransition")], Na);
|
|
9021
9112
|
//#endregion
|
|
9022
9113
|
//#region src/asset/loaders/GifLoader.ts
|
|
9023
|
-
var
|
|
9114
|
+
var Pa = class extends Vn {
|
|
9024
9115
|
install(e) {
|
|
9025
9116
|
let t = async (t) => {
|
|
9026
9117
|
let { decodeFrames: n } = await import("modern-gif");
|
|
@@ -9037,14 +9128,14 @@ var Ra = class extends Vn {
|
|
|
9037
9128
|
e.register(n, t);
|
|
9038
9129
|
}), e.gif = this, this;
|
|
9039
9130
|
}
|
|
9040
|
-
},
|
|
9131
|
+
}, Fa = class extends Vn {
|
|
9041
9132
|
install(e) {
|
|
9042
9133
|
let t = async (e) => JSON.parse(await e.text());
|
|
9043
9134
|
return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), ["application/json"].forEach((n) => {
|
|
9044
9135
|
e.register(n, t);
|
|
9045
9136
|
}), e.json = this, this;
|
|
9046
9137
|
}
|
|
9047
|
-
},
|
|
9138
|
+
}, Ia = class extends Vn {
|
|
9048
9139
|
install(e) {
|
|
9049
9140
|
return this.load = async (t, n) => (await import("lottie-web").then((e) => e.default)).loadAnimation({
|
|
9050
9141
|
container: null,
|
|
@@ -9055,12 +9146,12 @@ var Ra = class extends Vn {
|
|
|
9055
9146
|
animationData: await e.loadBy(t, () => e.fetch(t).then((e) => e.json()))
|
|
9056
9147
|
}), e.lottie = this, this;
|
|
9057
9148
|
}
|
|
9058
|
-
},
|
|
9149
|
+
}, La = class extends Vn {
|
|
9059
9150
|
install(e) {
|
|
9060
9151
|
let t = async (e) => e.text();
|
|
9061
9152
|
return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), e.text = this, this;
|
|
9062
9153
|
}
|
|
9063
|
-
},
|
|
9154
|
+
}, Ra = class extends Vn {
|
|
9064
9155
|
install(e) {
|
|
9065
9156
|
let t = (t) => e.fetchImageBitmap(t, { premultiplyAlpha: "premultiply" }).then((e) => new z({
|
|
9066
9157
|
source: e,
|
|
@@ -9084,11 +9175,11 @@ var Ra = class extends Vn {
|
|
|
9084
9175
|
e.register(n, t);
|
|
9085
9176
|
}), e.texture = this, this;
|
|
9086
9177
|
}
|
|
9087
|
-
},
|
|
9178
|
+
}, za = class extends Vn {
|
|
9088
9179
|
install(e) {
|
|
9089
9180
|
return this.load = (t) => e.awaitBy(() => new ar(t).load()), e.video = this, this;
|
|
9090
9181
|
}
|
|
9091
|
-
},
|
|
9182
|
+
}, Ba = Object.entries({
|
|
9092
9183
|
"font/woff": ["woff"],
|
|
9093
9184
|
"font/ttf": ["ttf"],
|
|
9094
9185
|
"font/otf": ["otf"],
|
|
@@ -9104,31 +9195,31 @@ var Ra = class extends Vn {
|
|
|
9104
9195
|
"image/webp": ["webp"],
|
|
9105
9196
|
"application/json": ["json"]
|
|
9106
9197
|
});
|
|
9107
|
-
function
|
|
9108
|
-
for (let [t, n] of
|
|
9198
|
+
function Va(e) {
|
|
9199
|
+
for (let [t, n] of Ba) if (n.includes(e)) return t;
|
|
9109
9200
|
}
|
|
9110
|
-
function
|
|
9201
|
+
function Ha(e) {
|
|
9111
9202
|
let t;
|
|
9112
9203
|
if (e.startsWith("data:")) t = e.match(/^data:(.+?);/)?.[1];
|
|
9113
9204
|
else if (e.startsWith("http")) {
|
|
9114
9205
|
let n = e.split(/[#?]/)[0].split(".").pop()?.trim();
|
|
9115
|
-
n && (t =
|
|
9206
|
+
n && (t = Va(n));
|
|
9116
9207
|
}
|
|
9117
9208
|
return t;
|
|
9118
9209
|
}
|
|
9119
9210
|
//#endregion
|
|
9120
9211
|
//#region src/asset/Assets.ts
|
|
9121
|
-
var
|
|
9212
|
+
var Ua = "WeakRef" in globalThis, Wa = class extends e {
|
|
9122
9213
|
defaultHandler = (e) => e;
|
|
9123
9214
|
_handlers = /* @__PURE__ */ new Map();
|
|
9124
9215
|
_handleing = /* @__PURE__ */ new Map();
|
|
9125
9216
|
_handled = /* @__PURE__ */ new Map();
|
|
9126
|
-
_gc =
|
|
9217
|
+
_gc = Ua ? new FinalizationRegistry((e) => {
|
|
9127
9218
|
let t = this.get(e);
|
|
9128
9219
|
t && "destroy" in t && t.destroy(), this._handled.delete(e);
|
|
9129
9220
|
}) : void 0;
|
|
9130
9221
|
constructor() {
|
|
9131
|
-
super(),
|
|
9222
|
+
super(), Ua || x.on(this.gc.bind(this), { sort: 2 });
|
|
9132
9223
|
}
|
|
9133
9224
|
use(e) {
|
|
9134
9225
|
return e.install(this), this;
|
|
@@ -9177,11 +9268,11 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9177
9268
|
}
|
|
9178
9269
|
get(e) {
|
|
9179
9270
|
let t = this._handled.get(e);
|
|
9180
|
-
return
|
|
9271
|
+
return Ua && t instanceof WeakRef && (t = t.deref(), t || this._handleing.delete(e)), t;
|
|
9181
9272
|
}
|
|
9182
9273
|
set(e, t) {
|
|
9183
9274
|
let n = t;
|
|
9184
|
-
|
|
9275
|
+
Ua && typeof t == "object" && (this._gc.register(t, e), n = new WeakRef(t)), this._handled.set(e, n);
|
|
9185
9276
|
}
|
|
9186
9277
|
async awaitBy(e) {
|
|
9187
9278
|
let t = e(), n = c();
|
|
@@ -9196,7 +9287,7 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9196
9287
|
return this._handleing.set(e, r), r;
|
|
9197
9288
|
}
|
|
9198
9289
|
async load(e, t) {
|
|
9199
|
-
let n = await this.loadBy(e), r =
|
|
9290
|
+
let n = await this.loadBy(e), r = Ha(e);
|
|
9200
9291
|
return r === void 0 && (r = n.type?.split(";")[0] ?? void 0), ((r ? this._handlers.get(r) : void 0) ?? this.defaultHandler)(n, t);
|
|
9201
9292
|
}
|
|
9202
9293
|
async waitUntilLoad() {
|
|
@@ -9210,14 +9301,14 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9210
9301
|
n && "destroy" in n && n.destroy();
|
|
9211
9302
|
}), this._handled.clear();
|
|
9212
9303
|
}
|
|
9213
|
-
}, $ = new
|
|
9304
|
+
}, $ = new Wa().use(new Hn()).use(new Pa()).use(new Fa()).use(new Ia()).use(new La()).use(new Ra()).use(new za()), Ga = {
|
|
9214
9305
|
alpha: !0,
|
|
9215
9306
|
stencil: !0,
|
|
9216
9307
|
antialias: !1,
|
|
9217
9308
|
premultipliedAlpha: !0,
|
|
9218
9309
|
preserveDrawingBuffer: !1,
|
|
9219
9310
|
powerPreference: "default"
|
|
9220
|
-
},
|
|
9311
|
+
}, Ka = class extends Sr {
|
|
9221
9312
|
renderer;
|
|
9222
9313
|
get view() {
|
|
9223
9314
|
return this.renderer.view;
|
|
@@ -9250,12 +9341,12 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9250
9341
|
constructor(e = {}) {
|
|
9251
9342
|
let { view: t, width: n, height: r, pixelRatio: i = Ye, autoResize: a, data: o } = e;
|
|
9252
9343
|
super(), this.renderer = new Bn(t, {
|
|
9253
|
-
alpha:
|
|
9254
|
-
stencil:
|
|
9255
|
-
antialias:
|
|
9256
|
-
premultipliedAlpha:
|
|
9257
|
-
preserveDrawingBuffer:
|
|
9258
|
-
powerPreference:
|
|
9344
|
+
alpha: Ga.alpha ?? e.alpha,
|
|
9345
|
+
stencil: Ga.stencil ?? e.stencil,
|
|
9346
|
+
antialias: Ga.antialias ?? e.antialias,
|
|
9347
|
+
premultipliedAlpha: Ga.premultipliedAlpha ?? e.premultipliedAlpha,
|
|
9348
|
+
preserveDrawingBuffer: Ga.preserveDrawingBuffer ?? e.preserveDrawingBuffer,
|
|
9349
|
+
powerPreference: Ga.powerPreference ?? e.powerPreference
|
|
9259
9350
|
}), 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);
|
|
9260
9351
|
}
|
|
9261
9352
|
_updateProperty(e, t, n) {
|
|
@@ -9338,22 +9429,22 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9338
9429
|
super._destroy(), this._resizeObserver?.disconnect(), this.renderer.destroy();
|
|
9339
9430
|
}
|
|
9340
9431
|
};
|
|
9341
|
-
k([_({ fallback: !1 }), O("design:type", Boolean)],
|
|
9432
|
+
k([_({ fallback: !1 }), O("design:type", Boolean)], Ka.prototype, "autoResize", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], Ka.prototype, "autoStart", void 0);
|
|
9342
9433
|
//#endregion
|
|
9343
9434
|
//#region src/render.ts
|
|
9344
|
-
var
|
|
9345
|
-
function
|
|
9346
|
-
return
|
|
9435
|
+
var qa, Ja = [], Ya = !1;
|
|
9436
|
+
function Xa() {
|
|
9437
|
+
return qa ??= new Ka({
|
|
9347
9438
|
pixelRatio: 1,
|
|
9348
9439
|
width: 1,
|
|
9349
9440
|
height: 1,
|
|
9350
9441
|
preserveDrawingBuffer: !0
|
|
9351
9442
|
});
|
|
9352
9443
|
}
|
|
9353
|
-
async function
|
|
9354
|
-
if (
|
|
9355
|
-
for (
|
|
9356
|
-
let t =
|
|
9444
|
+
async function Za(e = 100) {
|
|
9445
|
+
if (!Ya) {
|
|
9446
|
+
for (Ya = !0; Ja.length;) {
|
|
9447
|
+
let t = Ja.shift();
|
|
9357
9448
|
if (t) try {
|
|
9358
9449
|
await t();
|
|
9359
9450
|
} catch (e) {
|
|
@@ -9361,11 +9452,11 @@ async function to(e = 100) {
|
|
|
9361
9452
|
}
|
|
9362
9453
|
else await new Promise((t) => setTimeout(t, e));
|
|
9363
9454
|
}
|
|
9364
|
-
|
|
9455
|
+
Ya = !1;
|
|
9365
9456
|
}
|
|
9366
9457
|
}
|
|
9367
|
-
async function
|
|
9368
|
-
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 =
|
|
9458
|
+
async function Qa(e) {
|
|
9459
|
+
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 = Xa();
|
|
9369
9460
|
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) {
|
|
9370
9461
|
let e = o.length, t = o[e - 1];
|
|
9371
9462
|
for (let n = 0; n < e; n++) {
|
|
@@ -9383,15 +9474,15 @@ async function no(e) {
|
|
|
9383
9474
|
toCanvas2D: () => f.toCanvas2D(new ImageData(p, u, d))
|
|
9384
9475
|
};
|
|
9385
9476
|
}
|
|
9386
|
-
async function
|
|
9477
|
+
async function $a(e) {
|
|
9387
9478
|
return new Promise((t) => {
|
|
9388
|
-
|
|
9479
|
+
Ja.push(async () => t(await Qa(e).then((e) => e.toCanvas2D()))), Za();
|
|
9389
9480
|
});
|
|
9390
9481
|
}
|
|
9391
|
-
async function
|
|
9482
|
+
async function eo(e) {
|
|
9392
9483
|
return new Promise((t) => {
|
|
9393
|
-
|
|
9484
|
+
Ja.push(async () => t(await Qa(e).then((e) => e.pixels))), Za();
|
|
9394
9485
|
});
|
|
9395
9486
|
}
|
|
9396
9487
|
//#endregion
|
|
9397
|
-
export { yt as Aabb2D, $n as AnimatedTexture,
|
|
9488
|
+
export { yt as Aabb2D, $n as AnimatedTexture, da as Animation, Wa as Assets, Ca as Audio, ha as AudioPipeline, ga as AudioProcessor, wa as AudioSpectrum, Ta as AudioWaveform, A as BufferUsage, Tr as Camera2D, sr as CanvasContext, _r as CanvasItem, er as CanvasTexture, T as Color, W as ColorAdjustEffect, Rr as ColorFilterEffect, St as ColorMatrix, Vr as ColorOverlayEffect, Ur as ColorRemoveEffect, Kr as ColorReplaceEffect, tr as ColorTexture, C as CoreObject, bt as DEG_TO_RAD, Ye as DEVICE_PIXEL_RATIO, G as DrawboardEffect, $r as DropShadowEffect, U as Effect, Xn as EffectMaterial, ea as Element2D, _i as Element2DBackground, X as Element2DChart, xi as Element2DConnection, Y as Element2DFill, ki as Element2DForeground, ji as Element2DOutline, Mi as Element2DShadow, Ni as Element2DShape, Pi as Element2DStyle, Ri as Element2DTable, Z as Element2DText, ti as EmbossEffect, Ka as Engine, Yi as Flexbox, Hn as FontLoader, Zr as GaussianBlurEffect, Wn as Geometry, Pa as GifLoader, ln as GlBatch2DSystem, an as GlBlendMode, Dt as GlBuffer, Pt as GlBufferSystem, Et as GlBufferTarget, pn as GlMaskSystem, Kt as GlProgram, _n as GlRenderTarget, vn as GlRenderTargetSystem, tn as GlShaderSystem, sn as GlState, cn as GlStateSystem, hn as GlStencilSystem, j as GlSystem, gn as GlViewportSystem, K as GlitchEffect, q as GodrayEffect, nr as GradientTexture, ma as HTMLAudio, fa as HTMLAudioContext, pa as HTMLSound, qe as IN_BROWSER, Je as IN_MAC_OS, Un as IndexBuffer, _t as Input, dt as InputEvent, Fa as JsonLoader, si as KawaseBlurEffect, Da as KawaseTransition, ft as KeyboardInputEvent, ka as LeftEraseTransition, Vn as Loader, na as Lottie2D, Ia as LottieLoader, Tt as MainLoop, li as MaskEffect, I as Material, lr as Meta, pt as MouseInputEvent, B as Node, wr as Node2D, Ct as Obb2D, J as OutlineEffect, Se as PI, Ce as PI_2, pi as PixelateEffect, rr as PixelsTexture, mt as PointerInputEvent, wt as Projection2D, Gn as QuadGeometry, L as QuadUvGeometry, xt as RAD_TO_DEG, vt as RefCounted, R as RenderTarget, Ot as Renderer, w as Resource, He as SUPPORTS_AUDIO_CONTEXT, Be as SUPPORTS_CLICK_EVENTS, Ve as SUPPORTS_CREATE_IMAGE_BITMAP, Pe as SUPPORTS_IMAGE_BITMAP, Re as SUPPORTS_MOUSE_EVENTS, We as SUPPORTS_OFFLINE_AUDIO_CONTEXT, Ie as SUPPORTS_POINTER_EVENTS, Fe as SUPPORTS_RESIZE_OBSERVER, ze as SUPPORTS_TOUCH_EVENTS, Ne as SUPPORTS_WEBGL2, Ue as SUPPORTS_WEBKIT_AUDIO_CONTEXT, Ge as SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, Ke as SUPPORTS_WEB_AUDIO, Le as SUPPORTS_WHEEL_EVENTS, Sr as SceneTree, La as TextLoader, z as Texture2D, Ra as TextureLoader, ta as TextureRect2D, x as Ticker, ja as TiltShiftTransition, br as Timeline, V as TimelineNode, ra as TransformRect2D, Cr as Transition, Na as TwistTransition, At as UniformGroup, Qn as UvGeometry, Zn as UvMaterial, F as VertexAttribute, P as VertexBuffer, ia as Video2D, za as VideoLoader, ar as VideoTexture, H as Viewport, or as ViewportTexture, xa as WebAudio, ya as WebAudioContext, Bn as WebGLRenderer, ba as WebSound, ht as WheelInputEvent, xr as Window, hi as ZoomBlurEffect, Bi as alignMap, $ as assets, Er as axisDir, Ji as boxSizingMap, E as clamp, oi as clampFrag, S as createHTMLCanvas, Nt as createIdFromString, be as createNode, ct as crossOrigin, la as cssEasingPresets, ca as cubicBezier, b as customNode, ye as customNodes, Ga as defaultOptions, st as determineCrossOrigin, Hi as directionMap, Vi as displayMap, Q as edgeMap, Ui as flexDirectionMap, Wi as flexWrapMap, ai as frag, rt as getCanvasFactory, Oe as getDefaultCssPropertyValue, ot as getGlContextProvider, Xa as getRenderEngine, zi as gutterMap, ut as instanceId, $e as isCanvasElement, Xe as isElementNode, Qe as isImageElement, we as isPow2, Ze as isVideoElement, et as isWebgl2, Gi as justifyMap, D as lerp, dn as log2, on as mapGlBlendModes, un as nextPow2, xe as nextTick, Ki as overflowMap, Pr as parseCssFilter, Ae as parseCssFunctions, ke as parseCssProperty, Fr as parseCssTransformOrigin, qi as positionTypeMap, $a as render, eo as renderPixels, hr as resetBatchPool, Dr as routeConnection, nt as setCanvasFactory, at as setGlContextProvider, mn as stencilModeMap };
|
|
@@ -32,6 +32,8 @@ export declare class Element2DChart extends CoreObject implements NormalizedChar
|
|
|
32
32
|
isValid(): boolean;
|
|
33
33
|
/** Render with echarts into the offscreen canvas backing `_texture`. */
|
|
34
34
|
update(): Promise<void>;
|
|
35
|
+
/** echarts 缺失时画一个虚线框 + 文案的占位纹理,而非静默空白。 */
|
|
36
|
+
protected _renderPlaceholder(width: number, height: number): void;
|
|
35
37
|
/** Paint the echarts texture onto the element, like fill/background do. */
|
|
36
38
|
draw(): void;
|
|
37
39
|
/** Map the normalized idoc chart to an echarts option. */
|
|
@@ -3,21 +3,23 @@ import { RawWeakMap } from 'modern-idoc';
|
|
|
3
3
|
import { PathMeasure } from 'modern-path2d';
|
|
4
4
|
import { Element2D } from '../2d';
|
|
5
5
|
import { TimelineNode } from '../main';
|
|
6
|
-
export declare const linear: (amount: number) => number;
|
|
7
|
-
export declare const ease: (amount: number) => number;
|
|
8
|
-
export declare const easeIn: (amount: number) => number;
|
|
9
|
-
export declare const easeOut: (amount: number) => number;
|
|
10
|
-
export declare const easeInOut: (amount: number) => number;
|
|
11
6
|
export declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (amount: number) => number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
/** CSS 缓动预设:name → cubic-bezier 控制点 [x1, y1, x2, y2] */
|
|
8
|
+
export declare const cssEasingPresets: {
|
|
9
|
+
readonly linear: readonly [0, 0, 1, 1];
|
|
10
|
+
readonly ease: readonly [0.25, 0.1, 0.25, 1];
|
|
11
|
+
readonly 'ease-in': readonly [0.42, 0, 1, 1];
|
|
12
|
+
readonly 'ease-out': readonly [0, 0, 0.58, 1];
|
|
13
|
+
readonly 'ease-in-out': readonly [0.42, 0, 0.58, 1];
|
|
14
|
+
readonly 'ease-in-quad': readonly [0.55, 0.085, 0.68, 0.53];
|
|
15
|
+
readonly 'ease-out-quad': readonly [0.25, 0.46, 0.45, 0.94];
|
|
16
|
+
readonly 'ease-in-out-quad': readonly [0.455, 0.03, 0.515, 0.955];
|
|
17
|
+
readonly 'ease-in-cubic': readonly [0.55, 0.055, 0.675, 0.19];
|
|
18
|
+
readonly 'ease-out-cubic': readonly [0.215, 0.61, 0.355, 1];
|
|
19
|
+
readonly 'ease-in-out-cubic': readonly [0.645, 0.045, 0.355, 1];
|
|
18
20
|
};
|
|
19
|
-
export type
|
|
20
|
-
export type Easing =
|
|
21
|
+
export type CssEasing = keyof typeof cssEasingPresets;
|
|
22
|
+
export type Easing = CssEasing | `cubic-bezier(${string})`;
|
|
21
23
|
export interface Keyframe {
|
|
22
24
|
easing?: Easing;
|
|
23
25
|
offset?: number;
|
|
@@ -46,6 +46,10 @@ export declare class SceneTree extends MainLoop {
|
|
|
46
46
|
readonly root: Window;
|
|
47
47
|
timeline: Timeline;
|
|
48
48
|
readonly nodeMap: Map<string, Node>;
|
|
49
|
+
/** 已订阅 load 事件的 fonts 实例,用于在 fonts 切换 / 销毁时解绑。 */
|
|
50
|
+
protected _boundFonts?: Fonts;
|
|
51
|
+
protected _textRemeasureScheduled: boolean;
|
|
52
|
+
protected _onFontLoad: () => void;
|
|
49
53
|
protected _backgroundColor: Color;
|
|
50
54
|
protected _previousViewport?: Viewport;
|
|
51
55
|
protected _currentViewport?: Viewport;
|
|
@@ -54,6 +58,14 @@ export declare class SceneTree extends MainLoop {
|
|
|
54
58
|
setCurrentViewport(viewport: Viewport | undefined): void;
|
|
55
59
|
getNodeById<T extends Node = Node>(id: string): T | undefined;
|
|
56
60
|
constructor(properties?: Partial<SceneTreeProperties>);
|
|
61
|
+
/** 订阅 fonts 的 load 事件,并在切换 fonts / 销毁时解绑,避免重复订阅与泄漏。 */
|
|
62
|
+
protected _bindFonts(next?: Fonts): void;
|
|
63
|
+
/**
|
|
64
|
+
* 字体到位后,重排树内全部文字(含表格 back 层单元格——它们也在 nodeMap)。
|
|
65
|
+
* 一个 tick 内多次 load 合并为一次。文字创建时字体可能尚未就绪、按 0 宽 glyph 测量挤成一坨,
|
|
66
|
+
* 这里在字体可用时自动重新测量,使所有消费方无需各自轮询字体状态。
|
|
67
|
+
*/
|
|
68
|
+
protected _scheduleTextRemeasure(): void;
|
|
57
69
|
protected _updateProperty(key: string, value: any, oldValue: any): void;
|
|
58
70
|
setProperties(properties?: Record<string, any>): this;
|
|
59
71
|
log(...args: any[]): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-canvas",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.12",
|
|
5
5
|
"packageManager": "pnpm@10.19.0",
|
|
6
6
|
"description": "A JavaScript WebGL rendering engine. only the ESM.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"colord": "^2.9.3",
|
|
64
64
|
"earcut": "^3.0.2",
|
|
65
|
-
"modern-font": "^0.6.
|
|
65
|
+
"modern-font": "^0.6.1",
|
|
66
66
|
"modern-idoc": "^0.11.9",
|
|
67
67
|
"modern-path2d": "^1.8.5",
|
|
68
68
|
"modern-text": "^2.0.6"
|