minearm-website 0.0.3-beta.2

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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/astro.config.ts +33 -0
  4. package/minearm.ts +174 -0
  5. package/package.json +64 -0
  6. package/public/13.jpg +0 -0
  7. package/public/1937daxue.png +0 -0
  8. package/public/3.png +0 -0
  9. package/public/404.png +0 -0
  10. package/public/5.jpg +0 -0
  11. package/public/BC.png +0 -0
  12. package/public/Chinese.png +0 -0
  13. package/public/avatar.avif +0 -0
  14. package/public/avatar.jpg +0 -0
  15. package/public/c++1.png +0 -0
  16. package/public/docker-hub.png +0 -0
  17. package/public/favicon.png +0 -0
  18. package/public/help1.png +0 -0
  19. package/public/heroimg.jpg +0 -0
  20. package/public/logo.png +0 -0
  21. package/public/mail.png +0 -0
  22. package/public/nahida.png +0 -0
  23. package/public/pojipao.avif +0 -0
  24. package/public/rust1.png +0 -0
  25. package/public/scripts/mdata.json +4 -0
  26. package/public/scripts/utils.js +190 -0
  27. package/public/xmrig.jpg +0 -0
  28. package/src/components/BodyInject.astro +5 -0
  29. package/src/components/HeadInject.astro +16 -0
  30. package/src/components/Search.astro +30 -0
  31. package/src/components/animation/bubbles.astro +82 -0
  32. package/src/components/animation/wave.astro +81 -0
  33. package/src/components/aside/announcement.astro +25 -0
  34. package/src/components/aside/aside.astro +32 -0
  35. package/src/components/aside/asideComps.astro +26 -0
  36. package/src/components/aside/authorInfo.astro +54 -0
  37. package/src/components/aside/blogToc.astro +26 -0
  38. package/src/components/aside/countScript.astro +18 -0
  39. package/src/components/aside/customCard.astro +23 -0
  40. package/src/components/aside/siteInfo.astro +51 -0
  41. package/src/components/client/searchCore.vue +77 -0
  42. package/src/components/client/themeControl.vue +77 -0
  43. package/src/components/footer/Footer.astro +32 -0
  44. package/src/components/header/Header.astro +40 -0
  45. package/src/components/header/HeaderButton.astro +59 -0
  46. package/src/components/header/HeaderItem.astro +63 -0
  47. package/src/components/header/heroWave.astro +19 -0
  48. package/src/components/header/searchBar.astro +21 -0
  49. package/src/components/icons/bilibili.astro +10 -0
  50. package/src/components/icons/c.astro +10 -0
  51. package/src/components/icons/code.astro +37 -0
  52. package/src/components/icons/computer.astro +4 -0
  53. package/src/components/icons/cube.astro +10 -0
  54. package/src/components/icons/game.astro +10 -0
  55. package/src/components/icons/getIcon.astro +64 -0
  56. package/src/components/icons/github.astro +10 -0
  57. package/src/components/icons/hardDriver.astro +10 -0
  58. package/src/components/icons/home.astro +14 -0
  59. package/src/components/icons/icon.ts +33 -0
  60. package/src/components/icons/icons.json +91961 -0
  61. package/src/components/icons/link.astro +4 -0
  62. package/src/components/icons/mail.astro +10 -0
  63. package/src/components/icons/paperPlane.astro +4 -0
  64. package/src/components/icons/pen.astro +14 -0
  65. package/src/components/icons/person.astro +14 -0
  66. package/src/components/icons/searchicon.astro +23 -0
  67. package/src/components/icons/tags.astro +10 -0
  68. package/src/components/icons/toTop.astro +10 -0
  69. package/src/components/icons/tools.astro +1 -0
  70. package/src/components/loading/loading.vue +185 -0
  71. package/src/components/postComment.astro +62 -0
  72. package/src/components/postlist/pagination.astro +40 -0
  73. package/src/components/postlist/postsList.astro +57 -0
  74. package/src/content/blog/default/Extended Search.md +50 -0
  75. package/src/content/blog/default/Mail.md +15 -0
  76. package/src/content/blog/default/history//345/205/254/345/205/203/345/211/215//347/247/246/345/247/213/347/232/207/347/273/237/344/270/200/345/205/255/345/233/275.md +40 -0
  77. package/src/content/blog/default/history//350/277/221/344/273/243/347/257/207//344/270/255/345/233/275/345/205/261/344/272/247/345/205/232/345/205/232/345/217/262.md +2361 -0
  78. package/src/content/blog/default/it/Rust/345/237/272/346/234/254/350/257/255/346/263/225.md +298 -0
  79. package/src/content/config.ts +38 -0
  80. package/src/env.d.ts +148 -0
  81. package/src/layouts/BaseLayout.astro +67 -0
  82. package/src/layouts/DefaultMdLayout.astro +46 -0
  83. package/src/layouts/HomeLayout.astro +27 -0
  84. package/src/layouts/PostLayout.astro +60 -0
  85. package/src/layouts/TagsLayout.astro +44 -0
  86. package/src/layouts/c.astro +42 -0
  87. package/src/layouts/h.astro +60 -0
  88. package/src/pages/404.md +10 -0
  89. package/src/pages/[...page].astro +46 -0
  90. package/src/pages/about/index.md +90 -0
  91. package/src/pages/blog/[...slug].astro +68 -0
  92. package/src/pages/categories/[category]/[...page].astro +45 -0
  93. package/src/pages/categories/index.astro +20 -0
  94. package/src/pages/friends/index.md +24 -0
  95. package/src/pages/rss.xml.js +20 -0
  96. package/src/pages/tags/[tag]/[...page].astro +42 -0
  97. package/src/pages/tags/index.astro +19 -0
  98. package/src/site_config.ts +15 -0
  99. package/src/styles/animation.scss +94 -0
  100. package/src/styles/blog/blog.scss +124 -0
  101. package/src/styles/blog/code.scss +111 -0
  102. package/src/styles/blog/directives.scss +356 -0
  103. package/src/styles/blog/index.scss +4 -0
  104. package/src/styles/blog/post.scss +474 -0
  105. package/src/styles/components/aside.scss +178 -0
  106. package/src/styles/components/footer.scss +74 -0
  107. package/src/styles/components/header.scss +421 -0
  108. package/src/styles/components/heroWave.scss +24 -0
  109. package/src/styles/components/main.scss +275 -0
  110. package/src/styles/components/page-content.scss +147 -0
  111. package/src/styles/components/pagination.scss +121 -0
  112. package/src/styles/components/search.scss +349 -0
  113. package/src/styles/custom.scss +21 -0
  114. package/src/styles/global.scss +167 -0
  115. package/src/styles/mixin.scss +17 -0
  116. package/src/styles/tags/tags.scss +83 -0
  117. package/src/theme_config.ts +178 -0
  118. package/src/utils/generateSearchData.ts +30 -0
  119. package/src/utils/md.ts +114 -0
  120. package/src/utils/processMd.ts +278 -0
  121. package/src/utils/utils.ts +87 -0
  122. package/tsconfig.json +32 -0
  123. package/vercel.json +26 -0
@@ -0,0 +1,298 @@
1
+ ---
2
+ title: Rust基本语法
3
+ description: 'Rust核心的基本语法'
4
+ pubDate: 2024-10-27
5
+ heroColor: ''
6
+ abbrlink: it/Rust基本语法
7
+ cover: "/rust1.png"
8
+ coverAlt: "Rust1"
9
+ tags:
10
+ - '编程基础'
11
+ - 'Rust'
12
+ - 'IT'
13
+ category: 'Rust'
14
+ ---
15
+ # Rust 基础语法
16
+
17
+ (说明) 复制滴别想,抄作业滴不要,若需要,滴开启超级复制插件
18
+
19
+ 变量,基本类型,函数,注释和控制流,这些几乎是每种编程语言都具有的编程概念。
20
+
21
+ 这些基础概念将存在于每个 Rust 程序中,及早学习它们将使你以最快的速度学习 Rust 的使用。
22
+
23
+ 变量
24
+ 首先必须说明,Rust 是强类型语言,但具有自动判断变量类型的能力。这很容易让人与弱类型语言产生混淆。
25
+
26
+ 默认情况下,Rust 中的变量是不可变的,除非使用 mut 关键字声明为可变变量。
27
+ ~~~rust
28
+ let a = 123; // 不可变变量
29
+ let mut b = 10; // 可变变量
30
+ ~~~
31
+ 如果要声明变量,需要使用 let 关键字。例如:
32
+ ```rust
33
+ let a = 123;
34
+ ```
35
+ 只学习过 JavaScript 的开发者对这句话很敏感,只学习过 C 语言的开发者对这句话很不理解。
36
+
37
+ 在这句声明语句之后,以下三行代码都是被禁止的:
38
+ ```rust
39
+ a = "abc";
40
+ a = 4.56;
41
+ a = 456;
42
+ ```
43
+ 第一行的错误在于当声明 a 是 123 以后,a 就被确定为整型数字,不能把字符串类型的值赋给它。
44
+
45
+ 第二行的错误在于自动转换数字精度有损失,Rust 语言不允许精度有损失的自动数据类型转换。
46
+
47
+ 第三行的错误在于 a 不是个可变变量。
48
+
49
+ 前两种错误很容易理解,但第三个是什么意思?难道 a 不是个变量吗?
50
+
51
+ 这就牵扯到了 Rust 语言为了高并发安全而做的设计:在语言层面尽量少的让变量的值可以改变。所以 a 的值不可变。但这不意味着 a 不是"变量"(英文中的 variable),官方文档称 a 这种变量为"不可变变量"。
52
+
53
+ 如果我们编写的程序的一部分在假设值永远不会改变的情况下运行,而我们代码的另一部分在改变该值,那么代码的第一部分可能就不会按照设计的意图去运转。由于这种原因造成的错误很难在事后找到。这是 Rust 语言设计这种机制的原因。
54
+
55
+ 当然,使变量变得"可变"(mutable)只需一个 mut 关键字。
56
+ ```rust
57
+ let mut a = 123;
58
+ a = 456;
59
+ ```
60
+
61
+ 这个程序是正确的。
62
+
63
+ 常量与不可变变量的区别
64
+ 既然不可变变量是不可变的,那不就是常量吗?为什么叫变量?
65
+
66
+ 变量和常量还是有区别的。在 Rust 中,以下程序是合法的:
67
+ ```rust
68
+ let a = 123; // 可以编译,但可能有警告,因为该变量没有被使用
69
+ let a = 456;
70
+ ```
71
+ 但是如果 a 是常量就不合法:
72
+ ```rust
73
+ const a: i32 = 123;
74
+ let a = 456;
75
+
76
+ ```
77
+ 变量的值可以"重新绑定",但在"重新绑定"以前不能私自被改变,这样可以确保在每一次"绑定"之后的区域里编译器可以充分的推理程序逻辑。 虽然 Rust 有自动判断类型的功能,但有些情况下声明类型更加方便:
78
+ ```rust
79
+ let a: u64 = 114;
80
+ ```
81
+
82
+ 这里声明了 a 为无符号 64 位整型变量,如果没有声明类型,a 将自动被判断为有符号 32 位整型变量,这对于 a 的取值范围有很大的影响。
83
+
84
+ 数据类型
85
+ Rust 是静态类型语言,在变量声明时可以显式指定类型,但通常可以依赖类型推断。
86
+
87
+ 基本类型: i32 (32位有符号整数), u32 (32位无符号整数), f64 (64位浮点数), bool (布尔类型), char (字符)
88
+
89
+ 实例
90
+ ```rust
91
+ let x: i32 = 42;
92
+ let y: f64 = 3.14;
93
+ let is_true: bool = true;
94
+ let letter: char = 'A';
95
+ ```
96
+ 函数
97
+ Rust 函数通过 fn 关键字定义,函数的返回类型通过箭头符号 -> 指定。
98
+
99
+ 实例
100
+ ```rust
101
+ fn add(a: i32, b: i32) -> i32 {
102
+ a + b
103
+ }
104
+ ```
105
+ 如果函数没有返回值,类型默认为 ()(即空元组)。
106
+
107
+ 控制流
108
+ if 表达式
109
+
110
+ 实例
111
+ ```rust
112
+ let number = 7;
113
+ if number < 5 {
114
+ println!("小于 5");
115
+ } else {
116
+ println!("大于等于 5");
117
+ }
118
+ ```
119
+ loop 循环: loop 是 Rust 中的无限循环,可以使用 break 退出循环。
120
+
121
+ 实例
122
+ ```rust
123
+ let mut counter = 0;
124
+ loop {
125
+ counter += 1;
126
+ if counter == 10 {
127
+ break;
128
+ }
129
+ }
130
+ ```
131
+ while 循环
132
+
133
+ 实例
134
+ ```rust
135
+ let mut number = 3;
136
+ while number != 0 {
137
+ println!("{}!", number);
138
+ number -= 1;
139
+ }
140
+ ```
141
+
142
+ for 循环
143
+
144
+ 实例
145
+ ```rust
146
+ for number in 1..4 {
147
+ println!("{}!", number);
148
+ }
149
+ ```
150
+ 所有权 (Ownership)
151
+ Rust 中的所有权是独特的内存管理机制,核心概念包括所有权 (ownership)、借用 (borrowing) 和引用 (reference)。
152
+
153
+ 所有权规则:
154
+
155
+ Rust 中的每个值都有一个所有者。
156
+ 每个值在任意时刻只能有一个所有者。
157
+ 当所有者超出作用域时,值会被删除。
158
+ ```rust
159
+ let s1 = String::from("hello");
160
+ let s2 = s1; // s1 的所有权被转移给了 s2
161
+ // println!("{}", s1); // 此处编译会报错,因为 s1 已不再拥有该值
162
+ ```
163
+ 借用和引用: 借用允许引用数据而不获取所有权,通过 & 符号实现。
164
+ ```rust
165
+ fn main() {
166
+ let s = String::from("hello");
167
+ let len = calculate_length(&s); // 借用
168
+ println!("The length of '{}' is {}.", s, len);
169
+ }
170
+
171
+ fn calculate_length(s: &String) -> usize {
172
+ s.len()
173
+ }
174
+ ```
175
+ 结构体 (Structs)
176
+ 结构体用于创建自定义类型,字段可以包含多种数据类型。
177
+
178
+ 实例
179
+ ```rust
180
+ struct User {
181
+ username: String,
182
+ email: String,
183
+ sign_in_count: u64,
184
+ active: bool,
185
+ }
186
+
187
+ let user1 = User {
188
+ username: String::from("someusername"),
189
+ email: String::from("someone@example.com"),
190
+ sign_in_count: 1,
191
+ active: true,
192
+ };
193
+ ```
194
+ 枚举 (Enums)
195
+ 枚举允许定义可能的几种数据类型中的一种。
196
+
197
+ 实例
198
+ ```rust
199
+ enum IpAddrKind {
200
+ V4,
201
+ V6,
202
+ }
203
+
204
+ let four = IpAddrKind::V4;
205
+ let six = IpAddrKind::V6;
206
+ ```
207
+ 模式匹配 (match)
208
+ match 是 Rust 中强大的控制流工具,类似于 switch 语句。
209
+
210
+ 实例
211
+ ```rust
212
+ enum Coin {
213
+ Penny,
214
+ Nickel,
215
+ Dime,
216
+ Quarter,
217
+ }
218
+
219
+ fn value_in_cents(coin: Coin) -> u8 {
220
+ match coin {
221
+ Coin::Penny => 1,
222
+ Coin::Nickel => 5,
223
+ Coin::Dime => 10,
224
+ Coin::Quarter => 25,
225
+ }
226
+ }
227
+ ```
228
+ 错误处理
229
+
230
+ Rust 有两种主要的错误处理方式:Result<T, E> 和 Option<T>。
231
+
232
+ Result:
233
+
234
+ 实例
235
+ ```rust
236
+ enum Result<T, E> {
237
+ Ok(T),
238
+ Err(E),
239
+ }
240
+
241
+ fn divide(a: i32, b: i32) -> Result<i32, String> {
242
+ if b == 0 {
243
+ Err(String::from("Division by zero"))
244
+ } else {
245
+ Ok(a / b)
246
+ }
247
+ }
248
+ ```
249
+ Option:
250
+
251
+ 实例
252
+ ```rust
253
+ fn get_element(index: usize, vec: &Vec<i32>) -> Option<i32> {
254
+ if index < vec.len() {
255
+ Some(vec[index])
256
+ } else {
257
+ None
258
+ }
259
+ }
260
+ ```
261
+ 所有权与借用的生命周期
262
+ Rust 使用生命周期来确保引用的有效性。生命周期标注用 'a 等来表示,但常见的情况下,编译器会自动推导。
263
+
264
+ 实例
265
+ ```rust
266
+ fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
267
+ if x.len() > y.len() {
268
+ x
269
+ } else {
270
+ y
271
+ }
272
+ }
273
+ ```
274
+ 重影(Shadowing)
275
+ 重影的概念与其他面向对象语言里的"重写"(Override)或"重载"(Overload)是不一样的。重影就是刚才讲述的所谓"重新绑定",之所以加引号就是为了在没有介绍这个概念的时候代替一下概念。
276
+
277
+ 重影就是指变量的名称可以被重新使用的机制:
278
+
279
+ 实例
280
+ ```rust
281
+ fn main() {
282
+ let x = 5;
283
+ let x = x + 1;
284
+ let x = x * 2;
285
+ println!("The value of x is: {}", x);
286
+ }
287
+ ```
288
+ 这段程序的运行结果:
289
+ ```rust
290
+ The value of x is: 12
291
+ ```
292
+ 重影与可变变量的赋值不是一个概念,重影是指用同一个名字重新代表另一个变量实体,其类型、可变属性和值都可以变化。但可变变量赋值仅能发生值的变化。
293
+ ```rust
294
+ let mut s = "114";
295
+ s = s.len();
296
+
297
+ ```
298
+ 这段程序会出错:不能给字符串变量赋整型值。
@@ -0,0 +1,38 @@
1
+ import { defineCollection, z } from "astro:content";
2
+ import { utils } from "@utils/utils";
3
+
4
+ const blogCollection = defineCollection({
5
+ schema: z.object({
6
+ title: z.string(),
7
+ description: z.string().optional(),
8
+ pubDate: z
9
+ .string()
10
+ .or(z.date())
11
+ .transform((val) => {
12
+ const date = new Date(val);
13
+ return utils.formatDate(date);
14
+ }),
15
+ updatedDate: z
16
+ .union([z.string(), z.date()])
17
+ .optional()
18
+ .transform((value) => {
19
+ if (!value) {
20
+ return undefined;
21
+ } else if (value instanceof Date) {
22
+ return utils.formatDate(value);
23
+ } else {
24
+ const date = new Date(value);
25
+ return utils.formatDate(date);
26
+ }
27
+ }),
28
+ heroColor: z.string().optional(),
29
+ cover: z.string().optional(),
30
+ abbrlink: z.string().optional(),
31
+ tags: z.string().array().optional(),
32
+ category: z.string().optional(),
33
+ }),
34
+ });
35
+
36
+ export const collections = {
37
+ blog: blogCollection,
38
+ };
package/src/env.d.ts ADDED
@@ -0,0 +1,148 @@
1
+ /// <reference path="../.astro/types.d.ts" />
2
+ /// <reference types="astro/client" />
3
+
4
+ interface Configs {
5
+ site: Site;
6
+ head: string[];
7
+ body: string[];
8
+ header: Header;
9
+ footer: Footer;
10
+ aside: Aside;
11
+ homePage: HomePageConfig;
12
+ postPage: PostPageConfig;
13
+ tagsPage: TagsPageConfig;
14
+ comments: CommentConfig;
15
+ }
16
+
17
+ interface PostPageConfig {
18
+ aside: AsideConfig;
19
+ }
20
+
21
+ interface ButtonItem {
22
+ customClass?: string;
23
+ link?: string;
24
+ icon: Function | string;
25
+ title?: string;
26
+ }
27
+
28
+ interface MenuItem extends ButtonItem {
29
+ name: string;
30
+ children?: MenuItem[];
31
+ }
32
+
33
+ interface HeaderFunc {
34
+ themeControl: boolean;
35
+ headerLogo: "left" | "right" | false;
36
+ pagePercent: boolean;
37
+ }
38
+
39
+ interface HomePageConfig {
40
+ heroShoot: string | false;
41
+ heroTitle: string;
42
+ heroDescription: string;
43
+ defaultCover: string;
44
+ paginationSize: number;
45
+ aside: AsideConfig;
46
+ }
47
+
48
+ interface AuthorInfo {
49
+ avatar: string;
50
+ description: string;
51
+ socialMedias: ButtonItem[];
52
+ }
53
+
54
+ interface Announcement {
55
+ headline: string;
56
+ content: string;
57
+ }
58
+
59
+ interface SiteInfo {
60
+ busuanzi: boolean;
61
+ totalWordCounts: boolean;
62
+ totalPostCounts: boolean;
63
+ }
64
+
65
+ interface Header {
66
+ menu: MenuItem[];
67
+ buttons: ButtonItem[];
68
+ functions: HeaderFunc;
69
+ }
70
+
71
+ interface Footer {
72
+ text: string;
73
+ copyright: string;
74
+ }
75
+
76
+ interface Aside {
77
+ authorInfo: AuthorInfo;
78
+ announcement: Announcement;
79
+ siteInfo: SiteInfo;
80
+ customCards: CustomCard[];
81
+ }
82
+
83
+ interface CustomCard {
84
+ icon: string | any;
85
+ title: string;
86
+ content: string;
87
+ customClass?: string;
88
+ }
89
+
90
+ interface Site {
91
+ title: string;
92
+ favicon: string;
93
+ logo: string;
94
+ author: string;
95
+ localSearch: {
96
+ enable: boolean;
97
+ comment: string;
98
+ hits: string[];
99
+ };
100
+ backgroundBubbles: number | false;
101
+ }
102
+
103
+ interface AsideConfig {
104
+ comps: AsideComponents[];
105
+ stickyComps: AsideComponents[];
106
+ direct?: "left" | "right";
107
+ }
108
+
109
+ type AsideComponents = "Announcement" | "AuthorInfo" | "BlogToc" | "SiteInfo";
110
+
111
+ interface TagsPageConfig {
112
+ floating: boolean;
113
+ }
114
+
115
+ // 评论相关类型
116
+ interface TwikooCommentConfig {
117
+ type: "twikoo";
118
+ options: {
119
+ envId: string;
120
+ lang: string;
121
+ };
122
+ }
123
+
124
+ interface WalineCommentConfig {
125
+ type: "waline";
126
+ options: {
127
+ serverURL: api.minearm.org;
128
+ };
129
+ }
130
+
131
+ interface ValineCommentConfig {
132
+ type: "valine";
133
+ options: {
134
+ appKey: string;
135
+ appId: string;
136
+ };
137
+ }
138
+
139
+ interface NoCommentConfig {
140
+ type: false;
141
+ options: null;
142
+ }
143
+
144
+ type CommentConfig =
145
+ | TwikooCommentConfig
146
+ | WalineCommentConfig
147
+ | NoCommentConfig
148
+ | ValineCommentConfig;
@@ -0,0 +1,67 @@
1
+ ---
2
+ import "@style/global.scss";
3
+ import "@style/components/page-content.scss";
4
+ import HeadInsert from "@comp/HeadInject.astro";
5
+ import { ViewTransitions } from 'astro:transitions';
6
+ import BodyInsert from "@comp/BodyInject.astro";
7
+ import { ThemeConfig } from "@src/theme_config";
8
+ import Header from "@comp/header/Header.astro";
9
+ import Footer from "@comp/footer/Footer.astro";
10
+ import Loading from "@comp/loading/loading.vue";
11
+ import Search from "@comp/Search.astro";
12
+ import Bubbles from "@comp/animation/bubbles.astro";
13
+ import { SiteConfig } from "@src/site_config";
14
+ interface Props {
15
+ class?: string;
16
+ description?: string;
17
+ }
18
+
19
+ const { class: pageClass, description } = Astro.props;
20
+ ---
21
+
22
+ <!DOCTYPE html>
23
+ <html lang="zh-CN" data-theme="light">
24
+ <head>
25
+ <meta charset="UTF-8" />
26
+ <title>{ThemeConfig.site.title}</title>
27
+ <link rel="icon" href={ThemeConfig.site.favicon} />
28
+ <meta name="generator" content={Astro.generator} />
29
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
30
+ <meta
31
+ name="description"
32
+ content={description === "" || !description
33
+ ? SiteConfig.description
34
+ : description}
35
+ />
36
+ <!-- <link
37
+ rel="stylesheet"
38
+ href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css"
39
+ /> -->
40
+ {
41
+ SiteConfig.markdownMath && (
42
+ <link
43
+ rel="stylesheet"
44
+ href="https://cdn.staticfile.org/KaTeX/0.16.8/katex.min.css"
45
+ />
46
+ )
47
+ }
48
+ <HeadInsert />
49
+ <slot name="head-end" />
50
+ </head>
51
+ <body class={pageClass} style="overflow: hidden;">
52
+ <Loading client:only />
53
+ <div id="main-container" style="display: none;">
54
+ <Header />
55
+ <slot />
56
+ <Footer />
57
+ </div>
58
+ <BodyInsert />
59
+ {SiteConfig.localSearch && <Search />}
60
+ {
61
+ ThemeConfig.site.backgroundBubbles !== false && (
62
+ <Bubbles bubbles={ThemeConfig.site.backgroundBubbles} />
63
+ )
64
+ }
65
+ <slot name="body-end" />
66
+ </body>
67
+ </html>
@@ -0,0 +1,46 @@
1
+ ---
2
+ import HeroWave from "@comp/header/heroWave.astro";
3
+ import PostLayout from "@src/layouts/PostLayout.astro";
4
+ import { ViewTransitions } from 'astro:transitions';
5
+ import { ThemeConfig } from "@src/theme_config";
6
+ import Code from '../components/icons/code.astro';
7
+ interface FrontMatter {
8
+ title: string;
9
+ description?: string;
10
+ heroColor?: string;
11
+ useComments?: boolean;
12
+ useToc?: boolean;
13
+ toc?: {
14
+ level: string;
15
+ id: string;
16
+ value: string;
17
+ }[];
18
+ file: string;
19
+ url: string;
20
+ }
21
+
22
+ interface Props {
23
+ frontmatter: FrontMatter;
24
+ }
25
+
26
+ const { frontmatter } = Astro.props;
27
+ ---
28
+
29
+ <PostLayout
30
+ useComments={frontmatter.useComments && ThemeConfig.comments.type !== false}
31
+ toc={frontmatter.useToc ? frontmatter.toc : undefined}
32
+ desc={frontmatter.description}
33
+ >
34
+ <HeroWave
35
+ class="post-header"
36
+ slot="post-hero"
37
+ heroColor={frontmatter.heroColor}
38
+ >
39
+
40
+ <div class="post-info">
41
+ <h1 class="post-title">{frontmatter.title}</h1>
42
+ </div>
43
+ </HeroWave>
44
+ <slot />
45
+ </PostLayout>
46
+ <ViewTransitions />
@@ -0,0 +1,27 @@
1
+ ---
2
+ import "@style/components/main.scss";
3
+ import BaseLayout from "./BaseLayout.astro";
4
+ import { ViewTransitions } from 'astro:transitions';
5
+ import Aside from "@comp/aside/aside.astro";
6
+ import { ThemeConfig } from "@src/theme_config";
7
+ interface Props {
8
+ asideDir?: "left" | "right" | false;
9
+ }
10
+
11
+ const { asideDir } = Astro.props;
12
+ ---
13
+
14
+ <BaseLayout class="home">
15
+ <slot name="beforeContainer" />
16
+ <article id="inner-container">
17
+ <Aside
18
+ direct={asideDir !== false ? ThemeConfig.homePage.aside.direct : false}
19
+ comps={ThemeConfig.homePage.aside.comps}
20
+ stickyComps={ThemeConfig.homePage.aside.stickyComps}
21
+ />
22
+ <main class="main-content">
23
+ <slot name="inContainer" />
24
+ </main>
25
+ </article>
26
+ </BaseLayout>
27
+ <ViewTransitions />
@@ -0,0 +1,60 @@
1
+ ---
2
+ import "@style/blog/index.scss";
3
+ import BaseLayout from "@layout/BaseLayout.astro";
4
+ import BlogToc from "@comp/aside/blogToc.astro";
5
+ import Aside from "@comp/aside/aside.astro";
6
+ import PostComment from "@comp/postComment.astro";
7
+ import type { CollectionEntry } from "astro:content";
8
+ import { ThemeConfig } from "@src/theme_config";
9
+
10
+ interface Props {
11
+ postData?: CollectionEntry<"blog">["data"];
12
+ toc?: {
13
+ level: string;
14
+ id: string;
15
+ value: string;
16
+ }[];
17
+ useComments?: boolean;
18
+ desc?: string;
19
+ }
20
+
21
+ const { toc, useComments = true, postData, desc } = Astro.props;
22
+ ---
23
+
24
+ <BaseLayout class="post-page" description={postData?.description || desc}>
25
+ <Fragment slot="head-end">
26
+ <script
27
+ is:inline
28
+ async
29
+ src="https://cdn.staticfile.org/fancyapps-ui/5.0.20/fancybox/fancybox.umd.min.js"
30
+ ></script>
31
+ <link
32
+ rel="stylesheet"
33
+ href="https://cdn.staticfile.org/fancyapps-ui/5.0.20/fancybox/fancybox.min.css"
34
+ />
35
+ </Fragment>
36
+ <slot name="post-hero" />
37
+ <article class="post-container">
38
+ <main class="post-main">
39
+ <slot />
40
+ {useComments && <PostComment />}
41
+ </main>
42
+ <Aside
43
+ comps={ThemeConfig.postPage.aside.comps}
44
+ stickyComps={ThemeConfig.postPage.aside.stickyComps}
45
+ class="post-aside"
46
+ >
47
+ {toc && <BlogToc toc={toc} />}
48
+ </Aside>
49
+ </article>
50
+ <Fragment slot="body-end">
51
+ <script is:inline>
52
+ Fancybox.bind("[data-fancybox]", {
53
+ closeButton: true,
54
+ Thumbs: {
55
+ type: "modern",
56
+ },
57
+ });
58
+ </script>
59
+ </Fragment>
60
+ </BaseLayout>