@fox-js/navigation 4.0.1-3 → 4.0.1-5

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/README.md CHANGED
@@ -242,13 +242,13 @@ onMounted(() => {
242
242
 
243
243
  <template>
244
244
  <fox-page :content-padding="contentPadding" ref="pageRef">
245
- <fox-footer>
245
+ <fox-footer-bar>
246
246
  <fox-tabbar v-model="index" @change="onTabChange">
247
247
  <template v-for="tab in tabs" :key="tab.title">
248
248
  <fox-tabbar-item :title="tab.title" :icon="tab.icon"></fox-tabbar-item>
249
249
  </template>
250
250
  </fox-tabbar>
251
- </fox-footer>
251
+ </fox-footer-bar>
252
252
  <fox-content ref="contentRef">
253
253
  <fox-swiper-navigator
254
254
  v-model:activePath="activeRoutePath"
package/dist/index.cjs.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";/*!
2
- * @fox-js/navigation v4.0.1-1 Wed Nov 02 2022 21:56:39 GMT+0800 (中国标准时间)
3
- */const o=require("vue"),O=o.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!1}},setup(t){const e=t;return(n,a)=>{const r=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(r,{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"])}}});const P=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"})),C=o.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(t){const e=t;return(n,a)=>{const r=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(r,{transition:!1,multi:!1,name:e.routerViewName},{default:o.withCtx(({Component:p})=>[o.createVNode(o.Transition,{name:"fox-default-navigator__trans"},{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(p)))]),_:2},1024)]),_:1},8,["name"])}}});const I=Object.freeze(Object.defineProperty({__proto__:null,default:C},Symbol.toStringTag,{value:"Module"})),D=10;function S(t,e){return t>e&&t>D?"horizontal":e>t&&e>D?"vertical":""}function b(){const t=o.ref(0),e=o.ref(0),n=o.ref(0),a=o.ref(0),r=o.ref(0),p=o.ref(0),m=o.ref(0),_=o.ref(0),f=o.ref(0),l=o.ref(0),i=o.ref(""),s=()=>i.value==="vertical",h=()=>i.value==="horizontal",d=()=>{m.value=0,_.value=0,f.value=0,l.value=0,i.value="",n.value=0};return{move:c=>{const g=c.touches[0];m.value=g.clientX-t.value,_.value=g.clientY-e.value,r.value=g.clientX,p.value=g.clientY,f.value=Math.abs(m.value),l.value=Math.abs(_.value),a.value=Date.now()-n.value,i.value||(i.value=S(f.value,l.value))},start:c=>{d(),t.value=c.touches[0].clientX,e.value=c.touches[0].clientY,n.value=Date.now()},reset:d,startX:t,startY:e,startTime:n,duration:a,moveX:r,moveY:p,deltaX:m,deltaY:_,offsetX:f,offsetY:l,direction:i,isVertical:s,isHorizontal:h}}function B(t){return t===window}const W=t=>{const e=o.unref(t);if(B(e)){const n=e.innerWidth,a=e.innerHeight;return{top:0,left:0,right:n,bottom:a,width:n,height:a}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},V=15,z=300,N=200;function k(t){t.stopPropagation()}function j(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&k(t)}function X(t,e){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function y(t,e=0,n,a=N){n==="end"?t.style.transition=`transform ${a}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 T=new WeakMap;function A(t,e,n,a=1e3){const r={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},p=t.previousSibling,m=b(),_=(h,d,v,u)=>{let c=d+r.startDistance;if(v==="end"){const g=W(h);let x=g.width/3;c<x?c=0:c=g.width,u&&u>0&&(r.transitionEndTrigger=()=>{r.moving=!1,n&&h.classList.remove(n)}),y(h,c,"end",u),p&&y(p,0,"",0),c>0&&typeof e=="function"&&e()}else c<0&&(c=0),y(h,c,"",0)},f=()=>{t.style.transform="",t.style.transition="",p&&(p.style.transform="",p.style.transition=""),r.transitionEndTrigger&&(r.transitionEndTrigger(),r.transitionEndTrigger=null)},l=h=>{if(m.start(h),r.moving){const d=t,{transform:v}=window.getComputedStyle(d);r.scrollDistance=+v.slice(7,v.length-1).split(", ")[5]}n&&t.classList.add(n),r.startDistance=r.scrollDistance,r.transitionEndTrigger=null,r.moving=!0},i=h=>{r.moving=!0,m.move(h),m.isHorizontal()&&j(h,!0),_(t,m.deltaX.value,"",0)},s=()=>{const h=m.deltaX.value;if(h==0){n&&t.classList.remove(n);return}const d=m.duration.value;if(d<z&&Math.abs(h)>V){const u=X(h,d);_(t,u,"end",a)}else _(t,h,"end",a)};t.addEventListener("transitionend",f),t.addEventListener("touchstart",l),t.addEventListener("touchmove",i),t.addEventListener("touchend",s),t.addEventListener("touchcancel",s),T.set(t,{state:r,transitionend:f,touchstart:l,touchmove:i,touchend:s,touchcancel:s})}function U(t){const e=T.get(t);e&&(T.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 R=o.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:null,routerViewName:null,viewTag:{default:"div"},transition:{type:[Object,Boolean],default:!0},viewClass:{default:"fox-root-navigator__item"}},setup(t){const e=t;function n(l){return(l.params&&l.params.animationType)??"slide"}const a=(l,i,s,h)=>{if(s.opsType===3||i){const d=n(s);if(d==="pop"&&i)return;const v=i?"show":"enter",u=`fox-root-navigator__${d}-${v}-from`,c=`fox-root-navigator__${d}-${v}-active`;l.classList.add(u),l.classList.add(c)}},r=(l,i,s,h)=>{if(s.opsType===3||i){const d=n(s);if(d==="pop"&&i)return;const v=i?"show":"enter",u=`fox-root-navigator__${d}-${v}-from`,c=`fox-root-navigator__${d}-${v}-to`;l.classList.remove(u),l.classList.add(c)}},p=(l,i,s,h)=>{if(s.opsType===3||i){const d=n(s);if(d!=="pop"||!i){const v=i?"show":"enter",u=`fox-root-navigator__${d}-${v}-active`,c=`fox-root-navigator__${d}-${v}-to`;l.classList.remove(u),l.classList.remove(c)}}e.dragRemove&&!i&&s.opsType===3&&A(l,e.removeViewPage,"fox-root-navigator__item-moving",1e3)},m=(l,i,s,h)=>{if(s.opsType===3||i){const d=n(s);if(d==="pop"&&i)return;const v=i?"hide":"leave",u=`fox-root-navigator__${d}-${v}-from`,c=`fox-root-navigator__${d}-${v}-active`;l.classList.add(u),l.classList.add(c)}},_=(l,i,s,h)=>{if(s.opsType===3||i){const d=n(s);if(d==="pop"&&i)return;const v=i?"hide":"leave",u=`fox-root-navigator__${d}-${v}-from`,c=`fox-root-navigator__${d}-${v}-to`;l.classList.remove(u),l.classList.add(c)}},f=(l,i,s,h)=>{if(s.opsType===3||i){const d=n(s);if(d!=="pop"||!i){const v=i?"hide":"leave",u=`fox-root-navigator__${d}-${v}-active`,c=`fox-root-navigator__${d}-${v}-to`;l.classList.remove(u),l.classList.remove(c)}}e.dragRemove&&!i&&U(l)};return(l,i)=>{const s=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(s,{class:"fox-root-navigator","view-class":t.viewClass,"before-enter":a,enter:r,"after-enter":p,"before-leave":m,leave:_,"after-leave":f,multi:!0,name:e.routerViewName,"view-tag":e.viewTag,transition:e.transition},null,8,["view-class","name","view-tag","transition"])}}});const Y=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"})),q={class:"fox-swiper-navigator"},H=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(a,r)=>(o.openBlock(),o.createElementBlock("div",q,[o.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:o.normalizeStyle(o.unref(n))},[o.renderSlot(a.$slots,"default")],4)]))}});let F=0;function G(){return++F}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){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function $(t,e=0,n,a=Q){n==="end"?t.style.transition=`transform ${a}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;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,a,r){this.getStartDistance=e,this.openPage=n,this.isPageOpened=a,this.pageOpened=r}open(){const e=this.el,n=b(),a=(r,p,m,_)=>{let f=p+this.startDistance;const l=this.columnWidth/3;if(m==="end"){if(f==0){this.moving=!1;return}Math.abs(p)>l&&(p>0?f=this.startDistance+this.columnWidth:f=this.startDistance-this.columnWidth);let i=-f;i<0?i=0:i>this.width-this.columnWidth&&(i=this.width-this.columnWidth);const s=Math.floor(i/this.columnWidth);this.isPageOpened(s)||this.openPage(s),f=-s*this.columnWidth,_&&_>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(s)}),$(r,f,"end",_),this.scrollDistance=f}else{if(Math.abs(p)>l){let s=0;if(p>0?s=Math.abs(this.startDistance+this.columnWidth):s=Math.abs(this.startDistance-this.columnWidth),s>=0&&s<this.width){const h=Math.floor(s/this.columnWidth);this.isPageOpened(h)||this.openPage(h)}}let i=-f;i<this.min?i=this.min:i>this.max&&(i=this.max),$(r,-i,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=r=>{this.moving||(n.start(r),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=r=>{n.move(r),n.isHorizontal()&&tt(r,!0),a(e,n.deltaX.value,"",0)},this.touchend=()=>{const r=n.deltaX.value;if(r==0)return;const p=n.duration.value;if(p<K&&Math.abs(r)>J){const _=et(r,p);a(e,_,"end",this.swipeDuration)}else a(e,r,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function ot(t,e,n,a){return new nt(t,e,n,a)}const it=o.defineComponent({__name:"index",props:{activePath:null,routes:null,height:null,width:null,drag:{type:Boolean,default:!0},openViewPage:null,routerViewName:null,transition:{type:[Object,Boolean],default:!0},swipeDuration:{default:360},scrollTime:{default:0}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,a=o.reactive({scrollDistance:0,index:-1,openedIndexList:[]}),f=ot(()=>a.scrollDistance,u=>{if(a.openedIndexList.indexOf(u)===-1){a.openedIndexList.push(u);const c=n.routes[u];try{n.openViewPage(c,u)}catch(g){console.error(g)}}},u=>a.openedIndexList.indexOf(u)!==-1,u=>{a.index=u,a.scrollDistance=-a.index*n.width;const c=n.routes[u];e("update:activePath",c.path)});o.onMounted(()=>{const u=h();f.el=u,f.open()}),o.onUnmounted(()=>{f.close()}),o.watchEffect(()=>{const u=n.activePath;a.index=n.routes.findIndex(M=>M.path===u);const c=n.width;a.index!==-1&&(a.openedIndexList.push(a.index),a.scrollDistance=-c*a.index);const g=c*n.routes.length,x=-c/3,w=c*(n.routes.length-1)+c/3;f.columnWidth=c,f.width=g,f.min=x,f.max=w,f.swipeDuration=n.swipeDuration});const l=`fox-swiper-navigator-${G()}`,i=o.computed(()=>({width:`${n.width}px`,height:`${n.height}px`}));let s=null;function h(){return s||(s=document.querySelector(`.${l}>.fox-swiper-navigator__inner`),s)}const d=o.computed(()=>`${n.width*n.routes.length}px`),v=(u,c)=>({style:{left:`${n.routes.findIndex(x=>{const w=u.path??u.name??"";return x.path==w})*n.width}px`,width:`${n.width}px`}});return(u,c)=>{const g=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(g,{class:o.normalizeClass(l),style:o.normalizeStyle(o.unref(i)),"view-class":"fox-swiper-navigator__item",tag:H,"view-tag-props":v,multi:!0,name:n.routerViewName,transition:n.transition,"scroll-distance":a.scrollDistance,"scroll-time":n.scrollTime,width:o.unref(d)},null,8,["style","name","transition","scroll-distance","scroll-time","width"])}}});const st=Object.freeze(Object.defineProperty({__proto__:null,default:it},Symbol.toStringTag,{value:"Module"}));let at="fox-";const rt=[],E=Object.assign({"/src/components/card-navigator/index.vue":P,"/src/components/default-navigator/index.vue":I,"/src/components/root-navigator/index.vue":Y,"/src/components/swiper-navigator/index.vue":st}),L=[];for(const t in E){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];rt.indexOf(e)===-1&&L.push({name:e,component:E[t].default})}const ct={install(t){L.forEach(e=>{t.component(`${at}${e.name}`,e.component)})}};module.exports=ct;
2
+ * @fox-js/navigation v4.0.1-4 Mon Jan 30 2023 14:43:23 GMT+0800 (中国标准时间)
3
+ */const o=require("vue"),O=o.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!1}},setup(t){const e=t;return(n,s)=>{const f=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(f,{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"])}}});const P=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"})),C=o.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(t){const e=t;return(n,s)=>{const f=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(f,{transition:!1,multi:!1,name:e.routerViewName},{default:o.withCtx(({Component:d})=>[o.createVNode(o.Transition,{name:"fox-default-navigator__trans"},{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(d)))]),_:2},1024)]),_:1},8,["name"])}}});const I=Object.freeze(Object.defineProperty({__proto__:null,default:C},Symbol.toStringTag,{value:"Module"})),$=10;function S(t,e){return t>e&&t>$?"horizontal":e>t&&e>$?"vertical":""}function L(){const t=o.ref(0),e=o.ref(0),n=o.ref(0),s=o.ref(0),f=o.ref(0),d=o.ref(0),m=o.ref(0),_=o.ref(0),h=o.ref(0),c=o.ref(0),i=o.ref(""),r=()=>i.value==="vertical",g=()=>i.value==="horizontal",a=()=>{m.value=0,_.value=0,h.value=0,c.value=0,i.value="",n.value=0};return{move:u=>{const p=u.touches[0];m.value=p.clientX-t.value,_.value=p.clientY-e.value,f.value=p.clientX,d.value=p.clientY,h.value=Math.abs(m.value),c.value=Math.abs(_.value),s.value=Date.now()-n.value,i.value||(i.value=S(h.value,c.value))},start:u=>{a(),t.value=u.touches[0].clientX,e.value=u.touches[0].clientY,n.value=Date.now()},reset:a,startX:t,startY:e,startTime:n,duration:s,moveX:f,moveY:d,deltaX:m,deltaY:_,offsetX:h,offsetY:c,direction:i,isVertical:r,isHorizontal:g}}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,z=300,N=200;function k(t){t.stopPropagation()}function j(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&k(t)}function X(t,e){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function T(t,e=0,n,s=N){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 D=new WeakMap;function A(t,e,n=500,s,f=1e3){const d={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},m=t.previousSibling,_=L(),h=(a,v,l,u)=>{let p=v+d.startDistance;if(l==="end"){const x=V(a);let w=x.width/3;p<w?p=0:p=x.width;let y=!1;u&&u>0&&(y=!0,d.transitionEndTrigger=()=>{d.moving=!1,s&&a.classList.remove(s),p>0&&typeof e=="function"&&e()}),T(a,p,"end",u),m&&T(m,0,"",0),!y&&p>0&&typeof e=="function"&&e()}else p<0&&(p=0),T(a,p,"",0)},c=()=>{t.style.transform="",t.style.transition="",d.transitionEndTrigger?(d.transitionEndTrigger(),d.transitionEndTrigger=null,m&&setTimeout(()=>{m&&(m.style.transform="",m.style.transition="")},n)):m&&(m.style.transform="",m.style.transition="")},i=a=>{if(_.start(a),d.moving){const v=t,{transform:l}=window.getComputedStyle(v);d.scrollDistance=+l.slice(7,l.length-1).split(", ")[5]}s&&t.classList.add(s),d.startDistance=d.scrollDistance,d.transitionEndTrigger=null,d.moving=!0},r=a=>{d.moving=!0,_.move(a),_.isHorizontal()&&j(a,!0),h(t,_.deltaX.value,"",0)},g=()=>{const a=_.deltaX.value;if(a==0){s&&t.classList.remove(s);return}const v=_.duration.value;if(v<z&&Math.abs(a)>W){const u=X(a,v);h(t,u,"end",f)}else h(t,a,"end",f)};t.addEventListener("transitionend",c),t.addEventListener("touchstart",i),t.addEventListener("touchmove",r),t.addEventListener("touchend",g),t.addEventListener("touchcancel",g),D.set(t,{state:d,transitionend:c,touchstart:i,touchmove:r,touchend:g,touchcancel:g})}function U(t){const e=D.get(t);e&&(D.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 R=o.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:null,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(c){return(c.params&&c.params.animationType)??"slide"}const s=(c,i,r,g)=>{if(r.opsType===3||i){const a=n(r);if(a==="pop"&&i)return;const v=i?"show":"enter",l=`fox-root-navigator__${a}-${v}-from`,u=`fox-root-navigator__${a}-${v}-active`;c.classList.add(l),c.classList.add(u)}},f=(c,i,r,g)=>{if(r.opsType===3||i){const a=n(r);if(a==="pop"&&i)return;const v=i?"show":"enter",l=`fox-root-navigator__${a}-${v}-from`,u=`fox-root-navigator__${a}-${v}-to`;c.classList.remove(l),c.classList.add(u)}},d=(c,i,r,g)=>{if(r.opsType===3||i){const a=n(r);if(a!=="pop"||!i){const v=i?"show":"enter",l=`fox-root-navigator__${a}-${v}-active`,u=`fox-root-navigator__${a}-${v}-to`;c.classList.remove(l),c.classList.remove(u)}}e.dragRemove&&!i&&r.opsType===3&&A(c,e.removeViewPage,e.removeViewPageDuration,"fox-root-navigator__item-moving",1e3)},m=(c,i,r,g)=>{if(r.opsType===3||i){const a=n(r);if(a==="pop"&&i)return;const v=i?"hide":"leave",l=`fox-root-navigator__${a}-${v}-from`,u=`fox-root-navigator__${a}-${v}-active`;c.classList.add(l),c.classList.add(u)}},_=(c,i,r,g)=>{if(r.opsType===3||i){const a=n(r);if(a==="pop"&&i)return;const v=i?"hide":"leave",l=`fox-root-navigator__${a}-${v}-from`,u=`fox-root-navigator__${a}-${v}-to`;c.classList.remove(l),c.classList.add(u)}},h=(c,i,r,g)=>{if(r.opsType===3||i){const a=n(r);if(a!=="pop"||!i){const v=i?"hide":"leave",l=`fox-root-navigator__${a}-${v}-active`,u=`fox-root-navigator__${a}-${v}-to`;c.classList.remove(l),c.classList.remove(u)}}e.dragRemove&&!i&&U(c)};return(c,i)=>{const r=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(r,{class:"fox-root-navigator","view-class":t.viewClass,"before-enter":s,enter:f,"after-enter":d,"before-leave":m,leave:_,"after-leave":h,multi:!0,name:e.routerViewName,"view-tag":e.viewTag,transition:e.transition},null,8,["view-class","name","view-tag","transition"])}}});const Y=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"})),q={class:"fox-swiper-navigator"},H=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,f)=>(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 F=0;function G(){return++F}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){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function E(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;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,s,f){this.getStartDistance=e,this.openPage=n,this.isPageOpened=s,this.pageOpened=f}open(){const e=this.el,n=L(),s=(f,d,m,_)=>{let h=d+this.startDistance;const c=this.columnWidth/3;if(m==="end"){if(h==0){this.moving=!1;return}Math.abs(d)>c&&(d>0?h=this.startDistance+this.columnWidth:h=this.startDistance-this.columnWidth);let i=-h;i<0?i=0:i>this.width-this.columnWidth&&(i=this.width-this.columnWidth);const r=Math.floor(i/this.columnWidth);this.isPageOpened(r)||this.openPage(r),h=-r*this.columnWidth,_&&_>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(r)}),E(f,h,"end",_),this.scrollDistance=h}else{if(Math.abs(d)>c){let r=0;if(d>0?r=Math.abs(this.startDistance+this.columnWidth):r=Math.abs(this.startDistance-this.columnWidth),r>=0&&r<this.width){const g=Math.floor(r/this.columnWidth);this.isPageOpened(g)||this.openPage(g)}}let i=-h;i<this.min?i=this.min:i>this.max&&(i=this.max),E(f,-i,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=f=>{this.moving||(n.start(f),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=f=>{n.move(f),n.isHorizontal()&&tt(f,!0),s(e,n.deltaX.value,"",0)},this.touchend=()=>{const f=n.deltaX.value;if(f==0)return;const d=n.duration.value;if(d<K&&Math.abs(f)>J){const _=et(f,d);s(e,_,"end",this.swipeDuration)}else s(e,f,"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){return new nt(t,e,n,s)}const it=o.defineComponent({__name:"index",props:{activePath:null,routes:null,height:null,width:null,drag:{type:Boolean,default:!0},openViewPage:null,routerViewName:null,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:[]}),h=ot(()=>s.scrollDistance,l=>{if(s.openedIndexList.indexOf(l)===-1){s.openedIndexList.push(l);const u=n.routes[l];try{n.openViewPage(u,l)}catch(p){console.error(p)}}},l=>s.openedIndexList.indexOf(l)!==-1,l=>{s.index=l,s.scrollDistance=-s.index*n.width;const u=n.routes[l];e("update:activePath",u.path)});o.onMounted(()=>{const l=g();h.el=l,h.open()}),o.onUnmounted(()=>{h.close()}),o.watchEffect(()=>{const l=n.activePath;s.index=n.routes.findIndex(y=>y.path===l);const u=n.width;s.index!==-1&&(s.openedIndexList.push(s.index),s.scrollDistance=-u*s.index);const p=u*n.routes.length,x=-u/3,w=u*(n.routes.length-1)+u/3;h.columnWidth=u,h.width=p,h.min=x,h.max=w,h.swipeDuration=n.swipeDuration});const c=`fox-swiper-navigator-${G()}`,i=o.computed(()=>({width:`${n.width}px`,height:`${n.height}px`}));let r=null;function g(){return r||(r=document.querySelector(`.${c}>.fox-swiper-navigator__inner`),r)}const a=o.computed(()=>`${n.width*n.routes.length}px`),v=(l,u)=>({style:{left:`${n.routes.findIndex(x=>{const w=l.path??l.name??"";return x.path==w})*n.width}px`,width:`${n.width}px`}});return(l,u)=>{const p=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(p,{class:o.normalizeClass(c),style:o.normalizeStyle(o.unref(i)),"view-class":"fox-swiper-navigator__item",tag:H,"view-tag-props":v,multi:!0,name:n.routerViewName,transition:n.transition,"scroll-distance":s.scrollDistance,"scroll-time":n.scrollTime,width:o.unref(a)},null,8,["style","name","transition","scroll-distance","scroll-time","width"])}}});const st=Object.freeze(Object.defineProperty({__proto__:null,default:it},Symbol.toStringTag,{value:"Module"}));let at="fox-";const rt=[],b=Object.assign({"/src/components/card-navigator/index.vue":P,"/src/components/default-navigator/index.vue":I,"/src/components/root-navigator/index.vue":Y,"/src/components/swiper-navigator/index.vue":st}),M=[];for(const t in b){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];rt.indexOf(e)===-1&&M.push({name:e,component:b[t].default})}const ct={install(t){M.forEach(e=>{t.component(`${at}${e.name}`,e.component)})}};module.exports=ct;
package/dist/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
- import { defineComponent as y, resolveComponent as $, openBlock as x, createBlock as T, withCtx as O, createVNode as z, Transition as j, resolveDynamicComponent as B, ref as g, unref as D, computed as L, createElementBlock as X, createElementVNode as A, normalizeStyle as C, renderSlot as U, reactive as R, onMounted as Y, onUnmounted as k, watchEffect as H, normalizeClass as q } from "vue";
1
+ import { defineComponent as D, resolveComponent as b, openBlock as w, createBlock as T, withCtx as P, createVNode as z, Transition as j, resolveDynamicComponent as B, ref as g, unref as E, computed as M, createElementBlock as X, createElementVNode as A, normalizeStyle as V, renderSlot as U, reactive as R, onMounted as Y, onUnmounted as k, watchEffect as H, normalizeClass as q } from "vue";
2
2
  /*!
3
- * @fox-js/navigation v4.0.1-1 Wed Nov 02 2022 21:56:39 GMT+0800 (中国标准时间)
3
+ * @fox-js/navigation v4.0.1-4 Mon Jan 30 2023 14:43:23 GMT+0800 (中国标准时间)
4
4
  */
5
- const F = /* @__PURE__ */ y({
5
+ const F = /* @__PURE__ */ D({
6
6
  __name: "index",
7
7
  props: {
8
8
  routerViewName: null,
@@ -10,9 +10,9 @@ const F = /* @__PURE__ */ y({
10
10
  },
11
11
  setup(t) {
12
12
  const e = t;
13
- return (n, s) => {
14
- const a = $("fox-router-view");
15
- return x(), T(a, {
13
+ return (n, i) => {
14
+ const d = b("fox-router-view");
15
+ return w(), T(d, {
16
16
  class: "fox-card-navigator",
17
17
  "view-class": "fox-card-navigator__item",
18
18
  "view-active-class": "fox-card-navigator__item-active",
@@ -28,7 +28,7 @@ const F = /* @__PURE__ */ y({
28
28
  const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29
29
  __proto__: null,
30
30
  default: F
31
- }, Symbol.toStringTag, { value: "Module" })), J = /* @__PURE__ */ y({
31
+ }, Symbol.toStringTag, { value: "Module" })), J = /* @__PURE__ */ D({
32
32
  __name: "index",
33
33
  props: {
34
34
  routerViewName: null,
@@ -36,17 +36,17 @@ const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
36
36
  },
37
37
  setup(t) {
38
38
  const e = t;
39
- return (n, s) => {
40
- const a = $("fox-router-view");
41
- return x(), T(a, {
39
+ return (n, i) => {
40
+ const d = b("fox-router-view");
41
+ return w(), T(d, {
42
42
  transition: !1,
43
43
  multi: !1,
44
44
  name: e.routerViewName
45
45
  }, {
46
- default: O(({ Component: v }) => [
46
+ default: P(({ Component: u }) => [
47
47
  z(j, { name: "fox-default-navigator__trans" }, {
48
- default: O(() => [
49
- (x(), T(B(v)))
48
+ default: P(() => [
49
+ (w(), T(B(u)))
50
50
  ]),
51
51
  _: 2
52
52
  }, 1024)
@@ -59,52 +59,52 @@ const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
59
59
  const K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
60
60
  __proto__: null,
61
61
  default: J
62
- }, Symbol.toStringTag, { value: "Module" })), P = 10;
62
+ }, Symbol.toStringTag, { value: "Module" })), I = 10;
63
63
  function Q(t, e) {
64
- return t > e && t > P ? "horizontal" : e > t && e > P ? "vertical" : "";
64
+ return t > e && t > I ? "horizontal" : e > t && e > I ? "vertical" : "";
65
65
  }
66
66
  function W() {
67
- const t = g(0), e = g(0), n = g(0), s = g(0), a = g(0), v = g(0), m = g(0), p = g(0), d = g(0), c = g(0), o = g(""), i = () => o.value === "vertical", f = () => o.value === "horizontal", u = () => {
68
- m.value = 0, p.value = 0, d.value = 0, c.value = 0, o.value = "", n.value = 0;
67
+ const t = g(0), e = g(0), n = g(0), i = g(0), d = g(0), u = g(0), m = g(0), p = g(0), f = g(0), r = g(0), o = g(""), a = () => o.value === "vertical", _ = () => o.value === "horizontal", s = () => {
68
+ m.value = 0, p.value = 0, f.value = 0, r.value = 0, o.value = "", n.value = 0;
69
69
  };
70
70
  return {
71
- move: (r) => {
72
- const _ = r.touches[0];
73
- m.value = _.clientX - t.value, p.value = _.clientY - e.value, a.value = _.clientX, v.value = _.clientY, d.value = Math.abs(m.value), c.value = Math.abs(p.value), s.value = Date.now() - n.value, o.value || (o.value = Q(d.value, c.value));
71
+ move: (l) => {
72
+ const v = l.touches[0];
73
+ m.value = v.clientX - t.value, p.value = v.clientY - e.value, d.value = v.clientX, u.value = v.clientY, f.value = Math.abs(m.value), r.value = Math.abs(p.value), i.value = Date.now() - n.value, o.value || (o.value = Q(f.value, r.value));
74
74
  },
75
- start: (r) => {
76
- u(), t.value = r.touches[0].clientX, e.value = r.touches[0].clientY, n.value = Date.now();
75
+ start: (l) => {
76
+ s(), t.value = l.touches[0].clientX, e.value = l.touches[0].clientY, n.value = Date.now();
77
77
  },
78
- reset: u,
78
+ reset: s,
79
79
  startX: t,
80
80
  startY: e,
81
81
  startTime: n,
82
- duration: s,
83
- moveX: a,
84
- moveY: v,
82
+ duration: i,
83
+ moveX: d,
84
+ moveY: u,
85
85
  deltaX: m,
86
86
  deltaY: p,
87
- offsetX: d,
88
- offsetY: c,
87
+ offsetX: f,
88
+ offsetY: r,
89
89
  direction: o,
90
- isVertical: i,
91
- isHorizontal: f
90
+ isVertical: a,
91
+ isHorizontal: _
92
92
  };
93
93
  }
94
94
  function Z(t) {
95
95
  return t === window;
96
96
  }
97
97
  const tt = (t) => {
98
- const e = D(t);
98
+ const e = E(t);
99
99
  if (Z(e)) {
100
- const n = e.innerWidth, s = e.innerHeight;
100
+ const n = e.innerWidth, i = e.innerHeight;
101
101
  return {
102
102
  top: 0,
103
103
  left: 0,
104
104
  right: n,
105
- bottom: s,
105
+ bottom: i,
106
106
  width: n,
107
- height: s
107
+ height: i
108
108
  };
109
109
  }
110
110
  return e && e.getBoundingClientRect ? e.getBoundingClientRect() : {
@@ -125,69 +125,74 @@ function st(t, e) {
125
125
  function at(t, e) {
126
126
  return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t;
127
127
  }
128
- function b(t, e = 0, n, s = ot) {
129
- 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)`;
128
+ function L(t, e = 0, n, i = ot) {
129
+ 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)`;
130
130
  }
131
- const M = /* @__PURE__ */ new WeakMap();
132
- function rt(t, e, n, s = 1e3) {
133
- const a = {
131
+ const O = /* @__PURE__ */ new WeakMap();
132
+ function rt(t, e, n = 500, i, d = 1e3) {
133
+ const u = {
134
134
  active: !0,
135
135
  startDistance: 0,
136
136
  scrollDistance: 0,
137
137
  scrollTime: 0,
138
138
  moving: !1,
139
139
  transitionEndTrigger: null
140
- }, v = t.previousSibling, m = W(), p = (f, u, h, l) => {
141
- let r = u + a.startDistance;
142
- if (h === "end") {
143
- const _ = tt(f);
144
- let w = _.width / 3;
145
- r < w ? r = 0 : r = _.width, l && l > 0 && (a.transitionEndTrigger = () => {
146
- a.moving = !1, n && f.classList.remove(n);
147
- }), b(f, r, "end", l), v && b(v, 0, "", 0), r > 0 && typeof e == "function" && e();
140
+ }, m = t.previousSibling, p = W(), f = (s, h, c, l) => {
141
+ let v = h + u.startDistance;
142
+ if (c === "end") {
143
+ const x = tt(s);
144
+ let y = x.width / 3;
145
+ v < y ? v = 0 : v = x.width;
146
+ let $ = !1;
147
+ l && l > 0 && ($ = !0, u.transitionEndTrigger = () => {
148
+ u.moving = !1, i && s.classList.remove(i), v > 0 && typeof e == "function" && e();
149
+ }), L(s, v, "end", l), m && L(m, 0, "", 0), !$ && v > 0 && typeof e == "function" && e();
148
150
  } else
149
- r < 0 && (r = 0), b(f, r, "", 0);
150
- }, d = () => {
151
- t.style.transform = "", t.style.transition = "", v && (v.style.transform = "", v.style.transition = ""), a.transitionEndTrigger && (a.transitionEndTrigger(), a.transitionEndTrigger = null);
152
- }, c = (f) => {
153
- if (m.start(f), a.moving) {
154
- const u = t, { transform: h } = window.getComputedStyle(u);
155
- a.scrollDistance = +h.slice(7, h.length - 1).split(", ")[5];
151
+ v < 0 && (v = 0), L(s, v, "", 0);
152
+ }, r = () => {
153
+ t.style.transform = "", t.style.transition = "", u.transitionEndTrigger ? (u.transitionEndTrigger(), u.transitionEndTrigger = null, m && setTimeout(() => {
154
+ m && (m.style.transform = "", m.style.transition = "");
155
+ }, n)) : m && (m.style.transform = "", m.style.transition = "");
156
+ }, o = (s) => {
157
+ if (p.start(s), u.moving) {
158
+ const h = t, { transform: c } = window.getComputedStyle(h);
159
+ u.scrollDistance = +c.slice(7, c.length - 1).split(", ")[5];
156
160
  }
157
- n && t.classList.add(n), a.startDistance = a.scrollDistance, a.transitionEndTrigger = null, a.moving = !0;
158
- }, o = (f) => {
159
- a.moving = !0, m.move(f), m.isHorizontal() && st(f, !0), p(t, m.deltaX.value, "", 0);
160
- }, i = () => {
161
- const f = m.deltaX.value;
162
- if (f == 0) {
163
- n && t.classList.remove(n);
161
+ i && t.classList.add(i), u.startDistance = u.scrollDistance, u.transitionEndTrigger = null, u.moving = !0;
162
+ }, a = (s) => {
163
+ u.moving = !0, p.move(s), p.isHorizontal() && st(s, !0), f(t, p.deltaX.value, "", 0);
164
+ }, _ = () => {
165
+ const s = p.deltaX.value;
166
+ if (s == 0) {
167
+ i && t.classList.remove(i);
164
168
  return;
165
169
  }
166
- const u = m.duration.value;
167
- if (u < nt && Math.abs(f) > et) {
168
- const l = at(f, u);
169
- p(t, l, "end", s);
170
+ const h = p.duration.value;
171
+ if (h < nt && Math.abs(s) > et) {
172
+ const l = at(s, h);
173
+ f(t, l, "end", d);
170
174
  } else
171
- p(t, f, "end", s);
175
+ f(t, s, "end", d);
172
176
  };
173
- t.addEventListener("transitionend", d), t.addEventListener("touchstart", c), t.addEventListener("touchmove", o), t.addEventListener("touchend", i), t.addEventListener("touchcancel", i), M.set(t, {
174
- state: a,
175
- transitionend: d,
176
- touchstart: c,
177
- touchmove: o,
178
- touchend: i,
179
- touchcancel: i
177
+ t.addEventListener("transitionend", r), t.addEventListener("touchstart", o), t.addEventListener("touchmove", a), t.addEventListener("touchend", _), t.addEventListener("touchcancel", _), O.set(t, {
178
+ state: u,
179
+ transitionend: r,
180
+ touchstart: o,
181
+ touchmove: a,
182
+ touchend: _,
183
+ touchcancel: _
180
184
  });
181
185
  }
182
186
  function ct(t) {
183
- const e = M.get(t);
184
- e && (M.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));
187
+ const e = O.get(t);
188
+ 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));
185
189
  }
186
- const lt = /* @__PURE__ */ y({
190
+ const lt = /* @__PURE__ */ D({
187
191
  __name: "index",
188
192
  props: {
189
193
  dragRemove: { type: Boolean, default: !0 },
190
194
  removeViewPage: null,
195
+ removeViewPageDuration: { default: 500 },
191
196
  routerViewName: null,
192
197
  viewTag: { default: "div" },
193
198
  transition: { type: [Object, Boolean], default: !0 },
@@ -195,71 +200,71 @@ const lt = /* @__PURE__ */ y({
195
200
  },
196
201
  setup(t) {
197
202
  const e = t;
198
- function n(c) {
199
- return (c.params && c.params.animationType) ?? "slide";
203
+ function n(r) {
204
+ return (r.params && r.params.animationType) ?? "slide";
200
205
  }
201
- const s = (c, o, i, f) => {
202
- if (i.opsType === 3 || o) {
203
- const u = n(i);
204
- if (u === "pop" && o)
206
+ const i = (r, o, a, _) => {
207
+ if (a.opsType === 3 || o) {
208
+ const s = n(a);
209
+ if (s === "pop" && o)
205
210
  return;
206
- const h = o ? "show" : "enter", l = `fox-root-navigator__${u}-${h}-from`, r = `fox-root-navigator__${u}-${h}-active`;
207
- c.classList.add(l), c.classList.add(r);
211
+ const h = o ? "show" : "enter", c = `fox-root-navigator__${s}-${h}-from`, l = `fox-root-navigator__${s}-${h}-active`;
212
+ r.classList.add(c), r.classList.add(l);
208
213
  }
209
- }, a = (c, o, i, f) => {
210
- if (i.opsType === 3 || o) {
211
- const u = n(i);
212
- if (u === "pop" && o)
214
+ }, d = (r, o, a, _) => {
215
+ if (a.opsType === 3 || o) {
216
+ const s = n(a);
217
+ if (s === "pop" && o)
213
218
  return;
214
- const h = o ? "show" : "enter", l = `fox-root-navigator__${u}-${h}-from`, r = `fox-root-navigator__${u}-${h}-to`;
215
- c.classList.remove(l), c.classList.add(r);
219
+ const h = o ? "show" : "enter", c = `fox-root-navigator__${s}-${h}-from`, l = `fox-root-navigator__${s}-${h}-to`;
220
+ r.classList.remove(c), r.classList.add(l);
216
221
  }
217
- }, v = (c, o, i, f) => {
218
- if (i.opsType === 3 || o) {
219
- const u = n(i);
220
- if (u !== "pop" || !o) {
221
- const h = o ? "show" : "enter", l = `fox-root-navigator__${u}-${h}-active`, r = `fox-root-navigator__${u}-${h}-to`;
222
- c.classList.remove(l), c.classList.remove(r);
222
+ }, u = (r, o, a, _) => {
223
+ if (a.opsType === 3 || o) {
224
+ const s = n(a);
225
+ if (s !== "pop" || !o) {
226
+ const h = o ? "show" : "enter", c = `fox-root-navigator__${s}-${h}-active`, l = `fox-root-navigator__${s}-${h}-to`;
227
+ r.classList.remove(c), r.classList.remove(l);
223
228
  }
224
229
  }
225
- e.dragRemove && !o && i.opsType === 3 && rt(c, e.removeViewPage, "fox-root-navigator__item-moving", 1e3);
226
- }, m = (c, o, i, f) => {
227
- if (i.opsType === 3 || o) {
228
- const u = n(i);
229
- if (u === "pop" && o)
230
+ e.dragRemove && !o && a.opsType === 3 && rt(r, e.removeViewPage, e.removeViewPageDuration, "fox-root-navigator__item-moving", 1e3);
231
+ }, m = (r, o, a, _) => {
232
+ if (a.opsType === 3 || o) {
233
+ const s = n(a);
234
+ if (s === "pop" && o)
230
235
  return;
231
- const h = o ? "hide" : "leave", l = `fox-root-navigator__${u}-${h}-from`, r = `fox-root-navigator__${u}-${h}-active`;
232
- c.classList.add(l), c.classList.add(r);
236
+ const h = o ? "hide" : "leave", c = `fox-root-navigator__${s}-${h}-from`, l = `fox-root-navigator__${s}-${h}-active`;
237
+ r.classList.add(c), r.classList.add(l);
233
238
  }
234
- }, p = (c, o, i, f) => {
235
- if (i.opsType === 3 || o) {
236
- const u = n(i);
237
- if (u === "pop" && o)
239
+ }, p = (r, o, a, _) => {
240
+ if (a.opsType === 3 || o) {
241
+ const s = n(a);
242
+ if (s === "pop" && o)
238
243
  return;
239
- const h = o ? "hide" : "leave", l = `fox-root-navigator__${u}-${h}-from`, r = `fox-root-navigator__${u}-${h}-to`;
240
- c.classList.remove(l), c.classList.add(r);
244
+ const h = o ? "hide" : "leave", c = `fox-root-navigator__${s}-${h}-from`, l = `fox-root-navigator__${s}-${h}-to`;
245
+ r.classList.remove(c), r.classList.add(l);
241
246
  }
242
- }, d = (c, o, i, f) => {
243
- if (i.opsType === 3 || o) {
244
- const u = n(i);
245
- if (u !== "pop" || !o) {
246
- const h = o ? "hide" : "leave", l = `fox-root-navigator__${u}-${h}-active`, r = `fox-root-navigator__${u}-${h}-to`;
247
- c.classList.remove(l), c.classList.remove(r);
247
+ }, f = (r, o, a, _) => {
248
+ if (a.opsType === 3 || o) {
249
+ const s = n(a);
250
+ if (s !== "pop" || !o) {
251
+ const h = o ? "hide" : "leave", c = `fox-root-navigator__${s}-${h}-active`, l = `fox-root-navigator__${s}-${h}-to`;
252
+ r.classList.remove(c), r.classList.remove(l);
248
253
  }
249
254
  }
250
- e.dragRemove && !o && ct(c);
255
+ e.dragRemove && !o && ct(r);
251
256
  };
252
- return (c, o) => {
253
- const i = $("fox-router-view");
254
- return x(), T(i, {
257
+ return (r, o) => {
258
+ const a = b("fox-router-view");
259
+ return w(), T(a, {
255
260
  class: "fox-root-navigator",
256
261
  "view-class": t.viewClass,
257
- "before-enter": s,
258
- enter: a,
259
- "after-enter": v,
262
+ "before-enter": i,
263
+ enter: d,
264
+ "after-enter": u,
260
265
  "before-leave": m,
261
266
  leave: p,
262
- "after-leave": d,
267
+ "after-leave": f,
263
268
  multi: !0,
264
269
  name: e.routerViewName,
265
270
  "view-tag": e.viewTag,
@@ -271,7 +276,7 @@ const lt = /* @__PURE__ */ y({
271
276
  const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
272
277
  __proto__: null,
273
278
  default: lt
274
- }, Symbol.toStringTag, { value: "Module" })), dt = { class: "fox-swiper-navigator" }, ft = /* @__PURE__ */ y({
279
+ }, Symbol.toStringTag, { value: "Module" })), dt = { class: "fox-swiper-navigator" }, ft = /* @__PURE__ */ D({
275
280
  __name: "swiper",
276
281
  props: {
277
282
  width: null,
@@ -279,16 +284,16 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
279
284
  scrollTime: null
280
285
  },
281
286
  setup(t) {
282
- const e = t, n = L(() => ({
287
+ const e = t, n = M(() => ({
283
288
  transform: `translate3d(${e.scrollDistance}px, 0, 0)`,
284
289
  width: `${e.width}`
285
290
  }));
286
- return (s, a) => (x(), X("div", dt, [
291
+ return (i, d) => (w(), X("div", dt, [
287
292
  A("div", {
288
293
  class: "fox-swiper-navigator__inner",
289
- style: C(D(n))
294
+ style: V(E(n))
290
295
  }, [
291
- U(s.$slots, "default")
296
+ U(i.$slots, "default")
292
297
  ], 4)
293
298
  ]));
294
299
  }
@@ -307,10 +312,10 @@ function xt(t, e) {
307
312
  function wt(t, e) {
308
313
  return t = Math.abs(t / e) / 3e-3 * (t < 0 ? -1 : 1), t;
309
314
  }
310
- function I(t, e = 0, n, s = _t) {
311
- 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)`;
315
+ function S(t, e = 0, n, i = _t) {
316
+ 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)`;
312
317
  }
313
- class Tt {
318
+ class yt {
314
319
  width = 0;
315
320
  columnWidth = 0;
316
321
  max = 0;
@@ -330,53 +335,53 @@ class Tt {
330
335
  touchmove = null;
331
336
  touchend = null;
332
337
  touchcancel = null;
333
- constructor(e, n, s, a) {
334
- this.getStartDistance = e, this.openPage = n, this.isPageOpened = s, this.pageOpened = a;
338
+ constructor(e, n, i, d) {
339
+ this.getStartDistance = e, this.openPage = n, this.isPageOpened = i, this.pageOpened = d;
335
340
  }
336
341
  open() {
337
- const e = this.el, n = W(), s = (a, v, m, p) => {
338
- let d = v + this.startDistance;
339
- const c = this.columnWidth / 3;
342
+ const e = this.el, n = W(), i = (d, u, m, p) => {
343
+ let f = u + this.startDistance;
344
+ const r = this.columnWidth / 3;
340
345
  if (m === "end") {
341
- if (d == 0) {
346
+ if (f == 0) {
342
347
  this.moving = !1;
343
348
  return;
344
349
  }
345
- Math.abs(v) > c && (v > 0 ? d = this.startDistance + this.columnWidth : d = this.startDistance - this.columnWidth);
346
- let o = -d;
350
+ Math.abs(u) > r && (u > 0 ? f = this.startDistance + this.columnWidth : f = this.startDistance - this.columnWidth);
351
+ let o = -f;
347
352
  o < 0 ? o = 0 : o > this.width - this.columnWidth && (o = this.width - this.columnWidth);
348
- const i = Math.floor(o / this.columnWidth);
349
- this.isPageOpened(i) || this.openPage(i), d = -i * this.columnWidth, p && p > 0 && (this.transitionEndTrigger = () => {
350
- this.moving = !1, this.pageOpened(i);
351
- }), I(a, d, "end", p), this.scrollDistance = d;
353
+ const a = Math.floor(o / this.columnWidth);
354
+ this.isPageOpened(a) || this.openPage(a), f = -a * this.columnWidth, p && p > 0 && (this.transitionEndTrigger = () => {
355
+ this.moving = !1, this.pageOpened(a);
356
+ }), S(d, f, "end", p), this.scrollDistance = f;
352
357
  } else {
353
- if (Math.abs(v) > c) {
354
- let i = 0;
355
- if (v > 0 ? i = Math.abs(this.startDistance + this.columnWidth) : i = Math.abs(this.startDistance - this.columnWidth), i >= 0 && i < this.width) {
356
- const f = Math.floor(i / this.columnWidth);
357
- this.isPageOpened(f) || this.openPage(f);
358
+ if (Math.abs(u) > r) {
359
+ let a = 0;
360
+ if (u > 0 ? a = Math.abs(this.startDistance + this.columnWidth) : a = Math.abs(this.startDistance - this.columnWidth), a >= 0 && a < this.width) {
361
+ const _ = Math.floor(a / this.columnWidth);
362
+ this.isPageOpened(_) || this.openPage(_);
358
363
  }
359
364
  }
360
- let o = -d;
361
- o < this.min ? o = this.min : o > this.max && (o = this.max), I(a, -o, "", 0);
365
+ let o = -f;
366
+ o < this.min ? o = this.min : o > this.max && (o = this.max), S(d, -o, "", 0);
362
367
  }
363
368
  };
364
369
  this.transitionend = () => {
365
370
  e.style.transition = "", this.transitionEndTrigger && (this.transitionEndTrigger(), this.transitionEndTrigger = null);
366
- }, this.touchstart = (a) => {
367
- this.moving || (n.start(a), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
368
- }, this.touchmove = (a) => {
369
- n.move(a), n.isHorizontal() && xt(a, !0), s(e, n.deltaX.value, "", 0);
371
+ }, this.touchstart = (d) => {
372
+ this.moving || (n.start(d), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
373
+ }, this.touchmove = (d) => {
374
+ n.move(d), n.isHorizontal() && xt(d, !0), i(e, n.deltaX.value, "", 0);
370
375
  }, this.touchend = () => {
371
- const a = n.deltaX.value;
372
- if (a == 0)
376
+ const d = n.deltaX.value;
377
+ if (d == 0)
373
378
  return;
374
- const v = n.duration.value;
375
- if (v < pt && Math.abs(a) > mt) {
376
- const p = wt(a, v);
377
- s(e, p, "end", this.swipeDuration);
379
+ const u = n.duration.value;
380
+ if (u < pt && Math.abs(d) > mt) {
381
+ const p = wt(d, u);
382
+ i(e, p, "end", this.swipeDuration);
378
383
  } else
379
- s(e, a, "end", this.swipeDuration);
384
+ i(e, d, "end", this.swipeDuration);
380
385
  }, 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);
381
386
  }
382
387
  close() {
@@ -384,10 +389,10 @@ class Tt {
384
389
  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;
385
390
  }
386
391
  }
387
- function yt(t, e, n, s) {
388
- return new Tt(t, e, n, s);
392
+ function Tt(t, e, n, i) {
393
+ return new yt(t, e, n, i);
389
394
  }
390
- const Dt = /* @__PURE__ */ y({
395
+ const Dt = /* @__PURE__ */ D({
391
396
  __name: "index",
392
397
  props: {
393
398
  activePath: null,
@@ -403,66 +408,66 @@ const Dt = /* @__PURE__ */ y({
403
408
  },
404
409
  emits: ["update:activePath"],
405
410
  setup(t, { emit: e }) {
406
- const n = t, s = R({
411
+ const n = t, i = R({
407
412
  scrollDistance: 0,
408
413
  index: -1,
409
414
  openedIndexList: []
410
- }), d = yt(() => s.scrollDistance, (l) => {
411
- if (s.openedIndexList.indexOf(l) === -1) {
412
- s.openedIndexList.push(l);
413
- const r = n.routes[l];
415
+ }), f = Tt(() => i.scrollDistance, (c) => {
416
+ if (i.openedIndexList.indexOf(c) === -1) {
417
+ i.openedIndexList.push(c);
418
+ const l = n.routes[c];
414
419
  try {
415
- n.openViewPage(r, l);
416
- } catch (_) {
417
- console.error(_);
420
+ n.openViewPage(l, c);
421
+ } catch (v) {
422
+ console.error(v);
418
423
  }
419
424
  }
420
- }, (l) => s.openedIndexList.indexOf(l) !== -1, (l) => {
421
- s.index = l, s.scrollDistance = -s.index * n.width;
422
- const r = n.routes[l];
423
- e("update:activePath", r.path);
425
+ }, (c) => i.openedIndexList.indexOf(c) !== -1, (c) => {
426
+ i.index = c, i.scrollDistance = -i.index * n.width;
427
+ const l = n.routes[c];
428
+ e("update:activePath", l.path);
424
429
  });
425
430
  Y(() => {
426
- const l = f();
427
- d.el = l, d.open();
431
+ const c = _();
432
+ f.el = c, f.open();
428
433
  }), k(() => {
429
- d.close();
434
+ f.close();
430
435
  }), H(() => {
431
- const l = n.activePath;
432
- s.index = n.routes.findIndex((N) => N.path === l);
433
- const r = n.width;
434
- s.index !== -1 && (s.openedIndexList.push(s.index), s.scrollDistance = -r * s.index);
435
- const _ = r * n.routes.length, w = -r / 3, E = r * (n.routes.length - 1) + r / 3;
436
- d.columnWidth = r, d.width = _, d.min = w, d.max = E, d.swipeDuration = n.swipeDuration;
436
+ const c = n.activePath;
437
+ i.index = n.routes.findIndex(($) => $.path === c);
438
+ const l = n.width;
439
+ i.index !== -1 && (i.openedIndexList.push(i.index), i.scrollDistance = -l * i.index);
440
+ const v = l * n.routes.length, x = -l / 3, y = l * (n.routes.length - 1) + l / 3;
441
+ f.columnWidth = l, f.width = v, f.min = x, f.max = y, f.swipeDuration = n.swipeDuration;
437
442
  });
438
- const c = `fox-swiper-navigator-${vt()}`, o = L(() => ({ width: `${n.width}px`, height: `${n.height}px` }));
439
- let i = null;
440
- function f() {
441
- return i || (i = document.querySelector(`.${c}>.fox-swiper-navigator__inner`), i);
443
+ const r = `fox-swiper-navigator-${vt()}`, o = M(() => ({ width: `${n.width}px`, height: `${n.height}px` }));
444
+ let a = null;
445
+ function _() {
446
+ return a || (a = document.querySelector(`.${r}>.fox-swiper-navigator__inner`), a);
442
447
  }
443
- const u = L(() => `${n.width * n.routes.length}px`), h = (l, r) => ({
448
+ const s = M(() => `${n.width * n.routes.length}px`), h = (c, l) => ({
444
449
  style: {
445
- left: `${n.routes.findIndex((w) => {
446
- const E = l.path ?? l.name ?? "";
447
- return w.path == E;
450
+ left: `${n.routes.findIndex((x) => {
451
+ const y = c.path ?? c.name ?? "";
452
+ return x.path == y;
448
453
  }) * n.width}px`,
449
454
  width: `${n.width}px`
450
455
  }
451
456
  });
452
- return (l, r) => {
453
- const _ = $("fox-router-view");
454
- return x(), T(_, {
455
- class: q(c),
456
- style: C(D(o)),
457
+ return (c, l) => {
458
+ const v = b("fox-router-view");
459
+ return w(), T(v, {
460
+ class: q(r),
461
+ style: V(E(o)),
457
462
  "view-class": "fox-swiper-navigator__item",
458
463
  tag: ft,
459
464
  "view-tag-props": h,
460
465
  multi: !0,
461
466
  name: n.routerViewName,
462
467
  transition: n.transition,
463
- "scroll-distance": s.scrollDistance,
468
+ "scroll-distance": i.scrollDistance,
464
469
  "scroll-time": n.scrollTime,
465
- width: D(u)
470
+ width: E(s)
466
471
  }, null, 8, ["style", "name", "transition", "scroll-distance", "scroll-time", "width"]);
467
472
  };
468
473
  }
@@ -472,17 +477,17 @@ const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
472
477
  default: Dt
473
478
  }, Symbol.toStringTag, { value: "Module" }));
474
479
  let Et = "fox-";
475
- const bt = [], S = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": G, "/src/components/default-navigator/index.vue": K, "/src/components/root-navigator/index.vue": ut, "/src/components/swiper-navigator/index.vue": $t }), V = [];
476
- for (const t in S) {
480
+ const bt = [], C = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": G, "/src/components/default-navigator/index.vue": K, "/src/components/root-navigator/index.vue": ut, "/src/components/swiper-navigator/index.vue": $t }), N = [];
481
+ for (const t in C) {
477
482
  let e = /src\/components\/(.*)\/index.vue/.exec(t)[1];
478
- bt.indexOf(e) === -1 && V.push({
483
+ bt.indexOf(e) === -1 && N.push({
479
484
  name: e,
480
- component: S[t].default
485
+ component: C[t].default
481
486
  });
482
487
  }
483
488
  const Mt = {
484
489
  install(t) {
485
- V.forEach((e) => {
490
+ N.forEach((e) => {
486
491
  t.component(`${Et}${e.name}`, e.component);
487
492
  });
488
493
  }
package/dist/index.umd.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(o,x){typeof exports=="object"&&typeof module<"u"?module.exports=x(require("vue")):typeof define=="function"&&define.amd?define(["vue"],x):(o=typeof globalThis<"u"?globalThis:o||self,o.navigation=x(o.Vue))})(this,function(o){"use strict";/*!
2
- * @fox-js/navigation v4.0.1-1 Wed Nov 02 2022 21:56:39 GMT+0800 (中国标准时间)
3
- */const x=o.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!1}},setup(t){const e=t;return(n,a)=>{const r=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(r,{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"])}}}),ct="",O=Object.freeze(Object.defineProperty({__proto__:null,default:x},Symbol.toStringTag,{value:"Module"})),P=o.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(t){const e=t;return(n,a)=>{const r=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(r,{transition:!1,multi:!1,name:e.routerViewName},{default:o.withCtx(({Component:m})=>[o.createVNode(o.Transition,{name:"fox-default-navigator__trans"},{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(m)))]),_:2},1024)]),_:1},8,["name"])}}}),lt="",C=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"})),$=10;function I(t,e){return t>e&&t>$?"horizontal":e>t&&e>$?"vertical":""}function E(){const t=o.ref(0),e=o.ref(0),n=o.ref(0),a=o.ref(0),r=o.ref(0),m=o.ref(0),_=o.ref(0),g=o.ref(0),f=o.ref(0),l=o.ref(0),i=o.ref(""),s=()=>i.value==="vertical",h=()=>i.value==="horizontal",u=()=>{_.value=0,g.value=0,f.value=0,l.value=0,i.value="",n.value=0};return{move:c=>{const v=c.touches[0];_.value=v.clientX-t.value,g.value=v.clientY-e.value,r.value=v.clientX,m.value=v.clientY,f.value=Math.abs(_.value),l.value=Math.abs(g.value),a.value=Date.now()-n.value,i.value||(i.value=I(f.value,l.value))},start:c=>{u(),t.value=c.touches[0].clientX,e.value=c.touches[0].clientY,n.value=Date.now()},reset:u,startX:t,startY:e,startTime:n,duration:a,moveX:r,moveY:m,deltaX:_,deltaY:g,offsetX:f,offsetY:l,direction:i,isVertical:s,isHorizontal:h}}function S(t){return t===window}const B=t=>{const e=o.unref(t);if(S(e)){const n=e.innerWidth,a=e.innerHeight;return{top:0,left:0,right:n,bottom:a,width:n,height:a}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},V=15,W=300,z=200;function N(t){t.stopPropagation()}function j(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&N(t)}function k(t,e){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function y(t,e=0,n,a=z){n==="end"?t.style.transition=`transform ${a}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 T=new WeakMap;function X(t,e,n,a=1e3){const r={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},m=t.previousSibling,_=E(),g=(h,u,p,d)=>{let c=u+r.startDistance;if(p==="end"){const v=B(h);let w=v.width/3;c<w?c=0:c=v.width,d&&d>0&&(r.transitionEndTrigger=()=>{r.moving=!1,n&&h.classList.remove(n)}),y(h,c,"end",d),m&&y(m,0,"",0),c>0&&typeof e=="function"&&e()}else c<0&&(c=0),y(h,c,"",0)},f=()=>{t.style.transform="",t.style.transition="",m&&(m.style.transform="",m.style.transition=""),r.transitionEndTrigger&&(r.transitionEndTrigger(),r.transitionEndTrigger=null)},l=h=>{if(_.start(h),r.moving){const u=t,{transform:p}=window.getComputedStyle(u);r.scrollDistance=+p.slice(7,p.length-1).split(", ")[5]}n&&t.classList.add(n),r.startDistance=r.scrollDistance,r.transitionEndTrigger=null,r.moving=!0},i=h=>{r.moving=!0,_.move(h),_.isHorizontal()&&j(h,!0),g(t,_.deltaX.value,"",0)},s=()=>{const h=_.deltaX.value;if(h==0){n&&t.classList.remove(n);return}const u=_.duration.value;if(u<W&&Math.abs(h)>V){const d=k(h,u);g(t,d,"end",a)}else g(t,h,"end",a)};t.addEventListener("transitionend",f),t.addEventListener("touchstart",l),t.addEventListener("touchmove",i),t.addEventListener("touchend",s),t.addEventListener("touchcancel",s),T.set(t,{state:r,transitionend:f,touchstart:l,touchmove:i,touchend:s,touchcancel:s})}function A(t){const e=T.get(t);e&&(T.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 U=o.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:null,routerViewName:null,viewTag:{default:"div"},transition:{type:[Object,Boolean],default:!0},viewClass:{default:"fox-root-navigator__item"}},setup(t){const e=t;function n(l){return(l.params&&l.params.animationType)??"slide"}const a=(l,i,s,h)=>{if(s.opsType===3||i){const u=n(s);if(u==="pop"&&i)return;const p=i?"show":"enter",d=`fox-root-navigator__${u}-${p}-from`,c=`fox-root-navigator__${u}-${p}-active`;l.classList.add(d),l.classList.add(c)}},r=(l,i,s,h)=>{if(s.opsType===3||i){const u=n(s);if(u==="pop"&&i)return;const p=i?"show":"enter",d=`fox-root-navigator__${u}-${p}-from`,c=`fox-root-navigator__${u}-${p}-to`;l.classList.remove(d),l.classList.add(c)}},m=(l,i,s,h)=>{if(s.opsType===3||i){const u=n(s);if(u!=="pop"||!i){const p=i?"show":"enter",d=`fox-root-navigator__${u}-${p}-active`,c=`fox-root-navigator__${u}-${p}-to`;l.classList.remove(d),l.classList.remove(c)}}e.dragRemove&&!i&&s.opsType===3&&X(l,e.removeViewPage,"fox-root-navigator__item-moving",1e3)},_=(l,i,s,h)=>{if(s.opsType===3||i){const u=n(s);if(u==="pop"&&i)return;const p=i?"hide":"leave",d=`fox-root-navigator__${u}-${p}-from`,c=`fox-root-navigator__${u}-${p}-active`;l.classList.add(d),l.classList.add(c)}},g=(l,i,s,h)=>{if(s.opsType===3||i){const u=n(s);if(u==="pop"&&i)return;const p=i?"hide":"leave",d=`fox-root-navigator__${u}-${p}-from`,c=`fox-root-navigator__${u}-${p}-to`;l.classList.remove(d),l.classList.add(c)}},f=(l,i,s,h)=>{if(s.opsType===3||i){const u=n(s);if(u!=="pop"||!i){const p=i?"hide":"leave",d=`fox-root-navigator__${u}-${p}-active`,c=`fox-root-navigator__${u}-${p}-to`;l.classList.remove(d),l.classList.remove(c)}}e.dragRemove&&!i&&A(l)};return(l,i)=>{const s=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(s,{class:"fox-root-navigator","view-class":t.viewClass,"before-enter":a,enter:r,"after-enter":m,"before-leave":_,leave:g,"after-leave":f,multi:!0,name:e.routerViewName,"view-tag":e.viewTag,transition:e.transition},null,8,["view-class","name","view-tag","transition"])}}}),dt="",R=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"})),Y={class:"fox-swiper-navigator"},q=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(a,r)=>(o.openBlock(),o.createElementBlock("div",Y,[o.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:o.normalizeStyle(o.unref(n))},[o.renderSlot(a.$slots,"default")],4)]))}});let H=0;function F(){return++H}const G=15,J=300,K=200;function Q(t){t.stopPropagation()}function Z(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&Q(t)}function tt(t,e){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function b(t,e=0,n,a=K){n==="end"?t.style.transition=`transform ${a}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 et{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,a,r){this.getStartDistance=e,this.openPage=n,this.isPageOpened=a,this.pageOpened=r}open(){const e=this.el,n=E(),a=(r,m,_,g)=>{let f=m+this.startDistance;const l=this.columnWidth/3;if(_==="end"){if(f==0){this.moving=!1;return}Math.abs(m)>l&&(m>0?f=this.startDistance+this.columnWidth:f=this.startDistance-this.columnWidth);let i=-f;i<0?i=0:i>this.width-this.columnWidth&&(i=this.width-this.columnWidth);const s=Math.floor(i/this.columnWidth);this.isPageOpened(s)||this.openPage(s),f=-s*this.columnWidth,g&&g>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(s)}),b(r,f,"end",g),this.scrollDistance=f}else{if(Math.abs(m)>l){let s=0;if(m>0?s=Math.abs(this.startDistance+this.columnWidth):s=Math.abs(this.startDistance-this.columnWidth),s>=0&&s<this.width){const h=Math.floor(s/this.columnWidth);this.isPageOpened(h)||this.openPage(h)}}let i=-f;i<this.min?i=this.min:i>this.max&&(i=this.max),b(r,-i,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=r=>{this.moving||(n.start(r),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=r=>{n.move(r),n.isHorizontal()&&Z(r,!0),a(e,n.deltaX.value,"",0)},this.touchend=()=>{const r=n.deltaX.value;if(r==0)return;const m=n.duration.value;if(m<J&&Math.abs(r)>G){const g=tt(r,m);a(e,g,"end",this.swipeDuration)}else a(e,r,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function nt(t,e,n,a){return new et(t,e,n,a)}const ot=o.defineComponent({__name:"index",props:{activePath:null,routes:null,height:null,width:null,drag:{type:Boolean,default:!0},openViewPage:null,routerViewName:null,transition:{type:[Object,Boolean],default:!0},swipeDuration:{default:360},scrollTime:{default:0}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,a=o.reactive({scrollDistance:0,index:-1,openedIndexList:[]}),f=nt(()=>a.scrollDistance,d=>{if(a.openedIndexList.indexOf(d)===-1){a.openedIndexList.push(d);const c=n.routes[d];try{n.openViewPage(c,d)}catch(v){console.error(v)}}},d=>a.openedIndexList.indexOf(d)!==-1,d=>{a.index=d,a.scrollDistance=-a.index*n.width;const c=n.routes[d];e("update:activePath",c.path)});o.onMounted(()=>{const d=h();f.el=d,f.open()}),o.onUnmounted(()=>{f.close()}),o.watchEffect(()=>{const d=n.activePath;a.index=n.routes.findIndex(rt=>rt.path===d);const c=n.width;a.index!==-1&&(a.openedIndexList.push(a.index),a.scrollDistance=-c*a.index);const v=c*n.routes.length,w=-c/3,D=c*(n.routes.length-1)+c/3;f.columnWidth=c,f.width=v,f.min=w,f.max=D,f.swipeDuration=n.swipeDuration});const l=`fox-swiper-navigator-${F()}`,i=o.computed(()=>({width:`${n.width}px`,height:`${n.height}px`}));let s=null;function h(){return s||(s=document.querySelector(`.${l}>.fox-swiper-navigator__inner`),s)}const u=o.computed(()=>`${n.width*n.routes.length}px`),p=(d,c)=>({style:{left:`${n.routes.findIndex(w=>{const D=d.path??d.name??"";return w.path==D})*n.width}px`,width:`${n.width}px`}});return(d,c)=>{const v=o.resolveComponent("fox-router-view");return o.openBlock(),o.createBlock(v,{class:o.normalizeClass(l),style:o.normalizeStyle(o.unref(i)),"view-class":"fox-swiper-navigator__item",tag:q,"view-tag-props":p,multi:!0,name:n.routerViewName,transition:n.transition,"scroll-distance":a.scrollDistance,"scroll-time":n.scrollTime,width:o.unref(u)},null,8,["style","name","transition","scroll-distance","scroll-time","width"])}}}),ut="",it=Object.freeze(Object.defineProperty({__proto__:null,default:ot},Symbol.toStringTag,{value:"Module"}));let st="fox-";const at=[],L=Object.assign({"/src/components/card-navigator/index.vue":O,"/src/components/default-navigator/index.vue":C,"/src/components/root-navigator/index.vue":R,"/src/components/swiper-navigator/index.vue":it}),M=[];for(const t in L){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];at.indexOf(e)===-1&&M.push({name:e,component:L[t].default})}return{install(t){M.forEach(e=>{t.component(`${st}${e.name}`,e.component)})}}});
1
+ (function(n,w){typeof exports=="object"&&typeof module<"u"?module.exports=w(require("vue")):typeof define=="function"&&define.amd?define(["vue"],w):(n=typeof globalThis<"u"?globalThis:n||self,n.FoxNavigation=w(n.Vue))})(this,function(n){"use strict";/*!
2
+ * @fox-js/navigation v4.0.1-4 Mon Jan 30 2023 14:43:23 GMT+0800 (中国标准时间)
3
+ */const w=n.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!1}},setup(t){const e=t;return(o,s)=>{const f=n.resolveComponent("fox-router-view");return n.openBlock(),n.createBlock(f,{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"])}}}),ct="",P=Object.freeze(Object.defineProperty({__proto__:null,default:w},Symbol.toStringTag,{value:"Module"})),C=n.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(t){const e=t;return(o,s)=>{const f=n.resolveComponent("fox-router-view");return n.openBlock(),n.createBlock(f,{transition:!1,multi:!1,name:e.routerViewName},{default:n.withCtx(({Component:d})=>[n.createVNode(n.Transition,{name:"fox-default-navigator__trans"},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d)))]),_:2},1024)]),_:1},8,["name"])}}}),lt="",I=Object.freeze(Object.defineProperty({__proto__:null,default:C},Symbol.toStringTag,{value:"Module"})),E=10;function S(t,e){return t>e&&t>E?"horizontal":e>t&&e>E?"vertical":""}function b(){const t=n.ref(0),e=n.ref(0),o=n.ref(0),s=n.ref(0),f=n.ref(0),d=n.ref(0),_=n.ref(0),g=n.ref(0),h=n.ref(0),c=n.ref(0),i=n.ref(""),r=()=>i.value==="vertical",v=()=>i.value==="horizontal",a=()=>{_.value=0,g.value=0,h.value=0,c.value=0,i.value="",o.value=0};return{move:u=>{const m=u.touches[0];_.value=m.clientX-t.value,g.value=m.clientY-e.value,f.value=m.clientX,d.value=m.clientY,h.value=Math.abs(_.value),c.value=Math.abs(g.value),s.value=Date.now()-o.value,i.value||(i.value=S(h.value,c.value))},start:u=>{a(),t.value=u.touches[0].clientX,e.value=u.touches[0].clientY,o.value=Date.now()},reset:a,startX:t,startY:e,startTime:o,duration:s,moveX:f,moveY:d,deltaX:_,deltaY:g,offsetX:h,offsetY:c,direction:i,isVertical:r,isHorizontal:v}}function B(t){return t===window}const V=t=>{const e=n.unref(t);if(B(e)){const o=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:o,bottom:s,width:o,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){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function D(t,e=0,o,s=z){o==="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 $=new WeakMap;function A(t,e,o=500,s,f=1e3){const d={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},_=t.previousSibling,g=b(),h=(a,p,l,u)=>{let m=p+d.startDistance;if(l==="end"){const x=V(a);let y=x.width/3;m<y?m=0:m=x.width;let T=!1;u&&u>0&&(T=!0,d.transitionEndTrigger=()=>{d.moving=!1,s&&a.classList.remove(s),m>0&&typeof e=="function"&&e()}),D(a,m,"end",u),_&&D(_,0,"",0),!T&&m>0&&typeof e=="function"&&e()}else m<0&&(m=0),D(a,m,"",0)},c=()=>{t.style.transform="",t.style.transition="",d.transitionEndTrigger?(d.transitionEndTrigger(),d.transitionEndTrigger=null,_&&setTimeout(()=>{_&&(_.style.transform="",_.style.transition="")},o)):_&&(_.style.transform="",_.style.transition="")},i=a=>{if(g.start(a),d.moving){const p=t,{transform:l}=window.getComputedStyle(p);d.scrollDistance=+l.slice(7,l.length-1).split(", ")[5]}s&&t.classList.add(s),d.startDistance=d.scrollDistance,d.transitionEndTrigger=null,d.moving=!0},r=a=>{d.moving=!0,g.move(a),g.isHorizontal()&&k(a,!0),h(t,g.deltaX.value,"",0)},v=()=>{const a=g.deltaX.value;if(a==0){s&&t.classList.remove(s);return}const p=g.duration.value;if(p<N&&Math.abs(a)>W){const u=X(a,p);h(t,u,"end",f)}else h(t,a,"end",f)};t.addEventListener("transitionend",c),t.addEventListener("touchstart",i),t.addEventListener("touchmove",r),t.addEventListener("touchend",v),t.addEventListener("touchcancel",v),$.set(t,{state:d,transitionend:c,touchstart:i,touchmove:r,touchend:v,touchcancel:v})}function U(t){const e=$.get(t);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 R=n.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:null,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 o(c){return(c.params&&c.params.animationType)??"slide"}const s=(c,i,r,v)=>{if(r.opsType===3||i){const a=o(r);if(a==="pop"&&i)return;const p=i?"show":"enter",l=`fox-root-navigator__${a}-${p}-from`,u=`fox-root-navigator__${a}-${p}-active`;c.classList.add(l),c.classList.add(u)}},f=(c,i,r,v)=>{if(r.opsType===3||i){const a=o(r);if(a==="pop"&&i)return;const p=i?"show":"enter",l=`fox-root-navigator__${a}-${p}-from`,u=`fox-root-navigator__${a}-${p}-to`;c.classList.remove(l),c.classList.add(u)}},d=(c,i,r,v)=>{if(r.opsType===3||i){const a=o(r);if(a!=="pop"||!i){const p=i?"show":"enter",l=`fox-root-navigator__${a}-${p}-active`,u=`fox-root-navigator__${a}-${p}-to`;c.classList.remove(l),c.classList.remove(u)}}e.dragRemove&&!i&&r.opsType===3&&A(c,e.removeViewPage,e.removeViewPageDuration,"fox-root-navigator__item-moving",1e3)},_=(c,i,r,v)=>{if(r.opsType===3||i){const a=o(r);if(a==="pop"&&i)return;const p=i?"hide":"leave",l=`fox-root-navigator__${a}-${p}-from`,u=`fox-root-navigator__${a}-${p}-active`;c.classList.add(l),c.classList.add(u)}},g=(c,i,r,v)=>{if(r.opsType===3||i){const a=o(r);if(a==="pop"&&i)return;const p=i?"hide":"leave",l=`fox-root-navigator__${a}-${p}-from`,u=`fox-root-navigator__${a}-${p}-to`;c.classList.remove(l),c.classList.add(u)}},h=(c,i,r,v)=>{if(r.opsType===3||i){const a=o(r);if(a!=="pop"||!i){const p=i?"hide":"leave",l=`fox-root-navigator__${a}-${p}-active`,u=`fox-root-navigator__${a}-${p}-to`;c.classList.remove(l),c.classList.remove(u)}}e.dragRemove&&!i&&U(c)};return(c,i)=>{const r=n.resolveComponent("fox-router-view");return n.openBlock(),n.createBlock(r,{class:"fox-root-navigator","view-class":t.viewClass,"before-enter":s,enter:f,"after-enter":d,"before-leave":_,leave:g,"after-leave":h,multi:!0,name:e.routerViewName,"view-tag":e.viewTag,transition:e.transition},null,8,["view-class","name","view-tag","transition"])}}}),ut="",Y=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"})),q={class:"fox-swiper-navigator"},F=n.defineComponent({__name:"swiper",props:{width:null,scrollDistance:null,scrollTime:null},setup(t){const e=t,o=n.computed(()=>({transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`}));return(s,f)=>(n.openBlock(),n.createElementBlock("div",q,[n.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:n.normalizeStyle(n.unref(o))},[n.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){return t=Math.abs(t/e)/.003*(t<0?-1:1),t}function L(t,e=0,o,s=Q){o==="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;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,o,s,f){this.getStartDistance=e,this.openPage=o,this.isPageOpened=s,this.pageOpened=f}open(){const e=this.el,o=b(),s=(f,d,_,g)=>{let h=d+this.startDistance;const c=this.columnWidth/3;if(_==="end"){if(h==0){this.moving=!1;return}Math.abs(d)>c&&(d>0?h=this.startDistance+this.columnWidth:h=this.startDistance-this.columnWidth);let i=-h;i<0?i=0:i>this.width-this.columnWidth&&(i=this.width-this.columnWidth);const r=Math.floor(i/this.columnWidth);this.isPageOpened(r)||this.openPage(r),h=-r*this.columnWidth,g&&g>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(r)}),L(f,h,"end",g),this.scrollDistance=h}else{if(Math.abs(d)>c){let r=0;if(d>0?r=Math.abs(this.startDistance+this.columnWidth):r=Math.abs(this.startDistance-this.columnWidth),r>=0&&r<this.width){const v=Math.floor(r/this.columnWidth);this.isPageOpened(v)||this.openPage(v)}}let i=-h;i<this.min?i=this.min:i>this.max&&(i=this.max),L(f,-i,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=f=>{this.moving||(o.start(f),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=f=>{o.move(f),o.isHorizontal()&&tt(f,!0),s(e,o.deltaX.value,"",0)},this.touchend=()=>{const f=o.deltaX.value;if(f==0)return;const d=o.duration.value;if(d<K&&Math.abs(f)>J){const g=et(f,d);s(e,g,"end",this.swipeDuration)}else s(e,f,"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,o,s){return new nt(t,e,o,s)}const it=n.defineComponent({__name:"index",props:{activePath:null,routes:null,height:null,width:null,drag:{type:Boolean,default:!0},openViewPage:null,routerViewName:null,transition:{type:[Object,Boolean],default:!0},swipeDuration:{default:360},scrollTime:{default:0}},emits:["update:activePath"],setup(t,{emit:e}){const o=t,s=n.reactive({scrollDistance:0,index:-1,openedIndexList:[]}),h=ot(()=>s.scrollDistance,l=>{if(s.openedIndexList.indexOf(l)===-1){s.openedIndexList.push(l);const u=o.routes[l];try{o.openViewPage(u,l)}catch(m){console.error(m)}}},l=>s.openedIndexList.indexOf(l)!==-1,l=>{s.index=l,s.scrollDistance=-s.index*o.width;const u=o.routes[l];e("update:activePath",u.path)});n.onMounted(()=>{const l=v();h.el=l,h.open()}),n.onUnmounted(()=>{h.close()}),n.watchEffect(()=>{const l=o.activePath;s.index=o.routes.findIndex(T=>T.path===l);const u=o.width;s.index!==-1&&(s.openedIndexList.push(s.index),s.scrollDistance=-u*s.index);const m=u*o.routes.length,x=-u/3,y=u*(o.routes.length-1)+u/3;h.columnWidth=u,h.width=m,h.min=x,h.max=y,h.swipeDuration=o.swipeDuration});const c=`fox-swiper-navigator-${G()}`,i=n.computed(()=>({width:`${o.width}px`,height:`${o.height}px`}));let r=null;function v(){return r||(r=document.querySelector(`.${c}>.fox-swiper-navigator__inner`),r)}const a=n.computed(()=>`${o.width*o.routes.length}px`),p=(l,u)=>({style:{left:`${o.routes.findIndex(x=>{const y=l.path??l.name??"";return x.path==y})*o.width}px`,width:`${o.width}px`}});return(l,u)=>{const m=n.resolveComponent("fox-router-view");return n.openBlock(),n.createBlock(m,{class:n.normalizeClass(c),style:n.normalizeStyle(n.unref(i)),"view-class":"fox-swiper-navigator__item",tag:F,"view-tag-props":p,multi:!0,name:o.routerViewName,transition:o.transition,"scroll-distance":s.scrollDistance,"scroll-time":o.scrollTime,width:n.unref(a)},null,8,["style","name","transition","scroll-distance","scroll-time","width"])}}}),dt="",st=Object.freeze(Object.defineProperty({__proto__:null,default:it},Symbol.toStringTag,{value:"Module"}));let at="fox-";const rt=[],M=Object.assign({"/src/components/card-navigator/index.vue":P,"/src/components/default-navigator/index.vue":I,"/src/components/root-navigator/index.vue":Y,"/src/components/swiper-navigator/index.vue":st}),O=[];for(const t in M){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];rt.indexOf(e)===-1&&O.push({name:e,component:M[t].default})}return{install(t){O.forEach(e=>{t.component(`${at}${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,.fox-swiper-navigator__inner{position:absolute;top:0;bottom:0}.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{position:absolute}
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,.fox-swiper-navigator__inner{position:absolute;top:0;bottom:0}.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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fox-js/navigation",
3
- "version": "4.0.1-3",
3
+ "version": "4.0.1-5",
4
4
  "description": "fox navigation",
5
5
  "author": "jiangcheng",
6
6
  "keywords": [
@@ -12,11 +12,11 @@
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": {
15
- "node": "./dist/index.cjs.js",
15
+ "node": "./dist/index.esm.js",
16
16
  "default": "./dist/index.esm.js"
17
17
  },
18
18
  "require": {
19
- "node": "./dist/index.cjs.js",
19
+ "node": "./dist/index.umd.js",
20
20
  "default": "./dist/index.umd.js"
21
21
  }
22
22
  },
@@ -29,7 +29,7 @@
29
29
  "access": "public"
30
30
  },
31
31
  "scripts": {
32
- "publish:next": "npm version prerelease & npm publish --tag next",
32
+ "publish:next": "npm version prerelease && npm publish --tag next",
33
33
  "build:dev": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode development",
34
34
  "build:prod": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode production"
35
35
  },