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