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

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-11 Thu Apr 11 2024 17:14:28 GMT+0800 (中国标准时间)
3
+ */const r=require("vue"),L=require("@fox-js/fox"),k=r.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=r.resolveComponent("fox-router-view");return r.openBlock(),r.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=r.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=r.resolveComponent("fox-router-view");return r.openBlock(),r.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:r.withCtx(({Component:i})=>[r.createVNode(r.Transition,{name:"fox-default-navigator__trans"},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.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 c=m.touches[0];t.deltaX=c.clientX-t.startX,t.deltaY=c.clientY-t.startY,t.moveX=c.clientX,t.moveY=c.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 c=m.touches[0];t.startX=c.clientX,t.startY=c.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=r.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,h=!0;for(let c in e)c==="bubbles"?i=!!e[c]:c==="cancelable"?h=!!e[c]:o[c]=e[c];o.initEvent(t,i,h),(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,h=600,m=60){const c={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},w=t.previousSibling,f=V(),v=(a,l,g,y)=>{let T=l+c.startDistance;if(g==="end"){const M=G(a);let u=M.width*e;T<u?T=0:T=M.width,c.transitionEndTrigger=()=>{c.moving=!1,i&&a.classList.remove(i),setTimeout(()=>{w&&A(w),T==0?A(a):J(L.FoxLeaveEnd,{},a),c.moving=!1},m)},w&&P(w,0,"",0),T>0&&typeof o=="function"&&o(),P(a,T,"end",y)}else T<0&&(T=0),P(a,T,"",0)},s=()=>{c.transitionEndTrigger&&(c.transitionEndTrigger(),c.transitionEndTrigger=null)},d=a=>{f.start(a),c.scrollDistance=0,c.moving&&(c.scrollDistance=C(t)),i&&t.classList.add(i),c.transitionEndTrigger=null,c.moving=!0},p=a=>{c.moving=!0,f.move(a),!(f.isVertical()||C(t)===0&&f.state.deltaX<0)&&(tt(a),v(t,f.state.deltaX,"",0))},E=()=>{if(f.isVertical()||C(t)===0&&f.state.deltaX<0)return;const l=f.state.deltaX;if(l===0){i&&t.classList.remove(i),c.moving=!1;return}const g=f.state.duration;if(g<Q&&Math.abs(l)>K){const T=et(l,g,n);v(t,T,"end",h)}else v(t,l,"end",h)};t.addEventListener("transitionend",s),t.addEventListener("touchstart",d),t.addEventListener("touchmove",p),t.addEventListener("touchend",E),t.addEventListener("touchcancel",E),X.set(t,{state:c,transitionend:s,touchstart:d,touchmove:p,touchend:E,touchcancel:E})}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=r.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(s){return(s.params&&s.params.animationType)??"slide"}const h=(s,d,p,E)=>{if(p.opsType===L.OperationType.Append||d){const a=i(p),l=d?"show":"enter";if(l==="show"&&(a==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;l==="enter"&&(n=p,o="enter");const g=`fox-root-navigator__${a}-${l}-from`,y=`fox-root-navigator__${a}-${l}-active`;s.classList.add(g),s.classList.add(y)}},m=(s,d,p,E)=>{if(p.opsType===L.OperationType.Append||d){const a=i(p),l=d?"show":"enter";if(l==="show"&&(a==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const g=`fox-root-navigator__${a}-${l}-from`,y=`fox-root-navigator__${a}-${l}-to`;s.classList.remove(g),s.classList.add(y)}},c=(s,d,p,E)=>{if(p.opsType===L.OperationType.Append||d){const a=i(p),l=d?"show":"enter";if(l==="enter"&&(n=null,o=null),a!=="pop"){const g=`fox-root-navigator__${a}-${l}-active`,y=`fox-root-navigator__${a}-${l}-to`;s.classList.remove(g),s.classList.remove(y)}}e.dragRemove&&!d&&p.opsType===L.OperationType.Append&&ot(s,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},w=(s,d,p,E)=>{if(p.opsType===L.OperationType.Append||d){const a=i(p),l=d?"hide":"leave";if(l==="hide"&&(a==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;l==="leave"&&(n=p,o="leave");const g=`fox-root-navigator__${a}-${l}-from`,y=`fox-root-navigator__${a}-${l}-active`;s.classList.add(g),s.classList.add(y)}},f=(s,d,p,E)=>{if(p.opsType===L.OperationType.Append||d){const a=i(p),l=d?"hide":"leave";if(l==="hide"&&(a==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const g=`fox-root-navigator__${a}-${l}-from`,y=`fox-root-navigator__${a}-${l}-to`;s.classList.remove(g),s.classList.add(y)}},v=(s,d,p,E)=>{if(p.opsType===L.OperationType.Append||d){const a=i(p),l=d?"hide":"leave";if(l==="leave"&&(n=null,o=null),a!=="pop"){const g=`fox-root-navigator__${a}-${l}-active`,y=`fox-root-navigator__${a}-${l}-to`;s.classList.remove(g),s.classList.remove(y)}}e.dragRemove&&!d&&it(s)};return(s,d)=>{const p=r.resolveComponent("fox-router-view");return r.openBlock(),r.createBlock(p,{class:"fox-root-navigator","view-class":s.viewClass,"before-enter":h,enter:m,"after-enter":c,"before-leave":w,leave:f,"after-leave":v,multi:!0,name:s.routerViewName,"view-tag":s.viewTag,transition:s.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=r.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=r.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)=>(r.openBlock(),r.createElementBlock("div",rt,[r.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:r.normalizeStyle(n.value)},[r.renderSlot(o.$slots,"default")],4)]))}});let lt=0;function ut(){return++lt}const dt=15,ft=300,ht=200;function pt(t){t.stopPropagation()}function mt(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,h,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=h,this.momentumReduceRatio=m}open(){const e=this.el,n=V(),o=(i,h,m,c)=>{let w=h+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(h==0){this.moving=!1;return}Math.abs(h)>f?h>0?w=this.startDistance+this.columnWidth:w=this.startDistance-this.columnWidth:w=this.startDistance;let v=-w;v<0?v=0:v>this.width-this.columnWidth&&(v=this.width-this.columnWidth);const s=Math.floor(v/this.columnWidth);this.isPageOpened(s)||this.openPage(s),w=-s*this.columnWidth,c&&c>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(s)}),I(i,w,"end",c),this.scrollDistance=w}else{if(Math.abs(h)>f){let s=0;if(h>0?s=Math.abs(this.startDistance+this.columnWidth):s=Math.abs(this.startDistance-this.columnWidth),s>=0&&s<this.width){const d=Math.floor(s/this.columnWidth);this.isPageOpened(d)||this.openPage(d)}}let v=-w;v<this.min?v=this.min:v>this.max&&(v=this.max),I(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()&&(pt(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const h=n.state.duration;if(h<ft&&Math.abs(i)>dt){const c=mt(i,h,this.momentumReduceRatio);o(e,c,"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,h){return new vt(t,e,n,o,i,h)}function _t(t){const e=r.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),h=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-h-m}}const wt=r.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=r.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,h=()=>o.scrollDistance,m=u=>{if(o.openedIndexList.indexOf(u)===-1){o.openedIndexList.push(u);const x=n.routes[u];try{n.openViewPage(x,u)}catch(_){console.error(_)}}},c=u=>o.openedIndexList.indexOf(u)!==-1,w=u=>{o.index=u,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const x=n.routes[u];i("update:activePath",x.path)};let f=null;n.draggable&&(f=gt(h,m,c,w,n.moveRatio,n.momentumReduceRatio));let v=null;r.onMounted(()=>{const u=l(),x=()=>{const _=_t(u);s(n.activePath,n.routes,_.width,_.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(v=new window.ResizeObserver(x),v.observe(u)),x(),f){const _=y();f.el=_,f.open()}}),r.onBeforeUnmount(()=>{v&&(v.disconnect(),v=null),f&&f.close()}),r.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([u,x,_,b,$,R])=>{const O=_<=0?o.width:_,D=b<=0?o.height:b;s(u,x,O,D,$,R)});const s=(u,x,_,b,$,R="horizontal")=>{const O=u;if(o.index=x.findIndex(D=>D.path===O),R==="horizontal"){const D=_;if(D>0){o.width=_;const z=D*n.routes.length,W=-D/3,N=D*(x.length-1)+D/3;f&&(f.columnWidth=D,f.width=z,f.min=W,f.max=N),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-D*o.index)}}f&&(f.swipeDuration=$)},d=`fox-swiper-navigator-${ut()}`,p=r.computed(()=>{const u=[d];return n.customClass&&u.push(n.customClass),u}),E=r.computed(()=>{const u={},x=o.width>0?o.width:n.width;x>0&&(u.width=`${x}px`);const _=o.height>0?o.height:n.height;return _>0&&(u.height=`${_}px`),n.customStyle&&Object.assign(u,n.customStyle),u});let a=null;function l(){return a||(a=document.querySelector(`.${d}`),a)}let g=null;function y(){return g||(g=document.querySelector(`.${d}>.fox-swiper-navigator__inner`),g)}const T=r.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),M=(u,x)=>{const _=n.routes.findIndex(b=>{const $=u.path??u.name??"";return b.path==$});return o.width<=0?{}:{style:{left:`${_*o.width}px`,width:`${o.width}px`}}};return(u,x)=>{const _=r.resolveComponent("fox-router-view");return r.openBlock(),r.createBlock(_,{class:r.normalizeClass(p.value),style:r.normalizeStyle(E.value),"view-class":"fox-swiper-navigator__item",tag:ct,"view-tag-props":M,multi:!0,name:u.routerViewName,transition:u.transition,"scroll-distance":o.scrollDistance,"scroll-duration":u.scrollDuration,direction:u.direction,width:T.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 R, resolveComponent as O, openBlock as L, createBlock as M, 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 D } 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-11 Thu Apr 11 2024 17:14:28 GMT+0800 (中国标准时间)
5
5
  */
6
- const st = /* @__PURE__ */ P({
6
+ const ct = /* @__PURE__ */ R({
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 L(), M(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__ */ R({
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 L(), M(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
+ (L(), M(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,
@@ -77,20 +77,20 @@ function F() {
77
77
  t.deltaX = 0, t.deltaY = 0, t.offsetX = 0, t.offsetY = 0, t.direction = "", t.startTime = 0;
78
78
  };
79
79
  return {
80
- move: (h) => {
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;
80
+ move: (m) => {
81
+ if (m.touches) {
82
+ const r = m.touches[0];
83
+ t.deltaX = r.clientX - t.startX, t.deltaY = r.clientY - t.startY, t.moveX = r.clientX, t.moveY = r.clientY;
84
84
  } else
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));
85
+ t.deltaX = m.clientX - t.startX, t.deltaY = m.clientY - t.startY, t.moveX = m.clientX, t.moveY = m.clientY;
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
- start: (h) => {
89
- if (o(), h.touches) {
90
- const c = h.touches[0];
91
- t.startX = c.clientX, t.startY = c.clientY;
88
+ start: (m) => {
89
+ if (o(), m.touches) {
90
+ const r = m.touches[0];
91
+ t.startX = r.clientX, t.startY = r.clientY;
92
92
  } else
93
- t.startX = h.clientX, t.startY = h.clientY;
93
+ t.startX = m.clientX, t.startY = m.clientY;
94
94
  t.startTime = Date.now();
95
95
  },
96
96
  reset: o,
@@ -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, f = !0;
134
+ for (let r in e)
135
+ r === "bubbles" ? i = !!e[r] : r === "cancelable" ? f = !!e[r] : o[r] = e[r];
136
+ o.initEvent(t, i, f), (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, f = 600, m = 60) {
162
+ const r = {
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
+ }, _ = t.previousSibling, d = j(), p = (a, c, v, T) => {
170
+ let w = c + r.startDistance;
171
+ if (v === "end") {
172
+ const P = mt(a);
173
+ let l = P.width * e;
174
+ w < l ? w = 0 : w = P.width, r.transitionEndTrigger = () => {
175
+ r.moving = !1, i && a.classList.remove(i), setTimeout(() => {
176
+ _ && z(_), w == 0 ? z(a) : pt(rt, {}, a), r.moving = !1;
177
+ }, m);
178
+ }, _ && C(_, 0, "", 0), w > 0 && typeof o == "function" && o(), C(a, w, "end", T);
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));
178
- }, l = () => {
179
- if (m.isVertical()) {
180
- p(t, 0, "end", h);
180
+ w < 0 && (w = 0), C(a, w, "", 0);
181
+ }, s = () => {
182
+ r.transitionEndTrigger && (r.transitionEndTrigger(), r.transitionEndTrigger = null);
183
+ }, u = (a) => {
184
+ d.start(a), r.scrollDistance = 0, r.moving && (r.scrollDistance = I(t)), i && t.classList.add(i), r.transitionEndTrigger = null, r.moving = !0;
185
+ }, h = (a) => {
186
+ r.moving = !0, d.move(a), !(d.isVertical() || I(t) === 0 && d.state.deltaX < 0) && (wt(a), p(t, d.state.deltaX, "", 0));
187
+ }, y = () => {
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 c = d.state.deltaX;
191
+ if (c === 0) {
192
+ i && t.classList.remove(i), r.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 v = d.state.duration;
196
+ if (v < gt && Math.abs(c) > vt) {
197
+ const w = Tt(c, v, n);
198
+ p(t, w, "end", f);
192
199
  } else
193
- p(t, s, "end", h);
200
+ p(t, c, "end", f);
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,
200
- touchend: l,
201
- touchcancel: l
202
+ t.addEventListener("transitionend", s), t.addEventListener("touchstart", u), t.addEventListener("touchmove", h), t.addEventListener("touchend", y), t.addEventListener("touchcancel", y), V.set(t, {
203
+ state: r,
204
+ transitionend: s,
205
+ touchstart: u,
206
+ touchmove: h,
207
+ touchend: y,
208
+ touchcancel: y
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__ */ R({
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,92 @@ 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(s) {
233
+ return (s.params && s.params.animationType) ?? "slide";
226
234
  }
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"))
235
+ const f = (s, u, h, y) => {
236
+ if (h.opsType === D.Append || u) {
237
+ const a = i(h), c = u ? "show" : "enter";
238
+ if (c === "show" && (a === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
231
239
  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);
240
+ c === "enter" && (n = h, o = "enter");
241
+ const v = `fox-root-navigator__${a}-${c}-from`, T = `fox-root-navigator__${a}-${c}-active`;
242
+ s.classList.add(v), s.classList.add(T);
235
243
  }
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"))
244
+ }, m = (s, u, h, y) => {
245
+ if (h.opsType === D.Append || u) {
246
+ const a = i(h), c = u ? "show" : "enter";
247
+ if (c === "show" && (a === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
240
248
  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);
249
+ const v = `fox-root-navigator__${a}-${c}-from`, T = `fox-root-navigator__${a}-${c}-to`;
250
+ s.classList.remove(v), s.classList.add(T);
243
251
  }
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);
252
+ }, r = (s, u, h, y) => {
253
+ if (h.opsType === D.Append || u) {
254
+ const a = i(h), c = u ? "show" : "enter";
255
+ if (c === "enter" && (n = null, o = null), a !== "pop") {
256
+ const v = `fox-root-navigator__${a}-${c}-active`, T = `fox-root-navigator__${a}-${c}-to`;
257
+ s.classList.remove(v), s.classList.remove(T);
250
258
  }
251
259
  }
252
- e.dragRemove && !u && f.opsType === b.Append && _t(
253
- i,
260
+ e.dragRemove && !u && h.opsType === D.Append && yt(
261
+ s,
254
262
  e.removeMoveRatio,
255
263
  e.momentumReduceRatio,
256
264
  e.removeViewPage,
257
- e.removeViewPageDuration,
258
265
  "fox-root-navigator__item-moving",
259
- 1e3
266
+ e.swipeDuration,
267
+ e.resetDelay
260
268
  );
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"))
269
+ }, _ = (s, u, h, y) => {
270
+ if (h.opsType === D.Append || u) {
271
+ const a = i(h), c = u ? "hide" : "leave";
272
+ if (c === "hide" && (a === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
265
273
  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);
274
+ c === "leave" && (n = h, o = "leave");
275
+ const v = `fox-root-navigator__${a}-${c}-from`, T = `fox-root-navigator__${a}-${c}-active`;
276
+ s.classList.add(v), s.classList.add(T);
269
277
  }
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"))
278
+ }, d = (s, u, h, y) => {
279
+ if (h.opsType === D.Append || u) {
280
+ const a = i(h), c = u ? "hide" : "leave";
281
+ if (c === "hide" && (a === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
274
282
  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);
283
+ const v = `fox-root-navigator__${a}-${c}-from`, T = `fox-root-navigator__${a}-${c}-to`;
284
+ s.classList.remove(v), s.classList.add(T);
277
285
  }
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);
286
+ }, p = (s, u, h, y) => {
287
+ if (h.opsType === D.Append || u) {
288
+ const a = i(h), c = u ? "hide" : "leave";
289
+ if (c === "leave" && (n = null, o = null), a !== "pop") {
290
+ const v = `fox-root-navigator__${a}-${c}-active`, T = `fox-root-navigator__${a}-${c}-to`;
291
+ s.classList.remove(v), s.classList.remove(T);
284
292
  }
285
293
  }
286
- e.dragRemove && !u && wt(i);
294
+ e.dragRemove && !u && Et(s);
287
295
  };
288
- return (i, u) => {
289
- const f = S("fox-router-view");
290
- return L(), R(f, {
296
+ return (s, u) => {
297
+ const h = O("fox-router-view");
298
+ return L(), M(h, {
291
299
  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,
300
+ "view-class": s.viewClass,
301
+ "before-enter": f,
302
+ enter: m,
303
+ "after-enter": r,
304
+ "before-leave": _,
305
+ leave: d,
298
306
  "after-leave": p,
299
307
  multi: !0,
300
- name: i.routerViewName,
301
- "view-tag": i.viewTag,
302
- transition: i.transition
308
+ name: s.routerViewName,
309
+ "view-tag": s.viewTag,
310
+ transition: s.transition
303
311
  }, null, 8, ["view-class", "name", "view-tag", "transition"]);
304
312
  };
305
313
  }
306
- }), xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
314
+ }), Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
307
315
  __proto__: null,
308
- default: yt
309
- }, Symbol.toStringTag, { value: "Module" })), Tt = { class: "fox-swiper-navigator" }, Dt = /* @__PURE__ */ P({
316
+ default: Dt
317
+ }, Symbol.toStringTag, { value: "Module" })), bt = { class: "fox-swiper-navigator" }, $t = /* @__PURE__ */ R({
310
318
  __name: "swiper",
311
319
  props: {
312
320
  width: {},
@@ -315,41 +323,38 @@ const yt = /* @__PURE__ */ P({
315
323
  direction: {}
316
324
  },
317
325
  setup(t) {
318
- const e = t, n = O(() => {
326
+ const e = t, n = X(() => {
319
327
  const o = {
320
328
  transform: `translate3d(${e.scrollDistance}px, 0, 0)`,
321
329
  width: `${e.width}`
322
330
  };
323
331
  return e.scrollDuration > 0 && (o["transition-duration"] = `${e.scrollDuration}ms`), o;
324
332
  });
325
- return (o, a) => (L(), K("div", Tt, [
326
- Q("div", {
333
+ return (o, i) => (L(), Z("div", bt, [
334
+ tt("div", {
327
335
  class: "fox-swiper-navigator__inner",
328
- style: B(n.value)
336
+ style: U(n.value)
329
337
  }, [
330
- Z(o.$slots, "default")
338
+ et(o.$slots, "default")
331
339
  ], 4)
332
340
  ]));
333
341
  }
334
342
  });
335
- let Et = 0;
336
- function bt() {
337
- return ++Et;
343
+ let Mt = 0;
344
+ function Rt() {
345
+ return ++Mt;
338
346
  }
339
- const Lt = 15, $t = 300, Mt = 200;
340
- function Rt(t) {
347
+ const Pt = 15, Xt = 300, Ot = 200;
348
+ function St(t) {
341
349
  t.stopPropagation();
342
350
  }
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) {
351
+ function At(t, e, n = 1) {
347
352
  return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t * n;
348
353
  }
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)`;
354
+ function N(t, e = 0, n, o = Ot) {
355
+ n === "end" ? t.style.transition = `transform ${o}ms linear` : t.style.transition = "transform 0ms linear", t.style.transform = `translate3d(${e}px, 0, 0)`;
351
356
  }
352
- class St {
357
+ class Ct {
353
358
  /**
354
359
  * width
355
360
  */
@@ -444,60 +449,58 @@ class St {
444
449
  * @param momentumReduceRatio
445
450
  *
446
451
  */
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;
452
+ constructor(e, n, o, i, f, m) {
453
+ this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = i, this.moveRatio = f, this.momentumReduceRatio = m;
449
454
  }
450
455
  /**
451
456
  * 打开drag支持
452
457
  */
453
458
  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;
457
- if (h === "end") {
458
- if (d == 0) {
459
+ const e = this.el, n = j(), o = (i, f, m, r) => {
460
+ let _ = f + this.startDistance;
461
+ const d = this.columnWidth * this.moveRatio;
462
+ if (m === "end") {
463
+ if (f == 0) {
459
464
  this.moving = !1;
460
465
  return;
461
466
  }
462
- Math.abs(d) > m ? d > 0 ? v = this.startDistance + this.columnWidth : v = this.startDistance - this.columnWidth : v = this.startDistance;
463
- let p = -v;
467
+ Math.abs(f) > d ? f > 0 ? _ = this.startDistance + this.columnWidth : _ = this.startDistance - this.columnWidth : _ = this.startDistance;
468
+ let p = -_;
464
469
  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
+ const s = Math.floor(p / this.columnWidth);
471
+ this.isPageOpened(s) || this.openPage(s), _ = -s * this.columnWidth, r && r > 0 && (this.transitionEndTrigger = () => {
472
+ this.moving = !1, this.pageOpened(s);
473
+ }), N(i, _, "end", r), this.scrollDistance = _;
469
474
  } 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);
475
+ if (Math.abs(f) > d) {
476
+ let s = 0;
477
+ if (f > 0 ? s = Math.abs(this.startDistance + this.columnWidth) : s = Math.abs(this.startDistance - this.columnWidth), s >= 0 && s < this.width) {
478
+ const u = Math.floor(s / this.columnWidth);
474
479
  this.isPageOpened(u) || this.openPage(u);
475
480
  }
476
481
  }
477
- let p = -v;
478
- p < this.min ? p = this.min : p > this.max && (p = this.max), z(a, -p, "", 0);
482
+ let p = -_;
483
+ p < this.min ? p = this.min : p > this.max && (p = this.max), N(i, -p, "", 0);
479
484
  }
480
485
  };
481
486
  this.transitionend = () => {
482
487
  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));
488
+ }, this.touchstart = (i) => {
489
+ this.moving || (n.start(i), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
490
+ }, this.touchmove = (i) => {
491
+ n.move(i), !n.isVertical() && (St(i), o(e, n.state.deltaX, "", 0));
487
492
  }, this.touchend = () => {
488
- if (n.isVertical()) {
489
- o(e, 0, "end", this.swipeDuration);
493
+ if (n.isVertical())
490
494
  return;
491
- }
492
- const a = n.state.deltaX;
493
- if (a == 0)
495
+ const i = n.state.deltaX;
496
+ if (i == 0)
494
497
  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);
498
+ const f = n.state.duration;
499
+ if (f < Xt && Math.abs(i) > Pt) {
500
+ const r = At(i, f, this.momentumReduceRatio);
501
+ o(e, r, "end", this.swipeDuration);
499
502
  } else
500
- o(e, a, "end", this.swipeDuration);
503
+ o(e, i, "end", this.swipeDuration);
501
504
  }, 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
505
  }
503
506
  /**
@@ -508,17 +511,17 @@ class St {
508
511
  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
512
  }
510
513
  }
511
- function Xt(t, e, n, o, a, d) {
512
- return new St(t, e, n, o, a, d);
514
+ function It(t, e, n, o, i, f) {
515
+ return new Ct(t, e, n, o, i, f);
513
516
  }
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"));
517
+ function Vt(t) {
518
+ const e = F(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), i = parseFloat(n.getPropertyValue("padding-right")), f = parseFloat(n.getPropertyValue("padding-top")), m = parseFloat(n.getPropertyValue("padding-bottom"));
516
519
  return {
517
- width: e.clientWidth - o - a,
518
- height: e.clientHeight - d - h
520
+ width: e.clientWidth - o - i,
521
+ height: e.clientHeight - f - m
519
522
  };
520
523
  }
521
- const It = /* @__PURE__ */ P({
524
+ const Yt = /* @__PURE__ */ R({
522
525
  __name: "index",
523
526
  props: {
524
527
  activePath: {},
@@ -539,49 +542,49 @@ const It = /* @__PURE__ */ P({
539
542
  },
540
543
  emits: ["update:activePath"],
541
544
  setup(t, { emit: e }) {
542
- const n = t, o = tt({
545
+ const n = t, o = nt({
543
546
  scrollDistance: 0,
544
547
  index: -1,
545
548
  openedIndexList: [],
546
549
  width: n.width,
547
550
  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];
551
+ }), i = e, f = () => o.scrollDistance, m = (l) => {
552
+ if (o.openedIndexList.indexOf(l) === -1) {
553
+ o.openedIndexList.push(l);
554
+ const x = n.routes[l];
552
555
  try {
553
- n.openViewPage(y, r);
554
- } catch (_) {
555
- console.error(_);
556
+ n.openViewPage(x, l);
557
+ } catch (g) {
558
+ console.error(g);
556
559
  }
557
560
  }
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);
561
+ }, r = (l) => o.openedIndexList.indexOf(l) !== -1, _ = (l) => {
562
+ o.index = l, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
563
+ const x = n.routes[l];
564
+ i("update:activePath", x.path);
562
565
  };
563
- let m = null;
564
- n.draggable && (m = Xt(
565
- d,
566
- h,
567
- c,
568
- v,
566
+ let d = null;
567
+ n.draggable && (d = It(
568
+ f,
569
+ m,
570
+ r,
571
+ _,
569
572
  n.moveRatio,
570
573
  n.momentumReduceRatio
571
574
  ));
572
575
  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);
576
+ ot(() => {
577
+ const l = c(), x = () => {
578
+ const g = Vt(l);
579
+ s(n.activePath, n.routes, g.width, g.height, n.swipeDuration, n.direction);
577
580
  };
578
- if (window.ResizeObserver && (p = new window.ResizeObserver(y), p.observe(r)), y(), m) {
579
- const _ = w();
580
- m.el = _, m.open();
581
+ if (window.ResizeObserver && (p = new window.ResizeObserver(x), p.observe(l)), x(), d) {
582
+ const g = T();
583
+ d.el = g, d.open();
581
584
  }
582
- }), nt(() => {
583
- p && (p.disconnect(), p = null), m && m.close();
584
- }), ot(
585
+ }), it(() => {
586
+ p && (p.disconnect(), p = null), d && d.close();
587
+ }), st(
585
588
  [
586
589
  () => n.activePath,
587
590
  () => n.routes,
@@ -590,93 +593,93 @@ const It = /* @__PURE__ */ P({
590
593
  () => n.swipeDuration,
591
594
  () => n.direction
592
595
  ],
593
- ([r, y, _, $, M, X]) => {
594
- const A = _ <= 0 ? o.width : _, D = $ <= 0 ? o.height : $;
595
- i(r, y, A, D, M, X);
596
+ ([l, x, g, b, $, S]) => {
597
+ const A = g <= 0 ? o.width : g, E = b <= 0 ? o.height : b;
598
+ s(l, x, A, E, $, S);
596
599
  }
597
600
  );
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 = _;
602
- 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);
601
+ const s = (l, x, g, b, $, S = "horizontal") => {
602
+ const A = l;
603
+ if (o.index = x.findIndex((E) => E.path === A), S === "horizontal") {
604
+ const E = g;
605
+ if (E > 0) {
606
+ o.width = g;
607
+ const q = E * n.routes.length, H = -E / 3, G = E * (x.length - 1) + E / 3;
608
+ d && (d.columnWidth = E, d.width = q, d.min = H, d.max = G), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -E * o.index);
606
609
  }
607
610
  }
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;
611
+ d && (d.swipeDuration = $);
612
+ }, u = `fox-swiper-navigator-${Rt()}`, h = X(() => {
613
+ const l = [u];
614
+ return n.customClass && l.push(n.customClass), l;
615
+ }), y = X(() => {
616
+ const l = {}, x = o.width > 0 ? o.width : n.width;
617
+ x > 0 && (l.width = `${x}px`);
618
+ const g = o.height > 0 ? o.height : n.height;
619
+ return g > 0 && (l.height = `${g}px`), n.customStyle && Object.assign(l, n.customStyle), l;
617
620
  });
618
- let l = null;
619
- function s() {
620
- return l || (l = document.querySelector(`.${u}`), l);
621
+ let a = null;
622
+ function c() {
623
+ return a || (a = document.querySelector(`.${u}`), a);
621
624
  }
622
- let g = null;
623
- function w() {
624
- return g || (g = document.querySelector(`.${u}>.fox-swiper-navigator__inner`), g);
625
+ let v = null;
626
+ function T() {
627
+ return v || (v = document.querySelector(`.${u}>.fox-swiper-navigator__inner`), v);
625
628
  }
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 ?? "";
629
- return $.path == M;
629
+ const w = X(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), P = (l, x) => {
630
+ const g = n.routes.findIndex((b) => {
631
+ const $ = l.path ?? l.name ?? "";
632
+ return b.path == $;
630
633
  });
631
634
  return o.width <= 0 ? {} : {
632
635
  style: {
633
- left: `${_ * o.width}px`,
636
+ left: `${g * o.width}px`,
634
637
  width: `${o.width}px`
635
638
  }
636
639
  };
637
640
  };
638
- return (r, y) => {
639
- const _ = S("fox-router-view");
640
- return L(), R(_, {
641
- class: it(f.value),
642
- style: B(E.value),
641
+ return (l, x) => {
642
+ const g = O("fox-router-view");
643
+ return L(), M(g, {
644
+ class: at(h.value),
645
+ style: U(y.value),
643
646
  "view-class": "fox-swiper-navigator__item",
644
- tag: Dt,
645
- "view-tag-props": T,
647
+ tag: $t,
648
+ "view-tag-props": P,
646
649
  multi: !0,
647
- name: r.routerViewName,
648
- transition: r.transition,
650
+ name: l.routerViewName,
651
+ transition: l.transition,
649
652
  "scroll-distance": o.scrollDistance,
650
- "scroll-duration": r.scrollDuration,
651
- direction: r.direction,
652
- width: x.value
653
+ "scroll-duration": l.scrollDuration,
654
+ direction: l.direction,
655
+ width: w.value
653
656
  }, null, 8, ["class", "style", "name", "transition", "scroll-distance", "scroll-duration", "direction", "width"]);
654
657
  };
655
658
  }
656
- }), Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
659
+ }), Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
657
660
  __proto__: null,
658
- default: It
661
+ default: Yt
659
662
  }, 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) {
663
+ let zt = "fox-";
664
+ 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 = [];
665
+ for (const t in B) {
663
666
  let e = /src\/components\/(.*)\/index.vue/.exec(t)[1];
664
- Yt.indexOf(e) === -1 && U.push({
667
+ Nt.indexOf(e) === -1 && k.push({
665
668
  name: e,
666
- component: W[t].default
669
+ component: B[t].default
667
670
  });
668
671
  }
669
- const Nt = {
672
+ const Ut = {
670
673
  /**
671
674
  * 安装
672
675
  * @param app
673
676
  */
674
677
  install(t) {
675
- U.forEach((e) => {
676
- t.component(`${Ct}${e.name}`, e.component);
678
+ k.forEach((e) => {
679
+ t.component(`${zt}${e.name}`, e.component);
677
680
  });
678
681
  }
679
682
  };
680
683
  export {
681
- Nt as default
684
+ Ut as default
682
685
  };
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,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):(s=typeof globalThis<"u"?globalThis:s||self,s.FoxNavigation=E(s.Vue,s.Fox))})(this,function(s,E){"use strict";/*!
2
+ * @fox-js/navigation v4.0.1-11 Thu Apr 11 2024 17:14:28 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 c=m.touches[0];t.deltaX=c.clientX-t.startX,t.deltaY=c.clientY-t.startY,t.moveX=c.clientX,t.moveY=c.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 c=m.touches[0];t.startX=c.clientX,t.startY=c.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,h=!0;for(let c in e)c==="bubbles"?i=!!e[c]:c==="cancelable"?h=!!e[c]:o[c]=e[c];o.initEvent(t,i,h),(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,h=600,m=60){const c={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},w=t.previousSibling,f=A(),g=(r,l,v,y)=>{let T=l+c.startDistance;if(v==="end"){const M=k(r);let d=M.width*e;T<d?T=0:T=M.width,c.transitionEndTrigger=()=>{c.moving=!1,i&&r.classList.remove(i),setTimeout(()=>{w&&I(w),T==0?I(r):j(E.FoxLeaveEnd,{},r),c.moving=!1},m)},w&&R(w,0,"",0),T>0&&typeof o=="function"&&o(),R(r,T,"end",y)}else T<0&&(T=0),R(r,T,"",0)},a=()=>{c.transitionEndTrigger&&(c.transitionEndTrigger(),c.transitionEndTrigger=null)},u=r=>{f.start(r),c.scrollDistance=0,c.moving&&(c.scrollDistance=O(t)),i&&t.classList.add(i),c.transitionEndTrigger=null,c.moving=!0},p=r=>{c.moving=!0,f.move(r),!(f.isVertical()||O(t)===0&&f.state.deltaX<0)&&(G(r),g(t,f.state.deltaX,"",0))},D=()=>{if(f.isVertical()||O(t)===0&&f.state.deltaX<0)return;const l=f.state.deltaX;if(l===0){i&&t.classList.remove(i),c.moving=!1;return}const v=f.state.duration;if(v<q&&Math.abs(l)>U){const T=J(l,v,n);g(t,T,"end",h)}else g(t,l,"end",h)};t.addEventListener("transitionend",a),t.addEventListener("touchstart",u),t.addEventListener("touchmove",p),t.addEventListener("touchend",D),t.addEventListener("touchcancel",D),P.set(t,{state:c,transitionend:a,touchstart:u,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(a){return(a.params&&a.params.animationType)??"slide"}const h=(a,u,p,D)=>{if(p.opsType===E.OperationType.Append||u){const r=i(p),l=u?"show":"enter";if(l==="show"&&(r==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;l==="enter"&&(n=p,o="enter");const v=`fox-root-navigator__${r}-${l}-from`,y=`fox-root-navigator__${r}-${l}-active`;a.classList.add(v),a.classList.add(y)}},m=(a,u,p,D)=>{if(p.opsType===E.OperationType.Append||u){const r=i(p),l=u?"show":"enter";if(l==="show"&&(r==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const v=`fox-root-navigator__${r}-${l}-from`,y=`fox-root-navigator__${r}-${l}-to`;a.classList.remove(v),a.classList.add(y)}},c=(a,u,p,D)=>{if(p.opsType===E.OperationType.Append||u){const r=i(p),l=u?"show":"enter";if(l==="enter"&&(n=null,o=null),r!=="pop"){const v=`fox-root-navigator__${r}-${l}-active`,y=`fox-root-navigator__${r}-${l}-to`;a.classList.remove(v),a.classList.remove(y)}}e.dragRemove&&!u&&p.opsType===E.OperationType.Append&&Q(a,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},w=(a,u,p,D)=>{if(p.opsType===E.OperationType.Append||u){const r=i(p),l=u?"hide":"leave";if(l==="hide"&&(r==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;l==="leave"&&(n=p,o="leave");const v=`fox-root-navigator__${r}-${l}-from`,y=`fox-root-navigator__${r}-${l}-active`;a.classList.add(v),a.classList.add(y)}},f=(a,u,p,D)=>{if(p.opsType===E.OperationType.Append||u){const r=i(p),l=u?"hide":"leave";if(l==="hide"&&(r==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const v=`fox-root-navigator__${r}-${l}-from`,y=`fox-root-navigator__${r}-${l}-to`;a.classList.remove(v),a.classList.add(y)}},g=(a,u,p,D)=>{if(p.opsType===E.OperationType.Append||u){const r=i(p),l=u?"hide":"leave";if(l==="leave"&&(n=null,o=null),r!=="pop"){const v=`fox-root-navigator__${r}-${l}-active`,y=`fox-root-navigator__${r}-${l}-to`;a.classList.remove(v),a.classList.remove(y)}}e.dragRemove&&!u&&Z(a)};return(a,u)=>{const p=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(p,{class:"fox-root-navigator","view-class":a.viewClass,"before-enter":h,enter:m,"after-enter":c,"before-leave":w,leave:f,"after-leave":g,multi:!0,name:a.routerViewName,"view-tag":a.viewTag,transition:a.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,h,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=h,this.momentumReduceRatio=m}open(){const e=this.el,n=A(),o=(i,h,m,c)=>{let w=h+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(h==0){this.moving=!1;return}Math.abs(h)>f?h>0?w=this.startDistance+this.columnWidth:w=this.startDistance-this.columnWidth:w=this.startDistance;let g=-w;g<0?g=0:g>this.width-this.columnWidth&&(g=this.width-this.columnWidth);const a=Math.floor(g/this.columnWidth);this.isPageOpened(a)||this.openPage(a),w=-a*this.columnWidth,c&&c>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(a)}),V(i,w,"end",c),this.scrollDistance=w}else{if(Math.abs(h)>f){let a=0;if(h>0?a=Math.abs(this.startDistance+this.columnWidth):a=Math.abs(this.startDistance-this.columnWidth),a>=0&&a<this.width){const u=Math.floor(a/this.columnWidth);this.isPageOpened(u)||this.openPage(u)}}let g=-w;g<this.min?g=this.min:g>this.max&&(g=this.max),V(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()&&(ct(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const h=n.state.duration;if(h<at&&Math.abs(i)>st){const c=lt(i,h,this.momentumReduceRatio);o(e,c,"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,h){return new dt(t,e,n,o,i,h)}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")),h=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-h-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,h=()=>o.scrollDistance,m=d=>{if(o.openedIndexList.indexOf(d)===-1){o.openedIndexList.push(d);const x=n.routes[d];try{n.openViewPage(x,d)}catch(_){console.error(_)}}},c=d=>o.openedIndexList.indexOf(d)!==-1,w=d=>{o.index=d,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const x=n.routes[d];i("update:activePath",x.path)};let f=null;n.draggable&&(f=ut(h,m,c,w,n.moveRatio,n.momentumReduceRatio));let g=null;s.onMounted(()=>{const d=l(),x=()=>{const _=ft(d);a(n.activePath,n.routes,_.width,_.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(g=new window.ResizeObserver(x),g.observe(d)),x(),f){const _=y();f.el=_,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],([d,x,_,$,b,C])=>{const X=_<=0?o.width:_,L=$<=0?o.height:$;a(d,x,X,L,b,C)});const a=(d,x,_,$,b,C="horizontal")=>{const X=d;if(o.index=x.findIndex(L=>L.path===X),C==="horizontal"){const L=_;if(L>0){o.width=_;const gt=L*n.routes.length,vt=-L/3,_t=L*(x.length-1)+L/3;f&&(f.columnWidth=L,f.width=gt,f.min=vt,f.max=_t),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-L*o.index)}}f&&(f.swipeDuration=b)},u=`fox-swiper-navigator-${it()}`,p=s.computed(()=>{const d=[u];return n.customClass&&d.push(n.customClass),d}),D=s.computed(()=>{const d={},x=o.width>0?o.width:n.width;x>0&&(d.width=`${x}px`);const _=o.height>0?o.height:n.height;return _>0&&(d.height=`${_}px`),n.customStyle&&Object.assign(d,n.customStyle),d});let r=null;function l(){return r||(r=document.querySelector(`.${u}`),r)}let v=null;function y(){return v||(v=document.querySelector(`.${u}>.fox-swiper-navigator__inner`),v)}const T=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),M=(d,x)=>{const _=n.routes.findIndex($=>{const b=d.path??d.name??"";return $.path==b});return o.width<=0?{}:{style:{left:`${_*o.width}px`,width:`${o.width}px`}}};return(d,x)=>{const _=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(_,{class:s.normalizeClass(p.value),style:s.normalizeStyle(D.value),"view-class":"fox-swiper-navigator__item",tag:nt,"view-tag-props":M,multi:!0,name:d.routerViewName,transition:d.transition,"scroll-distance":o.scrollDistance,"scroll-duration":d.scrollDuration,direction:d.direction,width:T.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}})},Symbol.toStringTag,{value:"Module"}));let pt="fox-";const mt=[],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];mt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}return{install(t){Y.forEach(e=>{t.component(`${pt}${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-12",
5
5
  "description": "fox navigation",
6
6
  "author": "jiangcheng",
7
7
  "keywords": [