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

@svadmin/flow

v0.5.0

Published

Optional node-based canvas components for Svelte 5 admin applications

Readme

@svadmin/flow

@svadmin/flow is an optional Svelte 5 node-canvas package for admin tools that need a draggable graph editor. It wraps the maintained MIT-licensed @xyflow/svelte runtime without adding it to @svadmin/ui, @svadmin/core, or applications that do not use a canvas.

It owns browser-side graph interaction only: drag, connect, pan, zoom, controls, minimap, and a plain-text template palette. It does not define workflow semantics, validate business rules, persist graphs, authorize edits, execute nodes, or integrate with any data provider. Hosts keep those decisions and must validate every saved graph on the server.

Install

bun add @svadmin/flow svelte

Import the package CSS once in the route or layout that renders a canvas:

import '@svadmin/flow/flow.css';

Minimal draggable canvas

<script lang="ts">
  import { FlowCanvas, FlowPalette, type FlowEdge, type FlowNode, type FlowItemDropDetail } from '@svadmin/flow';
  import '@svadmin/flow/flow.css';

  let nodes = $state<FlowNode[]>([
    { id: 'start', type: 'input', position: { x: 80, y: 80 }, data: { label: 'Start' } },
  ]);
  let edges = $state<FlowEdge[]>([]);
  let sequence = 0;

  const palette = [
    { id: 'review', type: 'default', label: 'Review', data: { label: 'Review' } },
    { id: 'finish', type: 'output', label: 'Finish', data: { label: 'Finish' } },
  ];

  function addNode({ template, position }: FlowItemDropDetail) {
    sequence += 1;
    nodes = [...nodes, { id: `${template.id}-${sequence}`, type: template.type, position, data: template.data }];
  }
</script>

<div class="editor-layout">
  <FlowPalette items={palette} />
  <FlowCanvas bind:nodes bind:edges onitemdrop={addNode} showMiniMap />
</div>

FlowCanvas updates bound nodes and edges when users move, connect, select, or delete elements. FlowPalette puts an explicitly-scoped JSON payload on the browser drag operation; onitemdrop receives that palette template and flow-space coordinates. The host creates the node, so it can assign IDs, validate node types, apply permissions, and choose its persistence model.

The onready callback exposes fitView() and screenToFlowPosition(). fitView() resolves to false for an empty canvas rather than waiting for nodes to appear. Later calls use the current nodes.

API

| Export | Purpose | | --- | --- | | FlowCanvas | Two-way-bound Svelte Flow canvas with optional background, controls, minimap, and palette-drop callback. | | FlowPalette | Accessible text palette that supports click selection and browser drag. | | FlowNode, FlowEdge | Svelte Flow node and edge type aliases. | | FlowPaletteItem, FlowItemDropDetail | Typed host-owned palette and drop contracts. | | encodeFlowPaletteItem, decodeFlowPaletteItem, readFlowPaletteItem | Small helpers for custom palette/drop integrations. |

Boundaries

  • This package is browser-oriented; SSR consumers should render it client-side only.
  • Palette types and runtime validation share one schema. Data must contain only plain JSON objects, dense arrays, strings, finite numbers, booleans, and null. Unknown template properties, explicit undefined, cycles, accessors, symbols, custom instances, and serialization hooks are rejected. Encoding invalid input throws TypeError; decoding invalid payloads returns null.
  • Palette validation checks the transport format, not host-specific business rules or authorization. Saved graphs still require server-side validation.
  • FlowCanvas does not serialize or persist state. Save only a host-owned graph document after validating node, edge, tenancy, authorization, and version rules.
  • Custom nodes and edges use the native @xyflow/svelte nodeTypes and edgeTypes props.