@fox-js/navigation 4.0.1-14 → 4.0.1-15
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 +294 -294
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +49 -48
- package/dist/index.umd.js +2 -2
- package/package.json +34 -34
package/README.md
CHANGED
|
@@ -1,294 +1,294 @@
|
|
|
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
|
-
| remove-move-ratio | 触发移除页面的移动比例(相对页面宽度) | Number | 0.5 |
|
|
97
|
-
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
## 插槽
|
|
102
|
-
|
|
103
|
-
| 名称 | 说明 |
|
|
104
|
-
|---------|------------------|
|
|
105
|
-
| default | 内容 |
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
### fox-card-navigator
|
|
110
|
-
|
|
111
|
-
卡片导航组件,配合多标签页容器使用,具备缓存页面的能力。
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
#### 基础用法
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
<script setup lang="ts">
|
|
119
|
-
const rootName = $ref('_tab_view')
|
|
120
|
-
</script>
|
|
121
|
-
|
|
122
|
-
<template>
|
|
123
|
-
<fox-card-navigator
|
|
124
|
-
:router-view-name="rootName"
|
|
125
|
-
:transition="true"
|
|
126
|
-
></fox-card-navigator>
|
|
127
|
-
</template>
|
|
128
|
-
|
|
129
|
-
<style lang="scss">
|
|
130
|
-
</style>
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
#### Props
|
|
135
|
-
|
|
136
|
-
| 字段 | 说明 | 类型 | 默认值 |
|
|
137
|
-
|------------------|----------------------------------------|---------|-----------|
|
|
138
|
-
| router-view-name | router view名称 | String | `default` |
|
|
139
|
-
| transition | 是否支持过渡动画 | Boolean | false |
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## 插槽
|
|
144
|
-
|
|
145
|
-
| 名称 | 说明 |
|
|
146
|
-
|---------|------------------|
|
|
147
|
-
| default | 内容 |
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
### fox-swiper-navigator
|
|
151
|
-
|
|
152
|
-
swiper导航组件,配合tab标签使用(例如手机端的主界面),支持拖曳新打开新页面/切换页面
|
|
153
|
-
|
|
154
|
-
#### 基础用法
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
<script lang="ts" setup>
|
|
158
|
-
import { onMounted, ref, computed } from 'vue'
|
|
159
|
-
import { usePageHelper } from '@/utils/custom'
|
|
160
|
-
import store from '@/store'
|
|
161
|
-
import tabs from './data'
|
|
162
|
-
const contentPadding = {
|
|
163
|
-
left: 0,
|
|
164
|
-
top: 0,
|
|
165
|
-
right: 0,
|
|
166
|
-
bottom: 0
|
|
167
|
-
}
|
|
168
|
-
// -------------- 导航设置 ---------------
|
|
169
|
-
// content width/height
|
|
170
|
-
const contentWidth = ref(0)
|
|
171
|
-
const contentHeight = ref(0)
|
|
172
|
-
// page ref
|
|
173
|
-
const pageRef = ref(null)
|
|
174
|
-
// root name
|
|
175
|
-
const rootName = ref('_tab_view')
|
|
176
|
-
// routes
|
|
177
|
-
const routes = computed(() => {
|
|
178
|
-
return tabs.map(tab => {
|
|
179
|
-
return {
|
|
180
|
-
path: tab.route
|
|
181
|
-
}
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
// active route path
|
|
185
|
-
const activeRoutePath = computed({
|
|
186
|
-
set: (newVal: string) => {
|
|
187
|
-
// 更新tab bar的index
|
|
188
|
-
index.value = routes.value.findIndex(r => {
|
|
189
|
-
return r.path === newVal
|
|
190
|
-
})
|
|
191
|
-
store.setCurrentRoutePath(newVal, rootName.value)
|
|
192
|
-
},
|
|
193
|
-
get: (): string => {
|
|
194
|
-
return store.getCurrentRoutePath(rootName.value) as string
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
// open page
|
|
198
|
-
const openPage = (route: any, index: number) => {
|
|
199
|
-
onTabChange(index)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// -------------tab bar 设置 ------------------
|
|
203
|
-
//当前tab索引
|
|
204
|
-
const index = ref(0)
|
|
205
|
-
// 获取page helper
|
|
206
|
-
const pageHelper = usePageHelper()
|
|
207
|
-
// tab change事件
|
|
208
|
-
const onTabChange = (index: any) => {
|
|
209
|
-
const tab = tabs[index]
|
|
210
|
-
// open页面
|
|
211
|
-
pageHelper.open(tab.route)
|
|
212
|
-
// 当前的route path到公共store中
|
|
213
|
-
store.setCurrentRoutePath(tab.route, rootName.value)
|
|
214
|
-
}
|
|
215
|
-
// content应用
|
|
216
|
-
const contentRef = ref(null)
|
|
217
|
-
// 加载后处理
|
|
218
|
-
onMounted(() => {
|
|
219
|
-
if (pageRef.value) {
|
|
220
|
-
const anyPage: any = pageRef.value
|
|
221
|
-
contentWidth.value = anyPage.getPageContentWidth()
|
|
222
|
-
if (contentWidth.value === 0) {
|
|
223
|
-
const anyContent: any = contentRef.value
|
|
224
|
-
contentWidth.value = anyContent.$el.offsetWidth
|
|
225
|
-
}
|
|
226
|
-
contentHeight.value = anyPage.getPageContentHeight()
|
|
227
|
-
}
|
|
228
|
-
// 当前选中tab index
|
|
229
|
-
let curIndex = index.value
|
|
230
|
-
// 获取之前保存的route path
|
|
231
|
-
let path = store.getCurrentRoutePath(rootName.value)
|
|
232
|
-
if (path) {
|
|
233
|
-
let i = tabs.findIndex(tab => {
|
|
234
|
-
return tab.route === path
|
|
235
|
-
})
|
|
236
|
-
curIndex = i !== -1 ? i : curIndex
|
|
237
|
-
// 更新tab的model
|
|
238
|
-
index.value = curIndex
|
|
239
|
-
}
|
|
240
|
-
// 触发页面跳转
|
|
241
|
-
onTabChange(curIndex)
|
|
242
|
-
})
|
|
243
|
-
</script>
|
|
244
|
-
|
|
245
|
-
<template>
|
|
246
|
-
<fox-page :content-padding="contentPadding" ref="pageRef">
|
|
247
|
-
<fox-footer-bar>
|
|
248
|
-
<fox-tabbar v-model="index" @change="onTabChange">
|
|
249
|
-
<template v-for="tab in tabs" :key="tab.title">
|
|
250
|
-
<fox-tabbar-item :title="tab.title" :icon="tab.icon"></fox-tabbar-item>
|
|
251
|
-
</template>
|
|
252
|
-
</fox-tabbar>
|
|
253
|
-
</fox-footer-bar>
|
|
254
|
-
<fox-content ref="contentRef">
|
|
255
|
-
<fox-swiper-navigator
|
|
256
|
-
v-model:activePath="activeRoutePath"
|
|
257
|
-
:router-view-name="rootName"
|
|
258
|
-
:routes="routes"
|
|
259
|
-
:open-page="openPage"
|
|
260
|
-
:transition="true"
|
|
261
|
-
:width="contentWidth"
|
|
262
|
-
:height="contentHeight"
|
|
263
|
-
></fox-swiper-navigator>
|
|
264
|
-
</fox-content>
|
|
265
|
-
</fox-page>
|
|
266
|
-
</template>
|
|
267
|
-
|
|
268
|
-
<style lang="scss" scoped></style>
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
#### Props
|
|
273
|
-
|
|
274
|
-
| 字段 | 说明 | 类型 | 默认值 |
|
|
275
|
-
|------------------|----------------------------------------|---------|-----------|
|
|
276
|
-
| open-page | 打开页面方法 | Function | |
|
|
277
|
-
| router-view-name | router view名称 | String | `default` |
|
|
278
|
-
| routes | 路由列表 | Route[] | |
|
|
279
|
-
| active-path | 激活路径 | String | |
|
|
280
|
-
| height | 导航容器高度 | Number | |
|
|
281
|
-
| width | 导航容器宽度 | Number | |
|
|
282
|
-
| drag | 是否支持拖曳 | Boolean | |
|
|
283
|
-
| swipe-duration | 滑动页面动画时间 | Number ||
|
|
284
|
-
| scroll-time | 切换页面动画时间 | Number | |
|
|
285
|
-
| move-ratio | 触发页面移动的比例(相对页面宽度) | Number | 0.5 |
|
|
286
|
-
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
## 插槽
|
|
291
|
-
|
|
292
|
-
| 名称 | 说明 |
|
|
293
|
-
|---------|------------------|
|
|
294
|
-
| default | 内容 |
|
|
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
|
+
| remove-move-ratio | 触发移除页面的移动比例(相对页面宽度) | Number | 0.5 |
|
|
97
|
+
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## 插槽
|
|
102
|
+
|
|
103
|
+
| 名称 | 说明 |
|
|
104
|
+
|---------|------------------|
|
|
105
|
+
| default | 内容 |
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### fox-card-navigator
|
|
110
|
+
|
|
111
|
+
卡片导航组件,配合多标签页容器使用,具备缓存页面的能力。
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
#### 基础用法
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
<script setup lang="ts">
|
|
119
|
+
const rootName = $ref('_tab_view')
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<template>
|
|
123
|
+
<fox-card-navigator
|
|
124
|
+
:router-view-name="rootName"
|
|
125
|
+
:transition="true"
|
|
126
|
+
></fox-card-navigator>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<style lang="scss">
|
|
130
|
+
</style>
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Props
|
|
135
|
+
|
|
136
|
+
| 字段 | 说明 | 类型 | 默认值 |
|
|
137
|
+
|------------------|----------------------------------------|---------|-----------|
|
|
138
|
+
| router-view-name | router view名称 | String | `default` |
|
|
139
|
+
| transition | 是否支持过渡动画 | Boolean | false |
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## 插槽
|
|
144
|
+
|
|
145
|
+
| 名称 | 说明 |
|
|
146
|
+
|---------|------------------|
|
|
147
|
+
| default | 内容 |
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### fox-swiper-navigator
|
|
151
|
+
|
|
152
|
+
swiper导航组件,配合tab标签使用(例如手机端的主界面),支持拖曳新打开新页面/切换页面
|
|
153
|
+
|
|
154
|
+
#### 基础用法
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
<script lang="ts" setup>
|
|
158
|
+
import { onMounted, ref, computed } from 'vue'
|
|
159
|
+
import { usePageHelper } from '@/utils/custom'
|
|
160
|
+
import store from '@/store'
|
|
161
|
+
import tabs from './data'
|
|
162
|
+
const contentPadding = {
|
|
163
|
+
left: 0,
|
|
164
|
+
top: 0,
|
|
165
|
+
right: 0,
|
|
166
|
+
bottom: 0
|
|
167
|
+
}
|
|
168
|
+
// -------------- 导航设置 ---------------
|
|
169
|
+
// content width/height
|
|
170
|
+
const contentWidth = ref(0)
|
|
171
|
+
const contentHeight = ref(0)
|
|
172
|
+
// page ref
|
|
173
|
+
const pageRef = ref(null)
|
|
174
|
+
// root name
|
|
175
|
+
const rootName = ref('_tab_view')
|
|
176
|
+
// routes
|
|
177
|
+
const routes = computed(() => {
|
|
178
|
+
return tabs.map(tab => {
|
|
179
|
+
return {
|
|
180
|
+
path: tab.route
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
// active route path
|
|
185
|
+
const activeRoutePath = computed({
|
|
186
|
+
set: (newVal: string) => {
|
|
187
|
+
// 更新tab bar的index
|
|
188
|
+
index.value = routes.value.findIndex(r => {
|
|
189
|
+
return r.path === newVal
|
|
190
|
+
})
|
|
191
|
+
store.setCurrentRoutePath(newVal, rootName.value)
|
|
192
|
+
},
|
|
193
|
+
get: (): string => {
|
|
194
|
+
return store.getCurrentRoutePath(rootName.value) as string
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
// open page
|
|
198
|
+
const openPage = (route: any, index: number) => {
|
|
199
|
+
onTabChange(index)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// -------------tab bar 设置 ------------------
|
|
203
|
+
//当前tab索引
|
|
204
|
+
const index = ref(0)
|
|
205
|
+
// 获取page helper
|
|
206
|
+
const pageHelper = usePageHelper()
|
|
207
|
+
// tab change事件
|
|
208
|
+
const onTabChange = (index: any) => {
|
|
209
|
+
const tab = tabs[index]
|
|
210
|
+
// open页面
|
|
211
|
+
pageHelper.open(tab.route)
|
|
212
|
+
// 当前的route path到公共store中
|
|
213
|
+
store.setCurrentRoutePath(tab.route, rootName.value)
|
|
214
|
+
}
|
|
215
|
+
// content应用
|
|
216
|
+
const contentRef = ref(null)
|
|
217
|
+
// 加载后处理
|
|
218
|
+
onMounted(() => {
|
|
219
|
+
if (pageRef.value) {
|
|
220
|
+
const anyPage: any = pageRef.value
|
|
221
|
+
contentWidth.value = anyPage.getPageContentWidth()
|
|
222
|
+
if (contentWidth.value === 0) {
|
|
223
|
+
const anyContent: any = contentRef.value
|
|
224
|
+
contentWidth.value = anyContent.$el.offsetWidth
|
|
225
|
+
}
|
|
226
|
+
contentHeight.value = anyPage.getPageContentHeight()
|
|
227
|
+
}
|
|
228
|
+
// 当前选中tab index
|
|
229
|
+
let curIndex = index.value
|
|
230
|
+
// 获取之前保存的route path
|
|
231
|
+
let path = store.getCurrentRoutePath(rootName.value)
|
|
232
|
+
if (path) {
|
|
233
|
+
let i = tabs.findIndex(tab => {
|
|
234
|
+
return tab.route === path
|
|
235
|
+
})
|
|
236
|
+
curIndex = i !== -1 ? i : curIndex
|
|
237
|
+
// 更新tab的model
|
|
238
|
+
index.value = curIndex
|
|
239
|
+
}
|
|
240
|
+
// 触发页面跳转
|
|
241
|
+
onTabChange(curIndex)
|
|
242
|
+
})
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<template>
|
|
246
|
+
<fox-page :content-padding="contentPadding" ref="pageRef">
|
|
247
|
+
<fox-footer-bar>
|
|
248
|
+
<fox-tabbar v-model="index" @change="onTabChange">
|
|
249
|
+
<template v-for="tab in tabs" :key="tab.title">
|
|
250
|
+
<fox-tabbar-item :title="tab.title" :icon="tab.icon"></fox-tabbar-item>
|
|
251
|
+
</template>
|
|
252
|
+
</fox-tabbar>
|
|
253
|
+
</fox-footer-bar>
|
|
254
|
+
<fox-content ref="contentRef">
|
|
255
|
+
<fox-swiper-navigator
|
|
256
|
+
v-model:activePath="activeRoutePath"
|
|
257
|
+
:router-view-name="rootName"
|
|
258
|
+
:routes="routes"
|
|
259
|
+
:open-page="openPage"
|
|
260
|
+
:transition="true"
|
|
261
|
+
:width="contentWidth"
|
|
262
|
+
:height="contentHeight"
|
|
263
|
+
></fox-swiper-navigator>
|
|
264
|
+
</fox-content>
|
|
265
|
+
</fox-page>
|
|
266
|
+
</template>
|
|
267
|
+
|
|
268
|
+
<style lang="scss" scoped></style>
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### Props
|
|
273
|
+
|
|
274
|
+
| 字段 | 说明 | 类型 | 默认值 |
|
|
275
|
+
|------------------|----------------------------------------|---------|-----------|
|
|
276
|
+
| open-page | 打开页面方法 | Function | |
|
|
277
|
+
| router-view-name | router view名称 | String | `default` |
|
|
278
|
+
| routes | 路由列表 | Route[] | |
|
|
279
|
+
| active-path | 激活路径 | String | |
|
|
280
|
+
| height | 导航容器高度 | Number | |
|
|
281
|
+
| width | 导航容器宽度 | Number | |
|
|
282
|
+
| drag | 是否支持拖曳 | Boolean | |
|
|
283
|
+
| swipe-duration | 滑动页面动画时间 | Number ||
|
|
284
|
+
| scroll-time | 切换页面动画时间 | Number | |
|
|
285
|
+
| move-ratio | 触发页面移动的比例(相对页面宽度) | Number | 0.5 |
|
|
286
|
+
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
## 插槽
|
|
291
|
+
|
|
292
|
+
| 名称 | 说明 |
|
|
293
|
+
|---------|------------------|
|
|
294
|
+
| default | 内容 |
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";/*!
|
|
2
|
-
* @fox-js/navigation v4.0.1-
|
|
3
|
-
*/const s=require("vue"),b=require("@fox-js/fox"),k=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.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=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}}),j=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"})),S=10;function q(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function V(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=q(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function H(t){return t===window}const G=t=>{const e=s.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,d=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?d=!!e[a]:o[a]=e[a];o.initEvent(t,i,d),(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 P(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 A(t){t.style.transition="",t.style.transform=""}const nt=/^matrix\((.+)\)$/;function C(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 X=new WeakMap;function ot(t,e,n,o,i,d=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=V(),g=(_,h,c,w)=>{let v=h+a.startDistance;if(c==="end"){const D=G(_);let l=D.width*e;v<l?v=0:v=D.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&A(x),v==0?A(_):J(b.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&P(x,0,"",0),v>0&&typeof o=="function"&&o(),P(_,v,"end",w)}else v<0&&(v=0),P(_,v,"",0)},y=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=C(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||C(t)===0&&f.state.deltaX<0)&&(tt(_),g(t,f.state.deltaX,"",0))},u=()=>{if(f.isVertical()||C(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<Q&&Math.abs(h)>K){const v=et(h,c,n);g(t,v,"end",d)}else g(t,h,"end",d)};t.addEventListener("transitionend",y),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",u),t.addEventListener("touchcancel",u),X.set(t,{state:a,transitionend:y,touchstart:r,touchmove:p,touchend:u,touchcancel:u})}function it(t){const e=X.get(t);e&&(X.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const st=s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function d(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=u,o="enter");const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(v)}},a=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(v)}},x=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),w=p?"show":"enter";if(w==="enter"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${w}-active`,D=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)===!0&&!p&&u.opsType===b.OperationType.Append&&ot(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=u,o="leave");const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(v)}},g=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(v)}},y=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),w=p?"hide":"leave";if(w==="leave"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${w}-active`,D=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)&&!p&&it(r)};return(r,p)=>{const u=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(u,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:g,"after-leave":y,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}}),at=Object.freeze(Object.defineProperty({__proto__:null,default:st},Symbol.toStringTag,{value:"Module"})),rt={class:"fox-swiper-navigator"},ct=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.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)=>(s.openBlock(),s.createElementBlock("div",rt,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.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 vt{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,d,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=d,this.momentumReduceRatio=m}open(){const e=this.el,n=V(),o=(i,d,m,a)=>{let x=d+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(d==0){this.moving=!1;return}Math.abs(d)>f?d>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let g=-x;g<0?g=0:g>this.width-this.columnWidth&&(g=this.width-this.columnWidth);const y=Math.floor(g/this.columnWidth);this.isPageOpened(y)||this.openPage(y),x=-y*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(y)}),I(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(d)>f){let y=0;if(d>0?y=Math.abs(this.startDistance+this.columnWidth):y=Math.abs(this.startDistance-this.columnWidth),y>=0&&y<this.width){const r=Math.floor(y/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let g=-x;g<this.min?g=this.min:g>this.max&&(g=this.max),I(i,-g,"",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 d=n.state.duration;if(d<ft&&Math.abs(i)>dt){const a=pt(i,d,this.momentumReduceRatio);o(e,a,"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 gt(t,e,n,o,i,d){return new vt(t,e,n,o,i,d)}function _t(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),d=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-d-m}}const wt=s.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=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,d=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(T){console.error(T)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=gt(d,m,a,x,n.moveRatio,n.momentumReduceRatio));let g=null;s.onMounted(()=>{const l=h(),E=()=>{const T=_t(l);y(n.activePath,n.routes,T.width,T.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(g=new window.ResizeObserver(E),g.observe(l)),E(),f){const T=w();f.el=T,f.open()}}),s.onBeforeUnmount(()=>{g&&(g.disconnect(),g=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,T,$,M,R])=>{const O=T<=0?o.width:T,L=$<=0?o.height:$;y(l,E,O,L,M,R)});const y=(l,E,T,$,M,R="horizontal")=>{const O=l;if(o.index=E.findIndex(L=>L.path===O),R==="horizontal"){const L=T;if(L>0){o.width=T;const z=L*n.routes.length,W=-L/3,N=L*(E.length-1)+L/3;f&&(f.columnWidth=L,f.width=z,f.min=W,f.max=N),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-L*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${ut()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),u=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const T=o.height>0?o.height:n.height;return T>0&&(l.height=`${T}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function w(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const v=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),D=(l,E)=>{const T=n.routes.findIndex($=>{const M=l.path??l.name??"";return $.path==M});return o.width<=0?{}:{style:{left:`${T*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const T=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(T,{class:s.normalizeClass(p.value),style:s.normalizeStyle(u.value),"view-class":"fox-swiper-navigator__item",tag:ct,"view-tag-props":D,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:v.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=[],B=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}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];xt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}const Et={install(t){Y.forEach(e=>{t.component(`${yt}${e.name}`,e.component)})}};module.exports=Et;
|
|
2
|
+
* @fox-js/navigation v4.0.1-14 Thu Jun 13 2024 07:29:14 GMT+0800 (中国标准时间)
|
|
3
|
+
*/const s=require("vue"),b=require("@fox-js/fox"),k=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.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=s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}}),j=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"})),S=10;function q(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function V(){const t={startX:0,startY:0,startTime:0,duration:0,moveX:0,moveY:0,deltaX:0,deltaY:0,offsetX:0,offsetY:0,direction:""},e=()=>t.direction==="vertical",n=()=>t.direction==="horizontal",o=()=>{t.deltaX=0,t.deltaY=0,t.offsetX=0,t.offsetY=0,t.direction="",t.startTime=0};return{move:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=q(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function H(t){return t===window}const G=t=>{const e=s.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,d=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?d=!!e[a]:o[a]=e[a];o.initEvent(t,i,d),(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 P(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 A(t){t.style.transition="",t.style.transform=""}const nt=/^matrix\((.+)\)$/;function C(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 X=new WeakMap;function ot(t,e,n,o,i,d=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=V(),g=(_,h,c,T)=>{let v=h+a.startDistance;if(c==="end"){const D=G(_);let l=D.width*e;v<l?v=0:v=D.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&A(x),v==0?A(_):J(b.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&P(x,0,"",0),v>0&&typeof o=="function"&&o(),P(_,v,"end",T)}else v<0&&(v=0),P(_,v,"",0)},w=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=C(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||C(t)===0&&f.state.deltaX<0)&&(tt(_),g(t,f.state.deltaX,"",0))},u=()=>{if(f.isVertical()||C(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<Q&&Math.abs(h)>K){const v=et(h,c,n);g(t,v,"end",d)}else g(t,h,"end",d)};t.addEventListener("transitionend",w),t.addEventListener("transitioncancel",w),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",u),t.addEventListener("touchcancel",u),X.set(t,{state:a,transitionend:w,transitioncancel:w,touchstart:r,touchmove:p,touchend:u,touchcancel:u})}function it(t){const e=X.get(t);e&&(X.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=s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function d(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=u,o="enter");const T=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(T),r.classList.add(v)}},a=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const T=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(T),r.classList.add(v)}},x=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),T=p?"show":"enter";if(T==="enter"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${T}-active`,D=`fox-root-navigator__${c}-${T}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)===!0&&!p&&u.opsType===b.OperationType.Append&&ot(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=u,o="leave");const T=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-active`;r.classList.add(T),r.classList.add(v)}},g=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const h=i(u),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const T=`fox-root-navigator__${h}-${c}-from`,v=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(T),r.classList.add(v)}},w=(r,p,u,_)=>{if(u.opsType===b.OperationType.Append||p){const c=i(u),T=p?"hide":"leave";if(T==="leave"&&(n=null,o=null),c!=="pop"){const v=`fox-root-navigator__${c}-${T}-active`,D=`fox-root-navigator__${c}-${T}-to`;r.classList.remove(v),r.classList.remove(D)}}d(u)&&!p&&it(r)};return(r,p)=>{const u=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(u,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:g,"after-leave":w,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}}),at=Object.freeze(Object.defineProperty({__proto__:null,default:st},Symbol.toStringTag,{value:"Module"})),rt={class:"fox-swiper-navigator"},ct=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.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)=>(s.openBlock(),s.createElementBlock("div",rt,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.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 vt{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,d,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=d,this.momentumReduceRatio=m}open(){const e=this.el,n=V(),o=(i,d,m,a)=>{let x=d+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(d==0){this.moving=!1;return}Math.abs(d)>f?d>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let g=-x;g<0?g=0:g>this.width-this.columnWidth&&(g=this.width-this.columnWidth);const w=Math.floor(g/this.columnWidth);this.isPageOpened(w)||this.openPage(w),x=-w*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(w)}),I(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(d)>f){let w=0;if(d>0?w=Math.abs(this.startDistance+this.columnWidth):w=Math.abs(this.startDistance-this.columnWidth),w>=0&&w<this.width){const r=Math.floor(w/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let g=-x;g<this.min?g=this.min:g>this.max&&(g=this.max),I(i,-g,"",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 d=n.state.duration;if(d<ft&&Math.abs(i)>dt){const a=pt(i,d,this.momentumReduceRatio);o(e,a,"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 gt(t,e,n,o,i,d){return new vt(t,e,n,o,i,d)}function _t(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),d=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-d-m}}const wt=s.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=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,d=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(y){console.error(y)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=gt(d,m,a,x,n.moveRatio,n.momentumReduceRatio));let g=null;s.onMounted(()=>{const l=h(),E=()=>{const y=_t(l);w(n.activePath,n.routes,y.width,y.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(g=new window.ResizeObserver(E),g.observe(l)),E(),f){const y=T();f.el=y,f.open()}}),s.onBeforeUnmount(()=>{g&&(g.disconnect(),g=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,y,$,M,R])=>{const O=y<=0?o.width:y,L=$<=0?o.height:$;w(l,E,O,L,M,R)});const w=(l,E,y,$,M,R="horizontal")=>{const O=l;if(o.index=E.findIndex(L=>L.path===O),R==="horizontal"){const L=y;if(L>0){o.width=y;const z=L*n.routes.length,W=-L/3,N=L*(E.length-1)+L/3;f&&(f.columnWidth=L,f.width=z,f.min=W,f.max=N),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-L*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${ut()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),u=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const y=o.height>0?o.height:n.height;return y>0&&(l.height=`${y}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function T(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const v=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),D=(l,E)=>{const y=n.routes.findIndex($=>{const M=l.path??l.name??"";return $.path==M});return o.width<=0?{}:{style:{left:`${y*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const y=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(y,{class:s.normalizeClass(p.value),style:s.normalizeStyle(u.value),"view-class":"fox-swiper-navigator__item",tag:ct,"view-tag-props":D,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:v.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=[],B=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}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];xt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}const Et={install(t){Y.forEach(e=>{t.component(`${yt}${e.name}`,e.component)})}};module.exports=Et;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as P, resolveComponent as O, openBlock as b, createBlock as R, withCtx as Y, createVNode as J, Transition as K, resolveDynamicComponent as Q, unref as F, computed as X, createElementBlock as Z, createElementVNode as tt, normalizeStyle as U, renderSlot as et, reactive as nt, onMounted as ot, onBeforeUnmount as it, watch as st, normalizeClass as at } from "vue";
|
|
2
2
|
import { FoxLeaveEnd as rt, OperationType as L } from "@fox-js/fox";
|
|
3
3
|
/*!
|
|
4
|
-
* @fox-js/navigation v4.0.1-
|
|
4
|
+
* @fox-js/navigation v4.0.1-14 Thu Jun 13 2024 07:29:14 GMT+0800 (中国标准时间)
|
|
5
5
|
*/
|
|
6
6
|
const ct = /* @__PURE__ */ P({
|
|
7
7
|
__name: "index",
|
|
@@ -166,7 +166,7 @@ function yt(t, e, n, o, i, u = 600, h = 60) {
|
|
|
166
166
|
scrollTime: 0,
|
|
167
167
|
moving: !1,
|
|
168
168
|
transitionEndTrigger: null
|
|
169
|
-
}, x = t.previousSibling, d = j(), v = (g, f, r,
|
|
169
|
+
}, x = t.previousSibling, d = j(), v = (g, f, r, w) => {
|
|
170
170
|
let p = f + s.startDistance;
|
|
171
171
|
if (r === "end") {
|
|
172
172
|
const E = mt(g);
|
|
@@ -175,10 +175,10 @@ function yt(t, e, n, o, i, u = 600, h = 60) {
|
|
|
175
175
|
s.moving = !1, i && g.classList.remove(i), setTimeout(() => {
|
|
176
176
|
x && z(x), p == 0 ? z(g) : pt(rt, {}, g), s.moving = !1;
|
|
177
177
|
}, h);
|
|
178
|
-
}, x && C(x, 0, "", 0), p > 0 && typeof o == "function" && o(), C(g, p, "end",
|
|
178
|
+
}, x && C(x, 0, "", 0), p > 0 && typeof o == "function" && o(), C(g, p, "end", w);
|
|
179
179
|
} else
|
|
180
180
|
p < 0 && (p = 0), C(g, p, "", 0);
|
|
181
|
-
},
|
|
181
|
+
}, _ = () => {
|
|
182
182
|
s.transitionEndTrigger && (s.transitionEndTrigger(), s.transitionEndTrigger = null);
|
|
183
183
|
}, a = (g) => {
|
|
184
184
|
d.start(g), s.scrollDistance = 0, s.moving && (s.scrollDistance = I(t)), i && t.classList.add(i), s.transitionEndTrigger = null, s.moving = !0;
|
|
@@ -199,9 +199,10 @@ function yt(t, e, n, o, i, u = 600, h = 60) {
|
|
|
199
199
|
} else
|
|
200
200
|
v(t, f, "end", u);
|
|
201
201
|
};
|
|
202
|
-
t.addEventListener("transitionend",
|
|
202
|
+
t.addEventListener("transitionend", _), t.addEventListener("transitioncancel", _), t.addEventListener("touchstart", a), t.addEventListener("touchmove", m), t.addEventListener("touchend", l), t.addEventListener("touchcancel", l), V.set(t, {
|
|
203
203
|
state: s,
|
|
204
|
-
transitionend:
|
|
204
|
+
transitionend: _,
|
|
205
|
+
transitioncancel: _,
|
|
205
206
|
touchstart: a,
|
|
206
207
|
touchmove: m,
|
|
207
208
|
touchend: l,
|
|
@@ -210,7 +211,7 @@ function yt(t, e, n, o, i, u = 600, h = 60) {
|
|
|
210
211
|
}
|
|
211
212
|
function Et(t) {
|
|
212
213
|
const e = V.get(t);
|
|
213
|
-
e && (V.delete(t), t.addEventListener("transitionend", e.transitionend), t.addEventListener("touchstart", e.touchstart), t.addEventListener("touchmove", e.touchmove), t.addEventListener("touchend", e.touchend), t.addEventListener("touchcancel", e.touchcancel));
|
|
214
|
+
e && (V.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));
|
|
214
215
|
}
|
|
215
216
|
const Dt = /* @__PURE__ */ P({
|
|
216
217
|
__name: "index",
|
|
@@ -241,22 +242,22 @@ const Dt = /* @__PURE__ */ P({
|
|
|
241
242
|
if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
|
|
242
243
|
return;
|
|
243
244
|
r === "enter" && (n = l, o = "enter");
|
|
244
|
-
const
|
|
245
|
-
a.classList.add(
|
|
245
|
+
const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
|
|
246
|
+
a.classList.add(w), a.classList.add(p);
|
|
246
247
|
}
|
|
247
248
|
}, s = (a, m, l, g) => {
|
|
248
249
|
if (l.opsType === L.Append || m) {
|
|
249
250
|
const f = i(l), r = m ? "show" : "enter";
|
|
250
251
|
if (r === "show" && (f === "pop" || o !== "leave" || (n ? i(n) : "") === "pop"))
|
|
251
252
|
return;
|
|
252
|
-
const
|
|
253
|
-
a.classList.remove(
|
|
253
|
+
const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
|
|
254
|
+
a.classList.remove(w), a.classList.add(p);
|
|
254
255
|
}
|
|
255
256
|
}, x = (a, m, l, g) => {
|
|
256
257
|
if (l.opsType === L.Append || m) {
|
|
257
|
-
const r = i(l),
|
|
258
|
-
if (
|
|
259
|
-
const p = `fox-root-navigator__${r}-${
|
|
258
|
+
const r = i(l), w = m ? "show" : "enter";
|
|
259
|
+
if (w === "enter" && (n = null, o = null), r !== "pop") {
|
|
260
|
+
const p = `fox-root-navigator__${r}-${w}-active`, E = `fox-root-navigator__${r}-${w}-to`;
|
|
260
261
|
a.classList.remove(p), a.classList.remove(E);
|
|
261
262
|
}
|
|
262
263
|
}
|
|
@@ -275,22 +276,22 @@ const Dt = /* @__PURE__ */ P({
|
|
|
275
276
|
if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
|
|
276
277
|
return;
|
|
277
278
|
r === "leave" && (n = l, o = "leave");
|
|
278
|
-
const
|
|
279
|
-
a.classList.add(
|
|
279
|
+
const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-active`;
|
|
280
|
+
a.classList.add(w), a.classList.add(p);
|
|
280
281
|
}
|
|
281
282
|
}, v = (a, m, l, g) => {
|
|
282
283
|
if (l.opsType === L.Append || m) {
|
|
283
284
|
const f = i(l), r = m ? "hide" : "leave";
|
|
284
285
|
if (r === "hide" && (f === "pop" || o !== "enter" || (n ? i(n) : "") === "pop"))
|
|
285
286
|
return;
|
|
286
|
-
const
|
|
287
|
-
a.classList.remove(
|
|
287
|
+
const w = `fox-root-navigator__${f}-${r}-from`, p = `fox-root-navigator__${f}-${r}-to`;
|
|
288
|
+
a.classList.remove(w), a.classList.add(p);
|
|
288
289
|
}
|
|
289
|
-
},
|
|
290
|
+
}, _ = (a, m, l, g) => {
|
|
290
291
|
if (l.opsType === L.Append || m) {
|
|
291
|
-
const r = i(l),
|
|
292
|
-
if (
|
|
293
|
-
const p = `fox-root-navigator__${r}-${
|
|
292
|
+
const r = i(l), w = m ? "hide" : "leave";
|
|
293
|
+
if (w === "leave" && (n = null, o = null), r !== "pop") {
|
|
294
|
+
const p = `fox-root-navigator__${r}-${w}-active`, E = `fox-root-navigator__${r}-${w}-to`;
|
|
294
295
|
a.classList.remove(p), a.classList.remove(E);
|
|
295
296
|
}
|
|
296
297
|
}
|
|
@@ -306,7 +307,7 @@ const Dt = /* @__PURE__ */ P({
|
|
|
306
307
|
"after-enter": x,
|
|
307
308
|
"before-leave": d,
|
|
308
309
|
leave: v,
|
|
309
|
-
"after-leave":
|
|
310
|
+
"after-leave": _,
|
|
310
311
|
multi: !0,
|
|
311
312
|
name: a.routerViewName,
|
|
312
313
|
"view-tag": a.viewTag,
|
|
@@ -470,15 +471,15 @@ class Ct {
|
|
|
470
471
|
Math.abs(u) > d ? u > 0 ? x = this.startDistance + this.columnWidth : x = this.startDistance - this.columnWidth : x = this.startDistance;
|
|
471
472
|
let v = -x;
|
|
472
473
|
v < 0 ? v = 0 : v > this.width - this.columnWidth && (v = this.width - this.columnWidth);
|
|
473
|
-
const
|
|
474
|
-
this.isPageOpened(
|
|
475
|
-
this.moving = !1, this.pageOpened(
|
|
474
|
+
const _ = Math.floor(v / this.columnWidth);
|
|
475
|
+
this.isPageOpened(_) || this.openPage(_), x = -_ * this.columnWidth, s && s > 0 && (this.transitionEndTrigger = () => {
|
|
476
|
+
this.moving = !1, this.pageOpened(_);
|
|
476
477
|
}), N(i, x, "end", s), this.scrollDistance = x;
|
|
477
478
|
} else {
|
|
478
479
|
if (Math.abs(u) > d) {
|
|
479
|
-
let
|
|
480
|
-
if (u > 0 ?
|
|
481
|
-
const a = Math.floor(
|
|
480
|
+
let _ = 0;
|
|
481
|
+
if (u > 0 ? _ = Math.abs(this.startDistance + this.columnWidth) : _ = Math.abs(this.startDistance - this.columnWidth), _ >= 0 && _ < this.width) {
|
|
482
|
+
const a = Math.floor(_ / this.columnWidth);
|
|
482
483
|
this.isPageOpened(a) || this.openPage(a);
|
|
483
484
|
}
|
|
484
485
|
}
|
|
@@ -557,8 +558,8 @@ const Yt = /* @__PURE__ */ P({
|
|
|
557
558
|
const y = n.routes[c];
|
|
558
559
|
try {
|
|
559
560
|
n.openViewPage(y, c);
|
|
560
|
-
} catch (
|
|
561
|
-
console.error(
|
|
561
|
+
} catch (T) {
|
|
562
|
+
console.error(T);
|
|
562
563
|
}
|
|
563
564
|
}
|
|
564
565
|
}, s = (c) => o.openedIndexList.indexOf(c) !== -1, x = (c) => {
|
|
@@ -578,12 +579,12 @@ const Yt = /* @__PURE__ */ P({
|
|
|
578
579
|
let v = null;
|
|
579
580
|
ot(() => {
|
|
580
581
|
const c = f(), y = () => {
|
|
581
|
-
const
|
|
582
|
-
|
|
582
|
+
const T = Vt(c);
|
|
583
|
+
_(n.activePath, n.routes, T.width, T.height, n.swipeDuration, n.direction);
|
|
583
584
|
};
|
|
584
585
|
if (window.ResizeObserver && (v = new window.ResizeObserver(y), v.observe(c)), y(), d) {
|
|
585
|
-
const
|
|
586
|
-
d.el =
|
|
586
|
+
const T = w();
|
|
587
|
+
d.el = T, d.open();
|
|
587
588
|
}
|
|
588
589
|
}), it(() => {
|
|
589
590
|
v && (v.disconnect(), v = null), d && d.close();
|
|
@@ -596,17 +597,17 @@ const Yt = /* @__PURE__ */ P({
|
|
|
596
597
|
() => n.swipeDuration,
|
|
597
598
|
() => n.direction
|
|
598
599
|
],
|
|
599
|
-
([c, y,
|
|
600
|
-
const A =
|
|
601
|
-
|
|
600
|
+
([c, y, T, $, M, S]) => {
|
|
601
|
+
const A = T <= 0 ? o.width : T, D = $ <= 0 ? o.height : $;
|
|
602
|
+
_(c, y, A, D, M, S);
|
|
602
603
|
}
|
|
603
604
|
);
|
|
604
|
-
const
|
|
605
|
+
const _ = (c, y, T, $, M, S = "horizontal") => {
|
|
605
606
|
const A = c;
|
|
606
607
|
if (o.index = y.findIndex((D) => D.path === A), S === "horizontal") {
|
|
607
|
-
const D =
|
|
608
|
+
const D = T;
|
|
608
609
|
if (D > 0) {
|
|
609
|
-
o.width =
|
|
610
|
+
o.width = T;
|
|
610
611
|
const q = D * n.routes.length, H = -D / 3, G = D * (y.length - 1) + D / 3;
|
|
611
612
|
d && (d.columnWidth = D, d.width = q, d.min = H, d.max = G), o.index !== -1 && (o.openedIndexList.push(o.index), o.scrollDistance = -D * o.index);
|
|
612
613
|
}
|
|
@@ -618,32 +619,32 @@ const Yt = /* @__PURE__ */ P({
|
|
|
618
619
|
}), l = X(() => {
|
|
619
620
|
const c = {}, y = o.width > 0 ? o.width : n.width;
|
|
620
621
|
y > 0 && (c.width = `${y}px`);
|
|
621
|
-
const
|
|
622
|
-
return
|
|
622
|
+
const T = o.height > 0 ? o.height : n.height;
|
|
623
|
+
return T > 0 && (c.height = `${T}px`), n.customStyle && Object.assign(c, n.customStyle), c;
|
|
623
624
|
});
|
|
624
625
|
let g = null;
|
|
625
626
|
function f() {
|
|
626
627
|
return g || (g = document.querySelector(`.${a}`), g);
|
|
627
628
|
}
|
|
628
629
|
let r = null;
|
|
629
|
-
function
|
|
630
|
+
function w() {
|
|
630
631
|
return r || (r = document.querySelector(`.${a}>.fox-swiper-navigator__inner`), r);
|
|
631
632
|
}
|
|
632
633
|
const p = X(() => o.width > 0 ? `${o.width * n.routes.length}px` : "100%"), E = (c, y) => {
|
|
633
|
-
const
|
|
634
|
+
const T = n.routes.findIndex(($) => {
|
|
634
635
|
const M = c.path ?? c.name ?? "";
|
|
635
636
|
return $.path == M;
|
|
636
637
|
});
|
|
637
638
|
return o.width <= 0 ? {} : {
|
|
638
639
|
style: {
|
|
639
|
-
left: `${
|
|
640
|
+
left: `${T * o.width}px`,
|
|
640
641
|
width: `${o.width}px`
|
|
641
642
|
}
|
|
642
643
|
};
|
|
643
644
|
};
|
|
644
645
|
return (c, y) => {
|
|
645
|
-
const
|
|
646
|
-
return b(), R(
|
|
646
|
+
const T = O("fox-router-view");
|
|
647
|
+
return b(), R(T, {
|
|
647
648
|
class: at(m.value),
|
|
648
649
|
style: U(l.value),
|
|
649
650
|
"view-class": "fox-swiper-navigator__item",
|
package/dist/index.umd.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function(s,D){typeof exports=="object"&&typeof module<"u"?module.exports=D(require("vue"),require("@fox-js/fox")):typeof define=="function"&&define.amd?define(["vue","@fox-js/fox"],D):(s=typeof globalThis<"u"?globalThis:s||self,s.FoxNavigation=D(s.Vue,s.Fox))})(this,function(s,D){"use strict";/*!
|
|
2
|
-
* @fox-js/navigation v4.0.1-
|
|
3
|
-
*/const z=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.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"])}}})},Symbol.toStringTag,{value:"Module"})),W=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}})},Symbol.toStringTag,{value:"Module"})),S=10;function N(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function A(){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:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=N(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function F(t){return t===window}const k=t=>{const e=s.unref(t);if(F(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,u=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?u=!!e[a]:o[a]=e[a];o.initEvent(t,i,u),(n??document).dispatchEvent(o)},U=15,q=300,H=200;function G(t){t.stopPropagation()}function J(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function R(t,e=0,n,o=H){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function I(t){t.style.transition="",t.style.transform=""}const K=/^matrix\((.+)\)$/;function O(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const i=K.exec(o);i&&(e=+i[1].split(/,\s*/)[4])}return e}const P=new WeakMap;function Q(t,e,n,o,i,u=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=A(),v=(_,h,c,w)=>{let g=h+a.startDistance;if(c==="end"){const L=k(_);let l=L.width*e;g<l?g=0:g=L.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&I(x),g==0?I(_):j(D.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&R(x,0,"",0),g>0&&typeof o=="function"&&o(),R(_,g,"end",w)}else g<0&&(g=0),R(_,g,"",0)},y=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=O(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||O(t)===0&&f.state.deltaX<0)&&(G(_),v(t,f.state.deltaX,"",0))},d=()=>{if(f.isVertical()||O(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<q&&Math.abs(h)>U){const g=J(h,c,n);v(t,g,"end",u)}else v(t,h,"end",u)};t.addEventListener("transitionend",y),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",d),t.addEventListener("touchcancel",d),P.set(t,{state:a,transitionend:y,touchstart:r,touchmove:p,touchend:d,touchcancel:d})}function Z(t){const e=P.get(t);e&&(P.delete(t),t.addEventListener("transitionend",e.transitionend),t.addEventListener("touchstart",e.touchstart),t.addEventListener("touchmove",e.touchmove),t.addEventListener("touchend",e.touchend),t.addEventListener("touchcancel",e.touchcancel))}const tt=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function u(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=d,o="enter");const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(g)}},a=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(g)}},x=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),w=p?"show":"enter";if(w==="enter"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${w}-active`,L=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)===!0&&!p&&d.opsType===D.OperationType.Append&&Q(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=d,o="leave");const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(w),r.classList.add(g)}},v=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const w=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(w),r.classList.add(g)}},y=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),w=p?"hide":"leave";if(w==="leave"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${w}-active`,L=`fox-root-navigator__${c}-${w}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)&&!p&&Z(r)};return(r,p)=>{const d=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(d,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:v,"after-leave":y,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}})},Symbol.toStringTag,{value:"Module"})),et={class:"fox-swiper-navigator"},nt=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.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)=>(s.openBlock(),s.createElementBlock("div",et,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.renderSlot(o.$slots,"default")],4)]))}});let ot=0;function it(){return++ot}const st=15,at=300,rt=200;function ct(t){t.stopPropagation()}function lt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function V(t,e=0,n,o=rt){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,i,u,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=u,this.momentumReduceRatio=m}open(){const e=this.el,n=A(),o=(i,u,m,a)=>{let x=u+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(u==0){this.moving=!1;return}Math.abs(u)>f?u>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let v=-x;v<0?v=0:v>this.width-this.columnWidth&&(v=this.width-this.columnWidth);const y=Math.floor(v/this.columnWidth);this.isPageOpened(y)||this.openPage(y),x=-y*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(y)}),V(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(u)>f){let y=0;if(u>0?y=Math.abs(this.startDistance+this.columnWidth):y=Math.abs(this.startDistance-this.columnWidth),y>=0&&y<this.width){const r=Math.floor(y/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let v=-x;v<this.min?v=this.min:v>this.max&&(v=this.max),V(i,-v,"",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()&&(ct(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const u=n.state.duration;if(u<at&&Math.abs(i)>st){const a=lt(i,u,this.momentumReduceRatio);o(e,a,"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 ut(t,e,n,o,i,u){return new dt(t,e,n,o,i,u)}function ft(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),u=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-u-m}}const ht=Object.freeze(Object.defineProperty({__proto__:null,default:s.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=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,u=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(T){console.error(T)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=ut(u,m,a,x,n.moveRatio,n.momentumReduceRatio));let v=null;s.onMounted(()=>{const l=h(),E=()=>{const T=ft(l);y(n.activePath,n.routes,T.width,T.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(v=new window.ResizeObserver(E),v.observe(l)),E(),f){const T=w();f.el=T,f.open()}}),s.onBeforeUnmount(()=>{v&&(v.disconnect(),v=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,T,b,M,C])=>{const X=T<=0?o.width:T,$=b<=0?o.height:b;y(l,E,X,$,M,C)});const y=(l,E,T,b,M,C="horizontal")=>{const X=l;if(o.index=E.findIndex($=>$.path===X),C==="horizontal"){const $=T;if($>0){o.width=T;const gt=$*n.routes.length,vt=-$/3,_t=$*(E.length-1)+$/3;f&&(f.columnWidth=$,f.width=gt,f.min=vt,f.max=_t),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-$*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${it()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),d=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const T=o.height>0?o.height:n.height;return T>0&&(l.height=`${T}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function w(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const g=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),L=(l,E)=>{const T=n.routes.findIndex(b=>{const M=l.path??l.name??"";return b.path==M});return o.width<=0?{}:{style:{left:`${T*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const T=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(T,{class:s.normalizeClass(p.value),style:s.normalizeStyle(d.value),"view-class":"fox-swiper-navigator__item",tag:nt,"view-tag-props":L,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:g.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}})},Symbol.toStringTag,{value:"Module"}));let mt="fox-";const pt=[],B=Object.assign({"/src/components/card-navigator/index.vue":z,"/src/components/default-navigator/index.vue":W,"/src/components/root-navigator/index.vue":tt,"/src/components/swiper-navigator/index.vue":ht}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];pt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}return{install(t){Y.forEach(e=>{t.component(`${mt}${e.name}`,e.component)})}}});
|
|
2
|
+
* @fox-js/navigation v4.0.1-14 Thu Jun 13 2024 07:29:14 GMT+0800 (中国标准时间)
|
|
3
|
+
*/const z=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!1}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.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"])}}})},Symbol.toStringTag,{value:"Module"})),W=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{routerViewName:{},transition:{type:[Function,Boolean],default:!0}},setup(t){return(e,n)=>{const o=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(o,{transition:!1,multi:!1,name:e.routerViewName},{default:s.withCtx(({Component:i})=>[s.createVNode(s.Transition,{name:"fox-default-navigator__trans"},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(i)))]),_:2},1024)]),_:1},8,["name"])}}})},Symbol.toStringTag,{value:"Module"})),S=10;function N(t,e){return t>e&&t>S?"horizontal":e>t&&e>S?"vertical":""}function A(){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:m=>{if(m.touches){const a=m.touches[0];t.deltaX=a.clientX-t.startX,t.deltaY=a.clientY-t.startY,t.moveX=a.clientX,t.moveY=a.clientY}else t.deltaX=m.clientX-t.startX,t.deltaY=m.clientY-t.startY,t.moveX=m.clientX,t.moveY=m.clientY;t.offsetX=Math.abs(t.deltaX),t.offsetY=Math.abs(t.deltaY),t.duration=Date.now()-t.startTime,t.direction||(t.direction=N(t.offsetX,t.offsetY))},start:m=>{if(o(),m.touches){const a=m.touches[0];t.startX=a.clientX,t.startY=a.clientY}else t.startX=m.clientX,t.startY=m.clientY;t.startTime=Date.now()},reset:o,isVertical:e,isHorizontal:n,state:t}}function F(t){return t===window}const k=t=>{const e=s.unref(t);if(F(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,u=!0;for(let a in e)a==="bubbles"?i=!!e[a]:a==="cancelable"?u=!!e[a]:o[a]=e[a];o.initEvent(t,i,u),(n??document).dispatchEvent(o)},U=15,q=300,H=200;function G(t){t.stopPropagation()}function J(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function R(t,e=0,n,o=H){n==="end"?t.style.transition=`transform ${o}ms linear`:t.style.transition="transform 0ms linear",t.style.transform=`translate3d(${e}px, 0, 0)`}function I(t){t.style.transition="",t.style.transform=""}const K=/^matrix\((.+)\)$/;function O(t){let e=0;const n=t,{transform:o}=window.getComputedStyle(n);if(o){const i=K.exec(o);i&&(e=+i[1].split(/,\s*/)[4])}return e}const P=new WeakMap;function Q(t,e,n,o,i,u=600,m=60){const a={active:!0,startDistance:0,scrollDistance:0,scrollTime:0,moving:!1,transitionEndTrigger:null},x=t.previousSibling,f=A(),v=(_,h,c,T)=>{let g=h+a.startDistance;if(c==="end"){const L=k(_);let l=L.width*e;g<l?g=0:g=L.width,a.transitionEndTrigger=()=>{a.moving=!1,i&&_.classList.remove(i),setTimeout(()=>{x&&I(x),g==0?I(_):j(D.FoxLeaveEnd,{},_),a.moving=!1},m)},x&&R(x,0,"",0),g>0&&typeof o=="function"&&o(),R(_,g,"end",T)}else g<0&&(g=0),R(_,g,"",0)},w=()=>{a.transitionEndTrigger&&(a.transitionEndTrigger(),a.transitionEndTrigger=null)},r=_=>{f.start(_),a.scrollDistance=0,a.moving&&(a.scrollDistance=O(t)),i&&t.classList.add(i),a.transitionEndTrigger=null,a.moving=!0},p=_=>{a.moving=!0,f.move(_),!(f.isVertical()||O(t)===0&&f.state.deltaX<0)&&(G(_),v(t,f.state.deltaX,"",0))},d=()=>{if(f.isVertical()||O(t)===0&&f.state.deltaX<0)return;const h=f.state.deltaX;if(h===0){i&&t.classList.remove(i),a.moving=!1;return}const c=f.state.duration;if(c<q&&Math.abs(h)>U){const g=J(h,c,n);v(t,g,"end",u)}else v(t,h,"end",u)};t.addEventListener("transitionend",w),t.addEventListener("transitioncancel",w),t.addEventListener("touchstart",r),t.addEventListener("touchmove",p),t.addEventListener("touchend",d),t.addEventListener("touchcancel",d),P.set(t,{state:a,transitionend:w,transitioncancel:w,touchstart:r,touchmove:p,touchend:d,touchcancel:d})}function Z(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 tt=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"index",props:{dragRemove:{type:Boolean,default:!0},removeViewPage:{},removeMoveRatio:{default:.5},momentumReduceRatio:{default:1},resetDelay:{default:120},swipeDuration:{default:60},routerViewName:{},viewTag:{type:[Function,String],default:"div"},transition:{type:[Function,Boolean],default:!0},viewClass:{type:[Function,String],default:"fox-root-navigator__item"}},setup(t){const e=t;let n=null,o=null;function i(r){return(r.params&&r.params.animationType)??"slide"}function u(r){return(r.params&&r.params.dragRemove)??e.dragRemove}const m=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;c==="enter"&&(n=d,o="enter");const T=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(T),r.classList.add(g)}},a=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"show":"enter";if(c==="show"&&(h==="pop"||o!=="leave"||(n?i(n):"")==="pop"))return;const T=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(T),r.classList.add(g)}},x=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),T=p?"show":"enter";if(T==="enter"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${T}-active`,L=`fox-root-navigator__${c}-${T}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)===!0&&!p&&d.opsType===D.OperationType.Append&&Q(r,e.removeMoveRatio,e.momentumReduceRatio,e.removeViewPage,"fox-root-navigator__item-moving",e.swipeDuration,e.resetDelay)},f=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;c==="leave"&&(n=d,o="leave");const T=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-active`;r.classList.add(T),r.classList.add(g)}},v=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const h=i(d),c=p?"hide":"leave";if(c==="hide"&&(h==="pop"||o!=="enter"||(n?i(n):"")==="pop"))return;const T=`fox-root-navigator__${h}-${c}-from`,g=`fox-root-navigator__${h}-${c}-to`;r.classList.remove(T),r.classList.add(g)}},w=(r,p,d,_)=>{if(d.opsType===D.OperationType.Append||p){const c=i(d),T=p?"hide":"leave";if(T==="leave"&&(n=null,o=null),c!=="pop"){const g=`fox-root-navigator__${c}-${T}-active`,L=`fox-root-navigator__${c}-${T}-to`;r.classList.remove(g),r.classList.remove(L)}}u(d)&&!p&&Z(r)};return(r,p)=>{const d=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(d,{class:"fox-root-navigator","view-class":r.viewClass,"before-enter":m,enter:a,"after-enter":x,"before-leave":f,leave:v,"after-leave":w,multi:!0,name:r.routerViewName,"view-tag":r.viewTag,transition:r.transition},null,8,["view-class","name","view-tag","transition"])}}})},Symbol.toStringTag,{value:"Module"})),et={class:"fox-swiper-navigator"},nt=s.defineComponent({__name:"swiper",props:{width:{},scrollDistance:{},scrollDuration:{},direction:{}},setup(t){const e=t,n=s.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)=>(s.openBlock(),s.createElementBlock("div",et,[s.createElementVNode("div",{class:"fox-swiper-navigator__inner",style:s.normalizeStyle(n.value)},[s.renderSlot(o.$slots,"default")],4)]))}});let ot=0;function it(){return++ot}const st=15,at=300,rt=200;function ct(t){t.stopPropagation()}function lt(t,e,n=1){return t=Math.abs(t/e)/.003*(t<0?-1:1),t*n}function V(t,e=0,n,o=rt){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,i,u,m){this.getStartDistance=e,this.openPage=n,this.isPageOpened=o,this.pageOpened=i,this.moveRatio=u,this.momentumReduceRatio=m}open(){const e=this.el,n=A(),o=(i,u,m,a)=>{let x=u+this.startDistance;const f=this.columnWidth*this.moveRatio;if(m==="end"){if(u==0){this.moving=!1;return}Math.abs(u)>f?u>0?x=this.startDistance+this.columnWidth:x=this.startDistance-this.columnWidth:x=this.startDistance;let v=-x;v<0?v=0:v>this.width-this.columnWidth&&(v=this.width-this.columnWidth);const w=Math.floor(v/this.columnWidth);this.isPageOpened(w)||this.openPage(w),x=-w*this.columnWidth,a&&a>0&&(this.transitionEndTrigger=()=>{this.moving=!1,this.pageOpened(w)}),V(i,x,"end",a),this.scrollDistance=x}else{if(Math.abs(u)>f){let w=0;if(u>0?w=Math.abs(this.startDistance+this.columnWidth):w=Math.abs(this.startDistance-this.columnWidth),w>=0&&w<this.width){const r=Math.floor(w/this.columnWidth);this.isPageOpened(r)||this.openPage(r)}}let v=-x;v<this.min?v=this.min:v>this.max&&(v=this.max),V(i,-v,"",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()&&(ct(i),o(e,n.state.deltaX,"",0))},this.touchend=()=>{if(n.isVertical())return;const i=n.state.deltaX;if(i==0)return;const u=n.state.duration;if(u<at&&Math.abs(i)>st){const a=lt(i,u,this.momentumReduceRatio);o(e,a,"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 ut(t,e,n,o,i,u){return new dt(t,e,n,o,i,u)}function ft(t){const e=s.unref(t),n=window.getComputedStyle(e,null),o=parseFloat(n.getPropertyValue("padding-left")),i=parseFloat(n.getPropertyValue("padding-right")),u=parseFloat(n.getPropertyValue("padding-top")),m=parseFloat(n.getPropertyValue("padding-bottom"));return{width:e.clientWidth-o-i,height:e.clientHeight-u-m}}const ht=Object.freeze(Object.defineProperty({__proto__:null,default:s.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=s.reactive({scrollDistance:0,index:-1,openedIndexList:[],width:n.width,height:n.height}),i=e,u=()=>o.scrollDistance,m=l=>{if(o.openedIndexList.indexOf(l)===-1){o.openedIndexList.push(l);const E=n.routes[l];try{n.openViewPage(E,l)}catch(y){console.error(y)}}},a=l=>o.openedIndexList.indexOf(l)!==-1,x=l=>{o.index=l,o.width>0?o.scrollDistance=-o.index*o.width:o.scrollDistance=0;const E=n.routes[l];i("update:activePath",E.path)};let f=null;n.draggable&&(f=ut(u,m,a,x,n.moveRatio,n.momentumReduceRatio));let v=null;s.onMounted(()=>{const l=h(),E=()=>{const y=ft(l);w(n.activePath,n.routes,y.width,y.height,n.swipeDuration,n.direction)};if(window.ResizeObserver&&(v=new window.ResizeObserver(E),v.observe(l)),E(),f){const y=T();f.el=y,f.open()}}),s.onBeforeUnmount(()=>{v&&(v.disconnect(),v=null),f&&f.close()}),s.watch([()=>n.activePath,()=>n.routes,()=>n.width,()=>n.height,()=>n.swipeDuration,()=>n.direction],([l,E,y,b,M,C])=>{const X=y<=0?o.width:y,$=b<=0?o.height:b;w(l,E,X,$,M,C)});const w=(l,E,y,b,M,C="horizontal")=>{const X=l;if(o.index=E.findIndex($=>$.path===X),C==="horizontal"){const $=y;if($>0){o.width=y;const gt=$*n.routes.length,vt=-$/3,_t=$*(E.length-1)+$/3;f&&(f.columnWidth=$,f.width=gt,f.min=vt,f.max=_t),o.index!==-1&&(o.openedIndexList.push(o.index),o.scrollDistance=-$*o.index)}}f&&(f.swipeDuration=M)},r=`fox-swiper-navigator-${it()}`,p=s.computed(()=>{const l=[r];return n.customClass&&l.push(n.customClass),l}),d=s.computed(()=>{const l={},E=o.width>0?o.width:n.width;E>0&&(l.width=`${E}px`);const y=o.height>0?o.height:n.height;return y>0&&(l.height=`${y}px`),n.customStyle&&Object.assign(l,n.customStyle),l});let _=null;function h(){return _||(_=document.querySelector(`.${r}`),_)}let c=null;function T(){return c||(c=document.querySelector(`.${r}>.fox-swiper-navigator__inner`),c)}const g=s.computed(()=>o.width>0?`${o.width*n.routes.length}px`:"100%"),L=(l,E)=>{const y=n.routes.findIndex(b=>{const M=l.path??l.name??"";return b.path==M});return o.width<=0?{}:{style:{left:`${y*o.width}px`,width:`${o.width}px`}}};return(l,E)=>{const y=s.resolveComponent("fox-router-view");return s.openBlock(),s.createBlock(y,{class:s.normalizeClass(p.value),style:s.normalizeStyle(d.value),"view-class":"fox-swiper-navigator__item",tag:nt,"view-tag-props":L,multi:!0,name:l.routerViewName,transition:l.transition,"scroll-distance":o.scrollDistance,"scroll-duration":l.scrollDuration,direction:l.direction,width:g.value},null,8,["class","style","name","transition","scroll-distance","scroll-duration","direction","width"])}}})},Symbol.toStringTag,{value:"Module"}));let mt="fox-";const pt=[],B=Object.assign({"/src/components/card-navigator/index.vue":z,"/src/components/default-navigator/index.vue":W,"/src/components/root-navigator/index.vue":tt,"/src/components/swiper-navigator/index.vue":ht}),Y=[];for(const t in B){let e=/src\/components\/(.*)\/index.vue/.exec(t)[1];pt.indexOf(e)===-1&&Y.push({name:e,component:B[t].default})}return{install(t){Y.forEach(e=>{t.component(`${mt}${e.name}`,e.component)})}}});
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fox-js/navigation",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "4.0.1-
|
|
5
|
-
"description": "fox navigation",
|
|
6
|
-
"author": "jiangcheng",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"fox",
|
|
9
|
-
"navigation"
|
|
10
|
-
],
|
|
11
|
-
"main": "./dist/index.umd.js",
|
|
12
|
-
"module": "./dist/index.esm.js",
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"style": "./dist/style.css",
|
|
15
|
-
"exports": {
|
|
16
|
-
".": {
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
18
|
-
"require": "./dist/index.umd.js",
|
|
19
|
-
"import": "./dist/index.esm.js"
|
|
20
|
-
},
|
|
21
|
-
"./style.css": "./dist/style.css",
|
|
22
|
-
"./*": "./*"
|
|
23
|
-
},
|
|
24
|
-
"license": "",
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"publish:next": "npm version prerelease && npm publish --tag next",
|
|
30
|
-
"build:dev": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode development",
|
|
31
|
-
"build:prod": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode production"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@fox-js/navigation",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "4.0.1-15",
|
|
5
|
+
"description": "fox navigation",
|
|
6
|
+
"author": "jiangcheng",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"fox",
|
|
9
|
+
"navigation"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.umd.js",
|
|
12
|
+
"module": "./dist/index.esm.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"style": "./dist/style.css",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"require": "./dist/index.umd.js",
|
|
19
|
+
"import": "./dist/index.esm.js"
|
|
20
|
+
},
|
|
21
|
+
"./style.css": "./dist/style.css",
|
|
22
|
+
"./*": "./*"
|
|
23
|
+
},
|
|
24
|
+
"license": "",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"publish:next": "npm version prerelease && npm publish --tag next",
|
|
30
|
+
"build:dev": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode development",
|
|
31
|
+
"build:prod": "vue-tsc --noEmit && vite build --config scripts/vite.config.ts --mode production"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {}
|
|
34
|
+
}
|