Add interactive website#6
Merged
Merged
Conversation
Launches a FastAPI server that renders the directory tree as a zoomable, navigable D3.js treemap in the browser. Key features: - Collapsible settings sidebar: depth, log-scale (slider 1-10), font size, colormap, canvas size, exclude/include/highlight patterns - Van Wijk cushion shading matching the PNG/SVG renderers - Dark/light mode toggle (dark default) - Multi-selection via shift-click with batch delete and copy-paths - Drag-resizable sidebar with movable divider - Context menu: file/folder info, delete, move, multi-select actions - Live file-system updates via WebSocket + watchdog debounce - Write operations guarded by read-only source detection - Default excludes: .git, .venv, node_modules, .yarn, .pnpm-store, __pycache__, *.pyc, .mypy_cache - Depth slider max set dynamically from actual tree depth - Log scale and default settings applied on initial page load Install extras: pip install 'dirplot[serve]'
- node_to_dict: resolve actual dir name when node.name is empty (e.g. root '.') - zoomInto: build full ancestor chain via pathChain() so breadcrumb shows the complete path, not just the clicked node
- Three tabs replace the flat settings list: Settings (existing), Metrics, Preview - Metrics: GET /api/metrics endpoint runs tree_metrics_dict and renders files/dirs/size/depth/extensions/largest files+dirs - Preview: GET /api/file endpoint serves text (with extension hint for highlight.js) or base64-encoded images; auto-switches to Preview tab on file click - Syntax highlighting via highlight.js@11 CDN; theme follows dark/light mode toggle - Metrics cache invalidated on Apply / Reset so re-opening the tab re-fetches after config changes
- api_file: resolve relative paths against root_path instead of CWD, so preview works regardless of which directory the server was started from - api_file: clearer error message when root_path is None (remote sources) - previewFile: auto-expand sidebar when collapsed so preview is visible
- Promote serve deps to core (fastapi, uvicorn, jinja2, python-multipart) - /api/file reads embedded metadata for .png/.svg/.mp4/.mov and returns it - New /api/file-stream endpoint streams video files for <video> playback - .mp4/.mov/.webm files now render as <video controls> in the preview panel - Metadata table shown below image/video when dirplot metadata is present
… for remote sources
- Add remote file preview via GitHubSource.read_file(); other remote sources return a 403 gracefully - Add PNG/SVG export from toolbar with embedded JetBrains Mono font; export CSS resolves --dir-border at export time so borders appear - Fix export dropdown not collapsing (missing #export-menu.hidden rule) - Add HEIC/HEIF preview via pillow-heif or macOS sips fallback - Add audio file preview (mp3/wav/ogg/flac/aac/m4a/opus/weba) - Fix .mov preview: remap MIME to video/mp4 for Chrome/Firefox compat - Fix binary file hex dump: use errors="strict" so non-UTF-8 files actually reach the 1000-byte hex dump path - Fix absolute local paths in source field not loading - Fix metadata read crash when ffprobe returns invalid JSON - Improve Python rounding in render_png/svg_render (defer to draw time) - Add source history dropdown: localStorage-backed, max 20 entries, per-item delete, closes on outside click via capture-phase listener - Add folder/file border colours as solid #fff/#000 following dark/light - Add pillow_heif to mypy ignore_missing_imports overrides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of Change
Checklist
make test)make lint)