themekit-js 1.1.0

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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/bin/themekit.js +2 -0
  4. package/client.d.ts +5 -0
  5. package/dist/client/app/components/ClientOnly.js +10 -0
  6. package/dist/client/app/components/Content.js +23 -0
  7. package/dist/client/app/composables/codeGroups.js +40 -0
  8. package/dist/client/app/composables/copyCode.js +73 -0
  9. package/dist/client/app/composables/head.js +81 -0
  10. package/dist/client/app/composables/preFetch.js +99 -0
  11. package/dist/client/app/data.js +59 -0
  12. package/dist/client/app/devtools.js +29 -0
  13. package/dist/client/app/index.js +140 -0
  14. package/dist/client/app/router.js +233 -0
  15. package/dist/client/app/ssr.js +10 -0
  16. package/dist/client/app/theme.js +1 -0
  17. package/dist/client/app/utils.js +119 -0
  18. package/dist/client/index.d.ts +1446 -0
  19. package/dist/client/index.js +9 -0
  20. package/dist/client/shared.js +139 -0
  21. package/dist/client/theme-default/Layout.vue +94 -0
  22. package/dist/client/theme-default/NotFound.vue +109 -0
  23. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +99 -0
  24. package/dist/client/theme-default/components/VPBackdrop.vue +41 -0
  25. package/dist/client/theme-default/components/VPBadge.vue +86 -0
  26. package/dist/client/theme-default/components/VPButton.vue +123 -0
  27. package/dist/client/theme-default/components/VPCarbonAds.vue +109 -0
  28. package/dist/client/theme-default/components/VPContent.vue +98 -0
  29. package/dist/client/theme-default/components/VPDoc.vue +193 -0
  30. package/dist/client/theme-default/components/VPDocAside.vue +46 -0
  31. package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +18 -0
  32. package/dist/client/theme-default/components/VPDocAsideOutline.vue +87 -0
  33. package/dist/client/theme-default/components/VPDocAsideSponsors.vue +17 -0
  34. package/dist/client/theme-default/components/VPDocFooter.vue +145 -0
  35. package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +50 -0
  36. package/dist/client/theme-default/components/VPDocOutlineItem.vue +59 -0
  37. package/dist/client/theme-default/components/VPFeature.vue +123 -0
  38. package/dist/client/theme-default/components/VPFeatures.vue +121 -0
  39. package/dist/client/theme-default/components/VPFlyout.vue +136 -0
  40. package/dist/client/theme-default/components/VPFooter.vue +60 -0
  41. package/dist/client/theme-default/components/VPHero.vue +336 -0
  42. package/dist/client/theme-default/components/VPHome.vue +43 -0
  43. package/dist/client/theme-default/components/VPHomeContent.vue +52 -0
  44. package/dist/client/theme-default/components/VPHomeFeatures.vue +14 -0
  45. package/dist/client/theme-default/components/VPHomeHero.vue +24 -0
  46. package/dist/client/theme-default/components/VPHomeSponsors.vue +116 -0
  47. package/dist/client/theme-default/components/VPImage.vue +46 -0
  48. package/dist/client/theme-default/components/VPLink.vue +33 -0
  49. package/dist/client/theme-default/components/VPLocalNav.vue +171 -0
  50. package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.vue +190 -0
  51. package/dist/client/theme-default/components/VPLocalSearchBox.vue +856 -0
  52. package/dist/client/theme-default/components/VPMenu.vue +72 -0
  53. package/dist/client/theme-default/components/VPMenuGroup.vue +47 -0
  54. package/dist/client/theme-default/components/VPMenuLink.vue +54 -0
  55. package/dist/client/theme-default/components/VPNav.vue +57 -0
  56. package/dist/client/theme-default/components/VPNavBar.vue +267 -0
  57. package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
  58. package/dist/client/theme-default/components/VPNavBarExtra.vue +94 -0
  59. package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
  60. package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
  61. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +42 -0
  62. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +53 -0
  63. package/dist/client/theme-default/components/VPNavBarSearch.vue +194 -0
  64. package/dist/client/theme-default/components/VPNavBarSearchButton.vue +208 -0
  65. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
  66. package/dist/client/theme-default/components/VPNavBarTitle.vue +76 -0
  67. package/dist/client/theme-default/components/VPNavBarTranslations.vue +47 -0
  68. package/dist/client/theme-default/components/VPNavScreen.vue +99 -0
  69. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
  70. package/dist/client/theme-default/components/VPNavScreenMenu.vue +23 -0
  71. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +111 -0
  72. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +39 -0
  73. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +34 -0
  74. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +39 -0
  75. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
  76. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
  77. package/dist/client/theme-default/components/VPPage.vue +7 -0
  78. package/dist/client/theme-default/components/VPSidebar.vue +137 -0
  79. package/dist/client/theme-default/components/VPSidebarItem.vue +250 -0
  80. package/dist/client/theme-default/components/VPSkipLink.vue +68 -0
  81. package/dist/client/theme-default/components/VPSocialLink.vue +50 -0
  82. package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
  83. package/dist/client/theme-default/components/VPSponsors.vue +48 -0
  84. package/dist/client/theme-default/components/VPSponsorsGrid.vue +48 -0
  85. package/dist/client/theme-default/components/VPSwitch.vue +63 -0
  86. package/dist/client/theme-default/components/VPSwitchAppearance.vue +52 -0
  87. package/dist/client/theme-default/components/VPTeamMembers.vue +66 -0
  88. package/dist/client/theme-default/components/VPTeamMembersItem.vue +225 -0
  89. package/dist/client/theme-default/components/VPTeamPage.vue +58 -0
  90. package/dist/client/theme-default/components/VPTeamPageSection.vue +77 -0
  91. package/dist/client/theme-default/components/VPTeamPageTitle.vue +63 -0
  92. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
  93. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
  94. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
  95. package/dist/client/theme-default/components/icons/VPIconArrowLeft.vue +7 -0
  96. package/dist/client/theme-default/components/icons/VPIconArrowRight.vue +7 -0
  97. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
  98. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
  99. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
  100. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
  101. package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
  102. package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
  103. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
  104. package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
  105. package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
  106. package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
  107. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
  108. package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
  109. package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
  110. package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
  111. package/dist/client/theme-default/composables/aside.js +17 -0
  112. package/dist/client/theme-default/composables/data.js +2 -0
  113. package/dist/client/theme-default/composables/edit-link.js +16 -0
  114. package/dist/client/theme-default/composables/flyout.js +41 -0
  115. package/dist/client/theme-default/composables/langs.js +26 -0
  116. package/dist/client/theme-default/composables/local-nav.js +18 -0
  117. package/dist/client/theme-default/composables/nav.js +30 -0
  118. package/dist/client/theme-default/composables/outline.js +178 -0
  119. package/dist/client/theme-default/composables/prev-next.js +57 -0
  120. package/dist/client/theme-default/composables/sidebar.js +136 -0
  121. package/dist/client/theme-default/composables/sponsor-grid.js +94 -0
  122. package/dist/client/theme-default/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
  123. package/dist/client/theme-default/fonts/inter-italic-cyrillic.woff2 +0 -0
  124. package/dist/client/theme-default/fonts/inter-italic-greek-ext.woff2 +0 -0
  125. package/dist/client/theme-default/fonts/inter-italic-greek.woff2 +0 -0
  126. package/dist/client/theme-default/fonts/inter-italic-latin-ext.woff2 +0 -0
  127. package/dist/client/theme-default/fonts/inter-italic-latin.woff2 +0 -0
  128. package/dist/client/theme-default/fonts/inter-italic-vietnamese.woff2 +0 -0
  129. package/dist/client/theme-default/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
  130. package/dist/client/theme-default/fonts/inter-roman-cyrillic.woff2 +0 -0
  131. package/dist/client/theme-default/fonts/inter-roman-greek-ext.woff2 +0 -0
  132. package/dist/client/theme-default/fonts/inter-roman-greek.woff2 +0 -0
  133. package/dist/client/theme-default/fonts/inter-roman-latin-ext.woff2 +0 -0
  134. package/dist/client/theme-default/fonts/inter-roman-latin.woff2 +0 -0
  135. package/dist/client/theme-default/fonts/inter-roman-vietnamese.woff2 +0 -0
  136. package/dist/client/theme-default/index.js +3 -0
  137. package/dist/client/theme-default/styles/base.css +252 -0
  138. package/dist/client/theme-default/styles/components/custom-block.css +208 -0
  139. package/dist/client/theme-default/styles/components/vp-code-group.css +85 -0
  140. package/dist/client/theme-default/styles/components/vp-code.css +7 -0
  141. package/dist/client/theme-default/styles/components/vp-doc.css +570 -0
  142. package/dist/client/theme-default/styles/components/vp-sponsor.css +155 -0
  143. package/dist/client/theme-default/styles/fonts.css +157 -0
  144. package/dist/client/theme-default/styles/icons.css +123 -0
  145. package/dist/client/theme-default/styles/utils.css +9 -0
  146. package/dist/client/theme-default/styles/vars.css +563 -0
  147. package/dist/client/theme-default/support/lru.js +33 -0
  148. package/dist/client/theme-default/support/sidebar.js +89 -0
  149. package/dist/client/theme-default/support/translation.js +49 -0
  150. package/dist/client/theme-default/support/utils.js +33 -0
  151. package/dist/client/theme-default/without-fonts.js +32 -0
  152. package/dist/node/cli.js +444 -0
  153. package/dist/node/index.d.ts +4588 -0
  154. package/dist/node/index.js +198 -0
  155. package/dist/node/serve-BjvG349_.js +50301 -0
  156. package/lib/vue-demi.mjs +34 -0
  157. package/package.json +223 -0
  158. package/template/.vitepress/config.js +28 -0
  159. package/template/.vitepress/theme/Layout.vue +21 -0
  160. package/template/.vitepress/theme/index.js +29 -0
  161. package/template/.vitepress/theme/style.css +143 -0
  162. package/template/api-examples.md +49 -0
  163. package/template/index.md +28 -0
  164. package/template/markdown-examples.md +85 -0
  165. package/theme-without-fonts.d.ts +2 -0
  166. package/theme.d.ts +30 -0
  167. package/types/default-theme.d.ts +533 -0
  168. package/types/docsearch.d.ts +144 -0
  169. package/types/index.d.ts +3 -0
  170. package/types/local-search.d.ts +33 -0
  171. package/types/shared.d.ts +199 -0
@@ -0,0 +1,9 @@
1
+ // exports in this file are exposed to themes and md files via 'vitepress'
2
+ // so the user can do `import { useRoute, useData } from 'vitepress'`
3
+ // composables
4
+ export { useData, dataSymbol } from './app/data';
5
+ export { useRoute, useRouter } from './app/router';
6
+ // utilities
7
+ export { inBrowser, onContentUpdated, defineClientComponent, withBase, getScrollOffset } from './app/utils';
8
+ // components
9
+ export { Content } from './app/components/Content';
@@ -0,0 +1,139 @@
1
+ export const EXTERNAL_URL_RE = /^(?:[a-z]+:|\/\/)/i;
2
+ export const APPEARANCE_KEY = 'vitepress-theme-appearance';
3
+ const HASH_RE = /#.*$/;
4
+ const HASH_OR_QUERY_RE = /[?#].*$/;
5
+ const INDEX_OR_EXT_RE = /(?:(^|\/)index)?\.(?:md|html)$/;
6
+ export const inBrowser = typeof document !== 'undefined';
7
+ export const notFoundPageData = {
8
+ relativePath: '',
9
+ filePath: '',
10
+ title: '404',
11
+ description: 'Not Found',
12
+ headers: [],
13
+ frontmatter: { sidebar: false, layout: 'page' },
14
+ lastUpdated: 0,
15
+ isNotFound: true
16
+ };
17
+ export function isActive(currentPath, matchPath, asRegex = false) {
18
+ if (matchPath === undefined) {
19
+ return false;
20
+ }
21
+ currentPath = normalize(`/${currentPath}`);
22
+ if (asRegex) {
23
+ return new RegExp(matchPath).test(currentPath);
24
+ }
25
+ if (normalize(matchPath) !== currentPath) {
26
+ return false;
27
+ }
28
+ const hashMatch = matchPath.match(HASH_RE);
29
+ if (hashMatch) {
30
+ return (inBrowser ? location.hash : '') === hashMatch[0];
31
+ }
32
+ return true;
33
+ }
34
+ function normalize(path) {
35
+ return decodeURI(path)
36
+ .replace(HASH_OR_QUERY_RE, '')
37
+ .replace(INDEX_OR_EXT_RE, '$1');
38
+ }
39
+ export function isExternal(path) {
40
+ return EXTERNAL_URL_RE.test(path);
41
+ }
42
+ /**
43
+ * this merges the locales data to the main data by the route
44
+ */
45
+ export function resolveSiteDataByRoute(siteData, relativePath) {
46
+ const localeIndex = Object.keys(siteData.locales).find((key) => key !== 'root' &&
47
+ !isExternal(key) &&
48
+ isActive(relativePath, `/${key}/`, true)) || 'root';
49
+ return Object.assign({}, siteData, {
50
+ localeIndex,
51
+ lang: siteData.locales[localeIndex]?.lang ?? siteData.lang,
52
+ dir: siteData.locales[localeIndex]?.dir ?? siteData.dir,
53
+ title: siteData.locales[localeIndex]?.title ?? siteData.title,
54
+ titleTemplate: siteData.locales[localeIndex]?.titleTemplate ?? siteData.titleTemplate,
55
+ description: siteData.locales[localeIndex]?.description ?? siteData.description,
56
+ head: mergeHead(siteData.head, siteData.locales[localeIndex]?.head ?? []),
57
+ themeConfig: {
58
+ ...siteData.themeConfig,
59
+ ...siteData.locales[localeIndex]?.themeConfig
60
+ }
61
+ });
62
+ }
63
+ /**
64
+ * Create the page title string based on config.
65
+ */
66
+ export function createTitle(siteData, pageData) {
67
+ const title = pageData.title || siteData.title;
68
+ const template = pageData.titleTemplate ?? siteData.titleTemplate;
69
+ if (typeof template === 'string' && template.includes(':title')) {
70
+ return template.replace(/:title/g, title);
71
+ }
72
+ const templateString = createTitleTemplate(siteData.title, template);
73
+ if (title === templateString.slice(3)) {
74
+ return title;
75
+ }
76
+ return `${title}${templateString}`;
77
+ }
78
+ function createTitleTemplate(siteTitle, template) {
79
+ if (template === false) {
80
+ return '';
81
+ }
82
+ if (template === true || template === undefined) {
83
+ return ` | ${siteTitle}`;
84
+ }
85
+ if (siteTitle === template) {
86
+ return '';
87
+ }
88
+ return ` | ${template}`;
89
+ }
90
+ function hasTag(head, tag) {
91
+ const [tagType, tagAttrs] = tag;
92
+ if (tagType !== 'meta')
93
+ return false;
94
+ const keyAttr = Object.entries(tagAttrs)[0]; // First key
95
+ if (keyAttr == null)
96
+ return false;
97
+ return head.some(([type, attrs]) => type === tagType && attrs[keyAttr[0]] === keyAttr[1]);
98
+ }
99
+ export function mergeHead(prev, curr) {
100
+ return [...prev.filter((tagAttrs) => !hasTag(curr, tagAttrs)), ...curr];
101
+ }
102
+ // https://github.com/rollup/rollup/blob/fec513270c6ac350072425cc045db367656c623b/src/utils/sanitizeFileName.ts
103
+ const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$&*+,:;<=>?[\]^`{|}\u007F]/g;
104
+ const DRIVE_LETTER_REGEX = /^[a-z]:/i;
105
+ export function sanitizeFileName(name) {
106
+ const match = DRIVE_LETTER_REGEX.exec(name);
107
+ const driveLetter = match ? match[0] : '';
108
+ return (driveLetter +
109
+ name
110
+ .slice(driveLetter.length)
111
+ .replace(INVALID_CHAR_REGEX, '_')
112
+ .replace(/(^|\/)_+(?=[^/]*$)/, '$1'));
113
+ }
114
+ export function slash(p) {
115
+ return p.replace(/\\/g, '/');
116
+ }
117
+ const KNOWN_EXTENSIONS = new Set();
118
+ export function treatAsHtml(filename) {
119
+ if (KNOWN_EXTENSIONS.size === 0) {
120
+ const extraExts = (typeof process === 'object' && process.env?.VITE_EXTRA_EXTENSIONS) ||
121
+ import.meta.env?.VITE_EXTRA_EXTENSIONS ||
122
+ '';
123
+ ('3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,' +
124
+ 'doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,' +
125
+ 'man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,' +
126
+ 'opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,' +
127
+ 'tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,' +
128
+ 'yaml,yml,zip' +
129
+ (extraExts && typeof extraExts === 'string' ? ',' + extraExts : ''))
130
+ .split(',')
131
+ .forEach((ext) => KNOWN_EXTENSIONS.add(ext));
132
+ }
133
+ const ext = filename.split('.').pop();
134
+ return ext == null || !KNOWN_EXTENSIONS.has(ext.toLowerCase());
135
+ }
136
+ // https://github.com/sindresorhus/escape-string-regexp/blob/ba9a4473850cb367936417e97f1f2191b7cc67dd/index.js
137
+ export function escapeRegExp(str) {
138
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
139
+ }
@@ -0,0 +1,94 @@
1
+ <script setup lang="ts">
2
+ import { useRoute } from 'vitepress'
3
+ import { computed, provide, useSlots, watch } from 'vue'
4
+ import VPBackdrop from './components/VPBackdrop.vue'
5
+ import VPContent from './components/VPContent.vue'
6
+ import VPFooter from './components/VPFooter.vue'
7
+ import VPLocalNav from './components/VPLocalNav.vue'
8
+ import VPNav from './components/VPNav.vue'
9
+ import VPSidebar from './components/VPSidebar.vue'
10
+ import VPSkipLink from './components/VPSkipLink.vue'
11
+ import { useData } from './composables/data'
12
+ import { useCloseSidebarOnEscape, useSidebar } from './composables/sidebar'
13
+
14
+ const {
15
+ isOpen: isSidebarOpen,
16
+ open: openSidebar,
17
+ close: closeSidebar
18
+ } = useSidebar()
19
+
20
+ const route = useRoute()
21
+ watch(() => route.path, closeSidebar)
22
+
23
+ useCloseSidebarOnEscape(isSidebarOpen, closeSidebar)
24
+
25
+ const { frontmatter } = useData()
26
+
27
+ const slots = useSlots()
28
+ const heroImageSlotExists = computed(() => !!slots['home-hero-image'])
29
+
30
+ provide('hero-image-slot-exists', heroImageSlotExists)
31
+ </script>
32
+
33
+ <template>
34
+ <div v-if="frontmatter.layout !== false" class="Layout" :class="frontmatter.pageClass" >
35
+ <slot name="layout-top" />
36
+ <VPSkipLink />
37
+ <VPBackdrop class="backdrop" :show="isSidebarOpen" @click="closeSidebar" />
38
+ <VPNav>
39
+ <template #nav-bar-title-before><slot name="nav-bar-title-before" /></template>
40
+ <template #nav-bar-title-after><slot name="nav-bar-title-after" /></template>
41
+ <template #nav-bar-content-before><slot name="nav-bar-content-before" /></template>
42
+ <template #nav-bar-content-after><slot name="nav-bar-content-after" /></template>
43
+ <template #nav-screen-content-before><slot name="nav-screen-content-before" /></template>
44
+ <template #nav-screen-content-after><slot name="nav-screen-content-after" /></template>
45
+ </VPNav>
46
+ <VPLocalNav :open="isSidebarOpen" @open-menu="openSidebar" />
47
+
48
+ <VPSidebar :open="isSidebarOpen">
49
+ <template #sidebar-nav-before><slot name="sidebar-nav-before" /></template>
50
+ <template #sidebar-nav-after><slot name="sidebar-nav-after" /></template>
51
+ </VPSidebar>
52
+
53
+ <VPContent>
54
+ <template #page-top><slot name="page-top" /></template>
55
+ <template #page-bottom><slot name="page-bottom" /></template>
56
+
57
+ <template #not-found><slot name="not-found" /></template>
58
+ <template #home-hero-before><slot name="home-hero-before" /></template>
59
+ <template #home-hero-info-before><slot name="home-hero-info-before" /></template>
60
+ <template #home-hero-info><slot name="home-hero-info" /></template>
61
+ <template #home-hero-info-after><slot name="home-hero-info-after" /></template>
62
+ <template #home-hero-actions-after><slot name="home-hero-actions-after" /></template>
63
+ <template #home-hero-image><slot name="home-hero-image" /></template>
64
+ <template #home-hero-after><slot name="home-hero-after" /></template>
65
+ <template #home-features-before><slot name="home-features-before" /></template>
66
+ <template #home-features-after><slot name="home-features-after" /></template>
67
+
68
+ <template #doc-footer-before><slot name="doc-footer-before" /></template>
69
+ <template #doc-before><slot name="doc-before" /></template>
70
+ <template #doc-after><slot name="doc-after" /></template>
71
+ <template #doc-top><slot name="doc-top" /></template>
72
+ <template #doc-bottom><slot name="doc-bottom" /></template>
73
+
74
+ <template #aside-top><slot name="aside-top" /></template>
75
+ <template #aside-bottom><slot name="aside-bottom" /></template>
76
+ <template #aside-outline-before><slot name="aside-outline-before" /></template>
77
+ <template #aside-outline-after><slot name="aside-outline-after" /></template>
78
+ <template #aside-ads-before><slot name="aside-ads-before" /></template>
79
+ <template #aside-ads-after><slot name="aside-ads-after" /></template>
80
+ </VPContent>
81
+
82
+ <VPFooter />
83
+ <slot name="layout-bottom" />
84
+ </div>
85
+ <Content v-else />
86
+ </template>
87
+
88
+ <style scoped>
89
+ .Layout {
90
+ display: flex;
91
+ flex-direction: column;
92
+ min-height: 100vh;
93
+ }
94
+ </style>
@@ -0,0 +1,109 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, ref } from 'vue'
3
+ import { withBase } from 'vitepress'
4
+ import { useData } from './composables/data'
5
+ import { useLangs } from './composables/langs'
6
+
7
+ const { site, theme } = useData()
8
+ const { localeLinks } = useLangs({ removeCurrent: false })
9
+
10
+ const root = ref('/')
11
+ onMounted(() => {
12
+ const path = window.location.pathname
13
+ .replace(site.value.base, '')
14
+ .replace(/(^.*?\/).*$/, '/$1')
15
+ if (localeLinks.value.length) {
16
+ root.value =
17
+ localeLinks.value.find(({ link }) => link.startsWith(path))?.link ||
18
+ localeLinks.value[0].link
19
+ }
20
+ })
21
+ </script>
22
+
23
+ <template>
24
+ <div class="NotFound">
25
+ <p class="code">{{ theme.notFound?.code ?? '404' }}</p>
26
+ <h1 class="title">{{ theme.notFound?.title ?? 'PAGE NOT FOUND' }}</h1>
27
+ <div class="divider" />
28
+ <blockquote class="quote">
29
+ {{
30
+ theme.notFound?.quote ??
31
+ "But if you don't change your direction, and if you keep looking, you may end up where you are heading."
32
+ }}
33
+ </blockquote>
34
+
35
+ <div class="action">
36
+ <a
37
+ class="link"
38
+ :href="withBase(root)"
39
+ :aria-label="theme.notFound?.linkLabel ?? 'go to home'"
40
+ >
41
+ {{ theme.notFound?.linkText ?? 'Take me home' }}
42
+ </a>
43
+ </div>
44
+ </div>
45
+ </template>
46
+
47
+ <style scoped>
48
+ .NotFound {
49
+ padding: 64px 24px 96px;
50
+ text-align: center;
51
+ }
52
+
53
+ @media (min-width: 768px) {
54
+ .NotFound {
55
+ padding: 96px 32px 168px;
56
+ }
57
+ }
58
+
59
+ .code {
60
+ line-height: 64px;
61
+ font-size: 64px;
62
+ font-weight: 600;
63
+ }
64
+
65
+ .title {
66
+ padding-top: 12px;
67
+ letter-spacing: 2px;
68
+ line-height: 20px;
69
+ font-size: 20px;
70
+ font-weight: 700;
71
+ }
72
+
73
+ .divider {
74
+ margin: 24px auto 18px;
75
+ width: 64px;
76
+ height: 1px;
77
+ background-color: var(--vp-c-divider);
78
+ }
79
+
80
+ .quote {
81
+ margin: 0 auto;
82
+ max-width: 256px;
83
+ font-size: 14px;
84
+ font-weight: 500;
85
+ color: var(--vp-c-text-2);
86
+ }
87
+
88
+ .action {
89
+ padding-top: 20px;
90
+ }
91
+
92
+ .link {
93
+ display: inline-block;
94
+ border: 1px solid var(--vp-c-brand-1);
95
+ border-radius: 16px;
96
+ padding: 3px 16px;
97
+ font-size: 14px;
98
+ font-weight: 500;
99
+ color: var(--vp-c-brand-1);
100
+ transition:
101
+ border-color 0.25s,
102
+ color 0.25s;
103
+ }
104
+
105
+ .link:hover {
106
+ border-color: var(--vp-c-brand-2);
107
+ color: var(--vp-c-brand-2);
108
+ }
109
+ </style>
@@ -0,0 +1,99 @@
1
+ <script setup lang="ts">
2
+ import docsearch from '@docsearch/js'
3
+ import { useRoute, useRouter } from 'vitepress'
4
+ import type { DefaultTheme } from 'vitepress/theme'
5
+ import { nextTick, onMounted, watch } from 'vue'
6
+ import { useData } from '../composables/data'
7
+
8
+ const props = defineProps<{
9
+ algolia: DefaultTheme.AlgoliaSearchOptions
10
+ }>()
11
+
12
+ const router = useRouter()
13
+ const route = useRoute()
14
+ const { site, localeIndex, lang } = useData()
15
+
16
+ type DocSearchProps = Parameters<typeof docsearch>[0]
17
+
18
+ onMounted(update)
19
+ watch(localeIndex, update)
20
+
21
+ async function update() {
22
+ await nextTick()
23
+ const options = {
24
+ ...props.algolia,
25
+ ...props.algolia.locales?.[localeIndex.value]
26
+ }
27
+ const rawFacetFilters = options.searchParameters?.facetFilters ?? []
28
+ const facetFilters = [
29
+ ...(Array.isArray(rawFacetFilters)
30
+ ? rawFacetFilters
31
+ : [rawFacetFilters]
32
+ ).filter((f) => !f.startsWith('lang:')),
33
+ `lang:${lang.value}`
34
+ ]
35
+ initialize({
36
+ ...options,
37
+ searchParameters: {
38
+ ...options.searchParameters,
39
+ facetFilters
40
+ }
41
+ })
42
+ }
43
+
44
+ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
45
+ const options = Object.assign<
46
+ {},
47
+ DefaultTheme.AlgoliaSearchOptions,
48
+ Partial<DocSearchProps>
49
+ >({}, userOptions, {
50
+ container: '#docsearch',
51
+
52
+ navigator: {
53
+ navigate({ itemUrl }) {
54
+ const { pathname: hitPathname } = new URL(
55
+ window.location.origin + itemUrl
56
+ )
57
+
58
+ // router doesn't handle same-page navigation so we use the native
59
+ // browser location API for anchor navigation
60
+ if (route.path === hitPathname) {
61
+ window.location.assign(window.location.origin + itemUrl)
62
+ } else {
63
+ router.go(itemUrl)
64
+ }
65
+ }
66
+ },
67
+
68
+ transformItems(items) {
69
+ return items.map((item) => {
70
+ return Object.assign({}, item, {
71
+ url: getRelativePath(item.url)
72
+ })
73
+ })
74
+ },
75
+
76
+ hitComponent({ hit, children }) {
77
+ return {
78
+ __v: null,
79
+ type: 'a',
80
+ ref: undefined,
81
+ constructor: undefined,
82
+ key: undefined,
83
+ props: { href: hit.url, children }
84
+ }
85
+ }
86
+ }) as DocSearchProps
87
+
88
+ docsearch(options)
89
+ }
90
+
91
+ function getRelativePath(url: string) {
92
+ const { pathname, hash } = new URL(url, location.origin)
93
+ return pathname.replace(/\.html$/, site.value.cleanUrls ? '' : '.html') + hash
94
+ }
95
+ </script>
96
+
97
+ <template>
98
+ <div id="docsearch" />
99
+ </template>
@@ -0,0 +1,41 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{
3
+ show: boolean
4
+ }>()
5
+ </script>
6
+
7
+ <template>
8
+ <transition name="fade">
9
+ <div v-if="show" class="VPBackdrop" />
10
+ </transition>
11
+ </template>
12
+
13
+ <style scoped>
14
+ .VPBackdrop {
15
+ position: fixed;
16
+ top: 0;
17
+ /*rtl:ignore*/
18
+ right: 0;
19
+ bottom: 0;
20
+ /*rtl:ignore*/
21
+ left: 0;
22
+ z-index: var(--vp-z-index-backdrop);
23
+ background: var(--vp-backdrop-bg-color);
24
+ transition: opacity 0.5s;
25
+ }
26
+
27
+ .VPBackdrop.fade-enter-from,
28
+ .VPBackdrop.fade-leave-to {
29
+ opacity: 0;
30
+ }
31
+
32
+ .VPBackdrop.fade-leave-active {
33
+ transition-duration: .25s;
34
+ }
35
+
36
+ @media (min-width: 1280px) {
37
+ .VPBackdrop {
38
+ display: none;
39
+ }
40
+ }
41
+ </style>
@@ -0,0 +1,86 @@
1
+ <script setup lang="ts">
2
+ interface Props {
3
+ text?: string
4
+ type?: 'info' | 'tip' | 'warning' | 'danger'
5
+ }
6
+ withDefaults(defineProps<Props>(), {
7
+ type: 'tip'
8
+ })
9
+ </script>
10
+
11
+ <template>
12
+ <span class="VPBadge" :class="type">
13
+ <slot>{{ text }}</slot>
14
+ </span>
15
+ </template>
16
+
17
+ <style>
18
+ .VPBadge {
19
+ display: inline-block;
20
+ margin-left: 2px;
21
+ border: 1px solid transparent;
22
+ border-radius: 12px;
23
+ padding: 0 10px;
24
+ line-height: 22px;
25
+ font-size: 12px;
26
+ font-weight: 500;
27
+ transform: translateY(-2px);
28
+ }
29
+
30
+ .VPBadge.small {
31
+ padding: 0 6px;
32
+ line-height: 18px;
33
+ font-size: 10px;
34
+ transform: translateY(-8px);
35
+ }
36
+
37
+ .VPDocFooter .VPBadge {
38
+ display: none;
39
+ }
40
+
41
+ .vp-doc h1 > .VPBadge {
42
+ margin-top: 4px;
43
+ vertical-align: top;
44
+ }
45
+
46
+ .vp-doc h2 > .VPBadge {
47
+ margin-top: 3px;
48
+ padding: 0 8px;
49
+ vertical-align: top;
50
+ }
51
+
52
+ .vp-doc h3 > .VPBadge {
53
+ vertical-align: middle;
54
+ }
55
+
56
+ .vp-doc h4 > .VPBadge,
57
+ .vp-doc h5 > .VPBadge,
58
+ .vp-doc h6 > .VPBadge {
59
+ vertical-align: middle;
60
+ line-height: 18px;
61
+ }
62
+
63
+ .VPBadge.info {
64
+ border-color: var(--vp-badge-info-border);
65
+ color: var(--vp-badge-info-text);
66
+ background-color: var(--vp-badge-info-bg);
67
+ }
68
+
69
+ .VPBadge.tip {
70
+ border-color: var(--vp-badge-tip-border);
71
+ color: var(--vp-badge-tip-text);
72
+ background-color: var(--vp-badge-tip-bg);
73
+ }
74
+
75
+ .VPBadge.warning {
76
+ border-color: var(--vp-badge-warning-border);
77
+ color: var(--vp-badge-warning-text);
78
+ background-color: var(--vp-badge-warning-bg);
79
+ }
80
+
81
+ .VPBadge.danger {
82
+ border-color: var(--vp-badge-danger-border);
83
+ color: var(--vp-badge-danger-text);
84
+ background-color: var(--vp-badge-danger-bg);
85
+ }
86
+ </style>
@@ -0,0 +1,123 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { normalizeLink } from '../support/utils'
4
+ import { EXTERNAL_URL_RE } from '../../shared'
5
+
6
+ interface Props {
7
+ tag?: string
8
+ size?: 'medium' | 'big'
9
+ theme?: 'brand' | 'alt' | 'sponsor'
10
+ text: string
11
+ href?: string
12
+ target?: string;
13
+ rel?: string;
14
+ }
15
+ const props = withDefaults(defineProps<Props>(), {
16
+ size: 'medium',
17
+ theme: 'brand'
18
+ })
19
+
20
+ const isExternal = computed(
21
+ () => props.href && EXTERNAL_URL_RE.test(props.href)
22
+ )
23
+
24
+ const component = computed(() => {
25
+ return props.tag || props.href ? 'a' : 'button'
26
+ })
27
+ </script>
28
+
29
+ <template>
30
+ <component
31
+ :is="component"
32
+ class="VPButton"
33
+ :class="[size, theme]"
34
+ :href="href ? normalizeLink(href) : undefined"
35
+ :target="props.target ?? (isExternal ? '_blank' : undefined)"
36
+ :rel="props.rel ?? (isExternal ? 'noreferrer' : undefined)"
37
+ >
38
+ {{ text }}
39
+ </component>
40
+ </template>
41
+
42
+ <style scoped>
43
+ .VPButton {
44
+ display: inline-block;
45
+ border: 1px solid transparent;
46
+ text-align: center;
47
+ font-weight: 600;
48
+ white-space: nowrap;
49
+ transition: color 0.25s, border-color 0.25s, background-color 0.25s;
50
+ }
51
+
52
+ .VPButton:active {
53
+ transition: color 0.1s, border-color 0.1s, background-color 0.1s;
54
+ }
55
+
56
+ .VPButton.medium {
57
+ border-radius: 20px;
58
+ padding: 0 20px;
59
+ line-height: 38px;
60
+ font-size: 14px;
61
+ }
62
+
63
+ .VPButton.big {
64
+ border-radius: 24px;
65
+ padding: 0 24px;
66
+ line-height: 46px;
67
+ font-size: 16px;
68
+ }
69
+
70
+ .VPButton.brand {
71
+ border-color: var(--vp-button-brand-border);
72
+ color: var(--vp-button-brand-text);
73
+ background-color: var(--vp-button-brand-bg);
74
+ }
75
+
76
+ .VPButton.brand:hover {
77
+ border-color: var(--vp-button-brand-hover-border);
78
+ color: var(--vp-button-brand-hover-text);
79
+ background-color: var(--vp-button-brand-hover-bg);
80
+ }
81
+
82
+ .VPButton.brand:active {
83
+ border-color: var(--vp-button-brand-active-border);
84
+ color: var(--vp-button-brand-active-text);
85
+ background-color: var(--vp-button-brand-active-bg);
86
+ }
87
+
88
+ .VPButton.alt {
89
+ border-color: var(--vp-button-alt-border);
90
+ color: var(--vp-button-alt-text);
91
+ background-color: var(--vp-button-alt-bg);
92
+ }
93
+
94
+ .VPButton.alt:hover {
95
+ border-color: var(--vp-button-alt-hover-border);
96
+ color: var(--vp-button-alt-hover-text);
97
+ background-color: var(--vp-button-alt-hover-bg);
98
+ }
99
+
100
+ .VPButton.alt:active {
101
+ border-color: var(--vp-button-alt-active-border);
102
+ color: var(--vp-button-alt-active-text);
103
+ background-color: var(--vp-button-alt-active-bg);
104
+ }
105
+
106
+ .VPButton.sponsor {
107
+ border-color: var(--vp-button-sponsor-border);
108
+ color: var(--vp-button-sponsor-text);
109
+ background-color: var(--vp-button-sponsor-bg);
110
+ }
111
+
112
+ .VPButton.sponsor:hover {
113
+ border-color: var(--vp-button-sponsor-hover-border);
114
+ color: var(--vp-button-sponsor-hover-text);
115
+ background-color: var(--vp-button-sponsor-hover-bg);
116
+ }
117
+
118
+ .VPButton.sponsor:active {
119
+ border-color: var(--vp-button-sponsor-active-border);
120
+ color: var(--vp-button-sponsor-active-text);
121
+ background-color: var(--vp-button-sponsor-active-bg);
122
+ }
123
+ </style>