Commit bc846bb516
Unsigned
Layout: unified · split
docs/.vitepress/theme/Layout.vue +3 −5
| @@ -30,10 +30,8 @@ import { sidebar } from '../configs/constants' | ||
| 30 | 30 | import AnnouncementPill from './components/AnnouncementPill.vue' |
| 31 | 31 | import SiteFooter from './components/SiteFooter.vue' |
| 32 | 32 | import NotFoundComponent from './components/NotFound.vue' |
| 33 | import { | |
| 34 | NolebaseEnhancedReadabilitiesMenu, | |
| 35 | NolebaseEnhancedReadabilitiesScreenMenu | |
| 36 | } from './components/settings' | |
| 33 | import { NolebaseEnhancedReadabilitiesScreenMenu } from './components/settings' | |
| 34 | import NavActions from './components/NavActions.vue' | |
| 37 | 35 | import SidebarCard from './components/SidebarCard.vue' |
| 38 | 36 | import { AccentColorStorageKey, LowEndDeviceModeStorageKey, TakodachiStorageKey } from './constants' |
| 39 | 37 | import { v2add, v2mag, v2norm, v2smul, v2sub, type Vec2D } from './math' |
| @@ -1174,7 +1172,7 @@ onUnmounted(() => { | ||
| 1174 | 1172 | <AnnouncementPill /> |
| 1175 | 1173 | </template> |
| 1176 | 1174 | <template #nav-bar-content-after> |
| 1177 | <NolebaseEnhancedReadabilitiesMenu /> | |
| 1175 | <NavActions /> | |
| 1178 | 1176 | </template> |
| 1179 | 1177 | <template #nav-screen-content-before> |
| 1180 | 1178 | <nav v-if="isHome" id="VPSidebarNavMobile" class="home-screen-nav"> |
docs/.vitepress/theme/components/NavActions.vue added +163
| @@ -0,0 +1,163 @@ | ||
| 1 | <script setup lang="ts"> | |
| 2 | import { Moon, Search, Sun } from 'lucide-vue-next' | |
| 3 | import { useData } from 'vitepress' | |
| 4 | // @ts-ignore | |
| 5 | import VPSocialLink from 'vitepress/dist/client/theme-default/components/VPSocialLink.vue' | |
| 6 | import { inject } from 'vue' | |
| 7 | ||
| 8 | import { navActions } from '../navActions' | |
| 9 | import { openSearch } from '../searchState' | |
| 10 | import NolebaseEnhancedReadabilitiesMenu from './settings/Menu.vue' | |
| 11 | ||
| 12 | const ICON_SIZE = 18 | |
| 13 | const ICON_STROKE = 2 | |
| 14 | ||
| 15 | const { isDark } = useData() | |
| 16 | const toggleAppearance = inject<() => void>('toggle-appearance', () => { | |
| 17 | isDark.value = !isDark.value | |
| 18 | }) | |
| 19 | </script> | |
| 20 | ||
| 21 | <template> | |
| 22 | <div class="nav-actions" role="group" aria-label="Site actions"> | |
| 23 | <template v-for="(action, i) in navActions" :key="i"> | |
| 24 | <div class="nav-action" :class="`nav-action--${action.type}`"> | |
| 25 | <button | |
| 26 | v-if="action.type === 'search'" | |
| 27 | type="button" | |
| 28 | class="nav-action-btn" | |
| 29 | aria-label="Search" | |
| 30 | aria-keyshortcuts="/ control+k meta+k" | |
| 31 | @click="openSearch()" | |
| 32 | > | |
| 33 | <Search :size="ICON_SIZE" :stroke-width="ICON_STROKE" /> | |
| 34 | </button> | |
| 35 | ||
| 36 | <button | |
| 37 | v-else-if="action.type === 'appearance'" | |
| 38 | type="button" | |
| 39 | class="nav-action-btn" | |
| 40 | :aria-label="isDark ? 'Switch to light theme' : 'Switch to dark theme'" | |
| 41 | @click="toggleAppearance()" | |
| 42 | > | |
| 43 | <Moon v-if="isDark" :size="ICON_SIZE" :stroke-width="ICON_STROKE" /> | |
| 44 | <Sun v-else :size="ICON_SIZE" :stroke-width="ICON_STROKE" /> | |
| 45 | </button> | |
| 46 | ||
| 47 | <VPSocialLink | |
| 48 | v-else-if="action.type === 'link'" | |
| 49 | :icon="action.icon" | |
| 50 | :link="action.link" | |
| 51 | :aria-label="action.label" | |
| 52 | :me="false" | |
| 53 | /> | |
| 54 | ||
| 55 | <NolebaseEnhancedReadabilitiesMenu v-else-if="action.type === 'settings'" /> | |
| 56 | </div> | |
| 57 | </template> | |
| 58 | </div> | |
| 59 | </template> | |
| 60 | ||
| 61 | <style scoped> | |
| 62 | .nav-actions { | |
| 63 | display: none; | |
| 64 | align-items: center; | |
| 65 | gap: var(--nav-pill-gap); | |
| 66 | height: var(--nav-pill-height); | |
| 67 | padding: 0 var(--nav-pill-pad); | |
| 68 | border-radius: var(--nav-pill-radius); | |
| 69 | background: var(--nav-pill-bg); | |
| 70 | border: 1px solid var(--nav-pill-border); | |
| 71 | backdrop-filter: blur(var(--nav-pill-blur)); | |
| 72 | -webkit-backdrop-filter: blur(var(--nav-pill-blur)); | |
| 73 | transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1); | |
| 74 | } | |
| 75 | ||
| 76 | @media (min-width: 768px) { | |
| 77 | .nav-actions { | |
| 78 | display: flex; | |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | .nav-action { | |
| 83 | flex: 0 0 var(--nav-pill-item-size); | |
| 84 | min-width: 0; | |
| 85 | max-width: var(--nav-pill-item-size); | |
| 86 | display: flex; | |
| 87 | align-items: center; | |
| 88 | justify-content: center; | |
| 89 | } | |
| 90 | ||
| 91 | .nav-action-btn { | |
| 92 | display: flex; | |
| 93 | align-items: center; | |
| 94 | justify-content: center; | |
| 95 | width: 100%; | |
| 96 | height: 100%; | |
| 97 | color: var(--vp-c-text-1); | |
| 98 | opacity: 0.55; | |
| 99 | transition: | |
| 100 | opacity 0.25s, | |
| 101 | transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); | |
| 102 | } | |
| 103 | ||
| 104 | .nav-action-btn:hover { opacity: 1; } | |
| 105 | .nav-action-btn:active { transform: scale(0.94); } | |
| 106 | ||
| 107 | .nav-actions :deep(.VPSocialLink) { | |
| 108 | width: 100% !important; | |
| 109 | height: 100% !important; | |
| 110 | color: var(--vp-c-text-1) !important; | |
| 111 | opacity: 0.55; | |
| 112 | transition: | |
| 113 | opacity 0.25s, | |
| 114 | transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important; | |
| 115 | } | |
| 116 | .nav-actions :deep(.VPSocialLink:hover) { | |
| 117 | color: var(--vp-c-text-1) !important; | |
| 118 | opacity: 1; | |
| 119 | } | |
| 120 | .nav-actions :deep(.VPSocialLink:active) { transform: scale(0.94); } | |
| 121 | .nav-actions :deep(.VPSocialLink > span) { | |
| 122 | width: var(--nav-pill-icon-size) !important; | |
| 123 | height: var(--nav-pill-icon-size) !important; | |
| 124 | } | |
| 125 | ||
| 126 | .nav-action--settings :deep(.VPNolebaseEnhancedReadabilitiesMenuFlyout) { | |
| 127 | display: flex !important; | |
| 128 | width: 100% !important; | |
| 129 | height: 100% !important; | |
| 130 | padding: 0 !important; | |
| 131 | background: transparent !important; | |
| 132 | border: 0 !important; | |
| 133 | border-radius: 0 !important; | |
| 134 | backdrop-filter: none !important; | |
| 135 | -webkit-backdrop-filter: none !important; | |
| 136 | } | |
| 137 | ||
| 138 | .nav-action--settings :deep(.VPNolebaseEnhancedReadabilitiesMenuFlyout .button) { | |
| 139 | width: 100% !important; | |
| 140 | height: auto !important; | |
| 141 | padding: 0 !important; | |
| 142 | display: flex !important; | |
| 143 | justify-content: center !important; | |
| 144 | align-items: center !important; | |
| 145 | color: var(--vp-c-text-1); | |
| 146 | opacity: 0.55; | |
| 147 | transition: opacity 0.25s; | |
| 148 | } | |
| 149 | .nav-action--settings :deep(.VPNolebaseEnhancedReadabilitiesMenuFlyout:hover .button) { | |
| 150 | opacity: 1; | |
| 151 | } | |
| 152 | ||
| 153 | .nav-action--settings :deep(.VPNolebaseEnhancedReadabilitiesMenuFlyout .text) { | |
| 154 | color: var(--vp-c-text-1) !important; | |
| 155 | } | |
| 156 | ||
| 157 | .nav-action--settings :deep(.option-icon) { | |
| 158 | width: var(--nav-pill-icon-size); | |
| 159 | height: var(--nav-pill-icon-size); | |
| 160 | } | |
| 161 | ||
| 162 | .nav-action--settings :deep(.vpi-chevron-down) { display: none; } | |
| 163 | </style> | |
docs/.vitepress/theme/components/NavBarSearch.vue +2 −5
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { onKeyStroke } from '@vueuse/core' |
| 3 | import { defineAsyncComponent, onMounted, onUnmounted, ref } from 'vue' | |
| 3 | import { defineAsyncComponent, onMounted, onUnmounted } from 'vue' | |
| 4 | 4 | |
| 5 | import { AnimatePresence } from 'motion-v' | |
| 5 | import { searchOpen as showSearch } from '../searchState' | |
| 6 | 6 | import VPNavBarSearchButton from './NavBarSearchButton.vue' |
| 7 | 7 | |
| 8 | 8 | const VPLocalSearchBox = defineAsyncComponent(() => import('./Search.vue')) |
| @@ -39,9 +39,6 @@ function isEditingContent(event: KeyboardEvent): boolean { | ||
| 39 | 39 | ) |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | // Local search | |
| 43 | const showSearch = ref(false) | |
| 44 | ||
| 45 | 42 | onKeyStroke('k', (event) => { |
| 46 | 43 | if (event.ctrlKey || event.metaKey) { |
| 47 | 44 | event.preventDefault() |
docs/.vitepress/theme/components/settings/Menu.vue +2 −6
| @@ -18,8 +18,8 @@ const mounted = useMounted() | ||
| 18 | 18 | |
| 19 | 19 | <template> |
| 20 | 20 | <VPFlyout |
| 21 | icon="i-icon-park-outline:setting-two" | |
| 22 | class="VPNolebaseEnhancedReadabilitiesMenu VPNolebaseEnhancedReadabilitiesMenuFlyout h-11 bg-white/80 dark:bg-neutral-900/70 backdrop-blur-lg rounded-r-3xl" | |
| 21 | icon="i-lucide:settings" | |
| 22 | class="VPNolebaseEnhancedReadabilitiesMenu VPNolebaseEnhancedReadabilitiesMenuFlyout" | |
| 23 | 23 | aria-label="Enhanced Readability" |
| 24 | 24 | role="menuitem" |
| 25 | 25 | > |
| @@ -62,10 +62,6 @@ const mounted = useMounted() | ||
| 62 | 62 | transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | .VPNolebaseEnhancedReadabilitiesMenuFlyout::before { | |
| 66 | --uno: "pr-1.5! pl-1.5!"; | |
| 67 | } | |
| 68 | ||
| 69 | 65 | @media (min-width: 768px) { |
| 70 | 66 | .VPNolebaseEnhancedReadabilitiesMenuFlyout { |
| 71 | 67 | display: flex; |
docs/.vitepress/theme/navActions.ts added +48
| @@ -0,0 +1,48 @@ | ||
| 1 | export type NavBreakpoint = 'sm' | 'md' | 'lg' | 'xl' | |
| 2 | ||
| 3 | interface NavActionBase { | |
| 4 | hideBelow?: NavBreakpoint | |
| 5 | } | |
| 6 | ||
| 7 | export interface NavSearchAction extends NavActionBase { | |
| 8 | type: 'search' | |
| 9 | } | |
| 10 | ||
| 11 | export interface NavAppearanceAction extends NavActionBase { | |
| 12 | type: 'appearance' | |
| 13 | } | |
| 14 | ||
| 15 | export interface NavSettingsAction extends NavActionBase { | |
| 16 | type: 'settings' | |
| 17 | } | |
| 18 | ||
| 19 | export interface NavLinkAction extends NavActionBase { | |
| 20 | type: 'link' | |
| 21 | icon: string | |
| 22 | link: string | |
| 23 | label: string | |
| 24 | } | |
| 25 | ||
| 26 | export type NavAction = | |
| 27 | | NavSearchAction | |
| 28 | | NavAppearanceAction | |
| 29 | | NavSettingsAction | |
| 30 | | NavLinkAction | |
| 31 | ||
| 32 | export const navActions: NavAction[] = [ | |
| 33 | { type: 'search' }, | |
| 34 | { type: 'appearance' }, | |
| 35 | { | |
| 36 | type: 'link', | |
| 37 | icon: 'github', | |
| 38 | link: 'https://github.com/wotakumoe/Wotaku', | |
| 39 | label: 'GitHub' | |
| 40 | }, | |
| 41 | { | |
| 42 | type: 'link', | |
| 43 | icon: 'discord', | |
| 44 | link: 'https://discord.gg/vShRGx8ZBC', | |
| 45 | label: 'Discord' | |
| 46 | }, | |
| 47 | { type: 'settings' } | |
| 48 | ] | |
docs/.vitepress/theme/searchState.ts added +7
| @@ -0,0 +1,7 @@ | ||
| 1 | import { ref } from 'vue' | |
| 2 | ||
| 3 | export const searchOpen = ref(false) | |
| 4 | ||
| 5 | export function openSearch() { | |
| 6 | searchOpen.value = true | |
| 7 | } | |
docs/.vitepress/theme/styles/style.scss +32 −33
| @@ -105,6 +105,21 @@ $ease-in-expo: cubic-bezier(0.7, 0, 0.84, 0); | ||
| 105 | 105 | var(--vp-c-brand-soft) 15%, |
| 106 | 106 | transparent 100% |
| 107 | 107 | ); |
| 108 | ||
| 109 | --nav-pill-height: 2.5rem; | |
| 110 | --nav-pill-radius: 1.5rem; | |
| 111 | --nav-pill-item-size: 1.875rem; | |
| 112 | --nav-pill-gap: 0.125rem; | |
| 113 | --nav-pill-pad: 0.125rem; | |
| 114 | --nav-pill-icon-size: 18px; | |
| 115 | --nav-pill-blur: 12px; | |
| 116 | --nav-pill-bg: rgb(255 255 255 / 0.8); | |
| 117 | --nav-pill-border: rgb(64 64 64 / 0.08); | |
| 118 | } | |
| 119 | ||
| 120 | .dark { | |
| 121 | --nav-pill-bg: rgb(23 23 23 / 0.7); | |
| 122 | --nav-pill-border: rgb(212 212 212 / 0.1); | |
| 108 | 123 | } |
| 109 | 124 | |
| 110 | 125 | .dark { |
| @@ -1111,7 +1126,6 @@ table tr:nth-child(odd) { | ||
| 1111 | 1126 | } |
| 1112 | 1127 | } |
| 1113 | 1128 | |
| 1114 | /* navbar left side group in order */ | |
| 1115 | 1129 | .VPNavBarMenu.menu { |
| 1116 | 1130 | @apply h-11 rounded-l-3xl; |
| 1117 | 1131 | |
| @@ -1133,48 +1147,32 @@ table tr:nth-child(odd) { | ||
| 1133 | 1147 | } |
| 1134 | 1148 | } |
| 1135 | 1149 | |
| 1136 | .VPNavBarAppearance.appearance { | |
| 1137 | @apply h-11 bg-white/80 dark:bg-neutral-900/70 backdrop-blur-lg rounded-l-3xl; | |
| 1138 | ||
| 1139 | &::before { | |
| 1140 | @apply hidden; | |
| 1141 | } | |
| 1142 | } | |
| 1143 | ||
| 1150 | .VPNavBarAppearance.appearance, | |
| 1144 | 1151 | .VPSocialLinks.VPNavBarSocialLinks.social-links { |
| 1145 | @apply h-11 pr-0! pl-1.5! bg-white/80 dark:bg-neutral-900/70 backdrop-blur-lg; | |
| 1152 | @apply hidden!; | |
| 1146 | 1153 | } |
| 1147 | 1154 | |
| 1148 | /* ... mobile */ | |
| 1149 | .VPFlyout.VPNavBarExtra.extra { | |
| 1150 | @apply h-11 bg-white/80 dark:bg-neutral-900/70; | |
| 1151 | ||
| 1152 | & > .button { | |
| 1153 | @apply h-10.5 backdrop-blur-lg rounded-r-3xl!; | |
| 1155 | @media (min-width: 768px) { | |
| 1156 | .VPFlyout.VPNavBarExtra.extra { | |
| 1157 | @apply hidden!; | |
| 1154 | 1158 | } |
| 1155 | 1159 | } |
| 1156 | 1160 | |
| 1157 | /* end navbar leftside group */ | |
| 1158 | ||
| 1159 | 1161 | #local-search { |
| 1160 | 1162 | & > .DocSearch-Button { |
| 1161 | 1163 | @apply hover:scale-[1.03] focus:scale-[1.03] active:scale-[0.98] |
| 1162 | h-10 rounded-xl backdrop-blur-sm lg:ml-2 sm:bg-red-50; | |
| 1164 | h-10 rounded-xl backdrop-blur-sm lg:ml-2; | |
| 1163 | 1165 | transition: scale 150ms ease !important; |
| 1164 | 1166 | color: var(--docsearch-secondary-text-color); |
| 1165 | 1167 | |
| 1166 | @media (width >= 40rem /* 640px */) { | |
| 1167 | background-color: var(--vp-c-bg-soft); | |
| 1168 | } | |
| 1169 | ||
| 1170 | 1168 | & > .DocSearch-Button-Container { |
| 1171 | 1169 | & > .DocSearch-Button-Placeholder { |
| 1172 | @apply pl-2 pr-3 hidden sm:inline; | |
| 1170 | @apply hidden!; | |
| 1173 | 1171 | } |
| 1174 | 1172 | } |
| 1175 | 1173 | |
| 1176 | 1174 | & > .DocSearch-Button-Keys { |
| 1177 | @apply py-0.75 -translate-y-1 hidden sm:inline; | |
| 1175 | @apply hidden!; | |
| 1178 | 1176 | } |
| 1179 | 1177 | } |
| 1180 | 1178 | } |
| @@ -1184,14 +1182,6 @@ table tr:nth-child(odd) { | ||
| 1184 | 1182 | @apply active:scale-[0.98] transition-all!; |
| 1185 | 1183 | } |
| 1186 | 1184 | |
| 1187 | .VPSocialLinks.VPNavBarSocialLinks.social-links { | |
| 1188 | @apply pl-2.5; | |
| 1189 | ||
| 1190 | &::before { | |
| 1191 | @apply hidden; | |
| 1192 | } | |
| 1193 | } | |
| 1194 | ||
| 1195 | 1185 | .VPDocAside { |
| 1196 | 1186 | & > .VPDocAsideOutline > .content { |
| 1197 | 1187 | @apply pl-0 border-l-0; |
| @@ -1270,6 +1260,12 @@ table tr:nth-child(odd) { | ||
| 1270 | 1260 | @apply ml-2 pl-0!; |
| 1271 | 1261 | } |
| 1272 | 1262 | |
| 1263 | @media (min-width: 768px) { | |
| 1264 | #local-search { | |
| 1265 | @apply hidden!; | |
| 1266 | } | |
| 1267 | } | |
| 1268 | ||
| 1273 | 1269 | %thin-scrollbar { |
| 1274 | 1270 | scrollbar-width: thin; |
| 1275 | 1271 | &::-webkit-scrollbar { |
| @@ -1495,6 +1491,7 @@ html.reduce-blur-effects { | ||
| 1495 | 1491 | .VPFlyout.VPNavBarExtra.extra > .button, |
| 1496 | 1492 | #local-search > .DocSearch-Button, |
| 1497 | 1493 | .VPNolebaseEnhancedReadabilitiesMenuFlyout, |
| 1494 | .nav-actions, | |
| 1498 | 1495 | .VPNavScreen:has(.home-screen-nav) { |
| 1499 | 1496 | backdrop-filter: none !important; |
| 1500 | 1497 | -webkit-backdrop-filter: none !important; |
| @@ -1511,6 +1508,7 @@ html.reduce-blur-effects { | ||
| 1511 | 1508 | .VPNavBarAppearance.appearance, |
| 1512 | 1509 | .VPSocialLinks.VPNavBarSocialLinks.social-links, |
| 1513 | 1510 | .VPNolebaseEnhancedReadabilitiesMenuFlyout, |
| 1511 | .nav-actions, | |
| 1514 | 1512 | .VPFlyout.VPNavBarExtra.extra, |
| 1515 | 1513 | .VPNavScreen:has(.home-screen-nav) { |
| 1516 | 1514 | background-color: var(--vp-c-bg) !important; |
| @@ -1519,6 +1517,7 @@ html.reduce-blur-effects { | ||
| 1519 | 1517 | &.dark { |
| 1520 | 1518 | .VPNavBarAppearance.appearance, |
| 1521 | 1519 | .VPSocialLinks.VPNavBarSocialLinks.social-links, |
| 1520 | .nav-actions, | |
| 1522 | 1521 | .VPNolebaseEnhancedReadabilitiesMenuFlyout { |
| 1523 | 1522 | background-color: #151617 !important; |
| 1524 | 1523 | } |
unocss.config.ts +2 −1
| @@ -74,7 +74,8 @@ const safelist = [ | ||
| 74 | 74 | 'i-lucide:heart', |
| 75 | 75 | 'i-lucide:message-circle', |
| 76 | 76 | 'i-lucide:copy', |
| 77 | 'i-lucide:check' | |
| 77 | 'i-lucide:check', | |
| 78 | 'i-lucide:settings' | |
| 78 | 79 | ] |
| 79 | 80 | |
| 80 | 81 | export default defineConfig({ |