y-design-ssr 0.1.1 → 0.2.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 (224) hide show
  1. package/README.md +12 -1
  2. package/libs/button/index.css +1 -0
  3. package/libs/button/index.mjs +152 -0
  4. package/libs/button/index.umd.js +2 -0
  5. package/libs/button/package.json +5 -0
  6. package/libs/cell/index.css +1 -0
  7. package/libs/cell/index.mjs +231 -0
  8. package/libs/cell/index.umd.js +2 -0
  9. package/libs/cell/package.json +5 -0
  10. package/libs/checkbox/index.css +1 -0
  11. package/libs/checkbox/index.mjs +248 -0
  12. package/libs/checkbox/index.umd.js +2 -0
  13. package/libs/checkbox/package.json +5 -0
  14. package/libs/checkboxGroup/index.css +1 -0
  15. package/libs/checkboxGroup/index.mjs +173 -0
  16. package/libs/checkboxGroup/index.umd.js +2 -0
  17. package/libs/checkboxGroup/package.json +5 -0
  18. package/libs/col/index.css +1 -0
  19. package/libs/col/index.mjs +134 -0
  20. package/libs/col/index.umd.js +2 -0
  21. package/libs/col/package.json +5 -0
  22. package/libs/countdown/index.css +1 -0
  23. package/libs/countdown/index.mjs +117 -0
  24. package/libs/countdown/index.umd.js +2 -0
  25. package/libs/countdown/package.json +5 -0
  26. package/libs/dialog/index.css +1 -0
  27. package/libs/dialog/index.mjs +952 -0
  28. package/libs/dialog/index.umd.js +2 -0
  29. package/libs/dialog/package.json +5 -0
  30. package/libs/empty/index.css +1 -0
  31. package/libs/empty/index.mjs +86 -0
  32. package/libs/empty/index.umd.js +2 -0
  33. package/libs/empty/package.json +5 -0
  34. package/libs/form/index.css +1 -0
  35. package/libs/form/index.mjs +213 -0
  36. package/libs/form/index.umd.js +2 -0
  37. package/libs/form/package.json +5 -0
  38. package/libs/formItem/index.css +1 -0
  39. package/libs/formItem/index.mjs +216 -0
  40. package/libs/formItem/index.umd.js +2 -0
  41. package/libs/formItem/package.json +5 -0
  42. package/libs/icon/index.css +1 -0
  43. package/libs/icon/index.mjs +131 -0
  44. package/libs/icon/index.umd.js +2 -0
  45. package/libs/icon/package.json +5 -0
  46. package/libs/index.css +1 -154
  47. package/libs/index.mjs +2348 -3788
  48. package/libs/index.umd.js +2 -5505
  49. package/libs/input/index.css +1 -0
  50. package/libs/input/index.mjs +177 -0
  51. package/libs/input/index.umd.js +2 -0
  52. package/libs/input/package.json +5 -0
  53. package/libs/layout/index.css +1 -0
  54. package/libs/layout/index.mjs +212 -0
  55. package/libs/layout/index.umd.js +2 -0
  56. package/libs/layout/package.json +5 -0
  57. package/libs/list/index.css +1 -0
  58. package/libs/list/index.mjs +384 -0
  59. package/libs/list/index.umd.js +2 -0
  60. package/libs/list/package.json +5 -0
  61. package/libs/loading/index.css +1 -0
  62. package/libs/loading/index.mjs +237 -0
  63. package/libs/loading/index.umd.js +2 -0
  64. package/libs/loading/package.json +5 -0
  65. package/libs/mask/index.css +1 -0
  66. package/libs/mask/index.mjs +134 -0
  67. package/libs/mask/index.umd.js +2 -0
  68. package/libs/mask/package.json +5 -0
  69. package/libs/popup/index.css +1 -0
  70. package/libs/popup/index.mjs +276 -0
  71. package/libs/popup/index.umd.js +2 -0
  72. package/libs/popup/package.json +5 -0
  73. package/libs/progress/index.css +1 -0
  74. package/libs/progress/index.mjs +244 -0
  75. package/libs/progress/index.umd.js +2 -0
  76. package/libs/progress/package.json +5 -0
  77. package/libs/pullrefresh/index.css +1 -0
  78. package/libs/pullrefresh/index.mjs +166 -0
  79. package/libs/pullrefresh/index.umd.js +2 -0
  80. package/libs/pullrefresh/package.json +5 -0
  81. package/libs/row/index.css +1 -0
  82. package/libs/row/index.mjs +139 -0
  83. package/libs/row/index.umd.js +2 -0
  84. package/libs/row/package.json +5 -0
  85. package/libs/slider/index.css +1 -0
  86. package/libs/slider/index.mjs +251 -0
  87. package/libs/slider/index.umd.js +2 -0
  88. package/libs/slider/package.json +5 -0
  89. package/libs/stepper/index.css +1 -0
  90. package/libs/stepper/index.mjs +183 -0
  91. package/libs/stepper/index.umd.js +2 -0
  92. package/libs/stepper/package.json +5 -0
  93. package/libs/swipe/index.css +1 -0
  94. package/libs/swipe/index.mjs +414 -0
  95. package/libs/swipe/index.umd.js +2 -0
  96. package/libs/swipe/package.json +5 -0
  97. package/libs/swipeItem/index.css +1 -0
  98. package/libs/swipeItem/index.mjs +89 -0
  99. package/libs/swipeItem/index.umd.js +2 -0
  100. package/libs/swipeItem/package.json +5 -0
  101. package/libs/switch/index.css +1 -0
  102. package/libs/switch/index.mjs +135 -0
  103. package/libs/switch/index.umd.js +2 -0
  104. package/libs/switch/package.json +5 -0
  105. package/libs/tab/index.mjs +124 -0
  106. package/libs/tab/index.umd.js +1 -0
  107. package/libs/tab/package.json +5 -0
  108. package/libs/tabs/index.css +1 -0
  109. package/libs/tabs/index.mjs +673 -0
  110. package/libs/tabs/index.umd.js +2 -0
  111. package/libs/tabs/package.json +5 -0
  112. package/libs/toast/index.css +1 -0
  113. package/libs/toast/index.mjs +231 -0
  114. package/libs/toast/index.umd.js +2 -0
  115. package/libs/toast/package.json +5 -0
  116. package/libs/tooltip/index.css +1 -0
  117. package/libs/tooltip/index.mjs +272 -0
  118. package/libs/tooltip/index.umd.js +2 -0
  119. package/libs/tooltip/package.json +5 -0
  120. package/libs/types/{button → components/button}/index.d.ts +1 -0
  121. package/libs/types/{button → components/button}/src/button.d.ts +1 -1
  122. package/libs/types/{cell → components/cell}/src/cell.d.ts +1 -1
  123. package/libs/types/{dialog → components/dialog}/src/dialog.d.ts +1 -1
  124. package/libs/types/{loading → components/loading}/src/loading.d.ts +1 -1
  125. package/libs/types/{popup → components/popup}/src/popup.d.ts +1 -1
  126. package/libs/types/{row → components/row}/src/row.d.ts +1 -1
  127. package/libs/types/{switch → components/switch}/src/switch.d.ts +1 -1
  128. package/libs/types/{toast → components/toast}/src/toast.d.ts +1 -1
  129. package/libs/types/index.d.ts +27 -27
  130. package/package.json +6 -6
  131. package/libs/component-props.json +0 -1
  132. package/libs/demo/button.json +0 -1
  133. package/libs/demo/cell.json +0 -1
  134. package/libs/demo/checkbox.json +0 -1
  135. package/libs/demo/countdown.json +0 -1
  136. package/libs/demo/dialog.json +0 -1
  137. package/libs/demo/empty.json +0 -1
  138. package/libs/demo/form.json +0 -1
  139. package/libs/demo/icon.json +0 -1
  140. package/libs/demo/input.json +0 -1
  141. package/libs/demo/layout.json +0 -1
  142. package/libs/demo/list.json +0 -1
  143. package/libs/demo/loading.json +0 -1
  144. package/libs/demo/mask.json +0 -1
  145. package/libs/demo/popup.json +0 -1
  146. package/libs/demo/progress.json +0 -1
  147. package/libs/demo/pullrefresh.json +0 -1
  148. package/libs/demo/slider.json +0 -1
  149. package/libs/demo/stepper.json +0 -1
  150. package/libs/demo/style.json +0 -1
  151. package/libs/demo/swipe.json +0 -1
  152. package/libs/demo/switch.json +0 -1
  153. package/libs/demo/tabs.json +0 -1
  154. package/libs/demo/toast.json +0 -1
  155. package/libs/demo/tooltip.json +0 -1
  156. package/libs/index.fa0c1ff.js +0 -2
  157. package/libs/index.fa0c1ff.js.LICENSE.txt +0 -19
  158. package/libs/index.html +0 -1
  159. package/libs/runtime.bfd6297.js +0 -1
  160. package/libs/style.css +0 -2837
  161. package/libs/vendor.025080b.js +0 -2
  162. package/libs/vendor.025080b.js.LICENSE.txt +0 -5
  163. /package/libs/types/{cell → components/cell}/index.d.ts +0 -0
  164. /package/libs/types/{checkbox → components/checkbox}/index.d.ts +0 -0
  165. /package/libs/types/{checkbox → components/checkbox}/src/checkbox.d.ts +0 -0
  166. /package/libs/types/{checkboxGroup → components/checkboxGroup}/index.d.ts +0 -0
  167. /package/libs/types/{checkboxGroup → components/checkboxGroup}/src/checkboxGroup.d.ts +0 -0
  168. /package/libs/types/{checkboxGroup → components/checkboxGroup}/src/constants.d.ts +0 -0
  169. /package/libs/types/{col → components/col}/index.d.ts +0 -0
  170. /package/libs/types/{col → components/col}/src/col.d.ts +0 -0
  171. /package/libs/types/{countdown → components/countdown}/index.d.ts +0 -0
  172. /package/libs/types/{countdown → components/countdown}/src/count-down.d.ts +0 -0
  173. /package/libs/types/{dialog → components/dialog}/index.d.ts +0 -0
  174. /package/libs/types/{dialog → components/dialog}/src/create.d.ts +0 -0
  175. /package/libs/types/{empty → components/empty}/index.d.ts +0 -0
  176. /package/libs/types/{empty → components/empty}/src/empty.d.ts +0 -0
  177. /package/libs/types/{empty → components/empty}/src/utils.d.ts +0 -0
  178. /package/libs/types/{form → components/form}/index.d.ts +0 -0
  179. /package/libs/types/{form → components/form}/src/constants.d.ts +0 -0
  180. /package/libs/types/{form → components/form}/src/form.d.ts +0 -0
  181. /package/libs/types/{formItem → components/formItem}/index.d.ts +0 -0
  182. /package/libs/types/{formItem → components/formItem}/src/formItem.d.ts +0 -0
  183. /package/libs/types/{icon → components/icon}/index.d.ts +0 -0
  184. /package/libs/types/{icon → components/icon}/src/icon.d.ts +0 -0
  185. /package/libs/types/{input → components/input}/index.d.ts +0 -0
  186. /package/libs/types/{input → components/input}/src/input.d.ts +0 -0
  187. /package/libs/types/{list → components/list}/index.d.ts +0 -0
  188. /package/libs/types/{list → components/list}/src/list.d.ts +0 -0
  189. /package/libs/types/{loading → components/loading}/index.d.ts +0 -0
  190. /package/libs/types/{loading → components/loading}/src/create.d.ts +0 -0
  191. /package/libs/types/{loading → components/loading}/src/directive.d.ts +0 -0
  192. /package/libs/types/{mask → components/mask}/index.d.ts +0 -0
  193. /package/libs/types/{mask → components/mask}/src/mask.d.ts +0 -0
  194. /package/libs/types/{popup → components/popup}/index.d.ts +0 -0
  195. /package/libs/types/{progress → components/progress}/index.d.ts +0 -0
  196. /package/libs/types/{progress → components/progress}/src/progress.d.ts +0 -0
  197. /package/libs/types/{pullrefresh → components/pullrefresh}/index.d.ts +0 -0
  198. /package/libs/types/{pullrefresh → components/pullrefresh}/src/pullrefresh.d.ts +0 -0
  199. /package/libs/types/{pullrefresh → components/pullrefresh}/src/utils.d.ts +0 -0
  200. /package/libs/types/{row → components/row}/index.d.ts +0 -0
  201. /package/libs/types/{row → components/row}/src/constants.d.ts +0 -0
  202. /package/libs/types/{slider → components/slider}/index.d.ts +0 -0
  203. /package/libs/types/{slider → components/slider}/src/slider.d.ts +0 -0
  204. /package/libs/types/{stepper → components/stepper}/index.d.ts +0 -0
  205. /package/libs/types/{stepper → components/stepper}/src/stepper.d.ts +0 -0
  206. /package/libs/types/{swipe → components/swipe}/index.d.ts +0 -0
  207. /package/libs/types/{swipe → components/swipe}/src/constants.d.ts +0 -0
  208. /package/libs/types/{swipe → components/swipe}/src/swipe.d.ts +0 -0
  209. /package/libs/types/{swipeItem → components/swipeItem}/index.d.ts +0 -0
  210. /package/libs/types/{swipeItem → components/swipeItem}/src/swipeItem.d.ts +0 -0
  211. /package/libs/types/{switch → components/switch}/index.d.ts +0 -0
  212. /package/libs/types/{tab → components/tab}/index.d.ts +0 -0
  213. /package/libs/types/{tab → components/tab}/src/tab.d.ts +0 -0
  214. /package/libs/types/{tabs → components/tabs}/index.d.ts +0 -0
  215. /package/libs/types/{tabs → components/tabs}/src/constants.d.ts +0 -0
  216. /package/libs/types/{tabs → components/tabs}/src/tabs.d.ts +0 -0
  217. /package/libs/types/{tabs → components/tabs}/src/title.d.ts +0 -0
  218. /package/libs/types/{toast → components/toast}/index.d.ts +0 -0
  219. /package/libs/types/{toast → components/toast}/src/create.d.ts +0 -0
  220. /package/libs/types/{tooltip → components/tooltip}/index.d.ts +0 -0
  221. /package/libs/types/{tooltip → components/tooltip}/src/constants.d.ts +0 -0
  222. /package/libs/types/{tooltip → components/tooltip}/src/direactive.d.ts +0 -0
  223. /package/libs/types/{tooltip → components/tooltip}/src/popper.d.ts +0 -0
  224. /package/libs/types/{tooltip → components/tooltip}/src/tooltip.d.ts +0 -0
@@ -0,0 +1,673 @@
1
+ import { ref as z, reactive as N, getCurrentInstance as ie, provide as Se, isVNode as re, inject as Ne, onUnmounted as Ce, computed as C, defineComponent as H, createVNode as b, watch as ee, onMounted as ce, nextTick as te, onBeforeUnmount as Te, onBeforeUpdate as ze } from "vue";
2
+ const V = (e, n) => n ? typeof n == "string" ? ` ${e}--${n}` : Array.isArray(n) ? n.reduce((o, l) => o + V(e, l), "") : Object.keys(n).reduce(
3
+ (o, l) => o + (n[l] ? V(e, l) : ""),
4
+ ""
5
+ ) : "", Ee = (e) => (n, o) => {
6
+ let l = n, v = o;
7
+ return l && typeof l != "string" && (v = l, l = ""), l = l ? `${e}__${l}` : e, `${l}${V(l, v)}`;
8
+ }, Le = () => (e, n) => n ? `${V(`y-${e}`, n)}` : `y-${e}`, $e = {
9
+ "pull-refresh": {
10
+ pulling: "下拉刷新...",
11
+ loosing: "释放刷新...",
12
+ loading: "数据加载中...",
13
+ success: "数据已更新",
14
+ failed: "数据跟新失败,请稍后再试"
15
+ },
16
+ "form-item": {
17
+ validateMessage: "请输入正确内容"
18
+ }
19
+ };
20
+ z("zh-CN");
21
+ N({
22
+ "zh-CN": $e
23
+ });
24
+ const U = (e) => {
25
+ const n = `y-${e}`;
26
+ return [n, Ee(n), Le()];
27
+ }, ae = (e, n) => typeof e == "string" && e.includes("%") && e.includes("%") ? n * Number(e.replace(/%/g, "")) / 100 : Number(e), xe = (e) => {
28
+ const n = [], o = (l) => {
29
+ Array.isArray(l) && l.forEach((v) => {
30
+ var u;
31
+ re(v) && (n.push(v), (u = v.component) != null && u.subTree && o(v.component.subTree.children), v.children && o(v.children));
32
+ });
33
+ };
34
+ return o(e), n;
35
+ }, Ie = (e, n) => {
36
+ const o = xe(n.subTree.children);
37
+ e.sort((l, v) => o.indexOf(l.vnode) - o.indexOf(v.vnode));
38
+ }, ue = (e) => {
39
+ const n = ie(), o = N([]);
40
+ return {
41
+ childrens: o,
42
+ initProvide: (v) => {
43
+ Se(e, {
44
+ addChild: (s) => {
45
+ s.proxy && (o.push(s), n && Ie(o, n));
46
+ },
47
+ removeChild: (s) => {
48
+ const f = o.indexOf(s);
49
+ o.splice(f, 1);
50
+ },
51
+ childrens: o,
52
+ ...v
53
+ });
54
+ }
55
+ };
56
+ }, fe = (e) => {
57
+ const n = Ne(e, null), o = ie();
58
+ if (n && o) {
59
+ const { childrens: l, addChild: v, removeChild: u } = n;
60
+ return v(o), Ce(() => u(o)), {
61
+ index: C(() => l.indexOf(o)),
62
+ parent: n
63
+ };
64
+ }
65
+ return {
66
+ parent: null,
67
+ index: z(-1)
68
+ };
69
+ }, [Be, De] = U("swipe-item"), K = /* @__PURE__ */ H({
70
+ name: Be,
71
+ props: {
72
+ clonenNode: {
73
+ type: Object,
74
+ default: null
75
+ },
76
+ index: {
77
+ type: Number,
78
+ default: -1
79
+ }
80
+ },
81
+ setup(e, {
82
+ slots: n
83
+ }) {
84
+ const o = ie(), {
85
+ parent: l
86
+ } = fe(ve);
87
+ !e.clonenNode && o && (l == null || l.children.push(o));
88
+ const v = C(() => e.clonenNode ? e.index : l == null ? void 0 : l.children.findIndex((c) => c.proxy === (o == null ? void 0 : o.proxy))), u = C(() => {
89
+ const c = `${(l == null ? void 0 : l.itemDetail.size) || 0}px`;
90
+ let s = "auto";
91
+ const f = `${(l == null ? void 0 : l.itemDetail.space) || 0}px`;
92
+ return l != null && l.props.autoHeight && (l == null ? void 0 : l.activeIndex) !== v.value && (s = "0"), l != null && l.props.vertical ? {
93
+ height: c,
94
+ width: s,
95
+ marginBottom: f
96
+ } : {
97
+ width: c,
98
+ height: s,
99
+ marginRight: f
100
+ };
101
+ });
102
+ return () => {
103
+ var s, f;
104
+ const c = ((s = l == null ? void 0 : l.itemShowedList) == null ? void 0 : s.list[v.value || 0]) || !1;
105
+ return b("div", {
106
+ class: De(),
107
+ style: u.value
108
+ }, [c ? e.clonenNode || ((f = n.default) == null ? void 0 : f.call(n)) : null]);
109
+ };
110
+ }
111
+ });
112
+ var ne = /* @__PURE__ */ ((e) => (e.left = "left", e.top = "top", e.bottom = "bottom", e.right = "right", e))(ne || {}), W = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(W || {});
113
+ const ke = {
114
+ autoplayTime: {
115
+ type: Number,
116
+ default: 0
117
+ },
118
+ duration: {
119
+ type: Number,
120
+ default: 300
121
+ },
122
+ initIndex: {
123
+ type: Number,
124
+ default: 0
125
+ },
126
+ loop: {
127
+ type: Boolean,
128
+ default: !0
129
+ },
130
+ dots: {
131
+ type: Boolean,
132
+ default: !0
133
+ },
134
+ dotsPosition: {
135
+ type: String,
136
+ default: null
137
+ },
138
+ dotsColor: {
139
+ type: String,
140
+ default: ""
141
+ },
142
+ lazy: {
143
+ type: Boolean,
144
+ default: !1
145
+ },
146
+ vertical: {
147
+ type: Boolean,
148
+ default: !1
149
+ },
150
+ autoHeight: {
151
+ type: Boolean,
152
+ default: !1
153
+ },
154
+ itemSize: {
155
+ type: [Number, String],
156
+ default: ""
157
+ },
158
+ itemSpace: {
159
+ type: [Number, String],
160
+ default: 0
161
+ },
162
+ minSwipeDistance: {
163
+ type: [Number, String],
164
+ default: "50%"
165
+ },
166
+ touchable: {
167
+ type: Boolean,
168
+ default: !0
169
+ },
170
+ isFollowHand: {
171
+ type: Boolean,
172
+ default: !0
173
+ },
174
+ align: {
175
+ type: String,
176
+ default: "center"
177
+ }
178
+ }, [de, q] = U("swipe"), ve = de, _e = /* @__PURE__ */ H({
179
+ name: de,
180
+ components: {
181
+ YSwipeItem: K
182
+ },
183
+ props: ke,
184
+ setup(e, {
185
+ slots: n,
186
+ emit: o,
187
+ expose: l
188
+ }) {
189
+ const {
190
+ initProvide: v
191
+ } = ue(ve), u = N([]), c = z(Number(e.initIndex)), s = N({
192
+ // 元素尺寸
193
+ size: 0,
194
+ // 间距
195
+ space: 0,
196
+ // 元素宽度比swipe小,占满整个视窗
197
+ isFillViewport: !1
198
+ }), f = N({
199
+ // 偏移量
200
+ offset: 0,
201
+ // 视窗大小
202
+ viewportSize: 0,
203
+ // 重复节点个数
204
+ cloneNodeCount: 0
205
+ }), T = z(), g = z(), B = () => {
206
+ const t = u.length, a = [];
207
+ for (let m = 0; m < t; m++)
208
+ a.push(!e.lazy);
209
+ return a;
210
+ }, R = () => {
211
+ if (!e.lazy)
212
+ return;
213
+ const t = s.size + s.space, a = u.length * t;
214
+ let m = -(f.offset + r.offset) - f.cloneNodeCount * t;
215
+ m < 0 && (m += a);
216
+ const w = m + f.viewportSize;
217
+ for (let y = 0; y < u.length; y++)
218
+ if (!k.list[y]) {
219
+ const S = t * y, E = S + s.size;
220
+ (S >= m && S < w || E > m && E < w || S < m && E > w) && (k.list[y] = !0);
221
+ }
222
+ }, k = N({
223
+ list: B()
224
+ }), p = () => {
225
+ k.list = B(), R();
226
+ };
227
+ ee(() => [...u], p);
228
+ const D = (t, a) => {
229
+ t ? s.size = ae(t, a) : s.size = a, s.space = Number(e.itemSpace) || 0, s.isFillViewport = s.size >= a, f.viewportSize = a, f.cloneNodeCount = G();
230
+ }, G = () => {
231
+ if (x.value) {
232
+ const t = s.size + s.space;
233
+ if (t === 0)
234
+ return 0;
235
+ const a = f.viewportSize * 2 - t, m = Math.ceil(a / t);
236
+ return Math.min(m, u.length - 1);
237
+ }
238
+ return 0;
239
+ }, L = () => {
240
+ if (!T.value)
241
+ return;
242
+ const {
243
+ width: t,
244
+ height: a
245
+ } = T.value.getBoundingClientRect();
246
+ e.vertical ? D(e.itemSize, a) : D(e.itemSize, t), c.value = c.value >= u.length ? u.length - 1 : c.value, c.value < 0 && (c.value = 0), I(c.value), p(), h();
247
+ };
248
+ ce(() => {
249
+ if (te(L).catch(() => {
250
+ }), e.touchable && T.value) {
251
+ const t = T.value;
252
+ t.addEventListener("touchstart", M, !1), t.addEventListener("mousedown", M, !1), t.addEventListener("touchmove", P, !1), t.addEventListener("mousemove", P, !1), t.addEventListener("touchend", $, !1), t.addEventListener("mouseup", $, !1), t.addEventListener("mouseleave", $, !1), t.addEventListener("touchcancel", $, !1);
253
+ }
254
+ window.addEventListener("resize", L, !1), window.addEventListener("orientationchange", L, !1);
255
+ }), Te(() => {
256
+ if (d(), e.touchable && T.value) {
257
+ const t = T.value;
258
+ t.removeEventListener("touchstart", M, !1), t.removeEventListener("mousedown", M, !1), t.removeEventListener("mousemove", P, !1), t.removeEventListener("touchmove", P, !1), t.removeEventListener("mouseup", $, !1), t.removeEventListener("touchend", $, !1), t.removeEventListener("mouseleave", $, !1), t.removeEventListener("touchcancel", $, !1);
259
+ }
260
+ window.removeEventListener("resize", L, !1), window.removeEventListener("orientationchange", L, !1);
261
+ });
262
+ const j = C(() => {
263
+ let t = 0;
264
+ switch (e.align) {
265
+ case W.start:
266
+ t = 0;
267
+ break;
268
+ case W.center:
269
+ t = (f.viewportSize - s.size) / 2;
270
+ break;
271
+ case W.end:
272
+ t = f.viewportSize - s.size;
273
+ break;
274
+ default:
275
+ t = 0;
276
+ }
277
+ return t;
278
+ }), x = C(() => e.loop && u.length > 1), I = (t) => {
279
+ const a = s.size + s.space;
280
+ x.value ? f.offset = -a * (t + f.cloneNodeCount) + j.value : (f.offset = -a * t + j.value, e.align !== "center" && (t === 0 && (f.offset = 0), t === u.length - 1 && (f.offset = -a * t + f.viewportSize - s.size)));
281
+ }, F = () => {
282
+ I(c.value), o("afterChange", c.value);
283
+ }, _ = (t) => (u.length + t) % u.length, A = (t, a = !0) => {
284
+ c.value = _(t), I(t), R(), o("change", c.value), a ? (r.transitionEnabled = !0, g.value && g.value.addEventListener("transitionend", () => {
285
+ r.transitionEnabled = !1, F();
286
+ }, {
287
+ once: !0
288
+ })) : F();
289
+ }, Y = (t = !0) => {
290
+ A(c.value - 1, t);
291
+ }, O = (t = !0) => {
292
+ A(c.value + 1, t);
293
+ };
294
+ let i = null;
295
+ const d = () => {
296
+ e.autoplayTime && i && clearInterval(i);
297
+ }, h = () => {
298
+ e.autoplayTime && u.length > 1 && (i && clearInterval(i), i = setInterval(() => {
299
+ O();
300
+ }, Number(e.autoplayTime)));
301
+ }, r = N({
302
+ // 拖拽中
303
+ isDragging: !1,
304
+ // 是否首次拖动
305
+ isFirstTouch: !0,
306
+ // 拖拽起始位置X
307
+ startX: 0,
308
+ // 拖拽起始位置Y
309
+ startY: 0,
310
+ // 拖拽距离
311
+ offset: 0,
312
+ // 开始拖动时间
313
+ startTime: /* @__PURE__ */ new Date(),
314
+ // 是否在执行动画
315
+ transitionEnabled: !1
316
+ }), M = (t) => {
317
+ if (r.transitionEnabled)
318
+ return;
319
+ let a = 0, m = 0;
320
+ "touches" in t ? (a = t.touches[0].clientX, m = t.touches[0].clientY) : (a = t.clientX, m = t.clientY), r.startX = a, r.startY = m, r.isDragging = !0, r.isFirstTouch = !0, r.startTime = /* @__PURE__ */ new Date();
321
+ }, P = (t) => {
322
+ if (!r.isDragging)
323
+ return;
324
+ let a = 0, m = 0;
325
+ "touches" in t ? (a = t.touches[0].clientX, m = t.touches[0].clientY) : (a = t.clientX, m = t.clientY);
326
+ const w = a - r.startX, y = m - r.startY;
327
+ if (r.isFirstTouch && (r.isFirstTouch = !1, Math.abs(w) < Math.abs(y) !== e.vertical)) {
328
+ r.isDragging = !1;
329
+ return;
330
+ }
331
+ t.preventDefault(), r.offset = e.vertical ? y : w, R(), o("dragging", {
332
+ percent: r.offset / (s.size + s.space),
333
+ offset: r.offset
334
+ });
335
+ }, $ = () => {
336
+ if (!r.isDragging)
337
+ return;
338
+ r.isDragging = !1;
339
+ const a = (/* @__PURE__ */ new Date()).getTime() - r.startTime.getTime();
340
+ ge() && (Math.abs(r.offset) > he.value || Math.abs(r.offset) / a > 0.5) && (r.offset > 0 ? Y() : O()), r.offset = 0, h();
341
+ }, he = C(() => ae(e.minSwipeDistance, s.size + s.space)), ge = () => {
342
+ if (x.value)
343
+ return !0;
344
+ const t = r.offset > 0 ? c.value - 1 : c.value + 1;
345
+ return t >= 0 && t < u.length;
346
+ }, ye = C(() => {
347
+ const t = r.isDragging && !e.isFollowHand ? f.offset : f.offset + r.offset, a = {};
348
+ return e.vertical ? (a.transform = `translate3d(0, ${t}px, 0)`, a.transitionDuration = r.transitionEnabled ? `${e.duration}ms` : "0ms") : (a.transform = `translate3d(${t}px, 0, 0)`, a.transitionDuration = r.transitionEnabled ? `${e.duration}ms` : "0ms"), r.isDragging && (a.transition = "none"), e.vertical && (a.flexDirection = "column"), e.autoHeight && (a.display = "block", a.whiteSpace = "nowrap"), a;
349
+ }), be = C(() => ["y-swipe__dots", `y-swipe__dots--${e.dotsPosition || (e.vertical ? ne.left : ne.bottom)}`]);
350
+ l({
351
+ moveTo: A,
352
+ next: O,
353
+ prev: Y,
354
+ resize: L
355
+ });
356
+ const we = N({
357
+ children: u,
358
+ activeIndex: c,
359
+ props: e,
360
+ itemDetail: s,
361
+ itemShowedList: k
362
+ });
363
+ v(we);
364
+ const pe = () => e.dots ? b("div", {
365
+ class: be.value
366
+ }, [u.map((t, a) => {
367
+ const m = q("dot", {
368
+ active: a === c.value
369
+ });
370
+ return b("div", {
371
+ class: m,
372
+ style: {
373
+ backgroundColor: e.dotsColor
374
+ },
375
+ key: a
376
+ }, null);
377
+ })]) : null;
378
+ return () => {
379
+ var t;
380
+ return b("div", {
381
+ class: q(),
382
+ ref: T
383
+ }, [b("div", {
384
+ class: q("track"),
385
+ style: ye.value,
386
+ ref: g
387
+ }, [Array(f.cloneNodeCount).fill("").map((a, m) => {
388
+ var S, E, X;
389
+ const w = _(m - f.cloneNodeCount), y = (X = (S = u[w]) == null ? void 0 : (E = S.slots).default) == null ? void 0 : X.call(E);
390
+ return y ? b(K, {
391
+ clonenNode: y,
392
+ index: w
393
+ }, null) : null;
394
+ }), (t = n.default) == null ? void 0 : t.call(n), Array(f.cloneNodeCount).fill("").map((a, m) => {
395
+ var S, E, X;
396
+ const w = _(m), y = (X = (S = u[w]) == null ? void 0 : (E = S.slots).default) == null ? void 0 : X.call(E);
397
+ return y ? b(K, {
398
+ clonenNode: y,
399
+ index: w
400
+ }, null) : null;
401
+ })]), n.dots ? n.dots() : pe()]);
402
+ };
403
+ }
404
+ }), [Ae, oe] = U("tabs-title"), se = /* @__PURE__ */ H({
405
+ name: Ae,
406
+ props: {
407
+ active: {
408
+ type: Boolean,
409
+ default: !1
410
+ },
411
+ scrollable: {
412
+ type: Boolean,
413
+ default: !1
414
+ },
415
+ title: {
416
+ type: String,
417
+ default: null
418
+ },
419
+ titleSlot: {
420
+ type: Function,
421
+ default: null
422
+ },
423
+ disabled: {
424
+ type: Boolean,
425
+ default: !1
426
+ }
427
+ },
428
+ setup(e) {
429
+ const {
430
+ parent: n
431
+ } = fe(me), o = C(() => [{
432
+ "y-el--clickable": !e.disabled
433
+ }, oe({
434
+ scrollable: e.scrollable,
435
+ disabled: e.disabled
436
+ }), oe(`${(n == null ? void 0 : n.props.size) || "middle"}`, {
437
+ active: e.active
438
+ }), n == null ? void 0 : n.props.titleClass, e.active ? n == null ? void 0 : n.props.titleActiveClass : ""]), l = C(() => ({
439
+ ...n == null ? void 0 : n.props.titleStyle,
440
+ ...e.active ? {
441
+ ...n == null ? void 0 : n.props.titleActiveStyle
442
+ } : {}
443
+ }));
444
+ return () => {
445
+ const {
446
+ title: v,
447
+ titleSlot: u
448
+ } = e;
449
+ return b("div", {
450
+ class: o.value,
451
+ title: v,
452
+ style: l.value,
453
+ role: "presentation"
454
+ }, [u ? u() : v]);
455
+ };
456
+ }
457
+ }), J = null, Ye = {
458
+ initIndex: {
459
+ type: Number,
460
+ default: 0
461
+ },
462
+ initName: {
463
+ type: [Number, String],
464
+ default: null
465
+ },
466
+ duration: {
467
+ type: Number,
468
+ default: 300
469
+ },
470
+ lazy: {
471
+ type: Boolean,
472
+ default: !1
473
+ },
474
+ lineColor: {
475
+ type: String,
476
+ default: ""
477
+ },
478
+ lineWidth: {
479
+ type: [Number, String],
480
+ default: "12px"
481
+ },
482
+ lineHeight: {
483
+ type: [Number, String],
484
+ default: "3px"
485
+ },
486
+ titleWrapperClass: J,
487
+ titleScrollThreshold: {
488
+ type: Number,
489
+ default: 5
490
+ },
491
+ titleStyle: {
492
+ type: [Object],
493
+ default: null
494
+ },
495
+ titleClass: {
496
+ type: J,
497
+ default: null
498
+ },
499
+ titleActiveStyle: {
500
+ type: [Object],
501
+ default: null
502
+ },
503
+ titleActiveClass: {
504
+ type: J,
505
+ default: null
506
+ },
507
+ touchable: {
508
+ type: Boolean,
509
+ default: !0
510
+ },
511
+ changeWithAnimation: {
512
+ type: Boolean,
513
+ default: !1
514
+ },
515
+ size: {
516
+ type: String,
517
+ default: "large"
518
+ },
519
+ align: {
520
+ type: String,
521
+ default: "center"
522
+ }
523
+ };
524
+ function Oe(e) {
525
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !re(e);
526
+ }
527
+ const [le, Q] = U("tabs"), me = le, Z = /* @__PURE__ */ H({
528
+ name: le,
529
+ components: {
530
+ YTabTitle: se
531
+ },
532
+ props: Ye,
533
+ setup(e, {
534
+ slots: n,
535
+ emit: o,
536
+ expose: l
537
+ }) {
538
+ const {
539
+ initProvide: v
540
+ } = ue(me), u = z(!1), c = N([]), s = z(), f = C(() => c.length > e.titleScrollThreshold), T = (i) => c.findIndex((d) => (d.$props ? d.$props.name : "") === i), g = z(e.initName ? T(e.initName) : e.initIndex), B = (i) => {
541
+ g.value = i;
542
+ const d = s.value;
543
+ d && (d == null || d.moveTo(i, e.changeWithAnimation));
544
+ };
545
+ l({
546
+ scrollToByIndex: (i) => {
547
+ B(i);
548
+ },
549
+ scrollToByName: (i) => {
550
+ const d = T(i);
551
+ B(d);
552
+ }
553
+ });
554
+ const p = z([]), D = z(), G = (i) => (d) => {
555
+ p.value[i] = d;
556
+ }, L = (i) => {
557
+ const {
558
+ title: d,
559
+ name: h,
560
+ disabled: r
561
+ } = c[i].$props || {};
562
+ g.value !== i && (o(r ? "disabledClick" : "click", i, d, h), !r && B(i));
563
+ }, j = async () => {
564
+ await te(() => {
565
+ if (!f.value || !D.value)
566
+ return;
567
+ const i = D.value;
568
+ if (!i || !p.value[g.value])
569
+ return;
570
+ const d = p.value[g.value].$el, h = d.offsetLeft - (i.offsetWidth - d.offsetWidth) / 2 - i.scrollLeft;
571
+ i.scrollBy({
572
+ left: h,
573
+ behavior: "smooth"
574
+ });
575
+ });
576
+ };
577
+ ze(() => {
578
+ p.value = [];
579
+ });
580
+ const x = N({
581
+ transform: "translateX(50%)",
582
+ transition: "all 0ms ease-out"
583
+ }), I = async () => {
584
+ await te(() => {
585
+ if (!p.value || p.value.length === 0)
586
+ return;
587
+ const i = g.value >= p.value.length ? 0 : g.value, d = p.value[i].$el, h = d.offsetLeft + d.offsetWidth / 2;
588
+ x.transform = `translateX(${h}px) translateX(-50%)`, u.value && (x.transition = `all ${e.duration}ms ease-out`), u.value = !0;
589
+ });
590
+ }, F = (i) => {
591
+ const {
592
+ title: d,
593
+ name: h
594
+ } = c[i].$props || {};
595
+ o("change", i, d, h), g.value = i;
596
+ }, _ = (i) => {
597
+ const {
598
+ title: d,
599
+ name: h
600
+ } = c[i].$props || {};
601
+ o("afterChange", i, d, h), g.value = i;
602
+ }, A = N({
603
+ children: c,
604
+ activeIndex: g,
605
+ props: e
606
+ });
607
+ v(A);
608
+ const Y = (i) => O(i) && /^\d+(\.\d+)?$/.test(i) ? `${i}px` : i, O = (i) => Object.prototype.toString.call(i) === "[object String]";
609
+ return ce(async () => {
610
+ await I();
611
+ }), ee(() => g.value, async () => {
612
+ await I(), await j();
613
+ }), ee(() => {
614
+ var i;
615
+ return (i = n.default) == null ? void 0 : i.length;
616
+ }, async () => {
617
+ await I();
618
+ }), () => {
619
+ let i;
620
+ return b("div", {
621
+ class: le
622
+ }, [b("div", {
623
+ class: Q("list")
624
+ }, [b("div", {
625
+ ref: D,
626
+ class: Q("list-child-wrapper", {
627
+ scrollable: f.value,
628
+ [e.size]: e.size,
629
+ [e.align]: e.align
630
+ })
631
+ }, [c.length > 0 && c.map((d, h) => b(se, {
632
+ title: d.title,
633
+ disabled: d.disabled,
634
+ "title-slot": d.$slots.title,
635
+ key: h,
636
+ ref: G(h),
637
+ active: g.value === h,
638
+ scrollable: f.value,
639
+ onClick: () => L(h)
640
+ }, null)), b("div", {
641
+ class: Q("line"),
642
+ style: {
643
+ ...x,
644
+ width: Y(e.lineWidth),
645
+ height: Y(e.lineHeight),
646
+ backgroundColor: e.lineColor
647
+ }
648
+ }, null)])]), n.default ? b(_e, {
649
+ ref: s,
650
+ dots: !1,
651
+ loop: !1,
652
+ initIndex: g.value,
653
+ lazy: e.lazy,
654
+ touchable: e.touchable,
655
+ duration: e.duration,
656
+ "is-follow-hand": e.changeWithAnimation,
657
+ onChange: F,
658
+ onAfterChange: _
659
+ }, Oe(i = n.default()) ? i : {
660
+ default: () => [i]
661
+ }) : null]);
662
+ };
663
+ }
664
+ });
665
+ Z.install = (e) => {
666
+ const { name: n } = Z;
667
+ e.component(n, Z);
668
+ };
669
+ export {
670
+ Ye as acceptProps,
671
+ Z as default,
672
+ J as unknownProp
673
+ };