@fuxishi/vitepress-theme 1.0.13 → 1.0.14

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.
@@ -117,24 +117,7 @@ var C = e({
117
117
  function T() {
118
118
  return m.value.fxHeroImages || {};
119
119
  }
120
- async function E() {
121
- try {
122
- let e = await import(
123
- /* @vite-ignore */
124
- [h.value.base, "index.md"].join("")
125
- ), t = (typeof e.__pageData == "string" ? JSON.parse(e.__pageData) : e.__pageData)?.frontmatter?.hero?.image;
126
- return t ? typeof t == "string" ? {
127
- light: t,
128
- dark: t
129
- } : {
130
- light: t.light,
131
- dark: t.dark
132
- } : null;
133
- } catch {
134
- return null;
135
- }
136
- }
137
- async function D(e, t) {
120
+ async function E(e, t) {
138
121
  let n = e.src;
139
122
  if (n) try {
140
123
  let e = b(await c.from(n).quality(1).getPalette());
@@ -143,7 +126,7 @@ var C = e({
143
126
  r[t] = e, r.images ||= {}, r.images[t] = n, d(r);
144
127
  } catch {}
145
128
  }
146
- async function O(e, t) {
129
+ async function D(e, t) {
147
130
  try {
148
131
  let n = b(await c.from(e).quality(1).getPalette()), r = u() || {};
149
132
  return r[t] = n, r.images ||= {}, r.images[t] = e, d(r), n;
@@ -151,15 +134,15 @@ var C = e({
151
134
  return null;
152
135
  }
153
136
  }
154
- async function k(e, t = !0) {
137
+ async function O(e, t = !0) {
155
138
  if (!e.light && !e.dark) return;
156
139
  let n = {};
157
140
  if (e.light) {
158
- let r = await O(t ? s(e.light) : e.light, "light");
141
+ let r = await D(t ? s(e.light) : e.light, "light");
159
142
  r && (n.light = r);
160
143
  }
161
144
  if (e.dark) {
162
- let r = await O(t ? s(e.dark) : e.dark, "dark");
145
+ let r = await D(t ? s(e.dark) : e.dark, "dark");
163
146
  r && (n.dark = r);
164
147
  }
165
148
  if (n.light || n.dark) {
@@ -167,38 +150,28 @@ var C = e({
167
150
  e && x(e);
168
151
  }
169
152
  }
170
- async function A() {
153
+ async function k() {
171
154
  let e = T();
172
155
  if (e.light || e.dark) {
173
- await k(e);
174
- return;
175
- }
176
- let t = await E();
177
- if (t) {
178
- await k(t);
156
+ await O(e);
179
157
  return;
180
158
  }
181
159
  try {
182
- let e = await (await fetch(window.location.origin + "/")).text(), t = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".VPHero .image-container img.VPImage"), n = {};
160
+ let e = await (await fetch(window.location.origin + h.value.base)).text(), t = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".VPHero .image-container img.VPImage"), n = {};
183
161
  t.forEach((e) => {
184
162
  let t = e.getAttribute("src");
185
163
  t && (e.classList.contains("dark") ? n.dark = t : n.light = t);
186
- }), (n.light || n.dark) && await k(n, !1);
164
+ }), (n.light || n.dark) && await O(n, !1);
187
165
  } catch {}
188
166
  }
189
- function j() {
167
+ function A() {
190
168
  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 ? 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
- if (e && (e.light || e.dark)) {
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), k(e));
195
- }
196
- }), A());
169
+ e || t ? (e && e.complete && e.naturalWidth > 0 ? E(e, "light") : e && e.addEventListener("load", () => E(e, "light"), { once: !0 }), t && t.complete && t.naturalWidth > 0 ? E(t, "dark") : t && t.addEventListener("load", () => E(t, "dark"), { once: !0 })) : (g(), w(), k());
197
170
  }
198
171
  r(() => {
199
- v(T()), C() || A(), j(), f = new MutationObserver((e) => {
172
+ v(T()), C() || k(), A(), f = new MutationObserver((e) => {
200
173
  for (let t of e) if (t.attributeName === "class") {
201
- w(), j();
174
+ w(), A();
202
175
  break;
203
176
  }
204
177
  }), f.observe(document.documentElement, {
@@ -206,7 +179,7 @@ var C = e({
206
179
  attributeFilter: ["class"]
207
180
  });
208
181
  }), i(() => p.path, () => {
209
- t(j);
182
+ t(A);
210
183
  }), n(() => {
211
184
  f?.disconnect(), g();
212
185
  });
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-AXhVm0se.js"), [{ heroImageColor: g.heroImageColor }]), O = c(() => import("./chunk/FxCodeBlockFold-C7zqZ39g.js"), [{ lines: C }]);
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-DyiZOKOD.js"), [{ heroImageColor: g.heroImageColor }]), O = c(() => import("./chunk/FxCodeBlockFold-C7zqZ39g.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": "1.0.13",
5
+ "version": "1.0.14",
6
6
  "license": "MIT",
7
7
  "description": "一款精美的 VitePress 主题",
8
8
  "keywords": [