@fuxishi/vitepress-theme 2.0.0-alpha.3 → 2.0.0-alpha.4
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.
|
@@ -90,38 +90,38 @@ var C = e({
|
|
|
90
90
|
render: () => null,
|
|
91
91
|
setup(e) {
|
|
92
92
|
if (!e.heroImageColor) return;
|
|
93
|
-
let f = null, p = o(), { frontmatter: m } = a();
|
|
94
|
-
function
|
|
93
|
+
let f = null, p = o(), { frontmatter: m, site: h } = a();
|
|
94
|
+
function g() {
|
|
95
95
|
let e = document.documentElement;
|
|
96
96
|
e.style.removeProperty("--vp-home-hero-image-background-image"), e.style.removeProperty("--vp-home-hero-name-background"), e.style.removeProperty("--fx-beam-c1"), e.style.removeProperty("--fx-beam-c2");
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function _(e) {
|
|
99
99
|
return y() ? e.dark || e.light : e.light || e.dark;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function v(e) {
|
|
102
102
|
let t = u();
|
|
103
103
|
return !t || !t.images ? !1 : e && (e.light && t.images.light && e.light !== t.images.light || e.dark && t.images.dark && e.dark !== t.images.dark) ? (localStorage.removeItem(l), !0) : !1;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function C() {
|
|
106
106
|
let e = u();
|
|
107
107
|
if (!e) return !1;
|
|
108
|
-
let t =
|
|
108
|
+
let t = _(e);
|
|
109
109
|
return t ? (x(t), !0) : !1;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function w() {
|
|
112
112
|
let e = u();
|
|
113
113
|
if (!e) return !1;
|
|
114
|
-
let t =
|
|
114
|
+
let t = _(e);
|
|
115
115
|
return t ? (S(t), !0) : !1;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function T() {
|
|
118
118
|
return m.value.fxHeroImages || {};
|
|
119
119
|
}
|
|
120
|
-
async function
|
|
120
|
+
async function E() {
|
|
121
121
|
try {
|
|
122
122
|
let e = await import(
|
|
123
123
|
/* @vite-ignore */
|
|
124
|
-
"
|
|
124
|
+
[h.value.base, "index.md"].join("")
|
|
125
125
|
), t = (typeof e.__pageData == "string" ? JSON.parse(e.__pageData) : e.__pageData)?.frontmatter?.hero?.image;
|
|
126
126
|
return t ? typeof t == "string" ? {
|
|
127
127
|
light: t,
|
|
@@ -134,7 +134,7 @@ var C = e({
|
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
async function
|
|
137
|
+
async function D(e, t) {
|
|
138
138
|
let n = e.src;
|
|
139
139
|
if (n) try {
|
|
140
140
|
let e = b(await c.from(n).quality(1).getPalette());
|
|
@@ -143,7 +143,7 @@ var C = e({
|
|
|
143
143
|
r[t] = e, r.images ||= {}, r.images[t] = n, d(r);
|
|
144
144
|
} catch {}
|
|
145
145
|
}
|
|
146
|
-
async function
|
|
146
|
+
async function O(e, t) {
|
|
147
147
|
try {
|
|
148
148
|
let n = b(await c.from(e).quality(1).getPalette()), r = u() || {};
|
|
149
149
|
return r[t] = n, r.images ||= {}, r.images[t] = e, d(r), n;
|
|
@@ -151,15 +151,15 @@ var C = e({
|
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
async function
|
|
154
|
+
async function k(e, t = !0) {
|
|
155
155
|
if (!e.light && !e.dark) return;
|
|
156
156
|
let n = {};
|
|
157
157
|
if (e.light) {
|
|
158
|
-
let r = await
|
|
158
|
+
let r = await O(t ? s(e.light) : e.light, "light");
|
|
159
159
|
r && (n.light = r);
|
|
160
160
|
}
|
|
161
161
|
if (e.dark) {
|
|
162
|
-
let r = await
|
|
162
|
+
let r = await O(t ? s(e.dark) : e.dark, "dark");
|
|
163
163
|
r && (n.dark = r);
|
|
164
164
|
}
|
|
165
165
|
if (n.light || n.dark) {
|
|
@@ -167,15 +167,15 @@ var C = e({
|
|
|
167
167
|
e && x(e);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
async function
|
|
171
|
-
let e =
|
|
170
|
+
async function A() {
|
|
171
|
+
let e = T();
|
|
172
172
|
if (e.light || e.dark) {
|
|
173
|
-
await
|
|
173
|
+
await k(e);
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
let t = await
|
|
176
|
+
let t = await E();
|
|
177
177
|
if (t) {
|
|
178
|
-
await
|
|
178
|
+
await k(t);
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
try {
|
|
@@ -183,22 +183,22 @@ var C = e({
|
|
|
183
183
|
t.forEach((e) => {
|
|
184
184
|
let t = e.getAttribute("src");
|
|
185
185
|
t && (e.classList.contains("dark") ? n.dark = t : n.light = t);
|
|
186
|
-
}), (n.light || n.dark) && await
|
|
186
|
+
}), (n.light || n.dark) && await k(n, !1);
|
|
187
187
|
} catch {}
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function j() {
|
|
190
190
|
let e = document.querySelector(".VPHero .image-container img.VPImage.light"), t = document.querySelector(".VPHero .image-container img.VPImage.dark");
|
|
191
|
-
e || t ? (e && e.complete && e.naturalWidth > 0 ?
|
|
191
|
+
e || t ? (e && e.complete && e.naturalWidth > 0 ? D(e, "light") : e && e.addEventListener("load", () => D(e, "light"), { once: !0 }), t && t.complete && t.naturalWidth > 0 ? D(t, "dark") : t && t.addEventListener("load", () => D(t, "dark"), { once: !0 })) : (g(), w(), E().then((e) => {
|
|
192
192
|
if (e && (e.light || e.dark)) {
|
|
193
193
|
let t = u();
|
|
194
|
-
t?.images && (e.light && t.images.light && e.light !== t.images.light || e.dark && t.images.dark && e.dark !== t.images.dark) && (localStorage.removeItem(l),
|
|
194
|
+
t?.images && (e.light && t.images.light && e.light !== t.images.light || e.dark && t.images.dark && e.dark !== t.images.dark) && (localStorage.removeItem(l), k(e));
|
|
195
195
|
}
|
|
196
|
-
}),
|
|
196
|
+
}), A());
|
|
197
197
|
}
|
|
198
198
|
r(() => {
|
|
199
|
-
|
|
199
|
+
v(T()), C() || A(), j(), f = new MutationObserver((e) => {
|
|
200
200
|
for (let t of e) if (t.attributeName === "class") {
|
|
201
|
-
|
|
201
|
+
w(), j();
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
}), f.observe(document.documentElement, {
|
|
@@ -206,9 +206,9 @@ var C = e({
|
|
|
206
206
|
attributeFilter: ["class"]
|
|
207
207
|
});
|
|
208
208
|
}), i(() => p.path, () => {
|
|
209
|
-
t(
|
|
209
|
+
t(j);
|
|
210
210
|
}), n(() => {
|
|
211
|
-
f?.disconnect(),
|
|
211
|
+
f?.disconnect(), g();
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
});
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var d = {
|
|
|
32
32
|
}, t = document.querySelector(".VPNavBarTitle .title");
|
|
33
33
|
t && (x = new ResizeObserver(e), x.observe(t)), e();
|
|
34
34
|
}), a(() => x?.disconnect());
|
|
35
|
-
let w = c(() => import("./chunk/FxMusicBall-CTP51ydo.js"), [{ style: { display: g.musicBall && g.musicBall.visible ? "" : "none" } }]), T = c(() => import("./chunk/FxHomeFeatureBefore-Cd9m9wit.js")), E = c(() => import("./chunk/FxConfetti-DFRD5KKS.js"), [{ confetti: g.confetti }]), D = c(() => import("./chunk/FxHeroImageBg-
|
|
35
|
+
let w = c(() => import("./chunk/FxMusicBall-CTP51ydo.js"), [{ style: { display: g.musicBall && g.musicBall.visible ? "" : "none" } }]), T = c(() => import("./chunk/FxHomeFeatureBefore-Cd9m9wit.js")), E = c(() => import("./chunk/FxConfetti-DFRD5KKS.js"), [{ confetti: g.confetti }]), D = c(() => import("./chunk/FxHeroImageBg-AXhVm0se.js"), [{ heroImageColor: g.heroImageColor }]), O = c(() => import("./chunk/FxCodeBlockFold-BZw-1rNl.js"), [{ lines: C }]);
|
|
36
36
|
return () => [
|
|
37
37
|
S && n("style", `:root{--fx-code-fold-lines:${C || 10}}`),
|
|
38
38
|
g.heroImageColor && n("style", ":root{--vp-home-hero-image-background-image:none;--vp-home-hero-name-color:transparent;--vp-home-hero-name-background:none}"),
|
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": "2.0.0-alpha.
|
|
5
|
+
"version": "2.0.0-alpha.4",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "一款精美的 VitePress 主题",
|
|
8
8
|
"keywords": [
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"ncu": "ncu -u && npm install",
|
|
45
45
|
"login": "npm login --registry=https://registry.npmjs.org/",
|
|
46
46
|
"pub": "npm publish --access public --registry=https://registry.npmjs.org/",
|
|
47
|
+
"pub-tag": "npm publish --access public --tag alpha --registry=https://registry.npmjs.org/",
|
|
47
48
|
"deprecate": "node -e \"const v=process.argv[1],m=process.argv[2]||'';require('child_process').execSync('npm deprecate @fuxishi/vitepress-theme@'+v+' \\\"'+m+'\\\" --registry=https://registry.npmjs.org/',{stdio:'inherit'})\""
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|