From ec802127d447377560362e6fe302224ca112252f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 12 May 2024 15:45:19 +0000 Subject: [PATCH] chore(release): set `package.json` to 5.0.1 [skip ci] ## [5.0.1](https://github.com/kouts/vue-modal/compare/v5.0.0...v5.0.1) (2024-05-12) ### Bug Fixes * switched to pnpm, updated npm packages ([5268e93](https://github.com/kouts/vue-modal/commit/5268e934d6ef918eca26e9b00982c1914895b42f)) --- CHANGELOG.md | 7 +++++++ dist/vue-modal.es.js | 16 ++++++++-------- dist/vue-modal.umd.js | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34a30b9..e405f23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.0.1](https://github.com/kouts/vue-modal/compare/v5.0.0...v5.0.1) (2024-05-12) + + +### Bug Fixes + +* switched to pnpm, updated npm packages ([5268e93](https://github.com/kouts/vue-modal/commit/5268e934d6ef918eca26e9b00982c1914895b42f)) + # [5.0.0](https://github.com/kouts/vue-modal/compare/v4.1.0...v5.0.0) (2023-06-05) diff --git a/dist/vue-modal.es.js b/dist/vue-modal.es.js index 3e8e0e4..667b012 100644 --- a/dist/vue-modal.es.js +++ b/dist/vue-modal.es.js @@ -1,4 +1,4 @@ -import { openBlock as h, createBlock as x, Teleport as _, createVNode as b, Transition as v, withCtx as g, withDirectives as p, createElementVNode as n, normalizeClass as u, normalizeStyle as f, vShow as y, renderSlot as m, toDisplayString as k, createElementBlock as S, withModifiers as T, createCommentVNode as C, reactive as I } from "vue"; +import { openBlock as h, createBlock as x, Teleport as k, createVNode as b, Transition as v, withCtx as g, withDirectives as p, createElementVNode as n, normalizeClass as u, normalizeStyle as f, vShow as y, renderSlot as m, toDisplayString as S, createElementBlock as T, withModifiers as _, createCommentVNode as C, reactive as I } from "vue"; const O = (e, t) => { const s = e.__vccOpts || e; for (const [i, l] of t) @@ -153,7 +153,7 @@ const A = { } }, E = ["data-vm-backdrop-id"], z = ["data-vm-wrapper-id", "aria-label", "aria-describedby", "aria-labelledby"], F = ["data-vm-id"], B = { class: "vm-titlebar" }, V = ["id"], L = ["aria-label"], Z = ["id"]; function j(e, t, s, i, l, a) { - return l.mount ? (h(), x(_, { + return l.mount ? (h(), x(k, { key: 0, to: s.appendTo }, [ @@ -210,13 +210,13 @@ function j(e, t, s, i, l, a) { n("h3", { id: `${l.id}-title`, class: "vm-title" - }, k(s.title), 9, V), - s.enableClose ? (h(), S("button", { + }, S(s.title), 9, V), + s.enableClose ? (h(), T("button", { key: 0, type: "button", class: "vm-btn-close", "aria-label": s.closeLabel, - onClick: t[0] || (t[0] = T((...d) => a.close && a.close(...d), ["prevent"])) + onClick: t[0] || (t[0] = _((...d) => a.close && a.close(...d), ["prevent"])) }, null, 8, L)) : C("", !0) ]) ]), @@ -239,7 +239,7 @@ function j(e, t, s, i, l, a) { } const N = /* @__PURE__ */ O(A, [["render", j]]), c = I({ modals: {} -}), M = () => { +}), q = () => { const e = (i) => { c.modals[i] = !0; }, t = (i) => { @@ -252,11 +252,11 @@ const N = /* @__PURE__ */ O(A, [["render", j]]), c = I({ } }; }, W = { install(e) { - e.config.globalProperties.$modal = M(); + e.config.globalProperties.$modal = q(); } }; export { N as Modal, W as modalPlugin, - M as useModal + q as useModal }; diff --git a/dist/vue-modal.umd.js b/dist/vue-modal.umd.js index abb8952..84cffc0 100644 --- a/dist/vue-modal.umd.js +++ b/dist/vue-modal.umd.js @@ -1 +1 @@ -(function(a,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(a=typeof globalThis<"u"?globalThis:a||self,t(a.VueModal={},a.Vue))})(this,function(a,t){"use strict";const T="",u=(e,l)=>{const s=e.__vccOpts||e;for(const[o,i]of l)s[o]=i;return s},d={type:[String,Object,Array],default:""},m='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"])';let c=0;const b={name:"VueModal",props:{name:{type:String,default:""},title:{type:String,default:""},baseZindex:{type:Number,default:1051},bgClass:d,wrapperClass:d,modalClass:d,modalStyle:d,inClass:Object.assign({},d,{default:"vm-fadeIn"}),outClass:Object.assign({},d,{default:"vm-fadeOut"}),bgInClass:Object.assign({},d,{default:"vm-fadeIn"}),bgOutClass:Object.assign({},d,{default:"vm-fadeOut"}),appendTo:{type:String,default:"body"},live:{type:Boolean,default:!1},enableClose:{type:Boolean,default:!0},modelValue:{type:Boolean,default:!1},closeLabel:{type:String,default:"Close"}},emits:["before-open","opening","opened","before-close","closing","closed","update:modelValue"],data(){return{zIndex:0,id:null,show:!1,mount:!1,elToFocus:null}},created(){this.live&&(this.mount=!0)},mounted(){this.id="vm-"+this.$.uid;const e=this.name?`$modal.state.modals.${this.name}`:"modelValue";this.$watch(e,l=>{l?(this.mount=!0,this.$nextTick(()=>{this.show=!0})):this.show=!1},{immediate:!0})},beforeUnmount(){this.elToFocus=null,this.name&&this.$modal.hide(this.name)},methods:{close(){this.enableClose===!0&&(this.$emit("update:modelValue",!1),this.name&&this.$modal.hide(this.name))},clickOutside(e){e.target===this.$refs["vm-wrapper"]&&this.close()},keydown(e){if((e.which===27||e.keyCode===27)&&this.close(),e.which===9||e.keyCode===9){const l=[].slice.call(this.$refs["vm-wrapper"].querySelectorAll(m)).filter(function(s){return!!(s.offsetWidth||s.offsetHeight||s.getClientRects().length)});e.shiftKey?(e.target===l[0]||e.target===this.$refs["vm-wrapper"])&&(e.preventDefault(),l[l.length-1].focus()):e.target===l[l.length-1]&&(e.preventDefault(),l[0].focus())}},getAllVisibleWrappers(){return[].slice.call(document.querySelectorAll("[data-vm-wrapper-id]")).filter(e=>e.display!=="none")},getTopZindex(){return this.getAllVisibleWrappers().reduce((e,l)=>parseInt(l.style.zIndex)>e?parseInt(l.style.zIndex):e,0)},handleFocus(e){const l=e.querySelector("[autofocus]");if(l)l.focus();else{const s=e.querySelectorAll(m);s.length?s[0].focus():e.focus()}},beforeOpen(){this.elToFocus=document.activeElement;const e=this.getTopZindex();c?this.zIndex=c+2:this.zIndex=e===0?this.baseZindex:e+2,c=this.zIndex,this.$emit("before-open")},opening(){this.$emit("opening")},opened(){this.handleFocus(this.$refs["vm-wrapper"]),this.$emit("opened")},beforeClose(){this.$emit("before-close")},closing(){this.$emit("closing")},closed(){this.zIndex=0,this.live||(this.mount=!1),this.$nextTick(()=>{window.requestAnimationFrame(()=>{const e=this.getTopZindex();if(e>0){const l=this.getAllVisibleWrappers();for(let s=0;s[t.withDirectives(t.createElementVNode("div",{"data-vm-backdrop-id":i.id,class:t.normalizeClass(["vm-backdrop",s.bgClass]),style:t.normalizeStyle({"z-index":i.zIndex-1})},null,14,p),[[t.vShow,i.show]])]),_:1},8,["enter-active-class","leave-active-class"]),t.createVNode(t.Transition,{name:"vm-transition","enter-active-class":s.inClass,"leave-active-class":s.outClass,onBeforeEnter:n.beforeOpen,onEnter:n.opening,onAfterEnter:n.opened,onBeforeLeave:n.beforeClose,onLeave:n.closing,onAfterLeave:n.closed},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{ref:"vm-wrapper","data-vm-wrapper-id":i.id,tabindex:"-1",class:t.normalizeClass(["vm-wrapper",s.wrapperClass]),style:t.normalizeStyle({"z-index":i.zIndex,cursor:s.enableClose?"pointer":"default"}),role:"dialog","aria-label":s.title,"aria-modal":"true","aria-describedby":`${i.id}-content`,"aria-labelledby":`${i.id}-title`,onClick:l[1]||(l[1]=r=>n.clickOutside(r)),onKeydown:l[2]||(l[2]=r=>n.keydown(r))},[t.createElementVNode("div",{ref:"vm",class:t.normalizeClass(["vm",s.modalClass]),"data-vm-id":i.id,style:t.normalizeStyle(s.modalStyle)},[t.renderSlot(e.$slots,"titlebar",{},()=>[t.createElementVNode("div",v,[t.createElementVNode("h3",{id:`${i.id}-title`,class:"vm-title"},t.toDisplayString(s.title),9,C),s.enableClose?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"vm-btn-close","aria-label":s.closeLabel,onClick:l[0]||(l[0]=t.withModifiers((...r)=>n.close&&n.close(...r),["prevent"]))},null,8,w)):t.createCommentVNode("",!0)])]),t.renderSlot(e.$slots,"content",{},()=>[t.createElementVNode("div",{id:`${i.id}-content`,class:"vm-content"},[t.renderSlot(e.$slots,"default")],8,x)])],14,y)],46,g),[[t.vShow,i.show]])]),_:3},8,["enter-active-class","leave-active-class","onBeforeEnter","onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],8,["to"])):t.createCommentVNode("",!0)}const _=u(b,[["render",S]]),f=t.reactive({modals:{}}),h=()=>{const e=o=>{f.modals[o]=!0},l=o=>{delete f.modals[o]};return{state:f,show:e,hide:l,hideAll:()=>{Object.keys(f.modals).forEach(o=>{l(o)})}}},k={install(e){e.config.globalProperties.$modal=h()}};a.Modal=_,a.modalPlugin=k,a.useModal=h,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}); +(function(a,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(a=typeof globalThis<"u"?globalThis:a||self,t(a.VueModal={},a.Vue))})(this,function(a,t){"use strict";const u=(e,l)=>{const s=e.__vccOpts||e;for(const[o,i]of l)s[o]=i;return s},d={type:[String,Object,Array],default:""},m='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"])';let c=0;const b={name:"VueModal",props:{name:{type:String,default:""},title:{type:String,default:""},baseZindex:{type:Number,default:1051},bgClass:d,wrapperClass:d,modalClass:d,modalStyle:d,inClass:Object.assign({},d,{default:"vm-fadeIn"}),outClass:Object.assign({},d,{default:"vm-fadeOut"}),bgInClass:Object.assign({},d,{default:"vm-fadeIn"}),bgOutClass:Object.assign({},d,{default:"vm-fadeOut"}),appendTo:{type:String,default:"body"},live:{type:Boolean,default:!1},enableClose:{type:Boolean,default:!0},modelValue:{type:Boolean,default:!1},closeLabel:{type:String,default:"Close"}},emits:["before-open","opening","opened","before-close","closing","closed","update:modelValue"],data(){return{zIndex:0,id:null,show:!1,mount:!1,elToFocus:null}},created(){this.live&&(this.mount=!0)},mounted(){this.id="vm-"+this.$.uid;const e=this.name?`$modal.state.modals.${this.name}`:"modelValue";this.$watch(e,l=>{l?(this.mount=!0,this.$nextTick(()=>{this.show=!0})):this.show=!1},{immediate:!0})},beforeUnmount(){this.elToFocus=null,this.name&&this.$modal.hide(this.name)},methods:{close(){this.enableClose===!0&&(this.$emit("update:modelValue",!1),this.name&&this.$modal.hide(this.name))},clickOutside(e){e.target===this.$refs["vm-wrapper"]&&this.close()},keydown(e){if((e.which===27||e.keyCode===27)&&this.close(),e.which===9||e.keyCode===9){const l=[].slice.call(this.$refs["vm-wrapper"].querySelectorAll(m)).filter(function(s){return!!(s.offsetWidth||s.offsetHeight||s.getClientRects().length)});e.shiftKey?(e.target===l[0]||e.target===this.$refs["vm-wrapper"])&&(e.preventDefault(),l[l.length-1].focus()):e.target===l[l.length-1]&&(e.preventDefault(),l[0].focus())}},getAllVisibleWrappers(){return[].slice.call(document.querySelectorAll("[data-vm-wrapper-id]")).filter(e=>e.display!=="none")},getTopZindex(){return this.getAllVisibleWrappers().reduce((e,l)=>parseInt(l.style.zIndex)>e?parseInt(l.style.zIndex):e,0)},handleFocus(e){const l=e.querySelector("[autofocus]");if(l)l.focus();else{const s=e.querySelectorAll(m);s.length?s[0].focus():e.focus()}},beforeOpen(){this.elToFocus=document.activeElement;const e=this.getTopZindex();c?this.zIndex=c+2:this.zIndex=e===0?this.baseZindex:e+2,c=this.zIndex,this.$emit("before-open")},opening(){this.$emit("opening")},opened(){this.handleFocus(this.$refs["vm-wrapper"]),this.$emit("opened")},beforeClose(){this.$emit("before-close")},closing(){this.$emit("closing")},closed(){this.zIndex=0,this.live||(this.mount=!1),this.$nextTick(()=>{window.requestAnimationFrame(()=>{const e=this.getTopZindex();if(e>0){const l=this.getAllVisibleWrappers();for(let s=0;s[t.withDirectives(t.createElementVNode("div",{"data-vm-backdrop-id":i.id,class:t.normalizeClass(["vm-backdrop",s.bgClass]),style:t.normalizeStyle({"z-index":i.zIndex-1})},null,14,p),[[t.vShow,i.show]])]),_:1},8,["enter-active-class","leave-active-class"]),t.createVNode(t.Transition,{name:"vm-transition","enter-active-class":s.inClass,"leave-active-class":s.outClass,onBeforeEnter:n.beforeOpen,onEnter:n.opening,onAfterEnter:n.opened,onBeforeLeave:n.beforeClose,onLeave:n.closing,onAfterLeave:n.closed},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{ref:"vm-wrapper","data-vm-wrapper-id":i.id,tabindex:"-1",class:t.normalizeClass(["vm-wrapper",s.wrapperClass]),style:t.normalizeStyle({"z-index":i.zIndex,cursor:s.enableClose?"pointer":"default"}),role:"dialog","aria-label":s.title,"aria-modal":"true","aria-describedby":`${i.id}-content`,"aria-labelledby":`${i.id}-title`,onClick:l[1]||(l[1]=r=>n.clickOutside(r)),onKeydown:l[2]||(l[2]=r=>n.keydown(r))},[t.createElementVNode("div",{ref:"vm",class:t.normalizeClass(["vm",s.modalClass]),"data-vm-id":i.id,style:t.normalizeStyle(s.modalStyle)},[t.renderSlot(e.$slots,"titlebar",{},()=>[t.createElementVNode("div",C,[t.createElementVNode("h3",{id:`${i.id}-title`,class:"vm-title"},t.toDisplayString(s.title),9,v),s.enableClose?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"vm-btn-close","aria-label":s.closeLabel,onClick:l[0]||(l[0]=t.withModifiers((...r)=>n.close&&n.close(...r),["prevent"]))},null,8,w)):t.createCommentVNode("",!0)])]),t.renderSlot(e.$slots,"content",{},()=>[t.createElementVNode("div",{id:`${i.id}-content`,class:"vm-content"},[t.renderSlot(e.$slots,"default")],8,x)])],14,y)],46,g),[[t.vShow,i.show]])]),_:3},8,["enter-active-class","leave-active-class","onBeforeEnter","onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],8,["to"])):t.createCommentVNode("",!0)}const k=u(b,[["render",S]]),f=t.reactive({modals:{}}),h=()=>{const e=o=>{f.modals[o]=!0},l=o=>{delete f.modals[o]};return{state:f,show:e,hide:l,hideAll:()=>{Object.keys(f.modals).forEach(o=>{l(o)})}}},T={install(e){e.config.globalProperties.$modal=h()}};a.Modal=k,a.modalPlugin=T,a.useModal=h,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});