@fuxishi/vitepress-theme 1.0.9 → 1.0.11

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.
@@ -1,199 +0,0 @@
1
- import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, normalizeClass as s, onMounted as c, onUnmounted as ee, openBlock as l, ref as u, renderList as d, toDisplayString as f, unref as p, vShow as m, watchEffect as h, withDirectives as g } from "vue";
2
- import { useData as te } from "vitepress";
3
- import { ElSlider as _ } from "element-plus";
4
- //#region .vitepress/components/FxMusicBall.vue?vue&type=script&setup=true&lang.ts
5
- var v = [
6
- "src",
7
- "autoplay",
8
- "loop"
9
- ], y = ["src", "autoplay"], b = { class: "fx-music-ball__inner" }, x = { class: "fx-play-pause" }, S = { class: "iconfont icon-playfill" }, C = { class: "iconfont icon-pause" }, w = { class: "fx-time" }, T = { class: "fx-duration" }, E = { class: "fx-volume" }, D = {
10
- id: "fx-progress-gradient",
11
- x1: "0%",
12
- y1: "0%",
13
- x2: "100%",
14
- y2: "100%"
15
- }, O = ["stop-color"], k = ["stop-color"], A = ["stroke-dasharray"], j = {
16
- key: 2,
17
- class: "fx-orbit-ring"
18
- }, ne = {
19
- key: 3,
20
- class: "fx-music-list"
21
- }, re = ["onClick"], ie = ["d"], M = /* @__PURE__ */ o({
22
- __name: "FxMusicBall",
23
- setup(o) {
24
- let M = [
25
- "M123.252 73.826h111.169v790.935h-111.169z",
26
- "M346.361 465.952h111.169v395.467h-111.169z",
27
- "M569.466 229.325h111.169v636.444h-111.169z",
28
- "M792.574 391.584h111.169v475.788h-111.169z"
29
- ], { site: ae } = te(), N = ae.value.themeConfig.musicBall, P = u(null), F = u(0), I = u(0), L = u(0), R = u(!1), z = u(50), B = u(!1), V = u(0), H = u(!!N.autoplay), U = u(!1), W = 2 * Math.PI * 22, G = u("#bd34fe"), K = u("#41d1ff");
30
- function q() {
31
- let e = getComputedStyle(document.documentElement), t = e.getPropertyValue("--fx-beam-c1").trim(), n = e.getPropertyValue("--fx-beam-c2").trim();
32
- t && (G.value = `rgb(${t})`), n && (K.value = `rgb(${n})`);
33
- }
34
- let J = null;
35
- c(() => {
36
- q(), J = new MutationObserver((e) => {
37
- for (let t of e) if (t.attributeName === "style") {
38
- q();
39
- break;
40
- }
41
- }), J.observe(document.documentElement, {
42
- attributes: !0,
43
- attributeFilter: ["style"]
44
- });
45
- }), ee(() => {
46
- J?.disconnect();
47
- });
48
- let oe = t(() => {
49
- let e = W - Z.value / 100 * W;
50
- return `${W - e} ${e}`;
51
- }), Y = t(() => N.src || N.list?.length === 1), se = t(() => N.src || N.list?.[0]?.src), X = t(() => N.list || []), Z = t({
52
- get() {
53
- return L.value / F.value * 100 || 0;
54
- },
55
- set(e) {
56
- I.value = F.value * e / 100, !R.value && P.value && (P.value.currentTime = I.value);
57
- }
58
- }), ce = t(() => $(F.value)), le = t(() => $(L.value));
59
- h(() => {
60
- P.value && (B.value = !1, P.value.volume = z.value / 100);
61
- }), h(() => {
62
- P.value && (P.value.muted = B.value);
63
- }), c(() => {
64
- let e = P.value;
65
- e?.addEventListener("play", () => {
66
- R.value = !0;
67
- }), e?.addEventListener("pause", () => {
68
- R.value = !1;
69
- }), e?.addEventListener("timeupdate", () => {
70
- F.value = e.duration, L.value = e.currentTime;
71
- }), e?.addEventListener("canplay", () => {
72
- F.value = e.duration;
73
- }), e?.addEventListener("ended", () => {
74
- V.value + 1 > X.value.length - 1 ? V.value = 0 : V.value++;
75
- });
76
- });
77
- let ue = () => {
78
- R.value = !R.value, R.value ? P.value?.play() : P.value?.pause(), !Y.value && !H.value && (H.value = !0);
79
- }, Q = () => {
80
- P.value && (P.value.currentTime = I.value);
81
- }, de = (e) => {
82
- H.value = !0, V.value = e;
83
- }, fe = () => {
84
- U.value = !1;
85
- };
86
- function $(e) {
87
- return e = Number(e), `${Math.floor(e % 3600 / 60) || 0}:${(Math.floor(e % 3600 % 60) || 0).toString().padStart(2, "0")}`;
88
- }
89
- return (t, o) => (l(), r("div", {
90
- class: s(["fx-music-ball", {
91
- active: U.value,
92
- "is-playing": R.value
93
- }]),
94
- onMouseleave: fe
95
- }, [
96
- Y.value ? (l(), r("audio", {
97
- key: 0,
98
- class: "audio",
99
- src: se.value,
100
- autoplay: p(N).autoplay,
101
- loop: p(N).loop,
102
- style: { display: "none" },
103
- ref_key: "audioRef",
104
- ref: P
105
- }, null, 8, v)) : (l(), r("audio", {
106
- key: 1,
107
- class: "audio",
108
- src: X.value[V.value].src,
109
- autoplay: H.value,
110
- style: { display: "none" },
111
- ref_key: "audioRef",
112
- ref: P
113
- }, null, 8, y)),
114
- i("div", b, [
115
- i("div", x, [g(i("span", S, null, 512), [[m, !R.value]]), g(i("span", C, null, 512), [[m, R.value]])]),
116
- i("div", w, f(ce.value) + "\xA0/\xA0" + f(le.value), 1),
117
- i("div", T, [a(p(_), {
118
- style: { width: "100%" },
119
- "show-tooltip": !1,
120
- modelValue: Z.value,
121
- "onUpdate:modelValue": o[0] ||= (e) => Z.value = e,
122
- onChange: Q
123
- }, null, 8, ["modelValue"])]),
124
- i("div", E, [
125
- a(p(_), {
126
- style: { width: "100%" },
127
- "show-tooltip": !1,
128
- modelValue: z.value,
129
- "onUpdate:modelValue": o[1] ||= (e) => z.value = e
130
- }, null, 8, ["modelValue"]),
131
- g(i("span", {
132
- class: "iconfont icon-ic_volume_off",
133
- onClick: o[2] ||= (e) => B.value = !B.value
134
- }, null, 512), [[m, B.value]]),
135
- g(i("span", {
136
- class: "iconfont icon-ic_volume_up",
137
- onClick: o[3] ||= (e) => B.value = !B.value
138
- }, null, 512), [[m, !B.value]])
139
- ]),
140
- Y.value ? n("", !0) : (l(), r("div", {
141
- key: 0,
142
- class: "fx-music-list-button",
143
- onClick: o[4] ||= (e) => U.value = !U.value
144
- }, [...o[5] ||= [i("span", { class: "iconfont icon-music_list" }, null, -1)]]))
145
- ]),
146
- (l(), r("svg", {
147
- class: "fx-progress-ring",
148
- width: "50",
149
- height: "50",
150
- viewBox: "0 0 50 50",
151
- onClick: ue
152
- }, [
153
- i("defs", null, [i("linearGradient", D, [i("stop", {
154
- offset: "0%",
155
- "stop-color": G.value
156
- }, null, 8, O), i("stop", {
157
- offset: "100%",
158
- "stop-color": K.value
159
- }, null, 8, k)])]),
160
- o[6] ||= i("circle", {
161
- class: "fx-progress-track",
162
- cx: "25",
163
- cy: "25",
164
- r: "22",
165
- fill: "none",
166
- "stroke-width": "2.5"
167
- }, null, -1),
168
- i("circle", {
169
- class: "fx-progress-bar",
170
- cx: "25",
171
- cy: "25",
172
- r: "22",
173
- fill: "none",
174
- stroke: "url(#fx-progress-gradient)",
175
- "stroke-width": "2.5",
176
- "stroke-linecap": "round",
177
- "stroke-dasharray": oe.value
178
- }, null, 8, A)
179
- ])),
180
- R.value ? (l(), r("div", j)) : n("", !0),
181
- U.value ? (l(), r("div", ne, [(l(!0), r(e, null, d(X.value, (t, a) => (l(), r("div", {
182
- class: s(["fx-music-list-item", V.value === a ? "active" : ""]),
183
- key: a,
184
- onClick: (e) => de(a)
185
- }, [V.value === a ? (l(), r("svg", {
186
- key: 0,
187
- class: s(["image-live", { playing: R.value }]),
188
- viewBox: "0 0 1024 1024",
189
- xmlns: "http://www.w3.org/2000/svg"
190
- }, [(l(), r(e, null, d(M, (e, t) => i("path", {
191
- key: t,
192
- d: e,
193
- class: s(["bar", `bar-${t + 1}`])
194
- }, null, 10, ie)), 64))], 2)) : n("", !0), i("span", null, f(t.name), 1)], 10, re))), 128)), o[7] ||= i("div", { class: "fx-music-list-sep" }, null, -1)])) : n("", !0)
195
- ], 34));
196
- }
197
- });
198
- //#endregion
199
- export { M as default };