README
Visual Node Editor
A modern, web-based presentation creation tool that combines the familiarity of traditional slide-based presentations with the flexibility of a visual node editor.
Overview
Visual Node Editor is a React/TypeScript application that allows users to create dynamic, interactive presentations using a node-and-connection metaphor. Unlike traditional linear slide decks, this tool enables non-linear presentation flows with rich animations and interactive elements.
Features
๐จ Visual Node-Based Design
- Drag-and-drop interface for adding presentation elements
- Visual connections between elements with animated effects
- Non-linear presentation flows
- Snap-to-grid functionality for precise alignment
- Advanced zoom and pan controls with keyboard shortcuts
๐ Rich Content Types
- Shapes: Rectangle, circle, diamond
- Text Elements: Titles, subtitles, body text, code blocks, bullet lists,
- Media:
- Icons: Extensive icon library with customization options
- Lines:
โจ Animation System
- Transition effects (fade, slide, scale, draw)
- Line animations (particles, energy, chase effects)
- Configurable animation speeds and intensities
- Page-to-page transitions
๐ค Presentation Mode
- Full-screen presentation view
- Drawing and annotation tools (fully functional)
- Highlighter and pen tools with customizable colors
- Virtual laser pointer
- Real-time annotations during presentations
- No hover effects or selection highlights in presentation mode
- Fixed presentation toolbar positioning
๐๏ธ Project Organization
- Hierarchical structure: Projects โ Presentations โ Pages
- Project-based organization for related presentations
- Search and filter capabilities
- Automatic localStorage management with quota handling
๐ค Export Capabilities
- Export to PowerPoint (PPTX) format
- Maintains formatting and layout
๐ Template System
- Pre-built templates for various use cases
- Categories: Business, Education, Technical, Creative
- Customizable placeholders
๐จ Theme System
- Built-in Themes: Default (light), Company (branded), and Dark themes
- Company Theme: Professional blue background (#1A1F71) with yellow text
- Theme Persistence: Selected theme saves to localStorage
- Dynamic Theme Switching: Instant theme changes via dropdown selector
- Presentation Mode Support: Themes apply consistently in both edit and
- Customizable Typography: Each theme includes font families and sizes
๐จ Page Customization
- Configurable page background colors
- Support for transparent backgrounds
- Frame position and size controls
- Automatic frame dimension inheritance between pages
โ๏ธ Node Slicing System
- CSS Clip-Path Based Slicing: Split any node into multiple pieces using CSS
- Universal Compatibility: Works with all node types (text, images, videos,
- Flexible Splitting:
- Slice Management:
- Property Synchronization: When properties are changed on any slice, all
- Magnet Mode: Automatically spaces split pieces with 10px gaps when enabled
- Snap Together: Slices snap back together when dragged close to each other
- Merge Functionality: One-click merge to restore original node for editing
- Context Menu Integration:
- Presentation Benefits: Progressive content reveal with sliced pieces on
โก Performance Optimizations
- Optimized component architecture with custom hooks
- Efficient state management to prevent excessive re-renders
- Video performance manager for smooth playback
- Automatic localStorage cleanup when quota is exceeded
- Advanced getEffectiveNodes/Connections with Map-based implementation
- Improved rendering performance with memoized calculations
๐ง Advanced Features
- Ghost Nodes: Visual preview of previous page elements during transitions
- Event Deletion Handlers: Clean up property changes when navigating pages
- Enhanced Copy/Paste: Support for copying and pasting both nodes and
- Template System: Full template functionality with insert position support
- Navigation Handlers: Quick navigation to first/last page and zoom reset
- Frame Property Tracking: Advanced frame property inheritance system
Getting Started
Prerequisites
- Node.js (v14 or higher)
- npm or yarn
Installation
git clone [repository-url]
cd present
npm install
npm start
The application will open at http://localhost:3000
Available Scripts
Development
npm start- Runs the app in development modenpm build- Builds the app for productionnpm run storybook- Launch Storybook for component developmentnpm run lint- Run ESLint checksnpm run typecheck- Run TypeScript type checking
Development Helper Scripts
./dev-all.sh- Start development environment with React app and Storybook
--force or -f - Auto-kill existing processes on ports without
prompting
- --no-storybook or -ns - Skip starting Storybook
- Can combine: ./dev-all.sh -f -ns for force kill and no Storybook
- Automatically checks and cleans ports 3002 (React) and 6006 (Storybook)
- React app runs on port 3002 to avoid Docker conflicts
- Provides colored output and real-time logs
./stop-dev.sh- Stop all development processes started by dev-all.sh
Code Quality & Analysis
./analyze.sh- Run full code analysis with complexity metrics./dev-analyze-next.sh- Get AI-powered recommendations for next refactoring
./check-storybook.sh- Verify all Storybook stories compile correctly
./tools/code-analysis/analyze-with-tools.sh- Advanced analysis toolkit
--ai flag: Get AI recommendations for refactoring
- --detailed flag: Generate detailed HTML reports
- Produces complexity metrics and visualizations
npm test- Runs the test suitenpm eject- Ejects from Create React App (one-way operation)
Usage
Keyboard Shortcuts
#### Edit Mode
- Ctrl/Cmd + C: Copy selected node or connection
- Ctrl/Cmd + V: Paste copied node or connection (with snap-to-grid support)
- Delete/Backspace: Delete selected node or connection
- Ctrl + G: Toggle grid visibility
- Ctrl/Cmd + 0: Zoom to fit
- Ctrl/Cmd + 1: Zoom to actual size
- 0: Zoom to fit (without modifier)
- 1: Zoom to actual size (without modifier)
- Ctrl/Cmd + =/-: Zoom in/out
- WASD/Arrow Keys: Pan the canvas
- F1: Show keyboard shortcuts help
- ?: Show keyboard shortcuts help
- Space: Next page (Shift+Space for previous)
- Arrow Left/Right: Navigate pages
- Home/End: First/last page
- H: Toggle highlighter tool
- P: Toggle pen tool
- L: Toggle laser pointer
- A: Toggle annotation tool
- Escape: Clear active tool
- C: Clear all drawings
- 1-5: Select highlighter colors
- +/-: Increase/decrease stroke width
- F1: Show help
- F11: Toggle fullscreen
Video Features
Video Time Controls
The video node supports precise playback control with start and end time settings:
- Start Time: Set the point (in seconds) where the video should begin
- End Time: Set the point (in seconds) where the video should stop or loop
- Page-Specific Settings: Each page can have different start/end times for
- Loop Support: Videos can loop between the start and end times
Usage
Example Use Cases
- Show only relevant portions of a longer video
- Create video loops for background effects
- Different video segments on different pages without duplicating the video
- Clean editing experience with no unexpected video playback
Edit Mode vs Presentation Mode
- Edit Mode: Videos never autoplay, allowing peaceful content creation and
- Presentation Mode: Videos autoplay according to your settings (autoplay,
- Seamless transition between modes with proper video state management
Tech Stack
- React - UI framework
- TypeScript - Type safety
- react-dnd - Drag and drop functionality
- pptxgenjs - PowerPoint export
- CSS Modules - Component styling
Node Component Architecture (Refactored - v2)
The Node component has been successfully refactored from a single 2900+ line file with complexity score of 602 into a modular architecture for better maintainability:
Refactoring Results
- Before: Single file, 2900+ lines, complexity score 602
- After: Modular architecture with separated concerns
- Location:
src/components/organisms/node/
Core Structure
node/index.tsx- Main orchestrator component (350 lines)node/NodeTypes.ts- TypeScript interfaces and type definitionsnode/NodeUtils.ts- Utility functions for all node operations
Component Modules (node/components/)
NodeText.tsx- Text rendering with markdown supportNodeImage.tsx- Image handling with loading statesNodeVideo.tsx- Video playback with time controlsNodeIcon.tsx- Icon rendering from icon libraryNodeCode.tsx- Code blocks with syntax highlightingNodeBulletList.tsx- Lists (bullet/numbered/checklist)NodeQuote.tsx- Quote blocks with attribution
Custom Hooks (node/hooks/)
useNode.ts- Main hook combining all node functionalityuseNodeDrag.ts- Drag behavior with throttlinguseNodeResize.ts- Resize with directional handlesuseNodeConnections.ts- Line endpoint connections
Utility Functions (node/NodeUtils.ts)
parseMarkdown()- Markdown to HTML conversiongetTransitionClasses()- Animation class calculationapplySyntaxHighlighting()- Code highlightinggetConnectorPosition()- Connector coordinate calculationfindNearestConnector()- Snap-to-connector detectioncalculateLineEndpoints()- Line endpoint calculations
Storybook Integration
- Component stories in
src/stories/node/ - Interactive documentation for each node type
- Visual testing capabilities
Using the Node Components
// Import the refactored Node component
import Node from './components/organisms/node';
import { NodeType } from './types';
// Basic usage remains the same
<Node
node={nodeData}
isSelected={selectedNodeId === nodeData.id}
zoom={currentZoom}
onMove={handleNodeMove}
onResize={handleNodeResize}
onSelect={handleNodeSelect}
onDelete={handleNodeDelete}
/>
// Individual components can be imported for custom use
import NodeText from './components/organisms/node/components/NodeText';
import { useNodeDrag } from './components/organisms/node/hooks/useNodeDrag';
Project Structure
src/
โโโ app/ # Modular architecture (in progress)
โ โโโ components/
โ โ โโโ AppContainer.tsx # Main container with integrated hooks
โ โ โโโ AppLayout.tsx # Layout structure component
โ โ โโโ AppProviders.tsx # Context providers
โ โโโ hooks/
โ โ โโโ useProjectManagement.ts # Project CRUD operations
โ โ โโโ usePageManagement.ts # Page navigation and management
โ โ โโโ useConnectionOperations.ts # Connection CRUD operations
โ โ โโโ useClipboardOperations.ts # Copy/cut/paste functionality
โ โ โโโ usePresentationMode.ts # Presenter mode management
โ โ โโโ useTemplateManagement.ts # Template system
โ โโโ utils/
โ โ โโโ constants.ts # App-wide constants
โ โ โโโ adapters.ts # Type conversion utilities
โ โโโ types/
โ โ โโโ AppTypes.ts # Modular type definitions
โ โโโ REFACTORING_PLAN.md # Detailed refactoring roadmap
โโโ components/
โ โโโ Canvas.tsx # Main drawing surface
โ โโโ Node.tsx # Presentation elements
โ โโโ Connection.tsx # Visual connections
โ โโโ Palette.tsx # Element palette
โ โโโ PropertiesPanel.tsx # Property editor
โ โโโ ...
โโโ hooks/
โ โโโ useNodeOperations.ts # Node manipulation logic
โ โโโ usePresentationState.ts # Presentation state management
โ โโโ useFileOperations.ts # File import/export
โ โโโ useSketchMode.ts # Sketch/drawing functionality
โ โโโ useZoomPan.ts # Zoom and pan controls
โโโ pages/
โ โโโ ProjectHome.tsx # Project management
โ โโโ PresentationHome.tsx # Presentation overview
โโโ utils/
โ โโโ exportToPowerPoint.ts # Export functionality
โโโ App.tsx # Legacy application component
โโโ AppNew.tsx # Current main application (being refactored)
Refactoring Progress
The codebase is currently undergoing a major modular refactoring to improve maintainability and reduce complexity:
- Current Status: ~50% complete
- Main Target: AppNew.tsx (2,268 lines โ target: <200 lines per module)
- Complexity Reduction: 241 โ target: <20 per module
- Completed Extractions:
- Next Steps: Migrate UI components from AppNew to modular structure
./dev-analyze-next.sh to get AI recommendations for the next refactoring
targets.Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is private. Please check with the repository owner for licensing information.