Commit d9bd3e965b

d9bd3e965b9fe47eab56dbf2b130f83401a16605

parent: fa14ae2c84

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-06-22 03:31 UTC

phone layout menu

Layout: unified · split

docs/.vitepress/theme/components/settings/ScreenAppearance.vue added +54
@@ -0,0 +1,54 @@
1<script setup lang="ts">
2import { NuInputHorizontalRadioGroup } from '@nolebase/ui'
3import { useData } from 'vitepress'
4import { computed, inject } from 'vue'
5
6import MenuTitle from './MenuTitle.vue'
7
8const { isDark } = useData()
9const toggleAppearance = inject<() => void>('toggle-appearance', () => {
10 isDark.value = !isDark.value
11})
12
13const fieldOptions = [
14 {
15 value: 'on',
16 title: 'On',
17 ariaLabel: 'On',
18 text: 'ON',
19 name: 'Dark Mode'
20 },
21 {
22 value: 'off',
23 title: 'Off',
24 ariaLabel: 'Off',
25 text: 'OFF',
26 name: 'Dark Mode'
27 }
28]
29
30const currentMode = computed({
31 get: () => (isDark.value ? 'on' : 'off'),
32 set: (value) => {
33 if ((value === 'on') !== isDark.value) {
34 toggleAppearance()
35 }
36 }
37})
38</script>
39
40<template>
41 <div space-y-2>
42 <MenuTitle title="Dark mode" aria-label="Dark mode">
43 <template #icon>
44 <span i-icon-park-outline:dark-mode mr-1 aria-hidden="true" />
45 </template>
46 </MenuTitle>
47 <NuInputHorizontalRadioGroup
48 v-model="currentMode"
49 bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
50 text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
51 :options="fieldOptions"
52 />
53 </div>
54</template>
docs/.vitepress/theme/components/settings/ScreenLayoutSwitch.vue −42
@@ -1,41 +1,5 @@
11<script setup lang="ts">
2import { NuInputHorizontalRadioGroup } from '@nolebase/ui'
3import { computed } from 'vue'
4
52import MenuTitle from './MenuTitle.vue'
6
7import { LayoutMode } from '../../constants'
8
9const fieldOptions = computed(() => [
10 {
11 value: LayoutMode.FullWidth,
12 title: 'Expand all',
13 ariaLabel: 'Expand all',
14 icon: 'i-icon-park-outline:full-screen-one',
15 name: 'VitePress Nolebase Enhanced Readabilities Layout Mode Checkbox'
16 },
17 {
18 value: LayoutMode.SidebarWidthAdjustableOnly,
19 title: 'Expand sidebar with adjustable values',
20 ariaLabel: 'Expand sidebar with adjustable values',
21 icon: 'i-icon-park-outline:full-screen-two',
22 name: 'VitePress Nolebase Enhanced Readabilities Layout Mode Checkbox'
23 },
24 {
25 value: LayoutMode.BothWidthAdjustable,
26 title: 'Expand all with adjustable values',
27 ariaLabel: 'Expand all with adjustable values',
28 icon: 'i-icon-park-outline:full-screen',
29 name: 'VitePress Nolebase Enhanced Readabilities Layout Mode Checkbox'
30 },
31 {
32 value: LayoutMode.Original,
33 title: 'Original width',
34 ariaLabel: 'Original width',
35 icon: 'i-icon-park-outline:overall-reduction',
36 name: 'VitePress Nolebase Enhanced Readabilities Layout Mode Checkbox'
37 }
38])
393</script>
404
415<template>
@@ -56,11 +20,5 @@ const fieldOptions = computed(() => [
5620 >
5721 <span text-xs>No available layout can be switched in mobile screen.</span>
5822 </div>
59 <NuInputHorizontalRadioGroup
60 bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
61 text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
62 :options="fieldOptions"
63 disabled
64 />
6523 </div>
6624</template>
docs/.vitepress/theme/components/settings/ScreenMenu.vue +12 −14
@@ -1,28 +1,26 @@
11<script setup lang="ts">
22import { useMounted } from '@vueuse/core'
3import { useData } from 'vitepress'
4import VPSocialLinks from 'vitepress/dist/client/theme-default/components/VPSocialLinks.vue'
35
46import AccentColor from './AccentColor.vue'
57import BlurEffects from './BlurEffects.vue'
6import MenuTitle from './MenuTitle.vue'
7import ScreenLayoutSwitch from './ScreenLayoutSwitch.vue'
8import ScreenSpotlight from './ScreenSpotlight.vue'
8import ScreenAppearance from './ScreenAppearance.vue'
99
1010const mounted = useMounted()
11const { theme } = useData()
1112</script>
1213
1314<template>
1415 <div v-if="mounted" space-y-2 class="VPNolebaseEnhancedReadabilitiesMenu">
15 <MenuTitle title="Enhanced Readability" aria-label="Enhanced Readability">
16 <template #icon>
17 <span i-icon-park-outline:setting-two mr-1 aria-hidden="true" />
18 </template>
19 </MenuTitle>
20 <div flex="~ col" pl-4 space-y-2>
21 <ScreenLayoutSwitch />
22 <ScreenSpotlight />
23 <BlurEffects />
24 <AccentColor />
25 </div>
16 <BlurEffects />
17 <ScreenAppearance />
18 <AccentColor />
19 <VPSocialLinks
20 v-if="theme.socialLinks"
21 :links="theme.socialLinks"
22 class="screen-menu-social-links"
23 />
2624 </div>
2725</template>
2826
docs/.vitepress/theme/styles/style.scss +11
@@ -1891,3 +1891,14 @@ html:not(.dark) .nolebase-ui-input-horizontal-option {
18911891 --nolebase-ui-input-horizontal-option-active-text: var(--vp-c-bg-elv);
18921892 --nolebase-ui-input-horizontal-option-shadow-color: #53535366;
18931893}
1894
1895/* Hide the default VitePress mobile appearance toggle and social links — we render them ourselves in ScreenMenu */
1896#VPNavScreen .VPNavScreenAppearance,
1897#VPNavScreen .VPNavScreenSocialLinks {
1898 display: none;
1899}
1900
1901.screen-menu-social-links {
1902 padding-top: 8px;
1903 border-top: 1px solid var(--vp-c-divider);
1904}