Commit d822be9529
d822be952957ac0c3c6f67d9250492f5c65e4eeb
parent: 320df5777c
Unsigned
Duck <57977673+woducku@users.noreply.github.com> · 2026-07-05 04:02 UTC
update
Layout: unified · split
docs/.vitepress/configs/constants.ts
+7
| @@ -572,6 +572,13 @@ export const siteConfig = { |
| 572 | 572 | appearance: true, |
| 573 | 573 | titleTemplate: ':title • Wotaku.wiki by Duck', |
| 574 | 574 | head: [ |
| 575 | // Apply the "Effects" preference before first paint to avoid a flash of |
| 576 | // effects. Effects are off by default; the class strips blur/transitions. |
| 577 | [ |
| 578 | 'script', |
| 579 | {}, |
| 580 | `(function(){try{if(localStorage.getItem('preference-effects')!=='on')document.documentElement.classList.add('effects-disabled')}catch(e){document.documentElement.classList.add('effects-disabled')}})()` |
| 581 | ], |
| 575 | 582 | ['meta', { name: 'theme-color', content: '#56b4fc' }], |
| 576 | 583 | ['meta', { name: 'og:type', content: 'website' }], |
| 577 | 584 | ['meta', { name: 'og:locale', content: 'en' }], |
docs/.vitepress/theme/Layout.vue
+6 −5
| @@ -34,7 +34,8 @@ import NotFoundComponent from './components/NotFound.vue' |
| 34 | 34 | import { NolebaseEnhancedReadabilitiesScreenMenu } from './components/settings' |
| 35 | 35 | import NavActions from './components/NavActions.vue' |
| 36 | 36 | import SidebarCard from './components/SidebarCard.vue' |
| 37 | | import { AccentColorStorageKey, LowEndDeviceModeStorageKey, TakodachiStorageKey } from './constants' |
| 37 | import { AccentColorStorageKey, TakodachiStorageKey } from './constants' |
| 38 | import { useEffects } from './composables/useEffects' |
| 38 | 39 | import { v2add, v2mag, v2norm, v2smul, v2sub, type Vec2D } from './math' |
| 39 | 40 | |
| 40 | 41 | const route = useRoute() |
| @@ -744,15 +745,15 @@ const breadcrumbs = computed(() => { |
| 744 | 745 | |
| 745 | 746 | // Respect user's reduced motion preferences |
| 746 | 747 | const prefs = usePreferredReducedMotion() |
| 747 | | const lowEndDeviceMode = useStorage(LowEndDeviceModeStorageKey, 'off') |
| 748 | | const reduceBlurEffects = computed(() => lowEndDeviceMode.value === 'on') |
| 748 | const { effectsEnabled } = useEffects() |
| 749 | 749 | |
| 750 | 750 | watchEffect(() => { |
| 751 | 751 | if (import.meta.env.SSR) return |
| 752 | 752 | |
| 753 | // Effects are off by default; the class strips blur/transitions/scaling. |
| 753 | 754 | document.documentElement.classList.toggle( |
| 754 | | 'reduce-blur-effects', |
| 755 | | reduceBlurEffects.value |
| 755 | 'effects-disabled', |
| 756 | !effectsEnabled.value |
| 756 | 757 | ) |
| 757 | 758 | }) |
| 758 | 759 | |
docs/.vitepress/theme/components/Search.vue
+2 −4
| @@ -28,7 +28,6 @@ import { |
| 28 | 28 | useLocalStorage, |
| 29 | 29 | useScrollLock, |
| 30 | 30 | useSessionStorage, |
| 31 | | useStorage, |
| 32 | 31 | watchDebounced |
| 33 | 32 | } from '@vueuse/core' |
| 34 | 33 | import { useFocusTrap } from '@vueuse/integrations/useFocusTrap' |
| @@ -62,7 +61,7 @@ import type { PageLink } from '../../plugins/urlSearchPlugin' |
| 62 | 61 | import { LRUCache } from '../composables/search/lru-cache' |
| 63 | 62 | import { createSearchTranslate } from '../composables/search/translation' |
| 64 | 63 | import { useData } from '../composables/search/use-data' |
| 65 | | import { LowEndDeviceModeStorageKey } from '../constants' |
| 64 | import { useEffects } from '../composables/useEffects' |
| 66 | 65 | import { enhanceAppWithTabs } from './tabs' |
| 67 | 66 | |
| 68 | 67 | export interface FooterTranslations { |
| @@ -138,8 +137,7 @@ const filterText = disableQueryPersistence.value |
| 138 | 137 | ? ref('') |
| 139 | 138 | : useSessionStorage('vitepress:local-search-filter', '') |
| 140 | 139 | |
| 141 | | const lowEndDeviceMode = useStorage(LowEndDeviceModeStorageKey, 'off') |
| 142 | | const searchAnimationsEnabled = computed(() => lowEndDeviceMode.value !== 'on') |
| 140 | const { effectsEnabled: searchAnimationsEnabled } = useEffects() |
| 143 | 141 | const showKeyboardShortcuts = computed(() => !filterText.value) |
| 144 | 142 | |
| 145 | 143 | const SearchMotionDiv = motion.div |
docs/.vitepress/theme/components/settings/BlurEffects.vue → docs/.vitepress/theme/components/settings/Effects.vue
renamed
+8 −15
| @@ -1,17 +1,16 @@ |
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { NuInputHighlight, NuInputHorizontalRadioGroup } from '@nolebase/ui' |
| 3 | | import { useStorage } from '@vueuse/core' |
| 4 | 3 | import { computed, ref } from 'vue' |
| 5 | 4 | |
| 6 | 5 | import MenuHelp from './MenuHelp.vue' |
| 7 | 6 | import MenuTitle from './MenuTitle.vue' |
| 8 | 7 | |
| 9 | | import { LowEndDeviceModeStorageKey } from '../../constants' |
| 8 | import { useEffects } from '../../composables/useEffects' |
| 10 | 9 | |
| 11 | 10 | const menuTitleElementRef = ref<HTMLDivElement>() |
| 12 | 11 | const isMenuHelpPoppedUp = ref(false) |
| 13 | 12 | |
| 14 | | const lowEndDeviceMode = useStorage(LowEndDeviceModeStorageKey, 'off') |
| 13 | const { effects } = useEffects() |
| 15 | 14 | |
| 16 | 15 | const fieldOptions = computed(() => [ |
| 17 | 16 | { |
| @@ -19,14 +18,14 @@ const fieldOptions = computed(() => [ |
| 19 | 18 | title: 'On', |
| 20 | 19 | ariaLabel: 'On', |
| 21 | 20 | text: 'ON', |
| 22 | | name: 'Low-End Device Mode' |
| 21 | name: 'Effects' |
| 23 | 22 | }, |
| 24 | 23 | { |
| 25 | 24 | value: 'off', |
| 26 | 25 | title: 'Off', |
| 27 | 26 | ariaLabel: 'Off', |
| 28 | 27 | text: 'OFF', |
| 29 | | name: 'Low-End Device Mode' |
| 28 | name: 'Effects' |
| 30 | 29 | } |
| 31 | 30 | ]) |
| 32 | 31 | </script> |
| @@ -34,12 +33,7 @@ const fieldOptions = computed(() => [ |
| 34 | 33 | <template> |
| 35 | 34 | <div space-y-2 role="radiogroup"> |
| 36 | 35 | <div ref="menuTitleElementRef" relative flex items-center> |
| 37 | | <MenuTitle |
| 38 | | title="Low-end device mode" |
| 39 | | aria-label="Low-end device mode" |
| 40 | | flex="1" |
| 41 | | pr-4 |
| 42 | | > |
| 36 | <MenuTitle title="Effects" aria-label="Effects" flex="1" pr-4> |
| 43 | 37 | <template #icon> |
| 44 | 38 | <span i-icon-park-outline:effects mr-1 aria-hidden="true" /> |
| 45 | 39 | </template> |
| @@ -48,16 +42,15 @@ const fieldOptions = computed(() => [ |
| 48 | 42 | v-model:is-popped-up="isMenuHelpPoppedUp" |
| 49 | 43 | :menu-title-element-ref="menuTitleElementRef" |
| 50 | 44 | > |
| 51 | | <h4 text-md mb-1 font-semibold>Low-end device mode</h4> |
| 45 | <h4 text-md mb-1 font-semibold>Effects</h4> |
| 52 | 46 | <p text="sm" mb-2 max-w-100> |
| 53 | | Turn on to disable expensive backdrop blur and view transitions if the |
| 54 | | site feels laggy on slower devices. |
| 47 | Adds backdrop blur, smooth page transitions, and scaling animations. Keep off for the best performance on slower devices. |
| 55 | 48 | </p> |
| 56 | 49 | </MenuHelp> |
| 57 | 50 | </div> |
| 58 | 51 | <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md"> |
| 59 | 52 | <NuInputHorizontalRadioGroup |
| 60 | | v-model="lowEndDeviceMode" |
| 53 | v-model="effects" |
| 61 | 54 | bg="$vp-nolebase-enhanced-readabilities-menu-background-color" |
| 62 | 55 | text="sm $vp-nolebase-enhanced-readabilities-menu-text-color" |
| 63 | 56 | :options="fieldOptions" |
docs/.vitepress/theme/components/settings/Menu.vue
+2 −2
| @@ -4,7 +4,7 @@ import { inject } from 'vue' |
| 4 | 4 | |
| 5 | 5 | import { InjectionKey } from '../../constants' |
| 6 | 6 | import AccentColor from './AccentColor.vue' |
| 7 | | import BlurEffects from './BlurEffects.vue' |
| 7 | import Effects from './Effects.vue' |
| 8 | 8 | import LayoutSwitch from './LayoutSwitch.vue' |
| 9 | 9 | import LayoutSwitchContentLayoutWidthInput from './LayoutSwitchContentLayoutMaxWidthSlider.vue' |
| 10 | 10 | import LayoutSwitchPageLayoutWidthInput from './LayoutSwitchPageLayoutMaxWidthSlider.vue' |
| @@ -31,7 +31,7 @@ const mounted = useMounted() |
| 31 | 31 | <LayoutSwitchContentLayoutWidthInput /> |
| 32 | 32 | <Spotlight v-if="!options.spotlight?.disabled" /> |
| 33 | 33 | <SpotlightStyles v-if="!options.spotlight?.disabled" /> |
| 34 | | <BlurEffects /> |
| 34 | <Effects /> |
| 35 | 35 | <Takodachi /> |
| 36 | 36 | <AccentColor /> |
| 37 | 37 | </div> |
docs/.vitepress/theme/components/settings/ScreenMenu.vue
+2 −2
| @@ -4,7 +4,7 @@ import { useData } from 'vitepress' |
| 4 | 4 | import VPSocialLinks from 'vitepress/dist/client/theme-default/components/VPSocialLinks.vue' |
| 5 | 5 | |
| 6 | 6 | import AccentColor from './AccentColor.vue' |
| 7 | | import BlurEffects from './BlurEffects.vue' |
| 7 | import Effects from './Effects.vue' |
| 8 | 8 | import ScreenAppearance from './ScreenAppearance.vue' |
| 9 | 9 | |
| 10 | 10 | const mounted = useMounted() |
| @@ -13,7 +13,7 @@ const { theme } = useData() |
| 13 | 13 | |
| 14 | 14 | <template> |
| 15 | 15 | <div v-if="mounted" space-y-2 class="VPNolebaseEnhancedReadabilitiesMenu"> |
| 16 | | <BlurEffects /> |
| 16 | <Effects /> |
| 17 | 17 | <ScreenAppearance /> |
| 18 | 18 | <AccentColor /> |
| 19 | 19 | <VPSocialLinks |
docs/.vitepress/theme/components/settings/index.ts
+5 −5
| @@ -2,7 +2,7 @@ import type { Plugin } from 'vue' |
| 2 | 2 | |
| 3 | 3 | import type { Options } from '../../types' |
| 4 | 4 | |
| 5 | | import BlurEffects from './BlurEffects.vue' |
| 5 | import Effects from './Effects.vue' |
| 6 | 6 | import LayoutSwitch from './LayoutSwitch.vue' |
| 7 | 7 | import LayoutSwitchContentLayoutMaxWidthSlider from './LayoutSwitchContentLayoutMaxWidthSlider.vue' |
| 8 | 8 | import LayoutSwitchPageLayoutMaxWidthSlider from './LayoutSwitchPageLayoutMaxWidthSlider.vue' |
| @@ -16,8 +16,8 @@ import SpotlightStyles from './SpotlightStyles.vue' |
| 16 | 16 | import { |
| 17 | 17 | InjectionKey, |
| 18 | 18 | LayoutMode, |
| 19 | EffectsStorageKey, |
| 19 | 20 | LayoutSwitchModeStorageKey, |
| 20 | | LowEndDeviceModeStorageKey, |
| 21 | 21 | SpotlightStyle, |
| 22 | 22 | SpotlightToggledStorageKey |
| 23 | 23 | } from '../../constants' |
| @@ -25,14 +25,14 @@ import { |
| 25 | 25 | export type { Options } |
| 26 | 26 | |
| 27 | 27 | export { |
| 28 | | BlurEffects, |
| 28 | Effects, |
| 29 | EffectsStorageKey, |
| 29 | 30 | InjectionKey, |
| 30 | 31 | LayoutMode, |
| 31 | 32 | LayoutSwitch, |
| 32 | 33 | LayoutSwitchContentLayoutMaxWidthSlider, |
| 33 | 34 | LayoutSwitchModeStorageKey, |
| 34 | 35 | LayoutSwitchPageLayoutMaxWidthSlider, |
| 35 | | LowEndDeviceModeStorageKey, |
| 36 | 36 | NolebaseEnhancedReadabilitiesMenu, |
| 37 | 37 | NolebaseEnhancedReadabilitiesScreenMenu, |
| 38 | 38 | ScreenLayoutSwitch, |
| @@ -44,7 +44,7 @@ export { |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | const components = { |
| 47 | | NolebaseEnhancedReadabilitiesBlurEffects: BlurEffects, |
| 47 | NolebaseEnhancedReadabilitiesEffects: Effects, |
| 48 | 48 | NolebaseEnhancedReadabilitiesMenu, |
| 49 | 49 | NolebaseEnhancedReadabilitiesScreenMenu, |
| 50 | 50 | NolebaseEnhancedReadabilitiesLayoutSwitch: LayoutSwitch, |
docs/.vitepress/theme/composables/useEffects.ts
added
+11
| @@ -0,0 +1,11 @@ |
| 1 | import { useStorage } from '@vueuse/core' |
| 2 | import { computed } from 'vue' |
| 3 | |
| 4 | import { EffectsStorageKey } from '../constants' |
| 5 | |
| 6 | export function useEffects() { |
| 7 | const effects = useStorage(EffectsStorageKey, 'off') |
| 8 | const effectsEnabled = computed(() => effects.value === 'on') |
| 9 | |
| 10 | return { effects, effectsEnabled } |
| 11 | } |
docs/.vitepress/theme/constants.ts
+1 −1
| @@ -26,7 +26,7 @@ export const SpotlightToggledStorageKey = |
| 26 | 26 | export const SpotlightStylesStorageKey = |
| 27 | 27 | 'vitepress-nolebase-enhanced-readabilities-spotlight-styles' |
| 28 | 28 | |
| 29 | | export const LowEndDeviceModeStorageKey = 'preference-low-end-device-mode' |
| 29 | export const EffectsStorageKey = 'preference-effects' |
| 30 | 30 | export const TakodachiStorageKey = 'preference-takodachi' |
| 31 | 31 | export const AccentColorStorageKey = 'preference-accent-color' |
| 32 | 32 | |
docs/.vitepress/theme/styles/style.scss
+18 −2
| @@ -1553,7 +1553,9 @@ table tr:nth-child(odd) { |
| 1553 | 1553 | } |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | | html.reduce-blur-effects { |
| 1556 | // Applied to <html> when the "Effects" preference is off (the default). |
| 1557 | // Strips backdrop blur, view/page transitions and scaling bounces. |
| 1558 | html.effects-disabled { |
| 1557 | 1559 | &::view-transition-group(root), |
| 1558 | 1560 | &::view-transition-new(root), |
| 1559 | 1561 | &::view-transition-old(root) { |
| @@ -1626,10 +1628,24 @@ html.reduce-blur-effects { |
| 1626 | 1628 | .VPSidebarItem.is-link:not(.collapsible), |
| 1627 | 1629 | .VPSidebarItem.is-link.collapsible > .item, |
| 1628 | 1630 | // Search button hover/active scale bounce |
| 1629 | | #local-search > .DocSearch-Button { |
| 1631 | #local-search > .DocSearch-Button, |
| 1632 | // Appearance (dark/light) toggle hover/active scale bounce |
| 1633 | .VPSwitchAppearance { |
| 1630 | 1634 | scale: none !important; |
| 1631 | 1635 | transition: none !important; |
| 1632 | 1636 | } |
| 1637 | |
| 1638 | // Nav-pill button + dropdown panel active/open scale bounces |
| 1639 | .nav-action-btn:active, |
| 1640 | .nav-actions .VPSocialLink:active, |
| 1641 | .VPNolebaseEnhancedReadabilitiesMenuFlyout .button:active, |
| 1642 | .bookmarks-btn:active, |
| 1643 | .bookmarks-panel-enter-from, |
| 1644 | .bookmarks-panel-leave-to, |
| 1645 | .settings-popup-enter-from, |
| 1646 | .settings-popup-leave-to { |
| 1647 | transform: none !important; |
| 1648 | } |
| 1633 | 1649 | } |
| 1634 | 1650 | |
| 1635 | 1651 | /* Icon tooltips (hover on desktop, tap on mobile) */ |