0.22.2 • Published 3 years ago

@marco.jacovone/cnodes-ui v0.22.2

Weekly downloads
1,432
License
MIT
Repository
github
Last release
3 years ago

cnodes-ui

An ultimate UI for cnodes

cnodes-ui is a User Interface specifically developed for cnodes. It is inspired by the interface model proposed for the Unreal Engine product, which has been hugely successful in the developer community.

I therefore decided to develop a project completely created in javascript, to make a tool available to the community that they can use within their own projects.

Screenshot

I strongly believe in the separation between the graphic interface and the processing engine. This is the reason that prompted me to create two distinct projects.

Taking advantage of this separation, it is possible to imagine the scenario in which the graphic part is integrated within a WEB client, while the server part, which is able to independently execute the processes defined with the client, can be integrated into the backend.

Getting started

You can turn any HTML element into a cnodes-ui canvas. Lets start with a simple HTML file such as

<html>
  <head>
    <style>
      html,
      body,
      div {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
    <script
      type="text/javascript"
      src="https://unpkg.com/@marco.jacovone/cnodes-ui/dist/main.js"
    ></script>
  </head>

  <body>
    <div id="my-canvas-id"></div>
  </body>
  <script type="text/javascript">
    // Create the canvas on the div element
    let canvas = cnui.canvas("my-canvas-id");

    // To create an empty canvas, lets define a empty program
    let prg = cnui.program();
    canvas.program = prg;
  </script>
</html>

Now you can play with links with only two elements: Enter and Exit, the main entry point and exit point of the prg program. Connections let you compose your program with your favorite custom nodes.

Connection

To insert some nodes, for example a For node and a If node, you can type

// Create two nodes: For and If
let prg = cnui.Env.getInstance("Program"); // or cnui.Program.instance()
let forNode = cnui.Env.getInstance("For");
let ifNode = cnui.Env.getInstance("If");

prg.addNode(forNode).addNode(ifNode);
canvas.program = prg;

Nodes will overlap, to give a position to nodes, you can set a pos structure

let forNode = cnui.Env.getInstance("For");
let ifNode = cnui.Env.getInstance("If");
forNode.meta = {
  pos: {
    x: 400,
    y: 100,
  },
};
ifNode.meta = {
  pos: {
    x: 700,
    y: 100,
  },
};

prg.addNode(forNode).addNode(ifNode);
canvas.program = prg;

You can now edit your node graph, and whenever you want, you can export the resulting program by typing

let exp = cnui.Env.export(prg);
console.log(JSON.stringify(exp));

This program (the exp variable) can be stored and loaded into a CNODES program instance to execute.

let prg = cnui.Env.import(JSON.parse(`{"id":"NID_3","version":1,...`));
// process execution is now asyncronous, this allow nodes to
// be async and to efficiently wait for background events such as
// webservice call. So await it with an IEF...
(async () => await prg.process())();

The cnodes engine doesn't require the cnodes-ui library to work, because it doesn't have any dependency.

Update:

0.18.25 Introduces new Dark theme!

DarkTheme

Documentation

Check out our Documentation section.

Demo

Try a demo test board at:

DEMO Test board

Once you've built the graph, you can press the Run button ti test its effect. please check the console to see the "Console" node output.

State of the art

The project is actually in a early alpha stage, but is growing rapidly ;-)

0.22.2

3 years ago

0.22.1

3 years ago

0.22.0

3 years ago

0.21.0

3 years ago

0.20.0

3 years ago

0.19.18

3 years ago

0.19.17

3 years ago

0.19.16

3 years ago

0.19.15

3 years ago

0.19.14

3 years ago

0.19.13

3 years ago

0.19.12

3 years ago

0.19.11

3 years ago

0.19.10

3 years ago

0.19.9

3 years ago

0.19.8

3 years ago

0.19.7

3 years ago

0.19.6

3 years ago

0.19.5

3 years ago

0.19.4

3 years ago

0.19.3

3 years ago

0.19.2

3 years ago

0.19.0

3 years ago

0.19.1

3 years ago

0.18.26

3 years ago

0.18.24

3 years ago

0.18.25

3 years ago

0.18.23

3 years ago

0.18.22

3 years ago

0.18.21

3 years ago

0.18.20

3 years ago

0.18.17

3 years ago

0.18.19

3 years ago

0.18.18

3 years ago

0.18.15

3 years ago

0.18.16

3 years ago

0.18.14

3 years ago

0.18.13

3 years ago

0.18.12

3 years ago

0.18.11

3 years ago

0.18.10

3 years ago

0.18.9

3 years ago

0.18.8

3 years ago

0.18.7

3 years ago

0.18.6

3 years ago

0.18.5

3 years ago

0.18.3

3 years ago

0.18.4

3 years ago

0.18.2

3 years ago

0.18.1

3 years ago

0.18.0

3 years ago

0.17.2

3 years ago

0.17.0

3 years ago

0.17.1

3 years ago

0.16.14

3 years ago

0.16.13

3 years ago

0.16.12

3 years ago

0.16.11

3 years ago

0.16.10

3 years ago

0.16.8

3 years ago

0.16.9

3 years ago

0.16.7

3 years ago

0.16.5

3 years ago

0.16.6

3 years ago

0.16.3

3 years ago

0.16.4

3 years ago

0.16.1

3 years ago

0.16.2

3 years ago

0.15.10

3 years ago

0.15.11

3 years ago

0.15.5

3 years ago

0.15.6

3 years ago

0.15.7

3 years ago

0.15.8

3 years ago

0.15.9

3 years ago

0.16.0

3 years ago

0.15.4

3 years ago

0.15.3

3 years ago

0.15.2

3 years ago

0.15.1

3 years ago

0.15.0

3 years ago

0.14.7

3 years ago

0.14.6

3 years ago

0.14.5

3 years ago

0.14.0

3 years ago

0.14.1

3 years ago

0.14.2

3 years ago

0.14.3

3 years ago

0.14.4

3 years ago

0.13.10

3 years ago

0.13.9

3 years ago

0.13.7

3 years ago

0.13.8

3 years ago

0.13.6

3 years ago

0.13.5

3 years ago

0.13.3

3 years ago

0.13.4

3 years ago

0.13.2

3 years ago

0.13.1

3 years ago

0.13.0

3 years ago

0.12.5

3 years ago

0.12.4

3 years ago

0.12.3

3 years ago

0.12.2

3 years ago

0.12.0

3 years ago

0.12.1

3 years ago

0.11.4

3 years ago

0.11.3

3 years ago

0.11.1

3 years ago

0.11.2

3 years ago

0.11.0

3 years ago

0.10.3

3 years ago

0.10.1

3 years ago

0.10.2

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.7.3

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.4

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.10

3 years ago

0.5.9

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.2

3 years ago

0.1.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.19

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.16

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago