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 🙏

© 2025 – Pkg Stats / Ryan Hefner

panera

v0.0.10

Published

A Svelte library for panning and zooming in SVG, Canvas and HTML.

Readme

panera

A Svelte library for panning and zooming in SVG, Canvas and HTML.

Install

pnpm add panera

Peer requirement: svelte ^4 || ^5

Example

<script>
	import { Panera, Svg } from 'panera';
	let width = 800,
		height = 300;

	let pan;
	function reset() {
		pan.reset();
	}
	function to() {
		pan.to({ x: 80, y: 40, width: 200, height: 120 }, { duration: 600 });
	}
</script>

<button on:click={reset}>Reset</button> <button on:click={to}>Zoom to rect</button>

<Panera bind:this={pan} {width} {height}>
	<Svg>
		<rect fill="tomato" x="80" y="40" width="200" height="120" />
	</Svg>
</Panera>

See more examples here

API

  • Provider: <Panera />
  • Layers: <Svg />, <Canvas />, <Html />
  • Control via bind:this: to(), reset(), interpolate(), getView(), getBox()

<Panera /> props

  • width?: number | null — container width in pixels (required for fits)
  • height?: number | null - container height in pixels (required for fits)
  • duration?: number — default 1000 ms (used by to() & reset())
  • easing?: (t:number)=>number — default cubicInOut
  • bound?: boolean — clamp view inside container (default true)
  • debugBox?: boolean — overlay a non-scaling red debug rect (default false)
  • debugZoom?: boolean — disable zooming, helpful in conjuction with debugBox (default false)

Methods (via bind:this)

  • reset(opts?) opts = { duration?: number, easing?: (t)=>number, debugBox?, debugZoom? } Reset the view back to k=1, x=0, y=0.

  • to(rect, opts?) rect = {x, y, width, height} opts = { duration?, easing?, bound?, debugBox?, debugZoom? } Tweens to the fitted view of the rectangle.

  • interpolate(a, b, opts?) a = { x, y, width, height }, b = { x, y, width, height } opts = { t?: number, easing?: (t)=>number, bound?, debugBox?, debugZoom? } Instant scrub (no tween). Fits both a and b, then blends view using t (after easing).

  • getView(): Readable<{ k:number, x:number, y:number }> A Svelte store reflecting the current view.

  • getBox(): Readable<{ x:number, y:number, width:number, height: number }> A Svelte store reflecting the current bounding box.

Layers

  • <Svg> Renders a <svg> with viewBox and a <g> that applies: transform="scale(k) translate(x, y)". Debug rect uses vector-effect="non-scaling-stroke".

  • <Canvas> DPR-aware canvas; applies scale(k) then translate(x, y). Prop: render(ctx, {k, x, y}, {width, height, dpr}) => void

  • <Html> Absolutely-positioned HTML that follows the same transform via CSS: transform: scale(k) translate(xpx, ypx); transform-origin: 0 0; Place children with position:absolute; left/top in object coordinates.

Development

pnpm format       # prettier
pnpm lint         # prettier check + eslint
pnpm test         # vitest unit tests
pnpm prepack      # build library to dist/ (svelte-package + publint)
pnpm storybook    # run the local storybook page
pnpm pack         # output a tarball

License

MIT