@vuepress/theme-default 2.0.0-rc.54 → 2.0.0-rc.56

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.
@@ -17,7 +17,7 @@ import { Content } from 'vuepress/client'
17
17
  </template>
18
18
 
19
19
  <style lang="scss">
20
- @import '../styles//variables';
20
+ @use '../styles/variables' as *;
21
21
 
22
22
  .vp-home {
23
23
  display: block;
@@ -19,7 +19,7 @@ const features = computed(() => frontmatter.value.features ?? [])
19
19
  </template>
20
20
 
21
21
  <style lang="scss">
22
- @import '../styles/variables';
22
+ @use '../styles/variables' as *;
23
23
 
24
24
  .vp-features {
25
25
  display: flex;
@@ -100,7 +100,7 @@ const HomeHeroImage: FunctionalComponent = () => {
100
100
  </template>
101
101
 
102
102
  <style lang="scss">
103
- @import '../styles//variables';
103
+ @use '../styles/variables' as *;
104
104
 
105
105
  .vp-hero {
106
106
  text-align: center;
@@ -86,7 +86,7 @@ useUpdateDeviceStatus(
86
86
  </template>
87
87
 
88
88
  <style lang="scss">
89
- @import '../styles/variables';
89
+ @use '../styles/variables' as *;
90
90
 
91
91
  .vp-navbar {
92
92
  --navbar-line-height: calc(
@@ -66,7 +66,7 @@ const NavbarBrandLogo: FunctionalComponent = () => {
66
66
  </template>
67
67
 
68
68
  <style lang="scss">
69
- @import '../styles/variables';
69
+ @use '../styles/variables' as *;
70
70
 
71
71
  .vp-site-logo {
72
72
  vertical-align: top;
@@ -1,21 +1,22 @@
1
1
  <script setup lang="ts">
2
2
  import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
3
- import { computed, ref, toRefs, watch } from 'vue'
3
+ import { useToggle } from '@vueuse/core'
4
+ import { computed, toRefs, watch } from 'vue'
4
5
  import { AutoLink, useRoute } from 'vuepress/client'
5
6
  import type { AutoLinkOptions, NavGroup } from '../../shared/index.js'
6
7
 
7
8
  const props = defineProps<{
8
- /** dropdown items */
9
- item: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
9
+ /** dropdown config */
10
+ config: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
10
11
  }>()
11
12
 
12
- const { item } = toRefs(props)
13
+ const { config } = toRefs(props)
13
14
  const route = useRoute()
14
15
 
15
- const open = ref(false)
16
+ const [open, toggleOpen] = useToggle(false)
16
17
 
17
18
  const dropdownAriaLabel = computed(
18
- () => item.value.ariaLabel || item.value.text,
19
+ () => config.value.ariaLabel || config.value.text,
19
20
  )
20
21
 
21
22
  const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
@@ -30,15 +31,14 @@ const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
30
31
  * @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
31
32
  */
32
33
  const handleDropdown = (e: UIEvent): void => {
33
- const isTriggerByTab = e.detail === 0
34
-
35
- open.value = isTriggerByTab ? !open.value : false
34
+ if (e.detail === 0) toggleOpen()
35
+ else toggleOpen(false)
36
36
  }
37
37
 
38
38
  watch(
39
39
  () => route.path,
40
40
  () => {
41
- open.value = false
41
+ toggleOpen(false)
42
42
  },
43
43
  )
44
44
  </script>
@@ -51,7 +51,7 @@ watch(
51
51
  :aria-label="dropdownAriaLabel"
52
52
  @click="handleDropdown"
53
53
  >
54
- <span class="title">{{ item.text }}</span>
54
+ <span class="title">{{ config.text }}</span>
55
55
  <span class="arrow down" />
56
56
  </button>
57
57
 
@@ -59,16 +59,16 @@ watch(
59
59
  class="vp-navbar-dropdown-title-mobile"
60
60
  type="button"
61
61
  :aria-label="dropdownAriaLabel"
62
- @click="open = !open"
62
+ @click="() => toggleOpen()"
63
63
  >
64
- <span class="title">{{ item.text }}</span>
64
+ <span class="title">{{ config.text }}</span>
65
65
  <span class="arrow" :class="open ? 'down' : 'right'" />
66
66
  </button>
67
67
 
68
68
  <VPDropdownTransition>
69
69
  <ul v-show="open" class="vp-navbar-dropdown">
70
70
  <li
71
- v-for="child in item.children"
71
+ v-for="child in config.children"
72
72
  :key="child.text"
73
73
  class="vp-navbar-dropdown-item"
74
74
  >
@@ -78,9 +78,14 @@ watch(
78
78
  v-if="child.link"
79
79
  :config="child"
80
80
  @focusout="
81
- isLastItemOfArray(child, item.children) &&
82
- child.children.length === 0 &&
83
- (open = false)
81
+ () => {
82
+ if (
83
+ isLastItemOfArray(child, config.children) &&
84
+ child.children.length === 0
85
+ ) {
86
+ open = false
87
+ }
88
+ }
84
89
  "
85
90
  />
86
91
 
@@ -96,9 +101,14 @@ watch(
96
101
  <AutoLink
97
102
  :config="grandchild"
98
103
  @focusout="
99
- isLastItemOfArray(grandchild, child.children) &&
100
- isLastItemOfArray(child, item.children) &&
101
- (open = false)
104
+ () => {
105
+ if (
106
+ isLastItemOfArray(grandchild, child.children) &&
107
+ isLastItemOfArray(child, config.children)
108
+ ) {
109
+ toggleOpen(false)
110
+ }
111
+ }
102
112
  "
103
113
  />
104
114
  </li>
@@ -109,7 +119,11 @@ watch(
109
119
  <AutoLink
110
120
  :config="child"
111
121
  @focusout="
112
- isLastItemOfArray(child, item.children) && (open = false)
122
+ () => {
123
+ if (isLastItemOfArray(child, config.children)) {
124
+ toggleOpen(false)
125
+ }
126
+ }
113
127
  "
114
128
  />
115
129
  </template>
@@ -121,7 +135,7 @@ watch(
121
135
 
122
136
  <style lang="scss">
123
137
  @use '../styles/mixins';
124
- @import '../styles/variables';
138
+ @use '../styles/variables' as *;
125
139
 
126
140
  .vp-navbar-dropdown-wrapper {
127
141
  cursor: pointer;
@@ -45,7 +45,7 @@ useUpdateDeviceStatus(
45
45
  <VPNavbarDropdown
46
46
  v-if="'children' in item"
47
47
  :class="{ mobile: isMobile }"
48
- :item="item"
48
+ :config="item"
49
49
  />
50
50
  <AutoLink v-else :config="item" />
51
51
  </div>
@@ -53,7 +53,7 @@ useUpdateDeviceStatus(
53
53
  </template>
54
54
 
55
55
  <style lang="scss">
56
- @import '../styles/variables';
56
+ @use '../styles/variables' as *;
57
57
 
58
58
  .vp-navbar-items {
59
59
  display: inline-block;
@@ -37,7 +37,7 @@ setupHeaders()
37
37
 
38
38
  <style lang="scss">
39
39
  @use '../styles/mixins';
40
- @import '../styles/variables';
40
+ @use '../styles/variables' as *;
41
41
 
42
42
  .vp-page {
43
43
  display: block;
@@ -64,7 +64,9 @@ setupHeaders()
64
64
  .theme-default-content {
65
65
  @include mixins.content-wrapper;
66
66
 
67
- padding-top: 0;
67
+ & {
68
+ padding-top: 0;
69
+ }
68
70
  }
69
71
  }
70
72
  </style>
@@ -52,19 +52,21 @@ const contributors = useContributors()
52
52
 
53
53
  <style lang="scss">
54
54
  @use '../styles/mixins';
55
- @import '../styles/variables';
55
+ @use '../styles/variables' as *;
56
56
 
57
57
  .vp-page-meta {
58
58
  @include mixins.content-wrapper;
59
59
 
60
- display: flex;
61
- flex-wrap: wrap;
62
- justify-content: space-between;
60
+ & {
61
+ display: flex;
62
+ flex-wrap: wrap;
63
+ justify-content: space-between;
63
64
 
64
- overflow: auto;
65
+ overflow: auto;
65
66
 
66
- padding-top: 0.75rem;
67
- padding-bottom: 0.75rem;
67
+ padding-top: 0.75rem;
68
+ padding-bottom: 0.75rem;
69
+ }
68
70
 
69
71
  @media print {
70
72
  margin: 0 !important;
@@ -62,7 +62,7 @@ useEventListener('keydown', (event): void => {
62
62
  </template>
63
63
 
64
64
  <style lang="scss">
65
- @import '../styles/variables';
65
+ @use '../styles/variables' as *;
66
66
 
67
67
  .vp-page-nav {
68
68
  display: flex;
@@ -19,7 +19,7 @@ defineSlots<{
19
19
  </template>
20
20
 
21
21
  <style lang="scss">
22
- @import '../styles/variables';
22
+ @use '../styles/variables' as *;
23
23
 
24
24
  .vp-sidebar {
25
25
  position: fixed;
@@ -92,7 +92,7 @@ onBeforeUnmount(() => {
92
92
 
93
93
  <style lang="scss">
94
94
  @use '../styles/mixins';
95
- @import '../styles/variables';
95
+ @use '../styles/variables' as *;
96
96
 
97
97
  .vp-sidebar-item {
98
98
  border-left: 0.25rem solid transparent;
@@ -58,7 +58,7 @@ onMounted(() => {
58
58
  </template>
59
59
 
60
60
  <style lang="scss">
61
- @import '../styles/variables';
61
+ @use '../styles/variables' as *;
62
62
 
63
63
  .vp-sidebar-items {
64
64
  margin: 0;
@@ -25,7 +25,7 @@ const themeLocale = useThemeLocaleData()
25
25
 
26
26
  <style lang="scss">
27
27
  /* stylelint-disable max-nesting-depth */
28
- @import '../styles/variables';
28
+ @use '../styles/variables' as *;
29
29
 
30
30
  .vp-toggle-sidebar-button {
31
31
  position: absolute;
@@ -159,7 +159,7 @@ const onBeforeLeave = scrollPromise.pending
159
159
  </template>
160
160
 
161
161
  <style lang="scss">
162
- @import '../styles/variables';
162
+ @use '../styles/variables' as *;
163
163
 
164
164
  .vp-sidebar-mask {
165
165
  position: fixed;
@@ -1,4 +1,4 @@
1
- @import 'variables';
1
+ @use 'variables' as *;
2
2
 
3
3
  @mixin content-wrapper {
4
4
  max-width: var(--content-width);
@@ -1,4 +1,4 @@
1
- @import 'variables';
1
+ @use 'variables' as *;
2
2
 
3
3
  :export {
4
4
  mobile: $MQMobile;
@@ -1,5 +1,5 @@
1
1
  /* stylelint-disable scss/dollar-variable-pattern */
2
- @import '@vuepress/plugin-palette/palette';
2
+ @forward '@vuepress/plugin-palette/palette';
3
3
 
4
4
  // responsive breakpoints
5
5
  $MQNarrow: 959px !default;
@@ -1,4 +1,4 @@
1
- @import 'variables';
1
+ @use 'variables' as *;
2
2
 
3
3
  /**
4
4
  * code-group
@@ -1,4 +1,4 @@
1
- @import '../variables';
1
+ @use '../variables' as *;
2
2
 
3
3
  // code block additional styles
4
4
  div[class*='language-'] {
@@ -1,4 +1,4 @@
1
- @import '../variables';
1
+ @use '../variables' as *;
2
2
 
3
3
  .theme-default-content {
4
4
  h1,
@@ -12,7 +12,6 @@
12
12
 
13
13
  background: var(--external-link-c-icon);
14
14
 
15
- -webkit-mask-image: var(--external-link-icon);
16
15
  mask-image: var(--external-link-icon);
17
16
  }
18
17
  }
@@ -1,4 +1,4 @@
1
- @import 'variables';
1
+ @use 'variables' as *;
2
2
 
3
3
  .vp-hide-mobile {
4
4
  @media screen and (max-width: $MQMobile) {
@@ -1,5 +1,5 @@
1
1
  @use 'mixins';
2
- @import 'variables';
2
+ @use 'variables' as *;
3
3
 
4
4
  // plugin-comment
5
5
  .vp-comment {
@@ -1,4 +1,4 @@
1
- import { addViteConfig, addViteOptimizeDepsExclude, chainWebpack, } from '@vuepress/helper';
1
+ import { addViteOptimizeDepsExclude } from '@vuepress/helper';
2
2
  import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links';
3
3
  import { backToTopPlugin } from '@vuepress/plugin-back-to-top';
4
4
  import { copyCodePlugin } from '@vuepress/plugin-copy-code';
@@ -42,32 +42,6 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
42
42
  },
43
43
  clientConfigFile: path.resolve(__dirname, '../client/config.js'),
44
44
  extendsBundlerOptions: (bundlerOptions, app) => {
45
- // FIXME: hide sass deprecation warning for mixed-decls
46
- addViteConfig(bundlerOptions, app, {
47
- css: {
48
- preprocessorOptions: {
49
- sass: {
50
- silenceDeprecations: ['mixed-decls'],
51
- },
52
- scss: {
53
- silenceDeprecations: ['mixed-decls'],
54
- },
55
- },
56
- },
57
- });
58
- chainWebpack(bundlerOptions, app, (config) => {
59
- config.module
60
- .rule('scss')
61
- .use('sass-loader')
62
- .tap((options) => ({
63
- ...options,
64
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
65
- sassOptions: {
66
- silenceDeprecations: ['mixed-decls'],
67
- ...options.sassOptions,
68
- },
69
- }));
70
- });
71
45
  // ensure theme alias is not optimized by Vite
72
46
  addViteOptimizeDepsExclude(bundlerOptions, app, '@theme');
73
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-rc.54",
3
+ "version": "2.0.0-rc.56",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -37,28 +37,28 @@
37
37
  "templates"
38
38
  ],
39
39
  "dependencies": {
40
- "@vuepress/helper": "2.0.0-rc.54",
41
- "@vuepress/plugin-active-header-links": "2.0.0-rc.54",
42
- "@vuepress/plugin-back-to-top": "2.0.0-rc.54",
43
- "@vuepress/plugin-copy-code": "2.0.0-rc.54",
44
- "@vuepress/plugin-git": "2.0.0-rc.54",
45
- "@vuepress/plugin-links-check": "2.0.0-rc.54",
46
- "@vuepress/plugin-markdown-hint": "2.0.0-rc.54",
47
- "@vuepress/plugin-markdown-tab": "2.0.0-rc.54",
48
- "@vuepress/plugin-medium-zoom": "2.0.0-rc.54",
49
- "@vuepress/plugin-nprogress": "2.0.0-rc.54",
50
- "@vuepress/plugin-palette": "2.0.0-rc.54",
51
- "@vuepress/plugin-prismjs": "2.0.0-rc.54",
52
- "@vuepress/plugin-seo": "2.0.0-rc.54",
53
- "@vuepress/plugin-sitemap": "2.0.0-rc.54",
54
- "@vuepress/plugin-theme-data": "2.0.0-rc.54",
40
+ "@vuepress/helper": "2.0.0-rc.56",
41
+ "@vuepress/plugin-active-header-links": "2.0.0-rc.55",
42
+ "@vuepress/plugin-back-to-top": "2.0.0-rc.56",
43
+ "@vuepress/plugin-copy-code": "2.0.0-rc.56",
44
+ "@vuepress/plugin-git": "2.0.0-rc.56",
45
+ "@vuepress/plugin-links-check": "2.0.0-rc.56",
46
+ "@vuepress/plugin-markdown-hint": "2.0.0-rc.56",
47
+ "@vuepress/plugin-markdown-tab": "2.0.0-rc.56",
48
+ "@vuepress/plugin-medium-zoom": "2.0.0-rc.56",
49
+ "@vuepress/plugin-nprogress": "2.0.0-rc.56",
50
+ "@vuepress/plugin-palette": "2.0.0-rc.56",
51
+ "@vuepress/plugin-prismjs": "2.0.0-rc.56",
52
+ "@vuepress/plugin-seo": "2.0.0-rc.56",
53
+ "@vuepress/plugin-sitemap": "2.0.0-rc.56",
54
+ "@vuepress/plugin-theme-data": "2.0.0-rc.56",
55
55
  "@vueuse/core": "^11.1.0",
56
- "vue": "^3.5.11"
56
+ "vue": "^3.5.12"
57
57
  },
58
58
  "peerDependencies": {
59
- "sass": "^1.79.2",
60
- "sass-embedded": "^1.79.2",
61
- "sass-loader": "^16.0.1",
59
+ "sass": "^1.80.3",
60
+ "sass-embedded": "^1.80.3",
61
+ "sass-loader": "^16.0.2",
62
62
  "vuepress": "2.0.0-rc.18"
63
63
  },
64
64
  "peerDependenciesMeta": {
@@ -75,5 +75,5 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "28c810aa6eeaebaf7986b5f27ae6a55a5aad5e83"
78
+ "gitHead": "cef5022f451740faf54d59abdd382a37bb4dddb0"
79
79
  }