Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.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.1.3
to
8.1.4
+1
dist/deckdeckgo/p-99cdb572.entry.js
import{h as t,r as i,c as s,H as e,g as n}from"./p-5f829155.js";function a(t){return t.changedTouches?t.changedTouches[0]:t}function o(){if(!window||!navigator)return!1;const t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}function r(t){return new Promise(async i=>{if(!t||t.length<=0)return void i(null);const 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 h{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));await function(t){return new Promise(i=>{t?(t.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")}),i()):i()})}(n),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 c=()=>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 "),d=({index:i})=>t("style",null,`\n ::slotted(.deckgo-slide-container:nth-child(${i+1})) {\n visibility: initial;\n opacity: 1;\n };\n `),l=()=>t("style",null,"\n ::slotted(.deckgo-slide-container) {\n transition: var(--slide-animation);\n }\n "),u=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):-1!==["ArrowRight","j","PageDown"].indexOf(t.key)&&await this.slideNextPrev(!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=!(!window||!screen)&&window.innerHeight==screen.height;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){document&&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;const t=navigator.userAgent||navigator.vendor||window.opera;return/iPad|iPhone|iPod/i.test(t)}()?{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(h.loadSlots(this.el,i,"background",this.cloneBackground)),"papyrus"!==this.dir?(s.push(h.cloneSlots(this.el,i,"actions")),s.push(h.loadSlots(this.el,i,"header")),s.push(h.loadSlots(this.el,i,"footer"))):i&&i.length>0&&(s.push(h.cloneSlot(this.el,i[0],"actions")),s.push(h.loadSlot(this.el,i[0],"header")),s.push(h.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 r(t.attributes);e.push({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:i})}const n=await r(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)+")"),e=await function(t){return new Promise(async i=>{if(!t)return void i(null);const s=await r(t.attributes);i({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:s})})}(s);i(e)})}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 h.removeSlots(s,t),await h.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?"initial":"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(l,null):[t(c,null),t(d,{index:this.activeIndex})]}get el(){return n(this)}static get watchers(){return{directionMobile:["onDirectionMobileChange"],direction:["onDirectionChange"],reveal:["onRevealChange"],autoSlide:["onAutoSlide"]}}};u.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{u as deckgo_deck}
+6
-0

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

# 8.1.4 (2021-03-25)
### Style
- set a CSS font size for aspect ratio slides
# 8.1.3 (2021-02-17)

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

+5
-3

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

}
await this.initFontSize(slider, sliderSize.height);
await this.initFontSize(slider, { height: sliderSize.height, width: sliderSize.width });
resolve();

@@ -429,3 +429,3 @@ });

}
await this.initFontSize(slider, slider.offsetParent.clientHeight);
await this.initFontSize(slider, { height: slider.offsetParent.clientHeight, width: slider.offsetParent.clientWidth });
}

@@ -435,6 +435,8 @@ resolve();

}
async initFontSize(slider, height) {
async initFontSize(slider, { height, width }) {
// 576px height = font-size 16px or 1em (relative to the font-size of its direct or nearest parent)
const fontSize = height / 576;
const ratioFontSize = width / 16 * 9 / 576;
slider.style.setProperty('--slide-auto-font-size', `${fontSize}em`);
slider.style.setProperty('--slide-auto-ratio-font-size', `${ratioFontSize}em`);
}

@@ -441,0 +443,0 @@ initKeyboardAssist() {

@@ -138,3 +138,3 @@ import { Component, Element, Listen, Method, Prop, State, Event, h, Watch, Host } from '@stencil/core';

}
await this.initFontSize(slider, sliderSize.height);
await this.initFontSize(slider, { height: sliderSize.height, width: sliderSize.width });
resolve();

@@ -161,3 +161,3 @@ });

}
await this.initFontSize(slider, slider.offsetParent.clientHeight);
await this.initFontSize(slider, { height: slider.offsetParent.clientHeight, width: slider.offsetParent.clientWidth });
}

@@ -167,6 +167,8 @@ resolve();

}
async initFontSize(slider, height) {
async initFontSize(slider, { height, width }) {
// 576px height = font-size 16px or 1em (relative to the font-size of its direct or nearest parent)
const fontSize = height / 576;
const ratioFontSize = width / 16 * 9 / 576;
slider.style.setProperty('--slide-auto-font-size', `${fontSize}em`);
slider.style.setProperty('--slide-auto-ratio-font-size', `${ratioFontSize}em`);
}

@@ -173,0 +175,0 @@ initKeyboardAssist() {

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

import{p as e,b as o}from"./p-5f829155.js";(()=>{const o=import.meta.url,i={};return""!==o&&(i.resourcesUrl=new URL(".",o).href),e(i)})().then(e=>o([["p-4da67c0c",[[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-5f829155.js";(()=>{const o=import.meta.url,i={};return""!==o&&(i.resourcesUrl=new URL(".",o).href),e(i)})().then(e=>o([["p-99cdb572",[[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));

@@ -402,3 +402,3 @@ import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-a633c8ab.js';

}
await this.initFontSize(slider, sliderSize.height);
await this.initFontSize(slider, { height: sliderSize.height, width: sliderSize.width });
resolve();

@@ -425,3 +425,3 @@ });

}
await this.initFontSize(slider, slider.offsetParent.clientHeight);
await this.initFontSize(slider, { height: slider.offsetParent.clientHeight, width: slider.offsetParent.clientWidth });
}

@@ -431,6 +431,8 @@ resolve();

}
async initFontSize(slider, height) {
async initFontSize(slider, { height, width }) {
// 576px height = font-size 16px or 1em (relative to the font-size of its direct or nearest parent)
const fontSize = height / 576;
const ratioFontSize = width / 16 * 9 / 576;
slider.style.setProperty('--slide-auto-font-size', `${fontSize}em`);
slider.style.setProperty('--slide-auto-ratio-font-size', `${ratioFontSize}em`);
}

@@ -437,0 +439,0 @@ initKeyboardAssist() {

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

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

import{h as t,r as i,c as s,H as e,g as n}from"./p-5f829155.js";function a(t){return t.changedTouches?t.changedTouches[0]:t}function o(){if(!window||!navigator)return!1;const t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}function r(t){return new Promise(async i=>{if(!t||t.length<=0)return void i(null);const 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 h{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));await function(t){return new Promise(i=>{t?(t.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")}),i()):i()})}(n),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 c=()=>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 "),d=({index:i})=>t("style",null,`\n ::slotted(.deckgo-slide-container:nth-child(${i+1})) {\n visibility: initial;\n opacity: 1;\n };\n `),l=()=>t("style",null,"\n ::slotted(.deckgo-slide-container) {\n transition: var(--slide-animation);\n }\n "),u=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):-1!==["ArrowRight","j","PageDown"].indexOf(t.key)&&await this.slideNextPrev(!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=!(!window||!screen)&&window.innerHeight==screen.height;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,s.height),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,t.offsetParent.clientHeight)),i()):i()})}async initFontSize(t,i){t.style.setProperty("--slide-auto-font-size",i/576+"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){document&&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;const t=navigator.userAgent||navigator.vendor||window.opera;return/iPad|iPhone|iPod/i.test(t)}()?{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(h.loadSlots(this.el,i,"background",this.cloneBackground)),"papyrus"!==this.dir?(s.push(h.cloneSlots(this.el,i,"actions")),s.push(h.loadSlots(this.el,i,"header")),s.push(h.loadSlots(this.el,i,"footer"))):i&&i.length>0&&(s.push(h.cloneSlot(this.el,i[0],"actions")),s.push(h.loadSlot(this.el,i[0],"header")),s.push(h.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 r(t.attributes);e.push({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:i})}const n=await r(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)+")"),e=await function(t){return new Promise(async i=>{if(!t)return void i(null);const s=await r(t.attributes);i({template:t.tagName?t.tagName.toLowerCase():void 0,content:t.innerHTML,attributes:s})})}(s);i(e)})}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 h.removeSlots(s,t),await h.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?"initial":"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(l,null):[t(c,null),t(d,{index:this.activeIndex})]}get el(){return n(this)}static get watchers(){return{directionMobile:["onDirectionMobileChange"],direction:["onDirectionChange"],reveal:["onRevealChange"],autoSlide:["onAutoSlide"]}}};u.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{u as deckgo_deck}