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

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-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;
2
+ * @fox-js/navigation v4.0.1-13 Tue Apr 30 2024 11:30:06 GMT+0800 (中国标准时间)
3
+ */const s=require("vue"),b=require("@fox-js/fox"),k=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:e.transition,multi:!0,name:e.routerViewName},null,8,["transition","name"])}}}),F=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"})),U=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}}),j=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"})),S=10;function q(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function V(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=q(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function H(t){return t===window}const G=t=>{const e=s.unref(t);if(H(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},J=(t,e,n)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const o=document.createEvent("Events");let i=!0,d=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?d=!!e[a]:o[a]=e[a];o.initEvent(t,i,d),(n??document).dispatchEvent(o)},K=15,Q=300,Z=200;function tt(t){t.stopPropagation()}function et(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function P(t,e=0,n,o=Z){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function A(t){t.style.transition="",t.style.transform=""}const nt=/^matrix\((.+)\)$/;function C(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const i=nt.exec(o);i&&(e=+i[1].split(/,\s*/)[4])}return e}const X=new WeakMap;function ot(t,e,n,o,i,d=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=V(),g=(_,h,c,w)=>{let v=h+a.startDistance;if(c==="end"){const D=G(_);let l=D.width*e;v<l?v=0:v=D.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&A(x),v==0?A(_):J(b.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&P(x,0,"",0),v>0&&typeof o=="function"&&o(),P(_,v,"end",w)}else v<0&&(v=0),P(_,v,"",0)},y=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=C(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||C(t)===0&&f.state.deltaX<0)&&(tt(_),g(t,f.state.deltaX,"",0))},u=()=>{if(f.isVertical()||C(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<Q&&Math.abs(h)>K){const v=et(h,c,n);g(t,v,"end",d)}else g(t,h,"end",d)};t.addEventListener("transitionend",y),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",u),t.addEventListener("touchcancel",u),X.set(t,{state:a,transitionend:y,touchstart:r,touchmove:p,touchend:u,touchcancel:u})}function it(t){const e=X.get(t);e&&(X.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const st=s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function d(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=u,o="enter");const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(v)}},a=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(v)}},x=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),w=p?"show":"enter";if(w==="enter"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${w}-active`,D=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)===!0&&!p&&u.opsType===b.OperationType.Append&&ot(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=u,o="leave");const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(v)}},g=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(v)}},y=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),w=p?"hide":"leave";if(w==="leave"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${w}-active`,D=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)&&!p&&it(r)};return(r,p)=>{const u=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(u,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:g,"after-leave":y,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}}),at=Object.freeze(Object.defineProperty({__proto__:null,default:st},Symbol.toStringTag,{value:"Module"})),rt={class:"fox-swiper-navigator"},ct=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,i)=>(s.openBlock(),s.createElementBlock("div",rt,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.renderSlot(o.$slots,"default")],4)]))}});let lt=0;function ut(){return++lt}const dt=15,ft=300,ht=200;function mt(t){t.stopPropagation()}function pt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function I(t,e=0,n,o=ht){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}class vt{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,i,d,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=d,this.momentumReduceRatio=m}open(){const e=this.el,n=V(),o=(i,d,m,a)=>{let x=d+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(d==0){this.moving=!1;return}Math.abs(d)>f?d>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let g=-x;g<0?g=0:g>this.width-this.columnWidth&&(g=this.width-this.columnWidth);const y=Math.floor(g/this.columnWidth);this.isPageOpened(y)||this.openPage(y),x=-y*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(y)}),I(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(d)>f){let y=0;if(d>0?y=Math.abs(this.startDistance+this.columnWidth):y=Math.abs(this.startDistance-this.columnWidth),y>=0&&y<this.width){const r=Math.floor(y/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let g=-x;g<this.min?g=this.min:g>this.max&&(g=this.max),I(i,-g,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=i=>{this.moving||(n.start(i),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=i=>{n.move(i),!n.isVertical()&&(mt(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const d=n.state.duration;if(d<ft&&Math.abs(i)>dt){const a=pt(i,d,this.momentumReduceRatio);o(e,a,"end",this.swipeDuration)}else o(e,i,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function gt(t,e,n,o,i,d){return new vt(t,e,n,o,i,d)}function _t(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),d=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-d-m}}const wt=s.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,d=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(T){console.error(T)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=gt(d,m,a,x,n.moveRatio,n.momentumReduceRatio));let g=null;s.onMounted(()=>{const l=h(),E=()=>{const T=_t(l);y(n.activePath,n.routes,T.width,T.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(g=new window.ResizeObserver(E),g.observe(l)),E(),f){const T=w();f.el=T,f.open()}}),s.onBeforeUnmount(()=>{g&&(g.disconnect(),g=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,T,$,M,R])=>{const O=T<=0?o.width:T,L=$<=0?o.height:$;y(l,E,O,L,M,R)});const y=(l,E,T,$,M,R="horizontal")=>{const O=l;if(o.index=E.findIndex(L=>L.path===O),R==="horizontal"){const L=T;if(L>0){o.width=T;const z=L*n.routes.length,W=-L/3,N=L*(E.length-1)+L/3;f&&(f.columnWidth=L,f.width=z,f.min=W,f.max=N),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-L*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${ut()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),u=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const T=o.height>0?o.height:n.height;return T>0&&(l.height=`${T}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function w(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const v=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),D=(l,E)=>{const T=n.routes.findIndex($=>{const M=l.path??l.name??"";return $.path==M});return o.width<=0?{}:{style:{left:`${T*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const T=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(T,{class:s.normalizeClass(p.value),style:s.normalizeStyle(u.value),"view-class":"fox-swiper-navigator__item",tag:ct,"view-tag-props":D,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:v.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}}),Tt=Object.freeze(Object.defineProperty({__proto__:null,default:wt},Symbol.toStringTag,{value:"Module"}));let yt="fox-";const xt=[],B=Object.assign({"/src/components/card-navigator/index.vue":F,"/src/components/default-navigator/index.vue":j,"/src/components/root-navigator/index.vue":at,"/src/components/swiper-navigator/index.vue":Tt}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];xt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}const Et={install(t){Y.forEach(e=>{t.component(`${yt}${e.name}`,e.component)})}};module.exports=Et;
package/dist/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as 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";
1
+ import { defineComponent as P, resolveComponent as O, openBlock as b, createBlock as R, withCtx as Y, createVNode as J, Transition as K, resolveDynamicComponent as Q, unref as F, computed as X, createElementBlock as Z, createElementVNode as tt, normalizeStyle as U, renderSlot as et, reactive as nt, onMounted as ot, onBeforeUnmount as it, watch as st, normalizeClass as at } from "vue";
2
+ import { FoxLeaveEnd as rt, OperationType as L } from "@fox-js/fox";
3
3
  /*!
4
- * @fox-js/navigation v4.0.1-11 Thu Apr 11 2024 17:14:28 GMT+0800 (中国标准时间)
4
+ * @fox-js/navigation v4.0.1-13 Tue Apr 30 2024 11:30:06 GMT+0800 (中国标准时间)
5
5
  */
6
- const ct = /* @__PURE__ */ R({
6
+ const ct = /* @__PURE__ */ P({
7
7
  __name: "index",
8
8
  props: {
9
9
  routerViewName: {},
@@ -12,7 +12,7 @@ const ct = /* @__PURE__ */ R({
12
12
  setup(t) {
13
13
  return (e, n) => {
14
14
  const o = O("fox-router-view");
15
- return L(), M(o, {
15
+ return b(), R(o, {
16
16
  class: "fox-card-navigator",
17
17
  "view-class": "fox-card-navigator__item",
18
18
  "view-active-class": "fox-card-navigator__item-active",
@@ -27,7 +27,7 @@ const ct = /* @__PURE__ */ R({
27
27
  }), lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
28
28
  __proto__: null,
29
29
  default: ct
30
- }, Symbol.toStringTag, { value: "Module" })), ut = /* @__PURE__ */ R({
30
+ }, Symbol.toStringTag, { value: "Module" })), ut = /* @__PURE__ */ P({
31
31
  __name: "index",
32
32
  props: {
33
33
  routerViewName: {},
@@ -36,7 +36,7 @@ const ct = /* @__PURE__ */ R({
36
36
  setup(t) {
37
37
  return (e, n) => {
38
38
  const o = O("fox-router-view");
39
- return L(), M(o, {
39
+ return b(), R(o, {
40
40
  transition: !1,
41
41
  multi: !1,
42
42
  name: e.routerViewName
@@ -44,7 +44,7 @@ const ct = /* @__PURE__ */ R({
44
44
  default: Y(({ Component: i }) => [
45
45
  J(K, { name: "fox-default-navigator__trans" }, {
46
46
  default: Y(() => [
47
- (L(), M(Q(i)))
47
+ (b(), R(Q(i)))
48
48
  ]),
49
49
  _: 2
50
50
  }, 1024)
@@ -77,20 +77,20 @@ function j() {
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: (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;
80
+ move: (h) => {
81
+ if (h.touches) {
82
+ const s = h.touches[0];
83
+ t.deltaX = s.clientX - t.startX, t.deltaY = s.clientY - t.startY, t.moveX = s.clientX, t.moveY = s.clientY;
84
84
  } else
85
- t.deltaX = m.clientX - t.startX, t.deltaY = m.clientY - t.startY, t.moveX = m.clientX, t.moveY = m.clientY;
85
+ t.deltaX = h.clientX - t.startX, t.deltaY = h.clientY - t.startY, t.moveX = h.clientX, t.moveY = h.clientY;
86
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: (m) => {
89
- if (o(), m.touches) {
90
- const r = m.touches[0];
91
- t.startX = r.clientX, t.startY = r.clientY;
88
+ start: (h) => {
89
+ if (o(), h.touches) {
90
+ const s = h.touches[0];
91
+ t.startX = s.clientX, t.startY = s.clientY;
92
92
  } else
93
- t.startX = m.clientX, t.startY = m.clientY;
93
+ t.startX = h.clientX, t.startY = h.clientY;
94
94
  t.startTime = Date.now();
95
95
  },
96
96
  reset: o,
@@ -130,10 +130,10 @@ const mt = (t) => {
130
130
  detail: void 0
131
131
  };
132
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);
133
+ let i = !0, u = !0;
134
+ for (let s in e)
135
+ s === "bubbles" ? i = !!e[s] : s === "cancelable" ? u = !!e[s] : o[s] = e[s];
136
+ o.initEvent(t, i, u), (n ?? document).dispatchEvent(o);
137
137
  }, vt = 15, gt = 300, _t = 200;
138
138
  function wt(t) {
139
139
  t.stopPropagation();
@@ -158,61 +158,61 @@ function I(t) {
158
158
  return e;
159
159
  }
160
160
  const V = /* @__PURE__ */ new WeakMap();
161
- function yt(t, e, n, o, i, f = 600, m = 60) {
162
- const r = {
161
+ function yt(t, e, n, o, i, u = 600, h = 60) {
162
+ const s = {
163
163
  active: !0,
164
164
  startDistance: 0,
165
165
  scrollDistance: 0,
166
166
  scrollTime: 0,
167
167
  moving: !1,
168
168
  transitionEndTrigger: null
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);
169
+ }, x = t.previousSibling, d = j(), v = (g, f, r, _) => {
170
+ let p = f + s.startDistance;
171
+ if (r === "end") {
172
+ const E = mt(g);
173
+ let c = E.width * e;
174
+ p < c ? p = 0 : p = E.width, s.transitionEndTrigger = () => {
175
+ s.moving = !1, i && g.classList.remove(i), setTimeout(() => {
176
+ x && z(x), p == 0 ? z(g) : pt(rt, {}, g), s.moving = !1;
177
+ }, h);
178
+ }, x && C(x, 0, "", 0), p > 0 && typeof o == "function" && o(), C(g, p, "end", _);
179
179
  } else
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 = () => {
180
+ p < 0 && (p = 0), C(g, p, "", 0);
181
+ }, T = () => {
182
+ s.transitionEndTrigger && (s.transitionEndTrigger(), s.transitionEndTrigger = null);
183
+ }, a = (g) => {
184
+ d.start(g), s.scrollDistance = 0, s.moving && (s.scrollDistance = I(t)), i && t.classList.add(i), s.transitionEndTrigger = null, s.moving = !0;
185
+ }, m = (g) => {
186
+ s.moving = !0, d.move(g), !(d.isVertical() || I(t) === 0 && d.state.deltaX < 0) && (wt(g), v(t, d.state.deltaX, "", 0));
187
+ }, l = () => {
188
188
  if (d.isVertical() || I(t) === 0 && d.state.deltaX < 0)
189
189
  return;
190
- const c = d.state.deltaX;
191
- if (c === 0) {
192
- i && t.classList.remove(i), r.moving = !1;
190
+ const f = d.state.deltaX;
191
+ if (f === 0) {
192
+ i && t.classList.remove(i), s.moving = !1;
193
193
  return;
194
194
  }
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);
195
+ const r = d.state.duration;
196
+ if (r < gt && Math.abs(f) > vt) {
197
+ const p = Tt(f, r, n);
198
+ v(t, p, "end", u);
199
199
  } else
200
- p(t, c, "end", f);
200
+ v(t, f, "end", u);
201
201
  };
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
+ t.addEventListener("transitionend", T), t.addEventListener("touchstart", a), t.addEventListener("touchmove", m), t.addEventListener("touchend", l), t.addEventListener("touchcancel", l), V.set(t, {
203
+ state: s,
204
+ transitionend: T,
205
+ touchstart: a,
206
+ touchmove: m,
207
+ touchend: l,
208
+ touchcancel: l
209
209
  });
210
210
  }
211
211
  function Et(t) {
212
212
  const e = V.get(t);
213
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));
214
214
  }
215
- const Dt = /* @__PURE__ */ R({
215
+ const Dt = /* @__PURE__ */ P({
216
216
  __name: "index",
217
217
  props: {
218
218
  dragRemove: { type: Boolean, default: !0 },
@@ -229,36 +229,39 @@ const Dt = /* @__PURE__ */ R({
229
229
  setup(t) {
230
230
  const e = t;
231
231
  let n = null, o = null;
232
- function i(s) {
233
- return (s.params && s.params.animationType) ?? "slide";
232
+ function i(a) {
233
+ return (a.params && a.params.animationType) ?? "slide";
234
234
  }
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"))
235
+ function u(a) {
236
+ return (a.params && a.params.dragRemove) ?? e.dragRemove;
237
+ }
238
+ const h = (a, m, l, g) => {
239
+ if (l.opsType === L.Append || m) {
240
+ const f = i(l), r = m ? "show" : "enter";
241
+ if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
239
242
  return;
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);
243
+ r === "enter" && (n = l, o = "enter");
244
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
245
+ a.classList.add(_), a.classList.add(p);
243
246
  }
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"))
247
+ }, s = (a, m, l, g) => {
248
+ if (l.opsType === L.Append || m) {
249
+ const f = i(l), r = m ? "show" : "enter";
250
+ if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
248
251
  return;
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);
252
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
253
+ a.classList.remove(_), a.classList.add(p);
251
254
  }
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);
255
+ }, x = (a, m, l, g) => {
256
+ if (l.opsType === L.Append || m) {
257
+ const r = i(l), _ = m ? "show" : "enter";
258
+ if (_ === "enter" && (n = null, o = null), r !== "pop") {
259
+ const p = `fox-root-navigator__${r}-${_}-active`, E = `fox-root-navigator__${r}-${_}-to`;
260
+ a.classList.remove(p), a.classList.remove(E);
258
261
  }
259
262
  }
260
- e.dragRemove && !u && h.opsType === D.Append && yt(
261
- s,
263
+ u(l) === !0 && !m && l.opsType === L.Append && yt(
264
+ a,
262
265
  e.removeMoveRatio,
263
266
  e.momentumReduceRatio,
264
267
  e.removeViewPage,
@@ -266,55 +269,55 @@ const Dt = /* @__PURE__ */ R({
266
269
  e.swipeDuration,
267
270
  e.resetDelay
268
271
  );
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"))
272
+ }, d = (a, m, l, g) => {
273
+ if (l.opsType === L.Append || m) {
274
+ const f = i(l), r = m ? "hide" : "leave";
275
+ if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
273
276
  return;
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);
277
+ r === "leave" && (n = l, o = "leave");
278
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
279
+ a.classList.add(_), a.classList.add(p);
277
280
  }
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"))
281
+ }, v = (a, m, l, g) => {
282
+ if (l.opsType === L.Append || m) {
283
+ const f = i(l), r = m ? "hide" : "leave";
284
+ if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
282
285
  return;
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);
286
+ const _ = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
287
+ a.classList.remove(_), a.classList.add(p);
285
288
  }
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);
289
+ }, T = (a, m, l, g) => {
290
+ if (l.opsType === L.Append || m) {
291
+ const r = i(l), _ = m ? "hide" : "leave";
292
+ if (_ === "leave" && (n = null, o = null), r !== "pop") {
293
+ const p = `fox-root-navigator__${r}-${_}-active`, E = `fox-root-navigator__${r}-${_}-to`;
294
+ a.classList.remove(p), a.classList.remove(E);
292
295
  }
293
296
  }
294
- e.dragRemove && !u && Et(s);
297
+ u(l) && !m && Et(a);
295
298
  };
296
- return (s, u) => {
297
- const h = O("fox-router-view");
298
- return L(), M(h, {
299
+ return (a, m) => {
300
+ const l = O("fox-router-view");
301
+ return b(), R(l, {
299
302
  class: "fox-root-navigator",
300
- "view-class": s.viewClass,
301
- "before-enter": f,
302
- enter: m,
303
- "after-enter": r,
304
- "before-leave": _,
305
- leave: d,
306
- "after-leave": p,
303
+ "view-class": a.viewClass,
304
+ "before-enter": h,
305
+ enter: s,
306
+ "after-enter": x,
307
+ "before-leave": d,
308
+ leave: v,
309
+ "after-leave": T,
307
310
  multi: !0,
308
- name: s.routerViewName,
309
- "view-tag": s.viewTag,
310
- transition: s.transition
311
+ name: a.routerViewName,
312
+ "view-tag": a.viewTag,
313
+ transition: a.transition
311
314
  }, null, 8, ["view-class", "name", "view-tag", "transition"]);
312
315
  };
313
316
  }
314
317
  }), Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
315
318
  __proto__: null,
316
319
  default: Dt
317
- }, Symbol.toStringTag, { value: "Module" })), bt = { class: "fox-swiper-navigator" }, $t = /* @__PURE__ */ R({
320
+ }, Symbol.toStringTag, { value: "Module" })), bt = { class: "fox-swiper-navigator" }, $t = /* @__PURE__ */ P({
318
321
  __name: "swiper",
319
322
  props: {
320
323
  width: {},
@@ -330,7 +333,7 @@ const Dt = /* @__PURE__ */ R({
330
333
  };
331
334
  return e.scrollDuration > 0 && (o["transition-duration"] = `${e.scrollDuration}ms`), o;
332
335
  });
333
- return (o, i) => (L(), Z("div", bt, [
336
+ return (o, i) => (b(), Z("div", bt, [
334
337
  tt("div", {
335
338
  class: "fox-swiper-navigator__inner",
336
339
  style: U(n.value)
@@ -449,38 +452,38 @@ class Ct {
449
452
  * @param momentumReduceRatio
450
453
  *
451
454
  */
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;
455
+ constructor(e, n, o, i, u, h) {
456
+ this.getStartDistance = e, this.openPage = n, this.isPageOpened = o, this.pageOpened = i, this.moveRatio = u, this.momentumReduceRatio = h;
454
457
  }
455
458
  /**
456
459
  * 打开drag支持
457
460
  */
458
461
  open() {
459
- const e = this.el, n = j(), o = (i, f, m, r) => {
460
- let _ = f + this.startDistance;
462
+ const e = this.el, n = j(), o = (i, u, h, s) => {
463
+ let x = u + this.startDistance;
461
464
  const d = this.columnWidth * this.moveRatio;
462
- if (m === "end") {
463
- if (f == 0) {
465
+ if (h === "end") {
466
+ if (u == 0) {
464
467
  this.moving = !1;
465
468
  return;
466
469
  }
467
- Math.abs(f) > d ? f > 0 ? _ = this.startDistance + this.columnWidth : _ = this.startDistance - this.columnWidth : _ = this.startDistance;
468
- let p = -_;
469
- p < 0 ? p = 0 : p > this.width - this.columnWidth && (p = this.width - this.columnWidth);
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 = _;
470
+ Math.abs(u) > d ? u > 0 ? x = this.startDistance + this.columnWidth : x = this.startDistance - this.columnWidth : x = this.startDistance;
471
+ let v = -x;
472
+ v < 0 ? v = 0 : v > this.width - this.columnWidth && (v = this.width - this.columnWidth);
473
+ const T = Math.floor(v / this.columnWidth);
474
+ this.isPageOpened(T) || this.openPage(T), x = -T * this.columnWidth, s && s > 0 && (this.transitionEndTrigger = () => {
475
+ this.moving = !1, this.pageOpened(T);
476
+ }), N(i, x, "end", s), this.scrollDistance = x;
474
477
  } else {
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);
479
- this.isPageOpened(u) || this.openPage(u);
478
+ if (Math.abs(u) > d) {
479
+ let T = 0;
480
+ if (u > 0 ? T = Math.abs(this.startDistance + this.columnWidth) : T = Math.abs(this.startDistance - this.columnWidth), T >= 0 && T < this.width) {
481
+ const a = Math.floor(T / this.columnWidth);
482
+ this.isPageOpened(a) || this.openPage(a);
480
483
  }
481
484
  }
482
- let p = -_;
483
- p < this.min ? p = this.min : p > this.max && (p = this.max), N(i, -p, "", 0);
485
+ let v = -x;
486
+ v < this.min ? v = this.min : v > this.max && (v = this.max), N(i, -v, "", 0);
484
487
  }
485
488
  };
486
489
  this.transitionend = () => {
@@ -495,10 +498,10 @@ class Ct {
495
498
  const i = n.state.deltaX;
496
499
  if (i == 0)
497
500
  return;
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);
501
+ const u = n.state.duration;
502
+ if (u < Xt && Math.abs(i) > Pt) {
503
+ const s = At(i, u, this.momentumReduceRatio);
504
+ o(e, s, "end", this.swipeDuration);
502
505
  } else
503
506
  o(e, i, "end", this.swipeDuration);
504
507
  }, e.addEventListener("transitionend", this.transitionend), e.addEventListener("touchstart", this.touchstart), e.addEventListener("touchmove", this.touchmove), e.addEventListener("touchend", this.touchend), e.addEventListener("touchcancel", this.touchend);
@@ -511,17 +514,17 @@ class Ct {
511
514
  this.transitionend && e.addEventListener("transitionend", this.transitionend), this.touchstart && e.addEventListener("touchstart", this.touchstart), this.touchmove && e.addEventListener("touchmove", this.touchmove), this.touchend && e.addEventListener("touchend", this.touchend), this.touchcancel && e.addEventListener("touchcancel", this.touchcancel), this.el = null;
512
515
  }
513
516
  }
514
- function It(t, e, n, o, i, f) {
515
- return new Ct(t, e, n, o, i, f);
517
+ function It(t, e, n, o, i, u) {
518
+ return new Ct(t, e, n, o, i, u);
516
519
  }
517
520
  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"));
521
+ const e = F(t), n = window.getComputedStyle(e, null), o = parseFloat(n.getPropertyValue("padding-left")), i = parseFloat(n.getPropertyValue("padding-right")), u = parseFloat(n.getPropertyValue("padding-top")), h = parseFloat(n.getPropertyValue("padding-bottom"));
519
522
  return {
520
523
  width: e.clientWidth - o - i,
521
- height: e.clientHeight - f - m
524
+ height: e.clientHeight - u - h
522
525
  };
523
526
  }
524
- const Yt = /* @__PURE__ */ R({
527
+ const Yt = /* @__PURE__ */ P({
525
528
  __name: "index",
526
529
  props: {
527
530
  activePath: {},
@@ -548,42 +551,42 @@ const Yt = /* @__PURE__ */ R({
548
551
  openedIndexList: [],
549
552
  width: n.width,
550
553
  height: n.height
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];
554
+ }), i = e, u = () => o.scrollDistance, h = (c) => {
555
+ if (o.openedIndexList.indexOf(c) === -1) {
556
+ o.openedIndexList.push(c);
557
+ const y = n.routes[c];
555
558
  try {
556
- n.openViewPage(x, l);
557
- } catch (g) {
558
- console.error(g);
559
+ n.openViewPage(y, c);
560
+ } catch (w) {
561
+ console.error(w);
559
562
  }
560
563
  }
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);
564
+ }, s = (c) => o.openedIndexList.indexOf(c) !== -1, x = (c) => {
565
+ o.index = c, o.width > 0 ? o.scrollDistance = -o.index * o.width : o.scrollDistance = 0;
566
+ const y = n.routes[c];
567
+ i("update:activePath", y.path);
565
568
  };
566
569
  let d = null;
567
570
  n.draggable && (d = It(
568
- f,
569
- m,
570
- r,
571
- _,
571
+ u,
572
+ h,
573
+ s,
574
+ x,
572
575
  n.moveRatio,
573
576
  n.momentumReduceRatio
574
577
  ));
575
- let p = null;
578
+ let v = null;
576
579
  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);
580
+ const c = f(), y = () => {
581
+ const w = Vt(c);
582
+ T(n.activePath, n.routes, w.width, w.height, n.swipeDuration, n.direction);
580
583
  };
581
- if (window.ResizeObserver && (p = new window.ResizeObserver(x), p.observe(l)), x(), d) {
582
- const g = T();
583
- d.el = g, d.open();
584
+ if (window.ResizeObserver && (v = new window.ResizeObserver(y), v.observe(c)), y(), d) {
585
+ const w = _();
586
+ d.el = w, d.open();
584
587
  }
585
588
  }), it(() => {
586
- p && (p.disconnect(), p = null), d && d.close();
589
+ v && (v.disconnect(), v = null), d && d.close();
587
590
  }), st(
588
591
  [
589
592
  () => n.activePath,
@@ -593,66 +596,66 @@ const Yt = /* @__PURE__ */ R({
593
596
  () => n.swipeDuration,
594
597
  () => n.direction
595
598
  ],
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);
599
+ ([c, y, w, $, M, S]) => {
600
+ const A = w <= 0 ? o.width : w, D = $ <= 0 ? o.height : $;
601
+ T(c, y, A, D, M, S);
599
602
  }
600
603
  );
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);
604
+ const T = (c, y, w, $, M, S = "horizontal") => {
605
+ const A = c;
606
+ if (o.index = y.findIndex((D) => D.path === A), S === "horizontal") {
607
+ const D = w;
608
+ if (D > 0) {
609
+ o.width = w;
610
+ const q = D * n.routes.length, H = -D / 3, G = D * (y.length - 1) + D / 3;
611
+ d && (d.columnWidth = D, d.width = q, d.min = H, d.max = G), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -D * o.index);
609
612
  }
610
613
  }
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;
614
+ d && (d.swipeDuration = M);
615
+ }, a = `fox-swiper-navigator-${Rt()}`, m = X(() => {
616
+ const c = [a];
617
+ return n.customClass && c.push(n.customClass), c;
618
+ }), l = X(() => {
619
+ const c = {}, y = o.width > 0 ? o.width : n.width;
620
+ y > 0 && (c.width = `${y}px`);
621
+ const w = o.height > 0 ? o.height : n.height;
622
+ return w > 0 && (c.height = `${w}px`), n.customStyle && Object.assign(c, n.customStyle), c;
620
623
  });
621
- let a = null;
622
- function c() {
623
- return a || (a = document.querySelector(`.${u}`), a);
624
+ let g = null;
625
+ function f() {
626
+ return g || (g = document.querySelector(`.${a}`), g);
624
627
  }
625
- let v = null;
626
- function T() {
627
- return v || (v = document.querySelector(`.${u}>.fox-swiper-navigator__inner`), v);
628
+ let r = null;
629
+ function _() {
630
+ return r || (r = document.querySelector(`.${a}>.fox-swiper-navigator__inner`), r);
628
631
  }
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 == $;
632
+ const p = X(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), E = (c, y) => {
633
+ const w = n.routes.findIndex(($) => {
634
+ const M = c.path ?? c.name ?? "";
635
+ return $.path == M;
633
636
  });
634
637
  return o.width <= 0 ? {} : {
635
638
  style: {
636
- left: `${g * o.width}px`,
639
+ left: `${w * o.width}px`,
637
640
  width: `${o.width}px`
638
641
  }
639
642
  };
640
643
  };
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),
644
+ return (c, y) => {
645
+ const w = O("fox-router-view");
646
+ return b(), R(w, {
647
+ class: at(m.value),
648
+ style: U(l.value),
646
649
  "view-class": "fox-swiper-navigator__item",
647
650
  tag: $t,
648
- "view-tag-props": P,
651
+ "view-tag-props": E,
649
652
  multi: !0,
650
- name: l.routerViewName,
651
- transition: l.transition,
653
+ name: c.routerViewName,
654
+ transition: c.transition,
652
655
  "scroll-distance": o.scrollDistance,
653
- "scroll-duration": l.scrollDuration,
654
- direction: l.direction,
655
- width: w.value
656
+ "scroll-duration": c.scrollDuration,
657
+ direction: c.direction,
658
+ width: p.value
656
659
  }, null, 8, ["class", "style", "name", "transition", "scroll-distance", "scroll-duration", "direction", "width"]);
657
660
  };
658
661
  }
package/dist/index.umd.js CHANGED
@@ -1,3 +1,3 @@
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)})}}});
1
+ (function(s,D){typeof exports=="object"&&typeof module<"u"?module.exports=D(require("vue"),require("@fox-js/fox")):typeof define=="function"&&define.amd?define(["vue","@fox-js/fox"],D):(s=typeof globalThis<"u"?globalThis:s||self,s.FoxNavigation=D(s.Vue,s.Fox))})(this,function(s,D){"use strict";/*!
2
+ * @fox-js/navigation v4.0.1-13 Tue Apr 30 2024 11:30:06 GMT+0800 (中国标准时间)
3
+ */const z=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:e.transition,multi:!0,name:e.routerViewName},null,8,["transition","name"])}}})},Symbol.toStringTag,{value:"Module"})),W=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}})},Symbol.toStringTag,{value:"Module"})),S=10;function N(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function A(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=N(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function F(t){return t===window}const k=t=>{const e=s.unref(t);if(F(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},j=(t,e,n)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const o=document.createEvent("Events");let i=!0,u=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?u=!!e[a]:o[a]=e[a];o.initEvent(t,i,u),(n??document).dispatchEvent(o)},U=15,q=300,H=200;function G(t){t.stopPropagation()}function J(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function R(t,e=0,n,o=H){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function I(t){t.style.transition="",t.style.transform=""}const K=/^matrix\((.+)\)$/;function O(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const i=K.exec(o);i&&(e=+i[1].split(/,\s*/)[4])}return e}const P=new WeakMap;function Q(t,e,n,o,i,u=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=A(),v=(_,h,c,w)=>{let g=h+a.startDistance;if(c==="end"){const L=k(_);let l=L.width*e;g<l?g=0:g=L.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&I(x),g==0?I(_):j(D.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&R(x,0,"",0),g>0&&typeof o=="function"&&o(),R(_,g,"end",w)}else g<0&&(g=0),R(_,g,"",0)},y=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=O(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||O(t)===0&&f.state.deltaX<0)&&(G(_),v(t,f.state.deltaX,"",0))},d=()=>{if(f.isVertical()||O(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<q&&Math.abs(h)>U){const g=J(h,c,n);v(t,g,"end",u)}else v(t,h,"end",u)};t.addEventListener("transitionend",y),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",d),t.addEventListener("touchcancel",d),P.set(t,{state:a,transitionend:y,touchstart:r,touchmove:p,touchend:d,touchcancel:d})}function Z(t){const e=P.get(t);e&&(P.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const tt=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function u(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=d,o="enter");const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(g)}},a=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(g)}},x=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),w=p?"show":"enter";if(w==="enter"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${w}-active`,L=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)===!0&&!p&&d.opsType===D.OperationType.Append&&Q(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=d,o="leave");const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(g)}},v=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(g)}},y=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),w=p?"hide":"leave";if(w==="leave"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${w}-active`,L=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)&&!p&&Z(r)};return(r,p)=>{const d=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(d,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:v,"after-leave":y,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}})},Symbol.toStringTag,{value:"Module"})),et={class:"fox-swiper-navigator"},nt=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,i)=>(s.openBlock(),s.createElementBlock("div",et,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.renderSlot(o.$slots,"default")],4)]))}});let ot=0;function it(){return++ot}const st=15,at=300,rt=200;function ct(t){t.stopPropagation()}function lt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function V(t,e=0,n,o=rt){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}class dt{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,i,u,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=u,this.momentumReduceRatio=m}open(){const e=this.el,n=A(),o=(i,u,m,a)=>{let x=u+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(u==0){this.moving=!1;return}Math.abs(u)>f?u>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let v=-x;v<0?v=0:v>this.width-this.columnWidth&&(v=this.width-this.columnWidth);const y=Math.floor(v/this.columnWidth);this.isPageOpened(y)||this.openPage(y),x=-y*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(y)}),V(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(u)>f){let y=0;if(u>0?y=Math.abs(this.startDistance+this.columnWidth):y=Math.abs(this.startDistance-this.columnWidth),y>=0&&y<this.width){const r=Math.floor(y/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let v=-x;v<this.min?v=this.min:v>this.max&&(v=this.max),V(i,-v,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=i=>{this.moving||(n.start(i),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=i=>{n.move(i),!n.isVertical()&&(ct(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const u=n.state.duration;if(u<at&&Math.abs(i)>st){const a=lt(i,u,this.momentumReduceRatio);o(e,a,"end",this.swipeDuration)}else o(e,i,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function ut(t,e,n,o,i,u){return new dt(t,e,n,o,i,u)}function ft(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),u=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-u-m}}const ht=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,u=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(T){console.error(T)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=ut(u,m,a,x,n.moveRatio,n.momentumReduceRatio));let v=null;s.onMounted(()=>{const l=h(),E=()=>{const T=ft(l);y(n.activePath,n.routes,T.width,T.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(v=new window.ResizeObserver(E),v.observe(l)),E(),f){const T=w();f.el=T,f.open()}}),s.onBeforeUnmount(()=>{v&&(v.disconnect(),v=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,T,b,M,C])=>{const X=T<=0?o.width:T,$=b<=0?o.height:b;y(l,E,X,$,M,C)});const y=(l,E,T,b,M,C="horizontal")=>{const X=l;if(o.index=E.findIndex($=>$.path===X),C==="horizontal"){const $=T;if($>0){o.width=T;const gt=$*n.routes.length,vt=-$/3,_t=$*(E.length-1)+$/3;f&&(f.columnWidth=$,f.width=gt,f.min=vt,f.max=_t),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-$*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${it()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),d=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const T=o.height>0?o.height:n.height;return T>0&&(l.height=`${T}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function w(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const g=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),L=(l,E)=>{const T=n.routes.findIndex(b=>{const M=l.path??l.name??"";return b.path==M});return o.width<=0?{}:{style:{left:`${T*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const T=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(T,{class:s.normalizeClass(p.value),style:s.normalizeStyle(d.value),"view-class":"fox-swiper-navigator__item",tag:nt,"view-tag-props":L,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:g.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}})},Symbol.toStringTag,{value:"Module"}));let mt="fox-";const pt=[],B=Object.assign({"/src/components/card-navigator/index.vue":z,"/src/components/default-navigator/index.vue":W,"/src/components/root-navigator/index.vue":tt,"/src/components/swiper-navigator/index.vue":ht}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];pt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}return{install(t){Y.forEach(e=>{t.component(`${mt}${e.name}`,e.component)})}}});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .fox-card-navigator{position:relative;overflow:hidden;width:100%}.fox-card-navigator__item{position:relative;width:100%}.fox-card-navigator__item-active{z-index:1}.fox-card-navigator__item-inactive{display:none;z-index:0}.fox-card-navigator__trans-enter-from,.fox-card-navigator__trans-show-from{-webkit-transform:translate3d(50%,0%,0);transform:translate3d(50%,0,0)}.fox-card-navigator__trans-enter-to,.fox-card-navigator__trans-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-card-navigator__trans-hide-active{position:absolute;display:block;-webkit-transition:opacity .36s cubic-bezier(.17,.89,.45,1);transition:opacity .36s cubic-bezier(.17,.89,.45,1)}.fox-card-navigator__trans-leave-to,.fox-card-navigator__trans-hide-to{opacity:0}.fox-default-navigator__trans-enter,.fox-default-navigator__trans-show{-webkit-transform:translate3d(50%,0%,0);transform:translate3d(50%,0,0)}.fox-default-navigator__trans-enter-to,.fox-default-navigator__trans-show-to{-webkit-transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1);transition:transform .36s cubic-bezier(.17,.89,.45,1),-webkit-transform .36s cubic-bezier(.17,.89,.45,1);-webkit-transform:translate3d(0%,0,0);transform:translateZ(0)}.fox-default-navigator__trans-hide-active{position:absolute;display:block;-webkit-transition:opacity .36s cubic-bezier(.17,.89,.45,1);transition:opacity .36s cubic-bezier(.17,.89,.45,1)}.fox-default-navigator__trans-leave-to,.fox-default-navigator__trans-hide-to{opacity:0}.fox-root-navigator{position:relative;overflow:hidden;width:100%}.fox-root-navigator__item{position:fixed;left:0;top:0;width:100%;z-index:120;-webkit-box-sizing:border-box;box-sizing:border-box}.fox-root-navigator__item-moving{-webkit-box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19);box-shadow:0 4px 8px #0003,0 6px 20px #00000030}.fox-root-navigator__slide-enter-from{-webkit-transform:translate3d(103%,0,0);transform:translate3d(103%,0,0)}.fox-root-navigator__slide-enter-to{-webkit-transition:-webkit-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.fox-root-navigator__slide-leave-to{-webkit-transition:-webkit-transform .5s ease-out;transition:-webkit-transform .5s ease-out;transition:transform .5s ease-out;transition:transform .5s ease-out,-webkit-transform .5s ease-out;-webkit-transform:translate3d(103%,0,0)!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}
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:var(--fox-root-navigator-width, 100vw);height:var(--fox-root-navigator-height, 100vh)}.fox-root-navigator__item{position:var(--fox-root-navigator-item-position, absolute);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:var(--fox-swiper-navigator-item-position, absolute);top:0;bottom:0}.fox-swiper-navigator__inner{position:var(--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-12",
4
+ "version": "4.0.1-14",
5
5
  "description": "fox navigation",
6
6
  "author": "jiangcheng",
7
7
  "keywords": [