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

ionic-shrinkage

v0.0.1

Published

Directive for headers in Ionic 2 which causes them to shrink/hide when scrolling up, and reveal when scrolling down.

Downloads

3

Readme

ionic-shrinkage

ionic-shrinkage is a directive for Ionic 2 to cause headers to shrink & reveal, in parallactic fashion, based on user scrolling.

I was in the pool

Installation

npm install ionic-shrinkage --save

Usage Example

home.ts

import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
import { Shrinkage } from 'ionic-shrinkage';

@Component({
  templateUrl: 'build/pages/home/home.html',
  directives: [ Shrinkage ]
})
export class HomePage {
  // We bind content to the shrinkage attribute in the HTML template
  @ViewChild(Content) content: Content;

  // Necessary for the change() method below
  @ViewChild(Shrinkage) shrinkage;

  constructor() {}

  // If you use Structural Directives to add or remove items in the header,
  // you'll have to call resize() on both content and the shrinkage directive.
  change(e) {
    this.content.resize();
    this.shrinkage.resize();
  }
}

home.html

<ion-header [shrinkage]="content">

  <ion-navbar>
    <ion-title>I was in the pool!</ion-title>
  </ion-navbar>

  <!--Structural Directives need to be accounted for with the resize() method --> 
  <ion-toolbar no-border-top *ngIf="showSearch">
    <ion-searchbar></ion-searchbar>
  </ion-toolbar>

</ion-header>


<!--Note the fullscreen attribute-->
<ion-content class="home" fullscreen>

  <!--Enough content to scroll-->

  <ion-item>
    <ion-label>Search</ion-label>
    <!--change() will resize the content and header via the directive-->
    <ion-toggle [(ngModel)]="showSearch" (ionChange)="change()"></ion-toggle>
  </ion-item>

</ion-content>

Requirements & Notes

  • WKWebView - With UIWebView, scroll events don't continue firing after your finger has left the screen, and while scroll momentum is still in effect. This works in WKWebView.
  • Crosswalk - I looked at Android without Crosswalk for about 2 minutes and doubt I'll spent more that that.
  • Windows? - I don't know and haven't tested it at all.

TODO

  1. ~~Resize method.~~
  2. Improve performance or provide fallback animation / cancellation for older devices.
    • Shrinkage works like butter on an iPhone 6s, but is janky on iPhone 5 and Galaxy S3 (with Crosswalk). Though both of those devices are from 2012, and possibly not worth fussing about.
    • Perfomance advice and device testing are welcome.
  3. Hide footers & tabs.
  4. Consider independently hiding toolbars within a header.

Author

Patrick McDonald (Github / Twitter)

Licence

This project is licensed under the ISC license. See the LICENSE file for more info.