Skip to content

Commit 0b29b67

Browse files
committed
feat: use more v-tooltip
1 parent 2573b65 commit 0b29b67

File tree

13 files changed

+74
-11
lines changed

13 files changed

+74
-11
lines changed

node-modules-inspector.config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export default defineConfig({
66
'eslint',
77
],
88
excludePackages: [
9-
'@antfu/eslint-config',
9+
'@pnpm/list',
10+
'@pnpm/types',
1011
],
1112
defaultFilters: {
1213
excludes: [

packages/node-modules-inspector/src/app/components/display/DateBadge.vue

+9
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@ const date = computed(() => props.time
2020
? getPublishTime(props.pkg)
2121
: undefined,
2222
)
23+
24+
const formatter = Intl.DateTimeFormat('en-US', {
25+
year: 'numeric',
26+
month: 'long',
27+
day: 'numeric',
28+
})
29+
const dateTitle = computed(() => date.value ? formatter.format(date.value) : null)
2330
</script>
2431

2532
<template>
2633
<DisplayDurationBadge
2734
v-if="date"
35+
v-tooltip="dateTitle"
36+
:title="dateTitle"
2837
:ms="Date.now() - +date"
2938
:colorize="props.colorize"
3039
mode="day"

packages/node-modules-inspector/src/app/components/display/FundingEntry.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ defineProps<{
88
</script>
99

1010
<template>
11-
<a v-if="funding" :href="funding.url" target="_blank" flex="~ gap-2" of-hidden text-ellipsis>
11+
<a
12+
v-if="funding"
13+
v-tooltip="'Open Funding Page'"
14+
:href="funding.url"
15+
title="Open Funding Page"
16+
target="_blank"
17+
flex="~ gap-2" of-hidden text-ellipsis
18+
>
1219
<SafeImage
1320
v-if="funding.avatar" :src="funding.avatar"
1421
bg-active border="~ base rounded-full"

packages/node-modules-inspector/src/app/components/graph/Canvas.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -378,16 +378,19 @@ onMounted(() => {
378378

379379
<div bg-glass rounded-full border border-base shadow>
380380
<button
381+
v-tooltip="'Zoom In (Ctrl + =)'"
381382
:disabled="scale >= ZOOM_MAX"
382-
w-10 h-10 rounded-full hover:bg-active op50 hover:op100
383-
disabled:op20 disabled:bg-none disabled:cursor-not-allowed
383+
w-10 h-10 rounded-full hover:bg-active op50
384+
hover:op100 disabled:op20 disabled:bg-none
385+
disabled:cursor-not-allowed
384386
flex="~ items-center justify-center"
385387
title="Zoom In (Ctrl + =)"
386388
@click="zoomIn()"
387389
>
388390
<div i-ph-magnifying-glass-plus-duotone />
389391
</button>
390392
<button
393+
v-tooltip="'Zoom Out (Ctrl + -)'"
391394
:disabled="scale <= ZOOM_MIN"
392395
w-10 h-10 rounded-full hover:bg-active op50 hover:op100
393396
disabled:op20 disabled:bg-none disabled:cursor-not-allowed
@@ -401,6 +404,7 @@ onMounted(() => {
401404

402405
<div bg-glass rounded-full border border-base shadow>
403406
<button
407+
v-tooltip="'Toggle Graph Render Mode'"
404408
w-10 h-10 rounded-full hover:bg-active op50 hover:op100
405409
flex="~ items-center justify-center"
406410
title="Toggle Graph Render Mode"
@@ -413,6 +417,7 @@ onMounted(() => {
413417

414418
<div bg-glass rounded-full border border-base shadow>
415419
<button
420+
v-tooltip="'Download Screenshot as PNG'"
416421
w-10 h-10 rounded-full hover:bg-active op50 hover:op100
417422
flex="~ items-center justify-center"
418423
title="Download Screenshot as PNG"

packages/node-modules-inspector/src/app/components/integrations/PublintPanel.vue

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const messageColors = {
6868
<div flex-auto />
6969
<button
7070
v-if="messages.length"
71+
v-tooltip="'Toggle file composition'"
7172
p1 rounded-full hover:bg-active mr--2
7273
title="Toggle file composition"
7374
>

packages/node-modules-inspector/src/app/components/panel/Dark.vue

+3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import { toggleDark } from '../../composables/dark'
88
bg-glass rounded-full border border-base shadow
99
>
1010
<a
11+
v-tooltip="'Check source code on GitHub'"
12+
title="Check source code on GitHub"
1113
w-10 h-10 rounded-full hover:bg-active op50 hover:op100
1214
flex="~ items-center justify-center"
1315
href="https://github.com/antfu/node-modules-inspector" target="_blank"
1416
>
1517
<div i-ri-github-fill text-xl />
1618
</a>
1719
<button
20+
v-tooltip="'Toggle Dark Mode'"
1821
w-10 h-10 rounded-full hover:bg-active op50 hover:op100
1922
flex="~ items-center justify-center"
2023
title="Toggle Dark Mode"

packages/node-modules-inspector/src/app/components/panel/FiltersMini.vue

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const moduleTypes = Object.fromEntries(
103103
</div>
104104

105105
<button
106+
v-tooltip="'Clear Filters'"
106107
w8 h8 rounded-full hover:bg-active op50 hover:op100 flex="~ items-center justify-center"
107108
title="Clear Filters"
108109
@click="filters.select.reset()"

packages/node-modules-inspector/src/app/components/panel/Nav.vue

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ function resetPanelState() {
9292
>
9393
<template v-for="tab of tabsMeta" :key="tab.value">
9494
<RouterLink
95+
v-tooltip="tab.name"
9596
w-10 h-10 rounded-full hover:bg-active
9697
flex="~ items-center justify-center"
9798
:title="tab.name"

packages/node-modules-inspector/src/app/components/panel/PackageDetails.vue

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script setup lang="ts">
22
import type { PackageNode } from 'node-modules-tools'
3+
import { useRouter } from '#app/composables/router'
34
import { Menu as VMenu } from 'floating-vue'
4-
import { computed, watch } from 'vue'
5+
import { computed, nextTick, watch } from 'vue'
56
import { getBackend } from '../../backends'
67
import { selectedNode } from '../../state/current'
78
import { fetchPublintMessages, rawPublintMessages } from '../../state/data'
@@ -102,6 +103,16 @@ function getShallowestDependents(pkg: PackageNode) {
102103
103104
const latestMeta = computed(() => getNpmMetaLatest(props.pkg))
104105
const deprecation = computed(() => getDeprecatedInfo(props.pkg))
106+
107+
const router = useRouter()
108+
function showDuplicatedGraph(pkgs: PackageNode[]) {
109+
filters.state.focus = null
110+
filters.state.why = pkgs.map(pkg => pkg.spec)
111+
selectedNode.value = pkgs[0]
112+
nextTick(() => {
113+
router.push({ path: '/graph', hash: location.hash })
114+
})
115+
}
105116
</script>
106117

107118
<template>
@@ -154,12 +165,22 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
154165
<DisplayVersion op75 flex-auto text-left :version="versionNode.version" />
155166
<DisplayModuleType :force="true" :pkg="versionNode" :badge="false" text-xs />
156167
</button>
168+
<div border="t base" my1 />
169+
<button
170+
py1 px2 rounded flex="~ items-center gap-1" min-w-40
171+
hover="bg-active"
172+
@click="showDuplicatedGraph(duplicated)"
173+
>
174+
<div i-ph-graph-duotone />
175+
<span text-sm> Compare in Graph</span>
176+
</button>
157177
</div>
158178
</template>
159179
</VMenu>
160180
<div flex="~ gap--1 items-center">
161181
<NuxtLink
162182
v-if="!pkg.private"
183+
v-tooltip="'Open on NPM'"
163184
:to="`https://www.npmjs.com/package/${pkg.name}/v/${pkg.version}`"
164185
title="Open on NPM"
165186
target="_blank"
@@ -169,6 +190,7 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
169190
</NuxtLink>
170191
<NuxtLink
171192
v-if="resolved.repository"
193+
v-tooltip="'Open Repository'"
172194
:to="resolved.repository"
173195
title="Open Repository"
174196
target="_blank"
@@ -178,6 +200,7 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
178200
</NuxtLink>
179201
<NuxtLink
180202
v-if="resolved.homepage"
203+
v-tooltip="'Open Homepage'"
181204
:to="resolved.homepage"
182205
title="Open Homepage"
183206
target="_blank"
@@ -190,6 +213,7 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
190213
:fundings="resolved.fundings"
191214
/>
192215
<NuxtLink
216+
v-tooltip="'Open in Publint'"
193217
:to="`https://publint.dev/${pkg.spec}`"
194218
title="Open in Publint"
195219
target="_blank"
@@ -199,6 +223,7 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
199223
</NuxtLink>
200224
<button
201225
v-if="backend?.functions.openInEditor"
226+
v-tooltip="'Open Package Folder in Editor'"
202227
title="Open Package Folder in Editor"
203228
ml--1 w-8 h-8 rounded-full hover:bg-active flex
204229
@click="backend.functions.openInEditor(pkg.filepath)"
@@ -207,7 +232,8 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
207232
</button>
208233
<button
209234
v-if="backend?.functions.openInFinder"
210-
title="Open Package Folder in Finder"
235+
v-tooltip="'Open Package Folder in File Explorer'"
236+
title="Open Package Folder in File Explorer"
211237
ml--1 w-8 h-8 rounded-full hover:bg-active flex
212238
@click="backend.functions.openInFinder(pkg.filepath)"
213239
>
@@ -296,6 +322,7 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
296322
</div>
297323
<div flex-auto />
298324
<button
325+
v-tooltip="'Toggle file composition'"
299326
p1 rounded-full hover:bg-active mr--2
300327
title="Toggle file composition"
301328
@click="settings.showFileComposition = !settings.showFileComposition"
@@ -338,6 +365,7 @@ const deprecation = computed(() => getDeprecatedInfo(props.pkg))
338365
</button>
339366
<div border="b base" pt2 px2>
340367
<button
368+
v-tooltip="'Toggle deep dependencies tree'"
341369
p1 rounded-full hover:bg-active
342370
title="Toggle deep dependencies tree"
343371
@click="settings.deepDependenciesTree = !settings.deepDependenciesTree"

packages/node-modules-inspector/src/app/components/panel/PackageFunding.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@ defineProps<{
1010
<template>
1111
<NuxtLink
1212
v-if="fundings?.length === 1"
13+
v-tooltip="'Open Funding Page'"
1314
:to="fundings[0].url"
14-
title="Open Funding"
15+
title="Open Funding Page"
1516
target="_blank"
1617
ml--1 w-8 h-8 rounded-full hover:bg-active flex
1718
>
1819
<div i-catppuccin-code-of-conduct icon-catppuccin ma />
1920
</NuxtLink>
2021

2122
<VMenu v-else-if="fundings?.length" ml--1 w-8 h-8 rounded-full hover:bg-active flex>
22-
<div i-catppuccin-code-of-conduct icon-catppuccin ma title="Show Fundings" />
23+
<div
24+
v-tooltip="'Show Fundings'"
25+
i-catppuccin-code-of-conduct icon-catppuccin ma
26+
title="Show Fundings"
27+
/>
2328
<template #popper>
2429
<div flex="~ col" p1>
2530
<DisplayFundingEntry

packages/node-modules-inspector/src/app/components/panel/Terminal.vue

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ onBeforeUnmount(() => {
5757
bg-glass rounded-full border border-base shadow
5858
>
5959
<button
60+
v-tooltip="'Toggle Terminal'"
6061
w-10 h-10 rounded-full hover:bg-active op50 hover:op100
6162
flex="~ items-center justify-center"
6263
title="Toggle Terminal"

packages/node-modules-inspector/src/app/components/report/MultipleVersions.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ function showGraph(pkgs: PackageNode[]) {
5252
{{ pkgs[0].name }}
5353
</h2>
5454
<button
55-
p1 rounded-full op50 hover:bg-active hover:text-primary hover:op100 flex="~ items-center"
56-
title="Show Graph"
55+
v-tooltip="'Compare in Graph'" p1 rounded-full op50 hover:bg-active hover:text-primary hover:op100
56+
flex="~ items-center"
57+
title="Compare in Graph"
5758
@click="showGraph(pkgs)"
5859
>
5960
<div i-ph-graph-duotone text-lg />

packages/node-modules-inspector/src/app/pages/report/[...report].vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ const selected = computed(() => params.report[0] || 'all')
4848

4949
<ReportTransitiveDeps v-if="selected === 'dependencies' || selected === 'all'" />
5050
<ReportUsedBy v-if="selected === 'dependencies' || selected === 'all'" />
51-
<ReportDeprecated v-if="selected === 'deprecated' || selected === 'all'" />
5251
<ReportInstallSize v-if="selected === 'install-size' || selected === 'all'" />
5352
<ReportPublishTime v-if="selected === 'time' || selected === 'all'" />
53+
<ReportDeprecated v-if="selected === 'deprecated' || selected === 'all'" />
5454
<ReportEngines v-if="selected === 'node-engines' || selected === 'all'" />
5555
<ReportLicenses v-if="selected === 'licenses' || selected === 'all'" />
5656
<ReportFunding v-if="selected === 'funding' || selected === 'all'" />

0 commit comments

Comments
 (0)