valaxy-theme-yun 0.19.3 → 0.19.5

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.
@@ -127,7 +127,7 @@ onClickOutside(searchInputRef, () => {
127
127
  text-align: center;
128
128
  margin: 0;
129
129
  z-index: var(--yun-z-search-popup);
130
- transition: 0.6s;
130
+ transition: 0.2s;
131
131
  background-color: var(--va-c-bg-opacity);
132
132
  }
133
133
 
@@ -26,7 +26,7 @@ const { icon, styles } = usePostProperty(props.post.type)
26
26
  loading="lazy"
27
27
  >
28
28
 
29
- <div class="flex flex-col items-center" :class="post.cover && 'h-54'" w="full">
29
+ <div class="flex flex-col items-center relative" :class="post.cover && 'h-54'" w="full">
30
30
  <AppLink
31
31
  class="post-title-link cursor-pointer"
32
32
  :to="post.path || ''"
@@ -41,14 +41,15 @@ const { icon, styles } = usePostProperty(props.post.type)
41
41
 
42
42
  <YunPostMeta :frontmatter="post" />
43
43
 
44
- <div class="flex flex-grow" w="full" justify="center" items="center">
44
+ <div flex="~ grow col" w="full" justify="center" items="center">
45
45
  <div v-if="post.excerpt_type === 'text'" py="1" />
46
46
  <div v-if="post.excerpt" class="markdown-body" op="90" text="left" w="full" p="x-6 lt-sm:4 y-2" v-html="post.excerpt" />
47
47
  <div v-else m="b-5" />
48
48
  </div>
49
-
50
49
  <!-- <div m="b-5" /> -->
51
50
 
51
+ <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" />
52
+
52
53
  <a
53
54
  v-if="post.url"
54
55
  :href="post.url"
@@ -1,6 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { useSiteConfig } from 'valaxy'
3
- import { computed, defineAsyncComponent, onMounted, onUnmounted, ref } from 'vue'
3
+ import { computed, defineAsyncComponent, onMounted, ref } from 'vue'
4
+ import { useEventListener } from '@vueuse/core'
4
5
 
5
6
  const siteConfig = useSiteConfig()
6
7
 
@@ -13,27 +14,29 @@ function togglePopup() {
13
14
  open.value = !open.value
14
15
  }
15
16
 
16
- onMounted(() => {
17
- const handleSearchHotKey = (event: KeyboardEvent) => {
18
- if (
19
- (event.key.toLowerCase() === 'k' && (event.metaKey || event.ctrlKey))
20
- ) {
21
- event.preventDefault()
22
- togglePopup()
23
- }
24
- }
25
-
26
- const remove = () => {
27
- window.removeEventListener('keydown', handleSearchHotKey)
17
+ function handleSearchHotKey(event: KeyboardEvent) {
18
+ if (
19
+ (event.key.toLowerCase() === 'k' && (event.metaKey || event.ctrlKey))
20
+ ) {
21
+ event.preventDefault()
22
+ togglePopup()
28
23
  }
24
+ }
29
25
 
30
- window.addEventListener('keydown', handleSearchHotKey)
31
-
32
- onUnmounted(remove)
26
+ const algoliaRef = ref()
27
+ onMounted(() => {
28
+ // algolia has its own hotkey
29
+ if (isFuse.value)
30
+ useEventListener('keydown', handleSearchHotKey)
33
31
  })
34
32
 
35
33
  function openSearch() {
36
34
  open.value = true
35
+
36
+ if (isAlgolia.value) {
37
+ algoliaRef.value.load()
38
+ algoliaRef.value.dispatchEvent()
39
+ }
37
40
  }
38
41
 
39
42
  function closeSearch() {
@@ -48,6 +51,6 @@ const YunAlgoliaSearch = isAlgolia.value
48
51
  <template>
49
52
  <YunSearchBtn :open="open && !isAlgolia" @open="openSearch" @close="closeSearch" />
50
53
 
51
- <YunAlgoliaSearch v-if="isAlgolia" :open="open" @close="closeSearch" />
54
+ <YunAlgoliaSearch v-if="isAlgolia" ref="algoliaRef" :open="open" @close="closeSearch" />
52
55
  <YunFuseSearch v-else-if="isFuse" :open="open" @close="closeSearch" />
53
56
  </template>
@@ -22,10 +22,10 @@ function toggleOptionVisible(e: MouseEvent) {
22
22
  </script>
23
23
 
24
24
  <template>
25
- <div class="relative h-8 w-30 text-[var(--va-c-text-2)] z-20" @mousedown.stop>
25
+ <div class="relative h-8 w-30 text-$va-c-text-2 z-10" @mousedown.stop>
26
26
  <button
27
27
  class="flex h-full w-full px-2 items-center justify-between border rounded transition"
28
- :class="optionVisible ? 'border-[var(--va-c-primary)] shadow-lg' : ''"
28
+ :class="optionVisible ? 'border-$va-c-primary' : ''"
29
29
  @click="toggleOptionVisible"
30
30
  >
31
31
  <span case-capital op-90>{{ activeValue }}</span>
@@ -34,13 +34,13 @@ function toggleOptionVisible(e: MouseEvent) {
34
34
  <Transition>
35
35
  <ul
36
36
  v-show="optionVisible"
37
- class="select-options absolute translate-y-1 left-0 top-full w-full bg-[var(--va-c-bg-light)] overflow-hidden rounded-1 border"
37
+ class="shadow-lg select-options absolute translate-y-1 left-0 top-full w-full bg-$va-c-bg-light overflow-hidden rounded-1"
38
38
  >
39
39
  <li
40
40
  v-for="option in options"
41
41
  :key="option"
42
- class="cursor-pointer list-none px-2 hover:bg-[var(--va-c-primary-light)] hover:text-white case-capital"
43
- :class="{ 'bg-[var(--va-c-primary)] text-white': activeValue === option }"
42
+ class="cursor-pointer list-none px-2 hover:bg-$va-c-primary-light hover:text-white case-capital"
43
+ :class="{ 'bg-$va-c-primary text-white': activeValue === option }"
44
44
  @click="activeValue = option"
45
45
  >
46
46
  {{ option }}
@@ -1,9 +1,8 @@
1
1
  <script lang="ts" setup>
2
2
  import * as addonAlgolia from 'valaxy-addon-algolia'
3
3
  import { isEmptyAddon } from 'valaxy'
4
- import { watch } from 'vue'
5
4
 
6
- const props = defineProps<{
5
+ defineProps<{
7
6
  open: boolean
8
7
  }>()
9
8
 
@@ -11,12 +10,11 @@ if (isEmptyAddon(addonAlgolia))
11
10
  throw new Error('Algolia addon is not installed')
12
11
 
13
12
  const { loaded, load, dispatchEvent } = addonAlgolia.useAddonAlgolia()
14
- watch(() => props.open, () => {
15
- if (props.open)
16
- load()
17
13
 
18
- if (loaded)
19
- dispatchEvent()
14
+ defineExpose({
15
+ loaded,
16
+ load,
17
+ dispatchEvent,
20
18
  })
21
19
  </script>
22
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -20,12 +20,12 @@
20
20
  "dependencies": {
21
21
  "@explosions/fireworks": "^0.0.2",
22
22
  "@iconify-json/ant-design": "^1.1.16",
23
- "@iconify-json/simple-icons": "^1.1.109",
23
+ "@iconify-json/simple-icons": "^1.1.110",
24
24
  "animejs": "^3.2.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/animejs": "^3.1.12",
28
- "valaxy": "0.19.3",
28
+ "valaxy": "0.19.5",
29
29
  "valaxy-addon-waline": "0.2.0"
30
30
  }
31
31
  }