@@ -55,7 +55,7 @@ function createDigraph(dependencies: DependencyGraphProps["dependencies"]) {
55
55
node [fontname="Courier", shape="box", style="filled,rounded"]
56
56
57
57
${
58
- dependencies . map ( ( { children, size , dependency } , index ) => {
58
+ dependencies . map ( ( { children, dependency , size } , index ) => {
59
59
return [
60
60
` ${ index } ${ renderDependency ( dependency , size ) } ` ,
61
61
...children . map ( ( child ) => ` ${ index } -> ${ child } ` ) ,
@@ -82,7 +82,7 @@ function renderDependency(dependency: DependencyGraphKind, size?: number) {
82
82
tooltip =
83
83
`@${ dependency . scope } /${ dependency . package } @${ dependency . version } ` ;
84
84
href = `/${ tooltip } ` ;
85
- content = tooltip + ` \n${ dependency . path } \n${ bytesToSize ( size ?? 0 ) } `;
85
+ content = ` ${ tooltip } \n${ dependency . path } \n${ bytesToSize ( size ?? 0 ) } `;
86
86
color = "#faee4a" ;
87
87
break ;
88
88
}
@@ -93,7 +93,7 @@ function renderDependency(dependency: DependencyGraphKind, size?: number) {
93
93
break ;
94
94
}
95
95
case "root" : {
96
- tooltip = content = dependency . path ;
96
+ content = tooltip = dependency . path ;
97
97
color = "#67bef9" ;
98
98
break ;
99
99
}
@@ -128,7 +128,7 @@ function useDigraph(dependencies: DependencyGraphProps["dependencies"]) {
128
128
defaults . value . pan . x = ( rWidth - sWidth ) / 2 ;
129
129
defaults . value . pan . y = ( rHeight - sHeight ) / 2 ;
130
130
defaults . value . zoom = Math . min ( rWidth / sWidth , rHeight / sHeight ) ;
131
- controls . value = { ... defaults . value } ;
131
+ controls . value = structuredClone ( defaults . value ) ;
132
132
svg . current . style . transform =
133
133
`translate(${ controls . value . pan . x } px, ${ controls . value . pan . y } px) scale(${ controls . value . zoom } )` ;
134
134
}
@@ -156,7 +156,7 @@ function useDigraph(dependencies: DependencyGraphProps["dependencies"]) {
156
156
} , [ ] ) ;
157
157
158
158
const reset = useCallback ( ( ) => {
159
- controls . value = { ... defaults . value } ;
159
+ controls . value = structuredClone ( defaults . value ) ;
160
160
if ( svg . current ) {
161
161
svg . current . style . transform =
162
162
`translate(${ controls . value . pan . x } px, ${ controls . value . pan . y } px) scale(${ controls . value . zoom } )` ;
0 commit comments