├── .gitattributes
├── .gitignore
├── .vscode
├── extensions.json
├── launch.json
├── settings.json
└── tasks.json
├── .vscodeignore
├── CHANGELOG.md
├── README.md
├── app
├── .eslintrc
├── .gitignore
├── package-lock.json
├── package.json
├── public
│ └── index.html
├── src
│ ├── assets
│ │ └── vue.png
│ ├── components
│ │ ├── app.js
│ │ └── vue.js
│ ├── controls
│ │ ├── TextControl.vue
│ │ └── text.js
│ ├── editor.js
│ ├── index.js
│ ├── request.js
│ └── sockets.js
└── webpack.config.js
├── example.png
├── package-lock.json
├── package.json
├── src
├── extension.ts
├── interfaces.ts
├── test
│ ├── extension.test.ts
│ └── index.ts
└── vue
│ ├── file.ts
│ ├── generate.ts
│ └── reverse.ts
├── tsconfig.json
├── tslint.json
└── vsc-extension-quickstart.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set default behavior to automatically normalize line endings.
2 | * text=auto
3 |
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | node_modules
3 | .vscode-test/
4 | *.vsix
5 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | // See http://go.microsoft.com/fwlink/?LinkId=827846
3 | // for the documentation about the extensions.json format
4 | "recommendations": [
5 | "eg2.tslint"
6 | ]
7 | }
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that compiles the extension and then opens it inside a new window
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | {
6 | "version": "0.2.0",
7 | "configurations": [
8 | {
9 | "name": "Extension",
10 | "type": "extensionHost",
11 | "request": "launch",
12 | "runtimeExecutable": "${execPath}",
13 | "args": [
14 | "--extensionDevelopmentPath=${workspaceFolder}"
15 | ],
16 | "outFiles": [
17 | "${workspaceFolder}/out/**/*.js"
18 | ],
19 | "preLaunchTask": "npm: watch"
20 | },
21 | {
22 | "name": "Extension Tests",
23 | "type": "extensionHost",
24 | "request": "launch",
25 | "runtimeExecutable": "${execPath}",
26 | "args": [
27 | "--extensionDevelopmentPath=${workspaceFolder}",
28 | "--extensionTestsPath=${workspaceFolder}/out/test"
29 | ],
30 | "outFiles": [
31 | "${workspaceFolder}/out/test/**/*.js"
32 | ],
33 | "preLaunchTask": "npm: watch"
34 | }
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "files.exclude": {
4 | "out": false // set this to true to hide the "out" folder with the compiled JS files
5 | },
6 | "search.exclude": {
7 | "out": true // set this to false to include "out" folder in search results
8 | },
9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10 | "typescript.tsc.autoDetect": "off"
11 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // See https://go.microsoft.com/fwlink/?LinkId=733558
2 | // for the documentation about the tasks.json format
3 | {
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "npm",
8 | "script": "watch",
9 | "problemMatcher": "$tsc-watch",
10 | "isBackground": true,
11 | "presentation": {
12 | "reveal": "never"
13 | },
14 | "group": {
15 | "kind": "build",
16 | "isDefault": true
17 | }
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode/**
2 | .vscode-test/**
3 | out/test/**
4 | out/**/*.map
5 | src/**
6 | .gitignore
7 | tsconfig.json
8 | vsc-extension-quickstart.md
9 | tslint.json
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 | All notable changes to the "rete-for-vue" extension will be documented in this file.
3 |
4 | ## 11.10.2018
5 |
6 | - Write Vue components to files
7 |
8 | ## 10.10.2018
9 | - Draft
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Rete for Vue (experimental)
2 |
3 | VS Code extension for generation of Vue.js component using Rete.js.
4 |
5 | Draft: on every scheme changes the generator will create .vue files with imports according to nodes and connections
6 |
7 | ### How to use
8 |
9 | - Open tab: `F1 > Open Rete ...`
10 |
11 | 
12 |
--------------------------------------------------------------------------------
/app/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "eslint:recommended"
4 | ],
5 | "parserOptions": {
6 | "ecmaVersion": 2018,
7 | "sourceType": "module",
8 | "ecmaFeatures": {
9 | "jsx": true
10 | }
11 | },
12 | "globals": {
13 | "acquireVsCodeApi": true,
14 | "document": true,
15 | "console": true
16 | },
17 | "rules": {
18 | "no-console": 0
19 | }
20 | }
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
--------------------------------------------------------------------------------
/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rete-for-vue-app",
3 | "version": "1.0.0",
4 | "description": "",
5 | "scripts": {
6 | "build": "webpack --config webpack.config.js",
7 | "build:dev": "webpack --watch --progress --config webpack.config.js"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "rete": "file:../../rete",
13 | "rete-context-menu-plugin": "^0.1.4",
14 | "rete-vue-render-plugin": "file:../../vue-render-plugin"
15 | },
16 | "devDependencies": {
17 | "css-loader": "^1.0.0",
18 | "html-webpack-plugin": "^3.2.0",
19 | "node-sass": "^4.9.3",
20 | "pug": "^2.0.3",
21 | "pug-plain-loader": "^1.0.0",
22 | "sass-loader": "^7.1.0",
23 | "vue-loader": "^15.4.2",
24 | "vue-template-compiler": "^2.5.17",
25 | "webpack": "^4.20.2",
26 | "webpack-cli": "^3.1.2"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Node Editor
5 |
6 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/assets/vue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/retejs/rete-for-vue/73b765bfefb21ccf811750db03b7bbb0a5a6a54c/app/src/assets/vue.png
--------------------------------------------------------------------------------
/app/src/components/app.js:
--------------------------------------------------------------------------------
1 | import { Component, Output } from 'rete';
2 | import Sockets from '../sockets';
3 |
4 | export class AppComponent extends Component {
5 |
6 | constructor() {
7 | super("App");
8 | }
9 |
10 | builder(node) {
11 | var out1 = new Output('component', "Vue component", Sockets.vue);
12 |
13 | return node
14 | .addOutput(out1);
15 | }
16 |
17 | worker(node, inputs, outputs, args) {
18 | const name = 'App';
19 |
20 | outputs.component = { name, path: '/', children: [] }
21 |
22 | args.components.push(outputs.component);
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/components/vue.js:
--------------------------------------------------------------------------------
1 | import { Component, Input, Output } from 'rete';
2 | import { TextControl } from '../controls/text';
3 | import Sockets from '../sockets';
4 |
5 | export class VueComponent extends Component {
6 | constructor() {
7 | super("Vue");
8 | }
9 |
10 | builder(node) {
11 | var out1 = new Output('component', "Vue component", Sockets.vue);
12 | var inp1 = new Input('component', "Vue component", Sockets.vue);
13 |
14 | return node
15 | .addControl(new TextControl(this.editor, 'name'))
16 | .addInput(inp1)
17 | .addOutput(out1);
18 | }
19 |
20 | worker(node, inputs, outputs, args) {
21 | const { name } = node.data;
22 | outputs.component = { name, path: inputs.component[0].path+name+'/', children: [] }
23 |
24 | inputs.component[0].children.push(outputs.component);
25 |
26 | args.components.push(outputs.component);
27 | }
28 | }
--------------------------------------------------------------------------------
/app/src/controls/TextControl.vue:
--------------------------------------------------------------------------------
1 |
2 | input(
3 | type="text"
4 | :readonly="readonly"
5 | :value="value"
6 | @input="change($event)"
7 | )
8 |
9 |
10 |
34 |
35 |
36 |
46 |
--------------------------------------------------------------------------------
/app/src/controls/text.js:
--------------------------------------------------------------------------------
1 | import { Control } from 'rete';
2 | import Component from './TextControl.vue';
3 |
4 | export class TextControl extends Control {
5 |
6 | constructor(emitter, key, readonly) {
7 | super(key);
8 | this.component = Component;
9 | this.props = { emitter, ikey: key, readonly };
10 | }
11 |
12 | setValue(val) {
13 | this.vueContext.value = val;
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/editor.js:
--------------------------------------------------------------------------------
1 | import Rete from 'rete';
2 | import ConnectionPlugin from 'rete-connection-plugin';
3 | import VueRenderPlugin from 'rete-vue-render-plugin';
4 | import ContextMenuPlugin from 'rete-context-menu-plugin';
5 | import AreaPlugin from 'rete-area-plugin';
6 | import { AppComponent } from './components/app';
7 | import { VueComponent } from './components/vue';
8 |
9 | export default async function createEditor(container, onProcess) {
10 | var editor = new Rete.NodeEditor("demo@0.1.0", container);
11 |
12 | editor.use(ConnectionPlugin);
13 | editor.use(VueRenderPlugin);
14 | editor.use(ContextMenuPlugin);
15 |
16 | var engine = new Rete.Engine("demo@0.1.0");
17 |
18 | [new AppComponent(), new VueComponent()].map(c => {
19 | editor.register(c);
20 | engine.register(c);
21 | });
22 |
23 | editor.on("process connectioncreated connectionremoved nodecreated noderemoved", async () => {
24 | let args = { components: [] };
25 | await engine.abort();
26 | await engine.process(editor.toJSON(), null, args);
27 | onProcess(args);
28 | });
29 |
30 | editor.view.resize();
31 |
32 | await editor.fromJSON({"id":"demo@0.1.0","nodes":{"1":{"id":1,"data":{},"inputs":{},"outputs":{"component":{"connections":[{"node":3,"input":"component","data":{}},{"node":4,"input":"component","data":{}}]}},"position":[-660.5,-31],"name":"App"},"3":{"id":3,"data":{"name":"Header"},"inputs":{"component":{"connections":[{"node":1,"output":"component","data":{}}]}},"outputs":{"component":{"connections":[{"node":5,"input":"component","data":{}},{"node":6,"input":"component","data":{}}]}},"position":[-270.5,-185],"name":"Vue"},"4":{"id":4,"data":{"name":"Footer"},"inputs":{"component":{"connections":[{"node":1,"output":"component","data":{}}]}},"outputs":{"component":{"connections":[]}},"position":[-205.5,48],"name":"Vue"},"5":{"id":5,"data":{"name":"Menu"},"inputs":{"component":{"connections":[{"node":3,"output":"component","data":{}}]}},"outputs":{"component":{"connections":[]}},"position":[58.5,-138],"name":"Vue"},"6":{"id":6,"data":{"name":"Logo"},"inputs":{"component":{"connections":[{"node":3,"output":"component","data":{}}]}},"outputs":{"component":{"connections":[]}},"position":[47.5,-329],"name":"Vue"}}})
33 | AreaPlugin.zoomAt(editor);
34 | }
--------------------------------------------------------------------------------
/app/src/index.js:
--------------------------------------------------------------------------------
1 | import createEditor from './editor';
2 | import Req from './request';
3 |
4 | let input = document.querySelector("#source")
5 | let components = '';
6 |
7 | document.querySelector("#reverse-button").addEventListener('click', () => {
8 | Req.reverse({ components, folder: input.value });
9 | });
10 | document.querySelector("#generate-button").addEventListener('click', () => {
11 | Req.generate({ components, folder: input.value });
12 | });
13 |
14 | createEditor(document.querySelector("#nodeEditor"), args => {
15 | components = args.components;
16 | });
--------------------------------------------------------------------------------
/app/src/request.js:
--------------------------------------------------------------------------------
1 | const vscode = acquireVsCodeApi();
2 |
3 | function method(type, payload) {
4 | console.log({ type, payload });
5 | vscode.postMessage({
6 | type,
7 | payload
8 | })
9 | }
10 |
11 | export default {
12 | generate(payload) { method('GENERATE', payload) },
13 | reverse(payload) { method('REVERSE', payload) }
14 | }
--------------------------------------------------------------------------------
/app/src/sockets.js:
--------------------------------------------------------------------------------
1 | import { Socket } from 'rete';
2 |
3 | export default {
4 | vue: new Socket("Vue")
5 | }
--------------------------------------------------------------------------------
/app/webpack.config.js:
--------------------------------------------------------------------------------
1 | const HtmlWebpackPlugin = require('html-webpack-plugin');
2 | const VueLoaderPlugin = require('vue-loader/lib/plugin')
3 |
4 | module.exports = {
5 | mode: 'development',
6 | entry: './src/index.js',
7 | resolve: {
8 | alias: {
9 | vue: 'vue/dist/vue.js'
10 | }
11 | },
12 | module: {
13 | rules: [
14 | {
15 | test: /\.vue$/,
16 | loader: 'vue-loader',
17 | options: {
18 | loaders: {
19 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' //