@netless/app-slide 0.0.28 → 0.0.33
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/README.md +14 -1
- package/dist/DocsViewer/index.d.ts +1 -5
- package/dist/SlideController/index.d.ts +1 -1
- package/dist/SlidePreviewer/index.d.ts +41 -0
- package/dist/index.d.ts +2 -0
- package/dist/main.cjs.js +221 -221
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +268 -84
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +143 -143
- package/dist/main.iife.js.map +1 -1
- package/dist/utils/logger.d.ts +20 -0
- package/package.json +4 -4
- package/src/DocsViewer/index.ts +1 -10
- package/src/SlideController/index.ts +26 -34
- package/src/SlideDocsViewer/index.ts +3 -3
- package/src/SlideDocsViewer/style.scss +1 -1
- package/src/SlidePreviewer/index.ts +176 -0
- package/src/index.ts +20 -5
- package/src/utils/bgcolor.ts +2 -3
- package/src/utils/freezer.ts +6 -15
- package/src/utils/logger.ts +39 -0
package/dist/main.es.js
CHANGED
|
@@ -29882,7 +29882,7 @@ void main() {
|
|
|
29882
29882
|
this.scaleExt = { x: 1, y: 1 }, this.scaleOrigin = { x: 1, y: 1 }, this.designScale = { x: 1, y: 1 }, this.bound = new fe(0, 0, 1, 1), this.pptX = 0, this.pptY = 0, this.presetSubType = 0, this.designWidth = 0, this.designHeight = 0, this.designX = 0, this.designY = 0, this.hasPreset = false, this.container = new Fe(), this.ctx = e3, this.style = new uu(this.container, t3.hardHidden), this.designGlobalPosition = { x: n2.x + ((r3 = (i2 = t3.position) === null || i2 === void 0 ? void 0 : i2.x) !== null && r3 !== void 0 ? r3 : 0), y: n2.y + ((s3 = (o3 = t3.position) === null || o3 === void 0 ? void 0 : o3.y) !== null && s3 !== void 0 ? s3 : 0) }, (t3.hlinkClick || t3.hlinkHover) && (this.hyperlink = new lu(this.container, this.ctx), t3.hlinkHover && ((a2 = this.hyperlink) === null || a2 === void 0 || a2.addAction(t3.hlinkHover, "hover")), t3.hlinkClick && ((u2 = this.hyperlink) === null || u2 === void 0 || u2.addAction(t3.hlinkClick, "click")));
|
|
29883
29883
|
}
|
|
29884
29884
|
updateScale() {
|
|
29885
|
-
this.container.scale.x = this.designScale.x * this.scaleExt.x * this.scaleOrigin.x, this.container.scale.y = this.designScale.y * this.scaleExt.y * this.scaleOrigin.y;
|
|
29885
|
+
this.container && (this.container.scale.x = this.designScale.x * this.scaleExt.x * this.scaleOrigin.x, this.container.scale.y = this.designScale.y * this.scaleExt.y * this.scaleOrigin.y);
|
|
29886
29886
|
}
|
|
29887
29887
|
updateTransform(t3) {
|
|
29888
29888
|
var e3, n2, i2, r3, o3, s3, a2, u2;
|
|
@@ -29904,7 +29904,7 @@ void main() {
|
|
|
29904
29904
|
return cu(this.designWidth / this.ctx.stageWidth);
|
|
29905
29905
|
}
|
|
29906
29906
|
get design_ppt_h() {
|
|
29907
|
-
return cu(this.designHeight / this.ctx.stageHeight);
|
|
29907
|
+
return cu((this.designHeight || this.container.height) / this.ctx.stageHeight);
|
|
29908
29908
|
}
|
|
29909
29909
|
get design_ppt_x() {
|
|
29910
29910
|
return cu(this.designX / this.ctx.stageWidth);
|
|
@@ -29919,10 +29919,12 @@ void main() {
|
|
|
29919
29919
|
this.scaleExt.x = t3 * this.ctx.stageWidth / this.designWidth, this.updateScale();
|
|
29920
29920
|
}
|
|
29921
29921
|
get ppt_h() {
|
|
29922
|
-
|
|
29922
|
+
const t3 = this.designHeight || this.container.height;
|
|
29923
|
+
return this.scaleExt.y * this.scaleOrigin.y * t3 / this.ctx.stageHeight;
|
|
29923
29924
|
}
|
|
29924
29925
|
set ppt_h(t3) {
|
|
29925
|
-
|
|
29926
|
+
const e3 = this.designHeight || this.container.height;
|
|
29927
|
+
this.scaleExt.y = t3 * this.ctx.stageHeight / e3, this.updateScale();
|
|
29926
29928
|
}
|
|
29927
29929
|
get ppt_x() {
|
|
29928
29930
|
return (this.container.position.x - this.container.pivot.x) / this.ctx.stageWidth;
|
|
@@ -30788,8 +30790,9 @@ void main() {
|
|
|
30788
30790
|
}, this.targetId = t3.targetId, this.ctx = t3.ctx, this.height = t3.height, this.width = t3.width, this.sprite = t3.sprite, this.media = t3.media, this.info = t3.info, this.canvasElement = t3.canvasElement, this.getMedianContainer(), this.createMediaController(), this.info.cut && (this.start = (e3 = this.info.cut.start) !== null && e3 !== void 0 ? e3 : 0, this.end = (n2 = this.info.cut.end) !== null && n2 !== void 0 ? n2 : 0);
|
|
30789
30791
|
}
|
|
30790
30792
|
getMedianContainer() {
|
|
30791
|
-
|
|
30792
|
-
|
|
30793
|
+
var t3;
|
|
30794
|
+
let e3 = (t3 = this.canvasElement.parentElement) === null || t3 === void 0 ? void 0 : t3.querySelector(".median-container");
|
|
30795
|
+
e3 || (e3 = document.createElement("div"), e3.className = "median-container", this.canvasElement.parentElement.appendChild(e3)), this.container = e3;
|
|
30793
30796
|
}
|
|
30794
30797
|
static formatTime(t3) {
|
|
30795
30798
|
let e3 = "00:00";
|
|
@@ -31075,7 +31078,7 @@ void main() {
|
|
|
31075
31078
|
var t3, e3, n2;
|
|
31076
31079
|
return sl(this, void 0, void 0, function* () {
|
|
31077
31080
|
const i2 = this.ctx.fillTexture.getTexture(this.picTextureId);
|
|
31078
|
-
i2.texture && (this.picSprite.texture = i2.texture), this.picMask.texture = this.backgroundMask.texture, this.picSprite.mask = this.picMask, this.picSprite.width = this.designWidth, this.picSprite.height = this.designHeight, this.container.addChild(this.picSprite), this.container.addChild(this.picMask), ((t3 = this.media) === null || t3 === void 0 ? void 0 : t3.type) === "video" ? (this.mediaPlayer = new il({ id: this.json.id + "-video", ctx: this.ctx, video: this.media, height: this.designHeight, width: this.designWidth, sprite: this.picSprite, container: this.container, canvasElement: this.ctx.view }), ((e3 = this.mediaPlayer) === null || e3 === void 0 ? void 0 : e3.sprite) && (this.mediaPlayer.sprite.mask = this.picMask)) : ((n2 = this.media) === null || n2 === void 0 ? void 0 : n2.type) === "audio" && (this.mediaPlayer = new ol({ id: this.json.id + "-audio", ctx: this.ctx, audio: this.media, height: this.designHeight, width: this.designWidth, sprite: this.picSprite, container: this.container, canvasElement: this.ctx.view })), this.mediaPlayer && (this.picSprite.interactive = true, this.picSprite.on("mouseover", () => {
|
|
31081
|
+
i2.texture && (this.picSprite.texture = i2.texture), this.picMask.texture = this.backgroundMask.texture, this.picSprite.mask = this.picMask, this.picSprite.width = this.designWidth, this.picSprite.height = this.designHeight, this.container.addChild(this.picSprite), this.container.addChild(this.picMask), ((t3 = this.media) === null || t3 === void 0 ? void 0 : t3.type) === "video" && this.media.src ? (this.mediaPlayer = new il({ id: this.json.id + "-video", ctx: this.ctx, video: this.media, height: this.designHeight, width: this.designWidth, sprite: this.picSprite, container: this.container, canvasElement: this.ctx.view }), ((e3 = this.mediaPlayer) === null || e3 === void 0 ? void 0 : e3.sprite) && (this.mediaPlayer.sprite.mask = this.picMask)) : ((n2 = this.media) === null || n2 === void 0 ? void 0 : n2.type) === "audio" && this.media.src && (this.mediaPlayer = new ol({ id: this.json.id + "-audio", ctx: this.ctx, audio: this.media, height: this.designHeight, width: this.designWidth, sprite: this.picSprite, container: this.container, canvasElement: this.ctx.view })), this.mediaPlayer && (this.picSprite.interactive = true, this.picSprite.on("mouseover", () => {
|
|
31079
31082
|
this.mediaPlayer.showController();
|
|
31080
31083
|
}), this.picSprite.on("mouseout", () => {
|
|
31081
31084
|
this.mediaPlayer.hideController();
|
|
@@ -31798,7 +31801,7 @@ void main() {
|
|
|
31798
31801
|
};
|
|
31799
31802
|
class Hl extends s2.a {
|
|
31800
31803
|
constructor(t3) {
|
|
31801
|
-
super(), this.uuid = Date.now().toString(32) + Math.random().toString(32).substring(2), this.isSub = false, this.isShadow = false, this.startCount = 0, this.applyCount = 0, this.isReverse = false, this.isConflictDispose = false, this.isIterateEnd = false, this.parentTimeNode = null, this.isActive = false, this.isDestroy = false, this.shouldSeekOnStart = false, this.repeatTimeoutId = "", this.iterateShadows = [], this.isIterate = false, this.iterateType = "el", this.iterateIndex = 0, this.children = [], this.subList = [], this.duration = 0, this.timeDelta = 0, this.isNegativeSpeed = false, this.handleEndCond = () => {
|
|
31804
|
+
super(), this.uuid = Date.now().toString(32) + Math.random().toString(32).substring(2), this.isSub = false, this.isShadow = false, this.startCount = 0, this.applyCount = 0, this.isReverse = false, this.isConflictDispose = false, this.isIterateEnd = false, this.parentTimeNode = null, this.isActive = false, this.isDestroy = false, this.shouldSeekOnStart = false, this.repeatTimeoutId = "", this.iterateShadows = [], this.isEndEventsEmitted = false, this.isIterate = false, this.iterateType = "el", this.iterateIndex = 0, this.children = [], this.subList = [], this.duration = 0, this.timeDelta = 0, this.isNegativeSpeed = false, this.handleEndCond = () => {
|
|
31802
31805
|
this.isActive && (this.isActive = false, this.dispose());
|
|
31803
31806
|
}, this.handleActive = (t4 = true) => {
|
|
31804
31807
|
if (this.isActive = true, this.applyCount += 1, this.json.iterate || this.emit("timeNodeStart", { id: this.uuid, activeCount: this.applyCount, isReverse: this.isReverse }), this.startCount > 0 && this.json.restart) {
|
|
@@ -31872,7 +31875,9 @@ void main() {
|
|
|
31872
31875
|
return (e4 = t5 == null ? void 0 : t5.cBhvr) === null || e4 === void 0 ? void 0 : e4.ctn;
|
|
31873
31876
|
}(t4) ? t4.cBhvr.ctn.presetOrder : function(t5) {
|
|
31874
31877
|
return t5 == null ? void 0 : t5.ctn;
|
|
31875
|
-
}(t4) ? t4.ctn.presetOrder :
|
|
31878
|
+
}(t4) ? t4.ctn.presetOrder : function(t5) {
|
|
31879
|
+
return t5 == null ? void 0 : t5.cMediaNode;
|
|
31880
|
+
}(t4) ? t4.cMediaNode.ctn.presetOrder : void 0;
|
|
31876
31881
|
}
|
|
31877
31882
|
if (e3(t3[0])) {
|
|
31878
31883
|
[...t3].sort((t4, n2) => {
|
|
@@ -31912,7 +31917,7 @@ void main() {
|
|
|
31912
31917
|
this.duration <= t3 && this.duration > 0 ? (this.emit("timeUpdate", { delta: this.duration, duration: this.duration, isReverse: this.isReverse }), this.ctx.eventHub.emit(Uh.animateEnd), this.ctx.ticker.remove(this.updateTimeLine)) : this.duration > t3 && (this.ctx.eventHub.emit(Uh.animateStart), this.ctx.ticker.add(this.updateTimeLine));
|
|
31913
31918
|
}
|
|
31914
31919
|
startTimeLine(t3 = true) {
|
|
31915
|
-
if (t3 && (this.eventHubs.global.emit(`time ${this.json.id} begin`), this.eventHubs.global.emit(`time ${this.json.id} onBegin`), this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)), this.json.iterate)
|
|
31920
|
+
if (t3 && (this.isEndEventsEmitted = false, this.eventHubs.global.emit(`time ${this.json.id} begin`), this.eventHubs.global.emit(`time ${this.json.id} onBegin`), this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)), this.json.iterate)
|
|
31916
31921
|
return void this.startIterate();
|
|
31917
31922
|
this.timeDelta = 0, this.emit("timelineStart", { id: this.uuid, activeCount: this.applyCount, isReverse: this.isReverse });
|
|
31918
31923
|
const e3 = 1e3 / this.ctx.ticker.maxFPS;
|
|
@@ -31993,7 +31998,7 @@ void main() {
|
|
|
31993
31998
|
});
|
|
31994
31999
|
}
|
|
31995
32000
|
seekToStart(t3 = true) {
|
|
31996
|
-
if (this.isActive = false, this.dispose(), this.timeDelta = 0, this.emit("seekToStart"), this.json.iterate && !this.isIterate)
|
|
32001
|
+
if (this.isEndEventsEmitted = false, this.isActive = false, this.dispose(), this.timeDelta = 0, this.emit("seekToStart"), this.json.iterate && !this.isIterate)
|
|
31997
32002
|
return this.isIterateEnd = true, void this.iterateShadows.forEach((e3) => e3.seekToStart(t3));
|
|
31998
32003
|
if (t3)
|
|
31999
32004
|
for (let t4 = this.subList.length - 1; t4 >= 0; t4--) {
|
|
@@ -32026,7 +32031,7 @@ void main() {
|
|
|
32026
32031
|
return this.children.length > 0 && (t3 = t3 && this.children.every((t4) => t4.commonTimeNode.isTimeNodeEnd())), this.json.repeatCount && (t3 = t3 && this.applyCount >= this.json.repeatCount), this.json.autoRev && (t3 = t3 && !this.isReverse), t3 = t3 && this.isNatureTimeEnd(), !!this.isConflictDispose || (!(!this.isIterateEnd || !this.json.iterate) || t3);
|
|
32027
32032
|
}
|
|
32028
32033
|
emitEndEvents() {
|
|
32029
|
-
this.eventHubs.global.emit(`time ${this.json.id} end`), this.eventHubs.global.emit(`time ${this.json.id} onEnd`), this.eventHubs.runtime.emit(`runtime ${this.json.id} end`), this.emit("timeNodeEnd", { id: this.uuid, activeCount: this.applyCount, isReverse: this.isReverse });
|
|
32034
|
+
this.isEndEventsEmitted || (this.isEndEventsEmitted = true, this.eventHubs.global.emit(`time ${this.json.id} end`), this.eventHubs.global.emit(`time ${this.json.id} onEnd`), this.eventHubs.runtime.emit(`runtime ${this.json.id} end`), this.emit("timeNodeEnd", { id: this.uuid, activeCount: this.applyCount, isReverse: this.isReverse }));
|
|
32030
32035
|
}
|
|
32031
32036
|
collectStartValue() {
|
|
32032
32037
|
this.emit("timeNodeCreate"), this.children.forEach((t3) => t3.commonTimeNode.collectStartValue());
|
|
@@ -32213,7 +32218,7 @@ void main() {
|
|
|
32213
32218
|
}
|
|
32214
32219
|
destroy() {
|
|
32215
32220
|
var t3;
|
|
32216
|
-
|
|
32221
|
+
this.ctx.eventHub.removeAllListeners(), this.ctx.graphicsTexture.destroy(), this.ctx.fillTexture.destroy(), this.globalEventHub.removeAllListeners(), (t3 = this.timing) === null || t3 === void 0 || t3.destroy(), super.destroy();
|
|
32217
32222
|
}
|
|
32218
32223
|
mainSeqStep() {
|
|
32219
32224
|
var t3, e3;
|
|
@@ -33054,13 +33059,14 @@ void main(void){
|
|
|
33054
33059
|
this.isPaused = false, this.timestamp = 0, this.callbackList = [], this.onTimeUpdate = (t4) => {
|
|
33055
33060
|
const e3 = t4 / (gt.TARGET_FPMS || 0.06);
|
|
33056
33061
|
if (!this.isPaused) {
|
|
33057
|
-
this.timestamp += e3, this.callbackList = this.callbackList.filter((
|
|
33058
|
-
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
+
this.timestamp += e3, this.callbackList = this.callbackList.filter((t6) => t6 && !t6.applied);
|
|
33063
|
+
let { length: t5 } = this.callbackList;
|
|
33064
|
+
for (let e4 = 0; e4 < t5; e4++) {
|
|
33065
|
+
const n2 = this.callbackList[e4];
|
|
33066
|
+
if (n2 && !n2.applied) {
|
|
33067
|
+
if (!(n2.triggerTime <= this.timestamp))
|
|
33062
33068
|
break;
|
|
33063
|
-
|
|
33069
|
+
n2.fn(), n2.applied = true, t5 = this.callbackList.length;
|
|
33064
33070
|
}
|
|
33065
33071
|
}
|
|
33066
33072
|
}
|
|
@@ -33173,6 +33179,14 @@ void main(void){
|
|
|
33173
33179
|
get view() {
|
|
33174
33180
|
return this.app.renderer ? this.app.view : null;
|
|
33175
33181
|
}
|
|
33182
|
+
get nextSlideIndex() {
|
|
33183
|
+
var t3;
|
|
33184
|
+
return ((t3 = this.currentStage) === null || t3 === void 0 ? void 0 : t3.json.nextIndex) ? this.currentStage.json.nextIndex : this.currentIndex + 1;
|
|
33185
|
+
}
|
|
33186
|
+
get prevSlideIndex() {
|
|
33187
|
+
var t3;
|
|
33188
|
+
return ((t3 = this.currentStage) === null || t3 === void 0 ? void 0 : t3.json.prevIndex) ? this.currentStage.json.prevIndex : this.currentIndex - 1;
|
|
33189
|
+
}
|
|
33176
33190
|
updateConfig(t3) {
|
|
33177
33191
|
Object(a.isUndefined)(t3.minFPS) || (this.config.minFPS = t3.minFPS, this.app.ticker.minFPS = t3.minFPS), Object(a.isUndefined)(t3.maxFPS) || (this.config.maxFPS = t3.maxFPS, this.app.ticker.maxFPS = t3.maxFPS), Object(a.isUndefined)(t3.resolution) || (this.config.resolution = t3.resolution, this.updateResolution(this.scale * this.config.resolution)), Object(a.isUndefined)(t3.autoFPS) || (this.config.autoFPS = t3.autoFPS), Object(a.isUndefined)(t3.autoResolution) || (this.config.autoResolution = t3.autoResolution), Object(a.isUndefined)(t3.transactionBgColor) || (this.config.transactionBgColor = t3.transactionBgColor);
|
|
33178
33192
|
}
|
|
@@ -34944,14 +34958,14 @@ void main(void){
|
|
|
34944
34958
|
return jd(n2, void 0, void 0, function() {
|
|
34945
34959
|
var t4;
|
|
34946
34960
|
return Vd(this, function(e5) {
|
|
34947
|
-
return this.player ? ((t4 = this.player.
|
|
34961
|
+
return this.player ? ((t4 = this.player.prevSlideIndex) >= 1 && this.renderSlide(t4, false), [2]) : [2];
|
|
34948
34962
|
});
|
|
34949
34963
|
});
|
|
34950
34964
|
}, n2.handleNextSlide = function() {
|
|
34951
34965
|
return jd(n2, void 0, void 0, function() {
|
|
34952
34966
|
var t4;
|
|
34953
34967
|
return Vd(this, function(e5) {
|
|
34954
|
-
return this.player ? ((t4 = this.player.
|
|
34968
|
+
return this.player ? ((t4 = this.player.nextSlideIndex) <= this.slideCount && this.renderSlide(t4, true), [2]) : [2];
|
|
34955
34969
|
});
|
|
34956
34970
|
});
|
|
34957
34971
|
}, n2.handleGotoSlide = function(t4) {
|
|
@@ -34960,7 +34974,7 @@ void main(void){
|
|
|
34960
34974
|
n2.renderSlide(t4, e5);
|
|
34961
34975
|
} else
|
|
34962
34976
|
t4 === -1 && n2.renderSlide(n2.slideCount, true);
|
|
34963
|
-
}, e4.timestamp && (n2.timestamp = e4.timestamp), n2.config = e4, n2.syncQueue = new Ud(n2.receiveSyncHandler), n2.mode = e4.mode, n2.anchor = e4.anchor, n2.resize = e4.resize || false, n2.interactive = e4.interactive, n2.frame.style.cssText = "width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;", n2.setMedianControllerAttribute(), n2.frame.appendChild(n2.medianController), n2.anchor.appendChild(n2.frame), n2.frameResizeObserver.observe(n2.frame), n2.on(Zd.syncReceive, function(t4) {
|
|
34977
|
+
}, e4.timestamp && (n2.timestamp = e4.timestamp), n2.config = e4, n2.syncQueue = new Ud(n2.receiveSyncHandler), n2.mode = e4.mode, n2.anchor = e4.anchor, n2.resize = e4.resize || false, n2.interactive = e4.interactive, n2.frame.style.cssText = "width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;", n2.setMedianControllerAttribute(), n2.frame.appendChild(n2.medianController), n2.anchor.appendChild(n2.frame), n2.frameResizeObserver.observe(n2.frame), n2.on(Zd.syncReceive, function(t4) {
|
|
34964
34978
|
n2.lock.unlock(t4.type, t4.uuid), n2.syncQueue.addTask(t4);
|
|
34965
34979
|
}), n2.renderingTaskManager.eventHub.on("task-error", function(t4) {
|
|
34966
34980
|
var e5 = t4.error, i2 = t4.task;
|
|
@@ -35005,7 +35019,7 @@ void main(void){
|
|
|
35005
35019
|
}, e3.prototype.createController = function() {
|
|
35006
35020
|
this.player && (this.playerController = new kd({ player: this.player, params: this.player.config || {}, target: this.frame }));
|
|
35007
35021
|
}, e3.prototype.setMedianControllerAttribute = function() {
|
|
35008
|
-
this.medianController.
|
|
35022
|
+
this.medianController.className = "median-container", this.medianController.style.position = "absolute", this.medianController.style.left = "0", this.medianController.style.top = "0", this.medianController.style.zIndex = "2";
|
|
35009
35023
|
}, e3.prototype.frameResizeHandler = function() {
|
|
35010
35024
|
var t4 = this.frame.getBoundingClientRect(), e4 = t4.width, n2 = t4.height;
|
|
35011
35025
|
this.frameWidth = e4, this.frameHeight = n2, this.resizeView();
|
|
@@ -35183,7 +35197,7 @@ void main(void){
|
|
|
35183
35197
|
return !r3.isLoading;
|
|
35184
35198
|
}, 6e4)]) : [3, 2];
|
|
35185
35199
|
case 1:
|
|
35186
|
-
for (n2 in o3.sent(), e4 = this.player.getSnapshot() || "", this.cacheImage.src = e4, this.cacheImage.style.position = "absolute", this.cacheImage.style.zIndex = "
|
|
35200
|
+
for (n2 in o3.sent(), e4 = this.player.getSnapshot() || "", this.cacheImage.src = e4, this.cacheImage.style.position = "absolute", this.cacheImage.style.zIndex = "100", this.frame.appendChild(this.cacheImage), this.player.destroy(), (t4 = this.playerController) === null || t4 === void 0 || t4.destroy(), this.player = void 0, this.__slideState.mediaState)
|
|
35187
35201
|
i2 = this.__slideState.mediaState[n2], this.__slideState.mediaState[n2] = zd(zd({}, i2), { frozenTime: this.timestamp() });
|
|
35188
35202
|
this.isFrowning = false, o3.label = 2;
|
|
35189
35203
|
case 2:
|
|
@@ -35417,9 +35431,10 @@ swizzle$1.wrap = function(fn) {
|
|
|
35417
35431
|
};
|
|
35418
35432
|
var colorNames = colorName;
|
|
35419
35433
|
var swizzle2 = simpleSwizzle.exports;
|
|
35434
|
+
var hasOwnProperty = Object.hasOwnProperty;
|
|
35420
35435
|
var reverseNames = {};
|
|
35421
35436
|
for (var name in colorNames) {
|
|
35422
|
-
if (
|
|
35437
|
+
if (hasOwnProperty.call(colorNames, name)) {
|
|
35423
35438
|
reverseNames[colorNames[name]] = name;
|
|
35424
35439
|
}
|
|
35425
35440
|
}
|
|
@@ -35456,9 +35471,9 @@ cs.get.rgb = function(string) {
|
|
|
35456
35471
|
}
|
|
35457
35472
|
var abbr = /^#([a-f0-9]{3,4})$/i;
|
|
35458
35473
|
var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
|
|
35459
|
-
var rgba = /^rgba?\(\s*([+-]?\d+)\s
|
|
35460
|
-
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s
|
|
35461
|
-
var keyword =
|
|
35474
|
+
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
35475
|
+
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
35476
|
+
var keyword = /^(\w+)$/;
|
|
35462
35477
|
var rgb = [0, 0, 0, 1];
|
|
35463
35478
|
var match;
|
|
35464
35479
|
var i;
|
|
@@ -35487,23 +35502,31 @@ cs.get.rgb = function(string) {
|
|
|
35487
35502
|
rgb[i] = parseInt(match[i + 1], 0);
|
|
35488
35503
|
}
|
|
35489
35504
|
if (match[4]) {
|
|
35490
|
-
|
|
35505
|
+
if (match[5]) {
|
|
35506
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
35507
|
+
} else {
|
|
35508
|
+
rgb[3] = parseFloat(match[4]);
|
|
35509
|
+
}
|
|
35491
35510
|
}
|
|
35492
35511
|
} else if (match = string.match(per)) {
|
|
35493
35512
|
for (i = 0; i < 3; i++) {
|
|
35494
35513
|
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
|
|
35495
35514
|
}
|
|
35496
35515
|
if (match[4]) {
|
|
35497
|
-
|
|
35516
|
+
if (match[5]) {
|
|
35517
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
35518
|
+
} else {
|
|
35519
|
+
rgb[3] = parseFloat(match[4]);
|
|
35520
|
+
}
|
|
35498
35521
|
}
|
|
35499
35522
|
} else if (match = string.match(keyword)) {
|
|
35500
35523
|
if (match[1] === "transparent") {
|
|
35501
35524
|
return [0, 0, 0, 0];
|
|
35502
35525
|
}
|
|
35503
|
-
|
|
35504
|
-
if (!rgb) {
|
|
35526
|
+
if (!hasOwnProperty.call(colorNames, match[1])) {
|
|
35505
35527
|
return null;
|
|
35506
35528
|
}
|
|
35529
|
+
rgb = colorNames[match[1]];
|
|
35507
35530
|
rgb[3] = 1;
|
|
35508
35531
|
return rgb;
|
|
35509
35532
|
} else {
|
|
@@ -35523,7 +35546,7 @@ cs.get.hsl = function(string) {
|
|
|
35523
35546
|
var match = string.match(hsl);
|
|
35524
35547
|
if (match) {
|
|
35525
35548
|
var alpha = parseFloat(match[4]);
|
|
35526
|
-
var h = (parseFloat(match[1]) + 360) % 360;
|
|
35549
|
+
var h = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
35527
35550
|
var s2 = clamp(parseFloat(match[2]), 0, 100);
|
|
35528
35551
|
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
35529
35552
|
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
@@ -35581,10 +35604,45 @@ function clamp(num, min, max) {
|
|
|
35581
35604
|
return Math.min(Math.max(min, num), max);
|
|
35582
35605
|
}
|
|
35583
35606
|
function hexDouble(num) {
|
|
35584
|
-
var str = num.toString(16).toUpperCase();
|
|
35607
|
+
var str = Math.round(num).toString(16).toUpperCase();
|
|
35585
35608
|
return str.length < 2 ? "0" + str : str;
|
|
35586
35609
|
}
|
|
35587
35610
|
var ColorString = colorString.exports;
|
|
35611
|
+
class Logger {
|
|
35612
|
+
constructor(enable) {
|
|
35613
|
+
this.enable = enable;
|
|
35614
|
+
this.apps = {};
|
|
35615
|
+
this.level = "debug";
|
|
35616
|
+
this._onMessage = (ev) => {
|
|
35617
|
+
if (isObj(ev.data)) {
|
|
35618
|
+
if (typeof ev.data.slide === "boolean") {
|
|
35619
|
+
this.enable = ev.data.slide;
|
|
35620
|
+
} else if (ev.data.slide === "__instance") {
|
|
35621
|
+
console.log(this);
|
|
35622
|
+
}
|
|
35623
|
+
}
|
|
35624
|
+
};
|
|
35625
|
+
window.addEventListener("message", this._onMessage);
|
|
35626
|
+
}
|
|
35627
|
+
log(...args) {
|
|
35628
|
+
if (this.enable) {
|
|
35629
|
+
console.log(...args);
|
|
35630
|
+
}
|
|
35631
|
+
}
|
|
35632
|
+
verbose(...args) {
|
|
35633
|
+
if (this.enable && this.level === "verbose") {
|
|
35634
|
+
console.log(...args);
|
|
35635
|
+
}
|
|
35636
|
+
}
|
|
35637
|
+
dispose(appId) {
|
|
35638
|
+
this.enable = false;
|
|
35639
|
+
delete this.apps[appId];
|
|
35640
|
+
window.removeEventListener("message", this._onMessage);
|
|
35641
|
+
}
|
|
35642
|
+
}
|
|
35643
|
+
const logger = new Logger(false);
|
|
35644
|
+
const log = logger.log.bind(logger);
|
|
35645
|
+
const verbose = logger.verbose.bind(logger);
|
|
35588
35646
|
function guessBgColor(el) {
|
|
35589
35647
|
try {
|
|
35590
35648
|
const bg = window.getComputedStyle(el).backgroundColor;
|
|
@@ -35613,6 +35671,7 @@ let cachedBgColor = "";
|
|
|
35613
35671
|
function cachedGetBgColor(el) {
|
|
35614
35672
|
if (!cachedBgColor) {
|
|
35615
35673
|
cachedBgColor = toHex(guessBgColor(el));
|
|
35674
|
+
log("[Slide] guess bg color", cachedBgColor);
|
|
35616
35675
|
}
|
|
35617
35676
|
return cachedBgColor;
|
|
35618
35677
|
}
|
|
@@ -35665,7 +35724,6 @@ class SlideController {
|
|
|
35665
35724
|
onTransitionEnd,
|
|
35666
35725
|
onError
|
|
35667
35726
|
}) {
|
|
35668
|
-
var _a;
|
|
35669
35727
|
this.sideEffect = new o();
|
|
35670
35728
|
this.ready = false;
|
|
35671
35729
|
this.readyPromise = new Promise((resolve) => {
|
|
@@ -35680,9 +35738,7 @@ class SlideController {
|
|
|
35680
35738
|
type: Slide.SLIDE_EVENTS.syncDispatch,
|
|
35681
35739
|
payload: event
|
|
35682
35740
|
};
|
|
35683
|
-
|
|
35684
|
-
console.log("[Slide] dispatch", event);
|
|
35685
|
-
}
|
|
35741
|
+
log("[Slide] dispatch", event);
|
|
35686
35742
|
this.room.dispatchMagixEvent(this.channel, payload);
|
|
35687
35743
|
}
|
|
35688
35744
|
};
|
|
@@ -35691,9 +35747,7 @@ class SlideController {
|
|
|
35691
35747
|
const { type, payload } = ev.payload;
|
|
35692
35748
|
if (type === Slide.SLIDE_EVENTS.syncDispatch) {
|
|
35693
35749
|
this.syncStateOnce();
|
|
35694
|
-
|
|
35695
|
-
console.log("[Slide] receive", payload);
|
|
35696
|
-
}
|
|
35750
|
+
log("[Slide] receive", payload);
|
|
35697
35751
|
if (!this.syncStateOnceFlag) {
|
|
35698
35752
|
this.slide.emit(Slide.SLIDE_EVENTS.syncReceive, payload);
|
|
35699
35753
|
}
|
|
@@ -35702,9 +35756,16 @@ class SlideController {
|
|
|
35702
35756
|
};
|
|
35703
35757
|
this.onStateChange = (state) => {
|
|
35704
35758
|
if (this.context.getIsWritable()) {
|
|
35759
|
+
verbose("[Slide] state change", JSON.stringify(state, null, 2));
|
|
35705
35760
|
this.context.updateAttributes(["state"], state);
|
|
35706
35761
|
}
|
|
35707
35762
|
};
|
|
35763
|
+
this.onSeeked = () => {
|
|
35764
|
+
const state = this.context.getAttributes().state;
|
|
35765
|
+
if (state) {
|
|
35766
|
+
this.slide.setSlideState(deepClone(state));
|
|
35767
|
+
}
|
|
35768
|
+
};
|
|
35708
35769
|
this.pollCount = 0;
|
|
35709
35770
|
this.pollReadyState = () => {
|
|
35710
35771
|
if (this.ready) {
|
|
@@ -35718,9 +35779,7 @@ class SlideController {
|
|
|
35718
35779
|
setTimeout(this.pollReadyState, 500);
|
|
35719
35780
|
} else {
|
|
35720
35781
|
this.pollCount = 0;
|
|
35721
|
-
|
|
35722
|
-
console.log("[Slide] renderSlide (retry after timeout)", 1);
|
|
35723
|
-
}
|
|
35782
|
+
log("[Slide] renderSlide (retry after timeout)", 1);
|
|
35724
35783
|
this.slide.renderSlide(1);
|
|
35725
35784
|
}
|
|
35726
35785
|
};
|
|
@@ -35740,9 +35799,7 @@ class SlideController {
|
|
|
35740
35799
|
this.freezePromise = null;
|
|
35741
35800
|
this.freeze = () => {
|
|
35742
35801
|
if (this.ready) {
|
|
35743
|
-
|
|
35744
|
-
console.log("[Slide] freeze", this.context.appId);
|
|
35745
|
-
}
|
|
35802
|
+
log("[Slide] freeze", this.context.appId);
|
|
35746
35803
|
if (this.freezePromise) {
|
|
35747
35804
|
this._toFreeze = 1;
|
|
35748
35805
|
} else if (!this.isFrozen) {
|
|
@@ -35755,9 +35812,7 @@ class SlideController {
|
|
|
35755
35812
|
};
|
|
35756
35813
|
this.unfreeze = async () => {
|
|
35757
35814
|
if (this.ready) {
|
|
35758
|
-
|
|
35759
|
-
console.log("[Slide] unfreeze", this.context.appId);
|
|
35760
|
-
}
|
|
35815
|
+
log("[Slide] unfreeze", this.context.appId);
|
|
35761
35816
|
if (this.freezePromise) {
|
|
35762
35817
|
this._toFreeze = -1;
|
|
35763
35818
|
} else if (this.isFrozen) {
|
|
@@ -35776,7 +35831,6 @@ class SlideController {
|
|
|
35776
35831
|
this.channel = `channel-${context.appId}`;
|
|
35777
35832
|
this.room = context.getRoom();
|
|
35778
35833
|
this.player = this.room ? void 0 : context.getDisplayer();
|
|
35779
|
-
this.debug = !!((_a = context.getAppOptions()) == null ? void 0 : _a.debug);
|
|
35780
35834
|
this.slide = this.createSlide(anchor);
|
|
35781
35835
|
this.syncStateOnceFlag = !this.context.isAddApp;
|
|
35782
35836
|
this.initialize();
|
|
@@ -35796,15 +35850,11 @@ class SlideController {
|
|
|
35796
35850
|
const { taskId, url, state } = __spreadValues(__spreadValues({}, EmptyAttributes), this.context.getAttributes());
|
|
35797
35851
|
slide.setResource(taskId, url || DefaultUrl);
|
|
35798
35852
|
if (state) {
|
|
35799
|
-
|
|
35800
|
-
console.log("[Slide] init with state", deepClone(state));
|
|
35801
|
-
}
|
|
35853
|
+
log("[Slide] init with state", deepClone(state));
|
|
35802
35854
|
this.syncStateOnceFlag = false;
|
|
35803
35855
|
slide.setSlideState(deepClone(state));
|
|
35804
35856
|
} else if (context.isAddApp) {
|
|
35805
|
-
|
|
35806
|
-
console.log("[Slide] init by renderSlide", 1);
|
|
35807
|
-
}
|
|
35857
|
+
log("[Slide] init by renderSlide", 1);
|
|
35808
35858
|
slide.renderSlide(1);
|
|
35809
35859
|
}
|
|
35810
35860
|
this.pollReadyState();
|
|
@@ -35818,6 +35868,10 @@ class SlideController {
|
|
|
35818
35868
|
});
|
|
35819
35869
|
return disposer;
|
|
35820
35870
|
});
|
|
35871
|
+
this.sideEffect.add(() => {
|
|
35872
|
+
context.emitter.on("seek", this.onSeeked);
|
|
35873
|
+
return () => context.emitter.off("seek", this.onSeeked);
|
|
35874
|
+
});
|
|
35821
35875
|
this.sideEffect.add(() => {
|
|
35822
35876
|
const displayer = context.getDisplayer();
|
|
35823
35877
|
displayer.addMagixEventListener(this.channel, this.magixEventListener, {
|
|
@@ -35839,9 +35893,7 @@ class SlideController {
|
|
|
35839
35893
|
if (this.syncStateOnceFlag) {
|
|
35840
35894
|
const { state } = __spreadValues(__spreadValues({}, EmptyAttributes), this.context.getAttributes());
|
|
35841
35895
|
if (state) {
|
|
35842
|
-
|
|
35843
|
-
console.log("[Slide] sync with state (once)", deepClone(state));
|
|
35844
|
-
}
|
|
35896
|
+
log("[Slide] sync with state (once)", deepClone(state));
|
|
35845
35897
|
this.slide.setSlideState(deepClone(state));
|
|
35846
35898
|
this.syncStateOnceFlag = false;
|
|
35847
35899
|
}
|
|
@@ -35863,7 +35915,7 @@ class SlideController {
|
|
|
35863
35915
|
interactive: true,
|
|
35864
35916
|
mode: "interactive",
|
|
35865
35917
|
resize: true,
|
|
35866
|
-
controller:
|
|
35918
|
+
controller: logger.enable,
|
|
35867
35919
|
renderOptions: {
|
|
35868
35920
|
minFPS: 25,
|
|
35869
35921
|
maxFPS: 30,
|
|
@@ -35874,17 +35926,12 @@ class SlideController {
|
|
|
35874
35926
|
},
|
|
35875
35927
|
timestamp: this.timestamp
|
|
35876
35928
|
});
|
|
35877
|
-
if (this.debug) {
|
|
35878
|
-
window.slide = slide;
|
|
35879
|
-
}
|
|
35880
35929
|
return slide;
|
|
35881
35930
|
}
|
|
35882
35931
|
destroy() {
|
|
35883
35932
|
this.sideEffect.flushAll();
|
|
35884
35933
|
if (!this.destroyed) {
|
|
35885
|
-
|
|
35886
|
-
console.log("[Slide] destroy slide (once)");
|
|
35887
|
-
}
|
|
35934
|
+
log("[Slide] destroy slide (once)");
|
|
35888
35935
|
this.slide.destroy();
|
|
35889
35936
|
this.destroyed = true;
|
|
35890
35937
|
}
|
|
@@ -36591,7 +36638,7 @@ if (runningOnBrowser) {
|
|
|
36591
36638
|
autoInitialize(LazyLoad, window.lazyLoadOptions);
|
|
36592
36639
|
}
|
|
36593
36640
|
class DocsViewer {
|
|
36594
|
-
constructor({ readonly,
|
|
36641
|
+
constructor({ readonly, onNewPageIndex, onPlay }) {
|
|
36595
36642
|
this._pages = [];
|
|
36596
36643
|
this.pageIndex = 0;
|
|
36597
36644
|
this.setPaused = () => {
|
|
@@ -36605,7 +36652,6 @@ class DocsViewer {
|
|
|
36605
36652
|
this.isSmallBox = false;
|
|
36606
36653
|
this.sideEffect = new o();
|
|
36607
36654
|
this.readonly = readonly;
|
|
36608
|
-
this.box = box;
|
|
36609
36655
|
this.onNewPageIndex = onNewPageIndex;
|
|
36610
36656
|
this.onPlay = onPlay;
|
|
36611
36657
|
this.render();
|
|
@@ -36619,10 +36665,6 @@ class DocsViewer {
|
|
|
36619
36665
|
get pages() {
|
|
36620
36666
|
return this._pages;
|
|
36621
36667
|
}
|
|
36622
|
-
mount() {
|
|
36623
|
-
this.box.mountContent(this.$content);
|
|
36624
|
-
this.box.mountFooter(this.$footer);
|
|
36625
|
-
}
|
|
36626
36668
|
unmount() {
|
|
36627
36669
|
this.$content.remove();
|
|
36628
36670
|
this.$footer.remove();
|
|
@@ -36863,7 +36905,7 @@ class DocsViewer {
|
|
|
36863
36905
|
return `${this.namespace}-${className}`;
|
|
36864
36906
|
}
|
|
36865
36907
|
}
|
|
36866
|
-
const ClickThroughAppliances = new Set(["clicker"
|
|
36908
|
+
const ClickThroughAppliances = new Set(["clicker"]);
|
|
36867
36909
|
class SlideDocsViewer {
|
|
36868
36910
|
constructor({ box, view, mountSlideController, mountWhiteboard }) {
|
|
36869
36911
|
this.slideController = null;
|
|
@@ -36915,7 +36957,6 @@ class SlideDocsViewer {
|
|
|
36915
36957
|
this.mountSlideController = mountSlideController;
|
|
36916
36958
|
this.mountWhiteboard = mountWhiteboard;
|
|
36917
36959
|
this.viewer = new DocsViewer({
|
|
36918
|
-
box,
|
|
36919
36960
|
readonly: box.readonly,
|
|
36920
36961
|
onNewPageIndex: this.onNewPageIndex,
|
|
36921
36962
|
onPlay: this.onPlay
|
|
@@ -36966,7 +37007,8 @@ class SlideDocsViewer {
|
|
|
36966
37007
|
return this.$whiteboardView;
|
|
36967
37008
|
}
|
|
36968
37009
|
mount() {
|
|
36969
|
-
this.
|
|
37010
|
+
this.box.mountContent(this.viewer.$content);
|
|
37011
|
+
this.box.mountFooter(this.viewer.$footer);
|
|
36970
37012
|
this.slideController = this.mountSlideController({
|
|
36971
37013
|
anchor: this.$slide,
|
|
36972
37014
|
onTransitionStart: this.viewer.setPlaying,
|
|
@@ -37012,15 +37054,18 @@ const apps = {
|
|
|
37012
37054
|
map: new Map(),
|
|
37013
37055
|
queue: [],
|
|
37014
37056
|
validateQueue() {
|
|
37057
|
+
log("[Slide] freezer: validate", this.queue);
|
|
37015
37058
|
while (this.queue.length > FreezerLength) {
|
|
37016
37059
|
const appId = this.queue.pop();
|
|
37017
37060
|
const slide = this.map.get(appId);
|
|
37018
37061
|
if (slide) {
|
|
37062
|
+
log("[Slide] freezer: validate-freeze", appId, this.queue);
|
|
37019
37063
|
slide.freeze();
|
|
37020
37064
|
}
|
|
37021
37065
|
}
|
|
37022
37066
|
},
|
|
37023
37067
|
set(appId, slide) {
|
|
37068
|
+
log("[Slide] freezer: add", appId, this.queue);
|
|
37024
37069
|
this.map.set(appId, slide);
|
|
37025
37070
|
if (!this.queue.includes(appId)) {
|
|
37026
37071
|
this.queue.unshift(appId);
|
|
@@ -37028,6 +37073,7 @@ const apps = {
|
|
|
37028
37073
|
this.validateQueue();
|
|
37029
37074
|
},
|
|
37030
37075
|
delete(appId) {
|
|
37076
|
+
log("[Slide] freezer: delete", appId, this.queue);
|
|
37031
37077
|
this.map.delete(appId);
|
|
37032
37078
|
this.queue = this.queue.filter((id) => id !== appId);
|
|
37033
37079
|
},
|
|
@@ -37039,6 +37085,7 @@ const apps = {
|
|
|
37039
37085
|
}
|
|
37040
37086
|
this.queue.unshift(appId);
|
|
37041
37087
|
this.validateQueue();
|
|
37088
|
+
log("[Slide] freezer: focus", appId, this.queue);
|
|
37042
37089
|
if (slide) {
|
|
37043
37090
|
slide.unfreeze();
|
|
37044
37091
|
}
|
|
@@ -37049,7 +37096,134 @@ const addHooks = (emitter) => {
|
|
|
37049
37096
|
apps.focus(appId);
|
|
37050
37097
|
});
|
|
37051
37098
|
};
|
|
37052
|
-
var styles = ".netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-slide-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-slide-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none}.netless-app-slide-footer-btn:hover{background:rgba(237,237,240,.9)}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-page-number-input{border:none;outline:none;width:1.5em;text-align:right;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text}.netless-app-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly .netless-app-slide-footer-btn{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-footer-btn:hover{background:transparent}.netless-app-slide-readonly .netless-app-slide-page-number-input{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-page-number-input:hover,.netless-app-slide-readonly .netless-app-slide-page-number-input:focus,.netless-app-slide-readonly .netless-app-slide-page-number-input:active{background:transparent;box-shadow:none}.netless-app-slide-readonly .netless-app-slide-page-number-input:disabled{color:inherit}.netless-app-slide-readonly.netless-app-slide-float-footer{display:none}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:
|
|
37099
|
+
var styles = ".netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-slide-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-slide-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none}.netless-app-slide-footer-btn:hover{background:rgba(237,237,240,.9)}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-page-number-input{border:none;outline:none;width:1.5em;text-align:right;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text}.netless-app-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly .netless-app-slide-footer-btn{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-footer-btn:hover{background:transparent}.netless-app-slide-readonly .netless-app-slide-page-number-input{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-page-number-input:hover,.netless-app-slide-readonly .netless-app-slide-page-number-input:focus,.netless-app-slide-readonly .netless-app-slide-page-number-input:active{background:transparent;box-shadow:none}.netless-app-slide-readonly .netless-app-slide-page-number-input:disabled{color:inherit}.netless-app-slide-readonly.netless-app-slide-float-footer{display:none}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}\n";
|
|
37100
|
+
function previewSlide({
|
|
37101
|
+
container,
|
|
37102
|
+
taskId,
|
|
37103
|
+
url = DefaultUrl,
|
|
37104
|
+
debug = false
|
|
37105
|
+
}) {
|
|
37106
|
+
if (!taskId) {
|
|
37107
|
+
throw new Error("[Slide] taskId is required");
|
|
37108
|
+
}
|
|
37109
|
+
container.style.cssText += `display:flex;flex-direction:column`;
|
|
37110
|
+
const previewer = new SlidePreviewer({ target: container });
|
|
37111
|
+
previewer.debug = !!debug;
|
|
37112
|
+
previewer.mount(taskId, url);
|
|
37113
|
+
return previewer;
|
|
37114
|
+
}
|
|
37115
|
+
class SlidePreviewer {
|
|
37116
|
+
constructor(config) {
|
|
37117
|
+
this.slide = null;
|
|
37118
|
+
this.debug = false;
|
|
37119
|
+
this.ready = false;
|
|
37120
|
+
this.readyPromise = new Promise((resolve) => {
|
|
37121
|
+
this.resolveReady = () => {
|
|
37122
|
+
this.ready = true;
|
|
37123
|
+
resolve();
|
|
37124
|
+
};
|
|
37125
|
+
});
|
|
37126
|
+
this.onPageChanged = (page) => {
|
|
37127
|
+
this.viewer.setPageIndex(page - 1);
|
|
37128
|
+
};
|
|
37129
|
+
this.onTransitionStart = () => {
|
|
37130
|
+
this.viewer.setPlaying();
|
|
37131
|
+
};
|
|
37132
|
+
this.onTransitionEnd = () => {
|
|
37133
|
+
this.viewer.setPaused();
|
|
37134
|
+
};
|
|
37135
|
+
this.onError = ({ error }) => {
|
|
37136
|
+
this.viewer.setPaused();
|
|
37137
|
+
console.warn("[Slide] render error", error);
|
|
37138
|
+
};
|
|
37139
|
+
this.destroyed = false;
|
|
37140
|
+
this.refreshPages = () => {
|
|
37141
|
+
if (this.slide) {
|
|
37142
|
+
this.viewer.pages = createDocsViewerPages(this.slide);
|
|
37143
|
+
this.viewer.setPageIndex(this.getPageIndex(this.slide.slideCount));
|
|
37144
|
+
}
|
|
37145
|
+
};
|
|
37146
|
+
this.onPlay = () => {
|
|
37147
|
+
if (this.slide) {
|
|
37148
|
+
this.slide.nextStep();
|
|
37149
|
+
}
|
|
37150
|
+
};
|
|
37151
|
+
this.onNewPageIndex = (index) => {
|
|
37152
|
+
if (this.slide && this.slide.slideCount > 0) {
|
|
37153
|
+
this.slide.renderSlide(clamp$1(index + 1, 1, this.slide.slideCount));
|
|
37154
|
+
}
|
|
37155
|
+
};
|
|
37156
|
+
this.namespace = "netless-app-slide";
|
|
37157
|
+
this.target = config.target;
|
|
37158
|
+
this.bgColor = cachedGetBgColor(this.target);
|
|
37159
|
+
this.viewer = new DocsViewer({
|
|
37160
|
+
readonly: false,
|
|
37161
|
+
onNewPageIndex: this.onNewPageIndex,
|
|
37162
|
+
onPlay: this.onPlay
|
|
37163
|
+
});
|
|
37164
|
+
this.render();
|
|
37165
|
+
}
|
|
37166
|
+
render() {
|
|
37167
|
+
this.viewer.$content.appendChild(this.renderSlideContainer());
|
|
37168
|
+
}
|
|
37169
|
+
mount(taskId, url) {
|
|
37170
|
+
this.target.appendChild(this.viewer.$content);
|
|
37171
|
+
this.target.appendChild(this.viewer.$footer);
|
|
37172
|
+
this.slide = new Slide.Slide({
|
|
37173
|
+
anchor: this.$slide,
|
|
37174
|
+
interactive: false,
|
|
37175
|
+
mode: "local",
|
|
37176
|
+
resize: true,
|
|
37177
|
+
controller: this.debug,
|
|
37178
|
+
renderOptions: {
|
|
37179
|
+
minFPS: 25,
|
|
37180
|
+
maxFPS: 30,
|
|
37181
|
+
autoFPS: true,
|
|
37182
|
+
autoResolution: true,
|
|
37183
|
+
transactionBgColor: this.bgColor
|
|
37184
|
+
}
|
|
37185
|
+
});
|
|
37186
|
+
this.registerEventListeners();
|
|
37187
|
+
this.slide.setResource(taskId, url);
|
|
37188
|
+
this.slide.renderSlide(1);
|
|
37189
|
+
}
|
|
37190
|
+
registerEventListeners() {
|
|
37191
|
+
if (!this.slide)
|
|
37192
|
+
return;
|
|
37193
|
+
const { slide } = this;
|
|
37194
|
+
slide.on(Slide.SLIDE_EVENTS.slideChange, this.onPageChanged);
|
|
37195
|
+
slide.on(Slide.SLIDE_EVENTS.renderStart, this.onTransitionStart);
|
|
37196
|
+
slide.on(Slide.SLIDE_EVENTS.renderEnd, this.onTransitionEnd);
|
|
37197
|
+
slide.on(Slide.SLIDE_EVENTS.mainSeqStepStart, this.onTransitionStart);
|
|
37198
|
+
slide.on(Slide.SLIDE_EVENTS.mainSeqStepEnd, this.onTransitionEnd);
|
|
37199
|
+
slide.on(Slide.SLIDE_EVENTS.renderError, this.onError);
|
|
37200
|
+
slide.on(Slide.SLIDE_EVENTS.renderEnd, this.resolveReady);
|
|
37201
|
+
this.readyPromise.then(this.refreshPages);
|
|
37202
|
+
}
|
|
37203
|
+
destroy() {
|
|
37204
|
+
if (this.slide && !this.destroyed) {
|
|
37205
|
+
log("[Slide] destroy slide (once)");
|
|
37206
|
+
this.slide.destroy();
|
|
37207
|
+
this.destroyed = true;
|
|
37208
|
+
}
|
|
37209
|
+
this.viewer.destroy();
|
|
37210
|
+
}
|
|
37211
|
+
getPageIndex(page) {
|
|
37212
|
+
return (page > 0 ? page : 1) - 1;
|
|
37213
|
+
}
|
|
37214
|
+
renderSlideContainer() {
|
|
37215
|
+
if (!this.$slide) {
|
|
37216
|
+
const $slide = document.createElement("div");
|
|
37217
|
+
$slide.className = this.wrapClassName("slide");
|
|
37218
|
+
$slide.dataset.appKind = "Slide";
|
|
37219
|
+
this.$slide = $slide;
|
|
37220
|
+
}
|
|
37221
|
+
return this.$slide;
|
|
37222
|
+
}
|
|
37223
|
+
wrapClassName(className) {
|
|
37224
|
+
return `${this.namespace}-${className}`;
|
|
37225
|
+
}
|
|
37226
|
+
}
|
|
37053
37227
|
const SlideApp = {
|
|
37054
37228
|
kind: "Slide",
|
|
37055
37229
|
setup(context) {
|
|
@@ -37070,23 +37244,26 @@ const SlideApp = {
|
|
|
37070
37244
|
const baseScenePath = context.getInitScenePath();
|
|
37071
37245
|
let docsViewer = null;
|
|
37072
37246
|
const onPageChanged = (page) => {
|
|
37073
|
-
var _a;
|
|
37074
37247
|
const room2 = context.getRoom();
|
|
37075
|
-
if (docsViewer && docsViewer.slideController
|
|
37076
|
-
|
|
37077
|
-
if (
|
|
37078
|
-
|
|
37248
|
+
if (docsViewer && docsViewer.slideController) {
|
|
37249
|
+
let synced = false;
|
|
37250
|
+
if (room2 && context.getIsWritable()) {
|
|
37251
|
+
syncSceneWithSlide(room2, context, docsViewer.slideController.slide, baseScenePath);
|
|
37252
|
+
synced = true;
|
|
37079
37253
|
}
|
|
37254
|
+
log("[Slide] page to", page, synced);
|
|
37080
37255
|
docsViewer.viewer.setPageIndex(page - 1);
|
|
37081
37256
|
}
|
|
37082
37257
|
};
|
|
37083
37258
|
const mountSlideController = (options) => {
|
|
37259
|
+
var _a, _b;
|
|
37084
37260
|
const slideController = new SlideController(__spreadProps(__spreadValues({
|
|
37085
37261
|
context
|
|
37086
37262
|
}, options), {
|
|
37087
37263
|
onPageChanged
|
|
37088
37264
|
}));
|
|
37089
37265
|
apps.set(context.appId, slideController);
|
|
37266
|
+
((_a = logger.apps)[_b = context.appId] || (_a[_b] = {})).controller = slideController;
|
|
37090
37267
|
slideController.readyPromise.then(options.onReady);
|
|
37091
37268
|
return slideController;
|
|
37092
37269
|
};
|
|
@@ -37098,6 +37275,13 @@ const SlideApp = {
|
|
|
37098
37275
|
});
|
|
37099
37276
|
const room = context.getRoom();
|
|
37100
37277
|
const sideEffect = new o();
|
|
37278
|
+
sideEffect.add(() => {
|
|
37279
|
+
var _a, _b, _c;
|
|
37280
|
+
((_a = logger.apps)[_b = context.appId] || (_a[_b] = {})).context = context;
|
|
37281
|
+
logger.enable = ((_c = context.getAppOptions()) == null ? void 0 : _c.debug) || false;
|
|
37282
|
+
logger.level = "debug";
|
|
37283
|
+
return () => logger.dispose(context.appId);
|
|
37284
|
+
});
|
|
37101
37285
|
if (room) {
|
|
37102
37286
|
docsViewer.toggleClickThrough(room.state.memberState.currentApplianceName);
|
|
37103
37287
|
sideEffect.add(() => {
|
|
@@ -37111,7 +37295,7 @@ const SlideApp = {
|
|
|
37111
37295
|
});
|
|
37112
37296
|
}
|
|
37113
37297
|
context.emitter.on("destroy", () => {
|
|
37114
|
-
|
|
37298
|
+
log("[Slide]: destroy");
|
|
37115
37299
|
apps.delete(context.appId);
|
|
37116
37300
|
sideEffect.flushAll();
|
|
37117
37301
|
if (docsViewer) {
|
|
@@ -37122,5 +37306,5 @@ const SlideApp = {
|
|
|
37122
37306
|
docsViewer.mount();
|
|
37123
37307
|
}
|
|
37124
37308
|
};
|
|
37125
|
-
export { DefaultUrl, FreezerLength, addHooks, apps, SlideApp as default };
|
|
37309
|
+
export { DefaultUrl, FreezerLength, SlidePreviewer, addHooks, apps, SlideApp as default, previewSlide };
|
|
37126
37310
|
//# sourceMappingURL=main.es.js.map
|