@fuxishi/vitepress-theme 1.0.5 → 1.0.7

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
@@ -1,119 +1,127 @@
1
- # @fuxishi/vitepress-theme
2
-
3
- 精美的 VitePress 文档站主题扩展,毛玻璃质感,紫蓝渐变,动效丰富,开箱即用。
4
-
5
- A beautiful VitePress theme extension with frosted glass effects, purple-blue gradients, rich animations, and ready to use.
6
-
7
- ## 特性 / Features
8
-
9
- - 🎵 **悬浮音乐球 / Floating Music Ball** — 毛玻璃质感的浮动播放器,支持单曲/列表模式,紫蓝渐变进度环与四重播放动效 / Frosted glass floating player with single/playlist mode, purple-blue gradient progress ring and four playback animations
10
- - 🎊 **点击彩纸 / Click Confetti** — 全局点击彩纸特效,支持金色星星、彩色烟花和自定义 Emoji / Global click confetti effect with gold stars, colorful fireworks, and custom Emoji
11
- - **Feature 光效 / Feature Glow** 首页 Feature 卡片鼠标追踪光晕效果 / Mouse-tracking glow effect on homepage Feature cards
12
- - ✨ **光束边框 / Beam Border** 暗色模式下代码块和导航 hover 时展示紫青品牌色光束旋转边框 / Purple-cyan brand color beam border on code blocks and navigation in dark mode on hover
13
- - 🔄 **主题切换动画 / Theme Switch Animation** View Transition API 实现亮暗模式圆形扩散动画 / Circular spread animation for light/dark mode switching using View Transition API
14
- - 🎨 **标题装饰 / Heading Decorations** h1-h4 各有不同颜色的下划线装饰 / Different colored underlines for h1-h4 headings
15
- - ⚙️ **类型安全 / Type-safe** 完整的 TypeScript 类型定义,IDE 友好 / Complete TypeScript type definitions, IDE friendly
16
-
17
- ## 安装 / Installation
18
-
19
- ```bash
20
- npm install @fuxishi/vitepress-theme
21
- ```
22
-
23
- 需要安装以下 peerDependencies / Install peerDependencies:
24
-
25
- ```bash
26
- npm install vitepress vue
27
- ```
28
-
29
- ## 使用 / Usage
30
-
31
- ### 1. 注册主题 / Register Theme
32
-
33
- 创建 `.vitepress/theme/index.ts`:
34
-
35
- ```ts
36
- import FxTheme from "@fuxishi/vitepress-theme"
37
- import "@fuxishi/vitepress-theme/style.css"
38
-
39
- export default FxTheme
40
- ```
41
-
42
- ### 2. 继承配置 / Extend Configuration
43
-
44
- 创建 `.vitepress/config.mts`:
45
-
46
- ```ts
47
- import { defineConfigWithTheme } from "vitepress"
48
- import fxConfig from "@fuxishi/vitepress-theme/config"
49
- import type { FxThemeConfig } from "@fuxishi/vitepress-theme/config"
50
-
51
- export default defineConfigWithTheme<FxThemeConfig>({
52
- extends: fxConfig,
53
- lang: "zh-CN",
54
- title: "我的文档站",
55
- themeConfig: {
56
- nav: [{ text: "指南", link: "/guide/" }],
57
- sidebar: {
58
- "/guide/": [{ text: "快速开始", link: "/guide/" }],
59
- },
60
- // 启用音乐球 / Enable music ball
61
- musicBall: {
62
- enable: true,
63
- autoplay: false,
64
- loop: true,
65
- src: "/music/my-song.mp3",
66
- },
67
- // 启用彩纸效果 / Enable confetti
68
- confetti: true,
69
- // 彩色烟花 / Colorful fireworks
70
- // confetti: { shape: "firework" },
71
- // 自定义 Emoji / Custom Emoji
72
- // confetti: { shapes: ["🌸", "🎀"] },
73
- },
74
- })
75
- ```
76
-
77
- ### 3. 启动开发服务器 / Start Dev Server
78
-
79
- ```bash
80
- npx vitepress dev
81
- ```
82
-
83
- ## 配置 / Configuration
84
-
85
- ### FxThemeConfig
86
-
87
- 继承自 VitePress `DefaultTheme.Config`,新增以下字段 / Extends VitePress `DefaultTheme.Config` with the following fields:
88
-
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 |
100
-
101
- ## 导出 / Exports
102
-
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 |
108
-
109
- ## 文档 / Documentation
110
-
111
- 完整文档请访问 / Full documentation:
112
-
113
- [https://fuxishi-vitepress-theme.fuxizjxzy.cn](https://fuxishi-vitepress-theme.fuxizjxzy.cn)
114
-
115
- ## License
116
-
117
- [MIT](./LICENSE)
118
-
119
- > 后续将在 GitHub 开放源码 / Will be open-sourced on GitHub in the future.
1
+ # @fuxishi/vitepress-theme
2
+
3
+ 精美的 VitePress 文档站主题扩展,毛玻璃质感,紫蓝渐变,动效丰富,开箱即用。
4
+
5
+ [English](./README_EN.md)
6
+
7
+ ## 特性
8
+
9
+ - 🎵 **悬浮音乐球** — 毛玻璃质感的浮动播放器,支持单曲/列表模式,紫蓝渐变进度环与四重播放动效
10
+ - 🎊 **点击彩纸** — 全局点击彩纸特效,支持金色星星、彩色烟花和自定义 Emoji
11
+ - 🎨 **Hero 图片取色**自动提取首页 hero 图片颜色,动态应用到背景光晕、标题渐变、代码块光束和音乐球
12
+ - ✨ **Feature 光效**首页 Feature 卡片鼠标追踪光晕效果
13
+ - **光束边框**暗色模式下代码块和导航 hover 时展示紫青品牌色光束旋转边框
14
+ - 🔄 **主题切换动画**View Transition API 实现亮暗模式圆形扩散动画
15
+ - 📜 **平滑滚动**右侧大纲导航点击时平滑滚动,指示条丝滑过渡
16
+ - 🎨 **标题装饰** — h1-h4 各有不同颜色的下划线装饰
17
+ - ⚙️ **类型安全** — 完整的 TypeScript 类型定义,IDE 友好
18
+
19
+ ## 安装
20
+
21
+ ```bash
22
+ npm install @fuxishi/vitepress-theme
23
+ ```
24
+
25
+ 需要安装以下 peerDependencies:
26
+
27
+ ```bash
28
+ npm install vitepress
29
+ ```
30
+
31
+ ## 使用
32
+
33
+ ### 1. 注册主题
34
+
35
+ 创建 `.vitepress/theme/index.ts`:
36
+
37
+ ```ts
38
+ import FxTheme from "@fuxishi/vitepress-theme";
39
+ import "@fuxishi/vitepress-theme/style.css";
40
+
41
+ export default FxTheme;
42
+ ```
43
+
44
+ ### 2. 继承配置
45
+
46
+ 创建 `.vitepress/config.mts`:
47
+
48
+ ```ts
49
+ import { defineConfigWithTheme } from "vitepress";
50
+ import fxConfig from "@fuxishi/vitepress-theme/config";
51
+ import type { FxThemeConfig } from "@fuxishi/vitepress-theme/config";
52
+
53
+ export default defineConfigWithTheme<FxThemeConfig>({
54
+ extends: fxConfig,
55
+ lang: "zh-CN",
56
+ title: "我的文档站",
57
+ themeConfig: {
58
+ nav: [{ text: "指南", link: "/guide/" }],
59
+ sidebar: {
60
+ "/guide/": [{ text: "快速开始", link: "/guide/" }],
61
+ },
62
+ // 启用音乐球
63
+ musicBall: {
64
+ enable: true,
65
+ autoplay: false,
66
+ loop: true,
67
+ src: "/music/my-song.mp3",
68
+ },
69
+ // 启用彩纸效果
70
+ confetti: true,
71
+ // 彩色烟花
72
+ // confetti: { shape: "firework" },
73
+ // 自定义 Emoji
74
+ // confetti: { shapes: ["🌸", "🎀"] },
75
+ // 启用 hero 图片取色
76
+ heroImageColor: true,
77
+ // 启用平滑滚动
78
+ smoothScroll: true,
79
+ },
80
+ });
81
+ ```
82
+
83
+ ### 3. 启动开发服务器
84
+
85
+ ```bash
86
+ npx vitepress dev
87
+ ```
88
+
89
+ ## 配置
90
+
91
+ ### FxThemeConfig
92
+
93
+ 继承自 VitePress `DefaultTheme.Config`,新增以下字段:
94
+
95
+ | 配置项 | 类型 | 默认值 | 说明 |
96
+ | -------------------- | ---------------------- | -------- | ------------------------------------------------------ |
97
+ | `musicBall.enable` | `boolean` | `true` | 是否启用音乐球 |
98
+ | `musicBall.visible` | `boolean` | `true` | 是否可见 |
99
+ | `musicBall.autoplay` | `boolean` | `false` | 自动播放 |
100
+ | `musicBall.loop` | `boolean` | `true` | 循环播放(单曲模式) |
101
+ | `musicBall.src` | `string` | `''` | 单首音乐地址 |
102
+ | `musicBall.list` | `MusicItem[]` | — | 多首音乐列表 |
103
+ | `confetti` | `boolean \| object` | `true` | 启用彩纸效果 |
104
+ | `confetti.shape` | `'star' \| 'firework'` | `'star'` | 预设形状 |
105
+ | `confetti.shapes` | `string \| string[]` | — | 自定义 Emoji 形状 |
106
+ | `heroImageColor` | `boolean` | `false` | 自动提取 hero 图片颜色(影响光晕、标题、光束、音乐球) |
107
+ | `smoothScroll` | `boolean` | `false` | 启用平滑滚动和大纲指示条过渡动画 |
108
+
109
+ ## 导出
110
+
111
+ | 导出路径 | 说明 |
112
+ | ------------------------------------ | ---------------------- |
113
+ | `@fuxishi/vitepress-theme` | 主题(Layout + 样式) |
114
+ | `@fuxishi/vitepress-theme/config` | VitePress 基础配置预设 |
115
+ | `@fuxishi/vitepress-theme/style.css` | 独立样式文件 |
116
+
117
+ ## 文档
118
+
119
+ 完整文档请访问:
120
+
121
+ [https://fuxishi-vitepress-theme.fuxizjxzy.cn](https://fuxishi-vitepress-theme.fuxizjxzy.cn)
122
+
123
+ ## License
124
+
125
+ [MIT](./LICENSE)
126
+
127
+ > 后续将在 GitHub 开放源码。