style: lint fix

This commit is contained in:
pengzhanbo 2024-01-02 00:34:02 +08:00
parent aac83e0c14
commit c4d9a10efc
26 changed files with 124 additions and 89 deletions

View File

@ -1,4 +1,5 @@
import * as path from 'path' import * as path from 'node:path'
import process from 'node:process'
import { viteBundler } from '@vuepress/bundler-vite' import { viteBundler } from '@vuepress/bundler-vite'
import { webpackBundler } from '@vuepress/bundler-webpack' import { webpackBundler } from '@vuepress/bundler-webpack'
import { defineUserConfig } from '@vuepress/cli' import { defineUserConfig } from '@vuepress/cli'

View File

@ -167,15 +167,25 @@ function foo() {
``` ```
::: note 注释 ::: note 注释
注释内容 注释内容 [link](https://github.com/pengzhanbo) `inline code`
```js
const a = 1
const b = 2
const c = a + b
```
::: :::
::: info 信息 ::: info 信息
信息内容 信息内容 [link](https://github.com/pengzhanbo) `inline code`
```js
const a = 1
const b = 2
const c = a + b
```
::: :::
::: tip 提示 ::: tip 提示
提示内容 提示内容 [link](https://github.com/pengzhanbo) `inline code`
```js ```js
const a = 1 const a = 1
const b = 2 const b = 2
@ -184,7 +194,7 @@ const c = a + b
::: :::
::: warning 警告 ::: warning 警告
警告内容 警告内容 [link](https://github.com/pengzhanbo) `inline code`
```js ```js
const a = 1 const a = 1
const b = 2 const b = 2
@ -193,7 +203,7 @@ const c = a + b
::: :::
::: caution 错误 ::: caution 错误
错误内容 错误内容 [link](https://github.com/pengzhanbo) `inline code`
```js ```js
const a = 1 const a = 1
const b = 2 const b = 2
@ -202,7 +212,7 @@ const c = a + b
::: :::
::: important 重要 ::: important 重要
重要内容 重要内容 [link](https://github.com/pengzhanbo) `inline code`
```js ```js
const a = 1 const a = 1
const b = 2 const b = 2
@ -210,14 +220,6 @@ const c = a + b
``` ```
::: :::
::: info
代码
```ts
const a = 1
const b = 2
```
:::
**代码演示** **代码演示**

View File

@ -15,7 +15,7 @@ export function useBlogPostData<
return blogPostData as BlogDataRef<T> return blogPostData as BlogDataRef<T>
} }
if (import.meta.webpackHot || import.meta.hot) { if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
__VUE_HMR_RUNTIME__.updateBlogData = (data: BlogPostData) => { __VUE_HMR_RUNTIME__.updateBlogData = (data: BlogPostData) => {
blogPostData.value = data blogPostData.value = data
} }

View File

@ -34,18 +34,11 @@ export function blogDataPlugin({
ignoreInitial: true, ignoreInitial: true,
}) })
watcher.on( const handler = () => preparedBlogData(app, pageFilter, pluginOptions)
'add',
async () => await preparedBlogData(app, pageFilter, pluginOptions), watcher.on('add', handler)
) watcher.on('change', handler)
watcher.on( watcher.on('unlink', handler)
'change',
async () => await preparedBlogData(app, pageFilter, pluginOptions),
)
watcher.on(
'unlink',
async () => await preparedBlogData(app, pageFilter, pluginOptions),
)
watchers.push(watcher) watchers.push(watcher)
}, },

View File

@ -15,7 +15,7 @@ export function useNotesData<
return notesData as NotesDataRef<T> return notesData as NotesDataRef<T>
} }
if (import.meta.webpackHot || import.meta.hot) { if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
__VUE_HMR_RUNTIME__.updateNotesData = (data: NotesData) => { __VUE_HMR_RUNTIME__.updateNotesData = (data: NotesData) => {
notesData.value = data notesData.value = data
} }

View File

@ -38,7 +38,7 @@
效果: 效果:
``` html ``` html
阅读数99 阅读数99
``` ```
## 结构 ## 结构

View File

@ -20,7 +20,7 @@ const isScrolling = ref(false)
const progress = computed( const progress = computed(
() => (y.value / (bodyHeight.value - windowHeight.value)) * 100, () => (y.value / (bodyHeight.value - windowHeight.value)) * 100,
) )
const percent = computed(() => `${Math.round(progress.value)}%`) const percent = computed(() => `${Math.round(progress.value) || 0}%`)
const stroke = computed(() => const stroke = computed(() =>
`calc(${Math.PI * progress.value}% - ${4 * Math.PI}px) calc(${Math.PI * 100}% - ${4 * Math.PI}px)`, `calc(${Math.PI * progress.value}% - ${4 * Math.PI}px) calc(${Math.PI * 100}% - ${4 * Math.PI}px)`,
@ -86,7 +86,9 @@ function handleClick() {
box-shadow: var(--vp-shadow-2); box-shadow: var(--vp-shadow-2);
background-color: var(--vp-c-bg); background-color: var(--vp-c-bg);
inset-inline-end: 1rem; inset-inline-end: 1rem;
transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease; transition:
background-color 0.25s ease,
box-shadow 0.25s ease;
} }
.back-to-top-button .percent, .back-to-top-button .percent,

View File

@ -146,13 +146,17 @@ const showBlogExtract = computed(() => {
background-color: var(--vp-c-bg); background-color: var(--vp-c-bg);
border-top-left-radius: 12px; border-top-left-radius: 12px;
border-top-right-radius: 12px; border-top-right-radius: 12px;
box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.1), 0 -1px 4px rgba(0, 0, 0, 0.1); box-shadow:
0 -3px 12px rgba(0, 0, 0, 0.1),
0 -1px 4px rgba(0, 0, 0, 0.1);
transform: translateY(100%); transform: translateY(100%);
transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1); transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
} }
.dark .blog-modal-container { .dark .blog-modal-container {
box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.3), 0 -1px 4px rgba(0, 0, 0, 0.27); box-shadow:
0 -3px 12px rgba(0, 0, 0, 0.3),
0 -1px 4px rgba(0, 0, 0, 0.27);
} }
.blog-modal-container.open { .blog-modal-container.open {

View File

@ -44,7 +44,9 @@ const page = usePageData()
font-weight: 500; font-weight: 500;
color: var(--vp-c-text-1); color: var(--vp-c-text-1);
white-space: nowrap; white-space: nowrap;
transition: background-color 0.25s, color 0.25s; transition:
background-color 0.25s,
color 0.25s;
} }
.link:hover { .link:hover {

View File

@ -66,11 +66,11 @@ export default {
<style scoped> <style scoped>
.flyout-wrapper { .flyout-wrapper {
position: relative; position: relative;
transition: color 0.25s;
} }
.flyout-wrapper:hover { .flyout-wrapper:hover {
color: var(--vp-c-brand-1); color: var(--vp-c-brand-1);
transition: color 0.25s;
} }
.flyout-wrapper:hover .text { .flyout-wrapper:hover .text {
@ -143,6 +143,9 @@ export default {
right: 0; right: 0;
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
transition: opacity 0.25s, visibility 0.25s, transform 0.25s; transition:
opacity 0.25s,
visibility 0.25s,
transform 0.25s;
} }
</style> </style>

View File

@ -82,7 +82,9 @@ const showLocalNav = computed(() => {
padding-top: var(--vp-layout-top-height, 0px); padding-top: var(--vp-layout-top-height, 0px);
width: 100%; width: 100%;
background-color: var(--vp-local-nav-bg-color); background-color: var(--vp-local-nav-bg-color);
transition: border-color 0.5s, background-color 0.5s; transition:
border-color 0.5s,
background-color 0.5s;
} }
.local-nav.fixed { .local-nav.fixed {

View File

@ -110,7 +110,7 @@ function scrollToTop() {
padding: 2px 0; padding: 2px 0;
} }
.open>.icon { .open > .icon {
transform: rotate(90deg); transform: rotate(90deg);
} }
@ -148,11 +148,11 @@ function scrollToTop() {
} }
.flyout-enter-active { .flyout-enter-active {
transition: all .2s ease-out; transition: all 0.2s ease-out;
} }
.flyout-leave-active { .flyout-leave-active {
transition: all .15s ease-in; transition: all 0.15s ease-in;
} }
.flyout-enter-from, .flyout-enter-from,

View File

@ -83,7 +83,10 @@ defineEmits<(e: 'click') => void>()
.navbar-hamburger.active:hover .middle, .navbar-hamburger.active:hover .middle,
.navbar-hamburger.active:hover .bottom { .navbar-hamburger.active:hover .bottom {
background-color: var(--vp-c-text-2); background-color: var(--vp-c-text-2);
transition: top 0.25s, background-color 0.25s, transform 0.25s; transition:
top 0.25s,
background-color 0.25s,
transform 0.25s;
} }
.top, .top,
@ -93,7 +96,10 @@ defineEmits<(e: 'click') => void>()
width: 16px; width: 16px;
height: 2px; height: 2px;
background-color: var(--vp-c-text-1); background-color: var(--vp-c-text-1);
transition: top 0.25s, background-color 0.5s, transform 0.25s; transition:
top 0.25s,
background-color 0.5s,
transform 0.25s;
} }
.top { .top {

View File

@ -23,6 +23,12 @@
} }
} }
@media print {
.navbar-search {
display: none;
}
}
/* plugin-docsearch */ /* plugin-docsearch */
.DocSearch { .DocSearch {
--docsearch-primary-color: var(--vp-c-brand-1); --docsearch-primary-color: var(--vp-c-brand-1);
@ -73,8 +79,8 @@
} }
.navbar-search #docsearch-container { .navbar-search #docsearch-container {
min-width: 32px; min-width: 32px;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.navbar-search .DocSearch-Button { .navbar-search .DocSearch-Button {
@ -171,7 +177,9 @@
font-family: var(--vp-font-family-base); font-family: var(--vp-font-family-base);
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
transition: color 0.5s, border-color 0.5s; transition:
color 0.5s,
border-color 0.5s;
} }
.DocSearch-Button .DocSearch-Button-Key + .DocSearch-Button-Key { .DocSearch-Button .DocSearch-Button-Key + .DocSearch-Button-Key {
@ -217,7 +225,7 @@
/* plugin-search */ /* plugin-search */
.navbar-search .search-box input { .navbar-search .search-box input {
padding: 0 0.3rem 0 1.575rem; padding: 0 0.4rem 0 1.555rem;
background-position: 0.5rem 0.4rem; background-position: 0.5rem 0.4rem;
} }
/* plugin-search */ /* plugin-search */

View File

@ -114,7 +114,9 @@ function toggle() {
width: 14px; width: 14px;
height: 14px; height: 14px;
fill: var(--vp-c-text-2); fill: var(--vp-c-text-2);
transition: fill 0.5s, transform 0.25s; transition:
fill 0.5s,
transform 0.25s;
} }
.group:first-child { .group:first-child {

View File

@ -27,7 +27,9 @@ const closeScreen = inject('close-screen') as () => void
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
color: var(--vp-c-text-1); color: var(--vp-c-text-1);
transition: border-color 0.25s, color 0.25s; transition:
border-color 0.25s,
color 0.25s;
} }
.nav-screen-menu-link:hover { .nav-screen-menu-link:hover {

View File

@ -96,7 +96,9 @@ function handlePrint() {
width: 2px; width: 2px;
height: 18px; height: 18px;
background-color: var(--vp-c-brand-1); background-color: var(--vp-c-brand-1);
transition: top 0.25s cubic-bezier(0, 1, 0.5, 1), background-color 0.5s, transition:
top 0.25s cubic-bezier(0, 1, 0.5, 1),
background-color 0.5s,
opacity 0.25s; opacity 0.25s;
} }

View File

@ -140,7 +140,7 @@ const hasMeta = computed(() => readingTime.value.times || tags.value.length || c
} }
.page-meta-wrapper .reading-time span { .page-meta-wrapper .reading-time span {
margin-right: 0.5rem; margin-right: 8px;
} }
.page-meta-wrapper .reading-time span:last-of-type { .page-meta-wrapper .reading-time span:last-of-type {

View File

@ -71,14 +71,18 @@ watch(
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
transform: translateX(-100%); transform: translateX(-100%);
transition: opacity 0.5s, transform 0.5s cubic-bezier(0.19, 1, 0.22, 1); transition:
opacity 0.5s,
transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
} }
.sidebar-wrapper.open { .sidebar-wrapper.open {
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
transform: translateX(0); transform: translateX(0);
transition: opacity 0.25s, transform 0.5s cubic-bezier(0.19, 1, 0.22, 1); transition:
opacity 0.25s,
transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
} }
.dark .sidebar-wrapper { .dark .sidebar-wrapper {

View File

@ -18,7 +18,9 @@
flex-shrink: 0; flex-shrink: 0;
border: 1px solid var(--vp-input-border-color); border: 1px solid var(--vp-input-border-color);
background-color: var(--vp-input-switch-bg-color); background-color: var(--vp-input-switch-bg-color);
transition: border-color 0.25s ease, background-color 0.25s ease; transition:
border-color 0.25s ease,
background-color 0.25s ease;
} }
.switch-wrapper:hover { .switch-wrapper:hover {

View File

@ -56,11 +56,17 @@ function linkTo(e: Event) {
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
white-space: nowrap; white-space: nowrap;
transition: color 0.25s, border-color 0.25s, background-color 0.25s; transition:
color 0.25s,
border-color 0.25s,
background-color 0.25s;
} }
.VPButton:active { .VPButton:active {
transition: color 0.1s, border-color 0.1s, background-color 0.1s; transition:
color 0.1s,
border-color 0.1s,
background-color 0.1s;
} }
.VPButton.medium { .VPButton.medium {

View File

@ -44,7 +44,9 @@ const { hasSidebar } = useSidebar()
.plume-footer :deep(a) { .plume-footer :deep(a) {
text-decoration-line: underline; text-decoration-line: underline;
text-underline-offset: 2px; text-underline-offset: 2px;
transition: color, text-underline-offset 0.25s; transition:
color,
text-underline-offset 0.25s;
} }
.plume-footer :deep(a:hover) { .plume-footer :deep(a:hover) {

View File

@ -1,23 +1,11 @@
import { usePageLang, useSiteData } from '@vuepress/client' import { useRouteLocale } from '@vuepress/client'
import { computed } from 'vue' import { computed } from 'vue'
import { normalizeLink } from '../utils' import { normalizeLink } from '../utils'
export function useLocaleLink(link: string) { export function useLocaleLink(link: string) {
const site = useSiteData() const prefix = useRouteLocale()
const locale = usePageLang()
const links = computed(() => {
const locales = site.value.locales
const links: Record<string, string> = {}
Object.keys(locales).forEach((key) => {
const locale = locales[key]
locale.lang && (links[locale.lang] = key)
})
return links
})
return computed(() => { return computed(() => {
const prefix = links.value[locale.value] || '/' return normalizeLink(prefix.value + link)
return normalizeLink(prefix + link)
}) })
} }

View File

@ -15,15 +15,15 @@ export const readingTimeLocales = {
}, },
'zh-CN': { 'zh-CN': {
word: '约 $word 字', word: '约$word字',
less1Minute: '小于 1 分钟', less1Minute: '小于1分钟',
time: '大约 $time 分钟', time: '大约$time分钟',
}, },
'zh-TW': { 'zh-TW': {
word: '約 $word 字', word: '約$word字',
less1Minute: '小於 1 分鐘', less1Minute: '小於1分鐘',
time: '大约 $time 分鐘', time: '大约$time分鐘',
}, },
'de': { 'de': {

View File

@ -94,7 +94,9 @@ const themeData = useThemeLocaleData()
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
color: var(--vp-c-brand); color: var(--vp-c-brand);
transition: border-color 0.25s, color 0.25s; transition:
border-color 0.25s,
color 0.25s;
} }
.link:hover { .link:hover {

View File

@ -1,18 +1,20 @@
<!DOCTYPE html> <!doctype html>
<html lang="{{ lang }}"> <html lang="{{ lang }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="generator" content="VuePress {{ version }}"> <meta name="generator" content="VuePress {{ version }}" />
<meta name="theme" content="VuePress Theme Plume {{ themeVersion }}"> <meta name="theme" content="VuePress Theme Plume {{ themeVersion }}" />
<script> <script>
(function() { ;(function () {
const um = localStorage.getItem('vuepress-theme-appearance'); const um = localStorage.getItem('vuepress-theme-appearance')
const sm = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; const sm =
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
if (um === 'dark' || (um !== 'light' && sm)) { if (um === 'dark' || (um !== 'light' && sm)) {
document.documentElement.classList.add('dark'); document.documentElement.classList.add('dark')
} }
})(); })()
</script> </script>
<!--vuepress-ssr-head--> <!--vuepress-ssr-head-->
<!--vuepress-ssr-styles--> <!--vuepress-ssr-styles-->