vitepress 2.0.0-alpha.10 → 2.0.0-alpha.12

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.
@@ -4,15 +4,7 @@ import { computed, inject, readonly, ref, shallowRef, watch } from 'vue';
4
4
  import { APPEARANCE_KEY, createTitle, inBrowser, resolveSiteDataByRoute } from '../shared';
5
5
  export const dataSymbol = Symbol();
6
6
  // site data is a singleton
7
- export const siteDataRef = shallowRef((import.meta.env.PROD ? siteData : readonly(siteData)));
8
- // hmr
9
- if (import.meta.hot) {
10
- import.meta.hot.accept('@siteData', (m) => {
11
- if (m) {
12
- siteDataRef.value = m.default;
13
- }
14
- });
15
- }
7
+ export const siteDataRef = shallowRef(readonly(siteData));
16
8
  // per-app data
17
9
  export function initData(route) {
18
10
  const site = computed(() => resolveSiteDataByRoute(siteDataRef.value, route.data.relativePath));
@@ -78,7 +78,7 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
78
78
  }
79
79
  })
80
80
 
81
- docsearch(options)
81
+ docsearch(options as any)
82
82
  }
83
83
 
84
84
  function getRelativePath(url: string) {
@@ -32,7 +32,7 @@ const classes = computed(() => {
32
32
  VPLocalNav: true,
33
33
  'has-sidebar': hasSidebar.value,
34
34
  empty: !hasLocalNav.value,
35
- fixed: !hasLocalNav.value && !hasSidebar.value,
35
+ fixed: !hasLocalNav.value && !hasSidebar.value
36
36
  }
37
37
  })
38
38
  </script>
@@ -113,7 +113,6 @@ const classes = computed(() => {
113
113
  .menu {
114
114
  display: flex;
115
115
  align-items: center;
116
- padding: 12px 24px 11px;
117
116
  line-height: 24px;
118
117
  font-size: 12px;
119
118
  font-weight: 500;
@@ -126,12 +125,6 @@ const classes = computed(() => {
126
125
  transition: color 0.25s;
127
126
  }
128
127
 
129
- @media (min-width: 768px) {
130
- .menu {
131
- padding: 0 32px;
132
- }
133
- }
134
-
135
128
  @media (min-width: 960px) {
136
129
  .menu {
137
130
  display: none;
@@ -143,12 +136,14 @@ const classes = computed(() => {
143
136
  font-size: 14px;
144
137
  }
145
138
 
146
- .VPOutlineDropdown {
139
+ .menu,
140
+ :deep(.VPLocalNavOutlineDropdown > button) {
147
141
  padding: 12px 24px 11px;
148
142
  }
149
143
 
150
144
  @media (min-width: 768px) {
151
- .VPOutlineDropdown {
145
+ .menu,
146
+ :deep(.VPLocalNavOutlineDropdown > button) {
152
147
  padding: 12px 32px 11px;
153
148
  }
154
149
  }
@@ -92,16 +92,6 @@ function scrollToTop() {
92
92
  </template>
93
93
 
94
94
  <style scoped>
95
- .VPLocalNavOutlineDropdown {
96
- padding: 12px 20px 11px;
97
- }
98
-
99
- @media (min-width: 960px) {
100
- .VPLocalNavOutlineDropdown {
101
- padding: 12px 36px 11px;
102
- }
103
- }
104
-
105
95
  .VPLocalNavOutlineDropdown button {
106
96
  display: block;
107
97
  font-size: 12px;
@@ -170,16 +170,22 @@ watchPostEffect(() => {
170
170
  .VPNavBar.has-sidebar .content {
171
171
  position: relative;
172
172
  z-index: 1;
173
- padding-right: 32px;
174
173
  padding-left: var(--vp-sidebar-width);
175
174
  }
175
+
176
+ .VPNavBar.has-sidebar .content-body {
177
+ padding-right: 32px;
178
+ }
176
179
  }
177
180
 
178
181
  @media (min-width: 1440px) {
179
182
  .VPNavBar.has-sidebar .content {
180
- padding-right: calc((100vw - var(--vp-layout-max-width)) / 2 + 32px);
181
183
  padding-left: calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width));
182
184
  }
185
+
186
+ .VPNavBar.has-sidebar .content-body {
187
+ padding-right: calc((100vw - var(--vp-layout-max-width)) / 2 + 32px);
188
+ }
183
189
  }
184
190
 
185
191
  .content-body {
@@ -111,8 +111,8 @@ watch(
111
111
 
112
112
  @media (min-width: 1440px) {
113
113
  .VPSidebar {
114
- padding-left: max(32px, calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));
115
- width: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
114
+ padding-left: max(32px, calc((100vw - (var(--vp-layout-max-width) - 64px)) / 2));
115
+ width: calc((100vw - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
116
116
  }
117
117
  }
118
118
 
@@ -88,6 +88,6 @@
88
88
  :root {
89
89
  /* clipboard */
90
90
  --vp-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3C/g%3E%3C/svg%3E");
91
- /* clipboard-copy */
92
- --vp-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M16 4h2a2 2 0 0 1 2 2v4m1 4H11'/%3E%3Cpath d='m15 10l-4 4l4 4'/%3E%3C/g%3E%3C/svg%3E");
91
+ /* clipboard-check */
92
+ --vp-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Cpath d='m9 14l2 2l4-4'/%3E%3C/g%3E%3C/svg%3E");
93
93
  }