Commit 7090bc8698
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/Collapsible.vue +20 −2
| @@ -1,11 +1,19 @@ | |||
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | import { ref } from 'vue' | 2 | import { computed, ref } from 'vue' |
| 3 | 3 | ||
| 4 | const props = defineProps<{ | 4 | const props = defineProps<{ |
| 5 | title?: string | 5 | title?: string |
| 6 | }>() | 6 | }>() |
| 7 | 7 | ||
| 8 | const open = ref(false) | 8 | const open = ref(false) |
| 9 | |||
| 10 | const slug = computed(() => { | ||
| 11 | const text = props.title || 'Details' | ||
| 12 | return text | ||
| 13 | .toLowerCase() | ||
| 14 | .replace(/\s+/g, '-') | ||
| 15 | .replace(/[^\w-]/g, '') | ||
| 16 | }) | ||
| 9 | </script> | 17 | </script> |
| 10 | 18 | ||
| 11 | <template> | 19 | <template> |
| @@ -13,7 +21,10 @@ const open = ref(false) | |||
| 13 | <summary> | 21 | <summary> |
| 14 | <span v-if="open" class="i-iconoir-nav-arrow-down collapsible-icon" /> | 22 | <span v-if="open" class="i-iconoir-nav-arrow-down collapsible-icon" /> |
| 15 | <span v-else class="i-iconoir-nav-arrow-right collapsible-icon" /> | 23 | <span v-else class="i-iconoir-nav-arrow-right collapsible-icon" /> |
| 16 | <h3 class="collapsible-title">{{ title || 'Details' }}</h3> | 24 | <h3 :id="slug" class="collapsible-title"> |
| 25 | <a :href="`#${slug}`" class="header-anchor" aria-hidden="true"></a> | ||
| 26 | {{ title || 'Details' }} | ||
| 27 | </h3> | ||
| 17 | </summary> | 28 | </summary> |
| 18 | <slot /> | 29 | <slot /> |
| 19 | </details> | 30 | </details> |
| @@ -47,5 +58,12 @@ summary::-webkit-details-marker { | |||
| 47 | color: inherit; | 58 | color: inherit; |
| 48 | letter-spacing: inherit; | 59 | letter-spacing: inherit; |
| 49 | border: none; | 60 | border: none; |
| 61 | text-decoration: none; | ||
| 62 | display: inline; | ||
| 63 | } | ||
| 64 | |||
| 65 | /* Hide the anchor icon VitePress would normally show on hover */ | ||
| 66 | .collapsible-title .header-anchor { | ||
| 67 | display: none; | ||
| 50 | } | 68 | } |
| 51 | </style>\ No newline at end of file | 69 | </style>\ No newline at end of file |
docs/.vitepress/theme/styles/style.scss −9
| @@ -1636,15 +1636,6 @@ html.reduce-blur-effects { | |||
| 1636 | } | 1636 | } |
| 1637 | } | 1637 | } |
| 1638 | 1638 | ||
| 1639 | /* Collapsible: title="" renders as h3 for search indexing, reset visual styles */ | ||
| 1640 | .details summary h3 { | ||
| 1641 | margin: 0; | ||
| 1642 | font-size: inherit; | ||
| 1643 | font-weight: inherit; | ||
| 1644 | border: none; | ||
| 1645 | text-decoration: none; | ||
| 1646 | } | ||
| 1647 | |||
| 1648 | .vp-doc .vp-card, | 1639 | .vp-doc .vp-card, |
| 1649 | .vp-doc .vp-card:hover, | 1640 | .vp-doc .vp-card:hover, |
| 1650 | .vp-doc .vp-card:focus, | 1641 | .vp-doc .vp-card:focus, |