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

rylli-drawer-vertical

v1.0.0

Published

A vertical slide-out panel (toggle panel) for Ionic. Built by Gavin Bennett

Downloads

10

Readme

rylli-drawer-vertical

A vertical slide-out panel (toggle panel) for Ionic. Built by Gavin Bennett

Demo rylli-drawer-vertical

Danger, here be dragons

Do note that this is an early release of rylli-drawer-vertical. Whilst the basics work, a few things still need tweaking (the animation speed for example) or might change in the future.

Installation

You may clone this repo or get rylli-drawer-vertical via npm:

npm install rylli-drawer-vertical

Usage

Usage is simple: include the source files, inject the project as a dependency and add some markup [PEN]

  1. Refer to the ionic.contrib.drawer.vertical.js and ionic.contrib.drawer.vertical.css files from within your HTML file:

    <link href="src/ionic.contrib.drawer.vertical.css" rel="stylesheet">
    <script src="src/ionic.contrib.drawer.vertical.js"></script>
  2. Inject ionic.contrib.drawer.vertical as a dependency into your Angular app:

    angular.module('app', [
    	'ionic',
    	'ionic.contrib.drawer.vertical'
    ])
  3. Add a <rylli-drawer-vertical-wrapper> element to your document. Inside it, put a <rylli-drawer-vertical-content> and an optional <rylli-drawer-vertical-handle> element.

    <rylli-drawer-vertical-wrapper>
    	<rylli-drawer-vertical-content>
    		<img src="http://lorempixel.com/g/400/200/animals/4/horizontal-giraffe/" alt="Horizontal Giraffe" title="Horizontal Giraffe" />
    	</rylli-drawer-vertical-content>
    	<rylli-drawer-vertical-handle />
    </rylli-drawer-vertical-wrapper>

Configuration

Adjust the direction (possible values: down [default] and up) and state (possible values: opened [default] and closed) attributes of the <rylli-drawer-vertical-wrapper> element if needed. [PEN]

If any headers and/or footers are present, also set the proper has-* classes (such as has-header or has-footer) on the <rylli-drawer-vertical-wrapper> element. [PEN]

When having a scrollable element (viz. ion-scroll or ion-content[scroll="true"]) it's possible to make the drawer automagically close when scrolling the content in the direction of the drawer itself. Enable it by setting autoclose-on-scroll on the <rylli-drawer-vertical-wrapper> element. [PEN]

Adjust <rylli-drawer-vertical-wrapper> atributemargin(default is 0, it's capped at <rylli-drawer-vertical-wrapper> height), to show some part of the drawer content when closed.

(@note: the autoclose feature required some monkey patching of Ionic's scrollView behavior. Above that has not been tested (and won't work) with Ionic's scrollViewNative)

Events and Functions

rylli-drawer-vertical automatically binds drag events to the <rylli-drawer-vertical-handle> element if it's present. Dragging said element up/down will make the drawer follow its moves. Upon releasing the handle, the drawer will either revert to its original state, or to the opposite one (e.g. open will become closed) when having dragged far enough (over 33% of the height of the panel).

rylli-drawer-vertical also ships with a delegate $ionDrawerVerticalDelegate. The methods openDrawer(), closeDrawer(), toggleDrawer(), and getState() are exposed via this delegate. [PEN]

angular
.module('app', ['ionic.contrib.drawer.vertical', 'ionic'])
.controller('demo', function($scope, $ionDrawerVerticalDelegate) {

	$scope.toggleDrawer = function() {
		$ionDrawerVerticalDelegate.toggleDrawer();
	}

});
<body ng-app="app" ng-controller="demo">
	<ion-header-bar class="bar-positive">
		<h1 class="title">rylli-drawer-vertical</h1>
		<button class="button" ng-click="toggleDrawer()">Toggle Drawer</button>
	</ion-header-bar>
	<rylli-drawer-vertical-wrapper class="has-header" direction="down" state="closed">
		<rylli-drawer-vertical-content>[...]</rylli-drawer-vertical-content>
		<rylli-drawer-vertical-handle />
	</rylli-drawer-vertical-wrapper>
	<ion-content>
		[...]
	</ion-content>
</body>

When cleverly combining getState() with ngIf one make the button change text/icon. [PEN]

angular
.module('app', ['ionic.contrib.drawer.vertical', 'ionic'])
.controller('demo', function($scope, $ionDrawerVerticalDelegate) {

	$scope.toggleDrawer = function() {
		$ionDrawerVerticalDelegate.toggleDrawer();
	}

	$scope.drawerIs = function(state) {
		return $ionDrawerVerticalDelegate.getState() == state;
	}

});
<body ng-app="app" ng-controller="demo">
	<ion-header-bar class="bar-positive">
		<h1 class="title">rylli-drawer-vertical</h1>
		<button class="button" ng-click="toggleDrawer()">
			<i class="icon ion-ios-arrow-down" ng-show="drawerIs('opened')"></i>
			<i class="icon ion-ios-loop" ng-show="!drawerIs('opened') && !drawerIs('closed')"></i>
			<i class="icon ion-ios-arrow-up" ng-show="drawerIs('closed')"></i>
		</button>
	</ion-header-bar>
	...
</body>

Note that when calling methods on the delegate it will control all rylli-drawer-vertical instances. To target one single / a specific instance use the $getByHandle method along with the delegate-handle attribute. [PEN]

angular
.module('app', ['ionic.contrib.drawer.vertical', 'ionic'])
.controller('demo', function($scope, $ionDrawerVerticalDelegate) {

	$scope.toggleDrawer = function(handle) {
		$ionDrawerVerticalDelegate.$getByHandle(handle).toggleDrawer();
	}

});
<body ng-app="app" ng-controller="demo">
	<ion-header-bar class="bar-positive">
		<button class="button" ng-click="toggleDrawer('first')">Toggle First</button>
		<h1 class="title">rylli-drawer-vertical</h1>
		<button class="button" ng-click="toggleDrawer('second')">Toggle Second</button>
	</ion-header-bar>
	<rylli-drawer-vertical-wrapper class="has-header" direction="down" state="closed" delegate-handle="first">
		<rylli-drawer-vertical-content>[...]</rylli-drawer-vertical-content>
		<rylli-drawer-vertical-handle />
	</rylli-drawer-vertical-wrapper>
	<rylli-drawer-vertical-wrapper class="has-footer" direction="up" state="closed" delegate-handle="second">
		<rylli-drawer-vertical-content>[...]</rylli-drawer-vertical-content>
		<rylli-drawer-vertical-handle />
	</rylli-drawer-vertical-wrapper>
	<ion-content>
		[...]
	</ion-content>
	<ion-footer-bar class="bar-positive">
	</ion-footer-bar>
</body>

Callbacks / Promises

The methods closeDrawer(), openDrawer(), and toggleDrawer() all return a promise (provided by Angular's $q) allowing you to have callbacks

$scope.toggleDrawer = function() {
	$ionDrawerVerticalDelegate.toggleDrawer().then(function() {
		$ionDrawerVerticalDelegate.toggleDrawer().then(function() {
			$ionicPopup.alert({
				title: 'Done',
				template: 'Done sliding up and down'
			});
		});
	});
}

Acknowledgements

ionic-contrib-drawer has been a source of inspiration / a starting point for rylli-drawer-vertical.

License

rylli-drawer-vertical is released under the MIT public license. See the enclosed LICENSE for details.