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

@sikaeducation/sika-graph

v1.4.5

Published

Graph algorithm for generating curriculum navigation coordinates

Downloads

60

Readme

Sika Graph

CI

Given nodes, links, groups, an optional options object, and an optional filter, return the plottable graph data for a Sika Graph. The filter needs to be a part of this (instead of the data being passed in) to prevent the graph thrashing when all of the plot points for the data change.

Deploys to npm as @sikaeducation/sika-graph.

Installation

npm i @sikaeducation/sika-graph

Usage

import { createSimulation } from "@sikaeducation/sika-graph";

const nodes = [
  {
    id: "Quality",
    group: "quality",
    critical: true,
    complete: true,
  },
  {
    id: "Naming",
    group: "quality",
    critical: false,
    complete: false,
  },
];
const links = [
  {
    source: "Quality",
    target: "Naming",
  },
];
const groups = [
  {
    id: "quality",
    label: "Quality Concepts",
    "background-color": "hsla(120, 50%, 50%, 0.1)",
    "foreground-color": "hsla(120, 50%, 50%, 0.4)",
  },
];
const options = {
  simulation: {
    tickCount: 300,
    alphaCutoff: 0.1,
    size: 60, // y/x/-y/-x
    hullPadding: 5,
  },
  forces: {
    positional: {
      x: 0,
      y: 0,
    },
    charge: {
      // Attraction, -100 is repel, 100 is stacked
      initial: -90,
      final: -30,
    },
    collision: {
      initial: 30,
      final: 0,
    },
    link: {
      // Nodes pushed together or pulled apart
      distance: {
        // How far apart to target, ~30
        initial: 300,
        final: 30,
      },
      strength: {
        // 0-1, how aggressive
        initial: 0.2,
        final: 0.5,
      },
    },
    group: {
      charge: {
        // how attracted nodes are to group center, -1 is repulsion, 0 is no attraction, 1 is pinned to center
        initial: 1,
        final: 0.5,
      },
      link: {
        // Used for link force nodes pre alpha cutoff
        strength: {
          // -1 - 1: Positive is attraction, negative is repulsion
          initial: 0.9,
        },
      },
      distance: {
        cutoff: 300, // Distance to ignore this force after
        rate: 100, // Factor
      },
    },
  },
};
const currentFilter = "all";
const { simulation, groups } = runSimulation({
  nodes,
  links,
  groups,
  currentFilter,
});

/*
// Simulation
{
	groups: [{
		"active": true,
		"background-color": "hsla(120, 50%, 50%, 0.1)",
		"center": [ 0, -0.5 ],
		"foreground-color": "hsla(120, 50%, 50%, 0.4)",
		"hull": `
		M 29.36739427831727 -9.310218283495182
		C 32.06128070550176,-0.3305968595468869,-26.673507851132783,17.289839707443477,-29.36739427831727,8.310218283495182
		S 26.673507851132783,-18.289839707443477,29.36739427831727,-9.310218283495182
		Z
		`,
		"id": "quality",
		"label": "Quality Concepts",
		"points": [
			[15, -5],
			[-15, 4]
		],
	}],
	nodes: [{
    "complete": true,
    "critical": true,
    "group": "quality",
    "groupCenter": Object {
      "x": 0,
      "y": -0.5,
    },
    "id": "Quality",
    "index": 0,
    "vx": 0.00048553240216897976,
    "vy": -0.00006794438663780661,
    "x": 15,
    "y": -5,
  }, {
    "complete": false,
    "critical": false,
    "group": "quality",
    "groupCenter": Object {
      "x": 0,
      "y": -0.5,
    },
    "id": "Naming",
    "index": 1,
    "vx": -0.00048553240216897976,
    "vy": 0.0002233750546635813,
    "x": -15,
    "y": 4,
  }])
*/

Scripts

  • npm run build
  • npm run lint
  • npm test, npm test:watch

Deployment

Set NPM_TOKEN on the secrets page. Generate NPM_TOKEN on the Sika npm account. Increment the version with npm version patch|minor|major and push to deploy.