Thank you for your interest in contributing to Open MindMap! This guide will help you get started.
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
Before creating a bug report, please check existing issues to avoid duplicates.
When filing a bug report, include:
- A clear, descriptive title
- Steps to reproduce the behavior
- Expected behavior vs. actual behavior
- Browser and OS information
- Screenshots or screen recordings if applicable
- A minimal code example that reproduces the issue
Feature requests are tracked as GitHub issues. When suggesting a feature:
- Use a clear, descriptive title
- Explain the use case and why existing features don't address it
- Provide examples of how the feature would work
- Fork the repository and create your branch from
main - Follow the development setup below
- Make your changes
- Ensure your code passes type checking and linting
- Write a clear PR description explaining your changes
# Fork and clone the repository
git clone https://github.com/<your-username>/mindmap.git
cd mindmap
# Install dependencies
pnpm install
# Start the dev server
pnpm devThe dev server starts at http://localhost:5173 with hot module replacement.
| Command | Description |
|---|---|
pnpm dev |
Start development server with HMR |
pnpm build |
Type-check and build the demo app |
pnpm build:lib |
Build the library for npm publishing |
pnpm lint |
Run ESLint |
pnpm preview |
Preview the production build locally |
Before submitting a PR, make sure:
# Type checking passes
pnpm build
# Linting passes
pnpm lint
# Library build succeeds
pnpm build:libsrc/components/MindMap/
index.ts Public API exports
MindMap.tsx Main component (orchestrator)
MindMap.css Styles
types.ts Shared TypeScript types
components/ Sub-components
hooks/ React hooks
utils/ Pure logic & utilities
- MindMap.tsx is the orchestrator. It wires together hooks, manages cross-cutting state, and renders the SVG container.
- components/ contains presentational sub-components (node rendering, controls, context menu).
- hooks/ encapsulates stateful logic (drag & drop, pan/zoom, editing, theme detection).
- utils/ contains pure functions with no React dependency (tree operations, layout algorithm, markdown parsing, export).
- SVG-based - all rendering is done with SVG elements, no canvas or DOM-heavy approaches
- Immutable data operations - tree manipulation functions in
utils/tree-ops.tsalways return new objects - Zero runtime dependencies - the only peer dependency is React itself
- Theme-aware - all colors flow through the theme system in
utils/theme.ts
- Use explicit types for function parameters and return values at module boundaries
- Prefer
interfaceovertypefor object shapes - Use
typefor unions and utility types
- Use function components exclusively
- Extract reusable logic into custom hooks
- Keep components focused - if a component grows beyond ~200 lines, consider splitting it
- Use
useCallbackanduseMemowhere reference stability matters for child components
- Use BEM-like naming with the
mindmap-prefix (e.g.,mindmap-node-animated) - Prefer inline styles for theme-dependent colors
- Use CSS classes for structural layout and animations
- Use clear, concise commit messages
- Start with a verb in the imperative mood (e.g., "Add dark mode support", "Fix node flicker on edit")
Releases are managed by maintainers. The library is published to npm as @xiangfa/mindmap.
- Open a GitHub issue for bugs and feature requests
- Start a GitHub Discussion for questions and ideas
Thank you for contributing!