@sugarat/theme 0.5.11 → 0.5.12-beta.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.
Files changed (49) hide show
  1. package/node.d.ts +2 -4
  2. package/node.js +206 -156
  3. package/node.mjs +205 -154
  4. package/package.json +10 -15
  5. package/src/components/Alert.vue +269 -0
  6. package/src/components/Avatar.vue +65 -0
  7. package/src/components/BlogAlert.vue +8 -8
  8. package/src/components/BlogApp.vue +5 -8
  9. package/src/components/BlogArticleAnalyze.vue +99 -66
  10. package/src/components/BlogAuthor.vue +13 -15
  11. package/src/components/BlogBackToTop.vue +21 -24
  12. package/src/components/BlogButtonAfterArticle.vue +12 -15
  13. package/src/components/BlogCommentWrapper.vue +34 -41
  14. package/src/components/BlogDocCover.vue +1 -1
  15. package/src/components/BlogFooter.vue +26 -32
  16. package/src/components/BlogFriendLink.vue +91 -73
  17. package/src/components/BlogHomeBanner.vue +25 -31
  18. package/src/components/BlogHomeHeaderAvatar.vue +16 -23
  19. package/src/components/BlogHomeInfo.vue +2 -4
  20. package/src/components/BlogHomeOverview.vue +12 -15
  21. package/src/components/BlogHomeTags.vue +22 -31
  22. package/src/components/BlogHotArticle.vue +69 -80
  23. package/src/components/BlogImagePreview.vue +3 -3
  24. package/src/components/BlogItem.vue +14 -23
  25. package/src/components/BlogList.vue +15 -19
  26. package/src/components/BlogRecommendArticle.vue +56 -72
  27. package/src/components/BlogSidebar.vue +1 -1
  28. package/src/components/Button.vue +150 -0
  29. package/src/components/Carousel.vue +249 -0
  30. package/src/components/CarouselItem.vue +139 -0
  31. package/src/components/CommentArtalk.vue +1 -1
  32. package/src/components/Image.vue +33 -0
  33. package/src/components/ImageViewer.vue +407 -0
  34. package/src/components/Pagination.vue +369 -0
  35. package/src/components/Tag.vue +144 -0
  36. package/src/components/UserWorks.vue +132 -175
  37. package/src/composables/config/blog.ts +6 -1
  38. package/src/composables/config/index.ts +2 -2
  39. package/src/index.ts +12 -19
  40. package/src/node.ts +0 -3
  41. package/src/styles/el-base.css +340 -0
  42. package/src/styles/{index.scss → index.css} +56 -91
  43. package/src/utils/client/index.ts +17 -0
  44. package/src/utils/node/mdPlugins.ts +1 -1
  45. package/src/utils/node/theme.ts +5 -2
  46. package/src/utils/node/vitePlugins.ts +51 -18
  47. package/src/styles/scss/algolia.scss +0 -231
  48. package/src/styles/scss/global.scss +0 -156
  49. package/src/styles/scss/highlight.scss +0 -12
@@ -25,33 +25,26 @@ useHoverSpin(imgRef, home?.value?.hoverSpin)
25
25
  </div>
26
26
  </template>
27
27
 
28
- <style lang="scss" scoped>
28
+ <style scoped>
29
29
  .blog-home-header-avatar {
30
- padding-top: 40px;
31
- display: flex;
32
- align-items: center;
33
-
34
- img {
35
- display: block;
36
- margin: 0 auto;
37
- width: 130px;
38
- height: 130px;
39
- border-radius: 50%;
40
- background-color: transparent;
41
- border: 5px solid rgba(var(--bg-gradient-home));
42
- box-sizing: border-box;
43
- cursor: pointer;
44
- }
45
-
46
- // img:hover {
47
- // transform: rotate(666turn);
48
- // transition-duration: 59s;
49
- // transition-timing-function: cubic-bezier(.34, 0, .84, 1)
50
- // }
30
+ padding-top: 40px;
31
+ display: flex;
32
+ align-items: center;
33
+ }
34
+ .blog-home-header-avatar img {
35
+ display: block;
36
+ margin: 0 auto;
37
+ width: 130px;
38
+ height: 130px;
39
+ border-radius: 50%;
40
+ background-color: transparent;
41
+ border: 5px solid rgba(var(--bg-gradient-home));
42
+ box-sizing: border-box;
43
+ cursor: pointer;
51
44
  }
52
45
 
53
46
  @media screen and (min-width: 768px) {
54
- .blog-home-header-avatar{
47
+ .blog-home-header-avatar {
55
48
  display: none;
56
49
  }
57
50
  }
@@ -14,16 +14,14 @@ import BlogFriendLink from './BlogFriendLink.vue'
14
14
  <BlogHotArticle />
15
15
 
16
16
  <!-- 友链 -->
17
- <ClientOnly>
18
- <BlogFriendLink />
19
- </ClientOnly>
17
+ <BlogFriendLink />
20
18
 
21
19
  <!-- 标签 -->
22
20
  <BlogHomeTags />
23
21
  </div>
24
22
  </template>
25
23
 
26
- <style lang="scss" scoped>
24
+ <style scoped>
27
25
  .blog-info {
28
26
  display: flex;
29
27
  flex-direction: column;
@@ -60,7 +60,7 @@ const titles = computed(() => (frontmatter.value?.blog?.analysis?.articles?.titl
60
60
  </div>
61
61
  </template>
62
62
 
63
- <style lang="scss" scoped>
63
+ <style scoped>
64
64
  .card {
65
65
  position: relative;
66
66
  margin: 0 auto 10px;
@@ -74,10 +74,9 @@ const titles = computed(() => (frontmatter.value?.blog?.analysis?.articles?.titl
74
74
  background-color: rgba(var(--bg-gradient));
75
75
  display: flex;
76
76
  flex-direction: column;
77
-
78
- &:hover {
79
- box-shadow: var(--box-shadow-hover);
80
- }
77
+ }
78
+ .card:hover {
79
+ box-shadow: var(--box-shadow-hover);
81
80
  }
82
81
 
83
82
  .overview-data {
@@ -101,15 +100,13 @@ const titles = computed(() => (frontmatter.value?.blog?.analysis?.articles?.titl
101
100
  align-items: center;
102
101
  position: relative;
103
102
  margin: 0 10px;
104
-
105
- .count {
106
- font-size: 18px;
107
- }
108
-
109
- .label {
110
- margin-top: 6px;
111
- font-size: 12px;
112
- color: var(--description-font-color);
113
- }
103
+ }
104
+ .overview-item .count {
105
+ font-size: 18px;
106
+ }
107
+ .overview-item .label {
108
+ margin-top: 6px;
109
+ font-size: 12px;
110
+ color: var(--description-font-color);
114
111
  }
115
112
  </style>
@@ -1,7 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, watch } from 'vue'
3
- import { ElTag } from 'element-plus'
4
- import { useBrowserLocation, useDark, useUrlSearchParams } from '@vueuse/core'
3
+ import { useBrowserLocation, useUrlSearchParams } from '@vueuse/core'
5
4
  import { useRoute, useRouter } from 'vitepress'
6
5
  import {
7
6
  useActiveTag,
@@ -10,6 +9,7 @@ import {
10
9
  useHomeTagsConfig,
11
10
  } from '../composables/config/blog'
12
11
  import { tagsSvgStr } from '../constants/svg'
12
+ import Tag from './Tag.vue'
13
13
 
14
14
  const route = useRoute()
15
15
  const docs = useArticles()
@@ -25,12 +25,6 @@ const tags = computed(() => {
25
25
 
26
26
  const activeTag = useActiveTag()
27
27
 
28
- const isDark = useDark({
29
- storageKey: 'vitepress-theme-appearance'
30
- })
31
-
32
- const colorMode = computed(() => (isDark.value ? 'light' : 'dark'))
33
-
34
28
  const tagType: any = ['', 'info', 'success', 'warning', 'danger']
35
29
  const currentPage = useCurrentPageNum()
36
30
  const router = useRouter()
@@ -88,28 +82,28 @@ watch(
88
82
  <!-- 头部 -->
89
83
  <div class="card-header">
90
84
  <span class="title svg-icon" v-html="title" />
91
- <ElTag
92
- v-if="activeTag.label" :type="activeTag.type || 'primary'" :effect="colorMode" closable
85
+ <Tag
86
+ v-if="activeTag.label" :type="activeTag.type || 'primary'" closable
93
87
  @close="handleCloseTag"
94
88
  >
95
89
  {{ activeTag.label }}
96
- </ElTag>
90
+ </Tag>
97
91
  </div>
98
92
  <!-- 标签列表 -->
99
93
  <ul class="tag-list">
100
94
  <li v-for="(tag, idx) in tags" :key="tag">
101
- <ElTag
102
- :type="tagType[idx % tagType.length] || 'primary'" :effect="colorMode"
95
+ <Tag
96
+ :type="tagType[idx % tagType.length] || 'primary'"
103
97
  @click="handleTagClick(tag, tagType[idx % tagType.length])"
104
98
  >
105
99
  {{ tag }}
106
- </ElTag>
100
+ </Tag>
107
101
  </li>
108
102
  </ul>
109
103
  </div>
110
104
  </template>
111
105
 
112
- <style lang="scss" scoped>
106
+ <style scoped>
113
107
  .card {
114
108
  position: relative;
115
109
  margin: 0 auto 10px;
@@ -122,10 +116,9 @@ watch(
122
116
  transition: all 0.3s;
123
117
  background-color: rgba(var(--bg-gradient));
124
118
  display: flex;
125
-
126
- &:hover {
127
- box-shadow: var(--box-shadow-hover);
128
- }
119
+ }
120
+ .card:hover {
121
+ box-shadow: var(--box-shadow-hover);
129
122
  }
130
123
 
131
124
  .card-header {
@@ -133,12 +126,11 @@ watch(
133
126
  width: 100%;
134
127
  justify-content: space-between;
135
128
  align-items: center;
136
-
137
- .title {
138
- font-size: 12px;
139
- display: flex;
140
- align-items: center;
141
- }
129
+ }
130
+ .card-header .title {
131
+ font-size: 12px;
132
+ display: flex;
133
+ align-items: center;
142
134
  }
143
135
 
144
136
  .tags {
@@ -149,11 +141,10 @@ watch(
149
141
  display: flex;
150
142
  flex-wrap: wrap;
151
143
  margin-top: 10px;
152
-
153
- li {
154
- margin-right: 10px;
155
- margin-bottom: 10px;
156
- cursor: pointer;
157
- }
144
+ }
145
+ .tag-list li {
146
+ margin-right: 10px;
147
+ margin-bottom: 10px;
148
+ cursor: pointer;
158
149
  }
159
150
  </style>
@@ -1,10 +1,10 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, ref } from 'vue'
3
- import { ElButton } from 'element-plus'
4
3
  import { useRouter, withBase } from 'vitepress'
5
4
  import { useArticles, useCleanUrls, useFormatShowDate, useHotArticleConfig, useShowHotArticle } from '../composables/config/blog'
6
5
  import { wrapperCleanUrls } from '../utils/client'
7
6
  import { fireSVG } from '../constants/svg'
7
+ import Button from './Button.vue'
8
8
 
9
9
  const formatShowDate = useFormatShowDate()
10
10
 
@@ -59,9 +59,9 @@ const showChangeBtn = computed(() => {
59
59
  <!-- 头部 -->
60
60
  <div class="card-header">
61
61
  <span class="title svg-icon" v-html="title" />
62
- <ElButton v-if="showChangeBtn" size="small" type="primary" text @click="changePage">
62
+ <Button v-if="showChangeBtn" size="small" type="primary" text @click="changePage">
63
63
  {{ nextText }}
64
- </ElButton>
64
+ </Button>
65
65
  </div>
66
66
  <!-- 文章列表 -->
67
67
  <ol v-if="currentWikiData.length" class="recommend-container">
@@ -98,7 +98,7 @@ const showChangeBtn = computed(() => {
98
98
  </div>
99
99
  </template>
100
100
 
101
- <style lang="scss" scoped>
101
+ <style scoped>
102
102
  .card {
103
103
  position: relative;
104
104
  margin: 0 auto 10px;
@@ -111,10 +111,9 @@ const showChangeBtn = computed(() => {
111
111
  transition: all 0.3s;
112
112
  background-color: rgba(var(--bg-gradient));
113
113
  display: flex;
114
-
115
- &:hover {
116
- box-shadow: var(--box-shadow-hover);
117
- }
114
+ }
115
+ .card:hover {
116
+ box-shadow: var(--box-shadow-hover);
118
117
  }
119
118
 
120
119
  .card-header {
@@ -122,12 +121,11 @@ const showChangeBtn = computed(() => {
122
121
  width: 100%;
123
122
  justify-content: space-between;
124
123
  align-items: center;
125
-
126
- .title {
127
- font-size: 12px;
128
- display: flex;
129
- align-items: center;
130
- }
124
+ }
125
+ .card-header .title {
126
+ font-size: 12px;
127
+ display: flex;
128
+ align-items: center;
131
129
  }
132
130
 
133
131
  .recommend {
@@ -141,72 +139,63 @@ const showChangeBtn = computed(() => {
141
139
  margin: 0;
142
140
  padding: 0 10px 0 0px;
143
141
  width: 100%;
144
-
145
- li {
146
- display: flex;
147
-
148
- &:nth-child(1) .num {
149
- background-color: #f56c6c;
150
- color: #fff;
151
- font-size: 12px;
152
- border-radius: 8px 0 8px 0;
153
- }
154
-
155
- &:nth-child(2) .num {
156
- background-color: #67c23a;
157
- color: #fff;
158
- font-size: 12px;
159
- border-radius: 0 8px 0 8px;
160
- }
161
-
162
- &:nth-child(3) .num {
163
- background-color: var(--vp-c-brand-2);
164
- color: #fff;
165
- font-size: 12px;
166
- border-radius: 6px;
167
- }
168
-
169
- .num {
170
- display: block;
171
- font-size: 14px;
172
- color: var(--description-font-color);
173
- font-weight: 600;
174
- margin: 6px 12px 10px 0;
175
- width: 18px;
176
- height: 18px;
177
- line-height: 18px;
178
- text-align: center;
179
- }
180
-
181
- .des {
182
- overflow: hidden;
183
- text-overflow: ellipsis;
184
- white-space: nowrap;
185
- }
186
-
187
- .title {
188
- font-size: 14px;
189
- color: var(--vp-c-text-1);
190
- font-weight: 500;
191
- position: relative;
192
- cursor: pointer;
193
- }
194
-
195
- .title:hover::after {
196
- content: "";
197
- position: absolute;
198
- left: 0;
199
- right: 0;
200
- height: 0;
201
- bottom: -3px;
202
- border-bottom: 1px solid #b1b3b8;
203
- }
204
-
205
- .suffix {
206
- font-size: 12px;
207
- color: var(--vp-c-text-2);
208
- }
209
- }
142
+ }
143
+ .recommend-container li {
144
+ display: flex;
145
+ }
146
+ .recommend-container li:nth-child(1) .num {
147
+ background-color: #f56c6c;
148
+ color: #fff;
149
+ font-size: 12px;
150
+ border-radius: 8px 0 8px 0;
151
+ }
152
+ .recommend-container li:nth-child(2) .num {
153
+ background-color: #67c23a;
154
+ color: #fff;
155
+ font-size: 12px;
156
+ border-radius: 0 8px 0 8px;
157
+ }
158
+ .recommend-container li:nth-child(3) .num {
159
+ background-color: var(--vp-c-brand-2);
160
+ color: #fff;
161
+ font-size: 12px;
162
+ border-radius: 6px;
163
+ }
164
+ .recommend-container li .num {
165
+ display: block;
166
+ font-size: 14px;
167
+ color: var(--description-font-color);
168
+ font-weight: 600;
169
+ margin: 6px 12px 10px 0;
170
+ width: 18px;
171
+ height: 18px;
172
+ line-height: 18px;
173
+ text-align: center;
174
+ }
175
+ .recommend-container li .des {
176
+ overflow: hidden;
177
+ text-overflow: ellipsis;
178
+ white-space: nowrap;
179
+ }
180
+ .recommend-container li .title {
181
+ font-size: 14px;
182
+ color: var(--vp-c-text-1);
183
+ font-weight: 500;
184
+ position: relative;
185
+ cursor: pointer;
186
+ }
187
+ .recommend-container li .title:hover::after {
188
+ content: "";
189
+ position: absolute;
190
+ left: 0;
191
+ right: 0;
192
+ height: 0;
193
+ bottom: -3px;
194
+ border-bottom: 1px solid #b1b3b8;
195
+ }
196
+ .recommend-container li .suffix {
197
+ font-size: 12px;
198
+ color: var(--vp-c-text-2);
210
199
  }
211
200
 
212
201
  .empty-text {
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { ElImageViewer } from 'element-plus'
3
2
  import { onMounted, onUnmounted, reactive, ref } from 'vue'
3
+ import ImageViewer from './ImageViewer.vue'
4
4
 
5
5
  const show = ref(false)
6
6
  const previewImageInfo = reactive<{ url: string; list: string[]; idx: number }>(
@@ -15,7 +15,7 @@ function previewImage(e: Event) {
15
15
  const currentTarget = e.currentTarget as HTMLElement
16
16
  if (target.tagName.toLowerCase() === 'img') {
17
17
  const imgs = currentTarget.querySelectorAll<HTMLImageElement>(
18
- '.content-container .main img'
18
+ '.content-container .main img,.VPPage img'
19
19
  )
20
20
  const idx = Array.from(imgs).findIndex(el => el === target)
21
21
  const urls = Array.from(imgs).map(el => el.src)
@@ -45,7 +45,7 @@ onUnmounted(() => {
45
45
  </script>
46
46
 
47
47
  <template>
48
- <ElImageViewer
48
+ <ImageViewer
49
49
  v-if="show" :infinite="false" hide-on-click-modal teleported :url-list="previewImageInfo.list"
50
50
  :initial-index="previewImageInfo.idx" @close="show = false"
51
51
  />
@@ -111,7 +111,7 @@ const resultCover = computed(() => {
111
111
  </a>
112
112
  </template>
113
113
 
114
- <style lang="scss" scoped>
114
+ <style scoped>
115
115
  .blog-item .pin {
116
116
  position: absolute;
117
117
  overflow: hidden;
@@ -127,13 +127,11 @@ const resultCover = computed(() => {
127
127
  }
128
128
 
129
129
  .blog-item .pin::before {
130
- content: '';
130
+ content: "";
131
131
  position: absolute;
132
132
  width: 120%;
133
133
  height: 30px;
134
- background-image: linear-gradient(45deg,
135
- var(--blog-theme-color),
136
- var(--blog-theme-color));
134
+ background-image: linear-gradient(45deg, var(--blog-theme-color), var(--blog-theme-color));
137
135
  transform: rotate(-45deg) translateY(-20px);
138
136
  display: flex;
139
137
  align-items: center;
@@ -155,10 +153,9 @@ const resultCover = computed(() => {
155
153
  cursor: pointer;
156
154
  display: flex;
157
155
  flex-direction: column;
158
-
159
- &:hover {
160
- box-shadow: var(--box-shadow-hover);
161
- }
156
+ }
157
+ .blog-item:hover {
158
+ box-shadow: var(--box-shadow-hover);
162
159
  }
163
160
 
164
161
  .info-container {
@@ -181,7 +178,6 @@ const resultCover = computed(() => {
181
178
  color: var(--description-font-color);
182
179
  font-size: 14px;
183
180
  margin-bottom: 8px;
184
- // 多行换行
185
181
  overflow: hidden;
186
182
  text-overflow: ellipsis;
187
183
  display: -webkit-box;
@@ -197,17 +193,14 @@ const resultCover = computed(() => {
197
193
  font-size: 13px;
198
194
  color: var(--badge-font-color);
199
195
  margin-top: 8px;
200
-
201
- .split:not(:last-child) {
202
- &::after {
203
- content: '';
204
- display: inline-block;
205
- width: 1px;
206
- height: 8px;
207
- margin: 0 10px;
208
- background-color: #4e5969;
209
- }
210
- }
196
+ }
197
+ .badge-list .split:not(:last-child)::after {
198
+ content: "";
199
+ display: inline-block;
200
+ width: 1px;
201
+ height: 8px;
202
+ margin: 0 10px;
203
+ background-color: #4e5969;
211
204
  }
212
205
 
213
206
  .cover-img {
@@ -235,11 +228,9 @@ const resultCover = computed(() => {
235
228
  background-size: contain;
236
229
  background-position: center;
237
230
  }
238
-
239
231
  .pc-visible {
240
232
  display: none;
241
233
  }
242
-
243
234
  .mobile-visible {
244
235
  display: block;
245
236
  }
@@ -1,16 +1,16 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, nextTick, watch } from 'vue'
3
- import { ElPagination } from 'element-plus'
4
3
  import { useData, useRoute, useRouter } from 'vitepress'
5
4
  import {
6
5
  useActiveTag,
7
6
  useArticles,
8
7
  useCurrentPageNum,
9
8
  useGlobalAuthor,
10
- useHomeConfig
9
+ useHomeConfig,
11
10
  } from '../composables/config/blog'
12
11
  import type { Theme } from '../composables/config'
13
12
  import BlogItem from './BlogItem.vue'
13
+ import Pagination from './Pagination.vue'
14
14
 
15
15
  const { frontmatter } = useData<Theme.Config>()
16
16
  const globalAuthor = useGlobalAuthor()
@@ -111,11 +111,10 @@ router.onAfterRouteChange = () => {
111
111
  <!-- 解决element-ui bug -->
112
112
  <ClientOnly>
113
113
  <div class="el-pagination-wrapper">
114
- <ElPagination
114
+ <Pagination
115
115
  v-if="wikiList.length >= pageSize"
116
116
  small
117
117
  background
118
- :default-current-page="1"
119
118
  :current-page="currentPage"
120
119
  :page-size="pageSize"
121
120
  :total="filterData.length"
@@ -126,20 +125,17 @@ router.onAfterRouteChange = () => {
126
125
  </ClientOnly>
127
126
  </template>
128
127
 
129
- <style lang="scss" scoped>
130
- .el-pagination-wrapper {
131
- :deep(.el-pagination li.is-active.number) {
132
- background-color: var(--vp-c-brand-2);
133
- }
134
- :deep(.el-pagination button:hover) {
135
- color: var(--vp-c-brand-2);
136
- }
137
-
138
- :deep(.el-pager li:not(.is-active):hover) {
139
- color: var(--vp-c-brand-2);
140
- }
141
- :deep(.el-input__wrapper.is-focus) {
142
- box-shadow: 0 0 0 1px var(--vp-c-brand-2) inset;
143
- }
128
+ <style scoped>
129
+ .el-pagination-wrapper :deep(.sugar-pagination li.is-active.number) {
130
+ background-color: var(--vp-c-brand-2);
131
+ }
132
+ .el-pagination-wrapper :deep(.sugar-pagination button:hover) {
133
+ color: var(--vp-c-brand-2);
134
+ }
135
+ .el-pagination-wrapper :deep(.sugar-pager li:not(.is-active):hover) {
136
+ color: var(--vp-c-brand-2);
137
+ }
138
+ .el-pagination-wrapper :deep(.sugar-input__wrapper:focus-within) {
139
+ box-shadow: 0 0 0 1px var(--vp-c-brand-2) inset;
144
140
  }
145
141
  </style>