Commit e61669d172
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/extrepo/BrokenFilter.vue +31 −10
| @@ -1,7 +1,8 @@ | |||
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | import { NuInputHorizontalRadioGroup } from '@nolebase/ui' | 2 | import { NuInputHighlight, NuInputHorizontalRadioGroup } from '@nolebase/ui' |
| 3 | import { computed } from 'vue' | 3 | import { computed, ref } from 'vue' |
| 4 | import MenuTitle from './MenuTitle.vue' | 4 | import MenuHelp from '../settings/MenuHelp.vue' |
| 5 | import MenuTitle from '../settings/MenuTitle.vue' | ||
| 5 | 6 | ||
| 6 | const props = defineProps<{ | 7 | const props = defineProps<{ |
| 7 | modelValue: boolean | 8 | modelValue: boolean |
| @@ -11,6 +12,9 @@ const emit = defineEmits<{ | |||
| 11 | 'update:modelValue': [value: boolean] | 12 | 'update:modelValue': [value: boolean] |
| 12 | }>() | 13 | }>() |
| 13 | 14 | ||
| 15 | const menuTitleElementRef = ref<HTMLDivElement>() | ||
| 16 | const isMenuHelpPoppedUp = ref(false) | ||
| 17 | |||
| 14 | const options = [ | 18 | const options = [ |
| 15 | { value: 'on', title: 'On', ariaLabel: 'On', text: 'ON', name: 'ShowBroken' }, | 19 | { value: 'on', title: 'On', ariaLabel: 'On', text: 'ON', name: 'ShowBroken' }, |
| 16 | { value: 'off', title: 'Off', ariaLabel: 'Off', text: 'OFF', name: 'ShowBroken' } | 20 | { value: 'off', title: 'Off', ariaLabel: 'Off', text: 'OFF', name: 'ShowBroken' } |
| @@ -24,12 +28,29 @@ const showBroken = computed({ | |||
| 24 | 28 | ||
| 25 | <template> | 29 | <template> |
| 26 | <div class="ext-broken" role="radiogroup"> | 30 | <div class="ext-broken" role="radiogroup"> |
| 27 | <MenuTitle icon="i-lucide:unlink" title="Show broken urls" /> | 31 | <div ref="menuTitleElementRef" relative flex items-center mb-2> |
| 28 | <NuInputHorizontalRadioGroup | 32 | <MenuTitle title="Show broken urls" aria-label="Show broken urls" flex="1" pr-4> |
| 29 | v-model="showBroken" | 33 | <template #icon> |
| 30 | bg="$vp-nolebase-enhanced-readabilities-menu-background-color" | 34 | <span i-lucide:unlink mr-1 aria-hidden="true" /> |
| 31 | text="sm $vp-nolebase-enhanced-readabilities-menu-text-color" | 35 | </template> |
| 32 | :options="options" | 36 | </MenuTitle> |
| 33 | /> | 37 | <MenuHelp |
| 38 | v-model:is-popped-up="isMenuHelpPoppedUp" | ||
| 39 | :menu-title-element-ref="menuTitleElementRef" | ||
| 40 | > | ||
| 41 | <h4 text-md mb-1 font-semibold>Show Broken Urls</h4> | ||
| 42 | <p text="sm" mb-2 max-w-100> | ||
| 43 | Toggles whether entries with a broken source url are shown in the list. | ||
| 44 | </p> | ||
| 45 | </MenuHelp> | ||
| 46 | </div> | ||
| 47 | <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md"> | ||
| 48 | <NuInputHorizontalRadioGroup | ||
| 49 | v-model="showBroken" | ||
| 50 | bg="$vp-nolebase-enhanced-readabilities-menu-background-color" | ||
| 51 | text="sm $vp-nolebase-enhanced-readabilities-menu-text-color" | ||
| 52 | :options="options" | ||
| 53 | /> | ||
| 54 | </NuInputHighlight> | ||
| 34 | </div> | 55 | </div> |
| 35 | </template> | 56 | </template> |
docs/.vitepress/theme/components/extrepo/ContentTypeFilter.vue +21 −3
| @@ -2,7 +2,8 @@ | |||
| 2 | import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui' | 2 | import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui' |
| 3 | import { computed, onMounted, onUnmounted, ref } from 'vue' | 3 | import { computed, onMounted, onUnmounted, ref } from 'vue' |
| 4 | import { contentTypeLabel } from './helpers' | 4 | import { contentTypeLabel } from './helpers' |
| 5 | import MenuTitle from './MenuTitle.vue' | 5 | import MenuHelp from '../settings/MenuHelp.vue' |
| 6 | import MenuTitle from '../settings/MenuTitle.vue' | ||
| 6 | 7 | ||
| 7 | const props = defineProps<{ | 8 | const props = defineProps<{ |
| 8 | // Excluded type values; empty means nothing is excluded, so everything is shown. | 9 | // Excluded type values; empty means nothing is excluded, so everything is shown. |
| @@ -16,6 +17,8 @@ const emit = defineEmits<{ | |||
| 16 | 17 | ||
| 17 | const rootRef = ref<HTMLElement>() | 18 | const rootRef = ref<HTMLElement>() |
| 18 | const open = ref(false) | 19 | const open = ref(false) |
| 20 | const menuTitleElementRef = ref<HTMLDivElement>() | ||
| 21 | const isMenuHelpPoppedUp = ref(false) | ||
| 19 | 22 | ||
| 20 | const selectedCount = computed(() => props.availableTypes.length - props.modelValue.size) | 23 | const selectedCount = computed(() => props.availableTypes.length - props.modelValue.size) |
| 21 | const summaryLabel = computed(() => { | 24 | const summaryLabel = computed(() => { |
| @@ -44,8 +47,23 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true)) | |||
| 44 | 47 | ||
| 45 | <template> | 48 | <template> |
| 46 | <div ref="rootRef" class="ext-ctype-select" :class="{ 'ext-ctype-select--open': open }"> | 49 | <div ref="rootRef" class="ext-ctype-select" :class="{ 'ext-ctype-select--open': open }"> |
| 47 | <MenuTitle icon="i-lucide:tags" title="Content Type" /> | 50 | <div ref="menuTitleElementRef" relative flex items-center mb-2> |
| 48 | <NuInputHighlight class="rounded-md"> | 51 | <MenuTitle title="Content Type" aria-label="Content Type" flex="1" pr-4> |
| 52 | <template #icon> | ||
| 53 | <span i-lucide:tags mr-1 aria-hidden="true" /> | ||
| 54 | </template> | ||
| 55 | </MenuTitle> | ||
| 56 | <MenuHelp | ||
| 57 | v-model:is-popped-up="isMenuHelpPoppedUp" | ||
| 58 | :menu-title-element-ref="menuTitleElementRef" | ||
| 59 | > | ||
| 60 | <h4 text-md mb-1 font-semibold>Content Type</h4> | ||
| 61 | <p text="sm" mb-2 max-w-100> | ||
| 62 | Shows or hides specific content types. Unchecking a type hides matching entries from the list. | ||
| 63 | </p> | ||
| 64 | </MenuHelp> | ||
| 65 | </div> | ||
| 66 | <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md"> | ||
| 49 | <button | 67 | <button |
| 50 | type="button" | 68 | type="button" |
| 51 | class="ext-ctype-trigger" | 69 | class="ext-ctype-trigger" |
docs/.vitepress/theme/components/extrepo/LangSelect.vue +21 −3
| @@ -2,7 +2,8 @@ | |||
| 2 | import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui' | 2 | import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui' |
| 3 | import { onMounted, onUnmounted, ref } from 'vue' | 3 | import { onMounted, onUnmounted, ref } from 'vue' |
| 4 | import { langFlagClass, langLabel } from './helpers' | 4 | import { langFlagClass, langLabel } from './helpers' |
| 5 | import MenuTitle from './MenuTitle.vue' | 5 | import MenuHelp from '../settings/MenuHelp.vue' |
| 6 | import MenuTitle from '../settings/MenuTitle.vue' | ||
| 6 | 7 | ||
| 7 | defineProps<{ | 8 | defineProps<{ |
| 8 | modelValue: string | 9 | modelValue: string |
| @@ -16,6 +17,8 @@ const emit = defineEmits<{ | |||
| 16 | 17 | ||
| 17 | const rootRef = ref<HTMLElement>() | 18 | const rootRef = ref<HTMLElement>() |
| 18 | const open = ref(false) | 19 | const open = ref(false) |
| 20 | const menuTitleElementRef = ref<HTMLDivElement>() | ||
| 21 | const isMenuHelpPoppedUp = ref(false) | ||
| 19 | 22 | ||
| 20 | function select(lang: string) { | 23 | function select(lang: string) { |
| 21 | emit('update:modelValue', lang) | 24 | emit('update:modelValue', lang) |
| @@ -32,8 +35,23 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true)) | |||
| 32 | 35 | ||
| 33 | <template> | 36 | <template> |
| 34 | <div ref="rootRef" class="ext-lang-select" :class="{ 'ext-lang-select--open': open }"> | 37 | <div ref="rootRef" class="ext-lang-select" :class="{ 'ext-lang-select--open': open }"> |
| 35 | <MenuTitle icon="i-lucide:languages" title="Language" /> | 38 | <div ref="menuTitleElementRef" relative flex items-center mb-2> |
| 36 | <NuInputHighlight class="rounded-md"> | 39 | <MenuTitle title="Language" aria-label="Language" flex="1" pr-4> |
| 40 | <template #icon> | ||
| 41 | <span i-lucide:languages mr-1 aria-hidden="true" /> | ||
| 42 | </template> | ||
| 43 | </MenuTitle> | ||
| 44 | <MenuHelp | ||
| 45 | v-model:is-popped-up="isMenuHelpPoppedUp" | ||
| 46 | :menu-title-element-ref="menuTitleElementRef" | ||
| 47 | > | ||
| 48 | <h4 text-md mb-1 font-semibold>Language</h4> | ||
| 49 | <p text="sm" mb-2 max-w-100> | ||
| 50 | Filters extensions by translated language (not original language). | ||
| 51 | </p> | ||
| 52 | </MenuHelp> | ||
| 53 | </div> | ||
| 54 | <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md"> | ||
| 37 | <button | 55 | <button |
| 38 | type="button" | 56 | type="button" |
| 39 | class="ext-lang-trigger" | 57 | class="ext-lang-trigger" |
docs/.vitepress/theme/components/extrepo/MenuTitle.vue deleted −30
| @@ -1,30 +0,0 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | defineProps<{ | ||
| 3 | icon: string | ||
| 4 | title: string | ||
| 5 | }>() | ||
| 6 | </script> | ||
| 7 | |||
| 8 | <template> | ||
| 9 | <h3 class="ext-menu-title"> | ||
| 10 | <span :class="icon" aria-hidden="true" /> | ||
| 11 | {{ title }} | ||
| 12 | </h3> | ||
| 13 | </template> | ||
| 14 | |||
| 15 | <style scoped> | ||
| 16 | .ext-menu-title { | ||
| 17 | display: flex; | ||
| 18 | align-items: center; | ||
| 19 | gap: 6px; | ||
| 20 | margin: 0 0 8px; | ||
| 21 | font-size: 13px; | ||
| 22 | font-weight: 600; | ||
| 23 | color: var(--vp-c-text-1); | ||
| 24 | } | ||
| 25 | |||
| 26 | .ext-menu-title span { | ||
| 27 | font-size: 14px; | ||
| 28 | color: var(--vp-c-text-2); | ||
| 29 | } | ||
| 30 | </style> | ||
docs/.vitepress/theme/components/extrepo/RatingFilter.vue +64 −3
| @@ -1,7 +1,8 @@ | |||
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui' | 2 | import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui' |
| 3 | import { computed, onMounted, onUnmounted, ref } from 'vue' | 3 | import { computed, onMounted, onUnmounted, ref } from 'vue' |
| 4 | import MenuTitle from './MenuTitle.vue' | 4 | import MenuHelp from '../settings/MenuHelp.vue' |
| 5 | import MenuTitle from '../settings/MenuTitle.vue' | ||
| 5 | import type { RatingFilter } from './types' | 6 | import type { RatingFilter } from './types' |
| 6 | 7 | ||
| 7 | const props = defineProps<{ | 8 | const props = defineProps<{ |
| @@ -30,6 +31,8 @@ const options = computed(() => { | |||
| 30 | 31 | ||
| 31 | const rootRef = ref<HTMLElement>() | 32 | const rootRef = ref<HTMLElement>() |
| 32 | const open = ref(false) | 33 | const open = ref(false) |
| 34 | const menuTitleElementRef = ref<HTMLDivElement>() | ||
| 35 | const isMenuHelpPoppedUp = ref(false) | ||
| 33 | 36 | ||
| 34 | const currentLabel = computed(() => options.value.find(o => o.value === props.modelValue)?.label ?? 'All') | 37 | const currentLabel = computed(() => options.value.find(o => o.value === props.modelValue)?.label ?? 'All') |
| 35 | 38 | ||
| @@ -48,8 +51,39 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true)) | |||
| 48 | 51 | ||
| 49 | <template> | 52 | <template> |
| 50 | <div ref="rootRef" class="ext-rating-select" :class="{ 'ext-rating-select--open': open }"> | 53 | <div ref="rootRef" class="ext-rating-select" :class="{ 'ext-rating-select--open': open }"> |
| 51 | <MenuTitle icon="i-lucide:shield" title="Rating" /> | 54 | <div ref="menuTitleElementRef" relative flex items-center mb-2> |
| 52 | <NuInputHighlight class="rounded-md"> | 55 | <MenuTitle title="Rating" aria-label="Rating" flex="1" pr-4> |
| 56 | <template #icon> | ||
| 57 | <span i-lucide:shield mr-1 aria-hidden="true" /> | ||
| 58 | </template> | ||
| 59 | </MenuTitle> | ||
| 60 | <MenuHelp | ||
| 61 | v-model:is-popped-up="isMenuHelpPoppedUp" | ||
| 62 | :menu-title-element-ref="menuTitleElementRef" | ||
| 63 | > | ||
| 64 | <h4 text-md mb-1 font-semibold>Rating</h4> | ||
| 65 | <p text="sm" mb-2>Choose the highest content rating to include.</p> | ||
| 66 | <div class="rating-help-options"> | ||
| 67 | <div class="rating-help-option"> | ||
| 68 | <strong>All</strong> | ||
| 69 | <span>Shows entries at every rating level</span> | ||
| 70 | </div> | ||
| 71 | <div class="rating-help-option"> | ||
| 72 | <strong>Safe</strong> | ||
| 73 | <span>Only entries with no mature content</span> | ||
| 74 | </div> | ||
| 75 | <div v-if="hasSuggestive" class="rating-help-option"> | ||
| 76 | <strong>Mature</strong> | ||
| 77 | <span>Includes suggestive content</span> | ||
| 78 | </div> | ||
| 79 | <div class="rating-help-option"> | ||
| 80 | <strong>{{ hasSuggestive ? 'Adult' : 'NSFW' }}</strong> | ||
| 81 | <span>Includes explicit adult content</span> | ||
| 82 | </div> | ||
| 83 | </div> | ||
| 84 | </MenuHelp> | ||
| 85 | </div> | ||
| 86 | <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md"> | ||
| 53 | <button | 87 | <button |
| 54 | type="button" | 88 | type="button" |
| 55 | class="ext-rating-trigger" | 89 | class="ext-rating-trigger" |
| @@ -82,6 +116,33 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true)) | |||
| 82 | </template> | 116 | </template> |
| 83 | 117 | ||
| 84 | <style scoped> | 118 | <style scoped> |
| 119 | .rating-help-options { | ||
| 120 | display: flex; | ||
| 121 | flex-direction: column; | ||
| 122 | gap: 5px; | ||
| 123 | } | ||
| 124 | |||
| 125 | .rating-help-option { | ||
| 126 | display: flex; | ||
| 127 | flex-direction: column; | ||
| 128 | gap: 4px; | ||
| 129 | background: var(--wk-c-menu-bg); | ||
| 130 | border-radius: 12px; | ||
| 131 | padding: 10px 12px; | ||
| 132 | } | ||
| 133 | |||
| 134 | .rating-help-option strong { | ||
| 135 | font-size: 0.875rem; | ||
| 136 | font-weight: 600; | ||
| 137 | color: var(--vp-c-text-1); | ||
| 138 | } | ||
| 139 | |||
| 140 | .rating-help-option span { | ||
| 141 | font-size: 0.875rem; | ||
| 142 | color: var(--vp-c-text-2); | ||
| 143 | line-height: 1.4; | ||
| 144 | } | ||
| 145 | |||
| 85 | .ext-rating-select { | 146 | .ext-rating-select { |
| 86 | position: relative; | 147 | position: relative; |
| 87 | } | 148 | } |
docs/.vitepress/theme/components/extrepo/SettingsMenu.vue +1 −1
| @@ -97,7 +97,7 @@ onUnmounted(() => { | |||
| 97 | <div | 97 | <div |
| 98 | v-show="open" | 98 | v-show="open" |
| 99 | ref="menuRef" | 99 | ref="menuRef" |
| 100 | class="ext-settings-menu" | 100 | class="ext-settings-menu VPMenu" |
| 101 | :class="{ 'ext-settings-menu--wide': hasSuggestive || hasContentTypes }" | 101 | :class="{ 'ext-settings-menu--wide': hasSuggestive || hasContentTypes }" |
| 102 | :style="menuStyle" | 102 | :style="menuStyle" |
| 103 | > | 103 | > |
docs/.vitepress/theme/components/settings/MenuHelp.vue +2 −1
| @@ -60,7 +60,7 @@ const helpPopupStyle = computed(() => { | |||
| 60 | const anchorLeft = menuBounding.width.value | 60 | const anchorLeft = menuBounding.width.value |
| 61 | ? menuBounding.left.value | 61 | ? menuBounding.left.value |
| 62 | : bounding.left.value | 62 | : bounding.left.value |
| 63 | left = Math.max(margin, anchorLeft - popupW - 16) | 63 | left = Math.max(margin, anchorLeft - popupW - 12) |
| 64 | top = bounding.top.value | 64 | top = bounding.top.value |
| 65 | } | 65 | } |
| 66 | 66 | ||
| @@ -128,6 +128,7 @@ watch( | |||
| 128 | rounded-xl | 128 | rounded-xl |
| 129 | p-4 | 129 | p-4 |
| 130 | shadow-xl | 130 | shadow-xl |
| 131 | w="[280px]" | ||
| 131 | max-w="[calc(100vw-16px)]" | 132 | max-w="[calc(100vw-16px)]" |
| 132 | > | 133 | > |
| 133 | <slot /> | 134 | <slot /> |