New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@plantarium/nodesystem

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plantarium/nodesystem

latest
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

@Plantarium/Nodesystem

@plantarium/nodesystem

Extensible/Serializable visual NodeSystem Library à la Blender.

Demo · Docs

Table of Contents

About The Project

This project came out of another project where i needed a node interface.

Installation

Without a package manager:

<script type="module">
  import { Nodesystem } from 'https://cdn.skypack.dev/@plantarium/nodesystem';
</script>

With a package manager:

npm install @plantarium/nodesystem
yarn add @plantarium/nodesystem
pnpm add @plantarium/nodesystem

Usage

Import it as module:

import { NodeSystem } from '@plantarium/nodesystem';

Then use it like so:

const system = new NodeSystem();

If you want to register your own node types:

system.registerNodeType({
  title: 'Add',
  type: 'add',
  outputs: ['number'],
  parameters: {
    a: {
      type: 'number',
      value: 0,
    },
    b: {
      type: 'number',
      value: 0,
    },
  },
  compute({ a, b }: { a: number, b: number }) {
    return a + b;
  },
});

All Options to register a NodeType:

interface NodeTypeData {
  title: string;

  type: string;

  outputs: string | string[];

  meta?: {
    description?: string;
    tags?: string[];
  };

  parameters: {
    [key: string]: ValueTemplate;
  };

  compute(parameters: { [key: string]: unknown }): unknown;
}

All options for a single parameter

interface ValueTemplate {
  type: string;
  label?: boolean | string;
  value?: boolean | string | number;
  values?: string[];
  points?: Vec2[];
  isAccessible?: boolean;
  external?: boolean;
  internal?: boolean;
  inputType?: string;
  min?: number;
  max?: number;
  step?: number;
  defaultValue?: number | string | boolean;
}

Saving and loading of systems

// save the node system
const save = system.serialize();
// Download/Upload/stringify the save

// Load the node system
system.load(save);

FAQs

Package last updated on 26 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts