vue-next-yui 1.0.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.
- package/favicon.ico +0 -0
- package/package.json +37 -0
- package/style.css +1 -0
- package/vue-next-yui.es.js +240 -0
- package/vue-next-yui.umd.js +1 -0
package/favicon.ico
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue-next-yui",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "vue-next-yui",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"main": "vue-next-yui.umd.js",
|
|
12
|
+
"module": "vue-next-yui.es.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "vue-next-yui.es.js",
|
|
16
|
+
"require": "vue-next-yui.umd.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"vue": "^3.4.29",
|
|
21
|
+
"vue-router": "^4.3.3"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@vitejs/plugin-vue": "^5.0.5",
|
|
25
|
+
"sass": "^1.77.8",
|
|
26
|
+
"vite": "^5.3.1"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"vue-next-yui",
|
|
30
|
+
"npm",
|
|
31
|
+
"package",
|
|
32
|
+
"vue",
|
|
33
|
+
"vue3"
|
|
34
|
+
],
|
|
35
|
+
"author": "shawyu",
|
|
36
|
+
"license": "MIT"
|
|
37
|
+
}
|
package/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.yu-slide-wrapper[data-v-3bff58af]{position:relative;overflow:hidden}.yu-slide-wrapper .yu-slide-container[data-v-3bff58af]{width:100%;height:100%;font-size:0;line-height:0;white-space:nowrap}.yu-slide-wrapper .yu-slide-arrow .prev[data-v-3bff58af]{position:absolute;left:30px;top:50%;transform:translateY(-50%);z-index:1;font-size:0;line-height:0;padding:10px;border-radius:50px;background-color:#fff0;cursor:pointer;transition:all .3s}.yu-slide-wrapper .yu-slide-arrow .prev .icon[data-v-3bff58af]{transition:all .3s;opacity:0}.yu-slide-wrapper .yu-slide-arrow .next[data-v-3bff58af]{position:absolute;right:30px;top:50%;transform:translateY(-50%);z-index:1;font-size:0;line-height:0;padding:10px;border-radius:50px;background-color:#fff0;cursor:pointer;transition:all .3s}.yu-slide-wrapper .yu-slide-arrow .next .icon[data-v-3bff58af]{transition:all .3s;opacity:0}.yu-slide-wrapper .yu-slide-indicator[data-v-3bff58af]{position:absolute;left:50%;bottom:10px;z-index:1;transform:translate(-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;align-items:center;gap:6px}.yu-slide-wrapper .yu-slide-indicator span[data-v-3bff58af]{display:block;width:12px;height:5px;border-radius:5px;background-color:#00000026;cursor:pointer}.yu-slide-wrapper .yu-slide-indicator span.active[data-v-3bff58af]{background-color:#0006}.yu-slide-wrapper .yu-slide-indicator span.white[data-v-3bff58af]{background-color:#ffffff4d}.yu-slide-wrapper .yu-slide-indicator span.white.active[data-v-3bff58af]{background-color:#ffffffe6}.yu-slide-wrapper .yu-slide-indicator span.black[data-v-3bff58af]{background-color:#00000026}.yu-slide-wrapper .yu-slide-indicator span.black.active[data-v-3bff58af]{background-color:#0006}@media screen and (min-width: 768px){.yu-slide-wrapper:hover .yu-slide-arrow .prev.white[data-v-3bff58af]{background-color:#00000026}.yu-slide-wrapper:hover .yu-slide-arrow .prev.white .icon[data-v-3bff58af]{opacity:.9}.yu-slide-wrapper:hover .yu-slide-arrow .prev.black[data-v-3bff58af]{background-color:#fff3}.yu-slide-wrapper:hover .yu-slide-arrow .prev.black .icon[data-v-3bff58af]{opacity:.6}.yu-slide-wrapper:hover .yu-slide-arrow .next.white[data-v-3bff58af]{background-color:#00000026}.yu-slide-wrapper:hover .yu-slide-arrow .next.white .icon[data-v-3bff58af]{opacity:.9}.yu-slide-wrapper:hover .yu-slide-arrow .next.black[data-v-3bff58af]{background-color:#fff3}.yu-slide-wrapper:hover .yu-slide-arrow .next.black .icon[data-v-3bff58af]{opacity:.6}}@media screen and (max-width: 768px){.yu-slide-wrapper .yu-slide-arrow[data-v-3bff58af]{display:none;opacity:0;visibility:hidden}.yu-slide-wrapper .yu-slide-indicator[data-v-3bff58af]{gap:5px}.yu-slide-wrapper .yu-slide-indicator span[data-v-3bff58af]{width:10px;height:4px;border-radius:5px;cursor:auto}}.yu-slide-item-wrapper[data-v-69b2940a]{display:inline-block;width:100%;height:100%}.yu-slide-item-wrapper .yu-slide-item[data-v-69b2940a]{position:relative;width:100%;height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;align-items:center;justify-content:center;background-color:#ccc;font-size:16px;line-height:2}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { ref as i, reactive as Y, onMounted as Z, onBeforeUnmount as ee, watch as A, openBlock as m, createElementBlock as y, createElementVNode as M, renderSlot as V, normalizeClass as X, withModifiers as k, unref as $, createCommentVNode as E, Fragment as te, renderList as le, pushScopeId as ae, popScopeId as oe } from "vue";
|
|
2
|
+
const z = (r, h) => {
|
|
3
|
+
const n = r.__vccOpts || r;
|
|
4
|
+
for (const [v, x] of h)
|
|
5
|
+
n[v] = x;
|
|
6
|
+
return n;
|
|
7
|
+
}, j = (r) => (ae("data-v-3bff58af"), r = r(), oe(), r), ne = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "yu-slide-arrow"
|
|
10
|
+
}, ue = ["fill"], se = /* @__PURE__ */ j(() => /* @__PURE__ */ M("path", { d: "M703.967748 885.366929c-8.532661 0-14.932661-2.134677-21.332661-8.532661l-384-341.332662c-6.4-6.4-10.667339-14.932661-10.667339-23.467338s4.267339-17.067339 10.667339-23.467339l384-341.334677c12.8-12.8 34.134677-10.665323 44.8 2.134677 12.802016 12.8 10.667339 34.134677-2.132662 44.8L369.033071 512.034268l356.267338 317.865323c12.8 10.667339 14.932661 32 2.132662 44.8-6.4 6.4-14.932661 10.667339-23.465323 10.667338z" }, null, -1)), ie = [
|
|
11
|
+
se
|
|
12
|
+
], re = ["fill"], ve = /* @__PURE__ */ j(() => /* @__PURE__ */ M("path", { d: "M320 885.333333c-8.533333 0-17.066667-4.266667-23.466667-10.666666-12.8-12.8-10.666667-34.133333 2.133334-44.8L654.933333 512 298.666667 194.133333c-12.8-10.666667-14.933333-32-2.133334-44.8 10.666667-12.8 32-14.933333 44.8-2.133333l384 341.333333c6.4 6.4 10.666667 14.933333 10.666667 23.466667 0 8.533333-4.266667 17.066667-10.666667 23.466667l-384 341.333333c-6.4 6.4-12.8 8.533333-21.333333 8.533333z" }, null, -1)), ce = [
|
|
13
|
+
ve
|
|
14
|
+
], de = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "yu-slide-indicator"
|
|
17
|
+
}, fe = ["onClick"], he = {
|
|
18
|
+
name: "Slide"
|
|
19
|
+
}, pe = /* @__PURE__ */ Object.assign(he, {
|
|
20
|
+
props: {
|
|
21
|
+
option: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default() {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
value: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default() {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
themeStyle: {
|
|
34
|
+
//white,black
|
|
35
|
+
type: String,
|
|
36
|
+
default() {
|
|
37
|
+
return "white";
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
gap: {
|
|
41
|
+
type: [Number, String],
|
|
42
|
+
default() {
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
emits: ["slide"],
|
|
48
|
+
setup(r, { emit: h }) {
|
|
49
|
+
const n = r, v = i(""), x = h, p = "all 0.45s", t = i(null), l = i(0), d = i(0), f = i(null), c = i(!1), w = i(!1), S = i(!1), s = i(0);
|
|
50
|
+
i(0);
|
|
51
|
+
const g = i("white"), a = Y({
|
|
52
|
+
width: n.option.width || document.body.clientWidth,
|
|
53
|
+
height: n.option.height || "auto",
|
|
54
|
+
duration: n.option.duration || 3e3,
|
|
55
|
+
showArrow: !!n.option.showArrow || !1,
|
|
56
|
+
showIndicator: !!n.option.showIndicator || !1,
|
|
57
|
+
autoPlay: !!n.option.autoPlay || !1,
|
|
58
|
+
loop: !!n.option.loop || !1
|
|
59
|
+
});
|
|
60
|
+
Z(() => {
|
|
61
|
+
g.value = ["black", "white"].includes(n.themeStyle) ? n.themeStyle : "white", R();
|
|
62
|
+
}), ee(() => {
|
|
63
|
+
clearTimeout(f.value);
|
|
64
|
+
}), A(() => n.option, (e, o) => {
|
|
65
|
+
console.log("option的name变化了", e, o);
|
|
66
|
+
}), A(l, (e, o) => {
|
|
67
|
+
});
|
|
68
|
+
const R = () => {
|
|
69
|
+
if (!t.value) return;
|
|
70
|
+
let e = t.value.children;
|
|
71
|
+
d.value = e.length;
|
|
72
|
+
for (let o = 0, u = e.length; o < u; o++)
|
|
73
|
+
e[o].setAttribute("index", o);
|
|
74
|
+
t.value.style.transition = p, a.loop ? (t.value.style.transform = `translateX(${-(l.value + 1) * a.width}px)`, t.value.insertBefore(e[e.length - 1].cloneNode(!0), e[0]), t.value.appendChild(e[1].cloneNode(!0))) : t.value.style.transform = `translateX(${-l.value * a.width}px)`, a.autoPlay && _();
|
|
75
|
+
}, N = (e, o = 300) => {
|
|
76
|
+
const u = i(!0);
|
|
77
|
+
return (...T) => {
|
|
78
|
+
u.value && (u.value = !1, e(...T), setTimeout(() => {
|
|
79
|
+
u.value = !0;
|
|
80
|
+
}, o));
|
|
81
|
+
};
|
|
82
|
+
}, _ = () => {
|
|
83
|
+
clearTimeout(f.value), f.value = setTimeout(() => {
|
|
84
|
+
a.loop ? P() : (console.log("a", l.value, d.value - 1), l.value >= d.value - 1 ? C(0) : (console.log("c"), P()));
|
|
85
|
+
}, a.duration);
|
|
86
|
+
}, O = (e) => {
|
|
87
|
+
let u = (a.loop ? l.value + 1 : l.value) * a.width + s.value - e;
|
|
88
|
+
t.value.style.transition = "none", t.value.style.transform = `translateX(${-u}px)`;
|
|
89
|
+
}, D = (e) => {
|
|
90
|
+
s.value && (a.loop ? e >= s.value && e - s.value > 80 ? b() : e < s.value && s.value - e > 80 ? P() : (t.value.style.transition = p, t.value.style.transform = `translateX(${-(l.value + 1) * a.width}px)`, a.autoPlay && _()) : e >= s.value && e - s.value > 80 && l.value > 0 ? b() : e < s.value && s.value - e > 80 && l.value < d.value - 1 ? P() : (t.value.style.transition = p, t.value.style.transform = `translateX(${-l.value * a.width}px)`, a.autoPlay && _()), s.value = 0, setTimeout(() => {
|
|
91
|
+
w.value = !1;
|
|
92
|
+
}, 300));
|
|
93
|
+
}, b = () => {
|
|
94
|
+
if (!(t.value && t.value.children)) return;
|
|
95
|
+
let e = t.value.children;
|
|
96
|
+
a.loop ? (l.value--, t.value.style.transition = p, t.value.style.transform = `translateX(${-(l.value + 1) * e[0].offsetWidth}px)`, l.value < 0 && (l.value = d.value - 1, setTimeout(() => {
|
|
97
|
+
t.value.style.transition = "none", t.value.style.transform = `translateX(${-d.value * e[0].offsetWidth}px)`;
|
|
98
|
+
}, 300))) : l.value > 0 && (l.value--, t.value.style.transition = p, t.value.style.transform = `translateX(${-l.value * e[0].offsetWidth}px)`), a.autoPlay && _(), x("slide", l.value);
|
|
99
|
+
}, P = () => {
|
|
100
|
+
if (!(t.value && t.value.children)) return;
|
|
101
|
+
let e = t.value.children;
|
|
102
|
+
a.loop ? (l.value++, t.value.style.transition = p, t.value.style.transform = `translateX(${-(l.value + 1) * e[0].offsetWidth}px)`, l.value > d.value - 1 && (l.value = 0, setTimeout(() => {
|
|
103
|
+
t.value.style.transition = "none", t.value.style.transform = `translateX(${-e[0].offsetWidth}px)`;
|
|
104
|
+
}, 300))) : l.value < d.value - 1 && (l.value++, t.value.style.transition = p, t.value.style.transform = `translateX(${-l.value * e[0].offsetWidth}px)`), a.autoPlay && _(), x("slide", l.value);
|
|
105
|
+
}, C = (e) => {
|
|
106
|
+
let o = t.value.children;
|
|
107
|
+
a.autoPlay && clearTimeout(f.value), l.value = e;
|
|
108
|
+
let u = a.loop ? l.value + 1 : l.value;
|
|
109
|
+
t.value.style.transition = p, t.value.style.transform = `translateX(${-u * o[0].offsetWidth}px)`, a.autoPlay && _(), x("slide", e);
|
|
110
|
+
}, F = (e) => {
|
|
111
|
+
v.value += "MouseEnter_", e.preventDefault(), S.value = !0, a.autoPlay && clearTimeout(f.value);
|
|
112
|
+
}, q = (e) => {
|
|
113
|
+
v.value += "MouseLeave_", e.preventDefault(), S.value && (S.value = !1, a.autoPlay && _());
|
|
114
|
+
}, G = (e) => {
|
|
115
|
+
v.value += "MouseDown_", e.preventDefault(), S.value = !1, !(c.value || w.value) && (a.autoPlay && clearTimeout(f.value), c.value = !0, s.value = e.clientX);
|
|
116
|
+
}, H = (e) => {
|
|
117
|
+
v.value += "MouseMove_", e.preventDefault(), c.value && (!w.value && (w.value = !0), O(e.clientX));
|
|
118
|
+
}, J = (e) => {
|
|
119
|
+
v.value += "MouseUp_", e.preventDefault(), c.value && (c.value = !1, D(e.clientX));
|
|
120
|
+
}, K = (e) => {
|
|
121
|
+
if (v.value += "TouchStart_", e.preventDefault(), c.value || w.value) return;
|
|
122
|
+
a.autoPlay && clearTimeout(f.value), c.value = !0;
|
|
123
|
+
let o = e.changedTouches[0];
|
|
124
|
+
s.value = o.clientX;
|
|
125
|
+
}, Q = (e) => {
|
|
126
|
+
v.value += "TouchMove_", e.preventDefault(), c.value && (!w.value && (w.value = !0), O(e.changedTouches[0].clientX));
|
|
127
|
+
}, L = (e) => {
|
|
128
|
+
v.value += "TouchLeave_", e.preventDefault(), c.value && (c.value = !1, D(e.changedTouches[0].clientX));
|
|
129
|
+
}, B = N(() => {
|
|
130
|
+
a.autoPlay && clearTimeout(f.value), b();
|
|
131
|
+
}, 300), W = N(() => {
|
|
132
|
+
a.autoPlay && clearTimeout(f.value), P();
|
|
133
|
+
}, 300);
|
|
134
|
+
return (e, o) => (m(), y("div", {
|
|
135
|
+
class: "yu-slide-wrapper",
|
|
136
|
+
onMousedown: G,
|
|
137
|
+
onMousemove: H,
|
|
138
|
+
onMouseup: J,
|
|
139
|
+
onMouseenter: F,
|
|
140
|
+
onMouseleave: q,
|
|
141
|
+
onTouchstart: K,
|
|
142
|
+
onTouchmove: Q,
|
|
143
|
+
onTouchend: L,
|
|
144
|
+
onTouchcancel: L
|
|
145
|
+
}, [
|
|
146
|
+
M("div", {
|
|
147
|
+
class: "yu-slide-container",
|
|
148
|
+
ref_key: "slideItemContainer",
|
|
149
|
+
ref: t
|
|
150
|
+
}, [
|
|
151
|
+
V(e.$slots, "default", {}, void 0, !0)
|
|
152
|
+
], 512),
|
|
153
|
+
a.showArrow ? (m(), y("div", ne, [
|
|
154
|
+
M("div", {
|
|
155
|
+
class: X(["prev", g.value]),
|
|
156
|
+
onClick: o[0] || (o[0] = k((...u) => $(B) && $(B)(...u), ["stop"]))
|
|
157
|
+
}, [
|
|
158
|
+
(m(), y("svg", {
|
|
159
|
+
class: "icon",
|
|
160
|
+
fill: g.value,
|
|
161
|
+
viewBox: "0 0 1024 1024",
|
|
162
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
163
|
+
width: "18",
|
|
164
|
+
height: "18"
|
|
165
|
+
}, ie, 8, ue))
|
|
166
|
+
], 2),
|
|
167
|
+
M("div", {
|
|
168
|
+
class: X(["next", g.value]),
|
|
169
|
+
onClick: o[1] || (o[1] = k((...u) => $(W) && $(W)(...u), ["stop"]))
|
|
170
|
+
}, [
|
|
171
|
+
(m(), y("svg", {
|
|
172
|
+
class: "icon",
|
|
173
|
+
fill: g.value,
|
|
174
|
+
viewBox: "0 0 1024 1024",
|
|
175
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
176
|
+
width: "18",
|
|
177
|
+
height: "18"
|
|
178
|
+
}, ce, 8, re))
|
|
179
|
+
], 2)
|
|
180
|
+
])) : E("", !0),
|
|
181
|
+
a.showIndicator ? (m(), y("div", de, [
|
|
182
|
+
(m(!0), y(te, null, le(d.value, (u, T) => (m(), y("span", {
|
|
183
|
+
class: X([g.value, { active: l.value === T }]),
|
|
184
|
+
key: T,
|
|
185
|
+
onClick: k((Me) => C(T), ["stop"])
|
|
186
|
+
}, null, 10, fe))), 128))
|
|
187
|
+
])) : E("", !0)
|
|
188
|
+
], 32));
|
|
189
|
+
}
|
|
190
|
+
}), me = /* @__PURE__ */ z(pe, [["__scopeId", "data-v-3bff58af"]]), ye = { class: "yu-slide-item-wrapper" }, we = { class: "yu-slide-item" }, _e = {
|
|
191
|
+
name: "SlideItem"
|
|
192
|
+
}, ge = /* @__PURE__ */ Object.assign(_e, {
|
|
193
|
+
props: {
|
|
194
|
+
name: {
|
|
195
|
+
type: String,
|
|
196
|
+
default() {
|
|
197
|
+
return "";
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
size: {
|
|
201
|
+
type: [Number, String],
|
|
202
|
+
default() {
|
|
203
|
+
return "16px";
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
showArrow: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default() {
|
|
209
|
+
return !1;
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
showPagination: {
|
|
213
|
+
type: Boolean,
|
|
214
|
+
default() {
|
|
215
|
+
return !1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
setup(r) {
|
|
220
|
+
return (h, n) => (m(), y("div", ye, [
|
|
221
|
+
M("div", we, [
|
|
222
|
+
V(h.$slots, "default", {}, void 0, !0)
|
|
223
|
+
])
|
|
224
|
+
]));
|
|
225
|
+
}
|
|
226
|
+
}), Te = /* @__PURE__ */ z(ge, [["__scopeId", "data-v-69b2940a"]]), U = [me, Te], I = function(r) {
|
|
227
|
+
I.installed || (I.installed = !0, U.map((h) => {
|
|
228
|
+
r.component(h.name, h);
|
|
229
|
+
}));
|
|
230
|
+
};
|
|
231
|
+
typeof window < "u" && window.Vue && I(window.Vue);
|
|
232
|
+
const Pe = {
|
|
233
|
+
// 导出的对象必须具备一个 install 方法
|
|
234
|
+
install: I,
|
|
235
|
+
// 组件列表
|
|
236
|
+
...U
|
|
237
|
+
};
|
|
238
|
+
export {
|
|
239
|
+
Pe as default
|
|
240
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,y){typeof exports=="object"&&typeof module<"u"?module.exports=y(require("vue")):typeof define=="function"&&define.amd?define(["vue"],y):(e=typeof globalThis<"u"?globalThis:e||self,e["vue-next-yui"]=y(e.Vue))})(this,function(e){"use strict";const y=(i,h)=>{const s=i.__vccOpts||i;for(const[c,g]of h)s[c]=g;return s},S=i=>(e.pushScopeId("data-v-3bff58af"),i=i(),e.popScopeId(),i),C={key:0,class:"yu-slide-arrow"},O=["fill"],D=[S(()=>e.createElementVNode("path",{d:"M703.967748 885.366929c-8.532661 0-14.932661-2.134677-21.332661-8.532661l-384-341.332662c-6.4-6.4-10.667339-14.932661-10.667339-23.467338s4.267339-17.067339 10.667339-23.467339l384-341.334677c12.8-12.8 34.134677-10.665323 44.8 2.134677 12.802016 12.8 10.667339 34.134677-2.132662 44.8L369.033071 512.034268l356.267338 317.865323c12.8 10.667339 14.932661 32 2.132662 44.8-6.4 6.4-14.932661 10.667339-23.465323 10.667338z"},null,-1))],L=["fill"],W=[S(()=>e.createElementVNode("path",{d:"M320 885.333333c-8.533333 0-17.066667-4.266667-23.466667-10.666666-12.8-12.8-10.666667-34.133333 2.133334-44.8L654.933333 512 298.666667 194.133333c-12.8-10.666667-14.933333-32-2.133334-44.8 10.666667-12.8 32-14.933333 44.8-2.133333l384 341.333333c6.4 6.4 10.666667 14.933333 10.666667 23.466667 0 8.533333-4.266667 17.066667-10.666667 23.466667l-384 341.333333c-6.4 6.4-12.8 8.533333-21.333333 8.533333z"},null,-1))],A={key:1,class:"yu-slide-indicator"},z=["onClick"],j=y(Object.assign({name:"Slide"},{props:{option:{type:Object,default(){return{}}},value:{type:Number,default(){return 0}},themeStyle:{type:String,default(){return"white"}},gap:{type:[Number,String],default(){return 0}}},emits:["slide"],setup(i,{emit:h}){const s=i,c=e.ref(""),g=h,p="all 0.45s",l=e.ref(null),a=e.ref(0),f=e.ref(0),v=e.ref(null),d=e.ref(!1),m=e.ref(!1),x=e.ref(!1),r=e.ref(0);e.ref(0);const w=e.ref("white"),o=e.reactive({width:s.option.width||document.body.clientWidth,height:s.option.height||"auto",duration:s.option.duration||3e3,showArrow:!!s.option.showArrow||!1,showIndicator:!!s.option.showIndicator||!1,autoPlay:!!s.option.autoPlay||!1,loop:!!s.option.loop||!1});e.onMounted(()=>{w.value=["black","white"].includes(s.themeStyle)?s.themeStyle:"white",q()}),e.onBeforeUnmount(()=>{clearTimeout(v.value)}),e.watch(()=>s.option,(t,n)=>{console.log("option的name变化了",t,n)}),e.watch(a,(t,n)=>{});const q=()=>{if(!l.value)return;let t=l.value.children;f.value=t.length;for(let n=0,u=t.length;n<u;n++)t[n].setAttribute("index",n);l.value.style.transition=p,o.loop?(l.value.style.transform=`translateX(${-(a.value+1)*o.width}px)`,l.value.insertBefore(t[t.length-1].cloneNode(!0),t[0]),l.value.appendChild(t[1].cloneNode(!0))):l.value.style.transform=`translateX(${-a.value*o.width}px)`,o.autoPlay&&_()},P=(t,n=300)=>{const u=e.ref(!0);return(...T)=>{u.value&&(u.value=!1,t(...T),setTimeout(()=>{u.value=!0},n))}},_=()=>{clearTimeout(v.value),v.value=setTimeout(()=>{o.loop?M():(console.log("a",a.value,f.value-1),a.value>=f.value-1?I(0):(console.log("c"),M()))},o.duration)},E=t=>{let u=(o.loop?a.value+1:a.value)*o.width+r.value-t;l.value.style.transition="none",l.value.style.transform=`translateX(${-u}px)`},N=t=>{r.value&&(o.loop?t>=r.value&&t-r.value>80?B():t<r.value&&r.value-t>80?M():(l.value.style.transition=p,l.value.style.transform=`translateX(${-(a.value+1)*o.width}px)`,o.autoPlay&&_()):t>=r.value&&t-r.value>80&&a.value>0?B():t<r.value&&r.value-t>80&&a.value<f.value-1?M():(l.value.style.transition=p,l.value.style.transform=`translateX(${-a.value*o.width}px)`,o.autoPlay&&_()),r.value=0,setTimeout(()=>{m.value=!1},300))},B=()=>{if(!(l.value&&l.value.children))return;let t=l.value.children;o.loop?(a.value--,l.value.style.transition=p,l.value.style.transform=`translateX(${-(a.value+1)*t[0].offsetWidth}px)`,a.value<0&&(a.value=f.value-1,setTimeout(()=>{l.value.style.transition="none",l.value.style.transform=`translateX(${-f.value*t[0].offsetWidth}px)`},300))):a.value>0&&(a.value--,l.value.style.transition=p,l.value.style.transform=`translateX(${-a.value*t[0].offsetWidth}px)`),o.autoPlay&&_(),g("slide",a.value)},M=()=>{if(!(l.value&&l.value.children))return;let t=l.value.children;o.loop?(a.value++,l.value.style.transition=p,l.value.style.transform=`translateX(${-(a.value+1)*t[0].offsetWidth}px)`,a.value>f.value-1&&(a.value=0,setTimeout(()=>{l.value.style.transition="none",l.value.style.transform=`translateX(${-t[0].offsetWidth}px)`},300))):a.value<f.value-1&&(a.value++,l.value.style.transition=p,l.value.style.transform=`translateX(${-a.value*t[0].offsetWidth}px)`),o.autoPlay&&_(),g("slide",a.value)},I=t=>{let n=l.value.children;o.autoPlay&&clearTimeout(v.value),a.value=t;let u=o.loop?a.value+1:a.value;l.value.style.transition=p,l.value.style.transform=`translateX(${-u*n[0].offsetWidth}px)`,o.autoPlay&&_(),g("slide",t)},F=t=>{c.value+="MouseEnter_",t.preventDefault(),x.value=!0,o.autoPlay&&clearTimeout(v.value)},G=t=>{c.value+="MouseLeave_",t.preventDefault(),x.value&&(x.value=!1,o.autoPlay&&_())},H=t=>{c.value+="MouseDown_",t.preventDefault(),x.value=!1,!(d.value||m.value)&&(o.autoPlay&&clearTimeout(v.value),d.value=!0,r.value=t.clientX)},J=t=>{c.value+="MouseMove_",t.preventDefault(),d.value&&(!m.value&&(m.value=!0),E(t.clientX))},K=t=>{c.value+="MouseUp_",t.preventDefault(),d.value&&(d.value=!1,N(t.clientX))},Q=t=>{if(c.value+="TouchStart_",t.preventDefault(),d.value||m.value)return;o.autoPlay&&clearTimeout(v.value),d.value=!0;let n=t.changedTouches[0];r.value=n.clientX},Y=t=>{c.value+="TouchMove_",t.preventDefault(),d.value&&(!m.value&&(m.value=!0),E(t.changedTouches[0].clientX))},b=t=>{c.value+="TouchLeave_",t.preventDefault(),d.value&&(d.value=!1,N(t.changedTouches[0].clientX))},V=P(()=>{o.autoPlay&&clearTimeout(v.value),B()},300),X=P(()=>{o.autoPlay&&clearTimeout(v.value),M()},300);return(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:"yu-slide-wrapper",onMousedown:H,onMousemove:J,onMouseup:K,onMouseenter:F,onMouseleave:G,onTouchstart:Q,onTouchmove:Y,onTouchend:b,onTouchcancel:b},[e.createElementVNode("div",{class:"yu-slide-container",ref_key:"slideItemContainer",ref:l},[e.renderSlot(t.$slots,"default",{},void 0,!0)],512),o.showArrow?(e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",{class:e.normalizeClass(["prev",w.value]),onClick:n[0]||(n[0]=e.withModifiers((...u)=>e.unref(V)&&e.unref(V)(...u),["stop"]))},[(e.openBlock(),e.createElementBlock("svg",{class:"icon",fill:w.value,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18"},D,8,O))],2),e.createElementVNode("div",{class:e.normalizeClass(["next",w.value]),onClick:n[1]||(n[1]=e.withModifiers((...u)=>e.unref(X)&&e.unref(X)(...u),["stop"]))},[(e.openBlock(),e.createElementBlock("svg",{class:"icon",fill:w.value,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18"},W,8,L))],2)])):e.createCommentVNode("",!0),o.showIndicator?(e.openBlock(),e.createElementBlock("div",A,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(u,T)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass([w.value,{active:a.value===T}]),key:T,onClick:e.withModifiers(ue=>I(T),["stop"])},null,10,z))),128))])):e.createCommentVNode("",!0)],32))}}),[["__scopeId","data-v-3bff58af"]]),U={class:"yu-slide-item-wrapper"},R={class:"yu-slide-item"},$=[j,y(Object.assign({name:"SlideItem"},{props:{name:{type:String,default(){return""}},size:{type:[Number,String],default(){return"16px"}},showArrow:{type:Boolean,default(){return!1}},showPagination:{type:Boolean,default(){return!1}}},setup(i){return(h,s)=>(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("div",R,[e.renderSlot(h.$slots,"default",{},void 0,!0)])]))}}),[["__scopeId","data-v-69b2940a"]])],k=function(i){k.installed||(k.installed=!0,$.map(h=>{i.component(h.name,h)}))};return typeof window<"u"&&window.Vue&&k(window.Vue),{install:k,...$}});
|