@fuxishi/vitepress-theme 1.0.4 → 1.0.5

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/README.md CHANGED
@@ -7,7 +7,7 @@ A beautiful VitePress theme extension with frosted glass effects, purple-blue gr
7
7
  ## 特性 / Features
8
8
 
9
9
  - 🎵 **悬浮音乐球 / Floating Music Ball** — 毛玻璃质感的浮动播放器,支持单曲/列表模式,紫蓝渐变进度环与四重播放动效 / Frosted glass floating player with single/playlist mode, purple-blue gradient progress ring and four playback animations
10
- - 🎊 **点击彩纸 / Click Confetti** — 全局点击彩纸特效,金色星星与金色圆形纸屑 / Global click confetti effect with gold stars and circular confetti
10
+ - 🎊 **点击彩纸 / Click Confetti** — 全局点击彩纸特效,支持金色星星、彩色烟花和自定义 Emoji / Global click confetti effect with gold stars, colorful fireworks, and custom Emoji
11
11
  - ✨ **Feature 光效 / Feature Glow** — 首页 Feature 卡片鼠标追踪光晕效果 / Mouse-tracking glow effect on homepage Feature cards
12
12
  - ✨ **光束边框 / Beam Border** — 暗色模式下代码块和导航 hover 时展示紫青品牌色光束旋转边框 / Purple-cyan brand color beam border on code blocks and navigation in dark mode on hover
13
13
  - 🔄 **主题切换动画 / Theme Switch Animation** — View Transition API 实现亮暗模式圆形扩散动画 / Circular spread animation for light/dark mode switching using View Transition API
@@ -66,6 +66,10 @@ export default defineConfigWithTheme<FxThemeConfig>({
66
66
  },
67
67
  // 启用彩纸效果 / Enable confetti
68
68
  confetti: true,
69
+ // 彩色烟花 / Colorful fireworks
70
+ // confetti: { shape: "firework" },
71
+ // 自定义 Emoji / Custom Emoji
72
+ // confetti: { shapes: ["🌸", "🎀"] },
69
73
  },
70
74
  })
71
75
  ```
@@ -82,23 +86,25 @@ npx vitepress dev
82
86
 
83
87
  继承自 VitePress `DefaultTheme.Config`,新增以下字段 / Extends VitePress `DefaultTheme.Config` with the following fields:
84
88
 
85
- | 配置项 / Option | 类型 / Type | 默认值 / Default | 说明 / Description |
86
- | --------------------- | ------------- | ---------------- | ---------------------------------------- |
87
- | `musicBall.enable` | `boolean` | `true` | 是否启用音乐球 / Enable music ball |
88
- | `musicBall.visible` | `boolean` | `true` | 是否可见 / Visibility |
89
- | `musicBall.autoplay` | `boolean` | `false` | 自动播放 / Autoplay |
90
- | `musicBall.loop` | `boolean` | `true` | 循环播放(单曲模式)/ Loop (single mode) |
91
- | `musicBall.src` | `string` | `''` | 单首音乐地址 / Single music URL |
92
- | `musicBall.list` | `MusicItem[]` | — | 多首音乐列表 / Multi-song playlist |
93
- | `confetti` | `boolean` | `true` | 是否启用点击彩纸效果 / Enable confetti |
89
+ | 配置项 / Option | 类型 / Type | 默认值 / Default | 说明 / Description |
90
+ | -------------------- | ---------------------- | ---------------- | ---------------------------------------- |
91
+ | `musicBall.enable` | `boolean` | `true` | 是否启用音乐球 / Enable music ball |
92
+ | `musicBall.visible` | `boolean` | `true` | 是否可见 / Visibility |
93
+ | `musicBall.autoplay` | `boolean` | `false` | 自动播放 / Autoplay |
94
+ | `musicBall.loop` | `boolean` | `true` | 循环播放(单曲模式)/ Loop (single mode) |
95
+ | `musicBall.src` | `string` | `''` | 单首音乐地址 / Single music URL |
96
+ | `musicBall.list` | `MusicItem[]` | — | 多首音乐列表 / Multi-song playlist |
97
+ | `confetti` | `boolean \| object` | `true` | 启用彩纸效果 / Enable confetti |
98
+ | `confetti.shape` | `'star' \| 'firework'` | `'star'` | 预设形状 / Preset shape |
99
+ | `confetti.shapes` | `string \| string[]` | — | 自定义 Emoji / Custom Emoji shapes |
94
100
 
95
101
  ## 导出 / Exports
96
102
 
97
- | 导出路径 / Export Path | 说明 / Description |
98
- | ------------------------------------- | ------------------------------------- |
99
- | `@fuxishi/vitepress-theme` | 主题(Layout + 样式)/ Theme (Layout + Styles) |
100
- | `@fuxishi/vitepress-theme/config` | VitePress 基础配置预设 / VitePress base config preset |
101
- | `@fuxishi/vitepress-theme/style.css` | 独立样式文件 / Standalone style file |
103
+ | 导出路径 / Export Path | 说明 / Description |
104
+ | ------------------------------------ | ----------------------------------------------------- |
105
+ | `@fuxishi/vitepress-theme` | 主题(Layout + 样式)/ Theme (Layout + Styles) |
106
+ | `@fuxishi/vitepress-theme/config` | VitePress 基础配置预设 / VitePress base config preset |
107
+ | `@fuxishi/vitepress-theme/style.css` | 独立样式文件 / Standalone style file |
102
108
 
103
109
  ## 文档 / Documentation
104
110
 
@@ -0,0 +1,116 @@
1
+ import { defineComponent as e, onMounted as t } from "vue";
2
+ import n from "canvas-confetti";
3
+ //#endregion
4
+ //#region .vitepress/components/FxConfetti.vue
5
+ var r = /* @__PURE__ */ e({
6
+ __name: "FxConfetti",
7
+ props: { confetti: { type: [Boolean, Object] } },
8
+ setup(e) {
9
+ let r = e, i = typeof r.confetti == "object" ? r.confetti : {}, a = i.shape || "star", o = i.shapes ? Array.isArray(i.shapes) ? i.shapes : [i.shapes] : null, s = [];
10
+ t(() => {
11
+ o && (s = o.map((e) => n.shapeFromText({
12
+ text: e,
13
+ scalar: 2
14
+ }))), window.addEventListener("click", (e) => {
15
+ let t = e.clientX / (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth), n = e.clientY / (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight);
16
+ s.length > 0 ? u(t, n) : a === "firework" ? l(t, n) : c(t, n);
17
+ });
18
+ });
19
+ let c = (e, t) => {
20
+ let r = {
21
+ spread: 360,
22
+ ticks: 50,
23
+ gravity: 0,
24
+ decay: .94,
25
+ startVelocity: 10,
26
+ colors: [
27
+ "FFE400",
28
+ "FFBD00",
29
+ "E89400",
30
+ "FFCA6C",
31
+ "FDFFB8"
32
+ ],
33
+ origin: {
34
+ x: e,
35
+ y: t
36
+ }
37
+ };
38
+ function i() {
39
+ n({
40
+ ...r,
41
+ particleCount: 4,
42
+ scalar: 1.2,
43
+ shapes: ["star"]
44
+ }), n({
45
+ ...r,
46
+ particleCount: 10,
47
+ scalar: .75,
48
+ shapes: ["circle"]
49
+ });
50
+ }
51
+ setTimeout(i, 0), setTimeout(i, 50), setTimeout(i, 100);
52
+ }, l = (e, t) => {
53
+ let r = {
54
+ spread: 360,
55
+ ticks: 50,
56
+ gravity: 0,
57
+ decay: .94,
58
+ startVelocity: 10,
59
+ colors: [
60
+ "#FF1461",
61
+ "#18FF92",
62
+ "#5A87FF",
63
+ "#FBF38C",
64
+ "#FF6B35"
65
+ ],
66
+ origin: {
67
+ x: e,
68
+ y: t
69
+ }
70
+ };
71
+ function i() {
72
+ n({
73
+ ...r,
74
+ particleCount: 10,
75
+ scalar: 1.2
76
+ }), n({
77
+ ...r,
78
+ particleCount: 10,
79
+ scalar: .75,
80
+ shapes: ["circle"]
81
+ });
82
+ }
83
+ setTimeout(i, 0), setTimeout(i, 50), setTimeout(i, 100);
84
+ }, u = (e, t) => {
85
+ let r = {
86
+ spread: 360,
87
+ ticks: 50,
88
+ gravity: 0,
89
+ decay: .94,
90
+ startVelocity: 10,
91
+ shapes: s,
92
+ origin: {
93
+ x: e,
94
+ y: t
95
+ }
96
+ };
97
+ function i() {
98
+ n({
99
+ ...r,
100
+ particleCount: 10,
101
+ scalar: 1.5,
102
+ flat: !0
103
+ }), n({
104
+ ...r,
105
+ particleCount: 10,
106
+ scalar: .75,
107
+ shapes: ["circle"]
108
+ });
109
+ }
110
+ setTimeout(i, 0), setTimeout(i, 50), setTimeout(i, 100);
111
+ };
112
+ return (e, t) => null;
113
+ }
114
+ });
115
+ //#endregion
116
+ export { r as default };
package/dist/config.d.ts CHANGED
@@ -5,6 +5,8 @@ export type MusicItem = {
5
5
  src: string
6
6
  }
7
7
 
8
+ export type ConfettiShape = 'star' | 'firework'
9
+
8
10
  export interface FxThemeConfig extends DefaultTheme.Config {
9
11
  musicBall?: {
10
12
  enable?: boolean
@@ -14,7 +16,12 @@ export interface FxThemeConfig extends DefaultTheme.Config {
14
16
  src?: string
15
17
  list?: MusicItem[]
16
18
  }
17
- confetti?: boolean
19
+ confetti?: boolean | {
20
+ /** 预设形状: 'star' 金色星星 | 'firework' 烟花 */
21
+ shape?: ConfettiShape
22
+ /** 自定义 emoji 形状,支持单个字符串或数组 */
23
+ shapes?: string | string[]
24
+ }
18
25
  }
19
26
 
20
27
  declare const fxConfig: UserConfig<FxThemeConfig>
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ var s = t({ setup(t, { slots: s }) {
19
19
  pseudoElement: `::view-transition-${d.value ? "old" : "new"}(root)`
20
20
  });
21
21
  });
22
- let p = f.musicBall?.enable && (f.musicBall?.src || f.musicBall?.list?.length > 0), m = a(() => import("./chunk/FxMusicBall-B_F7Q9VQ.js"), [{ style: { display: f.musicBall && f.musicBall.visible ? "" : "none" } }]), h = a(() => import("./chunk/FxHomeFeatureBefore-DUbsbVTj.js")), g = a(() => import("./chunk/FxConfetti-DIy1zU6g.js"));
22
+ let p = f.musicBall?.enable && (f.musicBall?.src || f.musicBall?.list?.length > 0), m = a(() => import("./chunk/FxMusicBall-B_F7Q9VQ.js"), [{ style: { display: f.musicBall && f.musicBall.visible ? "" : "none" } }]), h = a(() => import("./chunk/FxHomeFeatureBefore-DUbsbVTj.js")), g = a(() => import("./chunk/FxConfetti-BA6pwd1S.js"), [{ confetti: f.confetti }]);
23
23
  return () => [
24
24
  n(l, null, {
25
25
  ...s,
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.4",
5
+ "version": "1.0.5",
6
6
  "license": "MIT",
7
7
  "description": "一款精美的 VitePress 主题",
8
8
  "keywords": [
@@ -1,51 +0,0 @@
1
- import { defineComponent as e, onMounted as t } from "vue";
2
- import n from "canvas-confetti";
3
- //#endregion
4
- //#region .vitepress/components/FxConfetti.vue
5
- var r = /* @__PURE__ */ e({
6
- __name: "FxConfetti",
7
- setup(e) {
8
- t(() => {
9
- window.addEventListener("click", (e) => {
10
- r(e.clientX / (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth), e.clientY / (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight));
11
- });
12
- });
13
- let r = (e, t) => {
14
- var r = {
15
- spread: 360,
16
- ticks: 50,
17
- gravity: 0,
18
- decay: .94,
19
- startVelocity: 10,
20
- colors: [
21
- "FFE400",
22
- "FFBD00",
23
- "E89400",
24
- "FFCA6C",
25
- "FDFFB8"
26
- ],
27
- origin: {
28
- x: e,
29
- y: t
30
- }
31
- };
32
- function i() {
33
- n({
34
- ...r,
35
- particleCount: 4,
36
- scalar: 1.2,
37
- shapes: ["star"]
38
- }), n({
39
- ...r,
40
- particleCount: 10,
41
- scalar: .75,
42
- shapes: ["circle"]
43
- });
44
- }
45
- setTimeout(i, 0), setTimeout(i, 50), setTimeout(i, 100);
46
- };
47
- return (e, t) => null;
48
- }
49
- });
50
- //#endregion
51
- export { r as default };