@netless/app-slide 0.2.34 → 0.2.36
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 +161 -161
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +52 -30
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +218 -218
- 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
|
@@ -30611,7 +30611,7 @@ void main(void){
|
|
|
30611
30611
|
const r3 = e2[t3], o3 = e2[t3 + 1], [s3, a2] = o3.split(",").map((t4) => Number(t4) / 100);
|
|
30612
30612
|
i2.push(r3), n2.push({ x: s3, y: a2 });
|
|
30613
30613
|
}
|
|
30614
|
-
if (i2.join("") !== "
|
|
30614
|
+
if (i2.join("") !== "MLLLCC")
|
|
30615
30615
|
return false;
|
|
30616
30616
|
for (let t3 = 0; t3 < 3; t3++) {
|
|
30617
30617
|
const e3 = n2[t3], i3 = n2[t3 + 1];
|
|
@@ -31065,10 +31065,15 @@ void main(void){
|
|
|
31065
31065
|
if (((t3 = this.json.textBody) === null || t3 === void 0 ? void 0 : t3.iterateType) === "wd" || ((e2 = this.json.textBody) === null || e2 === void 0 ? void 0 : e2.iterateType) === "lt") {
|
|
31066
31066
|
if (this.renderContainer.addChild(this.container), this.text) {
|
|
31067
31067
|
const { x: t4, y: e3 } = (i2 = this.json.scale) !== null && i2 !== void 0 ? i2 : { x: 1, y: 1 };
|
|
31068
|
-
this.text.container.scale.x = e3 < 0 ? -Math.abs(t4) : Math.abs(t4), this.text.container.scale.y = e3, this.text.container.position.x = ((r2 = (n2 = this.json.position) === null || n2 === void 0 ? void 0 : n2.x) !== null && r2 !== void 0 ? r2 : 0) + this.text.x, this.text.container.position.y = ((s2 = (o2 = this.json.position) === null || o2 === void 0 ? void 0 : o2.y) !== null && s2 !== void 0 ? s2 : 0) + this.text.y, this.text.container.scale.y < 0 && (this.text.container.position.y += this.text.height), this.text.container.scale.x < 0 && (this.text.container.position.x += this.json.width), this.renderContainer.addChild(this.text.container);
|
|
31068
|
+
this.text.container.scale.x = e3 < 0 ? -Math.abs(t4) : Math.abs(t4), this.text.container.scale.y = e3, this.text.container.position.x = ((r2 = (n2 = this.json.position) === null || n2 === void 0 ? void 0 : n2.x) !== null && r2 !== void 0 ? r2 : 0) + this.text.x, this.text.container.position.y = ((s2 = (o2 = this.json.position) === null || o2 === void 0 ? void 0 : o2.y) !== null && s2 !== void 0 ? s2 : 0) + this.text.y, this.text.container.scale.y < 0 && (this.text.container.position.y += this.text.height), this.text.container.scale.x < 0 && (this.text.container.position.x += this.json.width), this.json.textRotation && (this.text.container.rotation = this.json.textRotation), this.renderContainer.addChild(this.text.container);
|
|
31069
31069
|
}
|
|
31070
31070
|
} else {
|
|
31071
31071
|
if (this.text) {
|
|
31072
|
+
if (this.json.textRotation) {
|
|
31073
|
+
this.text.container.rotation = this.json.textRotation;
|
|
31074
|
+
const { width: t5, height: e4 } = this.text, { x: i4, y: n3 } = this.text.container.position;
|
|
31075
|
+
this.text.container.pivot.x = t5 / 2, this.text.container.pivot.y = e4 / 2, this.text.container.x = i4 + t5 / 2, this.text.container.y = n3 + e4 / 2;
|
|
31076
|
+
}
|
|
31072
31077
|
if (cg()(this.json.textRotateWithShape) && !this.json.textRotateWithShape) {
|
|
31073
31078
|
const t5 = this.json.rotation || 0;
|
|
31074
31079
|
this.text.container.rotation = -t5;
|
|
@@ -31541,7 +31546,7 @@ void main(void){
|
|
|
31541
31546
|
this.controller.jumpToTime(t2);
|
|
31542
31547
|
}
|
|
31543
31548
|
stop() {
|
|
31544
|
-
this.seek(0), this.pause(), this.ctx.eventHub.emit(Hy.mediaStop);
|
|
31549
|
+
this.seek(0), this.pause(), this.ctx.eventHub.emit(Hy.mediaStop, { id: this.id });
|
|
31545
31550
|
}
|
|
31546
31551
|
requestFullscreen() {
|
|
31547
31552
|
return u_(this, void 0, void 0, function* () {
|
|
@@ -31644,7 +31649,7 @@ void main(void){
|
|
|
31644
31649
|
this.ctx.isPlayerPaused() ? this.ctx.logger.info("Audio player prevent seek event with paused state", this.ctx.taskId) : this.controller.jumpToTime(t2);
|
|
31645
31650
|
}
|
|
31646
31651
|
stop() {
|
|
31647
|
-
this.seek(0), this.pause(), this.ctx.eventHub.emit(Hy.mediaStop);
|
|
31652
|
+
this.seek(0), this.pause(), this.ctx.eventHub.emit(Hy.mediaStop, { id: this.id });
|
|
31648
31653
|
}
|
|
31649
31654
|
requestFullscreen() {
|
|
31650
31655
|
}
|
|
@@ -31787,8 +31792,11 @@ void main(void){
|
|
|
31787
31792
|
const o2 = { x: (i2 = (e2 = this.json.position) === null || e2 === void 0 ? void 0 : e2.x) !== null && i2 !== void 0 ? i2 : 0, y: (r2 = (n2 = this.json.position) === null || n2 === void 0 ? void 0 : n2.y) !== null && r2 !== void 0 ? r2 : 0 };
|
|
31788
31793
|
for (let e3 = 0, i3 = this.json.children.length; e3 < i3; e3++)
|
|
31789
31794
|
t2.addSubMTask(() => g_(this, void 0, void 0, function* () {
|
|
31790
|
-
|
|
31791
|
-
|
|
31795
|
+
let i4 = this.json.children[e3], n3 = null;
|
|
31796
|
+
if (!(!this.ctx.featureList || !this.ctx.featureList.smartArt) && ((i4 == null ? void 0 : i4.type) === "Shape" || (i4 == null ? void 0 : i4.type) === "Picture") && this.ctx.smartArtShapeList) {
|
|
31797
|
+
const { id: t3 } = i4, e4 = this.ctx.smartArtShapeList.find((e5) => e5.id === t3);
|
|
31798
|
+
e4 && (i4 = e4);
|
|
31799
|
+
}
|
|
31792
31800
|
(i4 == null ? void 0 : i4.type) === "Shape" ? n3 = new Kv(i4, this.ctx, o2, this.json.fillStyle) : (i4 == null ? void 0 : i4.type) === "Picture" ? n3 = new m_(i4, this.ctx, o2, this.json.fillStyle) : (i4 == null ? void 0 : i4.type) === "Container" && (n3 = new v_(i4, this.ctx, o2, this.json.fillStyle, t2)), n3 && this.children.push(n3);
|
|
31793
31801
|
}), "@ContainerImpl[child.init]");
|
|
31794
31802
|
}
|
|
@@ -32986,7 +32994,7 @@ void main(void){
|
|
|
32986
32994
|
};
|
|
32987
32995
|
class wy extends v_ {
|
|
32988
32996
|
constructor(t2, e2, i2, n2) {
|
|
32989
|
-
super({ id: "stage", width: t2.width, height: t2.height, type: "Container", children: t2.children }, e2, i2, void 0, n2), this.isRendered = false, this.isTimingStartValueCollected = false, this.json = t2, e2.hasBackgroundFillShape = this.detectUseBackgroundFill(this.json), this.container.visible = false, this.ctx = e2;
|
|
32997
|
+
super({ id: "stage", width: t2.width, height: t2.height, type: "Container", children: t2.children }, e2, i2, void 0, n2), this.isRendered = false, this.isTimingStartValueCollected = false, this.json = t2, this.json.smartArtShapeList && (e2.smartArtShapeList = this.json.smartArtShapeList), e2.hasBackgroundFillShape = this.detectUseBackgroundFill(this.json), this.container.visible = false, this.ctx = e2;
|
|
32990
32998
|
const r2 = new Jd();
|
|
32991
32999
|
r2.beginFill(16777215), r2.drawRect(0, 0, t2.width, t2.height), r2.endFill(), this.container.addChild(r2);
|
|
32992
33000
|
}
|
|
@@ -35737,9 +35745,9 @@ void main(void){
|
|
|
35737
35745
|
}
|
|
35738
35746
|
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
35747
|
try {
|
|
35740
|
-
cT = "1.0.1
|
|
35748
|
+
cT = "1.0.1";
|
|
35741
35749
|
} catch (t2) {
|
|
35742
|
-
cT = "
|
|
35750
|
+
cT = "dev";
|
|
35743
35751
|
}
|
|
35744
35752
|
var dT = null;
|
|
35745
35753
|
try {
|
|
@@ -35844,7 +35852,7 @@ void main(void){
|
|
|
35844
35852
|
e2.appendLogString("ERROR - " + new Date().toISOString() + " - {" + n3.randomId + "}[" + i4 + "] " + t3 + "\n");
|
|
35845
35853
|
var o2 = (r2 = n3.config.logger) === null || r2 === void 0 ? void 0 : r2.error;
|
|
35846
35854
|
o2 && o2("[" + i4 + "] " + t3);
|
|
35847
|
-
} }, n3.logger.info("new slide with clientId: " + n3.config.clientId, n3.taskId), n3.anchor = n3.config.anchor, n3.syncQueue = new Zb(n3.receiveSyncHandler), n3.lock = new Jb(n3.mode === "interactive"), n3.cacheImage.style.position = "absolute", n3.cacheImage.style.zIndex = "100", n3.setMedianControllerAttribute(), n3.canvasContainer.style.position = "relative", n3.canvasContainer.style.fontSize = "0", n3.canvasContainer.appendChild(n3.medianController), n3.frame.appendChild(n3.canvasContainer), n3.frameResizeObserver.observe(n3.frame), n3.on(hT.syncReceive, function(t3) {
|
|
35855
|
+
} }, n3.logger.info("new slide with clientId: " + n3.config.clientId + ", version: " + n3.version, n3.taskId), n3.anchor = n3.config.anchor, n3.syncQueue = new Zb(n3.receiveSyncHandler), n3.lock = new Jb(n3.mode === "interactive"), n3.cacheImage.style.position = "absolute", n3.cacheImage.style.zIndex = "100", n3.setMedianControllerAttribute(), n3.canvasContainer.style.position = "relative", n3.canvasContainer.style.fontSize = "0", n3.canvasContainer.appendChild(n3.medianController), n3.frame.appendChild(n3.canvasContainer), n3.frameResizeObserver.observe(n3.frame), n3.on(hT.syncReceive, function(t3) {
|
|
35848
35856
|
n3.lock.unlock(t3.type, t3.uuid), n3.syncQueue.addTask(t3);
|
|
35849
35857
|
}), n3.renderingTaskManager.eventHub.on("task-error", function(t3) {
|
|
35850
35858
|
var e3 = t3.error, i4 = t3.task, r2 = Tm.transform(e3);
|
|
@@ -38031,7 +38039,7 @@ if (runningOnBrowser) {
|
|
|
38031
38039
|
autoInitialize(LazyLoad, window.lazyLoadOptions);
|
|
38032
38040
|
}
|
|
38033
38041
|
class DocsViewer {
|
|
38034
|
-
constructor({ readonly, onNewPageIndex, onPlay }) {
|
|
38042
|
+
constructor({ readonly, onNewPageIndex, onPlay, urlInterrupter }) {
|
|
38035
38043
|
this._pages = [];
|
|
38036
38044
|
this.pageIndex = 0;
|
|
38037
38045
|
this.setPaused = () => {
|
|
@@ -38047,13 +38055,13 @@ class DocsViewer {
|
|
|
38047
38055
|
this.readonly = readonly;
|
|
38048
38056
|
this.onNewPageIndex = onNewPageIndex;
|
|
38049
38057
|
this.onPlay = onPlay;
|
|
38058
|
+
this.urlInterrupter = urlInterrupter || ((url) => url);
|
|
38050
38059
|
this.render();
|
|
38051
38060
|
}
|
|
38052
38061
|
set pages(value) {
|
|
38053
38062
|
this._pages = value;
|
|
38054
|
-
this.refreshPreview();
|
|
38063
|
+
this.refreshPreview().then(this.refreshBtnSidebar.bind(this));
|
|
38055
38064
|
this.refreshTotalPage();
|
|
38056
|
-
this.refreshBtnSidebar();
|
|
38057
38065
|
}
|
|
38058
38066
|
get pages() {
|
|
38059
38067
|
return this._pages;
|
|
@@ -38134,17 +38142,27 @@ class DocsViewer {
|
|
|
38134
38142
|
}
|
|
38135
38143
|
return this.$preview;
|
|
38136
38144
|
}
|
|
38137
|
-
refreshPreview() {
|
|
38138
|
-
var _a;
|
|
38145
|
+
async refreshPreview() {
|
|
38146
|
+
var _a, _b;
|
|
38139
38147
|
const { $preview } = this;
|
|
38140
38148
|
const pageClassName = this.wrapClassName("preview-page");
|
|
38141
38149
|
const pageNameClassName = this.wrapClassName("preview-page-name");
|
|
38142
38150
|
while ($preview.firstChild) {
|
|
38143
38151
|
$preview.firstChild.remove();
|
|
38144
38152
|
}
|
|
38153
|
+
const previewSRCs = [];
|
|
38154
|
+
for (let i = 0, len = this.pages.length; i < len; i++) {
|
|
38155
|
+
const page = this.pages[i];
|
|
38156
|
+
const src = (_a = page.thumbnail) != null ? _a : page.src.startsWith("ppt") ? void 0 : page.src;
|
|
38157
|
+
if (src) {
|
|
38158
|
+
previewSRCs[i] = this.urlInterrupter(src);
|
|
38159
|
+
}
|
|
38160
|
+
}
|
|
38161
|
+
for (let i = 0, len = this.pages.length; i < len; i++) {
|
|
38162
|
+
previewSRCs[i] = await previewSRCs[i];
|
|
38163
|
+
}
|
|
38145
38164
|
this.pages.forEach((page, i) => {
|
|
38146
|
-
|
|
38147
|
-
const previewSRC = (_a2 = page.thumbnail) != null ? _a2 : page.src.startsWith("ppt") ? void 0 : page.src;
|
|
38165
|
+
const previewSRC = previewSRCs[i];
|
|
38148
38166
|
if (!previewSRC) {
|
|
38149
38167
|
return;
|
|
38150
38168
|
}
|
|
@@ -38166,7 +38184,7 @@ class DocsViewer {
|
|
|
38166
38184
|
$page.appendChild($name);
|
|
38167
38185
|
$preview.appendChild($page);
|
|
38168
38186
|
});
|
|
38169
|
-
(
|
|
38187
|
+
(_b = this.previewLazyLoad) == null ? void 0 : _b.update();
|
|
38170
38188
|
}
|
|
38171
38189
|
renderPreviewMask() {
|
|
38172
38190
|
if (!this.$previewMask) {
|
|
@@ -38305,7 +38323,8 @@ class SlideDocsViewer {
|
|
|
38305
38323
|
mountSlideController,
|
|
38306
38324
|
mountWhiteboard,
|
|
38307
38325
|
baseScenePath,
|
|
38308
|
-
appId
|
|
38326
|
+
appId,
|
|
38327
|
+
urlInterrupter
|
|
38309
38328
|
}) {
|
|
38310
38329
|
this.slideController = null;
|
|
38311
38330
|
this.isViewMounted = false;
|
|
@@ -38454,7 +38473,8 @@ class SlideDocsViewer {
|
|
|
38454
38473
|
this.viewer = new DocsViewer({
|
|
38455
38474
|
readonly: box.readonly,
|
|
38456
38475
|
onNewPageIndex: this.onNewPageIndex,
|
|
38457
|
-
onPlay: this.onPlay
|
|
38476
|
+
onPlay: this.onPlay,
|
|
38477
|
+
urlInterrupter
|
|
38458
38478
|
});
|
|
38459
38479
|
this.sideEffect.add(() => {
|
|
38460
38480
|
const handler = (readonly) => {
|
|
@@ -38822,10 +38842,11 @@ class SlidePreviewer {
|
|
|
38822
38842
|
}
|
|
38823
38843
|
}
|
|
38824
38844
|
const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
|
|
38825
|
-
const version = "0.2.
|
|
38845
|
+
const version = "0.2.36";
|
|
38826
38846
|
const SlideApp = {
|
|
38827
38847
|
kind: "Slide",
|
|
38828
38848
|
setup(context) {
|
|
38849
|
+
var _a;
|
|
38829
38850
|
console.log("[Slide] setup @ " + version);
|
|
38830
38851
|
if (context.getIsWritable()) {
|
|
38831
38852
|
context.storage.ensureState(EmptyAttributes);
|
|
@@ -38889,14 +38910,15 @@ const SlideApp = {
|
|
|
38889
38910
|
mountSlideController,
|
|
38890
38911
|
mountWhiteboard: context.mountView.bind(context),
|
|
38891
38912
|
baseScenePath,
|
|
38892
|
-
appId: context.appId
|
|
38913
|
+
appId: context.appId,
|
|
38914
|
+
urlInterrupter: (_a = context.getAppOptions()) == null ? void 0 : _a.urlInterrupter
|
|
38893
38915
|
});
|
|
38894
38916
|
const room = context.getRoom();
|
|
38895
38917
|
const sideEffect = new SideEffectManager();
|
|
38896
38918
|
sideEffect.add(() => {
|
|
38897
|
-
var
|
|
38919
|
+
var _a2;
|
|
38898
38920
|
logger.setAppContext(context.appId, context);
|
|
38899
|
-
logger.enable = ((
|
|
38921
|
+
logger.enable = ((_a2 = context.getAppOptions()) == null ? void 0 : _a2.debug) || false;
|
|
38900
38922
|
logger.level = "debug";
|
|
38901
38923
|
return () => logger.deleteApp(context.appId);
|
|
38902
38924
|
});
|
|
@@ -38931,21 +38953,21 @@ const SlideApp = {
|
|
|
38931
38953
|
return docsViewer == null ? void 0 : docsViewer.slideController;
|
|
38932
38954
|
},
|
|
38933
38955
|
slide: () => {
|
|
38934
|
-
var
|
|
38935
|
-
return (
|
|
38956
|
+
var _a2;
|
|
38957
|
+
return (_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide;
|
|
38936
38958
|
},
|
|
38937
38959
|
nextStep: () => {
|
|
38938
|
-
var
|
|
38960
|
+
var _a2;
|
|
38939
38961
|
if (docsViewer && docsViewer.slideController) {
|
|
38940
|
-
(
|
|
38962
|
+
(_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide.nextStep();
|
|
38941
38963
|
return true;
|
|
38942
38964
|
}
|
|
38943
38965
|
return false;
|
|
38944
38966
|
},
|
|
38945
38967
|
prevStep: () => {
|
|
38946
|
-
var
|
|
38968
|
+
var _a2;
|
|
38947
38969
|
if (docsViewer && docsViewer.slideController) {
|
|
38948
|
-
(
|
|
38970
|
+
(_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide.prevStep();
|
|
38949
38971
|
return true;
|
|
38950
38972
|
}
|
|
38951
38973
|
return false;
|