forked from lando/vitepress-theme-default-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitepress-theme-default-plus.js
74 lines (63 loc) · 2.93 KB
/
vitepress-theme-default-plus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// styles
import './styles/vars.scss';
import './styles/styles.scss';
// client stuff
import {default as enhanceAppWithLayouts} from './client/enhance-app-with-layouts.js';
import {enhanceAppWithTabs} from 'vitepress-plugin-tabs/client';
// layouts
import DefaultTheme from 'vitepress/theme';
import Layout from './components/VPLLayout.vue';
// global components
import VPLJobs from './components/VPLJobs.vue';
import VPLMailChimp from './components/VPLMailChimp.vue';
import VPLSponsors from './components/VPLSponsors.vue';
import VPLYouTube from './components/VPLYouTube.vue';
// composables
export {default as isActive} from './client/is-active.js';
export {default as encodeTag} from './client/encode-tag.js';
export {default as useCollection} from './client/use-collection.js';
export {default as useTeam} from './client/use-team.js';
// components
export {default as VPLAlert} from './components/VPLAlert.vue';
export {default as VPLLink} from './components/VPLLink.vue';
export {default as VPLMenuGroup} from './components/VPLMenuGroup.vue';
export {default as VPLMenuLink} from './components/VPLMenuLink.vue';
export {default as VPLNavBarMenuGroup} from './components/VPLNavBarMenuGroup.vue';
// team page
export {default as VPLTeamMembersItem} from './components/VPLTeamMembersItem.vue';
export {default as VPLTeamMembers} from './components/VPLTeamMembers.vue';
export {VPTeamPage as VPLTeamPage} from 'vitepress/theme';
export {VPTeamPageTitle as VPLTeamPageTitle} from 'vitepress/theme';
export {VPTeamPageSection as VPLTeamPageSection} from 'vitepress/theme';
// collection page
export {default as VPLCollectionItem} from './components/VPLCollectionItem.vue';
export {default as VPLCollectionItemTags} from './components/VPLCollectionItemTags.vue';
export {default as VPLCollectionItems} from './components/VPLCollectionItems.vue';
export {default as VPLCollectionPage} from './components/VPLCollectionPage.vue';
export {default as VPLCollectionPageTags} from './components/VPLCollectionPageTags.vue';
export {default as VPLCollectionPageTitle} from './components/VPLCollectionPageTitle.vue';
export {default as VPLCollectionPageSection} from './components/VPLCollectionPageSection.vue';
const theme = {
extends: DefaultTheme,
Layout,
async enhanceApp({app, router}) {
// register global components
app.component('Jobs', VPLJobs);
app.component('MailChimp', VPLMailChimp);
app.component('Sponsors', VPLSponsors);
app.component('YouTube', VPLYouTube);
// enhance app for tabbin
enhanceAppWithTabs(app);
// enhance app with layouts
enhanceAppWithLayouts(app);
// add query tags if we can
if (!import.meta.env.SSR) {
const params = new URLSearchParams(window.location.search);
router.route.tags = [params.get('tag'), params.get('tags')]
.filter(param => param && param !== null && typeof param === 'string')
.map(param => param.split(','))
.flat(Infinity);
}
},
};
export default theme;