From 855853c724ab1b5c13b8f1169355d00ac27d7b9b Mon Sep 17 00:00:00 2001 From: Ahoo Wang Date: Tue, 7 Jan 2025 10:06:52 +0800 Subject: [PATCH] docs(documentation): upgrade VitePress and add medium-zoom - Upgrade VitePress from 1.0.0-rc.34 to 1.5.0 - Add medium-zoom dependency for image zoom functionality - Create global.css file for custom styling - Implement mediumZoom in theme setup for image zoom --- .../docs/.vitepress/theme/global.css | 16 +++++++++ documentation/docs/.vitepress/theme/index.ts | 35 +++++++++++++++++++ documentation/package-lock.json | 14 ++++++-- documentation/package.json | 7 ++-- 4 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 documentation/docs/.vitepress/theme/global.css create mode 100644 documentation/docs/.vitepress/theme/index.ts diff --git a/documentation/docs/.vitepress/theme/global.css b/documentation/docs/.vitepress/theme/global.css new file mode 100644 index 00000000000..91a7598c334 --- /dev/null +++ b/documentation/docs/.vitepress/theme/global.css @@ -0,0 +1,16 @@ +/* + * Copyright [2021-present] [ahoo wang (https://github.com/Ahoo-Wang)]. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.medium-zoom-image { + z-index: 9999 !important; +} \ No newline at end of file diff --git a/documentation/docs/.vitepress/theme/index.ts b/documentation/docs/.vitepress/theme/index.ts new file mode 100644 index 00000000000..f7f33adc81d --- /dev/null +++ b/documentation/docs/.vitepress/theme/index.ts @@ -0,0 +1,35 @@ +/* + * Copyright [2021-present] [ahoo wang (https://github.com/Ahoo-Wang)]. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DefaultTheme from 'vitepress/theme' +import { onMounted, watch, nextTick } from 'vue' +import { useRoute } from 'vitepress' +import mediumZoom from 'medium-zoom' +import './global.css' + +export default { + ...DefaultTheme, + setup() { + const route = useRoute() + const initZoom = () => { + mediumZoom('.main img', { background: 'var(--vp-c-bg)' }) + } + onMounted(() => { + initZoom() + }) + watch( + () => route.path, + () => nextTick(() => initZoom()) + ) + }, +} \ No newline at end of file diff --git a/documentation/package-lock.json b/documentation/package-lock.json index 125028e11f8..54a42c1121a 100644 --- a/documentation/package-lock.json +++ b/documentation/package-lock.json @@ -1,15 +1,18 @@ { "name": "documentation", - "version": "3.0.0", + "version": "5.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "documentation", - "version": "3.0.0", + "version": "5.0.0", "license": "Apache-2.0", + "dependencies": { + "medium-zoom": "^1.1.0" + }, "devDependencies": { - "vitepress": "^1.0.0-rc.34" + "vitepress": "^1.5.0" } }, "node_modules/@algolia/autocomplete-core": { @@ -1935,6 +1938,11 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/medium-zoom": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/medium-zoom/-/medium-zoom-1.1.0.tgz", + "integrity": "sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==" + }, "node_modules/micromark-util-character": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.0.tgz", diff --git a/documentation/package.json b/documentation/package.json index 071024552cf..07d4da0b805 100644 --- a/documentation/package.json +++ b/documentation/package.json @@ -1,6 +1,6 @@ { "name": "documentation", - "version": "3.0.0", + "version": "5.0.0", "description": "领域模型即服务 | Modern Reactive CQRS Architecture Microservice development framework based on DDD and EventSourcing.", "main": "index.js", "scripts": { @@ -20,6 +20,9 @@ "author": "ahoo-wang", "license": "Apache-2.0", "devDependencies": { - "vitepress": "^1.0.0-rc.34" + "vitepress": "^1.5.0" + }, + "dependencies": { + "medium-zoom": "^1.1.0" } }