@netless/app-slide 0.0.29 → 0.0.30
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/SlideController/index.d.ts +0 -1
- package/dist/main.cjs.js +128 -128
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +90 -57
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +137 -137
- package/dist/main.iife.js.map +1 -1
- package/dist/utils/logger.d.ts +20 -0
- package/package.json +4 -4
- package/src/SlideController/index.ts +15 -36
- package/src/SlideDocsViewer/index.ts +1 -1
- package/src/index.ts +17 -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";
|
|
@@ -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) {
|
|
@@ -31914,7 +31917,7 @@ void main() {
|
|
|
31914
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));
|
|
31915
31918
|
}
|
|
31916
31919
|
startTimeLine(t3 = true) {
|
|
31917
|
-
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)
|
|
31918
31921
|
return void this.startIterate();
|
|
31919
31922
|
this.timeDelta = 0, this.emit("timelineStart", { id: this.uuid, activeCount: this.applyCount, isReverse: this.isReverse });
|
|
31920
31923
|
const e3 = 1e3 / this.ctx.ticker.maxFPS;
|
|
@@ -31995,7 +31998,7 @@ void main() {
|
|
|
31995
31998
|
});
|
|
31996
31999
|
}
|
|
31997
32000
|
seekToStart(t3 = true) {
|
|
31998
|
-
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)
|
|
31999
32002
|
return this.isIterateEnd = true, void this.iterateShadows.forEach((e3) => e3.seekToStart(t3));
|
|
32000
32003
|
if (t3)
|
|
32001
32004
|
for (let t4 = this.subList.length - 1; t4 >= 0; t4--) {
|
|
@@ -32028,7 +32031,7 @@ void main() {
|
|
|
32028
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);
|
|
32029
32032
|
}
|
|
32030
32033
|
emitEndEvents() {
|
|
32031
|
-
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 }));
|
|
32032
32035
|
}
|
|
32033
32036
|
collectStartValue() {
|
|
32034
32037
|
this.emit("timeNodeCreate"), this.children.forEach((t3) => t3.commonTimeNode.collectStartValue());
|
|
@@ -32215,7 +32218,7 @@ void main() {
|
|
|
32215
32218
|
}
|
|
32216
32219
|
destroy() {
|
|
32217
32220
|
var t3;
|
|
32218
|
-
|
|
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();
|
|
32219
32222
|
}
|
|
32220
32223
|
mainSeqStep() {
|
|
32221
32224
|
var t3, e3;
|
|
@@ -35016,7 +35019,7 @@ void main(void){
|
|
|
35016
35019
|
}, e3.prototype.createController = function() {
|
|
35017
35020
|
this.player && (this.playerController = new kd({ player: this.player, params: this.player.config || {}, target: this.frame }));
|
|
35018
35021
|
}, e3.prototype.setMedianControllerAttribute = function() {
|
|
35019
|
-
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";
|
|
35020
35023
|
}, e3.prototype.frameResizeHandler = function() {
|
|
35021
35024
|
var t4 = this.frame.getBoundingClientRect(), e4 = t4.width, n2 = t4.height;
|
|
35022
35025
|
this.frameWidth = e4, this.frameHeight = n2, this.resizeView();
|
|
@@ -35428,9 +35431,10 @@ swizzle$1.wrap = function(fn) {
|
|
|
35428
35431
|
};
|
|
35429
35432
|
var colorNames = colorName;
|
|
35430
35433
|
var swizzle2 = simpleSwizzle.exports;
|
|
35434
|
+
var hasOwnProperty = Object.hasOwnProperty;
|
|
35431
35435
|
var reverseNames = {};
|
|
35432
35436
|
for (var name in colorNames) {
|
|
35433
|
-
if (
|
|
35437
|
+
if (hasOwnProperty.call(colorNames, name)) {
|
|
35434
35438
|
reverseNames[colorNames[name]] = name;
|
|
35435
35439
|
}
|
|
35436
35440
|
}
|
|
@@ -35519,10 +35523,10 @@ cs.get.rgb = function(string) {
|
|
|
35519
35523
|
if (match[1] === "transparent") {
|
|
35520
35524
|
return [0, 0, 0, 0];
|
|
35521
35525
|
}
|
|
35522
|
-
|
|
35523
|
-
if (!rgb) {
|
|
35526
|
+
if (!hasOwnProperty.call(colorNames, match[1])) {
|
|
35524
35527
|
return null;
|
|
35525
35528
|
}
|
|
35529
|
+
rgb = colorNames[match[1]];
|
|
35526
35530
|
rgb[3] = 1;
|
|
35527
35531
|
return rgb;
|
|
35528
35532
|
} else {
|
|
@@ -35542,7 +35546,7 @@ cs.get.hsl = function(string) {
|
|
|
35542
35546
|
var match = string.match(hsl);
|
|
35543
35547
|
if (match) {
|
|
35544
35548
|
var alpha = parseFloat(match[4]);
|
|
35545
|
-
var h = (parseFloat(match[1]) + 360) % 360;
|
|
35549
|
+
var h = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
35546
35550
|
var s2 = clamp(parseFloat(match[2]), 0, 100);
|
|
35547
35551
|
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
35548
35552
|
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
@@ -35600,10 +35604,45 @@ function clamp(num, min, max) {
|
|
|
35600
35604
|
return Math.min(Math.max(min, num), max);
|
|
35601
35605
|
}
|
|
35602
35606
|
function hexDouble(num) {
|
|
35603
|
-
var str = num.toString(16).toUpperCase();
|
|
35607
|
+
var str = Math.round(num).toString(16).toUpperCase();
|
|
35604
35608
|
return str.length < 2 ? "0" + str : str;
|
|
35605
35609
|
}
|
|
35606
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);
|
|
35607
35646
|
function guessBgColor(el) {
|
|
35608
35647
|
try {
|
|
35609
35648
|
const bg = window.getComputedStyle(el).backgroundColor;
|
|
@@ -35632,6 +35671,7 @@ let cachedBgColor = "";
|
|
|
35632
35671
|
function cachedGetBgColor(el) {
|
|
35633
35672
|
if (!cachedBgColor) {
|
|
35634
35673
|
cachedBgColor = toHex(guessBgColor(el));
|
|
35674
|
+
log("[Slide] guess bg color", cachedBgColor);
|
|
35635
35675
|
}
|
|
35636
35676
|
return cachedBgColor;
|
|
35637
35677
|
}
|
|
@@ -35684,7 +35724,6 @@ class SlideController {
|
|
|
35684
35724
|
onTransitionEnd,
|
|
35685
35725
|
onError
|
|
35686
35726
|
}) {
|
|
35687
|
-
var _a;
|
|
35688
35727
|
this.sideEffect = new o();
|
|
35689
35728
|
this.ready = false;
|
|
35690
35729
|
this.readyPromise = new Promise((resolve) => {
|
|
@@ -35699,9 +35738,7 @@ class SlideController {
|
|
|
35699
35738
|
type: Slide.SLIDE_EVENTS.syncDispatch,
|
|
35700
35739
|
payload: event
|
|
35701
35740
|
};
|
|
35702
|
-
|
|
35703
|
-
console.log("[Slide] dispatch", event);
|
|
35704
|
-
}
|
|
35741
|
+
log("[Slide] dispatch", event);
|
|
35705
35742
|
this.room.dispatchMagixEvent(this.channel, payload);
|
|
35706
35743
|
}
|
|
35707
35744
|
};
|
|
@@ -35710,9 +35747,7 @@ class SlideController {
|
|
|
35710
35747
|
const { type, payload } = ev.payload;
|
|
35711
35748
|
if (type === Slide.SLIDE_EVENTS.syncDispatch) {
|
|
35712
35749
|
this.syncStateOnce();
|
|
35713
|
-
|
|
35714
|
-
console.log("[Slide] receive", payload);
|
|
35715
|
-
}
|
|
35750
|
+
log("[Slide] receive", payload);
|
|
35716
35751
|
if (!this.syncStateOnceFlag) {
|
|
35717
35752
|
this.slide.emit(Slide.SLIDE_EVENTS.syncReceive, payload);
|
|
35718
35753
|
}
|
|
@@ -35721,6 +35756,7 @@ class SlideController {
|
|
|
35721
35756
|
};
|
|
35722
35757
|
this.onStateChange = (state) => {
|
|
35723
35758
|
if (this.context.getIsWritable()) {
|
|
35759
|
+
verbose("[Slide] state change", JSON.stringify(state, null, 2));
|
|
35724
35760
|
this.context.updateAttributes(["state"], state);
|
|
35725
35761
|
}
|
|
35726
35762
|
};
|
|
@@ -35743,9 +35779,7 @@ class SlideController {
|
|
|
35743
35779
|
setTimeout(this.pollReadyState, 500);
|
|
35744
35780
|
} else {
|
|
35745
35781
|
this.pollCount = 0;
|
|
35746
|
-
|
|
35747
|
-
console.log("[Slide] renderSlide (retry after timeout)", 1);
|
|
35748
|
-
}
|
|
35782
|
+
log("[Slide] renderSlide (retry after timeout)", 1);
|
|
35749
35783
|
this.slide.renderSlide(1);
|
|
35750
35784
|
}
|
|
35751
35785
|
};
|
|
@@ -35765,9 +35799,7 @@ class SlideController {
|
|
|
35765
35799
|
this.freezePromise = null;
|
|
35766
35800
|
this.freeze = () => {
|
|
35767
35801
|
if (this.ready) {
|
|
35768
|
-
|
|
35769
|
-
console.log("[Slide] freeze", this.context.appId);
|
|
35770
|
-
}
|
|
35802
|
+
log("[Slide] freeze", this.context.appId);
|
|
35771
35803
|
if (this.freezePromise) {
|
|
35772
35804
|
this._toFreeze = 1;
|
|
35773
35805
|
} else if (!this.isFrozen) {
|
|
@@ -35780,9 +35812,7 @@ class SlideController {
|
|
|
35780
35812
|
};
|
|
35781
35813
|
this.unfreeze = async () => {
|
|
35782
35814
|
if (this.ready) {
|
|
35783
|
-
|
|
35784
|
-
console.log("[Slide] unfreeze", this.context.appId);
|
|
35785
|
-
}
|
|
35815
|
+
log("[Slide] unfreeze", this.context.appId);
|
|
35786
35816
|
if (this.freezePromise) {
|
|
35787
35817
|
this._toFreeze = -1;
|
|
35788
35818
|
} else if (this.isFrozen) {
|
|
@@ -35801,7 +35831,6 @@ class SlideController {
|
|
|
35801
35831
|
this.channel = `channel-${context.appId}`;
|
|
35802
35832
|
this.room = context.getRoom();
|
|
35803
35833
|
this.player = this.room ? void 0 : context.getDisplayer();
|
|
35804
|
-
this.debug = !!((_a = context.getAppOptions()) == null ? void 0 : _a.debug);
|
|
35805
35834
|
this.slide = this.createSlide(anchor);
|
|
35806
35835
|
this.syncStateOnceFlag = !this.context.isAddApp;
|
|
35807
35836
|
this.initialize();
|
|
@@ -35821,15 +35850,11 @@ class SlideController {
|
|
|
35821
35850
|
const { taskId, url, state } = __spreadValues(__spreadValues({}, EmptyAttributes), this.context.getAttributes());
|
|
35822
35851
|
slide.setResource(taskId, url || DefaultUrl);
|
|
35823
35852
|
if (state) {
|
|
35824
|
-
|
|
35825
|
-
console.log("[Slide] init with state", deepClone(state));
|
|
35826
|
-
}
|
|
35853
|
+
log("[Slide] init with state", deepClone(state));
|
|
35827
35854
|
this.syncStateOnceFlag = false;
|
|
35828
35855
|
slide.setSlideState(deepClone(state));
|
|
35829
35856
|
} else if (context.isAddApp) {
|
|
35830
|
-
|
|
35831
|
-
console.log("[Slide] init by renderSlide", 1);
|
|
35832
|
-
}
|
|
35857
|
+
log("[Slide] init by renderSlide", 1);
|
|
35833
35858
|
slide.renderSlide(1);
|
|
35834
35859
|
}
|
|
35835
35860
|
this.pollReadyState();
|
|
@@ -35868,9 +35893,7 @@ class SlideController {
|
|
|
35868
35893
|
if (this.syncStateOnceFlag) {
|
|
35869
35894
|
const { state } = __spreadValues(__spreadValues({}, EmptyAttributes), this.context.getAttributes());
|
|
35870
35895
|
if (state) {
|
|
35871
|
-
|
|
35872
|
-
console.log("[Slide] sync with state (once)", deepClone(state));
|
|
35873
|
-
}
|
|
35896
|
+
log("[Slide] sync with state (once)", deepClone(state));
|
|
35874
35897
|
this.slide.setSlideState(deepClone(state));
|
|
35875
35898
|
this.syncStateOnceFlag = false;
|
|
35876
35899
|
}
|
|
@@ -35892,7 +35915,7 @@ class SlideController {
|
|
|
35892
35915
|
interactive: true,
|
|
35893
35916
|
mode: "interactive",
|
|
35894
35917
|
resize: true,
|
|
35895
|
-
controller:
|
|
35918
|
+
controller: logger.enable,
|
|
35896
35919
|
renderOptions: {
|
|
35897
35920
|
minFPS: 25,
|
|
35898
35921
|
maxFPS: 30,
|
|
@@ -35903,17 +35926,12 @@ class SlideController {
|
|
|
35903
35926
|
},
|
|
35904
35927
|
timestamp: this.timestamp
|
|
35905
35928
|
});
|
|
35906
|
-
if (this.debug) {
|
|
35907
|
-
window.slide = slide;
|
|
35908
|
-
}
|
|
35909
35929
|
return slide;
|
|
35910
35930
|
}
|
|
35911
35931
|
destroy() {
|
|
35912
35932
|
this.sideEffect.flushAll();
|
|
35913
35933
|
if (!this.destroyed) {
|
|
35914
|
-
|
|
35915
|
-
console.log("[Slide] destroy slide (once)");
|
|
35916
|
-
}
|
|
35934
|
+
log("[Slide] destroy slide (once)");
|
|
35917
35935
|
this.slide.destroy();
|
|
35918
35936
|
this.destroyed = true;
|
|
35919
35937
|
}
|
|
@@ -36892,7 +36910,7 @@ class DocsViewer {
|
|
|
36892
36910
|
return `${this.namespace}-${className}`;
|
|
36893
36911
|
}
|
|
36894
36912
|
}
|
|
36895
|
-
const ClickThroughAppliances = new Set(["clicker"
|
|
36913
|
+
const ClickThroughAppliances = new Set(["clicker"]);
|
|
36896
36914
|
class SlideDocsViewer {
|
|
36897
36915
|
constructor({ box, view, mountSlideController, mountWhiteboard }) {
|
|
36898
36916
|
this.slideController = null;
|
|
@@ -37041,15 +37059,18 @@ const apps = {
|
|
|
37041
37059
|
map: new Map(),
|
|
37042
37060
|
queue: [],
|
|
37043
37061
|
validateQueue() {
|
|
37062
|
+
log("[Slide] freezer: validate", this.queue);
|
|
37044
37063
|
while (this.queue.length > FreezerLength) {
|
|
37045
37064
|
const appId = this.queue.pop();
|
|
37046
37065
|
const slide = this.map.get(appId);
|
|
37047
37066
|
if (slide) {
|
|
37067
|
+
log("[Slide] freezer: validate-freeze", appId, this.queue);
|
|
37048
37068
|
slide.freeze();
|
|
37049
37069
|
}
|
|
37050
37070
|
}
|
|
37051
37071
|
},
|
|
37052
37072
|
set(appId, slide) {
|
|
37073
|
+
log("[Slide] freezer: add", appId, this.queue);
|
|
37053
37074
|
this.map.set(appId, slide);
|
|
37054
37075
|
if (!this.queue.includes(appId)) {
|
|
37055
37076
|
this.queue.unshift(appId);
|
|
@@ -37057,6 +37078,7 @@ const apps = {
|
|
|
37057
37078
|
this.validateQueue();
|
|
37058
37079
|
},
|
|
37059
37080
|
delete(appId) {
|
|
37081
|
+
log("[Slide] freezer: delete", appId, this.queue);
|
|
37060
37082
|
this.map.delete(appId);
|
|
37061
37083
|
this.queue = this.queue.filter((id) => id !== appId);
|
|
37062
37084
|
},
|
|
@@ -37068,6 +37090,7 @@ const apps = {
|
|
|
37068
37090
|
}
|
|
37069
37091
|
this.queue.unshift(appId);
|
|
37070
37092
|
this.validateQueue();
|
|
37093
|
+
log("[Slide] freezer: focus", appId, this.queue);
|
|
37071
37094
|
if (slide) {
|
|
37072
37095
|
slide.unfreeze();
|
|
37073
37096
|
}
|
|
@@ -37099,23 +37122,26 @@ const SlideApp = {
|
|
|
37099
37122
|
const baseScenePath = context.getInitScenePath();
|
|
37100
37123
|
let docsViewer = null;
|
|
37101
37124
|
const onPageChanged = (page) => {
|
|
37102
|
-
var _a;
|
|
37103
37125
|
const room2 = context.getRoom();
|
|
37104
|
-
if (docsViewer && docsViewer.slideController
|
|
37105
|
-
|
|
37106
|
-
if (
|
|
37107
|
-
|
|
37126
|
+
if (docsViewer && docsViewer.slideController) {
|
|
37127
|
+
let synced = false;
|
|
37128
|
+
if (room2 && context.getIsWritable()) {
|
|
37129
|
+
syncSceneWithSlide(room2, context, docsViewer.slideController.slide, baseScenePath);
|
|
37130
|
+
synced = true;
|
|
37108
37131
|
}
|
|
37132
|
+
log("[Slide] page to", page, synced);
|
|
37109
37133
|
docsViewer.viewer.setPageIndex(page - 1);
|
|
37110
37134
|
}
|
|
37111
37135
|
};
|
|
37112
37136
|
const mountSlideController = (options) => {
|
|
37137
|
+
var _a, _b;
|
|
37113
37138
|
const slideController = new SlideController(__spreadProps(__spreadValues({
|
|
37114
37139
|
context
|
|
37115
37140
|
}, options), {
|
|
37116
37141
|
onPageChanged
|
|
37117
37142
|
}));
|
|
37118
37143
|
apps.set(context.appId, slideController);
|
|
37144
|
+
((_a = logger.apps)[_b = context.appId] || (_a[_b] = {})).controller = slideController;
|
|
37119
37145
|
slideController.readyPromise.then(options.onReady);
|
|
37120
37146
|
return slideController;
|
|
37121
37147
|
};
|
|
@@ -37127,6 +37153,13 @@ const SlideApp = {
|
|
|
37127
37153
|
});
|
|
37128
37154
|
const room = context.getRoom();
|
|
37129
37155
|
const sideEffect = new o();
|
|
37156
|
+
sideEffect.add(() => {
|
|
37157
|
+
var _a, _b, _c;
|
|
37158
|
+
((_a = logger.apps)[_b = context.appId] || (_a[_b] = {})).context = context;
|
|
37159
|
+
logger.enable = ((_c = context.getAppOptions()) == null ? void 0 : _c.debug) || false;
|
|
37160
|
+
logger.level = "debug";
|
|
37161
|
+
return () => logger.dispose(context.appId);
|
|
37162
|
+
});
|
|
37130
37163
|
if (room) {
|
|
37131
37164
|
docsViewer.toggleClickThrough(room.state.memberState.currentApplianceName);
|
|
37132
37165
|
sideEffect.add(() => {
|
|
@@ -37140,7 +37173,7 @@ const SlideApp = {
|
|
|
37140
37173
|
});
|
|
37141
37174
|
}
|
|
37142
37175
|
context.emitter.on("destroy", () => {
|
|
37143
|
-
|
|
37176
|
+
log("[Slide]: destroy");
|
|
37144
37177
|
apps.delete(context.appId);
|
|
37145
37178
|
sideEffect.flushAll();
|
|
37146
37179
|
if (docsViewer) {
|