@fox-js/navigation 4.0.1-20 → 4.0.1-21

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
@@ -7,19 +7,19 @@
7
7
  ### NPM
8
8
 
9
9
  ```shell
10
- npm i @fox-js/navigation -S
10
+ npm i @fox-js/navigation@next
11
11
  ```
12
12
 
13
13
  ### YARN
14
14
 
15
15
  ```shell
16
- yarn add @fox-js/navigation
16
+ yarn add @fox-js/navigation@next
17
17
  ```
18
18
 
19
19
  ### PNPM
20
20
 
21
21
  ```shell
22
- pnpm add @fox-js/navigation
22
+ pnpm add @fox-js/navigation@next
23
23
  ```
24
24
 
25
25
  ## 使用说明
@@ -89,12 +89,103 @@ pageHelper.append({
89
89
 
90
90
  | 字段 | 说明 | 类型 | 默认值 |
91
91
  |------------------|----------------------------------------|---------|-----------|
92
+ | router-view-name | router view名称 | String | `default` |
93
+ | view-tag | view tag标签 | Function/String | `div` |
94
+ | view-calss | view tag class | Function/String | - |
95
+ | transition | 动画支持 | Boolean | `true` |
92
96
  | drag-remove | 是否支持拖曳关闭 | Boolean | true |
97
+ | draggable-area | 动拖曳区域 | Rect | |
93
98
  | remove-page | 关闭顶层页面方法 | Function | |
99
+ | swipe-duration | 拖曳关闭动画时间(ms) | Number | `500` |
100
+ | remove-move-ratio | 触发删除动作的页面宽度比例 | Number | `0.5` |
101
+ | momentum-reduce-ratio | 惯性削减比例(0~1),1代表无削减 | Number | `1` |
102
+ | reset-delay | 动画完成后,重置状态延时(ms) | Number | `60` |
103
+
104
+
105
+
106
+ ## 插槽
107
+
108
+ | 名称 | 说明 |
109
+ |---------|------------------|
110
+ | default | 内容 |
111
+
112
+
113
+ ### fox-stack-navigator
114
+
115
+ stack导航组件,配合append方法使用,页面以堆栈的形式,新增的页面会盖在前一个页面上,支持新增页面的动画效果和拖曳关闭页面。
116
+
117
+ #### 基础用法
118
+
119
+ ```
120
+ <script setup lang="ts">
121
+ import { usePageHelper } from '@/utils/custom'
122
+ // 获取page helper
123
+ const pageHelper = usePageHelper()
124
+ // 定义remove page函数
125
+ const removePage = () => {
126
+ pageHelper.remove()
127
+ }
128
+ </script>
129
+
130
+ <template>
131
+ <fox-stack-navigator :remove-page="removePage"></fox-stack-navigator>
132
+ </template>
133
+
134
+ <style lang="scss">
135
+ </style>
136
+
137
+ ```
138
+
139
+ #### 设置页面加载动画
140
+
141
+ ##### 滑入方式
142
+
143
+ 通过route的params属性设置animationType:'slide'
144
+
145
+ ```ts
146
+ import { usePageHelper } from '@/utils/custom'
147
+
148
+ pageHelper.append({
149
+ path: target.route,
150
+ params: {
151
+ animationType:'slide'
152
+ }
153
+ })
154
+
155
+ ```
156
+
157
+ ##### 弹出方式
158
+
159
+ 通过route的params属性设置animationType:'pop'
160
+
161
+ ```ts
162
+ import { usePageHelper } from '@/utils/custom'
163
+
164
+ pageHelper.append({
165
+ path: target.route,
166
+ params: {
167
+ animationType:'pop'
168
+ }
169
+ })
170
+
171
+ ```
172
+
173
+
174
+ #### Props
175
+
176
+ | 字段 | 说明 | 类型 | 默认值 |
177
+ |------------------|----------------------------------------|---------|-----------|
94
178
  | router-view-name | router view名称 | String | `default` |
95
179
  | view-tag | view tag标签 | Function/String | `div` |
96
- | remove-move-ratio | 触发移除页面的移动比例(相对页面宽度) | Number | 0.5 |
97
- | momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
180
+ | view-calss | view tag class | Function/String | - |
181
+ | transition | 动画支持 | Boolean | `true` |
182
+ | drag-remove | 是否支持拖曳关闭 | Boolean | true |
183
+ | draggable-area | 动拖曳区域 | Rect | |
184
+ | remove-page | 关闭顶层页面方法 | Function | |
185
+ | swipe-duration | 拖曳关闭动画时间(ms) | Number | `500` |
186
+ | remove-move-ratio | 触发删除动作的页面宽度比例 | Number | `0.5` |
187
+ | momentum-reduce-ratio | 惯性削减比例(0~1),1代表无削减 | Number | `1` |
188
+ | reset-delay | 动画完成后,重置状态延时(ms) | Number | `60` |
98
189
 
99
190
 
100
191
 
@@ -244,13 +335,13 @@ onMounted(() => {
244
335
 
245
336
  <template>
246
337
  <fox-page :content-padding="contentPadding" ref="pageRef">
247
- <fox-footer-bar>
338
+ <fox-footer>
248
339
  <fox-tabbar v-model="index" @change="onTabChange">
249
340
  <template v-for="tab in tabs" :key="tab.title">
250
341
  <fox-tabbar-item :title="tab.title" :icon="tab.icon"></fox-tabbar-item>
251
342
  </template>
252
343
  </fox-tabbar>
253
- </fox-footer-bar>
344
+ </fox-footer>
254
345
  <fox-content ref="contentRef">
255
346
  <fox-swiper-navigator
256
347
  v-model:activePath="activeRoutePath"
@@ -282,8 +373,6 @@ onMounted(() => {
282
373
  | drag | 是否支持拖曳 | Boolean | |
283
374
  | swipe-duration | 滑动页面动画时间 | Number ||
284
375
  | scroll-time | 切换页面动画时间 | Number | |
285
- | move-ratio | 触发页面移动的比例(相对页面宽度) | Number | 0.5 |
286
- | momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
287
376
 
288
377
 
289
378
 
package/dist/index.cjs.js CHANGED
@@ -1,3 +1 @@
1
- "use strict";/*!
2
- * @fox-js/navigation v4.0.1-19 Sun Aug 17 2025 09:44:50 GMT+0800 (中国标准时间)
3
- */const r=require("vue"),L=require("@fox-js/fox"),k=r.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=r.resolveComponent("fox-router-view");return r.openBlock(),r.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:e.transition,multi:!0,name:e.routerViewName},null,8,["transition","name"])}}}),F=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"})),U=r.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=r.resolveComponent("fox-router-view");return r.openBlock(),r.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:r.withCtx(({Component:i})=>[r.createVNode(r.Transition,{name:"fox-default-navigator__trans"},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}}),j=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"})),X=10;function q(t,e){return t>e&&t>X?"horizontal":e>t&&e>X?"vertical":""}function B(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:p=>{if(p.touches){const m=p.touches[0];t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY}else t.deltaX=p.clientX-t.startX,t.deltaY=p.clientY-t.startY,t.moveX=p.clientX,t.moveY=p.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=q(t.offsetX,t.offsetY))},start:p=>{if(o(),p.touches){const m=p.touches[0];t.startX=m.clientX,t.startY=m.clientY}else t.startX=p.clientX,t.startY=p.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function H(t){return t===window}const G=t=>{const e=r.unref(t);if(H(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},J=(t,e,n)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const o=document.createEvent("Events");let i=!0,h=!0;for(let m in e)m==="bubbles"?i=!!e[m]:m==="cancelable"?h=!!e[m]:o[m]=e[m];o.initEvent(t,i,h),(n??document).dispatchEvent(o)},K=15,Q=300,Z=200;function tt(t){t.stopPropagation()}function et(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function C(t,e=0,n,o=Z){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function S(t){t.style.transition="",t.style.transform=""}const nt=/^matrix\((.+)\)$/;function A(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const i=nt.exec(o);i&&(e=+i[1].split(/,\s*/)[4])}return e}const P=new WeakMap;function ot(t,e,n,o,i,h=600,p=60,m=null){const l={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,dragging:!1,transitionEndTrigger:null},_=t.previousSibling,u=B(),y=(d,a,v,E)=>{let w=a+l.startDistance;if(v==="end"){const c=G(d);let T=c.width*e;w<T?w=0:w=c.width,l.transitionEndTrigger=()=>{l.moving=!1,d.classList.remove(i),setTimeout(()=>{_&&S(_),w==0?S(d):J(L.FoxLeaveEnd,{},d),l.moving=!1},p)},_&&C(_,0,"",0),w>0&&typeof o=="function"&&o(),C(d,w,"end",E)}else w<0&&(w=0),C(d,w,"",0)},s=()=>{l.transitionEndTrigger&&(l.transitionEndTrigger(),l.transitionEndTrigger=null)},g=d=>{if(u.start(d),l.draging=m?m(t,u.state.startX,u.state.startY):!0,!l.draging){u.reset();return}l.scrollDistance=0,l.moving&&(l.scrollDistance=A(t)),t.classList.add(i),l.transitionEndTrigger=null,l.moving=!0},f=d=>{!l.draging||(l.moving=!0,u.move(d),u.isVertical())||A(t)===0&&u.state.deltaX<0||(tt(d),y(t,u.state.deltaX,"",0))},b=()=>{if(!l.draging||(l.draging=!1,u.isVertical())||A(t)===0&&u.state.deltaX<0)return;const a=u.state.deltaX;if(a===0){t.classList.remove(i),l.moving=!1;return}const v=u.state.duration;if(v<Q&&Math.abs(a)>K){const w=et(a,v,n);y(t,w,"end",h)}else y(t,a,"end",h)};t.addEventListener("transitionend",s),t.addEventListener("transitioncancel",s),t.addEventListener("touchstart",g),t.addEventListener("touchmove",f),t.addEventListener("touchend",b),t.addEventListener("touchcancel",b),P.set(t,{state:l,transitionend:s,transitioncancel:s,touchstart:g,touchmove:f,touchend:b,touchcancel:b})}function it(t){const e=P.get(t);e&&(P.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("transitioncancel",e.transitioncancel),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const st=r.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},draggableArea:{},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},transitionDuration:{},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(s){return(s.params&&s.params.animationType)??"slide"}function h(s){return(s.params&&s.params.dragRemove)??e.dragRemove}const p=(s,g,f,b)=>{if(f.opsType===L.OperationType.Append||g){const d=i(f),a=g?"show":"enter";if(a==="show"&&(d==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;a==="enter"&&(n=f,o="enter");const v=`fox-root-navigator__${d}-${a}-from`,E=`fox-root-navigator__${d}-${a}-active`;s.classList.add(v),s.classList.add(E)}},m=(s,g,f,b)=>{if(f.opsType===L.OperationType.Append||g){const d=i(f),a=g?"show":"enter";if(a==="show"&&(d==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const v=`fox-root-navigator__${d}-${a}-from`,E=`fox-root-navigator__${d}-${a}-to`;s.classList.remove(v),s.classList.add(E)}},l=(s,g,f,b)=>{if(f.opsType===L.OperationType.Append||g){const a=i(f),v=g?"show":"enter";if(v==="enter"&&(n=null,o=null),a!=="pop"){const E=`fox-root-navigator__${a}-${v}-active`,w=`fox-root-navigator__${a}-${v}-to`;s.classList.remove(E),s.classList.remove(w)}}if(h(f)===!0&&!g&&f.opsType===L.OperationType.Append){let a=null;e.draggableArea&&(a=function(v,E,w){const c=E-v.offsetLeft,T=w-v.offsetTop;return!(e.draggableArea?.left&&c<e.draggableArea?.left||e.draggableArea?.right&&c>e.draggableArea?.right||e.draggableArea?.top&&T<e.draggableArea?.top||e.draggableArea?.bottom&&T>e.draggableArea?.bottom)}),ot(s,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay,a)}},_=(s,g,f,b)=>{if(f.opsType===L.OperationType.Append||g){const d=i(f),a=g?"hide":"leave";if(a==="hide"&&(d==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;a==="leave"&&(n=f,o="leave");const v=`fox-root-navigator__${d}-${a}-from`,E=`fox-root-navigator__${d}-${a}-active`;s.classList.add(v),s.classList.add(E)}},u=(s,g,f,b)=>{if(f.opsType===L.OperationType.Append||g){const d=i(f),a=g?"hide":"leave";if(a==="hide"&&(d==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const v=`fox-root-navigator__${d}-${a}-from`,E=`fox-root-navigator__${d}-${a}-to`;s.classList.remove(v),s.classList.add(E)}},y=(s,g,f,b)=>{if(f.opsType===L.OperationType.Append||g){const a=i(f),v=g?"hide":"leave";if(v==="leave"&&(n=null,o=null),a!=="pop"){const E=`fox-root-navigator__${a}-${v}-active`,w=`fox-root-navigator__${a}-${v}-to`;s.classList.remove(E),s.classList.remove(w)}}h(f)&&!g&&it(s)};return(s,g)=>{const f=r.resolveComponent("fox-router-view");return r.openBlock(),r.createBlock(f,{class:"fox-root-navigator","view-class":s.viewClass,"before-enter":p,enter:m,"after-enter":l,"before-leave":_,leave:u,"after-leave":y,multi:!0,name:s.routerViewName,"view-tag":s.viewTag,transition:s.transition,"transition-duration":s.transitionDuration},null,8,["view-class","name","view-tag","transition","transition-duration"])}}}),at=Object.freeze(Object.defineProperty({__proto__:null,default:st},Symbol.toStringTag,{value:"Module"})),rt={class:"fox-swiper-navigator"},ct=r.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=r.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,i)=>(r.openBlock(),r.createElementBlock("div",rt,[r.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:r.normalizeStyle(n.value)},[r.renderSlot(o.$slots,"default")],4)]))}});let lt=0;function ut(){return++lt}const dt=15,ft=300,ht=200;function mt(t){t.stopPropagation()}function pt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function I(t,e=0,n,o=ht){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}class gt{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,i,h,p){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=h,this.momentumReduceRatio=p}open(){const e=this.el,n=B(),o=(i,h,p,m)=>{let l=h+this.startDistance;const _=this.columnWidth*this.moveRatio;if(p==="end"){if(h==0){this.moving=!1;return}Math.abs(h)>_?h>0?l=this.startDistance+this.columnWidth:l=this.startDistance-this.columnWidth:l=this.startDistance;let u=-l;u<0?u=0:u>this.width-this.columnWidth&&(u=this.width-this.columnWidth);const y=Math.floor(u/this.columnWidth);this.isPageOpened(y)||this.openPage(y),l=-y*this.columnWidth,m&&m>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(y)}),I(i,l,"end",m),this.scrollDistance=l}else{if(Math.abs(h)>_){let y=0;if(h>0?y=Math.abs(this.startDistance+this.columnWidth):y=Math.abs(this.startDistance-this.columnWidth),y>=0&&y<this.width){const s=Math.floor(y/this.columnWidth);this.isPageOpened(s)||this.openPage(s)}}let u=-l;u<this.min?u=this.min:u>this.max&&(u=this.max),I(i,-u,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=i=>{this.moving||(n.start(i),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=i=>{n.move(i),!n.isVertical()&&(mt(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const h=n.state.duration;if(h<ft&&Math.abs(i)>dt){const m=pt(i,h,this.momentumReduceRatio);o(e,m,"end",this.swipeDuration)}else o(e,i,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function vt(t,e,n,o,i,h){return new gt(t,e,n,o,i,h)}function _t(t){const e=r.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),h=parseFloat(n.getPropertyValue("padding-top")),p=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-h-p}}const wt=r.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=r.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,h=()=>o.scrollDistance,p=c=>{if(o.openedIndexList.indexOf(c)===-1){o.openedIndexList.push(c);const T=n.routes[c];try{n.openViewPage(T,c)}catch(x){console.error(x)}}},m=c=>o.openedIndexList.indexOf(c)!==-1,l=c=>{o.index=c,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const T=n.routes[c];i("update:activePath",T.path)};let _=null;n.draggable&&(_=vt(h,p,m,l,n.moveRatio,n.momentumReduceRatio));let u=null;r.onMounted(()=>{const c=d(),T=()=>{const x=_t(c);y(n.activePath,n.routes,x.width,x.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(u=new window.ResizeObserver(T),u.observe(c)),T(),_){const x=v();_.el=x,_.open()}}),r.onBeforeUnmount(()=>{u&&(u.disconnect(),u=null),_&&_.close()}),r.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([c,T,x,$,M,R])=>{const O=x<=0?o.width:x,D=$<=0?o.height:$;y(c,T,O,D,M,R)});const y=(c,T,x,$,M,R="horizontal")=>{const O=c;if(o.index=T.findIndex(D=>D.path===O),R==="horizontal"){const D=x;if(D>0){o.width=x;const z=D*n.routes.length,N=-D/3,W=D*(T.length-1)+D/3;_&&(_.columnWidth=D,_.width=z,_.min=N,_.max=W),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-D*o.index)}}_&&(_.swipeDuration=M)},s=`fox-swiper-navigator-${ut()}`,g=r.computed(()=>{const c=[s];return n.customClass&&c.push(n.customClass),c}),f=r.computed(()=>{const c={},T=o.width>0?o.width:n.width;T>0&&(c.width=`${T}px`);const x=o.height>0?o.height:n.height;return x>0&&(c.height=`${x}px`),n.customStyle&&Object.assign(c,n.customStyle),c});let b=null;function d(){return b||(b=document.querySelector(`.${s}`),b)}let a=null;function v(){return a||(a=document.querySelector(`.${s}>.fox-swiper-navigator__inner`),a)}const E=r.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),w=(c,T)=>{const x=n.routes.findIndex($=>{const M=c.path??c.name??"";return $.path==M});return o.width<=0?{}:{style:{left:`${x*o.width}px`,width:`${o.width}px`}}};return(c,T)=>{const x=r.resolveComponent("fox-router-view");return r.openBlock(),r.createBlock(x,{class:r.normalizeClass(g.value),style:r.normalizeStyle(f.value),"view-class":"fox-swiper-navigator__item",tag:ct,"view-tag-props":w,multi:!0,name:c.routerViewName,transition:c.transition,"scroll-distance":o.scrollDistance,"scroll-duration":c.scrollDuration,direction:c.direction,width:E.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}}),Tt=Object.freeze(Object.defineProperty({__proto__:null,default:wt},Symbol.toStringTag,{value:"Module"}));let yt="fox-";const xt=[],Y=Object.assign({"/src/components/card-navigator/index.vue":F,"/src/components/default-navigator/index.vue":j,"/src/components/root-navigator/index.vue":at,"/src/components/swiper-navigator/index.vue":Tt}),V=[];for(const t in Y){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];xt.indexOf(e)===-1&&V.push({name:e,component:Y[t].default})}const Et={install(t){V.forEach(e=>{t.component(`${yt}${e.name}`,e.component)})}};module.exports=Et;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("vue"),D=require("@fox-js/fox"),F=m.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=m.resolveComponent("fox-router-view");return m.openBlock(),m.createBlock(o,{transition:!1,multi:!1,name:t.routerViewName},{default:m.withCtx(({Component:r})=>[m.createVNode(m.Transition,{name:"fox-default-navigator__trans"},{default:m.withCtx(()=>[(m.openBlock(),m.createBlock(m.resolveDynamicComponent(r)))]),_:2},1024)]),_:1},8,["name"])}}}),B=10;function Q(t,e){return t>e&&t>B?"horizontal":e>t&&e>B?"vertical":""}function I(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:(h=>{if(h.touches){const w=h.touches[0];t.deltaX=w.clientX-t.startX,t.deltaY=w.clientY-t.startY,t.moveX=w.clientX,t.moveY=w.clientY}else t.deltaX=h.clientX-t.startX,t.deltaY=h.clientY-t.startY,t.moveX=h.clientX,t.moveY=h.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=Q(t.offsetX,t.offsetY))}),start:(h=>{if(o(),h.touches){const w=h.touches[0];t.startX=w.clientX,t.startY=w.clientY}else t.startX=h.clientX,t.startY=h.clientY;t.startTime=Date.now()}),reset:o,isVertical:e,isHorizontal:n,state:t}}function Z(t){return t===window}const W=t=>{const e=m.unref(t);if(Z(e)){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return e&&e.getBoundingClientRect?e.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},z=(t,e,n)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const o=document.createEvent("Events");let r=!0,v=!0;for(let w in e)w==="bubbles"?r=!!e[w]:w==="cancelable"?v=!!e[w]:o[w]=e[w];o.initEvent(t,r,v),(n??document).dispatchEvent(o)},tt=15,et=300,nt=200;function ot(t){t.stopPropagation()}function it(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function C(t,e=0,n,o=nt){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function V(t){t.style.transition="",t.style.transform=""}const at=/^matrix\((.+)\)$/;function X(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const r=at.exec(o);r&&(e=+r[1].split(/,\s*/)[4])}return e}const S=new WeakMap;function st(t,e,n,o,r,v,h=600,w=60,$=null){const s={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,dragging:!1,transitionEndTrigger:null},T=t.previousSibling,g=I(),a=(i,d,p,x)=>{let l=d+s.startDistance;if(p==="end"){const y=W(i);let E=y.width*e;l<E?l=0:l=y.width,s.transitionEndTrigger=()=>{s.moving=!1,i.classList.remove(v),setTimeout(()=>{T&&V(T),l==0?V(i):z(D.FoxLeaveEnd,{},i),s.moving=!1},w)},T&&C(T,0,"",0),l>0&&typeof o=="function"&&o(r),C(i,l,"end",x)}else l<0&&(l=0),C(i,l,"",0)},u=()=>{s.transitionEndTrigger&&(s.transitionEndTrigger(),s.transitionEndTrigger=null)},c=i=>{if(g.start(i),s.draging=$?$(t,g.state.startX,g.state.startY):!0,!s.draging){g.reset();return}s.scrollDistance=0,s.moving&&(s.scrollDistance=X(t)),t.classList.add(v),s.transitionEndTrigger=null,s.moving=!0},L=i=>{!s.draging||(s.moving=!0,g.move(i),g.isVertical())||X(t)===0&&g.state.deltaX<0||(ot(i),a(t,g.state.deltaX,"",0))},f=()=>{if(!s.draging||(s.draging=!1,g.isVertical())||X(t)===0&&g.state.deltaX<0)return;const d=g.state.deltaX;if(d===0){t.classList.remove(v),s.moving=!1;return}const p=g.state.duration;if(p<et&&Math.abs(d)>tt){const l=it(d,p,n);a(t,l,"end",h)}else a(t,d,"end",h)};t.addEventListener("transitionend",u),t.addEventListener("transitioncancel",u),t.addEventListener("touchstart",c),t.addEventListener("touchmove",L),t.addEventListener("touchend",f),t.addEventListener("touchcancel",f),S.set(t,{state:s,transitionend:u,transitioncancel:u,touchstart:c,touchmove:L,touchend:f,touchcancel:f})}function rt(t){const e=S.get(t);e&&(S.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("transitioncancel",e.transitioncancel),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const U=m.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},draggableArea:{},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},transitionDuration:{},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function r(a){return(a.params&&a.params.animationType)??"slide"}function v(a){return(a.params&&a.params.dragRemove)??e.dragRemove}const h=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"show":"enter";if(i==="show"&&(f==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;i==="enter"&&(n=c,o="enter");const d=`fox-root-navigator--${f}-${i}-from`,p=`fox-root-navigator--${f}-${i}-active`;a.classList.add(d),a.classList.add(p)}},w=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"show":"enter";if(i==="show"&&(f==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;const d=`fox-root-navigator--${f}-${i}-from`,p=`fox-root-navigator--${f}-${i}-to`;a.classList.remove(d),a.classList.add(p)}},$=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const i=r(c),d=u?"show":"enter";if(d==="enter"&&(n=null,o=null),i!=="pop"){const p=`fox-root-navigator--${i}-${d}-active`,x=`fox-root-navigator--${i}-${d}-to`;a.classList.remove(p),a.classList.remove(x)}}if(v(c)===!0&&!u&&c.opsType===D.OperationType.Append){let i=null;e.draggableArea&&(i=function(d,p,x){const l=p-d.offsetLeft,y=x-d.offsetTop;return!(e.draggableArea?.left&&l<e.draggableArea?.left||e.draggableArea?.right&&l>e.draggableArea?.right||e.draggableArea?.top&&y<e.draggableArea?.top||e.draggableArea?.bottom&&y>e.draggableArea?.bottom)}),st(a,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,c,"fox-root-navigator__item--moving",e.swipeDuration,e.resetDelay,i)}},s=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"hide":"leave";if(i==="hide"&&(f==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;i==="leave"&&(n=c,o="leave");const d=`fox-root-navigator--${f}-${i}-from`,p=`fox-root-navigator--${f}-${i}-active`;a.classList.add(d),a.classList.add(p)}},T=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"hide":"leave";if(i==="hide"&&(f==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;const d=`fox-root-navigator--${f}-${i}-from`,p=`fox-root-navigator--${f}-${i}-to`;a.classList.remove(d),a.classList.add(p)}},g=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const i=r(c),d=u?"hide":"leave";if(d==="leave"&&(n=null,o=null),i!=="pop"){const p=`fox-root-navigator--${i}-${d}-active`,x=`fox-root-navigator--${i}-${d}-to`;a.classList.remove(p),a.classList.remove(x)}}v(c)&&!u&&rt(a)};return(a,u)=>{const c=m.resolveComponent("fox-router-view");return m.openBlock(),m.createBlock(c,{class:"fox-root-navigator","view-class":t.viewClass,"before-enter":h,enter:w,"after-enter":$,"before-leave":s,leave:T,"after-leave":g,multi:!0,name:t.routerViewName,"view-tag":t.viewTag,transition:t.transition,"transition-duration":t.transitionDuration},null,8,["view-class","name","view-tag","transition","transition-duration"])}}}),q=m.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=m.resolveComponent("fox-router-view");return m.openBlock(),m.createBlock(o,{class:"fox-card-navigator","view-class":"fox-card-navigator__item","view-active-class":"fox-card-navigator__item-active","view-inactive-class":"fox-card-navigator__item-inactive","transition-name":"fox-card-navigator__trans",transition:t.transition,multi:!0,name:t.routerViewName},null,8,["transition","name"])}}}),ct=15,lt=300,dt=200;function ut(t){t.stopPropagation()}function ft(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function O(t,e=0,n,o=dt){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function N(t){t.style.transition="",t.style.transform=""}const mt=/^matrix\((.+)\)$/;function P(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const r=mt.exec(o);r&&(e=+r[1].split(/,\s*/)[4])}return e}const k=new WeakMap;function gt(t,e,n,o,r,v,h=600,w=60,$=null){const s={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,dragging:!1,transitionEndTrigger:null},T=t.previousSibling,g=I(),a=(i,d,p,x)=>{let l=d+s.startDistance;if(p==="end"){const y=W(i);let E=y.width*e;l<E?l=0:l=y.width,s.transitionEndTrigger=()=>{s.moving=!1,i.classList.remove(v),setTimeout(()=>{T&&N(T),l==0?N(i):z(D.FoxLeaveEnd,{},i),s.moving=!1},w)},T&&O(T,0,"",0),l>0&&typeof o=="function"&&o(r),O(i,l,"end",x)}else l<0&&(l=0),O(i,l,"",0)},u=()=>{s.transitionEndTrigger&&(s.transitionEndTrigger(),s.transitionEndTrigger=null)},c=i=>{if(g.start(i),s.draging=$?$(t,g.state.startX,g.state.startY):!0,!s.draging){g.reset();return}s.scrollDistance=0,s.moving&&(s.scrollDistance=P(t)),t.classList.add(v),s.transitionEndTrigger=null,s.moving=!0},L=i=>{!s.draging||(s.moving=!0,g.move(i),g.isVertical())||P(t)===0&&g.state.deltaX<0||(ut(i),a(t,g.state.deltaX,"",0))},f=()=>{if(!s.draging||(s.draging=!1,g.isVertical())||P(t)===0&&g.state.deltaX<0)return;const d=g.state.deltaX;if(d===0){t.classList.remove(v),s.moving=!1;return}const p=g.state.duration;if(p<lt&&Math.abs(d)>ct){const l=ft(d,p,n);a(t,l,"end",h)}else a(t,d,"end",h)};t.addEventListener("transitionend",u),t.addEventListener("transitioncancel",u),t.addEventListener("touchstart",c),t.addEventListener("touchmove",L),t.addEventListener("touchend",f),t.addEventListener("touchcancel",f),k.set(t,{state:s,transitionend:u,transitioncancel:u,touchstart:c,touchmove:L,touchend:f,touchcancel:f})}function pt(t){const e=k.get(t);e&&(k.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("transitioncancel",e.transitioncancel),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const H=m.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},draggableArea:{},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},transitionDuration:{},viewClass:{type:[Function,String],default:"fox-stack-navigator__item"}},setup(t){const e=t;let n=null,o=null;function r(a){return(a.params&&a.params.animationType)??"slide"}function v(a){return(a.params&&a.params.dragRemove)??e.dragRemove}const h=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"show":"enter";if(i==="show"&&(f==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;i==="enter"&&(n=c,o="enter");const d=`fox-stack-navigator--${f}-${i}-from`,p=`fox-stack-navigator--${f}-${i}-active`;a.classList.add(d),a.classList.add(p)}},w=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"show":"enter";if(i==="show"&&(f==="pop"||o!=="leave"||(n?r(n):"")==="pop"))return;const d=`fox-stack-navigator--${f}-${i}-from`,p=`fox-stack-navigator--${f}-${i}-to`;a.classList.remove(d),a.classList.add(p)}},$=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const i=r(c),d=u?"show":"enter";if(d==="enter"&&(n=null,o=null),i!=="pop"){const p=`fox-stack-navigator--${i}-${d}-active`,x=`fox-stack-navigator--${i}-${d}-to`;a.classList.remove(p),a.classList.remove(x)}}if(v(c)===!0&&!u&&c.opsType===D.OperationType.Append){let i=null;e.draggableArea&&(i=function(d,p,x){const l=p-d.offsetLeft,y=x-d.offsetTop;return!(e.draggableArea?.left&&l<e.draggableArea?.left||e.draggableArea?.right&&l>e.draggableArea?.right||e.draggableArea?.top&&y<e.draggableArea?.top||e.draggableArea?.bottom&&y>e.draggableArea?.bottom)}),gt(a,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,c,"fox-stack-navigator__item--moving",e.swipeDuration,e.resetDelay,i)}},s=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"hide":"leave";if(i==="hide"&&(f==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;i==="leave"&&(n=c,o="leave");const d=`fox-stack-navigator--${f}-${i}-from`,p=`fox-stack-navigator--${f}-${i}-active`;a.classList.add(d),a.classList.add(p)}},T=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const f=r(c),i=u?"hide":"leave";if(i==="hide"&&(f==="pop"||o!=="enter"||(n?r(n):"")==="pop"))return;const d=`fox-stack-navigator--${f}-${i}-from`,p=`fox-stack-navigator--${f}-${i}-to`;a.classList.remove(d),a.classList.add(p)}},g=(a,u,c,L)=>{if(c.opsType===D.OperationType.Append||u){const i=r(c),d=u?"hide":"leave";if(d==="leave"&&(n=null,o=null),i!=="pop"){const p=`fox-stack-navigator--${i}-${d}-active`,x=`fox-stack-navigator--${i}-${d}-to`;a.classList.remove(p),a.classList.remove(x)}}v(c)&&!u&&pt(a)};return(a,u)=>{const c=m.resolveComponent("fox-router-view");return m.openBlock(),m.createBlock(c,{class:"fox-stack-navigator","view-class":t.viewClass,"before-enter":h,enter:w,"after-enter":$,"before-leave":s,leave:T,"after-leave":g,multi:!0,name:t.routerViewName,"view-tag":t.viewTag,transition:t.transition,"transition-duration":t.transitionDuration},null,8,["view-class","name","view-tag","transition","transition-duration"])}}}),vt={class:"fox-swiper-navigator"},ht=m.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=m.computed(()=>{const o={transform:`translate3d(${e.scrollDistance}px, 0, 0)`,width:`${e.width}`};return e.scrollDuration>0&&(o["transition-duration"]=`${e.scrollDuration}ms`),o});return(o,r)=>(m.openBlock(),m.createElementBlock("div",vt,[m.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:m.normalizeStyle(n.value)},[m.renderSlot(o.$slots,"default")],4)]))}});let Tt=0;function wt(){return++Tt}const yt=15,xt=300,Et=200;function Lt(t){t.stopPropagation()}function $t(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function Y(t,e=0,n,o=Et){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}class Dt{width=0;columnWidth=0;max=0;min=0;el=null;swipeDuration=360;transitionEndTrigger=null;moving=!1;startDistance=0;scrollDistance=0;getStartDistance;openPage;isPageOpened;pageOpened;moveRatio=.5;momentumReduceRatio=1;transitionend=null;touchstart=null;touchmove=null;touchend=null;touchcancel=null;constructor(e,n,o,r,v,h){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=r,this.moveRatio=v,this.momentumReduceRatio=h}open(){const e=this.el,n=I(),o=(r,v,h,w)=>{let $=v+this.startDistance;const s=this.columnWidth*this.moveRatio;if(h==="end"){if(v==0){this.moving=!1;return}Math.abs(v)>s?v>0?$=this.startDistance+this.columnWidth:$=this.startDistance-this.columnWidth:$=this.startDistance;let T=-$;T<0?T=0:T>this.width-this.columnWidth&&(T=this.width-this.columnWidth);const g=Math.floor(T/this.columnWidth);this.isPageOpened(g)||this.openPage(g),$=-g*this.columnWidth,w&&w>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(g)}),Y(r,$,"end",w),this.scrollDistance=$}else{if(Math.abs(v)>s){let g=0;if(v>0?g=Math.abs(this.startDistance+this.columnWidth):g=Math.abs(this.startDistance-this.columnWidth),g>=0&&g<this.width){const a=Math.floor(g/this.columnWidth);this.isPageOpened(a)||this.openPage(a)}}let T=-$;T<this.min?T=this.min:T>this.max&&(T=this.max),Y(r,-T,"",0)}};this.transitionend=()=>{e.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=r=>{this.moving||(n.start(r),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=r=>{n.move(r),!n.isVertical()&&(Lt(r),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const r=n.state.deltaX;if(r==0)return;const v=n.state.duration;if(v<xt&&Math.abs(r)>yt){const w=$t(r,v,this.momentumReduceRatio);o(e,w,"end",this.swipeDuration)}else o(e,r,"end",this.swipeDuration)},e.addEventListener("transitionend",this.transitionend),e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchmove",this.touchmove),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchend)}close(){const e=this.el;this.transitionend&&e.addEventListener("transitionend",this.transitionend),this.touchstart&&e.addEventListener("touchstart",this.touchstart),this.touchmove&&e.addEventListener("touchmove",this.touchmove),this.touchend&&e.addEventListener("touchend",this.touchend),this.touchcancel&&e.addEventListener("touchcancel",this.touchcancel),this.el=null}}function Rt(t,e,n,o,r,v){return new Dt(t,e,n,o,r,v)}function _t(t){const e=m.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),r=parseFloat(n.getPropertyValue("padding-right")),v=parseFloat(n.getPropertyValue("padding-top")),h=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-r,height:e.clientHeight-v-h}}const j=m.defineComponent({__name:"index",props:{activePath:{},routes:{},height:{default:-1},width:{default:-1},draggable:{type:Boolean,default:!0},openViewPage:{},routerViewName:{},moveRatio:{default:.5},momentumReduceRatio:{default:1},direction:{default:"horizontal"},transition:{type:[Function,Boolean],default:!0},swipeDuration:{default:360},scrollDuration:{},customClass:{},customStyle:{}},emits:["update:activePath"],setup(t,{emit:e}){const n=t,o=m.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),r=e,v=()=>o.scrollDistance,h=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const y=n.routes[l];try{n.openViewPage(y,l)}catch(E){console.error(E)}}},w=l=>o.openedIndexList.indexOf(l)!==-1,$=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const y=n.routes[l];r("update:activePath",y.path)};let s=null;n.draggable&&(s=Rt(v,h,w,$,n.moveRatio,n.momentumReduceRatio));let T=null;m.onMounted(()=>{const l=f(),y=()=>{const E=_t(l);g(n.activePath,n.routes,E.width,E.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(T=new window.ResizeObserver(y),T.observe(l)),y(),s){const E=d();s.el=E,s.open()}}),m.onBeforeUnmount(()=>{T&&(T.disconnect(),T=null),s&&s.close()}),m.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,y,E,_,b,A])=>{const M=E<=0?o.width:E,R=_<=0?o.height:_;g(l,y,M,R,b,A)});const g=(l,y,E,_,b,A="horizontal")=>{const M=l;if(o.index=y.findIndex(R=>R.path===M),A==="horizontal"){const R=E;if(R>0){o.width=E;const G=R*n.routes.length,J=-R/3,K=R*(y.length-1)+R/3;s&&(s.columnWidth=R,s.width=G,s.min=J,s.max=K),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-R*o.index)}}s&&(s.swipeDuration=b)},a=`fox-swiper-navigator-${wt()}`,u=m.computed(()=>{const l=[a];return n.customClass&&l.push(n.customClass),l}),c=m.computed(()=>{const l={},y=o.width>0?o.width:n.width;y>0&&(l.width=`${y}px`);const E=o.height>0?o.height:n.height;return E>0&&(l.height=`${E}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let L=null;function f(){return L||(L=document.querySelector(`.${a}`),L)}let i=null;function d(){return i||(i=document.querySelector(`.${a}>.fox-swiper-navigator__inner`),i)}const p=m.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),x=(l,y)=>{const E=n.routes.findIndex(_=>{const b=l.path??l.name??"";return _.path==b});return o.width<=0?{}:{style:{left:`${E*o.width}px`,width:`${o.width}px`}}};return(l,y)=>{const E=m.resolveComponent("fox-router-view");return m.openBlock(),m.createBlock(E,{class:m.normalizeClass(u.value),style:m.normalizeStyle(c.value),"view-class":"fox-swiper-navigator__item",tag:ht,"view-tag-props":x,multi:!0,name:t.routerViewName,transition:t.transition,"scroll-distance":o.scrollDistance,"scroll-duration":t.scrollDuration,direction:t.direction,width:p.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}}),bt={install(t,e="fox"){t.component(`${e}-default-navigator`,F),t.component(`${e}-root-navigator`,U),t.component(`${e}-card-navigator`,q),t.component(`${e}-stack-navigator`,H),t.component(`${e}-swiper-navigator`,j)}};exports.FoxCardNavigator=q;exports.FoxDefaultNavigator=F;exports.FoxRootNavigator=U;exports.FoxStackNavigator=H;exports.FoxSwiperNavigator=j;exports.default=bt;