Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

@deckdeckgo/core

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deckdeckgo/core - npm Package Compare versions

Comparing version
8.2.1
to
8.3.0
+1
dist/deckdeckgo/p-dddad230.entry.js
import{h as t,r as i,c as s,H as e,g as n}from"./p-9eee8309.js";function a(t){return t.changedTouches?t.changedTouches[0]:t}function o(){return!!window&&window.matchMedia("(any-pointer:coarse)").matches}function r(){if(!window||!navigator)return!1;let t=h();return!!/iPad/i.test(t)||/Macintosh/i.test(t)&&o()}var h=()=>navigator.userAgent||navigator.vendor||window.opera;function c(t){return new Promise((async i=>{if(!t||t.length<=0)return void i(null);let s=[];Array.prototype.slice.call(t).forEach((t=>{if(-1===["id","hydrated","class","contenteditable"].indexOf(t.name.toLowerCase())){let i={name:t.name};void 0!==t.value&&(i.value=`${t.value}`),s.push(i)}})),i(s&&s.length>0?s:null)}))}class d{static lazyBackgroundImages(t){return new Promise((async i=>{const s=[];s.push(this.lazyBackgroundImgTags(t)),s.push(this.lazyBackgroundImgComponents(t)),await Promise.all(s),i()}))}static lazyBackgroundImgTags(t){return new Promise((async i=>{const s=t.querySelectorAll("img[slot='background']"),e=t.querySelectorAll("[slot='background'] img"),n=Array.from(s).concat(Array.from(e));var a;await(a=n,new Promise((t=>{a?(a.forEach((t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none")})),t()):t()}))),i()}))}static lazyBackgroundImgComponents(t){return new Promise((async i=>{const s=t.querySelectorAll(":scope > [slot='background'] deckgo-lazy-img"),e=Array.from(s);var n;await(n=e,new Promise((t=>{n?(n.forEach((async t=>{await t.lazyLoad()})),t()):t()}))),i()}))}static loadSlots(t,i,s,e=!0){return new Promise((async n=>{t.querySelector(`:scope > [slot='${s}']`)?(await this.lazyBackgroundImages(t),e&&await this.cloneSlots(t,i,s),await this.showHideBackgroundSlot(t,e),n()):n()}))}static async loadSlot(t,i,s,e=!0){t.querySelector(`:scope > [slot='${s}']`)&&(await this.lazyBackgroundImages(t),e&&await this.cloneSlot(t,i,s),await this.showHideBackgroundSlot(t,e))}static showHideBackgroundSlot(t,i){return new Promise((async s=>{const e=t.shadowRoot.host;e?(i||e.style.removeProperty("--background-display"),s()):s()}))}static cloneSlots(t,i,s){return new Promise((e=>{if(!i||i.length<=0)return void e();const n=t.querySelector(":scope > [slot='"+s+"']");n&&i.forEach((t=>{this.appendSlot(n,t,s)})),e()}))}static async cloneSlot(t,i,s){if(!i)return;const e=t.querySelector(":scope > [slot='"+s+"']");this.appendSlot(e,i,s)}static appendSlot(t,i,s){if(t&&!i.hasAttribute("custom-"+s)){const e=i.querySelector(":scope > [slot='"+s+"']");e&&i.removeChild(e),i.appendChild(t.cloneNode(!0))}}static removeSlots(t,i){return new Promise((s=>{!t||t.length<=0||t.forEach((t=>{if(!t.hasAttribute("custom-"+i)){const s=t.querySelector(":scope > [slot='"+i+"']");s&&t.removeChild(s)}})),s()}))}}const l=()=>t("style",null,"\n ::slotted(.deckgo-slide-container) {\n opacity: var(--animation-fade-hidden-opacity, 0.4);\n visibility: hidden;\n transition: opacity var(--animation-fade-duration, 500ms) cubic-bezier(0.23, 1, 0.320, 1), var(--slide-animation, visibility 500ms);\n };\n "),u=({index:i})=>t("style",null,`\n ::slotted(.deckgo-slide-container:nth-child(${i+1})) {\n visibility: initial;\n opacity: 1;\n };\n `),w=()=>t("style",null,"\n ::slotted(.deckgo-slide-container) {\n transition: var(--slide-animation);\n }\n "),m=class{constructor(t){i(this,t),this.slidesDidLoad=s(this,"slidesDidLoad",7),this.slideNextDidAnimate=s(this,"slideNextDidAnimate",7),this.slidePrevDidAnimate=s(this,"slidePrevDidAnimate",7),this.slideNextDidChange=s(this,"slideNextDidChange",7),this.slidePrevDidChange=s(this,"slidePrevDidChange",7),this.slideToChange=s(this,"slideToChange",7),this.slideDrag=s(this,"slideDrag",7),this.slideWillChange=s(this,"slideWillChange",7),this.deckDidLoad=s(this,"deckDidLoad",7),this.mouseInactivity=s(this,"mouseInactivity",7),this.keyboard=!0,this.embedded=!1,this.cloneBackground=!0,this.rtl=!1,this.startX=null,this.startY=null,this.deckMove=0,this.autoSwipeRatio=10,this.block=!1,this.activeIndex=0,this.length=0,this.fullscreen=!1,this.cursorHidden=!1,this.idleMouseTimeout=2e3,this.reveal=!0,this.revealOnMobile=!1,this.animation="slide",this.direction="horizontal",this.directionMobile="papyrus",this.autoSlide="false",this.autoSlideInterval=5e3,this.mobile=o()&&!(r()||(()=>{if(!window)return!1;let t=h();return(()=>{if(!window)return!1;let t=h();return/android|sink/i.test(t)})()&&!/mobile/i.test(t)})()),this.onIntersection=async t=>{if(!t||t.length<=0)return;const i=t.filter((t=>t.isIntersecting)).map((t=>t.target));if(!i||i.length<=0)return;const s=i.map((t=>new Promise((async i=>{this.observer.unobserve(t),await t.lazyLoadContent(),i()}))));await Promise.all(s)},this.keyboardAssist=async t=>{t.defaultPrevented||(-1!==["ArrowLeft","k","PageUp"].indexOf(t.key)?await this.slideNextPrev(!1,!0,!0):-1!==["ArrowRight","j","PageDown"].indexOf(t.key)&&await this.slideNextPrev(!0,!0,!0))}}async componentWillLoad(){await this.initRtl(),await this.initDirection()}async componentDidLoad(){await this.initSlideSize(),await this.initAutoSlide(),this.initWindowResize(),this.initKeyboardAssist()}disconnectedCallback(){this.observer&&this.observer.disconnect(),this.idleSlideLoopTimer>0&&clearTimeout(this.idleSlideLoopTimer),this.slideLoopInterval>0&&clearInterval(this.slideLoopInterval),this.idleMouseTimer>0&&clearTimeout(this.idleMouseTimer)}initRtl(){return new Promise((t=>{if(document&&document.documentElement){const t=document.documentElement.getAttribute("dir");this.rtl=t&&"rtl"===t}t()}))}initWindowResize(){window&&window.addEventListener("resize",function(t){let i;return(...s)=>{i&&clearTimeout(i),i=setTimeout((()=>t(...s)),100)}}((async()=>{await this.initSlideSize(),"papyrus"!==this.dir&&await this.slideTo(this.activeIndex);const t=!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement);await this.hideOrClearMouseCursorTimer(t),await this.showHideActionsSlot(t)})))}initSlideSize(){return new Promise((async t=>{const i=this.el.shadowRoot.querySelector("div.deckgo-deck");i?(this.embedded?await this.initSlideSizeEmbedded(i):await this.initSlideSizeStandard(i),t()):t()}))}initSlideSizeStandard(t){return new Promise((async i=>{if(!window||!screen)return void i();const s=await this.getSliderSize();t.style.setProperty("--slide-width",`${s.width}px`),"papyrus"===this.dir?(t.style.setProperty("--slide-min-height",`${s.height}px`),t.style.removeProperty("--slide-height")):(t.style.removeProperty("--slide-min-height"),t.style.setProperty("--slide-height",`${s.height}px`)),await this.initFontSize(t,{height:s.height,width:s.width}),i()}))}initSlideSizeEmbedded(t){return new Promise((async i=>{t.offsetParent?(t.offsetParent&&(t.offsetParent.clientWidth>0&&t.style.setProperty("--slide-width",t.offsetParent.clientWidth+"px"),t.offsetParent.clientHeight>0&&"papyrus"===this.dir&&(t.style.setProperty("--slide-min-height",t.offsetParent.clientHeight+"px"),t.style.removeProperty("--slide-height")),t.offsetParent.clientHeight>0&&"papyrus"!==this.dir&&(t.style.removeProperty("--slide-min-height"),t.style.setProperty("--slide-height",t.offsetParent.clientHeight+"px")),await this.initFontSize(t,{height:t.offsetParent.clientHeight,width:t.offsetParent.clientWidth})),i()):i()}))}async initFontSize(t,{height:i,width:s}){const e=s/16*9/576;t.style.setProperty("--slide-auto-font-size",i/576+"em"),t.style.setProperty("--slide-auto-ratio-font-size",`${e}em`)}initKeyboardAssist(){document&&this.keyboard&&document.addEventListener("keydown",this.keyboardAssist,{passive:!0})}async initLazyLoadContent(){window&&"IntersectionObserver"in window?await this.deferIntersectionObserverLoad():await this.lazyLoadAllContent()}async deferIntersectionObserverLoad(){const t=this.el.querySelectorAll(".deckgo-slide-container");!t||t.length<=0||(this.observer&&this.observer.disconnect(),this.observer=new IntersectionObserver(this.onIntersection,{rootMargin:"300px",threshold:0}),t.forEach((t=>{this.observer.observe(t)})))}async toggleKeyboardAssist(t){this.keyboard&&(t?document.addEventListener("keydown",this.keyboardAssist,{passive:!0}):document.removeEventListener("keydown",this.keyboardAssist,{passive:!0}))}async onDirectionMobileChange(){await this.initDirection()}async onDirectionChange(){await this.initDirection()}async initDirection(){this.dir=this.mobile?this.directionMobile:this.direction}mousedown(t){this.start(t)}touchstart(t){this.start(t)}async mouseup(t){await this.stop(t)}async touchend(t){await this.stop(t)}async mousemove(t){await this.move(t)}async touchmove(t){await this.move(t)}async dblclick(){this.resetStart()}async contextMenu(){this.resetStart()}scrolling(t){this.block=!!t&&t.detail}async keypress(){await this.clearMouseCursorTimer(!0)}start(t){const i=window.getComputedStyle(t.target);this.block="text"===(null==i?void 0:i.userSelect)||"text"===(null==i?void 0:i.getPropertyValue("-webkit-user-select"))||"text"===(null==i?void 0:i.getPropertyValue("-moz-user-select"))||"text"===(null==i?void 0:i.getPropertyValue("-ms-user-select")),this.startX=a(t).clientX,this.startY=a(t).clientY}async move(t){if(await this.clearMouseCursorTimer(!0),this.block)return;if("slide"!==this.animation)return;const i=await this.getDelta(t);i&&(this.moveX(i),this.moveY(i),i.slider.style.setProperty("--transformXDuration","0ms"))}moveX(t){if("horizontal"!==this.dir)return;const i=t.swipeNext?this.deckMove-t.deltaX:this.deckMove+t.deltaX;t.slider.style.setProperty("--transformX",i+"px"),this.slideDrag.emit(i)}moveY(t){if("vertical"!==this.dir)return;const i=t.swipeNext?this.deckMove-t.deltaY:this.deckMove+t.deltaY;t.slider.style.setProperty("--transformY",i+"px"),this.slideDrag.emit(i)}async stop(t){if(this.block)return;const i=await this.getDelta(t);await this.swipeSlide(i),this.resetStart()}swipeSlide(t,i=!0){return new Promise((async s=>{if(!t||!window)return void s();let e=t.swipeNext&&this.activeIndex<this.length-1,n=!t.swipeNext&&this.activeIndex>0;if(this.rtl&&(e=t.swipeNext&&this.activeIndex>0,n=!t.swipeNext&&this.activeIndex<this.length-1),e||n){const s=await this.getSliderSize(),e=t.deltaY>s.height/this.autoSwipeRatio;(t.deltaX>s.width/this.autoSwipeRatio||e)&&(this.deckMove="horizontal"!==this.dir?t.swipeNext?this.deckMove-s.height:this.deckMove+s.height:t.swipeNext?this.deckMove-s.width:this.deckMove+s.width,this.isNextChange(t.swipeNext)?(this.activeIndex++,i&&this.slideNextDidChange.emit(this.activeIndex)):(this.activeIndex--,i&&this.slidePrevDidChange.emit(this.activeIndex)))}await this.doSwipeSlide(t.slider),s()}))}async getSliderSize(){if(!this.embedded)return this.getSliderSizeNotEmbededd();const t=this.el.shadowRoot.querySelector("div.deckgo-deck");return!t||!t.offsetParent||t.offsetParent.clientWidth<=0?this.getSliderSizeNotEmbededd():{width:t.offsetParent.clientWidth,height:t.offsetParent.clientHeight}}async getSliderSizeNotEmbededd(){return function(){if(!window||!navigator)return!1;let t=h();return/iPhone|iPod/i.test(t)||r()}()?{width:screen.width>window.innerWidth?screen.width:window.innerWidth,height:screen.height>window.innerHeight?screen.height:window.innerHeight}:{width:window.innerWidth,height:window.innerHeight}}isNextChange(t){return t&&!this.rtl||!t&&this.rtl}doSwipeSlide(t,i){return new Promise((s=>{if("horizontal"===this.dir&&t.style.setProperty("--transformX",this.deckMove+"px"),"vertical"===this.dir&&t.style.setProperty("--transformY",this.deckMove+"px"),t.style.setProperty("--transformXDuration","slide"===this.animation?(isNaN(i)?300:i)+"ms":"0ms"),"papyrus"===this.dir){const t=this.el.querySelector(".deckgo-slide-container:nth-child("+(this.activeIndex+1)+")");setTimeout((()=>{null==t||t.scrollIntoView("none"===this.animation?null:{behavior:"smooth",block:"nearest"})}),0)}this.slideWillChange.emit(this.deckMove),this.resetStart(),s()}))}resetStart(){this.startX=null,this.startY=null}async getDelta(t){if(!this.startX&&"horizontal"===this.dir)return null;if(!this.startY&&"vertical"===this.dir)return null;if("papyrus"===this.dir)return null;const i=this.el.shadowRoot.querySelector("div.deckgo-deck");if(!i)return null;const s=a(t).clientX,e=a(t).clientY;if(this.startX===s&&"horizontal"===this.dir)return null;if(this.startY===e&&"vertical"===this.dir)return null;const n=this.startX>s&&"horizontal"===this.dir,o=this.startY>e&&"vertical"===this.dir;return{slider:i,swipeNext:n||o,deltaX:n?this.startX-s:s-this.startX,deltaY:o?this.startY-e:e-this.startY}}async slideDidLoad(){await this.updateLength(),await this.afterSlidesDidLoad()}async updateLength(){const t=await this.getDefinedFilteredSlides();this.length=t?t.length:0}afterSlidesDidLoad(){return new Promise((async t=>{const i=await this.getDeckDefinition();i&&i.slides&&i.slides.length>0&&(this.slidesDidLoad.emit(i),await this.onAllSlidesDidLoad(),this.deckDidLoad.emit()),t()}))}onAllSlidesDidLoad(){return new Promise((async t=>{const i=await this.getDefinedFilteredSlides(),s=[];s.push(this.initLazyLoadContent()),s.push(d.loadSlots(this.el,i,"background",this.cloneBackground)),"papyrus"!==this.dir?(s.push(d.cloneSlots(this.el,i,"actions")),s.push(d.loadSlots(this.el,i,"header")),s.push(d.loadSlots(this.el,i,"footer"))):i&&i.length>0&&(s.push(d.cloneSlot(this.el,i[0],"actions")),s.push(d.loadSlot(this.el,i[0],"header")),s.push(d.loadSlot(this.el,i[i.length-1],"footer"))),(!this.reveal||!this.revealOnMobile&&this.mobile||"papyrus"===this.dir)&&s.push(this.revealAllContent()),await Promise.all(s),t()}))}getDeckDefinition(){return new Promise((async t=>{const i=this.el.querySelectorAll(".deckgo-slide-container.hydrated");if(!i||i.length<=0)return void t(null);const s=await this.getDefinedFilteredSlides();if(i.length!==(s?s.length:0))return void t(null);const e=[];for(const t of Array.from(i)){const i=await c(t.attributes);e.push({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:i})}const n=await c(this.el.attributes),a=this.el.querySelector(":scope > [slot='background']");t({slides:e,attributes:n,background:a?a.innerHTML:null,reveal:this.reveal,revealOnMobile:this.revealOnMobile})}))}getSlideDefinition(t){return new Promise((async i=>{const s=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");var e;i(await(e=s,new Promise((async t=>{if(!e)return void t(null);let i=await c(e.attributes);t({template:e.tagName?e.tagName.toLowerCase():void 0,content:e.innerHTML,attributes:i})}))))}))}getDefinedFilteredSlides(){return new Promise((async t=>{const i=this.el.children;t(await this.filterSlides(i))}))}loadBackground(){return this.loadSlots("background",this.cloneBackground)}loadHeader(){return this.loadSlots("header")}loadFooter(){return this.loadSlots("footer")}async loadSlots(t,i=!0){const s=await this.getDefinedFilteredSlides();!s||s.length<=0||(await d.removeSlots(s,t),await d.loadSlots(this.el,s,t,i))}filterSlides(t){return new Promise((i=>{i(!t||t.length<=0?null:Array.from(t).filter((t=>!t.hasAttribute("slot")||""===t.getAttribute("slot"))))}))}isBeginning(){return new Promise((t=>{t(0===this.activeIndex)}))}isEnd(){return new Promise((t=>{t(this.activeIndex===this.length-1)}))}getActiveIndex(){return new Promise((t=>{t(this.activeIndex)}))}getLength(){return new Promise((t=>{t(this.length)}))}async slideNext(t,i){await this.slideNextPrev(!this.rtl,t,i)}async slidePrev(t,i){await this.slideNextPrev(this.rtl,t,i)}async slideNextPrev(t,i=!0,s){const e=this.el.shadowRoot.querySelector("div.deckgo-deck");if(!e||!window)return;let n;if(n=!i||await this.beforeSwipe(this.isNextChange(t)),n){const i=await this.getSliderSize(),n={slider:e,swipeNext:t,deltaX:i.width,deltaY:i.height};await this.swipeSlide(n,s),await this.afterSwipe(t)}else s&&(t?this.slideNextDidAnimate.emit():this.slidePrevDidAnimate.emit())}beforeSwipe(t){return new Promise((async i=>{const s=this.el.querySelector(".deckgo-slide-container:nth-child("+(this.activeIndex+1)+")");i(!s||await s.beforeSwipe(t,this.reveal))}))}afterSwipe(t){return new Promise((async i=>{const s=t?this.activeIndex-1:this.activeIndex+1;if(isNaN(s)||s<0||s>this.length)return void i();const e=this.el.querySelector(".deckgo-slide-container:nth-child("+(s+1)+")");e?(await e.afterSwipe(),i()):i()}))}async lazyLoadContent(t){const i=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");i&&await i.lazyLoadContent()}async slideTo(t,i,s=!0){if(t>this.length||t<0)return;const e=this.el.shadowRoot.querySelector("div.deckgo-deck");if(!e||!window)return;const n=await this.getSliderSize();this.deckMove=t*("horizontal"===this.dir?n.width:n.height)*(this.rtl?1:-1),this.activeIndex=t,await this.doSwipeSlide(e,i),e.parentElement.scrollTo(0,0),s&&this.slideToChange.emit(t)}async deleteActiveSlide(){if(this.activeIndex>this.length||this.activeIndex<0)return;const t=this.el.querySelector(".deckgo-slide-container:nth-child("+(this.activeIndex+1)+")");t&&(t.parentElement.removeChild(t),this.activeIndex=this.activeIndex>0?this.activeIndex-1:0,this.length=this.length>0?this.length-1:0,this.length>0&&await this.slideTo(this.activeIndex,0))}async blockSlide(t){this.block=t,this.block&&this.resetStart()}toggleFullScreen(){return new Promise((async t=>{const i=window.document,s=i.documentElement,e=s.requestFullscreen||s.mozRequestFullScreen||s.webkitRequestFullScreen||s.msRequestFullscreen;i.fullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement||i.msFullscreenElement?(i.exitFullscreen||i.mozCancelFullScreen||i.webkitExitFullscreen||i.msExitFullscreen).call(i):e.call(s),t()}))}async hideOrClearMouseCursorTimer(t){t?(this.fullscreen=!0,setTimeout((async()=>{await this.showHideMouseCursor(!1)}),500),this.hideMouseCursorWithDelay()):(await this.clearMouseCursorTimer(!1),this.fullscreen=!1)}async clearMouseCursorTimer(t){this.fullscreen&&(this.idleMouseTimer>0&&clearTimeout(this.idleMouseTimer),await this.showHideMouseCursor(!0),t&&this.hideMouseCursorWithDelay())}hideMouseCursorWithDelay(){this.fullscreen&&(this.idleMouseTimer=setTimeout((async()=>{await this.showHideMouseCursor(!1)}),this.idleMouseTimeout))}showHideMouseCursor(t){return new Promise((i=>{if(!this.fullscreen)return void i();if(!this.cursorHidden&&t)return void i();const s=this.el.shadowRoot.querySelector("div.deckgo-deck");s?(s.style.setProperty("cursor",t?"inherit":"none"),this.mouseInactivity.emit(t),this.cursorHidden=!t,i()):i()}))}showHideActionsSlot(t){return new Promise((i=>{const s=this.el.shadowRoot.querySelector("div.deckgo-deck");s?t?s.style.setProperty("--slide-actions-display","none"):s.style.removeProperty("--slide-actions-display"):i()}))}doPrint(){return new Promise((async t=>{window&&(await this.lazyLoadAllContent(),window.print()),t()}))}lazyLoadAllContent(){const t=[];for(let i=0;i<this.length;i++)t.push(this.lazyLoadContent(i));return Promise.all(t)}async onRevealChange(){this.reveal?await this.redoRevealContent():await this.revealAllContent()}revealAllContent(){return new Promise((async t=>{const i=[];for(let t=0;t<this.length;t++)i.push(this.revealContent(t));await Promise.all(i),t()}))}redoRevealContent(){return new Promise((async t=>{const i=[];for(let t=0;t<this.length;t++)i.push(t<this.activeIndex?this.revealContent(t):this.hideContent(t));await Promise.all(i),t()}))}async revealContent(t){const i=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");i&&await i.revealContent()}async hideContent(t){const i=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");i&&await i.hideContent()}async initAutoSlide(){"true"===this.autoSlide&&await this.onAutoSlide()}async onAutoSlide(){let t;this.idleSlideLoopTimer=setTimeout((()=>t=this.idleMouseTimer),this.idleMouseTimeout),"true"===this.autoSlide?this.slideLoopInterval=setInterval((async()=>{t===this.idleMouseTimer?await this.isEnd()?await this.slideTo(0,0):await this.slideNext(!0):t=this.idleMouseTimer}),this.autoSlideInterval):clearInterval(this.slideLoopInterval)}render(){return t(e,{class:`${this.dir}`},t("main",null,this.renderAnimation(),t("div",{class:"deckgo-deck"},t("slot",null),t("slot",{name:"actions"}),t("slot",{name:"background"})),t("slot",{name:"pager"})))}renderAnimation(){return"fade"!==this.animation||"papyrus"===this.dir?t(w,null):[t(l,null),t(u,{index:this.activeIndex})]}get el(){return n(this)}static get watchers(){return{directionMobile:["onDirectionMobileChange"],direction:["onDirectionChange"],reveal:["onRevealChange"],autoSlide:["onAutoSlide"]}}};m.style=":host{display:block;position:relative;width:100%;height:100%;contain:size style}main{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;-webkit-overflow-scrolling:touch;will-change:scroll-position;touch-action:auto}:host(.vertical) main,:host(.horizontal) main{overflow:hidden}:host(.papyrus) main{overflow-x:hidden}:host(.vertical) main,:host(.papyrus) main{touch-action:pan-y;overscroll-behavior-y:contain}:host(.horizontal) main{touch-action:pan-x;overscroll-behavior-x:contain}div.deckgo-deck{display:flex;position:absolute;top:0;bottom:0;z-index:var(--zIndex);--transformX:0px;--transformY:0px;--transformXDuration:0ms;transform:translate3d(var(--transformX), var(--transformY), 0px);transition-duration:var(--transformXDuration, 0ms);--slide-width:100vw;--slide-height:100%;font-size:var(--slide-font-size, var(--slide-auto-font-size, 1em))}div.deckgo-deck ::-webkit-scrollbar{display:none}:host(.vertical) div.deckgo-deck,:host(.papyrus) div.deckgo-deck{flex-direction:column}:host(.papyrus) div.deckgo-deck{--slide-user-select:auto}::slotted([slot=background]){display:var(--background-display, none);pointer-events:none}::slotted([slot=actions]){display:none}@media print{div.deckgo-deck{display:initial;position:initial}::slotted([slot=background]){display:none}}";export{m as deckgo_deck}
+6
-0

@@ -0,1 +1,7 @@

# 8.3.0 (2021-08-19)
### Features
- consider mobile as small devices, not tablets
# 8.2.1 (2021-05-29)

@@ -2,0 +8,0 @@

+6
-4

@@ -7,3 +7,3 @@ 'use strict';

function f(e){return e.changedTouches?e.changedTouches[0]:e}function m(e,n){let t;return (...i)=>{let r=()=>e(...i);t&&clearTimeout(t),t=setTimeout(r,n&&n>0?n:300);}}function s(){return window?window.matchMedia("(any-pointer:coarse)").matches:!1}function p$1(){if(!window||!navigator)return !1;let e=o();return /iPhone|iPod/i.test(e)||a()}function a(){if(!window||!navigator)return !1;let e=o();return /iPad/i.test(e)?!0:/Macintosh/i.test(e)&&s()}function g(){return !!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}var o=()=>navigator.userAgent||navigator.vendor||window.opera;function h(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none");}),n();})}function S(e){return new Promise(n=>{if(!e){n();return}e.forEach(async t=>{await t.lazyLoad();}),n();})}
function f(e){return e.changedTouches?e.changedTouches[0]:e}function m(e,n){let t;return (...i)=>{let r=()=>e(...i);t&&clearTimeout(t),t=setTimeout(r,n&&n>0?n:300);}}function s(){return window?window.matchMedia("(any-pointer:coarse)").matches:!1}function p$1(){if(!window||!navigator)return !1;let e=o();return /iPhone|iPod/i.test(e)||a()}function a(){if(!window||!navigator)return !1;let e=o();return /iPad/i.test(e)?!0:/Macintosh/i.test(e)&&s()}function g(){return !!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}var u=()=>{if(!window)return !1;let e=o();return /android|sink/i.test(e)},y=()=>{if(!window)return !1;let e=o();return u()&&!/mobile/i.test(e)},o=()=>navigator.userAgent||navigator.vendor||window.opera;function h(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none");}),n();})}function S(e){return new Promise(n=>{if(!e){n();return}e.forEach(async t=>{await t.lazyLoad();}),n();})}

@@ -199,2 +199,4 @@ function p(t){return new Promise(async n=>{if(!t){n(null);return}let e=await c(t.attributes);n({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:e});})}function c(t){return new Promise(async n=>{if(!t||t.length<=0){n(null);return}let e=[];Array.prototype.slice.call(t).forEach(r=>{if(["id","hydrated","class","contenteditable"].indexOf(r.name.toLowerCase())===-1){let l={name:r.name};r.value!==void 0&&(l.value=`${r.value}`),e.push(l);}}),n(e&&e.length>0?e:null);})}

this.autoSlideInterval = 5000;
// We do not consider iPad and Tablet as "mobile" devices. With mobile we mean smaller devices, phones.
this.mobile = s() && !(a() || y());
this.onIntersection = async (entries) => {

@@ -339,3 +341,3 @@ if (!entries || entries.length <= 0) {

const fontSize = height / 576;
const ratioFontSize = width / 16 * 9 / 576;
const ratioFontSize = ((width / 16) * 9) / 576;
slider.style.setProperty('--slide-auto-font-size', `${fontSize}em`);

@@ -392,3 +394,3 @@ slider.style.setProperty('--slide-auto-ratio-font-size', `${ratioFontSize}em`);

async initDirection() {
this.dir = s() ? this.directionMobile : this.direction;
this.dir = this.mobile ? this.directionMobile : this.direction;
}

@@ -650,3 +652,3 @@ /* BEGIN: Handle swipe */

// Also, no reveal for papyrus as we can scroll
if (!this.reveal || (!this.revealOnMobile && s()) || this.dir === 'papyrus') {
if (!this.reveal || (!this.revealOnMobile && this.mobile) || this.dir === 'papyrus') {
promises.push(this.revealAllContent());

@@ -653,0 +655,0 @@ }

import { Component, Element, Listen, Method, Prop, State, Event, h, Watch, Host } from '@stencil/core';
import { isIOS, unifyEvent, isMobile, isFullscreen, debounce } from '@deckdeckgo/utils';
import { isIOS, unifyEvent, isMobile, isFullscreen, debounce, isAndroidTablet, isIPad } from '@deckdeckgo/utils';
import { getSlideDefinition, getAttributesDefinition } from '@deckdeckgo/deck-utils';

@@ -29,2 +29,4 @@ import { DeckdeckgoDeckBackgroundUtils } from '../../utils/deckdeckgo-deck-background-utils';

this.autoSlideInterval = 5000;
// We do not consider iPad and Tablet as "mobile" devices. With mobile we mean smaller devices, phones.
this.mobile = isMobile() && !(isIPad() || isAndroidTablet());
this.onIntersection = async (entries) => {

@@ -169,3 +171,3 @@ if (!entries || entries.length <= 0) {

const fontSize = height / 576;
const ratioFontSize = width / 16 * 9 / 576;
const ratioFontSize = ((width / 16) * 9) / 576;
slider.style.setProperty('--slide-auto-font-size', `${fontSize}em`);

@@ -222,3 +224,3 @@ slider.style.setProperty('--slide-auto-ratio-font-size', `${ratioFontSize}em`);

async initDirection() {
this.dir = isMobile() ? this.directionMobile : this.direction;
this.dir = this.mobile ? this.directionMobile : this.direction;
}

@@ -480,3 +482,3 @@ /* BEGIN: Handle swipe */

// Also, no reveal for papyrus as we can scroll
if (!this.reveal || (!this.revealOnMobile && isMobile()) || this.dir === 'papyrus') {
if (!this.reveal || (!this.revealOnMobile && this.mobile) || this.dir === 'papyrus') {
promises.push(this.revealAllContent());

@@ -483,0 +485,0 @@ }

import { h as h$1, attachShadow, createEvent, Host, proxyCustomElement } from '@stencil/core/internal/client';
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
function f(e){return e.changedTouches?e.changedTouches[0]:e}function m(e,n){let t;return (...i)=>{let r=()=>e(...i);t&&clearTimeout(t),t=setTimeout(r,n&&n>0?n:300);}}function s(){return window?window.matchMedia("(any-pointer:coarse)").matches:!1}function p$1(){if(!window||!navigator)return !1;let e=o();return /iPhone|iPod/i.test(e)||a()}function a(){if(!window||!navigator)return !1;let e=o();return /iPad/i.test(e)?!0:/Macintosh/i.test(e)&&s()}function g(){return !!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}var o=()=>navigator.userAgent||navigator.vendor||window.opera;function h(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none");}),n();})}function S(e){return new Promise(n=>{if(!e){n();return}e.forEach(async t=>{await t.lazyLoad();}),n();})}
function f(e){return e.changedTouches?e.changedTouches[0]:e}function m(e,n){let t;return (...i)=>{let r=()=>e(...i);t&&clearTimeout(t),t=setTimeout(r,n&&n>0?n:300);}}function s(){return window?window.matchMedia("(any-pointer:coarse)").matches:!1}function p$1(){if(!window||!navigator)return !1;let e=o();return /iPhone|iPod/i.test(e)||a()}function a(){if(!window||!navigator)return !1;let e=o();return /iPad/i.test(e)?!0:/Macintosh/i.test(e)&&s()}function g(){return !!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}var u=()=>{if(!window)return !1;let e=o();return /android|sink/i.test(e)},y=()=>{if(!window)return !1;let e=o();return u()&&!/mobile/i.test(e)},o=()=>navigator.userAgent||navigator.vendor||window.opera;function h(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none");}),n();})}function S(e){return new Promise(n=>{if(!e){n();return}e.forEach(async t=>{await t.lazyLoad();}),n();})}

@@ -197,2 +197,4 @@ function p(t){return new Promise(async n=>{if(!t){n(null);return}let e=await c(t.attributes);n({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:e});})}function c(t){return new Promise(async n=>{if(!t||t.length<=0){n(null);return}let e=[];Array.prototype.slice.call(t).forEach(r=>{if(["id","hydrated","class","contenteditable"].indexOf(r.name.toLowerCase())===-1){let l={name:r.name};r.value!==void 0&&(l.value=`${r.value}`),e.push(l);}}),n(e&&e.length>0?e:null);})}

this.autoSlideInterval = 5000;
// We do not consider iPad and Tablet as "mobile" devices. With mobile we mean smaller devices, phones.
this.mobile = s() && !(a() || y());
this.onIntersection = async (entries) => {

@@ -337,3 +339,3 @@ if (!entries || entries.length <= 0) {

const fontSize = height / 576;
const ratioFontSize = width / 16 * 9 / 576;
const ratioFontSize = ((width / 16) * 9) / 576;
slider.style.setProperty('--slide-auto-font-size', `${fontSize}em`);

@@ -390,3 +392,3 @@ slider.style.setProperty('--slide-auto-ratio-font-size', `${ratioFontSize}em`);

async initDirection() {
this.dir = s() ? this.directionMobile : this.direction;
this.dir = this.mobile ? this.directionMobile : this.direction;
}

@@ -648,3 +650,3 @@ /* BEGIN: Handle swipe */

// Also, no reveal for papyrus as we can scroll
if (!this.reveal || (!this.revealOnMobile && s()) || this.dir === 'papyrus') {
if (!this.reveal || (!this.revealOnMobile && this.mobile) || this.dir === 'papyrus') {
promises.push(this.revealAllContent());

@@ -651,0 +653,0 @@ }

+1
-1

@@ -1,1 +0,1 @@

import{p as e,b as o}from"./p-9eee8309.js";(()=>{const o=import.meta.url,i={};return""!==o&&(i.resourcesUrl=new URL(".",o).href),e(i)})().then((e=>o([["p-1c25b04d",[[1,"deckgo-deck",{keyboard:[4],embedded:[4],cloneBackground:[4,"clone-background"],reveal:[4],revealOnMobile:[4,"reveal-on-mobile"],animation:[513],direction:[513],directionMobile:[513,"direction-mobile"],autoSlide:[1,"auto-slide"],autoSlideInterval:[2,"auto-slide-interval"],rtl:[32],activeIndex:[32],dir:[32],initSlideSize:[64],toggleKeyboardAssist:[64],getDeckDefinition:[64],getSlideDefinition:[64],loadBackground:[64],loadHeader:[64],loadFooter:[64],isBeginning:[64],isEnd:[64],getActiveIndex:[64],getLength:[64],slideNext:[64],slidePrev:[64],slideTo:[64],deleteActiveSlide:[64],blockSlide:[64],toggleFullScreen:[64],doPrint:[64],lazyLoadAllContent:[64]},[[1,"mousedown","mousedown"],[1,"touchstart","touchstart"],[1,"mouseup","mouseup"],[1,"touchend","touchend"],[1,"mousemove","mousemove"],[1,"touchmove","touchmove"],[1,"dblclick","dblclick"],[1,"contextmenu","contextMenu"],[0,"scrolling","scrolling"],[0,"keypress","keypress"],[0,"slideDidLoad","slideDidLoad"]]]]]],e)));
import{p as e,b as o}from"./p-9eee8309.js";(()=>{const o=import.meta.url,i={};return""!==o&&(i.resourcesUrl=new URL(".",o).href),e(i)})().then((e=>o([["p-dddad230",[[1,"deckgo-deck",{keyboard:[4],embedded:[4],cloneBackground:[4,"clone-background"],reveal:[4],revealOnMobile:[4,"reveal-on-mobile"],animation:[513],direction:[513],directionMobile:[513,"direction-mobile"],autoSlide:[1,"auto-slide"],autoSlideInterval:[2,"auto-slide-interval"],rtl:[32],activeIndex:[32],dir:[32],initSlideSize:[64],toggleKeyboardAssist:[64],getDeckDefinition:[64],getSlideDefinition:[64],loadBackground:[64],loadHeader:[64],loadFooter:[64],isBeginning:[64],isEnd:[64],getActiveIndex:[64],getLength:[64],slideNext:[64],slidePrev:[64],slideTo:[64],deleteActiveSlide:[64],blockSlide:[64],toggleFullScreen:[64],doPrint:[64],lazyLoadAllContent:[64]},[[1,"mousedown","mousedown"],[1,"touchstart","touchstart"],[1,"mouseup","mouseup"],[1,"touchend","touchend"],[1,"mousemove","mousemove"],[1,"touchmove","touchmove"],[1,"dblclick","dblclick"],[1,"contextmenu","contextMenu"],[0,"scrolling","scrolling"],[0,"keypress","keypress"],[0,"slideDidLoad","slideDidLoad"]]]]]],e)));
import { h as h$1, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-998c833e.js';
function f(e){return e.changedTouches?e.changedTouches[0]:e}function m(e,n){let t;return (...i)=>{let r=()=>e(...i);t&&clearTimeout(t),t=setTimeout(r,n&&n>0?n:300);}}function s(){return window?window.matchMedia("(any-pointer:coarse)").matches:!1}function p$1(){if(!window||!navigator)return !1;let e=o();return /iPhone|iPod/i.test(e)||a()}function a(){if(!window||!navigator)return !1;let e=o();return /iPad/i.test(e)?!0:/Macintosh/i.test(e)&&s()}function g(){return !!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}var o=()=>navigator.userAgent||navigator.vendor||window.opera;function h(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none");}),n();})}function S(e){return new Promise(n=>{if(!e){n();return}e.forEach(async t=>{await t.lazyLoad();}),n();})}
function f(e){return e.changedTouches?e.changedTouches[0]:e}function m(e,n){let t;return (...i)=>{let r=()=>e(...i);t&&clearTimeout(t),t=setTimeout(r,n&&n>0?n:300);}}function s(){return window?window.matchMedia("(any-pointer:coarse)").matches:!1}function p$1(){if(!window||!navigator)return !1;let e=o();return /iPhone|iPod/i.test(e)||a()}function a(){if(!window||!navigator)return !1;let e=o();return /iPad/i.test(e)?!0:/Macintosh/i.test(e)&&s()}function g(){return !!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}var u=()=>{if(!window)return !1;let e=o();return /android|sink/i.test(e)},y=()=>{if(!window)return !1;let e=o();return u()&&!/mobile/i.test(e)},o=()=>navigator.userAgent||navigator.vendor||window.opera;function h(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none");}),n();})}function S(e){return new Promise(n=>{if(!e){n();return}e.forEach(async t=>{await t.lazyLoad();}),n();})}

@@ -194,2 +194,4 @@ function p(t){return new Promise(async n=>{if(!t){n(null);return}let e=await c(t.attributes);n({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:e});})}function c(t){return new Promise(async n=>{if(!t||t.length<=0){n(null);return}let e=[];Array.prototype.slice.call(t).forEach(r=>{if(["id","hydrated","class","contenteditable"].indexOf(r.name.toLowerCase())===-1){let l={name:r.name};r.value!==void 0&&(l.value=`${r.value}`),e.push(l);}}),n(e&&e.length>0?e:null);})}

this.autoSlideInterval = 5000;
// We do not consider iPad and Tablet as "mobile" devices. With mobile we mean smaller devices, phones.
this.mobile = s() && !(a() || y());
this.onIntersection = async (entries) => {

@@ -334,3 +336,3 @@ if (!entries || entries.length <= 0) {

const fontSize = height / 576;
const ratioFontSize = width / 16 * 9 / 576;
const ratioFontSize = ((width / 16) * 9) / 576;
slider.style.setProperty('--slide-auto-font-size', `${fontSize}em`);

@@ -387,3 +389,3 @@ slider.style.setProperty('--slide-auto-ratio-font-size', `${ratioFontSize}em`);

async initDirection() {
this.dir = s() ? this.directionMobile : this.direction;
this.dir = this.mobile ? this.directionMobile : this.direction;
}

@@ -645,3 +647,3 @@ /* BEGIN: Handle swipe */

// Also, no reveal for papyrus as we can scroll
if (!this.reveal || (!this.revealOnMobile && s()) || this.dir === 'papyrus') {
if (!this.reveal || (!this.revealOnMobile && this.mobile) || this.dir === 'papyrus') {
promises.push(this.revealAllContent());

@@ -648,0 +650,0 @@ }

@@ -41,2 +41,3 @@ import { EventEmitter } from '../../../stencil-public-runtime';

private idleSlideLoopTimer;
private mobile;
componentWillLoad(): Promise<void>;

@@ -43,0 +44,0 @@ componentDidLoad(): Promise<void>;

{
"name": "@deckdeckgo/core",
"version": "8.2.1",
"version": "8.3.0",
"description": "Add a presentation to your web application using HTML and Web Components",

@@ -41,3 +41,4 @@ "main": "dist/index.cjs.js",

"type": "git",
"url": "git+https://github.com/deckgo/deckdeckgo.git"
"url": "git+https://github.com/deckgo/deckdeckgo.git",
"directory": "webcomponents/core"
},

@@ -44,0 +45,0 @@ "author": "David Dal Busco",

import{h as t,r as i,c as s,H as e,g as n}from"./p-9eee8309.js";function a(t){return t.changedTouches?t.changedTouches[0]:t}function o(){return!!window&&window.matchMedia("(any-pointer:coarse)").matches}var r=()=>navigator.userAgent||navigator.vendor||window.opera;function h(t){return new Promise((async i=>{if(!t||t.length<=0)return void i(null);let s=[];Array.prototype.slice.call(t).forEach((t=>{if(-1===["id","hydrated","class","contenteditable"].indexOf(t.name.toLowerCase())){let i={name:t.name};void 0!==t.value&&(i.value=`${t.value}`),s.push(i)}})),i(s&&s.length>0?s:null)}))}class c{static lazyBackgroundImages(t){return new Promise((async i=>{const s=[];s.push(this.lazyBackgroundImgTags(t)),s.push(this.lazyBackgroundImgComponents(t)),await Promise.all(s),i()}))}static lazyBackgroundImgTags(t){return new Promise((async i=>{const s=t.querySelectorAll("img[slot='background']"),e=t.querySelectorAll("[slot='background'] img"),n=Array.from(s).concat(Array.from(e));var a;await(a=n,new Promise((t=>{a?(a.forEach((t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none")})),t()):t()}))),i()}))}static lazyBackgroundImgComponents(t){return new Promise((async i=>{const s=t.querySelectorAll(":scope > [slot='background'] deckgo-lazy-img"),e=Array.from(s);var n;await(n=e,new Promise((t=>{n?(n.forEach((async t=>{await t.lazyLoad()})),t()):t()}))),i()}))}static loadSlots(t,i,s,e=!0){return new Promise((async n=>{t.querySelector(`:scope > [slot='${s}']`)?(await this.lazyBackgroundImages(t),e&&await this.cloneSlots(t,i,s),await this.showHideBackgroundSlot(t,e),n()):n()}))}static async loadSlot(t,i,s,e=!0){t.querySelector(`:scope > [slot='${s}']`)&&(await this.lazyBackgroundImages(t),e&&await this.cloneSlot(t,i,s),await this.showHideBackgroundSlot(t,e))}static showHideBackgroundSlot(t,i){return new Promise((async s=>{const e=t.shadowRoot.host;e?(i||e.style.removeProperty("--background-display"),s()):s()}))}static cloneSlots(t,i,s){return new Promise((e=>{if(!i||i.length<=0)return void e();const n=t.querySelector(":scope > [slot='"+s+"']");n&&i.forEach((t=>{this.appendSlot(n,t,s)})),e()}))}static async cloneSlot(t,i,s){if(!i)return;const e=t.querySelector(":scope > [slot='"+s+"']");this.appendSlot(e,i,s)}static appendSlot(t,i,s){if(t&&!i.hasAttribute("custom-"+s)){const e=i.querySelector(":scope > [slot='"+s+"']");e&&i.removeChild(e),i.appendChild(t.cloneNode(!0))}}static removeSlots(t,i){return new Promise((s=>{!t||t.length<=0||t.forEach((t=>{if(!t.hasAttribute("custom-"+i)){const s=t.querySelector(":scope > [slot='"+i+"']");s&&t.removeChild(s)}})),s()}))}}const d=()=>t("style",null,"\n ::slotted(.deckgo-slide-container) {\n opacity: var(--animation-fade-hidden-opacity, 0.4);\n visibility: hidden;\n transition: opacity var(--animation-fade-duration, 500ms) cubic-bezier(0.23, 1, 0.320, 1), var(--slide-animation, visibility 500ms);\n };\n "),l=({index:i})=>t("style",null,`\n ::slotted(.deckgo-slide-container:nth-child(${i+1})) {\n visibility: initial;\n opacity: 1;\n };\n `),u=()=>t("style",null,"\n ::slotted(.deckgo-slide-container) {\n transition: var(--slide-animation);\n }\n "),w=class{constructor(t){i(this,t),this.slidesDidLoad=s(this,"slidesDidLoad",7),this.slideNextDidAnimate=s(this,"slideNextDidAnimate",7),this.slidePrevDidAnimate=s(this,"slidePrevDidAnimate",7),this.slideNextDidChange=s(this,"slideNextDidChange",7),this.slidePrevDidChange=s(this,"slidePrevDidChange",7),this.slideToChange=s(this,"slideToChange",7),this.slideDrag=s(this,"slideDrag",7),this.slideWillChange=s(this,"slideWillChange",7),this.deckDidLoad=s(this,"deckDidLoad",7),this.mouseInactivity=s(this,"mouseInactivity",7),this.keyboard=!0,this.embedded=!1,this.cloneBackground=!0,this.rtl=!1,this.startX=null,this.startY=null,this.deckMove=0,this.autoSwipeRatio=10,this.block=!1,this.activeIndex=0,this.length=0,this.fullscreen=!1,this.cursorHidden=!1,this.idleMouseTimeout=2e3,this.reveal=!0,this.revealOnMobile=!1,this.animation="slide",this.direction="horizontal",this.directionMobile="papyrus",this.autoSlide="false",this.autoSlideInterval=5e3,this.onIntersection=async t=>{if(!t||t.length<=0)return;const i=t.filter((t=>t.isIntersecting)).map((t=>t.target));if(!i||i.length<=0)return;const s=i.map((t=>new Promise((async i=>{this.observer.unobserve(t),await t.lazyLoadContent(),i()}))));await Promise.all(s)},this.keyboardAssist=async t=>{t.defaultPrevented||(-1!==["ArrowLeft","k","PageUp"].indexOf(t.key)?await this.slideNextPrev(!1,!0,!0):-1!==["ArrowRight","j","PageDown"].indexOf(t.key)&&await this.slideNextPrev(!0,!0,!0))}}async componentWillLoad(){await this.initRtl(),await this.initDirection()}async componentDidLoad(){await this.initSlideSize(),await this.initAutoSlide(),this.initWindowResize(),this.initKeyboardAssist()}disconnectedCallback(){this.observer&&this.observer.disconnect(),this.idleSlideLoopTimer>0&&clearTimeout(this.idleSlideLoopTimer),this.slideLoopInterval>0&&clearInterval(this.slideLoopInterval),this.idleMouseTimer>0&&clearTimeout(this.idleMouseTimer)}initRtl(){return new Promise((t=>{if(document&&document.documentElement){const t=document.documentElement.getAttribute("dir");this.rtl=t&&"rtl"===t}t()}))}initWindowResize(){window&&window.addEventListener("resize",function(t){let i;return(...s)=>{i&&clearTimeout(i),i=setTimeout((()=>t(...s)),100)}}((async()=>{await this.initSlideSize(),"papyrus"!==this.dir&&await this.slideTo(this.activeIndex);const t=!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement);await this.hideOrClearMouseCursorTimer(t),await this.showHideActionsSlot(t)})))}initSlideSize(){return new Promise((async t=>{const i=this.el.shadowRoot.querySelector("div.deckgo-deck");i?(this.embedded?await this.initSlideSizeEmbedded(i):await this.initSlideSizeStandard(i),t()):t()}))}initSlideSizeStandard(t){return new Promise((async i=>{if(!window||!screen)return void i();const s=await this.getSliderSize();t.style.setProperty("--slide-width",`${s.width}px`),"papyrus"===this.dir?(t.style.setProperty("--slide-min-height",`${s.height}px`),t.style.removeProperty("--slide-height")):(t.style.removeProperty("--slide-min-height"),t.style.setProperty("--slide-height",`${s.height}px`)),await this.initFontSize(t,{height:s.height,width:s.width}),i()}))}initSlideSizeEmbedded(t){return new Promise((async i=>{t.offsetParent?(t.offsetParent&&(t.offsetParent.clientWidth>0&&t.style.setProperty("--slide-width",t.offsetParent.clientWidth+"px"),t.offsetParent.clientHeight>0&&"papyrus"===this.dir&&(t.style.setProperty("--slide-min-height",t.offsetParent.clientHeight+"px"),t.style.removeProperty("--slide-height")),t.offsetParent.clientHeight>0&&"papyrus"!==this.dir&&(t.style.removeProperty("--slide-min-height"),t.style.setProperty("--slide-height",t.offsetParent.clientHeight+"px")),await this.initFontSize(t,{height:t.offsetParent.clientHeight,width:t.offsetParent.clientWidth})),i()):i()}))}async initFontSize(t,{height:i,width:s}){const e=s/16*9/576;t.style.setProperty("--slide-auto-font-size",i/576+"em"),t.style.setProperty("--slide-auto-ratio-font-size",`${e}em`)}initKeyboardAssist(){document&&this.keyboard&&document.addEventListener("keydown",this.keyboardAssist,{passive:!0})}async initLazyLoadContent(){window&&"IntersectionObserver"in window?await this.deferIntersectionObserverLoad():await this.lazyLoadAllContent()}async deferIntersectionObserverLoad(){const t=this.el.querySelectorAll(".deckgo-slide-container");!t||t.length<=0||(this.observer&&this.observer.disconnect(),this.observer=new IntersectionObserver(this.onIntersection,{rootMargin:"300px",threshold:0}),t.forEach((t=>{this.observer.observe(t)})))}async toggleKeyboardAssist(t){this.keyboard&&(t?document.addEventListener("keydown",this.keyboardAssist,{passive:!0}):document.removeEventListener("keydown",this.keyboardAssist,{passive:!0}))}async onDirectionMobileChange(){await this.initDirection()}async onDirectionChange(){await this.initDirection()}async initDirection(){this.dir=o()?this.directionMobile:this.direction}mousedown(t){this.start(t)}touchstart(t){this.start(t)}async mouseup(t){await this.stop(t)}async touchend(t){await this.stop(t)}async mousemove(t){await this.move(t)}async touchmove(t){await this.move(t)}async dblclick(){this.resetStart()}async contextMenu(){this.resetStart()}scrolling(t){this.block=!!t&&t.detail}async keypress(){await this.clearMouseCursorTimer(!0)}start(t){const i=window.getComputedStyle(t.target);this.block="text"===(null==i?void 0:i.userSelect)||"text"===(null==i?void 0:i.getPropertyValue("-webkit-user-select"))||"text"===(null==i?void 0:i.getPropertyValue("-moz-user-select"))||"text"===(null==i?void 0:i.getPropertyValue("-ms-user-select")),this.startX=a(t).clientX,this.startY=a(t).clientY}async move(t){if(await this.clearMouseCursorTimer(!0),this.block)return;if("slide"!==this.animation)return;const i=await this.getDelta(t);i&&(this.moveX(i),this.moveY(i),i.slider.style.setProperty("--transformXDuration","0ms"))}moveX(t){if("horizontal"!==this.dir)return;const i=t.swipeNext?this.deckMove-t.deltaX:this.deckMove+t.deltaX;t.slider.style.setProperty("--transformX",i+"px"),this.slideDrag.emit(i)}moveY(t){if("vertical"!==this.dir)return;const i=t.swipeNext?this.deckMove-t.deltaY:this.deckMove+t.deltaY;t.slider.style.setProperty("--transformY",i+"px"),this.slideDrag.emit(i)}async stop(t){if(this.block)return;const i=await this.getDelta(t);await this.swipeSlide(i),this.resetStart()}swipeSlide(t,i=!0){return new Promise((async s=>{if(!t||!window)return void s();let e=t.swipeNext&&this.activeIndex<this.length-1,n=!t.swipeNext&&this.activeIndex>0;if(this.rtl&&(e=t.swipeNext&&this.activeIndex>0,n=!t.swipeNext&&this.activeIndex<this.length-1),e||n){const s=await this.getSliderSize(),e=t.deltaY>s.height/this.autoSwipeRatio;(t.deltaX>s.width/this.autoSwipeRatio||e)&&(this.deckMove="horizontal"!==this.dir?t.swipeNext?this.deckMove-s.height:this.deckMove+s.height:t.swipeNext?this.deckMove-s.width:this.deckMove+s.width,this.isNextChange(t.swipeNext)?(this.activeIndex++,i&&this.slideNextDidChange.emit(this.activeIndex)):(this.activeIndex--,i&&this.slidePrevDidChange.emit(this.activeIndex)))}await this.doSwipeSlide(t.slider),s()}))}async getSliderSize(){if(!this.embedded)return this.getSliderSizeNotEmbededd();const t=this.el.shadowRoot.querySelector("div.deckgo-deck");return!t||!t.offsetParent||t.offsetParent.clientWidth<=0?this.getSliderSizeNotEmbededd():{width:t.offsetParent.clientWidth,height:t.offsetParent.clientHeight}}async getSliderSizeNotEmbededd(){return function(){if(!window||!navigator)return!1;let t=r();return/iPhone|iPod/i.test(t)||function(){if(!window||!navigator)return!1;let t=r();return!!/iPad/i.test(t)||/Macintosh/i.test(t)&&o()}()}()?{width:screen.width>window.innerWidth?screen.width:window.innerWidth,height:screen.height>window.innerHeight?screen.height:window.innerHeight}:{width:window.innerWidth,height:window.innerHeight}}isNextChange(t){return t&&!this.rtl||!t&&this.rtl}doSwipeSlide(t,i){return new Promise((s=>{if("horizontal"===this.dir&&t.style.setProperty("--transformX",this.deckMove+"px"),"vertical"===this.dir&&t.style.setProperty("--transformY",this.deckMove+"px"),t.style.setProperty("--transformXDuration","slide"===this.animation?(isNaN(i)?300:i)+"ms":"0ms"),"papyrus"===this.dir){const t=this.el.querySelector(".deckgo-slide-container:nth-child("+(this.activeIndex+1)+")");setTimeout((()=>{null==t||t.scrollIntoView("none"===this.animation?null:{behavior:"smooth",block:"nearest"})}),0)}this.slideWillChange.emit(this.deckMove),this.resetStart(),s()}))}resetStart(){this.startX=null,this.startY=null}async getDelta(t){if(!this.startX&&"horizontal"===this.dir)return null;if(!this.startY&&"vertical"===this.dir)return null;if("papyrus"===this.dir)return null;const i=this.el.shadowRoot.querySelector("div.deckgo-deck");if(!i)return null;const s=a(t).clientX,e=a(t).clientY;if(this.startX===s&&"horizontal"===this.dir)return null;if(this.startY===e&&"vertical"===this.dir)return null;const n=this.startX>s&&"horizontal"===this.dir,o=this.startY>e&&"vertical"===this.dir;return{slider:i,swipeNext:n||o,deltaX:n?this.startX-s:s-this.startX,deltaY:o?this.startY-e:e-this.startY}}async slideDidLoad(){await this.updateLength(),await this.afterSlidesDidLoad()}async updateLength(){const t=await this.getDefinedFilteredSlides();this.length=t?t.length:0}afterSlidesDidLoad(){return new Promise((async t=>{const i=await this.getDeckDefinition();i&&i.slides&&i.slides.length>0&&(this.slidesDidLoad.emit(i),await this.onAllSlidesDidLoad(),this.deckDidLoad.emit()),t()}))}onAllSlidesDidLoad(){return new Promise((async t=>{const i=await this.getDefinedFilteredSlides(),s=[];s.push(this.initLazyLoadContent()),s.push(c.loadSlots(this.el,i,"background",this.cloneBackground)),"papyrus"!==this.dir?(s.push(c.cloneSlots(this.el,i,"actions")),s.push(c.loadSlots(this.el,i,"header")),s.push(c.loadSlots(this.el,i,"footer"))):i&&i.length>0&&(s.push(c.cloneSlot(this.el,i[0],"actions")),s.push(c.loadSlot(this.el,i[0],"header")),s.push(c.loadSlot(this.el,i[i.length-1],"footer"))),(!this.reveal||!this.revealOnMobile&&o()||"papyrus"===this.dir)&&s.push(this.revealAllContent()),await Promise.all(s),t()}))}getDeckDefinition(){return new Promise((async t=>{const i=this.el.querySelectorAll(".deckgo-slide-container.hydrated");if(!i||i.length<=0)return void t(null);const s=await this.getDefinedFilteredSlides();if(i.length!==(s?s.length:0))return void t(null);const e=[];for(const t of Array.from(i)){const i=await h(t.attributes);e.push({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:i})}const n=await h(this.el.attributes),a=this.el.querySelector(":scope > [slot='background']");t({slides:e,attributes:n,background:a?a.innerHTML:null,reveal:this.reveal,revealOnMobile:this.revealOnMobile})}))}getSlideDefinition(t){return new Promise((async i=>{const s=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");var e;i(await(e=s,new Promise((async t=>{if(!e)return void t(null);let i=await h(e.attributes);t({template:e.tagName?e.tagName.toLowerCase():void 0,content:e.innerHTML,attributes:i})}))))}))}getDefinedFilteredSlides(){return new Promise((async t=>{const i=this.el.children;t(await this.filterSlides(i))}))}loadBackground(){return this.loadSlots("background",this.cloneBackground)}loadHeader(){return this.loadSlots("header")}loadFooter(){return this.loadSlots("footer")}async loadSlots(t,i=!0){const s=await this.getDefinedFilteredSlides();!s||s.length<=0||(await c.removeSlots(s,t),await c.loadSlots(this.el,s,t,i))}filterSlides(t){return new Promise((i=>{i(!t||t.length<=0?null:Array.from(t).filter((t=>!t.hasAttribute("slot")||""===t.getAttribute("slot"))))}))}isBeginning(){return new Promise((t=>{t(0===this.activeIndex)}))}isEnd(){return new Promise((t=>{t(this.activeIndex===this.length-1)}))}getActiveIndex(){return new Promise((t=>{t(this.activeIndex)}))}getLength(){return new Promise((t=>{t(this.length)}))}async slideNext(t,i){await this.slideNextPrev(!this.rtl,t,i)}async slidePrev(t,i){await this.slideNextPrev(this.rtl,t,i)}async slideNextPrev(t,i=!0,s){const e=this.el.shadowRoot.querySelector("div.deckgo-deck");if(!e||!window)return;let n;if(n=!i||await this.beforeSwipe(this.isNextChange(t)),n){const i=await this.getSliderSize(),n={slider:e,swipeNext:t,deltaX:i.width,deltaY:i.height};await this.swipeSlide(n,s),await this.afterSwipe(t)}else s&&(t?this.slideNextDidAnimate.emit():this.slidePrevDidAnimate.emit())}beforeSwipe(t){return new Promise((async i=>{const s=this.el.querySelector(".deckgo-slide-container:nth-child("+(this.activeIndex+1)+")");i(!s||await s.beforeSwipe(t,this.reveal))}))}afterSwipe(t){return new Promise((async i=>{const s=t?this.activeIndex-1:this.activeIndex+1;if(isNaN(s)||s<0||s>this.length)return void i();const e=this.el.querySelector(".deckgo-slide-container:nth-child("+(s+1)+")");e?(await e.afterSwipe(),i()):i()}))}async lazyLoadContent(t){const i=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");i&&await i.lazyLoadContent()}async slideTo(t,i,s=!0){if(t>this.length||t<0)return;const e=this.el.shadowRoot.querySelector("div.deckgo-deck");if(!e||!window)return;const n=await this.getSliderSize();this.deckMove=t*("horizontal"===this.dir?n.width:n.height)*(this.rtl?1:-1),this.activeIndex=t,await this.doSwipeSlide(e,i),e.parentElement.scrollTo(0,0),s&&this.slideToChange.emit(t)}async deleteActiveSlide(){if(this.activeIndex>this.length||this.activeIndex<0)return;const t=this.el.querySelector(".deckgo-slide-container:nth-child("+(this.activeIndex+1)+")");t&&(t.parentElement.removeChild(t),this.activeIndex=this.activeIndex>0?this.activeIndex-1:0,this.length=this.length>0?this.length-1:0,this.length>0&&await this.slideTo(this.activeIndex,0))}async blockSlide(t){this.block=t,this.block&&this.resetStart()}toggleFullScreen(){return new Promise((async t=>{const i=window.document,s=i.documentElement,e=s.requestFullscreen||s.mozRequestFullScreen||s.webkitRequestFullScreen||s.msRequestFullscreen;i.fullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement||i.msFullscreenElement?(i.exitFullscreen||i.mozCancelFullScreen||i.webkitExitFullscreen||i.msExitFullscreen).call(i):e.call(s),t()}))}async hideOrClearMouseCursorTimer(t){t?(this.fullscreen=!0,setTimeout((async()=>{await this.showHideMouseCursor(!1)}),500),this.hideMouseCursorWithDelay()):(await this.clearMouseCursorTimer(!1),this.fullscreen=!1)}async clearMouseCursorTimer(t){this.fullscreen&&(this.idleMouseTimer>0&&clearTimeout(this.idleMouseTimer),await this.showHideMouseCursor(!0),t&&this.hideMouseCursorWithDelay())}hideMouseCursorWithDelay(){this.fullscreen&&(this.idleMouseTimer=setTimeout((async()=>{await this.showHideMouseCursor(!1)}),this.idleMouseTimeout))}showHideMouseCursor(t){return new Promise((i=>{if(!this.fullscreen)return void i();if(!this.cursorHidden&&t)return void i();const s=this.el.shadowRoot.querySelector("div.deckgo-deck");s?(s.style.setProperty("cursor",t?"inherit":"none"),this.mouseInactivity.emit(t),this.cursorHidden=!t,i()):i()}))}showHideActionsSlot(t){return new Promise((i=>{const s=this.el.shadowRoot.querySelector("div.deckgo-deck");s?t?s.style.setProperty("--slide-actions-display","none"):s.style.removeProperty("--slide-actions-display"):i()}))}doPrint(){return new Promise((async t=>{window&&(await this.lazyLoadAllContent(),window.print()),t()}))}lazyLoadAllContent(){const t=[];for(let i=0;i<this.length;i++)t.push(this.lazyLoadContent(i));return Promise.all(t)}async onRevealChange(){this.reveal?await this.redoRevealContent():await this.revealAllContent()}revealAllContent(){return new Promise((async t=>{const i=[];for(let t=0;t<this.length;t++)i.push(this.revealContent(t));await Promise.all(i),t()}))}redoRevealContent(){return new Promise((async t=>{const i=[];for(let t=0;t<this.length;t++)i.push(t<this.activeIndex?this.revealContent(t):this.hideContent(t));await Promise.all(i),t()}))}async revealContent(t){const i=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");i&&await i.revealContent()}async hideContent(t){const i=this.el.querySelector(".deckgo-slide-container:nth-child("+(t+1)+")");i&&await i.hideContent()}async initAutoSlide(){"true"===this.autoSlide&&await this.onAutoSlide()}async onAutoSlide(){let t;this.idleSlideLoopTimer=setTimeout((()=>t=this.idleMouseTimer),this.idleMouseTimeout),"true"===this.autoSlide?this.slideLoopInterval=setInterval((async()=>{t===this.idleMouseTimer?await this.isEnd()?await this.slideTo(0,0):await this.slideNext(!0):t=this.idleMouseTimer}),this.autoSlideInterval):clearInterval(this.slideLoopInterval)}render(){return t(e,{class:`${this.dir}`},t("main",null,this.renderAnimation(),t("div",{class:"deckgo-deck"},t("slot",null),t("slot",{name:"actions"}),t("slot",{name:"background"})),t("slot",{name:"pager"})))}renderAnimation(){return"fade"!==this.animation||"papyrus"===this.dir?t(u,null):[t(d,null),t(l,{index:this.activeIndex})]}get el(){return n(this)}static get watchers(){return{directionMobile:["onDirectionMobileChange"],direction:["onDirectionChange"],reveal:["onRevealChange"],autoSlide:["onAutoSlide"]}}};w.style=":host{display:block;position:relative;width:100%;height:100%;contain:size style}main{position:absolute;left:0;right:0;top:0;bottom:0;box-sizing:border-box;-webkit-overflow-scrolling:touch;will-change:scroll-position;touch-action:auto}:host(.vertical) main,:host(.horizontal) main{overflow:hidden}:host(.papyrus) main{overflow-x:hidden}:host(.vertical) main,:host(.papyrus) main{touch-action:pan-y;overscroll-behavior-y:contain}:host(.horizontal) main{touch-action:pan-x;overscroll-behavior-x:contain}div.deckgo-deck{display:flex;position:absolute;top:0;bottom:0;z-index:var(--zIndex);--transformX:0px;--transformY:0px;--transformXDuration:0ms;transform:translate3d(var(--transformX), var(--transformY), 0px);transition-duration:var(--transformXDuration, 0ms);--slide-width:100vw;--slide-height:100%;font-size:var(--slide-font-size, var(--slide-auto-font-size, 1em))}div.deckgo-deck ::-webkit-scrollbar{display:none}:host(.vertical) div.deckgo-deck,:host(.papyrus) div.deckgo-deck{flex-direction:column}:host(.papyrus) div.deckgo-deck{--slide-user-select:auto}::slotted([slot=background]){display:var(--background-display, none);pointer-events:none}::slotted([slot=actions]){display:none}@media print{div.deckgo-deck{display:initial;position:initial}::slotted([slot=background]){display:none}}";export{w as deckgo_deck}