├── .gitignore ├── README.md ├── app ├── app.ts ├── pages │ ├── body-content-transition.ts │ ├── body-content.ts │ ├── content-one.ts │ ├── content-three.ts │ ├── content-two.ts │ ├── landing.ts │ └── paging-component.ts ├── theme │ ├── app.core.scss │ ├── app.ios.scss │ ├── app.md.scss │ ├── app.variables.scss │ └── app.wp.scss └── utils │ └── constants.ts ├── config.xml ├── gulpfile.js ├── hooks ├── README.md └── after_prepare │ └── 010_add_platform_class.js ├── ionic.config.json ├── package.json ├── resources ├── android │ ├── icon │ │ ├── drawable-hdpi-icon.png │ │ ├── drawable-ldpi-icon.png │ │ ├── drawable-mdpi-icon.png │ │ ├── drawable-xhdpi-icon.png │ │ ├── drawable-xxhdpi-icon.png │ │ └── drawable-xxxhdpi-icon.png │ └── splash │ │ ├── drawable-land-hdpi-screen.png │ │ ├── drawable-land-ldpi-screen.png │ │ ├── drawable-land-mdpi-screen.png │ │ ├── drawable-land-xhdpi-screen.png │ │ ├── drawable-land-xxhdpi-screen.png │ │ ├── drawable-land-xxxhdpi-screen.png │ │ ├── drawable-port-hdpi-screen.png │ │ ├── drawable-port-ldpi-screen.png │ │ ├── drawable-port-mdpi-screen.png │ │ ├── drawable-port-xhdpi-screen.png │ │ ├── drawable-port-xxhdpi-screen.png │ │ └── drawable-port-xxxhdpi-screen.png ├── icon.png ├── ios │ ├── icon │ │ ├── icon-40.png │ │ ├── icon-40@2x.png │ │ ├── icon-50.png │ │ ├── icon-50@2x.png │ │ ├── icon-60.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-72.png │ │ ├── icon-72@2x.png │ │ ├── icon-76.png │ │ ├── icon-76@2x.png │ │ ├── icon-small.png │ │ ├── icon-small@2x.png │ │ ├── icon-small@3x.png │ │ ├── icon.png │ │ └── icon@2x.png │ └── splash │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape@2x~ipad.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait@2x~ipad.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default@2x~iphone.png │ │ └── Default~iphone.png └── splash.png ├── tsconfig.json ├── tslint.json ├── typings.json ├── typings ├── globals │ ├── es6-shim │ │ ├── index.d.ts │ │ └── typings.json │ ├── hammerjs │ │ ├── index.d.ts │ │ └── typings.json │ └── jasmine │ │ ├── index.d.ts │ │ └── typings.json └── index.d.ts └── www └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | www/build/ 3 | platforms/ 4 | plugins/ 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ionic Paging App 2 | An Ionic 2 app demonstrating the power of web animations. 3 | 4 | It demonstrates how to create powerful animations using Ionic 2's [Animation](https://github.com/driftyco/ionic/blob/2.0/src/animations/animation.ts) class. 5 | -------------------------------------------------------------------------------- /app/app.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | import {Platform, ionicBootstrap} from 'ionic-angular'; 3 | import {StatusBar} from 'ionic-native'; 4 | import {LandingPage} from './pages/landing'; 5 | 6 | import {TRANSITION_IN_KEY, TRANSITION_OUT_KEY} from './pages/body-content-transition'; 7 | 8 | @Component({ 9 | template: '' 10 | }) 11 | export class MyApp { 12 | rootPage: any = LandingPage; 13 | 14 | constructor(platform: Platform) { 15 | platform.ready().then(() => { 16 | // Okay, so the platform is ready and our plugins are available. 17 | // Here you can do any higher level native things you might need. 18 | StatusBar.styleDefault(); 19 | }); 20 | } 21 | } 22 | 23 | ionicBootstrap(MyApp, [], { 24 | bodyContentEnter: TRANSITION_IN_KEY, 25 | bodyContentLeave: TRANSITION_OUT_KEY, 26 | prodMode: true 27 | }); 28 | -------------------------------------------------------------------------------- /app/pages/body-content-transition.ts: -------------------------------------------------------------------------------- 1 | import {ElementRef} from '@angular/core'; 2 | import {Animation, Transition, TransitionOptions, ViewController} from 'ionic-angular'; 3 | 4 | import {ANIMATION_DURATION} from '../utils/constants'; 5 | 6 | export const TRANSITION_IN_KEY: string = 'bodyContentEnter'; 7 | export const TRANSITION_OUT_KEY: string = 'bodyContentExit'; 8 | 9 | export class BodyContentInTransition extends Transition { 10 | constructor(enteringView: ViewController, leavingView: ViewController, opts: TransitionOptions) { 11 | super(enteringView, leavingView, opts); 12 | 13 | // DOM READS 14 | let enteringElement = enteringView.pageRef().nativeElement; 15 | let enteringContent = enteringElement.querySelector('.content-container'); 16 | let enteringAnimation = new Animation(enteringContent); 17 | enteringAnimation.fromTo('translateY', `${150}px`, `${0}px`); 18 | enteringAnimation.fromTo('opacity', `0.0`, `1.0`); 19 | 20 | let exitingAnimation = null; 21 | if ( leavingView.pageRef() ) { 22 | let exitingElement = leavingView.pageRef().nativeElement; 23 | let exitingContent = exitingElement.querySelector('.content-container'); 24 | exitingAnimation = new Animation(exitingContent); 25 | exitingAnimation.fromTo('translateY', `${0}px`, `${-150}px`); 26 | exitingAnimation.fromTo('opacity', `1.0`, `0.0`); 27 | } 28 | 29 | this.element(enteringView.pageRef()).easing('ease').duration(ANIMATION_DURATION) 30 | .before.addClass('show-page') 31 | .add(enteringAnimation); 32 | 33 | if ( exitingAnimation ) { 34 | this.add(exitingAnimation); 35 | } 36 | if ( opts.ev && opts.ev.animation ) { 37 | this.add(opts.ev.animation); 38 | } 39 | } 40 | } 41 | export class BodyContentOutTransition extends Transition { 42 | constructor(enteringView: ViewController, leavingView: ViewController, opts: TransitionOptions) { 43 | super(enteringView, leavingView, opts); 44 | // DOM READS 45 | let enteringElement = enteringView.pageRef().nativeElement; 46 | let enteringContent = enteringElement.querySelector('.content-container'); 47 | let enteringAnimation = new Animation(enteringContent); 48 | enteringAnimation.fromTo('translateY', `${150}px`, `${0}px`); 49 | enteringAnimation.fromTo('opacity', `0.0`, `1.0`); 50 | 51 | let exitingAnimation = null; 52 | if ( leavingView.pageRef() ) { 53 | let exitingElement = leavingView.pageRef().nativeElement; 54 | let exitingContent = exitingElement.querySelector('.content-container'); 55 | exitingAnimation = new Animation(exitingContent); 56 | exitingAnimation.fromTo('translateY', `${0}px`, `${-150}px`); 57 | exitingAnimation.fromTo('opacity', `1.0`, `0.0`); 58 | } 59 | 60 | this.element(leavingView.pageRef()).easing('ease').duration(ANIMATION_DURATION) 61 | .before.addClass('show-page') 62 | .add(enteringAnimation); 63 | 64 | if ( exitingAnimation ) { 65 | this.add(exitingAnimation); 66 | } 67 | 68 | if ( opts.ev && opts.ev.animation ) { 69 | this.add(opts.ev.animation); 70 | } 71 | } 72 | } 73 | 74 | Transition.register(TRANSITION_IN_KEY, BodyContentInTransition); 75 | Transition.register(TRANSITION_OUT_KEY, BodyContentOutTransition); 76 | -------------------------------------------------------------------------------- /app/pages/body-content.ts: -------------------------------------------------------------------------------- 1 | import {Component, Input, ViewChild} from '@angular/core'; 2 | import {Animation, NavController} from 'ionic-angular'; 3 | 4 | import {PageOne} from './content-one'; 5 | import {PageTwo} from './content-two'; 6 | import {PageThree} from './content-three'; 7 | 8 | import {TRANSITION_IN_KEY, TRANSITION_OUT_KEY} from './body-content-transition'; 9 | 10 | @Component({ 11 | selector: `body-content`, 12 | template: ` 13 | 14 | ` 15 | }) 16 | export class BodyContent { 17 | 18 | @ViewChild('nav') navController: NavController; 19 | 20 | processTransition(previousIndex: number, selectedIndex: number, animation: Animation) { 21 | if ( previousIndex > selectedIndex ) { 22 | // it's a pop 23 | return this.navController.pop({ animation: TRANSITION_OUT_KEY, ev: { animation: animation } }); 24 | } else { 25 | // it's a push 26 | return this.navController.push(this.getPageForIndex(selectedIndex), {}, { animation: TRANSITION_IN_KEY, ev: { animation: animation } }); 27 | } 28 | } 29 | 30 | getPageForIndex(index: number) { 31 | if ( index === 0 ) { 32 | return PageOne; 33 | } else if ( index === 1 ) { 34 | return PageTwo; 35 | } else { 36 | return PageThree; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/pages/content-one.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | 3 | @Component({ 4 | template: ` 5 |
6 | 7 |

Framework

8 | Hands down the best way to build high performance, cross-platform apps that can run on any screen! 100% free and open-source forever. Available under the MIT license. 9 |
10 | ` 11 | }) 12 | export class PageOne { 13 | constructor() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/pages/content-three.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | 3 | @Component({ 4 | template: ` 5 |
6 | 7 |

Enterprise

8 |

The same framework you know and love, with direct access to the Ionic team, priority hotfixes, support SLAs and more!

9 |
10 | ` 11 | }) 12 | export class PageThree { 13 | 14 | constructor() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/pages/content-two.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | 3 | @Component({ 4 | template: ` 5 |
6 | 7 |

Cloud

8 |

The Ionic Cloud is a suite of backend services that make building, deploying and scaling apps easy! Free to get started!

9 |
10 | ` 11 | }) 12 | export class PageTwo { 13 | 14 | constructor() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/pages/landing.ts: -------------------------------------------------------------------------------- 1 | import {Component, ViewChild} from '@angular/core'; 2 | 3 | import {BodyContent} from './body-content'; 4 | import {AnimationReadyEvent, PagingComponent, PageObject} from './paging-component'; 5 | 6 | @Component({ 7 | directives: [BodyContent, PagingComponent], 8 | template: ` 9 | 14 | 15 | 16 | 17 | ` 18 | }) 19 | export class LandingPage { 20 | 21 | @ViewChild('bodyContent') bodyContent: BodyContent; 22 | private pages: PageObject[]; 23 | 24 | private activeIndex: number = 0; 25 | private nextIndex: number = 0; 26 | 27 | constructor() { 28 | } 29 | 30 | ionViewWillEnter() { 31 | let tempPages: PageObject[] = []; 32 | tempPages.push({iconName: 'ionic'}); 33 | tempPages.push({iconName: 'cloud-outline'}); 34 | tempPages.push({iconName: 'ionitron'}); 35 | this.pages = tempPages; 36 | this.pageChangeAnimationReady(); 37 | } 38 | 39 | swipeLeftToRight() { 40 | if ( this.nextIndex < this.pages.length - 1 ) { 41 | this.nextIndex++; 42 | } 43 | } 44 | 45 | swipeRightToLeft() { 46 | if ( this.nextIndex > 0 ) { 47 | this.nextIndex--; 48 | } 49 | } 50 | 51 | pageChangeAnimationReady(event: AnimationReadyEvent = { animation: null}) { 52 | this.bodyContent.processTransition(this.activeIndex, this.nextIndex, event.animation).then( () => { 53 | this.activeIndex = this.nextIndex; 54 | }); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/pages/paging-component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ElementRef, EventEmitter, Host, Input, NgZone, Output, QueryList, SimpleChange, ViewChild, ViewChildren } from '@angular/core'; 2 | import { Animation, Content, ViewController } from 'ionic-angular'; 3 | 4 | import { ANIMATION_DURATION } from '../utils/constants'; 5 | 6 | @Component({ 7 | selector: `paging-component`, 8 | template: ` 9 |
13 |
14 |
15 |
16 |
17 | 18 |
19 |
20 |
21 |
22 | ` 23 | }) 24 | export class PagingComponent { 25 | @Input() pages: PageObject[]; 26 | @Input() selectedIndex: number; 27 | 28 | @Output() animationReady: EventEmitter = new EventEmitter(); 29 | 30 | @ViewChild('zoomCircleRef', {read: ElementRef}) zoomCircleRef: ElementRef; 31 | @ViewChild('container', {read: ElementRef}) container: ElementRef; 32 | @ViewChildren('pagingCircleWrapperElements', {read: ElementRef}) queryList: QueryList; 33 | 34 | private parentElement: ElementRef; 35 | private previousIndex: number; 36 | private currentAmountShiftedInPx: number = 0; 37 | private initialized: boolean = false; 38 | private ignoreFirst: boolean = true; 39 | 40 | constructor(@Host() host: Content, private ngZone: NgZone, private viewController: ViewController) { 41 | this.parentElement = host.getElementRef(); 42 | 43 | viewController.didEnter.subscribe( () => { 44 | this.ignoreFirst = true; 45 | let callback = () => { 46 | this.ngZone.run( () => { 47 | this.initialized = true; 48 | }); 49 | }; 50 | this.selectedIndexChanged(this.selectedIndex, callback, false); 51 | }); 52 | } 53 | 54 | ngOnChanges(changes: {[propertyName: string]: SimpleChange}) { 55 | let self = this; 56 | let change = changes['selectedIndex']; 57 | if ( change ) { 58 | this.previousIndex = typeof change.previousValue === 'number' ? change.previousValue : -1; 59 | if ( this.initialized ) { 60 | let callback = () => { 61 | self.animationReady.emit(null); 62 | }; 63 | this.selectedIndexChanged(change.currentValue, null, true); 64 | } 65 | } 66 | } 67 | 68 | selectedIndexChanged(newIndex: number, callback: () => any, doAnimation: boolean = true) { 69 | let centerPoint = this.container.nativeElement.clientWidth / 2; 70 | let pagingCircleWrapperElements = this.queryList.toArray(); 71 | 72 | let selectedItemCenterPoint; 73 | if ( this.previousIndex === -1 ) { 74 | selectedItemCenterPoint = pagingCircleWrapperElements[newIndex].nativeElement.offsetLeft + (pagingCircleWrapperElements[newIndex].nativeElement.offsetWidth / 2 + SMALL_CIRCLE_DIAMETER / 2); 75 | } 76 | 77 | if ( this.previousIndex < newIndex ) { 78 | selectedItemCenterPoint = pagingCircleWrapperElements[newIndex].nativeElement.offsetLeft + (pagingCircleWrapperElements[newIndex].nativeElement.offsetWidth / 2); 79 | } else if ( this.previousIndex > newIndex ) { 80 | selectedItemCenterPoint = pagingCircleWrapperElements[newIndex].nativeElement.offsetLeft + (pagingCircleWrapperElements[newIndex].nativeElement.offsetWidth / 2); 81 | } 82 | 83 | 84 | let previousDistanceNeededToMove = this.currentAmountShiftedInPx; 85 | this.currentAmountShiftedInPx = centerPoint - selectedItemCenterPoint; 86 | 87 | let animation = new Animation(this.container.nativeElement); 88 | animation.fromTo('translateX', `${previousDistanceNeededToMove}px`, `${this.currentAmountShiftedInPx}px`); 89 | 90 | for ( let i = 0; i < pagingCircleWrapperElements.length; i++ ) { 91 | let pagingCircleWrapperRef = pagingCircleWrapperElements[i]; 92 | let childAnimation = this.buildChildAnimation(newIndex, i, pagingCircleWrapperRef, previousDistanceNeededToMove, this.currentAmountShiftedInPx); 93 | animation.add(childAnimation); 94 | 95 | if ( i === newIndex ) { 96 | if ( this.ignoreFirst ) { 97 | this.ignoreFirst = false; 98 | } else { 99 | let circleAnimation = new Animation(this.zoomCircleRef.nativeElement); 100 | let animationOriginY = pagingCircleWrapperElements[newIndex].nativeElement.offsetTop + SMALL_CIRCLE_DIAMETER / 2; 101 | 102 | let circleXOrigin = selectedItemCenterPoint - SMALL_CIRCLE_DIAMETER / 2; 103 | circleAnimation.fromTo('translateX', `${circleXOrigin + previousDistanceNeededToMove}px`, `${circleXOrigin + this.currentAmountShiftedInPx}px`); 104 | 105 | let scaleX = this.parentElement.nativeElement.clientWidth / this.zoomCircleRef.nativeElement.clientWidth; 106 | let scaleY = this.parentElement.nativeElement.clientHeight / this.zoomCircleRef.nativeElement.clientHeight; 107 | let scale = Math.max(scaleX, scaleY) * 2; 108 | scale = Math.ceil(scale); 109 | 110 | circleAnimation.fromTo('translateY', `${animationOriginY}px`, `${animationOriginY}px`); 111 | circleAnimation.fromTo('opacity', `0.9`, `1.0`); 112 | circleAnimation.fromTo('scale', `1.0`, `${scale}`, true); 113 | 114 | animation.add(circleAnimation); 115 | } 116 | } 117 | } 118 | 119 | if ( doAnimation ) { 120 | animation.duration(ANIMATION_DURATION); 121 | } 122 | 123 | if ( callback ) { 124 | animation.onFinish(callback); 125 | } 126 | 127 | if ( this.initialized ) { 128 | this.animationReady.emit({ animation: animation}); 129 | } else { 130 | animation.play(); 131 | } 132 | } 133 | 134 | buildChildAnimation(selectedIndex: number, currentIndex: number, pagingCircleWrapperRef: ElementRef, originalOffset: number, newOffset: number) { 135 | let animation = new Animation(pagingCircleWrapperRef.nativeElement); 136 | let circleElement = pagingCircleWrapperRef.nativeElement.children[0]; 137 | let innerCircleElement = circleElement.children[0]; 138 | let circleAnimation = new Animation(circleElement); 139 | let innerCircleAnimation = new Animation(innerCircleElement); 140 | if ( currentIndex === selectedIndex ) { 141 | innerCircleAnimation.fromTo('opacity', '0.0', '1.0'); 142 | circleAnimation.fromTo('scale', `0.5`, `1.0`); 143 | } else { 144 | if ( currentIndex === this.previousIndex ) { 145 | innerCircleAnimation.fromTo('opacity', '1.0', '0.0'); 146 | circleAnimation.fromTo('scale', `1.0`, `0.5`); 147 | } else { 148 | circleAnimation.fromTo('scale', `0.5`, `0.5`); 149 | } 150 | } 151 | animation.add(circleAnimation); 152 | animation.add(innerCircleAnimation); 153 | return animation; 154 | } 155 | } 156 | 157 | export interface PageObject { 158 | iconName?: string; 159 | } 160 | 161 | export interface AnimationReadyEvent { 162 | animation: Animation; 163 | } 164 | 165 | export const SMALL_CIRCLE_DIAMETER = 20; 166 | export const LARGE_CIRCLE_DIAMETER = 40; 167 | -------------------------------------------------------------------------------- /app/theme/app.core.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Shared Imports 5 | // -------------------------------------------------- 6 | // These are the imports which make up the design of this app. 7 | // By default each design mode includes these shared imports. 8 | // App Shared Sass variables belong in app.variables.scss. 9 | .white { 10 | color: #FFF; 11 | } 12 | 13 | .blue { 14 | background-color: #6691B5; 15 | } 16 | 17 | .blue-text { 18 | color: #6691B5; 19 | } 20 | 21 | .green { 22 | background-color: #64B2B5; 23 | } 24 | 25 | .green-text { 26 | color: #64B2B5; 27 | } 28 | 29 | .purple { 30 | background-color: #9B90BC; 31 | } 32 | 33 | .purple-text { 34 | color: #9B90BC; 35 | } 36 | 37 | .transparent-bg { 38 | background-color: transparent; 39 | } 40 | 41 | paging-component { 42 | display: block; 43 | height: 100px; 44 | } 45 | 46 | .paging-container { 47 | height: 100%; 48 | display: flex; 49 | align-items: center; 50 | justify-content: center; 51 | } 52 | 53 | .paging-circle-wrapper { 54 | padding: 0px 5px 0px 5px; 55 | display: inline-block; 56 | } 57 | 58 | .paging-circle { 59 | transform-origin: center; 60 | height: 40px; 61 | width: 40px; 62 | border-radius: 50%; 63 | border: 3px solid #FFF; 64 | } 65 | 66 | .inner-circle { 67 | border-radius: inherit; 68 | height: 100%; 69 | background-color: #FFF; 70 | opacity: 0.0; 71 | display: flex; 72 | align-items: center; 73 | justify-content: center; 74 | } 75 | 76 | .paging-icon { 77 | font-size: 30px; 78 | } 79 | 80 | body-content { 81 | position: relative; 82 | display: block; 83 | height: 80%; 84 | pointer-events: none; 85 | } 86 | 87 | .content-nav, .content-nav > ion-page{ 88 | display: flex; 89 | align-items: center; 90 | justify-content: center; 91 | } 92 | 93 | .content-nav > .nav-decor { 94 | display: none !important; 95 | } 96 | 97 | .content-container { 98 | max-width: 355px; 99 | } 100 | 101 | .content-icon { 102 | font-size: 200px; 103 | } 104 | 105 | .circle-animation-helper { 106 | position: absolute; 107 | top: 0px; 108 | left: 0px; 109 | height: 20px; 110 | width: 20px; 111 | border-radius: 50%; 112 | z-index: -1; 113 | opacity: 0.0; 114 | } 115 | -------------------------------------------------------------------------------- /app/theme/app.ios.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Shared Variables 5 | // -------------------------------------------------- 6 | // Shared Sass variables go in the app.variables.scss file 7 | @import "app.variables"; 8 | 9 | 10 | // App iOS Variables 11 | // -------------------------------------------------- 12 | // iOS only Sass variables can go here 13 | 14 | 15 | // Ionic iOS Sass 16 | // -------------------------------------------------- 17 | // Custom App variables must be declared before importing Ionic. 18 | // Ionic will use its default values when a custom variable isn't provided. 19 | @import "ionic.ios"; 20 | 21 | 22 | // App Shared Sass 23 | // -------------------------------------------------- 24 | // All Sass files that make up this app goes into the app.core.scss file. 25 | // For simpler CSS overrides, custom app CSS must come after Ionic's CSS. 26 | @import "app.core"; 27 | 28 | 29 | // App iOS Only Sass 30 | // -------------------------------------------------- 31 | // CSS that should only apply to the iOS app 32 | -------------------------------------------------------------------------------- /app/theme/app.md.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Shared Variables 5 | // -------------------------------------------------- 6 | // Shared Sass variables go in the app.variables.scss file 7 | @import "app.variables"; 8 | 9 | 10 | // App Material Design Variables 11 | // -------------------------------------------------- 12 | // Material Design only Sass variables can go here 13 | 14 | 15 | // Ionic Material Design Sass 16 | // -------------------------------------------------- 17 | // Custom App variables must be declared before importing Ionic. 18 | // Ionic will use its default values when a custom variable isn't provided. 19 | @import "ionic.md"; 20 | 21 | 22 | // App Shared Sass 23 | // -------------------------------------------------- 24 | // All Sass files that make up this app goes into the app.core.scss file. 25 | // For simpler CSS overrides, custom app CSS must come after Ionic's CSS. 26 | @import "app.core"; 27 | 28 | 29 | // App Material Design Only Sass 30 | // -------------------------------------------------- 31 | // CSS that should only apply to the Material Design app 32 | -------------------------------------------------------------------------------- /app/theme/app.variables.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | // Ionic Shared Functions 4 | // -------------------------------------------------- 5 | // Makes Ionic Sass functions available to your App 6 | 7 | @import "globals.core"; 8 | 9 | // App Shared Variables 10 | // -------------------------------------------------- 11 | // To customize the look and feel of this app, you can override 12 | // the Sass variables found in Ionic's source scss files. Setting 13 | // variables before Ionic's Sass will use these variables rather than 14 | // Ionic's default Sass variable values. App Shared Sass imports belong 15 | // in the app.core.scss file and not this file. Sass variables specific 16 | // to the mode belong in either the app.ios.scss or app.md.scss files. 17 | 18 | 19 | // App Shared Color Variables 20 | // -------------------------------------------------- 21 | // It's highly recommended to change the default colors 22 | // to match your app's branding. Ionic uses a Sass map of 23 | // colors so you can add, rename and remove colors as needed. 24 | // The "primary" color is the only required color in the map. 25 | // Both iOS and MD colors can be further customized if colors 26 | // are different per mode. 27 | 28 | $colors: ( 29 | primary: #387ef5, 30 | secondary: #32db64, 31 | danger: #f53d3d, 32 | light: #f4f4f4, 33 | dark: #222, 34 | favorite: #69BB7B 35 | ); 36 | -------------------------------------------------------------------------------- /app/theme/app.wp.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Shared Variables 5 | // -------------------------------------------------- 6 | // Shared Sass variables go in the app.variables.scss file 7 | @import "app.variables"; 8 | 9 | 10 | // App Windows Variables 11 | // -------------------------------------------------- 12 | // Windows only Sass variables can go here 13 | 14 | 15 | // Ionic Windows Sass 16 | // -------------------------------------------------- 17 | // Custom App variables must be declared before importing Ionic. 18 | // Ionic will use its default values when a custom variable isn't provided. 19 | @import "ionic.wp"; 20 | 21 | 22 | // App Shared Sass 23 | // -------------------------------------------------- 24 | // All Sass files that make up this app goes into the app.core.scss file. 25 | // For simpler CSS overrides, custom app CSS must come after Ionic's CSS. 26 | @import "app.core"; 27 | 28 | 29 | // App Windows Only Sass 30 | // -------------------------------------------------- 31 | // CSS that should only apply to the Windows app 32 | -------------------------------------------------------------------------------- /app/utils/constants.ts: -------------------------------------------------------------------------------- 1 | export const ANIMATION_DURATION = 500; 2 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pagination 4 | An Ionic Framework and Cordova project. 5 | Ionic Framework Team 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | gulpWatch = require('gulp-watch'), 3 | del = require('del'), 4 | runSequence = require('run-sequence'), 5 | argv = process.argv; 6 | 7 | 8 | /** 9 | * Ionic hooks 10 | * Add ':before' or ':after' to any Ionic project command name to run the specified 11 | * tasks before or after the command. 12 | */ 13 | gulp.task('serve:before', ['watch']); 14 | gulp.task('emulate:before', ['build']); 15 | gulp.task('deploy:before', ['build']); 16 | gulp.task('build:before', ['build']); 17 | 18 | // we want to 'watch' when livereloading 19 | var shouldWatch = argv.indexOf('-l') > -1 || argv.indexOf('--livereload') > -1; 20 | gulp.task('run:before', [shouldWatch ? 'watch' : 'build']); 21 | 22 | /** 23 | * Ionic Gulp tasks, for more information on each see 24 | * https://github.com/driftyco/ionic-gulp-tasks 25 | * 26 | * Using these will allow you to stay up to date if the default Ionic 2 build 27 | * changes, but you are of course welcome (and encouraged) to customize your 28 | * build however you see fit. 29 | */ 30 | var buildBrowserify = require('ionic-gulp-browserify-typescript'); 31 | var buildSass = require('ionic-gulp-sass-build'); 32 | var copyHTML = require('ionic-gulp-html-copy'); 33 | var copyFonts = require('ionic-gulp-fonts-copy'); 34 | var copyScripts = require('ionic-gulp-scripts-copy'); 35 | 36 | var isRelease = argv.indexOf('--release') > -1; 37 | 38 | gulp.task('watch', ['clean'], function(done){ 39 | runSequence( 40 | ['sass', 'html', 'fonts', 'scripts'], 41 | function(){ 42 | gulpWatch('app/**/*.scss', function(){ gulp.start('sass'); }); 43 | gulpWatch('app/**/*.html', function(){ gulp.start('html'); }); 44 | buildBrowserify({ watch: true }).on('end', done); 45 | } 46 | ); 47 | }); 48 | 49 | gulp.task('build', ['clean'], function(done){ 50 | runSequence( 51 | ['sass', 'html', 'fonts', 'scripts'], 52 | function(){ 53 | buildBrowserify({ 54 | minify: isRelease, 55 | browserifyOptions: { 56 | debug: !isRelease 57 | }, 58 | uglifyOptions: { 59 | mangle: false 60 | } 61 | }).on('end', done); 62 | } 63 | ); 64 | }); 65 | 66 | gulp.task('sass', buildSass); 67 | gulp.task('html', copyHTML); 68 | gulp.task('fonts', copyFonts); 69 | gulp.task('scripts', copyScripts); 70 | gulp.task('clean', function(){ 71 | return del('www/build'); 72 | }); 73 | 74 | gulp.task('tslint', function() { 75 | var tslint = require('gulp-tslint'); 76 | return gulp.src([ 77 | 'app/**/*.ts', 78 | '!app/**/*-spec.ts', 79 | ]).pipe(tslint()) 80 | .pipe(tslint.report('verbose')); 81 | }); 82 | -------------------------------------------------------------------------------- /hooks/README.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Hooks 22 | 23 | Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. Hook scripts could be defined by adding them to the special predefined folder (`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run serially in the following order: 24 | * Application hooks from `/hooks`; 25 | * Application hooks from `config.xml`; 26 | * Plugin hooks from `plugins/.../plugin.xml`. 27 | 28 | __Remember__: Make your scripts executable. 29 | 30 | __Note__: `.cordova/hooks` directory is also supported for backward compatibility, but we don't recommend using it as it is deprecated. 31 | 32 | ## Supported hook types 33 | The following hook types are supported: 34 | 35 | after_build/ 36 | after_compile/ 37 | after_docs/ 38 | after_emulate/ 39 | after_platform_add/ 40 | after_platform_rm/ 41 | after_platform_ls/ 42 | after_plugin_add/ 43 | after_plugin_ls/ 44 | after_plugin_rm/ 45 | after_plugin_search/ 46 | after_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed 47 | after_prepare/ 48 | after_run/ 49 | after_serve/ 50 | before_build/ 51 | before_compile/ 52 | before_docs/ 53 | before_emulate/ 54 | before_platform_add/ 55 | before_platform_rm/ 56 | before_platform_ls/ 57 | before_plugin_add/ 58 | before_plugin_ls/ 59 | before_plugin_rm/ 60 | before_plugin_search/ 61 | before_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed 62 | before_plugin_uninstall/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being uninstalled 63 | before_prepare/ 64 | before_run/ 65 | before_serve/ 66 | pre_package/ <-- Windows 8 and Windows Phone only. 67 | 68 | ## Ways to define hooks 69 | ### Via '/hooks' directory 70 | To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example: 71 | 72 | # script file will be automatically executed after each build 73 | hooks/after_build/after_build_custom_action.js 74 | 75 | 76 | ### Config.xml 77 | 78 | Hooks can be defined in project's `config.xml` using `` elements, for example: 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | ... 89 | 90 | 91 | 92 | 93 | 94 | 95 | ... 96 | 97 | 98 | ### Plugin hooks (plugin.xml) 99 | 100 | As a plugin developer you can define hook scripts using `` elements in a `plugin.xml` like that: 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | ... 109 | 110 | 111 | `before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled. 112 | 113 | ## Script Interface 114 | 115 | ### Javascript 116 | 117 | If you are writing hooks in Javascript you should use the following module definition: 118 | ```javascript 119 | module.exports = function(context) { 120 | ... 121 | } 122 | ``` 123 | 124 | You can make your scipts async using Q: 125 | ```javascript 126 | module.exports = function(context) { 127 | var Q = context.requireCordovaModule('q'); 128 | var deferral = new Q.defer(); 129 | 130 | setTimeout(function(){ 131 | console.log('hook.js>> end'); 132 | deferral.resolve(); 133 | }, 1000); 134 | 135 | return deferral.promise; 136 | } 137 | ``` 138 | 139 | `context` object contains hook type, executed script full path, hook options, command-line arguments passed to Cordova and top-level "cordova" object: 140 | ```json 141 | { 142 | "hook": "before_plugin_install", 143 | "scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js", 144 | "cmdLine": "The\\exact\\command\\cordova\\run\\with arguments", 145 | "opts": { 146 | "projectRoot":"C:\\path\\to\\the\\project", 147 | "cordova": { 148 | "platforms": ["wp8"], 149 | "plugins": ["com.plugin.withhooks"], 150 | "version": "0.21.7-dev" 151 | }, 152 | "plugin": { 153 | "id": "com.plugin.withhooks", 154 | "pluginInfo": { 155 | ... 156 | }, 157 | "platform": "wp8", 158 | "dir": "C:\\path\\to\\the\\project\\plugins\\com.plugin.withhooks" 159 | } 160 | }, 161 | "cordova": {...} 162 | } 163 | 164 | ``` 165 | `context.opts.plugin` object will only be passed to plugin hooks scripts. 166 | 167 | You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way: 168 | ```javascript 169 | var Q = context.requireCordovaModule('q'); 170 | ``` 171 | 172 | __Note__: new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only. 173 | For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below. 174 | 175 | ### Non-javascript 176 | 177 | Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: 178 | 179 | * CORDOVA_VERSION - The version of the Cordova-CLI. 180 | * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). 181 | * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) 182 | * CORDOVA_HOOK - Path to the hook that is being executed. 183 | * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) 184 | 185 | If a script returns a non-zero exit code, then the parent cordova command will be aborted. 186 | 187 | ## Writing hooks 188 | 189 | We highly recommend writing your hooks using Node.js so that they are 190 | cross-platform. Some good examples are shown here: 191 | 192 | [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) 193 | 194 | Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example: 195 | 196 | #!/usr/bin/env [name_of_interpreter_executable] 197 | -------------------------------------------------------------------------------- /hooks/after_prepare/010_add_platform_class.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Add Platform Class 4 | // v1.0 5 | // Automatically adds the platform class to the body tag 6 | // after the `prepare` command. By placing the platform CSS classes 7 | // directly in the HTML built for the platform, it speeds up 8 | // rendering the correct layout/style for the specific platform 9 | // instead of waiting for the JS to figure out the correct classes. 10 | 11 | var fs = require('fs'); 12 | var path = require('path'); 13 | 14 | var rootdir = process.argv[2]; 15 | 16 | function addPlatformBodyTag(indexPath, platform) { 17 | // add the platform class to the body tag 18 | try { 19 | var platformClass = 'platform-' + platform; 20 | var cordovaClass = 'platform-cordova platform-webview'; 21 | 22 | var html = fs.readFileSync(indexPath, 'utf8'); 23 | 24 | var bodyTag = findBodyTag(html); 25 | if(!bodyTag) return; // no opening body tag, something's wrong 26 | 27 | if(bodyTag.indexOf(platformClass) > -1) return; // already added 28 | 29 | var newBodyTag = bodyTag; 30 | 31 | var classAttr = findClassAttr(bodyTag); 32 | if(classAttr) { 33 | // body tag has existing class attribute, add the classname 34 | var endingQuote = classAttr.substring(classAttr.length-1); 35 | var newClassAttr = classAttr.substring(0, classAttr.length-1); 36 | newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote; 37 | newBodyTag = bodyTag.replace(classAttr, newClassAttr); 38 | 39 | } else { 40 | // add class attribute to the body tag 41 | newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">'); 42 | } 43 | 44 | html = html.replace(bodyTag, newBodyTag); 45 | 46 | fs.writeFileSync(indexPath, html, 'utf8'); 47 | 48 | process.stdout.write('add to body class: ' + platformClass + '\n'); 49 | } catch(e) { 50 | process.stdout.write(e); 51 | } 52 | } 53 | 54 | function findBodyTag(html) { 55 | // get the body tag 56 | try{ 57 | return html.match(/])(.*?)>/gi)[0]; 58 | }catch(e){} 59 | } 60 | 61 | function findClassAttr(bodyTag) { 62 | // get the body tag's class attribute 63 | try{ 64 | return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0]; 65 | }catch(e){} 66 | } 67 | 68 | if (rootdir) { 69 | 70 | // go through each of the platform directories that have been prepared 71 | var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); 72 | 73 | for(var x=0; x { 6 | done: boolean; 7 | value?: T; 8 | } 9 | 10 | interface IterableShim { 11 | /** 12 | * Shim for an ES6 iterable. Not intended for direct use by user code. 13 | */ 14 | "_es6-shim iterator_"(): Iterator; 15 | } 16 | 17 | interface Iterator { 18 | next(value?: any): IteratorResult; 19 | return?(value?: any): IteratorResult; 20 | throw?(e?: any): IteratorResult; 21 | } 22 | 23 | interface IterableIteratorShim extends IterableShim, Iterator { 24 | /** 25 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code. 26 | */ 27 | "_es6-shim iterator_"(): IterableIteratorShim; 28 | } 29 | 30 | interface StringConstructor { 31 | /** 32 | * Return the String value whose elements are, in order, the elements in the List elements. 33 | * If length is 0, the empty string is returned. 34 | */ 35 | fromCodePoint(...codePoints: number[]): string; 36 | 37 | /** 38 | * String.raw is intended for use as a tag function of a Tagged Template String. When called 39 | * as such the first argument will be a well formed template call site object and the rest 40 | * parameter will contain the substitution values. 41 | * @param template A well-formed template string call site representation. 42 | * @param substitutions A set of substitution values. 43 | */ 44 | raw(template: TemplateStringsArray, ...substitutions: any[]): string; 45 | } 46 | 47 | interface String { 48 | /** 49 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point 50 | * value of the UTF-16 encoded code point starting at the string element at position pos in 51 | * the String resulting from converting this object to a String. 52 | * If there is no element at that position, the result is undefined. 53 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. 54 | */ 55 | codePointAt(pos: number): number; 56 | 57 | /** 58 | * Returns true if searchString appears as a substring of the result of converting this 59 | * object to a String, at one or more positions that are 60 | * greater than or equal to position; otherwise, returns false. 61 | * @param searchString search string 62 | * @param position If position is undefined, 0 is assumed, so as to search all of the String. 63 | */ 64 | includes(searchString: string, position?: number): boolean; 65 | 66 | /** 67 | * Returns true if the sequence of elements of searchString converted to a String is the 68 | * same as the corresponding elements of this object (converted to a String) starting at 69 | * endPosition – length(this). Otherwise returns false. 70 | */ 71 | endsWith(searchString: string, endPosition?: number): boolean; 72 | 73 | /** 74 | * Returns a String value that is made from count copies appended together. If count is 0, 75 | * T is the empty String is returned. 76 | * @param count number of copies to append 77 | */ 78 | repeat(count: number): string; 79 | 80 | /** 81 | * Returns true if the sequence of elements of searchString converted to a String is the 82 | * same as the corresponding elements of this object (converted to a String) starting at 83 | * position. Otherwise returns false. 84 | */ 85 | startsWith(searchString: string, position?: number): boolean; 86 | 87 | /** 88 | * Returns an HTML anchor element and sets the name attribute to the text value 89 | * @param name 90 | */ 91 | anchor(name: string): string; 92 | 93 | /** Returns a HTML element */ 94 | big(): string; 95 | 96 | /** Returns a HTML element */ 97 | blink(): string; 98 | 99 | /** Returns a HTML element */ 100 | bold(): string; 101 | 102 | /** Returns a HTML element */ 103 | fixed(): string 104 | 105 | /** Returns a HTML element and sets the color attribute value */ 106 | fontcolor(color: string): string 107 | 108 | /** Returns a HTML element and sets the size attribute value */ 109 | fontsize(size: number): string; 110 | 111 | /** Returns a HTML element and sets the size attribute value */ 112 | fontsize(size: string): string; 113 | 114 | /** Returns an HTML element */ 115 | italics(): string; 116 | 117 | /** Returns an HTML element and sets the href attribute value */ 118 | link(url: string): string; 119 | 120 | /** Returns a HTML element */ 121 | small(): string; 122 | 123 | /** Returns a HTML element */ 124 | strike(): string; 125 | 126 | /** Returns a HTML element */ 127 | sub(): string; 128 | 129 | /** Returns a HTML element */ 130 | sup(): string; 131 | 132 | /** 133 | * Shim for an ES6 iterable. Not intended for direct use by user code. 134 | */ 135 | "_es6-shim iterator_"(): IterableIteratorShim; 136 | } 137 | 138 | interface ArrayConstructor { 139 | /** 140 | * Creates an array from an array-like object. 141 | * @param arrayLike An array-like object to convert to an array. 142 | * @param mapfn A mapping function to call on every element of the array. 143 | * @param thisArg Value of 'this' used to invoke the mapfn. 144 | */ 145 | from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 146 | 147 | /** 148 | * Creates an array from an iterable object. 149 | * @param iterable An iterable object to convert to an array. 150 | * @param mapfn A mapping function to call on every element of the array. 151 | * @param thisArg Value of 'this' used to invoke the mapfn. 152 | */ 153 | from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 154 | 155 | /** 156 | * Creates an array from an array-like object. 157 | * @param arrayLike An array-like object to convert to an array. 158 | */ 159 | from(arrayLike: ArrayLike): Array; 160 | 161 | /** 162 | * Creates an array from an iterable object. 163 | * @param iterable An iterable object to convert to an array. 164 | */ 165 | from(iterable: IterableShim): Array; 166 | 167 | /** 168 | * Returns a new array from a set of elements. 169 | * @param items A set of elements to include in the new array object. 170 | */ 171 | of(...items: T[]): Array; 172 | } 173 | 174 | interface Array { 175 | /** 176 | * Returns the value of the first element in the array where predicate is true, and undefined 177 | * otherwise. 178 | * @param predicate find calls predicate once for each element of the array, in ascending 179 | * order, until it finds one where predicate returns true. If such an element is found, find 180 | * immediately returns that element value. Otherwise, find returns undefined. 181 | * @param thisArg If provided, it will be used as the this value for each invocation of 182 | * predicate. If it is not provided, undefined is used instead. 183 | */ 184 | find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; 185 | 186 | /** 187 | * Returns the index of the first element in the array where predicate is true, and undefined 188 | * otherwise. 189 | * @param predicate find calls predicate once for each element of the array, in ascending 190 | * order, until it finds one where predicate returns true. If such an element is found, find 191 | * immediately returns that element value. Otherwise, find returns undefined. 192 | * @param thisArg If provided, it will be used as the this value for each invocation of 193 | * predicate. If it is not provided, undefined is used instead. 194 | */ 195 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number; 196 | 197 | /** 198 | * Returns the this object after filling the section identified by start and end with value 199 | * @param value value to fill array section with 200 | * @param start index to start filling the array at. If start is negative, it is treated as 201 | * length+start where length is the length of the array. 202 | * @param end index to stop filling the array at. If end is negative, it is treated as 203 | * length+end. 204 | */ 205 | fill(value: T, start?: number, end?: number): T[]; 206 | 207 | /** 208 | * Returns the this object after copying a section of the array identified by start and end 209 | * to the same array starting at position target 210 | * @param target If target is negative, it is treated as length+target where length is the 211 | * length of the array. 212 | * @param start If start is negative, it is treated as length+start. If end is negative, it 213 | * is treated as length+end. 214 | * @param end If not specified, length of the this object is used as its default value. 215 | */ 216 | copyWithin(target: number, start: number, end?: number): T[]; 217 | 218 | /** 219 | * Returns an array of key, value pairs for every entry in the array 220 | */ 221 | entries(): IterableIteratorShim<[number, T]>; 222 | 223 | /** 224 | * Returns an list of keys in the array 225 | */ 226 | keys(): IterableIteratorShim; 227 | 228 | /** 229 | * Returns an list of values in the array 230 | */ 231 | values(): IterableIteratorShim; 232 | 233 | /** 234 | * Shim for an ES6 iterable. Not intended for direct use by user code. 235 | */ 236 | "_es6-shim iterator_"(): IterableIteratorShim; 237 | } 238 | 239 | interface NumberConstructor { 240 | /** 241 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 242 | * that is representable as a Number value, which is approximately: 243 | * 2.2204460492503130808472633361816 x 10‍−‍16. 244 | */ 245 | EPSILON: number; 246 | 247 | /** 248 | * Returns true if passed value is finite. 249 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a 250 | * number. Only finite values of the type number, result in true. 251 | * @param number A numeric value. 252 | */ 253 | isFinite(number: number): boolean; 254 | 255 | /** 256 | * Returns true if the value passed is an integer, false otherwise. 257 | * @param number A numeric value. 258 | */ 259 | isInteger(number: number): boolean; 260 | 261 | /** 262 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a 263 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter 264 | * to a number. Only values of the type number, that are also NaN, result in true. 265 | * @param number A numeric value. 266 | */ 267 | isNaN(number: number): boolean; 268 | 269 | /** 270 | * Returns true if the value passed is a safe integer. 271 | * @param number A numeric value. 272 | */ 273 | isSafeInteger(number: number): boolean; 274 | 275 | /** 276 | * The value of the largest integer n such that n and n + 1 are both exactly representable as 277 | * a Number value. 278 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. 279 | */ 280 | MAX_SAFE_INTEGER: number; 281 | 282 | /** 283 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as 284 | * a Number value. 285 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). 286 | */ 287 | MIN_SAFE_INTEGER: number; 288 | 289 | /** 290 | * Converts a string to a floating-point number. 291 | * @param string A string that contains a floating-point number. 292 | */ 293 | parseFloat(string: string): number; 294 | 295 | /** 296 | * Converts A string to an integer. 297 | * @param s A string to convert into a number. 298 | * @param radix A value between 2 and 36 that specifies the base of the number in numString. 299 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. 300 | * All other strings are considered decimal. 301 | */ 302 | parseInt(string: string, radix?: number): number; 303 | } 304 | 305 | interface ObjectConstructor { 306 | /** 307 | * Copy the values of all of the enumerable own properties from one or more source objects to a 308 | * target object. Returns the target object. 309 | * @param target The target object to copy to. 310 | * @param sources One or more source objects to copy properties from. 311 | */ 312 | assign(target: any, ...sources: any[]): any; 313 | 314 | /** 315 | * Returns true if the values are the same value, false otherwise. 316 | * @param value1 The first value. 317 | * @param value2 The second value. 318 | */ 319 | is(value1: any, value2: any): boolean; 320 | 321 | /** 322 | * Sets the prototype of a specified object o to object proto or null. Returns the object o. 323 | * @param o The object to change its prototype. 324 | * @param proto The value of the new prototype or null. 325 | * @remarks Requires `__proto__` support. 326 | */ 327 | setPrototypeOf(o: any, proto: any): any; 328 | } 329 | 330 | interface RegExp { 331 | /** 332 | * Returns a string indicating the flags of the regular expression in question. This field is read-only. 333 | * The characters in this string are sequenced and concatenated in the following order: 334 | * 335 | * - "g" for global 336 | * - "i" for ignoreCase 337 | * - "m" for multiline 338 | * - "u" for unicode 339 | * - "y" for sticky 340 | * 341 | * If no flags are set, the value is the empty string. 342 | */ 343 | flags: string; 344 | } 345 | 346 | interface Math { 347 | /** 348 | * Returns the number of leading zero bits in the 32-bit binary representation of a number. 349 | * @param x A numeric expression. 350 | */ 351 | clz32(x: number): number; 352 | 353 | /** 354 | * Returns the result of 32-bit multiplication of two numbers. 355 | * @param x First number 356 | * @param y Second number 357 | */ 358 | imul(x: number, y: number): number; 359 | 360 | /** 361 | * Returns the sign of the x, indicating whether x is positive, negative or zero. 362 | * @param x The numeric expression to test 363 | */ 364 | sign(x: number): number; 365 | 366 | /** 367 | * Returns the base 10 logarithm of a number. 368 | * @param x A numeric expression. 369 | */ 370 | log10(x: number): number; 371 | 372 | /** 373 | * Returns the base 2 logarithm of a number. 374 | * @param x A numeric expression. 375 | */ 376 | log2(x: number): number; 377 | 378 | /** 379 | * Returns the natural logarithm of 1 + x. 380 | * @param x A numeric expression. 381 | */ 382 | log1p(x: number): number; 383 | 384 | /** 385 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of 386 | * the natural logarithms). 387 | * @param x A numeric expression. 388 | */ 389 | expm1(x: number): number; 390 | 391 | /** 392 | * Returns the hyperbolic cosine of a number. 393 | * @param x A numeric expression that contains an angle measured in radians. 394 | */ 395 | cosh(x: number): number; 396 | 397 | /** 398 | * Returns the hyperbolic sine of a number. 399 | * @param x A numeric expression that contains an angle measured in radians. 400 | */ 401 | sinh(x: number): number; 402 | 403 | /** 404 | * Returns the hyperbolic tangent of a number. 405 | * @param x A numeric expression that contains an angle measured in radians. 406 | */ 407 | tanh(x: number): number; 408 | 409 | /** 410 | * Returns the inverse hyperbolic cosine of a number. 411 | * @param x A numeric expression that contains an angle measured in radians. 412 | */ 413 | acosh(x: number): number; 414 | 415 | /** 416 | * Returns the inverse hyperbolic sine of a number. 417 | * @param x A numeric expression that contains an angle measured in radians. 418 | */ 419 | asinh(x: number): number; 420 | 421 | /** 422 | * Returns the inverse hyperbolic tangent of a number. 423 | * @param x A numeric expression that contains an angle measured in radians. 424 | */ 425 | atanh(x: number): number; 426 | 427 | /** 428 | * Returns the square root of the sum of squares of its arguments. 429 | * @param values Values to compute the square root for. 430 | * If no arguments are passed, the result is +0. 431 | * If there is only one argument, the result is the absolute value. 432 | * If any argument is +Infinity or -Infinity, the result is +Infinity. 433 | * If any argument is NaN, the result is NaN. 434 | * If all arguments are either +0 or −0, the result is +0. 435 | */ 436 | hypot(...values: number[]): number; 437 | 438 | /** 439 | * Returns the integral part of the a numeric expression, x, removing any fractional digits. 440 | * If x is already an integer, the result is x. 441 | * @param x A numeric expression. 442 | */ 443 | trunc(x: number): number; 444 | 445 | /** 446 | * Returns the nearest single precision float representation of a number. 447 | * @param x A numeric expression. 448 | */ 449 | fround(x: number): number; 450 | 451 | /** 452 | * Returns an implementation-dependent approximation to the cube root of number. 453 | * @param x A numeric expression. 454 | */ 455 | cbrt(x: number): number; 456 | } 457 | 458 | interface PromiseLike { 459 | /** 460 | * Attaches callbacks for the resolution and/or rejection of the Promise. 461 | * @param onfulfilled The callback to execute when the Promise is resolved. 462 | * @param onrejected The callback to execute when the Promise is rejected. 463 | * @returns A Promise for the completion of which ever callback is executed. 464 | */ 465 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; 466 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; 467 | } 468 | 469 | /** 470 | * Represents the completion of an asynchronous operation 471 | */ 472 | interface Promise { 473 | /** 474 | * Attaches callbacks for the resolution and/or rejection of the Promise. 475 | * @param onfulfilled The callback to execute when the Promise is resolved. 476 | * @param onrejected The callback to execute when the Promise is rejected. 477 | * @returns A Promise for the completion of which ever callback is executed. 478 | */ 479 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; 480 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; 481 | 482 | /** 483 | * Attaches a callback for only the rejection of the Promise. 484 | * @param onrejected The callback to execute when the Promise is rejected. 485 | * @returns A Promise for the completion of the callback. 486 | */ 487 | catch(onrejected?: (reason: any) => T | PromiseLike): Promise; 488 | catch(onrejected?: (reason: any) => void): Promise; 489 | } 490 | 491 | interface PromiseConstructor { 492 | /** 493 | * A reference to the prototype. 494 | */ 495 | prototype: Promise; 496 | 497 | /** 498 | * Creates a new Promise. 499 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: 500 | * a resolve callback used resolve the promise with a value or the result of another promise, 501 | * and a reject callback used to reject the promise with a provided reason or error. 502 | */ 503 | new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; 504 | 505 | /** 506 | * Creates a Promise that is resolved with an array of results when all of the provided Promises 507 | * resolve, or rejected when any Promise is rejected. 508 | * @param values An array of Promises. 509 | * @returns A new Promise. 510 | */ 511 | all(values: IterableShim>): Promise; 512 | 513 | /** 514 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved 515 | * or rejected. 516 | * @param values An array of Promises. 517 | * @returns A new Promise. 518 | */ 519 | race(values: IterableShim>): Promise; 520 | 521 | /** 522 | * Creates a new rejected promise for the provided reason. 523 | * @param reason The reason the promise was rejected. 524 | * @returns A new rejected Promise. 525 | */ 526 | reject(reason: any): Promise; 527 | 528 | /** 529 | * Creates a new rejected promise for the provided reason. 530 | * @param reason The reason the promise was rejected. 531 | * @returns A new rejected Promise. 532 | */ 533 | reject(reason: any): Promise; 534 | 535 | /** 536 | * Creates a new resolved promise for the provided value. 537 | * @param value A promise. 538 | * @returns A promise whose internal state matches the provided promise. 539 | */ 540 | resolve(value: T | PromiseLike): Promise; 541 | 542 | /** 543 | * Creates a new resolved promise . 544 | * @returns A resolved promise. 545 | */ 546 | resolve(): Promise; 547 | } 548 | 549 | declare var Promise: PromiseConstructor; 550 | 551 | interface Map { 552 | clear(): void; 553 | delete(key: K): boolean; 554 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; 555 | get(key: K): V; 556 | has(key: K): boolean; 557 | set(key: K, value?: V): Map; 558 | size: number; 559 | entries(): IterableIteratorShim<[K, V]>; 560 | keys(): IterableIteratorShim; 561 | values(): IterableIteratorShim; 562 | } 563 | 564 | interface MapConstructor { 565 | new (): Map; 566 | new (iterable: IterableShim<[K, V]>): Map; 567 | prototype: Map; 568 | } 569 | 570 | declare var Map: MapConstructor; 571 | 572 | interface Set { 573 | add(value: T): Set; 574 | clear(): void; 575 | delete(value: T): boolean; 576 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; 577 | has(value: T): boolean; 578 | size: number; 579 | entries(): IterableIteratorShim<[T, T]>; 580 | keys(): IterableIteratorShim; 581 | values(): IterableIteratorShim; 582 | '_es6-shim iterator_'(): IterableIteratorShim; 583 | } 584 | 585 | interface SetConstructor { 586 | new (): Set; 587 | new (iterable: IterableShim): Set; 588 | prototype: Set; 589 | } 590 | 591 | declare var Set: SetConstructor; 592 | 593 | interface WeakMap { 594 | delete(key: K): boolean; 595 | get(key: K): V; 596 | has(key: K): boolean; 597 | set(key: K, value?: V): WeakMap; 598 | } 599 | 600 | interface WeakMapConstructor { 601 | new (): WeakMap; 602 | new (iterable: IterableShim<[K, V]>): WeakMap; 603 | prototype: WeakMap; 604 | } 605 | 606 | declare var WeakMap: WeakMapConstructor; 607 | 608 | interface WeakSet { 609 | add(value: T): WeakSet; 610 | delete(value: T): boolean; 611 | has(value: T): boolean; 612 | } 613 | 614 | interface WeakSetConstructor { 615 | new (): WeakSet; 616 | new (iterable: IterableShim): WeakSet; 617 | prototype: WeakSet; 618 | } 619 | 620 | declare var WeakSet: WeakSetConstructor; 621 | 622 | declare namespace Reflect { 623 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 624 | function construct(target: Function, argumentsList: ArrayLike): any; 625 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 626 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 627 | function enumerate(target: any): IterableIteratorShim; 628 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 629 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 630 | function getPrototypeOf(target: any): any; 631 | function has(target: any, propertyKey: PropertyKey): boolean; 632 | function isExtensible(target: any): boolean; 633 | function ownKeys(target: any): Array; 634 | function preventExtensions(target: any): boolean; 635 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 636 | function setPrototypeOf(target: any, proto: any): boolean; 637 | } 638 | 639 | declare module "es6-shim" { 640 | var String: StringConstructor; 641 | var Array: ArrayConstructor; 642 | var Number: NumberConstructor; 643 | var Math: Math; 644 | var Object: ObjectConstructor; 645 | var Map: MapConstructor; 646 | var Set: SetConstructor; 647 | var WeakMap: WeakMapConstructor; 648 | var WeakSet: WeakSetConstructor; 649 | var Promise: PromiseConstructor; 650 | namespace Reflect { 651 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 652 | function construct(target: Function, argumentsList: ArrayLike): any; 653 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 654 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 655 | function enumerate(target: any): Iterator; 656 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 657 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 658 | function getPrototypeOf(target: any): any; 659 | function has(target: any, propertyKey: PropertyKey): boolean; 660 | function isExtensible(target: any): boolean; 661 | function ownKeys(target: any): Array; 662 | function preventExtensions(target: any): boolean; 663 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 664 | function setPrototypeOf(target: any, proto: any): boolean; 665 | } 666 | } -------------------------------------------------------------------------------- /typings/globals/es6-shim/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts", 5 | "raw": "registry:dt/es6-shim#0.31.2+20160602141504", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/hammerjs/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/de8e80dfe5360fef44d00c41257d5ef37add000a/hammerjs/hammerjs.d.ts 3 | declare var Hammer:HammerStatic; 4 | 5 | declare module "hammerjs" { 6 | export = Hammer; 7 | } 8 | 9 | interface HammerStatic 10 | { 11 | new( element:HTMLElement | SVGElement, options?:any ): HammerManager; 12 | 13 | defaults:HammerDefaults; 14 | 15 | VERSION: number; 16 | 17 | INPUT_START: number; 18 | INPUT_MOVE: number; 19 | INPUT_END: number; 20 | INPUT_CANCEL: number; 21 | 22 | STATE_POSSIBLE: number; 23 | STATE_BEGAN: number; 24 | STATE_CHANGED: number; 25 | STATE_ENDED: number; 26 | STATE_RECOGNIZED: number; 27 | STATE_CANCELLED: number; 28 | STATE_FAILED: number; 29 | 30 | DIRECTION_NONE: number; 31 | DIRECTION_LEFT: number; 32 | DIRECTION_RIGHT: number; 33 | DIRECTION_UP: number; 34 | DIRECTION_DOWN: number; 35 | DIRECTION_HORIZONTAL: number; 36 | DIRECTION_VERTICAL: number; 37 | DIRECTION_ALL: number; 38 | 39 | Manager: HammerManager; 40 | Input: HammerInput; 41 | TouchAction: TouchAction; 42 | 43 | TouchInput: TouchInput; 44 | MouseInput: MouseInput; 45 | PointerEventInput: PointerEventInput; 46 | TouchMouseInput: TouchMouseInput; 47 | SingleTouchInput: SingleTouchInput; 48 | 49 | Recognizer: RecognizerStatic; 50 | AttrRecognizer: AttrRecognizerStatic; 51 | Tap: TapRecognizerStatic; 52 | Pan: PanRecognizerStatic; 53 | Swipe: SwipeRecognizerStatic; 54 | Pinch: PinchRecognizerStatic; 55 | Rotate: RotateRecognizerStatic; 56 | Press: PressRecognizerStatic; 57 | 58 | on( target:EventTarget, types:string, handler:Function ):void; 59 | off( target:EventTarget, types:string, handler:Function ):void; 60 | each( obj:any, iterator:Function, context:any ): void; 61 | merge( dest:any, src:any ): any; 62 | extend( dest:any, src:any, merge:boolean ): any; 63 | inherit( child:Function, base:Function, properties:any ):any; 64 | bindFn( fn:Function, context:any ):Function; 65 | prefixed( obj:any, property:string ):string; 66 | } 67 | 68 | interface HammerDefaults 69 | { 70 | domEvents:boolean; 71 | enable:boolean; 72 | preset:any[]; 73 | touchAction:string; 74 | cssProps:CssProps; 75 | 76 | inputClass():void; 77 | inputTarget():void; 78 | } 79 | 80 | interface CssProps 81 | { 82 | contentZooming:string; 83 | tapHighlightColor:string; 84 | touchCallout:string; 85 | touchSelect:string; 86 | userDrag:string; 87 | userSelect:string; 88 | } 89 | 90 | interface HammerOptions extends HammerDefaults 91 | { 92 | 93 | } 94 | 95 | interface HammerManager 96 | { 97 | new( element:HTMLElement, options?:any ):HammerManager; 98 | 99 | add( recogniser:Recognizer ):Recognizer; 100 | add( recogniser:Recognizer ):HammerManager; 101 | add( recogniser:Recognizer[] ):Recognizer; 102 | add( recogniser:Recognizer[] ):HammerManager; 103 | destroy():void; 104 | emit( event:string, data:any ):void; 105 | get( recogniser:Recognizer ):Recognizer; 106 | get( recogniser:string ):Recognizer; 107 | off( events:string, handler?:( event:HammerInput ) => void ):void; 108 | on( events:string, handler:( event:HammerInput ) => void ):void; 109 | recognize( inputData:any ):void; 110 | remove( recogniser:Recognizer ):HammerManager; 111 | remove( recogniser:string ):HammerManager; 112 | set( options:HammerOptions ):HammerManager; 113 | stop( force:boolean ):void; 114 | } 115 | 116 | declare class HammerInput 117 | { 118 | constructor( manager:HammerManager, callback:Function ); 119 | 120 | destroy():void; 121 | handler():void; 122 | init():void; 123 | 124 | /** Name of the event. Like panstart. */ 125 | type:string; 126 | 127 | /** Movement of the X axis. */ 128 | deltaX:number; 129 | 130 | /** Movement of the Y axis. */ 131 | deltaY:number; 132 | 133 | /** Total time in ms since the first input. */ 134 | deltaTime:number; 135 | 136 | /** Distance moved. */ 137 | distance:number; 138 | 139 | /** Angle moved. */ 140 | angle:number; 141 | 142 | /** Velocity on the X axis, in px/ms. */ 143 | velocityX:number; 144 | 145 | /** Velocity on the Y axis, in px/ms */ 146 | velocityY:number; 147 | 148 | /** Highest velocityX/Y value. */ 149 | velocity:number; 150 | 151 | /** Direction moved. Matches the DIRECTION constants. */ 152 | direction:number; 153 | 154 | /** Direction moved from it's starting point. Matches the DIRECTION constants. */ 155 | offsetDirection:string; 156 | 157 | /** Scaling that has been done when multi-touch. 1 on a single touch. */ 158 | scale:number; 159 | 160 | /** Rotation that has been done when multi-touch. 0 on a single touch. */ 161 | rotation:number; 162 | 163 | /** Center position for multi-touch, or just the single pointer. */ 164 | center:HammerPoint; 165 | 166 | /** Source event object, type TouchEvent, MouseEvent or PointerEvent. */ 167 | srcEvent:TouchEvent | MouseEvent | PointerEvent; 168 | 169 | /** Target that received the event. */ 170 | target:HTMLElement; 171 | 172 | /** Primary pointer type, could be touch, mouse, pen or kinect. */ 173 | pointerType:string; 174 | 175 | /** Event type, matches the INPUT constants. */ 176 | eventType:string; 177 | 178 | /** true when the first input. */ 179 | isFirst:boolean; 180 | 181 | /** true when the final (last) input. */ 182 | isFinal:boolean; 183 | 184 | /** Array with all pointers, including the ended pointers (touchend, mouseup). */ 185 | pointers:any[]; 186 | 187 | /** Array with all new/moved/lost pointers. */ 188 | changedPointers:any[]; 189 | 190 | /** Reference to the srcEvent.preventDefault() method. Only for experts! */ 191 | preventDefault:Function; 192 | } 193 | 194 | declare class MouseInput extends HammerInput 195 | { 196 | constructor( manager:HammerManager, callback:Function ); 197 | } 198 | 199 | declare class PointerEventInput extends HammerInput 200 | { 201 | constructor( manager:HammerManager, callback:Function ); 202 | } 203 | 204 | declare class SingleTouchInput extends HammerInput 205 | { 206 | constructor( manager:HammerManager, callback:Function ); 207 | } 208 | 209 | declare class TouchInput extends HammerInput 210 | { 211 | constructor( manager:HammerManager, callback:Function ); 212 | } 213 | 214 | declare class TouchMouseInput extends HammerInput 215 | { 216 | constructor( manager:HammerManager, callback:Function ); 217 | } 218 | 219 | interface RecognizerStatic 220 | { 221 | new( options?:any ):Recognizer; 222 | } 223 | 224 | interface Recognizer 225 | { 226 | defaults:any; 227 | 228 | canEmit():boolean; 229 | canRecognizeWith( otherRecognizer:Recognizer ):boolean; 230 | dropRecognizeWith( otherRecognizer:Recognizer ):Recognizer; 231 | dropRecognizeWith( otherRecognizer:string ):Recognizer; 232 | dropRequireFailure( otherRecognizer:Recognizer ):Recognizer; 233 | dropRequireFailure( otherRecognizer:string ):Recognizer; 234 | emit( input:HammerInput ):void; 235 | getTouchAction():any[]; 236 | hasRequireFailures():boolean; 237 | process( inputData:HammerInput ):string; 238 | recognize( inputData:HammerInput ):void; 239 | recognizeWith( otherRecognizer:Recognizer ):Recognizer; 240 | recognizeWith( otherRecognizer:string ):Recognizer; 241 | requireFailure( otherRecognizer:Recognizer ):Recognizer; 242 | requireFailure( otherRecognizer:string ):Recognizer; 243 | reset():void; 244 | set( options?:any ):Recognizer; 245 | tryEmit( input:HammerInput ):void; 246 | } 247 | 248 | interface AttrRecognizerStatic 249 | { 250 | attrTest( input:HammerInput ):boolean; 251 | process( input:HammerInput ):any; 252 | } 253 | 254 | interface AttrRecognizer extends Recognizer 255 | { 256 | new( options?:any ):AttrRecognizer; 257 | } 258 | 259 | interface PanRecognizerStatic 260 | { 261 | new( options?:any ):PanRecognizer; 262 | } 263 | 264 | interface PanRecognizer extends AttrRecognizer 265 | { 266 | } 267 | 268 | interface PinchRecognizerStatic 269 | { 270 | new( options?:any ):PinchRecognizer; 271 | } 272 | 273 | interface PinchRecognizer extends AttrRecognizer 274 | { 275 | } 276 | 277 | interface PressRecognizerStatic 278 | { 279 | new( options?:any ):PressRecognizer; 280 | } 281 | 282 | interface PressRecognizer extends AttrRecognizer 283 | { 284 | } 285 | 286 | interface RotateRecognizerStatic 287 | { 288 | new( options?:any ):RotateRecognizer; 289 | } 290 | 291 | interface RotateRecognizer extends AttrRecognizer 292 | { 293 | } 294 | 295 | interface SwipeRecognizerStatic 296 | { 297 | new( options?:any ):SwipeRecognizer; 298 | } 299 | 300 | interface SwipeRecognizer extends AttrRecognizer 301 | { 302 | } 303 | 304 | interface TapRecognizerStatic 305 | { 306 | new( options?:any ):TapRecognizer; 307 | } 308 | 309 | interface TapRecognizer extends AttrRecognizer 310 | { 311 | } 312 | 313 | declare class TouchAction 314 | { 315 | constructor( manager:HammerManager, value:string ); 316 | 317 | compute():string; 318 | preventDefaults( input:HammerInput ):void; 319 | preventSrc( srcEvent:any ):void; 320 | set( value:string ):void; 321 | update():void; 322 | } 323 | 324 | interface HammerPoint 325 | { 326 | x: number; 327 | y: number; 328 | } -------------------------------------------------------------------------------- /typings/globals/hammerjs/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/de8e80dfe5360fef44d00c41257d5ef37add000a/hammerjs/hammerjs.d.ts", 5 | "raw": "registry:dt/hammerjs#2.0.4+20160417130828", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/de8e80dfe5360fef44d00c41257d5ef37add000a/hammerjs/hammerjs.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/jasmine/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts 3 | declare function describe(description: string, specDefinitions: () => void): void; 4 | declare function fdescribe(description: string, specDefinitions: () => void): void; 5 | declare function xdescribe(description: string, specDefinitions: () => void): void; 6 | 7 | declare function it(expectation: string, assertion?: () => void, timeout?: number): void; 8 | declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 9 | declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; 10 | declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 11 | declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; 12 | declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 13 | 14 | /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ 15 | declare function pending(reason?: string): void; 16 | 17 | declare function beforeEach(action: () => void, timeout?: number): void; 18 | declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; 19 | declare function afterEach(action: () => void, timeout?: number): void; 20 | declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; 21 | 22 | declare function beforeAll(action: () => void, timeout?: number): void; 23 | declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; 24 | declare function afterAll(action: () => void, timeout?: number): void; 25 | declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; 26 | 27 | declare function expect(spy: Function): jasmine.Matchers; 28 | declare function expect(actual: any): jasmine.Matchers; 29 | 30 | declare function fail(e?: any): void; 31 | /** Action method that should be called when the async work is complete */ 32 | interface DoneFn extends Function { 33 | (): void; 34 | 35 | /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ 36 | fail: (message?: Error|string) => void; 37 | } 38 | 39 | declare function spyOn(object: any, method: string): jasmine.Spy; 40 | 41 | declare function runs(asyncMethod: Function): void; 42 | declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void; 43 | declare function waits(timeout?: number): void; 44 | 45 | declare namespace jasmine { 46 | 47 | var clock: () => Clock; 48 | 49 | function any(aclass: any): Any; 50 | function anything(): Any; 51 | function arrayContaining(sample: any[]): ArrayContaining; 52 | function objectContaining(sample: any): ObjectContaining; 53 | function createSpy(name: string, originalFn?: Function): Spy; 54 | function createSpyObj(baseName: string, methodNames: any[]): any; 55 | function createSpyObj(baseName: string, methodNames: any[]): T; 56 | function pp(value: any): string; 57 | function getEnv(): Env; 58 | function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 59 | function addMatchers(matchers: CustomMatcherFactories): void; 60 | function stringMatching(str: string): Any; 61 | function stringMatching(str: RegExp): Any; 62 | 63 | interface Any { 64 | 65 | new (expectedClass: any): any; 66 | 67 | jasmineMatches(other: any): boolean; 68 | jasmineToString(): string; 69 | } 70 | 71 | // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() 72 | interface ArrayLike { 73 | length: number; 74 | [n: number]: T; 75 | } 76 | 77 | interface ArrayContaining { 78 | new (sample: any[]): any; 79 | 80 | asymmetricMatch(other: any): boolean; 81 | jasmineToString(): string; 82 | } 83 | 84 | interface ObjectContaining { 85 | new (sample: any): any; 86 | 87 | jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; 88 | jasmineToString(): string; 89 | } 90 | 91 | interface Block { 92 | 93 | new (env: Env, func: SpecFunction, spec: Spec): any; 94 | 95 | execute(onComplete: () => void): void; 96 | } 97 | 98 | interface WaitsBlock extends Block { 99 | new (env: Env, timeout: number, spec: Spec): any; 100 | } 101 | 102 | interface WaitsForBlock extends Block { 103 | new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any; 104 | } 105 | 106 | interface Clock { 107 | install(): void; 108 | uninstall(): void; 109 | /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ 110 | tick(ms: number): void; 111 | mockDate(date?: Date): void; 112 | } 113 | 114 | interface CustomEqualityTester { 115 | (first: any, second: any): boolean; 116 | } 117 | 118 | interface CustomMatcher { 119 | compare(actual: T, expected: T): CustomMatcherResult; 120 | compare(actual: any, expected: any): CustomMatcherResult; 121 | } 122 | 123 | interface CustomMatcherFactory { 124 | (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; 125 | } 126 | 127 | interface CustomMatcherFactories { 128 | [index: string]: CustomMatcherFactory; 129 | } 130 | 131 | interface CustomMatcherResult { 132 | pass: boolean; 133 | message?: string; 134 | } 135 | 136 | interface MatchersUtil { 137 | equals(a: any, b: any, customTesters?: Array): boolean; 138 | contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; 139 | buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; 140 | } 141 | 142 | interface Env { 143 | setTimeout: any; 144 | clearTimeout: void; 145 | setInterval: any; 146 | clearInterval: void; 147 | updateInterval: number; 148 | 149 | currentSpec: Spec; 150 | 151 | matchersClass: Matchers; 152 | 153 | version(): any; 154 | versionString(): string; 155 | nextSpecId(): number; 156 | addReporter(reporter: Reporter): void; 157 | execute(): void; 158 | describe(description: string, specDefinitions: () => void): Suite; 159 | // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these 160 | beforeEach(beforeEachFunction: () => void): void; 161 | beforeAll(beforeAllFunction: () => void): void; 162 | currentRunner(): Runner; 163 | afterEach(afterEachFunction: () => void): void; 164 | afterAll(afterAllFunction: () => void): void; 165 | xdescribe(desc: string, specDefinitions: () => void): XSuite; 166 | it(description: string, func: () => void): Spec; 167 | // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these 168 | xit(desc: string, func: () => void): XSpec; 169 | compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean; 170 | compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 171 | equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 172 | contains_(haystack: any, needle: any): boolean; 173 | addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 174 | addMatchers(matchers: CustomMatcherFactories): void; 175 | specFilter(spec: Spec): boolean; 176 | } 177 | 178 | interface FakeTimer { 179 | 180 | new (): any; 181 | 182 | reset(): void; 183 | tick(millis: number): void; 184 | runFunctionsWithinRange(oldMillis: number, nowMillis: number): void; 185 | scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void; 186 | } 187 | 188 | interface HtmlReporter { 189 | new (): any; 190 | } 191 | 192 | interface HtmlSpecFilter { 193 | new (): any; 194 | } 195 | 196 | interface Result { 197 | type: string; 198 | } 199 | 200 | interface NestedResults extends Result { 201 | description: string; 202 | 203 | totalCount: number; 204 | passedCount: number; 205 | failedCount: number; 206 | 207 | skipped: boolean; 208 | 209 | rollupCounts(result: NestedResults): void; 210 | log(values: any): void; 211 | getItems(): Result[]; 212 | addResult(result: Result): void; 213 | passed(): boolean; 214 | } 215 | 216 | interface MessageResult extends Result { 217 | values: any; 218 | trace: Trace; 219 | } 220 | 221 | interface ExpectationResult extends Result { 222 | matcherName: string; 223 | passed(): boolean; 224 | expected: any; 225 | actual: any; 226 | message: string; 227 | trace: Trace; 228 | } 229 | 230 | interface Trace { 231 | name: string; 232 | message: string; 233 | stack: any; 234 | } 235 | 236 | interface PrettyPrinter { 237 | 238 | new (): any; 239 | 240 | format(value: any): void; 241 | iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void; 242 | emitScalar(value: any): void; 243 | emitString(value: string): void; 244 | emitArray(array: any[]): void; 245 | emitObject(obj: any): void; 246 | append(value: any): void; 247 | } 248 | 249 | interface StringPrettyPrinter extends PrettyPrinter { 250 | } 251 | 252 | interface Queue { 253 | 254 | new (env: any): any; 255 | 256 | env: Env; 257 | ensured: boolean[]; 258 | blocks: Block[]; 259 | running: boolean; 260 | index: number; 261 | offset: number; 262 | abort: boolean; 263 | 264 | addBefore(block: Block, ensure?: boolean): void; 265 | add(block: any, ensure?: boolean): void; 266 | insertNext(block: any, ensure?: boolean): void; 267 | start(onComplete?: () => void): void; 268 | isRunning(): boolean; 269 | next_(): void; 270 | results(): NestedResults; 271 | } 272 | 273 | interface Matchers { 274 | 275 | new (env: Env, actual: any, spec: Env, isNot?: boolean): any; 276 | 277 | env: Env; 278 | actual: any; 279 | spec: Env; 280 | isNot?: boolean; 281 | message(): any; 282 | 283 | toBe(expected: any, expectationFailOutput?: any): boolean; 284 | toEqual(expected: any, expectationFailOutput?: any): boolean; 285 | toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; 286 | toBeDefined(expectationFailOutput?: any): boolean; 287 | toBeUndefined(expectationFailOutput?: any): boolean; 288 | toBeNull(expectationFailOutput?: any): boolean; 289 | toBeNaN(): boolean; 290 | toBeTruthy(expectationFailOutput?: any): boolean; 291 | toBeFalsy(expectationFailOutput?: any): boolean; 292 | toHaveBeenCalled(): boolean; 293 | toHaveBeenCalledWith(...params: any[]): boolean; 294 | toHaveBeenCalledTimes(expected: number): boolean; 295 | toContain(expected: any, expectationFailOutput?: any): boolean; 296 | toBeLessThan(expected: number, expectationFailOutput?: any): boolean; 297 | toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; 298 | toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; 299 | toThrow(expected?: any): boolean; 300 | toThrowError(message?: string | RegExp): boolean; 301 | toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; 302 | not: Matchers; 303 | 304 | Any: Any; 305 | } 306 | 307 | interface Reporter { 308 | reportRunnerStarting(runner: Runner): void; 309 | reportRunnerResults(runner: Runner): void; 310 | reportSuiteResults(suite: Suite): void; 311 | reportSpecStarting(spec: Spec): void; 312 | reportSpecResults(spec: Spec): void; 313 | log(str: string): void; 314 | } 315 | 316 | interface MultiReporter extends Reporter { 317 | addReporter(reporter: Reporter): void; 318 | } 319 | 320 | interface Runner { 321 | 322 | new (env: Env): any; 323 | 324 | execute(): void; 325 | beforeEach(beforeEachFunction: SpecFunction): void; 326 | afterEach(afterEachFunction: SpecFunction): void; 327 | beforeAll(beforeAllFunction: SpecFunction): void; 328 | afterAll(afterAllFunction: SpecFunction): void; 329 | finishCallback(): void; 330 | addSuite(suite: Suite): void; 331 | add(block: Block): void; 332 | specs(): Spec[]; 333 | suites(): Suite[]; 334 | topLevelSuites(): Suite[]; 335 | results(): NestedResults; 336 | } 337 | 338 | interface SpecFunction { 339 | (spec?: Spec): void; 340 | } 341 | 342 | interface SuiteOrSpec { 343 | id: number; 344 | env: Env; 345 | description: string; 346 | queue: Queue; 347 | } 348 | 349 | interface Spec extends SuiteOrSpec { 350 | 351 | new (env: Env, suite: Suite, description: string): any; 352 | 353 | suite: Suite; 354 | 355 | afterCallbacks: SpecFunction[]; 356 | spies_: Spy[]; 357 | 358 | results_: NestedResults; 359 | matchersClass: Matchers; 360 | 361 | getFullName(): string; 362 | results(): NestedResults; 363 | log(arguments: any): any; 364 | runs(func: SpecFunction): Spec; 365 | addToQueue(block: Block): void; 366 | addMatcherResult(result: Result): void; 367 | expect(actual: any): any; 368 | waits(timeout: number): Spec; 369 | waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; 370 | fail(e?: any): void; 371 | getMatchersClass_(): Matchers; 372 | addMatchers(matchersPrototype: CustomMatcherFactories): void; 373 | finishCallback(): void; 374 | finish(onComplete?: () => void): void; 375 | after(doAfter: SpecFunction): void; 376 | execute(onComplete?: () => void): any; 377 | addBeforesAndAftersToQueue(): void; 378 | explodes(): void; 379 | spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy; 380 | removeAllSpies(): void; 381 | } 382 | 383 | interface XSpec { 384 | id: number; 385 | runs(): void; 386 | } 387 | 388 | interface Suite extends SuiteOrSpec { 389 | 390 | new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any; 391 | 392 | parentSuite: Suite; 393 | 394 | getFullName(): string; 395 | finish(onComplete?: () => void): void; 396 | beforeEach(beforeEachFunction: SpecFunction): void; 397 | afterEach(afterEachFunction: SpecFunction): void; 398 | beforeAll(beforeAllFunction: SpecFunction): void; 399 | afterAll(afterAllFunction: SpecFunction): void; 400 | results(): NestedResults; 401 | add(suiteOrSpec: SuiteOrSpec): void; 402 | specs(): Spec[]; 403 | suites(): Suite[]; 404 | children(): any[]; 405 | execute(onComplete?: () => void): void; 406 | } 407 | 408 | interface XSuite { 409 | execute(): void; 410 | } 411 | 412 | interface Spy { 413 | (...params: any[]): any; 414 | 415 | identity: string; 416 | and: SpyAnd; 417 | calls: Calls; 418 | mostRecentCall: { args: any[]; }; 419 | argsForCall: any[]; 420 | wasCalled: boolean; 421 | } 422 | 423 | interface SpyAnd { 424 | /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ 425 | callThrough(): Spy; 426 | /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */ 427 | returnValue(val: any): Spy; 428 | /** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */ 429 | returnValues(...values: any[]): Spy; 430 | /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */ 431 | callFake(fn: Function): Spy; 432 | /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */ 433 | throwError(msg: string): Spy; 434 | /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */ 435 | stub(): Spy; 436 | } 437 | 438 | interface Calls { 439 | /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/ 440 | any(): boolean; 441 | /** By chaining the spy with calls.count(), will return the number of times the spy was called **/ 442 | count(): number; 443 | /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/ 444 | argsFor(index: number): any[]; 445 | /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/ 446 | allArgs(): any[]; 447 | /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/ 448 | all(): CallInfo[]; 449 | /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/ 450 | mostRecent(): CallInfo; 451 | /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/ 452 | first(): CallInfo; 453 | /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/ 454 | reset(): void; 455 | } 456 | 457 | interface CallInfo { 458 | /** The context (the this) for the call */ 459 | object: any; 460 | /** All arguments passed to the call */ 461 | args: any[]; 462 | /** The return value of the call */ 463 | returnValue: any; 464 | } 465 | 466 | interface Util { 467 | inherit(childClass: Function, parentClass: Function): any; 468 | formatException(e: any): any; 469 | htmlEscape(str: string): string; 470 | argsToArray(args: any): any; 471 | extend(destination: any, source: any): any; 472 | } 473 | 474 | interface JsApiReporter extends Reporter { 475 | 476 | started: boolean; 477 | finished: boolean; 478 | result: any; 479 | messages: any; 480 | 481 | new (): any; 482 | 483 | suites(): Suite[]; 484 | summarize_(suiteOrSpec: SuiteOrSpec): any; 485 | results(): any; 486 | resultsForSpec(specId: any): any; 487 | log(str: any): any; 488 | resultsForSpecs(specIds: any): any; 489 | summarizeResult_(result: any): any; 490 | } 491 | 492 | interface Jasmine { 493 | Spec: Spec; 494 | clock: Clock; 495 | util: Util; 496 | } 497 | 498 | export var HtmlReporter: HtmlReporter; 499 | export var HtmlSpecFilter: HtmlSpecFilter; 500 | export var DEFAULT_TIMEOUT_INTERVAL: number; 501 | } -------------------------------------------------------------------------------- /typings/globals/jasmine/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts", 5 | "raw": "registry:dt/jasmine#2.2.0+20160505161446", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ionic 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | --------------------------------------------------------------------------------