docs/.vitepress/theme/index.ts
95 lines · 2848 bytes
1/**
2 * All Rights Reserved
3 *
4 * Copyright (c) 2025 taskylizard
5 *
6 * All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
7 */
8import type { Theme } from 'vitepress'
9import DefaultTheme from 'vitepress/theme'
10import './styles/style.scss'
11import { NolebasePagePropertiesPlugin } from '@nolebase/vitepress-plugin-page-properties/client'
12import FloatingVue from 'floating-vue'
13import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css'
14import '@nolebase/vitepress-plugin-page-properties/client/style.css'
15import 'floating-vue/dist/style.css'
16import { createMediumZoomProvider } from './composables/medium-zoom'
17import 'virtual:uno.css'
18import Layout from './Layout.vue'
19import './styles/tooltip-hint.css'
20import './styles/table-more.css'
21import './styles/steps.css'
22import { enhanceAppWithTabs } from './components/tabs'
23import { registerGlobalComponents } from './globalComponents'
24
25export default {
26 extends: DefaultTheme,
27 Layout: Layout,
28 enhanceApp({ app, router }) {
29 app.use(FloatingVue, {
30 themes: {
31 hint: {
32 $extend: 'tooltip',
33 delay: { show: 0, hide: 0 },
34 html: true
35 },
36 'vp-tooltip': {
37 $extend: 'tooltip',
38 $resetCss: true,
39 triggers: ['click', 'touch'],
40 autoHide: true
41 }
42 }
43 })
44 enhanceAppWithTabs(app)
45 registerGlobalComponents(app)
46 createMediumZoomProvider(app, router)
47 app.use(
48 NolebasePagePropertiesPlugin<{ tags: string[]; progress: number }>(),
49 [
50 {
51 locales: {
52 en: [
53 {
54 key: 'tags',
55 type: 'tags',
56 title: 'Tags'
57 },
58 {
59 key: 'createdAt',
60 type: 'datetime',
61 title: 'Created at',
62 formatAsFrom: true,
63 dateFnsLocaleName: 'enUS'
64 },
65 {
66 key: 'updatedAt',
67 type: 'datetime',
68 title: 'Updated at',
69 formatAsFrom: true,
70 dateFnsLocaleName: 'enUS'
71 },
72 {
73 key: 'wordsCount',
74 type: 'dynamic',
75 title: 'Word count',
76 options: {
77 type: 'wordsCount'
78 }
79 },
80 {
81 key: 'readingTime',
82 type: 'dynamic',
83 title: 'Reading time',
84 options: {
85 type: 'readingTime',
86 dateFnsLocaleName: 'enUS'
87 }
88 }
89 ]
90 }
91 }
92 ]
93 )
94 }
95} satisfies Theme