vitepress 1.0.0-draft.2 → 1.0.0-draft.5

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 (127) hide show
  1. package/README.md +3 -1
  2. package/bin/vitepress.js +1 -1
  3. package/dist/client/app/composables/head.js +2 -2
  4. package/dist/client/app/data.js +2 -4
  5. package/dist/client/app/index.js +1 -5
  6. package/dist/client/index.d.ts +123 -134
  7. package/dist/client/index.js +1 -2
  8. package/dist/client/shared.js +21 -0
  9. package/dist/client/theme-default/Layout.vue +7 -0
  10. package/dist/client/theme-default/NotFound.vue +74 -14
  11. package/dist/client/theme-default/components/VPBox.vue +1 -5
  12. package/dist/client/theme-default/components/VPCarbonAds.vue +90 -0
  13. package/dist/client/theme-default/components/VPContent.vue +14 -10
  14. package/dist/client/theme-default/components/VPDoc.vue +73 -58
  15. package/dist/client/theme-default/components/VPDocAside.vue +34 -0
  16. package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +13 -0
  17. package/dist/client/theme-default/components/{VPDocOutline.vue → VPDocAsideOutline.vue} +14 -3
  18. package/dist/client/theme-default/components/VPDocAsideSponsors.vue +32 -0
  19. package/dist/client/theme-default/components/VPDocFooter.vue +1 -1
  20. package/dist/client/theme-default/components/VPFlyout.vue +2 -3
  21. package/dist/client/theme-default/components/VPFooter.vue +1 -1
  22. package/dist/client/theme-default/components/VPHero.vue +3 -3
  23. package/dist/client/theme-default/components/VPHomeSponsors.vue +3 -7
  24. package/dist/client/theme-default/components/VPLink.vue +2 -1
  25. package/dist/client/theme-default/components/VPLocalNav.vue +1 -1
  26. package/dist/client/theme-default/components/VPMenu.vue +8 -13
  27. package/dist/client/theme-default/components/VPMenuLink.vue +10 -4
  28. package/dist/client/theme-default/components/VPNav.vue +18 -1
  29. package/dist/client/theme-default/components/VPNavBar.vue +20 -8
  30. package/dist/client/theme-default/components/VPNavBarExtra.vue +20 -41
  31. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +2 -8
  32. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +3 -3
  33. package/dist/client/theme-default/components/VPNavBarSearch.vue +6 -6
  34. package/dist/client/theme-default/components/VPNavBarTitle.vue +4 -2
  35. package/dist/client/theme-default/components/VPNavBarTranslations.vue +10 -39
  36. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +1 -2
  37. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +1 -1
  38. package/dist/client/theme-default/components/VPSidebar.vue +12 -6
  39. package/dist/client/theme-default/components/VPSidebarGroup.vue +80 -17
  40. package/dist/client/theme-default/components/VPSidebarLink.vue +2 -9
  41. package/dist/client/theme-default/components/VPSocialLink.vue +2 -2
  42. package/dist/client/theme-default/components/VPSocialLinks.vue +1 -1
  43. package/dist/client/theme-default/components/VPSponsors.vue +15 -40
  44. package/dist/client/theme-default/components/VPSponsorsGrid.vue +2 -2
  45. package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
  46. package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
  47. package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
  48. package/dist/client/theme-default/composables/aside.js +17 -0
  49. package/dist/client/theme-default/composables/copy-code.js +33 -0
  50. package/dist/client/theme-default/composables/outline.js +14 -4
  51. package/dist/client/theme-default/composables/sponsor-grid.js +8 -6
  52. package/dist/client/theme-default/index.js +4 -2
  53. package/dist/client/theme-default/styles/base.css +9 -1
  54. package/dist/client/theme-default/styles/components/custom-block.css +90 -0
  55. package/dist/client/theme-default/styles/{vp-doc.css → components/vp-doc.css} +152 -115
  56. package/dist/client/theme-default/styles/{vp-sponsor.css → components/vp-sponsor.css} +51 -7
  57. package/dist/client/theme-default/styles/vars.css +109 -58
  58. package/dist/node/cli.js +295 -37
  59. package/dist/node/index.d.ts +371 -361
  60. package/dist/node/index.js +22 -22
  61. package/dist/node/serve-f7c10936.js +64795 -0
  62. package/dist/node-cjs/cli.cjs +304 -0
  63. package/dist/node-cjs/index.cjs +38 -0
  64. package/dist/{node/serve-b5dc02b2.js → node-cjs/serve-c220f0a8.cjs} +27511 -28708
  65. package/package.json +47 -40
  66. package/theme.d.ts +7 -2
  67. package/types/default-theme.d.ts +15 -2
  68. package/types/shared.d.ts +3 -0
  69. package/dist/client/theme-default/composables/sponsor.js +0 -87
  70. package/dist/node/alias.js +0 -60
  71. package/dist/node/alias.js.map +0 -1
  72. package/dist/node/build/build.js +0 -57
  73. package/dist/node/build/build.js.map +0 -1
  74. package/dist/node/build/buildMPAClient.js +0 -44
  75. package/dist/node/build/buildMPAClient.js.map +0 -1
  76. package/dist/node/build/bundle.js +0 -163
  77. package/dist/node/build/bundle.js.map +0 -1
  78. package/dist/node/build/render.js +0 -185
  79. package/dist/node/build/render.js.map +0 -1
  80. package/dist/node/cli.js.map +0 -1
  81. package/dist/node/config.js +0 -176
  82. package/dist/node/config.js.map +0 -1
  83. package/dist/node/index.js.map +0 -1
  84. package/dist/node/markdown/markdown.js +0 -75
  85. package/dist/node/markdown/markdown.js.map +0 -1
  86. package/dist/node/markdown/plugins/component.js +0 -86
  87. package/dist/node/markdown/plugins/component.js.map +0 -1
  88. package/dist/node/markdown/plugins/containers.js +0 -41
  89. package/dist/node/markdown/plugins/containers.js.map +0 -1
  90. package/dist/node/markdown/plugins/headings.js +0 -25
  91. package/dist/node/markdown/plugins/headings.js.map +0 -1
  92. package/dist/node/markdown/plugins/highlight.js +0 -53
  93. package/dist/node/markdown/plugins/highlight.js.map +0 -1
  94. package/dist/node/markdown/plugins/highlightLines.js +0 -48
  95. package/dist/node/markdown/plugins/highlightLines.js.map +0 -1
  96. package/dist/node/markdown/plugins/hoist.js +0 -22
  97. package/dist/node/markdown/plugins/hoist.js.map +0 -1
  98. package/dist/node/markdown/plugins/image.js +0 -17
  99. package/dist/node/markdown/plugins/image.js.map +0 -1
  100. package/dist/node/markdown/plugins/lineNumbers.js +0 -23
  101. package/dist/node/markdown/plugins/lineNumbers.js.map +0 -1
  102. package/dist/node/markdown/plugins/link.js +0 -85
  103. package/dist/node/markdown/plugins/link.js.map +0 -1
  104. package/dist/node/markdown/plugins/preWrapper.js +0 -22
  105. package/dist/node/markdown/plugins/preWrapper.js.map +0 -1
  106. package/dist/node/markdown/plugins/slugify.js +0 -26
  107. package/dist/node/markdown/plugins/slugify.js.map +0 -1
  108. package/dist/node/markdown/plugins/snippet.js +0 -146
  109. package/dist/node/markdown/plugins/snippet.js.map +0 -1
  110. package/dist/node/markdownToVue.js +0 -166
  111. package/dist/node/markdownToVue.js.map +0 -1
  112. package/dist/node/plugin.js +0 -227
  113. package/dist/node/plugin.js.map +0 -1
  114. package/dist/node/serve/serve.js +0 -59
  115. package/dist/node/serve/serve.js.map +0 -1
  116. package/dist/node/server.js +0 -18
  117. package/dist/node/server.js.map +0 -1
  118. package/dist/node/shared.js +0 -72
  119. package/dist/node/shared.js.map +0 -1
  120. package/dist/node/staticDataPlugin.js +0 -99
  121. package/dist/node/staticDataPlugin.js.map +0 -1
  122. package/dist/node/utils/getGitTimestamp.js +0 -17
  123. package/dist/node/utils/getGitTimestamp.js.map +0 -1
  124. package/dist/node/utils/parseHeader.js +0 -57
  125. package/dist/node/utils/parseHeader.js.map +0 -1
  126. package/dist/node/utils/slash.js +0 -8
  127. package/dist/node/utils/slash.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { useData } from 'vitepress'
3
3
  import VPFlyout from './VPFlyout.vue'
4
+ import VPMenuLink from './VPMenuLink.vue'
4
5
  import VPSwitchAppearance from './VPSwitchAppearance.vue'
5
6
  import VPSocialLinks from './VPSocialLinks.vue'
6
7
 
@@ -10,21 +11,15 @@ const { site, theme } = useData()
10
11
  <template>
11
12
  <VPFlyout class="VPNavBarExtra" label="extra navigation">
12
13
  <div v-if="theme.localeLinks" class="group">
13
- <div class="trans">
14
- <p class="trans-title">
15
- {{ theme.localeLinks.text }}
16
- </p>
14
+ <p class="trans-title">{{ theme.localeLinks.text }}</p>
17
15
 
18
- <ul class="trans-list">
19
- <li v-for="locale in theme.localeLinks.items" :key="locale.link" class="trans-item">
20
- <a class="trans-link" :href="locale.link">{{ locale.text }}</a>
21
- </li>
22
- </ul>
23
- </div>
16
+ <template v-for="locale in theme.localeLinks.items" :key="locale.link">
17
+ <VPMenuLink :item="locale" />
18
+ </template>
24
19
  </div>
25
20
 
26
21
  <div v-if="site.appearance" class="group">
27
- <div class="item">
22
+ <div class="item appearance">
28
23
  <p class="label">Appearance</p>
29
24
  <div class="appearance-action">
30
25
  <VPSwitchAppearance />
@@ -33,8 +28,8 @@ const { site, theme } = useData()
33
28
  </div>
34
29
 
35
30
  <div v-if="theme.socialLinks" class="group">
36
- <div class="item">
37
- <VPSocialLinks class="social-links" :links="theme.socialLinks" />
31
+ <div class="item social-links">
32
+ <VPSocialLinks class="social-links-list" :links="theme.socialLinks" />
38
33
  </div>
39
34
  </div>
40
35
  </VPFlyout>
@@ -63,45 +58,29 @@ const { site, theme } = useData()
63
58
  }
64
59
 
65
60
  .trans-title {
66
- display: flex;
67
- align-items: center;
68
- font-size: 13px;
69
- font-weight: 600;
70
- color: var(--vp-c-text-1);
71
- }
72
-
73
- .trans-icon {
74
- margin-right: 12px;
75
- width: 16px;
76
- height: 16px;
77
- fill: currentColor;
78
- }
79
-
80
- .trans-list {
81
- padding: 2px 0 0 0;
82
- }
83
-
84
- .trans-link {
85
- line-height: 28px;
86
- font-size: 13px;
61
+ padding: 0 24px 0 12px;
62
+ line-height: 32px;
63
+ font-size: 14px;
64
+ font-weight: 700;
87
65
  color: var(--vp-c-text-1);
88
- transition: color 0.25s;
89
66
  }
90
67
 
91
- .trans-link:hover {
92
- color: var(--vp-c-brand);
93
- }
94
-
95
- .item {
68
+ .item.appearance,
69
+ .item.social-links {
96
70
  display: flex;
97
71
  align-items: center;
72
+ padding: 0 24px;
73
+ }
74
+
75
+ .item.appearance {
76
+ min-width: 176px;
98
77
  }
99
78
 
100
79
  .appearance-action {
101
80
  margin-right: -2px;
102
81
  }
103
82
 
104
- .social-links {
83
+ .social-links-list {
105
84
  margin: -4px -8px;
106
85
  }
107
86
  </style>
@@ -1,18 +1,12 @@
1
1
  <script lang="ts" setup>
2
- import { DefaultTheme, useData } from 'vitepress'
3
- import { isActive } from '../support/utils'
2
+ import { DefaultTheme } from '../config'
4
3
  import VPFlyout from './VPFlyout.vue'
5
4
 
6
5
  defineProps<{
7
6
  item: DefaultTheme.NavItemWithChildren
8
7
  }>()
9
-
10
- const { page } = useData()
11
8
  </script>
12
9
 
13
10
  <template>
14
- <VPFlyout
15
- :button="item.text"
16
- :items="item.items"
17
- />
11
+ <VPFlyout :button="item.text" :items="item.items" />
18
12
  </template>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
- import { DefaultTheme, useData } from 'vitepress'
2
+ import { useData } from 'vitepress'
3
3
  import { isActive } from '../support/utils'
4
- import { NavItemWithLink } from '../config'
4
+ import { DefaultTheme } from '../config'
5
5
  import VPLink from './VPLink.vue'
6
6
 
7
7
  defineProps<{
@@ -34,7 +34,7 @@ const { page } = useData()
34
34
  align-items: center;
35
35
  padding: 0 12px;
36
36
  line-height: var(--vp-nav-height-mobile);
37
- font-size: 13px;
37
+ font-size: 14px;
38
38
  font-weight: 500;
39
39
  color: var(--vp-c-text-1);
40
40
  transition: color 0.25s;
@@ -1,11 +1,11 @@
1
1
  <script lang="ts" setup>
2
2
  import '@docsearch/css'
3
- import { useData } from 'vitepress'
4
3
  import { defineAsyncComponent, ref, onMounted, onUnmounted } from 'vue'
4
+ import { useData } from 'vitepress'
5
5
 
6
- const VPAlgoliaSearchBox = defineAsyncComponent(() => {
7
- return import('./VPAlgoliaSearchBox.vue')
8
- })
6
+ const VPAlgoliaSearchBox = __ALGOLIA__
7
+ ? defineAsyncComponent(() => import('./VPAlgoliaSearchBox.vue'))
8
+ : () => null
9
9
 
10
10
  const { theme } = useData()
11
11
 
@@ -161,12 +161,12 @@ function load() {
161
161
  padding: 0 10px 0 12px;
162
162
  width: 100%;
163
163
  height: 40px;
164
- background-color: var(--vp-c-bg-sidebar);
164
+ background-color: var(--vp-c-bg-alt);
165
165
  }
166
166
 
167
167
  .DocSearch-Button:hover {
168
168
  border-color: var(--vp-c-brand);
169
- background: var(--vp-c-bg-sidebar);
169
+ background: var(--vp-c-bg-alt);
170
170
  }
171
171
  }
172
172
 
@@ -18,14 +18,16 @@ const { hasSidebar } = useSidebar()
18
18
  <style scoped>
19
19
  .VPNavBarTitle {
20
20
  flex-shrink: 0;
21
+ border-bottom: 1px solid transparent;
22
+ transition: background-color 0.5s;
21
23
  }
22
24
 
23
25
  @media (min-width: 960px) {
24
26
  .VPNavBarTitle.has-sidebar {
25
27
  margin-right: 32px;
26
28
  width: calc(var(--vp-sidebar-width) - 64px);
27
- border-bottom: 1px solid var(--vp-c-divider-light);
28
- background-color: var(--vp-c-bg-sidebar);
29
+ border-bottom-color: var(--vp-c-divider-light);
30
+ background-color: var(--vp-c-bg-alt);
29
31
  }
30
32
  }
31
33
 
@@ -1,16 +1,10 @@
1
1
  <script lang="ts" setup>
2
- import { ref } from 'vue'
3
2
  import { useData } from 'vitepress'
4
3
  import VPIconLanguages from './icons/VPIconLanguages.vue'
5
4
  import VPFlyout from './VPFlyout.vue'
5
+ import VPMenuLink from './VPMenuLink.vue'
6
6
 
7
7
  const { theme } = useData()
8
-
9
- const isOpen = ref(false)
10
-
11
- function toggle() {
12
- isOpen.value = !isOpen.value
13
- }
14
8
  </script>
15
9
 
16
10
  <template>
@@ -19,16 +13,12 @@ function toggle() {
19
13
  class="VPNavBarTranslations"
20
14
  :icon="VPIconLanguages"
21
15
  >
22
- <div class="container">
23
- <p class="title">
24
- {{ theme.localeLinks.text }}
25
- </p>
16
+ <div class="items">
17
+ <p class="title">{{ theme.localeLinks.text }}</p>
26
18
 
27
- <ul class="list">
28
- <li v-for="locale in theme.localeLinks.items" :key="locale.link" class="lang">
29
- <a class="link" :href="locale.link">{{ locale.text }}</a>
30
- </li>
31
- </ul>
19
+ <template v-for="locale in theme.localeLinks.items" :key="locale.link">
20
+ <VPMenuLink :item="locale" />
21
+ </template>
32
22
  </div>
33
23
  </VPFlyout>
34
24
  </template>
@@ -45,30 +35,11 @@ function toggle() {
45
35
  }
46
36
  }
47
37
 
48
- .container {
49
- padding: 0 16px;
50
- }
51
-
52
38
  .title {
53
- display: flex;
54
- align-items: center;
55
- font-size: 13px;
56
- font-weight: 600;
57
- color: var(--vp-c-text-1);
58
- }
59
-
60
- .lang {
61
- padding: 4px 0 0 0;
62
- }
63
-
64
- .link {
65
- line-height: 28px;
66
- font-size: 13px;
39
+ padding: 0 24px 0 12px;
40
+ line-height: 32px;
41
+ font-size: 14px;
42
+ font-weight: 700;
67
43
  color: var(--vp-c-text-1);
68
- transition: color 0.25s;
69
- }
70
-
71
- .link:hover {
72
- color: var(--vp-c-brand);
73
44
  }
74
45
  </style>
@@ -1,13 +1,12 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, ref } from 'vue'
3
- import { DefaultTheme } from 'vitepress'
4
3
  import VPIconPlus from './icons/VPIconPlus.vue'
5
4
  import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue'
6
5
  import VPNavScreenMenuGroupSection from './VPNavScreenMenuGroupSection.vue'
7
6
 
8
7
  const props = defineProps<{
9
8
  text: string
10
- items: DefaultTheme.NavItemChild[]
9
+ items: any[]
11
10
  }>()
12
11
 
13
12
  const isOpen = ref(false)
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { DefaultTheme } from 'vitepress'
2
+ import { DefaultTheme } from '../config'
3
3
  import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue'
4
4
 
5
5
  defineProps<{
@@ -34,7 +34,12 @@ watchPostEffect(async () => {
34
34
  </span>
35
35
 
36
36
  <div v-for="group in sidebar" :key="group.text" class="group">
37
- <VPSidebarGroup :text="group.text" :items="group.items" />
37
+ <VPSidebarGroup
38
+ :text="group.text"
39
+ :items="group.items"
40
+ :collapsible="group.collapsible"
41
+ :collapsed="group.collapsed"
42
+ />
38
43
  </div>
39
44
  </nav>
40
45
  </aside>
@@ -80,7 +85,7 @@ watchPostEffect(async () => {
80
85
  width: var(--vp-sidebar-width);
81
86
  max-width: 100%;
82
87
  width: var(--vp-sidebar-width);
83
- background-color: var(--vp-c-bg-sidebar);
88
+ background-color: var(--vp-c-bg-alt);
84
89
  opacity: 1;
85
90
  visibility: visible;
86
91
  box-shadow: none;
@@ -91,8 +96,8 @@ watchPostEffect(async () => {
91
96
 
92
97
  @media (min-width: 1440px) {
93
98
  .VPSidebar {
94
- padding-left: calc((100% - var(--vp-layout-max-width)) / 2);
95
- width: calc((100% - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width) - 32px);
99
+ padding-left: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2);
100
+ width: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
96
101
  }
97
102
  }
98
103
 
@@ -103,12 +108,13 @@ watchPostEffect(async () => {
103
108
  .group + .group {
104
109
  margin-top: 32px;
105
110
  border-top: 1px solid var(--vp-c-divider-light);
106
- padding-top: 8px;
111
+ padding-top: 10px;
107
112
  }
108
113
 
109
114
  @media (min-width: 960px) {
110
115
  .group {
111
- padding-top: 8px;
116
+ padding-top: 10px;
117
+ width: calc(var(--vp-sidebar-width) - 64px);
112
118
  }
113
119
 
114
120
  .group + .group {
@@ -1,44 +1,107 @@
1
1
  <script lang="ts" setup>
2
- import { useData } from 'vitepress'
2
+ import { ref } from 'vue'
3
3
  import { DefaultTheme } from '../config'
4
+ import VPIconPlusSquare from './icons/VPIconPlusSquare.vue'
5
+ import VPIconMinusSquare from './icons/VPIconMinusSquare.vue'
4
6
  import VPSidebarLink from './VPSidebarLink.vue'
5
7
 
6
8
  const props = defineProps<{
7
9
  text: string
8
10
  items: DefaultTheme.SidebarItem[]
11
+ collapsible?: boolean
12
+ collapsed?: boolean
9
13
  }>()
10
14
 
11
- const { page } = useData()
15
+ const collapsed = ref(props.collapsible && props.collapsed)
16
+
17
+ function toggle() {
18
+ if (props.collapsible) {
19
+ collapsed.value = !collapsed.value
20
+ }
21
+ }
12
22
  </script>
13
23
 
14
24
  <template>
15
- <section class="VPSidebarGroup">
16
- <div class="title">
25
+ <section class="VPSidebarGroup" :class="{ collapsible, collapsed }">
26
+ <div class="title" :role="collapsible ? 'button' : undefined" @click="toggle">
17
27
  <h2 class="title-text">{{ text }}</h2>
28
+ <div class="action">
29
+ <VPIconMinusSquare class="icon minus" />
30
+ <VPIconPlusSquare class="icon plus" />
31
+ </div>
18
32
  </div>
19
33
 
20
- <template v-for="item in items" :key="item.link">
21
- <VPSidebarLink :item="item" />
22
- </template>
34
+ <div class="items">
35
+ <template v-for="item in items" :key="item.link">
36
+ <VPSidebarLink :item="item" />
37
+ </template>
38
+ </div>
23
39
  </section>
24
40
  </template>
25
41
 
26
42
  <style scoped>
27
43
  .title {
28
- padding: 6px 0;
29
- }
30
-
31
- @media (min-width: 960px) {
32
- .title {
33
- padding: 4px 0;
34
- }
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: flex-start;
47
+ z-index: 2;
35
48
  }
36
49
 
37
50
  .title-text {
51
+ padding-top: 6px;
52
+ padding-bottom: 6px;
38
53
  line-height: 20px;
39
- font-size: 13px;
40
- font-weight: 600;
54
+ font-size: 14px;
55
+ font-weight: 700;
41
56
  color: var(--vp-c-text-1);
42
- transition: color 0.5s;
57
+ }
58
+
59
+ .action {
60
+ display: none;
61
+ position: relative;
62
+ margin-right: -8px;
63
+ border-radius: 4px;
64
+ width: 32px;
65
+ height: 32px;
66
+ color: var(--vp-c-text-3);
67
+ transition: color 0.25s;
68
+ }
69
+
70
+ .VPSidebarGroup.collapsible .action {
71
+ display: block;
72
+ }
73
+
74
+ .title:hover .action {
75
+ color: var(--vp-c-text-2);
76
+ }
77
+
78
+ .icon {
79
+ position: absolute;
80
+ top: 8px;
81
+ left: 8px;
82
+ width: 16px;
83
+ height: 16px;
84
+ fill: currentColor;
85
+ }
86
+
87
+ .icon.minus { opacity: 1; }
88
+ .icon.plus { opacity: 0; }
89
+
90
+ .VPSidebarGroup.collapsed .icon.minus { opacity: 0; }
91
+ .VPSidebarGroup.collapsed .icon.plus { opacity: 1; }
92
+
93
+ .items {
94
+ overflow: hidden;
95
+ }
96
+
97
+ .VPSidebarGroup.collapsed .items {
98
+ margin-bottom: -22px;
99
+ max-height: 0;
100
+ }
101
+
102
+ @media (min-width: 960px) {
103
+ .VPSidebarGroup.collapsed .items {
104
+ margin-bottom: -14px;
105
+ }
43
106
  }
44
107
  </style>
@@ -31,25 +31,18 @@ const closeSideBar = inject('close-sidebar') as () => void
31
31
  }
32
32
 
33
33
  .link:hover .link-text {
34
- color: var(--vp-c-brand);
34
+ color: var(--vp-c-text-1);
35
35
  transition: color 0.25s;
36
36
  }
37
37
 
38
38
  .link.active .link-text {
39
- font-weight: 600;
40
39
  color: var(--vp-c-brand);
41
40
  transition: color 0.25s;
42
41
  }
43
42
 
44
- @media (min-width: 960px) {
45
- .link {
46
- padding: 4px 0;
47
- }
48
- }
49
-
50
43
  .link-text {
51
44
  line-height: 20px;
52
- font-size: 13px;
45
+ font-size: 14px;
53
46
  font-weight: 500;
54
47
  color: var(--vp-c-text-2);
55
48
  transition: color 0.5s;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { DefaultTheme } from 'vitepress'
2
+ import { DefaultTheme } from '../config'
3
3
  import VPIconDiscord from './icons/VPIconDiscord.vue'
4
4
  import VPIconFacebook from './icons/VPIconFacebook.vue'
5
5
  import VPIconGitHub from './icons/VPIconGitHub.vue'
@@ -9,7 +9,7 @@ import VPIconSlack from './icons/VPIconSlack.vue'
9
9
  import VPIconTwitter from './icons/VPIconTwitter.vue'
10
10
  import VPIconYouTube from './icons/VPIconYouTube.vue'
11
11
 
12
- const props = defineProps<{
12
+ defineProps<{
13
13
  icon: DefaultTheme.SocialLinkIcon
14
14
  link: string
15
15
  }>()
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { DefaultTheme } from 'vitepress'
2
+ import { DefaultTheme } from '../config'
3
3
  import VPSocialLink from './VPSocialLink.vue'
4
4
 
5
5
  defineProps<{
@@ -2,26 +2,29 @@
2
2
  import { computed } from 'vue'
3
3
  import VPSponsorsGrid from './VPSponsorsGrid.vue'
4
4
 
5
- interface Sponsors {
5
+ export interface Sponsors {
6
6
  tier?: string
7
7
  size?: 'small' | 'medium' | 'big'
8
8
  items: Sponsor[]
9
9
  }
10
10
 
11
- interface Sponsor {
11
+ export interface Sponsor {
12
12
  name: string
13
13
  img: string
14
14
  url: string
15
15
  }
16
16
 
17
17
  const props = defineProps<{
18
+ mode?: 'normal' | 'aside'
18
19
  tier?: string
19
- size?: 'small' | 'medium' | 'big'
20
- data: Sposors[] | Sponsor[]
20
+ size?: 'xmini' | 'small' | 'medium' | 'big'
21
+ data: Sponsors[] | Sponsor[]
21
22
  }>()
22
23
 
23
24
  const sponsors = computed(() => {
24
- const isSponsors = props.data.some((s: any) => s.items)
25
+ const isSponsors = props.data.some((s) => {
26
+ return !!(s as Sponsors).items
27
+ })
25
28
 
26
29
  if (isSponsors) {
27
30
  return props.data
@@ -36,42 +39,14 @@ const sponsors = computed(() => {
36
39
  </script>
37
40
 
38
41
  <template>
39
- <div class="VPSponsors">
40
- <section v-for="(sponsor, index) in sponsors" :key="index" class="section">
41
- <h3 v-if="sponsor.tier" class="tier">{{ sponsor.tier }}</h3>
42
+ <div class="VPSponsors vp-sponsor" :class="[mode ?? 'normal']">
43
+ <section
44
+ v-for="(sponsor, index) in sponsors"
45
+ :key="index"
46
+ class="vp-sponsor-section"
47
+ >
48
+ <h3 v-if="sponsor.tier" class="vp-sponsor-tier">{{ sponsor.tier }}</h3>
42
49
  <VPSponsorsGrid :size="sponsor.size" :data="sponsor.items" />
43
50
  </section>
44
51
  </div>
45
52
  </template>
46
-
47
- <style scoped>
48
- .VPSponsors {
49
- border-radius: 16px;
50
- overflow: hidden;
51
- }
52
-
53
- .section + .section {
54
- margin-top: 4px;
55
- }
56
-
57
- .tier {
58
- margin-bottom: 4px;
59
- padding: 13px 0 11px;
60
- text-align: center;
61
- letter-spacing: 1px;
62
- line-height: 24px;
63
- width: 100%;
64
- font-size: 14px;
65
- font-weight: 600;
66
- color: var(--vp-c-text-2);
67
- background-color: var(--vp-c-white-soft);
68
- }
69
-
70
- .dark .tier {
71
- background-color: var(--vp-c-black-mute);
72
- }
73
-
74
- .VPSponsorsGrid + .tier {
75
- margin-top: 4px;
76
- }
77
- </style>
@@ -2,14 +2,14 @@
2
2
  import { ref } from 'vue'
3
3
  import { useSponsorsGrid } from '../composables/sponsor-grid'
4
4
 
5
- interface Sponsor {
5
+ export interface Sponsor {
6
6
  name: string
7
7
  img: string
8
8
  url: string
9
9
  }
10
10
 
11
11
  const props = defineProps<{
12
- size?: 'small' | 'medium' | 'big'
12
+ size?: 'xmini' | 'mini' | 'small' | 'medium' | 'big'
13
13
  data: Sponsor[]
14
14
  }>()
15
15
 
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
3
+ <path d="M22,13H2a1,1,0,0,1,0-2H22a1,1,0,0,1,0,2Z" />
4
+ </svg>
5
+ </template>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
3
+ <path d="M19,2H5C3.3,2,2,3.3,2,5v14c0,1.7,1.3,3,3,3h14c1.7,0,3-1.3,3-3V5C22,3.3,20.7,2,19,2zM20,19c0,0.6-0.4,1-1,1H5c-0.6,0-1-0.4-1-1V5c0-0.6,0.4-1,1-1h14c0.6,0,1,0.4,1,1V19z" />
4
+ <path d="M16,11H8c-0.6,0-1,0.4-1,1s0.4,1,1,1h8c0.6,0,1-0.4,1-1S16.6,11,16,11z" />
5
+ </svg>
6
+ </template>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
3
+ <path d="M19,2H5C3.3,2,2,3.3,2,5v14c0,1.7,1.3,3,3,3h14c1.7,0,3-1.3,3-3V5C22,3.3,20.7,2,19,2z M20,19c0,0.6-0.4,1-1,1H5c-0.6,0-1-0.4-1-1V5c0-0.6,0.4-1,1-1h14c0.6,0,1,0.4,1,1V19z" />
4
+ <path d="M16,11h-3V8c0-0.6-0.4-1-1-1s-1,0.4-1,1v3H8c-0.6,0-1,0.4-1,1s0.4,1,1,1h3v3c0,0.6,0.4,1,1,1s1-0.4,1-1v-3h3c0.6,0,1-0.4,1-1S16.6,11,16,11z" />
5
+ </svg>
6
+ </template>
@@ -0,0 +1,17 @@
1
+ import { computed } from 'vue';
2
+ import { useMediaQuery } from '@vueuse/core';
3
+ import { useSidebar } from './sidebar';
4
+ export function useAside() {
5
+ const { hasSidebar } = useSidebar();
6
+ const is960 = useMediaQuery('(min-width: 960px)');
7
+ const is1280 = useMediaQuery('(min-width: 1280px)');
8
+ const isAsideEnabled = computed(() => {
9
+ if (!is1280.value && !is960.value) {
10
+ return false;
11
+ }
12
+ return hasSidebar.value ? is1280.value : is960.value;
13
+ });
14
+ return {
15
+ isAsideEnabled
16
+ };
17
+ }