Back to Visual Node Editor

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,
quotes
  • Media:
- Images with URL or file upload support - Videos with external URL support (HTTP/HTTPS) - Advanced video playback controls: - Mute, loop, and autoplay options - Video Start/End Time Controls: Set precise playback segments (e.g., play from 60s to 75s) - Page-Specific Video Properties: Different start/end times on different pages - Autoplay on Page Show: Videos can autoplay when a page loads in presentation mode - Edit Mode Protection: Videos never autoplay in edit mode for clean editing experience - Optimized video performance with reference-based loading
  • Icons: Extensive icon library with customization options
  • Lines:
- Absolute positioning system - endpoints have fixed canvas coordinates - Node box automatically adjusts to contain the line - Flexible endpoint positioning anywhere on canvas - Click detection on the line path for easier selection - Transparent selection border for better visibility - Enhanced endpoint handles with drop shadows - Shift-constraint for straight lines (45ยฐ angle snapping) - Real-time coordinate display while dragging - Smart Connector Snapping System: - Automatic detection and snapping to node connectors within 30px - Visual feedback with highlighted connectors (green glow effect) - Connection tracking with persistent state management - Auto-update line endpoints when connected nodes move - Smart disconnect when endpoints dragged >60px from connectors - Enhanced endpoint styling (green for connected, blue for free) - Smooth transitions and animations for all interactions - Advanced animation effects

โœจ 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
(#F7B600)
  • 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
presentation modes
  • 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
- New pages inherit position, width, and height from the current page - Ensures consistent layout when navigating between pages - Customizable frame properties persist across page creation

โœ‚๏ธ Node Slicing System

  • CSS Clip-Path Based Slicing: Split any node into multiple pieces using CSS
clipping
  • Universal Compatibility: Works with all node types (text, images, videos,
shapes, etc.)
  • Flexible Splitting:
- Split horizontally or vertically at custom positions (default 50%) - Split pieces can be further split into more pieces - Each piece acts as an independent node (can be moved, selected, copied)
  • Slice Management:
- Sliced pieces are read-only (must merge to edit content) - Visual indicators show piece numbers (Part 1/2, Part 2/3, etc.) - Purple dashed borders indicate sliced nodes
  • Property Synchronization: When properties are changed on any slice, all
slices in the group update together (they represent the same node)
  • Magnet Mode: Automatically spaces split pieces with 10px gaps when enabled
  • Snap Together: Slices snap back together when dragged close to each other
(within 20px)
  • Merge Functionality: One-click merge to restore original node for editing
  • Context Menu Integration:
- "Split Node Horizontally/Vertically" for regular nodes - "Split This Piece" for already sliced pieces - "Merge All Slices" to reconstruct original - "Auto-Space Slices" to reorganize with gaps - "Snap Together" to align slices at same position
  • Presentation Benefits: Progressive content reveal with sliced pieces on
different pages

โšก 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
connections
  • 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

  • Clone the repository:
  • bash
    git clone [repository-url]
    cd present

  • Install dependencies:
  • bash
    npm install

  • Start the development server:
  • bash
    npm start

    The application will open at http://localhost:3000

    Available Scripts

    Development

    • npm start - Runs the app in development mode
    • npm build - Builds the app for production
    • npm run storybook - Launch Storybook for component development
    • npm run lint - Run ESLint checks
    • npm run typecheck - Run TypeScript type checking

    Development Helper Scripts

    • ./dev-all.sh - Start development environment with React app and Storybook
    - Options: - --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
    targets - Analyzes code complexity using plato - Identifies files with highest cyclomatic complexity - Provides specific refactoring strategies - Tracks refactoring progress over time
    • ./check-storybook.sh - Verify all Storybook stories compile correctly
    - Checks framework configuration - Validates story imports - Runs ESLint on story files - Builds static Storybook for verification
    • ./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 suite
    • npm eject - Ejects from Create React App (one-way operation)

    Usage

  • Create a Project: Start by creating a new project from the home screen
  • Add a Presentation: Within a project, create one or more presentations
  • Design Your Slides:
  • - Use the palette to drag and drop elements onto the canvas - Connect elements with animated lines - Customize properties using the properties panel
  • Present: Enter presentation mode to deliver your content with interactive
  • tools
  • Export: Export your presentation to PowerPoint format for sharing
  • 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
    #### Presentation Mode

    • 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
    playing
    • 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
    the same video
    • Loop Support: Videos can loop between the start and end times

    Usage

  • Add a video node to your presentation
  • Select the video node to open the properties panel
  • In the "Time Range" section:
  • - Set "Start Time" to begin playback at a specific point (default: 0) - Set "End Time" to stop at a specific point (leave empty for full video)
  • These settings can be different on each page of your presentation
  • 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
    editing
    • Presentation Mode: Videos autoplay according to your settings (autoplay,
    autoplay on page show)
    • 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 definitions
    • node/NodeUtils.ts - Utility functions for all node operations

    Component Modules (node/components/)

    • NodeText.tsx - Text rendering with markdown support
    • NodeImage.tsx - Image handling with loading states
    • NodeVideo.tsx - Video playback with time controls
    • NodeIcon.tsx - Icon rendering from icon library
    • NodeCode.tsx - Code blocks with syntax highlighting
    • NodeBulletList.tsx - Lists (bullet/numbered/checklist)
    • NodeQuote.tsx - Quote blocks with attribution

    Custom Hooks (node/hooks/)

    • useNode.ts - Main hook combining all node functionality
    • useNodeDrag.ts - Drag behavior with throttling
    • useNodeResize.ts - Resize with directional handles
    • useNodeConnections.ts - Line endpoint connections

    Utility Functions (node/NodeUtils.ts)

    • parseMarkdown() - Markdown to HTML conversion
    • getTransitionClasses() - Animation class calculation
    • applySyntaxHighlighting() - Code highlighting
    • getConnectorPosition() - Connector coordinate calculation
    • findNearestConnector() - Snap-to-connector detection
    • calculateLineEndpoints() - Line endpoint calculations

    Storybook Integration

    • Component stories in src/stories/node/
    • Interactive documentation for each node type
    • Visual testing capabilities

    Using the Node Components

    typescript
    // 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

    shell
    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:
    - โœ… Project management logic - โœ… Page management operations - โœ… Node operations (already existed) - โœ… Connection operations - โœ… Sketch/drawing mode - โœ… Presentation mode - โœ… Template management - โœ… Clipboard operations - โœ… Layout and provider components
    • Next Steps: Migrate UI components from AppNew to modular structure
    Use ./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.

    ยฉ 2026 Jonathan Leahy ยท v0.8.8-2-g254d590