Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
ikenxuan committed Jan 4, 2025
1 parent e9cc04b commit b18f55d
Show file tree
Hide file tree
Showing 27 changed files with 570 additions and 410 deletions.
17 changes: 10 additions & 7 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { execSync } from 'node:child_process'
import { cwd } from 'node:process'
import { defineConfig } from 'vitepress'
import { DefaultTheme } from 'vitepress/theme'
Expand Down Expand Up @@ -39,6 +40,12 @@ import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-i
// 懒加载模糊预览图
import { UnlazyImages } from '@nolebase/markdown-it-unlazy-img'

let version = ''

const latestVersion = execSync('npm show karin-plugin-kkk version').toString().trim()
version = latestVersion


export default
withPwa(defineConfig({
pwa,
Expand Down Expand Up @@ -158,6 +165,7 @@ export default
['link', { rel: 'icon', href: '/karin-plugin-kkk/logo.png' }], //部署到vitepress仓库
],
themeConfig: {
siteTitle: `karin-plugin-kkk <code class="VPBadge tip">v${version}</code>`,
logo: {
src: '/logo.png',
},
Expand Down Expand Up @@ -194,13 +202,8 @@ export default
},
sidebar: sidebar,
socialLinks: [
{ icon: { svg: '<i class="fa-brands fa-github fa-fade fa-lg"></i>' }, link: 'https://github.com/ikenxuan/karin-plugin-kkk' },
{
icon: {
svg: '<i class="fa-brands fa-qq fa-fade fa-lg"></i>',
},
link: 'http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=S8y6baEcSkO6TEO5kEdfgmJhz79Oxdw5&authKey=ficWQytHGz3KIv5i0HpGbEeMBpABBXfjEMYRzo3ZwMV%2B0Y5mq8cC0Yxbczfa904H&noverify=0&group_code=795874649',
},
{ icon: { svg: '<iconify-icon icon="meteor-icons:github" style="display: inline-block;background-repeat: no-repeat;background-size: 100% 100%;"></iconify-icon>' }, link: 'https://github.com/ikenxuan/karin-plugin-kkk' },
{ icon: { svg: '<iconify-icon icon="devicon:npm" style="display: inline-block;background-repeat: no-repeat;background-size: 100% 100%;"></iconify-icon>' }, link: 'https://www.npmjs.com/package/karin-plugin-kkk' },
],
lastUpdatedText: '最后编辑于',
outlineTitle: '本页大纲',
Expand Down
20 changes: 1 addition & 19 deletions .vitepress/data/fooertData.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
import type { FooterData } from '@theojs/lumen'

export const Footer_Data: FooterData = {
author: { name: 'ikenxuan', link: 'https://github.com/ikenxuan' },
group: [
{
title: '框架',
icon: 'fa-solid fa-robot',
links: [
{ name: 'Karin', href: 'https://github.com/Karinjs/Karin' },
]
},
{
title: '相关链接',
icon: 'fab fa-github',
links: [
{ name: 'ICQQ', href: 'https://github.com/icqqjs/icqq' },
{ name: '插件库', href: 'https://plugin.karin.fun' },
{ name: '解析库', href: 'https://github.com/ikenxuan/amagi' }
]
},
]
author: { name: 'ikenxuan', link: 'https://github.com/ikenxuan' }
}
2 changes: 1 addition & 1 deletion .vitepress/script/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const nav = [
{
text: '功能',
items: [
{ text: '作品解析', link: '/docs/intro/main/main' },
{ text: '目录', link: '/docs/intro/main/main' },
{ text: '动态推送', link: '/docs/intro/push' },
{ text: 'API Server', link: '/docs/intro/apiserver' },
{ text: '其他功能', link: '/docs/intro/other' },
Expand Down
30 changes: 15 additions & 15 deletions .vitepress/script/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@ const sidebar = [
{
text: '快速开始',
items: [
{ text: '<i class="fa-solid fa-play fa-beat"></i> 简介', link: '/docs/start/start' },
{ text: '<i class="fa-solid fa-download fa-fade"></i> 安装插件', link: '/docs/start/install' },
{ text: '<i class="fa-solid fa-gear fa-spin"></i> 配置文件', link: '/docs/start/start.config' },
{ text: '<iconify-icon icon="ix:about" style="margin-right:0.25rem;color:#741eff;"></iconify-icon> 简介', link: '/docs/start/start' },
{ text: '<iconify-icon icon="icon-park-outline:install" style="margin-right:0.25rem;color:#cdff1e;"></iconify-icon> 安装插件', link: '/docs/start/install' },
{ text: '<iconify-icon icon="ep:setting" style="margin-right:0.25rem;color:#1effc5;"></iconify-icon> 配置文件', link: '/docs/start/start.config' },
],
},
{
text: '功能',
items: [
{
text: '<i class="fa-solid fa-bars fa-flip"></i> 作品解析', link: '/docs/intro/main/main', items: [
{ text: '<i class="fa-brands fa-tiktok fa-fade"></i> 抖音相关', link: '/docs/intro/main/douyin', },
{ text: '<i class="fa-brands fa-bilibili fa-fade"></i> B站相关', link: '/docs/intro/main/bilibili' },
{ text: '快手相关', link: '/docs/intro/main/kuaishou' },
text: '<iconify-icon icon="line-md:list-3-filled" style="margin-right:0.25rem;color:#ffd72a"></iconify-icon> 目录', link: '/docs/intro/main/main', items: [
{ text: '<iconify-icon icon="logos:tiktok-icon" style="margin-right:0.25rem"></iconify-icon> 抖音相关', link: '/docs/intro/main/douyin', },
{ text: '<iconify-icon icon="ri:bilibili-fill" style="margin-right:0.25rem;color:#1ee1ff"></iconify-icon> B站相关', link: '/docs/intro/main/bilibili' },
{ text: '<iconify-icon icon="simple-icons:kuaishou" style="margin-right:0.25rem;color:#ff551e"></iconify-icon> 快手相关', link: '/docs/intro/main/kuaishou' },
]
},
{ text: '<i class="fa-brands fa-pushed fa-fade"></i> 动态推送', link: '/docs/intro/push' },
{ text: '<i class="fa-solid fa-server fa-fade"></i> API Server', link: '/docs/intro/apiserver' },
{ text: '其他功能', link: '/docs/intro/other' },
{ text: '<iconify-icon icon="mingcute:horn-fill" style="margin-right:0.25rem;color:#d1a202;"></iconify-icon> 动态推送', link: '/docs/intro/push' },
{ text: '<iconify-icon icon="mingcute:route-fill" style="margin-right:0.25rem;color:#74ff5c;"></iconify-icon> API Server', link: '/docs/intro/apiserver' },
{ text: '<iconify-icon icon="basil:other-1-outline" style="margin-right:0.25rem;color:#5f2aff;"></iconify-icon> 其他功能', link: '/docs/intro/other' },
],
},
{
text: '其他',
items: [
{
text: '<i class="fa-solid fa-question fa-fade"></i> 遇到问题了?', link: '/docs/intro/problems', items: [
{ text: '<i class="fa-solid fa-file-circle-question fa-fade"></i> 常见问题解答', link: '/docs/intro/QA' },
text: '<iconify-icon icon="twemoji:thinking-face" style="margin-right:0.25rem"></iconify-icon> 遇到问题了?', link: '/docs/intro/problems', items: [
{ text: '<iconify-icon icon="mingcute:check-2-fill" style="margin-right:0.25rem;color:#50ff2a;"></iconify-icon> 常见问题解答', link: '/docs/intro/QA' },
]
},
{ text: '<i class="fa-solid fa-hand-holding-heart fa-fade"></i> 投喂', link: '/docs/other/afdian' },
{ text: '<i class="fa-solid fa-triangle-exclamation fa-fade"></i> 免责声明', link: '/docs/other/disclaimer' },
{ text: '<i class="fa-solid fa-code-branch fa-fade"></i> 版本历史', link: '/docs/other/timeline' },
{ text: '<iconify-icon icon="fluent-emoji:red-heart" style="margin-right:0.25rem"></iconify-icon> 投喂', link: '/docs/other/afdian' },
{ text: '<iconify-icon icon="noto-v1:warning" style="margin-right:0.25rem"></iconify-icon> 免责声明', link: '/docs/other/disclaimer' },
{ text: '<iconify-icon icon="mingcute:content-ai-line" style="margin-right:0.25rem;color:#2afff9;"></iconify-icon> 版本历史', link: '/docs/other/timeline' },
],
},
]
Expand Down
110 changes: 110 additions & 0 deletions .vitepress/theme/components/DocPill.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue'
/** DocPill 接口 */
interface Pill {
/** Pill 名称。 */
name: string
/** Pill 链接。 */
link: string
/** 图标名称,支持 `iconify`。 */
icon?: string | { light: string; dark: string }
/** 图标的颜色。 */
color?: string | { light: string; dark: string }
/** 图片地址或包含 light 和 dark 模式的对象。 */
image?: string | { light: string; dark: string }
/** 是否加粗。 */
bold?: boolean
}
/**
* 检查链接是否为外部链接。
*
* @param link - 要判断的链接字符串。
* @returns 如果链接是外部链接,则返回 `true`,否则返回 `false`。
*/
const isExternal = (link: string): boolean =>
/^(?:[a-z]+:|\/\/)/i.test(link)
const pill = defineProps<Pill>()
</script>

<template>
<a class="link" :class="{ 'bold': pill.bold }" :href="pill.link" :title="pill.name" :aria-label="pill.name"
:target="isExternal(pill.link) ? '_blank' : '_self'" rel="noopener noreferrer">
<template v-if="pill.icon">
<Icon v-if="typeof pill.icon === 'object'" class="iconify light-only" :icon="pill.icon.light" :style="{
color: typeof pill.color === 'object' ? pill.color.light : pill.color
}" :alt="pill.name" aria-hidden="true" />
<Icon v-if="typeof pill.icon === 'object'" class="iconify dark-only" :icon="pill.icon.dark" :style="{
color: typeof pill.color === 'object' ? pill.color.dark : pill.color
}" :alt="pill.name" aria-hidden="true" />
<Icon v-else class="iconify" :icon="pill.icon" :style="{ color: pill.color }" :alt="pill.name"
aria-hidden="true" />
</template>
<template v-else-if="pill.image">
<img v-if="typeof pill.image === 'object'" class="icon light-only" :src="pill.image.light" :alt="pill.name"
loading="lazy" aria-hidden="true" />
<img v-if="typeof pill.image === 'object'" class="icon dark-only" :src="pill.image.dark" :alt="pill.name"
loading="lazy" aria-hidden="true" />
<img v-else class="icon" :src="pill.image" :alt="pill.name" loading="lazy" aria-hidden="true" />
</template>
<span class="name">{{ pill.name }}</span>
</a>
</template>

<style scoped>
/**
* 处理不同模式下的图标显示:暗色模式下隐藏浅色图标,浅色模式下隐藏暗色图标。
*/
:root:not(.dark) .dark-only,
:root:is(.dark) .light-only {
display: none;
}
.link {
display: inline-flex;
align-items: center;
gap: 0.25rem;
transform: translateY(1px);
transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
border: 1px solid transparent;
border-radius: 0.5rem;
background-color: var(--pill-bg);
padding: 0.75rem 0.25rem;
height: 1rem;
text-decoration: none !important;
white-space: nowrap;
}
.link:hover {
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border-color: var(--vp-c-brand-1);
background-color: var(--vp-c-brand-soft);
}
.link:active {
transform: scale(0.9);
}
.bold {
font-weight: bold;
}
.icon {
height: 1em;
}
.iconify {
flex-shrink: 0;
color: var(--vp-c-text-1);
font-size: 1em;
}
.name {
font-size: 1rem;
letter-spacing: 0.05rem;
}
</style>
110 changes: 110 additions & 0 deletions .vitepress/theme/components/Layout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<!-- .vitepress/theme/Layout.vue -->
<!-- https://vitepress.dev/guide/extending-default-theme#using-view-transitions-api -->

<script setup lang="ts">
import { useData } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { nextTick, provide } from 'vue'

// 页面分享按钮、首页公告栏、页脚
import { ShareButton, Announcement, HomeFooter } from '@theojs/lumen'
import { Footer_Data } from '../../data/fooertData.ts'
// 顶级的阅读增强,页面右上角小书本
import {
NolebaseEnhancedReadabilitiesMenu,

} from '@nolebase/vitepress-plugin-enhanced-readabilities/client'
// 闪烁高亮当前目标标题
import {
NolebaseHighlightTargetedHeading,
} from '@nolebase/vitepress-plugin-highlight-targeted-heading/client'

const { isDark } = useData()

const enableTransitions = () =>
'startViewTransition' in document &&
window.matchMedia('(prefers-reduced-motion: no-preference)').matches

provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => {
if (!enableTransitions()) {
isDark.value = !isDark.value
return
}

const clipPath = [
`circle(0px at ${x}px ${y}px)`,
`circle(${Math.hypot(
Math.max(x, innerWidth - x),
Math.max(y, innerHeight - y)
)}px at ${x}px ${y}px)`
]

await document.startViewTransition(async () => {
isDark.value = !isDark.value
await nextTick()
}).ready

document.documentElement.animate(
{ clipPath: isDark.value ? clipPath.reverse() : clipPath },
{
duration: 300,
easing: 'ease-in',
pseudoElement: `::view-transition-${isDark.value ? 'old' : 'new'}(root)`
}
)
})
</script>

<template>
<DefaultTheme.Layout>
<!-- 顶级的阅读增强,页面右上角小书本 -->
<template #nav-bar-content-after>
<NolebaseEnhancedReadabilitiesMenu />
</template>
<template #nav-screen-content-after>
<NolebaseEnhancedReadabilitiesScreenMenu />
</template>
<!-- 页面分享按钮 -->
<template #aside-outline-before>
<ShareButton />
</template>
<!-- 闪烁高亮当前目标标题 -->
<template #layout-top>
<NolebaseHighlightTargetedHeading />
</template>
<template #home-hero-info-before>
<Announcement />
</template>
<!-- 页脚 -->
<template #layout-bottom>
<HomeFooter :Footer_Data="Footer_Data" />
</template>

</DefaultTheme.Layout>
</template>

<style>
::view-transition-old(root),
::view-transition-new(root) {
animation: none;
mix-blend-mode: normal;
}

::view-transition-old(root),
.dark::view-transition-new(root) {
z-index: 1;
}

::view-transition-new(root),
.dark::view-transition-old(root) {
z-index: 9999;
}

.VPSwitchAppearance {
width: 22px !important;
}

.VPSwitchAppearance .check {
transform: none !important;
}
</style>
Loading

0 comments on commit b18f55d

Please sign in to comment.