valaxy-theme-press 1.5.1 → 1.6.1

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.
@@ -1,13 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { formatDate, useFrontmatter, useSiteStore, useValaxyI18n } from 'valaxy'
3
3
  import { computed } from 'vue'
4
-
4
+ import { useI18n } from 'vue-i18n'
5
5
  import { useRoute } from 'vue-router'
6
6
 
7
7
  const frontmatter = useFrontmatter()
8
8
 
9
9
  const route = useRoute()
10
10
  const site = useSiteStore()
11
+ const { t } = useI18n()
11
12
 
12
13
  function findCurrentIndex() {
13
14
  return site.postList.findIndex(p => p.path === route.path)
@@ -25,8 +26,8 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
25
26
  </script>
26
27
 
27
28
  <template>
28
- <article class="xl:divide-y xl:divide-gray-200 max-w-7xl m-auto" p="x-6" w="full">
29
- <header class="pt-20 xl:pb-10 text-center">
29
+ <article class="press-article max-w-7xl m-auto" p="x-6" w="full">
30
+ <header class="press-article-header pt-20 xl:pb-10 text-center">
30
31
  <h1
31
32
  class="
32
33
  text-3xl
@@ -40,7 +41,7 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
40
41
  >
41
42
  {{ $title }}
42
43
  </h1>
43
- <div class="flex items-center justify-center gap-4 text-sm text-gray-500">
44
+ <div class="press-article-meta flex items-center justify-center gap-4 text-sm">
44
45
  <span v-if="createdDate" class="inline-flex items-center gap-1">
45
46
  <span class="i-ri-calendar-line" />
46
47
  <time :datetime="createdDate">{{ createdDate }}</time>
@@ -53,7 +54,7 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
53
54
  <div v-if="frontmatter.tags?.length || frontmatter.categories" class="mt-3 flex items-center justify-center gap-2 flex-wrap text-xs">
54
55
  <RouterLink
55
56
  v-for="tag in (Array.isArray(frontmatter.tags) ? frontmatter.tags : [])" :key="tag"
56
- class="px-2 py-0.5 rounded-full bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400 no-underline hover:bg-primary/10 hover:text-primary transition-colors"
57
+ class="press-article-tag px-2 py-0.5 rounded-full no-underline"
57
58
  :to="{ path: '/tags/', query: { tag } }"
58
59
  >
59
60
  #{{ tag }}
@@ -63,9 +64,7 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
63
64
 
64
65
  <div
65
66
  class="
66
- divide-y
67
- xl:divide-y-0
68
- divide-gray-200
67
+ press-article-body
69
68
  xl:grid xl:grid-cols-12 xl:gap-x-6
70
69
  pb-16
71
70
  xl:pb-20
@@ -73,22 +72,22 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
73
72
  style="grid-template-rows: auto 1fr"
74
73
  >
75
74
  <PressAuthor v-if="frontmatter.author" :frontmatter="frontmatter" />
76
- <div class="divide-y divide-gray-200 xl:pb-0 xl:col-span-8 xl:row-span-2">
75
+ <div class="press-article-content xl:pb-0 xl:col-span-8 xl:row-span-2">
77
76
  <RouterView />
78
77
  </div>
79
78
 
80
79
  <footer
81
80
  class="
81
+ press-article-footer
82
82
  text-sm
83
83
  font-medium
84
84
  leading-5
85
- divide-y divide-gray-200
86
85
  xl:col-start-1 xl:row-start-2 xl:col-span-2
87
86
  "
88
87
  >
89
- <div v-if="nextPost && nextPost.path" class="py-8">
90
- <h2 class="text-xs tracking-wide uppercase text-gray-500">
91
- Next Article
88
+ <div v-if="nextPost && nextPost.path" class="press-article-section py-8">
89
+ <h2 class="press-article-heading">
90
+ {{ t('article.next') }}
92
91
  </h2>
93
92
  <div class="link">
94
93
  <RouterLink :to="nextPost.path">
@@ -96,9 +95,9 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
96
95
  </RouterLink>
97
96
  </div>
98
97
  </div>
99
- <div v-if="prevPost && prevPost.path" class="py-8">
100
- <h2 class="text-xs tracking-wide uppercase text-gray-500">
101
- Previous Article
98
+ <div v-if="prevPost && prevPost.path" class="press-article-section py-8">
99
+ <h2 class="press-article-heading">
100
+ {{ t('article.prev') }}
102
101
  </h2>
103
102
  <div class="link">
104
103
  <RouterLink :to="prevPost.path">
@@ -107,14 +106,15 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
107
106
  </div>
108
107
  </div>
109
108
 
110
- <div v-if="posts.length" class="py-8">
111
- <h2 class="text-xs tracking-wide uppercase text-gray-500 mb-4">
112
- All Posts
109
+ <div v-if="posts.length" class="press-article-section py-8">
110
+ <h2 class="press-article-heading mb-4">
111
+ {{ t('article.all_posts') }}
113
112
  </h2>
114
113
  <ul class="space-y-2">
115
114
  <li v-for="post in posts" :key="post.path">
116
115
  <RouterLink
117
- class="link block truncate" :class="post.path === route.path ? 'font-bold text-primary' : 'op-50 hover:op-80'"
116
+ class="press-article-post-link block truncate"
117
+ :class="{ 'is-active': post.path === route.path }"
118
118
  :to="post.path || ''"
119
119
  :title="$tO(post.title)"
120
120
  >
@@ -124,12 +124,78 @@ const updatedDate = computed(() => frontmatter.value.updated ? formatDate(frontm
124
124
  </ul>
125
125
  </div>
126
126
 
127
- <div class="pt-8">
127
+ <div class="press-article-section pt-8">
128
128
  <RouterLink class="link" to="/posts/">
129
- ← Back to Posts
129
+ ← {{ t('article.back_to_posts') }}
130
130
  </RouterLink>
131
131
  </div>
132
132
  </footer>
133
133
  </div>
134
134
  </article>
135
135
  </template>
136
+
137
+ <style scoped>
138
+ .press-article-meta,
139
+ .press-article-heading {
140
+ color: var(--pr-c-text-2);
141
+ }
142
+
143
+ .press-article-heading {
144
+ font-size: 13px;
145
+ font-weight: 600;
146
+ line-height: 1.4;
147
+ }
148
+
149
+ .press-article-tag {
150
+ color: var(--pr-c-text-2);
151
+ background-color: var(--pr-c-surface);
152
+ border: 1px solid var(--pr-c-divider-light);
153
+ transition: color var(--va-transition-duration-fast), border-color var(--va-transition-duration-fast), background-color var(--va-transition-duration-fast);
154
+ }
155
+
156
+ .press-article-tag:hover {
157
+ color: var(--pr-c-brand);
158
+ border-color: var(--pr-c-brand);
159
+ background-color: var(--pr-c-brand-soft);
160
+ }
161
+
162
+ .press-article-body {
163
+ border-top: 1px solid var(--pr-c-divider-light);
164
+ }
165
+
166
+ .press-article-section + .press-article-section {
167
+ border-top: 1px solid var(--pr-c-divider-light);
168
+ }
169
+
170
+ .press-article-post-link {
171
+ color: var(--pr-c-text-2);
172
+ transition: color var(--va-transition-duration-fast);
173
+ }
174
+
175
+ .press-article-post-link:hover {
176
+ color: var(--pr-c-text-1);
177
+ }
178
+
179
+ .press-article-post-link.is-active {
180
+ color: var(--pr-c-brand);
181
+ font-weight: 700;
182
+ }
183
+
184
+ @media (width < 1280px) {
185
+ .press-article-body {
186
+ border-top: 0;
187
+ }
188
+
189
+ .press-article-content,
190
+ .press-article-footer {
191
+ border-top: 1px solid var(--pr-c-divider-light);
192
+ }
193
+ }
194
+
195
+ @media (prefers-reduced-motion: reduce) {
196
+ .press-article-tag,
197
+ .press-article-post-link {
198
+ transition: none;
199
+ }
200
+ }
201
+ </style>
@@ -18,7 +18,7 @@ const { hasSidebar } = useSidebar()
18
18
  <style lang="scss" scoped>
19
19
  .press-footer {
20
20
  position: relative;
21
- z-index: var(--pr-z-index-footer);
21
+ z-index: var(--pr-z-footer);
22
22
  border-top: 1px solid var(--pr-c-divider-light);
23
23
  padding: 32px 24px;
24
24
  background-color: var(--va-c-bg);
@@ -29,14 +29,14 @@ const { hasSidebar } = useSidebar()
29
29
  }
30
30
 
31
31
  @media (width >= 768px) {
32
- .pr-footer {
32
+ .press-footer {
33
33
  padding: 32px;
34
34
  }
35
35
  }
36
36
 
37
37
  .container {
38
38
  margin: 0 auto;
39
- max-width: var(--pr-layout-max-width);
39
+ max-width: var(--pr-layout-max-width, var(--pr-home-max-width));
40
40
  text-align: center;
41
41
  }
42
42
 
@@ -45,7 +45,7 @@ const { hasSidebar } = useSidebar()
45
45
  line-height: 24px;
46
46
  font-size: 14px;
47
47
  font-weight: 500;
48
- color: var(--va-c-text-lighter);
48
+ color: var(--pr-c-text-2);
49
49
  }
50
50
 
51
51
  .press-footer :deep(a) {
@@ -83,6 +83,7 @@ async function copyCommand() {
83
83
  }
84
84
 
85
85
  .command-copy {
86
+ position: relative;
86
87
  display: grid;
87
88
  place-items: center;
88
89
  flex-shrink: 0;
@@ -94,6 +95,12 @@ async function copyCommand() {
94
95
  cursor: pointer;
95
96
  }
96
97
 
98
+ .command-copy::after {
99
+ content: '';
100
+ position: absolute;
101
+ inset: -8px;
102
+ }
103
+
97
104
  .command-copy:hover {
98
105
  color: var(--pr-c-brand);
99
106
  background: var(--pr-c-brand-soft);
@@ -92,7 +92,7 @@ const actions = computed(() => {
92
92
  display: grid;
93
93
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
94
94
  border-bottom: 1px solid var(--pr-c-divider-light);
95
- min-height: 620px;
95
+ min-height: clamp(540px, calc(100svh - var(--pr-nav-height) - 68px), 780px);
96
96
  }
97
97
 
98
98
  .hero-copy {
@@ -113,7 +113,7 @@ const actions = computed(() => {
113
113
  .hero-eyebrow {
114
114
  margin: 0 0 24px;
115
115
  color: var(--pr-c-text-2);
116
- font-size: 12px;
116
+ font-size: 13px;
117
117
  letter-spacing: 0.08em;
118
118
  }
119
119
 
@@ -172,9 +172,8 @@ const actions = computed(() => {
172
172
  bottom: 28px;
173
173
  margin: 0;
174
174
  color: var(--pr-c-text-2);
175
- font-size: 11px;
176
- letter-spacing: 0.2em;
177
- text-transform: uppercase;
175
+ font-size: 13px;
176
+ letter-spacing: 0.06em;
178
177
  }
179
178
 
180
179
  .press-hero-image {
@@ -247,6 +246,7 @@ const actions = computed(() => {
247
246
  @media (width <= 959px) {
248
247
  .press-home-hero {
249
248
  grid-template-columns: minmax(0, 1fr);
249
+ min-height: auto;
250
250
  }
251
251
 
252
252
  .hero-copy {
@@ -156,8 +156,6 @@ const playing = computed(() => props.animated && isVisible.value && documentVisi
156
156
  z-index: 1;
157
157
  width: 48%;
158
158
  max-width: 260px;
159
- animation: press-orbit-float 7s ease-in-out infinite;
160
- animation-play-state: paused;
161
159
  }
162
160
 
163
161
  .orbit-logo :deep(img) {
@@ -224,13 +222,18 @@ const playing = computed(() => props.animated && isVisible.value && documentVisi
224
222
  cursor: pointer;
225
223
  }
226
224
 
225
+ .orbit-toggle::after {
226
+ content: '';
227
+ position: absolute;
228
+ inset: -4px;
229
+ }
230
+
227
231
  .orbit-toggle:hover {
228
232
  color: var(--pr-c-brand);
229
233
  border-color: currentcolor;
230
234
  }
231
235
 
232
- .is-playing .orbit-ring,
233
- .is-playing .orbit-logo {
236
+ .is-playing .orbit-ring {
234
237
  animation-play-state: running;
235
238
  }
236
239
 
@@ -238,14 +241,8 @@ const playing = computed(() => props.animated && isVisible.value && documentVisi
238
241
  to { transform: rotate(360deg); }
239
242
  }
240
243
 
241
- @keyframes press-orbit-float {
242
- 0%, 100% { transform: translateY(5px); }
243
- 50% { transform: translateY(-9px); }
244
- }
245
-
246
244
  @media (prefers-reduced-motion: reduce) {
247
- .orbit-ring,
248
- .orbit-logo {
245
+ .orbit-ring {
249
246
  animation: none;
250
247
  }
251
248
 
@@ -70,7 +70,7 @@ onUnmounted(() => {
70
70
  <slot name="main-content-before" />
71
71
 
72
72
  <ValaxyMd class="mx-auto w-full max-w-4xl" :frontmatter="frontmatter">
73
- <div v-if="hasSidebar && !isHome && $title && frontmatter.pageTitle !== false" flex items-center justify-between gap-2>
73
+ <div v-if="hasSidebar && !isHome && $title && frontmatter.pageTitle !== false" class="press-doc-header flex items-center justify-between flex-wrap gap-3">
74
74
  <h1 :id="$title" tabindex="-1" class="!mt-0">
75
75
  {{ $title }}
76
76
  <a class="header-anchor" :href="`#${$title}`" aria-hidden="true" />
package/layouts/post.vue CHANGED
@@ -1,13 +1,3 @@
1
- <script setup lang="ts">
2
- import { defineArticle, useSchemaOrg } from '@unhead/schema-org/vue'
3
-
4
- useSchemaOrg([
5
- defineArticle({
6
- '@type': 'Article',
7
- }),
8
- ])
9
- </script>
10
-
11
1
  <template>
12
2
  <Layout>
13
3
  <PressArticle />
package/locales/en.yml CHANGED
@@ -26,3 +26,9 @@ nav:
26
26
  site: Site navigation
27
27
  open: Open navigation
28
28
  close: Close navigation
29
+
30
+ article:
31
+ next: Next article
32
+ prev: Previous article
33
+ all_posts: All posts
34
+ back_to_posts: Back to posts
package/locales/zh-CN.yml CHANGED
@@ -26,3 +26,9 @@ nav:
26
26
  site: 站点导航
27
27
  open: 打开导航
28
28
  close: 关闭导航
29
+
30
+ article:
31
+ next: 下一篇
32
+ prev: 上一篇
33
+ all_posts: 全部文章
34
+ back_to_posts: 返回文章列表
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-press",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "Docs (VitePress-like) theme for Valaxy",
5
5
  "author": {
6
6
  "email": "me@yunyoujun.cn",
@@ -37,6 +37,6 @@
37
37
  "reka-ui": "^2.10.4"
38
38
  },
39
39
  "devDependencies": {
40
- "valaxy": "1.5.1"
40
+ "valaxy": "1.6.1"
41
41
  }
42
42
  }
@@ -1,5 +1,6 @@
1
1
  :root {
2
2
  --pr-home-max-width: 1320px;
3
+ --pr-layout-max-width: 1440px;
3
4
  --pr-font-display: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
4
5
  --pr-font-body: var(--va-font-sans);
5
6
  --pr-font-mono: var(--va-font-mono);
@@ -58,6 +59,7 @@
58
59
 
59
60
  // z-index
60
61
  --va-z-overlay: var(--pr-z-backdrop);
62
+ --pr-z-footer: 1;
61
63
  --pr-z-local-nav: 8;
62
64
  --pr-z-backdrop: 10;
63
65
  --pr-z-aside: 11;
package/styles/doc.css CHANGED
@@ -99,6 +99,21 @@
99
99
  line-height: 1.75;
100
100
  }
101
101
 
102
+ .press-doc .markdown-body :where(p, ul, ol, blockquote):not(.custom-block *, td *, th *) {
103
+ max-width: 72ch;
104
+ }
105
+
106
+ .press-doc .press-doc-header + div > h2:first-child,
107
+ .press-doc .press-doc-header + h2 {
108
+ margin-top: 1.5rem;
109
+ }
110
+
111
+ @media (width <= 639px) {
112
+ .press-doc h2 {
113
+ margin-top: 2rem;
114
+ }
115
+ }
116
+
102
117
  .press-doc blockquote {
103
118
  margin: 1rem 0;
104
119
  border-left: 2px solid var(--press-c-divider);
@@ -113,6 +113,25 @@
113
113
  font-weight: 600;
114
114
  }
115
115
 
116
+ .press-doc-header + :is(div, section) > h2:first-child,
117
+ .press-doc-header + h2 {
118
+ margin-top: 20px;
119
+ }
120
+
121
+ @media (width <= 639px) {
122
+ h2 {
123
+ --va-header-anchor-top: 20px;
124
+
125
+ margin-top: 32px;
126
+ padding-top: 20px;
127
+ }
128
+
129
+ .press-doc-header + :is(div, section) > h2:first-child,
130
+ .press-doc-header + h2 {
131
+ margin-top: 16px;
132
+ }
133
+ }
134
+
116
135
  p, li {
117
136
  line-height: 1.85;
118
137
  }
package/styles/tokens.css CHANGED
@@ -29,37 +29,31 @@
29
29
  }
30
30
 
31
31
  :root {
32
- --press-c-bg: #fff;
33
- --press-c-bg-alt: #f6f6f7;
34
- --press-c-bg-soft: #f6f6f7;
35
- }
36
-
37
- .dark {
38
- --press-c-bg: #1b1b1f;
39
- --press-c-bg-alt: #161618;
40
- --press-c-bg-soft: #202127;
32
+ --press-c-bg: var(--va-c-bg);
33
+ --press-c-bg-alt: var(--va-c-bg-alt);
34
+ --press-c-bg-soft: var(--va-c-bg-soft);
41
35
  }
42
36
 
43
37
  :root {
44
- --press-c-divider: #e2e2e3;
38
+ --press-c-divider: var(--pr-c-divider-light);
45
39
  --press-c-gutter: #e2e2e3;
46
40
  }
47
41
 
48
42
  .dark {
49
- --press-c-divider: #2e2e32;
43
+ --press-c-divider: var(--pr-c-divider-light);
50
44
  --press-c-gutter: #000;
51
45
  }
52
46
 
53
47
  :root {
54
- --press-c-text-1: #3c3c43;
55
- --press-c-text-2: #67676c;
56
- --press-c-text-3: #929295;
48
+ --press-c-text-1: var(--pr-c-text-1);
49
+ --press-c-text-2: var(--pr-c-text-2);
50
+ --press-c-text-3: #73737a;
57
51
  }
58
52
 
59
53
  .dark {
60
- --press-c-text-1: #dfdfd6;
61
- --press-c-text-2: #98989f;
62
- --press-c-text-3: #6a6a71;
54
+ --press-c-text-1: var(--pr-c-text-1);
55
+ --press-c-text-2: var(--pr-c-text-2);
56
+ --press-c-text-3: #8e8e96;
63
57
  }
64
58
 
65
59
  :root {