valaxy-theme-press 0.22.3 → 0.22.5-beta.4

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.
@@ -0,0 +1,50 @@
1
+ <script lang="ts" setup>
2
+ import type { NavItemLink } from '../types'
3
+ import { useI18n } from 'vue-i18n'
4
+
5
+ defineProps<{
6
+ item: NavItemLink
7
+ }>()
8
+
9
+ const { t } = useI18n()
10
+ </script>
11
+
12
+ <template>
13
+ <div class="menu-link">
14
+ <AppLink
15
+ v-if="'link' in item"
16
+ class="menu-item"
17
+ p="x-3"
18
+ :to="item.link"
19
+ >
20
+ {{ item.text.includes(".") ? t(item.text) : item.text }}
21
+ </AppLink>
22
+ </div>
23
+ </template>
24
+
25
+ <style lang="scss" scoped>
26
+ .menu-link{
27
+ .menu-item {
28
+ display: flex;
29
+ width: 100%;
30
+ border-radius: 6px;
31
+ color: var(--pr-nav-text);
32
+ line-height: 32px;
33
+ font-size: 14px;
34
+ font-weight: 500;
35
+ white-space: nowrap;
36
+ transition:
37
+ background-color 0.25s,
38
+ color 0.25s;
39
+
40
+ &:hover {
41
+ background-color: #f1f1f1;
42
+ color: var(--va-c-brand);
43
+
44
+ .dark & {
45
+ background-color: #2f2f2f;
46
+ }
47
+ }
48
+ }
49
+ }
50
+ </style>
@@ -1,10 +1,12 @@
1
1
  <script lang="ts" setup>
2
- import type { NavItemGroup } from '../types'
2
+ import type { NavItemWithChildren } from '../types'
3
3
  import { ref } from 'vue'
4
4
  import { useI18n } from 'vue-i18n'
5
+ import PressMenuLink from './PressMenuLink.vue'
6
+ import PressNavItemGroupChild from './PressNavItemGroupChild.vue'
5
7
 
6
8
  defineProps<{
7
- item: NavItemGroup
9
+ item: NavItemWithChildren
8
10
  }>()
9
11
 
10
12
  const open = ref(false)
@@ -27,33 +29,38 @@ const { t } = useI18n()
27
29
  h="full"
28
30
  @click="open = !open"
29
31
  >
30
- <span class="text">
31
- {{ item.text.includes('.') ? t(item.text) : item.text }}
32
+ <span v-if="item.text" class="text">
33
+ {{ item.text.includes(".") ? t(item.text) : item.text }}
32
34
  </span>
33
35
  <div i-ri-arrow-drop-down-line />
34
36
  </button>
35
37
 
36
38
  <div class="menu grow" flex="~ col" items="start">
37
- <AppLink v-for="itemLink in item.items" :key="itemLink.text" class="menu-item" p="x-3" :to="itemLink.link">
38
- {{ itemLink.text.includes('.') ? t(itemLink.text) : itemLink.text }}
39
- </AppLink>
39
+ <template v-for="itemLink in item.items" :key="JSON.stringify(itemLink)">
40
+ <PressMenuLink v-if="'link' in itemLink" :item="itemLink" />
41
+ <PressNavItemGroupChild
42
+ v-else
43
+ :text="itemLink.text"
44
+ :items="itemLink.items"
45
+ />
46
+ </template>
40
47
  </div>
41
48
  </div>
42
49
  </template>
43
50
 
44
51
  <style lang="scss" scoped>
45
- .group .button{
52
+ .group .button {
46
53
  color: var(--pr-nav-text);
47
54
  font-weight: 500;
48
55
  font-size: 14px;
49
56
  }
50
57
 
51
- .group[aria-expanded="true"] .button{
52
- color: rgba(60, 60, 60, 0.70);
58
+ .group[aria-expanded="true"] .button {
59
+ color: rgb(60 60 60 / 0.70);
53
60
  transition: color 0.25s;
54
61
 
55
- .dark &{
56
- color: rgba(235, 235, 235, 0.6)
62
+ .dark & {
63
+ color: rgb(235 235 235 / 0.6)
57
64
  }
58
65
  }
59
66
 
@@ -64,39 +71,21 @@ const { t } = useI18n()
64
71
  min-width: 128px;
65
72
  opacity: 0;
66
73
  visibility: hidden;
67
- transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
74
+ transition:
75
+ opacity 0.25s,
76
+ visibility 0.25s,
77
+ transform 0.25s;
68
78
  transform: translateX(-50%) translateY(calc(var(--pr-nav-height) / 2));
69
79
  border-radius: 12px;
70
80
  padding: 12px;
71
- border: 1px solid rgba(60, 60, 60, 0.12);
81
+ border: 1px solid rgb(60 60 60 / 0.12);
72
82
  background-color: #fff;
73
- box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.08);
83
+ box-shadow: 0 12px 32px rgb(0 0 0 / 0.1), 0 2px 6px rgb(0 0 0 / 0.08);
74
84
 
75
- .dark &{
85
+ .dark & {
76
86
  background-color: #242424;
77
87
  }
78
88
 
79
- &-item{
80
- display: flex;
81
- width: 100%;
82
- border-radius: 6px;
83
- color: var(--pr-nav-text);
84
- line-height: 32px;
85
- font-size: 14px;
86
- font-weight: 500;
87
- white-space: nowrap;
88
- transition: background-color .25s,color .25s;
89
-
90
- &:hover{
91
- background-color: #f1f1f1;
92
- color: var(--va-c-brand);
93
-
94
- .dark &{
95
- background-color: #2f2f2f;
96
- }
97
- }
98
-
99
- }
100
89
  }
101
90
 
102
91
  .group[aria-expanded="true"] > .menu {
@@ -0,0 +1,45 @@
1
+ <script lang="ts" setup>
2
+ import type { NavItemLink } from '../types'
3
+ import PressMenuLink from './PressMenuLink.vue'
4
+
5
+ defineProps<{
6
+ text?: string
7
+ items: NavItemLink[]
8
+ }>()
9
+ </script>
10
+
11
+ <template>
12
+ <div class="menu-group-item">
13
+ <p v-if="text" class="title">
14
+ {{ text }}
15
+ </p>
16
+ <template v-for="item in items" :key="item.link">
17
+ <PressMenuLink v-if="'link' in item" :item="item" />
18
+ </template>
19
+ </div>
20
+ </template>
21
+
22
+ <style lang="scss" scoped>
23
+ .menu-group-item {
24
+ display: block;
25
+ margin: 12px -12px 0;
26
+ border-top: 1px solid rgb(60 60 60 / 0.12);
27
+ padding: 12px 12px 0;
28
+
29
+ .title {
30
+ padding: 0 12px;
31
+ line-height: 28px;
32
+ font-size: 14px;
33
+ font-weight: 600;
34
+ color: rgb(60 60 60 / 0.33);
35
+ white-space: nowrap;
36
+ transition: color 0.25s;
37
+ }
38
+
39
+ &:first-child {
40
+ margin-top: 0;
41
+ border-top: 0;
42
+ padding-top: 0;
43
+ }
44
+ }
45
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-press",
3
- "version": "0.22.3",
3
+ "version": "0.22.5-beta.4",
4
4
  "description": "Docs Theme for Valaxy",
5
5
  "author": {
6
6
  "email": "me@yunyoujun.cn",
@@ -26,6 +26,6 @@
26
26
  "@docsearch/js": "^3.8.2"
27
27
  },
28
28
  "devDependencies": {
29
- "valaxy": "0.22.3"
29
+ "valaxy": "0.22.5-beta.4"
30
30
  }
31
31
  }
package/types/index.d.ts CHANGED
@@ -103,12 +103,18 @@ export interface NavItemLink {
103
103
  active?: string
104
104
  }
105
105
 
106
- export interface NavItemGroup {
107
- text: string
106
+ export interface NavItemChildren {
107
+ text?: string
108
108
  items: NavItemLink[]
109
109
  }
110
110
 
111
- export type NavItem = NavItemLink | NavItemGroup
111
+ export interface NavItemWithChildren {
112
+ text?: string
113
+ items?: (NavItemChildren | NavItemLink)[]
114
+ active?: string
115
+ }
116
+
117
+ export type NavItem = NavItemLink | NavItemWithChildren
112
118
 
113
119
  /**
114
120
  * Theme Config