Skip to content
forked from newcat/baklavajs

Graph / node editor in the browser using VueJS

License

Notifications You must be signed in to change notification settings

Gehbt/baklavajs

Repository files navigation

BaklavaJS

Build Status

Graph / node editor in the browser using VueJS example

Package Version
@baklavajs/core npm (scoped)
@baklavajs/plugin-engine npm (scoped)
@baklavajs/plugin-interface-types npm (scoped)
@baklavajs/plugin-options-vue npm (scoped)
@baklavajs/plugin-renderer-vue npm (scoped)

Introduction

BaklavaJS is a graph/node editor for the web. It provides an easy-to-use editor together with the ability to create custom nodes. Aditionally, it puts a strong emphasis on extensibility, which lead to an versatile plugin system. To guarantee type safety, the entirety of the BaklavaJS ecosystem is written in TypeScript.

The core functionality is shipped in the @baklavajs/core package. Any other functionality can be added a-la-carte by installing the desired plugins:

  • Engine: Provides functions to run calculations with the graph.
  • Interface Types: Adds types to node interfaces and allowing connections only between types that you want to. It can also automatically convert values from one type to another.
  • Vue Renderer: Displays the editor in the browser using VueJS
  • Vue Options: Adds predefined node options in Baklava style

Getting Started

For a more extensive documentation, have a look here: https://newcat.github.io/baklavajs

Without Vue / NPM

Add these lines in your HTML file:

<!-- in your <head> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/baklavajs/dist/styles.css">

<!-- in your <body> -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/@baklavajs/core/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@baklavajs/plugin-engine/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@baklavajs/plugin-interface-types/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@baklavajs/plugin-options-vue/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@baklavajs/plugin-renderer-vue/dist/index.js"></script>

Now you can use the factory function createBaklava:

<div style="width:90vw;height:90vh">
    <div id="editor"></div>
</div>

<script>
const plugin = BaklavaJSRendererVue.createBaklava(document.getElementById("editor"));
const editor = plugin.editor;
</script>

The function will return a ViewPlugin instance which in turn contains a reference to the Editor instance.

With Vue / NPM

First, you need to install the library:

# npm
npm i @baklavajs/core
# plugins
npm i @baklavajs/plugin-engine @baklavajs/plugin-interface-types @baklavajs/plugin-options-vue @baklavajs/plugin-renderer-vue

# yarn
yarn add @baklavajs/core
# plugins
yarn add @baklavajs/plugin-engine @baklavajs/plugin-interface-types @baklavajs/plugin-options-vue @baklavajs/plugin-renderer-vue

To display the editor in the browser follow the steps described here

About

Graph / node editor in the browser using VueJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 70.6%
  • Vue 20.9%
  • SCSS 7.1%
  • Other 1.4%