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

@codeflow-team/react

v0.3.0

Published

React canvas for CodeFlow graphs — React Flow nodes with ELK hierarchical layout, node inspector, Monaco code panel and diagnostics, wired to the core patch engine.

Readme

@codeflow-team/react

The UI layer. A React Flow canvas with hierarchical ELK layout (loops and try blocks are real containers, not decorations), an inspector that edits through the patch engine, a Monaco panel with two-way selection sync, a diff preview, a diagnostics panel, three progressive-disclosure levels and a light/dark design system.

Everything the MVP cannot do renders as a disabled control with the reason next to it. The UI is not allowed to fail silently or approximate.

See the root README for screenshots and the wider picture.

Install

Prepared for npm as v0.1.0; until the first release lands, use the workspace copy:

// package.json
"dependencies": { "@codeflow-team/react": "workspace:*" }

React 18 or 19 is a peer dependency. Two stylesheets must be imported by the host app:

import "@xyflow/react/dist/style.css";
import "@codeflow-team/react/styles.css";

The shape of a host app

The host owns the source text and the graph; the provider owns everything else. This type-checks against the workspace as written:

import { useEffect, useState } from "react";
import { createCodeFlow, createRegistry, type WorkflowGraph } from "@codeflow-team/core";
import { CodeFlowProvider, WorkflowCanvas, NodeInspector } from "@codeflow-team/react";

const session = createCodeFlow({ registry: createRegistry({ tools: [] }) });

export function Editor({ file }: { file: string }): React.ReactNode {
  const [source, setSource] = useState(file);
  const [graph, setGraph] = useState<WorkflowGraph | null>(null);

  useEffect(() => {
    void session.analyze(source, { file: "flow.ts" }).then(setGraph);
  }, [source]);

  return (
    <CodeFlowProvider
      session={session}
      graph={graph}
      source={source}
      onPatched={(result) => {
        setSource(result.source);   // the patched file — this is the source of truth
        setGraph(result.graph);
      }}
      onGraphSync={setGraph}
    >
      <WorkflowCanvas />
      <NodeInspector />
    </CodeFlowProvider>
  );
}

The components that matter

| Export | What it is | |---|---| | CodeFlowProvider | Holds the session, the graph, the selection and the editing state. Also takes source (so patch conflicts can be detected when the editor is ahead of the graph), mode / defaultMode for the disclosure level, run for live execution state, and editable={false} to switch editing off entirely. | | WorkflowCanvas | The diagram. ELK hierarchical layout, resizable containers, coloured branch labels, folding, minimap, and a select-to-reveal rule for data edges. | | NodeInspector | The edit surface: fields, condition, iterable, tool swap, delete with its dependency check, code region, and a diff preview before Apply. Renders as a right-hand dock, or as a sheet on a narrow screen. | | CodePanel / CodeDialog | Monaco, synced both ways — select a node and the code highlights; move the cursor and the node selects. CodeDialog is the "Edit Code" modal for an opaque region. | | DiagnosticsPanel | Everything the analyzer could not fully understand, each entry linked to its node. |

Plus the controls a host needs to build its own chrome: DisclosureToggle, DataLinksToggle, ThemeToggle, applyTheme / useTheme, and a shadcn-shaped design system over Base UI primitives (Button, Badge, Select, Modal, Sheet, Popover, Segmented, Notice, ToastHost, useToast, TooltipProvider) — exported so an app builds its top bar out of the same parts the library uses instead of approximating them.

Hooks and pure helpers

useCodeFlow, useOptionalCodeFlow, useSelectedNode, useNodeDiagnostics read the provider. Below them, the adapters are exported as plain functions and are the unit-test surface: toReactFlow, toElkGraph / runLayout / useElkLayout, autoCollapse / buildCollapseView, buildDataLinks, resolveInspectorFields, encodeFieldValue, nodeSummaryRows. None of them need React to run.

Note for library development

context/provider.tsx exports exactly one component, and the context object is cached on globalThis by context/context.ts. Both are load-bearing: a module that creates a context at module scope and exports non-components is not a valid Fast Refresh boundary, so a rebuild produced a second context object, the provider and its consumers stopped meeting, and the app went white. Three regression tests hold that shut.

Tests

pnpm --filter @codeflow-team/react test   # 155 tests

License

GNU AGPL v3 or later.