From 51df0e7dc5f560930ecf200a1127be54c867e349 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 25 Dec 2024 12:59:43 +0800 Subject: [PATCH] feat(inspector): improve merged selector display --- packages/inspector/client/components/Analyzer.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/inspector/client/components/Analyzer.vue b/packages/inspector/client/components/Analyzer.vue index 6b4e233e6c..e6c07f2bae 100644 --- a/packages/inspector/client/components/Analyzer.vue +++ b/packages/inspector/client/components/Analyzer.vue @@ -50,8 +50,19 @@ const mergedSelectors = computed(() => { } }) - return [...map.values()] + const sorted = [...map.values()] .sort((a, b) => b.count - a.count) + + // Use name without bracket if possible + // `[text-sm] text-sm` -> `text-sm` + sorted.forEach((item) => { + if (item.alias) { + item.name = Object.keys(item.alias) + .sort((a, b) => b.localeCompare(a))[0] + } + }) + + return sorted }) const grouped = computed(() => mergedSelectors