docs/.vitepress/theme/index.ts

2301a554922d0c2ec0daf31fcce6f729fb9e3e9f
wotaku/docs/.vitepress/theme/index.ts

94 lines · 2814 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/steps.css'
21import { enhanceAppWithTabs } from './components/tabs'
22import { registerGlobalComponents } from './globalComponents'
23
24export default {
25  extends: DefaultTheme,
26  Layout: Layout,
27  enhanceApp({ app, router }) {
28    app.use(FloatingVue, {
29      themes: {
30        hint: {
31          $extend: 'tooltip',
32          delay: { show: 0, hide: 0 },
33          html: true
34        },
35        'vp-tooltip': {
36          $extend: 'tooltip',
37          $resetCss: true,
38          triggers: ['click', 'touch'],
39          autoHide: true
40        }
41      }
42    })
43    enhanceAppWithTabs(app)
44    registerGlobalComponents(app)
45    createMediumZoomProvider(app, router)
46    app.use(
47      NolebasePagePropertiesPlugin<{ tags: string[]; progress: number }>(),
48      [
49        {
50          locales: {
51            en: [
52              {
53                key: 'tags',
54                type: 'tags',
55                title: 'Tags'
56              },
57              {
58                key: 'createdAt',
59                type: 'datetime',
60                title: 'Created at',
61                formatAsFrom: true,
62                dateFnsLocaleName: 'enUS'
63              },
64              {
65                key: 'updatedAt',
66                type: 'datetime',
67                title: 'Updated at',
68                formatAsFrom: true,
69                dateFnsLocaleName: 'enUS'
70              },
71              {
72                key: 'wordsCount',
73                type: 'dynamic',
74                title: 'Word count',
75                options: {
76                  type: 'wordsCount'
77                }
78              },
79              {
80                key: 'readingTime',
81                type: 'dynamic',
82                title: 'Reading time',
83                options: {
84                  type: 'readingTime',
85                  dateFnsLocaleName: 'enUS'
86                }
87              }
88            ]
89          }
90        }
91      ]
92    )
93  }
94} satisfies Theme
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form