diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..c8afdf7
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+node_modules
+dist
+.git
+.gitignore
+Dockerfile
+README.md
diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml
new file mode 100644
index 0000000..64c2bca
--- /dev/null
+++ b/.github/workflows/deploy-pages.yml
@@ -0,0 +1,38 @@
+name: Deploy to GitHub Pages
+
+on:
+ push:
+ branches: [main, master]
+
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+concurrency:
+ group: "pages"
+ cancel-in-progress: false
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ environment: github-pages
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: npm
+
+ - run: npm ci
+
+ - run: npm run build
+
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: dist
+
+ - name: Deploy to GitHub Pages
+ uses: actions/deploy-pages@v4
diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
new file mode 100644
index 0000000..4582139
--- /dev/null
+++ b/.github/workflows/static.yml
@@ -0,0 +1,43 @@
+# Simple workflow for deploying static content to GitHub Pages
+name: Deploy static content to Pages
+
+on:
+ # Runs on pushes targeting the default branch
+ push:
+ branches: ["feature/functions"]
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
+# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
+concurrency:
+ group: "pages"
+ cancel-in-progress: false
+
+jobs:
+ # Single deploy job since we're just deploying
+ deploy:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Pages
+ uses: actions/configure-pages@v5
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ # Upload entire repository
+ path: 'src'
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.gitignore b/.gitignore
index 68c0483..e9bb4cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -113,3 +113,4 @@ fabric.properties
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml
/node_modules/
+/dist/
diff --git a/CONVENTIONS.md b/CONVENTIONS.md
new file mode 100644
index 0000000..ad11df1
--- /dev/null
+++ b/CONVENTIONS.md
@@ -0,0 +1,54 @@
+# CodeWire – Branch & Commit Conventions
+
+## Branch names
+
+Use lowercase with a type prefix and short description:
+
+- **Format:** `type/short-description` (e.g. `feature/node-registry`, `fix/context-menu`)
+- **Allowed types:** `feature`, `fix`, `chore`, `docs`, `refactor`, `test`
+- **Protected:** `master` and `main` are allowed as-is (no validation when pushing them)
+
+**Examples:** `feature/visual-script-export`, `fix/compiler-edge-case`, `chore/deps`
+
+---
+
+## Commit messages
+
+Use [Conventional Commits](https://www.conventionalcommits.org/):
+
+- **Format:** `type(scope): short description` or `type: short description`
+- **Types:** `feat`, `fix`, `chore`, `docs`, `refactor`, `style`, `test`, `perf`
+- **Scope (optional):** e.g. `feat(nodes): add custom node type`
+- **Length:** First line should be under 72 characters.
+
+**Examples:**
+- `feat: add node registry and definitions`
+- `fix(compiler): handle empty script output`
+- `chore: update dependencies`
+
+---
+
+## File and folder naming
+
+- **Domain folders:** Use lowercase for domain group folders under `src/js/` (e.g. `core`, `nodes`, `registry`, `compiler`, `editor`, `ui`, `persistence`).
+- **JavaScript files:** Use camelCase (e.g. `nodeFactory.js`, `contextMenu.js`, `stage.js`, `saveAndLoad.js`). Match the main export or feature name. Use `index.js` for module entry points.
+- **App layout:** App source lives under `src/`: entry point `src/index.html`, styles and images in `src/`, app JavaScript in `src/js/` (domain folders as above), app entry point at `src/js/app.js`. Third-party libraries live in `src/vendor/` (e.g. `codemirror`, `jquery`, `konva`). Use lowercase for vendor subfolders to avoid case-sensitivity issues.
+- **Avoid:** Typos in filenames; mixing casing for the same concept (e.g. `Dependencies` vs `dependencies`).
+
+---
+
+## Enforcing conventions
+
+After cloning the repo, install the Git hooks once:
+
+```bash
+npm run setup:hooks
+```
+
+This installs:
+
+- **commit-msg** – Rejects commits that don’t match the commit message format.
+- **pre-push** – Rejects pushes if the current branch name doesn’t match the branch format (except when pushing `master` or `main`).
+
+To skip hook checks in rare cases (e.g. emergency fix):
+`git commit --no-verify` or `git push --no-verify` (use sparingly).
diff --git a/README.md b/README.md
index 4afaf6b..aa26c2a 100644
--- a/README.md
+++ b/README.md
@@ -3,10 +3,43 @@

-
+
Try at https://ayushk7.github.io/CodeWire/
+
+## Getting Started
+
+```bash
+npm install
+```
+
+### Local Development
+
+```bash
+npm run dev
+```
+
+Starts the Vite dev server at http://localhost:5173 with hot module replacement.
+
+### Production Build
+
+```bash
+npm run build
+```
+
+Bundles and minifies everything into the `dist/` folder. To preview the production build locally:
+
+```bash
+npm run preview
+```
+
+### Deployment
+
+The `dist/` folder is the deployable output — upload it to any static host (Netlify, Vercel, S3, etc.).
+
+For GitHub Pages, the included workflow (`.github/workflows/deploy-pages.yml`) automatically builds and deploys on push to `main`/`master`.
+
CodeWire is a node based editor inspired by UE4 Blueprints which helps in better visualization of the code,
and faster scripting of complex and repetitive tasks.
It doesn't bind to any particular language.
@@ -28,130 +61,34 @@ Tutorial:
## Fibonacci Series
-
+
## HTTP REQUEST/Compiled Code
-
+
## Documentation
### Node Anatomy
-
+
### Adding New Nodes
-1. Add the description of node in the [javascript/Nodes/nodes.js](javascript/Nodes/nodes.js)
-```js
- //description of the Print node
- if (type == 'Print') {
- nodeDescription.nodeTitle = 'Print';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: "'hello'",
- pinInId: null,
- }
- }
- // styling for the node
- nodeDescription.color = 'Print';
- nodeDescription.rows = 3;
- nodeDescription.colums = 12;
- }
-
- //NOTE: this same object is furthur used for serialization and deserialization of the graph, so we have some meta info like pinIds
-```
-But still the node is not available in the context menu
-
-
-
-2. To make this node available in the context menu you need to add it to the markup in [index.html](index.html)
-```html
-
-
-
-
-```
-Result
-
-3. Now only thing left is to add the logic for the node, that is what code it should generate on it's turn
+With the node registry, adding a new node only requires editing one file: [src/js/registry/nodeDefinitions.js](src/js/registry/nodeDefinitions.js).
-For this you need add the logic in [VisualScriptToJavascript.js](javascript/VisualScriptToJavascript/VisualScriptToJavascript.js) in coreAlgorithm(node) method
+1. Call `registerNode({ id, schema, execCodegen?, exprCodegen? })` with the node's schema (inputs, outputs, exec pins, color, rows, columns).
+2. Add the node id to the `registerMenuOrder()` array at the bottom of the file (use `null` for a separator).
+3. If the node has execution flow, provide an `execCodegen(compiler, node)` function.
+4. If the node produces an expression output, provide an `exprCodegen(compiler, inputNode)` function.
-```js
- case "Print": {
- this.script += `console.log(${this.handleInp(inputPins[0])});\n
- `;
- this.coreAlgorithm(execOutPins[0]); // this tells algo to go to the next node which is connected at first pin(triangle shaped)
- }
+See existing definitions in [src/js/registry/nodeDefinitions.js](src/js/registry/nodeDefinitions.js) for examples (e.g. Print, Add, Branch).
- // this will append the console.log(input) in the generated js
-```
-Result
-
-
-
-#### NOTE: The above node only takes input, but if the node also do outputs, then that logic is needed to be added separately
-Example: Add Node
-
-Description:
-```js
- if (type == 'Add') { // this type should match the entry in the context menu's markup in index.html
- nodeDescription.nodeTitle = 'Add';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
-```
-
-And In [VisualScriptToJavascript.js](javascript/VisualScriptToJavascript/VisualScriptToJavascript.js)
-
-in handleInputs() method
-
-```js
-case "Add": {
- expr = `(${this.handleInputs(inputPins[0])} + ${this.handleInputs(inputPins[1])})`;
-}
-// this will generate and return (inp1 + inp2) expression
-```
-
+The node factory ([src/js/nodes/nodeFactory.js](src/js/nodes/nodeFactory.js)) and compiler ([src/js/compiler/compiler.js](src/js/compiler/compiler.js)) automatically pick up any registered node.
diff --git a/dockerfile b/dockerfile
new file mode 100644
index 0000000..e2f3e51
--- /dev/null
+++ b/dockerfile
@@ -0,0 +1,26 @@
+# ---------- Build Stage ----------
+FROM node:22 AS builder
+
+WORKDIR /app
+
+RUN npm install -g pnpm
+
+COPY package.json pnpm-lock.yaml* ./
+
+RUN pnpm install
+
+COPY . .
+
+RUN pnpm run build
+
+
+# ---------- Production Stage ----------
+FROM nginx:alpine
+
+RUN rm -rf /usr/share/nginx/html/*
+
+COPY --from=builder /app/dist /usr/share/nginx/html
+
+EXPOSE 80
+
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/index.html b/index.html
deleted file mode 100644
index 70181bd..0000000
--- a/index.html
+++ /dev/null
@@ -1,288 +0,0 @@
-
-
-
-
-
-
-
- CodeWire
-
-
-
-
-
-
-
-
-
-
-
-
-
- Run
-
-
- Code
-
-
- Github
-
-
- Output
-
-
- Import
-
-
- Export
-
-
-
- Starter
-
-
- New
-
-
- Reload
-
-
- Save
-
-
-
-
-
-
-
-
-
-
Alert: Export Current script If Not Exported
-
OK
-
-
-
-
-
Alert: Current Script Will Be Lost
-
Refresh
-
Cancel
-
-
-
-
-
-
-
-
-
- true
- false
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/javascript/ColorMap/colorMap.js b/javascript/ColorMap/colorMap.js
deleted file mode 100644
index 63a7328..0000000
--- a/javascript/ColorMap/colorMap.js
+++ /dev/null
@@ -1,29 +0,0 @@
-export const colorMap = {
- 'Number': '#00d0fa',
- 'String': '#ed1a95',
- 'Boolean': '#f30909',
- 'Array' : '#ccff33',
- 'Data': '#ff7900',
- 'MainLabel': '#ffffff',
- 'MainLabelBox': '#3282b8',
- // 'MainLabelBox': '#7209b7',
- // 'MainBox': '#3c415c',
- // 'MainBox': '#413D65',
- 'MainBoxGradient': {
- 'start': '#28313b',
- 'end': '#485461',
- },
- 'Text': '#ffffff',
- 'Logic': '#7209b7',
- 'Get': '#008000',
- 'Math': '#ae2012',
- 'Func': '#0353a4',
- 'Begin': '#d8572a',
- 'Print' : '#bc4749'
-};
-
-
-//red: #ae2012
-//green: #008000
-//blue: #0353a4
-//violet: #7209b7
\ No newline at end of file
diff --git a/javascript/ContextMenu/contextMenu.js b/javascript/ContextMenu/contextMenu.js
deleted file mode 100644
index 34dcb36..0000000
--- a/javascript/ContextMenu/contextMenu.js
+++ /dev/null
@@ -1,185 +0,0 @@
-import { setLocationOfNode } from '../setLocationOfNode/setLocationOfNode.js'
-import { Nodes } from '../Nodes/nodes.js'
-import { variableList } from '../Variable/variable.js'
-import { deleteProgramNode, deleteWire } from '../Delete/delete.js'
-
-export var ContextMenu = {
- contextMenu: function (stage, layer) {
- let contextMenu = document.getElementById("ctx-menu-container");
- let deleteCtxMenu = document.getElementById("delete-ctx-container");
- let getSetCtxMenu = document.getElementById("get-set-ctx-menu-container");
- let searchBar = document.getElementById("ctx-search-bar");
- let draggedVariableInfo = {
- name: null,
- dataType: null,
- };
- function toggleContextMenu(location, show) {
- if (show) {
- contextMenu.classList.toggle("hidden", false);
- contextMenu.style.left = location[0] + 'px';
- contextMenu.style.top = location[1] + 'px';
- searchBar.focus();
- }
- else {
- contextMenu.classList.toggle("hidden", true);
- searchBar.value = '';
- for (let ctxItem of contextMenu.children[1].children) {
- ctxItem.classList.toggle("hidden", false);
- }
- }
- }
- function toggleDeleteCtxMenu(location, show) {
- if (show) {
- deleteCtxMenu.classList.toggle("hidden", false);
- deleteCtxMenu.style.left = location[0] + 'px';
- deleteCtxMenu.style.top = location[1] + 'px';
-
- }
- else {
- deleteCtxMenu.classList.toggle("hidden", true);
- }
- }
- function toggleGetSetCtxMenu(location, show) {
- if (show) {
- getSetCtxMenu.classList.toggle("hidden", false);
- getSetCtxMenu.style.left = location[0] + 'px';
- getSetCtxMenu.style.top = location[1] + 'px';
- }
- else {
- getSetCtxMenu.classList.toggle("hidden", true);
- }
- }
- ContextMenu.addEventToCtxMenuItems = function (e) {
- e.addEventListener('click', function () {
- makeNode(e, stage, layer, toggleContextMenu);
- });
- }
- searchBar.addEventListener("input", (e) => {
- let key = e.target.value.toLowerCase();
- // /\bhe/gmi
- // let patt = /\b(key)/gi;
- // let patt = new RegExp(`${key}`, "gis");
- // console.log(patt);
- for (let ctxItem of contextMenu.children[1].children) {
- if (ctxItem.innerHTML.toString().toLowerCase().includes(key)) {
- ctxItem.classList.toggle("hidden", false);
- }
- else {
- ctxItem.classList.toggle("hidden", true);
- }
- }
-
- });
-
-
-
-
- for (let e of contextMenu.children[1].children) {
- this.addEventToCtxMenuItems(e);
- };
-
- // let alreadyPresent = []; // to prevent adding multiple eventListeners
- stage.on('contextmenu', function (e) {
- e.evt.preventDefault();
- if (e.target === stage) {
- let availY = stage.getContainer().getBoundingClientRect().height - e.evt.clientY;
- let offY = 0, offX = 0;
- if (availY <= 260) {
- offY = -260;
- }
- let availX = stage.getContainer().getBoundingClientRect().width - e.evt.clientX;
- if (availX <= 200) {
- offX = -200;
- }
- toggleContextMenu([e.evt.clientX + offX, e.evt.clientY + offY], true);
- }
- else {
-
- toggleDeleteCtxMenu([e.evt.clientX - 130, e.evt.clientY - 35], true);
- // console.log("xx");
- deleteCtxMenu.onclick = function () {
- // console.log("x");
- // console.log(e);
- if (e.target.getParent().name() == 'aProgramNodeGroup') {
- deleteProgramNode(e, layer, stage);
- stage.draw();
- }
- else if (e.target.name() == "isConnection") {
- deleteWire(e.target);
- stage.draw();
- }
- toggleDeleteCtxMenu([e.evt.clientX - 130, e.evt.clientY - 35], false);
- }
- };
-
- });
- stage.on('click', function (e) {
- toggleContextMenu([e.evt.clientX, e.evt.clientY], false);
- toggleDeleteCtxMenu([], false);
- toggleGetSetCtxMenu([], false);
- });
- document.addEventListener("click", (e) => {
- if (e.target !== stage.getContainer() && e.target !== searchBar)
- toggleContextMenu([0, 0], false);
- if (e.target !== stage.getContainer()) {
- toggleDeleteCtxMenu([], false);
- toggleGetSetCtxMenu([], false);
- }
- });
-
- getSetCtxMenu.addEventListener("click", (e) => {
- let nodeType = e.target.innerHTML + " " + draggedVariableInfo.name;
- let xx = e.target.parentElement.getBoundingClientRect().x - stage.getContainer().getBoundingClientRect().x;
- let yy = e.target.parentElement.getBoundingClientRect().y - stage.getContainer().getBoundingClientRect().y;
- if (e.target.innerHTML == "Get") {
- Nodes.CreateNode(nodeType, { x: xx, y: yy }, layer, stage, "Get", draggedVariableInfo.dataType, null);
- }
- else {
- Nodes.CreateNode(nodeType, { x: xx, y: yy }, layer, stage, "Set", draggedVariableInfo.dataType, null);
- }
- });
-
-
- stage.getContainer().addEventListener('dragenter', (e) => {
- e.preventDefault();
- e.stopPropagation();
- });
- stage.getContainer().addEventListener('dragover', (e) => {
- e.preventDefault();
- e.stopPropagation();
- });
- stage.getContainer().addEventListener('drop', (e) => {
- e.preventDefault();
- if (e.dataTransfer.getData("variableName")) {
- toggleGetSetCtxMenu([e.clientX, e.clientY], true);
- draggedVariableInfo = {
- name: e.dataTransfer.getData("variableName"),
- dataType: e.dataTransfer.getData("dataType"),
- }
- }
- e.stopPropagation();
- });
- }
-}
-
-
-
-function makeNode(e, stage, layer, toggleContextMenu) {
- let xx = e.parentElement.getBoundingClientRect().x - stage.getContainer().getBoundingClientRect().x;
- let yy = e.parentElement.getBoundingClientRect().y - stage.getContainer().getBoundingClientRect().y;
- let node = undefined;
- let dataType;
- if (e.dataset.datatype)
- dataType = e.dataset.datatype;
- let tmp = e.innerHTML.split(" ");
- let isGetSet = "";
- if (tmp[0] == "Get")
- isGetSet = "Get";
- else if (tmp[0] == "Set")
- isGetSet = "Set";
- let defValue = null;
- // console.log(e.innerHTML);
- Nodes.CreateNode(e.innerHTML, { x: xx, y: yy }, layer, stage, isGetSet, dataType, defValue);
- layer.draw();
- toggleContextMenu([], false);
-}
diff --git a/javascript/Nodes/nodes.js b/javascript/Nodes/nodes.js
deleted file mode 100644
index e5e4a49..0000000
--- a/javascript/Nodes/nodes.js
+++ /dev/null
@@ -1,2321 +0,0 @@
-import { InputBox } from '../InputBox/InputBox.js'
-import { colorMap } from '../ColorMap/colorMap.js'
-import { setLocationOfNode } from '../setLocationOfNode/setLocationOfNode.js';
-let placeLocation = function (location) {
- //"this" is stage
- return {
- x: (location.x - this.x()) / this.scaleX(),
- y: (location.y - this.y()) / this.scaleY()
- };
-}
-export var Nodes = {
- countNodes: 0,
- getExecPin: function (inType, helper, layer) {
- // let pointsExecIn = [0, 0, -14, -7, -14, 7];
- // let pointsExecOut = []
- let pin = new Konva.Line({
- points: [0, 0, -14, -7, -14, 7],
- stroke: 'white',
- strokeWidth: 2,
- hitStrokeWidth: 10,
- closed: true,
- helper: helper,
- name: 'pin',
- offsetX: (inType) ? -14 : 0,
- pinType: (inType) ? 'exec-in' : 'exec-out',
- pinDataType: null,
- fill: '',
- });
- pin.on("mouseenter", () => {
- pin.strokeWidth(4);
- layer.draw();
- });
- pin.on("mouseleave", () => {
- pin.strokeWidth(2);
- layer.draw();
- });
- pin.on("wireremoved", (e) => {
- if (e.isPinEmpty) {
- pin.fill('transparent');
- }
- });
- pin.on("wireconnected", (e) => {
- pin.fill("white");
- });
- pin.on("wiringstart", (e) => {
- pin.fill("white");
- layer.draw();
- });
- return pin;
- },
- getRectBlock: function (height, width) {
- let rect = new Konva.Rect({
- height: height,
- width: width,
- // fill: colorMap['MainBox'],
- opacity: 0.8,
- cornerRadius: 5,
- shadowColor: 'black',
- shadowBlur: 15,
- shadowOffset: { x: 15, y: 15 },
- shadowOpacity: 0.5,
- fillLinearGradientStartPoint: { x: 0, y: 0 },
- fillLinearGradientEndPoint: { x: width, y: height },
- fillLinearGradientColorStops: [0, colorMap['MainBoxGradient']['start'], 1, colorMap['MainBoxGradient']['end']],
- // fillLinearGradientColorStops: [0, '#12100e', 1, '#2b4162'],
-
- // strokeWidth: [10, 10, 110, 0],
- });
- return rect;
- },
- getInputPin: function (inType, helper, type, layer) {
- let pin = new Konva.Circle({
- radius: 7,
- stroke: colorMap[type],
- strokeWidth: 2,
- hitStrokeWidth: 10,
- name: 'pin',
- pinType: (inType) ? 'inp' : 'outp',
- pinDataType: type,
- offsetX: (inType) ? -7 : 7,
- helper: helper,
- fill: '',
- });
- pin.on("mouseenter", () => {
- pin.strokeWidth(4);
- layer.draw();
- });
- pin.on("mouseleave", () => {
- pin.strokeWidth(2);
- layer.draw();
- });
- pin.on("wireremoved", (e) => {
- if (e.isPinEmpty) {
- pin.fill('transparent');
- }
- });
- pin.on("wireconnected", (e) => {
- pin.fill(`${colorMap[type]}`);
- });
- pin.on("wiringstart", (e) => {
- pin.fill(`${colorMap[type]}`);
- layer.draw();
- });
- return pin;
- },
- // getOutputPin: function(){
- // let pin = new Konva.Circle({
- // radius: 7,
- // stroke: 'yellow',
- // strokeWidth: '2',
- // name: 'pin',
- // pinType: 'outp',
- // });
- // return pin;
- // },
- getLabel: function (text, size, width, color) {
- let rect = new Konva.Rect({
- width: width,
- height: size + 3,
- fill: colorMap[color],
- cornerRadius: [5, 5, 0, 0],
- // fillLinearGradientStartPoint: { x: 0, y: 0 },
- // fillLinearGradientEndPoint: { x: width, y: size + 3 },
- // fillLinearGradientColorStops: [0, colorMap[color], 1, 'rgba(0, 0, 0, 0)'],
- // fillRadialGradientStartPoint: {x: 0, y: 0},
- // fillRadialGradientEndPoint: { x: 30, y: 0 },
- // fillRadialGradientColorStops: [0, colorMap[color], 1, '#2d3436'],
- // fillRadialGradientStartRadius: size / 3,
- // fillRadialGradientEndRadius: 100,
-
- // fillLinearGradientColorStops: [0, '#9e768f', 1, '#ff4e00'],
-
- // #ec9f05 #ff4e00
- });
- let label = new Konva.Text({
- text: text,
- fontSize: size - 5,
- fontFamily: 'Verdana',
- fill: colorMap['MainLabel'],
- width: width,
- // height: size + 3,
- y: 2,
- align: 'left',
- padding: 3,
- // padding: 10
- });
- return { bg: rect, text: label };
- },
- getPinCounts: function (nodeDescription) {
- let inputPinCounts = 0;
- let outputPinCounts = 0;
- if (nodeDescription.execIn)
- inputPinCounts++;
- if (nodeDescription.inputs) {
- inputPinCounts += Object.keys(nodeDescription.inputs).length;
- }
-
- //For outputs
- if (nodeDescription.execOut) {
- outputPinCounts += Object.keys(nodeDescription.execOut).length;
- }
- if (nodeDescription.outputs) {
- outputPinCounts += Object.keys(nodeDescription.outputs).length;
-
- }
- return Math.max(inputPinCounts, outputPinCounts);
- },
- // getEditableTextBox: function (type, stage, index) {
- // let rect = new Konva.Rect({
- // width: (type == 'Boolean') ? 14 : 50,
- // height: 14,
- // stroke: colorMap[type],
- // strokeWidth: 1,
- // });
- // return rect;
- // },
- getInputLabel: function (labelText, isInput) {
- let text = new Konva.Text({
- // width: 40,
- height: 14,
- text: labelText,
- fontSize: 11,
- fontFamily: 'Verdana',
- fill: colorMap['Text'],
- });
- if (isInput)
- text.offsetX(0);
- else
- text.offsetX(text.width());
- // text.off()
- return text;
- },
- getExecOutTitle: function (labelText) {
- let text = new Konva.Text({
- height: 14,
- fontSize: 11,
- text: labelText,
- fontFamily: 'Verdana',
- fill: "white",
- });
- text.offsetX(text.width());
- return text;
- },
- optimizeDrag: function (grp, stage, layer) {
- let dragLayer = stage.findOne('#dragLayer');
- let wireLayer = stage.findOne('#wireLayer');
- grp.on('dragstart', () => {
- grp.moveTo(dragLayer);
- for (let each of grp.customClass.execInPins) {
- for (let aWire of each.wire) {
- aWire.moveTo(dragLayer);
- }
- }
- for (let each of grp.customClass.execOutPins) {
- if (each.wire)
- each.wire.moveTo(dragLayer);
- }
- for (let each of grp.customClass.inputPins) {
- if (each.wire)
- each.wire.moveTo(dragLayer);
- }
- for (let each of grp.customClass.outputPins) {
- for (let aWire of each.wire) {
- aWire.moveTo(dragLayer);
- }
- }
- wireLayer.draw();
- dragLayer.draw();
- layer.draw();
- // try {
- // if (layer.hasChildren())
- // layer.cache();
- // if (wireLayer.hasChildren())
- // wireLayer.cache();
- // }
- // catch (err) {
-
- // }
- })
- grp.on('dragend', () => {
- grp.moveTo(layer);
- for (let each of grp.customClass.execInPins) {
- for (let aWire of each.wire) {
- aWire.moveTo(wireLayer);
- }
- }
- for (let each of grp.customClass.execOutPins) {
- if (each.wire)
- each.wire.moveTo(wireLayer);
- }
- for (let each of grp.customClass.inputPins) {
- if (each.wire)
- each.wire.moveTo(wireLayer);
- }
- for (let each of grp.customClass.outputPins) {
- for (let aWire of each.wire) {
- aWire.moveTo(wireLayer);
- }
- }
- // layer.clearCache();
- // wireLayer.clearCache();
- wireLayer.draw();
- dragLayer.draw();
- layer.draw();
- });
- },
- getBorderRect: function (height, width) {
- let rect = new Konva.Rect({
- height: height,
- width: width,
- fill: 'transparent',
- stroke: '#dbd8e3',
- strokeWidth: 0,
- cornerRadius: 5,
- name: 'borderbox',
- });
- rect.off('click mouseover mouseenter mouseleave');
- return rect;
- },
- ProgramNode: class {
- constructor(nodeDescription, location, layer, stage) {
-
-
-
- this.grp = new Konva.Group({
- draggable: true,
- name: "aProgramNodeGroup",
- });
- if (nodeDescription.nodeTitle == 'Begin') {
- this.grp.id('Begin');
- }
- this.grp.customClass = this;
- // this.grp.on('dblclick', (e) => {
- // console.table(e.currentTarget.customClass);
- // })
- this.nodeDescription = nodeDescription;
- let relativePosition = placeLocation.bind(stage);
- let maxOfPinsOnEitherSide = Nodes.getPinCounts(nodeDescription);
- let height = maxOfPinsOnEitherSide * 50 + 15;
- let width = nodeDescription.colums * 15;
- this.grp.position(relativePosition(location));
- let rect = Nodes.getRectBlock(height, width);
- this.grp.add(rect);
- let borderRect = Nodes.getBorderRect(height, width);
- let titleLabel = Nodes.getLabel(nodeDescription.nodeTitle, 20, width, nodeDescription.color);
- this.grp.add(titleLabel.bg);
- this.grp.add(titleLabel.text);
- this.grp.add(borderRect);
-
- this.grp.on("mouseover", (e) => {
- // console.log(e);
- // if(shape == this.grp)
- borderRect.strokeWidth(1);
- layer.draw();
- });
- this.grp.on("mouseleave", (e) => {
- // rect.opacity(0.9);
- // rect.shadowOffset({ x: 15, y: 15 });
- // this.grp.scale(1);
- // this.grp.filters([]);
- borderRect.strokeWidth(0);
- layer.draw();
- });
- this.grp.on('mousedown', (e) => {
- rect.shadowBlur(25);
- // rect.shadowOffset({ x: 25, y: 25 });
- layer.draw();
- })
- this.grp.on('mouseup', (e) => {
- rect.shadowBlur(15);
- // rect.shadowOffset({ x: 15, y: 15 });
- layer.draw();
- })
- /****/
-
- Nodes.optimizeDrag(this.grp, stage, layer);
-
- /****/
- // titleLabel.offsetX(titleLabel.width() / 2);
- let inputPinsPlaced = 0, outputPinsPlaced = 0;
- this.execInPins = [];
- if (nodeDescription.execIn == true) {
- let execInPin = Nodes.getExecPin(true, 'exec-in-0', layer);
- execInPin.position({ x: 7, y: 44 });
- if (nodeDescription.pinExecInId == null) {
- execInPin.id(`${execInPin._id}`);
- }
- else {
- execInPin.id(nodeDescription.pinExecInId);
- }
- this.nodeDescription.pinExecInId = execInPin.id();
- this.grp.add(execInPin);
- let tmp = {
- thisNode: execInPin,
- wire: [],
- }
- this.execInPins.push(tmp);
- inputPinsPlaced = 1;
- }
-
- let X = nodeDescription.nodeTitle.split(" ");
- this.type = {
- isGetSet: (X[0] == 'Get' || X[0] == 'Set'),
- typeOfNode: nodeDescription.nodeTitle,
- }
- this.execOutPins = [];
- if (nodeDescription.execOut) {
- Object.keys(nodeDescription.execOut).forEach((value, index) => {
- let execOutPin = Nodes.getExecPin(false, `exec-out-${index}`, layer);
- execOutPin.position({ x: width - 7, y: 44 + nodeDescription.execOut[value].outOrder * 39 });
- if (nodeDescription.execOut[value].pinExecOutId == null) {
- execOutPin.id(`${execOutPin._id}`);
- }
- else {
- execOutPin.id(nodeDescription.execOut[value].pinExecOutId);
- }
- this.nodeDescription.execOut[value].pinExecOutId = execOutPin.id();
- this.grp.add(execOutPin);
- if (nodeDescription.execOut[value].execOutTitle) {
- let exLabel = Nodes.getExecOutTitle(nodeDescription.execOut[value].execOutTitle);
- exLabel.position({ x: width - 28, y: 44 + nodeDescription.execOut[value].outOrder * 39 - 4 });
- this.grp.add(exLabel);
- }
- let tmp = {
- thisNode: execOutPin,
- wire: null,
- title: value.execOutTitle,
- }
- this.execOutPins.push(tmp);
- outputPinsPlaced++;
- });
- }
- this.inputPins = [];
- if (nodeDescription.inputs) {
- Object.keys(nodeDescription.inputs).forEach((value, index) => {
- let inputPin = Nodes.getInputPin(true, `inp-${index}`, nodeDescription.inputs[value].dataType, layer);
- inputPin.position({ x: 7, y: 44 + 39 * inputPinsPlaced });
- if (nodeDescription.inputs[value].pinInId == null) {
- inputPin.id(`${inputPin._id}`);
- }
- else {
- inputPin.id(nodeDescription.inputs[value].pinInId);
- }
- this.nodeDescription.inputs[value].pinInId = inputPin.id();
- // iprect.position({ x: 28, y: 44 + 39 * inputPinsPlaced - 2 });
- let iprect = null;
- let iplabel = Nodes.getInputLabel(nodeDescription.inputs[value].inputTitle, true);
- iplabel.position({ x: 28, y: 44 + 39 * inputPinsPlaced - 4 });
- if (nodeDescription.inputs[value].isInputBoxRequired !== false) {
- // console.log(nodeDescription.inputs, this.nodeDescription.inputs);
- iprect = new InputBox(stage, layer, nodeDescription.inputs[value].dataType, this.grp, { x: 28, y: 44 + 39 * inputPinsPlaced - 2 }, colorMap, inputPin, iplabel, inputPinsPlaced, nodeDescription.inputs[value], this.nodeDescription.inputs[value]);
- iplabel.position({ x: 28, y: 44 + 39 * inputPinsPlaced - 14 });
- }
- this.grp.add(iplabel);
- this.grp.add(inputPin);
- // this.grp.add(iprect);
- let tmp = {
- thisNode: inputPin,
- wire: null,
- textBox: iprect,
- value: null,
- title: value.inputTitle,
- }
- this.inputPins.push(tmp);
- inputPinsPlaced++;
- });
- }
- this.outputPins = [];
- if (nodeDescription.outputs) {
- Object.keys(nodeDescription.outputs).forEach((value, index) => {
- let outputPin = Nodes.getInputPin(false, `out-${index}`, nodeDescription.outputs[value].dataType, layer);
- outputPin.position({ x: width - 7, y: 44 + 39 * nodeDescription.outputs[value].outOrder });
- if (nodeDescription.outputs[value].pinOutId == null) {
- outputPin.id(`${outputPin._id}`);
- }
- else {
- outputPin.id(nodeDescription.outputs[value].pinOutId);
- }
- nodeDescription.outputs[value].pinOutId = outputPin.id();
- this.grp.add(outputPin);
- let outLabel = Nodes.getInputLabel(nodeDescription.outputs[value].outputTitle, false);
- outLabel.position({ x: width - 28, y: 44 + 39 * nodeDescription.outputs[value].outOrder - 4 })
- this.grp.add(outLabel);
- let tmp = {
- wire: [],
- value: null,
- title: value.outputTitle,
- }
- this.outputPins.push(tmp);
- outputPinsPlaced++;
- })
- };
- // this.grp.cache();
- layer.add(this.grp);
- layer.draw();
- layer.draw();
- // console.log(JSON.parse(JSON.stringify(this.grp)));
- }
- },
-
-
-
-
-
- CreateNode: function (type, location, layer, stage, isGetSet, dataType, defValue) {
- let nodeDescription = {};
- if (type == 'Begin') {
- nodeDescription.nodeTitle = 'Begin';
- nodeDescription.execIn = false;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- }
- };
- nodeDescription.color = 'Begin';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Print') {
- nodeDescription.nodeTitle = 'Print';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: "'hello'",
- pinInId: null,
- }
- }
- nodeDescription.color = 'Print';
- nodeDescription.rows = 3;
- nodeDescription.colums = 12;
- }
- if (type == 'Alert') {
- nodeDescription.nodeTitle = 'Alert';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: "'hello'",
- pinInId: null,
- }
- }
- nodeDescription.color = 'Print';
- nodeDescription.rows = 3;
- nodeDescription.colums = 12;
- }
- if (type == 'Confirm') {
- nodeDescription.nodeTitle = 'Confirm';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Message',
- dataType: 'String',
- defValue: "'Ok'",
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Ok?',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Print';
- nodeDescription.rows = 3;
- nodeDescription.colums = 12;
- }
- if (type == 'Prompt') {
- nodeDescription.nodeTitle = 'Prompt';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Message',
- dataType: 'String',
- defValue: "'Ok'",
- pinInId: null,
- },
- input1: {
- inputTitle: 'Default',
- dataType: 'String',
- defValue: "'Yes'",
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Ok?',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 1,
- },
- output1: {
- outputTitle: 'Value',
- dataType: 'String',
- pinOutId: null,
- outOrder: 2,
- },
- }
- nodeDescription.color = 'Print';
- nodeDescription.rows = 3;
- nodeDescription.colums = 12;
- }
- if (type == 'If/Else') {
- nodeDescription.nodeTitle = 'If/Else';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: 'True',
- pinExecOutId: null,
- outOrder: 0,
- },
- execOut1: {
- execOutTitle: 'False',
- pinExecOutId: null,
- outOrder: 1,
- },
- execOut2: {
- execOutTitle: 'Done',
- pinExecOutId: null,
- outOrder: 2,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Bool',
- dataType: 'Boolean',
- defValue: true,
- pinInId: null,
- }
- }
- nodeDescription.color = 'Logic';
- nodeDescription.rows = 3;
- nodeDescription.colums = 12;
- }
- if (type == 'Add') {
- nodeDescription.nodeTitle = 'Add';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Modulo') {
- nodeDescription.nodeTitle = 'Modulo';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 2,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Subtract') {
- nodeDescription.nodeTitle = 'Subtract';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Multiply') {
- nodeDescription.nodeTitle = 'Multiply';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
-
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Divide') {
- nodeDescription.nodeTitle = 'Divide';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
-
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Power') {
- nodeDescription.nodeTitle = 'Power';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 2,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 2,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
-
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Ceil') {
- nodeDescription.nodeTitle = 'Ceil';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
-
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Floor') {
- nodeDescription.nodeTitle = 'Floor';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
-
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
-
- if (type == 'WhileLoop') {
- nodeDescription.nodeTitle = 'WhileLoop';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Bool',
- dataType: 'Boolean',
- defValue: false,
- pinInId: null,
- },
- }
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: 'Loop Body',
- pinExecOutId: null,
- outOrder: 0,
-
- },
- execOut1: {
- execOutTitle: 'Completed',
- pinExecOutId: null,
- outOrder: 1,
-
- }
- }
- nodeDescription.color = 'Logic';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
-
- if (type == 'OR') {
- nodeDescription.nodeTitle = 'OR';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Boolean',
- defValue: true,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Boolean',
- defValue: true,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
-
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'AND') {
- nodeDescription.nodeTitle = 'AND';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Boolean',
- defValue: true,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Boolean',
- defValue: true,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'XOR') {
- nodeDescription.nodeTitle = 'XOR';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Boolean',
- defValue: true,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Boolean',
- defValue: true,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'bXOR') {
- nodeDescription.nodeTitle = 'bXOR';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'bOR') {
- nodeDescription.nodeTitle = 'bOR';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'bAND') {
- nodeDescription.nodeTitle = 'bAND';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'bXOR') {
- nodeDescription.nodeTitle = 'XOR';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'bNEG') {
- nodeDescription.nodeTitle = 'bNEG';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "Swap") {
- nodeDescription.nodeTitle = 'Swap';
- nodeDescription.execIn = true,
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Ref1',
- dataType: 'Data',
- isInputBoxRequired: false,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Ref2',
- dataType: 'Data',
- isInputBoxRequired: false,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Ref1',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 1,
-
- },
- output1: {
- outputTitle: 'Ref2',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 2,
-
- }
- }
- nodeDescription.color = 'Func';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == "Equals") {
- nodeDescription.nodeTitle = 'Equals';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Data',
- defValue: 0,
- pinInId: null,
-
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Data',
- defValue: 0,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "Not Equals") {
- nodeDescription.nodeTitle = 'Not Equals';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Data',
- defValue: 0,
- pinInId: null,
-
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Data',
- defValue: 0,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "LessEq") {
- nodeDescription.nodeTitle = 'LessEq';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "Less") {
- nodeDescription.nodeTitle = 'Less';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "Greater") {
- nodeDescription.nodeTitle = 'Greater';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "GreaterEq") {
- nodeDescription.nodeTitle = 'GreaterEq';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'NEG') {
- nodeDescription.nodeTitle = 'NEG';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Boolean',
- defValue: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "Max(Num)") {
- nodeDescription.nodeTitle = 'Max(Num)';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Max',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "Min(Num)") {
- nodeDescription.nodeTitle = 'Min(Num)';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'ValueA',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'ValueB',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Min',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (isGetSet == "Set") {
- let defaultValueByType = {
- "Number": 0,
- "Boolean": true,
- "String": "'hello'",
- "Array": '[]',
- }
- nodeDescription.nodeTitle = type;
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: dataType,
- defValue: defaultValueByType[dataType],
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Value(Ref)',
- dataType: dataType,
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
-
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (isGetSet == "Get") {
- nodeDescription.nodeTitle = type;
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Value(Ref)',
- dataType: dataType,
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Get';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Random') {
- nodeDescription.nodeTitle = 'Random';
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Random[0,1)',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Math';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'ForLoop') {
- nodeDescription.nodeTitle = 'ForLoop';
- nodeDescription.pinExecInId = null;
- nodeDescription.execIn = true;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: 'Loop Body',
- pinExecOutId: null,
- outOrder: 0,
- },
- execOut1: {
- execOutTitle: 'Completed',
- pinExecOutId: null,
- outOrder: 2,
- }
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'From',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'To(Excl)',
- dataType: 'Number',
- defValue: 10,
- pinInId: null,
- },
- input2: {
- inputTitle: 'Increment',
- dataType: 'Number',
- defValue: 1,
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Index',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Logic';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == 'ForEachLoop') {
- nodeDescription.nodeTitle = 'ForEachLoop';
- nodeDescription.pinExecInId = null;
- nodeDescription.execIn = true;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: 'Loop Body',
- pinExecOutId: null,
- outOrder: 0,
- },
- execOut1: {
- execOutTitle: 'Completed',
- pinExecOutId: null,
- outOrder: 4,
- }
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Value',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 1,
- },
- output1: {
- outputTitle: 'Index',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 2,
- },
- output2: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 3,
- }
- }
- nodeDescription.color = 'Logic';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == "Break") {
- nodeDescription.nodeTitle = 'Break';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.color = 'Logic';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == "Continue") {
- nodeDescription.nodeTitle = 'Continue';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.color = 'Logic';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Length') {
- nodeDescription.nodeTitle = 'Length';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Value',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Get';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'isEmpty') {
- nodeDescription.nodeTitle = 'isEmpty';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Result',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Get';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Reverse') {
- nodeDescription.nodeTitle = 'Reverse';
- nodeDescription.pinExecInId = null;
- nodeDescription.execIn = true;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Front') {
- nodeDescription.nodeTitle = 'Front';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Front(Ref)',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Get';
- nodeDescription.rows = 2;
- nodeDescription.colums = 11;
- }
- if (type == 'Sort(Num)') {
- nodeDescription.nodeTitle = 'Sort(Num)';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Increasing',
- dataType: 'Boolean',
- pinInId: null,
- defValue: true,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == 'Back') {
- nodeDescription.nodeTitle = 'Back';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Back(Ref)',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Get';
- nodeDescription.rows = 2;
- nodeDescription.colums = 11;
- }
- if (type == 'GetByPos') {
- nodeDescription.nodeTitle = 'GetByPos';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Pos',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Value(Ref)',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 0,
- }
- }
- nodeDescription.color = 'Get';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == 'SetByPos') {
- nodeDescription.nodeTitle = 'SetByPos';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Pos',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: 1,
- pinInId: null,
-
- },
- input2: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
-
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Value(Ref)',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 4;
- nodeDescription.colums = 12;
- }
- if (type == 'Insert') {
- nodeDescription.nodeTitle = 'Insert';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Pos',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: 1,
- pinInId: null,
- },
- input2: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 4;
- nodeDescription.colums = 10;
- }
- if (type == 'PushBack') {
- nodeDescription.nodeTitle = 'PushBack';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'PushFront') {
- nodeDescription.nodeTitle = 'PushFront';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: 1,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'PopBack') {
- nodeDescription.nodeTitle = 'PopBack';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'PopFront') {
- nodeDescription.nodeTitle = 'PopFront';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 10;
- }
- if (type == 'Search') {
- nodeDescription.nodeTitle = 'Search';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Data',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Exist',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
- },
- output1: {
- outputTitle: 'Index',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 1,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 11;
- }
- if (type == 'BinarySearch(Num)') {
- nodeDescription.nodeTitle = 'BinarySearch(Num)';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Value',
- dataType: 'Number',
- defValue: 0,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Exist',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 0,
-
- },
- output1: {
- outputTitle: 'Lower Bound',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 1,
- },
- output2: {
- outputTitle: 'Upper Bound',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 2,
- }
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 13;
- }
- if (type == 'Max(Array)') {
- nodeDescription.nodeTitle = 'Max(Array)';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'MaxValue',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 11;
- }
- if (type == 'Min(Array)') {
- nodeDescription.nodeTitle = 'Min(Array)';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'MinValue',
- dataType: 'Number',
- pinOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 11;
- }
- if (type == 'HttpRequest') {
- nodeDescription.nodeTitle = 'HttpRequest';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: 'OnSuccess',
- pinExecOutId: null,
- outOrder: 0,
- },
- execOut1: {
- execOutTitle: 'OnFail',
- pinExecOutId: null,
- outOrder: 2,
- },
- execOut2: {
- execOutTitle: 'Continue',
- pinExecOutId: null,
- outOrder: 3,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'URL',
- dataType: 'String',
- defValue: "'link'",
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'JSON',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 1,
- },
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == 'OpenWindow') {
- nodeDescription.nodeTitle = 'OpenWindow';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'URL',
- dataType: 'String',
- defValue: "'link'",
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Success?',
- dataType: 'Boolean',
- pinOutId: null,
- outOrder: 1,
- },
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == 'GetByName(JSON)') {
- nodeDescription.nodeTitle = 'GetByName(JSON)';
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'JSON',
- dataType: 'Data',
- isInputBoxRequired: false,
- pinInId: null,
- },
- input1: {
- inputTitle: 'Name',
- dataType: 'String',
- defValue: "'id'",
- pinInId: null,
- }
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Data',
- dataType: 'Data',
- pinOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.color = 'Get';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == 'StrToArray') {
- nodeDescription.nodeTitle = 'StrToArray';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'String',
- dataType: 'String',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'Array',
- dataType: 'Array',
- pinOutId: null,
- outOrder: 1,
- },
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
- if (type == 'ArrayToStr') {
- nodeDescription.nodeTitle = 'ArrayToStr';
- nodeDescription.execIn = true;
- nodeDescription.pinExecInId = null;
- nodeDescription.execOut = {
- execOut0: {
- execOutTitle: null,
- pinExecOutId: null,
- outOrder: 0,
- },
- }
- nodeDescription.inputs = {
- input0: {
- inputTitle: 'Array',
- dataType: 'Array',
- isInputBoxRequired: false,
- pinInId: null,
- },
- }
- nodeDescription.outputs = {
- output0: {
- outputTitle: 'String',
- dataType: 'String',
- pinOutId: null,
- outOrder: 1,
- },
- }
- nodeDescription.color = 'Func';
- nodeDescription.rows = 2;
- nodeDescription.colums = 12;
- }
-
- new this.ProgramNode(nodeDescription, location, layer, stage);
- }
-
-
-}
-
-
-
-/*
-
-//required json
-{
- type: string,
- id: num,
- inputs:{
- count: integer,
- execIn1:{
- name: "",
- wire: KonvaWire else null
- }
- ip1: {
- dataType: string,
- default: num/str etc,
- value: num/str etc,
- name: ""
- wire: Konva.Line else null if no wire
- }
- }
- outputs:{
- count: integer,
- execOut1:{
- name: "",
- wire: KonvaWire else null
- }
- out1: {
- dataType: string,
- default: num/str etc,
- value: num/str etc,
- name: ""
- wire: Konva.Line else null if no wire
- }
- }
-
-}
-
-
-*/
\ No newline at end of file
diff --git a/javascript/SaveAndLoad/SaveAndLoad.js b/javascript/SaveAndLoad/SaveAndLoad.js
deleted file mode 100644
index cc39ce7..0000000
--- a/javascript/SaveAndLoad/SaveAndLoad.js
+++ /dev/null
@@ -1,207 +0,0 @@
-import { Nodes } from '../Nodes/nodes.js'
-import { addConnectionWire } from '../Wiring/Wiring.js'
-import { variableList } from '../Variable/variable.js'
-import {showAlert, vscriptOnLoad} from '../main/alertBox.js'
-function writeError(err, msg) {
- document.getElementById("console-window").classList.toggle("hidden", false);
- let codeDoc = document.getElementById("console").contentWindow.document;
- codeDoc.open();
- codeDoc.writeln(
- `\n
-
-
-
- "${msg}"
- ${err}
-
-
-