vitepress 0.22.3 → 1.0.0-draft.2

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 (208) 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 +5 -7
  4. package/dist/client/index.d.ts +5 -0
  5. package/dist/client/shared.js +1 -0
  6. package/dist/client/theme-default/Layout.vue +39 -180
  7. package/dist/client/theme-default/NotFound.vue +9 -8
  8. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +127 -0
  9. package/dist/client/theme-default/components/VPBackdrop.vue +39 -0
  10. package/dist/client/theme-default/components/VPBox.vue +59 -0
  11. package/dist/client/theme-default/components/VPButton.vue +123 -0
  12. package/dist/client/theme-default/components/VPContent.vue +74 -0
  13. package/dist/client/theme-default/components/VPDoc.vue +173 -0
  14. package/dist/client/theme-default/components/VPDocFooter.vue +141 -0
  15. package/dist/client/theme-default/components/VPDocOutline.vue +108 -0
  16. package/dist/client/theme-default/components/VPFlyout.vue +149 -0
  17. package/dist/client/theme-default/components/VPFooter.vue +53 -0
  18. package/dist/client/theme-default/components/VPHero.vue +144 -0
  19. package/dist/client/theme-default/components/VPHome.vue +33 -0
  20. package/dist/client/theme-default/components/VPHomeFeatures.vue +96 -0
  21. package/dist/client/theme-default/components/VPHomeHero.vue +17 -0
  22. package/dist/client/theme-default/components/VPHomeSponsors.vue +97 -0
  23. package/dist/client/theme-default/components/VPLink.vue +37 -0
  24. package/dist/client/theme-default/components/VPLocalNav.vue +106 -0
  25. package/dist/client/theme-default/components/VPMenu.vue +79 -0
  26. package/dist/client/theme-default/components/VPMenuGroup.vue +35 -0
  27. package/dist/client/theme-default/components/VPMenuLink.vue +30 -0
  28. package/dist/client/theme-default/components/VPNav.vue +33 -0
  29. package/dist/client/theme-default/components/VPNavBar.vue +110 -0
  30. package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
  31. package/dist/client/theme-default/components/VPNavBarExtra.vue +107 -0
  32. package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
  33. package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
  34. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +18 -0
  35. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +56 -0
  36. package/dist/client/theme-default/components/VPNavBarSearch.vue +269 -0
  37. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
  38. package/dist/client/theme-default/components/VPNavBarTitle.vue +57 -0
  39. package/dist/client/theme-default/components/VPNavBarTranslations.vue +74 -0
  40. package/dist/client/theme-default/components/VPNavScreen.vue +100 -0
  41. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
  42. package/dist/client/theme-default/components/VPNavScreenMenu.vue +24 -0
  43. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +118 -0
  44. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +33 -0
  45. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +35 -0
  46. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +34 -0
  47. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
  48. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
  49. package/dist/client/theme-default/components/VPPage.vue +5 -0
  50. package/dist/client/theme-default/components/VPSidebar.vue +118 -0
  51. package/dist/client/theme-default/components/VPSidebarGroup.vue +44 -0
  52. package/dist/client/theme-default/components/VPSidebarLink.vue +57 -0
  53. package/dist/client/theme-default/components/VPSkipLink.vue +72 -0
  54. package/dist/client/theme-default/components/VPSocialLink.vue +63 -0
  55. package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
  56. package/dist/client/theme-default/components/VPSponsors.vue +77 -0
  57. package/dist/client/theme-default/components/VPSponsorsGrid.vue +32 -0
  58. package/dist/client/theme-default/components/VPSwitch.vue +66 -0
  59. package/dist/client/theme-default/components/VPSwitchAppearance.vue +74 -0
  60. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
  61. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
  62. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
  63. package/dist/client/theme-default/components/icons/{ArrowLeft.vue → VPIconArrowLeft.vue} +0 -0
  64. package/dist/client/theme-default/components/icons/{ArrowRight.vue → VPIconArrowRight.vue} +0 -0
  65. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
  66. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
  67. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
  68. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
  69. package/dist/client/theme-default/components/icons/VPIconDiscord.vue +5 -0
  70. package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
  71. package/dist/client/theme-default/components/icons/VPIconExternalLink.vue +13 -0
  72. package/dist/client/theme-default/components/icons/VPIconFacebook.vue +5 -0
  73. package/dist/client/theme-default/components/icons/VPIconGitHub.vue +5 -0
  74. package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
  75. package/dist/client/theme-default/components/icons/VPIconInstagram.vue +5 -0
  76. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
  77. package/dist/client/theme-default/components/icons/VPIconLinkedIn.vue +5 -0
  78. package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
  79. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
  80. package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
  81. package/dist/client/theme-default/components/icons/VPIconSlack.vue +5 -0
  82. package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
  83. package/dist/client/theme-default/components/icons/VPIconTwitter.vue +5 -0
  84. package/dist/client/theme-default/components/icons/VPIconYouTube.vue +5 -0
  85. package/dist/client/theme-default/composables/edit-link.js +22 -0
  86. package/dist/client/theme-default/composables/flyout.js +40 -0
  87. package/dist/client/theme-default/composables/nav.js +27 -1
  88. package/dist/client/theme-default/composables/outline.js +112 -0
  89. package/dist/client/theme-default/composables/prev-next.js +18 -0
  90. package/dist/client/theme-default/composables/sidebar.js +57 -0
  91. package/dist/client/theme-default/composables/sponsor-grid.js +92 -0
  92. package/dist/client/theme-default/composables/sponsor.js +87 -0
  93. package/dist/client/theme-default/fonts/inter-cyrillic-ext.woff2 +0 -0
  94. package/dist/client/theme-default/fonts/inter-cyrillic.woff2 +0 -0
  95. package/dist/client/theme-default/fonts/inter-greek-ext.woff2 +0 -0
  96. package/dist/client/theme-default/fonts/inter-greek.woff2 +0 -0
  97. package/dist/client/theme-default/fonts/inter-latin-ext.woff2 +0 -0
  98. package/dist/client/theme-default/fonts/inter-latin.woff2 +0 -0
  99. package/dist/client/theme-default/fonts/inter-vietnamese.woff2 +0 -0
  100. package/dist/client/theme-default/index.js +8 -4
  101. package/dist/client/theme-default/styles/base.css +203 -0
  102. package/dist/client/theme-default/styles/fonts.css +67 -0
  103. package/dist/client/theme-default/styles/utils.css +9 -0
  104. package/dist/client/theme-default/styles/vars.css +291 -66
  105. package/dist/client/theme-default/styles/vp-doc.css +425 -0
  106. package/dist/client/theme-default/styles/vp-sponsor.css +86 -0
  107. package/dist/client/theme-default/support/sidebar.js +29 -0
  108. package/dist/client/theme-default/support/utils.js +62 -0
  109. package/dist/node/alias.js +60 -0
  110. package/dist/node/alias.js.map +1 -0
  111. package/dist/node/build/build.js +57 -0
  112. package/dist/node/build/build.js.map +1 -0
  113. package/dist/node/build/buildMPAClient.js +44 -0
  114. package/dist/node/build/buildMPAClient.js.map +1 -0
  115. package/dist/node/build/bundle.js +163 -0
  116. package/dist/node/build/bundle.js.map +1 -0
  117. package/dist/node/build/render.js +185 -0
  118. package/dist/node/build/render.js.map +1 -0
  119. package/dist/node/cli.js +37 -294
  120. package/dist/node/cli.js.map +1 -0
  121. package/dist/node/config.js +176 -0
  122. package/dist/node/config.js.map +1 -0
  123. package/dist/node/index.d.ts +122 -79
  124. package/dist/node/index.js +22 -37
  125. package/dist/node/index.js.map +1 -0
  126. package/dist/node/markdown/markdown.js +75 -0
  127. package/dist/node/markdown/markdown.js.map +1 -0
  128. package/dist/node/markdown/plugins/component.js +86 -0
  129. package/dist/node/markdown/plugins/component.js.map +1 -0
  130. package/dist/node/markdown/plugins/containers.js +41 -0
  131. package/dist/node/markdown/plugins/containers.js.map +1 -0
  132. package/dist/node/markdown/plugins/headings.js +25 -0
  133. package/dist/node/markdown/plugins/headings.js.map +1 -0
  134. package/dist/node/markdown/plugins/highlight.js +53 -0
  135. package/dist/node/markdown/plugins/highlight.js.map +1 -0
  136. package/dist/node/markdown/plugins/highlightLines.js +48 -0
  137. package/dist/node/markdown/plugins/highlightLines.js.map +1 -0
  138. package/dist/node/markdown/plugins/hoist.js +22 -0
  139. package/dist/node/markdown/plugins/hoist.js.map +1 -0
  140. package/dist/node/markdown/plugins/image.js +17 -0
  141. package/dist/node/markdown/plugins/image.js.map +1 -0
  142. package/dist/node/markdown/plugins/lineNumbers.js +23 -0
  143. package/dist/node/markdown/plugins/lineNumbers.js.map +1 -0
  144. package/dist/node/markdown/plugins/link.js +85 -0
  145. package/dist/node/markdown/plugins/link.js.map +1 -0
  146. package/dist/node/markdown/plugins/preWrapper.js +22 -0
  147. package/dist/node/markdown/plugins/preWrapper.js.map +1 -0
  148. package/dist/node/markdown/plugins/slugify.js +26 -0
  149. package/dist/node/markdown/plugins/slugify.js.map +1 -0
  150. package/dist/node/markdown/plugins/snippet.js +146 -0
  151. package/dist/node/markdown/plugins/snippet.js.map +1 -0
  152. package/dist/node/markdownToVue.js +166 -0
  153. package/dist/node/markdownToVue.js.map +1 -0
  154. package/dist/node/plugin.js +227 -0
  155. package/dist/node/plugin.js.map +1 -0
  156. package/dist/node/serve/serve.js +59 -0
  157. package/dist/node/serve/serve.js.map +1 -0
  158. package/dist/node/{serve-777539c0.js → serve-b5dc02b2.js} +27 -2
  159. package/dist/node/server.js +18 -0
  160. package/dist/node/server.js.map +1 -0
  161. package/dist/node/shared.js +72 -0
  162. package/dist/node/shared.js.map +1 -0
  163. package/dist/node/staticDataPlugin.js +99 -0
  164. package/dist/node/staticDataPlugin.js.map +1 -0
  165. package/dist/node/utils/getGitTimestamp.js +17 -0
  166. package/dist/node/utils/getGitTimestamp.js.map +1 -0
  167. package/dist/node/utils/parseHeader.js +57 -0
  168. package/dist/node/utils/parseHeader.js.map +1 -0
  169. package/dist/node/utils/slash.js +8 -0
  170. package/dist/node/utils/slash.js.map +1 -0
  171. package/package.json +31 -25
  172. package/types/default-theme.d.ts +115 -78
  173. package/types/shared.d.ts +11 -6
  174. package/dist/client/theme-default/components/AlgoliaSearchBox.vue +0 -188
  175. package/dist/client/theme-default/components/BuySellAds.vue +0 -152
  176. package/dist/client/theme-default/components/CarbonAds.vue +0 -99
  177. package/dist/client/theme-default/components/EditLink.vue +0 -38
  178. package/dist/client/theme-default/components/Home.vue +0 -31
  179. package/dist/client/theme-default/components/HomeFeatures.vue +0 -143
  180. package/dist/client/theme-default/components/HomeFooter.vue +0 -50
  181. package/dist/client/theme-default/components/HomeHero.vue +0 -161
  182. package/dist/client/theme-default/components/LastUpdated.vue +0 -60
  183. package/dist/client/theme-default/components/NavBar.vue +0 -60
  184. package/dist/client/theme-default/components/NavBarTitle.vue +0 -41
  185. package/dist/client/theme-default/components/NavDropdownLink.vue +0 -135
  186. package/dist/client/theme-default/components/NavDropdownLinkItem.vue +0 -76
  187. package/dist/client/theme-default/components/NavLink.vue +0 -61
  188. package/dist/client/theme-default/components/NavLinks.vue +0 -52
  189. package/dist/client/theme-default/components/NextAndPrevLinks.vue +0 -88
  190. package/dist/client/theme-default/components/Page.vue +0 -53
  191. package/dist/client/theme-default/components/PageFooter.vue +0 -44
  192. package/dist/client/theme-default/components/SideBar.vue +0 -60
  193. package/dist/client/theme-default/components/SideBarLink.js +0 -68
  194. package/dist/client/theme-default/components/SideBarLinks.vue +0 -12
  195. package/dist/client/theme-default/components/ToggleSideBarButton.vue +0 -46
  196. package/dist/client/theme-default/components/icons/OutboundLink.vue +0 -31
  197. package/dist/client/theme-default/composables/activeSidebarLink.js +0 -99
  198. package/dist/client/theme-default/composables/editLink.js +0 -49
  199. package/dist/client/theme-default/composables/navLink.js +0 -42
  200. package/dist/client/theme-default/composables/nextAndPrevLinks.js +0 -37
  201. package/dist/client/theme-default/composables/repo.js +0 -38
  202. package/dist/client/theme-default/composables/sideBar.js +0 -57
  203. package/dist/client/theme-default/styles/code.css +0 -299
  204. package/dist/client/theme-default/styles/custom-blocks.css +0 -76
  205. package/dist/client/theme-default/styles/layout.css +0 -236
  206. package/dist/client/theme-default/styles/sidebar-links.css +0 -107
  207. package/dist/client/theme-default/support/sideBar.js +0 -46
  208. package/dist/client/theme-default/utils.js +0 -63
@@ -1,161 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import { useData, withBase } from 'vitepress'
4
- import NavLink from './NavLink.vue'
5
-
6
- const { site, frontmatter } = useData()
7
-
8
- const showHero = computed(() => {
9
- const { heroImage, heroText, tagline, actionLink, actionText } =
10
- frontmatter.value
11
- return heroImage || heroText || tagline || (actionLink && actionText)
12
- })
13
-
14
- const heroText = computed(() => frontmatter.value.heroText || site.value.title)
15
- const tagline = computed(
16
- () => frontmatter.value.tagline || site.value.description
17
- )
18
- </script>
19
-
20
- <template>
21
- <header v-if="showHero" class="home-hero">
22
- <figure v-if="frontmatter.heroImage" class="figure">
23
- <img
24
- class="image"
25
- :src="withBase(frontmatter.heroImage)"
26
- :alt="frontmatter.heroAlt"
27
- />
28
- </figure>
29
-
30
- <h1 v-if="heroText" id="main-title" class="title">{{ heroText }}</h1>
31
- <p v-if="tagline" class="tagline">{{ tagline }}</p>
32
-
33
- <NavLink
34
- v-if="frontmatter.actionLink && frontmatter.actionText"
35
- :item="{ link: frontmatter.actionLink, text: frontmatter.actionText }"
36
- class="action"
37
- />
38
-
39
- <NavLink
40
- v-if="frontmatter.altActionLink && frontmatter.altActionText"
41
- :item="{
42
- link: frontmatter.altActionLink,
43
- text: frontmatter.altActionText
44
- }"
45
- class="action alt"
46
- />
47
- </header>
48
- </template>
49
-
50
- <style scoped>
51
- .home-hero {
52
- margin: 2.5rem 0 2.75rem;
53
- padding: 0 1.5rem;
54
- text-align: center;
55
- }
56
-
57
- @media (min-width: 420px) {
58
- .home-hero {
59
- margin: 3.5rem 0;
60
- }
61
- }
62
-
63
- @media (min-width: 720px) {
64
- .home-hero {
65
- margin: 4rem 0 4.25rem;
66
- }
67
- }
68
-
69
- .figure {
70
- padding: 0 1.5rem;
71
- }
72
-
73
- .image {
74
- display: block;
75
- margin: 0 auto;
76
- width: auto;
77
- max-width: 100%;
78
- max-height: 280px;
79
- }
80
-
81
- .title {
82
- margin-top: 1.5rem;
83
- font-size: 2rem;
84
- }
85
-
86
- @media (min-width: 420px) {
87
- .title {
88
- font-size: 3rem;
89
- }
90
- }
91
-
92
- @media (min-width: 720px) {
93
- .title {
94
- margin-top: 2rem;
95
- }
96
- }
97
-
98
- .tagline {
99
- margin: 0;
100
- margin-top: 0.25rem;
101
- line-height: 1.3;
102
- font-size: 1.2rem;
103
- color: var(--c-text-light);
104
- }
105
-
106
- @media (min-width: 420px) {
107
- .tagline {
108
- line-height: 1.2;
109
- font-size: 1.6rem;
110
- }
111
- }
112
-
113
- .action {
114
- margin-top: 1.5rem;
115
- display: inline-block;
116
- }
117
-
118
- .action.alt {
119
- margin-left: 1.5rem;
120
- }
121
-
122
- @media (min-width: 420px) {
123
- .action {
124
- margin-top: 2rem;
125
- display: inline-block;
126
- }
127
- }
128
-
129
- .action :deep(.item) {
130
- display: inline-block;
131
- border-radius: 6px;
132
- padding: 0 20px;
133
- line-height: 44px;
134
- font-size: 1rem;
135
- font-weight: 500;
136
- color: var(--c-bg);
137
- background-color: var(--c-brand);
138
- border: 2px solid var(--c-brand);
139
- transition: background-color 0.1s ease;
140
- }
141
-
142
- .action.alt :deep(.item) {
143
- background-color: var(--c-bg);
144
- color: var(--c-brand);
145
- }
146
-
147
- .action :deep(.item:hover) {
148
- text-decoration: none;
149
- color: var(--c-bg);
150
- background-color: var(--c-brand-light);
151
- }
152
-
153
- @media (min-width: 420px) {
154
- .action :deep(.item) {
155
- padding: 0 24px;
156
- line-height: 52px;
157
- font-size: 1.2rem;
158
- font-weight: 500;
159
- }
160
- }
161
- </style>
@@ -1,60 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref, computed, onMounted, watchEffect } from 'vue'
3
- import { useData } from 'vitepress'
4
-
5
- const { theme, page } = useData()
6
-
7
- const hasLastUpdated = computed(() => {
8
- const lu = theme.value.lastUpdated
9
-
10
- return lu !== undefined && lu !== false && page.value.lastUpdated !== 0
11
- })
12
-
13
- const prefix = computed(() => {
14
- const p = theme.value.lastUpdated
15
- return p === true ? 'Last Updated' : p
16
- })
17
-
18
- const datetime = ref('')
19
- onMounted(() => {
20
- watchEffect(() => {
21
- // locale string might be different based on end user
22
- // and will lead to potential hydration mismatch if calculated at build time
23
- datetime.value = new Date(page.value.lastUpdated!).toLocaleString('en-US')
24
- })
25
- })
26
- </script>
27
-
28
- <template>
29
- <p v-if="hasLastUpdated" class="last-updated">
30
- <span class="prefix">{{ prefix }}:</span>
31
- <span class="datetime">{{ datetime }}</span>
32
- </p>
33
- </template>
34
-
35
- <style scoped>
36
- .last-updated {
37
- display: inline-block;
38
- margin: 0;
39
- line-height: 1.4;
40
- font-size: 0.9rem;
41
- color: var(--c-text-light);
42
- }
43
-
44
- @media (min-width: 960px) {
45
- .last-updated {
46
- font-size: 1rem;
47
- }
48
- }
49
-
50
- .prefix {
51
- display: inline-block;
52
- font-weight: 500;
53
- }
54
-
55
- .datetime {
56
- display: inline-block;
57
- margin-left: 6px;
58
- font-weight: 400;
59
- }
60
- </style>
@@ -1,60 +0,0 @@
1
- <script setup lang="ts">
2
- import NavBarTitle from './NavBarTitle.vue'
3
- import NavLinks from './NavLinks.vue'
4
- import ToggleSideBarButton from './ToggleSideBarButton.vue'
5
-
6
- defineEmits(['toggle'])
7
- </script>
8
-
9
- <template>
10
- <header class="nav-bar">
11
- <ToggleSideBarButton @toggle="$emit('toggle')" />
12
-
13
- <NavBarTitle />
14
-
15
- <div class="flex-grow" />
16
-
17
- <div class="nav">
18
- <NavLinks />
19
- </div>
20
-
21
- <slot name="search" />
22
- </header>
23
- </template>
24
-
25
- <style scoped>
26
- .nav-bar {
27
- position: fixed;
28
- top: 0;
29
- right: 0;
30
- left: 0;
31
- z-index: var(--z-index-navbar);
32
- display: flex;
33
- justify-content: space-between;
34
- align-items: center;
35
- border-bottom: 1px solid var(--c-divider);
36
- padding: 0.7rem 1.5rem 0.7rem 4rem;
37
- height: var(--header-height);
38
- background-color: var(--c-bg);
39
- }
40
-
41
- @media (min-width: 720px) {
42
- .nav-bar {
43
- padding: 0.7rem 1.5rem;
44
- }
45
- }
46
-
47
- .flex-grow {
48
- flex-grow: 1;
49
- }
50
-
51
- .nav {
52
- display: none;
53
- }
54
-
55
- @media (min-width: 720px) {
56
- .nav {
57
- display: block;
58
- }
59
- }
60
- </style>
@@ -1,41 +0,0 @@
1
- <script setup lang="ts">
2
- import { withBase, useData } from 'vitepress'
3
- const { site, theme, localePath } = useData()
4
- </script>
5
-
6
- <template>
7
- <a
8
- class="nav-bar-title"
9
- :href="localePath"
10
- :aria-label="`${site.title}, back to home`"
11
- >
12
- <img
13
- v-if="theme.logo"
14
- class="logo"
15
- :src="withBase(theme.logo)"
16
- alt="Logo"
17
- />
18
- {{ site.title }}
19
- </a>
20
- </template>
21
-
22
- <style scoped>
23
- .nav-bar-title {
24
- font-size: 1.3rem;
25
- font-weight: 600;
26
- color: var(--c-text);
27
- display: flex;
28
- justify-content: center;
29
- align-items: center;
30
- }
31
-
32
- .nav-bar-title:hover {
33
- text-decoration: none;
34
- }
35
-
36
- .logo {
37
- margin-right: 0.75rem;
38
- height: 1.3rem;
39
- vertical-align: bottom;
40
- }
41
- </style>
@@ -1,135 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref, watch } from 'vue'
3
- import { useRoute } from 'vitepress'
4
- import type { DefaultTheme } from '../config'
5
- import NavDropdownLinkItem from './NavDropdownLinkItem.vue'
6
-
7
- defineProps<{
8
- item: DefaultTheme.NavItemWithChildren
9
- }>()
10
-
11
- const route = useRoute()
12
-
13
- const open = ref(false)
14
-
15
- watch(
16
- () => route.path,
17
- () => {
18
- open.value = false
19
- }
20
- )
21
-
22
- function toggle() {
23
- open.value = !open.value
24
- }
25
- </script>
26
-
27
- <template>
28
- <div class="nav-dropdown-link" :class="{ open }">
29
- <button class="button" :aria-label="item.ariaLabel" @click="toggle">
30
- <span class="button-text">{{ item.text }}</span>
31
- <span class="button-arrow" :class="open ? 'down' : 'right'" />
32
- </button>
33
-
34
- <ul class="dialog">
35
- <li v-for="item in item.items" :key="item.text" class="dialog-item">
36
- <NavDropdownLinkItem :item="item" />
37
- </li>
38
- </ul>
39
- </div>
40
- </template>
41
-
42
- <style scoped>
43
- .nav-dropdown-link {
44
- position: relative;
45
- height: 36px;
46
- overflow: hidden;
47
- cursor: pointer;
48
- }
49
-
50
- @media (min-width: 720px) {
51
- .nav-dropdown-link {
52
- height: auto;
53
- overflow: visible;
54
- }
55
-
56
- .nav-dropdown-link:hover .dialog {
57
- display: block;
58
- }
59
- }
60
-
61
- .nav-dropdown-link.open {
62
- height: auto;
63
- }
64
-
65
- .button {
66
- display: block;
67
- border: 0;
68
- padding: 0 1.5rem;
69
- width: 100%;
70
- text-align: left;
71
- line-height: 36px;
72
- font-family: var(--font-family-base);
73
- font-size: 1rem;
74
- font-weight: 600;
75
- color: var(--c-text);
76
- white-space: nowrap;
77
- background-color: transparent;
78
- cursor: pointer;
79
- }
80
-
81
- .button:focus {
82
- outline: 0;
83
- }
84
-
85
- @media (min-width: 720px) {
86
- .button {
87
- border-bottom: 2px solid transparent;
88
- padding: 0;
89
- line-height: 24px;
90
- font-size: 0.9rem;
91
- font-weight: 500;
92
- }
93
- }
94
-
95
- .button-arrow {
96
- display: inline-block;
97
- margin-top: -1px;
98
- margin-left: 8px;
99
- border-top: 6px solid #ccc;
100
- border-right: 4px solid transparent;
101
- border-bottom: 0;
102
- border-left: 4px solid transparent;
103
- vertical-align: middle;
104
- }
105
-
106
- .button-arrow.right {
107
- transform: rotate(-90deg);
108
- }
109
-
110
- @media (min-width: 720px) {
111
- .button-arrow.right {
112
- transform: rotate(0);
113
- }
114
- }
115
-
116
- .dialog {
117
- margin: 0;
118
- padding: 0;
119
- list-style: none;
120
- }
121
-
122
- @media (min-width: 720px) {
123
- .dialog {
124
- display: none;
125
- position: absolute;
126
- top: 26px;
127
- right: -8px;
128
- border-radius: 6px;
129
- padding: 12px 0;
130
- min-width: 128px;
131
- background-color: var(--c-bg);
132
- box-shadow: var(--shadow-3);
133
- }
134
- }
135
- </style>
@@ -1,76 +0,0 @@
1
- <script setup lang="ts">
2
- import { toRefs } from 'vue'
3
- import type { DefaultTheme } from '../config'
4
- import { useNavLink } from '../composables/navLink'
5
- import OutboundLink from './icons/OutboundLink.vue'
6
-
7
- const props = defineProps<{
8
- item: DefaultTheme.NavItemWithLink
9
- }>()
10
-
11
- const propsRefs = toRefs(props)
12
-
13
- const { props: linkProps, isExternal } = useNavLink(propsRefs.item)
14
- </script>
15
-
16
- <template>
17
- <div class="nav-dropdown-link-item">
18
- <a class="item" v-bind="linkProps">
19
- <span class="arrow" />
20
- <span class="text">{{ item.text }}</span>
21
- <span class="icon"><OutboundLink v-if="isExternal" /></span>
22
- </a>
23
- </div>
24
- </template>
25
-
26
- <style scoped>
27
- .item {
28
- display: block;
29
- padding: 0 1.5rem 0 2.5rem;
30
- line-height: 32px;
31
- font-size: 0.9rem;
32
- font-weight: 500;
33
- color: var(--c-text);
34
- white-space: nowrap;
35
- }
36
-
37
- @media (min-width: 720px) {
38
- .item {
39
- padding: 0 24px 0 12px;
40
- line-height: 32px;
41
- font-size: 0.85rem;
42
- font-weight: 500;
43
- color: var(--c-text);
44
- white-space: nowrap;
45
- }
46
-
47
- .item.active .arrow {
48
- opacity: 1;
49
- }
50
- }
51
-
52
- .item:hover,
53
- .item.active {
54
- text-decoration: none;
55
- color: var(--c-brand);
56
- }
57
-
58
- .item.external:hover {
59
- border-bottom-color: transparent;
60
- color: var(--c-text);
61
- }
62
-
63
- @media (min-width: 720px) {
64
- .arrow {
65
- display: inline-block;
66
- margin-right: 8px;
67
- border-top: 6px solid #ccc;
68
- border-right: 4px solid transparent;
69
- border-bottom: 0;
70
- border-left: 4px solid transparent;
71
- vertical-align: middle;
72
- opacity: 0;
73
- transform: translateY(-2px) rotate(-90deg);
74
- }
75
- }
76
- </style>
@@ -1,61 +0,0 @@
1
- <script setup lang="ts">
2
- import { toRefs } from 'vue'
3
- import type { DefaultTheme } from '../config'
4
- import { useNavLink } from '../composables/navLink'
5
- import OutboundLink from './icons/OutboundLink.vue'
6
-
7
- const props = defineProps<{
8
- item: DefaultTheme.NavItemWithLink
9
- }>()
10
-
11
- const propsRefs = toRefs(props)
12
-
13
- const { props: linkProps, isExternal } = useNavLink(propsRefs.item)
14
- </script>
15
-
16
- <template>
17
- <div class="nav-link">
18
- <a class="item" v-bind="linkProps">
19
- {{ item.text }} <OutboundLink v-if="isExternal" />
20
- </a>
21
- </div>
22
- </template>
23
-
24
- <style scoped>
25
- .item {
26
- display: block;
27
- padding: 0 1.5rem;
28
- line-height: 36px;
29
- font-size: 1rem;
30
- font-weight: 600;
31
- color: var(--c-text);
32
- white-space: nowrap;
33
- }
34
-
35
- .item:hover,
36
- .item.active {
37
- text-decoration: none;
38
- color: var(--c-brand);
39
- }
40
-
41
- .item.external:hover {
42
- border-bottom-color: transparent;
43
- color: var(--c-text);
44
- }
45
-
46
- @media (min-width: 720px) {
47
- .item {
48
- border-bottom: 2px solid transparent;
49
- padding: 0;
50
- line-height: 24px;
51
- font-size: 0.9rem;
52
- font-weight: 500;
53
- }
54
-
55
- .item:hover,
56
- .item.active {
57
- border-bottom-color: var(--c-brand);
58
- color: var(--c-text);
59
- }
60
- }
61
- </style>
@@ -1,52 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import { useData } from 'vitepress'
4
- import { useLanguageLinks } from '../composables/nav'
5
- import { useRepo } from '../composables/repo'
6
- import NavLink from './NavLink.vue'
7
- import NavDropdownLink from './NavDropdownLink.vue'
8
-
9
- const { theme } = useData()
10
- const localeLinks = useLanguageLinks()
11
- const repo = useRepo()
12
- const show = computed(() => theme.value.nav || repo.value || localeLinks.value)
13
- </script>
14
-
15
- <template>
16
- <nav v-if="show" class="nav-links">
17
- <template v-if="theme.nav">
18
- <div v-for="item in theme.nav" :key="item.text" class="item">
19
- <NavDropdownLink v-if="item.items" :item="item" />
20
- <NavLink v-else :item="item" />
21
- </div>
22
- </template>
23
-
24
- <div v-if="localeLinks" class="item">
25
- <NavDropdownLink :item="localeLinks" />
26
- </div>
27
-
28
- <div v-if="repo" class="item">
29
- <NavLink :item="repo" />
30
- </div>
31
- </nav>
32
- </template>
33
-
34
- <style scoped>
35
- .nav-links {
36
- padding: 0.75rem 0;
37
- border-bottom: 1px solid var(--c-divider);
38
- }
39
-
40
- @media (min-width: 720px) {
41
- .nav-links {
42
- display: flex;
43
- padding: 6px 0 0;
44
- align-items: center;
45
- border-bottom: 0;
46
- }
47
-
48
- .item + .item {
49
- padding-left: 24px;
50
- }
51
- }
52
- </style>