:~]/)){ // Pure ID selector
els = [document.getElementById(selector.split('#')[1])];}else { // Other selectors
els = (context || document).querySelectorAll(selector);}for(i = 0;i < els.length;i++) {if(els[i])arr.push(els[i]);}}}else if(selector.nodeType || selector === window || selector === document){arr.push(selector);}else if(selector.length > 0 && selector[0].nodeType){for(i = 0;i < selector.length;i++) {arr.push(selector[i]);}}}return new Dom7(arr);};Dom7.prototype = { // Classes and attriutes
addClass:function addClass(className){if(typeof className === 'undefined'){return this;}var classes=className.split(' ');for(var i=0;i < classes.length;i++) {for(var j=0;j < this.length;j++) {this[j].classList.add(classes[i]);}}return this;},removeClass:function removeClass(className){var classes=className.split(' ');for(var i=0;i < classes.length;i++) {for(var j=0;j < this.length;j++) {this[j].classList.remove(classes[i]);}}return this;},hasClass:function hasClass(className){if(!this[0])return false;else return this[0].classList.contains(className);},toggleClass:function toggleClass(className){var classes=className.split(' ');for(var i=0;i < classes.length;i++) {for(var j=0;j < this.length;j++) {this[j].classList.toggle(classes[i]);}}return this;},attr:function attr(attrs,value){if(arguments.length === 1 && typeof attrs === 'string'){ // Get attr
if(this[0])return this[0].getAttribute(attrs);else return undefined;}else { // Set attrs
for(var i=0;i < this.length;i++) {if(arguments.length === 2){ // String
this[i].setAttribute(attrs,value);}else { // Object
for(var attrName in attrs) {this[i][attrName] = attrs[attrName];this[i].setAttribute(attrName,attrs[attrName]);}}}return this;}},removeAttr:function removeAttr(attr){for(var i=0;i < this.length;i++) {this[i].removeAttribute(attr);}return this;},data:function data(key,value){if(typeof value === 'undefined'){ // Get value
if(this[0]){var dataKey=this[0].getAttribute('data-' + key);if(dataKey)return dataKey;else if(this[0].dom7ElementDataStorage && key in this[0].dom7ElementDataStorage)return this[0].dom7ElementDataStorage[key];else return undefined;}else return undefined;}else { // Set value
for(var i=0;i < this.length;i++) {var el=this[i];if(!el.dom7ElementDataStorage)el.dom7ElementDataStorage = {};el.dom7ElementDataStorage[key] = value;}return this;}}, // Transforms
transform:function transform(_transform){for(var i=0;i < this.length;i++) {var elStyle=this[i].style;elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = _transform;}return this;},transition:function transition(duration){if(typeof duration !== 'string'){duration = duration + 'ms';}for(var i=0;i < this.length;i++) {var elStyle=this[i].style;elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;}return this;}, //Events
on:function on(eventName,targetSelector,listener,capture){function handleLiveEvent(e){var target=e.target;if($(target).is(targetSelector))listener.call(target,e);else {var parents=$(target).parents();for(var k=0;k < parents.length;k++) {if($(parents[k]).is(targetSelector))listener.call(parents[k],e);}}}var events=eventName.split(' ');var i,j;for(i = 0;i < this.length;i++) {if(typeof targetSelector === 'function' || targetSelector === false){ // Usual events
if(typeof targetSelector === 'function'){listener = arguments[1];capture = arguments[2] || false;}for(j = 0;j < events.length;j++) {this[i].addEventListener(events[j],listener,capture);}}else { //Live events
for(j = 0;j < events.length;j++) {if(!this[i].dom7LiveListeners)this[i].dom7LiveListeners = [];this[i].dom7LiveListeners.push({listener:listener,liveListener:handleLiveEvent});this[i].addEventListener(events[j],handleLiveEvent,capture);}}}return this;},off:function off(eventName,targetSelector,listener,capture){var events=eventName.split(' ');for(var i=0;i < events.length;i++) {for(var j=0;j < this.length;j++) {if(typeof targetSelector === 'function' || targetSelector === false){ // Usual events
if(typeof targetSelector === 'function'){listener = arguments[1];capture = arguments[2] || false;}this[j].removeEventListener(events[i],listener,capture);}else { // Live event
if(this[j].dom7LiveListeners){for(var k=0;k < this[j].dom7LiveListeners.length;k++) {if(this[j].dom7LiveListeners[k].listener === listener){this[j].removeEventListener(events[i],this[j].dom7LiveListeners[k].liveListener,capture);}}}}}}return this;},once:function once(eventName,targetSelector,listener,capture){var dom=this;if(typeof targetSelector === 'function'){targetSelector = false;listener = arguments[1];capture = arguments[2];}function proxy(e){listener(e);dom.off(eventName,targetSelector,proxy,capture);}dom.on(eventName,targetSelector,proxy,capture);},trigger:function trigger(eventName,eventData){for(var i=0;i < this.length;i++) {var evt;try{evt = new window.CustomEvent(eventName,{detail:eventData,bubbles:true,cancelable:true});}catch(e) {evt = document.createEvent('Event');evt.initEvent(eventName,true,true);evt.detail = eventData;}this[i].dispatchEvent(evt);}return this;},transitionEnd:function transitionEnd(callback){var events=['webkitTransitionEnd','transitionend','oTransitionEnd','MSTransitionEnd','msTransitionEnd'],i,j,dom=this;function fireCallBack(e){ /*jshint validthis:true */if(e.target !== this)return;callback.call(this,e);for(i = 0;i < events.length;i++) {dom.off(events[i],fireCallBack);}}if(callback){for(i = 0;i < events.length;i++) {dom.on(events[i],fireCallBack);}}return this;}, // Sizing/Styles
width:function width(){if(this[0] === window){return window.innerWidth;}else {if(this.length > 0){return parseFloat(this.css('width'));}else {return null;}}},outerWidth:function outerWidth(includeMargins){if(this.length > 0){if(includeMargins)return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));else return this[0].offsetWidth;}else return null;},height:function height(){if(this[0] === window){return window.innerHeight;}else {if(this.length > 0){return parseFloat(this.css('height'));}else {return null;}}},outerHeight:function outerHeight(includeMargins){if(this.length > 0){if(includeMargins)return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));else return this[0].offsetHeight;}else return null;},offset:function offset(){if(this.length > 0){var el=this[0];var box=el.getBoundingClientRect();var body=document.body;var clientTop=el.clientTop || body.clientTop || 0;var clientLeft=el.clientLeft || body.clientLeft || 0;var scrollTop=window.pageYOffset || el.scrollTop;var scrollLeft=window.pageXOffset || el.scrollLeft;return {top:box.top + scrollTop - clientTop,left:box.left + scrollLeft - clientLeft};}else {return null;}},css:function css(props,value){var i;if(arguments.length === 1){if(typeof props === 'string'){if(this[0])return window.getComputedStyle(this[0],null).getPropertyValue(props);}else {for(i = 0;i < this.length;i++) {for(var prop in props) {this[i].style[prop] = props[prop];}}return this;}}if(arguments.length === 2 && typeof props === 'string'){for(i = 0;i < this.length;i++) {this[i].style[props] = value;}return this;}return this;}, //Dom manipulation
each:function each(callback){for(var i=0;i < this.length;i++) {callback.call(this[i],i,this[i]);}return this;},html:function html(_html){if(typeof _html === 'undefined'){return this[0]?this[0].innerHTML:undefined;}else {for(var i=0;i < this.length;i++) {this[i].innerHTML = _html;}return this;}},is:function is(selector){if(!this[0])return false;var compareWith,i;if(typeof selector === 'string'){var el=this[0];if(el === document)return selector === document;if(el === window)return selector === window;if(el.matches)return el.matches(selector);else if(el.webkitMatchesSelector)return el.webkitMatchesSelector(selector);else if(el.mozMatchesSelector)return el.mozMatchesSelector(selector);else if(el.msMatchesSelector)return el.msMatchesSelector(selector);else {compareWith = $(selector);for(i = 0;i < compareWith.length;i++) {if(compareWith[i] === this[0])return true;}return false;}}else if(selector === document)return this[0] === document;else if(selector === window)return this[0] === window;else {if(selector.nodeType || selector instanceof Dom7){compareWith = selector.nodeType?[selector]:selector;for(i = 0;i < compareWith.length;i++) {if(compareWith[i] === this[0])return true;}return false;}return false;}},index:function index(){if(this[0]){var child=this[0];var i=0;while((child = child.previousSibling) !== null) {if(child.nodeType === 1)i++;}return i;}else return undefined;},eq:function eq(index){if(typeof index === 'undefined')return this;var length=this.length;var returnIndex;if(index > length - 1){return new Dom7([]);}if(index < 0){returnIndex = length + index;if(returnIndex < 0)return new Dom7([]);else return new Dom7([this[returnIndex]]);}return new Dom7([this[index]]);},append:function append(newChild){var i,j;for(i = 0;i < this.length;i++) {if(typeof newChild === 'string'){var tempDiv=document.createElement('div');tempDiv.innerHTML = newChild;while(tempDiv.firstChild) {this[i].appendChild(tempDiv.firstChild);}}else if(newChild instanceof Dom7){for(j = 0;j < newChild.length;j++) {this[i].appendChild(newChild[j]);}}else {this[i].appendChild(newChild);}}return this;},prepend:function prepend(newChild){var i,j;for(i = 0;i < this.length;i++) {if(typeof newChild === 'string'){var tempDiv=document.createElement('div');tempDiv.innerHTML = newChild;for(j = tempDiv.childNodes.length - 1;j >= 0;j--) {this[i].insertBefore(tempDiv.childNodes[j],this[i].childNodes[0]);}}else if(newChild instanceof Dom7){for(j = 0;j < newChild.length;j++) {this[i].insertBefore(newChild[j],this[i].childNodes[0]);}}else {this[i].insertBefore(newChild,this[i].childNodes[0]);}}return this;},insertBefore:function insertBefore(selector){var before=$(selector);for(var i=0;i < this.length;i++) {if(before.length === 1){before[0].parentNode.insertBefore(this[i],before[0]);}else if(before.length > 1){for(var j=0;j < before.length;j++) {before[j].parentNode.insertBefore(this[i].cloneNode(true),before[j]);}}}},insertAfter:function insertAfter(selector){var after=$(selector);for(var i=0;i < this.length;i++) {if(after.length === 1){after[0].parentNode.insertBefore(this[i],after[0].nextSibling);}else if(after.length > 1){for(var j=0;j < after.length;j++) {after[j].parentNode.insertBefore(this[i].cloneNode(true),after[j].nextSibling);}}}},next:function next(selector){if(this.length > 0){if(selector){if(this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector))return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);}else {if(this[0].nextElementSibling)return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);}}else return new Dom7([]);},nextAll:function nextAll(selector){var nextEls=[];var el=this[0];if(!el)return new Dom7([]);while(el.nextElementSibling) {var next=el.nextElementSibling;if(selector){if($(next).is(selector))nextEls.push(next);}else nextEls.push(next);el = next;}return new Dom7(nextEls);},prev:function prev(selector){if(this.length > 0){if(selector){if(this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector))return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);}else {if(this[0].previousElementSibling)return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);}}else return new Dom7([]);},prevAll:function prevAll(selector){var prevEls=[];var el=this[0];if(!el)return new Dom7([]);while(el.previousElementSibling) {var prev=el.previousElementSibling;if(selector){if($(prev).is(selector))prevEls.push(prev);}else prevEls.push(prev);el = prev;}return new Dom7(prevEls);},parent:function parent(selector){var parents=[];for(var i=0;i < this.length;i++) {if(selector){if($(this[i].parentNode).is(selector))parents.push(this[i].parentNode);}else {parents.push(this[i].parentNode);}}return $($.unique(parents));},parents:function parents(selector){var parents=[];for(var i=0;i < this.length;i++) {var parent=this[i].parentNode;while(parent) {if(selector){if($(parent).is(selector))parents.push(parent);}else {parents.push(parent);}parent = parent.parentNode;}}return $($.unique(parents));},find:function find(selector){var foundElements=[];for(var i=0;i < this.length;i++) {var found=this[i].querySelectorAll(selector);for(var j=0;j < found.length;j++) {foundElements.push(found[j]);}}return new Dom7(foundElements);},children:function children(selector){var children=[];for(var i=0;i < this.length;i++) {var childNodes=this[i].childNodes;for(var j=0;j < childNodes.length;j++) {if(!selector){if(childNodes[j].nodeType === 1)children.push(childNodes[j]);}else {if(childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector))children.push(childNodes[j]);}}}return new Dom7($.unique(children));},remove:function remove(){for(var i=0;i < this.length;i++) {if(this[i].parentNode)this[i].parentNode.removeChild(this[i]);}return this;},add:function add(){var dom=this;var i,j;for(i = 0;i < arguments.length;i++) {var toAdd=$(arguments[i]);for(j = 0;j < toAdd.length;j++) {dom[dom.length] = toAdd[j];dom.length++;}}return dom;}};$.fn = Dom7.prototype;$.unique = function(arr){var unique=[];for(var i=0;i < arr.length;i++) {if(unique.indexOf(arr[i]) === -1)unique.push(arr[i]);}return unique;};return $;})(); /*===========================
Get Dom libraries
===========================*/swiperDomPlugins = ['jQuery','Zepto','Dom7'];for(i = 0;i < swiperDomPlugins.length;i++) {if(window[swiperDomPlugins[i]]){addLibraryPlugin(window[swiperDomPlugins[i]]);}} // Required DOM Plugins
if(typeof Dom7 === 'undefined'){domLib = window.Dom7 || window.Zepto || window.jQuery;}else {domLib = Dom7;}if(domLib){if(!('transitionEnd' in domLib.fn)){domLib.fn.transitionEnd = function(callback){var events=['webkitTransitionEnd','transitionend','oTransitionEnd','MSTransitionEnd','msTransitionEnd'],i,j,dom=this;function fireCallBack(e){ /*jshint validthis:true */if(e.target !== this)return;callback.call(this,e);for(i = 0;i < events.length;i++) {dom.off(events[i],fireCallBack);}}if(callback){for(i = 0;i < events.length;i++) {dom.on(events[i],fireCallBack);}}return this;};}if(!('transform' in domLib.fn)){domLib.fn.transform = function(transform){for(var i=0;i < this.length;i++) {var elStyle=this[i].style;elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;}return this;};}if(!('transition' in domLib.fn)){domLib.fn.transition = function(duration){if(typeof duration !== 'string'){duration = duration + 'ms';}for(var i=0;i < this.length;i++) {var elStyle=this[i].style;elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;}return this;};}}}};});
System.register('ionic-angular/components', ['./components/app/app', './components/app/id', './components/action-sheet/action-sheet', './components/alert/alert', './components/blur/blur', './components/button/button', './components/checkbox/checkbox', './components/content/content', './components/icon/icon', './components/infinite-scroll/infinite-scroll', './components/infinite-scroll/infinite-scroll-content', './components/input/input', './components/item/item', './components/item/item-sliding', './components/menu/menu-controller', './components/menu/menu', './components/menu/menu-types', './components/menu/menu-toggle', './components/menu/menu-close', './components/label/label', './components/list/list', './components/show-hide-when/show-hide-when', './components/modal/modal', './components/nav/nav', './components/nav/nav-controller', './components/nav/view-controller', './components/nav/nav-params', './components/nav/nav-push', './components/nav/nav-router', './components/navbar/navbar', './components/option/option', './components/overlay/overlay', './components/slides/slides', './components/radio/radio-button', './components/radio/radio-group', './components/refresher/refresher', './components/refresher/refresher-content', './components/scroll/scroll', './components/searchbar/searchbar', './components/segment/segment', './components/select/select', './components/tabs/tabs', './components/tabs/tab', './components/tap-click/tap-click', './components/toggle/toggle', './components/toolbar/toolbar'], function (_export) {
'use strict';
return {
setters: [function (_componentsAppApp) {
for (var _key in _componentsAppApp) {
if (_key !== 'default') _export(_key, _componentsAppApp[_key]);
}
}, function (_componentsAppId) {
for (var _key2 in _componentsAppId) {
if (_key2 !== 'default') _export(_key2, _componentsAppId[_key2]);
}
}, function (_componentsActionSheetActionSheet) {
for (var _key3 in _componentsActionSheetActionSheet) {
if (_key3 !== 'default') _export(_key3, _componentsActionSheetActionSheet[_key3]);
}
}, function (_componentsAlertAlert) {
for (var _key4 in _componentsAlertAlert) {
if (_key4 !== 'default') _export(_key4, _componentsAlertAlert[_key4]);
}
}, function (_componentsBlurBlur) {
for (var _key5 in _componentsBlurBlur) {
if (_key5 !== 'default') _export(_key5, _componentsBlurBlur[_key5]);
}
}, function (_componentsButtonButton) {
for (var _key6 in _componentsButtonButton) {
if (_key6 !== 'default') _export(_key6, _componentsButtonButton[_key6]);
}
}, function (_componentsCheckboxCheckbox) {
for (var _key7 in _componentsCheckboxCheckbox) {
if (_key7 !== 'default') _export(_key7, _componentsCheckboxCheckbox[_key7]);
}
}, function (_componentsContentContent) {
for (var _key8 in _componentsContentContent) {
if (_key8 !== 'default') _export(_key8, _componentsContentContent[_key8]);
}
}, function (_componentsIconIcon) {
for (var _key9 in _componentsIconIcon) {
if (_key9 !== 'default') _export(_key9, _componentsIconIcon[_key9]);
}
}, function (_componentsInfiniteScrollInfiniteScroll) {
for (var _key10 in _componentsInfiniteScrollInfiniteScroll) {
if (_key10 !== 'default') _export(_key10, _componentsInfiniteScrollInfiniteScroll[_key10]);
}
}, function (_componentsInfiniteScrollInfiniteScrollContent) {
for (var _key11 in _componentsInfiniteScrollInfiniteScrollContent) {
if (_key11 !== 'default') _export(_key11, _componentsInfiniteScrollInfiniteScrollContent[_key11]);
}
}, function (_componentsInputInput) {
for (var _key12 in _componentsInputInput) {
if (_key12 !== 'default') _export(_key12, _componentsInputInput[_key12]);
}
}, function (_componentsItemItem) {
for (var _key13 in _componentsItemItem) {
if (_key13 !== 'default') _export(_key13, _componentsItemItem[_key13]);
}
}, function (_componentsItemItemSliding) {
for (var _key14 in _componentsItemItemSliding) {
if (_key14 !== 'default') _export(_key14, _componentsItemItemSliding[_key14]);
}
}, function (_componentsMenuMenuController) {
for (var _key15 in _componentsMenuMenuController) {
if (_key15 !== 'default') _export(_key15, _componentsMenuMenuController[_key15]);
}
}, function (_componentsMenuMenu) {
for (var _key16 in _componentsMenuMenu) {
if (_key16 !== 'default') _export(_key16, _componentsMenuMenu[_key16]);
}
}, function (_componentsMenuMenuTypes) {
for (var _key17 in _componentsMenuMenuTypes) {
if (_key17 !== 'default') _export(_key17, _componentsMenuMenuTypes[_key17]);
}
}, function (_componentsMenuMenuToggle) {
for (var _key18 in _componentsMenuMenuToggle) {
if (_key18 !== 'default') _export(_key18, _componentsMenuMenuToggle[_key18]);
}
}, function (_componentsMenuMenuClose) {
for (var _key19 in _componentsMenuMenuClose) {
if (_key19 !== 'default') _export(_key19, _componentsMenuMenuClose[_key19]);
}
}, function (_componentsLabelLabel) {
for (var _key20 in _componentsLabelLabel) {
if (_key20 !== 'default') _export(_key20, _componentsLabelLabel[_key20]);
}
}, function (_componentsListList) {
for (var _key21 in _componentsListList) {
if (_key21 !== 'default') _export(_key21, _componentsListList[_key21]);
}
}, function (_componentsShowHideWhenShowHideWhen) {
for (var _key22 in _componentsShowHideWhenShowHideWhen) {
if (_key22 !== 'default') _export(_key22, _componentsShowHideWhenShowHideWhen[_key22]);
}
}, function (_componentsModalModal) {
for (var _key23 in _componentsModalModal) {
if (_key23 !== 'default') _export(_key23, _componentsModalModal[_key23]);
}
}, function (_componentsNavNav) {
for (var _key24 in _componentsNavNav) {
if (_key24 !== 'default') _export(_key24, _componentsNavNav[_key24]);
}
}, function (_componentsNavNavController) {
for (var _key25 in _componentsNavNavController) {
if (_key25 !== 'default') _export(_key25, _componentsNavNavController[_key25]);
}
}, function (_componentsNavViewController) {
for (var _key26 in _componentsNavViewController) {
if (_key26 !== 'default') _export(_key26, _componentsNavViewController[_key26]);
}
}, function (_componentsNavNavParams) {
for (var _key27 in _componentsNavNavParams) {
if (_key27 !== 'default') _export(_key27, _componentsNavNavParams[_key27]);
}
}, function (_componentsNavNavPush) {
for (var _key28 in _componentsNavNavPush) {
if (_key28 !== 'default') _export(_key28, _componentsNavNavPush[_key28]);
}
}, function (_componentsNavNavRouter) {
for (var _key29 in _componentsNavNavRouter) {
if (_key29 !== 'default') _export(_key29, _componentsNavNavRouter[_key29]);
}
}, function (_componentsNavbarNavbar) {
for (var _key30 in _componentsNavbarNavbar) {
if (_key30 !== 'default') _export(_key30, _componentsNavbarNavbar[_key30]);
}
}, function (_componentsOptionOption) {
for (var _key31 in _componentsOptionOption) {
if (_key31 !== 'default') _export(_key31, _componentsOptionOption[_key31]);
}
}, function (_componentsOverlayOverlay) {
for (var _key32 in _componentsOverlayOverlay) {
if (_key32 !== 'default') _export(_key32, _componentsOverlayOverlay[_key32]);
}
}, function (_componentsSlidesSlides) {
for (var _key33 in _componentsSlidesSlides) {
if (_key33 !== 'default') _export(_key33, _componentsSlidesSlides[_key33]);
}
}, function (_componentsRadioRadioButton) {
for (var _key34 in _componentsRadioRadioButton) {
if (_key34 !== 'default') _export(_key34, _componentsRadioRadioButton[_key34]);
}
}, function (_componentsRadioRadioGroup) {
for (var _key35 in _componentsRadioRadioGroup) {
if (_key35 !== 'default') _export(_key35, _componentsRadioRadioGroup[_key35]);
}
}, function (_componentsRefresherRefresher) {
for (var _key36 in _componentsRefresherRefresher) {
if (_key36 !== 'default') _export(_key36, _componentsRefresherRefresher[_key36]);
}
}, function (_componentsRefresherRefresherContent) {
for (var _key37 in _componentsRefresherRefresherContent) {
if (_key37 !== 'default') _export(_key37, _componentsRefresherRefresherContent[_key37]);
}
}, function (_componentsScrollScroll) {
for (var _key38 in _componentsScrollScroll) {
if (_key38 !== 'default') _export(_key38, _componentsScrollScroll[_key38]);
}
}, function (_componentsSearchbarSearchbar) {
for (var _key39 in _componentsSearchbarSearchbar) {
if (_key39 !== 'default') _export(_key39, _componentsSearchbarSearchbar[_key39]);
}
}, function (_componentsSegmentSegment) {
for (var _key40 in _componentsSegmentSegment) {
if (_key40 !== 'default') _export(_key40, _componentsSegmentSegment[_key40]);
}
}, function (_componentsSelectSelect) {
for (var _key41 in _componentsSelectSelect) {
if (_key41 !== 'default') _export(_key41, _componentsSelectSelect[_key41]);
}
}, function (_componentsTabsTabs) {
for (var _key42 in _componentsTabsTabs) {
if (_key42 !== 'default') _export(_key42, _componentsTabsTabs[_key42]);
}
}, function (_componentsTabsTab) {
for (var _key43 in _componentsTabsTab) {
if (_key43 !== 'default') _export(_key43, _componentsTabsTab[_key43]);
}
}, function (_componentsTapClickTapClick) {
for (var _key44 in _componentsTapClickTapClick) {
if (_key44 !== 'default') _export(_key44, _componentsTapClickTapClick[_key44]);
}
}, function (_componentsToggleToggle) {
for (var _key45 in _componentsToggleToggle) {
if (_key45 !== 'default') _export(_key45, _componentsToggleToggle[_key45]);
}
}, function (_componentsToolbarToolbar) {
for (var _key46 in _componentsToolbarToolbar) {
if (_key46 !== 'default') _export(_key46, _componentsToolbarToolbar[_key46]);
}
}],
execute: function () {}
};
});
System.register('ionic-angular/index', ['./config/modes', './platform/registry', './animations/builtins', './transitions/transition-ios', './transitions/transition-md', './config/bootstrap', './config/config', './config/directives', './decorators/app', './decorators/page', './components', './platform/platform', './platform/storage', './util/click-block', './util/events', './util/keyboard', './util/form', './animations/animation', './transitions/transition', './translation/translate', './translation/translate_pipe'], function (_export) {
'use strict';
return {
setters: [function (_configModes) {}, function (_platformRegistry) {}, function (_animationsBuiltins) {}, function (_transitionsTransitionIos) {}, function (_transitionsTransitionMd) {}, function (_configBootstrap) {
for (var _key in _configBootstrap) {
if (_key !== 'default') _export(_key, _configBootstrap[_key]);
}
}, function (_configConfig) {
for (var _key2 in _configConfig) {
if (_key2 !== 'default') _export(_key2, _configConfig[_key2]);
}
}, function (_configDirectives) {
for (var _key3 in _configDirectives) {
if (_key3 !== 'default') _export(_key3, _configDirectives[_key3]);
}
}, function (_decoratorsApp) {
for (var _key4 in _decoratorsApp) {
if (_key4 !== 'default') _export(_key4, _decoratorsApp[_key4]);
}
}, function (_decoratorsPage) {
for (var _key5 in _decoratorsPage) {
if (_key5 !== 'default') _export(_key5, _decoratorsPage[_key5]);
}
}, function (_components) {
for (var _key6 in _components) {
if (_key6 !== 'default') _export(_key6, _components[_key6]);
}
}, function (_platformPlatform) {
for (var _key7 in _platformPlatform) {
if (_key7 !== 'default') _export(_key7, _platformPlatform[_key7]);
}
}, function (_platformStorage) {
for (var _key8 in _platformStorage) {
if (_key8 !== 'default') _export(_key8, _platformStorage[_key8]);
}
}, function (_utilClickBlock) {
for (var _key9 in _utilClickBlock) {
if (_key9 !== 'default') _export(_key9, _utilClickBlock[_key9]);
}
}, function (_utilEvents) {
for (var _key10 in _utilEvents) {
if (_key10 !== 'default') _export(_key10, _utilEvents[_key10]);
}
}, function (_utilKeyboard) {
for (var _key11 in _utilKeyboard) {
if (_key11 !== 'default') _export(_key11, _utilKeyboard[_key11]);
}
}, function (_utilForm) {
for (var _key12 in _utilForm) {
if (_key12 !== 'default') _export(_key12, _utilForm[_key12]);
}
}, function (_animationsAnimation) {
for (var _key13 in _animationsAnimation) {
if (_key13 !== 'default') _export(_key13, _animationsAnimation[_key13]);
}
}, function (_transitionsTransition) {
for (var _key14 in _transitionsTransition) {
if (_key14 !== 'default') _export(_key14, _transitionsTransition[_key14]);
}
}, function (_translationTranslate) {
for (var _key15 in _translationTranslate) {
if (_key15 !== 'default') _export(_key15, _translationTranslate[_key15]);
}
}, function (_translationTranslate_pipe) {
for (var _key16 in _translationTranslate_pipe) {
if (_key16 !== 'default') _export(_key16, _translationTranslate_pipe[_key16]);
}
}],
execute: function () {}
};
});
System.register('ionic-angular/util', ['./util/dom', './util/util'], function (_export) {
'use strict';
var domUtil, dom;
return {
setters: [function (_utilDom) {
domUtil = _utilDom;
}, function (_utilUtil) {
for (var _key in _utilUtil) {
if (_key !== 'default') _export(_key, _utilUtil[_key]);
}
}],
execute: function () {
dom = domUtil;
_export('dom', dom);
}
};
});
System.register('ionic-angular/animations/animation', ['../util/dom', '../util/util'], function (_export) {
/**
* @private
**/
'use strict';
var CSS, rafFrames, transitionEnd, assign, isDefined, Animation, TRANSFORMS, CSS_VALUE_REGEX, AnimationRegistry;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
return {
setters: [function (_utilDom) {
CSS = _utilDom.CSS;
rafFrames = _utilDom.rafFrames;
transitionEnd = _utilDom.transitionEnd;
}, function (_utilUtil) {
assign = _utilUtil.assign;
isDefined = _utilUtil.isDefined;
}],
execute: function () {
Animation = (function () {
function Animation(ele) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, Animation);
this._wChg = false;
this._rv = false;
this._lastUpd = 0;
this.isPlaying = false;
this.hasTween = false;
this.hasCompleted = false;
this._reset();
this.element(ele);
this._opts = assign({
renderDelay: 24
}, opts);
}
_createClass(Animation, [{
key: '_reset',
value: function _reset() {
this._el = [];
this._c = [];
this._fx = {};
this._bfSty = {};
this._bfAdd = [];
this._bfRmv = [];
this._afSty = {};
this._afAdd = [];
this._afRmv = [];
this._pFns = [];
this._fFns = [];
this._fOnceFns = [];
}
}, {
key: 'element',
value: function element(ele) {
var i;
if (ele) {
if (Array.isArray(ele)) {
for (i = 0; i < ele.length; i++) {
this._addEle(ele[i]);
}
} else if (typeof ele === 'string') {
ele = document.querySelectorAll(ele);
for (i = 0; i < ele.length; i++) {
this._addEle(ele[i]);
}
} else {
this._addEle(ele);
}
}
return this;
}
}, {
key: '_addEle',
value: function _addEle(ele) {
if (ele.nativeElement) {
ele = ele.nativeElement;
}
if (ele.nodeType === 1) {
this._el.push(ele);
// does this element suport will-change property?
this._wChg = typeof ele.style.willChange !== 'undefined';
}
}
}, {
key: 'parent',
value: function parent(parentAnimation) {
this._parent = parentAnimation;
return this;
}
}, {
key: 'add',
value: function add(childAnimation) {
childAnimation.parent(this);
this._c.push(childAnimation);
return this;
}
}, {
key: 'getDuration',
value: function getDuration() {
return this._dur !== null ? this._dur : this._parent && this._parent.getDuration() || 0;
}
}, {
key: 'duration',
value: function duration(milliseconds) {
this._dur = milliseconds;
return this;
}
}, {
key: 'getEasing',
value: function getEasing() {
return this._easing !== null ? this._easing : this._parent && this._parent.getEasing() || null;
}
}, {
key: 'easing',
value: function easing(name) {
this._easing = name;
return this;
}
}, {
key: 'from',
value: function from(prop, val) {
this._addProp('from', prop, val);
return this;
}
}, {
key: 'to',
value: function to(prop, val, clearProperyAfterTransition) {
var fx = this._addProp('to', prop, val);
if (clearProperyAfterTransition) {
// if this effect is a transform then clear the transform effect
// otherwise just clear the actual property
this.after.clearStyles([fx.trans ? CSS.transform : prop]);
}
return this;
}
}, {
key: 'fromTo',
value: function fromTo(prop, fromVal, toVal, clearProperyAfterTransition) {
return this.from(prop, fromVal).to(prop, toVal, clearProperyAfterTransition);
}
}, {
key: '_addProp',
value: function _addProp(state, prop, val) {
var fxProp = this._fx[prop];
if (!fxProp) {
// first time we've see this EffectProperty
fxProp = this._fx[prop] = {
trans: typeof TRANSFORMS[prop] !== 'undefined',
wc: ''
};
// add the will-change property fo transforms or opacity
if (fxProp.trans) {
fxProp.wc = CSS.transform;
} else if (prop === 'opacity') {
fxProp.wc = prop;
}
}
// add from/to EffectState to the EffectProperty
var fxState = fxProp[state] = {
val: val,
num: null,
unit: ''
};
if (typeof val === 'string' && val.indexOf(' ') < 0) {
var r = val.match(CSS_VALUE_REGEX);
var num = parseFloat(r[1]);
if (!isNaN(num)) {
fxState.num = num;
}
fxState.unit = r[0] != r[2] ? r[2] : '';
} else if (typeof val === 'number') {
fxState.num = val;
}
return fxProp;
}
}, {
key: 'fadeIn',
value: function fadeIn() {
return this.fromTo('opacity', 0.001, 1, true);
}
}, {
key: 'fadeOut',
value: function fadeOut() {
return this.fromTo('opacity', 0.999, 0);
}
}, {
key: 'play',
value: function play() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var self = this;
var i;
var duration = isDefined(opts.duration) ? opts.duration : self._dur;
void 0;
// always default that an animation does not tween
// a tween requires that an Animation class has an element
// and that it has at least one FROM/TO effect
// and that the FROM/TO effect can tween numeric values
self.hasTween = false;
self.hasCompleted = false;
// fire off all the onPlays
for (i = 0; i < self._pFns.length; i++) {
self._pFns[i]();
}
self.isPlaying = true;
// this is the top level animation and is in full control
// of when the async play() should actually kick off
// if there is no duration then it'll set the TO property immediately
// if there is a duration, then it'll stage all animations at the
// FROM property and transition duration, wait a few frames, then
// kick off the animation by setting the TO property for each animation
// stage all of the before css classes and inline styles
// will recursively stage all child elements
self._before();
// ensure all past transition end events have been cleared
self._clearAsync();
if (duration > 30) {
// this animation has a duration, so it should animate
// place all the elements with their FROM properties
// set the FROM properties
self._progress(0);
// add the will-change or translateZ properties when applicable
self._willChg(true);
// set the async TRANSITION END event
// and run onFinishes when the transition ends
self._asyncEnd(duration, true);
// begin each animation when everything is rendered in their place
// and the transition duration/easing is ready to go
rafFrames(self._opts.renderDelay / 16, function () {
// there's been a moment and the elements are in place
// now set the TRANSITION duration/easing
self._setTrans(duration, false);
// wait a few moments again to wait for the transition
// info to take hold in the DOM
rafFrames(2, function () {
// browser had some time to render everything in place
// and the transition duration/easing is set
// now set the TO properties
// which will trigger the transition to begin
self._progress(1);
});
});
} else {
// this animation does not have a duration, so it should not animate
// just go straight to the TO properties and call it done
self._progress(1);
// since there was no animation, immediately run the after
self._after();
// since there was no animation, it's done
// fire off all the onFinishes
self._didFinish(true);
}
}
}, {
key: 'stop',
value: function stop() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var self = this;
var duration = isDefined(opts.duration) ? opts.duration : 0;
var stepValue = isDefined(opts.stepValue) ? opts.stepValue : 1;
// ensure all past transition end events have been cleared
this._clearAsync();
// set the TO properties
self._progress(stepValue);
if (duration > 30) {
// this animation has a duration, so it should animate
// place all the elements with their TO properties
// now set the TRANSITION duration
self._setTrans(duration, true);
// set the async TRANSITION END event
// and run onFinishes when the transition ends
self._asyncEnd(duration, false);
} else {
// this animation does not have a duration, so it should not animate
// just go straight to the TO properties and call it done
self._after();
// since there was no animation, it's done
// fire off all the onFinishes
self._didFinish(false);
}
}
}, {
key: '_asyncEnd',
value: function _asyncEnd(duration, shouldComplete) {
var self = this;
function onTransitionEnd(ev) {
void 0;
// ensure transition end events and timeouts have been cleared
self._clearAsync();
// set the after styles
self._after();
// remove will change properties
self._willChg(false);
// transition finished
self._didFinish(shouldComplete);
}
function onTransitionFallback() {
void 0;
// oh noz! the transition end event didn't fire in time!
// instead the fallback timer when first
// clear the other async end events from firing
self._tmr = 0;
self._clearAsync();
// too late to have a smooth animation, just finish it
self._setTrans(0, true);
// ensure the ending progress step gets rendered
self._progress(1);
// set the after styles
self._after();
// remove will change properties
self._willChg(false);
// transition finished
self._didFinish(shouldComplete);
}
// set the TRANSITION END event on one of the transition elements
self._unregTrans = transitionEnd(self._transEl(), onTransitionEnd);
// set a fallback timeout if the transition end event never fires, or is too slow
// transition end fallback: (animation duration + XXms)
self._tmr = setTimeout(onTransitionFallback, duration + 400);
}
}, {
key: '_clearAsync',
value: function _clearAsync() {
this._unregTrans && this._unregTrans();
if (this._tmr) {
clearTimeout(this._tmr);
this._tmr = 0;
}
}
}, {
key: '_progress',
value: function _progress(stepValue) {
// bread 'n butter
var i;
var prop;
var fx;
var val;
var transforms;
var tweenEffect;
for (i = 0; i < this._c.length; i++) {
this._c[i]._progress(stepValue);
}
if (this._el.length) {
// flip the number if we're going in reverse
if (this._rv) {
stepValue = stepValue * -1 + 1;
}
transforms = [];
for (prop in this._fx) {
fx = this._fx[prop];
if (fx.from && fx.to) {
tweenEffect = fx.from.num !== fx.to.num;
if (tweenEffect) {
this.hasTween = true;
}
if (stepValue === 0) {
// FROM
val = fx.from.val;
} else if (stepValue === 1) {
// TO
val = fx.to.val;
} else if (tweenEffect) {
// EVERYTHING IN BETWEEN
val = (fx.to.num - fx.from.num) * stepValue + fx.from.num + fx.to.unit;
} else {
val = null;
}
if (val !== null) {
if (fx.trans) {
transforms.push(prop + '(' + val + ')');
} else {
for (i = 0; i < this._el.length; i++) {
this._el[i].style[prop] = val;
}
}
}
}
}
// place all transforms on the same property
if (transforms.length) {
if (!this._wChg) {
// if the element doesn't support will-change
// then auto add translateZ for transform properties
transforms.push('translateZ(0px)');
}
for (i = 0; i < this._el.length; i++) {
this._el[i].style[CSS.transform] = transforms.join(' ');
}
}
}
}
}, {
key: '_setTrans',
value: function _setTrans(duration, forcedLinearEasing) {
var i;
var easing;
// set the TRANSITION properties inline on the element
for (i = 0; i < this._c.length; i++) {
this._c[i]._setTrans(duration, forcedLinearEasing);
}
if (Object.keys(this._fx).length) {
for (i = 0; i < this._el.length; i++) {
// all parent/child animations should have the same duration
this._el[i].style[CSS.transitionDuration] = duration + 'ms';
// each animation can have a different easing
easing = forcedLinearEasing ? 'linear' : this.getEasing();
if (easing) {
this._el[i].style[CSS.transitionTimingFn] = easing;
}
}
}
}
}, {
key: '_willChg',
value: function _willChg(addWillChange) {
var i;
var wc;
var prop;
for (i = 0; i < this._c.length; i++) {
this._c[i]._willChg(addWillChange);
}
if (this._wChg) {
wc = [];
if (addWillChange) {
for (prop in this._fx) {
if (this._fx[prop].wc !== '') {
wc.push(this._fx[prop].wc);
}
}
}
for (i = 0; i < this._el.length; i++) {
this._el[i].style['willChange'] = wc.join(',');
}
}
}
}, {
key: '_before',
value: function _before() {
// before the RENDER_DELAY
// before the animations have started
var i;
var j;
var prop;
var ele;
// stage all of the child animations
for (i = 0; i < this._c.length; i++) {
this._c[i]._before();
}
if (!this._rv) {
for (i = 0; i < this._el.length; i++) {
ele = this._el[i];
// css classes to add before the animation
for (j = 0; j < this._bfAdd.length; j++) {
ele.classList.add(this._bfAdd[j]);
}
// css classes to remove before the animation
for (j = 0; j < this._bfRmv.length; j++) {
ele.classList.remove(this._bfRmv[j]);
}
// inline styles to add before the animation
for (prop in this._bfSty) {
ele.style[prop] = this._bfSty[prop];
}
}
}
}
}, {
key: '_after',
value: function _after() {
// after the animations have finished
var i;
var j;
var prop;
var ele;
for (i = 0; i < this._c.length; i++) {
this._c[i]._after();
}
for (i = 0; i < this._el.length; i++) {
ele = this._el[i];
// remove the transition duration/easing
ele.style[CSS.transitionDuration] = '';
ele.style[CSS.transitionTimingFn] = '';
if (this._rv) {
// finished in reverse direction
// css classes that were added before the animation should be removed
for (j = 0; j < this._bfAdd.length; j++) {
ele.classList.remove(this._bfAdd[j]);
}
// css classes that were removed before the animation should be added
for (j = 0; j < this._bfRmv.length; j++) {
ele.classList.add(this._bfRmv[j]);
}
// inline styles that were added before the animation should be removed
for (prop in this._bfSty) {
ele.style[prop] = '';
}
} else {
// finished in forward direction
// css classes to add after the animation
for (j = 0; j < this._afAdd.length; j++) {
ele.classList.add(this._afAdd[j]);
}
// css classes to remove after the animation
for (j = 0; j < this._afRmv.length; j++) {
ele.classList.remove(this._afRmv[j]);
}
// inline styles to add after the animation
for (prop in this._afSty) {
ele.style[prop] = this._afSty[prop];
}
}
}
}
}, {
key: 'progressStart',
value: function progressStart() {
for (var i = 0; i < this._c.length; i++) {
this._c[i].progressStart();
}
this._before();
// force no duration, linear easing
this._setTrans(0, true);
}
}, {
key: 'progressStep',
value: function progressStep(stepValue) {
var now = Date.now();
// only update if the last update was more than 16ms ago
if (now - 16 > this._lastUpd) {
this._lastUpd = now;
stepValue = Math.min(1, Math.max(0, stepValue));
for (var i = 0; i < this._c.length; i++) {
this._c[i].progressStep(stepValue);
}
if (this._rv) {
// if the animation is going in reverse then
// flip the step value: 0 becomes 1, 1 becomes 0
stepValue = stepValue * -1 + 1;
}
this._progress(stepValue);
}
}
}, {
key: 'progressEnd',
value: function progressEnd(shouldComplete, currentStepValue) {
void 0;
for (var i = 0; i < this._c.length; i++) {
this._c[i].progressEnd(shouldComplete, currentStepValue);
}
// set all the animations to their final position
this._progress(shouldComplete ? 1 : 0);
// if it's already at the final position, or close, then it's done
// otherwise we need to add a transition end event listener
if (currentStepValue < 0.05 || currentStepValue > 0.95) {
// the progress was already left off at the point that is finished
// for example, the left menu was dragged all the way open already
this._after();
this._willChg(false);
this._didFinish(shouldComplete);
} else {
// the stepValue was left off at a point when it needs to finish transition still
// for example, the left menu was opened 75% and needs to finish opening
this._asyncEnd(64, shouldComplete);
// force quick duration, linear easing
this._setTrans(64, true);
}
}
}, {
key: 'onPlay',
value: function onPlay(callback) {
this._pFns.push(callback);
return this;
}
}, {
key: 'onFinish',
value: function onFinish(callback) {
var onceTimeCallback = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var clearOnFinishCallacks = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];
if (clearOnFinishCallacks) {
this._fFns = [];
this._fOnceFns = [];
}
if (onceTimeCallback) {
this._fOnceFns.push(callback);
} else {
this._fFns.push(callback);
}
return this;
}
}, {
key: '_didFinish',
value: function _didFinish(hasCompleted) {
this.isPlaying = false;
this.hasCompleted = hasCompleted;
var i;
for (i = 0; i < this._fFns.length; i++) {
this._fFns[i](this);
}
for (i = 0; i < this._fOnceFns.length; i++) {
this._fOnceFns[i](this);
}
this._fOnceFns = [];
}
}, {
key: 'reverse',
value: function reverse() {
var shouldReverse = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
for (var i = 0; i < this._c.length; i++) {
this._c[i].reverse(shouldReverse);
}
this._rv = shouldReverse;
return this;
}
}, {
key: 'destroy',
value: function destroy(removeElement) {
var i;
var ele;
for (i = 0; i < this._c.length; i++) {
this._c[i].destroy(removeElement);
}
if (removeElement) {
for (i = 0; i < this._el.length; i++) {
ele = this._el[i];
ele.parentNode && ele.parentNode.removeChild(ele);
}
}
this._clearAsync();
this._reset();
}
}, {
key: '_transEl',
value: function _transEl() {
// get the lowest level element that has an Animation
var i;
var targetEl;
for (i = 0; i < this._c.length; i++) {
targetEl = this._c[i]._transEl();
if (targetEl) {
return targetEl;
}
}
return this.hasTween && this._el.length ? this._el[0] : null;
}
/*
STATIC CLASSES
*/
}, {
key: 'before',
get: function get() {
var _this = this;
return {
addClass: function addClass(className) {
_this._bfAdd.push(className);
return _this;
},
removeClass: function removeClass(className) {
_this._bfRmv.push(className);
return _this;
},
setStyles: function setStyles(styles) {
_this._bfSty = styles;
return _this;
},
clearStyles: function clearStyles(propertyNames) {
for (var i = 0; i < propertyNames.length; i++) {
_this._bfSty[propertyNames[i]] = '';
}
return _this;
}
};
}
}, {
key: 'after',
get: function get() {
var _this2 = this;
return {
addClass: function addClass(className) {
_this2._afAdd.push(className);
return _this2;
},
removeClass: function removeClass(className) {
_this2._afRmv.push(className);
return _this2;
},
setStyles: function setStyles(styles) {
_this2._afSty = styles;
return _this2;
},
clearStyles: function clearStyles(propertyNames) {
for (var i = 0; i < propertyNames.length; i++) {
_this2._afSty[propertyNames[i]] = '';
}
return _this2;
}
};
}
}], [{
key: 'create',
value: function create(name) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var AnimationClass = AnimationRegistry[name];
if (!AnimationClass) {
// couldn't find an animation by the given name
// fallback to just the base Animation class
AnimationClass = Animation;
}
return new AnimationClass(null, opts);
}
}, {
key: 'register',
value: function register(name, AnimationClass) {
AnimationRegistry[name] = AnimationClass;
}
}]);
return Animation;
})();
_export('Animation', Animation);
TRANSFORMS = {
'translateX': 1, 'translateY': 1, 'translateZ': 1,
'scale': 1, 'scaleX': 1, 'scaleY': 1, 'scaleZ': 1,
'rotate': 1, 'rotateX': 1, 'rotateY': 1, 'rotateZ': 1,
'skewX': 1, 'skewY': 1, 'perspective': 1
};
CSS_VALUE_REGEX = /(^-?\d*\.?\d*)(.*)/;
AnimationRegistry = {};
}
};
});
System.register('ionic-angular/animations/builtins', ['./animation'], function (_export) {
'use strict';
var Animation, SlideIn, SlideOut, FadeIn, FadeOut;
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_animation) {
Animation = _animation.Animation;
}],
execute: function () {
SlideIn = (function (_Animation) {
_inherits(SlideIn, _Animation);
function SlideIn(element) {
_classCallCheck(this, SlideIn);
_get(Object.getPrototypeOf(SlideIn.prototype), 'constructor', this).call(this, element);
this.easing('cubic-bezier(0.1,0.7,0.1,1)').duration(400).fromTo('translateY', '100%', '0%');
}
return SlideIn;
})(Animation);
Animation.register('slide-in', SlideIn);
SlideOut = (function (_Animation2) {
_inherits(SlideOut, _Animation2);
function SlideOut(element) {
_classCallCheck(this, SlideOut);
_get(Object.getPrototypeOf(SlideOut.prototype), 'constructor', this).call(this, element);
this.easing('ease-out').duration(250).fromTo('translateY', '0%', '100%');
}
return SlideOut;
})(Animation);
Animation.register('slide-out', SlideOut);
FadeIn = (function (_Animation3) {
_inherits(FadeIn, _Animation3);
function FadeIn(element) {
_classCallCheck(this, FadeIn);
_get(Object.getPrototypeOf(FadeIn.prototype), 'constructor', this).call(this, element);
this.easing('ease-in').duration(400).fadeIn();
}
return FadeIn;
})(Animation);
Animation.register('fade-in', FadeIn);
FadeOut = (function (_Animation4) {
_inherits(FadeOut, _Animation4);
function FadeOut(element) {
_classCallCheck(this, FadeOut);
_get(Object.getPrototypeOf(FadeOut.prototype), 'constructor', this).call(this, element);
this.easing('ease-out').duration(250).fadeOut();
}
return FadeOut;
})(Animation);
Animation.register('fade-out', FadeOut);
}
};
});
System.register('ionic-angular/animations/scroll-to', ['../util/dom'], function (_export) {
'use strict';
var raf, ScrollTo;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
// decelerating to zero velocity
function easeOutCubic(t) {
return --t * t * t + 1;
}
return {
setters: [function (_utilDom) {
raf = _utilDom.raf;
}],
execute: function () {
ScrollTo = (function () {
function ScrollTo(ele) {
_classCallCheck(this, ScrollTo);
if (typeof ele === 'string') {
// string query selector
ele = document.querySelector(ele);
}
if (ele) {
if (ele.nativeElement) {
// angular ElementRef
ele = ele.nativeElement;
}
if (ele.nodeType === 1) {
this._el = ele;
}
}
}
_createClass(ScrollTo, [{
key: 'start',
value: function start(x, y, duration, tolerance) {
// scroll animation loop w/ easing
// credit https://gist.github.com/dezinezync/5487119
var self = this;
if (!self._el) {
// invalid element
return Promise.resolve();
}
x = x || 0;
y = y || 0;
tolerance = tolerance || 0;
var fromY = self._el.scrollTop;
var fromX = self._el.scrollLeft;
var xDistance = Math.abs(x - fromX);
var yDistance = Math.abs(y - fromY);
void 0;
if (yDistance <= tolerance && xDistance <= tolerance) {
// prevent scrolling if already close to there
self._el = null;
return Promise.resolve();
}
return new Promise(function (resolve, reject) {
var startTime = undefined;
// scroll loop
function step() {
if (!self._el) {
return resolve();
}
var time = Math.min(1, (Date.now() - startTime) / duration);
// where .5 would be 50% of time on a linear scale easedT gives a
// fraction based on the easing method
var easedT = easeOutCubic(time);
if (fromY != y) {
self._el.scrollTop = easedT * (y - fromY) + fromY;
}
if (fromX != x) {
self._el.scrollLeft = Math.round(easedT * (x - fromX) + fromX);
}
void 0;
if (time < 1 && self.isPlaying) {
raf(step);
} else if (!self.isPlaying) {
// stopped
self._el = null;
reject();
} else {
// done
self._el = null;
void 0;
resolve();
}
}
// start scroll loop
self.isPlaying = true;
// chill out for a frame first
raf(function () {
startTime = Date.now();
raf(step);
});
});
}
}, {
key: 'stop',
value: function stop() {
this.isPlaying = false;
}
}, {
key: 'dispose',
value: function dispose() {
this.stop();
this._el = null;
}
}]);
return ScrollTo;
})();
_export('ScrollTo', ScrollTo);
}
};
});
System.register('ionic-angular/components/ion', ['../util/dom'], function (_export) {
'use strict';
var dom, ids, Ion;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
return {
setters: [function (_utilDom) {
dom = _utilDom;
}],
execute: function () {
ids = 0;
/**
* Base class for all Ionic components. Exposes some common functionality
* that all Ionic components need, such as accessing underlying native elements and
* sending/receiving app-level events.
*/
Ion = (function () {
function Ion(elementRef) {
_classCallCheck(this, Ion);
this.elementRef = elementRef;
this._id = 'i' + ids++;
}
_createClass(Ion, [{
key: 'getElementRef',
value: function getElementRef() {
return this.elementRef;
}
}, {
key: 'getNativeElement',
value: function getNativeElement() {
return this.elementRef.nativeElement;
}
}, {
key: 'getDimensions',
value: function getDimensions() {
return dom.getDimensions(this.elementRef.nativeElement, this._id);
}
}, {
key: 'width',
value: function width() {
return dom.getDimensions(this.elementRef.nativeElement, this._id).width;
}
}, {
key: 'height',
value: function height() {
return dom.getDimensions(this.elementRef.nativeElement, this._id).height;
}
}, {
key: 'ngOnDestroy',
value: function ngOnDestroy() {
dom.clearDimensions(this._id);
}
}]);
return Ion;
})();
_export('Ion', Ion);
}
};
});
System.register('ionic-angular/config/bootstrap', ['angular2/core', 'angular2/router', 'angular2/http', '../util/click-block', './config', '../util/events', '../util/feature-detect', '../util/form', '../components/app/app', '../util/keyboard', '../components/menu/menu-controller', '../components/nav/nav-registry', '../platform/platform', '../util/dom', '../animations/scroll-to', '../components/tap-click/tap-click', '../translation/translate'], function (_export) {
/**
* @private
*/
'use strict';
var provide, ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy, HTTP_PROVIDERS, ClickBlock, Config, Events, FeatureDetect, Form, IonicApp, Keyboard, MenuController, NavRegistry, Platform, closest, ScrollTo, TapClick, Translate;
_export('ionicProviders', ionicProviders);
function ionicProviders() {
var args = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var platform = new Platform();
var navRegistry = new NavRegistry(args.pages);
var config = args.config;
if (!(config instanceof Config)) {
config = new Config(config);
}
platform.setUrl(window.location.href);
platform.setUserAgent(window.navigator.userAgent);
platform.setNavigatorPlatform(window.navigator.platform);
platform.load();
config.setPlatform(platform);
var clickBlock = new ClickBlock();
var events = new Events();
var featureDetect = new FeatureDetect();
setupDom(window, document, config, platform, clickBlock, featureDetect);
bindEvents(window, document, platform, events);
// prepare the ready promise to fire....when ready
platform.prepareReady(config);
return [IonicApp, provide(ClickBlock, { useValue: clickBlock }), provide(Config, { useValue: config }), provide(Platform, { useValue: platform }), provide(FeatureDetect, { useValue: featureDetect }), provide(Events, { useValue: events }), provide(NavRegistry, { useValue: navRegistry }), TapClick, Form, Keyboard, MenuController, Translate, ROUTER_PROVIDERS, provide(LocationStrategy, { useClass: HashLocationStrategy }), HTTP_PROVIDERS];
}
function setupDom(window, document, config, platform, clickBlock, featureDetect) {
var bodyEle = document.body;
var mode = config.get('mode');
// if dynamic mode links have been added the fire up the correct one
var modeLinkAttr = mode + '-href';
var linkEle = document.head.querySelector('link[' + modeLinkAttr + ']');
if (linkEle) {
var href = linkEle.getAttribute(modeLinkAttr);
linkEle.removeAttribute(modeLinkAttr);
linkEle.href = href;
}
// set the mode class name
// ios/md
bodyEle.classList.add(mode);
// language and direction
platform.setDir(document.documentElement.dir, false);
platform.setLang(document.documentElement.lang, false);
var versions = platform.versions();
platform.platforms().forEach(function (platformName) {
// platform-ios
var platformClass = 'platform-' + platformName;
bodyEle.classList.add(platformClass);
var platformVersion = versions[platformName];
if (platformVersion) {
// platform-ios9
platformClass += platformVersion.major;
bodyEle.classList.add(platformClass);
// platform-ios9_3
bodyEle.classList.add(platformClass + '_' + platformVersion.minor);
}
});
// touch devices should not use :hover CSS pseudo
// enable :hover CSS when the "hoverCSS" setting is not false
if (config.get('hoverCSS') !== false) {
bodyEle.classList.add('enable-hover');
}
if (config.get('clickBlock')) {
clickBlock.enable();
}
// run feature detection tests
featureDetect.run(window, document);
}
/**
* Bind some global events and publish on the 'app' channel
*/
function bindEvents(window, document, platform, events) {
window.addEventListener('online', function (ev) {
events.publish('app:online', ev);
}, false);
window.addEventListener('offline', function (ev) {
events.publish('app:offline', ev);
}, false);
window.addEventListener('orientationchange', function (ev) {
events.publish('app:rotated', ev);
});
// When that status taps, we respond
window.addEventListener('statusTap', function (ev) {
// TODO: Make this more better
var el = document.elementFromPoint(platform.width() / 2, platform.height() / 2);
if (!el) {
return;
}
var content = closest(el, 'scroll-content');
if (content) {
var scrollTo = new ScrollTo(content);
scrollTo.start(0, 0, 300, 0);
}
});
// start listening for resizes XXms after the app starts
setTimeout(function () {
window.addEventListener('resize', function () {
platform.windowResize();
});
}, 2000);
}
return {
setters: [function (_angular2Core) {
provide = _angular2Core.provide;
}, function (_angular2Router) {
ROUTER_PROVIDERS = _angular2Router.ROUTER_PROVIDERS;
LocationStrategy = _angular2Router.LocationStrategy;
HashLocationStrategy = _angular2Router.HashLocationStrategy;
}, function (_angular2Http) {
HTTP_PROVIDERS = _angular2Http.HTTP_PROVIDERS;
}, function (_utilClickBlock) {
ClickBlock = _utilClickBlock.ClickBlock;
}, function (_config) {
Config = _config.Config;
}, function (_utilEvents) {
Events = _utilEvents.Events;
}, function (_utilFeatureDetect) {
FeatureDetect = _utilFeatureDetect.FeatureDetect;
}, function (_utilForm) {
Form = _utilForm.Form;
}, function (_componentsAppApp) {
IonicApp = _componentsAppApp.IonicApp;
}, function (_utilKeyboard) {
Keyboard = _utilKeyboard.Keyboard;
}, function (_componentsMenuMenuController) {
MenuController = _componentsMenuMenuController.MenuController;
}, function (_componentsNavNavRegistry) {
NavRegistry = _componentsNavNavRegistry.NavRegistry;
}, function (_platformPlatform) {
Platform = _platformPlatform.Platform;
}, function (_utilDom) {
closest = _utilDom.closest;
}, function (_animationsScrollTo) {
ScrollTo = _animationsScrollTo.ScrollTo;
}, function (_componentsTapClickTapClick) {
TapClick = _componentsTapClickTapClick.TapClick;
}, function (_translationTranslate) {
Translate = _translationTranslate.Translate;
}],
execute: function () {}
};
});
System.register('ionic-angular/config/config', ['../platform/platform', '../util/util'], function (_export) {
/**
* @ngdoc service
* @name Config
* @module ionic
* @description
* Config allows you to set the modes of your components
*/
/**
* @name Config
* @demo /docs/v2/demos/config/
* @description
* Config lets you change multiple or a single value in an apps mode configuration. Things such as tab placement, icon changes, and view animations can be set here.
*
* ```ts
* @App({
* template: ``
* config: {
* backButtonText: 'Go Back',
* iconMode: 'ios',
* modalEnter: 'modal-slide-in',
* modalLeave: 'modal-slide-out',
* tabbarPlacement: 'bottom',
* pageTransition: 'ios',
* }
* })
* ```
*
* Or change the whole mode
*
* ```ts
* @App({
* template: ``
* config: {
* mode: 'md'
* }
* })
* ```
*
* Config can be overwritting at multiple levels, allowing deeper configuration. Taking the example from earlier, we can override any setting we want based on a platform.
* ```ts
* @App({
* template: ``
* config: {
* tabbarPlacement: 'bottom',
* platforms: {
* ios: {
* tabbarPlacement: 'top',
* }
* }
* }
* })
* ```
*
* We could also configure these values at a component level. Take `tabbarPlacement`, we can configure this as a property on our `ion-tabs`.
*
* ```html
*
*
*
* ```
*
* The property will override anything else set in the apps.
*
* The last way we could configure is through URL query strings. This is useful for testing while in the browser.
* Simply add `?ionic=` to the url.
*
* ```bash
* http://localhost:8100/?ionicTabbarPlacement=bottom
* ```
*
* Custom values can be added to config, and looked up at a later point in time.
*
* ``` javascript
* config.set('ios', 'favoriteColor', 'green');
* // from any page in your app:
* config.get('favoriteColor'); // 'green'
* ```
*
*
* A config value can come from anywhere and be anything, but there are a default set of values.
*
*
* | Config property | Default iOS Value | Default MD Value |
* |----------------------------|------------------------|---------------------------|
* | activator | highlight | ripple |
* | actionSheetEnter | action-sheet-slide-in | action-sheet-md-slide-in |
* | actionSheetLeave | action-sheet-slide-out | action-sheet-md-slide-out |
* | alertEnter | alert-pop-in | alert-md-pop-in |
* | alertLeave | alert-pop-out | alert-md-pop-out |
* | backButtonText | Back | |
* | backButtonIcon | ion-ios-arrow-back | ion-md-arrow-back |
* | iconMode | ios | md |
* | menuType | reveal | overlay |
* | modalEnter | modal-slide-in | modal-md-slide-in |
* | modalLeave | modal-slide-out | modal-md-slide-out |
* | pageTransition | ios-transition | md-transition |
* | pageTransitionDelay | 16 | 120 |
* | tabbarPlacement | bottom | top |
* | tabbarHighlight | | top |
* | tabbarLayout | | |
* | tabSubPages | | true |
*
**/
'use strict';
var Platform, isObject, isDefined, isFunction, isArray, Config, modeConfigs;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
return {
setters: [function (_platformPlatform) {
Platform = _platformPlatform.Platform;
}, function (_utilUtil) {
isObject = _utilUtil.isObject;
isDefined = _utilUtil.isDefined;
isFunction = _utilUtil.isFunction;
isArray = _utilUtil.isArray;
}],
execute: function () {
Config = (function () {
function Config(config) {
_classCallCheck(this, Config);
this._c = {};
this._s = {};
this._s = config && isObject(config) && !isArray(config) ? config : {};
}
/**
* @name get
* @description
* Returns a single config value, given a key.
*
* @param {string} [key] - the key for the config value
* @param {any} [fallbackValue] - a fallback value to use when the config value was not found, or is config value is `null`. Fallback value defaults to `null`.
*/
_createClass(Config, [{
key: 'get',
value: function get(key) {
var fallbackValue = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
if (!isDefined(this._c[key])) {
if (!isDefined(key)) {
throw 'config key is not defined';
}
// if the value was already set this will all be skipped
// if there was no user config then it'll check each of
// the user config's platforms, which already contains
// settings from default platform configs
var userPlatformValue = undefined;
var userDefaultValue = this._s[key];
var userPlatformModeValue = undefined;
var userDefaultModeValue = undefined;
var platformValue = undefined;
var platformModeValue = undefined;
var configObj = null;
if (this.platform) {
var queryStringValue = this.platform.query('ionic' + key.toLowerCase());
if (isDefined(queryStringValue)) {
return this._c[key] = queryStringValue === 'true' ? true : queryStringValue === 'false' ? false : queryStringValue;
}
// check the platform settings object for this value
// loop though each of the active platforms
// array of active platforms, which also knows the hierarchy,
// with the last one the most important
var activePlatformKeys = this.platform.platforms();
// loop through all of the active platforms we're on
for (var i = 0, l = activePlatformKeys.length; i < l; i++) {
// get user defined platform values
if (this._s.platforms) {
configObj = this._s.platforms[activePlatformKeys[i]];
if (configObj) {
if (isDefined(configObj[key])) {
userPlatformValue = configObj[key];
}
configObj = Config.getModeConfig(configObj.mode);
if (configObj && isDefined(configObj[key])) {
userPlatformModeValue = configObj[key];
}
}
}
// get default platform's setting
configObj = Platform.get(activePlatformKeys[i]);
if (configObj && configObj.settings) {
if (isDefined(configObj.settings[key])) {
// found a setting for this platform
platformValue = configObj.settings[key];
}
configObj = Config.getModeConfig(configObj.settings.mode);
if (configObj && isDefined(configObj[key])) {
// found setting for this platform's mode
platformModeValue = configObj[key];
}
}
}
}
configObj = Config.getModeConfig(this._s.mode);
if (configObj && isDefined(configObj[key])) {
userDefaultModeValue = configObj[key];
}
// cache the value
this._c[key] = isDefined(userPlatformValue) ? userPlatformValue : isDefined(userDefaultValue) ? userDefaultValue : isDefined(userPlatformModeValue) ? userPlatformModeValue : isDefined(userDefaultModeValue) ? userDefaultModeValue : isDefined(platformValue) ? platformValue : isDefined(platformModeValue) ? platformModeValue : null;
}
// return key's value
// either it came directly from the user config
// or it was from the users platform configs
// or it was from the default platform configs
// in that order
var rtnVal = undefined;
if (isFunction(this._c[key])) {
rtnVal = this._c[key](this.platform);
} else {
rtnVal = this._c[key];
}
return rtnVal !== null ? rtnVal : fallbackValue;
}
/**
* @name getBoolean
* @description
* Same as `get()`, however always returns a boolean value.
*
* @param {string} [key] - the key for the config value
*/
}, {
key: 'getBoolean',
value: function getBoolean(key) {
var val = this.get(key);
return val || val === 'true' ? true : false;
}
/**
* @name set
* @description
* Sets a single config value.
*
* @param {string} [platform] - The platform (either 'ios' or 'android') that the config value should apply to. Leaving this blank will apply the config value to all platforms.
* @param {string} [key] - The key used to look up the value at a later point in time.
* @param {string} [value] - The config value being stored.
*/
}, {
key: 'set',
value: function set() {
var args = arguments;
var arg0 = args[0];
var arg1 = args[1];
switch (args.length) {
case 2:
// set('key', 'value') = set key/value pair
// arg1 = value
this._s[arg0] = arg1;
delete this._c[arg0]; // clear cache
break;
case 3:
// setting('ios', 'key', 'value') = set key/value pair for platform
// arg0 = platform
// arg1 = key
// arg2 = value
this._s.platforms = this._s.platforms || {};
this._s.platforms[arg0] = this._s.platforms[arg0] || {};
this._s.platforms[arg0][arg1] = args[2];
delete this._c[arg1]; // clear cache
break;
}
return this;
}
/**
* @private
* @name settings()
* @description
*/
}, {
key: 'settings',
value: function settings() {
var args = arguments;
switch (args.length) {
case 0:
return this._s;
case 1:
// settings({...})
this._s = args[0];
this._c = {}; // clear cache
break;
case 2:
// settings('ios', {...})
this._s.platforms = this._s.platforms || {};
this._s.platforms[args[0]] = args[1];
this._c = {}; // clear cache
break;
}
return this;
}
/**
* @private
*/
}, {
key: 'setPlatform',
value: function setPlatform(platform) {
this.platform = platform;
}
/**
* @private
*/
}], [{
key: 'setModeConfig',
value: function setModeConfig(mode, config) {
modeConfigs[mode] = config;
}
/**
* @private
*/
}, {
key: 'getModeConfig',
value: function getModeConfig(mode) {
return modeConfigs[mode] || null;
}
}]);
return Config;
})();
_export('Config', Config);
modeConfigs = {};
}
};
});
System.register('ionic-angular/config/directives', ['angular2/common', '../components/overlay/overlay', '../components/menu/menu', '../components/menu/menu-toggle', '../components/menu/menu-close', '../components/badge/badge', '../components/button/button', '../components/blur/blur', '../components/content/content', '../components/scroll/scroll', '../components/infinite-scroll/infinite-scroll', '../components/infinite-scroll/infinite-scroll-content', '../components/refresher/refresher', '../components/refresher/refresher-content', '../components/slides/slides', '../components/tabs/tabs', '../components/tabs/tab', '../components/list/list', '../components/item/item', '../components/item/item-sliding', '../components/toolbar/toolbar', '../components/icon/icon', '../components/spinner/spinner', '../components/checkbox/checkbox', '../components/select/select', '../components/option/option', '../components/toggle/toggle', '../components/input/input', '../components/label/label', '../components/segment/segment', '../components/radio/radio-button', '../components/radio/radio-group', '../components/searchbar/searchbar', '../components/nav/nav', '../components/nav/nav-push', '../components/nav/nav-router', '../components/navbar/navbar', '../components/app/id', '../components/show-hide-when/show-hide-when'], function (_export) {
/**
* @name IONIC_DIRECTIVES
* @private
* @description
* The core Ionic directives as well as Angular's CORE_DIRECTIVES and
* FORM_DIRECTIVES. Automatically available in every [@Page](../Page/) template.
*
* **Angular**
* - CORE_DIRECTIVES
* - FORM_DIRECTIVES
*
* **Content**
* - Menu
* - MenuToggle
* - MenuClose
*
* - Button
* - Blur
* - Content
* - Scroll
* - InfiniteScroll
* - InfiniteScrollContent
* - Refresher
* - RefresherContent
*
* **Lists**
* - List
* - ListHeader
* - Item
* - ItemSliding
*
* **Slides**
* - Slides
* - Slide
* - SlideLazy
*
* **Tabs**
* - Tabs
* - Tab
*
* **Toolbar**
* - Toolbar
* - ToolbarTitle
* - ToolbarItem
*
* **Media**
* - Icon
* - Spinner
*
* **Forms**
* - Searchbar
* - Segment
* - SegmentButton
* - Checkbox
* - RadioGroup
* - RadioButton
* - Select
* - Option
* - Toggle
* - TextInput
* - Label
*
* **Nav**
* - Nav
* - NavbarTemplate
* - Navbar
* - NavPush
* - NavPop
* - NavRouter
* - IdRef
*
* - ShowWhen
* - HideWhen
*/
'use strict';
var CORE_DIRECTIVES, FORM_DIRECTIVES, OverlayNav, Menu, MenuToggle, MenuClose, Badge, Button, Blur, Content, Scroll, InfiniteScroll, InfiniteScrollContent, Refresher, RefresherContent, Slides, Slide, SlideLazy, Tabs, Tab, List, ListHeader, Item, ItemSliding, Toolbar, ToolbarTitle, ToolbarItem, Icon, Spinner, Checkbox, Select, Option, Toggle, TextInput, TextArea, Label, Segment, SegmentButton, RadioButton, RadioGroup, Searchbar, SearchbarInput, Nav, NavPush, NavPop, NavRouter, NavbarTemplate, Navbar, IdRef, ShowWhen, HideWhen, IONIC_DIRECTIVES;
return {
setters: [function (_angular2Common) {
CORE_DIRECTIVES = _angular2Common.CORE_DIRECTIVES;
FORM_DIRECTIVES = _angular2Common.FORM_DIRECTIVES;
}, function (_componentsOverlayOverlay) {
OverlayNav = _componentsOverlayOverlay.OverlayNav;
}, function (_componentsMenuMenu) {
Menu = _componentsMenuMenu.Menu;
}, function (_componentsMenuMenuToggle) {
MenuToggle = _componentsMenuMenuToggle.MenuToggle;
}, function (_componentsMenuMenuClose) {
MenuClose = _componentsMenuMenuClose.MenuClose;
}, function (_componentsBadgeBadge) {
Badge = _componentsBadgeBadge.Badge;
}, function (_componentsButtonButton) {
Button = _componentsButtonButton.Button;
}, function (_componentsBlurBlur) {
Blur = _componentsBlurBlur.Blur;
}, function (_componentsContentContent) {
Content = _componentsContentContent.Content;
}, function (_componentsScrollScroll) {
Scroll = _componentsScrollScroll.Scroll;
}, function (_componentsInfiniteScrollInfiniteScroll) {
InfiniteScroll = _componentsInfiniteScrollInfiniteScroll.InfiniteScroll;
}, function (_componentsInfiniteScrollInfiniteScrollContent) {
InfiniteScrollContent = _componentsInfiniteScrollInfiniteScrollContent.InfiniteScrollContent;
}, function (_componentsRefresherRefresher) {
Refresher = _componentsRefresherRefresher.Refresher;
}, function (_componentsRefresherRefresherContent) {
RefresherContent = _componentsRefresherRefresherContent.RefresherContent;
}, function (_componentsSlidesSlides) {
Slides = _componentsSlidesSlides.Slides;
Slide = _componentsSlidesSlides.Slide;
SlideLazy = _componentsSlidesSlides.SlideLazy;
}, function (_componentsTabsTabs) {
Tabs = _componentsTabsTabs.Tabs;
}, function (_componentsTabsTab) {
Tab = _componentsTabsTab.Tab;
}, function (_componentsListList) {
List = _componentsListList.List;
ListHeader = _componentsListList.ListHeader;
}, function (_componentsItemItem) {
Item = _componentsItemItem.Item;
}, function (_componentsItemItemSliding) {
ItemSliding = _componentsItemItemSliding.ItemSliding;
}, function (_componentsToolbarToolbar) {
Toolbar = _componentsToolbarToolbar.Toolbar;
ToolbarTitle = _componentsToolbarToolbar.ToolbarTitle;
ToolbarItem = _componentsToolbarToolbar.ToolbarItem;
}, function (_componentsIconIcon) {
Icon = _componentsIconIcon.Icon;
}, function (_componentsSpinnerSpinner) {
Spinner = _componentsSpinnerSpinner.Spinner;
}, function (_componentsCheckboxCheckbox) {
Checkbox = _componentsCheckboxCheckbox.Checkbox;
}, function (_componentsSelectSelect) {
Select = _componentsSelectSelect.Select;
}, function (_componentsOptionOption) {
Option = _componentsOptionOption.Option;
}, function (_componentsToggleToggle) {
Toggle = _componentsToggleToggle.Toggle;
}, function (_componentsInputInput) {
TextInput = _componentsInputInput.TextInput;
TextArea = _componentsInputInput.TextArea;
}, function (_componentsLabelLabel) {
Label = _componentsLabelLabel.Label;
}, function (_componentsSegmentSegment) {
Segment = _componentsSegmentSegment.Segment;
SegmentButton = _componentsSegmentSegment.SegmentButton;
}, function (_componentsRadioRadioButton) {
RadioButton = _componentsRadioRadioButton.RadioButton;
}, function (_componentsRadioRadioGroup) {
RadioGroup = _componentsRadioRadioGroup.RadioGroup;
}, function (_componentsSearchbarSearchbar) {
Searchbar = _componentsSearchbarSearchbar.Searchbar;
SearchbarInput = _componentsSearchbarSearchbar.SearchbarInput;
}, function (_componentsNavNav) {
Nav = _componentsNavNav.Nav;
}, function (_componentsNavNavPush) {
NavPush = _componentsNavNavPush.NavPush;
NavPop = _componentsNavNavPush.NavPop;
}, function (_componentsNavNavRouter) {
NavRouter = _componentsNavNavRouter.NavRouter;
}, function (_componentsNavbarNavbar) {
NavbarTemplate = _componentsNavbarNavbar.NavbarTemplate;
Navbar = _componentsNavbarNavbar.Navbar;
}, function (_componentsAppId) {
IdRef = _componentsAppId.IdRef;
}, function (_componentsShowHideWhenShowHideWhen) {
ShowWhen = _componentsShowHideWhenShowHideWhen.ShowWhen;
HideWhen = _componentsShowHideWhenShowHideWhen.HideWhen;
}],
execute: function () {
IONIC_DIRECTIVES = [
// Angular
CORE_DIRECTIVES, FORM_DIRECTIVES,
// Content
OverlayNav, Menu, MenuToggle, MenuClose, Badge, Button, Blur, Content, Scroll, InfiniteScroll, InfiniteScrollContent, Refresher, RefresherContent,
// Lists
List, ListHeader, Item, ItemSliding,
// Slides
Slides, Slide, SlideLazy,
// Tabs
Tabs, Tab,
// Toolbar
Toolbar, ToolbarTitle, ToolbarItem,
// Media
Icon, Spinner,
// Forms
Searchbar, SearchbarInput, Segment, SegmentButton, Checkbox, RadioGroup, RadioButton, Select, Option, Toggle, TextArea, TextInput, Label,
// Nav
Nav, NavbarTemplate, Navbar, NavPush, NavPop, NavRouter, IdRef, ShowWhen, HideWhen];
_export('IONIC_DIRECTIVES', IONIC_DIRECTIVES);
}
};
});
System.register('ionic-angular/config/modes', ['./config'], function (_export) {
// iOS Mode Settings
'use strict';
var Config;
return {
setters: [function (_config) {
Config = _config.Config;
}],
execute: function () {
Config.setModeConfig('ios', {
activator: 'highlight',
actionSheetEnter: 'action-sheet-slide-in',
actionSheetLeave: 'action-sheet-slide-out',
alertEnter: 'alert-pop-in',
alertLeave: 'alert-pop-out',
backButtonText: 'Back',
backButtonIcon: 'ios-arrow-back',
iconMode: 'ios',
menuType: 'reveal',
modalEnter: 'modal-slide-in',
modalLeave: 'modal-slide-out',
pageTransition: 'ios-transition',
pageTransitionDelay: 16,
spinner: 'ios',
tabbarPlacement: 'bottom'
});
// Material Design Mode Settings
Config.setModeConfig('md', {
activator: 'ripple',
actionSheetEnter: 'action-sheet-md-slide-in',
actionSheetLeave: 'action-sheet-md-slide-out',
alertEnter: 'alert-md-pop-in',
alertLeave: 'alert-md-pop-out',
backButtonText: '',
backButtonIcon: 'md-arrow-back',
iconMode: 'md',
menuType: 'overlay',
modalEnter: 'modal-md-slide-in',
modalLeave: 'modal-md-slide-out',
pageTransition: 'md-transition',
pageTransitionDelay: 96,
spinner: 'crescent',
tabbarHighlight: true,
tabbarPlacement: 'top',
tabSubPages: true
});
}
};
});
System.register('ionic-angular/decorators/app', ['angular2/core', 'angular2/platform/browser', '../components/app/app', '../components/tap-click/tap-click', '../config/bootstrap', '../config/directives'], function (_export) {
'use strict';
var Component, enableProdMode, bootstrap, IonicApp, TapClick, ionicProviders, IONIC_DIRECTIVES, _reflect;
_export('App', App);
/**
* @name App
* @description
* App is an Ionic decorator that bootstraps an application. It can be passed a
* number of arguments that act as global config variables for the app.
* `@App` is similar to Angular's `@Component` in which it can accept a `template`
* property that has an inline template, or a `templateUrl` property that points
* to an external html template.
*
* @usage
* ```ts
* import {App} from 'ionic-angular';
*
* @App({
* templateUrl: 'app/app.html',
* providers: [DataService]
* })
*
* export class MyApp{
* // Anything we would want to do at the root of our app
* }
* ```
*
* @property {object} [config] - the app's {@link /docs/v2/api/config/Config/ Config} object.
* @property {boolean} [prodMode] - Enable Angular's production mode, which turns off assertions and other checks within the framework. Additionally, this config sets the return value of `isProd()` which is on the `IonicApp` instance. Defaults to `false`.
* @property {array} [pipes] - any pipes for your app.
* @property {array} [providers] - any providers for your app.
* @property {string} [template] - the template to use for the app root.
* @property {string} [templateUrl] - a relative URL pointing to the template to use for the app root.
*/
function App() {
var args = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
return function (cls) {
// get current annotations
var annotations = _reflect.getMetadata('annotations', cls) || [];
args.selector = 'ion-app';
// auto add Ionic directives
args.directives = args.directives ? args.directives.concat(IONIC_DIRECTIVES) : IONIC_DIRECTIVES;
// if no template was provided, default so it has a root
if (!args.templateUrl && !args.template) {
args.template = '';
}
// create @Component
annotations.push(new Component(args));
// redefine with added annotations
_reflect.defineMetadata('annotations', annotations, cls);
// define array of bootstrap providers
var providers = ionicProviders(args).concat(args.providers || []);
if (args.prodMode) {
enableProdMode();
}
bootstrap(cls, providers).then(function (appRef) {
appRef.injector.get(TapClick);
var app = appRef.injector.get(IonicApp);
app.setProd(args.prodMode);
});
return cls;
};
}
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
enableProdMode = _angular2Core.enableProdMode;
}, function (_angular2PlatformBrowser) {
bootstrap = _angular2PlatformBrowser.bootstrap;
}, function (_componentsAppApp) {
IonicApp = _componentsAppApp.IonicApp;
}, function (_componentsTapClickTapClick) {
TapClick = _componentsTapClickTapClick.TapClick;
}, function (_configBootstrap) {
ionicProviders = _configBootstrap.ionicProviders;
}, function (_configDirectives) {
IONIC_DIRECTIVES = _configDirectives.IONIC_DIRECTIVES;
}],
execute: function () {
_reflect = Reflect;
}
};
});
System.register('ionic-angular/decorators/page', ['angular2/core', '../config/directives'], function (_export) {
'use strict';
var Component, IONIC_DIRECTIVES, _reflect;
_export('Page', Page);
/**
* @name Page
* @description
*
* The Page decorator indicates that the decorated class is an Ionic
* navigation component, meaning it can be navigated to using a NavController.
*
* Pages have all `IONIC_DIRECTIVES`, which include all Ionic components and directives,
* as well as Angular's [CORE_DIRECTIVES](https://angular.io/docs/js/latest/api/core/CORE_DIRECTIVES-const.html)
* and [FORM_DIRECTIVES](https://angular.io/docs/js/latest/api/core/FORM_DIRECTIVES-const.html),
* already provided to them, so you only need to supply custom components and directives to your pages:
*
* @usage
*
* ```ts
* @Page({
* template: `
*
* I am a page!
*
* `
* })
* class MyPage {}
* ```
*
* Here [Content](../../../components/content/Content/) will load because
* it is in `IONIC_DIRECTIVES`, so there is no need to add a `directives` array.
*
*
* Say you built a custom component that uses the already existing Ionic component.
* In this case, you would add `IONIC_DIRECTIVES` to your directives array.
*
* ```ts
* import {IONIC_DIRECTIVES} from 'ionic-angular';
* @Component({
* selector: 'my-component'
* template: `
*
*
`,
* directives: [IONIC_DIRECTIVES]
* })
* class MyCustomCheckbox {}
*```
* Alternatively, you could:
*
* ```ts
* import {Checkbox, Icon} from 'ionic-angular'
* ```
*
* along with any other components and add them individually:
*
* ```
* @Component({
* ...
* directives: [Checkbox, Icon]
* })
* ```
*
* However, using IONIC_DIRECTIVES will always *Just Work* with no
* performance overhead, so there is really no reason to not always use it.
*
* Pages have their content automatically wrapped in ``, so although
* you may see these tags if you inspect your markup, you don't need to include
* them in your templates.
*
* For more information on how pages are created, see the [NavController API reference](../../components/nav/NavController/#creating_pages)
*/
function Page(config) {
return function (cls) {
config.selector = 'ion-page';
config.directives = config.directives ? config.directives.concat(IONIC_DIRECTIVES) : IONIC_DIRECTIVES;
config.host = config.host || {};
config.host['[hidden]'] = '_hidden';
config.host['[class.tab-subpage]'] = '_tabSubPage';
var annotations = _reflect.getMetadata('annotations', cls) || [];
annotations.push(new Component(config));
_reflect.defineMetadata('annotations', annotations, cls);
return cls;
};
}
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
}, function (_configDirectives) {
IONIC_DIRECTIVES = _configDirectives.IONIC_DIRECTIVES;
}],
execute: function () {
_reflect = Reflect;
}
};
});
System.register('ionic-angular/gestures/drag-gesture', ['./gesture', '../util'], function (_export) {
'use strict';
var Gesture, defaults, DragGesture;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_gesture) {
Gesture = _gesture.Gesture;
}, function (_util) {
defaults = _util.defaults;
}],
execute: function () {
DragGesture = (function (_Gesture) {
_inherits(DragGesture, _Gesture);
function DragGesture(element) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, DragGesture);
defaults(opts, {});
_get(Object.getPrototypeOf(DragGesture.prototype), 'constructor', this).call(this, element, opts);
}
_createClass(DragGesture, [{
key: 'listen',
value: function listen() {
var _this = this;
_get(Object.getPrototypeOf(DragGesture.prototype), 'listen', this).call(this);
this.on('panstart', function (ev) {
if (_this.onDragStart(ev) !== false) {
_this.dragging = true;
}
});
this.on('panmove', function (ev) {
if (!_this.dragging) return;
if (_this.onDrag(ev) === false) {
_this.dragging = false;
}
});
this.on('panend', function (ev) {
if (!_this.dragging) return;
_this.onDragEnd(ev);
_this.dragging = false;
});
}
}, {
key: 'onDrag',
value: function onDrag(ev) {
return true;
}
}, {
key: 'onDragStart',
value: function onDragStart(ev) {
return true;
}
}, {
key: 'onDragEnd',
value: function onDragEnd(ev) {}
}]);
return DragGesture;
})(Gesture);
_export('DragGesture', DragGesture);
}
};
});
System.register('ionic-angular/gestures/gesture', ['../util', './hammer'], function (_export) {
/**
* A gesture recognizer class.
*
* TODO(mlynch): Re-enable the DOM event simulation that was causing issues (or verify hammer does this already, it might);
*/
'use strict';
var defaults, assign, Hammer, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, Gesture;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
return {
setters: [function (_util) {
defaults = _util.defaults;
assign = _util.assign;
}, function (_hammer) {
Hammer = _hammer.Hammer;
DIRECTION_HORIZONTAL = _hammer.DIRECTION_HORIZONTAL;
DIRECTION_VERTICAL = _hammer.DIRECTION_VERTICAL;
}],
execute: function () {
Gesture = (function () {
function Gesture(element) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, Gesture);
this._callbacks = {};
this.isListening = false;
defaults(opts, {
domEvents: true
});
this.element = element;
// Map 'x' or 'y' string to hammerjs opts
this.direction = opts.direction || 'x';
opts.direction = this.direction === 'x' ? DIRECTION_HORIZONTAL : DIRECTION_VERTICAL;
this._options = opts;
}
_createClass(Gesture, [{
key: 'options',
value: function options(opts) {
assign(this._options, opts);
}
}, {
key: 'on',
value: function on(type, cb) {
if (type == 'pinch' || type == 'rotate') {
this._hammer.get('pinch').set({ enable: true });
}
this._hammer.on(type, cb);
(this._callbacks[type] || (this._callbacks[type] = [])).push(cb);
}
}, {
key: 'off',
value: function off(type, cb) {
this._hammer.off(type, this._callbacks[type] ? cb : null);
}
}, {
key: 'listen',
value: function listen() {
if (!this.isListening) {
this._hammer = Hammer(this.element, this._options);
}
this.isListening = true;
}
}, {
key: 'unlisten',
value: function unlisten() {
var type, i;
if (this._hammer && this.isListening) {
for (type in this._callbacks) {
for (i = 0; i < this._callbacks[type].length; i++) {
this._hammer.off(type, this._callbacks[type]);
}
}
this._hammer.destroy();
}
this._callbacks = {};
this._hammer = null;
this.isListening = false;
}
}, {
key: 'destroy',
value: function destroy() {
this.unlisten();
this.element = this._options = null;
}
}]);
return Gesture;
})();
_export('Gesture', Gesture);
}
};
});
System.register('ionic-angular/gestures/hammer', ['../util/util'], function (_export) {
'use strict';
var assign, win, doc, VENDOR_PREFIXES, TEST_ELEMENT, TYPE_FUNCTION, round, abs, now, _uniqueId, MOBILE_REGEX, SUPPORT_TOUCH, SUPPORT_POINTER_EVENTS, SUPPORT_ONLY_TOUCH, INPUT_TYPE_TOUCH, INPUT_TYPE_PEN, INPUT_TYPE_MOUSE, INPUT_TYPE_KINECT, COMPUTE_INTERVAL, INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, PROPS_XY, PROPS_CLIENT_XY, MOUSE_INPUT_MAP, MOUSE_ELEMENT_EVENTS, MOUSE_WINDOW_EVENTS, POINTER_INPUT_MAP, IE10_POINTER_TYPE_ENUM, POINTER_ELEMENT_EVENTS, POINTER_WINDOW_EVENTS, SINGLE_TOUCH_INPUT_MAP, SINGLE_TOUCH_TARGET_EVENTS, SINGLE_TOUCH_WINDOW_EVENTS, TOUCH_INPUT_MAP, TOUCH_TARGET_EVENTS, PREFIXED_TOUCH_ACTION, NATIVE_TOUCH_ACTION, TOUCH_ACTION_COMPUTE, TOUCH_ACTION_AUTO, TOUCH_ACTION_MANIPULATION, TOUCH_ACTION_NONE, TOUCH_ACTION_PAN_X, TOUCH_ACTION_PAN_Y, STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, VERSION, _defaults, STOP, FORCED_STOP;
/**
* set a timeout with a given scope
* @param {Function} fn
* @param {Number} timeout
* @param {Object} context
* @returns {number}
*/
function setTimeoutContext(fn, timeout, context) {
return setTimeout(bindFn(fn, context), timeout);
}
/**
* if the argument is an array, we want to execute the fn on each entry
* if it aint an array we don't want to do a thing.
* this is used by all the methods that accept a single and array argument.
* @param {*|Array} arg
* @param {String} fn
* @param {Object} [context]
* @returns {Boolean}
*/
function invokeArrayArg(arg, fn, context) {
if (Array.isArray(arg)) {
each(arg, context[fn], context);
return true;
}
return false;
}
/**
* walk objects and arrays
* @param {Object} obj
* @param {Function} iterator
* @param {Object} context
*/
function each(obj, iterator, context) {
var i;
if (!obj) {
return;
}
if (obj.forEach) {
obj.forEach(iterator, context);
} else if (obj.length !== undefined) {
i = 0;
while (i < obj.length) {
iterator.call(context, obj[i], i, obj);
i++;
}
} else {
for (i in obj) {
obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
}
}
}
/**
* simple class inheritance
* @param {Function} child
* @param {Function} base
* @param {Object} [properties]
*/
function inherit(child, base, properties) {
var baseP = base.prototype,
childP;
childP = child.prototype = Object.create(baseP);
childP.constructor = child;
childP._super = baseP;
if (properties) {
assign(childP, properties);
}
}
/**
* simple function bind
* @param {Function} fn
* @param {Object} context
* @returns {Function}
*/
function bindFn(fn, context) {
return function boundFn() {
return fn.apply(context, arguments);
};
}
/**
* let a boolean value also be a function that must return a boolean
* this first item in args will be used as the context
* @param {Boolean|Function} val
* @param {Array} [args]
* @returns {Boolean}
*/
function boolOrFn(val, args) {
if (typeof val == TYPE_FUNCTION) {
return val.apply(args ? args[0] || undefined : undefined, args);
}
return val;
}
/**
* use the val2 when val1 is undefined
* @param {*} val1
* @param {*} val2
* @returns {*}
*/
function ifUndefined(val1, val2) {
return val1 === undefined ? val2 : val1;
}
/**
* addEventListener with multiple events at once
* @param {EventTarget} target
* @param {String} types
* @param {Function} handler
*/
function addEventListeners(target, types, handler) {
each(splitStr(types), function (type) {
target.addEventListener(type, handler, false);
});
}
/**
* removeEventListener with multiple events at once
* @param {EventTarget} target
* @param {String} types
* @param {Function} handler
*/
function removeEventListeners(target, types, handler) {
each(splitStr(types), function (type) {
target.removeEventListener(type, handler, false);
});
}
/**
* find if a node is in the given parent
* @method hasParent
* @param {HTMLElement} node
* @param {HTMLElement} parent
* @return {Boolean} found
*/
function hasParent(node, parent) {
while (node) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
}
/**
* small indexOf wrapper
* @param {String} str
* @param {String} find
* @returns {Boolean} found
*/
function inStr(str, find) {
return str.indexOf(find) > -1;
}
/**
* split string on whitespace
* @param {String} str
* @returns {Array} words
*/
function splitStr(str) {
return str.trim().split(/\s+/g);
}
/**
* find if a array contains the object using indexOf or a simple polyFill
* @param {Array} src
* @param {String} find
* @param {String} [findByKey]
* @return {Boolean|Number} false when not found, or the index
*/
function inArray(src, find, findByKey) {
if (src.indexOf && !findByKey) {
return src.indexOf(find);
} else {
var i = 0;
while (i < src.length) {
if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
return i;
}
i++;
}
return -1;
}
}
/**
* convert array-like objects to real arrays
* @param {Object} obj
* @returns {Array}
*/
function toArray(obj) {
return Array.prototype.slice.call(obj, 0);
}
/**
* unique array with objects based on a key (like 'id') or just by the array's value
* @param {Array} src [{id:1},{id:2},{id:1}]
* @param {String} [key]
* @param {Boolean} [sort=False]
* @returns {Array} [{id:1},{id:2}]
*/
function uniqueArray(src, key, sort) {
var results = [];
var values = [];
var i = 0;
while (i < src.length) {
var val = key ? src[i][key] : src[i];
if (inArray(values, val) < 0) {
results.push(src[i]);
}
values[i] = val;
i++;
}
if (sort) {
if (!key) {
results = results.sort();
} else {
results = results.sort(function sortUniqueArray(a, b) {
return a[key] > b[key] ? 1 : 0;
});
}
}
return results;
}
/**
* get the prefixed property
* @param {Object} obj
* @param {String} property
* @returns {String|Undefined} prefixed
*/
function prefixed(obj, property) {
var prefix, prop;
var camelProp = property[0].toUpperCase() + property.slice(1);
var i = 0;
while (i < VENDOR_PREFIXES.length) {
prefix = VENDOR_PREFIXES[i];
prop = prefix ? prefix + camelProp : property;
if (prop in obj) {
return prop;
}
i++;
}
return undefined;
}
/**
* get a unique id
* @returns {number} uniqueId
*/
function uniqueId() {
return _uniqueId++;
}
/**
* get the window object of an element
* @param {HTMLElement} element
* @returns {DocumentView|Window}
*/
function getWindowForElement(element) {
var doc = element.ownerDocument || element;
return doc.defaultView || doc.parentWindow || window;
}
/**
* create new input type manager
* @param {Manager} manager
* @param {Function} callback
* @returns {Input}
* @constructor
*/
function Input(manager, callback) {
var self = this;
this.manager = manager;
this.callback = callback;
this.element = manager.element;
this.target = manager.options.inputTarget;
// smaller wrapper around the handler, for the scope and the enabled state of the manager,
// so when disabled the input events are completely bypassed.
this.domHandler = function (ev) {
if (boolOrFn(manager.options.enable, [manager])) {
self.handler(ev);
}
};
this.init();
}
/**
* create new input type manager
* called by the Manager constructor
* @param {Hammer} manager
* @returns {Input}
*/
function createInputInstance(manager) {
var Type;
var inputClass = manager.options.inputClass;
if (inputClass) {
Type = inputClass;
} else if (SUPPORT_POINTER_EVENTS) {
Type = PointerEventInput;
} else if (SUPPORT_ONLY_TOUCH) {
Type = TouchInput;
} else if (!SUPPORT_TOUCH) {
Type = MouseInput;
} else {
Type = TouchMouseInput;
}
return new Type(manager, inputHandler);
}
/**
* handle input events
* @param {Manager} manager
* @param {String} eventType
* @param {Object} input
*/
function inputHandler(manager, eventType, input) {
var pointersLen = input.pointers.length;
var changedPointersLen = input.changedPointers.length;
var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
input.isFirst = !!isFirst;
input.isFinal = !!isFinal;
if (isFirst) {
manager.session = {};
}
// source event is the normalized value of the domEvents
// like 'touchstart, mouseup, pointerdown'
input.eventType = eventType;
// compute scale, rotation etc
computeInputData(manager, input);
// emit secret event
manager.emit('hammer.input', input);
manager.recognize(input);
manager.session.prevInput = input;
}
/**
* extend the data with some usable properties like scale, rotate, velocity etc
* @param {Object} manager
* @param {Object} input
*/
function computeInputData(manager, input) {
var session = manager.session;
var pointers = input.pointers;
var pointersLength = pointers.length;
// store the first input to calculate the distance and direction
if (!session.firstInput) {
session.firstInput = simpleCloneInputData(input);
}
// to compute scale and rotation we need to store the multiple touches
if (pointersLength > 1 && !session.firstMultiple) {
session.firstMultiple = simpleCloneInputData(input);
} else if (pointersLength === 1) {
session.firstMultiple = false;
}
var firstInput = session.firstInput;
var firstMultiple = session.firstMultiple;
var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
var center = input.center = getCenter(pointers);
input.timeStamp = now();
input.deltaTime = input.timeStamp - firstInput.timeStamp;
input.angle = getAngle(offsetCenter, center);
input.distance = getDistance(offsetCenter, center);
computeDeltaXY(session, input);
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
input.overallVelocityX = overallVelocity.x;
input.overallVelocityY = overallVelocity.y;
input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
computeIntervalInputData(session, input);
// find the correct target
var target = manager.element;
if (hasParent(input.srcEvent.target, target)) {
target = input.srcEvent.target;
}
input.target = target;
}
function computeDeltaXY(session, input) {
var center = input.center;
var offset = session.offsetDelta || {};
var prevDelta = session.prevDelta || {};
var prevInput = session.prevInput || {};
if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
prevDelta = session.prevDelta = {
x: prevInput.deltaX || 0,
y: prevInput.deltaY || 0
};
offset = session.offsetDelta = {
x: center.x,
y: center.y
};
}
input.deltaX = prevDelta.x + (center.x - offset.x);
input.deltaY = prevDelta.y + (center.y - offset.y);
}
/**
* velocity is calculated every x ms
* @param {Object} session
* @param {Object} input
*/
function computeIntervalInputData(session, input) {
var last = session.lastInterval || input,
deltaTime = input.timeStamp - last.timeStamp,
velocity,
velocityX,
velocityY,
direction;
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
var deltaX = input.deltaX - last.deltaX;
var deltaY = input.deltaY - last.deltaY;
var v = getVelocity(deltaTime, deltaX, deltaY);
velocityX = v.x;
velocityY = v.y;
velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
direction = getDirection(deltaX, deltaY);
session.lastInterval = input;
} else {
// use latest velocity info if it doesn't overtake a minimum period
velocity = last.velocity;
velocityX = last.velocityX;
velocityY = last.velocityY;
direction = last.direction;
}
input.velocity = velocity;
input.velocityX = velocityX;
input.velocityY = velocityY;
input.direction = direction;
}
/**
* create a simple clone from the input used for storage of firstInput and firstMultiple
* @param {Object} input
* @returns {Object} clonedInputData
*/
function simpleCloneInputData(input) {
// make a simple copy of the pointers because we will get a reference if we don't
// we only need clientXY for the calculations
var pointers = [];
var i = 0;
while (i < input.pointers.length) {
pointers[i] = {
clientX: round(input.pointers[i].clientX),
clientY: round(input.pointers[i].clientY)
};
i++;
}
return {
timeStamp: now(),
pointers: pointers,
center: getCenter(pointers),
deltaX: input.deltaX,
deltaY: input.deltaY
};
}
/**
* get the center of all the pointers
* @param {Array} pointers
* @return {Object} center contains `x` and `y` properties
*/
function getCenter(pointers) {
var pointersLength = pointers.length;
// no need to loop when only one touch
if (pointersLength === 1) {
return {
x: round(pointers[0].clientX),
y: round(pointers[0].clientY)
};
}
var x = 0,
y = 0,
i = 0;
while (i < pointersLength) {
x += pointers[i].clientX;
y += pointers[i].clientY;
i++;
}
return {
x: round(x / pointersLength),
y: round(y / pointersLength)
};
}
/**
* calculate the velocity between two points. unit is in px per ms.
* @param {Number} deltaTime
* @param {Number} x
* @param {Number} y
* @return {Object} velocity `x` and `y`
*/
function getVelocity(deltaTime, x, y) {
return {
x: x / deltaTime || 0,
y: y / deltaTime || 0
};
}
/**
* get the direction between two points
* @param {Number} x
* @param {Number} y
* @return {Number} direction
*/
function getDirection(x, y) {
if (x === y) {
return DIRECTION_NONE;
}
if (abs(x) >= abs(y)) {
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
}
/**
* calculate the absolute distance between two points
* @param {Object} p1 {x, y}
* @param {Object} p2 {x, y}
* @param {Array} [props] containing x and y keys
* @return {Number} distance
*/
function getDistance(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return Math.sqrt(x * x + y * y);
}
/**
* calculate the angle between two coordinates
* @param {Object} p1
* @param {Object} p2
* @param {Array} [props] containing x and y keys
* @return {Number} angle
*/
function getAngle(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return Math.atan2(y, x) * 180 / Math.PI;
}
/**
* calculate the rotation degrees between two pointersets
* @param {Array} start array of pointers
* @param {Array} end array of pointers
* @return {Number} rotation
*/
function getRotation(start, end) {
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
}
/**
* calculate the scale factor between two pointersets
* no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
* @param {Array} start array of pointers
* @param {Array} end array of pointers
* @return {Number} scale
*/
function getScale(start, end) {
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
}
/**
* Mouse events input
* @constructor
* @extends Input
*/
function MouseInput(manager, handler) {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.allow = true; // used by Input.TouchMouse to disable mouse events
this.pressed = false; // mousedown state
Input.apply(this, arguments);
}
/**
* Pointer events input
* @constructor
* @extends Input
*/
function PointerEventInput() {
this.evEl = POINTER_ELEMENT_EVENTS;
this.evWin = POINTER_WINDOW_EVENTS;
Input.apply(this, arguments);
this.store = this.manager.session.pointerEvents = [];
}
/**
* Touch events input
* @constructor
* @extends Input
*/
function SingleTouchInput() {
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
this.started = false;
Input.apply(this, arguments);
}
/**
* @this {TouchInput}
* @param {Object} ev
* @param {Number} type flag
* @returns {undefined|Array} [all, changed]
*/
function normalizeSingleTouches(ev, type) {
var all = toArray(ev.touches);
var changed = toArray(ev.changedTouches);
if (type & (INPUT_END | INPUT_CANCEL)) {
all = uniqueArray(all.concat(changed), 'identifier', true);
}
return [all, changed];
}
/**
* Multi-user touch events input
* @constructor
* @extends Input
*/
function TouchInput(manager, handler) {
this.evTarget = TOUCH_TARGET_EVENTS;
this.targetIds = {};
Input.apply(this, arguments);
}
/**
* @this {TouchInput}
* @param {Object} ev
* @param {Number} type flag
* @returns {undefined|Array} [all, changed]
*/
function getTouches(ev, type) {
var allTouches = toArray(ev.touches);
var targetIds = this.targetIds;
// when there is only one touch, the process can be simplified
if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
targetIds[allTouches[0].identifier] = true;
return [allTouches, allTouches];
}
var i,
targetTouches,
changedTouches = toArray(ev.changedTouches),
changedTargetTouches = [],
target = this.target;
// get target touches from touches
targetTouches = allTouches.filter(function (touch) {
return hasParent(touch.target, target);
});
// collect touches
if (type === INPUT_START) {
i = 0;
while (i < targetTouches.length) {
targetIds[targetTouches[i].identifier] = true;
i++;
}
}
// filter changed touches to only contain touches that exist in the collected target ids
i = 0;
while (i < changedTouches.length) {
if (targetIds[changedTouches[i].identifier]) {
changedTargetTouches.push(changedTouches[i]);
}
// cleanup removed touches
if (type & (INPUT_END | INPUT_CANCEL)) {
delete targetIds[changedTouches[i].identifier];
}
i++;
}
if (!changedTargetTouches.length) {
return;
}
return [
// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];
}
/**
* Combined touch and mouse input
*
* Touch has a higher priority then mouse, and while touching no mouse events are allowed.
* This because touch devices also emit mouse events while doing a touch.
*
* @constructor
* @extends Input
*/
function TouchMouseInput() {
Input.apply(this, arguments);
var handler = bindFn(this.handler, this);
this.touch = new TouchInput(this.manager, handler);
this.mouse = new MouseInput(this.manager, handler);
}
/**
* Touch Action
* sets the touchAction property or uses the js alternative
* @param {Manager} manager
* @param {String} value
* @constructor
*/
function TouchAction(manager, value) {
this.manager = manager;
this.set(value);
}
/**
* when the touchActions are collected they are not a valid value, so we need to clean things up. *
* @param {String} actions
* @returns {*}
*/
function cleanTouchActions(actions) {
// none
if (inStr(actions, TOUCH_ACTION_NONE)) {
return TOUCH_ACTION_NONE;
}
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
// if both pan-x and pan-y are set (different recognizers
// for different directions, e.g. horizontal pan but vertical swipe?)
// we need none (as otherwise with pan-x pan-y combined none of these
// recognizers will work, since the browser would handle all panning
if (hasPanX && hasPanY) {
return TOUCH_ACTION_NONE;
}
// pan-x OR pan-y
if (hasPanX || hasPanY) {
return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
}
// manipulation
if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
return TOUCH_ACTION_MANIPULATION;
}
return TOUCH_ACTION_AUTO;
}
/**
* Recognizer flow explained; *
* All recognizers have the initial state of POSSIBLE when a input session starts.
* The definition of a input session is from the first input until the last input, with all it's movement in it. *
* Example session for mouse-input: mousedown -> mousemove -> mouseup
*
* On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
* which determines with state it should be.
*
* If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
* POSSIBLE to give it another change on the next cycle.
*
* Possible
* |
* +-----+---------------+
* | |
* +-----+-----+ |
* | | |
* Failed Cancelled |
* +-------+------+
* | |
* Recognized Began
* |
* Changed
* |
* Ended/Recognized
*/
/**
* Recognizer
* Every recognizer needs to extend from this class.
* @constructor
* @param {Object} options
*/
function Recognizer(options) {
this.options = assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
this.state = STATE_POSSIBLE;
this.simultaneous = {};
this.requireFail = [];
}
/**
* get a usable string, used as event postfix
* @param {Const} state
* @returns {String} state
*/
function stateStr(state) {
if (state & STATE_CANCELLED) {
return 'cancel';
} else if (state & STATE_ENDED) {
return 'end';
} else if (state & STATE_CHANGED) {
return 'move';
} else if (state & STATE_BEGAN) {
return 'start';
}
return '';
}
/**
* direction cons to string
* @param {Const} direction
* @returns {String}
*/
function directionStr(direction) {
if (direction == DIRECTION_DOWN) {
return 'down';
} else if (direction == DIRECTION_UP) {
return 'up';
} else if (direction == DIRECTION_LEFT) {
return 'left';
} else if (direction == DIRECTION_RIGHT) {
return 'right';
}
return '';
}
/**
* get a recognizer by name if it is bound to a manager
* @param {Recognizer|String} otherRecognizer
* @param {Recognizer} recognizer
* @returns {Recognizer}
*/
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
var manager = recognizer.manager;
if (manager) {
return manager.get(otherRecognizer);
}
return otherRecognizer;
}
/**
* This recognizer is just used as a base for the simple attribute recognizers.
* @constructor
* @extends Recognizer
*/
function AttrRecognizer() {
Recognizer.apply(this, arguments);
}
/**
* Pan
* Recognized when the pointer is down and moved in the allowed direction.
* @constructor
* @extends AttrRecognizer
*/
function PanRecognizer() {
AttrRecognizer.apply(this, arguments);
this.pX = null;
this.pY = null;
}
/**
* Pinch
* Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
* @constructor
* @extends AttrRecognizer
*/
function PinchRecognizer() {
AttrRecognizer.apply(this, arguments);
}
/**
* Press
* Recognized when the pointer is down for x ms without any movement.
* @constructor
* @extends Recognizer
*/
function PressRecognizer() {
Recognizer.apply(this, arguments);
this._timer = null;
this._input = null;
}
/**
* Rotate
* Recognized when two or more pointer are moving in a circular motion.
* @constructor
* @extends AttrRecognizer
*/
function RotateRecognizer() {
AttrRecognizer.apply(this, arguments);
}
/**
* Swipe
* Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
* @constructor
* @extends AttrRecognizer
*/
function SwipeRecognizer() {
AttrRecognizer.apply(this, arguments);
}
/**
* A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
* between the given interval and position. The delay option can be used to recognize multi-taps without firing
* a single tap.
*
* The eventData from the emitted event contains the property `tapCount`, which contains the amount of
* multi-taps being recognized.
* @constructor
* @extends Recognizer
*/
function TapRecognizer() {
Recognizer.apply(this, arguments);
// previous time and center,
// used for tap counting
this.pTime = false;
this.pCenter = false;
this._timer = null;
this._input = null;
this.count = 0;
}
/**
* Simple way to create a manager with a default set of recognizers.
* @param {HTMLElement} element
* @param {Object} [options]
* @constructor
*/
function Hammer(element, options) {
options = options || {};
options.recognizers = ifUndefined(options.recognizers, _defaults.preset);
return new Manager(element, options);
}
/**
* @const {string}
*/
/**
* Manager
* @param {HTMLElement} element
* @param {Object} [options]
* @constructor
*/
function Manager(element, options) {
this.options = assign({}, _defaults, options || {});
this.options.inputTarget = this.options.inputTarget || element;
this.handlers = {};
this.session = {};
this.recognizers = [];
this.element = element;
this.input = createInputInstance(this);
this.touchAction = new TouchAction(this, this.options.touchAction);
toggleCssProps(this, true);
each(this.options.recognizers, function (item) {
var recognizer = this.add(new item[0](item[1]));
item[2] && recognizer.recognizeWith(item[2]);
item[3] && recognizer.requireFailure(item[3]);
}, this);
}
/**
* add/remove the css properties as defined in manager.options.cssProps
* @param {Manager} manager
* @param {Boolean} add
*/
function toggleCssProps(manager, add) {
var element = manager.element;
if (!element.style) {
return;
}
each(manager.options.cssProps, function (value, name) {
element.style[prefixed(element.style, name)] = add ? value : '';
});
}
/**
* trigger dom event
* @param {String} event
* @param {Object} data
*/
function triggerDomEvent(event, data) {
var gestureEvent = doc.createEvent('Event');
gestureEvent.initEvent(event, true, true);
gestureEvent.gesture = data;
data.target.dispatchEvent(gestureEvent);
}
return {
setters: [function (_utilUtil) {
assign = _utilUtil.assign;
}],
execute: function () {
win = window;
doc = document;
/*! Hammer.JS - v2.0.6 - 2015-12-23
* http://hammerjs.github.io/
*
* Copyright (c) 2015 Jorik Tangelder;
* Licensed under the license */
VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
TEST_ELEMENT = doc.createElement('div');
TYPE_FUNCTION = 'function';
round = Math.round;
abs = Math.abs;
now = Date.now;
_uniqueId = 1;
MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
SUPPORT_TOUCH = 'ontouchstart' in window;
SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
INPUT_TYPE_TOUCH = 'touch';
INPUT_TYPE_PEN = 'pen';
INPUT_TYPE_MOUSE = 'mouse';
INPUT_TYPE_KINECT = 'kinect';
COMPUTE_INTERVAL = 25;
INPUT_START = 1;
INPUT_MOVE = 2;
INPUT_END = 4;
INPUT_CANCEL = 8;
DIRECTION_NONE = 1;
DIRECTION_LEFT = 2;
_export('DIRECTION_LEFT', DIRECTION_LEFT);
DIRECTION_RIGHT = 4;
_export('DIRECTION_RIGHT', DIRECTION_RIGHT);
DIRECTION_UP = 8;
DIRECTION_DOWN = 16;
DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
_export('DIRECTION_HORIZONTAL', DIRECTION_HORIZONTAL);
DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
_export('DIRECTION_VERTICAL', DIRECTION_VERTICAL);
DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
PROPS_XY = ['x', 'y'];
PROPS_CLIENT_XY = ['clientX', 'clientY'];
Input.prototype = {
/**
* should handle the inputEvent data and trigger the callback
* @virtual
*/
handler: function handler() {},
/**
* bind the events
*/
init: function init() {
this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
},
/**
* unbind the events
*/
destroy: function destroy() {
this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
}
};MOUSE_INPUT_MAP = {
mousedown: INPUT_START,
mousemove: INPUT_MOVE,
mouseup: INPUT_END
};
MOUSE_ELEMENT_EVENTS = 'mousedown';
MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
inherit(MouseInput, Input, {
/**
* handle mouse events
* @param {Object} ev
*/
handler: function MEhandler(ev) {
var eventType = MOUSE_INPUT_MAP[ev.type];
// on start we want to have the left mouse button down
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}
if (eventType & INPUT_MOVE && ev.which !== 1) {
eventType = INPUT_END;
}
// mouse must be down, and mouse events are allowed (see the TouchMouse input)
if (!this.pressed || !this.allow) {
return;
}
if (eventType & INPUT_END) {
this.pressed = false;
}
this.callback(this.manager, eventType, {
pointers: [ev],
changedPointers: [ev],
pointerType: INPUT_TYPE_MOUSE,
srcEvent: ev
});
}
});
POINTER_INPUT_MAP = {
pointerdown: INPUT_START,
pointermove: INPUT_MOVE,
pointerup: INPUT_END,
pointercancel: INPUT_CANCEL,
pointerout: INPUT_CANCEL
};
// in IE10 the pointer types is defined as an enum
IE10_POINTER_TYPE_ENUM = {
2: INPUT_TYPE_TOUCH,
3: INPUT_TYPE_PEN,
4: INPUT_TYPE_MOUSE,
5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
};
POINTER_ELEMENT_EVENTS = 'pointerdown';
POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
// IE10 has prefixed support, and case-sensitive
if (win.MSPointerEvent && !win.PointerEvent) {
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
}inherit(PointerEventInput, Input, {
/**
* handle mouse events
* @param {Object} ev
*/
handler: function PEhandler(ev) {
var store = this.store;
var removePointer = false;
var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
var isTouch = pointerType == INPUT_TYPE_TOUCH;
// get index of the event in the store
var storeIndex = inArray(store, ev.pointerId, 'pointerId');
// start and mouse must be down
if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
if (storeIndex < 0) {
store.push(ev);
storeIndex = store.length - 1;
}
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
removePointer = true;
}
// it not found, so the pointer hasn't been down (so it's probably a hover)
if (storeIndex < 0) {
return;
}
// update the event in the store
store[storeIndex] = ev;
this.callback(this.manager, eventType, {
pointers: store,
changedPointers: [ev],
pointerType: pointerType,
srcEvent: ev
});
if (removePointer) {
// remove from the store
store.splice(storeIndex, 1);
}
}
});
SINGLE_TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
inherit(SingleTouchInput, Input, {
handler: function TEhandler(ev) {
var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
// should we handle the touch events?
if (type === INPUT_START) {
this.started = true;
}
if (!this.started) {
return;
}
var touches = normalizeSingleTouches.call(this, ev, type);
// when done, reset the started state
if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
this.started = false;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
inherit(TouchInput, Input, {
handler: function MTEhandler(ev) {
var type = TOUCH_INPUT_MAP[ev.type];
var touches = getTouches.call(this, ev, type);
if (!touches) {
return;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});inherit(TouchMouseInput, Input, {
/**
* handle mouse and touch events
* @param {Hammer} manager
* @param {String} inputEvent
* @param {Object} inputData
*/
handler: function TMEhandler(manager, inputEvent, inputData) {
var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,
isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;
// when we're in a touch event, so block all upcoming mouse events
// most mobile browser also emit mouseevents, right after touchstart
if (isTouch) {
this.mouse.allow = false;
} else if (isMouse && !this.mouse.allow) {
return;
}
// reset the allowMouse when we're done
if (inputEvent & (INPUT_END | INPUT_CANCEL)) {
this.mouse.allow = true;
}
this.callback(manager, inputEvent, inputData);
},
/**
* remove the event listeners
*/
destroy: function destroy() {
this.touch.destroy();
this.mouse.destroy();
}
});
PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
// magical touchAction value
TOUCH_ACTION_COMPUTE = 'compute';
TOUCH_ACTION_AUTO = 'auto';
TOUCH_ACTION_MANIPULATION = 'manipulation';
// not implemented
TOUCH_ACTION_NONE = 'none';
TOUCH_ACTION_PAN_X = 'pan-x';
TOUCH_ACTION_PAN_Y = 'pan-y';
TouchAction.prototype = {
/**
* set the touchAction value on the element or enable the polyfill
* @param {String} value
*/
set: function set(value) {
// find out the touch-action by the event handlers
if (value == TOUCH_ACTION_COMPUTE) {
value = this.compute();
}
if (NATIVE_TOUCH_ACTION && this.manager.element.style) {
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
}
this.actions = value.toLowerCase().trim();
},
/**
* just re-set the touchAction value
*/
update: function update() {
this.set(this.manager.options.touchAction);
},
/**
* compute the value for the touchAction property based on the recognizer's settings
* @returns {String} value
*/
compute: function compute() {
var actions = [];
each(this.manager.recognizers, function (recognizer) {
if (boolOrFn(recognizer.options.enable, [recognizer])) {
actions = actions.concat(recognizer.getTouchAction());
}
});
return cleanTouchActions(actions.join(' '));
},
/**
* this method is called on each input cycle and provides the preventing of the browser behavior
* @param {Object} input
*/
preventDefaults: function preventDefaults(input) {
// not needed with native support for the touchAction property
if (NATIVE_TOUCH_ACTION) {
return;
}
var srcEvent = input.srcEvent;
var direction = input.offsetDirection;
// if the touch action did prevented once this session
if (this.manager.session.prevented) {
srcEvent.preventDefault();
return;
}
var actions = this.actions;
var hasNone = inStr(actions, TOUCH_ACTION_NONE);
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
if (hasNone) {
//do not prevent defaults if this is a tap gesture
var isTapPointer = input.pointers.length === 1;
var isTapMovement = input.distance < 2;
var isTapTouchTime = input.deltaTime < 250;
if (isTapPointer && isTapMovement && isTapTouchTime) {
return;
}
}
if (hasPanX && hasPanY) {
// `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
return;
}
if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
return this.preventSrc(srcEvent);
}
},
/**
* call preventDefault to prevent the browser's default behavior (scrolling in most cases)
* @param {Object} srcEvent
*/
preventSrc: function preventSrc(srcEvent) {
this.manager.session.prevented = true;
srcEvent.preventDefault();
}
};STATE_POSSIBLE = 1;
STATE_BEGAN = 2;
STATE_CHANGED = 4;
STATE_ENDED = 8;
STATE_RECOGNIZED = STATE_ENDED;
STATE_CANCELLED = 16;
STATE_FAILED = 32;
Recognizer.prototype = {
/**
* @virtual
* @type {Object}
*/
defaults: {},
/**
* set options
* @param {Object} options
* @return {Recognizer}
*/
set: function set(options) {
assign(this.options, options);
// also update the touchAction, in case something changed about the directions/enabled state
this.manager && this.manager.touchAction.update();
return this;
},
/**
* recognize simultaneous with an other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
recognizeWith: function recognizeWith(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
return this;
}
var simultaneous = this.simultaneous;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (!simultaneous[otherRecognizer.id]) {
simultaneous[otherRecognizer.id] = otherRecognizer;
otherRecognizer.recognizeWith(this);
}
return this;
},
/**
* drop the simultaneous link. it doesnt remove the link on the other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
dropRecognizeWith: function dropRecognizeWith(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
delete this.simultaneous[otherRecognizer.id];
return this;
},
/**
* recognizer can only run when an other is failing
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
requireFailure: function requireFailure(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
return this;
}
var requireFail = this.requireFail;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (inArray(requireFail, otherRecognizer) === -1) {
requireFail.push(otherRecognizer);
otherRecognizer.requireFailure(this);
}
return this;
},
/**
* drop the requireFailure link. it does not remove the link on the other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
dropRequireFailure: function dropRequireFailure(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
var index = inArray(this.requireFail, otherRecognizer);
if (index > -1) {
this.requireFail.splice(index, 1);
}
return this;
},
/**
* has require failures boolean
* @returns {boolean}
*/
hasRequireFailures: function hasRequireFailures() {
return this.requireFail.length > 0;
},
/**
* if the recognizer can recognize simultaneous with an other recognizer
* @param {Recognizer} otherRecognizer
* @returns {Boolean}
*/
canRecognizeWith: function canRecognizeWith(otherRecognizer) {
return !!this.simultaneous[otherRecognizer.id];
},
/**
* You should use `tryEmit` instead of `emit` directly to check
* that all the needed recognizers has failed before emitting.
* @param {Object} input
*/
emit: function emit(input) {
var self = this;
var state = this.state;
function emit(event) {
self.manager.emit(event, input);
}
// 'panstart' and 'panmove'
if (state < STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
emit(self.options.event); // simple 'eventName' events
if (input.additionalEvent) {
emit(input.additionalEvent);
}
// panend and pancancel
if (state >= STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
},
/**
* Check that all the require failure recognizers has failed,
* if true, it emits a gesture event,
* otherwise, setup the state to FAILED.
* @param {Object} input
*/
tryEmit: function tryEmit(input) {
if (this.canEmit()) {
return this.emit(input);
}
// it's failing anyway
this.state = STATE_FAILED;
},
/**
* can we emit?
* @returns {boolean}
*/
canEmit: function canEmit() {
var i = 0;
while (i < this.requireFail.length) {
if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
return false;
}
i++;
}
return true;
},
/**
* update the recognizer
* @param {Object} inputData
*/
recognize: function recognize(inputData) {
// make a new copy of the inputData
// so we can change the inputData without messing up the other recognizers
var inputDataClone = assign({}, inputData);
// is is enabled and allow recognizing?
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
this.reset();
this.state = STATE_FAILED;
return;
}
// reset when we've reached the end
if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
this.state = STATE_POSSIBLE;
}
this.state = this.process(inputDataClone);
// the recognizer has recognized a gesture
// so trigger an event
if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
this.tryEmit(inputDataClone);
}
},
/**
* return the state of the recognizer
* the actual recognizing happens in this method
* @virtual
* @param {Object} inputData
* @returns {Const} STATE
*/
process: function process(inputData) {},
/**
* return the preferred touch-action
* @virtual
* @returns {Array}
*/
getTouchAction: function getTouchAction() {},
/**
* called when the gesture isn't allowed to recognize
* like when another is being recognized or it is disabled
* @virtual
*/
reset: function reset() {}
};inherit(AttrRecognizer, Recognizer, {
/**
* @namespace
* @memberof AttrRecognizer
*/
defaults: {
/**
* @type {Number}
* @default 1
*/
pointers: 1
},
/**
* Used to check if it the recognizer receives valid input, like input.distance > 10.
* @memberof AttrRecognizer
* @param {Object} input
* @returns {Boolean} recognized
*/
attrTest: function attrTest(input) {
var optionPointers = this.options.pointers;
return optionPointers === 0 || input.pointers.length === optionPointers;
},
/**
* Process the input and return the state for the recognizer
* @memberof AttrRecognizer
* @param {Object} input
* @returns {*} State
*/
process: function process(input) {
var state = this.state;
var eventType = input.eventType;
var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
var isValid = this.attrTest(input);
// on cancel input and we've recognized before, return STATE_CANCELLED
if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
return state | STATE_CANCELLED;
} else if (isRecognized || isValid) {
if (eventType & INPUT_END) {
return state | STATE_ENDED;
} else if (!(state & STATE_BEGAN)) {
return STATE_BEGAN;
}
return state | STATE_CHANGED;
}
return STATE_FAILED;
}
});inherit(PanRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof PanRecognizer
*/
defaults: {
event: 'pan',
threshold: 10,
pointers: 1,
direction: DIRECTION_ALL
},
getTouchAction: function getTouchAction() {
var direction = this.options.direction;
var actions = [];
if (direction & DIRECTION_HORIZONTAL) {
actions.push(TOUCH_ACTION_PAN_Y);
}
if (direction & DIRECTION_VERTICAL) {
actions.push(TOUCH_ACTION_PAN_X);
}
return actions;
},
directionTest: function directionTest(input) {
var options = this.options;
var hasMoved = true;
var distance = input.distance;
var direction = input.direction;
var x = input.deltaX;
var y = input.deltaY;
// lock to axis?
if (!(direction & options.direction)) {
if (options.direction & DIRECTION_HORIZONTAL) {
direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
hasMoved = x != this.pX;
distance = Math.abs(input.deltaX);
} else {
direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
hasMoved = y != this.pY;
distance = Math.abs(input.deltaY);
}
}
input.direction = direction;
return hasMoved && distance > options.threshold && direction & options.direction;
},
attrTest: function attrTest(input) {
return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
},
emit: function emit(input) {
this.pX = input.deltaX;
this.pY = input.deltaY;
var direction = directionStr(input.direction);
if (direction) {
input.additionalEvent = this.options.event + direction;
}
this._super.emit.call(this, input);
}
});inherit(PinchRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof PinchRecognizer
*/
defaults: {
event: 'pinch',
threshold: 0,
pointers: 2
},
getTouchAction: function getTouchAction() {
return [TOUCH_ACTION_NONE];
},
attrTest: function attrTest(input) {
return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
},
emit: function emit(input) {
if (input.scale !== 1) {
var inOut = input.scale < 1 ? 'in' : 'out';
input.additionalEvent = this.options.event + inOut;
}
this._super.emit.call(this, input);
}
});inherit(PressRecognizer, Recognizer, {
/**
* @namespace
* @memberof PressRecognizer
*/
defaults: {
event: 'press',
pointers: 1,
time: 251,
threshold: 9 // a minimal movement is ok, but keep it low
},
getTouchAction: function getTouchAction() {
return [TOUCH_ACTION_AUTO];
},
process: function process(input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTime = input.deltaTime > options.time;
this._input = input;
// we only allow little movement
// and we've reached an end event, so a tap is possible
if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
this.reset();
} else if (input.eventType & INPUT_START) {
this.reset();
this._timer = setTimeoutContext(function () {
this.state = STATE_RECOGNIZED;
this.tryEmit();
}, options.time, this);
} else if (input.eventType & INPUT_END) {
return STATE_RECOGNIZED;
}
return STATE_FAILED;
},
reset: function reset() {
clearTimeout(this._timer);
},
emit: function emit(input) {
if (this.state !== STATE_RECOGNIZED) {
return;
}
if (input && input.eventType & INPUT_END) {
this.manager.emit(this.options.event + 'up', input);
} else {
this._input.timeStamp = now();
this.manager.emit(this.options.event, this._input);
}
}
});inherit(RotateRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof RotateRecognizer
*/
defaults: {
event: 'rotate',
threshold: 0,
pointers: 2
},
getTouchAction: function getTouchAction() {
return [TOUCH_ACTION_NONE];
},
attrTest: function attrTest(input) {
return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
}
});inherit(SwipeRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof SwipeRecognizer
*/
defaults: {
event: 'swipe',
threshold: 10,
velocity: 0.3,
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
pointers: 1
},
getTouchAction: function getTouchAction() {
return PanRecognizer.prototype.getTouchAction.call(this);
},
attrTest: function attrTest(input) {
var direction = this.options.direction;
var velocity;
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
velocity = input.overallVelocity;
} else if (direction & DIRECTION_HORIZONTAL) {
velocity = input.overallVelocityX;
} else if (direction & DIRECTION_VERTICAL) {
velocity = input.overallVelocityY;
}
return this._super.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers == this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
},
emit: function emit(input) {
var direction = directionStr(input.offsetDirection);
if (direction) {
this.manager.emit(this.options.event + direction, input);
}
this.manager.emit(this.options.event, input);
}
});inherit(TapRecognizer, Recognizer, {
/**
* @namespace
* @memberof PinchRecognizer
*/
defaults: {
event: 'tap',
pointers: 1,
taps: 1,
interval: 300,
time: 250,
threshold: 9,
posThreshold: 10 // a multi-tap can be a bit off the initial position
},
getTouchAction: function getTouchAction() {
return [TOUCH_ACTION_MANIPULATION];
},
process: function process(input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTouchTime = input.deltaTime < options.time;
this.reset();
if (input.eventType & INPUT_START && this.count === 0) {
return this.failTimeout();
}
// we only allow little movement
// and we've reached an end event, so a tap is possible
if (validMovement && validTouchTime && validPointers) {
if (input.eventType != INPUT_END) {
return this.failTimeout();
}
var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
this.pTime = input.timeStamp;
this.pCenter = input.center;
if (!validMultiTap || !validInterval) {
this.count = 1;
} else {
this.count += 1;
}
this._input = input;
// if tap count matches we have recognized it,
// else it has began recognizing...
var tapCount = this.count % options.taps;
if (tapCount === 0) {
// no failing requirements, immediately trigger the tap event
// or wait as long as the multitap interval to trigger
if (!this.hasRequireFailures()) {
return STATE_RECOGNIZED;
} else {
this._timer = setTimeoutContext(function () {
this.state = STATE_RECOGNIZED;
this.tryEmit();
}, options.interval, this);
return STATE_BEGAN;
}
}
}
return STATE_FAILED;
},
failTimeout: function failTimeout() {
this._timer = setTimeoutContext(function () {
this.state = STATE_FAILED;
}, this.options.interval, this);
return STATE_FAILED;
},
reset: function reset() {
clearTimeout(this._timer);
},
emit: function emit() {
if (this.state == STATE_RECOGNIZED) {
this._input.tapCount = this.count;
this.manager.emit(this.options.event, this._input);
}
}
});VERSION = '2.0.6';
/**
* default settings
* @namespace
*/
_defaults = {
/**
* set if DOM events are being triggered.
* But this is slower and unused by simple implementations, so disabled by default.
* @type {Boolean}
* @default false
*/
domEvents: false,
/**
* The value for the touchAction property/fallback.
* When set to `compute` it will magically set the correct value based on the added recognizers.
* @type {String}
* @default compute
*/
touchAction: TOUCH_ACTION_COMPUTE,
/**
* @type {Boolean}
* @default true
*/
enable: true,
/**
* EXPERIMENTAL FEATURE -- can be removed/changed
* Change the parent input target element.
* If Null, then it is being set the to main element.
* @type {Null|EventTarget}
* @default null
*/
inputTarget: null,
/**
* force an input class
* @type {Null|Function}
* @default null
*/
inputClass: null,
/**
* Default recognizer setup when calling `Hammer()`
* When creating a new Manager these will be skipped.
* @type {Array}
*/
preset: [
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
[RotateRecognizer, { enable: false }], [PinchRecognizer, { enable: false }, ['rotate']], [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }], [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']], [TapRecognizer], [TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']], [PressRecognizer]],
/**
* Some CSS properties can be used to improve the working of Hammer.
* Add them to this method and they will be set when creating a new Manager.
* @namespace
*/
cssProps: {
/**
* Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userSelect: 'none',
/**
* Disable the Windows Phone grippers when pressing an element.
* @type {String}
* @default 'none'
*/
touchSelect: 'none',
/**
* Disables the default callout shown when you touch and hold a touch target.
* On iOS, when you touch and hold a touch target such as a link, Safari displays
* a callout containing information about the link. This property allows you to disable that callout.
* @type {String}
* @default 'none'
*/
touchCallout: 'none',
/**
* Specifies whether zooming is enabled. Used by IE10>
* @type {String}
* @default 'none'
*/
contentZooming: 'none',
/**
* Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userDrag: 'none',
/**
* Overrides the highlight color shown when the user taps a link or a JavaScript
* clickable element in iOS. This property obeys the alpha value, if specified.
* @type {String}
* @default 'rgba(0,0,0,0)'
*/
tapHighlightColor: 'rgba(0,0,0,0)'
}
};
STOP = 1;
FORCED_STOP = 2;
Manager.prototype = {
/**
* set options
* @param {Object} options
* @returns {Manager}
*/
set: function set(options) {
assign(this.options, options);
// Options that need a little more setup
if (options.touchAction) {
this.touchAction.update();
}
if (options.inputTarget) {
// Clean up existing event listeners and reinitialize
this.input.destroy();
this.input.target = options.inputTarget;
this.input.init();
}
return this;
},
/**
* stop recognizing for this session.
* This session will be discarded, when a new [input]start event is fired.
* When forced, the recognizer cycle is stopped immediately.
* @param {Boolean} [force]
*/
stop: function stop(force) {
this.session.stopped = force ? FORCED_STOP : STOP;
},
/**
* run the recognizers!
* called by the inputHandler function on every movement of the pointers (touches)
* it walks through all the recognizers and tries to detect the gesture that is being made
* @param {Object} inputData
*/
recognize: function recognize(inputData) {
var session = this.session;
if (session.stopped) {
return;
}
// run the touch-action polyfill
this.touchAction.preventDefaults(inputData);
var recognizer;
var recognizers = this.recognizers;
// this holds the recognizer that is being recognized.
// so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
// if no recognizer is detecting a thing, it is set to `null`
var curRecognizer = session.curRecognizer;
// reset when the last recognizer is recognized
// or when we're in a new session
if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
curRecognizer = session.curRecognizer = null;
}
var i = 0;
while (i < recognizers.length) {
recognizer = recognizers[i];
// find out if we are allowed try to recognize the input for this one.
// 1. allow if the session is NOT forced stopped (see the .stop() method)
// 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
// that is being recognized.
// 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
// this can be setup with the `recognizeWith()` method on the recognizer.
if (session.stopped !== FORCED_STOP && (!curRecognizer || recognizer == curRecognizer || recognizer.canRecognizeWith(curRecognizer))) {
recognizer.recognize(inputData);
} else {
recognizer.reset();
}
// if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
// current active recognizer. but only if we don't already have an active recognizer
if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
curRecognizer = session.curRecognizer = recognizer;
}
i++;
}
},
/**
* get a recognizer by its event name.
* @param {Recognizer|String} recognizer
* @returns {Recognizer|Null}
*/
get: function get(recognizer) {
if (recognizer instanceof Recognizer) {
return recognizer;
}
var recognizers = this.recognizers;
for (var i = 0; i < recognizers.length; i++) {
if (recognizers[i].options.event == recognizer) {
return recognizers[i];
}
}
return null;
},
/**
* add a recognizer to the manager
* existing recognizers with the same event name will be removed
* @param {Recognizer} recognizer
* @returns {Recognizer|Manager}
*/
add: function add(recognizer) {
if (invokeArrayArg(recognizer, 'add', this)) {
return this;
}
// remove existing
var existing = this.get(recognizer.options.event);
if (existing) {
this.remove(existing);
}
this.recognizers.push(recognizer);
recognizer.manager = this;
this.touchAction.update();
return recognizer;
},
/**
* remove a recognizer by name or instance
* @param {Recognizer|String} recognizer
* @returns {Manager}
*/
remove: function remove(recognizer) {
if (invokeArrayArg(recognizer, 'remove', this)) {
return this;
}
recognizer = this.get(recognizer);
// let's make sure this recognizer exists
if (recognizer) {
var recognizers = this.recognizers;
var index = inArray(recognizers, recognizer);
if (index !== -1) {
recognizers.splice(index, 1);
this.touchAction.update();
}
}
return this;
},
/**
* bind event
* @param {String} events
* @param {Function} handler
* @returns {EventEmitter} this
*/
on: function on(events, handler) {
var handlers = this.handlers;
each(splitStr(events), function (event) {
handlers[event] = handlers[event] || [];
handlers[event].push(handler);
});
return this;
},
/**
* unbind event, leave emit blank to remove all handlers
* @param {String} events
* @param {Function} [handler]
* @returns {EventEmitter} this
*/
off: function off(events, handler) {
var handlers = this.handlers;
each(splitStr(events), function (event) {
if (!handler) {
delete handlers[event];
} else {
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
}
});
return this;
},
/**
* emit event to the listeners
* @param {String} event
* @param {Object} data
*/
emit: function emit(event, data) {
// we also want to trigger dom events
if (this.options.domEvents) {
triggerDomEvent(event, data);
}
// no handlers, so skip it all
var handlers = this.handlers[event] && this.handlers[event].slice();
if (!handlers || !handlers.length) {
return;
}
data.type = event;
data.preventDefault = function () {
data.srcEvent.preventDefault();
};
var i = 0;
while (i < handlers.length) {
handlers[i](data);
i++;
}
},
/**
* destroy the manager and unbinds all events
* it doesn't unbind dom events, that is the user own responsibility
*/
destroy: function destroy() {
this.element && toggleCssProps(this, false);
this.handlers = {};
this.session = {};
this.input.destroy();
this.element = null;
}
};assign(Hammer, {
INPUT_START: INPUT_START,
INPUT_MOVE: INPUT_MOVE,
INPUT_END: INPUT_END,
INPUT_CANCEL: INPUT_CANCEL,
STATE_POSSIBLE: STATE_POSSIBLE,
STATE_BEGAN: STATE_BEGAN,
STATE_CHANGED: STATE_CHANGED,
STATE_ENDED: STATE_ENDED,
STATE_RECOGNIZED: STATE_RECOGNIZED,
STATE_CANCELLED: STATE_CANCELLED,
STATE_FAILED: STATE_FAILED,
DIRECTION_NONE: DIRECTION_NONE,
DIRECTION_LEFT: DIRECTION_LEFT,
DIRECTION_RIGHT: DIRECTION_RIGHT,
DIRECTION_UP: DIRECTION_UP,
DIRECTION_DOWN: DIRECTION_DOWN,
DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: DIRECTION_VERTICAL,
DIRECTION_ALL: DIRECTION_ALL,
Manager: Manager,
Input: Input,
TouchAction: TouchAction,
TouchInput: TouchInput,
MouseInput: MouseInput,
PointerEventInput: PointerEventInput,
TouchMouseInput: TouchMouseInput,
SingleTouchInput: SingleTouchInput,
Recognizer: Recognizer,
AttrRecognizer: AttrRecognizer,
Tap: TapRecognizer,
Pan: PanRecognizer,
Swipe: SwipeRecognizer,
Pinch: PinchRecognizer,
Rotate: RotateRecognizer,
Press: PressRecognizer,
on: addEventListeners,
off: removeEventListeners,
each: each,
inherit: inherit,
bindFn: bindFn,
prefixed: prefixed
});
win.Hammer = Hammer;
_export('Hammer', Hammer);
}
};
});
System.register('ionic-angular/gestures/slide-edge-gesture', ['./slide-gesture', '../util/util', '../util/dom'], function (_export) {
'use strict';
var SlideGesture, defaults, windowDimensions, SlideEdgeGesture;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_slideGesture) {
SlideGesture = _slideGesture.SlideGesture;
}, function (_utilUtil) {
defaults = _utilUtil.defaults;
}, function (_utilDom) {
windowDimensions = _utilDom.windowDimensions;
}],
execute: function () {
SlideEdgeGesture = (function (_SlideGesture) {
_inherits(SlideEdgeGesture, _SlideGesture);
function SlideEdgeGesture(element) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, SlideEdgeGesture);
defaults(opts, {
edge: 'left',
maxEdgeStart: 50
});
_get(Object.getPrototypeOf(SlideEdgeGesture.prototype), 'constructor', this).call(this, element, opts);
// Can check corners through use of eg 'left top'
this.edges = opts.edge.split(' ');
this.maxEdgeStart = opts.maxEdgeStart;
}
_createClass(SlideEdgeGesture, [{
key: 'canStart',
value: function canStart(ev) {
var _this = this;
this._d = this.getContainerDimensions();
return this.edges.every(function (edge) {
return _this._checkEdge(edge, ev.center);
});
}
}, {
key: 'getContainerDimensions',
value: function getContainerDimensions() {
return {
left: 0,
top: 0,
width: windowDimensions().width,
height: windowDimensions().height
};
}
}, {
key: '_checkEdge',
value: function _checkEdge(edge, pos) {
switch (edge) {
case 'left':
return pos.x <= this._d.left + this.maxEdgeStart;
case 'right':
return pos.x >= this._d.width - this.maxEdgeStart;
case 'top':
return pos.y <= this._d.top + this.maxEdgeStart;
case 'bottom':
return pos.y >= this._d.height - this.maxEdgeStart;
}
}
}]);
return SlideEdgeGesture;
})(SlideGesture);
_export('SlideEdgeGesture', SlideEdgeGesture);
}
};
});
System.register('ionic-angular/gestures/slide-gesture', ['./drag-gesture', '../util'], function (_export) {
'use strict';
var DragGesture, clamp, SlideGesture;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_dragGesture) {
DragGesture = _dragGesture.DragGesture;
}, function (_util) {
clamp = _util.clamp;
}],
execute: function () {
SlideGesture = (function (_DragGesture) {
_inherits(SlideGesture, _DragGesture);
function SlideGesture(element) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, SlideGesture);
_get(Object.getPrototypeOf(SlideGesture.prototype), 'constructor', this).call(this, element, opts);
this.slide = null;
this.element = element;
}
/*
* Get the min and max for the slide. pageX/pageY.
* Only called on dragstart.
*/
_createClass(SlideGesture, [{
key: 'getSlideBoundaries',
value: function getSlideBoundaries(slide, ev) {
return {
min: 0,
max: this.element.offsetWidth
};
}
/*
* Get the element's pos when the drag starts.
* For example, an open side menu starts at 100% and a closed
* sidemenu starts at 0%.
*/
}, {
key: 'getElementStartPos',
value: function getElementStartPos(slide, ev) {
return 0;
}
}, {
key: 'canStart',
value: function canStart(ev) {
return true;
}
}, {
key: 'onDragStart',
value: function onDragStart(ev) {
if (!this.canStart(ev)) {
return false;
}
this.slide = {};
this.onSlideBeforeStart(this.slide, ev);
var _getSlideBoundaries = this.getSlideBoundaries(this.slide, ev);
var min = _getSlideBoundaries.min;
var max = _getSlideBoundaries.max;
this.slide.min = min;
this.slide.max = max;
this.slide.elementStartPos = this.getElementStartPos(this.slide, ev);
this.slide.pointerStartPos = ev.center[this.direction];
this.slide.started = true;
this.onSlideStart(this.slide, ev);
return true;
}
}, {
key: 'onDrag',
value: function onDrag(ev) {
if (!this.slide || !this.slide.started) {
return false;
}
this.slide.pos = ev.center[this.direction];
this.slide.distance = clamp(this.slide.min, this.slide.pos - this.slide.pointerStartPos + this.slide.elementStartPos, this.slide.max);
this.slide.delta = this.slide.pos - this.slide.pointerStartPos;
this.onSlide(this.slide, ev);
return true;
}
}, {
key: 'onDragEnd',
value: function onDragEnd(ev) {
if (!this.slide || !this.slide.started) return;
this.onSlideEnd(this.slide, ev);
this.slide = null;
}
}, {
key: 'onSlideBeforeStart',
value: function onSlideBeforeStart(slide, ev) {}
}, {
key: 'onSlideStart',
value: function onSlideStart(slide, ev) {}
}, {
key: 'onSlide',
value: function onSlide(slide, ev) {}
}, {
key: 'onSlideEnd',
value: function onSlideEnd(slide, ev) {}
}]);
return SlideGesture;
})(DragGesture);
_export('SlideGesture', SlideGesture);
}
};
});
System.register('ionic-angular/platform/platform', ['../util/util', '../util/dom'], function (_export) {
/**
* @name Platform
* @description
* Platform returns the availble information about your current platform.
* Platforms in Ionic 2 are much more complex then in V1, returns not just a single platform,
* but a hierarchy of information, such as a devices OS, phone vs tablet, or mobile vs browser.
* With this information you can completely custimize your app to fit any device and platform.
*
* @usage
* ```ts
* import {Platform} 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
* this.platform = platform;
* }
* }
* ```
* @demo /docs/v2/demos/platform/
*/
'use strict';
var getQuerystring, assign, ready, windowDimensions, flushDimensionCache, Platform, PlatformNode, platformRegistry, platformDefault;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function insertSuperset(platformNode) {
var supersetPlaformName = platformNode.superset();
if (supersetPlaformName) {
// add a platform in between two exist platforms
// so we can build the correct hierarchy of active platforms
var supersetPlatform = new PlatformNode(supersetPlaformName);
supersetPlatform.parent = platformNode.parent;
supersetPlatform.child = platformNode;
if (supersetPlatform.parent) {
supersetPlatform.parent.child = supersetPlatform;
}
platformNode.parent = supersetPlatform;
}
}
return {
setters: [function (_utilUtil) {
getQuerystring = _utilUtil.getQuerystring;
assign = _utilUtil.assign;
}, function (_utilDom) {
ready = _utilDom.ready;
windowDimensions = _utilDom.windowDimensions;
flushDimensionCache = _utilDom.flushDimensionCache;
}],
execute: function () {
Platform = (function () {
function Platform() {
var _this = this;
var platforms = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
_classCallCheck(this, Platform);
this._versions = {};
this._onResizes = [];
this._platforms = platforms;
this._readyPromise = new Promise(function (res) {
_this._readyResolve = res;
});
}
// Methods
// **********************************************
/**
* @param {string} platformName
* @returns {boolean} returns true/false based on platform you place
* @description
* Depending on the platform name, isPlatform will return true or flase
*
* ```
* import {Platform} 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
* this.platform = platform;
* if(this.platform.is('ios'){
* // what ever you need to do for
* // if the platfomr is ios
* }
* }
* }
* ```
*/
_createClass(Platform, [{
key: 'is',
value: function is(platformName) {
return this._platforms.indexOf(platformName) > -1;
}
/**
* @returns {array} the array of platforms
* @description
* Depending on what device you are on, `platforms` can return multiple values.
* Each possible value is a hierarchy of platforms. For example, on an iPhone,
* it would return mobile, ios, and iphone.
*
* ```
* import {Platform} 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
* this.platform = platform;
* console.log(this.platform.platforms());
* // This will return an array of all the availble platforms
* // From if your on mobile, to mobile os, and device name
* }
* }
* ```
*/
}, {
key: 'platforms',
value: function platforms() {
// get the array of active platforms, which also knows the hierarchy,
// with the last one the most important
return this._platforms;
}
/**
* Returns an object containing information about the paltform
*
* ```
* import {Platform} 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
* this.platform = platform;
* console.log(this.platform.versions());
* }
* }
* ```
* @param {string} [platformName] optional platformName
* @returns {object} An object with various platform info
*
*/
}, {
key: 'versions',
value: function versions(platformName) {
if (arguments.length) {
// get a specific platform's version
return this._versions[platformName];
}
// get all the platforms that have a valid parsed version
return this._versions;
}
/**
* @private
*/
}, {
key: 'version',
value: function version() {
for (var platformName in this._versions) {
if (this._versions[platformName]) {
return this._versions[platformName];
}
}
return {};
}
/**
* Returns a promise when the platform is ready and native functionality can be called
*
* ```
* import {Platform} 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
* this.platform = platform;
* this.platform.ready().then(() => {
* console.log('Platform ready');
* // The platform is now ready, execute any native code you want
* });
* }
* }
* ```
* @returns {promise} Returns a promsie when device ready has fired
*/
}, {
key: 'ready',
value: function ready() {
return this._readyPromise;
}
/**
* @private
*/
}, {
key: 'prepareReady',
value: function prepareReady(config) {
var self = this;
function resolve() {
self._readyResolve(config);
}
if (this._engineReady) {
// the engine provide a ready promise, use this instead
this._engineReady(resolve);
} else {
// there is no custom ready method from the engine
// use the default dom ready
ready(resolve);
}
}
/**
* Set the app's language direction, which will update the `dir` attribute
* on the app's root `` element. We recommend the app's `index.html`
* file already has the correct `dir` attribute value set, such as
* `` or ``. This method is useful if the
* direction needs to be dynamically changed per user/session.
* [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir)
* @param {string} dir Examples: `rtl`, `ltr`
*/
}, {
key: 'setDir',
value: function setDir(dir, updateDocument) {
this._dir = (dir || '').toLowerCase();
if (updateDocument !== false) {
document.documentElement.setAttribute('dir', dir);
}
}
/**
* Returns app's language direction.
* We recommend the app's `index.html` file already has the correct `dir`
* attribute value set, such as `` or ``.
* [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir)
* @returns {string}
*/
}, {
key: 'dir',
value: function dir() {
return this._dir;
}
/**
* Returns if this app is using right-to-left language direction or not.
* We recommend the app's `index.html` file already has the correct `dir`
* attribute value set, such as `` or ``.
* [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir)
* @returns {boolean}
*/
}, {
key: 'isRTL',
value: function isRTL() {
return this._dir === 'rtl';
}
/**
* Set the app's language and optionally the country code, which will update
* the `lang` attribute on the app's root `` element.
* We recommend the app's `index.html` file already has the correct `lang`
* attribute value set, such as ``. This method is useful if
* the language needs to be dynamically changed per user/session.
* [W3C: Declaring language in HTML](http://www.w3.org/International/questions/qa-html-language-declarations)
* @param {string} language Examples: `en-US`, `en-GB`, `ar`, `de`, `zh`, `es-MX`
*/
}, {
key: 'setLang',
value: function setLang(language, updateDocument) {
this._lang = language;
if (updateDocument !== false) {
document.documentElement.setAttribute('lang', language);
}
}
/**
* Returns app's language and optional country code.
* We recommend the app's `index.html` file already has the correct `lang`
* attribute value set, such as ``.
* [W3C: Declaring language in HTML](http://www.w3.org/International/questions/qa-html-language-declarations)
* @returns {string}
*/
}, {
key: 'lang',
value: function lang() {
return this._lang;
}
// Methods meant to be overridden by the engine
// **********************************************
// Provided NOOP methods so they do not error when
// called by engines (the browser) doesn't provide them
/**
* @private
*/
}, {
key: 'on',
value: function on() {}
/**
* @private
*/
}, {
key: 'onHardwareBackButton',
value: function onHardwareBackButton() {}
/**
* @private
*/
}, {
key: 'registerBackButtonAction',
value: function registerBackButtonAction() {}
/**
* @private
*/
}, {
key: 'exitApp',
value: function exitApp() {}
/**
* @private
*/
}, {
key: 'fullScreen',
value: function fullScreen() {}
/**
* @private
*/
}, {
key: 'showStatusBar',
value: function showStatusBar() {}
// Getter/Setter Methods
// **********************************************
/**
* @private
*/
}, {
key: 'setUrl',
value: function setUrl(url) {
this._url = url;
this._qs = getQuerystring(url);
}
/**
* @private
*/
}, {
key: 'url',
value: function url() {
return this._url;
}
/**
* @private
*/
}, {
key: 'query',
value: function query(key) {
return (this._qs || {})[key];
}
/**
* @private
*/
}, {
key: 'setUserAgent',
value: function setUserAgent(userAgent) {
this._ua = userAgent;
}
/**
* @private
*/
}, {
key: 'userAgent',
value: function userAgent() {
return this._ua || '';
}
/**
* @private
*/
}, {
key: 'setNavigatorPlatform',
value: function setNavigatorPlatform(navigatorPlatform) {
this._bPlt = navigatorPlatform;
}
/**
* @private
*/
}, {
key: 'navigatorPlatform',
value: function navigatorPlatform() {
return this._bPlt || '';
}
/**
* @private
*/
}, {
key: 'width',
value: function width() {
return windowDimensions().width;
}
/**
* @private
*/
}, {
key: 'height',
value: function height() {
return windowDimensions().height;
}
/**
* @private
*/
}, {
key: 'isPortrait',
value: function isPortrait() {
return this.width() < this.height();
}
/**
* @private
*/
}, {
key: 'isLandscape',
value: function isLandscape() {
return !this.isPortrait();
}
/**
* @private
*/
}, {
key: 'windowResize',
value: function windowResize() {
var self = this;
clearTimeout(self._resizeTm);
self._resizeTm = setTimeout(function () {
flushDimensionCache();
for (var i = 0; i < self._onResizes.length; i++) {
try {
self._onResizes[i]();
} catch (e) {
void 0;
}
}
}, 200);
}
/**
* @private
* @returns Unregister function
*/
}, {
key: 'onResize',
value: function onResize(cb) {
var self = this;
self._onResizes.push(cb);
return function () {
var index = self._onResizes.indexOf(cb);
if (index > -1) {
self._onResizes.splice(index, 1);
}
};
}
// Platform Registry
// **********************************************
/**
* @private
*/
}, {
key: 'testQuery',
/**
* @private
*/
value: function testQuery(queryValue, queryTestValue) {
var valueSplit = queryValue.toLowerCase().split(';');
return valueSplit.indexOf(queryTestValue) > -1;
}
/**
* @private
*/
}, {
key: 'testUserAgent',
value: function testUserAgent(userAgentExpression) {
var rgx = new RegExp(userAgentExpression, 'i');
return rgx.test(this._ua || '');
}
/**
* @private
*/
}, {
key: 'testNavigatorPlatform',
value: function testNavigatorPlatform(navigatorPlatformExpression) {
var rgx = new RegExp(navigatorPlatformExpression, 'i');
return rgx.test(this._bPlt);
}
/**
* @private
*/
}, {
key: 'matchUserAgentVersion',
value: function matchUserAgentVersion(userAgentExpression) {
if (this._ua && userAgentExpression) {
var val = this._ua.match(userAgentExpression);
if (val) {
return {
major: val[1],
minor: val[2]
};
}
}
}
/**
* @private
*/
}, {
key: 'isPlatform',
value: function isPlatform(queryTestValue, userAgentExpression) {
if (!userAgentExpression) {
userAgentExpression = queryTestValue;
}
var queryValue = this.query('ionicplatform');
if (queryValue) {
return this.testQuery(queryValue, queryTestValue);
}
return this.testUserAgent(userAgentExpression);
}
/**
* @private
*/
}, {
key: 'load',
value: function load(platformOverride) {
var rootPlatformNode = null;
var engineNode = null;
var self = this;
this.platformOverride = platformOverride;
// figure out the most specific platform and active engine
var tmpPlatform = null;
for (var platformName in platformRegistry) {
tmpPlatform = this.matchPlatform(platformName);
if (tmpPlatform) {
// we found a platform match!
// check if its more specific than the one we already have
if (tmpPlatform.isEngine) {
// because it matched then this should be the active engine
// you cannot have more than one active engine
engineNode = tmpPlatform;
} else if (!rootPlatformNode || tmpPlatform.depth > rootPlatformNode.depth) {
// only find the root node for platforms that are not engines
// set this node as the root since we either don't already
// have one, or this one is more specific that the current one
rootPlatformNode = tmpPlatform;
}
}
}
if (!rootPlatformNode) {
rootPlatformNode = new PlatformNode(platformDefault);
}
// build a Platform instance filled with the
// hierarchy of active platforms and settings
if (rootPlatformNode) {
// check if we found an engine node (cordova/node-webkit/etc)
if (engineNode) {
// add the engine to the first in the platform hierarchy
// the original rootPlatformNode now becomes a child
// of the engineNode, which is not the new root
engineNode.child = rootPlatformNode;
rootPlatformNode.parent = engineNode;
rootPlatformNode = engineNode;
// add any events which the engine would provide
// for example, Cordova provides its own ready event
var engineMethods = engineNode.methods();
engineMethods._engineReady = engineMethods.ready;
delete engineMethods.ready;
assign(this, engineMethods);
}
var platformNode = rootPlatformNode;
while (platformNode) {
insertSuperset(platformNode);
platformNode = platformNode.child;
}
// make sure the root noot is actually the root
// incase a node was inserted before the root
platformNode = rootPlatformNode.parent;
while (platformNode) {
rootPlatformNode = platformNode;
platformNode = platformNode.parent;
}
platformNode = rootPlatformNode;
while (platformNode) {
// set the array of active platforms with
// the last one in the array the most important
this._platforms.push(platformNode.name());
// get the platforms version if a version parser was provided
this._versions[platformNode.name()] = platformNode.version(this);
// go to the next platform child
platformNode = platformNode.child;
}
}
if (this._platforms.indexOf('mobile') > -1 && this._platforms.indexOf('cordova') === -1) {
this._platforms.push('mobileweb');
}
}
/**
* @private
*/
}, {
key: 'matchPlatform',
value: function matchPlatform(platformName) {
// build a PlatformNode and assign config data to it
// use it's getRoot method to build up its hierarchy
// depending on which platforms match
var platformNode = new PlatformNode(platformName);
var rootNode = platformNode.getRoot(this);
if (rootNode) {
rootNode.depth = 0;
var childPlatform = rootNode.child;
while (childPlatform) {
rootNode.depth++;
childPlatform = childPlatform.child;
}
}
return rootNode;
}
}], [{
key: 'register',
value: function register(platformConfig) {
platformRegistry[platformConfig.name] = platformConfig;
}
/**
* @private
*/
}, {
key: 'registry',
value: function registry() {
return platformRegistry;
}
/**
* @private
*/
}, {
key: 'get',
value: function get(platformName) {
return platformRegistry[platformName] || {};
}
/**
* @private
*/
}, {
key: 'setDefault',
value: function setDefault(platformName) {
platformDefault = platformName;
}
}]);
return Platform;
})();
_export('Platform', Platform);
PlatformNode = (function () {
function PlatformNode(platformName) {
_classCallCheck(this, PlatformNode);
this.c = Platform.get(platformName);
this.isEngine = this.c.isEngine;
}
_createClass(PlatformNode, [{
key: 'name',
value: function name() {
return this.c.name;
}
}, {
key: 'settings',
value: function settings() {
return this.c.settings || {};
}
}, {
key: 'superset',
value: function superset() {
return this.c.superset;
}
}, {
key: 'methods',
value: function methods() {
return this.c.methods || {};
}
}, {
key: 'isMatch',
value: function isMatch(p) {
if (p.platformOverride && !this.isEngine) {
return p.platformOverride === this.c.name;
} else if (!this.c.isMatch) {
return false;
}
return this.c.isMatch(p);
}
}, {
key: 'version',
value: function version(p) {
if (this.c.versionParser) {
var v = this.c.versionParser(p);
if (v) {
var str = v.major + '.' + v.minor;
return {
str: str,
num: parseFloat(str),
major: parseInt(v.major, 10),
minor: parseInt(v.minor, 10)
};
}
}
}
}, {
key: 'getRoot',
value: function getRoot(p) {
if (this.isMatch(p)) {
var parents = this.getSubsetParents(this.name());
if (!parents.length) {
return this;
}
var platform = null;
var rootPlatform = null;
for (var i = 0; i < parents.length; i++) {
platform = new PlatformNode(parents[i]);
platform.child = this;
rootPlatform = platform.getRoot(p);
if (rootPlatform) {
this.parent = platform;
return rootPlatform;
}
}
}
return null;
}
}, {
key: 'getSubsetParents',
value: function getSubsetParents(subsetPlatformName) {
var platformRegistry = Platform.registry();
var parentPlatformNames = [];
var platform = null;
for (var platformName in platformRegistry) {
platform = platformRegistry[platformName];
if (platform.subsets && platform.subsets.indexOf(subsetPlatformName) > -1) {
parentPlatformNames.push(platformName);
}
}
return parentPlatformNames;
}
}]);
return PlatformNode;
})();
platformRegistry = {};
platformDefault = null;
}
};
});
System.register('ionic-angular/platform/registry', ['./platform', '../util/dom'], function (_export) {
'use strict';
var Platform, windowLoad, win, doc;
function isIOSDevice(p) {
// shortcut function to be reused internally
// checks navigator.platform to see if it's an actual iOS device
// this does not use the user-agent string because it is often spoofed
// an actual iPad will return true, a chrome dev tools iPad will return false
return p.testNavigatorPlatform('iphone|ipad|ipod');
}
return {
setters: [function (_platform) {
Platform = _platform.Platform;
}, function (_utilDom) {
windowLoad = _utilDom.windowLoad;
}],
execute: function () {
win = window;
doc = document;
Platform.register({
name: 'core',
settings: {
mode: 'ios',
keyboardHeight: 290
}
});
Platform.setDefault('core');
Platform.register({
name: 'mobile'
});
Platform.register({
name: 'phablet',
isMatch: function isMatch(p) {
var smallest = Math.min(p.width(), p.height());
var largest = Math.max(p.width(), p.height());
return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
}
});
Platform.register({
name: 'tablet',
isMatch: function isMatch(p) {
var smallest = Math.min(p.width(), p.height());
var largest = Math.max(p.width(), p.height());
return smallest > 460 && smallest < 820 && largest > 780 && largest < 1400;
}
});
Platform.register({
name: 'android',
superset: 'mobile',
subsets: ['phablet', 'tablet'],
settings: {
activator: function activator(p) {
// md mode defaults to use ripple activator
// however, under-powered devices shouldn't use ripple
// if this a linux device, and is using Android Chrome v36 (Android 5.0)
// or above then use ripple, otherwise do not use a ripple effect
if (p.testNavigatorPlatform('linux')) {
var chromeVersion = p.matchUserAgentVersion(/Chrome\/(\d+).(\d+)?/);
if (chromeVersion) {
// linux android device using modern android chrome browser gets ripple
return parseInt(chromeVersion.major, 10) < 36 ? 'none' : 'ripple';
}
// linux android device not using chrome browser checks just android's version
if (p.version().major < 5) {
return 'none';
}
}
// fallback to always use ripple
return 'ripple';
},
autoFocusAssist: 'immediate',
hoverCSS: false,
keyboardHeight: 300,
mode: 'md',
scrollAssist: true
},
isMatch: function isMatch(p) {
return p.isPlatform('android', 'android|silk');
},
versionParser: function versionParser(p) {
return p.matchUserAgentVersion(/Android (\d+).(\d+)?/);
}
});
Platform.register({
name: 'ios',
superset: 'mobile',
subsets: ['ipad', 'iphone'],
settings: {
autoFocusAssist: 'delay',
clickBlock: true,
hoverCSS: false,
keyboardHeight: 300,
mode: 'ios',
scrollAssist: isIOSDevice,
swipeBackEnabled: isIOSDevice,
swipeBackThreshold: 40,
tapPolyfill: isIOSDevice
},
isMatch: function isMatch(p) {
return p.isPlatform('ios', 'iphone|ipad|ipod');
},
versionParser: function versionParser(p) {
return p.matchUserAgentVersion(/OS (\d+)_(\d+)?/);
}
});
Platform.register({
name: 'ipad',
superset: 'tablet',
settings: {
keyboardHeight: 500
},
isMatch: function isMatch(p) {
return p.isPlatform('ios', 'ipad');
}
});
Platform.register({
name: 'iphone',
subsets: ['phablet'],
isMatch: function isMatch(p) {
return p.isPlatform('ios', 'iphone');
}
});
Platform.register({
name: 'windowsphone',
superset: 'mobile',
subsets: ['phablet', 'tablet'],
settings: {
mode: 'md'
},
isMatch: function isMatch(p) {
return p.isPlatform('windowsphone', 'windows phone');
},
versionParser: function versionParser(p) {
return p.matchUserAgentVersion(/Windows Phone (\d+).(\d+)?/);
}
});
Platform.register({
name: 'cordova',
isEngine: true,
methods: {
ready: function ready(resolve) {
function isReady() {
doc.removeEventListener('deviceready', isReady);
resolve();
}
windowLoad(function () {
doc.addEventListener('deviceready', isReady);
});
}
},
isMatch: function isMatch() {
return !!(win.cordova || win.PhoneGap || win.phonegap);
}
});
}
};
});
System.register('ionic-angular/platform/storage', ['./storage/storage', './storage/local-storage', './storage/sql'], function (_export) {
'use strict';
return {
setters: [function (_storageStorage) {
for (var _key in _storageStorage) {
if (_key !== 'default') _export(_key, _storageStorage[_key]);
}
}, function (_storageLocalStorage) {
for (var _key2 in _storageLocalStorage) {
if (_key2 !== 'default') _export(_key2, _storageLocalStorage[_key2]);
}
}, function (_storageSql) {
for (var _key3 in _storageSql) {
if (_key3 !== 'default') _export(_key3, _storageSql[_key3]);
}
}],
execute: function () {}
};
});
System.register('ionic-angular/transitions/transition-ios', ['../animations/animation', './transition'], function (_export) {
'use strict';
var Animation, Transition, DURATION, EASING, OPACITY, TRANSLATEX, OFF_RIGHT, OFF_LEFT, CENTER, OFF_OPACITY, SHOW_BACK_BTN_CSS, IOSTransition;
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_animationsAnimation) {
Animation = _animationsAnimation.Animation;
}, function (_transition) {
Transition = _transition.Transition;
}],
execute: function () {
DURATION = 500;
EASING = 'cubic-bezier(0.36,0.66,0.04,1)';
OPACITY = 'opacity';
TRANSLATEX = 'translateX';
OFF_RIGHT = '99.5%';
OFF_LEFT = '-33%';
CENTER = '0%';
OFF_OPACITY = 0.8;
SHOW_BACK_BTN_CSS = 'show-back-button';
IOSTransition = (function (_Transition) {
_inherits(IOSTransition, _Transition);
function IOSTransition(enteringView, leavingView, opts) {
_classCallCheck(this, IOSTransition);
_get(Object.getPrototypeOf(IOSTransition.prototype), 'constructor', this).call(this, opts);
this.duration(opts.duration || DURATION);
this.easing(opts.easing || EASING);
// what direction is the transition going
var backDirection = opts.direction === 'back';
// do they have navbars?
var enteringHasNavbar = enteringView.hasNavbar();
var leavingHasNavbar = leavingView && leavingView.hasNavbar();
var enteringPage = new Animation(enteringView.pageRef());
enteringPage.before.addClass('show-page');
this.add(enteringPage);
// entering content
var enteringContent = new Animation(enteringView.contentRef());
this.add(enteringContent);
if (backDirection) {
// entering content, back direction
enteringContent.fromTo(TRANSLATEX, OFF_LEFT, CENTER, true).fromTo(OPACITY, OFF_OPACITY, 1, true);
} else {
// entering content, forward direction
enteringContent.before.clearStyles([OPACITY]).fromTo(TRANSLATEX, OFF_RIGHT, CENTER, true);
}
if (enteringHasNavbar) {
// entering page has a navbar
var enteringNavBar = new Animation(enteringView.navbarRef());
enteringNavBar.before.addClass('show-navbar');
this.add(enteringNavBar);
var enteringTitle = new Animation(enteringView.titleRef());
var enteringNavbarItems = new Animation(enteringView.navbarItemRefs());
var enteringNavbarBg = new Animation(enteringView.navbarBgRef());
var enteringBackButton = new Animation(enteringView.backBtnRef());
enteringNavBar.add(enteringTitle).add(enteringNavbarItems).add(enteringNavbarBg).add(enteringBackButton);
enteringTitle.fadeIn();
enteringNavbarItems.fadeIn();
// set properties depending on direction
if (backDirection) {
// entering navbar, back direction
enteringTitle.fromTo(TRANSLATEX, OFF_LEFT, CENTER, true);
if (enteringView.enableBack()) {
// back direction, entering page has a back button
enteringBackButton.before.addClass(SHOW_BACK_BTN_CSS).fadeIn();
}
} else {
// entering navbar, forward direction
enteringTitle.fromTo(TRANSLATEX, OFF_RIGHT, CENTER, true);
if (leavingHasNavbar) {
// entering navbar, forward direction, and there's a leaving navbar
// should just fade in, no sliding
enteringNavbarBg.before.clearStyles([TRANSLATEX]).fadeIn();
} else {
// entering navbar, forward direction, and there's no leaving navbar
// should just slide in, no fading in
enteringNavbarBg.before.clearStyles([OPACITY]).fromTo(TRANSLATEX, OFF_RIGHT, CENTER, true);
}
if (enteringView.enableBack()) {
// forward direction, entering page has a back button
enteringBackButton.before.addClass(SHOW_BACK_BTN_CSS).fadeIn();
var enteringBackBtnText = new Animation(enteringView.backBtnTextRef());
enteringBackBtnText.fromTo(TRANSLATEX, '100px', '0px');
enteringNavBar.add(enteringBackBtnText);
} else {
enteringBackButton.before.removeClass(SHOW_BACK_BTN_CSS);
}
}
}
// setup leaving view
if (leavingView) {
// leaving content
var leavingContent = new Animation(leavingView.contentRef());
this.add(leavingContent);
if (backDirection) {
// leaving content, back direction
leavingContent.before.clearStyles([OPACITY]).fromTo(TRANSLATEX, CENTER, '100%');
} else {
// leaving content, forward direction
leavingContent.fromTo(TRANSLATEX, CENTER, OFF_LEFT).fromTo(OPACITY, 1, OFF_OPACITY);
}
if (leavingHasNavbar) {
// leaving page has a navbar
var leavingNavBar = new Animation(leavingView.navbarRef());
var leavingBackButton = new Animation(leavingView.backBtnRef());
var leavingTitle = new Animation(leavingView.titleRef());
var leavingNavbarItems = new Animation(leavingView.navbarItemRefs());
var leavingNavbarBg = new Animation(leavingView.navbarBgRef());
leavingNavBar.add(leavingBackButton).add(leavingTitle).add(leavingNavbarItems).add(leavingNavbarBg);
this.add(leavingNavBar);
// fade out leaving navbar items
leavingBackButton.fadeOut();
leavingTitle.fadeOut();
leavingNavbarItems.fadeOut();
if (backDirection) {
// leaving navbar, back direction
leavingTitle.fromTo(TRANSLATEX, CENTER, '100%');
if (enteringHasNavbar) {
// leaving navbar, back direction, and there's an entering navbar
// should just fade out, no sliding
leavingNavbarBg.before.clearStyles([TRANSLATEX]).fadeOut();
} else {
// leaving navbar, back direction, and there's no entering navbar
// should just slide out, no fading out
leavingNavbarBg.before.clearStyles([OPACITY]).fromTo(TRANSLATEX, CENTER, '100%');
}
var leavingBackBtnText = new Animation(leavingView.backBtnTextRef());
leavingBackBtnText.fromTo(TRANSLATEX, CENTER, 300 + 'px');
leavingNavBar.add(leavingBackBtnText);
} else {
// leaving navbar, forward direction
leavingTitle.fromTo(TRANSLATEX, CENTER, OFF_LEFT);
}
}
}
}
return IOSTransition;
})(Transition);
Transition.register('ios-transition', IOSTransition);
}
};
});
System.register('ionic-angular/transitions/transition-md', ['../animations/animation', './transition'], function (_export) {
'use strict';
var Animation, Transition, TRANSLATEY, OFF_BOTTOM, CENTER, SHOW_BACK_BTN_CSS, MDTransition;
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_animationsAnimation) {
Animation = _animationsAnimation.Animation;
}, function (_transition) {
Transition = _transition.Transition;
}],
execute: function () {
TRANSLATEY = 'translateY';
OFF_BOTTOM = '40px';
CENTER = '0px';
SHOW_BACK_BTN_CSS = 'show-back-button';
MDTransition = (function (_Transition) {
_inherits(MDTransition, _Transition);
function MDTransition(enteringView, leavingView, opts) {
_classCallCheck(this, MDTransition);
_get(Object.getPrototypeOf(MDTransition.prototype), 'constructor', this).call(this, opts);
// what direction is the transition going
var backDirection = opts.direction === 'back';
// do they have navbars?
var enteringHasNavbar = enteringView.hasNavbar();
var leavingHasNavbar = leavingView && leavingView.hasNavbar();
// entering content item moves in bottom to center
var enteringPage = new Animation(enteringView.pageRef());
enteringPage.before.addClass('show-page');
this.add(enteringPage);
if (backDirection) {
this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
enteringPage.before.clearStyles([TRANSLATEY]);
} else {
this.duration(opts.duration || 280).easing('cubic-bezier(0.36,0.66,0.04,1)');
enteringPage.fromTo(TRANSLATEY, OFF_BOTTOM, CENTER, true).fadeIn();
}
if (enteringHasNavbar) {
var enteringNavBar = new Animation(enteringView.navbarRef());
enteringNavBar.before.addClass('show-navbar');
this.add(enteringNavBar);
var enteringBackButton = new Animation(enteringView.backBtnRef());
this.add(enteringBackButton);
if (enteringView.enableBack()) {
enteringBackButton.before.addClass(SHOW_BACK_BTN_CSS);
} else {
enteringBackButton.before.removeClass(SHOW_BACK_BTN_CSS);
}
}
// setup leaving view
if (leavingView && backDirection) {
// leaving content
this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
var leavingPage = new Animation(leavingView.pageRef());
this.add(leavingPage.fromTo(TRANSLATEY, CENTER, OFF_BOTTOM).fadeOut());
}
}
return MDTransition;
})(Transition);
Transition.register('md-transition', MDTransition);
}
};
});
System.register('ionic-angular/transitions/transition', ['../animations/animation'], function (_export) {
/**
* @private
**/
'use strict';
var Animation, Transition, TransitionRegistry;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_animationsAnimation) {
Animation = _animationsAnimation.Animation;
}],
execute: function () {
Transition = (function (_Animation) {
_inherits(Transition, _Animation);
function Transition(opts) {
_classCallCheck(this, Transition);
_get(Object.getPrototypeOf(Transition.prototype), 'constructor', this).call(this, null, {
renderDelay: opts.renderDelay
});
}
_createClass(Transition, null, [{
key: 'createTransition',
value: function createTransition(enteringView, leavingView, opts) {
var TransitionClass = TransitionRegistry[opts.animation];
if (!TransitionClass) {
// didn't find a transition animation, default to ios-transition
TransitionClass = TransitionRegistry['ios-transition'];
}
return new TransitionClass(enteringView, leavingView, opts);
}
}, {
key: 'register',
value: function register(name, TransitionClass) {
TransitionRegistry[name] = TransitionClass;
}
}]);
return Transition;
})(Animation);
_export('Transition', Transition);
TransitionRegistry = {};
}
};
});
System.register('ionic-angular/translation/translate', [], function (_export) {
/**
* @private
* Provide multi-language and i18n support in your app. Translate works by
* mapping full strings to language translated ones. That means that you don't
* need to provide strings for your default language, just new languages.
*
* Note: The Angular team will be building an
* [Localization/Internationalization](https://docs.google.com/document/d/1mwyOFsAD-bPoXTk3Hthq0CAcGXCUw-BtTJMR4nGTY-0/view#heading=h.ixg45w3363q)
* provider, so this Translation provider may not be further developed.
*
* @usage
* ```js
* Translate.translations({
* 'de': {
* 'Welcome to MyApp': 'Willkommen auf'
* }
* })
*
* Changing the default language:
*
* Translate.setLanguage('de');
* ```
*
* Usage in a template:
*
* ```js
* {{ 'Welcome to MyApp' | translate }}
* ```
*/
'use strict';
var Translate;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
return {
setters: [],
execute: function () {
Translate = (function () {
function Translate() {
_classCallCheck(this, Translate);
this._transMap = {};
this._language = {};
}
_createClass(Translate, [{
key: 'translations',
value: function translations(lang, map) {
this._transMap[lang] = map;
}
}, {
key: 'setLanguage',
value: function setLanguage(lang) {
this._language = lang;
}
}, {
key: 'getTranslations',
value: function getTranslations(lang) {
return this._transMap[lang];
}
}, {
key: 'translate',
value: function translate(key, lang) {
// If the language isn't specified and we have no overridden one, return the string passed.
if (!lang && !this._language) {
return key;
}
var setLanguage = lang || this._language;
var map = this.getTranslations(setLanguage);
if (!map) {
void 0;
return '';
}
return this._getTranslation(map, key);
}
}, {
key: '_getTranslation',
value: function _getTranslation(map, key) {
return map && map[key] || '';
}
}]);
return Translate;
})();
_export('Translate', Translate);
}
};
});
System.register("ionic-angular/translation/translate_pipe", ["angular2/core", "./translate"], function (_export) {
/**
* @private
* The Translate pipe makes it easy to translate strings.
*
* @usage
* Translate using the current language or language set through Translate.setLanguage
* {{ 'Please enter your location' | translate }}
*
* Translate using a specific language
* {{ 'Please enter your location' | translate:"de" }}
*/
"use strict";
var Injectable, Pipe, Translate, __decorate, __metadata, TranslatePipe, _a;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Injectable = _angular2Core.Injectable;
Pipe = _angular2Core.Pipe;
}, function (_translate) {
Translate = _translate.Translate;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
TranslatePipe = (function () {
function TranslatePipe(translate) {
_classCallCheck(this, TranslatePipe);
this.translate = {};
this.translate = translate;
}
_createClass(TranslatePipe, [{
key: "transform",
value: function transform(value, args) {
var lang = undefined;
if (args.length > 0) {
lang = args[0];
}
return this.translate.translate(value, lang);
}
}, {
key: "supports",
value: function supports(obj) {
return true;
}
}]);
return TranslatePipe;
})();
_export("TranslatePipe", TranslatePipe);
_export("TranslatePipe", TranslatePipe = __decorate([Pipe({ name: 'translate' }), Injectable(), __metadata('design:paramtypes', [typeof (_a = typeof Translate !== 'undefined' && Translate) === 'function' && _a || Object])], TranslatePipe));
}
};
});
System.register('ionic-angular/util/click-block', [], function (_export) {
'use strict';
var CSS_CLICK_BLOCK, DEFAULT_EXPIRE, cbEle, fallbackTimerId, isShowing, ClickBlock;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _show(expire) {
clearTimeout(fallbackTimerId);
fallbackTimerId = setTimeout(hide, expire || DEFAULT_EXPIRE);
if (!isShowing) {
cbEle.classList.add(CSS_CLICK_BLOCK);
isShowing = true;
}
}
function hide() {
clearTimeout(fallbackTimerId);
if (isShowing) {
cbEle.classList.remove(CSS_CLICK_BLOCK);
isShowing = false;
}
}
return {
setters: [],
execute: function () {
CSS_CLICK_BLOCK = 'click-block-active';
DEFAULT_EXPIRE = 330;
cbEle = undefined;
fallbackTimerId = undefined;
isShowing = false;
/**
* @private
*/
ClickBlock = (function () {
function ClickBlock() {
_classCallCheck(this, ClickBlock);
this._enabled = false;
}
_createClass(ClickBlock, [{
key: 'enable',
value: function enable() {
cbEle = document.createElement('click-block');
document.body.appendChild(cbEle);
cbEle.addEventListener('touchmove', function (ev) {
ev.preventDefault();
ev.stopPropagation();
});
this._enabled = true;
}
}, {
key: 'show',
value: function show(shouldShow, expire) {
if (this._enabled) {
if (shouldShow) {
_show(expire);
} else {
hide();
}
}
}
}]);
return ClickBlock;
})();
_export('ClickBlock', ClickBlock);
}
};
});
System.register('ionic-angular/util/dom', [], function (_export) {
// RequestAnimationFrame Polyfill (Android 4.3 and below)
/*! @author Paul Irish */
/*! @source https://gist.github.com/paulirish/1579671 */
'use strict';
var raf, cancelRaf, CSS, skipInputAttrsReg, matchesFn, matchesMethods, dimensionCache;
_export('rafFrames', rafFrames);
_export('transitionEnd', transitionEnd);
_export('ready', ready);
_export('windowLoad', windowLoad);
_export('pointerCoord', pointerCoord);
_export('hasPointerMoved', hasPointerMoved);
_export('isActive', isActive);
_export('hasFocus', hasFocus);
_export('isTextInput', isTextInput);
_export('hasFocusedTextInput', hasFocusedTextInput);
_export('copyInputAttributes', copyInputAttributes);
/**
* Get the element offsetWidth and offsetHeight. Values are cached
* to reduce DOM reads. Cache is cleared on a window resize.
*/
_export('closest', closest);
_export('getDimensions', getDimensions);
_export('clearDimensions', clearDimensions);
_export('windowDimensions', windowDimensions);
_export('flushDimensionCache', flushDimensionCache);
function rafFrames(framesToWait, callback) {
framesToWait = Math.ceil(framesToWait);
if (framesToWait < 2) {
raf(callback);
} else {
setTimeout(function () {
raf(callback);
}, (framesToWait - 1) * 17);
}
}
function transitionEnd(el, callback) {
if (el) {
var _ret = (function () {
var unregister = function unregister() {
CSS.transitionEnd.split(' ').forEach(function (eventName) {
el.removeEventListener(eventName, onEvent);
});
};
var onEvent = function onEvent(ev) {
if (el === ev.target) {
unregister();
callback(ev);
}
};
CSS.transitionEnd.split(' ').forEach(function (eventName) {
el.addEventListener(eventName, onEvent);
});
return {
v: unregister
};
})();
if (typeof _ret === 'object') return _ret.v;
}
}
function ready(callback) {
var promise = null;
if (!callback) {
// a callback wasn't provided, so let's return a promise instead
promise = new Promise(function (resolve) {
callback = resolve;
});
}
if (document.readyState === 'complete' || document.readyState === 'interactive') {
callback();
} else {
(function () {
var completed = function completed() {
document.removeEventListener('DOMContentLoaded', completed, false);
window.removeEventListener('load', completed, false);
callback();
};
document.addEventListener('DOMContentLoaded', completed, false);
window.addEventListener('load', completed, false);
})();
}
return promise;
}
function windowLoad(callback) {
var promise = null;
if (!callback) {
// a callback wasn't provided, so let's return a promise instead
promise = new Promise(function (resolve) {
callback = resolve;
});
}
if (document.readyState === 'complete') {
callback();
} else {
(function () {
var completed = function completed() {
window.removeEventListener('load', completed, false);
callback();
};
window.addEventListener('load', completed, false);
})();
}
return promise;
}
function pointerCoord(ev) {
// get coordinates for either a mouse click
// or a touch depending on the given event
var c = { x: 0, y: 0 };
if (ev) {
var touches = ev.touches && ev.touches.length ? ev.touches : [ev];
var e = ev.changedTouches && ev.changedTouches[0] || touches[0];
if (e) {
c.x = e.clientX || e.pageX || 0;
c.y = e.clientY || e.pageY || 0;
}
}
return c;
}
function hasPointerMoved(threshold, startCoord, endCoord) {
return startCoord && endCoord && (Math.abs(startCoord.x - endCoord.x) > threshold || Math.abs(startCoord.y - endCoord.y) > threshold);
}
function isActive(ele) {
return !!(ele && document.activeElement === ele);
}
function hasFocus(ele) {
return isActive(ele) && ele.parentElement.querySelector(':focus') === ele;
}
function isTextInput(ele) {
return !!ele && (ele.tagName == 'TEXTAREA' || ele.contentEditable === 'true' || ele.tagName == 'INPUT' && !/^(radio|checkbox|range|file|submit|reset|color|image|button)$/i.test(ele.type));
}
function hasFocusedTextInput() {
var ele = document.activeElement;
if (isTextInput(ele)) {
return ele.parentElement.querySelector(':focus') === ele;
}
return false;
}
function copyInputAttributes(srcElement, destElement) {
// copy attributes from one element to another
// however, skip over a few of them as they're already
// handled in the angular world
var attrs = srcElement.attributes;
for (var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
if (!skipInputAttrsReg.test(attr.name)) {
destElement.setAttribute(attr.name, attr.value);
}
}
}
function closest(ele, selector, checkSelf) {
if (ele && matchesFn) {
// traverse parents
ele = checkSelf ? ele : ele.parentElement;
while (ele !== null) {
if (ele[matchesFn](selector)) {
return ele;
}
ele = ele.parentElement;
}
}
return null;
}
function getDimensions(ele, id) {
var dimensions = dimensionCache[id];
if (!dimensions) {
// make sure we got good values before caching
if (ele.offsetWidth && ele.offsetHeight) {
dimensions = dimensionCache[id] = {
width: ele.offsetWidth,
height: ele.offsetHeight,
left: ele.offsetLeft,
top: ele.offsetTop
};
} else {
// do not cache bad values
return { width: 0, height: 0, left: 0, top: 0 };
}
}
return dimensions;
}
function clearDimensions(id) {
delete dimensionCache[id];
}
function windowDimensions() {
if (!dimensionCache.win) {
// make sure we got good values before caching
if (window.innerWidth && window.innerHeight) {
dimensionCache.win = {
width: window.innerWidth,
height: window.innerHeight
};
} else {
// do not cache bad values
return { width: 0, height: 0 };
}
}
return dimensionCache.win;
}
function flushDimensionCache() {
dimensionCache = {};
}
return {
setters: [],
execute: function () {
(function () {
var rafLastTime = 0;
var win = window;
if (!win.requestAnimationFrame) {
win.requestAnimationFrame = function (callback, element) {
var currTime = Date.now();
var timeToCall = Math.max(0, 16 - (currTime - rafLastTime));
var id = window.setTimeout(function () {
callback(currTime + timeToCall);
}, timeToCall);
rafLastTime = currTime + timeToCall;
return id;
};
}
if (!win.cancelAnimationFrame) {
win.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
}
})();
raf = window.requestAnimationFrame.bind(window);
_export('raf', raf);
cancelRaf = window.cancelAnimationFrame.bind(window);
_export('cancelRaf', cancelRaf);
CSS = {};
_export('CSS', CSS);
(function () {
// transform
var i,
keys = ['webkitTransform', 'transform', '-webkit-transform', 'webkit-transform', '-moz-transform', 'moz-transform', 'MozTransform', 'mozTransform', 'msTransform'];
for (i = 0; i < keys.length; i++) {
if (document.documentElement.style[keys[i]] !== undefined) {
CSS.transform = keys[i];
break;
}
}
// transition
keys = ['webkitTransition', 'mozTransition', 'msTransition', 'transition'];
for (i = 0; i < keys.length; i++) {
if (document.documentElement.style[keys[i]] !== undefined) {
CSS.transition = keys[i];
break;
}
}
// The only prefix we care about is webkit for transitions.
var isWebkit = CSS.transition.indexOf('webkit') > -1;
// transition duration
CSS.transitionDuration = (isWebkit ? '-webkit-' : '') + 'transition-duration';
// transition timing function
CSS.transitionTimingFn = (isWebkit ? '-webkit-' : '') + 'transition-timing-function';
// transition delay
CSS.transitionDelay = (isWebkit ? '-webkit-' : '') + 'transition-delay';
// To be sure transitionend works everywhere, include *both* the webkit and non-webkit events
CSS.transitionEnd = (isWebkit ? 'webkitTransitionEnd ' : '') + 'transitionend';
})();
skipInputAttrsReg = /^(value|checked|disabled|type|class|style|id|autofocus|autocomplete|autocorrect)$/i;
matchesFn = undefined;
matchesMethods = ['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector'];
matchesMethods.some(function (fn) {
if (typeof document.documentElement[fn] === 'function') {
matchesFn = fn;
return true;
}
});
dimensionCache = {};
}
};
});
System.register("ionic-angular/util/events", [], function (_export) {
/**
* @name Events
* @description
* Events is a pub/sub style event system for sending and responding to application-level
* events across your app.
* @usage
* ```ts
* // first page (publish an event when a user is created)
* function createUser(user) {
* console.log('User created!')
* events.publish('user:created', user);
* }
*
* // second page (listen for the user created event)
* events.subscribe('user:created', (user) => {
* console.log('Welcome', user);
* });
*
* ```
* @demo /docs/v2/demos/events/
*/
"use strict";
var Events;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [],
execute: function () {
Events = (function () {
function Events() {
_classCallCheck(this, Events);
this._channels = [];
}
/**
* Subscribe to an event topic. Events that get posted to that topic will trigger the provided handler.
*
* @param {string} topic the topic to subscribe to
* @param {function} handler the event handler
*/
_createClass(Events, [{
key: "subscribe",
value: function subscribe(topic) {
var _this = this;
if (!this._channels[topic]) {
this._channels[topic] = [];
}
for (var _len = arguments.length, handlers = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
handlers[_key - 1] = arguments[_key];
}
handlers.forEach(function (handler) {
_this._channels[topic].push(handler);
});
}
/**
* Unsubscribe from the given topic. Your handler will no longer receive events published to this topic.
*
* @param {string} topic the topic to unsubscribe from
* @param {function} handler the event handler
*
* @return true if a handler was removed
*/
}, {
key: "unsubscribe",
value: function unsubscribe(topic, handler) {
var t = this._channels[topic];
if (!t) {
// Wasn't found, wasn't removed
return false;
}
if (!handler) {
// Remove all handlers for this topic
delete this._channels[topic];
return true;
}
// We need to find and remove a specific handler
var i = t.indexOf(handler);
if (i < 0) {
// Wasn't found, wasn't removed
return false;
}
t.splice(i, 1);
// If the channel is empty now, remove it from the channel map
if (!t.length) {
delete this._channels[topic];
}
return true;
}
/**
* Publish an event to the given topic.
*
* @param {string} topic the topic to publish to
* @param {any} eventData the data to send as the event
*/
}, {
key: "publish",
value: function publish(topic) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
var t = this._channels[topic];
if (!t) {
return null;
}
var responses = [];
t.forEach(function (handler) {
responses.push(handler(args));
});
return responses;
}
}]);
return Events;
})();
_export("Events", Events);
}
};
});
System.register('ionic-angular/util/feature-detect', [], function (_export) {
'use strict';
var FeatureDetect, featureDetects;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
return {
setters: [],
execute: function () {
FeatureDetect = (function () {
function FeatureDetect() {
_classCallCheck(this, FeatureDetect);
this._results = {};
}
_createClass(FeatureDetect, [{
key: 'run',
value: function run(window, document) {
for (var _name in featureDetects) {
this._results[_name] = featureDetects[_name](window, document, document.body);
}
}
}, {
key: 'has',
value: function has(featureName) {
return !!this._results[featureName];
}
}], [{
key: 'add',
value: function add(name, fn) {
featureDetects[name] = fn;
}
}]);
return FeatureDetect;
})();
_export('FeatureDetect', FeatureDetect);
featureDetects = {};
// FeatureDetect.add('sticky', function(window, document) {
// // css position sticky
// let ele = document.createElement('div');
// ele.style.cssText = 'position:-webkit-sticky;position:sticky';
// return ele.style.position.indexOf('sticky') > -1;
// });
FeatureDetect.add('hairlines', function (window, document, body) {
/**
* Hairline Shim
* Add the "hairline" CSS class name to the body tag
* if the browser supports subpixels.
*/
var canDo = false;
if (window.devicePixelRatio >= 2) {
var hairlineEle = document.createElement('div');
hairlineEle.style.border = '.5px solid transparent';
body.appendChild(hairlineEle);
if (hairlineEle.offsetHeight === 1) {
body.classList.add('hairlines');
canDo = true;
}
body.removeChild(hairlineEle);
}
return canDo;
});
}
};
});
System.register("ionic-angular/util/form", ["angular2/core"], function (_export) {
/**
* @private
*/
"use strict";
var Injectable, __decorate, __metadata, Form;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Injectable = _angular2Core.Injectable;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Form = (function () {
function Form() {
_classCallCheck(this, Form);
this._focused = null;
this._ids = -1;
this._inputs = [];
this.focusCtrl(document);
}
_createClass(Form, [{
key: "register",
value: function register(input) {
this._inputs.push(input);
}
}, {
key: "deregister",
value: function deregister(input) {
var index = this._inputs.indexOf(input);
if (index > -1) {
this._inputs.splice(index, 1);
}
if (input === this._focused) {
this._focused = null;
}
}
}, {
key: "focusCtrl",
value: function focusCtrl(document) {
// raw DOM fun
var focusCtrl = document.createElement('focus-ctrl');
focusCtrl.setAttribute('aria-hidden', true);
this._blur = document.createElement('button');
this._blur.tabIndex = -1;
focusCtrl.appendChild(this._blur);
document.body.appendChild(focusCtrl);
}
}, {
key: "focusOut",
value: function focusOut() {
void 0;
var activeElement = document.activeElement;
if (activeElement) {
activeElement.blur();
}
this._blur.focus();
}
}, {
key: "setAsFocused",
value: function setAsFocused(input) {
this._focused = input;
}
/**
* Focuses the next input element, if it exists.
*/
}, {
key: "tabFocus",
value: function tabFocus(currentInput) {
var index = this._inputs.indexOf(currentInput);
if (index > -1 && index + 1 < this._inputs.length) {
var nextInput = this._inputs[index + 1];
if (nextInput !== this._focused) {
void 0;
return nextInput.initFocus();
}
}
index = this._inputs.indexOf(this._focused);
if (index > 0) {
var previousInput = this._inputs[index - 1];
if (previousInput) {
void 0;
previousInput.initFocus();
}
}
}
}, {
key: "nextId",
value: function nextId() {
return ++this._ids;
}
}]);
return Form;
})();
_export("Form", Form);
_export("Form", Form = __decorate([Injectable(), __metadata('design:paramtypes', [])], Form));
}
};
});
System.register("ionic-angular/util/keyboard", ["angular2/core", "../config/config", "./form", "./dom"], function (_export) {
/**
* @name Keyboard
* @description
* The `Keyboard` class allows you to work with the keyboard events provide by the Ionic keyboard plugin.
*
* @usage
* ```ts
* export class MyClass{
* constructor(keyboard: Keyboard){
* this.keyboard = keyboard;
* }
* }
*
* ```
*/
"use strict";
var Injectable, NgZone, Config, Form, hasFocusedTextInput, raf, rafFrames, __decorate, __metadata, Keyboard, KEYBOARD_CLOSE_POLLING, _a, _b, _c;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Injectable = _angular2Core.Injectable;
NgZone = _angular2Core.NgZone;
}, function (_configConfig) {
Config = _configConfig.Config;
}, function (_form2) {
Form = _form2.Form;
}, function (_dom) {
hasFocusedTextInput = _dom.hasFocusedTextInput;
raf = _dom.raf;
rafFrames = _dom.rafFrames;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Keyboard = (function () {
function Keyboard(config, _form, _zone) {
var _this = this;
_classCallCheck(this, Keyboard);
this._form = _form;
this._zone = _zone;
_zone.runOutsideAngular(function () {
_this.focusOutline(config.get('focusOutline'), document);
});
}
/**
* Chech to see if the keyboard is open or not.
*
* ```ts
* export class MyClass{
* constructor(keyboard: Keyboard){
* this.keyboard = keyboard;
* }
* keyboardCheck(){
* setTimeout(() => console.log('is the keyboard open ', this.keyboard.isOpen()));
* }
* }
*
* ```
*
* @return {boolean} returns a true or flase value if the keyboard is open or not
*/
_createClass(Keyboard, [{
key: "isOpen",
value: function isOpen() {
return hasFocusedTextInput();
}
/**
* When the keyboard is closed, call any methods you want
*
* ```ts
* export class MyClass{
* constructor(keyboard: Keyboard){
* this.keyboard = keyboard;
* this.keyboard.onClose(this.closeCallback);
* }
* closeCallback(){
* // call what ever functionality you want on keyboard close
* console.log('Closing time");
* }
* }
*
* ```
* @param {function} callback method you want to call when the keyboard has been closed
* @return {function} returns a callback that gets fired when the keyboard is closed
*/
}, {
key: "onClose",
value: function onClose(callback) {
var pollingInternval = arguments.length <= 1 || arguments[1] === undefined ? KEYBOARD_CLOSE_POLLING : arguments[1];
void 0;
var self = this;
var checks = 0;
var promise = null;
if (!callback) {
// a callback wasn't provided, so let's return a promise instead
promise = new Promise(function (resolve) {
callback = resolve;
});
}
self._zone.runOutsideAngular(function () {
function checkKeyboard() {
void 0;
if (!self.isOpen() || checks > 100) {
rafFrames(30, function () {
self._zone.run(function () {
void 0;
callback();
});
});
} else {
setTimeout(checkKeyboard, pollingInternval);
}
checks++;
}
setTimeout(checkKeyboard, pollingInternval);
});
return promise;
}
/**
* Progamatically close they keyboard
*
*/
}, {
key: "close",
value: function close() {
var _this2 = this;
void 0;
raf(function () {
if (hasFocusedTextInput()) {
// only focus out when a text input has focus
_this2._form.focusOut();
}
});
}
/**
* @private
*/
}, {
key: "focusOutline",
value: function focusOutline(setting, document) {
/* Focus Outline
* --------------------------------------------------
* By default, when a keydown event happens from a tab key, then
* the 'focus-outline' css class is added to the body element
* so focusable elements have an outline. On a mousedown or
* touchstart event, then the 'focus-outline' css class is removed.
*
* Config default overrides:
* focusOutline: true - Always add the focus-outline
* focusOutline: false - Do not add the focus-outline
*/
var self = this;
var isKeyInputEnabled = false;
function cssClass() {
raf(function () {
document.body.classList[isKeyInputEnabled ? 'add' : 'remove']('focus-outline');
});
}
if (setting === true) {
isKeyInputEnabled = true;
return cssClass();
} else if (setting === false) {
return;
}
// default is to add the focus-outline when the tab key is used
function keyDown(ev) {
if (!isKeyInputEnabled && ev.keyCode == 9) {
isKeyInputEnabled = true;
enableKeyInput();
}
}
function pointerDown() {
isKeyInputEnabled = false;
enableKeyInput();
}
function enableKeyInput() {
cssClass();
self._zone.runOutsideAngular(function () {
document.removeEventListener('mousedown', pointerDown);
document.removeEventListener('touchstart', pointerDown);
if (isKeyInputEnabled) {
document.addEventListener('mousedown', pointerDown);
document.addEventListener('touchstart', pointerDown);
}
});
}
document.addEventListener('keydown', keyDown);
}
}]);
return Keyboard;
})();
_export("Keyboard", Keyboard);
_export("Keyboard", Keyboard = __decorate([Injectable(), __metadata('design:paramtypes', [typeof (_a = typeof Config !== 'undefined' && Config) === 'function' && _a || Object, typeof (_b = typeof Form !== 'undefined' && Form) === 'function' && _b || Object, typeof (_c = typeof NgZone !== 'undefined' && NgZone) === 'function' && _c || Object])], Keyboard));
KEYBOARD_CLOSE_POLLING = 150;
}
};
});
System.register('ionic-angular/util/util', [], function (_export) {
/**
* Given a min and max, restrict the given number
* to the range.
* @param min the minimum
* @param n the value
* @param max the maximum
*/
'use strict';
var isBoolean, isString, isNumber, isFunction, isDefined, isUndefined, isBlank, isObject, isArray, isTrueProperty, uid, array;
/**
* The assign() method is used to copy the values of all enumerable own
* properties from one or more source objects to a target object. It will
* return the target object. When available, this method will use
* `Object.assign()` under-the-hood.
* @param target The target object
* @param source(s) The source object
*/
_export('clamp', clamp);
/**
* Do a deep extend (merge).
* @param dst the destination
* @param ... the param objects
*/
_export('assign', assign);
_export('merge', merge);
/**
* Apply default arguments if they don't exist in
* the first object.
* @param the destination to apply defaults to.
*/
_export('debounce', debounce);
_export('defaults', defaults);
_export('pascalCaseToDashCase', pascalCaseToDashCase);
_export('nextUid', nextUid);
/**
* Throttle the given fun, only allowing it to be
* called at most every `wait` ms.
*/
_export('getQuerystring', getQuerystring);
_export('throttle', throttle);
function clamp(min, n, max) {
return Math.max(min, Math.min(n, max));
}
function assign() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (typeof Object.assign !== 'function') {
// use the old-school shallow extend method
return _baseExtend(args[0], [].slice.call(args, 1), false);
}
// use the built in ES6 Object.assign method
return Object.assign.apply(null, args);
}
function merge(dst) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
return _baseExtend(dst, [].slice.call(arguments, 1), true);
}
function _baseExtend(dst, objs, deep) {
for (var i = 0, ii = objs.length; i < ii; ++i) {
var obj = objs[i];
if (!obj || !isObject(obj) && !isFunction(obj)) continue;
var keys = Object.keys(obj);
for (var j = 0, jj = keys.length; j < jj; j++) {
var key = keys[j];
var src = obj[key];
if (deep && isObject(src)) {
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
_baseExtend(dst[key], [src], true);
} else {
dst[key] = src;
}
}
}
return dst;
}
function debounce(fn, wait) {
var immediate = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];
var timeout, args, context, timestamp, result;
return function () {
context = this;
args = arguments;
timestamp = Date.now();
var later = function later() {
var last = Date.now() - timestamp;
if (last < wait) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) result = fn.apply(context, args);
}
};
var callNow = immediate && !timeout;
if (!timeout) {
timeout = setTimeout(later, wait);
}
if (callNow) result = fn.apply(context, args);
return result;
};
}
function defaults(dest) {
for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
args[_key3 - 1] = arguments[_key3];
}
for (var i = arguments.length - 1; i >= 1; i--) {
var source = arguments[i] || {};
for (var key in source) {
if (source.hasOwnProperty(key) && !dest.hasOwnProperty(key)) {
dest[key] = source[key];
}
}
}
return dest;
}
/**
* Convert a string in the format thisIsAString to a slug format this-is-a-string
*/
function pascalCaseToDashCase() {
var val = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
return val.charAt(0).toLowerCase() + val.substring(1).replace(/[A-Z]/g, function (match) {
return '-' + match.toLowerCase();
});
}
function nextUid() {
return ++uid;
}
/**
* Grab all query strings keys and values.
* @param url
*/
function getQuerystring(url) {
var queryParams = {};
if (url) {
var startIndex = url.indexOf('?');
if (startIndex !== -1) {
var queries = url.slice(startIndex + 1).split('&');
queries.forEach(function (param) {
var split = param.split('=');
queryParams[split[0].toLowerCase()] = split[1].split('#')[0];
});
}
}
return queryParams;
}
function throttle(fn, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
options || (options = {});
var later = function later() {
previous = options.leading === false ? 0 : Date.now();
timeout = null;
result = fn.apply(context, args);
};
return function () {
var now = Date.now();
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0) {
clearTimeout(timeout);
timeout = null;
previous = now;
result = fn.apply(context, args);
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
}
return {
setters: [],
execute: function () {
isBoolean = function isBoolean(val) {
return typeof val === 'boolean';
};
_export('isBoolean', isBoolean);
isString = function isString(val) {
return typeof val === 'string';
};
_export('isString', isString);
isNumber = function isNumber(val) {
return typeof val === 'number';
};
_export('isNumber', isNumber);
isFunction = function isFunction(val) {
return typeof val === 'function';
};
_export('isFunction', isFunction);
isDefined = function isDefined(val) {
return typeof val !== 'undefined';
};
_export('isDefined', isDefined);
isUndefined = function isUndefined(val) {
return typeof val === 'undefined';
};
_export('isUndefined', isUndefined);
isBlank = function isBlank(val) {
return val === undefined || val === null;
};
_export('isBlank', isBlank);
isObject = function isObject(val) {
return typeof val === 'object';
};
_export('isObject', isObject);
isArray = Array.isArray;
_export('isArray', isArray);
isTrueProperty = function isTrueProperty(val) {
if (typeof val === 'string') {
val = val.toLowerCase().trim();
return val === 'true' || val === 'on' || val === '';
}
return !!val;
};
_export('isTrueProperty', isTrueProperty);
uid = 0;
array = {
find: function find(arr, cb) {
for (var i = 0, ii = arr.length; i < ii; i++) {
if (cb(arr[i], i)) return arr[i];
}
},
remove: function remove(arr, itemOrIndex) {
var index = -1;
if (isNumber(itemOrIndex)) {
index = itemOrIndex;
} else {
index = arr.indexOf(itemOrIndex);
}
if (index < 0) {
return false;
}
arr.splice(index, 1);
return true;
}
};
_export('array', array);
}
};
});
System.register("ionic-angular/components/action-sheet/action-sheet", ["angular2/core", "angular2/common", "../../animations/animation", "../../transitions/transition", "../../config/config", "../icon/icon", "../../util/util", "../nav/nav-params", "../nav/view-controller"], function (_export) {
/**
* @name ActionSheet
* @description
* An Action Sheet is a dialog that lets the user choose from a set of
* options. It appears on top of the app's content, and must be manually
* dismissed by the user before they can resume interaction with the app.
* Dangerous (destructive) options are made obvious. There are easy
* ways to cancel out of the action sheet, such as tapping the backdrop or
* hitting the escape key on desktop.
*
* An action sheet is created from an array of `buttons`, with each button
* including properties for its `text`, and optionally a `handler` and `role`.
* If a handler returns `false` then the action sheet will not be dismissed. An
* action sheet can also optionally have a `title` and a `subTitle`.
*
* A button's `role` property can either be `destructive` or `cancel`. Buttons
* without a role property will have a default look for its platform. Buttons
* with the `cancel` role will always load as the bottom button, no matter where
* it shows up in the array. All other buttons will show up in the order they
* have been added to the `buttons` array. Note: We recommend that `destructive`
* buttons show be the first button in the array, making it the button on top.
* Additionally, if the action sheet is dismissed by tapping the backdrop, then
* it will fire the handler from the button with the cancel role.
*
* Its shorthand is to add all the action sheet's options from within the
* `ActionSheet.create(opts)` first argument. Otherwise the action sheet's
* instance has methods to add options, like `setTitle()` or `addButton()`.
*
* @usage
* ```ts
* constructor(nav: NavController) {
* this.nav = nav;
* }
*
* presentActionSheet() {
* let actionSheet = ActionSheet.create({
* title: 'Modify your album',
* buttons: [
* {
* text: 'Destructive',
* role: 'destructive',
* handler: () => {
* console.log('Destructive clicked');
* }
* },
* {
* text: 'Archive',
* handler: () => {
* console.log('Archive clicked');
* }
* },
* {
* text: 'Cancel',
* role: 'cancel',
* handler: () => {
* console.log('Cancel clicked');
* }
* }
* ]
* });
*
* this.nav.present(actionSheet);
* }
* ```
*
* @demo /docs/v2/demos/action-sheet/
* @see {@link /docs/v2/components#action-sheets ActionSheet Component Docs}
*/
"use strict";
var Component, Renderer, ElementRef, NgFor, NgIf, Animation, Transition, Config, Icon, isDefined, NavParams, ViewController, __decorate, __metadata, ActionSheet, ActionSheetCmp, ActionSheetSlideIn, ActionSheetSlideOut, ActionSheetMdSlideIn, ActionSheetMdSlideOut, _a, _b, _c, _d, _e;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
Renderer = _angular2Core.Renderer;
ElementRef = _angular2Core.ElementRef;
}, function (_angular2Common) {
NgFor = _angular2Common.NgFor;
NgIf = _angular2Common.NgIf;
}, function (_animationsAnimation) {
Animation = _animationsAnimation.Animation;
}, function (_transitionsTransition) {
Transition = _transitionsTransition.Transition;
}, function (_configConfig) {
Config = _configConfig.Config;
}, function (_iconIcon) {
Icon = _iconIcon.Icon;
}, function (_utilUtil) {
isDefined = _utilUtil.isDefined;
}, function (_navNavParams) {
NavParams = _navNavParams.NavParams;
}, function (_navViewController) {
ViewController = _navViewController.ViewController;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
ActionSheet = (function (_ViewController) {
_inherits(ActionSheet, _ViewController);
function ActionSheet() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, ActionSheet);
opts.buttons = opts.buttons || [];
opts.enableBackdropDismiss = isDefined(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
_get(Object.getPrototypeOf(ActionSheet.prototype), "constructor", this).call(this, ActionSheetCmp, opts);
this.viewType = 'action-sheet';
this.isOverlay = true;
// by default, actionsheets should not fire lifecycle events of other views
// for example, when an actionsheets enters, the current active view should
// not fire its lifecycle events because it's not conceptually leaving
this.fireOtherLifecycles = false;
}
/**
* @private
*/
/**
* @private
*/
_createClass(ActionSheet, [{
key: "getTransitionName",
value: function getTransitionName(direction) {
var key = 'actionSheet' + (direction === 'back' ? 'Leave' : 'Enter');
return this._nav && this._nav.config.get(key);
}
/**
* @param {string} title Action sheet title
*/
}, {
key: "setTitle",
value: function setTitle(title) {
this.data.title = title;
}
/**
* @param {string} subTitle Action sheet subtitle
*/
}, {
key: "setSubTitle",
value: function setSubTitle(subTitle) {
this.data.subTitle = subTitle;
}
/**
* @param {object} button Action sheet button
*/
}, {
key: "addButton",
value: function addButton(button) {
this.data.buttons.push(button);
}
/**
* Open an action sheet with the following options
*
* | Option | Type | Description |
* |-----------------------|------------|-----------------------------------------------------------------|
* | title |`string` | The title for the actionsheet |
* | subTitle |`string` | The sub-title for the actionsheet |
* | cssClass |`string` | An additional class for custom styles |
* | enableBackdropDismiss |`boolean` | If the actionsheet should close when the user taps the backdrop |
* | buttons |`array`| An array of buttons to display |
*
* For the buttons:
*
* | Option | Type | Description |
* |----------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------|
* | text | `string` | The buttons text |
* | icon | `icon` | The buttons icons |
* | handler | `any` | An express the button shoule evaluate |
* | cssClass | `string` | An additional class for custom styles |
* | role | `string` | How the button should be displayed, `destructive` or `cancel`. If not role is provided, it will display the button without any additional styles |
*
*
*
* @param {object} opts Action sheet options
*/
}], [{
key: "create",
value: function create() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
return new ActionSheet(opts);
}
}]);
return ActionSheet;
})(ViewController);
_export("ActionSheet", ActionSheet);
ActionSheetCmp = (function () {
function ActionSheetCmp(_viewCtrl, _config, elementRef, params, renderer) {
_classCallCheck(this, ActionSheetCmp);
this._viewCtrl = _viewCtrl;
this._config = _config;
this.d = params.data;
if (this.d.cssClass) {
renderer.setElementClass(elementRef.nativeElement, this.d.cssClass, true);
}
}
_createClass(ActionSheetCmp, [{
key: "onPageLoaded",
value: function onPageLoaded() {
var _this = this;
// normalize the data
var buttons = [];
this.d.buttons.forEach(function (button) {
if (typeof button === 'string') {
button = { text: button };
}
if (!button.cssClass) {
button.cssClass = '';
}
// deprecated warning
if (button.style) {
void 0;
button.role = button.style;
}
if (button.role === 'cancel') {
_this.d.cancelButton = button;
} else {
if (button.role === 'destructive') {
button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-destructive';
}
buttons.push(button);
}
});
this.d.buttons = buttons;
var self = this;
self.keyUp = function (ev) {
if (ev.keyCode === 27) {
void 0;
self.bdClick();
}
};
document.addEventListener('keyup', this.keyUp);
}
}, {
key: "click",
value: function click(button, dismissDelay) {
var _this2 = this;
var shouldDismiss = true;
if (button.handler) {
// a handler has been provided, execute it
if (button.handler() === false) {
// if the return value of the handler is false then do not dismiss
shouldDismiss = false;
}
}
if (shouldDismiss) {
setTimeout(function () {
_this2.dismiss(button.role);
}, dismissDelay || this._config.get('pageTransitionDelay'));
}
}
}, {
key: "bdClick",
value: function bdClick() {
if (this.d.enableBackdropDismiss) {
if (this.d.cancelButton) {
this.click(this.d.cancelButton, 1);
} else {
this.dismiss('backdrop');
}
}
}
}, {
key: "dismiss",
value: function dismiss(role) {
return this._viewCtrl.dismiss(null, role);
}
}, {
key: "onPageWillLeave",
value: function onPageWillLeave() {
document.removeEventListener('keyup', this.keyUp);
}
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
document.removeEventListener('keyup', this.keyUp);
}
}]);
return ActionSheetCmp;
})();
ActionSheetCmp = __decorate([Component({
selector: 'ion-action-sheet',
template: '' + '
' + '
' + '
' + '
{{d.title}}
' + '
{{d.subTitle}}
' + '' + '
' + '
' + '' + '
' + '
' + '
',
host: {
'role': 'dialog'
},
directives: [NgFor, NgIf, Icon]
}), __metadata('design:paramtypes', [typeof (_a = typeof ViewController !== 'undefined' && ViewController) === 'function' && _a || Object, typeof (_b = typeof Config !== 'undefined' && Config) === 'function' && _b || Object, typeof (_c = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _c || Object, typeof (_d = typeof NavParams !== 'undefined' && NavParams) === 'function' && _d || Object, typeof (_e = typeof Renderer !== 'undefined' && Renderer) === 'function' && _e || Object])], ActionSheetCmp);
ActionSheetSlideIn = (function (_Transition) {
_inherits(ActionSheetSlideIn, _Transition);
function ActionSheetSlideIn(enteringView, leavingView, opts) {
_classCallCheck(this, ActionSheetSlideIn);
_get(Object.getPrototypeOf(ActionSheetSlideIn.prototype), "constructor", this).call(this, opts);
var ele = enteringView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.01, 0.4);
wrapper.fromTo('translateY', '100%', '0%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(400).add(backdrop).add(wrapper);
}
return ActionSheetSlideIn;
})(Transition);
Transition.register('action-sheet-slide-in', ActionSheetSlideIn);
ActionSheetSlideOut = (function (_Transition2) {
_inherits(ActionSheetSlideOut, _Transition2);
function ActionSheetSlideOut(enteringView, leavingView, opts) {
_classCallCheck(this, ActionSheetSlideOut);
_get(Object.getPrototypeOf(ActionSheetSlideOut.prototype), "constructor", this).call(this, opts);
var ele = leavingView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.4, 0);
wrapper.fromTo('translateY', '0%', '100%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(300).add(backdrop).add(wrapper);
}
return ActionSheetSlideOut;
})(Transition);
Transition.register('action-sheet-slide-out', ActionSheetSlideOut);
ActionSheetMdSlideIn = (function (_Transition3) {
_inherits(ActionSheetMdSlideIn, _Transition3);
function ActionSheetMdSlideIn(enteringView, leavingView, opts) {
_classCallCheck(this, ActionSheetMdSlideIn);
_get(Object.getPrototypeOf(ActionSheetMdSlideIn.prototype), "constructor", this).call(this, opts);
var ele = enteringView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.01, 0.26);
wrapper.fromTo('translateY', '100%', '0%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(450).add(backdrop).add(wrapper);
}
return ActionSheetMdSlideIn;
})(Transition);
Transition.register('action-sheet-md-slide-in', ActionSheetMdSlideIn);
ActionSheetMdSlideOut = (function (_Transition4) {
_inherits(ActionSheetMdSlideOut, _Transition4);
function ActionSheetMdSlideOut(enteringView, leavingView, opts) {
_classCallCheck(this, ActionSheetMdSlideOut);
_get(Object.getPrototypeOf(ActionSheetMdSlideOut.prototype), "constructor", this).call(this, opts);
var ele = leavingView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.26, 0);
wrapper.fromTo('translateY', '0%', '100%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(450).add(backdrop).add(wrapper);
}
return ActionSheetMdSlideOut;
})(Transition);
Transition.register('action-sheet-md-slide-out', ActionSheetMdSlideOut);
}
};
});
System.register("ionic-angular/components/alert/alert", ["angular2/core", "angular2/common", "../../animations/animation", "../../transitions/transition", "../../config/config", "../../util/util", "../nav/nav-params", "../nav/view-controller"], function (_export) {
/**
* @name Alert
* @description
* An Alert is a dialog that presents users with either information, or used
* to receive information from the user using inputs. An alert appears on top
* of the app's content, and must be manually dismissed by the user before
* they can resume interaction with the app.
*
* An alert is created from an array of `buttons` and optionally an array of
* `inputs`. Each button includes properties for its `text`, and optionally a
* `handler`. If a handler returns `false` then the alert will not be dismissed.
* An alert can also optionally have a `title`, `subTitle` and `message`.
*
* All buttons will show up in the order they have been added to the `buttons`
* array, from left to right. Note: The right most button (the last one in the
* array) is the main button.
*
* Optionally, a `role` property can be added to a button, such as `cancel`.
* If a `cancel` role is on one of the buttons, then if the alert is dismissed
* by tapping the backdrop, then it will fire the handler from the button
* with a cancel role.
*
* Alerts can also include inputs whos data can be passed back to the app.
* Inputs can be used to prompt users for information.
*
* Its shorthand is to add all the alert's options from within the
* `Alert.create(opts)` first argument. Otherwise the alert's instance
* has methods to add options, such as `setTitle()` or `addButton()`.
*
* @usage
* ```ts
* constructor(nav: NavController) {
* this.nav = nav;
* }
*
* presentAlert() {
* let alert = Alert.create({
* title: 'Low battery',
* subTitle: '10% of battery remaining',
* buttons: ['Dismiss']
* });
* this.nav.present(alert);
* }
*
* presentConfirm() {
* let alert = Alert.create({
* title: 'Confirm purchase',
* message: 'Do you want to buy this book?',
* buttons: [
* {
* text: 'Cancel',
* role: 'cancel',
* handler: () => {
* console.log('Cancel clicked');
* }
* },
* {
* text: 'Buy',
* handler: () => {
* console.log('Buy clicked');
* }
* }
* ]
* });
* this.nav.present(alert);
* }
*
* presentPrompt() {
* let alert = Alert.create({
* title: 'Login',
* inputs: [
* {
* name: 'username',
* placeholder: 'Username'
* },
* {
* name: 'password',
* placeholder: 'Password',
* type: 'password'
* }
* ],
* buttons: [
* {
* text: 'Cancel',
* role: 'cancel',
* handler: data => {
* console.log('Cancel clicked');
* }
* },
* {
* text: 'Login',
* handler: data => {
* if (User.isValid(data.username, data.password)) {
* // logged in!
* } else {
* // invalid login
* return false;
* }
* }
* }
* ]
* });
* this.nav.present(alert);
* }
* ```
*
* @demo /docs/v2/demos/alert/
*/
"use strict";
var Component, ElementRef, Renderer, NgClass, NgSwitch, NgIf, NgFor, Animation, Transition, Config, isDefined, NavParams, ViewController, __decorate, __metadata, Alert, AlertCmp, AlertPopIn, AlertPopOut, AlertMdPopIn, AlertMdPopOut, alertIds, _a, _b, _c, _d, _e;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
ElementRef = _angular2Core.ElementRef;
Renderer = _angular2Core.Renderer;
}, function (_angular2Common) {
NgClass = _angular2Common.NgClass;
NgSwitch = _angular2Common.NgSwitch;
NgIf = _angular2Common.NgIf;
NgFor = _angular2Common.NgFor;
}, function (_animationsAnimation) {
Animation = _animationsAnimation.Animation;
}, function (_transitionsTransition) {
Transition = _transitionsTransition.Transition;
}, function (_configConfig) {
Config = _configConfig.Config;
}, function (_utilUtil) {
isDefined = _utilUtil.isDefined;
}, function (_navNavParams) {
NavParams = _navNavParams.NavParams;
}, function (_navViewController) {
ViewController = _navViewController.ViewController;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Alert = (function (_ViewController) {
_inherits(Alert, _ViewController);
function Alert() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, Alert);
opts.inputs = opts.inputs || [];
opts.buttons = opts.buttons || [];
opts.enableBackdropDismiss = isDefined(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
_get(Object.getPrototypeOf(Alert.prototype), "constructor", this).call(this, AlertCmp, opts);
this.viewType = 'alert';
this.isOverlay = true;
// by default, alerts should not fire lifecycle events of other views
// for example, when an alert enters, the current active view should
// not fire its lifecycle events because it's not conceptually leaving
this.fireOtherLifecycles = false;
}
/**
* @private
*/
/**
* @private
*/
_createClass(Alert, [{
key: "getTransitionName",
value: function getTransitionName(direction) {
var key = direction === 'back' ? 'alertLeave' : 'alertEnter';
return this._nav && this._nav.config.get(key);
}
/**
* @param {string} title Alert title
*/
}, {
key: "setTitle",
value: function setTitle(title) {
this.data.title = title;
}
/**
* @param {string} subTitle Alert subtitle
*/
}, {
key: "setSubTitle",
value: function setSubTitle(subTitle) {
this.data.subTitle = subTitle;
}
/**
* @private
*/
}, {
key: "setBody",
value: function setBody(message) {
// deprecated warning
void 0;
this.setMessage(message);
}
/**
* @param {string} message Alert message content
*/
}, {
key: "setMessage",
value: function setMessage(message) {
this.data.message = message;
}
/**
* @param {object} input Alert input
*/
}, {
key: "addInput",
value: function addInput(input) {
this.data.inputs.push(input);
}
/**
* @param {any} button Alert button
*/
}, {
key: "addButton",
value: function addButton(button) {
this.data.buttons.push(button);
}
/**
* @param {string} cssClass CSS class name to add to the alert's outer wrapper
*/
}, {
key: "setCssClass",
value: function setCssClass(cssClass) {
this.data.cssClass = cssClass;
}
/**
* @param {object} opts Alert options
*/
}], [{
key: "create",
value: function create() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
return new Alert(opts);
}
}]);
return Alert;
})(ViewController);
_export("Alert", Alert);
AlertCmp = (function () {
function AlertCmp(_viewCtrl, _elementRef, _config, params, renderer) {
_classCallCheck(this, AlertCmp);
this._viewCtrl = _viewCtrl;
this._elementRef = _elementRef;
this._config = _config;
this.d = params.data;
if (this.d.cssClass) {
this.d.cssClass.split(' ').forEach(function (cssClass) {
renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
this.id = ++alertIds;
this.descId = '';
this.hdrId = 'alert-hdr-' + this.id;
this.subHdrId = 'alert-subhdr-' + this.id;
this.msgId = 'alert-msg-' + this.id;
this.activeId = '';
if (this.d.message) {
this.descId = this.msgId;
} else if (this.d.subTitle) {
this.descId = this.subHdrId;
}
if (!this.d.message) {
this.d.message = '';
}
}
_createClass(AlertCmp, [{
key: "onPageLoaded",
value: function onPageLoaded() {
var _this = this;
// normalize the data
var data = this.d;
if (data.body) {
// deprecated warning
void 0;
data.message = data.body;
}
data.buttons = data.buttons.map(function (button) {
if (typeof button === 'string') {
return { text: button };
}
return button;
});
data.inputs = data.inputs.map(function (input, index) {
return {
type: input.type || 'text',
name: isDefined(input.name) ? input.name : index,
placeholder: isDefined(input.placeholder) ? input.placeholder : '',
value: isDefined(input.value) ? input.value : '',
label: input.label,
checked: !!input.checked,
id: 'alert-input-' + _this.id + '-' + index
};
});
this.inputType = data.inputs.length ? data.inputs[0].type : null;
var checkedInput = this.d.inputs.find(function (input) {
return input.checked;
});
if (checkedInput) {
this.activeId = checkedInput.id;
}
var self = this;
self.keyUp = function (ev) {
if (ev.keyCode === 13) {
void 0;
var button = self.d.buttons[self.d.buttons.length - 1];
self.btnClick(button);
} else if (ev.keyCode === 27) {
void 0;
self.bdClick();
}
};
document.addEventListener('keyup', this.keyUp);
}
}, {
key: "onPageDidEnter",
value: function onPageDidEnter() {
var activeElement = document.activeElement;
if (activeElement) {
activeElement.blur();
}
if (this.d.inputs.length) {
var firstInput = this._elementRef.nativeElement.querySelector('input');
if (firstInput) {
firstInput.focus();
}
}
}
}, {
key: "btnClick",
value: function btnClick(button, dismissDelay) {
var _this2 = this;
var shouldDismiss = true;
if (button.handler) {
// a handler has been provided, execute it
// pass the handler the values from the inputs
if (button.handler(this.getValues()) === false) {
// if the return value of the handler is false then do not dismiss
shouldDismiss = false;
}
}
if (shouldDismiss) {
setTimeout(function () {
_this2.dismiss(button.role);
}, dismissDelay || this._config.get('pageTransitionDelay'));
}
}
}, {
key: "rbClick",
value: function rbClick(checkedInput) {
this.d.inputs.forEach(function (input) {
input.checked = checkedInput === input;
});
this.activeId = checkedInput.id;
}
}, {
key: "cbClick",
value: function cbClick(checkedInput) {
checkedInput.checked = !checkedInput.checked;
}
}, {
key: "bdClick",
value: function bdClick() {
if (this.d.enableBackdropDismiss) {
var cancelBtn = this.d.buttons.find(function (b) {
return b.role === 'cancel';
});
if (cancelBtn) {
this.btnClick(cancelBtn, 1);
} else {
this.dismiss('backdrop');
}
}
}
}, {
key: "dismiss",
value: function dismiss(role) {
return this._viewCtrl.dismiss(this.getValues(), role);
}
}, {
key: "getValues",
value: function getValues() {
if (this.inputType === 'radio') {
// this is an alert with radio buttons (single value select)
// return the one value which is checked, otherwise undefined
var checkedInput = this.d.inputs.find(function (i) {
return i.checked;
});
return checkedInput ? checkedInput.value : undefined;
}
if (this.inputType === 'checkbox') {
// this is an alert with checkboxes (multiple value select)
// return an array of all the checked values
return this.d.inputs.filter(function (i) {
return i.checked;
}).map(function (i) {
return i.value;
});
}
// this is an alert with text inputs
// return an object of all the values with the input name as the key
var values = {};
this.d.inputs.forEach(function (i) {
values[i.name] = i.value;
});
return values;
}
}, {
key: "onPageWillLeave",
value: function onPageWillLeave() {
document.removeEventListener('keyup', this.keyUp);
}
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
document.removeEventListener('keyup', this.keyUp);
}
}]);
return AlertCmp;
})();
AlertCmp = __decorate([Component({
selector: 'ion-alert',
template: '' + '
' + '
' + '' + '' + '
' + '' + '
' + '' + '
' + '
' + '' + '
' + '{{i.label}}' + '
' + '
' + '
' + '' + '' + '
' + '
' + '
' + '
' + '{{i.label}}' + '
' + '
' + '
' + '' + '' + '
' + '
' + '' + '
' + '
' + '' + '
' + '
2}">' + '' + '
' + '
',
host: {
'role': 'dialog',
'[attr.aria-labelledby]': 'hdrId',
'[attr.aria-describedby]': 'descId'
},
directives: [NgClass, NgSwitch, NgIf, NgFor]
}), __metadata('design:paramtypes', [typeof (_a = typeof ViewController !== 'undefined' && ViewController) === 'function' && _a || Object, typeof (_b = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _b || Object, typeof (_c = typeof Config !== 'undefined' && Config) === 'function' && _c || Object, typeof (_d = typeof NavParams !== 'undefined' && NavParams) === 'function' && _d || Object, typeof (_e = typeof Renderer !== 'undefined' && Renderer) === 'function' && _e || Object])], AlertCmp);
/**
* Animations for alerts
*/
AlertPopIn = (function (_Transition) {
_inherits(AlertPopIn, _Transition);
function AlertPopIn(enteringView, leavingView, opts) {
_classCallCheck(this, AlertPopIn);
_get(Object.getPrototypeOf(AlertPopIn.prototype), "constructor", this).call(this, opts);
var ele = enteringView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', '0.01', '1').fromTo('scale', '1.1', '1');
backdrop.fromTo('opacity', '0.01', '0.3');
this.easing('ease-in-out').duration(200).add(backdrop).add(wrapper);
}
return AlertPopIn;
})(Transition);
Transition.register('alert-pop-in', AlertPopIn);
AlertPopOut = (function (_Transition2) {
_inherits(AlertPopOut, _Transition2);
function AlertPopOut(enteringView, leavingView, opts) {
_classCallCheck(this, AlertPopOut);
_get(Object.getPrototypeOf(AlertPopOut.prototype), "constructor", this).call(this, opts);
var ele = leavingView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', '1', '0').fromTo('scale', '1', '0.9');
backdrop.fromTo('opacity', '0.3', '0');
this.easing('ease-in-out').duration(200).add(backdrop).add(wrapper);
}
return AlertPopOut;
})(Transition);
Transition.register('alert-pop-out', AlertPopOut);
AlertMdPopIn = (function (_Transition3) {
_inherits(AlertMdPopIn, _Transition3);
function AlertMdPopIn(enteringView, leavingView, opts) {
_classCallCheck(this, AlertMdPopIn);
_get(Object.getPrototypeOf(AlertMdPopIn.prototype), "constructor", this).call(this, opts);
var ele = enteringView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', '0.01', '1').fromTo('scale', '1.1', '1');
backdrop.fromTo('opacity', '0.01', '0.5');
this.easing('ease-in-out').duration(200).add(backdrop).add(wrapper);
}
return AlertMdPopIn;
})(Transition);
Transition.register('alert-md-pop-in', AlertMdPopIn);
AlertMdPopOut = (function (_Transition4) {
_inherits(AlertMdPopOut, _Transition4);
function AlertMdPopOut(enteringView, leavingView, opts) {
_classCallCheck(this, AlertMdPopOut);
_get(Object.getPrototypeOf(AlertMdPopOut.prototype), "constructor", this).call(this, opts);
var ele = leavingView.pageRef().nativeElement;
var backdrop = new Animation(ele.querySelector('.backdrop'));
var wrapper = new Animation(ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', '1', '0').fromTo('scale', '1', '0.9');
backdrop.fromTo('opacity', '0.5', '0');
this.easing('ease-in-out').duration(200).add(backdrop).add(wrapper);
}
return AlertMdPopOut;
})(Transition);
Transition.register('alert-md-pop-out', AlertMdPopOut);
alertIds = -1;
}
};
});
System.register("ionic-angular/components/app/app", ["angular2/core", "angular2/platform/browser", "../../config/config", "../../util/click-block"], function (_export) {
/**
* @private
* Component registry service. For more information on registering
* components see the [IdRef API reference](../id/IdRef/).
*/
"use strict";
var Injectable, NgZone, Title, Config, ClickBlock, __decorate, __metadata, IonicApp, _a, _b, _c;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Injectable = _angular2Core.Injectable;
NgZone = _angular2Core.NgZone;
}, function (_angular2PlatformBrowser) {
Title = _angular2PlatformBrowser.Title;
}, function (_configConfig) {
Config = _configConfig.Config;
}, function (_utilClickBlock) {
ClickBlock = _utilClickBlock.ClickBlock;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
IonicApp = (function () {
function IonicApp(_config, _clickBlock, _zone) {
_classCallCheck(this, IonicApp);
this._config = _config;
this._clickBlock = _clickBlock;
this._zone = _zone;
this._cmps = {};
this._disTime = 0;
this._scrollTime = 0;
this._title = '';
this._titleSrv = new Title();
this._isProd = false;
}
/**
* Sets the document title.
* @param {string} val Value to set the document title to.
*/
_createClass(IonicApp, [{
key: "setTitle",
value: function setTitle(val) {
if (val !== this._title) {
this._title = val;
this._titleSrv.setTitle(val);
}
}
/**
* Returns if the app has been set to be in be in production mode or not.
* Production mode can only be set within the config of `@App`. Defaults
* to `false`.
* @return {boolean}
*/
}, {
key: "isProd",
value: function isProd() {
return this._isProd;
}
/**
* @private
*/
}, {
key: "setProd",
value: function setProd(val) {
this._isProd = !!val;
}
/**
* @private
* Sets if the app is currently enabled or not, meaning if it's
* available to accept new user commands. For example, this is set to `false`
* while views transition, a modal slides up, an action-sheet
* slides up, etc. After the transition completes it is set back to `true`.
* @param {boolean} isEnabled
* @param {boolean} fallback When `isEnabled` is set to `false`, this argument
* is used to set the maximum number of milliseconds that app will wait until
* it will automatically enable the app again. It's basically a fallback incase
* something goes wrong during a transition and the app wasn't re-enabled correctly.
*/
}, {
key: "setEnabled",
value: function setEnabled(isEnabled) {
var duration = arguments.length <= 1 || arguments[1] === undefined ? 700 : arguments[1];
this._disTime = isEnabled ? 0 : Date.now() + duration;
if (duration > 32 || isEnabled) {
// only do a click block if the duration is longer than XXms
this._clickBlock.show(!isEnabled, duration + 64);
}
}
/**
* @private
* Boolean if the app is actively enabled or not.
* @return {boolean}
*/
}, {
key: "isEnabled",
value: function isEnabled() {
return this._disTime < Date.now();
}
/**
* @private
*/
}, {
key: "setScrolling",
value: function setScrolling() {
this._scrollTime = Date.now();
}
/**
* @private
* Boolean if the app is actively scrolling or not.
* @return {boolean}
*/
}, {
key: "isScrolling",
value: function isScrolling() {
return this._scrollTime + 64 > Date.now();
}
/**
* @private
* Register a known component with a key, for easy lookups later.
* @param {string} id The id to use to register the component
* @param {object} component The component to register
*/
}, {
key: "register",
value: function register(id, component) {
this._cmps[id] = component;
}
/**
* @private
* Unregister a known component with a key.
* @param {string} id The id to use to unregister
*/
}, {
key: "unregister",
value: function unregister(id) {
delete this._cmps[id];
}
/**
* @private
* Get a registered component with the given type (returns the first)
* @param {object} cls the type to search for
* @return {object} the matching component, or undefined if none was found
*/
}, {
key: "getRegisteredComponent",
value: function getRegisteredComponent(cls) {
for (var key in this._cmps) {
var component = this._cmps[key];
if (component instanceof cls) {
return component;
}
}
}
/**
* @private
* Get the component for the given key.
*/
}, {
key: "getComponent",
value: function getComponent(id) {
// deprecated warning
if (/menu/i.test(id)) {
void 0;
}
return this._cmps[id];
}
}]);
return IonicApp;
})();
_export("IonicApp", IonicApp);
_export("IonicApp", IonicApp = __decorate([Injectable(), __metadata('design:paramtypes', [typeof (_a = typeof Config !== 'undefined' && Config) === 'function' && _a || Object, typeof (_b = typeof ClickBlock !== 'undefined' && ClickBlock) === 'function' && _b || Object, typeof (_c = typeof NgZone !== 'undefined' && NgZone) === 'function' && _c || Object])], IonicApp));
}
};
});
System.register("ionic-angular/components/app/id", ["angular2/core", "./app"], function (_export) {
/**
* @name Id
* @description
* IdRef is an easy way to identify unique components in an app and access them
* no matter where in the UI hierarchy you are. For example, this makes toggling
* a global side menu feasible from any place in the application.
*
* See the [Menu section](http://ionicframework.com/docs/v2/components/#menus) of
* the Component docs for an example of how Menus rely on ID's.
*
* @usage
* To give any component an ID, simply set its `id` property:
* ```html
*
* ```
*
* To get a reference to the registered component, inject the [IonicApp](../IonicApp/)
* service:
* ```ts
* constructor(app: IonicApp) {
* this.app = app
* }
* ngAfterViewInit{
* var checkbox = this.app.getComponent("myCheckbox");
* if (checkbox.checked) {
* console.log('checkbox is checked');
* }
* }
* ```
*
* *NOTE:* It is not recommended to use ID's across Pages, as there is often no
* guarantee that the registered component has not been destroyed if its Page
* has been navigated away from.
*
* @demo /docs/v2/demos/id/
*/
"use strict";
var AppViewManager, ElementRef, Directive, Renderer, Input, IonicApp, __decorate, __metadata, IdRef, Attr, _a, _b, _c, _d, _e;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
AppViewManager = _angular2Core.AppViewManager;
ElementRef = _angular2Core.ElementRef;
Directive = _angular2Core.Directive;
Renderer = _angular2Core.Renderer;
Input = _angular2Core.Input;
}, function (_app2) {
IonicApp = _app2.IonicApp;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
IdRef = (function () {
function IdRef(_app, elementRef, appViewManager) {
_classCallCheck(this, IdRef);
this._app = _app;
// Grab the component this directive is attached to
this._component = appViewManager.getComponent(elementRef);
}
/**
* @private
*/
_createClass(IdRef, [{
key: "ngOnInit",
value: function ngOnInit() {
this._app.register(this.id, this._component);
}
/**
* @private
*/
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
this._app.unregister(this.id);
}
}]);
return IdRef;
})();
_export("IdRef", IdRef);
__decorate([Input(), __metadata('design:type', String)], IdRef.prototype, "id", void 0);
_export("IdRef", IdRef = __decorate([Directive({
selector: '[id]'
}), __metadata('design:paramtypes', [typeof (_a = typeof IonicApp !== 'undefined' && IonicApp) === 'function' && _a || Object, typeof (_b = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _b || Object, typeof (_c = typeof AppViewManager !== 'undefined' && AppViewManager) === 'function' && _c || Object])], IdRef));
/**
* @private
*/
Attr = (function () {
function Attr(_renderer, _elementRef) {
_classCallCheck(this, Attr);
this._renderer = _renderer;
this._elementRef = _elementRef;
}
/**
* @private
*/
_createClass(Attr, [{
key: "ngOnInit",
value: function ngOnInit() {
this._renderer.setElementAttribute(this._elementRef.nativeElement, this.attr, '');
}
}]);
return Attr;
})();
_export("Attr", Attr);
__decorate([Input(), __metadata('design:type', String)], Attr.prototype, "attr", void 0);
_export("Attr", Attr = __decorate([Directive({
selector: '[attr]'
}), __metadata('design:paramtypes', [typeof (_d = typeof Renderer !== 'undefined' && Renderer) === 'function' && _d || Object, typeof (_e = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _e || Object])], Attr));
}
};
});
System.register("ionic-angular/components/badge/badge", ["angular2/core", "../../config/config"], function (_export) {
/**
* @name Badge
* @module ionic
* @description
* Badges are simple components in Ionic containing numbers or text. You can display a badge to indicate that there is new information associated with the item it is on.
* @see {@link /docs/v2/components/#badges Badges Component Docs}
*/
"use strict";
var Directive, ElementRef, Renderer, Config, __decorate, __metadata, Badge, _a, _b, _c;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Directive = _angular2Core.Directive;
ElementRef = _angular2Core.ElementRef;
Renderer = _angular2Core.Renderer;
}, function (_configConfig) {
Config = _configConfig.Config;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Badge = (function () {
function Badge(config, _elementRef, _renderer) {
_classCallCheck(this, Badge);
this._elementRef = _elementRef;
this._renderer = _renderer;
var element = _elementRef.nativeElement;
this._readAttrs(element);
}
/**
* @private
*/
_createClass(Badge, [{
key: "_readAttrs",
value: function _readAttrs(element) {
var elementAttrs = element.attributes;
var attrName = undefined;
for (var i = 0, l = elementAttrs.length; i < l; i++) {
if (elementAttrs[i].value !== '') continue;
attrName = elementAttrs[i].name;
// Ignore attributes item-left, item-right
if (attrName.indexOf('item') == -1) {
this._setClass(attrName);
}
}
}
/**
* @private
*/
}, {
key: "_setClass",
value: function _setClass(color) {
this._renderer.setElementClass(this._elementRef.nativeElement, 'badge-' + color, true);
}
}]);
return Badge;
})();
_export("Badge", Badge);
_export("Badge", Badge = __decorate([Directive({
selector: 'ion-badge'
}), __metadata('design:paramtypes', [typeof (_a = typeof Config !== 'undefined' && Config) === 'function' && _a || Object, typeof (_b = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _b || Object, typeof (_c = typeof Renderer !== 'undefined' && Renderer) === 'function' && _c || Object])], Badge));
}
};
});
System.register("ionic-angular/components/blur/blur", ["angular2/core"], function (_export) {
/**
* @name Blur
* @description
* The blur attribute applies the CSS blur attribute to an element. Safari only.
*
* @usage
* ```html
*
* This card will blur the content behind it.
*
* ```
*
* @demo /docs/v2/demos/blur/
* @private
*/
"use strict";
var Directive, Renderer, ElementRef, __decorate, __metadata, Blur, _a, _b;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Directive = _angular2Core.Directive;
Renderer = _angular2Core.Renderer;
ElementRef = _angular2Core.ElementRef;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Blur = function Blur(_elementRef, _renderer) {
_classCallCheck(this, Blur);
this._elementRef = _elementRef;
this._renderer = _renderer;
_renderer.setElementStyle(_elementRef.nativeElement, '-webkit-backdrop-filter', 'blur(10px)');
};
_export("Blur", Blur);
_export("Blur", Blur = __decorate([Directive({
selector: '[blur]'
}), __metadata('design:paramtypes', [typeof (_a = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _a || Object, typeof (_b = typeof Renderer !== 'undefined' && Renderer) === 'function' && _b || Object])], Blur));
}
};
});
System.register("ionic-angular/components/button/button", ["angular2/core", "../../config/config"], function (_export) {
/**
* @name Button
* @module ionic
* @property [outline] - for an unfilled outline button
* @property [clear] - for a transparent button that only shows text and icons
* @property [round] - for a button with rounded corners
* @property [block] - for a block button that fills it's parent container
* @property [full] - for a full width button
* @property [small] - sets button size to small
* @property [large] - sets button size to large
* @property [disabled] - disables the button
* @property [fab] - for a floating action button
* @property [fab-left] - position a fab button to the left
* @property [fab-right] - position a fab button to the right
* @property [fab-center] - position a fab button towards the center
* @property [fab-top] - position a fab button towards the top
* @property [fab-bottom] - position a fab button towards the bottom
* @property [color] - Dynamically set which color attribute this button should use.
* @description
* Buttons are simple components in Ionic, can consist of text, an icon, or both, and can be enhanced with a wide range of attributes.
* @demo /docs/v2/demos/button/
* @see {@link /docs/v2/components#buttons Button Component Docs}
*/
"use strict";
var Component, ElementRef, Renderer, Attribute, Input, Config, __decorate, __metadata, __param, Button, BUTTON_SIZE_ATTRS, BUTTON_STYLE_ATTRS, BUTTON_SHAPE_ATTRS, BUTTON_DISPLAY_ATTRS, IGNORE_ATTRS, TEXT, ICON, _a, _b, _c;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
ElementRef = _angular2Core.ElementRef;
Renderer = _angular2Core.Renderer;
Attribute = _angular2Core.Attribute;
Input = _angular2Core.Input;
}, function (_configConfig) {
Config = _configConfig.Config;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
__param = undefined && undefined.__param || function (paramIndex, decorator) {
return function (target, key) {
decorator(target, key, paramIndex);
};
};
Button = (function () {
function Button(config, _elementRef, _renderer, ionItem) {
_classCallCheck(this, Button);
this._elementRef = _elementRef;
this._renderer = _renderer;
this._role = 'button'; // bar-button/item-button
this._size = null; // large/small
this._style = 'default'; // outline/clear/solid
this._shape = null; // round/fab
this._display = null; // block/full
this._lastColor = null;
this._colors = []; // primary/secondary
this._icon = null; // left/right/only
this._disabled = false; // disabled
this.isItem = ionItem === '';
var element = _elementRef.nativeElement;
if (config.get('hoverCSS') === false) {
_renderer.setElementClass(_elementRef.nativeElement, 'disable-hover', true);
}
if (element.hasAttribute('ion-item')) {
// no need to put on these classes for an ion-item
this._role = null;
return;
}
if (element.hasAttribute('disabled')) {
this._disabled = true;
}
this._readAttrs(element);
}
/**
* @private
*/
_createClass(Button, [{
key: "ngAfterContentInit",
value: function ngAfterContentInit() {
this._lastColor = this.color;
if (this.color) {
this._colors = [this.color];
}
this._readIcon(this._elementRef.nativeElement);
this._assignCss(true);
}
/**
* @private
*/
}, {
key: "ngAfterContentChecked",
value: function ngAfterContentChecked() {
if (this._lastColor !== this.color) {
this._assignCss(false);
this._lastColor = this.color;
this._colors = [this.color];
this._assignCss(true);
}
}
/**
* @private
*/
}, {
key: "addClass",
value: function addClass(className) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, true);
}
/**
* @private
*/
}, {
key: "setRole",
value: function setRole(val) {
this._role = val;
}
/**
* @private
*/
}, {
key: "_readIcon",
value: function _readIcon(element) {
// figure out if and where the icon lives in the button
var childNodes = element.childNodes;
if (childNodes.length > 0) {
childNodes = childNodes[0].childNodes;
}
var childNode = undefined;
var nodes = [];
for (var i = 0, l = childNodes.length; i < l; i++) {
childNode = childNodes[i];
if (childNode.nodeType === 3) {
// text node
if (childNode.textContent.trim() !== '') {
nodes.push(TEXT);
}
} else if (childNode.nodeType === 1) {
if (childNode.nodeName === 'ION-ICON') {
// icon element node
nodes.push(ICON);
} else {
// element other than an
nodes.push(TEXT);
}
}
}
if (nodes.length > 1) {
if (nodes[0] === ICON && nodes[1] === TEXT) {
this._icon = 'icon-left';
} else if (nodes[0] === TEXT && nodes[1] === ICON) {
this._icon = 'icon-right';
}
} else if (nodes.length === 1 && nodes[0] === ICON) {
this._icon = 'icon-only';
}
}
/**
* @private
*/
}, {
key: "_readAttrs",
value: function _readAttrs(element) {
var elementAttrs = element.attributes;
var attrName = undefined;
for (var i = 0, l = elementAttrs.length; i < l; i++) {
if (elementAttrs[i].value !== '') continue;
attrName = elementAttrs[i].name;
if (BUTTON_STYLE_ATTRS.indexOf(attrName) > -1) {
this._style = attrName;
} else if (BUTTON_DISPLAY_ATTRS.indexOf(attrName) > -1) {
this._display = attrName;
} else if (BUTTON_SHAPE_ATTRS.indexOf(attrName) > -1) {
this._shape = attrName;
} else if (BUTTON_SIZE_ATTRS.indexOf(attrName) > -1) {
this._size = attrName;
} else if (!IGNORE_ATTRS.test(attrName)) {
this._colors.push(attrName);
}
}
}
/**
* @private
*/
}, {
key: "_assignCss",
value: function _assignCss(assignCssClass) {
var _this = this;
var role = this._role;
if (role) {
(function () {
_this._renderer.setElementClass(_this._elementRef.nativeElement, role, assignCssClass); // button
_this._setClass(_this._style, assignCssClass); // button-clear
_this._setClass(_this._shape, assignCssClass); // button-round
_this._setClass(_this._display, assignCssClass); // button-full
_this._setClass(_this._size, assignCssClass); // button-small
_this._setClass(_this._icon, assignCssClass); // button-icon-left
var colorStyle = _this._style !== 'default' ? _this._style + '-' : '';
_this._colors.forEach(function (colorName) {
_this._setClass(colorStyle + colorName, assignCssClass); // button-secondary, button-clear-secondary
});
})();
}
}
/**
* @private
*/
}, {
key: "_setClass",
value: function _setClass(type, assignCssClass) {
if (type) {
this._renderer.setElementClass(this._elementRef.nativeElement, this._role + '-' + type, assignCssClass);
}
}
/**
* @private
*/
}], [{
key: "setRoles",
value: function setRoles(contentButtonChildren, role) {
var buttons = contentButtonChildren.toArray();
buttons.forEach(function (button) {
button.setRole(role);
});
}
}]);
return Button;
})();
_export("Button", Button);
__decorate([Input(), __metadata('design:type', String)], Button.prototype, "color", void 0);
_export("Button", Button = __decorate([Component({
selector: 'button:not([ion-item]),[button]',
template: '' + '' + '' + ''
}), __param(3, Attribute('ion-item')), __metadata('design:paramtypes', [typeof (_a = typeof Config !== 'undefined' && Config) === 'function' && _a || Object, typeof (_b = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _b || Object, typeof (_c = typeof Renderer !== 'undefined' && Renderer) === 'function' && _c || Object, String])], Button));
BUTTON_SIZE_ATTRS = ['large', 'small'];
BUTTON_STYLE_ATTRS = ['clear', 'outline', 'solid'];
BUTTON_SHAPE_ATTRS = ['round', 'fab'];
BUTTON_DISPLAY_ATTRS = ['block', 'full'];
IGNORE_ATTRS = /_ng|button|left|right/;
TEXT = 1;
ICON = 2;
}
};
});
System.register("ionic-angular/components/checkbox/checkbox", ["angular2/core", "angular2/common", "../../util/form", "../item/item", "../../util/util"], function (_export) {
"use strict";
var Component, Optional, Input, Output, EventEmitter, HostListener, Provider, forwardRef, NG_VALUE_ACCESSOR, Form, Item, isTrueProperty, __decorate, __metadata, __param, CHECKBOX_VALUE_ACCESSOR, Checkbox, _a, _b, _c;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
Optional = _angular2Core.Optional;
Input = _angular2Core.Input;
Output = _angular2Core.Output;
EventEmitter = _angular2Core.EventEmitter;
HostListener = _angular2Core.HostListener;
Provider = _angular2Core.Provider;
forwardRef = _angular2Core.forwardRef;
}, function (_angular2Common) {
NG_VALUE_ACCESSOR = _angular2Common.NG_VALUE_ACCESSOR;
}, function (_utilForm) {
Form = _utilForm.Form;
}, function (_itemItem) {
Item = _itemItem.Item;
}, function (_utilUtil) {
isTrueProperty = _utilUtil.isTrueProperty;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
__param = undefined && undefined.__param || function (paramIndex, decorator) {
return function (target, key) {
decorator(target, key, paramIndex);
};
};
CHECKBOX_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, { useExisting: forwardRef(function () {
return Checkbox;
}), multi: true });
/**
* The checkbox is no different than the HTML checkbox input, except
* it's styled accordingly to the the platform and design mode, such
* as iOS or Material Design.
*
* See the [Angular 2 Docs](https://angular.io/docs/ts/latest/guide/forms.html)
* for more info on forms and inputs.
*
*
* @usage
* ```html
*
*
*
*
* Pepperoni
*
*
*
*
* Sausage
*
*
*
*
* Mushrooms
*
*
*
*
* ```
* @demo /docs/v2/demos/checkbox/
* @see {@link /docs/v2/components#checkbox Checkbox Component Docs}
*/
Checkbox = (function () {
function Checkbox(_form, _item) {
_classCallCheck(this, Checkbox);
this._form = _form;
this._item = _item;
this._checked = false;
this._disabled = false;
/**
* @output {Checkbox} expression to evaluate when the checkbox value changes
*/
this.change = new EventEmitter();
_form.register(this);
if (_item) {
this.id = 'chk-' + _item.registerInput('checkbox');
this._labelId = 'lbl-' + _item.id;
this._item.setCssClass('item-checkbox', true);
}
}
/**
* @private
*/
_createClass(Checkbox, [{
key: "_click",
value: function _click(ev) {
void 0;
ev.preventDefault();
ev.stopPropagation();
this.onChange(!this._checked);
}
/**
* @input {boolean} whether or not the checkbox is checked (defaults to false)
*/
}, {
key: "_setChecked",
/**
* @private
*/
value: function _setChecked(isChecked) {
if (isChecked !== this._checked) {
this._checked = isChecked;
this.change.emit(this);
this._item && this._item.setCssClass('item-checkbox-checked', isChecked);
}
}
/**
* @private
*/
}, {
key: "writeValue",
value: function writeValue(val) {
this._setChecked(isTrueProperty(val));
}
/**
* @private
*/
}, {
key: "registerOnChange",
value: function registerOnChange(fn) {
var _this = this;
this._fn = fn;
this.onChange = function (isChecked) {
void 0;
fn(isChecked);
_this._setChecked(isChecked);
_this.onTouched();
};
}
/**
* @private
*/
}, {
key: "registerOnTouched",
value: function registerOnTouched(fn) {
this.onTouched = fn;
}
/**
* @input {boolean} whether or not the checkbox is disabled or not.
*/
}, {
key: "onChange",
/**
* @private
*/
value: function onChange(isChecked) {
// used when this input does not have an ngModel or ngControl
void 0;
this._setChecked(isChecked);
this.onTouched();
}
/**
* @private
*/
}, {
key: "onTouched",
value: function onTouched() {}
/**
* @private
*/
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
this._form.deregister(this);
}
}, {
key: "checked",
get: function get() {
return this._checked;
},
set: function set(val) {
this._setChecked(isTrueProperty(val));
this.onChange(this._checked);
}
}, {
key: "disabled",
get: function get() {
return this._disabled;
},
set: function set(val) {
this._disabled = isTrueProperty(val);
this._item && this._item.setCssClass('item-checkbox-disabled', this._disabled);
}
}]);
return Checkbox;
})();
_export("Checkbox", Checkbox);
__decorate([Output(), __metadata('design:type', typeof (_a = typeof EventEmitter !== 'undefined' && EventEmitter) === 'function' && _a || Object)], Checkbox.prototype, "change", void 0);
__decorate([HostListener('click', ['$event']), __metadata('design:type', Function), __metadata('design:paramtypes', [Object]), __metadata('design:returntype', void 0)], Checkbox.prototype, "_click", null);
__decorate([Input(), __metadata('design:type', Boolean)], Checkbox.prototype, "checked", null);
__decorate([Input(), __metadata('design:type', Boolean)], Checkbox.prototype, "disabled", null);
_export("Checkbox", Checkbox = __decorate([Component({
selector: 'ion-checkbox',
template: '
' + '' + '
' + '',
host: {
'[class.checkbox-disabled]': '_disabled'
},
providers: [CHECKBOX_VALUE_ACCESSOR]
}), __param(1, Optional()), __metadata('design:paramtypes', [typeof (_b = typeof Form !== 'undefined' && Form) === 'function' && _b || Object, typeof (_c = typeof Item !== 'undefined' && Item) === 'function' && _c || Object])], Checkbox));
}
};
});
System.register("ionic-angular/components/content/content", ["angular2/core", "../ion", "../app/app", "../../config/config", "../../util/dom", "../nav/view-controller", "../../animations/scroll-to"], function (_export) {
/**
* @name Content
* @description
* The Content component provides an easy to use content area with some useful
* methods to control the scrollable area.
*
* The content area can also implement pull-to-refresh with the
* [Refresher](../../scroll/Refresher) component.
*
* @usage
* ```html
*
* Add your content here!
*
* ```
*
*/
"use strict";
var Component, ElementRef, Optional, NgZone, Ion, IonicApp, Config, raf, transitionEnd, ViewController, ScrollTo, __decorate, __metadata, __param, Content, _a, _b, _c, _d, _e;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
ElementRef = _angular2Core.ElementRef;
Optional = _angular2Core.Optional;
NgZone = _angular2Core.NgZone;
}, function (_ion) {
Ion = _ion.Ion;
}, function (_appApp) {
IonicApp = _appApp.IonicApp;
}, function (_configConfig) {
Config = _configConfig.Config;
}, function (_utilDom) {
raf = _utilDom.raf;
transitionEnd = _utilDom.transitionEnd;
}, function (_navViewController) {
ViewController = _navViewController.ViewController;
}, function (_animationsScrollTo) {
ScrollTo = _animationsScrollTo.ScrollTo;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
__param = undefined && undefined.__param || function (paramIndex, decorator) {
return function (target, key) {
decorator(target, key, paramIndex);
};
};
Content = (function (_Ion) {
_inherits(Content, _Ion);
function Content(_elementRef, _config, _app, _zone, viewCtrl) {
_classCallCheck(this, Content);
_get(Object.getPrototypeOf(Content.prototype), "constructor", this).call(this, _elementRef);
this._elementRef = _elementRef;
this._config = _config;
this._app = _app;
this._zone = _zone;
this._padding = 0;
if (viewCtrl) {
viewCtrl.setContent(this);
viewCtrl.setContentRef(_elementRef);
}
}
/**
* @private
*/
_createClass(Content, [{
key: "ngOnInit",
value: function ngOnInit() {
var self = this;
self.scrollElement = self._elementRef.nativeElement.children[0];
if (self._config.get('tapPolyfill') === true) {
self._zone.runOutsideAngular(function () {
self._scLsn = self.addScrollListener(function () {
self._app.setScrolling();
});
});
}
}
/**
* @private
*/
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
this._scLsn && this._scLsn();
this.scrollElement = this._scLsn = null;
}
/**
* @private
* Adds the specified scroll handler to the content' scroll element.
*
* ```ts
* @Page({
* template: ``
* )}
* export class MyPage{
* constructor(app: IonicApp){
* this.app = app;
* }
* // Need to wait until the component has been initialized
* ngAfterViewInit() {
* // Here 'my-content' is the ID of my ion-content
* this.content = this.app.getComponent('my-content');
* this.content.addScrollEventListener(this.myScroll);
* }
* myScroll() {
* console.info('They see me scrolling...');
* }
* }
* ```
* @param {Function} handler The method you want perform when scrolling
* @returns {Function} A function that removes the scroll handler.
*/
}, {
key: "addScrollListener",
value: function addScrollListener(handler) {
return this._addListener('scroll', handler);
}
/**
* @private
*/
}, {
key: "addTouchStartListener",
value: function addTouchStartListener(handler) {
return this._addListener('touchstart', handler);
}
/**
* @private
*/
}, {
key: "addTouchMoveListener",
value: function addTouchMoveListener(handler) {
return this._addListener('touchmove', handler);
}
/**
* @private
*/
}, {
key: "addTouchEndListener",
value: function addTouchEndListener(handler) {
return this._addListener('touchend', handler);
}
/**
* @private
*/
}, {
key: "addMouseDownListener",
value: function addMouseDownListener(handler) {
return this._addListener('mousedown', handler);
}
/**
* @private
*/
}, {
key: "addMouseUpListener",
value: function addMouseUpListener(handler) {
return this._addListener('mouseup', handler);
}
/**
* @private
*/
}, {
key: "addMouseMoveListener",
value: function addMouseMoveListener(handler) {
return this._addListener('mousemove', handler);
}
}, {
key: "_addListener",
value: function _addListener(type, handler) {
var _this = this;
if (!this.scrollElement) {
return;
}
// ensure we're not creating duplicates
this.scrollElement.removeEventListener(type, handler);
this.scrollElement.addEventListener(type, handler);
return function () {
_this.scrollElement.removeEventListener(type, handler);
};
}
/**
* @private
* Call a method when scrolling has stopped
* @param {Function} callback The method you want perform when scrolling has ended
*/
}, {
key: "onScrollEnd",
value: function onScrollEnd(callback) {
var lastScrollTop = null;
var framesUnchanged = 0;
var _scrollEle = this.scrollElement;
function next() {
var currentScrollTop = _scrollEle.scrollTop;
if (lastScrollTop !== null) {
if (Math.round(lastScrollTop) === Math.round(currentScrollTop)) {
framesUnchanged++;
} else {
framesUnchanged = 0;
}
if (framesUnchanged > 9) {
return callback();
}
}
lastScrollTop = currentScrollTop;
raf(function () {
raf(next);
});
}
setTimeout(next, 100);
}
}, {
key: "onScrollElementTransitionEnd",
value: function onScrollElementTransitionEnd(callback) {
transitionEnd(this.scrollElement, callback);
}
/**
* Scroll to the specified position.
*
* ```ts
* @Page({
* template: `
*
* `
* )}
* export class MyPage{
* constructor(app: IonicApp){
* this.app = app;
* }
* // Need to wait until the component has been initialized
* ngAfterViewInit() {
* // Here 'my-content' is the ID of my ion-content
* this.content = this.app.getComponent('my-content');
* }
* scrollTo() {
* this.content.scrollTo(0, 500, 200);
* }
* }
* ```
* @param {number} x The x-value to scroll to.
* @param {number} y The y-value to scroll to.
* @param {number} duration Duration of the scroll animation in ms.
* @param {TODO} tolerance TODO
* @returns {Promise} Returns a promise when done
*/
}, {
key: "scrollTo",
value: function scrollTo(x, y, duration, tolerance) {
if (this._scrollTo) {
this._scrollTo.dispose();
}
this._scrollTo = new ScrollTo(this.scrollElement);
return this._scrollTo.start(x, y, duration, tolerance);
}
/**
* Scroll to the specified position.
*
* ```ts
* @Page({
* template: `
*
* `
* )}
* export class MyPage{
* constructor(app: IonicApp){
* this.app = app;
* }
* // Need to wait until the component has been initialized
* ngAfterViewInit() {
* // Here 'my-content' is the ID of my ion-content
* this.content = this.app.getComponent('my-content');
* }
* scrollTop() {
* this.content.scrollTop();
* }
* }
* ```
* @returns {Promise} Returns a promise when done
*/
}, {
key: "scrollToTop",
value: function scrollToTop() {
if (this._scrollTo) {
this._scrollTo.dispose();
}
this._scrollTo = new ScrollTo(this.scrollElement);
return this._scrollTo.start(0, 0, 300, 0);
}
/**
* @private
*/
}, {
key: "getScrollTop",
value: function getScrollTop() {
return this.getNativeElement().scrollTop;
}
/**
* @private
*/
}, {
key: "addCssClass",
value: function addCssClass(className) {
this.getNativeElement().classList.add(className);
}
/**
* @private
*/
}, {
key: "removeCssClass",
value: function removeCssClass(className) {
this.getNativeElement().classList.remove(className);
}
/**
* @private
*/
}, {
key: "setScrollElementStyle",
value: function setScrollElementStyle(prop, val) {
this.scrollElement.style[prop] = val;
}
/**
* Returns the content and scroll elements' dimensions.
* @returns {object} dimensions The content and scroll elements' dimensions
* {number} dimensions.contentHeight content offsetHeight
* {number} dimensions.contentTop content offsetTop
* {number} dimensions.contentBottom content offsetTop+offsetHeight
* {number} dimensions.contentWidth content offsetWidth
* {number} dimensions.contentLeft content offsetLeft
* {number} dimensions.contentRight content offsetLeft + offsetWidth
* {number} dimensions.scrollHeight scroll scrollHeight
* {number} dimensions.scrollTop scroll scrollTop
* {number} dimensions.scrollBottom scroll scrollTop + scrollHeight
* {number} dimensions.scrollWidth scroll scrollWidth
* {number} dimensions.scrollLeft scroll scrollLeft
* {number} dimensions.scrollRight scroll scrollLeft + scrollWidth
*/
}, {
key: "getContentDimensions",
value: function getContentDimensions() {
var _scrollEle = this.scrollElement;
var parentElement = _scrollEle.parentElement;
return {
contentHeight: parentElement.offsetHeight,
contentTop: parentElement.offsetTop,
contentBottom: parentElement.offsetTop + parentElement.offsetHeight,
contentWidth: parentElement.offsetWidth,
contentLeft: parentElement.offsetLeft,
contentRight: parentElement.offsetLeft + parentElement.offsetWidth,
scrollHeight: _scrollEle.scrollHeight,
scrollTop: _scrollEle.scrollTop,
scrollBottom: _scrollEle.scrollTop + _scrollEle.scrollHeight,
scrollWidth: _scrollEle.scrollWidth,
scrollLeft: _scrollEle.scrollLeft,
scrollRight: _scrollEle.scrollLeft + _scrollEle.scrollWidth
};
}
/**
* @private
* Adds padding to the bottom of the scroll element when the keyboard is open
* so content below the keyboard can be scrolled into view.
*/
}, {
key: "addScrollPadding",
value: function addScrollPadding(newPadding) {
if (newPadding > this._padding) {
void 0;
this._padding = newPadding;
this.scrollElement.style.paddingBottom = newPadding + 'px';
}
}
}]);
return Content;
})(Ion);
_export("Content", Content);
_export("Content", Content = __decorate([Component({
selector: 'ion-content',
template: '' + '' + '' + ''
}), __param(4, Optional()), __metadata('design:paramtypes', [typeof (_a = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _a || Object, typeof (_b = typeof Config !== 'undefined' && Config) === 'function' && _b || Object, typeof (_c = typeof IonicApp !== 'undefined' && IonicApp) === 'function' && _c || Object, typeof (_d = typeof NgZone !== 'undefined' && NgZone) === 'function' && _d || Object, typeof (_e = typeof ViewController !== 'undefined' && ViewController) === 'function' && _e || Object])], Content));
}
};
});
System.register("ionic-angular/components/icon/icon", ["angular2/core", "../../config/config"], function (_export) {
/**
* @name Icon
* @description
* Icons can be used on their own, or inside of a number of Ionic components.
* For a full list of available icons, check out the
* [Ionicons resource docs](../../../../resources/ionicons).
*
* One feature of Ionicons is that when icon names are set, the actual icon
* which is rendered can change slightly depending on the mode the app is
* running from. For example, by setting the icon name of `alarm`, on iOS the
* icon will automatically apply `ios-alarm`, and on Material Design it will
* automatically apply `md-alarm`. This allow the developer to write the
* markup once, and let Ionic automatically apply the appropriate icon.
*
* @usage
* ```html
*
*
*
*
*
*
*
*
*
* ```
*
* @demo /docs/v2/demos/icon/
* @see {@link /docs/v2/components#icons Icon Component Docs}
*
*/
"use strict";
var Directive, ElementRef, Renderer, Input, Config, __decorate, __metadata, Icon, _a, _b, _c;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Directive = _angular2Core.Directive;
ElementRef = _angular2Core.ElementRef;
Renderer = _angular2Core.Renderer;
Input = _angular2Core.Input;
}, function (_configConfig) {
Config = _configConfig.Config;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Icon = (function () {
function Icon(config, _elementRef, _renderer) {
_classCallCheck(this, Icon);
this._elementRef = _elementRef;
this._renderer = _renderer;
this._name = '';
this._ios = '';
this._md = '';
this._css = '';
this.mode = config.get('iconMode');
if (_elementRef.nativeElement.tagName === 'ICON') {
// deprecated warning
void 0;
void 0;
void 0;
}
}
/**
* @private
*/
_createClass(Icon, [{
key: "ngOnDestroy",
value: function ngOnDestroy() {
if (this._css) {
this._renderer.setElementClass(this._elementRef.nativeElement, this._css, false);
}
}
/**
* @input {string} Icon to use. Will load the appropriate icon for each mode
*/
}, {
key: "update",
/**
* @private
*/
value: function update() {
var css = 'ion-';
if (this._ios && this.mode === 'ios') {
css += this._ios;
} else if (this._md && this.mode === 'md') {
css += this._md;
} else {
css += this._name;
}
if (this.mode == 'ios' && !this.isActive) {
css += '-outline';
}
if (this._css !== css) {
if (this._css) {
this._renderer.setElementClass(this._elementRef.nativeElement, this._css, false);
}
this._css = css;
this._renderer.setElementClass(this._elementRef.nativeElement, css, true);
this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-label', css.replace('ion-', '').replace('ios-', '').replace('md-', '').replace('-', ' '));
}
}
/**
* @private
* @param {string} add class name
*/
}, {
key: "addClass",
value: function addClass(className) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, true);
}
}, {
key: "name",
get: function get() {
return this._name;
},
set: function set(val) {
if (!/^md-|^ios-|^logo-/.test(val)) {
// this does not have one of the defaults
// so lets auto add in the mode prefix for them
val = this.mode + '-' + val;
}
this._name = val;
this.update();
}
/**
* @input {string} Explicitly set the icon to use on iOS
*/
}, {
key: "ios",
get: function get() {
return this._ios;
},
set: function set(val) {
this._ios = val;
this.update();
}
/**
* @input {string} Explicitly set the icon to use on MD
*/
}, {
key: "md",
get: function get() {
return this._md;
},
set: function set(val) {
this._md = val;
this.update();
}
/**
* @input {bool} Whether or not the icon has an "active" appearance. On iOS an active icon is filled in or full appearance, and an inactive icon on iOS will use an outlined version of the icon same icon. Material Design icons do not change appearance depending if they're active or not. The `isActive` property is largely used by the tabbar.
*/
}, {
key: "isActive",
get: function get() {
return this._isActive === undefined || this._isActive === true || this._isActive === 'true';
},
set: function set(val) {
this._isActive = val;
this.update();
}
}]);
return Icon;
})();
_export("Icon", Icon);
__decorate([Input(), __metadata('design:type', String)], Icon.prototype, "name", null);
__decorate([Input(), __metadata('design:type', String)], Icon.prototype, "ios", null);
__decorate([Input(), __metadata('design:type', String)], Icon.prototype, "md", null);
__decorate([Input(), __metadata('design:type', Boolean)], Icon.prototype, "isActive", null);
_export("Icon", Icon = __decorate([Directive({
selector: 'ion-icon,icon',
host: {
'role': 'img'
}
}), __metadata('design:paramtypes', [typeof (_a = typeof Config !== 'undefined' && Config) === 'function' && _a || Object, typeof (_b = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _b || Object, typeof (_c = typeof Renderer !== 'undefined' && Renderer) === 'function' && _c || Object])], Icon));
}
};
});
System.register("ionic-angular/components/infinite-scroll/infinite-scroll-content", ["angular2/core", "angular2/common", "../../config/config", "./infinite-scroll", "../spinner/spinner"], function (_export) {
/**
* @private
*/
"use strict";
var Component, Input, NgIf, Config, InfiniteScroll, Spinner, __decorate, __metadata, InfiniteScrollContent, _a, _b;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Component = _angular2Core.Component;
Input = _angular2Core.Input;
}, function (_angular2Common) {
NgIf = _angular2Common.NgIf;
}, function (_configConfig) {
Config = _configConfig.Config;
}, function (_infiniteScroll) {
InfiniteScroll = _infiniteScroll.InfiniteScroll;
}, function (_spinnerSpinner) {
Spinner = _spinnerSpinner.Spinner;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
InfiniteScrollContent = (function () {
function InfiniteScrollContent(inf, _config) {
_classCallCheck(this, InfiniteScrollContent);
this.inf = inf;
this._config = _config;
}
/**
* @private
*/
_createClass(InfiniteScrollContent, [{
key: "ngOnInit",
value: function ngOnInit() {
if (!this.loadingSpinner) {
this.loadingSpinner = this._config.get('infiniteLoadingSpinner', this._config.get('spinner', 'ios'));
}
}
}]);
return InfiniteScrollContent;
})();
_export("InfiniteScrollContent", InfiniteScrollContent);
__decorate([Input(), __metadata('design:type', String)], InfiniteScrollContent.prototype, "loadingSpinner", void 0);
__decorate([Input(), __metadata('design:type', String)], InfiniteScrollContent.prototype, "loadingText", void 0);
_export("InfiniteScrollContent", InfiniteScrollContent = __decorate([Component({
selector: 'ion-infinite-scroll-content',
template: '
' + '
' + '' + '
' + '' + '
',
directives: [NgIf, Spinner],
host: {
'[attr.state]': 'inf.state'
}
}), __metadata('design:paramtypes', [typeof (_a = typeof InfiniteScroll !== 'undefined' && InfiniteScroll) === 'function' && _a || Object, typeof (_b = typeof Config !== 'undefined' && Config) === 'function' && _b || Object])], InfiniteScrollContent));
}
};
});
System.register("ionic-angular/components/infinite-scroll/infinite-scroll", ["angular2/core", "../content/content"], function (_export) {
/**
* @name InfiniteScroll
* @description
* The Infinite Scroll allows you to perform an action when the user
* scrolls a specified distance from the bottom of the page.
*
* The expression assigned to the `infinite` event is called when
* the user scrolls to the specified distance. When this expression
* has finished its tasks, it should call the `complete()` method
* on the infinite scroll instance.
*
* @usage
* ```html
*
*
*
* {{i}}
*
*
*
*
*
*
*
* ```
*
* ```ts
* @Page({...})
* export class NewsFeedPage {
*
* constructor() {
* this.items = [];
* for (var i = 0; i < 30; i++) {
* this.items.push( this.items.length );
* }
* }
*
* doInfinite(infiniteScroll) {
* console.log('Begin async operation');
*
* setTimeout(() => {
* for (var i = 0; i < 30; i++) {
* this.items.push( this.items.length );
* }
*
* console.log('Async operation has ended');
* infiniteScroll.complete();
* }, 500);
* }
*
* }
* ```
*
*
* ## Infinite Scroll Content
*
* By default, Ionic uses the infinite scroll spinner that looks
* best for the platform the user is on. However, you can change the
* default spinner or add text by adding properties to the
* `ion-infinite-scroll-content` component.
*
* ```html
*
*
*
*
*
*
*
*
* ```
*
*
* ## Further Customizing Infinite Scroll Content
*
* The `ion-infinite-scroll` component holds the infinite scroll logic.
* It requires a child component in order to display the content.
* Ionic uses `ion-infinite-scroll-content` by default. This component
* displays the infinite scroll and changes the look depending
* on the infinite scroll's state. Separating these components allows
* developers to create their own infinite scroll content components.
* You could replace our default content with custom SVG or CSS animations.
*
* @demo /docs/v2/demos/infinite-scroll/
*
*/
"use strict";
var Directive, Input, Output, EventEmitter, Host, NgZone, ElementRef, Content, __decorate, __metadata, __param, InfiniteScroll, STATE_ENABLED, STATE_DISABLED, STATE_LOADING, _a, _b, _c, _d;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return {
setters: [function (_angular2Core) {
Directive = _angular2Core.Directive;
Input = _angular2Core.Input;
Output = _angular2Core.Output;
EventEmitter = _angular2Core.EventEmitter;
Host = _angular2Core.Host;
NgZone = _angular2Core.NgZone;
ElementRef = _angular2Core.ElementRef;
}, function (_contentContent) {
Content = _contentContent.Content;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
__param = undefined && undefined.__param || function (paramIndex, decorator) {
return function (target, key) {
decorator(target, key, paramIndex);
};
};
InfiniteScroll = (function () {
function InfiniteScroll(_content, _zone, _elementRef) {
_classCallCheck(this, InfiniteScroll);
this._content = _content;
this._zone = _zone;
this._elementRef = _elementRef;
this._lastCheck = 0;
this._highestY = 0;
this._thr = '15%';
this._thrPx = 0;
this._thrPc = 0.15;
this._init = false;
this.state = STATE_ENABLED;
/**
* @output {event} The expression to call when the scroll reaches
* the threshold distance. From within your infinite handler,
* you must call the infinite scroll's `complete()` method when
* your async operation has completed.
*/
this.infinite = new EventEmitter();
_content.addCssClass('has-infinite-scroll');
}
/**
* @input {string} The threshold distance from the bottom
* of the content to call the `infinite` output event when scrolled.
* The threshold value can be either a percent, or
* in pixels. For example, use the value of `10%` for the `infinite`
* output event to get called when the user has scrolled 10%
* from the bottom of the page. Use the value `100px` when the
* scroll is within 100 pixels from the bottom of the page.
* Default is `15%`.
*/
_createClass(InfiniteScroll, [{
key: "_onScroll",
value: function _onScroll(ev) {
var _this = this;
if (this.state === STATE_LOADING || this.state === STATE_DISABLED) {
return 1;
}
var now = Date.now();
if (this._lastCheck + 32 > now) {
// no need to check less than every XXms
return 2;
}
this._lastCheck = now;
var infiniteHeight = this._elementRef.nativeElement.scrollHeight;
if (!infiniteHeight) {
// if there is no height of this element then do nothing
return 3;
}
var d = this._content.getContentDimensions();
if (d.scrollTop <= this._highestY) {
// don't bother if scrollY is less than the highest Y seen
return 4;
}
this._highestY = d.scrollTop;
var reloadY = d.contentHeight;
if (this._thrPc) {
reloadY += reloadY * this._thrPc;
} else {
reloadY += this._thrPx;
}
var distanceFromInfinite = d.scrollHeight - infiniteHeight - d.scrollTop - reloadY;
if (distanceFromInfinite < 0) {
this._zone.run(function () {
void 0;
_this.state = STATE_LOADING;
_this.infinite.emit(_this);
});
return 5;
}
return 6;
}
/**
* Call `complete()` within the `infinite` output event handler when
* your async operation has completed. For example, the `loading`
* state is while the app is performing an asynchronous operation,
* such as receiving more data from an AJAX request to add more items
* to a data list. Once the data has been received and UI updated, you
* then call this method to signify that the loading has completed.
* This method will change the infinite scroll's state from `loading`
* to `enabled`.
*/
}, {
key: "complete",
value: function complete() {
this.state = STATE_ENABLED;
}
/**
* Call `enable(false)` to disable the infinite scroll from actively
* trying to receive new data while scrolling. This method is useful
* when it is known that there is no more data that can be added, and
* the infinite scroll is no longer needed.
* @param {boolean} shouldEnable If the infinite scroll should be enabled or not. Setting to `false` will remove scroll event listeners and hide the display.
*/
}, {
key: "enable",
value: function enable(shouldEnable) {
this.state = shouldEnable ? STATE_ENABLED : STATE_DISABLED;
this._setListeners(shouldEnable);
}
}, {
key: "_setListeners",
value: function _setListeners(shouldListen) {
var _this2 = this;
if (this._init) {
if (shouldListen) {
if (!this._scLsn) {
this._zone.runOutsideAngular(function () {
_this2._scLsn = _this2._content.addScrollListener(_this2._onScroll.bind(_this2));
});
}
} else {
this._scLsn && this._scLsn();
this._scLsn = null;
}
}
}
/**
* @private
*/
}, {
key: "ngAfterContentInit",
value: function ngAfterContentInit() {
this._init = true;
this._setListeners(this.state !== STATE_DISABLED);
}
/**
* @private
*/
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
this._setListeners(false);
}
}, {
key: "threshold",
get: function get() {
return this._thr;
},
set: function set(val) {
this._thr = val;
if (val.indexOf('%') > -1) {
this._thrPx = 0;
this._thrPc = parseFloat(val) / 100;
} else {
this._thrPx = parseFloat(val);
this._thrPc = 0;
}
}
}]);
return InfiniteScroll;
})();
_export("InfiniteScroll", InfiniteScroll);
__decorate([Input(), __metadata('design:type', String)], InfiniteScroll.prototype, "threshold", null);
__decorate([Output(), __metadata('design:type', typeof (_a = typeof EventEmitter !== 'undefined' && EventEmitter) === 'function' && _a || Object)], InfiniteScroll.prototype, "infinite", void 0);
_export("InfiniteScroll", InfiniteScroll = __decorate([Directive({
selector: 'ion-infinite-scroll'
}), __param(0, Host()), __metadata('design:paramtypes', [typeof (_b = typeof Content !== 'undefined' && Content) === 'function' && _b || Object, typeof (_c = typeof NgZone !== 'undefined' && NgZone) === 'function' && _c || Object, typeof (_d = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _d || Object])], InfiniteScroll));
STATE_ENABLED = 'enabled';
STATE_DISABLED = 'disabled';
STATE_LOADING = 'loading';
}
};
});
System.register("ionic-angular/components/input/input-base", ["angular2/core", "../../util/util", "../../util/dom", "./native-input"], function (_export) {
"use strict";
var Input, ViewChild, isTrueProperty, pointerCoord, hasPointerMoved, closest, copyInputAttributes, NativeInput, NextInput, __decorate, __metadata, InputBase, SCROLL_ASSIST_SPEED, _a, _b, _c, _d, _e;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function getScrollAssistDuration(distanceToScroll) {
//return 3000;
distanceToScroll = Math.abs(distanceToScroll);
var duration = distanceToScroll / SCROLL_ASSIST_SPEED;
return Math.min(400, Math.max(150, duration));
}
return {
setters: [function (_angular2Core) {
Input = _angular2Core.Input;
ViewChild = _angular2Core.ViewChild;
}, function (_utilUtil) {
isTrueProperty = _utilUtil.isTrueProperty;
}, function (_utilDom) {
pointerCoord = _utilDom.pointerCoord;
hasPointerMoved = _utilDom.hasPointerMoved;
closest = _utilDom.closest;
copyInputAttributes = _utilDom.copyInputAttributes;
}, function (_nativeInput) {
NativeInput = _nativeInput.NativeInput;
NextInput = _nativeInput.NextInput;
}],
execute: function () {
__decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
var c = arguments.length,
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__metadata = undefined && undefined.__metadata || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
InputBase = (function () {
function InputBase(config, _form, _item, _app, _platform, _elementRef, _scrollView, _nav, ngControl) {
_classCallCheck(this, InputBase);
this._form = _form;
this._item = _item;
this._app = _app;
this._platform = _platform;
this._elementRef = _elementRef;
this._scrollView = _scrollView;
this._nav = _nav;
this._disabled = false;
this._type = 'text';
this._useAssist = true;
this._value = '';
this.placeholder = '';
this._useAssist = config.get('scrollAssist');
this._keyboardHeight = config.get('keyboardHeight');
this._autoFocusAssist = config.get('autoFocusAssist', 'delay');
this._autoComplete = config.get('autocomplete', 'off');
this._autoCorrect = config.get('autocorrect', 'off');
if (ngControl) {
ngControl.valueAccessor = this;
}
_form.register(this);
}
_createClass(InputBase, [{
key: "ngOnInit",
value: function ngOnInit() {
if (this._item) {
this._item.setCssClass('item-input', true);
this._item.registerInput(this._type);
}
var clearInput = this.clearInput;
if (typeof clearInput === 'string') {
this.clearInput = clearInput === '' || clearInput === 'true';
}
}
}, {
key: "ngAfterContentInit",
value: function ngAfterContentInit() {
var self = this;
self._scrollMove = function (ev) {
// scroll move event listener this instance can reuse
if (!(self._nav && self._nav.isTransitioning())) {
self.deregScrollMove();
if (self.hasFocus()) {
self._native.hideFocus(true);
self._scrollView.onScrollEnd(function () {
self._native.hideFocus(false);
if (self.hasFocus()) {
// if it still has focus then keep listening
self.regScrollMove();
}
});
}
}
};
this.setItemControlCss();
}
}, {
key: "ngAfterContentChecked",
value: function ngAfterContentChecked() {
this.setItemControlCss();
}
}, {
key: "setItemControlCss",
value: function setItemControlCss() {
var item = this._item;
var nativeControl = this._native && this._native.ngControl;
if (item && nativeControl) {
item.setCssClass('ng-untouched', nativeControl.untouched);
item.setCssClass('ng-touched', nativeControl.touched);
item.setCssClass('ng-pristine', nativeControl.pristine);
item.setCssClass('ng-dirty', nativeControl.dirty);
item.setCssClass('ng-valid', nativeControl.valid);
item.setCssClass('ng-invalid', !nativeControl.valid);
}
}
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
this._form.deregister(this);
}
}, {
key: "writeValue",
/**
* @private
* Angular2 Forms API method called by the model (Control) on change to update
* the checked value.
* https://github.com/angular/angular/blob/master/modules/angular2/src/forms/directives/shared.ts#L34
*/
value: function writeValue(val) {
this._value = val;
this.checkHasValue(val);
}
/**
* @private
*/
}, {
key: "onChange",
value: function onChange(val) {
this.checkHasValue(val);
}
/**
* @private
*/
}, {
key: "onTouched",
value: function onTouched(val) {}
/**
* @private
*/
}, {
key: "hasFocus",
value: function hasFocus() {
// check if an input has focus or not
return this._native.hasFocus();
}
/**
* @private
*/
}, {
key: "checkHasValue",
value: function checkHasValue(inputValue) {
if (this._item) {
this._item.setCssClass('input-has-value', !!(inputValue && inputValue !== ''));
}
}
/**
* @private
*/
}, {
key: "focusChange",
value: function focusChange(inputHasFocus) {
if (this._item) {
this._item.setCssClass('input-has-focus', inputHasFocus);
}
if (!inputHasFocus) {
this.deregScrollMove();
}
}
}, {
key: "pointerStart",
value: function pointerStart(ev) {
// input cover touchstart
void 0;
if (ev.type === 'touchstart') {
this._isTouch = true;
}
if ((this._isTouch || !this._isTouch && ev.type === 'mousedown') && this._app.isEnabled()) {
// remember where the touchstart/mousedown started
this._coord = pointerCoord(ev);
}
}
}, {
key: "pointerEnd",
value: function pointerEnd(ev) {
// input cover touchend/mouseup
void 0;
if (this._isTouch && ev.type === 'mouseup' || !this._app.isEnabled()) {
// the app is actively doing something right now
// don't try to scroll in the input
ev.preventDefault();
ev.stopPropagation();
} else if (this._coord) {
// get where the touchend/mouseup ended
var endCoord = pointerCoord(ev);
// focus this input if the pointer hasn't moved XX pixels
// and the input doesn't already have focus
if (!hasPointerMoved(8, this._coord, endCoord) && !this.hasFocus()) {
ev.preventDefault();
ev.stopPropagation();
// begin the input focus process
void 0;
this.initFocus();
}
}
this._coord = null;
}
/**
* @private
*/
}, {
key: "initFocus",
value: function initFocus() {
var _this = this;
// begin the process of setting focus to the inner input element
var scrollView = this._scrollView;
if (scrollView) {
// this input is inside of a scroll view
// find out if text input should be manually scrolled into view
var ele = this._elementRef.nativeElement;
var itemEle = closest(ele, 'ion-item');
if (itemEle) {
ele = itemEle;
}
var scrollData = InputBase.getScrollData(ele.offsetTop, ele.offsetHeight, scrollView.getContentDimensions(), this._keyboardHeight, this._platform.height());
if (scrollData.scrollAmount > -3 && scrollData.scrollAmount < 3) {
// the text input is in a safe position that doesn't
// require it to be scrolled into view, just set focus now
this.setFocus();
this.regScrollMove();
return;
}
// add padding to the bottom of the scroll view (if needed)
scrollView.addScrollPadding(scrollData.scrollPadding);
// manually scroll the text input to the top
// do not allow any clicks while it's scrolling
var scrollDuration = getScrollAssistDuration(scrollData.scrollAmount);
this._app.setEnabled(false, scrollDuration);
this._nav && this._nav.setTransitioning(true, scrollDuration);
// temporarily move the focus to the focus holder so the browser
// doesn't freak out while it's trying to get the input in place
// at this point the native text input still does not have focus
this._native.relocate(true, scrollData.inputSafeY);
// scroll the input into place
scrollView.scrollTo(0, scrollData.scrollTo, scrollDuration).then(function () {
// the scroll view is in the correct position now
// give the native text input focus
_this._native.relocate(false, 0);
_this.setFocus();
// all good, allow clicks again
_this._app.setEnabled(true);
_this._nav && _this._nav.setTransitioning(false);
_this.regScrollMove();
});
} else {
// not inside of a scroll view, just focus it
this.setFocus();
this.regScrollMove();
}
}
/**
* @private
*/
}, {
key: "clearTextInput",
value: function clearTextInput() {
void 0;
}
/**
* @private
*/
}, {
key: "setFocus",
value: function setFocus() {
// immediately set focus
this._form.setAsFocused(this);
// set focus on the actual input element
this._native.setFocus();
// ensure the body hasn't scrolled down
document.body.scrollTop = 0;
}
/**
* @private
* Angular2 Forms API method called by the view (NgControl) to register the
* onChange event handler that updates the model (Control).
* https://github.com/angular/angular/blob/master/modules/angular2/src/forms/directives/shared.ts#L27
* @param {Function} fn the onChange event handler.
*/
}, {
key: "registerOnChange",
value: function registerOnChange(fn) {
this.onChange = fn;
}
/**
* @private
* Angular2 Forms API method called by the the view (NgControl) to register
* the onTouched event handler that marks model (Control) as touched.
* @param {Function} fn onTouched event handler.
*/
}, {
key: "registerOnTouched",
value: function registerOnTouched(fn) {
this.onTouched = fn;
}
/**
* @private
*/
}, {
key: "regScrollMove",
value: function regScrollMove() {
var _this2 = this;
// register scroll move listener
if (this._useAssist && this._scrollView) {
setTimeout(function () {
_this2.deregScrollMove();
_this2._deregScroll = _this2._scrollView.addScrollListener(_this2._scrollMove);
}, 80);
}
}
/**
* @private
*/
}, {
key: "deregScrollMove",
value: function deregScrollMove() {
// deregister the scroll move listener
this._deregScroll && this._deregScroll();
}
}, {
key: "focusNext",
value: function focusNext() {
this._form.tabFocus(this);
}
/**
* @private
*/
}, {
key: "value",
get: function get() {
return this._value;
},
set: function set(val) {
this._value = val;
}
}, {
key: "type",
get: function get() {
return this._type;
},
set: function set(val) {
this._type = 'text';
if (val) {
val = val.toLowerCase();
if (/password|email|number|search|tel|url|date|month|time|week/.test(val)) {
this._type = val;
}
}
}
}, {
key: "disabled",
get: function get() {
return this._disabled;
},
set: function set(val) {
this._disabled = isTrueProperty(val);
this._item && this._item.setCssClass('item-input-disabled', this._disabled);
this._native && this._native.isDisabled(this._disabled);
}
/**
* @private
*/
}, {
key: "_nativeInput",
set: function set(nativeInput) {
var _this3 = this;
this._native = nativeInput;
if (this._item && this._item.labelId !== null) {
nativeInput.labelledBy(this._item.labelId);
}
nativeInput.valueChange.subscribe(function (inputValue) {
_this3.onChange(inputValue);
});
this.focusChange(this.hasFocus());
nativeInput.focusChange.subscribe(function (textInputHasFocus) {
_this3.focusChange(textInputHasFocus);
_this3.checkHasValue(nativeInput.getValue());
if (!textInputHasFocus) {
_this3.onTouched(textInputHasFocus);
}
});
this.checkHasValue(nativeInput.getValue());
this.disabled = this._disabled;
var ionInputEle = this._elementRef.nativeElement;
var nativeInputEle = nativeInput.element();
// copy ion-input attributes to the native input element
copyInputAttributes(ionInputEle, nativeInputEle);
if (ionInputEle.hasAttribute('autofocus')) {
// the ion-input element has the autofocus attributes
ionInputEle.removeAttribute('autofocus');
if (this._autoFocusAssist === 'immediate') {
// config says to immediate focus on the input
// works best on android devices
nativeInputEle.focus();
} else if (this._autoFocusAssist === 'delay') {
// config says to chill out a bit and focus on the input after transitions
// works best on desktop
setTimeout(function () {
nativeInputEle.focus();
}, 650);
}
}
// by default set autocomplete="off" unless specified by the input
if (ionInputEle.hasAttribute('autocomplete')) {
this._autoComplete = ionInputEle.getAttribute('autocomplete');
}
nativeInputEle.setAttribute('autocomplete', this._autoComplete);
// by default set autocomplete="off" unless specified by the input
if (ionInputEle.hasAttribute('autocorrect')) {
this._autoCorrect = ionInputEle.getAttribute('autocorrect');
}
nativeInputEle.setAttribute('autocorrect', this._autoCorrect);
}
/**
* @private
*/
}, {
key: "_nextInput",
set: function set(nextInput) {
var _this4 = this;
if (nextInput) {
nextInput.focused.subscribe(function () {
_this4._form.tabFocus(_this4);
});
}
}
}], [{
key: "getScrollData",
value: function getScrollData(inputOffsetTop, inputOffsetHeight, scrollViewDimensions, keyboardHeight, plaformHeight) {
// compute input's Y values relative to the body
var inputTop = inputOffsetTop + scrollViewDimensions.contentTop - scrollViewDimensions.scrollTop;
var inputBottom = inputTop + inputOffsetHeight;
// compute the safe area which is the viewable content area when the soft keyboard is up
var safeAreaTop = scrollViewDimensions.contentTop;
var safeAreaHeight = plaformHeight - keyboardHeight - safeAreaTop;
safeAreaHeight /= 2;
var safeAreaBottom = safeAreaTop + safeAreaHeight;
var inputTopWithinSafeArea = inputTop >= safeAreaTop && inputTop <= safeAreaBottom;
var inputTopAboveSafeArea = inputTop < safeAreaTop;
var inputTopBelowSafeArea = inputTop > safeAreaBottom;
var inputBottomWithinSafeArea = inputBottom >= safeAreaTop && inputBottom <= safeAreaBottom;
var inputBottomBelowSafeArea = inputBottom > safeAreaBottom;
/*
Text Input Scroll To Scenarios
---------------------------------------
1) Input top within safe area, bottom within safe area
2) Input top within safe area, bottom below safe area, room to scroll
3) Input top above safe area, bottom within safe area, room to scroll
4) Input top below safe area, no room to scroll, input smaller than safe area
5) Input top within safe area, bottom below safe area, no room to scroll, input smaller than safe area
6) Input top within safe area, bottom below safe area, no room to scroll, input larger than safe area
7) Input top below safe area, no room to scroll, input larger than safe area
*/
var scrollData = {
scrollAmount: 0,
scrollTo: 0,
scrollPadding: 0,
inputSafeY: 0
};
if (inputTopWithinSafeArea && inputBottomWithinSafeArea) {
// Input top within safe area, bottom within safe area
// no need to scroll to a position, it's good as-is
return scrollData;
}
// looks like we'll have to do some auto-scrolling
if (inputTopBelowSafeArea || inputBottomBelowSafeArea) {
// Input top and bottom below safe area
// auto scroll the input up so at least the top of it shows
if (safeAreaHeight > inputOffsetHeight) {
// safe area height is taller than the input height, so we
// can bring it up the input just enough to show the input bottom
scrollData.scrollAmount = Math.round(safeAreaBottom - inputBottom);
} else {
// safe area height is smaller than the input height, so we can
// only scroll it up so the input top is at the top of the safe area
// however the input bottom will be below the safe area
scrollData.scrollAmount = Math.round(safeAreaTop - inputTop);
}
scrollData.inputSafeY = -(inputTop - safeAreaTop) + 4;
} else if (inputTopAboveSafeArea) {
// Input top above safe area
// auto scroll the input down so at least the top of it shows
scrollData.scrollAmount = Math.round(safeAreaTop - inputTop);
scrollData.inputSafeY = safeAreaTop - inputTop + 4;
}
// figure out where it should scroll to for the best position to the input
scrollData.scrollTo = scrollViewDimensions.scrollTop - scrollData.scrollAmount;
if (scrollData.scrollAmount < 0) {
// when auto-scrolling up, there also needs to be enough
// content padding at the bottom of the scroll view
// manually add it if there isn't enough scrollable area
// figure out how many scrollable area is left to scroll up
var availablePadding = scrollViewDimensions.scrollHeight - scrollViewDimensions.scrollTop - scrollViewDimensions.contentHeight;
var paddingSpace = availablePadding + scrollData.scrollAmount;
if (paddingSpace < 0) {
// there's not enough scrollable area at the bottom, so manually add more
scrollData.scrollPadding = scrollViewDimensions.contentHeight - safeAreaHeight;
}
}
// if (!window.safeAreaEle) {
// window.safeAreaEle = document.createElement('div');
// window.safeAreaEle.style.position = 'absolute';
// window.safeAreaEle.style.background = 'rgba(0, 128, 0, 0.7)';
// window.safeAreaEle.style.padding = '2px 5px';
// window.safeAreaEle.style.textShadow = '1px 1px white';
// window.safeAreaEle.style.left = '0px';
// window.safeAreaEle.style.right = '0px';
// window.safeAreaEle.style.fontWeight = 'bold';
// window.safeAreaEle.style.pointerEvents = 'none';
// document.body.appendChild(window.safeAreaEle);
// }
// window.safeAreaEle.style.top = safeAreaTop + 'px';
// window.safeAreaEle.style.height = safeAreaHeight + 'px';
// window.safeAreaEle.innerHTML = `
//