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

@alexgyver/vector-canvas

v1.0.3

Published

Vector drawing canvas for export to Canvas, SVG and DXF

Readme

VectorCanvas

Виртуальный векторный канвас:

  • Вывод на Canvas
  • Экспорт в SVG
  • Экспорт в DXF

demo

Browser: import VectorCanvas from 'https://gyverlibs.github.io/VectorCanvas.js/VectorCanvas.min.js'

Node: npm i @alexgyver/vector-canvas

import VectorCanvas from '@alexgyver/vector-canvas';

const vc = new VectorCanvas(300, 200);

vc.setStyle({
    stroke: '#000',
    fill: '#ddd',
    lineWidth: 2,
    font: '16px Arial',
    textAlign: 'center',
    textBaseline: 'middle',
});

vc.rect(20, 20, 120, 80);
vc.fillCircle(80, 60, 16);
vc.arc(180, 60, 24, 0, Math.PI * 1.5);
vc.polyline([[20, 140], [80, 100], [140, 140]]);
vc.fillText('VectorCanvas', 220, 140);

vc.renderTo(canvas);

const pxPerMm = 1;
const svg = vc.toSVG(pxPerMm);
const dxf = vc.toDXF(pxPerMm);
// создать сцену width x height
new VectorCanvas(width, height);

// изменить размер сцены
setSize(width, height);

// полностью сбросить состояние и примитивы
reset();

// очистить только примитивы
clear();

// сохранить/восстановить стиль и слой
save();
restore();

// задать стиль рисования
setStyle({
    stroke, fill, lineWidth,
    font, textAlign, textBaseline,
    layer
});

// переключить слой, color - ACI цвет для DXF
layer(name, color = null);
// линия
line(x1, y1, x2, y2);

// окружность / залитый круг
circle(x, y, r, fill = false);
fillCircle(x, y, r);

// ломаная / замкнутый полигон
polyline(points, closed = false);
polygon(points);

// прямоугольник по позиции и размеру
rect(x, y, w, h, fill = false);
fillRect(x, y, w, h);

// дуга, углы в радианах
arc(x, y, r, a0, a1, ccw = false);

// текст
text(text, x, y, fill = false);
fillText(text, x, y);
// \n внутри text переносит строку
// нарисовать на canvas
renderTo(canvas);

// экспортировать в SVG
toSVG(pxPerMm);

// экспортировать в DXF R12
toDXF(pxPerMm);

pxPerMm - сколько пикселей сцены приходится на 1 мм в экспорте.

По умолчанию все примитивы идут в слой 0.

Текст в DXF может немного отличаться в разных viewer.