Commit f340b6279b

f340b6279b874b1867b183ea60dea9e4ae70fdd2

parent: fc0ad44f7a

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-06-30 16:26 UTC

update

Layout: unified · split

docs/.vitepress/theme/components/HomeFeatures.vue +11 −1
@@ -1,5 +1,5 @@
1<script setup lang="ts"> 1<script setup lang="ts">
2import { computed, nextTick, onMounted, ref, watch } from 'vue' 2import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
3import type { HomeCard } from '../../configs/constants' 3import type { HomeCard } from '../../configs/constants'
4 4
5const props = defineProps<{ cards: HomeCard[] }>() 5const props = defineProps<{ cards: HomeCard[] }>()
@@ -123,6 +123,16 @@ watch(panelOpen, (open) => {
123 document.body.style.overflow = open ? 'hidden' : '' 123 document.body.style.overflow = open ? 'hidden' : ''
124}) 124})
125 125
126function onKeydown(e: KeyboardEvent) {
127 if (e.key === 'Escape') {
128 panelOpen.value = false
129 cardTooltip.value = null
130 }
131}
132
133onMounted(() => document.addEventListener('keydown', onKeydown))
134onUnmounted(() => document.removeEventListener('keydown', onKeydown))
135
126function loadPrefs() { 136function loadPrefs() {
127 if (typeof window === 'undefined') return { columnMode: 'default' as const, viewMode: 'default' as const } 137 if (typeof window === 'undefined') return { columnMode: 'default' as const, viewMode: 'default' as const }
128 try { 138 try {
docs/.vitepress/theme/components/settings/Menu.vue +4 −6
@@ -2,7 +2,7 @@
2import { useMounted } from '@vueuse/core' 2import { useMounted } from '@vueuse/core'
3import { inject } from 'vue' 3import { inject } from 'vue'
4 4
5import { InjectionKey, VPFlyout } from '../../constants' 5import { InjectionKey } from '../../constants'
6import AccentColor from './AccentColor.vue' 6import AccentColor from './AccentColor.vue'
7import BlurEffects from './BlurEffects.vue' 7import BlurEffects from './BlurEffects.vue'
8import LayoutSwitch from './LayoutSwitch.vue' 8import LayoutSwitch from './LayoutSwitch.vue'
@@ -10,6 +10,7 @@ import LayoutSwitchContentLayoutWidthInput from './LayoutSwitchContentLayoutMaxW
10import LayoutSwitchPageLayoutWidthInput from './LayoutSwitchPageLayoutMaxWidthSlider.vue' 10import LayoutSwitchPageLayoutWidthInput from './LayoutSwitchPageLayoutMaxWidthSlider.vue'
11import Spotlight from './Spotlight.vue' 11import Spotlight from './Spotlight.vue'
12import SpotlightStyles from './SpotlightStyles.vue' 12import SpotlightStyles from './SpotlightStyles.vue'
13import SettingsFlyout from './SettingsFlyout.vue'
13import Takodachi from './Takodachi.vue' 14import Takodachi from './Takodachi.vue'
14 15
15const options = inject(InjectionKey, {}) 16const options = inject(InjectionKey, {})
@@ -17,11 +18,8 @@ const mounted = useMounted()
17</script> 18</script>
18 19
19<template> 20<template>
20 <VPFlyout 21 <SettingsFlyout
21 icon="i-lucide:settings"
22 class="VPNolebaseEnhancedReadabilitiesMenu VPNolebaseEnhancedReadabilitiesMenuFlyout" 22 class="VPNolebaseEnhancedReadabilitiesMenu VPNolebaseEnhancedReadabilitiesMenuFlyout"
23 aria-label="Enhanced Readability"
24 role="menuitem"
25 > 23 >
26 <div 24 <div
27 v-if="mounted" 25 v-if="mounted"
@@ -37,7 +35,7 @@ const mounted = useMounted()
37 <Takodachi /> 35 <Takodachi />
38 <AccentColor /> 36 <AccentColor />
39 </div> 37 </div>
40 </VPFlyout> 38 </SettingsFlyout>
41</template> 39</template>
42 40
43<style> 41<style>
docs/.vitepress/theme/components/settings/SettingsFlyout.vue added +86
@@ -0,0 +1,86 @@
1<script setup lang="ts">
2import { onMounted, onUnmounted, ref } from 'vue'
3
4const open = ref(false)
5const el = ref<HTMLElement>()
6
7function toggle() {
8 open.value = !open.value
9}
10
11function onDocClick(e: MouseEvent) {
12 if (el.value && !el.value.contains(e.target as Node)) {
13 open.value = false
14 }
15}
16
17onMounted(() => document.addEventListener('click', onDocClick, true))
18onUnmounted(() => document.removeEventListener('click', onDocClick, true))
19</script>
20
21<template>
22 <div ref="el" class="VPFlyout">
23 <button
24 type="button"
25 class="button"
26 aria-haspopup="true"
27 :aria-expanded="open"
28 aria-label="Enhanced Readability"
29 @click="toggle"
30 >
31 <span class="text">
32 <span class="i-lucide:settings option-icon" />
33 </span>
34 </button>
35
36 <div v-show="open" class="menu">
37 <div class="VPMenu">
38 <slot />
39 </div>
40 </div>
41 </div>
42</template>
43
44<style scoped>
45.VPFlyout {
46 position: relative;
47}
48
49.button {
50 display: flex;
51 align-items: center;
52 padding: 0 12px;
53 height: var(--vp-nav-height);
54 color: var(--vp-c-text-1);
55 transition: color 0.5s;
56}
57
58.text {
59 display: flex;
60 align-items: center;
61 line-height: var(--vp-nav-height);
62}
63
64.option-icon {
65 font-size: 16px;
66}
67
68.menu {
69 position: absolute;
70 top: calc(var(--vp-nav-height) / 2 + 20px);
71 right: 0;
72 z-index: 100;
73}
74
75.VPMenu {
76 border-radius: 12px;
77 padding: 12px;
78 min-width: 128px;
79 border: 1px solid var(--vp-c-divider);
80 background-color: var(--vp-c-bg-elv);
81 box-shadow: var(--vp-shadow-3);
82 transition: background-color 0.5s;
83 max-height: calc(100vh - var(--vp-nav-height));
84 overflow-y: auto;
85}
86</style>