Skip to content

A lightweight Svelte component library for building interactive node-based flow diagrams

License

Notifications You must be signed in to change notification settings

openpixel/Svelvet

 
 

Repository files navigation

banner

MIT License NPM Downloads GitHub Stars GitHub Forks NPM Version

Simplify Diagramming with Svelvet!

Svelvet is a lightweight Svelte component library for building interactive node-based diagrams.

⚡ Getting Started | 📚 Documentation | ⌨️ Blog | 💬 Twitter | 💼 LinkedIn

Version Updates

Shout out to our contributors! Here's what's new:

Changelog

v6.0.0
  • Added adaptive anchors. Anchors now automatically arrange themselves in an aesthetically pleasing way without user input. Adaptive anchors are now the default anchor mode.
  • Added dynamic anchors. Anchors now automatically shift position when nodes are moved to preserve aesthetics.
  • Added custom positioning of anchors. Users are able to specify custom positions of anchors using callbacks
  • Added accessibiilty features for edges. Edges now highlight on hover to make edge interactions easier.
  • Added functionality to resize nodes by dragging their bottom-right corner
  • Added custom classes for edges to allow for uniform styling
  • Added click event for edges that execute a user-defined callback
  • Added functionality to edit edges by right-clicking on a node to bring up a modal
  • Added feature to expand and collapse tree nodes.
  • Updated documentation page on website to include new features
  • Updated home page to include newest collaborators
  • Solved github issue #s:
v5.0.0
  • Now compatible with Safari (5.0.7 update)
  • Added interactive node linking & creation
  • Added ability to load custom Svelte components as nodes
  • Added an optional minimap that allows you to visualize larger diagrams
  • Added progammatic initial zoom and location
  • Added custom classes for nodes to allow for uniform styling
  • Added a feature that allows you to export and import diagrams
  • Added an optional boundary to the diagram
  • Added functionality to edit nodes by right-clicking on a node to bring up a modal
  • Added an optional feature that allows users to delete nodes
  • NOTE: Please make sure to give nodes and edges unique IDs to prevent forEach key duplicate error!
  • Solved github issue #s: 65, 78, 80, 81, 85, 86, 104, 105, 146, 147, 148, 151, 153, 158
  • Updated documentation page on website to include new features
  • Updated home page to include newest collaborators
v4.0.0
  • Added ability to include HTML in inside of nodes (i.e. videos, sounds, etc)
  • Added NPM Package folder in root directory of GitHub repo
  • this folder is used for adding changes to library & pushing updates to NPM; included here to have version control through GitHub
  • Added snap-to-grid functionality for use during runtime in the canvas (GitHub Issue 107)
  • Corrected issue where nodes become magnetized when moved outside of the visible canvas boundaries (GitHub Issues 120 & 125)
  • Removed unused dotenv & node.env dependency from NPM Package package.json (GitHub Issue 118)
  • Moved all dependancies in devDependancies to regular dependancies object, except for d3-zoom which is used by the client during runtime
  • Added group nodes functionality
  • Updated main website page to include newest set of collaborators
  • Added CSS option for canvas background
  • Added documentation for HTML in nodes, snap-to-grid, canvas background coloring, and node grouping to website documents
  • General refactoring throughout application to improve responsiveness and decrease size
  • Created documentation to assist future developers in understanding the flow of data in Svelvet and provide list of potential updates/upgrades
v3.0.0
  • Added right-click context menu functionality on REPL playground page
  • Added capability to add custom nodes and edges via context menu
  • Added custom node/edge shortcuts for optimized user experience
  • Incorporated dynamic addition of custom node/edge via predictive algorithm
  • Added ability to copy text from code editor
  • Node diagrams now have the option to be fixed in place
  • Added tutorial overlay for REPL playground page
  • Added ability to access quick view documentation via popup modal
  • Updated documentation to allow easier contributor access('.env' file setup)
  • Updated Community link on website to redirect to Svelvet thread on Stackoverflow
  • Implemented skeleton codebase for a Community Forum with full database/route accessibility(for future contributors)
v2.0.2
  • Added left and right anchor points
  • Added step and smoothstep edge types
  • Incorporated mixed edge functionality
  • Refactored how edge text and labels render for every edge
  • Fixed D3Zoom bias bug
  • Expanded styling options, including label color, label background, and edge color
  • Nodes are now able to contain images and will render differently based on the presence of label text
  • Nodes are now draggable on touch screens and reposition themselves to center on your touch
  • Implemented data reactivity
  • Expanded TypeScripting
  • Added E2E testing using Cypress
  • Expanded unit tests
  • Added a REPL to our documentation site
  • Added SQL database to our REPL
  • Added GitHub OAuth to enable users to save their custom diagrams created in our new REPL
  • Expanded documentation for new features
  • Added full CI/CD pipeline
v1.0.3
  • Fixed bug with running tests
  • Added ability to render multiple unique Svelvet components
  • Added a 'clickCallback' customization option for nodes
v1.0.2
  • Fixed bug with importing types for TypeScript applications
  • Added a 'borderRadius' customization option for nodes
  • Fixed SVG zoom/pan bug (zoom/pan is now limited to Svelvet component only)

Key Features

  • Easy to use: To get started with Svelvet, all you need is data for nodes and edges. Visit our documentation website for streamlined, user-friendly tutorials and examples on how to get the most out of your Svelvet flowchart!
  • Interactive: Elegant and smooth interface when selecting a node to drag it across the graph.
  • Customizable: Ability to customize your nodes and edges (node size, color, border and edge type, label, anchor). More coming soon!
  • Fast rendering: Re-rendering is based on changes to initial values for nodes, edges and optional background and movement (collaborator credit to dvisockas).
  • Reliable: Svelvet is written in TypeScript and tested with Vitest, Cypress and Svelte Testing Library. Svelvet is maintained by motivated engineers seeking to contribute to the larger Svelte developer community and library ecosystem.
  • Room to Grow: There is so much we can do to improve, add features and make Svelvet the best version of itself - we welcome feedback and contributions! Scroll below for suggestions on what to contribute.

screenshot

Installation

Svelvet is available as both an npm and a yarn package. You can install it by running one of the two commands:

npm install svelvet
yarn add svelvet

Quick Start

Start by importing Svelvet into your application:

import Svelvet from 'svelvet';

A Svelvet component consists of nodes and edges (or just nodes). You can pass nodes and edges as props to the Svelvet component. By default, Svelvet components allow for the ability to move nodes and edges as well as pan and zoom. However, if you would like to render a fixed diagram, simply pass in the movement attribute and set it's value to false! You can add a dot-grid background like the example below. With the information that you provide for your nodes and edges, Svelvet will do all of the work behind-the-scenes to render your flowchart!

<Svelvet nodes={nodes} edges={edges} movement background />

Visit our website to learn more on how to customize your nodes and edges to your liking!

Testing

Testing is done with Vitest and the Svelte Testing Library. You can find tests in the /tests folder. In order to run the tests use the command:

For Unit testing

npm run test:unit

For End-to-End testing

npm run cypress:open

The Svelvet Team

Forking the Repository

If you'd like to fork the repository and run it locally, you'll need to perform a couple of steps to in order to get everything working properly:

  • Create an account on Supabase
  • Create a new project in Supabase (you can name this whatever you want)
  • Rename the 'supabase_env' file to '.env' and paste in the API keys from your newly created supabase project into the .env file

Once that is done you should be able to render the website locally on localhost:3000, although you will be missing some minor functionality tied to the production database (e.g. OAuth login).

How to Contribute

Read src/lib/doc/README.md for suggestions on how to get started!

The following is a list of features and improvements by ourselves and the larger Svelte community for any open source developer to contribute. If you have any additional ideas, feel free to raise the issue or implement them as well!

  • Premade node menu with drag & drop abilities
  • Rotating of nodes
  • Add documentation/video tutorial on how to set up a Svelvet demo
  • Custom error handling
  • Increase test coverage for scalability
  • More styling and customization of edges for complex Svelvet flow diagrams
  • Community Forum
  • GET CREATIVE!! Svelvet is an amazing project that has so much room to grow.

Credits

Inspired by React Flow, Svelvet expands the tools available to Svelte developers and makes Svelte more inviting to both new and seasoned software engineers. Under the hood, Svelvet depends on the d3-zoom library to zoom and pan across the graph.

License

Svelvet is developed under the MIT license.

About

A lightweight Svelte component library for building interactive node-based flow diagrams

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Svelte 69.4%
  • TypeScript 22.3%
  • JavaScript 6.7%
  • HTML 1.1%
  • Other 0.5%