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

simple-svelte-slideshow

v1.0.0

Published

A simple svelte slideshow component, which uses the tweened store from "svelte/motion"

Downloads

3

Readme

Simple Svelte Slideshow

Demo page.

As the name suggests, it is a simple svelte slideshow. It uses the tweened store from "svelte/motion"

Get started

First install the slideshow

npm install simple-svelte-slideshow

Then on the top of your file you wish to use it add the following import statement

import SliderGalery from "simple-svelte-slideshow";

Finaly add the following component into you markup

<SliderGalery {imgArray} />

Options

The only required prop is imgArray which is an array of objects. The objects should have two properties:

  • The src property which holds the image source/path
  • And a text property which holds the image description (see example below)
// These are images in the public folder
let terre = "images/img_5terre_wide.jpg";
let lights = "images/img_lights_wide.jpg";
let mountains = "images/img_mountains_wide.jpg";
let nature = "images/img_nature_wide.jpg";
let snow = "images/img_snow_wide.jpg";
let woods = "images/img_woods_wide.jpg";
// imgArray is the name of the property
let imgArray = [
  { src: terre, text: "Cinque Terre" },
  { src: lights, text: "Northen Lights" },
  { src: mountains, text: "Mountains and fjords" },
  { src: nature, text: "Nature and sunrise" },
  { src: woods, text: "The Woods" },
  { src: snow, text: "Snowy Mountains" }
];

Now the imgArray should be passed as a prop into the component

<SliderGalery {imgArray} />

And you are good to go.

There are three more optional properties:

  1. delay
  2. duration
  3. easingMethod

delay is set to zero by default. The duration of the animations defaults to 1.5 seconds. For the easingMethod you can choose between five values:

  • sineInOut

  • cubicInOut,

  • expoInOut,

  • backInOut,

  • elasticInOut

    For more information about these methods visit the following link

    Here is another example:

<script>
  import SliderGalery from "simple-svelte-slideshow";

  // These are in the public folder
  let terre = "images/img_5terre_wide.jpg";
  let lights = "images/img_lights_wide.jpg";
  let mountains = "images/img_mountains_wide.jpg";
  let nature = "images/img_nature_wide.jpg";
  let snow = "images/img_snow_wide.jpg";
  let woods = "images/img_woods_wide.jpg";
  let imgArray = [
    { src: terre, text: "Cinque Terre" },
    { src: lights, text: "Northen Lights" },
    { src: mountains, text: "Mountains and fjords" },
    { src: nature, text: "Nature and sunrise" },
    { src: woods, text: "The Woods" },
    { src: snow, text: "Snowy Mountains" }
  ];
  const easingMethod = "backInOut";
  const duration = 2000;
</script>

<main>
	<SliderGalery {imgArray} {duration} {easingMethod}/>
</main>

Happy coding...