@netless/app-slide 0.3.0-canary.7 → 0.3.0-canary.8

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.
@@ -395,6 +395,7 @@ export class SlideViewer {
395
395
  readonly footer = create_footer();
396
396
  readonly $content: HTMLElement;
397
397
  readonly $footer: HTMLElement;
398
+ readonly $overlay: HTMLElement;
398
399
 
399
400
  readonly slide;
400
401
 
@@ -408,6 +409,9 @@ export class SlideViewer {
408
409
  this.$content = this.sidebar.$content;
409
410
  this.$footer = this.footer.$footer;
410
411
  append(this.$content, this.$slide);
412
+ this.$overlay = h("div");
413
+ set_class(this.$overlay, "overlay");
414
+ append(this.$content, this.$overlay);
411
415
 
412
416
  let resolveReady: () => void;
413
417
  this._readyPromise = new Promise(resolve => {
@@ -474,11 +478,23 @@ export class SlideViewer {
474
478
  });
475
479
 
476
480
  this.slide.on("renderEnd", () => {
477
- if (!this._ready)
481
+ if (!this._ready) {
478
482
  setTimeout(() => {
479
483
  this._ready = true;
480
484
  resolveReady();
481
485
  }, 1000);
486
+ } else {
487
+ this.$overlay.style.opacity = "";
488
+ }
489
+ });
490
+
491
+ this.slide.on("renderError", ({ error, index }) => {
492
+ if (this._destroyed) return;
493
+ if (error) {
494
+ console.error(error);
495
+ this.$overlay.textContent = `Error on slide[index=${index}]: ${error.message}`;
496
+ this.$overlay.style.opacity = "1";
497
+ }
482
498
  });
483
499
 
484
500
  const fetching = fetch_slide_info(options).then(({ preview, slide }) => {
package/src/style.scss CHANGED
@@ -101,6 +101,22 @@ $namespace: "netless-app-slide";
101
101
  @include no-user-select;
102
102
  }
103
103
 
104
+ .#{$namespace}-overlay {
105
+ display: flex;
106
+ align-items: center;
107
+ justify-content: center;
108
+ position: absolute;
109
+ z-index: 10100;
110
+ top: 0;
111
+ left: 0;
112
+ width: 100%;
113
+ height: 100%;
114
+ background: rgba(255, 0, 0, 0.25);
115
+ transition: opacity 0.3s;
116
+ opacity: 0;
117
+ pointer-events: none;
118
+ }
119
+
104
120
  .#{$namespace}-footer {
105
121
  box-sizing: border-box;
106
122
  height: 26px;