@takuma-ru/vue-swipe-modal
Advanced tools
Comparing version 4.0.4 to 4.0.5
@@ -1,1 +0,1 @@ | ||
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".swipe-modal-takumaru-vue-swipe-modal{position:fixed;scrollbar-width:none;z-index:15}.swipe-modal-takumaru-vue-swipe-modal .modal-background{position:fixed;z-index:11;width:100vw;height:100vh;top:50%;left:50%;transform:translate(-50%,-50%)}.swipe-modal-takumaru-vue-swipe-modal .modal-contents{position:fixed;z-index:12;max-height:100vh;left:50%;transform:translate(-50%) translateY(0);overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(0px 16px 40px rgba(0,37,80,.2))}.swipe-modal-takumaru-vue-swipe-modal .modal-contents::-webkit-scrollbar{width:0px}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip-wrapper{z-index:12;display:flex;justify-items:center;align-items:center;justify-content:center;align-content:center;position:relative;top:0px;height:4px;width:100%;padding-top:8px;padding-bottom:8px;cursor:s-resize}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip{--tip-color: #c8c8c8;width:40px;height:100%;border-radius:4px;background-color:var(--tip-color)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var o=require("vue-demi"),Y;const I=typeof window!="undefined",G=e=>typeof e!="undefined",q=e=>typeof e=="function",R=e=>typeof e=="number",j=(e,n,l)=>Math.min(l,Math.max(n,e)),$=()=>{};I&&((Y=window==null?void 0:window.navigator)==null?void 0:Y.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function K(e){return e}function F(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function J(e,n=!0){o.getCurrentInstance()?o.onMounted(e):n?e():o.nextTick(e)}function Q(e,n,l={}){const{immediate:v=!0}=l,i=o.ref(!1);let u=null;function d(){u&&(clearTimeout(u),u=null)}function c(){i.value=!1,d()}function r(...f){d(),i.value=!0,u=setTimeout(()=>{i.value=!1,u=null,e(...f)},o.unref(n))}return v&&(i.value=!0,I&&r()),F(c),{isPending:i,start:r,stop:c}}function Z(e){var n;const l=o.unref(e);return(n=l==null?void 0:l.$el)!=null?n:l}const A=I?window:void 0,k=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},H="__vueuse_ssr_handlers__";k[H]=k[H]||{};k[H];function z(e,n,{window:l=A,initialValue:v=""}={}){const i=o.ref(v),u=o.computed(()=>{var d;return Z(n)||((d=l==null?void 0:l.document)==null?void 0:d.documentElement)});return o.watch([u,()=>o.unref(e)],([d,c])=>{var r;if(d&&l){const f=(r=l.getComputedStyle(d).getPropertyValue(c))==null?void 0:r.trim();i.value=f||v}},{immediate:!0}),o.watch(i,d=>{var c;(c=u.value)!=null&&c.style&&u.value.style.setProperty(o.unref(e),d)}),i}function ee(e,n={}){const{immediate:l=!0,window:v=A}=n,i=o.ref(!1);let u=null;function d(){!i.value||!v||(e(),u=v.requestAnimationFrame(d))}function c(){!i.value&&v&&(i.value=!0,d())}function r(){i.value=!1,u!=null&&v&&(v.cancelAnimationFrame(u),u=null)}return l&&c(),F(r),{isActive:i,pause:r,resume:c}}var B;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(B||(B={}));function te([e,n,l,v]){const i=(a,s)=>1-3*s+3*a,u=(a,s)=>3*s-6*a,d=a=>3*a,c=(a,s,m)=>((i(s,m)*a+u(s,m))*a+d(s))*a,r=(a,s,m)=>3*i(s,m)*a*a+2*u(s,m)*a+d(s),f=a=>{let s=a;for(let m=0;m<4;++m){const t=r(s,e,l);if(t===0)return s;s-=(c(s,e,l)-a)/t}return s};return a=>e===n&&l===v?a:c(f(a),n,v)}function W(e,n={}){const{delay:l=0,disabled:v=!1,duration:i=1e3,onFinished:u=$,onStarted:d=$,transition:c=K}=n,r=o.computed(()=>{const p=o.unref(c);return q(p)?p:te(p)}),f=o.computed(()=>{const p=o.unref(e);return R(p)?p:p.map(o.unref)}),a=o.computed(()=>R(f.value)?[f.value]:f.value),s=o.ref(a.value.slice(0));let m,t,g,w,T;const{resume:h,pause:b}=ee(()=>{const p=Date.now(),D=j(1-(g-p)/m,0,1);s.value=T.map((M,y)=>{var _;return M+((_=t[y])!=null?_:0)*r.value(D)}),D>=1&&(b(),u())},{immediate:!1}),V=()=>{b(),m=o.unref(i),t=s.value.map((p,D)=>{var M,y;return((M=a.value[D])!=null?M:0)-((y=s.value[D])!=null?y:0)}),T=s.value.slice(0),w=Date.now(),g=w+m,h(),d()},P=Q(V,l,{immediate:!1});return o.watch(a,()=>{o.unref(v)?s.value=a.value.slice(0):o.unref(l)<=0?V():P.start()},{deep:!0}),o.computed(()=>{const p=o.unref(v)?a:s;return R(f.value)?p.value[0]:p.value})}function oe(e,n,l,v={}){var i,u,d,c,r;const{passive:f=!1,eventName:a,deep:s=!1,defaultValue:m}=v,t=o.getCurrentInstance(),g=l||(t==null?void 0:t.emit)||((i=t==null?void 0:t.$emit)==null?void 0:i.bind(t))||((d=(u=t==null?void 0:t.proxy)==null?void 0:u.$emit)==null?void 0:d.bind(t==null?void 0:t.proxy));let w=a;if(!n)if(o.isVue2){const h=(r=(c=t==null?void 0:t.proxy)==null?void 0:c.$options)==null?void 0:r.model;n=(h==null?void 0:h.value)||"value",a||(w=(h==null?void 0:h.event)||"input")}else n="modelValue";w=a||w||`update:${n.toString()}`;const T=()=>G(e[n])?e[n]:m;if(f){const h=o.ref(T());return o.watch(()=>e[n],b=>h.value=b),o.watch(h,b=>{(b!==e[n]||s)&&g(w,b)},{deep:s}),h}else return o.computed({get(){return T()},set(h){g(w,h)}})}const ne=()=>{const e=o.ref({isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0});return{touchPosition:e,initTouchPosition:()=>{e.value={isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0}},touchStart:u=>{e.value.isTouch=!0,e.value.touchStart=u.touches[0].pageY},touchMove:u=>{e.value.isTouch&&(e.value.touchY=u.touches[0].pageY,e.value.touchDistance=e.value.touchStart-e.value.touchY,e.value.touchDistance>0&&(e.value.touchDistance=0))},touchEnd:()=>{e.value.isTouch=!1}}};function ue(){const e=o.ref({isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0});return{mousePosition:e,initMousePosition:()=>{e.value={isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0}},mouseDown:u=>{e.value.isMouseDown=!0,e.value.downStart=u.pageY},mouseMove:u=>{e.value.isMouseDown&&(e.value.mouseY=u.pageY,e.value.mouseDistance=e.value.downStart-e.value.mouseY,e.value.mouseDistance>0&&(e.value.mouseDistance=0))},mouseUp:()=>{e.value.isMouseDown=!1}}}const E=(e,n)=>{const l=e.indexOf("px"),v=e.indexOf("vh"),i=e.indexOf("vw"),u=e.indexOf("vmin"),d=e.indexOf("vmax"),c=e.indexOf("%");if(l>0)return Number(e.slice(0,l));if(v>0){const r=Number(e.slice(0,v));return window.innerHeight*(r/100)}else if(i>0){const r=Number(e.slice(0,i));return window.innerWidth*(r/100)}else if(u>0){const r=Number(e.slice(0,u));return window.innerWidth<window.innerHeight?window.innerWidth:window.innerHeight*(r/100)}else if(d>0){const r=Number(e.slice(0,d));return window.innerWidth<window.innerHeight?window.innerHeight:window.innerWidth*(r/100)}else if(c>0){let r=0;return J(()=>{var s,m;const f=((m=(s=n==null?void 0:n.value)==null?void 0:s.parentElement)==null?void 0:m.clientHeight)||document.documentElement.clientHeight,a=Number(e.slice(0,c));r=f*(a/100)}),r||document.documentElement.clientHeight}else return 0};o.install();var X=o.defineComponent({name:"swipeModal",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:Boolean,default:!1},dark:{type:Boolean,default:!1},persistent:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#80808080"},fullscreen:{type:Boolean,default:!1},noTip:{type:Boolean,default:!1},contentsWidth:{type:String,default:"100%"},contentsHeight:{type:String,default:"30vh"},borderTopRadius:{type:String,default:null},borderTopLeftRadius:{type:String,default:"0px"},borderTopRightRadius:{type:String,default:"0px"},contentsColor:{type:String,default:"white"},tipColor:{type:String,default:"#c8c8c8"},darkContentsColor:{type:String,default:"#1E1E1E"}},emits:["update:modelValue","open","close"],setup(e,n){const{mousePosition:l,initMousePosition:v,mouseDown:i,mouseMove:u,mouseUp:d}=ue(),{touchPosition:c,initTouchPosition:r,touchStart:f,touchMove:a,touchEnd:s}=ne(),m=oe(e,"modelValue",n.emit),t=o.toRefs(e),g=o.ref(),w=o.ref(280),T=o.ref(null),h=z("--tip-color",T);h.value=t.tipColor.value;const b=o.ref([parseInt(t.backgroundColor.value.slice(1,3),16),parseInt(t.backgroundColor.value.slice(3,5),16),parseInt(t.backgroundColor.value.slice(5,7),16),0]),V=W(b,{duration:250,transition:[.25,.8,.25,1]}),P=o.computed(()=>{const[x,S,U,L]=V.value;return`rgba(${x}, ${S}, ${U}, ${L})`}),p=o.ref(-1*E(t.contentsHeight.value,g)),D=W(p,{duration:w.value,transition:[.25,.8,.25,1]}),M=o.computed(()=>D.value+(Math.abs(c.value.touchDistance)>Math.abs(l.value.mouseDistance)?c.value.touchDistance:l.value.mouseDistance)),y=()=>{document.documentElement.style.overflowY="auto",m.value=!1},_=()=>{n.emit("open"),document.documentElement.style.overflowY="hidden",p.value=0,b.value=[parseInt(t.backgroundColor.value.slice(1,3),16),parseInt(t.backgroundColor.value.slice(3,5),16),parseInt(t.backgroundColor.value.slice(5,7),16),parseInt(t.backgroundColor.value.slice(7,9),16)/255]},C=()=>{p.value=-1*E(t.contentsHeight.value,g)-(Math.abs(c.value.touchDistance)>Math.abs(l.value.mouseDistance)?c.value.touchDistance:l.value.mouseDistance),b.value=[parseInt(t.backgroundColor.value.slice(1,3),16),parseInt(t.backgroundColor.value.slice(3,5),16),parseInt(t.backgroundColor.value.slice(5,7),16),0],setTimeout(()=>{v(),r(),y(),n.emit("close")},w.value)},N=()=>{s(),-1*c.value.touchDistance>E(t.contentsHeight.value,g)/8?C():c.value.touchDistance=0},O=()=>{d(),-1*l.value.mouseDistance>E(t.contentsHeight.value,g)/8?C():l.value.mouseDistance=0};return o.watch(m,(x,S)=>{m.value&&_()}),()=>{var x,S;return o.h("div",{class:"swipe-modal-takumaru-vue-swipe-modal",on:{mousemove:u,mouseup:O},onMousemove:u,onMouseup:O},[t.modelValue.value?o.h("div",{class:"modal-background",style:{backgroundColor:P.value},on:{onMouseup:()=>t.persistent.value?()=>null:C(),click:()=>t.persistent.value?()=>null:C()},onMouseup:()=>{t.persistent.value||C()},onClick:()=>{t.persistent.value||C()}}):null,t.modelValue.value?o.h("div",{ref:g,class:"modal-contents",style:{width:t.contentsWidth.value,minHeight:t.contentsHeight.value,borderTopLeftRadius:t.borderTopRadius.value?t.borderTopRadius.value:t.borderTopLeftRadius.value,borderTopRightRadius:t.borderTopRadius?t.borderTopRadius.value:t.borderTopRightRadius.value,backgroundColor:t.dark.value?t.darkContentsColor.value:t.contentsColor.value,color:t.dark.value?"white":"black",bottom:`${M.value}px`},on:{touchstart:f,touchmove:a,touchend:N},onTouchstart:f,onTouchmove:a,onTouchend:N},[t.noTip.value?null:o.h("div",{class:"modal-contents-chip-wrapper",on:{mousedown:i},onMousedown:i},[o.h("div",{class:"modal-contents-chip"})]),(S=(x=n.slots).default)==null?void 0:S.call(x)]):null])}}});exports.default=X;exports.swipeModal=X; | ||
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".swipe-modal-takumaru-vue-swipe-modal{position:fixed;scrollbar-width:none;z-index:15}.swipe-modal-takumaru-vue-swipe-modal .modal-background{position:fixed;z-index:11;width:100vw;height:100vh;top:50%;left:50%;transform:translate(-50%,-50%)}.swipe-modal-takumaru-vue-swipe-modal .modal-contents{position:fixed;z-index:12;max-height:100vh;left:50%;transform:translate(-50%) translateY(0);overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(0px 16px 40px rgba(0,37,80,.2))}.swipe-modal-takumaru-vue-swipe-modal .modal-contents::-webkit-scrollbar{width:0px}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip-wrapper{z-index:12;display:flex;justify-items:center;align-items:center;justify-content:center;align-content:center;position:relative;top:0px;height:4px;width:100%;padding-top:8px;padding-bottom:8px;cursor:s-resize}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip{--tip-color: #c8c8c8;width:40px;height:100%;border-radius:4px;background-color:var(--tip-color)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var o=require("vue-demi"),Y;const S=typeof window!="undefined",G=e=>typeof e!="undefined",q=e=>typeof e=="function",k=e=>typeof e=="number",j=(e,n,l)=>Math.min(l,Math.max(n,e)),$=()=>{};S&&((Y=window==null?void 0:window.navigator)==null?void 0:Y.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function K(e){return e}function F(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function J(e,n=!0){o.getCurrentInstance()?o.onMounted(e):n?e():o.nextTick(e)}function Q(e,n,l={}){const{immediate:v=!0}=l,i=o.ref(!1);let u=null;function d(){u&&(clearTimeout(u),u=null)}function c(){i.value=!1,d()}function r(...f){d(),i.value=!0,u=setTimeout(()=>{i.value=!1,u=null,e(...f)},o.unref(n))}return v&&(i.value=!0,S&&r()),F(c),{isPending:i,start:r,stop:c}}function Z(e){var n;const l=o.unref(e);return(n=l==null?void 0:l.$el)!=null?n:l}const A=S?window:void 0;S&&window.document;S&&window.navigator;S&&window.location;const H=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},I="__vueuse_ssr_handlers__";H[I]=H[I]||{};H[I];function z(e,n,{window:l=A,initialValue:v=""}={}){const i=o.ref(v),u=o.computed(()=>{var d;return Z(n)||((d=l==null?void 0:l.document)==null?void 0:d.documentElement)});return o.watch([u,()=>o.unref(e)],([d,c])=>{var r;if(d&&l){const f=(r=l.getComputedStyle(d).getPropertyValue(c))==null?void 0:r.trim();i.value=f||v}},{immediate:!0}),o.watch(i,d=>{var c;(c=u.value)!=null&&c.style&&u.value.style.setProperty(o.unref(e),d)}),i}function ee(e,n={}){const{immediate:l=!0,window:v=A}=n,i=o.ref(!1);let u=null;function d(){!i.value||!v||(e(),u=v.requestAnimationFrame(d))}function c(){!i.value&&v&&(i.value=!0,d())}function r(){i.value=!1,u!=null&&v&&(v.cancelAnimationFrame(u),u=null)}return l&&c(),F(r),{isActive:i,pause:r,resume:c}}var B;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(B||(B={}));function te([e,n,l,v]){const i=(a,s)=>1-3*s+3*a,u=(a,s)=>3*s-6*a,d=a=>3*a,c=(a,s,m)=>((i(s,m)*a+u(s,m))*a+d(s))*a,r=(a,s,m)=>3*i(s,m)*a*a+2*u(s,m)*a+d(s),f=a=>{let s=a;for(let m=0;m<4;++m){const t=r(s,e,l);if(t===0)return s;s-=(c(s,e,l)-a)/t}return s};return a=>e===n&&l===v?a:c(f(a),n,v)}function W(e,n={}){const{delay:l=0,disabled:v=!1,duration:i=1e3,onFinished:u=$,onStarted:d=$,transition:c=K}=n,r=o.computed(()=>{const p=o.unref(c);return q(p)?p:te(p)}),f=o.computed(()=>{const p=o.unref(e);return k(p)?p:p.map(o.unref)}),a=o.computed(()=>k(f.value)?[f.value]:f.value),s=o.ref(a.value.slice(0));let m,t,g,w,T;const{resume:h,pause:b}=ee(()=>{const p=Date.now(),D=j(1-(g-p)/m,0,1);s.value=T.map((M,y)=>{var E;return M+((E=t[y])!=null?E:0)*r.value(D)}),D>=1&&(b(),u())},{immediate:!1}),_=()=>{b(),m=o.unref(i),t=s.value.map((p,D)=>{var M,y;return((M=a.value[D])!=null?M:0)-((y=s.value[D])!=null?y:0)}),T=s.value.slice(0),w=Date.now(),g=w+m,h(),d()},R=Q(_,l,{immediate:!1});return o.watch(a,()=>{o.unref(v)?s.value=a.value.slice(0):o.unref(l)<=0?_():R.start()},{deep:!0}),o.computed(()=>{const p=o.unref(v)?a:s;return k(f.value)?p.value[0]:p.value})}function oe(e,n,l,v={}){var i,u,d,c,r;const{passive:f=!1,eventName:a,deep:s=!1,defaultValue:m}=v,t=o.getCurrentInstance(),g=l||(t==null?void 0:t.emit)||((i=t==null?void 0:t.$emit)==null?void 0:i.bind(t))||((d=(u=t==null?void 0:t.proxy)==null?void 0:u.$emit)==null?void 0:d.bind(t==null?void 0:t.proxy));let w=a;if(!n)if(o.isVue2){const h=(r=(c=t==null?void 0:t.proxy)==null?void 0:c.$options)==null?void 0:r.model;n=(h==null?void 0:h.value)||"value",a||(w=(h==null?void 0:h.event)||"input")}else n="modelValue";w=a||w||`update:${n.toString()}`;const T=()=>G(e[n])?e[n]:m;if(f){const h=o.ref(T());return o.watch(()=>e[n],b=>h.value=b),o.watch(h,b=>{(b!==e[n]||s)&&g(w,b)},{deep:s}),h}else return o.computed({get(){return T()},set(h){g(w,h)}})}const ne=()=>{const e=o.ref({isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0});return{touchPosition:e,initTouchPosition:()=>{e.value={isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0}},touchStart:u=>{e.value.isTouch=!0,e.value.touchStart=u.touches[0].pageY},touchMove:u=>{e.value.isTouch&&(e.value.touchY=u.touches[0].pageY,e.value.touchDistance=e.value.touchStart-e.value.touchY,e.value.touchDistance>0&&(e.value.touchDistance=0))},touchEnd:()=>{e.value.isTouch=!1}}};function ue(){const e=o.ref({isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0});return{mousePosition:e,initMousePosition:()=>{e.value={isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0}},mouseDown:u=>{e.value.isMouseDown=!0,e.value.downStart=u.pageY},mouseMove:u=>{e.value.isMouseDown&&(e.value.mouseY=u.pageY,e.value.mouseDistance=e.value.downStart-e.value.mouseY,e.value.mouseDistance>0&&(e.value.mouseDistance=0))},mouseUp:()=>{e.value.isMouseDown=!1}}}const P=(e,n)=>{const l=e.indexOf("px"),v=e.indexOf("vh"),i=e.indexOf("vw"),u=e.indexOf("vmin"),d=e.indexOf("vmax"),c=e.indexOf("%");if(l>0)return Number(e.slice(0,l));if(v>0){const r=Number(e.slice(0,v));return window.innerHeight*(r/100)}else if(i>0){const r=Number(e.slice(0,i));return window.innerWidth*(r/100)}else if(u>0){const r=Number(e.slice(0,u));return window.innerWidth<window.innerHeight?window.innerWidth:window.innerHeight*(r/100)}else if(d>0){const r=Number(e.slice(0,d));return window.innerWidth<window.innerHeight?window.innerHeight:window.innerWidth*(r/100)}else if(c>0){let r=0;return J(()=>{var s,m;const f=((m=(s=n==null?void 0:n.value)==null?void 0:s.parentElement)==null?void 0:m.clientHeight)||document.documentElement.clientHeight,a=Number(e.slice(0,c));r=f*(a/100)}),r||document.documentElement.clientHeight}else return 0};o.install();var X=o.defineComponent({name:"swipeModal",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:Boolean,default:!1},dark:{type:Boolean,default:!1},persistent:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#80808080"},fullscreen:{type:Boolean,default:!1},noTip:{type:Boolean,default:!1},contentsWidth:{type:String,default:"100%"},contentsHeight:{type:String,default:"30vh"},borderTopRadius:{type:String,default:null},borderTopLeftRadius:{type:String,default:"0px"},borderTopRightRadius:{type:String,default:"0px"},contentsColor:{type:String,default:"white"},tipColor:{type:String,default:"#c8c8c8"},darkContentsColor:{type:String,default:"#1E1E1E"}},emits:["update:modelValue","open","close"],setup(e,n){const{mousePosition:l,initMousePosition:v,mouseDown:i,mouseMove:u,mouseUp:d}=ue(),{touchPosition:c,initTouchPosition:r,touchStart:f,touchMove:a,touchEnd:s}=ne(),m=oe(e,"modelValue",n.emit),t=o.toRefs(e),g=o.ref(),w=o.ref(280),T=o.ref(null),h=z("--tip-color",T);h.value=t.tipColor.value;const b=o.ref([parseInt(t.backgroundColor.value.slice(1,3),16),parseInt(t.backgroundColor.value.slice(3,5),16),parseInt(t.backgroundColor.value.slice(5,7),16),0]),_=W(b,{duration:250,transition:[.25,.8,.25,1]}),R=o.computed(()=>{const[x,V,U,L]=_.value;return`rgba(${x}, ${V}, ${U}, ${L})`}),p=o.ref(-1*P(t.contentsHeight.value,g)),D=W(p,{duration:w.value,transition:[.25,.8,.25,1]}),M=o.computed(()=>D.value+(Math.abs(c.value.touchDistance)>Math.abs(l.value.mouseDistance)?c.value.touchDistance:l.value.mouseDistance)),y=()=>{document.documentElement.style.overflowY="auto",m.value=!1},E=()=>{n.emit("open"),document.documentElement.style.overflowY="hidden",p.value=0,b.value=[parseInt(t.backgroundColor.value.slice(1,3),16),parseInt(t.backgroundColor.value.slice(3,5),16),parseInt(t.backgroundColor.value.slice(5,7),16),parseInt(t.backgroundColor.value.slice(7,9),16)/255]},C=()=>{p.value=-1*P(t.contentsHeight.value,g)-(Math.abs(c.value.touchDistance)>Math.abs(l.value.mouseDistance)?c.value.touchDistance:l.value.mouseDistance),b.value=[parseInt(t.backgroundColor.value.slice(1,3),16),parseInt(t.backgroundColor.value.slice(3,5),16),parseInt(t.backgroundColor.value.slice(5,7),16),0],setTimeout(()=>{v(),r(),y(),n.emit("close")},w.value)},N=()=>{s(),-1*c.value.touchDistance>P(t.contentsHeight.value,g)/8?C():c.value.touchDistance=0},O=()=>{d(),-1*l.value.mouseDistance>P(t.contentsHeight.value,g)/8?C():l.value.mouseDistance=0};return o.watch(m,(x,V)=>{m.value&&E()}),()=>{var x,V;return o.h("div",{class:"swipe-modal-takumaru-vue-swipe-modal",on:{mousemove:u,mouseup:O},onMousemove:u,onMouseup:O},[t.modelValue.value?o.h("div",{class:"modal-background",style:{backgroundColor:R.value},on:{onMouseup:()=>t.persistent.value?()=>null:C(),click:()=>t.persistent.value?()=>null:C()},onMouseup:()=>{t.persistent.value||C()},onClick:()=>{t.persistent.value||C()}}):null,t.modelValue.value?o.h("div",{ref:g,class:"modal-contents",style:{width:t.contentsWidth.value,minHeight:t.contentsHeight.value,borderTopLeftRadius:t.borderTopRadius.value?t.borderTopRadius.value:t.borderTopLeftRadius.value,borderTopRightRadius:t.borderTopRadius?t.borderTopRadius.value:t.borderTopRightRadius.value,backgroundColor:t.dark.value?t.darkContentsColor.value:t.contentsColor.value,color:t.dark.value?"white":"black",bottom:`${M.value}px`},on:{touchstart:f,touchmove:a,touchend:N},onTouchstart:f,onTouchmove:a,onTouchend:N},[t.noTip.value?null:o.h("div",{class:"modal-contents-chip-wrapper",on:{mousedown:i},onMousedown:i},[o.h("div",{class:"modal-contents-chip"})]),(V=(x=n.slots).default)==null?void 0:V.call(x)]):null])}}});exports.default=X;exports.swipeModal=X; |
@@ -1,2 +0,2 @@ | ||
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".swipe-modal-takumaru-vue-swipe-modal{position:fixed;scrollbar-width:none;z-index:15}.swipe-modal-takumaru-vue-swipe-modal .modal-background{position:fixed;z-index:11;width:100vw;height:100vh;top:50%;left:50%;transform:translate(-50%,-50%)}.swipe-modal-takumaru-vue-swipe-modal .modal-contents{position:fixed;z-index:12;max-height:100vh;left:50%;transform:translate(-50%) translateY(0);overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(0px 16px 40px rgba(0,37,80,.2))}.swipe-modal-takumaru-vue-swipe-modal .modal-contents::-webkit-scrollbar{width:0px}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip-wrapper{z-index:12;display:flex;justify-items:center;align-items:center;justify-content:center;align-content:center;position:relative;top:0px;height:4px;width:100%;padding-top:8px;padding-bottom:8px;cursor:s-resize}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip{--tip-color: #c8c8c8;width:40px;height:100%;border-radius:4px;background-color:var(--tip-color)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import { getCurrentInstance, onMounted, nextTick, ref, unref, getCurrentScope, onScopeDispose, computed, watch, isVue2, install, defineComponent, toRefs, h } from "vue-demi"; | ||
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".swipe-modal-takumaru-vue-swipe-modal{position:fixed;scrollbar-width:none;z-index:15}.swipe-modal-takumaru-vue-swipe-modal .modal-background{position:fixed;z-index:11;width:100vw;height:100vh;top:50%;left:50%;transform:translate(-50%,-50%)}.swipe-modal-takumaru-vue-swipe-modal .modal-contents{position:fixed;z-index:12;max-height:100vh;left:50%;transform:translate(-50%) translateY(0);overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(0px 16px 40px rgba(0,37,80,.2))}.swipe-modal-takumaru-vue-swipe-modal .modal-contents::-webkit-scrollbar{width:0px}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip-wrapper{z-index:12;display:flex;justify-items:center;align-items:center;justify-content:center;align-content:center;position:relative;top:0px;height:4px;width:100%;padding-top:8px;padding-bottom:8px;cursor:s-resize}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip{--tip-color: #c8c8c8;width:40px;height:100%;border-radius:4px;background-color:var(--tip-color)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import { getCurrentInstance, onMounted, nextTick, ref, getCurrentScope, onScopeDispose, unref, computed, watch, isVue2, install, defineComponent, toRefs, h } from "vue-demi"; | ||
var _a; | ||
@@ -72,2 +72,5 @@ const isClient = typeof window !== "undefined"; | ||
const defaultWindow = isClient ? window : void 0; | ||
isClient ? window.document : void 0; | ||
isClient ? window.navigator : void 0; | ||
isClient ? window.location : void 0; | ||
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; | ||
@@ -600,13 +603,17 @@ const globalKey = "__vueuse_ssr_handlers__"; | ||
}, [ | ||
!propsRef.noTip.value ? h("div", { | ||
class: "modal-contents-chip-wrapper", | ||
on: { | ||
mousedown: mouseDown | ||
!propsRef.noTip.value ? h( | ||
"div", | ||
{ | ||
class: "modal-contents-chip-wrapper", | ||
on: { | ||
mousedown: mouseDown | ||
}, | ||
onMousedown: mouseDown | ||
}, | ||
onMousedown: mouseDown | ||
}, [ | ||
h("div", { | ||
class: "modal-contents-chip" | ||
}) | ||
]) : null, | ||
[ | ||
h("div", { | ||
class: "modal-contents-chip" | ||
}) | ||
] | ||
) : null, | ||
(_b = (_a2 = context.slots).default) == null ? void 0 : _b.call(_a2) | ||
@@ -613,0 +620,0 @@ ]) : null |
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".swipe-modal-takumaru-vue-swipe-modal{position:fixed;scrollbar-width:none;z-index:15}.swipe-modal-takumaru-vue-swipe-modal .modal-background{position:fixed;z-index:11;width:100vw;height:100vh;top:50%;left:50%;transform:translate(-50%,-50%)}.swipe-modal-takumaru-vue-swipe-modal .modal-contents{position:fixed;z-index:12;max-height:100vh;left:50%;transform:translate(-50%) translateY(0);overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(0px 16px 40px rgba(0,37,80,.2))}.swipe-modal-takumaru-vue-swipe-modal .modal-contents::-webkit-scrollbar{width:0px}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip-wrapper{z-index:12;display:flex;justify-items:center;align-items:center;justify-content:center;align-content:center;position:relative;top:0px;height:4px;width:100%;padding-top:8px;padding-bottom:8px;cursor:s-resize}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip{--tip-color: #c8c8c8;width:40px;height:100%;border-radius:4px;background-color:var(--tip-color)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();var __vite_style__=document.createElement("style");__vite_style__.innerHTML=`.swipe-modal-takumaru-vue-swipe-modal{position:fixed;scrollbar-width:none;z-index:15}.swipe-modal-takumaru-vue-swipe-modal .modal-background{position:fixed;z-index:11;width:100vw;height:100vh;top:50%;left:50%;transform:translate(-50%,-50%)}.swipe-modal-takumaru-vue-swipe-modal .modal-contents{position:fixed;z-index:12;max-height:100vh;left:50%;transform:translate(-50%) translateY(0);overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(0px 16px 40px rgba(0,37,80,.2))}.swipe-modal-takumaru-vue-swipe-modal .modal-contents::-webkit-scrollbar{width:0px}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip-wrapper{z-index:12;display:flex;justify-items:center;align-items:center;justify-content:center;align-content:center;position:relative;top:0px;height:4px;width:100%;padding-top:8px;padding-bottom:8px;cursor:s-resize}.swipe-modal-takumaru-vue-swipe-modal .modal-contents-chip{--tip-color: #c8c8c8;width:40px;height:100%;border-radius:4px;background-color:var(--tip-color)} | ||
(function(T,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","vue-demi"],t):(T=typeof globalThis!="undefined"?globalThis:T||self,t(T.swipeModal={},T.vueDemi))})(this,function(T,t){"use strict";`;document.head.appendChild(__vite_style__);var O;const R=typeof window!="undefined",j=e=>typeof e!="undefined",G=e=>typeof e=="function",H=e=>typeof e=="number",q=(e,n,u)=>Math.min(u,Math.max(n,e)),$=()=>{};R&&((O=window==null?void 0:window.navigator)==null?void 0:O.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function K(e){return e}function B(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function J(e,n=!0){t.getCurrentInstance()?t.onMounted(e):n?e():t.nextTick(e)}function Q(e,n,u={}){const{immediate:f=!0}=u,i=t.ref(!1);let l=null;function d(){l&&(clearTimeout(l),l=null)}function c(){i.value=!1,d()}function r(...p){d(),i.value=!0,l=setTimeout(()=>{i.value=!1,l=null,e(...p)},t.unref(n))}return f&&(i.value=!0,R&&r()),B(c),{isPending:i,start:r,stop:c}}function Z(e){var n;const u=t.unref(e);return(n=u==null?void 0:u.$el)!=null?n:u}const W=R?window:void 0,I=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Y="__vueuse_ssr_handlers__";I[Y]=I[Y]||{},I[Y];function z(e,n,{window:u=W,initialValue:f=""}={}){const i=t.ref(f),l=t.computed(()=>{var d;return Z(n)||((d=u==null?void 0:u.document)==null?void 0:d.documentElement)});return t.watch([l,()=>t.unref(e)],([d,c])=>{var r;if(d&&u){const p=(r=u.getComputedStyle(d).getPropertyValue(c))==null?void 0:r.trim();i.value=p||f}},{immediate:!0}),t.watch(i,d=>{var c;(c=l.value)!=null&&c.style&&l.value.style.setProperty(t.unref(e),d)}),i}function D(e,n={}){const{immediate:u=!0,window:f=W}=n,i=t.ref(!1);let l=null;function d(){!i.value||!f||(e(),l=f.requestAnimationFrame(d))}function c(){!i.value&&f&&(i.value=!0,d())}function r(){i.value=!1,l!=null&&f&&(f.cancelAnimationFrame(l),l=null)}return u&&c(),B(r),{isActive:i,pause:r,resume:c}}var F;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(F||(F={}));function ee([e,n,u,f]){const i=(a,s)=>1-3*s+3*a,l=(a,s)=>3*s-6*a,d=a=>3*a,c=(a,s,v)=>((i(s,v)*a+l(s,v))*a+d(s))*a,r=(a,s,v)=>3*i(s,v)*a*a+2*l(s,v)*a+d(s),p=a=>{let s=a;for(let v=0;v<4;++v){const o=r(s,e,u);if(o===0)return s;s-=(c(s,e,u)-a)/o}return s};return a=>e===n&&u===f?a:c(p(a),n,f)}function A(e,n={}){const{delay:u=0,disabled:f=!1,duration:i=1e3,onFinished:l=$,onStarted:d=$,transition:c=K}=n,r=t.computed(()=>{const h=t.unref(c);return G(h)?h:ee(h)}),p=t.computed(()=>{const h=t.unref(e);return H(h)?h:h.map(t.unref)}),a=t.computed(()=>H(p.value)?[p.value]:p.value),s=t.ref(a.value.slice(0));let v,o,w,g,x;const{resume:m,pause:b}=D(()=>{const h=Date.now(),y=q(1-(w-h)/v,0,1);s.value=x.map((M,C)=>{var P;return M+((P=o[C])!=null?P:0)*r.value(y)}),y>=1&&(b(),l())},{immediate:!1}),E=()=>{b(),v=t.unref(i),o=s.value.map((h,y)=>{var M,C;return((M=a.value[y])!=null?M:0)-((C=s.value[y])!=null?C:0)}),x=s.value.slice(0),g=Date.now(),w=g+v,m(),d()},N=Q(E,u,{immediate:!1});return t.watch(a,()=>{t.unref(f)?s.value=a.value.slice(0):t.unref(u)<=0?E():N.start()},{deep:!0}),t.computed(()=>{const h=t.unref(f)?a:s;return H(p.value)?h.value[0]:h.value})}function te(e,n,u,f={}){var i,l,d,c,r;const{passive:p=!1,eventName:a,deep:s=!1,defaultValue:v}=f,o=t.getCurrentInstance(),w=u||(o==null?void 0:o.emit)||((i=o==null?void 0:o.$emit)==null?void 0:i.bind(o))||((d=(l=o==null?void 0:o.proxy)==null?void 0:l.$emit)==null?void 0:d.bind(o==null?void 0:o.proxy));let g=a;if(!n)if(t.isVue2){const m=(r=(c=o==null?void 0:o.proxy)==null?void 0:c.$options)==null?void 0:r.model;n=(m==null?void 0:m.value)||"value",a||(g=(m==null?void 0:m.event)||"input")}else n="modelValue";g=a||g||`update:${n.toString()}`;const x=()=>j(e[n])?e[n]:v;if(p){const m=t.ref(x());return t.watch(()=>e[n],b=>m.value=b),t.watch(m,b=>{(b!==e[n]||s)&&w(g,b)},{deep:s}),m}else return t.computed({get(){return x()},set(m){w(g,m)}})}const oe=()=>{const e=t.ref({isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0});return{touchPosition:e,initTouchPosition:()=>{e.value={isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0}},touchStart:l=>{e.value.isTouch=!0,e.value.touchStart=l.touches[0].pageY},touchMove:l=>{e.value.isTouch&&(e.value.touchY=l.touches[0].pageY,e.value.touchDistance=e.value.touchStart-e.value.touchY,e.value.touchDistance>0&&(e.value.touchDistance=0))},touchEnd:()=>{e.value.isTouch=!1}}};function ne(){const e=t.ref({isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0});return{mousePosition:e,initMousePosition:()=>{e.value={isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0}},mouseDown:l=>{e.value.isMouseDown=!0,e.value.downStart=l.pageY},mouseMove:l=>{e.value.isMouseDown&&(e.value.mouseY=l.pageY,e.value.mouseDistance=e.value.downStart-e.value.mouseY,e.value.mouseDistance>0&&(e.value.mouseDistance=0))},mouseUp:()=>{e.value.isMouseDown=!1}}}const V=(e,n)=>{const u=e.indexOf("px"),f=e.indexOf("vh"),i=e.indexOf("vw"),l=e.indexOf("vmin"),d=e.indexOf("vmax"),c=e.indexOf("%");if(u>0)return Number(e.slice(0,u));if(f>0){const r=Number(e.slice(0,f));return window.innerHeight*(r/100)}else if(i>0){const r=Number(e.slice(0,i));return window.innerWidth*(r/100)}else if(l>0){const r=Number(e.slice(0,l));return window.innerWidth<window.innerHeight?window.innerWidth:window.innerHeight*(r/100)}else if(d>0){const r=Number(e.slice(0,d));return window.innerWidth<window.innerHeight?window.innerHeight:window.innerWidth*(r/100)}else if(c>0){let r=0;return J(()=>{var s,v;const p=((v=(s=n==null?void 0:n.value)==null?void 0:s.parentElement)==null?void 0:v.clientHeight)||document.documentElement.clientHeight,a=Number(e.slice(0,c));r=p*(a/100)}),r||document.documentElement.clientHeight}else return 0};var ae="";t.install();var X=t.defineComponent({name:"swipeModal",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:Boolean,default:!1},dark:{type:Boolean,default:!1},persistent:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#80808080"},fullscreen:{type:Boolean,default:!1},noTip:{type:Boolean,default:!1},contentsWidth:{type:String,default:"100%"},contentsHeight:{type:String,default:"30vh"},borderTopRadius:{type:String,default:null},borderTopLeftRadius:{type:String,default:"0px"},borderTopRightRadius:{type:String,default:"0px"},contentsColor:{type:String,default:"white"},tipColor:{type:String,default:"#c8c8c8"},darkContentsColor:{type:String,default:"#1E1E1E"}},emits:["update:modelValue","open","close"],setup(e,n){const{mousePosition:u,initMousePosition:f,mouseDown:i,mouseMove:l,mouseUp:d}=ne(),{touchPosition:c,initTouchPosition:r,touchStart:p,touchMove:a,touchEnd:s}=oe(),v=te(e,"modelValue",n.emit),o=t.toRefs(e),w=t.ref(),g=t.ref(280),x=t.ref(null),m=z("--tip-color",x);m.value=o.tipColor.value;const b=t.ref([parseInt(o.backgroundColor.value.slice(1,3),16),parseInt(o.backgroundColor.value.slice(3,5),16),parseInt(o.backgroundColor.value.slice(5,7),16),0]),E=A(b,{duration:250,transition:[.25,.8,.25,1]}),N=t.computed(()=>{const[_,S,le,ue]=E.value;return`rgba(${_}, ${S}, ${le}, ${ue})`}),h=t.ref(-1*V(o.contentsHeight.value,w)),y=A(h,{duration:g.value,transition:[.25,.8,.25,1]}),M=t.computed(()=>y.value+(Math.abs(c.value.touchDistance)>Math.abs(u.value.mouseDistance)?c.value.touchDistance:u.value.mouseDistance)),C=()=>{document.documentElement.style.overflowY="auto",v.value=!1},P=()=>{n.emit("open"),document.documentElement.style.overflowY="hidden",h.value=0,b.value=[parseInt(o.backgroundColor.value.slice(1,3),16),parseInt(o.backgroundColor.value.slice(3,5),16),parseInt(o.backgroundColor.value.slice(5,7),16),parseInt(o.backgroundColor.value.slice(7,9),16)/255]},k=()=>{h.value=-1*V(o.contentsHeight.value,w)-(Math.abs(c.value.touchDistance)>Math.abs(u.value.mouseDistance)?c.value.touchDistance:u.value.mouseDistance),b.value=[parseInt(o.backgroundColor.value.slice(1,3),16),parseInt(o.backgroundColor.value.slice(3,5),16),parseInt(o.backgroundColor.value.slice(5,7),16),0],setTimeout(()=>{f(),r(),C(),n.emit("close")},g.value)},L=()=>{s(),-1*c.value.touchDistance>V(o.contentsHeight.value,w)/8?k():c.value.touchDistance=0},U=()=>{d(),-1*u.value.mouseDistance>V(o.contentsHeight.value,w)/8?k():u.value.mouseDistance=0};return t.watch(v,(_,S)=>{v.value&&P()}),()=>{var _,S;return t.h("div",{class:"swipe-modal-takumaru-vue-swipe-modal",on:{mousemove:l,mouseup:U},onMousemove:l,onMouseup:U},[o.modelValue.value?t.h("div",{class:"modal-background",style:{backgroundColor:N.value},on:{onMouseup:()=>o.persistent.value?()=>null:k(),click:()=>o.persistent.value?()=>null:k()},onMouseup:()=>{o.persistent.value||k()},onClick:()=>{o.persistent.value||k()}}):null,o.modelValue.value?t.h("div",{ref:w,class:"modal-contents",style:{width:o.contentsWidth.value,minHeight:o.contentsHeight.value,borderTopLeftRadius:o.borderTopRadius.value?o.borderTopRadius.value:o.borderTopLeftRadius.value,borderTopRightRadius:o.borderTopRadius?o.borderTopRadius.value:o.borderTopRightRadius.value,backgroundColor:o.dark.value?o.darkContentsColor.value:o.contentsColor.value,color:o.dark.value?"white":"black",bottom:`${M.value}px`},on:{touchstart:p,touchmove:a,touchend:L},onTouchstart:p,onTouchmove:a,onTouchend:L},[o.noTip.value?null:t.h("div",{class:"modal-contents-chip-wrapper",on:{mousedown:i},onMousedown:i},[t.h("div",{class:"modal-contents-chip"})]),(S=(_=n.slots).default)==null?void 0:S.call(_)]):null])}}});T.default=X,T.swipeModal=X,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(T,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","vue-demi"],t):(T=typeof globalThis!="undefined"?globalThis:T||self,t(T.swipeModal={},T.vueDemi))})(this,function(T,t){"use strict";`;document.head.appendChild(__vite_style__);var O;const M=typeof window!="undefined",j=e=>typeof e!="undefined",G=e=>typeof e=="function",H=e=>typeof e=="number",q=(e,n,a)=>Math.min(a,Math.max(n,e)),$=()=>{};M&&((O=window==null?void 0:window.navigator)==null?void 0:O.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function K(e){return e}function B(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function J(e,n=!0){t.getCurrentInstance()?t.onMounted(e):n?e():t.nextTick(e)}function Q(e,n,a={}){const{immediate:f=!0}=a,i=t.ref(!1);let l=null;function d(){l&&(clearTimeout(l),l=null)}function c(){i.value=!1,d()}function r(...p){d(),i.value=!0,l=setTimeout(()=>{i.value=!1,l=null,e(...p)},t.unref(n))}return f&&(i.value=!0,M&&r()),B(c),{isPending:i,start:r,stop:c}}function Z(e){var n;const a=t.unref(e);return(n=a==null?void 0:a.$el)!=null?n:a}const W=M?window:void 0;M&&window.document,M&&window.navigator,M&&window.location;const I=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Y="__vueuse_ssr_handlers__";I[Y]=I[Y]||{},I[Y];function z(e,n,{window:a=W,initialValue:f=""}={}){const i=t.ref(f),l=t.computed(()=>{var d;return Z(n)||((d=a==null?void 0:a.document)==null?void 0:d.documentElement)});return t.watch([l,()=>t.unref(e)],([d,c])=>{var r;if(d&&a){const p=(r=a.getComputedStyle(d).getPropertyValue(c))==null?void 0:r.trim();i.value=p||f}},{immediate:!0}),t.watch(i,d=>{var c;(c=l.value)!=null&&c.style&&l.value.style.setProperty(t.unref(e),d)}),i}function D(e,n={}){const{immediate:a=!0,window:f=W}=n,i=t.ref(!1);let l=null;function d(){!i.value||!f||(e(),l=f.requestAnimationFrame(d))}function c(){!i.value&&f&&(i.value=!0,d())}function r(){i.value=!1,l!=null&&f&&(f.cancelAnimationFrame(l),l=null)}return a&&c(),B(r),{isActive:i,pause:r,resume:c}}var F;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(F||(F={}));function ee([e,n,a,f]){const i=(u,s)=>1-3*s+3*u,l=(u,s)=>3*s-6*u,d=u=>3*u,c=(u,s,v)=>((i(s,v)*u+l(s,v))*u+d(s))*u,r=(u,s,v)=>3*i(s,v)*u*u+2*l(s,v)*u+d(s),p=u=>{let s=u;for(let v=0;v<4;++v){const o=r(s,e,a);if(o===0)return s;s-=(c(s,e,a)-u)/o}return s};return u=>e===n&&a===f?u:c(p(u),n,f)}function A(e,n={}){const{delay:a=0,disabled:f=!1,duration:i=1e3,onFinished:l=$,onStarted:d=$,transition:c=K}=n,r=t.computed(()=>{const h=t.unref(c);return G(h)?h:ee(h)}),p=t.computed(()=>{const h=t.unref(e);return H(h)?h:h.map(t.unref)}),u=t.computed(()=>H(p.value)?[p.value]:p.value),s=t.ref(u.value.slice(0));let v,o,w,g,x;const{resume:m,pause:b}=D(()=>{const h=Date.now(),y=q(1-(w-h)/v,0,1);s.value=x.map((C,k)=>{var R;return C+((R=o[k])!=null?R:0)*r.value(y)}),y>=1&&(b(),l())},{immediate:!1}),P=()=>{b(),v=t.unref(i),o=s.value.map((h,y)=>{var C,k;return((C=u.value[y])!=null?C:0)-((k=s.value[y])!=null?k:0)}),x=s.value.slice(0),g=Date.now(),w=g+v,m(),d()},N=Q(P,a,{immediate:!1});return t.watch(u,()=>{t.unref(f)?s.value=u.value.slice(0):t.unref(a)<=0?P():N.start()},{deep:!0}),t.computed(()=>{const h=t.unref(f)?u:s;return H(p.value)?h.value[0]:h.value})}function te(e,n,a,f={}){var i,l,d,c,r;const{passive:p=!1,eventName:u,deep:s=!1,defaultValue:v}=f,o=t.getCurrentInstance(),w=a||(o==null?void 0:o.emit)||((i=o==null?void 0:o.$emit)==null?void 0:i.bind(o))||((d=(l=o==null?void 0:o.proxy)==null?void 0:l.$emit)==null?void 0:d.bind(o==null?void 0:o.proxy));let g=u;if(!n)if(t.isVue2){const m=(r=(c=o==null?void 0:o.proxy)==null?void 0:c.$options)==null?void 0:r.model;n=(m==null?void 0:m.value)||"value",u||(g=(m==null?void 0:m.event)||"input")}else n="modelValue";g=u||g||`update:${n.toString()}`;const x=()=>j(e[n])?e[n]:v;if(p){const m=t.ref(x());return t.watch(()=>e[n],b=>m.value=b),t.watch(m,b=>{(b!==e[n]||s)&&w(g,b)},{deep:s}),m}else return t.computed({get(){return x()},set(m){w(g,m)}})}const oe=()=>{const e=t.ref({isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0});return{touchPosition:e,initTouchPosition:()=>{e.value={isTouch:!1,touchStart:0,touchDistance:0,touchX:0,touchY:0}},touchStart:l=>{e.value.isTouch=!0,e.value.touchStart=l.touches[0].pageY},touchMove:l=>{e.value.isTouch&&(e.value.touchY=l.touches[0].pageY,e.value.touchDistance=e.value.touchStart-e.value.touchY,e.value.touchDistance>0&&(e.value.touchDistance=0))},touchEnd:()=>{e.value.isTouch=!1}}};function ne(){const e=t.ref({isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0});return{mousePosition:e,initMousePosition:()=>{e.value={isMouseDown:!1,downStart:0,mouseDistance:0,mouseX:0,mouseY:0}},mouseDown:l=>{e.value.isMouseDown=!0,e.value.downStart=l.pageY},mouseMove:l=>{e.value.isMouseDown&&(e.value.mouseY=l.pageY,e.value.mouseDistance=e.value.downStart-e.value.mouseY,e.value.mouseDistance>0&&(e.value.mouseDistance=0))},mouseUp:()=>{e.value.isMouseDown=!1}}}const E=(e,n)=>{const a=e.indexOf("px"),f=e.indexOf("vh"),i=e.indexOf("vw"),l=e.indexOf("vmin"),d=e.indexOf("vmax"),c=e.indexOf("%");if(a>0)return Number(e.slice(0,a));if(f>0){const r=Number(e.slice(0,f));return window.innerHeight*(r/100)}else if(i>0){const r=Number(e.slice(0,i));return window.innerWidth*(r/100)}else if(l>0){const r=Number(e.slice(0,l));return window.innerWidth<window.innerHeight?window.innerWidth:window.innerHeight*(r/100)}else if(d>0){const r=Number(e.slice(0,d));return window.innerWidth<window.innerHeight?window.innerHeight:window.innerWidth*(r/100)}else if(c>0){let r=0;return J(()=>{var s,v;const p=((v=(s=n==null?void 0:n.value)==null?void 0:s.parentElement)==null?void 0:v.clientHeight)||document.documentElement.clientHeight,u=Number(e.slice(0,c));r=p*(u/100)}),r||document.documentElement.clientHeight}else return 0};var ue="";t.install();var X=t.defineComponent({name:"swipeModal",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:Boolean,default:!1},dark:{type:Boolean,default:!1},persistent:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#80808080"},fullscreen:{type:Boolean,default:!1},noTip:{type:Boolean,default:!1},contentsWidth:{type:String,default:"100%"},contentsHeight:{type:String,default:"30vh"},borderTopRadius:{type:String,default:null},borderTopLeftRadius:{type:String,default:"0px"},borderTopRightRadius:{type:String,default:"0px"},contentsColor:{type:String,default:"white"},tipColor:{type:String,default:"#c8c8c8"},darkContentsColor:{type:String,default:"#1E1E1E"}},emits:["update:modelValue","open","close"],setup(e,n){const{mousePosition:a,initMousePosition:f,mouseDown:i,mouseMove:l,mouseUp:d}=ne(),{touchPosition:c,initTouchPosition:r,touchStart:p,touchMove:u,touchEnd:s}=oe(),v=te(e,"modelValue",n.emit),o=t.toRefs(e),w=t.ref(),g=t.ref(280),x=t.ref(null),m=z("--tip-color",x);m.value=o.tipColor.value;const b=t.ref([parseInt(o.backgroundColor.value.slice(1,3),16),parseInt(o.backgroundColor.value.slice(3,5),16),parseInt(o.backgroundColor.value.slice(5,7),16),0]),P=A(b,{duration:250,transition:[.25,.8,.25,1]}),N=t.computed(()=>{const[S,V,le,ae]=P.value;return`rgba(${S}, ${V}, ${le}, ${ae})`}),h=t.ref(-1*E(o.contentsHeight.value,w)),y=A(h,{duration:g.value,transition:[.25,.8,.25,1]}),C=t.computed(()=>y.value+(Math.abs(c.value.touchDistance)>Math.abs(a.value.mouseDistance)?c.value.touchDistance:a.value.mouseDistance)),k=()=>{document.documentElement.style.overflowY="auto",v.value=!1},R=()=>{n.emit("open"),document.documentElement.style.overflowY="hidden",h.value=0,b.value=[parseInt(o.backgroundColor.value.slice(1,3),16),parseInt(o.backgroundColor.value.slice(3,5),16),parseInt(o.backgroundColor.value.slice(5,7),16),parseInt(o.backgroundColor.value.slice(7,9),16)/255]},_=()=>{h.value=-1*E(o.contentsHeight.value,w)-(Math.abs(c.value.touchDistance)>Math.abs(a.value.mouseDistance)?c.value.touchDistance:a.value.mouseDistance),b.value=[parseInt(o.backgroundColor.value.slice(1,3),16),parseInt(o.backgroundColor.value.slice(3,5),16),parseInt(o.backgroundColor.value.slice(5,7),16),0],setTimeout(()=>{f(),r(),k(),n.emit("close")},g.value)},L=()=>{s(),-1*c.value.touchDistance>E(o.contentsHeight.value,w)/8?_():c.value.touchDistance=0},U=()=>{d(),-1*a.value.mouseDistance>E(o.contentsHeight.value,w)/8?_():a.value.mouseDistance=0};return t.watch(v,(S,V)=>{v.value&&R()}),()=>{var S,V;return t.h("div",{class:"swipe-modal-takumaru-vue-swipe-modal",on:{mousemove:l,mouseup:U},onMousemove:l,onMouseup:U},[o.modelValue.value?t.h("div",{class:"modal-background",style:{backgroundColor:N.value},on:{onMouseup:()=>o.persistent.value?()=>null:_(),click:()=>o.persistent.value?()=>null:_()},onMouseup:()=>{o.persistent.value||_()},onClick:()=>{o.persistent.value||_()}}):null,o.modelValue.value?t.h("div",{ref:w,class:"modal-contents",style:{width:o.contentsWidth.value,minHeight:o.contentsHeight.value,borderTopLeftRadius:o.borderTopRadius.value?o.borderTopRadius.value:o.borderTopLeftRadius.value,borderTopRightRadius:o.borderTopRadius?o.borderTopRadius.value:o.borderTopRightRadius.value,backgroundColor:o.dark.value?o.darkContentsColor.value:o.contentsColor.value,color:o.dark.value?"white":"black",bottom:`${C.value}px`},on:{touchstart:p,touchmove:u,touchend:L},onTouchstart:p,onTouchmove:u,onTouchend:L},[o.noTip.value?null:t.h("div",{class:"modal-contents-chip-wrapper",on:{mousedown:i},onMousedown:i},[t.h("div",{class:"modal-contents-chip"})]),(V=(S=n.slots).default)==null?void 0:V.call(S)]):null])}}});T.default=X,T.swipeModal=X,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "@takuma-ru/vue-swipe-modal", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"private": false, | ||
@@ -39,6 +39,6 @@ "description": "Swipeable Bottom Sheet library for vue2 and vue3", | ||
}, | ||
"types": "types/components/swipe-modal.d.ts", | ||
"types": "@types/components/swipe-modal.d.ts", | ||
"files": [ | ||
"dist/*", | ||
"types/*" | ||
"@types/*" | ||
], | ||
@@ -45,0 +45,0 @@ "sideEffects": false, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62456
19
1124