@fox-js/navigation 3.0.1

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 ADDED
@@ -0,0 +1,290 @@
1
+ # fox-navigation
2
+
3
+ 导航组件,支持动画过渡
4
+
5
+ ## Install
6
+
7
+ ### NPM
8
+
9
+ ```shell
10
+ npm i @fox-js/navigation -S
11
+ ```
12
+
13
+ ### YARN
14
+
15
+ ```shell
16
+ yarn add @fox-js/navigation
17
+ ```
18
+
19
+ ### PNPM
20
+
21
+ ```shell
22
+ pnpm add @fox-js/navigation
23
+ ```
24
+
25
+ ## 使用说明
26
+
27
+ ### fox-root-navigator
28
+
29
+ root导航组件,在入口vue文件(App.vue)上使用,支持新增页面的动画效果和拖曳关闭页面。
30
+
31
+ #### 基础用法
32
+
33
+ ```
34
+ <script setup lang="ts">
35
+ import { usePageHelper } from '@/utils/custom'
36
+ // 获取page helper
37
+ const pageHelper = usePageHelper()
38
+ // 定义remove page函数
39
+ const removePage = () => {
40
+ pageHelper.remove()
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <fox-root-navigator :remove-page="removePage"></fox-root-navigator>
46
+ </template>
47
+
48
+ <style lang="scss">
49
+ </style>
50
+
51
+ ```
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
+
88
+ #### Props
89
+
90
+ | 字段 | 说明 | 类型 | 默认值 |
91
+ |------------------|----------------------------------------|---------|-----------|
92
+ | drag-remove | 是否支持拖曳关闭 | Boolean | true |
93
+ | remove-page | 关闭顶层页面方法 | Function | |
94
+ | router-view-name | router view名称 | String | `default` |
95
+ | view-tag | view tag标签 | Function/String | `div` |
96
+
97
+
98
+
99
+ ## 插槽
100
+
101
+ | 名称 | 说明 |
102
+ |---------|------------------|
103
+ | default | 内容 |
104
+
105
+
106
+
107
+ ### fox-card-navigator
108
+
109
+ 卡片导航组件,配合多标签页容器使用,具备缓存页面的能力。
110
+
111
+
112
+
113
+ #### 基础用法
114
+
115
+ ```
116
+ <script setup lang="ts">
117
+ const rootName = $ref('_tab_view')
118
+ </script>
119
+
120
+ <template>
121
+ <fox-card-navigator
122
+ :router-view-name="rootName"
123
+ :transition="true"
124
+ ></fox-card-navigator>
125
+ </template>
126
+
127
+ <style lang="scss">
128
+ </style>
129
+
130
+ ```
131
+
132
+ #### Props
133
+
134
+ | 字段 | 说明 | 类型 | 默认值 |
135
+ |------------------|----------------------------------------|---------|-----------|
136
+ | router-view-name | router view名称 | String | `default` |
137
+ | transition | 是否支持过渡动画 | Boolean | false |
138
+
139
+
140
+
141
+ ## 插槽
142
+
143
+ | 名称 | 说明 |
144
+ |---------|------------------|
145
+ | default | 内容 |
146
+
147
+
148
+ ### fox-swiper-navigator
149
+
150
+ swiper导航组件,配合tab标签使用(例如手机端的主界面),支持拖曳新打开新页面/切换页面
151
+
152
+ #### 基础用法
153
+
154
+ ```
155
+ <script lang="ts" setup>
156
+ import { onMounted, ref, computed } from 'vue'
157
+ import { usePageHelper } from '@/utils/custom'
158
+ import store from '@/store'
159
+ import tabs from './data'
160
+ const contentPadding = {
161
+ left: 0,
162
+ top: 0,
163
+ right: 0,
164
+ bottom: 0
165
+ }
166
+ // -------------- 导航设置 ---------------
167
+ // content width/height
168
+ const contentWidth = ref(0)
169
+ const contentHeight = ref(0)
170
+ // page ref
171
+ const pageRef = ref(null)
172
+ // root name
173
+ const rootName = ref('_tab_view')
174
+ // routes
175
+ const routes = computed(() => {
176
+ return tabs.map(tab => {
177
+ return {
178
+ path: tab.route
179
+ }
180
+ })
181
+ })
182
+ // active route path
183
+ const activeRoutePath = computed({
184
+ set: (newVal: string) => {
185
+ // 更新tab bar的index
186
+ index.value = routes.value.findIndex(r => {
187
+ return r.path === newVal
188
+ })
189
+ store.setCurrentRoutePath(newVal, rootName.value)
190
+ },
191
+ get: (): string => {
192
+ return store.getCurrentRoutePath(rootName.value) as string
193
+ }
194
+ })
195
+ // open page
196
+ const openPage = (route: any, index: number) => {
197
+ onTabChange(index)
198
+ }
199
+
200
+ // -------------tab bar 设置 ------------------
201
+ //当前tab索引
202
+ const index = ref(0)
203
+ // 获取page helper
204
+ const pageHelper = usePageHelper()
205
+ // tab change事件
206
+ const onTabChange = (index: any) => {
207
+ const tab = tabs[index]
208
+ // open页面
209
+ pageHelper.open(tab.route)
210
+ // 当前的route path到公共store中
211
+ store.setCurrentRoutePath(tab.route, rootName.value)
212
+ }
213
+ // content应用
214
+ const contentRef = ref(null)
215
+ // 加载后处理
216
+ onMounted(() => {
217
+ if (pageRef.value) {
218
+ const anyPage: any = pageRef.value
219
+ contentWidth.value = anyPage.getPageContentWidth()
220
+ if (contentWidth.value === 0) {
221
+ const anyContent: any = contentRef.value
222
+ contentWidth.value = anyContent.$el.offsetWidth
223
+ }
224
+ contentHeight.value = anyPage.getPageContentHeight()
225
+ }
226
+ // 当前选中tab index
227
+ let curIndex = index.value
228
+ // 获取之前保存的route path
229
+ let path = store.getCurrentRoutePath(rootName.value)
230
+ if (path) {
231
+ let i = tabs.findIndex(tab => {
232
+ return tab.route === path
233
+ })
234
+ curIndex = i !== -1 ? i : curIndex
235
+ // 更新tab的model
236
+ index.value = curIndex
237
+ }
238
+ // 触发页面跳转
239
+ onTabChange(curIndex)
240
+ })
241
+ </script>
242
+
243
+ <template>
244
+ <fox-page :content-padding="contentPadding" ref="pageRef">
245
+ <fox-footer>
246
+ <fox-tabbar v-model="index" @change="onTabChange">
247
+ <template v-for="tab in tabs" :key="tab.title">
248
+ <fox-tabbar-item :title="tab.title" :icon="tab.icon"></fox-tabbar-item>
249
+ </template>
250
+ </fox-tabbar>
251
+ </fox-footer>
252
+ <fox-content ref="contentRef">
253
+ <fox-swiper-navigator
254
+ v-model:activePath="activeRoutePath"
255
+ :router-view-name="rootName"
256
+ :routes="routes"
257
+ :open-page="openPage"
258
+ :transition="true"
259
+ :width="contentWidth"
260
+ :height="contentHeight"
261
+ ></fox-swiper-navigator>
262
+ </fox-content>
263
+ </fox-page>
264
+ </template>
265
+
266
+ <style lang="scss" scoped></style>
267
+
268
+ ```
269
+
270
+ #### Props
271
+
272
+ | 字段 | 说明 | 类型 | 默认值 |
273
+ |------------------|----------------------------------------|---------|-----------|
274
+ | open-page | 打开页面方法 | Function | |
275
+ | router-view-name | router view名称 | String | `default` |
276
+ | routes | 路由列表 | Route[] | |
277
+ | active-path | 激活路径 | String | |
278
+ | height | 导航容器高度 | Number | |
279
+ | width | 导航容器宽度 | Number | |
280
+ | drag | 是否支持拖曳 | Boolean | |
281
+ | swipe-duration | 滑动页面动画时间 | Number ||
282
+ | scroll-time | 切换页面动画时间 | Number | |
283
+
284
+
285
+
286
+ ## 插槽
287
+
288
+ | 名称 | 说明 |
289
+ |---------|------------------|
290
+ | default | 内容 |
@@ -0,0 +1,3 @@
1
+ "use strict";/*!
2
+ * @fox-js/navigation v3.0.0 Wed Jun 14 2023 18:34:17 GMT+0800 (中国标准时间)
3
+ */const v=require("vue"),I=v.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(e){return{__sfc:!0,props:e}}});function y(e,t,n,o,a,_,h,m){var r=typeof e=="function"?e.options:e;t&&(r.render=t,r.staticRenderFns=n,r._compiled=!0),o&&(r.functional=!0),_&&(r._scopeId="data-v-"+_);var i;if(h?(i=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__<"u"&&(l=__VUE_SSR_CONTEXT__),a&&a.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(h)},r._ssrRegister=i):a&&(i=m?function(){a.call(this,(r.functional?this.parent:this).$root.$options.shadowRoot)}:a),i)if(r.functional){r._injectStyles=i;var s=r.render;r.render=function(u,d){return i.call(d),s(u,d)}}else{var c=r.beforeCreate;r.beforeCreate=c?[].concat(c,i):[i]}return{exports:e,options:r}}var S=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("fox-router-view",{staticClass:"fox-card-navigator",attrs:{"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:o.props.transition,multi:!0,name:o.props.routerViewName}})},W=[],R=y(I,S,W,!1,null,null,null,null);const N=R.exports,V=Object.freeze(Object.defineProperty({__proto__:null,default:N},Symbol.toStringTag,{value:"Module"})),z=v.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(e){return{__sfc:!0,props:e}}});var A=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("transition",{attrs:{name:"fox-default-navigator__trans"}},[n("fox-router-view",{attrs:{transition:!1,multi:!1,name:o.props.routerViewName}})],1)},B=[],X=y(z,A,B,!1,null,null,null,null);const U=X.exports,j=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"})),L=10;function F(e,t){return e>t&&e>L?"horizontal":t>e&&t>L?"vertical":""}function P(){const e=v.ref(0),t=v.ref(0),n=v.ref(0),o=v.ref(0),a=v.ref(0),_=v.ref(0),h=v.ref(0),m=v.ref(0),r=v.ref(0),i=v.ref(0),s=v.ref(""),c=()=>s.value==="vertical",l=()=>s.value==="horizontal",u=()=>{h.value=0,m.value=0,r.value=0,i.value=0,s.value="",n.value=0};return{move:f=>{const p=f.touches[0];h.value=p.clientX-e.value,m.value=p.clientY-t.value,a.value=p.clientX,_.value=p.clientY,r.value=Math.abs(h.value),i.value=Math.abs(m.value),o.value=Date.now()-n.value,s.value||(s.value=F(r.value,i.value))},start:f=>{u(),e.value=f.touches[0].clientX,t.value=f.touches[0].clientY,n.value=Date.now()},reset:u,startX:e,startY:t,startTime:n,duration:o,moveX:a,moveY:_,deltaX:h,deltaY:m,offsetX:r,offsetY:i,direction:s,isVertical:c,isHorizontal:l}}function Y(e){return e===window}const q=e=>{const t=v.unref(e);if(Y(t)){const n=t.innerWidth,o=t.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return t&&t.getBoundingClientRect?t.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},H=15,k=300,G=200;function J(e){e.stopPropagation()}function K(e,t){(typeof e.cancelable!="boolean"||e.cancelable)&&e.preventDefault(),t&&J(e)}function Q(e,t){return e=Math.abs(e/t)/.003*(e<0?-1:1),e}function D(e,t=0,n,o=G){n==="end"?e.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:e.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",e.style.transform=`translate3d(${t}px, 0, 0)`}const E=new WeakMap;function Z(e,t,n,o=1e3){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},_=e.previousSibling,h=P(),m=(l,u,d,g)=>{let f=u+a.startDistance;if(d==="end"){const p=q(l);let x=p.width/3;f<x?f=0:f=p.width;let w=!1;g&&g>0&&(w=!0,a.transitionEndTrigger=()=>{a.moving=!1,n&&l.classList.remove(n),f>0&&typeof t=="function"&&t()}),D(l,f,"end",g),_&&D(_,0,"",0),!w&&f>0&&typeof t=="function"&&t()}else f<0&&(f=0),D(l,f,"",0)},r=()=>{e.style.transform="",e.style.transition="",_&&(_.style.transform="",_.style.transition=""),a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},i=l=>{if(h.start(l),a.moving){const u=e,{transform:d}=window.getComputedStyle(u);a.scrollDistance=+d.slice(7,d.length-1).split(", ")[5]}n&&e.classList.add(n),a.startDistance=a.scrollDistance,a.transitionEndTrigger=null,a.moving=!0},s=l=>{a.moving=!0,h.move(l),h.isHorizontal()&&K(l,!0),m(e,h.deltaX.value,"",0)},c=()=>{const l=h.deltaX.value;if(l==0){n&&e.classList.remove(n);return}const u=h.duration.value;if(u<k&&Math.abs(l)>H){const g=Q(l,u);m(e,g,"end",o)}else m(e,l,"end",o)};e.addEventListener("transitionend",r),e.addEventListener("touchstart",i),e.addEventListener("touchmove",s),e.addEventListener("touchend",c),e.addEventListener("touchcancel",c),E.set(e,{state:a,transitionend:r,touchstart:i,touchmove:s,touchend:c,touchcancel:c})}function tt(e){const t=E.get(e);t&&(E.delete(e),e.addEventListener("transitionend",t.transitionend),e.addEventListener("touchstart",t.touchstart),e.addEventListener("touchmove",t.touchmove),e.addEventListener("touchend",t.touchend),e.addEventListener("touchcancel",t.touchcancel))}const et=v.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:null,routerViewName:null,viewTag:{default:"div"},transition:{type:[Object,Boolean],default:!0}},setup(e){const t=e;function n(i){return(i.params&&i.params.animationType)??"slide"}return{__sfc:!0,props:t,getAnimationType:n,onBeforeEnter:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"show":"enter",g=`fox-root-navigator__${u}-${d}-from`,f=`fox-root-navigator__${u}-${d}-active`;i.classList.add(g),i.classList.add(f)}},onEnter:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"show":"enter",g=`fox-root-navigator__${u}-${d}-from`,f=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.add(f)}},onAfterEnter:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u!=="pop"||!s){const d=s?"show":"enter",g=`fox-root-navigator__${u}-${d}-active`,f=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.remove(f)}}t.dragRemove&&!s&&c.opsType===3&&Z(i,t.removeViewPage,"fox-root-navigator__item-moving",1e3)},onBeforeLeave:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"hide":"leave",g=`fox-root-navigator__${u}-${d}-from`,f=`fox-root-navigator__${u}-${d}-active`;i.classList.add(g),i.classList.add(f)}},onLeave:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"hide":"leave",g=`fox-root-navigator__${u}-${d}-from`,f=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.add(f)}},onAfterLeave:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u!=="pop"||!s){const d=s?"hide":"leave",g=`fox-root-navigator__${u}-${d}-active`,f=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.remove(f)}}t.dragRemove&&!s&&tt(i)}}}});var nt=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("fox-router-view",{staticClass:"fox-root-navigator",attrs:{"view-class":"fox-root-navigator__item","before-enter":o.onBeforeEnter,enter:o.onEnter,"after-enter":o.onAfterEnter,"before-leave":o.onBeforeLeave,leave:o.onLeave,"after-leave":o.onAfterLeave,multi:!0,name:o.props.routerViewName,"view-tag":o.props.viewTag,transition:o.props.transition}})},ot=[],st=y(et,nt,ot,!1,null,null,null,null);const it=st.exports,at=Object.freeze(Object.defineProperty({__proto__:null,default:it},Symbol.toStringTag,{value:"Module"})),rt=v.defineComponent({__name:"swiper",props:{width:null,scrollDistance:null,scrollTime:null},setup(e){const t=e,n=v.computed(()=>({transform:`translate3d(${t.scrollDistance}px, 0, 0)`,width:`${t.width}`}));return{__sfc:!0,props:t,styles:n}}});var ct=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("div",{staticClass:"fox-swiper-navigator"},[n("div",{staticClass:"fox-swiper-navigator__inner",style:o.styles},[t._t("default")],2)])},lt=[],ut=y(rt,ct,lt,!1,null,null,null,null);const dt=ut.exports;let ft=0;function _t(){return++ft}const pt=15,vt=300,ht=200;function mt(e){e.stopPropagation()}function gt(e,t){(typeof e.cancelable!="boolean"||e.cancelable)&&e.preventDefault(),t&&mt(e)}function xt(e,t){return e=Math.abs(e/t)/.003*(e<0?-1:1),e}function b(e,t=0,n,o=ht){n==="end"?e.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:e.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",e.style.transform=`translate3d(${t}px, 0, 0)`}class wt{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(t,n,o,a){this.getStartDistance=t,this.openPage=n,this.isPageOpened=o,this.pageOpened=a}open(){const t=this.el,n=P(),o=(a,_,h,m)=>{let r=_+this.startDistance;const i=this.columnWidth/3;if(h==="end"){if(r==0){this.moving=!1;return}Math.abs(_)>i&&(_>0?r=this.startDistance+this.columnWidth:r=this.startDistance-this.columnWidth);let s=-r;s<0?s=0:s>this.width-this.columnWidth&&(s=this.width-this.columnWidth);const c=Math.floor(s/this.columnWidth);this.isPageOpened(c)||this.openPage(c),r=-c*this.columnWidth,m&&m>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(c)}),b(a,r,"end",m),this.scrollDistance=r}else{if(Math.abs(_)>i){let c=0;if(_>0?c=Math.abs(this.startDistance+this.columnWidth):c=Math.abs(this.startDistance-this.columnWidth),c>=0&&c<this.width){const l=Math.floor(c/this.columnWidth);this.isPageOpened(l)||this.openPage(l)}}let s=-r;s<this.min?s=this.min:s>this.max&&(s=this.max),b(a,-s,"",0)}};this.transitionend=()=>{t.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=a=>{this.moving||(n.start(a),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=a=>{n.move(a),n.isHorizontal()&&gt(a,!0),o(t,n.deltaX.value,"",0)},this.touchend=()=>{const a=n.deltaX.value;if(a==0)return;const _=n.duration.value;if(_<vt&&Math.abs(a)>pt){const m=xt(a,_);o(t,m,"end",this.swipeDuration)}else o(t,a,"end",this.swipeDuration)},t.addEventListener("transitionend",this.transitionend),t.addEventListener("touchstart",this.touchstart),t.addEventListener("touchmove",this.touchmove),t.addEventListener("touchend",this.touchend),t.addEventListener("touchcancel",this.touchend)}close(){const t=this.el;this.transitionend&&t.addEventListener("transitionend",this.transitionend),this.touchstart&&t.addEventListener("touchstart",this.touchstart),this.touchmove&&t.addEventListener("touchmove",this.touchmove),this.touchend&&t.addEventListener("touchend",this.touchend),this.touchcancel&&t.addEventListener("touchcancel",this.touchcancel),this.el=null}}function yt(e,t,n,o){return new wt(e,t,n,o)}const Tt=v.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(e,{emit:t}){const n=e,o=v.reactive({scrollDistance:0,index:-1,openedIndexList:[]}),a=()=>o.scrollDistance,_=p=>{if(o.openedIndexList.indexOf(p)===-1){o.openedIndexList.push(p);const x=n.routes[p];try{n.openViewPage(x,p)}catch(w){console.error(w)}}},h=p=>o.openedIndexList.indexOf(p)!==-1,m=p=>{o.index=p,o.scrollDistance=-o.index*n.width;const x=n.routes[p];t("update:activePath",x.path)},r=yt(a,_,h,m);v.onMounted(()=>{const p=u();r.el=p,r.open()}),v.onUnmounted(()=>{r.close()}),v.watchEffect(()=>{const p=n.activePath;o.index=n.routes.findIndex(O=>O.path===p);const x=n.width;o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-x*o.index);const w=x*n.routes.length,T=-x/3,$=x*(n.routes.length-1)+x/3;r.columnWidth=x,r.width=w,r.min=T,r.max=$,r.swipeDuration=n.swipeDuration});const i=()=>dt,s=`fox-swiper-navigator-${_t()}`,c=v.computed(()=>({width:`${n.width}px`,height:`${n.height}px`}));let l=null;function u(){return l||(l=document.querySelector(`.${s}>.fox-swiper-navigator__inner`),l)}const d=v.computed(()=>`${n.width*n.routes.length}px`);return{__sfc:!0,props:n,state:o,emit:t,getStartDistance:a,openViewPage:_,isPageOpened:h,pageOpened:m,pageDragger:r,tagProvider:i,uniqueClass:s,styles:c,scrollEl:l,getScrollerEl:u,scrollerWidth:d,tagProps:()=>({scrollDistance:o.scrollDistance,scrollTime:n.scrollTime,width:d.value}),viewTagData:(p,x)=>({style:{left:`${n.routes.findIndex(T=>{const $=p.path??p.name??"";return T.path==$})*n.width}px`,width:`${n.width}px`}})}}});var $t=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("fox-router-view",{class:o.uniqueClass,style:o.styles,attrs:{"view-class":"fox-swiper-navigator__item",tag:o.tagProvider,"tag-props":o.tagProps,"view-tag-data":o.viewTagData,multi:!0,name:o.props.routerViewName,transition:o.props.transition}})},Dt=[],Et=y(Tt,$t,Dt,!1,null,null,null,null);const Lt=Et.exports,bt=Object.freeze(Object.defineProperty({__proto__:null,default:Lt},Symbol.toStringTag,{value:"Module"}));let Mt="fox-";const Pt=[],M=Object.assign({"/src/components/card-navigator/index.vue":V,"/src/components/default-navigator/index.vue":j,"/src/components/root-navigator/index.vue":at,"/src/components/swiper-navigator/index.vue":bt}),C=[];for(const e in M){let t=/src\/components\/(.*)\/index.vue/.exec(e)[1];Pt.indexOf(t)===-1&&C.push({name:t,component:M[e].default})}const Ct={install(e){C.forEach(t=>{e.component(`${Mt}${t.name}`,t.component)})}};module.exports=Ct;
@@ -0,0 +1,520 @@
1
+ import { defineComponent as y, ref as x, unref as W, computed as L, reactive as R, onMounted as N, onUnmounted as V, watchEffect as z } from "vue";
2
+ /*!
3
+ * @fox-js/navigation v3.0.0 Wed Jun 14 2023 18:34:17 GMT+0800 (中国标准时间)
4
+ */
5
+ const A = /* @__PURE__ */ y({
6
+ __name: "index",
7
+ props: {
8
+ routerViewName: null,
9
+ transition: { type: [Object, Boolean], default: !0 }
10
+ },
11
+ setup(e) {
12
+ return { __sfc: !0, props: e };
13
+ }
14
+ });
15
+ function T(e, t, n, o, a, _, p, h) {
16
+ var r = typeof e == "function" ? e.options : e;
17
+ t && (r.render = t, r.staticRenderFns = n, r._compiled = !0), o && (r.functional = !0), _ && (r._scopeId = "data-v-" + _);
18
+ var i;
19
+ if (p ? (i = function(l) {
20
+ l = l || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !l && typeof __VUE_SSR_CONTEXT__ < "u" && (l = __VUE_SSR_CONTEXT__), a && a.call(this, l), l && l._registeredComponents && l._registeredComponents.add(p);
21
+ }, r._ssrRegister = i) : a && (i = h ? function() {
22
+ a.call(
23
+ this,
24
+ (r.functional ? this.parent : this).$root.$options.shadowRoot
25
+ );
26
+ } : a), i)
27
+ if (r.functional) {
28
+ r._injectStyles = i;
29
+ var s = r.render;
30
+ r.render = function(u, d) {
31
+ return i.call(d), s(u, d);
32
+ };
33
+ } else {
34
+ var c = r.beforeCreate;
35
+ r.beforeCreate = c ? [].concat(c, i) : [i];
36
+ }
37
+ return {
38
+ exports: e,
39
+ options: r
40
+ };
41
+ }
42
+ var B = function() {
43
+ var t = this, n = t._self._c, o = t._self._setupProxy;
44
+ return n("fox-router-view", { staticClass: "fox-card-navigator", attrs: { "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: o.props.transition, multi: !0, name: o.props.routerViewName } });
45
+ }, X = [], U = /* @__PURE__ */ T(
46
+ A,
47
+ B,
48
+ X,
49
+ !1,
50
+ null,
51
+ null,
52
+ null,
53
+ null
54
+ );
55
+ const j = U.exports, F = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
+ __proto__: null,
57
+ default: j
58
+ }, Symbol.toStringTag, { value: "Module" })), Y = /* @__PURE__ */ y({
59
+ __name: "index",
60
+ props: {
61
+ routerViewName: null,
62
+ transition: { type: [Object, Boolean], default: !0 }
63
+ },
64
+ setup(e) {
65
+ return { __sfc: !0, props: e };
66
+ }
67
+ });
68
+ var q = function() {
69
+ var t = this, n = t._self._c, o = t._self._setupProxy;
70
+ return n("transition", { attrs: { name: "fox-default-navigator__trans" } }, [n("fox-router-view", { attrs: { transition: !1, multi: !1, name: o.props.routerViewName } })], 1);
71
+ }, H = [], k = /* @__PURE__ */ T(
72
+ Y,
73
+ q,
74
+ H,
75
+ !1,
76
+ null,
77
+ null,
78
+ null,
79
+ null
80
+ );
81
+ const G = k.exports, J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
82
+ __proto__: null,
83
+ default: G
84
+ }, Symbol.toStringTag, { value: "Module" })), M = 10;
85
+ function K(e, t) {
86
+ return e > t && e > M ? "horizontal" : t > e && t > M ? "vertical" : "";
87
+ }
88
+ function C() {
89
+ const e = x(0), t = x(0), n = x(0), o = x(0), a = x(0), _ = x(0), p = x(0), h = x(0), r = x(0), i = x(0), s = x(""), c = () => s.value === "vertical", l = () => s.value === "horizontal", u = () => {
90
+ p.value = 0, h.value = 0, r.value = 0, i.value = 0, s.value = "", n.value = 0;
91
+ };
92
+ return {
93
+ move: (f) => {
94
+ const v = f.touches[0];
95
+ p.value = v.clientX - e.value, h.value = v.clientY - t.value, a.value = v.clientX, _.value = v.clientY, r.value = Math.abs(p.value), i.value = Math.abs(h.value), o.value = Date.now() - n.value, s.value || (s.value = K(r.value, i.value));
96
+ },
97
+ start: (f) => {
98
+ u(), e.value = f.touches[0].clientX, t.value = f.touches[0].clientY, n.value = Date.now();
99
+ },
100
+ reset: u,
101
+ startX: e,
102
+ startY: t,
103
+ startTime: n,
104
+ duration: o,
105
+ moveX: a,
106
+ moveY: _,
107
+ deltaX: p,
108
+ deltaY: h,
109
+ offsetX: r,
110
+ offsetY: i,
111
+ direction: s,
112
+ isVertical: c,
113
+ isHorizontal: l
114
+ };
115
+ }
116
+ function Q(e) {
117
+ return e === window;
118
+ }
119
+ const Z = (e) => {
120
+ const t = W(e);
121
+ if (Q(t)) {
122
+ const n = t.innerWidth, o = t.innerHeight;
123
+ return {
124
+ top: 0,
125
+ left: 0,
126
+ right: n,
127
+ bottom: o,
128
+ width: n,
129
+ height: o
130
+ };
131
+ }
132
+ return t && t.getBoundingClientRect ? t.getBoundingClientRect() : {
133
+ top: 0,
134
+ left: 0,
135
+ right: 0,
136
+ bottom: 0,
137
+ width: 0,
138
+ height: 0
139
+ };
140
+ }, tt = 15, et = 300, nt = 200;
141
+ function ot(e) {
142
+ e.stopPropagation();
143
+ }
144
+ function st(e, t) {
145
+ (typeof e.cancelable != "boolean" || e.cancelable) && e.preventDefault(), t && ot(e);
146
+ }
147
+ function it(e, t) {
148
+ return e = Math.abs(e / t) / 3e-3 * (e < 0 ? -1 : 1), e;
149
+ }
150
+ function E(e, t = 0, n, o = nt) {
151
+ n === "end" ? e.style.transition = `transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)` : e.style.transition = "transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)", e.style.transform = `translate3d(${t}px, 0, 0)`;
152
+ }
153
+ const b = /* @__PURE__ */ new WeakMap();
154
+ function at(e, t, n, o = 1e3) {
155
+ const a = {
156
+ active: !0,
157
+ startDistance: 0,
158
+ scrollDistance: 0,
159
+ scrollTime: 0,
160
+ moving: !1,
161
+ transitionEndTrigger: null
162
+ }, _ = e.previousSibling, p = C(), h = (l, u, d, m) => {
163
+ let f = u + a.startDistance;
164
+ if (d === "end") {
165
+ const v = Z(l);
166
+ let g = v.width / 3;
167
+ f < g ? f = 0 : f = v.width;
168
+ let w = !1;
169
+ m && m > 0 && (w = !0, a.transitionEndTrigger = () => {
170
+ a.moving = !1, n && l.classList.remove(n), f > 0 && typeof t == "function" && t();
171
+ }), E(l, f, "end", m), _ && E(_, 0, "", 0), !w && f > 0 && typeof t == "function" && t();
172
+ } else
173
+ f < 0 && (f = 0), E(l, f, "", 0);
174
+ }, r = () => {
175
+ e.style.transform = "", e.style.transition = "", _ && (_.style.transform = "", _.style.transition = ""), a.transitionEndTrigger && (a.transitionEndTrigger(), a.transitionEndTrigger = null);
176
+ }, i = (l) => {
177
+ if (p.start(l), a.moving) {
178
+ const u = e, { transform: d } = window.getComputedStyle(u);
179
+ a.scrollDistance = +d.slice(7, d.length - 1).split(", ")[5];
180
+ }
181
+ n && e.classList.add(n), a.startDistance = a.scrollDistance, a.transitionEndTrigger = null, a.moving = !0;
182
+ }, s = (l) => {
183
+ a.moving = !0, p.move(l), p.isHorizontal() && st(l, !0), h(e, p.deltaX.value, "", 0);
184
+ }, c = () => {
185
+ const l = p.deltaX.value;
186
+ if (l == 0) {
187
+ n && e.classList.remove(n);
188
+ return;
189
+ }
190
+ const u = p.duration.value;
191
+ if (u < et && Math.abs(l) > tt) {
192
+ const m = it(l, u);
193
+ h(e, m, "end", o);
194
+ } else
195
+ h(e, l, "end", o);
196
+ };
197
+ e.addEventListener("transitionend", r), e.addEventListener("touchstart", i), e.addEventListener("touchmove", s), e.addEventListener("touchend", c), e.addEventListener("touchcancel", c), b.set(e, {
198
+ state: a,
199
+ transitionend: r,
200
+ touchstart: i,
201
+ touchmove: s,
202
+ touchend: c,
203
+ touchcancel: c
204
+ });
205
+ }
206
+ function rt(e) {
207
+ const t = b.get(e);
208
+ t && (b.delete(e), e.addEventListener("transitionend", t.transitionend), e.addEventListener("touchstart", t.touchstart), e.addEventListener("touchmove", t.touchmove), e.addEventListener("touchend", t.touchend), e.addEventListener("touchcancel", t.touchcancel));
209
+ }
210
+ const ct = /* @__PURE__ */ y({
211
+ __name: "index",
212
+ props: {
213
+ dragRemove: { type: Boolean, default: !0 },
214
+ removeViewPage: null,
215
+ routerViewName: null,
216
+ viewTag: { default: "div" },
217
+ transition: { type: [Object, Boolean], default: !0 }
218
+ },
219
+ setup(e) {
220
+ const t = e;
221
+ function n(i) {
222
+ return (i.params && i.params.animationType) ?? "slide";
223
+ }
224
+ return { __sfc: !0, props: t, getAnimationType: n, onBeforeEnter: (i, s, c, l) => {
225
+ if (c.opsType === 3 || s) {
226
+ const u = n(c);
227
+ if (u === "pop" && s)
228
+ return;
229
+ const d = s ? "show" : "enter", m = `fox-root-navigator__${u}-${d}-from`, f = `fox-root-navigator__${u}-${d}-active`;
230
+ i.classList.add(m), i.classList.add(f);
231
+ }
232
+ }, onEnter: (i, s, c, l) => {
233
+ if (c.opsType === 3 || s) {
234
+ const u = n(c);
235
+ if (u === "pop" && s)
236
+ return;
237
+ const d = s ? "show" : "enter", m = `fox-root-navigator__${u}-${d}-from`, f = `fox-root-navigator__${u}-${d}-to`;
238
+ i.classList.remove(m), i.classList.add(f);
239
+ }
240
+ }, onAfterEnter: (i, s, c, l) => {
241
+ if (c.opsType === 3 || s) {
242
+ const u = n(c);
243
+ if (u !== "pop" || !s) {
244
+ const d = s ? "show" : "enter", m = `fox-root-navigator__${u}-${d}-active`, f = `fox-root-navigator__${u}-${d}-to`;
245
+ i.classList.remove(m), i.classList.remove(f);
246
+ }
247
+ }
248
+ t.dragRemove && !s && c.opsType === 3 && at(i, t.removeViewPage, "fox-root-navigator__item-moving", 1e3);
249
+ }, onBeforeLeave: (i, s, c, l) => {
250
+ if (c.opsType === 3 || s) {
251
+ const u = n(c);
252
+ if (u === "pop" && s)
253
+ return;
254
+ const d = s ? "hide" : "leave", m = `fox-root-navigator__${u}-${d}-from`, f = `fox-root-navigator__${u}-${d}-active`;
255
+ i.classList.add(m), i.classList.add(f);
256
+ }
257
+ }, onLeave: (i, s, c, l) => {
258
+ if (c.opsType === 3 || s) {
259
+ const u = n(c);
260
+ if (u === "pop" && s)
261
+ return;
262
+ const d = s ? "hide" : "leave", m = `fox-root-navigator__${u}-${d}-from`, f = `fox-root-navigator__${u}-${d}-to`;
263
+ i.classList.remove(m), i.classList.add(f);
264
+ }
265
+ }, onAfterLeave: (i, s, c, l) => {
266
+ if (c.opsType === 3 || s) {
267
+ const u = n(c);
268
+ if (u !== "pop" || !s) {
269
+ const d = s ? "hide" : "leave", m = `fox-root-navigator__${u}-${d}-active`, f = `fox-root-navigator__${u}-${d}-to`;
270
+ i.classList.remove(m), i.classList.remove(f);
271
+ }
272
+ }
273
+ t.dragRemove && !s && rt(i);
274
+ } };
275
+ }
276
+ });
277
+ var lt = function() {
278
+ var t = this, n = t._self._c, o = t._self._setupProxy;
279
+ return n("fox-router-view", { staticClass: "fox-root-navigator", attrs: { "view-class": "fox-root-navigator__item", "before-enter": o.onBeforeEnter, enter: o.onEnter, "after-enter": o.onAfterEnter, "before-leave": o.onBeforeLeave, leave: o.onLeave, "after-leave": o.onAfterLeave, multi: !0, name: o.props.routerViewName, "view-tag": o.props.viewTag, transition: o.props.transition } });
280
+ }, ut = [], dt = /* @__PURE__ */ T(
281
+ ct,
282
+ lt,
283
+ ut,
284
+ !1,
285
+ null,
286
+ null,
287
+ null,
288
+ null
289
+ );
290
+ const ft = dt.exports, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
291
+ __proto__: null,
292
+ default: ft
293
+ }, Symbol.toStringTag, { value: "Module" })), vt = /* @__PURE__ */ y({
294
+ __name: "swiper",
295
+ props: {
296
+ width: null,
297
+ scrollDistance: null,
298
+ scrollTime: null
299
+ },
300
+ setup(e) {
301
+ const t = e, n = L(() => ({
302
+ transform: `translate3d(${t.scrollDistance}px, 0, 0)`,
303
+ width: `${t.width}`
304
+ }));
305
+ return { __sfc: !0, props: t, styles: n };
306
+ }
307
+ });
308
+ var pt = function() {
309
+ var t = this, n = t._self._c, o = t._self._setupProxy;
310
+ return n("div", { staticClass: "fox-swiper-navigator" }, [n("div", { staticClass: "fox-swiper-navigator__inner", style: o.styles }, [t._t("default")], 2)]);
311
+ }, ht = [], mt = /* @__PURE__ */ T(
312
+ vt,
313
+ pt,
314
+ ht,
315
+ !1,
316
+ null,
317
+ null,
318
+ null,
319
+ null
320
+ );
321
+ const gt = mt.exports;
322
+ let xt = 0;
323
+ function wt() {
324
+ return ++xt;
325
+ }
326
+ const yt = 15, Tt = 300, $t = 200;
327
+ function Dt(e) {
328
+ e.stopPropagation();
329
+ }
330
+ function Et(e, t) {
331
+ (typeof e.cancelable != "boolean" || e.cancelable) && e.preventDefault(), t && Dt(e);
332
+ }
333
+ function Lt(e, t) {
334
+ return e = Math.abs(e / t) / 3e-3 * (e < 0 ? -1 : 1), e;
335
+ }
336
+ function P(e, t = 0, n, o = $t) {
337
+ n === "end" ? e.style.transition = `transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)` : e.style.transition = "transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)", e.style.transform = `translate3d(${t}px, 0, 0)`;
338
+ }
339
+ class bt {
340
+ width = 0;
341
+ columnWidth = 0;
342
+ max = 0;
343
+ min = 0;
344
+ el = null;
345
+ swipeDuration = 360;
346
+ transitionEndTrigger = null;
347
+ moving = !1;
348
+ startDistance = 0;
349
+ scrollDistance = 0;
350
+ getStartDistance;
351
+ openPage;
352
+ isPageOpened;
353
+ pageOpened;
354
+ transitionend = null;
355
+ touchstart = null;
356
+ touchmove = null;
357
+ touchend = null;
358
+ touchcancel = null;
359
+ constructor(t, n, o, a) {
360
+ this.getStartDistance = t, this.openPage = n, this.isPageOpened = o, this.pageOpened = a;
361
+ }
362
+ open() {
363
+ const t = this.el, n = C(), o = (a, _, p, h) => {
364
+ let r = _ + this.startDistance;
365
+ const i = this.columnWidth / 3;
366
+ if (p === "end") {
367
+ if (r == 0) {
368
+ this.moving = !1;
369
+ return;
370
+ }
371
+ Math.abs(_) > i && (_ > 0 ? r = this.startDistance + this.columnWidth : r = this.startDistance - this.columnWidth);
372
+ let s = -r;
373
+ s < 0 ? s = 0 : s > this.width - this.columnWidth && (s = this.width - this.columnWidth);
374
+ const c = Math.floor(s / this.columnWidth);
375
+ this.isPageOpened(c) || this.openPage(c), r = -c * this.columnWidth, h && h > 0 && (this.transitionEndTrigger = () => {
376
+ this.moving = !1, this.pageOpened(c);
377
+ }), P(a, r, "end", h), this.scrollDistance = r;
378
+ } else {
379
+ if (Math.abs(_) > i) {
380
+ let c = 0;
381
+ if (_ > 0 ? c = Math.abs(this.startDistance + this.columnWidth) : c = Math.abs(this.startDistance - this.columnWidth), c >= 0 && c < this.width) {
382
+ const l = Math.floor(c / this.columnWidth);
383
+ this.isPageOpened(l) || this.openPage(l);
384
+ }
385
+ }
386
+ let s = -r;
387
+ s < this.min ? s = this.min : s > this.max && (s = this.max), P(a, -s, "", 0);
388
+ }
389
+ };
390
+ this.transitionend = () => {
391
+ t.style.transition = "", this.transitionEndTrigger && (this.transitionEndTrigger(), this.transitionEndTrigger = null);
392
+ }, this.touchstart = (a) => {
393
+ this.moving || (n.start(a), this.startDistance = this.getStartDistance(), this.transitionEndTrigger = null, this.moving = !0);
394
+ }, this.touchmove = (a) => {
395
+ n.move(a), n.isHorizontal() && Et(a, !0), o(t, n.deltaX.value, "", 0);
396
+ }, this.touchend = () => {
397
+ const a = n.deltaX.value;
398
+ if (a == 0)
399
+ return;
400
+ const _ = n.duration.value;
401
+ if (_ < Tt && Math.abs(a) > yt) {
402
+ const h = Lt(a, _);
403
+ o(t, h, "end", this.swipeDuration);
404
+ } else
405
+ o(t, a, "end", this.swipeDuration);
406
+ }, t.addEventListener("transitionend", this.transitionend), t.addEventListener("touchstart", this.touchstart), t.addEventListener("touchmove", this.touchmove), t.addEventListener("touchend", this.touchend), t.addEventListener("touchcancel", this.touchend);
407
+ }
408
+ close() {
409
+ const t = this.el;
410
+ this.transitionend && t.addEventListener("transitionend", this.transitionend), this.touchstart && t.addEventListener("touchstart", this.touchstart), this.touchmove && t.addEventListener("touchmove", this.touchmove), this.touchend && t.addEventListener("touchend", this.touchend), this.touchcancel && t.addEventListener("touchcancel", this.touchcancel), this.el = null;
411
+ }
412
+ }
413
+ function Mt(e, t, n, o) {
414
+ return new bt(e, t, n, o);
415
+ }
416
+ const Pt = /* @__PURE__ */ y({
417
+ __name: "index",
418
+ props: {
419
+ activePath: null,
420
+ routes: null,
421
+ height: null,
422
+ width: null,
423
+ drag: { type: Boolean, default: !0 },
424
+ openViewPage: null,
425
+ routerViewName: null,
426
+ transition: { type: [Object, Boolean], default: !0 },
427
+ swipeDuration: { default: 360 },
428
+ scrollTime: { default: 0 }
429
+ },
430
+ emits: ["update:activePath"],
431
+ setup(e, { emit: t }) {
432
+ const n = e, o = R({
433
+ scrollDistance: 0,
434
+ index: -1,
435
+ openedIndexList: []
436
+ }), a = () => o.scrollDistance, _ = (v) => {
437
+ if (o.openedIndexList.indexOf(v) === -1) {
438
+ o.openedIndexList.push(v);
439
+ const g = n.routes[v];
440
+ try {
441
+ n.openViewPage(g, v);
442
+ } catch (w) {
443
+ console.error(w);
444
+ }
445
+ }
446
+ }, p = (v) => o.openedIndexList.indexOf(v) !== -1, h = (v) => {
447
+ o.index = v, o.scrollDistance = -o.index * n.width;
448
+ const g = n.routes[v];
449
+ t("update:activePath", g.path);
450
+ }, r = Mt(a, _, p, h);
451
+ N(() => {
452
+ const v = u();
453
+ r.el = v, r.open();
454
+ }), V(() => {
455
+ r.close();
456
+ }), z(() => {
457
+ const v = n.activePath;
458
+ o.index = n.routes.findIndex((S) => S.path === v);
459
+ const g = n.width;
460
+ o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -g * o.index);
461
+ const w = g * n.routes.length, $ = -g / 3, D = g * (n.routes.length - 1) + g / 3;
462
+ r.columnWidth = g, r.width = w, r.min = $, r.max = D, r.swipeDuration = n.swipeDuration;
463
+ });
464
+ const i = () => gt, s = `fox-swiper-navigator-${wt()}`, c = L(() => ({ width: `${n.width}px`, height: `${n.height}px` }));
465
+ let l = null;
466
+ function u() {
467
+ return l || (l = document.querySelector(`.${s}>.fox-swiper-navigator__inner`), l);
468
+ }
469
+ const d = L(() => `${n.width * n.routes.length}px`);
470
+ return { __sfc: !0, props: n, state: o, emit: t, getStartDistance: a, openViewPage: _, isPageOpened: p, pageOpened: h, pageDragger: r, tagProvider: i, uniqueClass: s, styles: c, scrollEl: l, getScrollerEl: u, scrollerWidth: d, tagProps: () => ({
471
+ scrollDistance: o.scrollDistance,
472
+ scrollTime: n.scrollTime,
473
+ width: d.value
474
+ }), viewTagData: (v, g) => ({
475
+ style: {
476
+ left: `${n.routes.findIndex(($) => {
477
+ const D = v.path ?? v.name ?? "";
478
+ return $.path == D;
479
+ }) * n.width}px`,
480
+ width: `${n.width}px`
481
+ }
482
+ }) };
483
+ }
484
+ });
485
+ var Ot = function() {
486
+ var t = this, n = t._self._c, o = t._self._setupProxy;
487
+ return n("fox-router-view", { class: o.uniqueClass, style: o.styles, attrs: { "view-class": "fox-swiper-navigator__item", tag: o.tagProvider, "tag-props": o.tagProps, "view-tag-data": o.viewTagData, multi: !0, name: o.props.routerViewName, transition: o.props.transition } });
488
+ }, Ct = [], It = /* @__PURE__ */ T(
489
+ Pt,
490
+ Ot,
491
+ Ct,
492
+ !1,
493
+ null,
494
+ null,
495
+ null,
496
+ null
497
+ );
498
+ const St = It.exports, Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
499
+ __proto__: null,
500
+ default: St
501
+ }, Symbol.toStringTag, { value: "Module" }));
502
+ let Rt = "fox-";
503
+ const Nt = [], O = /* @__PURE__ */ Object.assign({ "/src/components/card-navigator/index.vue": F, "/src/components/default-navigator/index.vue": J, "/src/components/root-navigator/index.vue": _t, "/src/components/swiper-navigator/index.vue": Wt }), I = [];
504
+ for (const e in O) {
505
+ let t = /src\/components\/(.*)\/index.vue/.exec(e)[1];
506
+ Nt.indexOf(t) === -1 && I.push({
507
+ name: t,
508
+ component: O[e].default
509
+ });
510
+ }
511
+ const zt = {
512
+ install(e) {
513
+ I.forEach((t) => {
514
+ e.component(`${Rt}${t.name}`, t.component);
515
+ });
516
+ }
517
+ };
518
+ export {
519
+ zt as default
520
+ };
@@ -0,0 +1,3 @@
1
+ (function(f,y){typeof exports=="object"&&typeof module<"u"?module.exports=y(require("vue")):typeof define=="function"&&define.amd?define(["vue"],y):(f=typeof globalThis<"u"?globalThis:f||self,f.navigation=y(f.Vue))})(this,function(f){"use strict";/*!
2
+ * @fox-js/navigation v3.0.0 Wed Jun 14 2023 18:34:17 GMT+0800 (中国标准时间)
3
+ */const y=f.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(e){return{__sfc:!0,props:e}}}),Ct="";function T(e,t,n,o,a,p,v,m){var r=typeof e=="function"?e.options:e;t&&(r.render=t,r.staticRenderFns=n,r._compiled=!0),o&&(r.functional=!0),p&&(r._scopeId="data-v-"+p);var i;if(v?(i=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__<"u"&&(l=__VUE_SSR_CONTEXT__),a&&a.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(v)},r._ssrRegister=i):a&&(i=m?function(){a.call(this,(r.functional?this.parent:this).$root.$options.shadowRoot)}:a),i)if(r.functional){r._injectStyles=i;var s=r.render;r.render=function(u,d){return i.call(d),s(u,d)}}else{var c=r.beforeCreate;r.beforeCreate=c?[].concat(c,i):[i]}return{exports:e,options:r}}var I=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("fox-router-view",{staticClass:"fox-card-navigator",attrs:{"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:o.props.transition,multi:!0,name:o.props.routerViewName}})},S=[],W=T(y,I,S,!1,null,null,null,null);const R=W.exports,V=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"})),N=f.defineComponent({__name:"index",props:{routerViewName:null,transition:{type:[Object,Boolean],default:!0}},setup(e){return{__sfc:!0,props:e}}}),Ot="";var z=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("transition",{attrs:{name:"fox-default-navigator__trans"}},[n("fox-router-view",{attrs:{transition:!1,multi:!1,name:o.props.routerViewName}})],1)},A=[],B=T(N,z,A,!1,null,null,null,null);const X=B.exports,j=Object.freeze(Object.defineProperty({__proto__:null,default:X},Symbol.toStringTag,{value:"Module"})),b=10;function U(e,t){return e>t&&e>b?"horizontal":t>e&&t>b?"vertical":""}function M(){const e=f.ref(0),t=f.ref(0),n=f.ref(0),o=f.ref(0),a=f.ref(0),p=f.ref(0),v=f.ref(0),m=f.ref(0),r=f.ref(0),i=f.ref(0),s=f.ref(""),c=()=>s.value==="vertical",l=()=>s.value==="horizontal",u=()=>{v.value=0,m.value=0,r.value=0,i.value=0,s.value="",n.value=0};return{move:_=>{const h=_.touches[0];v.value=h.clientX-e.value,m.value=h.clientY-t.value,a.value=h.clientX,p.value=h.clientY,r.value=Math.abs(v.value),i.value=Math.abs(m.value),o.value=Date.now()-n.value,s.value||(s.value=U(r.value,i.value))},start:_=>{u(),e.value=_.touches[0].clientX,t.value=_.touches[0].clientY,n.value=Date.now()},reset:u,startX:e,startY:t,startTime:n,duration:o,moveX:a,moveY:p,deltaX:v,deltaY:m,offsetX:r,offsetY:i,direction:s,isVertical:c,isHorizontal:l}}function F(e){return e===window}const Y=e=>{const t=f.unref(e);if(F(t)){const n=t.innerWidth,o=t.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}return t&&t.getBoundingClientRect?t.getBoundingClientRect():{top:0,left:0,right:0,bottom:0,width:0,height:0}},q=15,H=300,k=200;function G(e){e.stopPropagation()}function J(e,t){(typeof e.cancelable!="boolean"||e.cancelable)&&e.preventDefault(),t&&G(e)}function K(e,t){return e=Math.abs(e/t)/.003*(e<0?-1:1),e}function $(e,t=0,n,o=k){n==="end"?e.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:e.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",e.style.transform=`translate3d(${t}px, 0, 0)`}const D=new WeakMap;function Q(e,t,n,o=1e3){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},p=e.previousSibling,v=M(),m=(l,u,d,g)=>{let _=u+a.startDistance;if(d==="end"){const h=Y(l);let x=h.width/3;_<x?_=0:_=h.width;let w=!1;g&&g>0&&(w=!0,a.transitionEndTrigger=()=>{a.moving=!1,n&&l.classList.remove(n),_>0&&typeof t=="function"&&t()}),$(l,_,"end",g),p&&$(p,0,"",0),!w&&_>0&&typeof t=="function"&&t()}else _<0&&(_=0),$(l,_,"",0)},r=()=>{e.style.transform="",e.style.transition="",p&&(p.style.transform="",p.style.transition=""),a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},i=l=>{if(v.start(l),a.moving){const u=e,{transform:d}=window.getComputedStyle(u);a.scrollDistance=+d.slice(7,d.length-1).split(", ")[5]}n&&e.classList.add(n),a.startDistance=a.scrollDistance,a.transitionEndTrigger=null,a.moving=!0},s=l=>{a.moving=!0,v.move(l),v.isHorizontal()&&J(l,!0),m(e,v.deltaX.value,"",0)},c=()=>{const l=v.deltaX.value;if(l==0){n&&e.classList.remove(n);return}const u=v.duration.value;if(u<H&&Math.abs(l)>q){const g=K(l,u);m(e,g,"end",o)}else m(e,l,"end",o)};e.addEventListener("transitionend",r),e.addEventListener("touchstart",i),e.addEventListener("touchmove",s),e.addEventListener("touchend",c),e.addEventListener("touchcancel",c),D.set(e,{state:a,transitionend:r,touchstart:i,touchmove:s,touchend:c,touchcancel:c})}function Z(e){const t=D.get(e);t&&(D.delete(e),e.addEventListener("transitionend",t.transitionend),e.addEventListener("touchstart",t.touchstart),e.addEventListener("touchmove",t.touchmove),e.addEventListener("touchend",t.touchend),e.addEventListener("touchcancel",t.touchcancel))}const tt=f.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:null,routerViewName:null,viewTag:{default:"div"},transition:{type:[Object,Boolean],default:!0}},setup(e){const t=e;function n(i){return(i.params&&i.params.animationType)??"slide"}return{__sfc:!0,props:t,getAnimationType:n,onBeforeEnter:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"show":"enter",g=`fox-root-navigator__${u}-${d}-from`,_=`fox-root-navigator__${u}-${d}-active`;i.classList.add(g),i.classList.add(_)}},onEnter:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"show":"enter",g=`fox-root-navigator__${u}-${d}-from`,_=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.add(_)}},onAfterEnter:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u!=="pop"||!s){const d=s?"show":"enter",g=`fox-root-navigator__${u}-${d}-active`,_=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.remove(_)}}t.dragRemove&&!s&&c.opsType===3&&Q(i,t.removeViewPage,"fox-root-navigator__item-moving",1e3)},onBeforeLeave:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"hide":"leave",g=`fox-root-navigator__${u}-${d}-from`,_=`fox-root-navigator__${u}-${d}-active`;i.classList.add(g),i.classList.add(_)}},onLeave:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u==="pop"&&s)return;const d=s?"hide":"leave",g=`fox-root-navigator__${u}-${d}-from`,_=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.add(_)}},onAfterLeave:(i,s,c,l)=>{if(c.opsType===3||s){const u=n(c);if(u!=="pop"||!s){const d=s?"hide":"leave",g=`fox-root-navigator__${u}-${d}-active`,_=`fox-root-navigator__${u}-${d}-to`;i.classList.remove(g),i.classList.remove(_)}}t.dragRemove&&!s&&Z(i)}}}}),It="";var et=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("fox-router-view",{staticClass:"fox-root-navigator",attrs:{"view-class":"fox-root-navigator__item","before-enter":o.onBeforeEnter,enter:o.onEnter,"after-enter":o.onAfterEnter,"before-leave":o.onBeforeLeave,leave:o.onLeave,"after-leave":o.onAfterLeave,multi:!0,name:o.props.routerViewName,"view-tag":o.props.viewTag,transition:o.props.transition}})},nt=[],ot=T(tt,et,nt,!1,null,null,null,null);const st=ot.exports,it=Object.freeze(Object.defineProperty({__proto__:null,default:st},Symbol.toStringTag,{value:"Module"})),at=f.defineComponent({__name:"swiper",props:{width:null,scrollDistance:null,scrollTime:null},setup(e){const t=e,n=f.computed(()=>({transform:`translate3d(${t.scrollDistance}px, 0, 0)`,width:`${t.width}`}));return{__sfc:!0,props:t,styles:n}}}),St="";var rt=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("div",{staticClass:"fox-swiper-navigator"},[n("div",{staticClass:"fox-swiper-navigator__inner",style:o.styles},[t._t("default")],2)])},ct=[],lt=T(at,rt,ct,!1,null,null,null,null);const ut=lt.exports;let dt=0;function ft(){return++dt}const _t=15,pt=300,ht=200;function vt(e){e.stopPropagation()}function mt(e,t){(typeof e.cancelable!="boolean"||e.cancelable)&&e.preventDefault(),t&&vt(e)}function gt(e,t){return e=Math.abs(e/t)/.003*(e<0?-1:1),e}function P(e,t=0,n,o=ht){n==="end"?e.style.transition=`transform ${o}ms cubic-bezier(0.17, 0.89, 0.45, 1)`:e.style.transition="transform 0ms cubic-bezier(0.17, 0.89, 0.45, 1)",e.style.transform=`translate3d(${t}px, 0, 0)`}class xt{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(t,n,o,a){this.getStartDistance=t,this.openPage=n,this.isPageOpened=o,this.pageOpened=a}open(){const t=this.el,n=M(),o=(a,p,v,m)=>{let r=p+this.startDistance;const i=this.columnWidth/3;if(v==="end"){if(r==0){this.moving=!1;return}Math.abs(p)>i&&(p>0?r=this.startDistance+this.columnWidth:r=this.startDistance-this.columnWidth);let s=-r;s<0?s=0:s>this.width-this.columnWidth&&(s=this.width-this.columnWidth);const c=Math.floor(s/this.columnWidth);this.isPageOpened(c)||this.openPage(c),r=-c*this.columnWidth,m&&m>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(c)}),P(a,r,"end",m),this.scrollDistance=r}else{if(Math.abs(p)>i){let c=0;if(p>0?c=Math.abs(this.startDistance+this.columnWidth):c=Math.abs(this.startDistance-this.columnWidth),c>=0&&c<this.width){const l=Math.floor(c/this.columnWidth);this.isPageOpened(l)||this.openPage(l)}}let s=-r;s<this.min?s=this.min:s>this.max&&(s=this.max),P(a,-s,"",0)}};this.transitionend=()=>{t.style.transition="",this.transitionEndTrigger&&(this.transitionEndTrigger(),this.transitionEndTrigger=null)},this.touchstart=a=>{this.moving||(n.start(a),this.startDistance=this.getStartDistance(),this.transitionEndTrigger=null,this.moving=!0)},this.touchmove=a=>{n.move(a),n.isHorizontal()&&mt(a,!0),o(t,n.deltaX.value,"",0)},this.touchend=()=>{const a=n.deltaX.value;if(a==0)return;const p=n.duration.value;if(p<pt&&Math.abs(a)>_t){const m=gt(a,p);o(t,m,"end",this.swipeDuration)}else o(t,a,"end",this.swipeDuration)},t.addEventListener("transitionend",this.transitionend),t.addEventListener("touchstart",this.touchstart),t.addEventListener("touchmove",this.touchmove),t.addEventListener("touchend",this.touchend),t.addEventListener("touchcancel",this.touchend)}close(){const t=this.el;this.transitionend&&t.addEventListener("transitionend",this.transitionend),this.touchstart&&t.addEventListener("touchstart",this.touchstart),this.touchmove&&t.addEventListener("touchmove",this.touchmove),this.touchend&&t.addEventListener("touchend",this.touchend),this.touchcancel&&t.addEventListener("touchcancel",this.touchcancel),this.el=null}}function wt(e,t,n,o){return new xt(e,t,n,o)}const yt=f.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(e,{emit:t}){const n=e,o=f.reactive({scrollDistance:0,index:-1,openedIndexList:[]}),a=()=>o.scrollDistance,p=h=>{if(o.openedIndexList.indexOf(h)===-1){o.openedIndexList.push(h);const x=n.routes[h];try{n.openViewPage(x,h)}catch(w){console.error(w)}}},v=h=>o.openedIndexList.indexOf(h)!==-1,m=h=>{o.index=h,o.scrollDistance=-o.index*n.width;const x=n.routes[h];t("update:activePath",x.path)},r=wt(a,p,v,m);f.onMounted(()=>{const h=u();r.el=h,r.open()}),f.onUnmounted(()=>{r.close()}),f.watchEffect(()=>{const h=n.activePath;o.index=n.routes.findIndex(Pt=>Pt.path===h);const x=n.width;o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-x*o.index);const w=x*n.routes.length,E=-x/3,L=x*(n.routes.length-1)+x/3;r.columnWidth=x,r.width=w,r.min=E,r.max=L,r.swipeDuration=n.swipeDuration});const i=()=>ut,s=`fox-swiper-navigator-${ft()}`,c=f.computed(()=>({width:`${n.width}px`,height:`${n.height}px`}));let l=null;function u(){return l||(l=document.querySelector(`.${s}>.fox-swiper-navigator__inner`),l)}const d=f.computed(()=>`${n.width*n.routes.length}px`);return{__sfc:!0,props:n,state:o,emit:t,getStartDistance:a,openViewPage:p,isPageOpened:v,pageOpened:m,pageDragger:r,tagProvider:i,uniqueClass:s,styles:c,scrollEl:l,getScrollerEl:u,scrollerWidth:d,tagProps:()=>({scrollDistance:o.scrollDistance,scrollTime:n.scrollTime,width:d.value}),viewTagData:(h,x)=>({style:{left:`${n.routes.findIndex(E=>{const L=h.path??h.name??"";return E.path==L})*n.width}px`,width:`${n.width}px`}})}}}),Wt="";var Tt=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return n("fox-router-view",{class:o.uniqueClass,style:o.styles,attrs:{"view-class":"fox-swiper-navigator__item",tag:o.tagProvider,"tag-props":o.tagProps,"view-tag-data":o.viewTagData,multi:!0,name:o.props.routerViewName,transition:o.props.transition}})},$t=[],Dt=T(yt,Tt,$t,!1,null,null,null,null);const Et=Dt.exports,Lt=Object.freeze(Object.defineProperty({__proto__:null,default:Et},Symbol.toStringTag,{value:"Module"}));let bt="fox-";const Mt=[],C=Object.assign({"/src/components/card-navigator/index.vue":V,"/src/components/default-navigator/index.vue":j,"/src/components/root-navigator/index.vue":it,"/src/components/swiper-navigator/index.vue":Lt}),O=[];for(const e in C){let t=/src\/components\/(.*)\/index.vue/.exec(e)[1];Mt.indexOf(t)===-1&&O.push({name:t,component:C[e].default})}return{install(e){O.forEach(t=>{e.component(`${bt}${t.name}`,t.component)})}}});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .fox-card-navigator{position:relative;overflow:hidden;width:100%}.fox-card-navigator__item{position:relative;width:100%}.fox-card-navigator__item-active{z-index:1}.fox-card-navigator__item-inactive{display:none;z-index:0}.fox-card-navigator__trans-enter,.fox-card-navigator__trans-show{-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 .5s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1),-webkit-transform .5s 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 .5s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1),-webkit-transform .5s 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 .5s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1),-webkit-transform .5s 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 .5s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1),-webkit-transform .5s 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 .5s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1),-webkit-transform .5s 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 .5s cubic-bezier(.17,.89,.45,1);transition:-webkit-transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1);transition:transform .5s cubic-bezier(.17,.89,.45,1),-webkit-transform .5s 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 ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@fox-js/navigation",
3
+ "version": "3.0.1",
4
+ "description": "fox navigation",
5
+ "author": "jiangcheng",
6
+ "keywords": [
7
+ "fox",
8
+ "navigation"
9
+ ],
10
+ "main": "dist/index.umd.js",
11
+ "module": "dist/index.esm.js",
12
+ "exports": {
13
+ ".": {
14
+ "import": {
15
+ "node": "./dist/index.cjs.js",
16
+ "default": "./dist/index.esm.js"
17
+ },
18
+ "require": {
19
+ "node": "./dist/index.cjs.js",
20
+ "default": "./dist/index.umd.js"
21
+ }
22
+ },
23
+ "./style.css": "./dist/style.css"
24
+ },
25
+ "style": "dist/style.css",
26
+ "typings": "dist/index.d.ts",
27
+ "license": "",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "publish:half": "npm version patch & npm publish --tag half",
33
+ "build:dev": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode development",
34
+ "build:prod": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode production"
35
+ },
36
+ "dependencies": {}
37
+ }