@fox-js/navigation 4.0.0 → 4.0.1-3

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