valaxy-theme-yun 1.2.2 → 1.3.0

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.
package/layouts/post.vue CHANGED
@@ -2,8 +2,9 @@
2
2
  import { defineArticle, useSchemaOrg } from '@unhead/schema-org/vue'
3
3
 
4
4
  import dayjs from 'dayjs'
5
- import { useFrontmatter, useSiteConfig, useValaxyI18n } from 'valaxy'
5
+ import { resolveCanonicalPath, resolveSiteUrl, useFrontmatter, usePageSeo, useSiteConfig, useValaxyI18n } from 'valaxy'
6
6
  import { useI18n } from 'vue-i18n'
7
+ import { useRoute } from 'vue-router'
7
8
  import { useYunCollection } from '../composables/collection'
8
9
  import { useYunLocalMenu } from '../composables/localMenu'
9
10
 
@@ -12,22 +13,30 @@ const { menuOpen, toggleMenu } = useYunLocalMenu()
12
13
  const { t } = useI18n()
13
14
  const siteConfig = useSiteConfig()
14
15
  const frontmatter = useFrontmatter()
16
+ const route = useRoute()
15
17
 
16
18
  const { $t, $tO } = useValaxyI18n()
17
- const image = frontmatter.value.image || frontmatter.value.cover
19
+ const authorLink = siteConfig.value.author.link?.trim()
20
+ const description = $tO(frontmatter.value.description) || route.meta.seoDescription || ''
21
+ const { image } = usePageSeo()
22
+ const pagePath = resolveCanonicalPath(route)
23
+ const pageUrl = /^https?:\/\//.test(siteConfig.value.url)
24
+ ? resolveSiteUrl(siteConfig.value.url, frontmatter.value.canonical || pagePath)
25
+ : ''
18
26
  const article: Parameters<typeof defineArticle>[0] = {
19
27
  '@type': 'BlogPosting',
20
28
  'headline': $tO(frontmatter.value.title),
21
- 'description': $tO(frontmatter.value.description),
29
+ ...(description ? { description } : {}),
22
30
  'author': [
23
31
  {
24
32
  name: $t(siteConfig.value.author.name),
25
- url: siteConfig.value.author.link,
33
+ ...(authorLink ? { url: authorLink } : {}),
26
34
  },
27
35
  ],
28
36
  'datePublished': dayjs(frontmatter.value.date || '').toDate(),
29
37
  'dateModified': dayjs(frontmatter.value.updated || '').toDate(),
30
- ...(image ? { image } : {}),
38
+ ...(pageUrl ? { url: pageUrl } : {}),
39
+ image,
31
40
  }
32
41
 
33
42
  useSchemaOrg(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.3.0",
5
5
  "description": "Default theme (Yun) for Valaxy — a Vite & Vue powered static blog generator",
6
6
  "author": {
7
7
  "email": "me@yunyoujun.cn",
@@ -41,7 +41,7 @@
41
41
  "valaxy-addon-girls": "0.1.0"
42
42
  },
43
43
  "devDependencies": {
44
- "valaxy": "1.2.2",
44
+ "valaxy": "1.3.0",
45
45
  "valaxy-addon-waline": "0.2.1"
46
46
  },
47
47
  "scripts": {
package/stores/app.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { isClient, useScroll, useToggle } from '@vueuse/core'
1
+ import { useToggle } from '@vueuse/core'
2
2
  import { acceptHMRUpdate, defineStore } from 'pinia'
3
- import { useScreenSize } from 'valaxy'
3
+ import { useScreenSize, useWindowScrollY } from 'valaxy'
4
4
  import { computed, ref } from 'vue'
5
5
  import { useThemeConfig } from '../composables'
6
6
 
@@ -38,7 +38,7 @@ export const useYunAppStore = defineStore('yun-app', () => {
38
38
  isOpen: isFullscreenMenuOpen,
39
39
  toggle: toggleFullscreenMenu,
40
40
  },
41
- scrollY: isClient ? useScroll(window).y : 0,
41
+ scrollY: useWindowScrollY(),
42
42
 
43
43
  isStrato,
44
44
  isNimbo,
@@ -31,8 +31,8 @@
31
31
  }
32
32
 
33
33
  // Keep the homepage entrance soft and brief; no spring or overshoot.
34
- .yun-nav-menu.animate-fade-in {
35
- animation: yun-nav-arrive 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
34
+ .yun-nav-menu.is-home-nav {
35
+ animation: yun-nav-arrive 600ms cubic-bezier(0.22, 1, 0.36, 1);
36
36
  }
37
37
 
38
38
  @keyframes yun-nav-arrive {
@@ -48,7 +48,7 @@
48
48
  }
49
49
 
50
50
  @media (prefers-reduced-motion: reduce) {
51
- .yun-nav-menu.animate-fade-in {
51
+ .yun-nav-menu.is-home-nav {
52
52
  animation: none;
53
53
  }
54
54
  }
package/styles/index.ts CHANGED
@@ -4,3 +4,4 @@ import './main.scss'
4
4
  import 'valaxy/client/styles/common/index.scss'
5
5
  import './global.scss'
6
6
  import './common/nav.scss'
7
+ import './widgets/search.scss'
@@ -0,0 +1,57 @@
1
+ .yun-search-popup {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ backdrop-filter: blur(30px);
8
+ /* stylelint-disable-next-line property-no-vendor-prefix */
9
+ -webkit-backdrop-filter: blur(30px);
10
+ text-align: center;
11
+ margin: 0;
12
+ z-index: var(--yun-z-search-popup);
13
+ transition: opacity var(--va-transition-duration-fast);
14
+ background-color: var(--va-c-bg-opacity);
15
+ }
16
+
17
+ .yun-search-input {
18
+ background: transparent;
19
+ color: var(--va-c-text);
20
+ font-size: 1.5rem;
21
+ border-radius: 3rem;
22
+ padding: 1rem 1.5rem;
23
+ border: 1px solid var(--va-c-gray);
24
+ box-sizing: border-box;
25
+ width: 90%;
26
+ max-width: 800px;
27
+ font-family: var(--va-font-serif);
28
+ font-weight: 900;
29
+ text-align: center;
30
+ transition: border-color var(--va-transition-duration-fast);
31
+
32
+ &:focus {
33
+ border-color: var(--va-c-text);
34
+ }
35
+ }
36
+
37
+ .yun-popup {
38
+ .search-icon, .close-icon {
39
+ display: inline-block;
40
+ width: 2rem;
41
+ height: 2rem;
42
+ padding: 0.5rem;
43
+
44
+ .icon {
45
+ width: 2rem;
46
+ height: 2rem;
47
+ }
48
+ }
49
+ }
50
+
51
+ .yun-fuse-search {
52
+ .yun-fuse-result-item {
53
+ // padding: 0.5rem;
54
+ cursor: pointer;
55
+ border-top: 1px dashed #ccc;
56
+ }
57
+ }
@@ -1,17 +1,12 @@
1
1
  import { isClient } from '@vueuse/core'
2
- import { gsap } from 'gsap'
3
- // gsap/ScrollToPlugin is ESM, but gsap not include 'type:module' in package.json
4
- // use cjs for vite-ssg, optimizeDeps for ESM
5
- import ScrollToPlugin from 'gsap/dist/ScrollToPlugin'
6
2
 
7
- gsap.registerPlugin(ScrollToPlugin)
8
-
9
- export function goDown() {
3
+ export async function goDown() {
10
4
  if (!isClient)
11
5
  return
12
6
 
13
7
  const banner = document.getElementById('yun-banner')
14
8
  if (banner) {
9
+ const { gsap } = await import('./scroll')
15
10
  // nav menu height
16
11
  const offset = 50
17
12
 
@@ -28,10 +23,11 @@ export function goDown() {
28
23
  /**
29
24
  * back to top
30
25
  */
31
- export function backToTop() {
26
+ export async function backToTop() {
32
27
  if (!isClient)
33
28
  return
34
29
 
30
+ const { gsap } = await import('./scroll')
35
31
  gsap.to(window, {
36
32
  duration: 1,
37
33
  scrollTo: {
@@ -0,0 +1,7 @@
1
+ import { gsap } from 'gsap'
2
+ // Use the CJS entry for Node/SSG compatibility; Vite optimizes it in dev.
3
+ import ScrollToPlugin from 'gsap/dist/ScrollToPlugin'
4
+
5
+ gsap.registerPlugin(ScrollToPlugin)
6
+
7
+ export { gsap }