@fox-js/navigation 4.0.1-11 → 4.0.1-13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";/*!
2
- * @fox-js/navigation v4.0.1-10 Tue Mar 12 2024 21:40:43 GMT+0800 (中国标准时间)
3
- */const a=require("vue"),L=require("@fox-js/fox"),W=a.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=a.resolveComponent("fox-router-view");return a.openBlock(),a.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:e.transition,multi:!0,name:e.routerViewName},null,8,["transition","name"])}}}),N=Object.freeze(Object.defineProperty({__proto__:null,default:W},Symbol.toStringTag,{value:"Module"})),k=a.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=a.resolveComponent("fox-router-view");return a.openBlock(),a.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:a.withCtx(({Component:r})=>[a.createVNode(a.Transition,{name:"fox-default-navigator__trans"},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r)))]),_:2},1024)]),_:1},8,["name"])}}}),F=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"})),S=10;function U(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function I(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:p=>{if(p.touches){const l=p.touches[0];t.deltaX=l.clientX-t.startX,t.deltaY=l.clientY-t.startY,t.moveX=l.clientX,t.moveY=l.clientY}else t.deltaX=p.clientX-t.startX,t.deltaY=p.clientY-t.startY,t.moveX=p.clientX,t.moveY=p.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=U(t.offsetX,t.offsetY))},start:p=>{if(o(),p.touches){const l=p.touches[0];t.startX=l.clientX,t.startY=l.clientY}else t.startX=p.clientX,t.startY=p.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function j(t){return t===window}const q=t=>{const e=a.unref(t);if(j(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},H=15,G=300,J=200;function K(t){t.stopPropagation()}function Q(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&K(t)}function Z(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function P(t,e=0,n,o=J){n==="end"?t.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:t.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",t.style.transform=`translate3d(${e}px, 0, 0)`}const C=new WeakMap;function tt(t,e,n,o,r=500,f,p=1e3){const l={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},_=t.previousSibling,m=I(),g=(s,v,y,x)=>{let D=v+l.startDistance;if(y==="end"){const c=q(s);let T=c.width*e;D<T?D=0:D=c.width;let w=!1;x&&x>0&&(w=!0,l.transitionEndTrigger=()=>{l.moving=!1,f&&s.classList.remove(f),D>0&&typeof o=="function"&&o()}),P(s,D,"end",x),_&&P(_,0,"",0),!w&&D>0&&typeof o=="function"&&(l.moving=!1,o())}else D<0&&(D=0),P(s,D,"",0)},i=()=>{t.style.transform="",t.style.transition="",l.transitionEndTrigger?(l.transitionEndTrigger(),l.transitionEndTrigger=null,_&&setTimeout(()=>{_&&(_.style.transform="",_.style.transition="")},r)):_&&(_.style.transform="",_.style.transition="")},d=/^matrix\((.+)\)$/,h=s=>{if(m.start(s),l.scrollDistance=0,l.moving){const v=t,{transform:y}=window.getComputedStyle(v);if(y){const x=d.exec(y);if(x){const c=x[1].split(/,\s*/);l.scrollDistance=+c[4]}}}f&&t.classList.add(f),l.startDistance=l.scrollDistance,l.transitionEndTrigger=null,l.moving=!0},b=s=>{l.moving=!0,m.move(s),!m.isVertical()&&(Q(s,!0),g(t,m.state.deltaX,"",0))},u=()=>{if(m.isVertical()){g(t,0,"end",p);return}const s=m.state.deltaX;if(s===0){f&&t.classList.remove(f),l.moving=!1;return}const v=m.state.duration;if(v<G&&Math.abs(s)>H){const x=Z(s,v,n);g(t,x,"end",p)}else g(t,s,"end",p)};t.addEventListener("transitionend",i),t.addEventListener("touchstart",h),t.addEventListener("touchmove",b),t.addEventListener("touchend",u),t.addEventListener("touchcancel",u),C.set(t,{state:l,transitionend:i,touchstart:h,touchmove:b,touchend:u,touchcancel:u})}function et(t){const e=C.get(t);e&&(C.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const nt=a.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},removeViewPageDuration:{default:500},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function r(i){return(i.params&&i.params.animationType)??"slide"}const f=(i,d,h,b)=>{if(h.opsType===L.OperationType.Append||d){const u=r(h),s=d?"show":"enter";if(s==="show"&&(u==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;s==="enter"&&(n=h,o="enter");const v=`fox-root-navigator__${u}-${s}-from`,y=`fox-root-navigator__${u}-${s}-active`;i.classList.add(v),i.classList.add(y)}},p=(i,d,h,b)=>{if(h.opsType===L.OperationType.Append||d){const u=r(h),s=d?"show":"enter";if(s==="show"&&(u==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;const v=`fox-root-navigator__${u}-${s}-from`,y=`fox-root-navigator__${u}-${s}-to`;i.classList.remove(v),i.classList.add(y)}},l=(i,d,h,b)=>{if(h.opsType===L.OperationType.Append||d){const u=r(h),s=d?"show":"enter";if(s==="enter"&&(n=null,o=null),u!=="pop"){const v=`fox-root-navigator__${u}-${s}-active`,y=`fox-root-navigator__${u}-${s}-to`;i.classList.remove(v),i.classList.remove(y)}}e.dragRemove&&!d&&h.opsType===L.OperationType.Append&&tt(i,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,e.removeViewPageDuration,"fox-root-navigator__item-moving",1e3)},_=(i,d,h,b)=>{if(h.opsType===L.OperationType.Append||d){const u=r(h),s=d?"hide":"leave";if(s==="hide"&&(u==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;s==="leave"&&(n=h,o="leave");const v=`fox-root-navigator__${u}-${s}-from`,y=`fox-root-navigator__${u}-${s}-active`;i.classList.add(v),i.classList.add(y)}},m=(i,d,h,b)=>{if(h.opsType===L.OperationType.Append||d){const u=r(h),s=d?"hide":"leave";if(s==="hide"&&(u==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;const v=`fox-root-navigator__${u}-${s}-from`,y=`fox-root-navigator__${u}-${s}-to`;i.classList.remove(v),i.classList.add(y)}},g=(i,d,h,b)=>{if(h.opsType===L.OperationType.Append||d){const u=r(h),s=d?"hide":"leave";if(s==="leave"&&(n=null,o=null),u!=="pop"){const v=`fox-root-navigator__${u}-${s}-active`,y=`fox-root-navigator__${u}-${s}-to`;i.classList.remove(v),i.classList.remove(y)}}e.dragRemove&&!d&&et(i)};return(i,d)=>{const h=a.resolveComponent("fox-router-view");return a.openBlock(),a.createBlock(h,{class:"fox-root-navigator","view-class":i.viewClass,"before-enter":f,enter:p,"after-enter":l,"before-leave":_,leave:m,"after-leave":g,multi:!0,name:i.routerViewName,"view-tag":i.viewTag,transition:i.transition},null,8,["view-class","name","view-tag","transition"])}}}),ot=Object.freeze(Object.defineProperty({__proto__:null,default:nt},Symbol.toStringTag,{value:"Module"})),it={class:"fox-swiper-navigator"},st=a.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=a.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,r)=>(a.openBlock(),a.createElementBlock("div",it,[a.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:a.normalizeStyle(n.value)},[a.renderSlot(o.$slots,"default")],4)]))}});let at=0;function rt(){return++at}const ct=15,lt=300,ut=200;function dt(t){t.stopPropagation()}function ft(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&dt(t)}function ht(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function X(t,e=0,n,o=ut){n==="end"?t.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:t.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",t.style.transform=`translate3d(${e}px, 0, 0)`}class pt{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,r,f,p){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=r,this.moveRatio=f,this.momentumReduceRatio=p}open(){const e=this.el,n=I(),o=(r,f,p,l)=>{let _=f+this.startDistance;const m=this.columnWidth*this.moveRatio;if(p==="end"){if(f==0){this.moving=!1;return}Math.abs(f)>m?f>0?_=this.startDistance+this.columnWidth:_=this.startDistance-this.columnWidth:_=this.startDistance;let g=-_;g<0?g=0:g>this.width-this.columnWidth&&(g=this.width-this.columnWidth);const i=Math.floor(g/this.columnWidth);this.isPageOpened(i)||this.openPage(i),_=-i*this.columnWidth,l&&l>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(i)}),X(r,_,"end",l),this.scrollDistance=_}else{if(Math.abs(f)>m){let i=0;if(f>0?i=Math.abs(this.startDistance+this.columnWidth):i=Math.abs(this.startDistance-this.columnWidth),i>=0&&i<this.width){const d=Math.floor(i/this.columnWidth);this.isPageOpened(d)||this.openPage(d)}}let g=-_;g<this.min?g=this.min:g>this.max&&(g=this.max),X(r,-g,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=r=>{this.moving||(n.start(r),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=r=>{n.move(r),!n.isVertical()&&(ft(r,!0),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical()){o(e,0,"end",this.swipeDuration);return}const r=n.state.deltaX;if(r==0)return;const f=n.state.duration;if(f<lt&&Math.abs(r)>ct){const l=ht(r,f,this.momentumReduceRatio);o(e,l,"end",this.swipeDuration)}else o(e,r,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function mt(t,e,n,o,r,f){return new pt(t,e,n,o,r,f)}function gt(t){const e=a.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),r=parseFloat(n.getPropertyValue("padding-right")),f=parseFloat(n.getPropertyValue("padding-top")),p=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-r,height:e.clientHeight-f-p}}const vt=a.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=a.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),r=e,f=()=>o.scrollDistance,p=c=>{if(o.openedIndexList.indexOf(c)===-1){o.openedIndexList.push(c);const T=n.routes[c];try{n.openViewPage(T,c)}catch(w){console.error(w)}}},l=c=>o.openedIndexList.indexOf(c)!==-1,_=c=>{o.index=c,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const T=n.routes[c];r("update:activePath",T.path)};let m=null;n.draggable&&(m=mt(f,p,l,_,n.moveRatio,n.momentumReduceRatio));let g=null;a.onMounted(()=>{const c=s(),T=()=>{const w=gt(c);i(n.activePath,n.routes,w.width,w.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(g=new window.ResizeObserver(T),g.observe(c)),T(),m){const w=y();m.el=w,m.open()}}),a.onBeforeUnmount(()=>{g&&(g.disconnect(),g=null),m&&m.close()}),a.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([c,T,w,$,M,R])=>{const O=w<=0?o.width:w,E=$<=0?o.height:$;i(c,T,O,E,M,R)});const i=(c,T,w,$,M,R="horizontal")=>{const O=c;if(o.index=T.findIndex(E=>E.path===O),R==="horizontal"){const E=w;if(E>0){o.width=w;const B=E*n.routes.length,z=-E/3,Y=E*(T.length-1)+E/3;m&&(m.columnWidth=E,m.width=B,m.min=z,m.max=Y),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-E*o.index)}}m&&(m.swipeDuration=M)},d=`fox-swiper-navigator-${rt()}`,h=a.computed(()=>{const c=[d];return n.customClass&&c.push(n.customClass),c}),b=a.computed(()=>{const c={},T=o.width>0?o.width:n.width;T>0&&(c.width=`${T}px`);const w=o.height>0?o.height:n.height;return w>0&&(c.height=`${w}px`),n.customStyle&&Object.assign(c,n.customStyle),c});let u=null;function s(){return u||(u=document.querySelector(`.${d}`),u)}let v=null;function y(){return v||(v=document.querySelector(`.${d}>.fox-swiper-navigator__inner`),v)}const x=a.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),D=(c,T)=>{const w=n.routes.findIndex($=>{const M=c.path??c.name??"";return $.path==M});return o.width<=0?{}:{style:{left:`${w*o.width}px`,width:`${o.width}px`}}};return(c,T)=>{const w=a.resolveComponent("fox-router-view");return a.openBlock(),a.createBlock(w,{class:a.normalizeClass(h.value),style:a.normalizeStyle(b.value),"view-class":"fox-swiper-navigator__item",tag:st,"view-tag-props":D,multi:!0,name:c.routerViewName,transition:c.transition,"scroll-distance":o.scrollDistance,"scroll-duration":c.scrollDuration,direction:c.direction,width:x.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}}),_t=Object.freeze(Object.defineProperty({__proto__:null,default:vt},Symbol.toStringTag,{value:"Module"}));let wt="fox-";const yt=[],A=Object.assign({"/src/components/card-navigator/index.vue":N,"/src/components/default-navigator/index.vue":F,"/src/components/root-navigator/index.vue":ot,"/src/components/swiper-navigator/index.vue":_t}),V=[];for(const t in A){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];yt.indexOf(e)===-1&&V.push({name:e,component:A[t].default})}const Tt={install(t){V.forEach(e=>{t.component(`${wt}${e.name}`,e.component)})}};module.exports=Tt;
2
+ * @fox-js/navigation v4.0.1-12 Sun Apr 28 2024 00:29:50 GMT+0800 (中国标准时间)
3
+ */const s=require("vue"),b=require("@fox-js/fox"),k=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:e.transition,multi:!0,name:e.routerViewName},null,8,["transition","name"])}}}),F=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"})),U=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}}),j=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"})),S=10;function q(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function V(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=q(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function H(t){return t===window}const G=t=>{const e=s.unref(t);if(H(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},J=(t,e,n)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const o=document.createEvent("Events");let i=!0,d=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?d=!!e[a]:o[a]=e[a];o.initEvent(t,i,d),(n??document).dispatchEvent(o)},K=15,Q=300,Z=200;function tt(t){t.stopPropagation()}function et(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function P(t,e=0,n,o=Z){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function A(t){t.style.transition="",t.style.transform=""}const nt=/^matrix\((.+)\)$/;function C(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const i=nt.exec(o);i&&(e=+i[1].split(/,\s*/)[4])}return e}const X=new WeakMap;function ot(t,e,n,o,i,d=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=V(),g=(_,h,c,w)=>{let v=h+a.startDistance;if(c==="end"){const D=G(_);let l=D.width*e;v<l?v=0:v=D.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&A(x),v==0?A(_):J(b.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&P(x,0,"",0),v>0&&typeof o=="function"&&o(),P(_,v,"end",w)}else v<0&&(v=0),P(_,v,"",0)},y=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=C(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||C(t)===0&&f.state.deltaX<0)&&(tt(_),g(t,f.state.deltaX,"",0))},u=()=>{if(f.isVertical()||C(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<Q&&Math.abs(h)>K){const v=et(h,c,n);g(t,v,"end",d)}else g(t,h,"end",d)};t.addEventListener("transitionend",y),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",u),t.addEventListener("touchcancel",u),X.set(t,{state:a,transitionend:y,touchstart:r,touchmove:p,touchend:u,touchcancel:u})}function it(t){const e=X.get(t);e&&(X.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const st=s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function d(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=u,o="enter");const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(v)}},a=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(v)}},x=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),w=p?"show":"enter";if(w==="enter"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${w}-active`,D=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)===!0&&!p&&u.opsType===b.OperationType.Append&&ot(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=u,o="leave");const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(v)}},g=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(v)}},y=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),w=p?"hide":"leave";if(w==="leave"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${w}-active`,D=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)&&!p&&it(r)};return(r,p)=>{const u=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(u,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:g,"after-leave":y,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}}),at=Object.freeze(Object.defineProperty({__proto__:null,default:st},Symbol.toStringTag,{value:"Module"})),rt={class:"fox-swiper-navigator"},ct=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,i)=>(s.openBlock(),s.createElementBlock("div",rt,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.renderSlot(o.$slots,"default")],4)]))}});let lt=0;function ut(){return++lt}const dt=15,ft=300,ht=200;function mt(t){t.stopPropagation()}function pt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function I(t,e=0,n,o=ht){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}class vt{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,i,d,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=d,this.momentumReduceRatio=m}open(){const e=this.el,n=V(),o=(i,d,m,a)=>{let x=d+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(d==0){this.moving=!1;return}Math.abs(d)>f?d>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let g=-x;g<0?g=0:g>this.width-this.columnWidth&&(g=this.width-this.columnWidth);const y=Math.floor(g/this.columnWidth);this.isPageOpened(y)||this.openPage(y),x=-y*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(y)}),I(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(d)>f){let y=0;if(d>0?y=Math.abs(this.startDistance+this.columnWidth):y=Math.abs(this.startDistance-this.columnWidth),y>=0&&y<this.width){const r=Math.floor(y/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let g=-x;g<this.min?g=this.min:g>this.max&&(g=this.max),I(i,-g,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=i=>{this.moving||(n.start(i),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=i=>{n.move(i),!n.isVertical()&&(mt(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const d=n.state.duration;if(d<ft&&Math.abs(i)>dt){const a=pt(i,d,this.momentumReduceRatio);o(e,a,"end",this.swipeDuration)}else o(e,i,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function gt(t,e,n,o,i,d){return new vt(t,e,n,o,i,d)}function _t(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),d=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-d-m}}const wt=s.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,d=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(T){console.error(T)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=gt(d,m,a,x,n.moveRatio,n.momentumReduceRatio));let g=null;s.onMounted(()=>{const l=h(),E=()=>{const T=_t(l);y(n.activePath,n.routes,T.width,T.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(g=new window.ResizeObserver(E),g.observe(l)),E(),f){const T=w();f.el=T,f.open()}}),s.onBeforeUnmount(()=>{g&&(g.disconnect(),g=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,T,$,M,R])=>{const O=T<=0?o.width:T,L=$<=0?o.height:$;y(l,E,O,L,M,R)});const y=(l,E,T,$,M,R="horizontal")=>{const O=l;if(o.index=E.findIndex(L=>L.path===O),R==="horizontal"){const L=T;if(L>0){o.width=T;const z=L*n.routes.length,W=-L/3,N=L*(E.length-1)+L/3;f&&(f.columnWidth=L,f.width=z,f.min=W,f.max=N),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-L*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${ut()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),u=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const T=o.height>0?o.height:n.height;return T>0&&(l.height=`${T}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function w(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const v=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),D=(l,E)=>{const T=n.routes.findIndex($=>{const M=l.path??l.name??"";return $.path==M});return o.width<=0?{}:{style:{left:`${T*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const T=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(T,{class:s.normalizeClass(p.value),style:s.normalizeStyle(u.value),"view-class":"fox-swiper-navigator__item",tag:ct,"view-tag-props":D,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:v.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}}),Tt=Object.freeze(Object.defineProperty({__proto__:null,default:wt},Symbol.toStringTag,{value:"Module"}));let yt="fox-";const xt=[],B=Object.assign({"/src/components/card-navigator/index.vue":F,"/src/components/default-navigator/index.vue":j,"/src/components/root-navigator/index.vue":at,"/src/components/swiper-navigator/index.vue":Tt}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];xt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}const Et={install(t){Y.forEach(e=>{t.component(`${yt}${e.name}`,e.component)})}};module.exports=Et;
package/dist/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as P, resolveComponent as S, openBlock as L, createBlock as R, withCtx as C, createVNode as H, Transition as G, resolveDynamicComponent as J, unref as N, computed as O, createElementBlock as K, createElementVNode as Q, normalizeStyle as B, renderSlot as Z, reactive as tt, onMounted as et, onBeforeUnmount as nt, watch as ot, normalizeClass as it } from "vue";
2
- import { OperationType as b } from "@fox-js/fox";
1
+ import { defineComponent as P, resolveComponent as O, openBlock as b, createBlock as R, withCtx as Y, createVNode as J, Transition as K, resolveDynamicComponent as Q, unref as F, computed as X, createElementBlock as Z, createElementVNode as tt, normalizeStyle as U, renderSlot as et, reactive as nt, onMounted as ot, onBeforeUnmount as it, watch as st, normalizeClass as at } from "vue";
2
+ import { FoxLeaveEnd as rt, OperationType as L } from "@fox-js/fox";
3
3
  /*!
4
- * @fox-js/navigation v4.0.1-10 Tue Mar 12 2024 21:40:43 GMT+0800 (中国标准时间)
4
+ * @fox-js/navigation v4.0.1-12 Sun Apr 28 2024 00:29:50 GMT+0800 (中国标准时间)
5
5
  */
6
- const st = /* @__PURE__ */ P({
6
+ const ct = /* @__PURE__ */ P({
7
7
  __name: "index",
8
8
  props: {
9
9
  routerViewName: {},
@@ -11,8 +11,8 @@ const st = /* @__PURE__ */ P({
11
11
  },
12
12
  setup(t) {
13
13
  return (e, n) => {
14
- const o = S("fox-router-view");
15
- return L(), R(o, {
14
+ const o = O("fox-router-view");
15
+ return b(), R(o, {
16
16
  class: "fox-card-navigator",
17
17
  "view-class": "fox-card-navigator__item",
18
18
  "view-active-class": "fox-card-navigator__item-active",
@@ -24,10 +24,10 @@ const st = /* @__PURE__ */ P({
24
24
  }, null, 8, ["transition", "name"]);
25
25
  };
26
26
  }
27
- }), at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
27
+ }), lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
28
28
  __proto__: null,
29
- default: st
30
- }, Symbol.toStringTag, { value: "Module" })), rt = /* @__PURE__ */ P({
29
+ default: ct
30
+ }, Symbol.toStringTag, { value: "Module" })), ut = /* @__PURE__ */ P({
31
31
  __name: "index",
32
32
  props: {
33
33
  routerViewName: {},
@@ -35,16 +35,16 @@ const st = /* @__PURE__ */ P({
35
35
  },
36
36
  setup(t) {
37
37
  return (e, n) => {
38
- const o = S("fox-router-view");
39
- return L(), R(o, {
38
+ const o = O("fox-router-view");
39
+ return b(), R(o, {
40
40
  transition: !1,
41
41
  multi: !1,
42
42
  name: e.routerViewName
43
43
  }, {
44
- default: C(({ Component: a }) => [
45
- H(G, { name: "fox-default-navigator__trans" }, {
46
- default: C(() => [
47
- (L(), R(J(a)))
44
+ default: Y(({ Component: i }) => [
45
+ J(K, { name: "fox-default-navigator__trans" }, {
46
+ default: Y(() => [
47
+ (b(), R(Q(i)))
48
48
  ]),
49
49
  _: 2
50
50
  }, 1024)
@@ -53,14 +53,14 @@ const st = /* @__PURE__ */ P({
53
53
  }, 8, ["name"]);
54
54
  };
55
55
  }
56
- }), ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
+ }), dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
57
57
  __proto__: null,
58
- default: rt
59
- }, Symbol.toStringTag, { value: "Module" })), Y = 10;
60
- function lt(t, e) {
61
- return t > e && t > Y ? "horizontal" : e > t && e > Y ? "vertical" : "";
58
+ default: ut
59
+ }, Symbol.toStringTag, { value: "Module" })), W = 10;
60
+ function ft(t, e) {
61
+ return t > e && t > W ? "horizontal" : e > t && e > W ? "vertical" : "";
62
62
  }
63
- function F() {
63
+ function j() {
64
64
  const t = {
65
65
  startX: 0,
66
66
  startY: 0,
@@ -79,16 +79,16 @@ function F() {
79
79
  return {
80
80
  move: (h) => {
81
81
  if (h.touches) {
82
- const c = h.touches[0];
83
- t.deltaX = c.clientX - t.startX, t.deltaY = c.clientY - t.startY, t.moveX = c.clientX, t.moveY = c.clientY;
82
+ const s = h.touches[0];
83
+ t.deltaX = s.clientX - t.startX, t.deltaY = s.clientY - t.startY, t.moveX = s.clientX, t.moveY = s.clientY;
84
84
  } else
85
85
  t.deltaX = h.clientX - t.startX, t.deltaY = h.clientY - t.startY, t.moveX = h.clientX, t.moveY = h.clientY;
86
- t.offsetX = Math.abs(t.deltaX), t.offsetY = Math.abs(t.deltaY), t.duration = Date.now() - t.startTime, t.direction || (t.direction = lt(t.offsetX, t.offsetY));
86
+ t.offsetX = Math.abs(t.deltaX), t.offsetY = Math.abs(t.deltaY), t.duration = Date.now() - t.startTime, t.direction || (t.direction = ft(t.offsetX, t.offsetY));
87
87
  },
88
88
  start: (h) => {
89
89
  if (o(), h.touches) {
90
- const c = h.touches[0];
91
- t.startX = c.clientX, t.startY = c.clientY;
90
+ const s = h.touches[0];
91
+ t.startX = s.clientX, t.startY = s.clientY;
92
92
  } else
93
93
  t.startX = h.clientX, t.startY = h.clientY;
94
94
  t.startTime = Date.now();
@@ -99,12 +99,12 @@ function F() {
99
99
  state: t
100
100
  };
101
101
  }
102
- function ut(t) {
102
+ function ht(t) {
103
103
  return t === window;
104
104
  }
105
- const dt = (t) => {
106
- const e = N(t);
107
- if (ut(e)) {
105
+ const mt = (t) => {
106
+ const e = F(t);
107
+ if (ht(e)) {
108
108
  const n = e.innerWidth, o = e.innerHeight;
109
109
  return {
110
110
  top: 0,
@@ -123,96 +123,104 @@ const dt = (t) => {
123
123
  width: 0,
124
124
  height: 0
125
125
  };
126
- }, ft = 15, ht = 300, mt = 200;
127
- function pt(t) {
126
+ }, pt = (t, e, n) => {
127
+ e = e ?? {
128
+ bubbles: !1,
129
+ cancelable: !1,
130
+ detail: void 0
131
+ };
132
+ const o = document.createEvent("Events");
133
+ let i = !0, u = !0;
134
+ for (let s in e)
135
+ s === "bubbles" ? i = !!e[s] : s === "cancelable" ? u = !!e[s] : o[s] = e[s];
136
+ o.initEvent(t, i, u), (n ?? document).dispatchEvent(o);
137
+ }, vt = 15, gt = 300, _t = 200;
138
+ function wt(t) {
128
139
  t.stopPropagation();
129
140
  }
130
- function gt(t, e) {
131
- (typeof t.cancelable != "boolean" || t.cancelable) && t.preventDefault(), e && pt(t);
132
- }
133
- function vt(t, e, n = 1) {
141
+ function Tt(t, e, n = 1) {
134
142
  return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
135
143
  }
136
- function I(t, e = 0, n, o = mt) {
137
- n === "end" ? t.style.transition = `transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)` : t.style.transition = "transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)", t.style.transform = `translate3d(${e}px, 0, 0)`;
144
+ function C(t, e = 0, n, o = _t) {
145
+ n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
146
+ }
147
+ function z(t) {
148
+ t.style.transition = "", t.style.transform = "";
149
+ }
150
+ const xt = /^matrix\((.+)\)$/;
151
+ function I(t) {
152
+ let e = 0;
153
+ const n = t, { transform: o } = window.getComputedStyle(n);
154
+ if (o) {
155
+ const i = xt.exec(o);
156
+ i && (e = +i[1].split(/,\s*/)[4]);
157
+ }
158
+ return e;
138
159
  }
139
160
  const V = /* @__PURE__ */ new WeakMap();
140
- function _t(t, e, n, o, a = 500, d, h = 1e3) {
141
- const c = {
161
+ function yt(t, e, n, o, i, u = 600, h = 60) {
162
+ const s = {
142
163
  active: !0,
143
164
  startDistance: 0,
144
165
  scrollDistance: 0,
145
166
  scrollTime: 0,
146
167
  moving: !1,
147
168
  transitionEndTrigger: null
148
- }, v = t.previousSibling, m = F(), p = (s, g, w, x) => {
149
- let T = g + c.startDistance;
150
- if (w === "end") {
151
- const r = dt(s);
152
- let y = r.width * e;
153
- T < y ? T = 0 : T = r.width;
154
- let _ = !1;
155
- x && x > 0 && (_ = !0, c.transitionEndTrigger = () => {
156
- c.moving = !1, d && s.classList.remove(d), T > 0 && typeof o == "function" && o();
157
- }), I(s, T, "end", x), v && I(v, 0, "", 0), !_ && T > 0 && typeof o == "function" && (c.moving = !1, o());
169
+ }, x = t.previousSibling, d = j(), v = (g, f, r, _) => {
170
+ let p = f + s.startDistance;
171
+ if (r === "end") {
172
+ const E = mt(g);
173
+ let c = E.width * e;
174
+ p < c ? p = 0 : p = E.width, s.transitionEndTrigger = () => {
175
+ s.moving = !1, i && g.classList.remove(i), setTimeout(() => {
176
+ x && z(x), p == 0 ? z(g) : pt(rt, {}, g), s.moving = !1;
177
+ }, h);
178
+ }, x && C(x, 0, "", 0), p > 0 && typeof o == "function" && o(), C(g, p, "end", _);
158
179
  } else
159
- T < 0 && (T = 0), I(s, T, "", 0);
160
- }, i = () => {
161
- t.style.transform = "", t.style.transition = "", c.transitionEndTrigger ? (c.transitionEndTrigger(), c.transitionEndTrigger = null, v && setTimeout(() => {
162
- v && (v.style.transform = "", v.style.transition = "");
163
- }, a)) : v && (v.style.transform = "", v.style.transition = "");
164
- }, u = /^matrix\((.+)\)$/, f = (s) => {
165
- if (m.start(s), c.scrollDistance = 0, c.moving) {
166
- const g = t, { transform: w } = window.getComputedStyle(g);
167
- if (w) {
168
- const x = u.exec(w);
169
- if (x) {
170
- const r = x[1].split(/,\s*/);
171
- c.scrollDistance = +r[4];
172
- }
173
- }
174
- }
175
- d && t.classList.add(d), c.startDistance = c.scrollDistance, c.transitionEndTrigger = null, c.moving = !0;
176
- }, E = (s) => {
177
- c.moving = !0, m.move(s), !m.isVertical() && (gt(s, !0), p(t, m.state.deltaX, "", 0));
180
+ p < 0 && (p = 0), C(g, p, "", 0);
181
+ }, T = () => {
182
+ s.transitionEndTrigger && (s.transitionEndTrigger(), s.transitionEndTrigger = null);
183
+ }, a = (g) => {
184
+ d.start(g), s.scrollDistance = 0, s.moving && (s.scrollDistance = I(t)), i && t.classList.add(i), s.transitionEndTrigger = null, s.moving = !0;
185
+ }, m = (g) => {
186
+ s.moving = !0, d.move(g), !(d.isVertical() || I(t) === 0 && d.state.deltaX < 0) && (wt(g), v(t, d.state.deltaX, "", 0));
178
187
  }, l = () => {
179
- if (m.isVertical()) {
180
- p(t, 0, "end", h);
188
+ if (d.isVertical() || I(t) === 0 && d.state.deltaX < 0)
181
189
  return;
182
- }
183
- const s = m.state.deltaX;
184
- if (s === 0) {
185
- d && t.classList.remove(d), c.moving = !1;
190
+ const f = d.state.deltaX;
191
+ if (f === 0) {
192
+ i && t.classList.remove(i), s.moving = !1;
186
193
  return;
187
194
  }
188
- const g = m.state.duration;
189
- if (g < ht && Math.abs(s) > ft) {
190
- const x = vt(s, g, n);
191
- p(t, x, "end", h);
195
+ const r = d.state.duration;
196
+ if (r < gt && Math.abs(f) > vt) {
197
+ const p = Tt(f, r, n);
198
+ v(t, p, "end", u);
192
199
  } else
193
- p(t, s, "end", h);
200
+ v(t, f, "end", u);
194
201
  };
195
- t.addEventListener("transitionend", i), t.addEventListener("touchstart", f), t.addEventListener("touchmove", E), t.addEventListener("touchend", l), t.addEventListener("touchcancel", l), V.set(t, {
196
- state: c,
197
- transitionend: i,
198
- touchstart: f,
199
- touchmove: E,
202
+ t.addEventListener("transitionend", T), t.addEventListener("touchstart", a), t.addEventListener("touchmove", m), t.addEventListener("touchend", l), t.addEventListener("touchcancel", l), V.set(t, {
203
+ state: s,
204
+ transitionend: T,
205
+ touchstart: a,
206
+ touchmove: m,
200
207
  touchend: l,
201
208
  touchcancel: l
202
209
  });
203
210
  }
204
- function wt(t) {
211
+ function Et(t) {
205
212
  const e = V.get(t);
206
213
  e && (V.delete(t), t.addEventListener("transitionend", e.transitionend), t.addEventListener("touchstart", e.touchstart), t.addEventListener("touchmove", e.touchmove), t.addEventListener("touchend", e.touchend), t.addEventListener("touchcancel", e.touchcancel));
207
214
  }
208
- const yt = /* @__PURE__ */ P({
215
+ const Dt = /* @__PURE__ */ P({
209
216
  __name: "index",
210
217
  props: {
211
218
  dragRemove: { type: Boolean, default: !0 },
212
219
  removeViewPage: {},
213
220
  removeMoveRatio: { default: 0.5 },
214
221
  momentumReduceRatio: { default: 1 },
215
- removeViewPageDuration: { default: 500 },
222
+ resetDelay: { default: 120 },
223
+ swipeDuration: { default: 60 },
216
224
  routerViewName: {},
217
225
  viewTag: { type: [Function, String], default: "div" },
218
226
  transition: { type: [Function, Boolean], default: !0 },
@@ -221,92 +229,95 @@ const yt = /* @__PURE__ */ P({
221
229
  setup(t) {
222
230
  const e = t;
223
231
  let n = null, o = null;
224
- function a(i) {
225
- return (i.params && i.params.animationType) ?? "slide";
232
+ function i(a) {
233
+ return (a.params && a.params.animationType) ?? "slide";
234
+ }
235
+ function u(a) {
236
+ return (a.params && a.params.dragRemove) ?? e.dragRemove;
226
237
  }
227
- const d = (i, u, f, E) => {
228
- if (f.opsType === b.Append || u) {
229
- const l = a(f), s = u ? "show" : "enter";
230
- if (s === "show" && (l === "pop" || o !== "leave" || (n ? a(n) : "") === "pop"))
238
+ const h = (a, m, l, g) => {
239
+ if (l.opsType === L.Append || m) {
240
+ const f = i(l), r = m ? "show" : "enter";
241
+ if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
231
242
  return;
232
- s === "enter" && (n = f, o = "enter");
233
- const g = `fox-root-navigator__${l}-${s}-from`, w = `fox-root-navigator__${l}-${s}-active`;
234
- i.classList.add(g), i.classList.add(w);
243
+ r === "enter" && (n = l, o = "enter");
244
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
245
+ a.classList.add(_), a.classList.add(p);
235
246
  }
236
- }, h = (i, u, f, E) => {
237
- if (f.opsType === b.Append || u) {
238
- const l = a(f), s = u ? "show" : "enter";
239
- if (s === "show" && (l === "pop" || o !== "leave" || (n ? a(n) : "") === "pop"))
247
+ }, s = (a, m, l, g) => {
248
+ if (l.opsType === L.Append || m) {
249
+ const f = i(l), r = m ? "show" : "enter";
250
+ if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
240
251
  return;
241
- const g = `fox-root-navigator__${l}-${s}-from`, w = `fox-root-navigator__${l}-${s}-to`;
242
- i.classList.remove(g), i.classList.add(w);
252
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
253
+ a.classList.remove(_), a.classList.add(p);
243
254
  }
244
- }, c = (i, u, f, E) => {
245
- if (f.opsType === b.Append || u) {
246
- const l = a(f), s = u ? "show" : "enter";
247
- if (s === "enter" && (n = null, o = null), l !== "pop") {
248
- const g = `fox-root-navigator__${l}-${s}-active`, w = `fox-root-navigator__${l}-${s}-to`;
249
- i.classList.remove(g), i.classList.remove(w);
255
+ }, x = (a, m, l, g) => {
256
+ if (l.opsType === L.Append || m) {
257
+ const r = i(l), _ = m ? "show" : "enter";
258
+ if (_ === "enter" && (n = null, o = null), r !== "pop") {
259
+ const p = `fox-root-navigator__${r}-${_}-active`, E = `fox-root-navigator__${r}-${_}-to`;
260
+ a.classList.remove(p), a.classList.remove(E);
250
261
  }
251
262
  }
252
- e.dragRemove && !u && f.opsType === b.Append && _t(
253
- i,
263
+ u(l) === !0 && !m && l.opsType === L.Append && yt(
264
+ a,
254
265
  e.removeMoveRatio,
255
266
  e.momentumReduceRatio,
256
267
  e.removeViewPage,
257
- e.removeViewPageDuration,
258
268
  "fox-root-navigator__item-moving",
259
- 1e3
269
+ e.swipeDuration,
270
+ e.resetDelay
260
271
  );
261
- }, v = (i, u, f, E) => {
262
- if (f.opsType === b.Append || u) {
263
- const l = a(f), s = u ? "hide" : "leave";
264
- if (s === "hide" && (l === "pop" || o !== "enter" || (n ? a(n) : "") === "pop"))
272
+ }, d = (a, m, l, g) => {
273
+ if (l.opsType === L.Append || m) {
274
+ const f = i(l), r = m ? "hide" : "leave";
275
+ if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
265
276
  return;
266
- s === "leave" && (n = f, o = "leave");
267
- const g = `fox-root-navigator__${l}-${s}-from`, w = `fox-root-navigator__${l}-${s}-active`;
268
- i.classList.add(g), i.classList.add(w);
277
+ r === "leave" && (n = l, o = "leave");
278
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
279
+ a.classList.add(_), a.classList.add(p);
269
280
  }
270
- }, m = (i, u, f, E) => {
271
- if (f.opsType === b.Append || u) {
272
- const l = a(f), s = u ? "hide" : "leave";
273
- if (s === "hide" && (l === "pop" || o !== "enter" || (n ? a(n) : "") === "pop"))
281
+ }, v = (a, m, l, g) => {
282
+ if (l.opsType === L.Append || m) {
283
+ const f = i(l), r = m ? "hide" : "leave";
284
+ if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
274
285
  return;
275
- const g = `fox-root-navigator__${l}-${s}-from`, w = `fox-root-navigator__${l}-${s}-to`;
276
- i.classList.remove(g), i.classList.add(w);
286
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
287
+ a.classList.remove(_), a.classList.add(p);
277
288
  }
278
- }, p = (i, u, f, E) => {
279
- if (f.opsType === b.Append || u) {
280
- const l = a(f), s = u ? "hide" : "leave";
281
- if (s === "leave" && (n = null, o = null), l !== "pop") {
282
- const g = `fox-root-navigator__${l}-${s}-active`, w = `fox-root-navigator__${l}-${s}-to`;
283
- i.classList.remove(g), i.classList.remove(w);
289
+ }, T = (a, m, l, g) => {
290
+ if (l.opsType === L.Append || m) {
291
+ const r = i(l), _ = m ? "hide" : "leave";
292
+ if (_ === "leave" && (n = null, o = null), r !== "pop") {
293
+ const p = `fox-root-navigator__${r}-${_}-active`, E = `fox-root-navigator__${r}-${_}-to`;
294
+ a.classList.remove(p), a.classList.remove(E);
284
295
  }
285
296
  }
286
- e.dragRemove && !u && wt(i);
297
+ u(l) && !m && Et(a);
287
298
  };
288
- return (i, u) => {
289
- const f = S("fox-router-view");
290
- return L(), R(f, {
299
+ return (a, m) => {
300
+ const l = O("fox-router-view");
301
+ return b(), R(l, {
291
302
  class: "fox-root-navigator",
292
- "view-class": i.viewClass,
293
- "before-enter": d,
294
- enter: h,
295
- "after-enter": c,
296
- "before-leave": v,
297
- leave: m,
298
- "after-leave": p,
303
+ "view-class": a.viewClass,
304
+ "before-enter": h,
305
+ enter: s,
306
+ "after-enter": x,
307
+ "before-leave": d,
308
+ leave: v,
309
+ "after-leave": T,
299
310
  multi: !0,
300
- name: i.routerViewName,
301
- "view-tag": i.viewTag,
302
- transition: i.transition
311
+ name: a.routerViewName,
312
+ "view-tag": a.viewTag,
313
+ transition: a.transition
303
314
  }, null, 8, ["view-class", "name", "view-tag", "transition"]);
304
315
  };
305
316
  }
306
- }), xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
317
+ }), Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
307
318
  __proto__: null,
308
- default: yt
309
- }, Symbol.toStringTag, { value: "Module" })), Tt = { class: "fox-swiper-navigator" }, Dt = /* @__PURE__ */ P({
319
+ default: Dt
320
+ }, Symbol.toStringTag, { value: "Module" })), bt = { class: "fox-swiper-navigator" }, $t = /* @__PURE__ */ P({
310
321
  __name: "swiper",
311
322
  props: {
312
323
  width: {},
@@ -315,41 +326,38 @@ const yt = /* @__PURE__ */ P({
315
326
  direction: {}
316
327
  },
317
328
  setup(t) {
318
- const e = t, n = O(() => {
329
+ const e = t, n = X(() => {
319
330
  const o = {
320
331
  transform: `translate3d(${e.scrollDistance}px, 0, 0)`,
321
332
  width: `${e.width}`
322
333
  };
323
334
  return e.scrollDuration > 0 && (o["transition-duration"] = `${e.scrollDuration}ms`), o;
324
335
  });
325
- return (o, a) => (L(), K("div", Tt, [
326
- Q("div", {
336
+ return (o, i) => (b(), Z("div", bt, [
337
+ tt("div", {
327
338
  class: "fox-swiper-navigator__inner",
328
- style: B(n.value)
339
+ style: U(n.value)
329
340
  }, [
330
- Z(o.$slots, "default")
341
+ et(o.$slots, "default")
331
342
  ], 4)
332
343
  ]));
333
344
  }
334
345
  });
335
- let Et = 0;
336
- function bt() {
337
- return ++Et;
346
+ let Mt = 0;
347
+ function Rt() {
348
+ return ++Mt;
338
349
  }
339
- const Lt = 15, $t = 300, Mt = 200;
340
- function Rt(t) {
350
+ const Pt = 15, Xt = 300, Ot = 200;
351
+ function St(t) {
341
352
  t.stopPropagation();
342
353
  }
343
- function Pt(t, e) {
344
- (typeof t.cancelable != "boolean" || t.cancelable) && t.preventDefault(), e && Rt(t);
345
- }
346
- function Ot(t, e, n = 1) {
354
+ function At(t, e, n = 1) {
347
355
  return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
348
356
  }
349
- function z(t, e = 0, n, o = Mt) {
350
- n === "end" ? t.style.transition = `transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)` : t.style.transition = "transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)", t.style.transform = `translate3d(${e}px, 0, 0)`;
357
+ function N(t, e = 0, n, o = Ot) {
358
+ n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
351
359
  }
352
- class St {
360
+ class Ct {
353
361
  /**
354
362
  * width
355
363
  */
@@ -444,60 +452,58 @@ class St {
444
452
  * @param momentumReduceRatio
445
453
  *
446
454
  */
447
- constructor(e, n, o, a, d, h) {
448
- this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = a, this.moveRatio = d, this.momentumReduceRatio = h;
455
+ constructor(e, n, o, i, u, h) {
456
+ this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = i, this.moveRatio = u, this.momentumReduceRatio = h;
449
457
  }
450
458
  /**
451
459
  * 打开drag支持
452
460
  */
453
461
  open() {
454
- const e = this.el, n = F(), o = (a, d, h, c) => {
455
- let v = d + this.startDistance;
456
- const m = this.columnWidth * this.moveRatio;
462
+ const e = this.el, n = j(), o = (i, u, h, s) => {
463
+ let x = u + this.startDistance;
464
+ const d = this.columnWidth * this.moveRatio;
457
465
  if (h === "end") {
458
- if (d == 0) {
466
+ if (u == 0) {
459
467
  this.moving = !1;
460
468
  return;
461
469
  }
462
- Math.abs(d) > m ? d > 0 ? v = this.startDistance + this.columnWidth : v = this.startDistance - this.columnWidth : v = this.startDistance;
463
- let p = -v;
464
- p < 0 ? p = 0 : p > this.width - this.columnWidth && (p = this.width - this.columnWidth);
465
- const i = Math.floor(p / this.columnWidth);
466
- this.isPageOpened(i) || this.openPage(i), v = -i * this.columnWidth, c && c > 0 && (this.transitionEndTrigger = () => {
467
- this.moving = !1, this.pageOpened(i);
468
- }), z(a, v, "end", c), this.scrollDistance = v;
470
+ Math.abs(u) > d ? u > 0 ? x = this.startDistance + this.columnWidth : x = this.startDistance - this.columnWidth : x = this.startDistance;
471
+ let v = -x;
472
+ v < 0 ? v = 0 : v > this.width - this.columnWidth && (v = this.width - this.columnWidth);
473
+ const T = Math.floor(v / this.columnWidth);
474
+ this.isPageOpened(T) || this.openPage(T), x = -T * this.columnWidth, s && s > 0 && (this.transitionEndTrigger = () => {
475
+ this.moving = !1, this.pageOpened(T);
476
+ }), N(i, x, "end", s), this.scrollDistance = x;
469
477
  } else {
470
- if (Math.abs(d) > m) {
471
- let i = 0;
472
- if (d > 0 ? i = Math.abs(this.startDistance + this.columnWidth) : i = Math.abs(this.startDistance - this.columnWidth), i >= 0 && i < this.width) {
473
- const u = Math.floor(i / this.columnWidth);
474
- this.isPageOpened(u) || this.openPage(u);
478
+ if (Math.abs(u) > d) {
479
+ let T = 0;
480
+ if (u > 0 ? T = Math.abs(this.startDistance + this.columnWidth) : T = Math.abs(this.startDistance - this.columnWidth), T >= 0 && T < this.width) {
481
+ const a = Math.floor(T / this.columnWidth);
482
+ this.isPageOpened(a) || this.openPage(a);
475
483
  }
476
484
  }
477
- let p = -v;
478
- p < this.min ? p = this.min : p > this.max && (p = this.max), z(a, -p, "", 0);
485
+ let v = -x;
486
+ v < this.min ? v = this.min : v > this.max && (v = this.max), N(i, -v, "", 0);
479
487
  }
480
488
  };
481
489
  this.transitionend = () => {
482
490
  e.style.transition = "", this.transitionEndTrigger && (this.transitionEndTrigger(), this.transitionEndTrigger = null);
483
- }, this.touchstart = (a) => {
484
- this.moving || (n.start(a), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
485
- }, this.touchmove = (a) => {
486
- n.move(a), !n.isVertical() && (Pt(a, !0), o(e, n.state.deltaX, "", 0));
491
+ }, this.touchstart = (i) => {
492
+ this.moving || (n.start(i), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
493
+ }, this.touchmove = (i) => {
494
+ n.move(i), !n.isVertical() && (St(i), o(e, n.state.deltaX, "", 0));
487
495
  }, this.touchend = () => {
488
- if (n.isVertical()) {
489
- o(e, 0, "end", this.swipeDuration);
496
+ if (n.isVertical())
490
497
  return;
491
- }
492
- const a = n.state.deltaX;
493
- if (a == 0)
498
+ const i = n.state.deltaX;
499
+ if (i == 0)
494
500
  return;
495
- const d = n.state.duration;
496
- if (d < $t && Math.abs(a) > Lt) {
497
- const c = Ot(a, d, this.momentumReduceRatio);
498
- o(e, c, "end", this.swipeDuration);
501
+ const u = n.state.duration;
502
+ if (u < Xt && Math.abs(i) > Pt) {
503
+ const s = At(i, u, this.momentumReduceRatio);
504
+ o(e, s, "end", this.swipeDuration);
499
505
  } else
500
- o(e, a, "end", this.swipeDuration);
506
+ o(e, i, "end", this.swipeDuration);
501
507
  }, e.addEventListener("transitionend", this.transitionend), e.addEventListener("touchstart", this.touchstart), e.addEventListener("touchmove", this.touchmove), e.addEventListener("touchend", this.touchend), e.addEventListener("touchcancel", this.touchend);
502
508
  }
503
509
  /**
@@ -508,17 +514,17 @@ class St {
508
514
  this.transitionend && e.addEventListener("transitionend", this.transitionend), this.touchstart && e.addEventListener("touchstart", this.touchstart), this.touchmove && e.addEventListener("touchmove", this.touchmove), this.touchend && e.addEventListener("touchend", this.touchend), this.touchcancel && e.addEventListener("touchcancel", this.touchcancel), this.el = null;
509
515
  }
510
516
  }
511
- function Xt(t, e, n, o, a, d) {
512
- return new St(t, e, n, o, a, d);
517
+ function It(t, e, n, o, i, u) {
518
+ return new Ct(t, e, n, o, i, u);
513
519
  }
514
- function At(t) {
515
- const e = N(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), a = parseFloat(n.getPropertyValue("padding-right")), d = parseFloat(n.getPropertyValue("padding-top")), h = parseFloat(n.getPropertyValue("padding-bottom"));
520
+ function Vt(t) {
521
+ const e = F(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), i = parseFloat(n.getPropertyValue("padding-right")), u = parseFloat(n.getPropertyValue("padding-top")), h = parseFloat(n.getPropertyValue("padding-bottom"));
516
522
  return {
517
- width: e.clientWidth - o - a,
518
- height: e.clientHeight - d - h
523
+ width: e.clientWidth - o - i,
524
+ height: e.clientHeight - u - h
519
525
  };
520
526
  }
521
- const It = /* @__PURE__ */ P({
527
+ const Yt = /* @__PURE__ */ P({
522
528
  __name: "index",
523
529
  props: {
524
530
  activePath: {},
@@ -539,49 +545,49 @@ const It = /* @__PURE__ */ P({
539
545
  },
540
546
  emits: ["update:activePath"],
541
547
  setup(t, { emit: e }) {
542
- const n = t, o = tt({
548
+ const n = t, o = nt({
543
549
  scrollDistance: 0,
544
550
  index: -1,
545
551
  openedIndexList: [],
546
552
  width: n.width,
547
553
  height: n.height
548
- }), a = e, d = () => o.scrollDistance, h = (r) => {
549
- if (o.openedIndexList.indexOf(r) === -1) {
550
- o.openedIndexList.push(r);
551
- const y = n.routes[r];
554
+ }), i = e, u = () => o.scrollDistance, h = (c) => {
555
+ if (o.openedIndexList.indexOf(c) === -1) {
556
+ o.openedIndexList.push(c);
557
+ const y = n.routes[c];
552
558
  try {
553
- n.openViewPage(y, r);
554
- } catch (_) {
555
- console.error(_);
559
+ n.openViewPage(y, c);
560
+ } catch (w) {
561
+ console.error(w);
556
562
  }
557
563
  }
558
- }, c = (r) => o.openedIndexList.indexOf(r) !== -1, v = (r) => {
559
- o.index = r, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
560
- const y = n.routes[r];
561
- a("update:activePath", y.path);
564
+ }, s = (c) => o.openedIndexList.indexOf(c) !== -1, x = (c) => {
565
+ o.index = c, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
566
+ const y = n.routes[c];
567
+ i("update:activePath", y.path);
562
568
  };
563
- let m = null;
564
- n.draggable && (m = Xt(
565
- d,
569
+ let d = null;
570
+ n.draggable && (d = It(
571
+ u,
566
572
  h,
567
- c,
568
- v,
573
+ s,
574
+ x,
569
575
  n.moveRatio,
570
576
  n.momentumReduceRatio
571
577
  ));
572
- let p = null;
573
- et(() => {
574
- const r = s(), y = () => {
575
- const _ = At(r);
576
- i(n.activePath, n.routes, _.width, _.height, n.swipeDuration, n.direction);
578
+ let v = null;
579
+ ot(() => {
580
+ const c = f(), y = () => {
581
+ const w = Vt(c);
582
+ T(n.activePath, n.routes, w.width, w.height, n.swipeDuration, n.direction);
577
583
  };
578
- if (window.ResizeObserver && (p = new window.ResizeObserver(y), p.observe(r)), y(), m) {
579
- const _ = w();
580
- m.el = _, m.open();
584
+ if (window.ResizeObserver && (v = new window.ResizeObserver(y), v.observe(c)), y(), d) {
585
+ const w = _();
586
+ d.el = w, d.open();
581
587
  }
582
- }), nt(() => {
583
- p && (p.disconnect(), p = null), m && m.close();
584
- }), ot(
588
+ }), it(() => {
589
+ v && (v.disconnect(), v = null), d && d.close();
590
+ }), st(
585
591
  [
586
592
  () => n.activePath,
587
593
  () => n.routes,
@@ -590,93 +596,93 @@ const It = /* @__PURE__ */ P({
590
596
  () => n.swipeDuration,
591
597
  () => n.direction
592
598
  ],
593
- ([r, y, _, $, M, X]) => {
594
- const A = _ <= 0 ? o.width : _, D = $ <= 0 ? o.height : $;
595
- i(r, y, A, D, M, X);
599
+ ([c, y, w, $, M, S]) => {
600
+ const A = w <= 0 ? o.width : w, D = $ <= 0 ? o.height : $;
601
+ T(c, y, A, D, M, S);
596
602
  }
597
603
  );
598
- const i = (r, y, _, $, M, X = "horizontal") => {
599
- const A = r;
600
- if (o.index = y.findIndex((D) => D.path === A), X === "horizontal") {
601
- const D = _;
604
+ const T = (c, y, w, $, M, S = "horizontal") => {
605
+ const A = c;
606
+ if (o.index = y.findIndex((D) => D.path === A), S === "horizontal") {
607
+ const D = w;
602
608
  if (D > 0) {
603
- o.width = _;
604
- const j = D * n.routes.length, k = -D / 3, q = D * (y.length - 1) + D / 3;
605
- m && (m.columnWidth = D, m.width = j, m.min = k, m.max = q), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -D * o.index);
609
+ o.width = w;
610
+ const q = D * n.routes.length, H = -D / 3, G = D * (y.length - 1) + D / 3;
611
+ d && (d.columnWidth = D, d.width = q, d.min = H, d.max = G), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -D * o.index);
606
612
  }
607
613
  }
608
- m && (m.swipeDuration = M);
609
- }, u = `fox-swiper-navigator-${bt()}`, f = O(() => {
610
- const r = [u];
611
- return n.customClass && r.push(n.customClass), r;
612
- }), E = O(() => {
613
- const r = {}, y = o.width > 0 ? o.width : n.width;
614
- y > 0 && (r.width = `${y}px`);
615
- const _ = o.height > 0 ? o.height : n.height;
616
- return _ > 0 && (r.height = `${_}px`), n.customStyle && Object.assign(r, n.customStyle), r;
614
+ d && (d.swipeDuration = M);
615
+ }, a = `fox-swiper-navigator-${Rt()}`, m = X(() => {
616
+ const c = [a];
617
+ return n.customClass && c.push(n.customClass), c;
618
+ }), l = X(() => {
619
+ const c = {}, y = o.width > 0 ? o.width : n.width;
620
+ y > 0 && (c.width = `${y}px`);
621
+ const w = o.height > 0 ? o.height : n.height;
622
+ return w > 0 && (c.height = `${w}px`), n.customStyle && Object.assign(c, n.customStyle), c;
617
623
  });
618
- let l = null;
619
- function s() {
620
- return l || (l = document.querySelector(`.${u}`), l);
621
- }
622
624
  let g = null;
623
- function w() {
624
- return g || (g = document.querySelector(`.${u}>.fox-swiper-navigator__inner`), g);
625
+ function f() {
626
+ return g || (g = document.querySelector(`.${a}`), g);
627
+ }
628
+ let r = null;
629
+ function _() {
630
+ return r || (r = document.querySelector(`.${a}>.fox-swiper-navigator__inner`), r);
625
631
  }
626
- const x = O(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), T = (r, y) => {
627
- const _ = n.routes.findIndex(($) => {
628
- const M = r.path ?? r.name ?? "";
632
+ const p = X(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), E = (c, y) => {
633
+ const w = n.routes.findIndex(($) => {
634
+ const M = c.path ?? c.name ?? "";
629
635
  return $.path == M;
630
636
  });
631
637
  return o.width <= 0 ? {} : {
632
638
  style: {
633
- left: `${_ * o.width}px`,
639
+ left: `${w * o.width}px`,
634
640
  width: `${o.width}px`
635
641
  }
636
642
  };
637
643
  };
638
- return (r, y) => {
639
- const _ = S("fox-router-view");
640
- return L(), R(_, {
641
- class: it(f.value),
642
- style: B(E.value),
644
+ return (c, y) => {
645
+ const w = O("fox-router-view");
646
+ return b(), R(w, {
647
+ class: at(m.value),
648
+ style: U(l.value),
643
649
  "view-class": "fox-swiper-navigator__item",
644
- tag: Dt,
645
- "view-tag-props": T,
650
+ tag: $t,
651
+ "view-tag-props": E,
646
652
  multi: !0,
647
- name: r.routerViewName,
648
- transition: r.transition,
653
+ name: c.routerViewName,
654
+ transition: c.transition,
649
655
  "scroll-distance": o.scrollDistance,
650
- "scroll-duration": r.scrollDuration,
651
- direction: r.direction,
652
- width: x.value
656
+ "scroll-duration": c.scrollDuration,
657
+ direction: c.direction,
658
+ width: p.value
653
659
  }, null, 8, ["class", "style", "name", "transition", "scroll-distance", "scroll-duration", "direction", "width"]);
654
660
  };
655
661
  }
656
- }), Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
662
+ }), Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
657
663
  __proto__: null,
658
- default: It
664
+ default: Yt
659
665
  }, Symbol.toStringTag, { value: "Module" }));
660
- let Ct = "fox-";
661
- const Yt = [], W = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": at, "/src/components/default-navigator/index.vue": ct, "/src/components/root-navigator/index.vue": xt, "/src/components/swiper-navigator/index.vue": Vt }), U = [];
662
- for (const t in W) {
666
+ let zt = "fox-";
667
+ const Nt = [], B = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": lt, "/src/components/default-navigator/index.vue": dt, "/src/components/root-navigator/index.vue": Lt, "/src/components/swiper-navigator/index.vue": Wt }), k = [];
668
+ for (const t in B) {
663
669
  let e = /src\/components\/(.*)\/index.vue/.exec(t)[1];
664
- Yt.indexOf(e) === -1 && U.push({
670
+ Nt.indexOf(e) === -1 && k.push({
665
671
  name: e,
666
- component: W[t].default
672
+ component: B[t].default
667
673
  });
668
674
  }
669
- const Nt = {
675
+ const Ut = {
670
676
  /**
671
677
  * 安装
672
678
  * @param app
673
679
  */
674
680
  install(t) {
675
- U.forEach((e) => {
676
- t.component(`${Ct}${e.name}`, e.component);
681
+ k.forEach((e) => {
682
+ t.component(`${zt}${e.name}`, e.component);
677
683
  });
678
684
  }
679
685
  };
680
686
  export {
681
- Nt as default
687
+ Ut as default
682
688
  };
package/dist/index.umd.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(i,E){typeof exports=="object"&&typeof module<"u"?module.exports=E(require("vue"),require("@fox-js/fox")):typeof define=="function"&&define.amd?define(["vue","@fox-js/fox"],E):(i=typeof globalThis<"u"?globalThis:i||self,i.FoxNavigation=E(i.Vue,i.Fox))})(this,function(i,E){"use strict";/*!
2
- * @fox-js/navigation v4.0.1-10 Tue Mar 12 2024 21:40:43 GMT+0800 (中国标准时间)
3
- */const B=Object.freeze(Object.defineProperty({__proto__:null,default:i.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=i.resolveComponent("fox-router-view");return i.openBlock(),i.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:e.transition,multi:!0,name:e.routerViewName},null,8,["transition","name"])}}})},Symbol.toStringTag,{value:"Module"})),z=Object.freeze(Object.defineProperty({__proto__:null,default:i.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=i.resolveComponent("fox-router-view");return i.openBlock(),i.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:i.withCtx(({Component:r})=>[i.createVNode(i.Transition,{name:"fox-default-navigator__trans"},{default:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r)))]),_:2},1024)]),_:1},8,["name"])}}})},Symbol.toStringTag,{value:"Module"})),S=10;function Y(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function V(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:h=>{if(h.touches){const l=h.touches[0];t.deltaX=l.clientX-t.startX,t.deltaY=l.clientY-t.startY,t.moveX=l.clientX,t.moveY=l.clientY}else t.deltaX=h.clientX-t.startX,t.deltaY=h.clientY-t.startY,t.moveX=h.clientX,t.moveY=h.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=Y(t.offsetX,t.offsetY))},start:h=>{if(o(),h.touches){const l=h.touches[0];t.startX=l.clientX,t.startY=l.clientY}else t.startX=h.clientX,t.startY=h.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function W(t){return t===window}const N=t=>{const e=i.unref(t);if(W(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},F=15,k=300,j=200;function U(t){t.stopPropagation()}function q(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&U(t)}function H(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function R(t,e=0,n,o=j){n==="end"?t.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:t.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",t.style.transform=`translate3d(${e}px, 0, 0)`}const O=new WeakMap;function G(t,e,n,o,r=500,f,h=1e3){const l={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},_=t.previousSibling,m=V(),g=(a,v,y,x)=>{let D=v+l.startDistance;if(y==="end"){const c=N(a);let T=c.width*e;D<T?D=0:D=c.width;let w=!1;x&&x>0&&(w=!0,l.transitionEndTrigger=()=>{l.moving=!1,f&&a.classList.remove(f),D>0&&typeof o=="function"&&o()}),R(a,D,"end",x),_&&R(_,0,"",0),!w&&D>0&&typeof o=="function"&&(l.moving=!1,o())}else D<0&&(D=0),R(a,D,"",0)},s=()=>{t.style.transform="",t.style.transition="",l.transitionEndTrigger?(l.transitionEndTrigger(),l.transitionEndTrigger=null,_&&setTimeout(()=>{_&&(_.style.transform="",_.style.transition="")},r)):_&&(_.style.transform="",_.style.transition="")},u=/^matrix\((.+)\)$/,p=a=>{if(m.start(a),l.scrollDistance=0,l.moving){const v=t,{transform:y}=window.getComputedStyle(v);if(y){const x=u.exec(y);if(x){const c=x[1].split(/,\s*/);l.scrollDistance=+c[4]}}}f&&t.classList.add(f),l.startDistance=l.scrollDistance,l.transitionEndTrigger=null,l.moving=!0},b=a=>{l.moving=!0,m.move(a),!m.isVertical()&&(q(a,!0),g(t,m.state.deltaX,"",0))},d=()=>{if(m.isVertical()){g(t,0,"end",h);return}const a=m.state.deltaX;if(a===0){f&&t.classList.remove(f),l.moving=!1;return}const v=m.state.duration;if(v<k&&Math.abs(a)>F){const x=H(a,v,n);g(t,x,"end",h)}else g(t,a,"end",h)};t.addEventListener("transitionend",s),t.addEventListener("touchstart",p),t.addEventListener("touchmove",b),t.addEventListener("touchend",d),t.addEventListener("touchcancel",d),O.set(t,{state:l,transitionend:s,touchstart:p,touchmove:b,touchend:d,touchcancel:d})}function J(t){const e=O.get(t);e&&(O.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const K=Object.freeze(Object.defineProperty({__proto__:null,default:i.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},removeViewPageDuration:{default:500},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function r(s){return(s.params&&s.params.animationType)??"slide"}const f=(s,u,p,b)=>{if(p.opsType===E.OperationType.Append||u){const d=r(p),a=u?"show":"enter";if(a==="show"&&(d==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;a==="enter"&&(n=p,o="enter");const v=`fox-root-navigator__${d}-${a}-from`,y=`fox-root-navigator__${d}-${a}-active`;s.classList.add(v),s.classList.add(y)}},h=(s,u,p,b)=>{if(p.opsType===E.OperationType.Append||u){const d=r(p),a=u?"show":"enter";if(a==="show"&&(d==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;const v=`fox-root-navigator__${d}-${a}-from`,y=`fox-root-navigator__${d}-${a}-to`;s.classList.remove(v),s.classList.add(y)}},l=(s,u,p,b)=>{if(p.opsType===E.OperationType.Append||u){const d=r(p),a=u?"show":"enter";if(a==="enter"&&(n=null,o=null),d!=="pop"){const v=`fox-root-navigator__${d}-${a}-active`,y=`fox-root-navigator__${d}-${a}-to`;s.classList.remove(v),s.classList.remove(y)}}e.dragRemove&&!u&&p.opsType===E.OperationType.Append&&G(s,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,e.removeViewPageDuration,"fox-root-navigator__item-moving",1e3)},_=(s,u,p,b)=>{if(p.opsType===E.OperationType.Append||u){const d=r(p),a=u?"hide":"leave";if(a==="hide"&&(d==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;a==="leave"&&(n=p,o="leave");const v=`fox-root-navigator__${d}-${a}-from`,y=`fox-root-navigator__${d}-${a}-active`;s.classList.add(v),s.classList.add(y)}},m=(s,u,p,b)=>{if(p.opsType===E.OperationType.Append||u){const d=r(p),a=u?"hide":"leave";if(a==="hide"&&(d==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;const v=`fox-root-navigator__${d}-${a}-from`,y=`fox-root-navigator__${d}-${a}-to`;s.classList.remove(v),s.classList.add(y)}},g=(s,u,p,b)=>{if(p.opsType===E.OperationType.Append||u){const d=r(p),a=u?"hide":"leave";if(a==="leave"&&(n=null,o=null),d!=="pop"){const v=`fox-root-navigator__${d}-${a}-active`,y=`fox-root-navigator__${d}-${a}-to`;s.classList.remove(v),s.classList.remove(y)}}e.dragRemove&&!u&&J(s)};return(s,u)=>{const p=i.resolveComponent("fox-router-view");return i.openBlock(),i.createBlock(p,{class:"fox-root-navigator","view-class":s.viewClass,"before-enter":f,enter:h,"after-enter":l,"before-leave":_,leave:m,"after-leave":g,multi:!0,name:s.routerViewName,"view-tag":s.viewTag,transition:s.transition},null,8,["view-class","name","view-tag","transition"])}}})},Symbol.toStringTag,{value:"Module"})),Q={class:"fox-swiper-navigator"},Z=i.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=i.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,r)=>(i.openBlock(),i.createElementBlock("div",Q,[i.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:i.normalizeStyle(n.value)},[i.renderSlot(o.$slots,"default")],4)]))}});let tt=0;function et(){return++tt}const nt=15,ot=300,it=200;function st(t){t.stopPropagation()}function at(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&st(t)}function rt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function X(t,e=0,n,o=it){n==="end"?t.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:t.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",t.style.transform=`translate3d(${e}px, 0, 0)`}class ct{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,r,f,h){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=r,this.moveRatio=f,this.momentumReduceRatio=h}open(){const e=this.el,n=V(),o=(r,f,h,l)=>{let _=f+this.startDistance;const m=this.columnWidth*this.moveRatio;if(h==="end"){if(f==0){this.moving=!1;return}Math.abs(f)>m?f>0?_=this.startDistance+this.columnWidth:_=this.startDistance-this.columnWidth:_=this.startDistance;let g=-_;g<0?g=0:g>this.width-this.columnWidth&&(g=this.width-this.columnWidth);const s=Math.floor(g/this.columnWidth);this.isPageOpened(s)||this.openPage(s),_=-s*this.columnWidth,l&&l>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(s)}),X(r,_,"end",l),this.scrollDistance=_}else{if(Math.abs(f)>m){let s=0;if(f>0?s=Math.abs(this.startDistance+this.columnWidth):s=Math.abs(this.startDistance-this.columnWidth),s>=0&&s<this.width){const u=Math.floor(s/this.columnWidth);this.isPageOpened(u)||this.openPage(u)}}let g=-_;g<this.min?g=this.min:g>this.max&&(g=this.max),X(r,-g,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=r=>{this.moving||(n.start(r),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=r=>{n.move(r),!n.isVertical()&&(at(r,!0),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical()){o(e,0,"end",this.swipeDuration);return}const r=n.state.deltaX;if(r==0)return;const f=n.state.duration;if(f<ot&&Math.abs(r)>nt){const l=rt(r,f,this.momentumReduceRatio);o(e,l,"end",this.swipeDuration)}else o(e,r,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function lt(t,e,n,o,r,f){return new ct(t,e,n,o,r,f)}function dt(t){const e=i.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),r=parseFloat(n.getPropertyValue("padding-right")),f=parseFloat(n.getPropertyValue("padding-top")),h=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-r,height:e.clientHeight-f-h}}const ut=Object.freeze(Object.defineProperty({__proto__:null,default:i.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=i.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),r=e,f=()=>o.scrollDistance,h=c=>{if(o.openedIndexList.indexOf(c)===-1){o.openedIndexList.push(c);const T=n.routes[c];try{n.openViewPage(T,c)}catch(w){console.error(w)}}},l=c=>o.openedIndexList.indexOf(c)!==-1,_=c=>{o.index=c,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const T=n.routes[c];r("update:activePath",T.path)};let m=null;n.draggable&&(m=lt(f,h,l,_,n.moveRatio,n.momentumReduceRatio));let g=null;i.onMounted(()=>{const c=a(),T=()=>{const w=dt(c);s(n.activePath,n.routes,w.width,w.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(g=new window.ResizeObserver(T),g.observe(c)),T(),m){const w=y();m.el=w,m.open()}}),i.onBeforeUnmount(()=>{g&&(g.disconnect(),g=null),m&&m.close()}),i.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([c,T,w,L,M,P])=>{const C=w<=0?o.width:w,$=L<=0?o.height:L;s(c,T,C,$,M,P)});const s=(c,T,w,L,M,P="horizontal")=>{const C=c;if(o.index=T.findIndex($=>$.path===C),P==="horizontal"){const $=w;if($>0){o.width=w;const ht=$*n.routes.length,mt=-$/3,gt=$*(T.length-1)+$/3;m&&(m.columnWidth=$,m.width=ht,m.min=mt,m.max=gt),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-$*o.index)}}m&&(m.swipeDuration=M)},u=`fox-swiper-navigator-${et()}`,p=i.computed(()=>{const c=[u];return n.customClass&&c.push(n.customClass),c}),b=i.computed(()=>{const c={},T=o.width>0?o.width:n.width;T>0&&(c.width=`${T}px`);const w=o.height>0?o.height:n.height;return w>0&&(c.height=`${w}px`),n.customStyle&&Object.assign(c,n.customStyle),c});let d=null;function a(){return d||(d=document.querySelector(`.${u}`),d)}let v=null;function y(){return v||(v=document.querySelector(`.${u}>.fox-swiper-navigator__inner`),v)}const x=i.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),D=(c,T)=>{const w=n.routes.findIndex(L=>{const M=c.path??c.name??"";return L.path==M});return o.width<=0?{}:{style:{left:`${w*o.width}px`,width:`${o.width}px`}}};return(c,T)=>{const w=i.resolveComponent("fox-router-view");return i.openBlock(),i.createBlock(w,{class:i.normalizeClass(p.value),style:i.normalizeStyle(b.value),"view-class":"fox-swiper-navigator__item",tag:Z,"view-tag-props":D,multi:!0,name:c.routerViewName,transition:c.transition,"scroll-distance":o.scrollDistance,"scroll-duration":c.scrollDuration,direction:c.direction,width:x.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}})},Symbol.toStringTag,{value:"Module"}));let ft="fox-";const pt=[],A=Object.assign({"/src/components/card-navigator/index.vue":B,"/src/components/default-navigator/index.vue":z,"/src/components/root-navigator/index.vue":K,"/src/components/swiper-navigator/index.vue":ut}),I=[];for(const t in A){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];pt.indexOf(e)===-1&&I.push({name:e,component:A[t].default})}return{install(t){I.forEach(e=>{t.component(`${ft}${e.name}`,e.component)})}}});
1
+ (function(s,D){typeof exports=="object"&&typeof module<"u"?module.exports=D(require("vue"),require("@fox-js/fox")):typeof define=="function"&&define.amd?define(["vue","@fox-js/fox"],D):(s=typeof globalThis<"u"?globalThis:s||self,s.FoxNavigation=D(s.Vue,s.Fox))})(this,function(s,D){"use strict";/*!
2
+ * @fox-js/navigation v4.0.1-12 Sun Apr 28 2024 00:29:50 GMT+0800 (中国标准时间)
3
+ */const z=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:e.transition,multi:!0,name:e.routerViewName},null,8,["transition","name"])}}})},Symbol.toStringTag,{value:"Module"})),W=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}})},Symbol.toStringTag,{value:"Module"})),S=10;function N(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function A(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=N(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function F(t){return t===window}const k=t=>{const e=s.unref(t);if(F(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},j=(t,e,n)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const o=document.createEvent("Events");let i=!0,u=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?u=!!e[a]:o[a]=e[a];o.initEvent(t,i,u),(n??document).dispatchEvent(o)},U=15,q=300,H=200;function G(t){t.stopPropagation()}function J(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function R(t,e=0,n,o=H){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function I(t){t.style.transition="",t.style.transform=""}const K=/^matrix\((.+)\)$/;function O(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const i=K.exec(o);i&&(e=+i[1].split(/,\s*/)[4])}return e}const P=new WeakMap;function Q(t,e,n,o,i,u=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=A(),v=(_,h,c,w)=>{let g=h+a.startDistance;if(c==="end"){const L=k(_);let l=L.width*e;g<l?g=0:g=L.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&I(x),g==0?I(_):j(D.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&R(x,0,"",0),g>0&&typeof o=="function"&&o(),R(_,g,"end",w)}else g<0&&(g=0),R(_,g,"",0)},y=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=O(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||O(t)===0&&f.state.deltaX<0)&&(G(_),v(t,f.state.deltaX,"",0))},d=()=>{if(f.isVertical()||O(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<q&&Math.abs(h)>U){const g=J(h,c,n);v(t,g,"end",u)}else v(t,h,"end",u)};t.addEventListener("transitionend",y),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",d),t.addEventListener("touchcancel",d),P.set(t,{state:a,transitionend:y,touchstart:r,touchmove:p,touchend:d,touchcancel:d})}function Z(t){const e=P.get(t);e&&(P.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const tt=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function u(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=d,o="enter");const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(g)}},a=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(g)}},x=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),w=p?"show":"enter";if(w==="enter"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${w}-active`,L=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)===!0&&!p&&d.opsType===D.OperationType.Append&&Q(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=d,o="leave");const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(g)}},v=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(g)}},y=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),w=p?"hide":"leave";if(w==="leave"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${w}-active`,L=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)&&!p&&Z(r)};return(r,p)=>{const d=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(d,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:v,"after-leave":y,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}})},Symbol.toStringTag,{value:"Module"})),et={class:"fox-swiper-navigator"},nt=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,i)=>(s.openBlock(),s.createElementBlock("div",et,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.renderSlot(o.$slots,"default")],4)]))}});let ot=0;function it(){return++ot}const st=15,at=300,rt=200;function ct(t){t.stopPropagation()}function lt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function V(t,e=0,n,o=rt){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}class dt{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,i,u,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=u,this.momentumReduceRatio=m}open(){const e=this.el,n=A(),o=(i,u,m,a)=>{let x=u+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(u==0){this.moving=!1;return}Math.abs(u)>f?u>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let v=-x;v<0?v=0:v>this.width-this.columnWidth&&(v=this.width-this.columnWidth);const y=Math.floor(v/this.columnWidth);this.isPageOpened(y)||this.openPage(y),x=-y*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(y)}),V(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(u)>f){let y=0;if(u>0?y=Math.abs(this.startDistance+this.columnWidth):y=Math.abs(this.startDistance-this.columnWidth),y>=0&&y<this.width){const r=Math.floor(y/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let v=-x;v<this.min?v=this.min:v>this.max&&(v=this.max),V(i,-v,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=i=>{this.moving||(n.start(i),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=i=>{n.move(i),!n.isVertical()&&(ct(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const u=n.state.duration;if(u<at&&Math.abs(i)>st){const a=lt(i,u,this.momentumReduceRatio);o(e,a,"end",this.swipeDuration)}else o(e,i,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function ut(t,e,n,o,i,u){return new dt(t,e,n,o,i,u)}function ft(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),u=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-u-m}}const ht=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,u=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(T){console.error(T)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=ut(u,m,a,x,n.moveRatio,n.momentumReduceRatio));let v=null;s.onMounted(()=>{const l=h(),E=()=>{const T=ft(l);y(n.activePath,n.routes,T.width,T.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(v=new window.ResizeObserver(E),v.observe(l)),E(),f){const T=w();f.el=T,f.open()}}),s.onBeforeUnmount(()=>{v&&(v.disconnect(),v=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,T,b,M,C])=>{const X=T<=0?o.width:T,$=b<=0?o.height:b;y(l,E,X,$,M,C)});const y=(l,E,T,b,M,C="horizontal")=>{const X=l;if(o.index=E.findIndex($=>$.path===X),C==="horizontal"){const $=T;if($>0){o.width=T;const gt=$*n.routes.length,vt=-$/3,_t=$*(E.length-1)+$/3;f&&(f.columnWidth=$,f.width=gt,f.min=vt,f.max=_t),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-$*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${it()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),d=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const T=o.height>0?o.height:n.height;return T>0&&(l.height=`${T}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function w(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const g=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),L=(l,E)=>{const T=n.routes.findIndex(b=>{const M=l.path??l.name??"";return b.path==M});return o.width<=0?{}:{style:{left:`${T*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const T=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(T,{class:s.normalizeClass(p.value),style:s.normalizeStyle(d.value),"view-class":"fox-swiper-navigator__item",tag:nt,"view-tag-props":L,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:g.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}})},Symbol.toStringTag,{value:"Module"}));let mt="fox-";const pt=[],B=Object.assign({"/src/components/card-navigator/index.vue":z,"/src/components/default-navigator/index.vue":W,"/src/components/root-navigator/index.vue":tt,"/src/components/swiper-navigator/index.vue":ht}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];pt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}return{install(t){Y.forEach(e=>{t.component(`${mt}${e.name}`,e.component)})}}});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .fox-card-navigator{position:relative;overflow:hidden;width:100%}.fox-card-navigator__item{position:relative;width:100%}.fox-card-navigator__item-active{z-index:1}.fox-card-navigator__item-inactive{display:none;z-index:0}.fox-card-navigator__trans-enter-from,.fox-card-navigator__trans-show-from{-webkit-transform:translate3d(50%,0%,0);transform:translate3d(50%,0,0)}.fox-card-navigator__trans-enter-to,.fox-card-navigator__trans-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-card-navigator__trans-hide-active{position:absolute;display:block;-webkit-transition:opacity .36s cubic-bezier(.17,.89,.45,1);transition:opacity .36s cubic-bezier(.17,.89,.45,1)}.fox-card-navigator__trans-leave-to,.fox-card-navigator__trans-hide-to{opacity:0}.fox-default-navigator__trans-enter,.fox-default-navigator__trans-show{-webkit-transform:translate3d(50%,0%,0);transform:translate3d(50%,0,0)}.fox-default-navigator__trans-enter-to,.fox-default-navigator__trans-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-default-navigator__trans-hide-active{position:absolute;display:block;-webkit-transition:opacity .36s cubic-bezier(.17,.89,.45,1);transition:opacity .36s cubic-bezier(.17,.89,.45,1)}.fox-default-navigator__trans-leave-to,.fox-default-navigator__trans-hide-to{opacity:0}.fox-root-navigator{position:relative;overflow:hidden;width:100%}.fox-root-navigator__item{position:fixed;left:0;top:0;width:100%;z-index:120;-webkit-box-sizing:border-box;box-sizing:border-box}.fox-root-navigator__item-moving{-webkit-box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);box-shadow:0 4px 8px #0003,0 6px 20px #00000030}.fox-root-navigator__slide-enter-from{-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-root-navigator__slide-enter-to{-webkit-transition:-webkit-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-root-navigator__slide-leave-to{-webkit-transition:-webkit-transform .5s ease-out;transition:-webkit-transform .5s ease-out;transition:transform .5s ease-out;transition:transform .5s ease-out,-webkit-transform .5s ease-out;-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-root-navigator__slide-show-from{-webkit-transform:translate3d(-50%,0%,0);transform:translate3d(-50%,0,0)}.fox-root-navigator__slide-show-to{-webkit-transition:-webkit-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-root-navigator__slide-hide-to{-webkit-transition:-webkit-transform .5s ease-out;transition:-webkit-transform .5s ease-out;transition:transform .5s ease-out;transition:transform .5s ease-out,-webkit-transform .5s ease-out;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.fox-root-navigator__pop-enter-from{-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-root-navigator__pop-enter-to{-webkit-transition:-webkit-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-root-navigator__pop-leave-to{-webkit-transition:-webkit-transform .36s ease-out;transition:-webkit-transform .36s ease-out;transition:transform .36s ease-out;transition:transform .36s ease-out,-webkit-transform .36s ease-out;-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-swiper-navigator{position:relative;overflow:hidden;width:100%}.fox-swiper-navigator__item{position:absolute;top:0;bottom:0}.fox-swiper-navigator__inner{position:absolute;top:0;bottom:0;-webkit-transition:-webkit-transform 0ms ease;transition:-webkit-transform 0ms ease;transition:transform 0ms ease;transition:transform 0ms ease,-webkit-transform 0ms ease}.fox-swiper-navigator__slide-enter-from{-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-swiper-navigator__slide-enter-to{-webkit-transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1),-webkit-transform .3s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-swiper-navigator__slide-leave-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-swiper-navigator__slide-show-from{-webkit-transform:translate3d(-50%,0%,0);transform:translate3d(-50%,0,0)}.fox-swiper-navigator__slide-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-swiper-navigator__slide-hide-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.fox-swiper-navigator__pop-enter-from{-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-swiper-navigator__pop-enter-active{-webkit-transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1),-webkit-transform .3s cubic-bezier(.17,.89,.45,1)}.fox-swiper-navigator__pop-enter-to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-swiper-navigator__pop-leave-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-swiper-navigator .fox-header-bar,.fox-swiper-navigator .fox-footer-bar{position:absolute!important}
1
+ .fox-card-navigator{position:relative;overflow:hidden;width:100%}.fox-card-navigator__item{position:relative;width:100%}.fox-card-navigator__item-active{z-index:1}.fox-card-navigator__item-inactive{display:none;z-index:0}.fox-card-navigator__trans-enter-from,.fox-card-navigator__trans-show-from{-webkit-transform:translate3d(50%,0%,0);transform:translate3d(50%,0,0)}.fox-card-navigator__trans-enter-to,.fox-card-navigator__trans-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-card-navigator__trans-hide-active{position:absolute;display:block;-webkit-transition:opacity .36s cubic-bezier(.17,.89,.45,1);transition:opacity .36s cubic-bezier(.17,.89,.45,1)}.fox-card-navigator__trans-leave-to,.fox-card-navigator__trans-hide-to{opacity:0}.fox-default-navigator__trans-enter,.fox-default-navigator__trans-show{-webkit-transform:translate3d(50%,0%,0);transform:translate3d(50%,0,0)}.fox-default-navigator__trans-enter-to,.fox-default-navigator__trans-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-default-navigator__trans-hide-active{position:absolute;display:block;-webkit-transition:opacity .36s cubic-bezier(.17,.89,.45,1);transition:opacity .36s cubic-bezier(.17,.89,.45,1)}.fox-default-navigator__trans-leave-to,.fox-default-navigator__trans-hide-to{opacity:0}.fox-root-navigator{position:relative;overflow:hidden;width:100%}.fox-root-navigator__item{position:fixed;left:0;top:0;width:100%;z-index:120;-webkit-box-sizing:border-box;box-sizing:border-box}.fox-root-navigator__item-moving{-webkit-box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);box-shadow:0 4px 8px #0003,0 6px 20px #00000030}.fox-root-navigator__slide-enter-from{-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-root-navigator__slide-enter-to{-webkit-transition:-webkit-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-root-navigator__slide-leave-to{-webkit-transition:-webkit-transform .5s ease-out;transition:-webkit-transform .5s ease-out;transition:transform .5s ease-out;transition:transform .5s ease-out,-webkit-transform .5s ease-out;-webkit-transform:translate3d(103%,0,0)!important;transform:translate3d(103%,0,0)!important}.fox-root-navigator__slide-show-from{-webkit-transform:translate3d(-50%,0%,0);transform:translate3d(-50%,0,0)}.fox-root-navigator__slide-show-to{-webkit-transition:-webkit-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-root-navigator__slide-hide-to{-webkit-transition:-webkit-transform .5s ease-out;transition:-webkit-transform .5s ease-out;transition:transform .5s ease-out;transition:transform .5s ease-out,-webkit-transform .5s ease-out;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.fox-root-navigator__pop-enter-from{-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-root-navigator__pop-enter-to{-webkit-transition:-webkit-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-root-navigator__pop-leave-to{-webkit-transition:-webkit-transform .36s ease-out;transition:-webkit-transform .36s ease-out;transition:transform .36s ease-out;transition:transform .36s ease-out,-webkit-transform .36s ease-out;-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-swiper-navigator{position:relative;overflow:hidden;width:100%}.fox-swiper-navigator__item{position:absolute;top:0;bottom:0}.fox-swiper-navigator__inner{position:absolute;top:0;bottom:0;-webkit-transition:-webkit-transform 0ms ease;transition:-webkit-transform 0ms ease;transition:transform 0ms ease;transition:transform 0ms ease,-webkit-transform 0ms ease}.fox-swiper-navigator__slide-enter-from{-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-swiper-navigator__slide-enter-to{-webkit-transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1),-webkit-transform .3s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-swiper-navigator__slide-leave-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-swiper-navigator__slide-show-from{-webkit-transform:translate3d(-50%,0%,0);transform:translate3d(-50%,0,0)}.fox-swiper-navigator__slide-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-swiper-navigator__slide-hide-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.fox-swiper-navigator__pop-enter-from{-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-swiper-navigator__pop-enter-active{-webkit-transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1);transition:transform .3s cubic-bezier(.17,.89,.45,1),-webkit-transform .3s cubic-bezier(.17,.89,.45,1)}.fox-swiper-navigator__pop-enter-to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-swiper-navigator__pop-leave-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0,103%,0);transform:translate3d(0,103%,0)}.fox-swiper-navigator .fox-header-bar,.fox-swiper-navigator .fox-footer-bar{position:absolute!important}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fox-js/navigation",
3
3
  "type": "module",
4
- "version": "4.0.1-11",
4
+ "version": "4.0.1-13",
5
5
  "description": "fox navigation",
6
6
  "author": "jiangcheng",
7
7
  "keywords": [