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"> |
| |
2 | import { NuInputHorizontalRadioGroup } from '@nolebase/ui' |
| |
3 | import { useData } from 'vitepress' |
| |
4 | import { computed, inject } from 'vue' |
| |
5 | |
| |
6 | import MenuTitle from './MenuTitle.vue' |
| |
7 | |
| |
8 | const { isDark } = useData() |
| |
9 | const toggleAppearance = inject<() => void>('toggle-appearance', () => { |
| |
10 | isDark.value = !isDark.value |
| |
11 | }) |
| |
12 | |
| |
13 | const 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 | |
| |
30 | const 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 @@ |
| 1 | <script setup lang="ts"> |
1 | <script setup lang="ts"> |
| 2 | import { NuInputHorizontalRadioGroup } from '@nolebase/ui' |
| |
| 3 | import { computed } from 'vue' |
| |
| 4 | |
| |
| 5 | import MenuTitle from './MenuTitle.vue' |
2 | import MenuTitle from './MenuTitle.vue' |
| 6 | |
| |
| 7 | import { LayoutMode } from '../../constants' |
| |
| 8 | |
| |
| 9 | const 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 | ]) |
| |
| 39 | </script> |
3 | </script> |
| 40 | |
4 | |
| 41 | <template> |
5 | <template> |
| @@ -56,11 +20,5 @@ const fieldOptions = computed(() => [ |
| 56 | > |
20 | > |
| 57 | <span text-xs>No available layout can be switched in mobile screen.</span> |
21 | <span text-xs>No available layout can be switched in mobile screen.</span> |
| 58 | </div> |
22 | </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 | /> |
| |
| 65 | </div> |
23 | </div> |
| 66 | </template> |
24 | </template> |
docs/.vitepress/theme/components/settings/ScreenMenu.vue
+12 −14
| @@ -1,28 +1,26 @@ |
| 1 | <script setup lang="ts"> |
1 | <script setup lang="ts"> |
| 2 | import { useMounted } from '@vueuse/core' |
2 | import { useMounted } from '@vueuse/core' |
| |
3 | import { useData } from 'vitepress' |
| |
4 | import VPSocialLinks from 'vitepress/dist/client/theme-default/components/VPSocialLinks.vue' |
| 3 | |
5 | |
| 4 | import AccentColor from './AccentColor.vue' |
6 | import AccentColor from './AccentColor.vue' |
| 5 | import BlurEffects from './BlurEffects.vue' |
7 | import BlurEffects from './BlurEffects.vue' |
| 6 | import MenuTitle from './MenuTitle.vue' |
8 | import ScreenAppearance from './ScreenAppearance.vue' |
| 7 | import ScreenLayoutSwitch from './ScreenLayoutSwitch.vue' |
| |
| 8 | import ScreenSpotlight from './ScreenSpotlight.vue' |
| |
| 9 | |
9 | |
| 10 | const mounted = useMounted() |
10 | const mounted = useMounted() |
| |
11 | const { theme } = useData() |
| 11 | </script> |
12 | </script> |
| 12 | |
13 | |
| 13 | <template> |
14 | <template> |
| 14 | <div v-if="mounted" space-y-2 class="VPNolebaseEnhancedReadabilitiesMenu"> |
15 | <div v-if="mounted" space-y-2 class="VPNolebaseEnhancedReadabilitiesMenu"> |
| 15 | <MenuTitle title="Enhanced Readability" aria-label="Enhanced Readability"> |
16 | <BlurEffects /> |
| 16 | <template #icon> |
17 | <ScreenAppearance /> |
| 17 | <span i-icon-park-outline:setting-two mr-1 aria-hidden="true" /> |
18 | <AccentColor /> |
| 18 | </template> |
19 | <VPSocialLinks |
| 19 | </MenuTitle> |
20 | v-if="theme.socialLinks" |
| 20 | <div flex="~ col" pl-4 space-y-2> |
21 | :links="theme.socialLinks" |
| 21 | <ScreenLayoutSwitch /> |
22 | class="screen-menu-social-links" |
| 22 | <ScreenSpotlight /> |
23 | /> |
| 23 | <BlurEffects /> |
| |
| 24 | <AccentColor /> |
| |
| 25 | </div> |
| |
| 26 | </div> |
24 | </div> |
| 27 | </template> |
25 | </template> |
| 28 | |
26 | |
docs/.vitepress/theme/styles/style.scss
+11
| @@ -1891,3 +1891,14 @@ html:not(.dark) .nolebase-ui-input-horizontal-option { |
| 1891 | --nolebase-ui-input-horizontal-option-active-text: var(--vp-c-bg-elv); |
1891 | --nolebase-ui-input-horizontal-option-active-text: var(--vp-c-bg-elv); |
| 1892 | --nolebase-ui-input-horizontal-option-shadow-color: #53535366; |
1892 | --nolebase-ui-input-horizontal-option-shadow-color: #53535366; |
| 1893 | } |
1893 | } |
| |
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 | } |