Skip to content

Add export to PNG, SVG, and animated GIF#5

Merged
tmcfarlane merged 8 commits into
mainfrom
feature/export-to-gif
Apr 13, 2026
Merged

Add export to PNG, SVG, and animated GIF#5
tmcfarlane merged 8 commits into
mainfrom
feature/export-to-gif

Conversation

@tmcfarlane
Copy link
Copy Markdown
Owner

@tmcfarlane tmcfarlane commented Apr 12, 2026

Summary

  • Add export dropdown to the toolbar with three options: PNG, SVG, and animated GIF
  • PNG and SVG exports capture the flowchart using html-to-image, filtering out UI chrome (controls, minimap, background grid)
  • GIF export captures animated dashed edges by manually stepping stroke-dashoffset per frame, encoding with gif.js at 10fps
  • User-configurable GIF duration (1-10 seconds)
  • Progress indicator shown during GIF capture and encoding
  • Full dark mode support for export UI and correct background colors in exports

Demo

GIF:
flowchart

SVG:
flowchart

PNG:
flowchart

Test plan

  • TypeScript compiles with no errors
  • All 20 existing tests pass
  • Production build succeeds
  • Manually test PNG export (downloads correct image with background)
  • Manually test SVG export (downloads vector file)
  • Manually test GIF export with animated edges (dashes flow in the GIF)
  • Verify GIF duration input clamps between 1-10 seconds
  • Verify export dropdown closes on click outside and ESC
  • Verify dark mode styling of export dropdown

- Implemented GIF export feature using gif.js, allowing users to record flowcharts as GIFs.
- Added export options for PNG and SVG formats.
- Introduced a dropdown menu in the toolbar for export options.
- Enhanced Toolbar component to manage export states and handle user interactions.
- Updated styles for the export dropdown and options to improve UI/UX.
- Added type definitions for gif.js to ensure TypeScript compatibility.
- Created utility functions for exporting to PNG, SVG, and GIF formats.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flowchart Ready Ready Preview, Comment Apr 13, 2026 4:05am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds export functionality to the flowchart editor, enabling users to download the current canvas as PNG, SVG, or an animated GIF (including animated dashed edges) via a new toolbar dropdown.

Changes:

  • Introduces exportUtils with PNG/SVG export via html-to-image and animated GIF export via gif.js.
  • Adds an Export dropdown UI to the toolbar, including GIF duration input and progress/encoding indicators.
  • Adds gif.js worker file to public/ and wires dependencies/types for TypeScript.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils/exportUtils.ts Implements PNG/SVG/GIF export helpers and DOM filtering for “UI chrome”.
src/types/gif.js.d.ts Adds TypeScript declarations for gif.js.
src/components/Toolbar.tsx Adds Export dropdown UI, duration input, progress display, and wiring to export helpers.
src/components/Toolbar.css Styles the Export dropdown (light/dark mode).
src/App.tsx Passes reactFlowWrapper ref into the Toolbar so exports can target the correct DOM node.
public/gif.worker.js Adds the gif.js worker script used for GIF encoding.
package.json Adds gif.js and html-to-image dependencies.
package-lock.json Locks new dependencies.
.gitignore Ignores .omc/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/exportUtils.ts Outdated
Comment thread src/utils/exportUtils.ts Outdated
Comment thread public/gif.worker.js Outdated
tmcfarlane and others added 2 commits April 12, 2026 19:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Changed the development server port in package.json to 3004 for better accessibility.
- Refactored gif.worker.js to remove unnecessary comments and improve code readability.
@tmcfarlane tmcfarlane merged commit 8b97852 into main Apr 13, 2026
2 checks passed
@tmcfarlane tmcfarlane deleted the feature/export-to-gif branch April 13, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants