@netless/app-slide 0.2.34-beta.2 → 0.2.35
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 +5 -2
- package/dist/main.cjs.js +145 -145
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +44 -30
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +203 -203
- package/dist/main.iife.js.map +1 -1
- package/package.json +2 -2
- package/src/DocsViewer/index.ts +20 -5
- package/src/SlideDocsViewer/index.ts +3 -0
- package/src/index.ts +1 -0
package/dist/main.es.js
CHANGED
|
@@ -31363,7 +31363,7 @@ void main(void){
|
|
|
31363
31363
|
var l_ = i(120);
|
|
31364
31364
|
class h_ extends Za.a {
|
|
31365
31365
|
constructor(t2, e2) {
|
|
31366
|
-
super(), this.isGlobalPause = false, this.lastTime = -1, this.howl = null, this.rctClient = null, this.isHowlEnd = false, this.isHowlLoadEmit = false, this.url = t2, this.runningAudio = e2, jy.RtcAudioClazz ? (this.rctClient = new jy.RtcAudioClazz(t2), this.rctClient.on("load", () => this.emit("load")), this.rctClient.on("pause", () => this.emit("pause")), this.rctClient.on("play", () => this.emit("play"))) : (this.howl = new l_.Howl({ src: [t2] }), this.howl.load(), this.howl.on("load", () => {
|
|
31366
|
+
super(), this.isGlobalPause = false, this.lastTime = -1, this.howl = null, this.rctClient = null, this.isHowlEnd = false, this.isHowlLoadEmit = false, this.staticEventId = 1001, this.url = t2, this.runningAudio = e2, jy.RtcAudioClazz ? (this.rctClient = new jy.RtcAudioClazz(t2), this.rctClient.on("load", () => this.emit("load")), this.rctClient.on("pause", () => this.emit("pause")), this.rctClient.on("play", () => this.emit("play"))) : (this.howl = new l_.Howl({ src: [t2] }), [this.staticEventId] = this.howl._getSoundIds(), this.howl.load(), this.howl.on("load", () => {
|
|
31367
31367
|
this.isHowlLoadEmit = true, this.emit("load");
|
|
31368
31368
|
}), this.howl.on("pause", () => this.emit("pause")), this.howl.on("play", () => {
|
|
31369
31369
|
this.isHowlLoadEmit || this.emit("load"), this.isHowlEnd = false, this.emit("play");
|
|
@@ -31376,11 +31376,11 @@ void main(void){
|
|
|
31376
31376
|
}
|
|
31377
31377
|
play() {
|
|
31378
31378
|
var t2, e2, i2;
|
|
31379
|
-
this.runningAudio.has(this.url) && ((t2 = this.runningAudio.get(this.url)) === null || t2 === void 0 || t2.stop(), this.runningAudio.delete(this.url)), this.isHowlEnd = false, this.lastTime = -1, (e2 = this.howl) === null || e2 === void 0 || e2.play(), (i2 = this.rctClient) === null || i2 === void 0 || i2.play(), this.startTimeChangeEmit(), this.runningAudio.set(this.url, this);
|
|
31379
|
+
this.runningAudio.has(this.url) && ((t2 = this.runningAudio.get(this.url)) === null || t2 === void 0 || t2.stop(), this.runningAudio.delete(this.url)), this.isHowlEnd = false, this.lastTime = -1, (e2 = this.howl) === null || e2 === void 0 || e2.play(this.staticEventId), (i2 = this.rctClient) === null || i2 === void 0 || i2.play(), this.startTimeChangeEmit(), this.runningAudio.set(this.url, this);
|
|
31380
31380
|
}
|
|
31381
31381
|
pause() {
|
|
31382
31382
|
var t2, e2;
|
|
31383
|
-
(t2 = this.howl) === null || t2 === void 0 || t2.pause(), (e2 = this.rctClient) === null || e2 === void 0 || e2.pause(), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
|
|
31383
|
+
(t2 = this.howl) === null || t2 === void 0 || t2.pause(this.staticEventId), (e2 = this.rctClient) === null || e2 === void 0 || e2.pause(), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
|
|
31384
31384
|
}
|
|
31385
31385
|
globalPause() {
|
|
31386
31386
|
this.isPaused || (this.isGlobalPause = true, this.pause());
|
|
@@ -31390,26 +31390,26 @@ void main(void){
|
|
|
31390
31390
|
}
|
|
31391
31391
|
stop() {
|
|
31392
31392
|
var t2;
|
|
31393
|
-
(t2 = this.howl) === null || t2 === void 0 || t2.
|
|
31393
|
+
(t2 = this.howl) === null || t2 === void 0 || t2.pause(this.staticEventId), this.rctClient && (this.rctClient.pause(), this.rctClient.currentTime = 0), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
|
|
31394
31394
|
}
|
|
31395
31395
|
destroy() {
|
|
31396
31396
|
var t2, e2, i2, n2, r2, o2, s2;
|
|
31397
|
-
(t2 = this.howl) === null || t2 === void 0 || t2.
|
|
31397
|
+
(t2 = this.howl) === null || t2 === void 0 || t2.stop(this.staticEventId), (e2 = this.howl) === null || e2 === void 0 || e2.unload(), (i2 = this.rctClient) === null || i2 === void 0 || i2.pause(), (n2 = this.rctClient) === null || n2 === void 0 || n2.destroy(), (r2 = this.rctClient) === null || r2 === void 0 || r2.removeAllListeners("load"), (o2 = this.rctClient) === null || o2 === void 0 || o2.removeAllListeners("play"), (s2 = this.rctClient) === null || s2 === void 0 || s2.removeAllListeners("pause"), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
|
|
31398
31398
|
}
|
|
31399
31399
|
get currentTime() {
|
|
31400
|
-
return this.rctClient ? this.rctClient.currentTime : this.howl ? this.howl.seek() : -1;
|
|
31400
|
+
return this.rctClient ? this.rctClient.currentTime : this.howl ? this.howl.seek(this.staticEventId) : -1;
|
|
31401
31401
|
}
|
|
31402
31402
|
set currentTime(t2) {
|
|
31403
|
-
this.rctClient ? this.rctClient.currentTime = t2 : this.howl && this.howl.seek(t2);
|
|
31403
|
+
this.rctClient ? this.rctClient.currentTime = t2 : this.howl && this.howl.seek(t2, this.staticEventId);
|
|
31404
31404
|
}
|
|
31405
31405
|
get duration() {
|
|
31406
|
-
return this.rctClient ? this.rctClient.duration : this.howl ? this.howl.duration() : 0;
|
|
31406
|
+
return this.rctClient ? this.rctClient.duration : this.howl ? this.howl.duration(this.staticEventId) : 0;
|
|
31407
31407
|
}
|
|
31408
31408
|
get isEnded() {
|
|
31409
31409
|
return this.howl ? this.isHowlEnd : Math.abs(this.currentTime - this.duration) < 1e-3;
|
|
31410
31410
|
}
|
|
31411
31411
|
get isPaused() {
|
|
31412
|
-
return this.rctClient ? this.rctClient.isPaused : !!this.howl && this.howl.playing();
|
|
31412
|
+
return this.rctClient ? this.rctClient.isPaused : !!this.howl && this.howl.playing(this.staticEventId);
|
|
31413
31413
|
}
|
|
31414
31414
|
volume(t2) {
|
|
31415
31415
|
this.rctClient ? this.rctClient.volume(t2) : this.howl && this.howl.volume(t2);
|
|
@@ -35737,7 +35737,7 @@ void main(void){
|
|
|
35737
35737
|
}
|
|
35738
35738
|
var hT = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", syncEventLag: "syncEventLag", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange", slideStepEnd: "slideEnd", slideStepStart: "slideStart" }, uT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, cT = "";
|
|
35739
35739
|
try {
|
|
35740
|
-
cT = "1.0.
|
|
35740
|
+
cT = "1.0.1-beta.1";
|
|
35741
35741
|
} catch (t2) {
|
|
35742
35742
|
cT = "-dev";
|
|
35743
35743
|
}
|
|
@@ -38031,7 +38031,7 @@ if (runningOnBrowser) {
|
|
|
38031
38031
|
autoInitialize(LazyLoad, window.lazyLoadOptions);
|
|
38032
38032
|
}
|
|
38033
38033
|
class DocsViewer {
|
|
38034
|
-
constructor({ readonly, onNewPageIndex, onPlay }) {
|
|
38034
|
+
constructor({ readonly, onNewPageIndex, onPlay, urlInterrupter }) {
|
|
38035
38035
|
this._pages = [];
|
|
38036
38036
|
this.pageIndex = 0;
|
|
38037
38037
|
this.setPaused = () => {
|
|
@@ -38047,13 +38047,13 @@ class DocsViewer {
|
|
|
38047
38047
|
this.readonly = readonly;
|
|
38048
38048
|
this.onNewPageIndex = onNewPageIndex;
|
|
38049
38049
|
this.onPlay = onPlay;
|
|
38050
|
+
this.urlInterrupter = urlInterrupter || ((url) => url);
|
|
38050
38051
|
this.render();
|
|
38051
38052
|
}
|
|
38052
38053
|
set pages(value) {
|
|
38053
38054
|
this._pages = value;
|
|
38054
|
-
this.refreshPreview();
|
|
38055
|
+
this.refreshPreview().then(this.refreshBtnSidebar.bind(this));
|
|
38055
38056
|
this.refreshTotalPage();
|
|
38056
|
-
this.refreshBtnSidebar();
|
|
38057
38057
|
}
|
|
38058
38058
|
get pages() {
|
|
38059
38059
|
return this._pages;
|
|
@@ -38134,17 +38134,27 @@ class DocsViewer {
|
|
|
38134
38134
|
}
|
|
38135
38135
|
return this.$preview;
|
|
38136
38136
|
}
|
|
38137
|
-
refreshPreview() {
|
|
38138
|
-
var _a;
|
|
38137
|
+
async refreshPreview() {
|
|
38138
|
+
var _a, _b;
|
|
38139
38139
|
const { $preview } = this;
|
|
38140
38140
|
const pageClassName = this.wrapClassName("preview-page");
|
|
38141
38141
|
const pageNameClassName = this.wrapClassName("preview-page-name");
|
|
38142
38142
|
while ($preview.firstChild) {
|
|
38143
38143
|
$preview.firstChild.remove();
|
|
38144
38144
|
}
|
|
38145
|
+
const previewSRCs = [];
|
|
38146
|
+
for (let i = 0, len = this.pages.length; i < len; i++) {
|
|
38147
|
+
const page = this.pages[i];
|
|
38148
|
+
const src = (_a = page.thumbnail) != null ? _a : page.src.startsWith("ppt") ? void 0 : page.src;
|
|
38149
|
+
if (src) {
|
|
38150
|
+
previewSRCs[i] = this.urlInterrupter(src);
|
|
38151
|
+
}
|
|
38152
|
+
}
|
|
38153
|
+
for (let i = 0, len = this.pages.length; i < len; i++) {
|
|
38154
|
+
previewSRCs[i] = await previewSRCs[i];
|
|
38155
|
+
}
|
|
38145
38156
|
this.pages.forEach((page, i) => {
|
|
38146
|
-
|
|
38147
|
-
const previewSRC = (_a2 = page.thumbnail) != null ? _a2 : page.src.startsWith("ppt") ? void 0 : page.src;
|
|
38157
|
+
const previewSRC = previewSRCs[i];
|
|
38148
38158
|
if (!previewSRC) {
|
|
38149
38159
|
return;
|
|
38150
38160
|
}
|
|
@@ -38166,7 +38176,7 @@ class DocsViewer {
|
|
|
38166
38176
|
$page.appendChild($name);
|
|
38167
38177
|
$preview.appendChild($page);
|
|
38168
38178
|
});
|
|
38169
|
-
(
|
|
38179
|
+
(_b = this.previewLazyLoad) == null ? void 0 : _b.update();
|
|
38170
38180
|
}
|
|
38171
38181
|
renderPreviewMask() {
|
|
38172
38182
|
if (!this.$previewMask) {
|
|
@@ -38305,7 +38315,8 @@ class SlideDocsViewer {
|
|
|
38305
38315
|
mountSlideController,
|
|
38306
38316
|
mountWhiteboard,
|
|
38307
38317
|
baseScenePath,
|
|
38308
|
-
appId
|
|
38318
|
+
appId,
|
|
38319
|
+
urlInterrupter
|
|
38309
38320
|
}) {
|
|
38310
38321
|
this.slideController = null;
|
|
38311
38322
|
this.isViewMounted = false;
|
|
@@ -38454,7 +38465,8 @@ class SlideDocsViewer {
|
|
|
38454
38465
|
this.viewer = new DocsViewer({
|
|
38455
38466
|
readonly: box.readonly,
|
|
38456
38467
|
onNewPageIndex: this.onNewPageIndex,
|
|
38457
|
-
onPlay: this.onPlay
|
|
38468
|
+
onPlay: this.onPlay,
|
|
38469
|
+
urlInterrupter
|
|
38458
38470
|
});
|
|
38459
38471
|
this.sideEffect.add(() => {
|
|
38460
38472
|
const handler = (readonly) => {
|
|
@@ -38822,10 +38834,11 @@ class SlidePreviewer {
|
|
|
38822
38834
|
}
|
|
38823
38835
|
}
|
|
38824
38836
|
const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
|
|
38825
|
-
const version = "0.2.
|
|
38837
|
+
const version = "0.2.35";
|
|
38826
38838
|
const SlideApp = {
|
|
38827
38839
|
kind: "Slide",
|
|
38828
38840
|
setup(context) {
|
|
38841
|
+
var _a;
|
|
38829
38842
|
console.log("[Slide] setup @ " + version);
|
|
38830
38843
|
if (context.getIsWritable()) {
|
|
38831
38844
|
context.storage.ensureState(EmptyAttributes);
|
|
@@ -38889,14 +38902,15 @@ const SlideApp = {
|
|
|
38889
38902
|
mountSlideController,
|
|
38890
38903
|
mountWhiteboard: context.mountView.bind(context),
|
|
38891
38904
|
baseScenePath,
|
|
38892
|
-
appId: context.appId
|
|
38905
|
+
appId: context.appId,
|
|
38906
|
+
urlInterrupter: (_a = context.getAppOptions()) == null ? void 0 : _a.urlInterrupter
|
|
38893
38907
|
});
|
|
38894
38908
|
const room = context.getRoom();
|
|
38895
38909
|
const sideEffect = new SideEffectManager();
|
|
38896
38910
|
sideEffect.add(() => {
|
|
38897
|
-
var
|
|
38911
|
+
var _a2;
|
|
38898
38912
|
logger.setAppContext(context.appId, context);
|
|
38899
|
-
logger.enable = ((
|
|
38913
|
+
logger.enable = ((_a2 = context.getAppOptions()) == null ? void 0 : _a2.debug) || false;
|
|
38900
38914
|
logger.level = "debug";
|
|
38901
38915
|
return () => logger.deleteApp(context.appId);
|
|
38902
38916
|
});
|
|
@@ -38931,21 +38945,21 @@ const SlideApp = {
|
|
|
38931
38945
|
return docsViewer == null ? void 0 : docsViewer.slideController;
|
|
38932
38946
|
},
|
|
38933
38947
|
slide: () => {
|
|
38934
|
-
var
|
|
38935
|
-
return (
|
|
38948
|
+
var _a2;
|
|
38949
|
+
return (_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide;
|
|
38936
38950
|
},
|
|
38937
38951
|
nextStep: () => {
|
|
38938
|
-
var
|
|
38952
|
+
var _a2;
|
|
38939
38953
|
if (docsViewer && docsViewer.slideController) {
|
|
38940
|
-
(
|
|
38954
|
+
(_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide.nextStep();
|
|
38941
38955
|
return true;
|
|
38942
38956
|
}
|
|
38943
38957
|
return false;
|
|
38944
38958
|
},
|
|
38945
38959
|
prevStep: () => {
|
|
38946
|
-
var
|
|
38960
|
+
var _a2;
|
|
38947
38961
|
if (docsViewer && docsViewer.slideController) {
|
|
38948
|
-
(
|
|
38962
|
+
(_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide.prevStep();
|
|
38949
38963
|
return true;
|
|
38950
38964
|
}
|
|
38951
38965
|
return false;
|