Commit 7090bc8698
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/Collapsible.vue +20 −2
| @@ -1,11 +1,19 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | import { ref } from 'vue' | |
| 2 | import { computed, ref } from 'vue' | |
| 3 | 3 | |
| 4 | 4 | const props = defineProps<{ |
| 5 | 5 | title?: string |
| 6 | 6 | }>() |
| 7 | 7 | |
| 8 | 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 | 17 | </script> |
| 10 | 18 | |
| 11 | 19 | <template> |
| @@ -13,7 +21,10 @@ const open = ref(false) | ||
| 13 | 21 | <summary> |
| 14 | 22 | <span v-if="open" class="i-iconoir-nav-arrow-down collapsible-icon" /> |
| 15 | 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 | 28 | </summary> |
| 18 | 29 | <slot /> |
| 19 | 30 | </details> |
| @@ -47,5 +58,12 @@ summary::-webkit-details-marker { | ||
| 47 | 58 | color: inherit; |
| 48 | 59 | letter-spacing: inherit; |
| 49 | 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 | 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 | 1639 | .vp-doc .vp-card, |
| 1649 | 1640 | .vp-doc .vp-card:hover, |
| 1650 | 1641 | .vp-doc .vp-card:focus, |