@netless/app-slide 0.2.93 → 0.2.95
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 +3 -3
- package/README.md +3 -3
- package/dist/index.d.ts +11 -3
- package/dist/main.cjs.js +65 -65
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +123 -22
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +65 -65
- package/dist/main.iife.js.map +1 -1
- package/package.json +2 -2
- package/src/DocsViewer/ResizableContainer.ts +52 -32
- package/src/DocsViewer/ScrollBar.ts +57 -51
- package/src/SlideController/index.ts +88 -5
- package/src/SlideDocsViewer/index.ts +24 -11
- package/src/index.ts +12 -5
package/dist/main.es.js
CHANGED
|
@@ -30038,10 +30038,10 @@ void main(void){
|
|
|
30038
30038
|
if (r2) {
|
|
30039
30039
|
const i3 = new ep();
|
|
30040
30040
|
if (i3.texture = r2, n2.length > 0 && this.config.useFilter && (this.ctx.featureList || {}).filter && (i3.filters = av(n2, this.ctx.featureList)), this.config.fillFloat) {
|
|
30041
|
-
const { l:
|
|
30042
|
-
|
|
30043
|
-
const
|
|
30044
|
-
i3.width =
|
|
30041
|
+
const n3 = (null !== (t2 = this.config.shapeRotation) && void 0 !== t2 ? t2 : 0) + (null !== (e2 = this.config.groupRotation) && void 0 !== e2 ? e2 : 0), { l: r3, t: o3, r: s2, b: a2 } = this.config.fillFloat.fillRect, l2 = (t3) => Math.abs(Math.sin(t3)), h2 = (t3) => Math.abs(Math.cos(t3)), u2 = 1 - r3 * h2(n3) - s2 * h2(n3) - o3 * l2(n3) - a2 * l2(n3), c2 = 1 - r3 * l2(n3) - s2 * l2(n3) - o3 * h2(n3) - a2 * h2(n3), d2 = this.width * u2, p2 = this.height * c2, f2 = new Jd();
|
|
30042
|
+
f2.drawRect(0, 0, d2, p2), f2.pivot.x = d2 / 2, f2.pivot.y = p2 / 2, f2.rotation = n3;
|
|
30043
|
+
const m2 = f2.getBounds(), g2 = m2.width, v2 = m2.height;
|
|
30044
|
+
i3.width = g2, i3.height = v2, i3.anchor.x = 0.5, i3.anchor.y = 0.5, i3.rotation = -1 * n3, i3.name = "math-texture", 0 === n3 ? (i3.position.x = g2 / 2 + r3 * this.width, i3.position.y = v2 / 2 + o3 * this.height) : (i3.position.x = this.width / 2, i3.position.y = this.height / 2);
|
|
30045
30045
|
} else
|
|
30046
30046
|
i3.width = this.width, i3.height = this.height, o2.rotate && (i3.position.x = this.width / 2, i3.position.y = this.height / 2, i3.anchor.x = 0.5, i3.anchor.y = 0.5, i3.rotation = o2.rotate / 180 * Math.PI);
|
|
30047
30047
|
return i3;
|
|
@@ -31111,6 +31111,8 @@ void main(void){
|
|
|
31111
31111
|
}
|
|
31112
31112
|
createStrokeGraphics() {
|
|
31113
31113
|
var t2, e2, i2, n2;
|
|
31114
|
+
if (this.json.isMathFallback)
|
|
31115
|
+
return null;
|
|
31114
31116
|
const { id: r2, geometry: o2, lineStyle: s2 } = this.json, { width: a2, height: l2, pivot: h2 } = (null == o2 ? void 0 : o2.lineTransform) || $v, u2 = a2 || this.json.width, c2 = l2 || this.json.height, d2 = "solidFill" === (null === (t2 = null == s2 ? void 0 : s2.fill) || void 0 === t2 ? void 0 : t2.fillType) ? s2.fill.color : null;
|
|
31115
31117
|
return s2 && "noFill" !== (null === (e2 = s2.fill) || void 0 === e2 ? void 0 : e2.fillType) ? new Zv(r2 + "-path-graphics", this.ctx, null !== (i2 = null == o2 ? void 0 : o2.paths) && void 0 !== i2 ? i2 : [], null !== (n2 = null == o2 ? void 0 : o2.hash) && void 0 !== n2 ? n2 : "", h2 || { x: 0, y: 0 }, u2, c2, s2, false, null, d2) : null;
|
|
31116
31118
|
}
|
|
@@ -36526,7 +36528,7 @@ void main(void){
|
|
|
36526
36528
|
}
|
|
36527
36529
|
var _T = { 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" }, yT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, xT = "";
|
|
36528
36530
|
try {
|
|
36529
|
-
xT = "1.4.
|
|
36531
|
+
xT = "1.4.49";
|
|
36530
36532
|
} catch (t2) {
|
|
36531
36533
|
xT = "-dev-";
|
|
36532
36534
|
}
|
|
@@ -38053,19 +38055,81 @@ class SlideControllerBase {
|
|
|
38053
38055
|
this._toFreeze = -1;
|
|
38054
38056
|
}
|
|
38055
38057
|
};
|
|
38058
|
+
this.bindAppStateChangeEvent = () => {
|
|
38059
|
+
try {
|
|
38060
|
+
const boxStatus = this.context.getBoxStatus();
|
|
38061
|
+
if (boxStatus) {
|
|
38062
|
+
const appProxy = this.context.getAppProxy();
|
|
38063
|
+
if (appProxy) {
|
|
38064
|
+
this.context.emitter.on("boxStatusChange", this.onAppStatusChangeHandler);
|
|
38065
|
+
}
|
|
38066
|
+
} else {
|
|
38067
|
+
const windowManager = this.context.getWindowManager();
|
|
38068
|
+
if (windowManager) {
|
|
38069
|
+
windowManager.emitter.on("boxStateChange", this.onAppStateChangeHandler);
|
|
38070
|
+
}
|
|
38071
|
+
}
|
|
38072
|
+
} catch (error) {
|
|
38073
|
+
log(
|
|
38074
|
+
"[Slide] bind app state change event failed, because should update window manager to latest version"
|
|
38075
|
+
);
|
|
38076
|
+
}
|
|
38077
|
+
};
|
|
38078
|
+
this.onAppStateChangeHandler = (state) => {
|
|
38079
|
+
if (state === "minimized") {
|
|
38080
|
+
log("[Slide] freeze because app state is minimized");
|
|
38081
|
+
this.freeze();
|
|
38082
|
+
}
|
|
38083
|
+
};
|
|
38084
|
+
this.onAppStatusChangeHandler = (payload) => {
|
|
38085
|
+
const { appId, status } = payload;
|
|
38086
|
+
if (appId === this.context.appId && status === "minimized") {
|
|
38087
|
+
log("[Slide] freeze because app status is minimized");
|
|
38088
|
+
this.freeze();
|
|
38089
|
+
}
|
|
38090
|
+
};
|
|
38091
|
+
this.getAppStatus = () => {
|
|
38092
|
+
try {
|
|
38093
|
+
const boxStatus = this.context.getBoxStatus();
|
|
38094
|
+
if (boxStatus) {
|
|
38095
|
+
return boxStatus;
|
|
38096
|
+
}
|
|
38097
|
+
const windowManager = this.context.getWindowManager();
|
|
38098
|
+
const boxstate = windowManager.boxState;
|
|
38099
|
+
return boxstate;
|
|
38100
|
+
} catch (error) {
|
|
38101
|
+
return void 0;
|
|
38102
|
+
}
|
|
38103
|
+
};
|
|
38056
38104
|
this.onVisibilityChange = async () => {
|
|
38105
|
+
const appStatus = this.getAppStatus();
|
|
38106
|
+
if (appStatus === "minimized") {
|
|
38107
|
+
log("[Slide] do nothing because app state is minimized");
|
|
38108
|
+
return;
|
|
38109
|
+
}
|
|
38057
38110
|
if (!(this.visible = document.visibilityState === "visible")) {
|
|
38058
38111
|
this.savedIsFrozen = this.isFrozen;
|
|
38059
38112
|
log("[Slide] freeze because tab becomes invisible");
|
|
38060
38113
|
this.freeze();
|
|
38061
38114
|
} else {
|
|
38062
|
-
log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
|
|
38063
38115
|
if (!this.savedIsFrozen) {
|
|
38116
|
+
log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
|
|
38064
38117
|
this.unfreeze();
|
|
38065
38118
|
}
|
|
38066
38119
|
}
|
|
38067
38120
|
};
|
|
38068
|
-
const {
|
|
38121
|
+
const {
|
|
38122
|
+
context,
|
|
38123
|
+
onRenderStart,
|
|
38124
|
+
onPageChanged,
|
|
38125
|
+
onTransitionStart,
|
|
38126
|
+
onTransitionEnd,
|
|
38127
|
+
onNavigate,
|
|
38128
|
+
onError,
|
|
38129
|
+
onRenderError,
|
|
38130
|
+
showRenderError,
|
|
38131
|
+
invisibleBehavior
|
|
38132
|
+
} = props;
|
|
38069
38133
|
this.invisibleBehavior = invisibleBehavior != null ? invisibleBehavior : "frozen";
|
|
38070
38134
|
this.onRenderStart = onRenderStart;
|
|
38071
38135
|
this.onPageChanged = onPageChanged;
|
|
@@ -38142,7 +38206,18 @@ class SlideControllerBase {
|
|
|
38142
38206
|
slide.on(Slide.SLIDE_EVENTS.renderEnd, this.resolveReady);
|
|
38143
38207
|
this.sideEffect.add(() => {
|
|
38144
38208
|
document.addEventListener("visibilitychange", this.onVisibilityChange);
|
|
38145
|
-
|
|
38209
|
+
this.bindAppStateChangeEvent();
|
|
38210
|
+
return () => {
|
|
38211
|
+
document.removeEventListener("visibilitychange", this.onVisibilityChange);
|
|
38212
|
+
try {
|
|
38213
|
+
this.context.emitter.off("boxStatusChange", this.onAppStatusChangeHandler);
|
|
38214
|
+
this.context.getWindowManager().emitter.off("boxStateChange", this.onAppStateChangeHandler);
|
|
38215
|
+
} catch (error) {
|
|
38216
|
+
log(
|
|
38217
|
+
"[Slide] unbind app state change event failed, because should update window manager to latest version"
|
|
38218
|
+
);
|
|
38219
|
+
}
|
|
38220
|
+
};
|
|
38146
38221
|
});
|
|
38147
38222
|
}
|
|
38148
38223
|
syncStateOnce() {
|
|
@@ -39334,7 +39409,10 @@ class ScrollBar {
|
|
|
39334
39409
|
scrollBar.className = "scroll-bar horizontal";
|
|
39335
39410
|
const availableWidth = containerWidth;
|
|
39336
39411
|
const trackWidth = availableWidth;
|
|
39337
|
-
const thumbWidth = Math.max(
|
|
39412
|
+
const thumbWidth = Math.max(
|
|
39413
|
+
30,
|
|
39414
|
+
Math.min(trackWidth, trackWidth * availableWidth / contentWidth)
|
|
39415
|
+
);
|
|
39338
39416
|
scrollBar.style.cssText = `
|
|
39339
39417
|
position: absolute;
|
|
39340
39418
|
bottom: 0;
|
|
@@ -39369,7 +39447,10 @@ class ScrollBar {
|
|
|
39369
39447
|
scrollBar.className = "scroll-bar vertical";
|
|
39370
39448
|
const availableHeight = containerHeight;
|
|
39371
39449
|
const trackHeight = availableHeight;
|
|
39372
|
-
const thumbHeight = Math.max(
|
|
39450
|
+
const thumbHeight = Math.max(
|
|
39451
|
+
30,
|
|
39452
|
+
Math.min(trackHeight, trackHeight * availableHeight / contentHeight)
|
|
39453
|
+
);
|
|
39373
39454
|
scrollBar.style.cssText = `
|
|
39374
39455
|
position: absolute;
|
|
39375
39456
|
top: 0;
|
|
@@ -39433,15 +39514,23 @@ class ScrollBar {
|
|
|
39433
39514
|
scrollRatio = Math.max(0, Math.min(1, scrollRatio));
|
|
39434
39515
|
}
|
|
39435
39516
|
if (orientation === "horizontal") {
|
|
39436
|
-
this.resizableContainer.handleNormalizeTranslate(
|
|
39437
|
-
|
|
39438
|
-
|
|
39439
|
-
|
|
39517
|
+
this.resizableContainer.handleNormalizeTranslate(
|
|
39518
|
+
scrollRatio,
|
|
39519
|
+
(_a = this.resizableContainer["translateY"]) != null ? _a : 0.5,
|
|
39520
|
+
{
|
|
39521
|
+
triggerScrollBar: false,
|
|
39522
|
+
triggerSync: true
|
|
39523
|
+
}
|
|
39524
|
+
);
|
|
39440
39525
|
} else {
|
|
39441
|
-
this.resizableContainer.handleNormalizeTranslate(
|
|
39442
|
-
|
|
39443
|
-
|
|
39444
|
-
|
|
39526
|
+
this.resizableContainer.handleNormalizeTranslate(
|
|
39527
|
+
(_b = this.resizableContainer["translateX"]) != null ? _b : 0.5,
|
|
39528
|
+
scrollRatio,
|
|
39529
|
+
{
|
|
39530
|
+
triggerScrollBar: false,
|
|
39531
|
+
triggerSync: true
|
|
39532
|
+
}
|
|
39533
|
+
);
|
|
39445
39534
|
}
|
|
39446
39535
|
};
|
|
39447
39536
|
const handleEnd = () => {
|
|
@@ -39555,7 +39644,12 @@ class ResizableContainer {
|
|
|
39555
39644
|
}
|
|
39556
39645
|
this.translateX = 0.5;
|
|
39557
39646
|
this.translateY = 0.5;
|
|
39558
|
-
this.renderScrollBar(
|
|
39647
|
+
this.renderScrollBar(
|
|
39648
|
+
parentBounds.width,
|
|
39649
|
+
parentBounds.width * this.scale,
|
|
39650
|
+
parentBounds.height,
|
|
39651
|
+
parentBounds.height * this.scale
|
|
39652
|
+
);
|
|
39559
39653
|
this.handleNormalizeTranslate(this.translateX, this.translateY, {
|
|
39560
39654
|
triggerScrollBar: true,
|
|
39561
39655
|
triggerSync: true
|
|
@@ -39831,7 +39925,10 @@ class SlideDocsViewer {
|
|
|
39831
39925
|
console.log("[SlideDocsViewer] Initial storage state:", this.context.storage.state);
|
|
39832
39926
|
console.log("[SlideDocsViewer] Initial slideScale:", this.context.storage.state.slideScale);
|
|
39833
39927
|
if (this.context.storage.state.slideScale !== void 0) {
|
|
39834
|
-
console.log(
|
|
39928
|
+
console.log(
|
|
39929
|
+
"[SlideDocsViewer] Applying initial slideScale:",
|
|
39930
|
+
this.context.storage.state.slideScale
|
|
39931
|
+
);
|
|
39835
39932
|
applyScale(this.context.storage.state.slideScale);
|
|
39836
39933
|
} else {
|
|
39837
39934
|
console.log("[SlideDocsViewer] No initial slideScale found");
|
|
@@ -39869,7 +39966,11 @@ class SlideDocsViewer {
|
|
|
39869
39966
|
}
|
|
39870
39967
|
render() {
|
|
39871
39968
|
if (!this.resizableContainer) {
|
|
39872
|
-
this.resizableContainer = new ResizableContainer(
|
|
39969
|
+
this.resizableContainer = new ResizableContainer(
|
|
39970
|
+
this.viewer.$content,
|
|
39971
|
+
this.context,
|
|
39972
|
+
this.enableScale
|
|
39973
|
+
);
|
|
39873
39974
|
}
|
|
39874
39975
|
this.renderSlideContainer();
|
|
39875
39976
|
this.renderWhiteboardView();
|
|
@@ -40251,7 +40352,7 @@ class SlidePreviewer {
|
|
|
40251
40352
|
}
|
|
40252
40353
|
}
|
|
40253
40354
|
const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
|
|
40254
|
-
const version = "0.2.
|
|
40355
|
+
const version = "0.2.95";
|
|
40255
40356
|
const SlideApp = {
|
|
40256
40357
|
kind: "Slide",
|
|
40257
40358
|
setup(context) {
|