valaxy-theme-yun 0.20.0-beta.10 → 0.20.0-beta.12

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.
@@ -38,7 +38,7 @@ watch(() => [yun.rightSidebar.isOpen, yun.size.isXl], async () => {
38
38
  overflow="auto"
39
39
  >
40
40
  <Transition name="fade" :delay="100">
41
- <div v-show="show" class="w-full" flex="~ col">
41
+ <div v-show="show" class="w-full" flex="~ col" pb-2>
42
42
  <template v-if="showToc">
43
43
  <h2
44
44
  m="t-6 b-2"
@@ -11,6 +11,7 @@ const props = defineProps<{
11
11
  const tagRef = ref<HTMLElement>()
12
12
  useYunSpringAnimation(tagRef, {
13
13
  i: props.i || 0,
14
+ delay: 25,
14
15
  })
15
16
  </script>
16
17
 
@@ -5,16 +5,17 @@ defineProps<{
5
5
  </script>
6
6
 
7
7
  <template>
8
- <div class="yun-notice m-auto">
9
- <span v-html="content" />
10
- <slot />
8
+ <div class="w-full px-4 flex-center">
9
+ <div class="yun-notice w-full">
10
+ <span v-html="content" />
11
+ <slot />
12
+ </div>
11
13
  </div>
12
14
  </template>
13
15
 
14
16
  <style>
15
17
  .yun-notice {
16
18
  border: 1px solid var(--va-c-text);
17
- width: calc(100% - 2rem);
18
19
  display: flex;
19
20
  flex-direction: column;
20
21
  justify-content: center;
@@ -23,6 +24,6 @@ defineProps<{
23
24
  font-weight: bold;
24
25
  padding: 1rem;
25
26
  max-width: var(--yun-post-card-max-width);
26
- background-color: rgba(200, 200, 200, 0.1);
27
+ background-color: rgb(200 200 200 / 0.1);
27
28
  }
28
29
  </style>
@@ -16,6 +16,10 @@ const { curPage, totalPages, showPage, getTo, surLen, prevTo, nextTo, showPrev,
16
16
  total: props.total,
17
17
  pageSize: props.pageSize,
18
18
  })
19
+
20
+ defineExpose({
21
+ curPage,
22
+ })
19
23
  </script>
20
24
 
21
25
  <template>
@@ -52,12 +52,12 @@ const { icon, styles } = usePostProperty(props.post.type)
52
52
  </div>
53
53
  <!-- <div m="b-5" /> -->
54
54
 
55
- <div v-if="post.excerpt" w="full" h="10" class="absolute bottom-0 bg-gradient-to-t from-$va-c-bg-light to-transparent z-1" />
55
+ <YunExcerptBottomGradient v-if="post.excerpt" />
56
56
 
57
57
  <a
58
58
  v-if="post.url"
59
59
  :href="post.url"
60
- class="post-link-btn shadow hover:shadow-md"
60
+ class="post-link-btn shadow hover:shadow-md z-2"
61
61
  rounded
62
62
  target="_blank"
63
63
  m="b-4"
@@ -1,15 +1,15 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
2
+ import { computed, ref } from 'vue'
3
3
  import { useSiteConfig, useSiteStore } from 'valaxy'
4
4
  import type { Post } from 'valaxy/types'
5
5
 
6
6
  const props = withDefaults(defineProps<{
7
7
  type?: string
8
8
  posts?: Post[]
9
- curPage?: number
10
- }>(), {
11
- curPage: 1,
12
- })
9
+ }>(), {})
10
+
11
+ const paginationRef = ref()
12
+ const curPage = computed(() => paginationRef.value?.curPage || 1)
13
13
 
14
14
  const site = useSiteStore()
15
15
  const siteConfig = useSiteConfig()
@@ -21,8 +21,8 @@ const posts = computed(() => (
21
21
 
22
22
  const displayedPosts = computed(() =>
23
23
  posts.value.slice(
24
- (props.curPage - 1) * pageSize.value,
25
- props.curPage * pageSize.value,
24
+ (curPage.value - 1) * pageSize.value,
25
+ curPage.value * pageSize.value,
26
26
  ),
27
27
  )
28
28
  </script>
@@ -39,6 +39,7 @@ const displayedPosts = computed(() =>
39
39
  </div>
40
40
 
41
41
  <YunPagination
42
+ ref="paginationRef"
42
43
  class="mt-5"
43
44
  :total="posts.length" :page-size="pageSize"
44
45
  />
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div
7
7
  flex="~ col"
8
- class="justify-center items-center absolute bottom-5 md:bottom-12 left-0 right-0"
8
+ class="justify-center items-center absolute bottom-$rect-margin left-0 right-0"
9
9
  >
10
10
  <PrologueSocialLinks />
11
11
  </div>
@@ -1,16 +1,19 @@
1
1
  <script setup lang="ts">
2
2
  // 播放完销毁 css 动画
3
+ import { sleep } from 'valaxy'
3
4
  import { onMounted, ref } from 'vue'
4
5
 
5
6
  const props = defineProps<{
7
+ delay: number
6
8
  duration: number
7
9
  }>()
8
10
 
9
- const destroy = ref(false)
10
- onMounted(() => {
11
- setTimeout(() => {
12
- destroy.value = true
13
- }, props.duration)
11
+ const destroy = ref(true)
12
+ onMounted(async () => {
13
+ await sleep(props.delay)
14
+ destroy.value = false
15
+ await sleep(props.duration)
16
+ destroy.value = true
14
17
  })
15
18
  </script>
16
19
 
@@ -7,6 +7,7 @@ const siteConfig = useSiteConfig()
7
7
  <template>
8
8
  <img
9
9
  class="rounded-full size-full"
10
- :src="siteConfig.author.avatar" alt="avatar"
10
+ :src="siteConfig.author.avatar"
11
+ alt="avatar"
11
12
  >
12
13
  </template>
@@ -1,64 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { useMotion } from '@vueuse/motion'
3
2
  import { ref } from 'vue'
4
- import { cubicBezier } from '../../client/constants'
5
3
  import { useThemeConfig } from '../../composables'
6
4
 
7
5
  const themeConfig = useThemeConfig()
8
6
 
9
7
  const showContent = ref(false)
10
- const avatarRef = ref<HTMLElement>()
11
- const motionInstance = useMotion(avatarRef, {
12
- initial: {
13
- borderRadius: '0%',
14
- width: 'var(--total-char-height)',
15
- height: 'var(--total-char-height)',
16
- rotate: 135,
17
- y: '0%',
18
- },
19
- enter: {
20
- borderRadius: '50%',
21
- rotate: 0,
22
- y: '0%',
23
- width: '120px',
24
- height: '120px',
25
- boxShadow: 'none',
26
- transition: {
27
- type: 'keyframes',
28
- ease: cubicBezier.easeIn,
29
- duration: 800,
30
- onComplete: () => {
31
- motionInstance.variant.value = 'leave'
32
- showContent.value = true
33
- },
34
- },
35
- },
36
- leave: {
37
- // y: '-50%',
38
- boxShadow: '0 5px 100px rgba(0, 0, 0, 0.15)',
39
- transition: {
40
- type: 'keyframes',
41
- ease: cubicBezier.easeInOut,
42
- duration: 500,
43
- },
44
- },
45
- })
46
-
47
- const introRef = ref<HTMLElement>()
48
- useMotion(introRef, {
49
- initial: {
50
- y: '0%',
51
- },
52
- enter: {
53
- y: 'calc(-50%)',
54
- transition: {
55
- delay: 800,
56
- type: 'keyframes',
57
- ease: cubicBezier.easeInOut,
58
- duration: 400,
59
- },
60
- },
61
- })
62
8
  </script>
63
9
 
64
10
  <template>
@@ -72,69 +18,77 @@ useMotion(introRef, {
72
18
  <slot />
73
19
 
74
20
  <div
75
- ref="introRef"
76
21
  flex="~ col center"
77
- class="info relative"
22
+ class="info relative duration-800 transition-cubic-bezier-ease-in"
23
+ :class="{
24
+ 'translate-y--1/2': showContent,
25
+ }"
78
26
  >
79
- <div
80
- ref="avatarRef" flex="~ col" class="absolute yun-square bg-$va-c-text square-rotate w-full"
27
+ <Transition
28
+ enter-from-class="enter-from"
29
+ enter-to-class="enter-to"
30
+ appear
31
+ @after-appear="showContent = true"
81
32
  >
82
- <LineBurstEffects
83
- class="absolute top-0 left-0 right-0 bottom-0 size-full scale-200"
84
- :duration="800"
85
- />
86
- <YunAuthorAvatar />
87
- </div>
33
+ <div
34
+ flex="~ col"
35
+ class="absolute yun-square bg-$va-c-text square-rotate w-full z-1"
36
+ >
37
+ <LineBurstEffects
38
+ class="absolute top-0 left-0 right-0 bottom-0 size-full scale-200"
39
+ :delay="1000"
40
+ :duration="600"
41
+ />
42
+ <Transition
43
+ enter-from-class="op-0"
44
+ enter-to-class="op-100"
45
+ enter-active-class="transition-400 delay-400"
46
+ appear
47
+ >
48
+ <YunAuthorAvatar />
49
+ </Transition>
50
+ </div>
51
+ </Transition>
88
52
 
89
- <div
90
- v-if="showContent"
91
- v-motion
92
- :initial="{
93
- opacity: 0,
94
- y: '0',
95
- }"
96
- :enter="{
97
- opacity: 1,
98
- y: 'calc(50% + 60px)',
99
- transition: {
100
- type: 'keyframes',
101
- ease: cubicBezier.easeInOut,
102
- duration: 400,
103
- },
104
- }"
53
+ <Transition
54
+ enter-from-class="translate-y-0"
55
+ enter-active-class="duration-800 transition-cubic-bezier-ease-in"
56
+ appear
105
57
  >
106
- <YunAuthorName class="mt-3" />
107
- <YunAuthorIntro />
58
+ <div v-if="showContent" class="translate-y-[calc(50%+50px)] animate-fade-in">
59
+ <YunAuthorName class="mt-3" />
60
+ <YunAuthorIntro />
108
61
 
109
- <YunDivider />
62
+ <YunDivider />
110
63
 
111
- <div flex="~ col" class="gap-2 items-center justify-center">
112
- <YunSiteTitle />
113
- <YunSiteSubtitle />
114
- <YunSiteDescription />
115
- </div>
64
+ <div flex="~ col" class="gap-2 items-center justify-center">
65
+ <YunSiteTitle />
66
+ <YunSiteSubtitle />
67
+ <YunSiteDescription />
68
+ </div>
116
69
 
117
- <YunDivider />
70
+ <YunDivider />
118
71
 
119
- <div
120
- class="mt-4 flex-center w-50 md:w-100 m-auto gap-2"
121
- flex="~ wrap"
122
- p="x-$rect-margin"
123
- >
124
- <YunSiteLinkItem
125
- :page="{
126
- name: '博客文章',
127
- icon: 'i-ri-article-line',
128
- url: '/posts/',
129
- }"
130
- />
131
- <slot />
132
- <YunSiteLinkItem
133
- v-for="item, i in themeConfig.pages"
134
- :key="i" :page="item"
135
- />
72
+ <div
73
+ class="mt-4 flex-center w-64 md:w-100 m-auto gap-2"
74
+ flex="~ wrap"
75
+ p="x-$rect-margin"
76
+ >
77
+ <YunSiteLinkItem
78
+ :page="{
79
+ name: '博客文章',
80
+ icon: 'i-ri-article-line',
81
+ url: '/posts/',
82
+ }"
83
+ />
84
+ <slot />
85
+ <YunSiteLinkItem
86
+ v-for="item, i in themeConfig.pages"
87
+ :key="i" :page="item"
88
+ />
89
+ </div>
136
90
  </div>
137
- </div>
91
+ </Transition>
138
92
  </div>
139
93
  </div>
140
94
  </template>
@@ -142,4 +96,21 @@ useMotion(introRef, {
142
96
  <style lang="scss">
143
97
  @use 'sass:map';
144
98
  @use 'valaxy-theme-yun/styles/vars.scss' as *;
99
+
100
+ .yun-square {
101
+ transition: all 0.8s map.get($cubic-bezier, 'ease-in');
102
+ border-radius: 50%;
103
+ transform: rotate(0deg) translateY(0%);
104
+ width: 100px;
105
+ height: 100px;
106
+ box-shadow: 0 5px 100px rgb(0 0 0 / 0.15);
107
+
108
+ &.enter-from {
109
+ border-radius: 0%;
110
+ width: var(--total-char-height);
111
+ height: var(--total-char-height);
112
+ transform: rotate(135deg) translateY(0%);
113
+ box-shadow: none;
114
+ }
115
+ }
145
116
  </style>
@@ -36,7 +36,7 @@ onMounted(() => {
36
36
 
37
37
  .yun-ae-frame {
38
38
  --corner-size: 40px;
39
- --corner-margin: 10px;
39
+ --corner-margin: 8px;
40
40
  --corner-border-size: 3px;
41
41
 
42
42
  div {
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <div
3
+ w="full" h="10"
4
+ class="absolute bottom-0 bg-gradient-to-t from-$va-c-bg-light to-transparent z-1"
5
+ />
6
+ </template>
@@ -12,6 +12,10 @@ export function useYunSpringAnimation(target: MaybeRef<HTMLElement | undefined>,
12
12
  i: number
13
13
  y?: number
14
14
  duration?: number
15
+ /**
16
+ * delay in ms
17
+ */
18
+ delay?: number
15
19
  }) {
16
20
  useMotion(target, {
17
21
  initial: {
@@ -22,7 +26,7 @@ export function useYunSpringAnimation(target: MaybeRef<HTMLElement | undefined>,
22
26
  opacity: 1,
23
27
  y: 0,
24
28
  transition: {
25
- delay: options.i * 50,
29
+ delay: options.i * (options.delay || 50),
26
30
  type: 'spring',
27
31
  ease: cubicBezier.easeIn,
28
32
  damping: 8,
package/layouts/home.vue CHANGED
@@ -16,7 +16,7 @@ const showNotice = computed(() => {
16
16
 
17
17
  <template>
18
18
  <YunLayoutWrapper
19
- class="items-center flex-col"
19
+ class="items-center flex-col"
20
20
  :class="{
21
21
  'mt-0!': !isPage,
22
22
  }"
@@ -29,7 +29,7 @@ const showNotice = computed(() => {
29
29
 
30
30
  <YunNotice
31
31
  v-if="showNotice"
32
- class="mb-10"
32
+ class="mb-2 md:mb-6"
33
33
  :class="{
34
34
  'mt-4': !isPage,
35
35
  }"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
3
  "type": "module",
4
- "version": "0.20.0-beta.10",
4
+ "version": "0.20.0-beta.12",
5
5
  "author": {
6
6
  "email": "me@yunyoujun.cn",
7
7
  "name": "YunYouJun",
@@ -4,6 +4,14 @@
4
4
  @use 'sass:map';
5
5
  @use '../vars.scss' as *;
6
6
 
7
+ .transition-cubic-bezier-ease-in {
8
+ transition-timing-function: map.get($cubic-bezier, 'ease-in');
9
+ }
10
+
11
+ .transition-cubic-bezier-ease-in-out {
12
+ transition-timing-function: map.get($cubic-bezier, 'ease-in-out');
13
+ }
14
+
7
15
  .v-enter-active,
8
16
  .v-leave-active {
9
17
  transition: opacity .2s map.get($cubic-bezier, 'ease-in');
@@ -26,7 +26,7 @@ html.dark {
26
26
  // animation
27
27
  @media screen and (width <= 768px) {
28
28
  :root {
29
- --rect-margin: 20px;
29
+ --rect-margin: 16px;
30
30
  }
31
31
  }
32
32