From 8fafa549404d8a5bc53fc83e4038efc5b30ee951 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 2 Jan 2024 00:29:50 +0800 Subject: [PATCH 1/4] build: update deps to latest --- docs/package.json | 2 +- eslint.config.js | 5 +- package.json | 2 +- plugins/plugin-iconify/package.json | 5 +- plugins/plugin-notes-data/package.json | 5 +- plugins/plugin-shikiji/package.json | 4 +- pnpm-lock.yaml | 131 +++++-------------------- 7 files changed, 35 insertions(+), 119 deletions(-) diff --git a/docs/package.json b/docs/package.json index 1dc31e83..90945cc6 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,7 +1,7 @@ { "name": "docs", - "private": true, "type": "module", + "private": true, "scripts": { "docs:build": "vuepress-cli build --clean-cache", "docs:clean": "rimraf .vuepress/.temp .vuepress/.cache .vuepress/dist", diff --git a/eslint.config.js b/eslint.config.js index b0d2616e..1bea7613 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,9 +2,10 @@ import config from '@pengzhanbo/eslint-config-vue' export default config({ formatters: { - css: false, + css: true, + html: true, }, - ignores: ['.temp', '.cache', 'lib', 'dist', 'docs', '**/*.html'], + ignores: ['lib', 'docs/**/*.md'], globals: { __VUEPRESS_VERSION__: 'readonly', __VUEPRESS_BASE__: 'readonly', diff --git a/package.json b/package.json index fffd9403..a293c01b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "devDependencies": { "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", - "@pengzhanbo/eslint-config-vue": "^1.5.0", + "@pengzhanbo/eslint-config-vue": "^1.5.1", "@types/minimist": "^1.2.5", "@types/node": "20.9.1", "@types/webpack-env": "^1.18.4", diff --git a/plugins/plugin-iconify/package.json b/plugins/plugin-iconify/package.json index b061a7e7..635b3967 100644 --- a/plugins/plugin-iconify/package.json +++ b/plugins/plugin-iconify/package.json @@ -33,10 +33,7 @@ "build": "pnpm run clean && pnpm run copy && pnpm run ts", "clean": "rimraf lib *.tsbuildinfo", "copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib", - "copy:watch": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib -w", - "dev": "concurrently \"pnpm copy:watch\" \"pnpm ts:watch\"", - "ts": "tsc -b tsconfig.build.json", - "ts:watch": "tsc -b tsconfig.build.json --watch" + "ts": "tsc -b tsconfig.build.json" }, "dependencies": { "@iconify/vue": "^4.1.1", diff --git a/plugins/plugin-notes-data/package.json b/plugins/plugin-notes-data/package.json index 6674f0eb..90eeb564 100644 --- a/plugins/plugin-notes-data/package.json +++ b/plugins/plugin-notes-data/package.json @@ -33,10 +33,7 @@ "build": "pnpm run clean && pnpm run copy && pnpm run ts", "clean": "rimraf lib *.tsbuildinfo", "copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib", - "copy:watch": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib -w", - "dev": "concurrently \"pnpm copy:watch\" \"pnpm ts:watch\"", - "ts": "tsc -b tsconfig.build.json", - "ts:watch": "tsc -b tsconfig.build.json --watch" + "ts": "tsc -b tsconfig.build.json" }, "dependencies": { "@vue/devtools-api": "^6.5.1", diff --git a/plugins/plugin-shikiji/package.json b/plugins/plugin-shikiji/package.json index 27fc3179..6ea0eccc 100644 --- a/plugins/plugin-shikiji/package.json +++ b/plugins/plugin-shikiji/package.json @@ -36,8 +36,8 @@ "@vuepress/utils": "2.0.0-rc.0", "nanoid": "^5.0.4", "picocolors": "^1.0.0", - "shikiji": "^0.9.15", - "shikiji-transformers": "^0.9.15" + "shikiji": "^0.9.16", + "shikiji-transformers": "^0.9.16" }, "publishConfig": { "access": "public" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c182c3c1..41cc59b9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: ^18.4.3 version: 18.4.3 '@pengzhanbo/eslint-config-vue': - specifier: ^1.5.0 - version: 1.5.0(@vue/compiler-sfc@3.4.3)(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3) + specifier: ^1.5.1 + version: 1.5.1(@vue/compiler-sfc@3.4.3)(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3) '@types/minimist': specifier: ^1.2.5 version: 1.2.5 @@ -386,11 +386,11 @@ importers: specifier: ^1.0.0 version: 1.0.0 shikiji: - specifier: ^0.9.15 - version: 0.9.15 + specifier: ^0.9.16 + version: 0.9.16 shikiji-transformers: - specifier: ^0.9.15 - version: 0.9.15 + specifier: ^0.9.16 + version: 0.9.16 theme: dependencies: @@ -1983,18 +1983,6 @@ packages: - supports-color dev: false - /@html-eslint/eslint-plugin@0.22.0: - resolution: {integrity: sha512-6Q3uW5XeVmUGwH2t5lmt0q51x7dNiaV1GuYReuHOPn01tSn9vJ5OKs71t+OsQzhg+hUqpVrmBizkBJZkcpX/sA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - - /@html-eslint/parser@0.22.0: - resolution: {integrity: sha512-1XNYNgysZJfpLEYx+ao4I67F5+8gQDQbBt38/Ylcn5L8ij5xHfRDWvOIBvejqEgNQRRzM5s7UOhPSj+02YtMsQ==} - engines: {node: '>=8.10.0'} - dependencies: - es-html-parser: 0.0.9 - dev: true - /@humanwhocodes/config-array@0.11.13: resolution: {integrity: sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==} engines: {node: '>=10.10.0'} @@ -3952,8 +3940,8 @@ packages: '@parcel/watcher-win32-x64': 2.3.0 dev: false - /@pengzhanbo/eslint-config-vue@1.5.0(@vue/compiler-sfc@3.4.3)(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-DdzMN4QEOk7hc1uGHw9u8xymQPZbG92OkVV8KNpOqMSOcEU+1UdIN5TGbgJ8SUn1zpW+eozN1AY2k7dXOhkWGA==} + /@pengzhanbo/eslint-config-vue@1.5.1(@vue/compiler-sfc@3.4.3)(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-4+ERArSMd5ovP0etk1BcH/chIB7Z/JvG/LoBErTn9Xujdj+g9ANyCJA/JNxMRh88DbMmCRp2ho1+4/b82HTipw==} peerDependencies: '@unocss/eslint-plugin': '>=0.50.0' eslint: '>=8.40.0' @@ -3964,7 +3952,7 @@ packages: eslint-plugin-tailwindcss: optional: true dependencies: - '@pengzhanbo/eslint-config': 1.5.0(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3)(vue-eslint-parser@9.3.2) + '@pengzhanbo/eslint-config': 1.5.1(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3)(vue-eslint-parser@9.3.2) '@typescript-eslint/parser': 6.16.0(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 eslint-merge-processors: 0.1.0(eslint@8.56.0) @@ -3984,8 +3972,8 @@ packages: - vitest dev: true - /@pengzhanbo/eslint-config@1.5.0(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3)(vue-eslint-parser@9.3.2): - resolution: {integrity: sha512-CaLMoRceGedgKmDRdWOJ8fzY1VUaRid9+mzrc7Fb4LHX24zyz7PMtNq7BVpz3ezEqV9e2CBoWLjL3j9sr+iojw==} + /@pengzhanbo/eslint-config@1.5.1(eslint-plugin-format@0.1.0)(eslint@8.56.0)(typescript@5.3.3)(vue-eslint-parser@9.3.2): + resolution: {integrity: sha512-tk1emthQHQnlwz76rwUFcmVB6r04QSJs8ekn7CdKSN3TekHjYDTvicfQaOq0n2Inmdj51Ha8Jri6bCU1cZ7oXg==} peerDependencies: '@unocss/eslint-plugin': '>=0.50.0' eslint: '>=8.40.0' @@ -4003,8 +3991,6 @@ packages: '@eslint-types/jsdoc': 46.9.0 '@eslint-types/typescript-eslint': 6.16.0 '@eslint-types/unicorn': 50.0.1 - '@html-eslint/eslint-plugin': 0.22.0 - '@html-eslint/parser': 0.22.0 '@stylistic/eslint-plugin': 1.5.1(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/eslint-plugin': 6.16.0(@typescript-eslint/parser@6.16.0)(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/parser': 6.16.0(eslint@8.56.0)(typescript@5.3.3) @@ -4015,7 +4001,7 @@ packages: eslint-plugin-eslint-comments: 3.2.0(eslint@8.56.0) eslint-plugin-format: 0.1.0(eslint@8.56.0) eslint-plugin-i: 2.29.1(@typescript-eslint/parser@6.16.0)(eslint@8.56.0) - eslint-plugin-jsdoc: 46.10.1(eslint@8.56.0) + eslint-plugin-jsdoc: 47.0.2(eslint@8.56.0) eslint-plugin-jsonc: 2.11.2(eslint@8.56.0) eslint-plugin-markdown: 3.0.1(eslint@8.56.0) eslint-plugin-n: 16.6.0(eslint@8.56.0) @@ -4303,7 +4289,7 @@ packages: peerDependencies: eslint: '*' dependencies: - '@typescript-eslint/utils': 6.15.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.16.0(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 transitivePeerDependencies: - supports-color @@ -4317,7 +4303,7 @@ packages: eslint: '>=8.40.0' dependencies: '@stylistic/eslint-plugin-js': 1.5.1(eslint@8.56.0) - '@typescript-eslint/utils': 6.15.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.16.0(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 transitivePeerDependencies: - supports-color @@ -4736,14 +4722,6 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@6.15.0: - resolution: {integrity: sha512-+BdvxYBltqrmgCNu4Li+fGDIkW9n//NrruzG9X1vBzaNK+ExVXPoGB71kneaVw/Jp+4rH/vaMAGC6JfMbHstVg==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.15.0 - '@typescript-eslint/visitor-keys': 6.15.0 - dev: true - /@typescript-eslint/scope-manager@6.16.0: resolution: {integrity: sha512-0N7Y9DSPdaBQ3sqSCwlrm9zJwkpOuc6HYm7LpzLAPqBL7dmzAUimr4M29dMkOP/tEwvOCC/Cxo//yOfJD3HUiw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -4777,11 +4755,6 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: false - /@typescript-eslint/types@6.15.0: - resolution: {integrity: sha512-yXjbt//E4T/ee8Ia1b5mGlbNj9fB9lJP4jqLbZualwpP2BCQ5is6BcWwxpIsY4XKAhmdv3hrW92GdtJbatC6dQ==} - engines: {node: ^16.0.0 || >=18.0.0} - dev: true - /@typescript-eslint/types@6.16.0: resolution: {integrity: sha512-hvDFpLEvTJoHutVl87+MG/c5C8I6LOgEx05zExTSJDEVU7hhR3jhV8M5zuggbdFCw98+HhZWPHZeKS97kS3JoQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -4808,27 +4781,6 @@ packages: - supports-color dev: false - /@typescript-eslint/typescript-estree@6.15.0(typescript@5.3.3): - resolution: {integrity: sha512-7mVZJN7Hd15OmGuWrp2T9UvqR2Ecg+1j/Bp1jXUEY2GZKV6FXlOIoqVDmLpBiEiq3katvj/2n2mR0SDwtloCew==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 6.15.0 - '@typescript-eslint/visitor-keys': 6.15.0 - debug: 4.3.4(supports-color@9.2.2) - globby: 11.1.0 - is-glob: 4.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.1(typescript@5.3.3) - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/typescript-estree@6.16.0(typescript@5.3.3): resolution: {integrity: sha512-VTWZuixh/vr7nih6CfrdpmFNLEnoVBF1skfjdyGnNwXOH1SLeHItGdZDHhhAIzd3ACazyY2Fg76zuzOVTaknGA==} engines: {node: ^16.0.0 || >=18.0.0} @@ -4851,25 +4803,6 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.15.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-eF82p0Wrrlt8fQSRL0bGXzK5nWPRV2dYQZdajcfzOD9+cQz9O7ugifrJxclB+xVOvWvagXfqS4Es7vpLP4augw==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@types/json-schema': 7.0.12 - '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 6.15.0 - '@typescript-eslint/types': 6.15.0 - '@typescript-eslint/typescript-estree': 6.15.0(typescript@5.3.3) - eslint: 8.56.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - /@typescript-eslint/utils@6.16.0(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-T83QPKrBm6n//q9mv7oiSvy/Xq/7Hyw9SzSEhMHJwznEmQayfBM87+oAlkNAMEO7/MjIwKyOHgBJbxB0s7gx2A==} engines: {node: ^16.0.0 || >=18.0.0} @@ -4897,14 +4830,6 @@ packages: eslint-visitor-keys: 3.4.3 dev: false - /@typescript-eslint/visitor-keys@6.15.0: - resolution: {integrity: sha512-1zvtdC1a9h5Tb5jU9x3ADNXO9yjP8rXlaoChu0DQX40vf5ACVpYIVIZhIMZ6d5sDXH7vq4dsZBT1fEGj8D2n2w==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.15.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@typescript-eslint/visitor-keys@6.16.0: resolution: {integrity: sha512-QSFQLruk7fhs91a/Ep/LqRdbJCZ1Rq03rqBdKT5Ky17Sz8zRLUksqIe9DW0pKtg/Z35/ztbLQ6qpOCN6rOC11A==} engines: {node: ^16.0.0 || >=18.0.0} @@ -8352,10 +8277,6 @@ packages: xtend: 4.0.2 dev: false - /es-html-parser@0.0.9: - resolution: {integrity: sha512-oniQMi+466VFsDzcdron9Ry/sqUJpDJg1bbDn0jFJKDdxXhwIOYDr4DgBnO5/yPLGj2xv+n5yy4L1Q0vAC5TYQ==} - dev: true - /es-module-lexer@1.2.1: resolution: {integrity: sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==} dev: false @@ -8683,8 +8604,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc@46.10.1(eslint@8.56.0): - resolution: {integrity: sha512-x8wxIpv00Y50NyweDUpa+58ffgSAI5sqe+zcZh33xphD0AVh+1kqr1ombaTRb7Fhpove1zfUuujlX9DWWBP5ag==} + /eslint-plugin-jsdoc@47.0.2(eslint@8.56.0): + resolution: {integrity: sha512-sIq81Pv+yrhhwY0m1JH79rdZRgDNunehv3S0Yv0UfewpoeJyPkODFn2o4o20nofVoI2tjku9/QBcCYUmmeWFXA==} engines: {node: '>=16'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 @@ -8773,7 +8694,7 @@ packages: vue-eslint-parser: optional: true dependencies: - '@typescript-eslint/utils': 6.15.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.16.0(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 minimatch: 9.0.3 natural-compare-lite: 1.4.0 @@ -8854,7 +8775,7 @@ packages: optional: true dependencies: '@typescript-eslint/eslint-plugin': 6.16.0(@typescript-eslint/parser@6.16.0)(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.15.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.16.0(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 transitivePeerDependencies: - supports-color @@ -14997,20 +14918,20 @@ packages: /shell-quote@1.8.1: resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} - /shikiji-core@0.9.15: - resolution: {integrity: sha512-7hqIcUKS15OMs/61Qp2GvO1fSajBB36bDqi8vexIg5kp80V6v6SGtBrlq+nLlo7erMG2d1kvIuTIq1bwKI6fEg==} + /shikiji-core@0.9.16: + resolution: {integrity: sha512-eJIK8/IpzvAGnbckCE2Qf/fOSfpjVLSosUfI3pQAnbphGXagEqiRcT/gyVtL4llqmBh0nexqRdJKMFZF3A6ayw==} dev: false - /shikiji-transformers@0.9.15: - resolution: {integrity: sha512-k0sQ6tX26/cdb8QV9CCwwr7QjRp6/AVP9C0oNIXNld3of+xCrpf74kD74piybG6vMfzBoHGsz/s60RVBJOUaYQ==} + /shikiji-transformers@0.9.16: + resolution: {integrity: sha512-DcvhYtLc3Xtme070vgyyeHX0XrNK0zHrKIiPk8wcptFbFUuS65qYDd/UFl68+R8KhdoSFTM9EXlBa9MhrGlbaw==} dependencies: - shikiji: 0.9.15 + shikiji: 0.9.16 dev: false - /shikiji@0.9.15: - resolution: {integrity: sha512-+inN4cN+nY7b0uCPOiqFHAk+cn2DEdM3AIQgPhAV7QKqhww/o7OGS5xvLh3SNnjke9C/HispALqGOQGYHVq7KQ==} + /shikiji@0.9.16: + resolution: {integrity: sha512-QeSwiW88gHke9deQ5Av1f6CEVPGW/riRMPT3vMDGPnASCOhBZK4TYk5ZRoa2qYLncPZS5kXKwcggccQvg3+U7Q==} dependencies: - shikiji-core: 0.9.15 + shikiji-core: 0.9.16 dev: false /shimmer@1.2.1: From 75c59c588ccaa7eea5d38e99e335d1928c85277b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 2 Jan 2024 00:31:25 +0800 Subject: [PATCH 2/4] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=AE=B9=E5=99=A8=E5=9C=A8=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E8=A1=A8=E7=8E=B0=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- theme/src/client/styles/_variables.scss | 1 - theme/src/client/styles/code.scss | 87 ++++++++++--------------- theme/src/client/styles/content.scss | 62 +++++++++--------- theme/src/client/styles/index.scss | 22 ++++--- theme/src/client/styles/md-enhance.scss | 49 ++++++++------ theme/src/client/styles/normalize.scss | 3 +- theme/src/client/styles/nprogress.scss | 10 +-- theme/src/client/styles/vars.scss | 54 ++++++++------- 8 files changed, 146 insertions(+), 142 deletions(-) delete mode 100644 theme/src/client/styles/_variables.scss diff --git a/theme/src/client/styles/_variables.scss b/theme/src/client/styles/_variables.scss deleted file mode 100644 index 12f61127..00000000 --- a/theme/src/client/styles/_variables.scss +++ /dev/null @@ -1 +0,0 @@ -@import '@vuepress/plugin-palette/palette'; diff --git a/theme/src/client/styles/code.scss b/theme/src/client/styles/code.scss index ff6fe4b5..02fa7182 100644 --- a/theme/src/client/styles/code.scss +++ b/theme/src/client/styles/code.scss @@ -1,6 +1,3 @@ -// =============================== -// Forked and modified from prismjs/themes/prism-tomorrow.css - .dark .vp-code span { color: var(--shiki-dark, rgba(235, 235, 245, 0.6)); } @@ -11,13 +8,12 @@ html:not(.dark) .vp-code span { .plume-content { pre { - // line-height: 1.4; padding: 1.3rem 1.5rem; margin: 0 0 0.85rem 0; border-radius: 6px; overflow: auto; scrollbar-width: thin; - scrollbar-color: var(--c-brand) var(--c-border); + scrollbar-color: var(--vp-c-brand-1) var(--vp-c-border); font-size: 14px; code { @@ -43,10 +39,6 @@ html:not(.dark) .vp-code span { } } -.code-tabs-nav { - margin-bottom: 0rem; -} - div[class*='language-'] { position: relative; background-color: var(--vp-code-block-bg); @@ -105,7 +97,6 @@ div[class*='language-'] { left: 0; top: 0; display: block; - // width: var(--code-ln-wrapper-width); height: 100%; } } @@ -125,7 +116,7 @@ div[class*='language-'] { text-align: center; z-index: 1; color: var(--vp-code-line-number-color); - padding-top: 1.14rem; + padding-top: 1.25rem; line-height: var(--vp-code-line-height); counter-reset: line-number; border-right: var(--vp-code-block-divider-color) 1px solid; @@ -153,14 +144,15 @@ div[class*='language-'] { padding: 0 24px; width: calc(100% + 2 * 24px); display: inline-block; -} + z-index: 2; -.plume-content [class*='language-'] code .highlighted.error { - background-color: var(--vp-code-line-error-color); -} + &.error { + background-color: var(--vp-code-line-error-color); + } -.plume-content [class*='language-'] code .highlighted.warning { - background-color: var(--vp-code-line-warning-color); + &.warning { + background-color: var(--vp-code-line-warning-color); + } } .plume-content [class*='language-'] code .diff { @@ -169,22 +161,36 @@ div[class*='language-'] { padding: 0 24px; width: calc(100% + 2 * 24px); display: inline-block; -} -.plume-content [class*='language-'] code .diff::before { - position: absolute; - left: 10px; + &::before { + position: absolute; + left: 10px; + } + + &.remove { + background-color: var(--vp-code-line-diff-remove-color); + opacity: 0.7; + } + + &.remove::before { + content: '-'; + color: var(--vp-code-line-diff-remove-symbol-color); + transform: translateX(-6px); + } + + &.add { + background-color: var(--vp-code-line-diff-add-color); + } + + &.add::before { + content: '+'; + color: var(--vp-code-line-diff-add-symbol-color); + transform: translateX(-6px); + } } .plume-content [class*='language-'] .has-focused-lines .line:not(.has-focus) { filter: blur(0.095rem); - opacity: 0.4; - transition: - filter 0.35s, - opacity 0.35s; -} - -.plume-content [class*='language-'] .has-focused-lines .line:not(.has-focus) { opacity: 0.7; transition: filter 0.35s, @@ -199,25 +205,8 @@ div[class*='language-'] { opacity: 1; } -.plume-content [class*='language-'] code .diff.remove { - background-color: var(--vp-code-line-diff-remove-color); - opacity: 0.7; -} - -.plume-content [class*='language-'] code .diff.remove::before { - content: '-'; - color: var(--vp-code-line-diff-remove-symbol-color); - transform: translateX(-6px); -} - -.plume-content [class*='language-'] code .diff.add { - background-color: var(--vp-code-line-diff-add-color); -} - -.plume-content [class*='language-'] code .diff.add::before { - content: '+'; - color: var(--vp-code-line-diff-add-symbol-color); - transform: translateX(-6px); +.code-tabs-nav { + margin-bottom: 0rem; } // narrow mobile @@ -237,7 +226,3 @@ div[class*='language-'] { margin: 0 -1.5rem -0.85rem; } } - -.hint-container.info pre code { - background-color: transparent; -} diff --git a/theme/src/client/styles/content.scss b/theme/src/client/styles/content.scss index bbc0dbec..8946d105 100644 --- a/theme/src/client/styles/content.scss +++ b/theme/src/client/styles/content.scss @@ -213,44 +213,44 @@ * Custom Block * -------------------------------------------------------------------------- */ -.plume-content .custom-block { - margin: 16px 0; -} +// .plume-content .custom-block { +// margin: 16px 0; +// } -.plume-content .custom-block p { - margin: 8px 0; - line-height: 24px; -} +// .plume-content .custom-block p { +// margin: 8px 0; +// line-height: 24px; +// } -.plume-content .custom-block p:first-child { - margin: 0; -} +// .plume-content .custom-block p:first-child { +// margin: 0; +// } -.plume-content .custom-block a { - color: inherit; - font-weight: 600; - text-decoration: underline; - transition: opacity 0.25s; -} +// .plume-content .custom-block a { +// color: inherit; +// font-weight: 600; +// text-decoration: underline; +// transition: opacity 0.25s; +// } -.plume-content .custom-block a:hover { - opacity: 0.6; -} +// .plume-content .custom-block a:hover { +// opacity: 0.6; +// } -.plume-content .custom-block code { - font-size: var(--vp-custom-block-code-font-size); - font-weight: 700; - color: inherit; -} +// .plume-content .custom-block code { +// font-size: var(--vp-custom-block-code-font-size); +// font-weight: 700; +// color: inherit; +// } -.plume-content .custom-block div[class*='language-'] { - margin: 8px 0; -} +// .plume-content .custom-block div[class*='language-'] { +// margin: 8px 0; +// } -.plume-content .custom-block div[class*='language-'] code { - font-weight: 400; - background-color: transparent; -} +// .plume-content .custom-block div[class*='language-'] code { +// font-weight: 400; +// background-color: transparent; +// } /** * Code diff --git a/theme/src/client/styles/index.scss b/theme/src/client/styles/index.scss index d2404d66..eedffd8c 100644 --- a/theme/src/client/styles/index.scss +++ b/theme/src/client/styles/index.scss @@ -1,11 +1,13 @@ -@use 'vars'; -@use 'fonts'; -@use 'normalize'; -@use 'nprogress'; -@use 'utils'; -@use 'content'; -@use 'code'; -@use 'md-enhance'; -@use 'search'; +@import '@vuepress/plugin-palette/palette'; -@use '@vuepress/plugin-palette/style'; +@import 'vars'; +@import 'fonts'; +@import 'normalize'; +@import 'nprogress'; +@import 'utils'; +@import 'content'; +@import 'code'; +@import 'md-enhance'; +@import 'search'; + +@import '@vuepress/plugin-palette/style'; diff --git a/theme/src/client/styles/md-enhance.scss b/theme/src/client/styles/md-enhance.scss index e0905344..53d8f906 100644 --- a/theme/src/client/styles/md-enhance.scss +++ b/theme/src/client/styles/md-enhance.scss @@ -11,6 +11,24 @@ margin-top: 0; } + p + p { + margin: 8px 0; + } + + code { + font-size: var(--vp-custom-block-code-font-size); + color: inherit; + } + + div[class*='language-'] { + margin: 8px 0; + } + + div[class*='language-'] code { + font-weight: 400; + background-color: transparent; + } + &.note { border-radius: 0; color: var(--vp-c-text-3); @@ -45,21 +63,12 @@ summary + p { margin: 8px 0; } - - } - - p + p { - margin: 8px 0; - } - - code { - font-size: var(--vp-custom-block-code-font-size); } &.note, + &.info, &.tip, - &.detail, - &.important { + &.detail { a, code { color: var(--vp-c-brand-1); @@ -68,6 +77,15 @@ color: var(--vp-c-brand-2); } } + &.important { + a, + code { + color: var(--vp-c-purple-1); + } + a:hover { + color: var(--vp-c-purple-2); + } + } &.warning { a, code { @@ -87,16 +105,10 @@ } } - [class*="language-"] code { - background-color: transparent; - } - - [class*="language-"] .line-numbers { + [class*='language-'] .line-numbers { padding-top: 21px; } - - th, blockquote > p { font-size: var(--vp-custom-block-font-size); @@ -205,7 +217,6 @@ content: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" viewBox="0 0 32 32"%3E%3Cpath fill="%23299764" d="M29.548 3.043a2.5 2.5 0 0 0-3.513.4L16 16.067l-3.508-4.414a2.5 2.5 0 0 0-3.915 3.112l5.465 6.875c.474.597 1.195.943 1.957.943s1.482-.35 1.957-.944L29.95 6.555c.86-1.08.68-2.654-.402-3.513zM24.5 24.5h-17v-17h12.756l2.385-3H6c-.83 0-1.5.67-1.5 1.5v20c0 .828.67 1.5 1.5 1.5h20a1.5 1.5 0 0 0 1.5-1.5V12.85l-3 3.774z"%2F%3E%3C%2Fsvg%3E'); border: none; background-color: transparent; - } } } diff --git a/theme/src/client/styles/normalize.scss b/theme/src/client/styles/normalize.scss index c74c801c..6acd1076 100644 --- a/theme/src/client/styles/normalize.scss +++ b/theme/src/client/styles/normalize.scss @@ -52,7 +52,8 @@ html, body { color: var(--vp-c-text-1); background-color: var(--vp-c-bg); - transition: var(--t-color); + transition-duration: 0.25s; + transition-timing-function: ease; transition-property: color, background-color; } diff --git a/theme/src/client/styles/nprogress.scss b/theme/src/client/styles/nprogress.scss index 2058f4bf..26016ede 100644 --- a/theme/src/client/styles/nprogress.scss +++ b/theme/src/client/styles/nprogress.scss @@ -1,14 +1,14 @@ #nprogress .bar { - background: var(--vp-c-brand); + background: var(--vp-c-brand-1); } #nprogress .spinner-icon { - border-top-color: var(--vp-c-brand); - border-left-color: var(--vp-c-brand); + border-top-color: var(--vp-c-brand-1); + border-left-color: var(--vp-c-brand-1); } #nprogress .peg { box-shadow: - 0 0 10px var(--vp-c-brand), - 0 0 5px var(--vp-c-brand); + 0 0 10px var(--vp-c-brand-1), + 0 0 5px var(--vp-c-brand-1); } diff --git a/theme/src/client/styles/vars.scss b/theme/src/client/styles/vars.scss index eddcd9ac..82004a03 100644 --- a/theme/src/client/styles/vars.scss +++ b/theme/src/client/styles/vars.scss @@ -69,7 +69,10 @@ --vp-c-red-3: #e0575b; --vp-c-red-soft: rgba(244, 63, 94, 0.14); - --vp-c-purple: #f4eefe; + --vp-c-purple-1: #734bb0; + --vp-c-purple-2: #9a72da; + --vp-c-purple-3: #d2c5e7; + --vp-c-purple-soft: rgba(109, 85, 148, 0.14); --vp-c-sponsor: #db2777; } @@ -95,7 +98,10 @@ --vp-c-yellow-3: #a46a0a; --vp-c-yellow-soft: rgba(234, 179, 8, 0.16); - --vp-c-purple: #423655; + --vp-c-purple-1: #9c74da; + --vp-c-purple-2: #a987df; + --vp-c-purple-3: #c3b4da; + --vp-c-purple-soft: rgba(109, 85, 148, 0.16); --vp-c-red-1: #f66f81; --vp-c-red-2: #f14158; @@ -372,15 +378,15 @@ html[lang='zh-CN'] { --vp-button-alt-active-text: var(--vp-c-text-1); --vp-button-alt-active-bg: var(--vp-c-default-1); - --vp-button-sponsor-border: var(--vp-c-text-2); - --vp-button-sponsor-text: var(--vp-c-text-2); - --vp-button-sponsor-bg: transparent; - --vp-button-sponsor-hover-border: var(--vp-c-sponsor); - --vp-button-sponsor-hover-text: var(--vp-c-sponsor); - --vp-button-sponsor-hover-bg: transparent; - --vp-button-sponsor-active-border: var(--vp-c-sponsor); - --vp-button-sponsor-active-text: var(--vp-c-sponsor); - --vp-button-sponsor-active-bg: transparent; + // --vp-button-sponsor-border: var(--vp-c-text-2); + // --vp-button-sponsor-text: var(--vp-c-text-2); + // --vp-button-sponsor-bg: transparent; + // --vp-button-sponsor-hover-border: var(--vp-c-sponsor); + // --vp-button-sponsor-hover-text: var(--vp-c-sponsor); + // --vp-button-sponsor-hover-bg: transparent; + // --vp-button-sponsor-active-border: var(--vp-c-sponsor); + // --vp-button-sponsor-active-text: var(--vp-c-sponsor); + // --vp-button-sponsor-active-bg: transparent; } .dark { @@ -449,7 +455,7 @@ html[lang='zh-CN'] { --vp-nav-height: 0px; } -.hide-nav .VPSidebar { +.hide-nav .sidebar { --vp-nav-height: 22px; } @@ -541,15 +547,15 @@ html[lang='zh-CN'] { * Component: Local Search * -------------------------------------------------------------------------- */ -:root { - --vp-local-search-bg: var(--vp-c-bg); - --vp-local-search-result-bg: var(--vp-c-bg); - --vp-local-search-result-border: var(--vp-c-divider); - --vp-local-search-result-selected-bg: var(--vp-c-bg); - --vp-local-search-result-selected-border: var(--vp-c-brand-1); - --vp-local-search-highlight-bg: var(--vp-c-brand-1); - --vp-local-search-highlight-text: var(--vp-c-neutral-inverse); -} +// :root { +// --vp-local-search-bg: var(--vp-c-bg); +// --vp-local-search-result-bg: var(--vp-c-bg); +// --vp-local-search-result-border: var(--vp-c-divider); +// --vp-local-search-result-selected-bg: var(--vp-c-bg); +// --vp-local-search-result-selected-border: var(--vp-c-brand-1); +// --vp-local-search-highlight-bg: var(--vp-c-brand-1); +// --vp-local-search-highlight-text: var(--vp-c-neutral-inverse); +// } /** Component: Search **/ :root { @@ -580,9 +586,9 @@ html[lang='zh-CN'] { html.dark { /* important */ --important-title-color: var(--vp-c-text-1); - --important-bg-color: var(--vp-c-purple); - --important-border-color: var(--vp-c-purple); - --important-code-bg-color: rgb(163 113 247 / 10%); + --important-bg-color: var(--vp-c-purple-soft); + --important-border-color: transparent; + --important-code-bg-color: var(--vp-c-purple-soft); // info --info-title-color: var(--vp-c-text-1); From aac83e0c14cfd5e4e01ee342125bfebe451fe570 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 2 Jan 2024 00:33:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=89=93=E5=8D=B0=E5=B8=83=E5=B1=80=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- theme/src/client/components/PageFooter.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/theme/src/client/components/PageFooter.vue b/theme/src/client/components/PageFooter.vue index 6ea03911..e5426294 100644 --- a/theme/src/client/components/PageFooter.vue +++ b/theme/src/client/components/PageFooter.vue @@ -100,6 +100,12 @@ const showFooter = computed(() => { color: var(--vp-c-brand-2); } +@media print { + .edit-link-button { + display: none; + } +} + .edit-link-icon { margin-right: 8px; width: 14px; @@ -130,7 +136,7 @@ const showFooter = computed(() => { text-align: left; } -@media (min-width: 768px) { +@media (min-width: 640px) { .contributors { text-align: right; } From c4d9a10efce4241d7e6c8fc42d04da607b22933c Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 2 Jan 2024 00:34:02 +0800 Subject: [PATCH 4/4] style: lint fix --- docs/.vuepress/config.ts | 3 +- docs/2.preview/主题效果预览.md | 30 ++++++++++--------- .../src/client/composables/useBlogPostData.ts | 2 +- plugins/plugin-blog-data/src/node/plugin.ts | 17 ++++------- .../src/client/composables/notesDate.ts | 2 +- plugins/plugin-page-collection/README.md | 2 +- theme/src/client/components/BackToTop.vue | 6 ++-- theme/src/client/components/BlogExtract.vue | 8 +++-- .../src/client/components/Flyout/MenuLink.vue | 4 ++- theme/src/client/components/Flyout/index.vue | 7 +++-- theme/src/client/components/LocalNav.vue | 4 ++- .../components/LocalNavOutlineDropdown.vue | 6 ++-- .../client/components/Nav/NavBarHamburger.vue | 10 +++++-- .../client/components/Nav/NavBarSearch.vue | 16 +++++++--- .../components/Nav/NavScreenMenuGroup.vue | 4 ++- .../components/Nav/NavScreenMenuLink.vue | 4 ++- theme/src/client/components/PageAside.vue | 4 ++- theme/src/client/components/PageMeta.vue | 2 +- theme/src/client/components/Sidebar.vue | 8 +++-- theme/src/client/components/Switch.vue | 4 ++- theme/src/client/components/VButton.vue | 10 +++++-- theme/src/client/components/VFooter.vue | 4 ++- theme/src/client/composables/locale.ts | 18 ++--------- theme/src/client/composables/readingTime.ts | 12 ++++---- theme/src/client/layouts/NotFound.vue | 4 ++- theme/templates/build.html | 22 +++++++------- 26 files changed, 124 insertions(+), 89 deletions(-) diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 2e003178..b60b350d 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -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 { webpackBundler } from '@vuepress/bundler-webpack' import { defineUserConfig } from '@vuepress/cli' diff --git a/docs/2.preview/主题效果预览.md b/docs/2.preview/主题效果预览.md index ff6d8a9a..553b9d5c 100644 --- a/docs/2.preview/主题效果预览.md +++ b/docs/2.preview/主题效果预览.md @@ -167,15 +167,25 @@ function foo() { ``` ::: note 注释 -注释内容 +注释内容 [link](https://github.com/pengzhanbo) `inline code` +```js +const a = 1 +const b = 2 +const c = a + b +``` ::: ::: info 信息 -信息内容 +信息内容 [link](https://github.com/pengzhanbo) `inline code` +```js +const a = 1 +const b = 2 +const c = a + b +``` ::: ::: tip 提示 -提示内容 +提示内容 [link](https://github.com/pengzhanbo) `inline code` ```js const a = 1 const b = 2 @@ -184,7 +194,7 @@ const c = a + b ::: ::: warning 警告 -警告内容 +警告内容 [link](https://github.com/pengzhanbo) `inline code` ```js const a = 1 const b = 2 @@ -193,7 +203,7 @@ const c = a + b ::: ::: caution 错误 -错误内容 +错误内容 [link](https://github.com/pengzhanbo) `inline code` ```js const a = 1 const b = 2 @@ -202,7 +212,7 @@ const c = a + b ::: ::: important 重要 -重要内容 +重要内容 [link](https://github.com/pengzhanbo) `inline code` ```js const a = 1 const b = 2 @@ -210,14 +220,6 @@ const c = a + b ``` ::: -::: info -代码 -```ts -const a = 1 -const b = 2 -``` -::: - **代码演示** diff --git a/plugins/plugin-blog-data/src/client/composables/useBlogPostData.ts b/plugins/plugin-blog-data/src/client/composables/useBlogPostData.ts index b302671f..f146b15a 100644 --- a/plugins/plugin-blog-data/src/client/composables/useBlogPostData.ts +++ b/plugins/plugin-blog-data/src/client/composables/useBlogPostData.ts @@ -15,7 +15,7 @@ export function useBlogPostData< return blogPostData as BlogDataRef } -if (import.meta.webpackHot || import.meta.hot) { +if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) { __VUE_HMR_RUNTIME__.updateBlogData = (data: BlogPostData) => { blogPostData.value = data } diff --git a/plugins/plugin-blog-data/src/node/plugin.ts b/plugins/plugin-blog-data/src/node/plugin.ts index db19a4b6..ab811115 100644 --- a/plugins/plugin-blog-data/src/node/plugin.ts +++ b/plugins/plugin-blog-data/src/node/plugin.ts @@ -34,18 +34,11 @@ export function blogDataPlugin({ ignoreInitial: true, }) - watcher.on( - 'add', - async () => await preparedBlogData(app, pageFilter, pluginOptions), - ) - watcher.on( - 'change', - async () => await preparedBlogData(app, pageFilter, pluginOptions), - ) - watcher.on( - 'unlink', - async () => await preparedBlogData(app, pageFilter, pluginOptions), - ) + const handler = () => preparedBlogData(app, pageFilter, pluginOptions) + + watcher.on('add', handler) + watcher.on('change', handler) + watcher.on('unlink', handler) watchers.push(watcher) }, diff --git a/plugins/plugin-notes-data/src/client/composables/notesDate.ts b/plugins/plugin-notes-data/src/client/composables/notesDate.ts index 372df0fd..bf357409 100644 --- a/plugins/plugin-notes-data/src/client/composables/notesDate.ts +++ b/plugins/plugin-notes-data/src/client/composables/notesDate.ts @@ -15,7 +15,7 @@ export function useNotesData< return notesData as NotesDataRef } -if (import.meta.webpackHot || import.meta.hot) { +if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) { __VUE_HMR_RUNTIME__.updateNotesData = (data: NotesData) => { notesData.value = data } diff --git a/plugins/plugin-page-collection/README.md b/plugins/plugin-page-collection/README.md index 98541a4a..0cc31342 100644 --- a/plugins/plugin-page-collection/README.md +++ b/plugins/plugin-page-collection/README.md @@ -38,7 +38,7 @@ 效果: ``` html - 阅读数:99 +阅读数:99 ``` ## 结构 diff --git a/theme/src/client/components/BackToTop.vue b/theme/src/client/components/BackToTop.vue index e1a71c34..7b2e6d77 100644 --- a/theme/src/client/components/BackToTop.vue +++ b/theme/src/client/components/BackToTop.vue @@ -20,7 +20,7 @@ const isScrolling = ref(false) const progress = computed( () => (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(() => `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); background-color: var(--vp-c-bg); 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, diff --git a/theme/src/client/components/BlogExtract.vue b/theme/src/client/components/BlogExtract.vue index 115ea983..364e0900 100644 --- a/theme/src/client/components/BlogExtract.vue +++ b/theme/src/client/components/BlogExtract.vue @@ -146,13 +146,17 @@ const showBlogExtract = computed(() => { background-color: var(--vp-c-bg); border-top-left-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%); transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1); } .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 { diff --git a/theme/src/client/components/Flyout/MenuLink.vue b/theme/src/client/components/Flyout/MenuLink.vue index 2edfbd0b..a50f24ee 100644 --- a/theme/src/client/components/Flyout/MenuLink.vue +++ b/theme/src/client/components/Flyout/MenuLink.vue @@ -44,7 +44,9 @@ const page = usePageData() font-weight: 500; color: var(--vp-c-text-1); white-space: nowrap; - transition: background-color 0.25s, color 0.25s; + transition: + background-color 0.25s, + color 0.25s; } .link:hover { diff --git a/theme/src/client/components/Flyout/index.vue b/theme/src/client/components/Flyout/index.vue index bb50e609..af98edc1 100644 --- a/theme/src/client/components/Flyout/index.vue +++ b/theme/src/client/components/Flyout/index.vue @@ -66,11 +66,11 @@ export default { diff --git a/theme/src/client/components/LocalNav.vue b/theme/src/client/components/LocalNav.vue index 024eced5..29a4a7ca 100644 --- a/theme/src/client/components/LocalNav.vue +++ b/theme/src/client/components/LocalNav.vue @@ -82,7 +82,9 @@ const showLocalNav = computed(() => { padding-top: var(--vp-layout-top-height, 0px); width: 100%; 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 { diff --git a/theme/src/client/components/LocalNavOutlineDropdown.vue b/theme/src/client/components/LocalNavOutlineDropdown.vue index 7e9841e8..d37c79c5 100644 --- a/theme/src/client/components/LocalNavOutlineDropdown.vue +++ b/theme/src/client/components/LocalNavOutlineDropdown.vue @@ -110,7 +110,7 @@ function scrollToTop() { padding: 2px 0; } -.open>.icon { +.open > .icon { transform: rotate(90deg); } @@ -148,11 +148,11 @@ function scrollToTop() { } .flyout-enter-active { - transition: all .2s ease-out; + transition: all 0.2s ease-out; } .flyout-leave-active { - transition: all .15s ease-in; + transition: all 0.15s ease-in; } .flyout-enter-from, diff --git a/theme/src/client/components/Nav/NavBarHamburger.vue b/theme/src/client/components/Nav/NavBarHamburger.vue index 1073b423..45f6809b 100644 --- a/theme/src/client/components/Nav/NavBarHamburger.vue +++ b/theme/src/client/components/Nav/NavBarHamburger.vue @@ -83,7 +83,10 @@ defineEmits<(e: 'click') => void>() .navbar-hamburger.active:hover .middle, .navbar-hamburger.active:hover .bottom { 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, @@ -93,7 +96,10 @@ defineEmits<(e: 'click') => void>() width: 16px; height: 2px; 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 { diff --git a/theme/src/client/components/Nav/NavBarSearch.vue b/theme/src/client/components/Nav/NavBarSearch.vue index 6034c418..aeec97b6 100644 --- a/theme/src/client/components/Nav/NavBarSearch.vue +++ b/theme/src/client/components/Nav/NavBarSearch.vue @@ -23,6 +23,12 @@ } } +@media print { + .navbar-search { + display: none; + } +} + /* plugin-docsearch */ .DocSearch { --docsearch-primary-color: var(--vp-c-brand-1); @@ -73,8 +79,8 @@ } .navbar-search #docsearch-container { - min-width: 32px; - } + min-width: 32px; +} @media (min-width: 768px) { .navbar-search .DocSearch-Button { @@ -171,7 +177,9 @@ font-family: var(--vp-font-family-base); font-size: 12px; 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 { @@ -217,7 +225,7 @@ /* plugin-search */ .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; } /* plugin-search */ diff --git a/theme/src/client/components/Nav/NavScreenMenuGroup.vue b/theme/src/client/components/Nav/NavScreenMenuGroup.vue index 9be6f87a..f40608e3 100644 --- a/theme/src/client/components/Nav/NavScreenMenuGroup.vue +++ b/theme/src/client/components/Nav/NavScreenMenuGroup.vue @@ -114,7 +114,9 @@ function toggle() { width: 14px; height: 14px; fill: var(--vp-c-text-2); - transition: fill 0.5s, transform 0.25s; + transition: + fill 0.5s, + transform 0.25s; } .group:first-child { diff --git a/theme/src/client/components/Nav/NavScreenMenuLink.vue b/theme/src/client/components/Nav/NavScreenMenuLink.vue index 8c0c85bd..e7e6522c 100644 --- a/theme/src/client/components/Nav/NavScreenMenuLink.vue +++ b/theme/src/client/components/Nav/NavScreenMenuLink.vue @@ -27,7 +27,9 @@ const closeScreen = inject('close-screen') as () => void font-size: 14px; font-weight: 500; 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 { diff --git a/theme/src/client/components/PageAside.vue b/theme/src/client/components/PageAside.vue index 5d1d4a50..9dcce554 100644 --- a/theme/src/client/components/PageAside.vue +++ b/theme/src/client/components/PageAside.vue @@ -96,7 +96,9 @@ function handlePrint() { width: 2px; height: 18px; 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; } diff --git a/theme/src/client/components/PageMeta.vue b/theme/src/client/components/PageMeta.vue index 6ea516cb..ff9f9b7d 100644 --- a/theme/src/client/components/PageMeta.vue +++ b/theme/src/client/components/PageMeta.vue @@ -140,7 +140,7 @@ const hasMeta = computed(() => readingTime.value.times || tags.value.length || c } .page-meta-wrapper .reading-time span { - margin-right: 0.5rem; + margin-right: 8px; } .page-meta-wrapper .reading-time span:last-of-type { diff --git a/theme/src/client/components/Sidebar.vue b/theme/src/client/components/Sidebar.vue index 7265f8c1..91789ccc 100644 --- a/theme/src/client/components/Sidebar.vue +++ b/theme/src/client/components/Sidebar.vue @@ -71,14 +71,18 @@ watch( overflow-x: hidden; overflow-y: auto; 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 { opacity: 1; visibility: visible; 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 { diff --git a/theme/src/client/components/Switch.vue b/theme/src/client/components/Switch.vue index 690d0424..6d997e03 100644 --- a/theme/src/client/components/Switch.vue +++ b/theme/src/client/components/Switch.vue @@ -18,7 +18,9 @@ flex-shrink: 0; border: 1px solid var(--vp-input-border-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 { diff --git a/theme/src/client/components/VButton.vue b/theme/src/client/components/VButton.vue index c674fa0a..3b902243 100644 --- a/theme/src/client/components/VButton.vue +++ b/theme/src/client/components/VButton.vue @@ -56,11 +56,17 @@ function linkTo(e: Event) { text-align: center; font-weight: 600; 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 { - 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 { diff --git a/theme/src/client/components/VFooter.vue b/theme/src/client/components/VFooter.vue index 4c6009ff..2b45dec2 100644 --- a/theme/src/client/components/VFooter.vue +++ b/theme/src/client/components/VFooter.vue @@ -44,7 +44,9 @@ const { hasSidebar } = useSidebar() .plume-footer :deep(a) { text-decoration-line: underline; text-underline-offset: 2px; - transition: color, text-underline-offset 0.25s; + transition: + color, + text-underline-offset 0.25s; } .plume-footer :deep(a:hover) { diff --git a/theme/src/client/composables/locale.ts b/theme/src/client/composables/locale.ts index b59730db..250e51ad 100644 --- a/theme/src/client/composables/locale.ts +++ b/theme/src/client/composables/locale.ts @@ -1,23 +1,11 @@ -import { usePageLang, useSiteData } from '@vuepress/client' +import { useRouteLocale } from '@vuepress/client' import { computed } from 'vue' import { normalizeLink } from '../utils' export function useLocaleLink(link: string) { - const site = useSiteData() - const locale = usePageLang() - - const links = computed(() => { - const locales = site.value.locales - const links: Record = {} - Object.keys(locales).forEach((key) => { - const locale = locales[key] - locale.lang && (links[locale.lang] = key) - }) - return links - }) + const prefix = useRouteLocale() return computed(() => { - const prefix = links.value[locale.value] || '/' - return normalizeLink(prefix + link) + return normalizeLink(prefix.value + link) }) } diff --git a/theme/src/client/composables/readingTime.ts b/theme/src/client/composables/readingTime.ts index dd0489b9..8df4b944 100644 --- a/theme/src/client/composables/readingTime.ts +++ b/theme/src/client/composables/readingTime.ts @@ -15,15 +15,15 @@ export const readingTimeLocales = { }, 'zh-CN': { - word: '约 $word 字', - less1Minute: '小于 1 分钟', - time: '大约 $time 分钟', + word: '约$word字', + less1Minute: '小于1分钟', + time: '大约$time分钟', }, 'zh-TW': { - word: '約 $word 字', - less1Minute: '小於 1 分鐘', - time: '大约 $time 分鐘', + word: '約$word字', + less1Minute: '小於1分鐘', + time: '大约$time分鐘', }, 'de': { diff --git a/theme/src/client/layouts/NotFound.vue b/theme/src/client/layouts/NotFound.vue index afab378b..0be90c63 100644 --- a/theme/src/client/layouts/NotFound.vue +++ b/theme/src/client/layouts/NotFound.vue @@ -94,7 +94,9 @@ const themeData = useThemeLocaleData() font-size: 14px; font-weight: 500; color: var(--vp-c-brand); - transition: border-color 0.25s, color 0.25s; + transition: + border-color 0.25s, + color 0.25s; } .link:hover { diff --git a/theme/templates/build.html b/theme/templates/build.html index c804a1d0..e71f0de1 100644 --- a/theme/templates/build.html +++ b/theme/templates/build.html @@ -1,18 +1,20 @@ - + - - - - + + + +