Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rebuild theme-default #134

Open
wants to merge 100 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
31f6b62
feat: initial new default theme
pengzhanbo May 13, 2024
b0fd64f
feat(plugin-shiki): support multi themes and transformers
pengzhanbo May 13, 2024
575d8fe
feat: sidebar&outline scroll to active element view
pengzhanbo May 13, 2024
def90fc
perf: optimize styles
pengzhanbo May 13, 2024
9bb6fb5
chore: tweak
pengzhanbo May 14, 2024
6d73e0e
docs: move to new theme default
pengzhanbo May 14, 2024
6468eb8
perf: dynamic parsing of navbar & sidebar
pengzhanbo May 15, 2024
347c4ec
docs: update docs
pengzhanbo May 16, 2024
64f92e1
test: update e2e test
pengzhanbo May 16, 2024
c4fe355
test: update e2e test
pengzhanbo May 16, 2024
928fdb0
chore: tweak
pengzhanbo May 16, 2024
73d1b73
Merge branch 'main' into theme-default
pengzhanbo May 17, 2024
5c05d5a
chore: tweak
pengzhanbo May 17, 2024
d1402ac
Merge branch 'main' into theme-default
Mister-Hope May 20, 2024
aa773b2
chore: tweaks
pengzhanbo May 20, 2024
1e1fe32
chore: tweak
pengzhanbo May 20, 2024
b8efe3a
Merge branch 'main' into theme-default
pengzhanbo May 24, 2024
75291b0
chore: tweak
pengzhanbo May 24, 2024
fbeefab
Merge branch 'main' into theme-default
Mister-Hope May 29, 2024
9a16e7d
Merge branch 'main' into theme-default
Mister-Hope May 29, 2024
fb57fb4
docs: sync docs
Mister-Hope May 29, 2024
a220482
chore: tweaks
Mister-Hope May 29, 2024
1dec895
docs: fix docs
Mister-Hope May 29, 2024
afe371d
Merge branch 'main' into theme-default
pengzhanbo May 29, 2024
25f058f
chore: tweak
pengzhanbo May 29, 2024
51c4125
chore: tweak
pengzhanbo May 29, 2024
98f9dad
chore: lint fix
pengzhanbo May 29, 2024
d095471
Merge branch 'main' into theme-default
pengzhanbo May 29, 2024
99c30a1
test: fix e2e tests
pengzhanbo May 29, 2024
1f5efc5
refactor: container & github alerts
pengzhanbo May 30, 2024
33c1d1c
perf: update plugin-shiki default options
pengzhanbo May 30, 2024
9dbab44
chore: tweak
pengzhanbo May 30, 2024
964301d
Merge branch 'main' into theme-default
pengzhanbo May 30, 2024
f240aa7
chore: tweak
pengzhanbo May 30, 2024
2acfaa1
chore: tweak
pengzhanbo May 31, 2024
d6203c6
chore: tweak
pengzhanbo May 31, 2024
58335c8
test: fix e2e tests
pengzhanbo May 31, 2024
d5afb0f
perf: replace all with arrow functions
pengzhanbo May 31, 2024
ecb75b3
Merge branch 'main' into theme-default
pengzhanbo Jun 1, 2024
34b0095
chore: tweak
pengzhanbo Jun 9, 2024
d9370b3
Merge branch 'main' into theme-default
pengzhanbo Jun 9, 2024
b09e8df
chore: tweak
pengzhanbo Jun 9, 2024
328220d
chore: stylelint
pengzhanbo Jun 9, 2024
b76f850
chore: lint fix
pengzhanbo Jun 9, 2024
75cb8fc
chore: tweak
pengzhanbo Jun 9, 2024
526cb7f
chore: tweak
pengzhanbo Jun 16, 2024
f7d3730
Merge branch 'main' into theme-default
pengzhanbo Jun 16, 2024
7f6cbb3
chore: tweak
pengzhanbo Jun 16, 2024
0141799
chore: tweak
pengzhanbo Jun 16, 2024
0518da0
Merge branch 'main' into theme-default
pengzhanbo Jun 21, 2024
e3c9a84
Merge branch 'main' into theme-default
Mister-Hope Jul 10, 2024
f13e95f
chore: tweak
pengzhanbo Jul 15, 2024
da8eab2
Merge branch 'main' into theme-default
pengzhanbo Sep 4, 2024
37e82dd
chore: tweak
pengzhanbo Sep 4, 2024
e32b67e
chore: tweak
pengzhanbo Sep 4, 2024
7c86e06
chore: lint fix
pengzhanbo Sep 4, 2024
ad8fc99
chore: lint fix
pengzhanbo Sep 4, 2024
fe74925
chore: tweak
pengzhanbo Sep 4, 2024
0b63fd3
chore: lint fix
pengzhanbo Sep 4, 2024
7fbaeb7
chore: lint fix
pengzhanbo Sep 4, 2024
51dd60e
chore: tweak
pengzhanbo Sep 5, 2024
528d7f4
chore: guidelines `data-theme=dark`
pengzhanbo Sep 5, 2024
1957d4e
chore: adapt `plugin-markdown-hint`
pengzhanbo Sep 5, 2024
34de92a
chore: guidelines `vp-*`
pengzhanbo Sep 5, 2024
2495fe9
chore: e2e-webpack sass warning
pengzhanbo Sep 5, 2024
79115f7
chore: guidelines css-vars `vp-*`
pengzhanbo Sep 5, 2024
a7bf49b
chore: tweak
pengzhanbo Sep 5, 2024
63f8dd5
chore: synchronize docs
pengzhanbo Sep 5, 2024
078956e
Merge branch 'main' into theme-default
pengzhanbo Nov 20, 2024
707e16c
chore: update deps
pengzhanbo Nov 20, 2024
71ce89f
chore: lint fix
pengzhanbo Nov 20, 2024
9afd1fb
chore: tweak
pengzhanbo Nov 20, 2024
e3d47ae
chore: tweak
pengzhanbo Nov 21, 2024
0aee9de
chore: fix e2e
pengzhanbo Nov 21, 2024
7837f64
Merge branch 'main' into theme-default
pengzhanbo Nov 21, 2024
6c65ca0
chore: tweak
pengzhanbo Nov 21, 2024
ab84201
chore: tweak
pengzhanbo Nov 21, 2024
2008020
Merge branch 'main' into theme-default
pengzhanbo Nov 24, 2024
d1e3e6d
chore: tweak
pengzhanbo Nov 24, 2024
583161b
chore: tweak
pengzhanbo Nov 24, 2024
d05dbdf
chore: tweak
pengzhanbo Nov 24, 2024
82bee92
chore: tweak
pengzhanbo Nov 24, 2024
ee616cd
chore: sync docs
pengzhanbo Nov 25, 2024
9c70abc
chore: tweak
pengzhanbo Nov 25, 2024
00ccf3d
chore: update docs
pengzhanbo Nov 26, 2024
a057285
Merge branch 'main' into theme-default
pengzhanbo Nov 26, 2024
f92095c
chore: tweak
pengzhanbo Nov 27, 2024
c28972e
Merge branch 'main' into theme-default
Mister-Hope Nov 28, 2024
7ef550d
chore: update comments
Mister-Hope Nov 28, 2024
4ce00fe
chore: tweaks
Mister-Hope Nov 28, 2024
4a14ed5
chore: tweaks
Mister-Hope Nov 28, 2024
020a60d
chore: tweak
pengzhanbo Nov 29, 2024
864d185
feat: add theme-helper
Mister-Hope Nov 30, 2024
409c50a
chore: fix build script
Mister-Hope Dec 6, 2024
845c0c2
feat: extract useContributor
Mister-Hope Dec 7, 2024
7cfaa45
feat: extract editLink
Mister-Hope Dec 7, 2024
5a27ce3
Merge branch 'main' into theme-default
Mister-Hope Dec 7, 2024
858dfd6
chore: fix lockfile
Mister-Hope Dec 7, 2024
246368c
chore: fix broken types
Mister-Hope Dec 7, 2024
b0eef91
fix(plugin-slimsearch): fix hotkey without suggestions, close #298
Mister-Hope Dec 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ module.exports = {
'vue/match-component-file-name': 'off',
},
},
{
files: ['themes/**/*.vue'],
rules: {
'vue/no-v-html': 'off',
'vue/no-v-text-v-html-on-component': 'off',
},
},
{
files: ['tools/create-vuepress/**/*.vue'],
rules: {
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"[markdown]": {
"files.trimTrailingWhitespace": false
},
"prettier.enable": true,
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.validate": [
"javascript",
Expand Down
71 changes: 71 additions & 0 deletions docs-next/.vuepress/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { defineGiscusConfig } from '@vuepress/plugin-comment/client'
import { defineDocSearchConfig } from '@vuepress/plugin-docsearch/client'
import { defineClientConfig } from 'vuepress/client'
import type { ClientConfig } from 'vuepress/client'
import CommentPage from './layouts/CommentPage.vue'

import './styles/index.scss'

defineGiscusConfig({
repo: 'vuepress/ecosystem',
repoId: 'R_kgDOKPxScA',
category: 'Announcements',
categoryId: 'DIC_kwDOKPxScM4CbWy7',
})

defineDocSearchConfig({
appId: 'N7UOPMVZ5B',
apiKey: 'aa626dfa43a5e32cd519ba84735ad384',
indexName: 'ecosystem-vuejs',
locales: {
'/zh/': {
placeholder: '搜索文档',
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档',
},
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消',
},
startScreen: {
recentSearchesTitle: '搜索历史',
noRecentSearchesText: '没有搜索历史',
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除',
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接',
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者',
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈',
},
},
},
},
},
})

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
export default defineClientConfig({
layouts: {
// We override the default layout to provide comment service
CommentPage,
},
}) as ClientConfig
51 changes: 51 additions & 0 deletions docs-next/.vuepress/components/NpmBadge.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script setup lang="ts">
import { computed } from 'vue'

const props = defineProps({
package: {
type: String,
required: true,
},
distTag: {
type: String,
required: false,
default: 'next',
},
})

const badgeLink = computed(
() => `https://www.npmjs.com/package/${props.package}/v/next`,
)
const badgeLabel = computed(() => {
if (props.distTag) {
return `${props.package}@${props.distTag}`
}
return props.package
})
const badgeImg = computed(
() =>
`https://badgen.net/npm/v/${props.package}/${
props.distTag
}?label=${encodeURIComponent(badgeLabel.value)}`,
)
</script>

<template>
<p>
<a
class="npm-badge no-icon"
:href="badgeLink"
:title="package"
target="_blank"
rel="noopener noreferrer"
>
<img :src="badgeImg" :alt="package" />
</a>
</p>
</template>

<style scoped>
.npm-badge {
margin-right: 0.5rem;
}
</style>
92 changes: 92 additions & 0 deletions docs-next/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { createRequire } from 'node:module'
import process from 'node:process'
import { footnote } from '@mdit/plugin-footnote'
import { viteBundler } from '@vuepress/bundler-vite'
import { webpackBundler } from '@vuepress/bundler-webpack'
import { catalogPlugin } from '@vuepress/plugin-catalog'
import { commentPlugin } from '@vuepress/plugin-comment'
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
import { feedPlugin } from '@vuepress/plugin-feed'
import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
import { defineUserConfig } from 'vuepress'
import type { UserConfig } from 'vuepress'
import { /* getDirname, */ path } from 'vuepress/utils'
import { head } from './configs/index.js'
import theme from './theme.js'

// const __dirname = getDirname(import.meta.url)
const require = createRequire(import.meta.url)

// const isProd = process.env.NODE_ENV === 'production'

export default defineUserConfig({
// set site base to default value
base: (process.env.BASE as `/${string}/` | '/') || '/',
lang: 'en-US',

// extra tags in `<head>`
head,

// site-level locales config
locales: {
'/': {
lang: 'en-US',
title: 'VuePress Ecosystem',
description: 'VuePress official themes and plugins',
},
'/zh/': {
lang: 'zh-CN',
title: 'VuePress 生态系统',
description: 'VuePress 官方主题和插件',
},
},

// specify bundler via environment variable
bundler:
process.env.DOCS_BUNDLER === 'webpack' ? webpackBundler() : viteBundler(),

// configure markdown
markdown: {
code: {
lineNumbers: 10,
},
importCode: {
handleImportPath: (importPath) => {
// handle @vuepress packages import path
if (importPath.startsWith('@vuepress/')) {
const packageName = importPath.match(/^(@vuepress\/[^/]*)/)![1]
return importPath
.replace(
packageName,
path.dirname(require.resolve(`${packageName}/package.json`)),
)
.replace('/src/', '/lib/')
.replace(/hotKey\.ts$/, 'hotKey.d.ts')
}
return importPath
},
},
},

extendsMarkdown: (md) => {
md.use(footnote)
},

plugins: [
catalogPlugin(),
docsearchPlugin(),
commentPlugin({ provider: 'Giscus' }),
registerComponentsPlugin({
componentsDir: path.resolve(__dirname, './components'),
}),
feedPlugin({
hostname: 'https://ecosystem.vuejs.press',
atom: true,
json: true,
rss: true,
}),
],

// configure default theme
theme,
}) as UserConfig
40 changes: 40 additions & 0 deletions docs-next/.vuepress/configs/head.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { HeadConfig } from 'vuepress/core'

export const head: HeadConfig[] = [
[
'link',
{
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: `/images/icons/favicon-16x16.png`,
},
],
[
'link',
{
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: `/images/icons/favicon-32x32.png`,
},
],
['link', { rel: 'manifest', href: '/manifest.webmanifest' }],
['meta', { name: 'application-name', content: 'VuePress' }],
['meta', { name: 'apple-mobile-web-app-title', content: 'VuePress' }],
['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
[
'link',
{ rel: 'apple-touch-icon', href: `/images/icons/apple-touch-icon.png` },
],
[
'link',
{
rel: 'mask-icon',
href: '/images/icons/safari-pinned-tab.svg',
color: '#3eaf7c',
},
],
['meta', { name: 'msapplication-TileColor', content: '#3eaf7c' }],
['meta', { name: 'theme-color', content: '#3eaf7c' }],
]
3 changes: 3 additions & 0 deletions docs-next/.vuepress/configs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './head.js'
export * from './navbar/index.js'
export * from './sidebar/index.js'
98 changes: 98 additions & 0 deletions docs-next/.vuepress/configs/navbar/en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import type { NavItem } from '@vuepress/theme-default'

export const navbarEn: NavItem[] = [
{
text: 'Themes',
items: [
{
text: 'Default Theme',
link: '/themes/default/',
},
{
text: 'Hope Theme',
link: 'https://theme-hope.vuejs.press',
},
{
text: 'Plume Theme',
link: 'https://theme-plume.vuejs.press',
},
],
},
{
text: 'Plugins',
activeMatch: '^/plugins/',
items: [
{
text: 'Common Features',
items: [
'/plugins/append-date',
'/plugins/back-to-top',
'/plugins/catalog',
'/plugins/copy-code',
'/plugins/copyright',
'/plugins/medium-zoom',
'/plugins/notice',
'/plugins/nprogress',
'/plugins/photo-swipe',
'/plugins/redirect',
'/plugins/register-components',
'/plugins/watermark',
],
},
{
text: 'Markdown',
items: ['/plugins/markdown-container', '/plugins/links-check'],
},
{
text: 'Search',
items: ['/plugins/docsearch', '/plugins/search'],
},
{
text: 'Blogging',
items: ['/plugins/blog/', '/plugins/comment/', '/plugins/feed/'],
},
{
text: 'PWA',
items: ['/plugins/pwa/', '/plugins/remove-pwa'],
},
{
text: 'SEO',
items: [
'/plugins/baidu-analytics',
'/plugins/google-analytics',
'/plugins/google-tag-manager',
'/plugins/seo/',
'/plugins/sitemap/',
'/plugins/umami-analytics',
],
},
{
text: 'Syntax Highlighting',
items: ['/plugins/prismjs', '/plugins/shiki'],
},
{
text: 'Theme Development',
items: [
'/plugins/active-header-links',
'/plugins/git',
'/plugins/palette',
'/plugins/reading-time',
'/plugins/rtl',
'/plugins/sass-palette/',
'/plugins/theme-data',
'/plugins/toc',
],
},
],
},
{
text: 'Tools',
activeMatch: '^/tools/',
items: [
{
text: 'helper',
link: '/tools/helper/',
},
],
},
]
2 changes: 2 additions & 0 deletions docs-next/.vuepress/configs/navbar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './zh.js'
export * from './en.js'
Loading
Loading