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

@pvotly/svelte

v0.1.1

Published

Svelte bindings for pvotly — a `use:pvotly` action that mounts the @pvotly/web widget.

Readme

@pvotly/svelte

Svelte bindings for pvotly. Ships a Svelte actionuse:pvotly — that mounts the @pvotly/web widget onto any element. The action is pure TypeScript, so it needs no Svelte compiler step and works with any Svelte 4+ project (and SvelteKit).

  • Version: 0.1.0
  • License: MIT

Installation

npm install @pvotly/svelte @pvotly/web @pvotly/core

svelte is an optional peer dependency (Svelte >=4).

Stylesheet

The action renders the bundled @pvotly/web widget, so import its stylesheet once in your app:

import '@pvotly/web/styles.css';

Without this import the table will render unstyled.

use:pvotly

Attach the action to a host element and pass the widget options. It creates a @pvotly/web PivotTable for the element's lifetime, applies updated options reactively, and tears the widget down on unmount.

<script lang="ts">
  import { pvotly, type PivotTableOptions } from '@pvotly/svelte';
  import '@pvotly/web/styles.css';

  const data = [
    { Country: 'USA', Category: 'Cars', Sales: 1200 },
    { Country: 'USA', Category: 'Bikes', Sales: 400 },
    { Country: 'Canada', Category: 'Cars', Sales: 900 },
  ];

  const options: PivotTableOptions = {
    dataSource: { data },
    slice: {
      rows: [{ uniqueName: 'Country' }],
      columns: [{ uniqueName: 'Category' }],
      measures: [{ uniqueName: 'Sales', aggregation: 'sum' }],
    },
    height: 500,
  };
</script>

<div use:pvotly={options} />

Reactive updates

Svelte calls the action's update hook whenever the passed options change. The action re-applies the configuration and, when present, the tokens, actionBar, and theme options:

<script lang="ts">
  import { pvotly, type PivotTableOptions } from '@pvotly/svelte';

  let theme: 'light' | 'dark' = 'light';
  $: options = {
    dataSource: { data },
    slice: { rows: [{ uniqueName: 'Country' }], measures: [{ uniqueName: 'Sales' }] },
    theme,
  } satisfies PivotTableOptions;
</script>

<button on:click={() => (theme = theme === 'light' ? 'dark' : 'light')}>Toggle theme</button>
<div use:pvotly={options} />

Imperative control

For full imperative access (export, print, the engine, etc.), construct a @pvotly/web PivotTable directly — @pvotly/svelte re-exports it:

<script lang="ts">
  import { PivotTable } from '@pvotly/svelte';
  import { onMount, onDestroy } from 'svelte';

  let host: HTMLDivElement;
  let pivot: PivotTable;

  onMount(() => {
    pivot = new PivotTable(host, {
      dataSource: { data },
      slice: { rows: [{ uniqueName: 'Country' }], measures: [{ uniqueName: 'Sales' }] },
    });
  });
  onDestroy(() => pivot?.destroy());
</script>

<button on:click={() => pivot.exportTo('csv', { filename: 'report' })}>Export CSV</button>
<div bind:this={host} />

Exports

import { pvotly, PivotTable, type PivotTableOptions } from '@pvotly/svelte';

The package also re-exports everything from @pvotly/web (which in turn re-exports @pvotly/core), so a single import covers the widget and engine types.

License

MIT