Commit 0543e0dd57

0543e0dd57b8cc82706a67f505642c577f7593e3

parent: 77c107043d

Unsigned

TubaApollo <86665265+TubaApollo@users.noreply.github.com> · 2026-04-17 08:13 UTC

feat: dynamic ScrapeTable header height and alphabetical source tie-breaker

Layout: unified · split

docs/.vitepress/theme/components/ScrapeTable.vue +13 −2
@@ -36,7 +36,18 @@ const sources = computed(() => {
3636 count[source] = (count[source] || 0) + 1
3737 }
3838 }
39 return Object.keys(count).sort((a, b) => count[b] - count[a])
39 return Object.keys(count).sort((a, b) => count[b] - count[a] || a.localeCompare(b))
40})
41
42const HEADER_MIN_PX = 48
43const HEADER_MAX_PX = 140
44const HEADER_PER_CHAR_PX = 7.2
45const HEADER_PADDING_PX = 20
46
47const headerHeight = computed(() => {
48 const longest = sources.value.reduce((n, s) => Math.max(n, s.length), 0)
49 const raw = Math.round(longest * HEADER_PER_CHAR_PX) + HEADER_PADDING_PX
50 return Math.min(HEADER_MAX_PX, Math.max(HEADER_MIN_PX, raw))
4051})
4152
4253// Drag to scroll + scroll indicator
@@ -85,7 +96,7 @@ onMounted(() => {
8596</script>
8697
8798<template>
88 <div class="scrape-table-outer">
99 <div class="scrape-table-outer" :style="{ '--scrape-header-height': `${headerHeight}px` }">
89100 <div
90101 ref="wrapRef"
91102 class="scrape-table-wrap"
docs/.vitepress/theme/styles/style.scss +2 −2
@@ -1486,7 +1486,7 @@ table tr:nth-child(odd) {
14861486 left: 0;
14871487 z-index: 2;
14881488 padding: 0 12px !important;
1489 height: 140px;
1489 height: var(--scrape-header-height, 140px);
14901490 background-color: var(--vp-c-bg-soft) !important;
14911491 border-left: 1px solid var(--vp-c-divider) !important;
14921492 color: var(--vp-c-text-1) !important;
@@ -1498,7 +1498,7 @@ table tr:nth-child(odd) {
14981498
14991499 .source-header {
15001500 vertical-align: bottom;
1501 height: 140px;
1501 height: var(--scrape-header-height, 140px);
15021502 text-align: center;
15031503 background: var(--vp-c-bg) !important;
15041504