vitepress 0.22.4 → 1.0.0-draft.1

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 (132) hide show
  1. package/client.d.ts +2 -3
  2. package/dist/client/app/components/ClientOnly.js +1 -1
  3. package/dist/client/app/index.js +1 -1
  4. package/dist/client/theme-default/Layout.vue +25 -183
  5. package/dist/client/theme-default/NotFound.vue +9 -8
  6. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +127 -0
  7. package/dist/client/theme-default/components/VPBackdrop.vue +39 -0
  8. package/dist/client/theme-default/components/VPContent.vue +44 -0
  9. package/dist/client/theme-default/components/VPContentDoc.vue +173 -0
  10. package/dist/client/theme-default/components/VPContentDocFooter.vue +140 -0
  11. package/dist/client/theme-default/components/VPContentDocOutline.vue +108 -0
  12. package/dist/client/theme-default/components/VPFlyout.vue +149 -0
  13. package/dist/client/theme-default/components/VPLink.vue +37 -0
  14. package/dist/client/theme-default/components/VPLocalNav.vue +106 -0
  15. package/dist/client/theme-default/components/VPMenu.vue +79 -0
  16. package/dist/client/theme-default/components/VPMenuGroup.vue +35 -0
  17. package/dist/client/theme-default/components/VPMenuLink.vue +30 -0
  18. package/dist/client/theme-default/components/VPNav.vue +33 -0
  19. package/dist/client/theme-default/components/VPNavBar.vue +109 -0
  20. package/dist/client/theme-default/components/VPNavBarAppearance.vue +22 -0
  21. package/dist/client/theme-default/components/VPNavBarExtra.vue +107 -0
  22. package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
  23. package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
  24. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +18 -0
  25. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +56 -0
  26. package/dist/client/theme-default/components/VPNavBarSearch.vue +269 -0
  27. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
  28. package/dist/client/theme-default/components/VPNavBarTitle.vue +44 -0
  29. package/dist/client/theme-default/components/VPNavBarTranslations.vue +74 -0
  30. package/dist/client/theme-default/components/VPNavScreen.vue +100 -0
  31. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +30 -0
  32. package/dist/client/theme-default/components/VPNavScreenMenu.vue +24 -0
  33. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +118 -0
  34. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +33 -0
  35. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +35 -0
  36. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +34 -0
  37. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
  38. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
  39. package/dist/client/theme-default/components/VPSidebar.vue +118 -0
  40. package/dist/client/theme-default/components/VPSidebarGroup.vue +44 -0
  41. package/dist/client/theme-default/components/VPSidebarLink.vue +57 -0
  42. package/dist/client/theme-default/components/VPSkipLink.vue +72 -0
  43. package/dist/client/theme-default/components/VPSocialLink.vue +63 -0
  44. package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
  45. package/dist/client/theme-default/components/VPSwitch.vue +66 -0
  46. package/dist/client/theme-default/components/VPSwitchAppearance.vue +74 -0
  47. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
  48. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
  49. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
  50. package/dist/client/theme-default/components/icons/{ArrowLeft.vue → VPIconArrowLeft.vue} +0 -0
  51. package/dist/client/theme-default/components/icons/{ArrowRight.vue → VPIconArrowRight.vue} +0 -0
  52. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
  53. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
  54. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
  55. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
  56. package/dist/client/theme-default/components/icons/VPIconDiscord.vue +5 -0
  57. package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
  58. package/dist/client/theme-default/components/icons/VPIconExternalLink.vue +13 -0
  59. package/dist/client/theme-default/components/icons/VPIconFacebook.vue +5 -0
  60. package/dist/client/theme-default/components/icons/VPIconGitHub.vue +5 -0
  61. package/dist/client/theme-default/components/icons/VPIconInstagram.vue +5 -0
  62. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
  63. package/dist/client/theme-default/components/icons/VPIconLinkedIn.vue +5 -0
  64. package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
  65. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
  66. package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
  67. package/dist/client/theme-default/components/icons/VPIconSlack.vue +5 -0
  68. package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
  69. package/dist/client/theme-default/components/icons/VPIconTwitter.vue +5 -0
  70. package/dist/client/theme-default/components/icons/VPIconYouTube.vue +5 -0
  71. package/dist/client/theme-default/composables/edit-link.js +22 -0
  72. package/dist/client/theme-default/composables/flyout.js +40 -0
  73. package/dist/client/theme-default/composables/nav.js +27 -1
  74. package/dist/client/theme-default/composables/outline.js +130 -0
  75. package/dist/client/theme-default/composables/prev-next.js +18 -0
  76. package/dist/client/theme-default/composables/sidebar.js +57 -0
  77. package/dist/client/theme-default/fonts/inter-cyrillic-ext.woff2 +0 -0
  78. package/dist/client/theme-default/fonts/inter-cyrillic.woff2 +0 -0
  79. package/dist/client/theme-default/fonts/inter-greek-ext.woff2 +0 -0
  80. package/dist/client/theme-default/fonts/inter-greek.woff2 +0 -0
  81. package/dist/client/theme-default/fonts/inter-latin-ext.woff2 +0 -0
  82. package/dist/client/theme-default/fonts/inter-latin.woff2 +0 -0
  83. package/dist/client/theme-default/fonts/inter-vietnamese.woff2 +0 -0
  84. package/dist/client/theme-default/index.js +4 -4
  85. package/dist/client/theme-default/styles/base.css +200 -0
  86. package/dist/client/theme-default/styles/fonts.css +67 -0
  87. package/dist/client/theme-default/styles/utils.css +9 -0
  88. package/dist/client/theme-default/styles/vars.css +206 -66
  89. package/dist/client/theme-default/styles/vp-doc.css +419 -0
  90. package/dist/client/theme-default/support/sidebar.js +29 -0
  91. package/dist/client/theme-default/support/utils.js +43 -0
  92. package/dist/node/cli.js +3 -8
  93. package/dist/node/index.d.ts +104 -79
  94. package/dist/node/index.js +1 -1
  95. package/dist/node/{serve-3035f99b.js → serve-428d4610.js} +11418 -1415
  96. package/package.json +24 -20
  97. package/types/default-theme.d.ts +104 -79
  98. package/dist/client/theme-default/components/AlgoliaSearchBox.vue +0 -188
  99. package/dist/client/theme-default/components/BuySellAds.vue +0 -152
  100. package/dist/client/theme-default/components/CarbonAds.vue +0 -99
  101. package/dist/client/theme-default/components/EditLink.vue +0 -38
  102. package/dist/client/theme-default/components/Home.vue +0 -31
  103. package/dist/client/theme-default/components/HomeFeatures.vue +0 -143
  104. package/dist/client/theme-default/components/HomeFooter.vue +0 -50
  105. package/dist/client/theme-default/components/HomeHero.vue +0 -161
  106. package/dist/client/theme-default/components/LastUpdated.vue +0 -60
  107. package/dist/client/theme-default/components/NavBar.vue +0 -60
  108. package/dist/client/theme-default/components/NavBarTitle.vue +0 -41
  109. package/dist/client/theme-default/components/NavDropdownLink.vue +0 -135
  110. package/dist/client/theme-default/components/NavDropdownLinkItem.vue +0 -76
  111. package/dist/client/theme-default/components/NavLink.vue +0 -61
  112. package/dist/client/theme-default/components/NavLinks.vue +0 -52
  113. package/dist/client/theme-default/components/NextAndPrevLinks.vue +0 -88
  114. package/dist/client/theme-default/components/Page.vue +0 -53
  115. package/dist/client/theme-default/components/PageFooter.vue +0 -44
  116. package/dist/client/theme-default/components/SideBar.vue +0 -60
  117. package/dist/client/theme-default/components/SideBarLink.js +0 -68
  118. package/dist/client/theme-default/components/SideBarLinks.vue +0 -12
  119. package/dist/client/theme-default/components/ToggleSideBarButton.vue +0 -46
  120. package/dist/client/theme-default/components/icons/OutboundLink.vue +0 -31
  121. package/dist/client/theme-default/composables/activeSidebarLink.js +0 -99
  122. package/dist/client/theme-default/composables/editLink.js +0 -49
  123. package/dist/client/theme-default/composables/navLink.js +0 -42
  124. package/dist/client/theme-default/composables/nextAndPrevLinks.js +0 -37
  125. package/dist/client/theme-default/composables/repo.js +0 -38
  126. package/dist/client/theme-default/composables/sideBar.js +0 -57
  127. package/dist/client/theme-default/styles/code.css +0 -299
  128. package/dist/client/theme-default/styles/custom-blocks.css +0 -76
  129. package/dist/client/theme-default/styles/layout.css +0 -236
  130. package/dist/client/theme-default/styles/sidebar-links.css +0 -107
  131. package/dist/client/theme-default/support/sideBar.js +0 -46
  132. package/dist/client/theme-default/utils.js +0 -63
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
3
+ <path d="M18.9,10.9h-6v-6c0-0.6-0.4-1-1-1s-1,0.4-1,1v6h-6c-0.6,0-1,0.4-1,1s0.4,1,1,1h6v6c0,0.6,0.4,1,1,1s1-0.4,1-1v-6h6c0.6,0,1-0.4,1-1S19.5,10.9,18.9,10.9z" />
4
+ </svg>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
3
+ <path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z" />
4
+ </svg>
5
+ </template>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
3
+ <path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z" />
4
+ <path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z" />
5
+ <path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z" />
6
+ <path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z" />
7
+ <path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z" />
8
+ <path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z" />
9
+ <path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z" />
10
+ <path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z" />
11
+ <path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z" />
12
+ </svg>
13
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
3
+ <path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z" />
4
+ </svg>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
3
+ <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
4
+ </svg>
5
+ </template>
@@ -0,0 +1,22 @@
1
+ import { computed } from 'vue';
2
+ import { useData } from 'vitepress';
3
+ export function useEditLink() {
4
+ const { theme, page } = useData();
5
+ return computed(() => {
6
+ const url = [
7
+ 'https://github.com',
8
+ theme.value.editLink?.repo || '???',
9
+ 'edit',
10
+ theme.value.editLink?.branch || 'main',
11
+ theme.value.editLink?.dir || null,
12
+ page.value.relativePath
13
+ ]
14
+ .filter((v) => v)
15
+ .join('/');
16
+ const text = theme.value.editLink?.text ?? 'Edit this page';
17
+ return {
18
+ url,
19
+ text
20
+ };
21
+ });
22
+ }
@@ -0,0 +1,40 @@
1
+ import { ref, watch, readonly, onUnmounted } from 'vue';
2
+ export const focusedElement = ref();
3
+ let active = false;
4
+ let listeners = 0;
5
+ export function useFlyout(options) {
6
+ const focus = ref(false);
7
+ if (typeof window !== 'undefined') {
8
+ !active && activateFocusTracking();
9
+ listeners++;
10
+ const unwatch = watch(focusedElement, (el) => {
11
+ if (el === options.el.value || options.el.value?.contains(el)) {
12
+ focus.value = true;
13
+ options.onFocus?.();
14
+ }
15
+ else {
16
+ focus.value = false;
17
+ options.onBlur?.();
18
+ }
19
+ });
20
+ onUnmounted(() => {
21
+ unwatch();
22
+ listeners--;
23
+ if (!listeners) {
24
+ deactivateFocusTracking();
25
+ }
26
+ });
27
+ }
28
+ return readonly(focus);
29
+ }
30
+ function activateFocusTracking() {
31
+ document.addEventListener('focusin', handleFocusIn);
32
+ active = true;
33
+ focusedElement.value = document.activeElement;
34
+ }
35
+ function deactivateFocusTracking() {
36
+ document.removeEventListener('focusin', handleFocusIn);
37
+ }
38
+ function handleFocusIn() {
39
+ focusedElement.value = document.activeElement;
40
+ }
@@ -1,5 +1,31 @@
1
- import { computed } from 'vue';
1
+ import { ref, computed } from 'vue';
2
2
  import { useData, useRoute } from 'vitepress';
3
+ export function useNav() {
4
+ const isScreenOpen = ref(false);
5
+ function openScreen() {
6
+ isScreenOpen.value = true;
7
+ window.addEventListener('resize', closeScreenOnTabletWindow);
8
+ }
9
+ function closeScreen() {
10
+ isScreenOpen.value = false;
11
+ window.removeEventListener('resize', closeScreenOnTabletWindow);
12
+ }
13
+ function toggleScreen() {
14
+ isScreenOpen.value ? closeScreen() : openScreen();
15
+ }
16
+ /**
17
+ * Close screen when the user resizes the window wider than tablet size.
18
+ */
19
+ function closeScreenOnTabletWindow() {
20
+ window.outerWidth >= 768 && closeScreen();
21
+ }
22
+ return {
23
+ isScreenOpen,
24
+ openScreen,
25
+ closeScreen,
26
+ toggleScreen
27
+ };
28
+ }
3
29
  export function useLanguageLinks() {
4
30
  const { site, localePath, theme } = useData();
5
31
  return computed(() => {
@@ -0,0 +1,130 @@
1
+ import { onMounted, onUpdated, onUnmounted } from 'vue';
2
+ import { useMediaQuery } from '@vueuse/core';
3
+ // magic number to avoid repeated retrieval
4
+ const PAGE_OFFSET = 56;
5
+ export function resolveHeaders(headers) {
6
+ return mapHeaders(groupHeaders(headers));
7
+ }
8
+ function groupHeaders(headers) {
9
+ headers = headers.map((h) => Object.assign({}, h));
10
+ let lastH2;
11
+ for (const h of headers) {
12
+ if (h.level === 2) {
13
+ lastH2 = h;
14
+ }
15
+ else if (lastH2 && h.level <= 3) {
16
+ ;
17
+ (lastH2.children || (lastH2.children = [])).push(h);
18
+ }
19
+ }
20
+ return headers.filter((h) => h.level === 2);
21
+ }
22
+ function mapHeaders(headers) {
23
+ return headers.map((header) => ({
24
+ text: header.title,
25
+ link: `#${header.slug}`,
26
+ children: header.children ? mapHeaders(header.children) : undefined,
27
+ hidden: header.hidden
28
+ }));
29
+ }
30
+ export function useActiveAnchor(container, marker) {
31
+ const isOutlineEnabled = useMediaQuery('(min-width: 1280px)');
32
+ const onScroll = throttleAndDebounce(setActiveLink, 100);
33
+ let prevActiveLink = null;
34
+ onMounted(() => {
35
+ requestAnimationFrame(setActiveLink);
36
+ window.addEventListener('scroll', onScroll);
37
+ });
38
+ onUpdated(() => {
39
+ // sidebar update means a route change
40
+ activateLink(location.hash);
41
+ });
42
+ onUnmounted(() => {
43
+ window.removeEventListener('scroll', onScroll);
44
+ });
45
+ function setActiveLink() {
46
+ if (!isOutlineEnabled.value) {
47
+ return;
48
+ }
49
+ const links = [].slice.call(container.value.querySelectorAll('.outline-link'));
50
+ const anchors = [].slice
51
+ .call(document.querySelectorAll('.content .header-anchor'))
52
+ .filter((anchor) => {
53
+ return links.some((link) => {
54
+ return link.hash === anchor.hash && anchor.offsetParent !== null;
55
+ });
56
+ });
57
+ const scrollY = window.scrollY;
58
+ const innerHeight = window.innerHeight;
59
+ const offsetHeight = document.body.offsetHeight;
60
+ const isBottom = scrollY + innerHeight === offsetHeight;
61
+ // page bottom - highlight last one
62
+ if (anchors.length && isBottom) {
63
+ activateLink(anchors[anchors.length - 1].hash);
64
+ return;
65
+ }
66
+ for (let i = 0; i < anchors.length; i++) {
67
+ const anchor = anchors[i];
68
+ const nextAnchor = anchors[i + 1];
69
+ const [isActive, hash] = isAnchorActive(i, anchor, nextAnchor);
70
+ if (isActive) {
71
+ history.replaceState(null, document.title, hash ? hash : ' ');
72
+ activateLink(hash);
73
+ return;
74
+ }
75
+ }
76
+ }
77
+ function activateLink(hash) {
78
+ if (prevActiveLink) {
79
+ prevActiveLink.classList.remove('active');
80
+ }
81
+ if (hash !== null) {
82
+ prevActiveLink = container.value.querySelector(`a[href="${decodeURIComponent(hash)}"]`);
83
+ }
84
+ const activeLink = prevActiveLink;
85
+ if (activeLink) {
86
+ activeLink.classList.add('active');
87
+ marker.value.style.top = activeLink.offsetTop + 33 + 'px';
88
+ marker.value.style.opacity = '1';
89
+ }
90
+ else {
91
+ marker.value.style.top = '33px';
92
+ marker.value.style.opacity = '0';
93
+ }
94
+ }
95
+ }
96
+ function getAnchorTop(anchor) {
97
+ return anchor.parentElement.offsetTop - PAGE_OFFSET - 15;
98
+ }
99
+ function isAnchorActive(index, anchor, nextAnchor) {
100
+ const scrollTop = window.scrollY;
101
+ if (index === 0 && scrollTop === 0) {
102
+ return [true, null];
103
+ }
104
+ if (scrollTop < getAnchorTop(anchor)) {
105
+ return [false, null];
106
+ }
107
+ if (!nextAnchor || scrollTop < getAnchorTop(nextAnchor)) {
108
+ return [true, anchor.hash];
109
+ }
110
+ return [false, null];
111
+ }
112
+ function throttleAndDebounce(fn, delay) {
113
+ let timeout;
114
+ let called = false;
115
+ return () => {
116
+ if (timeout) {
117
+ clearTimeout(timeout);
118
+ }
119
+ if (!called) {
120
+ fn();
121
+ called = true;
122
+ setTimeout(() => {
123
+ called = false;
124
+ }, delay);
125
+ }
126
+ else {
127
+ timeout = setTimeout(fn, delay);
128
+ }
129
+ };
130
+ }
@@ -0,0 +1,18 @@
1
+ import { computed } from 'vue';
2
+ import { useData } from 'vitepress';
3
+ import { isActive } from '../support/utils';
4
+ import { getSidebar, getFlatSideBarLinks } from '../support/sidebar';
5
+ export function usePrevNext() {
6
+ const { page, theme } = useData();
7
+ return computed(() => {
8
+ const sidebar = getSidebar(theme.value.sidebar, page.value.relativePath);
9
+ const candidates = getFlatSideBarLinks(sidebar);
10
+ const index = candidates.findIndex((link) => {
11
+ return isActive(page.value.relativePath, link.link);
12
+ });
13
+ return {
14
+ prev: candidates[index - 1],
15
+ next: candidates[index + 1]
16
+ };
17
+ });
18
+ }
@@ -0,0 +1,57 @@
1
+ import { ref, computed, watchEffect, onMounted, onUnmounted } from 'vue';
2
+ import { useRoute, useData } from 'vitepress';
3
+ import { getSidebar } from '../support/sidebar';
4
+ export function useSidebar() {
5
+ const route = useRoute();
6
+ const { theme, frontmatter } = useData();
7
+ const isOpen = ref(false);
8
+ const sidebar = computed(() => {
9
+ const sidebarConfig = theme.value.sidebar;
10
+ const relativePath = route.data.relativePath;
11
+ return sidebarConfig ? getSidebar(sidebarConfig, relativePath) : [];
12
+ });
13
+ const hasSidebar = computed(() => {
14
+ return frontmatter.value.sidebar !== false && sidebar.value.length > 0;
15
+ });
16
+ function open() {
17
+ isOpen.value = true;
18
+ }
19
+ function close() {
20
+ isOpen.value = false;
21
+ }
22
+ function toggle() {
23
+ isOpen.value ? close() : open();
24
+ }
25
+ return {
26
+ isOpen,
27
+ sidebar,
28
+ hasSidebar,
29
+ open,
30
+ close,
31
+ toggle
32
+ };
33
+ }
34
+ /**
35
+ * a11y: cache the element that opened the Sidebar (the menu button) then
36
+ * focus that button again when Menu is closed with Escape key.
37
+ */
38
+ export function useCloseSidebarOnEscape(isOpen, close) {
39
+ let triggerElement;
40
+ watchEffect(() => {
41
+ triggerElement = isOpen.value
42
+ ? document.activeElement
43
+ : undefined;
44
+ });
45
+ onMounted(() => {
46
+ window.addEventListener('keyup', onEscape);
47
+ });
48
+ onUnmounted(() => {
49
+ window.removeEventListener('keyup', onEscape);
50
+ });
51
+ function onEscape(e) {
52
+ if (e.key === 'Escape' && isOpen.value) {
53
+ close();
54
+ triggerElement?.focus();
55
+ }
56
+ }
57
+ }
@@ -1,8 +1,8 @@
1
+ import './styles/fonts.css';
1
2
  import './styles/vars.css';
2
- import './styles/layout.css';
3
- import './styles/code.css';
4
- import './styles/custom-blocks.css';
5
- import './styles/sidebar-links.css';
3
+ import './styles/base.css';
4
+ import './styles/utils.css';
5
+ import './styles/vp-doc.css';
6
6
  import Layout from './Layout.vue';
7
7
  import NotFound from './NotFound.vue';
8
8
  const theme = {
@@ -0,0 +1,200 @@
1
+ *,
2
+ ::before,
3
+ ::after {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ html {
8
+ line-height: 1.4;
9
+ font-size: 16px;
10
+ -webkit-text-size-adjust: 100%;
11
+ }
12
+
13
+ body {
14
+ margin: 0;
15
+ width: 100%;
16
+ min-width: 320px;
17
+ min-height: 100vh;
18
+ line-height: 24px;
19
+ font-family: var(--vp-font-family-base);
20
+ font-size: 16px;
21
+ font-weight: 400;
22
+ color: var(--vp-c-text-1);
23
+ background-color: var(--vp-c-bg-content);
24
+ direction: ltr;
25
+ font-synthesis: none;
26
+ text-rendering: optimizeLegibility;
27
+ -webkit-font-smoothing: antialiased;
28
+ -moz-osx-font-smoothing: grayscale;
29
+ }
30
+
31
+ main {
32
+ display: block;
33
+ }
34
+
35
+ h1,
36
+ h2,
37
+ h3,
38
+ h4,
39
+ h5,
40
+ h6 {
41
+ margin: 0;
42
+ }
43
+
44
+ p {
45
+ margin: 0;
46
+ }
47
+
48
+ strong,
49
+ b {
50
+ font-weight: 600;
51
+ }
52
+
53
+ /**
54
+ * Avoid 300ms click delay on touch devices that support the `touch-action`
55
+ * CSS property.
56
+ *
57
+ * In particular, unlike most other browsers, IE11+Edge on Windows 10 on
58
+ * touch devices and IE Mobile 10-11 DON'T remove the click delay when
59
+ * `<meta name="viewport" content="width=device-width">` is present.
60
+ * However, they DO support removing the click delay via
61
+ * `touch-action: manipulation`.
62
+ *
63
+ * See:
64
+ * - http://v4-alpha.getbootstrap.com/content/reboot/#click-delay-optimization-for-touch
65
+ * - http://caniuse.com/#feat=css-touch-action
66
+ * - http://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay
67
+ */
68
+ a,
69
+ area,
70
+ button,
71
+ [role="button"],
72
+ input,
73
+ label,
74
+ select,
75
+ summary,
76
+ textarea {
77
+ touch-action: manipulation;
78
+ }
79
+
80
+ a {
81
+ color: inherit;
82
+ text-decoration: inherit;
83
+ }
84
+
85
+ ol,
86
+ ul {
87
+ list-style: none;
88
+ margin: 0;
89
+ padding: 0;
90
+ }
91
+
92
+ pre,
93
+ code,
94
+ kbd,
95
+ samp {
96
+ font-family: var(--vp-font-family-mono);
97
+ }
98
+
99
+ img,
100
+ svg,
101
+ video,
102
+ canvas,
103
+ audio,
104
+ iframe,
105
+ embed,
106
+ object {
107
+ display: block;
108
+ vertical-align: middle;
109
+ }
110
+
111
+ img,
112
+ video {
113
+ max-width: 100%;
114
+ height: auto;
115
+ }
116
+
117
+ button,
118
+ input,
119
+ optgroup,
120
+ select,
121
+ textarea {
122
+ border: 0;
123
+ padding: 0;
124
+ line-height: inherit;
125
+ color: inherit;
126
+ }
127
+
128
+ button {
129
+ padding: 0;
130
+ font-family: inherit;;
131
+ background-color: transparent;
132
+ background-image: none;
133
+ }
134
+
135
+ button,
136
+ [role="button"] {
137
+ cursor: pointer;
138
+ }
139
+
140
+ button:focus,
141
+ button:focus-visible {
142
+ outline: 1px dotted;
143
+ outline: 4px auto -webkit-focus-ring-color;
144
+ }
145
+
146
+ button:focus:not(:focus-visible) {
147
+ outline: none !important;
148
+ }
149
+
150
+ input:focus,
151
+ textarea:focus,
152
+ select:focus {
153
+ outline: none;
154
+ }
155
+
156
+ table {
157
+ border-collapse: collapse;
158
+ }
159
+
160
+ input {
161
+ background-color: transparent;
162
+ }
163
+
164
+ input:-ms-input-placeholder,
165
+ textarea:-ms-input-placeholder {
166
+ color: var(--vp-c-text-3);
167
+ }
168
+
169
+ input::-ms-input-placeholder,
170
+ textarea::-ms-input-placeholder {
171
+ color: var(--vp-c-text-3);
172
+ }
173
+
174
+ input::placeholder,
175
+ textarea::placeholder {
176
+ color: var(--vp-c-text-3);
177
+ }
178
+
179
+ input::-webkit-outer-spin-button,
180
+ input::-webkit-inner-spin-button {
181
+ -webkit-appearance: none;
182
+ margin: 0;
183
+ }
184
+
185
+ input[type="number"] {
186
+ -moz-appearance: textfield;
187
+ }
188
+
189
+ textarea {
190
+ resize: vertical;
191
+ }
192
+
193
+ select {
194
+ -webkit-appearance: none;
195
+ }
196
+
197
+ fieldset {
198
+ margin: 0;
199
+ padding: 0;
200
+ }
@@ -0,0 +1,67 @@
1
+ @font-face {
2
+ font-family: Inter;
3
+ font-style: normal;
4
+ font-weight: 100 900;
5
+ font-display: swap;
6
+ src: url(../fonts/inter-latin.woff2) format('woff2');
7
+ unicode-range: U+00??, U+0131, U+0152-0153, U+02bb-02bc, U+02c6, U+02da,
8
+ U+02dc, U+2000-206f, U+2074, U+20ac, U+2122, U+2191, U+2193, U+2212, U+2215,
9
+ U+feff, U+fffd;
10
+ }
11
+
12
+ @font-face {
13
+ font-family: Inter;
14
+ font-style: normal;
15
+ font-weight: 400 500 600 700 900;
16
+ font-display: swap;
17
+ src: url(../fonts/inter-latin-ext.woff2) format('woff2');
18
+ unicode-range: U+0100-024f, U+0259, U+1e??, U+2020, U+20a0-20ab, U+20ad-20cf,
19
+ U+2113, U+2c60-2c7f, U+a720-a7ff;
20
+ }
21
+
22
+ @font-face {
23
+ font-family: Inter;
24
+ font-style: normal;
25
+ font-weight: 400 500 600 700 900;
26
+ font-display: swap;
27
+ src: url(../fonts/inter-cyrillic.woff2) format('woff2');
28
+ unicode-range: U+0400-045f, U+0490-0491, U+04b0-04b1, U+2116;
29
+ }
30
+
31
+ @font-face {
32
+ font-family: Inter;
33
+ font-style: normal;
34
+ font-weight: 400 500 600 700 900;
35
+ font-display: swap;
36
+ src: url(../fonts/inter-cyrillic-ext.woff2) format('woff2');
37
+ unicode-range: U+0460-052f, U+1c80-1c88, U+20b4, U+2de0-2dff, U+a640-a69f,
38
+ U+fe2e-fe2f;
39
+ }
40
+
41
+ @font-face {
42
+ font-family: Inter;
43
+ font-style: normal;
44
+ font-weight: 400 500 600 700 900;
45
+ font-display: swap;
46
+ src: url(../fonts/inter-greek.woff2) format('woff2');
47
+ unicode-range: U+0370-03ff;
48
+ }
49
+
50
+ @font-face {
51
+ font-family: Inter;
52
+ font-style: normal;
53
+ font-weight: 400 500 600 700 900;
54
+ font-display: swap;
55
+ src: url(../fonts/inter-greek-ext.woff2) format('woff2');
56
+ unicode-range: U+1f??;
57
+ }
58
+
59
+ @font-face {
60
+ font-family: Inter;
61
+ font-style: normal;
62
+ font-weight: 400 500 600 700 900;
63
+ font-display: swap;
64
+ src: url(../fonts/inter-vietnamese.woff2) format('woff2');
65
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01a0-01a1,
66
+ U+01af-01b0, U+1ea0-1ef9, U+20ab;
67
+ }
@@ -0,0 +1,9 @@
1
+ .visually-hidden {
2
+ position: absolute;
3
+ width: 1px;
4
+ height: 1px;
5
+ white-space: nowrap;
6
+ clip: rect(0 0 0 0);
7
+ clip-path: inset(50%);
8
+ overflow: hidden;
9
+ }