Skip to content

Commit

Permalink
test: fix hover popper by wait for animation
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Nov 27, 2024
1 parent 8cf4971 commit 70932c0
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 30 deletions.
2 changes: 0 additions & 2 deletions demo/yun/.valaxy/typed-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ declare module 'vue-router/auto-routes' {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/_drafts/README': RouteRecordInfo<'/_drafts/README', '/_drafts/README', Record<never, never>, Record<never, never>>,
'/[...path]': RouteRecordInfo<'/[...path]', '/:path(.*)', { path: ParamValue<true> }, { path: ParamValue<false> }>,
'/[year]/': RouteRecordInfo<'/[year]/', '/:year', { year: ParamValue<true> }, { year: ParamValue<false> }>,
'/[year]/[month]/': RouteRecordInfo<'/[year]/[month]/', '/:year/:month', { year: ParamValue<true>, month: ParamValue<true> }, { year: ParamValue<false>, month: ParamValue<false> }>,
'/404': RouteRecordInfo<'/404', '/404', Record<never, never>, Record<never, never>>,
'/about/': RouteRecordInfo<'/about/', '/about', Record<never, never>, Record<never, never>>,
'/about/site': RouteRecordInfo<'/about/site', '/about/site', Record<never, never>, Record<never, never>>,
Expand Down
5 changes: 0 additions & 5 deletions demo/yun/pages/[year]/[month]/index.vue

This file was deleted.

5 changes: 0 additions & 5 deletions demo/yun/pages/[year]/index.vue

This file was deleted.

2 changes: 2 additions & 0 deletions e2e/theme-yun/markdown/footnote-tooltip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ test.describe('markdown footnote tooltip', () => {
await page.evaluate(() => {
document.documentElement.setAttribute('lang', 'zh-CN')
})
// await menu move animation
await page.waitForTimeout(500)
await page.locator('a[href="#fn1"]').hover()
await expect(page.locator('.v-popper__popper')).toContainText('Here is the footnote.')
})
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy-addon-components/components/VCLiveTime.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { differenceInSeconds } from 'date-fns/differenceInSeconds'
import { differenceInSeconds } from 'date-fns'
import { onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
Expand Down
3 changes: 1 addition & 2 deletions packages/valaxy-theme-yun/components/YunMdTimeWarning.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts" setup>
import { differenceInMilliseconds } from 'date-fns/differenceInMilliseconds'
import { formatDistanceToNow } from 'date-fns/formatDistanceToNow'
import { differenceInMilliseconds, formatDistanceToNow } from 'date-fns'
import { useFrontmatter } from 'valaxy'
import { computed, ref, watch } from 'vue'
Expand Down
7 changes: 5 additions & 2 deletions packages/valaxy-theme-yun/components/menu/YunNavMenuTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ const siteConfig = useSiteConfig()
const route = useRoute()
const showPostTitle = ref(false)
const showSiteTitle = computed(() => {
if (route.path === '/')
return false
if (yunApp.isStrato)
return route.path === '/' ? false : yunApp.scrollY < 10
return !showPostTitle.value
return yunApp.scrollY < 10
else
return !showPostTitle.value
})
watch(() => yunApp.scrollY, () => {
if (yunApp.isNimbo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const showContent = ref(false)
<div
flex="~ col"
class="gap-2 items-center justify-center"
my-4 md:my-6
my-4 md:my-5 lg:my-6
py-4 md:py-6
border="t-1px b-1px black/60 dark:white/60"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const yunApp = useYunAppStore()

<template>
<AppLink
class="link-item inline-flex-center gap-2 transition rounded text-base p-1 md:(text-xl p-3) text-$va-c-text"
class="link-item inline-flex-center gap-2 transition rounded text-base p-1 md:(text-base p-2) lg:(text-xl p-3) text-$va-c-text"
inline-flex
:to="page.url" :title="page.name"
:style="`color:${page.color}`"
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy-theme-yun/layouts/post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Article } from '@unhead/schema-org'
import { defineArticle, useSchemaOrg } from '@unhead/schema-org'
import { toDate } from 'date-fns/toDate'
import { toDate } from 'date-fns'
import { useFrontmatter, useFullUrl, useSiteConfig } from 'valaxy'
import { computed } from 'vue'
Expand Down
4 changes: 0 additions & 4 deletions packages/valaxy-theme-yun/setup/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { MotionPlugin } from '@vueuse/motion'
import AnimateOnScroll from 'primevue/animateonscroll'
import PrimeVue from 'primevue/config'

import StyleClass from 'primevue/styleclass'
import ToastService from 'primevue/toastservice'
import { defineAppSetup } from 'valaxy'
import { useYunAppStore } from '../stores'
Expand Down Expand Up @@ -42,8 +40,6 @@ export default defineAppSetup((ctx) => {
},
},
})
app.directive('animateonscroll', AnimateOnScroll)
app.directive('styleclass', StyleClass)

// use floating-vue
// app.directive('tooltip', Tooltip)
Expand Down
11 changes: 10 additions & 1 deletion packages/valaxy-theme-yun/valaxy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ function ThemeVitePlugin(options: ResolvedValaxyOptions<ThemeConfig>): Plugin {
},

optimizeDeps: {
include: ['@ctrl/tinycolor', 'gsap/dist/ScrollToPlugin'],
include: [
'@ctrl/tinycolor',
'gsap',
'gsap/dist/ScrollToPlugin',
'@explosions/fireworks',

'@vueuse/motion',
'primevue/toastservice',
'primevue/config',
],
exclude: ['@docsearch/js'],
},
}
Expand Down
3 changes: 2 additions & 1 deletion packages/valaxy/client/composables/locale.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { isClient, useStorage } from '@vueuse/core'
import { setDefaultOptions } from 'date-fns'
// not optimize deps all locales
import { enUS } from 'date-fns/locale/en-US'
import { zhCN } from 'date-fns/locale/zh-CN'
import { setDefaultOptions } from 'date-fns/setDefaultOptions'
import { useI18n } from 'vue-i18n'

export function useLocale() {
Expand Down
3 changes: 1 addition & 2 deletions packages/valaxy/client/utils/time.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { ToDateOptionsWithTZ } from 'date-fns-tz'
import type { Post } from '../../types'
import { format, toDate } from 'date-fns'
import { format as formatWithTZ, toZonedTime } from 'date-fns-tz'
import { format } from 'date-fns/format'
import { toDate } from 'date-fns/toDate'
import { DateTime } from 'luxon'
import { timezone as globalTimezone } from '../composables/global'
import { i18n } from '../modules/valaxy'
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy/node/cli/utils/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { writeFile } from 'node:fs/promises'
import { join, resolve } from 'node:path'
import { ensureSuffix } from '@antfu/utils'
import { consola } from 'consola'
import { formatDate } from 'date-fns/format'
import { formatDate } from 'date-fns'
import { render } from 'ejs'
import { green, magenta } from 'picocolors'
import { defaultPostTemplate, userRoot } from './constants'
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy/node/modules/rss/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { readFile } from 'node:fs/promises'
import { dirname, join, resolve } from 'node:path'
import consola from 'consola'
import { colors } from 'consola/utils'
import { formatDate } from 'date-fns/format'
import { formatDate } from 'date-fns'
import fg from 'fast-glob'
import { Feed } from 'feed'
import fs from 'fs-extra'
Expand Down
5 changes: 5 additions & 0 deletions packages/valaxy/node/plugins/extendConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const clientDeps = [
// https://cn.vite.dev/guide/dep-pre-bundling.html#the-why
// bundle date-fns to one file
'date-fns',
'date-fns/locale/en-US',
'date-fns/locale/zh-CN',
'date-fns-tz',
// @TODO replace luxon by date-fns
'luxon',

'@unhead/schema-org',
'@unhead/vue',
Expand Down

1 comment on commit 70932c0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://674757ad59edc951b6afbbac--valaxy.netlify.app

Please sign in to comment.