npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

diazo

v0.2.7

Published

[GitHub](https://github.com/astronautlabs/diazo) | [NPM](https://npmjs.com/package/diazo) | [Angular Documentation](https://astronautlabs.github.io/diazo/) | [Model Documentation](https://astronautlabs.github.io/diazo-model) | [Try it out](https://astron

Downloads

17

Readme

diazo

GitHub | NPM | Angular Documentation | Model Documentation | Try it out

An MIT-licensed slot-driven directed-acyclical-graph (DAG) editor for Angular. This component was built for use in Astronaut Labs' Livefire product suite because there was no good existing open-source editor. We wanted to fix that, so we hope you find lots of great ways to use this editor in your projects!

Diazo is inspired by Blueprint, the visual programming language of Unreal Engine. Diazo itself is just the editor that would power such an experience, and the library itself is completely domain-agnostic. You can use Diazo in your apps to introduce visual node-graph functionality in any domain where it makes sense to apply it, and we encourage you to do so!

Where can I find docs for DiazoGraph?

The types for the actual graph data that Diazo edits can be found in the @diazo/model module. Click here to jump to its documentation.

Concepts

Diazo operates on a simple directed-acyclical-graph (DAG) data structure which is transparently available to you as the consumer of the library. The DAG is specified as a set of nodes with distinct IDs which each specify a set of input and output slots. The DAG also tracks a set of edges which link one slot on a particular node to another slot on a different node.

Usage

    <dz-editor
        [graph]="myGraph"
        [availableNodes]="availableNodes"
        ></dz-editor>

There are many more bindable properties and events that {@linkcode EditorComponent | <dz-editor>} makes available, but the above is good enough to get started.

[graph]="myGraph"

The most important input to Diazo is the graph object itself. The graph object specifies the nodes and edges that make up the graph you can see in the editor.

One might satisfy this binding by declaring myGraph as seen below.

import { Diazo } from 'diazo';

export class MyComponent {
    myGraph : Diazo = { nodes: [], edges: [] };
}

[availableNodes]="availableNodes"

In order for a user to create new nodes, you will need to define a set of template nodes that will populate into the New Node menu (accessible by right clicking). availableNodes is an array of NodeSets.

Each NodeSet defines a labelled group of template nodes. Let's add a node set with a few simple template nodes:

import { Diazo } from 'diazo';

export class MyComponent {
    myGraph : Diazo = { nodes: [], edges: [] };
    availableNodes : DiazoNodeSet[] = [
        {
            id: 'general',
            label: 'General',
            nodes: [
                {
                    data: {
                        unit: 'my-input'
                    },
                    label: 'My Input',
                    slots: [
                        { id: 'output', type: 'output', label: 'Output' }
                    ]
                },
                {
                    data: {
                        unit: 'my-output'
                    },
                    label: 'My Output',
                    slots: [
                        { id: 'input', type: 'input', label: 'Input' }
                    ]
                }
            ]
        }
    ];
}

Defining Properties

Template nodes can specify a set of properties which will be shown on the Properties sidebar. Similar to the available node set, properties are grouped into labelled sets.

let node : DiazoNode = {
    data: {
        unit: 'my-output',
        someProperty: 'abc'
    },
    label: 'My Output',
    slots: [
        { id: 'input', type: 'input', label: 'Input' }
    ],
    properties: [
        {
            id: 'output-options',
            label: 'Output Options',
            properties: [
                {
                    type: 'text',
                    path: '$.data.someProperty',
                    label: 'Some Property'
                }
            ]
        }
    ]
}

Property Types

There are a number of property editor types built in, and you can register custom property editors as well.

Builtin types:

  • text - Single-line text editor
  • textarea - Multi-line text editor
  • number - Number editor
  • boolean - Checkbox
  • position - Special property which exposes two fields connected to $.x and $.y. path is ignored.
  • bitmask - Edit the bits of a number with checkboxes by defining an array of labels. Labels are associated with bit indices by their position in the labels array, and thus all labels must be contiguous. Place labels in bitmask.labels
  • json - Edit JSON using Monaco
  • markdown - Edit Markdown using Monaco
  • typescript - Edit TypeScript using Monaco
  • matrix - Edit many properties in a grid with short labels. Can be used to implement fixed-size matrices.
  • select - Choose the value from a set of predefined options
  • flags - Edit an array of string flags using a multiple select box.

Learn More

  • {@linkcode EditorComponent | <dz-editor>} - Read about the editor component
  • {@linkcode DiazoGraph} - Read about the model layer
  • {@linkcode DiazoContext} - Read about the context layer, which tracks editor state