valaxy-theme-yun 0.19.13 → 0.20.0-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 (106) hide show
  1. package/App.vue +30 -4
  2. package/client/constants/index.ts +13 -0
  3. package/components/ValaxyMain.vue +48 -52
  4. package/components/YunAside.vue +66 -43
  5. package/components/YunBackToTop.vue +11 -4
  6. package/components/YunBanner.vue +31 -15
  7. package/components/YunBg.vue +2 -0
  8. package/components/YunCard.vue +5 -1
  9. package/components/YunCategories.vue +14 -34
  10. package/components/YunCategory.vue +42 -11
  11. package/components/YunClassifyPopover.vue +59 -0
  12. package/components/YunCloud.vue +5 -10
  13. package/components/YunConfig.vue +2 -19
  14. package/components/YunDebug.vue +47 -0
  15. package/components/YunDock.vue +223 -0
  16. package/components/YunFooter.vue +56 -4
  17. package/components/YunFullscreenMenu.vue +57 -0
  18. package/components/YunGirlItem.vue +98 -0
  19. package/components/YunGirls.vue +2 -73
  20. package/components/YunGoDown.vue +8 -15
  21. package/components/YunLinkItem.vue +62 -0
  22. package/components/YunLinks.vue +15 -47
  23. package/components/YunNavMenu.vue +125 -0
  24. package/components/YunOutline.vue +1 -2
  25. package/components/YunOverlay.vue +31 -0
  26. package/components/YunOverview.vue +2 -74
  27. package/components/YunPageHeader.vue +1 -1
  28. package/components/YunPagination.vue +105 -0
  29. package/components/YunPostCard.vue +32 -3
  30. package/components/YunPostCategories.vue +3 -3
  31. package/components/YunPostCollapse.vue +7 -72
  32. package/components/YunPostCollapseItem.vue +137 -0
  33. package/components/YunPostDateMeta.vue +30 -0
  34. package/components/YunPostList.vue +6 -11
  35. package/components/YunPostMeta.vue +31 -39
  36. package/components/YunPostTags.vue +2 -2
  37. package/components/YunPostsInfo.vue +41 -0
  38. package/components/YunPrologue.vue +24 -0
  39. package/components/YunSearchBtn.vue +8 -6
  40. package/components/YunSelect.vue +1 -11
  41. package/components/YunSidebar.vue +7 -4
  42. package/components/YunSidebarCard.vue +10 -0
  43. package/components/YunSidebarNav.vue +0 -1
  44. package/components/YunSiteInfo.vue +72 -0
  45. package/components/YunSponsor.vue +21 -6
  46. package/components/animation/LineBurstEffects.vue +75 -0
  47. package/components/author/YunAuthorAvatar.vue +12 -0
  48. package/components/author/YunAuthorIntro.vue +11 -0
  49. package/components/author/YunAuthorName.vue +14 -0
  50. package/components/config/YunToggleDark.vue +37 -0
  51. package/components/layout/YunLayoutLeft.vue +12 -0
  52. package/components/layout/YunLayoutRight.vue +21 -0
  53. package/components/layout/YunLayoutWrapper.vue +17 -0
  54. package/components/menu/YunNavMenuItem.vue +22 -0
  55. package/components/menu/YunNavMenuTitle.vue +86 -0
  56. package/components/menu/YunPostClassifyNavItem.vue +30 -0
  57. package/components/page/YunPageHeaderGradient.vue +38 -0
  58. package/components/project/YunProjectCard.vue +94 -0
  59. package/components/project/YunProjectCollection.vue +15 -0
  60. package/components/project/YunProjectLinkItem.vue +60 -0
  61. package/components/project/YunProjectToggleButton.vue +16 -0
  62. package/components/project/YunProjects.vue +48 -0
  63. package/components/prologue/PrologueSocialIcon.vue +58 -0
  64. package/components/prologue/PrologueSocialLinks.vue +16 -0
  65. package/components/prologue/PrologueSquare.vue +144 -0
  66. package/components/prologue/YunAEFrame.vue +155 -0
  67. package/components/prologue/YunAERect.vue +127 -0
  68. package/components/site/YunFullscreenMenuItem.vue +26 -0
  69. package/components/site/YunFullscreenMenuList.vue +19 -0
  70. package/components/site/YunSiteLinkItem.vue +26 -0
  71. package/components/site/YunSiteLinks.vue +19 -0
  72. package/components/site/YunSiteTitle.vue +59 -0
  73. package/components/third/YunWalineMeta.vue +17 -5
  74. package/docs/zh-CN/config.md +0 -3
  75. package/layouts/archives.vue +33 -21
  76. package/layouts/categories.vue +43 -31
  77. package/layouts/default.vue +10 -5
  78. package/layouts/empty.vue +3 -0
  79. package/layouts/home.vue +12 -5
  80. package/layouts/post.vue +23 -20
  81. package/layouts/posts.vue +10 -0
  82. package/layouts/projects.vue +25 -0
  83. package/layouts/tags.vue +45 -41
  84. package/node/config.ts +2 -5
  85. package/package.json +10 -5
  86. package/pages/page/[page].vue +3 -6
  87. package/pages/posts/index.vue +11 -0
  88. package/setup/main.ts +51 -9
  89. package/stores/app.ts +25 -3
  90. package/styles/animations/index.scss +36 -0
  91. package/styles/common/markdown.scss +4 -0
  92. package/styles/css-vars.scss +19 -1
  93. package/styles/global.scss +8 -0
  94. package/styles/index.scss +1 -0
  95. package/styles/layout/index.scss +3 -0
  96. package/styles/modules/prologue.scss +1 -0
  97. package/styles/primevue/index.ts +7 -0
  98. package/styles/primevue/tooltip.scss +55 -0
  99. package/styles/primevue/tooltip.ts +14 -0
  100. package/styles/vars.scss +23 -2
  101. package/styles/widgets/banner.scss +26 -6
  102. package/types/index.d.ts +53 -5
  103. package/types/projects.ts +48 -0
  104. package/unocss.config.ts +1 -1
  105. package/utils/animation.ts +33 -0
  106. package/utils/index.ts +2 -0
package/setup/main.ts CHANGED
@@ -1,21 +1,63 @@
1
- import { defineAppSetup, useAppStore } from 'valaxy'
2
- import { nextTick } from 'vue'
1
+ import { defineAppSetup } from 'valaxy'
2
+ import '../styles/global.scss'
3
+ import { MotionPlugin } from '@vueuse/motion'
4
+
5
+ import PrimeVue from 'primevue/config'
6
+ import AnimateOnScroll from 'primevue/animateonscroll'
7
+ import StyleClass from 'primevue/styleclass'
8
+ import ToastService from 'primevue/toastservice'
9
+
10
+ import primeStyles from '../styles/primevue'
11
+ import '../styles/primevue/tooltip.scss'
3
12
  import { useYunAppStore } from '../stores'
4
13
 
5
14
  export default defineAppSetup((ctx) => {
6
15
  // can do for setup
7
16
 
8
- const { router } = ctx
17
+ const { router, app } = ctx
18
+ // https://motion.vueuse.org/
19
+ app.use(MotionPlugin)
20
+ // primevue
21
+ app.use(PrimeVue, {
22
+ unstyled: true,
23
+ // ripple: true,
24
+
25
+ pt: {
26
+ // tooltip: {
27
+ // arrow: {
28
+ // style: {
29
+ // borderBottomColor: 'var(--p-primary-color)',
30
+ // },
31
+ // },
32
+ // text: '!bg-primary !text-primary-contrast !font-medium',
33
+ // },
34
+ ...primeStyles,
35
+
36
+ dock: {
37
+ root: 'yun-dock',
38
+ list: 'yun-dock-list',
39
+ listContainer: 'yun-dock-list-container',
40
+ item: 'yun-dock-item',
41
+ itemLink: 'yun-dock-item-link',
42
+ },
43
+ },
44
+ })
45
+ app.directive('animateonscroll', AnimateOnScroll)
46
+ app.directive('styleclass', StyleClass)
47
+
48
+ // use floating-vue
49
+ // app.directive('tooltip', Tooltip)
50
+ app.use(ToastService)
51
+
52
+ // app.$primevue.config.ripple = true
53
+
9
54
  router.afterEach(() => {
10
55
  /**
11
56
  * router import order
12
57
  * @see https://pinia.vuejs.org/zh/core-concepts/outside-component-usage.html#single-page-applications
13
58
  */
14
- const appStore = useAppStore()
15
- const yunAppStore = useYunAppStore()
16
- nextTick(() => {
17
- if (appStore.isMobile)
18
- yunAppStore.leftSidebar.close()
19
- })
59
+ const app = useYunAppStore()
60
+ if (app.fullscreenMenu.isOpen)
61
+ app.fullscreenMenu.toggle()
20
62
  })
21
63
  })
package/stores/app.ts CHANGED
@@ -1,11 +1,33 @@
1
1
  import { acceptHMRUpdate, defineStore } from 'pinia'
2
- import { useDynamicLeftSidebar } from 'valaxy'
2
+ import { isClient, useScroll, useToggle } from '@vueuse/core'
3
+ import { useScreenSize } from 'valaxy'
3
4
 
4
5
  export const useYunAppStore = defineStore('yun-app', () => {
5
- const leftSidebar = useDynamicLeftSidebar()
6
+ // 左侧边栏
7
+ const [isLeftSidebarOpen, toggleLeftSidebar] = useToggle()
8
+ // 右侧边栏
9
+ const [isRightSidebarOpen, toggleRightSidebar] = useToggle()
10
+ // 全屏菜单
11
+ const [isFullscreenMenuOpen, toggleFullscreenMenu] = useToggle()
12
+
13
+ // init once
14
+ const size = useScreenSize()
6
15
 
7
16
  return {
8
- leftSidebar,
17
+ size,
18
+ leftSidebar: {
19
+ isOpen: isLeftSidebarOpen,
20
+ toggle: toggleLeftSidebar,
21
+ },
22
+ rightSidebar: {
23
+ isOpen: isRightSidebarOpen,
24
+ toggle: toggleRightSidebar,
25
+ },
26
+ fullscreenMenu: {
27
+ isOpen: isFullscreenMenuOpen,
28
+ toggle: toggleFullscreenMenu,
29
+ },
30
+ scrollY: isClient ? useScroll(window).y : 0,
9
31
  }
10
32
  })
11
33
 
@@ -0,0 +1,36 @@
1
+ // cubic-bezier(0.18, 0.66, 0.05, 0.96)
2
+ // cubic-bezier(0.77, 0, 0.17, 1.02)
3
+
4
+ @use 'sass:map';
5
+ @use '../vars.scss' as *;
6
+
7
+ .v-enter-active,
8
+ .v-leave-active {
9
+ transition: opacity .2s map.get($cubic-bezier, 'ease-in');
10
+ }
11
+
12
+ .v-enter-from,
13
+ .v-leave-to {
14
+ opacity: 0;
15
+ }
16
+
17
+ .fade-enter-active,
18
+ .fade-leave-active {
19
+ opacity: 1;
20
+ transition: opacity 0.5s ease;
21
+ }
22
+
23
+ .fade-enter-from,
24
+ .fade-leave-to {
25
+ opacity: 0;
26
+ }
27
+
28
+ @keyframes fade-in {
29
+ from {
30
+ opacity: 0;
31
+ }
32
+
33
+ to {
34
+ opacity: 1;
35
+ }
36
+ }
@@ -15,6 +15,10 @@
15
15
  .markdown-body {
16
16
  word-wrap: break-word;
17
17
 
18
+ a {
19
+ color: var(--va-c-link);
20
+ }
21
+
18
22
  h1,
19
23
  h2,
20
24
  h3,
@@ -14,6 +14,24 @@
14
14
  @include set-css-var-from-map($light);
15
15
  }
16
16
 
17
- .dark {
17
+ html.dark {
18
18
  @include set-css-var-from-map($dark);
19
+
20
+ // bg
21
+ // gradient
22
+ --va-c-bg: #1a1a1d;
23
+ --va-c-bg-soft: #121215;
24
+ }
25
+
26
+ // animation
27
+ @media screen and (width <= 768px) {
28
+ :root {
29
+ --rect-margin: 20px;
30
+ }
31
+ }
32
+
33
+ @media screen and (width > 768px) {
34
+ :root {
35
+ --rect-margin: 48px;
36
+ }
19
37
  }
@@ -0,0 +1,8 @@
1
+ // global css
2
+
3
+ /**
4
+ * bg transition
5
+ */
6
+ html {
7
+ transition: background-color 0.6s;
8
+ }
package/styles/index.scss CHANGED
@@ -13,3 +13,4 @@ $c-primary: #0078e7 !default;
13
13
  @use 'valaxy/client/styles/components/code.scss' as *;
14
14
  @use 'valaxy/client/styles/components/code-group.scss' as *;
15
15
  @use 'valaxy/client/styles/components/custom-block.scss' as *;
16
+ @use "./animations/index.scss" as *;
@@ -1,3 +1,5 @@
1
+ @use 'sass:map';
2
+ @use 'valaxy-theme-yun/styles/vars.scss' as *;
1
3
  @use "valaxy/client/styles/mixins/index.scss" as *;
2
4
  @use "./post" as *;
3
5
 
@@ -7,4 +9,5 @@ html {
7
9
 
8
10
  .yun-main {
9
11
  transition: padding-left var(--va-transition-duration);
12
+ transition-timing-function: map.get($cubic-bezier, 'ease-in-out');
10
13
  }
@@ -0,0 +1 @@
1
+ // bg-transition
@@ -0,0 +1,7 @@
1
+ import tooltip from './tooltip'
2
+
3
+ export default {
4
+ directives: {
5
+ tooltip,
6
+ },
7
+ }
@@ -0,0 +1,55 @@
1
+ // deprecated
2
+ // use floating-vue
3
+ @use 'sass:map';
4
+ @use 'valaxy-theme-yun/styles/vars.scss' as *;
5
+
6
+ :root {
7
+ --p-overlay-popover-shadow: 0px 4px 6px -1px rgb(0 0 0 / 0.1),0px 2px 4px -2px rgb(0 0 0 / 0.1);
8
+ --p-overlay-popover-border-radius: 4px;
9
+
10
+ // Tooltip
11
+ --p-tooltip-max-width: 12.5rem;
12
+ --p-tooltip-gutter: 0.25rem;
13
+ --p-tooltip-shadow: var(--p-overlay-popover-shadow);
14
+ --p-tooltip-padding: 0.25rem 0.75rem;
15
+ --p-tooltip-border-radius: var(--p-overlay-popover-border-radius);
16
+ --p-tooltip-background: var(--va-c-bg);
17
+ --p-tooltip-color: var(--va-c-text);
18
+ }
19
+
20
+ .yun-tooltip {
21
+ position: absolute;
22
+ display: none;
23
+ max-width: var(--p-tooltip-max-width);
24
+ transform: translateY(-5px);
25
+
26
+ &-top {
27
+ padding: var(--p-tooltip-gutter) 0;
28
+
29
+ .yun-tooltip-arrow {
30
+ margin-left: calc(-1 * var(--p-tooltip-gutter));
31
+ border-width: var(--p-tooltip-gutter) var(--p-tooltip-gutter) 0 var(--p-tooltip-gutter);
32
+ border-top-color: var(--p-tooltip-background);
33
+ border-bottom-color: var(--p-tooltip-background);
34
+ }
35
+ }
36
+
37
+ &-text {
38
+ white-space: pre-line;
39
+ word-break: break-word;
40
+ background: var(--p-tooltip-background);
41
+ color: var(--p-tooltip-color);
42
+ padding: var(--p-tooltip-padding);
43
+ box-shadow: var(--p-tooltip-shadow);
44
+ border-radius: var(--p-tooltip-border-radius);
45
+ }
46
+
47
+ &-arrow {
48
+ position: absolute;
49
+ width: 0;
50
+ height: 0;
51
+ border-color: transparent;
52
+ border-style: solid;
53
+ scale: 2;
54
+ }
55
+ }
@@ -0,0 +1,14 @@
1
+ export default {
2
+ root: {
3
+ class: [
4
+ 'yun-tooltip',
5
+ 'yun-tooltip-top',
6
+ ],
7
+ },
8
+ arrow: {
9
+ class: 'yun-tooltip-arrow',
10
+ },
11
+ text: {
12
+ class: 'yun-tooltip-text',
13
+ },
14
+ }
package/styles/vars.scss CHANGED
@@ -13,6 +13,7 @@ $light: map.merge(
13
13
  $dark: () !default;
14
14
  $dark: map.merge(
15
15
  (
16
+ "bg": red,
16
17
  "bg-img": none,
17
18
  "sidebar-bg-img": none,
18
19
  ),
@@ -31,16 +32,36 @@ $common: map.merge(
31
32
  $z-index: () !default;
32
33
  $z-index: map.merge(
33
34
  (
34
- "toc-btn": 7,
35
+ "select": 6,
35
36
  "cloud": 7,
36
37
  "go-down": 9,
37
38
  "backdrop": 9,
38
39
  "sidebar": 10,
39
40
  "fireworks": 11,
40
- "menu-btn": 20,
41
+ "toc-btn": 11,
41
42
  "go-up-btn": 20,
43
+ "fullscreen-menu": 21,
44
+ "nav-menu": 22,
45
+ "menu-btn": 22,
42
46
  "search-popup": 30,
43
47
  "search-btn": 31,
48
+ "overlay": 32,
49
+ "aside": 33,
50
+ "page-gradient": 34,
51
+ "dock": 999999,
44
52
  ),
45
53
  $z-index
46
54
  );
55
+
56
+ // cubic-bezier
57
+ $cubic-bezier: () !default;
58
+ $cubic-bezier: map.merge(
59
+ (
60
+ // 慢速开始,然后加速
61
+ "ease-in": cubic-bezier(0.18, 0.66, 0.05, 0.96),
62
+ // 慢速开始和结束
63
+ "ease-in-out": cubic-bezier(0.77, 0, 0.17, 1.02),
64
+ ),
65
+ $cubic-bezier
66
+ );
67
+
@@ -1,3 +1,6 @@
1
+ @use 'sass:map';
2
+ @use '../vars.scss' as *;
3
+
1
4
  $banner-animation-duration: 1s;
2
5
  $char-animation-duration: 0.4s;
3
6
 
@@ -11,7 +14,7 @@ $char-animation-duration: 0.4s;
11
14
  justify-content: center;
12
15
  align-items: center;
13
16
  width: 100%;
14
- height: var(--banner-container-height, 100vh);
17
+ height: var(--banner-container-height, calc(100 * var(--vh)));
15
18
  }
16
19
 
17
20
  .banner-char-container {
@@ -40,22 +43,39 @@ $char-animation-duration: 0.4s;
40
43
  background-color: var(--banner-line-color);
41
44
  width: 1px;
42
45
  height: 0;
46
+ }
47
+
48
+ &-bottom {
49
+ flex-direction: column-reverse;
50
+ }
51
+
52
+
53
+
54
+
55
+ }
56
+
57
+ .banner-line {
58
+ &.enter {
43
59
  animation-name: extend-line;
44
60
  animation-duration: var(--line-animation-duration);
45
61
  animation-fill-mode: forwards;
46
- animation-timing-function: ease-in;
62
+ animation-timing-function: map.get($cubic-bezier, "ease-in");
47
63
  animation-iteration-count: 1;
48
64
  }
49
65
 
50
- &-bottom {
51
- flex-direction: column-reverse;
66
+ &.active {
67
+ height: var(--banner-line-height);
52
68
  }
53
69
 
54
- &.active {
70
+ // Exit
71
+ &.exit {
55
72
  animation-name: extend-line;
56
73
  animation-duration: var(--line-animation-duration);
57
74
  animation-fill-mode: forwards;
58
- animation-timing-function: ease-in;
75
+
76
+ // reverse
77
+ animation-direction: reverse;
78
+ animation-timing-function: map.get($cubic-bezier, "ease-in-out");
59
79
  animation-iteration-count: 1;
60
80
  }
61
81
  }
package/types/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import type { DefaultTheme } from 'valaxy/types'
2
2
 
3
- export * from '../composables'
4
-
5
3
  export namespace YunTheme {
6
4
  export type Config = ThemeConfig
7
5
  export type Sidebar = any
@@ -27,7 +25,7 @@ export namespace YunTheme {
27
25
  }
28
26
  }
29
27
 
30
- export interface Page {
28
+ export interface PageProps {
31
29
  name: string
32
30
  /**
33
31
  * @description:en-US Page URL
@@ -43,8 +41,9 @@ export interface Page {
43
41
  /**
44
42
  * @description:en-US Color of icon
45
43
  * @description:zh-CN 图标颜色
44
+ * @default 'var(--va-c-text)'
46
45
  */
47
- color: string
46
+ color?: string
48
47
  }
49
48
 
50
49
  /**
@@ -108,6 +107,9 @@ export interface ThemeConfig extends DefaultTheme.Config {
108
107
  * ["Hello, World!", "Bye, World!"]
109
108
  */
110
109
  say: {
110
+ /**
111
+ * @default false
112
+ */
111
113
  enable: boolean
112
114
  api: string
113
115
  hitokoto: {
@@ -130,6 +132,7 @@ export interface ThemeConfig extends DefaultTheme.Config {
130
132
  }
131
133
 
132
134
  /**
135
+ * [@explosions/fireworks](https://www.npmjs.com/package/@explosions/fireworks)
133
136
  * @en - Fireworks when click
134
137
  * @zh - 点击时的烟花效果
135
138
  */
@@ -143,11 +146,16 @@ export interface ThemeConfig extends DefaultTheme.Config {
143
146
  colors?: string[]
144
147
  }
145
148
 
149
+ /**
150
+ * nav items
151
+ * @zh 导航栏 位于页面右上角
152
+ */
153
+ nav?: NavItem[]
146
154
  /**
147
155
  * @en - Pages
148
156
  * @zh - 页面,显示在社交导航栏下方
149
157
  */
150
- pages: Page[]
158
+ pages: PageProps[]
151
159
 
152
160
  sidebar: YunTheme.Sidebar
153
161
 
@@ -221,3 +229,43 @@ export interface ThemeConfig extends DefaultTheme.Config {
221
229
  }
222
230
 
223
231
  export type UserThemeConfig = Partial<ThemeConfig>
232
+
233
+ /**
234
+ * For user links
235
+ */
236
+ export interface LinkType {
237
+ avatar: string
238
+ name: string
239
+ url: string
240
+ color: string
241
+ blog: string
242
+ desc: string
243
+ }
244
+
245
+ export interface NavItemLink {
246
+ icon?: string
247
+ link: string
248
+ text: string
249
+ active?: string
250
+ }
251
+
252
+ export interface NavItemGroup {
253
+ text: string
254
+ items: NavItemLink[]
255
+ }
256
+
257
+ export type NavItem = NavItemLink | NavItemGroup
258
+
259
+ /**
260
+ * girl
261
+ */
262
+ export interface GirlType {
263
+ name: string
264
+ url: string
265
+ avatar: string
266
+ from?: string
267
+ reason?: string
268
+ }
269
+
270
+ export * from '../composables'
271
+ export * from './projects'
@@ -0,0 +1,48 @@
1
+ export interface ProjectItem {
2
+ emoji?: string
3
+ /**
4
+ * 项目名称
5
+ */
6
+ name?: string
7
+ /**
8
+ * 项目描述
9
+ */
10
+ desc?: string
11
+ /**
12
+ * 代表色
13
+ */
14
+ color?: string
15
+ /**
16
+ * 渐变色
17
+ */
18
+ gradient?: boolean
19
+ /**
20
+ * 强制覆盖文本色
21
+ */
22
+ textColor?: string
23
+
24
+ /**
25
+ * 文档链接
26
+ */
27
+ docs?: string
28
+ /**
29
+ * 站点链接
30
+ */
31
+ url?: string
32
+ /**
33
+ * GitHub 仓库
34
+ */
35
+ github?: string
36
+ /**
37
+ * NPM 包
38
+ */
39
+ npm?: string
40
+ }
41
+
42
+ export interface ProjectDataType {
43
+ [key: string]: {
44
+ title: string
45
+ emoji: string
46
+ collection: ProjectItem[]
47
+ }
48
+ }
package/unocss.config.ts CHANGED
@@ -3,7 +3,7 @@ import { defineConfig } from 'unocss'
3
3
  export default defineConfig({
4
4
  shortcuts: [
5
5
  ['yun-main', 'lt-md:pl-0'],
6
- ['yun-card', 'm-auto transition yun-transition shadow hover:shadow-lg'],
6
+ ['yun-card', 'transition yun-transition shadow hover:shadow-lg'],
7
7
  ],
8
8
  rules: [
9
9
  [
@@ -0,0 +1,33 @@
1
+ import { gsap } from 'gsap'
2
+ import ScrollToPlugin from 'gsap/dist/ScrollToPlugin'
3
+
4
+ gsap.registerPlugin(ScrollToPlugin)
5
+
6
+ export function goDown() {
7
+ const banner = document.getElementById('yun-banner')
8
+ if (banner) {
9
+ // nav menu height
10
+ const offset = 50
11
+
12
+ gsap.to(window, {
13
+ duration: 1,
14
+ scrollTo: {
15
+ y: banner.clientHeight - offset,
16
+ },
17
+ ease: 'power3.inOut',
18
+ })
19
+ }
20
+ }
21
+
22
+ /**
23
+ * back to top
24
+ */
25
+ export function backToTop() {
26
+ gsap.to(window, {
27
+ duration: 1,
28
+ scrollTo: {
29
+ y: 0,
30
+ },
31
+ ease: 'power3.inOut',
32
+ })
33
+ }
package/utils/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { formatDate } from 'valaxy'
2
2
  import noneImg from '../assets/images/none.jpg'
3
3
 
4
+ export * from './animation'
5
+
4
6
  /**
5
7
  * set default img
6
8
  * @param e