@netless/app-slide 0.0.48 → 0.0.49
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.d.ts +1 -1
- package/dist/main.cjs.js +46 -46
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +36 -30
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +7 -7
- package/dist/main.iife.js.map +1 -1
- package/package.json +2 -2
- package/src/SlideController/index.ts +1 -4
- package/src/index.ts +1 -1
package/dist/main.es.js
CHANGED
|
@@ -30414,7 +30414,7 @@ void main() {
|
|
|
30414
30414
|
});
|
|
30415
30415
|
}
|
|
30416
30416
|
destroy() {
|
|
30417
|
-
this.spriteSheets.forEach((t3) => t3.destroy(true));
|
|
30417
|
+
this.spriteSheets.forEach((t3) => t3.destroy(true)), this.spriteSheets = [], this.gifs = Object.create(null), this.textures = Object.create(null), this.frames = Object.create(null);
|
|
30418
30418
|
}
|
|
30419
30419
|
}
|
|
30420
30420
|
var uM = n(3), hM = n.n(uM);
|
|
@@ -31371,7 +31371,10 @@ void main(void){
|
|
|
31371
31371
|
return rM(t3);
|
|
31372
31372
|
}
|
|
31373
31373
|
destroy() {
|
|
31374
|
-
|
|
31374
|
+
Object.keys(this.textures).forEach((t3) => {
|
|
31375
|
+
var e3;
|
|
31376
|
+
(e3 = this.textures[t3].texture) === null || e3 === void 0 || e3.destroy();
|
|
31377
|
+
}), this.textures = Object.create(null), this.fillStyles = [], this.renderTextures.forEach((t3) => t3.destroy(true)), this.renderTextures = [], this.renderContainers.forEach((t3) => t3.destroy({ children: true })), this.renderContainers = [], this.spriteTextures.destroy(), this.idToHashMap = Object.create(null), this.hashToIdMap = Object.create(null);
|
|
31375
31378
|
}
|
|
31376
31379
|
}
|
|
31377
31380
|
class aA {
|
|
@@ -31703,7 +31706,7 @@ void main(void){
|
|
|
31703
31706
|
};
|
|
31704
31707
|
class SA extends bA {
|
|
31705
31708
|
constructor(t3, e3, n2) {
|
|
31706
|
-
super(t3, e3, n2), this.fillMaskSprite = new Ow(), this.fillSprite = new Ow(), this.strokeMaskSprite = new Ow(), this.strokeSprite = new Ow(), this.textureContainer = new ty(), this.underline = null;
|
|
31709
|
+
super(t3, e3, n2), this.fillMaskSprite = new Ow(), this.fillSprite = new Ow(), this.strokeMaskSprite = new Ow(), this.strokeSprite = new Ow(), this.textureContainer = new ty(), this.underline = null, this.cacheSprite = new Ow();
|
|
31707
31710
|
const { shapeId: i2, paragraphIndex: r3, lineIndex: o3, unitIndex: s3 } = t3, { underLine: a2 } = this.json;
|
|
31708
31711
|
a2 && (this.underline = new TA(e3, i2, r3, o3, s3)), this.fillTextureId = `${i2}-text-p${r3}-l${o3}-u${s3}-fill`, this.fillBgId = `${i2}-text-p${r3}-l${o3}-u${s3}-fill-bg`, this.strokeTextureId = `${i2}-text-p${r3}-l${o3}-u${s3}-stroke`, this.strokeBgId = `${i2}-text-p${r3}-l${o3}-u${s3}-stroke-bg`;
|
|
31709
31712
|
}
|
|
@@ -31751,12 +31754,10 @@ void main(void){
|
|
|
31751
31754
|
r4.texture = (t3 = e4 == null ? void 0 : e4.texture) !== null && t3 !== void 0 ? t3 : null, r4.mask = this.underline.sprite, r4.addChild(this.underline.sprite), this.textureContainer.addChild(r4);
|
|
31752
31755
|
}
|
|
31753
31756
|
const p2 = Hy.create({ width: r3 ? a2 : e3, height: r3 ? Math.max(d2, n2) : s3, resolution: 2 });
|
|
31754
|
-
KR.textureCacheSize += p2.width * p2.height * 2, this.ctx.renderer.render(this.textureContainer, { renderTexture: p2 });
|
|
31755
|
-
const f2 = new Ow();
|
|
31756
|
-
f2.texture = p2, this.container.addChild(f2), this.container.name = c2;
|
|
31757
|
+
KR.textureCacheSize += p2.width * p2.height * 2, this.ctx.renderer.render(this.textureContainer, { renderTexture: p2 }), this.cacheSprite.texture = p2, this.container.addChild(this.cacheSprite), this.container.name = c2;
|
|
31757
31758
|
}
|
|
31758
31759
|
destroy() {
|
|
31759
|
-
this.textureContainer.destroy({ texture: true }), this.container.destroy({ children: true, texture: true });
|
|
31760
|
+
this.cacheSprite.texture.destroy(true), this.cacheSprite.destroy({ texture: true, baseTexture: true }), this.textureContainer.destroy({ texture: true }), this.container.destroy({ children: true, texture: true });
|
|
31760
31761
|
}
|
|
31761
31762
|
}
|
|
31762
31763
|
var EA = function(t3, e3, n2, i2) {
|
|
@@ -32214,9 +32215,10 @@ void main(void){
|
|
|
32214
32215
|
clearOnSlideChange() {
|
|
32215
32216
|
}
|
|
32216
32217
|
destroy() {
|
|
32217
|
-
|
|
32218
|
+
var t3;
|
|
32219
|
+
(t3 = this.text) === null || t3 === void 0 || t3.destroy(), this.bgSprite.destroy(), this.backgroundMask.destroy({ texture: true, baseTexture: true }), this.pathSprite.destroy(), this.pathMask.destroy({ texture: true, baseTexture: true }), this.fillColorFilter.destroy(), this.strokeColorFilter.destroy(), this.renderContainer.destroy({ texture: true, baseTexture: true }), this.cacheSprite.destroy({ texture: true, baseTexture: true }), this.arrowList.forEach((t4) => {
|
|
32218
32220
|
var e3;
|
|
32219
|
-
(e3 =
|
|
32221
|
+
(e3 = t4.sprite) === null || e3 === void 0 || e3.destroy();
|
|
32220
32222
|
});
|
|
32221
32223
|
}
|
|
32222
32224
|
}
|
|
@@ -32612,7 +32614,7 @@ void main(void){
|
|
|
32612
32614
|
class ZA extends fA {
|
|
32613
32615
|
constructor(t3, e3, n2) {
|
|
32614
32616
|
var i2, r3, o3, s3;
|
|
32615
|
-
super(t3, e3, n2), this.children = [], this.cacheSprite = new Ow(), this.cacheContainer = new ty(), this.json = t3, this.container.name = t3.id, this.fillTextureId = t3.id + "-bg-fill", this.ctx.timingTargets.addTarget(t3.id, this);
|
|
32617
|
+
super(t3, e3, n2), this.children = [], this.cacheSprite = new Ow(), this.cacheContainer = new ty(), this.json = t3, this.container.name = t3.id, this.fillTextureId = t3.id + "-bg-fill", this.cacheContainer.name = t3.id + "-cache-container", this.ctx.timingTargets.addTarget(t3.id, this);
|
|
32616
32618
|
const a2 = { x: (r3 = (i2 = t3.position) === null || i2 === void 0 ? void 0 : i2.x) !== null && r3 !== void 0 ? r3 : 0, y: (s3 = (o3 = t3.position) === null || o3 === void 0 ? void 0 : o3.y) !== null && s3 !== void 0 ? s3 : 0 };
|
|
32617
32619
|
t3.children.forEach((t4) => {
|
|
32618
32620
|
let e4 = null;
|
|
@@ -32659,7 +32661,7 @@ void main(void){
|
|
|
32659
32661
|
this.children.forEach((t3) => t3.clearOnSlideChange());
|
|
32660
32662
|
}
|
|
32661
32663
|
destroy() {
|
|
32662
|
-
this.cacheSprite && this.cacheSprite.destroy({ texture: true }), this.children.forEach((t3) => t3.destroy()), this.container.destroy(), this.cacheContainer.destroy();
|
|
32664
|
+
this.cacheSprite && this.cacheSprite.destroy({ texture: true }), this.children.forEach((t3) => t3.destroy()), this.container.destroy(), this.cacheContainer.destroy({ children: true, texture: true, baseTexture: true });
|
|
32663
32665
|
}
|
|
32664
32666
|
}
|
|
32665
32667
|
class JA extends a.a {
|
|
@@ -33916,7 +33918,7 @@ void main(void){
|
|
|
33916
33918
|
createCtx(t3) {
|
|
33917
33919
|
const { task: e3 } = this.stageStates[t3];
|
|
33918
33920
|
e3.addMTask(() => {
|
|
33919
|
-
const e4 = new lM(this.loader), n2 = new a.a(), i2 = { mode: this.mode, renderer: this.renderer, graphicsTexture: new xM(this.taskId, t3, this.microTaskManager, this.renderer, this.graphicsCache), fillTexture: new sA(this.taskId, t3, this.microTaskManager, this.renderer, e4, this.fillCache), stageWidth: 0, stageHeight: 0, ticker: this.ticker, timingTargets: new lA(n2), eventHub: n2, view: this.view, medias: Object.create(null), lastViewedIndex: 0, conflictTimeNodeManager: new aA(), clock: this.clock, spriteTexture: e4 };
|
|
33921
|
+
const e4 = new lM(this.loader), n2 = new a.a(), i2 = { mode: this.mode, renderer: this.renderer, graphicsTexture: new xM(this.taskId, t3, this.microTaskManager, this.renderer, this.graphicsCache), fillTexture: new sA(this.taskId, t3, this.microTaskManager, this.renderer, e4, this.fillCache), stageWidth: 0, stageHeight: 0, ticker: this.ticker, timingTargets: new lA(n2), eventHub: n2, view: this.view, medias: Object.create(null), lastViewedIndex: 0, conflictTimeNodeManager: new aA(), clock: this.clock, spriteTexture: e4, slideIndex: t3 };
|
|
33920
33922
|
return this.stageCtxs[t3] = i2, Promise.resolve();
|
|
33921
33923
|
});
|
|
33922
33924
|
}
|
|
@@ -33973,18 +33975,20 @@ void main(void){
|
|
|
33973
33975
|
const { task: e3 } = this.stageStates[t3];
|
|
33974
33976
|
e3.addMTask(() => VR(this, void 0, void 0, function* () {
|
|
33975
33977
|
const n2 = this.stageJsons[t3], i2 = this.stageCtxs[t3];
|
|
33976
|
-
|
|
33978
|
+
console.log("1");
|
|
33979
|
+
const r3 = yield i2.graphicsTexture.hasLocalCache();
|
|
33980
|
+
if (console.log("2"), r3)
|
|
33977
33981
|
return;
|
|
33978
|
-
const
|
|
33979
|
-
this.collectChildren(n2,
|
|
33980
|
-
const
|
|
33981
|
-
for (let t4 = 0; t4 <
|
|
33982
|
-
const e4 =
|
|
33983
|
-
|
|
33982
|
+
const o3 = [];
|
|
33983
|
+
this.collectChildren(n2, o3);
|
|
33984
|
+
const s3 = Math.ceil(o3.length / 10), a2 = [];
|
|
33985
|
+
for (let t4 = 0; t4 < o3.length; t4 += s3) {
|
|
33986
|
+
const e4 = o3.slice(t4, t4 + s3);
|
|
33987
|
+
a2.push(() => (e4.forEach((t5) => {
|
|
33984
33988
|
(XR(t5) || qR(t5)) && NR(t5, i2, this.objPoolGroup);
|
|
33985
33989
|
}), Promise.resolve()));
|
|
33986
33990
|
}
|
|
33987
|
-
e3.addSubMTask(
|
|
33991
|
+
e3.addSubMTask(a2);
|
|
33988
33992
|
}));
|
|
33989
33993
|
}
|
|
33990
33994
|
createFillTexture(t3) {
|
|
@@ -34196,7 +34200,7 @@ void main(void){
|
|
|
34196
34200
|
const e3 = Hy.create({ width: this.designWidth, height: this.designHeight, resolution: 1 });
|
|
34197
34201
|
KR.textureCacheSize += e3.width * e3.height, this.app.renderer.render(t3.container, { renderTexture: e3 });
|
|
34198
34202
|
const n2 = this.app.renderer.plugins.extract.base64(e3, "image/jpeg");
|
|
34199
|
-
return e3.destroy(), n2;
|
|
34203
|
+
return e3.destroy(true), n2;
|
|
34200
34204
|
}
|
|
34201
34205
|
playTransaction(t3, e3, n2, i2, r3) {
|
|
34202
34206
|
return ZR(this, void 0, void 0, function* () {
|
|
@@ -34302,12 +34306,15 @@ void main(void){
|
|
|
34302
34306
|
}
|
|
34303
34307
|
destroy() {
|
|
34304
34308
|
var t3;
|
|
34305
|
-
fM.collectObjectByGroup(this.objPoolGroup), mM.collectObjectByGroup(this.objPoolGroup), (t3 = this.transactionPlayer) === null || t3 === void 0 || t3.destroy(), this.loader.destroy(), this.fps.destroy(), this.stagePool.destroyAllStage();
|
|
34306
34309
|
try {
|
|
34307
|
-
this.app.renderer.
|
|
34310
|
+
this.app.renderer.filter.texturePool.clear(true), fM.collectObjectByGroup(this.objPoolGroup), mM.collectObjectByGroup(this.objPoolGroup), (t3 = this.transactionPlayer) === null || t3 === void 0 || t3.destroy(), this.loader.destroy(), this.fps.destroy(), this.stagePool.destroyAllStage();
|
|
34311
|
+
try {
|
|
34312
|
+
this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext();
|
|
34313
|
+
} catch (t4) {
|
|
34314
|
+
}
|
|
34315
|
+
this.app.destroy(true, { children: true, texture: true, baseTexture: true });
|
|
34308
34316
|
} catch (t4) {
|
|
34309
34317
|
}
|
|
34310
|
-
this.app.destroy(true, { children: false, texture: true, baseTexture: true });
|
|
34311
34318
|
}
|
|
34312
34319
|
}
|
|
34313
34320
|
KR.textureCacheSize = 0, KR.storeManager = ZE, KR.platform = jR;
|
|
@@ -35838,7 +35845,7 @@ void main(void){
|
|
|
35838
35845
|
}
|
|
35839
35846
|
var aC = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange" }, lC = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: Object.create(null), interactiveSeqState: Object.create(null) }, uC = "";
|
|
35840
35847
|
try {
|
|
35841
|
-
uC = "0.1.
|
|
35848
|
+
uC = "0.1.52";
|
|
35842
35849
|
} catch (t3) {
|
|
35843
35850
|
uC = "dev";
|
|
35844
35851
|
}
|
|
@@ -36103,7 +36110,7 @@ void main(void){
|
|
|
36103
36110
|
(n2 !== this.player.currentIndex || this.renderingTaskManager.hasStartTask()) && (n2 > this.slideCount && this.slideCount > 0 || this.poseRenderSlide(n2, e4));
|
|
36104
36111
|
}
|
|
36105
36112
|
}, e3.prototype.needCreateNewPlayer = function() {
|
|
36106
|
-
return (KR.platform.isIOS() || KR.platform.isAndroid()) && (this.iosResetCache.length >
|
|
36113
|
+
return (KR.platform.isIOS() || KR.platform.isAndroid()) && (this.iosResetCache.length > 20 || 4 * KR.textureCacheSize / 1048576 > 800);
|
|
36107
36114
|
}, e3.prototype.poseRenderSlide = function(t4, e4) {
|
|
36108
36115
|
this.isLoading = true, this.mode === "interactive" ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "renderSlide", index: t4, isForward: e4 }) : this.mode === "sync" ? (this.doRenderSlide(t4, e4), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "renderSlide", index: t4, isForward: e4 })) : this.doRenderSlide(t4, e4);
|
|
36109
36116
|
}, e3.prototype.doRenderSlide = function(t4, e4) {
|
|
@@ -36111,6 +36118,7 @@ void main(void){
|
|
|
36111
36118
|
if (e4 === void 0 && (e4 = true), !this.player)
|
|
36112
36119
|
return Promise.resolve();
|
|
36113
36120
|
if (this.needCreateNewPlayer() && (this.iosResetCache = [], KR.textureCacheSize = 0, this.iosNewPlayer = this.initPlayer(this.config), this.iosNewPlayer.setResourceData(this.__slideState.taskId, this.__slideState.url)), this.iosNewPlayer) {
|
|
36121
|
+
console.log("[slide] clear webgl context");
|
|
36114
36122
|
var r3 = this.player.getSnapshot();
|
|
36115
36123
|
this.cacheImage.src = r3, this.frame.appendChild(this.cacheImage), this.player.destroy(), this.player = this.iosNewPlayer, this.iosNewPlayer = void 0, this.needClearCacheImage = true, ((n2 = this == null ? void 0 : this.player) === null || n2 === void 0 ? void 0 : n2.view) && (this.player.view.style.visibility = "hidden", this.frame.appendChild(this.player.view));
|
|
36116
36124
|
}
|
|
@@ -36726,9 +36734,7 @@ class SlideController {
|
|
|
36726
36734
|
if (type === Slide.SLIDE_EVENTS.syncDispatch) {
|
|
36727
36735
|
this.syncStateOnce();
|
|
36728
36736
|
log("[Slide] receive", payload);
|
|
36729
|
-
|
|
36730
|
-
this.slide.emit(Slide.SLIDE_EVENTS.syncReceive, payload);
|
|
36731
|
-
}
|
|
36737
|
+
this.slide.emit(Slide.SLIDE_EVENTS.syncReceive, payload);
|
|
36732
36738
|
}
|
|
36733
36739
|
}
|
|
36734
36740
|
};
|
|
@@ -38226,7 +38232,7 @@ class SlidePreviewer {
|
|
|
38226
38232
|
return `${this.namespace}-${className}`;
|
|
38227
38233
|
}
|
|
38228
38234
|
}
|
|
38229
|
-
const version = "0.0.
|
|
38235
|
+
const version = "0.0.49";
|
|
38230
38236
|
const SlideApp = {
|
|
38231
38237
|
kind: "Slide",
|
|
38232
38238
|
setup(context) {
|