@getflip/swirl-components 0.234.0 → 0.235.0

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-09-05T11:06:49",
2
+ "timestamp": "2024-09-05T13:42:07",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.18.1",
@@ -49,6 +49,9 @@ const SwirlLightbox = class {
49
49
  this.setSlideAttributes();
50
50
  };
51
51
  this.onPointerDown = (event) => {
52
+ if (this.slides.length <= 1) {
53
+ return;
54
+ }
52
55
  this.dragging = true;
53
56
  this.dragStartPosition =
54
57
  event instanceof MouseEvent ? event.clientX : event.touches[0].clientX;
@@ -57,6 +60,9 @@ const SwirlLightbox = class {
57
60
  });
58
61
  };
59
62
  this.onPointerMove = async (event) => {
63
+ if (!this.dragging) {
64
+ return;
65
+ }
60
66
  const isMultiTouch = !(event instanceof MouseEvent) && event.touches.length > 1;
61
67
  const imageViewer = this.slides[this.activeSlideIndex]?.shadowRoot?.querySelector("swirl-file-viewer-image");
62
68
  const showsZoomedImage = Boolean(imageViewer)
@@ -65,19 +71,20 @@ const SwirlLightbox = class {
65
71
  if (isMultiTouch || showsZoomedImage) {
66
72
  return;
67
73
  }
68
- if (this.dragging) {
69
- event.preventDefault();
70
- const deltaX = event instanceof MouseEvent
71
- ? event.clientX - this.dragStartPosition
72
- : event.touches[0].clientX - this.dragStartPosition;
73
- this.slides.forEach((slide) => {
74
- const pixelOffset = this.activeSlideIndex * slide.getBoundingClientRect().width;
75
- this.dragDelta = deltaX;
76
- slide.style.transform = `translate3d(${(-pixelOffset + this.dragDelta) / 16}rem, 0, 0)`;
77
- });
78
- }
74
+ event.preventDefault();
75
+ const deltaX = event instanceof MouseEvent
76
+ ? event.clientX - this.dragStartPosition
77
+ : event.touches[0].clientX - this.dragStartPosition;
78
+ this.slides.forEach((slide) => {
79
+ const pixelOffset = this.activeSlideIndex * slide.getBoundingClientRect().width;
80
+ this.dragDelta = deltaX;
81
+ slide.style.transform = `translate3d(${(-pixelOffset + this.dragDelta) / 16}rem, 0, 0)`;
82
+ });
79
83
  };
80
84
  this.onPointerUp = () => {
85
+ if (!this.dragging) {
86
+ return;
87
+ }
81
88
  this.dragging = false;
82
89
  this.dragStartPosition = undefined;
83
90
  const dragRatio = this.dragDelta /
@@ -268,7 +275,7 @@ const SwirlLightbox = class {
268
275
  "lightbox--hide-menu": !hasMenuItems,
269
276
  "lightbox--hide-toolbar": !hasToolbar,
270
277
  });
271
- return (index.h(index.Host, { key: 'f2734a2e6af04f6a0370239aaf4b21381feba736', onKeydown: this.onKeyDown }, index.h("section", { key: '1281d13e171b5aa7b9a6e232485ab93669eef88e', "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, id: "lightbox", onMouseDown: this.onPointerDown, onMouseMove: this.onPointerMove, onMouseOut: this.onPointerUp, onMouseUp: this.onPointerUp, onTouchEnd: this.onPointerUp, onTouchMove: this.onPointerMove, onTouchStart: this.onPointerDown, ref: (el) => (this.modalEl = el), role: "dialog", tabIndex: this.isOpen ? 0 : -1 }, index.h("div", { key: 'b00258b8d9355d8bd4f19a95a5b7b92178635836', class: "lightbox__body", role: "document" }, index.h("header", { key: 'd1b532fb01f67d1d1cc5b59aaedb3f2099404bf4', class: "lightbox__header" }, index.h("button", { key: '9121d75f19313e6f5837a4e1db56ab516159ca11', "aria-label": this.closeButtonLabel, class: "lightbox__close-button", onClick: this.onCloseButtonClick }, index.h("swirl-icon-close", { key: 'c8261f1daa32b9a70fb2d81d897af67bf92866ac' })), index.h("div", { key: 'caf01d916093c56b3807bb62a8188d3cee211742', class: "lightbox__toolbar" }, index.h("slot", { key: '1cf08e386c6f6aedd6e2cd3ade3f7bb470d6765b', name: "toolbar" })), !this.hideMenu && (index.h("swirl-popover-trigger", { key: 'c4f95f7db960e96867d0a3b133813c9aa47ff483', swirlPopover: this.menu }, index.h("button", { key: 'dd24311fd414aacb76fb40acdf17633947aaa2d4', "aria-label": this.menuTriggerLabel, class: "lightbox__menu-button" }, index.h("swirl-icon-more-vertikal", { key: 'e8931b30cecdadc74d47394656e48db207020c96' }))))), index.h("div", { key: '2e1a1d0a63e6bea8e49fbb3c642e952a0ab166a6', "aria-roledescription": "carousel", class: "lightbox__content", role: "group" }, index.h("div", { key: 'c1ac931d24c3bfdc6a0fc8aceaa1a5da8ab0c4c8', "aria-atomic": "false", "aria-live": "polite", class: "lightbox__slides", onClick: this.onBackdropClick, onContextMenu: this.onContextMenu, ref: (el) => (this.slidesContainer = el) }, index.h("slot", { key: 'ff0a0e673778e0d482938784c132cf1fc81abb1d', onSlotchange: this.registerSlides }))), index.h("div", { key: 'ab9975a3ef9fc5a19a7767b20aa240059896219e', class: "lightbox__controls" }, index.h("button", { key: '8dd71b3f4e0bce3b3fcd570aeb67d0021a70419b', "aria-label": this.previousSlideButtonLabel, class: "lightbox__previous-slide-button", disabled: this.activeSlideIndex === 0, onClick: this.onPreviousSlideClick }, index.h("swirl-icon-arrow-left", { key: 'ad7b0c13c10b2f52aff2dbdeb881cbccd2e37dfa' })), index.h("button", { key: 'c7042244acc8a6e20ac7ae864ef2cb9c6be58bcb', "aria-label": this.nextSlideButtonLabel, class: "lightbox__next-slide-button", disabled: this.activeSlideIndex === this.slides.length - 1, onClick: this.onNextSlideClick }, index.h("swirl-icon-arrow-right", { key: '6f4388d53e0ddea5c9db1f11334c4462a0d5abad' }))), showPagination && (index.h("span", { key: '136f67a9019c60d59c18a3b633fb38dcadca6f10', class: "lightbox__pagination" }, index.h("span", { key: '290cd52650146855367ad0dab4bfbc4ee9289fcc', "aria-current": "page" }, this.activeSlideIndex + 1), " /", " ", this.slides.length))), !this.hideMenu && (index.h("swirl-popover", { key: 'fd7f8aaf55c89cd750031f5b12ae466826ac998a', animation: "scale-in-y", disableScrollLock: true, id: "slide-menu", label: this.menuLabel, placement: "bottom-end", ref: (el) => (this.menu = el) }, index.h("swirl-stack", { key: 'e325ae6944941095aede8855151b0561e9276625' }, index.h("div", { key: 'eec5dbc6d403464a213366aae3924dd620a488ad', class: "lightbox__meta" }, currentThumbnailUrl && (index.h("div", { key: '42e6f5045d0c05a4b65edc7c46d75c8ff7760d9b', class: "lightbox__thumbnail" }, index.h("swirl-thumbnail", { key: 'a3de4b5d24c4c1b5670f188d00412f40026d538d', alt: "", src: currentThumbnailUrl }))), index.h("div", { key: 'af5e69c850511b42c12928bf24931fc87e7f80cf', class: "lightbox__file-info" }, index.h("swirl-text", { key: '94052b82b830773a8d3b391db01deeb5e7538684', truncate: true, weight: "semibold" }, currentFileName), index.h("swirl-text", { key: '8bf3325f2873669a15bdc9235cc207c641be503a', color: "subdued", size: "sm", truncate: true }, currentFileType))), hasMenuItems && index.h("swirl-separator", { key: 'f67ba2c8d5cadefba4e1ec0b1544e5af7738e009' }), index.h("swirl-action-list", { key: 'a36865865808d3b620996c499e1abf5e51e02838' }, this.downloadButtonEnabled && (index.h("swirl-action-list-item", { key: 'de66ba749597ab23425465ec0577f80dd752cc33', icon: "<swirl-icon-download></swirl-icon-download>", label: this.downloadButtonLabel, onClick: this.onDownloadButtonClick })), index.h("slot", { key: 'd028960cce8e411b603fa7aac90973c4b2f30b7f', name: "menu-items" }))))))));
278
+ return (index.h(index.Host, { key: '711c0392474fa14a7fac934bac030614277b00bb', onKeydown: this.onKeyDown }, index.h("section", { key: 'c7a1346ba3f62fcb9ffa548cafe9863fea547abf', "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, id: "lightbox", onMouseDown: this.onPointerDown, onMouseMove: this.onPointerMove, onMouseOut: this.onPointerUp, onMouseUp: this.onPointerUp, onTouchEnd: this.onPointerUp, onTouchMove: this.onPointerMove, onTouchStart: this.onPointerDown, ref: (el) => (this.modalEl = el), role: "dialog", tabIndex: this.isOpen ? 0 : -1 }, index.h("div", { key: '693d8618fa2160a65c92752f1905bc1dcec916d0', class: "lightbox__body", role: "document" }, index.h("header", { key: '4ebbd00119a77c104f00bf5ecac020af03ea389c', class: "lightbox__header" }, index.h("button", { key: '56a6a0f54ff17b609af4edd0e5923b1155f2fa6e', "aria-label": this.closeButtonLabel, class: "lightbox__close-button", onClick: this.onCloseButtonClick }, index.h("swirl-icon-close", { key: '0816497d2f8012e860146c6a8494edde9bc834d2' })), index.h("div", { key: '4c22c991a5f8f1f6b691d4f9b1e08c6d30b45569', class: "lightbox__toolbar" }, index.h("slot", { key: '1891cad14a36356781d4a048cff42a650bffb214', name: "toolbar" })), !this.hideMenu && (index.h("swirl-popover-trigger", { key: '371d1f3dea6b3264e3192b6f7dc6336efb1a2284', swirlPopover: this.menu }, index.h("button", { key: '73b7f96f9fc510c0e6dfeea714681c7ba71539d4', "aria-label": this.menuTriggerLabel, class: "lightbox__menu-button" }, index.h("swirl-icon-more-vertikal", { key: 'a8eeb497a471968a5c00bf69e5acdf513f3f84d6' }))))), index.h("div", { key: 'b6ea4cfdd22f2e3137c971d541dc0e20e51a17fa', "aria-roledescription": "carousel", class: "lightbox__content", role: "group" }, index.h("div", { key: '14f010e3ff24ff158f280680f86afd14039edbd7', "aria-atomic": "false", "aria-live": "polite", class: "lightbox__slides", onClick: this.onBackdropClick, onContextMenu: this.onContextMenu, ref: (el) => (this.slidesContainer = el) }, index.h("slot", { key: 'efeec16ff88ff1f58d3e8c56f4f16290f3ec08f8', onSlotchange: this.registerSlides }))), index.h("div", { key: 'd2178f1d694ef3e41960872a920157337c455e1e', class: "lightbox__controls" }, index.h("button", { key: '583737358a6018e3fb694da1e89ddd0f0456dc69', "aria-label": this.previousSlideButtonLabel, class: "lightbox__previous-slide-button", disabled: this.activeSlideIndex === 0, onClick: this.onPreviousSlideClick }, index.h("swirl-icon-arrow-left", { key: '5b3c53f7c3de10df0bc450efeac73b0d3ba1a055' })), index.h("button", { key: 'dad26a76dbf5321a3a121a0f00ada47ef96f89a4', "aria-label": this.nextSlideButtonLabel, class: "lightbox__next-slide-button", disabled: this.activeSlideIndex === this.slides.length - 1, onClick: this.onNextSlideClick }, index.h("swirl-icon-arrow-right", { key: '2a3e12886335250986ba13b27c526890cc61c9ef' }))), showPagination && (index.h("span", { key: '6dc3eb07c58459904cebc3c55b1a3ea61d04b7f9', class: "lightbox__pagination" }, index.h("span", { key: 'cc9efa1750bac95f556619b87b9ad530364ddf29', "aria-current": "page" }, this.activeSlideIndex + 1), " /", " ", this.slides.length))), !this.hideMenu && (index.h("swirl-popover", { key: '8e9909d8f4ecba8dfa143657685376a9c4d23647', animation: "scale-in-y", disableScrollLock: true, id: "slide-menu", label: this.menuLabel, placement: "bottom-end", ref: (el) => (this.menu = el) }, index.h("swirl-stack", { key: '86e96e34f5bfd024f21ad20cb5533702c0b87a75' }, index.h("div", { key: '0ba6335bf5b625fef945a03f3d30229dcbb4d9fe', class: "lightbox__meta" }, currentThumbnailUrl && (index.h("div", { key: '0cc28e6a455db3f9e3b5b38b500e2e9d4e4be105', class: "lightbox__thumbnail" }, index.h("swirl-thumbnail", { key: '1994f956fa046cf197ff519416792ecfc27c25cb', alt: "", src: currentThumbnailUrl }))), index.h("div", { key: '9ed5a72ff591a77835bf8ddc7cf905c73fb6d4ee', class: "lightbox__file-info" }, index.h("swirl-text", { key: '5d404ac3bfcae7933ee21c996c0df458476e42c3', truncate: true, weight: "semibold" }, currentFileName), index.h("swirl-text", { key: '58f21622b74914fc2523bfa7d34c171cba96fdd9', color: "subdued", size: "sm", truncate: true }, currentFileType))), hasMenuItems && index.h("swirl-separator", { key: '975065e045ecd021ad2f196be3f05e4a9f94ee7f' }), index.h("swirl-action-list", { key: 'fb09c171d08e50f688fa6c3f60cbbd23e83cb709' }, this.downloadButtonEnabled && (index.h("swirl-action-list-item", { key: 'c3576a179fb57f9f3115234d6a757a0dc58b3ee8', icon: "<swirl-icon-download></swirl-icon-download>", label: this.downloadButtonLabel, onClick: this.onDownloadButtonClick })), index.h("slot", { key: '438269a75c8c02c58c329bce89651d170d2ccedd', name: "menu-items" }))))))));
272
279
  }
273
280
  get el() { return index.getElement(this); }
274
281
  static get watchers() { return {
@@ -43,10 +43,16 @@ const SwirlTreeViewItem = class {
43
43
  this.hasChildren = Boolean(this.el.querySelector("swirl-tree-view-item"));
44
44
  }
45
45
  async expand() {
46
+ if (this.expanded) {
47
+ return;
48
+ }
46
49
  this.expanded = true;
47
50
  this.expandedChange.emit(this.expanded);
48
51
  }
49
52
  async collapse() {
53
+ if (!this.expanded) {
54
+ return;
55
+ }
50
56
  this.expanded = false;
51
57
  this.expandedChange.emit(this.expanded);
52
58
  }
@@ -74,11 +80,11 @@ const SwirlTreeViewItem = class {
74
80
  "tree-view-item--active": this.active,
75
81
  "tree-view-item--has-tags": hasTags,
76
82
  });
77
- return (index.h(index.Host, { key: '3bef1ae67a6b69390a3b541303d2cb0a5b4b0572', id: this.itemId, role: "none" }, index.h("li", { key: '76f801f429af865e5564d1a6de6beafc8ff091fc', class: className, role: "none" }, index.h("a", { key: '1fddde54d88f7de5e3d940e7a8f6b6df38428de0', "aria-current": this.active ? "page" : undefined, "aria-expanded": !this.hasChildren ? undefined : String(this.expanded), "aria-level": this.level + 1, "aria-owns": this.hasChildren ? `${this.itemId}-children` : undefined, "aria-selected": String(this.selected), class: "tree-view-item__link", href: this.href, onFocus: this.onFocus, style: {
83
+ return (index.h(index.Host, { key: 'a350471e6d4a63098c22ac8856fb642bef79a8e4', id: this.itemId, role: "none" }, index.h("li", { key: '6485eca3fa6bc73bc6d849946d3cd3f8447c1f96', class: className, role: "none" }, index.h("a", { key: '523ccc5dc330ef55bbde7d7fc6175095265500cd', "aria-current": this.active ? "page" : undefined, "aria-expanded": !this.hasChildren ? undefined : String(this.expanded), "aria-level": this.level + 1, "aria-owns": this.hasChildren ? `${this.itemId}-children` : undefined, "aria-selected": String(this.selected), class: "tree-view-item__link", href: this.href, onFocus: this.onFocus, style: {
78
84
  paddingLeft: `calc(${this.level} * var(--s-space-12) + var(--s-space-4))`,
79
- }, ref: (el) => (this.link = el), role: "treeitem", tabIndex: this.selected ? 0 : -1 }, index.h("span", { key: '4dc36fa94d7831a45986440e777a6e2ee9e64558', class: "tree-view-item__toggle-icon" }, this.hasChildren && (index.h(index.Fragment, { key: '0771bc5940d86bb482e71671adef637e52f031e2' }, this.expanded ? (index.h("swirl-icon-expand-more", { onClick: this.onClickCollapse, size: 24 })) : (index.h("swirl-icon-chevron-right", { onClick: this.onClickExpand, size: 24 }))))), Boolean(this.icon) && (index.h(index.Fragment, { key: 'fdd19fe265b067318bf6447504474cbfea067a3e' }, index.h("span", { key: '006b75550b8a438a64b920a24cc3a65b1e710574', class: "tree-view-item__icon" }, iconIsEmoji ? (this.icon) : (index.h("swirl-icon", { glyph: this.icon, size: 24 }))))), index.h("span", { key: '5968fe73fcaeec498a00a08dd809feafc97924dd', class: "tree-view-item__label" }, this.label), index.h("span", { key: 'c5c12f44f3d93fc9f4ac85487454fc900de708ff', class: "tree-view-item__tags" }, index.h("slot", { key: '0731b78236892a2da887153fd58a6ee2386477ca', name: "tags" }))), index.h("ul", { key: '1198cb06161c4667c853dc14df3d5363500d72e7', "aria-label": this.label, class: "tree-view-item__children", id: `${this.itemId}-children`, role: "group", style: {
85
+ }, ref: (el) => (this.link = el), role: "treeitem", tabIndex: this.selected ? 0 : -1 }, index.h("span", { key: '38545839a14a02be2d5215cf8243d8442315d01f', class: "tree-view-item__toggle-icon" }, this.hasChildren && (index.h(index.Fragment, { key: '5985b994251fbeba1d4951ef97d2d886be896b47' }, this.expanded ? (index.h("swirl-icon-expand-more", { onClick: this.onClickCollapse, size: 24 })) : (index.h("swirl-icon-chevron-right", { onClick: this.onClickExpand, size: 24 }))))), Boolean(this.icon) && (index.h(index.Fragment, { key: '5cf0e41959520d380cb4e26fcde2f7ad7a5ad2d8' }, index.h("span", { key: 'a1ba2c49d276f726d41d31c857f08977b4dca993', class: "tree-view-item__icon" }, iconIsEmoji ? (this.icon) : (index.h("swirl-icon", { glyph: this.icon, size: 24 }))))), index.h("span", { key: '18c2483d1878e9922e571d74f9994865fff69d9f', class: "tree-view-item__label" }, this.label), index.h("span", { key: '09b24c4ff18845f056c6d490fb3795cf84d81a9a', class: "tree-view-item__tags" }, index.h("slot", { key: 'bc45bf6afa16260be7218d2608237251983c7e33', name: "tags" }))), index.h("ul", { key: '491569e41d788183e23ac3e8fc9beeb483c35573', "aria-label": this.label, class: "tree-view-item__children", id: `${this.itemId}-children`, role: "group", style: {
80
86
  display: !this.expanded || !this.hasChildren ? "none" : undefined,
81
- } }, index.h("slot", { key: '8dc659440d40bc01edd389937586d9b02c4ef04a' })))));
87
+ } }, index.h("slot", { key: '22c80b13b2044b77c5c1acaa62044127dbe9cf0e' })))));
82
88
  }
83
89
  get el() { return index.getElement(this); }
84
90
  };