chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,232 @@
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, onUnmounted, ref } from 'vue'
|
||||
|
||||
const MIN = 0.3
|
||||
const MAX = 8
|
||||
|
||||
const open = ref(false)
|
||||
const scale = ref(1)
|
||||
const tx = ref(0)
|
||||
const ty = ref(0)
|
||||
const stage = ref<HTMLElement>()
|
||||
|
||||
let dragging = false
|
||||
let originX = 0
|
||||
let originY = 0
|
||||
|
||||
function reset() {
|
||||
scale.value = 1
|
||||
tx.value = 0
|
||||
ty.value = 0
|
||||
}
|
||||
|
||||
function close() {
|
||||
open.value = false
|
||||
document.documentElement.style.removeProperty('overflow')
|
||||
}
|
||||
|
||||
async function show(source: SVGElement) {
|
||||
reset()
|
||||
open.value = true
|
||||
document.documentElement.style.overflow = 'hidden'
|
||||
await nextTick()
|
||||
const host = stage.value
|
||||
if (!host) return
|
||||
host.replaceChildren()
|
||||
|
||||
// mermaid 的 svg 内联样式以 #id 作用域,且插件会对同 id 元素重新渲染,
|
||||
// 因此副本必须换一个 id 并同步改写内部样式表
|
||||
const clone = source.cloneNode(true) as SVGElement
|
||||
const oldId = source.id
|
||||
if (oldId) {
|
||||
const newId = `${oldId}-zoom`
|
||||
clone.id = newId
|
||||
clone.querySelectorAll('style').forEach((s) => {
|
||||
s.textContent = (s.textContent ?? '').split(`#${oldId}`).join(`#${newId}`)
|
||||
})
|
||||
}
|
||||
clone.removeAttribute('width')
|
||||
clone.removeAttribute('height')
|
||||
clone.style.maxWidth = 'none'
|
||||
clone.style.width = '100%'
|
||||
clone.style.height = '100%'
|
||||
host.appendChild(clone)
|
||||
}
|
||||
|
||||
function onDocClick(e: MouseEvent) {
|
||||
const block = (e.target as HTMLElement | null)?.closest?.('.vp-doc .mermaid')
|
||||
if (!block) return
|
||||
const svg = block.querySelector('svg')
|
||||
if (svg) show(svg as SVGElement)
|
||||
}
|
||||
|
||||
function onKey(e: KeyboardEvent) {
|
||||
if (!open.value) return
|
||||
if (e.key === 'Escape') close()
|
||||
if (e.key === '0') reset()
|
||||
}
|
||||
|
||||
function zoomBy(factor: number) {
|
||||
scale.value = Math.min(MAX, Math.max(MIN, scale.value * factor))
|
||||
}
|
||||
|
||||
function onWheel(e: WheelEvent) {
|
||||
e.preventDefault()
|
||||
zoomBy(e.deltaY < 0 ? 1.12 : 1 / 1.12)
|
||||
}
|
||||
|
||||
function onDown(e: MouseEvent) {
|
||||
dragging = true
|
||||
originX = e.clientX - tx.value
|
||||
originY = e.clientY - ty.value
|
||||
}
|
||||
|
||||
function onMove(e: MouseEvent) {
|
||||
if (!dragging) return
|
||||
tx.value = e.clientX - originX
|
||||
ty.value = e.clientY - originY
|
||||
}
|
||||
|
||||
function onUp() {
|
||||
dragging = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener('click', onDocClick)
|
||||
document.addEventListener('keydown', onKey)
|
||||
window.addEventListener('mousemove', onMove)
|
||||
window.addEventListener('mouseup', onUp)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('click', onDocClick)
|
||||
document.removeEventListener('keydown', onKey)
|
||||
window.removeEventListener('mousemove', onMove)
|
||||
window.removeEventListener('mouseup', onUp)
|
||||
document.documentElement.style.removeProperty('overflow')
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="zoom-fade">
|
||||
<div v-if="open" class="zoom" @wheel="onWheel" @mousedown.self="close">
|
||||
<div
|
||||
ref="stage"
|
||||
class="zoom-stage"
|
||||
:style="{ transform: `translate(${tx}px, ${ty}px) scale(${scale})` }"
|
||||
@mousedown.stop="onDown"
|
||||
/>
|
||||
|
||||
<div class="zoom-bar" @mousedown.stop>
|
||||
<button title="缩小" @click="zoomBy(1 / 1.35)">−</button>
|
||||
<span class="zoom-level">{{ Math.round(scale * 100) }}%</span>
|
||||
<button title="放大" @click="zoomBy(1.35)">+</button>
|
||||
<span class="zoom-sep" />
|
||||
<button class="zoom-word" @click="reset">重置</button>
|
||||
<button class="zoom-word" @click="close">关闭</button>
|
||||
</div>
|
||||
|
||||
<p class="zoom-hint">滚轮缩放 · 拖拽平移 · Esc 关闭</p>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.zoom {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--wk-paper);
|
||||
cursor: zoom-out;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.zoom-stage {
|
||||
width: min(1400px, 88vw);
|
||||
height: 82vh;
|
||||
cursor: grab;
|
||||
transform-origin: center center;
|
||||
}
|
||||
|
||||
.zoom-stage:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.zoom-bar {
|
||||
position: fixed;
|
||||
bottom: 28px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 6px 8px;
|
||||
border: 1px solid var(--wk-rule);
|
||||
border-radius: 3px;
|
||||
background: var(--wk-paper);
|
||||
box-shadow: 0 6px 22px rgba(16, 31, 56, 0.08);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.zoom-bar button {
|
||||
min-width: 30px;
|
||||
height: 28px;
|
||||
padding: 0 8px;
|
||||
border-radius: 2px;
|
||||
font-size: 15px;
|
||||
line-height: 1;
|
||||
color: var(--wk-ink-soft);
|
||||
transition: background-color 0.18s ease, color 0.18s ease;
|
||||
}
|
||||
|
||||
.zoom-bar button:hover {
|
||||
background: var(--wk-paper-2);
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.zoom-word {
|
||||
font-size: 12.5px !important;
|
||||
}
|
||||
|
||||
.zoom-level {
|
||||
min-width: 46px;
|
||||
text-align: center;
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 11px;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.zoom-sep {
|
||||
width: 1px;
|
||||
height: 16px;
|
||||
margin: 0 4px;
|
||||
background: var(--wk-rule);
|
||||
}
|
||||
|
||||
.zoom-hint {
|
||||
position: fixed;
|
||||
top: 26px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
margin: 0;
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.14em;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.zoom-fade-enter-active,
|
||||
.zoom-fade-leave-active {
|
||||
transition: opacity 0.18s ease;
|
||||
}
|
||||
|
||||
.zoom-fade-enter-from,
|
||||
.zoom-fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,113 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { useData, withBase } from 'vitepress'
|
||||
|
||||
const props = defineProps<{
|
||||
/** 相对站点根的图片路径,约定放在 public/screenshots/ 下 */
|
||||
src: string
|
||||
/** 图注:说明这张图展示的是什么 */
|
||||
caption: string
|
||||
/** 补充说明:截图应覆盖哪些界面元素,供补图的人参考 */
|
||||
hint?: string
|
||||
}>()
|
||||
|
||||
const { theme } = useData()
|
||||
const size = computed(() => theme.value.academyScreenshotSizes?.[props.src])
|
||||
const failed = ref(false)
|
||||
const resolved = computed(() => withBase(props.src))
|
||||
watch(resolved, () => { failed.value = false })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<figure class="wk-shot">
|
||||
<div class="wk-shot-media" :style="size ? { aspectRatio: `${size.width} / ${size.height}` } : undefined">
|
||||
<img
|
||||
v-if="size && !failed"
|
||||
class="wk-shot-img"
|
||||
:src="resolved"
|
||||
:alt="caption"
|
||||
:width="size.width"
|
||||
:height="size.height"
|
||||
@error="failed = true"
|
||||
/>
|
||||
<div v-else class="wk-shot-placeholder" :class="{ 'wk-shot-placeholder-sized': size }">
|
||||
<div class="wk-shot-placeholder-badge">{{ failed ? '图片加载失败' : '截图待补充' }}</div>
|
||||
<div class="wk-shot-placeholder-caption">{{ caption }}</div>
|
||||
<p v-if="hint" class="wk-shot-placeholder-hint">{{ hint }}</p>
|
||||
<code class="wk-shot-placeholder-path">website-docs/public{{ src }}</code>
|
||||
</div>
|
||||
</div>
|
||||
<figcaption class="wk-shot-caption">{{ caption }}</figcaption>
|
||||
</figure>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.wk-shot {
|
||||
margin: 24px 0;
|
||||
}
|
||||
|
||||
.wk-shot-media { position: relative; }
|
||||
|
||||
.wk-shot-placeholder-sized {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
justify-content: center;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.wk-shot-img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.wk-shot-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 32px 24px;
|
||||
text-align: center;
|
||||
border: 1px dashed var(--vp-c-divider);
|
||||
border-radius: 10px;
|
||||
background: var(--vp-c-bg-soft);
|
||||
}
|
||||
|
||||
.wk-shot-placeholder-badge {
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: var(--vp-c-text-2);
|
||||
background: var(--vp-c-default-soft);
|
||||
}
|
||||
|
||||
.wk-shot-placeholder-caption {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.wk-shot-placeholder-hint {
|
||||
max-width: 46em;
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.7;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.wk-shot-placeholder-path {
|
||||
font-size: 12px;
|
||||
color: var(--vp-c-text-3);
|
||||
}
|
||||
|
||||
.wk-shot-caption {
|
||||
margin-top: 8px;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
text-align: center;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, ref, watch } from 'vue'
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const { page } = useData()
|
||||
const label = ref<HTMLElement>()
|
||||
|
||||
async function revealCurrentPage() {
|
||||
// Wait for VitePress to mark the current link and expand its section.
|
||||
await nextTick()
|
||||
const sidebar = label.value?.closest<HTMLElement>('.VPSidebar')
|
||||
const active = sidebar?.querySelector<HTMLElement>('.VPSidebarItem.is-active > .item > a')
|
||||
if (!sidebar || !active) return
|
||||
|
||||
const bounds = sidebar.getBoundingClientRect()
|
||||
const item = active.getBoundingClientRect()
|
||||
const curtain = sidebar.querySelector<HTMLElement>('.curtain')?.getBoundingClientRect()
|
||||
const top = Math.max(bounds.top, curtain?.bottom ?? bounds.top) + 16
|
||||
const bottom = bounds.bottom - 16
|
||||
if (item.top >= top && item.bottom <= bottom) return
|
||||
|
||||
// Move only the sidebar; scrollIntoView could also move the document body.
|
||||
sidebar.scrollTop += item.top - (top + (bottom - top - item.height) / 2)
|
||||
}
|
||||
|
||||
onMounted(revealCurrentPage)
|
||||
watch(() => page.value.relativePath, revealCurrentPage, { flush: 'post' })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<p ref="label" class="wk-docs-label">使用文档</p>
|
||||
</template>
|
||||
@@ -0,0 +1,43 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, h, ref, watch, onMounted, onUnmounted } from 'vue'
|
||||
import { useData, useRoute } from 'vitepress'
|
||||
import Search from 'vitepress/dist/client/theme-default/components/VPNavBarSearch.vue'
|
||||
import { repositoryUrl, headerIcons, homeAssets } from '../../shared/header'
|
||||
const { isDark } = useData()
|
||||
const route = useRoute()
|
||||
const docsNavigation = [
|
||||
{ label: '快速开始', href: '/docs/01-getting-started/03-quickstart', section: '/docs/01-getting-started/' },
|
||||
{ label: '架构', href: '/docs/02-architecture/01-overview', section: '/docs/02-architecture/' },
|
||||
{ label: '功能', href: '/docs/03-features/01-tenant-auth', section: '/docs/03-features/' },
|
||||
{ label: 'API', href: '/docs/04-api/01-api-overview', section: '/docs/04-api/' },
|
||||
{ label: '客户端', href: '/docs/05-clients/01-frontend', section: '/docs/05-clients/' },
|
||||
{ label: '开发', href: '/docs/06-development/01-dev-guide', section: '/docs/06-development/' },
|
||||
{ label: '版本', href: '/docs/07-releases/v0.8.3', section: '/docs/07-releases/' },
|
||||
]
|
||||
const open = ref(false)
|
||||
watch(() => route.path, () => open.value = false)
|
||||
const menu = ref<HTMLButtonElement>()
|
||||
const label = computed(() => isDark.value ? '切换到浅色' : '切换到深色')
|
||||
const HeaderIcon = (props: { name: string }) => h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'stroke-width': 1.4, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true' }, [h('path', { d: headerIcons[props.name] })])
|
||||
function closeMenu(event: KeyboardEvent) {
|
||||
if (event.key === 'Escape' && open.value) { open.value = false; menu.value?.focus() }
|
||||
}
|
||||
onMounted(() => document.addEventListener('keydown', closeMenu))
|
||||
onUnmounted(() => document.removeEventListener('keydown', closeMenu))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="wk-header wk-docs-header">
|
||||
<div class="wk-header-inner">
|
||||
<a class="wk-brand" href="/" target="_self" aria-label="Academy 首页"><span class="wk-logo"><img :src="`${homeAssets}/brand/academy-original.png`" alt="Academy" width="945" height="650"></span></a>
|
||||
<nav id="main-navigation" class="wk-navigation" :class="{ 'is-open': open }" aria-label="文档导航">
|
||||
<a v-for="item in docsNavigation" :key="item.href" :href="item.href" :aria-current="route.path.startsWith(item.section) ? 'page' : undefined" @click="open = false">{{ item.label }}</a>
|
||||
<div class="wk-header-search"><Search /></div>
|
||||
<a class="wk-mobile-github" :href="repositoryUrl" target="_blank" rel="noreferrer">GitHub <HeaderIcon name="external" /></a>
|
||||
</nav>
|
||||
<button class="wk-theme-toggle" type="button" role="switch" :aria-checked="isDark" :aria-label="label" :title="label" @click="isDark = !isDark"><HeaderIcon :name="isDark ? 'moon' : 'sun'" /></button>
|
||||
<a class="wk-header-github" :href="repositoryUrl" target="_blank" rel="noreferrer"><HeaderIcon name="github" /><span>GitHub</span></a>
|
||||
<button ref="menu" class="wk-menu-toggle" type="button" :aria-label="open ? '关闭导航' : '打开导航'" :aria-expanded="open" aria-controls="main-navigation" @click="open = !open"><HeaderIcon :name="open ? 'close' : 'menu'" /></button>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
import { h } from 'vue'
|
||||
import type { Theme } from 'vitepress'
|
||||
import DefaultTheme from 'vitepress/theme-without-fonts'
|
||||
import SiteHeader from './SiteHeader.vue'
|
||||
import SidebarNavigationSync from './SidebarNavigationSync.vue'
|
||||
import MermaidZoom from './MermaidZoom.vue'
|
||||
import Screenshot from './Screenshot.vue'
|
||||
import './style.css'
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme,
|
||||
Layout: () => h(DefaultTheme.Layout, null, {
|
||||
'layout-bottom': () => h(MermaidZoom),
|
||||
'layout-top': () => h(SiteHeader),
|
||||
'sidebar-nav-before': () => h(SidebarNavigationSync),
|
||||
}),
|
||||
enhanceApp({ app }) {
|
||||
app.component('Screenshot', Screenshot)
|
||||
},
|
||||
} satisfies Theme
|
||||
@@ -0,0 +1,662 @@
|
||||
@import '../../shared/brand.css';
|
||||
@import '../../shared/header.css';
|
||||
|
||||
/* ==========================================================================
|
||||
Academy 文档站主题
|
||||
墨蓝(logo 主色)· 纸白 · 鎏金(帆浪点缀)
|
||||
========================================================================== */
|
||||
|
||||
:root {
|
||||
|
||||
|
||||
/* —— 覆盖 VitePress 默认变量 —— */
|
||||
--vp-font-family-base: var(--wk-font-sans);
|
||||
--vp-font-family-mono: var(--wk-font-mono);
|
||||
|
||||
--vp-c-brand-1: var(--wk-ink);
|
||||
--vp-c-brand-2: #24395a;
|
||||
--vp-c-brand-3: var(--wk-gold);
|
||||
--vp-c-brand-soft: rgba(184, 134, 59, 0.14);
|
||||
|
||||
--vp-c-bg: var(--wk-paper);
|
||||
--vp-c-bg-alt: var(--wk-paper-2);
|
||||
--vp-c-bg-soft: var(--wk-paper-2);
|
||||
--vp-c-bg-elv: #ffffff;
|
||||
|
||||
--vp-c-text-1: var(--wk-ink);
|
||||
--vp-c-text-2: var(--wk-ink-soft);
|
||||
--vp-c-text-3: var(--wk-ink-mute);
|
||||
|
||||
--vp-c-divider: var(--wk-rule);
|
||||
--vp-c-gutter: var(--wk-rule);
|
||||
--vp-c-border: var(--wk-rule);
|
||||
|
||||
/* 铺满视口。默认主题用这个值给 .VPContent 算左右内边距
|
||||
(padding-right: (100vw - max-width) / 2),任何小于视口的定值都会在两侧留出
|
||||
大片空白;给一个大于视口的定值又会让左内边距被钳到 0、正文钻到侧栏底下。
|
||||
取 100vw 时右侧内边距为 0、左侧正好等于侧栏宽度。 */
|
||||
--vp-layout-max-width: 100vw;
|
||||
--vp-nav-height: 64px;
|
||||
--vp-sidebar-width: 288px;
|
||||
--vp-code-block-bg: #fbf9f5;
|
||||
|
||||
--vp-home-hero-name-color: var(--wk-ink);
|
||||
--vp-code-copy-copied-text-content: "已复制";
|
||||
}
|
||||
|
||||
.dark {
|
||||
|
||||
--vp-c-brand-1: #e6ecf5;
|
||||
--vp-c-brand-2: #c3d0e2;
|
||||
--vp-c-brand-3: var(--wk-gold);
|
||||
--vp-c-bg-elv: #101a2b;
|
||||
--vp-code-block-bg: #0d1626;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-feature-settings: "kern" 1, "liga" 1, "cv05" 1;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background: rgba(184, 134, 59, 0.22);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
侧边栏
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
/* 默认公式在视口窄于 layout-max-width 时会把侧栏压窄,这里给它一个下限 */
|
||||
@media (min-width: 1440px) {
|
||||
.VPSidebar {
|
||||
width: calc(
|
||||
max(0px, (100vw - (var(--vp-layout-max-width) - 64px)) / 2) + var(--vp-sidebar-width) - 32px
|
||||
) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.VPSidebar {
|
||||
border-right: 1px solid var(--wk-rule-soft);
|
||||
}
|
||||
|
||||
/* 桌面侧栏透明,让正文背景贯通;窄屏抽屉必须不透明,否则会透出正文 */
|
||||
@media (min-width: 960px) {
|
||||
.VPSidebar {
|
||||
/* 与默认主题一致:正好让出顶栏高度,首组标题紧贴顶栏下沿 */
|
||||
padding-top: var(--vp-nav-height) !important;
|
||||
background: transparent !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 959px) {
|
||||
.VPSidebar {
|
||||
padding-top: 18px !important;
|
||||
background: var(--wk-paper) !important;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.dark .VPSidebar {
|
||||
background: var(--wk-paper) !important;
|
||||
}
|
||||
|
||||
/* 移动端不需要顶部 curtain */
|
||||
.VPSidebar .curtain {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 默认主题的 curtain 用负 margin 铺满侧栏宽度,会盖住滚动条顶部 */
|
||||
@media (min-width: 960px) {
|
||||
.VPSidebar .curtain {
|
||||
/* Keep the sidebar curtain aligned with the shared masthead. */
|
||||
top: calc(var(--vp-nav-height) * -1);
|
||||
margin-right: 0;
|
||||
width: calc(100% + 32px);
|
||||
/* 叠加滚动条画在内容区右侧,需裁掉一条竖向通道 */
|
||||
clip-path: inset(0 14px 0 0);
|
||||
background-color: color-mix(in srgb, var(--wk-paper) 82%, transparent);
|
||||
backdrop-filter: saturate(140%) blur(14px);
|
||||
}
|
||||
|
||||
.dark .VPSidebar .curtain {
|
||||
background-color: color-mix(in srgb, var(--wk-paper) 82%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
中等屏「本页目录」条(960–1279px)
|
||||
默认通栏 + 底边会横穿侧栏,看起来像多余的线
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
@media (min-width: 960px) and (max-width: 1279px) {
|
||||
.VPLocalNav.has-sidebar {
|
||||
width: calc(100% - var(--vp-sidebar-width));
|
||||
margin-left: var(--vp-sidebar-width);
|
||||
/* 盖过默认主题 scoped 的 padding-left: sidebar-width,否则会双重偏移居中 */
|
||||
padding-left: 0 !important;
|
||||
background-color: color-mix(in srgb, var(--wk-paper) 82%, transparent);
|
||||
backdrop-filter: saturate(140%) blur(14px);
|
||||
border-bottom-color: var(--wk-rule-soft);
|
||||
}
|
||||
|
||||
.VPLocalNav.has-sidebar .container {
|
||||
justify-content: flex-start;
|
||||
padding-left: 32px;
|
||||
padding-right: 32px;
|
||||
}
|
||||
|
||||
.VPLocalNav.has-sidebar .VPLocalNavOutlineDropdown {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
/* 默认 left 按通栏算了 sidebar+32;LocalNav 已右移,再加一次会落到中间 */
|
||||
.VPLocalNav.has-sidebar .VPLocalNavOutlineDropdown .items {
|
||||
left: 32px;
|
||||
right: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-0 > .item > .text {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 11px !important;
|
||||
font-weight: 500 !important;
|
||||
letter-spacing: 0.16em;
|
||||
text-transform: uppercase;
|
||||
color: var(--wk-ink-mute) !important;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-0 {
|
||||
padding-bottom: 22px;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-0:not(:first-child) {
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1 .link .text {
|
||||
font-size: 13.5px;
|
||||
line-height: 1.6;
|
||||
color: var(--wk-ink-soft);
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1 .link:hover .text {
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1 > .item {
|
||||
margin-left: -10px;
|
||||
padding: 0 10px;
|
||||
width: calc(100% + 10px);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1.is-active .link .text {
|
||||
color: var(--wk-accent-text) !important;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1.is-active > .item {
|
||||
position: relative;
|
||||
background: color-mix(in srgb, var(--wk-gold) 16%, var(--wk-paper));
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1.is-active > .item::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 6px;
|
||||
bottom: 6px;
|
||||
width: 3px;
|
||||
border-radius: 2px;
|
||||
background: var(--wk-gold);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
正文排版
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
.VPDoc {
|
||||
padding-top: 44px !important;
|
||||
}
|
||||
|
||||
/* 默认主题用 scoped 选择器把正文锁死在 688px,覆盖它需要 !important。
|
||||
这里让正文列吃满侧栏与右侧目录之间的空间,只在超宽屏留一个上限,
|
||||
免得一行拉到两千像素。 */
|
||||
@media (min-width: 1280px) {
|
||||
.VPDoc .content-container,
|
||||
.VPDoc.has-aside .content-container {
|
||||
max-width: 1600px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.vp-doc {
|
||||
font-size: 15.5px;
|
||||
line-height: 1.82;
|
||||
color: var(--wk-ink-soft);
|
||||
}
|
||||
|
||||
.vp-doc h1,
|
||||
.vp-doc h2,
|
||||
.vp-doc h3,
|
||||
.vp-doc h4 {
|
||||
color: var(--wk-ink);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.vp-doc h1 {
|
||||
font-family: var(--wk-font-serif);
|
||||
font-size: 42px;
|
||||
line-height: 1.22;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.02em;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.vp-doc h2 {
|
||||
font-family: var(--wk-font-serif);
|
||||
font-size: 27px;
|
||||
font-weight: 500;
|
||||
line-height: 1.35;
|
||||
margin-top: 66px;
|
||||
padding-top: 26px;
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
}
|
||||
|
||||
.vp-doc h3 {
|
||||
font-size: 18.5px;
|
||||
font-weight: 650;
|
||||
margin-top: 42px;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.vp-doc h4 {
|
||||
font-size: 15.5px;
|
||||
font-weight: 650;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.vp-doc h2 .header-anchor,
|
||||
.vp-doc h3 .header-anchor {
|
||||
color: var(--wk-gold);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.vp-doc p,
|
||||
.vp-doc li {
|
||||
color: var(--wk-ink-soft);
|
||||
}
|
||||
|
||||
.vp-doc strong {
|
||||
color: var(--wk-ink);
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.vp-doc a {
|
||||
color: var(--wk-ink);
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--wk-gold) 55%, transparent);
|
||||
padding-bottom: 1px;
|
||||
transition: border-color 0.2s ease, background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc a:hover {
|
||||
border-bottom-color: var(--wk-gold);
|
||||
background: rgba(184, 134, 59, 0.08);
|
||||
}
|
||||
|
||||
.vp-doc ul,
|
||||
.vp-doc ol {
|
||||
padding-left: 1.3em;
|
||||
}
|
||||
|
||||
.vp-doc li + li {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.vp-doc li::marker {
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.vp-doc blockquote {
|
||||
border-left: 2px solid var(--wk-gold);
|
||||
background: transparent;
|
||||
padding: 2px 0 2px 20px;
|
||||
margin: 26px 0;
|
||||
}
|
||||
|
||||
.vp-doc blockquote > p {
|
||||
font-size: 14.5px;
|
||||
color: var(--wk-ink-mute);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.vp-doc hr {
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
margin: 52px 0;
|
||||
}
|
||||
|
||||
/* 代码 */
|
||||
|
||||
.vp-doc :not(pre) > code {
|
||||
font-size: 0.86em;
|
||||
font-family: var(--wk-font-mono);
|
||||
background: var(--wk-paper-2);
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 3px;
|
||||
padding: 2px 5px;
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.vp-doc div[class*="language-"] {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
background: var(--vp-code-block-bg);
|
||||
margin: 26px 0;
|
||||
}
|
||||
|
||||
.vp-doc div[class*="language-"] pre {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] code {
|
||||
font-size: 13px;
|
||||
line-height: 1.72;
|
||||
}
|
||||
|
||||
/* 复制按钮:默认隐形,悬停时才出现的细线方钮 */
|
||||
.vp-doc [class*="language-"] > button.copy {
|
||||
top: 9px;
|
||||
right: 9px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 2px;
|
||||
background-color: transparent;
|
||||
background-size: 14px;
|
||||
background-position: 50%;
|
||||
opacity: 0;
|
||||
transform: translateY(-2px);
|
||||
transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease,
|
||||
background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"]:hover > button.copy,
|
||||
.vp-doc [class*="language-"] > button.copy:focus-visible {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > button.copy:hover {
|
||||
border-color: var(--wk-gold);
|
||||
background-color: var(--wk-paper);
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > button.copy.copied,
|
||||
.vp-doc [class*="language-"] > button.copy:hover.copied {
|
||||
border-color: var(--wk-gold);
|
||||
background-color: var(--wk-paper);
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > button.copy.copied::before,
|
||||
.vp-doc [class*="language-"] > button.copy:hover.copied::before {
|
||||
top: -1px;
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 2px;
|
||||
background-color: var(--wk-paper);
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.1em;
|
||||
color: var(--wk-ink-mute);
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > span.lang {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
/* 表格 */
|
||||
|
||||
/* 滚动交给包裹层(见 config.mts 的 table_open 规则),表格本身保持
|
||||
display:table + width:100%,所有表格宽度一致地撑满正文列 */
|
||||
.vp-doc .wk-table {
|
||||
overflow-x: auto;
|
||||
margin: 28px 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.vp-doc .wk-table > table {
|
||||
display: table;
|
||||
width: 100%;
|
||||
/* 窄屏下宁可横向滚动,也不要把列挤成一字一行 */
|
||||
min-width: 420px;
|
||||
margin: 0;
|
||||
font-size: 13.5px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.vp-doc .wk-table::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
.vp-doc .wk-table::-webkit-scrollbar-thumb {
|
||||
background: var(--wk-rule);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.vp-doc th {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
font-weight: 500;
|
||||
color: var(--wk-ink-mute);
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--wk-rule);
|
||||
padding: 10px 14px 10px 0;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.vp-doc td {
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--wk-rule-soft);
|
||||
padding: 12px 14px 12px 0;
|
||||
vertical-align: top;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.vp-doc tr {
|
||||
background: transparent !important;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.vp-doc th:last-child,
|
||||
.vp-doc td:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
/* 自定义容器 */
|
||||
|
||||
.vp-doc .custom-block {
|
||||
border-radius: 3px;
|
||||
border: 1px solid var(--wk-rule);
|
||||
border-left-width: 2px;
|
||||
background: var(--wk-paper-2);
|
||||
font-size: 14px;
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
.vp-doc .custom-block.tip {
|
||||
border-left-color: var(--wk-gold);
|
||||
}
|
||||
|
||||
.vp-doc .custom-block-title {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Mermaid 图 */
|
||||
|
||||
.vp-doc .mermaid {
|
||||
position: relative;
|
||||
margin: 34px 0;
|
||||
padding: 28px 20px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 4px;
|
||||
background: var(--wk-paper-2);
|
||||
text-align: center;
|
||||
overflow-x: auto;
|
||||
cursor: zoom-in;
|
||||
transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc .mermaid:hover {
|
||||
border-color: var(--wk-rule);
|
||||
}
|
||||
|
||||
.vp-doc .mermaid::after {
|
||||
content: "点击放大";
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: 10px;
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.14em;
|
||||
color: var(--wk-ink-mute);
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc .mermaid:hover::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* 页脚区 */
|
||||
|
||||
.VPDocFooter {
|
||||
margin-top: 72px;
|
||||
padding-top: 26px;
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
}
|
||||
|
||||
.VPDocFooter .prev-link .desc,
|
||||
.VPDocFooter .next-link .desc {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.VPDocFooter .pager-link {
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 3px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.VPDocFooter .pager-link:hover {
|
||||
border-color: var(--wk-gold);
|
||||
}
|
||||
|
||||
.VPDocFooter .pager-link .title {
|
||||
font-weight: 550;
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.VPDocAsideOutline .outline-title,
|
||||
.VPDocOutlineItem .outline-title {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px !important;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.VPDocAside .outline-link {
|
||||
font-size: 12.8px;
|
||||
line-height: 1.65;
|
||||
padding: 6px 0;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.VPDocAside .outline-link.nested {
|
||||
padding-inline-start: 16px;
|
||||
}
|
||||
|
||||
.VPDocAside .VPDocAsideOutline .root {
|
||||
padding-inline-start: 2px;
|
||||
}
|
||||
|
||||
.VPDocAside .outline-link.active {
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.VPDocAsideOutline .outline-marker {
|
||||
background-color: var(--wk-gold) !important;
|
||||
}
|
||||
|
||||
.VPFooter {
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
background: transparent !important;
|
||||
padding: 34px 24px;
|
||||
}
|
||||
|
||||
.VPFooter .message,
|
||||
.VPFooter .copyright {
|
||||
font-size: 12.5px;
|
||||
color: var(--wk-ink-mute);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.VPLastUpdated {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 11px !important;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.vp-doc h1 {
|
||||
font-size: 32px;
|
||||
}
|
||||
.vp-doc h2 {
|
||||
font-size: 23px;
|
||||
margin-top: 52px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reserve the same masthead space in the default documentation layout. */
|
||||
:root, .hide-nav, .hide-nav .VPSidebar { --vp-nav-height: 64px; }
|
||||
.wk-docs-header { position: fixed; left: 0; top: 0; }
|
||||
.VPLocalNav { top: var(--vp-nav-height); }
|
||||
.wk-docs-label { margin: 0; padding: 24px 0 16px; color: var(--wk-ink-mute); font-size: 12px; letter-spacing: .08em; }
|
||||
.wk-header-search .VPNavBarSearch { padding: 0; }
|
||||
.wk-header-search .DocSearch-Button { width: 160px; height: 36px; padding: 0 10px; justify-content: space-between; border: 1px solid var(--wk-rule); border-radius: 4px; background: var(--wk-paper-2); }
|
||||
.wk-header-search .DocSearch-Button-Placeholder { display: inline-block; padding: 0 8px; font-size: 12px; }
|
||||
.wk-header-search .DocSearch-Button-Keys { display: flex; }
|
||||
@media (min-width: 801px) and (max-width: 1280px) {
|
||||
.wk-header-search .DocSearch-Button { width: 36px; justify-content: center; }
|
||||
.wk-header-search .DocSearch-Button-Placeholder, .wk-header-search .DocSearch-Button-Keys { display: none; }
|
||||
.wk-header-search .DocSearch-Search-Icon { margin: 0; }
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.wk-header-search { order: -1; margin-bottom: 10px; }
|
||||
.wk-header-search, .wk-header-search #local-search, .wk-header-search .DocSearch-Button { width: 100%; }
|
||||
}
|
||||
@media (max-width: 959px) {
|
||||
.Layout { padding-top: var(--vp-nav-height); }
|
||||
.VPSidebar { top: var(--vp-nav-height); }
|
||||
.wk-docs-label { padding-top: 0; }
|
||||
}
|
||||
@media (max-width: 800px) { :root, .hide-nav, .hide-nav .VPSidebar { --vp-nav-height: 64px; } }
|
||||
Reference in new issue
Block a user