From df9f4852592c989a66567a74aed5269d896c77cf Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 23 Apr 2021 06:59:35 +0000 Subject: [PATCH] chore(release): 1.1.0 [skip ci] ## [1.1.0](https://github.com/hoiheart/vue-universal-modal/compare/v1.0.7...v1.1.0) (2021-04-23) ### Features * Use v-model for insert component ([652fad5](https://github.com/hoiheart/vue-universal-modal/commit/652fad517ba4e33f073117fe41e1d36a018db02d)) ### Docs * update README ([da24bb2](https://github.com/hoiheart/vue-universal-modal/commit/da24bb2aa15fc2d79a5f5eef3c33d50e1fc1239a)) --- demo/index.5d6b4420.js | 1 + ...{style.0a05a68d.css => index.e1935fda.css} | 2 +- demo/index.ef8c8d27.js | 1 - demo/index.html | 5 +- demo/vendor.979a7963.js | 1 + dist/Modal.vue.d.ts | 76 +-- dist/hooks.d.ts | 33 + dist/index.d.ts | 10 +- dist/index.es5.js | 629 ++++++++++-------- dist/index.js | 405 ++++++----- dist/index.runtime.js | 627 +++++++++-------- package-lock.json | 2 +- package.json | 2 +- 13 files changed, 1008 insertions(+), 786 deletions(-) create mode 100644 demo/index.5d6b4420.js rename demo/{style.0a05a68d.css => index.e1935fda.css} (56%) delete mode 100644 demo/index.ef8c8d27.js create mode 100644 demo/vendor.979a7963.js create mode 100644 dist/hooks.d.ts diff --git a/demo/index.5d6b4420.js b/demo/index.5d6b4420.js new file mode 100644 index 0000000..69d1ebe --- /dev/null +++ b/demo/index.5d6b4420.js @@ -0,0 +1 @@ +var e=Object.defineProperty,l=Object.prototype.hasOwnProperty,o=Object.getOwnPropertySymbols,a=Object.prototype.propertyIsEnumerable,t=(l,o,a)=>o in l?e(l,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[o]=a,s=(e,s)=>{for(var n in s||(s={}))l.call(s,n)&&t(e,n,s[n]);if(o)for(var n of o(s))a.call(s,n)&&t(e,n,s[n]);return e};import{d as n,r as d,c as u,a as r,F as i,b as c,o as m,w as v,e as b,f as h,p,g as f,h as M,i as w,j as y,k as C,n as g,l as S,m as k,t as x,q as E,s as V,T as _,u as L,v as A,x as O,y as U,z as j,A as $,B as D,C as R}from"./vendor.979a7963.js";!function(e=".",l="__import__"){try{self[l]=new Function("u","return import(u)")}catch(o){const a=new URL(e,location),t=e=>{URL.revokeObjectURL(e.src),e.remove()};self[l]=e=>new Promise(((o,s)=>{const n=new URL(e,a);if(self[l].moduleMap[n])return o(self[l].moduleMap[n]);const d=new Blob([`import * as m from '${n}';`,`${l}.moduleMap['${n}']=m;`],{type:"text/javascript"}),u=Object.assign(document.createElement("script"),{type:"module",src:URL.createObjectURL(d),onerror(){s(new Error(`Failed to import: ${e}`)),t(u)},onload(){o(self[l].moduleMap[n]),t(u)}});document.head.appendChild(u)})),self[l].moduleMap={}}}("/vue-universal-modal/demo/");const T={h3:"mt-6 mb-2 text-xl font-bold",ul:"mt-2 list-disc list-inside",button:"mt-2 rounded-full py-1 px-4 bg-white transition border-blue-500 border-2 text-blue-500 text-sm hover:border-blue-700 hover:text-blue-700 focus:bg-blue-700 focus:text-white focus:outline-none"};var B=n({setup(){const e=d(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:T}}});const K={class:"modal"},N=r("p",null," Hello ",-1);B.render=function(e,l,o,a,t,s){const n=c("Modal");return m(),u(i,null,[r("h3",{class:e.style.h3}," 1. basic ",2),r("div",null,[r("button",{class:e.style.button,onClick:l[1]||(l[1]=(...l)=>e.showModal&&e.showModal(...l))}," Show modal ",2),r("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/1.basic.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),r(n,{modelValue:e.isShow,"onUpdate:modelValue":l[3]||(l[3]=l=>e.isShow=l),close:e.closeModal},{default:v((()=>[r("div",K,[N,r("button",{class:e.style.button,onClick:l[2]||(l[2]=(...l)=>e.closeModal&&e.closeModal(...l))}," close ",2)])])),_:1},8,["modelValue","close"])],64)};var F=n({setup(){const e=d(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:T}}});const I={class:"modal"},P=r("p",null," change v-show ",-1);F.render=function(e,l,o,a,t,s){const n=c("Modal");return m(),u(i,null,[r("h3",{class:e.style.h3}," 2. change v-show (always mounted) ",2),r("div",null,[r("button",{class:e.style.button,onClick:l[1]||(l[1]=(...l)=>e.showModal&&e.showModal(...l))}," Show modal ",2),r("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/2.visible.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),r(n,{"model-value":!0,close:e.closeModal,disabled:!e.isShow},{default:v((()=>[r("div",I,[P,r("button",{class:e.style.button,onClick:l[2]||(l[2]=(...l)=>e.closeModal&&e.closeModal(...l))}," close ",2)])])),_:1},8,["close","disabled"])],64)};var H=n({setup(){const e=b({modal1:!1,modal2:!1});return{isShowModal:e,options:{transition:!1,closeClickDimmed:!1,closeKeyCode:!1,styleModalContent:{justifyContent:"flex-start"}},showModal:function(l){e[l]=!0},closeModal:function(l){e[l]=!1},style:T}}});const q=r("li",null,"transition: false",-1),z=r("li",null,"closeClickDimmed: false",-1),G=r("li",null,"closeKeyCode: false",-1),J=r("li",null,"styleModalContent: { justifyContent: 'flex-start' }",-1),Q={class:"modal"},W=r("p",null," modal1 ",-1),X={class:"modal"},Y=r("p",null," modal2 ",-1);H.render=function(e,l,o,a,t,s){const n=c("Modal");return m(),u(i,null,[r("h3",{class:e.style.h3}," 3. options ",2),r("ul",{class:e.style.ul},[q,z,G,J],2),r("div",null,[r("button",{class:e.style.button,onClick:l[1]||(l[1]=l=>e.showModal("modal1"))}," Show modal ",2),r("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/3.options.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),r(n,{modelValue:e.isShowModal.modal1,"onUpdate:modelValue":l[4]||(l[4]=l=>e.isShowModal.modal1=l),close:()=>e.closeModal("modal1"),options:e.options,style:{backgroundColor:"rgba(59, 130, 246, 0.3)"}},{default:v((()=>[r("div",Q,[W,r("button",{class:[e.style.button,"mr-2"],onClick:l[2]||(l[2]=l=>e.showModal("modal2"))}," open modal2 ",2),r("button",{class:e.style.button,onClick:l[3]||(l[3]=()=>e.closeModal("modal1"))}," close ",2)])])),_:1},8,["modelValue","close","options","style"]),r(n,{modelValue:e.isShowModal.modal2,"onUpdate:modelValue":l[6]||(l[6]=l=>e.isShowModal.modal2=l),close:()=>e.closeModal("modal2"),options:e.options},{default:v((()=>[r("div",X,[Y,r("button",{class:e.style.button,onClick:l[5]||(l[5]=()=>e.closeModal("modal2"))}," close ",2)])])),_:1},8,["modelValue","close","options"])],64)};var Z=n({setup(){const e=b({modal1:!1,modal2:!1});return{isShowModal:e,showModal:function(l){e[l]=!0},closeModal:function(l){e[l]=!1},style:T}}});const ee={class:"modal"},le=r("p",null," modal1 ",-1),oe={class:"modal"},ae=r("p",null," modal2 ",-1);Z.render=function(e,l,o,a,t,s){const n=c("Modal");return m(),u(i,null,[r("h3",{class:e.style.h3}," 4. modal in modal ",2),r("div",null,[r("button",{class:e.style.button,onClick:l[1]||(l[1]=l=>e.showModal("modal1"))}," Show modal1 ",2),r("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/4.modal.on.modal.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),r(n,{modelValue:e.isShowModal.modal1,"onUpdate:modelValue":l[4]||(l[4]=l=>e.isShowModal.modal1=l),close:()=>e.closeModal("modal1")},{default:v((()=>[r("div",ee,[le,r("button",{class:e.style.button,style:{marginRight:"10px"},onClick:l[2]||(l[2]=l=>e.showModal("modal2"))}," open modal2 ",2),r("button",{class:e.style.button,onClick:l[3]||(l[3]=()=>e.closeModal("modal1"))}," close ",2)])])),_:1},8,["modelValue","close"]),r(n,{modelValue:e.isShowModal.modal2,"onUpdate:modelValue":l[6]||(l[6]=l=>e.isShowModal.modal2=l),close:()=>e.closeModal("modal2")},{default:v((()=>[r("div",oe,[ae,r("button",{class:e.style.button,onClick:l[5]||(l[5]=()=>e.closeModal("modal2"))}," close ",2)])])),_:1},8,["modelValue","close"])],64)};var te=n({setup(){const e=d(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:T}}});const se=h();p("data-v-118afcd2");const ne={class:"modal"},de=r("p",null," Hello ",-1);f();const ue=se(((e,l,o,a,t,s)=>{const n=c("Modal");return m(),u(i,null,[r("h3",{class:e.style.h3}," 5. custom animation ",2),r("div",null,[r("button",{class:e.style.button,onClick:l[1]||(l[1]=(...l)=>e.showModal&&e.showModal(...l))}," Show modal ",2),r("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/5.custom.animation.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),r(n,{modelValue:e.isShow,"onUpdate:modelValue":l[3]||(l[3]=l=>e.isShow=l),close:e.closeModal},{default:se((()=>[r("div",ne,[de,r("button",{class:e.style.button,onClick:l[2]||(l[2]=(...l)=>e.closeModal&&e.closeModal(...l))}," close ",2)])])),_:1},8,["modelValue","close"])],64)}));te.render=ue,te.__scopeId="data-v-118afcd2";var re=n({setup(){const e=b({modal1:!1,modal2:!1});return{isShowModal:e,showModal:function(l){e[l]=!0},closeModal:function(l){e[l]=!1},style:T}}});const ie={class:"modal"},ce=r("h2",{id:"heading-modal1"}," wai-aria1 ",-1),me={class:"modal"},ve=r("h2",{id:"heading-modal2"}," wai-aria2 ",-1);re.render=function(e,l,o,a,t,s){const n=c("Modal");return m(),u(i,null,[r("h3",{class:e.style.h3}," 6. wai-aria ",2),r("div",null,[r("button",{class:e.style.button,onClick:l[1]||(l[1]=l=>e.showModal("modal1"))}," Show modal1 ",2),r("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/6.wai-aria.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),r(n,{id:"aria-modal1",modelValue:e.isShowModal.modal1,"onUpdate:modelValue":l[4]||(l[4]=l=>e.isShowModal.modal1=l),class:"border-8 border-white-700 focus:border-blue-700","aria-labelledby":"heading-modal1",close:()=>e.closeModal("modal1")},{default:v((()=>[r("div",ie,[ce,r("button",{class:[e.style.button,"mr-2"],onClick:l[2]||(l[2]=l=>e.showModal("modal2"))}," open modal2 ",2),r("button",{class:e.style.button,onClick:l[3]||(l[3]=()=>e.closeModal("modal1"))}," close ",2)])])),_:1},8,["modelValue","close"]),r(n,{id:"aria-modal2",modelValue:e.isShowModal.modal2,"onUpdate:modelValue":l[6]||(l[6]=l=>e.isShowModal.modal2=l),class:"border-8 border-white-700 focus:border-blue-700","aria-labelledby":"heading-modal2",close:()=>e.closeModal("modal2")},{default:v((()=>[r("div",me,[ve,r("button",{class:e.style.button,onClick:l[5]||(l[5]=()=>e.closeModal("modal2"))}," close ",2)])])),_:1},8,["modelValue","close"])],64)};var be=n({setup(){const e=d(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:T,beforeEnter:function(){console.log("before enter")},afterEnter:function(){console.log("after enter")},beforeLeave:function(){console.log("before leave")},afterLeave:function(){console.log("after leave")}}}});const he={class:"modal"},pe=r("p",null," Hello ",-1);be.render=function(e,l,o,a,t,s){const n=c("Modal");return m(),u(i,null,[r("h3",{class:e.style.h3}," 7. event (please see console) ",2),r("div",null,[r("button",{class:e.style.button,onClick:l[1]||(l[1]=(...l)=>e.showModal&&e.showModal(...l))}," Show modal ",2),r("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/7.event.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),r(n,{modelValue:e.isShow,"onUpdate:modelValue":l[3]||(l[3]=l=>e.isShow=l),close:e.closeModal,onBeforeEnter:e.beforeEnter,onAfterEnter:e.afterEnter,onBeforeLeave:e.beforeLeave,onAfterLeave:e.afterLeave},{default:v((()=>[r("div",he,[pe,r("button",{class:e.style.button,onClick:l[2]||(l[2]=(...l)=>e.closeModal&&e.closeModal(...l))}," close ",2)])])),_:1},8,["modelValue","close","onBeforeEnter","onAfterEnter","onBeforeLeave","onAfterLeave"])],64)};var fe=n({components:{Example1:B,Example2:F,Example3:H,Example4:Z,Example5:te,Example6:re,Example7:be}});const Me=r("h2",{class:"text-2xl font-bold mt-8 mb-4"}," Examples ",-1);fe.render=function(e,l,o,a,t,s){const n=c("Example1"),d=c("Example2"),v=c("Example3"),b=c("Example4"),h=c("Example5"),p=c("Example6"),f=c("Example7");return m(),u(i,null,[Me,r(n),r(d),r(v),r(b),r(h),r(p),r(f)],64)};const we=({modalRef:e,latest:l,show:o})=>{let a;function t(o){const t=o.target.closest(`.${ge}`);if(l.value&&(!t||t!==e.value)){if(t&&!t.classList.contains(`${ge}-show`))return;a=o.target}}y((()=>{document.addEventListener("click",t),w((()=>o.value),(l=>{g((()=>function(l){l?e.value&&e.value.focus():a&&a.focus()}(l)))}),{immediate:o.value})})),C((()=>{document.removeEventListener("click",t)}))};var ye=n({inheritAttrs:!1,props:{close:{type:Function,default:()=>{}},disabled:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!0},options:{type:Object,default:()=>({})}},emits:["before-enter","enter","after-enter","enter-cancelled","before-leave","leave","after-leave","leave-cancelled"],setup(e,l){const{teleportTarget:o}=S(Ce),{close:a,disabled:t,options:n,modelValue:u}=x(e),r=d(void 0===u.value||u.value),i=d(null),c=d(!t.value);w([()=>u.value,()=>t.value],(()=>{const e=u.value&&!t.value;c.value=e,u.value&&(r.value=u.value)}),{immediate:!0});const{latest:m}=(({modelValue:e,show:l})=>{const{visibleModals:o,addVisibleModals:a,removeVisibleModals:t}=S(Ce),{uid:s}=k()||{},n=M((()=>!(!s||!o.value.length)&&s===o.value[o.value.length-1]));return w([()=>e.value,()=>l.value],(()=>{if(!s)return;const n=e.value&&l.value;n&&o.value.indexOf(s)<0&&a(s),!n&&o.value.indexOf(s)>-1&&t(s)}),{immediate:!0}),{latest:n}})({modelValue:u,show:c}),{mergeOptions:v,onClickDimmed:b}=(({close:e,options:l,latest:o})=>{const a=s({transition:300,closeClickDimmed:!0,closeKeyCode:27,styleModalContent:{}},l.value);function t(l){l.keyCode===a.closeKeyCode&&o.value&&e.value()}return y((()=>{a.closeKeyCode&&document.addEventListener("keyup",t)})),C((()=>{a.closeKeyCode&&document.removeEventListener("keyup",t)})),{mergeOptions:a,onClickDimmed:function(){a.closeClickDimmed&&e.value()}}})({close:a,latest:m,options:n});we({latest:m,modalRef:i,show:c});const h={beforeEnter:()=>l.emit("before-enter"),enter:()=>l.emit("enter"),afterEnter:()=>l.emit("after-enter"),enterCancelled:()=>l.emit("enter-cancelled"),beforeLeave:()=>l.emit("before-leave"),leave:()=>l.emit("leave"),afterLeave:()=>{l.emit("after-leave"),!1===u.value&&(r.value=!1)},leaveCancelled:()=>l.emit("leave-cancelled")};return{CLASS_NAME:ge,emitClose:()=>{console.warn("emitClose was deprecated.\nhttps://github.com/hoiheart/vue-universal-modal#usage-modal"),a.value()},inserted:r,latest:m,mergeOptions:v,modalRef:i,onClickDimmed:b,onTransitionEmit:h,show:c,teleportTarget:o,transition:!!v.transition&&v.transition/1e3+"s"}}});ye.render=function(e,l,o,a,t,n){return e.inserted?(m(),u(L,{key:0,to:e.teleportTarget,disabled:e.disabled},[r(_,E({appear:"",name:e.CLASS_NAME},V(e.onTransitionEmit)),{default:v((()=>{var o;return[O(r("div",E({ref:"modalRef",role:"dialog",tabindex:"-1","aria-modal":"true","aria-label":"Modal window",class:[e.CLASS_NAME,{[`${e.CLASS_NAME}-show`]:e.show},{[`${e.CLASS_NAME}-latest`]:e.latest}],style:{transitionDuration:e.transition}},e.$attrs),[r("div",{class:`${e.CLASS_NAME}-content`,style:s({transitionDuration:e.transition},null==(o=e.mergeOptions)?void 0:o.styleModalContent),onClick:l[1]||(l[1]=j(((...l)=>e.onClickDimmed&&e.onClickDimmed(...l)),["self"]))},[$(e.$slots,"default",{emitClose:e.emitClose}),$(e.$slots,"close")],6)],16),[[U,e.show]])]})),_:3},16,["name"])],8,["to","disabled"])):A("",!0)};const Ce="VueUniversalModal",ge="vue-universal-modal";var Se={install:(e,l={})=>{const{teleportTarget:o="",teleportComponent:a="",teleportComponentId:t="",modalComponent:s="Modal"}=l;if(!o)return console.error("teleportTarget is required.");if(a||t)return console.error("teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)");const n=d([]);e.provide(Ce,{teleportTarget:o,visibleModals:D(n),addVisibleModals:e=>{n.value=[...n.value,e]},removeVisibleModals:e=>{const l=[...n.value];l.splice(n.value.indexOf(e),1),n.value=[...l]}}),e.component(s,ye)}};const ke=R(fe);ke.use(Se,{teleportTarget:"#modals"}),ke.mount("#app"); diff --git a/demo/style.0a05a68d.css b/demo/index.e1935fda.css similarity index 56% rename from demo/style.0a05a68d.css rename to demo/index.e1935fda.css index ae78fa8..ecb4f82 100644 --- a/demo/style.0a05a68d.css +++ b/demo/index.e1935fda.css @@ -1 +1 @@ -.vue-universal-modal-enter-from .modal[data-v-23d831b8],.vue-universal-modal-enter-to .modal[data-v-23d831b8],.vue-universal-modal-leave-from .modal[data-v-23d831b8],.vue-universal-modal-leave-to .modal[data-v-23d831b8]{transition:transform .3s}.vue-universal-modal-enter-to .modal[data-v-23d831b8],.vue-universal-modal-leave-from .modal[data-v-23d831b8]{transform:translate3d(0,0,0)}.vue-universal-modal-enter-from .modal[data-v-23d831b8],.vue-universal-modal-leave-to .modal[data-v-23d831b8]{transform:translate3d(0,50px,0)}.modal{width:300px;padding:30px;box-sizing:border-box;background-color:#fff;font-size:20px;text-align:center}.vue-universal-modal-enter-to,.vue-universal-modal-leave-from{opacity:1}.vue-universal-modal-enter-from,.vue-universal-modal-leave-to{opacity:0}.vue-universal-modal{-webkit-overflow-scrolling:touch;overscroll-behavior:contain;position:fixed;overflow-y:auto;left:0;top:0;right:0;bottom:0;background-color:rgba(0,0,0,.8);text-align:left}.vue-universal-modal:not(.vue-universal-modal-latest){background:0 0}.vue-universal-modal-content{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;min-height:100%} \ No newline at end of file +.vue-universal-modal-enter-from .modal[data-v-118afcd2],.vue-universal-modal-enter-to .modal[data-v-118afcd2],.vue-universal-modal-leave-from .modal[data-v-118afcd2],.vue-universal-modal-leave-to .modal[data-v-118afcd2]{transition:.3s transform}.vue-universal-modal-enter-to .modal[data-v-118afcd2],.vue-universal-modal-leave-from .modal[data-v-118afcd2]{transform:translate3d(0,0,0)}.vue-universal-modal-enter-from .modal[data-v-118afcd2],.vue-universal-modal-leave-to .modal[data-v-118afcd2]{transform:translate3d(0,50px,0)}.modal{width:300px;padding:30px;box-sizing:border-box;background-color:#fff;font-size:20px;text-align:center}.vue-universal-modal-enter-to,.vue-universal-modal-leave-from{opacity:1}.vue-universal-modal-enter-from,.vue-universal-modal-leave-to{opacity:0}.vue-universal-modal{-webkit-overflow-scrolling:touch;overscroll-behavior:contain;position:fixed;overflow-y:auto;left:0;top:0;right:0;bottom:0;background-color:rgba(0,0,0,.8);text-align:left}.vue-universal-modal:not(.vue-universal-modal-latest){background:0 0}.vue-universal-modal-content{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;min-height:100%} \ No newline at end of file diff --git a/demo/index.ef8c8d27.js b/demo/index.ef8c8d27.js deleted file mode 100644 index 3c43f04..0000000 --- a/demo/index.ef8c8d27.js +++ /dev/null @@ -1 +0,0 @@ -function e(e,t){const n=Object.create(null),o=e.split(",");for(let e=0;e!!n[e.toLowerCase()]:e=>!!n[e]}const t=e("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt"),n=e("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function o(e){if(b(e)){const t={};for(let n=0;n{if(e){const n=e.split(s);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function i(e){let t="";if(x(e))t=e;else if(b(e))for(let n=0;n{},d=()=>!1,f=/^on[^a-z]/,p=e=>f.test(e),h=e=>e.startsWith("onUpdate:"),m=Object.assign,v=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},g=Object.prototype.hasOwnProperty,y=(e,t)=>g.call(e,t),b=Array.isArray,_=e=>"[object Map]"===E(e),C=e=>"function"==typeof e,x=e=>"string"==typeof e,w=e=>"symbol"==typeof e,S=e=>null!==e&&"object"==typeof e,k=e=>S(e)&&C(e.then)&&C(e.catch),M=Object.prototype.toString,E=e=>M.call(e),A=e=>x(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,F=e(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),L=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},T=/-(\w)/g,O=L((e=>e.replace(T,((e,t)=>t?t.toUpperCase():"")))),N=/\B([A-Z])/g,R=L((e=>e.replace(N,"-$1").toLowerCase())),$=L((e=>e.charAt(0).toUpperCase()+e.slice(1))),P=L((e=>e?`on${$(e)}`:"")),V=(e,t)=>e!==t&&(e==e||t==t),B=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},U=e=>{const t=parseFloat(e);return isNaN(t)?e:t},I=new WeakMap,D=[];let K;const z=Symbol(""),H=Symbol("");function W(e,t=a){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const n=function(e,t){const n=function(){if(!n.active)return t.scheduler?void 0:e();if(!D.includes(n)){J(n);try{return Z.push(X),X=!0,D.push(n),K=n,e()}finally{D.pop(),Y(),K=D[D.length-1]}}};return n.id=G++,n.allowRecurse=!!t.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||n(),n}function q(e){e.active&&(J(e),e.options.onStop&&e.options.onStop(),e.active=!1)}let G=0;function J(e){const{deps:t}=e;if(t.length){for(let n=0;n{e&&e.forEach((e=>{(e!==K||e.allowRecurse)&&i.add(e)}))};if("clear"===t)r.forEach(a);else if("length"===n&&b(e))r.forEach(((e,t)=>{("length"===t||t>=o)&&a(e)}));else switch(void 0!==n&&a(r.get(n)),t){case"add":b(e)?A(n)&&a(r.get("length")):(a(r.get(z)),_(e)&&a(r.get(H)));break;case"delete":b(e)||(a(r.get(z)),_(e)&&a(r.get(H)));break;case"set":_(e)&&a(r.get(z))}i.forEach((e=>{e.options.scheduler?e.options.scheduler(e):e()}))}const ne=e("__proto__,__v_isRef,__isVue"),oe=new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(w)),le=ce(),se=ce(!1,!0),re=ce(!0),ie=ce(!0,!0),ae={};function ce(e=!1,t=!1){return function(n,o,l){if("__v_isReactive"===o)return!e;if("__v_isReadonly"===o)return e;if("__v_raw"===o&&l===(e?Pe:$e).get(n))return n;const s=b(n);if(!e&&s&&y(ae,o))return Reflect.get(ae,o,l);const r=Reflect.get(n,o,l);if(w(o)?oe.has(o):ne(o))return r;if(e||ee(n,0,o),t)return r;if(We(r)){return!s||!A(o)?r.value:r}return S(r)?e?je(r):Be(r):r}}["includes","indexOf","lastIndexOf"].forEach((e=>{const t=Array.prototype[e];ae[e]=function(...e){const n=ze(this);for(let e=0,t=this.length;e{const t=Array.prototype[e];ae[e]=function(...e){Q();const n=t.apply(this,e);return Y(),n}}));function ue(e=!1){return function(t,n,o,l){const s=t[n];if(!e&&(o=ze(o),!b(t)&&We(s)&&!We(o)))return s.value=o,!0;const r=b(t)&&A(n)?Number(n)!0,deleteProperty:(e,t)=>!0},pe=m({},de,{get:se,set:ue(!0)}),he=(m({},fe,{get:ie}),e=>S(e)?Be(e):e),me=e=>S(e)?je(e):e,ve=e=>e,ge=e=>Reflect.getPrototypeOf(e);function ye(e,t,n=!1,o=!1){const l=ze(e=e.__v_raw),s=ze(t);t!==s&&!n&&ee(l,0,t),!n&&ee(l,0,s);const{has:r}=ge(l),i=n?me:o?ve:he;return r.call(l,t)?i(e.get(t)):r.call(l,s)?i(e.get(s)):void 0}function be(e,t=!1){const n=this.__v_raw,o=ze(n),l=ze(e);return e!==l&&!t&&ee(o,0,e),!t&&ee(o,0,l),e===l?n.has(e):n.has(e)||n.has(l)}function _e(e,t=!1){return e=e.__v_raw,!t&&ee(ze(e),0,z),Reflect.get(e,"size",e)}function Ce(e){e=ze(e);const t=ze(this);return ge(t).has.call(t,e)||(t.add(e),te(t,"add",e,e)),this}function xe(e,t){t=ze(t);const n=ze(this),{has:o,get:l}=ge(n);let s=o.call(n,e);s||(e=ze(e),s=o.call(n,e));const r=l.call(n,e);return n.set(e,t),s?V(t,r)&&te(n,"set",e,t):te(n,"add",e,t),this}function we(e){const t=ze(this),{has:n,get:o}=ge(t);let l=n.call(t,e);l||(e=ze(e),l=n.call(t,e));o&&o.call(t,e);const s=t.delete(e);return l&&te(t,"delete",e,void 0),s}function Se(){const e=ze(this),t=0!==e.size,n=e.clear();return t&&te(e,"clear",void 0,void 0),n}function ke(e,t){return function(n,o){const l=this,s=l.__v_raw,r=ze(s),i=e?me:t?ve:he;return!e&&ee(r,0,z),s.forEach(((e,t)=>n.call(o,i(e),i(t),l)))}}function Me(e,t,n){return function(...o){const l=this.__v_raw,s=ze(l),r=_(s),i="entries"===e||e===Symbol.iterator&&r,a="keys"===e&&r,c=l[e](...o),u=t?me:n?ve:he;return!t&&ee(s,0,a?H:z),{next(){const{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:i?[u(e[0]),u(e[1])]:u(e),done:t}},[Symbol.iterator](){return this}}}}function Ee(e){return function(...t){return"delete"!==e&&this}}const Ae={get(e){return ye(this,e)},get size(){return _e(this)},has:be,add:Ce,set:xe,delete:we,clear:Se,forEach:ke(!1,!1)},Fe={get(e){return ye(this,e,!1,!0)},get size(){return _e(this)},has:be,add:Ce,set:xe,delete:we,clear:Se,forEach:ke(!1,!0)},Le={get(e){return ye(this,e,!0)},get size(){return _e(this,!0)},has(e){return be.call(this,e,!0)},add:Ee("add"),set:Ee("set"),delete:Ee("delete"),clear:Ee("clear"),forEach:ke(!0,!1)};function Te(e,t){const n=t?Fe:e?Le:Ae;return(t,o,l)=>"__v_isReactive"===o?!e:"__v_isReadonly"===o?e:"__v_raw"===o?t:Reflect.get(y(n,o)&&o in t?n:t,o,l)}["keys","values","entries",Symbol.iterator].forEach((e=>{Ae[e]=Me(e,!1,!1),Le[e]=Me(e,!0,!1),Fe[e]=Me(e,!1,!0)}));const Oe={get:Te(!1,!1)},Ne={get:Te(!1,!0)},Re={get:Te(!0,!1)},$e=new WeakMap,Pe=new WeakMap;function Ve(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>E(e).slice(8,-1))(e))}function Be(e){return e&&e.__v_isReadonly?e:Ue(e,!1,de,Oe)}function je(e){return Ue(e,!0,fe,Re)}function Ue(e,t,n,o){if(!S(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const l=t?Pe:$e,s=l.get(e);if(s)return s;const r=Ve(e);if(0===r)return e;const i=new Proxy(e,2===r?o:n);return l.set(e,i),i}function Ie(e){return De(e)?Ie(e.__v_raw):!(!e||!e.__v_isReactive)}function De(e){return!(!e||!e.__v_isReadonly)}function Ke(e){return Ie(e)||De(e)}function ze(e){return e&&ze(e.__v_raw)||e}const He=e=>S(e)?Be(e):e;function We(e){return Boolean(e&&!0===e.__v_isRef)}function qe(e){return function(e,t=!1){if(We(e))return e;return new Ge(e,t)}(e)}class Ge{constructor(e,t=!1){this._rawValue=e,this._shallow=t,this.__v_isRef=!0,this._value=t?e:He(e)}get value(){return ee(ze(this),0,"value"),this._value}set value(e){V(ze(e),this._rawValue)&&(this._rawValue=e,this._value=this._shallow?e:He(e),te(ze(this),"set","value",e))}}const Je={get:(e,t,n)=>{return We(o=Reflect.get(e,t,n))?o.value:o;var o},set:(e,t,n,o)=>{const l=e[t];return We(l)&&!We(n)?(l.value=n,!0):Reflect.set(e,t,n,o)}};function Xe(e){return Ie(e)?e:new Proxy(e,Je)}class Ze{constructor(e,t){this._object=e,this._key=t,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(e){this._object[this._key]=e}}class Qe{constructor(e,t,n){this._setter=t,this._dirty=!0,this.__v_isRef=!0,this.effect=W(e,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,te(ze(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),ee(ze(this),0,"value"),this._value}set value(e){this._setter(e)}}function Ye(e,t,n,o){let l;try{l=o?e(...o):e()}catch(e){tt(e,t,n)}return l}function et(e,t,n,o){if(C(e)){const l=Ye(e,t,n,o);return l&&k(l)&&l.catch((e=>{tt(e,t,n)})),l}const l=[];for(let s=0;s>>1;Ct(lt[e])-1?lt.splice(t,0,e):lt.push(e),gt()}}function gt(){nt||ot||(ot=!0,pt=ft.then(xt))}function yt(e,t,n,o){b(e)?n.push(...e):t&&t.includes(e,e.allowRecurse?o+1:o)||n.push(e),gt()}function bt(e,t=null){if(rt.length){for(ht=t,it=[...new Set(rt)],rt.length=0,at=0;atCt(e)-Ct(t))),dt=0;dtnull==e.id?1/0:e.id;function xt(e){ot=!1,nt=!0,bt(e),lt.sort(((e,t)=>Ct(e)-Ct(t)));try{for(st=0;ste.trim())):t&&(l=n.map(U))}let i=P(O(t)),c=o[i];!c&&s&&(i=P(R(t)),c=o[i]),c&&et(c,e,6,l);const u=o[i+"Once"];if(u){if(e.emitted){if(e.emitted[i])return}else(e.emitted={})[i]=!0;et(u,e,6,l)}}function St(e,t,n=!1){if(!t.deopt&&void 0!==e.__emits)return e.__emits;const o=e.emits;let l={},s=!1;if(!C(e)){const o=e=>{s=!0,m(l,St(e,t,!0))};!n&&t.mixins.length&&t.mixins.forEach(o),e.extends&&o(e.extends),e.mixins&&e.mixins.forEach(o)}return o||s?(b(o)?o.forEach((e=>l[e]=null)):m(l,o),e.__emits=l):e.__emits=null}function kt(e,t){return!(!e||!p(t))&&(t=t.slice(2).replace(/Once$/,""),y(e,t[0].toLowerCase()+t.slice(1))||y(e,R(t))||y(e,t))}let Mt=null;function Et(e){Mt=e}function At(e){const{type:t,vnode:n,proxy:o,withProxy:l,props:s,propsOptions:[r],slots:i,attrs:a,emit:c,render:u,renderCache:d,data:f,setupState:p,ctx:m}=e;let v;Mt=e;try{let e;if(4&n.shapeFlag){const t=l||o;v=mo(u.call(t,t,d,s,p,f,m)),e=a}else{const n=t;0,v=mo(n.length>1?n(s,{attrs:a,slots:i,emit:c}):n(s,null)),e=t.props?a:Lt(a)}let g=v;if(!1!==t.inheritAttrs&&e){const t=Object.keys(e),{shapeFlag:n}=g;t.length&&(1&n||6&n)&&(r&&t.some(h)&&(e=Tt(e,r)),g=fo(g,e))}n.dirs&&(g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&(g.transition=n.transition),v=g}catch(t){tt(t,e,1),v=uo(Qn)}return Mt=null,v}function Ft(e){let t;for(let n=0;n{let t;for(const n in e)("class"===n||"style"===n||p(n))&&((t||(t={}))[n]=e[n]);return t},Tt=(e,t)=>{const n={};for(const o in e)h(o)&&o.slice(9)in t||(n[o]=e[o]);return n};function Ot(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let l=0;lRt+=e;function Pt(e,t,n={},o){let l=e[t];Rt++,no();const s=l&&Vt(l(n)),r=lo(Xn,{key:n.key||`_${t}`},s||(o?o():[]),s&&1===e._?64:-2);return Rt--,r}function Vt(e){return e.some((e=>!so(e)||e.type!==Qn&&!(e.type===Xn&&!Vt(e.children))))?e:null}function Bt(e,t=Mt){if(!t)return e;const n=(...n)=>{Rt||no(!0);const o=Mt;Et(t);const l=e(...n);return Et(o),Rt||oo(),l};return n._c=!0,n}let jt=null;const Ut=[];function It(e){Ut.push(jt=e)}function Dt(){Ut.pop(),jt=Ut[Ut.length-1]||null}function Kt(e){return t=>Bt((function(){It(e);const n=t.apply(this,arguments);return Dt(),n}))}function zt(e,t,n,o=!1){const l={},s={};j(s,io,1),Ht(e,t,l,s),n?e.props=o?l:Ue(l,!1,pe,Ne):e.type.props?e.props=l:e.props=s,e.attrs=s}function Ht(e,t,n,o){const[l,s]=e.propsOptions;if(t)for(const s in t){const r=t[s];if(F(s))continue;let i;l&&y(l,i=O(s))?n[i]=r:kt(e.emitsOptions,s)||(o[s]=r)}if(s){const t=ze(n);for(let o=0;o{r=!0;const[n,o]=qt(e,t,!0);m(l,n),o&&s.push(...o)};!n&&t.mixins.length&&t.mixins.forEach(o),e.extends&&o(e.extends),e.mixins&&e.mixins.forEach(o)}if(!o&&!r)return e.__props=c;if(b(o))for(let e=0;e-1,r[1]=n<0||e-1||y(r,"default"))&&s.push(t)}}}return e.__props=[l,s]}function Gt(e){return"$"!==e[0]}function Jt(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Xt(e,t){return Jt(e)===Jt(t)}function Zt(e,t){if(b(t)){for(let n=0,o=t.length;n{if(n.isUnmounted)return;Q(),Po(n);const l=et(t,n,e,o);return Po(null),Y(),l});return o?l.unshift(s):l.push(s),s}}const Yt=e=>(t,n=Ro)=>!Bo&&Qt(e,t,n),en=Yt("bm"),tn=Yt("m"),nn=Yt("bu"),on=Yt("u"),ln=Yt("bum"),sn=Yt("um"),rn=Yt("rtg"),an=Yt("rtc"),cn={};function un(e,t,n){return dn(e,t,n)}function dn(e,t,{immediate:n,deep:o,flush:l,onTrack:s,onTrigger:r}=a,i=Ro){let c,d,f=!1;if(We(e)?(c=()=>e.value,f=!!e._shallow):Ie(e)?(c=()=>e,o=!0):c=b(e)?()=>e.map((e=>We(e)?e.value:Ie(e)?pn(e):C(e)?Ye(e,i,2,[i&&i.proxy]):void 0)):C(e)?t?()=>Ye(e,i,2,[i&&i.proxy]):()=>{if(!i||!i.isUnmounted)return d&&d(),Ye(e,i,3,[p])}:u,t&&o){const e=c;c=()=>pn(e())}const p=e=>{d=y.options.onStop=()=>{Ye(e,i,4)}};let h=b(e)?[]:cn;const m=()=>{if(y.active)if(t){const e=y();(o||f||V(e,h))&&(d&&d(),et(t,i,3,[e,h===cn?void 0:h,p]),h=e)}else y()};let g;m.allowRecurse=!!t,g="sync"===l?m:"post"===l?()=>Vn(m,i&&i.suspense):()=>{!i||i.isMounted?function(e){yt(e,it,rt,at)}(m):m()};const y=W(c,{lazy:!0,onTrack:s,onTrigger:r,scheduler:g});return Io(y,i),t?n?m():h=y():"post"===l?Vn(y,i&&i.suspense):y(),()=>{q(y),i&&v(i.effects,y)}}function fn(e,t,n){const o=this.proxy;return dn(x(e)?()=>o[e]:e.bind(o),t.bind(o),n,this)}function pn(e,t=new Set){if(!S(e)||t.has(e))return e;if(t.add(e),We(e))pn(e.value,t);else if(b(e))for(let n=0;n{pn(e,t)}));else for(const n in e)pn(e[n],t);return e}const hn=[Function,Array],mn={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:hn,onEnter:hn,onAfterEnter:hn,onEnterCancelled:hn,onBeforeLeave:hn,onLeave:hn,onAfterLeave:hn,onLeaveCancelled:hn,onBeforeAppear:hn,onAppear:hn,onAfterAppear:hn,onAppearCancelled:hn},setup(e,{slots:t}){const n=$o(),o=function(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return tn((()=>{e.isMounted=!0})),ln((()=>{e.isUnmounting=!0})),e}();let l;return()=>{const s=t.default&&Cn(t.default(),!0);if(!s||!s.length)return;const r=ze(e),{mode:i}=r,a=s[0];if(o.isLeaving)return yn(a);const c=bn(a);if(!c)return yn(a);const u=gn(c,r,o,n);_n(c,u);const d=n.subTree,f=d&&bn(d);let p=!1;const{getTransitionKey:h}=c.type;if(h){const e=h();void 0===l?l=e:e!==l&&(l=e,p=!0)}if(f&&f.type!==Qn&&(!ro(c,f)||p)){const e=gn(f,r,o,n);if(_n(f,e),"out-in"===i)return o.isLeaving=!0,e.afterLeave=()=>{o.isLeaving=!1,n.update()},yn(a);"in-out"===i&&(e.delayLeave=(e,t,n)=>{vn(o,f)[String(f.key)]=f,e._leaveCb=()=>{t(),e._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=n})}return a}}};function vn(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function gn(e,t,n,o){const{appear:l,mode:s,persisted:r=!1,onBeforeEnter:i,onEnter:a,onAfterEnter:c,onEnterCancelled:u,onBeforeLeave:d,onLeave:f,onAfterLeave:p,onLeaveCancelled:h,onBeforeAppear:m,onAppear:v,onAfterAppear:g,onAppearCancelled:y}=t,b=String(e.key),_=vn(n,e),C=(e,t)=>{e&&et(e,o,9,t)},x={mode:s,persisted:r,beforeEnter(t){let o=i;if(!n.isMounted){if(!l)return;o=m||i}t._leaveCb&&t._leaveCb(!0);const s=_[b];s&&ro(e,s)&&s.el._leaveCb&&s.el._leaveCb(),C(o,[t])},enter(e){let t=a,o=c,s=u;if(!n.isMounted){if(!l)return;t=v||a,o=g||c,s=y||u}let r=!1;const i=e._enterCb=t=>{r||(r=!0,C(t?s:o,[e]),x.delayedLeave&&x.delayedLeave(),e._enterCb=void 0)};t?(t(e,i),t.length<=1&&i()):i()},leave(t,o){const l=String(e.key);if(t._enterCb&&t._enterCb(!0),n.isUnmounting)return o();C(d,[t]);let s=!1;const r=t._leaveCb=n=>{s||(s=!0,o(),C(n?h:p,[t]),t._leaveCb=void 0,_[l]===e&&delete _[l])};_[l]=e,f?(f(t,r),f.length<=1&&r()):r()},clone:e=>gn(e,t,n,o)};return x}function yn(e){if(xn(e))return(e=fo(e)).children=null,e}function bn(e){return xn(e)?e.children?e.children[0]:void 0:e}function _n(e,t){6&e.shapeFlag&&e.component?_n(e.component.subTree,t):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Cn(e,t=!1){let n=[],o=0;for(let l=0;l1)for(let e=0;ee.type.__isKeepAlive;function wn(e,t,n=Ro){const o=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}e()});if(Qt(t,o,n),n){let e=n.parent;for(;e&&e.parent;)xn(e.parent.vnode)&&Sn(o,t,n,e),e=e.parent}}function Sn(e,t,n,o){const l=Qt(t,e,o,!0);sn((()=>{v(o[t],l)}),n)}const kn=e=>"_"===e[0]||"$stable"===e,Mn=e=>b(e)?e.map(mo):[mo(e)],En=(e,t,n)=>Bt((e=>Mn(t(e))),n),An=(e,t)=>{const n=e._ctx;for(const o in e){if(kn(o))continue;const l=e[o];if(C(l))t[o]=En(0,l,n);else if(null!=l){const e=Mn(l);t[o]=()=>e}}},Fn=(e,t)=>{const n=Mn(t);e.slots.default=()=>n};function Ln(e,t){if(null===Mt)return e;const n=Mt.proxy,o=e.dirs||(e.dirs=[]);for(let e=0;e(s.has(e)||(e&&C(e.install)?(s.add(e),e.install(i,...t)):C(e)&&(s.add(e),e(i,...t))),i),mixin:e=>(l.mixins.includes(e)||(l.mixins.push(e),(e.props||e.emits)&&(l.deopt=!0)),i),component:(e,t)=>t?(l.components[e]=t,i):l.components[e],directive:(e,t)=>t?(l.directives[e]=t,i):l.directives[e],mount(s,a){if(!r){const c=uo(n,o);return c.appContext=l,a&&t?t(c,s):e(c,s),r=!0,i._container=s,s.__vue_app__=i,c.component.proxy}},unmount(){r&&(e(null,i._container),delete i._container.__vue_app__)},provide:(e,t)=>(l.provides[e]=t,i)};return i}}function $n(e){return C(e)?{setup:e,name:e.name}:e}const Pn={scheduler:vt,allowRecurse:!0},Vn=function(e,t){t&&t.pendingBranch?b(e)?t.effects.push(...e):t.effects.push(e):yt(e,ut,ct,dt)},Bn=(e,t,n,o)=>{if(b(e))return void e.forEach(((e,l)=>Bn(e,t&&(b(t)?t[l]:t),n,o)));let l;l=!o||o.type.__asyncLoader?null:4&o.shapeFlag?o.component.exposed||o.component.proxy:o.el;const{i:s,r:r}=e,i=t&&t.r,c=s.refs===a?s.refs={}:s.refs,u=s.setupState;if(null!=i&&i!==r&&(x(i)?(c[i]=null,y(u,i)&&(u[i]=null)):We(i)&&(i.value=null)),x(r)){const e=()=>{c[r]=l,y(u,r)&&(u[r]=l)};l?(e.id=-1,Vn(e,n)):e()}else if(We(r)){const e=()=>{r.value=l};l?(e.id=-1,Vn(e,n)):e()}else C(r)&&Ye(r,s,12,[l,c])};function jn(e){return function(e,t){const{insert:n,remove:o,patchProp:l,forcePatchProp:s,createElement:r,createText:i,createComment:d,setText:f,setElementText:p,parentNode:h,nextSibling:v,setScopeId:g=u,cloneNode:b,insertStaticContent:_}=e,C=(e,t,n,o=null,l=null,s=null,r=!1,i=!1)=>{e&&!ro(e,t)&&(o=re(e),ee(e,l,s,!0),e=null),-2===t.patchFlag&&(i=!1,t.dynamicChildren=null);const{type:a,ref:c,shapeFlag:u}=t;switch(a){case Zn:x(e,t,n,o);break;case Qn:w(e,t,n,o);break;case Yn:null==e&&S(t,n,o,r);break;case Xn:U(e,t,n,o,l,s,r,i);break;default:1&u?A(e,t,n,o,l,s,r,i):6&u?I(e,t,n,o,l,s,r,i):(64&u||128&u)&&a.process(e,t,n,o,l,s,r,i,ae)}null!=c&&l&&Bn(c,e&&e.ref,s,t)},x=(e,t,o,l)=>{if(null==e)n(t.el=i(t.children),o,l);else{const n=t.el=e.el;t.children!==e.children&&f(n,t.children)}},w=(e,t,o,l)=>{null==e?n(t.el=d(t.children||""),o,l):t.el=e.el},S=(e,t,n,o)=>{[e.el,e.anchor]=_(e.children,t,n,o)},M=({el:e,anchor:t},o,l)=>{let s;for(;e&&e!==t;)s=v(e),n(e,o,l),e=s;n(t,o,l)},E=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=v(e),o(e),e=n;o(t)},A=(e,t,n,o,l,s,r,i)=>{r=r||"svg"===t.type,null==e?L(t,n,o,l,s,r,i):$(e,t,l,s,r,i)},L=(e,t,o,s,i,a,c)=>{let u,d;const{type:f,props:h,shapeFlag:m,transition:v,scopeId:g,patchFlag:y,dirs:_}=e;if(e.el&&void 0!==b&&-1===y)u=e.el=b(e.el);else{if(u=e.el=r(e.type,a,h&&h.is),8&m?p(u,e.children):16&m&&N(e.children,u,null,s,i,a&&"foreignObject"!==f,c||!!e.dynamicChildren),_&&Tn(e,null,s,"created"),h){for(const t in h)F(t)||l(u,t,null,h[t],a,e.children,s,i,se);(d=h.onVnodeBeforeMount)&&Un(d,s,e)}T(u,g,e,s)}_&&Tn(e,null,s,"beforeMount");const C=(!i||i&&!i.pendingBranch)&&v&&!v.persisted;C&&v.beforeEnter(u),n(u,t,o),((d=h&&h.onVnodeMounted)||C||_)&&Vn((()=>{d&&Un(d,s,e),C&&v.enter(u),_&&Tn(e,null,s,"mounted")}),i)},T=(e,t,n,o)=>{if(t&&g(e,t),o){const l=o.type.__scopeId;l&&l!==t&&g(e,l+"-s"),n===o.subTree&&T(e,o.vnode.scopeId,o.vnode,o.parent)}},N=(e,t,n,o,l,s,r,i=0)=>{for(let a=i;a{const c=t.el=e.el;let{patchFlag:u,dynamicChildren:d,dirs:f}=t;u|=16&e.patchFlag;const h=e.props||a,m=t.props||a;let v;if((v=m.onVnodeBeforeUpdate)&&Un(v,n,t,e),f&&Tn(t,e,n,"beforeUpdate"),u>0){if(16&u)V(c,t,h,m,n,o,r);else if(2&u&&h.class!==m.class&&l(c,"class",null,m.class,r),4&u&&l(c,"style",h.style,m.style,r),8&u){const i=t.dynamicProps;for(let t=0;t{v&&Un(v,n,t,e),f&&Tn(t,e,n,"updated")}),o)},P=(e,t,n,o,l,s)=>{for(let r=0;r{if(n!==o){for(const a in o){if(F(a))continue;const u=o[a],d=n[a];(u!==d||s&&s(e,a))&&l(e,a,d,u,c,t.children,r,i,se)}if(n!==a)for(const s in n)F(s)||s in o||l(e,s,n[s],null,c,t.children,r,i,se)}},U=(e,t,o,l,s,r,a,c)=>{const u=t.el=e?e.el:i(""),d=t.anchor=e?e.anchor:i("");let{patchFlag:f,dynamicChildren:p}=t;f>0&&(c=!0),null==e?(n(u,o,l),n(d,o,l),N(t.children,o,d,s,r,a,c)):f>0&&64&f&&p&&e.dynamicChildren?(P(e.dynamicChildren,p,o,s,r,a),(null!=t.key||s&&t===s.subTree)&&In(e,t,!0)):G(e,t,o,d,s,r,a,c)},I=(e,t,n,o,l,s,r,i)=>{null==e?512&t.shapeFlag?l.ctx.activate(t,n,o,r,i):D(t,n,o,l,s,r,i):K(e,t,i)},D=(e,t,n,o,l,s,r)=>{const i=e.component=function(e,t,n){const o=e.type,l=(t?t.appContext:e.appContext)||Oo,s={uid:No++,vnode:e,type:o,parent:t,appContext:l,root:null,next:null,subTree:null,update:null,render:null,proxy:null,exposed:null,withProxy:null,effects:null,provides:t?t.provides:Object.create(l.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:qt(o,l),emitsOptions:St(o,l),emit:null,emitted:null,ctx:a,data:a,props:a,attrs:a,slots:a,refs:a,setupState:a,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null};return s.ctx={_:s},s.root=t?t.root:s,s.emit=wt.bind(null,s),s}(e,o,l);if(xn(e)&&(i.ctx.renderer=ae),function(e,t=!1){Bo=t;const{props:n,children:o}=e.vnode,l=Vo(e);zt(e,n,l,t),((e,t)=>{if(32&e.vnode.shapeFlag){const n=t._;n?(e.slots=t,j(t,"_",n)):An(t,e.slots={})}else e.slots={},t&&Fn(e,t);j(e.slots,io,1)})(e,o);const s=l?function(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Lo);const{setup:o}=n;if(o){const n=e.setupContext=o.length>1?function(e){const t=t=>{e.exposed=Xe(t)};return{attrs:e.attrs,slots:e.slots,emit:e.emit,expose:t}}(e):null;Ro=e,Q();const l=Ye(o,e,0,[e.props,n]);if(Y(),Ro=null,k(l)){if(t)return l.then((t=>{jo(e,t)}));e.asyncDep=l}else jo(e,l)}else Uo(e)}(e,t):void 0;Bo=!1}(i),i.asyncDep){if(l&&l.registerDep(i,z),!e.el){const e=i.subTree=uo(Qn);w(null,e,t,n)}}else z(i,e,t,n,l,s,r)},K=(e,t,n)=>{const o=t.component=e.component;if(function(e,t,n){const{props:o,children:l,component:s}=e,{props:r,children:i,patchFlag:a}=t,c=s.emitsOptions;if(t.dirs||t.transition)return!0;if(!(n&&a>=0))return!(!l&&!i||i&&i.$stable)||o!==r&&(o?!r||Ot(o,r,c):!!r);if(1024&a)return!0;if(16&a)return o?Ot(o,r,c):!!r;if(8&a){const e=t.dynamicProps;for(let t=0;t-1&<.splice(t,1)}(o.update),o.update()}else t.component=e.component,t.el=e.el,o.vnode=t},z=(e,t,n,o,l,s,r)=>{e.update=W((function(){if(e.isMounted){let t,{next:n,bu:o,u:i,parent:a,vnode:c}=e,u=n;n?(n.el=c.el,H(e,n,r)):n=c,o&&B(o),(t=n.props&&n.props.onVnodeBeforeUpdate)&&Un(t,a,n,c);const d=At(e),f=e.subTree;e.subTree=d,C(f,d,h(f.el),re(f),e,l,s),n.el=d.el,null===u&&function({vnode:e,parent:t},n){for(;t&&t.subTree===e;)(e=t.vnode).el=n,t=t.parent}(e,d.el),i&&Vn(i,l),(t=n.props&&n.props.onVnodeUpdated)&&Vn((()=>{Un(t,a,n,c)}),l)}else{let r;const{el:i,props:a}=t,{bm:c,m:u,parent:d}=e;c&&B(c),(r=a&&a.onVnodeBeforeMount)&&Un(r,d,t);const f=e.subTree=At(e);if(i&&ue?ue(t.el,f,e,l):(C(null,f,n,o,e,l,s),t.el=f.el),u&&Vn(u,l),r=a&&a.onVnodeMounted){const e=t;Vn((()=>{Un(r,d,e)}),l)}const{a:p}=e;p&&256&t.shapeFlag&&Vn(p,l),e.isMounted=!0,t=n=o=null}}),Pn)},H=(e,t,n)=>{t.component=e;const o=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,o){const{props:l,attrs:s,vnode:{patchFlag:r}}=e,i=ze(l),[c]=e.propsOptions;if(!(o||r>0)||16&r){let o;Ht(e,t,l,s);for(const s in i)t&&(y(t,s)||(o=R(s))!==s&&y(t,o))||(c?!n||void 0===n[s]&&void 0===n[o]||(l[s]=Wt(c,t||a,s,void 0,e)):delete l[s]);if(s!==i)for(const e in s)t&&y(t,e)||delete s[e]}else if(8&r){const n=e.vnode.dynamicProps;for(let o=0;o{const{vnode:n,slots:o}=e;let l=!0,s=a;if(32&n.shapeFlag){const e=t._;e?1===e?l=!1:m(o,t):(l=!t.$stable,An(t,o)),s=t}else t&&(Fn(e,t),s={default:1});if(l)for(const e in o)kn(e)||e in s||delete o[e]})(e,t.children),bt(void 0,e.update)},G=(e,t,n,o,l,s,r,i=!1)=>{const a=e&&e.children,c=e?e.shapeFlag:0,u=t.children,{patchFlag:d,shapeFlag:f}=t;if(d>0){if(128&d)return void X(a,u,n,o,l,s,r,i);if(256&d)return void J(a,u,n,o,l,s,r,i)}8&f?(16&c&&se(a,l,s),u!==a&&p(n,u)):16&c?16&f?X(a,u,n,o,l,s,r,i):se(a,l,s,!0):(8&c&&p(n,""),16&f&&N(u,n,o,l,s,r,i))},J=(e,t,n,o,l,s,r,i)=>{t=t||c;const a=(e=e||c).length,u=t.length,d=Math.min(a,u);let f;for(f=0;fu?se(e,l,s,!0,!1,d):N(t,n,o,l,s,r,i,d)},X=(e,t,n,o,l,s,r,i)=>{let a=0;const u=t.length;let d=e.length-1,f=u-1;for(;a<=d&&a<=f;){const o=e[a],c=t[a]=i?vo(t[a]):mo(t[a]);if(!ro(o,c))break;C(o,c,n,null,l,s,r,i),a++}for(;a<=d&&a<=f;){const o=e[d],a=t[f]=i?vo(t[f]):mo(t[f]);if(!ro(o,a))break;C(o,a,n,null,l,s,r,i),d--,f--}if(a>d){if(a<=f){const e=f+1,c=ef)for(;a<=d;)ee(e[a],l,s,!0),a++;else{const p=a,h=a,m=new Map;for(a=h;a<=f;a++){const e=t[a]=i?vo(t[a]):mo(t[a]);null!=e.key&&m.set(e.key,a)}let v,g=0;const y=f-h+1;let b=!1,_=0;const x=new Array(y);for(a=0;a=y){ee(o,l,s,!0);continue}let c;if(null!=o.key)c=m.get(o.key);else for(v=h;v<=f;v++)if(0===x[v-h]&&ro(o,t[v])){c=v;break}void 0===c?ee(o,l,s,!0):(x[c-h]=a+1,c>=_?_=c:b=!0,C(o,t[c],n,null,l,s,r,i),g++)}const w=b?function(e){const t=e.slice(),n=[0];let o,l,s,r,i;const a=e.length;for(o=0;o0&&(t[o]=n[s-1]),n[s]=o)}}s=n.length,r=n[s-1];for(;s-- >0;)n[s]=r,r=t[r];return n}(x):c;for(v=w.length-1,a=y-1;a>=0;a--){const e=h+a,i=t[e],c=e+1{const{el:r,type:i,transition:a,children:c,shapeFlag:u}=e;if(6&u)return void Z(e.component.subTree,t,o,l);if(128&u)return void e.suspense.move(t,o,l);if(64&u)return void i.move(e,t,o,ae);if(i===Xn){n(r,t,o);for(let e=0;ea.enter(r)),s);else{const{leave:e,delayLeave:l,afterLeave:s}=a,i=()=>n(r,t,o),c=()=>{e(r,(()=>{i(),s&&s()}))};l?l(r,i,c):c()}else n(r,t,o)},ee=(e,t,n,o=!1,l=!1)=>{const{type:s,props:r,ref:i,children:a,dynamicChildren:c,shapeFlag:u,patchFlag:d,dirs:f}=e;if(null!=i&&Bn(i,null,n,null),256&u)return void t.ctx.deactivate(e);const p=1&u&&f;let h;if((h=r&&r.onVnodeBeforeUnmount)&&Un(h,t,e),6&u)le(e.component,n,o);else{if(128&u)return void e.suspense.unmount(n,o);p&&Tn(e,null,t,"beforeUnmount"),c&&(s!==Xn||d>0&&64&d)?se(c,t,n,!1,!0):(s===Xn&&(128&d||256&d)||!l&&16&u)&&se(a,t,n),64&u&&(o||!Dn(e.props))&&e.type.remove(e,ae),o&&ne(e)}((h=r&&r.onVnodeUnmounted)||p)&&Vn((()=>{h&&Un(h,t,e),p&&Tn(e,null,t,"unmounted")}),n)},ne=e=>{const{type:t,el:n,anchor:l,transition:s}=e;if(t===Xn)return void oe(n,l);if(t===Yn)return void E(e);const r=()=>{o(n),s&&!s.persisted&&s.afterLeave&&s.afterLeave()};if(1&e.shapeFlag&&s&&!s.persisted){const{leave:t,delayLeave:o}=s,l=()=>t(n,r);o?o(e.el,r,l):l()}else r()},oe=(e,t)=>{let n;for(;e!==t;)n=v(e),o(e),e=n;o(t)},le=(e,t,n)=>{const{bum:o,effects:l,update:s,subTree:r,um:i}=e;if(o&&B(o),l)for(let e=0;e{e.isUnmounted=!0}),t),t&&t.pendingBranch&&!t.isUnmounted&&e.asyncDep&&!e.asyncResolved&&e.suspenseId===t.pendingId&&(t.deps--,0===t.deps&&t.resolve())},se=(e,t,n,o=!1,l=!1,s=0)=>{for(let r=s;r6&e.shapeFlag?re(e.component.subTree):128&e.shapeFlag?e.suspense.next():v(e.anchor||e.el),ie=(e,t)=>{null==e?t._vnode&&ee(t._vnode,null,null,!0):C(t._vnode||null,e,t),_t(),t._vnode=e},ae={p:C,um:ee,m:Z,r:ne,mt:D,mc:N,pc:G,pbc:P,n:re,o:e};let ce,ue;t&&([ce,ue]=t(ae));return{render:ie,hydrate:ce,createApp:Rn(ie,ce)}}(e)}function Un(e,t,n,o=null){et(e,t,7,[n,o])}function In(e,t,n=!1){const o=e.children,l=t.children;if(b(o)&&b(l))for(let e=0;ee&&(e.disabled||""===e.disabled),Kn=e=>"undefined"!=typeof SVGElement&&e instanceof SVGElement,zn=(e,t)=>{const n=e&&e.to;if(x(n)){if(t){return t(n)}return null}return n};function Hn(e,t,n,{o:{insert:o},m:l},s=2){0===s&&o(e.targetAnchor,t,n);const{el:r,anchor:i,shapeFlag:a,children:c,props:u}=e,d=2===s;if(d&&o(r,t,n),(!d||Dn(u))&&16&a)for(let e=0;e{16&g&&c(y,e,t,l,s,r,i)};v?m(n,a):u&&m(u,d)}else{t.el=e.el;const o=t.anchor=e.anchor,c=t.target=e.target,f=t.targetAnchor=e.targetAnchor,h=Dn(e.props),m=h?n:c,g=h?o:f;if(r=r||Kn(c),t.dynamicChildren?(d(e.dynamicChildren,t.dynamicChildren,m,l,s,r),In(e,t,!0)):i||u(e,t,m,g,l,s,r),v)h||Hn(t,n,o,a,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const e=t.target=zn(t.props,p);e&&Hn(t,e,null,a,0)}else h&&Hn(t,c,f,a,1)}},remove(e,{r:t,o:{remove:n}}){const{shapeFlag:o,children:l,anchor:s}=e;if(n(s),16&o)for(let e=0;enull!=e?e:null,co=({ref:e})=>null!=e?x(e)||We(e)||C(e)?{i:Mt,r:e}:e:null,uo=function(e,t=null,n=null,l=0,s=null,r=!1){e&&e!==Gn||(e=Qn);if(so(e)){const o=fo(e,t,!0);return n&&go(o,n),o}a=e,C(a)&&"__vccOpts"in a&&(e=e.__vccOpts);var a;if(t){(Ke(t)||io in t)&&(t=m({},t));let{class:e,style:n}=t;e&&!x(e)&&(t.class=i(e)),S(n)&&(Ke(n)&&!b(n)&&(n=m({},n)),t.style=o(n))}const c=x(e)?1:(e=>e.__isSuspense)(e)?128:(e=>e.__isTeleport)(e)?64:S(e)?4:C(e)?2:0,u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ao(t),ref:t&&co(t),scopeId:jt,children:null,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:c,patchFlag:l,dynamicProps:s,dynamicChildren:null,appContext:null};if(go(u,n),128&c){const{content:e,fallback:t}=function(e){const{shapeFlag:t,children:n}=e;let o,l;return 32&t?(o=Nt(n.default),l=Nt(n.fallback)):(o=Nt(n),l=mo(null)),{content:o,fallback:l}}(u);u.ssContent=e,u.ssFallback=t}!r&&to&&(l>0||6&c)&&32!==l&&to.push(u);return u};function fo(e,t,n=!1){const{props:l,ref:s,patchFlag:r,children:a}=e,c=t?function(...e){const t=m({},e[0]);for(let n=1;n1)return n&&C(t)?t():t}}let bo=!1;function _o(e,t,n=[],o=[],l=[],s=!1){const{mixins:r,extends:i,data:c,computed:d,methods:f,watch:p,provide:h,inject:v,components:g,directives:y,beforeMount:_,mounted:x,beforeUpdate:w,updated:k,activated:M,deactivated:E,beforeDestroy:A,beforeUnmount:F,destroyed:L,unmounted:T,render:O,renderTracked:N,renderTriggered:R,errorCaptured:$,expose:P}=t,V=e.proxy,B=e.ctx,j=e.appContext.mixins;if(s&&O&&e.render===u&&(e.render=O),s||(bo=!0,Co("beforeCreate","bc",t,e,j),bo=!1,So(e,j,n,o,l)),i&&_o(e,i,n,o,l,!0),r&&So(e,r,n,o,l),v)if(b(v))for(let e=0;eko(e,t,V))),c&&ko(e,c,V)),d)for(const e in d){const t=d[e],n=Ko({get:C(t)?t.bind(V,V):C(t.get)?t.get.bind(V,V):u,set:!C(t)&&C(t.set)?t.set.bind(V):u});Object.defineProperty(B,e,{enumerable:!0,configurable:!0,get:()=>n.value,set:e=>n.value=e})}var U;if(p&&o.push(p),!s&&o.length&&o.forEach((e=>{for(const t in e)Mo(e[t],B,V,t)})),h&&l.push(h),!s&&l.length&&l.forEach((e=>{const t=C(e)?e.call(V):e;Reflect.ownKeys(t).forEach((e=>{!function(e,t){if(Ro){let n=Ro.provides;const o=Ro.parent&&Ro.parent.provides;o===n&&(n=Ro.provides=Object.create(o)),n[e]=t}}(e,t[e])}))})),s&&(g&&m(e.components||(e.components=m({},e.type.components)),g),y&&m(e.directives||(e.directives=m({},e.type.directives)),y)),s||Co("created","c",t,e,j),_&&en(_.bind(V)),x&&tn(x.bind(V)),w&&nn(w.bind(V)),k&&on(k.bind(V)),M&&wn(M.bind(V),"a",U),E&&function(e,t){wn(e,"da",t)}(E.bind(V)),$&&((e,t=Ro)=>{Qt("ec",e,t)})($.bind(V)),N&&an(N.bind(V)),R&&rn(R.bind(V)),F&&ln(F.bind(V)),T&&sn(T.bind(V)),b(P)&&!s)if(P.length){const t=e.exposed||(e.exposed=Xe({}));P.forEach((e=>{t[e]=function(e,t){return We(e[t])?e[t]:new Ze(e,t)}(V,e)}))}else e.exposed||(e.exposed=a)}function Co(e,t,n,o,l){wo(e,t,l,o);const{extends:s,mixins:r}=n;s&&xo(e,t,s,o),r&&wo(e,t,r,o);const i=n[e];i&&et(i.bind(o.proxy),o,t)}function xo(e,t,n,o){n.extends&&xo(e,t,n.extends,o);const l=n[e];l&&et(l.bind(o.proxy),o,t)}function wo(e,t,n,o){for(let l=0;l{let t=e;for(let e=0;en[o];if(x(e)){const n=t[e];C(n)&&un(l,n)}else if(C(e))un(l,e.bind(n));else if(S(e))if(b(e))e.forEach((e=>Mo(e,t,n,o)));else{const o=C(e.handler)?e.handler.bind(n):t[e.handler];C(o)&&un(l,o,e)}}function Eo(e,t,n){const o=n.appContext.config.optionMergeStrategies,{mixins:l,extends:s}=t;s&&Eo(e,s,n),l&&l.forEach((t=>Eo(e,t,n)));for(const l in t)o&&y(o,l)?e[l]=o[l](e[l],t[l],n.proxy,l):e[l]=t[l]}const Ao=e=>e?Vo(e)?e.exposed?e.exposed:e.proxy:Ao(e.parent):null,Fo=m(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ao(e.parent),$root:e=>Ao(e.root),$emit:e=>e.emit,$options:e=>function(e){const t=e.type,{__merged:n,mixins:o,extends:l}=t;if(n)return n;const s=e.appContext.mixins;if(!s.length&&!o&&!l)return t;const r={};return s.forEach((t=>Eo(r,t,e))),Eo(r,t,e),t.__merged=r}(e),$forceUpdate:e=>()=>vt(e.update),$nextTick:e=>mt.bind(e.proxy),$watch:e=>fn.bind(e)}),Lo={get({_:e},t){const{ctx:n,setupState:o,data:l,props:s,accessCache:r,type:i,appContext:c}=e;if("__v_skip"===t)return!0;let u;if("$"!==t[0]){const i=r[t];if(void 0!==i)switch(i){case 0:return o[t];case 1:return l[t];case 3:return n[t];case 2:return s[t]}else{if(o!==a&&y(o,t))return r[t]=0,o[t];if(l!==a&&y(l,t))return r[t]=1,l[t];if((u=e.propsOptions[0])&&y(u,t))return r[t]=2,s[t];if(n!==a&&y(n,t))return r[t]=3,n[t];bo||(r[t]=4)}}const d=Fo[t];let f,p;return d?("$attrs"===t&&ee(e,0,t),d(e)):(f=i.__cssModules)&&(f=f[t])?f:n!==a&&y(n,t)?(r[t]=3,n[t]):(p=c.config.globalProperties,y(p,t)?p[t]:void 0)},set({_:e},t,n){const{data:o,setupState:l,ctx:s}=e;if(l!==a&&y(l,t))l[t]=n;else if(o!==a&&y(o,t))o[t]=n;else if(y(e.props,t))return!1;return("$"!==t[0]||!(t.slice(1)in e))&&(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:l,propsOptions:s}},r){let i;return void 0!==n[r]||e!==a&&y(e,r)||t!==a&&y(t,r)||(i=s[0])&&y(i,r)||y(o,r)||y(Fo,r)||y(l.config.globalProperties,r)}},To=m({},Lo,{get(e,t){if(t!==Symbol.unscopables)return Lo.get(e,t,e)},has:(e,n)=>"_"!==n[0]&&!t(n)}),Oo=On();let No=0;let Ro=null;const $o=()=>Ro||Mt,Po=e=>{Ro=e};function Vo(e){return 4&e.vnode.shapeFlag}let Bo=!1;function jo(e,t,n){C(t)?e.render=t:S(t)&&(e.setupState=Xe(t)),Uo(e)}function Uo(e,t){const n=e.type;e.render||(e.render=n.render||u,e.render._rc&&(e.withProxy=new Proxy(e.ctx,To))),Ro=e,Q(),_o(e,n),Y(),Ro=null}function Io(e,t=Ro){t&&(t.effects||(t.effects=[])).push(e)}function Do(e){return C(e)&&e.displayName||e.name}function Ko(e){const t=function(e){let t,n;return C(e)?(t=e,n=u):(t=e.get,n=e.set),new Qe(t,n,C(e)||!e.set)}(e);return Io(t.effect),t}const zo="3.0.7",Ho="http://www.w3.org/2000/svg",Wo="undefined"!=typeof document?document:null;let qo,Go;const Jo={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n)=>t?Wo.createElementNS(Ho,e):Wo.createElement(e,n?{is:n}:void 0),createText:e=>Wo.createTextNode(e),createComment:e=>Wo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Wo.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},cloneNode:e=>e.cloneNode(!0),insertStaticContent(e,t,n,o){const l=o?Go||(Go=Wo.createElementNS(Ho,"svg")):qo||(qo=Wo.createElement("div"));l.innerHTML=e;const s=l.firstChild;let r=s,i=r;for(;r;)i=r,Jo.insert(r,t,n),r=l.firstChild;return[s,i]}};const Xo=/\s*!important$/;function Zo(e,t,n){if(b(n))n.forEach((n=>Zo(e,t,n)));else if(t.startsWith("--"))e.setProperty(t,n);else{const o=function(e,t){const n=Yo[t];if(n)return n;let o=O(t);if("filter"!==o&&o in e)return Yo[t]=o;o=$(o);for(let n=0;ndocument.createEvent("Event").timeStamp&&(tl=()=>performance.now());let nl=0;const ol=Promise.resolve(),ll=()=>{nl=0};function sl(e,t,n,o,l=null){const s=e._vei||(e._vei={}),r=s[t];if(o&&r)r.value=o;else{const[n,i]=function(e){let t;if(rl.test(e)){let n;for(t={};n=e.match(rl);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[R(e.slice(2)),t]}(t);if(o){!function(e,t,n,o){e.addEventListener(t,n,o)}(e,n,s[t]=function(e,t){const n=e=>{(e.timeStamp||tl())>=n.attached-1&&et(function(e,t){if(b(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map((e=>t=>!t._stopped&&e(t)))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=(()=>nl||(ol.then(ll),nl=tl()))(),n}(o,l),i)}else r&&(!function(e,t,n,o){e.removeEventListener(t,n,o)}(e,n,r,i),s[t]=void 0)}}const rl=/(?:Once|Passive|Capture)$/;const il=/^on[a-z]/;const al="transition",cl=(e,{slots:t})=>function(e,t,n){const o=arguments.length;return 2===o?S(t)&&!b(t)?so(t)?uo(e,null,[t]):uo(e,t):uo(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):3===o&&so(n)&&(n=[n]),uo(e,t,n))}(mn,function(e){let{name:t="v",type:n,css:o=!0,duration:l,enterFromClass:s=`${t}-enter-from`,enterActiveClass:r=`${t}-enter-active`,enterToClass:i=`${t}-enter-to`,appearFromClass:a=s,appearActiveClass:c=r,appearToClass:u=i,leaveFromClass:d=`${t}-leave-from`,leaveActiveClass:f=`${t}-leave-active`,leaveToClass:p=`${t}-leave-to`}=e;const h={};for(const t in e)t in ul||(h[t]=e[t]);if(!o)return h;const v=function(e){if(null==e)return null;if(S(e))return[dl(e.enter),dl(e.leave)];{const t=dl(e);return[t,t]}}(l),g=v&&v[0],y=v&&v[1],{onBeforeEnter:b,onEnter:_,onEnterCancelled:C,onLeave:x,onLeaveCancelled:w,onBeforeAppear:k=b,onAppear:M=_,onAppearCancelled:E=C}=h,A=(e,t,n)=>{pl(e,t?u:i),pl(e,t?c:r),n&&n()},F=(e,t)=>{pl(e,p),pl(e,f),t&&t()},L=e=>(t,o)=>{const l=e?M:_,r=()=>A(t,e,o);l&&l(t,r),hl((()=>{pl(t,e?a:s),fl(t,e?u:i),l&&l.length>1||vl(t,n,g,r)}))};return m(h,{onBeforeEnter(e){b&&b(e),fl(e,s),fl(e,r)},onBeforeAppear(e){k&&k(e),fl(e,a),fl(e,c)},onEnter:L(!1),onAppear:L(!0),onLeave(e,t){const o=()=>F(e,t);fl(e,d),document.body.offsetHeight,fl(e,f),hl((()=>{pl(e,d),fl(e,p),x&&x.length>1||vl(e,n,y,o)})),x&&x(e,o)},onEnterCancelled(e){A(e,!1),C&&C(e)},onAppearCancelled(e){A(e,!0),E&&E(e)},onLeaveCancelled(e){F(e),w&&w(e)}})}(e),t);cl.displayName="Transition";const ul={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};cl.props=m({},mn.props,ul);function dl(e){return U(e)}function fl(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.add(t))),(e._vtc||(e._vtc=new Set)).add(t)}function pl(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.remove(t)));const{_vtc:n}=e;n&&(n.delete(t),n.size||(e._vtc=void 0))}function hl(e){requestAnimationFrame((()=>{requestAnimationFrame(e)}))}let ml=0;function vl(e,t,n,o){const l=e._endId=++ml,s=()=>{l===e._endId&&o()};if(n)return setTimeout(s,n);const{type:r,timeout:i,propCount:a}=function(e,t){const n=window.getComputedStyle(e),o=e=>(n[e]||"").split(", "),l=o("transitionDelay"),s=o("transitionDuration"),r=gl(l,s),i=o("animationDelay"),a=o("animationDuration"),c=gl(i,a);let u=null,d=0,f=0;t===al?r>0&&(u=al,d=r,f=s.length):"animation"===t?c>0&&(u="animation",d=c,f=a.length):(d=Math.max(r,c),u=d>0?r>c?al:"animation":null,f=u?u===al?s.length:a.length:0);const p=u===al&&/\b(transform|all)(,|$)/.test(n.transitionProperty);return{type:u,timeout:d,propCount:f,hasTransform:p}}(e,t);if(!r)return o();const c=r+"end";let u=0;const d=()=>{e.removeEventListener(c,f),s()},f=t=>{t.target===e&&++u>=a&&d()};setTimeout((()=>{uyl(t)+yl(e[n]))))}function yl(e){return 1e3*Number(e.slice(0,-1).replace(",","."))}const bl=["ctrl","shift","alt","meta"],_l={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>bl.some((n=>e[`${n}Key`]&&!t.includes(n)))},Cl={beforeMount(e,{value:t},{transition:n}){e._vod="none"===e.style.display?"":e.style.display,n&&t?n.beforeEnter(e):xl(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:o}){!t!=!n&&(o?t?(o.beforeEnter(e),xl(e,!0),o.enter(e)):o.leave(e,(()=>{xl(e,!1)})):xl(e,t))},beforeUnmount(e,{value:t}){xl(e,t)}};function xl(e,t){e.style.display=t?e._vod:"none"}const wl=m({patchProp:(e,t,o,l,s=!1,r,i,a,c)=>{switch(t){case"class":!function(e,t,n){if(null==t&&(t=""),n)e.setAttribute("class",t);else{const n=e._vtc;n&&(t=(t?[t,...n]:[...n]).join(" ")),e.className=t}}(e,l,s);break;case"style":!function(e,t,n){const o=e.style;if(n)if(x(n)){if(t!==n){const t=o.display;o.cssText=n,"_vod"in e&&(o.display=t)}}else{for(const e in n)Zo(o,e,n[e]);if(t&&!x(t))for(const e in t)null==n[e]&&Zo(o,e,"")}else e.removeAttribute("style")}(e,o,l);break;default:p(t)?h(t)||sl(e,t,0,l,i):function(e,t,n,o){if(o)return"innerHTML"===t||!!(t in e&&il.test(t)&&C(n));if("spellcheck"===t||"draggable"===t)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if(il.test(t)&&x(n))return!1;return t in e}(e,t,l,s)?function(e,t,n,o,l,s,r){if("innerHTML"===t||"textContent"===t)return o&&r(o,l,s),void(e[t]=null==n?"":n);if("value"!==t||"PROGRESS"===e.tagName){if(""===n||null==n){const o=typeof e[t];if(""===n&&"boolean"===o)return void(e[t]=!0);if(null==n&&"string"===o)return e[t]="",void e.removeAttribute(t);if("number"===o)return e[t]=0,void e.removeAttribute(t)}try{e[t]=n}catch(e){}}else{e._value=n;const t=null==n?"":n;e.value!==t&&(e.value=t)}}(e,t,l,r,i,a,c):("true-value"===t?e._trueValue=l:"false-value"===t&&(e._falseValue=l),function(e,t,o,l){if(l&&t.startsWith("xlink:"))null==o?e.removeAttributeNS(el,t.slice(6,t.length)):e.setAttributeNS(el,t,o);else{const l=n(t);null==o||l&&!1===o?e.removeAttribute(t):e.setAttribute(t,l?"":o)}}(e,t,l,s))}},forcePatchProp:(e,t)=>"value"===t},Jo);let Sl;const kl={h3:"mt-6 mb-2 text-xl font-bold",ul:"mt-2 list-disc list-inside",button:"mt-2 rounded-full py-1 px-4 bg-white transition border-blue-500 border-2 text-blue-500 text-sm hover:border-blue-700 hover:text-blue-700 focus:bg-blue-700 focus:text-white focus:outline-none"};var Ml=$n({setup(){const e=qe(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:kl}}});const El={class:"modal"},Al=uo("p",null," Hello ",-1);Ml.render=function(e,t,n,o,l,s){const r=qn("Modal");return no(),lo(Xn,null,[uo("h3",{class:e.style.h3}," 1. basic ",2),uo("div",null,[uo("button",{class:e.style.button,onClick:t[1]||(t[1]=(...t)=>e.showModal&&e.showModal(...t))}," Show modal ",2),uo("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/1.basic.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),e.isShow?(no(),lo(r,{key:0,close:e.closeModal},{default:Bt((({emitClose:t})=>[uo("div",El,[Al,uo("button",{class:e.style.button,onClick:t}," close ",10,["onClick"])])])),_:1},8,["close"])):ho("",!0)],64)};var Fl=$n({setup(){const e=qe(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:kl}}});const Ll={class:"modal"},Tl=uo("p",null," change v-show ",-1);Fl.render=function(e,t,n,o,l,s){const r=qn("Modal");return no(),lo(Xn,null,[uo("h3",{class:e.style.h3}," 2. change v-show (always mounted) ",2),uo("div",null,[uo("button",{class:e.style.button,onClick:t[1]||(t[1]=(...t)=>e.showModal&&e.showModal(...t))}," Show modal ",2),uo("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/2.visible.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),uo(r,{close:e.closeModal,disabled:!e.isShow},{default:Bt((({emitClose:t})=>[uo("div",Ll,[Tl,uo("button",{class:e.style.button,onClick:t}," close ",10,["onClick"])])])),_:1},8,["close","disabled"])],64)};var Ol=$n({setup(){const e=Be({modal1:!1,modal2:!1});return{isShowModal:e,options:{transition:!1,closeClickDimmed:!1,closeKeyCode:!1,styleModal:{backgroundColor:"rgba(59, 130, 246, 0.3)"},styleModalContent:{justifyContent:"flex-start"}},showModal:function(t){e[t]=!0},closeModal:function(t){e[t]=!1},style:kl}}});const Nl=uo("li",null,"transition: false",-1),Rl=uo("li",null,"closeClickDimmed: false",-1),$l=uo("li",null,"closeKeyCode: false",-1),Pl=uo("li",null,"styleModal: { backgroundColor: 'rgba(59, 130, 246, 0.3)' }",-1),Vl=uo("li",null,"styleModalContent: { justifyContent: 'flex-start' }",-1),Bl={class:"modal"},jl=uo("p",null," modal1 ",-1),Ul={class:"modal"},Il=uo("p",null," modal2 ",-1);Ol.render=function(e,t,n,o,l,s){const r=qn("Modal");return no(),lo(Xn,null,[uo("h3",{class:e.style.h3}," 3. options ",2),uo("ul",{class:e.style.ul},[Nl,Rl,$l,Pl,Vl],2),uo("div",null,[uo("button",{class:e.style.button,onClick:t[1]||(t[1]=t=>e.showModal("modal1"))}," Show modal ",2),uo("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/3.options.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),e.isShowModal.modal1?(no(),lo(r,{key:0,close:()=>e.closeModal("modal1"),options:e.options},{default:Bt((({emitClose:n})=>[uo("div",Bl,[jl,uo("button",{class:[e.style.button,"mr-2"],onClick:t[2]||(t[2]=t=>e.showModal("modal2"))}," open modal2 ",2),uo("button",{class:e.style.button,onClick:n}," close ",10,["onClick"])])])),_:1},8,["close","options"])):ho("",!0),e.isShowModal.modal2?(no(),lo(r,{key:1,close:()=>e.closeModal("modal2"),options:e.options},{default:Bt((({emitClose:t})=>[uo("div",Ul,[Il,uo("button",{class:e.style.button,onClick:t}," close ",10,["onClick"])])])),_:1},8,["close","options"])):ho("",!0)],64)};var Dl=$n({setup(){const e=Be({modal1:!1,modal2:!1});return{isShowModal:e,showModal:function(t){e[t]=!0},closeModal:function(t){e[t]=!1},style:kl}}});const Kl={class:"modal"},zl=uo("p",null," modal1 ",-1),Hl={class:"modal"},Wl=uo("p",null," modal2 ",-1);Dl.render=function(e,t,n,o,l,s){const r=qn("Modal");return no(),lo(Xn,null,[uo("h3",{class:e.style.h3}," 4. modal in modal ",2),uo("div",null,[uo("button",{class:e.style.button,onClick:t[1]||(t[1]=t=>e.showModal("modal1"))}," Show modal1 ",2),uo("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/4.modal.on.modal.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),e.isShowModal.modal1?(no(),lo(r,{key:0,close:()=>e.closeModal("modal1")},{default:Bt((({emitClose:n})=>[uo("div",Kl,[zl,uo("button",{style:{marginRight:"10px"},onClick:t[2]||(t[2]=t=>e.showModal("modal2"))}," open modal2 "),uo("button",{onClick:n}," close ",8,["onClick"])])])),_:1},8,["close"])):ho("",!0),e.isShowModal.modal2?(no(),lo(r,{key:1,close:()=>e.closeModal("modal2")},{default:Bt((({emitClose:t})=>[uo("div",Hl,[Wl,uo("button",{class:e.style.button,onClick:t}," close ",10,["onClick"])])])),_:1},8,["close"])):ho("",!0)],64)};var ql=$n({setup(){const e=qe(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:kl}}});const Gl=Kt("data-v-23d831b8");It("data-v-23d831b8");const Jl={class:"modal"},Xl=uo("p",null," Hello ",-1);Dt();const Zl=Gl(((e,t,n,o,l,s)=>{const r=qn("Modal");return no(),lo(Xn,null,[uo("h3",{class:e.style.h3}," 5. custom animation ",2),uo("div",null,[uo("button",{class:e.style.button,onClick:t[1]||(t[1]=(...t)=>e.showModal&&e.showModal(...t))}," Show modal ",2),uo("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/5.custom.animation.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),e.isShow?(no(),lo(r,{key:0,close:e.closeModal},{default:Gl((({emitClose:t})=>[uo("div",Jl,[Xl,uo("button",{class:e.style.button,onClick:t}," close ",10,["onClick"])])])),_:1},8,["close"])):ho("",!0)],64)}));ql.render=Zl,ql.__scopeId="data-v-23d831b8";var Ql=$n({setup(){const e=Be({modal1:!1,modal2:!1});return{isShowModal:e,showModal:function(t){e[t]=!0},closeModal:function(t){e[t]=!1},style:kl}}});const Yl={class:"modal"},es=uo("h2",{id:"heading-modal1"}," wai-aria1 ",-1),ts={class:"modal"},ns=uo("h2",{id:"heading-modal2"}," wai-aria2 ",-1);Ql.render=function(e,t,n,o,l,s){const r=qn("Modal");return no(),lo(Xn,null,[uo("h3",{class:e.style.h3}," 6. wai-aria ",2),uo("div",null,[uo("button",{class:e.style.button,onClick:t[1]||(t[1]=t=>e.showModal("modal1"))}," Show modal1 ",2),uo("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/6.wai-aria.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),e.isShowModal.modal1?(no(),lo(r,{key:0,id:"aria-modal1",class:"border-8 border-white-700 focus:border-blue-700","aria-labelledby":"heading-modal1",close:()=>e.closeModal("modal1")},{default:Bt((({emitClose:n})=>[uo("div",Yl,[es,uo("button",{class:[e.style.button,"mr-2"],onClick:t[2]||(t[2]=t=>e.showModal("modal2"))}," open modal2 ",2),uo("button",{class:e.style.button,onClick:n}," close ",10,["onClick"])])])),_:1},8,["close"])):ho("",!0),e.isShowModal.modal2?(no(),lo(r,{key:1,id:"aria-modal2",class:"border-8 border-white-700 focus:border-blue-700","aria-labelledby":"heading-modal2",close:()=>e.closeModal("modal2")},{default:Bt((({emitClose:t})=>[uo("div",ts,[ns,uo("button",{class:e.style.button,onClick:t}," close ",10,["onClick"])])])),_:1},8,["close"])):ho("",!0)],64)};var os=$n({setup(){const e=qe(!1);return{isShow:e,showModal:function(){e.value=!0},closeModal:function(){e.value=!1},style:kl,beforeEnter:function(){console.log("before enter")},afterEnter:function(){console.log("after enter")},beforeLeave:function(){console.log("before leave")},afterLeave:function(){console.log("after leave")}}}});const ls={class:"modal"},ss=uo("p",null," Hello ",-1);os.render=function(e,t,n,o,l,s){const r=qn("Modal");return no(),lo(Xn,null,[uo("h3",{class:e.style.h3}," 7. event ",2),uo("div",null,[uo("button",{class:e.style.button,onClick:t[1]||(t[1]=(...t)=>e.showModal&&e.showModal(...t))}," Show modal ",2),uo("a",{href:"https://github.com/hoiheart/vue-universal-modal/blob/master/example/7.event.vue",target:"_blank",class:[e.style.button,"ml-2"]}," Source ",2)]),e.isShow?(no(),lo(r,{key:0,close:e.closeModal,onBeforeEnter:e.beforeEnter,onAfterEnter:e.afterEnter,onBeforeLeave:e.beforeLeave,onAfterLeave:e.afterLeave},{default:Bt((({emitClose:t})=>[uo("div",ls,[ss,uo("button",{class:e.style.button,onClick:t}," close ",10,["onClick"])])])),_:1},8,["close","onBeforeEnter","onAfterEnter","onBeforeLeave","onAfterLeave"])):ho("",!0)],64)};var rs=$n({components:{Example1:Ml,Example2:Fl,Example3:Ol,Example4:Dl,Example5:ql,Example6:Ql,Example7:os}});const is=uo("h2",{class:"text-2xl font-bold mt-8 mb-4"}," Examples ",-1);rs.render=function(e,t,n,o,l,s){const r=qn("Example1"),i=qn("Example2"),a=qn("Example3"),c=qn("Example4"),u=qn("Example5"),d=qn("Example6"),f=qn("Example7");return no(),lo(Xn,null,[is,uo(r),uo(i),uo(a),uo(c),uo(u),uo(d),uo(f)],64)};var as=$n({props:{close:{type:Function,required:!0,default:()=>{}},options:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},id:{type:String,default:""},class:{type:String,default:""},ariaLabelledby:{type:String,default:""}},emits:["before-enter","after-enter","before-leave","after-leave"],setup(e,t){const{teleportTarget:n,visibleModals:o,addVisibleModals:l,removeVisibleModals:s}=yo(cs),{uid:r}=$o()||{},i=qe(),a=qe(),c=Ko((()=>!(!r||!o.value.length)&&r===o.value[o.value.length-1]));un((()=>e.disabled),(()=>{a.value=!e.disabled}),{immediate:!0}),un((()=>a.value),(e=>{r&&(e&&o.value.indexOf(r)<0&&l(r),!e&&o.value.indexOf(r)>-1&&s(r))}),{immediate:!0});const u={transition:300,closeClickDimmed:!0,closeKeyCode:27,styleModal:{},styleModalContent:{},...e.options},d=!!u.transition&&u.transition/1e3+"s";function f(){a.value=!1}function p(e){e.keyCode===u.closeKeyCode&&c.value&&f()}let h;function m(e){const t=e.target.closest(`.${us}`);if(c.value&&(!t||t!==i.value)){if(t&&!t.classList.contains(`${us}-show`))return;h=e.target}}return tn((()=>{u.closeKeyCode&&document.addEventListener("keyup",p),document.addEventListener("click",m),un((()=>a.value),(e=>{!function(e){e?i.value&&i.value.focus():h&&h.focus()}(e)}),{immediate:a.value})})),sn((()=>{u.closeKeyCode&&document.removeEventListener("keyup",p),document.removeEventListener("click",m)})),{CLASS_NAME:us,teleportTarget:n,modalRef:i,show:a,latest:c,emitClose:f,emitAfterLeave:function(){t.emit("after-leave"),e.close()},onClickDimmed:function(){u.closeClickDimmed&&f()},mergeOptions:u,transition:d,className:e.class}}});as.render=function(e,t,n,o,l,s){return no(),lo(Wn,{to:e.teleportTarget,disabled:e.disabled},[uo(cl,{name:e.CLASS_NAME,appear:"",onBeforeEnter:t[2]||(t[2]=t=>e.$emit("before-enter")),onAfterEnter:t[3]||(t[3]=t=>e.$emit("after-enter")),onBeforeLeave:t[4]||(t[4]=t=>e.$emit("before-leave")),onAfterLeave:e.emitAfterLeave},{default:Bt((()=>{return[Ln(uo("div",{id:e.id,ref:"modalRef",class:[e.CLASS_NAME,e.className,{[`${e.CLASS_NAME}-show`]:e.show},{[`${e.CLASS_NAME}-latest`]:e.latest}],style:{transitionDuration:e.transition,...e.mergeOptions.styleModal},role:"dialog","aria-modal":"true","aria-label":!e.ariaLabelledby&&"Modal window","aria-labelledby":e.ariaLabelledby,tabindex:"-1"},[uo("div",{class:`${e.CLASS_NAME}-content`,style:{transitionDuration:e.transition,...e.mergeOptions.styleModalContent},onClick:t[1]||(t[1]=(n=(...t)=>e.onClickDimmed&&e.onClickDimmed(...t),o=["self"],(e,...t)=>{for(let t=0;t{const{teleportTarget:n="",teleportComponent:o="",teleportComponentId:l="",modalComponent:s="Modal"}=t;if(!n)return console.error("teleportTarget is required.");if(o||l)return console.error("teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)");const r=qe([]);e.provide(cs,{teleportTarget:n,visibleModals:je(r),addVisibleModals:e=>{r.value=[...r.value,e]},removeVisibleModals:e=>{const t=[...r.value];t.splice(r.value.indexOf(e),1),r.value=[...t]}}),e.component(s,as)}};const fs=((...e)=>{const t=(Sl||(Sl=jn(wl))).createApp(...e),{mount:n}=t;return t.mount=e=>{const o=function(e){if(x(e)){return document.querySelector(e)}return e}(e);if(!o)return;const l=t._component;C(l)||l.render||l.template||(l.template=o.innerHTML),o.innerHTML="";const s=n(o);return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t})(rs);fs.use(ds,{teleportTarget:"#modals"}),fs.mount("#app"); diff --git a/demo/index.html b/demo/index.html index e1226dd..01410da 100644 --- a/demo/index.html +++ b/demo/index.html @@ -11,8 +11,9 @@ - - + + +
diff --git a/demo/vendor.979a7963.js b/demo/vendor.979a7963.js new file mode 100644 index 0000000..f6c5d6a --- /dev/null +++ b/demo/vendor.979a7963.js @@ -0,0 +1 @@ +function e(e,t){const n=Object.create(null),o=e.split(",");for(let r=0;r!!n[e.toLowerCase()]:e=>!!n[e]}const t=e("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt"),n=e("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function o(e){if(_(e)){const t={};for(let n=0;n{if(e){const n=e.split(s);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function i(e){let t="";if(C(e))t=e;else if(_(e))for(let n=0;n{},f=()=>!1,p=/^on[^a-z]/,d=e=>p.test(e),h=e=>e.startsWith("onUpdate:"),v=Object.assign,g=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},m=Object.prototype.hasOwnProperty,y=(e,t)=>m.call(e,t),_=Array.isArray,b=e=>"[object Map]"===F(e),x=e=>"function"==typeof e,C=e=>"string"==typeof e,S=e=>"symbol"==typeof e,w=e=>null!==e&&"object"==typeof e,E=e=>w(e)&&x(e.then)&&x(e.catch),A=Object.prototype.toString,F=e=>A.call(e),k=e=>C(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,T=e(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),O=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},R=/-(\w)/g,L=O((e=>e.replace(R,((e,t)=>t?t.toUpperCase():"")))),M=/\B([A-Z])/g,N=O((e=>e.replace(M,"-$1").toLowerCase())),P=O((e=>e.charAt(0).toUpperCase()+e.slice(1))),I=O((e=>e?`on${P(e)}`:"")),$=(e,t)=>e!==t&&(e==e||t==t),j=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},B=e=>{const t=parseFloat(e);return isNaN(t)?e:t},U=new WeakMap,D=[];let z;const W=Symbol(""),K=Symbol("");function H(e,t=c){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const n=function(e,t){const n=function(){if(!n.active)return t.scheduler?void 0:e();if(!D.includes(n)){J(n);try{return Z.push(X),X=!0,D.push(n),z=n,e()}finally{D.pop(),Y(),z=D[D.length-1]}}};return n.id=G++,n.allowRecurse=!!t.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||n(),n}function q(e){e.active&&(J(e),e.options.onStop&&e.options.onStop(),e.active=!1)}let G=0;function J(e){const{deps:t}=e;if(t.length){for(let n=0;n{e&&e.forEach((e=>{(e!==z||e.allowRecurse)&&i.add(e)}))};if("clear"===t)l.forEach(c);else if("length"===n&&_(e))l.forEach(((e,t)=>{("length"===t||t>=o)&&c(e)}));else switch(void 0!==n&&c(l.get(n)),t){case"add":_(e)?k(n)&&c(l.get("length")):(c(l.get(W)),b(e)&&c(l.get(K)));break;case"delete":_(e)||(c(l.get(W)),b(e)&&c(l.get(K)));break;case"set":b(e)&&c(l.get(W))}i.forEach((e=>{e.options.scheduler?e.options.scheduler(e):e()}))}const ne=e("__proto__,__v_isRef,__isVue"),oe=new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(S)),re=ae(),se=ae(!1,!0),le=ae(!0),ie=ae(!0,!0),ce={};function ae(e=!1,t=!1){return function(n,o,r){if("__v_isReactive"===o)return!e;if("__v_isReadonly"===o)return e;if("__v_raw"===o&&r===(e?t?Ve:je:t?$e:Ie).get(n))return n;const s=_(n);if(!e&&s&&y(ce,o))return Reflect.get(ce,o,r);const l=Reflect.get(n,o,r);if(S(o)?oe.has(o):ne(o))return l;if(e||ee(n,0,o),t)return l;if(Je(l)){return!s||!k(o)?l.value:l}return w(l)?e?De(l):Ue(l):l}}["includes","indexOf","lastIndexOf"].forEach((e=>{const t=Array.prototype[e];ce[e]=function(...e){const n=qe(this);for(let t=0,r=this.length;t{const t=Array.prototype[e];ce[e]=function(...e){Q();const n=t.apply(this,e);return Y(),n}}));function ue(e=!1){return function(t,n,o,r){let s=t[n];if(!e&&(o=qe(o),s=qe(s),!_(t)&&Je(s)&&!Je(o)))return s.value=o,!0;const l=_(t)&&k(n)?Number(n)!0,deleteProperty:(e,t)=>!0},de=v({},fe,{get:se,set:ue(!0)});v({},pe,{get:ie});const he=e=>w(e)?Ue(e):e,ve=e=>w(e)?De(e):e,ge=e=>e,me=e=>Reflect.getPrototypeOf(e);function ye(e,t,n=!1,o=!1){const r=qe(e=e.__v_raw),s=qe(t);t!==s&&!n&&ee(r,0,t),!n&&ee(r,0,s);const{has:l}=me(r),i=o?ge:n?ve:he;return l.call(r,t)?i(e.get(t)):l.call(r,s)?i(e.get(s)):void 0}function _e(e,t=!1){const n=this.__v_raw,o=qe(n),r=qe(e);return e!==r&&!t&&ee(o,0,e),!t&&ee(o,0,r),e===r?n.has(e):n.has(e)||n.has(r)}function be(e,t=!1){return e=e.__v_raw,!t&&ee(qe(e),0,W),Reflect.get(e,"size",e)}function xe(e){e=qe(e);const t=qe(this);return me(t).has.call(t,e)||(t.add(e),te(t,"add",e,e)),this}function Ce(e,t){t=qe(t);const n=qe(this),{has:o,get:r}=me(n);let s=o.call(n,e);s||(e=qe(e),s=o.call(n,e));const l=r.call(n,e);return n.set(e,t),s?$(t,l)&&te(n,"set",e,t):te(n,"add",e,t),this}function Se(e){const t=qe(this),{has:n,get:o}=me(t);let r=n.call(t,e);r||(e=qe(e),r=n.call(t,e)),o&&o.call(t,e);const s=t.delete(e);return r&&te(t,"delete",e,void 0),s}function we(){const e=qe(this),t=0!==e.size,n=e.clear();return t&&te(e,"clear",void 0,void 0),n}function Ee(e,t){return function(n,o){const r=this,s=r.__v_raw,l=qe(s),i=t?ge:e?ve:he;return!e&&ee(l,0,W),s.forEach(((e,t)=>n.call(o,i(e),i(t),r)))}}function Ae(e,t,n){return function(...o){const r=this.__v_raw,s=qe(r),l=b(s),i="entries"===e||e===Symbol.iterator&&l,c="keys"===e&&l,a=r[e](...o),u=n?ge:t?ve:he;return!t&&ee(s,0,c?K:W),{next(){const{value:e,done:t}=a.next();return t?{value:e,done:t}:{value:i?[u(e[0]),u(e[1])]:u(e),done:t}},[Symbol.iterator](){return this}}}}function Fe(e){return function(...t){return"delete"!==e&&this}}const ke={get(e){return ye(this,e)},get size(){return be(this)},has:_e,add:xe,set:Ce,delete:Se,clear:we,forEach:Ee(!1,!1)},Te={get(e){return ye(this,e,!1,!0)},get size(){return be(this)},has:_e,add:xe,set:Ce,delete:Se,clear:we,forEach:Ee(!1,!0)},Oe={get(e){return ye(this,e,!0)},get size(){return be(this,!0)},has(e){return _e.call(this,e,!0)},add:Fe("add"),set:Fe("set"),delete:Fe("delete"),clear:Fe("clear"),forEach:Ee(!0,!1)},Re={get(e){return ye(this,e,!0,!0)},get size(){return be(this,!0)},has(e){return _e.call(this,e,!0)},add:Fe("add"),set:Fe("set"),delete:Fe("delete"),clear:Fe("clear"),forEach:Ee(!0,!0)};function Le(e,t){const n=t?e?Re:Te:e?Oe:ke;return(t,o,r)=>"__v_isReactive"===o?!e:"__v_isReadonly"===o?e:"__v_raw"===o?t:Reflect.get(y(n,o)&&o in t?n:t,o,r)}["keys","values","entries",Symbol.iterator].forEach((e=>{ke[e]=Ae(e,!1,!1),Oe[e]=Ae(e,!0,!1),Te[e]=Ae(e,!1,!0),Re[e]=Ae(e,!0,!0)}));const Me={get:Le(!1,!1)},Ne={get:Le(!1,!0)},Pe={get:Le(!0,!1)},Ie=new WeakMap,$e=new WeakMap,je=new WeakMap,Ve=new WeakMap;function Be(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>F(e).slice(8,-1))(e))}function Ue(e){return e&&e.__v_isReadonly?e:ze(e,!1,fe,Me,Ie)}function De(e){return ze(e,!0,pe,Pe,je)}function ze(e,t,n,o,r){if(!w(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const s=r.get(e);if(s)return s;const l=Be(e);if(0===l)return e;const i=new Proxy(e,2===l?o:n);return r.set(e,i),i}function We(e){return Ke(e)?We(e.__v_raw):!(!e||!e.__v_isReactive)}function Ke(e){return!(!e||!e.__v_isReadonly)}function He(e){return We(e)||Ke(e)}function qe(e){return e&&qe(e.__v_raw)||e}const Ge=e=>w(e)?Ue(e):e;function Je(e){return Boolean(e&&!0===e.__v_isRef)}function Xe(e){return function(e,t=!1){if(Je(e))return e;return new Ze(e,t)}(e)}class Ze{constructor(e,t=!1){this._rawValue=e,this._shallow=t,this.__v_isRef=!0,this._value=t?e:Ge(e)}get value(){return ee(qe(this),0,"value"),this._value}set value(e){$(qe(e),this._rawValue)&&(this._rawValue=e,this._value=this._shallow?e:Ge(e),te(qe(this),"set","value",e))}}const Qe={get:(e,t,n)=>{return Je(o=Reflect.get(e,t,n))?o.value:o;var o},set:(e,t,n,o)=>{const r=e[t];return Je(r)&&!Je(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function Ye(e){return We(e)?e:new Proxy(e,Qe)}function et(e){const t=_(e)?new Array(e.length):{};for(const n in e)t[n]=nt(e,n);return t}class tt{constructor(e,t){this._object=e,this._key=t,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(e){this._object[this._key]=e}}function nt(e,t){return Je(e[t])?e[t]:new tt(e,t)}class ot{constructor(e,t,n){this._setter=t,this._dirty=!0,this.__v_isRef=!0,this.effect=H(e,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,te(qe(this),"set","value"))}}),this.__v_isReadonly=n}get value(){const e=qe(this);return e._dirty&&(e._value=this.effect(),e._dirty=!1),ee(e,0,"value"),e._value}set value(e){this._setter(e)}}function rt(e,t,n,o){let r;try{r=o?e(...o):e()}catch(s){lt(s,t,n)}return r}function st(e,t,n,o){if(x(e)){const r=rt(e,t,n,o);return r&&E(r)&&r.catch((e=>{lt(e,t,n)})),r}const r=[];for(let s=0;s>>1;At(at[e])-1?at.splice(t,0,e):at.push(e),Ct()}}function Ct(){it||ct||(ct=!0,yt=mt.then(Ft))}function St(e,t,n,o){_(e)?n.push(...e):t&&t.includes(e,e.allowRecurse?o+1:o)||n.push(e),Ct()}function wt(e,t=null){if(ft.length){for(_t=t,pt=[...new Set(ft)],ft.length=0,dt=0;dtAt(e)-At(t))),gt=0;gtnull==e.id?1/0:e.id;function Ft(e){ct=!1,it=!0,wt(e),at.sort(((e,t)=>At(e)-At(t)));try{for(ut=0;ute.trim())):t&&(r=n.map(B))}let i,a=o[i=I(t)]||o[i=I(L(t))];!a&&s&&(a=o[i=I(N(t))]),a&&st(a,e,6,r);const u=o[i+"Once"];if(u){if(e.emitted){if(e.emitted[i])return}else(e.emitted={})[i]=!0;st(u,e,6,r)}}function Tt(e,t,n=!1){if(!t.deopt&&void 0!==e.__emits)return e.__emits;const o=e.emits;let r={},s=!1;if(!x(e)){const o=e=>{const n=Tt(e,t,!0);n&&(s=!0,v(r,n))};!n&&t.mixins.length&&t.mixins.forEach(o),e.extends&&o(e.extends),e.mixins&&e.mixins.forEach(o)}return o||s?(_(o)?o.forEach((e=>r[e]=null)):v(r,o),e.__emits=r):e.__emits=null}function Ot(e,t){return!(!e||!d(t))&&(t=t.slice(2).replace(/Once$/,""),y(e,t[0].toLowerCase()+t.slice(1))||y(e,N(t))||y(e,t))}let Rt=0;const Lt=e=>Rt+=e;function Mt(e,t,n={},o,r){let s=e[t];Rt++,lo();const l=s&&Nt(s(n)),i=co(eo,{key:n.key||`_${t}`},l||(o?o():[]),l&&1===e._?64:-2);return!r&&i.scopeId&&(i.slotScopeIds=[i.scopeId+"-s"]),Rt--,i}function Nt(e){return e.some((e=>!ao(e)||e.type!==no&&!(e.type===eo&&!Nt(e.children))))?e:null}let Pt=null,It=null;function $t(e){const t=Pt;return Pt=e,It=e&&e.type.__scopeId||null,t}function jt(e){It=e}function Vt(){It=null}const Bt=e=>Ut;function Ut(e,t=Pt){if(!t)return e;const n=(...n)=>{Rt||lo(!0);const o=$t(t),r=e(...n);return $t(o),Rt||io(),r};return n._c=!0,n}function Dt(e){const{type:t,vnode:n,proxy:o,withProxy:r,props:s,propsOptions:[l],slots:i,attrs:c,emit:a,render:u,renderCache:f,data:p,setupState:d,ctx:v}=e;let g;const m=$t(e);try{let e;if(4&n.shapeFlag){const t=r||o;g=_o(u.call(t,t,f,s,d,p,v)),e=c}else{const n=t;0,g=_o(n.length>1?n(s,{attrs:c,slots:i,emit:a}):n(s,null)),e=t.props?c:Wt(c)}let m=g;if(!1!==t.inheritAttrs&&e){const t=Object.keys(e),{shapeFlag:n}=m;t.length&&(1&n||6&n)&&(l&&t.some(h)&&(e=Kt(e,l)),m=go(m,e))}n.dirs&&(m.dirs=m.dirs?m.dirs.concat(n.dirs):n.dirs),n.transition&&(m.transition=n.transition),g=m}catch(y){ro.length=0,lt(y,e,1),g=vo(no)}return $t(m),g}function zt(e){let t;for(let n=0;n{let t;for(const n in e)("class"===n||"style"===n||d(n))&&((t||(t={}))[n]=e[n]);return t},Kt=(e,t)=>{const n={};for(const o in e)h(o)&&o.slice(9)in t||(n[o]=e[o]);return n};function Ht(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r{l=!0;const[n,o]=Zt(e,t,!0);v(r,n),o&&s.push(...o)};!n&&t.mixins.length&&t.mixins.forEach(o),e.extends&&o(e.extends),e.mixins&&e.mixins.forEach(o)}if(!o&&!l)return e.__props=a;if(_(o))for(let i=0;i-1,n[1]=o<0||t-1||y(n,"default"))&&s.push(e)}}}return e.__props=[r,s]}function Qt(e){return"$"!==e[0]}function Yt(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function en(e,t){return Yt(e)===Yt(t)}function tn(e,t){return _(t)?t.findIndex((t=>en(t,e))):x(t)&&en(t,e)?0:-1}function nn(e,t,n=jo,o=!1){if(n){const r=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...o)=>{if(n.isUnmounted)return;Q(),Bo(n);const r=st(t,n,e,o);return Bo(null),Y(),r});return o?r.unshift(s):r.push(s),s}}const on=e=>(t,n=jo)=>!Do&&nn(e,t,n),rn=on("bm"),sn=on("m"),ln=on("bu"),cn=on("u"),an=on("bum"),un=on("um"),fn=on("rtg"),pn=on("rtc"),dn={};function hn(e,t,n){return vn(e,t,n)}function vn(e,t,{immediate:n,deep:o,flush:r,onTrack:s,onTrigger:l}=c,i=jo){let a,f,p=!1;if(Je(e)?(a=()=>e.value,p=!!e._shallow):We(e)?(a=()=>e,o=!0):a=_(e)?()=>e.map((e=>Je(e)?e.value:We(e)?mn(e):x(e)?rt(e,i,2,[i&&i.proxy]):void 0)):x(e)?t?()=>rt(e,i,2,[i&&i.proxy]):()=>{if(!i||!i.isUnmounted)return f&&f(),st(e,i,3,[d])}:u,t&&o){const e=a;a=()=>mn(e())}let d=e=>{f=y.options.onStop=()=>{rt(e,i,4)}},h=_(e)?[]:dn;const v=()=>{if(y.active)if(t){const e=y();(o||p||$(e,h))&&(f&&f(),st(t,i,3,[e,h===dn?void 0:h,d]),h=e)}else y()};let m;v.allowRecurse=!!t,m="sync"===r?v:"post"===r?()=>Un(v,i&&i.suspense):()=>{!i||i.isMounted?function(e){St(e,pt,ft,dt)}(v):v()};const y=H(a,{lazy:!0,onTrack:s,onTrigger:l,scheduler:m});return Ko(y,i),t?n?v():h=y():"post"===r?Un(y,i&&i.suspense):y(),()=>{q(y),i&&g(i.effects,y)}}function gn(e,t,n){const o=this.proxy;return vn(C(e)?()=>o[e]:e.bind(o),t.bind(o),n,this)}function mn(e,t=new Set){if(!w(e)||t.has(e))return e;if(t.add(e),Je(e))mn(e.value,t);else if(_(e))for(let n=0;n{mn(e,t)}));else for(const n in e)mn(e[n],t);return e}const yn=[Function,Array],_n={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:yn,onEnter:yn,onAfterEnter:yn,onEnterCancelled:yn,onBeforeLeave:yn,onLeave:yn,onAfterLeave:yn,onLeaveCancelled:yn,onBeforeAppear:yn,onAppear:yn,onAfterAppear:yn,onAppearCancelled:yn},setup(e,{slots:t}){const n=Vo(),o=function(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return sn((()=>{e.isMounted=!0})),an((()=>{e.isUnmounting=!0})),e}();let r;return()=>{const s=t.default&&En(t.default(),!0);if(!s||!s.length)return;const l=qe(e),{mode:i}=l,c=s[0];if(o.isLeaving)return Cn(c);const a=Sn(c);if(!a)return Cn(c);const u=xn(a,l,o,n);wn(a,u);const f=n.subTree,p=f&&Sn(f);let d=!1;const{getTransitionKey:h}=a.type;if(h){const e=h();void 0===r?r=e:e!==r&&(r=e,d=!0)}if(p&&p.type!==no&&(!uo(a,p)||d)){const e=xn(p,l,o,n);if(wn(p,e),"out-in"===i)return o.isLeaving=!0,e.afterLeave=()=>{o.isLeaving=!1,n.update()},Cn(c);"in-out"===i&&a.type!==no&&(e.delayLeave=(e,t,n)=>{bn(o,p)[String(p.key)]=p,e._leaveCb=()=>{t(),e._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=n})}return c}}};function bn(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function xn(e,t,n,o){const{appear:r,mode:s,persisted:l=!1,onBeforeEnter:i,onEnter:c,onAfterEnter:a,onEnterCancelled:u,onBeforeLeave:f,onLeave:p,onAfterLeave:d,onLeaveCancelled:h,onBeforeAppear:v,onAppear:g,onAfterAppear:m,onAppearCancelled:y}=t,_=String(e.key),b=bn(n,e),x=(e,t)=>{e&&st(e,o,9,t)},C={mode:s,persisted:l,beforeEnter(t){let o=i;if(!n.isMounted){if(!r)return;o=v||i}t._leaveCb&&t._leaveCb(!0);const s=b[_];s&&uo(e,s)&&s.el._leaveCb&&s.el._leaveCb(),x(o,[t])},enter(e){let t=c,o=a,s=u;if(!n.isMounted){if(!r)return;t=g||c,o=m||a,s=y||u}let l=!1;const i=e._enterCb=t=>{l||(l=!0,x(t?s:o,[e]),C.delayedLeave&&C.delayedLeave(),e._enterCb=void 0)};t?(t(e,i),t.length<=1&&i()):i()},leave(t,o){const r=String(e.key);if(t._enterCb&&t._enterCb(!0),n.isUnmounting)return o();x(f,[t]);let s=!1;const l=t._leaveCb=n=>{s||(s=!0,o(),x(n?h:d,[t]),t._leaveCb=void 0,b[r]===e&&delete b[r])};b[r]=e,p?(p(t,l),p.length<=1&&l()):l()},clone:e=>xn(e,t,n,o)};return C}function Cn(e){if(An(e))return(e=go(e)).children=null,e}function Sn(e){return An(e)?e.children?e.children[0]:void 0:e}function wn(e,t){6&e.shapeFlag&&e.component?wn(e.component.subTree,t):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function En(e,t=!1){let n=[],o=0;for(let r=0;r1)for(let r=0;re.type.__isKeepAlive;function Fn(e,t,n=jo){const o=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}e()});if(nn(t,o,n),n){let e=n.parent;for(;e&&e.parent;)An(e.parent.vnode)&&kn(o,t,n,e),e=e.parent}}function kn(e,t,n,o){const r=nn(t,e,o,!0);un((()=>{g(o[t],r)}),n)}const Tn=e=>"_"===e[0]||"$stable"===e,On=e=>_(e)?e.map(_o):[_o(e)],Rn=(e,t,n)=>Ut((e=>On(t(e))),n),Ln=(e,t)=>{const n=e._ctx;for(const o in e){if(Tn(o))continue;const r=e[o];if(x(r))t[o]=Rn(0,r,n);else if(null!=r){const e=On(r);t[o]=()=>e}}},Mn=(e,t)=>{const n=On(t);e.slots.default=()=>n};function Nn(e,t){if(null===Pt)return e;const n=Pt.proxy,o=e.dirs||(e.dirs=[]);for(let r=0;r(s.has(e)||(e&&x(e.install)?(s.add(e),e.install(i,...t)):x(e)&&(s.add(e),e(i,...t))),i),mixin:e=>(r.mixins.includes(e)||(r.mixins.push(e),(e.props||e.emits)&&(r.deopt=!0)),i),component:(e,t)=>t?(r.components[e]=t,i):r.components[e],directive:(e,t)=>t?(r.directives[e]=t,i):r.directives[e],mount(s,c,a){if(!l){const u=vo(n,o);return u.appContext=r,c&&t?t(u,s):e(u,s,a),l=!0,i._container=s,s.__vue_app__=i,u.component.proxy}},unmount(){l&&(e(null,i._container),delete i._container.__vue_app__)},provide:(e,t)=>(r.provides[e]=t,i)};return i}}function Vn(e){return x(e)?{setup:e,name:e.name}:e}const Bn={scheduler:xt,allowRecurse:!0},Un=function(e,t){t&&t.pendingBranch?_(e)?t.effects.push(...e):t.effects.push(e):St(e,vt,ht,gt)},Dn=(e,t,n,o)=>{if(_(e))return void e.forEach(((e,r)=>Dn(e,t&&(_(t)?t[r]:t),n,o)));let r;if(o){if(o.type.__asyncLoader)return;r=4&o.shapeFlag?o.component.exposed||o.component.proxy:o.el}else r=null;const{i:s,r:l}=e,i=t&&t.r,a=s.refs===c?s.refs={}:s.refs,u=s.setupState;if(null!=i&&i!==l&&(C(i)?(a[i]=null,y(u,i)&&(u[i]=null)):Je(i)&&(i.value=null)),C(l)){const e=()=>{a[l]=r,y(u,l)&&(u[l]=r)};r?(e.id=-1,Un(e,n)):e()}else if(Je(l)){const e=()=>{l.value=r};r?(e.id=-1,Un(e,n)):e()}else x(l)&&rt(l,s,12,[r,a])};function zn(e){return function(e,t){const{insert:n,remove:o,patchProp:r,forcePatchProp:s,createElement:l,createText:i,createComment:f,setText:p,setElementText:d,parentNode:h,nextSibling:g,setScopeId:m=u,cloneNode:_,insertStaticContent:b}=e,x=(e,t,n,o=null,r=null,s=null,l=!1,i=null,c=!1)=>{e&&!uo(e,t)&&(o=le(e),ee(e,r,s,!0),e=null),-2===t.patchFlag&&(c=!1,t.dynamicChildren=null);const{type:a,ref:u,shapeFlag:f}=t;switch(a){case to:C(e,t,n,o);break;case no:S(e,t,n,o);break;case oo:null==e&&w(t,n,o,l);break;case eo:B(e,t,n,o,r,s,l,i,c);break;default:1&f?k(e,t,n,o,r,s,l,i,c):6&f?U(e,t,n,o,r,s,l,i,c):(64&f||128&f)&&a.process(e,t,n,o,r,s,l,i,c,ce)}null!=u&&r&&Dn(u,e&&e.ref,s,t)},C=(e,t,o,r)=>{if(null==e)n(t.el=i(t.children),o,r);else{const n=t.el=e.el;t.children!==e.children&&p(n,t.children)}},S=(e,t,o,r)=>{null==e?n(t.el=f(t.children||""),o,r):t.el=e.el},w=(e,t,n,o)=>{[e.el,e.anchor]=b(e.children,t,n,o)},A=({el:e,anchor:t},o,r)=>{let s;for(;e&&e!==t;)s=g(e),n(e,o,r),e=s;n(t,o,r)},F=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=g(e),o(e),e=n;o(t)},k=(e,t,n,o,r,s,l,i,c)=>{l=l||"svg"===t.type,null==e?O(t,n,o,r,s,l,i,c):P(e,t,r,s,l,i,c)},O=(e,t,o,s,i,c,a,u)=>{let f,p;const{type:h,props:v,shapeFlag:g,transition:m,patchFlag:y,dirs:b}=e;if(e.el&&void 0!==_&&-1===y)f=e.el=_(e.el);else{if(f=e.el=l(e.type,c,v&&v.is,v),8&g?d(f,e.children):16&g&&M(e.children,f,null,s,i,c&&"foreignObject"!==h,a,u||!!e.dynamicChildren),b&&Pn(e,null,s,"created"),v){for(const t in v)T(t)||r(f,t,null,v[t],c,e.children,s,i,se);(p=v.onVnodeBeforeMount)&&Wn(p,s,e)}R(f,e,e.scopeId,a,s)}b&&Pn(e,null,s,"beforeMount");const x=(!i||i&&!i.pendingBranch)&&m&&!m.persisted;x&&m.beforeEnter(f),n(f,t,o),((p=v&&v.onVnodeMounted)||x||b)&&Un((()=>{p&&Wn(p,s,e),x&&m.enter(f),b&&Pn(e,null,s,"mounted")}),i)},R=(e,t,n,o,r)=>{if(n&&m(e,n),o)for(let s=0;s{for(let a=c;a{const u=t.el=e.el;let{patchFlag:f,dynamicChildren:p,dirs:h}=t;f|=16&e.patchFlag;const v=e.props||c,g=t.props||c;let m;if((m=g.onVnodeBeforeUpdate)&&Wn(m,n,t,e),h&&Pn(t,e,n,"beforeUpdate"),f>0){if(16&f)$(u,t,v,g,n,o,l);else if(2&f&&v.class!==g.class&&r(u,"class",null,g.class,l),4&f&&r(u,"style",v.style,g.style,l),8&f){const i=t.dynamicProps;for(let t=0;t{m&&Wn(m,n,t,e),h&&Pn(t,e,n,"updated")}),o)},I=(e,t,n,o,r,s,l)=>{for(let i=0;i{if(n!==o){for(const c in o){if(T(c))continue;const u=o[c],f=n[c];(u!==f||s&&s(e,c))&&r(e,c,f,u,a,t.children,l,i,se)}if(n!==c)for(const s in n)T(s)||s in o||r(e,s,n[s],null,a,t.children,l,i,se)}},B=(e,t,o,r,s,l,c,a,u)=>{const f=t.el=e?e.el:i(""),p=t.anchor=e?e.anchor:i("");let{patchFlag:d,dynamicChildren:h,slotScopeIds:v}=t;d>0&&(u=!0),v&&(a=a?a.concat(v):v),null==e?(n(f,o,r),n(p,o,r),M(t.children,o,p,s,l,c,a,u)):d>0&&64&d&&h&&e.dynamicChildren?(I(e.dynamicChildren,h,o,s,l,c,a),(null!=t.key||s&&t===s.subTree)&&Kn(e,t,!0)):G(e,t,o,p,s,l,c,a,u)},U=(e,t,n,o,r,s,l,i,c)=>{t.slotScopeIds=i,null==e?512&t.shapeFlag?r.ctx.activate(t,n,o,l,c):D(t,n,o,r,s,l,c):z(e,t,c)},D=(e,t,n,o,r,s,l)=>{const i=e.component=function(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||Io,s={uid:$o++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,update:null,render:null,proxy:null,exposed:null,withProxy:null,effects:null,provides:t?t.provides:Object.create(r.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Zt(o,r),emitsOptions:Tt(o,r),emit:null,emitted:null,propsDefaults:c,ctx:c,data:c,props:c,attrs:c,slots:c,refs:c,setupState:c,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null};return s.ctx={_:s},s.root=t?t.root:s,s.emit=kt.bind(null,s),s}(e,o,r);if(An(e)&&(i.ctx.renderer=ce),function(e,t=!1){Do=t;const{props:n,children:o}=e.vnode,r=Uo(e);Gt(e,n,r,t),((e,t)=>{if(32&e.vnode.shapeFlag){const n=t._;n?(e.slots=t,V(t,"_",n)):Ln(t,e.slots={})}else e.slots={},t&&Mn(e,t);V(e.slots,fo,1)})(e,o);const s=r?function(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,No);const{setup:o}=n;if(o){const n=e.setupContext=o.length>1?function(e){const t=t=>{e.exposed=Ye(t)};return{attrs:e.attrs,slots:e.slots,emit:e.emit,expose:t}}(e):null;jo=e,Q();const r=rt(o,e,0,[e.props,n]);if(Y(),jo=null,E(r)){if(t)return r.then((t=>{zo(e,t)})).catch((t=>{lt(t,e,0)}));e.asyncDep=r}else zo(e,r)}else Wo(e)}(e,t):void 0;Do=!1}(i),i.asyncDep){if(r&&r.registerDep(i,W),!e.el){const e=i.subTree=vo(no);S(null,e,t,n)}}else W(i,e,t,n,r,s,l)},z=(e,t,n)=>{const o=t.component=e.component;if(function(e,t,n){const{props:o,children:r,component:s}=e,{props:l,children:i,patchFlag:c}=t,a=s.emitsOptions;if(t.dirs||t.transition)return!0;if(!(n&&c>=0))return!(!r&&!i||i&&i.$stable)||o!==l&&(o?!l||Ht(o,l,a):!!l);if(1024&c)return!0;if(16&c)return o?Ht(o,l,a):!!l;if(8&c){const e=t.dynamicProps;for(let t=0;tut&&at.splice(t,1)}(o.update),o.update()}else t.component=e.component,t.el=e.el,o.vnode=t},W=(e,t,n,o,r,s,l)=>{e.update=H((function(){if(e.isMounted){let t,{next:n,bu:o,u:i,parent:c,vnode:a}=e,u=n;n?(n.el=a.el,K(e,n,l)):n=a,o&&j(o),(t=n.props&&n.props.onVnodeBeforeUpdate)&&Wn(t,c,n,a);const f=Dt(e),p=e.subTree;e.subTree=f,x(p,f,h(p.el),le(p),e,r,s),n.el=f.el,null===u&&function({vnode:e,parent:t},n){for(;t&&t.subTree===e;)(e=t.vnode).el=n,t=t.parent}(e,f.el),i&&Un(i,r),(t=n.props&&n.props.onVnodeUpdated)&&Un((()=>{Wn(t,c,n,a)}),r)}else{let l;const{el:i,props:c}=t,{bm:a,m:u,parent:f}=e;a&&j(a),(l=c&&c.onVnodeBeforeMount)&&Wn(l,f,t);const p=e.subTree=Dt(e);if(i&&ue?ue(t.el,p,e,r,null):(x(null,p,n,o,e,r,s),t.el=p.el),u&&Un(u,r),l=c&&c.onVnodeMounted){const e=t;Un((()=>{Wn(l,f,e)}),r)}const{a:d}=e;d&&256&t.shapeFlag&&Un(d,r),e.isMounted=!0,t=n=o=null}}),Bn)},K=(e,t,n)=>{t.component=e;const o=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,o){const{props:r,attrs:s,vnode:{patchFlag:l}}=e,i=qe(r),[a]=e.propsOptions;if(!(o||l>0)||16&l){let o;Jt(e,t,r,s);for(const s in i)t&&(y(t,s)||(o=N(s))!==s&&y(t,o))||(a?!n||void 0===n[s]&&void 0===n[o]||(r[s]=Xt(a,t||c,s,void 0,e)):delete r[s]);if(s!==i)for(const e in s)t&&y(t,e)||delete s[e]}else if(8&l){const n=e.vnode.dynamicProps;for(let o=0;o{const{vnode:o,slots:r}=e;let s=!0,l=c;if(32&o.shapeFlag){const e=t._;e?n&&1===e?s=!1:(v(r,t),n||1!==e||delete r._):(s=!t.$stable,Ln(t,r)),l=t}else t&&(Mn(e,t),l={default:1});if(s)for(const i in r)Tn(i)||i in l||delete r[i]})(e,t.children,n),Q(),wt(void 0,e.update),Y()},G=(e,t,n,o,r,s,l,i,c=!1)=>{const a=e&&e.children,u=e?e.shapeFlag:0,f=t.children,{patchFlag:p,shapeFlag:h}=t;if(p>0){if(128&p)return void X(a,f,n,o,r,s,l,i,c);if(256&p)return void J(a,f,n,o,r,s,l,i,c)}8&h?(16&u&&se(a,r,s),f!==a&&d(n,f)):16&u?16&h?X(a,f,n,o,r,s,l,i,c):se(a,r,s,!0):(8&u&&d(n,""),16&h&&M(f,n,o,r,s,l,i,c))},J=(e,t,n,o,r,s,l,i,c)=>{t=t||a;const u=(e=e||a).length,f=t.length,p=Math.min(u,f);let d;for(d=0;df?se(e,r,s,!0,!1,p):M(t,n,o,r,s,l,i,c,p)},X=(e,t,n,o,r,s,l,i,c)=>{let u=0;const f=t.length;let p=e.length-1,d=f-1;for(;u<=p&&u<=d;){const o=e[u],a=t[u]=c?bo(t[u]):_o(t[u]);if(!uo(o,a))break;x(o,a,n,null,r,s,l,i,c),u++}for(;u<=p&&u<=d;){const o=e[p],a=t[d]=c?bo(t[d]):_o(t[d]);if(!uo(o,a))break;x(o,a,n,null,r,s,l,i,c),p--,d--}if(u>p){if(u<=d){const e=d+1,a=ed)for(;u<=p;)ee(e[u],r,s,!0),u++;else{const h=u,v=u,g=new Map;for(u=v;u<=d;u++){const e=t[u]=c?bo(t[u]):_o(t[u]);null!=e.key&&g.set(e.key,u)}let m,y=0;const _=d-v+1;let b=!1,C=0;const S=new Array(_);for(u=0;u<_;u++)S[u]=0;for(u=h;u<=p;u++){const o=e[u];if(y>=_){ee(o,r,s,!0);continue}let a;if(null!=o.key)a=g.get(o.key);else for(m=v;m<=d;m++)if(0===S[m-v]&&uo(o,t[m])){a=m;break}void 0===a?ee(o,r,s,!0):(S[a-v]=u+1,a>=C?C=a:b=!0,x(o,t[a],n,null,r,s,l,i,c),y++)}const w=b?function(e){const t=e.slice(),n=[0];let o,r,s,l,i;const c=e.length;for(o=0;o0&&(t[o]=n[s-1]),n[s]=o)}}s=n.length,l=n[s-1];for(;s-- >0;)n[s]=l,l=t[l];return n}(S):a;for(m=w.length-1,u=_-1;u>=0;u--){const e=v+u,a=t[e],p=e+1{const{el:l,type:i,transition:c,children:a,shapeFlag:u}=e;if(6&u)return void Z(e.component.subTree,t,o,r);if(128&u)return void e.suspense.move(t,o,r);if(64&u)return void i.move(e,t,o,ce);if(i===eo){n(l,t,o);for(let e=0;ec.enter(l)),s);else{const{leave:e,delayLeave:r,afterLeave:s}=c,i=()=>n(l,t,o),a=()=>{e(l,(()=>{i(),s&&s()}))};r?r(l,i,a):a()}else n(l,t,o)},ee=(e,t,n,o=!1,r=!1)=>{const{type:s,props:l,ref:i,children:c,dynamicChildren:a,shapeFlag:u,patchFlag:f,dirs:p}=e;if(null!=i&&Dn(i,null,n,null),256&u)return void t.ctx.deactivate(e);const d=1&u&&p;let h;if((h=l&&l.onVnodeBeforeUnmount)&&Wn(h,t,e),6&u)re(e.component,n,o);else{if(128&u)return void e.suspense.unmount(n,o);d&&Pn(e,null,t,"beforeUnmount"),64&u?e.type.remove(e,t,n,r,ce,o):a&&(s!==eo||f>0&&64&f)?se(a,t,n,!1,!0):(s===eo&&(128&f||256&f)||!r&&16&u)&&se(c,t,n),o&&ne(e)}((h=l&&l.onVnodeUnmounted)||d)&&Un((()=>{h&&Wn(h,t,e),d&&Pn(e,null,t,"unmounted")}),n)},ne=e=>{const{type:t,el:n,anchor:r,transition:s}=e;if(t===eo)return void oe(n,r);if(t===oo)return void F(e);const l=()=>{o(n),s&&!s.persisted&&s.afterLeave&&s.afterLeave()};if(1&e.shapeFlag&&s&&!s.persisted){const{leave:t,delayLeave:o}=s,r=()=>t(n,l);o?o(e.el,l,r):r()}else l()},oe=(e,t)=>{let n;for(;e!==t;)n=g(e),o(e),e=n;o(t)},re=(e,t,n)=>{const{bum:o,effects:r,update:s,subTree:l,um:i}=e;if(o&&j(o),r)for(let c=0;c{e.isUnmounted=!0}),t),t&&t.pendingBranch&&!t.isUnmounted&&e.asyncDep&&!e.asyncResolved&&e.suspenseId===t.pendingId&&(t.deps--,0===t.deps&&t.resolve())},se=(e,t,n,o=!1,r=!1,s=0)=>{for(let l=s;l6&e.shapeFlag?le(e.component.subTree):128&e.shapeFlag?e.suspense.next():g(e.anchor||e.el),ie=(e,t,n)=>{null==e?t._vnode&&ee(t._vnode,null,null,!0):x(t._vnode||null,e,t,null,null,null,n),Et(),t._vnode=e},ce={p:x,um:ee,m:Z,r:ne,mt:D,mc:M,pc:G,pbc:I,n:le,o:e};let ae,ue;t&&([ae,ue]=t(ce));return{render:ie,hydrate:ae,createApp:jn(ie,ae)}}(e)}function Wn(e,t,n,o=null){st(e,t,7,[n,o])}function Kn(e,t,n=!1){const o=e.children,r=t.children;if(_(o)&&_(r))for(let s=0;se&&(e.disabled||""===e.disabled),qn=e=>"undefined"!=typeof SVGElement&&e instanceof SVGElement,Gn=(e,t)=>{const n=e&&e.to;if(C(n)){if(t){return t(n)}return null}return n};function Jn(e,t,n,{o:{insert:o},m:r},s=2){0===s&&o(e.targetAnchor,t,n);const{el:l,anchor:i,shapeFlag:c,children:a,props:u}=e,f=2===s;if(f&&o(l,t,n),(!f||Hn(u))&&16&c)for(let p=0;p{16&y&&u(_,e,t,r,s,l,i,c)};m?g(n,a):f&&g(f,p)}else{t.el=e.el;const o=t.anchor=e.anchor,u=t.target=e.target,d=t.targetAnchor=e.targetAnchor,v=Hn(e.props),g=v?n:u,y=v?o:d;if(l=l||qn(u),t.dynamicChildren?(p(e.dynamicChildren,t.dynamicChildren,g,r,s,l,i),Kn(e,t,!0)):c||f(e,t,g,y,r,s,l,i,!1),m)v||Jn(t,n,o,a,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const e=t.target=Gn(t.props,h);e&&Jn(t,e,null,a,0)}else v&&Jn(t,u,d,a,1)}},remove(e,t,n,o,{um:r,o:{remove:s}},l){const{shapeFlag:i,children:c,anchor:a,targetAnchor:u,target:f,props:p}=e;if(f&&s(u),(l||!Hn(p))&&(s(a),16&i))for(let d=0;dnull!=e?e:null,ho=({ref:e})=>null!=e?C(e)||Je(e)||x(e)?{i:Pt,r:e}:e:null,vo=function(e,t=null,n=null,r=0,s=null,l=!1){e&&e!==Qn||(e=no);if(ao(e)){const o=go(e,t,!0);return n&&xo(o,n),o}c=e,x(c)&&"__vccOpts"in c&&(e=e.__vccOpts);var c;if(t){(He(t)||fo in t)&&(t=v({},t));let{class:e,style:n}=t;e&&!C(e)&&(t.class=i(e)),w(n)&&(He(n)&&!_(n)&&(n=v({},n)),t.style=o(n))}const a=C(e)?1:(e=>e.__isSuspense)(e)?128:(e=>e.__isTeleport)(e)?64:w(e)?4:x(e)?2:0,u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&po(t),ref:t&&ho(t),scopeId:It,slotScopeIds:null,children:null,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null};if(xo(u,n),128&a){const{content:e,fallback:t}=function(e){const{shapeFlag:t,children:n}=e;let o,r;return 32&t?(o=qt(n.default),r=qt(n.fallback)):(o=qt(n),r=_o(null)),{content:o,fallback:r}}(u);u.ssContent=e,u.ssFallback=t}!l&&so&&(r>0||6&a)&&32!==r&&so.push(u);return u};function go(e,t,n=!1){const{props:o,ref:r,patchFlag:s,children:l}=e,i=t?Co(o||{},t):o;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:i,key:i&&po(i),ref:t&&t.ref?n&&r?_(r)?r.concat(ho(t)):[r,ho(t)]:ho(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==eo?-1===s?16:16|s:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&go(e.ssContent),ssFallback:e.ssFallback&&go(e.ssFallback),el:e.el,anchor:e.anchor}}function mo(e=" ",t=0){return vo(to,null,e,t)}function yo(e="",t=!1){return t?(lo(),co(no,null,e)):vo(no,null,e)}function _o(e){return null==e||"boolean"==typeof e?vo(no):_(e)?vo(eo,null,e):"object"==typeof e?null===e.el?e:go(e):vo(to,null,String(e))}function bo(e){return null===e.el?e:go(e)}function xo(e,t){let n=0;const{shapeFlag:o}=e;if(null==t)t=null;else if(_(t))n=16;else if("object"==typeof t){if(1&o||64&o){const n=t.default;return void(n&&(n._c&&Lt(1),xo(e,n()),n._c&&Lt(-1)))}{n=32;const o=t._;o||fo in t?3===o&&Pt&&(1024&Pt.vnode.patchFlag?(t._=2,e.patchFlag|=1024):t._=1):t._ctx=Pt}}else x(t)?(t={default:t,_ctx:Pt},n=32):(t=String(t),64&o?(n=16,t=[mo(t)]):n=8);e.children=t,e.shapeFlag|=n}function Co(...e){const t=v({},e[0]);for(let n=1;n1)return n&&x(t)?t():t}}let wo=!0;function Eo(e,t,n=[],o=[],r=[],s=!1){const{mixins:l,extends:i,data:a,computed:f,methods:p,watch:d,provide:h,inject:g,components:m,directives:y,beforeMount:b,mounted:C,beforeUpdate:S,updated:E,activated:A,deactivated:F,beforeDestroy:k,beforeUnmount:T,destroyed:O,unmounted:R,render:L,renderTracked:M,renderTriggered:N,errorCaptured:P,expose:I}=t,$=e.proxy,j=e.ctx,V=e.appContext.mixins;if(s&&L&&e.render===u&&(e.render=L),s||(wo=!1,Ao("beforeCreate","bc",t,e,V),wo=!0,ko(e,V,n,o,r)),i&&Eo(e,i,n,o,r,!0),l&&ko(e,l,n,o,r),g)if(_(g))for(let c=0;cTo(e,t,$))),a&&To(e,a,$)),f)for(const c in f){const e=f[c],t=qo({get:x(e)?e.bind($,$):x(e.get)?e.get.bind($,$):u,set:!x(e)&&x(e.set)?e.set.bind($):u});Object.defineProperty(j,c,{enumerable:!0,configurable:!0,get:()=>t.value,set:e=>t.value=e})}var B;if(d&&o.push(d),!s&&o.length&&o.forEach((e=>{for(const t in e)Oo(e[t],j,$,t)})),h&&r.push(h),!s&&r.length&&r.forEach((e=>{const t=x(e)?e.call($):e;Reflect.ownKeys(t).forEach((e=>{!function(e,t){if(jo){let n=jo.provides;const o=jo.parent&&jo.parent.provides;o===n&&(n=jo.provides=Object.create(o)),n[e]=t}}(e,t[e])}))})),s&&(m&&v(e.components||(e.components=v({},e.type.components)),m),y&&v(e.directives||(e.directives=v({},e.type.directives)),y)),s||Ao("created","c",t,e,V),b&&rn(b.bind($)),C&&sn(C.bind($)),S&&ln(S.bind($)),E&&cn(E.bind($)),A&&Fn(A.bind($),"a",B),F&&function(e,t){Fn(e,"da",t)}(F.bind($)),P&&((e,t=jo)=>{nn("ec",e,t)})(P.bind($)),M&&pn(M.bind($)),N&&fn(N.bind($)),T&&an(T.bind($)),R&&un(R.bind($)),_(I)&&!s)if(I.length){const t=e.exposed||(e.exposed=Ye({}));I.forEach((e=>{t[e]=nt($,e)}))}else e.exposed||(e.exposed=c)}function Ao(e,t,n,o,r){for(let s=0;s{let t=e;for(let e=0;en[o];if(C(e)){const n=t[e];x(n)&&hn(r,n)}else if(x(e))hn(r,e.bind(n));else if(w(e))if(_(e))e.forEach((e=>Oo(e,t,n,o)));else{const o=x(e.handler)?e.handler.bind(n):t[e.handler];x(o)&&hn(r,o,e)}}function Ro(e,t,n){const o=n.appContext.config.optionMergeStrategies,{mixins:r,extends:s}=t;s&&Ro(e,s,n),r&&r.forEach((t=>Ro(e,t,n)));for(const l in t)o&&y(o,l)?e[l]=o[l](e[l],t[l],n.proxy,l):e[l]=t[l]}const Lo=e=>e?Uo(e)?e.exposed?e.exposed:e.proxy:Lo(e.parent):null,Mo=v(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Lo(e.parent),$root:e=>Lo(e.root),$emit:e=>e.emit,$options:e=>function(e){const t=e.type,{__merged:n,mixins:o,extends:r}=t;if(n)return n;const s=e.appContext.mixins;if(!s.length&&!o&&!r)return t;const l={};return s.forEach((t=>Ro(l,t,e))),Ro(l,t,e),t.__merged=l}(e),$forceUpdate:e=>()=>xt(e.update),$nextTick:e=>bt.bind(e.proxy),$watch:e=>gn.bind(e)}),No={get({_:e},t){const{ctx:n,setupState:o,data:r,props:s,accessCache:l,type:i,appContext:a}=e;if("__v_skip"===t)return!0;let u;if("$"!==t[0]){const i=l[t];if(void 0!==i)switch(i){case 0:return o[t];case 1:return r[t];case 3:return n[t];case 2:return s[t]}else{if(o!==c&&y(o,t))return l[t]=0,o[t];if(r!==c&&y(r,t))return l[t]=1,r[t];if((u=e.propsOptions[0])&&y(u,t))return l[t]=2,s[t];if(n!==c&&y(n,t))return l[t]=3,n[t];wo&&(l[t]=4)}}const f=Mo[t];let p,d;return f?("$attrs"===t&&ee(e,0,t),f(e)):(p=i.__cssModules)&&(p=p[t])?p:n!==c&&y(n,t)?(l[t]=3,n[t]):(d=a.config.globalProperties,y(d,t)?d[t]:void 0)},set({_:e},t,n){const{data:o,setupState:r,ctx:s}=e;if(r!==c&&y(r,t))r[t]=n;else if(o!==c&&y(o,t))o[t]=n;else if(y(e.props,t))return!1;return("$"!==t[0]||!(t.slice(1)in e))&&(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,propsOptions:s}},l){let i;return void 0!==n[l]||e!==c&&y(e,l)||t!==c&&y(t,l)||(i=s[0])&&y(i,l)||y(o,l)||y(Mo,l)||y(r.config.globalProperties,l)}},Po=v({},No,{get(e,t){if(t!==Symbol.unscopables)return No.get(e,t,e)},has:(e,n)=>"_"!==n[0]&&!t(n)}),Io=In();let $o=0;let jo=null;const Vo=()=>jo||Pt,Bo=e=>{jo=e};function Uo(e){return 4&e.vnode.shapeFlag}let Do=!1;function zo(e,t,n){x(t)?e.render=t:w(t)&&(e.setupState=Ye(t)),Wo(e)}function Wo(e,t){const n=e.type;e.render||(e.render=n.render||u,e.render._rc&&(e.withProxy=new Proxy(e.ctx,Po))),jo=e,Q(),Eo(e,n),Y(),jo=null}function Ko(e,t=jo){t&&(t.effects||(t.effects=[])).push(e)}function Ho(e){return x(e)&&e.displayName||e.name}function qo(e){const t=function(e){let t,n;return x(e)?(t=e,n=u):(t=e.get,n=e.set),new ot(t,n,x(e)||!e.set)}(e);return Ko(t.effect),t}function Go(e){const t={};for(const n in e)t[I(n)]=e[n];return t}const Jo="3.0.11",Xo="http://www.w3.org/2000/svg",Zo="undefined"!=typeof document?document:null;let Qo,Yo;const er={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const r=t?Zo.createElementNS(Xo,e):Zo.createElement(e,n?{is:n}:void 0);return"select"===e&&o&&null!=o.multiple&&r.setAttribute("multiple",o.multiple),r},createText:e=>Zo.createTextNode(e),createComment:e=>Zo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Zo.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},cloneNode(e){const t=e.cloneNode(!0);return"_value"in e&&(t._value=e._value),t},insertStaticContent(e,t,n,o){const r=o?Yo||(Yo=Zo.createElementNS(Xo,"svg")):Qo||(Qo=Zo.createElement("div"));r.innerHTML=e;const s=r.firstChild;let l=s,i=l;for(;l;)i=l,er.insert(l,t,n),l=r.firstChild;return[s,i]}};const tr=/\s*!important$/;function nr(e,t,n){if(_(n))n.forEach((n=>nr(e,t,n)));else if(t.startsWith("--"))e.setProperty(t,n);else{const o=function(e,t){const n=rr[t];if(n)return n;let o=L(t);if("filter"!==o&&o in e)return rr[t]=o;o=P(o);for(let r=0;rdocument.createEvent("Event").timeStamp&&(lr=()=>performance.now());const e=navigator.userAgent.match(/firefox\/(\d+)/i);ir=!!(e&&Number(e[1])<=53)}let cr=0;const ar=Promise.resolve(),ur=()=>{cr=0};function fr(e,t,n,o,r=null){const s=e._vei||(e._vei={}),l=s[t];if(o&&l)l.value=o;else{const[n,i]=function(e){let t;if(pr.test(e)){let n;for(t={};n=e.match(pr);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[N(e.slice(2)),t]}(t);if(o){!function(e,t,n,o){e.addEventListener(t,n,o)}(e,n,s[t]=function(e,t){const n=e=>{const o=e.timeStamp||lr();(ir||o>=n.attached-1)&&st(function(e,t){if(_(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map((e=>t=>!t._stopped&&e(t)))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=(()=>cr||(ar.then(ur),cr=lr()))(),n}(o,r),i)}else l&&(!function(e,t,n,o){e.removeEventListener(t,n,o)}(e,n,l,i),s[t]=void 0)}}const pr=/(?:Once|Passive|Capture)$/;const dr=/^on[a-z]/;const hr="transition",vr=(e,{slots:t})=>function(e,t,n){const o=arguments.length;return 2===o?w(t)&&!_(t)?ao(t)?vo(e,null,[t]):vo(e,t):vo(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):3===o&&ao(n)&&(n=[n]),vo(e,t,n))}(_n,function(e){let{name:t="v",type:n,css:o=!0,duration:r,enterFromClass:s=`${t}-enter-from`,enterActiveClass:l=`${t}-enter-active`,enterToClass:i=`${t}-enter-to`,appearFromClass:c=s,appearActiveClass:a=l,appearToClass:u=i,leaveFromClass:f=`${t}-leave-from`,leaveActiveClass:p=`${t}-leave-active`,leaveToClass:d=`${t}-leave-to`}=e;const h={};for(const v in e)v in gr||(h[v]=e[v]);if(!o)return h;const g=function(e){if(null==e)return null;if(w(e))return[mr(e.enter),mr(e.leave)];{const t=mr(e);return[t,t]}}(r),m=g&&g[0],y=g&&g[1],{onBeforeEnter:_,onEnter:b,onEnterCancelled:x,onLeave:C,onLeaveCancelled:S,onBeforeAppear:E=_,onAppear:A=b,onAppearCancelled:F=x}=h,k=(e,t,n)=>{_r(e,t?u:i),_r(e,t?a:l),n&&n()},T=(e,t)=>{_r(e,d),_r(e,p),t&&t()},O=e=>(t,o)=>{const r=e?A:b,l=()=>k(t,e,o);r&&r(t,l),br((()=>{_r(t,e?c:s),yr(t,e?u:i),r&&r.length>1||Cr(t,n,m,l)}))};return v(h,{onBeforeEnter(e){_&&_(e),yr(e,s),yr(e,l)},onBeforeAppear(e){E&&E(e),yr(e,c),yr(e,a)},onEnter:O(!1),onAppear:O(!0),onLeave(e,t){const o=()=>T(e,t);yr(e,f),document.body.offsetHeight,yr(e,p),br((()=>{_r(e,f),yr(e,d),C&&C.length>1||Cr(e,n,y,o)})),C&&C(e,o)},onEnterCancelled(e){k(e,!1),x&&x(e)},onAppearCancelled(e){k(e,!0),F&&F(e)},onLeaveCancelled(e){T(e),S&&S(e)}})}(e),t);vr.displayName="Transition";const gr={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};function mr(e){return B(e)}function yr(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.add(t))),(e._vtc||(e._vtc=new Set)).add(t)}function _r(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.remove(t)));const{_vtc:n}=e;n&&(n.delete(t),n.size||(e._vtc=void 0))}function br(e){requestAnimationFrame((()=>{requestAnimationFrame(e)}))}vr.props=v({},_n.props,gr);let xr=0;function Cr(e,t,n,o){const r=e._endId=++xr,s=()=>{r===e._endId&&o()};if(n)return setTimeout(s,n);const{type:l,timeout:i,propCount:c}=function(e,t){const n=window.getComputedStyle(e),o=e=>(n[e]||"").split(", "),r=o("transitionDelay"),s=o("transitionDuration"),l=Sr(r,s),i=o("animationDelay"),c=o("animationDuration"),a=Sr(i,c);let u=null,f=0,p=0;t===hr?l>0&&(u=hr,f=l,p=s.length):"animation"===t?a>0&&(u="animation",f=a,p=c.length):(f=Math.max(l,a),u=f>0?l>a?hr:"animation":null,p=u?u===hr?s.length:c.length:0);const d=u===hr&&/\b(transform|all)(,|$)/.test(n.transitionProperty);return{type:u,timeout:f,propCount:p,hasTransform:d}}(e,t);if(!l)return o();const a=l+"end";let u=0;const f=()=>{e.removeEventListener(a,p),s()},p=t=>{t.target===e&&++u>=c&&f()};setTimeout((()=>{uwr(t)+wr(e[n]))))}function wr(e){return 1e3*Number(e.slice(0,-1).replace(",","."))}const Er=["ctrl","shift","alt","meta"],Ar={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>Er.some((n=>e[`${n}Key`]&&!t.includes(n)))},Fr=(e,t)=>(n,...o)=>{for(let e=0;e{Tr(e,!1)})):Tr(e,t))},beforeUnmount(e,{value:t}){Tr(e,t)}};function Tr(e,t){e.style.display=t?e._vod:"none"}const Or=v({patchProp:(e,t,o,r,s=!1,l,i,c,a)=>{switch(t){case"class":!function(e,t,n){if(null==t&&(t=""),n)e.setAttribute("class",t);else{const n=e._vtc;n&&(t=(t?[t,...n]:[...n]).join(" ")),e.className=t}}(e,r,s);break;case"style":!function(e,t,n){const o=e.style;if(n)if(C(n)){if(t!==n){const t=o.display;o.cssText=n,"_vod"in e&&(o.display=t)}}else{for(const e in n)nr(o,e,n[e]);if(t&&!C(t))for(const e in t)null==n[e]&&nr(o,e,"")}else e.removeAttribute("style")}(e,o,r);break;default:d(t)?h(t)||fr(e,t,0,r,i):function(e,t,n,o){if(o)return"innerHTML"===t||!!(t in e&&dr.test(t)&&x(n));if("spellcheck"===t||"draggable"===t)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if(dr.test(t)&&C(n))return!1;return t in e}(e,t,r,s)?function(e,t,n,o,r,s,l){if("innerHTML"===t||"textContent"===t)return o&&l(o,r,s),void(e[t]=null==n?"":n);if("value"!==t||"PROGRESS"===e.tagName){if(""===n||null==n){const o=typeof e[t];if(""===n&&"boolean"===o)return void(e[t]=!0);if(null==n&&"string"===o)return e[t]="",void e.removeAttribute(t);if("number"===o)return e[t]=0,void e.removeAttribute(t)}try{e[t]=n}catch(i){}}else{e._value=n;const t=null==n?"":n;e.value!==t&&(e.value=t)}}(e,t,r,l,i,c,a):("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),function(e,t,o,r){if(r&&t.startsWith("xlink:"))null==o?e.removeAttributeNS(sr,t.slice(6,t.length)):e.setAttributeNS(sr,t,o);else{const r=n(t);null==o||r&&!1===o?e.removeAttribute(t):e.setAttribute(t,r?"":o)}}(e,t,r,s))}},forcePatchProp:(e,t)=>"value"===t},er);let Rr;const Lr=(...e)=>{const t=(Rr||(Rr=zn(Or))).createApp(...e),{mount:n}=t;return t.mount=e=>{const o=function(e){if(C(e)){return document.querySelector(e)}return e}(e);if(!o)return;const r=t._component;x(r)||r.render||r.template||(r.template=o.innerHTML),o.innerHTML="";const s=n(o,!1,o instanceof SVGElement);return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};export{Mt as A,De as B,Lr as C,eo as F,vr as T,vo as a,Zn as b,co as c,Vn as d,Ue as e,Bt as f,Vt as g,qo as h,hn as i,sn as j,un as k,So as l,Vo as m,bt as n,lo as o,jt as p,Co as q,Xe as r,Go as s,et as t,Xn as u,yo as v,Ut as w,Nn as x,kr as y,Fr as z}; diff --git a/dist/Modal.vue.d.ts b/dist/Modal.vue.d.ts index 278954f..3a8de71 100644 --- a/dist/Modal.vue.d.ts +++ b/dist/Modal.vue.d.ts @@ -1,65 +1,57 @@ -interface Options { - transition: number | false; - closeKeyCode: number | false; - closeClickDimmed: boolean; - styleModal: { - [key: string]: string; - }; - styleModalContent: { - [key: string]: string; - }; -} declare const _default: import("vue").DefineComponent<{ close: { type: FunctionConstructor; - required: true; default: () => undefined; }; - options: { - type: ObjectConstructor; - default: () => {}; - }; disabled: { type: BooleanConstructor; default: boolean; }; - id: { - type: StringConstructor; - default: string; - }; - class: { - type: StringConstructor; - default: string; + modelValue: { + type: BooleanConstructor; + default: boolean; }; - ariaLabelledby: { - type: StringConstructor; - default: string; + options: { + type: ObjectConstructor; + default: () => {}; }; }, { CLASS_NAME: string; - teleportTarget: string; - modalRef: import("vue").Ref; - show: import("vue").Ref; - latest: import("vue").ComputedRef; emitClose: () => void; - emitAfterLeave: () => void; + inserted: import("vue").Ref; + latest: import("vue").ComputedRef; + mergeOptions: { + transition: number | false; + closeClickDimmed: boolean; + closeKeyCode: number | false; + styleModalContent: { + [key: string]: unknown; + }; + }; + modalRef: import("vue").Ref; onClickDimmed: () => void; - mergeOptions: Options; + onTransitionEmit: { + beforeEnter: () => void; + enter: () => void; + afterEnter: () => void; + enterCancelled: () => void; + beforeLeave: () => void; + leave: () => void; + afterLeave: () => void; + leaveCancelled: () => void; + }; + show: import("vue").Ref; + teleportTarget: string; transition: string | boolean; - className: string; -}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("before-enter" | "after-enter" | "before-leave" | "after-leave")[], "before-enter" | "after-enter" | "before-leave" | "after-leave", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{ +}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("before-enter" | "enter" | "after-enter" | "enter-cancelled" | "before-leave" | "leave" | "after-leave" | "leave-cancelled")[], "before-enter" | "enter" | "after-enter" | "enter-cancelled" | "before-leave" | "leave" | "after-leave" | "leave-cancelled", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{ close: Function; - options: Record; disabled: boolean; - id: string; - class: string; - ariaLabelledby: string; + modelValue: boolean; + options: Record; } & {}>, { close: Function; - options: Record; disabled: boolean; - id: string; - class: string; - ariaLabelledby: string; + modelValue: boolean; + options: Record; }>; export default _default; diff --git a/dist/hooks.d.ts b/dist/hooks.d.ts new file mode 100644 index 0000000..753a451 --- /dev/null +++ b/dist/hooks.d.ts @@ -0,0 +1,33 @@ +import type { ComputedRef, Ref } from 'vue'; +declare type UseOrder = ({ modelValue, show }: { + modelValue: Ref; + show: Ref; +}) => { + latest: ComputedRef; +}; +export declare const useOrder: UseOrder; +declare type UseColse = ({ close, options, latest }: { + close: Ref; + options: Ref<{ + [key: string]: unknown; + }>; + latest: ComputedRef; +}) => { + mergeOptions: { + transition: number | false; + closeClickDimmed: boolean; + closeKeyCode: number | false; + styleModalContent: { + [key: string]: unknown; + }; + }; + onClickDimmed: () => void; +}; +export declare const useClose: UseColse; +declare type UseA11Y = ({ modalRef, latest, show }: { + modalRef: Ref; + latest: ComputedRef; + show: Ref; +}) => void; +export declare const useA11Y: UseA11Y; +export {}; diff --git a/dist/index.d.ts b/dist/index.d.ts index 2fd4999..acd8f19 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,9 +1,9 @@ import type { App, Ref } from 'vue'; interface PluginOptions { - teleportTarget: string; - teleportComponent: string; - teleportComponentId: string; - modalComponent: string; + teleportTarget?: string; + teleportComponent?: string; + teleportComponentId?: string; + modalComponent?: string; } interface Provide { teleportTarget: string; @@ -14,7 +14,7 @@ interface Provide { declare const PLUGIN_NAME = "VueUniversalModal"; declare const CLASS_NAME = "vue-universal-modal"; declare const _default: { - install: (app: App, options?: {}) => void; + install: (app: App, options: PluginOptions) => void; }; export default _default; export { PLUGIN_NAME, CLASS_NAME }; diff --git a/dist/index.es5.js b/dist/index.es5.js index 12c002a..506ed4d 100644 --- a/dist/index.es5.js +++ b/dist/index.es5.js @@ -1,4 +1,4 @@ -import { defineComponent, inject, getCurrentInstance, ref, computed, watch, onMounted, onUnmounted, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, withModifiers, renderSlot, vShow, readonly } from 'vue'; +import { inject, getCurrentInstance, computed, watch, onMounted, onUnmounted, nextTick, defineComponent, toRefs, ref, openBlock, createBlock, Teleport, createVNode, Transition, mergeProps, toHandlers, withCtx, withDirectives, withModifiers, renderSlot, vShow, createCommentVNode, readonly } from 'vue'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; @@ -44,20 +44,20 @@ var descriptors = !fails(function () { }); var nativePropertyIsEnumerable = {}.propertyIsEnumerable; -var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug -var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); +var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable -var f = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = getOwnPropertyDescriptor(this, V); +var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$1(this, V); return !!descriptor && descriptor.enumerable; } : nativePropertyIsEnumerable; var objectPropertyIsEnumerable = { - f: f + f: f$4 }; var createPropertyDescriptor = function (bitmap, value) { @@ -120,7 +120,7 @@ var toPrimitive = function (input, PREFERRED_STRING) { var hasOwnProperty = {}.hasOwnProperty; -var has = function (it, key) { +var has$1 = function (it, key) { return hasOwnProperty.call(it, key); }; @@ -143,17 +143,17 @@ var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor -var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { +var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (ie8DomDefine) try { return nativeGetOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } - if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); + if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); }; var objectGetOwnPropertyDescriptor = { - f: f$1 + f: f$3 }; var anObject = function (it) { @@ -198,9 +198,9 @@ var setGlobal = function (key, value) { }; var SHARED = '__core-js_shared__'; -var store = global_1[SHARED] || setGlobal(SHARED, {}); +var store$1 = global_1[SHARED] || setGlobal(SHARED, {}); -var sharedStore = store; +var sharedStore = store$1; var functionToString = Function.toString; @@ -213,16 +213,16 @@ if (typeof sharedStore.inspectSource != 'function') { var inspectSource = sharedStore.inspectSource; -var WeakMap = global_1.WeakMap; +var WeakMap$1 = global_1.WeakMap; -var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); +var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1)); var shared = createCommonjsModule(function (module) { (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.8.0', - mode: 'global', + mode: 'global', copyright: '© 2020 Denis Pushkarev (zloirock.ru)' }); }); @@ -240,13 +240,13 @@ var sharedKey = function (key) { return keys[key] || (keys[key] = uid(key)); }; -var hiddenKeys = {}; +var hiddenKeys$1 = {}; -var WeakMap$1 = global_1.WeakMap; -var set, get, has$1; +var WeakMap = global_1.WeakMap; +var set, get, has; var enforce = function (it) { - return has$1(it) ? get(it) : set(it, {}); + return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { @@ -259,41 +259,41 @@ var getterFor = function (TYPE) { }; if (nativeWeakMap) { - var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$1()); - var wmget = store$1.get; - var wmhas = store$1.has; - var wmset = store$1.set; + var store = sharedStore.state || (sharedStore.state = new WeakMap()); + var wmget = store.get; + var wmhas = store.has; + var wmset = store.set; set = function (it, metadata) { metadata.facade = it; - wmset.call(store$1, it, metadata); + wmset.call(store, it, metadata); return metadata; }; get = function (it) { - return wmget.call(store$1, it) || {}; + return wmget.call(store, it) || {}; }; - has$1 = function (it) { - return wmhas.call(store$1, it); + has = function (it) { + return wmhas.call(store, it); }; } else { var STATE = sharedKey('state'); - hiddenKeys[STATE] = true; + hiddenKeys$1[STATE] = true; set = function (it, metadata) { metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { - return has(it, STATE) ? it[STATE] : {}; + return has$1(it, STATE) ? it[STATE] : {}; }; - has$1 = function (it) { - return has(it, STATE); + has = function (it) { + return has$1(it, STATE); }; } var internalState = { set: set, get: get, - has: has$1, + has: has, enforce: enforce, getterFor: getterFor }; @@ -309,7 +309,7 @@ var TEMPLATE = String(String).split('String'); var noTargetGet = options ? !!options.noTargetGet : false; var state; if (typeof value == 'function') { - if (typeof key == 'string' && !has(value, 'name')) { + if (typeof key == 'string' && !has$1(value, 'name')) { createNonEnumerableProperty(value, 'name', key); } state = enforceInternalState(value); @@ -354,15 +354,15 @@ var toInteger = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; -var min = Math.min; +var min$2 = Math.min; // `ToLength` abstract operation // https://tc39.github.io/ecma262/#sec-tolength var toLength = function (argument) { - return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + return argument > 0 ? min$2(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; -var max = Math.max; +var max$1 = Math.max; var min$1 = Math.min; // Helper for a popular repeating case of the spec: @@ -370,7 +370,7 @@ var min$1 = Math.min; // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). var toAbsoluteIndex = function (index, length) { var integer = toInteger(index); - return integer < 0 ? max(integer + length, 0) : min$1(integer, length); + return integer < 0 ? max$1(integer + length, 0) : min$1(integer, length); }; // `Array.prototype.{ indexOf, includes }` methods implementation @@ -410,9 +410,9 @@ var objectKeysInternal = function (object, names) { var i = 0; var result = []; var key; - for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); + for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key); // Don't enum bug & hidden keys - while (names.length > i) if (has(O, key = names[i++])) { + while (names.length > i) if (has$1(O, key = names[i++])) { ~indexOf(result, key) || result.push(key); } return result; @@ -429,38 +429,38 @@ var enumBugKeys = [ 'valueOf' ]; -var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); +var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.github.io/ecma262/#sec-object.getownpropertynames -var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return objectKeysInternal(O, hiddenKeys$1); +var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return objectKeysInternal(O, hiddenKeys); }; var objectGetOwnPropertyNames = { - f: f$3 + f: f$1 }; -var f$4 = Object.getOwnPropertySymbols; +var f = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { - f: f$4 + f: f }; // all object keys, includes non-enumerable and symbols -var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { +var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = objectGetOwnPropertyNames.f(anObject(it)); var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; var copyConstructorProperties = function (target, source) { - var keys = ownKeys(source); + var keys = ownKeys$1(source); var defineProperty = objectDefineProperty.f; var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; - if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; @@ -484,7 +484,7 @@ var POLYFILL = isForced.POLYFILL = 'P'; var isForced_1 = isForced; -var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; +var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; @@ -520,7 +520,7 @@ var _export = function (options, source) { if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { - descriptor = getOwnPropertyDescriptor$1(target, key); + descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); @@ -573,13 +573,13 @@ var Symbol$1 = global_1.Symbol; var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; var wellKnownSymbol = function (name) { - if (!has(WellKnownSymbolsStore, name)) { - if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name]; + if (!has$1(WellKnownSymbolsStore, name)) { + if (nativeSymbol && has$1(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name]; else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; -var SPECIES = wellKnownSymbol('species'); +var SPECIES$1 = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation // https://tc39.github.io/ecma262/#sec-arrayspeciescreate @@ -590,7 +590,7 @@ var arraySpeciesCreate = function (originalArray, length) { // cross-realm fallback if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) { - C = C[SPECIES]; + C = C[SPECIES$1]; if (C === null) C = undefined; } } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); @@ -616,7 +616,7 @@ if (v8) { var engineV8Version = version && +version; -var SPECIES$1 = wellKnownSymbol('species'); +var SPECIES = wellKnownSymbol('species'); var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes @@ -625,7 +625,7 @@ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { return engineV8Version >= 51 || !fails(function () { var array = []; var constructor = array.constructor = {}; - constructor[SPECIES$1] = function () { + constructor[SPECIES] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; @@ -633,7 +633,7 @@ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { }; var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); -var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; +var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes @@ -668,10 +668,10 @@ _export({ target: 'Array', proto: true, forced: FORCED }, { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = toLength(E.length); - if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); } else { - if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); createProperty(A, n++, E); } } @@ -694,12 +694,12 @@ var cache = {}; var thrower = function (it) { throw it; }; var arrayMethodUsesToLength = function (METHOD_NAME, options) { - if (has(cache, METHOD_NAME)) return cache[METHOD_NAME]; + if (has$1(cache, METHOD_NAME)) return cache[METHOD_NAME]; if (!options) options = {}; var method = [][METHOD_NAME]; - var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false; - var argument0 = has(options, 0) ? options[0] : thrower; - var argument1 = has(options, 1) ? options[1] : undefined; + var ACCESSORS = has$1(options, 'ACCESSORS') ? options.ACCESSORS : false; + var argument0 = has$1(options, 0) ? options[0] : thrower; + var argument1 = has$1(options, 1) ? options[1] : undefined; return cache[METHOD_NAME] = !!method && !fails(function () { if (ACCESSORS && !descriptors) return true; @@ -720,11 +720,11 @@ var nativeIndexOf = [].indexOf; var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; var STRICT_METHOD = arrayMethodIsStrict('indexOf'); -var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); +var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof -_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, { +_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH$1 }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { return NEGATIVE_ZERO // convert -0 to +0 @@ -734,17 +734,17 @@ _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); -var USES_TO_LENGTH$1 = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 }); +var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 }); -var max$1 = Math.max; -var min$2 = Math.min; -var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; +var max = Math.max; +var min = Math.min; +var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method // https://tc39.github.io/ecma262/#sec-array.prototype.splice // with adding support of @@species -_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$1 }, { +_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, { splice: function splice(start, deleteCount /* , ...items */) { var O = toObject(this); var len = toLength(O.length); @@ -758,9 +758,9 @@ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; - actualDeleteCount = min$2(max$1(toInteger(deleteCount), 0), len - actualStart); + actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart); } - if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { + if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); } A = arraySpeciesCreate(O, actualDeleteCount); @@ -843,7 +843,7 @@ function _defineProperty(obj, key, value) { return obj; } -function ownKeys$1(object, enumerableOnly) { +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { @@ -862,13 +862,13 @@ function _objectSpread2(target) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { - ownKeys$1(Object(source), true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys$1(Object(source)).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } @@ -877,231 +877,307 @@ function _objectSpread2(target) { return target; } +var useOrder = function useOrder(_ref) { + var modelValue = _ref.modelValue, + show = _ref.show; + + var _inject = inject(PLUGIN_NAME), + visibleModals = _inject.visibleModals, + addVisibleModals = _inject.addVisibleModals, + removeVisibleModals = _inject.removeVisibleModals; + + var _ref2 = getCurrentInstance() || {}, + uid = _ref2.uid; + + var latest = computed(function () { + if (!uid || !visibleModals.value.length) return false; + return uid === visibleModals.value[visibleModals.value.length - 1]; + }); + watch([function () { + return modelValue.value; + }, function () { + return show.value; + }], function () { + if (!uid) { + return; + } + + var isShow = modelValue.value && show.value; + + if (isShow && visibleModals.value.indexOf(uid) < 0) { + addVisibleModals(uid); + } + + if (!isShow && visibleModals.value.indexOf(uid) > -1) { + removeVisibleModals(uid); + } + }, { + immediate: true + }); + return { + latest: latest + }; +}; +var useClose = function useClose(_ref3) { + var close = _ref3.close, + options = _ref3.options, + latest = _ref3.latest; + + var mergeOptions = _objectSpread2({ + transition: 300, + closeClickDimmed: true, + closeKeyCode: 27, + styleModalContent: {} + }, options.value); + + function onClickDimmed() { + if (mergeOptions.closeClickDimmed) { + close.value(); + } + } + + function closeKeyEvent(event) { + if (event.keyCode === mergeOptions.closeKeyCode && latest.value) { + close.value(); + } + } + + onMounted(function () { + if (mergeOptions.closeKeyCode) { + document.addEventListener('keyup', closeKeyEvent); + } + }); + onUnmounted(function () { + if (mergeOptions.closeKeyCode) { + document.removeEventListener('keyup', closeKeyEvent); + } + }); + return { + mergeOptions: mergeOptions, + onClickDimmed: onClickDimmed + }; +}; +var useA11Y = function useA11Y(_ref4) { + var modalRef = _ref4.modalRef, + latest = _ref4.latest, + show = _ref4.show; + var activeElement; + + function setLastActiveElement(event) { + var isModalEvent = event.target.closest(".".concat(CLASS_NAME)); // skip when this not latest modal + + if (!latest.value) return; // set activeElement when fired outside this modal + + if (!isModalEvent || isModalEvent !== modalRef.value) { + // skip when modal status is closing + if (isModalEvent && !isModalEvent.classList.contains("".concat(CLASS_NAME, "-show"))) return; + activeElement = event.target; + } + } + + onMounted(function () { + document.addEventListener('click', setLastActiveElement); + + function setFocus(value) { + if (value) { + if (modalRef.value) { + modalRef.value.focus(); + } + } else { + if (activeElement) { + activeElement.focus(); + } + } + } + + watch(function () { + return show.value; + }, function (value) { + nextTick(function () { + return setFocus(value); + }); + }, { + immediate: show.value + }); + }); + onUnmounted(function () { + document.removeEventListener('click', setLastActiveElement); + }); +}; + var script = defineComponent({ + inheritAttrs: false, props: { close: { type: Function, - required: true, default: function _default() { return undefined; } }, - options: { - type: Object, - default: function _default() { - return {}; - } - }, disabled: { type: Boolean, default: false }, - id: { - type: String, - default: '' - }, - class: { - type: String, - default: '' + modelValue: { + type: Boolean, + default: true }, - ariaLabelledby: { - type: String, - default: '' + options: { + type: Object, + default: function _default() { + return {}; + } } }, - emits: ['before-enter', 'after-enter', 'before-leave', 'after-leave'], + emits: ['before-enter', 'enter', 'after-enter', 'enter-cancelled', 'before-leave', 'leave', 'after-leave', 'leave-cancelled'], setup: function setup(props, context) { var _inject = inject(PLUGIN_NAME), - teleportTarget = _inject.teleportTarget, - visibleModals = _inject.visibleModals, - addVisibleModals = _inject.addVisibleModals, - removeVisibleModals = _inject.removeVisibleModals; - - var _ref = getCurrentInstance() || {}, - uid = _ref.uid; - - var modalRef = ref(); - var show = ref(); - var latest = computed(function () { - if (!uid || !visibleModals.value.length) return false; - return uid === visibleModals.value[visibleModals.value.length - 1]; - }); - watch(function () { - return props.disabled; + teleportTarget = _inject.teleportTarget; + + var _toRefs = toRefs(props), + close = _toRefs.close, + disabled = _toRefs.disabled, + options = _toRefs.options, + modelValue = _toRefs.modelValue; + + var inserted = ref(modelValue.value === undefined ? true : modelValue.value); + var modalRef = ref(null); + var show = ref(!disabled.value); + watch([function () { + return modelValue.value; }, function () { - show.value = !props.disabled; - }, { - immediate: true - }); - watch(function () { - return show.value; - }, function (value) { - if (!uid) return; - - if (value && visibleModals.value.indexOf(uid) < 0) { - addVisibleModals(uid); - } + return disabled.value; + }], function () { + var isShow = modelValue.value && !disabled.value; + show.value = isShow; - if (!value && visibleModals.value.indexOf(uid) > -1) { - removeVisibleModals(uid); + if (modelValue.value) { + inserted.value = modelValue.value; } }, { immediate: true }); - var mergeOptions = _objectSpread2({ - transition: 300, - closeClickDimmed: true, - closeKeyCode: 27, - styleModal: {}, - styleModalContent: {} - }, props.options); - - var transition = mergeOptions.transition ? mergeOptions.transition / 1000 + 's' : false; - - function emitClose() { - show.value = false; - } - - function emitAfterLeave() { - context.emit('after-leave'); - props.close(); - } - - function onClickDimmed() { - if (mergeOptions.closeClickDimmed) { - emitClose(); - } - } - - function closeKeyEvent(event) { - if (event.keyCode === mergeOptions.closeKeyCode && latest.value) { - emitClose(); - } - } // wai-aria - - - var activeElement; - - function setLastActiveElement(event) { - var isModalEvent = event.target.closest(".".concat(CLASS_NAME)); // skip when this not latest modal - - if (!latest.value) return; // set activeElement when fired outside this modal - - if (!isModalEvent || isModalEvent !== modalRef.value) { - // skip when modal status is closing - if (isModalEvent && !isModalEvent.classList.contains("".concat(CLASS_NAME, "-show"))) return; - activeElement = event.target; - } - } - - onMounted(function () { - if (mergeOptions.closeKeyCode) { - document.addEventListener('keyup', closeKeyEvent); - } // wai-aria - + var _useOrder = useOrder({ + modelValue: modelValue, + show: show + }), + latest = _useOrder.latest; - document.addEventListener('click', setLastActiveElement); + var _useClose = useClose({ + close: close, + latest: latest, + options: options + }), + mergeOptions = _useClose.mergeOptions, + onClickDimmed = _useClose.onClickDimmed; - function setFocus(value) { - if (value) { - if (modalRef.value) { - modalRef.value.focus(); - } - } else { - if (activeElement) { - activeElement.focus(); - } + useA11Y({ + latest: latest, + modalRef: modalRef, + show: show + }); + var onTransitionEmit = { + beforeEnter: function beforeEnter() { + return context.emit('before-enter'); + }, + enter: function enter() { + return context.emit('enter'); + }, + afterEnter: function afterEnter() { + return context.emit('after-enter'); + }, + enterCancelled: function enterCancelled() { + return context.emit('enter-cancelled'); + }, + beforeLeave: function beforeLeave() { + return context.emit('before-leave'); + }, + leave: function leave() { + return context.emit('leave'); + }, + afterLeave: function afterLeave() { + context.emit('after-leave'); + + if (modelValue.value === false) { + inserted.value = false; } + }, + leaveCancelled: function leaveCancelled() { + return context.emit('leave-cancelled'); } + }; + /** + * @deprecated + */ - watch(function () { - return show.value; - }, function (value) { - setFocus(value); - }, { - immediate: show.value - }); - }); - onUnmounted(function () { - if (mergeOptions.closeKeyCode) { - document.removeEventListener('keyup', closeKeyEvent); - } // wai-aria - + var emitClose = function emitClose() { + console.warn('emitClose was deprecated.\nhttps://github.com/hoiheart/vue-universal-modal#usage-modal'); + close.value(); + }; - document.removeEventListener('click', setLastActiveElement); - }); return { CLASS_NAME: CLASS_NAME, - teleportTarget: teleportTarget, - modalRef: modalRef, - show: show, - latest: latest, emitClose: emitClose, - emitAfterLeave: emitAfterLeave, - onClickDimmed: onClickDimmed, + inserted: inserted, + latest: latest, mergeOptions: mergeOptions, - transition: transition, - className: props.class + modalRef: modalRef, + onClickDimmed: onClickDimmed, + onTransitionEmit: onTransitionEmit, + show: show, + teleportTarget: teleportTarget, + transition: mergeOptions.transition ? mergeOptions.transition / 1000 + 's' : false }; } }); function render(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createBlock(Teleport, { + return _ctx.inserted ? (openBlock(), createBlock(Teleport, { + key: 0, to: _ctx.teleportTarget, disabled: _ctx.disabled - }, [createVNode(Transition, { - name: _ctx.CLASS_NAME, + }, [createVNode(Transition, mergeProps({ appear: "", - onBeforeEnter: _cache[2] || (_cache[2] = function ($event) { - return _ctx.$emit('before-enter'); - }), - onAfterEnter: _cache[3] || (_cache[3] = function ($event) { - return _ctx.$emit('after-enter'); - }), - onBeforeLeave: _cache[4] || (_cache[4] = function ($event) { - return _ctx.$emit('before-leave'); - }), - onAfterLeave: _ctx.emitAfterLeave - }, { + name: _ctx.CLASS_NAME + }, toHandlers(_ctx.onTransitionEmit)), { default: withCtx(function () { - return [withDirectives(createVNode("div", { - id: _ctx.id, + var _ctx$mergeOptions; + + return [withDirectives(createVNode("div", mergeProps({ ref: "modalRef", - class: [_ctx.CLASS_NAME, _ctx.className, _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-show"), _ctx.show), _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-latest"), _ctx.latest)], - style: _objectSpread2({ - transitionDuration: _ctx.transition - }, _ctx.mergeOptions.styleModal), role: "dialog", + tabindex: "-1", "aria-modal": "true", - "aria-label": !_ctx.ariaLabelledby && 'Modal window', - "aria-labelledby": _ctx.ariaLabelledby, - tabindex: "-1" - }, [createVNode("div", { + "aria-label": "Modal window", + class: [_ctx.CLASS_NAME, _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-show"), _ctx.show), _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-latest"), _ctx.latest)], + style: { + transitionDuration: _ctx.transition + } + }, _ctx.$attrs), [createVNode("div", { class: "".concat(_ctx.CLASS_NAME, "-content"), style: _objectSpread2({ transitionDuration: _ctx.transition - }, _ctx.mergeOptions.styleModalContent), + }, (_ctx$mergeOptions = _ctx.mergeOptions) === null || _ctx$mergeOptions === void 0 ? void 0 : _ctx$mergeOptions.styleModalContent), onClick: _cache[1] || (_cache[1] = withModifiers(function () { return _ctx.onClickDimmed && _ctx.onClickDimmed.apply(_ctx, arguments); }, ["self"])) }, [renderSlot(_ctx.$slots, "default", { emitClose: _ctx.emitClose - })], 6 + }), renderSlot(_ctx.$slots, "close")], 6 /* CLASS, STYLE */ - )], 14 - /* CLASS, STYLE, PROPS */ - , ["id", "aria-label", "aria-labelledby"]), [[vShow, _ctx.show]])]; + )], 16 + /* FULL_PROPS */ + ), [[vShow, _ctx.show]])]; }), _: 3 /* FORWARDED */ - }, 8 + }, 16 + /* FULL_PROPS */ + , ["name"])], 8 /* PROPS */ - , ["name", "onAfterLeave"])], 8 - /* PROPS */ - , ["to", "disabled"]); + , ["to", "disabled"])) : createCommentVNode("v-if", true); } script.render = render; @@ -1109,47 +1185,50 @@ script.__file = "src/Modal.vue"; var PLUGIN_NAME = 'VueUniversalModal'; var CLASS_NAME = 'vue-universal-modal'; -var index = { - install: function install(app) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var _options$teleportTarg = options.teleportTarget, - teleportTarget = _options$teleportTarg === void 0 ? '' : _options$teleportTarg, - _options$teleportComp = options.teleportComponent, - teleportComponent = _options$teleportComp === void 0 ? '' : _options$teleportComp, - _options$teleportComp2 = options.teleportComponentId, - teleportComponentId = _options$teleportComp2 === void 0 ? '' : _options$teleportComp2, - _options$modalCompone = options.modalComponent, - modalComponent = _options$modalCompone === void 0 ? 'Modal' : _options$modalCompone; - - if (!teleportTarget) { - return console.error('teleportTarget is required.'); - } - if (teleportComponent || teleportComponentId) { - return console.error('teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)'); - } +var install = function install(app) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var _options$teleportTarg = options.teleportTarget, + teleportTarget = _options$teleportTarg === void 0 ? '' : _options$teleportTarg, + _options$teleportComp = options.teleportComponent, + teleportComponent = _options$teleportComp === void 0 ? '' : _options$teleportComp, + _options$teleportComp2 = options.teleportComponentId, + teleportComponentId = _options$teleportComp2 === void 0 ? '' : _options$teleportComp2, + _options$modalCompone = options.modalComponent, + modalComponent = _options$modalCompone === void 0 ? 'Modal' : _options$modalCompone; + + if (!teleportTarget) { + return console.error('teleportTarget is required.'); + } - var visibleModals = ref([]); + if (teleportComponent || teleportComponentId) { + return console.error('teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)'); + } - var addVisibleModals = function addVisibleModals(id) { - visibleModals.value = [].concat(_toConsumableArray(visibleModals.value), [id]); - }; + var visibleModals = ref([]); - var removeVisibleModals = function removeVisibleModals(id) { - var modals = _toConsumableArray(visibleModals.value); + var addVisibleModals = function addVisibleModals(id) { + visibleModals.value = [].concat(_toConsumableArray(visibleModals.value), [id]); + }; - modals.splice(visibleModals.value.indexOf(id), 1); - visibleModals.value = _toConsumableArray(modals); - }; + var removeVisibleModals = function removeVisibleModals(id) { + var modals = _toConsumableArray(visibleModals.value); - app.provide(PLUGIN_NAME, { - teleportTarget: teleportTarget, - visibleModals: readonly(visibleModals), - addVisibleModals: addVisibleModals, - removeVisibleModals: removeVisibleModals - }); - app.component(modalComponent, script); - } + modals.splice(visibleModals.value.indexOf(id), 1); + visibleModals.value = _toConsumableArray(modals); + }; + + app.provide(PLUGIN_NAME, { + teleportTarget: teleportTarget, + visibleModals: readonly(visibleModals), + addVisibleModals: addVisibleModals, + removeVisibleModals: removeVisibleModals + }); + app.component(modalComponent, script); +}; + +var index = { + install: install }; export default index; diff --git a/dist/index.js b/dist/index.js index 7bb6511..d8ccc67 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,202 +1,238 @@ -import { defineComponent, inject, getCurrentInstance, ref, computed, watch, onMounted, onUnmounted, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, withModifiers, renderSlot, vShow, readonly } from 'vue'; +import { inject, getCurrentInstance, computed, watch, onMounted, onUnmounted, nextTick, defineComponent, toRefs, ref, openBlock, createBlock, Teleport, createVNode, Transition, mergeProps, toHandlers, withCtx, withDirectives, withModifiers, renderSlot, vShow, createCommentVNode, readonly } from 'vue'; + +const useOrder = ({ modelValue, show }) => { + const { visibleModals, addVisibleModals, removeVisibleModals } = inject(PLUGIN_NAME); + const { uid } = getCurrentInstance() || {}; + const latest = computed(() => { + if (!uid || !visibleModals.value.length) + return false; + return uid === visibleModals.value[visibleModals.value.length - 1]; + }); + watch([ + () => modelValue.value, + () => show.value + ], () => { + if (!uid) { + return; + } + const isShow = modelValue.value && show.value; + if (isShow && visibleModals.value.indexOf(uid) < 0) { + addVisibleModals(uid); + } + if (!isShow && visibleModals.value.indexOf(uid) > -1) { + removeVisibleModals(uid); + } + }, { immediate: true }); + return { + latest + }; +}; +const useClose = ({ close, options, latest }) => { + const mergeOptions = { + transition: 300, + closeClickDimmed: true, + closeKeyCode: 27, + styleModalContent: {}, + ...options.value + }; + function onClickDimmed() { + if (mergeOptions.closeClickDimmed) { + close.value(); + } + } + function closeKeyEvent(event) { + if (event.keyCode === mergeOptions.closeKeyCode && latest.value) { + close.value(); + } + } + onMounted(() => { + if (mergeOptions.closeKeyCode) { + document.addEventListener('keyup', closeKeyEvent); + } + }); + onUnmounted(() => { + if (mergeOptions.closeKeyCode) { + document.removeEventListener('keyup', closeKeyEvent); + } + }); + return { + mergeOptions, + onClickDimmed + }; +}; +const useA11Y = ({ modalRef, latest, show }) => { + let activeElement; + function setLastActiveElement(event) { + const isModalEvent = event.target.closest(`.${CLASS_NAME}`); + // skip when this not latest modal + if (!latest.value) + return; + // set activeElement when fired outside this modal + if (!isModalEvent || (isModalEvent !== modalRef.value)) { + // skip when modal status is closing + if (isModalEvent && !isModalEvent.classList.contains(`${CLASS_NAME}-show`)) + return; + activeElement = event.target; + } + } + onMounted(() => { + document.addEventListener('click', setLastActiveElement); + function setFocus(value) { + if (value) { + if (modalRef.value) { + modalRef.value.focus(); + } + } + else { + if (activeElement) { + activeElement.focus(); + } + } + } + watch(() => show.value, (value) => { + nextTick(() => setFocus(value)); + }, { immediate: show.value }); + }); + onUnmounted(() => { + document.removeEventListener('click', setLastActiveElement); + }); +}; var script = defineComponent({ + inheritAttrs: false, props: { close: { type: Function, - required: true, default: () => { return undefined; } }, - options: { - type: Object, - default: () => { - return {}; - } - }, disabled: { type: Boolean, default: false }, - id: { - type: String, - default: '' - }, - class: { - type: String, - default: '' + modelValue: { + type: Boolean, + default: true }, - ariaLabelledby: { - type: String, - default: '' + options: { + type: Object, + default: () => { + return {}; + } } }, emits: [ 'before-enter', + 'enter', 'after-enter', + 'enter-cancelled', 'before-leave', - 'after-leave' + 'leave', + 'after-leave', + 'leave-cancelled' ], setup(props, context) { - const { teleportTarget, visibleModals, addVisibleModals, removeVisibleModals } = inject(PLUGIN_NAME); - const { uid } = getCurrentInstance() || {}; - const modalRef = ref(); - const show = ref(); - const latest = computed(() => { - if (!uid || !visibleModals.value.length) - return false; - return uid === visibleModals.value[visibleModals.value.length - 1]; - }); - watch(() => props.disabled, () => { - show.value = !props.disabled; - }, { immediate: true }); - watch(() => show.value, (value) => { - if (!uid) - return; - if (value && visibleModals.value.indexOf(uid) < 0) { - addVisibleModals(uid); - } - if (!value && visibleModals.value.indexOf(uid) > -1) { - removeVisibleModals(uid); + const { teleportTarget } = inject(PLUGIN_NAME); + const { close, disabled, options, modelValue } = toRefs(props); + const inserted = ref(modelValue.value === undefined ? true : modelValue.value); + const modalRef = ref(null); + const show = ref(!disabled.value); + watch([ + () => modelValue.value, + () => disabled.value + ], () => { + const isShow = modelValue.value && !disabled.value; + show.value = isShow; + if (modelValue.value) { + inserted.value = modelValue.value; } }, { immediate: true }); - const mergeOptions = { - transition: 300, - closeClickDimmed: true, - closeKeyCode: 27, - styleModal: {}, - styleModalContent: {}, - ...props.options - }; - const transition = mergeOptions.transition ? mergeOptions.transition / 1000 + 's' : false; - function emitClose() { - show.value = false; - } - function emitAfterLeave() { - context.emit('after-leave'); - props.close(); - } - function onClickDimmed() { - if (mergeOptions.closeClickDimmed) { - emitClose(); - } - } - function closeKeyEvent(event) { - if (event.keyCode === mergeOptions.closeKeyCode && latest.value) { - emitClose(); - } - } - // wai-aria - let activeElement; - function setLastActiveElement(event) { - const isModalEvent = event.target.closest(`.${CLASS_NAME}`); - // skip when this not latest modal - if (!latest.value) - return; - // set activeElement when fired outside this modal - if (!isModalEvent || (isModalEvent !== modalRef.value)) { - // skip when modal status is closing - if (isModalEvent && !isModalEvent.classList.contains(`${CLASS_NAME}-show`)) - return; - activeElement = event.target; - } - } - onMounted(() => { - if (mergeOptions.closeKeyCode) { - document.addEventListener('keyup', closeKeyEvent); - } - // wai-aria - document.addEventListener('click', setLastActiveElement); - function setFocus(value) { - if (value) { - if (modalRef.value) { - modalRef.value.focus(); - } + const { latest } = useOrder({ modelValue, show }); + const { mergeOptions, onClickDimmed } = useClose({ close, latest, options }); + useA11Y({ latest, modalRef, show }); + const onTransitionEmit = { + beforeEnter: () => context.emit('before-enter'), + enter: () => context.emit('enter'), + afterEnter: () => context.emit('after-enter'), + enterCancelled: () => context.emit('enter-cancelled'), + beforeLeave: () => context.emit('before-leave'), + leave: () => context.emit('leave'), + afterLeave: () => { + context.emit('after-leave'); + if (modelValue.value === false) { + inserted.value = false; } - else { - if (activeElement) { - activeElement.focus(); - } - } - } - watch(() => show.value, (value) => { - setFocus(value); - }, { immediate: show.value }); - }); - onUnmounted(() => { - if (mergeOptions.closeKeyCode) { - document.removeEventListener('keyup', closeKeyEvent); - } - // wai-aria - document.removeEventListener('click', setLastActiveElement); - }); + }, + leaveCancelled: () => context.emit('leave-cancelled') + }; + /** + * @deprecated + */ + const emitClose = () => { + console.warn('emitClose was deprecated.\nhttps://github.com/hoiheart/vue-universal-modal#usage-modal'); + close.value(); + }; return { CLASS_NAME, - teleportTarget, - modalRef, - show, - latest, emitClose, - emitAfterLeave, - onClickDimmed, + inserted, + latest, mergeOptions, - transition, - className: props.class + modalRef, + onClickDimmed, + onTransitionEmit, + show, + teleportTarget, + transition: mergeOptions.transition ? mergeOptions.transition / 1000 + 's' : false }; } }); function render(_ctx, _cache, $props, $setup, $data, $options) { - return (openBlock(), createBlock(Teleport, { - to: _ctx.teleportTarget, - disabled: _ctx.disabled - }, [ - createVNode(Transition, { - name: _ctx.CLASS_NAME, - appear: "", - onBeforeEnter: _cache[2] || (_cache[2] = $event => (_ctx.$emit('before-enter'))), - onAfterEnter: _cache[3] || (_cache[3] = $event => (_ctx.$emit('after-enter'))), - onBeforeLeave: _cache[4] || (_cache[4] = $event => (_ctx.$emit('before-leave'))), - onAfterLeave: _ctx.emitAfterLeave - }, { - default: withCtx(() => [ - withDirectives(createVNode("div", { - id: _ctx.id, - ref: "modalRef", - class: [ + return (_ctx.inserted) + ? (openBlock(), createBlock(Teleport, { + key: 0, + to: _ctx.teleportTarget, + disabled: _ctx.disabled + }, [ + createVNode(Transition, mergeProps({ + appear: "", + name: _ctx.CLASS_NAME + }, toHandlers(_ctx.onTransitionEmit)), { + default: withCtx(() => [ + withDirectives(createVNode("div", mergeProps({ + ref: "modalRef", + role: "dialog", + tabindex: "-1", + "aria-modal": "true", + "aria-label": "Modal window", + class: [ _ctx.CLASS_NAME, - _ctx.className, { [`${_ctx.CLASS_NAME}-show`]: _ctx.show }, { [`${_ctx.CLASS_NAME}-latest`]: _ctx.latest }, ], - style: { - transitionDuration: _ctx.transition, - ..._ctx.mergeOptions.styleModal - }, - role: "dialog", - "aria-modal": "true", - "aria-label": !_ctx.ariaLabelledby && 'Modal window', - "aria-labelledby": _ctx.ariaLabelledby, - tabindex: "-1" - }, [ - createVNode("div", { - class: `${_ctx.CLASS_NAME}-content`, - style: { + style: { transitionDuration: _ctx.transition } + }, _ctx.$attrs), [ + createVNode("div", { + class: `${_ctx.CLASS_NAME}-content`, + style: { transitionDuration: _ctx.transition, - ..._ctx.mergeOptions.styleModalContent + ..._ctx.mergeOptions?.styleModalContent }, - onClick: _cache[1] || (_cache[1] = withModifiers((...args) => (_ctx.onClickDimmed && _ctx.onClickDimmed(...args)), ["self"])) - }, [ - renderSlot(_ctx.$slots, "default", { emitClose: _ctx.emitClose }) - ], 6 /* CLASS, STYLE */) - ], 14 /* CLASS, STYLE, PROPS */, ["id", "aria-label", "aria-labelledby"]), [ - [vShow, _ctx.show] - ]) - ]), - _: 3 /* FORWARDED */ - }, 8 /* PROPS */, ["name", "onAfterLeave"]) - ], 8 /* PROPS */, ["to", "disabled"])) + onClick: _cache[1] || (_cache[1] = withModifiers((...args) => (_ctx.onClickDimmed && _ctx.onClickDimmed(...args)), ["self"])) + }, [ + renderSlot(_ctx.$slots, "default", { emitClose: _ctx.emitClose }), + renderSlot(_ctx.$slots, "close") + ], 6 /* CLASS, STYLE */) + ], 16 /* FULL_PROPS */), [ + [vShow, _ctx.show] + ]) + ]), + _: 3 /* FORWARDED */ + }, 16 /* FULL_PROPS */, ["name"]) + ], 8 /* PROPS */, ["to", "disabled"])) + : createCommentVNode("v-if", true) } script.render = render; @@ -204,32 +240,33 @@ script.__file = "src/Modal.vue"; const PLUGIN_NAME = 'VueUniversalModal'; const CLASS_NAME = 'vue-universal-modal'; -var index = { - install: (app, options = {}) => { - const { teleportTarget = '', teleportComponent = '', teleportComponentId = '', modalComponent = 'Modal' } = options; - if (!teleportTarget) { - return console.error('teleportTarget is required.'); - } - if (teleportComponent || teleportComponentId) { - return console.error('teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)'); - } - const visibleModals = ref([]); - const addVisibleModals = (id) => { - visibleModals.value = [...visibleModals.value, id]; - }; - const removeVisibleModals = (id) => { - const modals = [...visibleModals.value]; - modals.splice(visibleModals.value.indexOf(id), 1); - visibleModals.value = [...modals]; - }; - app.provide(PLUGIN_NAME, { - teleportTarget, - visibleModals: readonly(visibleModals), - addVisibleModals, - removeVisibleModals - }); - app.component(modalComponent, script); +const install = (app, options = {}) => { + const { teleportTarget = '', teleportComponent = '', teleportComponentId = '', modalComponent = 'Modal' } = options; + if (!teleportTarget) { + return console.error('teleportTarget is required.'); } + if (teleportComponent || teleportComponentId) { + return console.error('teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)'); + } + const visibleModals = ref([]); + const addVisibleModals = (id) => { + visibleModals.value = [...visibleModals.value, id]; + }; + const removeVisibleModals = (id) => { + const modals = [...visibleModals.value]; + modals.splice(visibleModals.value.indexOf(id), 1); + visibleModals.value = [...modals]; + }; + app.provide(PLUGIN_NAME, { + teleportTarget, + visibleModals: readonly(visibleModals), + addVisibleModals, + removeVisibleModals + }); + app.component(modalComponent, script); +}; +var index = { + install }; export default index; diff --git a/dist/index.runtime.js b/dist/index.runtime.js index 2e03a67..26a6c7a 100644 --- a/dist/index.runtime.js +++ b/dist/index.runtime.js @@ -48,20 +48,20 @@ }); var nativePropertyIsEnumerable = {}.propertyIsEnumerable; - var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable - var f = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = getOwnPropertyDescriptor(this, V); + var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$1(this, V); return !!descriptor && descriptor.enumerable; } : nativePropertyIsEnumerable; var objectPropertyIsEnumerable = { - f: f + f: f$4 }; var createPropertyDescriptor = function (bitmap, value) { @@ -124,7 +124,7 @@ var hasOwnProperty = {}.hasOwnProperty; - var has = function (it, key) { + var has$1 = function (it, key) { return hasOwnProperty.call(it, key); }; @@ -147,17 +147,17 @@ // `Object.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor - var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (ie8DomDefine) try { return nativeGetOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } - if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); + if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); }; var objectGetOwnPropertyDescriptor = { - f: f$1 + f: f$3 }; var anObject = function (it) { @@ -202,9 +202,9 @@ }; var SHARED = '__core-js_shared__'; - var store = global_1[SHARED] || setGlobal(SHARED, {}); + var store$1 = global_1[SHARED] || setGlobal(SHARED, {}); - var sharedStore = store; + var sharedStore = store$1; var functionToString = Function.toString; @@ -217,16 +217,16 @@ var inspectSource = sharedStore.inspectSource; - var WeakMap = global_1.WeakMap; + var WeakMap$1 = global_1.WeakMap; - var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); + var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1)); var shared = createCommonjsModule(function (module) { (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.8.0', - mode: 'global', + mode: 'global', copyright: '© 2020 Denis Pushkarev (zloirock.ru)' }); }); @@ -244,13 +244,13 @@ return keys[key] || (keys[key] = uid(key)); }; - var hiddenKeys = {}; + var hiddenKeys$1 = {}; - var WeakMap$1 = global_1.WeakMap; - var set, get, has$1; + var WeakMap = global_1.WeakMap; + var set, get, has; var enforce = function (it) { - return has$1(it) ? get(it) : set(it, {}); + return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { @@ -263,41 +263,41 @@ }; if (nativeWeakMap) { - var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$1()); - var wmget = store$1.get; - var wmhas = store$1.has; - var wmset = store$1.set; + var store = sharedStore.state || (sharedStore.state = new WeakMap()); + var wmget = store.get; + var wmhas = store.has; + var wmset = store.set; set = function (it, metadata) { metadata.facade = it; - wmset.call(store$1, it, metadata); + wmset.call(store, it, metadata); return metadata; }; get = function (it) { - return wmget.call(store$1, it) || {}; + return wmget.call(store, it) || {}; }; - has$1 = function (it) { - return wmhas.call(store$1, it); + has = function (it) { + return wmhas.call(store, it); }; } else { var STATE = sharedKey('state'); - hiddenKeys[STATE] = true; + hiddenKeys$1[STATE] = true; set = function (it, metadata) { metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { - return has(it, STATE) ? it[STATE] : {}; + return has$1(it, STATE) ? it[STATE] : {}; }; - has$1 = function (it) { - return has(it, STATE); + has = function (it) { + return has$1(it, STATE); }; } var internalState = { set: set, get: get, - has: has$1, + has: has, enforce: enforce, getterFor: getterFor }; @@ -313,7 +313,7 @@ var noTargetGet = options ? !!options.noTargetGet : false; var state; if (typeof value == 'function') { - if (typeof key == 'string' && !has(value, 'name')) { + if (typeof key == 'string' && !has$1(value, 'name')) { createNonEnumerableProperty(value, 'name', key); } state = enforceInternalState(value); @@ -358,15 +358,15 @@ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; - var min = Math.min; + var min$2 = Math.min; // `ToLength` abstract operation // https://tc39.github.io/ecma262/#sec-tolength var toLength = function (argument) { - return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + return argument > 0 ? min$2(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; - var max = Math.max; + var max$1 = Math.max; var min$1 = Math.min; // Helper for a popular repeating case of the spec: @@ -374,7 +374,7 @@ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). var toAbsoluteIndex = function (index, length) { var integer = toInteger(index); - return integer < 0 ? max(integer + length, 0) : min$1(integer, length); + return integer < 0 ? max$1(integer + length, 0) : min$1(integer, length); }; // `Array.prototype.{ indexOf, includes }` methods implementation @@ -414,9 +414,9 @@ var i = 0; var result = []; var key; - for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); + for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key); // Don't enum bug & hidden keys - while (names.length > i) if (has(O, key = names[i++])) { + while (names.length > i) if (has$1(O, key = names[i++])) { ~indexOf(result, key) || result.push(key); } return result; @@ -433,38 +433,38 @@ 'valueOf' ]; - var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); + var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.github.io/ecma262/#sec-object.getownpropertynames - var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return objectKeysInternal(O, hiddenKeys$1); + var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return objectKeysInternal(O, hiddenKeys); }; var objectGetOwnPropertyNames = { - f: f$3 + f: f$1 }; - var f$4 = Object.getOwnPropertySymbols; + var f = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { - f: f$4 + f: f }; // all object keys, includes non-enumerable and symbols - var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { + var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = objectGetOwnPropertyNames.f(anObject(it)); var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; var copyConstructorProperties = function (target, source) { - var keys = ownKeys(source); + var keys = ownKeys$1(source); var defineProperty = objectDefineProperty.f; var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; - if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; @@ -488,7 +488,7 @@ var isForced_1 = isForced; - var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; @@ -524,7 +524,7 @@ if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { - descriptor = getOwnPropertyDescriptor$1(target, key); + descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); @@ -577,13 +577,13 @@ var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; var wellKnownSymbol = function (name) { - if (!has(WellKnownSymbolsStore, name)) { - if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name]; + if (!has$1(WellKnownSymbolsStore, name)) { + if (nativeSymbol && has$1(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name]; else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; - var SPECIES = wellKnownSymbol('species'); + var SPECIES$1 = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation // https://tc39.github.io/ecma262/#sec-arrayspeciescreate @@ -594,7 +594,7 @@ // cross-realm fallback if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) { - C = C[SPECIES]; + C = C[SPECIES$1]; if (C === null) C = undefined; } } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); @@ -620,7 +620,7 @@ var engineV8Version = version && +version; - var SPECIES$1 = wellKnownSymbol('species'); + var SPECIES = wellKnownSymbol('species'); var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes @@ -629,7 +629,7 @@ return engineV8Version >= 51 || !fails(function () { var array = []; var constructor = array.constructor = {}; - constructor[SPECIES$1] = function () { + constructor[SPECIES] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; @@ -637,7 +637,7 @@ }; var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); - var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; + var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes @@ -672,10 +672,10 @@ E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = toLength(E.length); - if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); } else { - if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); createProperty(A, n++, E); } } @@ -698,12 +698,12 @@ var thrower = function (it) { throw it; }; var arrayMethodUsesToLength = function (METHOD_NAME, options) { - if (has(cache, METHOD_NAME)) return cache[METHOD_NAME]; + if (has$1(cache, METHOD_NAME)) return cache[METHOD_NAME]; if (!options) options = {}; var method = [][METHOD_NAME]; - var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false; - var argument0 = has(options, 0) ? options[0] : thrower; - var argument1 = has(options, 1) ? options[1] : undefined; + var ACCESSORS = has$1(options, 'ACCESSORS') ? options.ACCESSORS : false; + var argument0 = has$1(options, 0) ? options[0] : thrower; + var argument1 = has$1(options, 1) ? options[1] : undefined; return cache[METHOD_NAME] = !!method && !fails(function () { if (ACCESSORS && !descriptors) return true; @@ -724,11 +724,11 @@ var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; var STRICT_METHOD = arrayMethodIsStrict('indexOf'); - var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); + var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof - _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, { + _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH$1 }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { return NEGATIVE_ZERO // convert -0 to +0 @@ -738,17 +738,17 @@ }); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); - var USES_TO_LENGTH$1 = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 }); + var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 }); - var max$1 = Math.max; - var min$2 = Math.min; - var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; + var max = Math.max; + var min = Math.min; + var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method // https://tc39.github.io/ecma262/#sec-array.prototype.splice // with adding support of @@species - _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$1 }, { + _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, { splice: function splice(start, deleteCount /* , ...items */) { var O = toObject(this); var len = toLength(O.length); @@ -762,9 +762,9 @@ actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; - actualDeleteCount = min$2(max$1(toInteger(deleteCount), 0), len - actualStart); + actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart); } - if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { + if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); } A = arraySpeciesCreate(O, actualDeleteCount); @@ -847,7 +847,7 @@ return obj; } - function ownKeys$1(object, enumerableOnly) { + function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { @@ -866,13 +866,13 @@ var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { - ownKeys$1(Object(source), true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys$1(Object(source)).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } @@ -881,231 +881,307 @@ return target; } + var useOrder = function useOrder(_ref) { + var modelValue = _ref.modelValue, + show = _ref.show; + + var _inject = vue.inject(PLUGIN_NAME), + visibleModals = _inject.visibleModals, + addVisibleModals = _inject.addVisibleModals, + removeVisibleModals = _inject.removeVisibleModals; + + var _ref2 = vue.getCurrentInstance() || {}, + uid = _ref2.uid; + + var latest = vue.computed(function () { + if (!uid || !visibleModals.value.length) return false; + return uid === visibleModals.value[visibleModals.value.length - 1]; + }); + vue.watch([function () { + return modelValue.value; + }, function () { + return show.value; + }], function () { + if (!uid) { + return; + } + + var isShow = modelValue.value && show.value; + + if (isShow && visibleModals.value.indexOf(uid) < 0) { + addVisibleModals(uid); + } + + if (!isShow && visibleModals.value.indexOf(uid) > -1) { + removeVisibleModals(uid); + } + }, { + immediate: true + }); + return { + latest: latest + }; + }; + var useClose = function useClose(_ref3) { + var close = _ref3.close, + options = _ref3.options, + latest = _ref3.latest; + + var mergeOptions = _objectSpread2({ + transition: 300, + closeClickDimmed: true, + closeKeyCode: 27, + styleModalContent: {} + }, options.value); + + function onClickDimmed() { + if (mergeOptions.closeClickDimmed) { + close.value(); + } + } + + function closeKeyEvent(event) { + if (event.keyCode === mergeOptions.closeKeyCode && latest.value) { + close.value(); + } + } + + vue.onMounted(function () { + if (mergeOptions.closeKeyCode) { + document.addEventListener('keyup', closeKeyEvent); + } + }); + vue.onUnmounted(function () { + if (mergeOptions.closeKeyCode) { + document.removeEventListener('keyup', closeKeyEvent); + } + }); + return { + mergeOptions: mergeOptions, + onClickDimmed: onClickDimmed + }; + }; + var useA11Y = function useA11Y(_ref4) { + var modalRef = _ref4.modalRef, + latest = _ref4.latest, + show = _ref4.show; + var activeElement; + + function setLastActiveElement(event) { + var isModalEvent = event.target.closest(".".concat(CLASS_NAME)); // skip when this not latest modal + + if (!latest.value) return; // set activeElement when fired outside this modal + + if (!isModalEvent || isModalEvent !== modalRef.value) { + // skip when modal status is closing + if (isModalEvent && !isModalEvent.classList.contains("".concat(CLASS_NAME, "-show"))) return; + activeElement = event.target; + } + } + + vue.onMounted(function () { + document.addEventListener('click', setLastActiveElement); + + function setFocus(value) { + if (value) { + if (modalRef.value) { + modalRef.value.focus(); + } + } else { + if (activeElement) { + activeElement.focus(); + } + } + } + + vue.watch(function () { + return show.value; + }, function (value) { + vue.nextTick(function () { + return setFocus(value); + }); + }, { + immediate: show.value + }); + }); + vue.onUnmounted(function () { + document.removeEventListener('click', setLastActiveElement); + }); + }; + var script = vue.defineComponent({ + inheritAttrs: false, props: { close: { type: Function, - required: true, default: function _default() { return undefined; } }, - options: { - type: Object, - default: function _default() { - return {}; - } - }, disabled: { type: Boolean, default: false }, - id: { - type: String, - default: '' - }, - class: { - type: String, - default: '' + modelValue: { + type: Boolean, + default: true }, - ariaLabelledby: { - type: String, - default: '' + options: { + type: Object, + default: function _default() { + return {}; + } } }, - emits: ['before-enter', 'after-enter', 'before-leave', 'after-leave'], + emits: ['before-enter', 'enter', 'after-enter', 'enter-cancelled', 'before-leave', 'leave', 'after-leave', 'leave-cancelled'], setup: function setup(props, context) { var _inject = vue.inject(PLUGIN_NAME), - teleportTarget = _inject.teleportTarget, - visibleModals = _inject.visibleModals, - addVisibleModals = _inject.addVisibleModals, - removeVisibleModals = _inject.removeVisibleModals; - - var _ref = vue.getCurrentInstance() || {}, - uid = _ref.uid; - - var modalRef = vue.ref(); - var show = vue.ref(); - var latest = vue.computed(function () { - if (!uid || !visibleModals.value.length) return false; - return uid === visibleModals.value[visibleModals.value.length - 1]; - }); - vue.watch(function () { - return props.disabled; + teleportTarget = _inject.teleportTarget; + + var _toRefs = vue.toRefs(props), + close = _toRefs.close, + disabled = _toRefs.disabled, + options = _toRefs.options, + modelValue = _toRefs.modelValue; + + var inserted = vue.ref(modelValue.value === undefined ? true : modelValue.value); + var modalRef = vue.ref(null); + var show = vue.ref(!disabled.value); + vue.watch([function () { + return modelValue.value; }, function () { - show.value = !props.disabled; - }, { - immediate: true - }); - vue.watch(function () { - return show.value; - }, function (value) { - if (!uid) return; - - if (value && visibleModals.value.indexOf(uid) < 0) { - addVisibleModals(uid); - } + return disabled.value; + }], function () { + var isShow = modelValue.value && !disabled.value; + show.value = isShow; - if (!value && visibleModals.value.indexOf(uid) > -1) { - removeVisibleModals(uid); + if (modelValue.value) { + inserted.value = modelValue.value; } }, { immediate: true }); - var mergeOptions = _objectSpread2({ - transition: 300, - closeClickDimmed: true, - closeKeyCode: 27, - styleModal: {}, - styleModalContent: {} - }, props.options); - - var transition = mergeOptions.transition ? mergeOptions.transition / 1000 + 's' : false; - - function emitClose() { - show.value = false; - } - - function emitAfterLeave() { - context.emit('after-leave'); - props.close(); - } - - function onClickDimmed() { - if (mergeOptions.closeClickDimmed) { - emitClose(); - } - } - - function closeKeyEvent(event) { - if (event.keyCode === mergeOptions.closeKeyCode && latest.value) { - emitClose(); - } - } // wai-aria - - - var activeElement; - - function setLastActiveElement(event) { - var isModalEvent = event.target.closest(".".concat(CLASS_NAME)); // skip when this not latest modal - - if (!latest.value) return; // set activeElement when fired outside this modal - - if (!isModalEvent || isModalEvent !== modalRef.value) { - // skip when modal status is closing - if (isModalEvent && !isModalEvent.classList.contains("".concat(CLASS_NAME, "-show"))) return; - activeElement = event.target; - } - } - - vue.onMounted(function () { - if (mergeOptions.closeKeyCode) { - document.addEventListener('keyup', closeKeyEvent); - } // wai-aria - + var _useOrder = useOrder({ + modelValue: modelValue, + show: show + }), + latest = _useOrder.latest; - document.addEventListener('click', setLastActiveElement); + var _useClose = useClose({ + close: close, + latest: latest, + options: options + }), + mergeOptions = _useClose.mergeOptions, + onClickDimmed = _useClose.onClickDimmed; - function setFocus(value) { - if (value) { - if (modalRef.value) { - modalRef.value.focus(); - } - } else { - if (activeElement) { - activeElement.focus(); - } + useA11Y({ + latest: latest, + modalRef: modalRef, + show: show + }); + var onTransitionEmit = { + beforeEnter: function beforeEnter() { + return context.emit('before-enter'); + }, + enter: function enter() { + return context.emit('enter'); + }, + afterEnter: function afterEnter() { + return context.emit('after-enter'); + }, + enterCancelled: function enterCancelled() { + return context.emit('enter-cancelled'); + }, + beforeLeave: function beforeLeave() { + return context.emit('before-leave'); + }, + leave: function leave() { + return context.emit('leave'); + }, + afterLeave: function afterLeave() { + context.emit('after-leave'); + + if (modelValue.value === false) { + inserted.value = false; } + }, + leaveCancelled: function leaveCancelled() { + return context.emit('leave-cancelled'); } + }; + /** + * @deprecated + */ - vue.watch(function () { - return show.value; - }, function (value) { - setFocus(value); - }, { - immediate: show.value - }); - }); - vue.onUnmounted(function () { - if (mergeOptions.closeKeyCode) { - document.removeEventListener('keyup', closeKeyEvent); - } // wai-aria - + var emitClose = function emitClose() { + console.warn('emitClose was deprecated.\nhttps://github.com/hoiheart/vue-universal-modal#usage-modal'); + close.value(); + }; - document.removeEventListener('click', setLastActiveElement); - }); return { CLASS_NAME: CLASS_NAME, - teleportTarget: teleportTarget, - modalRef: modalRef, - show: show, - latest: latest, emitClose: emitClose, - emitAfterLeave: emitAfterLeave, - onClickDimmed: onClickDimmed, + inserted: inserted, + latest: latest, mergeOptions: mergeOptions, - transition: transition, - className: props.class + modalRef: modalRef, + onClickDimmed: onClickDimmed, + onTransitionEmit: onTransitionEmit, + show: show, + teleportTarget: teleportTarget, + transition: mergeOptions.transition ? mergeOptions.transition / 1000 + 's' : false }; } }); function render(_ctx, _cache, $props, $setup, $data, $options) { - return vue.openBlock(), vue.createBlock(vue.Teleport, { + return _ctx.inserted ? (vue.openBlock(), vue.createBlock(vue.Teleport, { + key: 0, to: _ctx.teleportTarget, disabled: _ctx.disabled - }, [vue.createVNode(vue.Transition, { - name: _ctx.CLASS_NAME, + }, [vue.createVNode(vue.Transition, vue.mergeProps({ appear: "", - onBeforeEnter: _cache[2] || (_cache[2] = function ($event) { - return _ctx.$emit('before-enter'); - }), - onAfterEnter: _cache[3] || (_cache[3] = function ($event) { - return _ctx.$emit('after-enter'); - }), - onBeforeLeave: _cache[4] || (_cache[4] = function ($event) { - return _ctx.$emit('before-leave'); - }), - onAfterLeave: _ctx.emitAfterLeave - }, { + name: _ctx.CLASS_NAME + }, vue.toHandlers(_ctx.onTransitionEmit)), { default: vue.withCtx(function () { - return [vue.withDirectives(vue.createVNode("div", { - id: _ctx.id, + var _ctx$mergeOptions; + + return [vue.withDirectives(vue.createVNode("div", vue.mergeProps({ ref: "modalRef", - class: [_ctx.CLASS_NAME, _ctx.className, _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-show"), _ctx.show), _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-latest"), _ctx.latest)], - style: _objectSpread2({ - transitionDuration: _ctx.transition - }, _ctx.mergeOptions.styleModal), role: "dialog", + tabindex: "-1", "aria-modal": "true", - "aria-label": !_ctx.ariaLabelledby && 'Modal window', - "aria-labelledby": _ctx.ariaLabelledby, - tabindex: "-1" - }, [vue.createVNode("div", { + "aria-label": "Modal window", + class: [_ctx.CLASS_NAME, _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-show"), _ctx.show), _defineProperty({}, "".concat(_ctx.CLASS_NAME, "-latest"), _ctx.latest)], + style: { + transitionDuration: _ctx.transition + } + }, _ctx.$attrs), [vue.createVNode("div", { class: "".concat(_ctx.CLASS_NAME, "-content"), style: _objectSpread2({ transitionDuration: _ctx.transition - }, _ctx.mergeOptions.styleModalContent), + }, (_ctx$mergeOptions = _ctx.mergeOptions) === null || _ctx$mergeOptions === void 0 ? void 0 : _ctx$mergeOptions.styleModalContent), onClick: _cache[1] || (_cache[1] = vue.withModifiers(function () { return _ctx.onClickDimmed && _ctx.onClickDimmed.apply(_ctx, arguments); }, ["self"])) }, [vue.renderSlot(_ctx.$slots, "default", { emitClose: _ctx.emitClose - })], 6 + }), vue.renderSlot(_ctx.$slots, "close")], 6 /* CLASS, STYLE */ - )], 14 - /* CLASS, STYLE, PROPS */ - , ["id", "aria-label", "aria-labelledby"]), [[vue.vShow, _ctx.show]])]; + )], 16 + /* FULL_PROPS */ + ), [[vue.vShow, _ctx.show]])]; }), _: 3 /* FORWARDED */ - }, 8 + }, 16 + /* FULL_PROPS */ + , ["name"])], 8 /* PROPS */ - , ["name", "onAfterLeave"])], 8 - /* PROPS */ - , ["to", "disabled"]); + , ["to", "disabled"])) : vue.createCommentVNode("v-if", true); } script.render = render; @@ -1113,47 +1189,50 @@ var PLUGIN_NAME = 'VueUniversalModal'; var CLASS_NAME = 'vue-universal-modal'; - var VueUniversalModal = { - install: function install(app) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var _options$teleportTarg = options.teleportTarget, - teleportTarget = _options$teleportTarg === void 0 ? '' : _options$teleportTarg, - _options$teleportComp = options.teleportComponent, - teleportComponent = _options$teleportComp === void 0 ? '' : _options$teleportComp, - _options$teleportComp2 = options.teleportComponentId, - teleportComponentId = _options$teleportComp2 === void 0 ? '' : _options$teleportComp2, - _options$modalCompone = options.modalComponent, - modalComponent = _options$modalCompone === void 0 ? 'Modal' : _options$modalCompone; - - if (!teleportTarget) { - return console.error('teleportTarget is required.'); - } - if (teleportComponent || teleportComponentId) { - return console.error('teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)'); - } + var install = function install(app) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var _options$teleportTarg = options.teleportTarget, + teleportTarget = _options$teleportTarg === void 0 ? '' : _options$teleportTarg, + _options$teleportComp = options.teleportComponent, + teleportComponent = _options$teleportComp === void 0 ? '' : _options$teleportComp, + _options$teleportComp2 = options.teleportComponentId, + teleportComponentId = _options$teleportComp2 === void 0 ? '' : _options$teleportComp2, + _options$modalCompone = options.modalComponent, + modalComponent = _options$modalCompone === void 0 ? 'Modal' : _options$modalCompone; + + if (!teleportTarget) { + return console.error('teleportTarget is required.'); + } - var visibleModals = vue.ref([]); + if (teleportComponent || teleportComponentId) { + return console.error('teleportComponent, teleportComponentId was deprecated. use teleportTarget instead. (https://github.com/hoiheart/vue-universal-modal)'); + } - var addVisibleModals = function addVisibleModals(id) { - visibleModals.value = [].concat(_toConsumableArray(visibleModals.value), [id]); - }; + var visibleModals = vue.ref([]); - var removeVisibleModals = function removeVisibleModals(id) { - var modals = _toConsumableArray(visibleModals.value); + var addVisibleModals = function addVisibleModals(id) { + visibleModals.value = [].concat(_toConsumableArray(visibleModals.value), [id]); + }; - modals.splice(visibleModals.value.indexOf(id), 1); - visibleModals.value = _toConsumableArray(modals); - }; + var removeVisibleModals = function removeVisibleModals(id) { + var modals = _toConsumableArray(visibleModals.value); - app.provide(PLUGIN_NAME, { - teleportTarget: teleportTarget, - visibleModals: vue.readonly(visibleModals), - addVisibleModals: addVisibleModals, - removeVisibleModals: removeVisibleModals - }); - app.component(modalComponent, script); - } + modals.splice(visibleModals.value.indexOf(id), 1); + visibleModals.value = _toConsumableArray(modals); + }; + + app.provide(PLUGIN_NAME, { + teleportTarget: teleportTarget, + visibleModals: vue.readonly(visibleModals), + addVisibleModals: addVisibleModals, + removeVisibleModals: removeVisibleModals + }); + app.component(modalComponent, script); + }; + + var VueUniversalModal = { + install: install }; return VueUniversalModal; diff --git a/package-lock.json b/package-lock.json index 50753d2..d21d0ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vue-universal-modal", - "version": "1.0.7", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "packages": { diff --git a/package.json b/package.json index 934668c..8f175f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-universal-modal", - "version": "1.0.7", + "version": "1.1.0", "description": "Universal modal plugin for Vue@3", "license": "ISC", "author": {