docs/.vitepress/theme/index.ts

0adefbb16515c2894412a024b6117730e1b8dc7d
wotaku/docs/.vitepress/theme/index.ts

104 lines · 3264 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 { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
 14import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css'
 15import '@nolebase/vitepress-plugin-page-properties/client/style.css'
 16import 'floating-vue/dist/style.css'
 17import Authors from './components/Authors.vue'
 18import Tooltip from './components/Tooltip.vue'
 19import { createMediumZoomProvider } from './composables/medium-zoom'
 20import 'virtual:uno.css'
 21import Feedback from './components/Feedback.vue'
 22import ScrapeTable from './components/ScrapeTable.vue'
 23import Layout from './Layout.vue'
 24import './styles/tooltip-hint.css'
 25import './styles/steps.css'
 26import Block from './components/Block.vue'
 27import LinkInline from './components/LinkInline.vue'
 28
 29export default {
 30  extends: DefaultTheme,
 31  Layout: Layout,
 32  enhanceApp({ app, router }) {
 33    app.use(FloatingVue, {
 34      themes: {
 35        hint: {
 36          $extend: 'tooltip',
 37          delay: { show: 0, hide: 0 },
 38          html: true
 39        },
 40        'vp-tooltip': {
 41          $extend: 'tooltip',
 42          $resetCss: true,
 43          triggers: ['click', 'touch'],
 44          autoHide: true
 45        }
 46      }
 47    })
 48    enhanceAppWithTabs(app)
 49    app.component('LinkInline', LinkInline)
 50    app.component('Block', Block)
 51    app.component('Authors', Authors)
 52    app.component('Tooltip', Tooltip)
 53    app.component('Feedback', Feedback)
 54    app.component('ScrapeTable', ScrapeTable)
 55    createMediumZoomProvider(app, router)
 56    app.use(
 57      NolebasePagePropertiesPlugin<{ tags: string[]; progress: number }>(),
 58      [
 59        {
 60          locales: {
 61            en: [
 62              {
 63                key: 'tags',
 64                type: 'tags',
 65                title: 'Tags'
 66              },
 67              {
 68                key: 'createdAt',
 69                type: 'datetime',
 70                title: 'Created at',
 71                formatAsFrom: true,
 72                dateFnsLocaleName: 'enUS'
 73              },
 74              {
 75                key: 'updatedAt',
 76                type: 'datetime',
 77                title: 'Updated at',
 78                formatAsFrom: true,
 79                dateFnsLocaleName: 'enUS'
 80              },
 81              {
 82                key: 'wordsCount',
 83                type: 'dynamic',
 84                title: 'Word count',
 85                options: {
 86                  type: 'wordsCount'
 87                }
 88              },
 89              {
 90                key: 'readingTime',
 91                type: 'dynamic',
 92                title: 'Reading time',
 93                options: {
 94                  type: 'readingTime',
 95                  dateFnsLocaleName: 'enUS'
 96                }
 97              }
 98            ]
 99          }
100        }
101      ]
102    )
103  }
104} 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