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

@wetron/svelte

v0.1.0

Published

Svelte components for neural network graph visualization, built on SvelteFlow

Readme

@wetron/svelte

Svelte components for neural network graph visualization. Renders a ModelGraph as an interactive node graph using SvelteFlow, with a property panel for inspecting nodes, edges, and tensors.

Install

pnpm add @wetron/svelte

Usage

<script>
  import { parseModel } from '@wetron/core';
  import { ModelGraphView, NodePropertyPanel } from '@wetron/svelte';

  let graph = $state(null);
  let target = $state(null);

  async function handleFile(e) {
    const bytes = new Uint8Array(await e.target.files[0].arrayBuffer());
    graph = await parseModel(bytes, e.target.files[0].name);
  }
</script>

<ModelGraphView {graph} onTargetClick={(t) => (target = t)} />
<NodePropertyPanel {target} {graph} onClose={() => (target = null)} />

Passing graph routes initializer tensors to the built-in inspectors. Rank-2 and higher tensors open in the matrix inspector; scalars and vectors open in the distribution inspector. Models larger than 20 MiB remain deferred until the user enables Show weights.

Built-in inspectors appear when their inputs are supported:

  • Matrix/slice: rank 2+, with explicit display axes and fixed indices.
  • Distribution: histogram, percentiles, non-finite counts, linear/log scale.
  • Per-axis profile: mean, standard deviation, L1/L2, maximum absolute value, zero ratio.
  • Sparsity: exact or near-zero ratios and source-traceable blocks.
  • Kernel gallery: rank 3–5 after selecting OIHW, OHWI, HWIO, or IHWO explicitly.
  • Quantization: encoded Q4_0 block diagnostics.
  • Diagnostics: non-finite values, constant slices, and norm outliers.
  • Values: the flattened virtualized value grid.

Only the selected inspector is mounted. WeightHeatmap remains exported for compatibility but is not part of the default composition.

Custom weight inspectors

Create an inspector component that reads the nearest WeightPanel context:

<!-- TensorCount.svelte -->
<script lang="ts">
  import { getWeightInspection } from '@wetron/svelte';
  import { computeWeightDistribution } from '@wetron/core/weight-distribution';

  const context = getWeightInspection();
  const inspection = $derived(context.current);
  const distribution = $derived(
    inspection.status === 'ready' ? computeWeightDistribution(inspection.values, 24) : null,
  );
</script>

<div>
  {inspection.tensor.name}:
  {distribution ? `median ${distribution.percentiles.p50}` : inspection.status}
</div>

Pass it through the weightInspector snippet:

<NodePropertyPanel {target} {graph}>
  {#snippet weightInspector()}
    <TensorCount />
  {/snippet}
</NodePropertyPanel>

getWeightInspection() reads the nearest WeightPanel and throws outside one. Its current getter stays reactive as loading state changes. Deferred, external, and unavailable inspections expose bytes, values, and stats as null; unsupported inspections expose bytes only. The panel's Show weights switch controls the deferred gate.

Custom inspector selectors should mount only their active inspector when analysis is expensive. Changing tensors remounts the inspector subtree and resets its local state.

API

ModelGraphView

<ModelGraphView
  graph={ModelGraph}
  onTargetClick={(target: PanelTarget) => void}
  colorMode={"light" | "dark" | "system"}
  selectedEdgeTensorName={string | null}
  searchQuery={string}
  onWarnings={(warnings: readonly ParseWarning[]) => void}
  bind:exportRef={ExportHelpers | null}
/>

bind:exportRef gives imperative access to the graph viewport:

type ExportHelpers = {
  fitAll: () => Promise<void>;
  getViewport: () => { x: number; y: number; zoom: number };
  setViewport: (vp: { x: number; y: number; zoom: number }) => void;
  getNodesBounds: () => { x: number; y: number; width: number; height: number };
  getViewportElement: () => HTMLElement | null;
};

NodePropertyPanel

<NodePropertyPanel
  target={PanelTarget | null}
  graph={ModelGraph}
  colorMode={"light" | "dark" | "system"}
  opsets={ReadonlyMap<string, number>}
  inputSources={ReadonlyMap<string, string>}
  tensorShapes={ReadonlyMap<string, { shape, dtype }>}
  onTensorClick={(name: string) => void}
  onBack={() => void}
  onClose={() => void}
>
  {#snippet weightInspector()}{/* custom inspector */}{/snippet}
</NodePropertyPanel>

PanelTarget

type PanelTarget =
  | GraphNode
  | { graphValue: GraphValue; direction: 'input' | 'output' }
  | {
      edge: {
        tensorName: string;
        from: { opType: string; name: string };
        to: Array<{ opType: string; name: string }>;
      };
    }
  | { tensor: { name: string; shape: readonly number[] | null; dtype: string | null } };

Peer dependencies

  • svelte ≥ 5
  • @xyflow/svelte ≥ 1.5.2
  • phosphor-svelte ≥ 3