bs5-lightbox
Advanced tools
Comparing version 1.7.6 to 1.7.7
/*! | ||
* Lightbox for Bootstrap 5 v1.7.6 (https://trvswgnr.github.io/bs5-lightbox/) | ||
* Lightbox for Bootstrap 5 v1.7.7 (https://trvswgnr.github.io/bs5-lightbox/) | ||
* Copyright 2021 Travis Aaron Wagner (https://github.com/trvswgnr/) | ||
* Licensed under MIT (https://github.com/trvswgnr/bs5-lightbox/blob/main/LICENSE) | ||
*/!function(){var t={728:function(t,e,i){var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(360),o=s(i(127)),r=s(i(591)),a=s(i(802)),l=s(i(642)),c="carousel",d={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},u={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},h="next",f="prev",m="left",g="right",p={ArrowLeft:g,ArrowRight:m},_="slid.bs.carousel",b="active",v=".active.carousel-item";class y extends l.default{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=a.default.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return d}static get NAME(){return c}next(){this._slide(h)}nextWhenVisible(){!document.hidden&&(0,n.isVisible)(this._element)&&this.next()}prev(){this._slide(f)}pause(t){t||(this._isPaused=!0),a.default.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&((0,n.triggerTransitionEnd)(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(t){this._activeElement=a.default.findOne(v,this._element);const e=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void o.default.one(this._element,_,(()=>this.to(t)));if(e===t)return this.pause(),void this.cycle();const i=t>e?h:f;this._slide(i,this._items[t])}_getConfig(t){return t=Object.assign(Object.assign(Object.assign({},d),r.default.getDataAttributes(this._element)),"object"==typeof t?t:{}),(0,n.typeCheckConfig)(c,t,u),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e&&this._slide(e>0?g:m)}_addEventListeners(){this._config.keyboard&&o.default.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(o.default.on(this._element,"mouseenter.bs.carousel",(t=>this.pause(t))),o.default.on(this._element,"mouseleave.bs.carousel",(t=>this.cycle(t)))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}dispose(){Data.remove(this._element,this.constructor.DATA_KEY),o.default.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach((t=>{this[t]=null}))}_addTouchEventListeners(){const t=t=>this._pointerEvent&&("pen"===t.pointerType||"touch"===t.pointerType),e=e=>{t(e)?this.touchStartX=e.clientX:this._pointerEvent||(this.touchStartX=e.touches[0].clientX)},i=t=>{this.touchDeltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this.touchStartX},s=e=>{t(e)&&(this.touchDeltaX=e.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((t=>this.cycle(t)),500+this._config.interval))};a.default.find(".carousel-item img",this._element).forEach((t=>{o.default.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()))})),this._pointerEvent?(o.default.on(this._element,"pointerdown.bs.carousel",(t=>e(t))),o.default.on(this._element,"pointerup.bs.carousel",(t=>s(t))),this._element.classList.add("pointer-event")):(o.default.on(this._element,"touchstart.bs.carousel",(t=>e(t))),o.default.on(this._element,"touchmove.bs.carousel",(t=>i(t))),o.default.on(this._element,"touchend.bs.carousel",(t=>s(t))))}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=p[t.key];e&&(t.preventDefault(),this._slide(e))}_getItemIndex(t){return this._items=t&&t.parentNode?a.default.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByOrder(t,e){const i=t===h;return(0,n.getNextActiveElement)(this._items,e,i,this._config.wrap)}_triggerSlideEvent(t,e){const i=this._getItemIndex(t),s=this._getItemIndex(a.default.findOne(v,this._element));return o.default.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:e,from:s,to:i})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=a.default.findOne(".active",this._indicatorsElement);e.classList.remove(b),e.removeAttribute("aria-current");const i=a.default.find("[data-bs-target]",this._indicatorsElement);for(let e=0;e<i.length;e++)if(Number.parseInt(i[e].getAttribute("data-bs-slide-to"),10)===this._getItemIndex(t)){i[e].classList.add(b),i[e].setAttribute("aria-current","true");break}}}_updateInterval(){const t=this._activeElement||a.default.findOne(v,this._element);if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);e?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=e):this._config.interval=this._config.defaultInterval||this._config.interval}_slide(t,e){const i=this._directionToOrder(t),s=a.default.findOne(v,this._element),r=this._getItemIndex(s),l=e||this._getItemByOrder(i,s),c=this._getItemIndex(l),d=Boolean(this._interval),u=i===h,f=u?"carousel-item-start":"carousel-item-end",m=u?"carousel-item-next":"carousel-item-prev",g=this._orderToDirection(i);if(l&&l.classList.contains(b))return void(this._isSliding=!1);if(this._isSliding)return;if(this._triggerSlideEvent(l,g).defaultPrevented)return;if(!s||!l)return;this._isSliding=!0,d&&this.pause(),this._setActiveIndicatorElement(l),this._activeElement=l;const p=()=>{o.default.trigger(this._element,_,{relatedTarget:l,direction:g,from:r,to:c})};if(this._element.classList.contains("slide")){l.classList.add(m),(0,n.reflow)(l),s.classList.add(f),l.classList.add(f);const t=()=>{l.classList.remove(f,m),l.classList.add(b),s.classList.remove(b,m,f),this._isSliding=!1,setTimeout(p,0)};this._queueCallback(t,s,!0)}else s.classList.remove(b),l.classList.add(b),this._isSliding=!1,p();d&&this.cycle()}_directionToOrder(t){return[g,m].includes(t)?(0,n.isRTL)()?t===m?f:h:t===m?h:f:t}_orderToDirection(t){return[h,f].includes(t)?(0,n.isRTL)()?t===f?m:g:t===f?g:m:t}static carouselInterface(t,e){const i=y.getOrCreateInstance(t,e);let{_config:s}=i;"object"==typeof e&&(s=Object.assign(Object.assign({},s),e));const n="string"==typeof e?e:s.slide;if("number"==typeof e)i.to(e);else if("string"==typeof n){if(void 0===i[n])throw new TypeError(`No method named "${n}"`);i[n]()}else s.interval&&s.ride&&(i.pause(),i.cycle())}static jQueryInterface(t){return this.each((function(){y.carouselInterface(this,t)}))}static dataApiClickHandler(t){let e=(0,n.getElementFromSelector)(this);if(!e||!e.classList.contains("carousel"))return;const i=Object.assign(Object.assign({},r.default.getDataAttributes(e)),r.default.getDataAttributes(this));console.log(i);const s=this.getAttribute("data-bs-slide-to");s&&(i.interval=!1),y.carouselInterface(e,i),s&&y.getInstance(e).to(s),t.preventDefault()}}e.default=y},315:function(t,e,i){var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(360),o=s(i(127)),r=s(i(591)),a=s(i(802)),l=s(i(189)),c=s(i(642)),d=s(i(836)),u=s(i(574)),h="modal",f=".bs.modal",m="Escape",g={backdrop:!0,keyboard:!0,focus:!0},p={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"},_="resize.bs.modal",b="click.dismiss.bs.modal",v="keydown.dismiss.bs.modal",y="mousedown.dismiss.bs.modal",E="modal-open",w="show",A="modal-static";class T extends c.default{constructor(t,e){super(t),this._config=this._getConfig(e),this._dialog=a.default.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollBar=new l.default}static get Default(){return g}static get NAME(){return h}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){if(this._isShown||this._isTransitioning)return;o.default.trigger(this._element,"show.bs.modal",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._scrollBar.hide(),document.body.classList.add(E),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),o.default.on(this._dialog,y,(()=>{o.default.one(this._element,"mouseup.dismiss.bs.modal",(t=>{t.target===this._element&&(this._ignoreBackdropClick=!0)}))})),this._showBackdrop((()=>this._showElement(t))))}hide(){if(!this._isShown||this._isTransitioning)return;if(o.default.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),this._focustrap.deactivate(),this._element.classList.remove(w),o.default.off(this._element,b),o.default.off(this._dialog,y),this._queueCallback((()=>this._hideModal()),this._element,t)}dispose(){[window,this._dialog].forEach((t=>o.default.off(t,f))),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new d.default({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new u.default({trapElement:this._element})}_getConfig(t){return t=Object.assign(Object.assign(Object.assign({},g),r.default.getDataAttributes(this._element)),"object"==typeof t?t:{}),(0,n.typeCheckConfig)(h,t,p),t}_showElement(t){const e=this._isAnimated(),i=a.default.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,i&&(i.scrollTop=0),e&&(0,n.reflow)(this._element),this._element.classList.add(w);this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,o.default.trigger(this._element,"shown.bs.modal",{relatedTarget:t})}),this._dialog,e)}_setEscapeEvent(){this._isShown?o.default.on(this._element,v,(t=>{this._config.keyboard&&t.key===m?(t.preventDefault(),this.hide()):this._config.keyboard||t.key!==m||this._triggerBackdropTransition()})):o.default.off(this._element,v)}_setResizeEvent(){this._isShown?o.default.on(window,_,(()=>this._adjustDialog())):o.default.off(window,_)}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(E),this._resetAdjustments(),this._scrollBar.reset(),o.default.trigger(this._element,"hidden.bs.modal")}))}_showBackdrop(t){o.default.on(this._element,b,(t=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:t.target===t.currentTarget&&(!0===this._config.backdrop?this.hide():"static"===this._config.backdrop&&this._triggerBackdropTransition())})),this._backdrop.show(t)}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(o.default.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const{classList:t,scrollHeight:e,style:i}=this._element,s=e>document.documentElement.clientHeight;!s&&"hidden"===i.overflowY||t.contains(A)||(s||(i.overflowY="hidden"),t.add(A),this._queueCallback((()=>{t.remove(A),s||this._queueCallback((()=>{i.overflowY=""}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;(!i&&t&&!(0,n.isRTL)()||i&&!t&&(0,n.isRTL)())&&(this._element.style.paddingLeft=`${e}px`),(i&&!t&&!(0,n.isRTL)()||!i&&t&&(0,n.isRTL)())&&(this._element.style.paddingRight=`${e}px`)}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const i=T.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}}))}}e.default=T},590:function(t,e,i){var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=s(i(315)),o=s(i(728)),r={Modal:n.default,Carousel:o.default};class a{constructor(t,e={}){this.hash=this.randomHash(),this.settings=Object.assign(Object.assign(Object.assign({},r.Modal.Default),r.Carousel.Default),{interval:!1,target:'[data-toggle="lightbox"]',gallery:"",size:"xl"}),this.modalOptions=(()=>this.setOptionsFromSettings(r.Modal.Default))(),this.carouselOptions=(()=>this.setOptionsFromSettings(r.Carousel.Default))(),"string"==typeof t&&(this.settings.target=t,t=document.querySelector(this.settings.target)),this.settings=Object.assign(Object.assign({},this.settings),e),this.el=t,this.type=t.dataset.type||"image",this.src=this.getSrc(t),this.src="image"!==this.type?"embed"+this.src:this.src,this.sources=this.getGalleryItems(),this.createCarousel(),this.createModal()}show(){document.body.appendChild(this.modalElement),this.modal.show()}hide(){this.modal.hide()}setOptionsFromSettings(t){return Object.keys(t).reduce(((t,e)=>Object.assign(t,{[e]:this.settings[e]})),{})}getSrc(t){let e=t.dataset.src||t.dataset.remote||t.href||"http://via.placeholder.com/1600x900";/\:\/\//.test(e)||(e=window.location.origin+e);const i=new URL(e);return(t.dataset.footer||t.dataset.caption)&&i.searchParams.set("caption",t.dataset.footer||t.dataset.caption),i.toString()}getGalleryItems(){let t;if(this.settings.gallery){if(Array.isArray(this.settings.gallery))return this.settings.gallery;t=this.settings.gallery}else this.el.dataset.gallery&&(t=this.el.dataset.gallery);return t?[...new Set(Array.from(document.querySelectorAll(`[data-gallery="${t}"]`),(t=>`${t.dataset.type?"embed":""}${this.getSrc(t)}`)))]:[this.src]}getYoutubeId(t){if(!t)return!1;const e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return!(!e||11!==e[2].length)&&e[2]}getInstagramEmbed(t){if(/instagram/.test(t))return`<iframe src="${t+=/\/embed$/.test(t)?"":"/embed"}" class="start-50 translate-middle-x" style="max-width: 500px" frameborder="0" scrolling="no" allowtransparency="true"></iframe>`}isEmbed(t){const e=new RegExp(a.allowedEmbedTypes.join("|")).test(t),i=/\.(png|jpe?g|gif|svg|webp)/.test(t);return e||!i}createCarousel(){const t=document.createElement("template"),e=this.sources.map(((t,e)=>{t=t.replace(/\/$/,"");let i="";i+=/\.png/.test(t)?"this.add.previousSibling.remove()":"";let s=`<img src="${t}" class="d-block w-100 h-100 img-fluid" style="z-index: 1; object-fit: contain;" onload="${i}" />`,n="";const o=this.getInstagramEmbed(t),r=this.getYoutubeId(t);this.isEmbed(t)&&(/^embed/.test(t)&&(t=t.substring(5)),r&&(t=`https://www.youtube.com/embed/${r}`,n='title="YouTube video player" frameborder="0" allow="accelerometer autoplay clipboard-write encrypted-media gyroscope picture-in-picture"'),s=o||`<iframe src="${t}" ${n} allowfullscreen></iframe>`);const a=new URLSearchParams(t.split("?")[1]);let l="";return a.get("caption")&&(l=`<p class="lightbox-caption m-0 p-2 text-center text-white small"><em>${a.get("caption")}</em></p>`),`\n\t\t\t\t<div class="carousel-item ${e?"":"active"}" style="min-height: 100px">\n\t\t\t\t\t<div class="position-absolute top-50 start-50 translate-middle text-white"><div class="spinner-border" style="width: 3rem height: 3rem" role="status"></div></div>\n\t\t\t\t\t<div class="ratio ratio-16x9" style="background-color: #000;">${s}</div>\n\t\t\t\t\t${l}\n\t\t\t\t</div>`})).join(""),i=this.sources.length<2?"":`\n\t\t\t<button class="carousel-control carousel-control-prev h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-${this.hash}" data-bs-slide="prev">\n\t\t\t\t<span class="carousel-control-prev-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Previous</span>\n\t\t\t</button>\n\t\t\t<button class="carousel-control carousel-control-next h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-${this.hash}" data-bs-slide="next">\n\t\t\t\t<span class="carousel-control-next-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Next</span>\n\t\t\t</button>`;let s="lightbox-carousel carousel";"fullscreen"===this.settings.size&&(s+=" position-absolute w-100 translate-middle top-50 start-50");const n=`\n\t\t\t<div id="lightboxCarousel-${this.hash}" class="${s}" data-bs-ride="carousel" data-bs-interval="${this.carouselOptions.interval}">\n\t\t\t\t<div class="carousel-inner">\n\t\t\t\t\t${e}\n\t\t\t\t</div>\n\t\t\t\t${i}\n\t\t\t</div>`;return t.innerHTML=n.trim(),this.carouselElement=t.content.firstChild,this.carousel=new r.Carousel(this.carouselElement,this.carouselOptions),this.carousel.to(this.sources.includes(this.src)?this.sources.indexOf(this.src):0),this.carousel}createModal(){const t=document.createElement("template"),e=`\n\t\t\t<div class="modal lightbox fade" id="lightboxModal-${this.hash}" tabindex="-1" aria-hidden="true">\n\t\t\t\t<div class="modal-dialog modal-dialog-centered modal-${this.settings.size}">\n\t\t\t\t\t<div class="modal-content border-0 bg-transparent">\n\t\t\t\t\t\t<div class="modal-body p-0">\n\t\t\t\t\t\t\t<button type="button" class="btn-close position-absolute top-0 end-0 p-3" data-bs-dismiss="modal" aria-label="Close" style="z-index: 2; background: none;"><svg xmlns="http://www.w3.org/2000/svg" style="position: relative; top: -5px;" viewBox="0 0 16 16" fill="#fff"><path d="M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z"/></svg></button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>`;return t.innerHTML=e.trim(),this.modalElement=t.content.firstChild,this.modalElement.querySelector(".modal-body").appendChild(this.carouselElement),this.modalElement.addEventListener("hidden.bs.modal",(()=>this.modalElement.remove())),this.modalElement.querySelector("[data-bs-dismiss]").addEventListener("click",(()=>this.modal.hide())),this.modal=new r.Modal(this.modalElement,this.modalOptions),this.modal}randomHash(t=8){return Array.from({length:t},(()=>Math.floor(36*Math.random()).toString(36))).join("")}}a.allowedEmbedTypes=["embed","youtube","vimeo","instagram","url"],a.allowedMediaTypes=[...a.allowedEmbedTypes,"image"],a.defaultSelector='[data-toggle="lightbox"]',a.initialize=function(t){t.preventDefault();new a(this).show()},document.querySelectorAll(a.defaultSelector).forEach((t=>t.addEventListener("click",a.initialize))),e.default=a},642:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});const s=new Map;var n={set(t,e,i){s.has(t)||s.set(t,new Map);const n=s.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(t,e)=>s.has(t)&&s.get(t).get(e)||null,remove(t,e){if(!s.has(t))return;const i=s.get(t);i.delete(e),0===i.size&&s.delete(t)}},o=i(360),r=i(127);var a=class{constructor(t){(t=(0,o.getElement)(t))&&(this._element=t,n.set(this._element,this.constructor.DATA_KEY,this))}dispose(){n.remove(this._element,this.constructor.DATA_KEY),r.default.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach((t=>{this[t]=null}))}_queueCallback(t,e,i=!0){(0,o.executeAfterTransition)(t,e,i)}static getInstance(t){return n.get((0,o.getElement)(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.1.1"}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}}},127:function(t,e,i){"use strict";i.r(e);var s=i(360);const n=/[^.]*(?=\..*)\.|.*/,o=/\..*/,r=/::\d+$/,a={};let l=1;const c={mouseenter:"mouseover",mouseleave:"mouseout"},d=/^(mouseenter|mouseleave)/i,u=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function h(t,e){return e&&`${e}::${l++}`||t.uidEvent||l++}function f(t){const e=h(t);return t.uidEvent=e,a[e]=a[e]||{},a[e]}function m(t,e,i=null){const s=Object.keys(t);for(let n=0,o=s.length;n<o;n++){const o=t[s[n]];if(o.originalHandler===e&&o.delegationSelector===i)return o}return null}function g(t,e,i){const s="string"==typeof e,n=s?i:e;let o=b(t);return u.has(o)||(o=t),[s,n,o]}function p(t,e,i,s,o){if("string"!=typeof e||!t)return;if(i||(i=s,s=null),d.test(e)){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};s?s=t(s):i=t(i)}const[r,a,l]=g(e,i,s),c=f(t),u=c[l]||(c[l]={}),p=m(u,a,r?i:null);if(p)return void(p.oneOff=p.oneOff&&o);const _=h(a,e.replace(n,"")),b=r?function(t,e,i){return function s(n){const o=t.querySelectorAll(e);for(let{target:r}=n;r&&r!==this;r=r.parentNode)for(let a=o.length;a--;)if(o[a]===r)return n.delegateTarget=r,s.oneOff&&v.off(t,n.type,e,i),i.apply(r,[n]);return null}}(t,i,s):function(t,e){return function i(s){return s.delegateTarget=t,i.oneOff&&v.off(t,s.type,e),e.apply(t,[s])}}(t,i);b.delegationSelector=r?i:null,b.originalHandler=a,b.oneOff=o,b.uidEvent=_,u[_]=b,t.addEventListener(l,b,r)}function _(t,e,i,s,n){const o=m(e[i],s,n);o&&(t.removeEventListener(i,o,Boolean(n)),delete e[i][o.uidEvent])}function b(t){return t=t.replace(o,""),c[t]||t}const v={on(t,e,i,s){p(t,e,i,s,!1)},one(t,e,i,s){p(t,e,i,s,!0)},off(t,e,i,s){if("string"!=typeof e||!t)return;const[n,o,a]=g(e,i,s),l=a!==e,c=f(t),d=e.startsWith(".");if(void 0!==o){if(!c||!c[a])return;return void _(t,c,a,o,n?i:null)}d&&Object.keys(c).forEach((i=>{!function(t,e,i,s){const n=e[i]||{};Object.keys(n).forEach((o=>{if(o.includes(s)){const s=n[o];_(t,e,i,s.originalHandler,s.delegationSelector)}}))}(t,c,i,e.slice(1))}));const u=c[a]||{};Object.keys(u).forEach((i=>{const s=i.replace(r,"");if(!l||e.includes(s)){const e=u[i];_(t,c,a,e.originalHandler,e.delegationSelector)}}))},trigger(t,e,i){if("string"!=typeof e||!t)return null;const n=(0,s.getjQuery)(),o=b(e),r=e!==o,a=u.has(o);let l,c=!0,d=!0,h=!1,f=null;return r&&n&&(l=n.Event(e,i),n(t).trigger(l),c=!l.isPropagationStopped(),d=!l.isImmediatePropagationStopped(),h=l.isDefaultPrevented()),a?(f=document.createEvent("HTMLEvents"),f.initEvent(o,c,!0)):f=new CustomEvent(e,{bubbles:c,cancelable:!0}),void 0!==i&&Object.keys(i).forEach((t=>{Object.defineProperty(f,t,{get:()=>i[t]})})),h&&f.preventDefault(),d&&t.dispatchEvent(f),f.defaultPrevented&&void 0!==l&&l.preventDefault(),f}};e.default=v},591:function(t,e,i){"use strict";function s(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function n(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}i.r(e);const o={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${n(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${n(e)}`)},getDataAttributes(t){if(!t)return{};const e={};return Object.keys(t.dataset).filter((t=>t.startsWith("bs"))).forEach((i=>{let n=i.replace(/^bs/,"");n=n.charAt(0).toLowerCase()+n.slice(1,n.length),e[n]=s(t.dataset[i])})),e},getDataAttribute:(t,e)=>s(t.getAttribute(`data-bs-${n(e)}`)),offset(t){const e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}},position:t=>({top:t.offsetTop,left:t.offsetLeft})};e.default=o},802:function(t,e,i){"use strict";i.r(e);var s=i(360);const n={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let s=t.parentNode;for(;s&&s.nodeType===Node.ELEMENT_NODE&&3!==s.nodeType;)s.matches(e)&&i.push(s),s=s.parentNode;return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(", ");return this.find(e,t).filter((t=>!(0,s.isDisabled)(t)&&(0,s.isVisible)(t)))}};e.default=n},836:function(t,e,i){"use strict";i.r(e);var s=i(127),n=i(360);const o={className:"modal-backdrop",isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},r={className:"string",isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},a="backdrop",l="show",c=`mousedown.bs.${a}`;e.default=class{constructor(t){this._config=this._getConfig(t),this._isAppended=!1,this._element=null}show(t){this._config.isVisible?(this._append(),this._config.isAnimated&&(0,n.reflow)(this._getElement()),this._getElement().classList.add(l),this._emulateAnimation((()=>{(0,n.execute)(t)}))):(0,n.execute)(t)}hide(t){this._config.isVisible?(this._getElement().classList.remove(l),this._emulateAnimation((()=>{this.dispose(),(0,n.execute)(t)}))):(0,n.execute)(t)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_getConfig(t){return(t={...o,..."object"==typeof t?t:{}}).rootElement=(0,n.getElement)(t.rootElement),(0,n.typeCheckConfig)(a,t,r),t}_append(){this._isAppended||(this._config.rootElement.append(this._getElement()),s.default.on(this._getElement(),c,(()=>{(0,n.execute)(this._config.clickCallback)})),this._isAppended=!0)}dispose(){this._isAppended&&(s.default.off(this._element,c),this._element.remove(),this._isAppended=!1)}_emulateAnimation(t){(0,n.executeAfterTransition)(t,this._getElement(),this._config.isAnimated)}}},574:function(t,e,i){"use strict";i.r(e);var s=i(127),n=i(802),o=i(360);const r={trapElement:null,autofocus:!0},a={trapElement:"element",autofocus:"boolean"},l=".bs.focustrap",c=`focusin${l}`,d=`keydown.tab${l}`,u="backward";e.default=class{constructor(t){this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}activate(){const{trapElement:t,autofocus:e}=this._config;this._isActive||(e&&t.focus(),s.default.off(document,l),s.default.on(document,c,(t=>this._handleFocusin(t))),s.default.on(document,d,(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,s.default.off(document,l))}_handleFocusin(t){const{target:e}=t,{trapElement:i}=this._config;if(e===document||e===i||i.contains(e))return;const s=n.default.focusableChildren(i);0===s.length?i.focus():this._lastTabNavDirection===u?s[s.length-1].focus():s[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?u:"forward")}_getConfig(t){return t={...r,..."object"==typeof t?t:{}},(0,o.typeCheckConfig)("focustrap",t,a),t}}},360:function(t,e,i){"use strict";i.r(e),i.d(e,{getElement:function(){return u},getUID:function(){return n},getSelectorFromElement:function(){return r},getElementFromSelector:function(){return a},getTransitionDurationFromElement:function(){return l},triggerTransitionEnd:function(){return c},isElement:function(){return d},typeCheckConfig:function(){return h},isVisible:function(){return f},isDisabled:function(){return m},findShadowRoot:function(){return g},noop:function(){return p},getNextActiveElement:function(){return k},reflow:function(){return _},getjQuery:function(){return b},onDOMContentLoaded:function(){return y},isRTL:function(){return E},defineJQueryPlugin:function(){return w},execute:function(){return A},executeAfterTransition:function(){return T}});const s="transitionend",n=t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t},o=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return e},r=t=>{const e=o(t);return e&&document.querySelector(e)?e:null},a=t=>{const e=o(t);return e?document.querySelector(e):null},l=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const s=Number.parseFloat(e),n=Number.parseFloat(i);return s||n?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0},c=t=>{t.dispatchEvent(new Event(s))},d=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),u=t=>d(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(t):null,h=(t,e,i)=>{Object.keys(i).forEach((s=>{const n=i[s],o=e[s],r=o&&d(o)?"element":null==(a=o)?`${a}`:{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase();var a;if(!new RegExp(n).test(r))throw new TypeError(`${t.toUpperCase()}: Option "${s}" provided type "${r}" but expected type "${n}".`)}))},f=t=>!(!d(t)||0===t.getClientRects().length)&&"visible"===getComputedStyle(t).getPropertyValue("visibility"),m=t=>!t||t.nodeType!==Node.ELEMENT_NODE||(!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled"))),g=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?g(t.parentNode):null},p=()=>{},_=t=>{t.offsetHeight},b=()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},v=[],y=t=>{"loading"===document.readyState?(v.length||document.addEventListener("DOMContentLoaded",(()=>{v.forEach((t=>t()))})),v.push(t)):t()},E=()=>"rtl"===document.documentElement.dir,w=t=>{y((()=>{const e=b();if(e){const i=t.NAME,s=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=s,t.jQueryInterface)}}))},A=t=>{"function"==typeof t&&t()},T=(t,e,i=!0)=>{if(!i)return void A(t);const n=l(e)+5;let o=!1;const r=({target:i})=>{i===e&&(o=!0,e.removeEventListener(s,r),A(t))};e.addEventListener(s,r),setTimeout((()=>{o||c(e)}),n)},k=(t,e,i,s)=>{let n=t.indexOf(e);if(-1===n)return t[!i&&s?t.length-1:0];const o=t.length;return n+=i?1:-1,s&&(n=(n+o)%o),t[Math.max(0,Math.min(n,o-1))]}},189:function(t,e,i){"use strict";i.r(e);var s=i(802),n=i(591),o=i(360);const r=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",a=".sticky-top";e.default=class{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,"paddingRight",(e=>e+t)),this._setElementAttributes(r,"paddingRight",(e=>e+t)),this._setElementAttributes(a,"marginRight",(e=>e-t))}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const s=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+s)return;this._saveInitialAttribute(t,e);const n=window.getComputedStyle(t)[e];t.style[e]=`${i(Number.parseFloat(n))}px`}))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(r,"paddingRight"),this._resetElementAttributes(a,"marginRight")}_saveInitialAttribute(t,e){const i=t.style[e];i&&n.default.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=n.default.getDataAttribute(t,e);void 0===i?t.style.removeProperty(e):(n.default.removeDataAttribute(t,e),t.style[e]=i)}))}_applyManipulationCallback(t,e){(0,o.isElement)(t)?e(t):s.default.find(t,this._element).forEach(e)}isOverflowing(){return this.getWidth()>0}}}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,i),o.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},function(){"use strict";var t=i(590),e=i.n(t);window.bootstrap&&(window.bootstrap.Lightbox=e())}()}(); |
{ | ||
"name": "bs5-lightbox", | ||
"version": "1.7.6", | ||
"version": "1.7.7", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Travis Aaron Wagner", |
@@ -19,3 +19,3 @@ # Lightbox for Bootstrap 5 | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/bs5-lightbox@1.7.2/dist/index.bundle.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/bs5-lightbox@1.7.7/dist/index.bundle.min.js"></script> | ||
``` | ||
@@ -22,0 +22,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package