@netless/app-slide 0.2.102 → 0.2.104
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-zh.md +5 -0
- package/README.md +5 -0
- package/dist/index.d.ts +10 -2
- package/dist/main.cjs.js +102 -102
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +79 -87
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +87 -87
- package/dist/main.iife.js.map +1 -1
- package/package.json +4 -3
- package/src/DocsViewer/ResizableContainer.ts +35 -9
- package/src/SlideController/index.ts +1 -0
- package/src/SlideDocsViewer/index.ts +26 -18
- package/src/index.ts +14 -17
- package/src/typings.ts +4 -0
package/dist/main.es.js
CHANGED
|
@@ -34848,37 +34848,7 @@ void main(void){
|
|
|
34848
34848
|
destroy() {
|
|
34849
34849
|
var t2;
|
|
34850
34850
|
try {
|
|
34851
|
-
this.clearAutoForwardTimer(), this.app.view.removeEventListener("webglcontextlost", this.onWebGLLost), tg.collectObjectByGroup(this.objPoolGroup), qy.collectObjectByGroup(this.objPoolGroup), null === (t2 = this.transactionPlayer) || void 0 === t2 || t2.destroy(), this.loader.destroy(), this.fps.destroy(), this.stagePool.destroyAllStage(), this.stagePool.destroy();
|
|
34852
|
-
} catch (t3) {
|
|
34853
|
-
}
|
|
34854
|
-
!function(t3) {
|
|
34855
|
-
var e2, i2, n2, r2, o2, s2, a2;
|
|
34856
|
-
let l2 = null, h2 = null;
|
|
34857
|
-
try {
|
|
34858
|
-
l2 = t3.view;
|
|
34859
|
-
} catch (t4) {
|
|
34860
|
-
}
|
|
34861
|
-
try {
|
|
34862
|
-
h2 = t3.renderer;
|
|
34863
|
-
} catch (t4) {
|
|
34864
|
-
}
|
|
34865
|
-
try {
|
|
34866
|
-
null === (n2 = null === (i2 = null === (e2 = null == h2 ? void 0 : h2.filter) || void 0 === e2 ? void 0 : e2.texturePool) || void 0 === i2 ? void 0 : i2.clear) || void 0 === n2 || n2.call(i2, true);
|
|
34867
|
-
} catch (t4) {
|
|
34868
|
-
}
|
|
34869
|
-
try {
|
|
34870
|
-
null === (a2 = null === (s2 = null === (o2 = null === (r2 = null == h2 ? void 0 : h2.gl) || void 0 === r2 ? void 0 : r2.getExtension) || void 0 === o2 ? void 0 : o2.call(r2, "WEBGL_lose_context")) || void 0 === s2 ? void 0 : s2.loseContext) || void 0 === a2 || a2.call(s2);
|
|
34871
|
-
} catch (t4) {
|
|
34872
|
-
}
|
|
34873
|
-
try {
|
|
34874
|
-
t3.destroy(true, { children: true, texture: true, baseTexture: true });
|
|
34875
|
-
} catch (t4) {
|
|
34876
|
-
} finally {
|
|
34877
|
-
(null == l2 ? void 0 : l2.parentNode) && l2.parentNode.removeChild(l2);
|
|
34878
|
-
}
|
|
34879
|
-
}(this.app);
|
|
34880
|
-
try {
|
|
34881
|
-
this.tracker({ name: "slidePlayerDestroy", result: "", reason: "", payload: {} });
|
|
34851
|
+
this.clearAutoForwardTimer(), this.app.view.removeEventListener("webglcontextlost", this.onWebGLLost), this.app.renderer.filter.texturePool.clear(true), tg.collectObjectByGroup(this.objPoolGroup), qy.collectObjectByGroup(this.objPoolGroup), null === (t2 = this.transactionPlayer) || void 0 === t2 || t2.destroy(), this.loader.destroy(), this.fps.destroy(), this.stagePool.destroyAllStage(), this.stagePool.destroy(), this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext(), this.app.destroy(true, { children: true, texture: true, baseTexture: true }), this.tracker({ name: "slidePlayerDestroy", result: "", reason: "", payload: {} });
|
|
34882
34852
|
} catch (t3) {
|
|
34883
34853
|
}
|
|
34884
34854
|
}
|
|
@@ -37083,7 +37053,7 @@ void main(void){
|
|
|
37083
37053
|
}
|
|
37084
37054
|
var PT = { 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", useraddLink: "useraddLink" }, OT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, LT = "";
|
|
37085
37055
|
try {
|
|
37086
|
-
LT = "1.4.
|
|
37056
|
+
LT = "1.4.55-alpha.5";
|
|
37087
37057
|
} catch (t2) {
|
|
37088
37058
|
LT = "-dev-";
|
|
37089
37059
|
}
|
|
@@ -37098,7 +37068,7 @@ void main(void){
|
|
|
37098
37068
|
var DT = function(t2) {
|
|
37099
37069
|
function e2(i3) {
|
|
37100
37070
|
var n3 = t2.call(this) || this;
|
|
37101
|
-
n3.iosResetCache = [], n3.version = LT, n3.__slideState = cx()(OT), n3.userInputTime = 0, n3.isSyncingSlideState = false, n3.frozenTaskManager = new mT(), n3.randomId = r(), n3.resize = false, n3.isAnimating = false, n3.renderingTaskManager = new tb(), n3.isLoading = false, n3.
|
|
37071
|
+
n3.iosResetCache = [], n3.version = LT, n3.__slideState = cx()(OT), n3.userInputTime = 0, n3.isSyncingSlideState = false, n3.frozenTaskManager = new mT(), n3.randomId = r(), n3.resize = false, n3.isAnimating = false, n3.renderingTaskManager = new tb(), n3.isLoading = false, n3.interactive = true, n3.syncCatchUpInputBlocked = false, n3.renderingIndex = 0, n3.frameWidth = 1, n3.frameHeight = 1, n3.frame = document.createElement("div"), n3.canvasContainer = document.createElement("div"), n3.medianController = document.createElement("div"), n3.frameResizeObserver = new CT(function() {
|
|
37102
37072
|
return n3.frameResizeHandler();
|
|
37103
37073
|
}), n3.timestamp = function() {
|
|
37104
37074
|
return Date.now();
|
|
@@ -37531,8 +37501,8 @@ void main(void){
|
|
|
37531
37501
|
return this.renderingIndex = t3, this.player && t3 === this.player.currentIndex ? [2] : ((nx.platform.isIOS() || nx.platform.isAndroid()) && this.iosResetCache.indexOf(t3) < 0 && this.iosResetCache.push(t3), this.flushDebounce(), [4, null === (e3 = this.player) || void 0 === e3 ? void 0 : e3.renderSlide(t3)]);
|
|
37532
37502
|
case 1:
|
|
37533
37503
|
return n3.sent(), this.__slideState.currentSlideIndex = t3, this._resizeView(), this.__slideState.interactiveSeqState = {}, this.__slideState.mediaState = {}, this.emitStateChange(), setTimeout(function() {
|
|
37534
|
-
var t4, e4
|
|
37535
|
-
|
|
37504
|
+
var t4, e4;
|
|
37505
|
+
"hidden" === (null === (e4 = null === (t4 = i3.player) || void 0 === t4 ? void 0 : t4.view) || void 0 === e4 ? void 0 : e4.style.visibility) && (i3.player.view.style.visibility = "visible"), "hidden" === i3.frame.style.visibility && (i3.frame.style.visibility = "visible"), i3.cacheImage.style.display = "none";
|
|
37536
37506
|
}, 100), [2];
|
|
37537
37507
|
}
|
|
37538
37508
|
});
|
|
@@ -37625,7 +37595,7 @@ void main(void){
|
|
|
37625
37595
|
return !o2.isLoading;
|
|
37626
37596
|
}, 6e4)] : [3, 2];
|
|
37627
37597
|
case 1:
|
|
37628
|
-
for (n3 in s2.sent(), i3 = this.player.getSnapshot() || "", this.cacheImage.src = i3, this.cacheImage.style.display = "block",
|
|
37598
|
+
for (n3 in s2.sent(), i3 = this.player.getSnapshot() || "", this.cacheImage.src = i3, this.cacheImage.style.display = "block", this.player.destroy(), null === (e3 = this.playerController) || void 0 === e3 || e3.destroy(), this.player = void 0, this.__slideState.mediaState)
|
|
37629
37599
|
r2 = this.__slideState.mediaState[n3], this.__slideState.mediaState[n3] = ET(ET({}, r2), { frozenTime: this.timestamp() });
|
|
37630
37600
|
s2.label = 2;
|
|
37631
37601
|
case 2:
|
|
@@ -37647,19 +37617,13 @@ void main(void){
|
|
|
37647
37617
|
case 0:
|
|
37648
37618
|
if (this.logger.info("do release slide", this.taskId), this.tracker({ name: "releaseSlide", reason: "", result: "", payload: { taskId: this.taskId } }), this.player)
|
|
37649
37619
|
return [2];
|
|
37650
|
-
this.
|
|
37651
|
-
case 1:
|
|
37652
|
-
for (r2 in a2.trys.push([1, , 4, 5]), this.player = this.initPlayer(this.config), (null === (e3 = this.config) || void 0 === e3 ? void 0 : e3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), n3 = this.__slideState, this.__slideState = cx()(OT), n3.mediaState)
|
|
37620
|
+
for (r2 in this.player = this.initPlayer(this.config), (null === (e3 = this.config) || void 0 === e3 ? void 0 : e3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), n3 = this.__slideState, this.__slideState = cx()(OT), n3.mediaState)
|
|
37653
37621
|
"play" === (o2 = n3.mediaState[r2]).type && (s2 = Math.max(null !== (i3 = o2.frozenTime) && void 0 !== i3 ? i3 : 0, o2.time), o2.time = this.timestamp() - (s2 - o2.time), o2.frozenTime = void 0);
|
|
37654
37622
|
return [4, this.setSlideState(n3)];
|
|
37655
|
-
case
|
|
37623
|
+
case 1:
|
|
37656
37624
|
return a2.sent(), [4, this.player.clock.delay(333)];
|
|
37657
|
-
case
|
|
37658
|
-
return a2.sent(), this.player.view && (this.player.view.style.visibility = "visible"),
|
|
37659
|
-
case 4:
|
|
37660
|
-
return this.isReleasing = false, [7];
|
|
37661
|
-
case 5:
|
|
37662
|
-
return [2];
|
|
37625
|
+
case 2:
|
|
37626
|
+
return a2.sent(), this.player.view && (this.player.view.style.visibility = "visible"), this.cacheImage.style.display = "none", t3 && t3(), [2];
|
|
37663
37627
|
}
|
|
37664
37628
|
});
|
|
37665
37629
|
});
|
|
@@ -38531,7 +38495,8 @@ const EmptyAttributes = {
|
|
|
38531
38495
|
customLinks: [],
|
|
38532
38496
|
slideScale: 1,
|
|
38533
38497
|
translateX: 0.5,
|
|
38534
|
-
translateY: 0.5
|
|
38498
|
+
translateY: 0.5,
|
|
38499
|
+
originSize: null
|
|
38535
38500
|
};
|
|
38536
38501
|
const noop$1 = function noop2() {
|
|
38537
38502
|
};
|
|
@@ -40157,6 +40122,7 @@ class ResizableContainer {
|
|
|
40157
40122
|
constructor(parent, context, enableResize, _box) {
|
|
40158
40123
|
this.onScaleChanged = null;
|
|
40159
40124
|
this.onLayoutUpdated = null;
|
|
40125
|
+
this.scaleChangedListeners = /* @__PURE__ */ new Set();
|
|
40160
40126
|
this.whiteboardContainer = null;
|
|
40161
40127
|
this.slide = null;
|
|
40162
40128
|
this.scale = 1;
|
|
@@ -40207,6 +40173,12 @@ class ResizableContainer {
|
|
|
40207
40173
|
getScale() {
|
|
40208
40174
|
return this.scale;
|
|
40209
40175
|
}
|
|
40176
|
+
addScaleChangedListener(listener) {
|
|
40177
|
+
this.scaleChangedListeners.add(listener);
|
|
40178
|
+
return () => {
|
|
40179
|
+
this.scaleChangedListeners.delete(listener);
|
|
40180
|
+
};
|
|
40181
|
+
}
|
|
40210
40182
|
renderScrollBar(width, overflowWidth, height, overflowHeight) {
|
|
40211
40183
|
if (this.scrollBar) {
|
|
40212
40184
|
this.scrollBar.render(width, height, overflowWidth, overflowHeight);
|
|
@@ -40218,6 +40190,7 @@ class ResizableContainer {
|
|
|
40218
40190
|
}
|
|
40219
40191
|
updateResizableContainer() {
|
|
40220
40192
|
var _a, _b;
|
|
40193
|
+
this.cancelScheduledLayoutUpdate();
|
|
40221
40194
|
const parentBounds = this.scrollContainer.getBoundingClientRect();
|
|
40222
40195
|
this.container.style.width = `${parentBounds.width * this.scale}px`;
|
|
40223
40196
|
this.container.style.height = `${parentBounds.height * this.scale}px`;
|
|
@@ -40268,6 +40241,7 @@ class ResizableContainer {
|
|
|
40268
40241
|
}
|
|
40269
40242
|
}
|
|
40270
40243
|
scaleContainer(applyScale) {
|
|
40244
|
+
var _a;
|
|
40271
40245
|
if (Math.abs(this.scale - applyScale) < 1e-3 || !this.enableResize) {
|
|
40272
40246
|
return;
|
|
40273
40247
|
}
|
|
@@ -40279,13 +40253,25 @@ class ResizableContainer {
|
|
|
40279
40253
|
this.scrollContainer.style.height = "100%";
|
|
40280
40254
|
}
|
|
40281
40255
|
applyScale = this.enableResize ? applyScale : 1;
|
|
40282
|
-
if (this.onScaleChanged && this.enableResize) {
|
|
40283
|
-
this.onScaleChanged(applyScale);
|
|
40284
|
-
}
|
|
40285
40256
|
this.scale = applyScale;
|
|
40286
|
-
|
|
40287
|
-
this.
|
|
40288
|
-
|
|
40257
|
+
if (this.enableResize) {
|
|
40258
|
+
(_a = this.onScaleChanged) == null ? void 0 : _a.call(this, this.scale);
|
|
40259
|
+
for (const listener of this.scaleChangedListeners) {
|
|
40260
|
+
listener(this.scale);
|
|
40261
|
+
}
|
|
40262
|
+
}
|
|
40263
|
+
if (this.layoutFrameId === void 0) {
|
|
40264
|
+
this.layoutFrameId = requestAnimationFrame(() => {
|
|
40265
|
+
this.layoutFrameId = void 0;
|
|
40266
|
+
this.updateResizableContainer();
|
|
40267
|
+
});
|
|
40268
|
+
}
|
|
40269
|
+
}
|
|
40270
|
+
cancelScheduledLayoutUpdate() {
|
|
40271
|
+
if (this.layoutFrameId !== void 0) {
|
|
40272
|
+
cancelAnimationFrame(this.layoutFrameId);
|
|
40273
|
+
this.layoutFrameId = void 0;
|
|
40274
|
+
}
|
|
40289
40275
|
}
|
|
40290
40276
|
addSlideContainer(slideContainer) {
|
|
40291
40277
|
this.container.appendChild(slideContainer);
|
|
@@ -40299,7 +40285,9 @@ class ResizableContainer {
|
|
|
40299
40285
|
}
|
|
40300
40286
|
destroy(_box) {
|
|
40301
40287
|
var _a;
|
|
40288
|
+
this.cancelScheduledLayoutUpdate();
|
|
40302
40289
|
this.onLayoutUpdated = null;
|
|
40290
|
+
this.scaleChangedListeners.clear();
|
|
40303
40291
|
(_a = this.scrollBar) == null ? void 0 : _a.destroy();
|
|
40304
40292
|
}
|
|
40305
40293
|
}
|
|
@@ -40927,24 +40915,29 @@ class SlideDocsViewer {
|
|
|
40927
40915
|
};
|
|
40928
40916
|
this.scaleDocsToFit = () => {
|
|
40929
40917
|
if (this.slideController) {
|
|
40930
|
-
const { width, height } = this.slideController.slide;
|
|
40931
|
-
if (
|
|
40932
|
-
this.
|
|
40933
|
-
|
|
40934
|
-
|
|
40935
|
-
|
|
40936
|
-
|
|
40937
|
-
|
|
40938
|
-
|
|
40939
|
-
|
|
40940
|
-
|
|
40941
|
-
|
|
40942
|
-
|
|
40943
|
-
|
|
40944
|
-
|
|
40945
|
-
|
|
40946
|
-
|
|
40947
|
-
|
|
40918
|
+
const { width: slideWidth, height: slideHeight } = this.slideController.slide;
|
|
40919
|
+
if (slideWidth && slideHeight) {
|
|
40920
|
+
const originSize = this.context.storage.state.originSize;
|
|
40921
|
+
const { width, height } = originSize && originSize.width > 0 && originSize.height > 0 ? originSize : { width: slideWidth, height: slideHeight };
|
|
40922
|
+
if (width > 0 && height > 0) {
|
|
40923
|
+
this.whiteboardView.moveCameraToContain({
|
|
40924
|
+
originX: -width / 2,
|
|
40925
|
+
originY: -height / 2,
|
|
40926
|
+
width,
|
|
40927
|
+
height,
|
|
40928
|
+
animationMode: "immediately"
|
|
40929
|
+
});
|
|
40930
|
+
const scale = this.whiteboardView.camera.scale;
|
|
40931
|
+
this.whiteboardView.setCameraBound({
|
|
40932
|
+
damping: 1,
|
|
40933
|
+
maxContentMode: () => scale,
|
|
40934
|
+
minContentMode: () => scale,
|
|
40935
|
+
centerX: 0,
|
|
40936
|
+
centerY: 0,
|
|
40937
|
+
width: slideWidth,
|
|
40938
|
+
height: slideHeight
|
|
40939
|
+
});
|
|
40940
|
+
}
|
|
40948
40941
|
if (!this.isViewMounted) {
|
|
40949
40942
|
this.isViewMounted = true;
|
|
40950
40943
|
console.log("[Slide] mount whiteboard view");
|
|
@@ -41564,7 +41557,7 @@ class SlidePreviewer {
|
|
|
41564
41557
|
}
|
|
41565
41558
|
}
|
|
41566
41559
|
const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
|
|
41567
|
-
const version = "0.2.
|
|
41560
|
+
const version = "0.2.104";
|
|
41568
41561
|
const SlideApp = {
|
|
41569
41562
|
kind: "Slide",
|
|
41570
41563
|
setup(context) {
|
|
@@ -41690,24 +41683,23 @@ const SlideApp = {
|
|
|
41690
41683
|
return {
|
|
41691
41684
|
onScaleChanged: (cb) => {
|
|
41692
41685
|
if (!docsViewer) {
|
|
41693
|
-
return;
|
|
41686
|
+
return () => void 0;
|
|
41694
41687
|
}
|
|
41695
|
-
docsViewer.resizableContainer.
|
|
41688
|
+
return docsViewer.resizableContainer.addScaleChangedListener(cb);
|
|
41696
41689
|
},
|
|
41697
41690
|
scaleView: (to) => {
|
|
41698
|
-
|
|
41699
|
-
if (Number.
|
|
41700
|
-
|
|
41701
|
-
|
|
41702
|
-
if (applyScale <
|
|
41703
|
-
|
|
41704
|
-
|
|
41705
|
-
|
|
41706
|
-
|
|
41707
|
-
|
|
41708
|
-
|
|
41709
|
-
|
|
41710
|
-
docsViewer == null ? void 0 : docsViewer.resizableContainer.scaleContainer(applyScale);
|
|
41691
|
+
const applyScale = Number(to);
|
|
41692
|
+
if (!Number.isFinite(applyScale) || applyScale <= 0)
|
|
41693
|
+
return;
|
|
41694
|
+
const container = docsViewer == null ? void 0 : docsViewer.resizableContainer;
|
|
41695
|
+
if (!container || Math.abs(container.getScale() - applyScale) < 1e-3)
|
|
41696
|
+
return;
|
|
41697
|
+
context.storage.setState({
|
|
41698
|
+
slideScale: applyScale,
|
|
41699
|
+
translateX: 0.5,
|
|
41700
|
+
translateY: 0.5
|
|
41701
|
+
});
|
|
41702
|
+
container.scaleContainer(applyScale);
|
|
41711
41703
|
},
|
|
41712
41704
|
getViewScale: () => {
|
|
41713
41705
|
return docsViewer == null ? void 0 : docsViewer.resizableContainer.getScale();
|