diff --git a/dist/VueFinalModal.esm.js b/dist/VueFinalModal.esm.js index 65158b6d..654bb112 100644 --- a/dist/VueFinalModal.esm.js +++ b/dist/VueFinalModal.esm.js @@ -1,2 +1,2 @@ -function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n0){var n=this.api.openedModals[this.api.openedModals.length-1];n.handleLockScroll(),(n.focusRetain||n.focusTrap)&&n.$refs.vfmContainer.focus(),!n.hideOverlay&&(n.visibility.overlay=!0)}this.startTransitionLeave()},startTransitionEnter:function(){this.visibility.overlay=!0,this.visibility.modal=!0},startTransitionLeave:function(){this.visibility.overlay=!1,this.visibility.modal=!1},handleLockScroll:function(){this.value&&(this.lockScroll?this.api.lockScroll():this.api.unlockScroll())},getAttachElement:function(){return!1!==this.attach&&("string"==typeof this.attach?!!window&&window.document.querySelector(this.attach):this.attach)},beforeOverlayEnter:function(){this.overlayTransitionState=u},afterOverlayEnter:function(){this.overlayTransitionState=d},beforeOverlayLeave:function(){this.overlayTransitionState=v},afterOverlayLeave:function(){this.overlayTransitionState=f},beforeModalEnter:function(){this.$emit("before-open"),this.modalTransitionState=u},afterModalEnter:function(){this.modalTransitionState=d,(this.focusRetain||this.focusTrap)&&this.$refs.vfmContainer.focus(),this.focusTrap&&this.$focusTrap.enable(this.$refs.vfmContainer),this.$emit("opened")},beforeModalLeave:function(){this.$emit("before-close"),this.modalTransitionState=v,this.$focusTrap.enabled()&&this.$focusTrap.disable()},afterModalLeave:function(){this.modalTransitionState=f,this.modalStackIndex=null,0===this.api.openedModals.length&&this.lockScroll&&this.api.unlockScroll(),this.$emit("closed")},onClickContainer:function(){this.$emit("click-outside"),this.clickToClose&&this.$emit("input",!1)},onEsc:function(e){27===e.keyCode&&this.visible&&this.escToClose&&this.$emit("input",!1)}}};var m,y=function(e,t,n,o,i,a,r,s,l,c){"boolean"!=typeof r&&(l=s,s=r,r=!1);var d,u="function"==typeof n?n.options:n;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,i&&(u.functional=!0)),o&&(u._scopeId=o),a?(d=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(a)},u._ssrRegister=d):t&&(d=r?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),d)if(u.functional){var f=u.render;u.render=function(e,t){return d.call(t),f(e,t)}}else{var v=u.beforeCreate;u.beforeCreate=v?[].concat(v,d):[d]}return n},b="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var g={};const S=y({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.ssr||e.visible?n("div",{directives:[{name:"show",rawName:"v-show",value:!e.ssr||e.visible,expression:"!ssr || visible"}],staticClass:"vfm vfm--inset",class:[!1===e.attach?"vfm--fixed":"vfm--absolute",{"vfm--prevent-none":e.preventClick}],style:{zIndex:e.calculateZIndex},on:{keydown:e.onEsc}},[n("transition",{attrs:{name:e.overlayTransition},on:{"before-enter":e.beforeOverlayEnter,"after-enter":e.afterOverlayEnter,"before-leave":e.beforeOverlayLeave,"after-leave":e.afterOverlayLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.hideOverlay&&e.visibility.overlay,expression:"!hideOverlay && visibility.overlay"}],staticClass:"vfm__overlay vfm--overlay vfm--absolute vfm--inset",class:e.overlayClass,style:e.overlayStyle})]),e._v(" "),n("transition",{attrs:{name:e.transition},on:{"before-enter":e.beforeModalEnter,"after-enter":e.afterModalEnter,"before-leave":e.beforeModalLeave,"after-leave":e.afterModalLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.visibility.modal,expression:"visibility.modal"}],ref:"vfmContainer",staticClass:"vfm__container vfm--absolute vfm--inset vfm--outline-none",class:e.classes,style:e.styles,attrs:{"aria-expanded":e.visibility.modal.toString(),role:"dialog","aria-modal":"true",tabindex:"-1"},on:{click:e.onClickContainer}},[n("div",{ref:"vfmContent",staticClass:"vfm__content",class:[e.contentClass,{"vfm--prevent-auto":e.preventClick}],style:e.contentStyle,on:{click:function(e){e.stopPropagation()}}},[e._t("default")],2)])])],1):e._e()},staticRenderFns:[]},(function(e){e&&e("data-v-0ee8c783_0",{source:".vfm--fixed[data-v-0ee8c783]{position:fixed}.vfm--absolute[data-v-0ee8c783]{position:absolute}.vfm--inset[data-v-0ee8c783]{top:0;right:0;bottom:0;left:0}.vfm--overlay[data-v-0ee8c783]{background-color:rgba(0,0,0,.5)}.vfm--prevent-none[data-v-0ee8c783]{pointer-events:none}.vfm--prevent-auto[data-v-0ee8c783]{pointer-events:auto}.vfm--outline-none[data-v-0ee8c783]:focus{outline:0}.vfm-enter-active[data-v-0ee8c783],.vfm-leave-active[data-v-0ee8c783]{transition:opacity .2s}.vfm-enter[data-v-0ee8c783],.vfm-leave-to[data-v-0ee8c783]{opacity:0}",map:void 0,media:void 0})}),p,"data-v-0ee8c783",false,undefined,!1,(function(e){return function(e,t){return function(e,t){var n=b?t.media||"default":e,o=g[n]||(g[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);var i=t.source;if(t.map&&(i+="\n/*# sourceURL="+t.map.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===m&&(m=document.head||document.getElementsByTagName("head")[0]),m.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(i),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{var a=o.ids.size-1,r=document.createTextNode(i),s=o.element.childNodes;s[a]&&o.element.removeChild(s[a]),s.length?o.element.insertBefore(r,s[a]):o.element.appendChild(r)}}}(e,t)}}),void 0,void 0);var k=function(e){return!(!e||e.nodeType!==Node.ELEMENT_NODE)};function w(e){return function(){return{isScrollLocked:!1,openedModals:[],modals:[],show:function(e){this.toggle(e,!0)},hide:function(e){this.toggle(e,!1)},hideAll:function(){this.openedModals.forEach((function(e){e.$emit("input",!1)}))},toggle:function(e,t){var n=this.modals.find((function(t){return t.name===e}));void 0!==n&&n.$emit("input",void 0===t?!n.value:t)},lockScroll:function(){var t,n,o;this.isScrollLocked||(e.isMobile?(t=document.body,o="hidden",(n="overflow")&&k(t)&&(t.style[n]=o)):window.addEventListener("wheel",this.lockScrollListener,{passive:!1}),this.isScrollLocked=!0)},unlockScroll:function(){var t,n;e.isMobile?(t=document.body,(n="overflow")&&k(t)&&(t.style[n]="")):window.removeEventListener("wheel",this.lockScrollListener),this.isScrollLocked=!1},lockScrollListener:function(e){e.preventDefault()}}}}var E=M,T=M,O=M,x=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,C=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function M(e){e||(e={});var t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;var n=e.tablet?C.test(t):x.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}E.isMobile=T,E.default=O;var _={componentName:"VueFinalModal",key:"$vfm",isMobile:E()};export default function(){return{install:function(e,t){var n=Object.assign({},_,t),o=e.prototype[n.key];e.options.components[n.componentName]?console.warn(o?"[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.":"[vue-final-modal] Duplicate registration componentName of VueFinalModal."):(o||function(e,t){var n=w(t)();Object.defineProperty(e.prototype,t.key,{get:function(){return n}})}(e,n),function(e,t){e.component(t.componentName,i(i({},S),{},{props:i(i({},S.props),{},{$_options:{type:Object,default:function(){return t}}})}))}(e,n))}}} +function e(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n({modalStackIndex:null,visible:!1,visibility:{modal:!1,overlay:!1},overlayTransitionState:null,modalTransitionState:null}),computed:{api(){return this[this.$_options.key]},isComponentReadyToBeDestroyed(){return(this.hideOverlay||this.overlayTransitionState===f)&&this.modalTransitionState===f},calculateZIndex(){return"boolean"==typeof this.zIndex?this.attach?"unset":this.zIndexBase+2*(this.modalStackIndex||0):this.zIndex}},watch:{value(e){this.mounted(),e||this.close()},lockScroll:"handleLockScroll",hideOverlay(e){this.value&&!e&&(this.visibility.overlay=!0)},attach:"mounted",isComponentReadyToBeDestroyed(e){e&&(this.visible=!1)}},created(){this.api.modals.push(this)},mounted(){this.$focusTrap=new l,this.mounted()},beforeDestroy(){this.close(),this.$el.remove();let e=this.api.modals.findIndex((e=>e===this));this.api.modals.splice(e,1)},methods:{mounted(){if(this.value){let e=this.getAttachElement();if(e||!1===this.attach){!1!==this.attach&&e.appendChild(this.$el);let t=this.api.openedModals.findIndex((e=>e===this));-1!==t&&this.api.openedModals.splice(t,1),this.api.openedModals.push(this),this.modalStackIndex=this.api.openedModals.length-1,this.handleLockScroll(),this.api.openedModals.filter((e=>e!==this)).forEach(((t,n)=>{t.getAttachElement()===e&&(t.modalStackIndex=n,t.visibility.overlay=!1)})),this.visible=!0,this.$nextTick((()=>{this.startTransitionEnter()}))}else!1!==e&&console.warn("Unable to locate target ".concat(this.attach))}},close(){let e=this.api.openedModals.findIndex((e=>e===this));if(-1!==e&&this.api.openedModals.splice(e,1),this.api.openedModals.length>0){const e=this.api.openedModals[this.api.openedModals.length-1];e.handleLockScroll(),(e.focusRetain||e.focusTrap)&&e.$refs.vfmContainer.focus(),!e.hideOverlay&&(e.visibility.overlay=!0)}this.startTransitionLeave()},startTransitionEnter(){this.visibility.overlay=!0,this.visibility.modal=!0},startTransitionLeave(){this.visibility.overlay=!1,this.visibility.modal=!1},handleLockScroll(){this.value&&(this.lockScroll?this.api.lockScroll():this.api.unlockScroll())},getAttachElement(){let e;return e=!1!==this.attach&&("string"==typeof this.attach?!!window&&window.document.querySelector(this.attach):this.attach),e},beforeOverlayEnter(){this.overlayTransitionState=d},afterOverlayEnter(){this.overlayTransitionState=c},beforeOverlayLeave(){this.overlayTransitionState=u},afterOverlayLeave(){this.overlayTransitionState=f},beforeModalEnter(){this.$emit("before-open"),this.modalTransitionState=d},afterModalEnter(){this.modalTransitionState=c,(this.focusRetain||this.focusTrap)&&this.$refs.vfmContainer.focus(),this.focusTrap&&this.$focusTrap.enable(this.$refs.vfmContainer),this.$emit("opened")},beforeModalLeave(){this.$emit("before-close"),this.modalTransitionState=u,this.$focusTrap.enabled()&&this.$focusTrap.disable()},afterModalLeave(){this.modalTransitionState=f,this.modalStackIndex=null,0===this.api.openedModals.length&&this.lockScroll&&this.api.unlockScroll(),this.$emit("closed")},onClickContainer(){this.$emit("click-outside"),this.clickToClose&&this.$emit("input",!1)},onEsc(e){27===e.keyCode&&this.visible&&this.escToClose&&this.$emit("input",!1)}}};var p,m=function(e,t,n,i,o,a,r,s,l,c){"boolean"!=typeof r&&(l=s,s=r,r=!1);var d,f="function"==typeof n?n.options:n;if(e&&e.render&&(f.render=e.render,f.staticRenderFns=e.staticRenderFns,f._compiled=!0,o&&(f.functional=!0)),i&&(f._scopeId=i),a?(d=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(a)},f._ssrRegister=d):t&&(d=r?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),d)if(f.functional){var u=f.render;f.render=function(e,t){return d.call(t),u(e,t)}}else{var v=f.beforeCreate;f.beforeCreate=v?[].concat(v,d):[d]}return n},y="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var b={};const g=m({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.ssr||e.visible?n("div",{directives:[{name:"show",rawName:"v-show",value:!e.ssr||e.visible,expression:"!ssr || visible"}],staticClass:"vfm vfm--inset",class:[!1===e.attach?"vfm--fixed":"vfm--absolute",{"vfm--prevent-none":e.preventClick}],style:{zIndex:e.calculateZIndex},on:{keydown:e.onEsc}},[n("transition",{attrs:{name:e.overlayTransition},on:{"before-enter":e.beforeOverlayEnter,"after-enter":e.afterOverlayEnter,"before-leave":e.beforeOverlayLeave,"after-leave":e.afterOverlayLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.hideOverlay&&e.visibility.overlay,expression:"!hideOverlay && visibility.overlay"}],staticClass:"vfm__overlay vfm--overlay vfm--absolute vfm--inset",class:e.overlayClass,style:e.overlayStyle})]),e._v(" "),n("transition",{attrs:{name:e.transition},on:{"before-enter":e.beforeModalEnter,"after-enter":e.afterModalEnter,"before-leave":e.beforeModalLeave,"after-leave":e.afterModalLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.visibility.modal,expression:"visibility.modal"}],ref:"vfmContainer",staticClass:"vfm__container vfm--absolute vfm--inset vfm--outline-none",class:e.classes,style:e.styles,attrs:{"aria-expanded":e.visibility.modal.toString(),role:"dialog","aria-modal":"true",tabindex:"-1"},on:{click:function(t){return t.target!==t.currentTarget?null:e.onClickContainer(t)}}},[n("div",{ref:"vfmContent",staticClass:"vfm__content",class:[e.contentClass,{"vfm--prevent-auto":e.preventClick}],style:e.contentStyle},[e._t("default")],2)])])],1):e._e()},staticRenderFns:[]},(function(e){e&&e("data-v-7c0fc555_0",{source:".vfm--fixed[data-v-7c0fc555]{position:fixed}.vfm--absolute[data-v-7c0fc555]{position:absolute}.vfm--inset[data-v-7c0fc555]{top:0;right:0;bottom:0;left:0}.vfm--overlay[data-v-7c0fc555]{background-color:rgba(0,0,0,.5)}.vfm--prevent-none[data-v-7c0fc555]{pointer-events:none}.vfm--prevent-auto[data-v-7c0fc555]{pointer-events:auto}.vfm--outline-none[data-v-7c0fc555]:focus{outline:0}.vfm-enter-active[data-v-7c0fc555],.vfm-leave-active[data-v-7c0fc555]{transition:opacity .2s}.vfm-enter[data-v-7c0fc555],.vfm-leave-to[data-v-7c0fc555]{opacity:0}",map:void 0,media:void 0})}),h,"data-v-7c0fc555",false,undefined,!1,(function(e){return function(e,t){return function(e,t){var n=y?t.media||"default":e,i=b[n]||(b[n]={ids:new Set,styles:[]});if(!i.ids.has(e)){i.ids.add(e);var o=t.source;if(t.map&&(o+="\n/*# sourceURL="+t.map.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),i.element||(i.element=document.createElement("style"),i.element.type="text/css",t.media&&i.element.setAttribute("media",t.media),void 0===p&&(p=document.head||document.getElementsByTagName("head")[0]),p.appendChild(i.element)),"styleSheet"in i.element)i.styles.push(o),i.element.styleSheet.cssText=i.styles.filter(Boolean).join("\n");else{var a=i.ids.size-1,r=document.createTextNode(o),s=i.element.childNodes;s[a]&&i.element.removeChild(s[a]),s.length?i.element.insertBefore(r,s[a]):i.element.appendChild(r)}}}(e,t)}}),void 0,void 0);var k=function(e){return!(!e||e.nodeType!==Node.ELEMENT_NODE)};function S(e){return function(){return{isScrollLocked:!1,openedModals:[],modals:[],show:function(e){this.toggle(e,!0)},hide:function(e){this.toggle(e,!1)},hideAll:function(){this.openedModals.forEach((function(e){e.$emit("input",!1)}))},toggle:function(e,t){var n=this.modals.find((function(t){return t.name===e}));void 0!==n&&n.$emit("input",void 0===t?!n.value:t)},lockScroll:function(){var t,n,i;this.isScrollLocked||(e.isMobile?(t=document.body,i="hidden",(n="overflow")&&k(t)&&(t.style[n]=i)):window.addEventListener("wheel",this.lockScrollListener,{passive:!1}),this.isScrollLocked=!0)},unlockScroll:function(){var t,n;e.isMobile?(t=document.body,(n="overflow")&&k(t)&&(t.style[n]="")):window.removeEventListener("wheel",this.lockScrollListener),this.isScrollLocked=!1},lockScrollListener:function(e){e.preventDefault()}}}}var w=C,E=C,T=C,O=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,x=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function C(e){e||(e={});var t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;var n=e.tablet?x.test(t):O.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}w.isMobile=E,w.default=T;var M={componentName:"VueFinalModal",key:"$vfm",isMobile:w()};export default function(){return{install:function(e,t){var n=Object.assign({},M,t),o=e.prototype[n.key];e.options.components[n.componentName]?console.warn(o?"[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.":"[vue-final-modal] Duplicate registration componentName of VueFinalModal."):(o||function(e,t){var n=S(t)();Object.defineProperty(e.prototype,t.key,{get:function(){return n}})}(e,n),function(e,t){e.component(t.componentName,i(i({},g),{},{props:i(i({},g.props),{},{$_options:{type:Object,default:function(){return t}}})}))}(e,n))}}} //# sourceMappingURL=VueFinalModal.esm.js.map diff --git a/dist/VueFinalModal.esm.js.map b/dist/VueFinalModal.esm.js.map index 89fba501..c07a827d 100644 --- a/dist/VueFinalModal.esm.js.map +++ b/dist/VueFinalModal.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"VueFinalModal.esm.js","sources":["../lib/utils/focusTrap.js","../lib/VueFinalModal.vue","../lib/utils/dom.js","../lib/PluginCore.js","../lib/utils/errors.js","../node_modules/is-mobile/index.js","../lib/Plugin.js"],"sourcesContent":["// stolen from vue-js-modal\n\nconst FOCUSABLE_ELEMENTS_QUERY =\n 'button:not([disabled]), ' +\n 'select:not([disabled]), ' +\n 'a[href]:not([disabled]), ' +\n 'area[href]:not([disabled]), ' +\n '[contentEditable=\"\"]:not([disabled]), ' +\n '[contentEditable=\"true\"]:not([disabled]), ' +\n '[contentEditable=\"TRUE\"]:not([disabled]), ' +\n 'textarea:not([disabled]), ' +\n 'iframe:not([disabled]), ' +\n 'input:not([disabled]), ' +\n 'summary:not([disabled]), ' +\n '[tabindex]:not([tabindex=\"-1\"])'\n\nconst isTabPressed = event => {\n return event.key === 'Tab' || event.keyCode === 9\n}\n\nconst querySelectorAll = (element, selector) => {\n return [...(element.querySelectorAll(selector) || [])]\n}\n\nconst queryFocusableElements = element => {\n return querySelectorAll(element, FOCUSABLE_ELEMENTS_QUERY)\n}\n\nconst isFocused = element => {\n return element == document.activeElement\n}\n\nconst isNothingFocused = () => {\n return !document.activeElement\n}\n\nclass FocusTrap {\n constructor() {\n this.root = null\n this.elements = []\n\n this.onKeyDown = this.onKeyDown.bind(this)\n this.enable = this.enable.bind(this)\n this.disable = this.disable.bind(this)\n this.firstElement = this.firstElement.bind(this)\n this.lastElement = this.lastElement.bind(this)\n }\n\n lastElement() {\n return this.elements[this.elements.length - 1] || null\n }\n\n firstElement() {\n return this.elements[0] || null\n }\n\n onKeyDown(event) {\n if (!isTabPressed(event)) {\n return\n }\n\n // SHIFT + TAB\n if (event.shiftKey) {\n if (isFocused(this.firstElement())) {\n this.lastElement().focus()\n event.preventDefault()\n }\n return\n }\n\n // TAB\n if (isNothingFocused() || isFocused(this.lastElement())) {\n this.firstElement().focus()\n event.preventDefault()\n return\n }\n }\n\n enabled() {\n return !!this.root\n }\n\n enable(root) {\n if (!root) {\n return\n }\n\n this.root = root\n this.elements = queryFocusableElements(this.root)\n\n this.root.addEventListener('keydown', this.onKeyDown)\n }\n\n disable() {\n this.root.removeEventListener('keydown', this.onKeyDown)\n this.root = null\n }\n}\n\nexport default FocusTrap\n","\n\n\n\n\n","// Stolen from bootstrap vue\n\n// Determine if an element is an HTML element\nexport const isElement = el => !!(el && el.nodeType === Node.ELEMENT_NODE)\n\n// Set an style property on an element\nexport const setStyle = (el, prop, value) => {\n if (prop && isElement(el)) {\n el.style[prop] = value\n }\n}\n\n// Remove an style property from an element\nexport const removeStyle = (el, prop) => {\n if (prop && isElement(el)) {\n el.style[prop] = ''\n }\n}\n","import VueFinalModal from './VueFinalModal.vue'\nimport { setStyle, removeStyle } from './utils/dom.js'\n\nfunction createVfm(options) {\n let vfm\n\n return function() {\n vfm = {\n isScrollLocked: false,\n openedModals: [],\n modals: [],\n show(name) {\n this.toggle(name, true)\n },\n hide(name) {\n this.toggle(name, false)\n },\n hideAll() {\n this.openedModals.forEach(modal => {\n modal.$emit('input', false)\n })\n },\n toggle(name, show) {\n const modal = this.modals.find(modal => modal.name === name)\n if (modal !== undefined) {\n modal.$emit('input', show === undefined ? !modal.value : show)\n }\n },\n lockScroll() {\n if (this.isScrollLocked) return\n if (options.isMobile) {\n setStyle(document.body, 'overflow', 'hidden')\n } else {\n window.addEventListener('wheel', this.lockScrollListener, { passive: false })\n }\n this.isScrollLocked = true\n },\n unlockScroll() {\n if (options.isMobile) {\n removeStyle(document.body, 'overflow')\n } else {\n window.removeEventListener('wheel', this.lockScrollListener)\n }\n this.isScrollLocked = false\n },\n lockScrollListener(e) {\n e.preventDefault()\n }\n }\n return vfm\n }\n}\n\nexport function bindPrototype(Vue, options) {\n const vfm = createVfm(options)()\n Object.defineProperty(Vue.prototype, options.key, {\n get() {\n return vfm\n }\n })\n}\n\nexport function registComponent(Vue, options) {\n Vue.component(options.componentName, {\n ...VueFinalModal,\n props: { ...VueFinalModal.props, $_options: { type: Object, default: () => options } }\n })\n}\n","export const DUPLICATE_PLUGIN_COMPONENT =\n '[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.'\n\nexport const DUPLICATE_COMPONENT = '[vue-final-modal] Duplicate registration componentName of VueFinalModal.'\n","'use strict'\r\n\r\nmodule.exports = isMobile\r\nmodule.exports.isMobile = isMobile\r\nmodule.exports.default = isMobile\r\n\r\nvar mobileRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i\r\n\r\nvar tabletRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i\r\n\r\nfunction isMobile (opts) {\r\n if (!opts) opts = {}\r\n var ua = opts.ua\r\n if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent\r\n if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {\r\n ua = ua.headers['user-agent']\r\n }\r\n if (typeof ua !== 'string') return false\r\n\r\n var result = opts.tablet ? tabletRE.test(ua) : mobileRE.test(ua)\r\n\r\n if (\r\n !result &&\r\n opts.tablet &&\r\n opts.featureDetect &&\r\n navigator &&\r\n navigator.maxTouchPoints > 1 &&\r\n ua.indexOf('Macintosh') !== -1 &&\r\n ua.indexOf('Safari') !== -1\r\n ) {\r\n result = true\r\n }\r\n\r\n return result\r\n}\r\n","import { bindPrototype, registComponent } from './PluginCore'\nimport { DUPLICATE_PLUGIN_COMPONENT, DUPLICATE_COMPONENT } from './utils/errors'\nimport mobile from 'is-mobile'\n\nconst defaultOptions = {\n componentName: 'VueFinalModal',\n key: '$vfm',\n isMobile: mobile()\n}\n\nconst Plugin = () => ({\n install(Vue, options) {\n const _options = Object.assign({}, defaultOptions, options)\n const isDuplicateKey = Vue.prototype[_options.key]\n const isDuplicateComponent = Vue.options.components[_options.componentName]\n\n if (isDuplicateComponent) {\n console.warn(isDuplicateKey ? DUPLICATE_PLUGIN_COMPONENT : DUPLICATE_COMPONENT)\n } else {\n if (!isDuplicateKey) {\n bindPrototype(Vue, _options)\n }\n registComponent(Vue, _options)\n }\n }\n})\n\nexport default Plugin\n"],"names":["queryFocusableElements","element","selector","querySelectorAll","isFocused","document","activeElement","FocusTrap","root","elements","onKeyDown","this","bind","enable","disable","firstElement","lastElement","length","event","key","keyCode","isTabPressed","shiftKey","focus","preventDefault","addEventListener","removeEventListener","isElement","el","nodeType","Node","ELEMENT_NODE","createVfm","options","isScrollLocked","openedModals","modals","show","name","toggle","hide","hideAll","forEach","modal","$emit","find","undefined","value","lockScroll","prop","isMobile","body","style","window","lockScrollListener","passive","unlockScroll","e","mobileRE","tabletRE","opts","ua","navigator","userAgent","headers","result","tablet","test","featureDetect","maxTouchPoints","indexOf","defaultOptions","componentName","mobile","install","Vue","_options","Object","assign","isDuplicateKey","prototype","components","console","warn","vfm","defineProperty","get","bindPrototype","component","VueFinalModal","props","$_options","type","default","registComponent"],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"VueFinalModal.esm.js","sources":["../lib/utils/focusTrap.js","../lib/VueFinalModal.vue","../lib/utils/dom.js","../lib/PluginCore.js","../lib/utils/errors.js","../node_modules/is-mobile/index.js","../lib/Plugin.js"],"sourcesContent":["// stolen from vue-js-modal\n\nconst FOCUSABLE_ELEMENTS_QUERY =\n 'button:not([disabled]), ' +\n 'select:not([disabled]), ' +\n 'a[href]:not([disabled]), ' +\n 'area[href]:not([disabled]), ' +\n '[contentEditable=\"\"]:not([disabled]), ' +\n '[contentEditable=\"true\"]:not([disabled]), ' +\n '[contentEditable=\"TRUE\"]:not([disabled]), ' +\n 'textarea:not([disabled]), ' +\n 'iframe:not([disabled]), ' +\n 'input:not([disabled]), ' +\n 'summary:not([disabled]), ' +\n '[tabindex]:not([tabindex=\"-1\"])'\n\nconst isTabPressed = event => {\n return event.key === 'Tab' || event.keyCode === 9\n}\n\nconst querySelectorAll = (element, selector) => {\n return [...(element.querySelectorAll(selector) || [])]\n}\n\nconst queryFocusableElements = element => {\n return querySelectorAll(element, FOCUSABLE_ELEMENTS_QUERY)\n}\n\nconst isFocused = element => {\n return element == document.activeElement\n}\n\nconst isNothingFocused = () => {\n return !document.activeElement\n}\n\nclass FocusTrap {\n constructor() {\n this.root = null\n this.elements = []\n\n this.onKeyDown = this.onKeyDown.bind(this)\n this.enable = this.enable.bind(this)\n this.disable = this.disable.bind(this)\n this.firstElement = this.firstElement.bind(this)\n this.lastElement = this.lastElement.bind(this)\n }\n\n lastElement() {\n return this.elements[this.elements.length - 1] || null\n }\n\n firstElement() {\n return this.elements[0] || null\n }\n\n onKeyDown(event) {\n if (!isTabPressed(event)) {\n return\n }\n\n // SHIFT + TAB\n if (event.shiftKey) {\n if (isFocused(this.firstElement())) {\n this.lastElement().focus()\n event.preventDefault()\n }\n return\n }\n\n // TAB\n if (isNothingFocused() || isFocused(this.lastElement())) {\n this.firstElement().focus()\n event.preventDefault()\n return\n }\n }\n\n enabled() {\n return !!this.root\n }\n\n enable(root) {\n if (!root) {\n return\n }\n\n this.root = root\n this.elements = queryFocusableElements(this.root)\n\n this.root.addEventListener('keydown', this.onKeyDown)\n }\n\n disable() {\n this.root.removeEventListener('keydown', this.onKeyDown)\n this.root = null\n }\n}\n\nexport default FocusTrap\n","\n\n\n\n\n","// Stolen from bootstrap vue\n\n// Determine if an element is an HTML element\nexport const isElement = el => !!(el && el.nodeType === Node.ELEMENT_NODE)\n\n// Set an style property on an element\nexport const setStyle = (el, prop, value) => {\n if (prop && isElement(el)) {\n el.style[prop] = value\n }\n}\n\n// Remove an style property from an element\nexport const removeStyle = (el, prop) => {\n if (prop && isElement(el)) {\n el.style[prop] = ''\n }\n}\n","import VueFinalModal from './VueFinalModal.vue'\nimport { setStyle, removeStyle } from './utils/dom.js'\n\nfunction createVfm(options) {\n let vfm\n\n return function() {\n vfm = {\n isScrollLocked: false,\n openedModals: [],\n modals: [],\n show(name) {\n this.toggle(name, true)\n },\n hide(name) {\n this.toggle(name, false)\n },\n hideAll() {\n this.openedModals.forEach(modal => {\n modal.$emit('input', false)\n })\n },\n toggle(name, show) {\n const modal = this.modals.find(modal => modal.name === name)\n if (modal !== undefined) {\n modal.$emit('input', show === undefined ? !modal.value : show)\n }\n },\n lockScroll() {\n if (this.isScrollLocked) return\n if (options.isMobile) {\n setStyle(document.body, 'overflow', 'hidden')\n } else {\n window.addEventListener('wheel', this.lockScrollListener, { passive: false })\n }\n this.isScrollLocked = true\n },\n unlockScroll() {\n if (options.isMobile) {\n removeStyle(document.body, 'overflow')\n } else {\n window.removeEventListener('wheel', this.lockScrollListener)\n }\n this.isScrollLocked = false\n },\n lockScrollListener(e) {\n e.preventDefault()\n }\n }\n return vfm\n }\n}\n\nexport function bindPrototype(Vue, options) {\n const vfm = createVfm(options)()\n Object.defineProperty(Vue.prototype, options.key, {\n get() {\n return vfm\n }\n })\n}\n\nexport function registComponent(Vue, options) {\n Vue.component(options.componentName, {\n ...VueFinalModal,\n props: { ...VueFinalModal.props, $_options: { type: Object, default: () => options } }\n })\n}\n","export const DUPLICATE_PLUGIN_COMPONENT =\n '[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.'\n\nexport const DUPLICATE_COMPONENT = '[vue-final-modal] Duplicate registration componentName of VueFinalModal.'\n","'use strict'\r\n\r\nmodule.exports = isMobile\r\nmodule.exports.isMobile = isMobile\r\nmodule.exports.default = isMobile\r\n\r\nvar mobileRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i\r\n\r\nvar tabletRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i\r\n\r\nfunction isMobile (opts) {\r\n if (!opts) opts = {}\r\n var ua = opts.ua\r\n if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent\r\n if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {\r\n ua = ua.headers['user-agent']\r\n }\r\n if (typeof ua !== 'string') return false\r\n\r\n var result = opts.tablet ? tabletRE.test(ua) : mobileRE.test(ua)\r\n\r\n if (\r\n !result &&\r\n opts.tablet &&\r\n opts.featureDetect &&\r\n navigator &&\r\n navigator.maxTouchPoints > 1 &&\r\n ua.indexOf('Macintosh') !== -1 &&\r\n ua.indexOf('Safari') !== -1\r\n ) {\r\n result = true\r\n }\r\n\r\n return result\r\n}\r\n","import { bindPrototype, registComponent } from './PluginCore'\nimport { DUPLICATE_PLUGIN_COMPONENT, DUPLICATE_COMPONENT } from './utils/errors'\nimport mobile from 'is-mobile'\n\nconst defaultOptions = {\n componentName: 'VueFinalModal',\n key: '$vfm',\n isMobile: mobile()\n}\n\nconst Plugin = () => ({\n install(Vue, options) {\n const _options = Object.assign({}, defaultOptions, options)\n const isDuplicateKey = Vue.prototype[_options.key]\n const isDuplicateComponent = Vue.options.components[_options.componentName]\n\n if (isDuplicateComponent) {\n console.warn(isDuplicateKey ? DUPLICATE_PLUGIN_COMPONENT : DUPLICATE_COMPONENT)\n } else {\n if (!isDuplicateKey) {\n bindPrototype(Vue, _options)\n }\n registComponent(Vue, _options)\n }\n }\n})\n\nexport default Plugin\n"],"names":["queryFocusableElements","element","selector","querySelectorAll","isFocused","document","activeElement","FocusTrap","root","elements","onKeyDown","this","bind","enable","disable","firstElement","lastElement","length","event","key","keyCode","isTabPressed","shiftKey","focus","preventDefault","addEventListener","removeEventListener","isElement","el","nodeType","Node","ELEMENT_NODE","createVfm","options","isScrollLocked","openedModals","modals","show","name","toggle","hide","hideAll","forEach","modal","$emit","find","undefined","value","lockScroll","prop","isMobile","body","style","window","lockScrollListener","passive","unlockScroll","e","mobileRE","tabletRE","opts","ua","navigator","userAgent","headers","result","tablet","test","featureDetect","maxTouchPoints","indexOf","defaultOptions","componentName","mobile","install","Vue","_options","Object","assign","isDuplicateKey","prototype","components","console","warn","vfm","defineProperty","get","bindPrototype","component","VueFinalModal","props","$_options","type","default","registComponent"],"mappings":"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"} \ No newline at end of file diff --git a/dist/VueFinalModal.umd.js b/dist/VueFinalModal.umd.js index 866d4aec..6a1c810c 100644 --- a/dist/VueFinalModal.umd.js +++ b/dist/VueFinalModal.umd.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VueFinalModal=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n0){var n=this.api.openedModals[this.api.openedModals.length-1];n.handleLockScroll(),(n.focusRetain||n.focusTrap)&&n.$refs.vfmContainer.focus(),!n.hideOverlay&&(n.visibility.overlay=!0)}this.startTransitionLeave()},startTransitionEnter:function(){this.visibility.overlay=!0,this.visibility.modal=!0},startTransitionLeave:function(){this.visibility.overlay=!1,this.visibility.modal=!1},handleLockScroll:function(){this.value&&(this.lockScroll?this.api.lockScroll():this.api.unlockScroll())},getAttachElement:function(){return!1!==this.attach&&("string"==typeof this.attach?!!window&&window.document.querySelector(this.attach):this.attach)},beforeOverlayEnter:function(){this.overlayTransitionState=f},afterOverlayEnter:function(){this.overlayTransitionState=d},beforeOverlayLeave:function(){this.overlayTransitionState=v},afterOverlayLeave:function(){this.overlayTransitionState=u},beforeModalEnter:function(){this.$emit("before-open"),this.modalTransitionState=f},afterModalEnter:function(){this.modalTransitionState=d,(this.focusRetain||this.focusTrap)&&this.$refs.vfmContainer.focus(),this.focusTrap&&this.$focusTrap.enable(this.$refs.vfmContainer),this.$emit("opened")},beforeModalLeave:function(){this.$emit("before-close"),this.modalTransitionState=v,this.$focusTrap.enabled()&&this.$focusTrap.disable()},afterModalLeave:function(){this.modalTransitionState=u,this.modalStackIndex=null,0===this.api.openedModals.length&&this.lockScroll&&this.api.unlockScroll(),this.$emit("closed")},onClickContainer:function(){this.$emit("click-outside"),this.clickToClose&&this.$emit("input",!1)},onEsc:function(e){27===e.keyCode&&this.visible&&this.escToClose&&this.$emit("input",!1)}}};var m,y=function(e,t,n,o,i,a,r,s,l,c){"boolean"!=typeof r&&(l=s,s=r,r=!1);var d,f="function"==typeof n?n.options:n;if(e&&e.render&&(f.render=e.render,f.staticRenderFns=e.staticRenderFns,f._compiled=!0,i&&(f.functional=!0)),o&&(f._scopeId=o),a?(d=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(a)},f._ssrRegister=d):t&&(d=r?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),d)if(f.functional){var u=f.render;f.render=function(e,t){return d.call(t),u(e,t)}}else{var v=f.beforeCreate;f.beforeCreate=v?[].concat(v,d):[d]}return n},b="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var g={};const S=y({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.ssr||e.visible?n("div",{directives:[{name:"show",rawName:"v-show",value:!e.ssr||e.visible,expression:"!ssr || visible"}],staticClass:"vfm vfm--inset",class:[!1===e.attach?"vfm--fixed":"vfm--absolute",{"vfm--prevent-none":e.preventClick}],style:{zIndex:e.calculateZIndex},on:{keydown:e.onEsc}},[n("transition",{attrs:{name:e.overlayTransition},on:{"before-enter":e.beforeOverlayEnter,"after-enter":e.afterOverlayEnter,"before-leave":e.beforeOverlayLeave,"after-leave":e.afterOverlayLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.hideOverlay&&e.visibility.overlay,expression:"!hideOverlay && visibility.overlay"}],staticClass:"vfm__overlay vfm--overlay vfm--absolute vfm--inset",class:e.overlayClass,style:e.overlayStyle})]),e._v(" "),n("transition",{attrs:{name:e.transition},on:{"before-enter":e.beforeModalEnter,"after-enter":e.afterModalEnter,"before-leave":e.beforeModalLeave,"after-leave":e.afterModalLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.visibility.modal,expression:"visibility.modal"}],ref:"vfmContainer",staticClass:"vfm__container vfm--absolute vfm--inset vfm--outline-none",class:e.classes,style:e.styles,attrs:{"aria-expanded":e.visibility.modal.toString(),role:"dialog","aria-modal":"true",tabindex:"-1"},on:{click:e.onClickContainer}},[n("div",{ref:"vfmContent",staticClass:"vfm__content",class:[e.contentClass,{"vfm--prevent-auto":e.preventClick}],style:e.contentStyle,on:{click:function(e){e.stopPropagation()}}},[e._t("default")],2)])])],1):e._e()},staticRenderFns:[]},(function(e){e&&e("data-v-0ee8c783_0",{source:".vfm--fixed[data-v-0ee8c783]{position:fixed}.vfm--absolute[data-v-0ee8c783]{position:absolute}.vfm--inset[data-v-0ee8c783]{top:0;right:0;bottom:0;left:0}.vfm--overlay[data-v-0ee8c783]{background-color:rgba(0,0,0,.5)}.vfm--prevent-none[data-v-0ee8c783]{pointer-events:none}.vfm--prevent-auto[data-v-0ee8c783]{pointer-events:auto}.vfm--outline-none[data-v-0ee8c783]:focus{outline:0}.vfm-enter-active[data-v-0ee8c783],.vfm-leave-active[data-v-0ee8c783]{transition:opacity .2s}.vfm-enter[data-v-0ee8c783],.vfm-leave-to[data-v-0ee8c783]{opacity:0}",map:void 0,media:void 0})}),p,"data-v-0ee8c783",false,undefined,!1,(function(e){return function(e,t){return function(e,t){var n=b?t.media||"default":e,o=g[n]||(g[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);var i=t.source;if(t.map&&(i+="\n/*# sourceURL="+t.map.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===m&&(m=document.head||document.getElementsByTagName("head")[0]),m.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(i),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{var a=o.ids.size-1,r=document.createTextNode(i),s=o.element.childNodes;s[a]&&o.element.removeChild(s[a]),s.length?o.element.insertBefore(r,s[a]):o.element.appendChild(r)}}}(e,t)}}),void 0,void 0);var k=function(e){return!(!e||e.nodeType!==Node.ELEMENT_NODE)};function w(e){return function(){return{isScrollLocked:!1,openedModals:[],modals:[],show:function(e){this.toggle(e,!0)},hide:function(e){this.toggle(e,!1)},hideAll:function(){this.openedModals.forEach((function(e){e.$emit("input",!1)}))},toggle:function(e,t){var n=this.modals.find((function(t){return t.name===e}));void 0!==n&&n.$emit("input",void 0===t?!n.value:t)},lockScroll:function(){var t,n,o;this.isScrollLocked||(e.isMobile?(t=document.body,o="hidden",(n="overflow")&&k(t)&&(t.style[n]=o)):window.addEventListener("wheel",this.lockScrollListener,{passive:!1}),this.isScrollLocked=!0)},unlockScroll:function(){var t,n;e.isMobile?(t=document.body,(n="overflow")&&k(t)&&(t.style[n]="")):window.removeEventListener("wheel",this.lockScrollListener),this.isScrollLocked=!1},lockScrollListener:function(e){e.preventDefault()}}}}var E=M,T=M,O=M,x=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,C=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function M(e){e||(e={});var t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;var n=e.tablet?C.test(t):x.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}E.isMobile=T,E.default=O;var _={componentName:"VueFinalModal",key:"$vfm",isMobile:E()};return function(){return{install:function(e,t){var n=Object.assign({},_,t),o=e.prototype[n.key];e.options.components[n.componentName]?console.warn(o?"[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.":"[vue-final-modal] Duplicate registration componentName of VueFinalModal."):(o||function(e,t){var n=w(t)();Object.defineProperty(e.prototype,t.key,{get:function(){return n}})}(e,n),function(e,t){e.component(t.componentName,i(i({},S),{},{props:i(i({},S.props),{},{$_options:{type:Object,default:function(){return t}}})}))}(e,n))}}}})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VueFinalModal=t()}(this,(function(){"use strict";function e(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n({modalStackIndex:null,visible:!1,visibility:{modal:!1,overlay:!1},overlayTransitionState:null,modalTransitionState:null}),computed:{api(){return this[this.$_options.key]},isComponentReadyToBeDestroyed(){return(this.hideOverlay||this.overlayTransitionState===f)&&this.modalTransitionState===f},calculateZIndex(){return"boolean"==typeof this.zIndex?this.attach?"unset":this.zIndexBase+2*(this.modalStackIndex||0):this.zIndex}},watch:{value(e){this.mounted(),e||this.close()},lockScroll:"handleLockScroll",hideOverlay(e){this.value&&!e&&(this.visibility.overlay=!0)},attach:"mounted",isComponentReadyToBeDestroyed(e){e&&(this.visible=!1)}},created(){this.api.modals.push(this)},mounted(){this.$focusTrap=new l,this.mounted()},beforeDestroy(){this.close(),this.$el.remove();let e=this.api.modals.findIndex((e=>e===this));this.api.modals.splice(e,1)},methods:{mounted(){if(this.value){let e=this.getAttachElement();if(e||!1===this.attach){!1!==this.attach&&e.appendChild(this.$el);let t=this.api.openedModals.findIndex((e=>e===this));-1!==t&&this.api.openedModals.splice(t,1),this.api.openedModals.push(this),this.modalStackIndex=this.api.openedModals.length-1,this.handleLockScroll(),this.api.openedModals.filter((e=>e!==this)).forEach(((t,n)=>{t.getAttachElement()===e&&(t.modalStackIndex=n,t.visibility.overlay=!1)})),this.visible=!0,this.$nextTick((()=>{this.startTransitionEnter()}))}else!1!==e&&console.warn("Unable to locate target ".concat(this.attach))}},close(){let e=this.api.openedModals.findIndex((e=>e===this));if(-1!==e&&this.api.openedModals.splice(e,1),this.api.openedModals.length>0){const e=this.api.openedModals[this.api.openedModals.length-1];e.handleLockScroll(),(e.focusRetain||e.focusTrap)&&e.$refs.vfmContainer.focus(),!e.hideOverlay&&(e.visibility.overlay=!0)}this.startTransitionLeave()},startTransitionEnter(){this.visibility.overlay=!0,this.visibility.modal=!0},startTransitionLeave(){this.visibility.overlay=!1,this.visibility.modal=!1},handleLockScroll(){this.value&&(this.lockScroll?this.api.lockScroll():this.api.unlockScroll())},getAttachElement(){let e;return e=!1!==this.attach&&("string"==typeof this.attach?!!window&&window.document.querySelector(this.attach):this.attach),e},beforeOverlayEnter(){this.overlayTransitionState=c},afterOverlayEnter(){this.overlayTransitionState=d},beforeOverlayLeave(){this.overlayTransitionState=u},afterOverlayLeave(){this.overlayTransitionState=f},beforeModalEnter(){this.$emit("before-open"),this.modalTransitionState=c},afterModalEnter(){this.modalTransitionState=d,(this.focusRetain||this.focusTrap)&&this.$refs.vfmContainer.focus(),this.focusTrap&&this.$focusTrap.enable(this.$refs.vfmContainer),this.$emit("opened")},beforeModalLeave(){this.$emit("before-close"),this.modalTransitionState=u,this.$focusTrap.enabled()&&this.$focusTrap.disable()},afterModalLeave(){this.modalTransitionState=f,this.modalStackIndex=null,0===this.api.openedModals.length&&this.lockScroll&&this.api.unlockScroll(),this.$emit("closed")},onClickContainer(){this.$emit("click-outside"),this.clickToClose&&this.$emit("input",!1)},onEsc(e){27===e.keyCode&&this.visible&&this.escToClose&&this.$emit("input",!1)}}};var p,m=function(e,t,n,i,o,a,r,s,l,d){"boolean"!=typeof r&&(l=s,s=r,r=!1);var c,f="function"==typeof n?n.options:n;if(e&&e.render&&(f.render=e.render,f.staticRenderFns=e.staticRenderFns,f._compiled=!0,o&&(f.functional=!0)),i&&(f._scopeId=i),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(a)},f._ssrRegister=c):t&&(c=r?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),c)if(f.functional){var u=f.render;f.render=function(e,t){return c.call(t),u(e,t)}}else{var h=f.beforeCreate;f.beforeCreate=h?[].concat(h,c):[c]}return n},y="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var b={};const g=m({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.ssr||e.visible?n("div",{directives:[{name:"show",rawName:"v-show",value:!e.ssr||e.visible,expression:"!ssr || visible"}],staticClass:"vfm vfm--inset",class:[!1===e.attach?"vfm--fixed":"vfm--absolute",{"vfm--prevent-none":e.preventClick}],style:{zIndex:e.calculateZIndex},on:{keydown:e.onEsc}},[n("transition",{attrs:{name:e.overlayTransition},on:{"before-enter":e.beforeOverlayEnter,"after-enter":e.afterOverlayEnter,"before-leave":e.beforeOverlayLeave,"after-leave":e.afterOverlayLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.hideOverlay&&e.visibility.overlay,expression:"!hideOverlay && visibility.overlay"}],staticClass:"vfm__overlay vfm--overlay vfm--absolute vfm--inset",class:e.overlayClass,style:e.overlayStyle})]),e._v(" "),n("transition",{attrs:{name:e.transition},on:{"before-enter":e.beforeModalEnter,"after-enter":e.afterModalEnter,"before-leave":e.beforeModalLeave,"after-leave":e.afterModalLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.visibility.modal,expression:"visibility.modal"}],ref:"vfmContainer",staticClass:"vfm__container vfm--absolute vfm--inset vfm--outline-none",class:e.classes,style:e.styles,attrs:{"aria-expanded":e.visibility.modal.toString(),role:"dialog","aria-modal":"true",tabindex:"-1"},on:{click:function(t){return t.target!==t.currentTarget?null:e.onClickContainer(t)}}},[n("div",{ref:"vfmContent",staticClass:"vfm__content",class:[e.contentClass,{"vfm--prevent-auto":e.preventClick}],style:e.contentStyle},[e._t("default")],2)])])],1):e._e()},staticRenderFns:[]},(function(e){e&&e("data-v-7c0fc555_0",{source:".vfm--fixed[data-v-7c0fc555]{position:fixed}.vfm--absolute[data-v-7c0fc555]{position:absolute}.vfm--inset[data-v-7c0fc555]{top:0;right:0;bottom:0;left:0}.vfm--overlay[data-v-7c0fc555]{background-color:rgba(0,0,0,.5)}.vfm--prevent-none[data-v-7c0fc555]{pointer-events:none}.vfm--prevent-auto[data-v-7c0fc555]{pointer-events:auto}.vfm--outline-none[data-v-7c0fc555]:focus{outline:0}.vfm-enter-active[data-v-7c0fc555],.vfm-leave-active[data-v-7c0fc555]{transition:opacity .2s}.vfm-enter[data-v-7c0fc555],.vfm-leave-to[data-v-7c0fc555]{opacity:0}",map:void 0,media:void 0})}),v,"data-v-7c0fc555",false,undefined,!1,(function(e){return function(e,t){return function(e,t){var n=y?t.media||"default":e,i=b[n]||(b[n]={ids:new Set,styles:[]});if(!i.ids.has(e)){i.ids.add(e);var o=t.source;if(t.map&&(o+="\n/*# sourceURL="+t.map.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),i.element||(i.element=document.createElement("style"),i.element.type="text/css",t.media&&i.element.setAttribute("media",t.media),void 0===p&&(p=document.head||document.getElementsByTagName("head")[0]),p.appendChild(i.element)),"styleSheet"in i.element)i.styles.push(o),i.element.styleSheet.cssText=i.styles.filter(Boolean).join("\n");else{var a=i.ids.size-1,r=document.createTextNode(o),s=i.element.childNodes;s[a]&&i.element.removeChild(s[a]),s.length?i.element.insertBefore(r,s[a]):i.element.appendChild(r)}}}(e,t)}}),void 0,void 0);var k=function(e){return!(!e||e.nodeType!==Node.ELEMENT_NODE)};function S(e){return function(){return{isScrollLocked:!1,openedModals:[],modals:[],show:function(e){this.toggle(e,!0)},hide:function(e){this.toggle(e,!1)},hideAll:function(){this.openedModals.forEach((function(e){e.$emit("input",!1)}))},toggle:function(e,t){var n=this.modals.find((function(t){return t.name===e}));void 0!==n&&n.$emit("input",void 0===t?!n.value:t)},lockScroll:function(){var t,n,i;this.isScrollLocked||(e.isMobile?(t=document.body,i="hidden",(n="overflow")&&k(t)&&(t.style[n]=i)):window.addEventListener("wheel",this.lockScrollListener,{passive:!1}),this.isScrollLocked=!0)},unlockScroll:function(){var t,n;e.isMobile?(t=document.body,(n="overflow")&&k(t)&&(t.style[n]="")):window.removeEventListener("wheel",this.lockScrollListener),this.isScrollLocked=!1},lockScrollListener:function(e){e.preventDefault()}}}}var w=C,E=C,T=C,O=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,x=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function C(e){e||(e={});var t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;var n=e.tablet?x.test(t):O.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}w.isMobile=E,w.default=T;var M={componentName:"VueFinalModal",key:"$vfm",isMobile:w()};return function(){return{install:function(e,t){var n=Object.assign({},M,t),o=e.prototype[n.key];e.options.components[n.componentName]?console.warn(o?"[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.":"[vue-final-modal] Duplicate registration componentName of VueFinalModal."):(o||function(e,t){var n=S(t)();Object.defineProperty(e.prototype,t.key,{get:function(){return n}})}(e,n),function(e,t){e.component(t.componentName,i(i({},g),{},{props:i(i({},g.props),{},{$_options:{type:Object,default:function(){return t}}})}))}(e,n))}}}})); //# sourceMappingURL=VueFinalModal.umd.js.map diff --git a/dist/VueFinalModal.umd.js.map b/dist/VueFinalModal.umd.js.map index 0c9e1727..a0fae292 100644 --- a/dist/VueFinalModal.umd.js.map +++ b/dist/VueFinalModal.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"VueFinalModal.umd.js","sources":["../lib/utils/focusTrap.js","../lib/VueFinalModal.vue","../lib/utils/dom.js","../lib/PluginCore.js","../lib/utils/errors.js","../node_modules/is-mobile/index.js","../lib/Plugin.js"],"sourcesContent":["// stolen from vue-js-modal\n\nconst FOCUSABLE_ELEMENTS_QUERY =\n 'button:not([disabled]), ' +\n 'select:not([disabled]), ' +\n 'a[href]:not([disabled]), ' +\n 'area[href]:not([disabled]), ' +\n '[contentEditable=\"\"]:not([disabled]), ' +\n '[contentEditable=\"true\"]:not([disabled]), ' +\n '[contentEditable=\"TRUE\"]:not([disabled]), ' +\n 'textarea:not([disabled]), ' +\n 'iframe:not([disabled]), ' +\n 'input:not([disabled]), ' +\n 'summary:not([disabled]), ' +\n '[tabindex]:not([tabindex=\"-1\"])'\n\nconst isTabPressed = event => {\n return event.key === 'Tab' || event.keyCode === 9\n}\n\nconst querySelectorAll = (element, selector) => {\n return [...(element.querySelectorAll(selector) || [])]\n}\n\nconst queryFocusableElements = element => {\n return querySelectorAll(element, FOCUSABLE_ELEMENTS_QUERY)\n}\n\nconst isFocused = element => {\n return element == document.activeElement\n}\n\nconst isNothingFocused = () => {\n return !document.activeElement\n}\n\nclass FocusTrap {\n constructor() {\n this.root = null\n this.elements = []\n\n this.onKeyDown = this.onKeyDown.bind(this)\n this.enable = this.enable.bind(this)\n this.disable = this.disable.bind(this)\n this.firstElement = this.firstElement.bind(this)\n this.lastElement = this.lastElement.bind(this)\n }\n\n lastElement() {\n return this.elements[this.elements.length - 1] || null\n }\n\n firstElement() {\n return this.elements[0] || null\n }\n\n onKeyDown(event) {\n if (!isTabPressed(event)) {\n return\n }\n\n // SHIFT + TAB\n if (event.shiftKey) {\n if (isFocused(this.firstElement())) {\n this.lastElement().focus()\n event.preventDefault()\n }\n return\n }\n\n // TAB\n if (isNothingFocused() || isFocused(this.lastElement())) {\n this.firstElement().focus()\n event.preventDefault()\n return\n }\n }\n\n enabled() {\n return !!this.root\n }\n\n enable(root) {\n if (!root) {\n return\n }\n\n this.root = root\n this.elements = queryFocusableElements(this.root)\n\n this.root.addEventListener('keydown', this.onKeyDown)\n }\n\n disable() {\n this.root.removeEventListener('keydown', this.onKeyDown)\n this.root = null\n }\n}\n\nexport default FocusTrap\n","\n\n\n\n\n","// Stolen from bootstrap vue\n\n// Determine if an element is an HTML element\nexport const isElement = el => !!(el && el.nodeType === Node.ELEMENT_NODE)\n\n// Set an style property on an element\nexport const setStyle = (el, prop, value) => {\n if (prop && isElement(el)) {\n el.style[prop] = value\n }\n}\n\n// Remove an style property from an element\nexport const removeStyle = (el, prop) => {\n if (prop && isElement(el)) {\n el.style[prop] = ''\n }\n}\n","import VueFinalModal from './VueFinalModal.vue'\nimport { setStyle, removeStyle } from './utils/dom.js'\n\nfunction createVfm(options) {\n let vfm\n\n return function() {\n vfm = {\n isScrollLocked: false,\n openedModals: [],\n modals: [],\n show(name) {\n this.toggle(name, true)\n },\n hide(name) {\n this.toggle(name, false)\n },\n hideAll() {\n this.openedModals.forEach(modal => {\n modal.$emit('input', false)\n })\n },\n toggle(name, show) {\n const modal = this.modals.find(modal => modal.name === name)\n if (modal !== undefined) {\n modal.$emit('input', show === undefined ? !modal.value : show)\n }\n },\n lockScroll() {\n if (this.isScrollLocked) return\n if (options.isMobile) {\n setStyle(document.body, 'overflow', 'hidden')\n } else {\n window.addEventListener('wheel', this.lockScrollListener, { passive: false })\n }\n this.isScrollLocked = true\n },\n unlockScroll() {\n if (options.isMobile) {\n removeStyle(document.body, 'overflow')\n } else {\n window.removeEventListener('wheel', this.lockScrollListener)\n }\n this.isScrollLocked = false\n },\n lockScrollListener(e) {\n e.preventDefault()\n }\n }\n return vfm\n }\n}\n\nexport function bindPrototype(Vue, options) {\n const vfm = createVfm(options)()\n Object.defineProperty(Vue.prototype, options.key, {\n get() {\n return vfm\n }\n })\n}\n\nexport function registComponent(Vue, options) {\n Vue.component(options.componentName, {\n ...VueFinalModal,\n props: { ...VueFinalModal.props, $_options: { type: Object, default: () => options } }\n })\n}\n","export const DUPLICATE_PLUGIN_COMPONENT =\n '[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.'\n\nexport const DUPLICATE_COMPONENT = '[vue-final-modal] Duplicate registration componentName of VueFinalModal.'\n","'use strict'\r\n\r\nmodule.exports = isMobile\r\nmodule.exports.isMobile = isMobile\r\nmodule.exports.default = isMobile\r\n\r\nvar mobileRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i\r\n\r\nvar tabletRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i\r\n\r\nfunction isMobile (opts) {\r\n if (!opts) opts = {}\r\n var ua = opts.ua\r\n if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent\r\n if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {\r\n ua = ua.headers['user-agent']\r\n }\r\n if (typeof ua !== 'string') return false\r\n\r\n var result = opts.tablet ? tabletRE.test(ua) : mobileRE.test(ua)\r\n\r\n if (\r\n !result &&\r\n opts.tablet &&\r\n opts.featureDetect &&\r\n navigator &&\r\n navigator.maxTouchPoints > 1 &&\r\n ua.indexOf('Macintosh') !== -1 &&\r\n ua.indexOf('Safari') !== -1\r\n ) {\r\n result = true\r\n }\r\n\r\n return result\r\n}\r\n","import { bindPrototype, registComponent } from './PluginCore'\nimport { DUPLICATE_PLUGIN_COMPONENT, DUPLICATE_COMPONENT } from './utils/errors'\nimport mobile from 'is-mobile'\n\nconst defaultOptions = {\n componentName: 'VueFinalModal',\n key: '$vfm',\n isMobile: mobile()\n}\n\nconst Plugin = () => ({\n install(Vue, options) {\n const _options = Object.assign({}, defaultOptions, options)\n const isDuplicateKey = Vue.prototype[_options.key]\n const isDuplicateComponent = Vue.options.components[_options.componentName]\n\n if (isDuplicateComponent) {\n console.warn(isDuplicateKey ? DUPLICATE_PLUGIN_COMPONENT : DUPLICATE_COMPONENT)\n } else {\n if (!isDuplicateKey) {\n bindPrototype(Vue, _options)\n }\n registComponent(Vue, _options)\n }\n }\n})\n\nexport default Plugin\n"],"names":["queryFocusableElements","element","selector","querySelectorAll","isFocused","document","activeElement","FocusTrap","root","elements","onKeyDown","this","bind","enable","disable","firstElement","lastElement","length","event","key","keyCode","isTabPressed","shiftKey","focus","preventDefault","addEventListener","removeEventListener","isElement","el","nodeType","Node","ELEMENT_NODE","createVfm","options","isScrollLocked","openedModals","modals","show","name","toggle","hide","hideAll","forEach","modal","$emit","find","undefined","value","lockScroll","prop","isMobile","body","style","window","lockScrollListener","passive","unlockScroll","e","mobileRE","tabletRE","opts","ua","navigator","userAgent","headers","result","tablet","test","featureDetect","maxTouchPoints","indexOf","defaultOptions","componentName","mobile","install","Vue","_options","Object","assign","isDuplicateKey","prototype","components","console","warn","vfm","defineProperty","get","bindPrototype","component","VueFinalModal","props","$_options","type","default","registComponent"],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"VueFinalModal.umd.js","sources":["../lib/utils/focusTrap.js","../lib/VueFinalModal.vue","../lib/utils/dom.js","../lib/PluginCore.js","../lib/utils/errors.js","../node_modules/is-mobile/index.js","../lib/Plugin.js"],"sourcesContent":["// stolen from vue-js-modal\n\nconst FOCUSABLE_ELEMENTS_QUERY =\n 'button:not([disabled]), ' +\n 'select:not([disabled]), ' +\n 'a[href]:not([disabled]), ' +\n 'area[href]:not([disabled]), ' +\n '[contentEditable=\"\"]:not([disabled]), ' +\n '[contentEditable=\"true\"]:not([disabled]), ' +\n '[contentEditable=\"TRUE\"]:not([disabled]), ' +\n 'textarea:not([disabled]), ' +\n 'iframe:not([disabled]), ' +\n 'input:not([disabled]), ' +\n 'summary:not([disabled]), ' +\n '[tabindex]:not([tabindex=\"-1\"])'\n\nconst isTabPressed = event => {\n return event.key === 'Tab' || event.keyCode === 9\n}\n\nconst querySelectorAll = (element, selector) => {\n return [...(element.querySelectorAll(selector) || [])]\n}\n\nconst queryFocusableElements = element => {\n return querySelectorAll(element, FOCUSABLE_ELEMENTS_QUERY)\n}\n\nconst isFocused = element => {\n return element == document.activeElement\n}\n\nconst isNothingFocused = () => {\n return !document.activeElement\n}\n\nclass FocusTrap {\n constructor() {\n this.root = null\n this.elements = []\n\n this.onKeyDown = this.onKeyDown.bind(this)\n this.enable = this.enable.bind(this)\n this.disable = this.disable.bind(this)\n this.firstElement = this.firstElement.bind(this)\n this.lastElement = this.lastElement.bind(this)\n }\n\n lastElement() {\n return this.elements[this.elements.length - 1] || null\n }\n\n firstElement() {\n return this.elements[0] || null\n }\n\n onKeyDown(event) {\n if (!isTabPressed(event)) {\n return\n }\n\n // SHIFT + TAB\n if (event.shiftKey) {\n if (isFocused(this.firstElement())) {\n this.lastElement().focus()\n event.preventDefault()\n }\n return\n }\n\n // TAB\n if (isNothingFocused() || isFocused(this.lastElement())) {\n this.firstElement().focus()\n event.preventDefault()\n return\n }\n }\n\n enabled() {\n return !!this.root\n }\n\n enable(root) {\n if (!root) {\n return\n }\n\n this.root = root\n this.elements = queryFocusableElements(this.root)\n\n this.root.addEventListener('keydown', this.onKeyDown)\n }\n\n disable() {\n this.root.removeEventListener('keydown', this.onKeyDown)\n this.root = null\n }\n}\n\nexport default FocusTrap\n","\n\n\n\n\n","// Stolen from bootstrap vue\n\n// Determine if an element is an HTML element\nexport const isElement = el => !!(el && el.nodeType === Node.ELEMENT_NODE)\n\n// Set an style property on an element\nexport const setStyle = (el, prop, value) => {\n if (prop && isElement(el)) {\n el.style[prop] = value\n }\n}\n\n// Remove an style property from an element\nexport const removeStyle = (el, prop) => {\n if (prop && isElement(el)) {\n el.style[prop] = ''\n }\n}\n","import VueFinalModal from './VueFinalModal.vue'\nimport { setStyle, removeStyle } from './utils/dom.js'\n\nfunction createVfm(options) {\n let vfm\n\n return function() {\n vfm = {\n isScrollLocked: false,\n openedModals: [],\n modals: [],\n show(name) {\n this.toggle(name, true)\n },\n hide(name) {\n this.toggle(name, false)\n },\n hideAll() {\n this.openedModals.forEach(modal => {\n modal.$emit('input', false)\n })\n },\n toggle(name, show) {\n const modal = this.modals.find(modal => modal.name === name)\n if (modal !== undefined) {\n modal.$emit('input', show === undefined ? !modal.value : show)\n }\n },\n lockScroll() {\n if (this.isScrollLocked) return\n if (options.isMobile) {\n setStyle(document.body, 'overflow', 'hidden')\n } else {\n window.addEventListener('wheel', this.lockScrollListener, { passive: false })\n }\n this.isScrollLocked = true\n },\n unlockScroll() {\n if (options.isMobile) {\n removeStyle(document.body, 'overflow')\n } else {\n window.removeEventListener('wheel', this.lockScrollListener)\n }\n this.isScrollLocked = false\n },\n lockScrollListener(e) {\n e.preventDefault()\n }\n }\n return vfm\n }\n}\n\nexport function bindPrototype(Vue, options) {\n const vfm = createVfm(options)()\n Object.defineProperty(Vue.prototype, options.key, {\n get() {\n return vfm\n }\n })\n}\n\nexport function registComponent(Vue, options) {\n Vue.component(options.componentName, {\n ...VueFinalModal,\n props: { ...VueFinalModal.props, $_options: { type: Object, default: () => options } }\n })\n}\n","export const DUPLICATE_PLUGIN_COMPONENT =\n '[vue-final-modal] Duplicate registration API key and componentName of VueFinalModal.'\n\nexport const DUPLICATE_COMPONENT = '[vue-final-modal] Duplicate registration componentName of VueFinalModal.'\n","'use strict'\r\n\r\nmodule.exports = isMobile\r\nmodule.exports.isMobile = isMobile\r\nmodule.exports.default = isMobile\r\n\r\nvar mobileRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i\r\n\r\nvar tabletRE = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i\r\n\r\nfunction isMobile (opts) {\r\n if (!opts) opts = {}\r\n var ua = opts.ua\r\n if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent\r\n if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {\r\n ua = ua.headers['user-agent']\r\n }\r\n if (typeof ua !== 'string') return false\r\n\r\n var result = opts.tablet ? tabletRE.test(ua) : mobileRE.test(ua)\r\n\r\n if (\r\n !result &&\r\n opts.tablet &&\r\n opts.featureDetect &&\r\n navigator &&\r\n navigator.maxTouchPoints > 1 &&\r\n ua.indexOf('Macintosh') !== -1 &&\r\n ua.indexOf('Safari') !== -1\r\n ) {\r\n result = true\r\n }\r\n\r\n return result\r\n}\r\n","import { bindPrototype, registComponent } from './PluginCore'\nimport { DUPLICATE_PLUGIN_COMPONENT, DUPLICATE_COMPONENT } from './utils/errors'\nimport mobile from 'is-mobile'\n\nconst defaultOptions = {\n componentName: 'VueFinalModal',\n key: '$vfm',\n isMobile: mobile()\n}\n\nconst Plugin = () => ({\n install(Vue, options) {\n const _options = Object.assign({}, defaultOptions, options)\n const isDuplicateKey = Vue.prototype[_options.key]\n const isDuplicateComponent = Vue.options.components[_options.componentName]\n\n if (isDuplicateComponent) {\n console.warn(isDuplicateKey ? DUPLICATE_PLUGIN_COMPONENT : DUPLICATE_COMPONENT)\n } else {\n if (!isDuplicateKey) {\n bindPrototype(Vue, _options)\n }\n registComponent(Vue, _options)\n }\n }\n})\n\nexport default Plugin\n"],"names":["queryFocusableElements","element","selector","querySelectorAll","isFocused","document","activeElement","FocusTrap","root","elements","onKeyDown","this","bind","enable","disable","firstElement","lastElement","length","event","key","keyCode","isTabPressed","shiftKey","focus","preventDefault","addEventListener","removeEventListener","isElement","el","nodeType","Node","ELEMENT_NODE","createVfm","options","isScrollLocked","openedModals","modals","show","name","toggle","hide","hideAll","forEach","modal","$emit","find","undefined","value","lockScroll","prop","isMobile","body","style","window","lockScrollListener","passive","unlockScroll","e","mobileRE","tabletRE","opts","ua","navigator","userAgent","headers","result","tablet","test","featureDetect","maxTouchPoints","indexOf","defaultOptions","componentName","mobile","install","Vue","_options","Object","assign","isDuplicateKey","prototype","components","console","warn","vfm","defineProperty","get","bindPrototype","component","VueFinalModal","props","$_options","type","default","registComponent"],"mappings":"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"} \ No newline at end of file diff --git a/lib/VueFinalModal.vue b/lib/VueFinalModal.vue index 3ea4efd0..f919a2b9 100644 --- a/lib/VueFinalModal.vue +++ b/lib/VueFinalModal.vue @@ -38,14 +38,13 @@ role="dialog" aria-modal="true" tabindex="-1" - @click="onClickContainer" + @click.self="onClickContainer" >