@netless/app-slide 0.2.13 → 0.2.15

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/main.es.js CHANGED
@@ -30518,6 +30518,8 @@ class DocsViewer {
30518
30518
  this.$pageNumberInput.disabled = readonly;
30519
30519
  }
30520
30520
  destroy() {
30521
+ var _a;
30522
+ (_a = this.previewLazyLoad) == null ? void 0 : _a.destroy();
30521
30523
  this.sideEffect.flushAll();
30522
30524
  this.unmount();
30523
30525
  }
@@ -30563,16 +30565,6 @@ class DocsViewer {
30563
30565
  const $preview = document.createElement("div");
30564
30566
  $preview.className = this.wrapClassName("preview") + " tele-fancy-scrollbar";
30565
30567
  this.$preview = $preview;
30566
- this.sideEffect.add(() => {
30567
- this.previewLazyLoad = new LazyLoad({
30568
- container: this.$preview,
30569
- elements_selector: `.${this.wrapClassName("preview-page>img")}`
30570
- });
30571
- return () => {
30572
- var _a;
30573
- return (_a = this.previewLazyLoad) == null ? void 0 : _a.destroy();
30574
- };
30575
- });
30576
30568
  this.refreshPreview();
30577
30569
  this.sideEffect.addEventListener($preview, "click", (ev) => {
30578
30570
  var _a;
@@ -30740,6 +30732,10 @@ class DocsViewer {
30740
30732
  if (this.isShowPreview) {
30741
30733
  const $previewPage = this.$preview.querySelector("." + this.wrapClassName(`preview-page-${this.pageIndex}`));
30742
30734
  if ($previewPage) {
30735
+ this.previewLazyLoad || (this.previewLazyLoad = new LazyLoad({
30736
+ container: this.$preview,
30737
+ elements_selector: `.${this.wrapClassName("preview-page>img")}`
30738
+ }));
30743
30739
  this.$preview.scrollTo({
30744
30740
  top: $previewPage.offsetTop - 16
30745
30741
  });
@@ -30926,8 +30922,15 @@ const inspect = (arr) => {
30926
30922
  };
30927
30923
  const apps = {
30928
30924
  map: /* @__PURE__ */ new Map(),
30925
+ boxes: /* @__PURE__ */ new Map(),
30929
30926
  queue: [],
30930
30927
  validateQueue() {
30928
+ this.queue.sort((a, b) => {
30929
+ var _a, _b, _c, _d;
30930
+ const za = (_b = (_a = this.boxes.get(a)) == null ? void 0 : _a.zIndex) != null ? _b : 0;
30931
+ const zb = (_d = (_c = this.boxes.get(b)) == null ? void 0 : _c.zIndex) != null ? _d : 0;
30932
+ return -(za - zb);
30933
+ });
30931
30934
  log("[Slide] freezer: validate", inspect(this.queue));
30932
30935
  while (this.queue.length > FreezerLength) {
30933
30936
  const appId = this.queue.pop();
@@ -30938,9 +30941,10 @@ const apps = {
30938
30941
  }
30939
30942
  }
30940
30943
  },
30941
- set(appId, slide) {
30944
+ set(appId, slide, box) {
30942
30945
  log("[Slide] freezer: add", appId, inspect(this.queue));
30943
30946
  this.map.set(appId, slide);
30947
+ this.boxes.set(appId, box);
30944
30948
  if (!this.queue.includes(appId)) {
30945
30949
  this.queue.unshift(appId);
30946
30950
  }
@@ -30948,6 +30952,7 @@ const apps = {
30948
30952
  },
30949
30953
  delete(appId) {
30950
30954
  this.map.delete(appId);
30955
+ this.boxes.delete(appId);
30951
30956
  this.queue = this.queue.filter((id) => id !== appId);
30952
30957
  log("[Slide] freezer: delete", appId, inspect(this.queue));
30953
30958
  },
@@ -31127,7 +31132,7 @@ class SlidePreviewer {
31127
31132
  }
31128
31133
  }
31129
31134
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
31130
- const version = "0.2.13";
31135
+ const version = "0.2.15";
31131
31136
  const SlideApp = {
31132
31137
  kind: "Slide",
31133
31138
  setup(context) {
@@ -31170,7 +31175,7 @@ const SlideApp = {
31170
31175
  onPageChanged
31171
31176
  }));
31172
31177
  if (useFreezer)
31173
- apps.set(context.appId, slideController);
31178
+ apps.set(context.appId, slideController, box);
31174
31179
  logger.setAppController(context.appId, slideController);
31175
31180
  slideController.readyPromise.then(options.onReady).then(() => {
31176
31181
  const room2 = context.getRoom();