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

sv-drawesome

v0.1.1

Published

A drawing toolbar for Svelte 5.

Readme

Svelte Drawesome

Svelte Drawesome

Svelte Drawesome is a drawing toolbar for Svelte 5. Seven pens, an eraser, undo and redo, plus SVG and PNG export.

Installation

pnpm add sv-drawesome

Quick start

Draw fills its parent, so give the parent an explicit height.

<script lang="ts">
	import { Draw } from 'sv-drawesome';
</script>

<div class="canvas">
	<Draw />
</div>

<style>
	.canvas {
		height: min(42rem, 80vh);
	}
</style>

Features

  • Pencil, pen, fineliner, marker, highlighter, brush, and fountain pen
  • Mouse, touch, and stylus input with pressure support
  • Erasing, undo, redo, and clear controls
  • SVG and high-resolution PNG export
  • Light, dark, and system themes
  • Configurable tools, colors, controls, and toolbar placement
  • Keyboard shortcuts and tooltips

Usage

Configure the toolbar

Pick the tools and colors you need. The toolbar can sit on any supported edge or be dragged into place.

<script lang="ts">
	import { Draw, type DrawControls, type PenId } from 'sv-drawesome';

	const tools: PenId[] = ['pencil', 'pen', 'marker', 'brush'];
	const controls: DrawControls = {
		custom: false,
		opacity: false
	};
	const swatches = ['#111111', '#e63946', '#457b9d', '#2a9d8f'];
</script>

<div class="canvas">
	<Draw
		background="checker"
		placement="left"
		theme="auto"
		{tools}
		{controls}
		{swatches}
		settings="tool"
		depth="soft"
		draggable
		gauge
	/>
</div>

<style>
	.canvas {
		height: 36rem;
		border-radius: 1rem;
	}
</style>

Track and restore strokes

onChange receives the full stroke list. Pass saved strokes to initialStrokes when the component is created.

<script lang="ts">
	import { Draw, type Stroke } from 'sv-drawesome';

	let strokes = $state<Stroke[]>([]);

	function updateStrokes(updatedStrokes: Stroke[]) {
		strokes = updatedStrokes;
	}
</script>

<div class="canvas">
	<Draw initialStrokes={strokes} onChange={updateStrokes} />
</div>

<p>{strokes.length} strokes</p>

<style>
	.canvas {
		height: 36rem;
	}
</style>

Export a drawing

Bind the component to call its export methods. PNG scale defaults to 2.

<script lang="ts">
	import { Draw, type DrawHandle } from 'sv-drawesome';

	let drawing: DrawHandle;

	async function downloadSvg() {
		await drawing.download('sketch', 'svg');
	}

	async function downloadPng() {
		await drawing.download('sketch', 'png', 2);
	}
</script>

<div class="canvas">
	<Draw bind:this={drawing} />
</div>

<div class="actions">
	<button onclick={downloadSvg}>Download SVG</button>
	<button onclick={downloadPng}>Download PNG</button>
</div>

<style>
	.canvas {
		height: 36rem;
	}

	.actions {
		display: flex;
		gap: 0.5rem;
		margin-top: 1rem;
	}
</style>

Common props

| Prop | Type | Default | Purpose | | ------------------- | ------------------------------------------- | ---------------- | ------------------------------------------------------------------------------ | | background | string | '#ffffff' | A CSS color, 'transparent', or 'checker' | | board | { w: number; h: number } | container size | Fixes the drawing coordinate space | | initialStrokes | Stroke[] | [] | Seeds the drawing when the component is created | | onChange | (strokes: Stroke[]) => void | - | Runs when the stroke list changes | | tools | PenId[] | all seven pens | Chooses and orders the available pens | | eraser | boolean | true | Shows or hides the eraser | | controls | DrawControls | all enabled | Toggles color, size, opacity, undo, clear, custom color, and minimize controls | | placement | 'bottom' \| 'left' \| 'right' | 'bottom' | Places the toolbar on an edge | | align | 'start' \| 'center' \| 'end' | 'center' | Aligns the toolbar along that edge | | theme | 'light' \| 'dark' \| 'auto' | 'light' | Sets the toolbar theme | | look | 'classic' \| 'studio' | 'classic' | Chooses the tool icon style | | settings | 'bar' \| 'tool' | 'bar' | Places brush settings in the bar or beside each tool | | swatches | string[] | built-in palette | Replaces the color palette | | ink | 'shared' \| 'per-tool' \| 'auto' | 'auto' | Controls whether pens share a color | | draggable | boolean | false | Lets the user reposition the toolbar | | gauge | boolean | false | Shows the current brush size on tool icons | | startMinimized | boolean | false | Starts with the toolbar collapsed | | drawWhenMinimized | boolean | false | Keeps the surface active while the toolbar is collapsed | | shortcuts | boolean | true | Enables keyboard shortcuts | | tooltips | boolean \| TooltipOptions | true | Configures or disables tooltips | | motion | 'rise' \| 'none' \| MotionOptions | 'rise' | Configures the toolbar entrance and exit | | depth | 'flat' \| 'soft' \| 'regular' \| 'strong' | 'regular' | Sets the toolbar shadow depth | | class | string | - | Adds a class to the root element | | style | string | - | Adds inline styles to the root element |

All public prop and stroke types are exported from sv-drawesome.

Component methods

| Method | Result | | ---------------------------------- | ----------------------------------------- | | toSvg() | Returns the drawing as an SVG string | | toPng(scale?) | Returns a PNG Blob | | download(name?, format?, scale?) | Downloads an SVG or PNG file | | getStrokes() | Returns the current strokes | | setStrokes(strokes) | Replaces the current strokes | | undo() / redo() | Moves through drawing history | | clear() | Removes every stroke | | getSize() | Returns the current { w, h } board size |

Keyboard shortcuts

Shortcuts work while the page body or drawing area has focus.

| Key | Action | | ---------------------------------------- | ------------------------------- | | C | Pencil | | P | Pen | | F | Fineliner | | M | Marker | | H | Highlighter | | B | Brush | | G | Fountain pen | | E | Eraser | | [ / ] | Decrease or increase brush size | | Cmd/Ctrl + Z | Undo | | Cmd/Ctrl + Shift + Z or Cmd/Ctrl + Y | Redo |

Questions and bugs

Open an issue on GitHub.

Credits

Svelte Drawesome is an unofficial port of Benji Taylor's Drawesome. The original project and its design are documented at benji.org/drawesome.

Maintained by SikandarJODD.

License

MIT