minearm-website 0.2.0 → 0.2.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,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { ref, reactive, computed, onMounted, Ref } from "vue";
3
- import Fuse from "fuse.js";
2
+ import { ref, computed, onMounted } from 'vue';
3
+ import Fuse from 'fuse.js';
4
4
 
5
5
  interface Result {
6
6
  content: string;
@@ -8,70 +8,192 @@ interface Result {
8
8
  url: string;
9
9
  }
10
10
 
11
- const fuseOptions = {
11
+ const fuseOptions: Fuse.IFuseOptions<Result> = {
12
12
  isCaseSensitive: false,
13
13
  includeScore: true,
14
14
  includeMatches: true,
15
15
  minMatchCharLength: 1,
16
16
  shouldSort: true,
17
17
  findAllMatches: false,
18
- // location: 0,
19
- // distance: 100,
20
- // ignoreLocation: false,
21
18
  threshold: 0.6,
22
19
  useExtendedSearch: false,
23
20
  ignoreFieldNorm: false,
24
21
  fieldNormWeight: 1,
25
- keys: ["title", "content"],
22
+ keys: ['title', 'content'],
26
23
  };
27
24
 
28
- const keywords = ref("");
29
- const result: Ref<Fuse.FuseResult<Result>[][]> = ref([]);
30
- const pageNumber: Ref<number> = ref(1);
31
- const pageSize: Ref<number> = ref(0);
25
+ const keywords = ref<string>(''); // 搜索关键词
26
+ const result = ref<Fuse.FuseResult<Result>[]>([]); // 搜索结果
27
+ const pageNumber = ref<number>(1); // 当前页码
28
+ const pageSize = ref<number>(10); // 每页显示结果数量
29
+ const totalPages = computed(() => Math.ceil(result.value.length / pageSize.value)); // 总页数
32
30
 
33
- const list = await hsu.getJson("/scripts/searchData.json");
34
- const fuse = new Fuse(list, fuseOptions);
35
- const search = () => {
36
- let tmp: Fuse.FuseResult<Result>[] = fuse.search(keywords.value);
37
- result.value = [];
31
+ let list: Result[] = []; // 原始数据列表
38
32
 
39
- for (let i = 0; i < tmp.length; i += 10) {
40
- result.value.push(tmp.slice(i, i + 10));
33
+ // 异步获取数据
34
+ onMounted(async () => {
35
+ try {
36
+ const response = await fetch('/scripts/searchData.json');
37
+ if (!response.ok) {
38
+ throw new Error('Failed to fetch searchData.json');
39
+ }
40
+ list = await response.json();
41
+ // 初始化搜索,显示所有结果
42
+ search('', 1);
43
+ } catch (error) {
44
+ console.error('Error fetching searchData.json:', error);
41
45
  }
46
+ });
42
47
 
43
- pageNumber.value = 1;
48
+ // 搜索函数
49
+ const search = (query: string, page: number = 1) => {
50
+ if (!query.trim()) {
51
+ result.value = [];
52
+ pageNumber.value = 1;
53
+ return;
54
+ }
55
+
56
+ const fuse = new Fuse(list, fuseOptions);
57
+ const tmp = fuse.search(query);
58
+
59
+ // 计算总页数
60
+ totalPages.value = Math.ceil(tmp.length / pageSize.value);
61
+
62
+ // 分页逻辑
63
+ const start = (page - 1) * pageSize.value;
64
+ const end = start + pageSize.value;
65
+ result.value = tmp.slice(start, end);
44
66
 
45
- pageSize.value = result.value.length;
67
+ // 设置当前页码
68
+ pageNumber.value = page;
46
69
  };
70
+
71
+ // 计算属性:当前页的结果
72
+ const currentPageResults = computed(() => {
73
+ const start = (pageNumber.value - 1) * pageSize.value;
74
+ const end = start + pageSize.value;
75
+ return result.value.slice(start, end);
76
+ });
47
77
  </script>
48
78
 
49
79
  <template>
50
- <input
51
- class="search-input"
52
- type="text"
53
- placeholder=""
54
- v-model="keywords"
55
- @keydown.enter="search"
56
- />
57
- <div class="search-results">
58
- <a
59
- v-if="result.length"
60
- v-for="i in 10"
61
- class="search-result"
62
- :href="result[pageNumber - 1][i - 1]?.item.url"
63
- >{{ result[pageNumber - 1][i - 1]?.item.title }}</a
64
- >
65
- </div>
66
- <div class="search-pagination">
67
- <span
68
- v-for="num in pageSize"
69
- :class="{ 'search-pagenumber': true, active: pageNumber == num }"
70
- @click="pageNumber = num"
71
- >
72
- <span>{{ num }}</span>
73
- </span>
80
+ <div class="search-container">
81
+ <!-- 输入框,绑定回车键事件 -->
82
+ <input
83
+ class="search-input"
84
+ type="text"
85
+ placeholder="请输入搜索关键词..."
86
+ v-model="keywords"
87
+ @keydown.enter="search(keywords, pageNumber)"
88
+ />
89
+ <!-- 搜索结果列表 -->
90
+ <div class="search-results" v-if="currentPageResults.length">
91
+ <a
92
+ v-for="(item, index) in currentPageResults"
93
+ :key="index"
94
+ class="search-result"
95
+ :href="item.item.url"
96
+ target="_blank"
97
+ rel="noopener noreferrer"
98
+ >
99
+ {{ item.item.title }}
100
+ </a>
101
+ </div>
102
+
103
+ <!-- 分页控件 -->
104
+ <div class="search-pagination" v-if="totalPages > 1">
105
+ <span
106
+ v-for="num in Array.from({ length: totalPages }, (_, i) => i + 1)"
107
+ :key="num"
108
+ :class="{ 'search-pagenumber': true, active: pageNumber === num }"
109
+ @click="pageNumber = num"
110
+ >
111
+ {{ num }}
112
+ </span>
113
+ </div>
114
+ <p v-if="currentPageResults.length === 0 && keywords" class="no-results">
115
+ 没有找到相关结果。
116
+ </p>
74
117
  </div>
75
118
  </template>
76
119
 
77
- <style scoped></style>
120
+ <style scoped>
121
+ .search-container {
122
+ max-width: 800px;
123
+ margin: 50px auto;
124
+ padding: 0 20px;
125
+ box-sizing: border-box;
126
+ }
127
+
128
+ .search-input {
129
+ width: 100%;
130
+ padding: 12px 20px;
131
+ font-size: 18px;
132
+ border: 2px solid var(--border-color);
133
+ border-radius: 25px;
134
+ outline: none;
135
+ transition: border-color 0.3s ease;
136
+ }
137
+
138
+ .search-input:focus {
139
+ border-color: var(--button-bg);
140
+ box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
141
+ }
142
+
143
+ .search-results {
144
+ margin-top: 20px;
145
+ }
146
+
147
+ .search-result {
148
+ display: block;
149
+ padding: 15px 0;
150
+ border-bottom: 1px solid var(--border-color);
151
+ transition: background-color 0.3s ease;
152
+ }
153
+
154
+ .search-result a {
155
+ color: var(--text-color);
156
+ text-decoration: none;
157
+ font-size: 18px;
158
+ }
159
+
160
+ .search-result a:hover {
161
+ color: var(--button-bg);
162
+ }
163
+
164
+ .search-pagination {
165
+ margin-top: 30px;
166
+ display: flex;
167
+ justify-content: center;
168
+ gap: 10px;
169
+ }
170
+
171
+ .search-pagenumber {
172
+ padding: 10px 15px;
173
+ border: 2px solid var(--button-bg);
174
+ border-radius: 25px;
175
+ background-color: var(--background-color);
176
+ color: var(--button-text);
177
+ cursor: pointer;
178
+ transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
179
+ }
180
+
181
+ .search-pagenumber:hover {
182
+ background-color: var(--button-bg);
183
+ color: var(--background-color);
184
+ transform: scale(1.05);
185
+ }
186
+
187
+ .search-pagenumber.active {
188
+ background-color: var(--button-bg);
189
+ color: var(--background-color);
190
+ border-color: var(--button-bg);
191
+ font-weight: 700;
192
+ }
193
+
194
+ .no-results {
195
+ margin-top: 20px;
196
+ color: var(--text-color);
197
+ font-style: italic;
198
+ }
199
+ </style>
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  ---
3
-
4
3
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"
5
4
  ><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
6
5
  <path
@@ -15,7 +15,6 @@ interface Props {
15
15
  class?: string;
16
16
  description?: string;
17
17
  }
18
-
19
18
  const { class: pageClass, description } = Astro.props;
20
19
  ---
21
20
 
@@ -4,6 +4,7 @@ import BaseLayout from "@layout/BaseLayout.astro";
4
4
  import BlogToc from "@comp/aside/blogToc.astro";
5
5
  import Aside from "@comp/aside/aside.astro";
6
6
  import PostComment from "@comp/postComment.astro";
7
+ import { ViewTransitions } from 'astro:transitions';
7
8
  import type { CollectionEntry } from "astro:content";
8
9
  import { ThemeConfig } from "@src/theme_config";
9
10
 
@@ -58,3 +59,4 @@ const { toc, useComments = true, postData, desc } = Astro.props;
58
59
  </script>
59
60
  </Fragment>
60
61
  </BaseLayout>
62
+ <ViewTransitions />
@@ -42,3 +42,4 @@ const { tags, baseurl, activeTag, page } = Astro.props;
42
42
  }
43
43
  </Fragment>
44
44
  </HomeLayout>
45
+ <ViewTransitions />
package/src/pages/404.md CHANGED
@@ -6,4 +6,6 @@ heroColor: "#007aff"
6
6
  useComments: false
7
7
  useToc: false
8
8
  ---
9
+ # 404 Not Found
10
+
9
11
  # 404了,非常抱歉,你要找的页面被作者吃了[doge]
@@ -7,11 +7,11 @@ useComments: true
7
7
  useToc: true
8
8
  ---
9
9
  # Minearm & Website
10
- # 本主题是从[HusBlog](https://github.com/KraHsu/HsuBlog.git)改进而来的
11
- 最新的正式版是0.2.0
10
+ # 本主题是从[HsuBlog](https://github.com/KraHsu/HsuBlog.git)改进而来的
11
+ 最新的正式版是0.2.1
12
12
  最新的测试版是0.0.3-beta.4
13
13
 
14
- 但是Minearm & Website做出了很大的改变,比如修复了scss警告和升级astro版本到5.1.10
14
+ 但是Minearm & Website做出了很大的改变,比如修复了scss警告和升级astro版本到5.5.4
15
15
 
16
16
  # 效果
17
17
  ![Minearm](https://portal.astro.build/_image?href=https%3A%2F%2Fstorage.googleapis.com%2Fdev-portal-bucket%2Fkotpt1ztaalrk5frua5pnwdvoh185ylgg0rio9.webp)
@@ -1,5 +1,5 @@
1
1
  ---
2
- import { CollectionEntry, getCollection } from "astro:content";
2
+ import { type CollectionEntry, getCollection } from "astro:content";
3
3
  import PostLayout from "@src/layouts/PostLayout.astro";
4
4
  import HeroWave from "@comp/header/heroWave.astro";
5
5
  import GetIcon from "@comp/icons/getIcon.astro";
@@ -66,3 +66,12 @@ const { Content, remarkPluginFrontmatter } = await post.render();
66
66
  </HeroWave>
67
67
  <Content />
68
68
  </PostLayout>
69
+ <article>
70
+ <!-- 文章正文 -->
71
+ <h1>{post.title}</h1>
72
+ <div>{post.content}</div>
73
+
74
+ <!-- 评论区域 -->
75
+ <div class="comments-section">
76
+ </div>
77
+ </article>
@@ -2,23 +2,25 @@
2
2
  layout: ../../layouts/DefaultMdLayout.astro
3
3
  title: Minearm盟友
4
4
  description: ""
5
- heroColor: "#007aff"
5
+ heroColor: "#00FF99"
6
6
  useComments: true
7
7
  useToc: true
8
8
  ---
9
-
10
9
  ## Minearm-RPM的盟友
11
10
 
12
11
  谁想成为盟友的来[这里](https://github.com/Minearm-RPM/minearm/issues/3)申请一下
13
12
 
14
- :::links[The Autor of Minearm-RPM & Website]
15
-
16
- ::link[纳西妲]{logo="/nahida.png" desc="我会为世界上所有的美好而战" link="https://nahida.im"}
13
+ <h2>或者发评论</h2>
17
14
 
18
- ::link[B站破击]{logo="/pojipao.avif" desc="全互联网最中二的傻逼" link="https://space.bilibili.com/1598534390"}
15
+ - 格式
19
16
 
20
- ::link[এ՞情绪ᮨ℘]{logo="/13.png" desc="明天要被历史肘击😭" link="mailto:2939765322@qq.com"}
17
+ ```yaml
18
+ - name: 名称
19
+ link: 跳转链接
20
+ avatar: 头像链接
21
+ descr: 描述
22
+ ```
21
23
 
22
- ::link[三的根号]{logo="/3.png" desc="√3每日发疯" link="https://space.bilibili.com/1832902560"}
24
+ :::links[The Autor of Minearm-RPM & Website]
23
25
 
24
- ::link[智宇]{logo="https://zhiyuhub.top/upload/be2bb1bb-8d91-4e9b-8b4d-00d4c45774ae.png" desc="root@kali:/#" link="https://zhiyuhub.top/"}
26
+ ::link[Minearm-RPM]{logo="/avatar.avif" desc="localhost@root #~" link="https://www.minearm.org/"}
@@ -18,7 +18,7 @@
18
18
  --astro-code-token-string-expression: #5ccfe6;
19
19
 
20
20
  --astro-code-token-punctuation: #cccac2;
21
-
21
+ //I love kunkun!
22
22
  --astro-code-token-link: #87d96c;
23
23
 
24
24
  --astro-code-color-ansi-black: #000000;
@@ -1,8 +1,8 @@
1
1
  import { Icons } from "@comp/icons/icon";
2
2
  import { SiteConfig } from "./site_config";
3
3
  // import { faStar } from "@fortawesome/free-solid-svg-icons";
4
- // import { library, icon } from "@fortawesome/fontawesome-svg-core";
5
- //import Code from '~/components/code.astro';
4
+ //import { library, icon } from "@fortawesome/fontawesome-svg-core";
5
+ // import Code from '~/components/code.astro';
6
6
  // library.add(faStar);
7
7
  // const starIcon = icon({ prefix: "fas", iconName: "star" });
8
8
 
@@ -17,7 +17,7 @@ export const ThemeConfig: Configs = {
17
17
  localSearch: {
18
18
  enable: true,
19
19
  comment: "你可以使用类似 unix 的格式:[扩展搜索](/blog/Search-help/)",
20
- hits: ["[扩展搜索](/blogSearch-help//)", "[Help](/blog/Search-help/)"],
20
+ hits: ["[扩展搜索](/blog/Search-help/)", "[Help](/blog/Search-help/)"],
21
21
  },
22
22
  backgroundBubbles: 20,
23
23
  },
@@ -65,7 +65,7 @@ export const ThemeConfig: Configs = {
65
65
  name: "MC",
66
66
  customClass: "MC",
67
67
  icon: "local:solid.paper-plane",
68
- link: "https://game.minearm.org",
68
+ link: "https://minecraft.minearm.org",
69
69
  },
70
70
  ],
71
71
  },
@@ -118,7 +118,7 @@ export const ThemeConfig: Configs = {
118
118
  announcement: {
119
119
  headline: "看公告啦!",
120
120
  content:
121
- "欢迎各位[找茬](https://github.com/Minearm-RPM/minearm-rpm-arch/issues)~",
121
+ "欢迎各位[找茬](https://github.com/Minearm-RPM/Minearm/issues)~",
122
122
  },
123
123
  siteInfo: {
124
124
  busuanzi: false,
@@ -137,8 +137,6 @@ export const ThemeConfig: Configs = {
137
137
  footer: {
138
138
  text: "Design & Build with ❤ by Minearm-RPM",
139
139
  copyright: `&copy; 2023-${today.getFullYear()} By [Minearm-RPM](/about)`,
140
- // 也可以使用 {{}} 包裹函数体,并返回替换值
141
- // You can also use {{}} to wrap the function body and return the replacement value.
142
140
  // copyright: `&copy; 2023-{{const today = new Date();return today.getFullYear();}} By [Minearm-RPM](/about)`,
143
141
  },
144
142
  homePage: {
@@ -168,11 +166,11 @@ export const ThemeConfig: Configs = {
168
166
  // envId: "",
169
167
  // lang: "zh-CN",
170
168
  // },
171
- type: "waline",
172
- options: {
173
- serverURL: "https://youserver",
174
- },
175
- //type: true,
176
- //options: null,
169
+ type: "waline",
170
+ options: {
171
+ serverURL: "https://comments.example.com/",
172
+ },
173
+ // type: false,
174
+ // options: null,
177
175
  },
178
176
  };
package/tsconfig.json CHANGED
@@ -1,32 +1,22 @@
1
1
  {
2
- "ts-node": {
3
- "esm": true
4
- },
5
2
  "extends": "astro/tsconfigs/strict",
6
3
  "compilerOptions": {
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "moduleResolution": "node",
7
7
  "resolveJsonModule": true,
8
8
  "baseUrl": ".",
9
9
  "strictNullChecks": true,
10
10
  "jsx": "preserve",
11
11
  "paths": {
12
- "@comp/*": [
13
- "src/components/*"
14
- ],
15
- "@ass/*": [
16
- "src/assets/*"
17
- ],
18
- "@style/*": [
19
- "src/styles/*"
20
- ],
21
- "@src/*": [
22
- "src/*"
23
- ],
24
- "@utils/*": [
25
- "src/utils/*"
26
- ],
27
- "@layout/*": [
28
- "src/layouts/*"
29
- ]
30
- }
31
- }
12
+ "@comp/*": ["src/components/*"],
13
+ "@ass/*": ["src/assets/*"],
14
+ "@style/*": ["src/styles/*"],
15
+ "@src/*": ["src/*"],
16
+ "@utils/*": ["src/utils/*"],
17
+ "@layout/*": ["src/layouts/*"]
18
+ },
19
+ "allowSyntheticDefaultImports": true
20
+ },
21
+ "include": ["src"]
32
22
  }
package/.hintrc DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": [
3
- "development"
4
- ],
5
- "hints": {
6
- "compat-api/css": [
7
- "default",
8
- {
9
- "ignore": [
10
- "backdrop-filter",
11
- "user-select"
12
- ]
13
- }
14
- ]
15
- }
16
- }
package/public/13.jpg DELETED
Binary file
package/public/13.png DELETED
Binary file
Binary file
package/public/3.png DELETED
Binary file
package/public/404.png DELETED
Binary file
package/public/5.jpg DELETED
Binary file
package/public/avatar.jpg DELETED
Binary file
package/public/c++1.png DELETED
Binary file
package/public/logo.png DELETED
Binary file
package/public/nahida.png DELETED
Binary file
Binary file
package/public/video.png DELETED
Binary file
package/public/xmrig.jpg DELETED
Binary file
@@ -1,15 +0,0 @@
1
- ---
2
- title: Mail
3
- description: ''
4
- pubDate: 2024-09-30
5
- heroColor: ''
6
- abbrlink: mail
7
- cover: "/mail.png"
8
- coverAlt: "mail"
9
- tags:
10
- - 'Tutorial'
11
- category: 'Mail'
12
- ---
13
-
14
- ## Mali
15
- minearm@minearm.org
@@ -1,42 +0,0 @@
1
- ---
2
- import HeroWave from "@comp/header/heroWave.astro";
3
- import PostLayout from "@src/layouts/h.astro";
4
- import { ThemeConfig } from "@src/theme_config";
5
- interface FrontMatter {
6
- title: string;
7
- description?: string;
8
- heroColor?: string;
9
- useComments?: boolean;
10
- useToc?: boolean;
11
- toc?: {
12
- level: string;
13
- id: string;
14
- value: string;
15
- }[];
16
- file: string;
17
- url: string;
18
- }
19
-
20
- interface Props {
21
- frontmatter: FrontMatter;
22
- }
23
-
24
- const { frontmatter } = Astro.props;
25
- ---
26
-
27
- <PostLayout
28
- useComments={frontmatter.useComments && ThemeConfig.comments.type !== false}
29
- toc={frontmatter.useToc ? frontmatter.toc : undefined}
30
- desc={frontmatter.description}
31
- >
32
- <HeroWave
33
- class="post-header"
34
- slot="post-hero"
35
- heroColor={frontmatter.heroColor}
36
- >
37
- <div class="post-info">
38
- <h1 class="post-title">{frontmatter.title}</h1>
39
- </div>
40
- </HeroWave>
41
- <slot />
42
- </PostLayout>
@@ -1,60 +0,0 @@
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>