@getflip/swirl-components 0.174.0 → 0.174.2

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/components.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2024-03-21T15:12:17",
2
+ "timestamp": "2024-03-22T10:43:45",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "3.3.1",
@@ -29886,11 +29886,14 @@ const SwirlFileViewerPdf = class {
29886
29886
  }
29887
29887
  async componentWillLoad() {
29888
29888
  window.pdf.GlobalWorkerOptions.workerSrc = this.workerSrc;
29889
- await this.getPages();
29890
29889
  }
29891
29890
  async componentDidLoad() {
29891
+ await this.getPages();
29892
29892
  await this.updateVisiblePages();
29893
29893
  this.activate.emit(this.el);
29894
+ }
29895
+ componentDidRender() {
29896
+ this.updateVisiblePages();
29894
29897
  this.determineScrollStatus();
29895
29898
  }
29896
29899
  disconnectedCallback() {
@@ -29982,10 +29985,11 @@ const SwirlFileViewerPdf = class {
29982
29985
  this.doc.destroy();
29983
29986
  }
29984
29987
  this.doc = await pdf.getDocument(this.file).promise;
29988
+ const pages = [];
29985
29989
  for (let i = 1; i <= this.doc.numPages; i++) {
29986
- const page = await this.doc.getPage(i);
29987
- this.pages[i] = page;
29990
+ pages.push(this.doc.getPage(i));
29988
29991
  }
29992
+ this.pages = await Promise.all(pages);
29989
29993
  this.loading = false;
29990
29994
  }
29991
29995
  catch (e) {
@@ -14,7 +14,6 @@ const SwirlLightbox = class {
14
14
  constructor(hostRef) {
15
15
  index.registerInstance(this, hostRef);
16
16
  this.dragging = false;
17
- this.mediaPlayers = [];
18
17
  this.onCloseButtonClick = () => {
19
18
  this.close();
20
19
  };
@@ -31,7 +30,6 @@ const SwirlLightbox = class {
31
30
  this.registerSlides = () => {
32
31
  this.slides = Array.from(this.el.children).filter((el) => el.tagName === "SWIRL-FILE-VIEWER");
33
32
  this.setSlideAttributes();
34
- this.updateMediaPlayers();
35
33
  };
36
34
  this.onPointerDown = (event) => {
37
35
  this.dragging = true;
@@ -186,7 +184,6 @@ const SwirlLightbox = class {
186
184
  });
187
185
  }, 300);
188
186
  this.stopAllMediaPlayers();
189
- this.updateMediaPlayers();
190
187
  this.resetImageZoom();
191
188
  }
192
189
  setSlideAttributes() {
@@ -217,12 +214,12 @@ const SwirlLightbox = class {
217
214
  unlockBodyScroll() {
218
215
  bodyScrollLock_esm.enableBodyScroll(this.el);
219
216
  }
220
- updateMediaPlayers() {
217
+ getMediaPlayers() {
221
218
  const mediaPlayers = utils.querySelectorAllDeep(this.el, "video");
222
- this.mediaPlayers = mediaPlayers;
219
+ return mediaPlayers;
223
220
  }
224
221
  stopAllMediaPlayers() {
225
- this.mediaPlayers.forEach((mediaPlayer) => mediaPlayer.pause());
222
+ this.getMediaPlayers().forEach((mediaPlayer) => mediaPlayer.pause());
226
223
  }
227
224
  resetImageZoom() {
228
225
  this.slides.forEach((slide) => {