@nutui/nutui 3.1.22-beta.3 → 3.1.23-beta.0

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.
Files changed (207) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20426 -4050
  4. package/dist/nutui.umd.js +20529 -4049
  5. package/dist/packages/_es/ActionSheet.js +149 -36
  6. package/dist/packages/_es/Address.js +535 -129
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +64 -0
  9. package/dist/packages/_es/Audio.js +257 -72
  10. package/dist/packages/_es/AudioOperate.js +100 -32
  11. package/dist/packages/_es/Avatar.js +162 -54
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -24
  18. package/dist/packages/_es/CalendarItem.js +2 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -179
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +110 -24
  30. package/dist/packages/_es/CollapseItem.js +252 -80
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +25 -0
  33. package/dist/packages/_es/CountDown.js +238 -75
  34. package/dist/packages/_es/CountUp.js +539 -159
  35. package/dist/packages/_es/DatePicker.js +315 -117
  36. package/dist/packages/_es/Dialog.js +289 -79
  37. package/dist/packages/_es/Divider.js +65 -32
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -77
  41. package/dist/packages/_es/Ellipsis.js +206 -0
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +142 -0
  50. package/dist/packages/_es/ImagePreview.js +547 -84
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -76
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -37
  57. package/dist/packages/_es/Menu.js +168 -29
  58. package/dist/packages/_es/MenuItem.js +173 -34
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -93
  61. package/dist/packages/_es/Notify.js +227 -91
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -149
  64. package/dist/packages/_es/OverLay.js +98 -40
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +460 -148
  67. package/dist/packages/_es/Popover.js +957 -337
  68. package/dist/packages/_es/Popup.js +299 -74
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -100
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -102
  75. package/dist/packages/_es/Rate.js +193 -16
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -56
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -43
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -60
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -103
  84. package/dist/packages/_es/Step.js +115 -39
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -36
  88. package/dist/packages/_es/Swipe.js +178 -60
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -37
  96. package/dist/packages/_es/Tabs.js +202 -59
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -37
  100. package/dist/packages/_es/TimePannel.js +48 -33
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -90
  103. package/dist/packages/_es/Uploader.js +455 -120
  104. package/dist/packages/_es/Video.js +332 -93
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +783 -130
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/animate/index.scss +299 -0
  116. package/dist/packages/cell/index.scss +7 -1
  117. package/dist/packages/checkbox/index.scss +10 -0
  118. package/dist/packages/configprovider/index.scss +2 -0
  119. package/dist/packages/ellipsis/index.scss +12 -0
  120. package/dist/packages/formitem/index.scss +12 -0
  121. package/dist/packages/griditem/index.scss +11 -0
  122. package/dist/packages/image/index.scss +39 -0
  123. package/dist/packages/imagepreview/index.scss +26 -2
  124. package/dist/packages/input/index.scss +13 -0
  125. package/dist/packages/inputnumber/index.scss +21 -0
  126. package/dist/packages/locale/lang/baseLang.js +3 -3
  127. package/dist/packages/locale/lang/en-US.js +105 -5
  128. package/dist/packages/locale/lang/id-ID.js +105 -5
  129. package/dist/packages/locale/lang/index.js +38 -16
  130. package/dist/packages/locale/lang/zh-CN.js +105 -5
  131. package/dist/packages/locale/lang/zh-TW.js +105 -5
  132. package/dist/packages/menu/index.scss +45 -36
  133. package/dist/packages/menuitem/index.scss +4 -0
  134. package/dist/packages/navbar/index.scss +9 -0
  135. package/dist/packages/pagination/index.scss +19 -0
  136. package/dist/packages/radio/index.scss +18 -0
  137. package/dist/packages/range/index.scss +19 -0
  138. package/dist/packages/rate/index.scss +1 -1
  139. package/dist/packages/searchbar/index.scss +21 -0
  140. package/dist/packages/switch/index.scss +1 -0
  141. package/dist/packages/tabbar/index.scss +5 -0
  142. package/dist/packages/tabbaritem/index.scss +7 -0
  143. package/dist/packages/tabpane/index.scss +5 -0
  144. package/dist/packages/tabs/index.scss +22 -0
  145. package/dist/packages/textarea/index.scss +8 -0
  146. package/dist/smartips/attributes.json +140 -4
  147. package/dist/smartips/tags.json +55 -6
  148. package/dist/smartips/web-types.json +6963 -0
  149. package/dist/style.css +1 -1
  150. package/dist/style.es.js +1 -1
  151. package/dist/styles/font/config.json +3 -1
  152. package/dist/styles/font/demo_index.html +49 -3
  153. package/dist/styles/font/iconfont.css +11 -3
  154. package/dist/styles/font/iconfont.js +15 -15
  155. package/dist/styles/font/iconfont.json +14 -0
  156. package/dist/styles/font/iconfont.ttf +0 -0
  157. package/dist/styles/font/iconfont.woff +0 -0
  158. package/dist/styles/font/iconfont.woff2 +0 -0
  159. package/dist/styles/themes/default.scss +54 -50
  160. package/dist/styles/themes/jdb.scss +54 -50
  161. package/dist/styles/themes/jdt.scss +54 -50
  162. package/dist/styles/variables-jdb.scss +12 -0
  163. package/dist/styles/variables-jdt.scss +12 -0
  164. package/dist/styles/variables.scss +12 -0
  165. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  166. package/dist/types/__VUE/address/index.vue.d.ts +7 -7
  167. package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
  168. package/dist/types/__VUE/animate/type.d.ts +6 -0
  169. package/dist/types/__VUE/avatar/index.vue.d.ts +3 -3
  170. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  171. package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
  172. package/dist/types/__VUE/cascader/index.vue.d.ts +2 -2
  173. package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/collapse/index.vue.d.ts +3 -1
  175. package/dist/types/__VUE/configprovider/common.d.ts +20 -0
  176. package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
  177. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  178. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  179. package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
  180. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  181. package/dist/types/__VUE/grid/index.vue.d.ts +2 -2
  182. package/dist/types/__VUE/image/index.vue.d.ts +105 -0
  183. package/dist/types/__VUE/image/type.d.ts +6 -0
  184. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  185. package/dist/types/__VUE/imagepreview/index.vue.d.ts +56 -24
  186. package/dist/types/__VUE/menu/index.vue.d.ts +31 -4
  187. package/dist/types/__VUE/menuitem/index.vue.d.ts +12 -3
  188. package/dist/types/__VUE/noticebar/index.vue.d.ts +1 -1
  189. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  190. package/dist/types/__VUE/oldpicker/index.vue.d.ts +4 -4
  191. package/dist/types/__VUE/picker/index.vue.d.ts +4 -4
  192. package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
  193. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  194. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  195. package/dist/types/__VUE/rate/common.d.ts +149 -0
  196. package/dist/types/__VUE/rate/index.vue.d.ts +17 -7
  197. package/dist/types/__VUE/row/index.vue.d.ts +2 -2
  198. package/dist/types/__VUE/shortpassword/index.vue.d.ts +2 -2
  199. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  200. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  201. package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
  202. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  203. package/dist/types/__VUE/timeselect/index.vue.d.ts +3 -2
  204. package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
  205. package/dist/types/index.d.ts +1 -1
  206. package/dist/types/nutui.d.ts +5 -1
  207. package/package.json +5 -4
@@ -1,17 +1,20 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { defineComponent as e } from "vue";
7
- import t from "../locale/lang";
8
- const n = (e2) => {
9
- if (e2 === null)
6
+ import { defineComponent } from "vue";
7
+ import locale from "../locale/lang";
8
+ const TypeOfFun = (value) => {
9
+ if (value === null) {
10
10
  return "null";
11
- const t2 = typeof e2;
12
- if (t2 === "undefined" || t2 === "string")
13
- return t2;
14
- switch (toString.call(e2)) {
11
+ }
12
+ const type = typeof value;
13
+ if (type === "undefined" || type === "string") {
14
+ return type;
15
+ }
16
+ const typeString = toString.call(value);
17
+ switch (typeString) {
15
18
  case "[object Array]":
16
19
  return "array";
17
20
  case "[object Date]":
@@ -25,37 +28,75 @@ const n = (e2) => {
25
28
  case "[object RegExp]":
26
29
  return "regexp";
27
30
  case "[object Object]":
28
- return e2.nodeType !== void 0 ? e2.nodeType == 3 ? /\S/.test(e2.nodeValue) ? "textnode" : "whitespace" : "element" : "object";
31
+ if (value.nodeType !== void 0) {
32
+ if (value.nodeType == 3) {
33
+ return /\S/.test(value.nodeValue) ? "textnode" : "whitespace";
34
+ } else {
35
+ return "element";
36
+ }
37
+ } else {
38
+ return "object";
39
+ }
29
40
  default:
30
41
  return "unknow";
31
42
  }
32
- }, r = (e2) => typeof e2 == "function", a = (e2) => e2 !== null && typeof e2 == "object", c = (e2) => a(e2) && r(e2.then) && r(e2.catch), o = (e2, t2) => {
43
+ };
44
+ const isFunction = (val) => typeof val === "function";
45
+ const isObject = (val) => val !== null && typeof val === "object";
46
+ const isPromise = (val) => {
47
+ return isObject(val) && isFunction(val.then) && isFunction(val.catch);
48
+ };
49
+ const getPropByPath = (obj, keyPath) => {
33
50
  try {
34
- return t2.split(".").reduce((e3, t3) => e3[t3], e2);
35
- } catch (e3) {
51
+ return keyPath.split(".").reduce((prev, curr) => prev[curr], obj);
52
+ } catch (error) {
36
53
  return "";
37
54
  }
38
- }, s = (e2, t2, r2) => {
39
- let a2 = Object.assign({}, e2), c2 = Object.assign({}, r2);
40
- return Object.keys(t2).length > 0 ? (Object.keys(a2).forEach((e3) => {
41
- if (c2.hasOwnProperty(e3)) {
42
- const r3 = n(c2[e3]);
43
- r3 == "function" && (a2[e3] = c2[e3](t2)), r3 == "string" && (a2[e3] = t2[c2[e3]]);
44
- } else
45
- t2[e3] && (a2[e3] = t2[e3]);
46
- }), a2) : e2;
47
55
  };
48
- function u(n2) {
49
- const a2 = "nut-" + n2;
50
- return { componentName: a2, translate(e2, ...a3) {
51
- const c2 = t.languages(), s2 = o(c2, `${n2.replace("-", "")}.${e2}`) || o(c2, e2);
52
- return r(s2) ? s2(...a3) : s2;
53
- }, create: function(t2) {
54
- return t2.baseName = n2, t2.name = a2, t2.install = (e2) => {
55
- e2.component(t2.name, t2);
56
- }, e(t2);
57
- }, createDemo: function(t2) {
58
- return t2.baseName = n2, t2.name = "demo-" + n2, e(t2);
59
- } };
56
+ const floatData = (format, dataOp, mapOps) => {
57
+ let mergeFormat = Object.assign({}, format);
58
+ let mergeMapOps = Object.assign({}, mapOps);
59
+ if (Object.keys(dataOp).length > 0) {
60
+ Object.keys(mergeFormat).forEach((keys) => {
61
+ if (mergeMapOps.hasOwnProperty(keys)) {
62
+ const tof = TypeOfFun(mergeMapOps[keys]);
63
+ if (tof == "function") {
64
+ mergeFormat[keys] = mergeMapOps[keys](dataOp);
65
+ }
66
+ if (tof == "string") {
67
+ mergeFormat[keys] = dataOp[mergeMapOps[keys]];
68
+ }
69
+ } else {
70
+ if (dataOp[keys])
71
+ mergeFormat[keys] = dataOp[keys];
72
+ }
73
+ });
74
+ return mergeFormat;
75
+ }
76
+ return format;
77
+ };
78
+ function createComponent(name) {
79
+ const componentName = "nut-" + name;
80
+ return {
81
+ componentName,
82
+ translate(keyPath, ...args) {
83
+ const languages = locale.languages();
84
+ const text = getPropByPath(languages, `${name.replace("-", "")}.${keyPath}`) || getPropByPath(languages, keyPath);
85
+ return isFunction(text) ? text(...args) : text;
86
+ },
87
+ create: function(_component) {
88
+ _component.baseName = name;
89
+ _component.name = componentName;
90
+ _component.install = (vue) => {
91
+ vue.component(_component.name, _component);
92
+ };
93
+ return defineComponent(_component);
94
+ },
95
+ createDemo: function(_component) {
96
+ _component.baseName = name;
97
+ _component.name = "demo-" + name;
98
+ return defineComponent(_component);
99
+ }
100
+ };
60
101
  }
61
- export { n as T, c as a, u as c, s as f, o as g, a as i };
102
+ export { TypeOfFun as T, isPromise as a, createComponent as c, floatData as f, getPropByPath as g, isObject as i };
@@ -1,10 +1,11 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { getCurrentInstance as r } from "vue";
7
- function o() {
8
- return r().proxy.$router || null;
6
+ import { getCurrentInstance } from "vue";
7
+ function useRouter() {
8
+ const proxy = getCurrentInstance().proxy;
9
+ return proxy.$router || null;
9
10
  }
10
- export { o as u };
11
+ export { useRouter as u };
@@ -1,15 +1,36 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { unref as t } from "vue";
7
- const e = (e2) => {
8
- const i = t(e2);
9
- if (i === window) {
10
- const t2 = i.innerWidth, e3 = i.innerHeight;
11
- return { top: 0, left: 0, right: t2, bottom: e3, width: t2, height: e3 };
6
+ import { unref } from "vue";
7
+ function isWindow(val) {
8
+ return val === window;
9
+ }
10
+ const useRect = (elementRef) => {
11
+ const element = unref(elementRef);
12
+ if (isWindow(element)) {
13
+ const width = element.innerWidth;
14
+ const height = element.innerHeight;
15
+ return {
16
+ top: 0,
17
+ left: 0,
18
+ right: width,
19
+ bottom: height,
20
+ width,
21
+ height
22
+ };
12
23
  }
13
- return i && i.getBoundingClientRect ? i.getBoundingClientRect() : { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0 };
24
+ if (element && element.getBoundingClientRect) {
25
+ return element.getBoundingClientRect();
26
+ }
27
+ return {
28
+ top: 0,
29
+ left: 0,
30
+ right: 0,
31
+ bottom: 0,
32
+ width: 0,
33
+ height: 0
34
+ };
14
35
  };
15
- export { e as u };
36
+ export { useRect as u };
@@ -1,11 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { getCurrentInstance as o } from "vue";
7
- function t(t2) {
8
- const n = o();
9
- n && Object.assign(n.proxy, t2);
6
+ import { getCurrentInstance } from "vue";
7
+ function useExpose(apis) {
8
+ const instance = getCurrentInstance();
9
+ if (instance) {
10
+ Object.assign(instance.proxy, apis);
11
+ }
10
12
  }
11
- export { t as u };
13
+ export { useExpose as u };
@@ -1,19 +1,70 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as e } from "vue";
7
- function a() {
8
- const a2 = e(0), l = e(0), t = e(0), u = e(0), v = e(0), o = e(0), r = e(""), i = () => {
9
- t.value = 0, u.value = 0, v.value = 0, o.value = 0, r.value = "";
6
+ import { ref } from "vue";
7
+ const MIN_DISTANCE = 10;
8
+ function getDirection(x, y) {
9
+ if (x > y && x > MIN_DISTANCE) {
10
+ return "horizontal";
11
+ }
12
+ if (y > x && y > MIN_DISTANCE) {
13
+ return "vertical";
14
+ }
15
+ return "";
16
+ }
17
+ function useTouch() {
18
+ const startX = ref(0);
19
+ const startY = ref(0);
20
+ const moveX = ref(0);
21
+ const moveY = ref(0);
22
+ const deltaX = ref(0);
23
+ const deltaY = ref(0);
24
+ const offsetX = ref(0);
25
+ const offsetY = ref(0);
26
+ const direction = ref("");
27
+ const isVertical = () => direction.value === "vertical";
28
+ const isHorizontal = () => direction.value === "horizontal";
29
+ const reset = () => {
30
+ deltaX.value = 0;
31
+ deltaY.value = 0;
32
+ offsetX.value = 0;
33
+ offsetY.value = 0;
34
+ direction.value = "";
35
+ };
36
+ const start = (event) => {
37
+ reset();
38
+ startX.value = event.touches[0].clientX;
39
+ startY.value = event.touches[0].clientY;
40
+ };
41
+ const move = (event) => {
42
+ const touch = event.touches[0];
43
+ deltaX.value = touch.clientX - startX.value;
44
+ deltaY.value = touch.clientY - startY.value;
45
+ moveX.value = touch.clientX;
46
+ moveY.value = touch.clientY;
47
+ offsetX.value = Math.abs(deltaX.value);
48
+ offsetY.value = Math.abs(deltaY.value);
49
+ if (!direction.value) {
50
+ direction.value = getDirection(offsetX.value, offsetY.value);
51
+ }
52
+ };
53
+ return {
54
+ move,
55
+ start,
56
+ reset,
57
+ startX,
58
+ startY,
59
+ moveX,
60
+ moveY,
61
+ deltaX,
62
+ deltaY,
63
+ offsetX,
64
+ offsetY,
65
+ direction,
66
+ isVertical,
67
+ isHorizontal
10
68
  };
11
- return { move: (e2) => {
12
- const i2 = e2.touches[0];
13
- var s, c;
14
- t.value = i2.clientX - a2.value, u.value = i2.clientY - l.value, v.value = Math.abs(t.value), o.value = Math.abs(u.value), r.value || (r.value = (s = v.value, c = o.value, s > c && s > 10 ? "horizontal" : c > s && c > 10 ? "vertical" : ""));
15
- }, start: (e2) => {
16
- i(), a2.value = e2.touches[0].clientX, l.value = e2.touches[0].clientY;
17
- }, reset: i, startX: a2, startY: l, deltaX: t, deltaY: u, offsetX: v, offsetY: o, direction: r, isVertical: () => r.value === "vertical", isHorizontal: () => r.value === "horizontal" };
18
69
  }
19
- export { a as u };
70
+ export { useTouch as u };