@@ -10,7 +10,12 @@ const { data: analysisData, status } = useDependencyAnalysis(
1010)
1111
1212const isExpanded = shallowRef (false )
13- const showAll = shallowRef (false )
13+
14+ const {
15+ visibleItems : visiblePackages,
16+ hasMore : hasMorePackages,
17+ expand : expandPackages,
18+ } = useVisibleItems (() => analysisData .value ?.deprecatedPackages ?? [], 5 )
1419
1520const hasDeprecated = computed (
1621 () => analysisData .value ?.deprecatedPackages && analysisData .value .deprecatedPackages .length > 0 ,
@@ -72,7 +77,7 @@ function getDepthStyle(depth: DependencyDepth) {
7277 >
7378 <ul class =" divide-y divide-border list-none m-0 p-0" >
7479 <li
75- v-for =" pkg in analysisData!.deprecatedPackages.slice(0, showAll ? undefined : 5) "
80+ v-for =" pkg in visiblePackages "
7681 :key =" `${pkg.name}@${pkg.version}`"
7782 class =" px-4 py-3"
7883 :class =" getDepthStyle(pkg.depth).bg"
@@ -96,10 +101,10 @@ function getDepthStyle(depth: DependencyDepth) {
96101 </ul >
97102
98103 <button
99- v-if =" analysisData!.deprecatedPackages.length > 5 && !showAll "
104+ v-if =" hasMorePackages "
100105 type =" button"
101106 class =" w-full px-4 py-2 text-xs font-mono text-fg-muted hover:text-fg border-t border-border transition-colors duration-200"
102- @click =" showAll = true "
107+ @click =" expandPackages "
103108 >
104109 {{
105110 $t('package.deprecated.show_all', { count: analysisData!.deprecatedPackages.length })
0 commit comments