添加 API 速查文档和相关数据,更新导航以支持新页面

This commit is contained in:
boybook
2025-03-26 17:14:19 +08:00
parent 5382f625fc
commit 7f56fbdb06
11 changed files with 40076 additions and 0 deletions

38722
api-index.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -60,6 +60,7 @@ export default withMermaid({
nav: [ nav: [
{ text: '首页', link: '/' }, { text: '首页', link: '/' },
{ text: 'Wiki', link: '/wiki', activeMatch: '^/wiki/' }, { text: 'Wiki', link: '/wiki', activeMatch: '^/wiki/' },
{ text: 'API速查', link: '/api-tools/interface', activeMatch: '^/api-tools/' },
{ text: 'API文档', link: '/mcdocs/0-欢迎', activeMatch: '^/mcdocs/' }, { text: 'API文档', link: '/mcdocs/0-欢迎', activeMatch: '^/mcdocs/' },
{ text: '开发指南', link: '/mcguide/0-欢迎', activeMatch: '^/mcguide/' }, { text: '开发指南', link: '/mcguide/0-欢迎', activeMatch: '^/mcguide/' },
{ text: '教学课程', link: '/mconline/0-欢迎', activeMatch: '^/mconline/' }, { text: '教学课程', link: '/mconline/0-欢迎', activeMatch: '^/mconline/' },

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,5 @@
import Layout from './layout/Layout.vue'
import DefaultTheme from 'vitepress/theme' import DefaultTheme from 'vitepress/theme'
import MyFeatures from './components/MyFeatures.vue' import MyFeatures from './components/MyFeatures.vue'
import CodeHeader from './components/content/CodeHeader.vue' import CodeHeader from './components/content/CodeHeader.vue'
@@ -5,10 +7,15 @@ import WikiImage from './components/content/WikiImage.vue'
import Button from './components/content/Button.vue' import Button from './components/content/Button.vue'
import FolderView from './components/content/FolderView/FolderView.vue' import FolderView from './components/content/FolderView/FolderView.vue'
import Checklist from './components/content/Checklist.vue' import Checklist from './components/content/Checklist.vue'
import ApiTable from './components/ApiTable.vue'
import './style.css';
export default { export default {
extends: DefaultTheme, extends: DefaultTheme,
Layout: Layout,
enhanceApp({ app }) { enhanceApp({ app }) {
app.component('ApiTable', ApiTable);
app.component('MyFeatures', MyFeatures); app.component('MyFeatures', MyFeatures);
app.component('CodeHeader', CodeHeader); app.component('CodeHeader', CodeHeader);
app.component('WikiImage', WikiImage); app.component('WikiImage', WikiImage);

View File

@@ -0,0 +1,32 @@
<script setup>
import { useRoute } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { computed } from 'vue'
const route = useRoute()
// 需要全宽的路由匹配规则(支持 glob 模式)
const fullWidthRoutes = [
'/api-tools/(.*)' // 正则匹配
]
// 动态计算 class
const layoutClass = computed(() => {
return fullWidthRoutes.some(pattern =>
new RegExp(
pattern
.replace(/\*/g, '.*')
.replace(/\//g, '\\/')
).test(route.path)
) ? 'vp-full-width' : ''
})
</script>
<template>
<div
class="vp-theme-container"
:class="layoutClass"
>
<DefaultTheme.Layout />
</div>
</template>

View File

@@ -0,0 +1,21 @@
/* 全宽模式下的变量覆盖 */
.vp-full-width {
--vp-layout-max-width: 100% !important;
--vp-sidebar-bg-color: var(--vp-bg-color) !important;
--vp-sidebar-width: 200px !important;
/*var(--vp-c-bg-alt)*/
--vp-sidebar-bg-color: var(--vp-bg-color) !important;
}
/* 全宽模式下的额外样式 */
.vp-full-width .VPDoc.has-aside .content-container {
max-width: none !important;
}
.vp-full-width .VPDoc.has-aside .aside {
display: none !important;
}
.vp-full-width .VPDoc {
background-color: var(--vp-c-bg-alt);
}

11
docs/api-tools/events.md Normal file
View File

@@ -0,0 +1,11 @@
---
title: ⛹️‍♂️ 事件速查
prev: false
next: false
---
<script setup>
import { data } from '../mcdocs/1-ModAPI/events.data.js'
</script>
<ApiTable class="custom-component" :apiData="data" :autoHideReturn="true" />

View File

@@ -0,0 +1,11 @@
---
title: 🔌 接口速查
prev: false
next: false
---
<script setup>
import { data } from '../mcdocs/1-ModAPI/interface.data.js'
</script>
<ApiTable class="custom-component" :apiData="data" />

View File

@@ -10,6 +10,9 @@ hero:
- theme: brand - theme: brand
text: 开始 text: 开始
link: /wiki link: /wiki
- theme: alt
text: API 速查
link: /api-tools/events
features: features:
- icon: 🎯 - icon: 🎯

View File

@@ -0,0 +1,7 @@
const file = require('./events.json');
export default {
load() {
return file;
}
}

View File

@@ -0,0 +1,7 @@
const file = require('./interface.json');
export default {
load() {
return file;
}
}