Skip to content

Commit 22ccaa1

Browse files
committed
feat: 🎸 initial commit
0 parents  commit 22ccaa1

File tree

189 files changed

+10548
-0
lines changed

Some content is hidden

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

189 files changed

+10548
-0
lines changed

.github/workflows/deploy.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
7+
# using the `master` branch as the default branch.
8+
push:
9+
branches: [main]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# Build job
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
with:
34+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
35+
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
36+
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
37+
- name: Setup Node
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: 18
41+
- name: Install pnpm
42+
run: npm i pnpm -g
43+
- name: Setup Pages
44+
uses: actions/configure-pages@v3
45+
- name: Install dependencies
46+
run: pnpm install
47+
- name: Build with VitePress
48+
run: |
49+
pnpm docs:build
50+
touch .vitepress/dist/.nojekyll
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v2
53+
with:
54+
path: .vitepress/dist
55+
56+
# Deployment job
57+
deploy:
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
needs: build
62+
runs-on: ubuntu-latest
63+
name: Deploy
64+
steps:
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v2

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
.thumbs.db
3+
node_modules
4+
5+
# Cache
6+
dist
7+
.vitepress/cache
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
*.suo
17+
*.ntvs*
18+
*.njsproj
19+
*.sln
20+
*.iml
21+
22+
# local .env files
23+
.env.local*

.vitepress/config/common.mts

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { defineConfig } from 'vitepress'
2+
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
3+
import { keywords, name, repo } from '../meta'
4+
5+
// https://vitepress.dev/reference/site-config
6+
export default defineConfig({
7+
srcDir: './src',
8+
cleanUrls: true,
9+
ignoreDeadLinks: true,
10+
lastUpdated: true,
11+
themeConfig: {
12+
// https://vitepress.dev/reference/default-theme-config
13+
logo: '/logo.svg',
14+
search: {
15+
provider: 'local',
16+
// options: {
17+
// appId: 'LBLWR2QCI3',
18+
// apiKey: '4338f265da64e33025f821af827dd22e',
19+
// indexName: 'pileax'
20+
// }
21+
},
22+
outline: 'deep',
23+
socialLinks: [
24+
{ icon: 'github', link: repo },
25+
],
26+
footer: {
27+
message: 'MIT Licensed.',
28+
copyright: `Copyright © 2024-present ${name}`
29+
},
30+
},
31+
32+
head: [
33+
['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
34+
['meta', { name: 'keywords', content: keywords }],
35+
],
36+
37+
markdown: {
38+
config(md) {
39+
md.use(tabsMarkdownPlugin)
40+
}
41+
},
42+
43+
optimizeDeps: {
44+
}
45+
})

.vitepress/config/en.mts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineConfig } from 'vitepress'
2+
import { nav } from './theme/nav'
3+
import { sidebarGuide, sidebarApi } from './theme/sidebar'
4+
import { labels } from './theme/labels'
5+
import { name, description, docsRepo } from '../meta'
6+
7+
const locale = 'en';
8+
9+
export default defineConfig({
10+
title: name,
11+
description: description,
12+
themeConfig: {
13+
...labels(locale),
14+
nav: nav(locale),
15+
sidebar: {
16+
'/guide/': { base: '/guide/', items: sidebarGuide(locale) },
17+
'/api/': { base: '/api/', items: sidebarApi(locale) },
18+
},
19+
editLink: {
20+
pattern: `${docsRepo}/edit/main/src/:path`,
21+
text: "Edit this page",
22+
},
23+
},
24+
head: [
25+
],
26+
})

.vitepress/config/index.mts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineConfig } from 'vitepress'
2+
import commonConfig from './common.mjs'
3+
import enConfig from './en.mjs'
4+
import zhConfig from './zh.mjs'
5+
6+
// https://vitepress.dev/reference/site-config
7+
export default defineConfig({
8+
...commonConfig,
9+
locales: {
10+
root: {
11+
label: 'English',
12+
lang: 'en',
13+
...enConfig
14+
},
15+
zh: {
16+
label: '中文',
17+
lang: 'zh',
18+
...zhConfig
19+
}
20+
}
21+
})

.vitepress/config/theme/labels.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { tr } from '../../i18n';
2+
3+
export function labels(locale :string) {
4+
const t = (key :string) => {
5+
return tr(locale, `theme.${key}`)
6+
}
7+
return {
8+
docFooter: {
9+
prev: t('prev'),
10+
next: t('next'),
11+
},
12+
returnToTopLabel: t('returnToTop'),
13+
outlineTitle: t('outline'),
14+
darkModeSwitchLabel: t('darkModeSwitch'),
15+
sidebarMenuLabel: t('sidebarMenu'),
16+
lastUpdatedText: t('lastUpdated'),
17+
}
18+
}

.vitepress/config/theme/nav.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { tr } from '../../i18n'
2+
import { preview } from '../../meta'
3+
import { DefaultTheme } from "vitepress";
4+
5+
export function nav(locale :string) {
6+
const t = (key :string) => {
7+
return tr(locale, `nav.${key}`)
8+
}
9+
const base = (locale === 'en') ? '' : `/${locale}`;
10+
return [
11+
{ text: t('guide'), link: base + '/guide/getting-started' },
12+
{ text: 'API', link: base + '/api/component/overview' },
13+
{ text: t('demo'), link: base + '/demo/vue' },
14+
// {
15+
// text: 'Demos',
16+
// items: [
17+
// { text: 'Vue', link: base + '/demo/vue' },
18+
// { text: 'React', link: base + '/demo/react' },
19+
// ]
20+
// },
21+
{ text: t('preview'), link: preview },
22+
] as DefaultTheme.NavItem[];
23+
}

.vitepress/config/theme/sidebar.ts

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import { tr } from '../../i18n';
2+
3+
export function sidebarGuide(locale :string) {
4+
const t = (key :string) => {
5+
return tr(locale, `sidebar.guide.${key}`);
6+
}
7+
return [
8+
{
9+
text: t('guide'),
10+
collapsed: false,
11+
items: [
12+
{ text: t('introduction'), link: 'introduction' },
13+
{ text: t('gettingStarted'), link: 'getting-started' },
14+
{ text: t('styles'), link: 'styles' },
15+
]
16+
},
17+
// {
18+
// text: t('utilities'),
19+
// collapsed: true,
20+
// items: [
21+
// { text: 'Emoji', link: 'util/emoji' },
22+
// { text: t('icon'), link: 'util/icon' },
23+
// ]
24+
// },
25+
]
26+
}
27+
export function sidebarApi(locale :string) {
28+
const t = (key :string) => {
29+
return tr(locale, `sidebar.api.${key}`);
30+
}
31+
const vueComponent = (path :string) => {
32+
return `component/vue/${path}`;
33+
}
34+
const reactComponent = (path :string) => {
35+
return `component/react/${path}`;
36+
}
37+
const extension = (path :string) => {
38+
return `extension/${path}`;
39+
}
40+
return [
41+
{
42+
text: t('components'),
43+
collapsed: false,
44+
items: [
45+
{ text: t('overview'), link: 'component/overview' },
46+
{
47+
text: 'Vue',
48+
collapsed: false,
49+
items: [
50+
{ text: 'YiiEditor', link: vueComponent('yii-editor') },
51+
{
52+
text: 'Common',
53+
collapsed: false,
54+
items: [
55+
{ text: 'Doc TOC', link: vueComponent('common/doc-toc') },
56+
]
57+
},
58+
{
59+
text: 'Menus',
60+
collapsed: false,
61+
items: [
62+
{ text: 'OMainMenu', link: vueComponent('menus/main-menu') },
63+
]
64+
},
65+
{
66+
text: 'UI',
67+
collapsed: true,
68+
items: [
69+
{ text: 'OIcon', link: vueComponent('ui/icon') },
70+
]
71+
},
72+
]
73+
},
74+
{
75+
text: 'React',
76+
collapsed: false,
77+
items: [
78+
{ text: 'YiiEditor', link: reactComponent('yii-editor') },
79+
]
80+
},
81+
]
82+
},
83+
{
84+
text: t('extensions'),
85+
collapsed: false,
86+
items: [
87+
{ text: t('overview'), link: extension('overview') },
88+
{ text: 'Callout', link: extension('callout') },
89+
{ text: 'Char Command', link: extension('char-command') },
90+
{ text: 'Code Block', link: extension('code-block') },
91+
{ text: 'Color Highlighter', link: extension('color-highlighter') },
92+
{ text: 'Image', link: extension('image') },
93+
{ text: 'Placeholder', link: extension('placeholder') },
94+
{ text: 'Table', link: extension('table') },
95+
{ text: 'Trailing Node', link: extension('trailing-node') },
96+
{ text: 'Unique ID', link: extension('unique-id') },
97+
{ text: 'Video', link: extension('video') },
98+
]
99+
},
100+
]
101+
}

.vitepress/config/zh.mts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineConfig } from 'vitepress'
2+
import { nav } from './theme/nav'
3+
import { sidebarGuide, sidebarApi } from './theme/sidebar'
4+
import { labels } from './theme/labels'
5+
import { name, docsRepo, descriptionZh } from '../meta'
6+
7+
const locale = 'zh';
8+
9+
export default defineConfig({
10+
title: name,
11+
description: descriptionZh,
12+
themeConfig: {
13+
...labels(locale),
14+
nav: nav(locale),
15+
sidebar: {
16+
'/zh/guide/': { base: '/zh/guide/', items: sidebarGuide(locale) },
17+
'/zh/api/': { base: '/zh/api/', items: sidebarApi(locale) },
18+
},
19+
editLink: {
20+
pattern: `${docsRepo}/edit/main/src/:path`,
21+
text: "编辑此页",
22+
},
23+
},
24+
head: [
25+
],
26+
})

0 commit comments

Comments
 (0)