@vuepress/theme-default 2.0.0-beta.48 → 2.0.0-beta.50-pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/package.json +30 -23
  2. package/lib/client/components/AutoLink.vue +0 -114
  3. package/lib/client/components/DropdownTransition.vue +0 -21
  4. package/lib/client/components/Home.vue +0 -15
  5. package/lib/client/components/HomeContent.vue +0 -5
  6. package/lib/client/components/HomeFeatures.vue +0 -23
  7. package/lib/client/components/HomeFooter.vue +0 -17
  8. package/lib/client/components/HomeHero.vue +0 -97
  9. package/lib/client/components/Navbar.vue +0 -75
  10. package/lib/client/components/NavbarBrand.vue +0 -55
  11. package/lib/client/components/NavbarDropdown.vue +0 -126
  12. package/lib/client/components/NavbarItems.vue +0 -154
  13. package/lib/client/components/Page.vue +0 -24
  14. package/lib/client/components/PageMeta.vue +0 -124
  15. package/lib/client/components/PageNav.vue +0 -103
  16. package/lib/client/components/Sidebar.vue +0 -13
  17. package/lib/client/components/SidebarItem.vue +0 -80
  18. package/lib/client/components/SidebarItems.vue +0 -57
  19. package/lib/client/components/ToggleColorModeButton.vue +0 -57
  20. package/lib/client/components/ToggleSidebarButton.vue +0 -24
  21. package/lib/client/components/global/Badge.vue +0 -31
  22. package/lib/client/components/global/CodeGroup.d.ts +0 -4
  23. package/lib/client/components/global/CodeGroup.js +0 -106
  24. package/lib/client/components/global/CodeGroupItem.vue +0 -31
  25. package/lib/client/components/global/index.d.ts +0 -4
  26. package/lib/client/components/global/index.js +0 -4
  27. package/lib/client/composables/index.d.ts +0 -6
  28. package/lib/client/composables/index.js +0 -6
  29. package/lib/client/composables/useDarkMode.d.ts +0 -12
  30. package/lib/client/composables/useDarkMode.js +0 -57
  31. package/lib/client/composables/useNavLink.d.ts +0 -14
  32. package/lib/client/composables/useNavLink.js +0 -18
  33. package/lib/client/composables/useResolveRouteWithRedirect.d.ts +0 -5
  34. package/lib/client/composables/useResolveRouteWithRedirect.js +0 -24
  35. package/lib/client/composables/useScrollPromise.d.ts +0 -6
  36. package/lib/client/composables/useScrollPromise.js +0 -14
  37. package/lib/client/composables/useSidebarItems.d.ts +0 -36
  38. package/lib/client/composables/useSidebarItems.js +0 -117
  39. package/lib/client/composables/useThemeData.d.ts +0 -4
  40. package/lib/client/composables/useThemeData.js +0 -3
  41. package/lib/client/config.d.ts +0 -3
  42. package/lib/client/config.js +0 -38
  43. package/lib/client/index.d.ts +0 -4
  44. package/lib/client/index.js +0 -2
  45. package/lib/client/layouts/404.vue +0 -25
  46. package/lib/client/layouts/Layout.vue +0 -134
  47. package/lib/client/shim.d.ts +0 -5
  48. package/lib/client/styles/_mixins.scss +0 -20
  49. package/lib/client/styles/_variables.scss +0 -11
  50. package/lib/client/styles/arrow.scss +0 -37
  51. package/lib/client/styles/badge.scss +0 -31
  52. package/lib/client/styles/code-group.scss +0 -69
  53. package/lib/client/styles/code.scss +0 -266
  54. package/lib/client/styles/custom-container.scss +0 -88
  55. package/lib/client/styles/home.scss +0 -168
  56. package/lib/client/styles/index.scss +0 -19
  57. package/lib/client/styles/layout.scss +0 -198
  58. package/lib/client/styles/navbar-dropdown.scss +0 -187
  59. package/lib/client/styles/navbar.scss +0 -177
  60. package/lib/client/styles/normalize.scss +0 -176
  61. package/lib/client/styles/page.scss +0 -83
  62. package/lib/client/styles/sidebar.scss +0 -134
  63. package/lib/client/styles/toc.scss +0 -5
  64. package/lib/client/styles/transitions.scss +0 -22
  65. package/lib/client/styles/vars-dark.scss +0 -46
  66. package/lib/client/styles/vars.scss +0 -133
  67. package/lib/client/utils/index.d.ts +0 -3
  68. package/lib/client/utils/index.js +0 -3
  69. package/lib/client/utils/isActiveSidebarItem.d.ts +0 -3
  70. package/lib/client/utils/isActiveSidebarItem.js +0 -20
  71. package/lib/client/utils/resolveEditLink.d.ts +0 -9
  72. package/lib/client/utils/resolveEditLink.js +0 -29
  73. package/lib/client/utils/resolveRepoType.d.ts +0 -2
  74. package/lib/client/utils/resolveRepoType.js +0 -12
  75. package/lib/node/defaultTheme.d.ts +0 -10
  76. package/lib/node/defaultTheme.js +0 -119
  77. package/lib/node/index.d.ts +0 -5
  78. package/lib/node/index.js +0 -21
  79. package/lib/node/utils/assignDefaultLocaleOptions.d.ts +0 -7
  80. package/lib/node/utils/assignDefaultLocaleOptions.js +0 -60
  81. package/lib/node/utils/index.d.ts +0 -2
  82. package/lib/node/utils/index.js +0 -18
  83. package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
  84. package/lib/node/utils/resolveContainerPluginOptions.js +0 -21
  85. package/lib/shared/index.d.ts +0 -3
  86. package/lib/shared/index.js +0 -19
  87. package/lib/shared/nav.d.ts +0 -43
  88. package/lib/shared/nav.js +0 -2
  89. package/lib/shared/options.d.ts +0 -243
  90. package/lib/shared/options.js +0 -2
  91. package/lib/shared/page.d.ts +0 -40
  92. package/lib/shared/page.js +0 -2
  93. package/templates/build.html +0 -33
@@ -1,106 +0,0 @@
1
- import { defineComponent, h, onBeforeUpdate, ref } from 'vue';
2
- export const CodeGroup = defineComponent({
3
- name: 'CodeGroup',
4
- setup(_, { slots }) {
5
- // index of current active item
6
- const activeIndex = ref(-1);
7
- // refs of the tab buttons
8
- const tabRefs = ref([]);
9
- if (__VUEPRESS_DEV__) {
10
- // after removing a code-group-item, we need to clear the ref
11
- // of the removed item to avoid issues caused by HMR
12
- onBeforeUpdate(() => {
13
- tabRefs.value = [];
14
- });
15
- }
16
- // activate next tab
17
- const activateNext = (i = activeIndex.value) => {
18
- if (i < tabRefs.value.length - 1) {
19
- activeIndex.value = i + 1;
20
- }
21
- else {
22
- activeIndex.value = 0;
23
- }
24
- tabRefs.value[activeIndex.value].focus();
25
- };
26
- // activate previous tab
27
- const activatePrev = (i = activeIndex.value) => {
28
- if (i > 0) {
29
- activeIndex.value = i - 1;
30
- }
31
- else {
32
- activeIndex.value = tabRefs.value.length - 1;
33
- }
34
- tabRefs.value[activeIndex.value].focus();
35
- };
36
- // handle keyboard event
37
- const keyboardHandler = (event, i) => {
38
- if (event.key === ' ' || event.key === 'Enter') {
39
- event.preventDefault();
40
- activeIndex.value = i;
41
- }
42
- else if (event.key === 'ArrowRight') {
43
- event.preventDefault();
44
- activateNext(i);
45
- }
46
- else if (event.key === 'ArrowLeft') {
47
- event.preventDefault();
48
- activatePrev(i);
49
- }
50
- };
51
- return () => {
52
- // NOTICE: here we put the `slots.default()` inside the render function to make
53
- // the slots reactive, otherwise the slot content won't be changed once the
54
- // `setup()` function of current component is called
55
- // get children code-group-item
56
- const items = (slots.default?.() || [])
57
- .filter((vnode) => vnode.type.name === 'CodeGroupItem')
58
- .map((vnode) => {
59
- if (vnode.props === null) {
60
- vnode.props = {};
61
- }
62
- return vnode;
63
- });
64
- // do not render anything if there is no code-group-item
65
- if (items.length === 0) {
66
- return null;
67
- }
68
- if (activeIndex.value < 0 || activeIndex.value > items.length - 1) {
69
- // if `activeIndex` is invalid
70
- // find the index of the code-group-item with `active` props
71
- activeIndex.value = items.findIndex((vnode) => vnode.props.active === '' || vnode.props.active === true);
72
- // if there is no `active` props on code-group-item, set the first item active
73
- if (activeIndex.value === -1) {
74
- activeIndex.value = 0;
75
- }
76
- }
77
- else {
78
- // set the active item
79
- items.forEach((vnode, i) => {
80
- vnode.props.active = i === activeIndex.value;
81
- });
82
- }
83
- return h('div', { class: 'code-group' }, [
84
- h('div', { class: 'code-group__nav' }, h('ul', { class: 'code-group__ul' }, items.map((vnode, i) => {
85
- const isActive = i === activeIndex.value;
86
- return h('li', { class: 'code-group__li' }, h('button', {
87
- ref: (element) => {
88
- if (element) {
89
- tabRefs.value[i] = element;
90
- }
91
- },
92
- class: {
93
- 'code-group__nav-tab': true,
94
- 'code-group__nav-tab-active': isActive,
95
- },
96
- ariaPressed: isActive,
97
- ariaExpanded: isActive,
98
- onClick: () => (activeIndex.value = i),
99
- onKeydown: (e) => keyboardHandler(e, i),
100
- }, vnode.props.title));
101
- }))),
102
- items,
103
- ]);
104
- };
105
- },
106
- });
@@ -1,31 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue'
3
-
4
- export default defineComponent({
5
- name: 'CodeGroupItem',
6
- })
7
- </script>
8
-
9
- <script setup lang="ts">
10
- defineProps({
11
- title: {
12
- type: String,
13
- required: true,
14
- },
15
- active: {
16
- type: Boolean,
17
- required: false,
18
- default: false,
19
- },
20
- })
21
- </script>
22
-
23
- <template>
24
- <div
25
- class="code-group-item"
26
- :class="{ 'code-group-item__active': active }"
27
- :aria-selected="active"
28
- >
29
- <slot />
30
- </div>
31
- </template>
@@ -1,4 +0,0 @@
1
- import Badge from './Badge.vue';
2
- import { CodeGroup } from './CodeGroup';
3
- import CodeGroupItem from './CodeGroupItem.vue';
4
- export { Badge, CodeGroup, CodeGroupItem };
@@ -1,4 +0,0 @@
1
- import Badge from './Badge.vue';
2
- import { CodeGroup } from './CodeGroup';
3
- import CodeGroupItem from './CodeGroupItem.vue';
4
- export { Badge, CodeGroup, CodeGroupItem };
@@ -1,6 +0,0 @@
1
- export * from './useDarkMode';
2
- export * from './useNavLink';
3
- export * from './useResolveRouteWithRedirect';
4
- export * from './useScrollPromise';
5
- export * from './useSidebarItems';
6
- export * from './useThemeData';
@@ -1,6 +0,0 @@
1
- export * from './useDarkMode';
2
- export * from './useNavLink';
3
- export * from './useResolveRouteWithRedirect';
4
- export * from './useScrollPromise';
5
- export * from './useSidebarItems';
6
- export * from './useThemeData';
@@ -1,12 +0,0 @@
1
- import type { InjectionKey, WritableComputedRef } from 'vue';
2
- export declare type DarkModeRef = WritableComputedRef<boolean>;
3
- export declare const darkModeSymbol: InjectionKey<DarkModeRef>;
4
- /**
5
- * Inject dark mode global computed
6
- */
7
- export declare const useDarkMode: () => DarkModeRef;
8
- /**
9
- * Create dark mode ref and provide as global computed in setup
10
- */
11
- export declare const setupDarkMode: () => void;
12
- export declare const updateHtmlDarkClass: (isDarkMode: DarkModeRef) => void;
@@ -1,57 +0,0 @@
1
- import { usePreferredDark, useStorage } from '@vueuse/core';
2
- import { computed, inject, onMounted, onUnmounted, provide, watch } from 'vue';
3
- import { useThemeLocaleData } from '.';
4
- export const darkModeSymbol = Symbol(__VUEPRESS_DEV__ ? 'darkMode' : '');
5
- /**
6
- * Inject dark mode global computed
7
- */
8
- export const useDarkMode = () => {
9
- const isDarkMode = inject(darkModeSymbol);
10
- if (!isDarkMode) {
11
- throw new Error('useDarkMode() is called without provider.');
12
- }
13
- return isDarkMode;
14
- };
15
- /**
16
- * Create dark mode ref and provide as global computed in setup
17
- */
18
- export const setupDarkMode = () => {
19
- const themeLocale = useThemeLocaleData();
20
- const isDarkPreferred = usePreferredDark();
21
- const darkStorage = useStorage('vuepress-color-scheme', themeLocale.value.colorMode);
22
- const isDarkMode = computed({
23
- get() {
24
- // disable color mode switching
25
- if (!themeLocale.value.colorModeSwitch) {
26
- return themeLocale.value.colorMode === 'dark';
27
- }
28
- // auto detected from prefers-color-scheme
29
- if (darkStorage.value === 'auto') {
30
- return isDarkPreferred.value;
31
- }
32
- // storage value
33
- return darkStorage.value === 'dark';
34
- },
35
- set(val) {
36
- if (val === isDarkPreferred.value) {
37
- darkStorage.value = 'auto';
38
- }
39
- else {
40
- darkStorage.value = val ? 'dark' : 'light';
41
- }
42
- },
43
- });
44
- provide(darkModeSymbol, isDarkMode);
45
- updateHtmlDarkClass(isDarkMode);
46
- };
47
- export const updateHtmlDarkClass = (isDarkMode) => {
48
- const update = (value = isDarkMode.value) => {
49
- // set `class="dark"` on `<html>` element
50
- const htmlEl = window?.document.querySelector('html');
51
- htmlEl?.classList.toggle('dark', value);
52
- };
53
- onMounted(() => {
54
- watch(isDarkMode, update, { immediate: true });
55
- });
56
- onUnmounted(() => update());
57
- };
@@ -1,14 +0,0 @@
1
- import type { NavLink } from '../../shared';
2
- declare module 'vue-router' {
3
- interface RouteMeta {
4
- title?: string;
5
- }
6
- }
7
- /**
8
- * Resolve NavLink props from string
9
- *
10
- * @example
11
- * - Input: '/README.md'
12
- * - Output: { text: 'Home', link: '/' }
13
- */
14
- export declare const useNavLink: (item: string) => NavLink;
@@ -1,18 +0,0 @@
1
- import { useResolveRouteWithRedirect } from './useResolveRouteWithRedirect';
2
- /**
3
- * Resolve NavLink props from string
4
- *
5
- * @example
6
- * - Input: '/README.md'
7
- * - Output: { text: 'Home', link: '/' }
8
- */
9
- export const useNavLink = (item) => {
10
- // the route path of vue-router is url-encoded, and we expect users are using
11
- // non-url-encoded string in theme config, so we need to url-encode it first to
12
- // resolve the route correctly
13
- const resolved = useResolveRouteWithRedirect(encodeURI(item));
14
- return {
15
- text: resolved.meta.title || item,
16
- link: resolved.name === '404' ? item : resolved.fullPath,
17
- };
18
- };
@@ -1,5 +0,0 @@
1
- import type { Router } from 'vue-router';
2
- /**
3
- * Resolve a route with redirection
4
- */
5
- export declare const useResolveRouteWithRedirect: (to: import("vue-router").RouteLocationRaw, currentLocation?: import("vue-router").RouteLocationNormalizedLoaded | undefined) => ReturnType<Router['resolve']>;
@@ -1,24 +0,0 @@
1
- import { isFunction, isString } from '@vuepress/shared';
2
- import { useRouter } from 'vue-router';
3
- /**
4
- * Resolve a route with redirection
5
- */
6
- export const useResolveRouteWithRedirect = (...args) => {
7
- const router = useRouter();
8
- const route = router.resolve(...args);
9
- const lastMatched = route.matched[route.matched.length - 1];
10
- if (!lastMatched?.redirect) {
11
- return route;
12
- }
13
- const { redirect } = lastMatched;
14
- const resolvedRedirect = isFunction(redirect) ? redirect(route) : redirect;
15
- const resolvedRedirectObj = isString(resolvedRedirect)
16
- ? { path: resolvedRedirect }
17
- : resolvedRedirect;
18
- return useResolveRouteWithRedirect({
19
- hash: route.hash,
20
- query: route.query,
21
- params: route.params,
22
- ...resolvedRedirectObj,
23
- });
24
- };
@@ -1,6 +0,0 @@
1
- export interface ScrollPromise {
2
- wait(): Promise<void> | null;
3
- pending: () => void;
4
- resolve: () => void;
5
- }
6
- export declare const useScrollPromise: () => ScrollPromise;
@@ -1,14 +0,0 @@
1
- let promise = null;
2
- let promiseResolve = null;
3
- const scrollPromise = {
4
- wait: () => promise,
5
- pending: () => {
6
- promise = new Promise((resolve) => (promiseResolve = resolve));
7
- },
8
- resolve: () => {
9
- promiseResolve?.();
10
- promise = null;
11
- promiseResolve = null;
12
- },
13
- };
14
- export const useScrollPromise = () => scrollPromise;
@@ -1,36 +0,0 @@
1
- import type { PageHeader } from '@vuepress/client';
2
- import type { ComputedRef, InjectionKey } from 'vue';
3
- import type { DefaultThemeData, DefaultThemeNormalPageFrontmatter, ResolvedSidebarItem, SidebarConfigArray, SidebarConfigObject } from '../../shared';
4
- export declare type SidebarItemsRef = ComputedRef<ResolvedSidebarItem[]>;
5
- export declare const sidebarItemsSymbol: InjectionKey<SidebarItemsRef>;
6
- /**
7
- * Inject sidebar items global computed
8
- */
9
- export declare const useSidebarItems: () => SidebarItemsRef;
10
- /**
11
- * Create sidebar items ref and provide as global computed in setup
12
- */
13
- export declare const setupSidebarItems: () => void;
14
- /**
15
- * Resolve sidebar items global computed
16
- *
17
- * It should only be resolved and provided once
18
- */
19
- export declare const resolveSidebarItems: (frontmatter: DefaultThemeNormalPageFrontmatter, themeLocale: DefaultThemeData) => ResolvedSidebarItem[];
20
- /**
21
- * Util to transform page header to sidebar item
22
- */
23
- export declare const headerToSidebarItem: (header: PageHeader, sidebarDepth: number) => ResolvedSidebarItem;
24
- export declare const headersToSidebarItemChildren: (headers: PageHeader[], sidebarDepth: number) => ResolvedSidebarItem[];
25
- /**
26
- * Resolve sidebar items if the config is `auto`
27
- */
28
- export declare const resolveAutoSidebarItems: (sidebarDepth: number) => ResolvedSidebarItem[];
29
- /**
30
- * Resolve sidebar items if the config is an array
31
- */
32
- export declare const resolveArraySidebarItems: (sidebarConfig: SidebarConfigArray, sidebarDepth: number) => ResolvedSidebarItem[];
33
- /**
34
- * Resolve sidebar items if the config is a key -> value (path-prefix -> array) object
35
- */
36
- export declare const resolveMultiSidebarItems: (sidebarConfig: SidebarConfigObject, sidebarDepth: number) => ResolvedSidebarItem[];
@@ -1,117 +0,0 @@
1
- import { usePageData, usePageFrontmatter } from '@vuepress/client';
2
- import { isArray, isPlainObject, isString, resolveLocalePath, } from '@vuepress/shared';
3
- import { computed, inject, provide } from 'vue';
4
- import { useRoute } from 'vue-router';
5
- import { useNavLink, useThemeLocaleData } from '.';
6
- export const sidebarItemsSymbol = Symbol('sidebarItems');
7
- /**
8
- * Inject sidebar items global computed
9
- */
10
- export const useSidebarItems = () => {
11
- const sidebarItems = inject(sidebarItemsSymbol);
12
- if (!sidebarItems) {
13
- throw new Error('useSidebarItems() is called without provider.');
14
- }
15
- return sidebarItems;
16
- };
17
- /**
18
- * Create sidebar items ref and provide as global computed in setup
19
- */
20
- export const setupSidebarItems = () => {
21
- const themeLocale = useThemeLocaleData();
22
- const frontmatter = usePageFrontmatter();
23
- const sidebarItems = computed(() => resolveSidebarItems(frontmatter.value, themeLocale.value));
24
- provide(sidebarItemsSymbol, sidebarItems);
25
- };
26
- /**
27
- * Resolve sidebar items global computed
28
- *
29
- * It should only be resolved and provided once
30
- */
31
- export const resolveSidebarItems = (frontmatter, themeLocale) => {
32
- // get sidebar config from frontmatter > theme data
33
- const sidebarConfig = frontmatter.sidebar ?? themeLocale.sidebar ?? 'auto';
34
- const sidebarDepth = frontmatter.sidebarDepth ?? themeLocale.sidebarDepth ?? 2;
35
- // resolve sidebar items according to the config
36
- if (frontmatter.home || sidebarConfig === false) {
37
- return [];
38
- }
39
- if (sidebarConfig === 'auto') {
40
- return resolveAutoSidebarItems(sidebarDepth);
41
- }
42
- if (isArray(sidebarConfig)) {
43
- return resolveArraySidebarItems(sidebarConfig, sidebarDepth);
44
- }
45
- if (isPlainObject(sidebarConfig)) {
46
- return resolveMultiSidebarItems(sidebarConfig, sidebarDepth);
47
- }
48
- return [];
49
- };
50
- /**
51
- * Util to transform page header to sidebar item
52
- */
53
- export const headerToSidebarItem = (header, sidebarDepth) => ({
54
- text: header.title,
55
- link: `#${header.slug}`,
56
- children: headersToSidebarItemChildren(header.children, sidebarDepth),
57
- });
58
- export const headersToSidebarItemChildren = (headers, sidebarDepth) => sidebarDepth > 0
59
- ? headers.map((header) => headerToSidebarItem(header, sidebarDepth - 1))
60
- : [];
61
- /**
62
- * Resolve sidebar items if the config is `auto`
63
- */
64
- export const resolveAutoSidebarItems = (sidebarDepth) => {
65
- const page = usePageData();
66
- return [
67
- {
68
- text: page.value.title,
69
- children: headersToSidebarItemChildren(page.value.headers, sidebarDepth),
70
- },
71
- ];
72
- };
73
- /**
74
- * Resolve sidebar items if the config is an array
75
- */
76
- export const resolveArraySidebarItems = (sidebarConfig, sidebarDepth) => {
77
- const route = useRoute();
78
- const page = usePageData();
79
- const handleChildItem = (item) => {
80
- let childItem;
81
- if (isString(item)) {
82
- childItem = useNavLink(item);
83
- }
84
- else {
85
- childItem = item;
86
- }
87
- if (childItem.children) {
88
- return {
89
- ...childItem,
90
- children: childItem.children.map((item) => handleChildItem(item)),
91
- };
92
- }
93
- // if the sidebar item is current page and children is not set
94
- // use headers of current page as children
95
- if (childItem.link === route.path) {
96
- // skip h1 header
97
- const headers = page.value.headers[0]?.level === 1
98
- ? page.value.headers[0].children
99
- : page.value.headers;
100
- return {
101
- ...childItem,
102
- children: headersToSidebarItemChildren(headers, sidebarDepth),
103
- };
104
- }
105
- return childItem;
106
- };
107
- return sidebarConfig.map((item) => handleChildItem(item));
108
- };
109
- /**
110
- * Resolve sidebar items if the config is a key -> value (path-prefix -> array) object
111
- */
112
- export const resolveMultiSidebarItems = (sidebarConfig, sidebarDepth) => {
113
- const route = useRoute();
114
- const sidebarPath = resolveLocalePath(sidebarConfig, route.path);
115
- const matchedSidebarConfig = sidebarConfig[sidebarPath] ?? [];
116
- return resolveArraySidebarItems(matchedSidebarConfig, sidebarDepth);
117
- };
@@ -1,4 +0,0 @@
1
- import type { ThemeDataRef, ThemeLocaleDataRef } from '@vuepress/plugin-theme-data/lib/client';
2
- import type { DefaultThemeData } from '../../shared';
3
- export declare const useThemeData: () => ThemeDataRef<DefaultThemeData>;
4
- export declare const useThemeLocaleData: () => ThemeLocaleDataRef<DefaultThemeData>;
@@ -1,3 +0,0 @@
1
- import { useThemeData as _useThemeData, useThemeLocaleData as _useThemeLocaleData, } from '@vuepress/plugin-theme-data/lib/client';
2
- export const useThemeData = () => _useThemeData();
3
- export const useThemeLocaleData = () => _useThemeLocaleData();
@@ -1,3 +0,0 @@
1
- import './styles/index.scss';
2
- declare const _default: import("@vuepress/client").ClientConfig;
3
- export default _default;
@@ -1,38 +0,0 @@
1
- import { defineClientConfig } from '@vuepress/client';
2
- import { h } from 'vue';
3
- import { Badge, CodeGroup, CodeGroupItem } from './components/global';
4
- import { setupDarkMode, setupSidebarItems, useScrollPromise, } from './composables';
5
- import './styles/index.scss';
6
- export default defineClientConfig({
7
- enhance({ app, router }) {
8
- app.component('Badge', Badge);
9
- app.component('CodeGroup', CodeGroup);
10
- app.component('CodeGroupItem', CodeGroupItem);
11
- // compat with @vuepress/plugin-external-link-icon
12
- app.component('AutoLinkExternalIcon', () => {
13
- const ExternalLinkIcon = app.component('ExternalLinkIcon');
14
- if (ExternalLinkIcon) {
15
- return h(ExternalLinkIcon);
16
- }
17
- return null;
18
- });
19
- // compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
20
- app.component('NavbarSearch', () => {
21
- const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
22
- if (SearchComponent) {
23
- return h(SearchComponent);
24
- }
25
- return null;
26
- });
27
- // handle scrollBehavior with transition
28
- const scrollBehavior = router.options.scrollBehavior;
29
- router.options.scrollBehavior = async (...args) => {
30
- await useScrollPromise().wait();
31
- return scrollBehavior(...args);
32
- };
33
- },
34
- setup() {
35
- setupDarkMode();
36
- setupSidebarItems();
37
- },
38
- });
@@ -1,4 +0,0 @@
1
- import type { DefaultThemeData, DefaultThemeHomePageFrontmatter, DefaultThemeLocaleData, DefaultThemeLocaleOptions, DefaultThemeNormalPageFrontmatter, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemePluginsOptions, NavbarConfig, NavbarGroup, NavbarItem, NavGroup, NavItem, NavLink, ResolvedNavbarItem, ResolvedSidebarItem, SidebarConfig, SidebarConfigArray, SidebarConfigObject, SidebarGroup, SidebarGroupCollapsible, SidebarItem } from '../shared';
2
- export type { DefaultThemeData, DefaultThemeHomePageFrontmatter, DefaultThemeLocaleData, DefaultThemeLocaleOptions, DefaultThemeNormalPageFrontmatter, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemePluginsOptions, NavbarConfig, NavbarGroup, NavbarItem, NavGroup, NavItem, NavLink, ResolvedNavbarItem, ResolvedSidebarItem, SidebarConfig, SidebarConfigArray, SidebarConfigObject, SidebarGroup, SidebarGroupCollapsible, SidebarItem, };
3
- export * from './composables';
4
- export * from './utils';
@@ -1,2 +0,0 @@
1
- export * from './composables';
2
- export * from './utils';
@@ -1,25 +0,0 @@
1
- <script setup lang="ts">
2
- import { useRouteLocale } from '@vuepress/client'
3
- import { useThemeLocaleData } from '../composables'
4
-
5
- const routeLocale = useRouteLocale()
6
- const themeLocale = useThemeLocaleData()
7
-
8
- const messages = themeLocale.value.notFound ?? ['Not Found']
9
- const getMsg = (): string =>
10
- messages[Math.floor(Math.random() * messages.length)]
11
- const homeLink = themeLocale.value.home ?? routeLocale.value
12
- const homeText = themeLocale.value.backToHome ?? 'Back to home'
13
- </script>
14
-
15
- <template>
16
- <div class="theme-container">
17
- <div class="theme-default-content">
18
- <h1>404</h1>
19
-
20
- <blockquote>{{ getMsg() }}</blockquote>
21
-
22
- <RouterLink :to="homeLink">{{ homeText }}</RouterLink>
23
- </div>
24
- </div>
25
- </template>