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

pri-ng-scrollbar

v7.0.0

Published

Custom overlay scrollbars using native scrolling mechanism, for angular outside angular change detection. now also usable as web-component in all web applications

Downloads

85

Readme

| pri-ng-scrollbar version| angular version | |-------------------------|-----------------| | 7.x | >= 11.x | | 6.x | >= 11.x | | 5.x | 10.x | | 4.x | 9.x | | 3.x | 8.x | | 2.x | 7.x |

Custom scrollbar with native scrolling mechanism which runs outside of the angular change detection, which results in better performance. Fallback for mobile devices and browser which are not supporting custom scrollbars.


Table of Contents

Angular

Web-Component

** web-component support is dropped with version >= 7.x

More

Angular

Installation

NPM

npm install --save pri-ng-scrollbar @angular/cdk

Usage

Import PriScrollbarModule in your module

import { PriScrollbarModule } from 'pri-ng-scrollbar';

@NgModule({
  imports: [
    PriScrollbarModule
  ]
})

In your template

<pri-scrollbar>
  <!-- Content -->
</pri-scrollbar>

Options

Scrollbar component inputs

| Inputs | Type / Values | Default value | Description | |-----------------|---------------|---------------|--------------| | overflowX | 'auto', 'scroll', 'native-auto', 'native-scroll', 'hidden' | 'auto' | Horizontal scrollbar overflow | | overflowY | 'auto', 'scroll', 'native-auto', 'native-scroll', 'hidden' | 'auto' | Vertical scrollbar | | xPosition | 'top', 'bottom' | 'bottom' | Position of the horizontal scrollbar | | xPosition | 'left', 'right' | 'right' | Position of the vertical scrollbar | | marginsX | string (format: '0 0 0 0' or '0 0' or '0 0') | 4 4 | Margins to position for the horizontal scrollbar. (top right bottom left) or (top/bottom left/right) or (top/bottom/left/right) | | marginsY | string (format: '0 0 0 0' or '0 0' or '0 0') | 4 12 | Margins to position for the vertical scrollbar. (top right bottom left) or (top/bottom left/right) or (top/bottom/left/right) |

Auto fallback to native scrollbars for mobile devices, bec. its not possible to show / hide custom scrollbars.

pri-scrollbar size will auto resize (height) based on its content, until it reaches the max available height. !!! This will only work if "overflowX" is set to "hidden" !!!

Styling

If you want a padding on the pri-scrollbar content, you have to use the following css variable on your pri-scrollbar

pri-scrollbar {
  --padding: 10px;
}

styling / theming with scss is similar to angular material.

add to your style

@import '~pri-ng-scrollbar/theming';

$vertical-thumb-color: #444;
// (optional) if vertical-thumb-size set and horizontal-thumb-color is not set, horizontal-thumb size will be set to vertical-thumb-color
$horizontal-thumb-color: #444;
// (optional)
$vertical-thumb-size: 20px;
// if vertical-thumb-size set and horizontal-thumb-size is not set, horizontal-thumb size will be set to vertical-thumb-size
$horizontal-thumb-size: 20px;

//creates palette
$custom-scrollbar-palette: pri-scrollbar-palette($vertical-thumb-color, $horizontal-thumb-color, $vertical-thumb-size, $horizontal-thumb-size);

//now use your palette for the theme
@include pri-scrollbar-theme($custom-scrollbar-palette);



/********************* extended styling *************************/

/**  
 * will set color and size for both thumbs
 * $custom-scrollbar-palette: pri-scrollbar-palette($vertical-thumb-color, null, $vertical-thumb-size, null);
 * only sets color
 * $custom-scrollbar-palette: pri-scrollbar-palette($vertical-thumb-color);
 */


/**
 * if you want change the thumb style i.e. border radius, border, border color you can add 'map' as pri-scrollbar-theme as parameter
 * !!! The following part is optional !!! 
 */
 
// horizontal thumb style
$horizontal-thumb-style: (
  border-radius: 0,
  border: 1 px solid white
);
$vertical-thumb-style: (
  border-radius: 0,
  border: 1 px solid white
);

@include pri-scrollbar-theme($custom-theme-palette, $horizontal-thumb-style, $vertical-thumb-style);

Development

This project uses the Angular CLI for building the library

$ npm run build:lib
$ npm run start

or if you want to get live updates on lib source changes

Terminal 1:

$ npm run start:lib 

Terminal 2:

$ npm run start

Issues

If you identify any errors in the library, or have an idea for an improvement, please open an issue.

Planned

  • add experimental version for ivy projects
  • Rework the web-component creation when angular ivy is ready. Reduces bundle size.

Author

Credit

More Stuff