Skip to content

Commit ab6bb69

Browse files
committed
chore: Add documents (#63)
* Run `yarn docs:dev` to run development environment * Some vitepress style codes from https://vitepress.yiov.top/style.html#%E4%B8%BB%E9%A2%98%E7%BE%8E%E5%8C%96 * Remove `HorizontalPager` Component * Remove LazyColumn's `topAppBarScrollBehavior` param * Marge dokka pages * Update .gitignore
1 parent e57175f commit ab6bb69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+6715
-163
lines changed

.github/workflows/doc.yml renamed to .github/workflows/docs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Simple workflow for deploying static content to GitHub Pages
2-
name: Build Doc Page
2+
name: Build Docs Page
33

44
on:
55
# Only run this workflow manually from the Actions tab
@@ -30,15 +30,20 @@ jobs:
3030
java-version: '21'
3131
- name: Setup Gradle
3232
uses: gradle/actions/setup-gradle@v4
33-
- name: Build Dokka
33+
- name: Build Docs
3434
run: |
3535
./gradlew :miuix:dokkaGenerate
36+
mkdir -p ./docs/public/dokka
37+
mv ./miuix/build/dokka/html/* ./docs/public/dokka
38+
cd ./docs
39+
yarn install
40+
yarn docs:build
3641
- name: Setup Pages
3742
uses: actions/configure-pages@v5
3843
- name: Upload artifact
3944
uses: actions/upload-pages-artifact@v3
4045
with:
41-
path: ./miuix/build/dokka/html
46+
path: ./docs/.vitepress/dist
4247

4348
deploy:
4449
environment:

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ local.properties
1010
xcuserdata
1111
.kotlin
1212
*.lock
13-
example/src/commonMain/kotlin/utils/VersionInfo.kt
13+
convention-plugins/bin
14+
docs/node_modules
15+
docs/.vitepress/dist
16+
docs/.vitepress/cache
17+
docs/public/dokka

convention-plugins/src/main/kotlin/module.publication.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ publishing {
1414
// Provide artifacts information required by Maven Central
1515
pom {
1616
name.set("miuix")
17-
description.set("A UI Library for Kotlin MultiPlatform")
17+
description.set("A UI library for Compose MultiPlatform")
1818
url.set("https://github.com/miuix-kotlin-multiplatform/miuix")
1919

2020
licenses {

docs/.vitepress/config.mts

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
export default defineConfig({
4+
base: '/',
5+
6+
title: "Miuix",
7+
8+
description: "A UI library for Compose MultiPlatform",
9+
10+
head: [
11+
['link', { rel: 'icon', href: '/Icon.webp' }],
12+
['link', { rel: 'preconnect', href: 'https://cdn-font.hyperos.mi.com/font/css?family=MiSans_VF:VF:Chinese_Simplify,Latin&display=swap' }],
13+
],
14+
15+
markdown: {
16+
image: {
17+
lazyLoading: true,
18+
},
19+
},
20+
21+
lastUpdated: true,
22+
23+
cleanUrls: true,
24+
25+
lang: 'zh-Hans',
26+
27+
themeConfig: {
28+
logo: '/Icon.webp',
29+
30+
search: {
31+
provider: 'local',
32+
options: {
33+
translations: {
34+
button: {
35+
buttonText: '搜索文档',
36+
buttonAriaLabel: '搜索文档'
37+
},
38+
modal: {
39+
noResultsText: '无法找到相关结果',
40+
resetButtonTitle: '清除查询条件',
41+
footer: {
42+
selectText: '选择',
43+
navigateText: '切换',
44+
closeText: '关闭',
45+
},
46+
},
47+
},
48+
},
49+
},
50+
51+
docFooter: {
52+
prev: '上一页',
53+
next: '下一页'
54+
},
55+
56+
outline: {
57+
label: '页面导航'
58+
},
59+
60+
lastUpdated: {
61+
text: '最后更新于',
62+
formatOptions: {
63+
dateStyle: 'short',
64+
timeStyle: 'medium'
65+
}
66+
},
67+
68+
langMenuLabel: '多语言',
69+
returnToTopLabel: '回到顶部',
70+
sidebarMenuLabel: '菜单',
71+
darkModeSwitchLabel: '主题',
72+
lightModeSwitchTitle: '切换到浅色模式',
73+
darkModeSwitchTitle: '切换到深色模式',
74+
skipToContentLabel: '跳转到内容',
75+
76+
socialLinks: [
77+
{ icon: 'github', link: 'https://github.com/YuKongA/miuix-kotlin-multiplatform' }
78+
],
79+
80+
editLink: {
81+
pattern: 'https://github.com/miuix-kotlin-multiplatform/miuix/edit/main/docs/:path',
82+
text: '在 GitHub 上编辑此页面'
83+
},
84+
85+
footer: {
86+
message: '基于 Apache-2.0 许可发布',
87+
copyright: `版权所有 © 2024-${new Date().getFullYear()} miuix-kotlin-multiplatform`
88+
},
89+
90+
nav: [
91+
{ text: '首页', link: '/' },
92+
{ text: '快速开始', link: '/guide/getting-started' },
93+
{ text: '组件库', link: '/components/' },
94+
],
95+
96+
sidebar: {
97+
'/guide/': [
98+
{
99+
text: '入门',
100+
collapsed: false,
101+
items: [
102+
{ text: '快速开始', link: '/guide/getting-started' },
103+
]
104+
},
105+
{
106+
text: '进阶',
107+
collapsed: false,
108+
items: [
109+
{ text: '主题系统', link: '/guide/theme' },
110+
{ text: '图标系统', link: '/guide/icons' },
111+
{ text: '工具函数', link: '/guide/utils' },
112+
{ text: '平台支持', link: '/guide/multiplatform' },
113+
{ text: '最佳实践', link: '/guide/best-practices' },
114+
]
115+
}
116+
],
117+
'/components/': [
118+
{
119+
text: '组件库',
120+
collapsed: false,
121+
items: [
122+
{ text: '总览', link: '/components/' },
123+
]
124+
},
125+
{
126+
text: '脚手架',
127+
collapsed: false,
128+
items: [
129+
{ text: 'Scaffold', link: '/components/scaffold' },
130+
]
131+
},
132+
{
133+
text: '基础组件',
134+
collapsed: false,
135+
items: [
136+
{ text: 'Surface', link: '/components/surface' },
137+
{ text: 'TopAppBar', link: '/components/topappbar' },
138+
{ text: 'NavigationBar', link: '/components/navigationbar' },
139+
{ text: 'TabRow', link: '/components/tabrow' },
140+
{ text: 'Card', link: '/components/card' },
141+
{ text: 'BasicComponent', link: '/components/basiccomponent' },
142+
{ text: 'Button', link: '/components/button' },
143+
{ text: 'IconButton', link: '/components/iconbutton' },
144+
{ text: 'Text', link: '/components/text' },
145+
{ text: 'SmallTitle', link: '/components/smalltitle' },
146+
{ text: 'TextField', link: '/components/textfield' },
147+
{ text: 'Switch', link: '/components/switch' },
148+
{ text: 'Checkbox', link: '/components/checkbox' },
149+
{ text: 'Slider', link: '/components/slider' },
150+
{ text: 'ProgressIndicator', link: '/components/progressindicator' },
151+
{ text: 'Icon', link: '/components/icon' },
152+
{ text: 'FloatingActionButton', link: '/components/floatingactionbutton' },
153+
{ text: 'Divider', link: '/components/divider' },
154+
{ text: 'PullToRefresh', link: '/components/pulltorefresh' },
155+
{ text: 'SearchBar', link: '/components/searchbar' },
156+
{ text: 'ColorPicker', link: '/components/colorpicker' },
157+
{ text: 'ListPopup', link: '/components/listpopup' },
158+
]
159+
},
160+
{
161+
text: '特殊组件',
162+
collapsed: false,
163+
items: [
164+
{ text: 'LazyColumn', link: '/components/lazycolumn' },
165+
]
166+
},
167+
{
168+
text: '扩展组件',
169+
collapsed: false,
170+
items: [
171+
{ text: 'SuperArrow', link: '/components/superarrow' },
172+
{ text: 'SuperSwitch', link: '/components/superswitch' },
173+
{ text: 'SuperCheckBox', link: '/components/supercheckbox' },
174+
{ text: 'SuperDropdown', link: '/components/superdropdown' },
175+
{ text: 'SuperSpinner', link: '/components/superspinner' },
176+
{ text: 'SuperDialog', link: '/components/superdialog' },
177+
]
178+
},
179+
]
180+
},
181+
}
182+
})

docs/.vitepress/theme/index.mts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import DefaultTheme from 'vitepress/theme'
2+
3+
/* mediumZoom */
4+
import mediumZoom from 'medium-zoom';
5+
import { onMounted, watch, nextTick } from 'vue';
6+
import { useRoute } from 'vitepress';
7+
8+
import './style/index.css'
9+
10+
export default {
11+
extends: DefaultTheme,
12+
13+
/* mediumZoom */
14+
setup() {
15+
const route = useRoute();
16+
const initZoom = () => {
17+
mediumZoom('.main img', { background: 'var(--vp-c-bg)' });
18+
};
19+
onMounted(() => {
20+
initZoom();
21+
});
22+
watch(
23+
() => route.path,
24+
() => nextTick(() => initZoom())
25+
);
26+
},
27+
28+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
:root {
2+
3+
/* 亮色模式搜索框颜色 */
4+
--miuix-color-search-button: rgba(255, 255, 255, 0.5);
5+
6+
/* 首页下滑后导航透明 */
7+
.VPNavBar:not(.has-sidebar):not(.home.top) {
8+
background-color: rgba(255, 255, 255, 0);
9+
backdrop-filter: blur(15px)
10+
}
11+
12+
/* 搜索框透明 */
13+
.DocSearch-Button {
14+
background-color: var(--miuix-color-search-button);
15+
backdrop-filter: blur(15px)
16+
}
17+
18+
/* Feature 透明 */
19+
.VPFeature {
20+
border: none;
21+
box-shadow: 0 10px 30px 0 rgb(0 0 0 / 15%);
22+
background-color: transparent;
23+
}
24+
25+
/* 文档页侧边栏顶部透明 */
26+
.curtain {
27+
background-color: rgba(255, 255, 255, 0);
28+
backdrop-filter: blur(15px)
29+
}
30+
31+
@media (min-width: 960px) {
32+
33+
/* 文档页导航中间透明 */
34+
.VPNavBar:not(.home.top) .content-body {
35+
background-color: rgba(255, 255, 255, 0);
36+
backdrop-filter: blur(15px)
37+
}
38+
}
39+
40+
/* 移动端大纲栏透明 */
41+
.VPLocalNav {
42+
background-color: rgba(255, 255, 255, 0);
43+
backdrop-filter: blur(15px)
44+
}
45+
}
46+
47+
48+
.dark {
49+
/* 深色模式搜索框颜色 */
50+
--miuix-color-search-button: rgba(0, 0, 0, 0.2);
51+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
:root {
2+
3+
/* 文档页Logo出文字下横条 */
4+
@media (min-width: 960px) {
5+
.VPNavBarTitle.has-sidebar .title {
6+
border-bottom-color: transparent;
7+
}
8+
}
9+
10+
/* 页脚横条隐藏
11+
.VPFooter {
12+
border-top: none;
13+
} */
14+
15+
/* 手机端菜单栏顶部横条隐藏 */
16+
.VPNavBar.screen-open {
17+
border-bottom: none;
18+
}
19+
20+
/* 手机端菜单栏菜单分割线隐藏 */
21+
.VPNavScreenMenuLink {
22+
border-bottom: none;
23+
}
24+
25+
/* 手机端菜单组隐藏 */
26+
.VPNavScreenMenuGroup {
27+
border-bottom: none;
28+
}
29+
30+
/* 手机端大纲栏横条隐藏 */
31+
.VPLocalNav {
32+
border-bottom: none;
33+
}
34+
35+
}
36+
37+
38+
/* 导航栏下划线隐藏 */
39+
.divider {
40+
display: none;
41+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import './var.css';
2+
@import './blur.css';
3+
@import './hidden.css';

0 commit comments

Comments
 (0)