mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
Merge branch '2.0' into windows-mode
This commit is contained in:
@ -147,7 +147,7 @@ gulp.task('bundle', ['bundle.cjs', 'bundle.system']);
|
|||||||
/**
|
/**
|
||||||
* Creates CommonJS bundle from Ionic source files.
|
* 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');
|
var config = require('./scripts/npm/ionic.webpack.config.js');
|
||||||
bundle({ config: config, stats: true });
|
bundle({ config: config, stats: true });
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ export class Animation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (typeof val === 'string' && val.indexOf(' ') < 0) {
|
if (typeof val === 'string' && val.indexOf(' ') < 0) {
|
||||||
let r = val.match(cssValueRegex);
|
let r = val.match(CSS_VALUE_REGEX);
|
||||||
let num = parseFloat(r[1]);
|
let num = parseFloat(r[1]);
|
||||||
|
|
||||||
if (!isNaN(num)) {
|
if (!isNaN(num)) {
|
||||||
@ -243,7 +243,7 @@ export class Animation {
|
|||||||
play(opts: PlayOptions = {}) {
|
play(opts: PlayOptions = {}) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var i: number;
|
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);
|
console.debug('Animation, play, duration', duration, 'easing', self._easing);
|
||||||
|
|
||||||
@ -252,12 +252,13 @@ export class Animation {
|
|||||||
// and that it has at least one FROM/TO effect
|
// and that it has at least one FROM/TO effect
|
||||||
// and that the FROM/TO effect can tween numeric values
|
// and that the FROM/TO effect can tween numeric values
|
||||||
self.hasTween = false;
|
self.hasTween = false;
|
||||||
|
self.hasCompleted = false;
|
||||||
|
|
||||||
// fire off all the onPlays
|
// fire off all the onPlays
|
||||||
for (i = 0; i < self._pFns.length; i++) {
|
for (i = 0; i < self._pFns.length; i++) {
|
||||||
self._pFns[i]();
|
self._pFns[i]();
|
||||||
}
|
}
|
||||||
this.isPlaying = true;
|
self.isPlaying = true;
|
||||||
|
|
||||||
// this is the top level animation and is in full control
|
// this is the top level animation and is in full control
|
||||||
// of when the async play() should actually kick off
|
// of when the async play() should actually kick off
|
||||||
@ -271,7 +272,7 @@ export class Animation {
|
|||||||
self._before();
|
self._before();
|
||||||
|
|
||||||
// ensure all past transition end events have been cleared
|
// ensure all past transition end events have been cleared
|
||||||
this._clearAsync();
|
self._clearAsync();
|
||||||
|
|
||||||
if (duration > 30) {
|
if (duration > 30) {
|
||||||
// this animation has a duration, so it should animate
|
// this animation has a duration, so it should animate
|
||||||
@ -280,7 +281,8 @@ export class Animation {
|
|||||||
// set the FROM properties
|
// set the FROM properties
|
||||||
self._progress(0);
|
self._progress(0);
|
||||||
|
|
||||||
self._willChange(true);
|
// add the will-change or translateZ properties when applicable
|
||||||
|
self._willChg(true);
|
||||||
|
|
||||||
// set the async TRANSITION END event
|
// set the async TRANSITION END event
|
||||||
// and run onFinishes when the transition ends
|
// and run onFinishes when the transition ends
|
||||||
@ -316,7 +318,7 @@ export class Animation {
|
|||||||
|
|
||||||
// since there was no animation, it's done
|
// since there was no animation, it's done
|
||||||
// fire off all the onFinishes
|
// 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
|
// since there was no animation, it's done
|
||||||
// fire off all the onFinishes
|
// fire off all the onFinishes
|
||||||
self._onFinish(false);
|
self._didFinish(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,27 +359,57 @@ export class Animation {
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
function onTransitionEnd(ev) {
|
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
|
// ensure transition end events and timeouts have been cleared
|
||||||
self._clearAsync();
|
self._clearAsync();
|
||||||
|
|
||||||
// set the after styles
|
// set the after styles
|
||||||
self._after();
|
self._after();
|
||||||
self._willChange(false);
|
|
||||||
self._onFinish(shouldComplete);
|
// remove will change properties
|
||||||
|
self._willChg(false);
|
||||||
|
|
||||||
|
// 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
|
// set the TRANSITION END event on one of the transition elements
|
||||||
self._unregTrans = transitionEnd(self._transEl(), onTransitionEnd);
|
self._unregTrans = transitionEnd(self._transEl(), onTransitionEnd);
|
||||||
|
|
||||||
// set a fallback timeout if the transition end event never fires
|
// set a fallback timeout if the transition end event never fires, or is too slow
|
||||||
self._tmr = setTimeout(onTransitionEnd, duration + 300);
|
// transition end fallback: (animation duration + XXms)
|
||||||
|
self._tmr = setTimeout(onTransitionFallback, duration + 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
_clearAsync() {
|
_clearAsync() {
|
||||||
|
this._unregTrans && this._unregTrans();
|
||||||
if (this._tmr) {
|
if (this._tmr) {
|
||||||
this._unregTrans && this._unregTrans();
|
|
||||||
clearTimeout(this._tmr);
|
clearTimeout(this._tmr);
|
||||||
this._tmr = 0;
|
this._tmr = 0;
|
||||||
}
|
}
|
||||||
@ -483,13 +515,13 @@ export class Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_willChange(addWillChange: boolean) {
|
_willChg(addWillChange: boolean) {
|
||||||
var i: number;
|
var i: number;
|
||||||
var wc: string[];
|
var wc: string[];
|
||||||
var prop: string;
|
var prop: string;
|
||||||
|
|
||||||
for (i = 0; i < this._c.length; i++) {
|
for (i = 0; i < this._c.length; i++) {
|
||||||
this._c[i]._willChange(addWillChange);
|
this._c[i]._willChg(addWillChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._wChg) {
|
if (this._wChg) {
|
||||||
@ -652,8 +684,8 @@ export class Animation {
|
|||||||
// the progress was already left off at the point that is finished
|
// the progress was already left off at the point that is finished
|
||||||
// for example, the left menu was dragged all the way open already
|
// for example, the left menu was dragged all the way open already
|
||||||
this._after();
|
this._after();
|
||||||
this._willChange(false);
|
this._willChg(false);
|
||||||
this._onFinish(shouldComplete);
|
this._didFinish(shouldComplete);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// the stepValue was left off at a point when it needs to finish transition still
|
// the stepValue was left off at a point when it needs to finish transition still
|
||||||
@ -684,7 +716,7 @@ export class Animation {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onFinish(hasCompleted: boolean) {
|
_didFinish(hasCompleted: boolean) {
|
||||||
this.isPlaying = false;
|
this.isPlaying = false;
|
||||||
this.hasCompleted = hasCompleted;
|
this.hasCompleted = hasCompleted;
|
||||||
var i: number;
|
var i: number;
|
||||||
@ -790,6 +822,6 @@ const TRANSFORMS = {
|
|||||||
'skewX':1, 'skewY':1, 'perspective':1
|
'skewX':1, 'skewY':1, 'perspective':1
|
||||||
};
|
};
|
||||||
|
|
||||||
const cssValueRegex = /(^-?\d*\.?\d*)(.*)/;
|
const CSS_VALUE_REGEX = /(^-?\d*\.?\d*)(.*)/;
|
||||||
|
|
||||||
let AnimationRegistry = {};
|
let AnimationRegistry = {};
|
||||||
|
@ -125,7 +125,7 @@ export class Navbar extends ToolbarBase {
|
|||||||
private _bgRef: ElementRef;
|
private _bgRef: ElementRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @input {boolean} whether the back button should be shown or not
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
get hideBackButton(): boolean {
|
get hideBackButton(): boolean {
|
||||||
|
@ -317,10 +317,16 @@ export class Config {
|
|||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
static setModeConfig(mode, config) {
|
static setModeConfig(mode, config) {
|
||||||
modeConfigs[mode] = config;
|
modeConfigs[mode] = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
static getModeConfig(mode) {
|
static getModeConfig(mode) {
|
||||||
return modeConfigs[mode] || null;
|
return modeConfigs[mode] || null;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ const win :any = window;
|
|||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* // Sql storage also exposes the full engine underneath
|
* // 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) => {})
|
* storage.query('select * from projects').then((resp) => {})
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as util from '../../../ionic/util';
|
import * as util from 'ionic-angular/util';
|
||||||
|
|
||||||
export function run() {
|
export function run() {
|
||||||
describe('extend', function() {
|
describe('extend', function() {
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
System.config({
|
System.config({
|
||||||
map: {
|
map: {
|
||||||
angular2: '/base/angular2',
|
'angular2': '/base/angular2'
|
||||||
ionic: '/base/ionic'
|
},
|
||||||
|
packages: {
|
||||||
|
'ionic-angular': {
|
||||||
|
main: 'index'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
Reference in New Issue
Block a user