@mintfolio/theme-verdant 0.2.0
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.
- package/LICENSE +674 -0
- package/README.md +66 -0
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/assets/favicon.ico +0 -0
- package/assets/favicon.svg +9 -0
- package/assets/fonts/Inter-300.woff2 +0 -0
- package/assets/fonts/Inter-400.woff2 +0 -0
- package/assets/fonts/Inter-500.woff2 +0 -0
- package/assets/fonts/Inter-600.woff2 +0 -0
- package/assets/fonts/Inter-700.woff2 +0 -0
- package/assets/fonts/JetBrainsMono-400.woff2 +0 -0
- package/assets/fonts/JetBrainsMono-500.woff2 +0 -0
- package/assets/fonts/PlayfairDisplay-400.woff2 +0 -0
- package/assets/fonts/PlayfairDisplay-500.woff2 +0 -0
- package/assets/fonts/PlayfairDisplay-600.woff2 +0 -0
- package/assets/fonts/PlayfairDisplay-700.woff2 +0 -0
- package/components/base/Contact.astro +173 -0
- package/components/base/Hero.astro +228 -0
- package/components/base/Navigation.astro +288 -0
- package/components/base/Projects.astro +207 -0
- package/components/base/Skills.astro +158 -0
- package/components/blog/ArticleProse.astro +217 -0
- package/components/blog/CodeBlockEnhancer.astro +310 -0
- package/components/blog/PostCard.astro +98 -0
- package/components/blog/ProtectedArticle.astro +89 -0
- package/config/theme-verdant.config.mjs +74 -0
- package/layouts/Base.astro +460 -0
- package/lib/palettes.ts +10 -0
- package/licenses/Inter-OFL.txt +92 -0
- package/licenses/JetBrainsMono-OFL.txt +93 -0
- package/licenses/PlayfairDisplay-OFL.txt +191 -0
- package/package.json +68 -0
- package/pages/archive.astro +384 -0
- package/pages/home.astro +2049 -0
- package/pages/page.astro +434 -0
- package/pages/post.astro +1029 -0
- package/scripts/article.ts +42 -0
- package/scripts/articleOrigin.ts +31 -0
- package/scripts/articleTables.ts +15 -0
- package/scripts/blog.ts +26 -0
- package/scripts/codeBlocks.ts +172 -0
- package/scripts/hero.ts +173 -0
- package/scripts/home.ts +12 -0
- package/scripts/homePanels.ts +100 -0
- package/scripts/hotContent.ts +16 -0
- package/scripts/lifecycle.ts +3 -0
- package/scripts/lightbox.ts +14 -0
- package/scripts/postFilters.ts +101 -0
- package/scripts/postList.ts +132 -0
- package/scripts/progress.ts +29 -0
- package/scripts/protectedArticle.ts +49 -0
- package/scripts/protectedToc.ts +29 -0
- package/scripts/site.ts +145 -0
- package/scripts/tagFold.ts +61 -0
- package/scripts/theme.ts +102 -0
- package/scripts/toc.ts +149 -0
- package/settings.ts +21 -0
- package/styles/fonts.css +120 -0
- package/styles/global.css +146 -0
- package/styles/themes/happyhues/effects.css +62 -0
- package/styles/themes/happyhues/index.css +2 -0
- package/styles/themes/happyhues/theme.css +225 -0
- package/theme.mjs +60 -0
- package/utils/blogNavigation.ts +3 -0
- package/utils/homeReturnHint.ts +34 -0
- package/utils/storage.ts +16 -0
- package/utils/types.ts +8 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ArticleProse - Blog article content wrapper component.
|
|
4
|
+
*
|
|
5
|
+
* Provides styled prose container for Markdown-rendered blog content with:
|
|
6
|
+
* - Typography styles for headings, paragraphs, lists, code blocks
|
|
7
|
+
* - Table wrapping for horizontal scroll on narrow viewports
|
|
8
|
+
* - Responsive padding adjustments for mobile devices
|
|
9
|
+
*/
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class="post-content post-shell-card article-prose">
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
.post-content.article-prose {
|
|
18
|
+
padding: 2rem;
|
|
19
|
+
line-height: 1.85;
|
|
20
|
+
border-radius: var(--radius-lg);
|
|
21
|
+
background: var(--color-surface);
|
|
22
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
|
|
23
|
+
box-shadow: var(--shadow-sm);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.post-content.article-prose :global(h1),
|
|
27
|
+
.post-content.article-prose :global(h2),
|
|
28
|
+
.post-content.article-prose :global(h3),
|
|
29
|
+
.post-content.article-prose :global(h4),
|
|
30
|
+
.post-content.article-prose :global(h5),
|
|
31
|
+
.post-content.article-prose :global(h6) {
|
|
32
|
+
color: var(--color-text);
|
|
33
|
+
margin-top: 2rem;
|
|
34
|
+
margin-bottom: 1rem;
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.post-content.article-prose :global(h1) {
|
|
39
|
+
font-size: 2rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.post-content.article-prose :global(h2) {
|
|
43
|
+
font-size: 1.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.post-content.article-prose :global(h3) {
|
|
47
|
+
font-size: 1.25rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.post-content.article-prose :global(p) {
|
|
51
|
+
margin-bottom: 1rem;
|
|
52
|
+
color: var(--color-text-muted);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.post-content.article-prose :global(a) {
|
|
56
|
+
color: var(--color-primary);
|
|
57
|
+
text-decoration: underline;
|
|
58
|
+
text-underline-offset: 2px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.post-content.article-prose :global(a:hover) {
|
|
62
|
+
color: var(--color-secondary);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.post-content.article-prose :global(ul),
|
|
66
|
+
.post-content.article-prose :global(ol) {
|
|
67
|
+
margin-bottom: 1rem;
|
|
68
|
+
padding-left: 1.5rem;
|
|
69
|
+
color: var(--color-text-muted);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.post-content.article-prose :global(li) {
|
|
73
|
+
margin-bottom: 0.5rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.post-content.article-prose :global(:not(pre) > code),
|
|
77
|
+
.post-content.article-prose :global(li > code),
|
|
78
|
+
.post-content.article-prose :global(p > code),
|
|
79
|
+
.post-content.article-prose :global(td > code) {
|
|
80
|
+
background: color-mix(in srgb, var(--color-primary) 12%, transparent);
|
|
81
|
+
color: var(--color-primary);
|
|
82
|
+
padding: 0.125rem 0.375rem;
|
|
83
|
+
border-radius: 6px;
|
|
84
|
+
font-size: 0.875em;
|
|
85
|
+
font-family: 'Fira Code', 'Consolas', monospace;
|
|
86
|
+
border: 1px solid color-mix(in srgb, var(--color-primary) 16%, transparent);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.post-content.article-prose :global(pre:not([data-code-block-enhanced='1'])) {
|
|
90
|
+
position: relative;
|
|
91
|
+
background: linear-gradient(180deg, rgba(14, 20, 27, 0.96) 0%, rgba(24, 32, 43, 0.98) 100%);
|
|
92
|
+
color: #edf2f7;
|
|
93
|
+
border: 1px solid rgba(148, 163, 184, 0.22);
|
|
94
|
+
border-radius: var(--radius-md);
|
|
95
|
+
padding: 1.1rem 1rem 1rem;
|
|
96
|
+
overflow-x: auto;
|
|
97
|
+
margin: 1.35rem 0;
|
|
98
|
+
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.post-content.article-prose :global(pre:not([data-code-block-enhanced='1']) code) {
|
|
102
|
+
background: none;
|
|
103
|
+
padding: 0;
|
|
104
|
+
color: inherit;
|
|
105
|
+
border: none;
|
|
106
|
+
display: block;
|
|
107
|
+
font-size: 0.92rem;
|
|
108
|
+
line-height: 1.7;
|
|
109
|
+
white-space: pre;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.post-content.article-prose :global(.code-block-shell pre) {
|
|
113
|
+
margin: 0;
|
|
114
|
+
padding: 0;
|
|
115
|
+
background: transparent;
|
|
116
|
+
border: none;
|
|
117
|
+
border-radius: 0;
|
|
118
|
+
box-shadow: none;
|
|
119
|
+
overflow: auto;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.post-content.article-prose :global(pre:not([data-code-block-enhanced='1']) code:not([class])),
|
|
123
|
+
.post-content.article-prose :global(pre:not([data-code-block-enhanced='1']) code.language-text),
|
|
124
|
+
.post-content.article-prose :global(pre:not([data-code-block-enhanced='1']) code[class*='language-text']) {
|
|
125
|
+
color: #f8fafc;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.post-content.article-prose :global(blockquote) {
|
|
129
|
+
border-left: 3px solid var(--color-primary);
|
|
130
|
+
padding-left: 1rem;
|
|
131
|
+
margin: 1rem 0;
|
|
132
|
+
color: var(--color-text-muted);
|
|
133
|
+
font-style: italic;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.post-content.article-prose :global(img) {
|
|
137
|
+
max-width: 100%;
|
|
138
|
+
height: auto;
|
|
139
|
+
border-radius: 8px;
|
|
140
|
+
margin: 1rem 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.post-content.article-prose :global(hr) {
|
|
144
|
+
border: none;
|
|
145
|
+
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
146
|
+
margin: 2rem 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.post-content.article-prose :global(.table-scroll-wrap) {
|
|
150
|
+
margin: 1.5rem 0;
|
|
151
|
+
overflow-x: auto;
|
|
152
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 85%, transparent);
|
|
153
|
+
border-radius: var(--radius-md);
|
|
154
|
+
background: color-mix(in srgb, var(--color-surface) 96%, var(--color-bg) 4%);
|
|
155
|
+
box-shadow: var(--shadow-sm);
|
|
156
|
+
-webkit-overflow-scrolling: touch;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.post-content.article-prose :global(table) {
|
|
160
|
+
width: 100%;
|
|
161
|
+
min-width: 32rem;
|
|
162
|
+
border-collapse: separate;
|
|
163
|
+
border-spacing: 0;
|
|
164
|
+
margin: 0;
|
|
165
|
+
background: transparent;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.post-content.article-prose :global(thead) {
|
|
169
|
+
background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.post-content.article-prose :global(th),
|
|
173
|
+
.post-content.article-prose :global(td) {
|
|
174
|
+
padding: 0.9rem 1rem;
|
|
175
|
+
text-align: left;
|
|
176
|
+
vertical-align: top;
|
|
177
|
+
border-right: 1px solid color-mix(in srgb, var(--color-border) 75%, transparent);
|
|
178
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-border) 75%, transparent);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.post-content.article-prose :global(th) {
|
|
182
|
+
font-weight: 700;
|
|
183
|
+
color: var(--color-text);
|
|
184
|
+
white-space: nowrap;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.post-content.article-prose :global(td) {
|
|
188
|
+
color: var(--color-text-muted);
|
|
189
|
+
line-height: 1.7;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.post-content.article-prose :global(tr:last-child td) {
|
|
193
|
+
border-bottom: none;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.post-content.article-prose :global(th:last-child),
|
|
197
|
+
.post-content.article-prose :global(td:last-child) {
|
|
198
|
+
border-right: none;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@media (max-width: 768px) {
|
|
202
|
+
.post-content.article-prose {
|
|
203
|
+
padding: 1.5rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.post-content.article-prose :global(table) {
|
|
207
|
+
min-width: 28rem;
|
|
208
|
+
font-size: 0.92rem;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.post-content.article-prose :global(th),
|
|
212
|
+
.post-content.article-prose :global(td) {
|
|
213
|
+
padding: 0.8rem 0.9rem;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</style>
|
|
217
|
+
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* CodeBlockEnhancer - Syntax-highlighted code block enhancer for blog posts.
|
|
4
|
+
*
|
|
5
|
+
* Transforms plain <pre><code> blocks into feature-rich code editors with:
|
|
6
|
+
* - macOS-style window chrome (red/yellow/green dots)
|
|
7
|
+
* - Language label detection and display
|
|
8
|
+
* - Line numbers with row highlighting
|
|
9
|
+
* - Copy-to-clipboard functionality with success/error feedback
|
|
10
|
+
* - Responsive styling for mobile devices
|
|
11
|
+
*
|
|
12
|
+
* Uses global styles and a page-scoped module for all article code blocks.
|
|
13
|
+
*/
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<style is:global>
|
|
17
|
+
.post-content .code-block-shell {
|
|
18
|
+
--code-block-bg: #0f172a;
|
|
19
|
+
--code-block-surface: #111827;
|
|
20
|
+
--code-block-toolbar: #1b2433;
|
|
21
|
+
--code-block-border: rgba(148, 163, 184, 0.22);
|
|
22
|
+
--code-block-highlight: rgba(255, 255, 255, 0.05);
|
|
23
|
+
--code-block-text: #e5eef9;
|
|
24
|
+
--code-block-muted: #7f8ea8;
|
|
25
|
+
--code-block-muted-strong: #9fb0cd;
|
|
26
|
+
--code-block-line-digits: 2;
|
|
27
|
+
position: relative;
|
|
28
|
+
margin: 1.5rem 0;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
border: 1px solid var(--code-block-border);
|
|
31
|
+
border-radius: calc(var(--radius-md) + 2px);
|
|
32
|
+
background:
|
|
33
|
+
radial-gradient(circle at top, rgba(96, 165, 250, 0.1), transparent 34%),
|
|
34
|
+
linear-gradient(180deg, #1a2333 0%, #101827 100%);
|
|
35
|
+
box-shadow:
|
|
36
|
+
0 18px 42px rgba(15, 23, 42, 0.22),
|
|
37
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.post-content .code-block-toolbar {
|
|
41
|
+
position: relative;
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: 0.55rem;
|
|
45
|
+
min-height: 1.95rem;
|
|
46
|
+
padding: 0.28rem 0.72rem;
|
|
47
|
+
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
|
48
|
+
background:
|
|
49
|
+
linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
|
|
50
|
+
linear-gradient(180deg, #263044 0%, var(--code-block-toolbar) 100%);
|
|
51
|
+
user-select: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.post-content .code-block-window-controls {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: 0.34rem;
|
|
58
|
+
flex-shrink: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.post-content .code-block-window-dot {
|
|
62
|
+
width: 0.6rem;
|
|
63
|
+
height: 0.6rem;
|
|
64
|
+
border-radius: 999px;
|
|
65
|
+
box-shadow:
|
|
66
|
+
inset 0 0 0 1px rgba(0, 0, 0, 0.14),
|
|
67
|
+
0 1px 2px rgba(15, 23, 42, 0.2);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.post-content .code-block-window-dot.is-red {
|
|
71
|
+
background: #ff5f57;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.post-content .code-block-window-dot.is-yellow {
|
|
75
|
+
background: #febc2e;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.post-content .code-block-window-dot.is-green {
|
|
79
|
+
background: #28c840;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.post-content .code-block-language {
|
|
83
|
+
position: absolute;
|
|
84
|
+
left: 50%;
|
|
85
|
+
transform: translateX(-50%);
|
|
86
|
+
max-width: calc(100% - 6rem);
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
text-overflow: ellipsis;
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
font-family: var(--font-mono);
|
|
91
|
+
font-size: 0.62rem;
|
|
92
|
+
font-weight: 600;
|
|
93
|
+
letter-spacing: 0.1em;
|
|
94
|
+
text-transform: uppercase;
|
|
95
|
+
color: var(--code-block-muted-strong);
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.post-content .code-copy-btn {
|
|
100
|
+
margin-left: auto;
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
width: 1.55rem;
|
|
105
|
+
height: 1.55rem;
|
|
106
|
+
padding: 0;
|
|
107
|
+
border: 1px solid rgba(148, 163, 184, 0.14);
|
|
108
|
+
border-radius: 0.5rem;
|
|
109
|
+
background: rgba(255, 255, 255, 0.04);
|
|
110
|
+
color: var(--code-block-muted-strong);
|
|
111
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
|
|
112
|
+
transition:
|
|
113
|
+
color var(--transition-fast),
|
|
114
|
+
border-color var(--transition-fast),
|
|
115
|
+
background var(--transition-fast),
|
|
116
|
+
scale var(--transition-fast);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.post-content .code-copy-btn:hover {
|
|
120
|
+
border-color: rgba(148, 163, 184, 0.24);
|
|
121
|
+
background: rgba(255, 255, 255, 0.08);
|
|
122
|
+
color: var(--code-block-text);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.post-content .code-copy-btn:active {
|
|
126
|
+
scale: 0.96;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@media (prefers-reduced-motion: reduce) {
|
|
130
|
+
.post-content .code-copy-btn:active {
|
|
131
|
+
scale: 1;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.post-content .code-copy-btn.is-copied {
|
|
136
|
+
border-color: rgba(74, 222, 128, 0.45);
|
|
137
|
+
background: rgba(74, 222, 128, 0.12);
|
|
138
|
+
color: #86efac;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.post-content .code-copy-btn.is-copy-failed {
|
|
142
|
+
border-color: rgba(248, 113, 113, 0.42);
|
|
143
|
+
background: rgba(248, 113, 113, 0.12);
|
|
144
|
+
color: #fda4af;
|
|
145
|
+
animation: code-copy-failed 0.28s ease;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.post-content .code-copy-btn svg {
|
|
149
|
+
width: 0.8rem;
|
|
150
|
+
height: 0.8rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@keyframes code-copy-failed {
|
|
154
|
+
0% {
|
|
155
|
+
transform: translateX(0);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
25% {
|
|
159
|
+
transform: translateX(-1.5px);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
50% {
|
|
163
|
+
transform: translateX(1.5px);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
75% {
|
|
167
|
+
transform: translateX(-1px);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
100% {
|
|
171
|
+
transform: translateX(0);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.post-content .code-block-scroll {
|
|
176
|
+
--code-font-size: 0.87rem;
|
|
177
|
+
--code-line-height: 1.6;
|
|
178
|
+
display: grid;
|
|
179
|
+
grid-template-columns: calc(var(--code-block-line-digits) * 1ch + 1.5rem) minmax(0, 1fr);
|
|
180
|
+
font-family: var(--font-mono);
|
|
181
|
+
font-size: var(--code-font-size);
|
|
182
|
+
line-height: var(--code-line-height);
|
|
183
|
+
background:
|
|
184
|
+
linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent),
|
|
185
|
+
linear-gradient(180deg, var(--code-block-surface) 0%, var(--code-block-bg) 100%);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.post-content .code-block-shell pre {
|
|
189
|
+
min-width: 0;
|
|
190
|
+
margin: 0;
|
|
191
|
+
padding: 0;
|
|
192
|
+
overflow-x: auto !important;
|
|
193
|
+
overflow-y: hidden !important;
|
|
194
|
+
border: none;
|
|
195
|
+
border-radius: 0;
|
|
196
|
+
background: transparent !important;
|
|
197
|
+
box-shadow: none;
|
|
198
|
+
scrollbar-width: thin;
|
|
199
|
+
scrollbar-color: rgba(148, 163, 184, 0.42) transparent;
|
|
200
|
+
font: inherit;
|
|
201
|
+
line-height: var(--code-line-height);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.post-content .code-block-shell pre::-webkit-scrollbar {
|
|
205
|
+
width: 10px;
|
|
206
|
+
height: 10px;
|
|
207
|
+
display: block;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.post-content .code-block-shell pre::-webkit-scrollbar-track {
|
|
211
|
+
background: transparent;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.post-content .code-block-shell pre::-webkit-scrollbar-thumb {
|
|
215
|
+
border: 2px solid transparent;
|
|
216
|
+
border-radius: 999px;
|
|
217
|
+
background: rgba(148, 163, 184, 0.36);
|
|
218
|
+
background-clip: padding-box;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.post-content .code-block-shell pre::-webkit-scrollbar-thumb:hover {
|
|
222
|
+
background: rgba(148, 163, 184, 0.5);
|
|
223
|
+
background-clip: padding-box;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.post-content .code-block-shell pre code {
|
|
227
|
+
display: block;
|
|
228
|
+
width: max-content;
|
|
229
|
+
min-width: 100%;
|
|
230
|
+
padding: 0.6rem 0;
|
|
231
|
+
border: 0;
|
|
232
|
+
border-radius: 0;
|
|
233
|
+
background: transparent;
|
|
234
|
+
color: var(--code-block-text);
|
|
235
|
+
font: inherit;
|
|
236
|
+
white-space: pre;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.post-content .code-block-shell .code-block-row {
|
|
240
|
+
display: block;
|
|
241
|
+
min-height: calc(var(--code-font-size) * var(--code-line-height));
|
|
242
|
+
padding: 0 0.85rem;
|
|
243
|
+
line-height: inherit;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.post-content .code-block-shell .code-block-row:hover {
|
|
247
|
+
background-color: var(--code-block-highlight);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.post-content .code-block-gutter {
|
|
251
|
+
padding: 0.6rem 0;
|
|
252
|
+
border-right: 1px solid rgba(148, 163, 184, 0.14);
|
|
253
|
+
background: var(--code-block-bg);
|
|
254
|
+
color: var(--code-block-muted);
|
|
255
|
+
text-align: right;
|
|
256
|
+
user-select: none;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.post-content .code-block-line-number {
|
|
260
|
+
display: block;
|
|
261
|
+
padding: 0 0.65rem;
|
|
262
|
+
height: calc(var(--code-font-size) * var(--code-line-height));
|
|
263
|
+
line-height: inherit;
|
|
264
|
+
font-variant-numeric: tabular-nums;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.post-content .code-block-shell :where(.code-block-row span) {
|
|
268
|
+
white-space: inherit;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@media (max-width: 640px) {
|
|
272
|
+
.post-content .code-block-shell {
|
|
273
|
+
margin: 1.2rem 0;
|
|
274
|
+
border-radius: var(--radius-md);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.post-content .code-block-toolbar {
|
|
278
|
+
min-height: 1.82rem;
|
|
279
|
+
padding: 0.24rem 0.62rem;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.post-content .code-block-window-controls {
|
|
283
|
+
gap: 0.26rem;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.post-content .code-block-window-dot {
|
|
287
|
+
width: 0.52rem;
|
|
288
|
+
height: 0.52rem;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.post-content .code-block-language {
|
|
292
|
+
max-width: calc(100% - 5.45rem);
|
|
293
|
+
font-size: 0.58rem;
|
|
294
|
+
letter-spacing: 0.08em;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.post-content .code-copy-btn {
|
|
298
|
+
width: 1.4rem;
|
|
299
|
+
height: 1.4rem;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.post-content .code-block-scroll {
|
|
303
|
+
--code-font-size: 0.78rem;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
</style>
|
|
307
|
+
|
|
308
|
+
<script>
|
|
309
|
+
import '../../scripts/codeBlocks';
|
|
310
|
+
</script>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Image from '@mintfolio/core/components/Image.astro';
|
|
3
|
+
import type { PostSummary } from '@mintfolio/theme-api';
|
|
4
|
+
import { createSearchEntry } from '@mintfolio/theme-api/search';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/** Core-projected metadata; includes no password or protected plaintext. */
|
|
8
|
+
post: PostSummary;
|
|
9
|
+
index: number;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
variant: 'home' | 'blog';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { post, index, pageSize, variant } = Astro.props;
|
|
15
|
+
const Heading = variant === 'home' ? 'h3' : 'h2';
|
|
16
|
+
const search = createSearchEntry(post);
|
|
17
|
+
const publishedAt = new Date(post.publishedAt);
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<article
|
|
21
|
+
class:list={['post-card', { 'home-card': variant === 'home', 'has-cover': post.cover, 'initially-hidden': index >= pageSize }]}
|
|
22
|
+
data-id={post.id}
|
|
23
|
+
data-url={post.url}
|
|
24
|
+
data-title={search.title}
|
|
25
|
+
data-description={search.description}
|
|
26
|
+
data-tags={JSON.stringify(search.tags)}
|
|
27
|
+
data-category={search.category}
|
|
28
|
+
>
|
|
29
|
+
<a href={post.url} data-article-link class="post-link" draggable="false">
|
|
30
|
+
{post.cover && (
|
|
31
|
+
<div class="post-cover">
|
|
32
|
+
<Image src={post.cover} alt="" loading="lazy" width={800} height={450} draggable="false"
|
|
33
|
+
layout="constrained" widths={[400, 800]} sizes="(max-width: 600px) calc(100vw - 5rem), (max-width: 900px) 29vw, 340px" />
|
|
34
|
+
</div>
|
|
35
|
+
)}
|
|
36
|
+
<div class="post-content">
|
|
37
|
+
<div class="post-meta">
|
|
38
|
+
<span class="post-category">{post.category.label}</span>
|
|
39
|
+
<time class="post-date" datetime={post.publishedAt}>{publishedAt.toLocaleDateString('zh-CN', { year: 'numeric', month: 'long', day: 'numeric' })}</time>
|
|
40
|
+
</div>
|
|
41
|
+
<Heading class="post-title">{post.protected && <span class="post-lock" aria-label="加密文章">🔒 </span>}{post.title}</Heading>
|
|
42
|
+
<p class="post-description">{post.description}</p>
|
|
43
|
+
{post.tags?.length ? (
|
|
44
|
+
<div class="post-tags">{post.tags.map((tag) => <span class="tag">{tag.label}</span>)}</div>
|
|
45
|
+
) : null}
|
|
46
|
+
</div>
|
|
47
|
+
<span class="post-arrow" aria-hidden="true">→</span>
|
|
48
|
+
</a>
|
|
49
|
+
</article>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.post-card {
|
|
53
|
+
--card-color: var(--color-primary);
|
|
54
|
+
position: relative;
|
|
55
|
+
border: 1px solid var(--color-border);
|
|
56
|
+
border-radius: var(--radius-lg);
|
|
57
|
+
background: var(--color-surface);
|
|
58
|
+
box-shadow: var(--shadow-sm);
|
|
59
|
+
transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
}
|
|
62
|
+
.post-card:nth-child(3n + 2) { --card-color: var(--color-accent); }
|
|
63
|
+
.post-card:nth-child(3n + 3) { --card-color: var(--color-play); }
|
|
64
|
+
.post-card::before { content: ''; position: absolute; left: 0; top: 1.5rem; bottom: 1.5rem; width: 4px; background: var(--card-color); border-radius: 0 4px 4px 0; }
|
|
65
|
+
.post-card:hover { transform: translateY(-3px); border-color: var(--color-primary); box-shadow: 5px 5px 0 color-mix(in srgb, var(--card-color) 22%, var(--color-bg)); }
|
|
66
|
+
.post-card:focus-within { border-color: var(--color-primary); }
|
|
67
|
+
.post-card.initially-hidden, .post-card.hidden { display: none; }
|
|
68
|
+
.post-link { display: flex; align-items: center; gap: 1.4rem; padding: 1.4rem 1.5rem; min-height: 210px; text-decoration: none; }
|
|
69
|
+
.post-link:focus-visible { outline-offset: -4px; border-radius: inherit; }
|
|
70
|
+
.post-content { flex: 1; min-width: 0; order: 0; }
|
|
71
|
+
.post-meta { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; margin-bottom: .7rem; }
|
|
72
|
+
.post-category { color: var(--color-primary); background: var(--color-tag-bg); padding: .15rem .6rem; border-radius: 6px; font-size: .66rem; font-weight: 650; }
|
|
73
|
+
.post-date { font: .64rem var(--font-mono); color: var(--color-text-muted); }
|
|
74
|
+
.post-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -.025em; color: var(--color-text-headline); margin-bottom: .6rem; line-height: 1.5; transition: color var(--transition-fast); }
|
|
75
|
+
.post-card:hover .post-title { color: var(--color-primary); }
|
|
76
|
+
.post-description { font-size: .83rem; color: var(--color-text-muted); line-height: 1.75; margin-bottom: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
77
|
+
.post-tags { display: flex; flex-wrap: wrap; gap: .3rem .65rem; }
|
|
78
|
+
.tag { color: var(--color-text-muted); font-size: .65rem; }
|
|
79
|
+
.tag::before { content: '#'; color: var(--color-primary); margin-right: .15rem; }
|
|
80
|
+
.post-cover { order: 2; flex: 0 0 29%; width: 29%; height: 165px; border-radius: var(--radius-md); overflow: hidden; background: var(--color-bg-alt); }
|
|
81
|
+
.post-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
|
|
82
|
+
.post-card:hover .post-cover img { transform: scale(1.04); }
|
|
83
|
+
.post-arrow { flex: 0 0 32px; order: 1; width: 32px; height: 32px; border: 1px solid var(--color-border); border-radius: 50%; color: var(--color-primary); display: grid; place-items: center; font-size: 1.1rem; transition: background var(--transition-fast), color var(--transition-fast); }
|
|
84
|
+
.post-card:hover .post-arrow { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
|
|
85
|
+
@media (max-width: 600px) {
|
|
86
|
+
.post-link { flex-wrap: wrap; padding: 1rem; gap: 1rem; }
|
|
87
|
+
.post-cover { flex: 0 0 100%; width: 100%; height: 170px; order: -1; }
|
|
88
|
+
.post-content { flex: 1 1 0; padding-left: .2rem; }
|
|
89
|
+
.post-title { font-size: 1.06rem; }
|
|
90
|
+
.post-arrow { align-self: flex-end; }
|
|
91
|
+
.post-meta { gap: .5rem; }
|
|
92
|
+
.post-card::before { top: auto; height: 50px; bottom: 1rem; }
|
|
93
|
+
}
|
|
94
|
+
@media (prefers-reduced-motion: reduce) {
|
|
95
|
+
.post-card, .post-cover img, .post-arrow { transition: none; }
|
|
96
|
+
.post-card:hover, .post-card:hover .post-cover img { transform: none; }
|
|
97
|
+
}
|
|
98
|
+
</style>
|