@fuxishi/vitepress-theme 1.0.7 → 1.0.9

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.
@@ -0,0 +1,199 @@
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 };
package/dist/index.js CHANGED
@@ -20,8 +20,8 @@ var s = t({ setup(t, { slots: s }) {
20
20
  });
21
21
  });
22
22
  let p = f.musicBall?.enable && (f.musicBall?.src || f.musicBall?.list?.length > 0);
23
- f.smoothScroll && document.documentElement.classList.add("fx-smooth-scroll");
24
- let m = a(() => import("./chunk/FxMusicBall-BruAGB47.js"), [{ style: { display: f.musicBall && f.musicBall.visible ? "" : "none" } }]), h = a(() => import("./chunk/FxHomeFeatureBefore-B-_BJxjO.js")), g = a(() => import("./chunk/FxConfetti-BA6pwd1S.js"), [{ confetti: f.confetti }]), _ = a(() => import("./chunk/FxHeroImageBg-BgS1cNDu.js"), [{ heroImageColor: f.heroImageColor }]);
23
+ f.smoothScroll && typeof document < "u" && document.documentElement.classList.add("fx-smooth-scroll");
24
+ let m = a(() => import("./chunk/FxMusicBall-BYNfzoJY.js"), [{ style: { display: f.musicBall && f.musicBall.visible ? "" : "none" } }]), h = a(() => import("./chunk/FxHomeFeatureBefore-B-_BJxjO.js")), g = a(() => import("./chunk/FxConfetti-BA6pwd1S.js"), [{ confetti: f.confetti }]), _ = a(() => import("./chunk/FxHeroImageBg-BgS1cNDu.js"), [{ heroImageColor: f.heroImageColor }]);
25
25
  return () => [
26
26
  f.heroImageColor && n("style", ":root{--vp-home-hero-image-background-image:none;--vp-home-hero-name-color:transparent;--vp-home-hero-name-background:none}"),
27
27
  n(l, null, {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fuxishi/vitepress-theme",
3
3
  "displayName": "@fuxishi/vitepress-theme",
4
4
  "private": false,
5
- "version": "1.0.7",
5
+ "version": "1.0.9",
6
6
  "license": "MIT",
7
7
  "description": "一款精美的 VitePress 主题",
8
8
  "keywords": [
@@ -1,185 +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, 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 _ } from "vitepress";
3
- import { ElSlider as v } from "element-plus";
4
- //#region .vitepress/components/FxMusicBall.vue?vue&type=script&setup=true&lang.ts
5
- var y = [
6
- "src",
7
- "autoplay",
8
- "loop"
9
- ], b = ["src", "autoplay"], x = { class: "fx-music-ball__inner" }, S = { class: "fx-play-pause" }, C = { class: "iconfont icon-playfill" }, w = { class: "iconfont icon-pause" }, T = { class: "fx-time" }, E = { class: "fx-duration" }, ee = { class: "fx-volume" }, te = {
10
- id: "fx-progress-gradient",
11
- x1: "0%",
12
- y1: "0%",
13
- x2: "100%",
14
- y2: "100%"
15
- }, ne = ["stop-color"], D = ["stop-color"], O = ["stroke-dasharray"], k = {
16
- key: 2,
17
- class: "fx-orbit-ring"
18
- }, A = {
19
- key: 3,
20
- class: "fx-music-list"
21
- }, j = ["onClick"], M = ["d"], N = /* @__PURE__ */ o({
22
- __name: "FxMusicBall",
23
- setup(o) {
24
- let N = [
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: P } = _(), F = P.value.themeConfig.musicBall, I = u(null), L = u(0), R = u(0), z = u(0), B = u(!1), V = u(50), H = u(!1), U = u(0), W = u(!!F.autoplay), G = u(!1), K = 2 * Math.PI * 22, q = u("#bd34fe"), J = u("#41d1ff");
30
- c(() => {
31
- let e = getComputedStyle(document.documentElement), t = e.getPropertyValue("--fx-beam-c1").trim(), n = e.getPropertyValue("--fx-beam-c2").trim();
32
- t && (q.value = `rgb(${t})`), n && (J.value = `rgb(${n})`);
33
- });
34
- let Y = t(() => {
35
- let e = K - Q.value / 100 * K;
36
- return `${K - e} ${e}`;
37
- }), X = t(() => F.src || F.list?.length === 1), re = t(() => F.src || F.list?.[0]?.src), Z = t(() => F.list || []), Q = t({
38
- get() {
39
- return z.value / L.value * 100 || 0;
40
- },
41
- set(e) {
42
- R.value = L.value * e / 100, !B.value && I.value && (I.value.currentTime = R.value);
43
- }
44
- }), ie = t(() => $(L.value)), ae = t(() => $(z.value));
45
- h(() => {
46
- I.value && (H.value = !1, I.value.volume = V.value / 100);
47
- }), h(() => {
48
- I.value && (I.value.muted = H.value);
49
- }), c(() => {
50
- let e = I.value;
51
- e?.addEventListener("play", () => {
52
- B.value = !0;
53
- }), e?.addEventListener("pause", () => {
54
- B.value = !1;
55
- }), e?.addEventListener("timeupdate", () => {
56
- L.value = e.duration, z.value = e.currentTime;
57
- }), e?.addEventListener("canplay", () => {
58
- L.value = e.duration;
59
- }), e?.addEventListener("ended", () => {
60
- U.value + 1 > Z.value.length - 1 ? U.value = 0 : U.value++;
61
- });
62
- });
63
- let oe = () => {
64
- B.value = !B.value, B.value ? I.value?.play() : I.value?.pause(), !X.value && !W.value && (W.value = !0);
65
- }, se = () => {
66
- I.value && (I.value.currentTime = R.value);
67
- }, ce = (e) => {
68
- W.value = !0, U.value = e;
69
- }, le = () => {
70
- G.value = !1;
71
- };
72
- function $(e) {
73
- return e = Number(e), `${Math.floor(e % 3600 / 60) || 0}:${(Math.floor(e % 3600 % 60) || 0).toString().padStart(2, "0")}`;
74
- }
75
- return (t, o) => (l(), r("div", {
76
- class: s(["fx-music-ball", {
77
- active: G.value,
78
- "is-playing": B.value
79
- }]),
80
- onMouseleave: le
81
- }, [
82
- X.value ? (l(), r("audio", {
83
- key: 0,
84
- class: "audio",
85
- src: re.value,
86
- autoplay: p(F).autoplay,
87
- loop: p(F).loop,
88
- style: { display: "none" },
89
- ref_key: "audioRef",
90
- ref: I
91
- }, null, 8, y)) : (l(), r("audio", {
92
- key: 1,
93
- class: "audio",
94
- src: Z.value[U.value].src,
95
- autoplay: W.value,
96
- style: { display: "none" },
97
- ref_key: "audioRef",
98
- ref: I
99
- }, null, 8, b)),
100
- i("div", x, [
101
- i("div", S, [g(i("span", C, null, 512), [[m, !B.value]]), g(i("span", w, null, 512), [[m, B.value]])]),
102
- i("div", T, f(ie.value) + "\xA0/\xA0" + f(ae.value), 1),
103
- i("div", E, [a(p(v), {
104
- style: { width: "100%" },
105
- "show-tooltip": !1,
106
- modelValue: Q.value,
107
- "onUpdate:modelValue": o[0] ||= (e) => Q.value = e,
108
- onChange: se
109
- }, null, 8, ["modelValue"])]),
110
- i("div", ee, [
111
- a(p(v), {
112
- style: { width: "100%" },
113
- "show-tooltip": !1,
114
- modelValue: V.value,
115
- "onUpdate:modelValue": o[1] ||= (e) => V.value = e
116
- }, null, 8, ["modelValue"]),
117
- g(i("span", {
118
- class: "iconfont icon-ic_volume_off",
119
- onClick: o[2] ||= (e) => H.value = !H.value
120
- }, null, 512), [[m, H.value]]),
121
- g(i("span", {
122
- class: "iconfont icon-ic_volume_up",
123
- onClick: o[3] ||= (e) => H.value = !H.value
124
- }, null, 512), [[m, !H.value]])
125
- ]),
126
- X.value ? n("", !0) : (l(), r("div", {
127
- key: 0,
128
- class: "fx-music-list-button",
129
- onClick: o[4] ||= (e) => G.value = !G.value
130
- }, [...o[5] ||= [i("span", { class: "iconfont icon-music_list" }, null, -1)]]))
131
- ]),
132
- (l(), r("svg", {
133
- class: "fx-progress-ring",
134
- width: "50",
135
- height: "50",
136
- viewBox: "0 0 50 50",
137
- onClick: oe
138
- }, [
139
- i("defs", null, [i("linearGradient", te, [i("stop", {
140
- offset: "0%",
141
- "stop-color": q.value
142
- }, null, 8, ne), i("stop", {
143
- offset: "100%",
144
- "stop-color": J.value
145
- }, null, 8, D)])]),
146
- o[6] ||= i("circle", {
147
- class: "fx-progress-track",
148
- cx: "25",
149
- cy: "25",
150
- r: "22",
151
- fill: "none",
152
- "stroke-width": "2.5"
153
- }, null, -1),
154
- i("circle", {
155
- class: "fx-progress-bar",
156
- cx: "25",
157
- cy: "25",
158
- r: "22",
159
- fill: "none",
160
- stroke: "url(#fx-progress-gradient)",
161
- "stroke-width": "2.5",
162
- "stroke-linecap": "round",
163
- "stroke-dasharray": Y.value
164
- }, null, 8, O)
165
- ])),
166
- B.value ? (l(), r("div", k)) : n("", !0),
167
- G.value ? (l(), r("div", A, [(l(!0), r(e, null, d(Z.value, (t, a) => (l(), r("div", {
168
- class: s(["fx-music-list-item", U.value === a ? "active" : ""]),
169
- key: a,
170
- onClick: (e) => ce(a)
171
- }, [U.value === a ? (l(), r("svg", {
172
- key: 0,
173
- class: s(["image-live", { playing: B.value }]),
174
- viewBox: "0 0 1024 1024",
175
- xmlns: "http://www.w3.org/2000/svg"
176
- }, [(l(), r(e, null, d(N, (e, t) => i("path", {
177
- key: t,
178
- d: e,
179
- class: s(["bar", `bar-${t + 1}`])
180
- }, null, 10, M)), 64))], 2)) : n("", !0), i("span", null, f(t.name), 1)], 10, j))), 128)), o[7] ||= i("div", { class: "fx-music-list-sep" }, null, -1)])) : n("", !0)
181
- ], 34));
182
- }
183
- });
184
- //#endregion
185
- export { N as default };