@@ -116,10 +116,32 @@ const dataset = computed(() =>
116116
117117const lastDatapoint = computed (() => dataset .value .at (- 1 )?.period ?? ' ' )
118118
119- // oklh or css variables are not supported by vue-data-ui (for now)
120119const config = computed (() => {
121120 return {
122121 theme: ' dark' ,
122+ /**
123+ * The built-in skeleton loader kicks in when the component is mounted but the data is not yet ready.
124+ * The configuration of the skeleton is customized for a seemless transition with the final state
125+ */
126+ skeletonConfig: {
127+ style: {
128+ backgroundColor: ' transparent' ,
129+ dataLabel: {
130+ show: true ,
131+ color: ' transparent' ,
132+ },
133+ area: {
134+ color: colors .value .borderHover ,
135+ useGradient: false ,
136+ opacity: 10 ,
137+ },
138+ line: {
139+ color: colors .value .borderHover ,
140+ },
141+ },
142+ },
143+ // Same idea: initialize the line at zero, so it nicely transitions to the final dataset
144+ skeletonDataset: Array .from ({ length: 52 }, () => 0 ),
123145 style: {
124146 backgroundColor: ' transparent' ,
125147 animation: { show: false },
@@ -196,16 +218,21 @@ const config = computed(() => {
196218
197219 <div class =" w-full overflow-hidden" >
198220 <ClientOnly >
199- <VueUiSparkline class =" w-full max-w-xs" :dataset :config />
221+ <VueUiSparkline class =" w-full max-w-xs" :dataset :config >
222+ <template #skeleton >
223+ <!-- This empty div overrides the default built-in scanning animation on load -->
224+ <div />
225+ </template >
226+ </VueUiSparkline >
200227 <template #fallback >
201228 <!-- Skeleton matching sparkline layout: title row + chart with data label -->
202- <div class =" max-w-xs " >
203- <!-- Title row: date range -->
204- <div class =" h-5 flex items-center ps-3" >
229+ <div class =" min-h-[75.195px] " >
230+ <!-- Title row: date range (24px height) -->
231+ <div class =" h-6 flex items-center ps-3" >
205232 <span class =" skeleton h-3 w-36" />
206233 </div >
207- <!-- Chart area: data label left, sparkline right (h-[51px] matches rendered SVG) -->
208- <div class =" h-[55px ] flex items-center" >
234+ <!-- Chart area: data label left, sparkline right -->
235+ <div class =" aspect-[500/80 ] flex items-center" >
209236 <!-- Data label (covers ~42% width) -->
210237 <div class =" w-[42%] flex items-center ps-0.5" >
211238 <span class =" skeleton h-7 w-24" />
0 commit comments