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

@web2paper/modeling-svelte

v0.0.2

Published

Svelte wrapper for web2paper core modeling utilities.

Readme

This Svelte library wraps Web2Paper core modeling utilities and integrate them with Svelte.

⚠️ Web2Paper and its ecosystem are under construction. Expect breaking change to API and bugs.

Usage

Data injection

The main interest of this library is to simplify the retrieval of data injected by Web2Paper when rendering a document. This done through the component <W2pDataProvider>, any component inside it will have access to data through the function getW2pData().

For browser preview, you can also provide the development data to load as a fallback.

schema.ts

// Imagine this is the real data schema used by your document model
export interface TestSchema {
    name: string
    age: number
}

Document.svelte

<script lang="ts">
    import {W2pDataProvider} from "@web2paper/modeling-svelte";
    import type {TestSchema} from "./schema.js";
    import Component from "./Component.svelte";

    // Provide dummy data to use during model development
    let developmentData: TestSchema = {
        name: "Bob",
        age: 42
    };

    // You can't access the data yet, you need to be in a child of W2pDataProvider
    // let data: TestSchema = getW2pData();
</script>

<W2pDataProvider {developmentData}>
    <Component/>
</W2pDataProvider>

Component.svelte

<script lang="ts">
    import type {TestSchema} from "./schema.js";
    import {getW2pData} from "@web2paper/modeling-svelte";

    // This is how you get the data to inject in your template
    let data: TestSchema = getW2pData();
</script>

<h1>Your name is {data.name}</h1>
<p>Your are {data.age} years old</p>

Common components

These components encapsulate common Web2Paper quirks, especially for basic types from @web2paper/modeling-schema.

<Image>

Inject an image with the type Image from @web2paper/modeling-schema passed with prop image. The underlying <img> element can be customized by passing class and style attributes.

<PageBreak>

Forces a page break.


<script lang="ts">
    import {type Image as ImageType} from "@web2paper/modeling-schema";
    import {Image} from "@web2paper/modeling-svelte";

    // Minimal image for testing
    // Found at https://gist.github.com/ondrek/7413434
    const image: ImageType = {
        mime: "image/png",
        base64: "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII"
    }
</script>

<!-- Passing classes allow you to use frameworks like TailwindCSS -->
<Image {image} class="object-contain h-20 aspect-square"/>