@@ -1624,7 +1624,13 @@ watch(selectedMetric, value => {
16241624})
16251625
16261626// Sparkline charts (a11y alternative display for multi series)
1627- const isSparklineLayout = shallowRef (false )
1627+ const chartLayout = usePermalink <' combined' | ' split' >(' layout' , ' combined' )
1628+ const isSparklineLayout = computed ({
1629+ get : () => chartLayout .value === ' split' ,
1630+ set : (v : boolean ) => {
1631+ chartLayout .value = v ? ' split' : ' combined'
1632+ },
1633+ })
16281634 </script >
16291635
16301636<template >
@@ -1633,50 +1639,25 @@ const isSparklineLayout = shallowRef(false)
16331639 id =" trends-chart"
16341640 :aria-busy =" activeMetricState.pending ? 'true' : 'false'"
16351641 >
1636- <div
1642+ <TabRoot
16371643 v-if =" isMultiPackageMode "
1638- class = " inline-flex items-center gap-1 rounded-md border border-border-subtle bg-bg-subtle p-0.5 mt-4 mb-8 "
1639- role = " tablist "
1640- :aria-label = " $t('package.trends.chart_view_toggle') "
1644+ v-model = " chartLayout "
1645+ id-prefix="chart-layout "
1646+ class="mt-4 mb-8 "
16411647 >
1642- <button
1643- id =" combined-chart-layout-tab"
1644- type =" button"
1645- role =" tab"
1646- :aria-selected =" isSparklineLayout ? 'false' : 'true'"
1647- aria-controls =" combined-chart-layout-panel"
1648- :tabindex =" isSparklineLayout ? 0 : -1"
1649- class =" flex items-center justify-center gap-x-2 rounded px-3 py-2 font-mono text-sm border border-solid transition-colors duration-150 focus-visible:outline-accent/70"
1650- :class ="
1651- isSparklineLayout
1652- ? 'border-transparent text-fg-subtle hover:text-fg'
1653- : 'bg-bg border-border shadow-sm text-fg'
1654- "
1655- @click =" isSparklineLayout = false"
1656- >
1657- <span class =" i-lucide:chart-line size-[1em]" aria-hidden =" true" />
1658- <span >{{ $t('package.trends.chart_view_combined') }}</span >
1659- </button >
1660-
1661- <button
1662- id =" split-chart-layout-tab"
1663- type =" button"
1664- role =" tab"
1665- :aria-selected =" isSparklineLayout ? 'true' : 'false'"
1666- aria-controls =" split-chart-layout-panel"
1667- :tabindex =" !isSparklineLayout ? 0 : -1"
1668- class =" flex items-center justify-center gap-x-2 rounded px-3 py-2 font-mono text-sm border border-solid transition-colors duration-150 focus-visible:outline-accent/70"
1669- :class ="
1670- isSparklineLayout
1671- ? 'bg-bg border-border shadow-sm text-fg'
1672- : 'border-transparent text-fg-subtle hover:text-fg'
1673- "
1674- @click =" isSparklineLayout = true"
1675- >
1676- <span class =" i-lucide:square-split-horizontal size-[1em]" aria-hidden =" true" />
1677- <span >{{ $t('package.trends.chart_view_split') }}</span >
1678- </button >
1679- </div >
1648+ <TabList :aria-label =" $t (' package.trends.chart_view_toggle' )" >
1649+ <TabItem value="combined" tab-id="combined-chart-layout-tab" icon="i-lucide:chart-line ">
1650+ {{ $t('package.trends.chart_view_combined') }}
1651+ </TabItem >
1652+ <TabItem
1653+ value="split"
1654+ tab-id="split-chart-layout-tab"
1655+ icon="i-lucide:square-split-horizontal "
1656+ >
1657+ {{ $t('package.trends.chart_view_split') }}
1658+ </TabItem >
1659+ </TabList >
1660+ </TabRoot >
16801661
16811662 <div class =" w-full mb-4 flex flex-col gap-3" >
16821663 <div class =" grid grid-cols-2 sm:flex sm:flex-row gap-3 sm:gap-2 sm:items-end" >
0 commit comments