Commit e8e1248194
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/HomeFeatures.vue +73 −21
| @@ -89,6 +89,7 @@ const dropdownOpen = ref(false) | ||
| 89 | 89 | type HelpSection = 'view' | 'columns' |
| 90 | 90 | const activeHelpSection = ref<HelpSection | null>(null) |
| 91 | 91 | const helpPopupEl = ref<HTMLDivElement | null>(null) |
| 92 | const settingsDropdownEl = ref<HTMLDivElement | null>(null) | |
| 92 | 93 | const helpPopupPos = ref({ top: -9999, left: -9999 }) |
| 93 | 94 | |
| 94 | 95 | watch(dropdownOpen, (val) => { |
| @@ -98,27 +99,67 @@ watch(dropdownOpen, (val) => { | ||
| 98 | 99 | } |
| 99 | 100 | }) |
| 100 | 101 | |
| 101 | function toggleHelpSection(section: HelpSection, e: MouseEvent) { | |
| 102 | if (activeHelpSection.value === section) { | |
| 103 | activeHelpSection.value = null | |
| 104 | helpPopupPos.value = { top: -9999, left: -9999 } | |
| 105 | return | |
| 106 | } | |
| 107 | activeHelpSection.value = section | |
| 102 | const canHoverHelp = () => | |
| 103 | typeof window !== 'undefined' && window.matchMedia('(hover: hover)').matches | |
| 104 | ||
| 105 | function positionHelpPopup(btn: HTMLElement) { | |
| 108 | 106 | helpPopupPos.value = { top: -9999, left: -9999 } |
| 109 | const btn = e.currentTarget as HTMLElement | |
| 110 | 107 | const rect = btn.getBoundingClientRect() |
| 108 | // Anchor to the dropdown's left edge so the popup sits beside it, not over it. | |
| 109 | const menuRect = settingsDropdownEl.value?.getBoundingClientRect() | |
| 111 | 110 | nextTick(() => { |
| 112 | const popupW = helpPopupEl.value?.offsetWidth || 220 | |
| 113 | const popupH = helpPopupEl.value?.offsetHeight || 160 | |
| 111 | const popupW = helpPopupEl.value?.offsetWidth || 260 | |
| 112 | const popupH = helpPopupEl.value?.offsetHeight || 200 | |
| 113 | const vw = window.innerWidth | |
| 114 | 114 | const margin = 8 |
| 115 | helpPopupPos.value = { | |
| 116 | left: Math.max(margin, rect.left - popupW - 8), | |
| 117 | top: Math.max(margin, Math.min(rect.top, window.innerHeight - popupH - margin)), | |
| 115 | const isMobile = vw < 768 | |
| 116 | if (isMobile) { | |
| 117 | const aboveTop = rect.top - popupH - margin | |
| 118 | const belowTop = rect.bottom + margin | |
| 119 | const top = aboveTop >= margin ? aboveTop : belowTop | |
| 120 | const left = Math.max(margin, Math.min((vw - popupW) / 2, vw - popupW - margin)) | |
| 121 | helpPopupPos.value = { top, left } | |
| 122 | } else { | |
| 123 | const anchorLeft = menuRect ? menuRect.left : rect.left | |
| 124 | helpPopupPos.value = { | |
| 125 | left: Math.max(margin, anchorLeft - popupW - 16), | |
| 126 | top: Math.max(margin, Math.min(rect.top, window.innerHeight - popupH - margin)), | |
| 127 | } | |
| 118 | 128 | } |
| 119 | 129 | }) |
| 120 | 130 | } |
| 121 | 131 | |
| 132 | function closeHelpSection() { | |
| 133 | activeHelpSection.value = null | |
| 134 | helpPopupPos.value = { top: -9999, left: -9999 } | |
| 135 | } | |
| 136 | ||
| 137 | function toggleHelpSection(section: HelpSection, e: MouseEvent) { | |
| 138 | // Hover devices open/close via mouseenter/leave; touch devices toggle on tap. | |
| 139 | if (canHoverHelp()) { | |
| 140 | activeHelpSection.value = section | |
| 141 | positionHelpPopup(e.currentTarget as HTMLElement) | |
| 142 | return | |
| 143 | } | |
| 144 | if (activeHelpSection.value === section) { | |
| 145 | closeHelpSection() | |
| 146 | return | |
| 147 | } | |
| 148 | activeHelpSection.value = section | |
| 149 | positionHelpPopup(e.currentTarget as HTMLElement) | |
| 150 | } | |
| 151 | ||
| 152 | function onHelpEnter(section: HelpSection, e: MouseEvent) { | |
| 153 | if (!canHoverHelp()) return | |
| 154 | activeHelpSection.value = section | |
| 155 | positionHelpPopup(e.currentTarget as HTMLElement) | |
| 156 | } | |
| 157 | ||
| 158 | function onHelpLeave() { | |
| 159 | if (!canHoverHelp()) return | |
| 160 | closeHelpSection() | |
| 161 | } | |
| 162 | ||
| 122 | 163 | watch(panelOpen, (open) => { |
| 123 | 164 | if (typeof document !== 'undefined') |
| 124 | 165 | document.body.style.overflow = open ? 'hidden' : '' |
| @@ -387,18 +428,18 @@ function onHandlePointerUp() { | ||
| 387 | 428 | <div class="foot-group"> |
| 388 | 429 | <div class="settings-wrap"> |
| 389 | 430 | <div v-if="dropdownOpen" class="dropdown-overlay" @click="dropdownOpen = false" /> |
| 390 | <div v-if="dropdownOpen" class="settings-dropdown"> | |
| 431 | <div v-if="dropdownOpen" ref="settingsDropdownEl" class="settings-dropdown"> | |
| 391 | 432 | <div class="dropdown-section"> |
| 392 | 433 | <div class="dropdown-section-header"> |
| 393 | 434 | <span class="dropdown-label"> |
| 394 | 435 | <span class="i-lucide-layout-list dropdown-label-icon" /> |
| 395 | 436 | View |
| 396 | 437 | </span> |
| 397 | <button type="button" class="settings-help-btn" :class="{ active: activeHelpSection === 'view' }" aria-label="View help" @click.stop="toggleHelpSection('view', $event)"> | |
| 438 | <button type="button" class="settings-help-btn" :class="{ active: activeHelpSection === 'view' }" aria-label="View help" @click.stop="toggleHelpSection('view', $event)" @mouseenter="onHelpEnter('view', $event)" @mouseleave="onHelpLeave"> | |
| 398 | 439 | <span class="i-carbon:help-filled settings-help-icon" /> |
| 399 | 440 | </button> |
| 400 | 441 | </div> |
| 401 | <div class="dropdown-group"> | |
| 442 | <div class="dropdown-group" :class="{ 'is-highlighted': activeHelpSection === 'view' }"> | |
| 402 | 443 | <button class="tool-btn" :class="{ 'is-active': viewMode === 'default' }" @click="viewMode = 'default'">Default</button> |
| 403 | 444 | <button class="tool-btn" :class="{ 'is-active': viewMode === 'mini' }" @click="viewMode = 'mini'">Mini</button> |
| 404 | 445 | </div> |
| @@ -409,11 +450,11 @@ function onHandlePointerUp() { | ||
| 409 | 450 | <span class="i-lucide-columns-3-cog dropdown-label-icon" /> |
| 410 | 451 | Columns |
| 411 | 452 | </span> |
| 412 | <button type="button" class="settings-help-btn" :class="{ active: activeHelpSection === 'columns' }" aria-label="Columns help" @click.stop="toggleHelpSection('columns', $event)"> | |
| 453 | <button type="button" class="settings-help-btn" :class="{ active: activeHelpSection === 'columns' }" aria-label="Columns help" @click.stop="toggleHelpSection('columns', $event)" @mouseenter="onHelpEnter('columns', $event)" @mouseleave="onHelpLeave"> | |
| 413 | 454 | <span class="i-carbon:help-filled settings-help-icon" /> |
| 414 | 455 | </button> |
| 415 | 456 | </div> |
| 416 | <div class="dropdown-group"> | |
| 457 | <div class="dropdown-group" :class="{ 'is-highlighted': activeHelpSection === 'columns' }"> | |
| 417 | 458 | <button class="tool-btn" :class="{ 'is-active': columnMode === 'default' }" @click="columnMode = 'default'">Default</button> |
| 418 | 459 | <button class="tool-btn" :class="{ 'is-active': columnMode === 'max' }" @click="columnMode = 'max'">Max</button> |
| 419 | 460 | </div> |
| @@ -1141,8 +1182,8 @@ html.effects-disabled .row-toggle:active { | ||
| 1141 | 1182 | |
| 1142 | 1183 | .settings-help-icon { |
| 1143 | 1184 | display: block; |
| 1144 | width: 14px; | |
| 1145 | height: 14px; | |
| 1185 | width: 16px; | |
| 1186 | height: 16px; | |
| 1146 | 1187 | } |
| 1147 | 1188 | |
| 1148 | 1189 | .home-help-popup { |
| @@ -1201,11 +1242,15 @@ html.effects-disabled .row-toggle:active { | ||
| 1201 | 1242 | display: flex; |
| 1202 | 1243 | flex-direction: column; |
| 1203 | 1244 | gap: 4px; |
| 1204 | background: var(--vp-c-bg-soft); | |
| 1245 | background: #e8e6ec; | |
| 1205 | 1246 | border-radius: 12px; |
| 1206 | 1247 | padding: 10px 12px; |
| 1207 | 1248 | } |
| 1208 | 1249 | |
| 1250 | .dark .sh-option { | |
| 1251 | background: #2c2c31; | |
| 1252 | } | |
| 1253 | ||
| 1209 | 1254 | .sh-option strong { |
| 1210 | 1255 | display: flex; |
| 1211 | 1256 | align-items: center; |
| @@ -1290,6 +1335,13 @@ html.effects-disabled .row-toggle:active { | ||
| 1290 | 1335 | background: var(--seg-track); |
| 1291 | 1336 | border-radius: 8px; |
| 1292 | 1337 | padding: 4px; |
| 1338 | outline: 2px dashed transparent; | |
| 1339 | outline-offset: 4px; | |
| 1340 | transition: outline-color 0.2s ease; | |
| 1341 | } | |
| 1342 | ||
| 1343 | .dropdown-group.is-highlighted { | |
| 1344 | outline-color: var(--vp-c-brand-1); | |
| 1293 | 1345 | } |
| 1294 | 1346 | |
| 1295 | 1347 | .dropdown-group .tool-btn { |
docs/.vitepress/theme/components/Search.vue +77 −16
| @@ -356,16 +356,14 @@ watch(showSettingsPopup, (val) => { | ||
| 356 | 356 | } |
| 357 | 357 | }) |
| 358 | 358 | |
| 359 | function toggleHelpSection(section: HelpSection, e: MouseEvent) { | |
| 360 | if (activeHelpSection.value === section) { | |
| 361 | activeHelpSection.value = null | |
| 362 | helpPopupPos.value = { top: -9999, left: -9999 } | |
| 363 | return | |
| 364 | } | |
| 365 | activeHelpSection.value = section | |
| 359 | const canHoverHelp = () => | |
| 360 | typeof window !== 'undefined' && window.matchMedia('(hover: hover)').matches | |
| 361 | ||
| 362 | function positionHelpPopup(btn: HTMLElement) { | |
| 366 | 363 | helpPopupPos.value = { top: -9999, left: -9999 } |
| 367 | const btn = e.currentTarget as HTMLElement | |
| 368 | 364 | const rect = btn.getBoundingClientRect() |
| 365 | // Anchor to the menu's left edge so the popup sits beside it, not over it. | |
| 366 | const menuRect = settingsPopupRef.value?.getBoundingClientRect() | |
| 369 | 367 | nextTick(() => { |
| 370 | 368 | const popupW = helpPopupEl.value?.offsetWidth || 260 |
| 371 | 369 | const popupH = helpPopupEl.value?.offsetHeight || 200 |
| @@ -379,14 +377,46 @@ function toggleHelpSection(section: HelpSection, e: MouseEvent) { | ||
| 379 | 377 | const left = Math.max(margin, Math.min((vw - popupW) / 2, vw - popupW - margin)) |
| 380 | 378 | helpPopupPos.value = { top, left } |
| 381 | 379 | } else { |
| 380 | const anchorLeft = menuRect ? menuRect.left : rect.left | |
| 382 | 381 | helpPopupPos.value = { |
| 383 | left: Math.max(margin, rect.left - popupW - 16), | |
| 382 | left: Math.max(margin, anchorLeft - popupW - 16), | |
| 384 | 383 | top: rect.top, |
| 385 | 384 | } |
| 386 | 385 | } |
| 387 | 386 | }) |
| 388 | 387 | } |
| 389 | 388 | |
| 389 | function closeHelpSection() { | |
| 390 | activeHelpSection.value = null | |
| 391 | helpPopupPos.value = { top: -9999, left: -9999 } | |
| 392 | } | |
| 393 | ||
| 394 | function toggleHelpSection(section: HelpSection, e: MouseEvent) { | |
| 395 | // Hover devices open/close via mouseenter/leave; touch devices toggle on tap. | |
| 396 | if (canHoverHelp()) { | |
| 397 | activeHelpSection.value = section | |
| 398 | positionHelpPopup(e.currentTarget as HTMLElement) | |
| 399 | return | |
| 400 | } | |
| 401 | if (activeHelpSection.value === section) { | |
| 402 | closeHelpSection() | |
| 403 | return | |
| 404 | } | |
| 405 | activeHelpSection.value = section | |
| 406 | positionHelpPopup(e.currentTarget as HTMLElement) | |
| 407 | } | |
| 408 | ||
| 409 | function onHelpEnter(section: HelpSection, e: MouseEvent) { | |
| 410 | if (!canHoverHelp()) return | |
| 411 | activeHelpSection.value = section | |
| 412 | positionHelpPopup(e.currentTarget as HTMLElement) | |
| 413 | } | |
| 414 | ||
| 415 | function onHelpLeave() { | |
| 416 | if (!canHoverHelp()) return | |
| 417 | closeHelpSection() | |
| 418 | } | |
| 419 | ||
| 390 | 420 | const settingsPopupStyle = computed(() => ({ |
| 391 | 421 | top: `${settingsBounding.bottom.value + 8}px`, |
| 392 | 422 | right: `calc(100vw - ${settingsBounding.right.value}px)`, |
| @@ -2577,11 +2607,16 @@ function onMouseMove(e: MouseEvent) { | ||
| 2577 | 2607 | :class="{ active: activeHelpSection === 'search' }" |
| 2578 | 2608 | aria-label="Search mode help" |
| 2579 | 2609 | @click.stop="toggleHelpSection('search', $event)" |
| 2610 | @mouseenter="onHelpEnter('search', $event)" | |
| 2611 | @mouseleave="onHelpLeave" | |
| 2580 | 2612 | > |
| 2581 | 2613 | <span class="i-carbon:help-filled settings-help-icon" /> |
| 2582 | 2614 | </button> |
| 2583 | 2615 | </div> |
| 2584 | <div class="settings-options"> | |
| 2616 | <div | |
| 2617 | class="settings-options" | |
| 2618 | :class="{ 'is-highlighted': activeHelpSection === 'search' }" | |
| 2619 | > | |
| 2585 | 2620 | <button |
| 2586 | 2621 | type="button" |
| 2587 | 2622 | class="settings-option" |
| @@ -2623,11 +2658,16 @@ function onMouseMove(e: MouseEvent) { | ||
| 2623 | 2658 | :class="{ active: activeHelpSection === 'view' }" |
| 2624 | 2659 | aria-label="Result view help" |
| 2625 | 2660 | @click.stop="toggleHelpSection('view', $event)" |
| 2661 | @mouseenter="onHelpEnter('view', $event)" | |
| 2662 | @mouseleave="onHelpLeave" | |
| 2626 | 2663 | > |
| 2627 | 2664 | <span class="i-carbon:help-filled settings-help-icon" /> |
| 2628 | 2665 | </button> |
| 2629 | 2666 | </div> |
| 2630 | <div class="settings-options"> | |
| 2667 | <div | |
| 2668 | class="settings-options" | |
| 2669 | :class="{ 'is-highlighted': activeHelpSection === 'view' }" | |
| 2670 | > | |
| 2631 | 2671 | <button |
| 2632 | 2672 | type="button" |
| 2633 | 2673 | class="settings-option" |
| @@ -2662,11 +2702,16 @@ function onMouseMove(e: MouseEvent) { | ||
| 2662 | 2702 | :class="{ active: activeHelpSection === 'preload' }" |
| 2663 | 2703 | aria-label="Excerpt preload help" |
| 2664 | 2704 | @click.stop="toggleHelpSection('preload', $event)" |
| 2705 | @mouseenter="onHelpEnter('preload', $event)" | |
| 2706 | @mouseleave="onHelpLeave" | |
| 2665 | 2707 | > |
| 2666 | 2708 | <span class="i-carbon:help-filled settings-help-icon" /> |
| 2667 | 2709 | </button> |
| 2668 | 2710 | </div> |
| 2669 | <div class="settings-options"> | |
| 2711 | <div | |
| 2712 | class="settings-options" | |
| 2713 | :class="{ 'is-highlighted': activeHelpSection === 'preload' }" | |
| 2714 | > | |
| 2670 | 2715 | <button |
| 2671 | 2716 | type="button" |
| 2672 | 2717 | class="settings-option" |
| @@ -2705,11 +2750,16 @@ function onMouseMove(e: MouseEvent) { | ||
| 2705 | 2750 | :class="{ active: activeHelpSection === 'history' }" |
| 2706 | 2751 | aria-label="Search history help" |
| 2707 | 2752 | @click.stop="toggleHelpSection('history', $event)" |
| 2753 | @mouseenter="onHelpEnter('history', $event)" | |
| 2754 | @mouseleave="onHelpLeave" | |
| 2708 | 2755 | > |
| 2709 | 2756 | <span class="i-carbon:help-filled settings-help-icon" /> |
| 2710 | 2757 | </button> |
| 2711 | 2758 | </div> |
| 2712 | <div class="settings-options"> | |
| 2759 | <div | |
| 2760 | class="settings-options" | |
| 2761 | :class="{ 'is-highlighted': activeHelpSection === 'history' }" | |
| 2762 | > | |
| 2713 | 2763 | <button |
| 2714 | 2764 | type="button" |
| 2715 | 2765 | class="settings-option" |
| @@ -3638,8 +3688,8 @@ html.effects-disabled .clear-button:active { | ||
| 3638 | 3688 | |
| 3639 | 3689 | .settings-help-icon { |
| 3640 | 3690 | display: block; |
| 3641 | width: 14px; | |
| 3642 | height: 14px; | |
| 3691 | width: 16px; | |
| 3692 | height: 16px; | |
| 3643 | 3693 | } |
| 3644 | 3694 | |
| 3645 | 3695 | /* Help popup */ |
| @@ -3699,11 +3749,15 @@ html.effects-disabled .clear-button:active { | ||
| 3699 | 3749 | display: flex; |
| 3700 | 3750 | flex-direction: column; |
| 3701 | 3751 | gap: 4px; |
| 3702 | background: var(--vp-c-bg-soft); | |
| 3752 | background: #e8e6ec; | |
| 3703 | 3753 | border-radius: 12px; |
| 3704 | 3754 | padding: 10px 12px; |
| 3705 | 3755 | } |
| 3706 | 3756 | |
| 3757 | .dark .sh-option { | |
| 3758 | background: #2c2c31; | |
| 3759 | } | |
| 3760 | ||
| 3707 | 3761 | .sh-option strong { |
| 3708 | 3762 | display: flex; |
| 3709 | 3763 | align-items: center; |
| @@ -3725,6 +3779,13 @@ html.effects-disabled .clear-button:active { | ||
| 3725 | 3779 | background: var(--seg-track); |
| 3726 | 3780 | border-radius: 8px; |
| 3727 | 3781 | padding: 4px; |
| 3782 | outline: 2px dashed transparent; | |
| 3783 | outline-offset: 4px; | |
| 3784 | transition: outline-color 0.2s ease; | |
| 3785 | } | |
| 3786 | ||
| 3787 | .settings-options.is-highlighted { | |
| 3788 | outline-color: var(--vp-c-brand-1); | |
| 3728 | 3789 | } |
| 3729 | 3790 | |
| 3730 | 3791 | .settings-option { |
docs/.vitepress/theme/components/settings/MenuHelp.vue +12 −2
| @@ -28,6 +28,12 @@ watch(isHovered, (val) => { | ||
| 28 | 28 | const bounding = useElementBounding(menuTitleElementRef) |
| 29 | 29 | const popupBounding = useElementBounding(popupElementRef) |
| 30 | 30 | |
| 31 | // Enclosing flyout panel — anchor the popup to its outer left edge. | |
| 32 | const menuPanelRef = computed( | |
| 33 | () => (menuTitleElementRef.value?.closest('.VPMenu') as HTMLElement | null) ?? undefined | |
| 34 | ) | |
| 35 | const menuBounding = useElementBounding(menuPanelRef) | |
| 36 | ||
| 31 | 37 | const helpPopupStyle = computed(() => { |
| 32 | 38 | const margin = 8 |
| 33 | 39 | const popupW = popupBounding.width.value |
| @@ -50,8 +56,11 @@ const helpPopupStyle = computed(() => { | ||
| 50 | 56 | : Math.max(margin, vh - popupH - margin) |
| 51 | 57 | left = Math.max(margin, Math.min((vw - popupW) / 2, vw - popupW - margin)) |
| 52 | 58 | } else { |
| 53 | // Desktop: place to the left of the menu title, aligned vertically | |
| 54 | left = bounding.left.value - popupW - 16 | |
| 59 | // Desktop: place to the left of the menu panel, aligned vertically | |
| 60 | const anchorLeft = menuBounding.width.value | |
| 61 | ? menuBounding.left.value | |
| 62 | : bounding.left.value | |
| 63 | left = Math.max(margin, anchorLeft - popupW - 16) | |
| 55 | 64 | top = bounding.top.value |
| 56 | 65 | } |
| 57 | 66 | |
| @@ -85,6 +94,7 @@ watch( | ||
| 85 | 94 | () => { |
| 86 | 95 | bounding.update() |
| 87 | 96 | popupBounding.update() |
| 97 | menuBounding.update() | |
| 88 | 98 | }, |
| 89 | 99 | { |
| 90 | 100 | flush: 'pre' |