refactor: improve tree shaking abilities

Internal refactor completed in order to improve tree shaking and dead
code removal. The public API, with an exception to ion-slides, has
stayed the same. However, internally many changes were required so
bundlers could better exclude modules which should not be bundled.
Ultimately most changes resorted to removing references to `window` or
`document`, or a module that referenced one of those.

BREAKING CHANGES

ion-slides was refactored to remove the external dependencies, and
rewritten in TypeScript/ES6 modules to again improve tree shaking
abilities.
This commit is contained in:
Adam Bradley
2017-01-09 09:51:39 -06:00
parent 13cf6a6cb7
commit 7000b1b173
191 changed files with 9401 additions and 13664 deletions

View File

@ -7,17 +7,18 @@ import { convertToView, convertToViews, NavOptions, DIRECTION_BACK, DIRECTION_FO
TransitionResolveFn, TransitionInstruction, ViewState } from './nav-util';
import { setZIndex } from './nav-util';
import { DeepLinker } from './deep-linker';
import { DomController } from '../platform/dom-controller';
import { GestureController } from '../gestures/gesture-controller';
import { isBlank, isNumber, isPresent, assert, removeArrayItem } from '../util/util';
import { isViewController, ViewController } from './view-controller';
import { Ion } from '../components/ion';
import { Keyboard } from '../util/keyboard';
import { Keyboard } from '../platform/keyboard';
import { NavController } from './nav-controller';
import { NavParams } from './nav-params';
import { Platform } from '../platform/platform';
import { SwipeBackGesture } from './swipe-back';
import { Transition } from '../transitions/transition';
import { TransitionController } from '../transitions/transition-controller';
import { DomController } from '../util/dom-controller';
/**
* @private
@ -52,6 +53,7 @@ export class NavControllerBase extends Ion implements NavController {
public parent: any,
public _app: App,
public config: Config,
public plt: Platform,
public _keyboard: Keyboard,
elementRef: ElementRef,
public _zone: NgZone,
@ -566,7 +568,7 @@ export class NavControllerBase extends Ion implements NavController {
direction: opts.direction,
duration: (opts.animate === false ? 0 : opts.duration),
easing: opts.easing,
isRTL: this._config.platform.isRTL(),
isRTL: this._config.plt.isRTL(),
ev: opts.ev,
};
@ -961,7 +963,7 @@ export class NavControllerBase extends Ion implements NavController {
_swipeBackCheck() {
if (this.canSwipeBack()) {
if (!this._sbGesture) {
this._sbGesture = new SwipeBackGesture(this, this._gestureCtrl, this._domCtrl);
this._sbGesture = new SwipeBackGesture(this.plt, this, this._gestureCtrl, this._domCtrl);
}
this._sbGesture.listen();