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-flatlist

v0.2.6

Published

A draggable, customizable, mobile-friendly menu that's easy to use for Svelte.

Downloads

27

Readme

Svelte FlatList

A mobile-friendly, simple, and customizable draggable menu.

Documentation / Demo site: https://svelte-flatlist.netlify.app/

Find me on NPM!

Demo

Demo/Docs REPL

Installation

npm install -D svelte-flatlist

Usage

Using Svelte FlatList is very simple. Below are some usage examples.

Each Block

See this in action at the Svelte REPL! Link

<script>
  import FlatList from 'svelte-flatlist';
  let visible;
  const items = [0,1,2,3,4,5];

  function handleClose(){
    visible = false;
  }
</script>

<button on:click={()=>(visible=true)}>
	Click me!
</button>

<FlatList on:close={handleClose} bind:visible>
  {#each items as item}
    <span>{item}</span>
  {/each}
</FlatList>

Customize the theme

See this in action at the Svelte REPL! Link

<script>
  import FlatList from 'svelte-flatlist';
  let visible;
  const items = [0,1,2,3,4,5];

  function handleClose(){
    visible = false;
  }
</script>

<button on:click={()=>(visible=true)}>
	Click me!
</button>

<FlatList style={{bgColor: '#424242', handle: {fgColor:'#f2f2f2', height: '2rem', bgColor: '#000000'}}} on:close={handleClose} bind:visible>
    <span>item 1</span>
    <span>item 2</span>
    <span>item 3</span>
    <span>item 4</span>
    <span>item 5</span>
</FlatList>

Manually list items

See this in action at the Svelte REPL! Link

<script>
  import FlatList from 'svelte-flatlist';

  let visible;
  function handleClose(){
    visible = false;
	}
</script>

<button on:click={()=>(visible=true)}>
	Click me!
</button>

<FlatList bind:visible on:close={handleClose}>
  <span>item 1</span>
  <span>item 2</span>
  <span>item 3</span>
  <span>item 4</span>
</FlatList>

Props

| Prop | Description | | -------- | --------------------------------------------------------------------------- | | visible | (REQUIRED) visibility state | | style | (See below for options) Customize the colors to fit your needs. | | zIndex | Same as CSS z-index (defaults to 9999) | | position | Position of the list on screen (defaults to 'center') | | duration | Duration of the opening & closing transition (defaults to 400) | | maxWidth | Maximum width of the list - must include a CSS unit (defaults to 640px) | | gap | Gap in between list items - must include a CSS unit (defaults to 0.8rem) | | overflow | Behavior for vertical overflow, same as CSS overflow-y (defaults to 'auto') |

Style Properties

Svelte-Flatlist allows you to modify the styles to fit your needs best using style prop.

Example:

<Flatlist
  style={{
    bgColor: "#424242",
    handle: {
      height: "3rem",
      bgColor: "#121212",
      fgColor: "#fefefe"
    }
  }}
>

style Type

The type of the style prop:

type ListStyle = {
  bgColor?: string;
  handle?: HandleStyle;
};

type HandleStyle = {
  bgColor?: string;
  fgColor?: string;
  height?: string;
};

More Info

| Style Props | Description | | ----------- | ---------------------------------------------------- | | bgColor | Base background color | | handle | (see below for options) Color options for the handle |

| Handle Properties | Description | | ----------------- | -------------------------- | | bgColor | Handle background color | | fgColor | Handle foreground color | | height | Handle height (ex: '5rem') |

Events

| Event | Description | | ----- | ------------------------------- | | close | Event fires when list is closed |

Events

| Event | Description | | ----- | ------------------------------- | | close | Event fires when list is closed |