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

vue-magic-scroller

v0.0.4

Published

A `Vue 3` + `Typescript` + `VueUse` virtual scroller for dynamic/fixed height items with no styles attached.

Downloads

4

Readme

Vue Magic Scroller

A Vue 3 + Typescript + VueUse virtual scroller for dynamic/fixed height items with no styles attached.

When to use this?

  • your app renders huge lists of elements;
  • you want to improve your app's performances;
  • you feel like trying to build your own virtual scroller component was a painful experience;
  • you feel like you spent too much time searching for an Vue 3 + Typescript unstyled virtual scroller library;

How to use it

  1. Run yarn add vue-magic-scroller;
  2. Import the component and use it in your Vue 3 project like this: import MagicScroller from 'vue-magic-scroller';
  3. Use the default slot to render your item;
<template>
    <div>
        <MagicScroller ref="scrollerEl" :items="items" :item-gap="10">
            <template #item="{item, index, position}">
                <div>
                    {{ index }}: {{ item.id }} - {{ position }}
                </div>
            </template>
        </MagicScroller>
    </div>
<template>

Props

  • items: T[] Array of items to be rendered;
  • item-gap: number Number of pixels between each item;

Slots

  • default: Template for list's items;

Emits

  • scrollStart: Triggered when scroll position starts being updated;
  • scrollEnd: Triggered when scroll position is finished being updated;

Exposed computed refs & methods

  • y: ComputedRef<number> scroll position;
  • virtualContainerHeight: ComputedRef<number> height of the virtual container;
  • startIndex: ComputedRef<number> index of the first virtual item;
  • endIndex: ComputedRef<number> index of the last virtual item;
  • firstVisibleIndex: ComputedRef<number> index of the first visible item;
  • lastVisibleIndex: ComputedRef<number> index of the last visible item;
  • getItemPosition: (index: number) => number | undefined: Method to get the position of an item;
  • getItemHeight: (index: number) => number | undefined: Method to get the height of an item;
  • scrollToIndex: (index: number) => void: Method to scroll to a specific item;
  • scrollToTop: () => void: Method to scroll to the top of the list;
  • scrollToBottom: () => void: Method to scroll to the bottom of the list;