mvn-tree-visualizer 1.4.0__py3-none-any.whl → 1.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mvn-tree-visualizer might be problematic. Click here for more details.

@@ -4,12 +4,12 @@ from pathlib import Path
4
4
  from typing import NoReturn
5
5
 
6
6
  from .diagram import create_diagram
7
- from .exceptions import DependencyFileNotFoundError, DependencyParsingError, MvnTreeVisualizerError, OutputGenerationError
7
+ from .exceptions import DependencyParsingError, MvnTreeVisualizerError, OutputGenerationError
8
8
  from .file_watcher import FileWatcher
9
9
  from .get_dependencies_in_one_file import merge_files
10
10
  from .outputs.html_output import create_html_diagram
11
11
  from .outputs.json_output import create_json_output
12
- from .validation import find_dependency_files, print_maven_help, validate_dependency_files, validate_output_directory
12
+ from .validation import find_dependency_files, validate_dependency_files, validate_output_directory
13
13
 
14
14
 
15
15
  def generate_diagram(
@@ -108,8 +108,6 @@ def generate_diagram(
108
108
  except MvnTreeVisualizerError as e:
109
109
  # Our custom errors already have helpful messages
110
110
  print(f"[{timestamp}] ❌ Error: {e}")
111
- if isinstance(e, DependencyFileNotFoundError):
112
- print_maven_help()
113
111
  except KeyboardInterrupt:
114
112
  print(f"\n[{timestamp}] ⏹️ Operation cancelled by user")
115
113
  except Exception as e:
@@ -2,7 +2,7 @@
2
2
 
3
3
  from typing import Any, Dict
4
4
 
5
- from .themes import STANDARD_COLORS, Theme
5
+ from .themes import MAX_ZOOM, MIN_ZOOM, STANDARD_COLORS, ZOOM_SCALE_SENSITIVITY, Theme
6
6
 
7
7
 
8
8
  def get_html_template(theme: Theme) -> str:
@@ -93,6 +93,12 @@ def get_html_template(theme: Theme) -> str:
93
93
  <button id="downloadButton" class="toggle-btn">Download SVG</button>
94
94
  <!-- Note: PNG download feature to be implemented in future version -->
95
95
  </div>
96
+ <div class="control-group">
97
+ <span class="control-label">Navigation:</span>
98
+ <button id="zoomInButton" class="toggle-btn">Zoom In (+)</button>
99
+ <button id="zoomOutButton" class="toggle-btn">Zoom Out (-)</button>
100
+ <button id="resetZoomButton" class="toggle-btn">Reset (Ctrl+R)</button>
101
+ </div>
96
102
  </div>
97
103
 
98
104
  <div id="graphDiv"></div>
@@ -107,6 +113,10 @@ def get_html_template(theme: Theme) -> str:
107
113
  // Global variables
108
114
  let panZoomInstance = null;
109
115
 
116
+ const MIN_ZOOM = {MIN_ZOOM};
117
+ const MAX_ZOOM = {MAX_ZOOM};
118
+ const ZOOM_SCALE_SENSITIVITY = {ZOOM_SCALE_SENSITIVITY};
119
+
110
120
  const drawDiagram = async function () {{
111
121
  const element = document.querySelector('#graphDiv');
112
122
  const graphDefinition = `{{{{diagram_definition}}}}`;
@@ -115,14 +125,21 @@ def get_html_template(theme: Theme) -> str:
115
125
  const {{ svg }} = await mermaid.render('mySvgId', graphDefinition);
116
126
  element.innerHTML = svg.replace(/[ ]*max-width:[ 0-9\\.]*px;/i , '');
117
127
 
118
- // Initialize pan & zoom
128
+ // Initialize pan & zoom with improved settings for large diagrams
119
129
  panZoomInstance = svgPanZoom('#mySvgId', {{
120
130
  zoomEnabled: true,
121
131
  controlIconsEnabled: true,
122
132
  fit: true,
123
133
  center: true,
124
- minZoom: 0.1,
125
- maxZoom: 10
134
+ minZoom: MIN_ZOOM, // Allow zooming out further for large diagrams
135
+ maxZoom: MAX_ZOOM, // Allow much higher zoom for detailed inspection
136
+ zoomScaleSensitivity: ZOOM_SCALE_SENSITIVITY, // Smoother zoom increments
137
+ mouseWheelZoomEnabled: true,
138
+ preventMouseEventsDefault: true,
139
+ beforeZoom: function(oldScale, newScale) {{
140
+ // Prevent zooming beyond reasonable limits
141
+ return newScale >= MIN_ZOOM && newScale <= MAX_ZOOM;
142
+ }}
126
143
  }});
127
144
 
128
145
  // Setup node interactions
@@ -142,11 +159,29 @@ def get_html_template(theme: Theme) -> str:
142
159
  }});
143
160
  }};
144
161
 
145
- // Download functionality
162
+ // Button event listeners
146
163
  document.getElementById('downloadButton').addEventListener('click', function() {{
147
164
  downloadSVG();
148
165
  }});
149
166
 
167
+ document.getElementById('zoomInButton').addEventListener('click', function() {{
168
+ if (panZoomInstance) {{
169
+ panZoomInstance.zoomIn();
170
+ }}
171
+ }});
172
+
173
+ document.getElementById('zoomOutButton').addEventListener('click', function() {{
174
+ if (panZoomInstance) {{
175
+ panZoomInstance.zoomOut();
176
+ }}
177
+ }});
178
+
179
+ document.getElementById('resetZoomButton').addEventListener('click', function() {{
180
+ if (panZoomInstance) {{
181
+ panZoomInstance.reset();
182
+ }}
183
+ }});
184
+
150
185
  const downloadSVG = function() {{
151
186
  const svg = document.querySelector('#mySvgId');
152
187
  let svgData = new XMLSerializer().serializeToString(svg);
@@ -183,6 +218,34 @@ def get_html_template(theme: Theme) -> str:
183
218
  panZoomInstance.reset();
184
219
  }}
185
220
  break;
221
+ case '=':
222
+ case '+':
223
+ e.preventDefault();
224
+ if (panZoomInstance) {{
225
+ panZoomInstance.zoomIn();
226
+ }}
227
+ break;
228
+ case '-':
229
+ e.preventDefault();
230
+ if (panZoomInstance) {{
231
+ panZoomInstance.zoomOut();
232
+ }}
233
+ break;
234
+ }}
235
+ }} else {{
236
+ // Non-Ctrl shortcuts
237
+ switch(e.key) {{
238
+ case '+':
239
+ case '=':
240
+ if (panZoomInstance) {{
241
+ panZoomInstance.zoomIn();
242
+ }}
243
+ break;
244
+ case '-':
245
+ if (panZoomInstance) {{
246
+ panZoomInstance.zoomOut();
247
+ }}
248
+ break;
186
249
  }}
187
250
  }}
188
251
  }});
@@ -2,6 +2,15 @@
2
2
 
3
3
  from typing import Any, Dict
4
4
 
5
+ # Mermaid configuration constants for large project support
6
+ MAX_TEXT_SIZE_LARGE_PROJECTS = 900000000 # Increase max text size for large dependency trees
7
+ MAX_EDGES_LARGE_PROJECTS = 20000 # Increase max edges for large projects
8
+
9
+ # Zoom configuration constants for enhanced navigation
10
+ MIN_ZOOM = 0.01 # Minimum zoom level for large diagram overview
11
+ MAX_ZOOM = 50 # Maximum zoom level for detailed inspection
12
+ ZOOM_SCALE_SENSITIVITY = 0.2 # Smoother zoom increments
13
+
5
14
 
6
15
  class Theme:
7
16
  """Base theme configuration class."""
@@ -98,6 +107,8 @@ THEMES = {
98
107
  "secondaryColor": "#f5f5f5",
99
108
  "tertiaryColor": "#ffffff",
100
109
  },
110
+ "maxTextSize": MAX_TEXT_SIZE_LARGE_PROJECTS, # Increase max text size for large dependency trees
111
+ "maxEdges": MAX_EDGES_LARGE_PROJECTS, # Increase max edges for large projects
101
112
  },
102
113
  ),
103
114
  "dark": Theme(
@@ -174,6 +185,8 @@ THEMES = {
174
185
  "nodeTextColor": "#ffffff",
175
186
  "textColor": "#ffffff",
176
187
  },
188
+ "maxTextSize": MAX_TEXT_SIZE_LARGE_PROJECTS, # Increase max text size for large dependency trees
189
+ "maxEdges": MAX_EDGES_LARGE_PROJECTS, # Increase max edges for large projects
177
190
  },
178
191
  ),
179
192
  }
@@ -15,15 +15,6 @@ def find_dependency_files(directory: str, filename: str) -> list[str]:
15
15
  return found_files
16
16
 
17
17
 
18
- def print_maven_help() -> None:
19
- """Print helpful Maven commands for generating dependency files."""
20
- print("\n💡 To generate a Maven dependency file, try one of these commands:")
21
- print(" mvn dependency:tree -DoutputFile=maven_dependency_file")
22
- print(" mvn dependency:tree > maven_dependency_file")
23
- print(" mvn dependency:tree -DoutputFile=maven_dependency_file -DoutputType=text")
24
- print("\n📍 Make sure you're in a directory with a pom.xml file.")
25
-
26
-
27
18
  def validate_directory(directory: str) -> None:
28
19
  """Validate that the directory exists and is accessible."""
29
20
  if not os.path.exists(directory):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mvn-tree-visualizer
3
- Version: 1.4.0
3
+ Version: 1.5.1
4
4
  Summary: A simple command line tool to visualize the dependency tree of a Maven project in a graphical format.
5
5
  Project-URL: source, https://github.com/dyka3773/mvn-tree-visualizer
6
6
  Author-email: Iraklis Konsoulas <dyka3773@gmail.com>
@@ -57,12 +57,10 @@ pip install mvn-tree-visualizer
57
57
  - **JSON:** Creates a structured JSON representation of the dependency tree, perfect for scripting or integration with other tools.
58
58
  - **🎨 Theme System:** Choose from 2 built-in themes (minimal, dark) for clean and consistent diagram styling.
59
59
  - **🔄 Watch Mode:** Automatically regenerates diagrams when Maven dependency files change using the `--watch` flag.
60
- - **📋 Version Display:** Show or hide dependency versions in both HTML and JSON outputs using the `--show-versions` flag.
61
- - **⚡ Easy to Use:** A simple command-line interface that gets the job done with minimal configuration.
62
- - **📂 File Merging:** Automatically finds and merges multiple `maven_dependency_file` files from different subdirectories.
63
- - **🎨 Customizable Output:** Specify the output file name and location.
64
- - **💾 Enhanced Downloads:** Download diagrams as SVG or high-resolution PNG directly from the HTML page.
65
- - **🖱️ Interactive Features:** Hover tooltips, click-to-highlight connections, pan/zoom controls, and keyboard shortcuts.
60
+ - **📋 Version Display:** Toggle dependency versions in outputs with `--show-versions`
61
+ - **💾 Enhanced Downloads:** SVG and PNG export directly from browser
62
+ - **📂 Smart File Handling:** Automatically finds and merges multiple `maven_dependency_file` files from different subdirectories.
63
+ - **🎯 Color Coding:** Visual distinction between root, intermediate, and leaf dependencies
66
64
 
67
65
  ## How to Use
68
66
 
@@ -82,36 +80,36 @@ Use the `mvn-tree-visualizer` command to generate the diagram.
82
80
 
83
81
  #### HTML Output (Interactive Diagram)
84
82
  ```bash
85
- mvn_tree_visualizer --filename "maven_dependency_file" --output "diagram.html" --format html
83
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --format html
86
84
  ```
87
85
 
88
86
  #### JSON Output (Structured Data)
89
87
  ```bash
90
- mvn_tree_visualizer --filename "maven_dependency_file" --output "dependencies.json" --format json
88
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "dependencies.json" --format json
91
89
  ```
92
90
 
93
91
  #### With Version Information
94
92
  ```bash
95
- mvn_tree_visualizer --filename "maven_dependency_file" --output "diagram.html" --show-versions
93
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --show-versions
96
94
  ```
97
95
 
98
96
  #### With Custom Themes
99
97
  ```bash
100
98
  # Dark theme for low-light environments
101
- mvn_tree_visualizer --filename "maven_dependency_file" --output "diagram.html" --theme dark
99
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --theme dark
102
100
 
103
101
  # Default minimal theme (clean monospace design)
104
- mvn_tree_visualizer --filename "maven_dependency_file" --output "diagram.html"
102
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html"
105
103
  ```
106
104
 
107
105
  #### JSON Output with Versions
108
106
  ```bash
109
- mvn_tree_visualizer --filename "maven_dependency_file" --output "dependencies.json" --format json --show-versions
107
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "dependencies.json" --format json --show-versions
110
108
  ```
111
109
 
112
110
  #### Watch Mode (Auto-regeneration)
113
111
  ```bash
114
- mvn_tree_visualizer --filename "maven_dependency_file" --output "diagram.html" --watch
112
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --watch
115
113
  ```
116
114
 
117
115
  > **💡 Tip:** In watch mode, the tool will monitor for changes to your Maven dependency files and automatically regenerate the diagram. Perfect for development workflows! Press `Ctrl+C` to stop watching.
@@ -1,17 +1,17 @@
1
1
  mvn_tree_visualizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  mvn_tree_visualizer/__main__.py,sha256=yIQFAdWjthKAFbSzzRuz5_YGlK0c6BnR2ypjNRDq180,82
3
- mvn_tree_visualizer/cli.py,sha256=Gufk14zH74lqSTz2o2KPPEmNLvOHKHLyno-eSyXqahw,8504
3
+ mvn_tree_visualizer/cli.py,sha256=Kq29UoFPHEKjWzmrs7b-yn4T1bT76PXx984WD3rRco8,8371
4
4
  mvn_tree_visualizer/diagram.py,sha256=UfvP_J4Im4JQLe3EWlY3TsP4tua3oYk5NiCGbZNQwoA,933
5
- mvn_tree_visualizer/enhanced_template.py,sha256=I35fNkZrlA5jYdyjPW0jU4FH4FF2HEagtwcUX6fcmMc,7050
5
+ mvn_tree_visualizer/enhanced_template.py,sha256=AwK4gw5U8Ag-RmeD8Y11LXLRSnVzMFZhWja__c2iF4M,9813
6
6
  mvn_tree_visualizer/exceptions.py,sha256=R4nnJ0xrOpd84GfPD9rFSDk40etDLoph7iZpj1CCR0c,543
7
7
  mvn_tree_visualizer/file_watcher.py,sha256=JtmV1KW08_Az-XqpKhcd342WpxV1vUW-Dge9lodjjJY,2284
8
8
  mvn_tree_visualizer/get_dependencies_in_one_file.py,sha256=nXhEhU-dI7tXa3TpoW1pv2t86t1K0yppSw8FYDtmTlQ,1973
9
- mvn_tree_visualizer/themes.py,sha256=91asg9VIqa7q2sUmgRD-Fw5wJ6kKsVWlPJ-bX9kGZhw,5469
10
- mvn_tree_visualizer/validation.py,sha256=UQ194gHiVS8UnJpp90sCM-Vjn3aeXT6scdwOplAoaSE,3689
9
+ mvn_tree_visualizer/themes.py,sha256=T7vdNVTHPtYYkh4HusGG1MUWk1mJcqFBjCc5IK5l6Dc,6338
10
+ mvn_tree_visualizer/validation.py,sha256=UR_v6Jt7IGsgozE3aK0pB-t2-n1ivvS4YKxEa7p4VLQ,3206
11
11
  mvn_tree_visualizer/outputs/html_output.py,sha256=Y0IY-UF0UMTa5w8mVFoLidgcW6BUBTxASO0iRo26hH4,5531
12
12
  mvn_tree_visualizer/outputs/json_output.py,sha256=cXntw9ndE_BcrmFnuV61cEwZaRMp9Ev0SxaK1SUedlw,2037
13
- mvn_tree_visualizer-1.4.0.dist-info/METADATA,sha256=AIAeZ3goQMeRVtZDxJLIRnlw37nBL1kCMHHRnjk2XuM,8756
14
- mvn_tree_visualizer-1.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- mvn_tree_visualizer-1.4.0.dist-info/entry_points.txt,sha256=Mu3QZhrlvbYuCxqmluVGi2efgKjkQY6T8Opf-vdb7hU,68
16
- mvn_tree_visualizer-1.4.0.dist-info/licenses/LICENSE,sha256=4zi6unpe17RUDMBu7ebh14jdbyvyeT-UA3n8Zl7aW74,1075
17
- mvn_tree_visualizer-1.4.0.dist-info/RECORD,,
13
+ mvn_tree_visualizer-1.5.1.dist-info/METADATA,sha256=F1SJi1YTZyENETyMipYJnojylvqCY3BEu9IbT7pCRpM,8477
14
+ mvn_tree_visualizer-1.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ mvn_tree_visualizer-1.5.1.dist-info/entry_points.txt,sha256=Mu3QZhrlvbYuCxqmluVGi2efgKjkQY6T8Opf-vdb7hU,68
16
+ mvn_tree_visualizer-1.5.1.dist-info/licenses/LICENSE,sha256=4zi6unpe17RUDMBu7ebh14jdbyvyeT-UA3n8Zl7aW74,1075
17
+ mvn_tree_visualizer-1.5.1.dist-info/RECORD,,