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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@signalsafe/tree-spec-editor-react

v0.2.5

Published

UI-kit agnostic React Flow canvas for the SignalSafe TreeSpec graph editor (no UI library).

Readme

@signalsafe/tree-spec-editor-react

Headless React + React Flow layer for the SignalSafe TreeSpec graph editor: canvas component, orchestration hook, and wiring to @signalsafe/tree-spec-editor-core.

| | | |---|---| | npm | @signalsafe/tree-spec-editor-react | | GitHub | SignalSafeSoftware/tree-spec-editor-react | | Peer deps | react, react-dom, reactflow (^18 / ^11) — no UI library required |

UI-kit agnostic canvas

The React Flow canvas uses semantic HTML and graph-editor-* class hooks only. It does not require Bootstrap CSS, Bootstrap Icons, or any component library.

Host applications own styling. Map graph-editor-* in your theme, or pass className on TreeSpecGraphEditor for layout/sizing. See docs/UI_KIT_AGNOSTIC_CANVAS.md.

What this package does

  • Renders TreeSpecGraphEditor (React Flow canvas, custom nodes/edges, selection).
  • Exposes useTreeSpecEditor for load/validate/autosave/publish orchestration (host injects adapter callbacks).
  • Re-exports core editor types used by the hook.

What this package does not do

  • Sidebar panels, modals, toolbars, or UI-kit chrome — use @signalsafe/tree-spec-editor or your own UI shell.
  • Routing, HTTP, authentication, or persistence — host app provides adapter implementations.
  • Wire compile/publish to a backend without your adapter code.

Install

npm install @signalsafe/tree-spec-editor-react @signalsafe/tree-spec-editor-core @signalsafe/tree-spec react react-dom reactflow

React Flow CSS (host-owned)

This package does not import reactflow/dist/style.css from built JavaScript. Native Node ESM imports of @signalsafe/tree-spec-editor-react therefore do not fail on .css file extensions.

Host applications that want React Flow default styling should import the stylesheet from their own app entrypoint:

import "reactflow/dist/style.css";

If you use @signalsafe/tree-spec-editor as the authoring shell, map graph-editor-* canvas hooks in host CSS — Bootstrap is optional and host-owned.

Quick start

import { useState } from "react";
import TreeSpecGraphEditor from "@signalsafe/tree-spec-editor-react";
import {
    END_NODE_ID,
    type EditorTree,
} from "@signalsafe/tree-spec-editor-core";

const initialTree: EditorTree = {
    start_node: "start",
    nodes: {
        start: {
            id: "start",
            type: "prompt",
            prompt: "Example prompt",
            choices: [{ id: "done", label: "Finish" }],
            position: { x: 40, y: 120 },
        },
    },
    transitions: [
        {
            id: "t1",
            fromNodeId: "start",
            fromChoiceId: "done",
            toNodeId: END_NODE_ID,
            outcome: "safe",
        },
    ],
};

export function ExampleCanvas() {
    const [tree, setTree] = useState(initialTree);
    return (
        <TreeSpecGraphEditor
            tree={tree}
            onChange={setTree}
            className="graph-editor-canvas-root my-canvas-host"
        />
    );
}

For full authoring flows (load/save/validate), compose useTreeSpecEditor with your adapter — see tests and @signalsafe/tree-spec-editor for a reference shell.

Public exports

| Export | Purpose | |---|---| | default / TreeSpecGraphEditor | React Flow canvas | | TreeSpecGraphEditorProps | Canvas props | | useTreeSpecEditor | Stateful editor orchestration | | TreeSpecEditorAdapter, UseTreeSpecEditorResult, … | Adapter and hook types |

Import from @signalsafe/tree-spec-editor-react only (no subpath exports).

Documentation preview

The graph image below is generated from the live example data with the built TreeSpecGraphEditor component. The browser-backed generator captures the same React Flow canvas that this package exports, including the editor's virtual END node.

TreeSpec editor example flow

Run yarn docs:images to regenerate the image locally. CI runs yarn docs:check with Chromium to keep the committed asset in sync.

Package boundaries

| Layer | Package | |---|---| | Wire | @signalsafe/tree-spec | | Editor model | @signalsafe/tree-spec-editor-core | | React canvas (this package) | @signalsafe/tree-spec-editor-react | | Authoring shell | @signalsafe/tree-spec-editor |

Canvas selection behavior

| Selection | Inspector context | Contextual zoom (default on) | |---|---|---| | Node | selected node | fits node in viewport | | Edge | source node + focused choice | viewport unchanged | | Choice | focusChoiceId set | fits parent node when selected |

Pass contextualZoom={false} to disable automatic viewport fitting.

Development

Requires Node.js >=22.12.0 (engines.node). CI runs checks, tests, and smoke on Node 22 and 24; publish uses Node 24. Node 20 is no longer supported (GitHub Actions Node 20 deprecation).

yarn build uses tsconfig.build.json and resolves @signalsafe/* from node_modules. Ecosystem sibling paths in tsconfig.json apply to local typecheck/tests only.

yarn install
yarn build
yarn test
yarn typecheck

Security

See SECURITY.md. Host applications must authenticate users, authorize edits, and validate TreeSpec JSON server-side before publish.

Changelog and releases

Related packages