docs/.vitepress/theme/index.ts

12477b9242fb06be8abaf5f2b874b35addef3897
wotaku/docs/.vitepress/theme/index.ts

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