更新文档

This commit is contained in:
Super Manito
2025-04-04 13:15:39 +08:00
parent cf0fccaa92
commit 421e0a42aa
21 changed files with 489 additions and 342 deletions

1
docs/theme/netlify.svg vendored Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="#014847" d="M29.39 13.98L18.02 2.61l-.42-.42l-.47-.19h-2.26l-.47.2l-.42.41L2.61 13.98l-.42.42l-.19.47v2.26l.2.47l.41.42l11.37 11.37l.42.42l.47.19h2.26l.47-.2l.42-.41l11.37-11.37l.42-.42l.19-.47v-2.26l-.2-.47z"/><path fill="#32E6E2" d="M14.99 27.38v-5.46l.14-.15h1.74l.14.15v5.46l-.14.14h-1.74zm0-17.3V4.62l.14-.14h1.74l.14.14v5.46l-.14.15h-1.74zM10.4 23.33h-.24l-1.2-1.2v-.23l1.6-1.6h1.26l.17.18v1.26l-1.6 1.6ZM8.96 10.16v-.24l1.2-1.2h.24l1.59 1.6v1.26l-.17.17h-1.26zm-4.8 4.82h6.14l.14.15v1.74l-.14.14H4.16L4 16.87v-1.74l.15-.15Z"/><path fill="#fff" d="M19.26 19.62h-1.74l-.15-.15v-4.06c0-.73-.28-1.29-1.15-1.3c-.45-.02-.97 0-1.51.02l-.09.08v5.26l-.14.15h-1.74l-.14-.15v-6.94l.14-.15h3.9a2.75 2.75 0 0 1 2.76 2.75v4.34l-.15.15Z"/><path fill="#32E6E2" d="M27.84 17.02H21.7l-.14-.15v-1.74l.14-.14h6.14l.15.14v1.74z"/></svg>

After

Width:  |  Height:  |  Size: 917 B

View File

@@ -25,22 +25,28 @@
<script>
var giscus = document.querySelector("script[src*=giscus]")
/* Set palette on initial load */
// Set palette on initial load
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light"
// Instruct Giscus to set theme
giscus.setAttribute("data-theme", theme)
}
/* Register event handlers after documented loaded */
// Register event handlers after documented loaded
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light"
/* Instruct Giscus to change theme */
// Instruct Giscus to change theme
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },

105
docs/theme/partials/palette.html vendored Normal file
View File

@@ -0,0 +1,105 @@
<form class="md-header__option" data-md-component="palette">
{% for option in config.theme.palette %} {% set scheme = option.scheme | d("default", true) %} {% set primary = option.primary | d("indigo", true) %} {% set accent = option.accent | d("indigo", true) %}
<input class="md-option" data-md-color-media="{{ option.media }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-primary="{{ primary | replace(' ', '-') }}" data-md-color-accent="{{ accent | replace(' ', '-') }}" {% if option.toggle %} aria-label="{{ option.toggle.name }}" {% else %} aria-hidden="true" {% endif %} type="radio" name="__palette" id="__palette_{{ loop.index0 }}" />
{% if option.toggle %}
<label class="md-header__button md-icon" title="{{ option.toggle.name }}" for="__palette_{{ loop.index % loop.length }}" hidden> {% include ".icons/" ~ option.toggle.icon ~ ".svg" %} </label>
{% endif %} {% endfor %}
</form>
<script>
var palette = __md_get('__palette')
if (palette && palette.color) {
/* Retrieve color palette for system preference */
if (palette.color.media === '(prefers-color-scheme)') {
var media = matchMedia('(prefers-color-scheme: light)')
var input = document.querySelector(media.matches ? "[data-md-color-media='(prefers-color-scheme: light)']" : "[data-md-color-media='(prefers-color-scheme: dark)']")
/* Retrieve colors for system preference */
;(palette.color.media = input.getAttribute('data-md-color-media')), (palette.color.scheme = input.getAttribute('data-md-color-scheme')), (palette.color.primary = input.getAttribute('data-md-color-primary')), (palette.color.accent = input.getAttribute('data-md-color-accent'))
}
/* Set color palette */
for (var [key, value] of Object.entries(palette.color)) document.body.setAttribute('data-md-color-' + key, value)
}
document.addEventListener('DOMContentLoaded', function () {
if (typeof document.startViewTransition !== 'function') {
return // 不支持 View Transitions API 的浏览器直接返回
}
// 获取所有主题切换按钮
const themeToggles = document.querySelectorAll('.md-header__button.md-icon')
themeToggles.forEach((toggle) => {
toggle.addEventListener(
'click',
function (e) {
// 阻止默认点击事件
e.preventDefault()
e.stopPropagation()
// 获取目标输入元素
const targetId = this.getAttribute('for')
const targetInput = document.getElementById(targetId)
if (!targetInput) return
// 获取当前存储的主题信息和即将切换到的主题信息
const currentPalette = __md_get('__palette')
const currentScheme = currentPalette?.color?.scheme || ''
const currentMedia = currentPalette?.color?.media || ''
// 获取新主题信息
const newScheme = targetInput.getAttribute('data-md-color-scheme')
const newMedia = targetInput.getAttribute('data-md-color-media')
// 判断当前浏览器/系统主题
const isSystemDark = window.matchMedia('(prefers-color-scheme: dark)').matches
// 判断是否切换到暗色主题
const isDark = newScheme != 'default'
// 确定当前主题的实际暗色状态
let isCurrentDark = currentScheme.includes('slate')
if (currentMedia === '(prefers-color-scheme)') {
isCurrentDark = isSystemDark
}
// 确定新主题的实际暗色状态
let isNewDark = newScheme.includes('slate')
if (newMedia === '(prefers-color-scheme)') {
isNewDark = isSystemDark
}
// 如果当前主题和目标主题相同,则不需要动画
if (isCurrentDark === isNewDark) {
targetInput.click()
return
}
// 动画参数
const x = e.clientX
const y = e.clientY
const endRadius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y))
// 设置动画路径
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`]
// 启动视图过渡
document
.startViewTransition(async () => {
// 切换主题
targetInput.click()
// 添加暗/亮模式类,用于动画控制
document.documentElement.classList.remove(isDark ? 'light' : 'dark')
document.documentElement.classList.add(isDark ? 'dark' : 'light')
// 等待主题变化完成
await new Promise((resolve) => setTimeout(resolve, 100))
})
.ready.then(() => {
// 视图过渡准备就绪,开始动画
document.documentElement.animate(
{
clipPath: isDark ? [...clipPath].reverse() : clipPath,
},
{
duration: 500,
easing: 'ease-in',
pseudoElement: isDark ? '::view-transition-old(root)' : '::view-transition-new(root)',
}
)
})
},
{ capture: true }
)
})
// 初始化主题状态类
const currentPalette = __md_get('__palette')
const currentScheme = currentPalette?.color?.scheme || ''
const isDark = currentScheme.includes('slate')
document.documentElement.classList.add(isDark ? 'dark' : 'light')
})
</script>

View File

@@ -8,27 +8,29 @@
{% for toc_item in toc %} {% include "partials/toc-item.html" %} {% endfor %}
</ul>
<div class="md-nav__sponsor-bottom">
<div class="sponsor-label">
<strong>赞助商</strong>
</div>
<div class="sponsor-wrapper">
<a class="sponsor-item" target="_blank" href="https://1panel.cn" title="1Panel · 新一代的 Linux 服务器运维管理面板">
<img src="/assets/images/sponsor/1panel.png" alt="1Panel · 新一代的 Linux 服务器运维管理面板" style="width: 60%" />
</a>
<a class="sponsor-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云">
<img src="/assets/images/sponsor/linfengyun-light.png#only-light" alt="林枫云" style="width: 60%" />
<img src="/assets/images/sponsor/linfengyun-dark.png#only-dark" alt="林枫云" style="width: 60%" />
</a>
<a class="sponsor-item" target="_blank" href="https://arcadia.cool" title="Arcadia 一站式代码运维平台">
<img src="/assets/images/sponsor/arcadia-light.png#only-light" alt="Arcadia 一站式代码运维平台" style="width: 60%" />
<img src="/assets/images/sponsor/arcadia-dark.png#only-dark" alt="Arcadia 一站式代码运维平台" style="width: 60%" />
</a>
<a class="sponsor-item" target="_blank" href="/sponsor/">
<span style="font-size: 0.6rem">
<strong>成为赞助商</strong>
</span>
</a>
<div class="md-content" data-md-component="content">
<div class="md-nav__sponsor-bottom">
<div class="sponsor-label">
<strong>赞助商</strong>
</div>
<div class="sponsor-wrapper">
<a class="sponsor-item" target="_blank" href="https://1panel.cn" title="1Panel · 新一代的 Linux 服务器运维管理面板">
<img src="/assets/images/sponsor/1panel.png" alt="1Panel" style="width: 60%" />
</a>
<a class="sponsor-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云 · 专注独立IP高频VPSR9/i9系列定制">
<img src="/assets/images/sponsor/linfengyun-light.png#only-light" alt="林枫云" style="width: 60%" />
<img src="/assets/images/sponsor/linfengyun-dark.png#only-dark" alt="林枫云" style="width: 60%" />
</a>
<a class="sponsor-item" target="_blank" href="https://arcadia.cool" title="Arcadia 一站式代码运维平台">
<img src="/assets/images/sponsor/arcadia-light.png#only-light" alt="Arcadia" style="width: 60%" />
<img src="/assets/images/sponsor/arcadia-dark.png#only-dark" alt="Arcadia" style="width: 60%" />
</a>
<!-- <a class="sponsor-item" target="_blank" href="/sponsor/">
<span style="font-size: 0.6rem">
<strong>成为赞助商</strong>
</span>
</a> -->
</div>
</div>
</div>
{% endif %}