From 4524e5ad7dd1561c85fa89497530fd54f53d4612 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 22 Feb 2016 21:05:56 -0600 Subject: [PATCH 1/7] fix(animation): ensure final inline styles applied when fallback runs Closes #5484 --- ionic/animations/animation.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ionic/animations/animation.ts b/ionic/animations/animation.ts index f05b47935a..b3111c33b7 100644 --- a/ionic/animations/animation.ts +++ b/ionic/animations/animation.ts @@ -257,7 +257,7 @@ export class Animation { for (i = 0; i < self._pFns.length; i++) { self._pFns[i](); } - this.isPlaying = true; + self.isPlaying = true; // this is the top level animation and is in full control // of when the async play() should actually kick off @@ -271,7 +271,7 @@ export class Animation { self._before(); // ensure all past transition end events have been cleared - this._clearAsync(); + self._clearAsync(); if (duration > 30) { // this animation has a duration, so it should animate @@ -280,7 +280,7 @@ export class Animation { // set the FROM properties self._progress(0); - self._willChange(true); + self._willChg(true); // set the async TRANSITION END event // and run onFinishes when the transition ends @@ -364,7 +364,7 @@ export class Animation { // set the after styles self._after(); - self._willChange(false); + self._willChg(false); self._onFinish(shouldComplete); } @@ -372,12 +372,20 @@ export class Animation { self._unregTrans = transitionEnd(self._transEl(), onTransitionEnd); // set a fallback timeout if the transition end event never fires - self._tmr = setTimeout(onTransitionEnd, duration + 300); + self._tmr = setTimeout(function() { + // oh noz! the transition end event didn't fire in time! + // instead the fallback timer when first + // ensure the ending progress step gets rendered + self._progress(1); + + // manually run transition end event + onTransitionEnd(null); + }, duration + 350); } _clearAsync() { + this._unregTrans && this._unregTrans(); if (this._tmr) { - this._unregTrans && this._unregTrans(); clearTimeout(this._tmr); this._tmr = 0; } @@ -483,13 +491,13 @@ export class Animation { } } - _willChange(addWillChange: boolean) { + _willChg(addWillChange: boolean) { var i: number; var wc: string[]; var prop: string; for (i = 0; i < this._c.length; i++) { - this._c[i]._willChange(addWillChange); + this._c[i]._willChg(addWillChange); } if (this._wChg) { @@ -652,7 +660,7 @@ export class Animation { // 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._willChange(false); + this._willChg(false); this._onFinish(shouldComplete); } else { From 0cb080c9246c582b6fbec3ff804d6bc7361af639 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Tue, 23 Feb 2016 07:34:25 -0600 Subject: [PATCH 2/7] chore(karma): update Ionic imports Closes https://github.com/driftyco/ionic/issues/5566. --- ionic/util/test/util.spec.ts | 2 +- scripts/karma/system.config.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ionic/util/test/util.spec.ts b/ionic/util/test/util.spec.ts index fe314e63cc..040fad43df 100644 --- a/ionic/util/test/util.spec.ts +++ b/ionic/util/test/util.spec.ts @@ -1,4 +1,4 @@ -import * as util from '../../../ionic/util'; +import * as util from 'ionic-angular/util'; export function run() { describe('extend', function() { diff --git a/scripts/karma/system.config.js b/scripts/karma/system.config.js index f505af5f22..6c902ad8ea 100644 --- a/scripts/karma/system.config.js +++ b/scripts/karma/system.config.js @@ -1,6 +1,10 @@ System.config({ map: { - angular2: '/base/angular2', - ionic: '/base/ionic' + 'angular2': '/base/angular2' + }, + packages: { + 'ionic-angular': { + main: 'index' + } } }); \ No newline at end of file From d0a3872628c0c6bdb2a68c7fb56156b5a68b06fa Mon Sep 17 00:00:00 2001 From: mhartington Date: Tue, 23 Feb 2016 09:47:04 -0500 Subject: [PATCH 3/7] docs(navbar): add doc for hideBackButton --- ionic/components/navbar/navbar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic/components/navbar/navbar.ts b/ionic/components/navbar/navbar.ts index 3505766bf0..4774ec9fd3 100644 --- a/ionic/components/navbar/navbar.ts +++ b/ionic/components/navbar/navbar.ts @@ -125,7 +125,7 @@ export class Navbar extends ToolbarBase { private _bgRef: ElementRef; /** - * @private + * @input {boolean} whether the back button should be shown or not */ @Input() get hideBackButton(): boolean { From e622e72e5ff4f25be1528b357fd55f96edac0517 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Tue, 23 Feb 2016 09:32:22 -0600 Subject: [PATCH 4/7] chore(animation): end animations when fallback applies --- ionic/animations/animation.ts | 62 ++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/ionic/animations/animation.ts b/ionic/animations/animation.ts index b3111c33b7..0afa78454c 100644 --- a/ionic/animations/animation.ts +++ b/ionic/animations/animation.ts @@ -171,7 +171,7 @@ export class Animation { }; if (typeof val === 'string' && val.indexOf(' ') < 0) { - let r = val.match(cssValueRegex); + let r = val.match(CSS_VALUE_REGEX); let num = parseFloat(r[1]); if (!isNaN(num)) { @@ -243,7 +243,7 @@ export class Animation { play(opts: PlayOptions = {}) { var self = this; var i: number; - var duration = isDefined(opts.duration) ? opts.duration : self._dur; + var duration: number = isDefined(opts.duration) ? opts.duration : self._dur; console.debug('Animation, play, duration', duration, 'easing', self._easing); @@ -252,6 +252,7 @@ export class Animation { // 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++) { @@ -280,6 +281,7 @@ export class Animation { // 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 @@ -316,7 +318,7 @@ export class Animation { // since there was no animation, it's done // fire off all the onFinishes - self._onFinish(true); + self._didFinish(true); } } @@ -349,7 +351,7 @@ export class Animation { // since there was no animation, it's done // fire off all the onFinishes - self._onFinish(false); + self._didFinish(false); } } @@ -357,30 +359,52 @@ export class Animation { var self = this; function onTransitionEnd(ev) { - console.debug('Animation async end,', (ev ? 'transitionEnd, ' + ev.target.nodeName + ', property: ' + ev.propertyName : 'fallback timeout')); + console.debug('Animation onTransitionEnd', ev.target.nodeName, ev.propertyName); // ensure transition end events and timeouts have been cleared self._clearAsync(); // set the after styles self._after(); + + // remove will change properties self._willChg(false); - self._onFinish(shouldComplete); + + // transition finished + self._didFinish(shouldComplete); + } + + function onTransitionFallback() { + console.debug('Animation onTransitionFallback'); + // 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 - self._tmr = setTimeout(function() { - // oh noz! the transition end event didn't fire in time! - // instead the fallback timer when first - // ensure the ending progress step gets rendered - self._progress(1); - - // manually run transition end event - onTransitionEnd(null); - }, duration + 350); + // 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); } _clearAsync() { @@ -661,7 +685,7 @@ export class Animation { // for example, the left menu was dragged all the way open already this._after(); this._willChg(false); - this._onFinish(shouldComplete); + this._didFinish(shouldComplete); } else { // the stepValue was left off at a point when it needs to finish transition still @@ -692,7 +716,7 @@ export class Animation { return this; } - _onFinish(hasCompleted: boolean) { + _didFinish(hasCompleted: boolean) { this.isPlaying = false; this.hasCompleted = hasCompleted; var i: number; @@ -798,6 +822,6 @@ const TRANSFORMS = { 'skewX':1, 'skewY':1, 'perspective':1 }; -const cssValueRegex = /(^-?\d*\.?\d*)(.*)/; +const CSS_VALUE_REGEX = /(^-?\d*\.?\d*)(.*)/; let AnimationRegistry = {}; From ccf42152659942c58c25f5724d2b0183ce5ff8fb Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Tue, 23 Feb 2016 09:38:06 -0600 Subject: [PATCH 5/7] chore(): copy.libs before CJS bundle task --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 037d411b54..5a8b5a09d1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -147,7 +147,7 @@ gulp.task('bundle', ['bundle.cjs', 'bundle.system']); /** * Creates CommonJS bundle from Ionic source files. */ -gulp.task('bundle.cjs', ['transpile'], function(done){ +gulp.task('bundle.cjs', ['transpile', 'copy.libs'], function(done){ var config = require('./scripts/npm/ionic.webpack.config.js'); bundle({ config: config, stats: true }); From ec4b5ce97441da58a70b09f3c8930d6b3b6a0c3a Mon Sep 17 00:00:00 2001 From: mhartington Date: Tue, 23 Feb 2016 11:04:51 -0500 Subject: [PATCH 6/7] docs(config): update docs --- ionic/config/config.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ionic/config/config.ts b/ionic/config/config.ts index 7d1cb7ab94..d098fb6c70 100644 --- a/ionic/config/config.ts +++ b/ionic/config/config.ts @@ -317,10 +317,16 @@ export class Config { this.platform = platform; } + /** + * @private + */ static setModeConfig(mode, config) { modeConfigs[mode] = config; } + /** + * @private + */ static getModeConfig(mode) { return modeConfigs[mode] || null; } From f7c86589933bf23fcce6dab1c9f37b5430d66a9a Mon Sep 17 00:00:00 2001 From: Felipe Wagner Date: Tue, 23 Feb 2016 13:44:35 -0300 Subject: [PATCH 7/7] docs(sqlStorage): string error in query example --- ionic/platform/storage/sql.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic/platform/storage/sql.ts b/ionic/platform/storage/sql.ts index c01bda6706..ea071b43c8 100644 --- a/ionic/platform/storage/sql.ts +++ b/ionic/platform/storage/sql.ts @@ -23,7 +23,7 @@ const win :any = window; * }); * * // Sql storage also exposes the full engine underneath - * storage.query('insert into projects(name, data) values('Cool Project', 'blah')'); + * storage.query('insert into projects(name, data) values("Cool Project", "blah")'); * storage.query('select * from projects').then((resp) => {}) * ``` *