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 🙏

© 2024 – Pkg Stats / Ryan Hefner

svelte-scrolly

v0.0.4

Published

A basic scrollytelling component for Svelte to facilitate narrative visualizations

Downloads

11

Readme

Svelte <Scrolly>

A simple Svelte <Scrolly> component to facilitate narrative visualizations (scrollytelling).

Originally created for this lab of MIT’s Interactive Visualization & Society course 2024, so that can also serve as a tutorial (see after Step 4).

Notes

  • There is an official Svelte package for this purpose: @sveltejs/svelte-scroller. However it assumes the two layers (narrative and visualization) are overlaid on top of each other, which is not always what we want.
  • This is meant to support visualizations that simply enhance the regular scroll behavior by using the scroll position to advance one or more visualizations. It assumes a structure where there is content that actually scrolls (the story) and content that sticks (the visualization). Scrollies where nothing is actually scrolling are out of scope for this component.

Installation

npm install svelte-scrolly

Usage

It’s used like this:

<Scrolly bind:progress={ myProgressVariable }>
	<!-- Story here -->
	<svelte:fragment slot="viz">
		<!-- Visualizations here -->
	</svelte:fragment>
</Scrolly>

This will create a scrollytelling narrative with the story on the left and the visualization(s) on the right. If you instead want the story on the right and the visualizations on the left, you can use --layout="viz story". You can also specify --scrolly-viz-width and/or --scrolly-story-width to any number of frs or any CSS length to change the proportion between the two. E.g. --scrolly-viz-width="2fr" will change the proportion of viz to story to 2:1 give the visualization more space.

<Scrolly bind:progress={raceProgress} --layout="viz story" --viz-width="2fr">

Customization

Props

| Prop | Description | Type | Default | |------|-------------|------|---------| | progress | The progress of the scrolly. | number (0 - 100) | 0 | | progressRaw | The progress of the scrolly, unclamped (i.e. can be negative or > 100). | number | 0 | | threshold | What % of the viewport does the scrolly need to reach for it to start? | number (0 - 1) | 0.5 | | margin | How much margin to add to the threshold (in pixels) | number (0 - 1) | 30 | | debounce | Whether to debounce updating the progress variable and optionally by how many milliseconds. If just specified with no value, it debounces by the browser’s framerate. | number | boolean | false | | throttle | Whether to throttle updating the progress variable and optionally by how many milliseconds | number | boolean | false |

CSS Properties

All CSS properties supported:

| Property | Description | Type | Default | |----------|-------------|------|---------| | --scrolly-layout | Layout of the scrolly. Requires style query support. | story-first | viz-first | overlap | story viz | | --scrolly-gap | Gap between the story and the visualization. Ignored when --layout: overlap. | <length> | 1em | | --scrolly-viz-width, --scrolly-story-width | Width of the visualization or the story respectively. Ignored when --layout: overlap. | <length> | 1fr | | --scrolly-viz-top | Offset of the visualization from the top of the viewport when stuck. | <length> | Same as margin prop |