foucui 2.3.9 → 2.3.10
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/dist/foucui.css +1 -1
- package/dist/foucui.js +100 -91
- package/dist/foucui.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/foucui.js
CHANGED
|
@@ -35,81 +35,88 @@ var ye = Object.create, be = Object.defineProperty, xe = Object.getOwnPropertyDe
|
|
|
35
35
|
},
|
|
36
36
|
emits: ["change", "scroll"],
|
|
37
37
|
setup(e, { expose: t, emit: n }) {
|
|
38
|
-
let r = e, i = n,
|
|
39
|
-
if (
|
|
40
|
-
let e =
|
|
38
|
+
let r = e, i = n, a = I(null), o = I(null), s = I(!1), d = I(0), f = I(0), p = I(), m = /* @__PURE__ */ new WeakSet(), h = () => {
|
|
39
|
+
if (!r.target) return window;
|
|
40
|
+
let e = a.value;
|
|
41
|
+
if (e) {
|
|
42
|
+
let t = e.closest(r.target);
|
|
43
|
+
if (t instanceof HTMLElement) return t;
|
|
44
|
+
}
|
|
45
|
+
let t = document.querySelector(r.target);
|
|
46
|
+
return t instanceof HTMLElement ? t : window;
|
|
47
|
+
}, g = (e) => {
|
|
48
|
+
m.has(e) || (getComputedStyle(e).position === "static" && (e.style.position = "relative", e.dataset.fouAffixRel = "1"), m.add(e));
|
|
49
|
+
}, _ = () => {
|
|
50
|
+
let e = a.value, t = o.value;
|
|
41
51
|
if (!e || !t) return;
|
|
42
|
-
let n =
|
|
43
|
-
f.value = t.
|
|
44
|
-
let c = !1;
|
|
52
|
+
let n = h();
|
|
53
|
+
d.value = t.offsetHeight, f.value = t.offsetWidth;
|
|
54
|
+
let c = ((s.value ? e.querySelector(".fou-affix__placeholder") : null) ?? e).getBoundingClientRect(), l = !1;
|
|
45
55
|
if (r.position === "top") {
|
|
46
|
-
if (n === window)
|
|
56
|
+
if (n === window) l = c.top <= r.offset;
|
|
47
57
|
else {
|
|
48
58
|
let e = n.getBoundingClientRect().top;
|
|
49
|
-
|
|
59
|
+
l = c.top <= e + r.offset;
|
|
50
60
|
}
|
|
51
|
-
} else if (n === window)
|
|
61
|
+
} else if (n === window) l = c.bottom >= window.innerHeight - r.offset;
|
|
52
62
|
else {
|
|
53
63
|
let e = n.getBoundingClientRect().bottom;
|
|
54
|
-
|
|
64
|
+
l = c.bottom >= e - r.offset;
|
|
55
65
|
}
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
if (l !== s.value && (s.value = l, i("change", l)), l) {
|
|
67
|
+
let e = {
|
|
68
|
+
zIndex: String(r.zIndex),
|
|
69
|
+
width: `${f.value}px`
|
|
70
|
+
};
|
|
71
|
+
if (n === window) e.position = "fixed", e.left = `${c.left}px`, r.position === "top" ? e.top = `${r.offset}px` : e.bottom = `${r.offset}px`;
|
|
72
|
+
else {
|
|
73
|
+
let t = n;
|
|
74
|
+
g(t);
|
|
75
|
+
let i = t.getBoundingClientRect();
|
|
76
|
+
e.position = "absolute", e.left = `${c.left - i.left + t.scrollLeft}px`, e.top = r.position === "top" ? `${t.scrollTop + r.offset}px` : `${t.scrollTop + t.clientHeight - d.value - r.offset}px`;
|
|
77
|
+
}
|
|
78
|
+
p.value = e;
|
|
79
|
+
} else p.value = void 0;
|
|
80
|
+
let u = n === window ? window.scrollY || document.documentElement.scrollTop : n.scrollTop;
|
|
58
81
|
i("scroll", {
|
|
59
|
-
scrollTop:
|
|
60
|
-
fixed:
|
|
82
|
+
scrollTop: u,
|
|
83
|
+
fixed: s.value
|
|
61
84
|
});
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
...r.position === "top" ? { top: `${r.offset}px` } : { bottom: `${r.offset}px` }
|
|
67
|
-
};
|
|
68
|
-
if (!d.value) return;
|
|
69
|
-
let e = m(), t = {
|
|
70
|
-
position: "fixed",
|
|
71
|
-
zIndex: String(r.zIndex),
|
|
72
|
-
width: `${o.value?.offsetWidth ?? 0}px`
|
|
73
|
-
};
|
|
74
|
-
if (r.position === "top" ? t.top = `${e === window ? r.offset : e.getBoundingClientRect().top + r.offset}px` : t.bottom = `${e === window ? r.offset : window.innerHeight - e.getBoundingClientRect().bottom + r.offset}px`, e !== window) {
|
|
75
|
-
let n = e.getBoundingClientRect();
|
|
76
|
-
t.left = `${n.left}px`, t.width = `${n.width}px`;
|
|
77
|
-
} else o.value && (t.left = `${o.value.getBoundingClientRect().left}px`);
|
|
78
|
-
return t;
|
|
79
|
-
}), _ = window, v = () => h(), y = () => h(), b = () => {
|
|
80
|
-
_.removeEventListener("scroll", v), window.removeEventListener("resize", y), !p.value && (_ = m(), _.addEventListener("scroll", v, { passive: !0 }), window.addEventListener("resize", y, { passive: !0 }), h());
|
|
85
|
+
}, v = window, y = () => _(), b = () => _(), x = () => {
|
|
86
|
+
v !== window && v.removeEventListener("scroll", y), window.removeEventListener("scroll", y), window.removeEventListener("resize", b);
|
|
87
|
+
}, S = () => {
|
|
88
|
+
x(), v = h(), v !== window && v.addEventListener("scroll", y, { passive: !0 }), window.addEventListener("scroll", y, { passive: !0 }), window.addEventListener("resize", b, { passive: !0 }), _();
|
|
81
89
|
};
|
|
82
90
|
return A(() => {
|
|
83
|
-
C(
|
|
84
|
-
}), k(() =>
|
|
85
|
-
_.removeEventListener("scroll", v), window.removeEventListener("resize", y);
|
|
86
|
-
}), W(() => [
|
|
91
|
+
C(S);
|
|
92
|
+
}), k(x), W(() => [
|
|
87
93
|
r.target,
|
|
88
94
|
r.offset,
|
|
89
|
-
r.position
|
|
90
|
-
|
|
95
|
+
r.position,
|
|
96
|
+
r.zIndex
|
|
97
|
+
], () => C(S)), t({ update: _ }), (e, t) => (N(), l("div", {
|
|
91
98
|
ref_key: "rootRef",
|
|
92
|
-
ref:
|
|
99
|
+
ref: a,
|
|
93
100
|
class: "fou-affix"
|
|
94
|
-
}, [U(
|
|
101
|
+
}, [U(s) ? (N(), l("div", {
|
|
95
102
|
key: 0,
|
|
96
103
|
class: "fou-affix__placeholder",
|
|
97
|
-
style: E({
|
|
104
|
+
style: E({
|
|
105
|
+
width: `${U(f)}px`,
|
|
106
|
+
height: `${U(d)}px`
|
|
107
|
+
})
|
|
98
108
|
}, null, 4)) : c("", !0), u("div", {
|
|
99
109
|
ref_key: "affixRef",
|
|
100
|
-
ref:
|
|
101
|
-
class: w(["fou-affix__content", {
|
|
102
|
-
|
|
103
|
-
"is-sticky": U(p)
|
|
104
|
-
}]),
|
|
105
|
-
style: E(U(g))
|
|
110
|
+
ref: o,
|
|
111
|
+
class: w(["fou-affix__content", { "is-fixed": U(s) }]),
|
|
112
|
+
style: E(U(p))
|
|
106
113
|
}, [R(e.$slots, "default", {}, void 0, !0)], 6)], 512));
|
|
107
114
|
}
|
|
108
115
|
}), Z = (e, t) => {
|
|
109
116
|
let n = e.__vccOpts || e;
|
|
110
117
|
for (let [e, r] of t) n[e] = r;
|
|
111
118
|
return n;
|
|
112
|
-
}, ke = /* @__PURE__ */ X({ default: () => Ae }), Ae = /*#__PURE__*/ Z(Oe, [["__scopeId", "data-v-
|
|
119
|
+
}, ke = /* @__PURE__ */ X({ default: () => Ae }), Ae = /*#__PURE__*/ Z(Oe, [["__scopeId", "data-v-a9405949"]]), je = ["viewBox"], Me = ["href", "xlink:href"], Ne = /*@__PURE__*/ h({
|
|
113
120
|
name: "FouIcon",
|
|
114
121
|
__name: "index",
|
|
115
122
|
props: {
|
|
@@ -17298,16 +17305,18 @@ var hm = { class: "badge-editor-header page-header" }, gm = { class: "badge-edit
|
|
|
17298
17305
|
},
|
|
17299
17306
|
emits: ["update:modelValue", "change"],
|
|
17300
17307
|
setup(e, { expose: n, emit: r }) {
|
|
17301
|
-
let i = e, o = r, d = I([]), f = I(/* @__PURE__ */ new Map()), p =
|
|
17302
|
-
|
|
17303
|
-
|
|
17304
|
-
|
|
17305
|
-
|
|
17306
|
-
|
|
17307
|
-
|
|
17308
|
-
|
|
17308
|
+
let i = e, o = r, d = I([]), f = I(/* @__PURE__ */ new Map()), p = I(i.modelValue ?? 0), g = null, _ = a(() => d.value.length), v = (e) => _.value ? (e % _.value + _.value) % _.value : 0, y = a(() => v(p.value)), b = (e) => {
|
|
17309
|
+
let t = v(e);
|
|
17310
|
+
p.value !== t && (p.value = t, o("update:modelValue", t), o("change", t));
|
|
17311
|
+
};
|
|
17312
|
+
W(() => i.modelValue, (e) => {
|
|
17313
|
+
if (e == null) return;
|
|
17314
|
+
let t = v(e);
|
|
17315
|
+
p.value !== t && (p.value = t);
|
|
17316
|
+
});
|
|
17317
|
+
let x = a(() => {
|
|
17309
17318
|
if (i.height !== "" && i.height != null) return { height: typeof i.height == "number" ? `${i.height}px` : i.height };
|
|
17310
|
-
}),
|
|
17319
|
+
}), S = a(() => ({ transform: `translateX(-${y.value * 100}%)` })), C = (e) => {
|
|
17311
17320
|
let t = f.value.get(e);
|
|
17312
17321
|
return t ? h({
|
|
17313
17322
|
name: "FouCarouselSlideHost",
|
|
@@ -17318,8 +17327,8 @@ var hm = { class: "badge-editor-header page-header" }, gm = { class: "badge-edit
|
|
|
17318
17327
|
}) : null;
|
|
17319
17328
|
};
|
|
17320
17329
|
P(vv, {
|
|
17321
|
-
activeIndex:
|
|
17322
|
-
itemCount:
|
|
17330
|
+
activeIndex: y,
|
|
17331
|
+
itemCount: _,
|
|
17323
17332
|
registerItem: (e) => {
|
|
17324
17333
|
let t = d.value.findIndex((t) => t.uid === e.uid);
|
|
17325
17334
|
return t >= 0 ? d.value[t] = e : d.value.push(e), d.value.findIndex((t) => t.uid === e.uid);
|
|
@@ -17331,72 +17340,72 @@ var hm = { class: "badge-editor-header page-header" }, gm = { class: "badge-edit
|
|
|
17331
17340
|
}), P("fouCarouselRegisterRender", (e, t) => {
|
|
17332
17341
|
f.value.set(e, t);
|
|
17333
17342
|
});
|
|
17334
|
-
let
|
|
17335
|
-
|
|
17336
|
-
}, S = () => {
|
|
17337
|
-
g.value && (_.value >= g.value - 1 ? _.value = i.loop ? 0 : g.value - 1 : _.value += 1);
|
|
17338
|
-
}, C = () => {
|
|
17339
|
-
g.value && (_.value <= 0 ? _.value = i.loop ? g.value - 1 : 0 : --_.value);
|
|
17340
|
-
}, T = () => {
|
|
17341
|
-
D(), !(!i.autoplay || g.value <= 1) && (p = setInterval(() => S(), i.interval));
|
|
17343
|
+
let T = (e) => {
|
|
17344
|
+
_.value && b(e);
|
|
17342
17345
|
}, D = () => {
|
|
17343
|
-
|
|
17344
|
-
}, O = () =>
|
|
17346
|
+
_.value && (y.value >= _.value - 1 ? b(i.loop ? 0 : _.value - 1) : b(y.value + 1));
|
|
17347
|
+
}, O = () => {
|
|
17348
|
+
_.value && (y.value <= 0 ? b(i.loop ? _.value - 1 : 0) : b(y.value - 1));
|
|
17349
|
+
}, A = () => {
|
|
17350
|
+
j(), !(!i.autoplay || _.value <= 1) && (g = setInterval(() => D(), i.interval));
|
|
17351
|
+
}, j = () => {
|
|
17352
|
+
g &&= (clearInterval(g), null);
|
|
17353
|
+
}, M = () => j(), F = () => A();
|
|
17345
17354
|
return W(() => [
|
|
17346
17355
|
i.autoplay,
|
|
17347
17356
|
i.interval,
|
|
17348
|
-
|
|
17349
|
-
], () =>
|
|
17350
|
-
next:
|
|
17351
|
-
prev:
|
|
17352
|
-
goTo:
|
|
17357
|
+
_.value
|
|
17358
|
+
], () => A(), { immediate: !0 }), k(j), n({
|
|
17359
|
+
next: D,
|
|
17360
|
+
prev: O,
|
|
17361
|
+
goTo: T
|
|
17353
17362
|
}), (n, r) => {
|
|
17354
17363
|
let i = Fe;
|
|
17355
17364
|
return N(), l("div", {
|
|
17356
17365
|
class: w(["fou-carousel", [`fou-carousel--arrow-${e.arrow}`]]),
|
|
17357
|
-
style: E(U(
|
|
17358
|
-
onMouseenter:
|
|
17359
|
-
onMouseleave:
|
|
17366
|
+
style: E(U(x)),
|
|
17367
|
+
onMouseenter: M,
|
|
17368
|
+
onMouseleave: F
|
|
17360
17369
|
}, [
|
|
17361
17370
|
u("div", yv, [
|
|
17362
17371
|
u("div", {
|
|
17363
17372
|
class: "fou-carousel__track",
|
|
17364
|
-
style: E(U(
|
|
17373
|
+
style: E(U(S))
|
|
17365
17374
|
}, [(N(!0), l(t, null, L(U(d), (e, t) => (N(), l("div", {
|
|
17366
17375
|
key: e.uid,
|
|
17367
|
-
class: w(["fou-carousel__slide", { "is-active": t === U(
|
|
17368
|
-
"aria-hidden": t !== U(
|
|
17369
|
-
}, [
|
|
17370
|
-
e.arrow !== "never" && U(
|
|
17376
|
+
class: w(["fou-carousel__slide", { "is-active": t === U(y) }]),
|
|
17377
|
+
"aria-hidden": t !== U(y)
|
|
17378
|
+
}, [C(e.uid) ? (N(), s(V(C(e.uid)), { key: 0 })) : c("", !0)], 10, bv))), 128))], 4),
|
|
17379
|
+
e.arrow !== "never" && U(_) > 1 ? (N(), l("button", {
|
|
17371
17380
|
key: 0,
|
|
17372
17381
|
type: "button",
|
|
17373
17382
|
class: "fou-carousel__arrow fou-carousel__arrow--left",
|
|
17374
17383
|
"aria-label": "previous",
|
|
17375
|
-
onClick: q(
|
|
17384
|
+
onClick: q(O, ["stop"])
|
|
17376
17385
|
}, [m(i, { icon: "arrow-left-s-line" })])) : c("", !0),
|
|
17377
|
-
e.arrow !== "never" && U(
|
|
17386
|
+
e.arrow !== "never" && U(_) > 1 ? (N(), l("button", {
|
|
17378
17387
|
key: 1,
|
|
17379
17388
|
type: "button",
|
|
17380
17389
|
class: "fou-carousel__arrow fou-carousel__arrow--right",
|
|
17381
17390
|
"aria-label": "next",
|
|
17382
|
-
onClick: q(
|
|
17391
|
+
onClick: q(D, ["stop"])
|
|
17383
17392
|
}, [m(i, { icon: "arrow-right-s-line" })])) : c("", !0)
|
|
17384
17393
|
]),
|
|
17385
|
-
e.indicatorPosition !== "none" && U(
|
|
17394
|
+
e.indicatorPosition !== "none" && U(_) > 1 ? (N(), l("div", {
|
|
17386
17395
|
key: 0,
|
|
17387
17396
|
class: w(["fou-carousel__indicators", `fou-carousel__indicators--${e.indicatorPosition}`])
|
|
17388
|
-
}, [(N(!0), l(t, null, L(U(
|
|
17397
|
+
}, [(N(!0), l(t, null, L(U(_), (e, t) => (N(), l("button", {
|
|
17389
17398
|
key: t,
|
|
17390
17399
|
type: "button",
|
|
17391
|
-
class: w(["fou-carousel__indicator", { "is-active": t === U(
|
|
17400
|
+
class: w(["fou-carousel__indicator", { "is-active": t === U(y) }]),
|
|
17392
17401
|
"aria-label": `slide ${t + 1}`,
|
|
17393
|
-
onClick: q((e) =>
|
|
17402
|
+
onClick: q((e) => T(t), ["stop"])
|
|
17394
17403
|
}, null, 10, xv))), 128))], 2)) : c("", !0),
|
|
17395
17404
|
u("div", Sv, [R(n.$slots, "default", {}, void 0, !0)])
|
|
17396
17405
|
], 38);
|
|
17397
17406
|
};
|
|
17398
17407
|
}
|
|
17399
|
-
}), wv = /* @__PURE__ */ X({ default: () => Tv }), Tv = /*#__PURE__*/ Z(Cv, [["__scopeId", "data-v-
|
|
17408
|
+
}), wv = /* @__PURE__ */ X({ default: () => Tv }), Tv = /*#__PURE__*/ Z(Cv, [["__scopeId", "data-v-6d39c1aa"]]), Ev = ["data-uid"], Dv = /*@__PURE__*/ h({
|
|
17400
17409
|
name: "FouCarouselItem",
|
|
17401
17410
|
__name: "index",
|
|
17402
17411
|
props: { name: {} },
|